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/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.3";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20231012`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -36904,7 +36904,7 @@ function resolvedTypeScriptOnly(resolved) {
|
|
|
36904
36904
|
Debug.assert(extensionIsTS(resolved.extension));
|
|
36905
36905
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
36906
36906
|
}
|
|
36907
|
-
function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, legacyResult) {
|
|
36907
|
+
function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, cache, legacyResult) {
|
|
36908
36908
|
if (!state.resultFromCache && !state.compilerOptions.preserveSymlinks && resolved && isExternalLibraryImport && !resolved.originalPath && !isExternalModuleNameRelative(moduleName)) {
|
|
36909
36909
|
const { resolvedFileName, originalPath } = getOriginalAndResolvedFileName(resolved.path, state.host, state.traceEnabled);
|
|
36910
36910
|
if (originalPath)
|
|
@@ -36917,15 +36917,25 @@ function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName
|
|
|
36917
36917
|
affectingLocations,
|
|
36918
36918
|
diagnostics,
|
|
36919
36919
|
state.resultFromCache,
|
|
36920
|
+
cache,
|
|
36920
36921
|
legacyResult
|
|
36921
36922
|
);
|
|
36922
36923
|
}
|
|
36923
|
-
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, legacyResult) {
|
|
36924
|
+
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, cache, legacyResult) {
|
|
36924
36925
|
if (resultFromCache) {
|
|
36925
|
-
|
|
36926
|
-
|
|
36927
|
-
|
|
36928
|
-
|
|
36926
|
+
if (!(cache == null ? void 0 : cache.isReadonly)) {
|
|
36927
|
+
resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
|
|
36928
|
+
resultFromCache.affectingLocations = updateResolutionField(resultFromCache.affectingLocations, affectingLocations);
|
|
36929
|
+
resultFromCache.resolutionDiagnostics = updateResolutionField(resultFromCache.resolutionDiagnostics, diagnostics);
|
|
36930
|
+
return resultFromCache;
|
|
36931
|
+
} else {
|
|
36932
|
+
return {
|
|
36933
|
+
...resultFromCache,
|
|
36934
|
+
failedLookupLocations: initializeResolutionFieldForReadonlyCache(resultFromCache.failedLookupLocations, failedLookupLocations),
|
|
36935
|
+
affectingLocations: initializeResolutionFieldForReadonlyCache(resultFromCache.affectingLocations, affectingLocations),
|
|
36936
|
+
resolutionDiagnostics: initializeResolutionFieldForReadonlyCache(resultFromCache.resolutionDiagnostics, diagnostics)
|
|
36937
|
+
};
|
|
36938
|
+
}
|
|
36929
36939
|
}
|
|
36930
36940
|
return {
|
|
36931
36941
|
resolvedModule: resolved && {
|
|
@@ -36953,6 +36963,13 @@ function updateResolutionField(to, value) {
|
|
|
36953
36963
|
to.push(...value);
|
|
36954
36964
|
return to;
|
|
36955
36965
|
}
|
|
36966
|
+
function initializeResolutionFieldForReadonlyCache(fromCache, value) {
|
|
36967
|
+
if (!(fromCache == null ? void 0 : fromCache.length))
|
|
36968
|
+
return initializeResolutionField(value);
|
|
36969
|
+
if (!value.length)
|
|
36970
|
+
return fromCache.slice();
|
|
36971
|
+
return [...fromCache, ...value];
|
|
36972
|
+
}
|
|
36956
36973
|
function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
|
|
36957
36974
|
if (!hasProperty(jsonContent, fieldName)) {
|
|
36958
36975
|
if (state.traceEnabled) {
|
|
@@ -37180,15 +37197,15 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
37180
37197
|
affectingLocations: initializeResolutionField(affectingLocations),
|
|
37181
37198
|
resolutionDiagnostics: initializeResolutionField(diagnostics)
|
|
37182
37199
|
};
|
|
37183
|
-
if (containingDirectory) {
|
|
37184
|
-
cache
|
|
37200
|
+
if (containingDirectory && cache && !cache.isReadonly) {
|
|
37201
|
+
cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(
|
|
37185
37202
|
typeReferenceDirectiveName,
|
|
37186
37203
|
/*mode*/
|
|
37187
37204
|
resolutionMode,
|
|
37188
37205
|
result
|
|
37189
37206
|
);
|
|
37190
37207
|
if (!isExternalModuleNameRelative(typeReferenceDirectiveName)) {
|
|
37191
|
-
cache
|
|
37208
|
+
cache.getOrCreateCacheForNonRelativeName(typeReferenceDirectiveName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
37192
37209
|
}
|
|
37193
37210
|
}
|
|
37194
37211
|
if (traceEnabled)
|
|
@@ -37380,7 +37397,8 @@ function createCacheWithRedirects(ownOptions, optionsToRedirectsKey) {
|
|
|
37380
37397
|
getMapOfCacheRedirects,
|
|
37381
37398
|
getOrCreateMapOfCacheRedirects,
|
|
37382
37399
|
update,
|
|
37383
|
-
clear: clear2
|
|
37400
|
+
clear: clear2,
|
|
37401
|
+
getOwnMap: () => ownMap
|
|
37384
37402
|
};
|
|
37385
37403
|
function getMapOfCacheRedirects(redirectedReference) {
|
|
37386
37404
|
return redirectedReference ? getOrCreateMap(
|
|
@@ -37487,7 +37505,8 @@ function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileNam
|
|
|
37487
37505
|
getFromDirectoryCache,
|
|
37488
37506
|
getOrCreateCacheForDirectory,
|
|
37489
37507
|
clear: clear2,
|
|
37490
|
-
update
|
|
37508
|
+
update,
|
|
37509
|
+
directoryToModuleNameMap
|
|
37491
37510
|
};
|
|
37492
37511
|
function clear2() {
|
|
37493
37512
|
directoryToModuleNameMap.clear();
|
|
@@ -37751,9 +37770,11 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
37751
37770
|
if (result && result.resolvedModule)
|
|
37752
37771
|
(_b = perfLogger) == null ? void 0 : _b.logInfoEvent(`Module "${moduleName}" resolved to "${result.resolvedModule.resolvedFileName}"`);
|
|
37753
37772
|
(_c = perfLogger) == null ? void 0 : _c.logStopResolveModule(result && result.resolvedModule ? "" + result.resolvedModule.resolvedFileName : "null");
|
|
37754
|
-
cache
|
|
37755
|
-
|
|
37756
|
-
|
|
37773
|
+
if (cache && !cache.isReadonly) {
|
|
37774
|
+
cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(moduleName, resolutionMode, result);
|
|
37775
|
+
if (!isExternalModuleNameRelative(moduleName)) {
|
|
37776
|
+
cache.getOrCreateCacheForNonRelativeName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
37777
|
+
}
|
|
37757
37778
|
}
|
|
37758
37779
|
}
|
|
37759
37780
|
if (traceEnabled) {
|
|
@@ -38055,6 +38076,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
38055
38076
|
affectingLocations,
|
|
38056
38077
|
diagnostics,
|
|
38057
38078
|
state,
|
|
38079
|
+
cache,
|
|
38058
38080
|
legacyResult
|
|
38059
38081
|
);
|
|
38060
38082
|
function tryResolve(extensions2, state2) {
|
|
@@ -38334,7 +38356,7 @@ function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
|
|
|
38334
38356
|
return packageJsonInfo.contents.versionPaths || void 0;
|
|
38335
38357
|
}
|
|
38336
38358
|
function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
38337
|
-
var _a, _b, _c, _d, _e, _f
|
|
38359
|
+
var _a, _b, _c, _d, _e, _f;
|
|
38338
38360
|
const { host, traceEnabled } = state;
|
|
38339
38361
|
const packageJsonPath = combinePaths(packageDirectory, "package.json");
|
|
38340
38362
|
if (onlyRecordFailures) {
|
|
@@ -38362,15 +38384,17 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
|
38362
38384
|
trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
38363
38385
|
}
|
|
38364
38386
|
const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
|
|
38365
|
-
(
|
|
38366
|
-
|
|
38387
|
+
if (state.packageJsonInfoCache && !state.packageJsonInfoCache.isReadonly)
|
|
38388
|
+
state.packageJsonInfoCache.setPackageJsonInfo(packageJsonPath, result);
|
|
38389
|
+
(_e = state.affectingLocations) == null ? void 0 : _e.push(packageJsonPath);
|
|
38367
38390
|
return result;
|
|
38368
38391
|
} else {
|
|
38369
38392
|
if (directoryExists && traceEnabled) {
|
|
38370
38393
|
trace(host, Diagnostics.File_0_does_not_exist, packageJsonPath);
|
|
38371
38394
|
}
|
|
38372
|
-
(
|
|
38373
|
-
|
|
38395
|
+
if (state.packageJsonInfoCache && !state.packageJsonInfoCache.isReadonly)
|
|
38396
|
+
state.packageJsonInfoCache.setPackageJsonInfo(packageJsonPath, directoryExists);
|
|
38397
|
+
(_f = state.failedLookupLocations) == null ? void 0 : _f.push(packageJsonPath);
|
|
38374
38398
|
}
|
|
38375
38399
|
}
|
|
38376
38400
|
function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) {
|
|
@@ -39160,7 +39184,8 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
39160
39184
|
failedLookupLocations,
|
|
39161
39185
|
affectingLocations,
|
|
39162
39186
|
diagnostics,
|
|
39163
|
-
state
|
|
39187
|
+
state,
|
|
39188
|
+
cache
|
|
39164
39189
|
);
|
|
39165
39190
|
function tryResolve(extensions) {
|
|
39166
39191
|
const resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
@@ -39279,7 +39304,9 @@ function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, hos
|
|
|
39279
39304
|
failedLookupLocations,
|
|
39280
39305
|
affectingLocations,
|
|
39281
39306
|
diagnostics,
|
|
39282
|
-
state.resultFromCache
|
|
39307
|
+
state.resultFromCache,
|
|
39308
|
+
/*cache*/
|
|
39309
|
+
void 0
|
|
39283
39310
|
);
|
|
39284
39311
|
}
|
|
39285
39312
|
function toSearchResult(value) {
|
|
@@ -73351,8 +73378,20 @@ function createTypeChecker(host) {
|
|
|
73351
73378
|
let hasReturnWithNoExpression = functionHasImplicitReturn(func);
|
|
73352
73379
|
let hasReturnOfTypeNever = false;
|
|
73353
73380
|
forEachReturnStatement(func.body, (returnStatement) => {
|
|
73354
|
-
|
|
73381
|
+
let expr = returnStatement.expression;
|
|
73355
73382
|
if (expr) {
|
|
73383
|
+
expr = skipParentheses(
|
|
73384
|
+
expr,
|
|
73385
|
+
/*excludeJSDocTypeAssertions*/
|
|
73386
|
+
true
|
|
73387
|
+
);
|
|
73388
|
+
if (functionFlags & 2 /* Async */ && expr.kind === 223 /* AwaitExpression */) {
|
|
73389
|
+
expr = skipParentheses(
|
|
73390
|
+
expr.expression,
|
|
73391
|
+
/*excludeJSDocTypeAssertions*/
|
|
73392
|
+
true
|
|
73393
|
+
);
|
|
73394
|
+
}
|
|
73356
73395
|
if (expr.kind === 213 /* CallExpression */ && expr.expression.kind === 80 /* Identifier */ && checkExpressionCached(expr.expression).symbol === func.symbol) {
|
|
73357
73396
|
hasReturnOfTypeNever = true;
|
|
73358
73397
|
return;
|
|
@@ -121000,6 +121039,10 @@ function getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirec
|
|
|
121000
121039
|
const normalized = getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory());
|
|
121001
121040
|
return !isDiskPathRoot(normalized) ? removeTrailingDirectorySeparator(normalized) : normalized;
|
|
121002
121041
|
}
|
|
121042
|
+
function getModuleResolutionHost(resolutionHost) {
|
|
121043
|
+
var _a;
|
|
121044
|
+
return ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
|
|
121045
|
+
}
|
|
121003
121046
|
function createModuleResolutionLoaderUsingGlobalCache(containingFile, redirectedReference, options, resolutionHost, moduleResolutionCache) {
|
|
121004
121047
|
return {
|
|
121005
121048
|
nameAndMode: moduleResolutionNameAndModeGetter,
|
|
@@ -121015,8 +121058,7 @@ function createModuleResolutionLoaderUsingGlobalCache(containingFile, redirected
|
|
|
121015
121058
|
};
|
|
121016
121059
|
}
|
|
121017
121060
|
function resolveModuleNameUsingGlobalCache(resolutionHost, moduleResolutionCache, moduleName, containingFile, compilerOptions, redirectedReference, mode) {
|
|
121018
|
-
|
|
121019
|
-
const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
|
|
121061
|
+
const host = getModuleResolutionHost(resolutionHost);
|
|
121020
121062
|
const primaryResult = resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
|
|
121021
121063
|
if (!resolutionHost.getGlobalCache) {
|
|
121022
121064
|
return primaryResult;
|
|
@@ -121187,6 +121229,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121187
121229
|
};
|
|
121188
121230
|
}
|
|
121189
121231
|
function startCachingPerDirectoryResolution() {
|
|
121232
|
+
moduleResolutionCache.isReadonly = void 0;
|
|
121233
|
+
typeReferenceDirectiveResolutionCache.isReadonly = void 0;
|
|
121234
|
+
libraryResolutionCache.isReadonly = void 0;
|
|
121235
|
+
moduleResolutionCache.getPackageJsonInfoCache().isReadonly = void 0;
|
|
121190
121236
|
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
121191
121237
|
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
121192
121238
|
libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
@@ -121244,6 +121290,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121244
121290
|
directoryWatchesOfFailedLookups.forEach(closeDirectoryWatchesOfFailedLookup);
|
|
121245
121291
|
fileWatchesOfAffectingLocations.forEach(closeFileWatcherOfAffectingLocation);
|
|
121246
121292
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
121293
|
+
moduleResolutionCache.isReadonly = true;
|
|
121294
|
+
typeReferenceDirectiveResolutionCache.isReadonly = true;
|
|
121295
|
+
libraryResolutionCache.isReadonly = true;
|
|
121296
|
+
moduleResolutionCache.getPackageJsonInfoCache().isReadonly = true;
|
|
121247
121297
|
}
|
|
121248
121298
|
function closeDirectoryWatchesOfFailedLookup(watcher, path) {
|
|
121249
121299
|
if (watcher.refCount === 0) {
|
|
@@ -121272,7 +121322,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121272
121322
|
shouldRetryResolution,
|
|
121273
121323
|
logChanges
|
|
121274
121324
|
}) {
|
|
121275
|
-
var _a;
|
|
121276
121325
|
const path = resolutionHost.toPath(containingFile);
|
|
121277
121326
|
const resolutionsInFile = perFileCache.get(path) || perFileCache.set(path, createModeAwareCache()).get(path);
|
|
121278
121327
|
const resolvedModules = [];
|
|
@@ -121304,7 +121353,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121304
121353
|
logChanges = false;
|
|
121305
121354
|
}
|
|
121306
121355
|
} else {
|
|
121307
|
-
const host = (
|
|
121356
|
+
const host = getModuleResolutionHost(resolutionHost);
|
|
121308
121357
|
if (isTraceEnabled(options, host) && !seenNamesInFile.has(name, mode)) {
|
|
121309
121358
|
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
121310
121359
|
trace(
|
|
@@ -121356,7 +121405,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121356
121405
|
}
|
|
121357
121406
|
}
|
|
121358
121407
|
function resolveTypeReferenceDirectiveReferences(typeDirectiveReferences, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
|
|
121359
|
-
var _a;
|
|
121360
121408
|
return resolveNamesWithLocalCache({
|
|
121361
121409
|
entries: typeDirectiveReferences,
|
|
121362
121410
|
containingFile,
|
|
@@ -121369,7 +121417,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121369
121417
|
containingFile,
|
|
121370
121418
|
redirectedReference,
|
|
121371
121419
|
options,
|
|
121372
|
-
(
|
|
121420
|
+
getModuleResolutionHost(resolutionHost),
|
|
121373
121421
|
typeReferenceDirectiveResolutionCache
|
|
121374
121422
|
),
|
|
121375
121423
|
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
|
|
@@ -121401,8 +121449,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121401
121449
|
});
|
|
121402
121450
|
}
|
|
121403
121451
|
function resolveLibrary2(libraryName, resolveFrom, options, libFileName) {
|
|
121404
|
-
|
|
121405
|
-
const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
|
|
121452
|
+
const host = getModuleResolutionHost(resolutionHost);
|
|
121406
121453
|
let resolution = resolvedLibraries == null ? void 0 : resolvedLibraries.get(libFileName);
|
|
121407
121454
|
if (!resolution || resolution.isInvalidated) {
|
|
121408
121455
|
const existingResolution = resolution;
|
|
@@ -121436,6 +121483,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121436
121483
|
return resolution;
|
|
121437
121484
|
}
|
|
121438
121485
|
function resolveSingleModuleNameWithoutWatching(moduleName, containingFile) {
|
|
121486
|
+
var _a, _b;
|
|
121439
121487
|
const path = resolutionHost.toPath(containingFile);
|
|
121440
121488
|
const resolutionsInFile = resolvedModuleNames.get(path);
|
|
121441
121489
|
const resolution = resolutionsInFile == null ? void 0 : resolutionsInFile.get(
|
|
@@ -121445,7 +121493,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121445
121493
|
);
|
|
121446
121494
|
if (resolution && !resolution.isInvalidated)
|
|
121447
121495
|
return resolution;
|
|
121448
|
-
|
|
121496
|
+
const data = (_a = resolutionHost.beforeResolveSingleModuleNameWithoutWatching) == null ? void 0 : _a.call(resolutionHost, moduleResolutionCache);
|
|
121497
|
+
const host = getModuleResolutionHost(resolutionHost);
|
|
121498
|
+
const result = resolveModuleName(
|
|
121499
|
+
moduleName,
|
|
121500
|
+
containingFile,
|
|
121501
|
+
resolutionHost.getCompilationSettings(),
|
|
121502
|
+
host,
|
|
121503
|
+
moduleResolutionCache
|
|
121504
|
+
);
|
|
121505
|
+
(_b = resolutionHost.afterResolveSingleModuleNameWithoutWatching) == null ? void 0 : _b.call(resolutionHost, moduleResolutionCache, moduleName, containingFile, result, data);
|
|
121506
|
+
return result;
|
|
121449
121507
|
}
|
|
121450
121508
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
121451
121509
|
return endsWith(dirPath, "/node_modules/@types");
|