* Refactoring so CacheWithRedirects has Key and Value type parameters
* ModuleResolutionCache or TypeRefDirectiveCache will look in directory before solving, so ResolutionCache doesnt need this check
* Test showing module resolution is not shared because resolution cache doesnt update own options
* Enable traceResolution on some of the project reference tests
* Simplify CacheWithRedirects and ensure the options are set in all common scenarios so cache can be shared between redirects
* Make failedlookup etc optional in ResolvedModule/TypeRefefWithFailedLookupLocations
Also make accidental public failed lookup internal
* Add new API for module and type ref resolution
* Store auto type reference resolutions
* Modify test to show how using program partially doesnt report resolution diagnostics
* Ensure that resolution diagnostics are reported in filePreocessingDiagnostics so they can be reused when program is reused
* Some cleanup
* Remove the newly added ReoslutionInfo in favor of new APIs
* update
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.
* 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
* 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
* Add test when declaration emit has errors and d.ts emit doesnt change which results in incorrect incremental behaviour
* Refactor
* Use declaration diagnostics in the d.ts signature for the file so it can be more accurate for detecting changes to file that could affect other files
Fixes#49527
* Renames and clarifications
* Simplify serialize declaration diagnostics for signature purpose
Do not serialize file name if error is in same file we are emitting. this should avoid having to do file path computation in most cases.
Locations are start and length instead of line and character.
Do not use any indents
* Fix baselines
* Use fixed time for vfs so baselining is consistent
* Baseline buildinfos
* Write new file text in baseline even if the file wasnt read on the shadow
* Remove unnecessary debugger statement
* Make sure that incremental correctness is checked with correct writeFile so we know buildInfo was written
Also baseline these so its easy to verify the changes
* More baselines for the tsbuildinfo
* If we are writing dts file and have used file text as version, we can update the signature when doing actual emit
* Make WriteFileCallback Api ready for future
* Assert that there is only single source file when emitting d.ts file
* Add test
* Renames
* More refactoring
* If we are updating dts of any of the file and it affects global scope, everything needs update in signature and dts emit
Fixes#42769
* Stacktrace optimization for getModified time in anticipation of using it more than fileExists wherever possible
* Baseline getModifiedTime, setModifiedTime, fileExits and directoryExits for experiment
* Remove unnecessary write file finger print code since its not used at all
* Use modified time instead of file existence check
* Remove unnecessary getModifiedTime
* No need to check for file existence before reading the d.ts file
* Do project reference errors before doing input/output file checks
* Dont call getModifiedTimes if dts change
* Passdown modified time if queried
* Use modified time passed through the file watching in tsbuild
* Handle force build as separate upto date status
* uptodate status worker to read buildinfo and use it to determine upto date ness
* No need to update output timestamps if buildinfo will determine uptodateness
* Store change file set instead of hasPendingChange to be able to reuse the information
* Add test that shows input file is not present
* No need to check input time stamp before buildinfo
* Keep buildinfos for lifetime of the solution builder and project
* Store modified time along with text of buildinfo
* Non composite projects dont need to track declaration change time
* Pass through buildInfo so we dont have to parse it back
* Save dts change time in buildinfo itself
* Store dts time for --out in the buildInfo
* Store hash of text in the bundle info so it can be verified before manipulating text for fast updates during prepend
This helps when text changes during incremental build toggling and we determine we can just manipulate text
* Since buildinfo is cached no need to maintain version check state
* Store output time stamps for non incremental builds
* Revert "Baseline getModifiedTime, setModifiedTime, fileExits and directoryExits for experiment"
This reverts commit 7e65cd3315ccf387f6d7e7c40263e85bcc3c961c.
* Change verbose messages for upto date status
* Reconcile reusable builder state and builder state so there are not two different types that are almost similar looking
* Cleanup impliedFormat
* Cleanup
* Cleanup noEmit option
* BuildInfo options emit as a flag
* Factor out types for program written in buildinfo with and without bundle emit
* No need to store output file stamps if not in watch mode
* Cleanup
* Test for single watch per file
* Fix emit and error update baselines that were duplicate
* More refactoring
* Only copy emit state fields when backing up to restore if emit fails
* Instead of maintaining delta of changes, maintain old state for those changes
* Add test to verify build when input file does not change
* If version of the input file does not change, dont mark as out of date
* Disable lint warning as build fails without the assert
* Report aggregate statistics for solution as well as some solution perf numbers
* Options solutionDiagnostics instead so that its not too verbose when printing diagnostics
* When tsc --build --clean, only remove tsbuildinfo if its incremental build
* Revert "Options solutionDiagnostics instead so that its not too verbose when printing diagnostics"
This reverts commit 0cf9e301038267bc1d9439c15d279940809b0c00.
* Revert "Report aggregate statistics for solution as well as some solution perf numbers"
This reverts commit 405d8e91978708a613fe8cb631a83b13c430a808.
* Revert "When tsc --build --clean, only remove tsbuildinfo if its incremental build"
This reverts commit e4e66726098201f38f5e8908a538e7a506f15efd.
* Comments in the code
* Feedback
* If we are writing dts file and have used file text as version, we can update the signature when doing actual emit
* Make WriteFileCallback Api ready for future
* Assert that there is only single source file when emitting d.ts file
* Revert "Avoid no-op export map updates (#45238)"
This reverts commit 0f6e6efde08385916602e254f406f1703907b2a5.
* Need to reset currentAffectedFilesExportedModulesMap after commiting to final exports map
* When checking for incremental correctness always calculate signature
* Fix the issue with not serializing impliedFormat when signature == version of the file
* Initial support for module: node12
* Add allowJs and declaration emit enabled tests
* Fix typos
* cts, mts, cjs, mjs, etc extension support
* Fix watch of files whose intepretation changes due to a package.json update
* Minor PR feedback
* Adjust error message
* Initial import/export/self-name support
* Accept new error codes
* TypesVersions support in export/import map conditions
* Fix import suggestion and autoimport default extensions under new resolution modes
* Add tests for import maps non-relative name lookup feature
* Fix isDeclarationFileName for .d.mts and .d.cts
* Preserve new extensions when generating module specifiers
* Fix spurious implict any suggestion caused by file ordering bug and optimize import name format detection by relying on parents being set
* Fix a bunch of incremental bugs that dont repro under fourslash for some reason
* Accept updated baseline
* Always include extensions on completions for cjs/mjs style imports
* String completion relative import suggestions respect the mode of the import when choosing if they provide extensions
* Style feedback
* Change diagnostic case
* Add id and version to ManyToManyPathMap
...so that unchanged maps can be recognized without having to examine
their contents.
* Track cache version on BuilderState
In practice, `updateExportedFilesMapFromCache` is called repeatedly
without the cache changing in between. When this occurs, there's no
need to update the `BuilderState` (this was already the net effect, but
it took a long time to determine that no work was required).
* Fix typo in comment
* add shape updates to baselines
* avoid computing a full shape for indirectly invalidated files
using file version as shape is enough to keep build info valid
and it's much cheaper
* Make export-module and reference maps invertible
Right now, we're enumerating all the entries to find out which keys map
to a corresponding value. By maintaining a two-way map, we can convert
this linear search into a map lookup and skip allocation of many, many
iterator results.
* Fix lint error
* Add some explanatory comments
* Rename, drop type parameters, and add readonly variant
* Simplify member list
* Fold non-exporting behavior into custom map type
* Serialize compiler options that are needed from old state when creating new state
* Dont write affectsGlobalScope if not true
* Encode FileInfo for better serialization size
* Update src/compiler/builder.ts
Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
* Extra tests in preparation for lazy signature making sure the original intent of test is maintained
* Whenver we cant use state delay signature calculation and use source file version as signature
* Incremental correctness checks
* Retain old behavior in compile on save by disabling use of file version as signature in when state is not reused
* Test update
* Use source file version as default signature for the file whenever there is no dts emit for the file
* json source files from project reference should be able to calculate the signature
* Dont emit declaration map when emitting dts files for force emit for signature
* Add undefined to Symbol.declarations' type
Symbol.declarations now has type `Declaration[] | undefined`.
I made a mistake somewhere in the checker related to JS checking, so
there are quite a few test failures right now.
* undo clever change to getDeclaringConstructor
* Address PR comments
1. More early-returns.
2. More line breaks.
* Add full implemention of Map and Set to shims
* Update default Map interface
* Remove WeakMap/WeakSet
* Add tests for set shim
* Update most usages of Map<K, true> to Set
* PR Feedback
* Fix lint issues
* Change key in fsWatchCallback
* Simpler shim, more tests
* Fix typo in collection shim