typescript 5.3.0-dev.20230919 → 5.3.0-dev.20230921
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 +114 -132
- package/lib/tsserver.js +489 -204
- package/lib/typescript.js +490 -200
- package/lib/typingsInstaller.js +17 -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-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20230921`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -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,
|
|
@@ -16423,7 +16407,7 @@ function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
|
|
|
16423
16407
|
return optionsHaveChanges(oldOptions, newOptions, affectsDeclarationPathOptionDeclarations);
|
|
16424
16408
|
}
|
|
16425
16409
|
function getCompilerOptionValue(options, option) {
|
|
16426
|
-
return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
|
|
16410
|
+
return option.strictFlag ? getStrictOptionValue(options, option.name) : option.allowJsFlag ? getAllowJSCompilerOption(options) : options[option.name];
|
|
16427
16411
|
}
|
|
16428
16412
|
function getJSXTransformEnabled(options) {
|
|
16429
16413
|
const jsx = options.jsx;
|
|
@@ -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,
|
|
@@ -34183,7 +34164,8 @@ var commandOptionsWithoutBuild = [
|
|
|
34183
34164
|
{
|
|
34184
34165
|
name: "allowJs",
|
|
34185
34166
|
type: "boolean",
|
|
34186
|
-
|
|
34167
|
+
allowJsFlag: true,
|
|
34168
|
+
affectsBuildInfo: true,
|
|
34187
34169
|
showInSimplifiedHelpView: true,
|
|
34188
34170
|
category: Diagnostics.JavaScript_Support,
|
|
34189
34171
|
description: Diagnostics.Allow_JavaScript_files_to_be_a_part_of_your_program_Use_the_checkJS_option_to_get_errors_from_these_files,
|
|
@@ -34193,6 +34175,8 @@ var commandOptionsWithoutBuild = [
|
|
|
34193
34175
|
name: "checkJs",
|
|
34194
34176
|
type: "boolean",
|
|
34195
34177
|
affectsModuleResolution: true,
|
|
34178
|
+
affectsSemanticDiagnostics: true,
|
|
34179
|
+
affectsBuildInfo: true,
|
|
34196
34180
|
showInSimplifiedHelpView: true,
|
|
34197
34181
|
category: Diagnostics.JavaScript_Support,
|
|
34198
34182
|
description: Diagnostics.Enable_error_reporting_in_type_checked_JavaScript_files,
|
|
@@ -34205,6 +34189,10 @@ var commandOptionsWithoutBuild = [
|
|
|
34205
34189
|
affectsEmit: true,
|
|
34206
34190
|
affectsBuildInfo: true,
|
|
34207
34191
|
affectsModuleResolution: true,
|
|
34192
|
+
// The checker emits an error when it sees JSX but this option is not set in compilerOptions.
|
|
34193
|
+
// This is effectively a semantic error, so mark this option as affecting semantic diagnostics
|
|
34194
|
+
// so we know to refresh errors when this option is changed.
|
|
34195
|
+
affectsSemanticDiagnostics: true,
|
|
34208
34196
|
paramType: Diagnostics.KIND,
|
|
34209
34197
|
showInSimplifiedHelpView: true,
|
|
34210
34198
|
category: Diagnostics.Language_and_Environment,
|
|
@@ -34520,6 +34508,7 @@ var commandOptionsWithoutBuild = [
|
|
|
34520
34508
|
bundler: 100 /* Bundler */
|
|
34521
34509
|
})),
|
|
34522
34510
|
deprecatedKeys: /* @__PURE__ */ new Set(["node"]),
|
|
34511
|
+
affectsSourceFile: true,
|
|
34523
34512
|
affectsModuleResolution: true,
|
|
34524
34513
|
paramType: Diagnostics.STRATEGY,
|
|
34525
34514
|
category: Diagnostics.Modules,
|
|
@@ -35062,6 +35051,7 @@ var commandOptionsWithoutBuild = [
|
|
|
35062
35051
|
legacy: 1 /* Legacy */,
|
|
35063
35052
|
force: 3 /* Force */
|
|
35064
35053
|
})),
|
|
35054
|
+
affectsSourceFile: true,
|
|
35065
35055
|
affectsModuleResolution: true,
|
|
35066
35056
|
description: Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
|
|
35067
35057
|
category: Diagnostics.Language_and_Environment,
|
|
@@ -35081,7 +35071,7 @@ var semanticDiagnosticsOptionDeclarations = optionDeclarations.filter((option) =
|
|
|
35081
35071
|
var affectsEmitOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsEmit);
|
|
35082
35072
|
var affectsDeclarationPathOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsDeclarationPath);
|
|
35083
35073
|
var moduleResolutionOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsModuleResolution);
|
|
35084
|
-
var sourceFileAffectingCompilerOptions = optionDeclarations.filter((option) => !!option.affectsSourceFile || !!option.
|
|
35074
|
+
var sourceFileAffectingCompilerOptions = optionDeclarations.filter((option) => !!option.affectsSourceFile || !!option.affectsBindDiagnostics);
|
|
35085
35075
|
var optionsAffectingProgramStructure = optionDeclarations.filter((option) => !!option.affectsProgramStructure);
|
|
35086
35076
|
var transpileOptionValueCompilerOptions = optionDeclarations.filter((option) => hasProperty(option, "transpileOptionValue"));
|
|
35087
35077
|
var optionsForBuild = [
|
|
@@ -37456,15 +37446,6 @@ function createModeAwareCache() {
|
|
|
37456
37446
|
return result;
|
|
37457
37447
|
}
|
|
37458
37448
|
}
|
|
37459
|
-
function zipToModeAwareCache(file, keys, values, nameAndModeGetter) {
|
|
37460
|
-
Debug.assert(keys.length === values.length);
|
|
37461
|
-
const map2 = createModeAwareCache();
|
|
37462
|
-
for (let i = 0; i < keys.length; ++i) {
|
|
37463
|
-
const entry = keys[i];
|
|
37464
|
-
map2.set(nameAndModeGetter.getName(entry), nameAndModeGetter.getMode(entry, file), values[i]);
|
|
37465
|
-
}
|
|
37466
|
-
return map2;
|
|
37467
|
-
}
|
|
37468
37449
|
function getOriginalOrResolvedModuleFileName(result) {
|
|
37469
37450
|
return result.resolvedModule && (result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
|
|
37470
37451
|
}
|
|
@@ -39922,7 +39903,7 @@ function createBinder() {
|
|
|
39922
39903
|
case 36 /* ExclamationEqualsToken */:
|
|
39923
39904
|
case 37 /* EqualsEqualsEqualsToken */:
|
|
39924
39905
|
case 38 /* ExclamationEqualsEqualsToken */:
|
|
39925
|
-
return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) || isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right);
|
|
39906
|
+
return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) || isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right) || (isBooleanLiteral(expr.right) && isNarrowingExpression(expr.left) || isBooleanLiteral(expr.left) && isNarrowingExpression(expr.right));
|
|
39926
39907
|
case 104 /* InstanceOfKeyword */:
|
|
39927
39908
|
return isNarrowableOperand(expr.left);
|
|
39928
39909
|
case 103 /* InKeyword */:
|
|
@@ -46306,7 +46287,7 @@ function createTypeChecker(host) {
|
|
|
46306
46287
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
|
|
46307
46288
|
}
|
|
46308
46289
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
46309
|
-
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;
|
|
46310
46291
|
if (startsWith(moduleReference, "@types/")) {
|
|
46311
46292
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
46312
46293
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -46324,7 +46305,7 @@ function createTypeChecker(host) {
|
|
|
46324
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);
|
|
46325
46306
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
46326
46307
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
46327
|
-
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;
|
|
46328
46309
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
46329
46310
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
46330
46311
|
if (sourceFile) {
|
|
@@ -46332,7 +46313,7 @@ function createTypeChecker(host) {
|
|
|
46332
46313
|
error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
46333
46314
|
}
|
|
46334
46315
|
if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
|
|
46335
|
-
const importOrExport = ((
|
|
46316
|
+
const importOrExport = ((_j = findAncestor(location, isImportDeclaration)) == null ? void 0 : _j.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
46336
46317
|
if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
|
|
46337
46318
|
error(
|
|
46338
46319
|
errorNode,
|
|
@@ -46341,7 +46322,7 @@ function createTypeChecker(host) {
|
|
|
46341
46322
|
);
|
|
46342
46323
|
}
|
|
46343
46324
|
} else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
|
|
46344
|
-
const importOrExport = ((
|
|
46325
|
+
const importOrExport = ((_k = findAncestor(location, isImportDeclaration)) == null ? void 0 : _k.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
46345
46326
|
if (!((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
|
|
46346
46327
|
const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
|
|
46347
46328
|
error(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
|
|
@@ -46362,7 +46343,7 @@ function createTypeChecker(host) {
|
|
|
46362
46343
|
if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
|
|
46363
46344
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
46364
46345
|
const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
46365
|
-
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;
|
|
46366
46347
|
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) {
|
|
46367
46348
|
if (findAncestor(location, isImportEqualsDeclaration)) {
|
|
46368
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);
|
|
@@ -46469,7 +46450,7 @@ function createTypeChecker(host) {
|
|
|
46469
46450
|
error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
46470
46451
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
46471
46452
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
46472
|
-
const suggestedExt = (
|
|
46453
|
+
const suggestedExt = (_m = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _m[1];
|
|
46473
46454
|
if (suggestedExt) {
|
|
46474
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);
|
|
46475
46456
|
} else {
|
|
@@ -54201,7 +54182,7 @@ function createTypeChecker(host) {
|
|
|
54201
54182
|
}
|
|
54202
54183
|
function isConstTypeVariable(type, depth = 0) {
|
|
54203
54184
|
var _a;
|
|
54204
|
-
return depth < 5 && !!(type && (type.flags & 262144 /* TypeParameter */ && some((_a = type.symbol) == null ? void 0 : _a.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || type.flags &
|
|
54185
|
+
return depth < 5 && !!(type && (type.flags & 262144 /* TypeParameter */ && some((_a = type.symbol) == null ? void 0 : _a.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, (t) => isConstTypeVariable(t, depth)) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType, depth + 1) || type.flags & 16777216 /* Conditional */ && isConstTypeVariable(getConstraintOfConditionalType(type), depth + 1) || type.flags & 33554432 /* Substitution */ && isConstTypeVariable(type.baseType, depth) || isGenericTupleType(type) && findIndex(getElementTypes(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t, depth)) >= 0));
|
|
54205
54186
|
}
|
|
54206
54187
|
function getConstraintOfIndexedAccess(type) {
|
|
54207
54188
|
return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0;
|
|
@@ -65807,6 +65788,10 @@ function createTypeChecker(host) {
|
|
|
65807
65788
|
}
|
|
65808
65789
|
return type;
|
|
65809
65790
|
}
|
|
65791
|
+
function narrowTypeByBooleanComparison(type, expr, bool, operator, assumeTrue) {
|
|
65792
|
+
assumeTrue = assumeTrue !== (bool.kind === 112 /* TrueKeyword */) !== (operator !== 38 /* ExclamationEqualsEqualsToken */ && operator !== 36 /* ExclamationEqualsToken */);
|
|
65793
|
+
return narrowType(type, expr, assumeTrue);
|
|
65794
|
+
}
|
|
65810
65795
|
function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
|
|
65811
65796
|
switch (expr.operatorToken.kind) {
|
|
65812
65797
|
case 64 /* EqualsToken */:
|
|
@@ -65854,6 +65839,12 @@ function createTypeChecker(host) {
|
|
|
65854
65839
|
if (isMatchingConstructorReference(right)) {
|
|
65855
65840
|
return narrowTypeByConstructor(type, operator, left, assumeTrue);
|
|
65856
65841
|
}
|
|
65842
|
+
if (isBooleanLiteral(right)) {
|
|
65843
|
+
return narrowTypeByBooleanComparison(type, left, right, operator, assumeTrue);
|
|
65844
|
+
}
|
|
65845
|
+
if (isBooleanLiteral(left)) {
|
|
65846
|
+
return narrowTypeByBooleanComparison(type, right, left, operator, assumeTrue);
|
|
65847
|
+
}
|
|
65857
65848
|
break;
|
|
65858
65849
|
case 104 /* InstanceOfKeyword */:
|
|
65859
65850
|
return narrowTypeByInstanceof(type, expr, assumeTrue);
|
|
@@ -115378,15 +115369,15 @@ function isReferencedFile(reason) {
|
|
|
115378
115369
|
function isReferenceFileLocation(location) {
|
|
115379
115370
|
return location.pos !== void 0;
|
|
115380
115371
|
}
|
|
115381
|
-
function getReferencedFileLocation(
|
|
115382
|
-
var _a, _b, _c, _d, _e, _f;
|
|
115383
|
-
const file = Debug.checkDefined(getSourceFileByPath(ref.file));
|
|
115372
|
+
function getReferencedFileLocation(program, ref) {
|
|
115373
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
115374
|
+
const file = Debug.checkDefined(program.getSourceFileByPath(ref.file));
|
|
115384
115375
|
const { kind, index } = ref;
|
|
115385
115376
|
let pos, end, packageId, resolutionMode;
|
|
115386
115377
|
switch (kind) {
|
|
115387
115378
|
case 3 /* Import */:
|
|
115388
115379
|
const importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
115389
|
-
packageId = (_c = (_b = (_a =
|
|
115380
|
+
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;
|
|
115390
115381
|
if (importLiteral.pos === -1)
|
|
115391
115382
|
return { file, packageId, text: importLiteral.text };
|
|
115392
115383
|
pos = skipTrivia(file.text, importLiteral.pos);
|
|
@@ -115397,7 +115388,7 @@ function getReferencedFileLocation(getSourceFileByPath, ref) {
|
|
|
115397
115388
|
break;
|
|
115398
115389
|
case 5 /* TypeReferenceDirective */:
|
|
115399
115390
|
({ pos, end, resolutionMode } = file.typeReferenceDirectives[index]);
|
|
115400
|
-
packageId = (
|
|
115391
|
+
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;
|
|
115401
115392
|
break;
|
|
115402
115393
|
case 7 /* LibReferenceDirective */:
|
|
115403
115394
|
({ pos, end } = file.libReferenceDirectives[index]);
|
|
@@ -115611,6 +115602,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115611
115602
|
let automaticTypeDirectiveResolutions;
|
|
115612
115603
|
let resolvedLibReferences;
|
|
115613
115604
|
let resolvedLibProcessing;
|
|
115605
|
+
let resolvedModules;
|
|
115606
|
+
let resolvedModulesProcessing;
|
|
115607
|
+
let resolvedTypeReferenceDirectiveNames;
|
|
115608
|
+
let resolvedTypeReferenceDirectiveNamesProcessing;
|
|
115614
115609
|
let packageMap;
|
|
115615
115610
|
const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
|
|
115616
115611
|
let currentNodeModulesDepth = 0;
|
|
@@ -115875,6 +115870,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115875
115870
|
}
|
|
115876
115871
|
oldProgram = void 0;
|
|
115877
115872
|
resolvedLibProcessing = void 0;
|
|
115873
|
+
resolvedModulesProcessing = void 0;
|
|
115874
|
+
resolvedTypeReferenceDirectiveNamesProcessing = void 0;
|
|
115878
115875
|
const program = {
|
|
115879
115876
|
getRootFileNames: () => rootNames,
|
|
115880
115877
|
getSourceFile,
|
|
@@ -115916,6 +115913,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115916
115913
|
sourceFileToPackageName,
|
|
115917
115914
|
redirectTargetsMap,
|
|
115918
115915
|
usesUriStyleNodeCoreModules,
|
|
115916
|
+
resolvedModules,
|
|
115917
|
+
resolvedTypeReferenceDirectiveNames,
|
|
115919
115918
|
resolvedLibReferences,
|
|
115920
115919
|
getCurrentPackagesMap: () => packageMap,
|
|
115921
115920
|
typesPackageExists,
|
|
@@ -115947,7 +115946,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115947
115946
|
case 1 /* FilePreprocessingFileExplainingDiagnostic */:
|
|
115948
115947
|
return programDiagnostics.add(createDiagnosticExplainingFile(diagnostic.file && getSourceFileByPath(diagnostic.file), diagnostic.fileProcessingReason, diagnostic.diagnostic, diagnostic.args || emptyArray));
|
|
115949
115948
|
case 0 /* FilePreprocessingReferencedDiagnostic */:
|
|
115950
|
-
const { file, pos, end } = getReferencedFileLocation(
|
|
115949
|
+
const { file, pos, end } = getReferencedFileLocation(program, diagnostic.reason);
|
|
115951
115950
|
return programDiagnostics.add(createFileDiagnostic(file, Debug.checkDefined(pos), Debug.checkDefined(end) - pos, diagnostic.diagnostic, ...diagnostic.args || emptyArray));
|
|
115952
115951
|
case 2 /* ResolutionDiagnostics */:
|
|
115953
115952
|
return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
|
|
@@ -115964,14 +115963,15 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115964
115963
|
if (packageMap)
|
|
115965
115964
|
return packageMap;
|
|
115966
115965
|
packageMap = /* @__PURE__ */ new Map();
|
|
115967
|
-
files.forEach(
|
|
115968
|
-
|
|
115969
|
-
|
|
115970
|
-
|
|
115971
|
-
|
|
115972
|
-
|
|
115973
|
-
|
|
115974
|
-
|
|
115966
|
+
files.forEach(
|
|
115967
|
+
(sf) => {
|
|
115968
|
+
var _a2;
|
|
115969
|
+
return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(sf.path)) == null ? void 0 : _a2.forEach(({ resolvedModule }) => {
|
|
115970
|
+
if (resolvedModule == null ? void 0 : resolvedModule.packageId)
|
|
115971
|
+
packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
|
|
115972
|
+
});
|
|
115973
|
+
}
|
|
115974
|
+
);
|
|
115975
115975
|
return packageMap;
|
|
115976
115976
|
}
|
|
115977
115977
|
function typesPackageExists(packageName) {
|
|
@@ -116103,7 +116103,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116103
116103
|
return classifiableNames;
|
|
116104
116104
|
}
|
|
116105
116105
|
function resolveModuleNamesReusingOldState(moduleNames, file) {
|
|
116106
|
-
var _a2;
|
|
116106
|
+
var _a2, _b2;
|
|
116107
116107
|
if (structureIsReused === 0 /* Not */ && !file.ambientModuleNames.length) {
|
|
116108
116108
|
return resolveModuleNamesWorker(
|
|
116109
116109
|
moduleNames,
|
|
@@ -116112,24 +116112,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116112
116112
|
void 0
|
|
116113
116113
|
);
|
|
116114
116114
|
}
|
|
116115
|
-
const oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
|
|
116116
|
-
if (oldSourceFile !== file && file.resolvedModules) {
|
|
116117
|
-
const result2 = [];
|
|
116118
|
-
for (const moduleName of moduleNames) {
|
|
116119
|
-
const resolvedModule = file.resolvedModules.get(moduleName.text, getModeForUsageLocation(file, moduleName));
|
|
116120
|
-
result2.push(resolvedModule);
|
|
116121
|
-
}
|
|
116122
|
-
return result2;
|
|
116123
|
-
}
|
|
116124
116115
|
let unknownModuleNames;
|
|
116125
116116
|
let result;
|
|
116126
116117
|
let reusedNames;
|
|
116127
116118
|
const predictedToResolveToAmbientModuleMarker = emptyResolution;
|
|
116119
|
+
const oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
|
|
116128
116120
|
for (let i = 0; i < moduleNames.length; i++) {
|
|
116129
116121
|
const moduleName = moduleNames[i];
|
|
116130
|
-
if (file === oldSourceFile && !hasInvalidatedResolutions(
|
|
116122
|
+
if (file === oldSourceFile && !hasInvalidatedResolutions(file.path)) {
|
|
116131
116123
|
const mode = getModeForUsageLocation(file, moduleName);
|
|
116132
|
-
const oldResolution = (_a2 =
|
|
116124
|
+
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);
|
|
116133
116125
|
if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
|
|
116134
116126
|
if (isTraceEnabled(options, host)) {
|
|
116135
116127
|
trace(
|
|
@@ -116176,7 +116168,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116176
116168
|
Debug.assert(j === resolutions.length);
|
|
116177
116169
|
return result;
|
|
116178
116170
|
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
|
|
116179
|
-
|
|
116171
|
+
var _a3, _b3, _c2;
|
|
116172
|
+
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;
|
|
116180
116173
|
const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
116181
116174
|
if (resolutionToFile && resolvedFile) {
|
|
116182
116175
|
return false;
|
|
@@ -116192,7 +116185,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116192
116185
|
}
|
|
116193
116186
|
}
|
|
116194
116187
|
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
116195
|
-
var _a2;
|
|
116188
|
+
var _a2, _b2;
|
|
116196
116189
|
if (structureIsReused === 0 /* Not */) {
|
|
116197
116190
|
return resolveTypeReferenceDirectiveNamesWorker(
|
|
116198
116191
|
typeDirectiveNames,
|
|
@@ -116201,28 +116194,18 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116201
116194
|
void 0
|
|
116202
116195
|
);
|
|
116203
116196
|
}
|
|
116204
|
-
const oldSourceFile = !isString(containingFile) ? oldProgram && oldProgram.getSourceFile(containingFile.fileName) : void 0;
|
|
116205
|
-
if (!isString(containingFile)) {
|
|
116206
|
-
if (oldSourceFile !== containingFile && containingFile.resolvedTypeReferenceDirectiveNames) {
|
|
116207
|
-
const result2 = [];
|
|
116208
|
-
for (const typeDirectiveName of typeDirectiveNames) {
|
|
116209
|
-
const resolvedTypeReferenceDirective = containingFile.resolvedTypeReferenceDirectiveNames.get(getTypeReferenceResolutionName(typeDirectiveName), getModeForFileReference(typeDirectiveName, containingFile.impliedNodeFormat));
|
|
116210
|
-
result2.push(resolvedTypeReferenceDirective);
|
|
116211
|
-
}
|
|
116212
|
-
return result2;
|
|
116213
|
-
}
|
|
116214
|
-
}
|
|
116215
116197
|
let unknownTypeReferenceDirectiveNames;
|
|
116216
116198
|
let result;
|
|
116217
116199
|
let reusedNames;
|
|
116218
116200
|
const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
|
|
116219
|
-
const
|
|
116201
|
+
const oldSourceFile = !isString(containingFile) ? oldProgram && oldProgram.getSourceFile(containingFile.fileName) : void 0;
|
|
116202
|
+
const canReuseResolutions = !isString(containingFile) ? containingFile === oldSourceFile && !hasInvalidatedResolutions(containingFile.path) : !hasInvalidatedResolutions(toPath3(containingFile));
|
|
116220
116203
|
for (let i = 0; i < typeDirectiveNames.length; i++) {
|
|
116221
116204
|
const entry = typeDirectiveNames[i];
|
|
116222
116205
|
if (canReuseResolutions) {
|
|
116223
116206
|
const typeDirectiveName = getTypeReferenceResolutionName(entry);
|
|
116224
116207
|
const mode = getModeForFileReference(entry, containingSourceFile == null ? void 0 : containingSourceFile.impliedNodeFormat);
|
|
116225
|
-
const oldResolution = (
|
|
116208
|
+
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);
|
|
116226
116209
|
if (oldResolution == null ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
|
|
116227
116210
|
if (isTraceEnabled(options, host)) {
|
|
116228
116211
|
trace(
|
|
@@ -116282,7 +116265,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116282
116265
|
);
|
|
116283
116266
|
}
|
|
116284
116267
|
function tryReuseStructureFromOldProgram() {
|
|
116285
|
-
var _a2;
|
|
116268
|
+
var _a2, _b2, _c2;
|
|
116286
116269
|
if (!oldProgram) {
|
|
116287
116270
|
return 0 /* Not */;
|
|
116288
116271
|
}
|
|
@@ -116384,42 +116367,37 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116384
116367
|
structureIsReused = 1 /* SafeModules */;
|
|
116385
116368
|
}
|
|
116386
116369
|
}
|
|
116387
|
-
modifiedSourceFiles.push(
|
|
116370
|
+
modifiedSourceFiles.push(newSourceFile);
|
|
116388
116371
|
} else if (hasInvalidatedResolutions(oldSourceFile.path)) {
|
|
116389
116372
|
structureIsReused = 1 /* SafeModules */;
|
|
116390
|
-
modifiedSourceFiles.push(
|
|
116373
|
+
modifiedSourceFiles.push(newSourceFile);
|
|
116374
|
+
} else {
|
|
116375
|
+
for (const moduleName of oldSourceFile.ambientModuleNames) {
|
|
116376
|
+
ambientModuleNameToUnmodifiedFileName.set(moduleName, oldSourceFile.fileName);
|
|
116377
|
+
}
|
|
116391
116378
|
}
|
|
116392
116379
|
newSourceFiles.push(newSourceFile);
|
|
116393
116380
|
}
|
|
116394
116381
|
if (structureIsReused !== 2 /* Completely */) {
|
|
116395
116382
|
return structureIsReused;
|
|
116396
116383
|
}
|
|
116397
|
-
const
|
|
116398
|
-
for (const oldFile of oldSourceFiles) {
|
|
116399
|
-
if (!contains(modifiedFiles, oldFile)) {
|
|
116400
|
-
for (const moduleName of oldFile.ambientModuleNames) {
|
|
116401
|
-
ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName);
|
|
116402
|
-
}
|
|
116403
|
-
}
|
|
116404
|
-
}
|
|
116405
|
-
for (const { oldFile: oldSourceFile, newFile: newSourceFile } of modifiedSourceFiles) {
|
|
116384
|
+
for (const newSourceFile of modifiedSourceFiles) {
|
|
116406
116385
|
const moduleNames = getModuleNames(newSourceFile);
|
|
116407
116386
|
const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
116408
|
-
|
|
116409
|
-
|
|
116387
|
+
(resolvedModulesProcessing ?? (resolvedModulesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, resolutions);
|
|
116388
|
+
const oldResolutions = (_b2 = oldProgram.resolvedModules) == null ? void 0 : _b2.get(newSourceFile.path);
|
|
116389
|
+
const resolutionsChanged = hasChangesInResolutions(moduleNames, newSourceFile, resolutions, oldResolutions, moduleResolutionIsEqualTo, moduleResolutionNameAndModeGetter);
|
|
116390
|
+
if (resolutionsChanged)
|
|
116410
116391
|
structureIsReused = 1 /* SafeModules */;
|
|
116411
|
-
newSourceFile.resolvedModules = zipToModeAwareCache(newSourceFile, moduleNames, resolutions, moduleResolutionNameAndModeGetter);
|
|
116412
|
-
} else {
|
|
116413
|
-
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
|
116414
|
-
}
|
|
116415
116392
|
const typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
|
|
116416
116393
|
const typeReferenceResolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typesReferenceDirectives, newSourceFile);
|
|
116417
|
-
|
|
116394
|
+
(resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, typeReferenceResolutions);
|
|
116395
|
+
const oldTypeResolutions = (_c2 = oldProgram.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _c2.get(newSourceFile.path);
|
|
116396
|
+
const typeReferenceResolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, newSourceFile, typeReferenceResolutions, oldTypeResolutions, typeDirectiveIsEqualTo, typeReferenceResolutionNameAndModeGetter);
|
|
116418
116397
|
if (typeReferenceResolutionsChanged) {
|
|
116419
116398
|
structureIsReused = 1 /* SafeModules */;
|
|
116420
|
-
|
|
116421
|
-
|
|
116422
|
-
newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
|
|
116399
|
+
} else if (oldTypeResolutions) {
|
|
116400
|
+
(resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, oldTypeResolutions);
|
|
116423
116401
|
}
|
|
116424
116402
|
}
|
|
116425
116403
|
if (structureIsReused !== 2 /* Completely */) {
|
|
@@ -116467,6 +116445,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116467
116445
|
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
|
|
116468
116446
|
redirectTargetsMap = oldProgram.redirectTargetsMap;
|
|
116469
116447
|
usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
|
|
116448
|
+
resolvedModules = oldProgram.resolvedModules;
|
|
116449
|
+
resolvedTypeReferenceDirectiveNames = oldProgram.resolvedTypeReferenceDirectiveNames;
|
|
116470
116450
|
resolvedLibReferences = oldProgram.resolvedLibReferences;
|
|
116471
116451
|
packageMap = oldProgram.getCurrentPackagesMap();
|
|
116472
116452
|
return 2 /* Completely */;
|
|
@@ -117512,16 +117492,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117512
117492
|
}
|
|
117513
117493
|
function processTypeReferenceDirectives(file) {
|
|
117514
117494
|
const typeDirectives = file.typeReferenceDirectives;
|
|
117515
|
-
if (!typeDirectives.length)
|
|
117516
|
-
file.resolvedTypeReferenceDirectiveNames = void 0;
|
|
117495
|
+
if (!typeDirectives.length)
|
|
117517
117496
|
return;
|
|
117518
|
-
|
|
117519
|
-
const
|
|
117497
|
+
const resolutions = (resolvedTypeReferenceDirectiveNamesProcessing == null ? void 0 : resolvedTypeReferenceDirectiveNamesProcessing.get(file.path)) || resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectives, file);
|
|
117498
|
+
const resolutionsInFile = createModeAwareCache();
|
|
117499
|
+
(resolvedTypeReferenceDirectiveNames ?? (resolvedTypeReferenceDirectiveNames = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
|
|
117520
117500
|
for (let index = 0; index < typeDirectives.length; index++) {
|
|
117521
117501
|
const ref = file.typeReferenceDirectives[index];
|
|
117522
117502
|
const resolvedTypeReferenceDirective = resolutions[index];
|
|
117523
117503
|
const fileName = toFileNameLowerCase(ref.fileName);
|
|
117524
|
-
|
|
117504
|
+
resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
|
|
117525
117505
|
const mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
117526
117506
|
if (mode && getEmitModuleResolutionKind(options) !== 3 /* Node16 */ && getEmitModuleResolutionKind(options) !== 99 /* NodeNext */) {
|
|
117527
117507
|
(fileProcessingDiagnostics ?? (fileProcessingDiagnostics = [])).push({
|
|
@@ -117685,14 +117665,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117685
117665
|
collectExternalModuleReferences(file);
|
|
117686
117666
|
if (file.imports.length || file.moduleAugmentations.length) {
|
|
117687
117667
|
const moduleNames = getModuleNames(file);
|
|
117688
|
-
const resolutions = resolveModuleNamesReusingOldState(moduleNames, file);
|
|
117668
|
+
const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
|
|
117689
117669
|
Debug.assert(resolutions.length === moduleNames.length);
|
|
117690
117670
|
const optionsForFile = (useSourceOfProjectReferenceRedirect ? (_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options : void 0) || options;
|
|
117671
|
+
const resolutionsInFile = createModeAwareCache();
|
|
117672
|
+
(resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
|
|
117691
117673
|
for (let index = 0; index < moduleNames.length; index++) {
|
|
117692
117674
|
const resolution = resolutions[index].resolvedModule;
|
|
117693
117675
|
const moduleName = moduleNames[index].text;
|
|
117694
117676
|
const mode = getModeForUsageLocation(file, moduleNames[index]);
|
|
117695
|
-
|
|
117677
|
+
resolutionsInFile.set(moduleName, mode, resolutions[index]);
|
|
117696
117678
|
addResolutionDiagnosticsFromResolutionOrCache(file, moduleName, resolutions[index], mode);
|
|
117697
117679
|
if (!resolution) {
|
|
117698
117680
|
continue;
|
|
@@ -117723,8 +117705,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117723
117705
|
currentNodeModulesDepth--;
|
|
117724
117706
|
}
|
|
117725
117707
|
}
|
|
117726
|
-
} else {
|
|
117727
|
-
file.resolvedModules = void 0;
|
|
117728
117708
|
}
|
|
117729
117709
|
}
|
|
117730
117710
|
function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) {
|
|
@@ -118239,7 +118219,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118239
118219
|
processReason(fileProcessingReason);
|
|
118240
118220
|
if (locationReason && (fileIncludeReasons == null ? void 0 : fileIncludeReasons.length) === 1)
|
|
118241
118221
|
fileIncludeReasons = void 0;
|
|
118242
|
-
const location = locationReason && getReferencedFileLocation(
|
|
118222
|
+
const location = locationReason && getReferencedFileLocation(program, locationReason);
|
|
118243
118223
|
const fileIncludeReasonDetails = fileIncludeReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
|
|
118244
118224
|
const redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file);
|
|
118245
118225
|
const chain = chainDiagnosticMessages(redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails, diagnostic, ...args || emptyArray);
|
|
@@ -118275,7 +118255,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118275
118255
|
}
|
|
118276
118256
|
function fileIncludeReasonToRelatedInformation(reason) {
|
|
118277
118257
|
if (isReferencedFile(reason)) {
|
|
118278
|
-
const referenceLocation = getReferencedFileLocation(
|
|
118258
|
+
const referenceLocation = getReferencedFileLocation(program, reason);
|
|
118279
118259
|
let message2;
|
|
118280
118260
|
switch (reason.kind) {
|
|
118281
118261
|
case 3 /* Import */:
|
|
@@ -118564,8 +118544,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118564
118544
|
if (!symlinks) {
|
|
118565
118545
|
symlinks = createSymlinkCache(currentDirectory, getCanonicalFileName);
|
|
118566
118546
|
}
|
|
118567
|
-
if (files &&
|
|
118568
|
-
symlinks.setSymlinksFromResolutions(
|
|
118547
|
+
if (files && !symlinks.hasProcessedResolutions()) {
|
|
118548
|
+
symlinks.setSymlinksFromResolutions(resolvedModules, resolvedTypeReferenceDirectiveNames, automaticTypeDirectiveResolutions);
|
|
118569
118549
|
}
|
|
118570
118550
|
return symlinks;
|
|
118571
118551
|
}
|
|
@@ -118919,6 +118899,7 @@ var BuilderState;
|
|
|
118919
118899
|
return toPath(program.getProjectReferenceRedirect(fileName) || fileName, sourceFileDirectory, getCanonicalFileName);
|
|
118920
118900
|
}
|
|
118921
118901
|
function getReferencedFiles(program, sourceFile, getCanonicalFileName) {
|
|
118902
|
+
var _a;
|
|
118922
118903
|
let referencedFiles;
|
|
118923
118904
|
if (sourceFile.imports && sourceFile.imports.length > 0) {
|
|
118924
118905
|
const checker = program.getTypeChecker();
|
|
@@ -118934,8 +118915,9 @@ var BuilderState;
|
|
|
118934
118915
|
addReferencedFile(referencedPath);
|
|
118935
118916
|
}
|
|
118936
118917
|
}
|
|
118937
|
-
|
|
118938
|
-
|
|
118918
|
+
const resolvedTypeReferenceDirectiveNames = (_a = program.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a.get(sourceFile.path);
|
|
118919
|
+
if (resolvedTypeReferenceDirectiveNames) {
|
|
118920
|
+
resolvedTypeReferenceDirectiveNames.forEach(({ resolvedTypeReferenceDirective }) => {
|
|
118939
118921
|
if (!resolvedTypeReferenceDirective) {
|
|
118940
118922
|
return;
|
|
118941
118923
|
}
|
|
@@ -120731,7 +120713,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
120731
120713
|
clear: clear2,
|
|
120732
120714
|
onChangesAffectModuleResolution
|
|
120733
120715
|
};
|
|
120734
|
-
function
|
|
120716
|
+
function getResolvedModule(resolution) {
|
|
120735
120717
|
return resolution.resolvedModule;
|
|
120736
120718
|
}
|
|
120737
120719
|
function getResolvedTypeReferenceDirective(resolution) {
|
|
@@ -120810,7 +120792,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
120810
120792
|
stopWatchFailedLookupLocationOfResolution(
|
|
120811
120793
|
resolution,
|
|
120812
120794
|
resolutionHost.toPath(getInferredLibraryNameResolveFrom(newProgram.getCompilerOptions(), getCurrentDirectory(), libFileName)),
|
|
120813
|
-
|
|
120795
|
+
getResolvedModule
|
|
120814
120796
|
);
|
|
120815
120797
|
resolvedLibraries.delete(libFileName);
|
|
120816
120798
|
}
|
|
@@ -121035,7 +121017,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121035
121017
|
redirectedReference,
|
|
121036
121018
|
options
|
|
121037
121019
|
),
|
|
121038
|
-
getResolutionWithResolvedFileName:
|
|
121020
|
+
getResolutionWithResolvedFileName: getResolvedModule,
|
|
121039
121021
|
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|
|
121040
121022
|
logChanges: logChangesWhenResolvingModule,
|
|
121041
121023
|
deferWatchingNonRelativeResolution: true
|
|
@@ -121054,17 +121036,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121054
121036
|
libraryName,
|
|
121055
121037
|
resolution,
|
|
121056
121038
|
path,
|
|
121057
|
-
|
|
121039
|
+
getResolvedModule,
|
|
121058
121040
|
/*deferWatchingNonRelativeResolution*/
|
|
121059
121041
|
false
|
|
121060
121042
|
);
|
|
121061
121043
|
resolvedLibraries.set(libFileName, resolution);
|
|
121062
121044
|
if (existingResolution) {
|
|
121063
|
-
stopWatchFailedLookupLocationOfResolution(existingResolution, path,
|
|
121045
|
+
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModule);
|
|
121064
121046
|
}
|
|
121065
121047
|
} else {
|
|
121066
121048
|
if (isTraceEnabled(options, host)) {
|
|
121067
|
-
const resolved =
|
|
121049
|
+
const resolved = getResolvedModule(resolution);
|
|
121068
121050
|
trace(
|
|
121069
121051
|
host,
|
|
121070
121052
|
(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,
|
|
@@ -121341,7 +121323,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121341
121323
|
resolvedProjectReference.commandLine.fileNames.forEach((f) => removeResolutionsOfFile(resolutionHost.toPath(f)));
|
|
121342
121324
|
}
|
|
121343
121325
|
function removeResolutionsOfFile(filePath) {
|
|
121344
|
-
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath,
|
|
121326
|
+
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule);
|
|
121345
121327
|
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective);
|
|
121346
121328
|
}
|
|
121347
121329
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
@@ -121768,7 +121750,7 @@ function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
|
|
|
121768
121750
|
var _a, _b;
|
|
121769
121751
|
const options = program.getCompilerOptions();
|
|
121770
121752
|
if (isReferencedFile(reason)) {
|
|
121771
|
-
const referenceLocation = getReferencedFileLocation(
|
|
121753
|
+
const referenceLocation = getReferencedFileLocation(program, reason);
|
|
121772
121754
|
const referenceText = isReferenceFileLocation(referenceLocation) ? referenceLocation.file.text.substring(referenceLocation.pos, referenceLocation.end) : `"${referenceLocation.text}"`;
|
|
121773
121755
|
let message;
|
|
121774
121756
|
Debug.assert(isReferenceFileLocation(referenceLocation) || reason.kind === 3 /* Import */, "Only synthetic references are imports");
|