typescript 5.0.0-dev.20221129 → 5.0.0-dev.20221201
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 +38 -24
- package/lib/tsserver.js +39 -25
- package/lib/tsserverlibrary.js +39 -25
- package/lib/typescript.js +39 -25
- package/lib/typingsInstaller.js +15 -9
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -23,7 +23,7 @@ var __export = (target, all) => {
|
|
|
23
23
|
|
|
24
24
|
// src/compiler/corePublic.ts
|
|
25
25
|
var versionMajorMinor = "5.0";
|
|
26
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
26
|
+
var version = `${versionMajorMinor}.0-dev.20221201`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -33767,7 +33767,7 @@ function tryFileLookup(fileName, onlyRecordFailures, state) {
|
|
|
33767
33767
|
function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson = true) {
|
|
33768
33768
|
const packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : void 0;
|
|
33769
33769
|
const packageJsonContent = packageInfo && packageInfo.contents.packageJsonContent;
|
|
33770
|
-
const versionPaths = packageInfo && packageInfo
|
|
33770
|
+
const versionPaths = packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state);
|
|
33771
33771
|
return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
|
|
33772
33772
|
}
|
|
33773
33773
|
function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options) {
|
|
@@ -33797,6 +33797,12 @@ function getPackageScopeForPath(fileName, state) {
|
|
|
33797
33797
|
}
|
|
33798
33798
|
return void 0;
|
|
33799
33799
|
}
|
|
33800
|
+
function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
|
|
33801
|
+
if (packageJsonInfo.contents.versionPaths === void 0) {
|
|
33802
|
+
packageJsonInfo.contents.versionPaths = readPackageJsonTypesVersionPaths(packageJsonInfo.contents.packageJsonContent, state) || false;
|
|
33803
|
+
}
|
|
33804
|
+
return packageJsonInfo.contents.versionPaths || void 0;
|
|
33805
|
+
}
|
|
33800
33806
|
function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
33801
33807
|
var _a2, _b, _c;
|
|
33802
33808
|
const { host, traceEnabled } = state;
|
|
@@ -33825,8 +33831,7 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
|
33825
33831
|
if (traceEnabled) {
|
|
33826
33832
|
trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
33827
33833
|
}
|
|
33828
|
-
const
|
|
33829
|
-
const result = { packageDirectory, contents: { packageJsonContent, versionPaths, resolvedEntrypoints: void 0 } };
|
|
33834
|
+
const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
|
|
33830
33835
|
(_b = state.packageJsonInfoCache) == null ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
|
|
33831
33836
|
state.affectingLocations.push(packageJsonPath);
|
|
33832
33837
|
return result;
|
|
@@ -34291,7 +34296,7 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
|
|
|
34291
34296
|
!nodeModulesDirectoryExists,
|
|
34292
34297
|
state,
|
|
34293
34298
|
packageInfo.contents.packageJsonContent,
|
|
34294
|
-
packageInfo
|
|
34299
|
+
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
|
34295
34300
|
);
|
|
34296
34301
|
return withPackageId(packageInfo, fromDirectory);
|
|
34297
34302
|
}
|
|
@@ -34303,7 +34308,7 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
|
|
|
34303
34308
|
onlyRecordFailures,
|
|
34304
34309
|
state2,
|
|
34305
34310
|
packageInfo && packageInfo.contents.packageJsonContent,
|
|
34306
|
-
packageInfo && packageInfo
|
|
34311
|
+
packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state2)
|
|
34307
34312
|
);
|
|
34308
34313
|
if (!pathAndExtension && packageInfo && (packageInfo.contents.packageJsonContent.exports === void 0 || packageInfo.contents.packageJsonContent.exports === null) && state2.features & 32 /* EsmMode */) {
|
|
34309
34314
|
pathAndExtension = loadModuleFromFile(extensions2, combinePaths(candidate2, "index.js"), onlyRecordFailures, state2);
|
|
@@ -34318,12 +34323,13 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
|
|
|
34318
34323
|
if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & 8 /* Exports */) {
|
|
34319
34324
|
return (_a2 = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)) == null ? void 0 : _a2.value;
|
|
34320
34325
|
}
|
|
34321
|
-
|
|
34326
|
+
const versionPaths = rest !== "" && packageInfo ? getVersionPathsOfPackageJsonInfo(packageInfo, state) : void 0;
|
|
34327
|
+
if (versionPaths) {
|
|
34322
34328
|
if (state.traceEnabled) {
|
|
34323
|
-
trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2,
|
|
34329
|
+
trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, version, rest);
|
|
34324
34330
|
}
|
|
34325
34331
|
const packageDirectoryExists = nodeModulesDirectoryExists && directoryProbablyExists(packageDirectory, state.host);
|
|
34326
|
-
const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory,
|
|
34332
|
+
const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, void 0, loader, !packageDirectoryExists, state);
|
|
34327
34333
|
if (fromPaths) {
|
|
34328
34334
|
return fromPaths.value;
|
|
34329
34335
|
}
|
|
@@ -51607,7 +51613,7 @@ function createTypeChecker(host) {
|
|
|
51607
51613
|
return isTypeRelatedTo(source, target, assignableRelation);
|
|
51608
51614
|
}
|
|
51609
51615
|
function isTypeDerivedFrom(source, target) {
|
|
51610
|
-
return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) : target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType);
|
|
51616
|
+
return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 2097152 /* Intersection */ ? some(source.types, (t) => isTypeDerivedFrom(t, target)) : source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : isEmptyAnonymousObjectType(target) ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) : target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) && !isEmptyAnonymousObjectType(source) : target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType);
|
|
51611
51617
|
}
|
|
51612
51618
|
function isTypeComparableTo(source, target) {
|
|
51613
51619
|
return isTypeRelatedTo(source, target, comparableRelation);
|
|
@@ -54534,7 +54540,8 @@ function createTypeChecker(host) {
|
|
|
54534
54540
|
return !!(type.flags & 109440 /* Unit */);
|
|
54535
54541
|
}
|
|
54536
54542
|
function isUnitLikeType(type) {
|
|
54537
|
-
|
|
54543
|
+
const t = getBaseConstraintOrType(type);
|
|
54544
|
+
return t.flags & 2097152 /* Intersection */ ? some(t.types, isUnitType) : isUnitType(t);
|
|
54538
54545
|
}
|
|
54539
54546
|
function extractUnitType(type) {
|
|
54540
54547
|
return type.flags & 2097152 /* Intersection */ ? find(type.types, isUnitType) || type : type;
|
|
@@ -101262,7 +101269,7 @@ function getBuildInfo2(state, bundle) {
|
|
|
101262
101269
|
for (const path of arrayFrom(state.affectedFilesPendingEmit.keys()).sort(compareStringsCaseSensitive)) {
|
|
101263
101270
|
if (tryAddToSet(seenFiles, path)) {
|
|
101264
101271
|
const file = state.program.getSourceFileByPath(path);
|
|
101265
|
-
if (!sourceFileMayBeEmitted(file, state.program))
|
|
101272
|
+
if (!file || !sourceFileMayBeEmitted(file, state.program))
|
|
101266
101273
|
continue;
|
|
101267
101274
|
const fileId = toFileId(path), pendingEmit = state.affectedFilesPendingEmit.get(path);
|
|
101268
101275
|
(affectedFilesPendingEmit || (affectedFilesPendingEmit = [])).push(
|
|
@@ -103085,9 +103092,9 @@ function createWatchFactory(host, options) {
|
|
|
103085
103092
|
function createCompilerHostFromProgramHost(host, getCompilerOptions, directoryStructureHost = host) {
|
|
103086
103093
|
const useCaseSensitiveFileNames = host.useCaseSensitiveFileNames();
|
|
103087
103094
|
const hostGetNewLine = memoize(() => host.getNewLine());
|
|
103088
|
-
|
|
103095
|
+
const compilerHost = {
|
|
103089
103096
|
getSourceFile: createGetSourceFile(
|
|
103090
|
-
(fileName, encoding) => host.readFile(fileName, encoding),
|
|
103097
|
+
(fileName, encoding) => !encoding ? compilerHost.readFile(fileName) : host.readFile(fileName, encoding),
|
|
103091
103098
|
getCompilerOptions,
|
|
103092
103099
|
void 0
|
|
103093
103100
|
),
|
|
@@ -103114,6 +103121,7 @@ function createCompilerHostFromProgramHost(host, getCompilerOptions, directorySt
|
|
|
103114
103121
|
disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
|
|
103115
103122
|
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
|
|
103116
103123
|
};
|
|
103124
|
+
return compilerHost;
|
|
103117
103125
|
}
|
|
103118
103126
|
function getSourceFileVersionAsHashFromText(host, text) {
|
|
103119
103127
|
if (text.match(sourceMapCommentRegExpDontCareLineStart)) {
|
|
@@ -103147,12 +103155,12 @@ function getSourceFileVersionAsHashFromText(host, text) {
|
|
|
103147
103155
|
}
|
|
103148
103156
|
return (host.createHash || generateDjb2Hash)(text);
|
|
103149
103157
|
}
|
|
103150
|
-
function setGetSourceFileAsHashVersioned(compilerHost
|
|
103158
|
+
function setGetSourceFileAsHashVersioned(compilerHost) {
|
|
103151
103159
|
const originalGetSourceFile = compilerHost.getSourceFile;
|
|
103152
103160
|
compilerHost.getSourceFile = (...args) => {
|
|
103153
103161
|
const result = originalGetSourceFile.call(compilerHost, ...args);
|
|
103154
103162
|
if (result) {
|
|
103155
|
-
result.version = getSourceFileVersionAsHashFromText(
|
|
103163
|
+
result.version = getSourceFileVersionAsHashFromText(compilerHost, result.text);
|
|
103156
103164
|
}
|
|
103157
103165
|
return result;
|
|
103158
103166
|
};
|
|
@@ -103281,7 +103289,7 @@ function createIncrementalCompilerHost(options, system = sys) {
|
|
|
103281
103289
|
host.createHash = maybeBind(system, system.createHash);
|
|
103282
103290
|
host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
|
|
103283
103291
|
host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
|
|
103284
|
-
setGetSourceFileAsHashVersioned(host
|
|
103292
|
+
setGetSourceFileAsHashVersioned(host);
|
|
103285
103293
|
changeCompilerHostLikeToUseCache(host, (fileName) => toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName));
|
|
103286
103294
|
return host;
|
|
103287
103295
|
}
|
|
@@ -103343,7 +103351,7 @@ function createWatchProgram(host) {
|
|
|
103343
103351
|
configFileWatcher = watchFile2(configFileName, scheduleProgramReload, 2e3 /* High */, watchOptions, WatchType.ConfigFile);
|
|
103344
103352
|
}
|
|
103345
103353
|
const compilerHost = createCompilerHostFromProgramHost(host, () => compilerOptions, directoryStructureHost);
|
|
103346
|
-
setGetSourceFileAsHashVersioned(compilerHost
|
|
103354
|
+
setGetSourceFileAsHashVersioned(compilerHost);
|
|
103347
103355
|
const getNewSourceFile = compilerHost.getSourceFile;
|
|
103348
103356
|
compilerHost.getSourceFile = (fileName, ...args) => getVersionedSourceFileByPath(fileName, toPath3(fileName), ...args);
|
|
103349
103357
|
compilerHost.getSourceFileByPath = getVersionedSourceFileByPath;
|
|
@@ -103442,9 +103450,10 @@ function createWatchProgram(host) {
|
|
|
103442
103450
|
originalFileExists,
|
|
103443
103451
|
originalDirectoryExists,
|
|
103444
103452
|
originalCreateDirectory,
|
|
103445
|
-
originalWriteFile
|
|
103453
|
+
originalWriteFile,
|
|
103454
|
+
readFileWithCache
|
|
103446
103455
|
} = changeCompilerHostLikeToUseCache(compilerHost, toPath3);
|
|
103447
|
-
if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
103456
|
+
if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, (path) => getSourceVersion(path, readFileWithCache), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
103448
103457
|
if (hasChangedConfigFileParsingErrors) {
|
|
103449
103458
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
103450
103459
|
reportWatchDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
@@ -103563,9 +103572,14 @@ function createWatchProgram(host) {
|
|
|
103563
103572
|
}
|
|
103564
103573
|
}
|
|
103565
103574
|
}
|
|
103566
|
-
function getSourceVersion(path) {
|
|
103575
|
+
function getSourceVersion(path, readFileWithCache) {
|
|
103567
103576
|
const hostSourceFile = sourceFilesCache.get(path);
|
|
103568
|
-
|
|
103577
|
+
if (!hostSourceFile)
|
|
103578
|
+
return void 0;
|
|
103579
|
+
if (hostSourceFile.version)
|
|
103580
|
+
return hostSourceFile.version;
|
|
103581
|
+
const text = readFileWithCache(path);
|
|
103582
|
+
return text !== void 0 ? getSourceFileVersionAsHashFromText(compilerHost, text) : void 0;
|
|
103569
103583
|
}
|
|
103570
103584
|
function onReleaseOldSourceFile(oldSourceFile, _oldOptions, hasSourceFileByPath) {
|
|
103571
103585
|
const hostSourceFileInfo = sourceFilesCache.get(oldSourceFile.resolvedPath);
|
|
@@ -104004,7 +104018,7 @@ function createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, optio
|
|
|
104004
104018
|
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
104005
104019
|
const baseCompilerOptions = getCompilerOptionsOfBuildOptions(options);
|
|
104006
104020
|
const compilerHost = createCompilerHostFromProgramHost(host, () => state.projectCompilerOptions);
|
|
104007
|
-
setGetSourceFileAsHashVersioned(compilerHost
|
|
104021
|
+
setGetSourceFileAsHashVersioned(compilerHost);
|
|
104008
104022
|
compilerHost.getParsedCommandLine = (fileName) => parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName));
|
|
104009
104023
|
compilerHost.resolveModuleNames = maybeBind(host, host.resolveModuleNames);
|
|
104010
104024
|
compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
@@ -105075,7 +105089,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
|
105075
105089
|
buildInfoVersionMap = getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
|
|
105076
105090
|
version2 = buildInfoVersionMap.get(toPath2(state, inputFile));
|
|
105077
105091
|
const text = version2 ? state.readFileWithCache(inputFile) : void 0;
|
|
105078
|
-
currentVersion = text
|
|
105092
|
+
currentVersion = text !== void 0 ? getSourceFileVersionAsHashFromText(host, text) : void 0;
|
|
105079
105093
|
if (version2 && version2 === currentVersion)
|
|
105080
105094
|
pseudoInputUpToDate = true;
|
|
105081
105095
|
}
|
package/lib/tsserver.js
CHANGED
|
@@ -2648,7 +2648,7 @@ var ts = (() => {
|
|
|
2648
2648
|
|
|
2649
2649
|
// src/compiler/corePublic.ts
|
|
2650
2650
|
var versionMajorMinor = "5.0";
|
|
2651
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2651
|
+
var version = `${versionMajorMinor}.0-dev.20221201`;
|
|
2652
2652
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2653
2653
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2654
2654
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -38479,7 +38479,7 @@ ${lanes.join("\n")}
|
|
|
38479
38479
|
function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson = true) {
|
|
38480
38480
|
const packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : void 0;
|
|
38481
38481
|
const packageJsonContent = packageInfo && packageInfo.contents.packageJsonContent;
|
|
38482
|
-
const versionPaths = packageInfo && packageInfo
|
|
38482
|
+
const versionPaths = packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state);
|
|
38483
38483
|
return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
|
|
38484
38484
|
}
|
|
38485
38485
|
function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host, cache, resolveJs) {
|
|
@@ -38498,7 +38498,7 @@ ${lanes.join("\n")}
|
|
|
38498
38498
|
false,
|
|
38499
38499
|
requireState,
|
|
38500
38500
|
packageJsonInfo.contents.packageJsonContent,
|
|
38501
|
-
packageJsonInfo
|
|
38501
|
+
getVersionPathsOfPackageJsonInfo(packageJsonInfo, requireState)
|
|
38502
38502
|
);
|
|
38503
38503
|
entrypoints = append(entrypoints, requireResolution == null ? void 0 : requireResolution.path);
|
|
38504
38504
|
if (features & 8 /* Exports */ && packageJsonInfo.contents.packageJsonContent.exports) {
|
|
@@ -38591,6 +38591,12 @@ ${lanes.join("\n")}
|
|
|
38591
38591
|
}
|
|
38592
38592
|
return void 0;
|
|
38593
38593
|
}
|
|
38594
|
+
function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
|
|
38595
|
+
if (packageJsonInfo.contents.versionPaths === void 0) {
|
|
38596
|
+
packageJsonInfo.contents.versionPaths = readPackageJsonTypesVersionPaths(packageJsonInfo.contents.packageJsonContent, state) || false;
|
|
38597
|
+
}
|
|
38598
|
+
return packageJsonInfo.contents.versionPaths || void 0;
|
|
38599
|
+
}
|
|
38594
38600
|
function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
38595
38601
|
var _a2, _b, _c;
|
|
38596
38602
|
const { host, traceEnabled } = state;
|
|
@@ -38619,8 +38625,7 @@ ${lanes.join("\n")}
|
|
|
38619
38625
|
if (traceEnabled) {
|
|
38620
38626
|
trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
38621
38627
|
}
|
|
38622
|
-
const
|
|
38623
|
-
const result = { packageDirectory, contents: { packageJsonContent, versionPaths, resolvedEntrypoints: void 0 } };
|
|
38628
|
+
const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
|
|
38624
38629
|
(_b = state.packageJsonInfoCache) == null ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
|
|
38625
38630
|
state.affectingLocations.push(packageJsonPath);
|
|
38626
38631
|
return result;
|
|
@@ -39085,7 +39090,7 @@ ${lanes.join("\n")}
|
|
|
39085
39090
|
!nodeModulesDirectoryExists,
|
|
39086
39091
|
state,
|
|
39087
39092
|
packageInfo.contents.packageJsonContent,
|
|
39088
|
-
packageInfo
|
|
39093
|
+
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
|
39089
39094
|
);
|
|
39090
39095
|
return withPackageId(packageInfo, fromDirectory);
|
|
39091
39096
|
}
|
|
@@ -39097,7 +39102,7 @@ ${lanes.join("\n")}
|
|
|
39097
39102
|
onlyRecordFailures,
|
|
39098
39103
|
state2,
|
|
39099
39104
|
packageInfo && packageInfo.contents.packageJsonContent,
|
|
39100
|
-
packageInfo && packageInfo
|
|
39105
|
+
packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state2)
|
|
39101
39106
|
);
|
|
39102
39107
|
if (!pathAndExtension && packageInfo && (packageInfo.contents.packageJsonContent.exports === void 0 || packageInfo.contents.packageJsonContent.exports === null) && state2.features & 32 /* EsmMode */) {
|
|
39103
39108
|
pathAndExtension = loadModuleFromFile(extensions2, combinePaths(candidate2, "index.js"), onlyRecordFailures, state2);
|
|
@@ -39112,12 +39117,13 @@ ${lanes.join("\n")}
|
|
|
39112
39117
|
if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & 8 /* Exports */) {
|
|
39113
39118
|
return (_a2 = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)) == null ? void 0 : _a2.value;
|
|
39114
39119
|
}
|
|
39115
|
-
|
|
39120
|
+
const versionPaths = rest !== "" && packageInfo ? getVersionPathsOfPackageJsonInfo(packageInfo, state) : void 0;
|
|
39121
|
+
if (versionPaths) {
|
|
39116
39122
|
if (state.traceEnabled) {
|
|
39117
|
-
trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2,
|
|
39123
|
+
trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, version, rest);
|
|
39118
39124
|
}
|
|
39119
39125
|
const packageDirectoryExists = nodeModulesDirectoryExists && directoryProbablyExists(packageDirectory, state.host);
|
|
39120
|
-
const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory,
|
|
39126
|
+
const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, void 0, loader, !packageDirectoryExists, state);
|
|
39121
39127
|
if (fromPaths) {
|
|
39122
39128
|
return fromPaths.value;
|
|
39123
39129
|
}
|
|
@@ -56450,7 +56456,7 @@ ${lanes.join("\n")}
|
|
|
56450
56456
|
return isTypeRelatedTo(source, target, assignableRelation);
|
|
56451
56457
|
}
|
|
56452
56458
|
function isTypeDerivedFrom(source, target) {
|
|
56453
|
-
return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) : target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType);
|
|
56459
|
+
return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 2097152 /* Intersection */ ? some(source.types, (t) => isTypeDerivedFrom(t, target)) : source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : isEmptyAnonymousObjectType(target) ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) : target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) && !isEmptyAnonymousObjectType(source) : target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType);
|
|
56454
56460
|
}
|
|
56455
56461
|
function isTypeComparableTo(source, target) {
|
|
56456
56462
|
return isTypeRelatedTo(source, target, comparableRelation);
|
|
@@ -59377,7 +59383,8 @@ ${lanes.join("\n")}
|
|
|
59377
59383
|
return !!(type.flags & 109440 /* Unit */);
|
|
59378
59384
|
}
|
|
59379
59385
|
function isUnitLikeType(type) {
|
|
59380
|
-
|
|
59386
|
+
const t = getBaseConstraintOrType(type);
|
|
59387
|
+
return t.flags & 2097152 /* Intersection */ ? some(t.types, isUnitType) : isUnitType(t);
|
|
59381
59388
|
}
|
|
59382
59389
|
function extractUnitType(type) {
|
|
59383
59390
|
return type.flags & 2097152 /* Intersection */ ? find(type.types, isUnitType) || type : type;
|
|
@@ -106351,7 +106358,7 @@ ${lanes.join("\n")}
|
|
|
106351
106358
|
for (const path of arrayFrom(state.affectedFilesPendingEmit.keys()).sort(compareStringsCaseSensitive)) {
|
|
106352
106359
|
if (tryAddToSet(seenFiles, path)) {
|
|
106353
106360
|
const file = state.program.getSourceFileByPath(path);
|
|
106354
|
-
if (!sourceFileMayBeEmitted(file, state.program))
|
|
106361
|
+
if (!file || !sourceFileMayBeEmitted(file, state.program))
|
|
106355
106362
|
continue;
|
|
106356
106363
|
const fileId = toFileId(path), pendingEmit = state.affectedFilesPendingEmit.get(path);
|
|
106357
106364
|
(affectedFilesPendingEmit || (affectedFilesPendingEmit = [])).push(
|
|
@@ -108186,9 +108193,9 @@ ${lanes.join("\n")}
|
|
|
108186
108193
|
function createCompilerHostFromProgramHost(host, getCompilerOptions, directoryStructureHost = host) {
|
|
108187
108194
|
const useCaseSensitiveFileNames = host.useCaseSensitiveFileNames();
|
|
108188
108195
|
const hostGetNewLine = memoize(() => host.getNewLine());
|
|
108189
|
-
|
|
108196
|
+
const compilerHost = {
|
|
108190
108197
|
getSourceFile: createGetSourceFile(
|
|
108191
|
-
(fileName, encoding) => host.readFile(fileName, encoding),
|
|
108198
|
+
(fileName, encoding) => !encoding ? compilerHost.readFile(fileName) : host.readFile(fileName, encoding),
|
|
108192
108199
|
getCompilerOptions,
|
|
108193
108200
|
void 0
|
|
108194
108201
|
),
|
|
@@ -108215,6 +108222,7 @@ ${lanes.join("\n")}
|
|
|
108215
108222
|
disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
|
|
108216
108223
|
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
|
|
108217
108224
|
};
|
|
108225
|
+
return compilerHost;
|
|
108218
108226
|
}
|
|
108219
108227
|
function getSourceFileVersionAsHashFromText(host, text) {
|
|
108220
108228
|
if (text.match(sourceMapCommentRegExpDontCareLineStart)) {
|
|
@@ -108248,12 +108256,12 @@ ${lanes.join("\n")}
|
|
|
108248
108256
|
}
|
|
108249
108257
|
return (host.createHash || generateDjb2Hash)(text);
|
|
108250
108258
|
}
|
|
108251
|
-
function setGetSourceFileAsHashVersioned(compilerHost
|
|
108259
|
+
function setGetSourceFileAsHashVersioned(compilerHost) {
|
|
108252
108260
|
const originalGetSourceFile = compilerHost.getSourceFile;
|
|
108253
108261
|
compilerHost.getSourceFile = (...args) => {
|
|
108254
108262
|
const result = originalGetSourceFile.call(compilerHost, ...args);
|
|
108255
108263
|
if (result) {
|
|
108256
|
-
result.version = getSourceFileVersionAsHashFromText(
|
|
108264
|
+
result.version = getSourceFileVersionAsHashFromText(compilerHost, result.text);
|
|
108257
108265
|
}
|
|
108258
108266
|
return result;
|
|
108259
108267
|
};
|
|
@@ -108382,7 +108390,7 @@ ${lanes.join("\n")}
|
|
|
108382
108390
|
host.createHash = maybeBind(system, system.createHash);
|
|
108383
108391
|
host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
|
|
108384
108392
|
host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
|
|
108385
|
-
setGetSourceFileAsHashVersioned(host
|
|
108393
|
+
setGetSourceFileAsHashVersioned(host);
|
|
108386
108394
|
changeCompilerHostLikeToUseCache(host, (fileName) => toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName));
|
|
108387
108395
|
return host;
|
|
108388
108396
|
}
|
|
@@ -108469,7 +108477,7 @@ ${lanes.join("\n")}
|
|
|
108469
108477
|
configFileWatcher = watchFile2(configFileName, scheduleProgramReload, 2e3 /* High */, watchOptions, WatchType.ConfigFile);
|
|
108470
108478
|
}
|
|
108471
108479
|
const compilerHost = createCompilerHostFromProgramHost(host, () => compilerOptions, directoryStructureHost);
|
|
108472
|
-
setGetSourceFileAsHashVersioned(compilerHost
|
|
108480
|
+
setGetSourceFileAsHashVersioned(compilerHost);
|
|
108473
108481
|
const getNewSourceFile = compilerHost.getSourceFile;
|
|
108474
108482
|
compilerHost.getSourceFile = (fileName, ...args) => getVersionedSourceFileByPath(fileName, toPath3(fileName), ...args);
|
|
108475
108483
|
compilerHost.getSourceFileByPath = getVersionedSourceFileByPath;
|
|
@@ -108568,9 +108576,10 @@ ${lanes.join("\n")}
|
|
|
108568
108576
|
originalFileExists,
|
|
108569
108577
|
originalDirectoryExists,
|
|
108570
108578
|
originalCreateDirectory,
|
|
108571
|
-
originalWriteFile
|
|
108579
|
+
originalWriteFile,
|
|
108580
|
+
readFileWithCache
|
|
108572
108581
|
} = changeCompilerHostLikeToUseCache(compilerHost, toPath3);
|
|
108573
|
-
if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
108582
|
+
if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, (path) => getSourceVersion(path, readFileWithCache), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
108574
108583
|
if (hasChangedConfigFileParsingErrors) {
|
|
108575
108584
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
108576
108585
|
reportWatchDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
@@ -108689,9 +108698,14 @@ ${lanes.join("\n")}
|
|
|
108689
108698
|
}
|
|
108690
108699
|
}
|
|
108691
108700
|
}
|
|
108692
|
-
function getSourceVersion(path) {
|
|
108701
|
+
function getSourceVersion(path, readFileWithCache) {
|
|
108693
108702
|
const hostSourceFile = sourceFilesCache.get(path);
|
|
108694
|
-
|
|
108703
|
+
if (!hostSourceFile)
|
|
108704
|
+
return void 0;
|
|
108705
|
+
if (hostSourceFile.version)
|
|
108706
|
+
return hostSourceFile.version;
|
|
108707
|
+
const text = readFileWithCache(path);
|
|
108708
|
+
return text !== void 0 ? getSourceFileVersionAsHashFromText(compilerHost, text) : void 0;
|
|
108695
108709
|
}
|
|
108696
108710
|
function onReleaseOldSourceFile(oldSourceFile, _oldOptions, hasSourceFileByPath) {
|
|
108697
108711
|
const hostSourceFileInfo = sourceFilesCache.get(oldSourceFile.resolvedPath);
|
|
@@ -109150,7 +109164,7 @@ ${lanes.join("\n")}
|
|
|
109150
109164
|
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
109151
109165
|
const baseCompilerOptions = getCompilerOptionsOfBuildOptions(options);
|
|
109152
109166
|
const compilerHost = createCompilerHostFromProgramHost(host, () => state.projectCompilerOptions);
|
|
109153
|
-
setGetSourceFileAsHashVersioned(compilerHost
|
|
109167
|
+
setGetSourceFileAsHashVersioned(compilerHost);
|
|
109154
109168
|
compilerHost.getParsedCommandLine = (fileName) => parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName));
|
|
109155
109169
|
compilerHost.resolveModuleNames = maybeBind(host, host.resolveModuleNames);
|
|
109156
109170
|
compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
@@ -110227,7 +110241,7 @@ ${lanes.join("\n")}
|
|
|
110227
110241
|
buildInfoVersionMap = getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
|
|
110228
110242
|
version2 = buildInfoVersionMap.get(toPath2(state, inputFile));
|
|
110229
110243
|
const text = version2 ? state.readFileWithCache(inputFile) : void 0;
|
|
110230
|
-
currentVersion = text
|
|
110244
|
+
currentVersion = text !== void 0 ? getSourceFileVersionAsHashFromText(host, text) : void 0;
|
|
110231
110245
|
if (version2 && version2 === currentVersion)
|
|
110232
110246
|
pseudoInputUpToDate = true;
|
|
110233
110247
|
}
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -42,7 +42,7 @@ var ts = (() => {
|
|
|
42
42
|
"src/compiler/corePublic.ts"() {
|
|
43
43
|
"use strict";
|
|
44
44
|
versionMajorMinor = "5.0";
|
|
45
|
-
version = `${versionMajorMinor}.0-dev.
|
|
45
|
+
version = `${versionMajorMinor}.0-dev.20221201`;
|
|
46
46
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
47
47
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
48
48
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -36012,7 +36012,7 @@ ${lanes.join("\n")}
|
|
|
36012
36012
|
function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson = true) {
|
|
36013
36013
|
const packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : void 0;
|
|
36014
36014
|
const packageJsonContent = packageInfo && packageInfo.contents.packageJsonContent;
|
|
36015
|
-
const versionPaths = packageInfo && packageInfo
|
|
36015
|
+
const versionPaths = packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state);
|
|
36016
36016
|
return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
|
|
36017
36017
|
}
|
|
36018
36018
|
function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host, cache, resolveJs) {
|
|
@@ -36031,7 +36031,7 @@ ${lanes.join("\n")}
|
|
|
36031
36031
|
false,
|
|
36032
36032
|
requireState,
|
|
36033
36033
|
packageJsonInfo.contents.packageJsonContent,
|
|
36034
|
-
packageJsonInfo
|
|
36034
|
+
getVersionPathsOfPackageJsonInfo(packageJsonInfo, requireState)
|
|
36035
36035
|
);
|
|
36036
36036
|
entrypoints = append(entrypoints, requireResolution == null ? void 0 : requireResolution.path);
|
|
36037
36037
|
if (features & 8 /* Exports */ && packageJsonInfo.contents.packageJsonContent.exports) {
|
|
@@ -36124,6 +36124,12 @@ ${lanes.join("\n")}
|
|
|
36124
36124
|
}
|
|
36125
36125
|
return void 0;
|
|
36126
36126
|
}
|
|
36127
|
+
function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
|
|
36128
|
+
if (packageJsonInfo.contents.versionPaths === void 0) {
|
|
36129
|
+
packageJsonInfo.contents.versionPaths = readPackageJsonTypesVersionPaths(packageJsonInfo.contents.packageJsonContent, state) || false;
|
|
36130
|
+
}
|
|
36131
|
+
return packageJsonInfo.contents.versionPaths || void 0;
|
|
36132
|
+
}
|
|
36127
36133
|
function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
36128
36134
|
var _a2, _b, _c;
|
|
36129
36135
|
const { host, traceEnabled } = state;
|
|
@@ -36152,8 +36158,7 @@ ${lanes.join("\n")}
|
|
|
36152
36158
|
if (traceEnabled) {
|
|
36153
36159
|
trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
36154
36160
|
}
|
|
36155
|
-
const
|
|
36156
|
-
const result = { packageDirectory, contents: { packageJsonContent, versionPaths, resolvedEntrypoints: void 0 } };
|
|
36161
|
+
const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
|
|
36157
36162
|
(_b = state.packageJsonInfoCache) == null ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
|
|
36158
36163
|
state.affectingLocations.push(packageJsonPath);
|
|
36159
36164
|
return result;
|
|
@@ -36618,7 +36623,7 @@ ${lanes.join("\n")}
|
|
|
36618
36623
|
!nodeModulesDirectoryExists,
|
|
36619
36624
|
state,
|
|
36620
36625
|
packageInfo.contents.packageJsonContent,
|
|
36621
|
-
packageInfo
|
|
36626
|
+
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
|
36622
36627
|
);
|
|
36623
36628
|
return withPackageId(packageInfo, fromDirectory);
|
|
36624
36629
|
}
|
|
@@ -36630,7 +36635,7 @@ ${lanes.join("\n")}
|
|
|
36630
36635
|
onlyRecordFailures,
|
|
36631
36636
|
state2,
|
|
36632
36637
|
packageInfo && packageInfo.contents.packageJsonContent,
|
|
36633
|
-
packageInfo && packageInfo
|
|
36638
|
+
packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state2)
|
|
36634
36639
|
);
|
|
36635
36640
|
if (!pathAndExtension && packageInfo && (packageInfo.contents.packageJsonContent.exports === void 0 || packageInfo.contents.packageJsonContent.exports === null) && state2.features & 32 /* EsmMode */) {
|
|
36636
36641
|
pathAndExtension = loadModuleFromFile(extensions2, combinePaths(candidate2, "index.js"), onlyRecordFailures, state2);
|
|
@@ -36645,12 +36650,13 @@ ${lanes.join("\n")}
|
|
|
36645
36650
|
if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & 8 /* Exports */) {
|
|
36646
36651
|
return (_a2 = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)) == null ? void 0 : _a2.value;
|
|
36647
36652
|
}
|
|
36648
|
-
|
|
36653
|
+
const versionPaths = rest !== "" && packageInfo ? getVersionPathsOfPackageJsonInfo(packageInfo, state) : void 0;
|
|
36654
|
+
if (versionPaths) {
|
|
36649
36655
|
if (state.traceEnabled) {
|
|
36650
|
-
trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2,
|
|
36656
|
+
trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, version, rest);
|
|
36651
36657
|
}
|
|
36652
36658
|
const packageDirectoryExists = nodeModulesDirectoryExists && directoryProbablyExists(packageDirectory, state.host);
|
|
36653
|
-
const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory,
|
|
36659
|
+
const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, void 0, loader, !packageDirectoryExists, state);
|
|
36654
36660
|
if (fromPaths) {
|
|
36655
36661
|
return fromPaths.value;
|
|
36656
36662
|
}
|
|
@@ -53908,7 +53914,7 @@ ${lanes.join("\n")}
|
|
|
53908
53914
|
return isTypeRelatedTo(source, target, assignableRelation);
|
|
53909
53915
|
}
|
|
53910
53916
|
function isTypeDerivedFrom(source, target) {
|
|
53911
|
-
return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) : target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType);
|
|
53917
|
+
return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 2097152 /* Intersection */ ? some(source.types, (t) => isTypeDerivedFrom(t, target)) : source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : isEmptyAnonymousObjectType(target) ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) : target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) && !isEmptyAnonymousObjectType(source) : target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType);
|
|
53912
53918
|
}
|
|
53913
53919
|
function isTypeComparableTo(source, target) {
|
|
53914
53920
|
return isTypeRelatedTo(source, target, comparableRelation);
|
|
@@ -56835,7 +56841,8 @@ ${lanes.join("\n")}
|
|
|
56835
56841
|
return !!(type.flags & 109440 /* Unit */);
|
|
56836
56842
|
}
|
|
56837
56843
|
function isUnitLikeType(type) {
|
|
56838
|
-
|
|
56844
|
+
const t = getBaseConstraintOrType(type);
|
|
56845
|
+
return t.flags & 2097152 /* Intersection */ ? some(t.types, isUnitType) : isUnitType(t);
|
|
56839
56846
|
}
|
|
56840
56847
|
function extractUnitType(type) {
|
|
56841
56848
|
return type.flags & 2097152 /* Intersection */ ? find(type.types, isUnitType) || type : type;
|
|
@@ -104142,7 +104149,7 @@ ${lanes.join("\n")}
|
|
|
104142
104149
|
for (const path of arrayFrom(state.affectedFilesPendingEmit.keys()).sort(compareStringsCaseSensitive)) {
|
|
104143
104150
|
if (tryAddToSet(seenFiles, path)) {
|
|
104144
104151
|
const file = state.program.getSourceFileByPath(path);
|
|
104145
|
-
if (!sourceFileMayBeEmitted(file, state.program))
|
|
104152
|
+
if (!file || !sourceFileMayBeEmitted(file, state.program))
|
|
104146
104153
|
continue;
|
|
104147
104154
|
const fileId = toFileId(path), pendingEmit = state.affectedFilesPendingEmit.get(path);
|
|
104148
104155
|
(affectedFilesPendingEmit || (affectedFilesPendingEmit = [])).push(
|
|
@@ -105978,9 +105985,9 @@ ${lanes.join("\n")}
|
|
|
105978
105985
|
function createCompilerHostFromProgramHost(host, getCompilerOptions, directoryStructureHost = host) {
|
|
105979
105986
|
const useCaseSensitiveFileNames = host.useCaseSensitiveFileNames();
|
|
105980
105987
|
const hostGetNewLine = memoize(() => host.getNewLine());
|
|
105981
|
-
|
|
105988
|
+
const compilerHost = {
|
|
105982
105989
|
getSourceFile: createGetSourceFile(
|
|
105983
|
-
(fileName, encoding) => host.readFile(fileName, encoding),
|
|
105990
|
+
(fileName, encoding) => !encoding ? compilerHost.readFile(fileName) : host.readFile(fileName, encoding),
|
|
105984
105991
|
getCompilerOptions,
|
|
105985
105992
|
void 0
|
|
105986
105993
|
),
|
|
@@ -106007,6 +106014,7 @@ ${lanes.join("\n")}
|
|
|
106007
106014
|
disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
|
|
106008
106015
|
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
|
|
106009
106016
|
};
|
|
106017
|
+
return compilerHost;
|
|
106010
106018
|
}
|
|
106011
106019
|
function getSourceFileVersionAsHashFromText(host, text) {
|
|
106012
106020
|
if (text.match(sourceMapCommentRegExpDontCareLineStart)) {
|
|
@@ -106040,12 +106048,12 @@ ${lanes.join("\n")}
|
|
|
106040
106048
|
}
|
|
106041
106049
|
return (host.createHash || generateDjb2Hash)(text);
|
|
106042
106050
|
}
|
|
106043
|
-
function setGetSourceFileAsHashVersioned(compilerHost
|
|
106051
|
+
function setGetSourceFileAsHashVersioned(compilerHost) {
|
|
106044
106052
|
const originalGetSourceFile = compilerHost.getSourceFile;
|
|
106045
106053
|
compilerHost.getSourceFile = (...args) => {
|
|
106046
106054
|
const result = originalGetSourceFile.call(compilerHost, ...args);
|
|
106047
106055
|
if (result) {
|
|
106048
|
-
result.version = getSourceFileVersionAsHashFromText(
|
|
106056
|
+
result.version = getSourceFileVersionAsHashFromText(compilerHost, result.text);
|
|
106049
106057
|
}
|
|
106050
106058
|
return result;
|
|
106051
106059
|
};
|
|
@@ -106213,7 +106221,7 @@ ${lanes.join("\n")}
|
|
|
106213
106221
|
host.createHash = maybeBind(system, system.createHash);
|
|
106214
106222
|
host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
|
|
106215
106223
|
host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
|
|
106216
|
-
setGetSourceFileAsHashVersioned(host
|
|
106224
|
+
setGetSourceFileAsHashVersioned(host);
|
|
106217
106225
|
changeCompilerHostLikeToUseCache(host, (fileName) => toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName));
|
|
106218
106226
|
return host;
|
|
106219
106227
|
}
|
|
@@ -106300,7 +106308,7 @@ ${lanes.join("\n")}
|
|
|
106300
106308
|
configFileWatcher = watchFile2(configFileName, scheduleProgramReload, 2e3 /* High */, watchOptions, WatchType.ConfigFile);
|
|
106301
106309
|
}
|
|
106302
106310
|
const compilerHost = createCompilerHostFromProgramHost(host, () => compilerOptions, directoryStructureHost);
|
|
106303
|
-
setGetSourceFileAsHashVersioned(compilerHost
|
|
106311
|
+
setGetSourceFileAsHashVersioned(compilerHost);
|
|
106304
106312
|
const getNewSourceFile = compilerHost.getSourceFile;
|
|
106305
106313
|
compilerHost.getSourceFile = (fileName, ...args) => getVersionedSourceFileByPath(fileName, toPath3(fileName), ...args);
|
|
106306
106314
|
compilerHost.getSourceFileByPath = getVersionedSourceFileByPath;
|
|
@@ -106399,9 +106407,10 @@ ${lanes.join("\n")}
|
|
|
106399
106407
|
originalFileExists,
|
|
106400
106408
|
originalDirectoryExists,
|
|
106401
106409
|
originalCreateDirectory,
|
|
106402
|
-
originalWriteFile
|
|
106410
|
+
originalWriteFile,
|
|
106411
|
+
readFileWithCache
|
|
106403
106412
|
} = changeCompilerHostLikeToUseCache(compilerHost, toPath3);
|
|
106404
|
-
if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
106413
|
+
if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, (path) => getSourceVersion(path, readFileWithCache), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
106405
106414
|
if (hasChangedConfigFileParsingErrors) {
|
|
106406
106415
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
106407
106416
|
reportWatchDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
@@ -106520,9 +106529,14 @@ ${lanes.join("\n")}
|
|
|
106520
106529
|
}
|
|
106521
106530
|
}
|
|
106522
106531
|
}
|
|
106523
|
-
function getSourceVersion(path) {
|
|
106532
|
+
function getSourceVersion(path, readFileWithCache) {
|
|
106524
106533
|
const hostSourceFile = sourceFilesCache.get(path);
|
|
106525
|
-
|
|
106534
|
+
if (!hostSourceFile)
|
|
106535
|
+
return void 0;
|
|
106536
|
+
if (hostSourceFile.version)
|
|
106537
|
+
return hostSourceFile.version;
|
|
106538
|
+
const text = readFileWithCache(path);
|
|
106539
|
+
return text !== void 0 ? getSourceFileVersionAsHashFromText(compilerHost, text) : void 0;
|
|
106526
106540
|
}
|
|
106527
106541
|
function onReleaseOldSourceFile(oldSourceFile, _oldOptions, hasSourceFileByPath) {
|
|
106528
106542
|
const hostSourceFileInfo = sourceFilesCache.get(oldSourceFile.resolvedPath);
|
|
@@ -106993,7 +107007,7 @@ ${lanes.join("\n")}
|
|
|
106993
107007
|
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
106994
107008
|
const baseCompilerOptions = getCompilerOptionsOfBuildOptions(options);
|
|
106995
107009
|
const compilerHost = createCompilerHostFromProgramHost(host, () => state.projectCompilerOptions);
|
|
106996
|
-
setGetSourceFileAsHashVersioned(compilerHost
|
|
107010
|
+
setGetSourceFileAsHashVersioned(compilerHost);
|
|
106997
107011
|
compilerHost.getParsedCommandLine = (fileName) => parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName));
|
|
106998
107012
|
compilerHost.resolveModuleNames = maybeBind(host, host.resolveModuleNames);
|
|
106999
107013
|
compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
@@ -108064,7 +108078,7 @@ ${lanes.join("\n")}
|
|
|
108064
108078
|
buildInfoVersionMap = getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
|
|
108065
108079
|
version2 = buildInfoVersionMap.get(toPath2(state, inputFile));
|
|
108066
108080
|
const text = version2 ? state.readFileWithCache(inputFile) : void 0;
|
|
108067
|
-
currentVersion = text
|
|
108081
|
+
currentVersion = text !== void 0 ? getSourceFileVersionAsHashFromText(host, text) : void 0;
|
|
108068
108082
|
if (version2 && version2 === currentVersion)
|
|
108069
108083
|
pseudoInputUpToDate = true;
|
|
108070
108084
|
}
|
package/lib/typescript.js
CHANGED
|
@@ -42,7 +42,7 @@ var ts = (() => {
|
|
|
42
42
|
"src/compiler/corePublic.ts"() {
|
|
43
43
|
"use strict";
|
|
44
44
|
versionMajorMinor = "5.0";
|
|
45
|
-
version = `${versionMajorMinor}.0-dev.
|
|
45
|
+
version = `${versionMajorMinor}.0-dev.20221201`;
|
|
46
46
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
47
47
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
48
48
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -36012,7 +36012,7 @@ ${lanes.join("\n")}
|
|
|
36012
36012
|
function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson = true) {
|
|
36013
36013
|
const packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : void 0;
|
|
36014
36014
|
const packageJsonContent = packageInfo && packageInfo.contents.packageJsonContent;
|
|
36015
|
-
const versionPaths = packageInfo && packageInfo
|
|
36015
|
+
const versionPaths = packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state);
|
|
36016
36016
|
return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
|
|
36017
36017
|
}
|
|
36018
36018
|
function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host, cache, resolveJs) {
|
|
@@ -36031,7 +36031,7 @@ ${lanes.join("\n")}
|
|
|
36031
36031
|
false,
|
|
36032
36032
|
requireState,
|
|
36033
36033
|
packageJsonInfo.contents.packageJsonContent,
|
|
36034
|
-
packageJsonInfo
|
|
36034
|
+
getVersionPathsOfPackageJsonInfo(packageJsonInfo, requireState)
|
|
36035
36035
|
);
|
|
36036
36036
|
entrypoints = append(entrypoints, requireResolution == null ? void 0 : requireResolution.path);
|
|
36037
36037
|
if (features & 8 /* Exports */ && packageJsonInfo.contents.packageJsonContent.exports) {
|
|
@@ -36124,6 +36124,12 @@ ${lanes.join("\n")}
|
|
|
36124
36124
|
}
|
|
36125
36125
|
return void 0;
|
|
36126
36126
|
}
|
|
36127
|
+
function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
|
|
36128
|
+
if (packageJsonInfo.contents.versionPaths === void 0) {
|
|
36129
|
+
packageJsonInfo.contents.versionPaths = readPackageJsonTypesVersionPaths(packageJsonInfo.contents.packageJsonContent, state) || false;
|
|
36130
|
+
}
|
|
36131
|
+
return packageJsonInfo.contents.versionPaths || void 0;
|
|
36132
|
+
}
|
|
36127
36133
|
function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
36128
36134
|
var _a2, _b, _c;
|
|
36129
36135
|
const { host, traceEnabled } = state;
|
|
@@ -36152,8 +36158,7 @@ ${lanes.join("\n")}
|
|
|
36152
36158
|
if (traceEnabled) {
|
|
36153
36159
|
trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
36154
36160
|
}
|
|
36155
|
-
const
|
|
36156
|
-
const result = { packageDirectory, contents: { packageJsonContent, versionPaths, resolvedEntrypoints: void 0 } };
|
|
36161
|
+
const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
|
|
36157
36162
|
(_b = state.packageJsonInfoCache) == null ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
|
|
36158
36163
|
state.affectingLocations.push(packageJsonPath);
|
|
36159
36164
|
return result;
|
|
@@ -36618,7 +36623,7 @@ ${lanes.join("\n")}
|
|
|
36618
36623
|
!nodeModulesDirectoryExists,
|
|
36619
36624
|
state,
|
|
36620
36625
|
packageInfo.contents.packageJsonContent,
|
|
36621
|
-
packageInfo
|
|
36626
|
+
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
|
36622
36627
|
);
|
|
36623
36628
|
return withPackageId(packageInfo, fromDirectory);
|
|
36624
36629
|
}
|
|
@@ -36630,7 +36635,7 @@ ${lanes.join("\n")}
|
|
|
36630
36635
|
onlyRecordFailures,
|
|
36631
36636
|
state2,
|
|
36632
36637
|
packageInfo && packageInfo.contents.packageJsonContent,
|
|
36633
|
-
packageInfo && packageInfo
|
|
36638
|
+
packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state2)
|
|
36634
36639
|
);
|
|
36635
36640
|
if (!pathAndExtension && packageInfo && (packageInfo.contents.packageJsonContent.exports === void 0 || packageInfo.contents.packageJsonContent.exports === null) && state2.features & 32 /* EsmMode */) {
|
|
36636
36641
|
pathAndExtension = loadModuleFromFile(extensions2, combinePaths(candidate2, "index.js"), onlyRecordFailures, state2);
|
|
@@ -36645,12 +36650,13 @@ ${lanes.join("\n")}
|
|
|
36645
36650
|
if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & 8 /* Exports */) {
|
|
36646
36651
|
return (_a2 = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)) == null ? void 0 : _a2.value;
|
|
36647
36652
|
}
|
|
36648
|
-
|
|
36653
|
+
const versionPaths = rest !== "" && packageInfo ? getVersionPathsOfPackageJsonInfo(packageInfo, state) : void 0;
|
|
36654
|
+
if (versionPaths) {
|
|
36649
36655
|
if (state.traceEnabled) {
|
|
36650
|
-
trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2,
|
|
36656
|
+
trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, version, rest);
|
|
36651
36657
|
}
|
|
36652
36658
|
const packageDirectoryExists = nodeModulesDirectoryExists && directoryProbablyExists(packageDirectory, state.host);
|
|
36653
|
-
const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory,
|
|
36659
|
+
const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, void 0, loader, !packageDirectoryExists, state);
|
|
36654
36660
|
if (fromPaths) {
|
|
36655
36661
|
return fromPaths.value;
|
|
36656
36662
|
}
|
|
@@ -53908,7 +53914,7 @@ ${lanes.join("\n")}
|
|
|
53908
53914
|
return isTypeRelatedTo(source, target, assignableRelation);
|
|
53909
53915
|
}
|
|
53910
53916
|
function isTypeDerivedFrom(source, target) {
|
|
53911
|
-
return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) : target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType);
|
|
53917
|
+
return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 2097152 /* Intersection */ ? some(source.types, (t) => isTypeDerivedFrom(t, target)) : source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : isEmptyAnonymousObjectType(target) ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) : target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) && !isEmptyAnonymousObjectType(source) : target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType);
|
|
53912
53918
|
}
|
|
53913
53919
|
function isTypeComparableTo(source, target) {
|
|
53914
53920
|
return isTypeRelatedTo(source, target, comparableRelation);
|
|
@@ -56835,7 +56841,8 @@ ${lanes.join("\n")}
|
|
|
56835
56841
|
return !!(type.flags & 109440 /* Unit */);
|
|
56836
56842
|
}
|
|
56837
56843
|
function isUnitLikeType(type) {
|
|
56838
|
-
|
|
56844
|
+
const t = getBaseConstraintOrType(type);
|
|
56845
|
+
return t.flags & 2097152 /* Intersection */ ? some(t.types, isUnitType) : isUnitType(t);
|
|
56839
56846
|
}
|
|
56840
56847
|
function extractUnitType(type) {
|
|
56841
56848
|
return type.flags & 2097152 /* Intersection */ ? find(type.types, isUnitType) || type : type;
|
|
@@ -104142,7 +104149,7 @@ ${lanes.join("\n")}
|
|
|
104142
104149
|
for (const path of arrayFrom(state.affectedFilesPendingEmit.keys()).sort(compareStringsCaseSensitive)) {
|
|
104143
104150
|
if (tryAddToSet(seenFiles, path)) {
|
|
104144
104151
|
const file = state.program.getSourceFileByPath(path);
|
|
104145
|
-
if (!sourceFileMayBeEmitted(file, state.program))
|
|
104152
|
+
if (!file || !sourceFileMayBeEmitted(file, state.program))
|
|
104146
104153
|
continue;
|
|
104147
104154
|
const fileId = toFileId(path), pendingEmit = state.affectedFilesPendingEmit.get(path);
|
|
104148
104155
|
(affectedFilesPendingEmit || (affectedFilesPendingEmit = [])).push(
|
|
@@ -105978,9 +105985,9 @@ ${lanes.join("\n")}
|
|
|
105978
105985
|
function createCompilerHostFromProgramHost(host, getCompilerOptions, directoryStructureHost = host) {
|
|
105979
105986
|
const useCaseSensitiveFileNames = host.useCaseSensitiveFileNames();
|
|
105980
105987
|
const hostGetNewLine = memoize(() => host.getNewLine());
|
|
105981
|
-
|
|
105988
|
+
const compilerHost = {
|
|
105982
105989
|
getSourceFile: createGetSourceFile(
|
|
105983
|
-
(fileName, encoding) => host.readFile(fileName, encoding),
|
|
105990
|
+
(fileName, encoding) => !encoding ? compilerHost.readFile(fileName) : host.readFile(fileName, encoding),
|
|
105984
105991
|
getCompilerOptions,
|
|
105985
105992
|
void 0
|
|
105986
105993
|
),
|
|
@@ -106007,6 +106014,7 @@ ${lanes.join("\n")}
|
|
|
106007
106014
|
disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
|
|
106008
106015
|
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
|
|
106009
106016
|
};
|
|
106017
|
+
return compilerHost;
|
|
106010
106018
|
}
|
|
106011
106019
|
function getSourceFileVersionAsHashFromText(host, text) {
|
|
106012
106020
|
if (text.match(sourceMapCommentRegExpDontCareLineStart)) {
|
|
@@ -106040,12 +106048,12 @@ ${lanes.join("\n")}
|
|
|
106040
106048
|
}
|
|
106041
106049
|
return (host.createHash || generateDjb2Hash)(text);
|
|
106042
106050
|
}
|
|
106043
|
-
function setGetSourceFileAsHashVersioned(compilerHost
|
|
106051
|
+
function setGetSourceFileAsHashVersioned(compilerHost) {
|
|
106044
106052
|
const originalGetSourceFile = compilerHost.getSourceFile;
|
|
106045
106053
|
compilerHost.getSourceFile = (...args) => {
|
|
106046
106054
|
const result = originalGetSourceFile.call(compilerHost, ...args);
|
|
106047
106055
|
if (result) {
|
|
106048
|
-
result.version = getSourceFileVersionAsHashFromText(
|
|
106056
|
+
result.version = getSourceFileVersionAsHashFromText(compilerHost, result.text);
|
|
106049
106057
|
}
|
|
106050
106058
|
return result;
|
|
106051
106059
|
};
|
|
@@ -106213,7 +106221,7 @@ ${lanes.join("\n")}
|
|
|
106213
106221
|
host.createHash = maybeBind(system, system.createHash);
|
|
106214
106222
|
host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
|
|
106215
106223
|
host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
|
|
106216
|
-
setGetSourceFileAsHashVersioned(host
|
|
106224
|
+
setGetSourceFileAsHashVersioned(host);
|
|
106217
106225
|
changeCompilerHostLikeToUseCache(host, (fileName) => toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName));
|
|
106218
106226
|
return host;
|
|
106219
106227
|
}
|
|
@@ -106300,7 +106308,7 @@ ${lanes.join("\n")}
|
|
|
106300
106308
|
configFileWatcher = watchFile2(configFileName, scheduleProgramReload, 2e3 /* High */, watchOptions, WatchType.ConfigFile);
|
|
106301
106309
|
}
|
|
106302
106310
|
const compilerHost = createCompilerHostFromProgramHost(host, () => compilerOptions, directoryStructureHost);
|
|
106303
|
-
setGetSourceFileAsHashVersioned(compilerHost
|
|
106311
|
+
setGetSourceFileAsHashVersioned(compilerHost);
|
|
106304
106312
|
const getNewSourceFile = compilerHost.getSourceFile;
|
|
106305
106313
|
compilerHost.getSourceFile = (fileName, ...args) => getVersionedSourceFileByPath(fileName, toPath3(fileName), ...args);
|
|
106306
106314
|
compilerHost.getSourceFileByPath = getVersionedSourceFileByPath;
|
|
@@ -106399,9 +106407,10 @@ ${lanes.join("\n")}
|
|
|
106399
106407
|
originalFileExists,
|
|
106400
106408
|
originalDirectoryExists,
|
|
106401
106409
|
originalCreateDirectory,
|
|
106402
|
-
originalWriteFile
|
|
106410
|
+
originalWriteFile,
|
|
106411
|
+
readFileWithCache
|
|
106403
106412
|
} = changeCompilerHostLikeToUseCache(compilerHost, toPath3);
|
|
106404
|
-
if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
106413
|
+
if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, (path) => getSourceVersion(path, readFileWithCache), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
106405
106414
|
if (hasChangedConfigFileParsingErrors) {
|
|
106406
106415
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
106407
106416
|
reportWatchDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
@@ -106520,9 +106529,14 @@ ${lanes.join("\n")}
|
|
|
106520
106529
|
}
|
|
106521
106530
|
}
|
|
106522
106531
|
}
|
|
106523
|
-
function getSourceVersion(path) {
|
|
106532
|
+
function getSourceVersion(path, readFileWithCache) {
|
|
106524
106533
|
const hostSourceFile = sourceFilesCache.get(path);
|
|
106525
|
-
|
|
106534
|
+
if (!hostSourceFile)
|
|
106535
|
+
return void 0;
|
|
106536
|
+
if (hostSourceFile.version)
|
|
106537
|
+
return hostSourceFile.version;
|
|
106538
|
+
const text = readFileWithCache(path);
|
|
106539
|
+
return text !== void 0 ? getSourceFileVersionAsHashFromText(compilerHost, text) : void 0;
|
|
106526
106540
|
}
|
|
106527
106541
|
function onReleaseOldSourceFile(oldSourceFile, _oldOptions, hasSourceFileByPath) {
|
|
106528
106542
|
const hostSourceFileInfo = sourceFilesCache.get(oldSourceFile.resolvedPath);
|
|
@@ -106993,7 +107007,7 @@ ${lanes.join("\n")}
|
|
|
106993
107007
|
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
106994
107008
|
const baseCompilerOptions = getCompilerOptionsOfBuildOptions(options);
|
|
106995
107009
|
const compilerHost = createCompilerHostFromProgramHost(host, () => state.projectCompilerOptions);
|
|
106996
|
-
setGetSourceFileAsHashVersioned(compilerHost
|
|
107010
|
+
setGetSourceFileAsHashVersioned(compilerHost);
|
|
106997
107011
|
compilerHost.getParsedCommandLine = (fileName) => parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName));
|
|
106998
107012
|
compilerHost.resolveModuleNames = maybeBind(host, host.resolveModuleNames);
|
|
106999
107013
|
compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
@@ -108064,7 +108078,7 @@ ${lanes.join("\n")}
|
|
|
108064
108078
|
buildInfoVersionMap = getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
|
|
108065
108079
|
version2 = buildInfoVersionMap.get(toPath2(state, inputFile));
|
|
108066
108080
|
const text = version2 ? state.readFileWithCache(inputFile) : void 0;
|
|
108067
|
-
currentVersion = text
|
|
108081
|
+
currentVersion = text !== void 0 ? getSourceFileVersionAsHashFromText(host, text) : void 0;
|
|
108068
108082
|
if (version2 && version2 === currentVersion)
|
|
108069
108083
|
pseudoInputUpToDate = true;
|
|
108070
108084
|
}
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -50,7 +50,7 @@ var path = __toESM(require("path"));
|
|
|
50
50
|
|
|
51
51
|
// src/compiler/corePublic.ts
|
|
52
52
|
var versionMajorMinor = "5.0";
|
|
53
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
53
|
+
var version = `${versionMajorMinor}.0-dev.20221201`;
|
|
54
54
|
|
|
55
55
|
// src/compiler/core.ts
|
|
56
56
|
var emptyArray = [];
|
|
@@ -26366,7 +26366,7 @@ function tryFileLookup(fileName, onlyRecordFailures, state) {
|
|
|
26366
26366
|
function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson = true) {
|
|
26367
26367
|
const packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : void 0;
|
|
26368
26368
|
const packageJsonContent = packageInfo && packageInfo.contents.packageJsonContent;
|
|
26369
|
-
const versionPaths = packageInfo && packageInfo
|
|
26369
|
+
const versionPaths = packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state);
|
|
26370
26370
|
return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
|
|
26371
26371
|
}
|
|
26372
26372
|
function getPackageScopeForPath(fileName, state) {
|
|
@@ -26381,6 +26381,12 @@ function getPackageScopeForPath(fileName, state) {
|
|
|
26381
26381
|
}
|
|
26382
26382
|
return void 0;
|
|
26383
26383
|
}
|
|
26384
|
+
function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
|
|
26385
|
+
if (packageJsonInfo.contents.versionPaths === void 0) {
|
|
26386
|
+
packageJsonInfo.contents.versionPaths = readPackageJsonTypesVersionPaths(packageJsonInfo.contents.packageJsonContent, state) || false;
|
|
26387
|
+
}
|
|
26388
|
+
return packageJsonInfo.contents.versionPaths || void 0;
|
|
26389
|
+
}
|
|
26384
26390
|
function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
26385
26391
|
var _a2, _b, _c;
|
|
26386
26392
|
const { host, traceEnabled } = state;
|
|
@@ -26409,8 +26415,7 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
|
26409
26415
|
if (traceEnabled) {
|
|
26410
26416
|
trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
26411
26417
|
}
|
|
26412
|
-
const
|
|
26413
|
-
const result = { packageDirectory, contents: { packageJsonContent, versionPaths, resolvedEntrypoints: void 0 } };
|
|
26418
|
+
const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
|
|
26414
26419
|
(_b = state.packageJsonInfoCache) == null ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
|
|
26415
26420
|
state.affectingLocations.push(packageJsonPath);
|
|
26416
26421
|
return result;
|
|
@@ -26875,7 +26880,7 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
|
|
|
26875
26880
|
!nodeModulesDirectoryExists,
|
|
26876
26881
|
state,
|
|
26877
26882
|
packageInfo.contents.packageJsonContent,
|
|
26878
|
-
packageInfo
|
|
26883
|
+
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
|
26879
26884
|
);
|
|
26880
26885
|
return withPackageId(packageInfo, fromDirectory);
|
|
26881
26886
|
}
|
|
@@ -26887,7 +26892,7 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
|
|
|
26887
26892
|
onlyRecordFailures,
|
|
26888
26893
|
state2,
|
|
26889
26894
|
packageInfo && packageInfo.contents.packageJsonContent,
|
|
26890
|
-
packageInfo && packageInfo
|
|
26895
|
+
packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state2)
|
|
26891
26896
|
);
|
|
26892
26897
|
if (!pathAndExtension && packageInfo && (packageInfo.contents.packageJsonContent.exports === void 0 || packageInfo.contents.packageJsonContent.exports === null) && state2.features & 32 /* EsmMode */) {
|
|
26893
26898
|
pathAndExtension = loadModuleFromFile(extensions2, combinePaths(candidate2, "index.js"), onlyRecordFailures, state2);
|
|
@@ -26902,12 +26907,13 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
|
|
|
26902
26907
|
if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & 8 /* Exports */) {
|
|
26903
26908
|
return (_a2 = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)) == null ? void 0 : _a2.value;
|
|
26904
26909
|
}
|
|
26905
|
-
|
|
26910
|
+
const versionPaths = rest !== "" && packageInfo ? getVersionPathsOfPackageJsonInfo(packageInfo, state) : void 0;
|
|
26911
|
+
if (versionPaths) {
|
|
26906
26912
|
if (state.traceEnabled) {
|
|
26907
|
-
trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2,
|
|
26913
|
+
trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, version, rest);
|
|
26908
26914
|
}
|
|
26909
26915
|
const packageDirectoryExists = nodeModulesDirectoryExists && directoryProbablyExists(packageDirectory, state.host);
|
|
26910
|
-
const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory,
|
|
26916
|
+
const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, void 0, loader, !packageDirectoryExists, state);
|
|
26911
26917
|
if (fromPaths) {
|
|
26912
26918
|
return fromPaths.value;
|
|
26913
26919
|
}
|
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.0.0-dev.
|
|
5
|
+
"version": "5.0.0-dev.20221201",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|