typescript 5.1.0-dev.20230418 → 5.1.0-dev.20230420
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 +41 -16
- package/lib/tsserver.js +54 -24
- package/lib/tsserverlibrary.d.ts +27 -3
- package/lib/tsserverlibrary.js +54 -24
- package/lib/typescript.d.ts +12 -1
- package/lib/typescript.js +46 -21
- package/lib/typingsInstaller.js +2 -2
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.1";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20230420`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -16601,7 +16601,7 @@ function getScriptKindFromFileName(fileName) {
|
|
|
16601
16601
|
var supportedTSExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */], [".cts" /* Cts */, ".d.cts" /* Dcts */], [".mts" /* Mts */, ".d.mts" /* Dmts */]];
|
|
16602
16602
|
var supportedTSExtensionsFlat = flatten(supportedTSExtensions);
|
|
16603
16603
|
var supportedTSExtensionsWithJson = [...supportedTSExtensions, [".json" /* Json */]];
|
|
16604
|
-
var supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx
|
|
16604
|
+
var supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */];
|
|
16605
16605
|
var supportedJSExtensions = [[".js" /* Js */, ".jsx" /* Jsx */], [".mjs" /* Mjs */], [".cjs" /* Cjs */]];
|
|
16606
16606
|
var supportedJSExtensionsFlat = flatten(supportedJSExtensions);
|
|
16607
16607
|
var allSupportedExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */, ".js" /* Js */, ".jsx" /* Jsx */], [".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */], [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */]];
|
|
@@ -110666,7 +110666,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
110666
110666
|
}
|
|
110667
110667
|
}
|
|
110668
110668
|
function emitEmbeddedStatement(parent, node) {
|
|
110669
|
-
if (isBlock(node) || getEmitFlags(parent) & 1 /* SingleLine */) {
|
|
110669
|
+
if (isBlock(node) || getEmitFlags(parent) & 1 /* SingleLine */ || preserveSourceNewlines && !getLeadingLineTerminatorCount(parent, node, 0 /* None */)) {
|
|
110670
110670
|
writeSpace();
|
|
110671
110671
|
emit(node);
|
|
110672
110672
|
} else {
|
|
@@ -113530,7 +113530,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
113530
113530
|
automaticTypeDirectiveResolutions = createModeAwareCache();
|
|
113531
113531
|
if (automaticTypeDirectiveNames.length) {
|
|
113532
113532
|
(_k = tracing) == null ? void 0 : _k.push(tracing.Phase.Program, "processTypeReferences", { count: automaticTypeDirectiveNames.length });
|
|
113533
|
-
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) :
|
|
113533
|
+
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
113534
113534
|
const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile);
|
|
113535
113535
|
const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(automaticTypeDirectiveNames, containingFilename);
|
|
113536
113536
|
for (let i = 0; i < automaticTypeDirectiveNames.length; i++) {
|
|
@@ -115321,8 +115321,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115321
115321
|
path += (i === 2 ? "/" : "-") + components[i];
|
|
115322
115322
|
i++;
|
|
115323
115323
|
}
|
|
115324
|
-
const
|
|
115325
|
-
const
|
|
115324
|
+
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
115325
|
+
const resolveFrom = combinePaths(containingDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`);
|
|
115326
|
+
const localOverrideModuleResult = resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: 2 /* Node10 */, traceResolution: options.traceResolution }, host, moduleResolutionCache);
|
|
115326
115327
|
if (localOverrideModuleResult == null ? void 0 : localOverrideModuleResult.resolvedModule) {
|
|
115327
115328
|
return localOverrideModuleResult.resolvedModule.resolvedFileName;
|
|
115328
115329
|
}
|
|
@@ -115457,7 +115458,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115457
115458
|
void 0
|
|
115458
115459
|
);
|
|
115459
115460
|
} else {
|
|
115460
|
-
const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath),
|
|
115461
|
+
const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath), currentDirectory);
|
|
115461
115462
|
sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
|
|
115462
115463
|
addFileToFilesByName(
|
|
115463
115464
|
sourceFile,
|
|
@@ -118298,6 +118299,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118298
118299
|
let failedLookupChecks;
|
|
118299
118300
|
let startsWithPathChecks;
|
|
118300
118301
|
let isInDirectoryChecks;
|
|
118302
|
+
let allResolutionsAreInvalidated = false;
|
|
118301
118303
|
const getCurrentDirectory = memoize(() => resolutionHost.getCurrentDirectory());
|
|
118302
118304
|
const cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
|
|
118303
118305
|
const resolvedModuleNames = /* @__PURE__ */ new Map();
|
|
@@ -118340,7 +118342,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118340
118342
|
isFileWithInvalidatedNonRelativeUnresolvedImports,
|
|
118341
118343
|
updateTypeRootsWatch,
|
|
118342
118344
|
closeTypeRootsWatch,
|
|
118343
|
-
clear: clear2
|
|
118345
|
+
clear: clear2,
|
|
118346
|
+
onChangesAffectModuleResolution
|
|
118344
118347
|
};
|
|
118345
118348
|
function getResolvedModule2(resolution) {
|
|
118346
118349
|
return resolution.resolvedModule;
|
|
@@ -118363,6 +118366,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118363
118366
|
isInDirectoryChecks = void 0;
|
|
118364
118367
|
affectingPathChecks = void 0;
|
|
118365
118368
|
affectingPathChecksForFile = void 0;
|
|
118369
|
+
allResolutionsAreInvalidated = false;
|
|
118366
118370
|
moduleResolutionCache.clear();
|
|
118367
118371
|
typeReferenceDirectiveResolutionCache.clear();
|
|
118368
118372
|
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
@@ -118370,6 +118374,13 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118370
118374
|
impliedFormatPackageJsons.clear();
|
|
118371
118375
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
118372
118376
|
}
|
|
118377
|
+
function onChangesAffectModuleResolution() {
|
|
118378
|
+
allResolutionsAreInvalidated = true;
|
|
118379
|
+
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
118380
|
+
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
118381
|
+
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
118382
|
+
typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
118383
|
+
}
|
|
118373
118384
|
function startRecordingFilesWithChangedResolutions() {
|
|
118374
118385
|
filesWithChangedSetOfUnresolvedImports = [];
|
|
118375
118386
|
}
|
|
@@ -118389,7 +118400,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118389
118400
|
invalidateResolutionsOfFailedLookupLocations();
|
|
118390
118401
|
const collected = filesWithInvalidatedResolutions;
|
|
118391
118402
|
filesWithInvalidatedResolutions = void 0;
|
|
118392
|
-
return (path) => customHasInvalidatedResolutions(path) || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
118403
|
+
return (path) => customHasInvalidatedResolutions(path) || allResolutionsAreInvalidated || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
118393
118404
|
}
|
|
118394
118405
|
function startCachingPerDirectoryResolution() {
|
|
118395
118406
|
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
@@ -118399,6 +118410,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118399
118410
|
}
|
|
118400
118411
|
function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
|
|
118401
118412
|
filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
|
|
118413
|
+
allResolutionsAreInvalidated = false;
|
|
118402
118414
|
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
118403
118415
|
nonRelativeExternalModuleResolutions.clear();
|
|
118404
118416
|
if (newProgram !== oldProgram) {
|
|
@@ -118510,8 +118522,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118510
118522
|
const name = loader.nameAndMode.getName(entry);
|
|
118511
118523
|
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
118512
118524
|
let resolution = resolutionsInFile.get(name, mode);
|
|
118513
|
-
if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
118514
|
-
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) {
|
|
118525
|
+
if (!seenNamesInFile.has(name, mode) && (allResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
118526
|
+
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
118515
118527
|
const existingResolution = resolution;
|
|
118516
118528
|
resolution = loader.resolve(name, mode);
|
|
118517
118529
|
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
@@ -118933,8 +118945,23 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118933
118945
|
}
|
|
118934
118946
|
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
118935
118947
|
}
|
|
118948
|
+
function invalidatePackageJsonMap() {
|
|
118949
|
+
const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
|
|
118950
|
+
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
118951
|
+
packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
|
|
118952
|
+
}
|
|
118953
|
+
}
|
|
118936
118954
|
function invalidateResolutionsOfFailedLookupLocations() {
|
|
118937
118955
|
var _a;
|
|
118956
|
+
if (allResolutionsAreInvalidated) {
|
|
118957
|
+
affectingPathChecksForFile = void 0;
|
|
118958
|
+
invalidatePackageJsonMap();
|
|
118959
|
+
failedLookupChecks = void 0;
|
|
118960
|
+
startsWithPathChecks = void 0;
|
|
118961
|
+
isInDirectoryChecks = void 0;
|
|
118962
|
+
affectingPathChecks = void 0;
|
|
118963
|
+
return true;
|
|
118964
|
+
}
|
|
118938
118965
|
let invalidated = false;
|
|
118939
118966
|
if (affectingPathChecksForFile) {
|
|
118940
118967
|
(_a = resolutionHost.getCurrentProgram()) == null ? void 0 : _a.getSourceFiles().forEach((f) => {
|
|
@@ -118949,10 +118976,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118949
118976
|
return invalidated;
|
|
118950
118977
|
}
|
|
118951
118978
|
invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution) || invalidated;
|
|
118952
|
-
|
|
118953
|
-
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
118954
|
-
packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
|
|
118955
|
-
}
|
|
118979
|
+
invalidatePackageJsonMap();
|
|
118956
118980
|
failedLookupChecks = void 0;
|
|
118957
118981
|
startsWithPathChecks = void 0;
|
|
118958
118982
|
isInDirectoryChecks = void 0;
|
|
@@ -119871,7 +119895,8 @@ function createWatchProgram(host) {
|
|
|
119871
119895
|
if (hasChangedCompilerOptions) {
|
|
119872
119896
|
newLine = updateNewLine();
|
|
119873
119897
|
if (program && changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) {
|
|
119874
|
-
|
|
119898
|
+
debugger;
|
|
119899
|
+
resolutionCache.onChangesAffectModuleResolution();
|
|
119875
119900
|
}
|
|
119876
119901
|
}
|
|
119877
119902
|
const hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions);
|
package/lib/tsserver.js
CHANGED
|
@@ -2301,7 +2301,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2301
2301
|
|
|
2302
2302
|
// src/compiler/corePublic.ts
|
|
2303
2303
|
var versionMajorMinor = "5.1";
|
|
2304
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2304
|
+
var version = `${versionMajorMinor}.0-dev.20230420`;
|
|
2305
2305
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2306
2306
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2307
2307
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -20751,7 +20751,7 @@ function getScriptKindFromFileName(fileName) {
|
|
|
20751
20751
|
var supportedTSExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */], [".cts" /* Cts */, ".d.cts" /* Dcts */], [".mts" /* Mts */, ".d.mts" /* Dmts */]];
|
|
20752
20752
|
var supportedTSExtensionsFlat = flatten(supportedTSExtensions);
|
|
20753
20753
|
var supportedTSExtensionsWithJson = [...supportedTSExtensions, [".json" /* Json */]];
|
|
20754
|
-
var supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx
|
|
20754
|
+
var supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */];
|
|
20755
20755
|
var supportedJSExtensions = [[".js" /* Js */, ".jsx" /* Jsx */], [".mjs" /* Mjs */], [".cjs" /* Cjs */]];
|
|
20756
20756
|
var supportedJSExtensionsFlat = flatten(supportedJSExtensions);
|
|
20757
20757
|
var allSupportedExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */, ".js" /* Js */, ".jsx" /* Jsx */], [".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */], [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */]];
|
|
@@ -115502,7 +115502,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
115502
115502
|
}
|
|
115503
115503
|
}
|
|
115504
115504
|
function emitEmbeddedStatement(parent2, node) {
|
|
115505
|
-
if (isBlock(node) || getEmitFlags(parent2) & 1 /* SingleLine */) {
|
|
115505
|
+
if (isBlock(node) || getEmitFlags(parent2) & 1 /* SingleLine */ || preserveSourceNewlines && !getLeadingLineTerminatorCount(parent2, node, 0 /* None */)) {
|
|
115506
115506
|
writeSpace();
|
|
115507
115507
|
emit(node);
|
|
115508
115508
|
} else {
|
|
@@ -118420,7 +118420,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118420
118420
|
automaticTypeDirectiveResolutions = createModeAwareCache();
|
|
118421
118421
|
if (automaticTypeDirectiveNames.length) {
|
|
118422
118422
|
(_k = tracing) == null ? void 0 : _k.push(tracing.Phase.Program, "processTypeReferences", { count: automaticTypeDirectiveNames.length });
|
|
118423
|
-
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) :
|
|
118423
|
+
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
118424
118424
|
const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile);
|
|
118425
118425
|
const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(automaticTypeDirectiveNames, containingFilename);
|
|
118426
118426
|
for (let i = 0; i < automaticTypeDirectiveNames.length; i++) {
|
|
@@ -120211,8 +120211,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120211
120211
|
path += (i === 2 ? "/" : "-") + components[i];
|
|
120212
120212
|
i++;
|
|
120213
120213
|
}
|
|
120214
|
-
const
|
|
120215
|
-
const
|
|
120214
|
+
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
120215
|
+
const resolveFrom = combinePaths(containingDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`);
|
|
120216
|
+
const localOverrideModuleResult = resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: 2 /* Node10 */, traceResolution: options.traceResolution }, host, moduleResolutionCache);
|
|
120216
120217
|
if (localOverrideModuleResult == null ? void 0 : localOverrideModuleResult.resolvedModule) {
|
|
120217
120218
|
return localOverrideModuleResult.resolvedModule.resolvedFileName;
|
|
120218
120219
|
}
|
|
@@ -120347,7 +120348,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120347
120348
|
void 0
|
|
120348
120349
|
);
|
|
120349
120350
|
} else {
|
|
120350
|
-
const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath),
|
|
120351
|
+
const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath), currentDirectory);
|
|
120351
120352
|
sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
|
|
120352
120353
|
addFileToFilesByName(
|
|
120353
120354
|
sourceFile,
|
|
@@ -123223,6 +123224,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123223
123224
|
let failedLookupChecks;
|
|
123224
123225
|
let startsWithPathChecks;
|
|
123225
123226
|
let isInDirectoryChecks;
|
|
123227
|
+
let allResolutionsAreInvalidated = false;
|
|
123226
123228
|
const getCurrentDirectory = memoize(() => resolutionHost.getCurrentDirectory());
|
|
123227
123229
|
const cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
|
|
123228
123230
|
const resolvedModuleNames = /* @__PURE__ */ new Map();
|
|
@@ -123265,7 +123267,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123265
123267
|
isFileWithInvalidatedNonRelativeUnresolvedImports,
|
|
123266
123268
|
updateTypeRootsWatch,
|
|
123267
123269
|
closeTypeRootsWatch,
|
|
123268
|
-
clear: clear2
|
|
123270
|
+
clear: clear2,
|
|
123271
|
+
onChangesAffectModuleResolution
|
|
123269
123272
|
};
|
|
123270
123273
|
function getResolvedModule2(resolution) {
|
|
123271
123274
|
return resolution.resolvedModule;
|
|
@@ -123288,6 +123291,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123288
123291
|
isInDirectoryChecks = void 0;
|
|
123289
123292
|
affectingPathChecks = void 0;
|
|
123290
123293
|
affectingPathChecksForFile = void 0;
|
|
123294
|
+
allResolutionsAreInvalidated = false;
|
|
123291
123295
|
moduleResolutionCache.clear();
|
|
123292
123296
|
typeReferenceDirectiveResolutionCache.clear();
|
|
123293
123297
|
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
@@ -123295,6 +123299,13 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123295
123299
|
impliedFormatPackageJsons.clear();
|
|
123296
123300
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
123297
123301
|
}
|
|
123302
|
+
function onChangesAffectModuleResolution() {
|
|
123303
|
+
allResolutionsAreInvalidated = true;
|
|
123304
|
+
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
123305
|
+
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
123306
|
+
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
123307
|
+
typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
123308
|
+
}
|
|
123298
123309
|
function startRecordingFilesWithChangedResolutions() {
|
|
123299
123310
|
filesWithChangedSetOfUnresolvedImports = [];
|
|
123300
123311
|
}
|
|
@@ -123314,7 +123325,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123314
123325
|
invalidateResolutionsOfFailedLookupLocations();
|
|
123315
123326
|
const collected = filesWithInvalidatedResolutions;
|
|
123316
123327
|
filesWithInvalidatedResolutions = void 0;
|
|
123317
|
-
return (path) => customHasInvalidatedResolutions(path) || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
123328
|
+
return (path) => customHasInvalidatedResolutions(path) || allResolutionsAreInvalidated || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
123318
123329
|
}
|
|
123319
123330
|
function startCachingPerDirectoryResolution() {
|
|
123320
123331
|
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
@@ -123324,6 +123335,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123324
123335
|
}
|
|
123325
123336
|
function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
|
|
123326
123337
|
filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
|
|
123338
|
+
allResolutionsAreInvalidated = false;
|
|
123327
123339
|
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
123328
123340
|
nonRelativeExternalModuleResolutions.clear();
|
|
123329
123341
|
if (newProgram !== oldProgram) {
|
|
@@ -123435,8 +123447,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123435
123447
|
const name = loader.nameAndMode.getName(entry);
|
|
123436
123448
|
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
123437
123449
|
let resolution = resolutionsInFile.get(name, mode);
|
|
123438
|
-
if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
123439
|
-
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) {
|
|
123450
|
+
if (!seenNamesInFile.has(name, mode) && (allResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
123451
|
+
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
123440
123452
|
const existingResolution = resolution;
|
|
123441
123453
|
resolution = loader.resolve(name, mode);
|
|
123442
123454
|
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
@@ -123858,8 +123870,23 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123858
123870
|
}
|
|
123859
123871
|
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
123860
123872
|
}
|
|
123873
|
+
function invalidatePackageJsonMap() {
|
|
123874
|
+
const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
|
|
123875
|
+
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
123876
|
+
packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
|
|
123877
|
+
}
|
|
123878
|
+
}
|
|
123861
123879
|
function invalidateResolutionsOfFailedLookupLocations() {
|
|
123862
123880
|
var _a;
|
|
123881
|
+
if (allResolutionsAreInvalidated) {
|
|
123882
|
+
affectingPathChecksForFile = void 0;
|
|
123883
|
+
invalidatePackageJsonMap();
|
|
123884
|
+
failedLookupChecks = void 0;
|
|
123885
|
+
startsWithPathChecks = void 0;
|
|
123886
|
+
isInDirectoryChecks = void 0;
|
|
123887
|
+
affectingPathChecks = void 0;
|
|
123888
|
+
return true;
|
|
123889
|
+
}
|
|
123863
123890
|
let invalidated = false;
|
|
123864
123891
|
if (affectingPathChecksForFile) {
|
|
123865
123892
|
(_a = resolutionHost.getCurrentProgram()) == null ? void 0 : _a.getSourceFiles().forEach((f) => {
|
|
@@ -123874,10 +123901,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123874
123901
|
return invalidated;
|
|
123875
123902
|
}
|
|
123876
123903
|
invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution) || invalidated;
|
|
123877
|
-
|
|
123878
|
-
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
123879
|
-
packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
|
|
123880
|
-
}
|
|
123904
|
+
invalidatePackageJsonMap();
|
|
123881
123905
|
failedLookupChecks = void 0;
|
|
123882
123906
|
startsWithPathChecks = void 0;
|
|
123883
123907
|
isInDirectoryChecks = void 0;
|
|
@@ -124821,7 +124845,8 @@ function createWatchProgram(host) {
|
|
|
124821
124845
|
if (hasChangedCompilerOptions) {
|
|
124822
124846
|
newLine = updateNewLine();
|
|
124823
124847
|
if (program && changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) {
|
|
124824
|
-
|
|
124848
|
+
debugger;
|
|
124849
|
+
resolutionCache.onChangesAffectModuleResolution();
|
|
124825
124850
|
}
|
|
124826
124851
|
}
|
|
124827
124852
|
const hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions);
|
|
@@ -137056,10 +137081,10 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
137056
137081
|
function getSmartSelectionRange2(fileName, position) {
|
|
137057
137082
|
return ts_SmartSelectionRange_exports.getSmartSelectionRange(position, syntaxTreeCache.getCurrentSourceFile(fileName));
|
|
137058
137083
|
}
|
|
137059
|
-
function getApplicableRefactors2(fileName, positionOrRange, preferences = emptyOptions, triggerReason, kind) {
|
|
137084
|
+
function getApplicableRefactors2(fileName, positionOrRange, preferences = emptyOptions, triggerReason, kind, includeInteractiveActions) {
|
|
137060
137085
|
synchronizeHostData();
|
|
137061
137086
|
const file = getValidSourceFile(fileName);
|
|
137062
|
-
return ts_refactor_exports.getApplicableRefactors(getRefactorContext(file, positionOrRange, preferences, emptyOptions, triggerReason, kind));
|
|
137087
|
+
return ts_refactor_exports.getApplicableRefactors(getRefactorContext(file, positionOrRange, preferences, emptyOptions, triggerReason, kind), includeInteractiveActions);
|
|
137063
137088
|
}
|
|
137064
137089
|
function getEditsForRefactor2(fileName, formatOptions, positionOrRange, refactorName13, actionName2, preferences = emptyOptions) {
|
|
137065
137090
|
synchronizeHostData();
|
|
@@ -152143,7 +152168,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
152143
152168
|
return true;
|
|
152144
152169
|
}
|
|
152145
152170
|
}
|
|
152146
|
-
return isDeclarationName(contextToken2) && !isShorthandPropertyAssignment(contextToken2.parent) && !isJsxAttribute(contextToken2.parent) && !((isClassLike(contextToken2.parent) || isInterfaceDeclaration(contextToken2.parent)) && (contextToken2 !== previousToken || position > previousToken.end));
|
|
152171
|
+
return isDeclarationName(contextToken2) && !isShorthandPropertyAssignment(contextToken2.parent) && !isJsxAttribute(contextToken2.parent) && !((isClassLike(contextToken2.parent) || isInterfaceDeclaration(contextToken2.parent) || isTypeParameterDeclaration(contextToken2.parent)) && (contextToken2 !== previousToken || position > previousToken.end));
|
|
152147
152172
|
}
|
|
152148
152173
|
function isPreviousPropertyDeclarationTerminated(contextToken2, position2) {
|
|
152149
152174
|
return contextToken2.kind !== 64 /* EqualsToken */ && (contextToken2.kind === 27 /* SemicolonToken */ || !positionsAreOnSameLine(contextToken2.end, position2, sourceFile));
|
|
@@ -158334,10 +158359,10 @@ var refactors = /* @__PURE__ */ new Map();
|
|
|
158334
158359
|
function registerRefactor(name, refactor) {
|
|
158335
158360
|
refactors.set(name, refactor);
|
|
158336
158361
|
}
|
|
158337
|
-
function getApplicableRefactors(context) {
|
|
158362
|
+
function getApplicableRefactors(context, includeInteractiveActions) {
|
|
158338
158363
|
return arrayFrom(flatMapIterator(refactors.values(), (refactor) => {
|
|
158339
158364
|
var _a;
|
|
158340
|
-
return context.cancellationToken && context.cancellationToken.isCancellationRequested() || !((_a = refactor.kinds) == null ? void 0 : _a.some((kind) => refactorKindBeginsWith(kind, context.kind))) ? void 0 : refactor.getAvailableActions(context);
|
|
158365
|
+
return context.cancellationToken && context.cancellationToken.isCancellationRequested() || !((_a = refactor.kinds) == null ? void 0 : _a.some((kind) => refactorKindBeginsWith(kind, context.kind))) ? void 0 : refactor.getAvailableActions(context, includeInteractiveActions);
|
|
158341
158366
|
}));
|
|
158342
158367
|
}
|
|
158343
158368
|
function getEditsForRefactor(context, refactorName13, actionName2) {
|
|
@@ -173946,7 +173971,7 @@ var Project3 = class {
|
|
|
173946
173971
|
if (changesAffectModuleResolution(oldOptions, compilerOptions)) {
|
|
173947
173972
|
this.cachedUnresolvedImportsPerFile.clear();
|
|
173948
173973
|
this.lastCachedUnresolvedImportsList = void 0;
|
|
173949
|
-
this.resolutionCache.
|
|
173974
|
+
this.resolutionCache.onChangesAffectModuleResolution();
|
|
173950
173975
|
this.moduleSpecifierCache.clear();
|
|
173951
173976
|
}
|
|
173952
173977
|
this.markAsDirty();
|
|
@@ -174416,13 +174441,18 @@ var InferredProject2 = class extends Project3 {
|
|
|
174416
174441
|
/*isJsInferredProject*/
|
|
174417
174442
|
true
|
|
174418
174443
|
);
|
|
174444
|
+
} else if (this.isOrphan() && this._isJsInferredProject && !info.isJavaScript()) {
|
|
174445
|
+
this.toggleJsInferredProject(
|
|
174446
|
+
/*isJsInferredProject*/
|
|
174447
|
+
false
|
|
174448
|
+
);
|
|
174419
174449
|
}
|
|
174420
174450
|
super.addRoot(info);
|
|
174421
174451
|
}
|
|
174422
174452
|
removeRoot(info) {
|
|
174423
174453
|
this.projectService.stopWatchingConfigFilesForInferredProjectRoot(info);
|
|
174424
174454
|
super.removeRoot(info);
|
|
174425
|
-
if (this._isJsInferredProject && info.isJavaScript()) {
|
|
174455
|
+
if (!this.isOrphan() && this._isJsInferredProject && info.isJavaScript()) {
|
|
174426
174456
|
if (every(this.getRootScriptInfos(), (rootInfo) => !rootInfo.isJavaScript())) {
|
|
174427
174457
|
this.toggleJsInferredProject(
|
|
174428
174458
|
/*isJsInferredProject*/
|
|
@@ -179524,7 +179554,7 @@ var Session3 = class {
|
|
|
179524
179554
|
}));
|
|
179525
179555
|
this.host = opts.host;
|
|
179526
179556
|
this.cancellationToken = opts.cancellationToken;
|
|
179527
|
-
this.typingsInstaller = opts.typingsInstaller;
|
|
179557
|
+
this.typingsInstaller = opts.typingsInstaller || nullTypingsInstaller;
|
|
179528
179558
|
this.byteLength = opts.byteLength;
|
|
179529
179559
|
this.hrtime = opts.hrtime;
|
|
179530
179560
|
this.logger = opts.logger;
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -501,6 +501,14 @@ declare namespace ts {
|
|
|
501
501
|
type GetApplicableRefactorsRequestArgs = FileLocationOrRangeRequestArgs & {
|
|
502
502
|
triggerReason?: RefactorTriggerReason;
|
|
503
503
|
kind?: string;
|
|
504
|
+
/**
|
|
505
|
+
* Include refactor actions that require additional arguments to be passed when
|
|
506
|
+
* calling 'GetEditsForRefactor'. When true, clients should inspect the
|
|
507
|
+
* `isInteractive` property of each returned `RefactorActionInfo`
|
|
508
|
+
* and ensure they are able to collect the appropriate arguments for any
|
|
509
|
+
* interactive refactor before offering it.
|
|
510
|
+
*/
|
|
511
|
+
includeInteractiveActions?: boolean;
|
|
504
512
|
};
|
|
505
513
|
type RefactorTriggerReason = "implicit" | "invoked";
|
|
506
514
|
/**
|
|
@@ -557,6 +565,11 @@ declare namespace ts {
|
|
|
557
565
|
* The hierarchical dotted name of the refactor action.
|
|
558
566
|
*/
|
|
559
567
|
kind?: string;
|
|
568
|
+
/**
|
|
569
|
+
* Indicates that the action requires additional arguments to be passed
|
|
570
|
+
* when calling 'GetEditsForRefactor'.
|
|
571
|
+
*/
|
|
572
|
+
isInteractive?: boolean;
|
|
560
573
|
}
|
|
561
574
|
interface GetEditsForRefactorRequest extends Request {
|
|
562
575
|
command: CommandTypes.GetEditsForRefactor;
|
|
@@ -3554,7 +3567,7 @@ declare namespace ts {
|
|
|
3554
3567
|
cancellationToken: HostCancellationToken;
|
|
3555
3568
|
useSingleInferredProject: boolean;
|
|
3556
3569
|
useInferredProjectPerProjectRoot: boolean;
|
|
3557
|
-
typingsInstaller
|
|
3570
|
+
typingsInstaller?: ITypingsInstaller;
|
|
3558
3571
|
eventHandler?: ProjectServiceEventHandler;
|
|
3559
3572
|
suppressDiagnosticEvents?: boolean;
|
|
3560
3573
|
throttleWaitMilliseconds?: number;
|
|
@@ -3826,7 +3839,7 @@ declare namespace ts {
|
|
|
3826
3839
|
cancellationToken: ServerCancellationToken;
|
|
3827
3840
|
useSingleInferredProject: boolean;
|
|
3828
3841
|
useInferredProjectPerProjectRoot: boolean;
|
|
3829
|
-
typingsInstaller
|
|
3842
|
+
typingsInstaller?: ITypingsInstaller;
|
|
3830
3843
|
byteLength: (buf: string, encoding?: BufferEncoding) => number;
|
|
3831
3844
|
hrtime: (start?: [
|
|
3832
3845
|
number,
|
|
@@ -10129,7 +10142,13 @@ declare namespace ts {
|
|
|
10129
10142
|
applyCodeActionCommand(fileName: string, action: CodeActionCommand[]): Promise<ApplyCodeActionCommandResult[]>;
|
|
10130
10143
|
/** @deprecated `fileName` will be ignored */
|
|
10131
10144
|
applyCodeActionCommand(fileName: string, action: CodeActionCommand | CodeActionCommand[]): Promise<ApplyCodeActionCommandResult | ApplyCodeActionCommandResult[]>;
|
|
10132
|
-
|
|
10145
|
+
/**
|
|
10146
|
+
* @param includeInteractiveActions Include refactor actions that require additional arguments to be
|
|
10147
|
+
* passed when calling `getEditsForRefactor`. When true, clients should inspect the `isInteractive`
|
|
10148
|
+
* property of each returned `RefactorActionInfo` and ensure they are able to collect the appropriate
|
|
10149
|
+
* arguments for any interactive action before offering it.
|
|
10150
|
+
*/
|
|
10151
|
+
getApplicableRefactors(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined, triggerReason?: RefactorTriggerReason, kind?: string, includeInteractiveActions?: boolean): ApplicableRefactorInfo[];
|
|
10133
10152
|
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined): RefactorEditInfo | undefined;
|
|
10134
10153
|
organizeImports(args: OrganizeImportsArgs, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): readonly FileTextChanges[];
|
|
10135
10154
|
getEditsForFileRename(oldFilePath: string, newFilePath: string, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): readonly FileTextChanges[];
|
|
@@ -10401,6 +10420,11 @@ declare namespace ts {
|
|
|
10401
10420
|
* The hierarchical dotted name of the refactor action.
|
|
10402
10421
|
*/
|
|
10403
10422
|
kind?: string;
|
|
10423
|
+
/**
|
|
10424
|
+
* Indicates that the action requires additional arguments to be passed
|
|
10425
|
+
* when calling `getEditsForRefactor`.
|
|
10426
|
+
*/
|
|
10427
|
+
isInteractive?: boolean;
|
|
10404
10428
|
}
|
|
10405
10429
|
/**
|
|
10406
10430
|
* A set of edits to make in response to a refactor action, plus an optional
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.1";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230420`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -19288,7 +19288,7 @@ ${lanes.join("\n")}
|
|
|
19288
19288
|
supportedTSExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */], [".cts" /* Cts */, ".d.cts" /* Dcts */], [".mts" /* Mts */, ".d.mts" /* Dmts */]];
|
|
19289
19289
|
supportedTSExtensionsFlat = flatten(supportedTSExtensions);
|
|
19290
19290
|
supportedTSExtensionsWithJson = [...supportedTSExtensions, [".json" /* Json */]];
|
|
19291
|
-
supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx
|
|
19291
|
+
supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */];
|
|
19292
19292
|
supportedJSExtensions = [[".js" /* Js */, ".jsx" /* Jsx */], [".mjs" /* Mjs */], [".cjs" /* Cjs */]];
|
|
19293
19293
|
supportedJSExtensionsFlat = flatten(supportedJSExtensions);
|
|
19294
19294
|
allSupportedExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */, ".js" /* Js */, ".jsx" /* Jsx */], [".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */], [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */]];
|
|
@@ -113561,7 +113561,7 @@ ${lanes.join("\n")}
|
|
|
113561
113561
|
}
|
|
113562
113562
|
}
|
|
113563
113563
|
function emitEmbeddedStatement(parent2, node) {
|
|
113564
|
-
if (isBlock(node) || getEmitFlags(parent2) & 1 /* SingleLine */) {
|
|
113564
|
+
if (isBlock(node) || getEmitFlags(parent2) & 1 /* SingleLine */ || preserveSourceNewlines && !getLeadingLineTerminatorCount(parent2, node, 0 /* None */)) {
|
|
113565
113565
|
writeSpace();
|
|
113566
113566
|
emit(node);
|
|
113567
113567
|
} else {
|
|
@@ -116422,7 +116422,7 @@ ${lanes.join("\n")}
|
|
|
116422
116422
|
automaticTypeDirectiveResolutions = createModeAwareCache();
|
|
116423
116423
|
if (automaticTypeDirectiveNames.length) {
|
|
116424
116424
|
(_k = tracing) == null ? void 0 : _k.push(tracing.Phase.Program, "processTypeReferences", { count: automaticTypeDirectiveNames.length });
|
|
116425
|
-
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) :
|
|
116425
|
+
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
116426
116426
|
const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile);
|
|
116427
116427
|
const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(automaticTypeDirectiveNames, containingFilename);
|
|
116428
116428
|
for (let i = 0; i < automaticTypeDirectiveNames.length; i++) {
|
|
@@ -118213,8 +118213,9 @@ ${lanes.join("\n")}
|
|
|
118213
118213
|
path += (i === 2 ? "/" : "-") + components[i];
|
|
118214
118214
|
i++;
|
|
118215
118215
|
}
|
|
118216
|
-
const
|
|
118217
|
-
const
|
|
118216
|
+
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
118217
|
+
const resolveFrom = combinePaths(containingDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`);
|
|
118218
|
+
const localOverrideModuleResult = resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: 2 /* Node10 */, traceResolution: options.traceResolution }, host, moduleResolutionCache);
|
|
118218
118219
|
if (localOverrideModuleResult == null ? void 0 : localOverrideModuleResult.resolvedModule) {
|
|
118219
118220
|
return localOverrideModuleResult.resolvedModule.resolvedFileName;
|
|
118220
118221
|
}
|
|
@@ -118349,7 +118350,7 @@ ${lanes.join("\n")}
|
|
|
118349
118350
|
void 0
|
|
118350
118351
|
);
|
|
118351
118352
|
} else {
|
|
118352
|
-
const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath),
|
|
118353
|
+
const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath), currentDirectory);
|
|
118353
118354
|
sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
|
|
118354
118355
|
addFileToFilesByName(
|
|
118355
118356
|
sourceFile,
|
|
@@ -121380,6 +121381,7 @@ ${lanes.join("\n")}
|
|
|
121380
121381
|
let failedLookupChecks;
|
|
121381
121382
|
let startsWithPathChecks;
|
|
121382
121383
|
let isInDirectoryChecks;
|
|
121384
|
+
let allResolutionsAreInvalidated = false;
|
|
121383
121385
|
const getCurrentDirectory = memoize(() => resolutionHost.getCurrentDirectory());
|
|
121384
121386
|
const cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
|
|
121385
121387
|
const resolvedModuleNames = /* @__PURE__ */ new Map();
|
|
@@ -121422,7 +121424,8 @@ ${lanes.join("\n")}
|
|
|
121422
121424
|
isFileWithInvalidatedNonRelativeUnresolvedImports,
|
|
121423
121425
|
updateTypeRootsWatch,
|
|
121424
121426
|
closeTypeRootsWatch,
|
|
121425
|
-
clear: clear2
|
|
121427
|
+
clear: clear2,
|
|
121428
|
+
onChangesAffectModuleResolution
|
|
121426
121429
|
};
|
|
121427
121430
|
function getResolvedModule2(resolution) {
|
|
121428
121431
|
return resolution.resolvedModule;
|
|
@@ -121445,6 +121448,7 @@ ${lanes.join("\n")}
|
|
|
121445
121448
|
isInDirectoryChecks = void 0;
|
|
121446
121449
|
affectingPathChecks = void 0;
|
|
121447
121450
|
affectingPathChecksForFile = void 0;
|
|
121451
|
+
allResolutionsAreInvalidated = false;
|
|
121448
121452
|
moduleResolutionCache.clear();
|
|
121449
121453
|
typeReferenceDirectiveResolutionCache.clear();
|
|
121450
121454
|
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
@@ -121452,6 +121456,13 @@ ${lanes.join("\n")}
|
|
|
121452
121456
|
impliedFormatPackageJsons.clear();
|
|
121453
121457
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
121454
121458
|
}
|
|
121459
|
+
function onChangesAffectModuleResolution() {
|
|
121460
|
+
allResolutionsAreInvalidated = true;
|
|
121461
|
+
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
121462
|
+
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
121463
|
+
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
121464
|
+
typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
121465
|
+
}
|
|
121455
121466
|
function startRecordingFilesWithChangedResolutions() {
|
|
121456
121467
|
filesWithChangedSetOfUnresolvedImports = [];
|
|
121457
121468
|
}
|
|
@@ -121471,7 +121482,7 @@ ${lanes.join("\n")}
|
|
|
121471
121482
|
invalidateResolutionsOfFailedLookupLocations();
|
|
121472
121483
|
const collected = filesWithInvalidatedResolutions;
|
|
121473
121484
|
filesWithInvalidatedResolutions = void 0;
|
|
121474
|
-
return (path) => customHasInvalidatedResolutions(path) || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
121485
|
+
return (path) => customHasInvalidatedResolutions(path) || allResolutionsAreInvalidated || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
121475
121486
|
}
|
|
121476
121487
|
function startCachingPerDirectoryResolution() {
|
|
121477
121488
|
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
@@ -121481,6 +121492,7 @@ ${lanes.join("\n")}
|
|
|
121481
121492
|
}
|
|
121482
121493
|
function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
|
|
121483
121494
|
filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
|
|
121495
|
+
allResolutionsAreInvalidated = false;
|
|
121484
121496
|
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
121485
121497
|
nonRelativeExternalModuleResolutions.clear();
|
|
121486
121498
|
if (newProgram !== oldProgram) {
|
|
@@ -121592,8 +121604,8 @@ ${lanes.join("\n")}
|
|
|
121592
121604
|
const name = loader.nameAndMode.getName(entry);
|
|
121593
121605
|
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
121594
121606
|
let resolution = resolutionsInFile.get(name, mode);
|
|
121595
|
-
if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
121596
|
-
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) {
|
|
121607
|
+
if (!seenNamesInFile.has(name, mode) && (allResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
121608
|
+
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
121597
121609
|
const existingResolution = resolution;
|
|
121598
121610
|
resolution = loader.resolve(name, mode);
|
|
121599
121611
|
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
@@ -122015,8 +122027,23 @@ ${lanes.join("\n")}
|
|
|
122015
122027
|
}
|
|
122016
122028
|
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
122017
122029
|
}
|
|
122030
|
+
function invalidatePackageJsonMap() {
|
|
122031
|
+
const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
|
|
122032
|
+
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
122033
|
+
packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
|
|
122034
|
+
}
|
|
122035
|
+
}
|
|
122018
122036
|
function invalidateResolutionsOfFailedLookupLocations() {
|
|
122019
122037
|
var _a;
|
|
122038
|
+
if (allResolutionsAreInvalidated) {
|
|
122039
|
+
affectingPathChecksForFile = void 0;
|
|
122040
|
+
invalidatePackageJsonMap();
|
|
122041
|
+
failedLookupChecks = void 0;
|
|
122042
|
+
startsWithPathChecks = void 0;
|
|
122043
|
+
isInDirectoryChecks = void 0;
|
|
122044
|
+
affectingPathChecks = void 0;
|
|
122045
|
+
return true;
|
|
122046
|
+
}
|
|
122020
122047
|
let invalidated = false;
|
|
122021
122048
|
if (affectingPathChecksForFile) {
|
|
122022
122049
|
(_a = resolutionHost.getCurrentProgram()) == null ? void 0 : _a.getSourceFiles().forEach((f) => {
|
|
@@ -122031,10 +122058,7 @@ ${lanes.join("\n")}
|
|
|
122031
122058
|
return invalidated;
|
|
122032
122059
|
}
|
|
122033
122060
|
invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution) || invalidated;
|
|
122034
|
-
|
|
122035
|
-
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
122036
|
-
packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
|
|
122037
|
-
}
|
|
122061
|
+
invalidatePackageJsonMap();
|
|
122038
122062
|
failedLookupChecks = void 0;
|
|
122039
122063
|
startsWithPathChecks = void 0;
|
|
122040
122064
|
isInDirectoryChecks = void 0;
|
|
@@ -122991,7 +123015,8 @@ ${lanes.join("\n")}
|
|
|
122991
123015
|
if (hasChangedCompilerOptions) {
|
|
122992
123016
|
newLine = updateNewLine();
|
|
122993
123017
|
if (program && changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) {
|
|
122994
|
-
|
|
123018
|
+
debugger;
|
|
123019
|
+
resolutionCache.onChangesAffectModuleResolution();
|
|
122995
123020
|
}
|
|
122996
123021
|
}
|
|
122997
123022
|
const hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions);
|
|
@@ -134809,10 +134834,10 @@ ${lanes.join("\n")}
|
|
|
134809
134834
|
function getSmartSelectionRange2(fileName, position) {
|
|
134810
134835
|
return ts_SmartSelectionRange_exports.getSmartSelectionRange(position, syntaxTreeCache.getCurrentSourceFile(fileName));
|
|
134811
134836
|
}
|
|
134812
|
-
function getApplicableRefactors2(fileName, positionOrRange, preferences = emptyOptions, triggerReason, kind) {
|
|
134837
|
+
function getApplicableRefactors2(fileName, positionOrRange, preferences = emptyOptions, triggerReason, kind, includeInteractiveActions) {
|
|
134813
134838
|
synchronizeHostData();
|
|
134814
134839
|
const file = getValidSourceFile(fileName);
|
|
134815
|
-
return ts_refactor_exports.getApplicableRefactors(getRefactorContext(file, positionOrRange, preferences, emptyOptions, triggerReason, kind));
|
|
134840
|
+
return ts_refactor_exports.getApplicableRefactors(getRefactorContext(file, positionOrRange, preferences, emptyOptions, triggerReason, kind), includeInteractiveActions);
|
|
134816
134841
|
}
|
|
134817
134842
|
function getEditsForRefactor2(fileName, formatOptions, positionOrRange, refactorName13, actionName2, preferences = emptyOptions) {
|
|
134818
134843
|
synchronizeHostData();
|
|
@@ -151174,7 +151199,7 @@ ${lanes.join("\n")}
|
|
|
151174
151199
|
return true;
|
|
151175
151200
|
}
|
|
151176
151201
|
}
|
|
151177
|
-
return isDeclarationName(contextToken2) && !isShorthandPropertyAssignment(contextToken2.parent) && !isJsxAttribute(contextToken2.parent) && !((isClassLike(contextToken2.parent) || isInterfaceDeclaration(contextToken2.parent)) && (contextToken2 !== previousToken || position > previousToken.end));
|
|
151202
|
+
return isDeclarationName(contextToken2) && !isShorthandPropertyAssignment(contextToken2.parent) && !isJsxAttribute(contextToken2.parent) && !((isClassLike(contextToken2.parent) || isInterfaceDeclaration(contextToken2.parent) || isTypeParameterDeclaration(contextToken2.parent)) && (contextToken2 !== previousToken || position > previousToken.end));
|
|
151178
151203
|
}
|
|
151179
151204
|
function isPreviousPropertyDeclarationTerminated(contextToken2, position2) {
|
|
151180
151205
|
return contextToken2.kind !== 64 /* EqualsToken */ && (contextToken2.kind === 27 /* SemicolonToken */ || !positionsAreOnSameLine(contextToken2.end, position2, sourceFile));
|
|
@@ -157532,10 +157557,10 @@ ${lanes.join("\n")}
|
|
|
157532
157557
|
function registerRefactor(name, refactor) {
|
|
157533
157558
|
refactors.set(name, refactor);
|
|
157534
157559
|
}
|
|
157535
|
-
function getApplicableRefactors(context) {
|
|
157560
|
+
function getApplicableRefactors(context, includeInteractiveActions) {
|
|
157536
157561
|
return arrayFrom(flatMapIterator(refactors.values(), (refactor) => {
|
|
157537
157562
|
var _a;
|
|
157538
|
-
return context.cancellationToken && context.cancellationToken.isCancellationRequested() || !((_a = refactor.kinds) == null ? void 0 : _a.some((kind) => refactorKindBeginsWith(kind, context.kind))) ? void 0 : refactor.getAvailableActions(context);
|
|
157563
|
+
return context.cancellationToken && context.cancellationToken.isCancellationRequested() || !((_a = refactor.kinds) == null ? void 0 : _a.some((kind) => refactorKindBeginsWith(kind, context.kind))) ? void 0 : refactor.getAvailableActions(context, includeInteractiveActions);
|
|
157539
157564
|
}));
|
|
157540
157565
|
}
|
|
157541
157566
|
function getEditsForRefactor(context, refactorName13, actionName2) {
|
|
@@ -171307,7 +171332,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171307
171332
|
if (changesAffectModuleResolution(oldOptions, compilerOptions)) {
|
|
171308
171333
|
this.cachedUnresolvedImportsPerFile.clear();
|
|
171309
171334
|
this.lastCachedUnresolvedImportsList = void 0;
|
|
171310
|
-
this.resolutionCache.
|
|
171335
|
+
this.resolutionCache.onChangesAffectModuleResolution();
|
|
171311
171336
|
this.moduleSpecifierCache.clear();
|
|
171312
171337
|
}
|
|
171313
171338
|
this.markAsDirty();
|
|
@@ -171755,13 +171780,18 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171755
171780
|
/*isJsInferredProject*/
|
|
171756
171781
|
true
|
|
171757
171782
|
);
|
|
171783
|
+
} else if (this.isOrphan() && this._isJsInferredProject && !info.isJavaScript()) {
|
|
171784
|
+
this.toggleJsInferredProject(
|
|
171785
|
+
/*isJsInferredProject*/
|
|
171786
|
+
false
|
|
171787
|
+
);
|
|
171758
171788
|
}
|
|
171759
171789
|
super.addRoot(info);
|
|
171760
171790
|
}
|
|
171761
171791
|
removeRoot(info) {
|
|
171762
171792
|
this.projectService.stopWatchingConfigFilesForInferredProjectRoot(info);
|
|
171763
171793
|
super.removeRoot(info);
|
|
171764
|
-
if (this._isJsInferredProject && info.isJavaScript()) {
|
|
171794
|
+
if (!this.isOrphan() && this._isJsInferredProject && info.isJavaScript()) {
|
|
171765
171795
|
if (every(this.getRootScriptInfos(), (rootInfo) => !rootInfo.isJavaScript())) {
|
|
171766
171796
|
this.toggleJsInferredProject(
|
|
171767
171797
|
/*isJsInferredProject*/
|
|
@@ -176958,7 +176988,7 @@ ${json}${newLine}`;
|
|
|
176958
176988
|
}));
|
|
176959
176989
|
this.host = opts.host;
|
|
176960
176990
|
this.cancellationToken = opts.cancellationToken;
|
|
176961
|
-
this.typingsInstaller = opts.typingsInstaller;
|
|
176991
|
+
this.typingsInstaller = opts.typingsInstaller || nullTypingsInstaller;
|
|
176962
176992
|
this.byteLength = opts.byteLength;
|
|
176963
176993
|
this.hrtime = opts.hrtime;
|
|
176964
176994
|
this.logger = opts.logger;
|
package/lib/typescript.d.ts
CHANGED
|
@@ -6198,7 +6198,13 @@ declare namespace ts {
|
|
|
6198
6198
|
applyCodeActionCommand(fileName: string, action: CodeActionCommand[]): Promise<ApplyCodeActionCommandResult[]>;
|
|
6199
6199
|
/** @deprecated `fileName` will be ignored */
|
|
6200
6200
|
applyCodeActionCommand(fileName: string, action: CodeActionCommand | CodeActionCommand[]): Promise<ApplyCodeActionCommandResult | ApplyCodeActionCommandResult[]>;
|
|
6201
|
-
|
|
6201
|
+
/**
|
|
6202
|
+
* @param includeInteractiveActions Include refactor actions that require additional arguments to be
|
|
6203
|
+
* passed when calling `getEditsForRefactor`. When true, clients should inspect the `isInteractive`
|
|
6204
|
+
* property of each returned `RefactorActionInfo` and ensure they are able to collect the appropriate
|
|
6205
|
+
* arguments for any interactive action before offering it.
|
|
6206
|
+
*/
|
|
6207
|
+
getApplicableRefactors(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined, triggerReason?: RefactorTriggerReason, kind?: string, includeInteractiveActions?: boolean): ApplicableRefactorInfo[];
|
|
6202
6208
|
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined): RefactorEditInfo | undefined;
|
|
6203
6209
|
organizeImports(args: OrganizeImportsArgs, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): readonly FileTextChanges[];
|
|
6204
6210
|
getEditsForFileRename(oldFilePath: string, newFilePath: string, formatOptions: FormatCodeSettings, preferences: UserPreferences | undefined): readonly FileTextChanges[];
|
|
@@ -6470,6 +6476,11 @@ declare namespace ts {
|
|
|
6470
6476
|
* The hierarchical dotted name of the refactor action.
|
|
6471
6477
|
*/
|
|
6472
6478
|
kind?: string;
|
|
6479
|
+
/**
|
|
6480
|
+
* Indicates that the action requires additional arguments to be passed
|
|
6481
|
+
* when calling `getEditsForRefactor`.
|
|
6482
|
+
*/
|
|
6483
|
+
isInteractive?: boolean;
|
|
6473
6484
|
}
|
|
6474
6485
|
/**
|
|
6475
6486
|
* A set of edits to make in response to a refactor action, plus an optional
|
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.1";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230420`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -19288,7 +19288,7 @@ ${lanes.join("\n")}
|
|
|
19288
19288
|
supportedTSExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */], [".cts" /* Cts */, ".d.cts" /* Dcts */], [".mts" /* Mts */, ".d.mts" /* Dmts */]];
|
|
19289
19289
|
supportedTSExtensionsFlat = flatten(supportedTSExtensions);
|
|
19290
19290
|
supportedTSExtensionsWithJson = [...supportedTSExtensions, [".json" /* Json */]];
|
|
19291
|
-
supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx
|
|
19291
|
+
supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */];
|
|
19292
19292
|
supportedJSExtensions = [[".js" /* Js */, ".jsx" /* Jsx */], [".mjs" /* Mjs */], [".cjs" /* Cjs */]];
|
|
19293
19293
|
supportedJSExtensionsFlat = flatten(supportedJSExtensions);
|
|
19294
19294
|
allSupportedExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */, ".js" /* Js */, ".jsx" /* Jsx */], [".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */], [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */]];
|
|
@@ -113561,7 +113561,7 @@ ${lanes.join("\n")}
|
|
|
113561
113561
|
}
|
|
113562
113562
|
}
|
|
113563
113563
|
function emitEmbeddedStatement(parent2, node) {
|
|
113564
|
-
if (isBlock(node) || getEmitFlags(parent2) & 1 /* SingleLine */) {
|
|
113564
|
+
if (isBlock(node) || getEmitFlags(parent2) & 1 /* SingleLine */ || preserveSourceNewlines && !getLeadingLineTerminatorCount(parent2, node, 0 /* None */)) {
|
|
113565
113565
|
writeSpace();
|
|
113566
113566
|
emit(node);
|
|
113567
113567
|
} else {
|
|
@@ -116422,7 +116422,7 @@ ${lanes.join("\n")}
|
|
|
116422
116422
|
automaticTypeDirectiveResolutions = createModeAwareCache();
|
|
116423
116423
|
if (automaticTypeDirectiveNames.length) {
|
|
116424
116424
|
(_k = tracing) == null ? void 0 : _k.push(tracing.Phase.Program, "processTypeReferences", { count: automaticTypeDirectiveNames.length });
|
|
116425
|
-
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) :
|
|
116425
|
+
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
116426
116426
|
const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile);
|
|
116427
116427
|
const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(automaticTypeDirectiveNames, containingFilename);
|
|
116428
116428
|
for (let i = 0; i < automaticTypeDirectiveNames.length; i++) {
|
|
@@ -118213,8 +118213,9 @@ ${lanes.join("\n")}
|
|
|
118213
118213
|
path += (i === 2 ? "/" : "-") + components[i];
|
|
118214
118214
|
i++;
|
|
118215
118215
|
}
|
|
118216
|
-
const
|
|
118217
|
-
const
|
|
118216
|
+
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
118217
|
+
const resolveFrom = combinePaths(containingDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`);
|
|
118218
|
+
const localOverrideModuleResult = resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: 2 /* Node10 */, traceResolution: options.traceResolution }, host, moduleResolutionCache);
|
|
118218
118219
|
if (localOverrideModuleResult == null ? void 0 : localOverrideModuleResult.resolvedModule) {
|
|
118219
118220
|
return localOverrideModuleResult.resolvedModule.resolvedFileName;
|
|
118220
118221
|
}
|
|
@@ -118349,7 +118350,7 @@ ${lanes.join("\n")}
|
|
|
118349
118350
|
void 0
|
|
118350
118351
|
);
|
|
118351
118352
|
} else {
|
|
118352
|
-
const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath),
|
|
118353
|
+
const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath), currentDirectory);
|
|
118353
118354
|
sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
|
|
118354
118355
|
addFileToFilesByName(
|
|
118355
118356
|
sourceFile,
|
|
@@ -121380,6 +121381,7 @@ ${lanes.join("\n")}
|
|
|
121380
121381
|
let failedLookupChecks;
|
|
121381
121382
|
let startsWithPathChecks;
|
|
121382
121383
|
let isInDirectoryChecks;
|
|
121384
|
+
let allResolutionsAreInvalidated = false;
|
|
121383
121385
|
const getCurrentDirectory = memoize(() => resolutionHost.getCurrentDirectory());
|
|
121384
121386
|
const cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
|
|
121385
121387
|
const resolvedModuleNames = /* @__PURE__ */ new Map();
|
|
@@ -121422,7 +121424,8 @@ ${lanes.join("\n")}
|
|
|
121422
121424
|
isFileWithInvalidatedNonRelativeUnresolvedImports,
|
|
121423
121425
|
updateTypeRootsWatch,
|
|
121424
121426
|
closeTypeRootsWatch,
|
|
121425
|
-
clear: clear2
|
|
121427
|
+
clear: clear2,
|
|
121428
|
+
onChangesAffectModuleResolution
|
|
121426
121429
|
};
|
|
121427
121430
|
function getResolvedModule2(resolution) {
|
|
121428
121431
|
return resolution.resolvedModule;
|
|
@@ -121445,6 +121448,7 @@ ${lanes.join("\n")}
|
|
|
121445
121448
|
isInDirectoryChecks = void 0;
|
|
121446
121449
|
affectingPathChecks = void 0;
|
|
121447
121450
|
affectingPathChecksForFile = void 0;
|
|
121451
|
+
allResolutionsAreInvalidated = false;
|
|
121448
121452
|
moduleResolutionCache.clear();
|
|
121449
121453
|
typeReferenceDirectiveResolutionCache.clear();
|
|
121450
121454
|
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
@@ -121452,6 +121456,13 @@ ${lanes.join("\n")}
|
|
|
121452
121456
|
impliedFormatPackageJsons.clear();
|
|
121453
121457
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
121454
121458
|
}
|
|
121459
|
+
function onChangesAffectModuleResolution() {
|
|
121460
|
+
allResolutionsAreInvalidated = true;
|
|
121461
|
+
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
121462
|
+
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
121463
|
+
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
121464
|
+
typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
121465
|
+
}
|
|
121455
121466
|
function startRecordingFilesWithChangedResolutions() {
|
|
121456
121467
|
filesWithChangedSetOfUnresolvedImports = [];
|
|
121457
121468
|
}
|
|
@@ -121471,7 +121482,7 @@ ${lanes.join("\n")}
|
|
|
121471
121482
|
invalidateResolutionsOfFailedLookupLocations();
|
|
121472
121483
|
const collected = filesWithInvalidatedResolutions;
|
|
121473
121484
|
filesWithInvalidatedResolutions = void 0;
|
|
121474
|
-
return (path) => customHasInvalidatedResolutions(path) || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
121485
|
+
return (path) => customHasInvalidatedResolutions(path) || allResolutionsAreInvalidated || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
121475
121486
|
}
|
|
121476
121487
|
function startCachingPerDirectoryResolution() {
|
|
121477
121488
|
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
@@ -121481,6 +121492,7 @@ ${lanes.join("\n")}
|
|
|
121481
121492
|
}
|
|
121482
121493
|
function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
|
|
121483
121494
|
filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
|
|
121495
|
+
allResolutionsAreInvalidated = false;
|
|
121484
121496
|
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
121485
121497
|
nonRelativeExternalModuleResolutions.clear();
|
|
121486
121498
|
if (newProgram !== oldProgram) {
|
|
@@ -121592,8 +121604,8 @@ ${lanes.join("\n")}
|
|
|
121592
121604
|
const name = loader.nameAndMode.getName(entry);
|
|
121593
121605
|
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
121594
121606
|
let resolution = resolutionsInFile.get(name, mode);
|
|
121595
|
-
if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
121596
|
-
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) {
|
|
121607
|
+
if (!seenNamesInFile.has(name, mode) && (allResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
121608
|
+
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
121597
121609
|
const existingResolution = resolution;
|
|
121598
121610
|
resolution = loader.resolve(name, mode);
|
|
121599
121611
|
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
@@ -122015,8 +122027,23 @@ ${lanes.join("\n")}
|
|
|
122015
122027
|
}
|
|
122016
122028
|
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
122017
122029
|
}
|
|
122030
|
+
function invalidatePackageJsonMap() {
|
|
122031
|
+
const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
|
|
122032
|
+
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
122033
|
+
packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
|
|
122034
|
+
}
|
|
122035
|
+
}
|
|
122018
122036
|
function invalidateResolutionsOfFailedLookupLocations() {
|
|
122019
122037
|
var _a;
|
|
122038
|
+
if (allResolutionsAreInvalidated) {
|
|
122039
|
+
affectingPathChecksForFile = void 0;
|
|
122040
|
+
invalidatePackageJsonMap();
|
|
122041
|
+
failedLookupChecks = void 0;
|
|
122042
|
+
startsWithPathChecks = void 0;
|
|
122043
|
+
isInDirectoryChecks = void 0;
|
|
122044
|
+
affectingPathChecks = void 0;
|
|
122045
|
+
return true;
|
|
122046
|
+
}
|
|
122020
122047
|
let invalidated = false;
|
|
122021
122048
|
if (affectingPathChecksForFile) {
|
|
122022
122049
|
(_a = resolutionHost.getCurrentProgram()) == null ? void 0 : _a.getSourceFiles().forEach((f) => {
|
|
@@ -122031,10 +122058,7 @@ ${lanes.join("\n")}
|
|
|
122031
122058
|
return invalidated;
|
|
122032
122059
|
}
|
|
122033
122060
|
invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution) || invalidated;
|
|
122034
|
-
|
|
122035
|
-
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
122036
|
-
packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
|
|
122037
|
-
}
|
|
122061
|
+
invalidatePackageJsonMap();
|
|
122038
122062
|
failedLookupChecks = void 0;
|
|
122039
122063
|
startsWithPathChecks = void 0;
|
|
122040
122064
|
isInDirectoryChecks = void 0;
|
|
@@ -122991,7 +123015,8 @@ ${lanes.join("\n")}
|
|
|
122991
123015
|
if (hasChangedCompilerOptions) {
|
|
122992
123016
|
newLine = updateNewLine();
|
|
122993
123017
|
if (program && changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) {
|
|
122994
|
-
|
|
123018
|
+
debugger;
|
|
123019
|
+
resolutionCache.onChangesAffectModuleResolution();
|
|
122995
123020
|
}
|
|
122996
123021
|
}
|
|
122997
123022
|
const hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions);
|
|
@@ -134823,10 +134848,10 @@ ${lanes.join("\n")}
|
|
|
134823
134848
|
function getSmartSelectionRange2(fileName, position) {
|
|
134824
134849
|
return ts_SmartSelectionRange_exports.getSmartSelectionRange(position, syntaxTreeCache.getCurrentSourceFile(fileName));
|
|
134825
134850
|
}
|
|
134826
|
-
function getApplicableRefactors2(fileName, positionOrRange, preferences = emptyOptions, triggerReason, kind) {
|
|
134851
|
+
function getApplicableRefactors2(fileName, positionOrRange, preferences = emptyOptions, triggerReason, kind, includeInteractiveActions) {
|
|
134827
134852
|
synchronizeHostData();
|
|
134828
134853
|
const file = getValidSourceFile(fileName);
|
|
134829
|
-
return ts_refactor_exports.getApplicableRefactors(getRefactorContext(file, positionOrRange, preferences, emptyOptions, triggerReason, kind));
|
|
134854
|
+
return ts_refactor_exports.getApplicableRefactors(getRefactorContext(file, positionOrRange, preferences, emptyOptions, triggerReason, kind), includeInteractiveActions);
|
|
134830
134855
|
}
|
|
134831
134856
|
function getEditsForRefactor2(fileName, formatOptions, positionOrRange, refactorName13, actionName2, preferences = emptyOptions) {
|
|
134832
134857
|
synchronizeHostData();
|
|
@@ -151188,7 +151213,7 @@ ${lanes.join("\n")}
|
|
|
151188
151213
|
return true;
|
|
151189
151214
|
}
|
|
151190
151215
|
}
|
|
151191
|
-
return isDeclarationName(contextToken2) && !isShorthandPropertyAssignment(contextToken2.parent) && !isJsxAttribute(contextToken2.parent) && !((isClassLike(contextToken2.parent) || isInterfaceDeclaration(contextToken2.parent)) && (contextToken2 !== previousToken || position > previousToken.end));
|
|
151216
|
+
return isDeclarationName(contextToken2) && !isShorthandPropertyAssignment(contextToken2.parent) && !isJsxAttribute(contextToken2.parent) && !((isClassLike(contextToken2.parent) || isInterfaceDeclaration(contextToken2.parent) || isTypeParameterDeclaration(contextToken2.parent)) && (contextToken2 !== previousToken || position > previousToken.end));
|
|
151192
151217
|
}
|
|
151193
151218
|
function isPreviousPropertyDeclarationTerminated(contextToken2, position2) {
|
|
151194
151219
|
return contextToken2.kind !== 64 /* EqualsToken */ && (contextToken2.kind === 27 /* SemicolonToken */ || !positionsAreOnSameLine(contextToken2.end, position2, sourceFile));
|
|
@@ -157546,10 +157571,10 @@ ${lanes.join("\n")}
|
|
|
157546
157571
|
function registerRefactor(name, refactor) {
|
|
157547
157572
|
refactors.set(name, refactor);
|
|
157548
157573
|
}
|
|
157549
|
-
function getApplicableRefactors(context) {
|
|
157574
|
+
function getApplicableRefactors(context, includeInteractiveActions) {
|
|
157550
157575
|
return arrayFrom(flatMapIterator(refactors.values(), (refactor) => {
|
|
157551
157576
|
var _a;
|
|
157552
|
-
return context.cancellationToken && context.cancellationToken.isCancellationRequested() || !((_a = refactor.kinds) == null ? void 0 : _a.some((kind) => refactorKindBeginsWith(kind, context.kind))) ? void 0 : refactor.getAvailableActions(context);
|
|
157577
|
+
return context.cancellationToken && context.cancellationToken.isCancellationRequested() || !((_a = refactor.kinds) == null ? void 0 : _a.some((kind) => refactorKindBeginsWith(kind, context.kind))) ? void 0 : refactor.getAvailableActions(context, includeInteractiveActions);
|
|
157553
157578
|
}));
|
|
157554
157579
|
}
|
|
157555
157580
|
function getEditsForRefactor(context, refactorName13, actionName2) {
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.1";
|
|
57
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
57
|
+
var version = `${versionMajorMinor}.0-dev.20230420`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -11483,7 +11483,7 @@ function getScriptKindFromFileName(fileName) {
|
|
|
11483
11483
|
var supportedTSExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */], [".cts" /* Cts */, ".d.cts" /* Dcts */], [".mts" /* Mts */, ".d.mts" /* Dmts */]];
|
|
11484
11484
|
var supportedTSExtensionsFlat = flatten(supportedTSExtensions);
|
|
11485
11485
|
var supportedTSExtensionsWithJson = [...supportedTSExtensions, [".json" /* Json */]];
|
|
11486
|
-
var supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx
|
|
11486
|
+
var supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */];
|
|
11487
11487
|
var supportedJSExtensions = [[".js" /* Js */, ".jsx" /* Jsx */], [".mjs" /* Mjs */], [".cjs" /* Cjs */]];
|
|
11488
11488
|
var supportedJSExtensionsFlat = flatten(supportedJSExtensions);
|
|
11489
11489
|
var allSupportedExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */, ".js" /* Js */, ".jsx" /* Jsx */], [".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */], [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */]];
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.1.0-dev.
|
|
5
|
+
"version": "5.1.0-dev.20230420",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"node": "14.21.1",
|
|
114
114
|
"npm": "8.19.3"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "484994735758d34da8e8259d1371c20f8de26a4f"
|
|
117
117
|
}
|