Rename module resolution option node to node10 (preserving backward-compatible alias) (#51901)

* Rename `node` to `node10` (preserving alias)

* Revert dogfooding change because of LKG

* Update baselines
This commit is contained in:
Andrew Branch authored and GitHub committed 2022-12-15 10:07:33 -08:00
1 parent 2993ea8eaa
commit e0bfac531b
236 files changed
+780 -628

No files matched your search

+8 -4
View File
@@ -961,12 +961,15 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [
{
name: "moduleResolution",
type: new Map(getEntries({
node: ModuleResolutionKind.NodeJs,
// N.B. The first entry specifies the value shown in `tsc --init`
node10: ModuleResolutionKind.Node10,
node: ModuleResolutionKind.Node10,
classic: ModuleResolutionKind.Classic,
node16: ModuleResolutionKind.Node16,
nodenext: ModuleResolutionKind.NodeNext,
bundler: ModuleResolutionKind.Bundler,
})),
deprecatedKeys: new Set(["node"]),
affectsModuleResolution: true,
paramType: Diagnostics.STRATEGY,
category: Diagnostics.Modules,
@@ -1685,8 +1688,9 @@ export function createCompilerDiagnosticForInvalidCustomType(opt: CommandLineOpt
}
function createDiagnosticForInvalidCustomType(opt: CommandLineOptionOfCustomType, createDiagnostic: (message: DiagnosticMessage, arg0: string, arg1: string) => Diagnostic): Diagnostic {
const namesOfType = arrayFrom(opt.type.keys()).map(key => `'${key}'`).join(", ");
return createDiagnostic(Diagnostics.Argument_for_0_option_must_be_Colon_1, `--${opt.name}`, namesOfType);
const namesOfType = arrayFrom(opt.type.keys());
const stringNames = (opt.deprecatedKeys ? namesOfType.filter(k => !opt.deprecatedKeys!.has(k)) : namesOfType).map(key => `'${key}'`).join(", ");
return createDiagnostic(Diagnostics.Argument_for_0_option_must_be_Colon_1, `--${opt.name}`, stringNames);
}
/** @internal */
@@ -3404,7 +3408,7 @@ function getExtendsConfigPath(
return extendedConfigPath;
}
// If the path isn't a rooted or relative path, resolve like a module
const resolved = nodeModuleNameResolver(extendedConfig, combinePaths(basePath, "tsconfig.json"), { moduleResolution: ModuleResolutionKind.NodeJs }, host, /*cache*/ undefined, /*projectRefs*/ undefined, /*lookupConfig*/ true);
const resolved = nodeModuleNameResolver(extendedConfig, combinePaths(basePath, "tsconfig.json"), { moduleResolution: ModuleResolutionKind.Node10 }, host, /*cache*/ undefined, /*projectRefs*/ undefined, /*lookupConfig*/ true);
if (resolved.resolvedModule) {
return resolved.resolvedModule.resolvedFileName;
}