* 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>
* 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`
* Make the non relative name resolution cache generic
* Add cache for non relative type reference resolution
* Add getter only methods so we can use these in future for sharing resolutions across the projects
* Mark existing non relative module name cache getOrCreate as deprecated
* Prefer getters for getting directory results
* 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
* 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
* Refactor `Extensions`, fix lookup priorities
* Update baselines
* Clean up
* Temporarily apply same fix to `node` for testing
* Revert ancestor node_modules lookups back to two passes
* Revert "Temporarily apply same fix to `node` for testing"
This reverts commit 4014f3005a2a01a5c71a88e6418cc635498a83bc.
* Update baselines
* Add new test for node_modules searching behavior
* Update new baseline
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.
* 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 test for node16 resolution with package json lookup making casing incorrect
* Handle more places where package direcroy is converted to canonical file path
* Add test to show how scope messes with casing
* Do not canonicalize the file names when getting absolute paths
Fixes#50544
* Unnecessary exports
* Add test for self referencing package
* Fix self reference package with casing
* Add test where module resolution cache is not local and hence doesnt report errors in watch mode
* Ensure module resolution cache is passed through in watch mode
* Remove unnecessary setting of impliedFormat which should anyways be done as part of create source file
* Add test for packge.json changing and modifying implied format
* Distinguish between package.json watch and affecting file location watch
* Pass in failed lookup and affected file locations for source file's implied format
Also stop creating options if we already have them
* Add diagnostic for explaining file's implied format if based on package.json
* Watch implied format dependencies for modules and schedule update on change
* For program if implied node format doesnt match create new source file. Handle implied node format in document registry
Fixes#50086
* Modify tests to show package.json being watched irrespective of folder its in
* Check file path if it can be watched before watching package.json file
* Because we are watching package.json files and failed lookups its safe to invalidate package json entries instead of clearing them out everytime program is created
* Remove todos
* Fix the incorrect merge
* Pickup PackageJsonInfo renames from #50088
* Rename
* Support path completions for exports wildcards
* Break up results by directory
* Share code between typesVersions and exports processing
* Revert completion kind change
* Add kinds to tests
* Update existing test
* Support nested conditions, improve recursive globbing
* Allow export map entries to remap back to input files for a program
* Fix file casing issues on windows
* Implement abiguity error, doesnt quite work
* Refine selection logic in error case to use getCommonSourceDirectory, add more tests
* 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.
* Prototype resolving to JS when go-to-def aliases all resolve to ambient declarations
* Add test infrastructure
* Start fleshing out test coverage
* Fix some go-to-def stuff
* Finish lodash test case
* Make go-to-implementation never return ambient results
* Build new functionality into go-to-implementation
* Update baselines
* Two more test cases
* Refine definition searches for unresolved imports
* Revert "Build new functionality into go-to-implementation"
This reverts commit 381799d0f104000c676334c8e08fcdff9ccac896.
* Fix tests
* Revert go-to-implementation changes
* Wow a bunch of code was unnecessary
* Update baselines and go-to-def test
* Fix navigation on symbols that are not aliases but resolve through aliases in chain
* Temporarily replace go-to-def with new command implementation
* Revert "Temporarily replace go-to-def with new command implementation"
This reverts commit 34c6cfdebbb9e2506ea5e6d528d2cb57b2cdeb2e.
* Revert "Wow a bunch of code was unnecessary"
This reverts commit 1cb2ba646c9e80d1ca08b6fc3f6a2219aac44f67.
* Bring back some deleted code needed for a new test case
* Clean up a little
* Rename more stuff
* Update test
* Update API baseline
* Temporarily replace go-to-def with new command implementation
* PR review fixes
* Fix getTopMostDeclarationNamesInFile
* Rename local
* Use hash set
* Remove option from commandLineParser
* Keep noDtsResolution project around
* Handle AuxiliaryProject kind in ScriptInfo getDefaultProject etc.
* Do not run updateGraph in the background for AuxiliaryProject
* Don’t create auxiliary project outside of semantic mode
* No-op on scheduled invalidation
* Add comments to unit test
* Sync compiler options to auxiliary project
* Fix case sensitivity
* Update extensionIsOk with new file extensions
* PR feedback
* Update API baseline
* Mark scheduleInvalidateResolutionsOfFailedLookupLocations internal
* Use same heuristics on property accesses of loosely-resolvable aliases as unresolvable named imports
* Rename command, and no need to return the bound span
* Update API baseline
* 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.
* Triple-slash reference type directives can override the import mode used for their resolution
They now use the file's default mode by default, rather than always using commonjs. The new arguments to the
reference directive look like:
```ts
///<reference types="pkg" resolution-mode="require" />
```
or
```ts
///<reference types="pkg" resolution-mode="import" />
```
* Omit redundant import modes in emitter
* Add test for #47806
* Add server test for triple-slash reference mode overrides
* Move FileReference mode into helper
* Update tests/cases/conformance/node/nodeModulesTripleSlashReferenceModeOverride3.ts
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>