--moduleResolution bundler (formerly known as hybrid) (#51669)

* 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`
This commit is contained in:
Andrew Branch
2022-12-13 13:35:16 -08:00
committed by GitHub
parent ad354c2d75
commit a5dde88dce
135 changed files with 4077 additions and 481 deletions

View File

@@ -135,8 +135,10 @@ class CompilerTest {
"module",
"moduleResolution",
"moduleDetection",
"allowImportingTsExtensions",
"target",
"jsx",
"noEmit",
"removeComments",
"importHelpers",
"importHelpers",
@@ -161,6 +163,8 @@ class CompilerTest {
"useUnknownInCatchVariables",
"noUncheckedIndexedAccess",
"noPropertyAccessFromIndexSignature",
"resolvePackageJsonExports",
"resolvePackageJsonImports",
];
private fileName: string;
private justName: string;

View File

@@ -170,4 +170,4 @@ export function updateProgram(oldProgram: ProgramWithSourceTexts, rootNames: rea
export function updateProgramText(files: readonly NamedSourceText[], fileName: string, newProgramText: string) {
const file = ts.find(files, f => f.name === fileName)!;
file.text = file.text.updateProgram(newProgramText);
}
}