typescript 5.0.0-dev.20221201 → 5.0.0-dev.20221202
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/lib.es2022.sharedmemory.d.ts +15 -1
- package/lib/tsc.js +139 -138
- package/lib/tsserver.js +465 -176
- package/lib/tsserverlibrary.js +465 -176
- package/lib/typescript.js +458 -176
- package/lib/typingsInstaller.js +1 -1
- package/package.json +1 -1
|
@@ -22,6 +22,20 @@ interface Atomics {
|
|
|
22
22
|
/**
|
|
23
23
|
* A non-blocking, asynchronous version of wait which is usable on the main thread.
|
|
24
24
|
* Waits asynchronously on a shared memory location and returns a Promise
|
|
25
|
+
* @param typedArray A shared Int32Array or BigInt64Array.
|
|
26
|
+
* @param index The position in the typedArray to wait on.
|
|
27
|
+
* @param value The expected value to test.
|
|
28
|
+
* @param [timeout] The expected value to test.
|
|
25
29
|
*/
|
|
26
|
-
waitAsync(typedArray:
|
|
30
|
+
waitAsync(typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false, value: "not-equal" | "timed-out" } | { async: true, value: Promise<"ok" | "timed-out"> };
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A non-blocking, asynchronous version of wait which is usable on the main thread.
|
|
34
|
+
* Waits asynchronously on a shared memory location and returns a Promise
|
|
35
|
+
* @param typedArray A shared Int32Array or BigInt64Array.
|
|
36
|
+
* @param index The position in the typedArray to wait on.
|
|
37
|
+
* @param value The expected value to test.
|
|
38
|
+
* @param [timeout] The expected value to test.
|
|
39
|
+
*/
|
|
40
|
+
waitAsync(typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false, value: "not-equal" | "timed-out" } | { async: true, value: Promise<"ok" | "timed-out"> };
|
|
27
41
|
}
|
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.20221202`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -15307,6 +15307,26 @@ function parsePseudoBigInt(stringValue) {
|
|
|
15307
15307
|
function pseudoBigIntToString({ negative, base10Value }) {
|
|
15308
15308
|
return (negative && base10Value !== "0" ? "-" : "") + base10Value;
|
|
15309
15309
|
}
|
|
15310
|
+
function parseValidBigInt(text) {
|
|
15311
|
+
const negative = text.startsWith("-");
|
|
15312
|
+
const base10Value = parsePseudoBigInt(`${negative ? text.slice(1) : text}n`);
|
|
15313
|
+
return { negative, base10Value };
|
|
15314
|
+
}
|
|
15315
|
+
function isValidBigIntString(s, roundTripOnly) {
|
|
15316
|
+
if (s === "")
|
|
15317
|
+
return false;
|
|
15318
|
+
const scanner = createScanner(99 /* ESNext */, false);
|
|
15319
|
+
let success = true;
|
|
15320
|
+
scanner.setOnError(() => success = false);
|
|
15321
|
+
scanner.setText(s + "n");
|
|
15322
|
+
let result = scanner.scan();
|
|
15323
|
+
const negative = result === 40 /* MinusToken */;
|
|
15324
|
+
if (negative) {
|
|
15325
|
+
result = scanner.scan();
|
|
15326
|
+
}
|
|
15327
|
+
const flags = scanner.getTokenFlags();
|
|
15328
|
+
return success && result === 9 /* BigIntLiteral */ && scanner.getTextPos() === s.length + 1 && !(flags & 512 /* ContainsSeparator */) && (!roundTripOnly || s === pseudoBigIntToString({ negative, base10Value: parsePseudoBigInt(scanner.getTokenValue()) }));
|
|
15329
|
+
}
|
|
15310
15330
|
function isValidTypeOnlyAliasUseSite(useSite) {
|
|
15311
15331
|
return !!(useSite.flags & 16777216 /* Ambient */) || isPartOfTypeQuery(useSite) || isIdentifierInNonEmittingHeritageClause(useSite) || isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite) || !(isExpressionNode(useSite) || isShorthandPropertyNameUseSite(useSite));
|
|
15312
15332
|
}
|
|
@@ -15626,6 +15646,13 @@ function isOptionalJSDocPropertyLikeTag(node) {
|
|
|
15626
15646
|
const { isBracketed, typeExpression } = node;
|
|
15627
15647
|
return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* JSDocOptionalType */;
|
|
15628
15648
|
}
|
|
15649
|
+
function canUsePropertyAccess(name, languageVersion) {
|
|
15650
|
+
if (name.length === 0) {
|
|
15651
|
+
return false;
|
|
15652
|
+
}
|
|
15653
|
+
const firstChar = name.charCodeAt(0);
|
|
15654
|
+
return firstChar === 35 /* hash */ ? name.length > 1 && isIdentifierStart(name.charCodeAt(1), languageVersion) : isIdentifierStart(firstChar, languageVersion);
|
|
15655
|
+
}
|
|
15629
15656
|
|
|
15630
15657
|
// src/compiler/factory/baseNodeFactory.ts
|
|
15631
15658
|
function createBaseNodeFactory() {
|
|
@@ -33004,41 +33031,86 @@ function getAutomaticTypeDirectiveNames(options, host) {
|
|
|
33004
33031
|
}
|
|
33005
33032
|
return result;
|
|
33006
33033
|
}
|
|
33007
|
-
function
|
|
33008
|
-
|
|
33034
|
+
function compilerOptionValueToString(value) {
|
|
33035
|
+
var _a2;
|
|
33036
|
+
if (value === null || typeof value !== "object") {
|
|
33037
|
+
return "" + value;
|
|
33038
|
+
}
|
|
33039
|
+
if (isArray(value)) {
|
|
33040
|
+
return `[${(_a2 = value.map((e) => compilerOptionValueToString(e))) == null ? void 0 : _a2.join(",")}]`;
|
|
33041
|
+
}
|
|
33042
|
+
let str = "{";
|
|
33043
|
+
for (const key in value) {
|
|
33044
|
+
if (hasProperty(value, key)) {
|
|
33045
|
+
str += `${key}: ${compilerOptionValueToString(value[key])}`;
|
|
33046
|
+
}
|
|
33047
|
+
}
|
|
33048
|
+
return str + "}";
|
|
33049
|
+
}
|
|
33050
|
+
function getKeyForCompilerOptions(options, affectingOptionDeclarations) {
|
|
33051
|
+
return affectingOptionDeclarations.map((option) => compilerOptionValueToString(getCompilerOptionValue(options, option))).join("|") + (options.pathsBasePath ? `|${options.pathsBasePath}` : void 0);
|
|
33052
|
+
}
|
|
33053
|
+
function createCacheWithRedirects(ownOptions) {
|
|
33009
33054
|
const redirectsMap = /* @__PURE__ */ new Map();
|
|
33055
|
+
const optionsToRedirectsKey = /* @__PURE__ */ new Map();
|
|
33056
|
+
const redirectsKeyToMap = /* @__PURE__ */ new Map();
|
|
33057
|
+
let ownMap = /* @__PURE__ */ new Map();
|
|
33058
|
+
if (ownOptions)
|
|
33059
|
+
redirectsMap.set(ownOptions, ownMap);
|
|
33010
33060
|
return {
|
|
33011
|
-
getOwnMap,
|
|
33012
|
-
redirectsMap,
|
|
33013
33061
|
getOrCreateMapOfCacheRedirects,
|
|
33014
|
-
|
|
33015
|
-
|
|
33016
|
-
setOwnMap
|
|
33062
|
+
update,
|
|
33063
|
+
clear: clear2
|
|
33017
33064
|
};
|
|
33018
|
-
function getOwnMap() {
|
|
33019
|
-
return ownMap;
|
|
33020
|
-
}
|
|
33021
|
-
function setOwnOptions(newOptions) {
|
|
33022
|
-
options = newOptions;
|
|
33023
|
-
}
|
|
33024
|
-
function setOwnMap(newOwnMap) {
|
|
33025
|
-
ownMap = newOwnMap;
|
|
33026
|
-
}
|
|
33027
33065
|
function getOrCreateMapOfCacheRedirects(redirectedReference) {
|
|
33028
|
-
|
|
33029
|
-
|
|
33066
|
+
return redirectedReference ? getOrCreateMap(redirectedReference.commandLine.options) : ownMap;
|
|
33067
|
+
}
|
|
33068
|
+
function update(newOptions) {
|
|
33069
|
+
if (ownOptions !== newOptions) {
|
|
33070
|
+
if (ownOptions)
|
|
33071
|
+
ownMap = getOrCreateMap(newOptions);
|
|
33072
|
+
else
|
|
33073
|
+
redirectsMap.set(newOptions, ownMap);
|
|
33074
|
+
ownOptions = newOptions;
|
|
33030
33075
|
}
|
|
33031
|
-
|
|
33032
|
-
|
|
33033
|
-
|
|
33034
|
-
|
|
33035
|
-
|
|
33076
|
+
}
|
|
33077
|
+
function getOrCreateMap(redirectOptions) {
|
|
33078
|
+
let result = redirectsMap.get(redirectOptions);
|
|
33079
|
+
if (result)
|
|
33080
|
+
return result;
|
|
33081
|
+
const key = getRedirectsCacheKey(redirectOptions);
|
|
33082
|
+
result = redirectsKeyToMap.get(key);
|
|
33083
|
+
if (!result) {
|
|
33084
|
+
if (ownOptions) {
|
|
33085
|
+
const ownKey = getRedirectsCacheKey(ownOptions);
|
|
33086
|
+
if (ownKey === key)
|
|
33087
|
+
result = ownMap;
|
|
33088
|
+
else if (!redirectsKeyToMap.has(ownKey))
|
|
33089
|
+
redirectsKeyToMap.set(ownKey, ownMap);
|
|
33090
|
+
}
|
|
33091
|
+
redirectsKeyToMap.set(key, result != null ? result : result = /* @__PURE__ */ new Map());
|
|
33036
33092
|
}
|
|
33037
|
-
|
|
33093
|
+
redirectsMap.set(redirectOptions, result);
|
|
33094
|
+
return result;
|
|
33038
33095
|
}
|
|
33039
33096
|
function clear2() {
|
|
33097
|
+
const ownKey = ownOptions && optionsToRedirectsKey.get(ownOptions);
|
|
33040
33098
|
ownMap.clear();
|
|
33041
33099
|
redirectsMap.clear();
|
|
33100
|
+
optionsToRedirectsKey.clear();
|
|
33101
|
+
redirectsKeyToMap.clear();
|
|
33102
|
+
if (ownOptions) {
|
|
33103
|
+
if (ownKey)
|
|
33104
|
+
optionsToRedirectsKey.set(ownOptions, ownKey);
|
|
33105
|
+
redirectsMap.set(ownOptions, ownMap);
|
|
33106
|
+
}
|
|
33107
|
+
}
|
|
33108
|
+
function getRedirectsCacheKey(options) {
|
|
33109
|
+
let result = optionsToRedirectsKey.get(options);
|
|
33110
|
+
if (!result) {
|
|
33111
|
+
optionsToRedirectsKey.set(options, result = getKeyForCompilerOptions(options, moduleResolutionOptionDeclarations));
|
|
33112
|
+
}
|
|
33113
|
+
return result;
|
|
33042
33114
|
}
|
|
33043
33115
|
}
|
|
33044
33116
|
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
|
|
@@ -33070,27 +33142,6 @@ function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create)
|
|
|
33070
33142
|
}
|
|
33071
33143
|
return result;
|
|
33072
33144
|
}
|
|
33073
|
-
function updateRedirectsMap(options, directoryToModuleNameMap, moduleNameToDirectoryMap) {
|
|
33074
|
-
if (!options.configFile)
|
|
33075
|
-
return;
|
|
33076
|
-
if (directoryToModuleNameMap.redirectsMap.size === 0) {
|
|
33077
|
-
Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.redirectsMap.size === 0);
|
|
33078
|
-
Debug.assert(directoryToModuleNameMap.getOwnMap().size === 0);
|
|
33079
|
-
Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.getOwnMap().size === 0);
|
|
33080
|
-
directoryToModuleNameMap.redirectsMap.set(options.configFile.path, directoryToModuleNameMap.getOwnMap());
|
|
33081
|
-
moduleNameToDirectoryMap == null ? void 0 : moduleNameToDirectoryMap.redirectsMap.set(options.configFile.path, moduleNameToDirectoryMap.getOwnMap());
|
|
33082
|
-
} else {
|
|
33083
|
-
Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.redirectsMap.size > 0);
|
|
33084
|
-
const ref = {
|
|
33085
|
-
sourceFile: options.configFile,
|
|
33086
|
-
commandLine: { options }
|
|
33087
|
-
};
|
|
33088
|
-
directoryToModuleNameMap.setOwnMap(directoryToModuleNameMap.getOrCreateMapOfCacheRedirects(ref));
|
|
33089
|
-
moduleNameToDirectoryMap == null ? void 0 : moduleNameToDirectoryMap.setOwnMap(moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(ref));
|
|
33090
|
-
}
|
|
33091
|
-
directoryToModuleNameMap.setOwnOptions(options);
|
|
33092
|
-
moduleNameToDirectoryMap == null ? void 0 : moduleNameToDirectoryMap.setOwnOptions(options);
|
|
33093
|
-
}
|
|
33094
33145
|
function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap) {
|
|
33095
33146
|
return {
|
|
33096
33147
|
getOrCreateCacheForDirectory,
|
|
@@ -33101,13 +33152,16 @@ function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileNam
|
|
|
33101
33152
|
directoryToModuleNameMap.clear();
|
|
33102
33153
|
}
|
|
33103
33154
|
function update(options) {
|
|
33104
|
-
|
|
33155
|
+
directoryToModuleNameMap.update(options);
|
|
33105
33156
|
}
|
|
33106
33157
|
function getOrCreateCacheForDirectory(directoryName, redirectedReference) {
|
|
33107
33158
|
const path = toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
33108
33159
|
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, () => createModeAwareCache());
|
|
33109
33160
|
}
|
|
33110
33161
|
}
|
|
33162
|
+
function createModeAwareCacheKey(specifier, mode) {
|
|
33163
|
+
return mode === void 0 ? specifier : `${mode}|${specifier}`;
|
|
33164
|
+
}
|
|
33111
33165
|
function createModeAwareCache() {
|
|
33112
33166
|
const underlying = /* @__PURE__ */ new Map();
|
|
33113
33167
|
const memoizedReverseKeys = /* @__PURE__ */ new Map();
|
|
@@ -33138,7 +33192,7 @@ function createModeAwareCache() {
|
|
|
33138
33192
|
};
|
|
33139
33193
|
return cache;
|
|
33140
33194
|
function getUnderlyingCacheKey(specifier, mode) {
|
|
33141
|
-
const result =
|
|
33195
|
+
const result = createModeAwareCacheKey(specifier, mode);
|
|
33142
33196
|
memoizedReverseKeys.set(result, [specifier, mode]);
|
|
33143
33197
|
return result;
|
|
33144
33198
|
}
|
|
@@ -33158,9 +33212,10 @@ function zipToModeAwareCache(file, keys, values) {
|
|
|
33158
33212
|
}
|
|
33159
33213
|
return map2;
|
|
33160
33214
|
}
|
|
33161
|
-
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options
|
|
33162
|
-
const
|
|
33163
|
-
|
|
33215
|
+
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options) {
|
|
33216
|
+
const directoryToModuleNameMap = createCacheWithRedirects(options);
|
|
33217
|
+
const perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap);
|
|
33218
|
+
const moduleNameToDirectoryMap = createCacheWithRedirects(options);
|
|
33164
33219
|
const packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName);
|
|
33165
33220
|
return {
|
|
33166
33221
|
...packageJsonInfoCache,
|
|
@@ -33180,11 +33235,12 @@ function createModuleResolutionCache(currentDirectory, getCanonicalFileName, opt
|
|
|
33180
33235
|
moduleNameToDirectoryMap.clear();
|
|
33181
33236
|
}
|
|
33182
33237
|
function update(options2) {
|
|
33183
|
-
|
|
33238
|
+
directoryToModuleNameMap.update(options2);
|
|
33239
|
+
moduleNameToDirectoryMap.update(options2);
|
|
33184
33240
|
}
|
|
33185
33241
|
function getOrCreateCacheForModuleName(nonRelativeModuleName, mode, redirectedReference) {
|
|
33186
33242
|
Debug.assert(!isExternalModuleNameRelative(nonRelativeModuleName));
|
|
33187
|
-
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference,
|
|
33243
|
+
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference, createModeAwareCacheKey(nonRelativeModuleName, mode), createPerModuleNameCache);
|
|
33188
33244
|
}
|
|
33189
33245
|
function createPerModuleNameCache() {
|
|
33190
33246
|
const directoryPathMap = /* @__PURE__ */ new Map();
|
|
@@ -33232,8 +33288,9 @@ function createModuleResolutionCache(currentDirectory, getCanonicalFileName, opt
|
|
|
33232
33288
|
}
|
|
33233
33289
|
}
|
|
33234
33290
|
}
|
|
33235
|
-
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache
|
|
33236
|
-
const
|
|
33291
|
+
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache) {
|
|
33292
|
+
const directoryToModuleNameMap = createCacheWithRedirects(options);
|
|
33293
|
+
const perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap);
|
|
33237
33294
|
packageJsonInfoCache || (packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName));
|
|
33238
33295
|
return {
|
|
33239
33296
|
...packageJsonInfoCache,
|
|
@@ -42870,7 +42927,7 @@ function createTypeChecker(host) {
|
|
|
42870
42927
|
}
|
|
42871
42928
|
const contextFile = getSourceFileOfNode(getOriginalNode(context.enclosingDeclaration));
|
|
42872
42929
|
const resolutionMode = overrideImportMode || (contextFile == null ? void 0 : contextFile.impliedNodeFormat);
|
|
42873
|
-
const cacheKey =
|
|
42930
|
+
const cacheKey = createModeAwareCacheKey(contextFile.path, resolutionMode);
|
|
42874
42931
|
const links = getSymbolLinks(symbol);
|
|
42875
42932
|
let specifier = links.specifierCache && links.specifierCache.get(cacheKey);
|
|
42876
42933
|
if (!specifier) {
|
|
@@ -42893,9 +42950,6 @@ function createTypeChecker(host) {
|
|
|
42893
42950
|
links.specifierCache.set(cacheKey, specifier);
|
|
42894
42951
|
}
|
|
42895
42952
|
return specifier;
|
|
42896
|
-
function getSpecifierCacheKey(path, mode) {
|
|
42897
|
-
return mode === void 0 ? path : `${mode}|${path}`;
|
|
42898
|
-
}
|
|
42899
42953
|
}
|
|
42900
42954
|
function symbolToEntityNameNode(symbol) {
|
|
42901
42955
|
const identifier = factory.createIdentifier(unescapeLeadingUnderscores(symbol.escapedName));
|
|
@@ -43109,8 +43163,7 @@ function createTypeChecker(host) {
|
|
|
43109
43163
|
if (isSingleOrDoubleQuote(firstChar) && some(symbol2.declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
|
|
43110
43164
|
return factory.createStringLiteral(getSpecifierForModuleSymbol(symbol2, context));
|
|
43111
43165
|
}
|
|
43112
|
-
|
|
43113
|
-
if (index === 0 || canUsePropertyAccess) {
|
|
43166
|
+
if (index === 0 || canUsePropertyAccess(symbolName2, languageVersion)) {
|
|
43114
43167
|
const identifier = setEmitFlags(factory.createIdentifier(symbolName2, typeParameterNodes), 33554432 /* NoAsciiEscaping */);
|
|
43115
43168
|
identifier.symbol = symbol2;
|
|
43116
43169
|
return index > 0 ? factory.createPropertyAccessExpression(createExpressionFromSymbolChain(chain2, index - 1), identifier) : identifier;
|
|
@@ -55182,24 +55235,7 @@ function createTypeChecker(host) {
|
|
|
55182
55235
|
return isFinite(n) && (!roundTripOnly || "" + n === s);
|
|
55183
55236
|
}
|
|
55184
55237
|
function parseBigIntLiteralType(text) {
|
|
55185
|
-
|
|
55186
|
-
const base10Value = parsePseudoBigInt(`${negative ? text.slice(1) : text}n`);
|
|
55187
|
-
return getBigIntLiteralType({ negative, base10Value });
|
|
55188
|
-
}
|
|
55189
|
-
function isValidBigIntString(s, roundTripOnly) {
|
|
55190
|
-
if (s === "")
|
|
55191
|
-
return false;
|
|
55192
|
-
const scanner = createScanner(99 /* ESNext */, false);
|
|
55193
|
-
let success = true;
|
|
55194
|
-
scanner.setOnError(() => success = false);
|
|
55195
|
-
scanner.setText(s + "n");
|
|
55196
|
-
let result = scanner.scan();
|
|
55197
|
-
const negative = result === 40 /* MinusToken */;
|
|
55198
|
-
if (negative) {
|
|
55199
|
-
result = scanner.scan();
|
|
55200
|
-
}
|
|
55201
|
-
const flags = scanner.getTokenFlags();
|
|
55202
|
-
return success && result === 9 /* BigIntLiteral */ && scanner.getTextPos() === s.length + 1 && !(flags & 512 /* ContainsSeparator */) && (!roundTripOnly || s === pseudoBigIntToString({ negative, base10Value: parsePseudoBigInt(scanner.getTokenValue()) }));
|
|
55238
|
+
return getBigIntLiteralType(parseValidBigInt(text));
|
|
55203
55239
|
}
|
|
55204
55240
|
function isMemberOfStringMapping(source, target) {
|
|
55205
55241
|
if (target.flags & (4 /* String */ | 1 /* Any */)) {
|
|
@@ -62671,11 +62707,11 @@ function createTypeChecker(host) {
|
|
|
62671
62707
|
}
|
|
62672
62708
|
function checkSatisfiesExpression(node) {
|
|
62673
62709
|
checkSourceElement(node.type);
|
|
62710
|
+
const exprType = checkExpression(node.expression);
|
|
62674
62711
|
const targetType = getTypeFromTypeNode(node.type);
|
|
62675
62712
|
if (isErrorType(targetType)) {
|
|
62676
62713
|
return targetType;
|
|
62677
62714
|
}
|
|
62678
|
-
const exprType = checkExpression(node.expression);
|
|
62679
62715
|
checkTypeAssignableToAndOptionallyElaborate(exprType, targetType, node.type, node.expression, Diagnostics.Type_0_does_not_satisfy_the_expected_type_1);
|
|
62680
62716
|
return exprType;
|
|
62681
62717
|
}
|
|
@@ -97322,16 +97358,15 @@ function loadWithTypeDirectiveCache(names, containingFile, redirectedReference,
|
|
|
97322
97358
|
return [];
|
|
97323
97359
|
}
|
|
97324
97360
|
const resolutions = [];
|
|
97325
|
-
const cache =
|
|
97361
|
+
const cache = createModeAwareCache();
|
|
97326
97362
|
for (const name of names) {
|
|
97327
97363
|
let result;
|
|
97328
97364
|
const mode = getModeForFileReference(name, containingFileMode);
|
|
97329
97365
|
const strName = getResolutionName(name);
|
|
97330
|
-
|
|
97331
|
-
|
|
97332
|
-
result = cache.get(cacheKey);
|
|
97366
|
+
if (cache.has(strName, mode)) {
|
|
97367
|
+
result = cache.get(strName, mode);
|
|
97333
97368
|
} else {
|
|
97334
|
-
cache.set(
|
|
97369
|
+
cache.set(strName, mode, result = loader(strName, containingFile, redirectedReference, mode));
|
|
97335
97370
|
}
|
|
97336
97371
|
resolutions.push(result);
|
|
97337
97372
|
}
|
|
@@ -97407,18 +97442,17 @@ function loadWithModeAwareCache(names, containingFile, containingFileName, redir
|
|
|
97407
97442
|
return [];
|
|
97408
97443
|
}
|
|
97409
97444
|
const resolutions = [];
|
|
97410
|
-
const cache =
|
|
97445
|
+
const cache = createModeAwareCache();
|
|
97411
97446
|
let i = 0;
|
|
97412
97447
|
for (const entry of resolutionInfo ? resolutionInfo.names : names) {
|
|
97413
97448
|
let result;
|
|
97414
97449
|
const mode = !isString(entry) ? getModeForUsageLocation(containingFile, entry) : getModeForResolutionAtIndex(containingFile, i);
|
|
97415
97450
|
i++;
|
|
97416
97451
|
const name = isString(entry) ? entry : entry.text;
|
|
97417
|
-
|
|
97418
|
-
|
|
97419
|
-
result = cache.get(cacheKey);
|
|
97452
|
+
if (cache.has(name, mode)) {
|
|
97453
|
+
result = cache.get(name, mode);
|
|
97420
97454
|
} else {
|
|
97421
|
-
cache.set(
|
|
97455
|
+
cache.set(name, mode, result = loader(name, mode, containingFileName, redirectedReference));
|
|
97422
97456
|
}
|
|
97423
97457
|
resolutions.push(result);
|
|
97424
97458
|
}
|
|
@@ -101912,23 +101946,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
101912
101946
|
const getCurrentDirectory = memoize(() => resolutionHost.getCurrentDirectory());
|
|
101913
101947
|
const cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
|
|
101914
101948
|
const resolvedModuleNames = /* @__PURE__ */ new Map();
|
|
101915
|
-
const perDirectoryResolvedModuleNames = createCacheWithRedirects();
|
|
101916
|
-
const nonRelativeModuleNameCache = createCacheWithRedirects();
|
|
101917
101949
|
const moduleResolutionCache = createModuleResolutionCache(
|
|
101918
101950
|
getCurrentDirectory(),
|
|
101919
101951
|
resolutionHost.getCanonicalFileName,
|
|
101920
|
-
|
|
101921
|
-
perDirectoryResolvedModuleNames,
|
|
101922
|
-
nonRelativeModuleNameCache
|
|
101952
|
+
resolutionHost.getCompilationSettings()
|
|
101923
101953
|
);
|
|
101924
101954
|
const resolvedTypeReferenceDirectives = /* @__PURE__ */ new Map();
|
|
101925
|
-
const perDirectoryResolvedTypeReferenceDirectives = createCacheWithRedirects();
|
|
101926
101955
|
const typeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache(
|
|
101927
101956
|
getCurrentDirectory(),
|
|
101928
101957
|
resolutionHost.getCanonicalFileName,
|
|
101929
|
-
|
|
101930
|
-
moduleResolutionCache.getPackageJsonInfoCache()
|
|
101931
|
-
perDirectoryResolvedTypeReferenceDirectives
|
|
101958
|
+
resolutionHost.getCompilationSettings(),
|
|
101959
|
+
moduleResolutionCache.getPackageJsonInfoCache()
|
|
101932
101960
|
);
|
|
101933
101961
|
const failedLookupDefaultExtensions = [".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */, ".json" /* Json */];
|
|
101934
101962
|
const customFailedLookupPaths = /* @__PURE__ */ new Map();
|
|
@@ -101989,6 +102017,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
101989
102017
|
affectingPathChecksForFile = void 0;
|
|
101990
102018
|
moduleResolutionCache.clear();
|
|
101991
102019
|
typeReferenceDirectiveResolutionCache.clear();
|
|
102020
|
+
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
102021
|
+
typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
101992
102022
|
impliedFormatPackageJsons.clear();
|
|
101993
102023
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
101994
102024
|
}
|
|
@@ -102093,8 +102123,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102093
102123
|
names,
|
|
102094
102124
|
containingFile,
|
|
102095
102125
|
redirectedReference,
|
|
102096
|
-
|
|
102097
|
-
perDirectoryCacheWithRedirects,
|
|
102126
|
+
perFileCache,
|
|
102098
102127
|
loader,
|
|
102099
102128
|
getResolutionWithResolvedFileName,
|
|
102100
102129
|
shouldRetryResolution,
|
|
@@ -102104,16 +102133,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102104
102133
|
containingSourceFile,
|
|
102105
102134
|
containingSourceFileMode
|
|
102106
102135
|
}) {
|
|
102107
|
-
var _a2, _b, _c
|
|
102136
|
+
var _a2, _b, _c;
|
|
102108
102137
|
const path = resolutionHost.toPath(containingFile);
|
|
102109
|
-
const resolutionsInFile =
|
|
102110
|
-
const dirPath = getDirectoryPath(path);
|
|
102111
|
-
const perDirectoryCache = perDirectoryCacheWithRedirects.getOrCreateMapOfCacheRedirects(redirectedReference);
|
|
102112
|
-
let perDirectoryResolution = perDirectoryCache.get(dirPath);
|
|
102113
|
-
if (!perDirectoryResolution) {
|
|
102114
|
-
perDirectoryResolution = createModeAwareCache();
|
|
102115
|
-
perDirectoryCache.set(dirPath, perDirectoryResolution);
|
|
102116
|
-
}
|
|
102138
|
+
const resolutionsInFile = perFileCache.get(path) || perFileCache.set(path, createModeAwareCache()).get(path);
|
|
102117
102139
|
const resolvedModules = [];
|
|
102118
102140
|
const compilerOptions = resolutionHost.getCompilationSettings();
|
|
102119
102141
|
const hasInvalidatedNonRelativeUnresolvedImport = logChanges && isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
@@ -102129,28 +102151,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102129
102151
|
let resolution = resolutionsInFile.get(name, mode);
|
|
102130
102152
|
if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) {
|
|
102131
102153
|
const existingResolution = resolution;
|
|
102132
|
-
|
|
102133
|
-
if (
|
|
102134
|
-
|
|
102135
|
-
const host = ((_a2 = resolutionHost.getCompilerHost) == null ? void 0 : _a2.call(resolutionHost)) || resolutionHost;
|
|
102136
|
-
if (isTraceEnabled(compilerOptions, host)) {
|
|
102137
|
-
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
102138
|
-
trace(
|
|
102139
|
-
host,
|
|
102140
|
-
loader === resolveModuleName2 ? (resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.packageId ? Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4 : Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 : Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_not_resolved : (resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.packageId ? Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4 : Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 : Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved,
|
|
102141
|
-
name,
|
|
102142
|
-
containingFile,
|
|
102143
|
-
getDirectoryPath(containingFile),
|
|
102144
|
-
resolved == null ? void 0 : resolved.resolvedFileName,
|
|
102145
|
-
(resolved == null ? void 0 : resolved.packageId) && packageIdToString(resolved.packageId)
|
|
102146
|
-
);
|
|
102147
|
-
}
|
|
102148
|
-
} else {
|
|
102149
|
-
resolution = loader(name, containingFile, compilerOptions, ((_b = resolutionHost.getCompilerHost) == null ? void 0 : _b.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile, mode);
|
|
102150
|
-
perDirectoryResolution.set(name, mode, resolution);
|
|
102151
|
-
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
102152
|
-
resolutionHost.onDiscoveredSymlink();
|
|
102153
|
-
}
|
|
102154
|
+
resolution = loader(name, containingFile, compilerOptions, ((_a2 = resolutionHost.getCompilerHost) == null ? void 0 : _a2.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile, mode);
|
|
102155
|
+
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
102156
|
+
resolutionHost.onDiscoveredSymlink();
|
|
102154
102157
|
}
|
|
102155
102158
|
resolutionsInFile.set(name, mode, resolution);
|
|
102156
102159
|
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
|
@@ -102162,7 +102165,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102162
102165
|
logChanges = false;
|
|
102163
102166
|
}
|
|
102164
102167
|
} else {
|
|
102165
|
-
const host = ((
|
|
102168
|
+
const host = ((_b = resolutionHost.getCompilerHost) == null ? void 0 : _b.call(resolutionHost)) || resolutionHost;
|
|
102166
102169
|
if (isTraceEnabled(compilerOptions, host) && !seenNamesInFile.has(name, mode)) {
|
|
102167
102170
|
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
102168
102171
|
trace(
|
|
@@ -102180,7 +102183,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102180
102183
|
resolvedModules.push(getResolutionWithResolvedFileName(resolution));
|
|
102181
102184
|
}
|
|
102182
102185
|
if (resolutionInfo && (loader === resolveTypeReferenceDirective2 || containingSourceFile)) {
|
|
102183
|
-
(
|
|
102186
|
+
(_c = resolutionInfo.reusedNames) == null ? void 0 : _c.forEach((entry) => seenNamesInFile.set(
|
|
102184
102187
|
getResolutionName(entry),
|
|
102185
102188
|
!isString(entry) && isStringLiteralLike(entry) ? getModeForUsageLocation(containingSourceFile, entry) : getModeForFileReference(entry, containingSourceFileMode),
|
|
102186
102189
|
true
|
|
@@ -102219,8 +102222,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102219
102222
|
names: typeDirectiveNames,
|
|
102220
102223
|
containingFile,
|
|
102221
102224
|
redirectedReference,
|
|
102222
|
-
|
|
102223
|
-
perDirectoryCacheWithRedirects: perDirectoryResolvedTypeReferenceDirectives,
|
|
102225
|
+
perFileCache: resolvedTypeReferenceDirectives,
|
|
102224
102226
|
loader: resolveTypeReferenceDirective2,
|
|
102225
102227
|
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective2,
|
|
102226
102228
|
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0,
|
|
@@ -102233,8 +102235,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102233
102235
|
names: moduleNames,
|
|
102234
102236
|
containingFile,
|
|
102235
102237
|
redirectedReference,
|
|
102236
|
-
|
|
102237
|
-
perDirectoryCacheWithRedirects: perDirectoryResolvedModuleNames,
|
|
102238
|
+
perFileCache: resolvedModuleNames,
|
|
102238
102239
|
loader: resolveModuleName2,
|
|
102239
102240
|
getResolutionWithResolvedFileName: getResolvedModule2,
|
|
102240
102241
|
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|