typescript 5.3.0-dev.20231010 → 5.3.0-dev.20231011
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 -85
- package/lib/typescript.d.ts +0 -1
- package/lib/typescript.js +136 -85
- 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.20231011`;
|
|
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");
|
|
@@ -174532,6 +174590,7 @@ __export(ts_server_exports3, {
|
|
|
174532
174590
|
hasArgument: () => hasArgument,
|
|
174533
174591
|
hasNoTypeScriptSource: () => hasNoTypeScriptSource,
|
|
174534
174592
|
indent: () => indent2,
|
|
174593
|
+
isBackgroundProject: () => isBackgroundProject,
|
|
174535
174594
|
isConfigFile: () => isConfigFile,
|
|
174536
174595
|
isConfiguredProject: () => isConfiguredProject,
|
|
174537
174596
|
isDynamicFileName: () => isDynamicFileName,
|
|
@@ -175799,7 +175858,7 @@ var ScriptInfo = class {
|
|
|
175799
175858
|
isContainedByBackgroundProject() {
|
|
175800
175859
|
return some(
|
|
175801
175860
|
this.containingProjects,
|
|
175802
|
-
|
|
175861
|
+
isBackgroundProject
|
|
175803
175862
|
);
|
|
175804
175863
|
}
|
|
175805
175864
|
/**
|
|
@@ -175830,7 +175889,7 @@ var ScriptInfo = class {
|
|
|
175830
175889
|
}
|
|
175831
175890
|
};
|
|
175832
175891
|
function ensurePrimaryProjectKind(project) {
|
|
175833
|
-
if (!project || project
|
|
175892
|
+
if (!project || isBackgroundProject(project)) {
|
|
175834
175893
|
return Errors.ThrowNoProject();
|
|
175835
175894
|
}
|
|
175836
175895
|
return project;
|
|
@@ -176116,9 +176175,10 @@ var Project3 = class _Project {
|
|
|
176116
176175
|
this.disableLanguageService(lastFileExceededProgramSize);
|
|
176117
176176
|
}
|
|
176118
176177
|
this.markAsDirty();
|
|
176119
|
-
if (
|
|
176178
|
+
if (!isBackgroundProject(this)) {
|
|
176120
176179
|
this.projectService.pendingEnsureProjectForOpenFiles = true;
|
|
176121
176180
|
}
|
|
176181
|
+
this.projectService.onProjectCreation(this);
|
|
176122
176182
|
}
|
|
176123
176183
|
/** @internal */
|
|
176124
176184
|
getResolvedProjectReferenceToRedirect(_fileName) {
|
|
@@ -176288,6 +176348,7 @@ var Project3 = class _Project {
|
|
|
176288
176348
|
resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
|
|
176289
176349
|
return this.resolutionCache.resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames);
|
|
176290
176350
|
}
|
|
176351
|
+
/** @internal */
|
|
176291
176352
|
getModuleResolutionCache() {
|
|
176292
176353
|
return this.resolutionCache.getModuleResolutionCache();
|
|
176293
176354
|
}
|
|
@@ -177566,32 +177627,15 @@ var Project3 = class _Project {
|
|
|
177566
177627
|
return this.projectService.getIncompleteCompletionsCache();
|
|
177567
177628
|
}
|
|
177568
177629
|
/** @internal */
|
|
177569
|
-
getNoDtsResolutionProject(
|
|
177630
|
+
getNoDtsResolutionProject(rootFile) {
|
|
177570
177631
|
Debug.assert(this.projectService.serverMode === 0 /* Semantic */);
|
|
177571
177632
|
if (!this.noDtsResolutionProject) {
|
|
177572
177633
|
this.noDtsResolutionProject = new AuxiliaryProject(this.projectService, this.documentRegistry, this.getCompilerOptionsForNoDtsResolutionProject(), this.currentDirectory);
|
|
177573
177634
|
}
|
|
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
|
-
);
|
|
177635
|
+
if (this.noDtsResolutionProject.rootFile !== rootFile) {
|
|
177636
|
+
this.projectService.setFileNamesOfAutpImportProviderOrAuxillaryProject(this.noDtsResolutionProject, [rootFile]);
|
|
177637
|
+
this.noDtsResolutionProject.rootFile = rootFile;
|
|
177638
|
+
}
|
|
177595
177639
|
return this.noDtsResolutionProject;
|
|
177596
177640
|
}
|
|
177597
177641
|
/** @internal */
|
|
@@ -177923,7 +177967,7 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
|
|
|
177923
177967
|
this.getCompilationSettings()
|
|
177924
177968
|
);
|
|
177925
177969
|
}
|
|
177926
|
-
this.projectService.
|
|
177970
|
+
this.projectService.setFileNamesOfAutpImportProviderOrAuxillaryProject(this, rootFileNames);
|
|
177927
177971
|
this.rootFileNames = rootFileNames;
|
|
177928
177972
|
const oldProgram = this.getCurrentProgram();
|
|
177929
177973
|
const hasSameSetOfFiles = super.updateGraph();
|
|
@@ -178279,6 +178323,9 @@ function isConfiguredProject(project) {
|
|
|
178279
178323
|
function isExternalProject(project) {
|
|
178280
178324
|
return project.projectKind === 2 /* External */;
|
|
178281
178325
|
}
|
|
178326
|
+
function isBackgroundProject(project) {
|
|
178327
|
+
return project.projectKind === 3 /* AutoImportProvider */ || project.projectKind === 4 /* Auxiliary */;
|
|
178328
|
+
}
|
|
178282
178329
|
|
|
178283
178330
|
// src/server/editorServices.ts
|
|
178284
178331
|
var maxProgramSizeForNonTsFiles = 20 * 1024 * 1024;
|
|
@@ -178719,6 +178766,8 @@ var _ProjectService = class _ProjectService {
|
|
|
178719
178766
|
this.verifyDocumentRegistry = noop;
|
|
178720
178767
|
/** @internal */
|
|
178721
178768
|
this.verifyProgram = noop;
|
|
178769
|
+
/** @internal */
|
|
178770
|
+
this.onProjectCreation = noop;
|
|
178722
178771
|
var _a;
|
|
178723
178772
|
this.host = opts.host;
|
|
178724
178773
|
this.logger = opts.logger;
|
|
@@ -178886,20 +178935,20 @@ var _ProjectService = class _ProjectService {
|
|
|
178886
178935
|
}
|
|
178887
178936
|
delayUpdateProjectGraph(project) {
|
|
178888
178937
|
project.markAsDirty();
|
|
178889
|
-
if (project
|
|
178890
|
-
|
|
178891
|
-
|
|
178892
|
-
|
|
178893
|
-
|
|
178894
|
-
|
|
178895
|
-
|
|
178896
|
-
|
|
178897
|
-
|
|
178898
|
-
|
|
178899
|
-
|
|
178938
|
+
if (isBackgroundProject(project))
|
|
178939
|
+
return;
|
|
178940
|
+
const projectName = project.getProjectName();
|
|
178941
|
+
this.pendingProjectUpdates.set(projectName, project);
|
|
178942
|
+
this.throttledOperations.schedule(
|
|
178943
|
+
projectName,
|
|
178944
|
+
/*delay*/
|
|
178945
|
+
250,
|
|
178946
|
+
() => {
|
|
178947
|
+
if (this.pendingProjectUpdates.delete(projectName)) {
|
|
178948
|
+
updateProjectIfDirty(project);
|
|
178900
178949
|
}
|
|
178901
|
-
|
|
178902
|
-
|
|
178950
|
+
}
|
|
178951
|
+
);
|
|
178903
178952
|
}
|
|
178904
178953
|
/** @internal */
|
|
178905
178954
|
hasPendingProjectUpdate(project) {
|
|
@@ -179756,6 +179805,7 @@ var _ProjectService = class _ProjectService {
|
|
|
179756
179805
|
addFilesToNonInferredProject(project, files, propertyReader, typeAcquisition) {
|
|
179757
179806
|
this.updateNonInferredProjectFiles(project, files, propertyReader);
|
|
179758
179807
|
project.setTypeAcquisition(typeAcquisition);
|
|
179808
|
+
project.markAsDirty();
|
|
179759
179809
|
}
|
|
179760
179810
|
/** @internal */
|
|
179761
179811
|
createConfiguredProject(configFileName) {
|
|
@@ -180041,7 +180091,6 @@ var _ProjectService = class _ProjectService {
|
|
|
180041
180091
|
}
|
|
180042
180092
|
});
|
|
180043
180093
|
}
|
|
180044
|
-
project.markAsDirty();
|
|
180045
180094
|
}
|
|
180046
180095
|
updateRootAndOptionsOfNonInferredProject(project, newUncheckedFiles, propertyReader, newOptions, newTypeAcquisition, compileOnSave, watchOptions) {
|
|
180047
180096
|
project.setCompilerOptions(newOptions);
|
|
@@ -180060,6 +180109,7 @@ var _ProjectService = class _ProjectService {
|
|
|
180060
180109
|
const fileNames = this.reloadFileNamesOfParsedConfig(project.getConfigFilePath(), this.configFileExistenceInfoCache.get(project.canonicalConfigFilePath).config);
|
|
180061
180110
|
project.updateErrorOnNoInputFiles(fileNames);
|
|
180062
180111
|
this.updateNonInferredProjectFiles(project, fileNames.concat(project.getExternalFiles(1 /* RootNamesAndUpdate */)), fileNamePropertyReader);
|
|
180112
|
+
project.markAsDirty();
|
|
180063
180113
|
return project.updateGraph();
|
|
180064
180114
|
}
|
|
180065
180115
|
/** @internal */
|
|
@@ -180079,7 +180129,7 @@ var _ProjectService = class _ProjectService {
|
|
|
180079
180129
|
return fileNames;
|
|
180080
180130
|
}
|
|
180081
180131
|
/** @internal */
|
|
180082
|
-
|
|
180132
|
+
setFileNamesOfAutpImportProviderOrAuxillaryProject(project, fileNames) {
|
|
180083
180133
|
this.updateNonInferredProjectFiles(project, fileNames, fileNamePropertyReader);
|
|
180084
180134
|
}
|
|
180085
180135
|
/**
|
|
@@ -183475,7 +183525,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
183475
183525
|
if (needsJsResolution) {
|
|
183476
183526
|
const definitionSet = createSet((d) => d.textSpan.start, documentSpansEqual);
|
|
183477
183527
|
definitions == null ? void 0 : definitions.forEach((d) => definitionSet.add(d));
|
|
183478
|
-
const noDtsProject = project.getNoDtsResolutionProject(
|
|
183528
|
+
const noDtsProject = project.getNoDtsResolutionProject(file);
|
|
183479
183529
|
const ls = noDtsProject.getLanguageService();
|
|
183480
183530
|
const jsDefinitions = (_a = ls.getDefinitionAtPosition(
|
|
183481
183531
|
file,
|
|
@@ -183502,8 +183552,18 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
183502
183552
|
const ambientCandidates = definitions.filter((d) => toNormalizedPath(d.fileName) !== file && d.isAmbient);
|
|
183503
183553
|
for (const candidate of some(ambientCandidates) ? ambientCandidates : getAmbientCandidatesByClimbingAccessChain()) {
|
|
183504
183554
|
const fileNameToSearch = findImplementationFileFromDtsFileName(candidate.fileName, file, noDtsProject);
|
|
183505
|
-
if (!fileNameToSearch
|
|
183555
|
+
if (!fileNameToSearch)
|
|
183506
183556
|
continue;
|
|
183557
|
+
const info = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
|
|
183558
|
+
fileNameToSearch,
|
|
183559
|
+
noDtsProject.currentDirectory,
|
|
183560
|
+
noDtsProject.directoryStructureHost
|
|
183561
|
+
);
|
|
183562
|
+
if (!info)
|
|
183563
|
+
continue;
|
|
183564
|
+
if (!noDtsProject.containsScriptInfo(info)) {
|
|
183565
|
+
noDtsProject.addRoot(info);
|
|
183566
|
+
noDtsProject.updateGraph();
|
|
183507
183567
|
}
|
|
183508
183568
|
const noDtsProgram = ls.getProgram();
|
|
183509
183569
|
const fileToSearch = Debug.checkDefined(noDtsProgram.getSourceFile(fileNameToSearch));
|
|
@@ -183606,16 +183666,6 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
183606
183666
|
}
|
|
183607
183667
|
});
|
|
183608
183668
|
}
|
|
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
183669
|
}
|
|
183620
183670
|
getEmitOutput(args) {
|
|
183621
183671
|
const { file, project } = this.getFileAndProject(args);
|
|
@@ -185942,6 +185992,7 @@ __export(ts_server_exports4, {
|
|
|
185942
185992
|
hasNoTypeScriptSource: () => hasNoTypeScriptSource,
|
|
185943
185993
|
indent: () => indent2,
|
|
185944
185994
|
initializeNodeSystem: () => initializeNodeSystem,
|
|
185995
|
+
isBackgroundProject: () => isBackgroundProject,
|
|
185945
185996
|
isConfigFile: () => isConfigFile,
|
|
185946
185997
|
isConfiguredProject: () => isConfiguredProject,
|
|
185947
185998
|
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;
|