typescript 5.1.0-dev.20230417 → 5.1.0-dev.20230419
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 +62 -29
- package/lib/tsserver.js +70 -32
- package/lib/tsserverlibrary.d.ts +2 -2
- package/lib/tsserverlibrary.js +70 -32
- package/lib/typescript.js +62 -29
- package/lib/typingsInstaller.js +7 -7
- package/package.json +2 -2
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.1";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20230419`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -16601,7 +16601,7 @@ function getScriptKindFromFileName(fileName) {
|
|
|
16601
16601
|
var supportedTSExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */], [".cts" /* Cts */, ".d.cts" /* Dcts */], [".mts" /* Mts */, ".d.mts" /* Dmts */]];
|
|
16602
16602
|
var supportedTSExtensionsFlat = flatten(supportedTSExtensions);
|
|
16603
16603
|
var supportedTSExtensionsWithJson = [...supportedTSExtensions, [".json" /* Json */]];
|
|
16604
|
-
var supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx
|
|
16604
|
+
var supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */];
|
|
16605
16605
|
var supportedJSExtensions = [[".js" /* Js */, ".jsx" /* Jsx */], [".mjs" /* Mjs */], [".cjs" /* Cjs */]];
|
|
16606
16606
|
var supportedJSExtensionsFlat = flatten(supportedJSExtensions);
|
|
16607
16607
|
var allSupportedExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */, ".js" /* Js */, ".jsx" /* Jsx */], [".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */], [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */]];
|
|
@@ -37633,22 +37633,22 @@ var nodeModulesPathPart = "/node_modules/";
|
|
|
37633
37633
|
function pathContainsNodeModules(path) {
|
|
37634
37634
|
return stringContains(path, nodeModulesPathPart);
|
|
37635
37635
|
}
|
|
37636
|
-
function parseNodeModuleFromPath(resolved) {
|
|
37636
|
+
function parseNodeModuleFromPath(resolved, isFolder) {
|
|
37637
37637
|
const path = normalizePath(resolved);
|
|
37638
37638
|
const idx = path.lastIndexOf(nodeModulesPathPart);
|
|
37639
37639
|
if (idx === -1) {
|
|
37640
37640
|
return void 0;
|
|
37641
37641
|
}
|
|
37642
37642
|
const indexAfterNodeModules = idx + nodeModulesPathPart.length;
|
|
37643
|
-
let indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterNodeModules);
|
|
37643
|
+
let indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterNodeModules, isFolder);
|
|
37644
37644
|
if (path.charCodeAt(indexAfterNodeModules) === 64 /* at */) {
|
|
37645
|
-
indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName);
|
|
37645
|
+
indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName, isFolder);
|
|
37646
37646
|
}
|
|
37647
37647
|
return path.slice(0, indexAfterPackageName);
|
|
37648
37648
|
}
|
|
37649
|
-
function moveToNextDirectorySeparatorIfAvailable(path, prevSeparatorIndex) {
|
|
37649
|
+
function moveToNextDirectorySeparatorIfAvailable(path, prevSeparatorIndex, isFolder) {
|
|
37650
37650
|
const nextSeparatorIndex = path.indexOf(directorySeparator, prevSeparatorIndex + 1);
|
|
37651
|
-
return nextSeparatorIndex === -1 ? prevSeparatorIndex : nextSeparatorIndex;
|
|
37651
|
+
return nextSeparatorIndex === -1 ? isFolder ? path.length : prevSeparatorIndex : nextSeparatorIndex;
|
|
37652
37652
|
}
|
|
37653
37653
|
function loadModuleFromFileNoPackageId(extensions, candidate, onlyRecordFailures, state) {
|
|
37654
37654
|
return noPackageId(loadModuleFromFile(extensions, candidate, onlyRecordFailures, state));
|
|
@@ -39024,7 +39024,7 @@ function createBinder() {
|
|
|
39024
39024
|
return getSymbolNameForPrivateIdentifier(containingClassSymbol, name.escapedText);
|
|
39025
39025
|
}
|
|
39026
39026
|
if (isJsxNamespacedName(name)) {
|
|
39027
|
-
return
|
|
39027
|
+
return getEscapedTextOfJsxNamespacedName(name);
|
|
39028
39028
|
}
|
|
39029
39029
|
return isPropertyNameLiteral(name) ? getEscapedTextOfIdentifierOrLiteral(name) : void 0;
|
|
39030
39030
|
}
|
|
@@ -66895,7 +66895,7 @@ function createTypeChecker(host) {
|
|
|
66895
66895
|
return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional, contextFlags) : void 0;
|
|
66896
66896
|
}
|
|
66897
66897
|
function getContextualTypeForChildJsxExpression(node, child, contextFlags) {
|
|
66898
|
-
const attributesType = getApparentTypeOfContextualType(node.openingElement.
|
|
66898
|
+
const attributesType = getApparentTypeOfContextualType(node.openingElement.attributes, contextFlags);
|
|
66899
66899
|
const jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
|
|
66900
66900
|
if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) {
|
|
66901
66901
|
return void 0;
|
|
@@ -110666,7 +110666,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
110666
110666
|
}
|
|
110667
110667
|
}
|
|
110668
110668
|
function emitEmbeddedStatement(parent, node) {
|
|
110669
|
-
if (isBlock(node) || getEmitFlags(parent) & 1 /* SingleLine */) {
|
|
110669
|
+
if (isBlock(node) || getEmitFlags(parent) & 1 /* SingleLine */ || preserveSourceNewlines && !getLeadingLineTerminatorCount(parent, node, 0 /* None */)) {
|
|
110670
110670
|
writeSpace();
|
|
110671
110671
|
emit(node);
|
|
110672
110672
|
} else {
|
|
@@ -113530,7 +113530,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
113530
113530
|
automaticTypeDirectiveResolutions = createModeAwareCache();
|
|
113531
113531
|
if (automaticTypeDirectiveNames.length) {
|
|
113532
113532
|
(_k = tracing) == null ? void 0 : _k.push(tracing.Phase.Program, "processTypeReferences", { count: automaticTypeDirectiveNames.length });
|
|
113533
|
-
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) :
|
|
113533
|
+
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
113534
113534
|
const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile);
|
|
113535
113535
|
const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(automaticTypeDirectiveNames, containingFilename);
|
|
113536
113536
|
for (let i = 0; i < automaticTypeDirectiveNames.length; i++) {
|
|
@@ -115321,8 +115321,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115321
115321
|
path += (i === 2 ? "/" : "-") + components[i];
|
|
115322
115322
|
i++;
|
|
115323
115323
|
}
|
|
115324
|
-
const
|
|
115325
|
-
const
|
|
115324
|
+
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
115325
|
+
const resolveFrom = combinePaths(containingDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`);
|
|
115326
|
+
const localOverrideModuleResult = resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: 2 /* Node10 */, traceResolution: options.traceResolution }, host, moduleResolutionCache);
|
|
115326
115327
|
if (localOverrideModuleResult == null ? void 0 : localOverrideModuleResult.resolvedModule) {
|
|
115327
115328
|
return localOverrideModuleResult.resolvedModule.resolvedFileName;
|
|
115328
115329
|
}
|
|
@@ -115457,7 +115458,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115457
115458
|
void 0
|
|
115458
115459
|
);
|
|
115459
115460
|
} else {
|
|
115460
|
-
const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath),
|
|
115461
|
+
const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath), currentDirectory);
|
|
115461
115462
|
sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
|
|
115462
115463
|
addFileToFilesByName(
|
|
115463
115464
|
sourceFile,
|
|
@@ -118298,6 +118299,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118298
118299
|
let failedLookupChecks;
|
|
118299
118300
|
let startsWithPathChecks;
|
|
118300
118301
|
let isInDirectoryChecks;
|
|
118302
|
+
let allResolutionsAreInvalidated = false;
|
|
118301
118303
|
const getCurrentDirectory = memoize(() => resolutionHost.getCurrentDirectory());
|
|
118302
118304
|
const cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
|
|
118303
118305
|
const resolvedModuleNames = /* @__PURE__ */ new Map();
|
|
@@ -118340,7 +118342,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118340
118342
|
isFileWithInvalidatedNonRelativeUnresolvedImports,
|
|
118341
118343
|
updateTypeRootsWatch,
|
|
118342
118344
|
closeTypeRootsWatch,
|
|
118343
|
-
clear: clear2
|
|
118345
|
+
clear: clear2,
|
|
118346
|
+
onChangesAffectModuleResolution
|
|
118344
118347
|
};
|
|
118345
118348
|
function getResolvedModule2(resolution) {
|
|
118346
118349
|
return resolution.resolvedModule;
|
|
@@ -118363,6 +118366,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118363
118366
|
isInDirectoryChecks = void 0;
|
|
118364
118367
|
affectingPathChecks = void 0;
|
|
118365
118368
|
affectingPathChecksForFile = void 0;
|
|
118369
|
+
allResolutionsAreInvalidated = false;
|
|
118366
118370
|
moduleResolutionCache.clear();
|
|
118367
118371
|
typeReferenceDirectiveResolutionCache.clear();
|
|
118368
118372
|
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
@@ -118370,6 +118374,13 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118370
118374
|
impliedFormatPackageJsons.clear();
|
|
118371
118375
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
118372
118376
|
}
|
|
118377
|
+
function onChangesAffectModuleResolution() {
|
|
118378
|
+
allResolutionsAreInvalidated = true;
|
|
118379
|
+
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
118380
|
+
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
118381
|
+
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
118382
|
+
typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
118383
|
+
}
|
|
118373
118384
|
function startRecordingFilesWithChangedResolutions() {
|
|
118374
118385
|
filesWithChangedSetOfUnresolvedImports = [];
|
|
118375
118386
|
}
|
|
@@ -118389,7 +118400,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118389
118400
|
invalidateResolutionsOfFailedLookupLocations();
|
|
118390
118401
|
const collected = filesWithInvalidatedResolutions;
|
|
118391
118402
|
filesWithInvalidatedResolutions = void 0;
|
|
118392
|
-
return (path) => customHasInvalidatedResolutions(path) || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
118403
|
+
return (path) => customHasInvalidatedResolutions(path) || allResolutionsAreInvalidated || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
118393
118404
|
}
|
|
118394
118405
|
function startCachingPerDirectoryResolution() {
|
|
118395
118406
|
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
@@ -118399,6 +118410,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118399
118410
|
}
|
|
118400
118411
|
function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
|
|
118401
118412
|
filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
|
|
118413
|
+
allResolutionsAreInvalidated = false;
|
|
118402
118414
|
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
118403
118415
|
nonRelativeExternalModuleResolutions.clear();
|
|
118404
118416
|
if (newProgram !== oldProgram) {
|
|
@@ -118493,6 +118505,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118493
118505
|
reusedNames,
|
|
118494
118506
|
loader,
|
|
118495
118507
|
getResolutionWithResolvedFileName,
|
|
118508
|
+
deferWatchingNonRelativeResolution,
|
|
118496
118509
|
shouldRetryResolution,
|
|
118497
118510
|
logChanges
|
|
118498
118511
|
}) {
|
|
@@ -118509,15 +118522,15 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118509
118522
|
const name = loader.nameAndMode.getName(entry);
|
|
118510
118523
|
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
118511
118524
|
let resolution = resolutionsInFile.get(name, mode);
|
|
118512
|
-
if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
118513
|
-
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) {
|
|
118525
|
+
if (!seenNamesInFile.has(name, mode) && (allResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
118526
|
+
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
118514
118527
|
const existingResolution = resolution;
|
|
118515
118528
|
resolution = loader.resolve(name, mode);
|
|
118516
118529
|
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
118517
118530
|
resolutionHost.onDiscoveredSymlink();
|
|
118518
118531
|
}
|
|
118519
118532
|
resolutionsInFile.set(name, mode, resolution);
|
|
118520
|
-
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
|
118533
|
+
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution);
|
|
118521
118534
|
if (existingResolution) {
|
|
118522
118535
|
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName);
|
|
118523
118536
|
}
|
|
@@ -118593,7 +118606,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118593
118606
|
typeReferenceDirectiveResolutionCache
|
|
118594
118607
|
),
|
|
118595
118608
|
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
|
|
118596
|
-
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0
|
|
118609
|
+
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0,
|
|
118610
|
+
deferWatchingNonRelativeResolution: false
|
|
118597
118611
|
});
|
|
118598
118612
|
}
|
|
118599
118613
|
function resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
|
|
@@ -118612,7 +118626,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118612
118626
|
),
|
|
118613
118627
|
getResolutionWithResolvedFileName: getResolvedModule2,
|
|
118614
118628
|
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|
|
118615
|
-
logChanges: logChangesWhenResolvingModule
|
|
118629
|
+
logChanges: logChangesWhenResolvingModule,
|
|
118630
|
+
deferWatchingNonRelativeResolution: true
|
|
118631
|
+
// Defer non relative resolution watch because we could be using ambient modules
|
|
118616
118632
|
});
|
|
118617
118633
|
}
|
|
118618
118634
|
function resolveSingleModuleNameWithoutWatching(moduleName, containingFile) {
|
|
@@ -118630,7 +118646,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118630
118646
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
118631
118647
|
return endsWith(dirPath, "/node_modules/@types");
|
|
118632
118648
|
}
|
|
118633
|
-
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
|
|
118649
|
+
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution) {
|
|
118634
118650
|
var _a;
|
|
118635
118651
|
if (resolution.refCount) {
|
|
118636
118652
|
resolution.refCount++;
|
|
@@ -118638,7 +118654,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118638
118654
|
} else {
|
|
118639
118655
|
resolution.refCount = 1;
|
|
118640
118656
|
Debug.assert(!((_a = resolution.files) == null ? void 0 : _a.size));
|
|
118641
|
-
if (isExternalModuleNameRelative(name)) {
|
|
118657
|
+
if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
|
|
118642
118658
|
watchFailedLookupLocationOfResolution(resolution);
|
|
118643
118659
|
} else {
|
|
118644
118660
|
nonRelativeExternalModuleResolutions.add(name, resolution);
|
|
@@ -118918,15 +118934,34 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118918
118934
|
return false;
|
|
118919
118935
|
}
|
|
118920
118936
|
(failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
|
|
118921
|
-
const packagePath = parseNodeModuleFromPath(
|
|
118937
|
+
const packagePath = parseNodeModuleFromPath(
|
|
118938
|
+
fileOrDirectoryPath,
|
|
118939
|
+
/*isFolder*/
|
|
118940
|
+
true
|
|
118941
|
+
);
|
|
118922
118942
|
if (packagePath)
|
|
118923
118943
|
(startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(packagePath);
|
|
118924
118944
|
}
|
|
118925
118945
|
}
|
|
118926
118946
|
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
118927
118947
|
}
|
|
118948
|
+
function invalidatePackageJsonMap() {
|
|
118949
|
+
const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
|
|
118950
|
+
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
118951
|
+
packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
|
|
118952
|
+
}
|
|
118953
|
+
}
|
|
118928
118954
|
function invalidateResolutionsOfFailedLookupLocations() {
|
|
118929
118955
|
var _a;
|
|
118956
|
+
if (allResolutionsAreInvalidated) {
|
|
118957
|
+
affectingPathChecksForFile = void 0;
|
|
118958
|
+
invalidatePackageJsonMap();
|
|
118959
|
+
failedLookupChecks = void 0;
|
|
118960
|
+
startsWithPathChecks = void 0;
|
|
118961
|
+
isInDirectoryChecks = void 0;
|
|
118962
|
+
affectingPathChecks = void 0;
|
|
118963
|
+
return true;
|
|
118964
|
+
}
|
|
118930
118965
|
let invalidated = false;
|
|
118931
118966
|
if (affectingPathChecksForFile) {
|
|
118932
118967
|
(_a = resolutionHost.getCurrentProgram()) == null ? void 0 : _a.getSourceFiles().forEach((f) => {
|
|
@@ -118941,10 +118976,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118941
118976
|
return invalidated;
|
|
118942
118977
|
}
|
|
118943
118978
|
invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution) || invalidated;
|
|
118944
|
-
|
|
118945
|
-
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
118946
|
-
packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
|
|
118947
|
-
}
|
|
118979
|
+
invalidatePackageJsonMap();
|
|
118948
118980
|
failedLookupChecks = void 0;
|
|
118949
118981
|
startsWithPathChecks = void 0;
|
|
118950
118982
|
isInDirectoryChecks = void 0;
|
|
@@ -119863,7 +119895,8 @@ function createWatchProgram(host) {
|
|
|
119863
119895
|
if (hasChangedCompilerOptions) {
|
|
119864
119896
|
newLine = updateNewLine();
|
|
119865
119897
|
if (program && changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) {
|
|
119866
|
-
|
|
119898
|
+
debugger;
|
|
119899
|
+
resolutionCache.onChangesAffectModuleResolution();
|
|
119867
119900
|
}
|
|
119868
119901
|
}
|
|
119869
119902
|
const hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions);
|
package/lib/tsserver.js
CHANGED
|
@@ -2301,7 +2301,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2301
2301
|
|
|
2302
2302
|
// src/compiler/corePublic.ts
|
|
2303
2303
|
var versionMajorMinor = "5.1";
|
|
2304
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2304
|
+
var version = `${versionMajorMinor}.0-dev.20230419`;
|
|
2305
2305
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2306
2306
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2307
2307
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -20751,7 +20751,7 @@ function getScriptKindFromFileName(fileName) {
|
|
|
20751
20751
|
var supportedTSExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */], [".cts" /* Cts */, ".d.cts" /* Dcts */], [".mts" /* Mts */, ".d.mts" /* Dmts */]];
|
|
20752
20752
|
var supportedTSExtensionsFlat = flatten(supportedTSExtensions);
|
|
20753
20753
|
var supportedTSExtensionsWithJson = [...supportedTSExtensions, [".json" /* Json */]];
|
|
20754
|
-
var supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx
|
|
20754
|
+
var supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */];
|
|
20755
20755
|
var supportedJSExtensions = [[".js" /* Js */, ".jsx" /* Jsx */], [".mjs" /* Mjs */], [".cjs" /* Cjs */]];
|
|
20756
20756
|
var supportedJSExtensionsFlat = flatten(supportedJSExtensions);
|
|
20757
20757
|
var allSupportedExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */, ".js" /* Js */, ".jsx" /* Jsx */], [".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */], [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */]];
|
|
@@ -42132,22 +42132,22 @@ var nodeModulesPathPart = "/node_modules/";
|
|
|
42132
42132
|
function pathContainsNodeModules(path) {
|
|
42133
42133
|
return stringContains(path, nodeModulesPathPart);
|
|
42134
42134
|
}
|
|
42135
|
-
function parseNodeModuleFromPath(resolved) {
|
|
42135
|
+
function parseNodeModuleFromPath(resolved, isFolder) {
|
|
42136
42136
|
const path = normalizePath(resolved);
|
|
42137
42137
|
const idx = path.lastIndexOf(nodeModulesPathPart);
|
|
42138
42138
|
if (idx === -1) {
|
|
42139
42139
|
return void 0;
|
|
42140
42140
|
}
|
|
42141
42141
|
const indexAfterNodeModules = idx + nodeModulesPathPart.length;
|
|
42142
|
-
let indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterNodeModules);
|
|
42142
|
+
let indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterNodeModules, isFolder);
|
|
42143
42143
|
if (path.charCodeAt(indexAfterNodeModules) === 64 /* at */) {
|
|
42144
|
-
indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName);
|
|
42144
|
+
indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName, isFolder);
|
|
42145
42145
|
}
|
|
42146
42146
|
return path.slice(0, indexAfterPackageName);
|
|
42147
42147
|
}
|
|
42148
|
-
function moveToNextDirectorySeparatorIfAvailable(path, prevSeparatorIndex) {
|
|
42148
|
+
function moveToNextDirectorySeparatorIfAvailable(path, prevSeparatorIndex, isFolder) {
|
|
42149
42149
|
const nextSeparatorIndex = path.indexOf(directorySeparator, prevSeparatorIndex + 1);
|
|
42150
|
-
return nextSeparatorIndex === -1 ? prevSeparatorIndex : nextSeparatorIndex;
|
|
42150
|
+
return nextSeparatorIndex === -1 ? isFolder ? path.length : prevSeparatorIndex : nextSeparatorIndex;
|
|
42151
42151
|
}
|
|
42152
42152
|
function loadModuleFromFileNoPackageId(extensions, candidate, onlyRecordFailures, state) {
|
|
42153
42153
|
return noPackageId(loadModuleFromFile(extensions, candidate, onlyRecordFailures, state));
|
|
@@ -43630,7 +43630,7 @@ function createBinder() {
|
|
|
43630
43630
|
return getSymbolNameForPrivateIdentifier(containingClassSymbol, name.escapedText);
|
|
43631
43631
|
}
|
|
43632
43632
|
if (isJsxNamespacedName(name)) {
|
|
43633
|
-
return
|
|
43633
|
+
return getEscapedTextOfJsxNamespacedName(name);
|
|
43634
43634
|
}
|
|
43635
43635
|
return isPropertyNameLiteral(name) ? getEscapedTextOfIdentifierOrLiteral(name) : void 0;
|
|
43636
43636
|
}
|
|
@@ -71549,7 +71549,7 @@ function createTypeChecker(host) {
|
|
|
71549
71549
|
return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType2(conditional, contextFlags) : void 0;
|
|
71550
71550
|
}
|
|
71551
71551
|
function getContextualTypeForChildJsxExpression(node, child, contextFlags) {
|
|
71552
|
-
const attributesType = getApparentTypeOfContextualType(node.openingElement.
|
|
71552
|
+
const attributesType = getApparentTypeOfContextualType(node.openingElement.attributes, contextFlags);
|
|
71553
71553
|
const jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
|
|
71554
71554
|
if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) {
|
|
71555
71555
|
return void 0;
|
|
@@ -115502,7 +115502,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
115502
115502
|
}
|
|
115503
115503
|
}
|
|
115504
115504
|
function emitEmbeddedStatement(parent2, node) {
|
|
115505
|
-
if (isBlock(node) || getEmitFlags(parent2) & 1 /* SingleLine */) {
|
|
115505
|
+
if (isBlock(node) || getEmitFlags(parent2) & 1 /* SingleLine */ || preserveSourceNewlines && !getLeadingLineTerminatorCount(parent2, node, 0 /* None */)) {
|
|
115506
115506
|
writeSpace();
|
|
115507
115507
|
emit(node);
|
|
115508
115508
|
} else {
|
|
@@ -118420,7 +118420,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118420
118420
|
automaticTypeDirectiveResolutions = createModeAwareCache();
|
|
118421
118421
|
if (automaticTypeDirectiveNames.length) {
|
|
118422
118422
|
(_k = tracing) == null ? void 0 : _k.push(tracing.Phase.Program, "processTypeReferences", { count: automaticTypeDirectiveNames.length });
|
|
118423
|
-
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) :
|
|
118423
|
+
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
118424
118424
|
const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile);
|
|
118425
118425
|
const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(automaticTypeDirectiveNames, containingFilename);
|
|
118426
118426
|
for (let i = 0; i < automaticTypeDirectiveNames.length; i++) {
|
|
@@ -120211,8 +120211,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120211
120211
|
path += (i === 2 ? "/" : "-") + components[i];
|
|
120212
120212
|
i++;
|
|
120213
120213
|
}
|
|
120214
|
-
const
|
|
120215
|
-
const
|
|
120214
|
+
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
120215
|
+
const resolveFrom = combinePaths(containingDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`);
|
|
120216
|
+
const localOverrideModuleResult = resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: 2 /* Node10 */, traceResolution: options.traceResolution }, host, moduleResolutionCache);
|
|
120216
120217
|
if (localOverrideModuleResult == null ? void 0 : localOverrideModuleResult.resolvedModule) {
|
|
120217
120218
|
return localOverrideModuleResult.resolvedModule.resolvedFileName;
|
|
120218
120219
|
}
|
|
@@ -120347,7 +120348,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120347
120348
|
void 0
|
|
120348
120349
|
);
|
|
120349
120350
|
} else {
|
|
120350
|
-
const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath),
|
|
120351
|
+
const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath), currentDirectory);
|
|
120351
120352
|
sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
|
|
120352
120353
|
addFileToFilesByName(
|
|
120353
120354
|
sourceFile,
|
|
@@ -123223,6 +123224,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123223
123224
|
let failedLookupChecks;
|
|
123224
123225
|
let startsWithPathChecks;
|
|
123225
123226
|
let isInDirectoryChecks;
|
|
123227
|
+
let allResolutionsAreInvalidated = false;
|
|
123226
123228
|
const getCurrentDirectory = memoize(() => resolutionHost.getCurrentDirectory());
|
|
123227
123229
|
const cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
|
|
123228
123230
|
const resolvedModuleNames = /* @__PURE__ */ new Map();
|
|
@@ -123265,7 +123267,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123265
123267
|
isFileWithInvalidatedNonRelativeUnresolvedImports,
|
|
123266
123268
|
updateTypeRootsWatch,
|
|
123267
123269
|
closeTypeRootsWatch,
|
|
123268
|
-
clear: clear2
|
|
123270
|
+
clear: clear2,
|
|
123271
|
+
onChangesAffectModuleResolution
|
|
123269
123272
|
};
|
|
123270
123273
|
function getResolvedModule2(resolution) {
|
|
123271
123274
|
return resolution.resolvedModule;
|
|
@@ -123288,6 +123291,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123288
123291
|
isInDirectoryChecks = void 0;
|
|
123289
123292
|
affectingPathChecks = void 0;
|
|
123290
123293
|
affectingPathChecksForFile = void 0;
|
|
123294
|
+
allResolutionsAreInvalidated = false;
|
|
123291
123295
|
moduleResolutionCache.clear();
|
|
123292
123296
|
typeReferenceDirectiveResolutionCache.clear();
|
|
123293
123297
|
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
@@ -123295,6 +123299,13 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123295
123299
|
impliedFormatPackageJsons.clear();
|
|
123296
123300
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
123297
123301
|
}
|
|
123302
|
+
function onChangesAffectModuleResolution() {
|
|
123303
|
+
allResolutionsAreInvalidated = true;
|
|
123304
|
+
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
123305
|
+
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
123306
|
+
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
123307
|
+
typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
123308
|
+
}
|
|
123298
123309
|
function startRecordingFilesWithChangedResolutions() {
|
|
123299
123310
|
filesWithChangedSetOfUnresolvedImports = [];
|
|
123300
123311
|
}
|
|
@@ -123314,7 +123325,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123314
123325
|
invalidateResolutionsOfFailedLookupLocations();
|
|
123315
123326
|
const collected = filesWithInvalidatedResolutions;
|
|
123316
123327
|
filesWithInvalidatedResolutions = void 0;
|
|
123317
|
-
return (path) => customHasInvalidatedResolutions(path) || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
123328
|
+
return (path) => customHasInvalidatedResolutions(path) || allResolutionsAreInvalidated || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
123318
123329
|
}
|
|
123319
123330
|
function startCachingPerDirectoryResolution() {
|
|
123320
123331
|
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
@@ -123324,6 +123335,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123324
123335
|
}
|
|
123325
123336
|
function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
|
|
123326
123337
|
filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
|
|
123338
|
+
allResolutionsAreInvalidated = false;
|
|
123327
123339
|
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
123328
123340
|
nonRelativeExternalModuleResolutions.clear();
|
|
123329
123341
|
if (newProgram !== oldProgram) {
|
|
@@ -123418,6 +123430,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123418
123430
|
reusedNames,
|
|
123419
123431
|
loader,
|
|
123420
123432
|
getResolutionWithResolvedFileName,
|
|
123433
|
+
deferWatchingNonRelativeResolution,
|
|
123421
123434
|
shouldRetryResolution,
|
|
123422
123435
|
logChanges
|
|
123423
123436
|
}) {
|
|
@@ -123434,15 +123447,15 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123434
123447
|
const name = loader.nameAndMode.getName(entry);
|
|
123435
123448
|
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
123436
123449
|
let resolution = resolutionsInFile.get(name, mode);
|
|
123437
|
-
if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
123438
|
-
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) {
|
|
123450
|
+
if (!seenNamesInFile.has(name, mode) && (allResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
123451
|
+
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
123439
123452
|
const existingResolution = resolution;
|
|
123440
123453
|
resolution = loader.resolve(name, mode);
|
|
123441
123454
|
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
123442
123455
|
resolutionHost.onDiscoveredSymlink();
|
|
123443
123456
|
}
|
|
123444
123457
|
resolutionsInFile.set(name, mode, resolution);
|
|
123445
|
-
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
|
123458
|
+
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution);
|
|
123446
123459
|
if (existingResolution) {
|
|
123447
123460
|
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName);
|
|
123448
123461
|
}
|
|
@@ -123518,7 +123531,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123518
123531
|
typeReferenceDirectiveResolutionCache
|
|
123519
123532
|
),
|
|
123520
123533
|
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective2,
|
|
123521
|
-
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0
|
|
123534
|
+
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0,
|
|
123535
|
+
deferWatchingNonRelativeResolution: false
|
|
123522
123536
|
});
|
|
123523
123537
|
}
|
|
123524
123538
|
function resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
|
|
@@ -123537,7 +123551,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123537
123551
|
),
|
|
123538
123552
|
getResolutionWithResolvedFileName: getResolvedModule2,
|
|
123539
123553
|
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|
|
123540
|
-
logChanges: logChangesWhenResolvingModule
|
|
123554
|
+
logChanges: logChangesWhenResolvingModule,
|
|
123555
|
+
deferWatchingNonRelativeResolution: true
|
|
123556
|
+
// Defer non relative resolution watch because we could be using ambient modules
|
|
123541
123557
|
});
|
|
123542
123558
|
}
|
|
123543
123559
|
function resolveSingleModuleNameWithoutWatching(moduleName, containingFile) {
|
|
@@ -123555,7 +123571,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123555
123571
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
123556
123572
|
return endsWith(dirPath, "/node_modules/@types");
|
|
123557
123573
|
}
|
|
123558
|
-
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
|
|
123574
|
+
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution) {
|
|
123559
123575
|
var _a;
|
|
123560
123576
|
if (resolution.refCount) {
|
|
123561
123577
|
resolution.refCount++;
|
|
@@ -123563,7 +123579,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123563
123579
|
} else {
|
|
123564
123580
|
resolution.refCount = 1;
|
|
123565
123581
|
Debug.assert(!((_a = resolution.files) == null ? void 0 : _a.size));
|
|
123566
|
-
if (isExternalModuleNameRelative(name)) {
|
|
123582
|
+
if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
|
|
123567
123583
|
watchFailedLookupLocationOfResolution(resolution);
|
|
123568
123584
|
} else {
|
|
123569
123585
|
nonRelativeExternalModuleResolutions.add(name, resolution);
|
|
@@ -123843,15 +123859,34 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123843
123859
|
return false;
|
|
123844
123860
|
}
|
|
123845
123861
|
(failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
|
|
123846
|
-
const packagePath = parseNodeModuleFromPath(
|
|
123862
|
+
const packagePath = parseNodeModuleFromPath(
|
|
123863
|
+
fileOrDirectoryPath,
|
|
123864
|
+
/*isFolder*/
|
|
123865
|
+
true
|
|
123866
|
+
);
|
|
123847
123867
|
if (packagePath)
|
|
123848
123868
|
(startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(packagePath);
|
|
123849
123869
|
}
|
|
123850
123870
|
}
|
|
123851
123871
|
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
123852
123872
|
}
|
|
123873
|
+
function invalidatePackageJsonMap() {
|
|
123874
|
+
const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
|
|
123875
|
+
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
123876
|
+
packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
|
|
123877
|
+
}
|
|
123878
|
+
}
|
|
123853
123879
|
function invalidateResolutionsOfFailedLookupLocations() {
|
|
123854
123880
|
var _a;
|
|
123881
|
+
if (allResolutionsAreInvalidated) {
|
|
123882
|
+
affectingPathChecksForFile = void 0;
|
|
123883
|
+
invalidatePackageJsonMap();
|
|
123884
|
+
failedLookupChecks = void 0;
|
|
123885
|
+
startsWithPathChecks = void 0;
|
|
123886
|
+
isInDirectoryChecks = void 0;
|
|
123887
|
+
affectingPathChecks = void 0;
|
|
123888
|
+
return true;
|
|
123889
|
+
}
|
|
123855
123890
|
let invalidated = false;
|
|
123856
123891
|
if (affectingPathChecksForFile) {
|
|
123857
123892
|
(_a = resolutionHost.getCurrentProgram()) == null ? void 0 : _a.getSourceFiles().forEach((f) => {
|
|
@@ -123866,10 +123901,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123866
123901
|
return invalidated;
|
|
123867
123902
|
}
|
|
123868
123903
|
invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution) || invalidated;
|
|
123869
|
-
|
|
123870
|
-
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
123871
|
-
packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
|
|
123872
|
-
}
|
|
123904
|
+
invalidatePackageJsonMap();
|
|
123873
123905
|
failedLookupChecks = void 0;
|
|
123874
123906
|
startsWithPathChecks = void 0;
|
|
123875
123907
|
isInDirectoryChecks = void 0;
|
|
@@ -124813,7 +124845,8 @@ function createWatchProgram(host) {
|
|
|
124813
124845
|
if (hasChangedCompilerOptions) {
|
|
124814
124846
|
newLine = updateNewLine();
|
|
124815
124847
|
if (program && changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) {
|
|
124816
|
-
|
|
124848
|
+
debugger;
|
|
124849
|
+
resolutionCache.onChangesAffectModuleResolution();
|
|
124817
124850
|
}
|
|
124818
124851
|
}
|
|
124819
124852
|
const hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions);
|
|
@@ -173938,7 +173971,7 @@ var Project3 = class {
|
|
|
173938
173971
|
if (changesAffectModuleResolution(oldOptions, compilerOptions)) {
|
|
173939
173972
|
this.cachedUnresolvedImportsPerFile.clear();
|
|
173940
173973
|
this.lastCachedUnresolvedImportsList = void 0;
|
|
173941
|
-
this.resolutionCache.
|
|
173974
|
+
this.resolutionCache.onChangesAffectModuleResolution();
|
|
173942
173975
|
this.moduleSpecifierCache.clear();
|
|
173943
173976
|
}
|
|
173944
173977
|
this.markAsDirty();
|
|
@@ -174408,13 +174441,18 @@ var InferredProject2 = class extends Project3 {
|
|
|
174408
174441
|
/*isJsInferredProject*/
|
|
174409
174442
|
true
|
|
174410
174443
|
);
|
|
174444
|
+
} else if (this.isOrphan() && this._isJsInferredProject && !info.isJavaScript()) {
|
|
174445
|
+
this.toggleJsInferredProject(
|
|
174446
|
+
/*isJsInferredProject*/
|
|
174447
|
+
false
|
|
174448
|
+
);
|
|
174411
174449
|
}
|
|
174412
174450
|
super.addRoot(info);
|
|
174413
174451
|
}
|
|
174414
174452
|
removeRoot(info) {
|
|
174415
174453
|
this.projectService.stopWatchingConfigFilesForInferredProjectRoot(info);
|
|
174416
174454
|
super.removeRoot(info);
|
|
174417
|
-
if (this._isJsInferredProject && info.isJavaScript()) {
|
|
174455
|
+
if (!this.isOrphan() && this._isJsInferredProject && info.isJavaScript()) {
|
|
174418
174456
|
if (every(this.getRootScriptInfos(), (rootInfo) => !rootInfo.isJavaScript())) {
|
|
174419
174457
|
this.toggleJsInferredProject(
|
|
174420
174458
|
/*isJsInferredProject*/
|
|
@@ -179516,7 +179554,7 @@ var Session3 = class {
|
|
|
179516
179554
|
}));
|
|
179517
179555
|
this.host = opts.host;
|
|
179518
179556
|
this.cancellationToken = opts.cancellationToken;
|
|
179519
|
-
this.typingsInstaller = opts.typingsInstaller;
|
|
179557
|
+
this.typingsInstaller = opts.typingsInstaller || nullTypingsInstaller;
|
|
179520
179558
|
this.byteLength = opts.byteLength;
|
|
179521
179559
|
this.hrtime = opts.hrtime;
|
|
179522
179560
|
this.logger = opts.logger;
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -3554,7 +3554,7 @@ declare namespace ts {
|
|
|
3554
3554
|
cancellationToken: HostCancellationToken;
|
|
3555
3555
|
useSingleInferredProject: boolean;
|
|
3556
3556
|
useInferredProjectPerProjectRoot: boolean;
|
|
3557
|
-
typingsInstaller
|
|
3557
|
+
typingsInstaller?: ITypingsInstaller;
|
|
3558
3558
|
eventHandler?: ProjectServiceEventHandler;
|
|
3559
3559
|
suppressDiagnosticEvents?: boolean;
|
|
3560
3560
|
throttleWaitMilliseconds?: number;
|
|
@@ -3826,7 +3826,7 @@ declare namespace ts {
|
|
|
3826
3826
|
cancellationToken: ServerCancellationToken;
|
|
3827
3827
|
useSingleInferredProject: boolean;
|
|
3828
3828
|
useInferredProjectPerProjectRoot: boolean;
|
|
3829
|
-
typingsInstaller
|
|
3829
|
+
typingsInstaller?: ITypingsInstaller;
|
|
3830
3830
|
byteLength: (buf: string, encoding?: BufferEncoding) => number;
|
|
3831
3831
|
hrtime: (start?: [
|
|
3832
3832
|
number,
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.1";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230419`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -19288,7 +19288,7 @@ ${lanes.join("\n")}
|
|
|
19288
19288
|
supportedTSExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */], [".cts" /* Cts */, ".d.cts" /* Dcts */], [".mts" /* Mts */, ".d.mts" /* Dmts */]];
|
|
19289
19289
|
supportedTSExtensionsFlat = flatten(supportedTSExtensions);
|
|
19290
19290
|
supportedTSExtensionsWithJson = [...supportedTSExtensions, [".json" /* Json */]];
|
|
19291
|
-
supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx
|
|
19291
|
+
supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */];
|
|
19292
19292
|
supportedJSExtensions = [[".js" /* Js */, ".jsx" /* Jsx */], [".mjs" /* Mjs */], [".cjs" /* Cjs */]];
|
|
19293
19293
|
supportedJSExtensionsFlat = flatten(supportedJSExtensions);
|
|
19294
19294
|
allSupportedExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */, ".js" /* Js */, ".jsx" /* Jsx */], [".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */], [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */]];
|
|
@@ -40003,22 +40003,22 @@ ${lanes.join("\n")}
|
|
|
40003
40003
|
function pathContainsNodeModules(path) {
|
|
40004
40004
|
return stringContains(path, nodeModulesPathPart);
|
|
40005
40005
|
}
|
|
40006
|
-
function parseNodeModuleFromPath(resolved) {
|
|
40006
|
+
function parseNodeModuleFromPath(resolved, isFolder) {
|
|
40007
40007
|
const path = normalizePath(resolved);
|
|
40008
40008
|
const idx = path.lastIndexOf(nodeModulesPathPart);
|
|
40009
40009
|
if (idx === -1) {
|
|
40010
40010
|
return void 0;
|
|
40011
40011
|
}
|
|
40012
40012
|
const indexAfterNodeModules = idx + nodeModulesPathPart.length;
|
|
40013
|
-
let indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterNodeModules);
|
|
40013
|
+
let indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterNodeModules, isFolder);
|
|
40014
40014
|
if (path.charCodeAt(indexAfterNodeModules) === 64 /* at */) {
|
|
40015
|
-
indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName);
|
|
40015
|
+
indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName, isFolder);
|
|
40016
40016
|
}
|
|
40017
40017
|
return path.slice(0, indexAfterPackageName);
|
|
40018
40018
|
}
|
|
40019
|
-
function moveToNextDirectorySeparatorIfAvailable(path, prevSeparatorIndex) {
|
|
40019
|
+
function moveToNextDirectorySeparatorIfAvailable(path, prevSeparatorIndex, isFolder) {
|
|
40020
40020
|
const nextSeparatorIndex = path.indexOf(directorySeparator, prevSeparatorIndex + 1);
|
|
40021
|
-
return nextSeparatorIndex === -1 ? prevSeparatorIndex : nextSeparatorIndex;
|
|
40021
|
+
return nextSeparatorIndex === -1 ? isFolder ? path.length : prevSeparatorIndex : nextSeparatorIndex;
|
|
40022
40022
|
}
|
|
40023
40023
|
function loadModuleFromFileNoPackageId(extensions, candidate, onlyRecordFailures, state) {
|
|
40024
40024
|
return noPackageId(loadModuleFromFile(extensions, candidate, onlyRecordFailures, state));
|
|
@@ -41516,7 +41516,7 @@ ${lanes.join("\n")}
|
|
|
41516
41516
|
return getSymbolNameForPrivateIdentifier(containingClassSymbol, name.escapedText);
|
|
41517
41517
|
}
|
|
41518
41518
|
if (isJsxNamespacedName(name)) {
|
|
41519
|
-
return
|
|
41519
|
+
return getEscapedTextOfJsxNamespacedName(name);
|
|
41520
41520
|
}
|
|
41521
41521
|
return isPropertyNameLiteral(name) ? getEscapedTextOfIdentifierOrLiteral(name) : void 0;
|
|
41522
41522
|
}
|
|
@@ -69343,7 +69343,7 @@ ${lanes.join("\n")}
|
|
|
69343
69343
|
return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType2(conditional, contextFlags) : void 0;
|
|
69344
69344
|
}
|
|
69345
69345
|
function getContextualTypeForChildJsxExpression(node, child, contextFlags) {
|
|
69346
|
-
const attributesType = getApparentTypeOfContextualType(node.openingElement.
|
|
69346
|
+
const attributesType = getApparentTypeOfContextualType(node.openingElement.attributes, contextFlags);
|
|
69347
69347
|
const jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
|
|
69348
69348
|
if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) {
|
|
69349
69349
|
return void 0;
|
|
@@ -113561,7 +113561,7 @@ ${lanes.join("\n")}
|
|
|
113561
113561
|
}
|
|
113562
113562
|
}
|
|
113563
113563
|
function emitEmbeddedStatement(parent2, node) {
|
|
113564
|
-
if (isBlock(node) || getEmitFlags(parent2) & 1 /* SingleLine */) {
|
|
113564
|
+
if (isBlock(node) || getEmitFlags(parent2) & 1 /* SingleLine */ || preserveSourceNewlines && !getLeadingLineTerminatorCount(parent2, node, 0 /* None */)) {
|
|
113565
113565
|
writeSpace();
|
|
113566
113566
|
emit(node);
|
|
113567
113567
|
} else {
|
|
@@ -116422,7 +116422,7 @@ ${lanes.join("\n")}
|
|
|
116422
116422
|
automaticTypeDirectiveResolutions = createModeAwareCache();
|
|
116423
116423
|
if (automaticTypeDirectiveNames.length) {
|
|
116424
116424
|
(_k = tracing) == null ? void 0 : _k.push(tracing.Phase.Program, "processTypeReferences", { count: automaticTypeDirectiveNames.length });
|
|
116425
|
-
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) :
|
|
116425
|
+
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
116426
116426
|
const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile);
|
|
116427
116427
|
const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(automaticTypeDirectiveNames, containingFilename);
|
|
116428
116428
|
for (let i = 0; i < automaticTypeDirectiveNames.length; i++) {
|
|
@@ -118213,8 +118213,9 @@ ${lanes.join("\n")}
|
|
|
118213
118213
|
path += (i === 2 ? "/" : "-") + components[i];
|
|
118214
118214
|
i++;
|
|
118215
118215
|
}
|
|
118216
|
-
const
|
|
118217
|
-
const
|
|
118216
|
+
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
118217
|
+
const resolveFrom = combinePaths(containingDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`);
|
|
118218
|
+
const localOverrideModuleResult = resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: 2 /* Node10 */, traceResolution: options.traceResolution }, host, moduleResolutionCache);
|
|
118218
118219
|
if (localOverrideModuleResult == null ? void 0 : localOverrideModuleResult.resolvedModule) {
|
|
118219
118220
|
return localOverrideModuleResult.resolvedModule.resolvedFileName;
|
|
118220
118221
|
}
|
|
@@ -118349,7 +118350,7 @@ ${lanes.join("\n")}
|
|
|
118349
118350
|
void 0
|
|
118350
118351
|
);
|
|
118351
118352
|
} else {
|
|
118352
|
-
const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath),
|
|
118353
|
+
const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath), currentDirectory);
|
|
118353
118354
|
sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
|
|
118354
118355
|
addFileToFilesByName(
|
|
118355
118356
|
sourceFile,
|
|
@@ -121380,6 +121381,7 @@ ${lanes.join("\n")}
|
|
|
121380
121381
|
let failedLookupChecks;
|
|
121381
121382
|
let startsWithPathChecks;
|
|
121382
121383
|
let isInDirectoryChecks;
|
|
121384
|
+
let allResolutionsAreInvalidated = false;
|
|
121383
121385
|
const getCurrentDirectory = memoize(() => resolutionHost.getCurrentDirectory());
|
|
121384
121386
|
const cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
|
|
121385
121387
|
const resolvedModuleNames = /* @__PURE__ */ new Map();
|
|
@@ -121422,7 +121424,8 @@ ${lanes.join("\n")}
|
|
|
121422
121424
|
isFileWithInvalidatedNonRelativeUnresolvedImports,
|
|
121423
121425
|
updateTypeRootsWatch,
|
|
121424
121426
|
closeTypeRootsWatch,
|
|
121425
|
-
clear: clear2
|
|
121427
|
+
clear: clear2,
|
|
121428
|
+
onChangesAffectModuleResolution
|
|
121426
121429
|
};
|
|
121427
121430
|
function getResolvedModule2(resolution) {
|
|
121428
121431
|
return resolution.resolvedModule;
|
|
@@ -121445,6 +121448,7 @@ ${lanes.join("\n")}
|
|
|
121445
121448
|
isInDirectoryChecks = void 0;
|
|
121446
121449
|
affectingPathChecks = void 0;
|
|
121447
121450
|
affectingPathChecksForFile = void 0;
|
|
121451
|
+
allResolutionsAreInvalidated = false;
|
|
121448
121452
|
moduleResolutionCache.clear();
|
|
121449
121453
|
typeReferenceDirectiveResolutionCache.clear();
|
|
121450
121454
|
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
@@ -121452,6 +121456,13 @@ ${lanes.join("\n")}
|
|
|
121452
121456
|
impliedFormatPackageJsons.clear();
|
|
121453
121457
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
121454
121458
|
}
|
|
121459
|
+
function onChangesAffectModuleResolution() {
|
|
121460
|
+
allResolutionsAreInvalidated = true;
|
|
121461
|
+
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
121462
|
+
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
121463
|
+
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
121464
|
+
typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
121465
|
+
}
|
|
121455
121466
|
function startRecordingFilesWithChangedResolutions() {
|
|
121456
121467
|
filesWithChangedSetOfUnresolvedImports = [];
|
|
121457
121468
|
}
|
|
@@ -121471,7 +121482,7 @@ ${lanes.join("\n")}
|
|
|
121471
121482
|
invalidateResolutionsOfFailedLookupLocations();
|
|
121472
121483
|
const collected = filesWithInvalidatedResolutions;
|
|
121473
121484
|
filesWithInvalidatedResolutions = void 0;
|
|
121474
|
-
return (path) => customHasInvalidatedResolutions(path) || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
121485
|
+
return (path) => customHasInvalidatedResolutions(path) || allResolutionsAreInvalidated || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
121475
121486
|
}
|
|
121476
121487
|
function startCachingPerDirectoryResolution() {
|
|
121477
121488
|
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
@@ -121481,6 +121492,7 @@ ${lanes.join("\n")}
|
|
|
121481
121492
|
}
|
|
121482
121493
|
function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
|
|
121483
121494
|
filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
|
|
121495
|
+
allResolutionsAreInvalidated = false;
|
|
121484
121496
|
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
121485
121497
|
nonRelativeExternalModuleResolutions.clear();
|
|
121486
121498
|
if (newProgram !== oldProgram) {
|
|
@@ -121575,6 +121587,7 @@ ${lanes.join("\n")}
|
|
|
121575
121587
|
reusedNames,
|
|
121576
121588
|
loader,
|
|
121577
121589
|
getResolutionWithResolvedFileName,
|
|
121590
|
+
deferWatchingNonRelativeResolution,
|
|
121578
121591
|
shouldRetryResolution,
|
|
121579
121592
|
logChanges
|
|
121580
121593
|
}) {
|
|
@@ -121591,15 +121604,15 @@ ${lanes.join("\n")}
|
|
|
121591
121604
|
const name = loader.nameAndMode.getName(entry);
|
|
121592
121605
|
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
121593
121606
|
let resolution = resolutionsInFile.get(name, mode);
|
|
121594
|
-
if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
121595
|
-
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) {
|
|
121607
|
+
if (!seenNamesInFile.has(name, mode) && (allResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
121608
|
+
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
121596
121609
|
const existingResolution = resolution;
|
|
121597
121610
|
resolution = loader.resolve(name, mode);
|
|
121598
121611
|
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
121599
121612
|
resolutionHost.onDiscoveredSymlink();
|
|
121600
121613
|
}
|
|
121601
121614
|
resolutionsInFile.set(name, mode, resolution);
|
|
121602
|
-
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
|
121615
|
+
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution);
|
|
121603
121616
|
if (existingResolution) {
|
|
121604
121617
|
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName);
|
|
121605
121618
|
}
|
|
@@ -121675,7 +121688,8 @@ ${lanes.join("\n")}
|
|
|
121675
121688
|
typeReferenceDirectiveResolutionCache
|
|
121676
121689
|
),
|
|
121677
121690
|
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective2,
|
|
121678
|
-
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0
|
|
121691
|
+
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0,
|
|
121692
|
+
deferWatchingNonRelativeResolution: false
|
|
121679
121693
|
});
|
|
121680
121694
|
}
|
|
121681
121695
|
function resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
|
|
@@ -121694,7 +121708,9 @@ ${lanes.join("\n")}
|
|
|
121694
121708
|
),
|
|
121695
121709
|
getResolutionWithResolvedFileName: getResolvedModule2,
|
|
121696
121710
|
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|
|
121697
|
-
logChanges: logChangesWhenResolvingModule
|
|
121711
|
+
logChanges: logChangesWhenResolvingModule,
|
|
121712
|
+
deferWatchingNonRelativeResolution: true
|
|
121713
|
+
// Defer non relative resolution watch because we could be using ambient modules
|
|
121698
121714
|
});
|
|
121699
121715
|
}
|
|
121700
121716
|
function resolveSingleModuleNameWithoutWatching(moduleName, containingFile) {
|
|
@@ -121712,7 +121728,7 @@ ${lanes.join("\n")}
|
|
|
121712
121728
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
121713
121729
|
return endsWith(dirPath, "/node_modules/@types");
|
|
121714
121730
|
}
|
|
121715
|
-
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
|
|
121731
|
+
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution) {
|
|
121716
121732
|
var _a;
|
|
121717
121733
|
if (resolution.refCount) {
|
|
121718
121734
|
resolution.refCount++;
|
|
@@ -121720,7 +121736,7 @@ ${lanes.join("\n")}
|
|
|
121720
121736
|
} else {
|
|
121721
121737
|
resolution.refCount = 1;
|
|
121722
121738
|
Debug.assert(!((_a = resolution.files) == null ? void 0 : _a.size));
|
|
121723
|
-
if (isExternalModuleNameRelative(name)) {
|
|
121739
|
+
if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
|
|
121724
121740
|
watchFailedLookupLocationOfResolution(resolution);
|
|
121725
121741
|
} else {
|
|
121726
121742
|
nonRelativeExternalModuleResolutions.add(name, resolution);
|
|
@@ -122000,15 +122016,34 @@ ${lanes.join("\n")}
|
|
|
122000
122016
|
return false;
|
|
122001
122017
|
}
|
|
122002
122018
|
(failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
|
|
122003
|
-
const packagePath = parseNodeModuleFromPath(
|
|
122019
|
+
const packagePath = parseNodeModuleFromPath(
|
|
122020
|
+
fileOrDirectoryPath,
|
|
122021
|
+
/*isFolder*/
|
|
122022
|
+
true
|
|
122023
|
+
);
|
|
122004
122024
|
if (packagePath)
|
|
122005
122025
|
(startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(packagePath);
|
|
122006
122026
|
}
|
|
122007
122027
|
}
|
|
122008
122028
|
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
122009
122029
|
}
|
|
122030
|
+
function invalidatePackageJsonMap() {
|
|
122031
|
+
const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
|
|
122032
|
+
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
122033
|
+
packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
|
|
122034
|
+
}
|
|
122035
|
+
}
|
|
122010
122036
|
function invalidateResolutionsOfFailedLookupLocations() {
|
|
122011
122037
|
var _a;
|
|
122038
|
+
if (allResolutionsAreInvalidated) {
|
|
122039
|
+
affectingPathChecksForFile = void 0;
|
|
122040
|
+
invalidatePackageJsonMap();
|
|
122041
|
+
failedLookupChecks = void 0;
|
|
122042
|
+
startsWithPathChecks = void 0;
|
|
122043
|
+
isInDirectoryChecks = void 0;
|
|
122044
|
+
affectingPathChecks = void 0;
|
|
122045
|
+
return true;
|
|
122046
|
+
}
|
|
122012
122047
|
let invalidated = false;
|
|
122013
122048
|
if (affectingPathChecksForFile) {
|
|
122014
122049
|
(_a = resolutionHost.getCurrentProgram()) == null ? void 0 : _a.getSourceFiles().forEach((f) => {
|
|
@@ -122023,10 +122058,7 @@ ${lanes.join("\n")}
|
|
|
122023
122058
|
return invalidated;
|
|
122024
122059
|
}
|
|
122025
122060
|
invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution) || invalidated;
|
|
122026
|
-
|
|
122027
|
-
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
122028
|
-
packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
|
|
122029
|
-
}
|
|
122061
|
+
invalidatePackageJsonMap();
|
|
122030
122062
|
failedLookupChecks = void 0;
|
|
122031
122063
|
startsWithPathChecks = void 0;
|
|
122032
122064
|
isInDirectoryChecks = void 0;
|
|
@@ -122983,7 +123015,8 @@ ${lanes.join("\n")}
|
|
|
122983
123015
|
if (hasChangedCompilerOptions) {
|
|
122984
123016
|
newLine = updateNewLine();
|
|
122985
123017
|
if (program && changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) {
|
|
122986
|
-
|
|
123018
|
+
debugger;
|
|
123019
|
+
resolutionCache.onChangesAffectModuleResolution();
|
|
122987
123020
|
}
|
|
122988
123021
|
}
|
|
122989
123022
|
const hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions);
|
|
@@ -171299,7 +171332,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171299
171332
|
if (changesAffectModuleResolution(oldOptions, compilerOptions)) {
|
|
171300
171333
|
this.cachedUnresolvedImportsPerFile.clear();
|
|
171301
171334
|
this.lastCachedUnresolvedImportsList = void 0;
|
|
171302
|
-
this.resolutionCache.
|
|
171335
|
+
this.resolutionCache.onChangesAffectModuleResolution();
|
|
171303
171336
|
this.moduleSpecifierCache.clear();
|
|
171304
171337
|
}
|
|
171305
171338
|
this.markAsDirty();
|
|
@@ -171747,13 +171780,18 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171747
171780
|
/*isJsInferredProject*/
|
|
171748
171781
|
true
|
|
171749
171782
|
);
|
|
171783
|
+
} else if (this.isOrphan() && this._isJsInferredProject && !info.isJavaScript()) {
|
|
171784
|
+
this.toggleJsInferredProject(
|
|
171785
|
+
/*isJsInferredProject*/
|
|
171786
|
+
false
|
|
171787
|
+
);
|
|
171750
171788
|
}
|
|
171751
171789
|
super.addRoot(info);
|
|
171752
171790
|
}
|
|
171753
171791
|
removeRoot(info) {
|
|
171754
171792
|
this.projectService.stopWatchingConfigFilesForInferredProjectRoot(info);
|
|
171755
171793
|
super.removeRoot(info);
|
|
171756
|
-
if (this._isJsInferredProject && info.isJavaScript()) {
|
|
171794
|
+
if (!this.isOrphan() && this._isJsInferredProject && info.isJavaScript()) {
|
|
171757
171795
|
if (every(this.getRootScriptInfos(), (rootInfo) => !rootInfo.isJavaScript())) {
|
|
171758
171796
|
this.toggleJsInferredProject(
|
|
171759
171797
|
/*isJsInferredProject*/
|
|
@@ -176950,7 +176988,7 @@ ${json}${newLine}`;
|
|
|
176950
176988
|
}));
|
|
176951
176989
|
this.host = opts.host;
|
|
176952
176990
|
this.cancellationToken = opts.cancellationToken;
|
|
176953
|
-
this.typingsInstaller = opts.typingsInstaller;
|
|
176991
|
+
this.typingsInstaller = opts.typingsInstaller || nullTypingsInstaller;
|
|
176954
176992
|
this.byteLength = opts.byteLength;
|
|
176955
176993
|
this.hrtime = opts.hrtime;
|
|
176956
176994
|
this.logger = opts.logger;
|
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.1";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230419`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -19288,7 +19288,7 @@ ${lanes.join("\n")}
|
|
|
19288
19288
|
supportedTSExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */], [".cts" /* Cts */, ".d.cts" /* Dcts */], [".mts" /* Mts */, ".d.mts" /* Dmts */]];
|
|
19289
19289
|
supportedTSExtensionsFlat = flatten(supportedTSExtensions);
|
|
19290
19290
|
supportedTSExtensionsWithJson = [...supportedTSExtensions, [".json" /* Json */]];
|
|
19291
|
-
supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx
|
|
19291
|
+
supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */];
|
|
19292
19292
|
supportedJSExtensions = [[".js" /* Js */, ".jsx" /* Jsx */], [".mjs" /* Mjs */], [".cjs" /* Cjs */]];
|
|
19293
19293
|
supportedJSExtensionsFlat = flatten(supportedJSExtensions);
|
|
19294
19294
|
allSupportedExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */, ".js" /* Js */, ".jsx" /* Jsx */], [".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */], [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */]];
|
|
@@ -40003,22 +40003,22 @@ ${lanes.join("\n")}
|
|
|
40003
40003
|
function pathContainsNodeModules(path) {
|
|
40004
40004
|
return stringContains(path, nodeModulesPathPart);
|
|
40005
40005
|
}
|
|
40006
|
-
function parseNodeModuleFromPath(resolved) {
|
|
40006
|
+
function parseNodeModuleFromPath(resolved, isFolder) {
|
|
40007
40007
|
const path = normalizePath(resolved);
|
|
40008
40008
|
const idx = path.lastIndexOf(nodeModulesPathPart);
|
|
40009
40009
|
if (idx === -1) {
|
|
40010
40010
|
return void 0;
|
|
40011
40011
|
}
|
|
40012
40012
|
const indexAfterNodeModules = idx + nodeModulesPathPart.length;
|
|
40013
|
-
let indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterNodeModules);
|
|
40013
|
+
let indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterNodeModules, isFolder);
|
|
40014
40014
|
if (path.charCodeAt(indexAfterNodeModules) === 64 /* at */) {
|
|
40015
|
-
indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName);
|
|
40015
|
+
indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName, isFolder);
|
|
40016
40016
|
}
|
|
40017
40017
|
return path.slice(0, indexAfterPackageName);
|
|
40018
40018
|
}
|
|
40019
|
-
function moveToNextDirectorySeparatorIfAvailable(path, prevSeparatorIndex) {
|
|
40019
|
+
function moveToNextDirectorySeparatorIfAvailable(path, prevSeparatorIndex, isFolder) {
|
|
40020
40020
|
const nextSeparatorIndex = path.indexOf(directorySeparator, prevSeparatorIndex + 1);
|
|
40021
|
-
return nextSeparatorIndex === -1 ? prevSeparatorIndex : nextSeparatorIndex;
|
|
40021
|
+
return nextSeparatorIndex === -1 ? isFolder ? path.length : prevSeparatorIndex : nextSeparatorIndex;
|
|
40022
40022
|
}
|
|
40023
40023
|
function loadModuleFromFileNoPackageId(extensions, candidate, onlyRecordFailures, state) {
|
|
40024
40024
|
return noPackageId(loadModuleFromFile(extensions, candidate, onlyRecordFailures, state));
|
|
@@ -41516,7 +41516,7 @@ ${lanes.join("\n")}
|
|
|
41516
41516
|
return getSymbolNameForPrivateIdentifier(containingClassSymbol, name.escapedText);
|
|
41517
41517
|
}
|
|
41518
41518
|
if (isJsxNamespacedName(name)) {
|
|
41519
|
-
return
|
|
41519
|
+
return getEscapedTextOfJsxNamespacedName(name);
|
|
41520
41520
|
}
|
|
41521
41521
|
return isPropertyNameLiteral(name) ? getEscapedTextOfIdentifierOrLiteral(name) : void 0;
|
|
41522
41522
|
}
|
|
@@ -69343,7 +69343,7 @@ ${lanes.join("\n")}
|
|
|
69343
69343
|
return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType2(conditional, contextFlags) : void 0;
|
|
69344
69344
|
}
|
|
69345
69345
|
function getContextualTypeForChildJsxExpression(node, child, contextFlags) {
|
|
69346
|
-
const attributesType = getApparentTypeOfContextualType(node.openingElement.
|
|
69346
|
+
const attributesType = getApparentTypeOfContextualType(node.openingElement.attributes, contextFlags);
|
|
69347
69347
|
const jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
|
|
69348
69348
|
if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) {
|
|
69349
69349
|
return void 0;
|
|
@@ -113561,7 +113561,7 @@ ${lanes.join("\n")}
|
|
|
113561
113561
|
}
|
|
113562
113562
|
}
|
|
113563
113563
|
function emitEmbeddedStatement(parent2, node) {
|
|
113564
|
-
if (isBlock(node) || getEmitFlags(parent2) & 1 /* SingleLine */) {
|
|
113564
|
+
if (isBlock(node) || getEmitFlags(parent2) & 1 /* SingleLine */ || preserveSourceNewlines && !getLeadingLineTerminatorCount(parent2, node, 0 /* None */)) {
|
|
113565
113565
|
writeSpace();
|
|
113566
113566
|
emit(node);
|
|
113567
113567
|
} else {
|
|
@@ -116422,7 +116422,7 @@ ${lanes.join("\n")}
|
|
|
116422
116422
|
automaticTypeDirectiveResolutions = createModeAwareCache();
|
|
116423
116423
|
if (automaticTypeDirectiveNames.length) {
|
|
116424
116424
|
(_k = tracing) == null ? void 0 : _k.push(tracing.Phase.Program, "processTypeReferences", { count: automaticTypeDirectiveNames.length });
|
|
116425
|
-
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) :
|
|
116425
|
+
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
116426
116426
|
const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile);
|
|
116427
116427
|
const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(automaticTypeDirectiveNames, containingFilename);
|
|
116428
116428
|
for (let i = 0; i < automaticTypeDirectiveNames.length; i++) {
|
|
@@ -118213,8 +118213,9 @@ ${lanes.join("\n")}
|
|
|
118213
118213
|
path += (i === 2 ? "/" : "-") + components[i];
|
|
118214
118214
|
i++;
|
|
118215
118215
|
}
|
|
118216
|
-
const
|
|
118217
|
-
const
|
|
118216
|
+
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
118217
|
+
const resolveFrom = combinePaths(containingDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`);
|
|
118218
|
+
const localOverrideModuleResult = resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: 2 /* Node10 */, traceResolution: options.traceResolution }, host, moduleResolutionCache);
|
|
118218
118219
|
if (localOverrideModuleResult == null ? void 0 : localOverrideModuleResult.resolvedModule) {
|
|
118219
118220
|
return localOverrideModuleResult.resolvedModule.resolvedFileName;
|
|
118220
118221
|
}
|
|
@@ -118349,7 +118350,7 @@ ${lanes.join("\n")}
|
|
|
118349
118350
|
void 0
|
|
118350
118351
|
);
|
|
118351
118352
|
} else {
|
|
118352
|
-
const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath),
|
|
118353
|
+
const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath), currentDirectory);
|
|
118353
118354
|
sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
|
|
118354
118355
|
addFileToFilesByName(
|
|
118355
118356
|
sourceFile,
|
|
@@ -121380,6 +121381,7 @@ ${lanes.join("\n")}
|
|
|
121380
121381
|
let failedLookupChecks;
|
|
121381
121382
|
let startsWithPathChecks;
|
|
121382
121383
|
let isInDirectoryChecks;
|
|
121384
|
+
let allResolutionsAreInvalidated = false;
|
|
121383
121385
|
const getCurrentDirectory = memoize(() => resolutionHost.getCurrentDirectory());
|
|
121384
121386
|
const cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
|
|
121385
121387
|
const resolvedModuleNames = /* @__PURE__ */ new Map();
|
|
@@ -121422,7 +121424,8 @@ ${lanes.join("\n")}
|
|
|
121422
121424
|
isFileWithInvalidatedNonRelativeUnresolvedImports,
|
|
121423
121425
|
updateTypeRootsWatch,
|
|
121424
121426
|
closeTypeRootsWatch,
|
|
121425
|
-
clear: clear2
|
|
121427
|
+
clear: clear2,
|
|
121428
|
+
onChangesAffectModuleResolution
|
|
121426
121429
|
};
|
|
121427
121430
|
function getResolvedModule2(resolution) {
|
|
121428
121431
|
return resolution.resolvedModule;
|
|
@@ -121445,6 +121448,7 @@ ${lanes.join("\n")}
|
|
|
121445
121448
|
isInDirectoryChecks = void 0;
|
|
121446
121449
|
affectingPathChecks = void 0;
|
|
121447
121450
|
affectingPathChecksForFile = void 0;
|
|
121451
|
+
allResolutionsAreInvalidated = false;
|
|
121448
121452
|
moduleResolutionCache.clear();
|
|
121449
121453
|
typeReferenceDirectiveResolutionCache.clear();
|
|
121450
121454
|
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
@@ -121452,6 +121456,13 @@ ${lanes.join("\n")}
|
|
|
121452
121456
|
impliedFormatPackageJsons.clear();
|
|
121453
121457
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
121454
121458
|
}
|
|
121459
|
+
function onChangesAffectModuleResolution() {
|
|
121460
|
+
allResolutionsAreInvalidated = true;
|
|
121461
|
+
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
121462
|
+
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
121463
|
+
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
121464
|
+
typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
121465
|
+
}
|
|
121455
121466
|
function startRecordingFilesWithChangedResolutions() {
|
|
121456
121467
|
filesWithChangedSetOfUnresolvedImports = [];
|
|
121457
121468
|
}
|
|
@@ -121471,7 +121482,7 @@ ${lanes.join("\n")}
|
|
|
121471
121482
|
invalidateResolutionsOfFailedLookupLocations();
|
|
121472
121483
|
const collected = filesWithInvalidatedResolutions;
|
|
121473
121484
|
filesWithInvalidatedResolutions = void 0;
|
|
121474
|
-
return (path) => customHasInvalidatedResolutions(path) || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
121485
|
+
return (path) => customHasInvalidatedResolutions(path) || allResolutionsAreInvalidated || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
121475
121486
|
}
|
|
121476
121487
|
function startCachingPerDirectoryResolution() {
|
|
121477
121488
|
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
@@ -121481,6 +121492,7 @@ ${lanes.join("\n")}
|
|
|
121481
121492
|
}
|
|
121482
121493
|
function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
|
|
121483
121494
|
filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
|
|
121495
|
+
allResolutionsAreInvalidated = false;
|
|
121484
121496
|
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
121485
121497
|
nonRelativeExternalModuleResolutions.clear();
|
|
121486
121498
|
if (newProgram !== oldProgram) {
|
|
@@ -121575,6 +121587,7 @@ ${lanes.join("\n")}
|
|
|
121575
121587
|
reusedNames,
|
|
121576
121588
|
loader,
|
|
121577
121589
|
getResolutionWithResolvedFileName,
|
|
121590
|
+
deferWatchingNonRelativeResolution,
|
|
121578
121591
|
shouldRetryResolution,
|
|
121579
121592
|
logChanges
|
|
121580
121593
|
}) {
|
|
@@ -121591,15 +121604,15 @@ ${lanes.join("\n")}
|
|
|
121591
121604
|
const name = loader.nameAndMode.getName(entry);
|
|
121592
121605
|
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
121593
121606
|
let resolution = resolutionsInFile.get(name, mode);
|
|
121594
|
-
if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
121595
|
-
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) {
|
|
121607
|
+
if (!seenNamesInFile.has(name, mode) && (allResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
121608
|
+
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
121596
121609
|
const existingResolution = resolution;
|
|
121597
121610
|
resolution = loader.resolve(name, mode);
|
|
121598
121611
|
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
121599
121612
|
resolutionHost.onDiscoveredSymlink();
|
|
121600
121613
|
}
|
|
121601
121614
|
resolutionsInFile.set(name, mode, resolution);
|
|
121602
|
-
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
|
121615
|
+
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution);
|
|
121603
121616
|
if (existingResolution) {
|
|
121604
121617
|
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName);
|
|
121605
121618
|
}
|
|
@@ -121675,7 +121688,8 @@ ${lanes.join("\n")}
|
|
|
121675
121688
|
typeReferenceDirectiveResolutionCache
|
|
121676
121689
|
),
|
|
121677
121690
|
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective2,
|
|
121678
|
-
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0
|
|
121691
|
+
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0,
|
|
121692
|
+
deferWatchingNonRelativeResolution: false
|
|
121679
121693
|
});
|
|
121680
121694
|
}
|
|
121681
121695
|
function resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
|
|
@@ -121694,7 +121708,9 @@ ${lanes.join("\n")}
|
|
|
121694
121708
|
),
|
|
121695
121709
|
getResolutionWithResolvedFileName: getResolvedModule2,
|
|
121696
121710
|
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|
|
121697
|
-
logChanges: logChangesWhenResolvingModule
|
|
121711
|
+
logChanges: logChangesWhenResolvingModule,
|
|
121712
|
+
deferWatchingNonRelativeResolution: true
|
|
121713
|
+
// Defer non relative resolution watch because we could be using ambient modules
|
|
121698
121714
|
});
|
|
121699
121715
|
}
|
|
121700
121716
|
function resolveSingleModuleNameWithoutWatching(moduleName, containingFile) {
|
|
@@ -121712,7 +121728,7 @@ ${lanes.join("\n")}
|
|
|
121712
121728
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
121713
121729
|
return endsWith(dirPath, "/node_modules/@types");
|
|
121714
121730
|
}
|
|
121715
|
-
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
|
|
121731
|
+
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution) {
|
|
121716
121732
|
var _a;
|
|
121717
121733
|
if (resolution.refCount) {
|
|
121718
121734
|
resolution.refCount++;
|
|
@@ -121720,7 +121736,7 @@ ${lanes.join("\n")}
|
|
|
121720
121736
|
} else {
|
|
121721
121737
|
resolution.refCount = 1;
|
|
121722
121738
|
Debug.assert(!((_a = resolution.files) == null ? void 0 : _a.size));
|
|
121723
|
-
if (isExternalModuleNameRelative(name)) {
|
|
121739
|
+
if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
|
|
121724
121740
|
watchFailedLookupLocationOfResolution(resolution);
|
|
121725
121741
|
} else {
|
|
121726
121742
|
nonRelativeExternalModuleResolutions.add(name, resolution);
|
|
@@ -122000,15 +122016,34 @@ ${lanes.join("\n")}
|
|
|
122000
122016
|
return false;
|
|
122001
122017
|
}
|
|
122002
122018
|
(failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
|
|
122003
|
-
const packagePath = parseNodeModuleFromPath(
|
|
122019
|
+
const packagePath = parseNodeModuleFromPath(
|
|
122020
|
+
fileOrDirectoryPath,
|
|
122021
|
+
/*isFolder*/
|
|
122022
|
+
true
|
|
122023
|
+
);
|
|
122004
122024
|
if (packagePath)
|
|
122005
122025
|
(startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(packagePath);
|
|
122006
122026
|
}
|
|
122007
122027
|
}
|
|
122008
122028
|
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
122009
122029
|
}
|
|
122030
|
+
function invalidatePackageJsonMap() {
|
|
122031
|
+
const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
|
|
122032
|
+
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
122033
|
+
packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
|
|
122034
|
+
}
|
|
122035
|
+
}
|
|
122010
122036
|
function invalidateResolutionsOfFailedLookupLocations() {
|
|
122011
122037
|
var _a;
|
|
122038
|
+
if (allResolutionsAreInvalidated) {
|
|
122039
|
+
affectingPathChecksForFile = void 0;
|
|
122040
|
+
invalidatePackageJsonMap();
|
|
122041
|
+
failedLookupChecks = void 0;
|
|
122042
|
+
startsWithPathChecks = void 0;
|
|
122043
|
+
isInDirectoryChecks = void 0;
|
|
122044
|
+
affectingPathChecks = void 0;
|
|
122045
|
+
return true;
|
|
122046
|
+
}
|
|
122012
122047
|
let invalidated = false;
|
|
122013
122048
|
if (affectingPathChecksForFile) {
|
|
122014
122049
|
(_a = resolutionHost.getCurrentProgram()) == null ? void 0 : _a.getSourceFiles().forEach((f) => {
|
|
@@ -122023,10 +122058,7 @@ ${lanes.join("\n")}
|
|
|
122023
122058
|
return invalidated;
|
|
122024
122059
|
}
|
|
122025
122060
|
invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution) || invalidated;
|
|
122026
|
-
|
|
122027
|
-
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
122028
|
-
packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
|
|
122029
|
-
}
|
|
122061
|
+
invalidatePackageJsonMap();
|
|
122030
122062
|
failedLookupChecks = void 0;
|
|
122031
122063
|
startsWithPathChecks = void 0;
|
|
122032
122064
|
isInDirectoryChecks = void 0;
|
|
@@ -122983,7 +123015,8 @@ ${lanes.join("\n")}
|
|
|
122983
123015
|
if (hasChangedCompilerOptions) {
|
|
122984
123016
|
newLine = updateNewLine();
|
|
122985
123017
|
if (program && changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) {
|
|
122986
|
-
|
|
123018
|
+
debugger;
|
|
123019
|
+
resolutionCache.onChangesAffectModuleResolution();
|
|
122987
123020
|
}
|
|
122988
123021
|
}
|
|
122989
123022
|
const hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions);
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.1";
|
|
57
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
57
|
+
var version = `${versionMajorMinor}.0-dev.20230419`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -11483,7 +11483,7 @@ function getScriptKindFromFileName(fileName) {
|
|
|
11483
11483
|
var supportedTSExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */], [".cts" /* Cts */, ".d.cts" /* Dcts */], [".mts" /* Mts */, ".d.mts" /* Dmts */]];
|
|
11484
11484
|
var supportedTSExtensionsFlat = flatten(supportedTSExtensions);
|
|
11485
11485
|
var supportedTSExtensionsWithJson = [...supportedTSExtensions, [".json" /* Json */]];
|
|
11486
|
-
var supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx
|
|
11486
|
+
var supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */];
|
|
11487
11487
|
var supportedJSExtensions = [[".js" /* Js */, ".jsx" /* Jsx */], [".mjs" /* Mjs */], [".cjs" /* Cjs */]];
|
|
11488
11488
|
var supportedJSExtensionsFlat = flatten(supportedJSExtensions);
|
|
11489
11489
|
var allSupportedExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */, ".js" /* Js */, ".jsx" /* Jsx */], [".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */], [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */]];
|
|
@@ -27734,22 +27734,22 @@ var nodeModulesPathPart = "/node_modules/";
|
|
|
27734
27734
|
function pathContainsNodeModules(path2) {
|
|
27735
27735
|
return stringContains(path2, nodeModulesPathPart);
|
|
27736
27736
|
}
|
|
27737
|
-
function parseNodeModuleFromPath(resolved) {
|
|
27737
|
+
function parseNodeModuleFromPath(resolved, isFolder) {
|
|
27738
27738
|
const path2 = normalizePath(resolved);
|
|
27739
27739
|
const idx = path2.lastIndexOf(nodeModulesPathPart);
|
|
27740
27740
|
if (idx === -1) {
|
|
27741
27741
|
return void 0;
|
|
27742
27742
|
}
|
|
27743
27743
|
const indexAfterNodeModules = idx + nodeModulesPathPart.length;
|
|
27744
|
-
let indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path2, indexAfterNodeModules);
|
|
27744
|
+
let indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path2, indexAfterNodeModules, isFolder);
|
|
27745
27745
|
if (path2.charCodeAt(indexAfterNodeModules) === 64 /* at */) {
|
|
27746
|
-
indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path2, indexAfterPackageName);
|
|
27746
|
+
indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path2, indexAfterPackageName, isFolder);
|
|
27747
27747
|
}
|
|
27748
27748
|
return path2.slice(0, indexAfterPackageName);
|
|
27749
27749
|
}
|
|
27750
|
-
function moveToNextDirectorySeparatorIfAvailable(path2, prevSeparatorIndex) {
|
|
27750
|
+
function moveToNextDirectorySeparatorIfAvailable(path2, prevSeparatorIndex, isFolder) {
|
|
27751
27751
|
const nextSeparatorIndex = path2.indexOf(directorySeparator, prevSeparatorIndex + 1);
|
|
27752
|
-
return nextSeparatorIndex === -1 ? prevSeparatorIndex : nextSeparatorIndex;
|
|
27752
|
+
return nextSeparatorIndex === -1 ? isFolder ? path2.length : prevSeparatorIndex : nextSeparatorIndex;
|
|
27753
27753
|
}
|
|
27754
27754
|
function loadModuleFromFileNoPackageId(extensions, candidate, onlyRecordFailures, state) {
|
|
27755
27755
|
return noPackageId(loadModuleFromFile(extensions, candidate, onlyRecordFailures, state));
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.1.0-dev.
|
|
5
|
+
"version": "5.1.0-dev.20230419",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"node": "14.21.1",
|
|
114
114
|
"npm": "8.19.3"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "d346d57162d74d1919b4fc1510b856fdcd7dbed2"
|
|
117
117
|
}
|