typescript 5.3.0-dev.20231010 → 5.3.0-dev.20231012
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 +90 -32
- package/lib/tsserver.js +136 -86
- package/lib/typescript.d.ts +0 -1
- package/lib/typescript.js +136 -86
- package/lib/typingsInstaller.js +39 -16
- package/package.json +4 -3
package/lib/tsserver.js
CHANGED
|
@@ -2328,7 +2328,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2328
2328
|
|
|
2329
2329
|
// src/compiler/corePublic.ts
|
|
2330
2330
|
var versionMajorMinor = "5.3";
|
|
2331
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2331
|
+
var version = `${versionMajorMinor}.0-dev.20231012`;
|
|
2332
2332
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2333
2333
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2334
2334
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -41393,7 +41393,7 @@ function resolvedTypeScriptOnly(resolved) {
|
|
|
41393
41393
|
Debug.assert(extensionIsTS(resolved.extension));
|
|
41394
41394
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
41395
41395
|
}
|
|
41396
|
-
function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, legacyResult) {
|
|
41396
|
+
function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, cache, legacyResult) {
|
|
41397
41397
|
if (!state.resultFromCache && !state.compilerOptions.preserveSymlinks && resolved && isExternalLibraryImport && !resolved.originalPath && !isExternalModuleNameRelative(moduleName)) {
|
|
41398
41398
|
const { resolvedFileName, originalPath } = getOriginalAndResolvedFileName(resolved.path, state.host, state.traceEnabled);
|
|
41399
41399
|
if (originalPath)
|
|
@@ -41406,15 +41406,25 @@ function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName
|
|
|
41406
41406
|
affectingLocations,
|
|
41407
41407
|
diagnostics,
|
|
41408
41408
|
state.resultFromCache,
|
|
41409
|
+
cache,
|
|
41409
41410
|
legacyResult
|
|
41410
41411
|
);
|
|
41411
41412
|
}
|
|
41412
|
-
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, legacyResult) {
|
|
41413
|
+
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, cache, legacyResult) {
|
|
41413
41414
|
if (resultFromCache) {
|
|
41414
|
-
|
|
41415
|
-
|
|
41416
|
-
|
|
41417
|
-
|
|
41415
|
+
if (!(cache == null ? void 0 : cache.isReadonly)) {
|
|
41416
|
+
resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
|
|
41417
|
+
resultFromCache.affectingLocations = updateResolutionField(resultFromCache.affectingLocations, affectingLocations);
|
|
41418
|
+
resultFromCache.resolutionDiagnostics = updateResolutionField(resultFromCache.resolutionDiagnostics, diagnostics);
|
|
41419
|
+
return resultFromCache;
|
|
41420
|
+
} else {
|
|
41421
|
+
return {
|
|
41422
|
+
...resultFromCache,
|
|
41423
|
+
failedLookupLocations: initializeResolutionFieldForReadonlyCache(resultFromCache.failedLookupLocations, failedLookupLocations),
|
|
41424
|
+
affectingLocations: initializeResolutionFieldForReadonlyCache(resultFromCache.affectingLocations, affectingLocations),
|
|
41425
|
+
resolutionDiagnostics: initializeResolutionFieldForReadonlyCache(resultFromCache.resolutionDiagnostics, diagnostics)
|
|
41426
|
+
};
|
|
41427
|
+
}
|
|
41418
41428
|
}
|
|
41419
41429
|
return {
|
|
41420
41430
|
resolvedModule: resolved && {
|
|
@@ -41442,6 +41452,13 @@ function updateResolutionField(to, value) {
|
|
|
41442
41452
|
to.push(...value);
|
|
41443
41453
|
return to;
|
|
41444
41454
|
}
|
|
41455
|
+
function initializeResolutionFieldForReadonlyCache(fromCache, value) {
|
|
41456
|
+
if (!(fromCache == null ? void 0 : fromCache.length))
|
|
41457
|
+
return initializeResolutionField(value);
|
|
41458
|
+
if (!value.length)
|
|
41459
|
+
return fromCache.slice();
|
|
41460
|
+
return [...fromCache, ...value];
|
|
41461
|
+
}
|
|
41445
41462
|
function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
|
|
41446
41463
|
if (!hasProperty(jsonContent, fieldName)) {
|
|
41447
41464
|
if (state.traceEnabled) {
|
|
@@ -41669,15 +41686,15 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
41669
41686
|
affectingLocations: initializeResolutionField(affectingLocations),
|
|
41670
41687
|
resolutionDiagnostics: initializeResolutionField(diagnostics)
|
|
41671
41688
|
};
|
|
41672
|
-
if (containingDirectory) {
|
|
41673
|
-
cache
|
|
41689
|
+
if (containingDirectory && cache && !cache.isReadonly) {
|
|
41690
|
+
cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(
|
|
41674
41691
|
typeReferenceDirectiveName,
|
|
41675
41692
|
/*mode*/
|
|
41676
41693
|
resolutionMode,
|
|
41677
41694
|
result
|
|
41678
41695
|
);
|
|
41679
41696
|
if (!isExternalModuleNameRelative(typeReferenceDirectiveName)) {
|
|
41680
|
-
cache
|
|
41697
|
+
cache.getOrCreateCacheForNonRelativeName(typeReferenceDirectiveName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
41681
41698
|
}
|
|
41682
41699
|
}
|
|
41683
41700
|
if (traceEnabled)
|
|
@@ -41884,7 +41901,8 @@ function createCacheWithRedirects(ownOptions, optionsToRedirectsKey) {
|
|
|
41884
41901
|
getMapOfCacheRedirects,
|
|
41885
41902
|
getOrCreateMapOfCacheRedirects,
|
|
41886
41903
|
update,
|
|
41887
|
-
clear: clear2
|
|
41904
|
+
clear: clear2,
|
|
41905
|
+
getOwnMap: () => ownMap
|
|
41888
41906
|
};
|
|
41889
41907
|
function getMapOfCacheRedirects(redirectedReference) {
|
|
41890
41908
|
return redirectedReference ? getOrCreateMap(
|
|
@@ -41991,7 +42009,8 @@ function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileNam
|
|
|
41991
42009
|
getFromDirectoryCache,
|
|
41992
42010
|
getOrCreateCacheForDirectory,
|
|
41993
42011
|
clear: clear2,
|
|
41994
|
-
update
|
|
42012
|
+
update,
|
|
42013
|
+
directoryToModuleNameMap
|
|
41995
42014
|
};
|
|
41996
42015
|
function clear2() {
|
|
41997
42016
|
directoryToModuleNameMap.clear();
|
|
@@ -42265,9 +42284,11 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
42265
42284
|
if (result && result.resolvedModule)
|
|
42266
42285
|
(_b = perfLogger) == null ? void 0 : _b.logInfoEvent(`Module "${moduleName}" resolved to "${result.resolvedModule.resolvedFileName}"`);
|
|
42267
42286
|
(_c = perfLogger) == null ? void 0 : _c.logStopResolveModule(result && result.resolvedModule ? "" + result.resolvedModule.resolvedFileName : "null");
|
|
42268
|
-
cache
|
|
42269
|
-
|
|
42270
|
-
|
|
42287
|
+
if (cache && !cache.isReadonly) {
|
|
42288
|
+
cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(moduleName, resolutionMode, result);
|
|
42289
|
+
if (!isExternalModuleNameRelative(moduleName)) {
|
|
42290
|
+
cache.getOrCreateCacheForNonRelativeName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
42291
|
+
}
|
|
42271
42292
|
}
|
|
42272
42293
|
}
|
|
42273
42294
|
if (traceEnabled) {
|
|
@@ -42582,6 +42603,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
42582
42603
|
affectingLocations,
|
|
42583
42604
|
diagnostics,
|
|
42584
42605
|
state,
|
|
42606
|
+
cache,
|
|
42585
42607
|
legacyResult
|
|
42586
42608
|
);
|
|
42587
42609
|
function tryResolve(extensions2, state2) {
|
|
@@ -42983,7 +43005,7 @@ function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
|
|
|
42983
43005
|
return packageJsonInfo.contents.versionPaths || void 0;
|
|
42984
43006
|
}
|
|
42985
43007
|
function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
42986
|
-
var _a, _b, _c, _d, _e, _f
|
|
43008
|
+
var _a, _b, _c, _d, _e, _f;
|
|
42987
43009
|
const { host, traceEnabled } = state;
|
|
42988
43010
|
const packageJsonPath = combinePaths(packageDirectory, "package.json");
|
|
42989
43011
|
if (onlyRecordFailures) {
|
|
@@ -43011,15 +43033,17 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
|
43011
43033
|
trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
43012
43034
|
}
|
|
43013
43035
|
const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
|
|
43014
|
-
(
|
|
43015
|
-
|
|
43036
|
+
if (state.packageJsonInfoCache && !state.packageJsonInfoCache.isReadonly)
|
|
43037
|
+
state.packageJsonInfoCache.setPackageJsonInfo(packageJsonPath, result);
|
|
43038
|
+
(_e = state.affectingLocations) == null ? void 0 : _e.push(packageJsonPath);
|
|
43016
43039
|
return result;
|
|
43017
43040
|
} else {
|
|
43018
43041
|
if (directoryExists && traceEnabled) {
|
|
43019
43042
|
trace(host, Diagnostics.File_0_does_not_exist, packageJsonPath);
|
|
43020
43043
|
}
|
|
43021
|
-
(
|
|
43022
|
-
|
|
43044
|
+
if (state.packageJsonInfoCache && !state.packageJsonInfoCache.isReadonly)
|
|
43045
|
+
state.packageJsonInfoCache.setPackageJsonInfo(packageJsonPath, directoryExists);
|
|
43046
|
+
(_f = state.failedLookupLocations) == null ? void 0 : _f.push(packageJsonPath);
|
|
43023
43047
|
}
|
|
43024
43048
|
}
|
|
43025
43049
|
function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) {
|
|
@@ -43809,7 +43833,8 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
43809
43833
|
failedLookupLocations,
|
|
43810
43834
|
affectingLocations,
|
|
43811
43835
|
diagnostics,
|
|
43812
|
-
state
|
|
43836
|
+
state,
|
|
43837
|
+
cache
|
|
43813
43838
|
);
|
|
43814
43839
|
function tryResolve(extensions) {
|
|
43815
43840
|
const resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
@@ -43928,7 +43953,9 @@ function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, hos
|
|
|
43928
43953
|
failedLookupLocations,
|
|
43929
43954
|
affectingLocations,
|
|
43930
43955
|
diagnostics,
|
|
43931
|
-
state.resultFromCache
|
|
43956
|
+
state.resultFromCache,
|
|
43957
|
+
/*cache*/
|
|
43958
|
+
void 0
|
|
43932
43959
|
);
|
|
43933
43960
|
}
|
|
43934
43961
|
function toSearchResult(value) {
|
|
@@ -78063,8 +78090,20 @@ function createTypeChecker(host) {
|
|
|
78063
78090
|
let hasReturnWithNoExpression = functionHasImplicitReturn(func);
|
|
78064
78091
|
let hasReturnOfTypeNever = false;
|
|
78065
78092
|
forEachReturnStatement(func.body, (returnStatement) => {
|
|
78066
|
-
|
|
78093
|
+
let expr = returnStatement.expression;
|
|
78067
78094
|
if (expr) {
|
|
78095
|
+
expr = skipParentheses(
|
|
78096
|
+
expr,
|
|
78097
|
+
/*excludeJSDocTypeAssertions*/
|
|
78098
|
+
true
|
|
78099
|
+
);
|
|
78100
|
+
if (functionFlags & 2 /* Async */ && expr.kind === 223 /* AwaitExpression */) {
|
|
78101
|
+
expr = skipParentheses(
|
|
78102
|
+
expr.expression,
|
|
78103
|
+
/*excludeJSDocTypeAssertions*/
|
|
78104
|
+
true
|
|
78105
|
+
);
|
|
78106
|
+
}
|
|
78068
78107
|
if (expr.kind === 213 /* CallExpression */ && expr.expression.kind === 80 /* Identifier */ && checkExpressionCached(expr.expression).symbol === func.symbol) {
|
|
78069
78108
|
hasReturnOfTypeNever = true;
|
|
78070
78109
|
return;
|
|
@@ -125983,6 +126022,10 @@ function getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirec
|
|
|
125983
126022
|
function getRootPathSplitLength(rootPath) {
|
|
125984
126023
|
return rootPath.split(directorySeparator).length - (hasTrailingDirectorySeparator(rootPath) ? 1 : 0);
|
|
125985
126024
|
}
|
|
126025
|
+
function getModuleResolutionHost(resolutionHost) {
|
|
126026
|
+
var _a;
|
|
126027
|
+
return ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
|
|
126028
|
+
}
|
|
125986
126029
|
function createModuleResolutionLoaderUsingGlobalCache(containingFile, redirectedReference, options, resolutionHost, moduleResolutionCache) {
|
|
125987
126030
|
return {
|
|
125988
126031
|
nameAndMode: moduleResolutionNameAndModeGetter,
|
|
@@ -125998,8 +126041,7 @@ function createModuleResolutionLoaderUsingGlobalCache(containingFile, redirected
|
|
|
125998
126041
|
};
|
|
125999
126042
|
}
|
|
126000
126043
|
function resolveModuleNameUsingGlobalCache(resolutionHost, moduleResolutionCache, moduleName, containingFile, compilerOptions, redirectedReference, mode) {
|
|
126001
|
-
|
|
126002
|
-
const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
|
|
126044
|
+
const host = getModuleResolutionHost(resolutionHost);
|
|
126003
126045
|
const primaryResult = resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
|
|
126004
126046
|
if (!resolutionHost.getGlobalCache) {
|
|
126005
126047
|
return primaryResult;
|
|
@@ -126170,6 +126212,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126170
126212
|
};
|
|
126171
126213
|
}
|
|
126172
126214
|
function startCachingPerDirectoryResolution() {
|
|
126215
|
+
moduleResolutionCache.isReadonly = void 0;
|
|
126216
|
+
typeReferenceDirectiveResolutionCache.isReadonly = void 0;
|
|
126217
|
+
libraryResolutionCache.isReadonly = void 0;
|
|
126218
|
+
moduleResolutionCache.getPackageJsonInfoCache().isReadonly = void 0;
|
|
126173
126219
|
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
126174
126220
|
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
126175
126221
|
libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
@@ -126227,6 +126273,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126227
126273
|
directoryWatchesOfFailedLookups.forEach(closeDirectoryWatchesOfFailedLookup);
|
|
126228
126274
|
fileWatchesOfAffectingLocations.forEach(closeFileWatcherOfAffectingLocation);
|
|
126229
126275
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
126276
|
+
moduleResolutionCache.isReadonly = true;
|
|
126277
|
+
typeReferenceDirectiveResolutionCache.isReadonly = true;
|
|
126278
|
+
libraryResolutionCache.isReadonly = true;
|
|
126279
|
+
moduleResolutionCache.getPackageJsonInfoCache().isReadonly = true;
|
|
126230
126280
|
}
|
|
126231
126281
|
function closeDirectoryWatchesOfFailedLookup(watcher, path) {
|
|
126232
126282
|
if (watcher.refCount === 0) {
|
|
@@ -126255,7 +126305,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126255
126305
|
shouldRetryResolution,
|
|
126256
126306
|
logChanges
|
|
126257
126307
|
}) {
|
|
126258
|
-
var _a;
|
|
126259
126308
|
const path = resolutionHost.toPath(containingFile);
|
|
126260
126309
|
const resolutionsInFile = perFileCache.get(path) || perFileCache.set(path, createModeAwareCache()).get(path);
|
|
126261
126310
|
const resolvedModules = [];
|
|
@@ -126287,7 +126336,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126287
126336
|
logChanges = false;
|
|
126288
126337
|
}
|
|
126289
126338
|
} else {
|
|
126290
|
-
const host = (
|
|
126339
|
+
const host = getModuleResolutionHost(resolutionHost);
|
|
126291
126340
|
if (isTraceEnabled(options, host) && !seenNamesInFile.has(name, mode)) {
|
|
126292
126341
|
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
126293
126342
|
trace(
|
|
@@ -126339,7 +126388,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126339
126388
|
}
|
|
126340
126389
|
}
|
|
126341
126390
|
function resolveTypeReferenceDirectiveReferences(typeDirectiveReferences, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
|
|
126342
|
-
var _a;
|
|
126343
126391
|
return resolveNamesWithLocalCache({
|
|
126344
126392
|
entries: typeDirectiveReferences,
|
|
126345
126393
|
containingFile,
|
|
@@ -126352,7 +126400,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126352
126400
|
containingFile,
|
|
126353
126401
|
redirectedReference,
|
|
126354
126402
|
options,
|
|
126355
|
-
(
|
|
126403
|
+
getModuleResolutionHost(resolutionHost),
|
|
126356
126404
|
typeReferenceDirectiveResolutionCache
|
|
126357
126405
|
),
|
|
126358
126406
|
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
|
|
@@ -126384,8 +126432,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126384
126432
|
});
|
|
126385
126433
|
}
|
|
126386
126434
|
function resolveLibrary2(libraryName, resolveFrom, options, libFileName) {
|
|
126387
|
-
|
|
126388
|
-
const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
|
|
126435
|
+
const host = getModuleResolutionHost(resolutionHost);
|
|
126389
126436
|
let resolution = resolvedLibraries == null ? void 0 : resolvedLibraries.get(libFileName);
|
|
126390
126437
|
if (!resolution || resolution.isInvalidated) {
|
|
126391
126438
|
const existingResolution = resolution;
|
|
@@ -126419,6 +126466,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126419
126466
|
return resolution;
|
|
126420
126467
|
}
|
|
126421
126468
|
function resolveSingleModuleNameWithoutWatching(moduleName, containingFile) {
|
|
126469
|
+
var _a, _b;
|
|
126422
126470
|
const path = resolutionHost.toPath(containingFile);
|
|
126423
126471
|
const resolutionsInFile = resolvedModuleNames.get(path);
|
|
126424
126472
|
const resolution = resolutionsInFile == null ? void 0 : resolutionsInFile.get(
|
|
@@ -126428,7 +126476,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126428
126476
|
);
|
|
126429
126477
|
if (resolution && !resolution.isInvalidated)
|
|
126430
126478
|
return resolution;
|
|
126431
|
-
|
|
126479
|
+
const data = (_a = resolutionHost.beforeResolveSingleModuleNameWithoutWatching) == null ? void 0 : _a.call(resolutionHost, moduleResolutionCache);
|
|
126480
|
+
const host = getModuleResolutionHost(resolutionHost);
|
|
126481
|
+
const result = resolveModuleName(
|
|
126482
|
+
moduleName,
|
|
126483
|
+
containingFile,
|
|
126484
|
+
resolutionHost.getCompilationSettings(),
|
|
126485
|
+
host,
|
|
126486
|
+
moduleResolutionCache
|
|
126487
|
+
);
|
|
126488
|
+
(_b = resolutionHost.afterResolveSingleModuleNameWithoutWatching) == null ? void 0 : _b.call(resolutionHost, moduleResolutionCache, moduleName, containingFile, result, data);
|
|
126489
|
+
return result;
|
|
126432
126490
|
}
|
|
126433
126491
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
126434
126492
|
return endsWith(dirPath, "/node_modules/@types");
|
|
@@ -166276,7 +166334,6 @@ function getOutliningSpanForNode(n, sourceFile) {
|
|
|
166276
166334
|
case 275 /* NamedImports */:
|
|
166277
166335
|
case 279 /* NamedExports */:
|
|
166278
166336
|
case 300 /* ImportAttributes */:
|
|
166279
|
-
case 300 /* AssertClause */:
|
|
166280
166337
|
return spanForImportExportElements(n);
|
|
166281
166338
|
}
|
|
166282
166339
|
function spanForImportExportElements(node) {
|
|
@@ -174532,6 +174589,7 @@ __export(ts_server_exports3, {
|
|
|
174532
174589
|
hasArgument: () => hasArgument,
|
|
174533
174590
|
hasNoTypeScriptSource: () => hasNoTypeScriptSource,
|
|
174534
174591
|
indent: () => indent2,
|
|
174592
|
+
isBackgroundProject: () => isBackgroundProject,
|
|
174535
174593
|
isConfigFile: () => isConfigFile,
|
|
174536
174594
|
isConfiguredProject: () => isConfiguredProject,
|
|
174537
174595
|
isDynamicFileName: () => isDynamicFileName,
|
|
@@ -175799,7 +175857,7 @@ var ScriptInfo = class {
|
|
|
175799
175857
|
isContainedByBackgroundProject() {
|
|
175800
175858
|
return some(
|
|
175801
175859
|
this.containingProjects,
|
|
175802
|
-
|
|
175860
|
+
isBackgroundProject
|
|
175803
175861
|
);
|
|
175804
175862
|
}
|
|
175805
175863
|
/**
|
|
@@ -175830,7 +175888,7 @@ var ScriptInfo = class {
|
|
|
175830
175888
|
}
|
|
175831
175889
|
};
|
|
175832
175890
|
function ensurePrimaryProjectKind(project) {
|
|
175833
|
-
if (!project || project
|
|
175891
|
+
if (!project || isBackgroundProject(project)) {
|
|
175834
175892
|
return Errors.ThrowNoProject();
|
|
175835
175893
|
}
|
|
175836
175894
|
return project;
|
|
@@ -176116,9 +176174,10 @@ var Project3 = class _Project {
|
|
|
176116
176174
|
this.disableLanguageService(lastFileExceededProgramSize);
|
|
176117
176175
|
}
|
|
176118
176176
|
this.markAsDirty();
|
|
176119
|
-
if (
|
|
176177
|
+
if (!isBackgroundProject(this)) {
|
|
176120
176178
|
this.projectService.pendingEnsureProjectForOpenFiles = true;
|
|
176121
176179
|
}
|
|
176180
|
+
this.projectService.onProjectCreation(this);
|
|
176122
176181
|
}
|
|
176123
176182
|
/** @internal */
|
|
176124
176183
|
getResolvedProjectReferenceToRedirect(_fileName) {
|
|
@@ -176288,6 +176347,7 @@ var Project3 = class _Project {
|
|
|
176288
176347
|
resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
|
|
176289
176348
|
return this.resolutionCache.resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames);
|
|
176290
176349
|
}
|
|
176350
|
+
/** @internal */
|
|
176291
176351
|
getModuleResolutionCache() {
|
|
176292
176352
|
return this.resolutionCache.getModuleResolutionCache();
|
|
176293
176353
|
}
|
|
@@ -177566,32 +177626,15 @@ var Project3 = class _Project {
|
|
|
177566
177626
|
return this.projectService.getIncompleteCompletionsCache();
|
|
177567
177627
|
}
|
|
177568
177628
|
/** @internal */
|
|
177569
|
-
getNoDtsResolutionProject(
|
|
177629
|
+
getNoDtsResolutionProject(rootFile) {
|
|
177570
177630
|
Debug.assert(this.projectService.serverMode === 0 /* Semantic */);
|
|
177571
177631
|
if (!this.noDtsResolutionProject) {
|
|
177572
177632
|
this.noDtsResolutionProject = new AuxiliaryProject(this.projectService, this.documentRegistry, this.getCompilerOptionsForNoDtsResolutionProject(), this.currentDirectory);
|
|
177573
177633
|
}
|
|
177574
|
-
|
|
177575
|
-
|
|
177576
|
-
this.noDtsResolutionProject.
|
|
177577
|
-
|
|
177578
|
-
(pathToAdd) => {
|
|
177579
|
-
const info = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
|
|
177580
|
-
pathToAdd,
|
|
177581
|
-
this.currentDirectory,
|
|
177582
|
-
this.noDtsResolutionProject.directoryStructureHost
|
|
177583
|
-
);
|
|
177584
|
-
if (info) {
|
|
177585
|
-
this.noDtsResolutionProject.addRoot(info, pathToAdd);
|
|
177586
|
-
}
|
|
177587
|
-
},
|
|
177588
|
-
(pathToRemove) => {
|
|
177589
|
-
const info = this.noDtsResolutionProject.getScriptInfo(pathToRemove);
|
|
177590
|
-
if (info) {
|
|
177591
|
-
this.noDtsResolutionProject.removeRoot(info);
|
|
177592
|
-
}
|
|
177593
|
-
}
|
|
177594
|
-
);
|
|
177634
|
+
if (this.noDtsResolutionProject.rootFile !== rootFile) {
|
|
177635
|
+
this.projectService.setFileNamesOfAutpImportProviderOrAuxillaryProject(this.noDtsResolutionProject, [rootFile]);
|
|
177636
|
+
this.noDtsResolutionProject.rootFile = rootFile;
|
|
177637
|
+
}
|
|
177595
177638
|
return this.noDtsResolutionProject;
|
|
177596
177639
|
}
|
|
177597
177640
|
/** @internal */
|
|
@@ -177923,7 +177966,7 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
|
|
|
177923
177966
|
this.getCompilationSettings()
|
|
177924
177967
|
);
|
|
177925
177968
|
}
|
|
177926
|
-
this.projectService.
|
|
177969
|
+
this.projectService.setFileNamesOfAutpImportProviderOrAuxillaryProject(this, rootFileNames);
|
|
177927
177970
|
this.rootFileNames = rootFileNames;
|
|
177928
177971
|
const oldProgram = this.getCurrentProgram();
|
|
177929
177972
|
const hasSameSetOfFiles = super.updateGraph();
|
|
@@ -178279,6 +178322,9 @@ function isConfiguredProject(project) {
|
|
|
178279
178322
|
function isExternalProject(project) {
|
|
178280
178323
|
return project.projectKind === 2 /* External */;
|
|
178281
178324
|
}
|
|
178325
|
+
function isBackgroundProject(project) {
|
|
178326
|
+
return project.projectKind === 3 /* AutoImportProvider */ || project.projectKind === 4 /* Auxiliary */;
|
|
178327
|
+
}
|
|
178282
178328
|
|
|
178283
178329
|
// src/server/editorServices.ts
|
|
178284
178330
|
var maxProgramSizeForNonTsFiles = 20 * 1024 * 1024;
|
|
@@ -178719,6 +178765,8 @@ var _ProjectService = class _ProjectService {
|
|
|
178719
178765
|
this.verifyDocumentRegistry = noop;
|
|
178720
178766
|
/** @internal */
|
|
178721
178767
|
this.verifyProgram = noop;
|
|
178768
|
+
/** @internal */
|
|
178769
|
+
this.onProjectCreation = noop;
|
|
178722
178770
|
var _a;
|
|
178723
178771
|
this.host = opts.host;
|
|
178724
178772
|
this.logger = opts.logger;
|
|
@@ -178886,20 +178934,20 @@ var _ProjectService = class _ProjectService {
|
|
|
178886
178934
|
}
|
|
178887
178935
|
delayUpdateProjectGraph(project) {
|
|
178888
178936
|
project.markAsDirty();
|
|
178889
|
-
if (project
|
|
178890
|
-
|
|
178891
|
-
|
|
178892
|
-
|
|
178893
|
-
|
|
178894
|
-
|
|
178895
|
-
|
|
178896
|
-
|
|
178897
|
-
|
|
178898
|
-
|
|
178899
|
-
|
|
178937
|
+
if (isBackgroundProject(project))
|
|
178938
|
+
return;
|
|
178939
|
+
const projectName = project.getProjectName();
|
|
178940
|
+
this.pendingProjectUpdates.set(projectName, project);
|
|
178941
|
+
this.throttledOperations.schedule(
|
|
178942
|
+
projectName,
|
|
178943
|
+
/*delay*/
|
|
178944
|
+
250,
|
|
178945
|
+
() => {
|
|
178946
|
+
if (this.pendingProjectUpdates.delete(projectName)) {
|
|
178947
|
+
updateProjectIfDirty(project);
|
|
178900
178948
|
}
|
|
178901
|
-
|
|
178902
|
-
|
|
178949
|
+
}
|
|
178950
|
+
);
|
|
178903
178951
|
}
|
|
178904
178952
|
/** @internal */
|
|
178905
178953
|
hasPendingProjectUpdate(project) {
|
|
@@ -179756,6 +179804,7 @@ var _ProjectService = class _ProjectService {
|
|
|
179756
179804
|
addFilesToNonInferredProject(project, files, propertyReader, typeAcquisition) {
|
|
179757
179805
|
this.updateNonInferredProjectFiles(project, files, propertyReader);
|
|
179758
179806
|
project.setTypeAcquisition(typeAcquisition);
|
|
179807
|
+
project.markAsDirty();
|
|
179759
179808
|
}
|
|
179760
179809
|
/** @internal */
|
|
179761
179810
|
createConfiguredProject(configFileName) {
|
|
@@ -180041,7 +180090,6 @@ var _ProjectService = class _ProjectService {
|
|
|
180041
180090
|
}
|
|
180042
180091
|
});
|
|
180043
180092
|
}
|
|
180044
|
-
project.markAsDirty();
|
|
180045
180093
|
}
|
|
180046
180094
|
updateRootAndOptionsOfNonInferredProject(project, newUncheckedFiles, propertyReader, newOptions, newTypeAcquisition, compileOnSave, watchOptions) {
|
|
180047
180095
|
project.setCompilerOptions(newOptions);
|
|
@@ -180060,6 +180108,7 @@ var _ProjectService = class _ProjectService {
|
|
|
180060
180108
|
const fileNames = this.reloadFileNamesOfParsedConfig(project.getConfigFilePath(), this.configFileExistenceInfoCache.get(project.canonicalConfigFilePath).config);
|
|
180061
180109
|
project.updateErrorOnNoInputFiles(fileNames);
|
|
180062
180110
|
this.updateNonInferredProjectFiles(project, fileNames.concat(project.getExternalFiles(1 /* RootNamesAndUpdate */)), fileNamePropertyReader);
|
|
180111
|
+
project.markAsDirty();
|
|
180063
180112
|
return project.updateGraph();
|
|
180064
180113
|
}
|
|
180065
180114
|
/** @internal */
|
|
@@ -180079,7 +180128,7 @@ var _ProjectService = class _ProjectService {
|
|
|
180079
180128
|
return fileNames;
|
|
180080
180129
|
}
|
|
180081
180130
|
/** @internal */
|
|
180082
|
-
|
|
180131
|
+
setFileNamesOfAutpImportProviderOrAuxillaryProject(project, fileNames) {
|
|
180083
180132
|
this.updateNonInferredProjectFiles(project, fileNames, fileNamePropertyReader);
|
|
180084
180133
|
}
|
|
180085
180134
|
/**
|
|
@@ -183475,7 +183524,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
183475
183524
|
if (needsJsResolution) {
|
|
183476
183525
|
const definitionSet = createSet((d) => d.textSpan.start, documentSpansEqual);
|
|
183477
183526
|
definitions == null ? void 0 : definitions.forEach((d) => definitionSet.add(d));
|
|
183478
|
-
const noDtsProject = project.getNoDtsResolutionProject(
|
|
183527
|
+
const noDtsProject = project.getNoDtsResolutionProject(file);
|
|
183479
183528
|
const ls = noDtsProject.getLanguageService();
|
|
183480
183529
|
const jsDefinitions = (_a = ls.getDefinitionAtPosition(
|
|
183481
183530
|
file,
|
|
@@ -183502,8 +183551,18 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
183502
183551
|
const ambientCandidates = definitions.filter((d) => toNormalizedPath(d.fileName) !== file && d.isAmbient);
|
|
183503
183552
|
for (const candidate of some(ambientCandidates) ? ambientCandidates : getAmbientCandidatesByClimbingAccessChain()) {
|
|
183504
183553
|
const fileNameToSearch = findImplementationFileFromDtsFileName(candidate.fileName, file, noDtsProject);
|
|
183505
|
-
if (!fileNameToSearch
|
|
183554
|
+
if (!fileNameToSearch)
|
|
183506
183555
|
continue;
|
|
183556
|
+
const info = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
|
|
183557
|
+
fileNameToSearch,
|
|
183558
|
+
noDtsProject.currentDirectory,
|
|
183559
|
+
noDtsProject.directoryStructureHost
|
|
183560
|
+
);
|
|
183561
|
+
if (!info)
|
|
183562
|
+
continue;
|
|
183563
|
+
if (!noDtsProject.containsScriptInfo(info)) {
|
|
183564
|
+
noDtsProject.addRoot(info);
|
|
183565
|
+
noDtsProject.updateGraph();
|
|
183507
183566
|
}
|
|
183508
183567
|
const noDtsProgram = ls.getProgram();
|
|
183509
183568
|
const fileToSearch = Debug.checkDefined(noDtsProgram.getSourceFile(fileNameToSearch));
|
|
@@ -183606,16 +183665,6 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
183606
183665
|
}
|
|
183607
183666
|
});
|
|
183608
183667
|
}
|
|
183609
|
-
function ensureRoot(project2, fileName) {
|
|
183610
|
-
const info = project2.getScriptInfo(fileName);
|
|
183611
|
-
if (!info)
|
|
183612
|
-
return false;
|
|
183613
|
-
if (!project2.containsScriptInfo(info)) {
|
|
183614
|
-
project2.addRoot(info);
|
|
183615
|
-
project2.updateGraph();
|
|
183616
|
-
}
|
|
183617
|
-
return true;
|
|
183618
|
-
}
|
|
183619
183668
|
}
|
|
183620
183669
|
getEmitOutput(args) {
|
|
183621
183670
|
const { file, project } = this.getFileAndProject(args);
|
|
@@ -185942,6 +185991,7 @@ __export(ts_server_exports4, {
|
|
|
185942
185991
|
hasNoTypeScriptSource: () => hasNoTypeScriptSource,
|
|
185943
185992
|
indent: () => indent2,
|
|
185944
185993
|
initializeNodeSystem: () => initializeNodeSystem,
|
|
185994
|
+
isBackgroundProject: () => isBackgroundProject,
|
|
185945
185995
|
isConfigFile: () => isConfigFile,
|
|
185946
185996
|
isConfiguredProject: () => isConfiguredProject,
|
|
185947
185997
|
isDynamicFileName: () => isDynamicFileName,
|
package/lib/typescript.d.ts
CHANGED
|
@@ -3354,7 +3354,6 @@ declare namespace ts {
|
|
|
3354
3354
|
readFile(fileName: string): string | undefined;
|
|
3355
3355
|
writeFile(fileName: string, content: string): void;
|
|
3356
3356
|
fileExists(file: string): boolean;
|
|
3357
|
-
getModuleResolutionCache(): ModuleResolutionCache | undefined;
|
|
3358
3357
|
directoryExists(path: string): boolean;
|
|
3359
3358
|
getDirectories(path: string): string[];
|
|
3360
3359
|
log(s: string): void;
|