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/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.3";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20231012`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -39253,7 +39253,7 @@ ${lanes.join("\n")}
|
|
|
39253
39253
|
Debug.assert(extensionIsTS(resolved.extension));
|
|
39254
39254
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
39255
39255
|
}
|
|
39256
|
-
function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, legacyResult) {
|
|
39256
|
+
function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, cache, legacyResult) {
|
|
39257
39257
|
if (!state.resultFromCache && !state.compilerOptions.preserveSymlinks && resolved && isExternalLibraryImport && !resolved.originalPath && !isExternalModuleNameRelative(moduleName)) {
|
|
39258
39258
|
const { resolvedFileName, originalPath } = getOriginalAndResolvedFileName(resolved.path, state.host, state.traceEnabled);
|
|
39259
39259
|
if (originalPath)
|
|
@@ -39266,15 +39266,25 @@ ${lanes.join("\n")}
|
|
|
39266
39266
|
affectingLocations,
|
|
39267
39267
|
diagnostics,
|
|
39268
39268
|
state.resultFromCache,
|
|
39269
|
+
cache,
|
|
39269
39270
|
legacyResult
|
|
39270
39271
|
);
|
|
39271
39272
|
}
|
|
39272
|
-
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, legacyResult) {
|
|
39273
|
+
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, cache, legacyResult) {
|
|
39273
39274
|
if (resultFromCache) {
|
|
39274
|
-
|
|
39275
|
-
|
|
39276
|
-
|
|
39277
|
-
|
|
39275
|
+
if (!(cache == null ? void 0 : cache.isReadonly)) {
|
|
39276
|
+
resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
|
|
39277
|
+
resultFromCache.affectingLocations = updateResolutionField(resultFromCache.affectingLocations, affectingLocations);
|
|
39278
|
+
resultFromCache.resolutionDiagnostics = updateResolutionField(resultFromCache.resolutionDiagnostics, diagnostics);
|
|
39279
|
+
return resultFromCache;
|
|
39280
|
+
} else {
|
|
39281
|
+
return {
|
|
39282
|
+
...resultFromCache,
|
|
39283
|
+
failedLookupLocations: initializeResolutionFieldForReadonlyCache(resultFromCache.failedLookupLocations, failedLookupLocations),
|
|
39284
|
+
affectingLocations: initializeResolutionFieldForReadonlyCache(resultFromCache.affectingLocations, affectingLocations),
|
|
39285
|
+
resolutionDiagnostics: initializeResolutionFieldForReadonlyCache(resultFromCache.resolutionDiagnostics, diagnostics)
|
|
39286
|
+
};
|
|
39287
|
+
}
|
|
39278
39288
|
}
|
|
39279
39289
|
return {
|
|
39280
39290
|
resolvedModule: resolved && {
|
|
@@ -39302,6 +39312,13 @@ ${lanes.join("\n")}
|
|
|
39302
39312
|
to.push(...value);
|
|
39303
39313
|
return to;
|
|
39304
39314
|
}
|
|
39315
|
+
function initializeResolutionFieldForReadonlyCache(fromCache, value) {
|
|
39316
|
+
if (!(fromCache == null ? void 0 : fromCache.length))
|
|
39317
|
+
return initializeResolutionField(value);
|
|
39318
|
+
if (!value.length)
|
|
39319
|
+
return fromCache.slice();
|
|
39320
|
+
return [...fromCache, ...value];
|
|
39321
|
+
}
|
|
39305
39322
|
function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
|
|
39306
39323
|
if (!hasProperty(jsonContent, fieldName)) {
|
|
39307
39324
|
if (state.traceEnabled) {
|
|
@@ -39527,15 +39544,15 @@ ${lanes.join("\n")}
|
|
|
39527
39544
|
affectingLocations: initializeResolutionField(affectingLocations),
|
|
39528
39545
|
resolutionDiagnostics: initializeResolutionField(diagnostics)
|
|
39529
39546
|
};
|
|
39530
|
-
if (containingDirectory) {
|
|
39531
|
-
cache
|
|
39547
|
+
if (containingDirectory && cache && !cache.isReadonly) {
|
|
39548
|
+
cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(
|
|
39532
39549
|
typeReferenceDirectiveName,
|
|
39533
39550
|
/*mode*/
|
|
39534
39551
|
resolutionMode,
|
|
39535
39552
|
result
|
|
39536
39553
|
);
|
|
39537
39554
|
if (!isExternalModuleNameRelative(typeReferenceDirectiveName)) {
|
|
39538
|
-
cache
|
|
39555
|
+
cache.getOrCreateCacheForNonRelativeName(typeReferenceDirectiveName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
39539
39556
|
}
|
|
39540
39557
|
}
|
|
39541
39558
|
if (traceEnabled)
|
|
@@ -39742,7 +39759,8 @@ ${lanes.join("\n")}
|
|
|
39742
39759
|
getMapOfCacheRedirects,
|
|
39743
39760
|
getOrCreateMapOfCacheRedirects,
|
|
39744
39761
|
update,
|
|
39745
|
-
clear: clear2
|
|
39762
|
+
clear: clear2,
|
|
39763
|
+
getOwnMap: () => ownMap
|
|
39746
39764
|
};
|
|
39747
39765
|
function getMapOfCacheRedirects(redirectedReference) {
|
|
39748
39766
|
return redirectedReference ? getOrCreateMap(
|
|
@@ -39849,7 +39867,8 @@ ${lanes.join("\n")}
|
|
|
39849
39867
|
getFromDirectoryCache,
|
|
39850
39868
|
getOrCreateCacheForDirectory,
|
|
39851
39869
|
clear: clear2,
|
|
39852
|
-
update
|
|
39870
|
+
update,
|
|
39871
|
+
directoryToModuleNameMap
|
|
39853
39872
|
};
|
|
39854
39873
|
function clear2() {
|
|
39855
39874
|
directoryToModuleNameMap.clear();
|
|
@@ -40123,9 +40142,11 @@ ${lanes.join("\n")}
|
|
|
40123
40142
|
if (result && result.resolvedModule)
|
|
40124
40143
|
(_b = perfLogger) == null ? void 0 : _b.logInfoEvent(`Module "${moduleName}" resolved to "${result.resolvedModule.resolvedFileName}"`);
|
|
40125
40144
|
(_c = perfLogger) == null ? void 0 : _c.logStopResolveModule(result && result.resolvedModule ? "" + result.resolvedModule.resolvedFileName : "null");
|
|
40126
|
-
cache
|
|
40127
|
-
|
|
40128
|
-
|
|
40145
|
+
if (cache && !cache.isReadonly) {
|
|
40146
|
+
cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(moduleName, resolutionMode, result);
|
|
40147
|
+
if (!isExternalModuleNameRelative(moduleName)) {
|
|
40148
|
+
cache.getOrCreateCacheForNonRelativeName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
40149
|
+
}
|
|
40129
40150
|
}
|
|
40130
40151
|
}
|
|
40131
40152
|
if (traceEnabled) {
|
|
@@ -40427,6 +40448,7 @@ ${lanes.join("\n")}
|
|
|
40427
40448
|
affectingLocations,
|
|
40428
40449
|
diagnostics,
|
|
40429
40450
|
state,
|
|
40451
|
+
cache,
|
|
40430
40452
|
legacyResult
|
|
40431
40453
|
);
|
|
40432
40454
|
function tryResolve(extensions2, state2) {
|
|
@@ -40827,7 +40849,7 @@ ${lanes.join("\n")}
|
|
|
40827
40849
|
return packageJsonInfo.contents.versionPaths || void 0;
|
|
40828
40850
|
}
|
|
40829
40851
|
function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
40830
|
-
var _a, _b, _c, _d, _e, _f
|
|
40852
|
+
var _a, _b, _c, _d, _e, _f;
|
|
40831
40853
|
const { host, traceEnabled } = state;
|
|
40832
40854
|
const packageJsonPath = combinePaths(packageDirectory, "package.json");
|
|
40833
40855
|
if (onlyRecordFailures) {
|
|
@@ -40855,15 +40877,17 @@ ${lanes.join("\n")}
|
|
|
40855
40877
|
trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
40856
40878
|
}
|
|
40857
40879
|
const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
|
|
40858
|
-
(
|
|
40859
|
-
|
|
40880
|
+
if (state.packageJsonInfoCache && !state.packageJsonInfoCache.isReadonly)
|
|
40881
|
+
state.packageJsonInfoCache.setPackageJsonInfo(packageJsonPath, result);
|
|
40882
|
+
(_e = state.affectingLocations) == null ? void 0 : _e.push(packageJsonPath);
|
|
40860
40883
|
return result;
|
|
40861
40884
|
} else {
|
|
40862
40885
|
if (directoryExists && traceEnabled) {
|
|
40863
40886
|
trace(host, Diagnostics.File_0_does_not_exist, packageJsonPath);
|
|
40864
40887
|
}
|
|
40865
|
-
(
|
|
40866
|
-
|
|
40888
|
+
if (state.packageJsonInfoCache && !state.packageJsonInfoCache.isReadonly)
|
|
40889
|
+
state.packageJsonInfoCache.setPackageJsonInfo(packageJsonPath, directoryExists);
|
|
40890
|
+
(_f = state.failedLookupLocations) == null ? void 0 : _f.push(packageJsonPath);
|
|
40867
40891
|
}
|
|
40868
40892
|
}
|
|
40869
40893
|
function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) {
|
|
@@ -41652,7 +41676,8 @@ ${lanes.join("\n")}
|
|
|
41652
41676
|
failedLookupLocations,
|
|
41653
41677
|
affectingLocations,
|
|
41654
41678
|
diagnostics,
|
|
41655
|
-
state
|
|
41679
|
+
state,
|
|
41680
|
+
cache
|
|
41656
41681
|
);
|
|
41657
41682
|
function tryResolve(extensions) {
|
|
41658
41683
|
const resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
@@ -41771,7 +41796,9 @@ ${lanes.join("\n")}
|
|
|
41771
41796
|
failedLookupLocations,
|
|
41772
41797
|
affectingLocations,
|
|
41773
41798
|
diagnostics,
|
|
41774
|
-
state.resultFromCache
|
|
41799
|
+
state.resultFromCache,
|
|
41800
|
+
/*cache*/
|
|
41801
|
+
void 0
|
|
41775
41802
|
);
|
|
41776
41803
|
}
|
|
41777
41804
|
function toSearchResult(value) {
|
|
@@ -75830,8 +75857,20 @@ ${lanes.join("\n")}
|
|
|
75830
75857
|
let hasReturnWithNoExpression = functionHasImplicitReturn(func);
|
|
75831
75858
|
let hasReturnOfTypeNever = false;
|
|
75832
75859
|
forEachReturnStatement(func.body, (returnStatement) => {
|
|
75833
|
-
|
|
75860
|
+
let expr = returnStatement.expression;
|
|
75834
75861
|
if (expr) {
|
|
75862
|
+
expr = skipParentheses(
|
|
75863
|
+
expr,
|
|
75864
|
+
/*excludeJSDocTypeAssertions*/
|
|
75865
|
+
true
|
|
75866
|
+
);
|
|
75867
|
+
if (functionFlags & 2 /* Async */ && expr.kind === 223 /* AwaitExpression */) {
|
|
75868
|
+
expr = skipParentheses(
|
|
75869
|
+
expr.expression,
|
|
75870
|
+
/*excludeJSDocTypeAssertions*/
|
|
75871
|
+
true
|
|
75872
|
+
);
|
|
75873
|
+
}
|
|
75835
75874
|
if (expr.kind === 213 /* CallExpression */ && expr.expression.kind === 80 /* Identifier */ && checkExpressionCached(expr.expression).symbol === func.symbol) {
|
|
75836
75875
|
hasReturnOfTypeNever = true;
|
|
75837
75876
|
return;
|
|
@@ -124126,6 +124165,10 @@ ${lanes.join("\n")}
|
|
|
124126
124165
|
function getRootPathSplitLength(rootPath) {
|
|
124127
124166
|
return rootPath.split(directorySeparator).length - (hasTrailingDirectorySeparator(rootPath) ? 1 : 0);
|
|
124128
124167
|
}
|
|
124168
|
+
function getModuleResolutionHost(resolutionHost) {
|
|
124169
|
+
var _a;
|
|
124170
|
+
return ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
|
|
124171
|
+
}
|
|
124129
124172
|
function createModuleResolutionLoaderUsingGlobalCache(containingFile, redirectedReference, options, resolutionHost, moduleResolutionCache) {
|
|
124130
124173
|
return {
|
|
124131
124174
|
nameAndMode: moduleResolutionNameAndModeGetter,
|
|
@@ -124141,8 +124184,7 @@ ${lanes.join("\n")}
|
|
|
124141
124184
|
};
|
|
124142
124185
|
}
|
|
124143
124186
|
function resolveModuleNameUsingGlobalCache(resolutionHost, moduleResolutionCache, moduleName, containingFile, compilerOptions, redirectedReference, mode) {
|
|
124144
|
-
|
|
124145
|
-
const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
|
|
124187
|
+
const host = getModuleResolutionHost(resolutionHost);
|
|
124146
124188
|
const primaryResult = resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
|
|
124147
124189
|
if (!resolutionHost.getGlobalCache) {
|
|
124148
124190
|
return primaryResult;
|
|
@@ -124313,6 +124355,10 @@ ${lanes.join("\n")}
|
|
|
124313
124355
|
};
|
|
124314
124356
|
}
|
|
124315
124357
|
function startCachingPerDirectoryResolution() {
|
|
124358
|
+
moduleResolutionCache.isReadonly = void 0;
|
|
124359
|
+
typeReferenceDirectiveResolutionCache.isReadonly = void 0;
|
|
124360
|
+
libraryResolutionCache.isReadonly = void 0;
|
|
124361
|
+
moduleResolutionCache.getPackageJsonInfoCache().isReadonly = void 0;
|
|
124316
124362
|
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
124317
124363
|
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
124318
124364
|
libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
@@ -124370,6 +124416,10 @@ ${lanes.join("\n")}
|
|
|
124370
124416
|
directoryWatchesOfFailedLookups.forEach(closeDirectoryWatchesOfFailedLookup);
|
|
124371
124417
|
fileWatchesOfAffectingLocations.forEach(closeFileWatcherOfAffectingLocation);
|
|
124372
124418
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
124419
|
+
moduleResolutionCache.isReadonly = true;
|
|
124420
|
+
typeReferenceDirectiveResolutionCache.isReadonly = true;
|
|
124421
|
+
libraryResolutionCache.isReadonly = true;
|
|
124422
|
+
moduleResolutionCache.getPackageJsonInfoCache().isReadonly = true;
|
|
124373
124423
|
}
|
|
124374
124424
|
function closeDirectoryWatchesOfFailedLookup(watcher, path) {
|
|
124375
124425
|
if (watcher.refCount === 0) {
|
|
@@ -124398,7 +124448,6 @@ ${lanes.join("\n")}
|
|
|
124398
124448
|
shouldRetryResolution,
|
|
124399
124449
|
logChanges
|
|
124400
124450
|
}) {
|
|
124401
|
-
var _a;
|
|
124402
124451
|
const path = resolutionHost.toPath(containingFile);
|
|
124403
124452
|
const resolutionsInFile = perFileCache.get(path) || perFileCache.set(path, createModeAwareCache()).get(path);
|
|
124404
124453
|
const resolvedModules = [];
|
|
@@ -124430,7 +124479,7 @@ ${lanes.join("\n")}
|
|
|
124430
124479
|
logChanges = false;
|
|
124431
124480
|
}
|
|
124432
124481
|
} else {
|
|
124433
|
-
const host = (
|
|
124482
|
+
const host = getModuleResolutionHost(resolutionHost);
|
|
124434
124483
|
if (isTraceEnabled(options, host) && !seenNamesInFile.has(name, mode)) {
|
|
124435
124484
|
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
124436
124485
|
trace(
|
|
@@ -124482,7 +124531,6 @@ ${lanes.join("\n")}
|
|
|
124482
124531
|
}
|
|
124483
124532
|
}
|
|
124484
124533
|
function resolveTypeReferenceDirectiveReferences(typeDirectiveReferences, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
|
|
124485
|
-
var _a;
|
|
124486
124534
|
return resolveNamesWithLocalCache({
|
|
124487
124535
|
entries: typeDirectiveReferences,
|
|
124488
124536
|
containingFile,
|
|
@@ -124495,7 +124543,7 @@ ${lanes.join("\n")}
|
|
|
124495
124543
|
containingFile,
|
|
124496
124544
|
redirectedReference,
|
|
124497
124545
|
options,
|
|
124498
|
-
(
|
|
124546
|
+
getModuleResolutionHost(resolutionHost),
|
|
124499
124547
|
typeReferenceDirectiveResolutionCache
|
|
124500
124548
|
),
|
|
124501
124549
|
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
|
|
@@ -124527,8 +124575,7 @@ ${lanes.join("\n")}
|
|
|
124527
124575
|
});
|
|
124528
124576
|
}
|
|
124529
124577
|
function resolveLibrary2(libraryName, resolveFrom, options, libFileName) {
|
|
124530
|
-
|
|
124531
|
-
const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
|
|
124578
|
+
const host = getModuleResolutionHost(resolutionHost);
|
|
124532
124579
|
let resolution = resolvedLibraries == null ? void 0 : resolvedLibraries.get(libFileName);
|
|
124533
124580
|
if (!resolution || resolution.isInvalidated) {
|
|
124534
124581
|
const existingResolution = resolution;
|
|
@@ -124562,6 +124609,7 @@ ${lanes.join("\n")}
|
|
|
124562
124609
|
return resolution;
|
|
124563
124610
|
}
|
|
124564
124611
|
function resolveSingleModuleNameWithoutWatching(moduleName, containingFile) {
|
|
124612
|
+
var _a, _b;
|
|
124565
124613
|
const path = resolutionHost.toPath(containingFile);
|
|
124566
124614
|
const resolutionsInFile = resolvedModuleNames.get(path);
|
|
124567
124615
|
const resolution = resolutionsInFile == null ? void 0 : resolutionsInFile.get(
|
|
@@ -124571,7 +124619,17 @@ ${lanes.join("\n")}
|
|
|
124571
124619
|
);
|
|
124572
124620
|
if (resolution && !resolution.isInvalidated)
|
|
124573
124621
|
return resolution;
|
|
124574
|
-
|
|
124622
|
+
const data = (_a = resolutionHost.beforeResolveSingleModuleNameWithoutWatching) == null ? void 0 : _a.call(resolutionHost, moduleResolutionCache);
|
|
124623
|
+
const host = getModuleResolutionHost(resolutionHost);
|
|
124624
|
+
const result = resolveModuleName(
|
|
124625
|
+
moduleName,
|
|
124626
|
+
containingFile,
|
|
124627
|
+
resolutionHost.getCompilationSettings(),
|
|
124628
|
+
host,
|
|
124629
|
+
moduleResolutionCache
|
|
124630
|
+
);
|
|
124631
|
+
(_b = resolutionHost.afterResolveSingleModuleNameWithoutWatching) == null ? void 0 : _b.call(resolutionHost, moduleResolutionCache, moduleName, containingFile, result, data);
|
|
124632
|
+
return result;
|
|
124575
124633
|
}
|
|
124576
124634
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
124577
124635
|
return endsWith(dirPath, "/node_modules/@types");
|
|
@@ -165660,7 +165718,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
165660
165718
|
case 275 /* NamedImports */:
|
|
165661
165719
|
case 279 /* NamedExports */:
|
|
165662
165720
|
case 300 /* ImportAttributes */:
|
|
165663
|
-
case 300 /* AssertClause */:
|
|
165664
165721
|
return spanForImportExportElements(n);
|
|
165665
165722
|
}
|
|
165666
165723
|
function spanForImportExportElements(node) {
|
|
@@ -172634,7 +172691,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
172634
172691
|
return fileName[0] === "^" || (fileName.includes("walkThroughSnippet:/") || fileName.includes("untitled:/")) && getBaseFileName(fileName)[0] === "^" || fileName.includes(":^") && !fileName.includes(directorySeparator);
|
|
172635
172692
|
}
|
|
172636
172693
|
function ensurePrimaryProjectKind(project) {
|
|
172637
|
-
if (!project || project
|
|
172694
|
+
if (!project || isBackgroundProject(project)) {
|
|
172638
172695
|
return Errors.ThrowNoProject();
|
|
172639
172696
|
}
|
|
172640
172697
|
return project;
|
|
@@ -173096,7 +173153,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
173096
173153
|
isContainedByBackgroundProject() {
|
|
173097
173154
|
return some(
|
|
173098
173155
|
this.containingProjects,
|
|
173099
|
-
|
|
173156
|
+
isBackgroundProject
|
|
173100
173157
|
);
|
|
173101
173158
|
}
|
|
173102
173159
|
/**
|
|
@@ -173332,6 +173389,9 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
173332
173389
|
function isExternalProject(project) {
|
|
173333
173390
|
return project.projectKind === 2 /* External */;
|
|
173334
173391
|
}
|
|
173392
|
+
function isBackgroundProject(project) {
|
|
173393
|
+
return project.projectKind === 3 /* AutoImportProvider */ || project.projectKind === 4 /* Auxiliary */;
|
|
173394
|
+
}
|
|
173335
173395
|
var ProjectKind, Project3, InferredProject2, AuxiliaryProject, _AutoImportProviderProject, AutoImportProviderProject, ConfiguredProject2, ExternalProject2;
|
|
173336
173396
|
var init_project = __esm({
|
|
173337
173397
|
"src/server/project.ts"() {
|
|
@@ -173448,9 +173508,10 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
173448
173508
|
this.disableLanguageService(lastFileExceededProgramSize);
|
|
173449
173509
|
}
|
|
173450
173510
|
this.markAsDirty();
|
|
173451
|
-
if (
|
|
173511
|
+
if (!isBackgroundProject(this)) {
|
|
173452
173512
|
this.projectService.pendingEnsureProjectForOpenFiles = true;
|
|
173453
173513
|
}
|
|
173514
|
+
this.projectService.onProjectCreation(this);
|
|
173454
173515
|
}
|
|
173455
173516
|
/** @internal */
|
|
173456
173517
|
getResolvedProjectReferenceToRedirect(_fileName) {
|
|
@@ -173620,6 +173681,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
173620
173681
|
resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
|
|
173621
173682
|
return this.resolutionCache.resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames);
|
|
173622
173683
|
}
|
|
173684
|
+
/** @internal */
|
|
173623
173685
|
getModuleResolutionCache() {
|
|
173624
173686
|
return this.resolutionCache.getModuleResolutionCache();
|
|
173625
173687
|
}
|
|
@@ -174898,32 +174960,15 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
174898
174960
|
return this.projectService.getIncompleteCompletionsCache();
|
|
174899
174961
|
}
|
|
174900
174962
|
/** @internal */
|
|
174901
|
-
getNoDtsResolutionProject(
|
|
174963
|
+
getNoDtsResolutionProject(rootFile) {
|
|
174902
174964
|
Debug.assert(this.projectService.serverMode === 0 /* Semantic */);
|
|
174903
174965
|
if (!this.noDtsResolutionProject) {
|
|
174904
174966
|
this.noDtsResolutionProject = new AuxiliaryProject(this.projectService, this.documentRegistry, this.getCompilerOptionsForNoDtsResolutionProject(), this.currentDirectory);
|
|
174905
174967
|
}
|
|
174906
|
-
|
|
174907
|
-
|
|
174908
|
-
this.noDtsResolutionProject.
|
|
174909
|
-
|
|
174910
|
-
(pathToAdd) => {
|
|
174911
|
-
const info = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
|
|
174912
|
-
pathToAdd,
|
|
174913
|
-
this.currentDirectory,
|
|
174914
|
-
this.noDtsResolutionProject.directoryStructureHost
|
|
174915
|
-
);
|
|
174916
|
-
if (info) {
|
|
174917
|
-
this.noDtsResolutionProject.addRoot(info, pathToAdd);
|
|
174918
|
-
}
|
|
174919
|
-
},
|
|
174920
|
-
(pathToRemove) => {
|
|
174921
|
-
const info = this.noDtsResolutionProject.getScriptInfo(pathToRemove);
|
|
174922
|
-
if (info) {
|
|
174923
|
-
this.noDtsResolutionProject.removeRoot(info);
|
|
174924
|
-
}
|
|
174925
|
-
}
|
|
174926
|
-
);
|
|
174968
|
+
if (this.noDtsResolutionProject.rootFile !== rootFile) {
|
|
174969
|
+
this.projectService.setFileNamesOfAutpImportProviderOrAuxillaryProject(this.noDtsResolutionProject, [rootFile]);
|
|
174970
|
+
this.noDtsResolutionProject.rootFile = rootFile;
|
|
174971
|
+
}
|
|
174927
174972
|
return this.noDtsResolutionProject;
|
|
174928
174973
|
}
|
|
174929
174974
|
/** @internal */
|
|
@@ -175230,7 +175275,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
175230
175275
|
this.getCompilationSettings()
|
|
175231
175276
|
);
|
|
175232
175277
|
}
|
|
175233
|
-
this.projectService.
|
|
175278
|
+
this.projectService.setFileNamesOfAutpImportProviderOrAuxillaryProject(this, rootFileNames);
|
|
175234
175279
|
this.rootFileNames = rootFileNames;
|
|
175235
175280
|
const oldProgram = this.getCurrentProgram();
|
|
175236
175281
|
const hasSameSetOfFiles = super.updateGraph();
|
|
@@ -176053,6 +176098,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
176053
176098
|
this.verifyDocumentRegistry = noop;
|
|
176054
176099
|
/** @internal */
|
|
176055
176100
|
this.verifyProgram = noop;
|
|
176101
|
+
/** @internal */
|
|
176102
|
+
this.onProjectCreation = noop;
|
|
176056
176103
|
var _a;
|
|
176057
176104
|
this.host = opts.host;
|
|
176058
176105
|
this.logger = opts.logger;
|
|
@@ -176220,20 +176267,20 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
176220
176267
|
}
|
|
176221
176268
|
delayUpdateProjectGraph(project) {
|
|
176222
176269
|
project.markAsDirty();
|
|
176223
|
-
if (project
|
|
176224
|
-
|
|
176225
|
-
|
|
176226
|
-
|
|
176227
|
-
|
|
176228
|
-
|
|
176229
|
-
|
|
176230
|
-
|
|
176231
|
-
|
|
176232
|
-
|
|
176233
|
-
|
|
176270
|
+
if (isBackgroundProject(project))
|
|
176271
|
+
return;
|
|
176272
|
+
const projectName = project.getProjectName();
|
|
176273
|
+
this.pendingProjectUpdates.set(projectName, project);
|
|
176274
|
+
this.throttledOperations.schedule(
|
|
176275
|
+
projectName,
|
|
176276
|
+
/*delay*/
|
|
176277
|
+
250,
|
|
176278
|
+
() => {
|
|
176279
|
+
if (this.pendingProjectUpdates.delete(projectName)) {
|
|
176280
|
+
updateProjectIfDirty(project);
|
|
176234
176281
|
}
|
|
176235
|
-
|
|
176236
|
-
|
|
176282
|
+
}
|
|
176283
|
+
);
|
|
176237
176284
|
}
|
|
176238
176285
|
/** @internal */
|
|
176239
176286
|
hasPendingProjectUpdate(project) {
|
|
@@ -177090,6 +177137,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
177090
177137
|
addFilesToNonInferredProject(project, files, propertyReader, typeAcquisition) {
|
|
177091
177138
|
this.updateNonInferredProjectFiles(project, files, propertyReader);
|
|
177092
177139
|
project.setTypeAcquisition(typeAcquisition);
|
|
177140
|
+
project.markAsDirty();
|
|
177093
177141
|
}
|
|
177094
177142
|
/** @internal */
|
|
177095
177143
|
createConfiguredProject(configFileName) {
|
|
@@ -177375,7 +177423,6 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
177375
177423
|
}
|
|
177376
177424
|
});
|
|
177377
177425
|
}
|
|
177378
|
-
project.markAsDirty();
|
|
177379
177426
|
}
|
|
177380
177427
|
updateRootAndOptionsOfNonInferredProject(project, newUncheckedFiles, propertyReader, newOptions, newTypeAcquisition, compileOnSave, watchOptions) {
|
|
177381
177428
|
project.setCompilerOptions(newOptions);
|
|
@@ -177394,6 +177441,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
177394
177441
|
const fileNames = this.reloadFileNamesOfParsedConfig(project.getConfigFilePath(), this.configFileExistenceInfoCache.get(project.canonicalConfigFilePath).config);
|
|
177395
177442
|
project.updateErrorOnNoInputFiles(fileNames);
|
|
177396
177443
|
this.updateNonInferredProjectFiles(project, fileNames.concat(project.getExternalFiles(1 /* RootNamesAndUpdate */)), fileNamePropertyReader);
|
|
177444
|
+
project.markAsDirty();
|
|
177397
177445
|
return project.updateGraph();
|
|
177398
177446
|
}
|
|
177399
177447
|
/** @internal */
|
|
@@ -177413,7 +177461,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
177413
177461
|
return fileNames;
|
|
177414
177462
|
}
|
|
177415
177463
|
/** @internal */
|
|
177416
|
-
|
|
177464
|
+
setFileNamesOfAutpImportProviderOrAuxillaryProject(project, fileNames) {
|
|
177417
177465
|
this.updateNonInferredProjectFiles(project, fileNames, fileNamePropertyReader);
|
|
177418
177466
|
}
|
|
177419
177467
|
/**
|
|
@@ -180878,7 +180926,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
180878
180926
|
if (needsJsResolution) {
|
|
180879
180927
|
const definitionSet = createSet((d) => d.textSpan.start, documentSpansEqual);
|
|
180880
180928
|
definitions == null ? void 0 : definitions.forEach((d) => definitionSet.add(d));
|
|
180881
|
-
const noDtsProject = project.getNoDtsResolutionProject(
|
|
180929
|
+
const noDtsProject = project.getNoDtsResolutionProject(file);
|
|
180882
180930
|
const ls = noDtsProject.getLanguageService();
|
|
180883
180931
|
const jsDefinitions = (_a = ls.getDefinitionAtPosition(
|
|
180884
180932
|
file,
|
|
@@ -180905,8 +180953,18 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
180905
180953
|
const ambientCandidates = definitions.filter((d) => toNormalizedPath(d.fileName) !== file && d.isAmbient);
|
|
180906
180954
|
for (const candidate of some(ambientCandidates) ? ambientCandidates : getAmbientCandidatesByClimbingAccessChain()) {
|
|
180907
180955
|
const fileNameToSearch = findImplementationFileFromDtsFileName(candidate.fileName, file, noDtsProject);
|
|
180908
|
-
if (!fileNameToSearch
|
|
180956
|
+
if (!fileNameToSearch)
|
|
180909
180957
|
continue;
|
|
180958
|
+
const info = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
|
|
180959
|
+
fileNameToSearch,
|
|
180960
|
+
noDtsProject.currentDirectory,
|
|
180961
|
+
noDtsProject.directoryStructureHost
|
|
180962
|
+
);
|
|
180963
|
+
if (!info)
|
|
180964
|
+
continue;
|
|
180965
|
+
if (!noDtsProject.containsScriptInfo(info)) {
|
|
180966
|
+
noDtsProject.addRoot(info);
|
|
180967
|
+
noDtsProject.updateGraph();
|
|
180910
180968
|
}
|
|
180911
180969
|
const noDtsProgram = ls.getProgram();
|
|
180912
180970
|
const fileToSearch = Debug.checkDefined(noDtsProgram.getSourceFile(fileNameToSearch));
|
|
@@ -181009,16 +181067,6 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
181009
181067
|
}
|
|
181010
181068
|
});
|
|
181011
181069
|
}
|
|
181012
|
-
function ensureRoot(project2, fileName) {
|
|
181013
|
-
const info = project2.getScriptInfo(fileName);
|
|
181014
|
-
if (!info)
|
|
181015
|
-
return false;
|
|
181016
|
-
if (!project2.containsScriptInfo(info)) {
|
|
181017
|
-
project2.addRoot(info);
|
|
181018
|
-
project2.updateGraph();
|
|
181019
|
-
}
|
|
181020
|
-
return true;
|
|
181021
|
-
}
|
|
181022
181070
|
}
|
|
181023
181071
|
getEmitOutput(args) {
|
|
181024
181072
|
const { file, project } = this.getFileAndProject(args);
|
|
@@ -183278,6 +183326,7 @@ ${e.message}`;
|
|
|
183278
183326
|
hasArgument: () => hasArgument,
|
|
183279
183327
|
hasNoTypeScriptSource: () => hasNoTypeScriptSource,
|
|
183280
183328
|
indent: () => indent2,
|
|
183329
|
+
isBackgroundProject: () => isBackgroundProject,
|
|
183281
183330
|
isConfigFile: () => isConfigFile,
|
|
183282
183331
|
isConfiguredProject: () => isConfiguredProject,
|
|
183283
183332
|
isDynamicFileName: () => isDynamicFileName,
|
|
@@ -185697,6 +185746,7 @@ ${e.message}`;
|
|
|
185697
185746
|
hasArgument: () => hasArgument,
|
|
185698
185747
|
hasNoTypeScriptSource: () => hasNoTypeScriptSource,
|
|
185699
185748
|
indent: () => indent2,
|
|
185749
|
+
isBackgroundProject: () => isBackgroundProject,
|
|
185700
185750
|
isConfigFile: () => isConfigFile,
|
|
185701
185751
|
isConfiguredProject: () => isConfiguredProject,
|
|
185702
185752
|
isDynamicFileName: () => isDynamicFileName,
|