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/tsserver.js
CHANGED
|
@@ -431,6 +431,7 @@ __export(server_exports, {
|
|
|
431
431
|
createModuleNotFoundChain: () => createModuleNotFoundChain,
|
|
432
432
|
createModuleResolutionCache: () => createModuleResolutionCache,
|
|
433
433
|
createModuleResolutionLoader: () => createModuleResolutionLoader,
|
|
434
|
+
createModuleResolutionLoaderUsingGlobalCache: () => createModuleResolutionLoaderUsingGlobalCache,
|
|
434
435
|
createModuleSpecifierResolutionHost: () => createModuleSpecifierResolutionHost,
|
|
435
436
|
createMultiMap: () => createMultiMap,
|
|
436
437
|
createNodeConverters: () => createNodeConverters,
|
|
@@ -859,6 +860,7 @@ __export(server_exports, {
|
|
|
859
860
|
getLeadingCommentRangesOfNode: () => getLeadingCommentRangesOfNode,
|
|
860
861
|
getLeftmostAccessExpression: () => getLeftmostAccessExpression,
|
|
861
862
|
getLeftmostExpression: () => getLeftmostExpression,
|
|
863
|
+
getLibraryNameFromLibFileName: () => getLibraryNameFromLibFileName,
|
|
862
864
|
getLineAndCharacterOfPosition: () => getLineAndCharacterOfPosition,
|
|
863
865
|
getLineInfo: () => getLineInfo,
|
|
864
866
|
getLineOfLocalPosition: () => getLineOfLocalPosition,
|
|
@@ -1253,6 +1255,7 @@ __export(server_exports, {
|
|
|
1253
1255
|
isClassDeclaration: () => isClassDeclaration,
|
|
1254
1256
|
isClassElement: () => isClassElement,
|
|
1255
1257
|
isClassExpression: () => isClassExpression,
|
|
1258
|
+
isClassFieldAndNotAutoAccessor: () => isClassFieldAndNotAutoAccessor,
|
|
1256
1259
|
isClassLike: () => isClassLike,
|
|
1257
1260
|
isClassMemberModifier: () => isClassMemberModifier,
|
|
1258
1261
|
isClassNamedEvaluationHelperBlock: () => isClassNamedEvaluationHelperBlock,
|
|
@@ -2324,7 +2327,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2324
2327
|
|
|
2325
2328
|
// src/compiler/corePublic.ts
|
|
2326
2329
|
var versionMajorMinor = "5.3";
|
|
2327
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2330
|
+
var version = `${versionMajorMinor}.0-dev.20230923`;
|
|
2328
2331
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2329
2332
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2330
2333
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -10165,6 +10168,7 @@ var Diagnostics = {
|
|
|
10165
10168
|
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."),
|
|
10166
10169
|
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."),
|
|
10167
10170
|
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."),
|
|
10171
|
+
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."),
|
|
10168
10172
|
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}'."),
|
|
10169
10173
|
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}'."),
|
|
10170
10174
|
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}'."),
|
|
@@ -14471,6 +14475,9 @@ function isAccessor(node) {
|
|
|
14471
14475
|
function isAutoAccessorPropertyDeclaration(node) {
|
|
14472
14476
|
return isPropertyDeclaration(node) && hasAccessorModifier(node);
|
|
14473
14477
|
}
|
|
14478
|
+
function isClassFieldAndNotAutoAccessor(node) {
|
|
14479
|
+
return node.parent && isClassLike(node.parent) && isPropertyDeclaration(node) && !hasAccessorModifier(node);
|
|
14480
|
+
}
|
|
14474
14481
|
function isMethodOrAccessor(node) {
|
|
14475
14482
|
switch (node.kind) {
|
|
14476
14483
|
case 174 /* MethodDeclaration */:
|
|
@@ -15173,8 +15180,8 @@ function moduleResolutionIsEqualTo(oldResolution, newResolution) {
|
|
|
15173
15180
|
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;
|
|
15174
15181
|
}
|
|
15175
15182
|
function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageName) {
|
|
15176
|
-
var _a
|
|
15177
|
-
const node10Result = (
|
|
15183
|
+
var _a;
|
|
15184
|
+
const node10Result = (_a = host.getResolvedModule(sourceFile, moduleReference, mode)) == null ? void 0 : _a.node10Result;
|
|
15178
15185
|
const result = node10Result ? chainDiagnosticMessages(
|
|
15179
15186
|
/*details*/
|
|
15180
15187
|
void 0,
|
|
@@ -15216,14 +15223,14 @@ function packageIdToString(packageId) {
|
|
|
15216
15223
|
function typeDirectiveIsEqualTo(oldResolution, newResolution) {
|
|
15217
15224
|
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;
|
|
15218
15225
|
}
|
|
15219
|
-
function hasChangesInResolutions(names, newSourceFile, newResolutions,
|
|
15226
|
+
function hasChangesInResolutions(names, newSourceFile, newResolutions, getOldResolution, comparer, nameAndModeGetter) {
|
|
15220
15227
|
Debug.assert(names.length === newResolutions.length);
|
|
15221
15228
|
for (let i = 0; i < names.length; i++) {
|
|
15222
15229
|
const newResolution = newResolutions[i];
|
|
15223
15230
|
const entry = names[i];
|
|
15224
15231
|
const name = nameAndModeGetter.getName(entry);
|
|
15225
15232
|
const mode = nameAndModeGetter.getMode(entry, newSourceFile);
|
|
15226
|
-
const oldResolution =
|
|
15233
|
+
const oldResolution = getOldResolution(name, mode);
|
|
15227
15234
|
const changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution;
|
|
15228
15235
|
if (changed) {
|
|
15229
15236
|
return true;
|
|
@@ -20622,11 +20629,11 @@ function createSymlinkCache(cwd, getCanonicalFileName) {
|
|
|
20622
20629
|
(symlinkedDirectories || (symlinkedDirectories = /* @__PURE__ */ new Map())).set(symlinkPath, real);
|
|
20623
20630
|
}
|
|
20624
20631
|
},
|
|
20625
|
-
setSymlinksFromResolutions(
|
|
20632
|
+
setSymlinksFromResolutions(forEachResolvedModule, forEachResolvedTypeReferenceDirective, typeReferenceDirectives) {
|
|
20626
20633
|
Debug.assert(!hasProcessedResolutions);
|
|
20627
20634
|
hasProcessedResolutions = true;
|
|
20628
|
-
|
|
20629
|
-
|
|
20635
|
+
forEachResolvedModule((resolution) => processResolution(this, resolution.resolvedModule));
|
|
20636
|
+
forEachResolvedTypeReferenceDirective((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
20630
20637
|
typeReferenceDirectives.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
20631
20638
|
},
|
|
20632
20639
|
hasProcessedResolutions: () => hasProcessedResolutions
|
|
@@ -50999,7 +51006,7 @@ function createTypeChecker(host) {
|
|
|
50999
51006
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
|
|
51000
51007
|
}
|
|
51001
51008
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
51002
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k
|
|
51009
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
51003
51010
|
if (startsWith(moduleReference, "@types/")) {
|
|
51004
51011
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
51005
51012
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -51017,7 +51024,7 @@ function createTypeChecker(host) {
|
|
|
51017
51024
|
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);
|
|
51018
51025
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
51019
51026
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
51020
|
-
const resolvedModule = (
|
|
51027
|
+
const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
|
|
51021
51028
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
51022
51029
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
51023
51030
|
if (sourceFile) {
|
|
@@ -51025,7 +51032,7 @@ function createTypeChecker(host) {
|
|
|
51025
51032
|
error2(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
51026
51033
|
}
|
|
51027
51034
|
if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
|
|
51028
|
-
const importOrExport = ((
|
|
51035
|
+
const importOrExport = ((_h = findAncestor(location, isImportDeclaration)) == null ? void 0 : _h.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
51029
51036
|
if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
|
|
51030
51037
|
error2(
|
|
51031
51038
|
errorNode,
|
|
@@ -51034,7 +51041,7 @@ function createTypeChecker(host) {
|
|
|
51034
51041
|
);
|
|
51035
51042
|
}
|
|
51036
51043
|
} else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
|
|
51037
|
-
const importOrExport = ((
|
|
51044
|
+
const importOrExport = ((_i = findAncestor(location, isImportDeclaration)) == null ? void 0 : _i.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
51038
51045
|
if (!((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
|
|
51039
51046
|
const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
|
|
51040
51047
|
error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
|
|
@@ -51055,7 +51062,7 @@ function createTypeChecker(host) {
|
|
|
51055
51062
|
if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
|
|
51056
51063
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
51057
51064
|
const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
51058
|
-
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (
|
|
51065
|
+
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_j = overrideClauseHost.assertions) == null ? void 0 : _j.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
51059
51066
|
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) {
|
|
51060
51067
|
if (findAncestor(location, isImportEqualsDeclaration)) {
|
|
51061
51068
|
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);
|
|
@@ -51162,7 +51169,7 @@ function createTypeChecker(host) {
|
|
|
51162
51169
|
error2(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
51163
51170
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
51164
51171
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
51165
|
-
const suggestedExt = (
|
|
51172
|
+
const suggestedExt = (_k = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _k[1];
|
|
51166
51173
|
if (suggestedExt) {
|
|
51167
51174
|
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);
|
|
51168
51175
|
} else {
|
|
@@ -73836,6 +73843,7 @@ function createTypeChecker(host) {
|
|
|
73836
73843
|
return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode);
|
|
73837
73844
|
}
|
|
73838
73845
|
function checkPropertyAccessibilityAtLocation(location, isSuper, writing, containingType, prop, errorNode) {
|
|
73846
|
+
var _a;
|
|
73839
73847
|
const flags = getDeclarationModifierFlagsFromSymbol(prop, writing);
|
|
73840
73848
|
if (isSuper) {
|
|
73841
73849
|
if (languageVersion < 2 /* ES2015 */) {
|
|
@@ -73852,6 +73860,12 @@ function createTypeChecker(host) {
|
|
|
73852
73860
|
}
|
|
73853
73861
|
return false;
|
|
73854
73862
|
}
|
|
73863
|
+
if (!(flags & 32 /* Static */) && ((_a = prop.declarations) == null ? void 0 : _a.some(isClassFieldAndNotAutoAccessor))) {
|
|
73864
|
+
if (errorNode) {
|
|
73865
|
+
error2(errorNode, Diagnostics.Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super, symbolToString(prop));
|
|
73866
|
+
}
|
|
73867
|
+
return false;
|
|
73868
|
+
}
|
|
73855
73869
|
}
|
|
73856
73870
|
if (flags & 256 /* Abstract */ && symbolHasNonMethodDeclaration(prop) && (isThisProperty(location) || isThisInitializedObjectBindingExpression(location) || isObjectBindingPattern(location.parent) && isThisInitializedDeclaration(location.parent.parent))) {
|
|
73857
73871
|
const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
|
|
@@ -74257,11 +74271,17 @@ function createTypeChecker(host) {
|
|
|
74257
74271
|
return getFlowTypeOfAccessExpression(node, prop, propType, right, checkMode);
|
|
74258
74272
|
}
|
|
74259
74273
|
function isUncheckedJSSuggestion(node, suggestion, excludeClasses) {
|
|
74274
|
+
var _a;
|
|
74260
74275
|
const file = getSourceFileOfNode(node);
|
|
74261
74276
|
if (file) {
|
|
74262
74277
|
if (compilerOptions.checkJs === void 0 && file.checkJsDirective === void 0 && (file.scriptKind === 1 /* JS */ || file.scriptKind === 2 /* JSX */)) {
|
|
74263
74278
|
const declarationFile = forEach(suggestion == null ? void 0 : suggestion.declarations, getSourceFileOfNode);
|
|
74264
|
-
|
|
74279
|
+
const suggestionHasNoExtendsOrDecorators = !(suggestion == null ? void 0 : suggestion.valueDeclaration) || !isClassLike(suggestion.valueDeclaration) || ((_a = suggestion.valueDeclaration.heritageClauses) == null ? void 0 : _a.length) || classOrConstructorParameterIsDecorated(
|
|
74280
|
+
/*useLegacyDecorators*/
|
|
74281
|
+
false,
|
|
74282
|
+
suggestion.valueDeclaration
|
|
74283
|
+
);
|
|
74284
|
+
return !(file !== declarationFile && !!declarationFile && isGlobalSourceFile(declarationFile)) && !(excludeClasses && suggestion && suggestion.flags & 32 /* Class */ && suggestionHasNoExtendsOrDecorators) && !(!!node && excludeClasses && isPropertyAccessExpression(node) && node.expression.kind === 110 /* ThisKeyword */ && suggestionHasNoExtendsOrDecorators);
|
|
74265
74285
|
}
|
|
74266
74286
|
}
|
|
74267
74287
|
return false;
|
|
@@ -114149,6 +114169,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
114149
114169
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
114150
114170
|
extendedDiagnostics: compilerOptions.extendedDiagnostics,
|
|
114151
114171
|
onlyPrintJsDocStyle: true,
|
|
114172
|
+
omitBraceSourceMapPositions: true,
|
|
114152
114173
|
writeBundleFileInfo: !!bundleBuildInfo,
|
|
114153
114174
|
recordInternalSection: !!bundleBuildInfo,
|
|
114154
114175
|
relativeToBuildInfo
|
|
@@ -114559,6 +114580,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114559
114580
|
onAfterEmitToken
|
|
114560
114581
|
} = handlers;
|
|
114561
114582
|
var extendedDiagnostics = !!printerOptions.extendedDiagnostics;
|
|
114583
|
+
var omitBraceSourcePositions = !!printerOptions.omitBraceSourceMapPositions;
|
|
114562
114584
|
var newLine = getNewLineCharacter(printerOptions);
|
|
114563
114585
|
var moduleKind = getEmitModuleKind(printerOptions);
|
|
114564
114586
|
var bundledHelpers = /* @__PURE__ */ new Map();
|
|
@@ -116554,7 +116576,11 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
116554
116576
|
decreaseIndent();
|
|
116555
116577
|
}
|
|
116556
116578
|
}
|
|
116557
|
-
|
|
116579
|
+
if (!omitBraceSourcePositions && (token === 19 /* OpenBraceToken */ || token === 20 /* CloseBraceToken */)) {
|
|
116580
|
+
pos = writeToken(token, pos, writer2, contextNode);
|
|
116581
|
+
} else {
|
|
116582
|
+
pos = writeTokenText(token, writer2, pos);
|
|
116583
|
+
}
|
|
116558
116584
|
if (isSimilarNode && contextNode.end !== pos) {
|
|
116559
116585
|
const isJsxExprContext = contextNode.kind === 294 /* JsxExpression */;
|
|
116560
116586
|
emitTrailingCommentsOfPosition(
|
|
@@ -120327,14 +120353,14 @@ function isReferenceFileLocation(location) {
|
|
|
120327
120353
|
return location.pos !== void 0;
|
|
120328
120354
|
}
|
|
120329
120355
|
function getReferencedFileLocation(program, ref) {
|
|
120330
|
-
var _a, _b, _c, _d
|
|
120356
|
+
var _a, _b, _c, _d;
|
|
120331
120357
|
const file = Debug.checkDefined(program.getSourceFileByPath(ref.file));
|
|
120332
120358
|
const { kind, index } = ref;
|
|
120333
120359
|
let pos, end, packageId, resolutionMode;
|
|
120334
120360
|
switch (kind) {
|
|
120335
120361
|
case 3 /* Import */:
|
|
120336
120362
|
const importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
120337
|
-
packageId = (
|
|
120363
|
+
packageId = (_b = (_a = program.getResolvedModule(file, importLiteral.text, getModeForResolutionAtIndex(file, index))) == null ? void 0 : _a.resolvedModule) == null ? void 0 : _b.packageId;
|
|
120338
120364
|
if (importLiteral.pos === -1)
|
|
120339
120365
|
return { file, packageId, text: importLiteral.text };
|
|
120340
120366
|
pos = skipTrivia(file.text, importLiteral.pos);
|
|
@@ -120345,7 +120371,7 @@ function getReferencedFileLocation(program, ref) {
|
|
|
120345
120371
|
break;
|
|
120346
120372
|
case 5 /* TypeReferenceDirective */:
|
|
120347
120373
|
({ pos, end, resolutionMode } = file.typeReferenceDirectives[index]);
|
|
120348
|
-
packageId = (
|
|
120374
|
+
packageId = (_d = (_c = program.getResolvedTypeReferenceDirective(file, toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), resolutionMode || file.impliedNodeFormat)) == null ? void 0 : _c.resolvedTypeReferenceDirective) == null ? void 0 : _d.packageId;
|
|
120349
120375
|
break;
|
|
120350
120376
|
case 7 /* LibReferenceDirective */:
|
|
120351
120377
|
({ pos, end } = file.libReferenceDirectives[index]);
|
|
@@ -120877,6 +120903,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120877
120903
|
resolvedModules,
|
|
120878
120904
|
resolvedTypeReferenceDirectiveNames,
|
|
120879
120905
|
resolvedLibReferences,
|
|
120906
|
+
getResolvedModule,
|
|
120907
|
+
getResolvedTypeReferenceDirective,
|
|
120908
|
+
forEachResolvedModule,
|
|
120909
|
+
forEachResolvedTypeReferenceDirective,
|
|
120880
120910
|
getCurrentPackagesMap: () => packageMap,
|
|
120881
120911
|
typesPackageExists,
|
|
120882
120912
|
packageBundlesTypes,
|
|
@@ -120920,19 +120950,35 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120920
120950
|
measure("Program", "beforeProgram", "afterProgram");
|
|
120921
120951
|
(_p = tracing) == null ? void 0 : _p.pop();
|
|
120922
120952
|
return program;
|
|
120953
|
+
function getResolvedModule(file, moduleName, mode) {
|
|
120954
|
+
var _a2;
|
|
120955
|
+
return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(file.path)) == null ? void 0 : _a2.get(moduleName, mode);
|
|
120956
|
+
}
|
|
120957
|
+
function getResolvedTypeReferenceDirective(file, typeDirectiveName, mode) {
|
|
120958
|
+
var _a2;
|
|
120959
|
+
return (_a2 = resolvedTypeReferenceDirectiveNames == null ? void 0 : resolvedTypeReferenceDirectiveNames.get(file.path)) == null ? void 0 : _a2.get(typeDirectiveName, mode);
|
|
120960
|
+
}
|
|
120961
|
+
function forEachResolvedModule(callback, file) {
|
|
120962
|
+
forEachResolution(resolvedModules, callback, file);
|
|
120963
|
+
}
|
|
120964
|
+
function forEachResolvedTypeReferenceDirective(callback, file) {
|
|
120965
|
+
forEachResolution(resolvedTypeReferenceDirectiveNames, callback, file);
|
|
120966
|
+
}
|
|
120967
|
+
function forEachResolution(resolutionCache, callback, file) {
|
|
120968
|
+
var _a2;
|
|
120969
|
+
if (file)
|
|
120970
|
+
(_a2 = resolutionCache == null ? void 0 : resolutionCache.get(file.path)) == null ? void 0 : _a2.forEach((resolution, name, mode) => callback(resolution, name, mode, file.path));
|
|
120971
|
+
else
|
|
120972
|
+
resolutionCache == null ? void 0 : resolutionCache.forEach((resolutions, filePath) => resolutions.forEach((resolution, name, mode) => callback(resolution, name, mode, filePath)));
|
|
120973
|
+
}
|
|
120923
120974
|
function getPackagesMap() {
|
|
120924
120975
|
if (packageMap)
|
|
120925
120976
|
return packageMap;
|
|
120926
120977
|
packageMap = /* @__PURE__ */ new Map();
|
|
120927
|
-
|
|
120928
|
-
(
|
|
120929
|
-
|
|
120930
|
-
|
|
120931
|
-
if (resolvedModule == null ? void 0 : resolvedModule.packageId)
|
|
120932
|
-
packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
|
|
120933
|
-
});
|
|
120934
|
-
}
|
|
120935
|
-
);
|
|
120978
|
+
forEachResolvedModule(({ resolvedModule }) => {
|
|
120979
|
+
if (resolvedModule == null ? void 0 : resolvedModule.packageId)
|
|
120980
|
+
packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
|
|
120981
|
+
});
|
|
120936
120982
|
return packageMap;
|
|
120937
120983
|
}
|
|
120938
120984
|
function typesPackageExists(packageName) {
|
|
@@ -121064,7 +121110,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121064
121110
|
return classifiableNames;
|
|
121065
121111
|
}
|
|
121066
121112
|
function resolveModuleNamesReusingOldState(moduleNames, file) {
|
|
121067
|
-
var _a2, _b2;
|
|
121068
121113
|
if (structureIsReused === 0 /* Not */ && !file.ambientModuleNames.length) {
|
|
121069
121114
|
return resolveModuleNamesWorker(
|
|
121070
121115
|
moduleNames,
|
|
@@ -121082,7 +121127,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121082
121127
|
const moduleName = moduleNames[i];
|
|
121083
121128
|
if (file === oldSourceFile && !hasInvalidatedResolutions(file.path)) {
|
|
121084
121129
|
const mode = getModeForUsageLocation(file, moduleName);
|
|
121085
|
-
const oldResolution =
|
|
121130
|
+
const oldResolution = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, mode);
|
|
121086
121131
|
if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
|
|
121087
121132
|
if (isTraceEnabled(options, host)) {
|
|
121088
121133
|
trace(
|
|
@@ -121129,8 +121174,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121129
121174
|
Debug.assert(j === resolutions.length);
|
|
121130
121175
|
return result;
|
|
121131
121176
|
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
|
|
121132
|
-
var
|
|
121133
|
-
const resolutionToFile = (
|
|
121177
|
+
var _a2;
|
|
121178
|
+
const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation(file, moduleName))) == null ? void 0 : _a2.resolvedModule;
|
|
121134
121179
|
const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
121135
121180
|
if (resolutionToFile && resolvedFile) {
|
|
121136
121181
|
return false;
|
|
@@ -121146,7 +121191,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121146
121191
|
}
|
|
121147
121192
|
}
|
|
121148
121193
|
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
121149
|
-
var _a2
|
|
121194
|
+
var _a2;
|
|
121150
121195
|
if (structureIsReused === 0 /* Not */) {
|
|
121151
121196
|
return resolveTypeReferenceDirectiveNamesWorker(
|
|
121152
121197
|
typeDirectiveNames,
|
|
@@ -121166,7 +121211,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121166
121211
|
if (canReuseResolutions) {
|
|
121167
121212
|
const typeDirectiveName = getTypeReferenceResolutionName(entry);
|
|
121168
121213
|
const mode = getModeForFileReference(entry, containingSourceFile == null ? void 0 : containingSourceFile.impliedNodeFormat);
|
|
121169
|
-
const oldResolution =
|
|
121214
|
+
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);
|
|
121170
121215
|
if (oldResolution == null ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
|
|
121171
121216
|
if (isTraceEnabled(options, host)) {
|
|
121172
121217
|
trace(
|
|
@@ -121226,7 +121271,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121226
121271
|
);
|
|
121227
121272
|
}
|
|
121228
121273
|
function tryReuseStructureFromOldProgram() {
|
|
121229
|
-
var _a2
|
|
121274
|
+
var _a2;
|
|
121230
121275
|
if (!oldProgram) {
|
|
121231
121276
|
return 0 /* Not */;
|
|
121232
121277
|
}
|
|
@@ -121346,20 +121391,29 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121346
121391
|
const moduleNames = getModuleNames(newSourceFile);
|
|
121347
121392
|
const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
121348
121393
|
(resolvedModulesProcessing ?? (resolvedModulesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, resolutions);
|
|
121349
|
-
const
|
|
121350
|
-
|
|
121394
|
+
const resolutionsChanged = hasChangesInResolutions(
|
|
121395
|
+
moduleNames,
|
|
121396
|
+
newSourceFile,
|
|
121397
|
+
resolutions,
|
|
121398
|
+
(name, mode) => oldProgram.getResolvedModule(newSourceFile, name, mode),
|
|
121399
|
+
moduleResolutionIsEqualTo,
|
|
121400
|
+
moduleResolutionNameAndModeGetter
|
|
121401
|
+
);
|
|
121351
121402
|
if (resolutionsChanged)
|
|
121352
121403
|
structureIsReused = 1 /* SafeModules */;
|
|
121353
121404
|
const typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
|
|
121354
121405
|
const typeReferenceResolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typesReferenceDirectives, newSourceFile);
|
|
121355
121406
|
(resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, typeReferenceResolutions);
|
|
121356
|
-
const
|
|
121357
|
-
|
|
121358
|
-
|
|
121407
|
+
const typeReferenceResolutionsChanged = hasChangesInResolutions(
|
|
121408
|
+
typesReferenceDirectives,
|
|
121409
|
+
newSourceFile,
|
|
121410
|
+
typeReferenceResolutions,
|
|
121411
|
+
(name, mode) => oldProgram == null ? void 0 : oldProgram.getResolvedTypeReferenceDirective(newSourceFile, name, mode),
|
|
121412
|
+
typeDirectiveIsEqualTo,
|
|
121413
|
+
typeReferenceResolutionNameAndModeGetter
|
|
121414
|
+
);
|
|
121415
|
+
if (typeReferenceResolutionsChanged)
|
|
121359
121416
|
structureIsReused = 1 /* SafeModules */;
|
|
121360
|
-
} else if (oldTypeResolutions) {
|
|
121361
|
-
(resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, oldTypeResolutions);
|
|
121362
|
-
}
|
|
121363
121417
|
}
|
|
121364
121418
|
if (structureIsReused !== 2 /* Completely */) {
|
|
121365
121419
|
return structureIsReused;
|
|
@@ -123506,7 +123560,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123506
123560
|
symlinks = createSymlinkCache(currentDirectory, getCanonicalFileName);
|
|
123507
123561
|
}
|
|
123508
123562
|
if (files && !symlinks.hasProcessedResolutions()) {
|
|
123509
|
-
symlinks.setSymlinksFromResolutions(
|
|
123563
|
+
symlinks.setSymlinksFromResolutions(forEachResolvedModule, forEachResolvedTypeReferenceDirective, automaticTypeDirectiveResolutions);
|
|
123510
123564
|
}
|
|
123511
123565
|
return symlinks;
|
|
123512
123566
|
}
|
|
@@ -123868,7 +123922,6 @@ var BuilderState;
|
|
|
123868
123922
|
return toPath(program.getProjectReferenceRedirect(fileName) || fileName, sourceFileDirectory, getCanonicalFileName);
|
|
123869
123923
|
}
|
|
123870
123924
|
function getReferencedFiles(program, sourceFile, getCanonicalFileName) {
|
|
123871
|
-
var _a;
|
|
123872
123925
|
let referencedFiles;
|
|
123873
123926
|
if (sourceFile.imports && sourceFile.imports.length > 0) {
|
|
123874
123927
|
const checker = program.getTypeChecker();
|
|
@@ -123884,17 +123937,14 @@ var BuilderState;
|
|
|
123884
123937
|
addReferencedFile(referencedPath);
|
|
123885
123938
|
}
|
|
123886
123939
|
}
|
|
123887
|
-
|
|
123888
|
-
|
|
123889
|
-
|
|
123890
|
-
|
|
123891
|
-
|
|
123892
|
-
|
|
123893
|
-
|
|
123894
|
-
|
|
123895
|
-
addReferencedFile(typeFilePath);
|
|
123896
|
-
});
|
|
123897
|
-
}
|
|
123940
|
+
program.forEachResolvedTypeReferenceDirective(({ resolvedTypeReferenceDirective }) => {
|
|
123941
|
+
if (!resolvedTypeReferenceDirective) {
|
|
123942
|
+
return;
|
|
123943
|
+
}
|
|
123944
|
+
const fileName = resolvedTypeReferenceDirective.resolvedFileName;
|
|
123945
|
+
const typeFilePath = getReferencedFileFromFileName(program, fileName, sourceFileDirectory, getCanonicalFileName);
|
|
123946
|
+
addReferencedFile(typeFilePath);
|
|
123947
|
+
}, sourceFile);
|
|
123898
123948
|
if (sourceFile.moduleAugmentations.length) {
|
|
123899
123949
|
const checker = program.getTypeChecker();
|
|
123900
123950
|
for (const moduleName of sourceFile.moduleAugmentations) {
|
|
@@ -125639,6 +125689,47 @@ function getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirec
|
|
|
125639
125689
|
function getRootPathSplitLength(rootPath) {
|
|
125640
125690
|
return rootPath.split(directorySeparator).length - (hasTrailingDirectorySeparator(rootPath) ? 1 : 0);
|
|
125641
125691
|
}
|
|
125692
|
+
function createModuleResolutionLoaderUsingGlobalCache(containingFile, redirectedReference, options, resolutionHost, moduleResolutionCache) {
|
|
125693
|
+
return {
|
|
125694
|
+
nameAndMode: moduleResolutionNameAndModeGetter,
|
|
125695
|
+
resolve: (moduleName, resoluionMode) => resolveModuleNameUsingGlobalCache(
|
|
125696
|
+
resolutionHost,
|
|
125697
|
+
moduleResolutionCache,
|
|
125698
|
+
moduleName,
|
|
125699
|
+
containingFile,
|
|
125700
|
+
options,
|
|
125701
|
+
redirectedReference,
|
|
125702
|
+
resoluionMode
|
|
125703
|
+
)
|
|
125704
|
+
};
|
|
125705
|
+
}
|
|
125706
|
+
function resolveModuleNameUsingGlobalCache(resolutionHost, moduleResolutionCache, moduleName, containingFile, compilerOptions, redirectedReference, mode) {
|
|
125707
|
+
var _a;
|
|
125708
|
+
const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
|
|
125709
|
+
const primaryResult = resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
|
|
125710
|
+
if (!resolutionHost.getGlobalCache) {
|
|
125711
|
+
return primaryResult;
|
|
125712
|
+
}
|
|
125713
|
+
const globalCache = resolutionHost.getGlobalCache();
|
|
125714
|
+
if (globalCache !== void 0 && !isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && extensionIsTS(primaryResult.resolvedModule.extension))) {
|
|
125715
|
+
const { resolvedModule, failedLookupLocations, affectingLocations, resolutionDiagnostics } = loadModuleFromGlobalCache(
|
|
125716
|
+
Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName),
|
|
125717
|
+
resolutionHost.projectName,
|
|
125718
|
+
compilerOptions,
|
|
125719
|
+
host,
|
|
125720
|
+
globalCache,
|
|
125721
|
+
moduleResolutionCache
|
|
125722
|
+
);
|
|
125723
|
+
if (resolvedModule) {
|
|
125724
|
+
primaryResult.resolvedModule = resolvedModule;
|
|
125725
|
+
primaryResult.failedLookupLocations = updateResolutionField(primaryResult.failedLookupLocations, failedLookupLocations);
|
|
125726
|
+
primaryResult.affectingLocations = updateResolutionField(primaryResult.affectingLocations, affectingLocations);
|
|
125727
|
+
primaryResult.resolutionDiagnostics = updateResolutionField(primaryResult.resolutionDiagnostics, resolutionDiagnostics);
|
|
125728
|
+
return primaryResult;
|
|
125729
|
+
}
|
|
125730
|
+
}
|
|
125731
|
+
return primaryResult;
|
|
125732
|
+
}
|
|
125642
125733
|
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
|
|
125643
125734
|
let filesWithChangedSetOfUnresolvedImports;
|
|
125644
125735
|
let filesWithInvalidatedResolutions;
|
|
@@ -125685,6 +125776,16 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125685
125776
|
const rootPathComponents = getPathComponents(rootPath);
|
|
125686
125777
|
const typeRootsWatches = /* @__PURE__ */ new Map();
|
|
125687
125778
|
return {
|
|
125779
|
+
rootDirForResolution,
|
|
125780
|
+
resolvedModuleNames,
|
|
125781
|
+
resolvedTypeReferenceDirectives,
|
|
125782
|
+
resolvedLibraries,
|
|
125783
|
+
resolvedFileToResolution,
|
|
125784
|
+
resolutionsWithFailedLookups,
|
|
125785
|
+
resolutionsWithOnlyAffectingLocations,
|
|
125786
|
+
directoryWatchesOfFailedLookups,
|
|
125787
|
+
fileWatchesOfAffectingLocations,
|
|
125788
|
+
watchFailedLookupLocationsOfExternalModuleResolutions,
|
|
125688
125789
|
getModuleResolutionCache: () => moduleResolutionCache,
|
|
125689
125790
|
startRecordingFilesWithChangedResolutions,
|
|
125690
125791
|
finishRecordingFilesWithChangedResolutions,
|
|
@@ -125787,7 +125888,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125787
125888
|
if (!((_a = newProgram == null ? void 0 : newProgram.resolvedLibReferences) == null ? void 0 : _a.has(libFileName))) {
|
|
125788
125889
|
stopWatchFailedLookupLocationOfResolution(
|
|
125789
125890
|
resolution,
|
|
125790
|
-
resolutionHost.toPath(getInferredLibraryNameResolveFrom(
|
|
125891
|
+
resolutionHost.toPath(getInferredLibraryNameResolveFrom(resolutionHost.getCompilationSettings(), getCurrentDirectory(), libFileName)),
|
|
125791
125892
|
getResolvedModule
|
|
125792
125893
|
);
|
|
125793
125894
|
resolvedLibraries.delete(libFileName);
|
|
@@ -125829,58 +125930,22 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125829
125930
|
}
|
|
125830
125931
|
});
|
|
125831
125932
|
}
|
|
125832
|
-
directoryWatchesOfFailedLookups.forEach(
|
|
125833
|
-
|
|
125834
|
-
directoryWatchesOfFailedLookups.delete(path);
|
|
125835
|
-
watcher.watcher.close();
|
|
125836
|
-
}
|
|
125837
|
-
});
|
|
125838
|
-
fileWatchesOfAffectingLocations.forEach((watcher, path) => {
|
|
125839
|
-
if (watcher.files === 0 && watcher.resolutions === 0) {
|
|
125840
|
-
fileWatchesOfAffectingLocations.delete(path);
|
|
125841
|
-
watcher.watcher.close();
|
|
125842
|
-
}
|
|
125843
|
-
});
|
|
125933
|
+
directoryWatchesOfFailedLookups.forEach(closeDirectoryWatchesOfFailedLookup);
|
|
125934
|
+
fileWatchesOfAffectingLocations.forEach(closeFileWatcherOfAffectingLocation);
|
|
125844
125935
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
125845
125936
|
}
|
|
125846
|
-
function
|
|
125847
|
-
|
|
125848
|
-
|
|
125849
|
-
|
|
125850
|
-
if (!resolutionHost.getGlobalCache) {
|
|
125851
|
-
return primaryResult;
|
|
125852
|
-
}
|
|
125853
|
-
const globalCache = resolutionHost.getGlobalCache();
|
|
125854
|
-
if (globalCache !== void 0 && !isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && extensionIsTS(primaryResult.resolvedModule.extension))) {
|
|
125855
|
-
const { resolvedModule, failedLookupLocations, affectingLocations, resolutionDiagnostics } = loadModuleFromGlobalCache(
|
|
125856
|
-
Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName),
|
|
125857
|
-
resolutionHost.projectName,
|
|
125858
|
-
compilerOptions,
|
|
125859
|
-
host,
|
|
125860
|
-
globalCache,
|
|
125861
|
-
moduleResolutionCache
|
|
125862
|
-
);
|
|
125863
|
-
if (resolvedModule) {
|
|
125864
|
-
primaryResult.resolvedModule = resolvedModule;
|
|
125865
|
-
primaryResult.failedLookupLocations = updateResolutionField(primaryResult.failedLookupLocations, failedLookupLocations);
|
|
125866
|
-
primaryResult.affectingLocations = updateResolutionField(primaryResult.affectingLocations, affectingLocations);
|
|
125867
|
-
primaryResult.resolutionDiagnostics = updateResolutionField(primaryResult.resolutionDiagnostics, resolutionDiagnostics);
|
|
125868
|
-
return primaryResult;
|
|
125869
|
-
}
|
|
125937
|
+
function closeDirectoryWatchesOfFailedLookup(watcher, path) {
|
|
125938
|
+
if (watcher.refCount === 0) {
|
|
125939
|
+
directoryWatchesOfFailedLookups.delete(path);
|
|
125940
|
+
watcher.watcher.close();
|
|
125870
125941
|
}
|
|
125871
|
-
return primaryResult;
|
|
125872
125942
|
}
|
|
125873
|
-
function
|
|
125874
|
-
|
|
125875
|
-
|
|
125876
|
-
|
|
125877
|
-
|
|
125878
|
-
|
|
125879
|
-
options,
|
|
125880
|
-
redirectedReference,
|
|
125881
|
-
resoluionMode
|
|
125882
|
-
)
|
|
125883
|
-
};
|
|
125943
|
+
function closeFileWatcherOfAffectingLocation(watcher, path) {
|
|
125944
|
+
var _a;
|
|
125945
|
+
if (watcher.files === 0 && watcher.resolutions === 0 && !((_a = watcher.symlinks) == null ? void 0 : _a.size)) {
|
|
125946
|
+
fileWatchesOfAffectingLocations.delete(path);
|
|
125947
|
+
watcher.watcher.close();
|
|
125948
|
+
}
|
|
125884
125949
|
}
|
|
125885
125950
|
function resolveNamesWithLocalCache({
|
|
125886
125951
|
entries,
|
|
@@ -125917,9 +125982,11 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125917
125982
|
resolutionHost.onDiscoveredSymlink();
|
|
125918
125983
|
}
|
|
125919
125984
|
resolutionsInFile.set(name, mode, resolution);
|
|
125920
|
-
|
|
125921
|
-
|
|
125922
|
-
|
|
125985
|
+
if (resolution !== existingResolution) {
|
|
125986
|
+
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution);
|
|
125987
|
+
if (existingResolution) {
|
|
125988
|
+
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName);
|
|
125989
|
+
}
|
|
125923
125990
|
}
|
|
125924
125991
|
if (logChanges && filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) {
|
|
125925
125992
|
filesWithChangedSetOfUnresolvedImports.push(path);
|
|
@@ -126008,10 +126075,12 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126008
126075
|
options,
|
|
126009
126076
|
reusedNames,
|
|
126010
126077
|
perFileCache: resolvedModuleNames,
|
|
126011
|
-
loader:
|
|
126078
|
+
loader: createModuleResolutionLoaderUsingGlobalCache(
|
|
126012
126079
|
containingFile,
|
|
126013
126080
|
redirectedReference,
|
|
126014
|
-
options
|
|
126081
|
+
options,
|
|
126082
|
+
resolutionHost,
|
|
126083
|
+
moduleResolutionCache
|
|
126015
126084
|
),
|
|
126016
126085
|
getResolutionWithResolvedFileName: getResolvedModule,
|
|
126017
126086
|
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|
|
@@ -126065,7 +126134,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126065
126134
|
);
|
|
126066
126135
|
if (resolution && !resolution.isInvalidated)
|
|
126067
126136
|
return resolution;
|
|
126068
|
-
return
|
|
126137
|
+
return resolveModuleNameUsingGlobalCache(resolutionHost, moduleResolutionCache, moduleName, containingFile, resolutionHost.getCompilationSettings());
|
|
126069
126138
|
}
|
|
126070
126139
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
126071
126140
|
return endsWith(dirPath, "/node_modules/@types");
|
|
@@ -126165,52 +126234,63 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126165
126234
|
return;
|
|
126166
126235
|
}
|
|
126167
126236
|
let locationToWatch = affectingLocation;
|
|
126237
|
+
let isSymlink = false;
|
|
126238
|
+
let symlinkWatcher;
|
|
126168
126239
|
if (resolutionHost.realpath) {
|
|
126169
126240
|
locationToWatch = resolutionHost.realpath(affectingLocation);
|
|
126170
126241
|
if (affectingLocation !== locationToWatch) {
|
|
126171
|
-
|
|
126172
|
-
|
|
126173
|
-
|
|
126174
|
-
|
|
126175
|
-
|
|
126176
|
-
|
|
126177
|
-
|
|
126178
|
-
|
|
126179
|
-
|
|
126180
|
-
|
|
126181
|
-
|
|
126242
|
+
isSymlink = true;
|
|
126243
|
+
symlinkWatcher = fileWatchesOfAffectingLocations.get(locationToWatch);
|
|
126244
|
+
}
|
|
126245
|
+
}
|
|
126246
|
+
const resolutions = forResolution ? 1 : 0;
|
|
126247
|
+
const files = forResolution ? 0 : 1;
|
|
126248
|
+
if (!isSymlink || !symlinkWatcher) {
|
|
126249
|
+
const watcher = {
|
|
126250
|
+
watcher: canWatchAffectingLocation(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
|
|
126251
|
+
cachedDirectoryStructureHost == null ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
|
|
126252
|
+
invalidateAffectingFileWatcher(locationToWatch, moduleResolutionCache.getPackageJsonInfoCache().getInternalMap());
|
|
126253
|
+
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
126254
|
+
}) : noopFileWatcher,
|
|
126255
|
+
resolutions: isSymlink ? 0 : resolutions,
|
|
126256
|
+
files: isSymlink ? 0 : files,
|
|
126257
|
+
symlinks: void 0
|
|
126258
|
+
};
|
|
126259
|
+
fileWatchesOfAffectingLocations.set(locationToWatch, watcher);
|
|
126260
|
+
if (isSymlink)
|
|
126261
|
+
symlinkWatcher = watcher;
|
|
126182
126262
|
}
|
|
126183
|
-
|
|
126184
|
-
|
|
126185
|
-
|
|
126186
|
-
|
|
126187
|
-
|
|
126188
|
-
|
|
126189
|
-
|
|
126190
|
-
|
|
126191
|
-
|
|
126192
|
-
|
|
126193
|
-
|
|
126194
|
-
|
|
126195
|
-
|
|
126196
|
-
|
|
126197
|
-
|
|
126198
|
-
|
|
126199
|
-
|
|
126200
|
-
actualWatcher.close();
|
|
126201
|
-
actualWatcher = noopFileWatcher;
|
|
126202
|
-
}
|
|
126203
|
-
} : actualWatcher,
|
|
126204
|
-
resolutions: forResolution ? 1 : 0,
|
|
126205
|
-
files: forResolution ? 0 : 1,
|
|
126206
|
-
paths
|
|
126207
|
-
};
|
|
126208
|
-
fileWatchesOfAffectingLocations.set(locationToWatch, watcher);
|
|
126209
|
-
if (affectingLocation !== locationToWatch) {
|
|
126263
|
+
if (isSymlink) {
|
|
126264
|
+
Debug.assert(!!symlinkWatcher);
|
|
126265
|
+
const watcher = {
|
|
126266
|
+
watcher: {
|
|
126267
|
+
close: () => {
|
|
126268
|
+
var _a;
|
|
126269
|
+
const symlinkWatcher2 = fileWatchesOfAffectingLocations.get(locationToWatch);
|
|
126270
|
+
if (((_a = symlinkWatcher2 == null ? void 0 : symlinkWatcher2.symlinks) == null ? void 0 : _a.delete(affectingLocation)) && !symlinkWatcher2.symlinks.size && !symlinkWatcher2.resolutions && !symlinkWatcher2.files) {
|
|
126271
|
+
fileWatchesOfAffectingLocations.delete(locationToWatch);
|
|
126272
|
+
symlinkWatcher2.watcher.close();
|
|
126273
|
+
}
|
|
126274
|
+
}
|
|
126275
|
+
},
|
|
126276
|
+
resolutions,
|
|
126277
|
+
files,
|
|
126278
|
+
symlinks: void 0
|
|
126279
|
+
};
|
|
126210
126280
|
fileWatchesOfAffectingLocations.set(affectingLocation, watcher);
|
|
126211
|
-
|
|
126281
|
+
(symlinkWatcher.symlinks ?? (symlinkWatcher.symlinks = /* @__PURE__ */ new Set())).add(affectingLocation);
|
|
126212
126282
|
}
|
|
126213
126283
|
}
|
|
126284
|
+
function invalidateAffectingFileWatcher(path, packageJsonMap) {
|
|
126285
|
+
var _a;
|
|
126286
|
+
const watcher = fileWatchesOfAffectingLocations.get(path);
|
|
126287
|
+
if (watcher == null ? void 0 : watcher.resolutions)
|
|
126288
|
+
(affectingPathChecks ?? (affectingPathChecks = /* @__PURE__ */ new Set())).add(path);
|
|
126289
|
+
if (watcher == null ? void 0 : watcher.files)
|
|
126290
|
+
(affectingPathChecksForFile ?? (affectingPathChecksForFile = /* @__PURE__ */ new Set())).add(path);
|
|
126291
|
+
(_a = watcher == null ? void 0 : watcher.symlinks) == null ? void 0 : _a.forEach((path2) => invalidateAffectingFileWatcher(path2, packageJsonMap));
|
|
126292
|
+
packageJsonMap == null ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path));
|
|
126293
|
+
}
|
|
126214
126294
|
function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
|
|
126215
126295
|
const program = resolutionHost.getCurrentProgram();
|
|
126216
126296
|
if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
|
|
@@ -126232,7 +126312,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126232
126312
|
directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive });
|
|
126233
126313
|
}
|
|
126234
126314
|
}
|
|
126235
|
-
function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot) {
|
|
126315
|
+
function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot, syncDirWatcherRemove) {
|
|
126236
126316
|
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
126237
126317
|
const toWatch = getDirectoryToWatchFailedLookupLocation(
|
|
126238
126318
|
failedLookupLocation,
|
|
@@ -126247,12 +126327,12 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126247
126327
|
if (dirPath === rootPath) {
|
|
126248
126328
|
removeAtRoot = true;
|
|
126249
126329
|
} else {
|
|
126250
|
-
removeDirectoryWatcher(dirPath);
|
|
126330
|
+
removeDirectoryWatcher(dirPath, syncDirWatcherRemove);
|
|
126251
126331
|
}
|
|
126252
126332
|
}
|
|
126253
126333
|
return removeAtRoot;
|
|
126254
126334
|
}
|
|
126255
|
-
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
|
|
126335
|
+
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName, syncDirWatcherRemove) {
|
|
126256
126336
|
Debug.checkDefined(resolution.files).delete(filePath);
|
|
126257
126337
|
resolution.refCount--;
|
|
126258
126338
|
if (resolution.refCount) {
|
|
@@ -126270,13 +126350,13 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126270
126350
|
let removeAtRoot = false;
|
|
126271
126351
|
if (failedLookupLocations) {
|
|
126272
126352
|
for (const failedLookupLocation of failedLookupLocations) {
|
|
126273
|
-
removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot);
|
|
126353
|
+
removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot, syncDirWatcherRemove);
|
|
126274
126354
|
}
|
|
126275
126355
|
}
|
|
126276
126356
|
if (node10Result)
|
|
126277
|
-
removeAtRoot = stopWatchFailedLookupLocation(node10Result, removeAtRoot);
|
|
126357
|
+
removeAtRoot = stopWatchFailedLookupLocation(node10Result, removeAtRoot, syncDirWatcherRemove);
|
|
126278
126358
|
if (removeAtRoot)
|
|
126279
|
-
removeDirectoryWatcher(rootPath);
|
|
126359
|
+
removeDirectoryWatcher(rootPath, syncDirWatcherRemove);
|
|
126280
126360
|
} else if (affectingLocations == null ? void 0 : affectingLocations.length) {
|
|
126281
126361
|
resolutionsWithOnlyAffectingLocations.delete(resolution);
|
|
126282
126362
|
}
|
|
@@ -126284,12 +126364,16 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126284
126364
|
for (const affectingLocation of affectingLocations) {
|
|
126285
126365
|
const watcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
126286
126366
|
watcher.resolutions--;
|
|
126367
|
+
if (syncDirWatcherRemove)
|
|
126368
|
+
closeFileWatcherOfAffectingLocation(watcher, affectingLocation);
|
|
126287
126369
|
}
|
|
126288
126370
|
}
|
|
126289
126371
|
}
|
|
126290
|
-
function removeDirectoryWatcher(dirPath) {
|
|
126372
|
+
function removeDirectoryWatcher(dirPath, syncDirWatcherRemove) {
|
|
126291
126373
|
const dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
126292
126374
|
dirWatcher.refCount--;
|
|
126375
|
+
if (syncDirWatcherRemove)
|
|
126376
|
+
closeDirectoryWatchesOfFailedLookup(dirWatcher, dirPath);
|
|
126293
126377
|
}
|
|
126294
126378
|
function createDirectoryWatcher(directory, dirPath, nonRecursive) {
|
|
126295
126379
|
return resolutionHost.watchDirectoryOfFailedLookupLocation(directory, (fileOrDirectory) => {
|
|
@@ -126300,10 +126384,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126300
126384
|
scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
|
|
126301
126385
|
}, nonRecursive ? 0 /* None */ : 1 /* Recursive */);
|
|
126302
126386
|
}
|
|
126303
|
-
function removeResolutionsOfFileFromCache(cache, filePath, getResolutionWithResolvedFileName) {
|
|
126387
|
+
function removeResolutionsOfFileFromCache(cache, filePath, getResolutionWithResolvedFileName, syncDirWatcherRemove) {
|
|
126304
126388
|
const resolutions = cache.get(filePath);
|
|
126305
126389
|
if (resolutions) {
|
|
126306
|
-
resolutions.forEach(
|
|
126390
|
+
resolutions.forEach(
|
|
126391
|
+
(resolution) => stopWatchFailedLookupLocationOfResolution(
|
|
126392
|
+
resolution,
|
|
126393
|
+
filePath,
|
|
126394
|
+
getResolutionWithResolvedFileName,
|
|
126395
|
+
syncDirWatcherRemove
|
|
126396
|
+
)
|
|
126397
|
+
);
|
|
126307
126398
|
cache.delete(filePath);
|
|
126308
126399
|
}
|
|
126309
126400
|
}
|
|
@@ -126318,9 +126409,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126318
126409
|
return;
|
|
126319
126410
|
resolvedProjectReference.commandLine.fileNames.forEach((f) => removeResolutionsOfFile(resolutionHost.toPath(f)));
|
|
126320
126411
|
}
|
|
126321
|
-
function removeResolutionsOfFile(filePath) {
|
|
126322
|
-
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule);
|
|
126323
|
-
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective);
|
|
126412
|
+
function removeResolutionsOfFile(filePath, syncDirWatcherRemove) {
|
|
126413
|
+
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule, syncDirWatcherRemove);
|
|
126414
|
+
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective, syncDirWatcherRemove);
|
|
126324
126415
|
}
|
|
126325
126416
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
126326
126417
|
if (!resolutions)
|
|
@@ -127307,7 +127398,7 @@ function createWatchProgram(host) {
|
|
|
127307
127398
|
watchConfigFileWildCardDirectories();
|
|
127308
127399
|
if (configFileName)
|
|
127309
127400
|
updateExtendedConfigFilesWatches(toPath3(configFileName), compilerOptions, watchOptions, WatchType.ExtendedConfigFile);
|
|
127310
|
-
return configFileName ? { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, close } : { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, updateRootFileNames, close };
|
|
127401
|
+
return configFileName ? { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, close, getResolutionCache } : { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, updateRootFileNames, close, getResolutionCache };
|
|
127311
127402
|
function close() {
|
|
127312
127403
|
clearInvalidateResolutionsOfFailedLookupLocations();
|
|
127313
127404
|
resolutionCache.clear();
|
|
@@ -127347,6 +127438,9 @@ function createWatchProgram(host) {
|
|
|
127347
127438
|
parsedConfigs = void 0;
|
|
127348
127439
|
}
|
|
127349
127440
|
}
|
|
127441
|
+
function getResolutionCache() {
|
|
127442
|
+
return resolutionCache;
|
|
127443
|
+
}
|
|
127350
127444
|
function getCurrentBuilderProgram() {
|
|
127351
127445
|
return builderProgram;
|
|
127352
127446
|
}
|
|
@@ -132717,7 +132811,7 @@ function indexInTextChange(change, name) {
|
|
|
132717
132811
|
return idx === -1 ? -1 : idx + 1;
|
|
132718
132812
|
}
|
|
132719
132813
|
function needsParentheses(expression) {
|
|
132720
|
-
return isBinaryExpression(expression) && expression.operatorToken.kind === 28 /* CommaToken */ || isObjectLiteralExpression(expression) || isAsExpression(expression) && isObjectLiteralExpression(expression.expression);
|
|
132814
|
+
return isBinaryExpression(expression) && expression.operatorToken.kind === 28 /* CommaToken */ || isObjectLiteralExpression(expression) || (isAsExpression(expression) || isSatisfiesExpression(expression)) && isObjectLiteralExpression(expression.expression);
|
|
132721
132815
|
}
|
|
132722
132816
|
function getContextualTypeFromParent(node, checker, contextFlags) {
|
|
132723
132817
|
const parent2 = walkUpParenthesizedExpressions(node.parent);
|
|
@@ -135432,14 +135526,13 @@ function combinePathsSafe(pathA, pathB) {
|
|
|
135432
135526
|
return ensurePathIsNonModuleName(combineNormal(pathA, pathB));
|
|
135433
135527
|
}
|
|
135434
135528
|
function getSourceFileToImport(importedModuleSymbol, importLiteral, importingSourceFile, program, host, oldToNew) {
|
|
135435
|
-
var _a, _b;
|
|
135436
135529
|
if (importedModuleSymbol) {
|
|
135437
135530
|
const oldFileName = find(importedModuleSymbol.declarations, isSourceFile).fileName;
|
|
135438
135531
|
const newFileName = oldToNew(oldFileName);
|
|
135439
135532
|
return newFileName === void 0 ? { newFileName: oldFileName, updated: false } : { newFileName, updated: true };
|
|
135440
135533
|
} else {
|
|
135441
135534
|
const mode = getModeForUsageLocation(importingSourceFile, importLiteral);
|
|
135442
|
-
const resolved = host.resolveModuleNameLiterals || !host.resolveModuleNames ?
|
|
135535
|
+
const resolved = host.resolveModuleNameLiterals || !host.resolveModuleNames ? program.getResolvedModule(importingSourceFile, importLiteral.text, mode) : host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode);
|
|
135443
135536
|
return getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, program.getSourceFiles());
|
|
135444
135537
|
}
|
|
135445
135538
|
}
|
|
@@ -136334,7 +136427,7 @@ function createSourceFileLike(text, lineMap) {
|
|
|
136334
136427
|
// src/services/suggestionDiagnostics.ts
|
|
136335
136428
|
var visitedNestedConvertibleFunctions = /* @__PURE__ */ new Map();
|
|
136336
136429
|
function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
|
|
136337
|
-
var _a
|
|
136430
|
+
var _a;
|
|
136338
136431
|
program.getSemanticDiagnostics(sourceFile, cancellationToken);
|
|
136339
136432
|
const diags = [];
|
|
136340
136433
|
const checker = program.getTypeChecker();
|
|
@@ -136351,7 +136444,7 @@ function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
|
|
|
136351
136444
|
const name = importNameForConvertToDefaultImport(importNode);
|
|
136352
136445
|
if (!name)
|
|
136353
136446
|
continue;
|
|
136354
|
-
const module2 = (
|
|
136447
|
+
const module2 = (_a = program.getResolvedModule(sourceFile, moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier))) == null ? void 0 : _a.resolvedModule;
|
|
136355
136448
|
const resolvedFile = module2 && program.getSourceFile(module2.resolvedFileName);
|
|
136356
136449
|
if (resolvedFile && resolvedFile.externalModuleIndicator && resolvedFile.externalModuleIndicator !== true && isExportAssignment(resolvedFile.externalModuleIndicator) && resolvedFile.externalModuleIndicator.isExportEquals) {
|
|
136357
136450
|
diags.push(createDiagnosticForNode(name, Diagnostics.Import_may_be_converted_to_a_default_import));
|
|
@@ -138755,10 +138848,10 @@ function getTargetFileImportsAndAddExportInOldFile(oldFile, targetFile, importsT
|
|
|
138755
138848
|
const targetSourceFile = program.getSourceFile(targetFile);
|
|
138756
138849
|
for (const oldStatement of oldFile.statements) {
|
|
138757
138850
|
forEachImportInStatement(oldStatement, (i) => {
|
|
138758
|
-
var _a
|
|
138851
|
+
var _a;
|
|
138759
138852
|
const moduleSpecifier = moduleSpecifierFromImport(i);
|
|
138760
|
-
const resolved =
|
|
138761
|
-
const fileName = (
|
|
138853
|
+
const resolved = program.getResolvedModule(oldFile, moduleSpecifier.text, getModeForUsageLocation(oldFile, moduleSpecifier));
|
|
138854
|
+
const fileName = (_a = resolved == null ? void 0 : resolved.resolvedModule) == null ? void 0 : _a.resolvedFileName;
|
|
138762
138855
|
if (fileName && targetSourceFile) {
|
|
138763
138856
|
const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), targetSourceFile, targetSourceFile.path, fileName, createModuleSpecifierResolutionHost(program, host));
|
|
138764
138857
|
append(copiedOldImports, filterImport(i, makeStringLiteral(newModuleSpecifier, quotePreference), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
|
|
@@ -139889,7 +139982,12 @@ function getConvertibleArrowFunctionAtPosition(file, startPosition, considerFunc
|
|
|
139889
139982
|
} else if (refactorKindBeginsWith(removeBracesAction.kind, kind) && isBlock(func.body) && func.body.statements.length === 1) {
|
|
139890
139983
|
const firstStatement = first(func.body.statements);
|
|
139891
139984
|
if (isReturnStatement(firstStatement)) {
|
|
139892
|
-
|
|
139985
|
+
const expression = firstStatement.expression && isObjectLiteralExpression(getLeftmostExpression(
|
|
139986
|
+
firstStatement.expression,
|
|
139987
|
+
/*stopAtCallExpressions*/
|
|
139988
|
+
false
|
|
139989
|
+
)) ? factory.createParenthesizedExpression(firstStatement.expression) : firstStatement.expression;
|
|
139990
|
+
return { func, addBraces: false, expression, returnStatement: firstStatement };
|
|
139893
139991
|
}
|
|
139894
139992
|
}
|
|
139895
139993
|
return void 0;
|
|
@@ -149051,9 +149149,9 @@ registerCodeFix({
|
|
|
149051
149149
|
}
|
|
149052
149150
|
});
|
|
149053
149151
|
function fixImportOfModuleExports(importingFile, exportingFile, program, changes, quotePreference) {
|
|
149054
|
-
var _a
|
|
149152
|
+
var _a;
|
|
149055
149153
|
for (const moduleSpecifier of importingFile.imports) {
|
|
149056
|
-
const imported = (
|
|
149154
|
+
const imported = (_a = program.getResolvedModule(importingFile, moduleSpecifier.text, getModeForUsageLocation(importingFile, moduleSpecifier))) == null ? void 0 : _a.resolvedModule;
|
|
149057
149155
|
if (!imported || imported.resolvedFileName !== exportingFile.fileName) {
|
|
149058
149156
|
continue;
|
|
149059
149157
|
}
|
|
@@ -151174,11 +151272,11 @@ function promoteFromTypeOnly(changes, aliasDeclaration, program, sourceFile, pre
|
|
|
151174
151272
|
Debug.failBadSyntaxKind(aliasDeclaration);
|
|
151175
151273
|
}
|
|
151176
151274
|
function promoteImportClause(importClause) {
|
|
151177
|
-
var _a
|
|
151275
|
+
var _a;
|
|
151178
151276
|
changes.delete(sourceFile, getTypeKeywordOfTypeOnlyImport(importClause, sourceFile));
|
|
151179
151277
|
if (!compilerOptions.allowImportingTsExtensions) {
|
|
151180
151278
|
const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(importClause.parent);
|
|
151181
|
-
const resolvedModule = moduleSpecifier && ((
|
|
151279
|
+
const resolvedModule = moduleSpecifier && ((_a = program.getResolvedModule(sourceFile, moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier))) == null ? void 0 : _a.resolvedModule);
|
|
151182
151280
|
if (resolvedModule == null ? void 0 : resolvedModule.resolvedUsingTsExtension) {
|
|
151183
151281
|
const changedExtension = changeAnyExtension(moduleSpecifier.text, getOutputExtension(moduleSpecifier.text, compilerOptions));
|
|
151184
151282
|
changes.replaceNode(sourceFile, moduleSpecifier, factory.createStringLiteral(changedExtension));
|
|
@@ -151846,7 +151944,7 @@ registerCodeFix({
|
|
|
151846
151944
|
}
|
|
151847
151945
|
});
|
|
151848
151946
|
function getInfo7(sourceFile, pos, program) {
|
|
151849
|
-
var _a, _b
|
|
151947
|
+
var _a, _b;
|
|
151850
151948
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
151851
151949
|
if (isIdentifier(token)) {
|
|
151852
151950
|
const importDeclaration = findAncestor(token, isImportDeclaration);
|
|
@@ -151855,18 +151953,19 @@ function getInfo7(sourceFile, pos, program) {
|
|
|
151855
151953
|
const moduleSpecifier = isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier.text : void 0;
|
|
151856
151954
|
if (moduleSpecifier === void 0)
|
|
151857
151955
|
return void 0;
|
|
151858
|
-
const resolvedModule = (
|
|
151956
|
+
const resolvedModule = (_a = program.getResolvedModule(
|
|
151957
|
+
sourceFile,
|
|
151859
151958
|
moduleSpecifier,
|
|
151860
151959
|
/*mode*/
|
|
151861
151960
|
void 0
|
|
151862
|
-
)) == null ? void 0 :
|
|
151961
|
+
)) == null ? void 0 : _a.resolvedModule;
|
|
151863
151962
|
if (resolvedModule === void 0)
|
|
151864
151963
|
return void 0;
|
|
151865
151964
|
const moduleSourceFile = program.getSourceFile(resolvedModule.resolvedFileName);
|
|
151866
151965
|
if (moduleSourceFile === void 0 || isSourceFileFromLibrary(program, moduleSourceFile))
|
|
151867
151966
|
return void 0;
|
|
151868
151967
|
const moduleSymbol = moduleSourceFile.symbol;
|
|
151869
|
-
const locals = (
|
|
151968
|
+
const locals = (_b = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _b.locals;
|
|
151870
151969
|
if (locals === void 0)
|
|
151871
151970
|
return void 0;
|
|
151872
151971
|
const localSymbol = locals.get(token.escapedText);
|
|
@@ -152121,10 +152220,10 @@ function convertSemanticMeaningToSymbolFlags(meaning) {
|
|
|
152121
152220
|
return flags;
|
|
152122
152221
|
}
|
|
152123
152222
|
function getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration) {
|
|
152124
|
-
var _a
|
|
152223
|
+
var _a;
|
|
152125
152224
|
if (!importDeclaration || !isStringLiteralLike(importDeclaration.moduleSpecifier))
|
|
152126
152225
|
return void 0;
|
|
152127
|
-
const resolvedModule = (
|
|
152226
|
+
const resolvedModule = (_a = context.program.getResolvedModule(sourceFile, importDeclaration.moduleSpecifier.text, getModeForUsageLocation(sourceFile, importDeclaration.moduleSpecifier))) == null ? void 0 : _a.resolvedModule;
|
|
152128
152227
|
if (!resolvedModule)
|
|
152129
152228
|
return void 0;
|
|
152130
152229
|
return context.program.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -162928,7 +163027,7 @@ function declarationIsWriteAccess(decl) {
|
|
|
162928
163027
|
var Core;
|
|
162929
163028
|
((Core2) => {
|
|
162930
163029
|
function getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options = {}, sourceFilesSet = new Set(sourceFiles.map((f) => f.fileName))) {
|
|
162931
|
-
var _a, _b
|
|
163030
|
+
var _a, _b;
|
|
162932
163031
|
node = getAdjustedNode2(node, options);
|
|
162933
163032
|
if (isSourceFile(node)) {
|
|
162934
163033
|
const resolvedRef = ts_GoToDefinition_exports.getReferenceAtPosition(node, position, program);
|
|
@@ -162967,7 +163066,7 @@ var Core;
|
|
|
162967
163066
|
if (!options.implementations && isStringLiteralLike(node)) {
|
|
162968
163067
|
if (isModuleSpecifierLike(node)) {
|
|
162969
163068
|
const fileIncludeReasons = program.getFileIncludeReasons();
|
|
162970
|
-
const referencedFileName = (
|
|
163069
|
+
const referencedFileName = (_b = (_a = program.getResolvedModule(node.getSourceFile(), node.text, getModeForUsageLocation(node.getSourceFile(), node))) == null ? void 0 : _a.resolvedModule) == null ? void 0 : _b.resolvedFileName;
|
|
162971
163070
|
const referencedFile = referencedFileName ? program.getSourceFile(referencedFileName) : void 0;
|
|
162972
163071
|
if (referencedFile) {
|
|
162973
163072
|
return [{ definition: { type: 4 /* String */, node }, references: getReferencesForNonModule(referencedFile, fileIncludeReasons, program) || emptyArray }];
|
|
@@ -164370,7 +164469,7 @@ __export(ts_GoToDefinition_exports, {
|
|
|
164370
164469
|
|
|
164371
164470
|
// src/services/goToDefinition.ts
|
|
164372
164471
|
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly, stopAtAlias) {
|
|
164373
|
-
var _a
|
|
164472
|
+
var _a;
|
|
164374
164473
|
const resolvedRef = getReferenceAtPosition(sourceFile, position, program);
|
|
164375
164474
|
const fileReferenceDefinition = resolvedRef && [getDefinitionInfoForFileReference(resolvedRef.reference.fileName, resolvedRef.fileName, resolvedRef.unverified)] || emptyArray;
|
|
164376
164475
|
if (resolvedRef == null ? void 0 : resolvedRef.file) {
|
|
@@ -164443,7 +164542,7 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
|
|
|
164443
164542
|
}
|
|
164444
164543
|
}
|
|
164445
164544
|
if (!symbol && isModuleSpecifierLike(fallbackNode)) {
|
|
164446
|
-
const ref = (
|
|
164545
|
+
const ref = (_a = program.getResolvedModule(sourceFile, fallbackNode.text, getModeForUsageLocation(sourceFile, fallbackNode))) == null ? void 0 : _a.resolvedModule;
|
|
164447
164546
|
if (ref) {
|
|
164448
164547
|
return [{
|
|
164449
164548
|
name: fallbackNode.text,
|
|
@@ -164538,7 +164637,7 @@ function getDefinitionFromOverriddenMember(typeChecker, node) {
|
|
|
164538
164637
|
return getDefinitionFromSymbol(typeChecker, symbol, node);
|
|
164539
164638
|
}
|
|
164540
164639
|
function getReferenceAtPosition(sourceFile, position, program) {
|
|
164541
|
-
var _a, _b
|
|
164640
|
+
var _a, _b;
|
|
164542
164641
|
const referencePath = findReferenceInPosition(sourceFile.referencedFiles, position);
|
|
164543
164642
|
if (referencePath) {
|
|
164544
164643
|
const file = program.getSourceFileFromReference(sourceFile, referencePath);
|
|
@@ -164555,11 +164654,11 @@ function getReferenceAtPosition(sourceFile, position, program) {
|
|
|
164555
164654
|
const file = program.getLibFileFromReference(libReferenceDirective);
|
|
164556
164655
|
return file && { reference: libReferenceDirective, fileName: file.fileName, file, unverified: false };
|
|
164557
164656
|
}
|
|
164558
|
-
|
|
164559
|
-
if (resolvedModules == null ? void 0 : resolvedModules.size()) {
|
|
164657
|
+
if (sourceFile.imports.length || sourceFile.moduleAugmentations.length) {
|
|
164560
164658
|
const node = getTouchingToken(sourceFile, position);
|
|
164561
|
-
|
|
164562
|
-
|
|
164659
|
+
let resolution;
|
|
164660
|
+
if (isModuleSpecifierLike(node) && isExternalModuleNameRelative(node.text) && (resolution = program.getResolvedModule(sourceFile, node.text, getModeForUsageLocation(sourceFile, node)))) {
|
|
164661
|
+
const verifiedFileName = (_b = resolution.resolvedModule) == null ? void 0 : _b.resolvedFileName;
|
|
164563
164662
|
const fileName = verifiedFileName || resolvePath(getDirectoryPath(sourceFile.fileName), node.text);
|
|
164564
164663
|
return {
|
|
164565
164664
|
file: program.getSourceFile(fileName),
|
|
@@ -172934,6 +173033,7 @@ __export(ts_exports2, {
|
|
|
172934
173033
|
createModuleNotFoundChain: () => createModuleNotFoundChain,
|
|
172935
173034
|
createModuleResolutionCache: () => createModuleResolutionCache,
|
|
172936
173035
|
createModuleResolutionLoader: () => createModuleResolutionLoader,
|
|
173036
|
+
createModuleResolutionLoaderUsingGlobalCache: () => createModuleResolutionLoaderUsingGlobalCache,
|
|
172937
173037
|
createModuleSpecifierResolutionHost: () => createModuleSpecifierResolutionHost,
|
|
172938
173038
|
createMultiMap: () => createMultiMap,
|
|
172939
173039
|
createNodeConverters: () => createNodeConverters,
|
|
@@ -173362,6 +173462,7 @@ __export(ts_exports2, {
|
|
|
173362
173462
|
getLeadingCommentRangesOfNode: () => getLeadingCommentRangesOfNode,
|
|
173363
173463
|
getLeftmostAccessExpression: () => getLeftmostAccessExpression,
|
|
173364
173464
|
getLeftmostExpression: () => getLeftmostExpression,
|
|
173465
|
+
getLibraryNameFromLibFileName: () => getLibraryNameFromLibFileName,
|
|
173365
173466
|
getLineAndCharacterOfPosition: () => getLineAndCharacterOfPosition,
|
|
173366
173467
|
getLineInfo: () => getLineInfo,
|
|
173367
173468
|
getLineOfLocalPosition: () => getLineOfLocalPosition,
|
|
@@ -173756,6 +173857,7 @@ __export(ts_exports2, {
|
|
|
173756
173857
|
isClassDeclaration: () => isClassDeclaration,
|
|
173757
173858
|
isClassElement: () => isClassElement,
|
|
173758
173859
|
isClassExpression: () => isClassExpression,
|
|
173860
|
+
isClassFieldAndNotAutoAccessor: () => isClassFieldAndNotAutoAccessor,
|
|
173759
173861
|
isClassLike: () => isClassLike,
|
|
173760
173862
|
isClassMemberModifier: () => isClassMemberModifier,
|
|
173761
173863
|
isClassNamedEvaluationHelperBlock: () => isClassNamedEvaluationHelperBlock,
|
|
@@ -174974,9 +175076,12 @@ __export(ts_server_exports3, {
|
|
|
174974
175076
|
AutoImportProviderProject: () => AutoImportProviderProject,
|
|
174975
175077
|
AuxiliaryProject: () => AuxiliaryProject,
|
|
174976
175078
|
CharRangeSection: () => CharRangeSection,
|
|
175079
|
+
CloseFileWatcherEvent: () => CloseFileWatcherEvent,
|
|
174977
175080
|
CommandNames: () => CommandNames,
|
|
174978
175081
|
ConfigFileDiagEvent: () => ConfigFileDiagEvent,
|
|
174979
175082
|
ConfiguredProject: () => ConfiguredProject2,
|
|
175083
|
+
CreateDirectoryWatcherEvent: () => CreateDirectoryWatcherEvent,
|
|
175084
|
+
CreateFileWatcherEvent: () => CreateFileWatcherEvent,
|
|
174980
175085
|
Errors: () => Errors,
|
|
174981
175086
|
EventBeginInstallTypes: () => EventBeginInstallTypes,
|
|
174982
175087
|
EventEndInstallTypes: () => EventEndInstallTypes,
|
|
@@ -175732,6 +175837,7 @@ var CommandTypes = /* @__PURE__ */ ((CommandTypes2) => {
|
|
|
175732
175837
|
CommandTypes2["ProvideCallHierarchyIncomingCalls"] = "provideCallHierarchyIncomingCalls";
|
|
175733
175838
|
CommandTypes2["ProvideCallHierarchyOutgoingCalls"] = "provideCallHierarchyOutgoingCalls";
|
|
175734
175839
|
CommandTypes2["ProvideInlayHints"] = "provideInlayHints";
|
|
175840
|
+
CommandTypes2["WatchChange"] = "watchChange";
|
|
175735
175841
|
return CommandTypes2;
|
|
175736
175842
|
})(CommandTypes || {});
|
|
175737
175843
|
var OrganizeImportsMode2 = /* @__PURE__ */ ((OrganizeImportsMode3) => {
|
|
@@ -176695,8 +176801,8 @@ var Project3 = class _Project {
|
|
|
176695
176801
|
}
|
|
176696
176802
|
if (this.program && !this.symlinks.hasProcessedResolutions()) {
|
|
176697
176803
|
this.symlinks.setSymlinksFromResolutions(
|
|
176698
|
-
this.program.
|
|
176699
|
-
this.program.
|
|
176804
|
+
this.program.forEachResolvedModule,
|
|
176805
|
+
this.program.forEachResolvedTypeReferenceDirective,
|
|
176700
176806
|
this.program.getAutomaticTypeDirectiveResolutions()
|
|
176701
176807
|
);
|
|
176702
176808
|
}
|
|
@@ -177479,12 +177585,23 @@ var Project3 = class _Project {
|
|
|
177479
177585
|
for (const f of oldProgram.getSourceFiles()) {
|
|
177480
177586
|
const newFile = this.program.getSourceFileByPath(f.resolvedPath);
|
|
177481
177587
|
if (!newFile || f.resolvedPath === f.path && newFile.resolvedPath !== f.path) {
|
|
177482
|
-
this.detachScriptInfoFromProject(
|
|
177588
|
+
this.detachScriptInfoFromProject(
|
|
177589
|
+
f.fileName,
|
|
177590
|
+
!!this.program.getSourceFileByPath(f.path),
|
|
177591
|
+
/*syncDirWatcherRemove*/
|
|
177592
|
+
true
|
|
177593
|
+
);
|
|
177483
177594
|
}
|
|
177484
177595
|
}
|
|
177485
177596
|
oldProgram.forEachResolvedProjectReference((resolvedProjectReference) => {
|
|
177486
177597
|
if (!this.program.getResolvedProjectReferenceByPath(resolvedProjectReference.sourceFile.path)) {
|
|
177487
|
-
this.detachScriptInfoFromProject(
|
|
177598
|
+
this.detachScriptInfoFromProject(
|
|
177599
|
+
resolvedProjectReference.sourceFile.fileName,
|
|
177600
|
+
/*noRemoveResolution*/
|
|
177601
|
+
void 0,
|
|
177602
|
+
/*syncDirWatcherRemove*/
|
|
177603
|
+
true
|
|
177604
|
+
);
|
|
177488
177605
|
}
|
|
177489
177606
|
});
|
|
177490
177607
|
}
|
|
@@ -177524,6 +177641,7 @@ var Project3 = class _Project {
|
|
|
177524
177641
|
this.resolutionCache.updateTypeRootsWatch();
|
|
177525
177642
|
}
|
|
177526
177643
|
}
|
|
177644
|
+
this.projectService.verifyProgram(this);
|
|
177527
177645
|
if (this.exportMapCache && !this.exportMapCache.isEmpty()) {
|
|
177528
177646
|
this.exportMapCache.releaseSymbols();
|
|
177529
177647
|
if (this.hasAddedorRemovedFiles || oldProgram && !this.program.structureIsReused) {
|
|
@@ -177596,12 +177714,12 @@ var Project3 = class _Project {
|
|
|
177596
177714
|
sendPerformanceEvent(kind, durationMs) {
|
|
177597
177715
|
this.projectService.sendPerformanceEvent(kind, durationMs);
|
|
177598
177716
|
}
|
|
177599
|
-
detachScriptInfoFromProject(uncheckedFileName, noRemoveResolution) {
|
|
177717
|
+
detachScriptInfoFromProject(uncheckedFileName, noRemoveResolution, syncDirWatcherRemove) {
|
|
177600
177718
|
const scriptInfoToDetach = this.projectService.getScriptInfo(uncheckedFileName);
|
|
177601
177719
|
if (scriptInfoToDetach) {
|
|
177602
177720
|
scriptInfoToDetach.detachFromProject(this);
|
|
177603
177721
|
if (!noRemoveResolution) {
|
|
177604
|
-
this.resolutionCache.removeResolutionsOfFile(scriptInfoToDetach.path);
|
|
177722
|
+
this.resolutionCache.removeResolutionsOfFile(scriptInfoToDetach.path, syncDirWatcherRemove);
|
|
177605
177723
|
}
|
|
177606
177724
|
}
|
|
177607
177725
|
}
|
|
@@ -178112,16 +178230,12 @@ function getUnresolvedImports(program, cachedUnresolvedImportsPerFile) {
|
|
|
178112
178230
|
}
|
|
178113
178231
|
function extractUnresolvedImportsFromSourceFile(program, file, ambientModules, cachedUnresolvedImportsPerFile) {
|
|
178114
178232
|
return getOrUpdate(cachedUnresolvedImportsPerFile, file.path, () => {
|
|
178115
|
-
var _a;
|
|
178116
|
-
const resolvedModules = (_a = program.resolvedModules) == null ? void 0 : _a.get(file.path);
|
|
178117
|
-
if (!resolvedModules)
|
|
178118
|
-
return emptyArray2;
|
|
178119
178233
|
let unresolvedImports;
|
|
178120
|
-
|
|
178234
|
+
program.forEachResolvedModule(({ resolvedModule }, name) => {
|
|
178121
178235
|
if ((!resolvedModule || !resolutionExtensionIsTSOrJson(resolvedModule.extension)) && !isExternalModuleNameRelative(name) && !ambientModules.some((m) => m === name)) {
|
|
178122
178236
|
unresolvedImports = append(unresolvedImports, parsePackageName(name).packageName);
|
|
178123
178237
|
}
|
|
178124
|
-
});
|
|
178238
|
+
}, file);
|
|
178125
178239
|
return unresolvedImports || emptyArray2;
|
|
178126
178240
|
});
|
|
178127
178241
|
}
|
|
@@ -178364,11 +178478,12 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
|
|
|
178364
178478
|
);
|
|
178365
178479
|
if (entrypoints) {
|
|
178366
178480
|
const real = (_a2 = host.realpath) == null ? void 0 : _a2.call(host, packageJson.packageDirectory);
|
|
178367
|
-
const
|
|
178481
|
+
const realPath2 = real ? hostProject.toPath(real) : void 0;
|
|
178482
|
+
const isSymlink = realPath2 && realPath2 !== hostProject.toPath(packageJson.packageDirectory);
|
|
178368
178483
|
if (isSymlink) {
|
|
178369
178484
|
symlinkCache.setSymlinkedDirectory(packageJson.packageDirectory, {
|
|
178370
178485
|
real,
|
|
178371
|
-
realPath:
|
|
178486
|
+
realPath: realPath2
|
|
178372
178487
|
});
|
|
178373
178488
|
}
|
|
178374
178489
|
return mapDefined(entrypoints, (entrypoint) => {
|
|
@@ -178780,6 +178895,9 @@ var ConfigFileDiagEvent = "configFileDiag";
|
|
|
178780
178895
|
var ProjectLanguageServiceStateEvent = "projectLanguageServiceState";
|
|
178781
178896
|
var ProjectInfoTelemetryEvent = "projectInfo";
|
|
178782
178897
|
var OpenFileInfoTelemetryEvent = "openFileInfo";
|
|
178898
|
+
var CreateFileWatcherEvent = "createFileWatcher";
|
|
178899
|
+
var CreateDirectoryWatcherEvent = "createDirectoryWatcher";
|
|
178900
|
+
var CloseFileWatcherEvent = "closeFileWatcher";
|
|
178783
178901
|
var ensureProjectForOpenFileSchedule = "*ensureProjectForOpenFiles*";
|
|
178784
178902
|
function prepareConvertersForEnumLikeCompilerOptions(commandLineOptions) {
|
|
178785
178903
|
const map2 = /* @__PURE__ */ new Map();
|
|
@@ -179043,6 +179161,87 @@ function createProjectNameFactoryWithCounter(nameFactory) {
|
|
|
179043
179161
|
let nextId = 1;
|
|
179044
179162
|
return () => nameFactory(nextId++);
|
|
179045
179163
|
}
|
|
179164
|
+
function getHostWatcherMap() {
|
|
179165
|
+
return { idToCallbacks: /* @__PURE__ */ new Map(), pathToId: /* @__PURE__ */ new Map() };
|
|
179166
|
+
}
|
|
179167
|
+
function createWatchFactoryHostUsingWatchEvents(service, canUseWatchEvents) {
|
|
179168
|
+
if (!canUseWatchEvents || !service.eventHandler || !service.session)
|
|
179169
|
+
return void 0;
|
|
179170
|
+
const watchedFiles = getHostWatcherMap();
|
|
179171
|
+
const watchedDirectories = getHostWatcherMap();
|
|
179172
|
+
const watchedDirectoriesRecursive = getHostWatcherMap();
|
|
179173
|
+
let ids = 1;
|
|
179174
|
+
service.session.addProtocolHandler("watchChange" /* WatchChange */, (req) => {
|
|
179175
|
+
onWatchChange(req.arguments);
|
|
179176
|
+
return { responseRequired: false };
|
|
179177
|
+
});
|
|
179178
|
+
return {
|
|
179179
|
+
watchFile: watchFile2,
|
|
179180
|
+
watchDirectory,
|
|
179181
|
+
getCurrentDirectory: () => service.host.getCurrentDirectory(),
|
|
179182
|
+
useCaseSensitiveFileNames: service.host.useCaseSensitiveFileNames
|
|
179183
|
+
};
|
|
179184
|
+
function watchFile2(path, callback) {
|
|
179185
|
+
return getOrCreateFileWatcher(
|
|
179186
|
+
watchedFiles,
|
|
179187
|
+
path,
|
|
179188
|
+
callback,
|
|
179189
|
+
(id) => ({ eventName: CreateFileWatcherEvent, data: { id, path } })
|
|
179190
|
+
);
|
|
179191
|
+
}
|
|
179192
|
+
function watchDirectory(path, callback, recursive) {
|
|
179193
|
+
return getOrCreateFileWatcher(
|
|
179194
|
+
recursive ? watchedDirectoriesRecursive : watchedDirectories,
|
|
179195
|
+
path,
|
|
179196
|
+
callback,
|
|
179197
|
+
(id) => ({ eventName: CreateDirectoryWatcherEvent, data: { id, path, recursive: !!recursive } })
|
|
179198
|
+
);
|
|
179199
|
+
}
|
|
179200
|
+
function getOrCreateFileWatcher({ pathToId, idToCallbacks }, path, callback, event) {
|
|
179201
|
+
const key = service.toPath(path);
|
|
179202
|
+
let id = pathToId.get(key);
|
|
179203
|
+
if (!id)
|
|
179204
|
+
pathToId.set(key, id = ids++);
|
|
179205
|
+
let callbacks = idToCallbacks.get(id);
|
|
179206
|
+
if (!callbacks) {
|
|
179207
|
+
idToCallbacks.set(id, callbacks = /* @__PURE__ */ new Set());
|
|
179208
|
+
service.eventHandler(event(id));
|
|
179209
|
+
}
|
|
179210
|
+
callbacks.add(callback);
|
|
179211
|
+
return {
|
|
179212
|
+
close() {
|
|
179213
|
+
const callbacks2 = idToCallbacks.get(id);
|
|
179214
|
+
if (!(callbacks2 == null ? void 0 : callbacks2.delete(callback)))
|
|
179215
|
+
return;
|
|
179216
|
+
if (callbacks2.size)
|
|
179217
|
+
return;
|
|
179218
|
+
idToCallbacks.delete(id);
|
|
179219
|
+
pathToId.delete(key);
|
|
179220
|
+
service.eventHandler({ eventName: CloseFileWatcherEvent, data: { id } });
|
|
179221
|
+
}
|
|
179222
|
+
};
|
|
179223
|
+
}
|
|
179224
|
+
function onWatchChange({ id, path, eventType }) {
|
|
179225
|
+
onFileWatcherCallback(id, path, eventType);
|
|
179226
|
+
onDirectoryWatcherCallback(watchedDirectories, id, path, eventType);
|
|
179227
|
+
onDirectoryWatcherCallback(watchedDirectoriesRecursive, id, path, eventType);
|
|
179228
|
+
}
|
|
179229
|
+
function onFileWatcherCallback(id, eventPath, eventType) {
|
|
179230
|
+
var _a;
|
|
179231
|
+
(_a = watchedFiles.idToCallbacks.get(id)) == null ? void 0 : _a.forEach((callback) => {
|
|
179232
|
+
const eventKind = eventType === "create" ? 0 /* Created */ : eventType === "delete" ? 2 /* Deleted */ : 1 /* Changed */;
|
|
179233
|
+
callback(eventPath, eventKind);
|
|
179234
|
+
});
|
|
179235
|
+
}
|
|
179236
|
+
function onDirectoryWatcherCallback({ idToCallbacks }, id, eventPath, eventType) {
|
|
179237
|
+
var _a;
|
|
179238
|
+
if (eventType === "update")
|
|
179239
|
+
return;
|
|
179240
|
+
(_a = idToCallbacks.get(id)) == null ? void 0 : _a.forEach((callback) => {
|
|
179241
|
+
callback(eventPath);
|
|
179242
|
+
});
|
|
179243
|
+
}
|
|
179244
|
+
}
|
|
179046
179245
|
var _ProjectService = class _ProjectService {
|
|
179047
179246
|
constructor(opts) {
|
|
179048
179247
|
/**
|
|
@@ -179122,6 +179321,8 @@ var _ProjectService = class _ProjectService {
|
|
|
179122
179321
|
this.extendedConfigCache = /* @__PURE__ */ new Map();
|
|
179123
179322
|
/** @internal */
|
|
179124
179323
|
this.verifyDocumentRegistry = noop;
|
|
179324
|
+
/** @internal */
|
|
179325
|
+
this.verifyProgram = noop;
|
|
179125
179326
|
var _a;
|
|
179126
179327
|
this.host = opts.host;
|
|
179127
179328
|
this.logger = opts.logger;
|
|
@@ -179170,7 +179371,12 @@ var _ProjectService = class _ProjectService {
|
|
|
179170
179371
|
this.watchFactory = this.serverMode !== 0 /* Semantic */ ? {
|
|
179171
179372
|
watchFile: returnNoopFileWatcher,
|
|
179172
179373
|
watchDirectory: returnNoopFileWatcher
|
|
179173
|
-
} : getWatchFactory(
|
|
179374
|
+
} : getWatchFactory(
|
|
179375
|
+
createWatchFactoryHostUsingWatchEvents(this, opts.canUseWatchEvents) || this.host,
|
|
179376
|
+
watchLogLevel,
|
|
179377
|
+
log,
|
|
179378
|
+
getDetailWatchInfo
|
|
179379
|
+
);
|
|
179174
179380
|
(_a = opts.incrementalVerifier) == null ? void 0 : _a.call(opts, this);
|
|
179175
179381
|
}
|
|
179176
179382
|
toPath(fileName) {
|
|
@@ -183394,6 +183600,7 @@ var Session3 = class _Session {
|
|
|
183394
183600
|
typesMapLocation: opts.typesMapLocation,
|
|
183395
183601
|
serverMode: opts.serverMode,
|
|
183396
183602
|
session: this,
|
|
183603
|
+
canUseWatchEvents: opts.canUseWatchEvents,
|
|
183397
183604
|
incrementalVerifier: opts.incrementalVerifier
|
|
183398
183605
|
};
|
|
183399
183606
|
this.projectService = new ProjectService3(settings);
|
|
@@ -183447,43 +183654,41 @@ var Session3 = class _Session {
|
|
|
183447
183654
|
defaultEventHandler(event) {
|
|
183448
183655
|
switch (event.eventName) {
|
|
183449
183656
|
case ProjectsUpdatedInBackgroundEvent:
|
|
183450
|
-
|
|
183451
|
-
this.projectsUpdatedInBackgroundEvent(openFiles);
|
|
183657
|
+
this.projectsUpdatedInBackgroundEvent(event.data.openFiles);
|
|
183452
183658
|
break;
|
|
183453
183659
|
case ProjectLoadingStartEvent:
|
|
183454
|
-
|
|
183455
|
-
|
|
183456
|
-
|
|
183457
|
-
|
|
183458
|
-
);
|
|
183660
|
+
this.event({
|
|
183661
|
+
projectName: event.data.project.getProjectName(),
|
|
183662
|
+
reason: event.data.reason
|
|
183663
|
+
}, event.eventName);
|
|
183459
183664
|
break;
|
|
183460
183665
|
case ProjectLoadingFinishEvent:
|
|
183461
|
-
|
|
183462
|
-
|
|
183666
|
+
this.event({
|
|
183667
|
+
projectName: event.data.project.getProjectName()
|
|
183668
|
+
}, event.eventName);
|
|
183463
183669
|
break;
|
|
183464
183670
|
case LargeFileReferencedEvent:
|
|
183465
|
-
|
|
183466
|
-
|
|
183671
|
+
case CreateFileWatcherEvent:
|
|
183672
|
+
case CreateDirectoryWatcherEvent:
|
|
183673
|
+
case CloseFileWatcherEvent:
|
|
183674
|
+
this.event(event.data, event.eventName);
|
|
183467
183675
|
break;
|
|
183468
183676
|
case ConfigFileDiagEvent:
|
|
183469
|
-
const { triggerFile, configFileName: configFile, diagnostics } = event.data;
|
|
183470
|
-
const bakedDiags = map(diagnostics, (diagnostic) => formatDiagnosticToProtocol(
|
|
183471
|
-
diagnostic,
|
|
183472
|
-
/*includeFileName*/
|
|
183473
|
-
true
|
|
183474
|
-
));
|
|
183475
183677
|
this.event({
|
|
183476
|
-
triggerFile,
|
|
183477
|
-
configFile,
|
|
183478
|
-
diagnostics:
|
|
183479
|
-
|
|
183678
|
+
triggerFile: event.data.triggerFile,
|
|
183679
|
+
configFile: event.data.configFileName,
|
|
183680
|
+
diagnostics: map(event.data.diagnostics, (diagnostic) => formatDiagnosticToProtocol(
|
|
183681
|
+
diagnostic,
|
|
183682
|
+
/*includeFileName*/
|
|
183683
|
+
true
|
|
183684
|
+
))
|
|
183685
|
+
}, event.eventName);
|
|
183480
183686
|
break;
|
|
183481
183687
|
case ProjectLanguageServiceStateEvent: {
|
|
183482
|
-
const eventName = ProjectLanguageServiceStateEvent;
|
|
183483
183688
|
this.event({
|
|
183484
183689
|
projectName: event.data.project.getProjectName(),
|
|
183485
183690
|
languageServiceEnabled: event.data.languageServiceEnabled
|
|
183486
|
-
}, eventName);
|
|
183691
|
+
}, event.eventName);
|
|
183487
183692
|
break;
|
|
183488
183693
|
}
|
|
183489
183694
|
case ProjectInfoTelemetryEvent: {
|
|
@@ -186278,9 +186483,12 @@ __export(ts_server_exports4, {
|
|
|
186278
186483
|
AutoImportProviderProject: () => AutoImportProviderProject,
|
|
186279
186484
|
AuxiliaryProject: () => AuxiliaryProject,
|
|
186280
186485
|
CharRangeSection: () => CharRangeSection,
|
|
186486
|
+
CloseFileWatcherEvent: () => CloseFileWatcherEvent,
|
|
186281
186487
|
CommandNames: () => CommandNames,
|
|
186282
186488
|
ConfigFileDiagEvent: () => ConfigFileDiagEvent,
|
|
186283
186489
|
ConfiguredProject: () => ConfiguredProject2,
|
|
186490
|
+
CreateDirectoryWatcherEvent: () => CreateDirectoryWatcherEvent,
|
|
186491
|
+
CreateFileWatcherEvent: () => CreateFileWatcherEvent,
|
|
186284
186492
|
Errors: () => Errors,
|
|
186285
186493
|
EventBeginInstallTypes: () => EventBeginInstallTypes,
|
|
186286
186494
|
EventEndInstallTypes: () => EventEndInstallTypes,
|
|
@@ -187097,6 +187305,7 @@ function start({ args, logger, cancellationToken, serverMode, unknownServerMode,
|
|
|
187097
187305
|
useInferredProjectPerProjectRoot: hasArgument("--useInferredProjectPerProjectRoot"),
|
|
187098
187306
|
suppressDiagnosticEvents: hasArgument("--suppressDiagnosticEvents"),
|
|
187099
187307
|
noGetErrOnBackgroundUpdate: hasArgument("--noGetErrOnBackgroundUpdate"),
|
|
187308
|
+
canUseWatchEvents: hasArgument("--canUseWatchEvents"),
|
|
187100
187309
|
serverMode
|
|
187101
187310
|
},
|
|
187102
187311
|
logger,
|
|
@@ -187502,6 +187711,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
187502
187711
|
createModuleNotFoundChain,
|
|
187503
187712
|
createModuleResolutionCache,
|
|
187504
187713
|
createModuleResolutionLoader,
|
|
187714
|
+
createModuleResolutionLoaderUsingGlobalCache,
|
|
187505
187715
|
createModuleSpecifierResolutionHost,
|
|
187506
187716
|
createMultiMap,
|
|
187507
187717
|
createNodeConverters,
|
|
@@ -187930,6 +188140,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
187930
188140
|
getLeadingCommentRangesOfNode,
|
|
187931
188141
|
getLeftmostAccessExpression,
|
|
187932
188142
|
getLeftmostExpression,
|
|
188143
|
+
getLibraryNameFromLibFileName,
|
|
187933
188144
|
getLineAndCharacterOfPosition,
|
|
187934
188145
|
getLineInfo,
|
|
187935
188146
|
getLineOfLocalPosition,
|
|
@@ -188324,6 +188535,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
188324
188535
|
isClassDeclaration,
|
|
188325
188536
|
isClassElement,
|
|
188326
188537
|
isClassExpression,
|
|
188538
|
+
isClassFieldAndNotAutoAccessor,
|
|
188327
188539
|
isClassLike,
|
|
188328
188540
|
isClassMemberModifier,
|
|
188329
188541
|
isClassNamedEvaluationHelperBlock,
|