typescript 5.1.0-dev.20230330 → 5.1.0-dev.20230401
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 +121 -95
- package/lib/tsserver.js +178 -121
- package/lib/tsserverlibrary.js +172 -121
- package/lib/typescript.js +156 -111
- package/lib/typingsInstaller.js +9 -9
- package/package.json +2 -2
package/lib/tsserver.js
CHANGED
|
@@ -257,6 +257,8 @@ __export(server_exports, {
|
|
|
257
257
|
canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
|
|
258
258
|
canProduceDiagnostics: () => canProduceDiagnostics,
|
|
259
259
|
canUsePropertyAccess: () => canUsePropertyAccess,
|
|
260
|
+
canWatchAffectingLocation: () => canWatchAffectingLocation,
|
|
261
|
+
canWatchAtTypes: () => canWatchAtTypes,
|
|
260
262
|
canWatchDirectoryOrFile: () => canWatchDirectoryOrFile,
|
|
261
263
|
cartesianProduct: () => cartesianProduct,
|
|
262
264
|
cast: () => cast,
|
|
@@ -704,6 +706,8 @@ __export(server_exports, {
|
|
|
704
706
|
getDiagnosticText: () => getDiagnosticText,
|
|
705
707
|
getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
|
|
706
708
|
getDirectoryPath: () => getDirectoryPath,
|
|
709
|
+
getDirectoryToWatchFailedLookupLocation: () => getDirectoryToWatchFailedLookupLocation,
|
|
710
|
+
getDirectoryToWatchFailedLookupLocationFromTypeRoot: () => getDirectoryToWatchFailedLookupLocationFromTypeRoot,
|
|
707
711
|
getDocumentPositionMapper: () => getDocumentPositionMapper,
|
|
708
712
|
getESModuleInterop: () => getESModuleInterop,
|
|
709
713
|
getEditsForFileRename: () => getEditsForFileRename,
|
|
@@ -973,6 +977,7 @@ __export(server_exports, {
|
|
|
973
977
|
getRestParameterElementType: () => getRestParameterElementType,
|
|
974
978
|
getRightMostAssignedExpression: () => getRightMostAssignedExpression,
|
|
975
979
|
getRootDeclaration: () => getRootDeclaration,
|
|
980
|
+
getRootDirectoryOfResolutionCache: () => getRootDirectoryOfResolutionCache,
|
|
976
981
|
getRootLength: () => getRootLength,
|
|
977
982
|
getScriptKind: () => getScriptKind,
|
|
978
983
|
getScriptKindFromFileName: () => getScriptKindFromFileName,
|
|
@@ -2070,6 +2075,7 @@ __export(server_exports, {
|
|
|
2070
2075
|
setValueDeclaration: () => setValueDeclaration,
|
|
2071
2076
|
shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
|
|
2072
2077
|
shouldPreserveConstEnums: () => shouldPreserveConstEnums,
|
|
2078
|
+
shouldResolveJsRequire: () => shouldResolveJsRequire,
|
|
2073
2079
|
shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
|
|
2074
2080
|
showModuleSpecifier: () => showModuleSpecifier,
|
|
2075
2081
|
signatureHasLiteralTypes: () => signatureHasLiteralTypes,
|
|
@@ -2286,7 +2292,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2286
2292
|
|
|
2287
2293
|
// src/compiler/corePublic.ts
|
|
2288
2294
|
var versionMajorMinor = "5.1";
|
|
2289
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2295
|
+
var version = `${versionMajorMinor}.0-dev.20230401`;
|
|
2290
2296
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2291
2297
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2292
2298
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -7548,7 +7554,7 @@ function createDynamicPriorityPollingWatchFile(host) {
|
|
|
7548
7554
|
queue.pollScheduled = false;
|
|
7549
7555
|
return queue;
|
|
7550
7556
|
}
|
|
7551
|
-
function pollPollingIntervalQueue(queue) {
|
|
7557
|
+
function pollPollingIntervalQueue(_timeoutType, queue) {
|
|
7552
7558
|
queue.pollIndex = pollQueue(queue, queue.pollingInterval, queue.pollIndex, pollingChunkSize[queue.pollingInterval]);
|
|
7553
7559
|
if (queue.length) {
|
|
7554
7560
|
scheduleNextPoll(queue.pollingInterval);
|
|
@@ -7557,7 +7563,7 @@ function createDynamicPriorityPollingWatchFile(host) {
|
|
|
7557
7563
|
queue.pollScheduled = false;
|
|
7558
7564
|
}
|
|
7559
7565
|
}
|
|
7560
|
-
function pollLowPollingIntervalQueue(queue) {
|
|
7566
|
+
function pollLowPollingIntervalQueue(_timeoutType, queue) {
|
|
7561
7567
|
pollQueue(
|
|
7562
7568
|
changedFilesInLastPoll,
|
|
7563
7569
|
250 /* Low */,
|
|
@@ -7565,7 +7571,7 @@ function createDynamicPriorityPollingWatchFile(host) {
|
|
|
7565
7571
|
0,
|
|
7566
7572
|
changedFilesInLastPoll.length
|
|
7567
7573
|
);
|
|
7568
|
-
pollPollingIntervalQueue(queue);
|
|
7574
|
+
pollPollingIntervalQueue(_timeoutType, queue);
|
|
7569
7575
|
if (!queue.pollScheduled && changedFilesInLastPoll.length) {
|
|
7570
7576
|
scheduleNextPoll(250 /* Low */);
|
|
7571
7577
|
}
|
|
@@ -7622,7 +7628,7 @@ function createDynamicPriorityPollingWatchFile(host) {
|
|
|
7622
7628
|
}
|
|
7623
7629
|
}
|
|
7624
7630
|
function scheduleNextPoll(pollingInterval) {
|
|
7625
|
-
pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval));
|
|
7631
|
+
pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingInterval === 250 /* Low */ ? "pollLowPollingIntervalQueue" : "pollPollingIntervalQueue", pollingIntervalQueue(pollingInterval));
|
|
7626
7632
|
}
|
|
7627
7633
|
}
|
|
7628
7634
|
function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) {
|
|
@@ -7701,7 +7707,7 @@ function createFixedChunkSizePollingWatchFile(host) {
|
|
|
7701
7707
|
function scheduleNextPoll() {
|
|
7702
7708
|
if (!watchedFiles.length || pollScheduled)
|
|
7703
7709
|
return;
|
|
7704
|
-
pollScheduled = host.setTimeout(pollQueue, 2e3 /* High
|
|
7710
|
+
pollScheduled = host.setTimeout(pollQueue, 2e3 /* High */, "pollQueue");
|
|
7705
7711
|
}
|
|
7706
7712
|
}
|
|
7707
7713
|
function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) {
|
|
@@ -7869,7 +7875,7 @@ function createDirectoryWatcherSupportingRecursive({
|
|
|
7869
7875
|
clearTimeout2(timerToUpdateChildWatches);
|
|
7870
7876
|
timerToUpdateChildWatches = void 0;
|
|
7871
7877
|
}
|
|
7872
|
-
timerToUpdateChildWatches = setTimeout2(onTimerToUpdateChildWatches, 1e3);
|
|
7878
|
+
timerToUpdateChildWatches = setTimeout2(onTimerToUpdateChildWatches, 1e3, "timerToUpdateChildWatches");
|
|
7873
7879
|
}
|
|
7874
7880
|
function onTimerToUpdateChildWatches() {
|
|
7875
7881
|
timerToUpdateChildWatches = void 0;
|
|
@@ -9709,7 +9715,6 @@ var Diagnostics = {
|
|
|
9709
9715
|
Constructors_for_derived_classes_must_contain_a_super_call: diag(2377, 1 /* Error */, "Constructors_for_derived_classes_must_contain_a_super_call_2377", "Constructors for derived classes must contain a 'super' call."),
|
|
9710
9716
|
A_get_accessor_must_return_a_value: diag(2378, 1 /* Error */, "A_get_accessor_must_return_a_value_2378", "A 'get' accessor must return a value."),
|
|
9711
9717
|
Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties: diag(2379, 1 /* Error */, "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_tr_2379", "Argument of type '{0}' is not assignable to parameter of type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."),
|
|
9712
|
-
The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type: diag(2380, 1 /* Error */, "The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type_2380", "The return type of a 'get' accessor must be assignable to its 'set' accessor type"),
|
|
9713
9718
|
Overload_signatures_must_all_be_exported_or_non_exported: diag(2383, 1 /* Error */, "Overload_signatures_must_all_be_exported_or_non_exported_2383", "Overload signatures must all be exported or non-exported."),
|
|
9714
9719
|
Overload_signatures_must_all_be_ambient_or_non_ambient: diag(2384, 1 /* Error */, "Overload_signatures_must_all_be_ambient_or_non_ambient_2384", "Overload signatures must all be ambient or non-ambient."),
|
|
9715
9720
|
Overload_signatures_must_all_be_public_private_or_protected: diag(2385, 1 /* Error */, "Overload_signatures_must_all_be_public_private_or_protected_2385", "Overload signatures must all be public, private or protected."),
|
|
@@ -20329,6 +20334,9 @@ function getAllowSyntheticDefaultImports(compilerOptions) {
|
|
|
20329
20334
|
function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
|
|
20330
20335
|
return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
|
|
20331
20336
|
}
|
|
20337
|
+
function shouldResolveJsRequire(compilerOptions) {
|
|
20338
|
+
return !!compilerOptions.noDtsResolution || getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */;
|
|
20339
|
+
}
|
|
20332
20340
|
function getResolvePackageJsonExports(compilerOptions) {
|
|
20333
20341
|
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
20334
20342
|
if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
|
@@ -38508,7 +38516,8 @@ var commandOptionsWithoutBuild = [
|
|
|
38508
38516
|
affectsBuildInfo: true,
|
|
38509
38517
|
category: Diagnostics.Modules,
|
|
38510
38518
|
description: Diagnostics.Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_bundler_and_either_noEmit_or_emitDeclarationOnly_to_be_set,
|
|
38511
|
-
defaultValueDescription: false
|
|
38519
|
+
defaultValueDescription: false,
|
|
38520
|
+
transpileOptionValue: void 0
|
|
38512
38521
|
},
|
|
38513
38522
|
{
|
|
38514
38523
|
name: "resolvePackageJsonExports",
|
|
@@ -45887,7 +45896,7 @@ function createBinder() {
|
|
|
45887
45896
|
}
|
|
45888
45897
|
if (!isBindingPattern(node.name)) {
|
|
45889
45898
|
const possibleVariableDecl = node.kind === 258 /* VariableDeclaration */ ? node : node.parent.parent;
|
|
45890
|
-
if (isInJSFile(node) &&
|
|
45899
|
+
if (isInJSFile(node) && shouldResolveJsRequire(options) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 1 /* Export */)) {
|
|
45891
45900
|
declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
|
|
45892
45901
|
} else if (isBlockOrCatchScoped(node)) {
|
|
45893
45902
|
bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
|
|
@@ -49546,7 +49555,7 @@ function createTypeChecker(host) {
|
|
|
49546
49555
|
const hasDefaultOnly = isOnlyImportedAsDefault(specifier);
|
|
49547
49556
|
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
49548
49557
|
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
49549
|
-
if (hasExportAssignmentSymbol(moduleSymbol) && !
|
|
49558
|
+
if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
|
|
49550
49559
|
const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop";
|
|
49551
49560
|
const exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
|
49552
49561
|
const exportAssignment = exportEqualsSymbol.valueDeclaration;
|
|
@@ -49714,7 +49723,7 @@ function createTypeChecker(host) {
|
|
|
49714
49723
|
if (!isIdentifier(name)) {
|
|
49715
49724
|
return void 0;
|
|
49716
49725
|
}
|
|
49717
|
-
const suppressInteropError = name.escapedText === "default" /* Default */ &&
|
|
49726
|
+
const suppressInteropError = name.escapedText === "default" /* Default */ && allowSyntheticDefaultImports;
|
|
49718
49727
|
const targetSymbol = resolveESModuleSymbol(
|
|
49719
49728
|
moduleSymbol,
|
|
49720
49729
|
moduleSpecifier,
|
|
@@ -54356,7 +54365,7 @@ function createTypeChecker(host) {
|
|
|
54356
54365
|
return;
|
|
54357
54366
|
}
|
|
54358
54367
|
let verbatimTargetName = isShorthandAmbientModuleSymbol(target) && getSomeTargetNameFromDeclarations(symbol.declarations) || unescapeLeadingUnderscores(target.escapedName);
|
|
54359
|
-
if (verbatimTargetName === "export=" /* ExportEquals */ &&
|
|
54368
|
+
if (verbatimTargetName === "export=" /* ExportEquals */ && allowSyntheticDefaultImports) {
|
|
54360
54369
|
verbatimTargetName = "default" /* Default */;
|
|
54361
54370
|
}
|
|
54362
54371
|
const targetName = getInternalSymbolName(target, verbatimTargetName);
|
|
@@ -75579,7 +75588,7 @@ function createTypeChecker(host) {
|
|
|
75579
75588
|
return anyType;
|
|
75580
75589
|
}
|
|
75581
75590
|
}
|
|
75582
|
-
if (isInJSFile(node) &&
|
|
75591
|
+
if (isInJSFile(node) && shouldResolveJsRequire(compilerOptions) && isCommonJsRequire(node)) {
|
|
75583
75592
|
return resolveExternalModuleTypeByLiteral(node.arguments[0]);
|
|
75584
75593
|
}
|
|
75585
75594
|
const returnType = getReturnTypeOfSignature(signature);
|
|
@@ -79284,11 +79293,6 @@ function createTypeChecker(host) {
|
|
|
79284
79293
|
error(getter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
|
|
79285
79294
|
error(setter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
|
|
79286
79295
|
}
|
|
79287
|
-
const getterType = getAnnotatedAccessorType(getter);
|
|
79288
|
-
const setterType = getAnnotatedAccessorType(setter);
|
|
79289
|
-
if (getterType && setterType) {
|
|
79290
|
-
checkTypeAssignableTo(getterType, setterType, getter, Diagnostics.The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type);
|
|
79291
|
-
}
|
|
79292
79296
|
}
|
|
79293
79297
|
}
|
|
79294
79298
|
const returnType = getTypeOfAccessors(getSymbolOfDeclaration(node));
|
|
@@ -119561,7 +119565,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119561
119565
|
false
|
|
119562
119566
|
);
|
|
119563
119567
|
}
|
|
119564
|
-
const shouldProcessRequires = isJavaScriptFile &&
|
|
119568
|
+
const shouldProcessRequires = isJavaScriptFile && shouldResolveJsRequire(options);
|
|
119565
119569
|
if (file.flags & 2097152 /* PossiblyContainsDynamicImport */ || shouldProcessRequires) {
|
|
119566
119570
|
collectDynamicImportOrRequireCalls(file);
|
|
119567
119571
|
}
|
|
@@ -123006,6 +123010,79 @@ function canWatchDirectoryOrFile(dirPath) {
|
|
|
123006
123010
|
}
|
|
123007
123011
|
return true;
|
|
123008
123012
|
}
|
|
123013
|
+
function canWatchAtTypes(atTypes, rootPath) {
|
|
123014
|
+
const dirPath = getDirectoryPath(getDirectoryPath(atTypes));
|
|
123015
|
+
return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
|
|
123016
|
+
}
|
|
123017
|
+
function isInDirectoryPath(dir, file) {
|
|
123018
|
+
if (dir === void 0 || file.length <= dir.length) {
|
|
123019
|
+
return false;
|
|
123020
|
+
}
|
|
123021
|
+
return startsWith(file, dir) && file[dir.length] === directorySeparator;
|
|
123022
|
+
}
|
|
123023
|
+
function canWatchAffectingLocation(filePath) {
|
|
123024
|
+
return canWatchDirectoryOrFile(filePath);
|
|
123025
|
+
}
|
|
123026
|
+
function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath, rootSplitLength, getCurrentDirectory) {
|
|
123027
|
+
if (isInDirectoryPath(rootPath, failedLookupLocationPath)) {
|
|
123028
|
+
failedLookupLocation = isRootedDiskPath(failedLookupLocation) ? normalizePath(failedLookupLocation) : getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory());
|
|
123029
|
+
const failedLookupPathSplit = failedLookupLocationPath.split(directorySeparator);
|
|
123030
|
+
const failedLookupSplit = failedLookupLocation.split(directorySeparator);
|
|
123031
|
+
Debug.assert(failedLookupSplit.length === failedLookupPathSplit.length, `FailedLookup: ${failedLookupLocation} failedLookupLocationPath: ${failedLookupLocationPath}`);
|
|
123032
|
+
if (failedLookupPathSplit.length > rootSplitLength + 1) {
|
|
123033
|
+
return {
|
|
123034
|
+
dir: failedLookupSplit.slice(0, rootSplitLength + 1).join(directorySeparator),
|
|
123035
|
+
dirPath: failedLookupPathSplit.slice(0, rootSplitLength + 1).join(directorySeparator)
|
|
123036
|
+
};
|
|
123037
|
+
} else {
|
|
123038
|
+
return {
|
|
123039
|
+
dir: rootDir,
|
|
123040
|
+
dirPath: rootPath,
|
|
123041
|
+
nonRecursive: false
|
|
123042
|
+
};
|
|
123043
|
+
}
|
|
123044
|
+
}
|
|
123045
|
+
return getDirectoryToWatchFromFailedLookupLocationDirectory(
|
|
123046
|
+
getDirectoryPath(getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory())),
|
|
123047
|
+
getDirectoryPath(failedLookupLocationPath),
|
|
123048
|
+
rootPath
|
|
123049
|
+
);
|
|
123050
|
+
}
|
|
123051
|
+
function getDirectoryToWatchFromFailedLookupLocationDirectory(dir, dirPath, rootPath) {
|
|
123052
|
+
while (pathContainsNodeModules(dirPath)) {
|
|
123053
|
+
dir = getDirectoryPath(dir);
|
|
123054
|
+
dirPath = getDirectoryPath(dirPath);
|
|
123055
|
+
}
|
|
123056
|
+
if (isNodeModulesDirectory(dirPath)) {
|
|
123057
|
+
return canWatchDirectoryOrFile(getDirectoryPath(dirPath)) ? { dir, dirPath } : void 0;
|
|
123058
|
+
}
|
|
123059
|
+
let nonRecursive = true;
|
|
123060
|
+
let subDirectoryPath, subDirectory;
|
|
123061
|
+
if (rootPath !== void 0) {
|
|
123062
|
+
while (!isInDirectoryPath(dirPath, rootPath)) {
|
|
123063
|
+
const parentPath = getDirectoryPath(dirPath);
|
|
123064
|
+
if (parentPath === dirPath) {
|
|
123065
|
+
break;
|
|
123066
|
+
}
|
|
123067
|
+
nonRecursive = false;
|
|
123068
|
+
subDirectoryPath = dirPath;
|
|
123069
|
+
subDirectory = dir;
|
|
123070
|
+
dirPath = parentPath;
|
|
123071
|
+
dir = getDirectoryPath(dir);
|
|
123072
|
+
}
|
|
123073
|
+
}
|
|
123074
|
+
return canWatchDirectoryOrFile(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive } : void 0;
|
|
123075
|
+
}
|
|
123076
|
+
function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, filterCustomPath) {
|
|
123077
|
+
if (isInDirectoryPath(rootPath, typeRootPath)) {
|
|
123078
|
+
return rootPath;
|
|
123079
|
+
}
|
|
123080
|
+
const toWatch = getDirectoryToWatchFromFailedLookupLocationDirectory(typeRoot, typeRootPath, rootPath);
|
|
123081
|
+
return toWatch && filterCustomPath(toWatch.dirPath) ? toWatch.dirPath : void 0;
|
|
123082
|
+
}
|
|
123083
|
+
function getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory) {
|
|
123084
|
+
return rootDirForResolution && removeTrailingDirectorySeparator(getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory()));
|
|
123085
|
+
}
|
|
123009
123086
|
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
|
|
123010
123087
|
let filesWithChangedSetOfUnresolvedImports;
|
|
123011
123088
|
let filesWithInvalidatedResolutions;
|
|
@@ -123040,7 +123117,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123040
123117
|
const customFailedLookupPaths = /* @__PURE__ */ new Map();
|
|
123041
123118
|
const directoryWatchesOfFailedLookups = /* @__PURE__ */ new Map();
|
|
123042
123119
|
const fileWatchesOfAffectingLocations = /* @__PURE__ */ new Map();
|
|
123043
|
-
const rootDir =
|
|
123120
|
+
const rootDir = getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory);
|
|
123044
123121
|
const rootPath = rootDir && resolutionHost.toPath(rootDir);
|
|
123045
123122
|
const rootSplitLength = rootPath !== void 0 ? rootPath.split(directorySeparator).length : 0;
|
|
123046
123123
|
const typeRootsWatches = /* @__PURE__ */ new Map();
|
|
@@ -123073,12 +123150,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123073
123150
|
function getResolvedTypeReferenceDirective2(resolution) {
|
|
123074
123151
|
return resolution.resolvedTypeReferenceDirective;
|
|
123075
123152
|
}
|
|
123076
|
-
function isInDirectoryPath(dir, file) {
|
|
123077
|
-
if (dir === void 0 || file.length <= dir.length) {
|
|
123078
|
-
return false;
|
|
123079
|
-
}
|
|
123080
|
-
return startsWith(file, dir) && file[dir.length] === directorySeparator;
|
|
123081
|
-
}
|
|
123082
123153
|
function clear2() {
|
|
123083
123154
|
clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
|
|
123084
123155
|
clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
|
|
@@ -123362,55 +123433,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123362
123433
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
123363
123434
|
return endsWith(dirPath, "/node_modules/@types");
|
|
123364
123435
|
}
|
|
123365
|
-
function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath) {
|
|
123366
|
-
if (isInDirectoryPath(rootPath, failedLookupLocationPath)) {
|
|
123367
|
-
failedLookupLocation = isRootedDiskPath(failedLookupLocation) ? normalizePath(failedLookupLocation) : getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory());
|
|
123368
|
-
const failedLookupPathSplit = failedLookupLocationPath.split(directorySeparator);
|
|
123369
|
-
const failedLookupSplit = failedLookupLocation.split(directorySeparator);
|
|
123370
|
-
Debug.assert(failedLookupSplit.length === failedLookupPathSplit.length, `FailedLookup: ${failedLookupLocation} failedLookupLocationPath: ${failedLookupLocationPath}`);
|
|
123371
|
-
if (failedLookupPathSplit.length > rootSplitLength + 1) {
|
|
123372
|
-
return {
|
|
123373
|
-
dir: failedLookupSplit.slice(0, rootSplitLength + 1).join(directorySeparator),
|
|
123374
|
-
dirPath: failedLookupPathSplit.slice(0, rootSplitLength + 1).join(directorySeparator)
|
|
123375
|
-
};
|
|
123376
|
-
} else {
|
|
123377
|
-
return {
|
|
123378
|
-
dir: rootDir,
|
|
123379
|
-
dirPath: rootPath,
|
|
123380
|
-
nonRecursive: false
|
|
123381
|
-
};
|
|
123382
|
-
}
|
|
123383
|
-
}
|
|
123384
|
-
return getDirectoryToWatchFromFailedLookupLocationDirectory(
|
|
123385
|
-
getDirectoryPath(getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory())),
|
|
123386
|
-
getDirectoryPath(failedLookupLocationPath)
|
|
123387
|
-
);
|
|
123388
|
-
}
|
|
123389
|
-
function getDirectoryToWatchFromFailedLookupLocationDirectory(dir, dirPath) {
|
|
123390
|
-
while (pathContainsNodeModules(dirPath)) {
|
|
123391
|
-
dir = getDirectoryPath(dir);
|
|
123392
|
-
dirPath = getDirectoryPath(dirPath);
|
|
123393
|
-
}
|
|
123394
|
-
if (isNodeModulesDirectory(dirPath)) {
|
|
123395
|
-
return canWatchDirectoryOrFile(getDirectoryPath(dirPath)) ? { dir, dirPath } : void 0;
|
|
123396
|
-
}
|
|
123397
|
-
let nonRecursive = true;
|
|
123398
|
-
let subDirectoryPath, subDirectory;
|
|
123399
|
-
if (rootPath !== void 0) {
|
|
123400
|
-
while (!isInDirectoryPath(dirPath, rootPath)) {
|
|
123401
|
-
const parentPath = getDirectoryPath(dirPath);
|
|
123402
|
-
if (parentPath === dirPath) {
|
|
123403
|
-
break;
|
|
123404
|
-
}
|
|
123405
|
-
nonRecursive = false;
|
|
123406
|
-
subDirectoryPath = dirPath;
|
|
123407
|
-
subDirectory = dir;
|
|
123408
|
-
dirPath = parentPath;
|
|
123409
|
-
dir = getDirectoryPath(dir);
|
|
123410
|
-
}
|
|
123411
|
-
}
|
|
123412
|
-
return canWatchDirectoryOrFile(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive } : void 0;
|
|
123413
|
-
}
|
|
123414
123436
|
function isPathWithDefaultFailedLookupExtension(path) {
|
|
123415
123437
|
return fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
|
|
123416
123438
|
}
|
|
@@ -123449,7 +123471,14 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123449
123471
|
if (failedLookupLocations) {
|
|
123450
123472
|
for (const failedLookupLocation of failedLookupLocations) {
|
|
123451
123473
|
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
123452
|
-
const toWatch = getDirectoryToWatchFailedLookupLocation(
|
|
123474
|
+
const toWatch = getDirectoryToWatchFailedLookupLocation(
|
|
123475
|
+
failedLookupLocation,
|
|
123476
|
+
failedLookupLocationPath,
|
|
123477
|
+
rootDir,
|
|
123478
|
+
rootPath,
|
|
123479
|
+
rootSplitLength,
|
|
123480
|
+
getCurrentDirectory
|
|
123481
|
+
);
|
|
123453
123482
|
if (toWatch) {
|
|
123454
123483
|
const { dir, dirPath, nonRecursive } = toWatch;
|
|
123455
123484
|
if (!isPathWithDefaultFailedLookupExtension(failedLookupLocationPath)) {
|
|
@@ -123517,7 +123546,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123517
123546
|
}
|
|
123518
123547
|
const paths = /* @__PURE__ */ new Set();
|
|
123519
123548
|
paths.add(locationToWatch);
|
|
123520
|
-
let actualWatcher =
|
|
123549
|
+
let actualWatcher = canWatchAffectingLocation(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
|
|
123521
123550
|
cachedDirectoryStructureHost == null ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
|
|
123522
123551
|
const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
|
|
123523
123552
|
paths.forEach((path) => {
|
|
@@ -123585,7 +123614,14 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123585
123614
|
let removeAtRoot = false;
|
|
123586
123615
|
for (const failedLookupLocation of failedLookupLocations) {
|
|
123587
123616
|
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
123588
|
-
const toWatch = getDirectoryToWatchFailedLookupLocation(
|
|
123617
|
+
const toWatch = getDirectoryToWatchFailedLookupLocation(
|
|
123618
|
+
failedLookupLocation,
|
|
123619
|
+
failedLookupLocationPath,
|
|
123620
|
+
rootDir,
|
|
123621
|
+
rootPath,
|
|
123622
|
+
rootSplitLength,
|
|
123623
|
+
getCurrentDirectory
|
|
123624
|
+
);
|
|
123589
123625
|
if (toWatch) {
|
|
123590
123626
|
const { dirPath } = toWatch;
|
|
123591
123627
|
const refCount = customFailedLookupPaths.get(failedLookupLocationPath);
|
|
@@ -123753,13 +123789,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123753
123789
|
function closeTypeRootsWatch() {
|
|
123754
123790
|
clearMap(typeRootsWatches, closeFileWatcher);
|
|
123755
123791
|
}
|
|
123756
|
-
function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath) {
|
|
123757
|
-
if (isInDirectoryPath(rootPath, typeRootPath)) {
|
|
123758
|
-
return rootPath;
|
|
123759
|
-
}
|
|
123760
|
-
const toWatch = getDirectoryToWatchFromFailedLookupLocationDirectory(typeRoot, typeRootPath);
|
|
123761
|
-
return toWatch && directoryWatchesOfFailedLookups.has(toWatch.dirPath) ? toWatch.dirPath : void 0;
|
|
123762
|
-
}
|
|
123763
123792
|
function createTypeRootsWatch(typeRootPath, typeRoot) {
|
|
123764
123793
|
return canWatchTypeRootPath(typeRootPath) ? resolutionHost.watchTypeRootsDirectory(typeRoot, (fileOrDirectory) => {
|
|
123765
123794
|
const fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
|
|
@@ -123768,7 +123797,12 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123768
123797
|
}
|
|
123769
123798
|
hasChangedAutomaticTypeDirectiveNames = true;
|
|
123770
123799
|
resolutionHost.onChangedAutomaticTypeDirectiveNames();
|
|
123771
|
-
const dirPath = getDirectoryToWatchFailedLookupLocationFromTypeRoot(
|
|
123800
|
+
const dirPath = getDirectoryToWatchFailedLookupLocationFromTypeRoot(
|
|
123801
|
+
typeRoot,
|
|
123802
|
+
typeRootPath,
|
|
123803
|
+
rootPath,
|
|
123804
|
+
(dirPath2) => directoryWatchesOfFailedLookups.has(dirPath2)
|
|
123805
|
+
);
|
|
123772
123806
|
if (dirPath) {
|
|
123773
123807
|
scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
|
|
123774
123808
|
}
|
|
@@ -123794,12 +123828,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123794
123828
|
closeTypeRootsWatch();
|
|
123795
123829
|
}
|
|
123796
123830
|
}
|
|
123797
|
-
function canWatchTypeRootPath(
|
|
123831
|
+
function canWatchTypeRootPath(typeRoot) {
|
|
123798
123832
|
if (resolutionHost.getCompilationSettings().typeRoots)
|
|
123799
123833
|
return true;
|
|
123800
|
-
|
|
123801
|
-
const dirPath = resolutionHost.toPath(dir);
|
|
123802
|
-
return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
|
|
123834
|
+
return canWatchAtTypes(resolutionHost.toPath(typeRoot), rootPath);
|
|
123803
123835
|
}
|
|
123804
123836
|
}
|
|
123805
123837
|
function resolutionIsSymlink(resolution) {
|
|
@@ -124859,7 +124891,7 @@ function createWatchProgram(host) {
|
|
|
124859
124891
|
}
|
|
124860
124892
|
const pending = clearInvalidateResolutionsOfFailedLookupLocations();
|
|
124861
124893
|
writeLog(`Scheduling invalidateFailedLookup${pending ? ", Cancelled earlier one" : ""}`);
|
|
124862
|
-
timerToInvalidateFailedLookupResolutions = host.setTimeout(invalidateResolutionsOfFailedLookup, 250);
|
|
124894
|
+
timerToInvalidateFailedLookupResolutions = host.setTimeout(invalidateResolutionsOfFailedLookup, 250, "timerToInvalidateFailedLookupResolutions");
|
|
124863
124895
|
}
|
|
124864
124896
|
function invalidateResolutionsOfFailedLookup() {
|
|
124865
124897
|
timerToInvalidateFailedLookupResolutions = void 0;
|
|
@@ -124875,7 +124907,7 @@ function createWatchProgram(host) {
|
|
|
124875
124907
|
host.clearTimeout(timerToUpdateProgram);
|
|
124876
124908
|
}
|
|
124877
124909
|
writeLog("Scheduling update");
|
|
124878
|
-
timerToUpdateProgram = host.setTimeout(updateProgramWithWatchStatus, 250);
|
|
124910
|
+
timerToUpdateProgram = host.setTimeout(updateProgramWithWatchStatus, 250, "timerToUpdateProgram");
|
|
124879
124911
|
}
|
|
124880
124912
|
function scheduleProgramReload() {
|
|
124881
124913
|
Debug.assert(!!configFileName);
|
|
@@ -126780,9 +126812,9 @@ function scheduleBuildInvalidatedProject(state, time, changeDetected) {
|
|
|
126780
126812
|
if (state.timerToBuildInvalidatedProject) {
|
|
126781
126813
|
hostWithWatch.clearTimeout(state.timerToBuildInvalidatedProject);
|
|
126782
126814
|
}
|
|
126783
|
-
state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected);
|
|
126815
|
+
state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, "timerToBuildInvalidatedProject", state, changeDetected);
|
|
126784
126816
|
}
|
|
126785
|
-
function buildNextInvalidatedProject(state, changeDetected) {
|
|
126817
|
+
function buildNextInvalidatedProject(_timeoutType, state, changeDetected) {
|
|
126786
126818
|
mark("SolutionBuilder::beforeBuild");
|
|
126787
126819
|
const buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected);
|
|
126788
126820
|
mark("SolutionBuilder::afterBuild");
|
|
@@ -130727,7 +130759,7 @@ function createCacheableExportInfoMap(host) {
|
|
|
130727
130759
|
// Adding or removing imports from node could change the outcome of that guess, so could change the suggestions list.
|
|
130728
130760
|
typeAcquisitionEnabled && consumesNodeCoreModules(oldSourceFile) !== consumesNodeCoreModules(newSourceFile) || // Module agumentation and ambient module changes can add or remove exports available to be auto-imported.
|
|
130729
130761
|
// Changes elsewhere in the file can change the *type* of an export in a module augmentation,
|
|
130730
|
-
// but type info is gathered in getCompletionEntryDetails, which doesn
|
|
130762
|
+
// but type info is gathered in getCompletionEntryDetails, which doesn't use the cache.
|
|
130731
130763
|
!arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations) || !ambientModuleDeclarationsAreEqual(oldSourceFile, newSourceFile)) {
|
|
130732
130764
|
cache.clear();
|
|
130733
130765
|
return true;
|
|
@@ -139396,7 +139428,7 @@ function getIdentifiersFromErrorSpanExpression(expression, checker) {
|
|
|
139396
139428
|
function symbolReferenceIsAlsoMissingAwait(reference, diagnostics, sourceFile, checker) {
|
|
139397
139429
|
const errorNode = isPropertyAccessExpression(reference.parent) ? reference.parent.name : isBinaryExpression(reference.parent) ? reference.parent : reference;
|
|
139398
139430
|
const diagnostic = find(diagnostics, (diagnostic2) => diagnostic2.start === errorNode.getStart(sourceFile) && diagnostic2.start + diagnostic2.length === errorNode.getEnd());
|
|
139399
|
-
return diagnostic && contains(errorCodes3, diagnostic.code) || // A Promise is usually not correct in a binary expression (it
|
|
139431
|
+
return diagnostic && contains(errorCodes3, diagnostic.code) || // A Promise is usually not correct in a binary expression (it's not valid
|
|
139400
139432
|
// in an arithmetic expression and an equality comparison seems unusual),
|
|
139401
139433
|
// but if the other side of the binary expression has an error, the side
|
|
139402
139434
|
// is typed `any` which will squash the error that would identify this
|
|
@@ -142176,7 +142208,6 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
|
|
|
142176
142208
|
importClauseOrBindingPattern,
|
|
142177
142209
|
defaultImport,
|
|
142178
142210
|
arrayFrom(namedImports.entries(), ([name, addAsTypeOnly]) => ({ addAsTypeOnly, name })),
|
|
142179
|
-
compilerOptions,
|
|
142180
142211
|
preferences
|
|
142181
142212
|
);
|
|
142182
142213
|
});
|
|
@@ -142374,7 +142405,19 @@ function getAddAsTypeOnly(isValidTypeOnlyUseSite, isForNewImportDeclaration, sym
|
|
|
142374
142405
|
return 1 /* Allowed */;
|
|
142375
142406
|
}
|
|
142376
142407
|
function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, compilerOptions) {
|
|
142377
|
-
|
|
142408
|
+
let best;
|
|
142409
|
+
for (const existingImport of existingImports) {
|
|
142410
|
+
const fix = getAddToExistingImportFix(existingImport);
|
|
142411
|
+
if (!fix)
|
|
142412
|
+
continue;
|
|
142413
|
+
const isTypeOnly = isTypeOnlyImportDeclaration(fix.importClauseOrBindingPattern);
|
|
142414
|
+
if (fix.addAsTypeOnly !== 4 /* NotAllowed */ && isTypeOnly || fix.addAsTypeOnly === 4 /* NotAllowed */ && !isTypeOnly) {
|
|
142415
|
+
return fix;
|
|
142416
|
+
}
|
|
142417
|
+
best != null ? best : best = fix;
|
|
142418
|
+
}
|
|
142419
|
+
return best;
|
|
142420
|
+
function getAddToExistingImportFix({ declaration, importKind, symbol, targetFlags }) {
|
|
142378
142421
|
if (importKind === 3 /* CommonJS */ || importKind === 2 /* Namespace */ || declaration.kind === 269 /* ImportEqualsDeclaration */) {
|
|
142379
142422
|
return void 0;
|
|
142380
142423
|
}
|
|
@@ -142382,11 +142425,13 @@ function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker
|
|
|
142382
142425
|
return (importKind === 0 /* Named */ || importKind === 1 /* Default */) && declaration.name.kind === 204 /* ObjectBindingPattern */ ? { kind: 2 /* AddToExisting */, importClauseOrBindingPattern: declaration.name, importKind, moduleSpecifier: declaration.initializer.arguments[0].text, addAsTypeOnly: 4 /* NotAllowed */ } : void 0;
|
|
142383
142426
|
}
|
|
142384
142427
|
const { importClause } = declaration;
|
|
142385
|
-
if (!importClause || !isStringLiteralLike(declaration.moduleSpecifier))
|
|
142428
|
+
if (!importClause || !isStringLiteralLike(declaration.moduleSpecifier)) {
|
|
142386
142429
|
return void 0;
|
|
142430
|
+
}
|
|
142387
142431
|
const { name, namedBindings } = importClause;
|
|
142388
|
-
if (importClause.isTypeOnly && !(importKind === 0 /* Named */ && namedBindings))
|
|
142432
|
+
if (importClause.isTypeOnly && !(importKind === 0 /* Named */ && namedBindings)) {
|
|
142389
142433
|
return void 0;
|
|
142434
|
+
}
|
|
142390
142435
|
const addAsTypeOnly = getAddAsTypeOnly(
|
|
142391
142436
|
isValidTypeOnlyUseSite,
|
|
142392
142437
|
/*isForNewImportDeclaration*/
|
|
@@ -142397,10 +142442,12 @@ function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker
|
|
|
142397
142442
|
compilerOptions
|
|
142398
142443
|
);
|
|
142399
142444
|
if (importKind === 1 /* Default */ && (name || // Cannot add a default import to a declaration that already has one
|
|
142400
|
-
addAsTypeOnly === 2 /* Required */ && namedBindings))
|
|
142445
|
+
addAsTypeOnly === 2 /* Required */ && namedBindings)) {
|
|
142401
142446
|
return void 0;
|
|
142402
|
-
|
|
142447
|
+
}
|
|
142448
|
+
if (importKind === 0 /* Named */ && (namedBindings == null ? void 0 : namedBindings.kind) === 272 /* NamespaceImport */) {
|
|
142403
142449
|
return void 0;
|
|
142450
|
+
}
|
|
142404
142451
|
return {
|
|
142405
142452
|
kind: 2 /* AddToExisting */,
|
|
142406
142453
|
importClauseOrBindingPattern: importClause,
|
|
@@ -142408,7 +142455,7 @@ function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker
|
|
|
142408
142455
|
moduleSpecifier: declaration.moduleSpecifier.text,
|
|
142409
142456
|
addAsTypeOnly
|
|
142410
142457
|
};
|
|
142411
|
-
}
|
|
142458
|
+
}
|
|
142412
142459
|
}
|
|
142413
142460
|
function createExistingImportMap(checker, importingFile, compilerOptions) {
|
|
142414
142461
|
let importMap;
|
|
@@ -142837,7 +142884,6 @@ function codeActionForFixWorker(changes, sourceFile, symbolName2, fix, includeSy
|
|
|
142837
142884
|
importClauseOrBindingPattern,
|
|
142838
142885
|
importKind === 1 /* Default */ ? { name: symbolName2, addAsTypeOnly } : void 0,
|
|
142839
142886
|
importKind === 0 /* Named */ ? [{ name: symbolName2, addAsTypeOnly }] : emptyArray,
|
|
142840
|
-
compilerOptions,
|
|
142841
142887
|
preferences
|
|
142842
142888
|
);
|
|
142843
142889
|
const moduleSpecifierWithoutQuotes = stripQuotes(moduleSpecifier);
|
|
@@ -142939,7 +142985,7 @@ function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceF
|
|
|
142939
142985
|
}
|
|
142940
142986
|
}
|
|
142941
142987
|
}
|
|
142942
|
-
function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports,
|
|
142988
|
+
function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports, preferences) {
|
|
142943
142989
|
var _a2;
|
|
142944
142990
|
if (clause.kind === 204 /* ObjectBindingPattern */) {
|
|
142945
142991
|
if (defaultImport) {
|
|
@@ -142957,7 +143003,6 @@ function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImpor
|
|
|
142957
143003
|
}
|
|
142958
143004
|
const promoteFromTypeOnly2 = clause.isTypeOnly && some([defaultImport, ...namedImports], (i) => (i == null ? void 0 : i.addAsTypeOnly) === 4 /* NotAllowed */);
|
|
142959
143005
|
const existingSpecifiers = clause.namedBindings && ((_a2 = tryCast(clause.namedBindings, isNamedImports)) == null ? void 0 : _a2.elements);
|
|
142960
|
-
const convertExistingToTypeOnly = promoteFromTypeOnly2 && importNameElisionDisabled(compilerOptions);
|
|
142961
143006
|
if (defaultImport) {
|
|
142962
143007
|
Debug.assert(!clause.name, "Cannot add a default import to an import clause that already has one");
|
|
142963
143008
|
changes.insertNodeAt(sourceFile, clause.getStart(sourceFile), factory.createIdentifier(defaultImport.name), { suffix: ", " });
|
|
@@ -142988,7 +143033,7 @@ function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImpor
|
|
|
142988
143033
|
const specifierSort = (existingSpecifiers == null ? void 0 : existingSpecifiers.length) && ts_OrganizeImports_exports.detectImportSpecifierSorting(existingSpecifiers, preferences);
|
|
142989
143034
|
if (specifierSort && !(ignoreCaseForSorting && specifierSort === 1 /* CaseSensitive */)) {
|
|
142990
143035
|
for (const spec of newSpecifiers) {
|
|
142991
|
-
const insertionIndex =
|
|
143036
|
+
const insertionIndex = promoteFromTypeOnly2 && !spec.isTypeOnly ? 0 : ts_OrganizeImports_exports.getImportSpecifierInsertionIndex(existingSpecifiers, spec, comparer);
|
|
142992
143037
|
changes.insertImportSpecifierAtIndex(sourceFile, spec, clause.namedBindings, insertionIndex);
|
|
142993
143038
|
}
|
|
142994
143039
|
} else if (existingSpecifiers == null ? void 0 : existingSpecifiers.length) {
|
|
@@ -143008,7 +143053,7 @@ function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImpor
|
|
|
143008
143053
|
}
|
|
143009
143054
|
if (promoteFromTypeOnly2) {
|
|
143010
143055
|
changes.delete(sourceFile, getTypeKeywordOfTypeOnlyImport(clause, sourceFile));
|
|
143011
|
-
if (
|
|
143056
|
+
if (existingSpecifiers) {
|
|
143012
143057
|
for (const specifier of existingSpecifiers) {
|
|
143013
143058
|
changes.insertModifierBefore(sourceFile, 155 /* TypeKeyword */, specifier);
|
|
143014
143059
|
}
|
|
@@ -154629,7 +154674,7 @@ var Core;
|
|
|
154629
154674
|
*/
|
|
154630
154675
|
this.markSeenReExportRHS = nodeSeenTracker();
|
|
154631
154676
|
this.symbolIdToReferences = [];
|
|
154632
|
-
// Source file ID
|
|
154677
|
+
// Source file ID -> symbol ID -> Whether the symbol has been searched for in the source file.
|
|
154633
154678
|
this.sourceFileToSeenSymbols = [];
|
|
154634
154679
|
}
|
|
154635
154680
|
includesSourceFile(sourceFile) {
|
|
@@ -163470,7 +163515,7 @@ function getSmartSelectionRange(pos, sourceFile) {
|
|
|
163470
163515
|
if (start2 !== end) {
|
|
163471
163516
|
const textSpan = createTextSpanFromBounds(start2, end);
|
|
163472
163517
|
if (!selectionRange || // Skip ranges that are identical to the parent
|
|
163473
|
-
!textSpansEqual(textSpan, selectionRange.textSpan) && // Skip ranges that don
|
|
163518
|
+
!textSpansEqual(textSpan, selectionRange.textSpan) && // Skip ranges that don't contain the original position
|
|
163474
163519
|
textSpanIntersectsWithPosition(textSpan, pos)) {
|
|
163475
163520
|
selectionRange = { textSpan, ...selectionRange && { parent: selectionRange } };
|
|
163476
163521
|
}
|
|
@@ -168521,6 +168566,8 @@ __export(ts_exports2, {
|
|
|
168521
168566
|
canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
|
|
168522
168567
|
canProduceDiagnostics: () => canProduceDiagnostics,
|
|
168523
168568
|
canUsePropertyAccess: () => canUsePropertyAccess,
|
|
168569
|
+
canWatchAffectingLocation: () => canWatchAffectingLocation,
|
|
168570
|
+
canWatchAtTypes: () => canWatchAtTypes,
|
|
168524
168571
|
canWatchDirectoryOrFile: () => canWatchDirectoryOrFile,
|
|
168525
168572
|
cartesianProduct: () => cartesianProduct,
|
|
168526
168573
|
cast: () => cast,
|
|
@@ -168968,6 +169015,8 @@ __export(ts_exports2, {
|
|
|
168968
169015
|
getDiagnosticText: () => getDiagnosticText,
|
|
168969
169016
|
getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
|
|
168970
169017
|
getDirectoryPath: () => getDirectoryPath,
|
|
169018
|
+
getDirectoryToWatchFailedLookupLocation: () => getDirectoryToWatchFailedLookupLocation,
|
|
169019
|
+
getDirectoryToWatchFailedLookupLocationFromTypeRoot: () => getDirectoryToWatchFailedLookupLocationFromTypeRoot,
|
|
168971
169020
|
getDocumentPositionMapper: () => getDocumentPositionMapper,
|
|
168972
169021
|
getESModuleInterop: () => getESModuleInterop,
|
|
168973
169022
|
getEditsForFileRename: () => getEditsForFileRename,
|
|
@@ -169237,6 +169286,7 @@ __export(ts_exports2, {
|
|
|
169237
169286
|
getRestParameterElementType: () => getRestParameterElementType,
|
|
169238
169287
|
getRightMostAssignedExpression: () => getRightMostAssignedExpression,
|
|
169239
169288
|
getRootDeclaration: () => getRootDeclaration,
|
|
169289
|
+
getRootDirectoryOfResolutionCache: () => getRootDirectoryOfResolutionCache,
|
|
169240
169290
|
getRootLength: () => getRootLength,
|
|
169241
169291
|
getScriptKind: () => getScriptKind,
|
|
169242
169292
|
getScriptKindFromFileName: () => getScriptKindFromFileName,
|
|
@@ -170334,6 +170384,7 @@ __export(ts_exports2, {
|
|
|
170334
170384
|
setValueDeclaration: () => setValueDeclaration,
|
|
170335
170385
|
shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
|
|
170336
170386
|
shouldPreserveConstEnums: () => shouldPreserveConstEnums,
|
|
170387
|
+
shouldResolveJsRequire: () => shouldResolveJsRequire,
|
|
170337
170388
|
shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
|
|
170338
170389
|
showModuleSpecifier: () => showModuleSpecifier,
|
|
170339
170390
|
signatureHasLiteralTypes: () => signatureHasLiteralTypes,
|
|
@@ -170889,7 +170940,7 @@ var ThrottledOperations = class {
|
|
|
170889
170940
|
if (pendingTimeout) {
|
|
170890
170941
|
this.host.clearTimeout(pendingTimeout);
|
|
170891
170942
|
}
|
|
170892
|
-
this.pendingTimeouts.set(operationId, this.host.setTimeout(ThrottledOperations.run, delay,
|
|
170943
|
+
this.pendingTimeouts.set(operationId, this.host.setTimeout(ThrottledOperations.run, delay, operationId, this, cb));
|
|
170893
170944
|
if (this.logger) {
|
|
170894
170945
|
this.logger.info(`Scheduled: ${operationId}${pendingTimeout ? ", Cancelled earlier one" : ""}`);
|
|
170895
170946
|
}
|
|
@@ -170901,7 +170952,7 @@ var ThrottledOperations = class {
|
|
|
170901
170952
|
this.host.clearTimeout(pendingTimeout);
|
|
170902
170953
|
return this.pendingTimeouts.delete(operationId);
|
|
170903
170954
|
}
|
|
170904
|
-
static run(
|
|
170955
|
+
static run(operationId, self, cb) {
|
|
170905
170956
|
var _a2, _b;
|
|
170906
170957
|
(_a2 = perfLogger) == null ? void 0 : _a2.logStartScheduledOperation(operationId);
|
|
170907
170958
|
self.pendingTimeouts.delete(operationId);
|
|
@@ -177543,21 +177594,21 @@ var MultistepOperation = class {
|
|
|
177543
177594
|
this.setTimerHandle(void 0);
|
|
177544
177595
|
this.setImmediateId(void 0);
|
|
177545
177596
|
}
|
|
177546
|
-
immediate(action) {
|
|
177597
|
+
immediate(actionType, action) {
|
|
177547
177598
|
const requestId = this.requestId;
|
|
177548
177599
|
Debug.assert(requestId === this.operationHost.getCurrentRequestId(), "immediate: incorrect request id");
|
|
177549
177600
|
this.setImmediateId(this.operationHost.getServerHost().setImmediate(() => {
|
|
177550
177601
|
this.immediateId = void 0;
|
|
177551
177602
|
this.operationHost.executeWithRequestId(requestId, () => this.executeAction(action));
|
|
177552
|
-
}));
|
|
177603
|
+
}, actionType));
|
|
177553
177604
|
}
|
|
177554
|
-
delay(ms, action) {
|
|
177605
|
+
delay(actionType, ms, action) {
|
|
177555
177606
|
const requestId = this.requestId;
|
|
177556
177607
|
Debug.assert(requestId === this.operationHost.getCurrentRequestId(), "delay: incorrect request id");
|
|
177557
177608
|
this.setTimerHandle(this.operationHost.getServerHost().setTimeout(() => {
|
|
177558
177609
|
this.timerHandle = void 0;
|
|
177559
177610
|
this.operationHost.executeWithRequestId(requestId, () => this.executeAction(action));
|
|
177560
|
-
}, ms));
|
|
177611
|
+
}, ms, actionType));
|
|
177561
177612
|
}
|
|
177562
177613
|
executeAction(action) {
|
|
177563
177614
|
var _a2, _b, _c, _d, _e, _f;
|
|
@@ -178871,7 +178922,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
178871
178922
|
const goNext = () => {
|
|
178872
178923
|
index++;
|
|
178873
178924
|
if (checkList.length > index) {
|
|
178874
|
-
next.delay(followMs, checkOne);
|
|
178925
|
+
next.delay("checkOne", followMs, checkOne);
|
|
178875
178926
|
}
|
|
178876
178927
|
};
|
|
178877
178928
|
const checkOne = () => {
|
|
@@ -178899,7 +178950,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
178899
178950
|
goNext();
|
|
178900
178951
|
return;
|
|
178901
178952
|
}
|
|
178902
|
-
next.immediate(() => {
|
|
178953
|
+
next.immediate("semanticCheck", () => {
|
|
178903
178954
|
this.semanticCheck(fileName, project);
|
|
178904
178955
|
if (this.changeSeq !== seq) {
|
|
178905
178956
|
return;
|
|
@@ -178908,14 +178959,14 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
178908
178959
|
goNext();
|
|
178909
178960
|
return;
|
|
178910
178961
|
}
|
|
178911
|
-
next.immediate(() => {
|
|
178962
|
+
next.immediate("suggestionCheck", () => {
|
|
178912
178963
|
this.suggestionCheck(fileName, project);
|
|
178913
178964
|
goNext();
|
|
178914
178965
|
});
|
|
178915
178966
|
});
|
|
178916
178967
|
};
|
|
178917
178968
|
if (checkList.length > index && this.changeSeq === seq) {
|
|
178918
|
-
next.delay(ms, checkOne);
|
|
178969
|
+
next.delay("checkOne", ms, checkOne);
|
|
178919
178970
|
}
|
|
178920
178971
|
}
|
|
178921
178972
|
cleanProjects(caption, projects) {
|
|
@@ -182487,6 +182538,8 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
182487
182538
|
canJsonReportNoInputFiles,
|
|
182488
182539
|
canProduceDiagnostics,
|
|
182489
182540
|
canUsePropertyAccess,
|
|
182541
|
+
canWatchAffectingLocation,
|
|
182542
|
+
canWatchAtTypes,
|
|
182490
182543
|
canWatchDirectoryOrFile,
|
|
182491
182544
|
cartesianProduct,
|
|
182492
182545
|
cast,
|
|
@@ -182934,6 +182987,8 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
182934
182987
|
getDiagnosticText,
|
|
182935
182988
|
getDiagnosticsWithinSpan,
|
|
182936
182989
|
getDirectoryPath,
|
|
182990
|
+
getDirectoryToWatchFailedLookupLocation,
|
|
182991
|
+
getDirectoryToWatchFailedLookupLocationFromTypeRoot,
|
|
182937
182992
|
getDocumentPositionMapper,
|
|
182938
182993
|
getESModuleInterop,
|
|
182939
182994
|
getEditsForFileRename,
|
|
@@ -183203,6 +183258,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
183203
183258
|
getRestParameterElementType,
|
|
183204
183259
|
getRightMostAssignedExpression,
|
|
183205
183260
|
getRootDeclaration,
|
|
183261
|
+
getRootDirectoryOfResolutionCache,
|
|
183206
183262
|
getRootLength,
|
|
183207
183263
|
getScriptKind,
|
|
183208
183264
|
getScriptKindFromFileName,
|
|
@@ -184300,6 +184356,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
184300
184356
|
setValueDeclaration,
|
|
184301
184357
|
shouldAllowImportingTsExtension,
|
|
184302
184358
|
shouldPreserveConstEnums,
|
|
184359
|
+
shouldResolveJsRequire,
|
|
184303
184360
|
shouldUseUriStyleNodeCoreModules,
|
|
184304
184361
|
showModuleSpecifier,
|
|
184305
184362
|
signatureHasLiteralTypes,
|