* feat(48665): resolve configs from the exports field of the source package
* add missed property
* rename loadFileName to loadFileNameFromPackageJsonField
* Apply suggestions from code review
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* feat(51000): add ignoreDeprecations option
* use constants of versions
* change the ignoreDeprecations type to allow only one value - '5.0'
* add tests
* update baseline
* add typeScriptVersion to CreateProgramOptions
* update baseline
* change diagnostic message
* WIP
* Add extension error back unless noEmit is set
* Add non-relative tests
* Add error for importing from declaration file
* Update unit test
* Add explicit flag for importing from .ts extensions
* Add module specifier resolution changes
* Add auto-import tests
* Disallow relative imports into node_modules
* Ensure auto-imports don’t suggest ./node_modules;
* Test a non-portable declaration emit issue
* Test auto-importing TSX file
* Update path completions
* Fix lint due to merge
* Remove minimal-specific stuff
* Remove minimal tests
* Update unit tests
* Add options
* Add customConditions option
* Add first tests
* CJS constructs are not allowed
* Add another test
* Fix extension adding/replacing priority
* Update test to reflect the choice not to block on unrecognized extensions
* Add auto-imports and string completions tests
* Revamp string completions ending preferences
* Comment test
* Auto-imports of declaration files cannot use .ts extension
* Have declaration file auto imports default to extensionless instead
* Add test for custom conditions
* Fix indentation
* Add baseline showing resolvePackageJsonImports/Exports compatibility
* Fix test and prevent CJS require from resolving
* Update unit test baselines
* Fix bad merge conflict resolution
* Make resolvedUsingTsExtension optional
* Update missed baselines
* Revert now-unnecessary API implementation changes
* Clean up
* Update baselines to es5 emit
* Rename to `bundler`
* tsconfig.extends as array
* Updated baselines
* Changes for pr
* Changes for pr comments
* Fixed formatting and edited a test
* Resolved errors after a merge conflict
* Added "string | list" type implentation
* Removed string | list type implementation
* Fixed formatting
* Added compiler test
* Resolving programUpdate errors
* Fixing commandLineParser error
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.
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.
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
* 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
* Add failing test
* Fix the implicit glob key so that recursive keys are not differing just by directory seperator
Fixes#49078
* Reset the reload level once program is loaded
* Remove Node12, add Node16.
* Accepted baselines.
* Refactor checking for top-level await, give a better error message in CJS files.
* Accepted baselines.
* Stop erroring on JSON module imports in node ESM since they're no longer experimental.
* Accepted baselines.
* More refactoring, do the same checks for for-await loops.
* Accepted baselines.
* Adjust phrasing to permit for-await on CJS error.
* Accepted baselines.
* Accepted baselines.
* Fix lints.
* Add moduleSuffixes compiler option and related tests. Update baselines for compiler options tests.
* Add a flag to the command-line parser which allows "list" params to preserve "falsy" values such as empty strings. Falsy values are normally stripped out.
* Add tests. Rework resolver logic to only run module-suffix code when needed.
* PR feedback
* Add test
* Remove unnecessary conditional.