typescript 5.0.0-dev.20221206 → 5.0.0-dev.20221207
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 +174 -139
- package/lib/tsserver.js +153265 -150990
- package/lib/tsserverlibrary.d.ts +19 -6
- package/lib/tsserverlibrary.js +216 -172
- package/lib/typescript.d.ts +19 -6
- package/lib/typescript.js +216 -172
- package/lib/typingsInstaller.js +53 -70
- package/package.json +1 -1
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.20221207`;
|
|
46
46
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
47
47
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
48
48
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -2190,22 +2190,8 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
2190
2190
|
function enableDebugInfo() {
|
|
2191
2191
|
if (isDebugInfoEnabled)
|
|
2192
2192
|
return;
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
function getWeakTypeTextMap() {
|
|
2196
|
-
if (weakTypeTextMap === void 0) {
|
|
2197
|
-
if (typeof WeakMap === "function")
|
|
2198
|
-
weakTypeTextMap = /* @__PURE__ */ new WeakMap();
|
|
2199
|
-
}
|
|
2200
|
-
return weakTypeTextMap;
|
|
2201
|
-
}
|
|
2202
|
-
function getWeakNodeTextMap() {
|
|
2203
|
-
if (weakNodeTextMap === void 0) {
|
|
2204
|
-
if (typeof WeakMap === "function")
|
|
2205
|
-
weakNodeTextMap = /* @__PURE__ */ new WeakMap();
|
|
2206
|
-
}
|
|
2207
|
-
return weakNodeTextMap;
|
|
2208
|
-
}
|
|
2193
|
+
const weakTypeTextMap = /* @__PURE__ */ new WeakMap();
|
|
2194
|
+
const weakNodeTextMap = /* @__PURE__ */ new WeakMap();
|
|
2209
2195
|
Object.defineProperties(objectAllocator.getSymbolConstructor().prototype, {
|
|
2210
2196
|
__tsDebuggerDisplay: {
|
|
2211
2197
|
value() {
|
|
@@ -2234,11 +2220,10 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
2234
2220
|
} },
|
|
2235
2221
|
__debugTypeToString: {
|
|
2236
2222
|
value() {
|
|
2237
|
-
|
|
2238
|
-
let text = map2 == null ? void 0 : map2.get(this);
|
|
2223
|
+
let text = weakTypeTextMap.get(this);
|
|
2239
2224
|
if (text === void 0) {
|
|
2240
2225
|
text = this.checker.typeToString(this);
|
|
2241
|
-
|
|
2226
|
+
weakTypeTextMap.set(this, text);
|
|
2242
2227
|
}
|
|
2243
2228
|
return text;
|
|
2244
2229
|
}
|
|
@@ -2290,13 +2275,12 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
2290
2275
|
value(includeTrivia) {
|
|
2291
2276
|
if (nodeIsSynthesized(this))
|
|
2292
2277
|
return "";
|
|
2293
|
-
|
|
2294
|
-
let text = map2 == null ? void 0 : map2.get(this);
|
|
2278
|
+
let text = weakNodeTextMap.get(this);
|
|
2295
2279
|
if (text === void 0) {
|
|
2296
2280
|
const parseNode = getParseTreeNode(this);
|
|
2297
2281
|
const sourceFile = parseNode && getSourceFileOfNode(parseNode);
|
|
2298
2282
|
text = sourceFile ? getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : "";
|
|
2299
|
-
|
|
2283
|
+
weakNodeTextMap.set(this, text);
|
|
2300
2284
|
}
|
|
2301
2285
|
return text;
|
|
2302
2286
|
}
|
|
@@ -35139,8 +35123,10 @@ ${lanes.join("\n")}
|
|
|
35139
35123
|
options = redirectedReference.commandLine.options;
|
|
35140
35124
|
}
|
|
35141
35125
|
const containingDirectory = containingFile ? getDirectoryPath(containingFile) : void 0;
|
|
35142
|
-
|
|
35143
|
-
|
|
35126
|
+
let result = containingDirectory ? cache == null ? void 0 : cache.getFromDirectoryCache(typeReferenceDirectiveName, resolutionMode, containingDirectory, redirectedReference) : void 0;
|
|
35127
|
+
if (!result && containingDirectory && !isExternalModuleNameRelative(typeReferenceDirectiveName)) {
|
|
35128
|
+
result = cache == null ? void 0 : cache.getFromNonRelativeNameCache(typeReferenceDirectiveName, resolutionMode, containingDirectory, redirectedReference);
|
|
35129
|
+
}
|
|
35144
35130
|
if (result) {
|
|
35145
35131
|
if (traceEnabled) {
|
|
35146
35132
|
trace(host, Diagnostics.Resolving_type_reference_directive_0_containing_file_1, typeReferenceDirectiveName, containingFile);
|
|
@@ -35216,7 +35202,12 @@ ${lanes.join("\n")}
|
|
|
35216
35202
|
affectingLocations: initializeResolutionField(affectingLocations),
|
|
35217
35203
|
resolutionDiagnostics: initializeResolutionField(diagnostics)
|
|
35218
35204
|
};
|
|
35219
|
-
|
|
35205
|
+
if (containingDirectory) {
|
|
35206
|
+
cache == null ? void 0 : cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(typeReferenceDirectiveName, resolutionMode, result);
|
|
35207
|
+
if (!isExternalModuleNameRelative(typeReferenceDirectiveName)) {
|
|
35208
|
+
cache == null ? void 0 : cache.getOrCreateCacheForNonRelativeName(typeReferenceDirectiveName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
35209
|
+
}
|
|
35210
|
+
}
|
|
35220
35211
|
if (traceEnabled)
|
|
35221
35212
|
traceResult(result);
|
|
35222
35213
|
return result;
|
|
@@ -35346,23 +35337,27 @@ ${lanes.join("\n")}
|
|
|
35346
35337
|
if (ownOptions)
|
|
35347
35338
|
redirectsMap.set(ownOptions, ownMap);
|
|
35348
35339
|
return {
|
|
35340
|
+
getMapOfCacheRedirects,
|
|
35349
35341
|
getOrCreateMapOfCacheRedirects,
|
|
35350
35342
|
update,
|
|
35351
35343
|
clear: clear2
|
|
35352
35344
|
};
|
|
35345
|
+
function getMapOfCacheRedirects(redirectedReference) {
|
|
35346
|
+
return redirectedReference ? getOrCreateMap(redirectedReference.commandLine.options, false) : ownMap;
|
|
35347
|
+
}
|
|
35353
35348
|
function getOrCreateMapOfCacheRedirects(redirectedReference) {
|
|
35354
|
-
return redirectedReference ? getOrCreateMap(redirectedReference.commandLine.options) : ownMap;
|
|
35349
|
+
return redirectedReference ? getOrCreateMap(redirectedReference.commandLine.options, true) : ownMap;
|
|
35355
35350
|
}
|
|
35356
35351
|
function update(newOptions) {
|
|
35357
35352
|
if (ownOptions !== newOptions) {
|
|
35358
35353
|
if (ownOptions)
|
|
35359
|
-
ownMap = getOrCreateMap(newOptions);
|
|
35354
|
+
ownMap = getOrCreateMap(newOptions, true);
|
|
35360
35355
|
else
|
|
35361
35356
|
redirectsMap.set(newOptions, ownMap);
|
|
35362
35357
|
ownOptions = newOptions;
|
|
35363
35358
|
}
|
|
35364
35359
|
}
|
|
35365
|
-
function getOrCreateMap(redirectOptions) {
|
|
35360
|
+
function getOrCreateMap(redirectOptions, create) {
|
|
35366
35361
|
let result = redirectsMap.get(redirectOptions);
|
|
35367
35362
|
if (result)
|
|
35368
35363
|
return result;
|
|
@@ -35376,9 +35371,13 @@ ${lanes.join("\n")}
|
|
|
35376
35371
|
else if (!redirectsKeyToMap.has(ownKey))
|
|
35377
35372
|
redirectsKeyToMap.set(ownKey, ownMap);
|
|
35378
35373
|
}
|
|
35379
|
-
|
|
35374
|
+
if (create)
|
|
35375
|
+
result != null ? result : result = /* @__PURE__ */ new Map();
|
|
35376
|
+
if (result)
|
|
35377
|
+
redirectsKeyToMap.set(key, result);
|
|
35380
35378
|
}
|
|
35381
|
-
|
|
35379
|
+
if (result)
|
|
35380
|
+
redirectsMap.set(redirectOptions, result);
|
|
35382
35381
|
return result;
|
|
35383
35382
|
}
|
|
35384
35383
|
function clear2() {
|
|
@@ -35430,8 +35429,10 @@ ${lanes.join("\n")}
|
|
|
35430
35429
|
}
|
|
35431
35430
|
return result;
|
|
35432
35431
|
}
|
|
35433
|
-
function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName,
|
|
35432
|
+
function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, options) {
|
|
35433
|
+
const directoryToModuleNameMap = createCacheWithRedirects(options);
|
|
35434
35434
|
return {
|
|
35435
|
+
getFromDirectoryCache,
|
|
35435
35436
|
getOrCreateCacheForDirectory,
|
|
35436
35437
|
clear: clear2,
|
|
35437
35438
|
update
|
|
@@ -35439,13 +35440,18 @@ ${lanes.join("\n")}
|
|
|
35439
35440
|
function clear2() {
|
|
35440
35441
|
directoryToModuleNameMap.clear();
|
|
35441
35442
|
}
|
|
35442
|
-
function update(
|
|
35443
|
-
directoryToModuleNameMap.update(
|
|
35443
|
+
function update(options2) {
|
|
35444
|
+
directoryToModuleNameMap.update(options2);
|
|
35444
35445
|
}
|
|
35445
35446
|
function getOrCreateCacheForDirectory(directoryName, redirectedReference) {
|
|
35446
35447
|
const path = toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
35447
35448
|
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, () => createModeAwareCache());
|
|
35448
35449
|
}
|
|
35450
|
+
function getFromDirectoryCache(name, mode, directoryName, redirectedReference) {
|
|
35451
|
+
var _a2, _b;
|
|
35452
|
+
const path = toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
35453
|
+
return (_b = (_a2 = directoryToModuleNameMap.getMapOfCacheRedirects(redirectedReference)) == null ? void 0 : _a2.get(path)) == null ? void 0 : _b.get(name, mode);
|
|
35454
|
+
}
|
|
35449
35455
|
}
|
|
35450
35456
|
function createModeAwareCacheKey(specifier, mode) {
|
|
35451
35457
|
return mode === void 0 ? specifier : `${mode}|${specifier}`;
|
|
@@ -35494,33 +35500,32 @@ ${lanes.join("\n")}
|
|
|
35494
35500
|
}
|
|
35495
35501
|
return map2;
|
|
35496
35502
|
}
|
|
35497
|
-
function
|
|
35498
|
-
|
|
35499
|
-
|
|
35503
|
+
function getOriginalOrResolvedModuleFileName(result) {
|
|
35504
|
+
return result.resolvedModule && (result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
|
|
35505
|
+
}
|
|
35506
|
+
function getOriginalOrResolvedTypeReferenceFileName(result) {
|
|
35507
|
+
return result.resolvedTypeReferenceDirective && (result.resolvedTypeReferenceDirective.originalPath || result.resolvedTypeReferenceDirective.resolvedFileName);
|
|
35508
|
+
}
|
|
35509
|
+
function createNonRelativeNameResolutionCache(currentDirectory, getCanonicalFileName, options, getResolvedFileName) {
|
|
35500
35510
|
const moduleNameToDirectoryMap = createCacheWithRedirects(options);
|
|
35501
|
-
const packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName);
|
|
35502
35511
|
return {
|
|
35503
|
-
|
|
35504
|
-
|
|
35505
|
-
getOrCreateCacheForModuleName,
|
|
35512
|
+
getFromNonRelativeNameCache,
|
|
35513
|
+
getOrCreateCacheForNonRelativeName,
|
|
35506
35514
|
clear: clear2,
|
|
35507
|
-
update
|
|
35508
|
-
getPackageJsonInfoCache: () => packageJsonInfoCache,
|
|
35509
|
-
clearAllExceptPackageJsonInfoCache
|
|
35515
|
+
update
|
|
35510
35516
|
};
|
|
35511
35517
|
function clear2() {
|
|
35512
|
-
clearAllExceptPackageJsonInfoCache();
|
|
35513
|
-
packageJsonInfoCache.clear();
|
|
35514
|
-
}
|
|
35515
|
-
function clearAllExceptPackageJsonInfoCache() {
|
|
35516
|
-
perDirectoryResolutionCache.clear();
|
|
35517
35518
|
moduleNameToDirectoryMap.clear();
|
|
35518
35519
|
}
|
|
35519
35520
|
function update(options2) {
|
|
35520
|
-
directoryToModuleNameMap.update(options2);
|
|
35521
35521
|
moduleNameToDirectoryMap.update(options2);
|
|
35522
35522
|
}
|
|
35523
|
-
function
|
|
35523
|
+
function getFromNonRelativeNameCache(nonRelativeModuleName, mode, directoryName, redirectedReference) {
|
|
35524
|
+
var _a2, _b;
|
|
35525
|
+
Debug.assert(!isExternalModuleNameRelative(nonRelativeModuleName));
|
|
35526
|
+
return (_b = (_a2 = moduleNameToDirectoryMap.getMapOfCacheRedirects(redirectedReference)) == null ? void 0 : _a2.get(createModeAwareCacheKey(nonRelativeModuleName, mode))) == null ? void 0 : _b.get(directoryName);
|
|
35527
|
+
}
|
|
35528
|
+
function getOrCreateCacheForNonRelativeName(nonRelativeModuleName, mode, redirectedReference) {
|
|
35524
35529
|
Debug.assert(!isExternalModuleNameRelative(nonRelativeModuleName));
|
|
35525
35530
|
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference, createModeAwareCacheKey(nonRelativeModuleName, mode), createPerModuleNameCache);
|
|
35526
35531
|
}
|
|
@@ -35536,7 +35541,7 @@ ${lanes.join("\n")}
|
|
|
35536
35541
|
return;
|
|
35537
35542
|
}
|
|
35538
35543
|
directoryPathMap.set(path, result);
|
|
35539
|
-
const resolvedFileName =
|
|
35544
|
+
const resolvedFileName = getResolvedFileName(result);
|
|
35540
35545
|
const commonPrefix = resolvedFileName && getCommonPrefix(path, resolvedFileName);
|
|
35541
35546
|
let current = path;
|
|
35542
35547
|
while (current !== commonPrefix) {
|
|
@@ -35570,14 +35575,22 @@ ${lanes.join("\n")}
|
|
|
35570
35575
|
}
|
|
35571
35576
|
}
|
|
35572
35577
|
}
|
|
35573
|
-
function
|
|
35574
|
-
const
|
|
35575
|
-
const
|
|
35576
|
-
|
|
35578
|
+
function createModuleOrTypeReferenceResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, getResolvedFileName) {
|
|
35579
|
+
const perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, options);
|
|
35580
|
+
const nonRelativeNameResolutionCache = createNonRelativeNameResolutionCache(
|
|
35581
|
+
currentDirectory,
|
|
35582
|
+
getCanonicalFileName,
|
|
35583
|
+
options,
|
|
35584
|
+
getResolvedFileName
|
|
35585
|
+
);
|
|
35586
|
+
packageJsonInfoCache != null ? packageJsonInfoCache : packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName);
|
|
35577
35587
|
return {
|
|
35578
35588
|
...packageJsonInfoCache,
|
|
35579
35589
|
...perDirectoryResolutionCache,
|
|
35590
|
+
...nonRelativeNameResolutionCache,
|
|
35580
35591
|
clear: clear2,
|
|
35592
|
+
update,
|
|
35593
|
+
getPackageJsonInfoCache: () => packageJsonInfoCache,
|
|
35581
35594
|
clearAllExceptPackageJsonInfoCache
|
|
35582
35595
|
};
|
|
35583
35596
|
function clear2() {
|
|
@@ -35586,14 +35599,36 @@ ${lanes.join("\n")}
|
|
|
35586
35599
|
}
|
|
35587
35600
|
function clearAllExceptPackageJsonInfoCache() {
|
|
35588
35601
|
perDirectoryResolutionCache.clear();
|
|
35602
|
+
nonRelativeNameResolutionCache.clear();
|
|
35603
|
+
}
|
|
35604
|
+
function update(options2) {
|
|
35605
|
+
perDirectoryResolutionCache.update(options2);
|
|
35606
|
+
nonRelativeNameResolutionCache.update(options2);
|
|
35589
35607
|
}
|
|
35590
35608
|
}
|
|
35609
|
+
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options) {
|
|
35610
|
+
const result = createModuleOrTypeReferenceResolutionCache(
|
|
35611
|
+
currentDirectory,
|
|
35612
|
+
getCanonicalFileName,
|
|
35613
|
+
options,
|
|
35614
|
+
void 0,
|
|
35615
|
+
getOriginalOrResolvedModuleFileName
|
|
35616
|
+
);
|
|
35617
|
+
result.getOrCreateCacheForModuleName = (nonRelativeName, mode, redirectedReference) => result.getOrCreateCacheForNonRelativeName(nonRelativeName, mode, redirectedReference);
|
|
35618
|
+
return result;
|
|
35619
|
+
}
|
|
35620
|
+
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache) {
|
|
35621
|
+
return createModuleOrTypeReferenceResolutionCache(
|
|
35622
|
+
currentDirectory,
|
|
35623
|
+
getCanonicalFileName,
|
|
35624
|
+
options,
|
|
35625
|
+
packageJsonInfoCache,
|
|
35626
|
+
getOriginalOrResolvedTypeReferenceFileName
|
|
35627
|
+
);
|
|
35628
|
+
}
|
|
35591
35629
|
function resolveModuleNameFromCache(moduleName, containingFile, cache, mode) {
|
|
35592
35630
|
const containingDirectory = getDirectoryPath(containingFile);
|
|
35593
|
-
|
|
35594
|
-
if (!perFolderCache)
|
|
35595
|
-
return void 0;
|
|
35596
|
-
return perFolderCache.get(moduleName, mode);
|
|
35631
|
+
return cache.getFromDirectoryCache(moduleName, mode, containingDirectory, void 0);
|
|
35597
35632
|
}
|
|
35598
35633
|
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
35599
35634
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
@@ -35607,8 +35642,7 @@ ${lanes.join("\n")}
|
|
|
35607
35642
|
}
|
|
35608
35643
|
}
|
|
35609
35644
|
const containingDirectory = getDirectoryPath(containingFile);
|
|
35610
|
-
|
|
35611
|
-
let result = perFolderCache && perFolderCache.get(moduleName, resolutionMode);
|
|
35645
|
+
let result = cache == null ? void 0 : cache.getFromDirectoryCache(moduleName, resolutionMode, containingDirectory, redirectedReference);
|
|
35612
35646
|
if (result) {
|
|
35613
35647
|
if (traceEnabled) {
|
|
35614
35648
|
trace(host, Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -35658,11 +35692,9 @@ ${lanes.join("\n")}
|
|
|
35658
35692
|
if (result && result.resolvedModule)
|
|
35659
35693
|
perfLogger.logInfoEvent(`Module "${moduleName}" resolved to "${result.resolvedModule.resolvedFileName}"`);
|
|
35660
35694
|
perfLogger.logStopResolveModule(result && result.resolvedModule ? "" + result.resolvedModule.resolvedFileName : "null");
|
|
35661
|
-
|
|
35662
|
-
|
|
35663
|
-
|
|
35664
|
-
cache.getOrCreateCacheForModuleName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
35665
|
-
}
|
|
35695
|
+
cache == null ? void 0 : cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(moduleName, resolutionMode, result);
|
|
35696
|
+
if (!isExternalModuleNameRelative(moduleName)) {
|
|
35697
|
+
cache == null ? void 0 : cache.getOrCreateCacheForNonRelativeName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
35666
35698
|
}
|
|
35667
35699
|
}
|
|
35668
35700
|
if (traceEnabled) {
|
|
@@ -36641,7 +36673,7 @@ ${lanes.join("\n")}
|
|
|
36641
36673
|
return loadModuleFromNearestNodeModulesDirectoryWorker(4 /* Declaration */, moduleName, directory, state, true, void 0, void 0);
|
|
36642
36674
|
}
|
|
36643
36675
|
function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
|
|
36644
|
-
const
|
|
36676
|
+
const mode = state.features === 0 ? void 0 : state.features & 32 /* EsmMode */ ? 99 /* ESNext */ : 1 /* CommonJS */;
|
|
36645
36677
|
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
36646
36678
|
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
36647
36679
|
if (priorityExtensions) {
|
|
@@ -36655,7 +36687,7 @@ ${lanes.join("\n")}
|
|
|
36655
36687
|
function lookup(extensions2) {
|
|
36656
36688
|
return forEachAncestorDirectory(normalizeSlashes(directory), (ancestorDirectory) => {
|
|
36657
36689
|
if (getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
36658
|
-
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
36690
|
+
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(cache, moduleName, mode, ancestorDirectory, redirectedReference, state);
|
|
36659
36691
|
if (resolutionFromCache) {
|
|
36660
36692
|
return resolutionFromCache;
|
|
36661
36693
|
}
|
|
@@ -36800,8 +36832,8 @@ ${lanes.join("\n")}
|
|
|
36800
36832
|
function unmangleScopedPackageName(typesPackageName) {
|
|
36801
36833
|
return stringContains(typesPackageName, mangledScopedPackageSeparator) ? "@" + typesPackageName.replace(mangledScopedPackageSeparator, directorySeparator) : typesPackageName;
|
|
36802
36834
|
}
|
|
36803
|
-
function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, state) {
|
|
36804
|
-
const result = cache && cache.
|
|
36835
|
+
function tryFindNonRelativeModuleNameInCache(cache, moduleName, mode, containingDirectory, redirectedReference, state) {
|
|
36836
|
+
const result = cache && cache.getFromNonRelativeNameCache(moduleName, mode, containingDirectory, redirectedReference);
|
|
36805
36837
|
if (result) {
|
|
36806
36838
|
if (state.traceEnabled) {
|
|
36807
36839
|
trace(state.host, Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -36844,9 +36876,8 @@ ${lanes.join("\n")}
|
|
|
36844
36876
|
return { value: resolvedUsingSettings };
|
|
36845
36877
|
}
|
|
36846
36878
|
if (!isExternalModuleNameRelative(moduleName)) {
|
|
36847
|
-
const perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName, void 0, redirectedReference);
|
|
36848
36879
|
const resolved2 = forEachAncestorDirectory(containingDirectory, (directory) => {
|
|
36849
|
-
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
36880
|
+
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(cache, moduleName, void 0, directory, redirectedReference, state);
|
|
36850
36881
|
if (resolutionFromCache) {
|
|
36851
36882
|
return resolutionFromCache;
|
|
36852
36883
|
}
|
|
@@ -40258,7 +40289,7 @@ ${lanes.join("\n")}
|
|
|
40258
40289
|
if (!shortest) {
|
|
40259
40290
|
return void 0;
|
|
40260
40291
|
}
|
|
40261
|
-
return getEmitModuleResolutionKind(compilerOptions) ===
|
|
40292
|
+
return getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */ ? removeFileExtension(shortest) : removeExtensionAndIndexPostFix(shortest, ending, compilerOptions);
|
|
40262
40293
|
}
|
|
40263
40294
|
function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileName, sourceDirectory }, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
|
|
40264
40295
|
if (!host.fileExists || !host.readFile) {
|
|
@@ -70304,7 +70335,6 @@ ${lanes.join("\n")}
|
|
|
70304
70335
|
let firstDefaultClause;
|
|
70305
70336
|
let hasDuplicateDefaultClause = false;
|
|
70306
70337
|
const expressionType = checkExpression(node.expression);
|
|
70307
|
-
const expressionIsLiteral = isLiteralType(expressionType);
|
|
70308
70338
|
forEach(node.caseBlock.clauses, (clause) => {
|
|
70309
70339
|
if (clause.kind === 293 /* DefaultClause */ && !hasDuplicateDefaultClause) {
|
|
70310
70340
|
if (firstDefaultClause === void 0) {
|
|
@@ -70323,15 +70353,9 @@ ${lanes.join("\n")}
|
|
|
70323
70353
|
}
|
|
70324
70354
|
function createLazyCaseClauseDiagnostics(clause2) {
|
|
70325
70355
|
return () => {
|
|
70326
|
-
|
|
70327
|
-
|
|
70328
|
-
|
|
70329
|
-
if (!caseIsLiteral || !expressionIsLiteral) {
|
|
70330
|
-
caseType = caseIsLiteral ? getBaseTypeOfLiteralType(caseType) : caseType;
|
|
70331
|
-
comparedExpressionType = getBaseTypeOfLiteralType(expressionType);
|
|
70332
|
-
}
|
|
70333
|
-
if (!isTypeEqualityComparableTo(comparedExpressionType, caseType)) {
|
|
70334
|
-
checkTypeComparableTo(caseType, comparedExpressionType, clause2.expression, void 0);
|
|
70356
|
+
const caseType = checkExpression(clause2.expression);
|
|
70357
|
+
if (!isTypeEqualityComparableTo(expressionType, caseType)) {
|
|
70358
|
+
checkTypeComparableTo(caseType, expressionType, clause2.expression, void 0);
|
|
70335
70359
|
}
|
|
70336
70360
|
};
|
|
70337
70361
|
}
|
|
@@ -100809,7 +100833,7 @@ ${lanes.join("\n")}
|
|
|
100809
100833
|
const containingFileName = getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
100810
100834
|
const containingDir = getDirectoryPath(containingFileName);
|
|
100811
100835
|
const redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
100812
|
-
const fromCache = moduleResolutionCache.
|
|
100836
|
+
const fromCache = moduleResolutionCache.getFromNonRelativeNameCache(name, mode, containingDir, redirectedReference);
|
|
100813
100837
|
if (fromCache)
|
|
100814
100838
|
addResolutionDiagnostics(fromCache);
|
|
100815
100839
|
}
|
|
@@ -103554,6 +103578,26 @@ ${lanes.join("\n")}
|
|
|
103554
103578
|
(state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = /* @__PURE__ */ new Set())).add(path);
|
|
103555
103579
|
}
|
|
103556
103580
|
BuilderState2.updateSignatureOfFile = updateSignatureOfFile;
|
|
103581
|
+
function computeDtsSignature(programOfThisState, sourceFile, cancellationToken, host, onNewSignature) {
|
|
103582
|
+
programOfThisState.emit(
|
|
103583
|
+
sourceFile,
|
|
103584
|
+
(fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) => {
|
|
103585
|
+
Debug.assert(isDeclarationFileName(fileName), `File extension for signature expected to be dts: Got:: ${fileName}`);
|
|
103586
|
+
onNewSignature(computeSignatureWithDiagnostics(
|
|
103587
|
+
programOfThisState,
|
|
103588
|
+
sourceFile,
|
|
103589
|
+
text,
|
|
103590
|
+
host,
|
|
103591
|
+
data
|
|
103592
|
+
), sourceFiles);
|
|
103593
|
+
},
|
|
103594
|
+
cancellationToken,
|
|
103595
|
+
true,
|
|
103596
|
+
void 0,
|
|
103597
|
+
true
|
|
103598
|
+
);
|
|
103599
|
+
}
|
|
103600
|
+
BuilderState2.computeDtsSignature = computeDtsSignature;
|
|
103557
103601
|
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, host, useFileVersionAsSignature = state.useFileVersionAsSignature) {
|
|
103558
103602
|
var _a2;
|
|
103559
103603
|
if ((_a2 = state.hasCalledUpdateShapeSignature) == null ? void 0 : _a2.has(sourceFile.resolvedPath))
|
|
@@ -103562,26 +103606,12 @@ ${lanes.join("\n")}
|
|
|
103562
103606
|
const prevSignature = info.signature;
|
|
103563
103607
|
let latestSignature;
|
|
103564
103608
|
if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
|
|
103565
|
-
programOfThisState
|
|
103566
|
-
|
|
103567
|
-
(
|
|
103568
|
-
|
|
103569
|
-
|
|
103570
|
-
|
|
103571
|
-
sourceFile,
|
|
103572
|
-
text,
|
|
103573
|
-
host,
|
|
103574
|
-
data
|
|
103575
|
-
);
|
|
103576
|
-
if (latestSignature !== prevSignature) {
|
|
103577
|
-
updateExportedModules(state, sourceFile, sourceFiles[0].exportedModulesFromDeclarationEmit);
|
|
103578
|
-
}
|
|
103579
|
-
},
|
|
103580
|
-
cancellationToken,
|
|
103581
|
-
true,
|
|
103582
|
-
void 0,
|
|
103583
|
-
true
|
|
103584
|
-
);
|
|
103609
|
+
computeDtsSignature(programOfThisState, sourceFile, cancellationToken, host, (signature, sourceFiles) => {
|
|
103610
|
+
latestSignature = signature;
|
|
103611
|
+
if (latestSignature !== prevSignature) {
|
|
103612
|
+
updateExportedModules(state, sourceFile, sourceFiles[0].exportedModulesFromDeclarationEmit);
|
|
103613
|
+
}
|
|
103614
|
+
});
|
|
103585
103615
|
}
|
|
103586
103616
|
if (latestSignature === void 0) {
|
|
103587
103617
|
latestSignature = sourceFile.version;
|
|
@@ -103605,27 +103635,24 @@ ${lanes.join("\n")}
|
|
|
103605
103635
|
if (!state.exportedModulesMap)
|
|
103606
103636
|
return;
|
|
103607
103637
|
(state.oldExportedModulesMap || (state.oldExportedModulesMap = /* @__PURE__ */ new Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
|
|
103608
|
-
|
|
103609
|
-
state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
|
|
103610
|
-
return;
|
|
103611
|
-
}
|
|
103612
|
-
let exportedModules;
|
|
103613
|
-
exportedModulesFromDeclarationEmit.forEach((symbol) => addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)));
|
|
103638
|
+
const exportedModules = getExportedModules(exportedModulesFromDeclarationEmit);
|
|
103614
103639
|
if (exportedModules) {
|
|
103615
103640
|
state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
|
|
103616
103641
|
} else {
|
|
103617
103642
|
state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
|
|
103618
103643
|
}
|
|
103619
|
-
function addExportedModule(exportedModulePaths) {
|
|
103620
|
-
if (exportedModulePaths == null ? void 0 : exportedModulePaths.length) {
|
|
103621
|
-
if (!exportedModules) {
|
|
103622
|
-
exportedModules = /* @__PURE__ */ new Set();
|
|
103623
|
-
}
|
|
103624
|
-
exportedModulePaths.forEach((path) => exportedModules.add(path));
|
|
103625
|
-
}
|
|
103626
|
-
}
|
|
103627
103644
|
}
|
|
103628
103645
|
BuilderState2.updateExportedModules = updateExportedModules;
|
|
103646
|
+
function getExportedModules(exportedModulesFromDeclarationEmit) {
|
|
103647
|
+
let exportedModules;
|
|
103648
|
+
exportedModulesFromDeclarationEmit == null ? void 0 : exportedModulesFromDeclarationEmit.forEach(
|
|
103649
|
+
(symbol) => getReferencedFilesFromImportedModuleSymbol(symbol).forEach(
|
|
103650
|
+
(path) => (exportedModules != null ? exportedModules : exportedModules = /* @__PURE__ */ new Set()).add(path)
|
|
103651
|
+
)
|
|
103652
|
+
);
|
|
103653
|
+
return exportedModules;
|
|
103654
|
+
}
|
|
103655
|
+
BuilderState2.getExportedModules = getExportedModules;
|
|
103629
103656
|
function getAllDependencies(state, programOfThisState, sourceFile) {
|
|
103630
103657
|
const compilerOptions = programOfThisState.getCompilerOptions();
|
|
103631
103658
|
if (outFile(compilerOptions)) {
|
|
@@ -103769,9 +103796,9 @@ ${lanes.join("\n")}
|
|
|
103769
103796
|
function hasSameKeys(map1, map2) {
|
|
103770
103797
|
return map1 === map2 || map1 !== void 0 && map2 !== void 0 && map1.size === map2.size && !forEachKey(map1, (key) => !map2.has(key));
|
|
103771
103798
|
}
|
|
103772
|
-
function createBuilderProgramState(newProgram, oldState
|
|
103799
|
+
function createBuilderProgramState(newProgram, oldState) {
|
|
103773
103800
|
var _a2, _b;
|
|
103774
|
-
const state = BuilderState.create(newProgram, oldState,
|
|
103801
|
+
const state = BuilderState.create(newProgram, oldState, false);
|
|
103775
103802
|
state.program = newProgram;
|
|
103776
103803
|
const compilerOptions = newProgram.getCompilerOptions();
|
|
103777
103804
|
state.compilerOptions = compilerOptions;
|
|
@@ -104063,7 +104090,7 @@ ${lanes.join("\n")}
|
|
|
104063
104090
|
sourceFile,
|
|
104064
104091
|
cancellationToken,
|
|
104065
104092
|
host,
|
|
104066
|
-
|
|
104093
|
+
true
|
|
104067
104094
|
);
|
|
104068
104095
|
if (getEmitDeclarations(state.compilerOptions)) {
|
|
104069
104096
|
addToAffectedFilesPendingEmit(state, path, state.compilerOptions.declarationMap ? 24 /* AllDts */ : 8 /* Dts */);
|
|
@@ -104446,7 +104473,7 @@ ${lanes.join("\n")}
|
|
|
104446
104473
|
oldState = void 0;
|
|
104447
104474
|
return oldProgram;
|
|
104448
104475
|
}
|
|
104449
|
-
const state = createBuilderProgramState(newProgram, oldState
|
|
104476
|
+
const state = createBuilderProgramState(newProgram, oldState);
|
|
104450
104477
|
newProgram.getBuildInfo = (bundle) => getBuildInfo2(state, bundle);
|
|
104451
104478
|
newProgram = void 0;
|
|
104452
104479
|
oldProgram = void 0;
|
|
@@ -104943,9 +104970,9 @@ ${lanes.join("\n")}
|
|
|
104943
104970
|
let filesWithInvalidatedResolutions;
|
|
104944
104971
|
let filesWithInvalidatedNonRelativeUnresolvedImports;
|
|
104945
104972
|
const nonRelativeExternalModuleResolutions = createMultiMap();
|
|
104946
|
-
const resolutionsWithFailedLookups =
|
|
104947
|
-
const resolutionsWithOnlyAffectingLocations =
|
|
104948
|
-
const resolvedFileToResolution =
|
|
104973
|
+
const resolutionsWithFailedLookups = /* @__PURE__ */ new Set();
|
|
104974
|
+
const resolutionsWithOnlyAffectingLocations = /* @__PURE__ */ new Set();
|
|
104975
|
+
const resolvedFileToResolution = /* @__PURE__ */ new Map();
|
|
104949
104976
|
const impliedFormatPackageJsons = /* @__PURE__ */ new Map();
|
|
104950
104977
|
let hasChangedAutomaticTypeDirectiveNames = false;
|
|
104951
104978
|
let affectingPathChecksForFile;
|
|
@@ -105018,8 +105045,8 @@ ${lanes.join("\n")}
|
|
|
105018
105045
|
resolvedModuleNames.clear();
|
|
105019
105046
|
resolvedTypeReferenceDirectives.clear();
|
|
105020
105047
|
resolvedFileToResolution.clear();
|
|
105021
|
-
resolutionsWithFailedLookups.
|
|
105022
|
-
resolutionsWithOnlyAffectingLocations.
|
|
105048
|
+
resolutionsWithFailedLookups.clear();
|
|
105049
|
+
resolutionsWithOnlyAffectingLocations.clear();
|
|
105023
105050
|
failedLookupChecks = void 0;
|
|
105024
105051
|
startsWithPathChecks = void 0;
|
|
105025
105052
|
isInDirectoryChecks = void 0;
|
|
@@ -105336,12 +105363,13 @@ ${lanes.join("\n")}
|
|
|
105336
105363
|
return fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
|
|
105337
105364
|
}
|
|
105338
105365
|
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
|
|
105366
|
+
var _a2, _b;
|
|
105339
105367
|
if (resolution.refCount) {
|
|
105340
105368
|
resolution.refCount++;
|
|
105341
105369
|
Debug.assertIsDefined(resolution.files);
|
|
105342
105370
|
} else {
|
|
105343
105371
|
resolution.refCount = 1;
|
|
105344
|
-
Debug.assert(
|
|
105372
|
+
Debug.assert(!((_a2 = resolution.files) == null ? void 0 : _a2.size));
|
|
105345
105373
|
if (isExternalModuleNameRelative(name)) {
|
|
105346
105374
|
watchFailedLookupLocationOfResolution(resolution);
|
|
105347
105375
|
} else {
|
|
@@ -105349,10 +105377,14 @@ ${lanes.join("\n")}
|
|
|
105349
105377
|
}
|
|
105350
105378
|
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
105351
105379
|
if (resolved && resolved.resolvedFileName) {
|
|
105352
|
-
|
|
105380
|
+
const key = resolutionHost.toPath(resolved.resolvedFileName);
|
|
105381
|
+
let resolutions = resolvedFileToResolution.get(key);
|
|
105382
|
+
if (!resolutions)
|
|
105383
|
+
resolvedFileToResolution.set(key, resolutions = /* @__PURE__ */ new Set());
|
|
105384
|
+
resolutions.add(resolution);
|
|
105353
105385
|
}
|
|
105354
105386
|
}
|
|
105355
|
-
(resolution.files
|
|
105387
|
+
((_b = resolution.files) != null ? _b : resolution.files = /* @__PURE__ */ new Set()).add(filePath);
|
|
105356
105388
|
}
|
|
105357
105389
|
function watchFailedLookupLocationOfResolution(resolution) {
|
|
105358
105390
|
Debug.assert(!!resolution.refCount);
|
|
@@ -105360,7 +105392,7 @@ ${lanes.join("\n")}
|
|
|
105360
105392
|
if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length))
|
|
105361
105393
|
return;
|
|
105362
105394
|
if (failedLookupLocations == null ? void 0 : failedLookupLocations.length)
|
|
105363
|
-
resolutionsWithFailedLookups.
|
|
105395
|
+
resolutionsWithFailedLookups.add(resolution);
|
|
105364
105396
|
let setAtRoot = false;
|
|
105365
105397
|
if (failedLookupLocations) {
|
|
105366
105398
|
for (const failedLookupLocation of failedLookupLocations) {
|
|
@@ -105392,7 +105424,7 @@ ${lanes.join("\n")}
|
|
|
105392
105424
|
if (!(affectingLocations == null ? void 0 : affectingLocations.length))
|
|
105393
105425
|
return;
|
|
105394
105426
|
if (addToResolutionsWithOnlyAffectingLocations)
|
|
105395
|
-
resolutionsWithOnlyAffectingLocations.
|
|
105427
|
+
resolutionsWithOnlyAffectingLocations.add(resolution);
|
|
105396
105428
|
for (const affectingLocation of affectingLocations) {
|
|
105397
105429
|
createFileWatcherOfAffectingLocation(affectingLocation, true);
|
|
105398
105430
|
}
|
|
@@ -105471,17 +105503,20 @@ ${lanes.join("\n")}
|
|
|
105471
105503
|
}
|
|
105472
105504
|
}
|
|
105473
105505
|
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
|
|
105474
|
-
|
|
105506
|
+
Debug.checkDefined(resolution.files).delete(filePath);
|
|
105475
105507
|
resolution.refCount--;
|
|
105476
105508
|
if (resolution.refCount) {
|
|
105477
105509
|
return;
|
|
105478
105510
|
}
|
|
105479
105511
|
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
105480
105512
|
if (resolved && resolved.resolvedFileName) {
|
|
105481
|
-
|
|
105513
|
+
const key = resolutionHost.toPath(resolved.resolvedFileName);
|
|
105514
|
+
const resolutions = resolvedFileToResolution.get(key);
|
|
105515
|
+
if ((resolutions == null ? void 0 : resolutions.delete(resolution)) && !resolutions.size)
|
|
105516
|
+
resolvedFileToResolution.delete(key);
|
|
105482
105517
|
}
|
|
105483
105518
|
const { failedLookupLocations, affectingLocations } = resolution;
|
|
105484
|
-
if (
|
|
105519
|
+
if (resolutionsWithFailedLookups.delete(resolution)) {
|
|
105485
105520
|
let removeAtRoot = false;
|
|
105486
105521
|
for (const failedLookupLocation of failedLookupLocations) {
|
|
105487
105522
|
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
@@ -105508,7 +105543,7 @@ ${lanes.join("\n")}
|
|
|
105508
105543
|
removeDirectoryWatcher(rootPath);
|
|
105509
105544
|
}
|
|
105510
105545
|
} else if (affectingLocations == null ? void 0 : affectingLocations.length) {
|
|
105511
|
-
|
|
105546
|
+
resolutionsWithOnlyAffectingLocations.delete(resolution);
|
|
105512
105547
|
}
|
|
105513
105548
|
if (affectingLocations) {
|
|
105514
105549
|
for (const affectingLocation of affectingLocations) {
|
|
@@ -105556,15 +105591,15 @@ ${lanes.join("\n")}
|
|
|
105556
105591
|
if (!resolutions)
|
|
105557
105592
|
return false;
|
|
105558
105593
|
let invalidated = false;
|
|
105559
|
-
|
|
105594
|
+
resolutions.forEach((resolution) => {
|
|
105560
105595
|
if (resolution.isInvalidated || !canInvalidate(resolution))
|
|
105561
|
-
|
|
105596
|
+
return;
|
|
105562
105597
|
resolution.isInvalidated = invalidated = true;
|
|
105563
105598
|
for (const containingFilePath of Debug.checkDefined(resolution.files)) {
|
|
105564
105599
|
(filesWithInvalidatedResolutions != null ? filesWithInvalidatedResolutions : filesWithInvalidatedResolutions = /* @__PURE__ */ new Set()).add(containingFilePath);
|
|
105565
105600
|
hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames || endsWith(containingFilePath, inferredTypesContainingFile);
|
|
105566
105601
|
}
|
|
105567
|
-
}
|
|
105602
|
+
});
|
|
105568
105603
|
return invalidated;
|
|
105569
105604
|
}
|
|
105570
105605
|
function invalidateResolutionOfFile(filePath) {
|
|
@@ -106129,7 +106164,6 @@ ${lanes.join("\n")}
|
|
|
106129
106164
|
getEnvironmentVariable: maybeBind(host, host.getEnvironmentVariable) || (() => ""),
|
|
106130
106165
|
createHash: maybeBind(host, host.createHash),
|
|
106131
106166
|
readDirectory: maybeBind(host, host.readDirectory),
|
|
106132
|
-
disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
|
|
106133
106167
|
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
|
|
106134
106168
|
};
|
|
106135
106169
|
return compilerHost;
|
|
@@ -106196,7 +106230,6 @@ ${lanes.join("\n")}
|
|
|
106196
106230
|
writeFile: (path, data, writeByteOrderMark) => system.writeFile(path, data, writeByteOrderMark),
|
|
106197
106231
|
createHash: maybeBind(system, system.createHash),
|
|
106198
106232
|
createProgram: createProgram2 || createEmitAndSemanticDiagnosticsBuilderProgram,
|
|
106199
|
-
disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
|
|
106200
106233
|
storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
|
|
106201
106234
|
now: maybeBind(system, system.now)
|
|
106202
106235
|
};
|
|
@@ -106337,7 +106370,6 @@ ${lanes.join("\n")}
|
|
|
106337
106370
|
function createIncrementalCompilerHost(options, system = sys) {
|
|
106338
106371
|
const host = createCompilerHostWorker(options, void 0, system);
|
|
106339
106372
|
host.createHash = maybeBind(system, system.createHash);
|
|
106340
|
-
host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
|
|
106341
106373
|
host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
|
|
106342
106374
|
setGetSourceFileAsHashVersioned(host);
|
|
106343
106375
|
changeCompilerHostLikeToUseCache(host, (fileName) => toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName));
|
|
@@ -129648,6 +129680,7 @@ ${lanes.join("\n")}
|
|
|
129648
129680
|
isTypeOnlyLocation,
|
|
129649
129681
|
isJsxIdentifierExpected,
|
|
129650
129682
|
isRightOfOpenTag,
|
|
129683
|
+
isRightOfDotOrQuestionDot,
|
|
129651
129684
|
importStatementCompletion,
|
|
129652
129685
|
insideJsDocTagTypeExpression,
|
|
129653
129686
|
symbolToSortTextMap,
|
|
@@ -129713,7 +129746,7 @@ ${lanes.join("\n")}
|
|
|
129713
129746
|
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, getEmitScriptTarget(compilerOptions), entries);
|
|
129714
129747
|
}
|
|
129715
129748
|
let caseBlock;
|
|
129716
|
-
if (preferences.includeCompletionsWithInsertText && contextToken && (caseBlock = findAncestor(contextToken, isCaseBlock))) {
|
|
129749
|
+
if (preferences.includeCompletionsWithInsertText && contextToken && !isRightOfOpenTag && !isRightOfDotOrQuestionDot && (caseBlock = findAncestor(contextToken, isCaseBlock))) {
|
|
129717
129750
|
const cases = getExhaustiveCaseSnippets(caseBlock, sourceFile, preferences, compilerOptions, host, program, formatContext);
|
|
129718
129751
|
if (cases) {
|
|
129719
129752
|
entries.push(cases.entry);
|
|
@@ -131084,6 +131117,7 @@ ${lanes.join("\n")}
|
|
|
131084
131117
|
isTypeOnlyLocation,
|
|
131085
131118
|
isJsxIdentifierExpected,
|
|
131086
131119
|
isRightOfOpenTag,
|
|
131120
|
+
isRightOfDotOrQuestionDot: isRightOfDot || isRightOfQuestionDot,
|
|
131087
131121
|
importStatementCompletion,
|
|
131088
131122
|
hasUnresolvedAutoImports,
|
|
131089
131123
|
flags
|
|
@@ -138178,10 +138212,17 @@ ${lanes.join("\n")}
|
|
|
138178
138212
|
const usage = getUsageInfo(oldFile, toMove.all, checker);
|
|
138179
138213
|
const currentDirectory = getDirectoryPath(oldFile.fileName);
|
|
138180
138214
|
const extension = extensionFromPath(oldFile.fileName);
|
|
138181
|
-
const
|
|
138182
|
-
|
|
138183
|
-
|
|
138184
|
-
|
|
138215
|
+
const newFilename = combinePaths(
|
|
138216
|
+
currentDirectory,
|
|
138217
|
+
makeUniqueFilename(
|
|
138218
|
+
inferNewFilename(usage.oldFileImportsFromNewFile, usage.movedSymbols),
|
|
138219
|
+
extension,
|
|
138220
|
+
currentDirectory,
|
|
138221
|
+
host
|
|
138222
|
+
)
|
|
138223
|
+
) + extension;
|
|
138224
|
+
changes.createNewFile(oldFile, newFilename, getNewStatementsAndRemoveFromOldFile(oldFile, usage, changes, toMove, program, host, newFilename, preferences));
|
|
138225
|
+
addNewFileToTsconfig(program, changes, oldFile.fileName, newFilename, hostGetCanonicalFileName(host));
|
|
138185
138226
|
}
|
|
138186
138227
|
function getStatementsToMove(context) {
|
|
138187
138228
|
const rangeToMove = getRangeToMove(context);
|
|
@@ -138224,7 +138265,7 @@ ${lanes.join("\n")}
|
|
|
138224
138265
|
changes.insertNodeInListAfter(cfg, last(filesProp.initializer.elements), factory.createStringLiteral(newFilePath), filesProp.initializer.elements);
|
|
138225
138266
|
}
|
|
138226
138267
|
}
|
|
138227
|
-
function getNewStatementsAndRemoveFromOldFile(oldFile, usage, changes, toMove, program,
|
|
138268
|
+
function getNewStatementsAndRemoveFromOldFile(oldFile, usage, changes, toMove, program, host, newFilename, preferences) {
|
|
138228
138269
|
const checker = program.getTypeChecker();
|
|
138229
138270
|
const prologueDirectives = takeWhile(oldFile.statements, isPrologueDirective);
|
|
138230
138271
|
if (oldFile.externalModuleIndicator === void 0 && oldFile.commonJsModuleIndicator === void 0 && usage.oldImportsNeededByNewFile.size() === 0) {
|
|
@@ -138233,14 +138274,14 @@ ${lanes.join("\n")}
|
|
|
138233
138274
|
}
|
|
138234
138275
|
const useEsModuleSyntax = !!oldFile.externalModuleIndicator;
|
|
138235
138276
|
const quotePreference = getQuotePreference(oldFile, preferences);
|
|
138236
|
-
const importsFromNewFile = createOldFileImportsFromNewFile(usage.oldFileImportsFromNewFile,
|
|
138277
|
+
const importsFromNewFile = createOldFileImportsFromNewFile(oldFile, usage.oldFileImportsFromNewFile, newFilename, program, host, useEsModuleSyntax, quotePreference);
|
|
138237
138278
|
if (importsFromNewFile) {
|
|
138238
138279
|
insertImports(changes, oldFile, importsFromNewFile, true);
|
|
138239
138280
|
}
|
|
138240
138281
|
deleteUnusedOldImports(oldFile, toMove.all, changes, usage.unusedImportsFromOldFile, checker);
|
|
138241
138282
|
deleteMovedStatements(oldFile, toMove.ranges, changes);
|
|
138242
|
-
updateImportsInOtherFiles(changes, program, oldFile, usage.movedSymbols,
|
|
138243
|
-
const imports = getNewFileImportsAndAddExportInOldFile(oldFile, usage.oldImportsNeededByNewFile, usage.newFileImportsFromOldFile, changes, checker, useEsModuleSyntax, quotePreference);
|
|
138283
|
+
updateImportsInOtherFiles(changes, program, host, oldFile, usage.movedSymbols, newFilename);
|
|
138284
|
+
const imports = getNewFileImportsAndAddExportInOldFile(oldFile, usage.oldImportsNeededByNewFile, usage.newFileImportsFromOldFile, changes, checker, program, host, useEsModuleSyntax, quotePreference);
|
|
138244
138285
|
const body = addExports(oldFile, toMove.all, usage.oldFileImportsFromNewFile, useEsModuleSyntax);
|
|
138245
138286
|
if (imports.length && body.length) {
|
|
138246
138287
|
return [
|
|
@@ -138268,7 +138309,7 @@ ${lanes.join("\n")}
|
|
|
138268
138309
|
forEachImportInStatement(statement, (i) => deleteUnusedImports(oldFile, i, changes, (name) => toDelete.has(checker.getSymbolAtLocation(name))));
|
|
138269
138310
|
}
|
|
138270
138311
|
}
|
|
138271
|
-
function updateImportsInOtherFiles(changes, program, oldFile, movedSymbols,
|
|
138312
|
+
function updateImportsInOtherFiles(changes, program, host, oldFile, movedSymbols, newFilename) {
|
|
138272
138313
|
const checker = program.getTypeChecker();
|
|
138273
138314
|
for (const sourceFile of program.getSourceFiles()) {
|
|
138274
138315
|
if (sourceFile === oldFile)
|
|
@@ -138282,13 +138323,14 @@ ${lanes.join("\n")}
|
|
|
138282
138323
|
return !!symbol && movedSymbols.has(symbol);
|
|
138283
138324
|
};
|
|
138284
138325
|
deleteUnusedImports(sourceFile, importNode, changes, shouldMove);
|
|
138285
|
-
const
|
|
138326
|
+
const pathToNewFileWithExtension = resolvePath(getDirectoryPath(oldFile.path), newFilename);
|
|
138327
|
+
const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.path, pathToNewFileWithExtension, createModuleSpecifierResolutionHost(program, host));
|
|
138286
138328
|
const newImportDeclaration = filterImport(importNode, factory.createStringLiteral(newModuleSpecifier), shouldMove);
|
|
138287
138329
|
if (newImportDeclaration)
|
|
138288
138330
|
changes.insertNodeAfter(sourceFile, statement, newImportDeclaration);
|
|
138289
138331
|
const ns = getNamespaceLikeImport(importNode);
|
|
138290
138332
|
if (ns)
|
|
138291
|
-
updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols,
|
|
138333
|
+
updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleSpecifier, ns, importNode);
|
|
138292
138334
|
});
|
|
138293
138335
|
}
|
|
138294
138336
|
}
|
|
@@ -138305,8 +138347,8 @@ ${lanes.join("\n")}
|
|
|
138305
138347
|
return Debug.assertNever(node, `Unexpected node kind ${node.kind}`);
|
|
138306
138348
|
}
|
|
138307
138349
|
}
|
|
138308
|
-
function updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols,
|
|
138309
|
-
const preferredNewNamespaceName = ts_codefix_exports.moduleSpecifierToValidIdentifier(
|
|
138350
|
+
function updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleSpecifier, oldImportId, oldImportNode) {
|
|
138351
|
+
const preferredNewNamespaceName = ts_codefix_exports.moduleSpecifierToValidIdentifier(newModuleSpecifier, 99 /* ESNext */);
|
|
138310
138352
|
let needUniqueName = false;
|
|
138311
138353
|
const toChange = [];
|
|
138312
138354
|
ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(oldImportId, checker, sourceFile, (ref) => {
|
|
@@ -138322,7 +138364,7 @@ ${lanes.join("\n")}
|
|
|
138322
138364
|
for (const ref of toChange) {
|
|
138323
138365
|
changes.replaceNode(sourceFile, ref, factory.createIdentifier(newNamespaceName));
|
|
138324
138366
|
}
|
|
138325
|
-
changes.insertNodeAfter(sourceFile, oldImportNode, updateNamespaceLikeImportNode(oldImportNode,
|
|
138367
|
+
changes.insertNodeAfter(sourceFile, oldImportNode, updateNamespaceLikeImportNode(oldImportNode, preferredNewNamespaceName, newModuleSpecifier));
|
|
138326
138368
|
}
|
|
138327
138369
|
}
|
|
138328
138370
|
function updateNamespaceLikeImportNode(node, newNamespaceName, newModuleSpecifier) {
|
|
@@ -138363,7 +138405,7 @@ ${lanes.join("\n")}
|
|
|
138363
138405
|
}
|
|
138364
138406
|
}
|
|
138365
138407
|
}
|
|
138366
|
-
function createOldFileImportsFromNewFile(newFileNeedExport, newFileNameWithExtension, useEs6Imports, quotePreference) {
|
|
138408
|
+
function createOldFileImportsFromNewFile(sourceFile, newFileNeedExport, newFileNameWithExtension, program, host, useEs6Imports, quotePreference) {
|
|
138367
138409
|
let defaultImport;
|
|
138368
138410
|
const imports = [];
|
|
138369
138411
|
newFileNeedExport.forEach((symbol) => {
|
|
@@ -138373,17 +138415,18 @@ ${lanes.join("\n")}
|
|
|
138373
138415
|
imports.push(symbol.name);
|
|
138374
138416
|
}
|
|
138375
138417
|
});
|
|
138376
|
-
return makeImportOrRequire(defaultImport, imports, newFileNameWithExtension, useEs6Imports, quotePreference);
|
|
138418
|
+
return makeImportOrRequire(sourceFile, defaultImport, imports, newFileNameWithExtension, program, host, useEs6Imports, quotePreference);
|
|
138377
138419
|
}
|
|
138378
|
-
function makeImportOrRequire(defaultImport, imports,
|
|
138379
|
-
|
|
138420
|
+
function makeImportOrRequire(sourceFile, defaultImport, imports, newFileNameWithExtension, program, host, useEs6Imports, quotePreference) {
|
|
138421
|
+
const pathToNewFile = resolvePath(getDirectoryPath(sourceFile.path), newFileNameWithExtension);
|
|
138422
|
+
const pathToNewFileWithCorrectExtension = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.path, pathToNewFile, createModuleSpecifierResolutionHost(program, host));
|
|
138380
138423
|
if (useEs6Imports) {
|
|
138381
138424
|
const specifiers = imports.map((i) => factory.createImportSpecifier(false, void 0, factory.createIdentifier(i)));
|
|
138382
|
-
return makeImportIfNecessary(defaultImport, specifiers,
|
|
138425
|
+
return makeImportIfNecessary(defaultImport, specifiers, pathToNewFileWithCorrectExtension, quotePreference);
|
|
138383
138426
|
} else {
|
|
138384
138427
|
Debug.assert(!defaultImport, "No default import should exist");
|
|
138385
138428
|
const bindingElements = imports.map((i) => factory.createBindingElement(void 0, void 0, i));
|
|
138386
|
-
return bindingElements.length ? makeVariableStatement(factory.createObjectBindingPattern(bindingElements), void 0, createRequireCall(factory.createStringLiteral(
|
|
138429
|
+
return bindingElements.length ? makeVariableStatement(factory.createObjectBindingPattern(bindingElements), void 0, createRequireCall(factory.createStringLiteral(pathToNewFileWithCorrectExtension))) : void 0;
|
|
138387
138430
|
}
|
|
138388
138431
|
}
|
|
138389
138432
|
function makeVariableStatement(name, type, initializer, flags = 2 /* Const */) {
|
|
@@ -138480,7 +138523,7 @@ ${lanes.join("\n")}
|
|
|
138480
138523
|
break;
|
|
138481
138524
|
}
|
|
138482
138525
|
}
|
|
138483
|
-
function getNewFileImportsAndAddExportInOldFile(oldFile, importsToCopy, newFileImportsFromOldFile, changes, checker, useEsModuleSyntax, quotePreference) {
|
|
138526
|
+
function getNewFileImportsAndAddExportInOldFile(oldFile, importsToCopy, newFileImportsFromOldFile, changes, checker, program, host, useEsModuleSyntax, quotePreference) {
|
|
138484
138527
|
const copiedOldImports = [];
|
|
138485
138528
|
for (const oldStatement of oldFile.statements) {
|
|
138486
138529
|
forEachImportInStatement(oldStatement, (i) => {
|
|
@@ -138511,19 +138554,19 @@ ${lanes.join("\n")}
|
|
|
138511
138554
|
}
|
|
138512
138555
|
}
|
|
138513
138556
|
});
|
|
138514
|
-
append(copiedOldImports, makeImportOrRequire(oldFileDefault, oldFileNamedImports,
|
|
138557
|
+
append(copiedOldImports, makeImportOrRequire(oldFile, oldFileDefault, oldFileNamedImports, getBaseFileName(oldFile.fileName), program, host, useEsModuleSyntax, quotePreference));
|
|
138515
138558
|
return copiedOldImports;
|
|
138516
138559
|
}
|
|
138517
|
-
function
|
|
138518
|
-
let
|
|
138560
|
+
function makeUniqueFilename(proposedFilename, extension, inDirectory, host) {
|
|
138561
|
+
let newFilename = proposedFilename;
|
|
138519
138562
|
for (let i = 1; ; i++) {
|
|
138520
|
-
const name = combinePaths(inDirectory,
|
|
138563
|
+
const name = combinePaths(inDirectory, newFilename + extension);
|
|
138521
138564
|
if (!host.fileExists(name))
|
|
138522
|
-
return
|
|
138523
|
-
|
|
138565
|
+
return newFilename;
|
|
138566
|
+
newFilename = `${proposedFilename}.${i}`;
|
|
138524
138567
|
}
|
|
138525
138568
|
}
|
|
138526
|
-
function
|
|
138569
|
+
function inferNewFilename(importsFromNewFile, movedSymbols) {
|
|
138527
138570
|
return importsFromNewFile.forEachEntry(symbolNameNoDefault) || movedSymbols.forEachEntry(symbolNameNoDefault) || "newFile";
|
|
138528
138571
|
}
|
|
138529
138572
|
function getUsageInfo(oldFile, toMove, checker) {
|
|
@@ -138797,6 +138840,7 @@ ${lanes.join("\n")}
|
|
|
138797
138840
|
var init_moveToNewFile = __esm({
|
|
138798
138841
|
"src/services/refactors/moveToNewFile.ts"() {
|
|
138799
138842
|
"use strict";
|
|
138843
|
+
init_moduleSpecifiers();
|
|
138800
138844
|
init_ts4();
|
|
138801
138845
|
init_ts_refactor();
|
|
138802
138846
|
refactorName4 = "Move to a new file";
|