typescript 5.3.0-dev.20230922 → 5.3.0-dev.20230923
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/tsc.js +255 -164
- package/lib/tsserver.js +441 -229
- package/lib/typescript.d.ts +56 -2
- package/lib/typescript.js +440 -231
- package/lib/typingsInstaller.js +10 -13
- 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.20230923`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -6642,6 +6642,7 @@ var Diagnostics = {
|
|
|
6642
6642
|
await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(2852, 1 /* Error */, "await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_2852", "'await using' statements are only allowed within async functions and at the top levels of modules."),
|
|
6643
6643
|
await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(2853, 1 /* Error */, "await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_th_2853", "'await using' statements are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
|
|
6644
6644
|
Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(2854, 1 /* Error */, "Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_sys_2854", "Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
|
|
6645
|
+
Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super: diag(2855, 1 /* Error */, "Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super_2855", "Class field '{0}' defined by the parent class is not accessible in the child class via super."),
|
|
6645
6646
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
6646
6647
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
6647
6648
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -10805,6 +10806,9 @@ function isAccessor(node) {
|
|
|
10805
10806
|
function isAutoAccessorPropertyDeclaration(node) {
|
|
10806
10807
|
return isPropertyDeclaration(node) && hasAccessorModifier(node);
|
|
10807
10808
|
}
|
|
10809
|
+
function isClassFieldAndNotAutoAccessor(node) {
|
|
10810
|
+
return node.parent && isClassLike(node.parent) && isPropertyDeclaration(node) && !hasAccessorModifier(node);
|
|
10811
|
+
}
|
|
10808
10812
|
function isMethodOrAccessor(node) {
|
|
10809
10813
|
switch (node.kind) {
|
|
10810
10814
|
case 174 /* MethodDeclaration */:
|
|
@@ -11458,8 +11462,8 @@ function moduleResolutionIsEqualTo(oldResolution, newResolution) {
|
|
|
11458
11462
|
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;
|
|
11459
11463
|
}
|
|
11460
11464
|
function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageName) {
|
|
11461
|
-
var _a
|
|
11462
|
-
const node10Result = (
|
|
11465
|
+
var _a;
|
|
11466
|
+
const node10Result = (_a = host.getResolvedModule(sourceFile, moduleReference, mode)) == null ? void 0 : _a.node10Result;
|
|
11463
11467
|
const result = node10Result ? chainDiagnosticMessages(
|
|
11464
11468
|
/*details*/
|
|
11465
11469
|
void 0,
|
|
@@ -11501,14 +11505,14 @@ function packageIdToString(packageId) {
|
|
|
11501
11505
|
function typeDirectiveIsEqualTo(oldResolution, newResolution) {
|
|
11502
11506
|
return oldResolution === newResolution || oldResolution.resolvedTypeReferenceDirective === newResolution.resolvedTypeReferenceDirective || !!oldResolution.resolvedTypeReferenceDirective && !!newResolution.resolvedTypeReferenceDirective && oldResolution.resolvedTypeReferenceDirective.resolvedFileName === newResolution.resolvedTypeReferenceDirective.resolvedFileName && !!oldResolution.resolvedTypeReferenceDirective.primary === !!newResolution.resolvedTypeReferenceDirective.primary && oldResolution.resolvedTypeReferenceDirective.originalPath === newResolution.resolvedTypeReferenceDirective.originalPath;
|
|
11503
11507
|
}
|
|
11504
|
-
function hasChangesInResolutions(names, newSourceFile, newResolutions,
|
|
11508
|
+
function hasChangesInResolutions(names, newSourceFile, newResolutions, getOldResolution, comparer, nameAndModeGetter) {
|
|
11505
11509
|
Debug.assert(names.length === newResolutions.length);
|
|
11506
11510
|
for (let i = 0; i < names.length; i++) {
|
|
11507
11511
|
const newResolution = newResolutions[i];
|
|
11508
11512
|
const entry = names[i];
|
|
11509
11513
|
const name = nameAndModeGetter.getName(entry);
|
|
11510
11514
|
const mode = nameAndModeGetter.getMode(entry, newSourceFile);
|
|
11511
|
-
const oldResolution =
|
|
11515
|
+
const oldResolution = getOldResolution(name, mode);
|
|
11512
11516
|
const changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution;
|
|
11513
11517
|
if (changed) {
|
|
11514
11518
|
return true;
|
|
@@ -16474,11 +16478,11 @@ function createSymlinkCache(cwd, getCanonicalFileName) {
|
|
|
16474
16478
|
(symlinkedDirectories || (symlinkedDirectories = /* @__PURE__ */ new Map())).set(symlinkPath, real);
|
|
16475
16479
|
}
|
|
16476
16480
|
},
|
|
16477
|
-
setSymlinksFromResolutions(
|
|
16481
|
+
setSymlinksFromResolutions(forEachResolvedModule, forEachResolvedTypeReferenceDirective, typeReferenceDirectives) {
|
|
16478
16482
|
Debug.assert(!hasProcessedResolutions);
|
|
16479
16483
|
hasProcessedResolutions = true;
|
|
16480
|
-
|
|
16481
|
-
|
|
16484
|
+
forEachResolvedModule((resolution) => processResolution(this, resolution.resolvedModule));
|
|
16485
|
+
forEachResolvedTypeReferenceDirective((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
16482
16486
|
typeReferenceDirectives.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
16483
16487
|
},
|
|
16484
16488
|
hasProcessedResolutions: () => hasProcessedResolutions
|
|
@@ -46298,7 +46302,7 @@ function createTypeChecker(host) {
|
|
|
46298
46302
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
|
|
46299
46303
|
}
|
|
46300
46304
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
46301
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k
|
|
46305
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
46302
46306
|
if (startsWith(moduleReference, "@types/")) {
|
|
46303
46307
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
46304
46308
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -46316,7 +46320,7 @@ function createTypeChecker(host) {
|
|
|
46316
46320
|
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);
|
|
46317
46321
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
46318
46322
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
46319
|
-
const resolvedModule = (
|
|
46323
|
+
const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
|
|
46320
46324
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
46321
46325
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
46322
46326
|
if (sourceFile) {
|
|
@@ -46324,7 +46328,7 @@ function createTypeChecker(host) {
|
|
|
46324
46328
|
error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
46325
46329
|
}
|
|
46326
46330
|
if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
|
|
46327
|
-
const importOrExport = ((
|
|
46331
|
+
const importOrExport = ((_h = findAncestor(location, isImportDeclaration)) == null ? void 0 : _h.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
46328
46332
|
if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
|
|
46329
46333
|
error(
|
|
46330
46334
|
errorNode,
|
|
@@ -46333,7 +46337,7 @@ function createTypeChecker(host) {
|
|
|
46333
46337
|
);
|
|
46334
46338
|
}
|
|
46335
46339
|
} else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
|
|
46336
|
-
const importOrExport = ((
|
|
46340
|
+
const importOrExport = ((_i = findAncestor(location, isImportDeclaration)) == null ? void 0 : _i.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
46337
46341
|
if (!((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
|
|
46338
46342
|
const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
|
|
46339
46343
|
error(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
|
|
@@ -46354,7 +46358,7 @@ function createTypeChecker(host) {
|
|
|
46354
46358
|
if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
|
|
46355
46359
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
46356
46360
|
const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
46357
|
-
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (
|
|
46361
|
+
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_j = overrideClauseHost.assertions) == null ? void 0 : _j.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
46358
46362
|
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) {
|
|
46359
46363
|
if (findAncestor(location, isImportEqualsDeclaration)) {
|
|
46360
46364
|
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);
|
|
@@ -46461,7 +46465,7 @@ function createTypeChecker(host) {
|
|
|
46461
46465
|
error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
46462
46466
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
46463
46467
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
46464
|
-
const suggestedExt = (
|
|
46468
|
+
const suggestedExt = (_k = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _k[1];
|
|
46465
46469
|
if (suggestedExt) {
|
|
46466
46470
|
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);
|
|
46467
46471
|
} else {
|
|
@@ -69135,6 +69139,7 @@ function createTypeChecker(host) {
|
|
|
69135
69139
|
return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode);
|
|
69136
69140
|
}
|
|
69137
69141
|
function checkPropertyAccessibilityAtLocation(location, isSuper, writing, containingType, prop, errorNode) {
|
|
69142
|
+
var _a;
|
|
69138
69143
|
const flags = getDeclarationModifierFlagsFromSymbol(prop, writing);
|
|
69139
69144
|
if (isSuper) {
|
|
69140
69145
|
if (languageVersion < 2 /* ES2015 */) {
|
|
@@ -69151,6 +69156,12 @@ function createTypeChecker(host) {
|
|
|
69151
69156
|
}
|
|
69152
69157
|
return false;
|
|
69153
69158
|
}
|
|
69159
|
+
if (!(flags & 32 /* Static */) && ((_a = prop.declarations) == null ? void 0 : _a.some(isClassFieldAndNotAutoAccessor))) {
|
|
69160
|
+
if (errorNode) {
|
|
69161
|
+
error(errorNode, Diagnostics.Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super, symbolToString(prop));
|
|
69162
|
+
}
|
|
69163
|
+
return false;
|
|
69164
|
+
}
|
|
69154
69165
|
}
|
|
69155
69166
|
if (flags & 256 /* Abstract */ && symbolHasNonMethodDeclaration(prop) && (isThisProperty(location) || isThisInitializedObjectBindingExpression(location) || isObjectBindingPattern(location.parent) && isThisInitializedDeclaration(location.parent.parent))) {
|
|
69156
69167
|
const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
|
|
@@ -69556,11 +69567,17 @@ function createTypeChecker(host) {
|
|
|
69556
69567
|
return getFlowTypeOfAccessExpression(node, prop, propType, right, checkMode);
|
|
69557
69568
|
}
|
|
69558
69569
|
function isUncheckedJSSuggestion(node, suggestion, excludeClasses) {
|
|
69570
|
+
var _a;
|
|
69559
69571
|
const file = getSourceFileOfNode(node);
|
|
69560
69572
|
if (file) {
|
|
69561
69573
|
if (compilerOptions.checkJs === void 0 && file.checkJsDirective === void 0 && (file.scriptKind === 1 /* JS */ || file.scriptKind === 2 /* JSX */)) {
|
|
69562
69574
|
const declarationFile = forEach(suggestion == null ? void 0 : suggestion.declarations, getSourceFileOfNode);
|
|
69563
|
-
|
|
69575
|
+
const suggestionHasNoExtendsOrDecorators = !(suggestion == null ? void 0 : suggestion.valueDeclaration) || !isClassLike(suggestion.valueDeclaration) || ((_a = suggestion.valueDeclaration.heritageClauses) == null ? void 0 : _a.length) || classOrConstructorParameterIsDecorated(
|
|
69576
|
+
/*useLegacyDecorators*/
|
|
69577
|
+
false,
|
|
69578
|
+
suggestion.valueDeclaration
|
|
69579
|
+
);
|
|
69580
|
+
return !(file !== declarationFile && !!declarationFile && isGlobalSourceFile(declarationFile)) && !(excludeClasses && suggestion && suggestion.flags & 32 /* Class */ && suggestionHasNoExtendsOrDecorators) && !(!!node && excludeClasses && isPropertyAccessExpression(node) && node.expression.kind === 110 /* ThisKeyword */ && suggestionHasNoExtendsOrDecorators);
|
|
69564
69581
|
}
|
|
69565
69582
|
}
|
|
69566
69583
|
return false;
|
|
@@ -109266,6 +109283,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
109266
109283
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
109267
109284
|
extendedDiagnostics: compilerOptions.extendedDiagnostics,
|
|
109268
109285
|
onlyPrintJsDocStyle: true,
|
|
109286
|
+
omitBraceSourceMapPositions: true,
|
|
109269
109287
|
writeBundleFileInfo: !!bundleBuildInfo,
|
|
109270
109288
|
recordInternalSection: !!bundleBuildInfo,
|
|
109271
109289
|
relativeToBuildInfo
|
|
@@ -109676,6 +109694,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
109676
109694
|
onAfterEmitToken
|
|
109677
109695
|
} = handlers;
|
|
109678
109696
|
var extendedDiagnostics = !!printerOptions.extendedDiagnostics;
|
|
109697
|
+
var omitBraceSourcePositions = !!printerOptions.omitBraceSourceMapPositions;
|
|
109679
109698
|
var newLine = getNewLineCharacter(printerOptions);
|
|
109680
109699
|
var moduleKind = getEmitModuleKind(printerOptions);
|
|
109681
109700
|
var bundledHelpers = /* @__PURE__ */ new Map();
|
|
@@ -111671,7 +111690,11 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
111671
111690
|
decreaseIndent();
|
|
111672
111691
|
}
|
|
111673
111692
|
}
|
|
111674
|
-
|
|
111693
|
+
if (!omitBraceSourcePositions && (token === 19 /* OpenBraceToken */ || token === 20 /* CloseBraceToken */)) {
|
|
111694
|
+
pos = writeToken(token, pos, writer2, contextNode);
|
|
111695
|
+
} else {
|
|
111696
|
+
pos = writeTokenText(token, writer2, pos);
|
|
111697
|
+
}
|
|
111675
111698
|
if (isSimilarNode && contextNode.end !== pos) {
|
|
111676
111699
|
const isJsxExprContext = contextNode.kind === 294 /* JsxExpression */;
|
|
111677
111700
|
emitTrailingCommentsOfPosition(
|
|
@@ -115394,14 +115417,14 @@ function isReferenceFileLocation(location) {
|
|
|
115394
115417
|
return location.pos !== void 0;
|
|
115395
115418
|
}
|
|
115396
115419
|
function getReferencedFileLocation(program, ref) {
|
|
115397
|
-
var _a, _b, _c, _d
|
|
115420
|
+
var _a, _b, _c, _d;
|
|
115398
115421
|
const file = Debug.checkDefined(program.getSourceFileByPath(ref.file));
|
|
115399
115422
|
const { kind, index } = ref;
|
|
115400
115423
|
let pos, end, packageId, resolutionMode;
|
|
115401
115424
|
switch (kind) {
|
|
115402
115425
|
case 3 /* Import */:
|
|
115403
115426
|
const importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
115404
|
-
packageId = (
|
|
115427
|
+
packageId = (_b = (_a = program.getResolvedModule(file, importLiteral.text, getModeForResolutionAtIndex(file, index))) == null ? void 0 : _a.resolvedModule) == null ? void 0 : _b.packageId;
|
|
115405
115428
|
if (importLiteral.pos === -1)
|
|
115406
115429
|
return { file, packageId, text: importLiteral.text };
|
|
115407
115430
|
pos = skipTrivia(file.text, importLiteral.pos);
|
|
@@ -115412,7 +115435,7 @@ function getReferencedFileLocation(program, ref) {
|
|
|
115412
115435
|
break;
|
|
115413
115436
|
case 5 /* TypeReferenceDirective */:
|
|
115414
115437
|
({ pos, end, resolutionMode } = file.typeReferenceDirectives[index]);
|
|
115415
|
-
packageId = (
|
|
115438
|
+
packageId = (_d = (_c = program.getResolvedTypeReferenceDirective(file, toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), resolutionMode || file.impliedNodeFormat)) == null ? void 0 : _c.resolvedTypeReferenceDirective) == null ? void 0 : _d.packageId;
|
|
115416
115439
|
break;
|
|
115417
115440
|
case 7 /* LibReferenceDirective */:
|
|
115418
115441
|
({ pos, end } = file.libReferenceDirectives[index]);
|
|
@@ -115940,6 +115963,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115940
115963
|
resolvedModules,
|
|
115941
115964
|
resolvedTypeReferenceDirectiveNames,
|
|
115942
115965
|
resolvedLibReferences,
|
|
115966
|
+
getResolvedModule,
|
|
115967
|
+
getResolvedTypeReferenceDirective,
|
|
115968
|
+
forEachResolvedModule,
|
|
115969
|
+
forEachResolvedTypeReferenceDirective,
|
|
115943
115970
|
getCurrentPackagesMap: () => packageMap,
|
|
115944
115971
|
typesPackageExists,
|
|
115945
115972
|
packageBundlesTypes,
|
|
@@ -115983,19 +116010,35 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115983
116010
|
measure("Program", "beforeProgram", "afterProgram");
|
|
115984
116011
|
(_p = tracing) == null ? void 0 : _p.pop();
|
|
115985
116012
|
return program;
|
|
116013
|
+
function getResolvedModule(file, moduleName, mode) {
|
|
116014
|
+
var _a2;
|
|
116015
|
+
return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(file.path)) == null ? void 0 : _a2.get(moduleName, mode);
|
|
116016
|
+
}
|
|
116017
|
+
function getResolvedTypeReferenceDirective(file, typeDirectiveName, mode) {
|
|
116018
|
+
var _a2;
|
|
116019
|
+
return (_a2 = resolvedTypeReferenceDirectiveNames == null ? void 0 : resolvedTypeReferenceDirectiveNames.get(file.path)) == null ? void 0 : _a2.get(typeDirectiveName, mode);
|
|
116020
|
+
}
|
|
116021
|
+
function forEachResolvedModule(callback, file) {
|
|
116022
|
+
forEachResolution(resolvedModules, callback, file);
|
|
116023
|
+
}
|
|
116024
|
+
function forEachResolvedTypeReferenceDirective(callback, file) {
|
|
116025
|
+
forEachResolution(resolvedTypeReferenceDirectiveNames, callback, file);
|
|
116026
|
+
}
|
|
116027
|
+
function forEachResolution(resolutionCache, callback, file) {
|
|
116028
|
+
var _a2;
|
|
116029
|
+
if (file)
|
|
116030
|
+
(_a2 = resolutionCache == null ? void 0 : resolutionCache.get(file.path)) == null ? void 0 : _a2.forEach((resolution, name, mode) => callback(resolution, name, mode, file.path));
|
|
116031
|
+
else
|
|
116032
|
+
resolutionCache == null ? void 0 : resolutionCache.forEach((resolutions, filePath) => resolutions.forEach((resolution, name, mode) => callback(resolution, name, mode, filePath)));
|
|
116033
|
+
}
|
|
115986
116034
|
function getPackagesMap() {
|
|
115987
116035
|
if (packageMap)
|
|
115988
116036
|
return packageMap;
|
|
115989
116037
|
packageMap = /* @__PURE__ */ new Map();
|
|
115990
|
-
|
|
115991
|
-
(
|
|
115992
|
-
|
|
115993
|
-
|
|
115994
|
-
if (resolvedModule == null ? void 0 : resolvedModule.packageId)
|
|
115995
|
-
packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
|
|
115996
|
-
});
|
|
115997
|
-
}
|
|
115998
|
-
);
|
|
116038
|
+
forEachResolvedModule(({ resolvedModule }) => {
|
|
116039
|
+
if (resolvedModule == null ? void 0 : resolvedModule.packageId)
|
|
116040
|
+
packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
|
|
116041
|
+
});
|
|
115999
116042
|
return packageMap;
|
|
116000
116043
|
}
|
|
116001
116044
|
function typesPackageExists(packageName) {
|
|
@@ -116127,7 +116170,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116127
116170
|
return classifiableNames;
|
|
116128
116171
|
}
|
|
116129
116172
|
function resolveModuleNamesReusingOldState(moduleNames, file) {
|
|
116130
|
-
var _a2, _b2;
|
|
116131
116173
|
if (structureIsReused === 0 /* Not */ && !file.ambientModuleNames.length) {
|
|
116132
116174
|
return resolveModuleNamesWorker(
|
|
116133
116175
|
moduleNames,
|
|
@@ -116145,7 +116187,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116145
116187
|
const moduleName = moduleNames[i];
|
|
116146
116188
|
if (file === oldSourceFile && !hasInvalidatedResolutions(file.path)) {
|
|
116147
116189
|
const mode = getModeForUsageLocation(file, moduleName);
|
|
116148
|
-
const oldResolution =
|
|
116190
|
+
const oldResolution = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, mode);
|
|
116149
116191
|
if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
|
|
116150
116192
|
if (isTraceEnabled(options, host)) {
|
|
116151
116193
|
trace(
|
|
@@ -116192,8 +116234,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116192
116234
|
Debug.assert(j === resolutions.length);
|
|
116193
116235
|
return result;
|
|
116194
116236
|
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
|
|
116195
|
-
var
|
|
116196
|
-
const resolutionToFile = (
|
|
116237
|
+
var _a2;
|
|
116238
|
+
const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation(file, moduleName))) == null ? void 0 : _a2.resolvedModule;
|
|
116197
116239
|
const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
116198
116240
|
if (resolutionToFile && resolvedFile) {
|
|
116199
116241
|
return false;
|
|
@@ -116209,7 +116251,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116209
116251
|
}
|
|
116210
116252
|
}
|
|
116211
116253
|
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
116212
|
-
var _a2
|
|
116254
|
+
var _a2;
|
|
116213
116255
|
if (structureIsReused === 0 /* Not */) {
|
|
116214
116256
|
return resolveTypeReferenceDirectiveNamesWorker(
|
|
116215
116257
|
typeDirectiveNames,
|
|
@@ -116229,7 +116271,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116229
116271
|
if (canReuseResolutions) {
|
|
116230
116272
|
const typeDirectiveName = getTypeReferenceResolutionName(entry);
|
|
116231
116273
|
const mode = getModeForFileReference(entry, containingSourceFile == null ? void 0 : containingSourceFile.impliedNodeFormat);
|
|
116232
|
-
const oldResolution =
|
|
116274
|
+
const oldResolution = !isString(containingFile) ? oldProgram == null ? void 0 : oldProgram.getResolvedTypeReferenceDirective(containingFile, typeDirectiveName, mode) : (_a2 = oldProgram == null ? void 0 : oldProgram.getAutomaticTypeDirectiveResolutions()) == null ? void 0 : _a2.get(typeDirectiveName, mode);
|
|
116233
116275
|
if (oldResolution == null ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
|
|
116234
116276
|
if (isTraceEnabled(options, host)) {
|
|
116235
116277
|
trace(
|
|
@@ -116289,7 +116331,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116289
116331
|
);
|
|
116290
116332
|
}
|
|
116291
116333
|
function tryReuseStructureFromOldProgram() {
|
|
116292
|
-
var _a2
|
|
116334
|
+
var _a2;
|
|
116293
116335
|
if (!oldProgram) {
|
|
116294
116336
|
return 0 /* Not */;
|
|
116295
116337
|
}
|
|
@@ -116409,20 +116451,29 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116409
116451
|
const moduleNames = getModuleNames(newSourceFile);
|
|
116410
116452
|
const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
116411
116453
|
(resolvedModulesProcessing ?? (resolvedModulesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, resolutions);
|
|
116412
|
-
const
|
|
116413
|
-
|
|
116454
|
+
const resolutionsChanged = hasChangesInResolutions(
|
|
116455
|
+
moduleNames,
|
|
116456
|
+
newSourceFile,
|
|
116457
|
+
resolutions,
|
|
116458
|
+
(name, mode) => oldProgram.getResolvedModule(newSourceFile, name, mode),
|
|
116459
|
+
moduleResolutionIsEqualTo,
|
|
116460
|
+
moduleResolutionNameAndModeGetter
|
|
116461
|
+
);
|
|
116414
116462
|
if (resolutionsChanged)
|
|
116415
116463
|
structureIsReused = 1 /* SafeModules */;
|
|
116416
116464
|
const typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
|
|
116417
116465
|
const typeReferenceResolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typesReferenceDirectives, newSourceFile);
|
|
116418
116466
|
(resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, typeReferenceResolutions);
|
|
116419
|
-
const
|
|
116420
|
-
|
|
116421
|
-
|
|
116467
|
+
const typeReferenceResolutionsChanged = hasChangesInResolutions(
|
|
116468
|
+
typesReferenceDirectives,
|
|
116469
|
+
newSourceFile,
|
|
116470
|
+
typeReferenceResolutions,
|
|
116471
|
+
(name, mode) => oldProgram == null ? void 0 : oldProgram.getResolvedTypeReferenceDirective(newSourceFile, name, mode),
|
|
116472
|
+
typeDirectiveIsEqualTo,
|
|
116473
|
+
typeReferenceResolutionNameAndModeGetter
|
|
116474
|
+
);
|
|
116475
|
+
if (typeReferenceResolutionsChanged)
|
|
116422
116476
|
structureIsReused = 1 /* SafeModules */;
|
|
116423
|
-
} else if (oldTypeResolutions) {
|
|
116424
|
-
(resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, oldTypeResolutions);
|
|
116425
|
-
}
|
|
116426
116477
|
}
|
|
116427
116478
|
if (structureIsReused !== 2 /* Completely */) {
|
|
116428
116479
|
return structureIsReused;
|
|
@@ -118569,7 +118620,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118569
118620
|
symlinks = createSymlinkCache(currentDirectory, getCanonicalFileName);
|
|
118570
118621
|
}
|
|
118571
118622
|
if (files && !symlinks.hasProcessedResolutions()) {
|
|
118572
|
-
symlinks.setSymlinksFromResolutions(
|
|
118623
|
+
symlinks.setSymlinksFromResolutions(forEachResolvedModule, forEachResolvedTypeReferenceDirective, automaticTypeDirectiveResolutions);
|
|
118573
118624
|
}
|
|
118574
118625
|
return symlinks;
|
|
118575
118626
|
}
|
|
@@ -118923,7 +118974,6 @@ var BuilderState;
|
|
|
118923
118974
|
return toPath(program.getProjectReferenceRedirect(fileName) || fileName, sourceFileDirectory, getCanonicalFileName);
|
|
118924
118975
|
}
|
|
118925
118976
|
function getReferencedFiles(program, sourceFile, getCanonicalFileName) {
|
|
118926
|
-
var _a;
|
|
118927
118977
|
let referencedFiles;
|
|
118928
118978
|
if (sourceFile.imports && sourceFile.imports.length > 0) {
|
|
118929
118979
|
const checker = program.getTypeChecker();
|
|
@@ -118939,17 +118989,14 @@ var BuilderState;
|
|
|
118939
118989
|
addReferencedFile(referencedPath);
|
|
118940
118990
|
}
|
|
118941
118991
|
}
|
|
118942
|
-
|
|
118943
|
-
|
|
118944
|
-
|
|
118945
|
-
|
|
118946
|
-
|
|
118947
|
-
|
|
118948
|
-
|
|
118949
|
-
|
|
118950
|
-
addReferencedFile(typeFilePath);
|
|
118951
|
-
});
|
|
118952
|
-
}
|
|
118992
|
+
program.forEachResolvedTypeReferenceDirective(({ resolvedTypeReferenceDirective }) => {
|
|
118993
|
+
if (!resolvedTypeReferenceDirective) {
|
|
118994
|
+
return;
|
|
118995
|
+
}
|
|
118996
|
+
const fileName = resolvedTypeReferenceDirective.resolvedFileName;
|
|
118997
|
+
const typeFilePath = getReferencedFileFromFileName(program, fileName, sourceFileDirectory, getCanonicalFileName);
|
|
118998
|
+
addReferencedFile(typeFilePath);
|
|
118999
|
+
}, sourceFile);
|
|
118953
119000
|
if (sourceFile.moduleAugmentations.length) {
|
|
118954
119001
|
const checker = program.getTypeChecker();
|
|
118955
119002
|
for (const moduleName of sourceFile.moduleAugmentations) {
|
|
@@ -120667,6 +120714,47 @@ function getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirec
|
|
|
120667
120714
|
const normalized = getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory());
|
|
120668
120715
|
return !isDiskPathRoot(normalized) ? removeTrailingDirectorySeparator(normalized) : normalized;
|
|
120669
120716
|
}
|
|
120717
|
+
function createModuleResolutionLoaderUsingGlobalCache(containingFile, redirectedReference, options, resolutionHost, moduleResolutionCache) {
|
|
120718
|
+
return {
|
|
120719
|
+
nameAndMode: moduleResolutionNameAndModeGetter,
|
|
120720
|
+
resolve: (moduleName, resoluionMode) => resolveModuleNameUsingGlobalCache(
|
|
120721
|
+
resolutionHost,
|
|
120722
|
+
moduleResolutionCache,
|
|
120723
|
+
moduleName,
|
|
120724
|
+
containingFile,
|
|
120725
|
+
options,
|
|
120726
|
+
redirectedReference,
|
|
120727
|
+
resoluionMode
|
|
120728
|
+
)
|
|
120729
|
+
};
|
|
120730
|
+
}
|
|
120731
|
+
function resolveModuleNameUsingGlobalCache(resolutionHost, moduleResolutionCache, moduleName, containingFile, compilerOptions, redirectedReference, mode) {
|
|
120732
|
+
var _a;
|
|
120733
|
+
const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
|
|
120734
|
+
const primaryResult = resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
|
|
120735
|
+
if (!resolutionHost.getGlobalCache) {
|
|
120736
|
+
return primaryResult;
|
|
120737
|
+
}
|
|
120738
|
+
const globalCache = resolutionHost.getGlobalCache();
|
|
120739
|
+
if (globalCache !== void 0 && !isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && extensionIsTS(primaryResult.resolvedModule.extension))) {
|
|
120740
|
+
const { resolvedModule, failedLookupLocations, affectingLocations, resolutionDiagnostics } = loadModuleFromGlobalCache(
|
|
120741
|
+
Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName),
|
|
120742
|
+
resolutionHost.projectName,
|
|
120743
|
+
compilerOptions,
|
|
120744
|
+
host,
|
|
120745
|
+
globalCache,
|
|
120746
|
+
moduleResolutionCache
|
|
120747
|
+
);
|
|
120748
|
+
if (resolvedModule) {
|
|
120749
|
+
primaryResult.resolvedModule = resolvedModule;
|
|
120750
|
+
primaryResult.failedLookupLocations = updateResolutionField(primaryResult.failedLookupLocations, failedLookupLocations);
|
|
120751
|
+
primaryResult.affectingLocations = updateResolutionField(primaryResult.affectingLocations, affectingLocations);
|
|
120752
|
+
primaryResult.resolutionDiagnostics = updateResolutionField(primaryResult.resolutionDiagnostics, resolutionDiagnostics);
|
|
120753
|
+
return primaryResult;
|
|
120754
|
+
}
|
|
120755
|
+
}
|
|
120756
|
+
return primaryResult;
|
|
120757
|
+
}
|
|
120670
120758
|
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
|
|
120671
120759
|
let filesWithChangedSetOfUnresolvedImports;
|
|
120672
120760
|
let filesWithInvalidatedResolutions;
|
|
@@ -120713,6 +120801,16 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
120713
120801
|
const rootPathComponents = getPathComponents(rootPath);
|
|
120714
120802
|
const typeRootsWatches = /* @__PURE__ */ new Map();
|
|
120715
120803
|
return {
|
|
120804
|
+
rootDirForResolution,
|
|
120805
|
+
resolvedModuleNames,
|
|
120806
|
+
resolvedTypeReferenceDirectives,
|
|
120807
|
+
resolvedLibraries,
|
|
120808
|
+
resolvedFileToResolution,
|
|
120809
|
+
resolutionsWithFailedLookups,
|
|
120810
|
+
resolutionsWithOnlyAffectingLocations,
|
|
120811
|
+
directoryWatchesOfFailedLookups,
|
|
120812
|
+
fileWatchesOfAffectingLocations,
|
|
120813
|
+
watchFailedLookupLocationsOfExternalModuleResolutions,
|
|
120716
120814
|
getModuleResolutionCache: () => moduleResolutionCache,
|
|
120717
120815
|
startRecordingFilesWithChangedResolutions,
|
|
120718
120816
|
finishRecordingFilesWithChangedResolutions,
|
|
@@ -120815,7 +120913,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
120815
120913
|
if (!((_a = newProgram == null ? void 0 : newProgram.resolvedLibReferences) == null ? void 0 : _a.has(libFileName))) {
|
|
120816
120914
|
stopWatchFailedLookupLocationOfResolution(
|
|
120817
120915
|
resolution,
|
|
120818
|
-
resolutionHost.toPath(getInferredLibraryNameResolveFrom(
|
|
120916
|
+
resolutionHost.toPath(getInferredLibraryNameResolveFrom(resolutionHost.getCompilationSettings(), getCurrentDirectory(), libFileName)),
|
|
120819
120917
|
getResolvedModule
|
|
120820
120918
|
);
|
|
120821
120919
|
resolvedLibraries.delete(libFileName);
|
|
@@ -120857,58 +120955,22 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
120857
120955
|
}
|
|
120858
120956
|
});
|
|
120859
120957
|
}
|
|
120860
|
-
directoryWatchesOfFailedLookups.forEach(
|
|
120861
|
-
|
|
120862
|
-
directoryWatchesOfFailedLookups.delete(path);
|
|
120863
|
-
watcher.watcher.close();
|
|
120864
|
-
}
|
|
120865
|
-
});
|
|
120866
|
-
fileWatchesOfAffectingLocations.forEach((watcher, path) => {
|
|
120867
|
-
if (watcher.files === 0 && watcher.resolutions === 0) {
|
|
120868
|
-
fileWatchesOfAffectingLocations.delete(path);
|
|
120869
|
-
watcher.watcher.close();
|
|
120870
|
-
}
|
|
120871
|
-
});
|
|
120958
|
+
directoryWatchesOfFailedLookups.forEach(closeDirectoryWatchesOfFailedLookup);
|
|
120959
|
+
fileWatchesOfAffectingLocations.forEach(closeFileWatcherOfAffectingLocation);
|
|
120872
120960
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
120873
120961
|
}
|
|
120874
|
-
function
|
|
120875
|
-
|
|
120876
|
-
|
|
120877
|
-
|
|
120878
|
-
if (!resolutionHost.getGlobalCache) {
|
|
120879
|
-
return primaryResult;
|
|
120880
|
-
}
|
|
120881
|
-
const globalCache = resolutionHost.getGlobalCache();
|
|
120882
|
-
if (globalCache !== void 0 && !isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && extensionIsTS(primaryResult.resolvedModule.extension))) {
|
|
120883
|
-
const { resolvedModule, failedLookupLocations, affectingLocations, resolutionDiagnostics } = loadModuleFromGlobalCache(
|
|
120884
|
-
Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName),
|
|
120885
|
-
resolutionHost.projectName,
|
|
120886
|
-
compilerOptions,
|
|
120887
|
-
host,
|
|
120888
|
-
globalCache,
|
|
120889
|
-
moduleResolutionCache
|
|
120890
|
-
);
|
|
120891
|
-
if (resolvedModule) {
|
|
120892
|
-
primaryResult.resolvedModule = resolvedModule;
|
|
120893
|
-
primaryResult.failedLookupLocations = updateResolutionField(primaryResult.failedLookupLocations, failedLookupLocations);
|
|
120894
|
-
primaryResult.affectingLocations = updateResolutionField(primaryResult.affectingLocations, affectingLocations);
|
|
120895
|
-
primaryResult.resolutionDiagnostics = updateResolutionField(primaryResult.resolutionDiagnostics, resolutionDiagnostics);
|
|
120896
|
-
return primaryResult;
|
|
120897
|
-
}
|
|
120962
|
+
function closeDirectoryWatchesOfFailedLookup(watcher, path) {
|
|
120963
|
+
if (watcher.refCount === 0) {
|
|
120964
|
+
directoryWatchesOfFailedLookups.delete(path);
|
|
120965
|
+
watcher.watcher.close();
|
|
120898
120966
|
}
|
|
120899
|
-
return primaryResult;
|
|
120900
120967
|
}
|
|
120901
|
-
function
|
|
120902
|
-
|
|
120903
|
-
|
|
120904
|
-
|
|
120905
|
-
|
|
120906
|
-
|
|
120907
|
-
options,
|
|
120908
|
-
redirectedReference,
|
|
120909
|
-
resoluionMode
|
|
120910
|
-
)
|
|
120911
|
-
};
|
|
120968
|
+
function closeFileWatcherOfAffectingLocation(watcher, path) {
|
|
120969
|
+
var _a;
|
|
120970
|
+
if (watcher.files === 0 && watcher.resolutions === 0 && !((_a = watcher.symlinks) == null ? void 0 : _a.size)) {
|
|
120971
|
+
fileWatchesOfAffectingLocations.delete(path);
|
|
120972
|
+
watcher.watcher.close();
|
|
120973
|
+
}
|
|
120912
120974
|
}
|
|
120913
120975
|
function resolveNamesWithLocalCache({
|
|
120914
120976
|
entries,
|
|
@@ -120945,9 +121007,11 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
120945
121007
|
resolutionHost.onDiscoveredSymlink();
|
|
120946
121008
|
}
|
|
120947
121009
|
resolutionsInFile.set(name, mode, resolution);
|
|
120948
|
-
|
|
120949
|
-
|
|
120950
|
-
|
|
121010
|
+
if (resolution !== existingResolution) {
|
|
121011
|
+
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution);
|
|
121012
|
+
if (existingResolution) {
|
|
121013
|
+
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName);
|
|
121014
|
+
}
|
|
120951
121015
|
}
|
|
120952
121016
|
if (logChanges && filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) {
|
|
120953
121017
|
filesWithChangedSetOfUnresolvedImports.push(path);
|
|
@@ -121036,10 +121100,12 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121036
121100
|
options,
|
|
121037
121101
|
reusedNames,
|
|
121038
121102
|
perFileCache: resolvedModuleNames,
|
|
121039
|
-
loader:
|
|
121103
|
+
loader: createModuleResolutionLoaderUsingGlobalCache(
|
|
121040
121104
|
containingFile,
|
|
121041
121105
|
redirectedReference,
|
|
121042
|
-
options
|
|
121106
|
+
options,
|
|
121107
|
+
resolutionHost,
|
|
121108
|
+
moduleResolutionCache
|
|
121043
121109
|
),
|
|
121044
121110
|
getResolutionWithResolvedFileName: getResolvedModule,
|
|
121045
121111
|
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|
|
@@ -121093,7 +121159,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121093
121159
|
);
|
|
121094
121160
|
if (resolution && !resolution.isInvalidated)
|
|
121095
121161
|
return resolution;
|
|
121096
|
-
return
|
|
121162
|
+
return resolveModuleNameUsingGlobalCache(resolutionHost, moduleResolutionCache, moduleName, containingFile, resolutionHost.getCompilationSettings());
|
|
121097
121163
|
}
|
|
121098
121164
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
121099
121165
|
return endsWith(dirPath, "/node_modules/@types");
|
|
@@ -121193,52 +121259,63 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121193
121259
|
return;
|
|
121194
121260
|
}
|
|
121195
121261
|
let locationToWatch = affectingLocation;
|
|
121262
|
+
let isSymlink = false;
|
|
121263
|
+
let symlinkWatcher;
|
|
121196
121264
|
if (resolutionHost.realpath) {
|
|
121197
121265
|
locationToWatch = resolutionHost.realpath(affectingLocation);
|
|
121198
121266
|
if (affectingLocation !== locationToWatch) {
|
|
121199
|
-
|
|
121200
|
-
|
|
121201
|
-
|
|
121202
|
-
|
|
121203
|
-
|
|
121204
|
-
|
|
121205
|
-
|
|
121206
|
-
|
|
121207
|
-
|
|
121208
|
-
|
|
121209
|
-
|
|
121210
|
-
|
|
121211
|
-
|
|
121212
|
-
|
|
121213
|
-
|
|
121214
|
-
|
|
121215
|
-
|
|
121216
|
-
|
|
121217
|
-
|
|
121218
|
-
|
|
121219
|
-
|
|
121220
|
-
|
|
121221
|
-
|
|
121222
|
-
|
|
121223
|
-
|
|
121224
|
-
|
|
121225
|
-
|
|
121226
|
-
|
|
121227
|
-
|
|
121228
|
-
|
|
121229
|
-
|
|
121230
|
-
|
|
121231
|
-
|
|
121232
|
-
|
|
121233
|
-
|
|
121234
|
-
|
|
121235
|
-
|
|
121236
|
-
|
|
121237
|
-
if (affectingLocation !== locationToWatch) {
|
|
121267
|
+
isSymlink = true;
|
|
121268
|
+
symlinkWatcher = fileWatchesOfAffectingLocations.get(locationToWatch);
|
|
121269
|
+
}
|
|
121270
|
+
}
|
|
121271
|
+
const resolutions = forResolution ? 1 : 0;
|
|
121272
|
+
const files = forResolution ? 0 : 1;
|
|
121273
|
+
if (!isSymlink || !symlinkWatcher) {
|
|
121274
|
+
const watcher = {
|
|
121275
|
+
watcher: canWatchAffectingLocation(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
|
|
121276
|
+
cachedDirectoryStructureHost == null ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
|
|
121277
|
+
invalidateAffectingFileWatcher(locationToWatch, moduleResolutionCache.getPackageJsonInfoCache().getInternalMap());
|
|
121278
|
+
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
121279
|
+
}) : noopFileWatcher,
|
|
121280
|
+
resolutions: isSymlink ? 0 : resolutions,
|
|
121281
|
+
files: isSymlink ? 0 : files,
|
|
121282
|
+
symlinks: void 0
|
|
121283
|
+
};
|
|
121284
|
+
fileWatchesOfAffectingLocations.set(locationToWatch, watcher);
|
|
121285
|
+
if (isSymlink)
|
|
121286
|
+
symlinkWatcher = watcher;
|
|
121287
|
+
}
|
|
121288
|
+
if (isSymlink) {
|
|
121289
|
+
Debug.assert(!!symlinkWatcher);
|
|
121290
|
+
const watcher = {
|
|
121291
|
+
watcher: {
|
|
121292
|
+
close: () => {
|
|
121293
|
+
var _a;
|
|
121294
|
+
const symlinkWatcher2 = fileWatchesOfAffectingLocations.get(locationToWatch);
|
|
121295
|
+
if (((_a = symlinkWatcher2 == null ? void 0 : symlinkWatcher2.symlinks) == null ? void 0 : _a.delete(affectingLocation)) && !symlinkWatcher2.symlinks.size && !symlinkWatcher2.resolutions && !symlinkWatcher2.files) {
|
|
121296
|
+
fileWatchesOfAffectingLocations.delete(locationToWatch);
|
|
121297
|
+
symlinkWatcher2.watcher.close();
|
|
121298
|
+
}
|
|
121299
|
+
}
|
|
121300
|
+
},
|
|
121301
|
+
resolutions,
|
|
121302
|
+
files,
|
|
121303
|
+
symlinks: void 0
|
|
121304
|
+
};
|
|
121238
121305
|
fileWatchesOfAffectingLocations.set(affectingLocation, watcher);
|
|
121239
|
-
|
|
121306
|
+
(symlinkWatcher.symlinks ?? (symlinkWatcher.symlinks = /* @__PURE__ */ new Set())).add(affectingLocation);
|
|
121240
121307
|
}
|
|
121241
121308
|
}
|
|
121309
|
+
function invalidateAffectingFileWatcher(path, packageJsonMap) {
|
|
121310
|
+
var _a;
|
|
121311
|
+
const watcher = fileWatchesOfAffectingLocations.get(path);
|
|
121312
|
+
if (watcher == null ? void 0 : watcher.resolutions)
|
|
121313
|
+
(affectingPathChecks ?? (affectingPathChecks = /* @__PURE__ */ new Set())).add(path);
|
|
121314
|
+
if (watcher == null ? void 0 : watcher.files)
|
|
121315
|
+
(affectingPathChecksForFile ?? (affectingPathChecksForFile = /* @__PURE__ */ new Set())).add(path);
|
|
121316
|
+
(_a = watcher == null ? void 0 : watcher.symlinks) == null ? void 0 : _a.forEach((path2) => invalidateAffectingFileWatcher(path2, packageJsonMap));
|
|
121317
|
+
packageJsonMap == null ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path));
|
|
121318
|
+
}
|
|
121242
121319
|
function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
|
|
121243
121320
|
const program = resolutionHost.getCurrentProgram();
|
|
121244
121321
|
if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
|
|
@@ -121260,7 +121337,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121260
121337
|
directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive });
|
|
121261
121338
|
}
|
|
121262
121339
|
}
|
|
121263
|
-
function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot) {
|
|
121340
|
+
function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot, syncDirWatcherRemove) {
|
|
121264
121341
|
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
121265
121342
|
const toWatch = getDirectoryToWatchFailedLookupLocation(
|
|
121266
121343
|
failedLookupLocation,
|
|
@@ -121275,12 +121352,12 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121275
121352
|
if (dirPath === rootPath) {
|
|
121276
121353
|
removeAtRoot = true;
|
|
121277
121354
|
} else {
|
|
121278
|
-
removeDirectoryWatcher(dirPath);
|
|
121355
|
+
removeDirectoryWatcher(dirPath, syncDirWatcherRemove);
|
|
121279
121356
|
}
|
|
121280
121357
|
}
|
|
121281
121358
|
return removeAtRoot;
|
|
121282
121359
|
}
|
|
121283
|
-
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
|
|
121360
|
+
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName, syncDirWatcherRemove) {
|
|
121284
121361
|
Debug.checkDefined(resolution.files).delete(filePath);
|
|
121285
121362
|
resolution.refCount--;
|
|
121286
121363
|
if (resolution.refCount) {
|
|
@@ -121298,13 +121375,13 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121298
121375
|
let removeAtRoot = false;
|
|
121299
121376
|
if (failedLookupLocations) {
|
|
121300
121377
|
for (const failedLookupLocation of failedLookupLocations) {
|
|
121301
|
-
removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot);
|
|
121378
|
+
removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot, syncDirWatcherRemove);
|
|
121302
121379
|
}
|
|
121303
121380
|
}
|
|
121304
121381
|
if (node10Result)
|
|
121305
|
-
removeAtRoot = stopWatchFailedLookupLocation(node10Result, removeAtRoot);
|
|
121382
|
+
removeAtRoot = stopWatchFailedLookupLocation(node10Result, removeAtRoot, syncDirWatcherRemove);
|
|
121306
121383
|
if (removeAtRoot)
|
|
121307
|
-
removeDirectoryWatcher(rootPath);
|
|
121384
|
+
removeDirectoryWatcher(rootPath, syncDirWatcherRemove);
|
|
121308
121385
|
} else if (affectingLocations == null ? void 0 : affectingLocations.length) {
|
|
121309
121386
|
resolutionsWithOnlyAffectingLocations.delete(resolution);
|
|
121310
121387
|
}
|
|
@@ -121312,12 +121389,16 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121312
121389
|
for (const affectingLocation of affectingLocations) {
|
|
121313
121390
|
const watcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
121314
121391
|
watcher.resolutions--;
|
|
121392
|
+
if (syncDirWatcherRemove)
|
|
121393
|
+
closeFileWatcherOfAffectingLocation(watcher, affectingLocation);
|
|
121315
121394
|
}
|
|
121316
121395
|
}
|
|
121317
121396
|
}
|
|
121318
|
-
function removeDirectoryWatcher(dirPath) {
|
|
121397
|
+
function removeDirectoryWatcher(dirPath, syncDirWatcherRemove) {
|
|
121319
121398
|
const dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
121320
121399
|
dirWatcher.refCount--;
|
|
121400
|
+
if (syncDirWatcherRemove)
|
|
121401
|
+
closeDirectoryWatchesOfFailedLookup(dirWatcher, dirPath);
|
|
121321
121402
|
}
|
|
121322
121403
|
function createDirectoryWatcher(directory, dirPath, nonRecursive) {
|
|
121323
121404
|
return resolutionHost.watchDirectoryOfFailedLookupLocation(directory, (fileOrDirectory) => {
|
|
@@ -121328,10 +121409,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121328
121409
|
scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
|
|
121329
121410
|
}, nonRecursive ? 0 /* None */ : 1 /* Recursive */);
|
|
121330
121411
|
}
|
|
121331
|
-
function removeResolutionsOfFileFromCache(cache, filePath, getResolutionWithResolvedFileName) {
|
|
121412
|
+
function removeResolutionsOfFileFromCache(cache, filePath, getResolutionWithResolvedFileName, syncDirWatcherRemove) {
|
|
121332
121413
|
const resolutions = cache.get(filePath);
|
|
121333
121414
|
if (resolutions) {
|
|
121334
|
-
resolutions.forEach(
|
|
121415
|
+
resolutions.forEach(
|
|
121416
|
+
(resolution) => stopWatchFailedLookupLocationOfResolution(
|
|
121417
|
+
resolution,
|
|
121418
|
+
filePath,
|
|
121419
|
+
getResolutionWithResolvedFileName,
|
|
121420
|
+
syncDirWatcherRemove
|
|
121421
|
+
)
|
|
121422
|
+
);
|
|
121335
121423
|
cache.delete(filePath);
|
|
121336
121424
|
}
|
|
121337
121425
|
}
|
|
@@ -121346,9 +121434,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121346
121434
|
return;
|
|
121347
121435
|
resolvedProjectReference.commandLine.fileNames.forEach((f) => removeResolutionsOfFile(resolutionHost.toPath(f)));
|
|
121348
121436
|
}
|
|
121349
|
-
function removeResolutionsOfFile(filePath) {
|
|
121350
|
-
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule);
|
|
121351
|
-
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective);
|
|
121437
|
+
function removeResolutionsOfFile(filePath, syncDirWatcherRemove) {
|
|
121438
|
+
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule, syncDirWatcherRemove);
|
|
121439
|
+
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective, syncDirWatcherRemove);
|
|
121352
121440
|
}
|
|
121353
121441
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
121354
121442
|
if (!resolutions)
|
|
@@ -122310,7 +122398,7 @@ function createWatchProgram(host) {
|
|
|
122310
122398
|
watchConfigFileWildCardDirectories();
|
|
122311
122399
|
if (configFileName)
|
|
122312
122400
|
updateExtendedConfigFilesWatches(toPath3(configFileName), compilerOptions, watchOptions, WatchType.ExtendedConfigFile);
|
|
122313
|
-
return configFileName ? { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, close } : { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, updateRootFileNames, close };
|
|
122401
|
+
return configFileName ? { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, close, getResolutionCache } : { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, updateRootFileNames, close, getResolutionCache };
|
|
122314
122402
|
function close() {
|
|
122315
122403
|
clearInvalidateResolutionsOfFailedLookupLocations();
|
|
122316
122404
|
resolutionCache.clear();
|
|
@@ -122350,6 +122438,9 @@ function createWatchProgram(host) {
|
|
|
122350
122438
|
parsedConfigs = void 0;
|
|
122351
122439
|
}
|
|
122352
122440
|
}
|
|
122441
|
+
function getResolutionCache() {
|
|
122442
|
+
return resolutionCache;
|
|
122443
|
+
}
|
|
122353
122444
|
function getCurrentBuilderProgram() {
|
|
122354
122445
|
return builderProgram;
|
|
122355
122446
|
}
|