typescript 5.3.0-dev.20230922 → 5.3.0-dev.20230924
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 +57 -3
- package/lib/typescript.js +440 -231
- package/lib/typingsInstaller.js +10 -13
- package/package.json +2 -2
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.3";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230924`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -7951,6 +7951,7 @@ ${lanes.join("\n")}
|
|
|
7951
7951
|
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."),
|
|
7952
7952
|
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."),
|
|
7953
7953
|
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."),
|
|
7954
|
+
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."),
|
|
7954
7955
|
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}'."),
|
|
7955
7956
|
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}'."),
|
|
7956
7957
|
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}'."),
|
|
@@ -12264,6 +12265,9 @@ ${lanes.join("\n")}
|
|
|
12264
12265
|
function isAutoAccessorPropertyDeclaration(node) {
|
|
12265
12266
|
return isPropertyDeclaration(node) && hasAccessorModifier(node);
|
|
12266
12267
|
}
|
|
12268
|
+
function isClassFieldAndNotAutoAccessor(node) {
|
|
12269
|
+
return node.parent && isClassLike(node.parent) && isPropertyDeclaration(node) && !hasAccessorModifier(node);
|
|
12270
|
+
}
|
|
12267
12271
|
function isMethodOrAccessor(node) {
|
|
12268
12272
|
switch (node.kind) {
|
|
12269
12273
|
case 174 /* MethodDeclaration */:
|
|
@@ -12970,8 +12974,8 @@ ${lanes.join("\n")}
|
|
|
12970
12974
|
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;
|
|
12971
12975
|
}
|
|
12972
12976
|
function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageName) {
|
|
12973
|
-
var _a
|
|
12974
|
-
const node10Result = (
|
|
12977
|
+
var _a;
|
|
12978
|
+
const node10Result = (_a = host.getResolvedModule(sourceFile, moduleReference, mode)) == null ? void 0 : _a.node10Result;
|
|
12975
12979
|
const result = node10Result ? chainDiagnosticMessages(
|
|
12976
12980
|
/*details*/
|
|
12977
12981
|
void 0,
|
|
@@ -13013,14 +13017,14 @@ ${lanes.join("\n")}
|
|
|
13013
13017
|
function typeDirectiveIsEqualTo(oldResolution, newResolution) {
|
|
13014
13018
|
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;
|
|
13015
13019
|
}
|
|
13016
|
-
function hasChangesInResolutions(names, newSourceFile, newResolutions,
|
|
13020
|
+
function hasChangesInResolutions(names, newSourceFile, newResolutions, getOldResolution, comparer, nameAndModeGetter) {
|
|
13017
13021
|
Debug.assert(names.length === newResolutions.length);
|
|
13018
13022
|
for (let i = 0; i < names.length; i++) {
|
|
13019
13023
|
const newResolution = newResolutions[i];
|
|
13020
13024
|
const entry = names[i];
|
|
13021
13025
|
const name = nameAndModeGetter.getName(entry);
|
|
13022
13026
|
const mode = nameAndModeGetter.getMode(entry, newSourceFile);
|
|
13023
|
-
const oldResolution =
|
|
13027
|
+
const oldResolution = getOldResolution(name, mode);
|
|
13024
13028
|
const changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution;
|
|
13025
13029
|
if (changed) {
|
|
13026
13030
|
return true;
|
|
@@ -17914,11 +17918,11 @@ ${lanes.join("\n")}
|
|
|
17914
17918
|
(symlinkedDirectories || (symlinkedDirectories = /* @__PURE__ */ new Map())).set(symlinkPath, real);
|
|
17915
17919
|
}
|
|
17916
17920
|
},
|
|
17917
|
-
setSymlinksFromResolutions(
|
|
17921
|
+
setSymlinksFromResolutions(forEachResolvedModule, forEachResolvedTypeReferenceDirective, typeReferenceDirectives) {
|
|
17918
17922
|
Debug.assert(!hasProcessedResolutions);
|
|
17919
17923
|
hasProcessedResolutions = true;
|
|
17920
|
-
|
|
17921
|
-
|
|
17924
|
+
forEachResolvedModule((resolution) => processResolution(this, resolution.resolvedModule));
|
|
17925
|
+
forEachResolvedTypeReferenceDirective((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
17922
17926
|
typeReferenceDirectives.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
17923
17927
|
},
|
|
17924
17928
|
hasProcessedResolutions: () => hasProcessedResolutions
|
|
@@ -48769,7 +48773,7 @@ ${lanes.join("\n")}
|
|
|
48769
48773
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
|
|
48770
48774
|
}
|
|
48771
48775
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
48772
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k
|
|
48776
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
48773
48777
|
if (startsWith(moduleReference, "@types/")) {
|
|
48774
48778
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
48775
48779
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -48787,7 +48791,7 @@ ${lanes.join("\n")}
|
|
|
48787
48791
|
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);
|
|
48788
48792
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
48789
48793
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
48790
|
-
const resolvedModule = (
|
|
48794
|
+
const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
|
|
48791
48795
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
48792
48796
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
48793
48797
|
if (sourceFile) {
|
|
@@ -48795,7 +48799,7 @@ ${lanes.join("\n")}
|
|
|
48795
48799
|
error2(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
48796
48800
|
}
|
|
48797
48801
|
if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
|
|
48798
|
-
const importOrExport = ((
|
|
48802
|
+
const importOrExport = ((_h = findAncestor(location, isImportDeclaration)) == null ? void 0 : _h.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
48799
48803
|
if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
|
|
48800
48804
|
error2(
|
|
48801
48805
|
errorNode,
|
|
@@ -48804,7 +48808,7 @@ ${lanes.join("\n")}
|
|
|
48804
48808
|
);
|
|
48805
48809
|
}
|
|
48806
48810
|
} else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
|
|
48807
|
-
const importOrExport = ((
|
|
48811
|
+
const importOrExport = ((_i = findAncestor(location, isImportDeclaration)) == null ? void 0 : _i.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
48808
48812
|
if (!((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
|
|
48809
48813
|
const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
|
|
48810
48814
|
error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
|
|
@@ -48825,7 +48829,7 @@ ${lanes.join("\n")}
|
|
|
48825
48829
|
if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
|
|
48826
48830
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
48827
48831
|
const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
48828
|
-
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (
|
|
48832
|
+
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_j = overrideClauseHost.assertions) == null ? void 0 : _j.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
48829
48833
|
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) {
|
|
48830
48834
|
if (findAncestor(location, isImportEqualsDeclaration)) {
|
|
48831
48835
|
error2(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);
|
|
@@ -48932,7 +48936,7 @@ ${lanes.join("\n")}
|
|
|
48932
48936
|
error2(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
48933
48937
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
48934
48938
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
48935
|
-
const suggestedExt = (
|
|
48939
|
+
const suggestedExt = (_k = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _k[1];
|
|
48936
48940
|
if (suggestedExt) {
|
|
48937
48941
|
error2(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
|
|
48938
48942
|
} else {
|
|
@@ -71606,6 +71610,7 @@ ${lanes.join("\n")}
|
|
|
71606
71610
|
return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode);
|
|
71607
71611
|
}
|
|
71608
71612
|
function checkPropertyAccessibilityAtLocation(location, isSuper, writing, containingType, prop, errorNode) {
|
|
71613
|
+
var _a;
|
|
71609
71614
|
const flags = getDeclarationModifierFlagsFromSymbol(prop, writing);
|
|
71610
71615
|
if (isSuper) {
|
|
71611
71616
|
if (languageVersion < 2 /* ES2015 */) {
|
|
@@ -71622,6 +71627,12 @@ ${lanes.join("\n")}
|
|
|
71622
71627
|
}
|
|
71623
71628
|
return false;
|
|
71624
71629
|
}
|
|
71630
|
+
if (!(flags & 32 /* Static */) && ((_a = prop.declarations) == null ? void 0 : _a.some(isClassFieldAndNotAutoAccessor))) {
|
|
71631
|
+
if (errorNode) {
|
|
71632
|
+
error2(errorNode, Diagnostics.Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super, symbolToString(prop));
|
|
71633
|
+
}
|
|
71634
|
+
return false;
|
|
71635
|
+
}
|
|
71625
71636
|
}
|
|
71626
71637
|
if (flags & 256 /* Abstract */ && symbolHasNonMethodDeclaration(prop) && (isThisProperty(location) || isThisInitializedObjectBindingExpression(location) || isObjectBindingPattern(location.parent) && isThisInitializedDeclaration(location.parent.parent))) {
|
|
71627
71638
|
const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
|
|
@@ -72027,11 +72038,17 @@ ${lanes.join("\n")}
|
|
|
72027
72038
|
return getFlowTypeOfAccessExpression(node, prop, propType, right, checkMode);
|
|
72028
72039
|
}
|
|
72029
72040
|
function isUncheckedJSSuggestion(node, suggestion, excludeClasses) {
|
|
72041
|
+
var _a;
|
|
72030
72042
|
const file = getSourceFileOfNode(node);
|
|
72031
72043
|
if (file) {
|
|
72032
72044
|
if (compilerOptions.checkJs === void 0 && file.checkJsDirective === void 0 && (file.scriptKind === 1 /* JS */ || file.scriptKind === 2 /* JSX */)) {
|
|
72033
72045
|
const declarationFile = forEach(suggestion == null ? void 0 : suggestion.declarations, getSourceFileOfNode);
|
|
72034
|
-
|
|
72046
|
+
const suggestionHasNoExtendsOrDecorators = !(suggestion == null ? void 0 : suggestion.valueDeclaration) || !isClassLike(suggestion.valueDeclaration) || ((_a = suggestion.valueDeclaration.heritageClauses) == null ? void 0 : _a.length) || classOrConstructorParameterIsDecorated(
|
|
72047
|
+
/*useLegacyDecorators*/
|
|
72048
|
+
false,
|
|
72049
|
+
suggestion.valueDeclaration
|
|
72050
|
+
);
|
|
72051
|
+
return !(file !== declarationFile && !!declarationFile && isGlobalSourceFile(declarationFile)) && !(excludeClasses && suggestion && suggestion.flags & 32 /* Class */ && suggestionHasNoExtendsOrDecorators) && !(!!node && excludeClasses && isPropertyAccessExpression(node) && node.expression.kind === 110 /* ThisKeyword */ && suggestionHasNoExtendsOrDecorators);
|
|
72035
72052
|
}
|
|
72036
72053
|
}
|
|
72037
72054
|
return false;
|
|
@@ -112245,6 +112262,7 @@ ${lanes.join("\n")}
|
|
|
112245
112262
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
112246
112263
|
extendedDiagnostics: compilerOptions.extendedDiagnostics,
|
|
112247
112264
|
onlyPrintJsDocStyle: true,
|
|
112265
|
+
omitBraceSourceMapPositions: true,
|
|
112248
112266
|
writeBundleFileInfo: !!bundleBuildInfo,
|
|
112249
112267
|
recordInternalSection: !!bundleBuildInfo,
|
|
112250
112268
|
relativeToBuildInfo
|
|
@@ -112607,6 +112625,7 @@ ${lanes.join("\n")}
|
|
|
112607
112625
|
onAfterEmitToken
|
|
112608
112626
|
} = handlers;
|
|
112609
112627
|
var extendedDiagnostics = !!printerOptions.extendedDiagnostics;
|
|
112628
|
+
var omitBraceSourcePositions = !!printerOptions.omitBraceSourceMapPositions;
|
|
112610
112629
|
var newLine = getNewLineCharacter(printerOptions);
|
|
112611
112630
|
var moduleKind = getEmitModuleKind(printerOptions);
|
|
112612
112631
|
var bundledHelpers = /* @__PURE__ */ new Map();
|
|
@@ -114602,7 +114621,11 @@ ${lanes.join("\n")}
|
|
|
114602
114621
|
decreaseIndent();
|
|
114603
114622
|
}
|
|
114604
114623
|
}
|
|
114605
|
-
|
|
114624
|
+
if (!omitBraceSourcePositions && (token === 19 /* OpenBraceToken */ || token === 20 /* CloseBraceToken */)) {
|
|
114625
|
+
pos = writeToken(token, pos, writer2, contextNode);
|
|
114626
|
+
} else {
|
|
114627
|
+
pos = writeTokenText(token, writer2, pos);
|
|
114628
|
+
}
|
|
114606
114629
|
if (isSimilarNode && contextNode.end !== pos) {
|
|
114607
114630
|
const isJsxExprContext = contextNode.kind === 294 /* JsxExpression */;
|
|
114608
114631
|
emitTrailingCommentsOfPosition(
|
|
@@ -118413,14 +118436,14 @@ ${lanes.join("\n")}
|
|
|
118413
118436
|
return location.pos !== void 0;
|
|
118414
118437
|
}
|
|
118415
118438
|
function getReferencedFileLocation(program, ref) {
|
|
118416
|
-
var _a, _b, _c, _d
|
|
118439
|
+
var _a, _b, _c, _d;
|
|
118417
118440
|
const file = Debug.checkDefined(program.getSourceFileByPath(ref.file));
|
|
118418
118441
|
const { kind, index } = ref;
|
|
118419
118442
|
let pos, end, packageId, resolutionMode;
|
|
118420
118443
|
switch (kind) {
|
|
118421
118444
|
case 3 /* Import */:
|
|
118422
118445
|
const importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
118423
|
-
packageId = (
|
|
118446
|
+
packageId = (_b = (_a = program.getResolvedModule(file, importLiteral.text, getModeForResolutionAtIndex(file, index))) == null ? void 0 : _a.resolvedModule) == null ? void 0 : _b.packageId;
|
|
118424
118447
|
if (importLiteral.pos === -1)
|
|
118425
118448
|
return { file, packageId, text: importLiteral.text };
|
|
118426
118449
|
pos = skipTrivia(file.text, importLiteral.pos);
|
|
@@ -118431,7 +118454,7 @@ ${lanes.join("\n")}
|
|
|
118431
118454
|
break;
|
|
118432
118455
|
case 5 /* TypeReferenceDirective */:
|
|
118433
118456
|
({ pos, end, resolutionMode } = file.typeReferenceDirectives[index]);
|
|
118434
|
-
packageId = (
|
|
118457
|
+
packageId = (_d = (_c = program.getResolvedTypeReferenceDirective(file, toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), resolutionMode || file.impliedNodeFormat)) == null ? void 0 : _c.resolvedTypeReferenceDirective) == null ? void 0 : _d.packageId;
|
|
118435
118458
|
break;
|
|
118436
118459
|
case 7 /* LibReferenceDirective */:
|
|
118437
118460
|
({ pos, end } = file.libReferenceDirectives[index]);
|
|
@@ -118866,6 +118889,10 @@ ${lanes.join("\n")}
|
|
|
118866
118889
|
resolvedModules,
|
|
118867
118890
|
resolvedTypeReferenceDirectiveNames,
|
|
118868
118891
|
resolvedLibReferences,
|
|
118892
|
+
getResolvedModule,
|
|
118893
|
+
getResolvedTypeReferenceDirective,
|
|
118894
|
+
forEachResolvedModule,
|
|
118895
|
+
forEachResolvedTypeReferenceDirective,
|
|
118869
118896
|
getCurrentPackagesMap: () => packageMap,
|
|
118870
118897
|
typesPackageExists,
|
|
118871
118898
|
packageBundlesTypes,
|
|
@@ -118909,19 +118936,35 @@ ${lanes.join("\n")}
|
|
|
118909
118936
|
measure("Program", "beforeProgram", "afterProgram");
|
|
118910
118937
|
(_p = tracing) == null ? void 0 : _p.pop();
|
|
118911
118938
|
return program;
|
|
118939
|
+
function getResolvedModule(file, moduleName, mode) {
|
|
118940
|
+
var _a2;
|
|
118941
|
+
return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(file.path)) == null ? void 0 : _a2.get(moduleName, mode);
|
|
118942
|
+
}
|
|
118943
|
+
function getResolvedTypeReferenceDirective(file, typeDirectiveName, mode) {
|
|
118944
|
+
var _a2;
|
|
118945
|
+
return (_a2 = resolvedTypeReferenceDirectiveNames == null ? void 0 : resolvedTypeReferenceDirectiveNames.get(file.path)) == null ? void 0 : _a2.get(typeDirectiveName, mode);
|
|
118946
|
+
}
|
|
118947
|
+
function forEachResolvedModule(callback, file) {
|
|
118948
|
+
forEachResolution(resolvedModules, callback, file);
|
|
118949
|
+
}
|
|
118950
|
+
function forEachResolvedTypeReferenceDirective(callback, file) {
|
|
118951
|
+
forEachResolution(resolvedTypeReferenceDirectiveNames, callback, file);
|
|
118952
|
+
}
|
|
118953
|
+
function forEachResolution(resolutionCache, callback, file) {
|
|
118954
|
+
var _a2;
|
|
118955
|
+
if (file)
|
|
118956
|
+
(_a2 = resolutionCache == null ? void 0 : resolutionCache.get(file.path)) == null ? void 0 : _a2.forEach((resolution, name, mode) => callback(resolution, name, mode, file.path));
|
|
118957
|
+
else
|
|
118958
|
+
resolutionCache == null ? void 0 : resolutionCache.forEach((resolutions, filePath) => resolutions.forEach((resolution, name, mode) => callback(resolution, name, mode, filePath)));
|
|
118959
|
+
}
|
|
118912
118960
|
function getPackagesMap() {
|
|
118913
118961
|
if (packageMap)
|
|
118914
118962
|
return packageMap;
|
|
118915
118963
|
packageMap = /* @__PURE__ */ new Map();
|
|
118916
|
-
|
|
118917
|
-
(
|
|
118918
|
-
|
|
118919
|
-
|
|
118920
|
-
if (resolvedModule == null ? void 0 : resolvedModule.packageId)
|
|
118921
|
-
packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
|
|
118922
|
-
});
|
|
118923
|
-
}
|
|
118924
|
-
);
|
|
118964
|
+
forEachResolvedModule(({ resolvedModule }) => {
|
|
118965
|
+
if (resolvedModule == null ? void 0 : resolvedModule.packageId)
|
|
118966
|
+
packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
|
|
118967
|
+
});
|
|
118925
118968
|
return packageMap;
|
|
118926
118969
|
}
|
|
118927
118970
|
function typesPackageExists(packageName) {
|
|
@@ -119053,7 +119096,6 @@ ${lanes.join("\n")}
|
|
|
119053
119096
|
return classifiableNames;
|
|
119054
119097
|
}
|
|
119055
119098
|
function resolveModuleNamesReusingOldState(moduleNames, file) {
|
|
119056
|
-
var _a2, _b2;
|
|
119057
119099
|
if (structureIsReused === 0 /* Not */ && !file.ambientModuleNames.length) {
|
|
119058
119100
|
return resolveModuleNamesWorker(
|
|
119059
119101
|
moduleNames,
|
|
@@ -119071,7 +119113,7 @@ ${lanes.join("\n")}
|
|
|
119071
119113
|
const moduleName = moduleNames[i];
|
|
119072
119114
|
if (file === oldSourceFile && !hasInvalidatedResolutions(file.path)) {
|
|
119073
119115
|
const mode = getModeForUsageLocation(file, moduleName);
|
|
119074
|
-
const oldResolution =
|
|
119116
|
+
const oldResolution = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, mode);
|
|
119075
119117
|
if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
|
|
119076
119118
|
if (isTraceEnabled(options, host)) {
|
|
119077
119119
|
trace(
|
|
@@ -119118,8 +119160,8 @@ ${lanes.join("\n")}
|
|
|
119118
119160
|
Debug.assert(j === resolutions.length);
|
|
119119
119161
|
return result;
|
|
119120
119162
|
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
|
|
119121
|
-
var
|
|
119122
|
-
const resolutionToFile = (
|
|
119163
|
+
var _a2;
|
|
119164
|
+
const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation(file, moduleName))) == null ? void 0 : _a2.resolvedModule;
|
|
119123
119165
|
const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
119124
119166
|
if (resolutionToFile && resolvedFile) {
|
|
119125
119167
|
return false;
|
|
@@ -119135,7 +119177,7 @@ ${lanes.join("\n")}
|
|
|
119135
119177
|
}
|
|
119136
119178
|
}
|
|
119137
119179
|
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
119138
|
-
var _a2
|
|
119180
|
+
var _a2;
|
|
119139
119181
|
if (structureIsReused === 0 /* Not */) {
|
|
119140
119182
|
return resolveTypeReferenceDirectiveNamesWorker(
|
|
119141
119183
|
typeDirectiveNames,
|
|
@@ -119155,7 +119197,7 @@ ${lanes.join("\n")}
|
|
|
119155
119197
|
if (canReuseResolutions) {
|
|
119156
119198
|
const typeDirectiveName = getTypeReferenceResolutionName(entry);
|
|
119157
119199
|
const mode = getModeForFileReference(entry, containingSourceFile == null ? void 0 : containingSourceFile.impliedNodeFormat);
|
|
119158
|
-
const oldResolution =
|
|
119200
|
+
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);
|
|
119159
119201
|
if (oldResolution == null ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
|
|
119160
119202
|
if (isTraceEnabled(options, host)) {
|
|
119161
119203
|
trace(
|
|
@@ -119215,7 +119257,7 @@ ${lanes.join("\n")}
|
|
|
119215
119257
|
);
|
|
119216
119258
|
}
|
|
119217
119259
|
function tryReuseStructureFromOldProgram() {
|
|
119218
|
-
var _a2
|
|
119260
|
+
var _a2;
|
|
119219
119261
|
if (!oldProgram) {
|
|
119220
119262
|
return 0 /* Not */;
|
|
119221
119263
|
}
|
|
@@ -119335,20 +119377,29 @@ ${lanes.join("\n")}
|
|
|
119335
119377
|
const moduleNames = getModuleNames(newSourceFile);
|
|
119336
119378
|
const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
119337
119379
|
(resolvedModulesProcessing ?? (resolvedModulesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, resolutions);
|
|
119338
|
-
const
|
|
119339
|
-
|
|
119380
|
+
const resolutionsChanged = hasChangesInResolutions(
|
|
119381
|
+
moduleNames,
|
|
119382
|
+
newSourceFile,
|
|
119383
|
+
resolutions,
|
|
119384
|
+
(name, mode) => oldProgram.getResolvedModule(newSourceFile, name, mode),
|
|
119385
|
+
moduleResolutionIsEqualTo,
|
|
119386
|
+
moduleResolutionNameAndModeGetter
|
|
119387
|
+
);
|
|
119340
119388
|
if (resolutionsChanged)
|
|
119341
119389
|
structureIsReused = 1 /* SafeModules */;
|
|
119342
119390
|
const typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
|
|
119343
119391
|
const typeReferenceResolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typesReferenceDirectives, newSourceFile);
|
|
119344
119392
|
(resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, typeReferenceResolutions);
|
|
119345
|
-
const
|
|
119346
|
-
|
|
119347
|
-
|
|
119393
|
+
const typeReferenceResolutionsChanged = hasChangesInResolutions(
|
|
119394
|
+
typesReferenceDirectives,
|
|
119395
|
+
newSourceFile,
|
|
119396
|
+
typeReferenceResolutions,
|
|
119397
|
+
(name, mode) => oldProgram == null ? void 0 : oldProgram.getResolvedTypeReferenceDirective(newSourceFile, name, mode),
|
|
119398
|
+
typeDirectiveIsEqualTo,
|
|
119399
|
+
typeReferenceResolutionNameAndModeGetter
|
|
119400
|
+
);
|
|
119401
|
+
if (typeReferenceResolutionsChanged)
|
|
119348
119402
|
structureIsReused = 1 /* SafeModules */;
|
|
119349
|
-
} else if (oldTypeResolutions) {
|
|
119350
|
-
(resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, oldTypeResolutions);
|
|
119351
|
-
}
|
|
119352
119403
|
}
|
|
119353
119404
|
if (structureIsReused !== 2 /* Completely */) {
|
|
119354
119405
|
return structureIsReused;
|
|
@@ -121495,7 +121546,7 @@ ${lanes.join("\n")}
|
|
|
121495
121546
|
symlinks = createSymlinkCache(currentDirectory, getCanonicalFileName);
|
|
121496
121547
|
}
|
|
121497
121548
|
if (files && !symlinks.hasProcessedResolutions()) {
|
|
121498
|
-
symlinks.setSymlinksFromResolutions(
|
|
121549
|
+
symlinks.setSymlinksFromResolutions(forEachResolvedModule, forEachResolvedTypeReferenceDirective, automaticTypeDirectiveResolutions);
|
|
121499
121550
|
}
|
|
121500
121551
|
return symlinks;
|
|
121501
121552
|
}
|
|
@@ -122000,7 +122051,6 @@ ${lanes.join("\n")}
|
|
|
122000
122051
|
return toPath(program.getProjectReferenceRedirect(fileName) || fileName, sourceFileDirectory, getCanonicalFileName);
|
|
122001
122052
|
}
|
|
122002
122053
|
function getReferencedFiles(program, sourceFile, getCanonicalFileName) {
|
|
122003
|
-
var _a;
|
|
122004
122054
|
let referencedFiles;
|
|
122005
122055
|
if (sourceFile.imports && sourceFile.imports.length > 0) {
|
|
122006
122056
|
const checker = program.getTypeChecker();
|
|
@@ -122016,17 +122066,14 @@ ${lanes.join("\n")}
|
|
|
122016
122066
|
addReferencedFile(referencedPath);
|
|
122017
122067
|
}
|
|
122018
122068
|
}
|
|
122019
|
-
|
|
122020
|
-
|
|
122021
|
-
|
|
122022
|
-
|
|
122023
|
-
|
|
122024
|
-
|
|
122025
|
-
|
|
122026
|
-
|
|
122027
|
-
addReferencedFile(typeFilePath);
|
|
122028
|
-
});
|
|
122029
|
-
}
|
|
122069
|
+
program.forEachResolvedTypeReferenceDirective(({ resolvedTypeReferenceDirective }) => {
|
|
122070
|
+
if (!resolvedTypeReferenceDirective) {
|
|
122071
|
+
return;
|
|
122072
|
+
}
|
|
122073
|
+
const fileName = resolvedTypeReferenceDirective.resolvedFileName;
|
|
122074
|
+
const typeFilePath = getReferencedFileFromFileName(program, fileName, sourceFileDirectory, getCanonicalFileName);
|
|
122075
|
+
addReferencedFile(typeFilePath);
|
|
122076
|
+
}, sourceFile);
|
|
122030
122077
|
if (sourceFile.moduleAugmentations.length) {
|
|
122031
122078
|
const checker = program.getTypeChecker();
|
|
122032
122079
|
for (const moduleName of sourceFile.moduleAugmentations) {
|
|
@@ -123786,6 +123833,47 @@ ${lanes.join("\n")}
|
|
|
123786
123833
|
function getRootPathSplitLength(rootPath) {
|
|
123787
123834
|
return rootPath.split(directorySeparator).length - (hasTrailingDirectorySeparator(rootPath) ? 1 : 0);
|
|
123788
123835
|
}
|
|
123836
|
+
function createModuleResolutionLoaderUsingGlobalCache(containingFile, redirectedReference, options, resolutionHost, moduleResolutionCache) {
|
|
123837
|
+
return {
|
|
123838
|
+
nameAndMode: moduleResolutionNameAndModeGetter,
|
|
123839
|
+
resolve: (moduleName, resoluionMode) => resolveModuleNameUsingGlobalCache(
|
|
123840
|
+
resolutionHost,
|
|
123841
|
+
moduleResolutionCache,
|
|
123842
|
+
moduleName,
|
|
123843
|
+
containingFile,
|
|
123844
|
+
options,
|
|
123845
|
+
redirectedReference,
|
|
123846
|
+
resoluionMode
|
|
123847
|
+
)
|
|
123848
|
+
};
|
|
123849
|
+
}
|
|
123850
|
+
function resolveModuleNameUsingGlobalCache(resolutionHost, moduleResolutionCache, moduleName, containingFile, compilerOptions, redirectedReference, mode) {
|
|
123851
|
+
var _a;
|
|
123852
|
+
const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
|
|
123853
|
+
const primaryResult = resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
|
|
123854
|
+
if (!resolutionHost.getGlobalCache) {
|
|
123855
|
+
return primaryResult;
|
|
123856
|
+
}
|
|
123857
|
+
const globalCache = resolutionHost.getGlobalCache();
|
|
123858
|
+
if (globalCache !== void 0 && !isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && extensionIsTS(primaryResult.resolvedModule.extension))) {
|
|
123859
|
+
const { resolvedModule, failedLookupLocations, affectingLocations, resolutionDiagnostics } = loadModuleFromGlobalCache(
|
|
123860
|
+
Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName),
|
|
123861
|
+
resolutionHost.projectName,
|
|
123862
|
+
compilerOptions,
|
|
123863
|
+
host,
|
|
123864
|
+
globalCache,
|
|
123865
|
+
moduleResolutionCache
|
|
123866
|
+
);
|
|
123867
|
+
if (resolvedModule) {
|
|
123868
|
+
primaryResult.resolvedModule = resolvedModule;
|
|
123869
|
+
primaryResult.failedLookupLocations = updateResolutionField(primaryResult.failedLookupLocations, failedLookupLocations);
|
|
123870
|
+
primaryResult.affectingLocations = updateResolutionField(primaryResult.affectingLocations, affectingLocations);
|
|
123871
|
+
primaryResult.resolutionDiagnostics = updateResolutionField(primaryResult.resolutionDiagnostics, resolutionDiagnostics);
|
|
123872
|
+
return primaryResult;
|
|
123873
|
+
}
|
|
123874
|
+
}
|
|
123875
|
+
return primaryResult;
|
|
123876
|
+
}
|
|
123789
123877
|
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
|
|
123790
123878
|
let filesWithChangedSetOfUnresolvedImports;
|
|
123791
123879
|
let filesWithInvalidatedResolutions;
|
|
@@ -123832,6 +123920,16 @@ ${lanes.join("\n")}
|
|
|
123832
123920
|
const rootPathComponents = getPathComponents(rootPath);
|
|
123833
123921
|
const typeRootsWatches = /* @__PURE__ */ new Map();
|
|
123834
123922
|
return {
|
|
123923
|
+
rootDirForResolution,
|
|
123924
|
+
resolvedModuleNames,
|
|
123925
|
+
resolvedTypeReferenceDirectives,
|
|
123926
|
+
resolvedLibraries,
|
|
123927
|
+
resolvedFileToResolution,
|
|
123928
|
+
resolutionsWithFailedLookups,
|
|
123929
|
+
resolutionsWithOnlyAffectingLocations,
|
|
123930
|
+
directoryWatchesOfFailedLookups,
|
|
123931
|
+
fileWatchesOfAffectingLocations,
|
|
123932
|
+
watchFailedLookupLocationsOfExternalModuleResolutions,
|
|
123835
123933
|
getModuleResolutionCache: () => moduleResolutionCache,
|
|
123836
123934
|
startRecordingFilesWithChangedResolutions,
|
|
123837
123935
|
finishRecordingFilesWithChangedResolutions,
|
|
@@ -123934,7 +124032,7 @@ ${lanes.join("\n")}
|
|
|
123934
124032
|
if (!((_a = newProgram == null ? void 0 : newProgram.resolvedLibReferences) == null ? void 0 : _a.has(libFileName))) {
|
|
123935
124033
|
stopWatchFailedLookupLocationOfResolution(
|
|
123936
124034
|
resolution,
|
|
123937
|
-
resolutionHost.toPath(getInferredLibraryNameResolveFrom(
|
|
124035
|
+
resolutionHost.toPath(getInferredLibraryNameResolveFrom(resolutionHost.getCompilationSettings(), getCurrentDirectory(), libFileName)),
|
|
123938
124036
|
getResolvedModule
|
|
123939
124037
|
);
|
|
123940
124038
|
resolvedLibraries.delete(libFileName);
|
|
@@ -123976,58 +124074,22 @@ ${lanes.join("\n")}
|
|
|
123976
124074
|
}
|
|
123977
124075
|
});
|
|
123978
124076
|
}
|
|
123979
|
-
directoryWatchesOfFailedLookups.forEach(
|
|
123980
|
-
|
|
123981
|
-
directoryWatchesOfFailedLookups.delete(path);
|
|
123982
|
-
watcher.watcher.close();
|
|
123983
|
-
}
|
|
123984
|
-
});
|
|
123985
|
-
fileWatchesOfAffectingLocations.forEach((watcher, path) => {
|
|
123986
|
-
if (watcher.files === 0 && watcher.resolutions === 0) {
|
|
123987
|
-
fileWatchesOfAffectingLocations.delete(path);
|
|
123988
|
-
watcher.watcher.close();
|
|
123989
|
-
}
|
|
123990
|
-
});
|
|
124077
|
+
directoryWatchesOfFailedLookups.forEach(closeDirectoryWatchesOfFailedLookup);
|
|
124078
|
+
fileWatchesOfAffectingLocations.forEach(closeFileWatcherOfAffectingLocation);
|
|
123991
124079
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
123992
124080
|
}
|
|
123993
|
-
function
|
|
123994
|
-
|
|
123995
|
-
|
|
123996
|
-
|
|
123997
|
-
if (!resolutionHost.getGlobalCache) {
|
|
123998
|
-
return primaryResult;
|
|
123999
|
-
}
|
|
124000
|
-
const globalCache = resolutionHost.getGlobalCache();
|
|
124001
|
-
if (globalCache !== void 0 && !isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && extensionIsTS(primaryResult.resolvedModule.extension))) {
|
|
124002
|
-
const { resolvedModule, failedLookupLocations, affectingLocations, resolutionDiagnostics } = loadModuleFromGlobalCache(
|
|
124003
|
-
Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName),
|
|
124004
|
-
resolutionHost.projectName,
|
|
124005
|
-
compilerOptions,
|
|
124006
|
-
host,
|
|
124007
|
-
globalCache,
|
|
124008
|
-
moduleResolutionCache
|
|
124009
|
-
);
|
|
124010
|
-
if (resolvedModule) {
|
|
124011
|
-
primaryResult.resolvedModule = resolvedModule;
|
|
124012
|
-
primaryResult.failedLookupLocations = updateResolutionField(primaryResult.failedLookupLocations, failedLookupLocations);
|
|
124013
|
-
primaryResult.affectingLocations = updateResolutionField(primaryResult.affectingLocations, affectingLocations);
|
|
124014
|
-
primaryResult.resolutionDiagnostics = updateResolutionField(primaryResult.resolutionDiagnostics, resolutionDiagnostics);
|
|
124015
|
-
return primaryResult;
|
|
124016
|
-
}
|
|
124081
|
+
function closeDirectoryWatchesOfFailedLookup(watcher, path) {
|
|
124082
|
+
if (watcher.refCount === 0) {
|
|
124083
|
+
directoryWatchesOfFailedLookups.delete(path);
|
|
124084
|
+
watcher.watcher.close();
|
|
124017
124085
|
}
|
|
124018
|
-
return primaryResult;
|
|
124019
124086
|
}
|
|
124020
|
-
function
|
|
124021
|
-
|
|
124022
|
-
|
|
124023
|
-
|
|
124024
|
-
|
|
124025
|
-
|
|
124026
|
-
options,
|
|
124027
|
-
redirectedReference,
|
|
124028
|
-
resoluionMode
|
|
124029
|
-
)
|
|
124030
|
-
};
|
|
124087
|
+
function closeFileWatcherOfAffectingLocation(watcher, path) {
|
|
124088
|
+
var _a;
|
|
124089
|
+
if (watcher.files === 0 && watcher.resolutions === 0 && !((_a = watcher.symlinks) == null ? void 0 : _a.size)) {
|
|
124090
|
+
fileWatchesOfAffectingLocations.delete(path);
|
|
124091
|
+
watcher.watcher.close();
|
|
124092
|
+
}
|
|
124031
124093
|
}
|
|
124032
124094
|
function resolveNamesWithLocalCache({
|
|
124033
124095
|
entries,
|
|
@@ -124064,9 +124126,11 @@ ${lanes.join("\n")}
|
|
|
124064
124126
|
resolutionHost.onDiscoveredSymlink();
|
|
124065
124127
|
}
|
|
124066
124128
|
resolutionsInFile.set(name, mode, resolution);
|
|
124067
|
-
|
|
124068
|
-
|
|
124069
|
-
|
|
124129
|
+
if (resolution !== existingResolution) {
|
|
124130
|
+
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution);
|
|
124131
|
+
if (existingResolution) {
|
|
124132
|
+
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName);
|
|
124133
|
+
}
|
|
124070
124134
|
}
|
|
124071
124135
|
if (logChanges && filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) {
|
|
124072
124136
|
filesWithChangedSetOfUnresolvedImports.push(path);
|
|
@@ -124155,10 +124219,12 @@ ${lanes.join("\n")}
|
|
|
124155
124219
|
options,
|
|
124156
124220
|
reusedNames,
|
|
124157
124221
|
perFileCache: resolvedModuleNames,
|
|
124158
|
-
loader:
|
|
124222
|
+
loader: createModuleResolutionLoaderUsingGlobalCache(
|
|
124159
124223
|
containingFile,
|
|
124160
124224
|
redirectedReference,
|
|
124161
|
-
options
|
|
124225
|
+
options,
|
|
124226
|
+
resolutionHost,
|
|
124227
|
+
moduleResolutionCache
|
|
124162
124228
|
),
|
|
124163
124229
|
getResolutionWithResolvedFileName: getResolvedModule,
|
|
124164
124230
|
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|
|
@@ -124212,7 +124278,7 @@ ${lanes.join("\n")}
|
|
|
124212
124278
|
);
|
|
124213
124279
|
if (resolution && !resolution.isInvalidated)
|
|
124214
124280
|
return resolution;
|
|
124215
|
-
return
|
|
124281
|
+
return resolveModuleNameUsingGlobalCache(resolutionHost, moduleResolutionCache, moduleName, containingFile, resolutionHost.getCompilationSettings());
|
|
124216
124282
|
}
|
|
124217
124283
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
124218
124284
|
return endsWith(dirPath, "/node_modules/@types");
|
|
@@ -124312,52 +124378,63 @@ ${lanes.join("\n")}
|
|
|
124312
124378
|
return;
|
|
124313
124379
|
}
|
|
124314
124380
|
let locationToWatch = affectingLocation;
|
|
124381
|
+
let isSymlink = false;
|
|
124382
|
+
let symlinkWatcher;
|
|
124315
124383
|
if (resolutionHost.realpath) {
|
|
124316
124384
|
locationToWatch = resolutionHost.realpath(affectingLocation);
|
|
124317
124385
|
if (affectingLocation !== locationToWatch) {
|
|
124318
|
-
|
|
124319
|
-
|
|
124320
|
-
|
|
124321
|
-
|
|
124322
|
-
|
|
124323
|
-
|
|
124324
|
-
|
|
124325
|
-
|
|
124326
|
-
|
|
124327
|
-
|
|
124328
|
-
|
|
124329
|
-
|
|
124330
|
-
|
|
124331
|
-
|
|
124332
|
-
|
|
124333
|
-
|
|
124334
|
-
|
|
124335
|
-
|
|
124336
|
-
|
|
124337
|
-
|
|
124338
|
-
|
|
124339
|
-
|
|
124340
|
-
|
|
124341
|
-
|
|
124342
|
-
|
|
124343
|
-
|
|
124344
|
-
|
|
124345
|
-
|
|
124346
|
-
|
|
124347
|
-
|
|
124348
|
-
|
|
124349
|
-
|
|
124350
|
-
|
|
124351
|
-
|
|
124352
|
-
|
|
124353
|
-
|
|
124354
|
-
|
|
124355
|
-
|
|
124356
|
-
if (affectingLocation !== locationToWatch) {
|
|
124386
|
+
isSymlink = true;
|
|
124387
|
+
symlinkWatcher = fileWatchesOfAffectingLocations.get(locationToWatch);
|
|
124388
|
+
}
|
|
124389
|
+
}
|
|
124390
|
+
const resolutions = forResolution ? 1 : 0;
|
|
124391
|
+
const files = forResolution ? 0 : 1;
|
|
124392
|
+
if (!isSymlink || !symlinkWatcher) {
|
|
124393
|
+
const watcher = {
|
|
124394
|
+
watcher: canWatchAffectingLocation(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
|
|
124395
|
+
cachedDirectoryStructureHost == null ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
|
|
124396
|
+
invalidateAffectingFileWatcher(locationToWatch, moduleResolutionCache.getPackageJsonInfoCache().getInternalMap());
|
|
124397
|
+
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
124398
|
+
}) : noopFileWatcher,
|
|
124399
|
+
resolutions: isSymlink ? 0 : resolutions,
|
|
124400
|
+
files: isSymlink ? 0 : files,
|
|
124401
|
+
symlinks: void 0
|
|
124402
|
+
};
|
|
124403
|
+
fileWatchesOfAffectingLocations.set(locationToWatch, watcher);
|
|
124404
|
+
if (isSymlink)
|
|
124405
|
+
symlinkWatcher = watcher;
|
|
124406
|
+
}
|
|
124407
|
+
if (isSymlink) {
|
|
124408
|
+
Debug.assert(!!symlinkWatcher);
|
|
124409
|
+
const watcher = {
|
|
124410
|
+
watcher: {
|
|
124411
|
+
close: () => {
|
|
124412
|
+
var _a;
|
|
124413
|
+
const symlinkWatcher2 = fileWatchesOfAffectingLocations.get(locationToWatch);
|
|
124414
|
+
if (((_a = symlinkWatcher2 == null ? void 0 : symlinkWatcher2.symlinks) == null ? void 0 : _a.delete(affectingLocation)) && !symlinkWatcher2.symlinks.size && !symlinkWatcher2.resolutions && !symlinkWatcher2.files) {
|
|
124415
|
+
fileWatchesOfAffectingLocations.delete(locationToWatch);
|
|
124416
|
+
symlinkWatcher2.watcher.close();
|
|
124417
|
+
}
|
|
124418
|
+
}
|
|
124419
|
+
},
|
|
124420
|
+
resolutions,
|
|
124421
|
+
files,
|
|
124422
|
+
symlinks: void 0
|
|
124423
|
+
};
|
|
124357
124424
|
fileWatchesOfAffectingLocations.set(affectingLocation, watcher);
|
|
124358
|
-
|
|
124425
|
+
(symlinkWatcher.symlinks ?? (symlinkWatcher.symlinks = /* @__PURE__ */ new Set())).add(affectingLocation);
|
|
124359
124426
|
}
|
|
124360
124427
|
}
|
|
124428
|
+
function invalidateAffectingFileWatcher(path, packageJsonMap) {
|
|
124429
|
+
var _a;
|
|
124430
|
+
const watcher = fileWatchesOfAffectingLocations.get(path);
|
|
124431
|
+
if (watcher == null ? void 0 : watcher.resolutions)
|
|
124432
|
+
(affectingPathChecks ?? (affectingPathChecks = /* @__PURE__ */ new Set())).add(path);
|
|
124433
|
+
if (watcher == null ? void 0 : watcher.files)
|
|
124434
|
+
(affectingPathChecksForFile ?? (affectingPathChecksForFile = /* @__PURE__ */ new Set())).add(path);
|
|
124435
|
+
(_a = watcher == null ? void 0 : watcher.symlinks) == null ? void 0 : _a.forEach((path2) => invalidateAffectingFileWatcher(path2, packageJsonMap));
|
|
124436
|
+
packageJsonMap == null ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path));
|
|
124437
|
+
}
|
|
124361
124438
|
function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
|
|
124362
124439
|
const program = resolutionHost.getCurrentProgram();
|
|
124363
124440
|
if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
|
|
@@ -124379,7 +124456,7 @@ ${lanes.join("\n")}
|
|
|
124379
124456
|
directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive });
|
|
124380
124457
|
}
|
|
124381
124458
|
}
|
|
124382
|
-
function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot) {
|
|
124459
|
+
function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot, syncDirWatcherRemove) {
|
|
124383
124460
|
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
124384
124461
|
const toWatch = getDirectoryToWatchFailedLookupLocation(
|
|
124385
124462
|
failedLookupLocation,
|
|
@@ -124394,12 +124471,12 @@ ${lanes.join("\n")}
|
|
|
124394
124471
|
if (dirPath === rootPath) {
|
|
124395
124472
|
removeAtRoot = true;
|
|
124396
124473
|
} else {
|
|
124397
|
-
removeDirectoryWatcher(dirPath);
|
|
124474
|
+
removeDirectoryWatcher(dirPath, syncDirWatcherRemove);
|
|
124398
124475
|
}
|
|
124399
124476
|
}
|
|
124400
124477
|
return removeAtRoot;
|
|
124401
124478
|
}
|
|
124402
|
-
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
|
|
124479
|
+
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName, syncDirWatcherRemove) {
|
|
124403
124480
|
Debug.checkDefined(resolution.files).delete(filePath);
|
|
124404
124481
|
resolution.refCount--;
|
|
124405
124482
|
if (resolution.refCount) {
|
|
@@ -124417,13 +124494,13 @@ ${lanes.join("\n")}
|
|
|
124417
124494
|
let removeAtRoot = false;
|
|
124418
124495
|
if (failedLookupLocations) {
|
|
124419
124496
|
for (const failedLookupLocation of failedLookupLocations) {
|
|
124420
|
-
removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot);
|
|
124497
|
+
removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot, syncDirWatcherRemove);
|
|
124421
124498
|
}
|
|
124422
124499
|
}
|
|
124423
124500
|
if (node10Result)
|
|
124424
|
-
removeAtRoot = stopWatchFailedLookupLocation(node10Result, removeAtRoot);
|
|
124501
|
+
removeAtRoot = stopWatchFailedLookupLocation(node10Result, removeAtRoot, syncDirWatcherRemove);
|
|
124425
124502
|
if (removeAtRoot)
|
|
124426
|
-
removeDirectoryWatcher(rootPath);
|
|
124503
|
+
removeDirectoryWatcher(rootPath, syncDirWatcherRemove);
|
|
124427
124504
|
} else if (affectingLocations == null ? void 0 : affectingLocations.length) {
|
|
124428
124505
|
resolutionsWithOnlyAffectingLocations.delete(resolution);
|
|
124429
124506
|
}
|
|
@@ -124431,12 +124508,16 @@ ${lanes.join("\n")}
|
|
|
124431
124508
|
for (const affectingLocation of affectingLocations) {
|
|
124432
124509
|
const watcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
124433
124510
|
watcher.resolutions--;
|
|
124511
|
+
if (syncDirWatcherRemove)
|
|
124512
|
+
closeFileWatcherOfAffectingLocation(watcher, affectingLocation);
|
|
124434
124513
|
}
|
|
124435
124514
|
}
|
|
124436
124515
|
}
|
|
124437
|
-
function removeDirectoryWatcher(dirPath) {
|
|
124516
|
+
function removeDirectoryWatcher(dirPath, syncDirWatcherRemove) {
|
|
124438
124517
|
const dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
124439
124518
|
dirWatcher.refCount--;
|
|
124519
|
+
if (syncDirWatcherRemove)
|
|
124520
|
+
closeDirectoryWatchesOfFailedLookup(dirWatcher, dirPath);
|
|
124440
124521
|
}
|
|
124441
124522
|
function createDirectoryWatcher(directory, dirPath, nonRecursive) {
|
|
124442
124523
|
return resolutionHost.watchDirectoryOfFailedLookupLocation(directory, (fileOrDirectory) => {
|
|
@@ -124447,10 +124528,17 @@ ${lanes.join("\n")}
|
|
|
124447
124528
|
scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
|
|
124448
124529
|
}, nonRecursive ? 0 /* None */ : 1 /* Recursive */);
|
|
124449
124530
|
}
|
|
124450
|
-
function removeResolutionsOfFileFromCache(cache, filePath, getResolutionWithResolvedFileName) {
|
|
124531
|
+
function removeResolutionsOfFileFromCache(cache, filePath, getResolutionWithResolvedFileName, syncDirWatcherRemove) {
|
|
124451
124532
|
const resolutions = cache.get(filePath);
|
|
124452
124533
|
if (resolutions) {
|
|
124453
|
-
resolutions.forEach(
|
|
124534
|
+
resolutions.forEach(
|
|
124535
|
+
(resolution) => stopWatchFailedLookupLocationOfResolution(
|
|
124536
|
+
resolution,
|
|
124537
|
+
filePath,
|
|
124538
|
+
getResolutionWithResolvedFileName,
|
|
124539
|
+
syncDirWatcherRemove
|
|
124540
|
+
)
|
|
124541
|
+
);
|
|
124454
124542
|
cache.delete(filePath);
|
|
124455
124543
|
}
|
|
124456
124544
|
}
|
|
@@ -124465,9 +124553,9 @@ ${lanes.join("\n")}
|
|
|
124465
124553
|
return;
|
|
124466
124554
|
resolvedProjectReference.commandLine.fileNames.forEach((f) => removeResolutionsOfFile(resolutionHost.toPath(f)));
|
|
124467
124555
|
}
|
|
124468
|
-
function removeResolutionsOfFile(filePath) {
|
|
124469
|
-
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule);
|
|
124470
|
-
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective);
|
|
124556
|
+
function removeResolutionsOfFile(filePath, syncDirWatcherRemove) {
|
|
124557
|
+
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule, syncDirWatcherRemove);
|
|
124558
|
+
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective, syncDirWatcherRemove);
|
|
124471
124559
|
}
|
|
124472
124560
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
124473
124561
|
if (!resolutions)
|
|
@@ -125467,7 +125555,7 @@ ${lanes.join("\n")}
|
|
|
125467
125555
|
watchConfigFileWildCardDirectories();
|
|
125468
125556
|
if (configFileName)
|
|
125469
125557
|
updateExtendedConfigFilesWatches(toPath3(configFileName), compilerOptions, watchOptions, WatchType.ExtendedConfigFile);
|
|
125470
|
-
return configFileName ? { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, close } : { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, updateRootFileNames, close };
|
|
125558
|
+
return configFileName ? { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, close, getResolutionCache } : { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, updateRootFileNames, close, getResolutionCache };
|
|
125471
125559
|
function close() {
|
|
125472
125560
|
clearInvalidateResolutionsOfFailedLookupLocations();
|
|
125473
125561
|
resolutionCache.clear();
|
|
@@ -125507,6 +125595,9 @@ ${lanes.join("\n")}
|
|
|
125507
125595
|
parsedConfigs = void 0;
|
|
125508
125596
|
}
|
|
125509
125597
|
}
|
|
125598
|
+
function getResolutionCache() {
|
|
125599
|
+
return resolutionCache;
|
|
125600
|
+
}
|
|
125510
125601
|
function getCurrentBuilderProgram() {
|
|
125511
125602
|
return builderProgram;
|
|
125512
125603
|
}
|
|
@@ -130985,7 +131076,7 @@ ${lanes.join("\n")}
|
|
|
130985
131076
|
return idx === -1 ? -1 : idx + 1;
|
|
130986
131077
|
}
|
|
130987
131078
|
function needsParentheses(expression) {
|
|
130988
|
-
return isBinaryExpression(expression) && expression.operatorToken.kind === 28 /* CommaToken */ || isObjectLiteralExpression(expression) || isAsExpression(expression) && isObjectLiteralExpression(expression.expression);
|
|
131079
|
+
return isBinaryExpression(expression) && expression.operatorToken.kind === 28 /* CommaToken */ || isObjectLiteralExpression(expression) || (isAsExpression(expression) || isSatisfiesExpression(expression)) && isObjectLiteralExpression(expression.expression);
|
|
130989
131080
|
}
|
|
130990
131081
|
function getContextualTypeFromParent(node, checker, contextFlags) {
|
|
130991
131082
|
const parent2 = walkUpParenthesizedExpressions(node.parent);
|
|
@@ -133776,14 +133867,13 @@ ${lanes.join("\n")}
|
|
|
133776
133867
|
return ensurePathIsNonModuleName(combineNormal(pathA, pathB));
|
|
133777
133868
|
}
|
|
133778
133869
|
function getSourceFileToImport(importedModuleSymbol, importLiteral, importingSourceFile, program, host, oldToNew) {
|
|
133779
|
-
var _a, _b;
|
|
133780
133870
|
if (importedModuleSymbol) {
|
|
133781
133871
|
const oldFileName = find(importedModuleSymbol.declarations, isSourceFile).fileName;
|
|
133782
133872
|
const newFileName = oldToNew(oldFileName);
|
|
133783
133873
|
return newFileName === void 0 ? { newFileName: oldFileName, updated: false } : { newFileName, updated: true };
|
|
133784
133874
|
} else {
|
|
133785
133875
|
const mode = getModeForUsageLocation(importingSourceFile, importLiteral);
|
|
133786
|
-
const resolved = host.resolveModuleNameLiterals || !host.resolveModuleNames ?
|
|
133876
|
+
const resolved = host.resolveModuleNameLiterals || !host.resolveModuleNames ? program.getResolvedModule(importingSourceFile, importLiteral.text, mode) : host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode);
|
|
133787
133877
|
return getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, program.getSourceFiles());
|
|
133788
133878
|
}
|
|
133789
133879
|
}
|
|
@@ -134703,7 +134793,7 @@ ${lanes.join("\n")}
|
|
|
134703
134793
|
|
|
134704
134794
|
// src/services/suggestionDiagnostics.ts
|
|
134705
134795
|
function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
|
|
134706
|
-
var _a
|
|
134796
|
+
var _a;
|
|
134707
134797
|
program.getSemanticDiagnostics(sourceFile, cancellationToken);
|
|
134708
134798
|
const diags = [];
|
|
134709
134799
|
const checker = program.getTypeChecker();
|
|
@@ -134720,7 +134810,7 @@ ${lanes.join("\n")}
|
|
|
134720
134810
|
const name = importNameForConvertToDefaultImport(importNode);
|
|
134721
134811
|
if (!name)
|
|
134722
134812
|
continue;
|
|
134723
|
-
const module2 = (
|
|
134813
|
+
const module2 = (_a = program.getResolvedModule(sourceFile, moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier))) == null ? void 0 : _a.resolvedModule;
|
|
134724
134814
|
const resolvedFile = module2 && program.getSourceFile(module2.resolvedFileName);
|
|
134725
134815
|
if (resolvedFile && resolvedFile.externalModuleIndicator && resolvedFile.externalModuleIndicator !== true && isExportAssignment(resolvedFile.externalModuleIndicator) && resolvedFile.externalModuleIndicator.isExportEquals) {
|
|
134726
134816
|
diags.push(createDiagnosticForNode(name, Diagnostics.Import_may_be_converted_to_a_default_import));
|
|
@@ -137137,10 +137227,10 @@ ${lanes.join("\n")}
|
|
|
137137
137227
|
const targetSourceFile = program.getSourceFile(targetFile);
|
|
137138
137228
|
for (const oldStatement of oldFile.statements) {
|
|
137139
137229
|
forEachImportInStatement(oldStatement, (i) => {
|
|
137140
|
-
var _a
|
|
137230
|
+
var _a;
|
|
137141
137231
|
const moduleSpecifier = moduleSpecifierFromImport(i);
|
|
137142
|
-
const resolved =
|
|
137143
|
-
const fileName = (
|
|
137232
|
+
const resolved = program.getResolvedModule(oldFile, moduleSpecifier.text, getModeForUsageLocation(oldFile, moduleSpecifier));
|
|
137233
|
+
const fileName = (_a = resolved == null ? void 0 : resolved.resolvedModule) == null ? void 0 : _a.resolvedFileName;
|
|
137144
137234
|
if (fileName && targetSourceFile) {
|
|
137145
137235
|
const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), targetSourceFile, targetSourceFile.path, fileName, createModuleSpecifierResolutionHost(program, host));
|
|
137146
137236
|
append(copiedOldImports, filterImport(i, makeStringLiteral(newModuleSpecifier, quotePreference), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
|
|
@@ -138306,7 +138396,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
138306
138396
|
} else if (refactorKindBeginsWith(removeBracesAction.kind, kind) && isBlock(func.body) && func.body.statements.length === 1) {
|
|
138307
138397
|
const firstStatement = first(func.body.statements);
|
|
138308
138398
|
if (isReturnStatement(firstStatement)) {
|
|
138309
|
-
|
|
138399
|
+
const expression = firstStatement.expression && isObjectLiteralExpression(getLeftmostExpression(
|
|
138400
|
+
firstStatement.expression,
|
|
138401
|
+
/*stopAtCallExpressions*/
|
|
138402
|
+
false
|
|
138403
|
+
)) ? factory.createParenthesizedExpression(firstStatement.expression) : firstStatement.expression;
|
|
138404
|
+
return { func, addBraces: false, expression, returnStatement: firstStatement };
|
|
138310
138405
|
}
|
|
138311
138406
|
}
|
|
138312
138407
|
return void 0;
|
|
@@ -147767,9 +147862,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
147767
147862
|
|
|
147768
147863
|
// src/services/codefixes/convertToEsModule.ts
|
|
147769
147864
|
function fixImportOfModuleExports(importingFile, exportingFile, program, changes, quotePreference) {
|
|
147770
|
-
var _a
|
|
147865
|
+
var _a;
|
|
147771
147866
|
for (const moduleSpecifier of importingFile.imports) {
|
|
147772
|
-
const imported = (
|
|
147867
|
+
const imported = (_a = program.getResolvedModule(importingFile, moduleSpecifier.text, getModeForUsageLocation(importingFile, moduleSpecifier))) == null ? void 0 : _a.resolvedModule;
|
|
147773
147868
|
if (!imported || imported.resolvedFileName !== exportingFile.fileName) {
|
|
147774
147869
|
continue;
|
|
147775
147870
|
}
|
|
@@ -149905,11 +150000,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
149905
150000
|
Debug.failBadSyntaxKind(aliasDeclaration);
|
|
149906
150001
|
}
|
|
149907
150002
|
function promoteImportClause(importClause) {
|
|
149908
|
-
var _a
|
|
150003
|
+
var _a;
|
|
149909
150004
|
changes.delete(sourceFile, getTypeKeywordOfTypeOnlyImport(importClause, sourceFile));
|
|
149910
150005
|
if (!compilerOptions.allowImportingTsExtensions) {
|
|
149911
150006
|
const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(importClause.parent);
|
|
149912
|
-
const resolvedModule = moduleSpecifier && ((
|
|
150007
|
+
const resolvedModule = moduleSpecifier && ((_a = program.getResolvedModule(sourceFile, moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier))) == null ? void 0 : _a.resolvedModule);
|
|
149913
150008
|
if (resolvedModule == null ? void 0 : resolvedModule.resolvedUsingTsExtension) {
|
|
149914
150009
|
const changedExtension = changeAnyExtension(moduleSpecifier.text, getOutputExtension(moduleSpecifier.text, compilerOptions));
|
|
149915
150010
|
changes.replaceNode(sourceFile, moduleSpecifier, factory.createStringLiteral(changedExtension));
|
|
@@ -150616,7 +150711,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
150616
150711
|
|
|
150617
150712
|
// src/services/codefixes/fixImportNonExportedMember.ts
|
|
150618
150713
|
function getInfo7(sourceFile, pos, program) {
|
|
150619
|
-
var _a, _b
|
|
150714
|
+
var _a, _b;
|
|
150620
150715
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
150621
150716
|
if (isIdentifier(token)) {
|
|
150622
150717
|
const importDeclaration = findAncestor(token, isImportDeclaration);
|
|
@@ -150625,18 +150720,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
150625
150720
|
const moduleSpecifier = isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier.text : void 0;
|
|
150626
150721
|
if (moduleSpecifier === void 0)
|
|
150627
150722
|
return void 0;
|
|
150628
|
-
const resolvedModule = (
|
|
150723
|
+
const resolvedModule = (_a = program.getResolvedModule(
|
|
150724
|
+
sourceFile,
|
|
150629
150725
|
moduleSpecifier,
|
|
150630
150726
|
/*mode*/
|
|
150631
150727
|
void 0
|
|
150632
|
-
)) == null ? void 0 :
|
|
150728
|
+
)) == null ? void 0 : _a.resolvedModule;
|
|
150633
150729
|
if (resolvedModule === void 0)
|
|
150634
150730
|
return void 0;
|
|
150635
150731
|
const moduleSourceFile = program.getSourceFile(resolvedModule.resolvedFileName);
|
|
150636
150732
|
if (moduleSourceFile === void 0 || isSourceFileFromLibrary(program, moduleSourceFile))
|
|
150637
150733
|
return void 0;
|
|
150638
150734
|
const moduleSymbol = moduleSourceFile.symbol;
|
|
150639
|
-
const locals = (
|
|
150735
|
+
const locals = (_b = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _b.locals;
|
|
150640
150736
|
if (locals === void 0)
|
|
150641
150737
|
return void 0;
|
|
150642
150738
|
const localSymbol = locals.get(token.escapedText);
|
|
@@ -150926,10 +151022,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
150926
151022
|
return flags;
|
|
150927
151023
|
}
|
|
150928
151024
|
function getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration) {
|
|
150929
|
-
var _a
|
|
151025
|
+
var _a;
|
|
150930
151026
|
if (!importDeclaration || !isStringLiteralLike(importDeclaration.moduleSpecifier))
|
|
150931
151027
|
return void 0;
|
|
150932
|
-
const resolvedModule = (
|
|
151028
|
+
const resolvedModule = (_a = context.program.getResolvedModule(sourceFile, importDeclaration.moduleSpecifier.text, getModeForUsageLocation(sourceFile, importDeclaration.moduleSpecifier))) == null ? void 0 : _a.resolvedModule;
|
|
150933
151029
|
if (!resolvedModule)
|
|
150934
151030
|
return void 0;
|
|
150935
151031
|
return context.program.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -162242,7 +162338,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162242
162338
|
})(FindReferencesUse || {});
|
|
162243
162339
|
((Core2) => {
|
|
162244
162340
|
function getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options = {}, sourceFilesSet = new Set(sourceFiles.map((f) => f.fileName))) {
|
|
162245
|
-
var _a, _b
|
|
162341
|
+
var _a, _b;
|
|
162246
162342
|
node = getAdjustedNode2(node, options);
|
|
162247
162343
|
if (isSourceFile(node)) {
|
|
162248
162344
|
const resolvedRef = ts_GoToDefinition_exports.getReferenceAtPosition(node, position, program);
|
|
@@ -162281,7 +162377,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162281
162377
|
if (!options.implementations && isStringLiteralLike(node)) {
|
|
162282
162378
|
if (isModuleSpecifierLike(node)) {
|
|
162283
162379
|
const fileIncludeReasons = program.getFileIncludeReasons();
|
|
162284
|
-
const referencedFileName = (
|
|
162380
|
+
const referencedFileName = (_b = (_a = program.getResolvedModule(node.getSourceFile(), node.text, getModeForUsageLocation(node.getSourceFile(), node))) == null ? void 0 : _a.resolvedModule) == null ? void 0 : _b.resolvedFileName;
|
|
162285
162381
|
const referencedFile = referencedFileName ? program.getSourceFile(referencedFileName) : void 0;
|
|
162286
162382
|
if (referencedFile) {
|
|
162287
162383
|
return [{ definition: { type: 4 /* String */, node }, references: getReferencesForNonModule(referencedFile, fileIncludeReasons, program) || emptyArray }];
|
|
@@ -163711,7 +163807,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
163711
163807
|
|
|
163712
163808
|
// src/services/goToDefinition.ts
|
|
163713
163809
|
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly, stopAtAlias) {
|
|
163714
|
-
var _a
|
|
163810
|
+
var _a;
|
|
163715
163811
|
const resolvedRef = getReferenceAtPosition(sourceFile, position, program);
|
|
163716
163812
|
const fileReferenceDefinition = resolvedRef && [getDefinitionInfoForFileReference(resolvedRef.reference.fileName, resolvedRef.fileName, resolvedRef.unverified)] || emptyArray;
|
|
163717
163813
|
if (resolvedRef == null ? void 0 : resolvedRef.file) {
|
|
@@ -163784,7 +163880,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
163784
163880
|
}
|
|
163785
163881
|
}
|
|
163786
163882
|
if (!symbol && isModuleSpecifierLike(fallbackNode)) {
|
|
163787
|
-
const ref = (
|
|
163883
|
+
const ref = (_a = program.getResolvedModule(sourceFile, fallbackNode.text, getModeForUsageLocation(sourceFile, fallbackNode))) == null ? void 0 : _a.resolvedModule;
|
|
163788
163884
|
if (ref) {
|
|
163789
163885
|
return [{
|
|
163790
163886
|
name: fallbackNode.text,
|
|
@@ -163879,7 +163975,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
163879
163975
|
return getDefinitionFromSymbol(typeChecker, symbol, node);
|
|
163880
163976
|
}
|
|
163881
163977
|
function getReferenceAtPosition(sourceFile, position, program) {
|
|
163882
|
-
var _a, _b
|
|
163978
|
+
var _a, _b;
|
|
163883
163979
|
const referencePath = findReferenceInPosition(sourceFile.referencedFiles, position);
|
|
163884
163980
|
if (referencePath) {
|
|
163885
163981
|
const file = program.getSourceFileFromReference(sourceFile, referencePath);
|
|
@@ -163896,11 +163992,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
163896
163992
|
const file = program.getLibFileFromReference(libReferenceDirective);
|
|
163897
163993
|
return file && { reference: libReferenceDirective, fileName: file.fileName, file, unverified: false };
|
|
163898
163994
|
}
|
|
163899
|
-
|
|
163900
|
-
if (resolvedModules == null ? void 0 : resolvedModules.size()) {
|
|
163995
|
+
if (sourceFile.imports.length || sourceFile.moduleAugmentations.length) {
|
|
163901
163996
|
const node = getTouchingToken(sourceFile, position);
|
|
163902
|
-
|
|
163903
|
-
|
|
163997
|
+
let resolution;
|
|
163998
|
+
if (isModuleSpecifierLike(node) && isExternalModuleNameRelative(node.text) && (resolution = program.getResolvedModule(sourceFile, node.text, getModeForUsageLocation(sourceFile, node)))) {
|
|
163999
|
+
const verifiedFileName = (_b = resolution.resolvedModule) == null ? void 0 : _b.resolvedFileName;
|
|
163904
164000
|
const fileName = verifiedFileName || resolvePath(getDirectoryPath(sourceFile.fileName), node.text);
|
|
163905
164001
|
return {
|
|
163906
164002
|
file: program.getSourceFile(fileName),
|
|
@@ -172999,6 +173095,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
172999
173095
|
CommandTypes2["ProvideCallHierarchyIncomingCalls"] = "provideCallHierarchyIncomingCalls";
|
|
173000
173096
|
CommandTypes2["ProvideCallHierarchyOutgoingCalls"] = "provideCallHierarchyOutgoingCalls";
|
|
173001
173097
|
CommandTypes2["ProvideInlayHints"] = "provideInlayHints";
|
|
173098
|
+
CommandTypes2["WatchChange"] = "watchChange";
|
|
173002
173099
|
return CommandTypes2;
|
|
173003
173100
|
})(CommandTypes || {});
|
|
173004
173101
|
OrganizeImportsMode2 = /* @__PURE__ */ ((OrganizeImportsMode3) => {
|
|
@@ -173832,16 +173929,12 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
173832
173929
|
}
|
|
173833
173930
|
function extractUnresolvedImportsFromSourceFile(program, file, ambientModules, cachedUnresolvedImportsPerFile) {
|
|
173834
173931
|
return getOrUpdate(cachedUnresolvedImportsPerFile, file.path, () => {
|
|
173835
|
-
var _a;
|
|
173836
|
-
const resolvedModules = (_a = program.resolvedModules) == null ? void 0 : _a.get(file.path);
|
|
173837
|
-
if (!resolvedModules)
|
|
173838
|
-
return emptyArray2;
|
|
173839
173932
|
let unresolvedImports;
|
|
173840
|
-
|
|
173933
|
+
program.forEachResolvedModule(({ resolvedModule }, name) => {
|
|
173841
173934
|
if ((!resolvedModule || !resolutionExtensionIsTSOrJson(resolvedModule.extension)) && !isExternalModuleNameRelative(name) && !ambientModules.some((m) => m === name)) {
|
|
173842
173935
|
unresolvedImports = append(unresolvedImports, parsePackageName(name).packageName);
|
|
173843
173936
|
}
|
|
173844
|
-
});
|
|
173937
|
+
}, file);
|
|
173845
173938
|
return unresolvedImports || emptyArray2;
|
|
173846
173939
|
});
|
|
173847
173940
|
}
|
|
@@ -174050,8 +174143,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
174050
174143
|
}
|
|
174051
174144
|
if (this.program && !this.symlinks.hasProcessedResolutions()) {
|
|
174052
174145
|
this.symlinks.setSymlinksFromResolutions(
|
|
174053
|
-
this.program.
|
|
174054
|
-
this.program.
|
|
174146
|
+
this.program.forEachResolvedModule,
|
|
174147
|
+
this.program.forEachResolvedTypeReferenceDirective,
|
|
174055
174148
|
this.program.getAutomaticTypeDirectiveResolutions()
|
|
174056
174149
|
);
|
|
174057
174150
|
}
|
|
@@ -174834,12 +174927,23 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
174834
174927
|
for (const f of oldProgram.getSourceFiles()) {
|
|
174835
174928
|
const newFile = this.program.getSourceFileByPath(f.resolvedPath);
|
|
174836
174929
|
if (!newFile || f.resolvedPath === f.path && newFile.resolvedPath !== f.path) {
|
|
174837
|
-
this.detachScriptInfoFromProject(
|
|
174930
|
+
this.detachScriptInfoFromProject(
|
|
174931
|
+
f.fileName,
|
|
174932
|
+
!!this.program.getSourceFileByPath(f.path),
|
|
174933
|
+
/*syncDirWatcherRemove*/
|
|
174934
|
+
true
|
|
174935
|
+
);
|
|
174838
174936
|
}
|
|
174839
174937
|
}
|
|
174840
174938
|
oldProgram.forEachResolvedProjectReference((resolvedProjectReference) => {
|
|
174841
174939
|
if (!this.program.getResolvedProjectReferenceByPath(resolvedProjectReference.sourceFile.path)) {
|
|
174842
|
-
this.detachScriptInfoFromProject(
|
|
174940
|
+
this.detachScriptInfoFromProject(
|
|
174941
|
+
resolvedProjectReference.sourceFile.fileName,
|
|
174942
|
+
/*noRemoveResolution*/
|
|
174943
|
+
void 0,
|
|
174944
|
+
/*syncDirWatcherRemove*/
|
|
174945
|
+
true
|
|
174946
|
+
);
|
|
174843
174947
|
}
|
|
174844
174948
|
});
|
|
174845
174949
|
}
|
|
@@ -174879,6 +174983,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
174879
174983
|
this.resolutionCache.updateTypeRootsWatch();
|
|
174880
174984
|
}
|
|
174881
174985
|
}
|
|
174986
|
+
this.projectService.verifyProgram(this);
|
|
174882
174987
|
if (this.exportMapCache && !this.exportMapCache.isEmpty()) {
|
|
174883
174988
|
this.exportMapCache.releaseSymbols();
|
|
174884
174989
|
if (this.hasAddedorRemovedFiles || oldProgram && !this.program.structureIsReused) {
|
|
@@ -174951,12 +175056,12 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
174951
175056
|
sendPerformanceEvent(kind, durationMs) {
|
|
174952
175057
|
this.projectService.sendPerformanceEvent(kind, durationMs);
|
|
174953
175058
|
}
|
|
174954
|
-
detachScriptInfoFromProject(uncheckedFileName, noRemoveResolution) {
|
|
175059
|
+
detachScriptInfoFromProject(uncheckedFileName, noRemoveResolution, syncDirWatcherRemove) {
|
|
174955
175060
|
const scriptInfoToDetach = this.projectService.getScriptInfo(uncheckedFileName);
|
|
174956
175061
|
if (scriptInfoToDetach) {
|
|
174957
175062
|
scriptInfoToDetach.detachFromProject(this);
|
|
174958
175063
|
if (!noRemoveResolution) {
|
|
174959
|
-
this.resolutionCache.removeResolutionsOfFile(scriptInfoToDetach.path);
|
|
175064
|
+
this.resolutionCache.removeResolutionsOfFile(scriptInfoToDetach.path, syncDirWatcherRemove);
|
|
174960
175065
|
}
|
|
174961
175066
|
}
|
|
174962
175067
|
}
|
|
@@ -175690,11 +175795,12 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
175690
175795
|
);
|
|
175691
175796
|
if (entrypoints) {
|
|
175692
175797
|
const real = (_a2 = host.realpath) == null ? void 0 : _a2.call(host, packageJson.packageDirectory);
|
|
175693
|
-
const
|
|
175798
|
+
const realPath2 = real ? hostProject.toPath(real) : void 0;
|
|
175799
|
+
const isSymlink = realPath2 && realPath2 !== hostProject.toPath(packageJson.packageDirectory);
|
|
175694
175800
|
if (isSymlink) {
|
|
175695
175801
|
symlinkCache.setSymlinkedDirectory(packageJson.packageDirectory, {
|
|
175696
175802
|
real,
|
|
175697
|
-
realPath:
|
|
175803
|
+
realPath: realPath2
|
|
175698
175804
|
});
|
|
175699
175805
|
}
|
|
175700
175806
|
return mapDefined(entrypoints, (entrypoint) => {
|
|
@@ -176276,6 +176382,87 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
176276
176382
|
let nextId = 1;
|
|
176277
176383
|
return () => nameFactory(nextId++);
|
|
176278
176384
|
}
|
|
176385
|
+
function getHostWatcherMap() {
|
|
176386
|
+
return { idToCallbacks: /* @__PURE__ */ new Map(), pathToId: /* @__PURE__ */ new Map() };
|
|
176387
|
+
}
|
|
176388
|
+
function createWatchFactoryHostUsingWatchEvents(service, canUseWatchEvents) {
|
|
176389
|
+
if (!canUseWatchEvents || !service.eventHandler || !service.session)
|
|
176390
|
+
return void 0;
|
|
176391
|
+
const watchedFiles = getHostWatcherMap();
|
|
176392
|
+
const watchedDirectories = getHostWatcherMap();
|
|
176393
|
+
const watchedDirectoriesRecursive = getHostWatcherMap();
|
|
176394
|
+
let ids = 1;
|
|
176395
|
+
service.session.addProtocolHandler("watchChange" /* WatchChange */, (req) => {
|
|
176396
|
+
onWatchChange(req.arguments);
|
|
176397
|
+
return { responseRequired: false };
|
|
176398
|
+
});
|
|
176399
|
+
return {
|
|
176400
|
+
watchFile: watchFile2,
|
|
176401
|
+
watchDirectory,
|
|
176402
|
+
getCurrentDirectory: () => service.host.getCurrentDirectory(),
|
|
176403
|
+
useCaseSensitiveFileNames: service.host.useCaseSensitiveFileNames
|
|
176404
|
+
};
|
|
176405
|
+
function watchFile2(path, callback) {
|
|
176406
|
+
return getOrCreateFileWatcher(
|
|
176407
|
+
watchedFiles,
|
|
176408
|
+
path,
|
|
176409
|
+
callback,
|
|
176410
|
+
(id) => ({ eventName: CreateFileWatcherEvent, data: { id, path } })
|
|
176411
|
+
);
|
|
176412
|
+
}
|
|
176413
|
+
function watchDirectory(path, callback, recursive) {
|
|
176414
|
+
return getOrCreateFileWatcher(
|
|
176415
|
+
recursive ? watchedDirectoriesRecursive : watchedDirectories,
|
|
176416
|
+
path,
|
|
176417
|
+
callback,
|
|
176418
|
+
(id) => ({ eventName: CreateDirectoryWatcherEvent, data: { id, path, recursive: !!recursive } })
|
|
176419
|
+
);
|
|
176420
|
+
}
|
|
176421
|
+
function getOrCreateFileWatcher({ pathToId, idToCallbacks }, path, callback, event) {
|
|
176422
|
+
const key = service.toPath(path);
|
|
176423
|
+
let id = pathToId.get(key);
|
|
176424
|
+
if (!id)
|
|
176425
|
+
pathToId.set(key, id = ids++);
|
|
176426
|
+
let callbacks = idToCallbacks.get(id);
|
|
176427
|
+
if (!callbacks) {
|
|
176428
|
+
idToCallbacks.set(id, callbacks = /* @__PURE__ */ new Set());
|
|
176429
|
+
service.eventHandler(event(id));
|
|
176430
|
+
}
|
|
176431
|
+
callbacks.add(callback);
|
|
176432
|
+
return {
|
|
176433
|
+
close() {
|
|
176434
|
+
const callbacks2 = idToCallbacks.get(id);
|
|
176435
|
+
if (!(callbacks2 == null ? void 0 : callbacks2.delete(callback)))
|
|
176436
|
+
return;
|
|
176437
|
+
if (callbacks2.size)
|
|
176438
|
+
return;
|
|
176439
|
+
idToCallbacks.delete(id);
|
|
176440
|
+
pathToId.delete(key);
|
|
176441
|
+
service.eventHandler({ eventName: CloseFileWatcherEvent, data: { id } });
|
|
176442
|
+
}
|
|
176443
|
+
};
|
|
176444
|
+
}
|
|
176445
|
+
function onWatchChange({ id, path, eventType }) {
|
|
176446
|
+
onFileWatcherCallback(id, path, eventType);
|
|
176447
|
+
onDirectoryWatcherCallback(watchedDirectories, id, path, eventType);
|
|
176448
|
+
onDirectoryWatcherCallback(watchedDirectoriesRecursive, id, path, eventType);
|
|
176449
|
+
}
|
|
176450
|
+
function onFileWatcherCallback(id, eventPath, eventType) {
|
|
176451
|
+
var _a;
|
|
176452
|
+
(_a = watchedFiles.idToCallbacks.get(id)) == null ? void 0 : _a.forEach((callback) => {
|
|
176453
|
+
const eventKind = eventType === "create" ? 0 /* Created */ : eventType === "delete" ? 2 /* Deleted */ : 1 /* Changed */;
|
|
176454
|
+
callback(eventPath, eventKind);
|
|
176455
|
+
});
|
|
176456
|
+
}
|
|
176457
|
+
function onDirectoryWatcherCallback({ idToCallbacks }, id, eventPath, eventType) {
|
|
176458
|
+
var _a;
|
|
176459
|
+
if (eventType === "update")
|
|
176460
|
+
return;
|
|
176461
|
+
(_a = idToCallbacks.get(id)) == null ? void 0 : _a.forEach((callback) => {
|
|
176462
|
+
callback(eventPath);
|
|
176463
|
+
});
|
|
176464
|
+
}
|
|
176465
|
+
}
|
|
176279
176466
|
function createIncompleteCompletionsCache() {
|
|
176280
176467
|
let info;
|
|
176281
176468
|
return {
|
|
@@ -176303,12 +176490,13 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
176303
176490
|
false
|
|
176304
176491
|
);
|
|
176305
176492
|
}
|
|
176306
|
-
var maxProgramSizeForNonTsFiles, maxFileSize, ProjectsUpdatedInBackgroundEvent, ProjectLoadingStartEvent, ProjectLoadingFinishEvent, LargeFileReferencedEvent, ConfigFileDiagEvent, ProjectLanguageServiceStateEvent, ProjectInfoTelemetryEvent, OpenFileInfoTelemetryEvent, ensureProjectForOpenFileSchedule, compilerOptionConverters, watchOptionsConverters, indentStyle, defaultTypeSafeList, fileNamePropertyReader, externalFilePropertyReader, noopConfigFileWatcher, ProjectReferenceProjectLoadKind, _ProjectService, ProjectService3;
|
|
176493
|
+
var maxProgramSizeForNonTsFiles, maxFileSize, ProjectsUpdatedInBackgroundEvent, ProjectLoadingStartEvent, ProjectLoadingFinishEvent, LargeFileReferencedEvent, ConfigFileDiagEvent, ProjectLanguageServiceStateEvent, ProjectInfoTelemetryEvent, OpenFileInfoTelemetryEvent, CreateFileWatcherEvent, CreateDirectoryWatcherEvent, CloseFileWatcherEvent, ensureProjectForOpenFileSchedule, compilerOptionConverters, watchOptionsConverters, indentStyle, defaultTypeSafeList, fileNamePropertyReader, externalFilePropertyReader, noopConfigFileWatcher, ProjectReferenceProjectLoadKind, _ProjectService, ProjectService3;
|
|
176307
176494
|
var init_editorServices = __esm({
|
|
176308
176495
|
"src/server/editorServices.ts"() {
|
|
176309
176496
|
"use strict";
|
|
176310
176497
|
init_ts7();
|
|
176311
176498
|
init_ts_server3();
|
|
176499
|
+
init_protocol();
|
|
176312
176500
|
maxProgramSizeForNonTsFiles = 20 * 1024 * 1024;
|
|
176313
176501
|
maxFileSize = 4 * 1024 * 1024;
|
|
176314
176502
|
ProjectsUpdatedInBackgroundEvent = "projectsUpdatedInBackground";
|
|
@@ -176319,6 +176507,9 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
176319
176507
|
ProjectLanguageServiceStateEvent = "projectLanguageServiceState";
|
|
176320
176508
|
ProjectInfoTelemetryEvent = "projectInfo";
|
|
176321
176509
|
OpenFileInfoTelemetryEvent = "openFileInfo";
|
|
176510
|
+
CreateFileWatcherEvent = "createFileWatcher";
|
|
176511
|
+
CreateDirectoryWatcherEvent = "createDirectoryWatcher";
|
|
176512
|
+
CloseFileWatcherEvent = "closeFileWatcher";
|
|
176322
176513
|
ensureProjectForOpenFileSchedule = "*ensureProjectForOpenFiles*";
|
|
176323
176514
|
compilerOptionConverters = prepareConvertersForEnumLikeCompilerOptions(optionDeclarations);
|
|
176324
176515
|
watchOptionsConverters = prepareConvertersForEnumLikeCompilerOptions(optionsForWatch);
|
|
@@ -176474,6 +176665,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
176474
176665
|
this.extendedConfigCache = /* @__PURE__ */ new Map();
|
|
176475
176666
|
/** @internal */
|
|
176476
176667
|
this.verifyDocumentRegistry = noop;
|
|
176668
|
+
/** @internal */
|
|
176669
|
+
this.verifyProgram = noop;
|
|
176477
176670
|
var _a;
|
|
176478
176671
|
this.host = opts.host;
|
|
176479
176672
|
this.logger = opts.logger;
|
|
@@ -176522,7 +176715,12 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
176522
176715
|
this.watchFactory = this.serverMode !== 0 /* Semantic */ ? {
|
|
176523
176716
|
watchFile: returnNoopFileWatcher,
|
|
176524
176717
|
watchDirectory: returnNoopFileWatcher
|
|
176525
|
-
} : getWatchFactory(
|
|
176718
|
+
} : getWatchFactory(
|
|
176719
|
+
createWatchFactoryHostUsingWatchEvents(this, opts.canUseWatchEvents) || this.host,
|
|
176720
|
+
watchLogLevel,
|
|
176721
|
+
log,
|
|
176722
|
+
getDetailWatchInfo
|
|
176723
|
+
);
|
|
176526
176724
|
(_a = opts.incrementalVerifier) == null ? void 0 : _a.call(opts, this);
|
|
176527
176725
|
}
|
|
176528
176726
|
toPath(fileName) {
|
|
@@ -180815,6 +181013,7 @@ ${json}${newLine}`;
|
|
|
180815
181013
|
typesMapLocation: opts.typesMapLocation,
|
|
180816
181014
|
serverMode: opts.serverMode,
|
|
180817
181015
|
session: this,
|
|
181016
|
+
canUseWatchEvents: opts.canUseWatchEvents,
|
|
180818
181017
|
incrementalVerifier: opts.incrementalVerifier
|
|
180819
181018
|
};
|
|
180820
181019
|
this.projectService = new ProjectService3(settings);
|
|
@@ -180868,43 +181067,41 @@ ${json}${newLine}`;
|
|
|
180868
181067
|
defaultEventHandler(event) {
|
|
180869
181068
|
switch (event.eventName) {
|
|
180870
181069
|
case ProjectsUpdatedInBackgroundEvent:
|
|
180871
|
-
|
|
180872
|
-
this.projectsUpdatedInBackgroundEvent(openFiles);
|
|
181070
|
+
this.projectsUpdatedInBackgroundEvent(event.data.openFiles);
|
|
180873
181071
|
break;
|
|
180874
181072
|
case ProjectLoadingStartEvent:
|
|
180875
|
-
|
|
180876
|
-
|
|
180877
|
-
|
|
180878
|
-
|
|
180879
|
-
);
|
|
181073
|
+
this.event({
|
|
181074
|
+
projectName: event.data.project.getProjectName(),
|
|
181075
|
+
reason: event.data.reason
|
|
181076
|
+
}, event.eventName);
|
|
180880
181077
|
break;
|
|
180881
181078
|
case ProjectLoadingFinishEvent:
|
|
180882
|
-
|
|
180883
|
-
|
|
181079
|
+
this.event({
|
|
181080
|
+
projectName: event.data.project.getProjectName()
|
|
181081
|
+
}, event.eventName);
|
|
180884
181082
|
break;
|
|
180885
181083
|
case LargeFileReferencedEvent:
|
|
180886
|
-
|
|
180887
|
-
|
|
181084
|
+
case CreateFileWatcherEvent:
|
|
181085
|
+
case CreateDirectoryWatcherEvent:
|
|
181086
|
+
case CloseFileWatcherEvent:
|
|
181087
|
+
this.event(event.data, event.eventName);
|
|
180888
181088
|
break;
|
|
180889
181089
|
case ConfigFileDiagEvent:
|
|
180890
|
-
const { triggerFile, configFileName: configFile, diagnostics } = event.data;
|
|
180891
|
-
const bakedDiags = map(diagnostics, (diagnostic) => formatDiagnosticToProtocol(
|
|
180892
|
-
diagnostic,
|
|
180893
|
-
/*includeFileName*/
|
|
180894
|
-
true
|
|
180895
|
-
));
|
|
180896
181090
|
this.event({
|
|
180897
|
-
triggerFile,
|
|
180898
|
-
configFile,
|
|
180899
|
-
diagnostics:
|
|
180900
|
-
|
|
181091
|
+
triggerFile: event.data.triggerFile,
|
|
181092
|
+
configFile: event.data.configFileName,
|
|
181093
|
+
diagnostics: map(event.data.diagnostics, (diagnostic) => formatDiagnosticToProtocol(
|
|
181094
|
+
diagnostic,
|
|
181095
|
+
/*includeFileName*/
|
|
181096
|
+
true
|
|
181097
|
+
))
|
|
181098
|
+
}, event.eventName);
|
|
180901
181099
|
break;
|
|
180902
181100
|
case ProjectLanguageServiceStateEvent: {
|
|
180903
|
-
const eventName = ProjectLanguageServiceStateEvent;
|
|
180904
181101
|
this.event({
|
|
180905
181102
|
projectName: event.data.project.getProjectName(),
|
|
180906
181103
|
languageServiceEnabled: event.data.languageServiceEnabled
|
|
180907
|
-
}, eventName);
|
|
181104
|
+
}, event.eventName);
|
|
180908
181105
|
break;
|
|
180909
181106
|
}
|
|
180910
181107
|
case ProjectInfoTelemetryEvent: {
|
|
@@ -183634,9 +183831,12 @@ ${e.message}`;
|
|
|
183634
183831
|
AutoImportProviderProject: () => AutoImportProviderProject,
|
|
183635
183832
|
AuxiliaryProject: () => AuxiliaryProject,
|
|
183636
183833
|
CharRangeSection: () => CharRangeSection,
|
|
183834
|
+
CloseFileWatcherEvent: () => CloseFileWatcherEvent,
|
|
183637
183835
|
CommandNames: () => CommandNames,
|
|
183638
183836
|
ConfigFileDiagEvent: () => ConfigFileDiagEvent,
|
|
183639
183837
|
ConfiguredProject: () => ConfiguredProject2,
|
|
183838
|
+
CreateDirectoryWatcherEvent: () => CreateDirectoryWatcherEvent,
|
|
183839
|
+
CreateFileWatcherEvent: () => CreateFileWatcherEvent,
|
|
183640
183840
|
Errors: () => Errors,
|
|
183641
183841
|
EventBeginInstallTypes: () => EventBeginInstallTypes,
|
|
183642
183842
|
EventEndInstallTypes: () => EventEndInstallTypes,
|
|
@@ -184135,6 +184335,7 @@ ${e.message}`;
|
|
|
184135
184335
|
createModuleNotFoundChain: () => createModuleNotFoundChain,
|
|
184136
184336
|
createModuleResolutionCache: () => createModuleResolutionCache,
|
|
184137
184337
|
createModuleResolutionLoader: () => createModuleResolutionLoader,
|
|
184338
|
+
createModuleResolutionLoaderUsingGlobalCache: () => createModuleResolutionLoaderUsingGlobalCache,
|
|
184138
184339
|
createModuleSpecifierResolutionHost: () => createModuleSpecifierResolutionHost,
|
|
184139
184340
|
createMultiMap: () => createMultiMap,
|
|
184140
184341
|
createNodeConverters: () => createNodeConverters,
|
|
@@ -184563,6 +184764,7 @@ ${e.message}`;
|
|
|
184563
184764
|
getLeadingCommentRangesOfNode: () => getLeadingCommentRangesOfNode,
|
|
184564
184765
|
getLeftmostAccessExpression: () => getLeftmostAccessExpression,
|
|
184565
184766
|
getLeftmostExpression: () => getLeftmostExpression,
|
|
184767
|
+
getLibraryNameFromLibFileName: () => getLibraryNameFromLibFileName,
|
|
184566
184768
|
getLineAndCharacterOfPosition: () => getLineAndCharacterOfPosition,
|
|
184567
184769
|
getLineInfo: () => getLineInfo,
|
|
184568
184770
|
getLineOfLocalPosition: () => getLineOfLocalPosition,
|
|
@@ -184957,6 +185159,7 @@ ${e.message}`;
|
|
|
184957
185159
|
isClassDeclaration: () => isClassDeclaration,
|
|
184958
185160
|
isClassElement: () => isClassElement,
|
|
184959
185161
|
isClassExpression: () => isClassExpression,
|
|
185162
|
+
isClassFieldAndNotAutoAccessor: () => isClassFieldAndNotAutoAccessor,
|
|
184960
185163
|
isClassLike: () => isClassLike,
|
|
184961
185164
|
isClassMemberModifier: () => isClassMemberModifier,
|
|
184962
185165
|
isClassNamedEvaluationHelperBlock: () => isClassNamedEvaluationHelperBlock,
|
|
@@ -186046,9 +186249,12 @@ ${e.message}`;
|
|
|
186046
186249
|
AutoImportProviderProject: () => AutoImportProviderProject,
|
|
186047
186250
|
AuxiliaryProject: () => AuxiliaryProject,
|
|
186048
186251
|
CharRangeSection: () => CharRangeSection,
|
|
186252
|
+
CloseFileWatcherEvent: () => CloseFileWatcherEvent,
|
|
186049
186253
|
CommandNames: () => CommandNames,
|
|
186050
186254
|
ConfigFileDiagEvent: () => ConfigFileDiagEvent,
|
|
186051
186255
|
ConfiguredProject: () => ConfiguredProject2,
|
|
186256
|
+
CreateDirectoryWatcherEvent: () => CreateDirectoryWatcherEvent,
|
|
186257
|
+
CreateFileWatcherEvent: () => CreateFileWatcherEvent,
|
|
186052
186258
|
Errors: () => Errors,
|
|
186053
186259
|
EventBeginInstallTypes: () => EventBeginInstallTypes,
|
|
186054
186260
|
EventEndInstallTypes: () => EventEndInstallTypes,
|
|
@@ -186535,6 +186741,7 @@ ${e.message}`;
|
|
|
186535
186741
|
createModuleNotFoundChain: () => createModuleNotFoundChain,
|
|
186536
186742
|
createModuleResolutionCache: () => createModuleResolutionCache,
|
|
186537
186743
|
createModuleResolutionLoader: () => createModuleResolutionLoader,
|
|
186744
|
+
createModuleResolutionLoaderUsingGlobalCache: () => createModuleResolutionLoaderUsingGlobalCache,
|
|
186538
186745
|
createModuleSpecifierResolutionHost: () => createModuleSpecifierResolutionHost,
|
|
186539
186746
|
createMultiMap: () => createMultiMap,
|
|
186540
186747
|
createNodeConverters: () => createNodeConverters,
|
|
@@ -186963,6 +187170,7 @@ ${e.message}`;
|
|
|
186963
187170
|
getLeadingCommentRangesOfNode: () => getLeadingCommentRangesOfNode,
|
|
186964
187171
|
getLeftmostAccessExpression: () => getLeftmostAccessExpression,
|
|
186965
187172
|
getLeftmostExpression: () => getLeftmostExpression,
|
|
187173
|
+
getLibraryNameFromLibFileName: () => getLibraryNameFromLibFileName,
|
|
186966
187174
|
getLineAndCharacterOfPosition: () => getLineAndCharacterOfPosition,
|
|
186967
187175
|
getLineInfo: () => getLineInfo,
|
|
186968
187176
|
getLineOfLocalPosition: () => getLineOfLocalPosition,
|
|
@@ -187357,6 +187565,7 @@ ${e.message}`;
|
|
|
187357
187565
|
isClassDeclaration: () => isClassDeclaration,
|
|
187358
187566
|
isClassElement: () => isClassElement,
|
|
187359
187567
|
isClassExpression: () => isClassExpression,
|
|
187568
|
+
isClassFieldAndNotAutoAccessor: () => isClassFieldAndNotAutoAccessor,
|
|
187360
187569
|
isClassLike: () => isClassLike,
|
|
187361
187570
|
isClassMemberModifier: () => isClassMemberModifier,
|
|
187362
187571
|
isClassNamedEvaluationHelperBlock: () => isClassNamedEvaluationHelperBlock,
|