typescript 5.5.0-dev.20240418 → 5.5.0-dev.20240419
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.es2021.weakref.d.ts +1 -1
- package/lib/tsc.js +74 -16
- package/lib/typescript.js +158 -46
- package/package.json +2 -3
|
@@ -60,7 +60,7 @@ interface FinalizationRegistry<T> {
|
|
|
60
60
|
* @param unregisterToken The token that was used as the unregisterToken argument when calling
|
|
61
61
|
* register to register the target value.
|
|
62
62
|
*/
|
|
63
|
-
unregister(unregisterToken: WeakKey):
|
|
63
|
+
unregister(unregisterToken: WeakKey): boolean;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
interface FinalizationRegistryConstructor {
|
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.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240419`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -16793,8 +16793,15 @@ function createSymlinkCache(cwd, getCanonicalFileName) {
|
|
|
16793
16793
|
forEachResolvedTypeReferenceDirective((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
16794
16794
|
typeReferenceDirectives.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
16795
16795
|
},
|
|
16796
|
-
hasProcessedResolutions: () => hasProcessedResolutions
|
|
16796
|
+
hasProcessedResolutions: () => hasProcessedResolutions,
|
|
16797
|
+
setSymlinksFromResolution(resolution) {
|
|
16798
|
+
processResolution(this, resolution);
|
|
16799
|
+
},
|
|
16800
|
+
hasAnySymlinks
|
|
16797
16801
|
};
|
|
16802
|
+
function hasAnySymlinks() {
|
|
16803
|
+
return !!(symlinkedFiles == null ? void 0 : symlinkedFiles.size) || !!symlinkedDirectories && !!forEachEntry(symlinkedDirectories, (value) => !!value);
|
|
16804
|
+
}
|
|
16798
16805
|
function processResolution(cache, resolution) {
|
|
16799
16806
|
if (!resolution || !resolution.originalPath || !resolution.resolvedFileName)
|
|
16800
16807
|
return;
|
|
@@ -27336,7 +27343,7 @@ var Parser;
|
|
|
27336
27343
|
function currentNode2(position) {
|
|
27337
27344
|
const node = baseSyntaxCursor.currentNode(position);
|
|
27338
27345
|
if (topLevel && node && containsPossibleTopLevelAwait(node)) {
|
|
27339
|
-
node
|
|
27346
|
+
markAsIntersectingIncrementalChange(node);
|
|
27340
27347
|
}
|
|
27341
27348
|
return node;
|
|
27342
27349
|
}
|
|
@@ -28206,7 +28213,7 @@ var Parser;
|
|
|
28206
28213
|
return void 0;
|
|
28207
28214
|
}
|
|
28208
28215
|
const node = syntaxCursor.currentNode(pos ?? scanner.getTokenFullStart());
|
|
28209
|
-
if (nodeIsMissing(node) || node
|
|
28216
|
+
if (nodeIsMissing(node) || intersectsIncrementalChange(node) || containsParseError(node)) {
|
|
28210
28217
|
return void 0;
|
|
28211
28218
|
}
|
|
28212
28219
|
const nodeContextFlags = node.flags & 101441536 /* ContextFlags */;
|
|
@@ -33721,6 +33728,20 @@ var Parser;
|
|
|
33721
33728
|
}
|
|
33722
33729
|
})(JSDocParser = Parser2.JSDocParser || (Parser2.JSDocParser = {}));
|
|
33723
33730
|
})(Parser || (Parser = {}));
|
|
33731
|
+
var incrementallyParsedFiles = /* @__PURE__ */ new WeakSet();
|
|
33732
|
+
function markAsIncrementallyParsed(sourceFile) {
|
|
33733
|
+
if (incrementallyParsedFiles.has(sourceFile)) {
|
|
33734
|
+
Debug.fail("Source file has already been incrementally parsed");
|
|
33735
|
+
}
|
|
33736
|
+
incrementallyParsedFiles.add(sourceFile);
|
|
33737
|
+
}
|
|
33738
|
+
var intersectingChangeSet = /* @__PURE__ */ new WeakSet();
|
|
33739
|
+
function intersectsIncrementalChange(node) {
|
|
33740
|
+
return intersectingChangeSet.has(node);
|
|
33741
|
+
}
|
|
33742
|
+
function markAsIntersectingIncrementalChange(node) {
|
|
33743
|
+
intersectingChangeSet.add(node);
|
|
33744
|
+
}
|
|
33724
33745
|
var IncrementalParser;
|
|
33725
33746
|
((IncrementalParser2) => {
|
|
33726
33747
|
function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) {
|
|
@@ -33743,10 +33764,8 @@ var IncrementalParser;
|
|
|
33743
33764
|
sourceFile.jsDocParsingMode
|
|
33744
33765
|
);
|
|
33745
33766
|
}
|
|
33746
|
-
|
|
33747
|
-
|
|
33748
|
-
incrementalSourceFile.hasBeenIncrementallyParsed = true;
|
|
33749
|
-
Parser.fixupParentReferences(incrementalSourceFile);
|
|
33767
|
+
markAsIncrementallyParsed(sourceFile);
|
|
33768
|
+
Parser.fixupParentReferences(sourceFile);
|
|
33750
33769
|
const oldText = sourceFile.text;
|
|
33751
33770
|
const syntaxCursor = createSyntaxCursor(sourceFile);
|
|
33752
33771
|
const changeRange = extendToAffectedRange(sourceFile, textChangeRange);
|
|
@@ -33755,7 +33774,7 @@ var IncrementalParser;
|
|
|
33755
33774
|
Debug.assert(textSpanEnd(changeRange.span) === textSpanEnd(textChangeRange.span));
|
|
33756
33775
|
Debug.assert(textSpanEnd(textChangeRangeNewSpan(changeRange)) === textSpanEnd(textChangeRangeNewSpan(textChangeRange)));
|
|
33757
33776
|
const delta = textChangeRangeNewSpan(changeRange).length - changeRange.span.length;
|
|
33758
|
-
updateTokenPositionsAndMarkElements(
|
|
33777
|
+
updateTokenPositionsAndMarkElements(sourceFile, changeRange.span.start, textSpanEnd(changeRange.span), textSpanEnd(textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks);
|
|
33759
33778
|
const result = Parser.parseSourceFile(
|
|
33760
33779
|
sourceFile.fileName,
|
|
33761
33780
|
newText,
|
|
@@ -33871,8 +33890,9 @@ var IncrementalParser;
|
|
|
33871
33890
|
);
|
|
33872
33891
|
Debug.assert(pos <= end);
|
|
33873
33892
|
if (element.parent) {
|
|
33874
|
-
|
|
33875
|
-
Debug.
|
|
33893
|
+
const parent = element.parent;
|
|
33894
|
+
Debug.assertGreaterThanOrEqual(pos, parent.pos);
|
|
33895
|
+
Debug.assertLessThanOrEqual(end, parent.end);
|
|
33876
33896
|
}
|
|
33877
33897
|
setTextRangePosEnd(element, pos, end);
|
|
33878
33898
|
}
|
|
@@ -33911,7 +33931,7 @@ var IncrementalParser;
|
|
|
33911
33931
|
}
|
|
33912
33932
|
const fullEnd = child.end;
|
|
33913
33933
|
if (fullEnd >= changeStart) {
|
|
33914
|
-
child
|
|
33934
|
+
markAsIntersectingIncrementalChange(child);
|
|
33915
33935
|
unsetNodeChildren(child);
|
|
33916
33936
|
adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
|
|
33917
33937
|
forEachChild(child, visitNode3, visitArray2);
|
|
@@ -33941,7 +33961,7 @@ var IncrementalParser;
|
|
|
33941
33961
|
}
|
|
33942
33962
|
const fullEnd = array.end;
|
|
33943
33963
|
if (fullEnd >= changeStart) {
|
|
33944
|
-
array
|
|
33964
|
+
markAsIntersectingIncrementalChange(array);
|
|
33945
33965
|
adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
|
|
33946
33966
|
for (const node of array) {
|
|
33947
33967
|
visitNode3(node);
|
|
@@ -43280,7 +43300,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
|
|
|
43280
43300
|
if (!moduleSourceFile)
|
|
43281
43301
|
return { moduleSpecifiers: emptyArray, computedWithoutCache };
|
|
43282
43302
|
computedWithoutCache = true;
|
|
43283
|
-
modulePaths || (modulePaths = getAllModulePathsWorker(getInfo(importingSourceFile.fileName, host), moduleSourceFile.originalFileName, host));
|
|
43303
|
+
modulePaths || (modulePaths = getAllModulePathsWorker(getInfo(importingSourceFile.fileName, host), moduleSourceFile.originalFileName, host, compilerOptions, options));
|
|
43284
43304
|
const result = computeModuleSpecifiers(
|
|
43285
43305
|
modulePaths,
|
|
43286
43306
|
compilerOptions,
|
|
@@ -43487,7 +43507,42 @@ function forEachFileNameOfModule(importingFileName, importedFileName, host, pref
|
|
|
43487
43507
|
});
|
|
43488
43508
|
return result || (preferSymlinks ? forEach(targets, (p) => shouldFilterIgnoredPaths && containsIgnoredPath(p) ? void 0 : cb(p, p === referenceRedirect)) : void 0);
|
|
43489
43509
|
}
|
|
43490
|
-
|
|
43510
|
+
var runtimeDependencyFields = ["dependencies", "peerDependencies", "optionalDependencies"];
|
|
43511
|
+
function getAllRuntimeDependencies(packageJson) {
|
|
43512
|
+
let result;
|
|
43513
|
+
for (const field of runtimeDependencyFields) {
|
|
43514
|
+
const deps = packageJson[field];
|
|
43515
|
+
if (deps && typeof deps === "object") {
|
|
43516
|
+
result = concatenate(result, getOwnKeys(deps));
|
|
43517
|
+
}
|
|
43518
|
+
}
|
|
43519
|
+
return result;
|
|
43520
|
+
}
|
|
43521
|
+
function getAllModulePathsWorker(info, importedFileName, host, compilerOptions, options) {
|
|
43522
|
+
var _a, _b;
|
|
43523
|
+
const cache = (_a = host.getModuleResolutionCache) == null ? void 0 : _a.call(host);
|
|
43524
|
+
const links = (_b = host.getSymlinkCache) == null ? void 0 : _b.call(host);
|
|
43525
|
+
if (cache && links && host.readFile && !pathContainsNodeModules(info.importingSourceFileName)) {
|
|
43526
|
+
Debug.type(host);
|
|
43527
|
+
const state = getTemporaryModuleResolutionState(cache.getPackageJsonInfoCache(), host, {});
|
|
43528
|
+
const packageJson = getPackageScopeForPath(info.importingSourceFileName, state);
|
|
43529
|
+
if (packageJson) {
|
|
43530
|
+
const toResolve = getAllRuntimeDependencies(packageJson.contents.packageJsonContent);
|
|
43531
|
+
for (const depName of toResolve || emptyArray) {
|
|
43532
|
+
const resolved = resolveModuleName(
|
|
43533
|
+
depName,
|
|
43534
|
+
combinePaths(packageJson.packageDirectory, "package.json"),
|
|
43535
|
+
compilerOptions,
|
|
43536
|
+
host,
|
|
43537
|
+
cache,
|
|
43538
|
+
/*redirectedReference*/
|
|
43539
|
+
void 0,
|
|
43540
|
+
options.overrideImportMode
|
|
43541
|
+
);
|
|
43542
|
+
links.setSymlinksFromResolution(resolved.resolvedModule);
|
|
43543
|
+
}
|
|
43544
|
+
}
|
|
43545
|
+
}
|
|
43491
43546
|
const allFileNames = /* @__PURE__ */ new Map();
|
|
43492
43547
|
let importedFileFromNodeModules = false;
|
|
43493
43548
|
forEachFileNameOfModule(
|
|
@@ -118292,6 +118347,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118292
118347
|
return false;
|
|
118293
118348
|
return host.fileExists(f);
|
|
118294
118349
|
},
|
|
118350
|
+
realpath: maybeBind(host, host.realpath),
|
|
118295
118351
|
useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(),
|
|
118296
118352
|
getBuildInfo: () => {
|
|
118297
118353
|
var _a2;
|
|
@@ -118300,7 +118356,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118300
118356
|
getSourceFileFromReference: (file, ref) => program.getSourceFileFromReference(file, ref),
|
|
118301
118357
|
redirectTargetsMap,
|
|
118302
118358
|
getFileIncludeReasons: program.getFileIncludeReasons,
|
|
118303
|
-
createHash: maybeBind(host, host.createHash)
|
|
118359
|
+
createHash: maybeBind(host, host.createHash),
|
|
118360
|
+
getModuleResolutionCache: () => program.getModuleResolutionCache(),
|
|
118361
|
+
trace: maybeBind(host, host.trace)
|
|
118304
118362
|
};
|
|
118305
118363
|
}
|
|
118306
118364
|
function writeFile2(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
|
package/lib/typescript.js
CHANGED
|
@@ -2350,7 +2350,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2350
2350
|
|
|
2351
2351
|
// src/compiler/corePublic.ts
|
|
2352
2352
|
var versionMajorMinor = "5.5";
|
|
2353
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2353
|
+
var version = `${versionMajorMinor}.0-dev.20240419`;
|
|
2354
2354
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2355
2355
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2356
2356
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -21004,8 +21004,15 @@ function createSymlinkCache(cwd, getCanonicalFileName) {
|
|
|
21004
21004
|
forEachResolvedTypeReferenceDirective((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
21005
21005
|
typeReferenceDirectives.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
21006
21006
|
},
|
|
21007
|
-
hasProcessedResolutions: () => hasProcessedResolutions
|
|
21007
|
+
hasProcessedResolutions: () => hasProcessedResolutions,
|
|
21008
|
+
setSymlinksFromResolution(resolution) {
|
|
21009
|
+
processResolution(this, resolution);
|
|
21010
|
+
},
|
|
21011
|
+
hasAnySymlinks
|
|
21008
21012
|
};
|
|
21013
|
+
function hasAnySymlinks() {
|
|
21014
|
+
return !!(symlinkedFiles == null ? void 0 : symlinkedFiles.size) || !!symlinkedDirectories && !!forEachEntry(symlinkedDirectories, (value) => !!value);
|
|
21015
|
+
}
|
|
21009
21016
|
function processResolution(cache, resolution) {
|
|
21010
21017
|
if (!resolution || !resolution.originalPath || !resolution.resolvedFileName)
|
|
21011
21018
|
return;
|
|
@@ -31782,7 +31789,7 @@ var Parser;
|
|
|
31782
31789
|
function currentNode2(position) {
|
|
31783
31790
|
const node = baseSyntaxCursor.currentNode(position);
|
|
31784
31791
|
if (topLevel && node && containsPossibleTopLevelAwait(node)) {
|
|
31785
|
-
node
|
|
31792
|
+
markAsIntersectingIncrementalChange(node);
|
|
31786
31793
|
}
|
|
31787
31794
|
return node;
|
|
31788
31795
|
}
|
|
@@ -32652,7 +32659,7 @@ var Parser;
|
|
|
32652
32659
|
return void 0;
|
|
32653
32660
|
}
|
|
32654
32661
|
const node = syntaxCursor.currentNode(pos ?? scanner2.getTokenFullStart());
|
|
32655
|
-
if (nodeIsMissing(node) || node
|
|
32662
|
+
if (nodeIsMissing(node) || intersectsIncrementalChange(node) || containsParseError(node)) {
|
|
32656
32663
|
return void 0;
|
|
32657
32664
|
}
|
|
32658
32665
|
const nodeContextFlags = node.flags & 101441536 /* ContextFlags */;
|
|
@@ -38167,6 +38174,20 @@ var Parser;
|
|
|
38167
38174
|
}
|
|
38168
38175
|
})(JSDocParser = Parser2.JSDocParser || (Parser2.JSDocParser = {}));
|
|
38169
38176
|
})(Parser || (Parser = {}));
|
|
38177
|
+
var incrementallyParsedFiles = /* @__PURE__ */ new WeakSet();
|
|
38178
|
+
function markAsIncrementallyParsed(sourceFile) {
|
|
38179
|
+
if (incrementallyParsedFiles.has(sourceFile)) {
|
|
38180
|
+
Debug.fail("Source file has already been incrementally parsed");
|
|
38181
|
+
}
|
|
38182
|
+
incrementallyParsedFiles.add(sourceFile);
|
|
38183
|
+
}
|
|
38184
|
+
var intersectingChangeSet = /* @__PURE__ */ new WeakSet();
|
|
38185
|
+
function intersectsIncrementalChange(node) {
|
|
38186
|
+
return intersectingChangeSet.has(node);
|
|
38187
|
+
}
|
|
38188
|
+
function markAsIntersectingIncrementalChange(node) {
|
|
38189
|
+
intersectingChangeSet.add(node);
|
|
38190
|
+
}
|
|
38170
38191
|
var IncrementalParser;
|
|
38171
38192
|
((IncrementalParser2) => {
|
|
38172
38193
|
function updateSourceFile2(sourceFile, newText, textChangeRange, aggressiveChecks) {
|
|
@@ -38189,10 +38210,8 @@ var IncrementalParser;
|
|
|
38189
38210
|
sourceFile.jsDocParsingMode
|
|
38190
38211
|
);
|
|
38191
38212
|
}
|
|
38192
|
-
|
|
38193
|
-
|
|
38194
|
-
incrementalSourceFile.hasBeenIncrementallyParsed = true;
|
|
38195
|
-
Parser.fixupParentReferences(incrementalSourceFile);
|
|
38213
|
+
markAsIncrementallyParsed(sourceFile);
|
|
38214
|
+
Parser.fixupParentReferences(sourceFile);
|
|
38196
38215
|
const oldText = sourceFile.text;
|
|
38197
38216
|
const syntaxCursor = createSyntaxCursor(sourceFile);
|
|
38198
38217
|
const changeRange = extendToAffectedRange(sourceFile, textChangeRange);
|
|
@@ -38201,7 +38220,7 @@ var IncrementalParser;
|
|
|
38201
38220
|
Debug.assert(textSpanEnd(changeRange.span) === textSpanEnd(textChangeRange.span));
|
|
38202
38221
|
Debug.assert(textSpanEnd(textChangeRangeNewSpan(changeRange)) === textSpanEnd(textChangeRangeNewSpan(textChangeRange)));
|
|
38203
38222
|
const delta = textChangeRangeNewSpan(changeRange).length - changeRange.span.length;
|
|
38204
|
-
updateTokenPositionsAndMarkElements(
|
|
38223
|
+
updateTokenPositionsAndMarkElements(sourceFile, changeRange.span.start, textSpanEnd(changeRange.span), textSpanEnd(textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks);
|
|
38205
38224
|
const result = Parser.parseSourceFile(
|
|
38206
38225
|
sourceFile.fileName,
|
|
38207
38226
|
newText,
|
|
@@ -38317,8 +38336,9 @@ var IncrementalParser;
|
|
|
38317
38336
|
);
|
|
38318
38337
|
Debug.assert(pos <= end);
|
|
38319
38338
|
if (element.parent) {
|
|
38320
|
-
|
|
38321
|
-
Debug.
|
|
38339
|
+
const parent2 = element.parent;
|
|
38340
|
+
Debug.assertGreaterThanOrEqual(pos, parent2.pos);
|
|
38341
|
+
Debug.assertLessThanOrEqual(end, parent2.end);
|
|
38322
38342
|
}
|
|
38323
38343
|
setTextRangePosEnd(element, pos, end);
|
|
38324
38344
|
}
|
|
@@ -38357,7 +38377,7 @@ var IncrementalParser;
|
|
|
38357
38377
|
}
|
|
38358
38378
|
const fullEnd = child.end;
|
|
38359
38379
|
if (fullEnd >= changeStart) {
|
|
38360
|
-
child
|
|
38380
|
+
markAsIntersectingIncrementalChange(child);
|
|
38361
38381
|
unsetNodeChildren(child);
|
|
38362
38382
|
adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
|
|
38363
38383
|
forEachChild(child, visitNode3, visitArray2);
|
|
@@ -38387,7 +38407,7 @@ var IncrementalParser;
|
|
|
38387
38407
|
}
|
|
38388
38408
|
const fullEnd = array.end;
|
|
38389
38409
|
if (fullEnd >= changeStart) {
|
|
38390
|
-
array
|
|
38410
|
+
markAsIntersectingIncrementalChange(array);
|
|
38391
38411
|
adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
|
|
38392
38412
|
for (const node of array) {
|
|
38393
38413
|
visitNode3(node);
|
|
@@ -47977,7 +47997,7 @@ function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourc
|
|
|
47977
47997
|
}
|
|
47978
47998
|
function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeModulesFileName, host, preferences, options = {}) {
|
|
47979
47999
|
const info = getInfo(importingSourceFile.fileName, host);
|
|
47980
|
-
const modulePaths = getAllModulePaths(info, nodeModulesFileName, host, preferences, options);
|
|
48000
|
+
const modulePaths = getAllModulePaths(info, nodeModulesFileName, host, preferences, compilerOptions, options);
|
|
47981
48001
|
return firstDefined(modulePaths, (modulePath) => tryGetModuleNameAsNodeModule(
|
|
47982
48002
|
modulePath,
|
|
47983
48003
|
info,
|
|
@@ -47992,7 +48012,7 @@ function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeMod
|
|
|
47992
48012
|
}
|
|
47993
48013
|
function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, preferences, userPreferences, options = {}) {
|
|
47994
48014
|
const info = getInfo(importingSourceFileName, host);
|
|
47995
|
-
const modulePaths = getAllModulePaths(info, toFileName2, host, userPreferences, options);
|
|
48015
|
+
const modulePaths = getAllModulePaths(info, toFileName2, host, userPreferences, compilerOptions, options);
|
|
47996
48016
|
return firstDefined(modulePaths, (modulePath) => tryGetModuleNameAsNodeModule(
|
|
47997
48017
|
modulePath,
|
|
47998
48018
|
info,
|
|
@@ -48054,7 +48074,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
|
|
|
48054
48074
|
if (!moduleSourceFile)
|
|
48055
48075
|
return { moduleSpecifiers: emptyArray, computedWithoutCache };
|
|
48056
48076
|
computedWithoutCache = true;
|
|
48057
|
-
modulePaths || (modulePaths = getAllModulePathsWorker(getInfo(importingSourceFile.fileName, host), moduleSourceFile.originalFileName, host));
|
|
48077
|
+
modulePaths || (modulePaths = getAllModulePathsWorker(getInfo(importingSourceFile.fileName, host), moduleSourceFile.originalFileName, host, compilerOptions, options));
|
|
48058
48078
|
const result = computeModuleSpecifiers(
|
|
48059
48079
|
modulePaths,
|
|
48060
48080
|
compilerOptions,
|
|
@@ -48273,7 +48293,7 @@ function forEachFileNameOfModule(importingFileName, importedFileName, host, pref
|
|
|
48273
48293
|
});
|
|
48274
48294
|
return result || (preferSymlinks ? forEach(targets, (p) => shouldFilterIgnoredPaths && containsIgnoredPath(p) ? void 0 : cb(p, p === referenceRedirect)) : void 0);
|
|
48275
48295
|
}
|
|
48276
|
-
function getAllModulePaths(info, importedFileName, host, preferences, options = {}) {
|
|
48296
|
+
function getAllModulePaths(info, importedFileName, host, preferences, compilerOptions, options = {}) {
|
|
48277
48297
|
var _a;
|
|
48278
48298
|
const importingFilePath = toPath(info.importingSourceFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
|
|
48279
48299
|
const importedFilePath = toPath(importedFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
|
|
@@ -48283,13 +48303,48 @@ function getAllModulePaths(info, importedFileName, host, preferences, options =
|
|
|
48283
48303
|
if (cached == null ? void 0 : cached.modulePaths)
|
|
48284
48304
|
return cached.modulePaths;
|
|
48285
48305
|
}
|
|
48286
|
-
const modulePaths = getAllModulePathsWorker(info, importedFileName, host);
|
|
48306
|
+
const modulePaths = getAllModulePathsWorker(info, importedFileName, host, compilerOptions, options);
|
|
48287
48307
|
if (cache) {
|
|
48288
48308
|
cache.setModulePaths(importingFilePath, importedFilePath, preferences, options, modulePaths);
|
|
48289
48309
|
}
|
|
48290
48310
|
return modulePaths;
|
|
48291
48311
|
}
|
|
48292
|
-
|
|
48312
|
+
var runtimeDependencyFields = ["dependencies", "peerDependencies", "optionalDependencies"];
|
|
48313
|
+
function getAllRuntimeDependencies(packageJson) {
|
|
48314
|
+
let result;
|
|
48315
|
+
for (const field of runtimeDependencyFields) {
|
|
48316
|
+
const deps = packageJson[field];
|
|
48317
|
+
if (deps && typeof deps === "object") {
|
|
48318
|
+
result = concatenate(result, getOwnKeys(deps));
|
|
48319
|
+
}
|
|
48320
|
+
}
|
|
48321
|
+
return result;
|
|
48322
|
+
}
|
|
48323
|
+
function getAllModulePathsWorker(info, importedFileName, host, compilerOptions, options) {
|
|
48324
|
+
var _a, _b;
|
|
48325
|
+
const cache = (_a = host.getModuleResolutionCache) == null ? void 0 : _a.call(host);
|
|
48326
|
+
const links = (_b = host.getSymlinkCache) == null ? void 0 : _b.call(host);
|
|
48327
|
+
if (cache && links && host.readFile && !pathContainsNodeModules(info.importingSourceFileName)) {
|
|
48328
|
+
Debug.type(host);
|
|
48329
|
+
const state = getTemporaryModuleResolutionState(cache.getPackageJsonInfoCache(), host, {});
|
|
48330
|
+
const packageJson = getPackageScopeForPath(info.importingSourceFileName, state);
|
|
48331
|
+
if (packageJson) {
|
|
48332
|
+
const toResolve = getAllRuntimeDependencies(packageJson.contents.packageJsonContent);
|
|
48333
|
+
for (const depName of toResolve || emptyArray) {
|
|
48334
|
+
const resolved = resolveModuleName(
|
|
48335
|
+
depName,
|
|
48336
|
+
combinePaths(packageJson.packageDirectory, "package.json"),
|
|
48337
|
+
compilerOptions,
|
|
48338
|
+
host,
|
|
48339
|
+
cache,
|
|
48340
|
+
/*redirectedReference*/
|
|
48341
|
+
void 0,
|
|
48342
|
+
options.overrideImportMode
|
|
48343
|
+
);
|
|
48344
|
+
links.setSymlinksFromResolution(resolved.resolvedModule);
|
|
48345
|
+
}
|
|
48346
|
+
}
|
|
48347
|
+
}
|
|
48293
48348
|
const allFileNames = /* @__PURE__ */ new Map();
|
|
48294
48349
|
let importedFileFromNodeModules = false;
|
|
48295
48350
|
forEachFileNameOfModule(
|
|
@@ -123338,6 +123393,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123338
123393
|
return false;
|
|
123339
123394
|
return host.fileExists(f);
|
|
123340
123395
|
},
|
|
123396
|
+
realpath: maybeBind(host, host.realpath),
|
|
123341
123397
|
useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(),
|
|
123342
123398
|
getBuildInfo: () => {
|
|
123343
123399
|
var _a2;
|
|
@@ -123346,7 +123402,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123346
123402
|
getSourceFileFromReference: (file, ref) => program.getSourceFileFromReference(file, ref),
|
|
123347
123403
|
redirectTargetsMap,
|
|
123348
123404
|
getFileIncludeReasons: program.getFileIncludeReasons,
|
|
123349
|
-
createHash: maybeBind(host, host.createHash)
|
|
123405
|
+
createHash: maybeBind(host, host.createHash),
|
|
123406
|
+
getModuleResolutionCache: () => program.getModuleResolutionCache(),
|
|
123407
|
+
trace: maybeBind(host, host.trace)
|
|
123350
123408
|
};
|
|
123351
123409
|
}
|
|
123352
123410
|
function writeFile2(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
|
|
@@ -162665,6 +162723,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
162665
162723
|
}
|
|
162666
162724
|
}
|
|
162667
162725
|
function shouldOfferImportCompletions() {
|
|
162726
|
+
var _a;
|
|
162668
162727
|
if (importStatementCompletion)
|
|
162669
162728
|
return true;
|
|
162670
162729
|
if (!preferences.includeCompletionsForModuleExports)
|
|
@@ -162673,7 +162732,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
162673
162732
|
return true;
|
|
162674
162733
|
if (compilerOptionsIndicateEsModules(program.getCompilerOptions()))
|
|
162675
162734
|
return true;
|
|
162676
|
-
return programContainsModules(program);
|
|
162735
|
+
return ((_a = program.getSymlinkCache) == null ? void 0 : _a.call(program).hasAnySymlinks()) || !!program.getCompilerOptions().paths || programContainsModules(program);
|
|
162677
162736
|
}
|
|
162678
162737
|
function isSnippetScope(scopeNode) {
|
|
162679
162738
|
switch (scopeNode.kind) {
|
|
@@ -180665,6 +180724,13 @@ var Project3 = class _Project {
|
|
|
180665
180724
|
}
|
|
180666
180725
|
}
|
|
180667
180726
|
/** @internal */
|
|
180727
|
+
markAutoImportProviderAsDirty() {
|
|
180728
|
+
var _a;
|
|
180729
|
+
if (!this.autoImportProviderHost)
|
|
180730
|
+
this.autoImportProviderHost = void 0;
|
|
180731
|
+
(_a = this.autoImportProviderHost) == null ? void 0 : _a.markAsDirty();
|
|
180732
|
+
}
|
|
180733
|
+
/** @internal */
|
|
180668
180734
|
onAutoImportProviderSettingsChanged() {
|
|
180669
180735
|
var _a;
|
|
180670
180736
|
if (this.autoImportProviderHost === false) {
|
|
@@ -180700,7 +180766,7 @@ var Project3 = class _Project {
|
|
|
180700
180766
|
* @returns: true if set of files in the project stays the same and false - otherwise.
|
|
180701
180767
|
*/
|
|
180702
180768
|
updateGraph() {
|
|
180703
|
-
var _a, _b, _c, _d
|
|
180769
|
+
var _a, _b, _c, _d;
|
|
180704
180770
|
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "updateGraph", { name: this.projectName, kind: ProjectKind[this.projectKind] });
|
|
180705
180771
|
(_b = perfLogger) == null ? void 0 : _b.logStartUpdateGraph();
|
|
180706
180772
|
this.resolutionCache.startRecordingFilesWithChangedResolutions();
|
|
@@ -180725,15 +180791,13 @@ var Project3 = class _Project {
|
|
|
180725
180791
|
this.projectProgramVersion++;
|
|
180726
180792
|
}
|
|
180727
180793
|
if (hasAddedorRemovedFiles) {
|
|
180728
|
-
|
|
180729
|
-
this.autoImportProviderHost = void 0;
|
|
180730
|
-
(_c = this.autoImportProviderHost) == null ? void 0 : _c.markAsDirty();
|
|
180794
|
+
this.markAutoImportProviderAsDirty();
|
|
180731
180795
|
}
|
|
180732
180796
|
if (isFirstProgramLoad) {
|
|
180733
180797
|
this.getPackageJsonAutoImportProvider();
|
|
180734
180798
|
}
|
|
180735
|
-
(
|
|
180736
|
-
(
|
|
180799
|
+
(_c = perfLogger) == null ? void 0 : _c.logStopUpdateGraph();
|
|
180800
|
+
(_d = tracing) == null ? void 0 : _d.pop();
|
|
180737
180801
|
return !hasNewProgram;
|
|
180738
180802
|
}
|
|
180739
180803
|
/** @internal */
|
|
@@ -181701,8 +181765,7 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
|
|
|
181701
181765
|
if (packageJson) {
|
|
181702
181766
|
const entrypoints = getRootNamesFromPackageJson(packageJson, program, symlinkCache);
|
|
181703
181767
|
if (entrypoints) {
|
|
181704
|
-
|
|
181705
|
-
dependenciesAdded += entrypoints.length ? 1 : 0;
|
|
181768
|
+
dependenciesAdded += addRootNames(entrypoints);
|
|
181706
181769
|
continue;
|
|
181707
181770
|
}
|
|
181708
181771
|
}
|
|
@@ -181717,8 +181780,7 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
|
|
|
181717
181780
|
);
|
|
181718
181781
|
if (typesPackageJson) {
|
|
181719
181782
|
const entrypoints = getRootNamesFromPackageJson(typesPackageJson, program, symlinkCache);
|
|
181720
|
-
|
|
181721
|
-
dependenciesAdded += (entrypoints == null ? void 0 : entrypoints.length) ? 1 : 0;
|
|
181783
|
+
dependenciesAdded += addRootNames(entrypoints);
|
|
181722
181784
|
return true;
|
|
181723
181785
|
}
|
|
181724
181786
|
}
|
|
@@ -181733,15 +181795,48 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
|
|
|
181733
181795
|
/*resolveJs*/
|
|
181734
181796
|
true
|
|
181735
181797
|
);
|
|
181736
|
-
|
|
181737
|
-
|
|
181798
|
+
dependenciesAdded += addRootNames(entrypoints);
|
|
181799
|
+
}
|
|
181800
|
+
}
|
|
181801
|
+
}
|
|
181802
|
+
const references = program.getResolvedProjectReferences();
|
|
181803
|
+
let referencesAddded = 0;
|
|
181804
|
+
if ((references == null ? void 0 : references.length) && hostProject.projectService.getHostPreferences().includeCompletionsForModuleExports) {
|
|
181805
|
+
references.forEach((ref) => {
|
|
181806
|
+
if (ref == null ? void 0 : ref.commandLine.options.outFile) {
|
|
181807
|
+
referencesAddded += addRootNames(filterEntrypoints([
|
|
181808
|
+
changeExtension(ref.commandLine.options.outFile, ".d.ts")
|
|
181809
|
+
]));
|
|
181810
|
+
} else if (ref) {
|
|
181811
|
+
const getCommonSourceDirectory2 = memoize(
|
|
181812
|
+
() => getCommonSourceDirectoryOfConfig(
|
|
181813
|
+
ref.commandLine,
|
|
181814
|
+
!hostProject.useCaseSensitiveFileNames()
|
|
181815
|
+
)
|
|
181816
|
+
);
|
|
181817
|
+
referencesAddded += addRootNames(filterEntrypoints(mapDefined(
|
|
181818
|
+
ref.commandLine.fileNames,
|
|
181819
|
+
(fileName) => !isDeclarationFileName(fileName) && !fileExtensionIs(fileName, ".json" /* Json */) && !program.getSourceFile(fileName) ? getOutputDeclarationFileName(
|
|
181820
|
+
fileName,
|
|
181821
|
+
ref.commandLine,
|
|
181822
|
+
!hostProject.useCaseSensitiveFileNames(),
|
|
181823
|
+
getCommonSourceDirectory2
|
|
181824
|
+
) : void 0
|
|
181825
|
+
)));
|
|
181738
181826
|
}
|
|
181739
|
-
}
|
|
181827
|
+
});
|
|
181740
181828
|
}
|
|
181741
|
-
if (rootNames == null ? void 0 : rootNames.
|
|
181742
|
-
hostProject.log(`AutoImportProviderProject: found ${rootNames.
|
|
181829
|
+
if (rootNames == null ? void 0 : rootNames.size) {
|
|
181830
|
+
hostProject.log(`AutoImportProviderProject: found ${rootNames.size} root files in ${dependenciesAdded} dependencies ${referencesAddded} referenced projects in ${timestamp() - start} ms`);
|
|
181831
|
+
}
|
|
181832
|
+
return rootNames ? arrayFrom(rootNames.values()) : emptyArray;
|
|
181833
|
+
function addRootNames(entrypoints) {
|
|
181834
|
+
if (!(entrypoints == null ? void 0 : entrypoints.length))
|
|
181835
|
+
return 0;
|
|
181836
|
+
rootNames ?? (rootNames = /* @__PURE__ */ new Set());
|
|
181837
|
+
entrypoints.forEach((entry) => rootNames.add(entry));
|
|
181838
|
+
return 1;
|
|
181743
181839
|
}
|
|
181744
|
-
return rootNames || emptyArray;
|
|
181745
181840
|
function addDependency(dependency) {
|
|
181746
181841
|
if (!startsWith(dependency, "@types/")) {
|
|
181747
181842
|
(dependencyNames || (dependencyNames = /* @__PURE__ */ new Set())).add(dependency);
|
|
@@ -181766,14 +181861,17 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
|
|
|
181766
181861
|
realPath: ensureTrailingDirectorySeparator(realPath2)
|
|
181767
181862
|
});
|
|
181768
181863
|
}
|
|
181769
|
-
return
|
|
181770
|
-
const resolvedFileName = isSymlink ? entrypoint.replace(packageJson.packageDirectory, real) : entrypoint;
|
|
181771
|
-
if (!program2.getSourceFile(resolvedFileName) && !(isSymlink && program2.getSourceFile(entrypoint))) {
|
|
181772
|
-
return resolvedFileName;
|
|
181773
|
-
}
|
|
181774
|
-
});
|
|
181864
|
+
return filterEntrypoints(entrypoints, isSymlink ? (entrypoint) => entrypoint.replace(packageJson.packageDirectory, real) : void 0);
|
|
181775
181865
|
}
|
|
181776
181866
|
}
|
|
181867
|
+
function filterEntrypoints(entrypoints, symlinkName) {
|
|
181868
|
+
return mapDefined(entrypoints, (entrypoint) => {
|
|
181869
|
+
const resolvedFileName = symlinkName ? symlinkName(entrypoint) : entrypoint;
|
|
181870
|
+
if (!program.getSourceFile(resolvedFileName) && !(symlinkName && program.getSourceFile(entrypoint))) {
|
|
181871
|
+
return resolvedFileName;
|
|
181872
|
+
}
|
|
181873
|
+
});
|
|
181874
|
+
}
|
|
181777
181875
|
}
|
|
181778
181876
|
/** @internal */
|
|
181779
181877
|
static create(dependencySelection, hostProject, host, documentRegistry) {
|
|
@@ -183116,11 +183214,18 @@ var _ProjectService = class _ProjectService {
|
|
|
183116
183214
|
if (config.updateLevel !== 2 /* Full */)
|
|
183117
183215
|
config.updateLevel = 1 /* RootNamesAndUpdate */;
|
|
183118
183216
|
config.projects.forEach((watchWildcardDirectories, projectCanonicalPath) => {
|
|
183217
|
+
var _a;
|
|
183119
183218
|
if (!watchWildcardDirectories)
|
|
183120
183219
|
return;
|
|
183121
183220
|
const project = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath);
|
|
183122
183221
|
if (!project)
|
|
183123
183222
|
return;
|
|
183223
|
+
if (configuredProjectForConfig !== project && this.getHostPreferences().includeCompletionsForModuleExports) {
|
|
183224
|
+
const path = this.toPath(configFileName);
|
|
183225
|
+
if (find((_a = project.getCurrentProgram()) == null ? void 0 : _a.getResolvedProjectReferences(), (ref) => (ref == null ? void 0 : ref.sourceFile.path) === path)) {
|
|
183226
|
+
project.markAutoImportProviderAsDirty();
|
|
183227
|
+
}
|
|
183228
|
+
}
|
|
183124
183229
|
const updateLevel = configuredProjectForConfig === project ? 1 /* RootNamesAndUpdate */ : 0 /* Update */;
|
|
183125
183230
|
if (project.pendingUpdateLevel !== void 0 && project.pendingUpdateLevel > updateLevel)
|
|
183126
183231
|
return;
|
|
@@ -183169,6 +183274,7 @@ var _ProjectService = class _ProjectService {
|
|
|
183169
183274
|
let scheduledAnyProjectUpdate = false;
|
|
183170
183275
|
configFileExistenceInfo.config.updateLevel = 2 /* Full */;
|
|
183171
183276
|
configFileExistenceInfo.config.projects.forEach((_watchWildcardDirectories, projectCanonicalPath) => {
|
|
183277
|
+
var _a;
|
|
183172
183278
|
const project = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath);
|
|
183173
183279
|
if (!project)
|
|
183174
183280
|
return;
|
|
@@ -183179,9 +183285,14 @@ var _ProjectService = class _ProjectService {
|
|
|
183179
183285
|
project.pendingUpdateLevel = 2 /* Full */;
|
|
183180
183286
|
project.pendingUpdateReason = loadReason;
|
|
183181
183287
|
this.delayUpdateProjectGraph(project);
|
|
183288
|
+
project.markAutoImportProviderAsDirty();
|
|
183182
183289
|
} else {
|
|
183183
|
-
|
|
183290
|
+
const path = this.toPath(canonicalConfigFilePath);
|
|
183291
|
+
project.resolutionCache.removeResolutionsFromProjectReferenceRedirects(path);
|
|
183184
183292
|
this.delayUpdateProjectGraph(project);
|
|
183293
|
+
if (this.getHostPreferences().includeCompletionsForModuleExports && find((_a = project.getCurrentProgram()) == null ? void 0 : _a.getResolvedProjectReferences(), (ref) => (ref == null ? void 0 : ref.sourceFile.path) === path)) {
|
|
183294
|
+
project.markAutoImportProviderAsDirty();
|
|
183295
|
+
}
|
|
183185
183296
|
}
|
|
183186
183297
|
});
|
|
183187
183298
|
return scheduledAnyProjectUpdate;
|
|
@@ -184646,7 +184757,8 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184646
184757
|
if (args.preferences) {
|
|
184647
184758
|
const {
|
|
184648
184759
|
lazyConfiguredProjectsFromExternalProject,
|
|
184649
|
-
includePackageJsonAutoImports
|
|
184760
|
+
includePackageJsonAutoImports,
|
|
184761
|
+
includeCompletionsForModuleExports
|
|
184650
184762
|
} = this.hostConfiguration.preferences;
|
|
184651
184763
|
this.hostConfiguration.preferences = { ...this.hostConfiguration.preferences, ...args.preferences };
|
|
184652
184764
|
if (lazyConfiguredProjectsFromExternalProject && !this.hostConfiguration.preferences.lazyConfiguredProjectsFromExternalProject) {
|
|
@@ -184658,7 +184770,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
184658
184770
|
})
|
|
184659
184771
|
);
|
|
184660
184772
|
}
|
|
184661
|
-
if (includePackageJsonAutoImports !== args.preferences.includePackageJsonAutoImports) {
|
|
184773
|
+
if (includePackageJsonAutoImports !== args.preferences.includePackageJsonAutoImports || !!includeCompletionsForModuleExports !== !!args.preferences.includeCompletionsForModuleExports) {
|
|
184662
184774
|
this.forEachProject((project) => {
|
|
184663
184775
|
project.onAutoImportProviderSettingsChanged();
|
|
184664
184776
|
});
|
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.5.0-dev.
|
|
5
|
+
"version": "5.5.0-dev.20240419",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -63,7 +63,6 @@
|
|
|
63
63
|
"eslint": "^8.57.0",
|
|
64
64
|
"eslint-formatter-autolinkable-stylish": "^1.3.0",
|
|
65
65
|
"eslint-plugin-local": "^4.2.1",
|
|
66
|
-
"eslint-plugin-no-null": "^1.0.2",
|
|
67
66
|
"fast-xml-parser": "^4.3.6",
|
|
68
67
|
"glob": "^10.3.10",
|
|
69
68
|
"hereby": "^1.8.9",
|
|
@@ -111,5 +110,5 @@
|
|
|
111
110
|
"node": "20.1.0",
|
|
112
111
|
"npm": "8.19.4"
|
|
113
112
|
},
|
|
114
|
-
"gitHead": "
|
|
113
|
+
"gitHead": "48870169dcc4b6626ddc9691cf72303e8a83e6f1"
|
|
115
114
|
}
|