typescript 5.5.0-dev.20240411 → 5.5.0-dev.20240413
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 +934 -670
- package/lib/typescript.d.ts +99 -30
- package/lib/typescript.js +1353 -895
- package/package.json +2 -2
package/lib/typescript.js
CHANGED
|
@@ -256,6 +256,7 @@ __export(typescript_exports, {
|
|
|
256
256
|
canHaveJSDoc: () => canHaveJSDoc,
|
|
257
257
|
canHaveLocals: () => canHaveLocals,
|
|
258
258
|
canHaveModifiers: () => canHaveModifiers,
|
|
259
|
+
canHaveModuleSpecifier: () => canHaveModuleSpecifier,
|
|
259
260
|
canHaveSymbol: () => canHaveSymbol,
|
|
260
261
|
canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
|
|
261
262
|
canProduceDiagnostics: () => canProduceDiagnostics,
|
|
@@ -434,6 +435,7 @@ __export(typescript_exports, {
|
|
|
434
435
|
createModuleResolutionLoaderUsingGlobalCache: () => createModuleResolutionLoaderUsingGlobalCache,
|
|
435
436
|
createModuleSpecifierResolutionHost: () => createModuleSpecifierResolutionHost,
|
|
436
437
|
createMultiMap: () => createMultiMap,
|
|
438
|
+
createNameResolver: () => createNameResolver,
|
|
437
439
|
createNodeConverters: () => createNodeConverters,
|
|
438
440
|
createNodeFactory: () => createNodeFactory,
|
|
439
441
|
createOptionNameMap: () => createOptionNameMap,
|
|
@@ -574,6 +576,7 @@ __export(typescript_exports, {
|
|
|
574
576
|
findChildOfKind: () => findChildOfKind,
|
|
575
577
|
findComputedPropertyNameCacheAssignment: () => findComputedPropertyNameCacheAssignment,
|
|
576
578
|
findConfigFile: () => findConfigFile,
|
|
579
|
+
findConstructorDeclaration: () => findConstructorDeclaration,
|
|
577
580
|
findContainingList: () => findContainingList,
|
|
578
581
|
findDiagnosticForNode: () => findDiagnosticForNode,
|
|
579
582
|
findFirstNonJsxWhitespaceToken: () => findFirstNonJsxWhitespaceToken,
|
|
@@ -720,6 +723,7 @@ __export(typescript_exports, {
|
|
|
720
723
|
getDefaultLibFileName: () => getDefaultLibFileName,
|
|
721
724
|
getDefaultLibFilePath: () => getDefaultLibFilePath,
|
|
722
725
|
getDefaultLikeExportInfo: () => getDefaultLikeExportInfo,
|
|
726
|
+
getDefaultResolutionModeForFileWorker: () => getDefaultResolutionModeForFileWorker,
|
|
723
727
|
getDiagnosticText: () => getDiagnosticText,
|
|
724
728
|
getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
|
|
725
729
|
getDirectoryPath: () => getDirectoryPath,
|
|
@@ -750,6 +754,7 @@ __export(typescript_exports, {
|
|
|
750
754
|
getEmitFlags: () => getEmitFlags,
|
|
751
755
|
getEmitHelpers: () => getEmitHelpers,
|
|
752
756
|
getEmitModuleDetectionKind: () => getEmitModuleDetectionKind,
|
|
757
|
+
getEmitModuleFormatOfFileWorker: () => getEmitModuleFormatOfFileWorker,
|
|
753
758
|
getEmitModuleKind: () => getEmitModuleKind,
|
|
754
759
|
getEmitModuleResolutionKind: () => getEmitModuleResolutionKind,
|
|
755
760
|
getEmitScriptTarget: () => getEmitScriptTarget,
|
|
@@ -800,6 +805,7 @@ __export(typescript_exports, {
|
|
|
800
805
|
getIdentifierGeneratedImportReference: () => getIdentifierGeneratedImportReference,
|
|
801
806
|
getIdentifierTypeArguments: () => getIdentifierTypeArguments,
|
|
802
807
|
getImmediatelyInvokedFunctionExpression: () => getImmediatelyInvokedFunctionExpression,
|
|
808
|
+
getImpliedNodeFormatForEmitWorker: () => getImpliedNodeFormatForEmitWorker,
|
|
803
809
|
getImpliedNodeFormatForFile: () => getImpliedNodeFormatForFile,
|
|
804
810
|
getImpliedNodeFormatForFileWorker: () => getImpliedNodeFormatForFileWorker,
|
|
805
811
|
getImportNeedsImportDefaultHelper: () => getImportNeedsImportDefaultHelper,
|
|
@@ -1155,6 +1161,7 @@ __export(typescript_exports, {
|
|
|
1155
1161
|
importDefaultHelper: () => importDefaultHelper,
|
|
1156
1162
|
importFromModuleSpecifier: () => importFromModuleSpecifier,
|
|
1157
1163
|
importStarHelper: () => importStarHelper,
|
|
1164
|
+
importSyntaxAffectsModuleResolution: () => importSyntaxAffectsModuleResolution,
|
|
1158
1165
|
indexOfAnyCharCode: () => indexOfAnyCharCode,
|
|
1159
1166
|
indexOfNode: () => indexOfNode,
|
|
1160
1167
|
indicesOf: () => indicesOf,
|
|
@@ -1285,6 +1292,7 @@ __export(typescript_exports, {
|
|
|
1285
1292
|
isConciseBody: () => isConciseBody,
|
|
1286
1293
|
isConditionalExpression: () => isConditionalExpression,
|
|
1287
1294
|
isConditionalTypeNode: () => isConditionalTypeNode,
|
|
1295
|
+
isConstAssertion: () => isConstAssertion,
|
|
1288
1296
|
isConstTypeReference: () => isConstTypeReference,
|
|
1289
1297
|
isConstructSignatureDeclaration: () => isConstructSignatureDeclaration,
|
|
1290
1298
|
isConstructorDeclaration: () => isConstructorDeclaration,
|
|
@@ -1399,6 +1407,7 @@ __export(typescript_exports, {
|
|
|
1399
1407
|
isGetOrSetAccessorDeclaration: () => isGetOrSetAccessorDeclaration,
|
|
1400
1408
|
isGlobalDeclaration: () => isGlobalDeclaration,
|
|
1401
1409
|
isGlobalScopeAugmentation: () => isGlobalScopeAugmentation,
|
|
1410
|
+
isGlobalSourceFile: () => isGlobalSourceFile,
|
|
1402
1411
|
isGrammarError: () => isGrammarError,
|
|
1403
1412
|
isHeritageClause: () => isHeritageClause,
|
|
1404
1413
|
isHoistedFunction: () => isHoistedFunction,
|
|
@@ -2242,11 +2251,11 @@ __export(typescript_exports, {
|
|
|
2242
2251
|
transformESDecorators: () => transformESDecorators,
|
|
2243
2252
|
transformESNext: () => transformESNext,
|
|
2244
2253
|
transformGenerators: () => transformGenerators,
|
|
2254
|
+
transformImpliedNodeFormatDependentModule: () => transformImpliedNodeFormatDependentModule,
|
|
2245
2255
|
transformJsx: () => transformJsx,
|
|
2246
2256
|
transformLegacyDecorators: () => transformLegacyDecorators,
|
|
2247
2257
|
transformModule: () => transformModule,
|
|
2248
2258
|
transformNamedEvaluation: () => transformNamedEvaluation,
|
|
2249
|
-
transformNodeModule: () => transformNodeModule,
|
|
2250
2259
|
transformNodes: () => transformNodes,
|
|
2251
2260
|
transformSystemModule: () => transformSystemModule,
|
|
2252
2261
|
transformTypeScript: () => transformTypeScript,
|
|
@@ -2338,7 +2347,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2338
2347
|
|
|
2339
2348
|
// src/compiler/corePublic.ts
|
|
2340
2349
|
var versionMajorMinor = "5.5";
|
|
2341
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2350
|
+
var version = `${versionMajorMinor}.0-dev.20240413`;
|
|
2342
2351
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2343
2352
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2344
2353
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6958,6 +6967,7 @@ var ScriptTarget = /* @__PURE__ */ ((ScriptTarget11) => {
|
|
|
6958
6967
|
ScriptTarget11[ScriptTarget11["ES2020"] = 7] = "ES2020";
|
|
6959
6968
|
ScriptTarget11[ScriptTarget11["ES2021"] = 8] = "ES2021";
|
|
6960
6969
|
ScriptTarget11[ScriptTarget11["ES2022"] = 9] = "ES2022";
|
|
6970
|
+
ScriptTarget11[ScriptTarget11["ES2023"] = 10] = "ES2023";
|
|
6961
6971
|
ScriptTarget11[ScriptTarget11["ESNext"] = 99] = "ESNext";
|
|
6962
6972
|
ScriptTarget11[ScriptTarget11["JSON"] = 100] = "JSON";
|
|
6963
6973
|
ScriptTarget11[ScriptTarget11["Latest"] = 99 /* ESNext */] = "Latest";
|
|
@@ -7850,7 +7860,7 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
7850
7860
|
const filePathComparer = getStringComparer(!useCaseSensitiveFileNames2);
|
|
7851
7861
|
const toCanonicalFilePath = createGetCanonicalFileName(useCaseSensitiveFileNames2);
|
|
7852
7862
|
return (dirName, callback, recursive, options) => recursive ? createDirectoryWatcher(dirName, options, callback) : watchDirectory(dirName, callback, recursive, options);
|
|
7853
|
-
function createDirectoryWatcher(dirName, options, callback) {
|
|
7863
|
+
function createDirectoryWatcher(dirName, options, callback, link) {
|
|
7854
7864
|
const dirPath = toCanonicalFilePath(dirName);
|
|
7855
7865
|
let directoryWatcher = cache.get(dirPath);
|
|
7856
7866
|
if (directoryWatcher) {
|
|
@@ -7860,10 +7870,12 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
7860
7870
|
watcher: watchDirectory(
|
|
7861
7871
|
dirName,
|
|
7862
7872
|
(fileName) => {
|
|
7873
|
+
var _a;
|
|
7863
7874
|
if (isIgnoredPath(fileName, options))
|
|
7864
7875
|
return;
|
|
7865
7876
|
if (options == null ? void 0 : options.synchronousWatchDirectory) {
|
|
7866
|
-
|
|
7877
|
+
if (!((_a = cache.get(dirPath)) == null ? void 0 : _a.targetWatcher))
|
|
7878
|
+
invokeCallbacks(dirName, dirPath, fileName);
|
|
7867
7879
|
updateChildWatches(dirName, dirPath, options);
|
|
7868
7880
|
} else {
|
|
7869
7881
|
nonSyncUpdateChildWatches(dirName, dirPath, fileName, options);
|
|
@@ -7874,11 +7886,15 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
7874
7886
|
options
|
|
7875
7887
|
),
|
|
7876
7888
|
refCount: 1,
|
|
7877
|
-
childWatches: emptyArray
|
|
7889
|
+
childWatches: emptyArray,
|
|
7890
|
+
targetWatcher: void 0,
|
|
7891
|
+
links: void 0
|
|
7878
7892
|
};
|
|
7879
7893
|
cache.set(dirPath, directoryWatcher);
|
|
7880
7894
|
updateChildWatches(dirName, dirPath, options);
|
|
7881
7895
|
}
|
|
7896
|
+
if (link)
|
|
7897
|
+
(directoryWatcher.links ?? (directoryWatcher.links = /* @__PURE__ */ new Set())).add(link);
|
|
7882
7898
|
const callbackToAdd = callback && { dirName, callback };
|
|
7883
7899
|
if (callbackToAdd) {
|
|
7884
7900
|
callbackCache.add(dirPath, callbackToAdd);
|
|
@@ -7886,19 +7902,25 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
7886
7902
|
return {
|
|
7887
7903
|
dirName,
|
|
7888
7904
|
close: () => {
|
|
7905
|
+
var _a;
|
|
7889
7906
|
const directoryWatcher2 = Debug.checkDefined(cache.get(dirPath));
|
|
7890
7907
|
if (callbackToAdd)
|
|
7891
7908
|
callbackCache.remove(dirPath, callbackToAdd);
|
|
7909
|
+
if (link)
|
|
7910
|
+
(_a = directoryWatcher2.links) == null ? void 0 : _a.delete(link);
|
|
7892
7911
|
directoryWatcher2.refCount--;
|
|
7893
7912
|
if (directoryWatcher2.refCount)
|
|
7894
7913
|
return;
|
|
7895
7914
|
cache.delete(dirPath);
|
|
7915
|
+
directoryWatcher2.links = void 0;
|
|
7896
7916
|
closeFileWatcherOf(directoryWatcher2);
|
|
7917
|
+
closeTargetWatcher(directoryWatcher2);
|
|
7897
7918
|
directoryWatcher2.childWatches.forEach(closeFileWatcher);
|
|
7898
7919
|
}
|
|
7899
7920
|
};
|
|
7900
7921
|
}
|
|
7901
|
-
function invokeCallbacks(dirPath, fileNameOrInvokeMap, fileNames) {
|
|
7922
|
+
function invokeCallbacks(dirName, dirPath, fileNameOrInvokeMap, fileNames) {
|
|
7923
|
+
var _a, _b;
|
|
7902
7924
|
let fileName;
|
|
7903
7925
|
let invokeMap;
|
|
7904
7926
|
if (isString(fileNameOrInvokeMap)) {
|
|
@@ -7926,6 +7948,14 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
7926
7948
|
}
|
|
7927
7949
|
}
|
|
7928
7950
|
});
|
|
7951
|
+
(_b = (_a = cache.get(dirPath)) == null ? void 0 : _a.links) == null ? void 0 : _b.forEach((link) => {
|
|
7952
|
+
const toPathInLink = (fileName2) => combinePaths(link, getRelativePathFromDirectory(dirName, fileName2, toCanonicalFilePath));
|
|
7953
|
+
if (invokeMap) {
|
|
7954
|
+
invokeCallbacks(link, toCanonicalFilePath(link), invokeMap, fileNames == null ? void 0 : fileNames.map(toPathInLink));
|
|
7955
|
+
} else {
|
|
7956
|
+
invokeCallbacks(link, toCanonicalFilePath(link), toPathInLink(fileName));
|
|
7957
|
+
}
|
|
7958
|
+
});
|
|
7929
7959
|
}
|
|
7930
7960
|
function nonSyncUpdateChildWatches(dirName, dirPath, fileName, options) {
|
|
7931
7961
|
const parentWatcher = cache.get(dirPath);
|
|
@@ -7933,7 +7963,8 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
7933
7963
|
scheduleUpdateChildWatches(dirName, dirPath, fileName, options);
|
|
7934
7964
|
return;
|
|
7935
7965
|
}
|
|
7936
|
-
invokeCallbacks(dirPath, fileName);
|
|
7966
|
+
invokeCallbacks(dirName, dirPath, fileName);
|
|
7967
|
+
closeTargetWatcher(parentWatcher);
|
|
7937
7968
|
removeChildWatches(parentWatcher);
|
|
7938
7969
|
}
|
|
7939
7970
|
function scheduleUpdateChildWatches(dirName, dirPath, fileName, options) {
|
|
@@ -7950,6 +7981,7 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
7950
7981
|
timerToUpdateChildWatches = setTimeout2(onTimerToUpdateChildWatches, 1e3, "timerToUpdateChildWatches");
|
|
7951
7982
|
}
|
|
7952
7983
|
function onTimerToUpdateChildWatches() {
|
|
7984
|
+
var _a;
|
|
7953
7985
|
timerToUpdateChildWatches = void 0;
|
|
7954
7986
|
sysLog(`sysLog:: onTimerToUpdateChildWatches:: ${cacheToUpdateChildWatches.size}`);
|
|
7955
7987
|
const start = timestamp();
|
|
@@ -7960,7 +7992,8 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
7960
7992
|
const { value: [dirPath, { dirName, options, fileNames }] } = result;
|
|
7961
7993
|
cacheToUpdateChildWatches.delete(dirPath);
|
|
7962
7994
|
const hasChanges = updateChildWatches(dirName, dirPath, options);
|
|
7963
|
-
|
|
7995
|
+
if (!((_a = cache.get(dirPath)) == null ? void 0 : _a.targetWatcher))
|
|
7996
|
+
invokeCallbacks(dirName, dirPath, invokeMap, hasChanges ? void 0 : fileNames);
|
|
7964
7997
|
}
|
|
7965
7998
|
sysLog(`sysLog:: invokingWatchers:: Elapsed:: ${timestamp() - start}ms:: ${cacheToUpdateChildWatches.size}`);
|
|
7966
7999
|
callbackCache.forEach((callbacks, rootDirName) => {
|
|
@@ -7988,22 +8021,46 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
7988
8021
|
removeChildWatches(cache.get(toCanonicalFilePath(childWatcher.dirName)));
|
|
7989
8022
|
}
|
|
7990
8023
|
}
|
|
8024
|
+
function closeTargetWatcher(watcher) {
|
|
8025
|
+
if (watcher == null ? void 0 : watcher.targetWatcher) {
|
|
8026
|
+
watcher.targetWatcher.close();
|
|
8027
|
+
watcher.targetWatcher = void 0;
|
|
8028
|
+
}
|
|
8029
|
+
}
|
|
7991
8030
|
function updateChildWatches(parentDir, parentDirPath, options) {
|
|
7992
8031
|
const parentWatcher = cache.get(parentDirPath);
|
|
7993
8032
|
if (!parentWatcher)
|
|
7994
8033
|
return false;
|
|
8034
|
+
const target = normalizePath(realpath(parentDir));
|
|
8035
|
+
let hasChanges;
|
|
7995
8036
|
let newChildWatches;
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
8037
|
+
if (filePathComparer(target, parentDir) === 0 /* EqualTo */) {
|
|
8038
|
+
hasChanges = enumerateInsertsAndDeletes(
|
|
8039
|
+
fileSystemEntryExists(parentDir, 1 /* Directory */) ? mapDefined(getAccessibleSortedChildDirectories(parentDir), (child) => {
|
|
8040
|
+
const childFullName = getNormalizedAbsolutePath(child, parentDir);
|
|
8041
|
+
return !isIgnoredPath(childFullName, options) && filePathComparer(childFullName, normalizePath(realpath(childFullName))) === 0 /* EqualTo */ ? childFullName : void 0;
|
|
8042
|
+
}) : emptyArray,
|
|
8043
|
+
parentWatcher.childWatches,
|
|
8044
|
+
(child, childWatcher) => filePathComparer(child, childWatcher.dirName),
|
|
8045
|
+
createAndAddChildDirectoryWatcher,
|
|
8046
|
+
closeFileWatcher,
|
|
8047
|
+
addChildDirectoryWatcher
|
|
8048
|
+
);
|
|
8049
|
+
} else if (parentWatcher.targetWatcher && filePathComparer(target, parentWatcher.targetWatcher.dirName) === 0 /* EqualTo */) {
|
|
8050
|
+
hasChanges = false;
|
|
8051
|
+
Debug.assert(parentWatcher.childWatches === emptyArray);
|
|
8052
|
+
} else {
|
|
8053
|
+
closeTargetWatcher(parentWatcher);
|
|
8054
|
+
parentWatcher.targetWatcher = createDirectoryWatcher(
|
|
8055
|
+
target,
|
|
8056
|
+
options,
|
|
8057
|
+
/*callback*/
|
|
8058
|
+
void 0,
|
|
8059
|
+
parentDir
|
|
8060
|
+
);
|
|
8061
|
+
parentWatcher.childWatches.forEach(closeFileWatcher);
|
|
8062
|
+
hasChanges = true;
|
|
8063
|
+
}
|
|
8007
8064
|
parentWatcher.childWatches = newChildWatches || emptyArray;
|
|
8008
8065
|
return hasChanges;
|
|
8009
8066
|
function createAndAddChildDirectoryWatcher(childName) {
|
|
@@ -9522,6 +9579,7 @@ var Diagnostics = {
|
|
|
9522
9579
|
_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1290, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_1290", "'{0}' resolves to a type-only declaration and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
|
|
9523
9580
|
_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported: diag(1291, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1291", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'import type' where '{0}' is imported."),
|
|
9524
9581
|
_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1292, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1292", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
|
|
9582
|
+
ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve: diag(1293, 1 /* Error */, "ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293", "ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'."),
|
|
9525
9583
|
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, 1 /* Error */, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
|
|
9526
9584
|
await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, 1 /* Error */, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
|
|
9527
9585
|
The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, 1 /* Error */, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."),
|
|
@@ -13648,6 +13706,8 @@ function getDefaultLibFileName(options) {
|
|
|
13648
13706
|
switch (getEmitScriptTarget(options)) {
|
|
13649
13707
|
case 99 /* ESNext */:
|
|
13650
13708
|
return "lib.esnext.full.d.ts";
|
|
13709
|
+
case 10 /* ES2023 */:
|
|
13710
|
+
return "lib.es2023.full.d.ts";
|
|
13651
13711
|
case 9 /* ES2022 */:
|
|
13652
13712
|
return "lib.es2022.full.d.ts";
|
|
13653
13713
|
case 8 /* ES2021 */:
|
|
@@ -16088,7 +16148,7 @@ function canUseOriginalText(node, flags) {
|
|
|
16088
16148
|
return !isBigIntLiteral(node);
|
|
16089
16149
|
}
|
|
16090
16150
|
function getTextOfConstantValue(value) {
|
|
16091
|
-
return isString(value) ?
|
|
16151
|
+
return isString(value) ? `"${escapeString(value)}"` : "" + value;
|
|
16092
16152
|
}
|
|
16093
16153
|
function makeIdentifierFromModuleName(moduleName) {
|
|
16094
16154
|
return getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_");
|
|
@@ -16520,6 +16580,9 @@ function getErrorSpanForNode(sourceFile, node) {
|
|
|
16520
16580
|
}
|
|
16521
16581
|
return createTextSpanFromBounds(pos, errorNode.end);
|
|
16522
16582
|
}
|
|
16583
|
+
function isGlobalSourceFile(node) {
|
|
16584
|
+
return node.kind === 307 /* SourceFile */ && !isExternalOrCommonJsModule(node);
|
|
16585
|
+
}
|
|
16523
16586
|
function isExternalOrCommonJsModule(file) {
|
|
16524
16587
|
return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== void 0;
|
|
16525
16588
|
}
|
|
@@ -17598,6 +17661,23 @@ function isFunctionSymbol(symbol) {
|
|
|
17598
17661
|
const decl = symbol.valueDeclaration;
|
|
17599
17662
|
return decl.kind === 262 /* FunctionDeclaration */ || isVariableDeclaration(decl) && decl.initializer && isFunctionLike(decl.initializer);
|
|
17600
17663
|
}
|
|
17664
|
+
function canHaveModuleSpecifier(node) {
|
|
17665
|
+
switch (node == null ? void 0 : node.kind) {
|
|
17666
|
+
case 260 /* VariableDeclaration */:
|
|
17667
|
+
case 208 /* BindingElement */:
|
|
17668
|
+
case 272 /* ImportDeclaration */:
|
|
17669
|
+
case 278 /* ExportDeclaration */:
|
|
17670
|
+
case 271 /* ImportEqualsDeclaration */:
|
|
17671
|
+
case 273 /* ImportClause */:
|
|
17672
|
+
case 280 /* NamespaceExport */:
|
|
17673
|
+
case 274 /* NamespaceImport */:
|
|
17674
|
+
case 281 /* ExportSpecifier */:
|
|
17675
|
+
case 276 /* ImportSpecifier */:
|
|
17676
|
+
case 205 /* ImportType */:
|
|
17677
|
+
return true;
|
|
17678
|
+
}
|
|
17679
|
+
return false;
|
|
17680
|
+
}
|
|
17601
17681
|
function tryGetModuleSpecifierFromDeclaration(node) {
|
|
17602
17682
|
var _a, _b;
|
|
17603
17683
|
switch (node.kind) {
|
|
@@ -20575,8 +20655,8 @@ function walkTreeForJSXTags(node) {
|
|
|
20575
20655
|
function isFileModuleFromUsingJSXTag(file) {
|
|
20576
20656
|
return !file.isDeclarationFile ? walkTreeForJSXTags(file) : void 0;
|
|
20577
20657
|
}
|
|
20578
|
-
function isFileForcedToBeModuleByFormat(file) {
|
|
20579
|
-
return (file
|
|
20658
|
+
function isFileForcedToBeModuleByFormat(file, options) {
|
|
20659
|
+
return (getImpliedNodeFormatForEmitWorker(file, options) === 99 /* ESNext */ || fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */, ".mjs" /* Mjs */, ".mts" /* Mts */])) && !file.isDeclarationFile ? true : void 0;
|
|
20580
20660
|
}
|
|
20581
20661
|
function getSetExternalModuleIndicator(options) {
|
|
20582
20662
|
switch (getEmitModuleDetectionKind(options)) {
|
|
@@ -20595,10 +20675,14 @@ function getSetExternalModuleIndicator(options) {
|
|
|
20595
20675
|
}
|
|
20596
20676
|
checks.push(isFileForcedToBeModuleByFormat);
|
|
20597
20677
|
const combined = or(...checks);
|
|
20598
|
-
const callback = (file) => void (file.externalModuleIndicator = combined(file));
|
|
20678
|
+
const callback = (file) => void (file.externalModuleIndicator = combined(file, options));
|
|
20599
20679
|
return callback;
|
|
20600
20680
|
}
|
|
20601
20681
|
}
|
|
20682
|
+
function importSyntaxAffectsModuleResolution(options) {
|
|
20683
|
+
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
20684
|
+
return 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */ || getResolvePackageJsonExports(options) || getResolvePackageJsonImports(options);
|
|
20685
|
+
}
|
|
20602
20686
|
function createComputedCompilerOptions(options) {
|
|
20603
20687
|
return options;
|
|
20604
20688
|
}
|
|
@@ -22069,6 +22153,380 @@ function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameEx
|
|
|
22069
22153
|
}
|
|
22070
22154
|
return evaluate;
|
|
22071
22155
|
}
|
|
22156
|
+
function isConstAssertion(location) {
|
|
22157
|
+
return isAssertionExpression(location) && isConstTypeReference(location.type) || isJSDocTypeTag(location) && isConstTypeReference(location.typeExpression);
|
|
22158
|
+
}
|
|
22159
|
+
function findConstructorDeclaration(node) {
|
|
22160
|
+
const members = node.members;
|
|
22161
|
+
for (const member of members) {
|
|
22162
|
+
if (member.kind === 176 /* Constructor */ && nodeIsPresent(member.body)) {
|
|
22163
|
+
return member;
|
|
22164
|
+
}
|
|
22165
|
+
}
|
|
22166
|
+
}
|
|
22167
|
+
function createNameResolver({
|
|
22168
|
+
compilerOptions,
|
|
22169
|
+
requireSymbol,
|
|
22170
|
+
argumentsSymbol,
|
|
22171
|
+
error: error2,
|
|
22172
|
+
getSymbolOfDeclaration,
|
|
22173
|
+
globals,
|
|
22174
|
+
lookup,
|
|
22175
|
+
setRequiresScopeChangeCache = returnUndefined,
|
|
22176
|
+
getRequiresScopeChangeCache = returnUndefined,
|
|
22177
|
+
onPropertyWithInvalidInitializer = returnFalse,
|
|
22178
|
+
onFailedToResolveSymbol = returnUndefined,
|
|
22179
|
+
onSuccessfullyResolvedSymbol = returnUndefined
|
|
22180
|
+
}) {
|
|
22181
|
+
var isolatedModulesLikeFlagName = compilerOptions.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules";
|
|
22182
|
+
var emitStandardClassFields = getEmitStandardClassFields(compilerOptions);
|
|
22183
|
+
var emptySymbols = createSymbolTable();
|
|
22184
|
+
return resolveNameHelper;
|
|
22185
|
+
function resolveNameHelper(location, nameArg, meaning, nameNotFoundMessage, isUse, excludeGlobals) {
|
|
22186
|
+
var _a, _b, _c;
|
|
22187
|
+
const originalLocation = location;
|
|
22188
|
+
let result;
|
|
22189
|
+
let lastLocation;
|
|
22190
|
+
let lastSelfReferenceLocation;
|
|
22191
|
+
let propertyWithInvalidInitializer;
|
|
22192
|
+
let associatedDeclarationForContainingInitializerOrBindingName;
|
|
22193
|
+
let withinDeferredContext = false;
|
|
22194
|
+
let grandparent;
|
|
22195
|
+
const name = isString(nameArg) ? nameArg : nameArg.escapedText;
|
|
22196
|
+
loop:
|
|
22197
|
+
while (location) {
|
|
22198
|
+
if (name === "const" && isConstAssertion(location)) {
|
|
22199
|
+
return void 0;
|
|
22200
|
+
}
|
|
22201
|
+
if (isModuleOrEnumDeclaration(location) && lastLocation && location.name === lastLocation) {
|
|
22202
|
+
lastLocation = location;
|
|
22203
|
+
location = location.parent;
|
|
22204
|
+
}
|
|
22205
|
+
if (canHaveLocals(location) && location.locals && !isGlobalSourceFile(location)) {
|
|
22206
|
+
if (result = lookup(location.locals, name, meaning)) {
|
|
22207
|
+
let useResult = true;
|
|
22208
|
+
if (isFunctionLike(location) && lastLocation && lastLocation !== location.body) {
|
|
22209
|
+
if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 320 /* JSDoc */) {
|
|
22210
|
+
useResult = result.flags & 262144 /* TypeParameter */ ? lastLocation === location.type || lastLocation.kind === 169 /* Parameter */ || lastLocation.kind === 341 /* JSDocParameterTag */ || lastLocation.kind === 342 /* JSDocReturnTag */ || lastLocation.kind === 168 /* TypeParameter */ : false;
|
|
22211
|
+
}
|
|
22212
|
+
if (meaning & result.flags & 3 /* Variable */) {
|
|
22213
|
+
if (useOuterVariableScopeInParameter(result, location, lastLocation)) {
|
|
22214
|
+
useResult = false;
|
|
22215
|
+
} else if (result.flags & 1 /* FunctionScopedVariable */) {
|
|
22216
|
+
useResult = lastLocation.kind === 169 /* Parameter */ || lastLocation === location.type && !!findAncestor(result.valueDeclaration, isParameter);
|
|
22217
|
+
}
|
|
22218
|
+
}
|
|
22219
|
+
} else if (location.kind === 194 /* ConditionalType */) {
|
|
22220
|
+
useResult = lastLocation === location.trueType;
|
|
22221
|
+
}
|
|
22222
|
+
if (useResult) {
|
|
22223
|
+
break loop;
|
|
22224
|
+
} else {
|
|
22225
|
+
result = void 0;
|
|
22226
|
+
}
|
|
22227
|
+
}
|
|
22228
|
+
}
|
|
22229
|
+
withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation);
|
|
22230
|
+
switch (location.kind) {
|
|
22231
|
+
case 307 /* SourceFile */:
|
|
22232
|
+
if (!isExternalOrCommonJsModule(location))
|
|
22233
|
+
break;
|
|
22234
|
+
case 267 /* ModuleDeclaration */:
|
|
22235
|
+
const moduleExports = ((_a = getSymbolOfDeclaration(location)) == null ? void 0 : _a.exports) || emptySymbols;
|
|
22236
|
+
if (location.kind === 307 /* SourceFile */ || isModuleDeclaration(location) && location.flags & 33554432 /* Ambient */ && !isGlobalScopeAugmentation(location)) {
|
|
22237
|
+
if (result = moduleExports.get("default" /* Default */)) {
|
|
22238
|
+
const localSymbol = getLocalSymbolForExportDefault(result);
|
|
22239
|
+
if (localSymbol && result.flags & meaning && localSymbol.escapedName === name) {
|
|
22240
|
+
break loop;
|
|
22241
|
+
}
|
|
22242
|
+
result = void 0;
|
|
22243
|
+
}
|
|
22244
|
+
const moduleExport = moduleExports.get(name);
|
|
22245
|
+
if (moduleExport && moduleExport.flags === 2097152 /* Alias */ && (getDeclarationOfKind(moduleExport, 281 /* ExportSpecifier */) || getDeclarationOfKind(moduleExport, 280 /* NamespaceExport */))) {
|
|
22246
|
+
break;
|
|
22247
|
+
}
|
|
22248
|
+
}
|
|
22249
|
+
if (name !== "default" /* Default */ && (result = lookup(moduleExports, name, meaning & 2623475 /* ModuleMember */))) {
|
|
22250
|
+
if (isSourceFile(location) && location.commonJsModuleIndicator && !((_b = result.declarations) == null ? void 0 : _b.some(isJSDocTypeAlias))) {
|
|
22251
|
+
result = void 0;
|
|
22252
|
+
} else {
|
|
22253
|
+
break loop;
|
|
22254
|
+
}
|
|
22255
|
+
}
|
|
22256
|
+
break;
|
|
22257
|
+
case 266 /* EnumDeclaration */:
|
|
22258
|
+
if (result = lookup(((_c = getSymbolOfDeclaration(location)) == null ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* EnumMember */)) {
|
|
22259
|
+
if (nameNotFoundMessage && getIsolatedModules(compilerOptions) && !(location.flags & 33554432 /* Ambient */) && getSourceFileOfNode(location) !== getSourceFileOfNode(result.valueDeclaration)) {
|
|
22260
|
+
error2(
|
|
22261
|
+
originalLocation,
|
|
22262
|
+
Diagnostics.Cannot_access_0_from_another_file_without_qualification_when_1_is_enabled_Use_2_instead,
|
|
22263
|
+
unescapeLeadingUnderscores(name),
|
|
22264
|
+
isolatedModulesLikeFlagName,
|
|
22265
|
+
`${unescapeLeadingUnderscores(getSymbolOfDeclaration(location).escapedName)}.${unescapeLeadingUnderscores(name)}`
|
|
22266
|
+
);
|
|
22267
|
+
}
|
|
22268
|
+
break loop;
|
|
22269
|
+
}
|
|
22270
|
+
break;
|
|
22271
|
+
case 172 /* PropertyDeclaration */:
|
|
22272
|
+
if (!isStatic(location)) {
|
|
22273
|
+
const ctor = findConstructorDeclaration(location.parent);
|
|
22274
|
+
if (ctor && ctor.locals) {
|
|
22275
|
+
if (lookup(ctor.locals, name, meaning & 111551 /* Value */)) {
|
|
22276
|
+
Debug.assertNode(location, isPropertyDeclaration);
|
|
22277
|
+
propertyWithInvalidInitializer = location;
|
|
22278
|
+
}
|
|
22279
|
+
}
|
|
22280
|
+
}
|
|
22281
|
+
break;
|
|
22282
|
+
case 263 /* ClassDeclaration */:
|
|
22283
|
+
case 231 /* ClassExpression */:
|
|
22284
|
+
case 264 /* InterfaceDeclaration */:
|
|
22285
|
+
if (result = lookup(getSymbolOfDeclaration(location).members || emptySymbols, name, meaning & 788968 /* Type */)) {
|
|
22286
|
+
if (!isTypeParameterSymbolDeclaredInContainer(result, location)) {
|
|
22287
|
+
result = void 0;
|
|
22288
|
+
break;
|
|
22289
|
+
}
|
|
22290
|
+
if (lastLocation && isStatic(lastLocation)) {
|
|
22291
|
+
if (nameNotFoundMessage) {
|
|
22292
|
+
error2(originalLocation, Diagnostics.Static_members_cannot_reference_class_type_parameters);
|
|
22293
|
+
}
|
|
22294
|
+
return void 0;
|
|
22295
|
+
}
|
|
22296
|
+
break loop;
|
|
22297
|
+
}
|
|
22298
|
+
if (isClassExpression(location) && meaning & 32 /* Class */) {
|
|
22299
|
+
const className = location.name;
|
|
22300
|
+
if (className && name === className.escapedText) {
|
|
22301
|
+
result = location.symbol;
|
|
22302
|
+
break loop;
|
|
22303
|
+
}
|
|
22304
|
+
}
|
|
22305
|
+
break;
|
|
22306
|
+
case 233 /* ExpressionWithTypeArguments */:
|
|
22307
|
+
if (lastLocation === location.expression && location.parent.token === 96 /* ExtendsKeyword */) {
|
|
22308
|
+
const container = location.parent.parent;
|
|
22309
|
+
if (isClassLike(container) && (result = lookup(getSymbolOfDeclaration(container).members, name, meaning & 788968 /* Type */))) {
|
|
22310
|
+
if (nameNotFoundMessage) {
|
|
22311
|
+
error2(originalLocation, Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters);
|
|
22312
|
+
}
|
|
22313
|
+
return void 0;
|
|
22314
|
+
}
|
|
22315
|
+
}
|
|
22316
|
+
break;
|
|
22317
|
+
case 167 /* ComputedPropertyName */:
|
|
22318
|
+
grandparent = location.parent.parent;
|
|
22319
|
+
if (isClassLike(grandparent) || grandparent.kind === 264 /* InterfaceDeclaration */) {
|
|
22320
|
+
if (result = lookup(getSymbolOfDeclaration(grandparent).members, name, meaning & 788968 /* Type */)) {
|
|
22321
|
+
if (nameNotFoundMessage) {
|
|
22322
|
+
error2(originalLocation, Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
|
|
22323
|
+
}
|
|
22324
|
+
return void 0;
|
|
22325
|
+
}
|
|
22326
|
+
}
|
|
22327
|
+
break;
|
|
22328
|
+
case 219 /* ArrowFunction */:
|
|
22329
|
+
if (getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */) {
|
|
22330
|
+
break;
|
|
22331
|
+
}
|
|
22332
|
+
case 174 /* MethodDeclaration */:
|
|
22333
|
+
case 176 /* Constructor */:
|
|
22334
|
+
case 177 /* GetAccessor */:
|
|
22335
|
+
case 178 /* SetAccessor */:
|
|
22336
|
+
case 262 /* FunctionDeclaration */:
|
|
22337
|
+
if (meaning & 3 /* Variable */ && name === "arguments") {
|
|
22338
|
+
result = argumentsSymbol;
|
|
22339
|
+
break loop;
|
|
22340
|
+
}
|
|
22341
|
+
break;
|
|
22342
|
+
case 218 /* FunctionExpression */:
|
|
22343
|
+
if (meaning & 3 /* Variable */ && name === "arguments") {
|
|
22344
|
+
result = argumentsSymbol;
|
|
22345
|
+
break loop;
|
|
22346
|
+
}
|
|
22347
|
+
if (meaning & 16 /* Function */) {
|
|
22348
|
+
const functionName = location.name;
|
|
22349
|
+
if (functionName && name === functionName.escapedText) {
|
|
22350
|
+
result = location.symbol;
|
|
22351
|
+
break loop;
|
|
22352
|
+
}
|
|
22353
|
+
}
|
|
22354
|
+
break;
|
|
22355
|
+
case 170 /* Decorator */:
|
|
22356
|
+
if (location.parent && location.parent.kind === 169 /* Parameter */) {
|
|
22357
|
+
location = location.parent;
|
|
22358
|
+
}
|
|
22359
|
+
if (location.parent && (isClassElement(location.parent) || location.parent.kind === 263 /* ClassDeclaration */)) {
|
|
22360
|
+
location = location.parent;
|
|
22361
|
+
}
|
|
22362
|
+
break;
|
|
22363
|
+
case 346 /* JSDocTypedefTag */:
|
|
22364
|
+
case 338 /* JSDocCallbackTag */:
|
|
22365
|
+
case 340 /* JSDocEnumTag */:
|
|
22366
|
+
case 351 /* JSDocImportTag */:
|
|
22367
|
+
const root = getJSDocRoot(location);
|
|
22368
|
+
if (root) {
|
|
22369
|
+
location = root.parent;
|
|
22370
|
+
}
|
|
22371
|
+
break;
|
|
22372
|
+
case 169 /* Parameter */:
|
|
22373
|
+
if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) {
|
|
22374
|
+
if (!associatedDeclarationForContainingInitializerOrBindingName) {
|
|
22375
|
+
associatedDeclarationForContainingInitializerOrBindingName = location;
|
|
22376
|
+
}
|
|
22377
|
+
}
|
|
22378
|
+
break;
|
|
22379
|
+
case 208 /* BindingElement */:
|
|
22380
|
+
if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) {
|
|
22381
|
+
if (isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) {
|
|
22382
|
+
associatedDeclarationForContainingInitializerOrBindingName = location;
|
|
22383
|
+
}
|
|
22384
|
+
}
|
|
22385
|
+
break;
|
|
22386
|
+
case 195 /* InferType */:
|
|
22387
|
+
if (meaning & 262144 /* TypeParameter */) {
|
|
22388
|
+
const parameterName = location.typeParameter.name;
|
|
22389
|
+
if (parameterName && name === parameterName.escapedText) {
|
|
22390
|
+
result = location.typeParameter.symbol;
|
|
22391
|
+
break loop;
|
|
22392
|
+
}
|
|
22393
|
+
}
|
|
22394
|
+
break;
|
|
22395
|
+
case 281 /* ExportSpecifier */:
|
|
22396
|
+
if (lastLocation && lastLocation === location.propertyName && location.parent.parent.moduleSpecifier) {
|
|
22397
|
+
location = location.parent.parent.parent;
|
|
22398
|
+
}
|
|
22399
|
+
break;
|
|
22400
|
+
}
|
|
22401
|
+
if (isSelfReferenceLocation(location)) {
|
|
22402
|
+
lastSelfReferenceLocation = location;
|
|
22403
|
+
}
|
|
22404
|
+
lastLocation = location;
|
|
22405
|
+
location = isJSDocTemplateTag(location) ? getEffectiveContainerForJSDocTemplateTag(location) || location.parent : isJSDocParameterTag(location) || isJSDocReturnTag(location) ? getHostSignatureFromJSDoc(location) || location.parent : location.parent;
|
|
22406
|
+
}
|
|
22407
|
+
if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
|
|
22408
|
+
result.isReferenced |= meaning;
|
|
22409
|
+
}
|
|
22410
|
+
if (!result) {
|
|
22411
|
+
if (lastLocation) {
|
|
22412
|
+
Debug.assertNode(lastLocation, isSourceFile);
|
|
22413
|
+
if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
|
|
22414
|
+
return lastLocation.symbol;
|
|
22415
|
+
}
|
|
22416
|
+
}
|
|
22417
|
+
if (!excludeGlobals) {
|
|
22418
|
+
result = lookup(globals, name, meaning);
|
|
22419
|
+
}
|
|
22420
|
+
}
|
|
22421
|
+
if (!result) {
|
|
22422
|
+
if (originalLocation && isInJSFile(originalLocation) && originalLocation.parent) {
|
|
22423
|
+
if (isRequireCall(
|
|
22424
|
+
originalLocation.parent,
|
|
22425
|
+
/*requireStringLiteralLikeArgument*/
|
|
22426
|
+
false
|
|
22427
|
+
)) {
|
|
22428
|
+
return requireSymbol;
|
|
22429
|
+
}
|
|
22430
|
+
}
|
|
22431
|
+
}
|
|
22432
|
+
if (nameNotFoundMessage) {
|
|
22433
|
+
if (propertyWithInvalidInitializer && onPropertyWithInvalidInitializer(originalLocation, name, propertyWithInvalidInitializer, result)) {
|
|
22434
|
+
return void 0;
|
|
22435
|
+
}
|
|
22436
|
+
if (!result) {
|
|
22437
|
+
onFailedToResolveSymbol(originalLocation, nameArg, meaning, nameNotFoundMessage);
|
|
22438
|
+
} else {
|
|
22439
|
+
onSuccessfullyResolvedSymbol(originalLocation, result, meaning, lastLocation, associatedDeclarationForContainingInitializerOrBindingName, withinDeferredContext);
|
|
22440
|
+
}
|
|
22441
|
+
}
|
|
22442
|
+
return result;
|
|
22443
|
+
}
|
|
22444
|
+
function useOuterVariableScopeInParameter(result, location, lastLocation) {
|
|
22445
|
+
const target = getEmitScriptTarget(compilerOptions);
|
|
22446
|
+
const functionLocation = location;
|
|
22447
|
+
if (isParameter(lastLocation) && functionLocation.body && result.valueDeclaration && result.valueDeclaration.pos >= functionLocation.body.pos && result.valueDeclaration.end <= functionLocation.body.end) {
|
|
22448
|
+
if (target >= 2 /* ES2015 */) {
|
|
22449
|
+
let declarationRequiresScopeChange = getRequiresScopeChangeCache(functionLocation);
|
|
22450
|
+
if (declarationRequiresScopeChange === void 0) {
|
|
22451
|
+
declarationRequiresScopeChange = forEach(functionLocation.parameters, requiresScopeChange) || false;
|
|
22452
|
+
setRequiresScopeChangeCache(functionLocation, declarationRequiresScopeChange);
|
|
22453
|
+
}
|
|
22454
|
+
return !declarationRequiresScopeChange;
|
|
22455
|
+
}
|
|
22456
|
+
}
|
|
22457
|
+
return false;
|
|
22458
|
+
function requiresScopeChange(node) {
|
|
22459
|
+
return requiresScopeChangeWorker(node.name) || !!node.initializer && requiresScopeChangeWorker(node.initializer);
|
|
22460
|
+
}
|
|
22461
|
+
function requiresScopeChangeWorker(node) {
|
|
22462
|
+
switch (node.kind) {
|
|
22463
|
+
case 219 /* ArrowFunction */:
|
|
22464
|
+
case 218 /* FunctionExpression */:
|
|
22465
|
+
case 262 /* FunctionDeclaration */:
|
|
22466
|
+
case 176 /* Constructor */:
|
|
22467
|
+
return false;
|
|
22468
|
+
case 174 /* MethodDeclaration */:
|
|
22469
|
+
case 177 /* GetAccessor */:
|
|
22470
|
+
case 178 /* SetAccessor */:
|
|
22471
|
+
case 303 /* PropertyAssignment */:
|
|
22472
|
+
return requiresScopeChangeWorker(node.name);
|
|
22473
|
+
case 172 /* PropertyDeclaration */:
|
|
22474
|
+
if (hasStaticModifier(node)) {
|
|
22475
|
+
return !emitStandardClassFields;
|
|
22476
|
+
}
|
|
22477
|
+
return requiresScopeChangeWorker(node.name);
|
|
22478
|
+
default:
|
|
22479
|
+
if (isNullishCoalesce(node) || isOptionalChain(node)) {
|
|
22480
|
+
return target < 7 /* ES2020 */;
|
|
22481
|
+
}
|
|
22482
|
+
if (isBindingElement(node) && node.dotDotDotToken && isObjectBindingPattern(node.parent)) {
|
|
22483
|
+
return target < 4 /* ES2017 */;
|
|
22484
|
+
}
|
|
22485
|
+
if (isTypeNode(node))
|
|
22486
|
+
return false;
|
|
22487
|
+
return forEachChild(node, requiresScopeChangeWorker) || false;
|
|
22488
|
+
}
|
|
22489
|
+
}
|
|
22490
|
+
}
|
|
22491
|
+
function getIsDeferredContext(location, lastLocation) {
|
|
22492
|
+
if (location.kind !== 219 /* ArrowFunction */ && location.kind !== 218 /* FunctionExpression */) {
|
|
22493
|
+
return isTypeQueryNode(location) || (isFunctionLikeDeclaration(location) || location.kind === 172 /* PropertyDeclaration */ && !isStatic(location)) && (!lastLocation || lastLocation !== location.name);
|
|
22494
|
+
}
|
|
22495
|
+
if (lastLocation && lastLocation === location.name) {
|
|
22496
|
+
return false;
|
|
22497
|
+
}
|
|
22498
|
+
if (location.asteriskToken || hasSyntacticModifier(location, 1024 /* Async */)) {
|
|
22499
|
+
return true;
|
|
22500
|
+
}
|
|
22501
|
+
return !getImmediatelyInvokedFunctionExpression(location);
|
|
22502
|
+
}
|
|
22503
|
+
function isSelfReferenceLocation(node) {
|
|
22504
|
+
switch (node.kind) {
|
|
22505
|
+
case 262 /* FunctionDeclaration */:
|
|
22506
|
+
case 263 /* ClassDeclaration */:
|
|
22507
|
+
case 264 /* InterfaceDeclaration */:
|
|
22508
|
+
case 266 /* EnumDeclaration */:
|
|
22509
|
+
case 265 /* TypeAliasDeclaration */:
|
|
22510
|
+
case 267 /* ModuleDeclaration */:
|
|
22511
|
+
return true;
|
|
22512
|
+
default:
|
|
22513
|
+
return false;
|
|
22514
|
+
}
|
|
22515
|
+
}
|
|
22516
|
+
function isTypeParameterSymbolDeclaredInContainer(symbol, container) {
|
|
22517
|
+
if (symbol.declarations) {
|
|
22518
|
+
for (const decl of symbol.declarations) {
|
|
22519
|
+
if (decl.kind === 168 /* TypeParameter */) {
|
|
22520
|
+
const parent2 = isJSDocTemplateTag(decl.parent) ? getJSDocHost(decl.parent) : decl.parent;
|
|
22521
|
+
if (parent2 === container) {
|
|
22522
|
+
return !(isJSDocTemplateTag(decl.parent) && find(decl.parent.parent.tags, isJSDocTypeAlias));
|
|
22523
|
+
}
|
|
22524
|
+
}
|
|
22525
|
+
}
|
|
22526
|
+
}
|
|
22527
|
+
return false;
|
|
22528
|
+
}
|
|
22529
|
+
}
|
|
22072
22530
|
|
|
22073
22531
|
// src/compiler/factory/baseNodeFactory.ts
|
|
22074
22532
|
function createBaseNodeFactory() {
|
|
@@ -29576,7 +30034,7 @@ function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFacto
|
|
|
29576
30034
|
if (compilerOptions.importHelpers && isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
29577
30035
|
let namedBindings;
|
|
29578
30036
|
const moduleKind = getEmitModuleKind(compilerOptions);
|
|
29579
|
-
if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || sourceFile
|
|
30037
|
+
if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || getImpliedNodeFormatForEmitWorker(sourceFile, compilerOptions) === 99 /* ESNext */) {
|
|
29580
30038
|
const helpers = getEmitHelpers(sourceFile);
|
|
29581
30039
|
if (helpers) {
|
|
29582
30040
|
const helperNames = [];
|
|
@@ -29641,8 +30099,7 @@ function getOrCreateExternalHelpersModuleNameIfNeeded(factory2, node, compilerOp
|
|
|
29641
30099
|
if (externalHelpersModuleName) {
|
|
29642
30100
|
return externalHelpersModuleName;
|
|
29643
30101
|
}
|
|
29644
|
-
|
|
29645
|
-
let create = (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || node.impliedNodeFormat === 1 /* CommonJS */);
|
|
30102
|
+
let create = (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && getEmitModuleFormatOfFileWorker(node, compilerOptions) < 4 /* System */;
|
|
29646
30103
|
if (!create) {
|
|
29647
30104
|
const helpers = getEmitHelpers(node);
|
|
29648
30105
|
if (helpers) {
|
|
@@ -38685,6 +39142,7 @@ var targetOptionDeclaration = {
|
|
|
38685
39142
|
es2020: 7 /* ES2020 */,
|
|
38686
39143
|
es2021: 8 /* ES2021 */,
|
|
38687
39144
|
es2022: 9 /* ES2022 */,
|
|
39145
|
+
es2023: 10 /* ES2023 */,
|
|
38688
39146
|
esnext: 99 /* ESNext */
|
|
38689
39147
|
})),
|
|
38690
39148
|
affectsSourceFile: true,
|
|
@@ -47343,13 +47801,15 @@ var RelativePreference = /* @__PURE__ */ ((RelativePreference2) => {
|
|
|
47343
47801
|
RelativePreference2[RelativePreference2["ExternalNonRelative"] = 3] = "ExternalNonRelative";
|
|
47344
47802
|
return RelativePreference2;
|
|
47345
47803
|
})(RelativePreference || {});
|
|
47346
|
-
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
47804
|
+
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, host, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
47347
47805
|
const filePreferredEnding = getPreferredEnding();
|
|
47348
47806
|
return {
|
|
47349
47807
|
relativePreference: oldImportSpecifier !== void 0 ? isExternalModuleNameRelative(oldImportSpecifier) ? 0 /* Relative */ : 1 /* NonRelative */ : importModuleSpecifierPreference === "relative" ? 0 /* Relative */ : importModuleSpecifierPreference === "non-relative" ? 1 /* NonRelative */ : importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : 2 /* Shortest */,
|
|
47350
47808
|
getAllowedEndingsInPreferredOrder: (syntaxImpliedNodeFormat) => {
|
|
47351
|
-
const
|
|
47352
|
-
|
|
47809
|
+
const impliedNodeFormat = getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions);
|
|
47810
|
+
const preferredEnding = syntaxImpliedNodeFormat !== impliedNodeFormat ? getPreferredEnding(syntaxImpliedNodeFormat) : filePreferredEnding;
|
|
47811
|
+
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
47812
|
+
if ((syntaxImpliedNodeFormat ?? impliedNodeFormat) === 99 /* ESNext */ && 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */) {
|
|
47353
47813
|
if (shouldAllowImportingTsExtension(compilerOptions, importingSourceFile.fileName)) {
|
|
47354
47814
|
return [3 /* TsExtension */, 2 /* JsExtension */];
|
|
47355
47815
|
}
|
|
@@ -47382,20 +47842,20 @@ function getModuleSpecifierPreferences({ importModuleSpecifierPreference, import
|
|
|
47382
47842
|
}
|
|
47383
47843
|
return getModuleSpecifierEndingPreference(
|
|
47384
47844
|
importModuleSpecifierEnding,
|
|
47385
|
-
resolutionMode ?? importingSourceFile
|
|
47845
|
+
resolutionMode ?? getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions),
|
|
47386
47846
|
compilerOptions,
|
|
47387
47847
|
isFullSourceFile(importingSourceFile) ? importingSourceFile : void 0
|
|
47388
47848
|
);
|
|
47389
47849
|
}
|
|
47390
47850
|
}
|
|
47391
47851
|
function updateModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, oldImportSpecifier, options = {}) {
|
|
47392
|
-
const res = getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, compilerOptions, importingSourceFile, oldImportSpecifier), {}, options);
|
|
47852
|
+
const res = getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, host, compilerOptions, importingSourceFile, oldImportSpecifier), {}, options);
|
|
47393
47853
|
if (res === oldImportSpecifier)
|
|
47394
47854
|
return void 0;
|
|
47395
47855
|
return res;
|
|
47396
47856
|
}
|
|
47397
47857
|
function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, options = {}) {
|
|
47398
|
-
return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, compilerOptions, importingSourceFile), {}, options);
|
|
47858
|
+
return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, host, compilerOptions, importingSourceFile), {}, options);
|
|
47399
47859
|
}
|
|
47400
47860
|
function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeModulesFileName, host, preferences, options = {}) {
|
|
47401
47861
|
const info = getInfo(importingSourceFile.fileName, host);
|
|
@@ -47425,7 +47885,7 @@ function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importin
|
|
|
47425
47885
|
/*packageNameOnly*/
|
|
47426
47886
|
void 0,
|
|
47427
47887
|
options.overrideImportMode
|
|
47428
|
-
)) || getLocalModuleSpecifier(toFileName2, info, compilerOptions, host, options.overrideImportMode || importingSourceFile
|
|
47888
|
+
)) || getLocalModuleSpecifier(toFileName2, info, compilerOptions, host, options.overrideImportMode || getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions), preferences);
|
|
47429
47889
|
}
|
|
47430
47890
|
function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options = {}) {
|
|
47431
47891
|
return tryGetModuleSpecifiersFromCacheWorker(
|
|
@@ -47498,19 +47958,22 @@ function getLocalModuleSpecifierBetweenFileNames(importingFile, targetFileName,
|
|
|
47498
47958
|
compilerOptions,
|
|
47499
47959
|
host,
|
|
47500
47960
|
importMode,
|
|
47501
|
-
getModuleSpecifierPreferences({}, compilerOptions, importingFile)
|
|
47961
|
+
getModuleSpecifierPreferences({}, host, compilerOptions, importingFile)
|
|
47502
47962
|
);
|
|
47503
47963
|
}
|
|
47504
47964
|
function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
|
|
47505
47965
|
const info = getInfo(importingSourceFile.fileName, host);
|
|
47506
|
-
const preferences = getModuleSpecifierPreferences(userPreferences, compilerOptions, importingSourceFile);
|
|
47966
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, host, compilerOptions, importingSourceFile);
|
|
47507
47967
|
const existingSpecifier = isFullSourceFile(importingSourceFile) && forEach(modulePaths, (modulePath) => forEach(
|
|
47508
47968
|
host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
|
|
47509
47969
|
(reason) => {
|
|
47510
47970
|
if (reason.kind !== 3 /* Import */ || reason.file !== importingSourceFile.path)
|
|
47511
47971
|
return void 0;
|
|
47512
|
-
|
|
47972
|
+
const existingMode = host.getModeForResolutionAtIndex(importingSourceFile, reason.index);
|
|
47973
|
+
const targetMode = options.overrideImportMode ?? host.getDefaultResolutionModeForFile(importingSourceFile);
|
|
47974
|
+
if (existingMode !== targetMode && existingMode !== void 0 && targetMode !== void 0) {
|
|
47513
47975
|
return void 0;
|
|
47976
|
+
}
|
|
47514
47977
|
const specifier = getModuleNameStringLiteralAt(importingSourceFile, reason.index).text;
|
|
47515
47978
|
return preferences.relativePreference !== 1 /* NonRelative */ || !pathIsRelative(specifier) ? specifier : void 0;
|
|
47516
47979
|
}
|
|
@@ -48021,7 +48484,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
48021
48484
|
if (!parts) {
|
|
48022
48485
|
return void 0;
|
|
48023
48486
|
}
|
|
48024
|
-
const preferences = getModuleSpecifierPreferences(userPreferences, options, importingSourceFile);
|
|
48487
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, host, options, importingSourceFile);
|
|
48025
48488
|
const allowedEndings = preferences.getAllowedEndingsInPreferredOrder();
|
|
48026
48489
|
let moduleSpecifier = path;
|
|
48027
48490
|
let isPackageRootPath = false;
|
|
@@ -48072,7 +48535,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
48072
48535
|
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
48073
48536
|
if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
|
|
48074
48537
|
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || tryParseJson(host.readFile(packageJsonPath));
|
|
48075
|
-
const importMode = overrideMode || importingSourceFile
|
|
48538
|
+
const importMode = overrideMode || getDefaultResolutionModeForFile(importingSourceFile, host, options);
|
|
48076
48539
|
if (getResolvePackageJsonExports(options)) {
|
|
48077
48540
|
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
|
|
48078
48541
|
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
|
|
@@ -48224,6 +48687,9 @@ function getRelativePathIfInSameVolume(path, directoryPath, getCanonicalFileName
|
|
|
48224
48687
|
function isPathRelativeToParent(path) {
|
|
48225
48688
|
return startsWith(path, "..");
|
|
48226
48689
|
}
|
|
48690
|
+
function getDefaultResolutionModeForFile(file, host, compilerOptions) {
|
|
48691
|
+
return isFullSourceFile(file) ? host.getDefaultResolutionModeForFile(file) : getDefaultResolutionModeForFileWorker(file, compilerOptions);
|
|
48692
|
+
}
|
|
48227
48693
|
|
|
48228
48694
|
// src/compiler/checker.ts
|
|
48229
48695
|
var ambientModuleSymbolRegex = /^".+"$/;
|
|
@@ -48434,6 +48900,31 @@ function createTypeChecker(host) {
|
|
|
48434
48900
|
var lastGetCombinedNodeFlagsResult = 0 /* None */;
|
|
48435
48901
|
var lastGetCombinedModifierFlagsNode;
|
|
48436
48902
|
var lastGetCombinedModifierFlagsResult = 0 /* None */;
|
|
48903
|
+
var resolveName = createNameResolver({
|
|
48904
|
+
compilerOptions,
|
|
48905
|
+
requireSymbol,
|
|
48906
|
+
argumentsSymbol,
|
|
48907
|
+
globals,
|
|
48908
|
+
getSymbolOfDeclaration,
|
|
48909
|
+
error: error2,
|
|
48910
|
+
getRequiresScopeChangeCache,
|
|
48911
|
+
setRequiresScopeChangeCache,
|
|
48912
|
+
lookup: getSymbol2,
|
|
48913
|
+
onPropertyWithInvalidInitializer: checkAndReportErrorForInvalidInitializer,
|
|
48914
|
+
onFailedToResolveSymbol,
|
|
48915
|
+
onSuccessfullyResolvedSymbol
|
|
48916
|
+
});
|
|
48917
|
+
var resolveNameForSymbolSuggestion = createNameResolver({
|
|
48918
|
+
compilerOptions,
|
|
48919
|
+
requireSymbol,
|
|
48920
|
+
argumentsSymbol,
|
|
48921
|
+
globals,
|
|
48922
|
+
getSymbolOfDeclaration,
|
|
48923
|
+
error: error2,
|
|
48924
|
+
getRequiresScopeChangeCache,
|
|
48925
|
+
setRequiresScopeChangeCache,
|
|
48926
|
+
lookup: getSuggestionForSymbolNameLookup
|
|
48927
|
+
});
|
|
48437
48928
|
const checker = {
|
|
48438
48929
|
getNodeCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.nodeCount, 0),
|
|
48439
48930
|
getIdentifierCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.identifierCount, 0),
|
|
@@ -48739,8 +49230,6 @@ function createTypeChecker(host) {
|
|
|
48739
49230
|
meaning,
|
|
48740
49231
|
/*nameNotFoundMessage*/
|
|
48741
49232
|
void 0,
|
|
48742
|
-
/*nameArg*/
|
|
48743
|
-
void 0,
|
|
48744
49233
|
/*isUse*/
|
|
48745
49234
|
false,
|
|
48746
49235
|
excludeGlobals
|
|
@@ -49770,9 +50259,6 @@ function createTypeChecker(host) {
|
|
|
49770
50259
|
const nodeId = getNodeId(node);
|
|
49771
50260
|
return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks());
|
|
49772
50261
|
}
|
|
49773
|
-
function isGlobalSourceFile(node) {
|
|
49774
|
-
return node.kind === 307 /* SourceFile */ && !isExternalOrCommonJsModule(node);
|
|
49775
|
-
}
|
|
49776
50262
|
function getSymbol2(symbols, name, meaning) {
|
|
49777
50263
|
if (meaning) {
|
|
49778
50264
|
const symbol = getMergedSymbol(symbols.get(name));
|
|
@@ -49948,417 +50434,120 @@ function createTypeChecker(host) {
|
|
|
49948
50434
|
return ancestorChangingReferenceScope === void 0;
|
|
49949
50435
|
}
|
|
49950
50436
|
}
|
|
49951
|
-
function
|
|
49952
|
-
|
|
49953
|
-
|
|
49954
|
-
|
|
49955
|
-
|
|
49956
|
-
|
|
49957
|
-
|
|
49958
|
-
|
|
49959
|
-
|
|
49960
|
-
return
|
|
50437
|
+
function getRequiresScopeChangeCache(node) {
|
|
50438
|
+
return getNodeLinks(node).declarationRequiresScopeChange;
|
|
50439
|
+
}
|
|
50440
|
+
function setRequiresScopeChangeCache(node, value) {
|
|
50441
|
+
getNodeLinks(node).declarationRequiresScopeChange = value;
|
|
50442
|
+
}
|
|
50443
|
+
function checkAndReportErrorForInvalidInitializer(errorLocation, name, propertyWithInvalidInitializer, result) {
|
|
50444
|
+
if (!emitStandardClassFields) {
|
|
50445
|
+
if (errorLocation && !result && checkAndReportErrorForMissingPrefix(errorLocation, name, name)) {
|
|
50446
|
+
return true;
|
|
49961
50447
|
}
|
|
50448
|
+
error2(
|
|
50449
|
+
errorLocation,
|
|
50450
|
+
errorLocation && propertyWithInvalidInitializer.type && textRangeContainsPositionInclusive(propertyWithInvalidInitializer.type, errorLocation.pos) ? Diagnostics.Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor : Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor,
|
|
50451
|
+
declarationNameToString(propertyWithInvalidInitializer.name),
|
|
50452
|
+
diagnosticName(name)
|
|
50453
|
+
);
|
|
50454
|
+
return true;
|
|
49962
50455
|
}
|
|
49963
50456
|
return false;
|
|
49964
|
-
function requiresScopeChange(node) {
|
|
49965
|
-
return requiresScopeChangeWorker(node.name) || !!node.initializer && requiresScopeChangeWorker(node.initializer);
|
|
49966
|
-
}
|
|
49967
|
-
function requiresScopeChangeWorker(node) {
|
|
49968
|
-
switch (node.kind) {
|
|
49969
|
-
case 219 /* ArrowFunction */:
|
|
49970
|
-
case 218 /* FunctionExpression */:
|
|
49971
|
-
case 262 /* FunctionDeclaration */:
|
|
49972
|
-
case 176 /* Constructor */:
|
|
49973
|
-
return false;
|
|
49974
|
-
case 174 /* MethodDeclaration */:
|
|
49975
|
-
case 177 /* GetAccessor */:
|
|
49976
|
-
case 178 /* SetAccessor */:
|
|
49977
|
-
case 303 /* PropertyAssignment */:
|
|
49978
|
-
return requiresScopeChangeWorker(node.name);
|
|
49979
|
-
case 172 /* PropertyDeclaration */:
|
|
49980
|
-
if (hasStaticModifier(node)) {
|
|
49981
|
-
return !emitStandardClassFields;
|
|
49982
|
-
}
|
|
49983
|
-
return requiresScopeChangeWorker(node.name);
|
|
49984
|
-
default:
|
|
49985
|
-
if (isNullishCoalesce(node) || isOptionalChain(node)) {
|
|
49986
|
-
return target < 7 /* ES2020 */;
|
|
49987
|
-
}
|
|
49988
|
-
if (isBindingElement(node) && node.dotDotDotToken && isObjectBindingPattern(node.parent)) {
|
|
49989
|
-
return target < 4 /* ES2017 */;
|
|
49990
|
-
}
|
|
49991
|
-
if (isTypeNode(node))
|
|
49992
|
-
return false;
|
|
49993
|
-
return forEachChild(node, requiresScopeChangeWorker) || false;
|
|
49994
|
-
}
|
|
49995
|
-
}
|
|
49996
50457
|
}
|
|
49997
|
-
function
|
|
49998
|
-
|
|
49999
|
-
|
|
50000
|
-
|
|
50001
|
-
|
|
50002
|
-
|
|
50003
|
-
|
|
50004
|
-
|
|
50005
|
-
|
|
50006
|
-
|
|
50007
|
-
|
|
50008
|
-
|
|
50009
|
-
|
|
50010
|
-
|
|
50011
|
-
|
|
50012
|
-
|
|
50013
|
-
|
|
50014
|
-
|
|
50015
|
-
|
|
50016
|
-
|
|
50017
|
-
|
|
50018
|
-
|
|
50019
|
-
|
|
50020
|
-
|
|
50021
|
-
|
|
50022
|
-
|
|
50023
|
-
|
|
50024
|
-
|
|
50025
|
-
|
|
50026
|
-
|
|
50027
|
-
|
|
50028
|
-
|
|
50029
|
-
|
|
50030
|
-
|
|
50031
|
-
if (meaning & result.flags & 3 /* Variable */) {
|
|
50032
|
-
if (useOuterVariableScopeInParameter(result, location, lastLocation)) {
|
|
50033
|
-
useResult = false;
|
|
50034
|
-
} else if (result.flags & 1 /* FunctionScopedVariable */) {
|
|
50035
|
-
useResult = lastLocation.kind === 169 /* Parameter */ || lastLocation === location.type && !!findAncestor(result.valueDeclaration, isParameter);
|
|
50036
|
-
}
|
|
50037
|
-
}
|
|
50038
|
-
} else if (location.kind === 194 /* ConditionalType */) {
|
|
50039
|
-
useResult = lastLocation === location.trueType;
|
|
50040
|
-
}
|
|
50041
|
-
if (useResult) {
|
|
50042
|
-
break loop;
|
|
50043
|
-
} else {
|
|
50044
|
-
result = void 0;
|
|
50458
|
+
function onFailedToResolveSymbol(errorLocation, nameArg, meaning, nameNotFoundMessage) {
|
|
50459
|
+
const name = isString(nameArg) ? nameArg : nameArg.escapedText;
|
|
50460
|
+
addLazyDiagnostic(() => {
|
|
50461
|
+
if (!errorLocation || errorLocation.parent.kind !== 324 /* JSDocLink */ && !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
|
|
50462
|
+
let suggestion;
|
|
50463
|
+
let suggestedLib;
|
|
50464
|
+
if (nameArg) {
|
|
50465
|
+
suggestedLib = getSuggestedLibForNonExistentName(nameArg);
|
|
50466
|
+
if (suggestedLib) {
|
|
50467
|
+
error2(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), suggestedLib);
|
|
50468
|
+
}
|
|
50469
|
+
}
|
|
50470
|
+
if (!suggestedLib && suggestionCount < maximumSuggestionCount) {
|
|
50471
|
+
suggestion = getSuggestedSymbolForNonexistentSymbol(errorLocation, name, meaning);
|
|
50472
|
+
const isGlobalScopeAugmentationDeclaration = (suggestion == null ? void 0 : suggestion.valueDeclaration) && isAmbientModule(suggestion.valueDeclaration) && isGlobalScopeAugmentation(suggestion.valueDeclaration);
|
|
50473
|
+
if (isGlobalScopeAugmentationDeclaration) {
|
|
50474
|
+
suggestion = void 0;
|
|
50475
|
+
}
|
|
50476
|
+
if (suggestion) {
|
|
50477
|
+
const suggestionName = symbolToString(suggestion);
|
|
50478
|
+
const isUncheckedJS = isUncheckedJSSuggestion(
|
|
50479
|
+
errorLocation,
|
|
50480
|
+
suggestion,
|
|
50481
|
+
/*excludeClasses*/
|
|
50482
|
+
false
|
|
50483
|
+
);
|
|
50484
|
+
const message = meaning === 1920 /* Namespace */ || nameArg && typeof nameArg !== "string" && nodeIsSynthesized(nameArg) ? Diagnostics.Cannot_find_namespace_0_Did_you_mean_1 : isUncheckedJS ? Diagnostics.Could_not_find_name_0_Did_you_mean_1 : Diagnostics.Cannot_find_name_0_Did_you_mean_1;
|
|
50485
|
+
const diagnostic = createError(errorLocation, message, diagnosticName(nameArg), suggestionName);
|
|
50486
|
+
addErrorOrSuggestion(!isUncheckedJS, diagnostic);
|
|
50487
|
+
if (suggestion.valueDeclaration) {
|
|
50488
|
+
addRelatedInfo(
|
|
50489
|
+
diagnostic,
|
|
50490
|
+
createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestionName)
|
|
50491
|
+
);
|
|
50045
50492
|
}
|
|
50046
50493
|
}
|
|
50047
50494
|
}
|
|
50048
|
-
|
|
50049
|
-
|
|
50050
|
-
case 307 /* SourceFile */:
|
|
50051
|
-
if (!isExternalOrCommonJsModule(location))
|
|
50052
|
-
break;
|
|
50053
|
-
isInExternalModule = true;
|
|
50054
|
-
case 267 /* ModuleDeclaration */:
|
|
50055
|
-
const moduleExports = ((_a = getSymbolOfDeclaration(location)) == null ? void 0 : _a.exports) || emptySymbols;
|
|
50056
|
-
if (location.kind === 307 /* SourceFile */ || isModuleDeclaration(location) && location.flags & 33554432 /* Ambient */ && !isGlobalScopeAugmentation(location)) {
|
|
50057
|
-
if (result = moduleExports.get("default" /* Default */)) {
|
|
50058
|
-
const localSymbol = getLocalSymbolForExportDefault(result);
|
|
50059
|
-
if (localSymbol && result.flags & meaning && localSymbol.escapedName === name) {
|
|
50060
|
-
break loop;
|
|
50061
|
-
}
|
|
50062
|
-
result = void 0;
|
|
50063
|
-
}
|
|
50064
|
-
const moduleExport = moduleExports.get(name);
|
|
50065
|
-
if (moduleExport && moduleExport.flags === 2097152 /* Alias */ && (getDeclarationOfKind(moduleExport, 281 /* ExportSpecifier */) || getDeclarationOfKind(moduleExport, 280 /* NamespaceExport */))) {
|
|
50066
|
-
break;
|
|
50067
|
-
}
|
|
50068
|
-
}
|
|
50069
|
-
if (name !== "default" /* Default */ && (result = lookup(moduleExports, name, meaning & 2623475 /* ModuleMember */))) {
|
|
50070
|
-
if (isSourceFile(location) && location.commonJsModuleIndicator && !((_b = result.declarations) == null ? void 0 : _b.some(isJSDocTypeAlias))) {
|
|
50071
|
-
result = void 0;
|
|
50072
|
-
} else {
|
|
50073
|
-
break loop;
|
|
50074
|
-
}
|
|
50075
|
-
}
|
|
50076
|
-
break;
|
|
50077
|
-
case 266 /* EnumDeclaration */:
|
|
50078
|
-
if (result = lookup(((_c = getSymbolOfDeclaration(location)) == null ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* EnumMember */)) {
|
|
50079
|
-
if (nameNotFoundMessage && getIsolatedModules(compilerOptions) && !(location.flags & 33554432 /* Ambient */) && getSourceFileOfNode(location) !== getSourceFileOfNode(result.valueDeclaration)) {
|
|
50080
|
-
error2(
|
|
50081
|
-
errorLocation,
|
|
50082
|
-
Diagnostics.Cannot_access_0_from_another_file_without_qualification_when_1_is_enabled_Use_2_instead,
|
|
50083
|
-
unescapeLeadingUnderscores(name),
|
|
50084
|
-
isolatedModulesLikeFlagName,
|
|
50085
|
-
`${unescapeLeadingUnderscores(getSymbolOfNode(location).escapedName)}.${unescapeLeadingUnderscores(name)}`
|
|
50086
|
-
);
|
|
50087
|
-
}
|
|
50088
|
-
break loop;
|
|
50089
|
-
}
|
|
50090
|
-
break;
|
|
50091
|
-
case 172 /* PropertyDeclaration */:
|
|
50092
|
-
if (!isStatic(location)) {
|
|
50093
|
-
const ctor = findConstructorDeclaration(location.parent);
|
|
50094
|
-
if (ctor && ctor.locals) {
|
|
50095
|
-
if (lookup(ctor.locals, name, meaning & 111551 /* Value */)) {
|
|
50096
|
-
Debug.assertNode(location, isPropertyDeclaration);
|
|
50097
|
-
propertyWithInvalidInitializer = location;
|
|
50098
|
-
}
|
|
50099
|
-
}
|
|
50100
|
-
}
|
|
50101
|
-
break;
|
|
50102
|
-
case 263 /* ClassDeclaration */:
|
|
50103
|
-
case 231 /* ClassExpression */:
|
|
50104
|
-
case 264 /* InterfaceDeclaration */:
|
|
50105
|
-
if (result = lookup(getSymbolOfDeclaration(location).members || emptySymbols, name, meaning & 788968 /* Type */)) {
|
|
50106
|
-
if (!isTypeParameterSymbolDeclaredInContainer(result, location)) {
|
|
50107
|
-
result = void 0;
|
|
50108
|
-
break;
|
|
50109
|
-
}
|
|
50110
|
-
if (lastLocation && isStatic(lastLocation)) {
|
|
50111
|
-
if (nameNotFoundMessage) {
|
|
50112
|
-
error2(errorLocation, Diagnostics.Static_members_cannot_reference_class_type_parameters);
|
|
50113
|
-
}
|
|
50114
|
-
return void 0;
|
|
50115
|
-
}
|
|
50116
|
-
break loop;
|
|
50117
|
-
}
|
|
50118
|
-
if (isClassExpression(location) && meaning & 32 /* Class */) {
|
|
50119
|
-
const className = location.name;
|
|
50120
|
-
if (className && name === className.escapedText) {
|
|
50121
|
-
result = location.symbol;
|
|
50122
|
-
break loop;
|
|
50123
|
-
}
|
|
50124
|
-
}
|
|
50125
|
-
break;
|
|
50126
|
-
case 233 /* ExpressionWithTypeArguments */:
|
|
50127
|
-
if (lastLocation === location.expression && location.parent.token === 96 /* ExtendsKeyword */) {
|
|
50128
|
-
const container = location.parent.parent;
|
|
50129
|
-
if (isClassLike(container) && (result = lookup(getSymbolOfDeclaration(container).members, name, meaning & 788968 /* Type */))) {
|
|
50130
|
-
if (nameNotFoundMessage) {
|
|
50131
|
-
error2(errorLocation, Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters);
|
|
50132
|
-
}
|
|
50133
|
-
return void 0;
|
|
50134
|
-
}
|
|
50135
|
-
}
|
|
50136
|
-
break;
|
|
50137
|
-
case 167 /* ComputedPropertyName */:
|
|
50138
|
-
grandparent = location.parent.parent;
|
|
50139
|
-
if (isClassLike(grandparent) || grandparent.kind === 264 /* InterfaceDeclaration */) {
|
|
50140
|
-
if (result = lookup(getSymbolOfDeclaration(grandparent).members, name, meaning & 788968 /* Type */)) {
|
|
50141
|
-
if (nameNotFoundMessage) {
|
|
50142
|
-
error2(errorLocation, Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
|
|
50143
|
-
}
|
|
50144
|
-
return void 0;
|
|
50145
|
-
}
|
|
50146
|
-
}
|
|
50147
|
-
break;
|
|
50148
|
-
case 219 /* ArrowFunction */:
|
|
50149
|
-
if (getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */) {
|
|
50150
|
-
break;
|
|
50151
|
-
}
|
|
50152
|
-
case 174 /* MethodDeclaration */:
|
|
50153
|
-
case 176 /* Constructor */:
|
|
50154
|
-
case 177 /* GetAccessor */:
|
|
50155
|
-
case 178 /* SetAccessor */:
|
|
50156
|
-
case 262 /* FunctionDeclaration */:
|
|
50157
|
-
if (meaning & 3 /* Variable */ && name === "arguments") {
|
|
50158
|
-
result = argumentsSymbol;
|
|
50159
|
-
break loop;
|
|
50160
|
-
}
|
|
50161
|
-
break;
|
|
50162
|
-
case 218 /* FunctionExpression */:
|
|
50163
|
-
if (meaning & 3 /* Variable */ && name === "arguments") {
|
|
50164
|
-
result = argumentsSymbol;
|
|
50165
|
-
break loop;
|
|
50166
|
-
}
|
|
50167
|
-
if (meaning & 16 /* Function */) {
|
|
50168
|
-
const functionName = location.name;
|
|
50169
|
-
if (functionName && name === functionName.escapedText) {
|
|
50170
|
-
result = location.symbol;
|
|
50171
|
-
break loop;
|
|
50172
|
-
}
|
|
50173
|
-
}
|
|
50174
|
-
break;
|
|
50175
|
-
case 170 /* Decorator */:
|
|
50176
|
-
if (location.parent && location.parent.kind === 169 /* Parameter */) {
|
|
50177
|
-
location = location.parent;
|
|
50178
|
-
}
|
|
50179
|
-
if (location.parent && (isClassElement(location.parent) || location.parent.kind === 263 /* ClassDeclaration */)) {
|
|
50180
|
-
location = location.parent;
|
|
50181
|
-
}
|
|
50182
|
-
break;
|
|
50183
|
-
case 346 /* JSDocTypedefTag */:
|
|
50184
|
-
case 338 /* JSDocCallbackTag */:
|
|
50185
|
-
case 340 /* JSDocEnumTag */:
|
|
50186
|
-
case 351 /* JSDocImportTag */:
|
|
50187
|
-
const root = getJSDocRoot(location);
|
|
50188
|
-
if (root) {
|
|
50189
|
-
location = root.parent;
|
|
50190
|
-
}
|
|
50191
|
-
break;
|
|
50192
|
-
case 169 /* Parameter */:
|
|
50193
|
-
if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) {
|
|
50194
|
-
if (!associatedDeclarationForContainingInitializerOrBindingName) {
|
|
50195
|
-
associatedDeclarationForContainingInitializerOrBindingName = location;
|
|
50196
|
-
}
|
|
50197
|
-
}
|
|
50198
|
-
break;
|
|
50199
|
-
case 208 /* BindingElement */:
|
|
50200
|
-
if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) {
|
|
50201
|
-
if (isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) {
|
|
50202
|
-
associatedDeclarationForContainingInitializerOrBindingName = location;
|
|
50203
|
-
}
|
|
50204
|
-
}
|
|
50205
|
-
break;
|
|
50206
|
-
case 195 /* InferType */:
|
|
50207
|
-
if (meaning & 262144 /* TypeParameter */) {
|
|
50208
|
-
const parameterName = location.typeParameter.name;
|
|
50209
|
-
if (parameterName && name === parameterName.escapedText) {
|
|
50210
|
-
result = location.typeParameter.symbol;
|
|
50211
|
-
break loop;
|
|
50212
|
-
}
|
|
50213
|
-
}
|
|
50214
|
-
break;
|
|
50215
|
-
case 281 /* ExportSpecifier */:
|
|
50216
|
-
if (lastLocation && lastLocation === location.propertyName && location.parent.parent.moduleSpecifier) {
|
|
50217
|
-
location = location.parent.parent.parent;
|
|
50218
|
-
}
|
|
50219
|
-
break;
|
|
50220
|
-
}
|
|
50221
|
-
if (isSelfReferenceLocation(location)) {
|
|
50222
|
-
lastSelfReferenceLocation = location;
|
|
50223
|
-
}
|
|
50224
|
-
lastLocation = location;
|
|
50225
|
-
location = isJSDocTemplateTag(location) ? getEffectiveContainerForJSDocTemplateTag(location) || location.parent : isJSDocParameterTag(location) || isJSDocReturnTag(location) ? getHostSignatureFromJSDoc(location) || location.parent : location.parent;
|
|
50226
|
-
}
|
|
50227
|
-
if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
|
|
50228
|
-
result.isReferenced |= meaning;
|
|
50229
|
-
}
|
|
50230
|
-
if (!result) {
|
|
50231
|
-
if (lastLocation) {
|
|
50232
|
-
Debug.assertNode(lastLocation, isSourceFile);
|
|
50233
|
-
if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
|
|
50234
|
-
return lastLocation.symbol;
|
|
50495
|
+
if (!suggestion && !suggestedLib && nameArg) {
|
|
50496
|
+
error2(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
|
|
50235
50497
|
}
|
|
50498
|
+
suggestionCount++;
|
|
50236
50499
|
}
|
|
50237
|
-
|
|
50238
|
-
|
|
50239
|
-
|
|
50240
|
-
|
|
50241
|
-
|
|
50242
|
-
|
|
50243
|
-
|
|
50244
|
-
|
|
50245
|
-
|
|
50246
|
-
|
|
50247
|
-
|
|
50248
|
-
|
|
50500
|
+
});
|
|
50501
|
+
}
|
|
50502
|
+
function onSuccessfullyResolvedSymbol(errorLocation, result, meaning, lastLocation, associatedDeclarationForContainingInitializerOrBindingName, withinDeferredContext) {
|
|
50503
|
+
addLazyDiagnostic(() => {
|
|
50504
|
+
var _a;
|
|
50505
|
+
const name = result.escapedName;
|
|
50506
|
+
const isInExternalModule = lastLocation && isSourceFile(lastLocation) && isExternalOrCommonJsModule(lastLocation);
|
|
50507
|
+
if (errorLocation && (meaning & 2 /* BlockScopedVariable */ || (meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */)) {
|
|
50508
|
+
const exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
|
|
50509
|
+
if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) {
|
|
50510
|
+
checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
|
|
50511
|
+
}
|
|
50512
|
+
}
|
|
50513
|
+
if (isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */ && !(errorLocation.flags & 16777216 /* JSDoc */)) {
|
|
50514
|
+
const merged = getMergedSymbol(result);
|
|
50515
|
+
if (length(merged.declarations) && every(merged.declarations, (d) => isNamespaceExportDeclaration(d) || isSourceFile(d) && !!d.symbol.globalExports)) {
|
|
50516
|
+
errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, unescapeLeadingUnderscores(name));
|
|
50517
|
+
}
|
|
50518
|
+
}
|
|
50519
|
+
if (associatedDeclarationForContainingInitializerOrBindingName && !withinDeferredContext && (meaning & 111551 /* Value */) === 111551 /* Value */) {
|
|
50520
|
+
const candidate = getMergedSymbol(getLateBoundSymbol(result));
|
|
50521
|
+
const root = getRootDeclaration(associatedDeclarationForContainingInitializerOrBindingName);
|
|
50522
|
+
if (candidate === getSymbolOfDeclaration(associatedDeclarationForContainingInitializerOrBindingName)) {
|
|
50523
|
+
error2(errorLocation, Diagnostics.Parameter_0_cannot_reference_itself, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name));
|
|
50524
|
+
} else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializerOrBindingName.pos && root.parent.locals && getSymbol2(root.parent.locals, candidate.escapedName, meaning) === candidate) {
|
|
50525
|
+
error2(errorLocation, Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), declarationNameToString(errorLocation));
|
|
50526
|
+
}
|
|
50527
|
+
}
|
|
50528
|
+
if (errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */ && !(result.flags & 111551 /* Value */) && !isValidTypeOnlyAliasUseSite(errorLocation)) {
|
|
50529
|
+
const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* Value */);
|
|
50530
|
+
if (typeOnlyDeclaration) {
|
|
50531
|
+
const message = typeOnlyDeclaration.kind === 281 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ || typeOnlyDeclaration.kind === 280 /* NamespaceExport */ ? Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type;
|
|
50532
|
+
const unescapedName = unescapeLeadingUnderscores(name);
|
|
50533
|
+
addTypeOnlyDeclarationRelatedInfo(
|
|
50534
|
+
error2(errorLocation, message, unescapedName),
|
|
50535
|
+
typeOnlyDeclaration,
|
|
50536
|
+
unescapedName
|
|
50537
|
+
);
|
|
50249
50538
|
}
|
|
50250
50539
|
}
|
|
50251
|
-
|
|
50252
|
-
|
|
50253
|
-
|
|
50254
|
-
|
|
50255
|
-
|
|
50256
|
-
|
|
50257
|
-
|
|
50258
|
-
diagnosticName(nameArg)
|
|
50259
|
-
);
|
|
50260
|
-
return true;
|
|
50261
|
-
}
|
|
50262
|
-
return false;
|
|
50263
|
-
}
|
|
50264
|
-
if (!result) {
|
|
50265
|
-
if (nameNotFoundMessage) {
|
|
50266
|
-
addLazyDiagnostic(() => {
|
|
50267
|
-
if (!errorLocation || errorLocation.parent.kind !== 324 /* JSDocLink */ && !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217
|
|
50268
|
-
!checkAndReportErrorForInvalidInitializer() && !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
|
|
50269
|
-
let suggestion;
|
|
50270
|
-
let suggestedLib;
|
|
50271
|
-
if (nameArg) {
|
|
50272
|
-
suggestedLib = getSuggestedLibForNonExistentName(nameArg);
|
|
50273
|
-
if (suggestedLib) {
|
|
50274
|
-
error2(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), suggestedLib);
|
|
50275
|
-
}
|
|
50276
|
-
}
|
|
50277
|
-
if (!suggestedLib && getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
|
|
50278
|
-
suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning);
|
|
50279
|
-
const isGlobalScopeAugmentationDeclaration = (suggestion == null ? void 0 : suggestion.valueDeclaration) && isAmbientModule(suggestion.valueDeclaration) && isGlobalScopeAugmentation(suggestion.valueDeclaration);
|
|
50280
|
-
if (isGlobalScopeAugmentationDeclaration) {
|
|
50281
|
-
suggestion = void 0;
|
|
50282
|
-
}
|
|
50283
|
-
if (suggestion) {
|
|
50284
|
-
const suggestionName = symbolToString(suggestion);
|
|
50285
|
-
const isUncheckedJS = isUncheckedJSSuggestion(
|
|
50286
|
-
originalLocation,
|
|
50287
|
-
suggestion,
|
|
50288
|
-
/*excludeClasses*/
|
|
50289
|
-
false
|
|
50290
|
-
);
|
|
50291
|
-
const message = meaning === 1920 /* Namespace */ || nameArg && typeof nameArg !== "string" && nodeIsSynthesized(nameArg) ? Diagnostics.Cannot_find_namespace_0_Did_you_mean_1 : isUncheckedJS ? Diagnostics.Could_not_find_name_0_Did_you_mean_1 : Diagnostics.Cannot_find_name_0_Did_you_mean_1;
|
|
50292
|
-
const diagnostic = createError(errorLocation, message, diagnosticName(nameArg), suggestionName);
|
|
50293
|
-
addErrorOrSuggestion(!isUncheckedJS, diagnostic);
|
|
50294
|
-
if (suggestion.valueDeclaration) {
|
|
50295
|
-
addRelatedInfo(
|
|
50296
|
-
diagnostic,
|
|
50297
|
-
createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestionName)
|
|
50298
|
-
);
|
|
50299
|
-
}
|
|
50300
|
-
}
|
|
50301
|
-
}
|
|
50302
|
-
if (!suggestion && !suggestedLib && nameArg) {
|
|
50303
|
-
error2(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
|
|
50304
|
-
}
|
|
50305
|
-
suggestionCount++;
|
|
50306
|
-
}
|
|
50307
|
-
});
|
|
50308
|
-
}
|
|
50309
|
-
return void 0;
|
|
50310
|
-
} else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) {
|
|
50311
|
-
return void 0;
|
|
50312
|
-
}
|
|
50313
|
-
if (nameNotFoundMessage) {
|
|
50314
|
-
addLazyDiagnostic(() => {
|
|
50315
|
-
var _a2;
|
|
50316
|
-
if (errorLocation && (meaning & 2 /* BlockScopedVariable */ || (meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */)) {
|
|
50317
|
-
const exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
|
|
50318
|
-
if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) {
|
|
50319
|
-
checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
|
|
50320
|
-
}
|
|
50321
|
-
}
|
|
50322
|
-
if (result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */ && !(originalLocation.flags & 16777216 /* JSDoc */)) {
|
|
50323
|
-
const merged = getMergedSymbol(result);
|
|
50324
|
-
if (length(merged.declarations) && every(merged.declarations, (d) => isNamespaceExportDeclaration(d) || isSourceFile(d) && !!d.symbol.globalExports)) {
|
|
50325
|
-
errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, unescapeLeadingUnderscores(name));
|
|
50326
|
-
}
|
|
50327
|
-
}
|
|
50328
|
-
if (result && associatedDeclarationForContainingInitializerOrBindingName && !withinDeferredContext && (meaning & 111551 /* Value */) === 111551 /* Value */) {
|
|
50329
|
-
const candidate = getMergedSymbol(getLateBoundSymbol(result));
|
|
50330
|
-
const root = getRootDeclaration(associatedDeclarationForContainingInitializerOrBindingName);
|
|
50331
|
-
if (candidate === getSymbolOfDeclaration(associatedDeclarationForContainingInitializerOrBindingName)) {
|
|
50332
|
-
error2(errorLocation, Diagnostics.Parameter_0_cannot_reference_itself, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name));
|
|
50333
|
-
} else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializerOrBindingName.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) {
|
|
50334
|
-
error2(errorLocation, Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), declarationNameToString(errorLocation));
|
|
50335
|
-
}
|
|
50336
|
-
}
|
|
50337
|
-
if (result && errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */ && !(result.flags & 111551 /* Value */) && !isValidTypeOnlyAliasUseSite(errorLocation)) {
|
|
50338
|
-
const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* Value */);
|
|
50339
|
-
if (typeOnlyDeclaration) {
|
|
50340
|
-
const message = typeOnlyDeclaration.kind === 281 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ || typeOnlyDeclaration.kind === 280 /* NamespaceExport */ ? Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type;
|
|
50341
|
-
const unescapedName = unescapeLeadingUnderscores(name);
|
|
50342
|
-
addTypeOnlyDeclarationRelatedInfo(
|
|
50343
|
-
error2(errorLocation, message, unescapedName),
|
|
50344
|
-
typeOnlyDeclaration,
|
|
50345
|
-
unescapedName
|
|
50346
|
-
);
|
|
50347
|
-
}
|
|
50348
|
-
}
|
|
50349
|
-
if (compilerOptions.isolatedModules && result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */) {
|
|
50350
|
-
const isGlobal = lookup(globals, name, meaning) === result;
|
|
50351
|
-
const nonValueSymbol = isGlobal && isSourceFile(lastLocation) && lastLocation.locals && lookup(lastLocation.locals, name, ~111551 /* Value */);
|
|
50352
|
-
if (nonValueSymbol) {
|
|
50353
|
-
const importDecl = (_a2 = nonValueSymbol.declarations) == null ? void 0 : _a2.find((d) => d.kind === 276 /* ImportSpecifier */ || d.kind === 273 /* ImportClause */ || d.kind === 274 /* NamespaceImport */ || d.kind === 271 /* ImportEqualsDeclaration */);
|
|
50354
|
-
if (importDecl && !isTypeOnlyImportDeclaration(importDecl)) {
|
|
50355
|
-
error2(importDecl, Diagnostics.Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled, unescapeLeadingUnderscores(name));
|
|
50356
|
-
}
|
|
50540
|
+
if (compilerOptions.isolatedModules && result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */) {
|
|
50541
|
+
const isGlobal = getSymbol2(globals, name, meaning) === result;
|
|
50542
|
+
const nonValueSymbol = isGlobal && isSourceFile(lastLocation) && lastLocation.locals && getSymbol2(lastLocation.locals, name, ~111551 /* Value */);
|
|
50543
|
+
if (nonValueSymbol) {
|
|
50544
|
+
const importDecl = (_a = nonValueSymbol.declarations) == null ? void 0 : _a.find((d) => d.kind === 276 /* ImportSpecifier */ || d.kind === 273 /* ImportClause */ || d.kind === 274 /* NamespaceImport */ || d.kind === 271 /* ImportEqualsDeclaration */);
|
|
50545
|
+
if (importDecl && !isTypeOnlyImportDeclaration(importDecl)) {
|
|
50546
|
+
error2(importDecl, Diagnostics.Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled, unescapeLeadingUnderscores(name));
|
|
50357
50547
|
}
|
|
50358
50548
|
}
|
|
50359
|
-
}
|
|
50360
|
-
}
|
|
50361
|
-
return result;
|
|
50549
|
+
}
|
|
50550
|
+
});
|
|
50362
50551
|
}
|
|
50363
50552
|
function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) {
|
|
50364
50553
|
if (!typeOnlyDeclaration)
|
|
@@ -50372,47 +50561,9 @@ function createTypeChecker(host) {
|
|
|
50372
50561
|
)
|
|
50373
50562
|
);
|
|
50374
50563
|
}
|
|
50375
|
-
function getIsDeferredContext(location, lastLocation) {
|
|
50376
|
-
if (location.kind !== 219 /* ArrowFunction */ && location.kind !== 218 /* FunctionExpression */) {
|
|
50377
|
-
return isTypeQueryNode(location) || (isFunctionLikeDeclaration(location) || location.kind === 172 /* PropertyDeclaration */ && !isStatic(location)) && (!lastLocation || lastLocation !== location.name);
|
|
50378
|
-
}
|
|
50379
|
-
if (lastLocation && lastLocation === location.name) {
|
|
50380
|
-
return false;
|
|
50381
|
-
}
|
|
50382
|
-
if (location.asteriskToken || hasSyntacticModifier(location, 1024 /* Async */)) {
|
|
50383
|
-
return true;
|
|
50384
|
-
}
|
|
50385
|
-
return !getImmediatelyInvokedFunctionExpression(location);
|
|
50386
|
-
}
|
|
50387
|
-
function isSelfReferenceLocation(node) {
|
|
50388
|
-
switch (node.kind) {
|
|
50389
|
-
case 262 /* FunctionDeclaration */:
|
|
50390
|
-
case 263 /* ClassDeclaration */:
|
|
50391
|
-
case 264 /* InterfaceDeclaration */:
|
|
50392
|
-
case 266 /* EnumDeclaration */:
|
|
50393
|
-
case 265 /* TypeAliasDeclaration */:
|
|
50394
|
-
case 267 /* ModuleDeclaration */:
|
|
50395
|
-
return true;
|
|
50396
|
-
default:
|
|
50397
|
-
return false;
|
|
50398
|
-
}
|
|
50399
|
-
}
|
|
50400
50564
|
function diagnosticName(nameArg) {
|
|
50401
50565
|
return isString(nameArg) ? unescapeLeadingUnderscores(nameArg) : declarationNameToString(nameArg);
|
|
50402
50566
|
}
|
|
50403
|
-
function isTypeParameterSymbolDeclaredInContainer(symbol, container) {
|
|
50404
|
-
if (symbol.declarations) {
|
|
50405
|
-
for (const decl of symbol.declarations) {
|
|
50406
|
-
if (decl.kind === 168 /* TypeParameter */) {
|
|
50407
|
-
const parent2 = isJSDocTemplateTag(decl.parent) ? getJSDocHost(decl.parent) : decl.parent;
|
|
50408
|
-
if (parent2 === container) {
|
|
50409
|
-
return !(isJSDocTemplateTag(decl.parent) && find(decl.parent.parent.tags, isJSDocTypeAlias));
|
|
50410
|
-
}
|
|
50411
|
-
}
|
|
50412
|
-
}
|
|
50413
|
-
}
|
|
50414
|
-
return false;
|
|
50415
|
-
}
|
|
50416
50567
|
function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) {
|
|
50417
50568
|
if (!isIdentifier(errorLocation) || errorLocation.escapedText !== name || isTypeReferenceIdentifier(errorLocation) || isInTypeQuery(errorLocation)) {
|
|
50418
50569
|
return false;
|
|
@@ -50483,8 +50634,6 @@ function createTypeChecker(host) {
|
|
|
50483
50634
|
788968 /* Type */ & ~namespaceMeaning,
|
|
50484
50635
|
/*nameNotFoundMessage*/
|
|
50485
50636
|
void 0,
|
|
50486
|
-
/*nameArg*/
|
|
50487
|
-
void 0,
|
|
50488
50637
|
/*isUse*/
|
|
50489
50638
|
false
|
|
50490
50639
|
));
|
|
@@ -50518,8 +50667,6 @@ function createTypeChecker(host) {
|
|
|
50518
50667
|
~788968 /* Type */ & 111551 /* Value */,
|
|
50519
50668
|
/*nameNotFoundMessage*/
|
|
50520
50669
|
void 0,
|
|
50521
|
-
/*nameArg*/
|
|
50522
|
-
void 0,
|
|
50523
50670
|
/*isUse*/
|
|
50524
50671
|
false
|
|
50525
50672
|
));
|
|
@@ -50565,8 +50712,6 @@ function createTypeChecker(host) {
|
|
|
50565
50712
|
788968 /* Type */ & ~111551 /* Value */,
|
|
50566
50713
|
/*nameNotFoundMessage*/
|
|
50567
50714
|
void 0,
|
|
50568
|
-
/*nameArg*/
|
|
50569
|
-
void 0,
|
|
50570
50715
|
/*isUse*/
|
|
50571
50716
|
false
|
|
50572
50717
|
));
|
|
@@ -50618,8 +50763,6 @@ function createTypeChecker(host) {
|
|
|
50618
50763
|
1024 /* NamespaceModule */,
|
|
50619
50764
|
/*nameNotFoundMessage*/
|
|
50620
50765
|
void 0,
|
|
50621
|
-
/*nameArg*/
|
|
50622
|
-
void 0,
|
|
50623
50766
|
/*isUse*/
|
|
50624
50767
|
false
|
|
50625
50768
|
));
|
|
@@ -50638,8 +50781,6 @@ function createTypeChecker(host) {
|
|
|
50638
50781
|
1536 /* Module */,
|
|
50639
50782
|
/*nameNotFoundMessage*/
|
|
50640
50783
|
void 0,
|
|
50641
|
-
/*nameArg*/
|
|
50642
|
-
void 0,
|
|
50643
50784
|
/*isUse*/
|
|
50644
50785
|
false
|
|
50645
50786
|
));
|
|
@@ -50770,22 +50911,28 @@ function createTypeChecker(host) {
|
|
|
50770
50911
|
function isSyntacticDefault(node) {
|
|
50771
50912
|
return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) || isNamespaceExport(node);
|
|
50772
50913
|
}
|
|
50773
|
-
function
|
|
50774
|
-
return isStringLiteralLike(usage) ? host.
|
|
50914
|
+
function getEmitSyntaxForModuleSpecifierExpression(usage) {
|
|
50915
|
+
return isStringLiteralLike(usage) ? host.getEmitSyntaxForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
|
|
50775
50916
|
}
|
|
50776
50917
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
50777
50918
|
return usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */;
|
|
50778
50919
|
}
|
|
50779
|
-
function
|
|
50780
|
-
|
|
50781
|
-
|
|
50920
|
+
function isOnlyImportableAsDefault(usage) {
|
|
50921
|
+
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
50922
|
+
const usageMode = getEmitSyntaxForModuleSpecifierExpression(usage);
|
|
50923
|
+
return usageMode === 99 /* ESNext */ && endsWith(usage.text, ".json" /* Json */);
|
|
50924
|
+
}
|
|
50925
|
+
return false;
|
|
50782
50926
|
}
|
|
50783
50927
|
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
|
|
50784
|
-
const usageMode = file &&
|
|
50785
|
-
if (file && usageMode !== void 0
|
|
50786
|
-
const
|
|
50787
|
-
if (usageMode === 99 /* ESNext */
|
|
50788
|
-
return
|
|
50928
|
+
const usageMode = file && getEmitSyntaxForModuleSpecifierExpression(usage);
|
|
50929
|
+
if (file && usageMode !== void 0) {
|
|
50930
|
+
const targetMode = host.getImpliedNodeFormatForEmit(file);
|
|
50931
|
+
if (usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */ && 100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
50932
|
+
return true;
|
|
50933
|
+
}
|
|
50934
|
+
if (usageMode === 99 /* ESNext */ && targetMode === 99 /* ESNext */) {
|
|
50935
|
+
return false;
|
|
50789
50936
|
}
|
|
50790
50937
|
}
|
|
50791
50938
|
if (!allowSyntheticDefaultImports) {
|
|
@@ -50844,7 +50991,7 @@ function createTypeChecker(host) {
|
|
|
50844
50991
|
if (!specifier) {
|
|
50845
50992
|
return exportDefaultSymbol;
|
|
50846
50993
|
}
|
|
50847
|
-
const hasDefaultOnly =
|
|
50994
|
+
const hasDefaultOnly = isOnlyImportableAsDefault(specifier);
|
|
50848
50995
|
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
50849
50996
|
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
50850
50997
|
if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
|
|
@@ -51048,7 +51195,7 @@ function createTypeChecker(host) {
|
|
|
51048
51195
|
let symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias);
|
|
51049
51196
|
if (symbolFromModule === void 0 && name.escapedText === "default" /* Default */) {
|
|
51050
51197
|
const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
|
51051
|
-
if (
|
|
51198
|
+
if (isOnlyImportableAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
51052
51199
|
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
51053
51200
|
}
|
|
51054
51201
|
}
|
|
@@ -51455,11 +51602,10 @@ function createTypeChecker(host) {
|
|
|
51455
51602
|
let left = getFirstIdentifier(node);
|
|
51456
51603
|
let symbol = resolveName(
|
|
51457
51604
|
left,
|
|
51458
|
-
left
|
|
51605
|
+
left,
|
|
51459
51606
|
111551 /* Value */,
|
|
51460
51607
|
/*nameNotFoundMessage*/
|
|
51461
51608
|
void 0,
|
|
51462
|
-
left,
|
|
51463
51609
|
/*isUse*/
|
|
51464
51610
|
true
|
|
51465
51611
|
);
|
|
@@ -51487,10 +51633,9 @@ function createTypeChecker(host) {
|
|
|
51487
51633
|
const symbolFromJSPrototype = isInJSFile(name) && !nodeIsSynthesized(name) ? resolveEntityNameFromAssignmentDeclaration(name, meaning) : void 0;
|
|
51488
51634
|
symbol = getMergedSymbol(resolveName(
|
|
51489
51635
|
location || name,
|
|
51490
|
-
name
|
|
51636
|
+
name,
|
|
51491
51637
|
meaning,
|
|
51492
51638
|
ignoreErrors || symbolFromJSPrototype ? void 0 : message,
|
|
51493
|
-
name,
|
|
51494
51639
|
/*isUse*/
|
|
51495
51640
|
true,
|
|
51496
51641
|
/*excludeGlobals*/
|
|
@@ -51586,11 +51731,10 @@ function createTypeChecker(host) {
|
|
|
51586
51731
|
if (secondaryLocation) {
|
|
51587
51732
|
return resolveName(
|
|
51588
51733
|
secondaryLocation,
|
|
51589
|
-
name
|
|
51734
|
+
name,
|
|
51590
51735
|
meaning,
|
|
51591
51736
|
/*nameNotFoundMessage*/
|
|
51592
51737
|
void 0,
|
|
51593
|
-
name,
|
|
51594
51738
|
/*isUse*/
|
|
51595
51739
|
true
|
|
51596
51740
|
);
|
|
@@ -51681,7 +51825,7 @@ function createTypeChecker(host) {
|
|
|
51681
51825
|
/*requireStringLiteralLikeArgument*/
|
|
51682
51826
|
true
|
|
51683
51827
|
) ? location.initializer.arguments[0] : void 0) || ((_c = findAncestor(location, isImportCall)) == null ? void 0 : _c.arguments[0]) || ((_d = findAncestor(location, isImportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _e.moduleReference.expression) || ((_f = findAncestor(location, isExportDeclaration)) == null ? void 0 : _f.moduleSpecifier);
|
|
51684
|
-
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile
|
|
51828
|
+
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : host.getDefaultResolutionModeForFile(currentSourceFile);
|
|
51685
51829
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
51686
51830
|
const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
|
|
51687
51831
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
@@ -51926,7 +52070,7 @@ function createTypeChecker(host) {
|
|
|
51926
52070
|
return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
|
|
51927
52071
|
}
|
|
51928
52072
|
const targetFile = (_a = moduleSymbol == null ? void 0 : moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
|
51929
|
-
const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(
|
|
52073
|
+
const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(getEmitSyntaxForModuleSpecifierExpression(reference), host.getImpliedNodeFormatForEmit(targetFile));
|
|
51930
52074
|
if (getESModuleInterop(compilerOptions) || isEsmCjsRef) {
|
|
51931
52075
|
let sigs = getSignaturesOfStructuredType(type, 0 /* Call */);
|
|
51932
52076
|
if (!sigs || !sigs.length) {
|
|
@@ -52288,14 +52432,6 @@ function createTypeChecker(host) {
|
|
|
52288
52432
|
function symbolIsValue(symbol, includeTypeOnlyMembers) {
|
|
52289
52433
|
return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && getSymbolFlags(symbol, !includeTypeOnlyMembers) & 111551 /* Value */);
|
|
52290
52434
|
}
|
|
52291
|
-
function findConstructorDeclaration(node) {
|
|
52292
|
-
const members = node.members;
|
|
52293
|
-
for (const member of members) {
|
|
52294
|
-
if (member.kind === 176 /* Constructor */ && nodeIsPresent(member.body)) {
|
|
52295
|
-
return member;
|
|
52296
|
-
}
|
|
52297
|
-
}
|
|
52298
|
-
}
|
|
52299
52435
|
function createType(flags) {
|
|
52300
52436
|
var _a;
|
|
52301
52437
|
const result = new Type28(checker, flags);
|
|
@@ -52777,8 +52913,6 @@ function createTypeChecker(host) {
|
|
|
52777
52913
|
meaning,
|
|
52778
52914
|
/*nameNotFoundMessage*/
|
|
52779
52915
|
void 0,
|
|
52780
|
-
/*nameArg*/
|
|
52781
|
-
void 0,
|
|
52782
52916
|
/*isUse*/
|
|
52783
52917
|
false
|
|
52784
52918
|
);
|
|
@@ -54349,8 +54483,6 @@ function createTypeChecker(host) {
|
|
|
54349
54483
|
111551 /* Value */ | 1048576 /* ExportValue */,
|
|
54350
54484
|
/*nameNotFoundMessage*/
|
|
54351
54485
|
void 0,
|
|
54352
|
-
/*nameArg*/
|
|
54353
|
-
void 0,
|
|
54354
54486
|
/*isUse*/
|
|
54355
54487
|
true
|
|
54356
54488
|
);
|
|
@@ -54491,14 +54623,16 @@ function createTypeChecker(host) {
|
|
|
54491
54623
|
return symbol.escapedName.substring(1, symbol.escapedName.length - 1);
|
|
54492
54624
|
}
|
|
54493
54625
|
}
|
|
54494
|
-
if (!context.
|
|
54626
|
+
if (!context.enclosingFile || !context.tracker.moduleResolverHost) {
|
|
54495
54627
|
if (ambientModuleSymbolRegex.test(symbol.escapedName)) {
|
|
54496
54628
|
return symbol.escapedName.substring(1, symbol.escapedName.length - 1);
|
|
54497
54629
|
}
|
|
54498
54630
|
return getSourceFileOfNode(getNonAugmentationDeclaration(symbol)).fileName;
|
|
54499
54631
|
}
|
|
54500
|
-
const
|
|
54501
|
-
const
|
|
54632
|
+
const enclosingDeclaration = getOriginalNode(context.enclosingDeclaration);
|
|
54633
|
+
const originalModuleSpecifier = canHaveModuleSpecifier(enclosingDeclaration) ? tryGetModuleSpecifierFromDeclaration(enclosingDeclaration) : void 0;
|
|
54634
|
+
const contextFile = context.enclosingFile;
|
|
54635
|
+
const resolutionMode = overrideImportMode || originalModuleSpecifier && host.getModeForUsageLocation(contextFile, originalModuleSpecifier) || contextFile && host.getDefaultResolutionModeForFile(contextFile);
|
|
54502
54636
|
const cacheKey = createModeAwareCacheKey(contextFile.path, resolutionMode);
|
|
54503
54637
|
const links = getSymbolLinks(symbol);
|
|
54504
54638
|
let specifier = links.specifierCache && links.specifierCache.get(cacheKey);
|
|
@@ -54674,7 +54808,6 @@ function createTypeChecker(host) {
|
|
|
54674
54808
|
788968 /* Type */,
|
|
54675
54809
|
/*nameNotFoundMessage*/
|
|
54676
54810
|
void 0,
|
|
54677
|
-
escapedName,
|
|
54678
54811
|
/*isUse*/
|
|
54679
54812
|
false
|
|
54680
54813
|
);
|
|
@@ -55235,22 +55368,16 @@ function createTypeChecker(host) {
|
|
|
55235
55368
|
return p.name && isIdentifier(p.name) && p.name.escapedText === "this" ? "this" : getEffectiveDotDotDotForParameter(p) ? `args` : `arg${index}`;
|
|
55236
55369
|
}
|
|
55237
55370
|
function rewriteModuleSpecifier(parent2, lit) {
|
|
55238
|
-
if (context.bundled) {
|
|
55239
|
-
|
|
55240
|
-
|
|
55241
|
-
|
|
55242
|
-
|
|
55243
|
-
|
|
55244
|
-
getCanonicalFileName,
|
|
55245
|
-
getCurrentDirectory: () => context.tracker.moduleResolverHost.getCurrentDirectory(),
|
|
55246
|
-
getCommonSourceDirectory: () => context.tracker.moduleResolverHost.getCommonSourceDirectory()
|
|
55247
|
-
};
|
|
55248
|
-
const newName = getResolvedExternalModuleName(resolverHost, targetFile);
|
|
55249
|
-
return factory.createStringLiteral(newName);
|
|
55371
|
+
if (context.bundled || context.enclosingFile !== getSourceFileOfNode(lit)) {
|
|
55372
|
+
const targetFile = getExternalModuleFileFromDeclaration(parent2);
|
|
55373
|
+
if (targetFile) {
|
|
55374
|
+
const newName = getSpecifierForModuleSymbol(targetFile.symbol, context);
|
|
55375
|
+
if (newName !== lit.text) {
|
|
55376
|
+
return setOriginalNode(factory.createStringLiteral(newName), lit);
|
|
55250
55377
|
}
|
|
55251
55378
|
}
|
|
55252
55379
|
}
|
|
55253
|
-
return lit;
|
|
55380
|
+
return visitNode(lit, visitExistingNodeTreeSymbols, isStringLiteral);
|
|
55254
55381
|
}
|
|
55255
55382
|
}
|
|
55256
55383
|
}
|
|
@@ -57006,11 +57133,10 @@ function createTypeChecker(host) {
|
|
|
57006
57133
|
if (node.parent && node.parent.kind === 277 /* ExportAssignment */) {
|
|
57007
57134
|
exportSymbol = resolveName(
|
|
57008
57135
|
node,
|
|
57009
|
-
node
|
|
57136
|
+
node,
|
|
57010
57137
|
111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
|
|
57011
57138
|
/*nameNotFoundMessage*/
|
|
57012
57139
|
void 0,
|
|
57013
|
-
node,
|
|
57014
57140
|
/*isUse*/
|
|
57015
57141
|
false
|
|
57016
57142
|
);
|
|
@@ -57043,8 +57169,6 @@ function createTypeChecker(host) {
|
|
|
57043
57169
|
111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */,
|
|
57044
57170
|
/*nameNotFoundMessage*/
|
|
57045
57171
|
void 0,
|
|
57046
|
-
/*nameArg*/
|
|
57047
|
-
void 0,
|
|
57048
57172
|
/*isUse*/
|
|
57049
57173
|
false
|
|
57050
57174
|
);
|
|
@@ -60864,8 +60988,6 @@ function createTypeChecker(host) {
|
|
|
60864
60988
|
111551 /* Value */,
|
|
60865
60989
|
/*nameNotFoundMessage*/
|
|
60866
60990
|
void 0,
|
|
60867
|
-
/*nameArg*/
|
|
60868
|
-
void 0,
|
|
60869
60991
|
/*isUse*/
|
|
60870
60992
|
false
|
|
60871
60993
|
);
|
|
@@ -61899,12 +62021,9 @@ function createTypeChecker(host) {
|
|
|
61899
62021
|
name,
|
|
61900
62022
|
meaning,
|
|
61901
62023
|
diagnostic,
|
|
61902
|
-
name,
|
|
61903
62024
|
/*isUse*/
|
|
61904
62025
|
false,
|
|
61905
62026
|
/*excludeGlobals*/
|
|
61906
|
-
false,
|
|
61907
|
-
/*getSpellingSuggestions*/
|
|
61908
62027
|
false
|
|
61909
62028
|
);
|
|
61910
62029
|
}
|
|
@@ -69289,7 +69408,6 @@ function createTypeChecker(host) {
|
|
|
69289
69408
|
788968 /* Type */,
|
|
69290
69409
|
/*nameNotFoundMessage*/
|
|
69291
69410
|
void 0,
|
|
69292
|
-
param.name.escapedText,
|
|
69293
69411
|
/*isUse*/
|
|
69294
69412
|
true
|
|
69295
69413
|
) || originalKeywordKind && isTypeNodeKind(originalKeywordKind))) {
|
|
@@ -70511,10 +70629,9 @@ function createTypeChecker(host) {
|
|
|
70511
70629
|
if (!links.resolvedSymbol) {
|
|
70512
70630
|
links.resolvedSymbol = !nodeIsMissing(node) && resolveName(
|
|
70513
70631
|
node,
|
|
70514
|
-
node
|
|
70632
|
+
node,
|
|
70515
70633
|
111551 /* Value */ | 1048576 /* ExportValue */,
|
|
70516
70634
|
getCannotFindNameDiagnosticForName(node),
|
|
70517
|
-
node,
|
|
70518
70635
|
!isWriteOnlyAccess(node),
|
|
70519
70636
|
/*excludeGlobals*/
|
|
70520
70637
|
false
|
|
@@ -73750,7 +73867,6 @@ function createTypeChecker(host) {
|
|
|
73750
73867
|
111551 /* Value */,
|
|
73751
73868
|
/*nameNotFoundMessage*/
|
|
73752
73869
|
void 0,
|
|
73753
|
-
id.escapedText,
|
|
73754
73870
|
/*isUse*/
|
|
73755
73871
|
true
|
|
73756
73872
|
);
|
|
@@ -73800,8 +73916,6 @@ function createTypeChecker(host) {
|
|
|
73800
73916
|
111551 /* Value */,
|
|
73801
73917
|
/*nameNotFoundMessage*/
|
|
73802
73918
|
void 0,
|
|
73803
|
-
/*nameArg*/
|
|
73804
|
-
void 0,
|
|
73805
73919
|
/*isUse*/
|
|
73806
73920
|
true,
|
|
73807
73921
|
/*excludeGlobals*/
|
|
@@ -75178,7 +75292,6 @@ function createTypeChecker(host) {
|
|
|
75178
75292
|
1920 /* Namespace */,
|
|
75179
75293
|
/*nameNotFoundMessage*/
|
|
75180
75294
|
void 0,
|
|
75181
|
-
namespaceName,
|
|
75182
75295
|
/*isUse*/
|
|
75183
75296
|
false
|
|
75184
75297
|
);
|
|
@@ -75393,7 +75506,6 @@ function createTypeChecker(host) {
|
|
|
75393
75506
|
jsxFactoryNamespace,
|
|
75394
75507
|
111551 /* Value */,
|
|
75395
75508
|
jsxFactoryRefErr,
|
|
75396
|
-
jsxFactoryNamespace,
|
|
75397
75509
|
/*isUse*/
|
|
75398
75510
|
true
|
|
75399
75511
|
);
|
|
@@ -75413,7 +75525,6 @@ function createTypeChecker(host) {
|
|
|
75413
75525
|
localJsxNamespace,
|
|
75414
75526
|
111551 /* Value */,
|
|
75415
75527
|
jsxFactoryRefErr,
|
|
75416
|
-
localJsxNamespace,
|
|
75417
75528
|
/*isUse*/
|
|
75418
75529
|
true
|
|
75419
75530
|
);
|
|
@@ -76134,38 +76245,34 @@ function createTypeChecker(host) {
|
|
|
76134
76245
|
const suggestion = getSuggestedSymbolForNonexistentProperty(name, containingType);
|
|
76135
76246
|
return suggestion && symbolName(suggestion);
|
|
76136
76247
|
}
|
|
76248
|
+
function getSuggestionForSymbolNameLookup(symbols, name, meaning) {
|
|
76249
|
+
const symbol = getSymbol2(symbols, name, meaning);
|
|
76250
|
+
if (symbol)
|
|
76251
|
+
return symbol;
|
|
76252
|
+
let candidates;
|
|
76253
|
+
if (symbols === globals) {
|
|
76254
|
+
const primitives = mapDefined(
|
|
76255
|
+
["string", "number", "boolean", "object", "bigint", "symbol"],
|
|
76256
|
+
(s) => symbols.has(s.charAt(0).toUpperCase() + s.slice(1)) ? createSymbol(524288 /* TypeAlias */, s) : void 0
|
|
76257
|
+
);
|
|
76258
|
+
candidates = primitives.concat(arrayFrom(symbols.values()));
|
|
76259
|
+
} else {
|
|
76260
|
+
candidates = arrayFrom(symbols.values());
|
|
76261
|
+
}
|
|
76262
|
+
return getSpellingSuggestionForName(unescapeLeadingUnderscores(name), candidates, meaning);
|
|
76263
|
+
}
|
|
76137
76264
|
function getSuggestedSymbolForNonexistentSymbol(location, outerName, meaning) {
|
|
76138
76265
|
Debug.assert(outerName !== void 0, "outername should always be defined");
|
|
76139
|
-
const result =
|
|
76266
|
+
const result = resolveNameForSymbolSuggestion(
|
|
76140
76267
|
location,
|
|
76141
76268
|
outerName,
|
|
76142
76269
|
meaning,
|
|
76143
76270
|
/*nameNotFoundMessage*/
|
|
76144
76271
|
void 0,
|
|
76145
|
-
outerName,
|
|
76146
76272
|
/*isUse*/
|
|
76147
76273
|
false,
|
|
76148
76274
|
/*excludeGlobals*/
|
|
76149
|
-
false
|
|
76150
|
-
/*getSpellingSuggestions*/
|
|
76151
|
-
true,
|
|
76152
|
-
(symbols, name, meaning2) => {
|
|
76153
|
-
Debug.assertEqual(outerName, name, "name should equal outerName");
|
|
76154
|
-
const symbol = getSymbol2(symbols, name, meaning2);
|
|
76155
|
-
if (symbol)
|
|
76156
|
-
return symbol;
|
|
76157
|
-
let candidates;
|
|
76158
|
-
if (symbols === globals) {
|
|
76159
|
-
const primitives = mapDefined(
|
|
76160
|
-
["string", "number", "boolean", "object", "bigint", "symbol"],
|
|
76161
|
-
(s) => symbols.has(s.charAt(0).toUpperCase() + s.slice(1)) ? createSymbol(524288 /* TypeAlias */, s) : void 0
|
|
76162
|
-
);
|
|
76163
|
-
candidates = primitives.concat(arrayFrom(symbols.values()));
|
|
76164
|
-
} else {
|
|
76165
|
-
candidates = arrayFrom(symbols.values());
|
|
76166
|
-
}
|
|
76167
|
-
return getSpellingSuggestionForName(unescapeLeadingUnderscores(name), candidates, meaning2);
|
|
76168
|
-
}
|
|
76275
|
+
false
|
|
76169
76276
|
);
|
|
76170
76277
|
return result;
|
|
76171
76278
|
}
|
|
@@ -77022,8 +77129,6 @@ function createTypeChecker(host) {
|
|
|
77022
77129
|
111551 /* Value */,
|
|
77023
77130
|
/*nameNotFoundMessage*/
|
|
77024
77131
|
void 0,
|
|
77025
|
-
/*nameArg*/
|
|
77026
|
-
void 0,
|
|
77027
77132
|
/*isUse*/
|
|
77028
77133
|
false
|
|
77029
77134
|
);
|
|
@@ -77363,6 +77468,7 @@ function createTypeChecker(host) {
|
|
|
77363
77468
|
candidateForTypeArgumentError = oldCandidateForTypeArgumentError;
|
|
77364
77469
|
}
|
|
77365
77470
|
function chooseOverload(candidates2, relation, isSingleNonGenericCandidate2, signatureHelpTrailingComma2 = false) {
|
|
77471
|
+
var _a, _b;
|
|
77366
77472
|
candidatesForArgumentError = void 0;
|
|
77367
77473
|
candidateForArgumentArityError = void 0;
|
|
77368
77474
|
candidateForTypeArgumentError = void 0;
|
|
@@ -77397,7 +77503,9 @@ function createTypeChecker(host) {
|
|
|
77397
77503
|
let checkCandidate;
|
|
77398
77504
|
let inferenceContext;
|
|
77399
77505
|
if (candidate.typeParameters) {
|
|
77400
|
-
|
|
77506
|
+
const paramLocation = (_b = (_a = candidate.typeParameters[0].symbol.declarations) == null ? void 0 : _a[0]) == null ? void 0 : _b.parent;
|
|
77507
|
+
const candidateParameterContext = paramLocation || (candidate.declaration && isConstructorDeclaration(candidate.declaration) ? candidate.declaration.parent : candidate.declaration);
|
|
77508
|
+
if (candidateParameterContext && findAncestor(node, (a) => a === candidateParameterContext)) {
|
|
77401
77509
|
candidate = getImplementationSignature(candidate);
|
|
77402
77510
|
}
|
|
77403
77511
|
let typeArgumentTypes;
|
|
@@ -78287,8 +78395,6 @@ function createTypeChecker(host) {
|
|
|
78287
78395
|
111551 /* Value */,
|
|
78288
78396
|
/*nameNotFoundMessage*/
|
|
78289
78397
|
void 0,
|
|
78290
|
-
/*nameArg*/
|
|
78291
|
-
void 0,
|
|
78292
78398
|
/*isUse*/
|
|
78293
78399
|
false
|
|
78294
78400
|
);
|
|
@@ -78345,7 +78451,7 @@ function createTypeChecker(host) {
|
|
|
78345
78451
|
return createAnonymousType(anonymousSymbol, memberTable, emptyArray, emptyArray, emptyArray);
|
|
78346
78452
|
}
|
|
78347
78453
|
function getTypeWithSyntheticDefaultOnly(type, symbol, originalSymbol, moduleSpecifier) {
|
|
78348
|
-
const hasDefaultOnly =
|
|
78454
|
+
const hasDefaultOnly = isOnlyImportableAsDefault(moduleSpecifier);
|
|
78349
78455
|
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
78350
78456
|
const synthType = type;
|
|
78351
78457
|
if (!synthType.defaultOnlyType) {
|
|
@@ -78406,8 +78512,6 @@ function createTypeChecker(host) {
|
|
|
78406
78512
|
111551 /* Value */,
|
|
78407
78513
|
/*nameNotFoundMessage*/
|
|
78408
78514
|
void 0,
|
|
78409
|
-
/*nameArg*/
|
|
78410
|
-
void 0,
|
|
78411
78515
|
/*isUse*/
|
|
78412
78516
|
true
|
|
78413
78517
|
);
|
|
@@ -80743,7 +80847,6 @@ function createTypeChecker(host) {
|
|
|
80743
80847
|
788968 /* Type */,
|
|
80744
80848
|
/*nameNotFoundMessage*/
|
|
80745
80849
|
void 0,
|
|
80746
|
-
name,
|
|
80747
80850
|
/*isUse*/
|
|
80748
80851
|
false
|
|
80749
80852
|
);
|
|
@@ -83031,8 +83134,6 @@ function createTypeChecker(host) {
|
|
|
83031
83134
|
meaning,
|
|
83032
83135
|
/*nameNotFoundMessage*/
|
|
83033
83136
|
void 0,
|
|
83034
|
-
/*nameArg*/
|
|
83035
|
-
void 0,
|
|
83036
83137
|
/*isUse*/
|
|
83037
83138
|
true
|
|
83038
83139
|
);
|
|
@@ -83687,7 +83788,7 @@ function createTypeChecker(host) {
|
|
|
83687
83788
|
});
|
|
83688
83789
|
}
|
|
83689
83790
|
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
|
|
83690
|
-
if (
|
|
83791
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) >= 5 /* ES2015 */) {
|
|
83691
83792
|
return;
|
|
83692
83793
|
}
|
|
83693
83794
|
if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
|
@@ -83784,8 +83885,6 @@ function createTypeChecker(host) {
|
|
|
83784
83885
|
3 /* Variable */,
|
|
83785
83886
|
/*nameNotFoundMessage*/
|
|
83786
83887
|
void 0,
|
|
83787
|
-
/*nameArg*/
|
|
83788
|
-
void 0,
|
|
83789
83888
|
/*isUse*/
|
|
83790
83889
|
false
|
|
83791
83890
|
);
|
|
@@ -85118,7 +85217,7 @@ function createTypeChecker(host) {
|
|
|
85118
85217
|
}
|
|
85119
85218
|
}
|
|
85120
85219
|
function checkClassNameCollisionWithObject(name) {
|
|
85121
|
-
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && (
|
|
85220
|
+
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && host.getEmitModuleFormatOfFile(getSourceFileOfNode(name)) < 5 /* ES2015 */) {
|
|
85122
85221
|
error2(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]);
|
|
85123
85222
|
}
|
|
85124
85223
|
}
|
|
@@ -86188,7 +86287,7 @@ function createTypeChecker(host) {
|
|
|
86188
86287
|
getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
|
|
86189
86288
|
}
|
|
86190
86289
|
}
|
|
86191
|
-
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ && (
|
|
86290
|
+
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ && host.getEmitModuleFormatOfFile(node.parent) === 1 /* CommonJS */) {
|
|
86192
86291
|
const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 95 /* ExportKeyword */);
|
|
86193
86292
|
if (exportModifier) {
|
|
86194
86293
|
error2(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
@@ -86398,8 +86497,10 @@ function createTypeChecker(host) {
|
|
|
86398
86497
|
}
|
|
86399
86498
|
}
|
|
86400
86499
|
}
|
|
86401
|
-
if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) && (
|
|
86500
|
+
if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
|
|
86402
86501
|
error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
86502
|
+
} else if (moduleKind === 200 /* Preserve */ && node.kind !== 271 /* ImportEqualsDeclaration */ && node.kind !== 260 /* VariableDeclaration */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
|
|
86503
|
+
error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve);
|
|
86403
86504
|
}
|
|
86404
86505
|
}
|
|
86405
86506
|
if (isImportSpecifier(node)) {
|
|
@@ -86441,7 +86542,7 @@ function createTypeChecker(host) {
|
|
|
86441
86542
|
function checkImportBinding(node) {
|
|
86442
86543
|
checkCollisionsForDeclarationName(node, node.name);
|
|
86443
86544
|
checkAliasSymbol(node);
|
|
86444
|
-
if (node.kind === 276 /* ImportSpecifier */ && idText(node.propertyName || node.name) === "default" && getESModuleInterop(compilerOptions) &&
|
|
86545
|
+
if (node.kind === 276 /* ImportSpecifier */ && idText(node.propertyName || node.name) === "default" && getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
|
|
86445
86546
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
86446
86547
|
}
|
|
86447
86548
|
}
|
|
@@ -86462,7 +86563,7 @@ function createTypeChecker(host) {
|
|
|
86462
86563
|
if (validForTypeAttributes && override) {
|
|
86463
86564
|
return;
|
|
86464
86565
|
}
|
|
86465
|
-
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier &&
|
|
86566
|
+
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getEmitSyntaxForModuleSpecifierExpression(declaration.moduleSpecifier);
|
|
86466
86567
|
if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
|
|
86467
86568
|
const message = isImportAttributes2 ? moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve : moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve;
|
|
86468
86569
|
return grammarErrorOnNode(node, message);
|
|
@@ -86495,7 +86596,7 @@ function createTypeChecker(host) {
|
|
|
86495
86596
|
if (importClause.namedBindings) {
|
|
86496
86597
|
if (importClause.namedBindings.kind === 274 /* NamespaceImport */) {
|
|
86497
86598
|
checkImportBinding(importClause.namedBindings);
|
|
86498
|
-
if (
|
|
86599
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && getESModuleInterop(compilerOptions)) {
|
|
86499
86600
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
86500
86601
|
}
|
|
86501
86602
|
} else {
|
|
@@ -86537,7 +86638,7 @@ function createTypeChecker(host) {
|
|
|
86537
86638
|
grammarErrorOnNode(node, Diagnostics.An_import_alias_cannot_use_import_type);
|
|
86538
86639
|
}
|
|
86539
86640
|
} else {
|
|
86540
|
-
if (
|
|
86641
|
+
if (5 /* ES2015 */ <= moduleKind && moduleKind <= 99 /* ESNext */ && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
|
|
86541
86642
|
grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
|
|
86542
86643
|
}
|
|
86543
86644
|
}
|
|
@@ -86566,7 +86667,7 @@ function createTypeChecker(host) {
|
|
|
86566
86667
|
} else if (node.exportClause) {
|
|
86567
86668
|
checkAliasSymbol(node.exportClause);
|
|
86568
86669
|
}
|
|
86569
|
-
if (
|
|
86670
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
|
|
86570
86671
|
if (node.exportClause) {
|
|
86571
86672
|
if (getESModuleInterop(compilerOptions)) {
|
|
86572
86673
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
@@ -86610,8 +86711,6 @@ function createTypeChecker(host) {
|
|
|
86610
86711
|
111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
|
|
86611
86712
|
/*nameNotFoundMessage*/
|
|
86612
86713
|
void 0,
|
|
86613
|
-
/*nameArg*/
|
|
86614
|
-
void 0,
|
|
86615
86714
|
/*isUse*/
|
|
86616
86715
|
true
|
|
86617
86716
|
);
|
|
@@ -86627,7 +86726,7 @@ function createTypeChecker(host) {
|
|
|
86627
86726
|
}
|
|
86628
86727
|
}
|
|
86629
86728
|
} else {
|
|
86630
|
-
if (getESModuleInterop(compilerOptions) &&
|
|
86729
|
+
if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && idText(node.propertyName || node.name) === "default") {
|
|
86631
86730
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
86632
86731
|
}
|
|
86633
86732
|
}
|
|
@@ -86653,7 +86752,7 @@ function createTypeChecker(host) {
|
|
|
86653
86752
|
if (typeAnnotationNode) {
|
|
86654
86753
|
checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression);
|
|
86655
86754
|
}
|
|
86656
|
-
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (
|
|
86755
|
+
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */;
|
|
86657
86756
|
if (node.expression.kind === 80 /* Identifier */) {
|
|
86658
86757
|
const id = node.expression;
|
|
86659
86758
|
const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
|
|
@@ -86733,7 +86832,7 @@ function createTypeChecker(host) {
|
|
|
86733
86832
|
grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
|
|
86734
86833
|
}
|
|
86735
86834
|
if (node.isExportEquals) {
|
|
86736
|
-
if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && (node.flags & 33554432 /* Ambient */ && getSourceFileOfNode(node)
|
|
86835
|
+
if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && (node.flags & 33554432 /* Ambient */ && host.getImpliedNodeFormatForEmit(getSourceFileOfNode(node)) === 99 /* ESNext */ || !(node.flags & 33554432 /* Ambient */) && host.getImpliedNodeFormatForEmit(getSourceFileOfNode(node)) !== 1 /* CommonJS */)) {
|
|
86737
86836
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
|
86738
86837
|
} else if (moduleKind === 4 /* System */ && !(node.flags & 33554432 /* Ambient */)) {
|
|
86739
86838
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
|
|
@@ -88028,8 +88127,6 @@ function createTypeChecker(host) {
|
|
|
88028
88127
|
111551 /* Value */,
|
|
88029
88128
|
/*nameNotFoundMessage*/
|
|
88030
88129
|
void 0,
|
|
88031
|
-
/*nameArg*/
|
|
88032
|
-
void 0,
|
|
88033
88130
|
/*isUse*/
|
|
88034
88131
|
false
|
|
88035
88132
|
)) {
|
|
@@ -88421,8 +88518,6 @@ function createTypeChecker(host) {
|
|
|
88421
88518
|
111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */,
|
|
88422
88519
|
/*nameNotFoundMessage*/
|
|
88423
88520
|
void 0,
|
|
88424
|
-
/*nameArg*/
|
|
88425
|
-
void 0,
|
|
88426
88521
|
/*isUse*/
|
|
88427
88522
|
true
|
|
88428
88523
|
);
|
|
@@ -88438,13 +88533,9 @@ function createTypeChecker(host) {
|
|
|
88438
88533
|
111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */,
|
|
88439
88534
|
/*nameNotFoundMessage*/
|
|
88440
88535
|
void 0,
|
|
88441
|
-
/*nameArg*/
|
|
88442
|
-
void 0,
|
|
88443
88536
|
/*isUse*/
|
|
88444
88537
|
true,
|
|
88445
88538
|
/*excludeGlobals*/
|
|
88446
|
-
void 0,
|
|
88447
|
-
/*getSpellingSuggestions*/
|
|
88448
88539
|
void 0
|
|
88449
88540
|
);
|
|
88450
88541
|
}
|
|
@@ -89122,7 +89213,7 @@ function createTypeChecker(host) {
|
|
|
89122
89213
|
break;
|
|
89123
89214
|
case 95 /* ExportKeyword */:
|
|
89124
89215
|
if (compilerOptions.verbatimModuleSyntax && !(node.flags & 33554432 /* Ambient */) && node.kind !== 265 /* TypeAliasDeclaration */ && node.kind !== 264 /* InterfaceDeclaration */ && // ModuleDeclaration needs to be checked that it is uninstantiated later
|
|
89125
|
-
node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 307 /* SourceFile */ && (
|
|
89216
|
+
node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 307 /* SourceFile */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
|
|
89126
89217
|
return grammarErrorOnNode(modifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
89127
89218
|
}
|
|
89128
89219
|
if (flags & 32 /* Export */) {
|
|
@@ -90033,7 +90124,7 @@ function createTypeChecker(host) {
|
|
|
90033
90124
|
const message = node.initializer ? Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type ? Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations : Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context;
|
|
90034
90125
|
return grammarErrorOnNode(node.exclamationToken, message);
|
|
90035
90126
|
}
|
|
90036
|
-
if ((
|
|
90127
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && !(node.parent.parent.flags & 33554432 /* Ambient */) && hasSyntacticModifier(node.parent.parent, 32 /* Export */)) {
|
|
90037
90128
|
checkESModuleMarker(node.name);
|
|
90038
90129
|
}
|
|
90039
90130
|
return !!blockScopeKind && checkGrammarNameInLetOrConstDeclarations(node.name);
|
|
@@ -90520,7 +90611,9 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host) {
|
|
|
90520
90611
|
isSourceOfProjectReferenceRedirect: (fileName) => host.isSourceOfProjectReferenceRedirect(fileName),
|
|
90521
90612
|
fileExists: (fileName) => host.fileExists(fileName),
|
|
90522
90613
|
getFileIncludeReasons: () => host.getFileIncludeReasons(),
|
|
90523
|
-
readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0
|
|
90614
|
+
readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0,
|
|
90615
|
+
getDefaultResolutionModeForFile: (file) => host.getDefaultResolutionModeForFile(file),
|
|
90616
|
+
getModeForResolutionAtIndex: (file, index) => host.getModeForResolutionAtIndex(file, index)
|
|
90524
90617
|
};
|
|
90525
90618
|
}
|
|
90526
90619
|
var SymbolTrackerImpl = class _SymbolTrackerImpl {
|
|
@@ -109953,6 +110046,9 @@ function transformModule(context) {
|
|
|
109953
110046
|
return updated;
|
|
109954
110047
|
}
|
|
109955
110048
|
function shouldEmitUnderscoreUnderscoreESModule() {
|
|
110049
|
+
if (hasJSFileExtension(currentSourceFile.fileName) && currentSourceFile.commonJsModuleIndicator && (!currentSourceFile.externalModuleIndicator || currentSourceFile.externalModuleIndicator === true)) {
|
|
110050
|
+
return false;
|
|
110051
|
+
}
|
|
109956
110052
|
if (!currentModuleInfo.exportEquals && isExternalModule(currentSourceFile)) {
|
|
109957
110053
|
return true;
|
|
109958
110054
|
}
|
|
@@ -110431,7 +110527,7 @@ function transformModule(context) {
|
|
|
110431
110527
|
case 354 /* PartiallyEmittedExpression */:
|
|
110432
110528
|
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
|
|
110433
110529
|
case 213 /* CallExpression */:
|
|
110434
|
-
if (isImportCall(node) && currentSourceFile
|
|
110530
|
+
if (isImportCall(node) && host.shouldTransformImportCall(currentSourceFile)) {
|
|
110435
110531
|
return visitImportCallExpression(node);
|
|
110436
110532
|
}
|
|
110437
110533
|
break;
|
|
@@ -113432,8 +113528,8 @@ function transformECMAScriptModule(context) {
|
|
|
113432
113528
|
}
|
|
113433
113529
|
}
|
|
113434
113530
|
|
|
113435
|
-
// src/compiler/transformers/module/
|
|
113436
|
-
function
|
|
113531
|
+
// src/compiler/transformers/module/impliedNodeFormatDependent.ts
|
|
113532
|
+
function transformImpliedNodeFormatDependentModule(context) {
|
|
113437
113533
|
const previousOnSubstituteNode = context.onSubstituteNode;
|
|
113438
113534
|
const previousOnEmitNode = context.onEmitNode;
|
|
113439
113535
|
const esmTransform = transformECMAScriptModule(context);
|
|
@@ -113444,6 +113540,7 @@ function transformNodeModule(context) {
|
|
|
113444
113540
|
const cjsTransform = transformModule(context);
|
|
113445
113541
|
const cjsOnSubstituteNode = context.onSubstituteNode;
|
|
113446
113542
|
const cjsOnEmitNode = context.onEmitNode;
|
|
113543
|
+
const getEmitModuleFormatOfFile2 = (file) => context.getEmitHost().getEmitModuleFormatOfFile(file);
|
|
113447
113544
|
context.onSubstituteNode = onSubstituteNode;
|
|
113448
113545
|
context.onEmitNode = onEmitNode;
|
|
113449
113546
|
context.enableSubstitution(307 /* SourceFile */);
|
|
@@ -113458,7 +113555,7 @@ function transformNodeModule(context) {
|
|
|
113458
113555
|
if (!currentSourceFile) {
|
|
113459
113556
|
return previousOnSubstituteNode(hint, node);
|
|
113460
113557
|
}
|
|
113461
|
-
if (currentSourceFile
|
|
113558
|
+
if (getEmitModuleFormatOfFile2(currentSourceFile) >= 5 /* ES2015 */) {
|
|
113462
113559
|
return esmOnSubstituteNode(hint, node);
|
|
113463
113560
|
}
|
|
113464
113561
|
return cjsOnSubstituteNode(hint, node);
|
|
@@ -113471,13 +113568,13 @@ function transformNodeModule(context) {
|
|
|
113471
113568
|
if (!currentSourceFile) {
|
|
113472
113569
|
return previousOnEmitNode(hint, node, emitCallback);
|
|
113473
113570
|
}
|
|
113474
|
-
if (currentSourceFile
|
|
113571
|
+
if (getEmitModuleFormatOfFile2(currentSourceFile) >= 5 /* ES2015 */) {
|
|
113475
113572
|
return esmOnEmitNode(hint, node, emitCallback);
|
|
113476
113573
|
}
|
|
113477
113574
|
return cjsOnEmitNode(hint, node, emitCallback);
|
|
113478
113575
|
}
|
|
113479
113576
|
function getModuleTransformForFile(file) {
|
|
113480
|
-
return file
|
|
113577
|
+
return getEmitModuleFormatOfFile2(file) >= 5 /* ES2015 */ ? esmTransform : cjsTransform;
|
|
113481
113578
|
}
|
|
113482
113579
|
function transformSourceFile(node) {
|
|
113483
113580
|
if (node.isDeclarationFile) {
|
|
@@ -115380,17 +115477,18 @@ function isProcessedComponent(node) {
|
|
|
115380
115477
|
// src/compiler/transformer.ts
|
|
115381
115478
|
function getModuleTransformer(moduleKind) {
|
|
115382
115479
|
switch (moduleKind) {
|
|
115480
|
+
case 200 /* Preserve */:
|
|
115481
|
+
return transformECMAScriptModule;
|
|
115383
115482
|
case 99 /* ESNext */:
|
|
115384
115483
|
case 7 /* ES2022 */:
|
|
115385
115484
|
case 6 /* ES2020 */:
|
|
115386
115485
|
case 5 /* ES2015 */:
|
|
115387
|
-
case 200 /* Preserve */:
|
|
115388
|
-
return transformECMAScriptModule;
|
|
115389
|
-
case 4 /* System */:
|
|
115390
|
-
return transformSystemModule;
|
|
115391
115486
|
case 100 /* Node16 */:
|
|
115392
115487
|
case 199 /* NodeNext */:
|
|
115393
|
-
|
|
115488
|
+
case 1 /* CommonJS */:
|
|
115489
|
+
return transformImpliedNodeFormatDependentModule;
|
|
115490
|
+
case 4 /* System */:
|
|
115491
|
+
return transformSystemModule;
|
|
115394
115492
|
default:
|
|
115395
115493
|
return transformModule;
|
|
115396
115494
|
}
|
|
@@ -116125,6 +116223,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
116125
116223
|
newLine: compilerOptions.newLine,
|
|
116126
116224
|
noEmitHelpers: compilerOptions.noEmitHelpers,
|
|
116127
116225
|
module: getEmitModuleKind(compilerOptions),
|
|
116226
|
+
moduleResolution: getEmitModuleResolutionKind(compilerOptions),
|
|
116128
116227
|
target: getEmitScriptTarget(compilerOptions),
|
|
116129
116228
|
sourceMap: compilerOptions.sourceMap,
|
|
116130
116229
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
@@ -116187,6 +116286,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
116187
116286
|
newLine: compilerOptions.newLine,
|
|
116188
116287
|
noEmitHelpers: true,
|
|
116189
116288
|
module: compilerOptions.module,
|
|
116289
|
+
moduleResolution: compilerOptions.moduleResolution,
|
|
116190
116290
|
target: compilerOptions.target,
|
|
116191
116291
|
sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
|
|
116192
116292
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
@@ -121752,7 +121852,6 @@ function getModeForUsageLocation(file, usage, compilerOptions) {
|
|
|
121752
121852
|
return getModeForUsageLocationWorker(file, usage, compilerOptions);
|
|
121753
121853
|
}
|
|
121754
121854
|
function getModeForUsageLocationWorker(file, usage, compilerOptions) {
|
|
121755
|
-
var _a;
|
|
121756
121855
|
if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
|
|
121757
121856
|
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
|
|
121758
121857
|
if (isTypeOnly) {
|
|
@@ -121768,20 +121867,28 @@ function getModeForUsageLocationWorker(file, usage, compilerOptions) {
|
|
|
121768
121867
|
return override;
|
|
121769
121868
|
}
|
|
121770
121869
|
}
|
|
121771
|
-
if (compilerOptions &&
|
|
121772
|
-
return usage
|
|
121773
|
-
usage.parent,
|
|
121774
|
-
/*requireStringLiteralLikeArgument*/
|
|
121775
|
-
false
|
|
121776
|
-
) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
121870
|
+
if (compilerOptions && importSyntaxAffectsModuleResolution(compilerOptions)) {
|
|
121871
|
+
return getEmitSyntaxForUsageLocationWorker(file, usage, compilerOptions);
|
|
121777
121872
|
}
|
|
121778
|
-
|
|
121873
|
+
}
|
|
121874
|
+
function getEmitSyntaxForUsageLocationWorker(file, usage, compilerOptions) {
|
|
121875
|
+
var _a;
|
|
121876
|
+
if (!compilerOptions) {
|
|
121779
121877
|
return void 0;
|
|
121780
|
-
if (file.impliedNodeFormat !== 99 /* ESNext */) {
|
|
121781
|
-
return isImportCall(walkUpParenthesizedExpressions(usage.parent)) ? 99 /* ESNext */ : 1 /* CommonJS */;
|
|
121782
121878
|
}
|
|
121783
121879
|
const exprParentParent = (_a = walkUpParenthesizedExpressions(usage.parent)) == null ? void 0 : _a.parent;
|
|
121784
|
-
|
|
121880
|
+
if (exprParentParent && isImportEqualsDeclaration(exprParentParent) || isRequireCall(
|
|
121881
|
+
usage.parent,
|
|
121882
|
+
/*requireStringLiteralLikeArgument*/
|
|
121883
|
+
false
|
|
121884
|
+
)) {
|
|
121885
|
+
return 1 /* CommonJS */;
|
|
121886
|
+
}
|
|
121887
|
+
if (isImportCall(walkUpParenthesizedExpressions(usage.parent))) {
|
|
121888
|
+
return shouldTransformImportCallWorker(file, compilerOptions) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
121889
|
+
}
|
|
121890
|
+
const fileEmitMode = getEmitModuleFormatOfFileWorker(file, compilerOptions);
|
|
121891
|
+
return fileEmitMode === 1 /* CommonJS */ ? 1 /* CommonJS */ : emitModuleKindIsNonNodeESM(fileEmitMode) || fileEmitMode === 200 /* Preserve */ ? 99 /* ESNext */ : void 0;
|
|
121785
121892
|
}
|
|
121786
121893
|
function getResolutionModeOverride(node, grammarErrorOnNode) {
|
|
121787
121894
|
if (!node)
|
|
@@ -121841,7 +121948,7 @@ function getTypeReferenceResolutionName(entry) {
|
|
|
121841
121948
|
}
|
|
121842
121949
|
var typeReferenceResolutionNameAndModeGetter = {
|
|
121843
121950
|
getName: getTypeReferenceResolutionName,
|
|
121844
|
-
getMode: (entry, file) => getModeForFileReference(entry, file
|
|
121951
|
+
getMode: (entry, file, compilerOptions) => getModeForFileReference(entry, file && getDefaultResolutionModeForFileWorker(file, compilerOptions))
|
|
121845
121952
|
};
|
|
121846
121953
|
function createTypeReferenceResolutionLoader(containingFile, redirectedReference, options, host, cache) {
|
|
121847
121954
|
return {
|
|
@@ -122029,13 +122136,7 @@ function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, optio
|
|
|
122029
122136
|
return typeof result === "object" ? result.impliedNodeFormat : result;
|
|
122030
122137
|
}
|
|
122031
122138
|
function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
|
|
122032
|
-
|
|
122033
|
-
case 3 /* Node16 */:
|
|
122034
|
-
case 99 /* NodeNext */:
|
|
122035
|
-
return fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? 99 /* ESNext */ : fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? 1 /* CommonJS */ : fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() : void 0;
|
|
122036
|
-
default:
|
|
122037
|
-
return void 0;
|
|
122038
|
-
}
|
|
122139
|
+
return fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? 99 /* ESNext */ : fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? 1 /* CommonJS */ : fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() : void 0;
|
|
122039
122140
|
function lookupFromPackageJson() {
|
|
122040
122141
|
const state = getTemporaryModuleResolutionState(packageJsonInfoCache, host, options);
|
|
122041
122142
|
const packageJsonLocations = [];
|
|
@@ -122485,6 +122586,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122485
122586
|
isSourceFileFromExternalLibrary,
|
|
122486
122587
|
isSourceFileDefaultLibrary,
|
|
122487
122588
|
getModeForUsageLocation: getModeForUsageLocation2,
|
|
122589
|
+
getEmitSyntaxForUsageLocation,
|
|
122488
122590
|
getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
|
|
122489
122591
|
getSourceFileFromReference,
|
|
122490
122592
|
getLibFileFromReference,
|
|
@@ -122512,6 +122614,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122512
122614
|
forEachResolvedProjectReference: forEachResolvedProjectReference2,
|
|
122513
122615
|
isSourceOfProjectReferenceRedirect,
|
|
122514
122616
|
getRedirectReferenceForResolutionFromSourceOfProject,
|
|
122617
|
+
getCompilerOptionsForFile,
|
|
122618
|
+
getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
|
|
122619
|
+
getEmitModuleFormatOfFile: getEmitModuleFormatOfFile2,
|
|
122620
|
+
getImpliedNodeFormatForEmit: getImpliedNodeFormatForEmit2,
|
|
122621
|
+
shouldTransformImportCall,
|
|
122515
122622
|
emitBuildInfo,
|
|
122516
122623
|
fileExists,
|
|
122517
122624
|
readFile,
|
|
@@ -123075,6 +123182,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123075
123182
|
getSymlinkCache,
|
|
123076
123183
|
writeFile: writeFileCallback || writeFile2,
|
|
123077
123184
|
isEmitBlocked,
|
|
123185
|
+
shouldTransformImportCall,
|
|
123186
|
+
getEmitModuleFormatOfFile: getEmitModuleFormatOfFile2,
|
|
123187
|
+
getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
|
|
123188
|
+
getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
|
|
123078
123189
|
readFile: (f) => host.readFile(f),
|
|
123079
123190
|
fileExists: (f) => {
|
|
123080
123191
|
const path = toPath3(f);
|
|
@@ -124110,10 +124221,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124110
124221
|
const resolvedTypeReferenceDirective = resolutions[index];
|
|
124111
124222
|
const fileName = toFileNameLowerCase(ref.fileName);
|
|
124112
124223
|
resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
|
|
124113
|
-
const mode = ref.resolutionMode || file
|
|
124224
|
+
const mode = ref.resolutionMode || getDefaultResolutionModeForFile2(file);
|
|
124114
124225
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
|
|
124115
124226
|
}
|
|
124116
124227
|
}
|
|
124228
|
+
function getCompilerOptionsForFile(file) {
|
|
124229
|
+
var _a2;
|
|
124230
|
+
return ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
|
|
124231
|
+
}
|
|
124117
124232
|
function processTypeReferenceDirective(typeReferenceDirective, mode, resolution, reason) {
|
|
124118
124233
|
var _a2, _b2;
|
|
124119
124234
|
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolution.resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : void 0 });
|
|
@@ -124261,13 +124376,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124261
124376
|
return host.getCanonicalFileName(fileName);
|
|
124262
124377
|
}
|
|
124263
124378
|
function processImportedModules(file) {
|
|
124264
|
-
var _a2;
|
|
124265
124379
|
collectExternalModuleReferences(file);
|
|
124266
124380
|
if (file.imports.length || file.moduleAugmentations.length) {
|
|
124267
124381
|
const moduleNames = getModuleNames(file);
|
|
124268
124382
|
const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
|
|
124269
124383
|
Debug.assert(resolutions.length === moduleNames.length);
|
|
124270
|
-
const optionsForFile = (
|
|
124384
|
+
const optionsForFile = getCompilerOptionsForFile(file);
|
|
124271
124385
|
const resolutionsInFile = createModeAwareCache();
|
|
124272
124386
|
(resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
|
|
124273
124387
|
for (let index = 0; index < moduleNames.length; index++) {
|
|
@@ -124803,7 +124917,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124803
124917
|
fileIncludeReasons = void 0;
|
|
124804
124918
|
const location = locationReason && getReferencedFileLocation(program, locationReason);
|
|
124805
124919
|
const fileIncludeReasonDetails = fileIncludeReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
|
|
124806
|
-
const
|
|
124920
|
+
const optionsForFile = file && getCompilerOptionsForFile(file) || options;
|
|
124921
|
+
const redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, optionsForFile);
|
|
124807
124922
|
const chain = chainDiagnosticMessages(redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails, diagnostic, ...args || emptyArray);
|
|
124808
124923
|
return location && isReferenceFileLocation(location) ? createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) : createCompilerDiagnosticFromMessageChain(chain, relatedInfo);
|
|
124809
124924
|
function processReason(reason) {
|
|
@@ -125104,13 +125219,53 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
125104
125219
|
return symlinks;
|
|
125105
125220
|
}
|
|
125106
125221
|
function getModeForUsageLocation2(file, usage) {
|
|
125107
|
-
|
|
125108
|
-
|
|
125109
|
-
|
|
125222
|
+
return getModeForUsageLocationWorker(file, usage, getCompilerOptionsForFile(file));
|
|
125223
|
+
}
|
|
125224
|
+
function getEmitSyntaxForUsageLocation(file, usage) {
|
|
125225
|
+
return getEmitSyntaxForUsageLocationWorker(file, usage, getCompilerOptionsForFile(file));
|
|
125110
125226
|
}
|
|
125111
125227
|
function getModeForResolutionAtIndex2(file, index) {
|
|
125112
125228
|
return getModeForUsageLocation2(file, getModuleNameStringLiteralAt(file, index));
|
|
125113
125229
|
}
|
|
125230
|
+
function getDefaultResolutionModeForFile2(sourceFile) {
|
|
125231
|
+
return getDefaultResolutionModeForFileWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
125232
|
+
}
|
|
125233
|
+
function getImpliedNodeFormatForEmit2(sourceFile) {
|
|
125234
|
+
return getImpliedNodeFormatForEmitWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
125235
|
+
}
|
|
125236
|
+
function getEmitModuleFormatOfFile2(sourceFile) {
|
|
125237
|
+
return getEmitModuleFormatOfFileWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
125238
|
+
}
|
|
125239
|
+
function shouldTransformImportCall(sourceFile) {
|
|
125240
|
+
return shouldTransformImportCallWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
125241
|
+
}
|
|
125242
|
+
}
|
|
125243
|
+
function shouldTransformImportCallWorker(sourceFile, options) {
|
|
125244
|
+
const moduleKind = getEmitModuleKind(options);
|
|
125245
|
+
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ || moduleKind === 200 /* Preserve */) {
|
|
125246
|
+
return false;
|
|
125247
|
+
}
|
|
125248
|
+
return getEmitModuleFormatOfFileWorker(sourceFile, options) < 5 /* ES2015 */;
|
|
125249
|
+
}
|
|
125250
|
+
function getEmitModuleFormatOfFileWorker(sourceFile, options) {
|
|
125251
|
+
return getImpliedNodeFormatForEmitWorker(sourceFile, options) ?? getEmitModuleKind(options);
|
|
125252
|
+
}
|
|
125253
|
+
function getImpliedNodeFormatForEmitWorker(sourceFile, options) {
|
|
125254
|
+
var _a, _b;
|
|
125255
|
+
const moduleKind = getEmitModuleKind(options);
|
|
125256
|
+
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
125257
|
+
return sourceFile.impliedNodeFormat;
|
|
125258
|
+
}
|
|
125259
|
+
if (sourceFile.impliedNodeFormat === 1 /* CommonJS */ && (((_a = sourceFile.packageJsonScope) == null ? void 0 : _a.contents.packageJsonContent.type) === "commonjs" || fileExtensionIsOneOf(sourceFile.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */]))) {
|
|
125260
|
+
return 1 /* CommonJS */;
|
|
125261
|
+
}
|
|
125262
|
+
if (sourceFile.impliedNodeFormat === 99 /* ESNext */ && (((_b = sourceFile.packageJsonScope) == null ? void 0 : _b.contents.packageJsonContent.type) === "module" || fileExtensionIsOneOf(sourceFile.fileName, [".mjs" /* Mjs */, ".mts" /* Mts */]))) {
|
|
125263
|
+
return 99 /* ESNext */;
|
|
125264
|
+
}
|
|
125265
|
+
return void 0;
|
|
125266
|
+
}
|
|
125267
|
+
function getDefaultResolutionModeForFileWorker(sourceFile, options) {
|
|
125268
|
+
return importSyntaxAffectsModuleResolution(options) ? getImpliedNodeFormatForEmitWorker(sourceFile, options) : void 0;
|
|
125114
125269
|
}
|
|
125115
125270
|
function updateHostForUseSourceOfProjectReferenceRedirect(host) {
|
|
125116
125271
|
let setOfDeclarationDirectories;
|
|
@@ -127121,9 +127276,15 @@ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLoo
|
|
|
127121
127276
|
const nodeModulesIndex = failedLookupPathComponents.indexOf("node_modules");
|
|
127122
127277
|
if (nodeModulesIndex !== -1 && nodeModulesIndex + 1 <= perceivedOsRootLength + 1)
|
|
127123
127278
|
return void 0;
|
|
127279
|
+
const lastNodeModulesIndex = failedLookupPathComponents.lastIndexOf("node_modules");
|
|
127124
127280
|
if (isInDirectoryPath(rootPathComponents, failedLookupPathComponents)) {
|
|
127125
127281
|
if (failedLookupPathComponents.length > rootPathComponents.length + 1) {
|
|
127126
|
-
return getDirectoryOfFailedLookupWatch(
|
|
127282
|
+
return getDirectoryOfFailedLookupWatch(
|
|
127283
|
+
failedLookupComponents,
|
|
127284
|
+
failedLookupPathComponents,
|
|
127285
|
+
Math.max(rootPathComponents.length + 1, perceivedOsRootLength + 1),
|
|
127286
|
+
lastNodeModulesIndex
|
|
127287
|
+
);
|
|
127127
127288
|
} else {
|
|
127128
127289
|
return {
|
|
127129
127290
|
dir: rootDir,
|
|
@@ -127138,12 +127299,18 @@ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLoo
|
|
|
127138
127299
|
failedLookupPathComponents.length - 1,
|
|
127139
127300
|
perceivedOsRootLength,
|
|
127140
127301
|
nodeModulesIndex,
|
|
127141
|
-
rootPathComponents
|
|
127302
|
+
rootPathComponents,
|
|
127303
|
+
lastNodeModulesIndex
|
|
127142
127304
|
);
|
|
127143
127305
|
}
|
|
127144
|
-
function getDirectoryToWatchFromFailedLookupLocationDirectory(dirComponents, dirPathComponents, dirPathComponentsLength, perceivedOsRootLength, nodeModulesIndex, rootPathComponents) {
|
|
127306
|
+
function getDirectoryToWatchFromFailedLookupLocationDirectory(dirComponents, dirPathComponents, dirPathComponentsLength, perceivedOsRootLength, nodeModulesIndex, rootPathComponents, lastNodeModulesIndex) {
|
|
127145
127307
|
if (nodeModulesIndex !== -1) {
|
|
127146
|
-
return getDirectoryOfFailedLookupWatch(
|
|
127308
|
+
return getDirectoryOfFailedLookupWatch(
|
|
127309
|
+
dirComponents,
|
|
127310
|
+
dirPathComponents,
|
|
127311
|
+
nodeModulesIndex + 1,
|
|
127312
|
+
lastNodeModulesIndex
|
|
127313
|
+
);
|
|
127147
127314
|
}
|
|
127148
127315
|
let nonRecursive = true;
|
|
127149
127316
|
let length2 = dirPathComponentsLength;
|
|
@@ -127154,13 +127321,29 @@ function getDirectoryToWatchFromFailedLookupLocationDirectory(dirComponents, dir
|
|
|
127154
127321
|
break;
|
|
127155
127322
|
}
|
|
127156
127323
|
}
|
|
127157
|
-
return getDirectoryOfFailedLookupWatch(
|
|
127324
|
+
return getDirectoryOfFailedLookupWatch(
|
|
127325
|
+
dirComponents,
|
|
127326
|
+
dirPathComponents,
|
|
127327
|
+
length2,
|
|
127328
|
+
lastNodeModulesIndex,
|
|
127329
|
+
nonRecursive
|
|
127330
|
+
);
|
|
127158
127331
|
}
|
|
127159
|
-
function getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, length2, nonRecursive) {
|
|
127332
|
+
function getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, length2, lastNodeModulesIndex, nonRecursive) {
|
|
127333
|
+
let packageDirLength;
|
|
127334
|
+
if (lastNodeModulesIndex !== -1 && lastNodeModulesIndex + 1 >= length2 && lastNodeModulesIndex + 2 < dirPathComponents.length) {
|
|
127335
|
+
if (!startsWith(dirPathComponents[lastNodeModulesIndex + 1], "@")) {
|
|
127336
|
+
packageDirLength = lastNodeModulesIndex + 2;
|
|
127337
|
+
} else if (lastNodeModulesIndex + 3 < dirPathComponents.length) {
|
|
127338
|
+
packageDirLength = lastNodeModulesIndex + 3;
|
|
127339
|
+
}
|
|
127340
|
+
}
|
|
127160
127341
|
return {
|
|
127161
127342
|
dir: getPathFromPathComponents(dirComponents, length2),
|
|
127162
127343
|
dirPath: getPathFromPathComponents(dirPathComponents, length2),
|
|
127163
|
-
nonRecursive
|
|
127344
|
+
nonRecursive,
|
|
127345
|
+
packageDir: packageDirLength !== void 0 ? getPathFromPathComponents(dirComponents, packageDirLength) : void 0,
|
|
127346
|
+
packageDirPath: packageDirLength !== void 0 ? getPathFromPathComponents(dirPathComponents, packageDirLength) : void 0
|
|
127164
127347
|
};
|
|
127165
127348
|
}
|
|
127166
127349
|
function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, rootPathComponents, getCurrentDirectory, filterCustomPath) {
|
|
@@ -127175,7 +127358,8 @@ function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootP
|
|
|
127175
127358
|
typeRootPathComponents.length,
|
|
127176
127359
|
perceivedOsRootLengthForWatching(typeRootPathComponents, typeRootPathComponents.length),
|
|
127177
127360
|
typeRootPathComponents.indexOf("node_modules"),
|
|
127178
|
-
rootPathComponents
|
|
127361
|
+
rootPathComponents,
|
|
127362
|
+
typeRootPathComponents.lastIndexOf("node_modules")
|
|
127179
127363
|
);
|
|
127180
127364
|
return toWatch && filterCustomPath(toWatch.dirPath) ? toWatch.dirPath : void 0;
|
|
127181
127365
|
}
|
|
@@ -127274,6 +127458,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127274
127458
|
const rootDir = getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory);
|
|
127275
127459
|
const rootPath = resolutionHost.toPath(rootDir);
|
|
127276
127460
|
const rootPathComponents = getPathComponents(rootPath);
|
|
127461
|
+
const isSymlinkCache = /* @__PURE__ */ new Map();
|
|
127462
|
+
const packageDirWatchers = /* @__PURE__ */ new Map();
|
|
127463
|
+
const dirPathToSymlinkPackageRefCount = /* @__PURE__ */ new Map();
|
|
127277
127464
|
const typeRootsWatches = /* @__PURE__ */ new Map();
|
|
127278
127465
|
return {
|
|
127279
127466
|
rootDirForResolution,
|
|
@@ -127285,6 +127472,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127285
127472
|
resolutionsWithOnlyAffectingLocations,
|
|
127286
127473
|
directoryWatchesOfFailedLookups,
|
|
127287
127474
|
fileWatchesOfAffectingLocations,
|
|
127475
|
+
packageDirWatchers,
|
|
127476
|
+
dirPathToSymlinkPackageRefCount,
|
|
127288
127477
|
watchFailedLookupLocationsOfExternalModuleResolutions,
|
|
127289
127478
|
getModuleResolutionCache: () => moduleResolutionCache,
|
|
127290
127479
|
startRecordingFilesWithChangedResolutions,
|
|
@@ -127319,6 +127508,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127319
127508
|
function clear2() {
|
|
127320
127509
|
clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
|
|
127321
127510
|
clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
|
|
127511
|
+
isSymlinkCache.clear();
|
|
127512
|
+
packageDirWatchers.clear();
|
|
127513
|
+
dirPathToSymlinkPackageRefCount.clear();
|
|
127322
127514
|
nonRelativeExternalModuleResolutions.clear();
|
|
127323
127515
|
closeTypeRootsWatch();
|
|
127324
127516
|
resolvedModuleNames.clear();
|
|
@@ -127385,6 +127577,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127385
127577
|
libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
127386
127578
|
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
127387
127579
|
nonRelativeExternalModuleResolutions.clear();
|
|
127580
|
+
isSymlinkCache.clear();
|
|
127388
127581
|
}
|
|
127389
127582
|
function cleanupLibResolutionWatching(newProgram) {
|
|
127390
127583
|
resolvedLibraries.forEach((resolution, libFileName) => {
|
|
@@ -127437,11 +127630,18 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127437
127630
|
}
|
|
127438
127631
|
directoryWatchesOfFailedLookups.forEach(closeDirectoryWatchesOfFailedLookup);
|
|
127439
127632
|
fileWatchesOfAffectingLocations.forEach(closeFileWatcherOfAffectingLocation);
|
|
127633
|
+
packageDirWatchers.forEach(closePackageDirWatcher);
|
|
127440
127634
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
127441
127635
|
moduleResolutionCache.isReadonly = true;
|
|
127442
127636
|
typeReferenceDirectiveResolutionCache.isReadonly = true;
|
|
127443
127637
|
libraryResolutionCache.isReadonly = true;
|
|
127444
127638
|
moduleResolutionCache.getPackageJsonInfoCache().isReadonly = true;
|
|
127639
|
+
isSymlinkCache.clear();
|
|
127640
|
+
}
|
|
127641
|
+
function closePackageDirWatcher(watcher, packageDirPath) {
|
|
127642
|
+
if (watcher.dirPathToWatcher.size === 0) {
|
|
127643
|
+
packageDirWatchers.delete(packageDirPath);
|
|
127644
|
+
}
|
|
127445
127645
|
}
|
|
127446
127646
|
function closeDirectoryWatchesOfFailedLookup(watcher, path) {
|
|
127447
127647
|
if (watcher.refCount === 0) {
|
|
@@ -127691,12 +127891,13 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127691
127891
|
getCurrentDirectory
|
|
127692
127892
|
);
|
|
127693
127893
|
if (toWatch) {
|
|
127694
|
-
const { dir, dirPath, nonRecursive } = toWatch;
|
|
127894
|
+
const { dir, dirPath, nonRecursive, packageDir, packageDirPath } = toWatch;
|
|
127695
127895
|
if (dirPath === rootPath) {
|
|
127696
127896
|
Debug.assert(nonRecursive);
|
|
127897
|
+
Debug.assert(!packageDir);
|
|
127697
127898
|
setAtRoot = true;
|
|
127698
127899
|
} else {
|
|
127699
|
-
setDirectoryWatcher(dir, dirPath, nonRecursive);
|
|
127900
|
+
setDirectoryWatcher(dir, dirPath, packageDir, packageDirPath, nonRecursive);
|
|
127700
127901
|
}
|
|
127701
127902
|
}
|
|
127702
127903
|
return setAtRoot;
|
|
@@ -127720,6 +127921,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127720
127921
|
setDirectoryWatcher(
|
|
127721
127922
|
rootDir,
|
|
127722
127923
|
rootPath,
|
|
127924
|
+
/*packageDir*/
|
|
127925
|
+
void 0,
|
|
127926
|
+
/*packageDirPath*/
|
|
127927
|
+
void 0,
|
|
127723
127928
|
/*nonRecursive*/
|
|
127724
127929
|
true
|
|
127725
127930
|
);
|
|
@@ -127820,14 +128025,68 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127820
128025
|
));
|
|
127821
128026
|
}
|
|
127822
128027
|
}
|
|
127823
|
-
function
|
|
127824
|
-
|
|
128028
|
+
function createDirectoryWatcherForPackageDir(dir, dirPath, packageDir, packageDirPath, nonRecursive) {
|
|
128029
|
+
Debug.assert(!nonRecursive);
|
|
128030
|
+
let isSymlink = isSymlinkCache.get(packageDirPath);
|
|
128031
|
+
let packageDirWatcher = packageDirWatchers.get(packageDirPath);
|
|
128032
|
+
if (isSymlink === void 0) {
|
|
128033
|
+
const realPath2 = resolutionHost.realpath(packageDir);
|
|
128034
|
+
isSymlink = realPath2 !== packageDir && resolutionHost.toPath(realPath2) !== packageDirPath;
|
|
128035
|
+
isSymlinkCache.set(packageDirPath, isSymlink);
|
|
128036
|
+
if (!packageDirWatcher) {
|
|
128037
|
+
packageDirWatchers.set(
|
|
128038
|
+
packageDirPath,
|
|
128039
|
+
packageDirWatcher = {
|
|
128040
|
+
dirPathToWatcher: /* @__PURE__ */ new Map(),
|
|
128041
|
+
isSymlink
|
|
128042
|
+
}
|
|
128043
|
+
);
|
|
128044
|
+
} else if (packageDirWatcher.isSymlink !== isSymlink) {
|
|
128045
|
+
packageDirWatcher.dirPathToWatcher.forEach((watcher) => {
|
|
128046
|
+
removeDirectoryWatcher(
|
|
128047
|
+
packageDirWatcher.isSymlink ? packageDirPath : dirPath,
|
|
128048
|
+
/*syncDirWatcherRemove*/
|
|
128049
|
+
false
|
|
128050
|
+
);
|
|
128051
|
+
watcher.watcher = createDirPathToWatcher();
|
|
128052
|
+
});
|
|
128053
|
+
packageDirWatcher.isSymlink = isSymlink;
|
|
128054
|
+
}
|
|
128055
|
+
} else {
|
|
128056
|
+
Debug.assertIsDefined(packageDirWatcher);
|
|
128057
|
+
Debug.assert(isSymlink === packageDirWatcher.isSymlink);
|
|
128058
|
+
}
|
|
128059
|
+
const forDirPath = packageDirWatcher.dirPathToWatcher.get(dirPath);
|
|
128060
|
+
if (forDirPath) {
|
|
128061
|
+
forDirPath.refCount++;
|
|
128062
|
+
} else {
|
|
128063
|
+
packageDirWatcher.dirPathToWatcher.set(dirPath, {
|
|
128064
|
+
watcher: createDirPathToWatcher(),
|
|
128065
|
+
refCount: 1
|
|
128066
|
+
});
|
|
128067
|
+
if (isSymlink)
|
|
128068
|
+
dirPathToSymlinkPackageRefCount.set(dirPath, (dirPathToSymlinkPackageRefCount.get(dirPath) ?? 0) + 1);
|
|
128069
|
+
}
|
|
128070
|
+
function createDirPathToWatcher() {
|
|
128071
|
+
return isSymlink ? createOrAddRefToDirectoryWatchOfFailedLookups(packageDir, packageDirPath, nonRecursive) : createOrAddRefToDirectoryWatchOfFailedLookups(dir, dirPath, nonRecursive);
|
|
128072
|
+
}
|
|
128073
|
+
}
|
|
128074
|
+
function setDirectoryWatcher(dir, dirPath, packageDir, packageDirPath, nonRecursive) {
|
|
128075
|
+
if (!packageDirPath || !resolutionHost.realpath) {
|
|
128076
|
+
createOrAddRefToDirectoryWatchOfFailedLookups(dir, dirPath, nonRecursive);
|
|
128077
|
+
} else {
|
|
128078
|
+
createDirectoryWatcherForPackageDir(dir, dirPath, packageDir, packageDirPath, nonRecursive);
|
|
128079
|
+
}
|
|
128080
|
+
}
|
|
128081
|
+
function createOrAddRefToDirectoryWatchOfFailedLookups(dir, dirPath, nonRecursive) {
|
|
128082
|
+
let dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
127825
128083
|
if (dirWatcher) {
|
|
127826
128084
|
Debug.assert(!!nonRecursive === !!dirWatcher.nonRecursive);
|
|
127827
128085
|
dirWatcher.refCount++;
|
|
127828
128086
|
} else {
|
|
127829
|
-
directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive });
|
|
128087
|
+
directoryWatchesOfFailedLookups.set(dirPath, dirWatcher = { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive });
|
|
127830
128088
|
}
|
|
128089
|
+
return dirWatcher;
|
|
127831
128090
|
}
|
|
127832
128091
|
function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot, syncDirWatcherRemove) {
|
|
127833
128092
|
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
@@ -127840,9 +128099,27 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127840
128099
|
getCurrentDirectory
|
|
127841
128100
|
);
|
|
127842
128101
|
if (toWatch) {
|
|
127843
|
-
const { dirPath } = toWatch;
|
|
128102
|
+
const { dirPath, packageDirPath } = toWatch;
|
|
127844
128103
|
if (dirPath === rootPath) {
|
|
127845
128104
|
removeAtRoot = true;
|
|
128105
|
+
} else if (packageDirPath && resolutionHost.realpath) {
|
|
128106
|
+
const packageDirWatcher = packageDirWatchers.get(packageDirPath);
|
|
128107
|
+
const forDirPath = packageDirWatcher.dirPathToWatcher.get(dirPath);
|
|
128108
|
+
forDirPath.refCount--;
|
|
128109
|
+
if (forDirPath.refCount === 0) {
|
|
128110
|
+
removeDirectoryWatcher(packageDirWatcher.isSymlink ? packageDirPath : dirPath, syncDirWatcherRemove);
|
|
128111
|
+
packageDirWatcher.dirPathToWatcher.delete(dirPath);
|
|
128112
|
+
if (packageDirWatcher.isSymlink) {
|
|
128113
|
+
const refCount = dirPathToSymlinkPackageRefCount.get(dirPath) - 1;
|
|
128114
|
+
if (refCount === 0) {
|
|
128115
|
+
dirPathToSymlinkPackageRefCount.delete(dirPath);
|
|
128116
|
+
} else {
|
|
128117
|
+
dirPathToSymlinkPackageRefCount.set(dirPath, refCount);
|
|
128118
|
+
}
|
|
128119
|
+
}
|
|
128120
|
+
if (syncDirWatcherRemove)
|
|
128121
|
+
closePackageDirWatcher(packageDirWatcher, packageDirPath);
|
|
128122
|
+
}
|
|
127846
128123
|
} else {
|
|
127847
128124
|
removeDirectoryWatcher(dirPath, syncDirWatcherRemove);
|
|
127848
128125
|
}
|
|
@@ -128064,7 +128341,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
128064
128341
|
rootPath,
|
|
128065
128342
|
rootPathComponents,
|
|
128066
128343
|
getCurrentDirectory,
|
|
128067
|
-
(dirPath2) => directoryWatchesOfFailedLookups.has(dirPath2)
|
|
128344
|
+
(dirPath2) => directoryWatchesOfFailedLookups.has(dirPath2) || dirPathToSymlinkPackageRefCount.has(dirPath2)
|
|
128068
128345
|
);
|
|
128069
128346
|
if (dirPath) {
|
|
128070
128347
|
scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
|
|
@@ -128270,10 +128547,10 @@ function explainFiles(program, write) {
|
|
|
128270
128547
|
for (const file of program.getSourceFiles()) {
|
|
128271
128548
|
write(`${toFileName(file, relativeFileName)}`);
|
|
128272
128549
|
(_a = reasons.get(file.path)) == null ? void 0 : _a.forEach((reason) => write(` ${fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText}`));
|
|
128273
|
-
(_b = explainIfFileIsRedirectAndImpliedFormat(file, relativeFileName)) == null ? void 0 : _b.forEach((d) => write(` ${d.messageText}`));
|
|
128550
|
+
(_b = explainIfFileIsRedirectAndImpliedFormat(file, program.getCompilerOptionsForFile(file), relativeFileName)) == null ? void 0 : _b.forEach((d) => write(` ${d.messageText}`));
|
|
128274
128551
|
}
|
|
128275
128552
|
}
|
|
128276
|
-
function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
|
|
128553
|
+
function explainIfFileIsRedirectAndImpliedFormat(file, options, fileNameConvertor) {
|
|
128277
128554
|
var _a;
|
|
128278
128555
|
let result;
|
|
128279
128556
|
if (file.path !== file.resolvedPath) {
|
|
@@ -128293,7 +128570,7 @@ function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
|
|
|
128293
128570
|
));
|
|
128294
128571
|
}
|
|
128295
128572
|
if (isExternalOrCommonJsModule(file)) {
|
|
128296
|
-
switch (file
|
|
128573
|
+
switch (getImpliedNodeFormatForEmitWorker(file, options)) {
|
|
128297
128574
|
case 99 /* ESNext */:
|
|
128298
128575
|
if (file.packageJsonScope) {
|
|
128299
128576
|
(result ?? (result = [])).push(chainDiagnosticMessages(
|
|
@@ -134674,7 +134951,9 @@ function createModuleSpecifierResolutionHost(program, host) {
|
|
|
134674
134951
|
isSourceOfProjectReferenceRedirect: (fileName) => program.isSourceOfProjectReferenceRedirect(fileName),
|
|
134675
134952
|
getNearestAncestorDirectoryWithPackageJson: maybeBind(host, host.getNearestAncestorDirectoryWithPackageJson),
|
|
134676
134953
|
getFileIncludeReasons: () => program.getFileIncludeReasons(),
|
|
134677
|
-
getCommonSourceDirectory: () => program.getCommonSourceDirectory()
|
|
134954
|
+
getCommonSourceDirectory: () => program.getCommonSourceDirectory(),
|
|
134955
|
+
getDefaultResolutionModeForFile: (file) => program.getDefaultResolutionModeForFile(file),
|
|
134956
|
+
getModeForResolutionAtIndex: (file, index) => program.getModeForResolutionAtIndex(file, index)
|
|
134678
134957
|
};
|
|
134679
134958
|
}
|
|
134680
134959
|
function getModuleSpecifierResolverHost(program, host) {
|
|
@@ -135986,9 +136265,13 @@ function fileShouldUseJavaScriptRequire(file, program, host, preferRequire) {
|
|
|
135986
136265
|
if (!hasJSFileExtension(fileName)) {
|
|
135987
136266
|
return false;
|
|
135988
136267
|
}
|
|
135989
|
-
const compilerOptions = program.getCompilerOptions();
|
|
136268
|
+
const compilerOptions = typeof file === "string" ? program.getCompilerOptions() : program.getCompilerOptionsForFile(file);
|
|
135990
136269
|
const moduleKind = getEmitModuleKind(compilerOptions);
|
|
135991
|
-
const
|
|
136270
|
+
const sourceFileLike = typeof file === "string" ? {
|
|
136271
|
+
fileName: file,
|
|
136272
|
+
impliedNodeFormat: getImpliedNodeFormatForFile(toPath(file, host.getCurrentDirectory(), hostGetCanonicalFileName(host)), (_a = program.getPackageJsonInfoCache) == null ? void 0 : _a.call(program), host, compilerOptions)
|
|
136273
|
+
} : file;
|
|
136274
|
+
const impliedNodeFormat = getImpliedNodeFormatForEmitWorker(sourceFileLike, compilerOptions);
|
|
135992
136275
|
if (impliedNodeFormat === 99 /* ESNext */) {
|
|
135993
136276
|
return false;
|
|
135994
136277
|
}
|
|
@@ -139025,7 +139308,7 @@ function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
|
|
|
139025
139308
|
program.getSemanticDiagnostics(sourceFile, cancellationToken);
|
|
139026
139309
|
const diags = [];
|
|
139027
139310
|
const checker = program.getTypeChecker();
|
|
139028
|
-
const isCommonJSFile = sourceFile
|
|
139311
|
+
const isCommonJSFile = program.getImpliedNodeFormatForEmit(sourceFile) === 1 /* CommonJS */ || fileExtensionIsOneOf(sourceFile.fileName, [".cts" /* Cts */, ".cjs" /* Cjs */]);
|
|
139029
139312
|
if (!isCommonJSFile && sourceFile.commonJsModuleIndicator && (programContainsEsModules(program) || compilerOptionsIndicateEsModules(program.getCompilerOptions())) && containsTopLevelCommonjs(sourceFile)) {
|
|
139030
139313
|
diags.push(createDiagnosticForNode(getErrorNodeFromCommonJsIndicator(sourceFile.commonJsModuleIndicator), Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module));
|
|
139031
139314
|
}
|
|
@@ -152307,7 +152590,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
|
|
|
152307
152590
|
compilerOptions,
|
|
152308
152591
|
createModuleSpecifierResolutionHost(program, host)
|
|
152309
152592
|
);
|
|
152310
|
-
const importKind = getImportKind(futureExportingSourceFile, exportKind,
|
|
152593
|
+
const importKind = getImportKind(futureExportingSourceFile, exportKind, program);
|
|
152311
152594
|
const addAsTypeOnly = getAddAsTypeOnly(
|
|
152312
152595
|
isImportUsageValidAsTypeOnly,
|
|
152313
152596
|
/*isForNewImportDeclaration*/
|
|
@@ -152640,7 +152923,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
|
|
|
152640
152923
|
}
|
|
152641
152924
|
function createImportSpecifierResolver(importingFile, program, host, preferences) {
|
|
152642
152925
|
const packageJsonImportFilter = createPackageJsonImportFilter(importingFile, preferences, host);
|
|
152643
|
-
const importMap = createExistingImportMap(
|
|
152926
|
+
const importMap = createExistingImportMap(importingFile, program);
|
|
152644
152927
|
return { getModuleSpecifierForBestExportInfo };
|
|
152645
152928
|
function getModuleSpecifierForBestExportInfo(exportInfo, position, isValidTypeOnlyUseSite, fromCacheOnly) {
|
|
152646
152929
|
const { fixes, computedWithoutCacheCount } = getImportFixes(
|
|
@@ -152747,7 +153030,7 @@ function getSingleExportInfoForSymbol(symbol, symbolName2, moduleSymbol, program
|
|
|
152747
153030
|
function isFutureSymbolExportInfoArray(info) {
|
|
152748
153031
|
return info[0].symbol === void 0;
|
|
152749
153032
|
}
|
|
152750
|
-
function getImportFixes(exportInfos, usagePosition, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap = isFullSourceFile(sourceFile) ? createExistingImportMap(
|
|
153033
|
+
function getImportFixes(exportInfos, usagePosition, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap = isFullSourceFile(sourceFile) ? createExistingImportMap(sourceFile, program) : void 0, fromCacheOnly) {
|
|
152751
153034
|
const checker = program.getTypeChecker();
|
|
152752
153035
|
const existingImports = importMap && !isFutureSymbolExportInfoArray(exportInfos) ? flatMap(exportInfos, importMap.getImportsForExportInfo) : emptyArray;
|
|
152753
153036
|
const useNamespace = usagePosition !== void 0 && tryUseExistingNamespaceImport(existingImports, usagePosition);
|
|
@@ -152863,7 +153146,8 @@ function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker
|
|
|
152863
153146
|
};
|
|
152864
153147
|
}
|
|
152865
153148
|
}
|
|
152866
|
-
function createExistingImportMap(
|
|
153149
|
+
function createExistingImportMap(importingFile, program) {
|
|
153150
|
+
const checker = program.getTypeChecker();
|
|
152867
153151
|
let importMap;
|
|
152868
153152
|
for (const moduleSpecifier of importingFile.imports) {
|
|
152869
153153
|
const i = importFromModuleSpecifier(moduleSpecifier);
|
|
@@ -152886,7 +153170,7 @@ function createExistingImportMap(checker, importingFile, compilerOptions) {
|
|
|
152886
153170
|
return emptyArray;
|
|
152887
153171
|
if (isSourceFileJS(importingFile) && !(targetFlags & 111551 /* Value */) && !every(matchingDeclarations, isJSDocImportTag))
|
|
152888
153172
|
return emptyArray;
|
|
152889
|
-
const importKind = getImportKind(importingFile, exportKind,
|
|
153173
|
+
const importKind = getImportKind(importingFile, exportKind, program);
|
|
152890
153174
|
return matchingDeclarations.map((declaration) => ({ declaration, importKind, symbol, targetFlags }));
|
|
152891
153175
|
}
|
|
152892
153176
|
};
|
|
@@ -152903,9 +153187,9 @@ function shouldUseRequire(sourceFile, program) {
|
|
|
152903
153187
|
if (compilerOptions.configFile) {
|
|
152904
153188
|
return getEmitModuleKind(compilerOptions) < 5 /* ES2015 */;
|
|
152905
153189
|
}
|
|
152906
|
-
if (sourceFile
|
|
153190
|
+
if (getImpliedNodeFormatForEmit(sourceFile, program) === 1 /* CommonJS */)
|
|
152907
153191
|
return true;
|
|
152908
|
-
if (sourceFile
|
|
153192
|
+
if (getImpliedNodeFormatForEmit(sourceFile, program) === 99 /* ESNext */)
|
|
152909
153193
|
return false;
|
|
152910
153194
|
for (const otherFile of program.getSourceFiles()) {
|
|
152911
153195
|
if (otherFile === sourceFile || !isSourceFileJS(otherFile) || program.isSourceFileFromExternalLibrary(otherFile))
|
|
@@ -152962,7 +153246,7 @@ function getNewImportFixes(program, sourceFile, usagePosition, isValidTypeOnlyUs
|
|
|
152962
153246
|
if (!importedSymbolHasValueMeaning && isJs && usagePosition !== void 0) {
|
|
152963
153247
|
return { kind: 1 /* JsdocTypeImport */, moduleSpecifier, usagePosition, exportInfo: exportInfo2, isReExport: i > 0 };
|
|
152964
153248
|
}
|
|
152965
|
-
const importKind = getImportKind(sourceFile, exportInfo2.exportKind,
|
|
153249
|
+
const importKind = getImportKind(sourceFile, exportInfo2.exportKind, program);
|
|
152966
153250
|
let qualification;
|
|
152967
153251
|
if (usagePosition !== void 0 && importKind === 3 /* CommonJS */ && exportInfo2.exportKind === 0 /* Named */) {
|
|
152968
153252
|
const exportEquals = checker.resolveExternalModuleSymbol(exportInfo2.moduleSymbol);
|
|
@@ -153135,8 +153419,8 @@ function getUmdSymbol(token, checker) {
|
|
|
153135
153419
|
}
|
|
153136
153420
|
return void 0;
|
|
153137
153421
|
}
|
|
153138
|
-
function getImportKind(importingFile, exportKind,
|
|
153139
|
-
if (
|
|
153422
|
+
function getImportKind(importingFile, exportKind, program, forceImportKeyword) {
|
|
153423
|
+
if (program.getCompilerOptions().verbatimModuleSyntax && getEmitModuleFormatOfFile(importingFile, program) === 1 /* CommonJS */) {
|
|
153140
153424
|
return 3 /* CommonJS */;
|
|
153141
153425
|
}
|
|
153142
153426
|
switch (exportKind) {
|
|
@@ -153145,18 +153429,18 @@ function getImportKind(importingFile, exportKind, compilerOptions, forceImportKe
|
|
|
153145
153429
|
case 1 /* Default */:
|
|
153146
153430
|
return 1 /* Default */;
|
|
153147
153431
|
case 2 /* ExportEquals */:
|
|
153148
|
-
return getExportEqualsImportKind(importingFile,
|
|
153432
|
+
return getExportEqualsImportKind(importingFile, program.getCompilerOptions(), !!forceImportKeyword);
|
|
153149
153433
|
case 3 /* UMD */:
|
|
153150
|
-
return getUmdImportKind(importingFile,
|
|
153434
|
+
return getUmdImportKind(importingFile, program, !!forceImportKeyword);
|
|
153151
153435
|
default:
|
|
153152
153436
|
return Debug.assertNever(exportKind);
|
|
153153
153437
|
}
|
|
153154
153438
|
}
|
|
153155
|
-
function getUmdImportKind(importingFile,
|
|
153156
|
-
if (getAllowSyntheticDefaultImports(
|
|
153439
|
+
function getUmdImportKind(importingFile, program, forceImportKeyword) {
|
|
153440
|
+
if (getAllowSyntheticDefaultImports(program.getCompilerOptions())) {
|
|
153157
153441
|
return 1 /* Default */;
|
|
153158
153442
|
}
|
|
153159
|
-
const moduleKind = getEmitModuleKind(
|
|
153443
|
+
const moduleKind = getEmitModuleKind(program.getCompilerOptions());
|
|
153160
153444
|
switch (moduleKind) {
|
|
153161
153445
|
case 2 /* AMD */:
|
|
153162
153446
|
case 1 /* CommonJS */:
|
|
@@ -153175,7 +153459,7 @@ function getUmdImportKind(importingFile, compilerOptions, forceImportKeyword) {
|
|
|
153175
153459
|
return 2 /* Namespace */;
|
|
153176
153460
|
case 100 /* Node16 */:
|
|
153177
153461
|
case 199 /* NodeNext */:
|
|
153178
|
-
return importingFile
|
|
153462
|
+
return getImpliedNodeFormatForEmit(importingFile, program) === 99 /* ESNext */ ? 2 /* Namespace */ : 3 /* CommonJS */;
|
|
153179
153463
|
default:
|
|
153180
153464
|
return Debug.assertNever(moduleKind, `Unexpected moduleKind ${moduleKind}`);
|
|
153181
153465
|
}
|
|
@@ -153692,6 +153976,12 @@ function moduleSpecifierToValidIdentifier(moduleSpecifier, target, forceCapitali
|
|
|
153692
153976
|
}
|
|
153693
153977
|
return !isStringANonContextualKeyword(res) ? res || "_" : `_${res}`;
|
|
153694
153978
|
}
|
|
153979
|
+
function getImpliedNodeFormatForEmit(file, program) {
|
|
153980
|
+
return isFullSourceFile(file) ? program.getImpliedNodeFormatForEmit(file) : getImpliedNodeFormatForEmitWorker(file, program.getCompilerOptions());
|
|
153981
|
+
}
|
|
153982
|
+
function getEmitModuleFormatOfFile(file, program) {
|
|
153983
|
+
return isFullSourceFile(file) ? program.getEmitModuleFormatOfFile(file) : getEmitModuleFormatOfFileWorker(file, program.getCompilerOptions());
|
|
153984
|
+
}
|
|
153695
153985
|
|
|
153696
153986
|
// src/services/codefixes/fixAddMissingConstraint.ts
|
|
153697
153987
|
var fixId17 = "addMissingConstraint";
|
|
@@ -160219,10 +160509,12 @@ function getJSDocParamAnnotation(paramName, initializer, dotDotDotToken, isJs, i
|
|
|
160219
160509
|
const printer = isSnippet ? createSnippetPrinter({
|
|
160220
160510
|
removeComments: true,
|
|
160221
160511
|
module: options.module,
|
|
160512
|
+
moduleResolution: options.moduleResolution,
|
|
160222
160513
|
target: options.target
|
|
160223
160514
|
}) : createPrinter({
|
|
160224
160515
|
removeComments: true,
|
|
160225
160516
|
module: options.module,
|
|
160517
|
+
moduleResolution: options.moduleResolution,
|
|
160226
160518
|
target: options.target
|
|
160227
160519
|
});
|
|
160228
160520
|
setEmitFlags(typeNode, 1 /* SingleLine */);
|
|
@@ -160472,6 +160764,7 @@ function getExhaustiveCaseSnippets(caseBlock, sourceFile, preferences, options,
|
|
|
160472
160764
|
const printer = createSnippetPrinter({
|
|
160473
160765
|
removeComments: true,
|
|
160474
160766
|
module: options.module,
|
|
160767
|
+
moduleResolution: options.moduleResolution,
|
|
160475
160768
|
target: options.target,
|
|
160476
160769
|
newLine: getNewLineKind(newLineChar)
|
|
160477
160770
|
});
|
|
@@ -160660,7 +160953,7 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
160660
160953
|
if (originIsResolvedExport(origin)) {
|
|
160661
160954
|
sourceDisplay = [textPart(origin.moduleSpecifier)];
|
|
160662
160955
|
if (importStatementCompletion) {
|
|
160663
|
-
({ insertText, replacementSpan } = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile,
|
|
160956
|
+
({ insertText, replacementSpan } = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, program, preferences));
|
|
160664
160957
|
isSnippet = preferences.includeCompletionsWithSnippetText ? true : void 0;
|
|
160665
160958
|
}
|
|
160666
160959
|
}
|
|
@@ -160776,6 +161069,7 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
|
|
|
160776
161069
|
const printer = createSnippetPrinter({
|
|
160777
161070
|
removeComments: true,
|
|
160778
161071
|
module: options.module,
|
|
161072
|
+
moduleResolution: options.moduleResolution,
|
|
160779
161073
|
target: options.target,
|
|
160780
161074
|
omitTrailingSemicolon: false,
|
|
160781
161075
|
newLine: getNewLineKind(getNewLineOrDefaultFromHost(host, formatContext == null ? void 0 : formatContext.options))
|
|
@@ -160926,6 +161220,7 @@ function getEntryForObjectLiteralMethodCompletion(symbol, name, enclosingDeclara
|
|
|
160926
161220
|
const printer = createSnippetPrinter({
|
|
160927
161221
|
removeComments: true,
|
|
160928
161222
|
module: options.module,
|
|
161223
|
+
moduleResolution: options.moduleResolution,
|
|
160929
161224
|
target: options.target,
|
|
160930
161225
|
omitTrailingSemicolon: false,
|
|
160931
161226
|
newLine: getNewLineKind(getNewLineOrDefaultFromHost(host, formatContext == null ? void 0 : formatContext.options))
|
|
@@ -160946,6 +161241,7 @@ function getEntryForObjectLiteralMethodCompletion(symbol, name, enclosingDeclara
|
|
|
160946
161241
|
const signaturePrinter = createPrinter({
|
|
160947
161242
|
removeComments: true,
|
|
160948
161243
|
module: options.module,
|
|
161244
|
+
moduleResolution: options.moduleResolution,
|
|
160949
161245
|
target: options.target,
|
|
160950
161246
|
omitTrailingSemicolon: true
|
|
160951
161247
|
});
|
|
@@ -161207,7 +161503,7 @@ function completionEntryDataToSymbolOriginInfo(data, completionName, moduleSymbo
|
|
|
161207
161503
|
};
|
|
161208
161504
|
return unresolvedOrigin;
|
|
161209
161505
|
}
|
|
161210
|
-
function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile,
|
|
161506
|
+
function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, program, preferences) {
|
|
161211
161507
|
const replacementSpan = importStatementCompletion.replacementSpan;
|
|
161212
161508
|
const quotedModuleSpecifier = escapeSnippetText(quote(sourceFile, preferences, origin.moduleSpecifier));
|
|
161213
161509
|
const exportKind = origin.isDefaultExport ? 1 /* Default */ : origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : 0 /* Named */;
|
|
@@ -161215,7 +161511,7 @@ function getInsertTextAndReplacementSpanForImportCompletion(name, importStatemen
|
|
|
161215
161511
|
const importKind = ts_codefix_exports.getImportKind(
|
|
161216
161512
|
sourceFile,
|
|
161217
161513
|
exportKind,
|
|
161218
|
-
|
|
161514
|
+
program,
|
|
161219
161515
|
/*forceImportKeyword*/
|
|
161220
161516
|
true
|
|
161221
161517
|
);
|
|
@@ -163631,7 +163927,7 @@ function createNameAndKindSet() {
|
|
|
163631
163927
|
}
|
|
163632
163928
|
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences, includeSymbol) {
|
|
163633
163929
|
if (isInReferenceComment(sourceFile, position)) {
|
|
163634
|
-
const entries = getTripleSlashReferenceCompletion(sourceFile, position,
|
|
163930
|
+
const entries = getTripleSlashReferenceCompletion(sourceFile, position, program, host);
|
|
163635
163931
|
return entries && convertPathCompletions(entries);
|
|
163636
163932
|
}
|
|
163637
163933
|
if (isInString(sourceFile, position, contextToken)) {
|
|
@@ -163944,7 +164240,7 @@ function getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node, prog
|
|
|
163944
164240
|
const compilerOptions = program.getCompilerOptions();
|
|
163945
164241
|
const typeChecker = program.getTypeChecker();
|
|
163946
164242
|
const extensionOptions = getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile, typeChecker, preferences, mode);
|
|
163947
|
-
return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && !compilerOptions.paths && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory,
|
|
164243
|
+
return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && !compilerOptions.paths && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, program, host, scriptPath, extensionOptions) : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, program, host, extensionOptions);
|
|
163948
164244
|
}
|
|
163949
164245
|
function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, typeChecker, preferences, resolutionMode) {
|
|
163950
164246
|
return {
|
|
@@ -163955,14 +164251,15 @@ function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile
|
|
|
163955
164251
|
resolutionMode
|
|
163956
164252
|
};
|
|
163957
164253
|
}
|
|
163958
|
-
function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory,
|
|
164254
|
+
function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, program, host, scriptPath, extensionOptions) {
|
|
164255
|
+
const compilerOptions = program.getCompilerOptions();
|
|
163959
164256
|
if (compilerOptions.rootDirs) {
|
|
163960
164257
|
return getCompletionEntriesForDirectoryFragmentWithRootDirs(
|
|
163961
164258
|
compilerOptions.rootDirs,
|
|
163962
164259
|
literalValue,
|
|
163963
164260
|
scriptDirectory,
|
|
163964
164261
|
extensionOptions,
|
|
163965
|
-
|
|
164262
|
+
program,
|
|
163966
164263
|
host,
|
|
163967
164264
|
scriptPath
|
|
163968
164265
|
);
|
|
@@ -163971,6 +164268,7 @@ function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, c
|
|
|
163971
164268
|
literalValue,
|
|
163972
164269
|
scriptDirectory,
|
|
163973
164270
|
extensionOptions,
|
|
164271
|
+
program,
|
|
163974
164272
|
host,
|
|
163975
164273
|
/*moduleSpecifierIsRelative*/
|
|
163976
164274
|
true,
|
|
@@ -163998,7 +164296,8 @@ function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptDirectory, ign
|
|
|
163998
164296
|
compareStringsCaseSensitive
|
|
163999
164297
|
);
|
|
164000
164298
|
}
|
|
164001
|
-
function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptDirectory, extensionOptions,
|
|
164299
|
+
function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptDirectory, extensionOptions, program, host, exclude) {
|
|
164300
|
+
const compilerOptions = program.getCompilerOptions();
|
|
164002
164301
|
const basePath = compilerOptions.project || host.getCurrentDirectory();
|
|
164003
164302
|
const ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());
|
|
164004
164303
|
const baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptDirectory, ignoreCase);
|
|
@@ -164007,6 +164306,7 @@ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment
|
|
|
164007
164306
|
fragment,
|
|
164008
164307
|
baseDirectory,
|
|
164009
164308
|
extensionOptions,
|
|
164309
|
+
program,
|
|
164010
164310
|
host,
|
|
164011
164311
|
/*moduleSpecifierIsRelative*/
|
|
164012
164312
|
true,
|
|
@@ -164015,7 +164315,7 @@ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment
|
|
|
164015
164315
|
(itemA, itemB) => itemA.name === itemB.name && itemA.kind === itemB.kind && itemA.extension === itemB.extension
|
|
164016
164316
|
);
|
|
164017
164317
|
}
|
|
164018
|
-
function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, extensionOptions, host, moduleSpecifierIsRelative, exclude, result = createNameAndKindSet()) {
|
|
164318
|
+
function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, extensionOptions, program, host, moduleSpecifierIsRelative, exclude, result = createNameAndKindSet()) {
|
|
164019
164319
|
var _a;
|
|
164020
164320
|
if (fragment === void 0) {
|
|
164021
164321
|
fragment = "";
|
|
@@ -164040,7 +164340,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
|
|
|
164040
164340
|
if (versionPaths) {
|
|
164041
164341
|
const packageDirectory = getDirectoryPath(packageJsonPath);
|
|
164042
164342
|
const pathInPackage = absolutePath.slice(ensureTrailingDirectorySeparator(packageDirectory).length);
|
|
164043
|
-
if (addCompletionEntriesFromPaths(result, pathInPackage, packageDirectory, extensionOptions, host, versionPaths)) {
|
|
164343
|
+
if (addCompletionEntriesFromPaths(result, pathInPackage, packageDirectory, extensionOptions, program, host, versionPaths)) {
|
|
164044
164344
|
return result;
|
|
164045
164345
|
}
|
|
164046
164346
|
}
|
|
@@ -164067,7 +164367,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
|
|
|
164067
164367
|
}
|
|
164068
164368
|
const { name, extension } = getFilenameWithExtensionOption(
|
|
164069
164369
|
getBaseFileName(filePath),
|
|
164070
|
-
|
|
164370
|
+
program,
|
|
164071
164371
|
extensionOptions,
|
|
164072
164372
|
/*isExportsWildcard*/
|
|
164073
164373
|
false
|
|
@@ -164086,7 +164386,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
|
|
|
164086
164386
|
}
|
|
164087
164387
|
return result;
|
|
164088
164388
|
}
|
|
164089
|
-
function getFilenameWithExtensionOption(name,
|
|
164389
|
+
function getFilenameWithExtensionOption(name, program, extensionOptions, isExportsWildcard) {
|
|
164090
164390
|
const nonJsResult = ts_moduleSpecifiers_exports.tryGetRealFileNameForNonJsDeclarationFileName(name);
|
|
164091
164391
|
if (nonJsResult) {
|
|
164092
164392
|
return { name: nonJsResult, extension: tryGetExtensionFromPath2(nonJsResult) };
|
|
@@ -164096,7 +164396,8 @@ function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions,
|
|
|
164096
164396
|
}
|
|
164097
164397
|
let allowedEndings = getModuleSpecifierPreferences(
|
|
164098
164398
|
{ importModuleSpecifierEnding: extensionOptions.endingPreference },
|
|
164099
|
-
|
|
164399
|
+
program,
|
|
164400
|
+
program.getCompilerOptions(),
|
|
164100
164401
|
extensionOptions.importingSourceFile
|
|
164101
164402
|
).getAllowedEndingsInPreferredOrder(extensionOptions.resolutionMode);
|
|
164102
164403
|
if (isExportsWildcard) {
|
|
@@ -164106,16 +164407,16 @@ function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions,
|
|
|
164106
164407
|
if (fileExtensionIsOneOf(name, supportedTSImplementationExtensions)) {
|
|
164107
164408
|
return { name, extension: tryGetExtensionFromPath2(name) };
|
|
164108
164409
|
}
|
|
164109
|
-
const outputExtension2 = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name,
|
|
164410
|
+
const outputExtension2 = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, program.getCompilerOptions());
|
|
164110
164411
|
return outputExtension2 ? { name: changeExtension(name, outputExtension2), extension: outputExtension2 } : { name, extension: tryGetExtensionFromPath2(name) };
|
|
164111
164412
|
}
|
|
164112
164413
|
if (!isExportsWildcard && (allowedEndings[0] === 0 /* Minimal */ || allowedEndings[0] === 1 /* Index */) && fileExtensionIsOneOf(name, [".js" /* Js */, ".jsx" /* Jsx */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */])) {
|
|
164113
164414
|
return { name: removeFileExtension(name), extension: tryGetExtensionFromPath2(name) };
|
|
164114
164415
|
}
|
|
164115
|
-
const outputExtension = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name,
|
|
164416
|
+
const outputExtension = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, program.getCompilerOptions());
|
|
164116
164417
|
return outputExtension ? { name: changeExtension(name, outputExtension), extension: outputExtension } : { name, extension: tryGetExtensionFromPath2(name) };
|
|
164117
164418
|
}
|
|
164118
|
-
function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensionOptions, host, paths) {
|
|
164419
|
+
function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensionOptions, program, host, paths) {
|
|
164119
164420
|
const getPatternsForKey = (key) => paths[key];
|
|
164120
164421
|
const comparePaths2 = (a, b) => {
|
|
164121
164422
|
const patternA = tryParsePattern(a);
|
|
@@ -164131,13 +164432,14 @@ function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensio
|
|
|
164131
164432
|
fragment,
|
|
164132
164433
|
baseDirectory,
|
|
164133
164434
|
extensionOptions,
|
|
164435
|
+
program,
|
|
164134
164436
|
host,
|
|
164135
164437
|
getOwnKeys(paths),
|
|
164136
164438
|
getPatternsForKey,
|
|
164137
164439
|
comparePaths2
|
|
164138
164440
|
);
|
|
164139
164441
|
}
|
|
164140
|
-
function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, baseDirectory, extensionOptions, host, keys, getPatternsForKey, comparePaths2) {
|
|
164442
|
+
function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, baseDirectory, extensionOptions, program, host, keys, getPatternsForKey, comparePaths2) {
|
|
164141
164443
|
let pathResults = [];
|
|
164142
164444
|
let matchedPath;
|
|
164143
164445
|
for (const key of keys) {
|
|
@@ -164158,7 +164460,7 @@ function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, bas
|
|
|
164158
164460
|
if (typeof pathPattern === "string" || matchedPath === void 0 || comparePaths2(key, matchedPath) !== 1 /* GreaterThan */) {
|
|
164159
164461
|
pathResults.push({
|
|
164160
164462
|
matchedPattern: isMatch,
|
|
164161
|
-
results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, isExports && isMatch, host).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
|
|
164463
|
+
results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, isExports && isMatch, program, host).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
|
|
164162
164464
|
});
|
|
164163
164465
|
}
|
|
164164
164466
|
}
|
|
@@ -164166,7 +164468,9 @@ function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, bas
|
|
|
164166
164468
|
pathResults.forEach((pathResult) => pathResult.results.forEach((r) => result.add(r)));
|
|
164167
164469
|
return matchedPath !== void 0;
|
|
164168
164470
|
}
|
|
164169
|
-
function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode,
|
|
164471
|
+
function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, program, host, extensionOptions) {
|
|
164472
|
+
const typeChecker = program.getTypeChecker();
|
|
164473
|
+
const compilerOptions = program.getCompilerOptions();
|
|
164170
164474
|
const { baseUrl, paths } = compilerOptions;
|
|
164171
164475
|
const result = createNameAndKindSet();
|
|
164172
164476
|
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
@@ -164176,6 +164480,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
164176
164480
|
fragment,
|
|
164177
164481
|
absolute,
|
|
164178
164482
|
extensionOptions,
|
|
164483
|
+
program,
|
|
164179
164484
|
host,
|
|
164180
164485
|
/*moduleSpecifierIsRelative*/
|
|
164181
164486
|
false,
|
|
@@ -164186,7 +164491,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
164186
164491
|
}
|
|
164187
164492
|
if (paths) {
|
|
164188
164493
|
const absolute = getPathsBasePath(compilerOptions, host);
|
|
164189
|
-
addCompletionEntriesFromPaths(result, fragment, absolute, extensionOptions, host, paths);
|
|
164494
|
+
addCompletionEntriesFromPaths(result, fragment, absolute, extensionOptions, program, host, paths);
|
|
164190
164495
|
}
|
|
164191
164496
|
const fragmentDirectory = getFragmentDirectory(fragment);
|
|
164192
164497
|
for (const ambientName of getAmbientModuleCompletions(fragment, fragmentDirectory, typeChecker)) {
|
|
@@ -164197,7 +164502,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
164197
164502
|
void 0
|
|
164198
164503
|
));
|
|
164199
164504
|
}
|
|
164200
|
-
getCompletionEntriesFromTypings(host,
|
|
164505
|
+
getCompletionEntriesFromTypings(host, program, scriptPath, fragmentDirectory, extensionOptions, result);
|
|
164201
164506
|
if (moduleResolutionUsesNodeModules(moduleResolution)) {
|
|
164202
164507
|
let foundGlobal = false;
|
|
164203
164508
|
if (fragmentDirectory === void 0) {
|
|
@@ -164222,6 +164527,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
164222
164527
|
fragment,
|
|
164223
164528
|
nodeModules,
|
|
164224
164529
|
extensionOptions,
|
|
164530
|
+
program,
|
|
164225
164531
|
host,
|
|
164226
164532
|
/*moduleSpecifierIsRelative*/
|
|
164227
164533
|
false,
|
|
@@ -164266,6 +164572,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
164266
164572
|
fragmentSubpath,
|
|
164267
164573
|
packageDirectory,
|
|
164268
164574
|
extensionOptions,
|
|
164575
|
+
program,
|
|
164269
164576
|
host,
|
|
164270
164577
|
keys,
|
|
164271
164578
|
(key) => singleElementArray(getPatternFromFirstMatchingCondition(exports2[key], conditions)),
|
|
@@ -164298,7 +164605,7 @@ function getPatternFromFirstMatchingCondition(target, conditions) {
|
|
|
164298
164605
|
function getFragmentDirectory(fragment) {
|
|
164299
164606
|
return containsSlash(fragment) ? hasTrailingDirectorySeparator(fragment) ? fragment : getDirectoryPath(fragment) : void 0;
|
|
164300
164607
|
}
|
|
164301
|
-
function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, isExportsWildcard, host) {
|
|
164608
|
+
function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, isExportsWildcard, program, host) {
|
|
164302
164609
|
if (!endsWith(path, "*")) {
|
|
164303
164610
|
return !path.includes("*") ? justPathMappingName(path, "script" /* scriptElement */) : emptyArray;
|
|
164304
164611
|
}
|
|
@@ -164308,15 +164615,15 @@ function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory
|
|
|
164308
164615
|
const starIsFullPathComponent = path[path.length - 2] === "/";
|
|
164309
164616
|
return starIsFullPathComponent ? justPathMappingName(pathPrefix, "directory" /* directory */) : flatMap(patterns, (pattern) => {
|
|
164310
164617
|
var _a;
|
|
164311
|
-
return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, isExportsWildcard, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest }));
|
|
164618
|
+
return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest }));
|
|
164312
164619
|
});
|
|
164313
164620
|
}
|
|
164314
|
-
return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host));
|
|
164621
|
+
return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host));
|
|
164315
164622
|
function justPathMappingName(name, kind) {
|
|
164316
164623
|
return startsWith(name, fragment) ? [{ name: removeTrailingDirectorySeparator(name), kind, extension: void 0 }] : emptyArray;
|
|
164317
164624
|
}
|
|
164318
164625
|
}
|
|
164319
|
-
function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host) {
|
|
164626
|
+
function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host) {
|
|
164320
164627
|
if (!host.readDirectory) {
|
|
164321
164628
|
return void 0;
|
|
164322
164629
|
}
|
|
@@ -164349,7 +164656,7 @@ function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensio
|
|
|
164349
164656
|
if (containsSlash(trimmedWithPattern)) {
|
|
164350
164657
|
return directoryResult(getPathComponents(removeLeadingDirectorySeparator(trimmedWithPattern))[1]);
|
|
164351
164658
|
}
|
|
164352
|
-
const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern,
|
|
164659
|
+
const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern, program, extensionOptions, isExportsWildcard);
|
|
164353
164660
|
return nameAndKind(name, "script" /* scriptElement */, extension);
|
|
164354
164661
|
}
|
|
164355
164662
|
});
|
|
@@ -164377,7 +164684,8 @@ function getAmbientModuleCompletions(fragment, fragmentDirectory, checker) {
|
|
|
164377
164684
|
}
|
|
164378
164685
|
return nonRelativeModuleNames;
|
|
164379
164686
|
}
|
|
164380
|
-
function getTripleSlashReferenceCompletion(sourceFile, position,
|
|
164687
|
+
function getTripleSlashReferenceCompletion(sourceFile, position, program, host) {
|
|
164688
|
+
const compilerOptions = program.getCompilerOptions();
|
|
164381
164689
|
const token = getTokenAtPosition(sourceFile, position);
|
|
164382
164690
|
const commentRanges = getLeadingCommentRanges(sourceFile.text, token.pos);
|
|
164383
164691
|
const range = commentRanges && find(commentRanges, (commentRange) => position >= commentRange.pos && position <= commentRange.end);
|
|
@@ -164395,14 +164703,16 @@ function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions
|
|
|
164395
164703
|
toComplete,
|
|
164396
164704
|
scriptPath,
|
|
164397
164705
|
getExtensionOptions(compilerOptions, 0 /* Filename */, sourceFile),
|
|
164706
|
+
program,
|
|
164398
164707
|
host,
|
|
164399
164708
|
/*moduleSpecifierIsRelative*/
|
|
164400
164709
|
true,
|
|
164401
164710
|
sourceFile.path
|
|
164402
|
-
) : kind === "types" ? getCompletionEntriesFromTypings(host,
|
|
164711
|
+
) : kind === "types" ? getCompletionEntriesFromTypings(host, program, scriptPath, getFragmentDirectory(toComplete), getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile)) : Debug.fail();
|
|
164403
164712
|
return addReplacementSpans(toComplete, range.pos + prefix.length, arrayFrom(names.values()));
|
|
164404
164713
|
}
|
|
164405
|
-
function getCompletionEntriesFromTypings(host,
|
|
164714
|
+
function getCompletionEntriesFromTypings(host, program, scriptPath, fragmentDirectory, extensionOptions, result = createNameAndKindSet()) {
|
|
164715
|
+
const options = program.getCompilerOptions();
|
|
164406
164716
|
const seen = /* @__PURE__ */ new Map();
|
|
164407
164717
|
const typeRoots = tryAndIgnoreErrors(() => getEffectiveTypeRoots(options, host)) || emptyArray;
|
|
164408
164718
|
for (const root of typeRoots) {
|
|
@@ -164438,6 +164748,7 @@ function getCompletionEntriesFromTypings(host, options, scriptPath, fragmentDire
|
|
|
164438
164748
|
remainingFragment,
|
|
164439
164749
|
baseDirectory,
|
|
164440
164750
|
extensionOptions,
|
|
164751
|
+
program,
|
|
164441
164752
|
host,
|
|
164442
164753
|
/*moduleSpecifierIsRelative*/
|
|
164443
164754
|
false,
|
|
@@ -164824,7 +165135,7 @@ function findModuleReferences(program, sourceFiles, searchModuleSymbol) {
|
|
|
164824
165135
|
}
|
|
164825
165136
|
}
|
|
164826
165137
|
for (const ref of referencingFile.typeReferenceDirectives) {
|
|
164827
|
-
const referenced = (_a = program.getResolvedTypeReferenceDirectives().get(ref.fileName, ref.resolutionMode || referencingFile
|
|
165138
|
+
const referenced = (_a = program.getResolvedTypeReferenceDirectives().get(ref.fileName, ref.resolutionMode || program.getDefaultResolutionModeForFile(referencingFile))) == null ? void 0 : _a.resolvedTypeReferenceDirective;
|
|
164828
165139
|
if (referenced !== void 0 && referenced.resolvedFileName === searchSourceFile.fileName) {
|
|
164829
165140
|
refs.push({ kind: "reference", referencingFile, ref });
|
|
164830
165141
|
}
|
|
@@ -167187,7 +167498,7 @@ function getReferenceAtPosition(sourceFile, position, program) {
|
|
|
167187
167498
|
}
|
|
167188
167499
|
const typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position);
|
|
167189
167500
|
if (typeReferenceDirective) {
|
|
167190
|
-
const reference = (_a = program.getResolvedTypeReferenceDirectives().get(typeReferenceDirective.fileName, typeReferenceDirective.resolutionMode || sourceFile
|
|
167501
|
+
const reference = (_a = program.getResolvedTypeReferenceDirectives().get(typeReferenceDirective.fileName, typeReferenceDirective.resolutionMode || program.getDefaultResolutionModeForFile(sourceFile))) == null ? void 0 : _a.resolvedTypeReferenceDirective;
|
|
167191
167502
|
const file = reference && program.getSourceFile(reference.resolvedFileName);
|
|
167192
167503
|
return file && { reference: typeReferenceDirective, fileName: file.fileName, file, unverified: false };
|
|
167193
167504
|
}
|
|
@@ -175633,6 +175944,7 @@ __export(ts_exports2, {
|
|
|
175633
175944
|
canHaveJSDoc: () => canHaveJSDoc,
|
|
175634
175945
|
canHaveLocals: () => canHaveLocals,
|
|
175635
175946
|
canHaveModifiers: () => canHaveModifiers,
|
|
175947
|
+
canHaveModuleSpecifier: () => canHaveModuleSpecifier,
|
|
175636
175948
|
canHaveSymbol: () => canHaveSymbol,
|
|
175637
175949
|
canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
|
|
175638
175950
|
canProduceDiagnostics: () => canProduceDiagnostics,
|
|
@@ -175811,6 +176123,7 @@ __export(ts_exports2, {
|
|
|
175811
176123
|
createModuleResolutionLoaderUsingGlobalCache: () => createModuleResolutionLoaderUsingGlobalCache,
|
|
175812
176124
|
createModuleSpecifierResolutionHost: () => createModuleSpecifierResolutionHost,
|
|
175813
176125
|
createMultiMap: () => createMultiMap,
|
|
176126
|
+
createNameResolver: () => createNameResolver,
|
|
175814
176127
|
createNodeConverters: () => createNodeConverters,
|
|
175815
176128
|
createNodeFactory: () => createNodeFactory,
|
|
175816
176129
|
createOptionNameMap: () => createOptionNameMap,
|
|
@@ -175951,6 +176264,7 @@ __export(ts_exports2, {
|
|
|
175951
176264
|
findChildOfKind: () => findChildOfKind,
|
|
175952
176265
|
findComputedPropertyNameCacheAssignment: () => findComputedPropertyNameCacheAssignment,
|
|
175953
176266
|
findConfigFile: () => findConfigFile,
|
|
176267
|
+
findConstructorDeclaration: () => findConstructorDeclaration,
|
|
175954
176268
|
findContainingList: () => findContainingList,
|
|
175955
176269
|
findDiagnosticForNode: () => findDiagnosticForNode,
|
|
175956
176270
|
findFirstNonJsxWhitespaceToken: () => findFirstNonJsxWhitespaceToken,
|
|
@@ -176097,6 +176411,7 @@ __export(ts_exports2, {
|
|
|
176097
176411
|
getDefaultLibFileName: () => getDefaultLibFileName,
|
|
176098
176412
|
getDefaultLibFilePath: () => getDefaultLibFilePath,
|
|
176099
176413
|
getDefaultLikeExportInfo: () => getDefaultLikeExportInfo,
|
|
176414
|
+
getDefaultResolutionModeForFileWorker: () => getDefaultResolutionModeForFileWorker,
|
|
176100
176415
|
getDiagnosticText: () => getDiagnosticText,
|
|
176101
176416
|
getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
|
|
176102
176417
|
getDirectoryPath: () => getDirectoryPath,
|
|
@@ -176127,6 +176442,7 @@ __export(ts_exports2, {
|
|
|
176127
176442
|
getEmitFlags: () => getEmitFlags,
|
|
176128
176443
|
getEmitHelpers: () => getEmitHelpers,
|
|
176129
176444
|
getEmitModuleDetectionKind: () => getEmitModuleDetectionKind,
|
|
176445
|
+
getEmitModuleFormatOfFileWorker: () => getEmitModuleFormatOfFileWorker,
|
|
176130
176446
|
getEmitModuleKind: () => getEmitModuleKind,
|
|
176131
176447
|
getEmitModuleResolutionKind: () => getEmitModuleResolutionKind,
|
|
176132
176448
|
getEmitScriptTarget: () => getEmitScriptTarget,
|
|
@@ -176177,6 +176493,7 @@ __export(ts_exports2, {
|
|
|
176177
176493
|
getIdentifierGeneratedImportReference: () => getIdentifierGeneratedImportReference,
|
|
176178
176494
|
getIdentifierTypeArguments: () => getIdentifierTypeArguments,
|
|
176179
176495
|
getImmediatelyInvokedFunctionExpression: () => getImmediatelyInvokedFunctionExpression,
|
|
176496
|
+
getImpliedNodeFormatForEmitWorker: () => getImpliedNodeFormatForEmitWorker,
|
|
176180
176497
|
getImpliedNodeFormatForFile: () => getImpliedNodeFormatForFile,
|
|
176181
176498
|
getImpliedNodeFormatForFileWorker: () => getImpliedNodeFormatForFileWorker,
|
|
176182
176499
|
getImportNeedsImportDefaultHelper: () => getImportNeedsImportDefaultHelper,
|
|
@@ -176532,6 +176849,7 @@ __export(ts_exports2, {
|
|
|
176532
176849
|
importDefaultHelper: () => importDefaultHelper,
|
|
176533
176850
|
importFromModuleSpecifier: () => importFromModuleSpecifier,
|
|
176534
176851
|
importStarHelper: () => importStarHelper,
|
|
176852
|
+
importSyntaxAffectsModuleResolution: () => importSyntaxAffectsModuleResolution,
|
|
176535
176853
|
indexOfAnyCharCode: () => indexOfAnyCharCode,
|
|
176536
176854
|
indexOfNode: () => indexOfNode,
|
|
176537
176855
|
indicesOf: () => indicesOf,
|
|
@@ -176662,6 +176980,7 @@ __export(ts_exports2, {
|
|
|
176662
176980
|
isConciseBody: () => isConciseBody,
|
|
176663
176981
|
isConditionalExpression: () => isConditionalExpression,
|
|
176664
176982
|
isConditionalTypeNode: () => isConditionalTypeNode,
|
|
176983
|
+
isConstAssertion: () => isConstAssertion,
|
|
176665
176984
|
isConstTypeReference: () => isConstTypeReference,
|
|
176666
176985
|
isConstructSignatureDeclaration: () => isConstructSignatureDeclaration,
|
|
176667
176986
|
isConstructorDeclaration: () => isConstructorDeclaration,
|
|
@@ -176776,6 +177095,7 @@ __export(ts_exports2, {
|
|
|
176776
177095
|
isGetOrSetAccessorDeclaration: () => isGetOrSetAccessorDeclaration,
|
|
176777
177096
|
isGlobalDeclaration: () => isGlobalDeclaration,
|
|
176778
177097
|
isGlobalScopeAugmentation: () => isGlobalScopeAugmentation,
|
|
177098
|
+
isGlobalSourceFile: () => isGlobalSourceFile,
|
|
176779
177099
|
isGrammarError: () => isGrammarError,
|
|
176780
177100
|
isHeritageClause: () => isHeritageClause,
|
|
176781
177101
|
isHoistedFunction: () => isHoistedFunction,
|
|
@@ -177619,11 +177939,11 @@ __export(ts_exports2, {
|
|
|
177619
177939
|
transformESDecorators: () => transformESDecorators,
|
|
177620
177940
|
transformESNext: () => transformESNext,
|
|
177621
177941
|
transformGenerators: () => transformGenerators,
|
|
177942
|
+
transformImpliedNodeFormatDependentModule: () => transformImpliedNodeFormatDependentModule,
|
|
177622
177943
|
transformJsx: () => transformJsx,
|
|
177623
177944
|
transformLegacyDecorators: () => transformLegacyDecorators,
|
|
177624
177945
|
transformModule: () => transformModule,
|
|
177625
177946
|
transformNamedEvaluation: () => transformNamedEvaluation,
|
|
177626
|
-
transformNodeModule: () => transformNodeModule,
|
|
177627
177947
|
transformNodes: () => transformNodes,
|
|
177628
177948
|
transformSystemModule: () => transformSystemModule,
|
|
177629
177949
|
transformTypeScript: () => transformTypeScript,
|
|
@@ -177931,6 +178251,7 @@ __export(ts_server_exports3, {
|
|
|
177931
178251
|
isExternalProject: () => isExternalProject,
|
|
177932
178252
|
isInferredProject: () => isInferredProject,
|
|
177933
178253
|
isInferredProjectName: () => isInferredProjectName,
|
|
178254
|
+
isProjectDeferredClose: () => isProjectDeferredClose,
|
|
177934
178255
|
makeAutoImportProviderProjectName: () => makeAutoImportProviderProjectName,
|
|
177935
178256
|
makeAuxiliaryProjectName: () => makeAuxiliaryProjectName,
|
|
177936
178257
|
makeInferredProjectName: () => makeInferredProjectName,
|
|
@@ -178757,6 +179078,7 @@ var ScriptTarget10 = /* @__PURE__ */ ((ScriptTarget11) => {
|
|
|
178757
179078
|
ScriptTarget11["ES2020"] = "es2020";
|
|
178758
179079
|
ScriptTarget11["ES2021"] = "es2021";
|
|
178759
179080
|
ScriptTarget11["ES2022"] = "es2022";
|
|
179081
|
+
ScriptTarget11["ES2023"] = "es2023";
|
|
178760
179082
|
ScriptTarget11["ESNext"] = "esnext";
|
|
178761
179083
|
ScriptTarget11["JSON"] = "json";
|
|
178762
179084
|
ScriptTarget11["Latest"] = "esnext" /* ESNext */;
|
|
@@ -178843,6 +179165,9 @@ var TextStorage = class {
|
|
|
178843
179165
|
const reloaded = this.reload(newText);
|
|
178844
179166
|
this.fileSize = fileSize;
|
|
178845
179167
|
this.ownFileText = !tempFileName || tempFileName === this.info.fileName;
|
|
179168
|
+
if (this.ownFileText && this.info.mTime === missingFileModifiedTime.getTime()) {
|
|
179169
|
+
this.info.mTime = (this.host.getModifiedTime(this.info.fileName) || missingFileModifiedTime).getTime();
|
|
179170
|
+
}
|
|
178846
179171
|
return reloaded;
|
|
178847
179172
|
}
|
|
178848
179173
|
/**
|
|
@@ -179121,7 +179446,9 @@ var ScriptInfo = class {
|
|
|
179121
179446
|
case 0:
|
|
179122
179447
|
return Errors.ThrowNoProject();
|
|
179123
179448
|
case 1:
|
|
179124
|
-
return ensurePrimaryProjectKind(
|
|
179449
|
+
return ensurePrimaryProjectKind(
|
|
179450
|
+
!isProjectDeferredClose(this.containingProjects[0]) ? this.containingProjects[0] : void 0
|
|
179451
|
+
);
|
|
179125
179452
|
default:
|
|
179126
179453
|
let firstExternalProject;
|
|
179127
179454
|
let firstConfiguredProject;
|
|
@@ -179131,6 +179458,8 @@ var ScriptInfo = class {
|
|
|
179131
179458
|
for (let index = 0; index < this.containingProjects.length; index++) {
|
|
179132
179459
|
const project = this.containingProjects[index];
|
|
179133
179460
|
if (isConfiguredProject(project)) {
|
|
179461
|
+
if (project.deferredClose)
|
|
179462
|
+
continue;
|
|
179134
179463
|
if (!project.isSourceOfProjectReferenceRedirect(this.fileName)) {
|
|
179135
179464
|
if (defaultConfiguredProject === void 0 && index !== this.containingProjects.length - 1) {
|
|
179136
179465
|
defaultConfiguredProject = project.projectService.findDefaultConfiguredProject(this) || false;
|
|
@@ -179204,7 +179533,7 @@ var ScriptInfo = class {
|
|
|
179204
179533
|
}
|
|
179205
179534
|
}
|
|
179206
179535
|
isOrphan() {
|
|
179207
|
-
return !forEach(this.containingProjects, (p) => !p.isOrphan());
|
|
179536
|
+
return this.deferredDelete || !forEach(this.containingProjects, (p) => !p.isOrphan());
|
|
179208
179537
|
}
|
|
179209
179538
|
/** @internal */
|
|
179210
179539
|
isContainedByBackgroundProject() {
|
|
@@ -179650,7 +179979,13 @@ var Project3 = class _Project {
|
|
|
179650
179979
|
return addRange(result, this.typingFiles) || emptyArray;
|
|
179651
179980
|
}
|
|
179652
179981
|
getOrCreateScriptInfoAndAttachToProject(fileName) {
|
|
179653
|
-
const scriptInfo = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
|
|
179982
|
+
const scriptInfo = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
|
|
179983
|
+
fileName,
|
|
179984
|
+
this.currentDirectory,
|
|
179985
|
+
this.directoryStructureHost,
|
|
179986
|
+
/*deferredDeleteOk*/
|
|
179987
|
+
false
|
|
179988
|
+
);
|
|
179654
179989
|
if (scriptInfo) {
|
|
179655
179990
|
const existingValue = this.rootFilesMap.get(scriptInfo.path);
|
|
179656
179991
|
if (existingValue && existingValue.info !== scriptInfo) {
|
|
@@ -179666,7 +180001,13 @@ var Project3 = class _Project {
|
|
|
179666
180001
|
return info && info.scriptKind;
|
|
179667
180002
|
}
|
|
179668
180003
|
getScriptVersion(filename) {
|
|
179669
|
-
const info = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
|
|
180004
|
+
const info = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
|
|
180005
|
+
filename,
|
|
180006
|
+
this.currentDirectory,
|
|
180007
|
+
this.directoryStructureHost,
|
|
180008
|
+
/*deferredDeleteOk*/
|
|
180009
|
+
false
|
|
180010
|
+
);
|
|
179670
180011
|
return info && info.getLatestVersion();
|
|
179671
180012
|
}
|
|
179672
180013
|
getScriptSnapshot(filename) {
|
|
@@ -180198,6 +180539,7 @@ var Project3 = class _Project {
|
|
|
180198
180539
|
(this.changedFilesForExportMapCache || (this.changedFilesForExportMapCache = /* @__PURE__ */ new Set())).add(changedFile);
|
|
180199
180540
|
}
|
|
180200
180541
|
}
|
|
180542
|
+
/** @internal */
|
|
180201
180543
|
markAsDirty() {
|
|
180202
180544
|
if (!this.dirty) {
|
|
180203
180545
|
this.projectStateVersion++;
|
|
@@ -180498,7 +180840,13 @@ var Project3 = class _Project {
|
|
|
180498
180840
|
// by the host for files in the program when the program is retrieved above but
|
|
180499
180841
|
// the program doesn't contain external files so this must be done explicitly.
|
|
180500
180842
|
(inserted) => {
|
|
180501
|
-
const scriptInfo = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
|
|
180843
|
+
const scriptInfo = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
|
|
180844
|
+
inserted,
|
|
180845
|
+
this.currentDirectory,
|
|
180846
|
+
this.directoryStructureHost,
|
|
180847
|
+
/*deferredDeleteOk*/
|
|
180848
|
+
false
|
|
180849
|
+
);
|
|
180502
180850
|
scriptInfo == null ? void 0 : scriptInfo.attachToProject(this);
|
|
180503
180851
|
},
|
|
180504
180852
|
(removed) => this.detachScriptInfoFromProject(removed)
|
|
@@ -181328,6 +181676,7 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
|
|
|
181328
181676
|
isEmpty() {
|
|
181329
181677
|
return !some(this.rootFileNames);
|
|
181330
181678
|
}
|
|
181679
|
+
/** @internal */
|
|
181331
181680
|
isOrphan() {
|
|
181332
181681
|
return true;
|
|
181333
181682
|
}
|
|
@@ -181358,6 +181707,7 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
|
|
|
181358
181707
|
var _a;
|
|
181359
181708
|
return !!((_a = this.rootFileNames) == null ? void 0 : _a.length);
|
|
181360
181709
|
}
|
|
181710
|
+
/** @internal */
|
|
181361
181711
|
markAsDirty() {
|
|
181362
181712
|
this.rootFileNames = void 0;
|
|
181363
181713
|
super.markAsDirty();
|
|
@@ -181481,6 +181831,8 @@ var ConfiguredProject2 = class extends Project3 {
|
|
|
181481
181831
|
* @returns: true if set of files in the project stays the same and false - otherwise.
|
|
181482
181832
|
*/
|
|
181483
181833
|
updateGraph() {
|
|
181834
|
+
if (this.deferredClose)
|
|
181835
|
+
return false;
|
|
181484
181836
|
const isInitialLoad = this.isInitialLoadPending();
|
|
181485
181837
|
this.isInitialLoadPending = returnFalse;
|
|
181486
181838
|
const updateLevel = this.pendingUpdateLevel;
|
|
@@ -181595,6 +181947,12 @@ var ConfiguredProject2 = class extends Project3 {
|
|
|
181595
181947
|
super.close();
|
|
181596
181948
|
}
|
|
181597
181949
|
/** @internal */
|
|
181950
|
+
markAsDirty() {
|
|
181951
|
+
if (this.deferredClose)
|
|
181952
|
+
return;
|
|
181953
|
+
super.markAsDirty();
|
|
181954
|
+
}
|
|
181955
|
+
/** @internal */
|
|
181598
181956
|
addExternalProjectReference() {
|
|
181599
181957
|
this.externalProjectRefCount++;
|
|
181600
181958
|
}
|
|
@@ -181625,7 +181983,7 @@ var ConfiguredProject2 = class extends Project3 {
|
|
|
181625
181983
|
* @internal
|
|
181626
181984
|
*/
|
|
181627
181985
|
hasOpenRef() {
|
|
181628
|
-
var _a;
|
|
181986
|
+
var _a, _b;
|
|
181629
181987
|
if (!!this.externalProjectRefCount) {
|
|
181630
181988
|
return true;
|
|
181631
181989
|
}
|
|
@@ -181633,8 +181991,10 @@ var ConfiguredProject2 = class extends Project3 {
|
|
|
181633
181991
|
return false;
|
|
181634
181992
|
}
|
|
181635
181993
|
const configFileExistenceInfo = this.projectService.configFileExistenceInfoCache.get(this.canonicalConfigFilePath);
|
|
181636
|
-
if (this.
|
|
181994
|
+
if (this.deferredClose)
|
|
181637
181995
|
return !!((_a = configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _a.size);
|
|
181996
|
+
if (this.projectService.hasPendingProjectUpdate(this)) {
|
|
181997
|
+
return !!((_b = configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _b.size);
|
|
181638
181998
|
}
|
|
181639
181999
|
return !!configFileExistenceInfo.openFilesImpactedByConfigFile && forEachEntry(
|
|
181640
182000
|
configFileExistenceInfo.openFilesImpactedByConfigFile,
|
|
@@ -181650,6 +182010,10 @@ var ConfiguredProject2 = class extends Project3 {
|
|
|
181650
182010
|
) || false;
|
|
181651
182011
|
}
|
|
181652
182012
|
/** @internal */
|
|
182013
|
+
isOrphan() {
|
|
182014
|
+
return !!this.deferredClose;
|
|
182015
|
+
}
|
|
182016
|
+
/** @internal */
|
|
181653
182017
|
hasExternalProjectRef() {
|
|
181654
182018
|
return !!this.externalProjectRefCount;
|
|
181655
182019
|
}
|
|
@@ -181704,6 +182068,9 @@ function isExternalProject(project) {
|
|
|
181704
182068
|
function isBackgroundProject(project) {
|
|
181705
182069
|
return project.projectKind === 3 /* AutoImportProvider */ || project.projectKind === 4 /* Auxiliary */;
|
|
181706
182070
|
}
|
|
182071
|
+
function isProjectDeferredClose(project) {
|
|
182072
|
+
return isConfiguredProject(project) && !!project.deferredClose;
|
|
182073
|
+
}
|
|
181707
182074
|
|
|
181708
182075
|
// src/server/editorServices.ts
|
|
181709
182076
|
var maxProgramSizeForNonTsFiles = 20 * 1024 * 1024;
|
|
@@ -182332,6 +182699,8 @@ var _ProjectService = class _ProjectService {
|
|
|
182332
182699
|
);
|
|
182333
182700
|
}
|
|
182334
182701
|
delayUpdateProjectGraph(project) {
|
|
182702
|
+
if (isProjectDeferredClose(project))
|
|
182703
|
+
return;
|
|
182335
182704
|
project.markAsDirty();
|
|
182336
182705
|
if (isBackgroundProject(project))
|
|
182337
182706
|
return;
|
|
@@ -182529,9 +182898,16 @@ var _ProjectService = class _ProjectService {
|
|
|
182529
182898
|
return this.hostConfiguration.preferences;
|
|
182530
182899
|
}
|
|
182531
182900
|
onSourceFileChanged(info, eventKind) {
|
|
182901
|
+
Debug.assert(!info.isScriptOpen());
|
|
182532
182902
|
if (eventKind === 2 /* Deleted */) {
|
|
182533
|
-
this.handleDeletedFile(
|
|
182534
|
-
|
|
182903
|
+
this.handleDeletedFile(
|
|
182904
|
+
info,
|
|
182905
|
+
/*deferredDelete*/
|
|
182906
|
+
true
|
|
182907
|
+
);
|
|
182908
|
+
} else {
|
|
182909
|
+
if (info.deferredDelete)
|
|
182910
|
+
info.deferredDelete = void 0;
|
|
182535
182911
|
info.delayReloadNonMixedContentFile();
|
|
182536
182912
|
this.delayUpdateProjectGraphs(
|
|
182537
182913
|
info.containingProjects,
|
|
@@ -182545,7 +182921,7 @@ var _ProjectService = class _ProjectService {
|
|
|
182545
182921
|
if (info.sourceMapFilePath) {
|
|
182546
182922
|
if (isString(info.sourceMapFilePath)) {
|
|
182547
182923
|
const sourceMapFileInfo = this.getScriptInfoForPath(info.sourceMapFilePath);
|
|
182548
|
-
this.delayUpdateSourceInfoProjects(sourceMapFileInfo
|
|
182924
|
+
this.delayUpdateSourceInfoProjects(sourceMapFileInfo == null ? void 0 : sourceMapFileInfo.sourceInfos);
|
|
182549
182925
|
} else {
|
|
182550
182926
|
this.delayUpdateSourceInfoProjects(info.sourceMapFilePath.sourceInfos);
|
|
182551
182927
|
}
|
|
@@ -182570,25 +182946,20 @@ var _ProjectService = class _ProjectService {
|
|
|
182570
182946
|
);
|
|
182571
182947
|
}
|
|
182572
182948
|
}
|
|
182573
|
-
handleDeletedFile(info) {
|
|
182574
|
-
|
|
182575
|
-
|
|
182949
|
+
handleDeletedFile(info, deferredDelete) {
|
|
182950
|
+
Debug.assert(!info.isScriptOpen());
|
|
182951
|
+
this.delayUpdateProjectGraphs(
|
|
182952
|
+
info.containingProjects,
|
|
182953
|
+
/*clearSourceMapperCache*/
|
|
182954
|
+
false
|
|
182955
|
+
);
|
|
182956
|
+
this.handleSourceMapProjects(info);
|
|
182957
|
+
info.detachAllProjects();
|
|
182958
|
+
if (deferredDelete) {
|
|
182959
|
+
info.delayReloadNonMixedContentFile();
|
|
182960
|
+
info.deferredDelete = true;
|
|
182961
|
+
} else {
|
|
182576
182962
|
this.deleteScriptInfo(info);
|
|
182577
|
-
const containingProjects = info.containingProjects.slice();
|
|
182578
|
-
info.detachAllProjects();
|
|
182579
|
-
this.delayUpdateProjectGraphs(
|
|
182580
|
-
containingProjects,
|
|
182581
|
-
/*clearSourceMapperCache*/
|
|
182582
|
-
false
|
|
182583
|
-
);
|
|
182584
|
-
this.handleSourceMapProjects(info);
|
|
182585
|
-
info.closeSourceMapFileWatcher();
|
|
182586
|
-
if (info.declarationInfoPath) {
|
|
182587
|
-
const declarationInfo = this.getScriptInfoForPath(info.declarationInfoPath);
|
|
182588
|
-
if (declarationInfo) {
|
|
182589
|
-
declarationInfo.sourceMapFilePath = void 0;
|
|
182590
|
-
}
|
|
182591
|
-
}
|
|
182592
182963
|
}
|
|
182593
182964
|
}
|
|
182594
182965
|
/**
|
|
@@ -182699,24 +183070,24 @@ var _ProjectService = class _ProjectService {
|
|
|
182699
183070
|
}
|
|
182700
183071
|
/** @internal */
|
|
182701
183072
|
onConfigFileChanged(canonicalConfigFilePath, eventKind) {
|
|
182702
|
-
var _a;
|
|
182703
183073
|
const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
|
|
183074
|
+
const project = this.getConfiguredProjectByCanonicalConfigFilePath(canonicalConfigFilePath);
|
|
183075
|
+
const wasDefferedClose = project == null ? void 0 : project.deferredClose;
|
|
182704
183076
|
if (eventKind === 2 /* Deleted */) {
|
|
182705
183077
|
configFileExistenceInfo.exists = false;
|
|
182706
|
-
const project = ((_a = configFileExistenceInfo.config) == null ? void 0 : _a.projects.has(canonicalConfigFilePath)) ? this.getConfiguredProjectByCanonicalConfigFilePath(canonicalConfigFilePath) : void 0;
|
|
182707
183078
|
if (project)
|
|
182708
|
-
|
|
183079
|
+
project.deferredClose = true;
|
|
182709
183080
|
} else {
|
|
182710
183081
|
configFileExistenceInfo.exists = true;
|
|
183082
|
+
if (wasDefferedClose) {
|
|
183083
|
+
project.deferredClose = void 0;
|
|
183084
|
+
project.markAsDirty();
|
|
183085
|
+
}
|
|
182711
183086
|
}
|
|
182712
183087
|
this.delayUpdateProjectsFromParsedConfigOnConfigFileChange(canonicalConfigFilePath, "Change in config file detected");
|
|
182713
|
-
this.
|
|
182714
|
-
configFileExistenceInfo
|
|
182715
|
-
/*
|
|
182716
|
-
false,
|
|
182717
|
-
/*delayReload*/
|
|
182718
|
-
true,
|
|
182719
|
-
eventKind !== 2 /* Deleted */ ? identity : (
|
|
183088
|
+
this.delayReloadConfiguredProjectsForFile(
|
|
183089
|
+
configFileExistenceInfo,
|
|
183090
|
+
!wasDefferedClose && eventKind !== 2 /* Deleted */ ? identity : (
|
|
182720
183091
|
// Reload open files if they are root of inferred project
|
|
182721
183092
|
returnTrue
|
|
182722
183093
|
),
|
|
@@ -182725,6 +183096,33 @@ var _ProjectService = class _ProjectService {
|
|
|
182725
183096
|
);
|
|
182726
183097
|
this.delayEnsureProjectForOpenFiles();
|
|
182727
183098
|
}
|
|
183099
|
+
/**
|
|
183100
|
+
* This function goes through all the openFiles and tries to file the config file for them.
|
|
183101
|
+
* If the config file is found and it refers to existing project, it schedules the reload it for reload
|
|
183102
|
+
* If there is no existing project it just opens the configured project for the config file
|
|
183103
|
+
* shouldReloadProjectFor provides a way to filter out files to reload configured project for
|
|
183104
|
+
*/
|
|
183105
|
+
delayReloadConfiguredProjectsForFile(configFileExistenceInfo, shouldReloadProjectFor, reason) {
|
|
183106
|
+
var _a;
|
|
183107
|
+
const updatedProjects = /* @__PURE__ */ new Set();
|
|
183108
|
+
(_a = configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _a.forEach((infoIsRootOfInferredProject, path) => {
|
|
183109
|
+
this.configFileForOpenFiles.delete(path);
|
|
183110
|
+
if (!shouldReloadProjectFor(infoIsRootOfInferredProject)) {
|
|
183111
|
+
return;
|
|
183112
|
+
}
|
|
183113
|
+
const info = this.getScriptInfoForPath(path);
|
|
183114
|
+
Debug.assert(info.isScriptOpen());
|
|
183115
|
+
const configFileName = this.getConfigFileNameForFile(info);
|
|
183116
|
+
if (configFileName) {
|
|
183117
|
+
const project = this.findConfiguredProjectByProjectName(configFileName) || this.createConfiguredProject(configFileName);
|
|
183118
|
+
if (tryAddToSet(updatedProjects, project)) {
|
|
183119
|
+
project.pendingUpdateLevel = 2 /* Full */;
|
|
183120
|
+
project.pendingUpdateReason = reason;
|
|
183121
|
+
this.delayUpdateProjectGraph(project);
|
|
183122
|
+
}
|
|
183123
|
+
}
|
|
183124
|
+
});
|
|
183125
|
+
}
|
|
182728
183126
|
removeProject(project) {
|
|
182729
183127
|
this.logger.info("`remove Project::");
|
|
182730
183128
|
project.print(
|
|
@@ -182868,17 +183266,24 @@ var _ProjectService = class _ProjectService {
|
|
|
182868
183266
|
if (fileExists) {
|
|
182869
183267
|
this.watchClosedScriptInfo(info);
|
|
182870
183268
|
} else {
|
|
182871
|
-
this.handleDeletedFile(
|
|
183269
|
+
this.handleDeletedFile(
|
|
183270
|
+
info,
|
|
183271
|
+
/*deferredDelete*/
|
|
183272
|
+
false
|
|
183273
|
+
);
|
|
182872
183274
|
}
|
|
182873
183275
|
return ensureProjectsForOpenFiles;
|
|
182874
183276
|
}
|
|
182875
183277
|
deleteScriptInfo(info) {
|
|
183278
|
+
Debug.assert(!info.isScriptOpen());
|
|
182876
183279
|
this.filenameToScriptInfo.delete(info.path);
|
|
182877
183280
|
this.filenameToScriptInfoVersion.set(info.path, info.textStorage.version);
|
|
183281
|
+
this.stopWatchingScriptInfo(info);
|
|
182878
183282
|
const realpath = info.getRealpathIfDifferent();
|
|
182879
183283
|
if (realpath) {
|
|
182880
183284
|
this.realpathToScriptInfos.remove(realpath, info);
|
|
182881
183285
|
}
|
|
183286
|
+
info.closeSourceMapFileWatcher();
|
|
182882
183287
|
}
|
|
182883
183288
|
configFileExists(configFileName, canonicalConfigFilePath, info) {
|
|
182884
183289
|
var _a;
|
|
@@ -183118,7 +183523,8 @@ var _ProjectService = class _ProjectService {
|
|
|
183118
183523
|
/** @internal */
|
|
183119
183524
|
findConfiguredProjectByProjectName(configFileName) {
|
|
183120
183525
|
const canonicalConfigFilePath = asNormalizedPath(this.toCanonicalFileName(configFileName));
|
|
183121
|
-
|
|
183526
|
+
const result = this.getConfiguredProjectByCanonicalConfigFilePath(canonicalConfigFilePath);
|
|
183527
|
+
return !(result == null ? void 0 : result.deferredClose) ? result : void 0;
|
|
183122
183528
|
}
|
|
183123
183529
|
getConfiguredProjectByCanonicalConfigFilePath(canonicalConfigFilePath) {
|
|
183124
183530
|
return this.configuredProjects.get(canonicalConfigFilePath);
|
|
@@ -183248,6 +183654,7 @@ var _ProjectService = class _ProjectService {
|
|
|
183248
183654
|
this.documentRegistry,
|
|
183249
183655
|
configFileExistenceInfo.config.cachedDirectoryStructureHost
|
|
183250
183656
|
);
|
|
183657
|
+
Debug.assert(!this.configuredProjects.has(canonicalConfigFilePath));
|
|
183251
183658
|
this.configuredProjects.set(canonicalConfigFilePath, project);
|
|
183252
183659
|
this.createConfigFileWatcherForParsedConfig(configFileName, canonicalConfigFilePath, project);
|
|
183253
183660
|
return project;
|
|
@@ -183476,7 +183883,9 @@ var _ProjectService = class _ProjectService {
|
|
|
183476
183883
|
project.currentDirectory,
|
|
183477
183884
|
scriptKind,
|
|
183478
183885
|
hasMixedContent,
|
|
183479
|
-
project.directoryStructureHost
|
|
183886
|
+
project.directoryStructureHost,
|
|
183887
|
+
/*deferredDeleteOk*/
|
|
183888
|
+
false
|
|
183480
183889
|
));
|
|
183481
183890
|
path = scriptInfo.path;
|
|
183482
183891
|
const existingValue = projectRootFilesMap.get(path);
|
|
@@ -183671,7 +184080,7 @@ var _ProjectService = class _ProjectService {
|
|
|
183671
184080
|
return project;
|
|
183672
184081
|
}
|
|
183673
184082
|
/** @internal */
|
|
183674
|
-
getOrCreateScriptInfoNotOpenedByClient(uncheckedFileName, currentDirectory, hostToQueryFileExistsOn) {
|
|
184083
|
+
getOrCreateScriptInfoNotOpenedByClient(uncheckedFileName, currentDirectory, hostToQueryFileExistsOn, deferredDeleteOk) {
|
|
183675
184084
|
return this.getOrCreateScriptInfoNotOpenedByClientForNormalizedPath(
|
|
183676
184085
|
toNormalizedPath(uncheckedFileName),
|
|
183677
184086
|
currentDirectory,
|
|
@@ -183679,7 +184088,8 @@ var _ProjectService = class _ProjectService {
|
|
|
183679
184088
|
void 0,
|
|
183680
184089
|
/*hasMixedContent*/
|
|
183681
184090
|
void 0,
|
|
183682
|
-
hostToQueryFileExistsOn
|
|
184091
|
+
hostToQueryFileExistsOn,
|
|
184092
|
+
deferredDeleteOk
|
|
183683
184093
|
);
|
|
183684
184094
|
}
|
|
183685
184095
|
getScriptInfo(uncheckedFileName) {
|
|
@@ -183696,7 +184106,13 @@ var _ProjectService = class _ProjectService {
|
|
|
183696
184106
|
}
|
|
183697
184107
|
/** @internal */
|
|
183698
184108
|
logErrorForScriptInfoNotFound(fileName) {
|
|
183699
|
-
const names = arrayFrom(
|
|
184109
|
+
const names = arrayFrom(
|
|
184110
|
+
mapDefinedIterator(
|
|
184111
|
+
this.filenameToScriptInfo.entries(),
|
|
184112
|
+
(entry) => entry[1].deferredDelete ? void 0 : entry
|
|
184113
|
+
),
|
|
184114
|
+
([path, scriptInfo]) => ({ path, fileName: scriptInfo.fileName })
|
|
184115
|
+
);
|
|
183700
184116
|
this.logger.msg(`Could not find file ${JSON.stringify(fileName)}.
|
|
183701
184117
|
All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
183702
184118
|
}
|
|
@@ -183768,7 +184184,7 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
183768
184184
|
if (dirPath === fileOrDirectoryPath) {
|
|
183769
184185
|
this.refreshScriptInfosInDirectory(dirPath);
|
|
183770
184186
|
} else {
|
|
183771
|
-
const info = this.
|
|
184187
|
+
const info = this.filenameToScriptInfo.get(fileOrDirectoryPath);
|
|
183772
184188
|
if (info) {
|
|
183773
184189
|
if (isScriptInfoWatchedFromNodeModules(info)) {
|
|
183774
184190
|
this.refreshScriptInfo(info);
|
|
@@ -183850,7 +184266,7 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
183850
184266
|
info.fileWatcher = void 0;
|
|
183851
184267
|
}
|
|
183852
184268
|
}
|
|
183853
|
-
getOrCreateScriptInfoNotOpenedByClientForNormalizedPath(fileName, currentDirectory, scriptKind, hasMixedContent, hostToQueryFileExistsOn) {
|
|
184269
|
+
getOrCreateScriptInfoNotOpenedByClientForNormalizedPath(fileName, currentDirectory, scriptKind, hasMixedContent, hostToQueryFileExistsOn, deferredDeleteOk) {
|
|
183854
184270
|
if (isRootedDiskPath(fileName) || isDynamicFileName(fileName)) {
|
|
183855
184271
|
return this.getOrCreateScriptInfoWorker(
|
|
183856
184272
|
fileName,
|
|
@@ -183860,8 +184276,9 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
183860
184276
|
/*fileContent*/
|
|
183861
184277
|
void 0,
|
|
183862
184278
|
scriptKind,
|
|
183863
|
-
hasMixedContent,
|
|
183864
|
-
hostToQueryFileExistsOn
|
|
184279
|
+
!!hasMixedContent,
|
|
184280
|
+
hostToQueryFileExistsOn,
|
|
184281
|
+
deferredDeleteOk
|
|
183865
184282
|
);
|
|
183866
184283
|
}
|
|
183867
184284
|
const info = this.openFilesWithNonRootedDiskPath.get(this.toCanonicalFileName(fileName));
|
|
@@ -183870,24 +184287,23 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
183870
184287
|
}
|
|
183871
184288
|
return void 0;
|
|
183872
184289
|
}
|
|
183873
|
-
|
|
184290
|
+
getOrCreateScriptInfoForNormalizedPath(fileName, openedByClient, fileContent, scriptKind, hasMixedContent, hostToQueryFileExistsOn) {
|
|
183874
184291
|
return this.getOrCreateScriptInfoWorker(
|
|
183875
184292
|
fileName,
|
|
183876
|
-
currentDirectory,
|
|
183877
|
-
|
|
183878
|
-
true,
|
|
184293
|
+
this.currentDirectory,
|
|
184294
|
+
openedByClient,
|
|
183879
184295
|
fileContent,
|
|
183880
184296
|
scriptKind,
|
|
183881
|
-
hasMixedContent
|
|
184297
|
+
!!hasMixedContent,
|
|
184298
|
+
hostToQueryFileExistsOn,
|
|
184299
|
+
/*deferredDeleteOk*/
|
|
184300
|
+
false
|
|
183882
184301
|
);
|
|
183883
184302
|
}
|
|
183884
|
-
|
|
183885
|
-
return this.getOrCreateScriptInfoWorker(fileName, this.currentDirectory, openedByClient, fileContent, scriptKind, hasMixedContent, hostToQueryFileExistsOn);
|
|
183886
|
-
}
|
|
183887
|
-
getOrCreateScriptInfoWorker(fileName, currentDirectory, openedByClient, fileContent, scriptKind, hasMixedContent, hostToQueryFileExistsOn) {
|
|
184303
|
+
getOrCreateScriptInfoWorker(fileName, currentDirectory, openedByClient, fileContent, scriptKind, hasMixedContent, hostToQueryFileExistsOn, deferredDeleteOk) {
|
|
183888
184304
|
Debug.assert(fileContent === void 0 || openedByClient, "ScriptInfo needs to be opened by client to be able to set its user defined content");
|
|
183889
184305
|
const path = normalizedPathToPath(fileName, currentDirectory, this.toCanonicalFileName);
|
|
183890
|
-
let info = this.
|
|
184306
|
+
let info = this.filenameToScriptInfo.get(path);
|
|
183891
184307
|
if (!info) {
|
|
183892
184308
|
const isDynamic = isDynamicFileName(fileName);
|
|
183893
184309
|
Debug.assert(isRootedDiskPath(fileName) || isDynamic || openedByClient, "", () => `${JSON.stringify({ fileName, currentDirectory, hostCurrentDirectory: this.currentDirectory, openKeys: arrayFrom(this.openFilesWithNonRootedDiskPath.keys()) })}
|
|
@@ -183899,7 +184315,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183899
184315
|
if (!openedByClient && !isDynamic && !(hostToQueryFileExistsOn || this.host).fileExists(fileName)) {
|
|
183900
184316
|
return;
|
|
183901
184317
|
}
|
|
183902
|
-
info = new ScriptInfo(this.host, fileName, scriptKind,
|
|
184318
|
+
info = new ScriptInfo(this.host, fileName, scriptKind, hasMixedContent, path, this.filenameToScriptInfoVersion.get(path));
|
|
183903
184319
|
this.filenameToScriptInfo.set(info.path, info);
|
|
183904
184320
|
this.filenameToScriptInfoVersion.delete(info.path);
|
|
183905
184321
|
if (!openedByClient) {
|
|
@@ -183907,6 +184323,12 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183907
184323
|
} else if (!isRootedDiskPath(fileName) && (!isDynamic || this.currentDirectory !== currentDirectory)) {
|
|
183908
184324
|
this.openFilesWithNonRootedDiskPath.set(this.toCanonicalFileName(fileName), info);
|
|
183909
184325
|
}
|
|
184326
|
+
} else if (info.deferredDelete) {
|
|
184327
|
+
Debug.assert(!info.isDynamic);
|
|
184328
|
+
if (!openedByClient && !(hostToQueryFileExistsOn || this.host).fileExists(fileName)) {
|
|
184329
|
+
return deferredDeleteOk ? info : void 0;
|
|
184330
|
+
}
|
|
184331
|
+
info.deferredDelete = void 0;
|
|
183910
184332
|
}
|
|
183911
184333
|
if (openedByClient) {
|
|
183912
184334
|
this.stopWatchingScriptInfo(info);
|
|
@@ -183924,11 +184346,18 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183924
184346
|
return !isRootedDiskPath(fileName) && this.openFilesWithNonRootedDiskPath.get(this.toCanonicalFileName(fileName)) || this.getScriptInfoForPath(normalizedPathToPath(fileName, this.currentDirectory, this.toCanonicalFileName));
|
|
183925
184347
|
}
|
|
183926
184348
|
getScriptInfoForPath(fileName) {
|
|
183927
|
-
|
|
184349
|
+
const info = this.filenameToScriptInfo.get(fileName);
|
|
184350
|
+
return !info || !info.deferredDelete ? info : void 0;
|
|
183928
184351
|
}
|
|
183929
184352
|
/** @internal */
|
|
183930
184353
|
getDocumentPositionMapper(project, generatedFileName, sourceFileName) {
|
|
183931
|
-
const declarationInfo = this.getOrCreateScriptInfoNotOpenedByClient(
|
|
184354
|
+
const declarationInfo = this.getOrCreateScriptInfoNotOpenedByClient(
|
|
184355
|
+
generatedFileName,
|
|
184356
|
+
project.currentDirectory,
|
|
184357
|
+
this.host,
|
|
184358
|
+
/*deferredDeleteOk*/
|
|
184359
|
+
false
|
|
184360
|
+
);
|
|
183932
184361
|
if (!declarationInfo) {
|
|
183933
184362
|
if (sourceFileName) {
|
|
183934
184363
|
project.addGeneratedFileWatch(generatedFileName, sourceFileName);
|
|
@@ -183953,14 +184382,17 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183953
184382
|
return void 0;
|
|
183954
184383
|
}
|
|
183955
184384
|
let sourceMapFileInfo;
|
|
183956
|
-
let mapFileNameFromDeclarationInfo;
|
|
183957
184385
|
let readMapFile = (mapFileName, mapFileNameFromDts) => {
|
|
183958
|
-
const mapInfo = this.getOrCreateScriptInfoNotOpenedByClient(
|
|
183959
|
-
|
|
183960
|
-
|
|
184386
|
+
const mapInfo = this.getOrCreateScriptInfoNotOpenedByClient(
|
|
184387
|
+
mapFileName,
|
|
184388
|
+
project.currentDirectory,
|
|
184389
|
+
this.host,
|
|
184390
|
+
/*deferredDeleteOk*/
|
|
184391
|
+
true
|
|
184392
|
+
);
|
|
184393
|
+
sourceMapFileInfo = mapInfo || mapFileNameFromDts;
|
|
184394
|
+
if (!mapInfo || mapInfo.deferredDelete)
|
|
183961
184395
|
return void 0;
|
|
183962
|
-
}
|
|
183963
|
-
sourceMapFileInfo = mapInfo;
|
|
183964
184396
|
const snap = mapInfo.getSnapshot();
|
|
183965
184397
|
if (mapInfo.documentPositionMapper !== void 0)
|
|
183966
184398
|
return mapInfo.documentPositionMapper;
|
|
@@ -183975,18 +184407,21 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183975
184407
|
);
|
|
183976
184408
|
readMapFile = void 0;
|
|
183977
184409
|
if (sourceMapFileInfo) {
|
|
183978
|
-
|
|
183979
|
-
|
|
183980
|
-
|
|
183981
|
-
|
|
183982
|
-
|
|
183983
|
-
|
|
183984
|
-
|
|
183985
|
-
|
|
183986
|
-
|
|
183987
|
-
|
|
183988
|
-
|
|
183989
|
-
|
|
184410
|
+
if (!isString(sourceMapFileInfo)) {
|
|
184411
|
+
declarationInfo.sourceMapFilePath = sourceMapFileInfo.path;
|
|
184412
|
+
sourceMapFileInfo.declarationInfoPath = declarationInfo.path;
|
|
184413
|
+
if (!sourceMapFileInfo.deferredDelete)
|
|
184414
|
+
sourceMapFileInfo.documentPositionMapper = documentPositionMapper || false;
|
|
184415
|
+
sourceMapFileInfo.sourceInfos = this.addSourceInfoToSourceMap(sourceFileName, project, sourceMapFileInfo.sourceInfos);
|
|
184416
|
+
} else {
|
|
184417
|
+
declarationInfo.sourceMapFilePath = {
|
|
184418
|
+
watcher: this.addMissingSourceMapFile(
|
|
184419
|
+
project.currentDirectory === this.currentDirectory ? sourceMapFileInfo : getNormalizedAbsolutePath(sourceMapFileInfo, project.currentDirectory),
|
|
184420
|
+
declarationInfo.path
|
|
184421
|
+
),
|
|
184422
|
+
sourceInfos: this.addSourceInfoToSourceMap(sourceFileName, project)
|
|
184423
|
+
};
|
|
184424
|
+
}
|
|
183990
184425
|
} else {
|
|
183991
184426
|
declarationInfo.sourceMapFilePath = false;
|
|
183992
184427
|
}
|
|
@@ -183994,7 +184429,13 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183994
184429
|
}
|
|
183995
184430
|
addSourceInfoToSourceMap(sourceFileName, project, sourceInfos) {
|
|
183996
184431
|
if (sourceFileName) {
|
|
183997
|
-
const sourceInfo = this.getOrCreateScriptInfoNotOpenedByClient(
|
|
184432
|
+
const sourceInfo = this.getOrCreateScriptInfoNotOpenedByClient(
|
|
184433
|
+
sourceFileName,
|
|
184434
|
+
project.currentDirectory,
|
|
184435
|
+
project.directoryStructureHost,
|
|
184436
|
+
/*deferredDeleteOk*/
|
|
184437
|
+
false
|
|
184438
|
+
);
|
|
183998
184439
|
(sourceInfos || (sourceInfos = /* @__PURE__ */ new Set())).add(sourceInfo.path);
|
|
183999
184440
|
}
|
|
184000
184441
|
return sourceInfos;
|
|
@@ -184029,13 +184470,19 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184029
184470
|
if (sourceFile && sourceFile.resolvedPath === path)
|
|
184030
184471
|
return sourceFile;
|
|
184031
184472
|
}
|
|
184032
|
-
const info = this.getOrCreateScriptInfoNotOpenedByClient(
|
|
184473
|
+
const info = this.getOrCreateScriptInfoNotOpenedByClient(
|
|
184474
|
+
fileName,
|
|
184475
|
+
(project || this).currentDirectory,
|
|
184476
|
+
project ? project.directoryStructureHost : this.host,
|
|
184477
|
+
/*deferredDeleteOk*/
|
|
184478
|
+
false
|
|
184479
|
+
);
|
|
184033
184480
|
if (!info)
|
|
184034
184481
|
return void 0;
|
|
184035
184482
|
if (declarationInfo && isString(declarationInfo.sourceMapFilePath) && info !== declarationInfo) {
|
|
184036
184483
|
const sourceMapInfo = this.getScriptInfoForPath(declarationInfo.sourceMapFilePath);
|
|
184037
184484
|
if (sourceMapInfo) {
|
|
184038
|
-
(sourceMapInfo.sourceInfos
|
|
184485
|
+
(sourceMapInfo.sourceInfos ?? (sourceMapInfo.sourceInfos = /* @__PURE__ */ new Set())).add(info.path);
|
|
184039
184486
|
}
|
|
184040
184487
|
}
|
|
184041
184488
|
if (info.cacheSourceFile)
|
|
@@ -184085,7 +184532,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184085
184532
|
if (lazyConfiguredProjectsFromExternalProject && !this.hostConfiguration.preferences.lazyConfiguredProjectsFromExternalProject) {
|
|
184086
184533
|
this.externalProjectToConfiguredProjectMap.forEach(
|
|
184087
184534
|
(projects) => projects.forEach((project) => {
|
|
184088
|
-
if (!project.isClosed() && project.hasExternalProjectRef() && project.pendingUpdateLevel === 2 /* Full */ && !this.pendingProjectUpdates.has(project.getProjectName())) {
|
|
184535
|
+
if (!project.deferredClose && !project.isClosed() && project.hasExternalProjectRef() && project.pendingUpdateLevel === 2 /* Full */ && !this.pendingProjectUpdates.has(project.getProjectName())) {
|
|
184089
184536
|
project.updateGraph();
|
|
184090
184537
|
}
|
|
184091
184538
|
})
|
|
@@ -184130,7 +184577,10 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184130
184577
|
return;
|
|
184131
184578
|
if (!info.fileWatcher)
|
|
184132
184579
|
return;
|
|
184133
|
-
this.onSourceFileChanged(
|
|
184580
|
+
this.onSourceFileChanged(
|
|
184581
|
+
info,
|
|
184582
|
+
this.host.fileExists(info.fileName) ? info.deferredDelete ? 0 /* Created */ : 1 /* Changed */ : 2 /* Deleted */
|
|
184583
|
+
);
|
|
184134
184584
|
});
|
|
184135
184585
|
this.pendingProjectUpdates.forEach((_project, projectName) => {
|
|
184136
184586
|
this.throttledOperations.cancel(projectName);
|
|
@@ -184142,15 +184592,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184142
184592
|
if (info.config)
|
|
184143
184593
|
info.config.updateLevel = 2 /* Full */;
|
|
184144
184594
|
});
|
|
184145
|
-
this.reloadConfiguredProjectForFiles(
|
|
184146
|
-
this.openFiles,
|
|
184147
|
-
/*clearSemanticCache*/
|
|
184148
|
-
true,
|
|
184149
|
-
/*delayReload*/
|
|
184150
|
-
false,
|
|
184151
|
-
returnTrue,
|
|
184152
|
-
"User requested reload projects"
|
|
184153
|
-
);
|
|
184595
|
+
this.reloadConfiguredProjectForFiles("User requested reload projects");
|
|
184154
184596
|
this.externalProjects.forEach((project) => {
|
|
184155
184597
|
this.clearSemanticCache(project);
|
|
184156
184598
|
project.updateGraph();
|
|
@@ -184163,69 +184605,57 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184163
184605
|
/**
|
|
184164
184606
|
* This function goes through all the openFiles and tries to file the config file for them.
|
|
184165
184607
|
* If the config file is found and it refers to existing project, it reloads it either immediately
|
|
184166
|
-
* or schedules it for reload depending on delayReload option
|
|
184167
184608
|
* If there is no existing project it just opens the configured project for the config file
|
|
184168
|
-
* reloadForInfo provides a way to filter out files to reload configured project for
|
|
184169
184609
|
*/
|
|
184170
|
-
reloadConfiguredProjectForFiles(
|
|
184171
|
-
|
|
184610
|
+
reloadConfiguredProjectForFiles(reason) {
|
|
184611
|
+
var _a;
|
|
184612
|
+
const updatedProjects = /* @__PURE__ */ new Set();
|
|
184172
184613
|
const reloadChildProject = (child) => {
|
|
184173
|
-
if (
|
|
184174
|
-
updatedProjects.set(child.canonicalConfigFilePath, true);
|
|
184614
|
+
if (tryAddToSet(updatedProjects, child)) {
|
|
184175
184615
|
this.reloadConfiguredProject(
|
|
184176
184616
|
child,
|
|
184177
184617
|
reason,
|
|
184178
184618
|
/*isInitialLoad*/
|
|
184179
184619
|
false,
|
|
184180
|
-
clearSemanticCache
|
|
184620
|
+
/*clearSemanticCache*/
|
|
184621
|
+
true
|
|
184181
184622
|
);
|
|
184182
184623
|
}
|
|
184183
184624
|
};
|
|
184184
|
-
openFiles == null ? void 0 :
|
|
184625
|
+
(_a = this.openFiles) == null ? void 0 : _a.forEach((_projectRoot, path) => {
|
|
184185
184626
|
this.configFileForOpenFiles.delete(path);
|
|
184186
|
-
if (!shouldReloadProjectFor(openFileValue)) {
|
|
184187
|
-
return;
|
|
184188
|
-
}
|
|
184189
184627
|
const info = this.getScriptInfoForPath(path);
|
|
184190
184628
|
Debug.assert(info.isScriptOpen());
|
|
184191
184629
|
const configFileName = this.getConfigFileNameForFile(info);
|
|
184192
184630
|
if (configFileName) {
|
|
184193
184631
|
const project = this.findConfiguredProjectByProjectName(configFileName) || this.createConfiguredProject(configFileName);
|
|
184194
|
-
if (
|
|
184195
|
-
|
|
184196
|
-
|
|
184197
|
-
|
|
184198
|
-
|
|
184199
|
-
|
|
184200
|
-
|
|
184201
|
-
|
|
184202
|
-
|
|
184203
|
-
|
|
184632
|
+
if (tryAddToSet(updatedProjects, project)) {
|
|
184633
|
+
this.reloadConfiguredProject(
|
|
184634
|
+
project,
|
|
184635
|
+
reason,
|
|
184636
|
+
/*isInitialLoad*/
|
|
184637
|
+
false,
|
|
184638
|
+
/*clearSemanticCache*/
|
|
184639
|
+
true
|
|
184640
|
+
);
|
|
184641
|
+
if (!projectContainsInfoDirectly(project, info)) {
|
|
184642
|
+
const referencedProject = forEachResolvedProjectReferenceProject(
|
|
184204
184643
|
project,
|
|
184205
|
-
|
|
184206
|
-
|
|
184207
|
-
|
|
184208
|
-
|
|
184644
|
+
info.path,
|
|
184645
|
+
(child) => {
|
|
184646
|
+
reloadChildProject(child);
|
|
184647
|
+
return projectContainsInfoDirectly(child, info);
|
|
184648
|
+
},
|
|
184649
|
+
1 /* FindCreate */
|
|
184209
184650
|
);
|
|
184210
|
-
if (
|
|
184211
|
-
|
|
184651
|
+
if (referencedProject) {
|
|
184652
|
+
forEachResolvedProjectReferenceProject(
|
|
184212
184653
|
project,
|
|
184213
|
-
|
|
184214
|
-
|
|
184215
|
-
|
|
184216
|
-
|
|
184217
|
-
},
|
|
184218
|
-
1 /* FindCreate */
|
|
184654
|
+
/*fileName*/
|
|
184655
|
+
void 0,
|
|
184656
|
+
reloadChildProject,
|
|
184657
|
+
0 /* Find */
|
|
184219
184658
|
);
|
|
184220
|
-
if (referencedProject) {
|
|
184221
|
-
forEachResolvedProjectReferenceProject(
|
|
184222
|
-
project,
|
|
184223
|
-
/*fileName*/
|
|
184224
|
-
void 0,
|
|
184225
|
-
reloadChildProject,
|
|
184226
|
-
0 /* Find */
|
|
184227
|
-
);
|
|
184228
|
-
}
|
|
184229
184659
|
}
|
|
184230
184660
|
}
|
|
184231
184661
|
}
|
|
@@ -184342,10 +184772,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184342
184772
|
});
|
|
184343
184773
|
return originalLocation;
|
|
184344
184774
|
function addOriginalConfiguredProject(originalProject) {
|
|
184345
|
-
|
|
184346
|
-
project.originalConfiguredProjects = /* @__PURE__ */ new Set();
|
|
184347
|
-
}
|
|
184348
|
-
project.originalConfiguredProjects.add(originalProject.canonicalConfigFilePath);
|
|
184775
|
+
(project.originalConfiguredProjects ?? (project.originalConfiguredProjects = /* @__PURE__ */ new Set())).add(originalProject.canonicalConfigFilePath);
|
|
184349
184776
|
}
|
|
184350
184777
|
}
|
|
184351
184778
|
/** @internal */
|
|
@@ -184359,7 +184786,19 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184359
184786
|
});
|
|
184360
184787
|
}
|
|
184361
184788
|
getOrCreateOpenScriptInfo(fileName, fileContent, scriptKind, hasMixedContent, projectRootPath) {
|
|
184362
|
-
const info = this.
|
|
184789
|
+
const info = this.getOrCreateScriptInfoWorker(
|
|
184790
|
+
fileName,
|
|
184791
|
+
projectRootPath ? this.getNormalizedAbsolutePath(projectRootPath) : this.currentDirectory,
|
|
184792
|
+
/*openedByClient*/
|
|
184793
|
+
true,
|
|
184794
|
+
fileContent,
|
|
184795
|
+
scriptKind,
|
|
184796
|
+
!!hasMixedContent,
|
|
184797
|
+
/*hostToQueryFileExistsOn*/
|
|
184798
|
+
void 0,
|
|
184799
|
+
/*deferredDeleteOk*/
|
|
184800
|
+
true
|
|
184801
|
+
);
|
|
184363
184802
|
this.openFiles.set(info.path, projectRootPath);
|
|
184364
184803
|
return info;
|
|
184365
184804
|
}
|
|
@@ -184505,7 +184944,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184505
184944
|
removeOrphanConfiguredProjects(toRetainConfiguredProjects) {
|
|
184506
184945
|
const toRemoveConfiguredProjects = new Map(this.configuredProjects);
|
|
184507
184946
|
const markOriginalProjectsAsUsed = (project) => {
|
|
184508
|
-
if (
|
|
184947
|
+
if (project.originalConfiguredProjects && (isConfiguredProject(project) || !project.isOrphan())) {
|
|
184509
184948
|
project.originalConfiguredProjects.forEach(
|
|
184510
184949
|
(_value, configuredProjectPath) => {
|
|
184511
184950
|
const project2 = this.getConfiguredProjectByCanonicalConfigFilePath(configuredProjectPath);
|
|
@@ -184524,18 +184963,17 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184524
184963
|
this.inferredProjects.forEach(markOriginalProjectsAsUsed);
|
|
184525
184964
|
this.externalProjects.forEach(markOriginalProjectsAsUsed);
|
|
184526
184965
|
this.configuredProjects.forEach((project) => {
|
|
184966
|
+
if (!toRemoveConfiguredProjects.has(project.canonicalConfigFilePath))
|
|
184967
|
+
return;
|
|
184527
184968
|
if (project.hasOpenRef()) {
|
|
184528
184969
|
retainConfiguredProject(project);
|
|
184529
|
-
} else if (
|
|
184530
|
-
|
|
184531
|
-
project,
|
|
184532
|
-
(ref) => isRetained(ref) && retainConfiguredProject(project)
|
|
184533
|
-
);
|
|
184970
|
+
} else if (forEachReferencedProject(project, (ref) => isRetained(ref))) {
|
|
184971
|
+
retainConfiguredProject(project);
|
|
184534
184972
|
}
|
|
184535
184973
|
});
|
|
184536
184974
|
toRemoveConfiguredProjects.forEach((project) => this.removeProject(project));
|
|
184537
184975
|
function isRetained(project) {
|
|
184538
|
-
return
|
|
184976
|
+
return !toRemoveConfiguredProjects.has(project.canonicalConfigFilePath) || project.hasOpenRef();
|
|
184539
184977
|
}
|
|
184540
184978
|
function retainConfiguredProject(project) {
|
|
184541
184979
|
if (toRemoveConfiguredProjects.delete(project.canonicalConfigFilePath)) {
|
|
@@ -184547,13 +184985,15 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184547
184985
|
removeOrphanScriptInfos() {
|
|
184548
184986
|
const toRemoveScriptInfos = new Map(this.filenameToScriptInfo);
|
|
184549
184987
|
this.filenameToScriptInfo.forEach((info) => {
|
|
184988
|
+
if (info.deferredDelete)
|
|
184989
|
+
return;
|
|
184550
184990
|
if (!info.isScriptOpen() && info.isOrphan() && !info.isContainedByBackgroundProject()) {
|
|
184551
184991
|
if (!info.sourceMapFilePath)
|
|
184552
184992
|
return;
|
|
184553
184993
|
let sourceInfos;
|
|
184554
184994
|
if (isString(info.sourceMapFilePath)) {
|
|
184555
|
-
const sourceMapInfo = this.
|
|
184556
|
-
sourceInfos = sourceMapInfo
|
|
184995
|
+
const sourceMapInfo = this.filenameToScriptInfo.get(info.sourceMapFilePath);
|
|
184996
|
+
sourceInfos = sourceMapInfo == null ? void 0 : sourceMapInfo.sourceInfos;
|
|
184557
184997
|
} else {
|
|
184558
184998
|
sourceInfos = info.sourceMapFilePath.sourceInfos;
|
|
184559
184999
|
}
|
|
@@ -184570,9 +185010,16 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184570
185010
|
if (info.sourceMapFilePath) {
|
|
184571
185011
|
let sourceInfos;
|
|
184572
185012
|
if (isString(info.sourceMapFilePath)) {
|
|
184573
|
-
|
|
184574
|
-
|
|
184575
|
-
|
|
185013
|
+
const sourceMapInfo = this.filenameToScriptInfo.get(info.sourceMapFilePath);
|
|
185014
|
+
if (sourceMapInfo == null ? void 0 : sourceMapInfo.deferredDelete) {
|
|
185015
|
+
info.sourceMapFilePath = {
|
|
185016
|
+
watcher: this.addMissingSourceMapFile(sourceMapInfo.fileName, info.path),
|
|
185017
|
+
sourceInfos: sourceMapInfo.sourceInfos
|
|
185018
|
+
};
|
|
185019
|
+
} else {
|
|
185020
|
+
toRemoveScriptInfos.delete(info.sourceMapFilePath);
|
|
185021
|
+
}
|
|
185022
|
+
sourceInfos = sourceMapInfo == null ? void 0 : sourceMapInfo.sourceInfos;
|
|
184576
185023
|
} else {
|
|
184577
185024
|
sourceInfos = info.sourceMapFilePath.sourceInfos;
|
|
184578
185025
|
}
|
|
@@ -184581,11 +185028,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184581
185028
|
}
|
|
184582
185029
|
}
|
|
184583
185030
|
});
|
|
184584
|
-
toRemoveScriptInfos.forEach((info) =>
|
|
184585
|
-
this.stopWatchingScriptInfo(info);
|
|
184586
|
-
this.deleteScriptInfo(info);
|
|
184587
|
-
info.closeSourceMapFileWatcher();
|
|
184588
|
-
});
|
|
185031
|
+
toRemoveScriptInfos.forEach((info) => this.deleteScriptInfo(info));
|
|
184589
185032
|
}
|
|
184590
185033
|
telemetryOnOpenFile(scriptInfo) {
|
|
184591
185034
|
if (this.serverMode !== 0 /* Semantic */ || !this.eventHandler || !scriptInfo.isJavaScript() || !addToSeen(this.allJsFilesForOpenFileTelemetry, scriptInfo.path)) {
|
|
@@ -184617,7 +185060,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184617
185060
|
synchronizeProjectList(knownProjects, includeProjectReferenceRedirectInfo) {
|
|
184618
185061
|
const files = [];
|
|
184619
185062
|
this.collectChanges(knownProjects, this.externalProjects, includeProjectReferenceRedirectInfo, files);
|
|
184620
|
-
this.collectChanges(knownProjects, this.configuredProjects.values(), includeProjectReferenceRedirectInfo, files);
|
|
185063
|
+
this.collectChanges(knownProjects, mapDefinedIterator(this.configuredProjects.values(), (p) => p.deferredClose ? void 0 : p), includeProjectReferenceRedirectInfo, files);
|
|
184621
185064
|
this.collectChanges(knownProjects, this.inferredProjects, includeProjectReferenceRedirectInfo, files);
|
|
184622
185065
|
return files;
|
|
184623
185066
|
}
|
|
@@ -184990,19 +185433,22 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184990
185433
|
}
|
|
184991
185434
|
async enableRequestedPluginsWorker(pendingPlugins) {
|
|
184992
185435
|
Debug.assert(this.currentPluginEnablementPromise === void 0);
|
|
184993
|
-
|
|
185436
|
+
let sendProjectsUpdatedInBackgroundEvent = false;
|
|
185437
|
+
await Promise.all(map(pendingPlugins, async ([project, promises]) => {
|
|
185438
|
+
const results = await Promise.all(promises);
|
|
185439
|
+
if (project.isClosed() || isProjectDeferredClose(project)) {
|
|
185440
|
+
this.logger.info(`Cancelling plugin enabling for ${project.getProjectName()} as it is ${project.isClosed() ? "closed" : "deferred close"}`);
|
|
185441
|
+
return;
|
|
185442
|
+
}
|
|
185443
|
+
sendProjectsUpdatedInBackgroundEvent = true;
|
|
185444
|
+
for (const result of results) {
|
|
185445
|
+
this.endEnablePlugin(project, result);
|
|
185446
|
+
}
|
|
185447
|
+
this.delayUpdateProjectGraph(project);
|
|
185448
|
+
}));
|
|
184994
185449
|
this.currentPluginEnablementPromise = void 0;
|
|
184995
|
-
|
|
184996
|
-
|
|
184997
|
-
async enableRequestedPluginsForProjectAsync(project, promises) {
|
|
184998
|
-
const results = await Promise.all(promises);
|
|
184999
|
-
if (project.isClosed()) {
|
|
185000
|
-
return;
|
|
185001
|
-
}
|
|
185002
|
-
for (const result of results) {
|
|
185003
|
-
this.endEnablePlugin(project, result);
|
|
185004
|
-
}
|
|
185005
|
-
this.delayUpdateProjectGraph(project);
|
|
185450
|
+
if (sendProjectsUpdatedInBackgroundEvent)
|
|
185451
|
+
this.sendProjectsUpdatedInBackgroundEvent();
|
|
185006
185452
|
}
|
|
185007
185453
|
configurePlugin(args) {
|
|
185008
185454
|
this.forEachEnabledProject((project) => project.onPluginConfigurationChanged(args.pluginName, args.configuration));
|
|
@@ -186996,7 +187442,9 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
186996
187442
|
const info = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
|
|
186997
187443
|
fileNameToSearch,
|
|
186998
187444
|
noDtsProject.currentDirectory,
|
|
186999
|
-
noDtsProject.directoryStructureHost
|
|
187445
|
+
noDtsProject.directoryStructureHost,
|
|
187446
|
+
/*deferredDeleteOk*/
|
|
187447
|
+
false
|
|
187000
187448
|
);
|
|
187001
187449
|
if (!info)
|
|
187002
187450
|
continue;
|
|
@@ -189618,6 +190066,7 @@ __export(ts_server_exports4, {
|
|
|
189618
190066
|
isExternalProject: () => isExternalProject,
|
|
189619
190067
|
isInferredProject: () => isInferredProject,
|
|
189620
190068
|
isInferredProjectName: () => isInferredProjectName,
|
|
190069
|
+
isProjectDeferredClose: () => isProjectDeferredClose,
|
|
189621
190070
|
makeAutoImportProviderProjectName: () => makeAutoImportProviderProjectName,
|
|
189622
190071
|
makeAuxiliaryProjectName: () => makeAuxiliaryProjectName,
|
|
189623
190072
|
makeInferredProjectName: () => makeInferredProjectName,
|
|
@@ -189877,6 +190326,7 @@ if (typeof console !== "undefined") {
|
|
|
189877
190326
|
canHaveJSDoc,
|
|
189878
190327
|
canHaveLocals,
|
|
189879
190328
|
canHaveModifiers,
|
|
190329
|
+
canHaveModuleSpecifier,
|
|
189880
190330
|
canHaveSymbol,
|
|
189881
190331
|
canJsonReportNoInputFiles,
|
|
189882
190332
|
canProduceDiagnostics,
|
|
@@ -190055,6 +190505,7 @@ if (typeof console !== "undefined") {
|
|
|
190055
190505
|
createModuleResolutionLoaderUsingGlobalCache,
|
|
190056
190506
|
createModuleSpecifierResolutionHost,
|
|
190057
190507
|
createMultiMap,
|
|
190508
|
+
createNameResolver,
|
|
190058
190509
|
createNodeConverters,
|
|
190059
190510
|
createNodeFactory,
|
|
190060
190511
|
createOptionNameMap,
|
|
@@ -190195,6 +190646,7 @@ if (typeof console !== "undefined") {
|
|
|
190195
190646
|
findChildOfKind,
|
|
190196
190647
|
findComputedPropertyNameCacheAssignment,
|
|
190197
190648
|
findConfigFile,
|
|
190649
|
+
findConstructorDeclaration,
|
|
190198
190650
|
findContainingList,
|
|
190199
190651
|
findDiagnosticForNode,
|
|
190200
190652
|
findFirstNonJsxWhitespaceToken,
|
|
@@ -190341,6 +190793,7 @@ if (typeof console !== "undefined") {
|
|
|
190341
190793
|
getDefaultLibFileName,
|
|
190342
190794
|
getDefaultLibFilePath,
|
|
190343
190795
|
getDefaultLikeExportInfo,
|
|
190796
|
+
getDefaultResolutionModeForFileWorker,
|
|
190344
190797
|
getDiagnosticText,
|
|
190345
190798
|
getDiagnosticsWithinSpan,
|
|
190346
190799
|
getDirectoryPath,
|
|
@@ -190371,6 +190824,7 @@ if (typeof console !== "undefined") {
|
|
|
190371
190824
|
getEmitFlags,
|
|
190372
190825
|
getEmitHelpers,
|
|
190373
190826
|
getEmitModuleDetectionKind,
|
|
190827
|
+
getEmitModuleFormatOfFileWorker,
|
|
190374
190828
|
getEmitModuleKind,
|
|
190375
190829
|
getEmitModuleResolutionKind,
|
|
190376
190830
|
getEmitScriptTarget,
|
|
@@ -190421,6 +190875,7 @@ if (typeof console !== "undefined") {
|
|
|
190421
190875
|
getIdentifierGeneratedImportReference,
|
|
190422
190876
|
getIdentifierTypeArguments,
|
|
190423
190877
|
getImmediatelyInvokedFunctionExpression,
|
|
190878
|
+
getImpliedNodeFormatForEmitWorker,
|
|
190424
190879
|
getImpliedNodeFormatForFile,
|
|
190425
190880
|
getImpliedNodeFormatForFileWorker,
|
|
190426
190881
|
getImportNeedsImportDefaultHelper,
|
|
@@ -190776,6 +191231,7 @@ if (typeof console !== "undefined") {
|
|
|
190776
191231
|
importDefaultHelper,
|
|
190777
191232
|
importFromModuleSpecifier,
|
|
190778
191233
|
importStarHelper,
|
|
191234
|
+
importSyntaxAffectsModuleResolution,
|
|
190779
191235
|
indexOfAnyCharCode,
|
|
190780
191236
|
indexOfNode,
|
|
190781
191237
|
indicesOf,
|
|
@@ -190906,6 +191362,7 @@ if (typeof console !== "undefined") {
|
|
|
190906
191362
|
isConciseBody,
|
|
190907
191363
|
isConditionalExpression,
|
|
190908
191364
|
isConditionalTypeNode,
|
|
191365
|
+
isConstAssertion,
|
|
190909
191366
|
isConstTypeReference,
|
|
190910
191367
|
isConstructSignatureDeclaration,
|
|
190911
191368
|
isConstructorDeclaration,
|
|
@@ -191020,6 +191477,7 @@ if (typeof console !== "undefined") {
|
|
|
191020
191477
|
isGetOrSetAccessorDeclaration,
|
|
191021
191478
|
isGlobalDeclaration,
|
|
191022
191479
|
isGlobalScopeAugmentation,
|
|
191480
|
+
isGlobalSourceFile,
|
|
191023
191481
|
isGrammarError,
|
|
191024
191482
|
isHeritageClause,
|
|
191025
191483
|
isHoistedFunction,
|
|
@@ -191863,11 +192321,11 @@ if (typeof console !== "undefined") {
|
|
|
191863
192321
|
transformESDecorators,
|
|
191864
192322
|
transformESNext,
|
|
191865
192323
|
transformGenerators,
|
|
192324
|
+
transformImpliedNodeFormatDependentModule,
|
|
191866
192325
|
transformJsx,
|
|
191867
192326
|
transformLegacyDecorators,
|
|
191868
192327
|
transformModule,
|
|
191869
192328
|
transformNamedEvaluation,
|
|
191870
|
-
transformNodeModule,
|
|
191871
192329
|
transformNodes,
|
|
191872
192330
|
transformSystemModule,
|
|
191873
192331
|
transformTypeScript,
|