typescript 5.3.0-dev.20231009 → 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 +168 -76
- package/lib/tsserver.js +265 -179
- package/lib/typescript.d.ts +15 -3
- package/lib/typescript.js +265 -179
- 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.20231011`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -13637,6 +13637,7 @@ function tryGetModuleSpecifierFromDeclaration(node) {
|
|
|
13637
13637
|
true
|
|
13638
13638
|
))) == null ? void 0 : _a.arguments[0];
|
|
13639
13639
|
case 272 /* ImportDeclaration */:
|
|
13640
|
+
case 278 /* ExportDeclaration */:
|
|
13640
13641
|
return tryCast(node.moduleSpecifier, isStringLiteralLike);
|
|
13641
13642
|
case 271 /* ImportEqualsDeclaration */:
|
|
13642
13643
|
return tryCast((_b = tryCast(node.moduleReference, isExternalModuleReference)) == null ? void 0 : _b.expression, isStringLiteralLike);
|
|
@@ -13648,6 +13649,8 @@ function tryGetModuleSpecifierFromDeclaration(node) {
|
|
|
13648
13649
|
return tryCast(node.parent.parent.moduleSpecifier, isStringLiteralLike);
|
|
13649
13650
|
case 276 /* ImportSpecifier */:
|
|
13650
13651
|
return tryCast(node.parent.parent.parent.moduleSpecifier, isStringLiteralLike);
|
|
13652
|
+
case 205 /* ImportType */:
|
|
13653
|
+
return isLiteralImportTypeNode(node) ? node.argument.literal : void 0;
|
|
13651
13654
|
default:
|
|
13652
13655
|
Debug.assertNever(node);
|
|
13653
13656
|
}
|
|
@@ -36901,7 +36904,7 @@ function resolvedTypeScriptOnly(resolved) {
|
|
|
36901
36904
|
Debug.assert(extensionIsTS(resolved.extension));
|
|
36902
36905
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
36903
36906
|
}
|
|
36904
|
-
function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, legacyResult) {
|
|
36907
|
+
function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, cache, legacyResult) {
|
|
36905
36908
|
if (!state.resultFromCache && !state.compilerOptions.preserveSymlinks && resolved && isExternalLibraryImport && !resolved.originalPath && !isExternalModuleNameRelative(moduleName)) {
|
|
36906
36909
|
const { resolvedFileName, originalPath } = getOriginalAndResolvedFileName(resolved.path, state.host, state.traceEnabled);
|
|
36907
36910
|
if (originalPath)
|
|
@@ -36914,15 +36917,25 @@ function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName
|
|
|
36914
36917
|
affectingLocations,
|
|
36915
36918
|
diagnostics,
|
|
36916
36919
|
state.resultFromCache,
|
|
36920
|
+
cache,
|
|
36917
36921
|
legacyResult
|
|
36918
36922
|
);
|
|
36919
36923
|
}
|
|
36920
|
-
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, legacyResult) {
|
|
36924
|
+
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, cache, legacyResult) {
|
|
36921
36925
|
if (resultFromCache) {
|
|
36922
|
-
|
|
36923
|
-
|
|
36924
|
-
|
|
36925
|
-
|
|
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
|
+
}
|
|
36926
36939
|
}
|
|
36927
36940
|
return {
|
|
36928
36941
|
resolvedModule: resolved && {
|
|
@@ -36950,6 +36963,13 @@ function updateResolutionField(to, value) {
|
|
|
36950
36963
|
to.push(...value);
|
|
36951
36964
|
return to;
|
|
36952
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
|
+
}
|
|
36953
36973
|
function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
|
|
36954
36974
|
if (!hasProperty(jsonContent, fieldName)) {
|
|
36955
36975
|
if (state.traceEnabled) {
|
|
@@ -37177,15 +37197,15 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
37177
37197
|
affectingLocations: initializeResolutionField(affectingLocations),
|
|
37178
37198
|
resolutionDiagnostics: initializeResolutionField(diagnostics)
|
|
37179
37199
|
};
|
|
37180
|
-
if (containingDirectory) {
|
|
37181
|
-
cache
|
|
37200
|
+
if (containingDirectory && cache && !cache.isReadonly) {
|
|
37201
|
+
cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(
|
|
37182
37202
|
typeReferenceDirectiveName,
|
|
37183
37203
|
/*mode*/
|
|
37184
37204
|
resolutionMode,
|
|
37185
37205
|
result
|
|
37186
37206
|
);
|
|
37187
37207
|
if (!isExternalModuleNameRelative(typeReferenceDirectiveName)) {
|
|
37188
|
-
cache
|
|
37208
|
+
cache.getOrCreateCacheForNonRelativeName(typeReferenceDirectiveName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
37189
37209
|
}
|
|
37190
37210
|
}
|
|
37191
37211
|
if (traceEnabled)
|
|
@@ -37377,7 +37397,8 @@ function createCacheWithRedirects(ownOptions, optionsToRedirectsKey) {
|
|
|
37377
37397
|
getMapOfCacheRedirects,
|
|
37378
37398
|
getOrCreateMapOfCacheRedirects,
|
|
37379
37399
|
update,
|
|
37380
|
-
clear: clear2
|
|
37400
|
+
clear: clear2,
|
|
37401
|
+
getOwnMap: () => ownMap
|
|
37381
37402
|
};
|
|
37382
37403
|
function getMapOfCacheRedirects(redirectedReference) {
|
|
37383
37404
|
return redirectedReference ? getOrCreateMap(
|
|
@@ -37484,7 +37505,8 @@ function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileNam
|
|
|
37484
37505
|
getFromDirectoryCache,
|
|
37485
37506
|
getOrCreateCacheForDirectory,
|
|
37486
37507
|
clear: clear2,
|
|
37487
|
-
update
|
|
37508
|
+
update,
|
|
37509
|
+
directoryToModuleNameMap
|
|
37488
37510
|
};
|
|
37489
37511
|
function clear2() {
|
|
37490
37512
|
directoryToModuleNameMap.clear();
|
|
@@ -37748,9 +37770,11 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
37748
37770
|
if (result && result.resolvedModule)
|
|
37749
37771
|
(_b = perfLogger) == null ? void 0 : _b.logInfoEvent(`Module "${moduleName}" resolved to "${result.resolvedModule.resolvedFileName}"`);
|
|
37750
37772
|
(_c = perfLogger) == null ? void 0 : _c.logStopResolveModule(result && result.resolvedModule ? "" + result.resolvedModule.resolvedFileName : "null");
|
|
37751
|
-
cache
|
|
37752
|
-
|
|
37753
|
-
|
|
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
|
+
}
|
|
37754
37778
|
}
|
|
37755
37779
|
}
|
|
37756
37780
|
if (traceEnabled) {
|
|
@@ -38052,6 +38076,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
38052
38076
|
affectingLocations,
|
|
38053
38077
|
diagnostics,
|
|
38054
38078
|
state,
|
|
38079
|
+
cache,
|
|
38055
38080
|
legacyResult
|
|
38056
38081
|
);
|
|
38057
38082
|
function tryResolve(extensions2, state2) {
|
|
@@ -38331,7 +38356,7 @@ function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
|
|
|
38331
38356
|
return packageJsonInfo.contents.versionPaths || void 0;
|
|
38332
38357
|
}
|
|
38333
38358
|
function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
38334
|
-
var _a, _b, _c, _d, _e, _f
|
|
38359
|
+
var _a, _b, _c, _d, _e, _f;
|
|
38335
38360
|
const { host, traceEnabled } = state;
|
|
38336
38361
|
const packageJsonPath = combinePaths(packageDirectory, "package.json");
|
|
38337
38362
|
if (onlyRecordFailures) {
|
|
@@ -38359,15 +38384,17 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
|
38359
38384
|
trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
38360
38385
|
}
|
|
38361
38386
|
const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
|
|
38362
|
-
(
|
|
38363
|
-
|
|
38387
|
+
if (state.packageJsonInfoCache && !state.packageJsonInfoCache.isReadonly)
|
|
38388
|
+
state.packageJsonInfoCache.setPackageJsonInfo(packageJsonPath, result);
|
|
38389
|
+
(_e = state.affectingLocations) == null ? void 0 : _e.push(packageJsonPath);
|
|
38364
38390
|
return result;
|
|
38365
38391
|
} else {
|
|
38366
38392
|
if (directoryExists && traceEnabled) {
|
|
38367
38393
|
trace(host, Diagnostics.File_0_does_not_exist, packageJsonPath);
|
|
38368
38394
|
}
|
|
38369
|
-
(
|
|
38370
|
-
|
|
38395
|
+
if (state.packageJsonInfoCache && !state.packageJsonInfoCache.isReadonly)
|
|
38396
|
+
state.packageJsonInfoCache.setPackageJsonInfo(packageJsonPath, directoryExists);
|
|
38397
|
+
(_f = state.failedLookupLocations) == null ? void 0 : _f.push(packageJsonPath);
|
|
38371
38398
|
}
|
|
38372
38399
|
}
|
|
38373
38400
|
function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) {
|
|
@@ -39157,7 +39184,8 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
39157
39184
|
failedLookupLocations,
|
|
39158
39185
|
affectingLocations,
|
|
39159
39186
|
diagnostics,
|
|
39160
|
-
state
|
|
39187
|
+
state,
|
|
39188
|
+
cache
|
|
39161
39189
|
);
|
|
39162
39190
|
function tryResolve(extensions) {
|
|
39163
39191
|
const resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
@@ -39276,7 +39304,9 @@ function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, hos
|
|
|
39276
39304
|
failedLookupLocations,
|
|
39277
39305
|
affectingLocations,
|
|
39278
39306
|
diagnostics,
|
|
39279
|
-
state.resultFromCache
|
|
39307
|
+
state.resultFromCache,
|
|
39308
|
+
/*cache*/
|
|
39309
|
+
void 0
|
|
39280
39310
|
);
|
|
39281
39311
|
}
|
|
39282
39312
|
function toSearchResult(value) {
|
|
@@ -65732,7 +65762,7 @@ function createTypeChecker(host) {
|
|
|
65732
65762
|
return createFlowType(narrowedType, isIncomplete(flowType));
|
|
65733
65763
|
}
|
|
65734
65764
|
function getTypeAtSwitchClause(flow) {
|
|
65735
|
-
const expr = flow.switchStatement.expression;
|
|
65765
|
+
const expr = skipParentheses(flow.switchStatement.expression);
|
|
65736
65766
|
const flowType = getTypeAtFlowNode(flow.antecedent);
|
|
65737
65767
|
let type = getTypeFromFlowType(flowType);
|
|
65738
65768
|
if (isMatchingReference(reference, expr)) {
|
|
@@ -73348,8 +73378,20 @@ function createTypeChecker(host) {
|
|
|
73348
73378
|
let hasReturnWithNoExpression = functionHasImplicitReturn(func);
|
|
73349
73379
|
let hasReturnOfTypeNever = false;
|
|
73350
73380
|
forEachReturnStatement(func.body, (returnStatement) => {
|
|
73351
|
-
|
|
73381
|
+
let expr = returnStatement.expression;
|
|
73352
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
|
+
}
|
|
73353
73395
|
if (expr.kind === 213 /* CallExpression */ && expr.expression.kind === 80 /* Identifier */ && checkExpressionCached(expr.expression).symbol === func.symbol) {
|
|
73354
73396
|
hasReturnOfTypeNever = true;
|
|
73355
73397
|
return;
|
|
@@ -82326,7 +82368,16 @@ function createTypeChecker(host) {
|
|
|
82326
82368
|
}
|
|
82327
82369
|
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker, bundled);
|
|
82328
82370
|
},
|
|
82329
|
-
isImportRequiredByAugmentation
|
|
82371
|
+
isImportRequiredByAugmentation,
|
|
82372
|
+
tryFindAmbientModule: (moduleReferenceExpression) => {
|
|
82373
|
+
const node = getParseTreeNode(moduleReferenceExpression);
|
|
82374
|
+
const moduleSpecifier = node && isStringLiteralLike(node) ? node.text : void 0;
|
|
82375
|
+
return moduleSpecifier !== void 0 ? tryFindAmbientModule(
|
|
82376
|
+
moduleSpecifier,
|
|
82377
|
+
/*withAugmentations*/
|
|
82378
|
+
true
|
|
82379
|
+
) : void 0;
|
|
82380
|
+
}
|
|
82330
82381
|
};
|
|
82331
82382
|
function isImportRequiredByAugmentation(node) {
|
|
82332
82383
|
const file = getSourceFileOfNode(node);
|
|
@@ -107086,6 +107137,17 @@ function transformDeclarations(context) {
|
|
|
107086
107137
|
const container = getSourceFileOfNode(node);
|
|
107087
107138
|
refs.set(getOriginalNodeId(container), container);
|
|
107088
107139
|
}
|
|
107140
|
+
function trackReferencedAmbientModuleFromImport(node) {
|
|
107141
|
+
const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(node);
|
|
107142
|
+
const symbol = moduleSpecifier && resolver.tryFindAmbientModule(moduleSpecifier);
|
|
107143
|
+
if (symbol == null ? void 0 : symbol.declarations) {
|
|
107144
|
+
for (const decl of symbol.declarations) {
|
|
107145
|
+
if (isAmbientModule(decl) && getSourceFileOfNode(decl) !== currentSourceFile) {
|
|
107146
|
+
trackReferencedAmbientModule(decl, symbol);
|
|
107147
|
+
}
|
|
107148
|
+
}
|
|
107149
|
+
}
|
|
107150
|
+
}
|
|
107089
107151
|
function handleSymbolAccessibilityError(symbolAccessibilityResult) {
|
|
107090
107152
|
if (symbolAccessibilityResult.accessibility === 0 /* Accessible */) {
|
|
107091
107153
|
if (symbolAccessibilityResult && symbolAccessibilityResult.aliasesToMakeVisible) {
|
|
@@ -108033,6 +108095,7 @@ function transformDeclarations(context) {
|
|
|
108033
108095
|
case 205 /* ImportType */: {
|
|
108034
108096
|
if (!isLiteralImportTypeNode(input))
|
|
108035
108097
|
return cleanup(input);
|
|
108098
|
+
trackReferencedAmbientModuleFromImport(input);
|
|
108036
108099
|
return cleanup(factory2.updateImportTypeNode(
|
|
108037
108100
|
input,
|
|
108038
108101
|
factory2.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)),
|
|
@@ -108084,6 +108147,7 @@ function transformDeclarations(context) {
|
|
|
108084
108147
|
resultHasExternalModuleIndicator = true;
|
|
108085
108148
|
}
|
|
108086
108149
|
resultHasScopeMarker = true;
|
|
108150
|
+
trackReferencedAmbientModuleFromImport(input);
|
|
108087
108151
|
return factory2.updateExportDeclaration(
|
|
108088
108152
|
input,
|
|
108089
108153
|
input.modifiers,
|
|
@@ -108158,10 +108222,18 @@ function transformDeclarations(context) {
|
|
|
108158
108222
|
return;
|
|
108159
108223
|
switch (input.kind) {
|
|
108160
108224
|
case 271 /* ImportEqualsDeclaration */: {
|
|
108161
|
-
|
|
108225
|
+
const transformed = transformImportEqualsDeclaration(input);
|
|
108226
|
+
if (transformed) {
|
|
108227
|
+
trackReferencedAmbientModuleFromImport(input);
|
|
108228
|
+
}
|
|
108229
|
+
return transformed;
|
|
108162
108230
|
}
|
|
108163
108231
|
case 272 /* ImportDeclaration */: {
|
|
108164
|
-
|
|
108232
|
+
const transformed = transformImportDeclaration(input);
|
|
108233
|
+
if (transformed) {
|
|
108234
|
+
trackReferencedAmbientModuleFromImport(input);
|
|
108235
|
+
}
|
|
108236
|
+
return transformed;
|
|
108165
108237
|
}
|
|
108166
108238
|
}
|
|
108167
108239
|
if (isDeclaration(input) && isDeclarationAndNotVisible(input))
|
|
@@ -109764,7 +109836,8 @@ var notImplementedResolver = {
|
|
|
109764
109836
|
getSymbolOfExternalModuleSpecifier: notImplemented,
|
|
109765
109837
|
isBindingCapturedByNode: notImplemented,
|
|
109766
109838
|
getDeclarationStatementsForSourceFile: notImplemented,
|
|
109767
|
-
isImportRequiredByAugmentation: notImplemented
|
|
109839
|
+
isImportRequiredByAugmentation: notImplemented,
|
|
109840
|
+
tryFindAmbientModule: notImplemented
|
|
109768
109841
|
};
|
|
109769
109842
|
function createSourceFilesFromBundleBuildInfo(bundle, buildInfoDirectory, host) {
|
|
109770
109843
|
var _a;
|
|
@@ -120966,6 +121039,10 @@ function getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirec
|
|
|
120966
121039
|
const normalized = getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory());
|
|
120967
121040
|
return !isDiskPathRoot(normalized) ? removeTrailingDirectorySeparator(normalized) : normalized;
|
|
120968
121041
|
}
|
|
121042
|
+
function getModuleResolutionHost(resolutionHost) {
|
|
121043
|
+
var _a;
|
|
121044
|
+
return ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
|
|
121045
|
+
}
|
|
120969
121046
|
function createModuleResolutionLoaderUsingGlobalCache(containingFile, redirectedReference, options, resolutionHost, moduleResolutionCache) {
|
|
120970
121047
|
return {
|
|
120971
121048
|
nameAndMode: moduleResolutionNameAndModeGetter,
|
|
@@ -120981,8 +121058,7 @@ function createModuleResolutionLoaderUsingGlobalCache(containingFile, redirected
|
|
|
120981
121058
|
};
|
|
120982
121059
|
}
|
|
120983
121060
|
function resolveModuleNameUsingGlobalCache(resolutionHost, moduleResolutionCache, moduleName, containingFile, compilerOptions, redirectedReference, mode) {
|
|
120984
|
-
|
|
120985
|
-
const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
|
|
121061
|
+
const host = getModuleResolutionHost(resolutionHost);
|
|
120986
121062
|
const primaryResult = resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
|
|
120987
121063
|
if (!resolutionHost.getGlobalCache) {
|
|
120988
121064
|
return primaryResult;
|
|
@@ -121153,6 +121229,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121153
121229
|
};
|
|
121154
121230
|
}
|
|
121155
121231
|
function startCachingPerDirectoryResolution() {
|
|
121232
|
+
moduleResolutionCache.isReadonly = void 0;
|
|
121233
|
+
typeReferenceDirectiveResolutionCache.isReadonly = void 0;
|
|
121234
|
+
libraryResolutionCache.isReadonly = void 0;
|
|
121235
|
+
moduleResolutionCache.getPackageJsonInfoCache().isReadonly = void 0;
|
|
121156
121236
|
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
121157
121237
|
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
121158
121238
|
libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
@@ -121210,6 +121290,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121210
121290
|
directoryWatchesOfFailedLookups.forEach(closeDirectoryWatchesOfFailedLookup);
|
|
121211
121291
|
fileWatchesOfAffectingLocations.forEach(closeFileWatcherOfAffectingLocation);
|
|
121212
121292
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
121293
|
+
moduleResolutionCache.isReadonly = true;
|
|
121294
|
+
typeReferenceDirectiveResolutionCache.isReadonly = true;
|
|
121295
|
+
libraryResolutionCache.isReadonly = true;
|
|
121296
|
+
moduleResolutionCache.getPackageJsonInfoCache().isReadonly = true;
|
|
121213
121297
|
}
|
|
121214
121298
|
function closeDirectoryWatchesOfFailedLookup(watcher, path) {
|
|
121215
121299
|
if (watcher.refCount === 0) {
|
|
@@ -121238,7 +121322,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121238
121322
|
shouldRetryResolution,
|
|
121239
121323
|
logChanges
|
|
121240
121324
|
}) {
|
|
121241
|
-
var _a;
|
|
121242
121325
|
const path = resolutionHost.toPath(containingFile);
|
|
121243
121326
|
const resolutionsInFile = perFileCache.get(path) || perFileCache.set(path, createModeAwareCache()).get(path);
|
|
121244
121327
|
const resolvedModules = [];
|
|
@@ -121270,7 +121353,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121270
121353
|
logChanges = false;
|
|
121271
121354
|
}
|
|
121272
121355
|
} else {
|
|
121273
|
-
const host = (
|
|
121356
|
+
const host = getModuleResolutionHost(resolutionHost);
|
|
121274
121357
|
if (isTraceEnabled(options, host) && !seenNamesInFile.has(name, mode)) {
|
|
121275
121358
|
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
121276
121359
|
trace(
|
|
@@ -121322,7 +121405,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121322
121405
|
}
|
|
121323
121406
|
}
|
|
121324
121407
|
function resolveTypeReferenceDirectiveReferences(typeDirectiveReferences, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
|
|
121325
|
-
var _a;
|
|
121326
121408
|
return resolveNamesWithLocalCache({
|
|
121327
121409
|
entries: typeDirectiveReferences,
|
|
121328
121410
|
containingFile,
|
|
@@ -121335,7 +121417,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121335
121417
|
containingFile,
|
|
121336
121418
|
redirectedReference,
|
|
121337
121419
|
options,
|
|
121338
|
-
(
|
|
121420
|
+
getModuleResolutionHost(resolutionHost),
|
|
121339
121421
|
typeReferenceDirectiveResolutionCache
|
|
121340
121422
|
),
|
|
121341
121423
|
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
|
|
@@ -121367,8 +121449,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121367
121449
|
});
|
|
121368
121450
|
}
|
|
121369
121451
|
function resolveLibrary2(libraryName, resolveFrom, options, libFileName) {
|
|
121370
|
-
|
|
121371
|
-
const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
|
|
121452
|
+
const host = getModuleResolutionHost(resolutionHost);
|
|
121372
121453
|
let resolution = resolvedLibraries == null ? void 0 : resolvedLibraries.get(libFileName);
|
|
121373
121454
|
if (!resolution || resolution.isInvalidated) {
|
|
121374
121455
|
const existingResolution = resolution;
|
|
@@ -121402,6 +121483,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121402
121483
|
return resolution;
|
|
121403
121484
|
}
|
|
121404
121485
|
function resolveSingleModuleNameWithoutWatching(moduleName, containingFile) {
|
|
121486
|
+
var _a, _b;
|
|
121405
121487
|
const path = resolutionHost.toPath(containingFile);
|
|
121406
121488
|
const resolutionsInFile = resolvedModuleNames.get(path);
|
|
121407
121489
|
const resolution = resolutionsInFile == null ? void 0 : resolutionsInFile.get(
|
|
@@ -121411,7 +121493,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121411
121493
|
);
|
|
121412
121494
|
if (resolution && !resolution.isInvalidated)
|
|
121413
121495
|
return resolution;
|
|
121414
|
-
|
|
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;
|
|
121415
121507
|
}
|
|
121416
121508
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
121417
121509
|
return endsWith(dirPath, "/node_modules/@types");
|
|
@@ -122557,7 +122649,7 @@ function createIncrementalProgram({
|
|
|
122557
122649
|
}
|
|
122558
122650
|
function createWatchProgram(host) {
|
|
122559
122651
|
let builderProgram;
|
|
122560
|
-
let
|
|
122652
|
+
let updateLevel;
|
|
122561
122653
|
let missingFilesMap;
|
|
122562
122654
|
let watchedWildcardDirectories;
|
|
122563
122655
|
let timerToUpdateProgram;
|
|
@@ -122916,7 +123008,7 @@ function createWatchProgram(host) {
|
|
|
122916
123008
|
}
|
|
122917
123009
|
function scheduleProgramReload() {
|
|
122918
123010
|
Debug.assert(!!configFileName);
|
|
122919
|
-
|
|
123011
|
+
updateLevel = 2 /* Full */;
|
|
122920
123012
|
scheduleProgramUpdate();
|
|
122921
123013
|
}
|
|
122922
123014
|
function updateProgramWithWatchStatus() {
|
|
@@ -122926,8 +123018,8 @@ function createWatchProgram(host) {
|
|
|
122926
123018
|
}
|
|
122927
123019
|
function updateProgram() {
|
|
122928
123020
|
var _a, _b, _c, _d;
|
|
122929
|
-
switch (
|
|
122930
|
-
case 1 /*
|
|
123021
|
+
switch (updateLevel) {
|
|
123022
|
+
case 1 /* RootNamesAndUpdate */:
|
|
122931
123023
|
(_a = perfLogger) == null ? void 0 : _a.logStartUpdateProgram("PartialConfigReload");
|
|
122932
123024
|
reloadFileNamesFromConfigFile();
|
|
122933
123025
|
break;
|
|
@@ -122947,7 +123039,7 @@ function createWatchProgram(host) {
|
|
|
122947
123039
|
writeLog("Reloading new file names and options");
|
|
122948
123040
|
Debug.assert(compilerOptions);
|
|
122949
123041
|
Debug.assert(configFileName);
|
|
122950
|
-
|
|
123042
|
+
updateLevel = 0 /* Update */;
|
|
122951
123043
|
rootFileNames = getFileNamesFromConfigSpecs(compilerOptions.configFile.configFileSpecs, getNormalizedAbsolutePath(getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions);
|
|
122952
123044
|
if (updateErrorForNoInputFiles(rootFileNames, getNormalizedAbsolutePath(configFileName, currentDirectory), compilerOptions.configFile.configFileSpecs, configFileParsingDiagnostics, canConfigFileJsonReportNoInputFiles)) {
|
|
122953
123045
|
hasChangedConfigFileParsingErrors = true;
|
|
@@ -122957,7 +123049,7 @@ function createWatchProgram(host) {
|
|
|
122957
123049
|
function reloadConfigFile() {
|
|
122958
123050
|
Debug.assert(configFileName);
|
|
122959
123051
|
writeLog(`Reloading config file: ${configFileName}`);
|
|
122960
|
-
|
|
123052
|
+
updateLevel = 0 /* Update */;
|
|
122961
123053
|
if (cachedDirectoryStructureHost) {
|
|
122962
123054
|
cachedDirectoryStructureHost.clearCache();
|
|
122963
123055
|
}
|
|
@@ -122994,9 +123086,9 @@ function createWatchProgram(host) {
|
|
|
122994
123086
|
const configPath = toPath3(configFileName2);
|
|
122995
123087
|
let config = parsedConfigs == null ? void 0 : parsedConfigs.get(configPath);
|
|
122996
123088
|
if (config) {
|
|
122997
|
-
if (!config.
|
|
123089
|
+
if (!config.updateLevel)
|
|
122998
123090
|
return config.parsedCommandLine;
|
|
122999
|
-
if (config.parsedCommandLine && config.
|
|
123091
|
+
if (config.parsedCommandLine && config.updateLevel === 1 /* RootNamesAndUpdate */ && !host.getParsedCommandLine) {
|
|
123000
123092
|
writeLog("Reloading new file names and options");
|
|
123001
123093
|
Debug.assert(compilerOptions);
|
|
123002
123094
|
const fileNames = getFileNamesFromConfigSpecs(
|
|
@@ -123006,7 +123098,7 @@ function createWatchProgram(host) {
|
|
|
123006
123098
|
parseConfigFileHost
|
|
123007
123099
|
);
|
|
123008
123100
|
config.parsedCommandLine = { ...config.parsedCommandLine, fileNames };
|
|
123009
|
-
config.
|
|
123101
|
+
config.updateLevel = void 0;
|
|
123010
123102
|
return config.parsedCommandLine;
|
|
123011
123103
|
}
|
|
123012
123104
|
}
|
|
@@ -123014,7 +123106,7 @@ function createWatchProgram(host) {
|
|
|
123014
123106
|
const parsedCommandLine = host.getParsedCommandLine ? host.getParsedCommandLine(configFileName2) : getParsedCommandLineFromConfigFileHost(configFileName2);
|
|
123015
123107
|
if (config) {
|
|
123016
123108
|
config.parsedCommandLine = parsedCommandLine;
|
|
123017
|
-
config.
|
|
123109
|
+
config.updateLevel = void 0;
|
|
123018
123110
|
} else {
|
|
123019
123111
|
(parsedConfigs || (parsedConfigs = /* @__PURE__ */ new Map())).set(configPath, config = { parsedCommandLine });
|
|
123020
123112
|
}
|
|
@@ -123111,8 +123203,8 @@ function createWatchProgram(host) {
|
|
|
123111
123203
|
toPath: toPath3
|
|
123112
123204
|
}))
|
|
123113
123205
|
return;
|
|
123114
|
-
if (
|
|
123115
|
-
|
|
123206
|
+
if (updateLevel !== 2 /* Full */) {
|
|
123207
|
+
updateLevel = 1 /* RootNamesAndUpdate */;
|
|
123116
123208
|
scheduleProgramUpdate();
|
|
123117
123209
|
}
|
|
123118
123210
|
},
|
|
@@ -123138,11 +123230,11 @@ function createWatchProgram(host) {
|
|
|
123138
123230
|
return;
|
|
123139
123231
|
projects.forEach((projectPath) => {
|
|
123140
123232
|
if (configFileName && toPath3(configFileName) === projectPath) {
|
|
123141
|
-
|
|
123233
|
+
updateLevel = 2 /* Full */;
|
|
123142
123234
|
} else {
|
|
123143
123235
|
const config = parsedConfigs == null ? void 0 : parsedConfigs.get(projectPath);
|
|
123144
123236
|
if (config)
|
|
123145
|
-
config.
|
|
123237
|
+
config.updateLevel = 2 /* Full */;
|
|
123146
123238
|
resolutionCache.removeResolutionsFromProjectReferenceRedirects(projectPath);
|
|
123147
123239
|
}
|
|
123148
123240
|
scheduleProgramUpdate();
|
|
@@ -123163,7 +123255,7 @@ function createWatchProgram(host) {
|
|
|
123163
123255
|
updateCachedSystemWithFile(configFileName2, configPath, eventKind);
|
|
123164
123256
|
const config = parsedConfigs == null ? void 0 : parsedConfigs.get(configPath);
|
|
123165
123257
|
if (config)
|
|
123166
|
-
config.
|
|
123258
|
+
config.updateLevel = 2 /* Full */;
|
|
123167
123259
|
resolutionCache.removeResolutionsFromProjectReferenceRedirects(configPath);
|
|
123168
123260
|
scheduleProgramUpdate();
|
|
123169
123261
|
},
|
|
@@ -123201,8 +123293,8 @@ function createWatchProgram(host) {
|
|
|
123201
123293
|
toPath: toPath3
|
|
123202
123294
|
}))
|
|
123203
123295
|
return;
|
|
123204
|
-
if (config.
|
|
123205
|
-
config.
|
|
123296
|
+
if (config.updateLevel !== 2 /* Full */) {
|
|
123297
|
+
config.updateLevel = 1 /* RootNamesAndUpdate */;
|
|
123206
123298
|
scheduleProgramUpdate();
|
|
123207
123299
|
}
|
|
123208
123300
|
},
|
|
@@ -123644,12 +123736,12 @@ function clearProjectStatus(state, resolved) {
|
|
|
123644
123736
|
state.projectStatus.delete(resolved);
|
|
123645
123737
|
state.diagnostics.delete(resolved);
|
|
123646
123738
|
}
|
|
123647
|
-
function addProjToQueue({ projectPendingBuild }, proj,
|
|
123739
|
+
function addProjToQueue({ projectPendingBuild }, proj, updateLevel) {
|
|
123648
123740
|
const value = projectPendingBuild.get(proj);
|
|
123649
123741
|
if (value === void 0) {
|
|
123650
|
-
projectPendingBuild.set(proj,
|
|
123651
|
-
} else if (value <
|
|
123652
|
-
projectPendingBuild.set(proj,
|
|
123742
|
+
projectPendingBuild.set(proj, updateLevel);
|
|
123743
|
+
} else if (value < updateLevel) {
|
|
123744
|
+
projectPendingBuild.set(proj, updateLevel);
|
|
123653
123745
|
}
|
|
123654
123746
|
}
|
|
123655
123747
|
function setupInitialBuild(state, cancellationToken) {
|
|
@@ -123663,7 +123755,7 @@ function setupInitialBuild(state, cancellationToken) {
|
|
|
123663
123755
|
buildOrder.forEach(
|
|
123664
123756
|
(configFileName) => state.projectPendingBuild.set(
|
|
123665
123757
|
toResolvedConfigFilePath(state, configFileName),
|
|
123666
|
-
0 /*
|
|
123758
|
+
0 /* Update */
|
|
123667
123759
|
)
|
|
123668
123760
|
);
|
|
123669
123761
|
if (cancellationToken) {
|
|
@@ -124099,8 +124191,8 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
|
|
|
124099
124191
|
for (let projectIndex = 0; projectIndex < buildOrder.length; projectIndex++) {
|
|
124100
124192
|
const project = buildOrder[projectIndex];
|
|
124101
124193
|
const projectPath = toResolvedConfigFilePath(state, project);
|
|
124102
|
-
const
|
|
124103
|
-
if (
|
|
124194
|
+
const updateLevel = state.projectPendingBuild.get(projectPath);
|
|
124195
|
+
if (updateLevel === void 0)
|
|
124104
124196
|
continue;
|
|
124105
124197
|
if (reportQueue) {
|
|
124106
124198
|
reportQueue = false;
|
|
@@ -124112,13 +124204,13 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
|
|
|
124112
124204
|
projectPendingBuild.delete(projectPath);
|
|
124113
124205
|
continue;
|
|
124114
124206
|
}
|
|
124115
|
-
if (
|
|
124207
|
+
if (updateLevel === 2 /* Full */) {
|
|
124116
124208
|
watchConfigFile(state, project, projectPath, config);
|
|
124117
124209
|
watchExtendedConfigFiles(state, projectPath, config);
|
|
124118
124210
|
watchWildCardDirectories(state, project, projectPath, config);
|
|
124119
124211
|
watchInputFiles(state, project, projectPath, config);
|
|
124120
124212
|
watchPackageJsonFiles(state, project, projectPath, config);
|
|
124121
|
-
} else if (
|
|
124213
|
+
} else if (updateLevel === 1 /* RootNamesAndUpdate */) {
|
|
124122
124214
|
config.fileNames = getFileNamesFromConfigSpecs(config.options.configFile.configFileSpecs, getDirectoryPath(project), config.options, state.parseConfigFileHost);
|
|
124123
124215
|
updateErrorForNoInputFiles(config.fileNames, project, config.options.configFile.configFileSpecs, config.errors, canJsonReportNoInputFiles(config.raw));
|
|
124124
124216
|
watchInputFiles(state, project, projectPath, config);
|
|
@@ -124705,7 +124797,7 @@ function queueReferencingProjects(state, project, projectPath, projectIndex, con
|
|
|
124705
124797
|
break;
|
|
124706
124798
|
}
|
|
124707
124799
|
}
|
|
124708
|
-
addProjToQueue(state, nextProjectPath, 0 /*
|
|
124800
|
+
addProjToQueue(state, nextProjectPath, 0 /* Update */);
|
|
124709
124801
|
break;
|
|
124710
124802
|
}
|
|
124711
124803
|
}
|
|
@@ -124774,7 +124866,7 @@ function cleanWorker(state, project, onlyReferences) {
|
|
|
124774
124866
|
filesToDelete.push(output);
|
|
124775
124867
|
} else {
|
|
124776
124868
|
host.deleteFile(output);
|
|
124777
|
-
invalidateProject(state, resolvedPath, 0 /*
|
|
124869
|
+
invalidateProject(state, resolvedPath, 0 /* Update */);
|
|
124778
124870
|
}
|
|
124779
124871
|
}
|
|
124780
124872
|
}
|
|
@@ -124785,22 +124877,22 @@ function cleanWorker(state, project, onlyReferences) {
|
|
|
124785
124877
|
}
|
|
124786
124878
|
return 0 /* Success */;
|
|
124787
124879
|
}
|
|
124788
|
-
function invalidateProject(state, resolved,
|
|
124789
|
-
if (state.host.getParsedCommandLine &&
|
|
124790
|
-
|
|
124880
|
+
function invalidateProject(state, resolved, updateLevel) {
|
|
124881
|
+
if (state.host.getParsedCommandLine && updateLevel === 1 /* RootNamesAndUpdate */) {
|
|
124882
|
+
updateLevel = 2 /* Full */;
|
|
124791
124883
|
}
|
|
124792
|
-
if (
|
|
124884
|
+
if (updateLevel === 2 /* Full */) {
|
|
124793
124885
|
state.configFileCache.delete(resolved);
|
|
124794
124886
|
state.buildOrder = void 0;
|
|
124795
124887
|
}
|
|
124796
124888
|
state.needsSummary = true;
|
|
124797
124889
|
clearProjectStatus(state, resolved);
|
|
124798
|
-
addProjToQueue(state, resolved,
|
|
124890
|
+
addProjToQueue(state, resolved, updateLevel);
|
|
124799
124891
|
enableCache(state);
|
|
124800
124892
|
}
|
|
124801
|
-
function invalidateProjectAndScheduleBuilds(state, resolvedPath,
|
|
124893
|
+
function invalidateProjectAndScheduleBuilds(state, resolvedPath, updateLevel) {
|
|
124802
124894
|
state.reportFileChangeDetected = true;
|
|
124803
|
-
invalidateProject(state, resolvedPath,
|
|
124895
|
+
invalidateProject(state, resolvedPath, updateLevel);
|
|
124804
124896
|
scheduleBuildInvalidatedProject(
|
|
124805
124897
|
state,
|
|
124806
124898
|
250,
|
|
@@ -124931,7 +125023,7 @@ function watchWildCardDirectories(state, resolved, resolvedPath, parsed) {
|
|
|
124931
125023
|
toPath: (fileName) => toPath2(state, fileName)
|
|
124932
125024
|
}))
|
|
124933
125025
|
return;
|
|
124934
|
-
invalidateProjectAndScheduleBuilds(state, resolvedPath, 1 /*
|
|
125026
|
+
invalidateProjectAndScheduleBuilds(state, resolvedPath, 1 /* RootNamesAndUpdate */);
|
|
124935
125027
|
},
|
|
124936
125028
|
flags,
|
|
124937
125029
|
parsed == null ? void 0 : parsed.watchOptions,
|
|
@@ -124950,7 +125042,7 @@ function watchInputFiles(state, resolved, resolvedPath, parsed) {
|
|
|
124950
125042
|
createNewValue: (_path, input) => watchFile(
|
|
124951
125043
|
state,
|
|
124952
125044
|
input,
|
|
124953
|
-
() => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /*
|
|
125045
|
+
() => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
|
|
124954
125046
|
250 /* Low */,
|
|
124955
125047
|
parsed == null ? void 0 : parsed.watchOptions,
|
|
124956
125048
|
WatchType.SourceFile,
|
|
@@ -124970,7 +125062,7 @@ function watchPackageJsonFiles(state, resolved, resolvedPath, parsed) {
|
|
|
124970
125062
|
createNewValue: (path, _input) => watchFile(
|
|
124971
125063
|
state,
|
|
124972
125064
|
path,
|
|
124973
|
-
() => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /*
|
|
125065
|
+
() => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
|
|
124974
125066
|
2e3 /* High */,
|
|
124975
125067
|
parsed == null ? void 0 : parsed.watchOptions,
|
|
124976
125068
|
WatchType.PackageJson,
|
|
@@ -125041,7 +125133,7 @@ function createSolutionBuilderWorker(watch, hostOrHostWithWatch, rootNames, opti
|
|
|
125041
125133
|
const configFilePath = toResolvedConfigFilePath(state, configFileName);
|
|
125042
125134
|
return getUpToDateStatus(state, parseConfigFile(state, configFileName, configFilePath), configFilePath);
|
|
125043
125135
|
},
|
|
125044
|
-
invalidateProject: (configFilePath,
|
|
125136
|
+
invalidateProject: (configFilePath, updateLevel) => invalidateProject(state, configFilePath, updateLevel || 0 /* Update */),
|
|
125045
125137
|
close: () => stopWatching(state)
|
|
125046
125138
|
};
|
|
125047
125139
|
}
|