@typescript-deploys/pr-build 5.3.0-pr-52972-6 → 5.3.0-pr-55820-7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.dom.d.ts +4 -0
- package/lib/lib.webworker.d.ts +2 -0
- package/lib/tsc.js +178 -166
- package/lib/tsserver.js +249 -230
- package/lib/typescript.js +249 -225
- package/lib/typingsInstaller.js +10 -6
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.3";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20230921`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -7689,7 +7689,7 @@ var Diagnostics = {
|
|
|
7689
7689
|
Could_not_convert_to_arrow_function: diag(95151, 3 /* Message */, "Could_not_convert_to_arrow_function_95151", "Could not convert to arrow function"),
|
|
7690
7690
|
Could_not_convert_to_named_function: diag(95152, 3 /* Message */, "Could_not_convert_to_named_function_95152", "Could not convert to named function"),
|
|
7691
7691
|
Could_not_convert_to_anonymous_function: diag(95153, 3 /* Message */, "Could_not_convert_to_anonymous_function_95153", "Could not convert to anonymous function"),
|
|
7692
|
-
|
|
7692
|
+
Can_only_convert_string_concatenations_and_string_literals: diag(95154, 3 /* Message */, "Can_only_convert_string_concatenations_and_string_literals_95154", "Can only convert string concatenations and string literals"),
|
|
7693
7693
|
Selection_is_not_a_valid_statement_or_statements: diag(95155, 3 /* Message */, "Selection_is_not_a_valid_statement_or_statements_95155", "Selection is not a valid statement or statements"),
|
|
7694
7694
|
Add_missing_function_declaration_0: diag(95156, 3 /* Message */, "Add_missing_function_declaration_0_95156", "Add missing function declaration '{0}'"),
|
|
7695
7695
|
Add_all_missing_function_declarations: diag(95157, 3 /* Message */, "Add_all_missing_function_declarations_95157", "Add all missing function declarations"),
|
|
@@ -11431,22 +11431,6 @@ function usingSingleLineStringWriter(action) {
|
|
|
11431
11431
|
function getFullWidth(node) {
|
|
11432
11432
|
return node.end - node.pos;
|
|
11433
11433
|
}
|
|
11434
|
-
function getResolvedModule(sourceFile, moduleNameText, mode) {
|
|
11435
|
-
var _a, _b;
|
|
11436
|
-
return (_b = (_a = sourceFile == null ? void 0 : sourceFile.resolvedModules) == null ? void 0 : _a.get(moduleNameText, mode)) == null ? void 0 : _b.resolvedModule;
|
|
11437
|
-
}
|
|
11438
|
-
function setResolvedModule(sourceFile, moduleNameText, resolvedModule, mode) {
|
|
11439
|
-
if (!sourceFile.resolvedModules) {
|
|
11440
|
-
sourceFile.resolvedModules = createModeAwareCache();
|
|
11441
|
-
}
|
|
11442
|
-
sourceFile.resolvedModules.set(moduleNameText, mode, resolvedModule);
|
|
11443
|
-
}
|
|
11444
|
-
function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective, mode) {
|
|
11445
|
-
if (!sourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
11446
|
-
sourceFile.resolvedTypeReferenceDirectiveNames = createModeAwareCache();
|
|
11447
|
-
}
|
|
11448
|
-
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, mode, resolvedTypeReferenceDirective);
|
|
11449
|
-
}
|
|
11450
11434
|
function projectReferenceIsEqualTo(oldRef, newRef) {
|
|
11451
11435
|
return oldRef.path === newRef.path && !oldRef.prepend === !newRef.prepend && !oldRef.circular === !newRef.circular;
|
|
11452
11436
|
}
|
|
@@ -11454,8 +11438,8 @@ function moduleResolutionIsEqualTo(oldResolution, newResolution) {
|
|
|
11454
11438
|
return oldResolution === newResolution || oldResolution.resolvedModule === newResolution.resolvedModule || !!oldResolution.resolvedModule && !!newResolution.resolvedModule && oldResolution.resolvedModule.isExternalLibraryImport === newResolution.resolvedModule.isExternalLibraryImport && oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension && oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName && oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath && packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId) && oldResolution.node10Result === newResolution.node10Result;
|
|
11455
11439
|
}
|
|
11456
11440
|
function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageName) {
|
|
11457
|
-
var _a, _b;
|
|
11458
|
-
const node10Result = (_b = (_a =
|
|
11441
|
+
var _a, _b, _c;
|
|
11442
|
+
const node10Result = (_c = (_b = (_a = host.resolvedModules) == null ? void 0 : _a.get(sourceFile.path)) == null ? void 0 : _b.get(moduleReference, mode)) == null ? void 0 : _c.node10Result;
|
|
11459
11443
|
const result = node10Result ? chainDiagnosticMessages(
|
|
11460
11444
|
/*details*/
|
|
11461
11445
|
void 0,
|
|
@@ -16470,14 +16454,11 @@ function createSymlinkCache(cwd, getCanonicalFileName) {
|
|
|
16470
16454
|
(symlinkedDirectories || (symlinkedDirectories = /* @__PURE__ */ new Map())).set(symlinkPath, real);
|
|
16471
16455
|
}
|
|
16472
16456
|
},
|
|
16473
|
-
setSymlinksFromResolutions(
|
|
16474
|
-
var _a, _b;
|
|
16457
|
+
setSymlinksFromResolutions(resolvedModules, resolvedTypeReferenceDirectiveNames, typeReferenceDirectives) {
|
|
16475
16458
|
Debug.assert(!hasProcessedResolutions);
|
|
16476
16459
|
hasProcessedResolutions = true;
|
|
16477
|
-
|
|
16478
|
-
|
|
16479
|
-
(_b = file.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _b.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
16480
|
-
}
|
|
16460
|
+
resolvedModules == null ? void 0 : resolvedModules.forEach((cache) => cache.forEach((resolution) => processResolution(this, resolution.resolvedModule)));
|
|
16461
|
+
resolvedTypeReferenceDirectiveNames == null ? void 0 : resolvedTypeReferenceDirectiveNames.forEach((cache) => cache.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective)));
|
|
16481
16462
|
typeReferenceDirectives.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
16482
16463
|
},
|
|
16483
16464
|
hasProcessedResolutions: () => hasProcessedResolutions
|
|
@@ -21462,7 +21443,6 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
21462
21443
|
node.imports = void 0;
|
|
21463
21444
|
node.moduleAugmentations = void 0;
|
|
21464
21445
|
node.ambientModuleNames = void 0;
|
|
21465
|
-
node.resolvedModules = void 0;
|
|
21466
21446
|
node.classifiableNames = void 0;
|
|
21467
21447
|
node.impliedNodeFormat = void 0;
|
|
21468
21448
|
return node;
|
|
@@ -34091,6 +34071,7 @@ var moduleOptionDeclaration = {
|
|
|
34091
34071
|
node16: 100 /* Node16 */,
|
|
34092
34072
|
nodenext: 199 /* NodeNext */
|
|
34093
34073
|
})),
|
|
34074
|
+
affectsSourceFile: true,
|
|
34094
34075
|
affectsModuleResolution: true,
|
|
34095
34076
|
affectsEmit: true,
|
|
34096
34077
|
affectsBuildInfo: true,
|
|
@@ -34527,6 +34508,7 @@ var commandOptionsWithoutBuild = [
|
|
|
34527
34508
|
bundler: 100 /* Bundler */
|
|
34528
34509
|
})),
|
|
34529
34510
|
deprecatedKeys: /* @__PURE__ */ new Set(["node"]),
|
|
34511
|
+
affectsSourceFile: true,
|
|
34530
34512
|
affectsModuleResolution: true,
|
|
34531
34513
|
paramType: Diagnostics.STRATEGY,
|
|
34532
34514
|
category: Diagnostics.Modules,
|
|
@@ -35069,6 +35051,7 @@ var commandOptionsWithoutBuild = [
|
|
|
35069
35051
|
legacy: 1 /* Legacy */,
|
|
35070
35052
|
force: 3 /* Force */
|
|
35071
35053
|
})),
|
|
35054
|
+
affectsSourceFile: true,
|
|
35072
35055
|
affectsModuleResolution: true,
|
|
35073
35056
|
description: Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
|
|
35074
35057
|
category: Diagnostics.Language_and_Environment,
|
|
@@ -35088,7 +35071,7 @@ var semanticDiagnosticsOptionDeclarations = optionDeclarations.filter((option) =
|
|
|
35088
35071
|
var affectsEmitOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsEmit);
|
|
35089
35072
|
var affectsDeclarationPathOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsDeclarationPath);
|
|
35090
35073
|
var moduleResolutionOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsModuleResolution);
|
|
35091
|
-
var sourceFileAffectingCompilerOptions = optionDeclarations.filter((option) => !!option.affectsSourceFile || !!option.
|
|
35074
|
+
var sourceFileAffectingCompilerOptions = optionDeclarations.filter((option) => !!option.affectsSourceFile || !!option.affectsBindDiagnostics);
|
|
35092
35075
|
var optionsAffectingProgramStructure = optionDeclarations.filter((option) => !!option.affectsProgramStructure);
|
|
35093
35076
|
var transpileOptionValueCompilerOptions = optionDeclarations.filter((option) => hasProperty(option, "transpileOptionValue"));
|
|
35094
35077
|
var optionsForBuild = [
|
|
@@ -37463,15 +37446,6 @@ function createModeAwareCache() {
|
|
|
37463
37446
|
return result;
|
|
37464
37447
|
}
|
|
37465
37448
|
}
|
|
37466
|
-
function zipToModeAwareCache(file, keys, values, nameAndModeGetter) {
|
|
37467
|
-
Debug.assert(keys.length === values.length);
|
|
37468
|
-
const map2 = createModeAwareCache();
|
|
37469
|
-
for (let i = 0; i < keys.length; ++i) {
|
|
37470
|
-
const entry = keys[i];
|
|
37471
|
-
map2.set(nameAndModeGetter.getName(entry), nameAndModeGetter.getMode(entry, file), values[i]);
|
|
37472
|
-
}
|
|
37473
|
-
return map2;
|
|
37474
|
-
}
|
|
37475
37449
|
function getOriginalOrResolvedModuleFileName(result) {
|
|
37476
37450
|
return result.resolvedModule && (result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
|
|
37477
37451
|
}
|
|
@@ -46313,7 +46287,7 @@ function createTypeChecker(host) {
|
|
|
46313
46287
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
|
|
46314
46288
|
}
|
|
46315
46289
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
46316
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
46290
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
46317
46291
|
if (startsWith(moduleReference, "@types/")) {
|
|
46318
46292
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
46319
46293
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -46331,7 +46305,7 @@ function createTypeChecker(host) {
|
|
|
46331
46305
|
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = findAncestor(location, isImportCall)) == null ? void 0 : _a.arguments[0]) || ((_b = findAncestor(location, isImportDeclaration)) == null ? void 0 : _b.moduleSpecifier) || ((_c = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _c.moduleReference.expression) || ((_d = findAncestor(location, isExportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _e.name) || ((_f = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _f.argument.literal);
|
|
46332
46306
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
46333
46307
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
46334
|
-
const resolvedModule =
|
|
46308
|
+
const resolvedModule = (_i = (_h = (_g = host.resolvedModules) == null ? void 0 : _g.get(currentSourceFile.path)) == null ? void 0 : _h.get(moduleReference, mode)) == null ? void 0 : _i.resolvedModule;
|
|
46335
46309
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
46336
46310
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
46337
46311
|
if (sourceFile) {
|
|
@@ -46339,7 +46313,7 @@ function createTypeChecker(host) {
|
|
|
46339
46313
|
error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
46340
46314
|
}
|
|
46341
46315
|
if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
|
|
46342
|
-
const importOrExport = ((
|
|
46316
|
+
const importOrExport = ((_j = findAncestor(location, isImportDeclaration)) == null ? void 0 : _j.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
46343
46317
|
if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
|
|
46344
46318
|
error(
|
|
46345
46319
|
errorNode,
|
|
@@ -46348,7 +46322,7 @@ function createTypeChecker(host) {
|
|
|
46348
46322
|
);
|
|
46349
46323
|
}
|
|
46350
46324
|
} else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
|
|
46351
|
-
const importOrExport = ((
|
|
46325
|
+
const importOrExport = ((_k = findAncestor(location, isImportDeclaration)) == null ? void 0 : _k.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
46352
46326
|
if (!((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
|
|
46353
46327
|
const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
|
|
46354
46328
|
error(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
|
|
@@ -46369,7 +46343,7 @@ function createTypeChecker(host) {
|
|
|
46369
46343
|
if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
|
|
46370
46344
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
46371
46345
|
const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
46372
|
-
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (
|
|
46346
|
+
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_l = overrideClauseHost.assertions) == null ? void 0 : _l.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
46373
46347
|
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) {
|
|
46374
46348
|
if (findAncestor(location, isImportEqualsDeclaration)) {
|
|
46375
46349
|
error(errorNode, Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
|
|
@@ -46476,7 +46450,7 @@ function createTypeChecker(host) {
|
|
|
46476
46450
|
error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
46477
46451
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
46478
46452
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
46479
|
-
const suggestedExt = (
|
|
46453
|
+
const suggestedExt = (_m = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _m[1];
|
|
46480
46454
|
if (suggestedExt) {
|
|
46481
46455
|
error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
|
|
46482
46456
|
} else {
|
|
@@ -47775,7 +47749,7 @@ function createTypeChecker(host) {
|
|
|
47775
47749
|
}
|
|
47776
47750
|
return factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, constraintNode));
|
|
47777
47751
|
}
|
|
47778
|
-
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.flags & 262144 /* TypeParameter */
|
|
47752
|
+
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.flags & 262144 /* TypeParameter */) {
|
|
47779
47753
|
const name2 = typeParameterToName(type, context);
|
|
47780
47754
|
context.approximateLength += idText(name2).length;
|
|
47781
47755
|
return factory.createTypeReferenceNode(
|
|
@@ -48541,36 +48515,65 @@ function createTypeChecker(host) {
|
|
|
48541
48515
|
true
|
|
48542
48516
|
)[0];
|
|
48543
48517
|
let cleanup;
|
|
48544
|
-
if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) {
|
|
48545
|
-
|
|
48546
|
-
|
|
48547
|
-
|
|
48548
|
-
|
|
48549
|
-
|
|
48550
|
-
if (
|
|
48551
|
-
|
|
48552
|
-
|
|
48553
|
-
|
|
48554
|
-
|
|
48555
|
-
|
|
48556
|
-
|
|
48518
|
+
if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && (some(expandedParams) || some(signature.typeParameters))) {
|
|
48519
|
+
let pushFakeScope2 = function(kind2, addAll) {
|
|
48520
|
+
Debug.assert(context.enclosingDeclaration);
|
|
48521
|
+
let existingFakeScope;
|
|
48522
|
+
if (getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration === kind2) {
|
|
48523
|
+
existingFakeScope = context.enclosingDeclaration;
|
|
48524
|
+
} else if (context.enclosingDeclaration.parent && getNodeLinks(context.enclosingDeclaration.parent).fakeScopeForSignatureDeclaration === kind2) {
|
|
48525
|
+
existingFakeScope = context.enclosingDeclaration.parent;
|
|
48526
|
+
}
|
|
48527
|
+
Debug.assertOptionalNode(existingFakeScope, isBlock);
|
|
48528
|
+
const locals = (existingFakeScope == null ? void 0 : existingFakeScope.locals) ?? createSymbolTable();
|
|
48529
|
+
let newLocals;
|
|
48530
|
+
addAll((name, symbol) => {
|
|
48531
|
+
if (!locals.has(name)) {
|
|
48532
|
+
newLocals = append(newLocals, name);
|
|
48533
|
+
locals.set(name, symbol);
|
|
48534
|
+
}
|
|
48535
|
+
});
|
|
48536
|
+
if (!newLocals)
|
|
48537
|
+
return;
|
|
48538
|
+
const oldCleanup = cleanup;
|
|
48539
|
+
function undo() {
|
|
48557
48540
|
forEach(newLocals, (s) => locals.delete(s));
|
|
48558
|
-
|
|
48559
|
-
|
|
48541
|
+
oldCleanup == null ? void 0 : oldCleanup();
|
|
48542
|
+
}
|
|
48560
48543
|
if (existingFakeScope) {
|
|
48561
|
-
cleanup =
|
|
48544
|
+
cleanup = undo;
|
|
48562
48545
|
} else {
|
|
48563
48546
|
const fakeScope = parseNodeFactory.createBlock(emptyArray);
|
|
48564
|
-
getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration =
|
|
48547
|
+
getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = kind2;
|
|
48565
48548
|
fakeScope.locals = locals;
|
|
48566
48549
|
const saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
48567
48550
|
setParent(fakeScope, saveEnclosingDeclaration);
|
|
48568
48551
|
context.enclosingDeclaration = fakeScope;
|
|
48569
48552
|
cleanup = () => {
|
|
48570
48553
|
context.enclosingDeclaration = saveEnclosingDeclaration;
|
|
48571
|
-
|
|
48554
|
+
undo();
|
|
48572
48555
|
};
|
|
48573
48556
|
}
|
|
48557
|
+
};
|
|
48558
|
+
var pushFakeScope = pushFakeScope2;
|
|
48559
|
+
pushFakeScope2(
|
|
48560
|
+
"params",
|
|
48561
|
+
(add) => {
|
|
48562
|
+
for (const param of expandedParams) {
|
|
48563
|
+
add(param.escapedName, param);
|
|
48564
|
+
}
|
|
48565
|
+
}
|
|
48566
|
+
);
|
|
48567
|
+
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
48568
|
+
pushFakeScope2(
|
|
48569
|
+
"typeParams",
|
|
48570
|
+
(add) => {
|
|
48571
|
+
for (const typeParam of signature.typeParameters ?? emptyArray) {
|
|
48572
|
+
const typeParamName = typeParameterToName(typeParam, context).escapedText;
|
|
48573
|
+
add(typeParamName, typeParam.symbol);
|
|
48574
|
+
}
|
|
48575
|
+
}
|
|
48576
|
+
);
|
|
48574
48577
|
}
|
|
48575
48578
|
}
|
|
48576
48579
|
const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 176 /* Constructor */, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports));
|
|
@@ -49114,7 +49117,7 @@ function createTypeChecker(host) {
|
|
|
49114
49117
|
return identifier;
|
|
49115
49118
|
}
|
|
49116
49119
|
}
|
|
49117
|
-
function
|
|
49120
|
+
function typeParameterShadowsOtherTypeParameterInScope(escapedName, context, type) {
|
|
49118
49121
|
const result = resolveName(
|
|
49119
49122
|
context.enclosingDeclaration,
|
|
49120
49123
|
escapedName,
|
|
@@ -49125,11 +49128,8 @@ function createTypeChecker(host) {
|
|
|
49125
49128
|
/*isUse*/
|
|
49126
49129
|
false
|
|
49127
49130
|
);
|
|
49128
|
-
if (result) {
|
|
49129
|
-
|
|
49130
|
-
return false;
|
|
49131
|
-
}
|
|
49132
|
-
return true;
|
|
49131
|
+
if (result && result.flags & 262144 /* TypeParameter */) {
|
|
49132
|
+
return result !== type.symbol;
|
|
49133
49133
|
}
|
|
49134
49134
|
return false;
|
|
49135
49135
|
}
|
|
@@ -49155,7 +49155,7 @@ function createTypeChecker(host) {
|
|
|
49155
49155
|
const rawtext = result.escapedText;
|
|
49156
49156
|
let i = ((_a = context.typeParameterNamesByTextNextNameCount) == null ? void 0 : _a.get(rawtext)) || 0;
|
|
49157
49157
|
let text = rawtext;
|
|
49158
|
-
while (((_b = context.typeParameterNamesByText) == null ? void 0 : _b.has(text)) ||
|
|
49158
|
+
while (((_b = context.typeParameterNamesByText) == null ? void 0 : _b.has(text)) || typeParameterShadowsOtherTypeParameterInScope(text, context, type)) {
|
|
49159
49159
|
i++;
|
|
49160
49160
|
text = `${rawtext}_${i}`;
|
|
49161
49161
|
}
|
|
@@ -49166,7 +49166,7 @@ function createTypeChecker(host) {
|
|
|
49166
49166
|
}
|
|
49167
49167
|
(context.typeParameterNamesByTextNextNameCount || (context.typeParameterNamesByTextNextNameCount = /* @__PURE__ */ new Map())).set(rawtext, i);
|
|
49168
49168
|
(context.typeParameterNames || (context.typeParameterNames = /* @__PURE__ */ new Map())).set(getTypeId(type), result);
|
|
49169
|
-
(context.typeParameterNamesByText || (context.typeParameterNamesByText = /* @__PURE__ */ new Set())).add(
|
|
49169
|
+
(context.typeParameterNamesByText || (context.typeParameterNamesByText = /* @__PURE__ */ new Set())).add(text);
|
|
49170
49170
|
}
|
|
49171
49171
|
return result;
|
|
49172
49172
|
}
|
|
@@ -49311,7 +49311,10 @@ function createTypeChecker(host) {
|
|
|
49311
49311
|
return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
|
|
49312
49312
|
}
|
|
49313
49313
|
function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
|
|
49314
|
-
|
|
49314
|
+
while (getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration) {
|
|
49315
|
+
enclosingDeclaration = enclosingDeclaration.parent;
|
|
49316
|
+
}
|
|
49317
|
+
return enclosingDeclaration;
|
|
49315
49318
|
}
|
|
49316
49319
|
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
|
|
49317
49320
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
@@ -49391,7 +49394,7 @@ function createTypeChecker(host) {
|
|
|
49391
49394
|
}
|
|
49392
49395
|
if (isIdentifier(node)) {
|
|
49393
49396
|
const type = getDeclaredTypeOfSymbol(sym);
|
|
49394
|
-
const name = sym.flags & 262144 /* TypeParameter */
|
|
49397
|
+
const name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(type, context) : factory.cloneNode(node);
|
|
49395
49398
|
name.symbol = sym;
|
|
49396
49399
|
return { introducesError, node: setEmitFlags(setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
|
|
49397
49400
|
}
|
|
@@ -53234,7 +53237,28 @@ function createTypeChecker(host) {
|
|
|
53234
53237
|
}
|
|
53235
53238
|
}
|
|
53236
53239
|
}
|
|
53237
|
-
|
|
53240
|
+
let resolved = combineSymbolTables(earlySymbols, lateSymbols);
|
|
53241
|
+
if (symbol.flags & 33554432 /* Transient */ && links.cjsExportMerged && symbol.declarations) {
|
|
53242
|
+
for (const decl of symbol.declarations) {
|
|
53243
|
+
const original = getSymbolLinks(decl.symbol)[resolutionKind];
|
|
53244
|
+
if (!resolved) {
|
|
53245
|
+
resolved = original;
|
|
53246
|
+
continue;
|
|
53247
|
+
}
|
|
53248
|
+
if (!original)
|
|
53249
|
+
continue;
|
|
53250
|
+
original.forEach((s, name) => {
|
|
53251
|
+
const existing = resolved.get(name);
|
|
53252
|
+
if (!existing)
|
|
53253
|
+
resolved.set(name, s);
|
|
53254
|
+
else if (existing === s)
|
|
53255
|
+
return;
|
|
53256
|
+
else
|
|
53257
|
+
resolved.set(name, mergeSymbol(existing, s));
|
|
53258
|
+
});
|
|
53259
|
+
}
|
|
53260
|
+
}
|
|
53261
|
+
links[resolutionKind] = resolved || emptySymbols;
|
|
53238
53262
|
}
|
|
53239
53263
|
return links[resolutionKind];
|
|
53240
53264
|
}
|
|
@@ -64060,13 +64084,10 @@ function createTypeChecker(host) {
|
|
|
64060
64084
|
if (sourceNameType && targetNameType)
|
|
64061
64085
|
inferFromTypes(sourceNameType, targetNameType);
|
|
64062
64086
|
}
|
|
64063
|
-
if (getObjectFlags(target) & 32 /* Mapped */) {
|
|
64064
|
-
const
|
|
64065
|
-
if (
|
|
64066
|
-
|
|
64067
|
-
if (inferToMappedType(source, mappedType, constraintType)) {
|
|
64068
|
-
return;
|
|
64069
|
-
}
|
|
64087
|
+
if (getObjectFlags(target) & 32 /* Mapped */ && !target.declaration.nameType) {
|
|
64088
|
+
const constraintType = getConstraintTypeFromMappedType(target);
|
|
64089
|
+
if (inferToMappedType(source, target, constraintType)) {
|
|
64090
|
+
return;
|
|
64070
64091
|
}
|
|
64071
64092
|
}
|
|
64072
64093
|
if (!typesDefinitelyUnrelated(source, target)) {
|
|
@@ -115398,15 +115419,15 @@ function isReferencedFile(reason) {
|
|
|
115398
115419
|
function isReferenceFileLocation(location) {
|
|
115399
115420
|
return location.pos !== void 0;
|
|
115400
115421
|
}
|
|
115401
|
-
function getReferencedFileLocation(
|
|
115402
|
-
var _a, _b, _c, _d, _e, _f;
|
|
115403
|
-
const file = Debug.checkDefined(getSourceFileByPath(ref.file));
|
|
115422
|
+
function getReferencedFileLocation(program, ref) {
|
|
115423
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
115424
|
+
const file = Debug.checkDefined(program.getSourceFileByPath(ref.file));
|
|
115404
115425
|
const { kind, index } = ref;
|
|
115405
115426
|
let pos, end, packageId, resolutionMode;
|
|
115406
115427
|
switch (kind) {
|
|
115407
115428
|
case 3 /* Import */:
|
|
115408
115429
|
const importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
115409
|
-
packageId = (_c = (_b = (_a =
|
|
115430
|
+
packageId = (_d = (_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(file.path)) == null ? void 0 : _b.get(importLiteral.text, getModeForResolutionAtIndex(file, index))) == null ? void 0 : _c.resolvedModule) == null ? void 0 : _d.packageId;
|
|
115410
115431
|
if (importLiteral.pos === -1)
|
|
115411
115432
|
return { file, packageId, text: importLiteral.text };
|
|
115412
115433
|
pos = skipTrivia(file.text, importLiteral.pos);
|
|
@@ -115417,7 +115438,7 @@ function getReferencedFileLocation(getSourceFileByPath, ref) {
|
|
|
115417
115438
|
break;
|
|
115418
115439
|
case 5 /* TypeReferenceDirective */:
|
|
115419
115440
|
({ pos, end, resolutionMode } = file.typeReferenceDirectives[index]);
|
|
115420
|
-
packageId = (
|
|
115441
|
+
packageId = (_h = (_g = (_f = (_e = program.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _e.get(file.path)) == null ? void 0 : _f.get(toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), resolutionMode || file.impliedNodeFormat)) == null ? void 0 : _g.resolvedTypeReferenceDirective) == null ? void 0 : _h.packageId;
|
|
115421
115442
|
break;
|
|
115422
115443
|
case 7 /* LibReferenceDirective */:
|
|
115423
115444
|
({ pos, end } = file.libReferenceDirectives[index]);
|
|
@@ -115631,6 +115652,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115631
115652
|
let automaticTypeDirectiveResolutions;
|
|
115632
115653
|
let resolvedLibReferences;
|
|
115633
115654
|
let resolvedLibProcessing;
|
|
115655
|
+
let resolvedModules;
|
|
115656
|
+
let resolvedModulesProcessing;
|
|
115657
|
+
let resolvedTypeReferenceDirectiveNames;
|
|
115658
|
+
let resolvedTypeReferenceDirectiveNamesProcessing;
|
|
115634
115659
|
let packageMap;
|
|
115635
115660
|
const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
|
|
115636
115661
|
let currentNodeModulesDepth = 0;
|
|
@@ -115895,6 +115920,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115895
115920
|
}
|
|
115896
115921
|
oldProgram = void 0;
|
|
115897
115922
|
resolvedLibProcessing = void 0;
|
|
115923
|
+
resolvedModulesProcessing = void 0;
|
|
115924
|
+
resolvedTypeReferenceDirectiveNamesProcessing = void 0;
|
|
115898
115925
|
const program = {
|
|
115899
115926
|
getRootFileNames: () => rootNames,
|
|
115900
115927
|
getSourceFile,
|
|
@@ -115936,6 +115963,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115936
115963
|
sourceFileToPackageName,
|
|
115937
115964
|
redirectTargetsMap,
|
|
115938
115965
|
usesUriStyleNodeCoreModules,
|
|
115966
|
+
resolvedModules,
|
|
115967
|
+
resolvedTypeReferenceDirectiveNames,
|
|
115939
115968
|
resolvedLibReferences,
|
|
115940
115969
|
getCurrentPackagesMap: () => packageMap,
|
|
115941
115970
|
typesPackageExists,
|
|
@@ -115967,7 +115996,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115967
115996
|
case 1 /* FilePreprocessingFileExplainingDiagnostic */:
|
|
115968
115997
|
return programDiagnostics.add(createDiagnosticExplainingFile(diagnostic.file && getSourceFileByPath(diagnostic.file), diagnostic.fileProcessingReason, diagnostic.diagnostic, diagnostic.args || emptyArray));
|
|
115969
115998
|
case 0 /* FilePreprocessingReferencedDiagnostic */:
|
|
115970
|
-
const { file, pos, end } = getReferencedFileLocation(
|
|
115999
|
+
const { file, pos, end } = getReferencedFileLocation(program, diagnostic.reason);
|
|
115971
116000
|
return programDiagnostics.add(createFileDiagnostic(file, Debug.checkDefined(pos), Debug.checkDefined(end) - pos, diagnostic.diagnostic, ...diagnostic.args || emptyArray));
|
|
115972
116001
|
case 2 /* ResolutionDiagnostics */:
|
|
115973
116002
|
return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
|
|
@@ -115984,14 +116013,15 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115984
116013
|
if (packageMap)
|
|
115985
116014
|
return packageMap;
|
|
115986
116015
|
packageMap = /* @__PURE__ */ new Map();
|
|
115987
|
-
files.forEach(
|
|
115988
|
-
|
|
115989
|
-
|
|
115990
|
-
|
|
115991
|
-
|
|
115992
|
-
|
|
115993
|
-
|
|
115994
|
-
|
|
116016
|
+
files.forEach(
|
|
116017
|
+
(sf) => {
|
|
116018
|
+
var _a2;
|
|
116019
|
+
return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(sf.path)) == null ? void 0 : _a2.forEach(({ resolvedModule }) => {
|
|
116020
|
+
if (resolvedModule == null ? void 0 : resolvedModule.packageId)
|
|
116021
|
+
packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
|
|
116022
|
+
});
|
|
116023
|
+
}
|
|
116024
|
+
);
|
|
115995
116025
|
return packageMap;
|
|
115996
116026
|
}
|
|
115997
116027
|
function typesPackageExists(packageName) {
|
|
@@ -116123,7 +116153,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116123
116153
|
return classifiableNames;
|
|
116124
116154
|
}
|
|
116125
116155
|
function resolveModuleNamesReusingOldState(moduleNames, file) {
|
|
116126
|
-
var _a2;
|
|
116156
|
+
var _a2, _b2;
|
|
116127
116157
|
if (structureIsReused === 0 /* Not */ && !file.ambientModuleNames.length) {
|
|
116128
116158
|
return resolveModuleNamesWorker(
|
|
116129
116159
|
moduleNames,
|
|
@@ -116132,24 +116162,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116132
116162
|
void 0
|
|
116133
116163
|
);
|
|
116134
116164
|
}
|
|
116135
|
-
const oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
|
|
116136
|
-
if (oldSourceFile !== file && file.resolvedModules) {
|
|
116137
|
-
const result2 = [];
|
|
116138
|
-
for (const moduleName of moduleNames) {
|
|
116139
|
-
const resolvedModule = file.resolvedModules.get(moduleName.text, getModeForUsageLocation(file, moduleName));
|
|
116140
|
-
result2.push(resolvedModule);
|
|
116141
|
-
}
|
|
116142
|
-
return result2;
|
|
116143
|
-
}
|
|
116144
116165
|
let unknownModuleNames;
|
|
116145
116166
|
let result;
|
|
116146
116167
|
let reusedNames;
|
|
116147
116168
|
const predictedToResolveToAmbientModuleMarker = emptyResolution;
|
|
116169
|
+
const oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
|
|
116148
116170
|
for (let i = 0; i < moduleNames.length; i++) {
|
|
116149
116171
|
const moduleName = moduleNames[i];
|
|
116150
|
-
if (file === oldSourceFile && !hasInvalidatedResolutions(
|
|
116172
|
+
if (file === oldSourceFile && !hasInvalidatedResolutions(file.path)) {
|
|
116151
116173
|
const mode = getModeForUsageLocation(file, moduleName);
|
|
116152
|
-
const oldResolution = (_a2 =
|
|
116174
|
+
const oldResolution = (_b2 = (_a2 = oldProgram == null ? void 0 : oldProgram.resolvedModules) == null ? void 0 : _a2.get(file.path)) == null ? void 0 : _b2.get(moduleName.text, mode);
|
|
116153
116175
|
if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
|
|
116154
116176
|
if (isTraceEnabled(options, host)) {
|
|
116155
116177
|
trace(
|
|
@@ -116196,7 +116218,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116196
116218
|
Debug.assert(j === resolutions.length);
|
|
116197
116219
|
return result;
|
|
116198
116220
|
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
|
|
116199
|
-
|
|
116221
|
+
var _a3, _b3, _c2;
|
|
116222
|
+
const resolutionToFile = (_c2 = (_b3 = (_a3 = oldProgram == null ? void 0 : oldProgram.resolvedModules) == null ? void 0 : _a3.get(file.path)) == null ? void 0 : _b3.get(moduleName.text, getModeForUsageLocation(file, moduleName))) == null ? void 0 : _c2.resolvedModule;
|
|
116200
116223
|
const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
116201
116224
|
if (resolutionToFile && resolvedFile) {
|
|
116202
116225
|
return false;
|
|
@@ -116212,7 +116235,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116212
116235
|
}
|
|
116213
116236
|
}
|
|
116214
116237
|
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
116215
|
-
var _a2;
|
|
116238
|
+
var _a2, _b2;
|
|
116216
116239
|
if (structureIsReused === 0 /* Not */) {
|
|
116217
116240
|
return resolveTypeReferenceDirectiveNamesWorker(
|
|
116218
116241
|
typeDirectiveNames,
|
|
@@ -116221,28 +116244,18 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116221
116244
|
void 0
|
|
116222
116245
|
);
|
|
116223
116246
|
}
|
|
116224
|
-
const oldSourceFile = !isString(containingFile) ? oldProgram && oldProgram.getSourceFile(containingFile.fileName) : void 0;
|
|
116225
|
-
if (!isString(containingFile)) {
|
|
116226
|
-
if (oldSourceFile !== containingFile && containingFile.resolvedTypeReferenceDirectiveNames) {
|
|
116227
|
-
const result2 = [];
|
|
116228
|
-
for (const typeDirectiveName of typeDirectiveNames) {
|
|
116229
|
-
const resolvedTypeReferenceDirective = containingFile.resolvedTypeReferenceDirectiveNames.get(getTypeReferenceResolutionName(typeDirectiveName), getModeForFileReference(typeDirectiveName, containingFile.impliedNodeFormat));
|
|
116230
|
-
result2.push(resolvedTypeReferenceDirective);
|
|
116231
|
-
}
|
|
116232
|
-
return result2;
|
|
116233
|
-
}
|
|
116234
|
-
}
|
|
116235
116247
|
let unknownTypeReferenceDirectiveNames;
|
|
116236
116248
|
let result;
|
|
116237
116249
|
let reusedNames;
|
|
116238
116250
|
const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
|
|
116239
|
-
const
|
|
116251
|
+
const oldSourceFile = !isString(containingFile) ? oldProgram && oldProgram.getSourceFile(containingFile.fileName) : void 0;
|
|
116252
|
+
const canReuseResolutions = !isString(containingFile) ? containingFile === oldSourceFile && !hasInvalidatedResolutions(containingFile.path) : !hasInvalidatedResolutions(toPath3(containingFile));
|
|
116240
116253
|
for (let i = 0; i < typeDirectiveNames.length; i++) {
|
|
116241
116254
|
const entry = typeDirectiveNames[i];
|
|
116242
116255
|
if (canReuseResolutions) {
|
|
116243
116256
|
const typeDirectiveName = getTypeReferenceResolutionName(entry);
|
|
116244
116257
|
const mode = getModeForFileReference(entry, containingSourceFile == null ? void 0 : containingSourceFile.impliedNodeFormat);
|
|
116245
|
-
const oldResolution = (
|
|
116258
|
+
const oldResolution = (_b2 = !isString(containingFile) ? (_a2 = oldProgram == null ? void 0 : oldProgram.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a2.get(containingFile.path) : oldProgram == null ? void 0 : oldProgram.getAutomaticTypeDirectiveResolutions()) == null ? void 0 : _b2.get(typeDirectiveName, mode);
|
|
116246
116259
|
if (oldResolution == null ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
|
|
116247
116260
|
if (isTraceEnabled(options, host)) {
|
|
116248
116261
|
trace(
|
|
@@ -116302,7 +116315,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116302
116315
|
);
|
|
116303
116316
|
}
|
|
116304
116317
|
function tryReuseStructureFromOldProgram() {
|
|
116305
|
-
var _a2;
|
|
116318
|
+
var _a2, _b2, _c2;
|
|
116306
116319
|
if (!oldProgram) {
|
|
116307
116320
|
return 0 /* Not */;
|
|
116308
116321
|
}
|
|
@@ -116404,42 +116417,37 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116404
116417
|
structureIsReused = 1 /* SafeModules */;
|
|
116405
116418
|
}
|
|
116406
116419
|
}
|
|
116407
|
-
modifiedSourceFiles.push(
|
|
116420
|
+
modifiedSourceFiles.push(newSourceFile);
|
|
116408
116421
|
} else if (hasInvalidatedResolutions(oldSourceFile.path)) {
|
|
116409
116422
|
structureIsReused = 1 /* SafeModules */;
|
|
116410
|
-
modifiedSourceFiles.push(
|
|
116423
|
+
modifiedSourceFiles.push(newSourceFile);
|
|
116424
|
+
} else {
|
|
116425
|
+
for (const moduleName of oldSourceFile.ambientModuleNames) {
|
|
116426
|
+
ambientModuleNameToUnmodifiedFileName.set(moduleName, oldSourceFile.fileName);
|
|
116427
|
+
}
|
|
116411
116428
|
}
|
|
116412
116429
|
newSourceFiles.push(newSourceFile);
|
|
116413
116430
|
}
|
|
116414
116431
|
if (structureIsReused !== 2 /* Completely */) {
|
|
116415
116432
|
return structureIsReused;
|
|
116416
116433
|
}
|
|
116417
|
-
const
|
|
116418
|
-
for (const oldFile of oldSourceFiles) {
|
|
116419
|
-
if (!contains(modifiedFiles, oldFile)) {
|
|
116420
|
-
for (const moduleName of oldFile.ambientModuleNames) {
|
|
116421
|
-
ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName);
|
|
116422
|
-
}
|
|
116423
|
-
}
|
|
116424
|
-
}
|
|
116425
|
-
for (const { oldFile: oldSourceFile, newFile: newSourceFile } of modifiedSourceFiles) {
|
|
116434
|
+
for (const newSourceFile of modifiedSourceFiles) {
|
|
116426
116435
|
const moduleNames = getModuleNames(newSourceFile);
|
|
116427
116436
|
const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
116428
|
-
|
|
116429
|
-
|
|
116437
|
+
(resolvedModulesProcessing ?? (resolvedModulesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, resolutions);
|
|
116438
|
+
const oldResolutions = (_b2 = oldProgram.resolvedModules) == null ? void 0 : _b2.get(newSourceFile.path);
|
|
116439
|
+
const resolutionsChanged = hasChangesInResolutions(moduleNames, newSourceFile, resolutions, oldResolutions, moduleResolutionIsEqualTo, moduleResolutionNameAndModeGetter);
|
|
116440
|
+
if (resolutionsChanged)
|
|
116430
116441
|
structureIsReused = 1 /* SafeModules */;
|
|
116431
|
-
newSourceFile.resolvedModules = zipToModeAwareCache(newSourceFile, moduleNames, resolutions, moduleResolutionNameAndModeGetter);
|
|
116432
|
-
} else {
|
|
116433
|
-
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
|
116434
|
-
}
|
|
116435
116442
|
const typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
|
|
116436
116443
|
const typeReferenceResolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typesReferenceDirectives, newSourceFile);
|
|
116437
|
-
|
|
116444
|
+
(resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, typeReferenceResolutions);
|
|
116445
|
+
const oldTypeResolutions = (_c2 = oldProgram.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _c2.get(newSourceFile.path);
|
|
116446
|
+
const typeReferenceResolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, newSourceFile, typeReferenceResolutions, oldTypeResolutions, typeDirectiveIsEqualTo, typeReferenceResolutionNameAndModeGetter);
|
|
116438
116447
|
if (typeReferenceResolutionsChanged) {
|
|
116439
116448
|
structureIsReused = 1 /* SafeModules */;
|
|
116440
|
-
|
|
116441
|
-
|
|
116442
|
-
newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
|
|
116449
|
+
} else if (oldTypeResolutions) {
|
|
116450
|
+
(resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, oldTypeResolutions);
|
|
116443
116451
|
}
|
|
116444
116452
|
}
|
|
116445
116453
|
if (structureIsReused !== 2 /* Completely */) {
|
|
@@ -116487,6 +116495,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116487
116495
|
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
|
|
116488
116496
|
redirectTargetsMap = oldProgram.redirectTargetsMap;
|
|
116489
116497
|
usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
|
|
116498
|
+
resolvedModules = oldProgram.resolvedModules;
|
|
116499
|
+
resolvedTypeReferenceDirectiveNames = oldProgram.resolvedTypeReferenceDirectiveNames;
|
|
116490
116500
|
resolvedLibReferences = oldProgram.resolvedLibReferences;
|
|
116491
116501
|
packageMap = oldProgram.getCurrentPackagesMap();
|
|
116492
116502
|
return 2 /* Completely */;
|
|
@@ -117532,16 +117542,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117532
117542
|
}
|
|
117533
117543
|
function processTypeReferenceDirectives(file) {
|
|
117534
117544
|
const typeDirectives = file.typeReferenceDirectives;
|
|
117535
|
-
if (!typeDirectives.length)
|
|
117536
|
-
file.resolvedTypeReferenceDirectiveNames = void 0;
|
|
117545
|
+
if (!typeDirectives.length)
|
|
117537
117546
|
return;
|
|
117538
|
-
|
|
117539
|
-
const
|
|
117547
|
+
const resolutions = (resolvedTypeReferenceDirectiveNamesProcessing == null ? void 0 : resolvedTypeReferenceDirectiveNamesProcessing.get(file.path)) || resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectives, file);
|
|
117548
|
+
const resolutionsInFile = createModeAwareCache();
|
|
117549
|
+
(resolvedTypeReferenceDirectiveNames ?? (resolvedTypeReferenceDirectiveNames = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
|
|
117540
117550
|
for (let index = 0; index < typeDirectives.length; index++) {
|
|
117541
117551
|
const ref = file.typeReferenceDirectives[index];
|
|
117542
117552
|
const resolvedTypeReferenceDirective = resolutions[index];
|
|
117543
117553
|
const fileName = toFileNameLowerCase(ref.fileName);
|
|
117544
|
-
|
|
117554
|
+
resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
|
|
117545
117555
|
const mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
117546
117556
|
if (mode && getEmitModuleResolutionKind(options) !== 3 /* Node16 */ && getEmitModuleResolutionKind(options) !== 99 /* NodeNext */) {
|
|
117547
117557
|
(fileProcessingDiagnostics ?? (fileProcessingDiagnostics = [])).push({
|
|
@@ -117705,14 +117715,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117705
117715
|
collectExternalModuleReferences(file);
|
|
117706
117716
|
if (file.imports.length || file.moduleAugmentations.length) {
|
|
117707
117717
|
const moduleNames = getModuleNames(file);
|
|
117708
|
-
const resolutions = resolveModuleNamesReusingOldState(moduleNames, file);
|
|
117718
|
+
const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
|
|
117709
117719
|
Debug.assert(resolutions.length === moduleNames.length);
|
|
117710
117720
|
const optionsForFile = (useSourceOfProjectReferenceRedirect ? (_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options : void 0) || options;
|
|
117721
|
+
const resolutionsInFile = createModeAwareCache();
|
|
117722
|
+
(resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
|
|
117711
117723
|
for (let index = 0; index < moduleNames.length; index++) {
|
|
117712
117724
|
const resolution = resolutions[index].resolvedModule;
|
|
117713
117725
|
const moduleName = moduleNames[index].text;
|
|
117714
117726
|
const mode = getModeForUsageLocation(file, moduleNames[index]);
|
|
117715
|
-
|
|
117727
|
+
resolutionsInFile.set(moduleName, mode, resolutions[index]);
|
|
117716
117728
|
addResolutionDiagnosticsFromResolutionOrCache(file, moduleName, resolutions[index], mode);
|
|
117717
117729
|
if (!resolution) {
|
|
117718
117730
|
continue;
|
|
@@ -117743,8 +117755,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117743
117755
|
currentNodeModulesDepth--;
|
|
117744
117756
|
}
|
|
117745
117757
|
}
|
|
117746
|
-
} else {
|
|
117747
|
-
file.resolvedModules = void 0;
|
|
117748
117758
|
}
|
|
117749
117759
|
}
|
|
117750
117760
|
function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) {
|
|
@@ -118259,7 +118269,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118259
118269
|
processReason(fileProcessingReason);
|
|
118260
118270
|
if (locationReason && (fileIncludeReasons == null ? void 0 : fileIncludeReasons.length) === 1)
|
|
118261
118271
|
fileIncludeReasons = void 0;
|
|
118262
|
-
const location = locationReason && getReferencedFileLocation(
|
|
118272
|
+
const location = locationReason && getReferencedFileLocation(program, locationReason);
|
|
118263
118273
|
const fileIncludeReasonDetails = fileIncludeReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
|
|
118264
118274
|
const redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file);
|
|
118265
118275
|
const chain = chainDiagnosticMessages(redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails, diagnostic, ...args || emptyArray);
|
|
@@ -118295,7 +118305,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118295
118305
|
}
|
|
118296
118306
|
function fileIncludeReasonToRelatedInformation(reason) {
|
|
118297
118307
|
if (isReferencedFile(reason)) {
|
|
118298
|
-
const referenceLocation = getReferencedFileLocation(
|
|
118308
|
+
const referenceLocation = getReferencedFileLocation(program, reason);
|
|
118299
118309
|
let message2;
|
|
118300
118310
|
switch (reason.kind) {
|
|
118301
118311
|
case 3 /* Import */:
|
|
@@ -118584,8 +118594,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118584
118594
|
if (!symlinks) {
|
|
118585
118595
|
symlinks = createSymlinkCache(currentDirectory, getCanonicalFileName);
|
|
118586
118596
|
}
|
|
118587
|
-
if (files &&
|
|
118588
|
-
symlinks.setSymlinksFromResolutions(
|
|
118597
|
+
if (files && !symlinks.hasProcessedResolutions()) {
|
|
118598
|
+
symlinks.setSymlinksFromResolutions(resolvedModules, resolvedTypeReferenceDirectiveNames, automaticTypeDirectiveResolutions);
|
|
118589
118599
|
}
|
|
118590
118600
|
return symlinks;
|
|
118591
118601
|
}
|
|
@@ -118939,6 +118949,7 @@ var BuilderState;
|
|
|
118939
118949
|
return toPath(program.getProjectReferenceRedirect(fileName) || fileName, sourceFileDirectory, getCanonicalFileName);
|
|
118940
118950
|
}
|
|
118941
118951
|
function getReferencedFiles(program, sourceFile, getCanonicalFileName) {
|
|
118952
|
+
var _a;
|
|
118942
118953
|
let referencedFiles;
|
|
118943
118954
|
if (sourceFile.imports && sourceFile.imports.length > 0) {
|
|
118944
118955
|
const checker = program.getTypeChecker();
|
|
@@ -118954,8 +118965,9 @@ var BuilderState;
|
|
|
118954
118965
|
addReferencedFile(referencedPath);
|
|
118955
118966
|
}
|
|
118956
118967
|
}
|
|
118957
|
-
|
|
118958
|
-
|
|
118968
|
+
const resolvedTypeReferenceDirectiveNames = (_a = program.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a.get(sourceFile.path);
|
|
118969
|
+
if (resolvedTypeReferenceDirectiveNames) {
|
|
118970
|
+
resolvedTypeReferenceDirectiveNames.forEach(({ resolvedTypeReferenceDirective }) => {
|
|
118959
118971
|
if (!resolvedTypeReferenceDirective) {
|
|
118960
118972
|
return;
|
|
118961
118973
|
}
|
|
@@ -120751,7 +120763,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
120751
120763
|
clear: clear2,
|
|
120752
120764
|
onChangesAffectModuleResolution
|
|
120753
120765
|
};
|
|
120754
|
-
function
|
|
120766
|
+
function getResolvedModule(resolution) {
|
|
120755
120767
|
return resolution.resolvedModule;
|
|
120756
120768
|
}
|
|
120757
120769
|
function getResolvedTypeReferenceDirective(resolution) {
|
|
@@ -120830,7 +120842,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
120830
120842
|
stopWatchFailedLookupLocationOfResolution(
|
|
120831
120843
|
resolution,
|
|
120832
120844
|
resolutionHost.toPath(getInferredLibraryNameResolveFrom(newProgram.getCompilerOptions(), getCurrentDirectory(), libFileName)),
|
|
120833
|
-
|
|
120845
|
+
getResolvedModule
|
|
120834
120846
|
);
|
|
120835
120847
|
resolvedLibraries.delete(libFileName);
|
|
120836
120848
|
}
|
|
@@ -121055,7 +121067,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121055
121067
|
redirectedReference,
|
|
121056
121068
|
options
|
|
121057
121069
|
),
|
|
121058
|
-
getResolutionWithResolvedFileName:
|
|
121070
|
+
getResolutionWithResolvedFileName: getResolvedModule,
|
|
121059
121071
|
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|
|
121060
121072
|
logChanges: logChangesWhenResolvingModule,
|
|
121061
121073
|
deferWatchingNonRelativeResolution: true
|
|
@@ -121074,17 +121086,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121074
121086
|
libraryName,
|
|
121075
121087
|
resolution,
|
|
121076
121088
|
path,
|
|
121077
|
-
|
|
121089
|
+
getResolvedModule,
|
|
121078
121090
|
/*deferWatchingNonRelativeResolution*/
|
|
121079
121091
|
false
|
|
121080
121092
|
);
|
|
121081
121093
|
resolvedLibraries.set(libFileName, resolution);
|
|
121082
121094
|
if (existingResolution) {
|
|
121083
|
-
stopWatchFailedLookupLocationOfResolution(existingResolution, path,
|
|
121095
|
+
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModule);
|
|
121084
121096
|
}
|
|
121085
121097
|
} else {
|
|
121086
121098
|
if (isTraceEnabled(options, host)) {
|
|
121087
|
-
const resolved =
|
|
121099
|
+
const resolved = getResolvedModule(resolution);
|
|
121088
121100
|
trace(
|
|
121089
121101
|
host,
|
|
121090
121102
|
(resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.packageId ? Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved,
|
|
@@ -121361,7 +121373,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121361
121373
|
resolvedProjectReference.commandLine.fileNames.forEach((f) => removeResolutionsOfFile(resolutionHost.toPath(f)));
|
|
121362
121374
|
}
|
|
121363
121375
|
function removeResolutionsOfFile(filePath) {
|
|
121364
|
-
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath,
|
|
121376
|
+
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule);
|
|
121365
121377
|
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective);
|
|
121366
121378
|
}
|
|
121367
121379
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
@@ -121788,7 +121800,7 @@ function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
|
|
|
121788
121800
|
var _a, _b;
|
|
121789
121801
|
const options = program.getCompilerOptions();
|
|
121790
121802
|
if (isReferencedFile(reason)) {
|
|
121791
|
-
const referenceLocation = getReferencedFileLocation(
|
|
121803
|
+
const referenceLocation = getReferencedFileLocation(program, reason);
|
|
121792
121804
|
const referenceText = isReferenceFileLocation(referenceLocation) ? referenceLocation.file.text.substring(referenceLocation.pos, referenceLocation.end) : `"${referenceLocation.text}"`;
|
|
121793
121805
|
let message;
|
|
121794
121806
|
Debug.assert(isReferenceFileLocation(referenceLocation) || reason.kind === 3 /* Import */, "Only synthetic references are imports");
|