typescript 5.5.0-dev.20240412 → 5.5.0-dev.20240414
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 +405 -139
- package/lib/typescript.d.ts +97 -30
- package/lib/typescript.js +810 -364
- 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,
|
|
@@ -722,6 +723,7 @@ __export(typescript_exports, {
|
|
|
722
723
|
getDefaultLibFileName: () => getDefaultLibFileName,
|
|
723
724
|
getDefaultLibFilePath: () => getDefaultLibFilePath,
|
|
724
725
|
getDefaultLikeExportInfo: () => getDefaultLikeExportInfo,
|
|
726
|
+
getDefaultResolutionModeForFileWorker: () => getDefaultResolutionModeForFileWorker,
|
|
725
727
|
getDiagnosticText: () => getDiagnosticText,
|
|
726
728
|
getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
|
|
727
729
|
getDirectoryPath: () => getDirectoryPath,
|
|
@@ -752,6 +754,7 @@ __export(typescript_exports, {
|
|
|
752
754
|
getEmitFlags: () => getEmitFlags,
|
|
753
755
|
getEmitHelpers: () => getEmitHelpers,
|
|
754
756
|
getEmitModuleDetectionKind: () => getEmitModuleDetectionKind,
|
|
757
|
+
getEmitModuleFormatOfFileWorker: () => getEmitModuleFormatOfFileWorker,
|
|
755
758
|
getEmitModuleKind: () => getEmitModuleKind,
|
|
756
759
|
getEmitModuleResolutionKind: () => getEmitModuleResolutionKind,
|
|
757
760
|
getEmitScriptTarget: () => getEmitScriptTarget,
|
|
@@ -802,6 +805,7 @@ __export(typescript_exports, {
|
|
|
802
805
|
getIdentifierGeneratedImportReference: () => getIdentifierGeneratedImportReference,
|
|
803
806
|
getIdentifierTypeArguments: () => getIdentifierTypeArguments,
|
|
804
807
|
getImmediatelyInvokedFunctionExpression: () => getImmediatelyInvokedFunctionExpression,
|
|
808
|
+
getImpliedNodeFormatForEmitWorker: () => getImpliedNodeFormatForEmitWorker,
|
|
805
809
|
getImpliedNodeFormatForFile: () => getImpliedNodeFormatForFile,
|
|
806
810
|
getImpliedNodeFormatForFileWorker: () => getImpliedNodeFormatForFileWorker,
|
|
807
811
|
getImportNeedsImportDefaultHelper: () => getImportNeedsImportDefaultHelper,
|
|
@@ -1157,6 +1161,7 @@ __export(typescript_exports, {
|
|
|
1157
1161
|
importDefaultHelper: () => importDefaultHelper,
|
|
1158
1162
|
importFromModuleSpecifier: () => importFromModuleSpecifier,
|
|
1159
1163
|
importStarHelper: () => importStarHelper,
|
|
1164
|
+
importSyntaxAffectsModuleResolution: () => importSyntaxAffectsModuleResolution,
|
|
1160
1165
|
indexOfAnyCharCode: () => indexOfAnyCharCode,
|
|
1161
1166
|
indexOfNode: () => indexOfNode,
|
|
1162
1167
|
indicesOf: () => indicesOf,
|
|
@@ -2246,11 +2251,11 @@ __export(typescript_exports, {
|
|
|
2246
2251
|
transformESDecorators: () => transformESDecorators,
|
|
2247
2252
|
transformESNext: () => transformESNext,
|
|
2248
2253
|
transformGenerators: () => transformGenerators,
|
|
2254
|
+
transformImpliedNodeFormatDependentModule: () => transformImpliedNodeFormatDependentModule,
|
|
2249
2255
|
transformJsx: () => transformJsx,
|
|
2250
2256
|
transformLegacyDecorators: () => transformLegacyDecorators,
|
|
2251
2257
|
transformModule: () => transformModule,
|
|
2252
2258
|
transformNamedEvaluation: () => transformNamedEvaluation,
|
|
2253
|
-
transformNodeModule: () => transformNodeModule,
|
|
2254
2259
|
transformNodes: () => transformNodes,
|
|
2255
2260
|
transformSystemModule: () => transformSystemModule,
|
|
2256
2261
|
transformTypeScript: () => transformTypeScript,
|
|
@@ -2342,7 +2347,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2342
2347
|
|
|
2343
2348
|
// src/compiler/corePublic.ts
|
|
2344
2349
|
var versionMajorMinor = "5.5";
|
|
2345
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2350
|
+
var version = `${versionMajorMinor}.0-dev.20240414`;
|
|
2346
2351
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2347
2352
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2348
2353
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -7855,7 +7860,7 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
7855
7860
|
const filePathComparer = getStringComparer(!useCaseSensitiveFileNames2);
|
|
7856
7861
|
const toCanonicalFilePath = createGetCanonicalFileName(useCaseSensitiveFileNames2);
|
|
7857
7862
|
return (dirName, callback, recursive, options) => recursive ? createDirectoryWatcher(dirName, options, callback) : watchDirectory(dirName, callback, recursive, options);
|
|
7858
|
-
function createDirectoryWatcher(dirName, options, callback) {
|
|
7863
|
+
function createDirectoryWatcher(dirName, options, callback, link) {
|
|
7859
7864
|
const dirPath = toCanonicalFilePath(dirName);
|
|
7860
7865
|
let directoryWatcher = cache.get(dirPath);
|
|
7861
7866
|
if (directoryWatcher) {
|
|
@@ -7865,10 +7870,12 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
7865
7870
|
watcher: watchDirectory(
|
|
7866
7871
|
dirName,
|
|
7867
7872
|
(fileName) => {
|
|
7873
|
+
var _a;
|
|
7868
7874
|
if (isIgnoredPath(fileName, options))
|
|
7869
7875
|
return;
|
|
7870
7876
|
if (options == null ? void 0 : options.synchronousWatchDirectory) {
|
|
7871
|
-
|
|
7877
|
+
if (!((_a = cache.get(dirPath)) == null ? void 0 : _a.targetWatcher))
|
|
7878
|
+
invokeCallbacks(dirName, dirPath, fileName);
|
|
7872
7879
|
updateChildWatches(dirName, dirPath, options);
|
|
7873
7880
|
} else {
|
|
7874
7881
|
nonSyncUpdateChildWatches(dirName, dirPath, fileName, options);
|
|
@@ -7879,11 +7886,15 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
7879
7886
|
options
|
|
7880
7887
|
),
|
|
7881
7888
|
refCount: 1,
|
|
7882
|
-
childWatches: emptyArray
|
|
7889
|
+
childWatches: emptyArray,
|
|
7890
|
+
targetWatcher: void 0,
|
|
7891
|
+
links: void 0
|
|
7883
7892
|
};
|
|
7884
7893
|
cache.set(dirPath, directoryWatcher);
|
|
7885
7894
|
updateChildWatches(dirName, dirPath, options);
|
|
7886
7895
|
}
|
|
7896
|
+
if (link)
|
|
7897
|
+
(directoryWatcher.links ?? (directoryWatcher.links = /* @__PURE__ */ new Set())).add(link);
|
|
7887
7898
|
const callbackToAdd = callback && { dirName, callback };
|
|
7888
7899
|
if (callbackToAdd) {
|
|
7889
7900
|
callbackCache.add(dirPath, callbackToAdd);
|
|
@@ -7891,19 +7902,25 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
7891
7902
|
return {
|
|
7892
7903
|
dirName,
|
|
7893
7904
|
close: () => {
|
|
7905
|
+
var _a;
|
|
7894
7906
|
const directoryWatcher2 = Debug.checkDefined(cache.get(dirPath));
|
|
7895
7907
|
if (callbackToAdd)
|
|
7896
7908
|
callbackCache.remove(dirPath, callbackToAdd);
|
|
7909
|
+
if (link)
|
|
7910
|
+
(_a = directoryWatcher2.links) == null ? void 0 : _a.delete(link);
|
|
7897
7911
|
directoryWatcher2.refCount--;
|
|
7898
7912
|
if (directoryWatcher2.refCount)
|
|
7899
7913
|
return;
|
|
7900
7914
|
cache.delete(dirPath);
|
|
7915
|
+
directoryWatcher2.links = void 0;
|
|
7901
7916
|
closeFileWatcherOf(directoryWatcher2);
|
|
7917
|
+
closeTargetWatcher(directoryWatcher2);
|
|
7902
7918
|
directoryWatcher2.childWatches.forEach(closeFileWatcher);
|
|
7903
7919
|
}
|
|
7904
7920
|
};
|
|
7905
7921
|
}
|
|
7906
|
-
function invokeCallbacks(dirPath, fileNameOrInvokeMap, fileNames) {
|
|
7922
|
+
function invokeCallbacks(dirName, dirPath, fileNameOrInvokeMap, fileNames) {
|
|
7923
|
+
var _a, _b;
|
|
7907
7924
|
let fileName;
|
|
7908
7925
|
let invokeMap;
|
|
7909
7926
|
if (isString(fileNameOrInvokeMap)) {
|
|
@@ -7931,6 +7948,14 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
7931
7948
|
}
|
|
7932
7949
|
}
|
|
7933
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
|
+
});
|
|
7934
7959
|
}
|
|
7935
7960
|
function nonSyncUpdateChildWatches(dirName, dirPath, fileName, options) {
|
|
7936
7961
|
const parentWatcher = cache.get(dirPath);
|
|
@@ -7938,7 +7963,8 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
7938
7963
|
scheduleUpdateChildWatches(dirName, dirPath, fileName, options);
|
|
7939
7964
|
return;
|
|
7940
7965
|
}
|
|
7941
|
-
invokeCallbacks(dirPath, fileName);
|
|
7966
|
+
invokeCallbacks(dirName, dirPath, fileName);
|
|
7967
|
+
closeTargetWatcher(parentWatcher);
|
|
7942
7968
|
removeChildWatches(parentWatcher);
|
|
7943
7969
|
}
|
|
7944
7970
|
function scheduleUpdateChildWatches(dirName, dirPath, fileName, options) {
|
|
@@ -7955,6 +7981,7 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
7955
7981
|
timerToUpdateChildWatches = setTimeout2(onTimerToUpdateChildWatches, 1e3, "timerToUpdateChildWatches");
|
|
7956
7982
|
}
|
|
7957
7983
|
function onTimerToUpdateChildWatches() {
|
|
7984
|
+
var _a;
|
|
7958
7985
|
timerToUpdateChildWatches = void 0;
|
|
7959
7986
|
sysLog(`sysLog:: onTimerToUpdateChildWatches:: ${cacheToUpdateChildWatches.size}`);
|
|
7960
7987
|
const start = timestamp();
|
|
@@ -7965,7 +7992,8 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
7965
7992
|
const { value: [dirPath, { dirName, options, fileNames }] } = result;
|
|
7966
7993
|
cacheToUpdateChildWatches.delete(dirPath);
|
|
7967
7994
|
const hasChanges = updateChildWatches(dirName, dirPath, options);
|
|
7968
|
-
|
|
7995
|
+
if (!((_a = cache.get(dirPath)) == null ? void 0 : _a.targetWatcher))
|
|
7996
|
+
invokeCallbacks(dirName, dirPath, invokeMap, hasChanges ? void 0 : fileNames);
|
|
7969
7997
|
}
|
|
7970
7998
|
sysLog(`sysLog:: invokingWatchers:: Elapsed:: ${timestamp() - start}ms:: ${cacheToUpdateChildWatches.size}`);
|
|
7971
7999
|
callbackCache.forEach((callbacks, rootDirName) => {
|
|
@@ -7993,22 +8021,46 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
7993
8021
|
removeChildWatches(cache.get(toCanonicalFilePath(childWatcher.dirName)));
|
|
7994
8022
|
}
|
|
7995
8023
|
}
|
|
8024
|
+
function closeTargetWatcher(watcher) {
|
|
8025
|
+
if (watcher == null ? void 0 : watcher.targetWatcher) {
|
|
8026
|
+
watcher.targetWatcher.close();
|
|
8027
|
+
watcher.targetWatcher = void 0;
|
|
8028
|
+
}
|
|
8029
|
+
}
|
|
7996
8030
|
function updateChildWatches(parentDir, parentDirPath, options) {
|
|
7997
8031
|
const parentWatcher = cache.get(parentDirPath);
|
|
7998
8032
|
if (!parentWatcher)
|
|
7999
8033
|
return false;
|
|
8034
|
+
const target = normalizePath(realpath(parentDir));
|
|
8035
|
+
let hasChanges;
|
|
8000
8036
|
let newChildWatches;
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8011
|
-
|
|
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
|
+
}
|
|
8012
8064
|
parentWatcher.childWatches = newChildWatches || emptyArray;
|
|
8013
8065
|
return hasChanges;
|
|
8014
8066
|
function createAndAddChildDirectoryWatcher(childName) {
|
|
@@ -9527,6 +9579,7 @@ var Diagnostics = {
|
|
|
9527
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 }'."),
|
|
9528
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."),
|
|
9529
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'."),
|
|
9530
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."),
|
|
9531
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."),
|
|
9532
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."),
|
|
@@ -16095,7 +16148,7 @@ function canUseOriginalText(node, flags) {
|
|
|
16095
16148
|
return !isBigIntLiteral(node);
|
|
16096
16149
|
}
|
|
16097
16150
|
function getTextOfConstantValue(value) {
|
|
16098
|
-
return isString(value) ?
|
|
16151
|
+
return isString(value) ? `"${escapeString(value)}"` : "" + value;
|
|
16099
16152
|
}
|
|
16100
16153
|
function makeIdentifierFromModuleName(moduleName) {
|
|
16101
16154
|
return getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_");
|
|
@@ -17608,6 +17661,23 @@ function isFunctionSymbol(symbol) {
|
|
|
17608
17661
|
const decl = symbol.valueDeclaration;
|
|
17609
17662
|
return decl.kind === 262 /* FunctionDeclaration */ || isVariableDeclaration(decl) && decl.initializer && isFunctionLike(decl.initializer);
|
|
17610
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
|
+
}
|
|
17611
17681
|
function tryGetModuleSpecifierFromDeclaration(node) {
|
|
17612
17682
|
var _a, _b;
|
|
17613
17683
|
switch (node.kind) {
|
|
@@ -20585,8 +20655,8 @@ function walkTreeForJSXTags(node) {
|
|
|
20585
20655
|
function isFileModuleFromUsingJSXTag(file) {
|
|
20586
20656
|
return !file.isDeclarationFile ? walkTreeForJSXTags(file) : void 0;
|
|
20587
20657
|
}
|
|
20588
|
-
function isFileForcedToBeModuleByFormat(file) {
|
|
20589
|
-
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;
|
|
20590
20660
|
}
|
|
20591
20661
|
function getSetExternalModuleIndicator(options) {
|
|
20592
20662
|
switch (getEmitModuleDetectionKind(options)) {
|
|
@@ -20605,10 +20675,14 @@ function getSetExternalModuleIndicator(options) {
|
|
|
20605
20675
|
}
|
|
20606
20676
|
checks.push(isFileForcedToBeModuleByFormat);
|
|
20607
20677
|
const combined = or(...checks);
|
|
20608
|
-
const callback = (file) => void (file.externalModuleIndicator = combined(file));
|
|
20678
|
+
const callback = (file) => void (file.externalModuleIndicator = combined(file, options));
|
|
20609
20679
|
return callback;
|
|
20610
20680
|
}
|
|
20611
20681
|
}
|
|
20682
|
+
function importSyntaxAffectsModuleResolution(options) {
|
|
20683
|
+
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
20684
|
+
return 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */ || getResolvePackageJsonExports(options) || getResolvePackageJsonImports(options);
|
|
20685
|
+
}
|
|
20612
20686
|
function createComputedCompilerOptions(options) {
|
|
20613
20687
|
return options;
|
|
20614
20688
|
}
|
|
@@ -29960,7 +30034,7 @@ function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFacto
|
|
|
29960
30034
|
if (compilerOptions.importHelpers && isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
29961
30035
|
let namedBindings;
|
|
29962
30036
|
const moduleKind = getEmitModuleKind(compilerOptions);
|
|
29963
|
-
if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || sourceFile
|
|
30037
|
+
if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || getImpliedNodeFormatForEmitWorker(sourceFile, compilerOptions) === 99 /* ESNext */) {
|
|
29964
30038
|
const helpers = getEmitHelpers(sourceFile);
|
|
29965
30039
|
if (helpers) {
|
|
29966
30040
|
const helperNames = [];
|
|
@@ -30025,8 +30099,7 @@ function getOrCreateExternalHelpersModuleNameIfNeeded(factory2, node, compilerOp
|
|
|
30025
30099
|
if (externalHelpersModuleName) {
|
|
30026
30100
|
return externalHelpersModuleName;
|
|
30027
30101
|
}
|
|
30028
|
-
|
|
30029
|
-
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 */;
|
|
30030
30103
|
if (!create) {
|
|
30031
30104
|
const helpers = getEmitHelpers(node);
|
|
30032
30105
|
if (helpers) {
|
|
@@ -47728,13 +47801,15 @@ var RelativePreference = /* @__PURE__ */ ((RelativePreference2) => {
|
|
|
47728
47801
|
RelativePreference2[RelativePreference2["ExternalNonRelative"] = 3] = "ExternalNonRelative";
|
|
47729
47802
|
return RelativePreference2;
|
|
47730
47803
|
})(RelativePreference || {});
|
|
47731
|
-
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
47804
|
+
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, host, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
47732
47805
|
const filePreferredEnding = getPreferredEnding();
|
|
47733
47806
|
return {
|
|
47734
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 */,
|
|
47735
47808
|
getAllowedEndingsInPreferredOrder: (syntaxImpliedNodeFormat) => {
|
|
47736
|
-
const
|
|
47737
|
-
|
|
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 */) {
|
|
47738
47813
|
if (shouldAllowImportingTsExtension(compilerOptions, importingSourceFile.fileName)) {
|
|
47739
47814
|
return [3 /* TsExtension */, 2 /* JsExtension */];
|
|
47740
47815
|
}
|
|
@@ -47767,20 +47842,20 @@ function getModuleSpecifierPreferences({ importModuleSpecifierPreference, import
|
|
|
47767
47842
|
}
|
|
47768
47843
|
return getModuleSpecifierEndingPreference(
|
|
47769
47844
|
importModuleSpecifierEnding,
|
|
47770
|
-
resolutionMode ?? importingSourceFile
|
|
47845
|
+
resolutionMode ?? getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions),
|
|
47771
47846
|
compilerOptions,
|
|
47772
47847
|
isFullSourceFile(importingSourceFile) ? importingSourceFile : void 0
|
|
47773
47848
|
);
|
|
47774
47849
|
}
|
|
47775
47850
|
}
|
|
47776
47851
|
function updateModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, oldImportSpecifier, options = {}) {
|
|
47777
|
-
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);
|
|
47778
47853
|
if (res === oldImportSpecifier)
|
|
47779
47854
|
return void 0;
|
|
47780
47855
|
return res;
|
|
47781
47856
|
}
|
|
47782
47857
|
function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, options = {}) {
|
|
47783
|
-
return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, compilerOptions, importingSourceFile), {}, options);
|
|
47858
|
+
return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, host, compilerOptions, importingSourceFile), {}, options);
|
|
47784
47859
|
}
|
|
47785
47860
|
function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeModulesFileName, host, preferences, options = {}) {
|
|
47786
47861
|
const info = getInfo(importingSourceFile.fileName, host);
|
|
@@ -47810,7 +47885,7 @@ function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importin
|
|
|
47810
47885
|
/*packageNameOnly*/
|
|
47811
47886
|
void 0,
|
|
47812
47887
|
options.overrideImportMode
|
|
47813
|
-
)) || getLocalModuleSpecifier(toFileName2, info, compilerOptions, host, options.overrideImportMode || importingSourceFile
|
|
47888
|
+
)) || getLocalModuleSpecifier(toFileName2, info, compilerOptions, host, options.overrideImportMode || getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions), preferences);
|
|
47814
47889
|
}
|
|
47815
47890
|
function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options = {}) {
|
|
47816
47891
|
return tryGetModuleSpecifiersFromCacheWorker(
|
|
@@ -47883,19 +47958,22 @@ function getLocalModuleSpecifierBetweenFileNames(importingFile, targetFileName,
|
|
|
47883
47958
|
compilerOptions,
|
|
47884
47959
|
host,
|
|
47885
47960
|
importMode,
|
|
47886
|
-
getModuleSpecifierPreferences({}, compilerOptions, importingFile)
|
|
47961
|
+
getModuleSpecifierPreferences({}, host, compilerOptions, importingFile)
|
|
47887
47962
|
);
|
|
47888
47963
|
}
|
|
47889
47964
|
function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
|
|
47890
47965
|
const info = getInfo(importingSourceFile.fileName, host);
|
|
47891
|
-
const preferences = getModuleSpecifierPreferences(userPreferences, compilerOptions, importingSourceFile);
|
|
47966
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, host, compilerOptions, importingSourceFile);
|
|
47892
47967
|
const existingSpecifier = isFullSourceFile(importingSourceFile) && forEach(modulePaths, (modulePath) => forEach(
|
|
47893
47968
|
host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
|
|
47894
47969
|
(reason) => {
|
|
47895
47970
|
if (reason.kind !== 3 /* Import */ || reason.file !== importingSourceFile.path)
|
|
47896
47971
|
return void 0;
|
|
47897
|
-
|
|
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) {
|
|
47898
47975
|
return void 0;
|
|
47976
|
+
}
|
|
47899
47977
|
const specifier = getModuleNameStringLiteralAt(importingSourceFile, reason.index).text;
|
|
47900
47978
|
return preferences.relativePreference !== 1 /* NonRelative */ || !pathIsRelative(specifier) ? specifier : void 0;
|
|
47901
47979
|
}
|
|
@@ -48406,7 +48484,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
48406
48484
|
if (!parts) {
|
|
48407
48485
|
return void 0;
|
|
48408
48486
|
}
|
|
48409
|
-
const preferences = getModuleSpecifierPreferences(userPreferences, options, importingSourceFile);
|
|
48487
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, host, options, importingSourceFile);
|
|
48410
48488
|
const allowedEndings = preferences.getAllowedEndingsInPreferredOrder();
|
|
48411
48489
|
let moduleSpecifier = path;
|
|
48412
48490
|
let isPackageRootPath = false;
|
|
@@ -48457,7 +48535,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
48457
48535
|
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
48458
48536
|
if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
|
|
48459
48537
|
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || tryParseJson(host.readFile(packageJsonPath));
|
|
48460
|
-
const importMode = overrideMode || importingSourceFile
|
|
48538
|
+
const importMode = overrideMode || getDefaultResolutionModeForFile(importingSourceFile, host, options);
|
|
48461
48539
|
if (getResolvePackageJsonExports(options)) {
|
|
48462
48540
|
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
|
|
48463
48541
|
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
|
|
@@ -48609,6 +48687,9 @@ function getRelativePathIfInSameVolume(path, directoryPath, getCanonicalFileName
|
|
|
48609
48687
|
function isPathRelativeToParent(path) {
|
|
48610
48688
|
return startsWith(path, "..");
|
|
48611
48689
|
}
|
|
48690
|
+
function getDefaultResolutionModeForFile(file, host, compilerOptions) {
|
|
48691
|
+
return isFullSourceFile(file) ? host.getDefaultResolutionModeForFile(file) : getDefaultResolutionModeForFileWorker(file, compilerOptions);
|
|
48692
|
+
}
|
|
48612
48693
|
|
|
48613
48694
|
// src/compiler/checker.ts
|
|
48614
48695
|
var ambientModuleSymbolRegex = /^".+"$/;
|
|
@@ -50830,22 +50911,28 @@ function createTypeChecker(host) {
|
|
|
50830
50911
|
function isSyntacticDefault(node) {
|
|
50831
50912
|
return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) || isNamespaceExport(node);
|
|
50832
50913
|
}
|
|
50833
|
-
function
|
|
50834
|
-
return isStringLiteralLike(usage) ? host.
|
|
50914
|
+
function getEmitSyntaxForModuleSpecifierExpression(usage) {
|
|
50915
|
+
return isStringLiteralLike(usage) ? host.getEmitSyntaxForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
|
|
50835
50916
|
}
|
|
50836
50917
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
50837
50918
|
return usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */;
|
|
50838
50919
|
}
|
|
50839
|
-
function
|
|
50840
|
-
|
|
50841
|
-
|
|
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;
|
|
50842
50926
|
}
|
|
50843
50927
|
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
|
|
50844
|
-
const usageMode = file &&
|
|
50845
|
-
if (file && usageMode !== void 0
|
|
50846
|
-
const
|
|
50847
|
-
if (usageMode === 99 /* ESNext */
|
|
50848
|
-
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;
|
|
50849
50936
|
}
|
|
50850
50937
|
}
|
|
50851
50938
|
if (!allowSyntheticDefaultImports) {
|
|
@@ -50904,7 +50991,7 @@ function createTypeChecker(host) {
|
|
|
50904
50991
|
if (!specifier) {
|
|
50905
50992
|
return exportDefaultSymbol;
|
|
50906
50993
|
}
|
|
50907
|
-
const hasDefaultOnly =
|
|
50994
|
+
const hasDefaultOnly = isOnlyImportableAsDefault(specifier);
|
|
50908
50995
|
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
50909
50996
|
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
50910
50997
|
if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
|
|
@@ -51108,7 +51195,7 @@ function createTypeChecker(host) {
|
|
|
51108
51195
|
let symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias);
|
|
51109
51196
|
if (symbolFromModule === void 0 && name.escapedText === "default" /* Default */) {
|
|
51110
51197
|
const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
|
51111
|
-
if (
|
|
51198
|
+
if (isOnlyImportableAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
51112
51199
|
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
51113
51200
|
}
|
|
51114
51201
|
}
|
|
@@ -51738,7 +51825,7 @@ function createTypeChecker(host) {
|
|
|
51738
51825
|
/*requireStringLiteralLikeArgument*/
|
|
51739
51826
|
true
|
|
51740
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);
|
|
51741
|
-
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile
|
|
51828
|
+
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : host.getDefaultResolutionModeForFile(currentSourceFile);
|
|
51742
51829
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
51743
51830
|
const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
|
|
51744
51831
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
@@ -51983,7 +52070,7 @@ function createTypeChecker(host) {
|
|
|
51983
52070
|
return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
|
|
51984
52071
|
}
|
|
51985
52072
|
const targetFile = (_a = moduleSymbol == null ? void 0 : moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
|
51986
|
-
const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(
|
|
52073
|
+
const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(getEmitSyntaxForModuleSpecifierExpression(reference), host.getImpliedNodeFormatForEmit(targetFile));
|
|
51987
52074
|
if (getESModuleInterop(compilerOptions) || isEsmCjsRef) {
|
|
51988
52075
|
let sigs = getSignaturesOfStructuredType(type, 0 /* Call */);
|
|
51989
52076
|
if (!sigs || !sigs.length) {
|
|
@@ -54536,14 +54623,16 @@ function createTypeChecker(host) {
|
|
|
54536
54623
|
return symbol.escapedName.substring(1, symbol.escapedName.length - 1);
|
|
54537
54624
|
}
|
|
54538
54625
|
}
|
|
54539
|
-
if (!context.
|
|
54626
|
+
if (!context.enclosingFile || !context.tracker.moduleResolverHost) {
|
|
54540
54627
|
if (ambientModuleSymbolRegex.test(symbol.escapedName)) {
|
|
54541
54628
|
return symbol.escapedName.substring(1, symbol.escapedName.length - 1);
|
|
54542
54629
|
}
|
|
54543
54630
|
return getSourceFileOfNode(getNonAugmentationDeclaration(symbol)).fileName;
|
|
54544
54631
|
}
|
|
54545
|
-
const
|
|
54546
|
-
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);
|
|
54547
54636
|
const cacheKey = createModeAwareCacheKey(contextFile.path, resolutionMode);
|
|
54548
54637
|
const links = getSymbolLinks(symbol);
|
|
54549
54638
|
let specifier = links.specifierCache && links.specifierCache.get(cacheKey);
|
|
@@ -55279,22 +55368,16 @@ function createTypeChecker(host) {
|
|
|
55279
55368
|
return p.name && isIdentifier(p.name) && p.name.escapedText === "this" ? "this" : getEffectiveDotDotDotForParameter(p) ? `args` : `arg${index}`;
|
|
55280
55369
|
}
|
|
55281
55370
|
function rewriteModuleSpecifier(parent2, lit) {
|
|
55282
|
-
if (context.bundled) {
|
|
55283
|
-
|
|
55284
|
-
|
|
55285
|
-
|
|
55286
|
-
|
|
55287
|
-
|
|
55288
|
-
getCanonicalFileName,
|
|
55289
|
-
getCurrentDirectory: () => context.tracker.moduleResolverHost.getCurrentDirectory(),
|
|
55290
|
-
getCommonSourceDirectory: () => context.tracker.moduleResolverHost.getCommonSourceDirectory()
|
|
55291
|
-
};
|
|
55292
|
-
const newName = getResolvedExternalModuleName(resolverHost, targetFile);
|
|
55293
|
-
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);
|
|
55294
55377
|
}
|
|
55295
55378
|
}
|
|
55296
55379
|
}
|
|
55297
|
-
return lit;
|
|
55380
|
+
return visitNode(lit, visitExistingNodeTreeSymbols, isStringLiteral);
|
|
55298
55381
|
}
|
|
55299
55382
|
}
|
|
55300
55383
|
}
|
|
@@ -77385,6 +77468,7 @@ function createTypeChecker(host) {
|
|
|
77385
77468
|
candidateForTypeArgumentError = oldCandidateForTypeArgumentError;
|
|
77386
77469
|
}
|
|
77387
77470
|
function chooseOverload(candidates2, relation, isSingleNonGenericCandidate2, signatureHelpTrailingComma2 = false) {
|
|
77471
|
+
var _a, _b;
|
|
77388
77472
|
candidatesForArgumentError = void 0;
|
|
77389
77473
|
candidateForArgumentArityError = void 0;
|
|
77390
77474
|
candidateForTypeArgumentError = void 0;
|
|
@@ -77419,7 +77503,9 @@ function createTypeChecker(host) {
|
|
|
77419
77503
|
let checkCandidate;
|
|
77420
77504
|
let inferenceContext;
|
|
77421
77505
|
if (candidate.typeParameters) {
|
|
77422
|
-
|
|
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)) {
|
|
77423
77509
|
candidate = getImplementationSignature(candidate);
|
|
77424
77510
|
}
|
|
77425
77511
|
let typeArgumentTypes;
|
|
@@ -78365,7 +78451,7 @@ function createTypeChecker(host) {
|
|
|
78365
78451
|
return createAnonymousType(anonymousSymbol, memberTable, emptyArray, emptyArray, emptyArray);
|
|
78366
78452
|
}
|
|
78367
78453
|
function getTypeWithSyntheticDefaultOnly(type, symbol, originalSymbol, moduleSpecifier) {
|
|
78368
|
-
const hasDefaultOnly =
|
|
78454
|
+
const hasDefaultOnly = isOnlyImportableAsDefault(moduleSpecifier);
|
|
78369
78455
|
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
78370
78456
|
const synthType = type;
|
|
78371
78457
|
if (!synthType.defaultOnlyType) {
|
|
@@ -83702,7 +83788,7 @@ function createTypeChecker(host) {
|
|
|
83702
83788
|
});
|
|
83703
83789
|
}
|
|
83704
83790
|
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
|
|
83705
|
-
if (
|
|
83791
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) >= 5 /* ES2015 */) {
|
|
83706
83792
|
return;
|
|
83707
83793
|
}
|
|
83708
83794
|
if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
|
@@ -85131,7 +85217,7 @@ function createTypeChecker(host) {
|
|
|
85131
85217
|
}
|
|
85132
85218
|
}
|
|
85133
85219
|
function checkClassNameCollisionWithObject(name) {
|
|
85134
|
-
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && (
|
|
85220
|
+
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && host.getEmitModuleFormatOfFile(getSourceFileOfNode(name)) < 5 /* ES2015 */) {
|
|
85135
85221
|
error2(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]);
|
|
85136
85222
|
}
|
|
85137
85223
|
}
|
|
@@ -86201,7 +86287,7 @@ function createTypeChecker(host) {
|
|
|
86201
86287
|
getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
|
|
86202
86288
|
}
|
|
86203
86289
|
}
|
|
86204
|
-
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ && (
|
|
86290
|
+
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ && host.getEmitModuleFormatOfFile(node.parent) === 1 /* CommonJS */) {
|
|
86205
86291
|
const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 95 /* ExportKeyword */);
|
|
86206
86292
|
if (exportModifier) {
|
|
86207
86293
|
error2(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
@@ -86411,8 +86497,10 @@ function createTypeChecker(host) {
|
|
|
86411
86497
|
}
|
|
86412
86498
|
}
|
|
86413
86499
|
}
|
|
86414
|
-
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 */) {
|
|
86415
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);
|
|
86416
86504
|
}
|
|
86417
86505
|
}
|
|
86418
86506
|
if (isImportSpecifier(node)) {
|
|
@@ -86454,7 +86542,7 @@ function createTypeChecker(host) {
|
|
|
86454
86542
|
function checkImportBinding(node) {
|
|
86455
86543
|
checkCollisionsForDeclarationName(node, node.name);
|
|
86456
86544
|
checkAliasSymbol(node);
|
|
86457
|
-
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 */) {
|
|
86458
86546
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
86459
86547
|
}
|
|
86460
86548
|
}
|
|
@@ -86475,7 +86563,7 @@ function createTypeChecker(host) {
|
|
|
86475
86563
|
if (validForTypeAttributes && override) {
|
|
86476
86564
|
return;
|
|
86477
86565
|
}
|
|
86478
|
-
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier &&
|
|
86566
|
+
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getEmitSyntaxForModuleSpecifierExpression(declaration.moduleSpecifier);
|
|
86479
86567
|
if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
|
|
86480
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;
|
|
86481
86569
|
return grammarErrorOnNode(node, message);
|
|
@@ -86508,7 +86596,7 @@ function createTypeChecker(host) {
|
|
|
86508
86596
|
if (importClause.namedBindings) {
|
|
86509
86597
|
if (importClause.namedBindings.kind === 274 /* NamespaceImport */) {
|
|
86510
86598
|
checkImportBinding(importClause.namedBindings);
|
|
86511
|
-
if (
|
|
86599
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && getESModuleInterop(compilerOptions)) {
|
|
86512
86600
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
86513
86601
|
}
|
|
86514
86602
|
} else {
|
|
@@ -86550,7 +86638,7 @@ function createTypeChecker(host) {
|
|
|
86550
86638
|
grammarErrorOnNode(node, Diagnostics.An_import_alias_cannot_use_import_type);
|
|
86551
86639
|
}
|
|
86552
86640
|
} else {
|
|
86553
|
-
if (
|
|
86641
|
+
if (5 /* ES2015 */ <= moduleKind && moduleKind <= 99 /* ESNext */ && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
|
|
86554
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);
|
|
86555
86643
|
}
|
|
86556
86644
|
}
|
|
@@ -86579,7 +86667,7 @@ function createTypeChecker(host) {
|
|
|
86579
86667
|
} else if (node.exportClause) {
|
|
86580
86668
|
checkAliasSymbol(node.exportClause);
|
|
86581
86669
|
}
|
|
86582
|
-
if (
|
|
86670
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
|
|
86583
86671
|
if (node.exportClause) {
|
|
86584
86672
|
if (getESModuleInterop(compilerOptions)) {
|
|
86585
86673
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
@@ -86638,7 +86726,7 @@ function createTypeChecker(host) {
|
|
|
86638
86726
|
}
|
|
86639
86727
|
}
|
|
86640
86728
|
} else {
|
|
86641
|
-
if (getESModuleInterop(compilerOptions) &&
|
|
86729
|
+
if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && idText(node.propertyName || node.name) === "default") {
|
|
86642
86730
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
86643
86731
|
}
|
|
86644
86732
|
}
|
|
@@ -86664,7 +86752,7 @@ function createTypeChecker(host) {
|
|
|
86664
86752
|
if (typeAnnotationNode) {
|
|
86665
86753
|
checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression);
|
|
86666
86754
|
}
|
|
86667
|
-
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 */;
|
|
86668
86756
|
if (node.expression.kind === 80 /* Identifier */) {
|
|
86669
86757
|
const id = node.expression;
|
|
86670
86758
|
const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
|
|
@@ -86744,7 +86832,7 @@ function createTypeChecker(host) {
|
|
|
86744
86832
|
grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
|
|
86745
86833
|
}
|
|
86746
86834
|
if (node.isExportEquals) {
|
|
86747
|
-
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 */)) {
|
|
86748
86836
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
|
86749
86837
|
} else if (moduleKind === 4 /* System */ && !(node.flags & 33554432 /* Ambient */)) {
|
|
86750
86838
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
|
|
@@ -89125,7 +89213,7 @@ function createTypeChecker(host) {
|
|
|
89125
89213
|
break;
|
|
89126
89214
|
case 95 /* ExportKeyword */:
|
|
89127
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
|
|
89128
|
-
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 */) {
|
|
89129
89217
|
return grammarErrorOnNode(modifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
89130
89218
|
}
|
|
89131
89219
|
if (flags & 32 /* Export */) {
|
|
@@ -90036,7 +90124,7 @@ function createTypeChecker(host) {
|
|
|
90036
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;
|
|
90037
90125
|
return grammarErrorOnNode(node.exclamationToken, message);
|
|
90038
90126
|
}
|
|
90039
|
-
if ((
|
|
90127
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && !(node.parent.parent.flags & 33554432 /* Ambient */) && hasSyntacticModifier(node.parent.parent, 32 /* Export */)) {
|
|
90040
90128
|
checkESModuleMarker(node.name);
|
|
90041
90129
|
}
|
|
90042
90130
|
return !!blockScopeKind && checkGrammarNameInLetOrConstDeclarations(node.name);
|
|
@@ -90523,7 +90611,9 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host) {
|
|
|
90523
90611
|
isSourceOfProjectReferenceRedirect: (fileName) => host.isSourceOfProjectReferenceRedirect(fileName),
|
|
90524
90612
|
fileExists: (fileName) => host.fileExists(fileName),
|
|
90525
90613
|
getFileIncludeReasons: () => host.getFileIncludeReasons(),
|
|
90526
|
-
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)
|
|
90527
90617
|
};
|
|
90528
90618
|
}
|
|
90529
90619
|
var SymbolTrackerImpl = class _SymbolTrackerImpl {
|
|
@@ -109956,6 +110046,9 @@ function transformModule(context) {
|
|
|
109956
110046
|
return updated;
|
|
109957
110047
|
}
|
|
109958
110048
|
function shouldEmitUnderscoreUnderscoreESModule() {
|
|
110049
|
+
if (hasJSFileExtension(currentSourceFile.fileName) && currentSourceFile.commonJsModuleIndicator && (!currentSourceFile.externalModuleIndicator || currentSourceFile.externalModuleIndicator === true)) {
|
|
110050
|
+
return false;
|
|
110051
|
+
}
|
|
109959
110052
|
if (!currentModuleInfo.exportEquals && isExternalModule(currentSourceFile)) {
|
|
109960
110053
|
return true;
|
|
109961
110054
|
}
|
|
@@ -110434,7 +110527,7 @@ function transformModule(context) {
|
|
|
110434
110527
|
case 354 /* PartiallyEmittedExpression */:
|
|
110435
110528
|
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
|
|
110436
110529
|
case 213 /* CallExpression */:
|
|
110437
|
-
if (isImportCall(node) && currentSourceFile
|
|
110530
|
+
if (isImportCall(node) && host.shouldTransformImportCall(currentSourceFile)) {
|
|
110438
110531
|
return visitImportCallExpression(node);
|
|
110439
110532
|
}
|
|
110440
110533
|
break;
|
|
@@ -113435,8 +113528,8 @@ function transformECMAScriptModule(context) {
|
|
|
113435
113528
|
}
|
|
113436
113529
|
}
|
|
113437
113530
|
|
|
113438
|
-
// src/compiler/transformers/module/
|
|
113439
|
-
function
|
|
113531
|
+
// src/compiler/transformers/module/impliedNodeFormatDependent.ts
|
|
113532
|
+
function transformImpliedNodeFormatDependentModule(context) {
|
|
113440
113533
|
const previousOnSubstituteNode = context.onSubstituteNode;
|
|
113441
113534
|
const previousOnEmitNode = context.onEmitNode;
|
|
113442
113535
|
const esmTransform = transformECMAScriptModule(context);
|
|
@@ -113447,6 +113540,7 @@ function transformNodeModule(context) {
|
|
|
113447
113540
|
const cjsTransform = transformModule(context);
|
|
113448
113541
|
const cjsOnSubstituteNode = context.onSubstituteNode;
|
|
113449
113542
|
const cjsOnEmitNode = context.onEmitNode;
|
|
113543
|
+
const getEmitModuleFormatOfFile2 = (file) => context.getEmitHost().getEmitModuleFormatOfFile(file);
|
|
113450
113544
|
context.onSubstituteNode = onSubstituteNode;
|
|
113451
113545
|
context.onEmitNode = onEmitNode;
|
|
113452
113546
|
context.enableSubstitution(307 /* SourceFile */);
|
|
@@ -113461,7 +113555,7 @@ function transformNodeModule(context) {
|
|
|
113461
113555
|
if (!currentSourceFile) {
|
|
113462
113556
|
return previousOnSubstituteNode(hint, node);
|
|
113463
113557
|
}
|
|
113464
|
-
if (currentSourceFile
|
|
113558
|
+
if (getEmitModuleFormatOfFile2(currentSourceFile) >= 5 /* ES2015 */) {
|
|
113465
113559
|
return esmOnSubstituteNode(hint, node);
|
|
113466
113560
|
}
|
|
113467
113561
|
return cjsOnSubstituteNode(hint, node);
|
|
@@ -113474,13 +113568,13 @@ function transformNodeModule(context) {
|
|
|
113474
113568
|
if (!currentSourceFile) {
|
|
113475
113569
|
return previousOnEmitNode(hint, node, emitCallback);
|
|
113476
113570
|
}
|
|
113477
|
-
if (currentSourceFile
|
|
113571
|
+
if (getEmitModuleFormatOfFile2(currentSourceFile) >= 5 /* ES2015 */) {
|
|
113478
113572
|
return esmOnEmitNode(hint, node, emitCallback);
|
|
113479
113573
|
}
|
|
113480
113574
|
return cjsOnEmitNode(hint, node, emitCallback);
|
|
113481
113575
|
}
|
|
113482
113576
|
function getModuleTransformForFile(file) {
|
|
113483
|
-
return file
|
|
113577
|
+
return getEmitModuleFormatOfFile2(file) >= 5 /* ES2015 */ ? esmTransform : cjsTransform;
|
|
113484
113578
|
}
|
|
113485
113579
|
function transformSourceFile(node) {
|
|
113486
113580
|
if (node.isDeclarationFile) {
|
|
@@ -115383,17 +115477,18 @@ function isProcessedComponent(node) {
|
|
|
115383
115477
|
// src/compiler/transformer.ts
|
|
115384
115478
|
function getModuleTransformer(moduleKind) {
|
|
115385
115479
|
switch (moduleKind) {
|
|
115480
|
+
case 200 /* Preserve */:
|
|
115481
|
+
return transformECMAScriptModule;
|
|
115386
115482
|
case 99 /* ESNext */:
|
|
115387
115483
|
case 7 /* ES2022 */:
|
|
115388
115484
|
case 6 /* ES2020 */:
|
|
115389
115485
|
case 5 /* ES2015 */:
|
|
115390
|
-
case 200 /* Preserve */:
|
|
115391
|
-
return transformECMAScriptModule;
|
|
115392
|
-
case 4 /* System */:
|
|
115393
|
-
return transformSystemModule;
|
|
115394
115486
|
case 100 /* Node16 */:
|
|
115395
115487
|
case 199 /* NodeNext */:
|
|
115396
|
-
|
|
115488
|
+
case 1 /* CommonJS */:
|
|
115489
|
+
return transformImpliedNodeFormatDependentModule;
|
|
115490
|
+
case 4 /* System */:
|
|
115491
|
+
return transformSystemModule;
|
|
115397
115492
|
default:
|
|
115398
115493
|
return transformModule;
|
|
115399
115494
|
}
|
|
@@ -116128,6 +116223,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
116128
116223
|
newLine: compilerOptions.newLine,
|
|
116129
116224
|
noEmitHelpers: compilerOptions.noEmitHelpers,
|
|
116130
116225
|
module: getEmitModuleKind(compilerOptions),
|
|
116226
|
+
moduleResolution: getEmitModuleResolutionKind(compilerOptions),
|
|
116131
116227
|
target: getEmitScriptTarget(compilerOptions),
|
|
116132
116228
|
sourceMap: compilerOptions.sourceMap,
|
|
116133
116229
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
@@ -116190,6 +116286,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
116190
116286
|
newLine: compilerOptions.newLine,
|
|
116191
116287
|
noEmitHelpers: true,
|
|
116192
116288
|
module: compilerOptions.module,
|
|
116289
|
+
moduleResolution: compilerOptions.moduleResolution,
|
|
116193
116290
|
target: compilerOptions.target,
|
|
116194
116291
|
sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
|
|
116195
116292
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
@@ -121755,7 +121852,6 @@ function getModeForUsageLocation(file, usage, compilerOptions) {
|
|
|
121755
121852
|
return getModeForUsageLocationWorker(file, usage, compilerOptions);
|
|
121756
121853
|
}
|
|
121757
121854
|
function getModeForUsageLocationWorker(file, usage, compilerOptions) {
|
|
121758
|
-
var _a;
|
|
121759
121855
|
if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
|
|
121760
121856
|
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
|
|
121761
121857
|
if (isTypeOnly) {
|
|
@@ -121771,20 +121867,28 @@ function getModeForUsageLocationWorker(file, usage, compilerOptions) {
|
|
|
121771
121867
|
return override;
|
|
121772
121868
|
}
|
|
121773
121869
|
}
|
|
121774
|
-
if (compilerOptions &&
|
|
121775
|
-
return usage
|
|
121776
|
-
usage.parent,
|
|
121777
|
-
/*requireStringLiteralLikeArgument*/
|
|
121778
|
-
false
|
|
121779
|
-
) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
121870
|
+
if (compilerOptions && importSyntaxAffectsModuleResolution(compilerOptions)) {
|
|
121871
|
+
return getEmitSyntaxForUsageLocationWorker(file, usage, compilerOptions);
|
|
121780
121872
|
}
|
|
121781
|
-
|
|
121873
|
+
}
|
|
121874
|
+
function getEmitSyntaxForUsageLocationWorker(file, usage, compilerOptions) {
|
|
121875
|
+
var _a;
|
|
121876
|
+
if (!compilerOptions) {
|
|
121782
121877
|
return void 0;
|
|
121783
|
-
if (file.impliedNodeFormat !== 99 /* ESNext */) {
|
|
121784
|
-
return isImportCall(walkUpParenthesizedExpressions(usage.parent)) ? 99 /* ESNext */ : 1 /* CommonJS */;
|
|
121785
121878
|
}
|
|
121786
121879
|
const exprParentParent = (_a = walkUpParenthesizedExpressions(usage.parent)) == null ? void 0 : _a.parent;
|
|
121787
|
-
|
|
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;
|
|
121788
121892
|
}
|
|
121789
121893
|
function getResolutionModeOverride(node, grammarErrorOnNode) {
|
|
121790
121894
|
if (!node)
|
|
@@ -121844,7 +121948,7 @@ function getTypeReferenceResolutionName(entry) {
|
|
|
121844
121948
|
}
|
|
121845
121949
|
var typeReferenceResolutionNameAndModeGetter = {
|
|
121846
121950
|
getName: getTypeReferenceResolutionName,
|
|
121847
|
-
getMode: (entry, file) => getModeForFileReference(entry, file
|
|
121951
|
+
getMode: (entry, file, compilerOptions) => getModeForFileReference(entry, file && getDefaultResolutionModeForFileWorker(file, compilerOptions))
|
|
121848
121952
|
};
|
|
121849
121953
|
function createTypeReferenceResolutionLoader(containingFile, redirectedReference, options, host, cache) {
|
|
121850
121954
|
return {
|
|
@@ -122032,13 +122136,7 @@ function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, optio
|
|
|
122032
122136
|
return typeof result === "object" ? result.impliedNodeFormat : result;
|
|
122033
122137
|
}
|
|
122034
122138
|
function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
|
|
122035
|
-
|
|
122036
|
-
case 3 /* Node16 */:
|
|
122037
|
-
case 99 /* NodeNext */:
|
|
122038
|
-
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
|
-
default:
|
|
122040
|
-
return void 0;
|
|
122041
|
-
}
|
|
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;
|
|
122042
122140
|
function lookupFromPackageJson() {
|
|
122043
122141
|
const state = getTemporaryModuleResolutionState(packageJsonInfoCache, host, options);
|
|
122044
122142
|
const packageJsonLocations = [];
|
|
@@ -122488,6 +122586,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122488
122586
|
isSourceFileFromExternalLibrary,
|
|
122489
122587
|
isSourceFileDefaultLibrary,
|
|
122490
122588
|
getModeForUsageLocation: getModeForUsageLocation2,
|
|
122589
|
+
getEmitSyntaxForUsageLocation,
|
|
122491
122590
|
getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
|
|
122492
122591
|
getSourceFileFromReference,
|
|
122493
122592
|
getLibFileFromReference,
|
|
@@ -122515,6 +122614,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122515
122614
|
forEachResolvedProjectReference: forEachResolvedProjectReference2,
|
|
122516
122615
|
isSourceOfProjectReferenceRedirect,
|
|
122517
122616
|
getRedirectReferenceForResolutionFromSourceOfProject,
|
|
122617
|
+
getCompilerOptionsForFile,
|
|
122618
|
+
getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
|
|
122619
|
+
getEmitModuleFormatOfFile: getEmitModuleFormatOfFile2,
|
|
122620
|
+
getImpliedNodeFormatForEmit: getImpliedNodeFormatForEmit2,
|
|
122621
|
+
shouldTransformImportCall,
|
|
122518
122622
|
emitBuildInfo,
|
|
122519
122623
|
fileExists,
|
|
122520
122624
|
readFile,
|
|
@@ -123078,6 +123182,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123078
123182
|
getSymlinkCache,
|
|
123079
123183
|
writeFile: writeFileCallback || writeFile2,
|
|
123080
123184
|
isEmitBlocked,
|
|
123185
|
+
shouldTransformImportCall,
|
|
123186
|
+
getEmitModuleFormatOfFile: getEmitModuleFormatOfFile2,
|
|
123187
|
+
getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
|
|
123188
|
+
getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
|
|
123081
123189
|
readFile: (f) => host.readFile(f),
|
|
123082
123190
|
fileExists: (f) => {
|
|
123083
123191
|
const path = toPath3(f);
|
|
@@ -124113,10 +124221,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124113
124221
|
const resolvedTypeReferenceDirective = resolutions[index];
|
|
124114
124222
|
const fileName = toFileNameLowerCase(ref.fileName);
|
|
124115
124223
|
resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
|
|
124116
|
-
const mode = ref.resolutionMode || file
|
|
124224
|
+
const mode = ref.resolutionMode || getDefaultResolutionModeForFile2(file);
|
|
124117
124225
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
|
|
124118
124226
|
}
|
|
124119
124227
|
}
|
|
124228
|
+
function getCompilerOptionsForFile(file) {
|
|
124229
|
+
var _a2;
|
|
124230
|
+
return ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
|
|
124231
|
+
}
|
|
124120
124232
|
function processTypeReferenceDirective(typeReferenceDirective, mode, resolution, reason) {
|
|
124121
124233
|
var _a2, _b2;
|
|
124122
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 });
|
|
@@ -124264,13 +124376,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124264
124376
|
return host.getCanonicalFileName(fileName);
|
|
124265
124377
|
}
|
|
124266
124378
|
function processImportedModules(file) {
|
|
124267
|
-
var _a2;
|
|
124268
124379
|
collectExternalModuleReferences(file);
|
|
124269
124380
|
if (file.imports.length || file.moduleAugmentations.length) {
|
|
124270
124381
|
const moduleNames = getModuleNames(file);
|
|
124271
124382
|
const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
|
|
124272
124383
|
Debug.assert(resolutions.length === moduleNames.length);
|
|
124273
|
-
const optionsForFile = (
|
|
124384
|
+
const optionsForFile = getCompilerOptionsForFile(file);
|
|
124274
124385
|
const resolutionsInFile = createModeAwareCache();
|
|
124275
124386
|
(resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
|
|
124276
124387
|
for (let index = 0; index < moduleNames.length; index++) {
|
|
@@ -124806,7 +124917,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124806
124917
|
fileIncludeReasons = void 0;
|
|
124807
124918
|
const location = locationReason && getReferencedFileLocation(program, locationReason);
|
|
124808
124919
|
const fileIncludeReasonDetails = fileIncludeReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
|
|
124809
|
-
const
|
|
124920
|
+
const optionsForFile = file && getCompilerOptionsForFile(file) || options;
|
|
124921
|
+
const redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, optionsForFile);
|
|
124810
124922
|
const chain = chainDiagnosticMessages(redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails, diagnostic, ...args || emptyArray);
|
|
124811
124923
|
return location && isReferenceFileLocation(location) ? createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) : createCompilerDiagnosticFromMessageChain(chain, relatedInfo);
|
|
124812
124924
|
function processReason(reason) {
|
|
@@ -125107,13 +125219,53 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
125107
125219
|
return symlinks;
|
|
125108
125220
|
}
|
|
125109
125221
|
function getModeForUsageLocation2(file, usage) {
|
|
125110
|
-
|
|
125111
|
-
|
|
125112
|
-
|
|
125222
|
+
return getModeForUsageLocationWorker(file, usage, getCompilerOptionsForFile(file));
|
|
125223
|
+
}
|
|
125224
|
+
function getEmitSyntaxForUsageLocation(file, usage) {
|
|
125225
|
+
return getEmitSyntaxForUsageLocationWorker(file, usage, getCompilerOptionsForFile(file));
|
|
125113
125226
|
}
|
|
125114
125227
|
function getModeForResolutionAtIndex2(file, index) {
|
|
125115
125228
|
return getModeForUsageLocation2(file, getModuleNameStringLiteralAt(file, index));
|
|
125116
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;
|
|
125117
125269
|
}
|
|
125118
125270
|
function updateHostForUseSourceOfProjectReferenceRedirect(host) {
|
|
125119
125271
|
let setOfDeclarationDirectories;
|
|
@@ -127124,9 +127276,15 @@ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLoo
|
|
|
127124
127276
|
const nodeModulesIndex = failedLookupPathComponents.indexOf("node_modules");
|
|
127125
127277
|
if (nodeModulesIndex !== -1 && nodeModulesIndex + 1 <= perceivedOsRootLength + 1)
|
|
127126
127278
|
return void 0;
|
|
127279
|
+
const lastNodeModulesIndex = failedLookupPathComponents.lastIndexOf("node_modules");
|
|
127127
127280
|
if (isInDirectoryPath(rootPathComponents, failedLookupPathComponents)) {
|
|
127128
127281
|
if (failedLookupPathComponents.length > rootPathComponents.length + 1) {
|
|
127129
|
-
return getDirectoryOfFailedLookupWatch(
|
|
127282
|
+
return getDirectoryOfFailedLookupWatch(
|
|
127283
|
+
failedLookupComponents,
|
|
127284
|
+
failedLookupPathComponents,
|
|
127285
|
+
Math.max(rootPathComponents.length + 1, perceivedOsRootLength + 1),
|
|
127286
|
+
lastNodeModulesIndex
|
|
127287
|
+
);
|
|
127130
127288
|
} else {
|
|
127131
127289
|
return {
|
|
127132
127290
|
dir: rootDir,
|
|
@@ -127141,12 +127299,18 @@ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLoo
|
|
|
127141
127299
|
failedLookupPathComponents.length - 1,
|
|
127142
127300
|
perceivedOsRootLength,
|
|
127143
127301
|
nodeModulesIndex,
|
|
127144
|
-
rootPathComponents
|
|
127302
|
+
rootPathComponents,
|
|
127303
|
+
lastNodeModulesIndex
|
|
127145
127304
|
);
|
|
127146
127305
|
}
|
|
127147
|
-
function getDirectoryToWatchFromFailedLookupLocationDirectory(dirComponents, dirPathComponents, dirPathComponentsLength, perceivedOsRootLength, nodeModulesIndex, rootPathComponents) {
|
|
127306
|
+
function getDirectoryToWatchFromFailedLookupLocationDirectory(dirComponents, dirPathComponents, dirPathComponentsLength, perceivedOsRootLength, nodeModulesIndex, rootPathComponents, lastNodeModulesIndex) {
|
|
127148
127307
|
if (nodeModulesIndex !== -1) {
|
|
127149
|
-
return getDirectoryOfFailedLookupWatch(
|
|
127308
|
+
return getDirectoryOfFailedLookupWatch(
|
|
127309
|
+
dirComponents,
|
|
127310
|
+
dirPathComponents,
|
|
127311
|
+
nodeModulesIndex + 1,
|
|
127312
|
+
lastNodeModulesIndex
|
|
127313
|
+
);
|
|
127150
127314
|
}
|
|
127151
127315
|
let nonRecursive = true;
|
|
127152
127316
|
let length2 = dirPathComponentsLength;
|
|
@@ -127157,13 +127321,29 @@ function getDirectoryToWatchFromFailedLookupLocationDirectory(dirComponents, dir
|
|
|
127157
127321
|
break;
|
|
127158
127322
|
}
|
|
127159
127323
|
}
|
|
127160
|
-
return getDirectoryOfFailedLookupWatch(
|
|
127324
|
+
return getDirectoryOfFailedLookupWatch(
|
|
127325
|
+
dirComponents,
|
|
127326
|
+
dirPathComponents,
|
|
127327
|
+
length2,
|
|
127328
|
+
lastNodeModulesIndex,
|
|
127329
|
+
nonRecursive
|
|
127330
|
+
);
|
|
127161
127331
|
}
|
|
127162
|
-
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
|
+
}
|
|
127163
127341
|
return {
|
|
127164
127342
|
dir: getPathFromPathComponents(dirComponents, length2),
|
|
127165
127343
|
dirPath: getPathFromPathComponents(dirPathComponents, length2),
|
|
127166
|
-
nonRecursive
|
|
127344
|
+
nonRecursive,
|
|
127345
|
+
packageDir: packageDirLength !== void 0 ? getPathFromPathComponents(dirComponents, packageDirLength) : void 0,
|
|
127346
|
+
packageDirPath: packageDirLength !== void 0 ? getPathFromPathComponents(dirPathComponents, packageDirLength) : void 0
|
|
127167
127347
|
};
|
|
127168
127348
|
}
|
|
127169
127349
|
function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, rootPathComponents, getCurrentDirectory, filterCustomPath) {
|
|
@@ -127178,7 +127358,8 @@ function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootP
|
|
|
127178
127358
|
typeRootPathComponents.length,
|
|
127179
127359
|
perceivedOsRootLengthForWatching(typeRootPathComponents, typeRootPathComponents.length),
|
|
127180
127360
|
typeRootPathComponents.indexOf("node_modules"),
|
|
127181
|
-
rootPathComponents
|
|
127361
|
+
rootPathComponents,
|
|
127362
|
+
typeRootPathComponents.lastIndexOf("node_modules")
|
|
127182
127363
|
);
|
|
127183
127364
|
return toWatch && filterCustomPath(toWatch.dirPath) ? toWatch.dirPath : void 0;
|
|
127184
127365
|
}
|
|
@@ -127277,6 +127458,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127277
127458
|
const rootDir = getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory);
|
|
127278
127459
|
const rootPath = resolutionHost.toPath(rootDir);
|
|
127279
127460
|
const rootPathComponents = getPathComponents(rootPath);
|
|
127461
|
+
const isSymlinkCache = /* @__PURE__ */ new Map();
|
|
127462
|
+
const packageDirWatchers = /* @__PURE__ */ new Map();
|
|
127463
|
+
const dirPathToSymlinkPackageRefCount = /* @__PURE__ */ new Map();
|
|
127280
127464
|
const typeRootsWatches = /* @__PURE__ */ new Map();
|
|
127281
127465
|
return {
|
|
127282
127466
|
rootDirForResolution,
|
|
@@ -127288,6 +127472,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127288
127472
|
resolutionsWithOnlyAffectingLocations,
|
|
127289
127473
|
directoryWatchesOfFailedLookups,
|
|
127290
127474
|
fileWatchesOfAffectingLocations,
|
|
127475
|
+
packageDirWatchers,
|
|
127476
|
+
dirPathToSymlinkPackageRefCount,
|
|
127291
127477
|
watchFailedLookupLocationsOfExternalModuleResolutions,
|
|
127292
127478
|
getModuleResolutionCache: () => moduleResolutionCache,
|
|
127293
127479
|
startRecordingFilesWithChangedResolutions,
|
|
@@ -127322,6 +127508,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127322
127508
|
function clear2() {
|
|
127323
127509
|
clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
|
|
127324
127510
|
clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
|
|
127511
|
+
isSymlinkCache.clear();
|
|
127512
|
+
packageDirWatchers.clear();
|
|
127513
|
+
dirPathToSymlinkPackageRefCount.clear();
|
|
127325
127514
|
nonRelativeExternalModuleResolutions.clear();
|
|
127326
127515
|
closeTypeRootsWatch();
|
|
127327
127516
|
resolvedModuleNames.clear();
|
|
@@ -127388,6 +127577,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127388
127577
|
libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
127389
127578
|
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
127390
127579
|
nonRelativeExternalModuleResolutions.clear();
|
|
127580
|
+
isSymlinkCache.clear();
|
|
127391
127581
|
}
|
|
127392
127582
|
function cleanupLibResolutionWatching(newProgram) {
|
|
127393
127583
|
resolvedLibraries.forEach((resolution, libFileName) => {
|
|
@@ -127440,11 +127630,18 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127440
127630
|
}
|
|
127441
127631
|
directoryWatchesOfFailedLookups.forEach(closeDirectoryWatchesOfFailedLookup);
|
|
127442
127632
|
fileWatchesOfAffectingLocations.forEach(closeFileWatcherOfAffectingLocation);
|
|
127633
|
+
packageDirWatchers.forEach(closePackageDirWatcher);
|
|
127443
127634
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
127444
127635
|
moduleResolutionCache.isReadonly = true;
|
|
127445
127636
|
typeReferenceDirectiveResolutionCache.isReadonly = true;
|
|
127446
127637
|
libraryResolutionCache.isReadonly = true;
|
|
127447
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
|
+
}
|
|
127448
127645
|
}
|
|
127449
127646
|
function closeDirectoryWatchesOfFailedLookup(watcher, path) {
|
|
127450
127647
|
if (watcher.refCount === 0) {
|
|
@@ -127694,12 +127891,13 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127694
127891
|
getCurrentDirectory
|
|
127695
127892
|
);
|
|
127696
127893
|
if (toWatch) {
|
|
127697
|
-
const { dir, dirPath, nonRecursive } = toWatch;
|
|
127894
|
+
const { dir, dirPath, nonRecursive, packageDir, packageDirPath } = toWatch;
|
|
127698
127895
|
if (dirPath === rootPath) {
|
|
127699
127896
|
Debug.assert(nonRecursive);
|
|
127897
|
+
Debug.assert(!packageDir);
|
|
127700
127898
|
setAtRoot = true;
|
|
127701
127899
|
} else {
|
|
127702
|
-
setDirectoryWatcher(dir, dirPath, nonRecursive);
|
|
127900
|
+
setDirectoryWatcher(dir, dirPath, packageDir, packageDirPath, nonRecursive);
|
|
127703
127901
|
}
|
|
127704
127902
|
}
|
|
127705
127903
|
return setAtRoot;
|
|
@@ -127723,6 +127921,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127723
127921
|
setDirectoryWatcher(
|
|
127724
127922
|
rootDir,
|
|
127725
127923
|
rootPath,
|
|
127924
|
+
/*packageDir*/
|
|
127925
|
+
void 0,
|
|
127926
|
+
/*packageDirPath*/
|
|
127927
|
+
void 0,
|
|
127726
127928
|
/*nonRecursive*/
|
|
127727
127929
|
true
|
|
127728
127930
|
);
|
|
@@ -127823,14 +128025,68 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127823
128025
|
));
|
|
127824
128026
|
}
|
|
127825
128027
|
}
|
|
127826
|
-
function
|
|
127827
|
-
|
|
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);
|
|
127828
128083
|
if (dirWatcher) {
|
|
127829
128084
|
Debug.assert(!!nonRecursive === !!dirWatcher.nonRecursive);
|
|
127830
128085
|
dirWatcher.refCount++;
|
|
127831
128086
|
} else {
|
|
127832
|
-
directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive });
|
|
128087
|
+
directoryWatchesOfFailedLookups.set(dirPath, dirWatcher = { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive });
|
|
127833
128088
|
}
|
|
128089
|
+
return dirWatcher;
|
|
127834
128090
|
}
|
|
127835
128091
|
function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot, syncDirWatcherRemove) {
|
|
127836
128092
|
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
@@ -127843,9 +128099,27 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127843
128099
|
getCurrentDirectory
|
|
127844
128100
|
);
|
|
127845
128101
|
if (toWatch) {
|
|
127846
|
-
const { dirPath } = toWatch;
|
|
128102
|
+
const { dirPath, packageDirPath } = toWatch;
|
|
127847
128103
|
if (dirPath === rootPath) {
|
|
127848
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
|
+
}
|
|
127849
128123
|
} else {
|
|
127850
128124
|
removeDirectoryWatcher(dirPath, syncDirWatcherRemove);
|
|
127851
128125
|
}
|
|
@@ -128067,7 +128341,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
128067
128341
|
rootPath,
|
|
128068
128342
|
rootPathComponents,
|
|
128069
128343
|
getCurrentDirectory,
|
|
128070
|
-
(dirPath2) => directoryWatchesOfFailedLookups.has(dirPath2)
|
|
128344
|
+
(dirPath2) => directoryWatchesOfFailedLookups.has(dirPath2) || dirPathToSymlinkPackageRefCount.has(dirPath2)
|
|
128071
128345
|
);
|
|
128072
128346
|
if (dirPath) {
|
|
128073
128347
|
scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
|
|
@@ -128273,10 +128547,10 @@ function explainFiles(program, write) {
|
|
|
128273
128547
|
for (const file of program.getSourceFiles()) {
|
|
128274
128548
|
write(`${toFileName(file, relativeFileName)}`);
|
|
128275
128549
|
(_a = reasons.get(file.path)) == null ? void 0 : _a.forEach((reason) => write(` ${fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText}`));
|
|
128276
|
-
(_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}`));
|
|
128277
128551
|
}
|
|
128278
128552
|
}
|
|
128279
|
-
function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
|
|
128553
|
+
function explainIfFileIsRedirectAndImpliedFormat(file, options, fileNameConvertor) {
|
|
128280
128554
|
var _a;
|
|
128281
128555
|
let result;
|
|
128282
128556
|
if (file.path !== file.resolvedPath) {
|
|
@@ -128296,7 +128570,7 @@ function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
|
|
|
128296
128570
|
));
|
|
128297
128571
|
}
|
|
128298
128572
|
if (isExternalOrCommonJsModule(file)) {
|
|
128299
|
-
switch (file
|
|
128573
|
+
switch (getImpliedNodeFormatForEmitWorker(file, options)) {
|
|
128300
128574
|
case 99 /* ESNext */:
|
|
128301
128575
|
if (file.packageJsonScope) {
|
|
128302
128576
|
(result ?? (result = [])).push(chainDiagnosticMessages(
|
|
@@ -134677,7 +134951,9 @@ function createModuleSpecifierResolutionHost(program, host) {
|
|
|
134677
134951
|
isSourceOfProjectReferenceRedirect: (fileName) => program.isSourceOfProjectReferenceRedirect(fileName),
|
|
134678
134952
|
getNearestAncestorDirectoryWithPackageJson: maybeBind(host, host.getNearestAncestorDirectoryWithPackageJson),
|
|
134679
134953
|
getFileIncludeReasons: () => program.getFileIncludeReasons(),
|
|
134680
|
-
getCommonSourceDirectory: () => program.getCommonSourceDirectory()
|
|
134954
|
+
getCommonSourceDirectory: () => program.getCommonSourceDirectory(),
|
|
134955
|
+
getDefaultResolutionModeForFile: (file) => program.getDefaultResolutionModeForFile(file),
|
|
134956
|
+
getModeForResolutionAtIndex: (file, index) => program.getModeForResolutionAtIndex(file, index)
|
|
134681
134957
|
};
|
|
134682
134958
|
}
|
|
134683
134959
|
function getModuleSpecifierResolverHost(program, host) {
|
|
@@ -135989,9 +136265,13 @@ function fileShouldUseJavaScriptRequire(file, program, host, preferRequire) {
|
|
|
135989
136265
|
if (!hasJSFileExtension(fileName)) {
|
|
135990
136266
|
return false;
|
|
135991
136267
|
}
|
|
135992
|
-
const compilerOptions = program.getCompilerOptions();
|
|
136268
|
+
const compilerOptions = typeof file === "string" ? program.getCompilerOptions() : program.getCompilerOptionsForFile(file);
|
|
135993
136269
|
const moduleKind = getEmitModuleKind(compilerOptions);
|
|
135994
|
-
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);
|
|
135995
136275
|
if (impliedNodeFormat === 99 /* ESNext */) {
|
|
135996
136276
|
return false;
|
|
135997
136277
|
}
|
|
@@ -139028,7 +139308,7 @@ function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
|
|
|
139028
139308
|
program.getSemanticDiagnostics(sourceFile, cancellationToken);
|
|
139029
139309
|
const diags = [];
|
|
139030
139310
|
const checker = program.getTypeChecker();
|
|
139031
|
-
const isCommonJSFile = sourceFile
|
|
139311
|
+
const isCommonJSFile = program.getImpliedNodeFormatForEmit(sourceFile) === 1 /* CommonJS */ || fileExtensionIsOneOf(sourceFile.fileName, [".cts" /* Cts */, ".cjs" /* Cjs */]);
|
|
139032
139312
|
if (!isCommonJSFile && sourceFile.commonJsModuleIndicator && (programContainsEsModules(program) || compilerOptionsIndicateEsModules(program.getCompilerOptions())) && containsTopLevelCommonjs(sourceFile)) {
|
|
139033
139313
|
diags.push(createDiagnosticForNode(getErrorNodeFromCommonJsIndicator(sourceFile.commonJsModuleIndicator), Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module));
|
|
139034
139314
|
}
|
|
@@ -152310,7 +152590,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
|
|
|
152310
152590
|
compilerOptions,
|
|
152311
152591
|
createModuleSpecifierResolutionHost(program, host)
|
|
152312
152592
|
);
|
|
152313
|
-
const importKind = getImportKind(futureExportingSourceFile, exportKind,
|
|
152593
|
+
const importKind = getImportKind(futureExportingSourceFile, exportKind, program);
|
|
152314
152594
|
const addAsTypeOnly = getAddAsTypeOnly(
|
|
152315
152595
|
isImportUsageValidAsTypeOnly,
|
|
152316
152596
|
/*isForNewImportDeclaration*/
|
|
@@ -152643,7 +152923,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
|
|
|
152643
152923
|
}
|
|
152644
152924
|
function createImportSpecifierResolver(importingFile, program, host, preferences) {
|
|
152645
152925
|
const packageJsonImportFilter = createPackageJsonImportFilter(importingFile, preferences, host);
|
|
152646
|
-
const importMap = createExistingImportMap(
|
|
152926
|
+
const importMap = createExistingImportMap(importingFile, program);
|
|
152647
152927
|
return { getModuleSpecifierForBestExportInfo };
|
|
152648
152928
|
function getModuleSpecifierForBestExportInfo(exportInfo, position, isValidTypeOnlyUseSite, fromCacheOnly) {
|
|
152649
152929
|
const { fixes, computedWithoutCacheCount } = getImportFixes(
|
|
@@ -152750,7 +153030,7 @@ function getSingleExportInfoForSymbol(symbol, symbolName2, moduleSymbol, program
|
|
|
152750
153030
|
function isFutureSymbolExportInfoArray(info) {
|
|
152751
153031
|
return info[0].symbol === void 0;
|
|
152752
153032
|
}
|
|
152753
|
-
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) {
|
|
152754
153034
|
const checker = program.getTypeChecker();
|
|
152755
153035
|
const existingImports = importMap && !isFutureSymbolExportInfoArray(exportInfos) ? flatMap(exportInfos, importMap.getImportsForExportInfo) : emptyArray;
|
|
152756
153036
|
const useNamespace = usagePosition !== void 0 && tryUseExistingNamespaceImport(existingImports, usagePosition);
|
|
@@ -152866,7 +153146,8 @@ function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker
|
|
|
152866
153146
|
};
|
|
152867
153147
|
}
|
|
152868
153148
|
}
|
|
152869
|
-
function createExistingImportMap(
|
|
153149
|
+
function createExistingImportMap(importingFile, program) {
|
|
153150
|
+
const checker = program.getTypeChecker();
|
|
152870
153151
|
let importMap;
|
|
152871
153152
|
for (const moduleSpecifier of importingFile.imports) {
|
|
152872
153153
|
const i = importFromModuleSpecifier(moduleSpecifier);
|
|
@@ -152889,7 +153170,7 @@ function createExistingImportMap(checker, importingFile, compilerOptions) {
|
|
|
152889
153170
|
return emptyArray;
|
|
152890
153171
|
if (isSourceFileJS(importingFile) && !(targetFlags & 111551 /* Value */) && !every(matchingDeclarations, isJSDocImportTag))
|
|
152891
153172
|
return emptyArray;
|
|
152892
|
-
const importKind = getImportKind(importingFile, exportKind,
|
|
153173
|
+
const importKind = getImportKind(importingFile, exportKind, program);
|
|
152893
153174
|
return matchingDeclarations.map((declaration) => ({ declaration, importKind, symbol, targetFlags }));
|
|
152894
153175
|
}
|
|
152895
153176
|
};
|
|
@@ -152906,9 +153187,9 @@ function shouldUseRequire(sourceFile, program) {
|
|
|
152906
153187
|
if (compilerOptions.configFile) {
|
|
152907
153188
|
return getEmitModuleKind(compilerOptions) < 5 /* ES2015 */;
|
|
152908
153189
|
}
|
|
152909
|
-
if (sourceFile
|
|
153190
|
+
if (getImpliedNodeFormatForEmit(sourceFile, program) === 1 /* CommonJS */)
|
|
152910
153191
|
return true;
|
|
152911
|
-
if (sourceFile
|
|
153192
|
+
if (getImpliedNodeFormatForEmit(sourceFile, program) === 99 /* ESNext */)
|
|
152912
153193
|
return false;
|
|
152913
153194
|
for (const otherFile of program.getSourceFiles()) {
|
|
152914
153195
|
if (otherFile === sourceFile || !isSourceFileJS(otherFile) || program.isSourceFileFromExternalLibrary(otherFile))
|
|
@@ -152965,7 +153246,7 @@ function getNewImportFixes(program, sourceFile, usagePosition, isValidTypeOnlyUs
|
|
|
152965
153246
|
if (!importedSymbolHasValueMeaning && isJs && usagePosition !== void 0) {
|
|
152966
153247
|
return { kind: 1 /* JsdocTypeImport */, moduleSpecifier, usagePosition, exportInfo: exportInfo2, isReExport: i > 0 };
|
|
152967
153248
|
}
|
|
152968
|
-
const importKind = getImportKind(sourceFile, exportInfo2.exportKind,
|
|
153249
|
+
const importKind = getImportKind(sourceFile, exportInfo2.exportKind, program);
|
|
152969
153250
|
let qualification;
|
|
152970
153251
|
if (usagePosition !== void 0 && importKind === 3 /* CommonJS */ && exportInfo2.exportKind === 0 /* Named */) {
|
|
152971
153252
|
const exportEquals = checker.resolveExternalModuleSymbol(exportInfo2.moduleSymbol);
|
|
@@ -153138,8 +153419,8 @@ function getUmdSymbol(token, checker) {
|
|
|
153138
153419
|
}
|
|
153139
153420
|
return void 0;
|
|
153140
153421
|
}
|
|
153141
|
-
function getImportKind(importingFile, exportKind,
|
|
153142
|
-
if (
|
|
153422
|
+
function getImportKind(importingFile, exportKind, program, forceImportKeyword) {
|
|
153423
|
+
if (program.getCompilerOptions().verbatimModuleSyntax && getEmitModuleFormatOfFile(importingFile, program) === 1 /* CommonJS */) {
|
|
153143
153424
|
return 3 /* CommonJS */;
|
|
153144
153425
|
}
|
|
153145
153426
|
switch (exportKind) {
|
|
@@ -153148,18 +153429,18 @@ function getImportKind(importingFile, exportKind, compilerOptions, forceImportKe
|
|
|
153148
153429
|
case 1 /* Default */:
|
|
153149
153430
|
return 1 /* Default */;
|
|
153150
153431
|
case 2 /* ExportEquals */:
|
|
153151
|
-
return getExportEqualsImportKind(importingFile,
|
|
153432
|
+
return getExportEqualsImportKind(importingFile, program.getCompilerOptions(), !!forceImportKeyword);
|
|
153152
153433
|
case 3 /* UMD */:
|
|
153153
|
-
return getUmdImportKind(importingFile,
|
|
153434
|
+
return getUmdImportKind(importingFile, program, !!forceImportKeyword);
|
|
153154
153435
|
default:
|
|
153155
153436
|
return Debug.assertNever(exportKind);
|
|
153156
153437
|
}
|
|
153157
153438
|
}
|
|
153158
|
-
function getUmdImportKind(importingFile,
|
|
153159
|
-
if (getAllowSyntheticDefaultImports(
|
|
153439
|
+
function getUmdImportKind(importingFile, program, forceImportKeyword) {
|
|
153440
|
+
if (getAllowSyntheticDefaultImports(program.getCompilerOptions())) {
|
|
153160
153441
|
return 1 /* Default */;
|
|
153161
153442
|
}
|
|
153162
|
-
const moduleKind = getEmitModuleKind(
|
|
153443
|
+
const moduleKind = getEmitModuleKind(program.getCompilerOptions());
|
|
153163
153444
|
switch (moduleKind) {
|
|
153164
153445
|
case 2 /* AMD */:
|
|
153165
153446
|
case 1 /* CommonJS */:
|
|
@@ -153178,7 +153459,7 @@ function getUmdImportKind(importingFile, compilerOptions, forceImportKeyword) {
|
|
|
153178
153459
|
return 2 /* Namespace */;
|
|
153179
153460
|
case 100 /* Node16 */:
|
|
153180
153461
|
case 199 /* NodeNext */:
|
|
153181
|
-
return importingFile
|
|
153462
|
+
return getImpliedNodeFormatForEmit(importingFile, program) === 99 /* ESNext */ ? 2 /* Namespace */ : 3 /* CommonJS */;
|
|
153182
153463
|
default:
|
|
153183
153464
|
return Debug.assertNever(moduleKind, `Unexpected moduleKind ${moduleKind}`);
|
|
153184
153465
|
}
|
|
@@ -153695,6 +153976,12 @@ function moduleSpecifierToValidIdentifier(moduleSpecifier, target, forceCapitali
|
|
|
153695
153976
|
}
|
|
153696
153977
|
return !isStringANonContextualKeyword(res) ? res || "_" : `_${res}`;
|
|
153697
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
|
+
}
|
|
153698
153985
|
|
|
153699
153986
|
// src/services/codefixes/fixAddMissingConstraint.ts
|
|
153700
153987
|
var fixId17 = "addMissingConstraint";
|
|
@@ -160222,10 +160509,12 @@ function getJSDocParamAnnotation(paramName, initializer, dotDotDotToken, isJs, i
|
|
|
160222
160509
|
const printer = isSnippet ? createSnippetPrinter({
|
|
160223
160510
|
removeComments: true,
|
|
160224
160511
|
module: options.module,
|
|
160512
|
+
moduleResolution: options.moduleResolution,
|
|
160225
160513
|
target: options.target
|
|
160226
160514
|
}) : createPrinter({
|
|
160227
160515
|
removeComments: true,
|
|
160228
160516
|
module: options.module,
|
|
160517
|
+
moduleResolution: options.moduleResolution,
|
|
160229
160518
|
target: options.target
|
|
160230
160519
|
});
|
|
160231
160520
|
setEmitFlags(typeNode, 1 /* SingleLine */);
|
|
@@ -160475,6 +160764,7 @@ function getExhaustiveCaseSnippets(caseBlock, sourceFile, preferences, options,
|
|
|
160475
160764
|
const printer = createSnippetPrinter({
|
|
160476
160765
|
removeComments: true,
|
|
160477
160766
|
module: options.module,
|
|
160767
|
+
moduleResolution: options.moduleResolution,
|
|
160478
160768
|
target: options.target,
|
|
160479
160769
|
newLine: getNewLineKind(newLineChar)
|
|
160480
160770
|
});
|
|
@@ -160663,7 +160953,7 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
160663
160953
|
if (originIsResolvedExport(origin)) {
|
|
160664
160954
|
sourceDisplay = [textPart(origin.moduleSpecifier)];
|
|
160665
160955
|
if (importStatementCompletion) {
|
|
160666
|
-
({ insertText, replacementSpan } = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile,
|
|
160956
|
+
({ insertText, replacementSpan } = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, program, preferences));
|
|
160667
160957
|
isSnippet = preferences.includeCompletionsWithSnippetText ? true : void 0;
|
|
160668
160958
|
}
|
|
160669
160959
|
}
|
|
@@ -160779,6 +161069,7 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
|
|
|
160779
161069
|
const printer = createSnippetPrinter({
|
|
160780
161070
|
removeComments: true,
|
|
160781
161071
|
module: options.module,
|
|
161072
|
+
moduleResolution: options.moduleResolution,
|
|
160782
161073
|
target: options.target,
|
|
160783
161074
|
omitTrailingSemicolon: false,
|
|
160784
161075
|
newLine: getNewLineKind(getNewLineOrDefaultFromHost(host, formatContext == null ? void 0 : formatContext.options))
|
|
@@ -160929,6 +161220,7 @@ function getEntryForObjectLiteralMethodCompletion(symbol, name, enclosingDeclara
|
|
|
160929
161220
|
const printer = createSnippetPrinter({
|
|
160930
161221
|
removeComments: true,
|
|
160931
161222
|
module: options.module,
|
|
161223
|
+
moduleResolution: options.moduleResolution,
|
|
160932
161224
|
target: options.target,
|
|
160933
161225
|
omitTrailingSemicolon: false,
|
|
160934
161226
|
newLine: getNewLineKind(getNewLineOrDefaultFromHost(host, formatContext == null ? void 0 : formatContext.options))
|
|
@@ -160949,6 +161241,7 @@ function getEntryForObjectLiteralMethodCompletion(symbol, name, enclosingDeclara
|
|
|
160949
161241
|
const signaturePrinter = createPrinter({
|
|
160950
161242
|
removeComments: true,
|
|
160951
161243
|
module: options.module,
|
|
161244
|
+
moduleResolution: options.moduleResolution,
|
|
160952
161245
|
target: options.target,
|
|
160953
161246
|
omitTrailingSemicolon: true
|
|
160954
161247
|
});
|
|
@@ -161210,7 +161503,7 @@ function completionEntryDataToSymbolOriginInfo(data, completionName, moduleSymbo
|
|
|
161210
161503
|
};
|
|
161211
161504
|
return unresolvedOrigin;
|
|
161212
161505
|
}
|
|
161213
|
-
function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile,
|
|
161506
|
+
function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, program, preferences) {
|
|
161214
161507
|
const replacementSpan = importStatementCompletion.replacementSpan;
|
|
161215
161508
|
const quotedModuleSpecifier = escapeSnippetText(quote(sourceFile, preferences, origin.moduleSpecifier));
|
|
161216
161509
|
const exportKind = origin.isDefaultExport ? 1 /* Default */ : origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : 0 /* Named */;
|
|
@@ -161218,7 +161511,7 @@ function getInsertTextAndReplacementSpanForImportCompletion(name, importStatemen
|
|
|
161218
161511
|
const importKind = ts_codefix_exports.getImportKind(
|
|
161219
161512
|
sourceFile,
|
|
161220
161513
|
exportKind,
|
|
161221
|
-
|
|
161514
|
+
program,
|
|
161222
161515
|
/*forceImportKeyword*/
|
|
161223
161516
|
true
|
|
161224
161517
|
);
|
|
@@ -163634,7 +163927,7 @@ function createNameAndKindSet() {
|
|
|
163634
163927
|
}
|
|
163635
163928
|
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences, includeSymbol) {
|
|
163636
163929
|
if (isInReferenceComment(sourceFile, position)) {
|
|
163637
|
-
const entries = getTripleSlashReferenceCompletion(sourceFile, position,
|
|
163930
|
+
const entries = getTripleSlashReferenceCompletion(sourceFile, position, program, host);
|
|
163638
163931
|
return entries && convertPathCompletions(entries);
|
|
163639
163932
|
}
|
|
163640
163933
|
if (isInString(sourceFile, position, contextToken)) {
|
|
@@ -163947,7 +164240,7 @@ function getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node, prog
|
|
|
163947
164240
|
const compilerOptions = program.getCompilerOptions();
|
|
163948
164241
|
const typeChecker = program.getTypeChecker();
|
|
163949
164242
|
const extensionOptions = getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile, typeChecker, preferences, mode);
|
|
163950
|
-
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);
|
|
163951
164244
|
}
|
|
163952
164245
|
function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, typeChecker, preferences, resolutionMode) {
|
|
163953
164246
|
return {
|
|
@@ -163958,14 +164251,15 @@ function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile
|
|
|
163958
164251
|
resolutionMode
|
|
163959
164252
|
};
|
|
163960
164253
|
}
|
|
163961
|
-
function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory,
|
|
164254
|
+
function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, program, host, scriptPath, extensionOptions) {
|
|
164255
|
+
const compilerOptions = program.getCompilerOptions();
|
|
163962
164256
|
if (compilerOptions.rootDirs) {
|
|
163963
164257
|
return getCompletionEntriesForDirectoryFragmentWithRootDirs(
|
|
163964
164258
|
compilerOptions.rootDirs,
|
|
163965
164259
|
literalValue,
|
|
163966
164260
|
scriptDirectory,
|
|
163967
164261
|
extensionOptions,
|
|
163968
|
-
|
|
164262
|
+
program,
|
|
163969
164263
|
host,
|
|
163970
164264
|
scriptPath
|
|
163971
164265
|
);
|
|
@@ -163974,6 +164268,7 @@ function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, c
|
|
|
163974
164268
|
literalValue,
|
|
163975
164269
|
scriptDirectory,
|
|
163976
164270
|
extensionOptions,
|
|
164271
|
+
program,
|
|
163977
164272
|
host,
|
|
163978
164273
|
/*moduleSpecifierIsRelative*/
|
|
163979
164274
|
true,
|
|
@@ -164001,7 +164296,8 @@ function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptDirectory, ign
|
|
|
164001
164296
|
compareStringsCaseSensitive
|
|
164002
164297
|
);
|
|
164003
164298
|
}
|
|
164004
|
-
function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptDirectory, extensionOptions,
|
|
164299
|
+
function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptDirectory, extensionOptions, program, host, exclude) {
|
|
164300
|
+
const compilerOptions = program.getCompilerOptions();
|
|
164005
164301
|
const basePath = compilerOptions.project || host.getCurrentDirectory();
|
|
164006
164302
|
const ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());
|
|
164007
164303
|
const baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptDirectory, ignoreCase);
|
|
@@ -164010,6 +164306,7 @@ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment
|
|
|
164010
164306
|
fragment,
|
|
164011
164307
|
baseDirectory,
|
|
164012
164308
|
extensionOptions,
|
|
164309
|
+
program,
|
|
164013
164310
|
host,
|
|
164014
164311
|
/*moduleSpecifierIsRelative*/
|
|
164015
164312
|
true,
|
|
@@ -164018,7 +164315,7 @@ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment
|
|
|
164018
164315
|
(itemA, itemB) => itemA.name === itemB.name && itemA.kind === itemB.kind && itemA.extension === itemB.extension
|
|
164019
164316
|
);
|
|
164020
164317
|
}
|
|
164021
|
-
function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, extensionOptions, host, moduleSpecifierIsRelative, exclude, result = createNameAndKindSet()) {
|
|
164318
|
+
function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, extensionOptions, program, host, moduleSpecifierIsRelative, exclude, result = createNameAndKindSet()) {
|
|
164022
164319
|
var _a;
|
|
164023
164320
|
if (fragment === void 0) {
|
|
164024
164321
|
fragment = "";
|
|
@@ -164043,7 +164340,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
|
|
|
164043
164340
|
if (versionPaths) {
|
|
164044
164341
|
const packageDirectory = getDirectoryPath(packageJsonPath);
|
|
164045
164342
|
const pathInPackage = absolutePath.slice(ensureTrailingDirectorySeparator(packageDirectory).length);
|
|
164046
|
-
if (addCompletionEntriesFromPaths(result, pathInPackage, packageDirectory, extensionOptions, host, versionPaths)) {
|
|
164343
|
+
if (addCompletionEntriesFromPaths(result, pathInPackage, packageDirectory, extensionOptions, program, host, versionPaths)) {
|
|
164047
164344
|
return result;
|
|
164048
164345
|
}
|
|
164049
164346
|
}
|
|
@@ -164070,7 +164367,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
|
|
|
164070
164367
|
}
|
|
164071
164368
|
const { name, extension } = getFilenameWithExtensionOption(
|
|
164072
164369
|
getBaseFileName(filePath),
|
|
164073
|
-
|
|
164370
|
+
program,
|
|
164074
164371
|
extensionOptions,
|
|
164075
164372
|
/*isExportsWildcard*/
|
|
164076
164373
|
false
|
|
@@ -164089,7 +164386,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
|
|
|
164089
164386
|
}
|
|
164090
164387
|
return result;
|
|
164091
164388
|
}
|
|
164092
|
-
function getFilenameWithExtensionOption(name,
|
|
164389
|
+
function getFilenameWithExtensionOption(name, program, extensionOptions, isExportsWildcard) {
|
|
164093
164390
|
const nonJsResult = ts_moduleSpecifiers_exports.tryGetRealFileNameForNonJsDeclarationFileName(name);
|
|
164094
164391
|
if (nonJsResult) {
|
|
164095
164392
|
return { name: nonJsResult, extension: tryGetExtensionFromPath2(nonJsResult) };
|
|
@@ -164099,7 +164396,8 @@ function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions,
|
|
|
164099
164396
|
}
|
|
164100
164397
|
let allowedEndings = getModuleSpecifierPreferences(
|
|
164101
164398
|
{ importModuleSpecifierEnding: extensionOptions.endingPreference },
|
|
164102
|
-
|
|
164399
|
+
program,
|
|
164400
|
+
program.getCompilerOptions(),
|
|
164103
164401
|
extensionOptions.importingSourceFile
|
|
164104
164402
|
).getAllowedEndingsInPreferredOrder(extensionOptions.resolutionMode);
|
|
164105
164403
|
if (isExportsWildcard) {
|
|
@@ -164109,16 +164407,16 @@ function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions,
|
|
|
164109
164407
|
if (fileExtensionIsOneOf(name, supportedTSImplementationExtensions)) {
|
|
164110
164408
|
return { name, extension: tryGetExtensionFromPath2(name) };
|
|
164111
164409
|
}
|
|
164112
|
-
const outputExtension2 = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name,
|
|
164410
|
+
const outputExtension2 = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, program.getCompilerOptions());
|
|
164113
164411
|
return outputExtension2 ? { name: changeExtension(name, outputExtension2), extension: outputExtension2 } : { name, extension: tryGetExtensionFromPath2(name) };
|
|
164114
164412
|
}
|
|
164115
164413
|
if (!isExportsWildcard && (allowedEndings[0] === 0 /* Minimal */ || allowedEndings[0] === 1 /* Index */) && fileExtensionIsOneOf(name, [".js" /* Js */, ".jsx" /* Jsx */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */])) {
|
|
164116
164414
|
return { name: removeFileExtension(name), extension: tryGetExtensionFromPath2(name) };
|
|
164117
164415
|
}
|
|
164118
|
-
const outputExtension = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name,
|
|
164416
|
+
const outputExtension = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, program.getCompilerOptions());
|
|
164119
164417
|
return outputExtension ? { name: changeExtension(name, outputExtension), extension: outputExtension } : { name, extension: tryGetExtensionFromPath2(name) };
|
|
164120
164418
|
}
|
|
164121
|
-
function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensionOptions, host, paths) {
|
|
164419
|
+
function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensionOptions, program, host, paths) {
|
|
164122
164420
|
const getPatternsForKey = (key) => paths[key];
|
|
164123
164421
|
const comparePaths2 = (a, b) => {
|
|
164124
164422
|
const patternA = tryParsePattern(a);
|
|
@@ -164134,13 +164432,14 @@ function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensio
|
|
|
164134
164432
|
fragment,
|
|
164135
164433
|
baseDirectory,
|
|
164136
164434
|
extensionOptions,
|
|
164435
|
+
program,
|
|
164137
164436
|
host,
|
|
164138
164437
|
getOwnKeys(paths),
|
|
164139
164438
|
getPatternsForKey,
|
|
164140
164439
|
comparePaths2
|
|
164141
164440
|
);
|
|
164142
164441
|
}
|
|
164143
|
-
function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, baseDirectory, extensionOptions, host, keys, getPatternsForKey, comparePaths2) {
|
|
164442
|
+
function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, baseDirectory, extensionOptions, program, host, keys, getPatternsForKey, comparePaths2) {
|
|
164144
164443
|
let pathResults = [];
|
|
164145
164444
|
let matchedPath;
|
|
164146
164445
|
for (const key of keys) {
|
|
@@ -164161,7 +164460,7 @@ function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, bas
|
|
|
164161
164460
|
if (typeof pathPattern === "string" || matchedPath === void 0 || comparePaths2(key, matchedPath) !== 1 /* GreaterThan */) {
|
|
164162
164461
|
pathResults.push({
|
|
164163
164462
|
matchedPattern: isMatch,
|
|
164164
|
-
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))
|
|
164165
164464
|
});
|
|
164166
164465
|
}
|
|
164167
164466
|
}
|
|
@@ -164169,7 +164468,9 @@ function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, bas
|
|
|
164169
164468
|
pathResults.forEach((pathResult) => pathResult.results.forEach((r) => result.add(r)));
|
|
164170
164469
|
return matchedPath !== void 0;
|
|
164171
164470
|
}
|
|
164172
|
-
function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode,
|
|
164471
|
+
function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, program, host, extensionOptions) {
|
|
164472
|
+
const typeChecker = program.getTypeChecker();
|
|
164473
|
+
const compilerOptions = program.getCompilerOptions();
|
|
164173
164474
|
const { baseUrl, paths } = compilerOptions;
|
|
164174
164475
|
const result = createNameAndKindSet();
|
|
164175
164476
|
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
@@ -164179,6 +164480,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
164179
164480
|
fragment,
|
|
164180
164481
|
absolute,
|
|
164181
164482
|
extensionOptions,
|
|
164483
|
+
program,
|
|
164182
164484
|
host,
|
|
164183
164485
|
/*moduleSpecifierIsRelative*/
|
|
164184
164486
|
false,
|
|
@@ -164189,7 +164491,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
164189
164491
|
}
|
|
164190
164492
|
if (paths) {
|
|
164191
164493
|
const absolute = getPathsBasePath(compilerOptions, host);
|
|
164192
|
-
addCompletionEntriesFromPaths(result, fragment, absolute, extensionOptions, host, paths);
|
|
164494
|
+
addCompletionEntriesFromPaths(result, fragment, absolute, extensionOptions, program, host, paths);
|
|
164193
164495
|
}
|
|
164194
164496
|
const fragmentDirectory = getFragmentDirectory(fragment);
|
|
164195
164497
|
for (const ambientName of getAmbientModuleCompletions(fragment, fragmentDirectory, typeChecker)) {
|
|
@@ -164200,7 +164502,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
164200
164502
|
void 0
|
|
164201
164503
|
));
|
|
164202
164504
|
}
|
|
164203
|
-
getCompletionEntriesFromTypings(host,
|
|
164505
|
+
getCompletionEntriesFromTypings(host, program, scriptPath, fragmentDirectory, extensionOptions, result);
|
|
164204
164506
|
if (moduleResolutionUsesNodeModules(moduleResolution)) {
|
|
164205
164507
|
let foundGlobal = false;
|
|
164206
164508
|
if (fragmentDirectory === void 0) {
|
|
@@ -164225,6 +164527,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
164225
164527
|
fragment,
|
|
164226
164528
|
nodeModules,
|
|
164227
164529
|
extensionOptions,
|
|
164530
|
+
program,
|
|
164228
164531
|
host,
|
|
164229
164532
|
/*moduleSpecifierIsRelative*/
|
|
164230
164533
|
false,
|
|
@@ -164269,6 +164572,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
164269
164572
|
fragmentSubpath,
|
|
164270
164573
|
packageDirectory,
|
|
164271
164574
|
extensionOptions,
|
|
164575
|
+
program,
|
|
164272
164576
|
host,
|
|
164273
164577
|
keys,
|
|
164274
164578
|
(key) => singleElementArray(getPatternFromFirstMatchingCondition(exports2[key], conditions)),
|
|
@@ -164301,7 +164605,7 @@ function getPatternFromFirstMatchingCondition(target, conditions) {
|
|
|
164301
164605
|
function getFragmentDirectory(fragment) {
|
|
164302
164606
|
return containsSlash(fragment) ? hasTrailingDirectorySeparator(fragment) ? fragment : getDirectoryPath(fragment) : void 0;
|
|
164303
164607
|
}
|
|
164304
|
-
function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, isExportsWildcard, host) {
|
|
164608
|
+
function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, isExportsWildcard, program, host) {
|
|
164305
164609
|
if (!endsWith(path, "*")) {
|
|
164306
164610
|
return !path.includes("*") ? justPathMappingName(path, "script" /* scriptElement */) : emptyArray;
|
|
164307
164611
|
}
|
|
@@ -164311,15 +164615,15 @@ function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory
|
|
|
164311
164615
|
const starIsFullPathComponent = path[path.length - 2] === "/";
|
|
164312
164616
|
return starIsFullPathComponent ? justPathMappingName(pathPrefix, "directory" /* directory */) : flatMap(patterns, (pattern) => {
|
|
164313
164617
|
var _a;
|
|
164314
|
-
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 }));
|
|
164315
164619
|
});
|
|
164316
164620
|
}
|
|
164317
|
-
return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host));
|
|
164621
|
+
return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host));
|
|
164318
164622
|
function justPathMappingName(name, kind) {
|
|
164319
164623
|
return startsWith(name, fragment) ? [{ name: removeTrailingDirectorySeparator(name), kind, extension: void 0 }] : emptyArray;
|
|
164320
164624
|
}
|
|
164321
164625
|
}
|
|
164322
|
-
function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host) {
|
|
164626
|
+
function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host) {
|
|
164323
164627
|
if (!host.readDirectory) {
|
|
164324
164628
|
return void 0;
|
|
164325
164629
|
}
|
|
@@ -164352,7 +164656,7 @@ function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensio
|
|
|
164352
164656
|
if (containsSlash(trimmedWithPattern)) {
|
|
164353
164657
|
return directoryResult(getPathComponents(removeLeadingDirectorySeparator(trimmedWithPattern))[1]);
|
|
164354
164658
|
}
|
|
164355
|
-
const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern,
|
|
164659
|
+
const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern, program, extensionOptions, isExportsWildcard);
|
|
164356
164660
|
return nameAndKind(name, "script" /* scriptElement */, extension);
|
|
164357
164661
|
}
|
|
164358
164662
|
});
|
|
@@ -164380,7 +164684,8 @@ function getAmbientModuleCompletions(fragment, fragmentDirectory, checker) {
|
|
|
164380
164684
|
}
|
|
164381
164685
|
return nonRelativeModuleNames;
|
|
164382
164686
|
}
|
|
164383
|
-
function getTripleSlashReferenceCompletion(sourceFile, position,
|
|
164687
|
+
function getTripleSlashReferenceCompletion(sourceFile, position, program, host) {
|
|
164688
|
+
const compilerOptions = program.getCompilerOptions();
|
|
164384
164689
|
const token = getTokenAtPosition(sourceFile, position);
|
|
164385
164690
|
const commentRanges = getLeadingCommentRanges(sourceFile.text, token.pos);
|
|
164386
164691
|
const range = commentRanges && find(commentRanges, (commentRange) => position >= commentRange.pos && position <= commentRange.end);
|
|
@@ -164398,14 +164703,16 @@ function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions
|
|
|
164398
164703
|
toComplete,
|
|
164399
164704
|
scriptPath,
|
|
164400
164705
|
getExtensionOptions(compilerOptions, 0 /* Filename */, sourceFile),
|
|
164706
|
+
program,
|
|
164401
164707
|
host,
|
|
164402
164708
|
/*moduleSpecifierIsRelative*/
|
|
164403
164709
|
true,
|
|
164404
164710
|
sourceFile.path
|
|
164405
|
-
) : kind === "types" ? getCompletionEntriesFromTypings(host,
|
|
164711
|
+
) : kind === "types" ? getCompletionEntriesFromTypings(host, program, scriptPath, getFragmentDirectory(toComplete), getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile)) : Debug.fail();
|
|
164406
164712
|
return addReplacementSpans(toComplete, range.pos + prefix.length, arrayFrom(names.values()));
|
|
164407
164713
|
}
|
|
164408
|
-
function getCompletionEntriesFromTypings(host,
|
|
164714
|
+
function getCompletionEntriesFromTypings(host, program, scriptPath, fragmentDirectory, extensionOptions, result = createNameAndKindSet()) {
|
|
164715
|
+
const options = program.getCompilerOptions();
|
|
164409
164716
|
const seen = /* @__PURE__ */ new Map();
|
|
164410
164717
|
const typeRoots = tryAndIgnoreErrors(() => getEffectiveTypeRoots(options, host)) || emptyArray;
|
|
164411
164718
|
for (const root of typeRoots) {
|
|
@@ -164441,6 +164748,7 @@ function getCompletionEntriesFromTypings(host, options, scriptPath, fragmentDire
|
|
|
164441
164748
|
remainingFragment,
|
|
164442
164749
|
baseDirectory,
|
|
164443
164750
|
extensionOptions,
|
|
164751
|
+
program,
|
|
164444
164752
|
host,
|
|
164445
164753
|
/*moduleSpecifierIsRelative*/
|
|
164446
164754
|
false,
|
|
@@ -164827,7 +165135,7 @@ function findModuleReferences(program, sourceFiles, searchModuleSymbol) {
|
|
|
164827
165135
|
}
|
|
164828
165136
|
}
|
|
164829
165137
|
for (const ref of referencingFile.typeReferenceDirectives) {
|
|
164830
|
-
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;
|
|
164831
165139
|
if (referenced !== void 0 && referenced.resolvedFileName === searchSourceFile.fileName) {
|
|
164832
165140
|
refs.push({ kind: "reference", referencingFile, ref });
|
|
164833
165141
|
}
|
|
@@ -167190,7 +167498,7 @@ function getReferenceAtPosition(sourceFile, position, program) {
|
|
|
167190
167498
|
}
|
|
167191
167499
|
const typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position);
|
|
167192
167500
|
if (typeReferenceDirective) {
|
|
167193
|
-
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;
|
|
167194
167502
|
const file = reference && program.getSourceFile(reference.resolvedFileName);
|
|
167195
167503
|
return file && { reference: typeReferenceDirective, fileName: file.fileName, file, unverified: false };
|
|
167196
167504
|
}
|
|
@@ -175636,6 +175944,7 @@ __export(ts_exports2, {
|
|
|
175636
175944
|
canHaveJSDoc: () => canHaveJSDoc,
|
|
175637
175945
|
canHaveLocals: () => canHaveLocals,
|
|
175638
175946
|
canHaveModifiers: () => canHaveModifiers,
|
|
175947
|
+
canHaveModuleSpecifier: () => canHaveModuleSpecifier,
|
|
175639
175948
|
canHaveSymbol: () => canHaveSymbol,
|
|
175640
175949
|
canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
|
|
175641
175950
|
canProduceDiagnostics: () => canProduceDiagnostics,
|
|
@@ -176102,6 +176411,7 @@ __export(ts_exports2, {
|
|
|
176102
176411
|
getDefaultLibFileName: () => getDefaultLibFileName,
|
|
176103
176412
|
getDefaultLibFilePath: () => getDefaultLibFilePath,
|
|
176104
176413
|
getDefaultLikeExportInfo: () => getDefaultLikeExportInfo,
|
|
176414
|
+
getDefaultResolutionModeForFileWorker: () => getDefaultResolutionModeForFileWorker,
|
|
176105
176415
|
getDiagnosticText: () => getDiagnosticText,
|
|
176106
176416
|
getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
|
|
176107
176417
|
getDirectoryPath: () => getDirectoryPath,
|
|
@@ -176132,6 +176442,7 @@ __export(ts_exports2, {
|
|
|
176132
176442
|
getEmitFlags: () => getEmitFlags,
|
|
176133
176443
|
getEmitHelpers: () => getEmitHelpers,
|
|
176134
176444
|
getEmitModuleDetectionKind: () => getEmitModuleDetectionKind,
|
|
176445
|
+
getEmitModuleFormatOfFileWorker: () => getEmitModuleFormatOfFileWorker,
|
|
176135
176446
|
getEmitModuleKind: () => getEmitModuleKind,
|
|
176136
176447
|
getEmitModuleResolutionKind: () => getEmitModuleResolutionKind,
|
|
176137
176448
|
getEmitScriptTarget: () => getEmitScriptTarget,
|
|
@@ -176182,6 +176493,7 @@ __export(ts_exports2, {
|
|
|
176182
176493
|
getIdentifierGeneratedImportReference: () => getIdentifierGeneratedImportReference,
|
|
176183
176494
|
getIdentifierTypeArguments: () => getIdentifierTypeArguments,
|
|
176184
176495
|
getImmediatelyInvokedFunctionExpression: () => getImmediatelyInvokedFunctionExpression,
|
|
176496
|
+
getImpliedNodeFormatForEmitWorker: () => getImpliedNodeFormatForEmitWorker,
|
|
176185
176497
|
getImpliedNodeFormatForFile: () => getImpliedNodeFormatForFile,
|
|
176186
176498
|
getImpliedNodeFormatForFileWorker: () => getImpliedNodeFormatForFileWorker,
|
|
176187
176499
|
getImportNeedsImportDefaultHelper: () => getImportNeedsImportDefaultHelper,
|
|
@@ -176537,6 +176849,7 @@ __export(ts_exports2, {
|
|
|
176537
176849
|
importDefaultHelper: () => importDefaultHelper,
|
|
176538
176850
|
importFromModuleSpecifier: () => importFromModuleSpecifier,
|
|
176539
176851
|
importStarHelper: () => importStarHelper,
|
|
176852
|
+
importSyntaxAffectsModuleResolution: () => importSyntaxAffectsModuleResolution,
|
|
176540
176853
|
indexOfAnyCharCode: () => indexOfAnyCharCode,
|
|
176541
176854
|
indexOfNode: () => indexOfNode,
|
|
176542
176855
|
indicesOf: () => indicesOf,
|
|
@@ -177626,11 +177939,11 @@ __export(ts_exports2, {
|
|
|
177626
177939
|
transformESDecorators: () => transformESDecorators,
|
|
177627
177940
|
transformESNext: () => transformESNext,
|
|
177628
177941
|
transformGenerators: () => transformGenerators,
|
|
177942
|
+
transformImpliedNodeFormatDependentModule: () => transformImpliedNodeFormatDependentModule,
|
|
177629
177943
|
transformJsx: () => transformJsx,
|
|
177630
177944
|
transformLegacyDecorators: () => transformLegacyDecorators,
|
|
177631
177945
|
transformModule: () => transformModule,
|
|
177632
177946
|
transformNamedEvaluation: () => transformNamedEvaluation,
|
|
177633
|
-
transformNodeModule: () => transformNodeModule,
|
|
177634
177947
|
transformNodes: () => transformNodes,
|
|
177635
177948
|
transformSystemModule: () => transformSystemModule,
|
|
177636
177949
|
transformTypeScript: () => transformTypeScript,
|
|
@@ -177938,6 +178251,7 @@ __export(ts_server_exports3, {
|
|
|
177938
178251
|
isExternalProject: () => isExternalProject,
|
|
177939
178252
|
isInferredProject: () => isInferredProject,
|
|
177940
178253
|
isInferredProjectName: () => isInferredProjectName,
|
|
178254
|
+
isProjectDeferredClose: () => isProjectDeferredClose,
|
|
177941
178255
|
makeAutoImportProviderProjectName: () => makeAutoImportProviderProjectName,
|
|
177942
178256
|
makeAuxiliaryProjectName: () => makeAuxiliaryProjectName,
|
|
177943
178257
|
makeInferredProjectName: () => makeInferredProjectName,
|
|
@@ -178851,6 +179165,9 @@ var TextStorage = class {
|
|
|
178851
179165
|
const reloaded = this.reload(newText);
|
|
178852
179166
|
this.fileSize = fileSize;
|
|
178853
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
|
+
}
|
|
178854
179171
|
return reloaded;
|
|
178855
179172
|
}
|
|
178856
179173
|
/**
|
|
@@ -179129,7 +179446,9 @@ var ScriptInfo = class {
|
|
|
179129
179446
|
case 0:
|
|
179130
179447
|
return Errors.ThrowNoProject();
|
|
179131
179448
|
case 1:
|
|
179132
|
-
return ensurePrimaryProjectKind(
|
|
179449
|
+
return ensurePrimaryProjectKind(
|
|
179450
|
+
!isProjectDeferredClose(this.containingProjects[0]) ? this.containingProjects[0] : void 0
|
|
179451
|
+
);
|
|
179133
179452
|
default:
|
|
179134
179453
|
let firstExternalProject;
|
|
179135
179454
|
let firstConfiguredProject;
|
|
@@ -179139,6 +179458,8 @@ var ScriptInfo = class {
|
|
|
179139
179458
|
for (let index = 0; index < this.containingProjects.length; index++) {
|
|
179140
179459
|
const project = this.containingProjects[index];
|
|
179141
179460
|
if (isConfiguredProject(project)) {
|
|
179461
|
+
if (project.deferredClose)
|
|
179462
|
+
continue;
|
|
179142
179463
|
if (!project.isSourceOfProjectReferenceRedirect(this.fileName)) {
|
|
179143
179464
|
if (defaultConfiguredProject === void 0 && index !== this.containingProjects.length - 1) {
|
|
179144
179465
|
defaultConfiguredProject = project.projectService.findDefaultConfiguredProject(this) || false;
|
|
@@ -179212,7 +179533,7 @@ var ScriptInfo = class {
|
|
|
179212
179533
|
}
|
|
179213
179534
|
}
|
|
179214
179535
|
isOrphan() {
|
|
179215
|
-
return !forEach(this.containingProjects, (p) => !p.isOrphan());
|
|
179536
|
+
return this.deferredDelete || !forEach(this.containingProjects, (p) => !p.isOrphan());
|
|
179216
179537
|
}
|
|
179217
179538
|
/** @internal */
|
|
179218
179539
|
isContainedByBackgroundProject() {
|
|
@@ -179658,7 +179979,13 @@ var Project3 = class _Project {
|
|
|
179658
179979
|
return addRange(result, this.typingFiles) || emptyArray;
|
|
179659
179980
|
}
|
|
179660
179981
|
getOrCreateScriptInfoAndAttachToProject(fileName) {
|
|
179661
|
-
const scriptInfo = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
|
|
179982
|
+
const scriptInfo = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
|
|
179983
|
+
fileName,
|
|
179984
|
+
this.currentDirectory,
|
|
179985
|
+
this.directoryStructureHost,
|
|
179986
|
+
/*deferredDeleteOk*/
|
|
179987
|
+
false
|
|
179988
|
+
);
|
|
179662
179989
|
if (scriptInfo) {
|
|
179663
179990
|
const existingValue = this.rootFilesMap.get(scriptInfo.path);
|
|
179664
179991
|
if (existingValue && existingValue.info !== scriptInfo) {
|
|
@@ -179674,7 +180001,13 @@ var Project3 = class _Project {
|
|
|
179674
180001
|
return info && info.scriptKind;
|
|
179675
180002
|
}
|
|
179676
180003
|
getScriptVersion(filename) {
|
|
179677
|
-
const info = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
|
|
180004
|
+
const info = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
|
|
180005
|
+
filename,
|
|
180006
|
+
this.currentDirectory,
|
|
180007
|
+
this.directoryStructureHost,
|
|
180008
|
+
/*deferredDeleteOk*/
|
|
180009
|
+
false
|
|
180010
|
+
);
|
|
179678
180011
|
return info && info.getLatestVersion();
|
|
179679
180012
|
}
|
|
179680
180013
|
getScriptSnapshot(filename) {
|
|
@@ -180206,6 +180539,7 @@ var Project3 = class _Project {
|
|
|
180206
180539
|
(this.changedFilesForExportMapCache || (this.changedFilesForExportMapCache = /* @__PURE__ */ new Set())).add(changedFile);
|
|
180207
180540
|
}
|
|
180208
180541
|
}
|
|
180542
|
+
/** @internal */
|
|
180209
180543
|
markAsDirty() {
|
|
180210
180544
|
if (!this.dirty) {
|
|
180211
180545
|
this.projectStateVersion++;
|
|
@@ -180506,7 +180840,13 @@ var Project3 = class _Project {
|
|
|
180506
180840
|
// by the host for files in the program when the program is retrieved above but
|
|
180507
180841
|
// the program doesn't contain external files so this must be done explicitly.
|
|
180508
180842
|
(inserted) => {
|
|
180509
|
-
const scriptInfo = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
|
|
180843
|
+
const scriptInfo = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
|
|
180844
|
+
inserted,
|
|
180845
|
+
this.currentDirectory,
|
|
180846
|
+
this.directoryStructureHost,
|
|
180847
|
+
/*deferredDeleteOk*/
|
|
180848
|
+
false
|
|
180849
|
+
);
|
|
180510
180850
|
scriptInfo == null ? void 0 : scriptInfo.attachToProject(this);
|
|
180511
180851
|
},
|
|
180512
180852
|
(removed) => this.detachScriptInfoFromProject(removed)
|
|
@@ -181336,6 +181676,7 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
|
|
|
181336
181676
|
isEmpty() {
|
|
181337
181677
|
return !some(this.rootFileNames);
|
|
181338
181678
|
}
|
|
181679
|
+
/** @internal */
|
|
181339
181680
|
isOrphan() {
|
|
181340
181681
|
return true;
|
|
181341
181682
|
}
|
|
@@ -181366,6 +181707,7 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
|
|
|
181366
181707
|
var _a;
|
|
181367
181708
|
return !!((_a = this.rootFileNames) == null ? void 0 : _a.length);
|
|
181368
181709
|
}
|
|
181710
|
+
/** @internal */
|
|
181369
181711
|
markAsDirty() {
|
|
181370
181712
|
this.rootFileNames = void 0;
|
|
181371
181713
|
super.markAsDirty();
|
|
@@ -181489,6 +181831,8 @@ var ConfiguredProject2 = class extends Project3 {
|
|
|
181489
181831
|
* @returns: true if set of files in the project stays the same and false - otherwise.
|
|
181490
181832
|
*/
|
|
181491
181833
|
updateGraph() {
|
|
181834
|
+
if (this.deferredClose)
|
|
181835
|
+
return false;
|
|
181492
181836
|
const isInitialLoad = this.isInitialLoadPending();
|
|
181493
181837
|
this.isInitialLoadPending = returnFalse;
|
|
181494
181838
|
const updateLevel = this.pendingUpdateLevel;
|
|
@@ -181603,6 +181947,12 @@ var ConfiguredProject2 = class extends Project3 {
|
|
|
181603
181947
|
super.close();
|
|
181604
181948
|
}
|
|
181605
181949
|
/** @internal */
|
|
181950
|
+
markAsDirty() {
|
|
181951
|
+
if (this.deferredClose)
|
|
181952
|
+
return;
|
|
181953
|
+
super.markAsDirty();
|
|
181954
|
+
}
|
|
181955
|
+
/** @internal */
|
|
181606
181956
|
addExternalProjectReference() {
|
|
181607
181957
|
this.externalProjectRefCount++;
|
|
181608
181958
|
}
|
|
@@ -181633,7 +181983,7 @@ var ConfiguredProject2 = class extends Project3 {
|
|
|
181633
181983
|
* @internal
|
|
181634
181984
|
*/
|
|
181635
181985
|
hasOpenRef() {
|
|
181636
|
-
var _a;
|
|
181986
|
+
var _a, _b;
|
|
181637
181987
|
if (!!this.externalProjectRefCount) {
|
|
181638
181988
|
return true;
|
|
181639
181989
|
}
|
|
@@ -181641,8 +181991,10 @@ var ConfiguredProject2 = class extends Project3 {
|
|
|
181641
181991
|
return false;
|
|
181642
181992
|
}
|
|
181643
181993
|
const configFileExistenceInfo = this.projectService.configFileExistenceInfoCache.get(this.canonicalConfigFilePath);
|
|
181644
|
-
if (this.
|
|
181994
|
+
if (this.deferredClose)
|
|
181645
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);
|
|
181646
181998
|
}
|
|
181647
181999
|
return !!configFileExistenceInfo.openFilesImpactedByConfigFile && forEachEntry(
|
|
181648
182000
|
configFileExistenceInfo.openFilesImpactedByConfigFile,
|
|
@@ -181658,6 +182010,10 @@ var ConfiguredProject2 = class extends Project3 {
|
|
|
181658
182010
|
) || false;
|
|
181659
182011
|
}
|
|
181660
182012
|
/** @internal */
|
|
182013
|
+
isOrphan() {
|
|
182014
|
+
return !!this.deferredClose;
|
|
182015
|
+
}
|
|
182016
|
+
/** @internal */
|
|
181661
182017
|
hasExternalProjectRef() {
|
|
181662
182018
|
return !!this.externalProjectRefCount;
|
|
181663
182019
|
}
|
|
@@ -181712,6 +182068,9 @@ function isExternalProject(project) {
|
|
|
181712
182068
|
function isBackgroundProject(project) {
|
|
181713
182069
|
return project.projectKind === 3 /* AutoImportProvider */ || project.projectKind === 4 /* Auxiliary */;
|
|
181714
182070
|
}
|
|
182071
|
+
function isProjectDeferredClose(project) {
|
|
182072
|
+
return isConfiguredProject(project) && !!project.deferredClose;
|
|
182073
|
+
}
|
|
181715
182074
|
|
|
181716
182075
|
// src/server/editorServices.ts
|
|
181717
182076
|
var maxProgramSizeForNonTsFiles = 20 * 1024 * 1024;
|
|
@@ -182340,6 +182699,8 @@ var _ProjectService = class _ProjectService {
|
|
|
182340
182699
|
);
|
|
182341
182700
|
}
|
|
182342
182701
|
delayUpdateProjectGraph(project) {
|
|
182702
|
+
if (isProjectDeferredClose(project))
|
|
182703
|
+
return;
|
|
182343
182704
|
project.markAsDirty();
|
|
182344
182705
|
if (isBackgroundProject(project))
|
|
182345
182706
|
return;
|
|
@@ -182537,9 +182898,16 @@ var _ProjectService = class _ProjectService {
|
|
|
182537
182898
|
return this.hostConfiguration.preferences;
|
|
182538
182899
|
}
|
|
182539
182900
|
onSourceFileChanged(info, eventKind) {
|
|
182901
|
+
Debug.assert(!info.isScriptOpen());
|
|
182540
182902
|
if (eventKind === 2 /* Deleted */) {
|
|
182541
|
-
this.handleDeletedFile(
|
|
182542
|
-
|
|
182903
|
+
this.handleDeletedFile(
|
|
182904
|
+
info,
|
|
182905
|
+
/*deferredDelete*/
|
|
182906
|
+
true
|
|
182907
|
+
);
|
|
182908
|
+
} else {
|
|
182909
|
+
if (info.deferredDelete)
|
|
182910
|
+
info.deferredDelete = void 0;
|
|
182543
182911
|
info.delayReloadNonMixedContentFile();
|
|
182544
182912
|
this.delayUpdateProjectGraphs(
|
|
182545
182913
|
info.containingProjects,
|
|
@@ -182553,7 +182921,7 @@ var _ProjectService = class _ProjectService {
|
|
|
182553
182921
|
if (info.sourceMapFilePath) {
|
|
182554
182922
|
if (isString(info.sourceMapFilePath)) {
|
|
182555
182923
|
const sourceMapFileInfo = this.getScriptInfoForPath(info.sourceMapFilePath);
|
|
182556
|
-
this.delayUpdateSourceInfoProjects(sourceMapFileInfo
|
|
182924
|
+
this.delayUpdateSourceInfoProjects(sourceMapFileInfo == null ? void 0 : sourceMapFileInfo.sourceInfos);
|
|
182557
182925
|
} else {
|
|
182558
182926
|
this.delayUpdateSourceInfoProjects(info.sourceMapFilePath.sourceInfos);
|
|
182559
182927
|
}
|
|
@@ -182578,25 +182946,20 @@ var _ProjectService = class _ProjectService {
|
|
|
182578
182946
|
);
|
|
182579
182947
|
}
|
|
182580
182948
|
}
|
|
182581
|
-
handleDeletedFile(info) {
|
|
182582
|
-
|
|
182583
|
-
|
|
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 {
|
|
182584
182962
|
this.deleteScriptInfo(info);
|
|
182585
|
-
const containingProjects = info.containingProjects.slice();
|
|
182586
|
-
info.detachAllProjects();
|
|
182587
|
-
this.delayUpdateProjectGraphs(
|
|
182588
|
-
containingProjects,
|
|
182589
|
-
/*clearSourceMapperCache*/
|
|
182590
|
-
false
|
|
182591
|
-
);
|
|
182592
|
-
this.handleSourceMapProjects(info);
|
|
182593
|
-
info.closeSourceMapFileWatcher();
|
|
182594
|
-
if (info.declarationInfoPath) {
|
|
182595
|
-
const declarationInfo = this.getScriptInfoForPath(info.declarationInfoPath);
|
|
182596
|
-
if (declarationInfo) {
|
|
182597
|
-
declarationInfo.sourceMapFilePath = void 0;
|
|
182598
|
-
}
|
|
182599
|
-
}
|
|
182600
182963
|
}
|
|
182601
182964
|
}
|
|
182602
182965
|
/**
|
|
@@ -182707,24 +183070,24 @@ var _ProjectService = class _ProjectService {
|
|
|
182707
183070
|
}
|
|
182708
183071
|
/** @internal */
|
|
182709
183072
|
onConfigFileChanged(canonicalConfigFilePath, eventKind) {
|
|
182710
|
-
var _a;
|
|
182711
183073
|
const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
|
|
183074
|
+
const project = this.getConfiguredProjectByCanonicalConfigFilePath(canonicalConfigFilePath);
|
|
183075
|
+
const wasDefferedClose = project == null ? void 0 : project.deferredClose;
|
|
182712
183076
|
if (eventKind === 2 /* Deleted */) {
|
|
182713
183077
|
configFileExistenceInfo.exists = false;
|
|
182714
|
-
const project = ((_a = configFileExistenceInfo.config) == null ? void 0 : _a.projects.has(canonicalConfigFilePath)) ? this.getConfiguredProjectByCanonicalConfigFilePath(canonicalConfigFilePath) : void 0;
|
|
182715
183078
|
if (project)
|
|
182716
|
-
|
|
183079
|
+
project.deferredClose = true;
|
|
182717
183080
|
} else {
|
|
182718
183081
|
configFileExistenceInfo.exists = true;
|
|
183082
|
+
if (wasDefferedClose) {
|
|
183083
|
+
project.deferredClose = void 0;
|
|
183084
|
+
project.markAsDirty();
|
|
183085
|
+
}
|
|
182719
183086
|
}
|
|
182720
183087
|
this.delayUpdateProjectsFromParsedConfigOnConfigFileChange(canonicalConfigFilePath, "Change in config file detected");
|
|
182721
|
-
this.
|
|
182722
|
-
configFileExistenceInfo
|
|
182723
|
-
/*
|
|
182724
|
-
false,
|
|
182725
|
-
/*delayReload*/
|
|
182726
|
-
true,
|
|
182727
|
-
eventKind !== 2 /* Deleted */ ? identity : (
|
|
183088
|
+
this.delayReloadConfiguredProjectsForFile(
|
|
183089
|
+
configFileExistenceInfo,
|
|
183090
|
+
!wasDefferedClose && eventKind !== 2 /* Deleted */ ? identity : (
|
|
182728
183091
|
// Reload open files if they are root of inferred project
|
|
182729
183092
|
returnTrue
|
|
182730
183093
|
),
|
|
@@ -182733,6 +183096,33 @@ var _ProjectService = class _ProjectService {
|
|
|
182733
183096
|
);
|
|
182734
183097
|
this.delayEnsureProjectForOpenFiles();
|
|
182735
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
|
+
}
|
|
182736
183126
|
removeProject(project) {
|
|
182737
183127
|
this.logger.info("`remove Project::");
|
|
182738
183128
|
project.print(
|
|
@@ -182876,17 +183266,24 @@ var _ProjectService = class _ProjectService {
|
|
|
182876
183266
|
if (fileExists) {
|
|
182877
183267
|
this.watchClosedScriptInfo(info);
|
|
182878
183268
|
} else {
|
|
182879
|
-
this.handleDeletedFile(
|
|
183269
|
+
this.handleDeletedFile(
|
|
183270
|
+
info,
|
|
183271
|
+
/*deferredDelete*/
|
|
183272
|
+
false
|
|
183273
|
+
);
|
|
182880
183274
|
}
|
|
182881
183275
|
return ensureProjectsForOpenFiles;
|
|
182882
183276
|
}
|
|
182883
183277
|
deleteScriptInfo(info) {
|
|
183278
|
+
Debug.assert(!info.isScriptOpen());
|
|
182884
183279
|
this.filenameToScriptInfo.delete(info.path);
|
|
182885
183280
|
this.filenameToScriptInfoVersion.set(info.path, info.textStorage.version);
|
|
183281
|
+
this.stopWatchingScriptInfo(info);
|
|
182886
183282
|
const realpath = info.getRealpathIfDifferent();
|
|
182887
183283
|
if (realpath) {
|
|
182888
183284
|
this.realpathToScriptInfos.remove(realpath, info);
|
|
182889
183285
|
}
|
|
183286
|
+
info.closeSourceMapFileWatcher();
|
|
182890
183287
|
}
|
|
182891
183288
|
configFileExists(configFileName, canonicalConfigFilePath, info) {
|
|
182892
183289
|
var _a;
|
|
@@ -183126,7 +183523,8 @@ var _ProjectService = class _ProjectService {
|
|
|
183126
183523
|
/** @internal */
|
|
183127
183524
|
findConfiguredProjectByProjectName(configFileName) {
|
|
183128
183525
|
const canonicalConfigFilePath = asNormalizedPath(this.toCanonicalFileName(configFileName));
|
|
183129
|
-
|
|
183526
|
+
const result = this.getConfiguredProjectByCanonicalConfigFilePath(canonicalConfigFilePath);
|
|
183527
|
+
return !(result == null ? void 0 : result.deferredClose) ? result : void 0;
|
|
183130
183528
|
}
|
|
183131
183529
|
getConfiguredProjectByCanonicalConfigFilePath(canonicalConfigFilePath) {
|
|
183132
183530
|
return this.configuredProjects.get(canonicalConfigFilePath);
|
|
@@ -183256,6 +183654,7 @@ var _ProjectService = class _ProjectService {
|
|
|
183256
183654
|
this.documentRegistry,
|
|
183257
183655
|
configFileExistenceInfo.config.cachedDirectoryStructureHost
|
|
183258
183656
|
);
|
|
183657
|
+
Debug.assert(!this.configuredProjects.has(canonicalConfigFilePath));
|
|
183259
183658
|
this.configuredProjects.set(canonicalConfigFilePath, project);
|
|
183260
183659
|
this.createConfigFileWatcherForParsedConfig(configFileName, canonicalConfigFilePath, project);
|
|
183261
183660
|
return project;
|
|
@@ -183484,7 +183883,9 @@ var _ProjectService = class _ProjectService {
|
|
|
183484
183883
|
project.currentDirectory,
|
|
183485
183884
|
scriptKind,
|
|
183486
183885
|
hasMixedContent,
|
|
183487
|
-
project.directoryStructureHost
|
|
183886
|
+
project.directoryStructureHost,
|
|
183887
|
+
/*deferredDeleteOk*/
|
|
183888
|
+
false
|
|
183488
183889
|
));
|
|
183489
183890
|
path = scriptInfo.path;
|
|
183490
183891
|
const existingValue = projectRootFilesMap.get(path);
|
|
@@ -183679,7 +184080,7 @@ var _ProjectService = class _ProjectService {
|
|
|
183679
184080
|
return project;
|
|
183680
184081
|
}
|
|
183681
184082
|
/** @internal */
|
|
183682
|
-
getOrCreateScriptInfoNotOpenedByClient(uncheckedFileName, currentDirectory, hostToQueryFileExistsOn) {
|
|
184083
|
+
getOrCreateScriptInfoNotOpenedByClient(uncheckedFileName, currentDirectory, hostToQueryFileExistsOn, deferredDeleteOk) {
|
|
183683
184084
|
return this.getOrCreateScriptInfoNotOpenedByClientForNormalizedPath(
|
|
183684
184085
|
toNormalizedPath(uncheckedFileName),
|
|
183685
184086
|
currentDirectory,
|
|
@@ -183687,7 +184088,8 @@ var _ProjectService = class _ProjectService {
|
|
|
183687
184088
|
void 0,
|
|
183688
184089
|
/*hasMixedContent*/
|
|
183689
184090
|
void 0,
|
|
183690
|
-
hostToQueryFileExistsOn
|
|
184091
|
+
hostToQueryFileExistsOn,
|
|
184092
|
+
deferredDeleteOk
|
|
183691
184093
|
);
|
|
183692
184094
|
}
|
|
183693
184095
|
getScriptInfo(uncheckedFileName) {
|
|
@@ -183704,7 +184106,13 @@ var _ProjectService = class _ProjectService {
|
|
|
183704
184106
|
}
|
|
183705
184107
|
/** @internal */
|
|
183706
184108
|
logErrorForScriptInfoNotFound(fileName) {
|
|
183707
|
-
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
|
+
);
|
|
183708
184116
|
this.logger.msg(`Could not find file ${JSON.stringify(fileName)}.
|
|
183709
184117
|
All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
183710
184118
|
}
|
|
@@ -183776,7 +184184,7 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
183776
184184
|
if (dirPath === fileOrDirectoryPath) {
|
|
183777
184185
|
this.refreshScriptInfosInDirectory(dirPath);
|
|
183778
184186
|
} else {
|
|
183779
|
-
const info = this.
|
|
184187
|
+
const info = this.filenameToScriptInfo.get(fileOrDirectoryPath);
|
|
183780
184188
|
if (info) {
|
|
183781
184189
|
if (isScriptInfoWatchedFromNodeModules(info)) {
|
|
183782
184190
|
this.refreshScriptInfo(info);
|
|
@@ -183858,7 +184266,7 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
183858
184266
|
info.fileWatcher = void 0;
|
|
183859
184267
|
}
|
|
183860
184268
|
}
|
|
183861
|
-
getOrCreateScriptInfoNotOpenedByClientForNormalizedPath(fileName, currentDirectory, scriptKind, hasMixedContent, hostToQueryFileExistsOn) {
|
|
184269
|
+
getOrCreateScriptInfoNotOpenedByClientForNormalizedPath(fileName, currentDirectory, scriptKind, hasMixedContent, hostToQueryFileExistsOn, deferredDeleteOk) {
|
|
183862
184270
|
if (isRootedDiskPath(fileName) || isDynamicFileName(fileName)) {
|
|
183863
184271
|
return this.getOrCreateScriptInfoWorker(
|
|
183864
184272
|
fileName,
|
|
@@ -183868,8 +184276,9 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
183868
184276
|
/*fileContent*/
|
|
183869
184277
|
void 0,
|
|
183870
184278
|
scriptKind,
|
|
183871
|
-
hasMixedContent,
|
|
183872
|
-
hostToQueryFileExistsOn
|
|
184279
|
+
!!hasMixedContent,
|
|
184280
|
+
hostToQueryFileExistsOn,
|
|
184281
|
+
deferredDeleteOk
|
|
183873
184282
|
);
|
|
183874
184283
|
}
|
|
183875
184284
|
const info = this.openFilesWithNonRootedDiskPath.get(this.toCanonicalFileName(fileName));
|
|
@@ -183878,24 +184287,23 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
183878
184287
|
}
|
|
183879
184288
|
return void 0;
|
|
183880
184289
|
}
|
|
183881
|
-
|
|
184290
|
+
getOrCreateScriptInfoForNormalizedPath(fileName, openedByClient, fileContent, scriptKind, hasMixedContent, hostToQueryFileExistsOn) {
|
|
183882
184291
|
return this.getOrCreateScriptInfoWorker(
|
|
183883
184292
|
fileName,
|
|
183884
|
-
currentDirectory,
|
|
183885
|
-
|
|
183886
|
-
true,
|
|
184293
|
+
this.currentDirectory,
|
|
184294
|
+
openedByClient,
|
|
183887
184295
|
fileContent,
|
|
183888
184296
|
scriptKind,
|
|
183889
|
-
hasMixedContent
|
|
184297
|
+
!!hasMixedContent,
|
|
184298
|
+
hostToQueryFileExistsOn,
|
|
184299
|
+
/*deferredDeleteOk*/
|
|
184300
|
+
false
|
|
183890
184301
|
);
|
|
183891
184302
|
}
|
|
183892
|
-
|
|
183893
|
-
return this.getOrCreateScriptInfoWorker(fileName, this.currentDirectory, openedByClient, fileContent, scriptKind, hasMixedContent, hostToQueryFileExistsOn);
|
|
183894
|
-
}
|
|
183895
|
-
getOrCreateScriptInfoWorker(fileName, currentDirectory, openedByClient, fileContent, scriptKind, hasMixedContent, hostToQueryFileExistsOn) {
|
|
184303
|
+
getOrCreateScriptInfoWorker(fileName, currentDirectory, openedByClient, fileContent, scriptKind, hasMixedContent, hostToQueryFileExistsOn, deferredDeleteOk) {
|
|
183896
184304
|
Debug.assert(fileContent === void 0 || openedByClient, "ScriptInfo needs to be opened by client to be able to set its user defined content");
|
|
183897
184305
|
const path = normalizedPathToPath(fileName, currentDirectory, this.toCanonicalFileName);
|
|
183898
|
-
let info = this.
|
|
184306
|
+
let info = this.filenameToScriptInfo.get(path);
|
|
183899
184307
|
if (!info) {
|
|
183900
184308
|
const isDynamic = isDynamicFileName(fileName);
|
|
183901
184309
|
Debug.assert(isRootedDiskPath(fileName) || isDynamic || openedByClient, "", () => `${JSON.stringify({ fileName, currentDirectory, hostCurrentDirectory: this.currentDirectory, openKeys: arrayFrom(this.openFilesWithNonRootedDiskPath.keys()) })}
|
|
@@ -183907,7 +184315,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183907
184315
|
if (!openedByClient && !isDynamic && !(hostToQueryFileExistsOn || this.host).fileExists(fileName)) {
|
|
183908
184316
|
return;
|
|
183909
184317
|
}
|
|
183910
|
-
info = new ScriptInfo(this.host, fileName, scriptKind,
|
|
184318
|
+
info = new ScriptInfo(this.host, fileName, scriptKind, hasMixedContent, path, this.filenameToScriptInfoVersion.get(path));
|
|
183911
184319
|
this.filenameToScriptInfo.set(info.path, info);
|
|
183912
184320
|
this.filenameToScriptInfoVersion.delete(info.path);
|
|
183913
184321
|
if (!openedByClient) {
|
|
@@ -183915,6 +184323,12 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183915
184323
|
} else if (!isRootedDiskPath(fileName) && (!isDynamic || this.currentDirectory !== currentDirectory)) {
|
|
183916
184324
|
this.openFilesWithNonRootedDiskPath.set(this.toCanonicalFileName(fileName), info);
|
|
183917
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;
|
|
183918
184332
|
}
|
|
183919
184333
|
if (openedByClient) {
|
|
183920
184334
|
this.stopWatchingScriptInfo(info);
|
|
@@ -183932,11 +184346,18 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183932
184346
|
return !isRootedDiskPath(fileName) && this.openFilesWithNonRootedDiskPath.get(this.toCanonicalFileName(fileName)) || this.getScriptInfoForPath(normalizedPathToPath(fileName, this.currentDirectory, this.toCanonicalFileName));
|
|
183933
184347
|
}
|
|
183934
184348
|
getScriptInfoForPath(fileName) {
|
|
183935
|
-
|
|
184349
|
+
const info = this.filenameToScriptInfo.get(fileName);
|
|
184350
|
+
return !info || !info.deferredDelete ? info : void 0;
|
|
183936
184351
|
}
|
|
183937
184352
|
/** @internal */
|
|
183938
184353
|
getDocumentPositionMapper(project, generatedFileName, sourceFileName) {
|
|
183939
|
-
const declarationInfo = this.getOrCreateScriptInfoNotOpenedByClient(
|
|
184354
|
+
const declarationInfo = this.getOrCreateScriptInfoNotOpenedByClient(
|
|
184355
|
+
generatedFileName,
|
|
184356
|
+
project.currentDirectory,
|
|
184357
|
+
this.host,
|
|
184358
|
+
/*deferredDeleteOk*/
|
|
184359
|
+
false
|
|
184360
|
+
);
|
|
183940
184361
|
if (!declarationInfo) {
|
|
183941
184362
|
if (sourceFileName) {
|
|
183942
184363
|
project.addGeneratedFileWatch(generatedFileName, sourceFileName);
|
|
@@ -183961,14 +184382,17 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183961
184382
|
return void 0;
|
|
183962
184383
|
}
|
|
183963
184384
|
let sourceMapFileInfo;
|
|
183964
|
-
let mapFileNameFromDeclarationInfo;
|
|
183965
184385
|
let readMapFile = (mapFileName, mapFileNameFromDts) => {
|
|
183966
|
-
const mapInfo = this.getOrCreateScriptInfoNotOpenedByClient(
|
|
183967
|
-
|
|
183968
|
-
|
|
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)
|
|
183969
184395
|
return void 0;
|
|
183970
|
-
}
|
|
183971
|
-
sourceMapFileInfo = mapInfo;
|
|
183972
184396
|
const snap = mapInfo.getSnapshot();
|
|
183973
184397
|
if (mapInfo.documentPositionMapper !== void 0)
|
|
183974
184398
|
return mapInfo.documentPositionMapper;
|
|
@@ -183983,18 +184407,21 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183983
184407
|
);
|
|
183984
184408
|
readMapFile = void 0;
|
|
183985
184409
|
if (sourceMapFileInfo) {
|
|
183986
|
-
|
|
183987
|
-
|
|
183988
|
-
|
|
183989
|
-
|
|
183990
|
-
|
|
183991
|
-
|
|
183992
|
-
|
|
183993
|
-
|
|
183994
|
-
|
|
183995
|
-
|
|
183996
|
-
|
|
183997
|
-
|
|
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
|
+
}
|
|
183998
184425
|
} else {
|
|
183999
184426
|
declarationInfo.sourceMapFilePath = false;
|
|
184000
184427
|
}
|
|
@@ -184002,7 +184429,13 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184002
184429
|
}
|
|
184003
184430
|
addSourceInfoToSourceMap(sourceFileName, project, sourceInfos) {
|
|
184004
184431
|
if (sourceFileName) {
|
|
184005
|
-
const sourceInfo = this.getOrCreateScriptInfoNotOpenedByClient(
|
|
184432
|
+
const sourceInfo = this.getOrCreateScriptInfoNotOpenedByClient(
|
|
184433
|
+
sourceFileName,
|
|
184434
|
+
project.currentDirectory,
|
|
184435
|
+
project.directoryStructureHost,
|
|
184436
|
+
/*deferredDeleteOk*/
|
|
184437
|
+
false
|
|
184438
|
+
);
|
|
184006
184439
|
(sourceInfos || (sourceInfos = /* @__PURE__ */ new Set())).add(sourceInfo.path);
|
|
184007
184440
|
}
|
|
184008
184441
|
return sourceInfos;
|
|
@@ -184037,13 +184470,19 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184037
184470
|
if (sourceFile && sourceFile.resolvedPath === path)
|
|
184038
184471
|
return sourceFile;
|
|
184039
184472
|
}
|
|
184040
|
-
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
|
+
);
|
|
184041
184480
|
if (!info)
|
|
184042
184481
|
return void 0;
|
|
184043
184482
|
if (declarationInfo && isString(declarationInfo.sourceMapFilePath) && info !== declarationInfo) {
|
|
184044
184483
|
const sourceMapInfo = this.getScriptInfoForPath(declarationInfo.sourceMapFilePath);
|
|
184045
184484
|
if (sourceMapInfo) {
|
|
184046
|
-
(sourceMapInfo.sourceInfos
|
|
184485
|
+
(sourceMapInfo.sourceInfos ?? (sourceMapInfo.sourceInfos = /* @__PURE__ */ new Set())).add(info.path);
|
|
184047
184486
|
}
|
|
184048
184487
|
}
|
|
184049
184488
|
if (info.cacheSourceFile)
|
|
@@ -184093,7 +184532,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184093
184532
|
if (lazyConfiguredProjectsFromExternalProject && !this.hostConfiguration.preferences.lazyConfiguredProjectsFromExternalProject) {
|
|
184094
184533
|
this.externalProjectToConfiguredProjectMap.forEach(
|
|
184095
184534
|
(projects) => projects.forEach((project) => {
|
|
184096
|
-
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())) {
|
|
184097
184536
|
project.updateGraph();
|
|
184098
184537
|
}
|
|
184099
184538
|
})
|
|
@@ -184138,7 +184577,10 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184138
184577
|
return;
|
|
184139
184578
|
if (!info.fileWatcher)
|
|
184140
184579
|
return;
|
|
184141
|
-
this.onSourceFileChanged(
|
|
184580
|
+
this.onSourceFileChanged(
|
|
184581
|
+
info,
|
|
184582
|
+
this.host.fileExists(info.fileName) ? info.deferredDelete ? 0 /* Created */ : 1 /* Changed */ : 2 /* Deleted */
|
|
184583
|
+
);
|
|
184142
184584
|
});
|
|
184143
184585
|
this.pendingProjectUpdates.forEach((_project, projectName) => {
|
|
184144
184586
|
this.throttledOperations.cancel(projectName);
|
|
@@ -184150,15 +184592,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184150
184592
|
if (info.config)
|
|
184151
184593
|
info.config.updateLevel = 2 /* Full */;
|
|
184152
184594
|
});
|
|
184153
|
-
this.reloadConfiguredProjectForFiles(
|
|
184154
|
-
this.openFiles,
|
|
184155
|
-
/*clearSemanticCache*/
|
|
184156
|
-
true,
|
|
184157
|
-
/*delayReload*/
|
|
184158
|
-
false,
|
|
184159
|
-
returnTrue,
|
|
184160
|
-
"User requested reload projects"
|
|
184161
|
-
);
|
|
184595
|
+
this.reloadConfiguredProjectForFiles("User requested reload projects");
|
|
184162
184596
|
this.externalProjects.forEach((project) => {
|
|
184163
184597
|
this.clearSemanticCache(project);
|
|
184164
184598
|
project.updateGraph();
|
|
@@ -184171,69 +184605,57 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184171
184605
|
/**
|
|
184172
184606
|
* This function goes through all the openFiles and tries to file the config file for them.
|
|
184173
184607
|
* If the config file is found and it refers to existing project, it reloads it either immediately
|
|
184174
|
-
* or schedules it for reload depending on delayReload option
|
|
184175
184608
|
* If there is no existing project it just opens the configured project for the config file
|
|
184176
|
-
* reloadForInfo provides a way to filter out files to reload configured project for
|
|
184177
184609
|
*/
|
|
184178
|
-
reloadConfiguredProjectForFiles(
|
|
184179
|
-
|
|
184610
|
+
reloadConfiguredProjectForFiles(reason) {
|
|
184611
|
+
var _a;
|
|
184612
|
+
const updatedProjects = /* @__PURE__ */ new Set();
|
|
184180
184613
|
const reloadChildProject = (child) => {
|
|
184181
|
-
if (
|
|
184182
|
-
updatedProjects.set(child.canonicalConfigFilePath, true);
|
|
184614
|
+
if (tryAddToSet(updatedProjects, child)) {
|
|
184183
184615
|
this.reloadConfiguredProject(
|
|
184184
184616
|
child,
|
|
184185
184617
|
reason,
|
|
184186
184618
|
/*isInitialLoad*/
|
|
184187
184619
|
false,
|
|
184188
|
-
clearSemanticCache
|
|
184620
|
+
/*clearSemanticCache*/
|
|
184621
|
+
true
|
|
184189
184622
|
);
|
|
184190
184623
|
}
|
|
184191
184624
|
};
|
|
184192
|
-
openFiles == null ? void 0 :
|
|
184625
|
+
(_a = this.openFiles) == null ? void 0 : _a.forEach((_projectRoot, path) => {
|
|
184193
184626
|
this.configFileForOpenFiles.delete(path);
|
|
184194
|
-
if (!shouldReloadProjectFor(openFileValue)) {
|
|
184195
|
-
return;
|
|
184196
|
-
}
|
|
184197
184627
|
const info = this.getScriptInfoForPath(path);
|
|
184198
184628
|
Debug.assert(info.isScriptOpen());
|
|
184199
184629
|
const configFileName = this.getConfigFileNameForFile(info);
|
|
184200
184630
|
if (configFileName) {
|
|
184201
184631
|
const project = this.findConfiguredProjectByProjectName(configFileName) || this.createConfiguredProject(configFileName);
|
|
184202
|
-
if (
|
|
184203
|
-
|
|
184204
|
-
|
|
184205
|
-
|
|
184206
|
-
|
|
184207
|
-
|
|
184208
|
-
|
|
184209
|
-
|
|
184210
|
-
|
|
184211
|
-
|
|
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(
|
|
184212
184643
|
project,
|
|
184213
|
-
|
|
184214
|
-
|
|
184215
|
-
|
|
184216
|
-
|
|
184644
|
+
info.path,
|
|
184645
|
+
(child) => {
|
|
184646
|
+
reloadChildProject(child);
|
|
184647
|
+
return projectContainsInfoDirectly(child, info);
|
|
184648
|
+
},
|
|
184649
|
+
1 /* FindCreate */
|
|
184217
184650
|
);
|
|
184218
|
-
if (
|
|
184219
|
-
|
|
184651
|
+
if (referencedProject) {
|
|
184652
|
+
forEachResolvedProjectReferenceProject(
|
|
184220
184653
|
project,
|
|
184221
|
-
|
|
184222
|
-
|
|
184223
|
-
|
|
184224
|
-
|
|
184225
|
-
},
|
|
184226
|
-
1 /* FindCreate */
|
|
184654
|
+
/*fileName*/
|
|
184655
|
+
void 0,
|
|
184656
|
+
reloadChildProject,
|
|
184657
|
+
0 /* Find */
|
|
184227
184658
|
);
|
|
184228
|
-
if (referencedProject) {
|
|
184229
|
-
forEachResolvedProjectReferenceProject(
|
|
184230
|
-
project,
|
|
184231
|
-
/*fileName*/
|
|
184232
|
-
void 0,
|
|
184233
|
-
reloadChildProject,
|
|
184234
|
-
0 /* Find */
|
|
184235
|
-
);
|
|
184236
|
-
}
|
|
184237
184659
|
}
|
|
184238
184660
|
}
|
|
184239
184661
|
}
|
|
@@ -184350,10 +184772,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184350
184772
|
});
|
|
184351
184773
|
return originalLocation;
|
|
184352
184774
|
function addOriginalConfiguredProject(originalProject) {
|
|
184353
|
-
|
|
184354
|
-
project.originalConfiguredProjects = /* @__PURE__ */ new Set();
|
|
184355
|
-
}
|
|
184356
|
-
project.originalConfiguredProjects.add(originalProject.canonicalConfigFilePath);
|
|
184775
|
+
(project.originalConfiguredProjects ?? (project.originalConfiguredProjects = /* @__PURE__ */ new Set())).add(originalProject.canonicalConfigFilePath);
|
|
184357
184776
|
}
|
|
184358
184777
|
}
|
|
184359
184778
|
/** @internal */
|
|
@@ -184367,7 +184786,19 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184367
184786
|
});
|
|
184368
184787
|
}
|
|
184369
184788
|
getOrCreateOpenScriptInfo(fileName, fileContent, scriptKind, hasMixedContent, projectRootPath) {
|
|
184370
|
-
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
|
+
);
|
|
184371
184802
|
this.openFiles.set(info.path, projectRootPath);
|
|
184372
184803
|
return info;
|
|
184373
184804
|
}
|
|
@@ -184513,7 +184944,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184513
184944
|
removeOrphanConfiguredProjects(toRetainConfiguredProjects) {
|
|
184514
184945
|
const toRemoveConfiguredProjects = new Map(this.configuredProjects);
|
|
184515
184946
|
const markOriginalProjectsAsUsed = (project) => {
|
|
184516
|
-
if (
|
|
184947
|
+
if (project.originalConfiguredProjects && (isConfiguredProject(project) || !project.isOrphan())) {
|
|
184517
184948
|
project.originalConfiguredProjects.forEach(
|
|
184518
184949
|
(_value, configuredProjectPath) => {
|
|
184519
184950
|
const project2 = this.getConfiguredProjectByCanonicalConfigFilePath(configuredProjectPath);
|
|
@@ -184532,18 +184963,17 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184532
184963
|
this.inferredProjects.forEach(markOriginalProjectsAsUsed);
|
|
184533
184964
|
this.externalProjects.forEach(markOriginalProjectsAsUsed);
|
|
184534
184965
|
this.configuredProjects.forEach((project) => {
|
|
184966
|
+
if (!toRemoveConfiguredProjects.has(project.canonicalConfigFilePath))
|
|
184967
|
+
return;
|
|
184535
184968
|
if (project.hasOpenRef()) {
|
|
184536
184969
|
retainConfiguredProject(project);
|
|
184537
|
-
} else if (
|
|
184538
|
-
|
|
184539
|
-
project,
|
|
184540
|
-
(ref) => isRetained(ref) && retainConfiguredProject(project)
|
|
184541
|
-
);
|
|
184970
|
+
} else if (forEachReferencedProject(project, (ref) => isRetained(ref))) {
|
|
184971
|
+
retainConfiguredProject(project);
|
|
184542
184972
|
}
|
|
184543
184973
|
});
|
|
184544
184974
|
toRemoveConfiguredProjects.forEach((project) => this.removeProject(project));
|
|
184545
184975
|
function isRetained(project) {
|
|
184546
|
-
return
|
|
184976
|
+
return !toRemoveConfiguredProjects.has(project.canonicalConfigFilePath) || project.hasOpenRef();
|
|
184547
184977
|
}
|
|
184548
184978
|
function retainConfiguredProject(project) {
|
|
184549
184979
|
if (toRemoveConfiguredProjects.delete(project.canonicalConfigFilePath)) {
|
|
@@ -184555,13 +184985,15 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184555
184985
|
removeOrphanScriptInfos() {
|
|
184556
184986
|
const toRemoveScriptInfos = new Map(this.filenameToScriptInfo);
|
|
184557
184987
|
this.filenameToScriptInfo.forEach((info) => {
|
|
184988
|
+
if (info.deferredDelete)
|
|
184989
|
+
return;
|
|
184558
184990
|
if (!info.isScriptOpen() && info.isOrphan() && !info.isContainedByBackgroundProject()) {
|
|
184559
184991
|
if (!info.sourceMapFilePath)
|
|
184560
184992
|
return;
|
|
184561
184993
|
let sourceInfos;
|
|
184562
184994
|
if (isString(info.sourceMapFilePath)) {
|
|
184563
|
-
const sourceMapInfo = this.
|
|
184564
|
-
sourceInfos = sourceMapInfo
|
|
184995
|
+
const sourceMapInfo = this.filenameToScriptInfo.get(info.sourceMapFilePath);
|
|
184996
|
+
sourceInfos = sourceMapInfo == null ? void 0 : sourceMapInfo.sourceInfos;
|
|
184565
184997
|
} else {
|
|
184566
184998
|
sourceInfos = info.sourceMapFilePath.sourceInfos;
|
|
184567
184999
|
}
|
|
@@ -184578,9 +185010,16 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184578
185010
|
if (info.sourceMapFilePath) {
|
|
184579
185011
|
let sourceInfos;
|
|
184580
185012
|
if (isString(info.sourceMapFilePath)) {
|
|
184581
|
-
|
|
184582
|
-
|
|
184583
|
-
|
|
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;
|
|
184584
185023
|
} else {
|
|
184585
185024
|
sourceInfos = info.sourceMapFilePath.sourceInfos;
|
|
184586
185025
|
}
|
|
@@ -184589,11 +185028,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184589
185028
|
}
|
|
184590
185029
|
}
|
|
184591
185030
|
});
|
|
184592
|
-
toRemoveScriptInfos.forEach((info) =>
|
|
184593
|
-
this.stopWatchingScriptInfo(info);
|
|
184594
|
-
this.deleteScriptInfo(info);
|
|
184595
|
-
info.closeSourceMapFileWatcher();
|
|
184596
|
-
});
|
|
185031
|
+
toRemoveScriptInfos.forEach((info) => this.deleteScriptInfo(info));
|
|
184597
185032
|
}
|
|
184598
185033
|
telemetryOnOpenFile(scriptInfo) {
|
|
184599
185034
|
if (this.serverMode !== 0 /* Semantic */ || !this.eventHandler || !scriptInfo.isJavaScript() || !addToSeen(this.allJsFilesForOpenFileTelemetry, scriptInfo.path)) {
|
|
@@ -184625,7 +185060,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184625
185060
|
synchronizeProjectList(knownProjects, includeProjectReferenceRedirectInfo) {
|
|
184626
185061
|
const files = [];
|
|
184627
185062
|
this.collectChanges(knownProjects, this.externalProjects, includeProjectReferenceRedirectInfo, files);
|
|
184628
|
-
this.collectChanges(knownProjects, this.configuredProjects.values(), includeProjectReferenceRedirectInfo, files);
|
|
185063
|
+
this.collectChanges(knownProjects, mapDefinedIterator(this.configuredProjects.values(), (p) => p.deferredClose ? void 0 : p), includeProjectReferenceRedirectInfo, files);
|
|
184629
185064
|
this.collectChanges(knownProjects, this.inferredProjects, includeProjectReferenceRedirectInfo, files);
|
|
184630
185065
|
return files;
|
|
184631
185066
|
}
|
|
@@ -184998,19 +185433,22 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184998
185433
|
}
|
|
184999
185434
|
async enableRequestedPluginsWorker(pendingPlugins) {
|
|
185000
185435
|
Debug.assert(this.currentPluginEnablementPromise === void 0);
|
|
185001
|
-
|
|
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
|
+
}));
|
|
185002
185449
|
this.currentPluginEnablementPromise = void 0;
|
|
185003
|
-
|
|
185004
|
-
|
|
185005
|
-
async enableRequestedPluginsForProjectAsync(project, promises) {
|
|
185006
|
-
const results = await Promise.all(promises);
|
|
185007
|
-
if (project.isClosed()) {
|
|
185008
|
-
return;
|
|
185009
|
-
}
|
|
185010
|
-
for (const result of results) {
|
|
185011
|
-
this.endEnablePlugin(project, result);
|
|
185012
|
-
}
|
|
185013
|
-
this.delayUpdateProjectGraph(project);
|
|
185450
|
+
if (sendProjectsUpdatedInBackgroundEvent)
|
|
185451
|
+
this.sendProjectsUpdatedInBackgroundEvent();
|
|
185014
185452
|
}
|
|
185015
185453
|
configurePlugin(args) {
|
|
185016
185454
|
this.forEachEnabledProject((project) => project.onPluginConfigurationChanged(args.pluginName, args.configuration));
|
|
@@ -187004,7 +187442,9 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
187004
187442
|
const info = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
|
|
187005
187443
|
fileNameToSearch,
|
|
187006
187444
|
noDtsProject.currentDirectory,
|
|
187007
|
-
noDtsProject.directoryStructureHost
|
|
187445
|
+
noDtsProject.directoryStructureHost,
|
|
187446
|
+
/*deferredDeleteOk*/
|
|
187447
|
+
false
|
|
187008
187448
|
);
|
|
187009
187449
|
if (!info)
|
|
187010
187450
|
continue;
|
|
@@ -189626,6 +190066,7 @@ __export(ts_server_exports4, {
|
|
|
189626
190066
|
isExternalProject: () => isExternalProject,
|
|
189627
190067
|
isInferredProject: () => isInferredProject,
|
|
189628
190068
|
isInferredProjectName: () => isInferredProjectName,
|
|
190069
|
+
isProjectDeferredClose: () => isProjectDeferredClose,
|
|
189629
190070
|
makeAutoImportProviderProjectName: () => makeAutoImportProviderProjectName,
|
|
189630
190071
|
makeAuxiliaryProjectName: () => makeAuxiliaryProjectName,
|
|
189631
190072
|
makeInferredProjectName: () => makeInferredProjectName,
|
|
@@ -189885,6 +190326,7 @@ if (typeof console !== "undefined") {
|
|
|
189885
190326
|
canHaveJSDoc,
|
|
189886
190327
|
canHaveLocals,
|
|
189887
190328
|
canHaveModifiers,
|
|
190329
|
+
canHaveModuleSpecifier,
|
|
189888
190330
|
canHaveSymbol,
|
|
189889
190331
|
canJsonReportNoInputFiles,
|
|
189890
190332
|
canProduceDiagnostics,
|
|
@@ -190351,6 +190793,7 @@ if (typeof console !== "undefined") {
|
|
|
190351
190793
|
getDefaultLibFileName,
|
|
190352
190794
|
getDefaultLibFilePath,
|
|
190353
190795
|
getDefaultLikeExportInfo,
|
|
190796
|
+
getDefaultResolutionModeForFileWorker,
|
|
190354
190797
|
getDiagnosticText,
|
|
190355
190798
|
getDiagnosticsWithinSpan,
|
|
190356
190799
|
getDirectoryPath,
|
|
@@ -190381,6 +190824,7 @@ if (typeof console !== "undefined") {
|
|
|
190381
190824
|
getEmitFlags,
|
|
190382
190825
|
getEmitHelpers,
|
|
190383
190826
|
getEmitModuleDetectionKind,
|
|
190827
|
+
getEmitModuleFormatOfFileWorker,
|
|
190384
190828
|
getEmitModuleKind,
|
|
190385
190829
|
getEmitModuleResolutionKind,
|
|
190386
190830
|
getEmitScriptTarget,
|
|
@@ -190431,6 +190875,7 @@ if (typeof console !== "undefined") {
|
|
|
190431
190875
|
getIdentifierGeneratedImportReference,
|
|
190432
190876
|
getIdentifierTypeArguments,
|
|
190433
190877
|
getImmediatelyInvokedFunctionExpression,
|
|
190878
|
+
getImpliedNodeFormatForEmitWorker,
|
|
190434
190879
|
getImpliedNodeFormatForFile,
|
|
190435
190880
|
getImpliedNodeFormatForFileWorker,
|
|
190436
190881
|
getImportNeedsImportDefaultHelper,
|
|
@@ -190786,6 +191231,7 @@ if (typeof console !== "undefined") {
|
|
|
190786
191231
|
importDefaultHelper,
|
|
190787
191232
|
importFromModuleSpecifier,
|
|
190788
191233
|
importStarHelper,
|
|
191234
|
+
importSyntaxAffectsModuleResolution,
|
|
190789
191235
|
indexOfAnyCharCode,
|
|
190790
191236
|
indexOfNode,
|
|
190791
191237
|
indicesOf,
|
|
@@ -191875,11 +192321,11 @@ if (typeof console !== "undefined") {
|
|
|
191875
192321
|
transformESDecorators,
|
|
191876
192322
|
transformESNext,
|
|
191877
192323
|
transformGenerators,
|
|
192324
|
+
transformImpliedNodeFormatDependentModule,
|
|
191878
192325
|
transformJsx,
|
|
191879
192326
|
transformLegacyDecorators,
|
|
191880
192327
|
transformModule,
|
|
191881
192328
|
transformNamedEvaluation,
|
|
191882
|
-
transformNodeModule,
|
|
191883
192329
|
transformNodes,
|
|
191884
192330
|
transformSystemModule,
|
|
191885
192331
|
transformTypeScript,
|