This adds a "small" d.ts bundler script. This script is very basic,
using Node printing to produce its output. Generally speaking, this is
inadvisable as it completely disregards name shadowing, globals, etc.
However, in our case, we don't care about the globals, and we can opt to
restructure our codebase in order to avoid conflict, which we largely
had to do anyway when we were namespaces and everything was in scope.
This configures the existing build tasks to use esbuild by default. If
using the plain files is desired, passing `--bundle=false` will build
using plain files and still produce a runnable system.
This is only a basic build; a more efficient build is provided later
when gulp is replaced by hereby.
Although the existing require calls would work fine, it's more
consistent to make them actual imports and let them be converted at
compile/bundle time. It also lets us emit ESM if needed.
There are still conditional requires present for things like the node
System, but that's a more difficult problem to solve.
If these are regular comments, then they won't appear in our d.ts files.
But, now we are relying on an external d.ts bundler to produce our final
merged, so they need to be present in the "input" d.ts files, meaning
they have to be JSDoc comments.
These comments only work today because all of our builds load their TS
files from scratch, so they see the actual source files and their
non-JSDoc comments.
The comments also need to be attached to a declaration, not floating,
otherwise they won't be used by api-extractor, so move them if needed.
Now that we are modules, there's no reason to ban multiple namespaces
per file; each file is its own scope and declaring a namespace won't
merge it into any other files.
While GitHub automatically uses this file if present, GitLens in VS Code
does not. Add the right option to our example settings.json for those
who use the extension.
Unfortunately, you can't leave this enabled if you want to look at the
repo _without_ the file; git blame just crashes when the file isn't
present. I'm not sure that there's a workaround for that.
This step converts as many explicit accesses as possible in favor of direct imports from the modules in which things were declared. This restores the code (as much as possible) back to how it looked originally before the explicitify step, e.g. instead of "ts.Node" and "ts.Symbol", we have just "Node" and "Symbol".
This step converts each file into an exported module by hoisting the namespace bodies into the global scope and transferring internal markers down onto declarations as needed.
The namespaces are reconstructed as "barrel"-style modules, which are identical to the old namespace objects in structure. These reconstructed namespaces are then imported in the newly module-ified files, making existing expressions like "ts." valid.
* Fixed a regression with discriminating unions based on a union property against `undefined` with `strictNullChecks: false`
* Add additional test case from the issue comment
* Test showing wrong resolution is returned because of incorrect mode calculation
Test for #48229
* Pass in information for the module name resolution when resolutions from file are partially used
Fixes#48229
* Make the resolution info complete
* Add different tests for baselining before behavior
* Fix assert for first project output
* Add ability to pass declaration, declarationMap, emitDeclarationOnly, sourceMap and inlineSourceMap on commandline of --build
* Store these options in --out scenario
* Store buildInfo program for --out even if not composite
* Changes to make these commanline options work
* Do not include sourceMapUrl text in the sourceFile version
* Emit complete program in --out scenario as well since we need to determine uptodate ness
* Copy js or dts bundle from old build if emitting only js or dts files
* Dont emit dts if we want to emit only js files even though options suggest emitting d.ts files as well
* Adding comments and refactoring some of the code
* Emit diagnostics when just manipuating bundle at that time itself
[4:04:42 PM] Updating output of project '/TypeScript/src/tsserver/tsconfig.json'...
Memory used: 581215K
transformTime time: 0.01s
Source Map time: 0.35s
commentTime time: 0.00s
printTime time: 0.58s
Emit time: 0.90s
I/O Write time: 0.01s
Total time: 0.90s
* Pull out getSourceFile and writeFile in a function
* Fix incorrect solutionPerformance reporting in watch mode
* Remove unnecessary build info read when host can give cached buildInfo
* Simplify overloads
* Accept API change
* Convert some of the tests to baselines
* There is no use of creating reference map with --out since its not used anyways.
The changes to affectedFileList returned should be intended since --out needs saving just one file for correct output and not both
* Fix enum classification and evaluation
* References in literal enums must be to other enum members
* Accept new baselines
* Unify enum types + template literal constant expressions
* Accept new baselines
* Fix fourslash tests
* Fix new compiler errors
* Fix lint error
* Accept new API baselines
* Fix test
* Better error message + consistently check enum initializers
* Accept new baselines
* Add test that fails
* Handle impliedNodeFormat when handling sourceFileCache
Fixes#50872
* Revert the fix
* Make sure impliedNodeFormat is set for the sourceFile
* Revert "Make sure impliedNodeFormat is set for the sourceFile"
This reverts commit 651a47fdd6ea200e59fdf150dfa913230a86653a.
* Revert "Revert the fix"
This reverts commit 5c98b9cfc1f275877d8d57a60f8f28a5c8d08157.
* Swap the keys for map