typescript 5.6.0-dev.20240708 → 5.6.0-dev.20240710
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 +62 -46
- package/lib/typescript.js +100 -78
- package/package.json +3 -3
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.6";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240710`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -12745,7 +12745,7 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
|
|
|
12745
12745
|
}
|
|
12746
12746
|
if (isJSDocNode(node) || node.kind === 12 /* JsxText */) {
|
|
12747
12747
|
return skipTrivia(
|
|
12748
|
-
(sourceFile
|
|
12748
|
+
(sourceFile ?? getSourceFileOfNode(node)).text,
|
|
12749
12749
|
node.pos,
|
|
12750
12750
|
/*stopAfterLineBreak*/
|
|
12751
12751
|
false,
|
|
@@ -12757,13 +12757,14 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
|
|
|
12757
12757
|
return getTokenPosOfNode(node.jsDoc[0], sourceFile);
|
|
12758
12758
|
}
|
|
12759
12759
|
if (node.kind === 352 /* SyntaxList */) {
|
|
12760
|
-
|
|
12760
|
+
sourceFile ?? (sourceFile = getSourceFileOfNode(node));
|
|
12761
|
+
const first2 = firstOrUndefined(getNodeChildren(node, sourceFile));
|
|
12761
12762
|
if (first2) {
|
|
12762
12763
|
return getTokenPosOfNode(first2, sourceFile, includeJsDoc);
|
|
12763
12764
|
}
|
|
12764
12765
|
}
|
|
12765
12766
|
return skipTrivia(
|
|
12766
|
-
(sourceFile
|
|
12767
|
+
(sourceFile ?? getSourceFileOfNode(node)).text,
|
|
12767
12768
|
node.pos,
|
|
12768
12769
|
/*stopAfterLineBreak*/
|
|
12769
12770
|
false,
|
|
@@ -23511,7 +23512,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
23511
23512
|
}
|
|
23512
23513
|
function createSyntaxList(children) {
|
|
23513
23514
|
const node = createBaseNode(352 /* SyntaxList */);
|
|
23514
|
-
|
|
23515
|
+
node._children = children;
|
|
23515
23516
|
return node;
|
|
23516
23517
|
}
|
|
23517
23518
|
function createNotEmittedStatement(original) {
|
|
@@ -26287,17 +26288,31 @@ function isJSDocImportTag(node) {
|
|
|
26287
26288
|
}
|
|
26288
26289
|
|
|
26289
26290
|
// src/compiler/factory/nodeChildren.ts
|
|
26290
|
-
var
|
|
26291
|
-
function getNodeChildren(node) {
|
|
26292
|
-
|
|
26293
|
-
|
|
26291
|
+
var sourceFileToNodeChildren = /* @__PURE__ */ new WeakMap();
|
|
26292
|
+
function getNodeChildren(node, sourceFile) {
|
|
26293
|
+
var _a;
|
|
26294
|
+
const kind = node.kind;
|
|
26295
|
+
if (!isNodeKind(kind)) {
|
|
26296
|
+
return emptyArray;
|
|
26297
|
+
}
|
|
26298
|
+
if (kind === 352 /* SyntaxList */) {
|
|
26299
|
+
return node._children;
|
|
26300
|
+
}
|
|
26301
|
+
return (_a = sourceFileToNodeChildren.get(sourceFile)) == null ? void 0 : _a.get(node);
|
|
26294
26302
|
}
|
|
26295
|
-
function
|
|
26296
|
-
|
|
26297
|
-
|
|
26303
|
+
function unsetNodeChildren(node, origSourceFile) {
|
|
26304
|
+
var _a;
|
|
26305
|
+
if (node.kind === 352 /* SyntaxList */) {
|
|
26306
|
+
Debug.fail("Did not expect to unset the children of a SyntaxList.");
|
|
26307
|
+
}
|
|
26308
|
+
(_a = sourceFileToNodeChildren.get(origSourceFile)) == null ? void 0 : _a.delete(node);
|
|
26298
26309
|
}
|
|
26299
|
-
function
|
|
26300
|
-
|
|
26310
|
+
function transferSourceFileChildren(sourceFile, targetSourceFile) {
|
|
26311
|
+
const map2 = sourceFileToNodeChildren.get(sourceFile);
|
|
26312
|
+
if (map2 !== void 0) {
|
|
26313
|
+
sourceFileToNodeChildren.delete(sourceFile);
|
|
26314
|
+
sourceFileToNodeChildren.set(targetSourceFile, map2);
|
|
26315
|
+
}
|
|
26301
26316
|
}
|
|
26302
26317
|
|
|
26303
26318
|
// src/compiler/factory/utilities.ts
|
|
@@ -34887,6 +34902,7 @@ var IncrementalParser;
|
|
|
34887
34902
|
aggressiveChecks
|
|
34888
34903
|
);
|
|
34889
34904
|
result.impliedNodeFormat = sourceFile.impliedNodeFormat;
|
|
34905
|
+
transferSourceFileChildren(sourceFile, result);
|
|
34890
34906
|
return result;
|
|
34891
34907
|
}
|
|
34892
34908
|
IncrementalParser2.updateSourceFile = updateSourceFile;
|
|
@@ -34922,7 +34938,7 @@ var IncrementalParser;
|
|
|
34922
34938
|
}
|
|
34923
34939
|
}
|
|
34924
34940
|
}
|
|
34925
|
-
function moveElementEntirelyPastChangeRange(element, isArray2, delta, oldText, newText, aggressiveChecks) {
|
|
34941
|
+
function moveElementEntirelyPastChangeRange(element, origSourceFile, isArray2, delta, oldText, newText, aggressiveChecks) {
|
|
34926
34942
|
if (isArray2) {
|
|
34927
34943
|
visitArray2(element);
|
|
34928
34944
|
} else {
|
|
@@ -34934,7 +34950,7 @@ var IncrementalParser;
|
|
|
34934
34950
|
if (aggressiveChecks && shouldCheckNode(node)) {
|
|
34935
34951
|
text = oldText.substring(node.pos, node.end);
|
|
34936
34952
|
}
|
|
34937
|
-
unsetNodeChildren(node);
|
|
34953
|
+
unsetNodeChildren(node, origSourceFile);
|
|
34938
34954
|
setTextRangePosEnd(node, node.pos + delta, node.end + delta);
|
|
34939
34955
|
if (aggressiveChecks && shouldCheckNode(node)) {
|
|
34940
34956
|
Debug.assert(text === newText.substring(node.pos, node.end));
|
|
@@ -35008,6 +35024,7 @@ var IncrementalParser;
|
|
|
35008
35024
|
if (child.pos > changeRangeOldEnd) {
|
|
35009
35025
|
moveElementEntirelyPastChangeRange(
|
|
35010
35026
|
child,
|
|
35027
|
+
sourceFile,
|
|
35011
35028
|
/*isArray*/
|
|
35012
35029
|
false,
|
|
35013
35030
|
delta,
|
|
@@ -35020,7 +35037,7 @@ var IncrementalParser;
|
|
|
35020
35037
|
const fullEnd = child.end;
|
|
35021
35038
|
if (fullEnd >= changeStart) {
|
|
35022
35039
|
markAsIntersectingIncrementalChange(child);
|
|
35023
|
-
unsetNodeChildren(child);
|
|
35040
|
+
unsetNodeChildren(child, sourceFile);
|
|
35024
35041
|
adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
|
|
35025
35042
|
forEachChild(child, visitNode3, visitArray2);
|
|
35026
35043
|
if (hasJSDocNodes(child)) {
|
|
@@ -35038,6 +35055,7 @@ var IncrementalParser;
|
|
|
35038
35055
|
if (array.pos > changeRangeOldEnd) {
|
|
35039
35056
|
moveElementEntirelyPastChangeRange(
|
|
35040
35057
|
array,
|
|
35058
|
+
sourceFile,
|
|
35041
35059
|
/*isArray*/
|
|
35042
35060
|
true,
|
|
35043
35061
|
delta,
|
|
@@ -51422,9 +51440,9 @@ function createTypeChecker(host) {
|
|
|
51422
51440
|
const typePredicate = getTypePredicateOfSignature(signature);
|
|
51423
51441
|
const type = getReturnTypeOfSignature(signature);
|
|
51424
51442
|
if (context.enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
|
51425
|
-
const annotation =
|
|
51426
|
-
if (annotation
|
|
51427
|
-
const result =
|
|
51443
|
+
const annotation = getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
|
|
51444
|
+
if (annotation) {
|
|
51445
|
+
const result = tryReuseExistingTypeNode(context, annotation, type, context.enclosingDeclaration);
|
|
51428
51446
|
if (result) {
|
|
51429
51447
|
return result;
|
|
51430
51448
|
}
|
|
@@ -51918,7 +51936,10 @@ function createTypeChecker(host) {
|
|
|
51918
51936
|
);
|
|
51919
51937
|
}
|
|
51920
51938
|
if (isNamedDeclaration(node) && node.name.kind === 167 /* ComputedPropertyName */ && !isLateBindableName(node.name)) {
|
|
51921
|
-
if (!
|
|
51939
|
+
if (!hasDynamicName(node)) {
|
|
51940
|
+
return visitEachChild2(node, visitExistingNodeTreeSymbols);
|
|
51941
|
+
}
|
|
51942
|
+
if (!(context.flags & 1 /* AllowUnresolvedNames */ && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
|
|
51922
51943
|
return void 0;
|
|
51923
51944
|
}
|
|
51924
51945
|
}
|
|
@@ -58009,7 +58030,7 @@ function createTypeChecker(host) {
|
|
|
58009
58030
|
);
|
|
58010
58031
|
}
|
|
58011
58032
|
function createSignatureTypeMapper(signature, typeArguments) {
|
|
58012
|
-
return createTypeMapper(signature.typeParameters, typeArguments);
|
|
58033
|
+
return createTypeMapper(sameMap(signature.typeParameters, (tp) => tp.mapper ? instantiateType(tp, tp.mapper) : tp), typeArguments);
|
|
58013
58034
|
}
|
|
58014
58035
|
function getErasedSignature(signature) {
|
|
58015
58036
|
return signature.typeParameters ? signature.erasedSignatureCache || (signature.erasedSignatureCache = createErasedSignature(signature)) : signature;
|
|
@@ -110974,6 +110995,7 @@ function transformDeclarations(context) {
|
|
|
110974
110995
|
}
|
|
110975
110996
|
function reportInferenceFallback(node) {
|
|
110976
110997
|
if (!isolatedDeclarations || isSourceFileJS(currentSourceFile)) return;
|
|
110998
|
+
if (getSourceFileOfNode(node) !== currentSourceFile) return;
|
|
110977
110999
|
if (isVariableDeclaration(node) && resolver.isExpandoFunctionDeclaration(node)) {
|
|
110978
111000
|
reportExpandoFunctionErrors(node);
|
|
110979
111001
|
} else {
|
|
@@ -119475,7 +119497,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119475
119497
|
const newFile = getSourceFileByPath(oldSourceFile.resolvedPath);
|
|
119476
119498
|
if (shouldCreateNewSourceFile || !newFile || newFile.impliedNodeFormat !== oldSourceFile.impliedNodeFormat || // old file wasn't redirect but new file is
|
|
119477
119499
|
oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path) {
|
|
119478
|
-
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path));
|
|
119500
|
+
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path), newFile);
|
|
119479
119501
|
}
|
|
119480
119502
|
}
|
|
119481
119503
|
if (!host.getParsedCommandLine) {
|
|
@@ -119485,7 +119507,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119485
119507
|
resolvedProjectReference.sourceFile,
|
|
119486
119508
|
oldProgram.getCompilerOptions(),
|
|
119487
119509
|
/*hasSourceFileByPath*/
|
|
119488
|
-
false
|
|
119510
|
+
false,
|
|
119511
|
+
/*newSourceFileByResolvedPath*/
|
|
119512
|
+
void 0
|
|
119489
119513
|
);
|
|
119490
119514
|
}
|
|
119491
119515
|
});
|
|
@@ -125180,11 +125204,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125180
125204
|
);
|
|
125181
125205
|
} else if (packageDirWatcher.isSymlink !== isSymlink) {
|
|
125182
125206
|
packageDirWatcher.dirPathToWatcher.forEach((watcher) => {
|
|
125183
|
-
removeDirectoryWatcher(
|
|
125184
|
-
packageDirWatcher.isSymlink ? packageDirPath : dirPath,
|
|
125185
|
-
/*syncDirWatcherRemove*/
|
|
125186
|
-
false
|
|
125187
|
-
);
|
|
125207
|
+
removeDirectoryWatcher(packageDirWatcher.isSymlink ? packageDirPath : dirPath);
|
|
125188
125208
|
watcher.watcher = createDirPathToWatcher();
|
|
125189
125209
|
});
|
|
125190
125210
|
packageDirWatcher.isSymlink = isSymlink;
|
|
@@ -125224,7 +125244,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125224
125244
|
}
|
|
125225
125245
|
return dirWatcher;
|
|
125226
125246
|
}
|
|
125227
|
-
function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot
|
|
125247
|
+
function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot) {
|
|
125228
125248
|
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
125229
125249
|
const toWatch = getDirectoryToWatchFailedLookupLocation(
|
|
125230
125250
|
failedLookupLocation,
|
|
@@ -125244,7 +125264,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125244
125264
|
const forDirPath = packageDirWatcher.dirPathToWatcher.get(dirPath);
|
|
125245
125265
|
forDirPath.refCount--;
|
|
125246
125266
|
if (forDirPath.refCount === 0) {
|
|
125247
|
-
removeDirectoryWatcher(packageDirWatcher.isSymlink ? packageDirPath : dirPath
|
|
125267
|
+
removeDirectoryWatcher(packageDirWatcher.isSymlink ? packageDirPath : dirPath);
|
|
125248
125268
|
packageDirWatcher.dirPathToWatcher.delete(dirPath);
|
|
125249
125269
|
if (packageDirWatcher.isSymlink) {
|
|
125250
125270
|
const refCount = dirPathToSymlinkPackageRefCount.get(dirPath) - 1;
|
|
@@ -125254,15 +125274,14 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125254
125274
|
dirPathToSymlinkPackageRefCount.set(dirPath, refCount);
|
|
125255
125275
|
}
|
|
125256
125276
|
}
|
|
125257
|
-
if (syncDirWatcherRemove) closePackageDirWatcher(packageDirWatcher, packageDirPath);
|
|
125258
125277
|
}
|
|
125259
125278
|
} else {
|
|
125260
|
-
removeDirectoryWatcher(dirPath
|
|
125279
|
+
removeDirectoryWatcher(dirPath);
|
|
125261
125280
|
}
|
|
125262
125281
|
}
|
|
125263
125282
|
return removeAtRoot;
|
|
125264
125283
|
}
|
|
125265
|
-
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName
|
|
125284
|
+
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
|
|
125266
125285
|
Debug.checkDefined(resolution.files).delete(filePath);
|
|
125267
125286
|
if (resolution.files.size) return;
|
|
125268
125287
|
resolution.files = void 0;
|
|
@@ -125277,11 +125296,11 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125277
125296
|
let removeAtRoot = false;
|
|
125278
125297
|
if (failedLookupLocations) {
|
|
125279
125298
|
for (const failedLookupLocation of failedLookupLocations) {
|
|
125280
|
-
removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot
|
|
125299
|
+
removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot);
|
|
125281
125300
|
}
|
|
125282
125301
|
}
|
|
125283
|
-
if (alternateResult) removeAtRoot = stopWatchFailedLookupLocation(alternateResult, removeAtRoot
|
|
125284
|
-
if (removeAtRoot) removeDirectoryWatcher(rootPath
|
|
125302
|
+
if (alternateResult) removeAtRoot = stopWatchFailedLookupLocation(alternateResult, removeAtRoot);
|
|
125303
|
+
if (removeAtRoot) removeDirectoryWatcher(rootPath);
|
|
125285
125304
|
} else if (affectingLocations == null ? void 0 : affectingLocations.length) {
|
|
125286
125305
|
resolutionsWithOnlyAffectingLocations.delete(resolution);
|
|
125287
125306
|
}
|
|
@@ -125289,14 +125308,12 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125289
125308
|
for (const affectingLocation of affectingLocations) {
|
|
125290
125309
|
const watcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
125291
125310
|
watcher.resolutions--;
|
|
125292
|
-
if (syncDirWatcherRemove) closeFileWatcherOfAffectingLocation(watcher, affectingLocation);
|
|
125293
125311
|
}
|
|
125294
125312
|
}
|
|
125295
125313
|
}
|
|
125296
|
-
function removeDirectoryWatcher(dirPath
|
|
125314
|
+
function removeDirectoryWatcher(dirPath) {
|
|
125297
125315
|
const dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
125298
125316
|
dirWatcher.refCount--;
|
|
125299
|
-
if (syncDirWatcherRemove) closeDirectoryWatchesOfFailedLookup(dirWatcher, dirPath);
|
|
125300
125317
|
}
|
|
125301
125318
|
function createDirectoryWatcher(directory, dirPath, nonRecursive) {
|
|
125302
125319
|
return resolutionHost.watchDirectoryOfFailedLookupLocation(directory, (fileOrDirectory) => {
|
|
@@ -125307,15 +125324,14 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125307
125324
|
scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
|
|
125308
125325
|
}, nonRecursive ? 0 /* None */ : 1 /* Recursive */);
|
|
125309
125326
|
}
|
|
125310
|
-
function removeResolutionsOfFileFromCache(cache, filePath, getResolutionWithResolvedFileName
|
|
125327
|
+
function removeResolutionsOfFileFromCache(cache, filePath, getResolutionWithResolvedFileName) {
|
|
125311
125328
|
const resolutions = cache.get(filePath);
|
|
125312
125329
|
if (resolutions) {
|
|
125313
125330
|
resolutions.forEach(
|
|
125314
125331
|
(resolution) => stopWatchFailedLookupLocationOfResolution(
|
|
125315
125332
|
resolution,
|
|
125316
125333
|
filePath,
|
|
125317
|
-
getResolutionWithResolvedFileName
|
|
125318
|
-
syncDirWatcherRemove
|
|
125334
|
+
getResolutionWithResolvedFileName
|
|
125319
125335
|
)
|
|
125320
125336
|
);
|
|
125321
125337
|
cache.delete(filePath);
|
|
@@ -125329,9 +125345,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125329
125345
|
if (!resolvedProjectReference) return;
|
|
125330
125346
|
resolvedProjectReference.commandLine.fileNames.forEach((f) => removeResolutionsOfFile(resolutionHost.toPath(f)));
|
|
125331
125347
|
}
|
|
125332
|
-
function removeResolutionsOfFile(filePath
|
|
125333
|
-
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModuleFromResolution
|
|
125334
|
-
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirectiveFromResolution
|
|
125348
|
+
function removeResolutionsOfFile(filePath) {
|
|
125349
|
+
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModuleFromResolution);
|
|
125350
|
+
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirectiveFromResolution);
|
|
125335
125351
|
}
|
|
125336
125352
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
125337
125353
|
if (!resolutions) return false;
|
package/lib/typescript.js
CHANGED
|
@@ -2143,6 +2143,7 @@ __export(typescript_exports, {
|
|
|
2143
2143
|
trace: () => trace,
|
|
2144
2144
|
tracing: () => tracing,
|
|
2145
2145
|
tracingEnabled: () => tracingEnabled,
|
|
2146
|
+
transferSourceFileChildren: () => transferSourceFileChildren,
|
|
2146
2147
|
transform: () => transform,
|
|
2147
2148
|
transformClassFields: () => transformClassFields,
|
|
2148
2149
|
transformDeclarations: () => transformDeclarations,
|
|
@@ -2250,7 +2251,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2250
2251
|
|
|
2251
2252
|
// src/compiler/corePublic.ts
|
|
2252
2253
|
var versionMajorMinor = "5.6";
|
|
2253
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2254
|
+
var version = `${versionMajorMinor}.0-dev.20240710`;
|
|
2254
2255
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2255
2256
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2256
2257
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -16357,7 +16358,7 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
|
|
|
16357
16358
|
}
|
|
16358
16359
|
if (isJSDocNode(node) || node.kind === 12 /* JsxText */) {
|
|
16359
16360
|
return skipTrivia(
|
|
16360
|
-
(sourceFile
|
|
16361
|
+
(sourceFile ?? getSourceFileOfNode(node)).text,
|
|
16361
16362
|
node.pos,
|
|
16362
16363
|
/*stopAfterLineBreak*/
|
|
16363
16364
|
false,
|
|
@@ -16369,13 +16370,14 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
|
|
|
16369
16370
|
return getTokenPosOfNode(node.jsDoc[0], sourceFile);
|
|
16370
16371
|
}
|
|
16371
16372
|
if (node.kind === 352 /* SyntaxList */) {
|
|
16372
|
-
|
|
16373
|
+
sourceFile ?? (sourceFile = getSourceFileOfNode(node));
|
|
16374
|
+
const first2 = firstOrUndefined(getNodeChildren(node, sourceFile));
|
|
16373
16375
|
if (first2) {
|
|
16374
16376
|
return getTokenPosOfNode(first2, sourceFile, includeJsDoc);
|
|
16375
16377
|
}
|
|
16376
16378
|
}
|
|
16377
16379
|
return skipTrivia(
|
|
16378
|
-
(sourceFile
|
|
16380
|
+
(sourceFile ?? getSourceFileOfNode(node)).text,
|
|
16379
16381
|
node.pos,
|
|
16380
16382
|
/*stopAfterLineBreak*/
|
|
16381
16383
|
false,
|
|
@@ -27606,7 +27608,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
27606
27608
|
}
|
|
27607
27609
|
function createSyntaxList3(children) {
|
|
27608
27610
|
const node = createBaseNode(352 /* SyntaxList */);
|
|
27609
|
-
|
|
27611
|
+
node._children = children;
|
|
27610
27612
|
return node;
|
|
27611
27613
|
}
|
|
27612
27614
|
function createNotEmittedStatement(original) {
|
|
@@ -30507,17 +30509,43 @@ function isSyntaxList(n) {
|
|
|
30507
30509
|
}
|
|
30508
30510
|
|
|
30509
30511
|
// src/compiler/factory/nodeChildren.ts
|
|
30510
|
-
var
|
|
30511
|
-
function getNodeChildren(node) {
|
|
30512
|
-
|
|
30513
|
-
|
|
30512
|
+
var sourceFileToNodeChildren = /* @__PURE__ */ new WeakMap();
|
|
30513
|
+
function getNodeChildren(node, sourceFile) {
|
|
30514
|
+
var _a;
|
|
30515
|
+
const kind = node.kind;
|
|
30516
|
+
if (!isNodeKind(kind)) {
|
|
30517
|
+
return emptyArray;
|
|
30518
|
+
}
|
|
30519
|
+
if (kind === 352 /* SyntaxList */) {
|
|
30520
|
+
return node._children;
|
|
30521
|
+
}
|
|
30522
|
+
return (_a = sourceFileToNodeChildren.get(sourceFile)) == null ? void 0 : _a.get(node);
|
|
30514
30523
|
}
|
|
30515
|
-
function setNodeChildren(node, children) {
|
|
30516
|
-
|
|
30524
|
+
function setNodeChildren(node, sourceFile, children) {
|
|
30525
|
+
if (node.kind === 352 /* SyntaxList */) {
|
|
30526
|
+
Debug.fail("Should not need to re-set the children of a SyntaxList.");
|
|
30527
|
+
}
|
|
30528
|
+
let map2 = sourceFileToNodeChildren.get(sourceFile);
|
|
30529
|
+
if (map2 === void 0) {
|
|
30530
|
+
map2 = /* @__PURE__ */ new WeakMap();
|
|
30531
|
+
sourceFileToNodeChildren.set(sourceFile, map2);
|
|
30532
|
+
}
|
|
30533
|
+
map2.set(node, children);
|
|
30517
30534
|
return children;
|
|
30518
30535
|
}
|
|
30519
|
-
function unsetNodeChildren(node) {
|
|
30520
|
-
|
|
30536
|
+
function unsetNodeChildren(node, origSourceFile) {
|
|
30537
|
+
var _a;
|
|
30538
|
+
if (node.kind === 352 /* SyntaxList */) {
|
|
30539
|
+
Debug.fail("Did not expect to unset the children of a SyntaxList.");
|
|
30540
|
+
}
|
|
30541
|
+
(_a = sourceFileToNodeChildren.get(origSourceFile)) == null ? void 0 : _a.delete(node);
|
|
30542
|
+
}
|
|
30543
|
+
function transferSourceFileChildren(sourceFile, targetSourceFile) {
|
|
30544
|
+
const map2 = sourceFileToNodeChildren.get(sourceFile);
|
|
30545
|
+
if (map2 !== void 0) {
|
|
30546
|
+
sourceFileToNodeChildren.delete(sourceFile);
|
|
30547
|
+
sourceFileToNodeChildren.set(targetSourceFile, map2);
|
|
30548
|
+
}
|
|
30521
30549
|
}
|
|
30522
30550
|
|
|
30523
30551
|
// src/compiler/factory/utilities.ts
|
|
@@ -39126,6 +39154,7 @@ var IncrementalParser;
|
|
|
39126
39154
|
aggressiveChecks
|
|
39127
39155
|
);
|
|
39128
39156
|
result.impliedNodeFormat = sourceFile.impliedNodeFormat;
|
|
39157
|
+
transferSourceFileChildren(sourceFile, result);
|
|
39129
39158
|
return result;
|
|
39130
39159
|
}
|
|
39131
39160
|
IncrementalParser2.updateSourceFile = updateSourceFile2;
|
|
@@ -39161,7 +39190,7 @@ var IncrementalParser;
|
|
|
39161
39190
|
}
|
|
39162
39191
|
}
|
|
39163
39192
|
}
|
|
39164
|
-
function moveElementEntirelyPastChangeRange(element, isArray2, delta, oldText, newText, aggressiveChecks) {
|
|
39193
|
+
function moveElementEntirelyPastChangeRange(element, origSourceFile, isArray2, delta, oldText, newText, aggressiveChecks) {
|
|
39165
39194
|
if (isArray2) {
|
|
39166
39195
|
visitArray2(element);
|
|
39167
39196
|
} else {
|
|
@@ -39173,7 +39202,7 @@ var IncrementalParser;
|
|
|
39173
39202
|
if (aggressiveChecks && shouldCheckNode(node)) {
|
|
39174
39203
|
text = oldText.substring(node.pos, node.end);
|
|
39175
39204
|
}
|
|
39176
|
-
unsetNodeChildren(node);
|
|
39205
|
+
unsetNodeChildren(node, origSourceFile);
|
|
39177
39206
|
setTextRangePosEnd(node, node.pos + delta, node.end + delta);
|
|
39178
39207
|
if (aggressiveChecks && shouldCheckNode(node)) {
|
|
39179
39208
|
Debug.assert(text === newText.substring(node.pos, node.end));
|
|
@@ -39247,6 +39276,7 @@ var IncrementalParser;
|
|
|
39247
39276
|
if (child.pos > changeRangeOldEnd) {
|
|
39248
39277
|
moveElementEntirelyPastChangeRange(
|
|
39249
39278
|
child,
|
|
39279
|
+
sourceFile,
|
|
39250
39280
|
/*isArray*/
|
|
39251
39281
|
false,
|
|
39252
39282
|
delta,
|
|
@@ -39259,7 +39289,7 @@ var IncrementalParser;
|
|
|
39259
39289
|
const fullEnd = child.end;
|
|
39260
39290
|
if (fullEnd >= changeStart) {
|
|
39261
39291
|
markAsIntersectingIncrementalChange(child);
|
|
39262
|
-
unsetNodeChildren(child);
|
|
39292
|
+
unsetNodeChildren(child, sourceFile);
|
|
39263
39293
|
adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta);
|
|
39264
39294
|
forEachChild(child, visitNode3, visitArray2);
|
|
39265
39295
|
if (hasJSDocNodes(child)) {
|
|
@@ -39277,6 +39307,7 @@ var IncrementalParser;
|
|
|
39277
39307
|
if (array.pos > changeRangeOldEnd) {
|
|
39278
39308
|
moveElementEntirelyPastChangeRange(
|
|
39279
39309
|
array,
|
|
39310
|
+
sourceFile,
|
|
39280
39311
|
/*isArray*/
|
|
39281
39312
|
true,
|
|
39282
39313
|
delta,
|
|
@@ -56010,9 +56041,9 @@ function createTypeChecker(host) {
|
|
|
56010
56041
|
const typePredicate = getTypePredicateOfSignature(signature);
|
|
56011
56042
|
const type = getReturnTypeOfSignature(signature);
|
|
56012
56043
|
if (context.enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
|
56013
|
-
const annotation =
|
|
56014
|
-
if (annotation
|
|
56015
|
-
const result =
|
|
56044
|
+
const annotation = getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
|
|
56045
|
+
if (annotation) {
|
|
56046
|
+
const result = tryReuseExistingTypeNode(context, annotation, type, context.enclosingDeclaration);
|
|
56016
56047
|
if (result) {
|
|
56017
56048
|
return result;
|
|
56018
56049
|
}
|
|
@@ -56506,7 +56537,10 @@ function createTypeChecker(host) {
|
|
|
56506
56537
|
);
|
|
56507
56538
|
}
|
|
56508
56539
|
if (isNamedDeclaration(node) && node.name.kind === 167 /* ComputedPropertyName */ && !isLateBindableName(node.name)) {
|
|
56509
|
-
if (!
|
|
56540
|
+
if (!hasDynamicName(node)) {
|
|
56541
|
+
return visitEachChild2(node, visitExistingNodeTreeSymbols);
|
|
56542
|
+
}
|
|
56543
|
+
if (!(context.flags & 1 /* AllowUnresolvedNames */ && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
|
|
56510
56544
|
return void 0;
|
|
56511
56545
|
}
|
|
56512
56546
|
}
|
|
@@ -62597,7 +62631,7 @@ function createTypeChecker(host) {
|
|
|
62597
62631
|
);
|
|
62598
62632
|
}
|
|
62599
62633
|
function createSignatureTypeMapper(signature, typeArguments) {
|
|
62600
|
-
return createTypeMapper(signature.typeParameters, typeArguments);
|
|
62634
|
+
return createTypeMapper(sameMap(signature.typeParameters, (tp) => tp.mapper ? instantiateType(tp, tp.mapper) : tp), typeArguments);
|
|
62601
62635
|
}
|
|
62602
62636
|
function getErasedSignature(signature) {
|
|
62603
62637
|
return signature.typeParameters ? signature.erasedSignatureCache || (signature.erasedSignatureCache = createErasedSignature(signature)) : signature;
|
|
@@ -115744,6 +115778,7 @@ function transformDeclarations(context) {
|
|
|
115744
115778
|
}
|
|
115745
115779
|
function reportInferenceFallback(node) {
|
|
115746
115780
|
if (!isolatedDeclarations || isSourceFileJS(currentSourceFile)) return;
|
|
115781
|
+
if (getSourceFileOfNode(node) !== currentSourceFile) return;
|
|
115747
115782
|
if (isVariableDeclaration(node) && resolver.isExpandoFunctionDeclaration(node)) {
|
|
115748
115783
|
reportExpandoFunctionErrors(node);
|
|
115749
115784
|
} else {
|
|
@@ -124299,7 +124334,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124299
124334
|
const newFile = getSourceFileByPath(oldSourceFile.resolvedPath);
|
|
124300
124335
|
if (shouldCreateNewSourceFile || !newFile || newFile.impliedNodeFormat !== oldSourceFile.impliedNodeFormat || // old file wasn't redirect but new file is
|
|
124301
124336
|
oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path) {
|
|
124302
|
-
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path));
|
|
124337
|
+
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path), newFile);
|
|
124303
124338
|
}
|
|
124304
124339
|
}
|
|
124305
124340
|
if (!host.getParsedCommandLine) {
|
|
@@ -124309,7 +124344,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124309
124344
|
resolvedProjectReference.sourceFile,
|
|
124310
124345
|
oldProgram.getCompilerOptions(),
|
|
124311
124346
|
/*hasSourceFileByPath*/
|
|
124312
|
-
false
|
|
124347
|
+
false,
|
|
124348
|
+
/*newSourceFileByResolvedPath*/
|
|
124349
|
+
void 0
|
|
124313
124350
|
);
|
|
124314
124351
|
}
|
|
124315
124352
|
});
|
|
@@ -130065,11 +130102,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
130065
130102
|
);
|
|
130066
130103
|
} else if (packageDirWatcher.isSymlink !== isSymlink) {
|
|
130067
130104
|
packageDirWatcher.dirPathToWatcher.forEach((watcher) => {
|
|
130068
|
-
removeDirectoryWatcher(
|
|
130069
|
-
packageDirWatcher.isSymlink ? packageDirPath : dirPath,
|
|
130070
|
-
/*syncDirWatcherRemove*/
|
|
130071
|
-
false
|
|
130072
|
-
);
|
|
130105
|
+
removeDirectoryWatcher(packageDirWatcher.isSymlink ? packageDirPath : dirPath);
|
|
130073
130106
|
watcher.watcher = createDirPathToWatcher();
|
|
130074
130107
|
});
|
|
130075
130108
|
packageDirWatcher.isSymlink = isSymlink;
|
|
@@ -130109,7 +130142,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
130109
130142
|
}
|
|
130110
130143
|
return dirWatcher;
|
|
130111
130144
|
}
|
|
130112
|
-
function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot
|
|
130145
|
+
function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot) {
|
|
130113
130146
|
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
130114
130147
|
const toWatch = getDirectoryToWatchFailedLookupLocation(
|
|
130115
130148
|
failedLookupLocation,
|
|
@@ -130129,7 +130162,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
130129
130162
|
const forDirPath = packageDirWatcher.dirPathToWatcher.get(dirPath);
|
|
130130
130163
|
forDirPath.refCount--;
|
|
130131
130164
|
if (forDirPath.refCount === 0) {
|
|
130132
|
-
removeDirectoryWatcher(packageDirWatcher.isSymlink ? packageDirPath : dirPath
|
|
130165
|
+
removeDirectoryWatcher(packageDirWatcher.isSymlink ? packageDirPath : dirPath);
|
|
130133
130166
|
packageDirWatcher.dirPathToWatcher.delete(dirPath);
|
|
130134
130167
|
if (packageDirWatcher.isSymlink) {
|
|
130135
130168
|
const refCount = dirPathToSymlinkPackageRefCount.get(dirPath) - 1;
|
|
@@ -130139,15 +130172,14 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
130139
130172
|
dirPathToSymlinkPackageRefCount.set(dirPath, refCount);
|
|
130140
130173
|
}
|
|
130141
130174
|
}
|
|
130142
|
-
if (syncDirWatcherRemove) closePackageDirWatcher(packageDirWatcher, packageDirPath);
|
|
130143
130175
|
}
|
|
130144
130176
|
} else {
|
|
130145
|
-
removeDirectoryWatcher(dirPath
|
|
130177
|
+
removeDirectoryWatcher(dirPath);
|
|
130146
130178
|
}
|
|
130147
130179
|
}
|
|
130148
130180
|
return removeAtRoot;
|
|
130149
130181
|
}
|
|
130150
|
-
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName
|
|
130182
|
+
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
|
|
130151
130183
|
Debug.checkDefined(resolution.files).delete(filePath);
|
|
130152
130184
|
if (resolution.files.size) return;
|
|
130153
130185
|
resolution.files = void 0;
|
|
@@ -130162,11 +130194,11 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
130162
130194
|
let removeAtRoot = false;
|
|
130163
130195
|
if (failedLookupLocations) {
|
|
130164
130196
|
for (const failedLookupLocation of failedLookupLocations) {
|
|
130165
|
-
removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot
|
|
130197
|
+
removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot);
|
|
130166
130198
|
}
|
|
130167
130199
|
}
|
|
130168
|
-
if (alternateResult) removeAtRoot = stopWatchFailedLookupLocation(alternateResult, removeAtRoot
|
|
130169
|
-
if (removeAtRoot) removeDirectoryWatcher(rootPath
|
|
130200
|
+
if (alternateResult) removeAtRoot = stopWatchFailedLookupLocation(alternateResult, removeAtRoot);
|
|
130201
|
+
if (removeAtRoot) removeDirectoryWatcher(rootPath);
|
|
130170
130202
|
} else if (affectingLocations == null ? void 0 : affectingLocations.length) {
|
|
130171
130203
|
resolutionsWithOnlyAffectingLocations.delete(resolution);
|
|
130172
130204
|
}
|
|
@@ -130174,14 +130206,12 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
130174
130206
|
for (const affectingLocation of affectingLocations) {
|
|
130175
130207
|
const watcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
130176
130208
|
watcher.resolutions--;
|
|
130177
|
-
if (syncDirWatcherRemove) closeFileWatcherOfAffectingLocation(watcher, affectingLocation);
|
|
130178
130209
|
}
|
|
130179
130210
|
}
|
|
130180
130211
|
}
|
|
130181
|
-
function removeDirectoryWatcher(dirPath
|
|
130212
|
+
function removeDirectoryWatcher(dirPath) {
|
|
130182
130213
|
const dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
130183
130214
|
dirWatcher.refCount--;
|
|
130184
|
-
if (syncDirWatcherRemove) closeDirectoryWatchesOfFailedLookup(dirWatcher, dirPath);
|
|
130185
130215
|
}
|
|
130186
130216
|
function createDirectoryWatcher(directory, dirPath, nonRecursive) {
|
|
130187
130217
|
return resolutionHost.watchDirectoryOfFailedLookupLocation(directory, (fileOrDirectory) => {
|
|
@@ -130192,15 +130222,14 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
130192
130222
|
scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
|
|
130193
130223
|
}, nonRecursive ? 0 /* None */ : 1 /* Recursive */);
|
|
130194
130224
|
}
|
|
130195
|
-
function removeResolutionsOfFileFromCache(cache, filePath, getResolutionWithResolvedFileName
|
|
130225
|
+
function removeResolutionsOfFileFromCache(cache, filePath, getResolutionWithResolvedFileName) {
|
|
130196
130226
|
const resolutions = cache.get(filePath);
|
|
130197
130227
|
if (resolutions) {
|
|
130198
130228
|
resolutions.forEach(
|
|
130199
130229
|
(resolution) => stopWatchFailedLookupLocationOfResolution(
|
|
130200
130230
|
resolution,
|
|
130201
130231
|
filePath,
|
|
130202
|
-
getResolutionWithResolvedFileName
|
|
130203
|
-
syncDirWatcherRemove
|
|
130232
|
+
getResolutionWithResolvedFileName
|
|
130204
130233
|
)
|
|
130205
130234
|
);
|
|
130206
130235
|
cache.delete(filePath);
|
|
@@ -130214,9 +130243,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
130214
130243
|
if (!resolvedProjectReference) return;
|
|
130215
130244
|
resolvedProjectReference.commandLine.fileNames.forEach((f) => removeResolutionsOfFile(resolutionHost.toPath(f)));
|
|
130216
130245
|
}
|
|
130217
|
-
function removeResolutionsOfFile(filePath
|
|
130218
|
-
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModuleFromResolution
|
|
130219
|
-
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirectiveFromResolution
|
|
130246
|
+
function removeResolutionsOfFile(filePath) {
|
|
130247
|
+
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModuleFromResolution);
|
|
130248
|
+
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirectiveFromResolution);
|
|
130220
130249
|
}
|
|
130221
130250
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
130222
130251
|
if (!resolutions) return false;
|
|
@@ -148116,9 +148145,9 @@ var NodeObject = class {
|
|
|
148116
148145
|
getChildAt(index, sourceFile) {
|
|
148117
148146
|
return this.getChildren(sourceFile)[index];
|
|
148118
148147
|
}
|
|
148119
|
-
getChildren(sourceFile) {
|
|
148148
|
+
getChildren(sourceFile = getSourceFileOfNode(this)) {
|
|
148120
148149
|
this.assertHasRealPosition("Node without a real position cannot be scanned and thus has no token nodes - use forEachChild and collect the result if that's fine");
|
|
148121
|
-
return getNodeChildren(this) ?? setNodeChildren(this, createChildren(this, sourceFile));
|
|
148150
|
+
return getNodeChildren(this, sourceFile) ?? setNodeChildren(this, sourceFile, createChildren(this, sourceFile));
|
|
148122
148151
|
}
|
|
148123
148152
|
getFirstToken(sourceFile) {
|
|
148124
148153
|
this.assertHasRealPosition();
|
|
@@ -148199,7 +148228,7 @@ function createSyntaxList(nodes, parent2) {
|
|
|
148199
148228
|
pos = node.end;
|
|
148200
148229
|
}
|
|
148201
148230
|
addSyntheticNodes(children, pos, nodes.end, parent2);
|
|
148202
|
-
|
|
148231
|
+
list._children = children;
|
|
148203
148232
|
return list;
|
|
148204
148233
|
}
|
|
148205
148234
|
var TokenOrIdentifierObject = class {
|
|
@@ -149138,13 +149167,18 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
149138
149167
|
if (host.getParsedCommandLine) {
|
|
149139
149168
|
(_a3 = host.onReleaseParsedCommandLine) == null ? void 0 : _a3.call(host, configFileName, oldResolvedRef, oldOptions);
|
|
149140
149169
|
} else if (oldResolvedRef) {
|
|
149141
|
-
|
|
149170
|
+
releaseOldSourceFile(oldResolvedRef.sourceFile, oldOptions);
|
|
149142
149171
|
}
|
|
149143
149172
|
}
|
|
149144
|
-
function
|
|
149173
|
+
function releaseOldSourceFile(oldSourceFile, oldOptions) {
|
|
149145
149174
|
const oldSettingsKey = documentRegistry.getKeyForCompilationSettings(oldOptions);
|
|
149146
149175
|
documentRegistry.releaseDocumentWithKey(oldSourceFile.resolvedPath, oldSettingsKey, oldSourceFile.scriptKind, oldSourceFile.impliedNodeFormat);
|
|
149147
149176
|
}
|
|
149177
|
+
function onReleaseOldSourceFile(oldSourceFile, oldOptions, hasSourceFileByPath, newSourceFileByResolvedPath) {
|
|
149178
|
+
var _a3;
|
|
149179
|
+
releaseOldSourceFile(oldSourceFile, oldOptions);
|
|
149180
|
+
(_a3 = host.onReleaseOldSourceFile) == null ? void 0 : _a3.call(host, oldSourceFile, oldOptions, hasSourceFileByPath, newSourceFileByResolvedPath);
|
|
149181
|
+
}
|
|
149148
149182
|
function getOrCreateSourceFile(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) {
|
|
149149
149183
|
return getOrCreateSourceFileByPath(fileName, toPath(fileName, currentDirectory, getCanonicalFileName), languageVersionOrOptions, onError, shouldCreateNewSourceFile);
|
|
149150
149184
|
}
|
|
@@ -167947,7 +167981,7 @@ function getContainingModuleSymbol(importer, checker) {
|
|
|
167947
167981
|
return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol);
|
|
167948
167982
|
}
|
|
167949
167983
|
function getSourceFileLikeForImportDeclaration(node) {
|
|
167950
|
-
if (node.kind === 213 /* CallExpression */) {
|
|
167984
|
+
if (node.kind === 213 /* CallExpression */ || node.kind === 351 /* JSDocImportTag */) {
|
|
167951
167985
|
return node.getSourceFile();
|
|
167952
167986
|
}
|
|
167953
167987
|
const { parent: parent2 } = node;
|
|
@@ -178404,8 +178438,9 @@ function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, pr
|
|
|
178404
178438
|
const { pos, end } = pasteLocations[i];
|
|
178405
178439
|
newText = actualPastedText ? newText.slice(0, pos) + actualPastedText[0] + newText.slice(end) : newText.slice(0, pos) + pastedText[i] + newText.slice(end);
|
|
178406
178440
|
}
|
|
178441
|
+
let importAdder;
|
|
178407
178442
|
Debug.checkDefined(host.runWithTemporaryFileUpdate).call(host, targetFile.fileName, newText, (updatedProgram, originalProgram, updatedFile) => {
|
|
178408
|
-
|
|
178443
|
+
importAdder = ts_codefix_exports.createImportAdder(updatedFile, updatedProgram, preferences, host);
|
|
178409
178444
|
if (copiedFrom == null ? void 0 : copiedFrom.range) {
|
|
178410
178445
|
Debug.assert(copiedFrom.range.length === pastedText.length);
|
|
178411
178446
|
copiedFrom.range.forEach((copy) => {
|
|
@@ -178452,6 +178487,9 @@ function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, pr
|
|
|
178452
178487
|
}
|
|
178453
178488
|
importAdder.writeFixes(changes, getQuotePreference(copiedFrom ? copiedFrom.file : targetFile, preferences));
|
|
178454
178489
|
});
|
|
178490
|
+
if (!importAdder.hasFixes()) {
|
|
178491
|
+
return;
|
|
178492
|
+
}
|
|
178455
178493
|
pasteLocations.forEach((paste, i) => {
|
|
178456
178494
|
changes.replaceRangeWithText(
|
|
178457
178495
|
targetFile,
|
|
@@ -180571,6 +180609,7 @@ __export(ts_exports2, {
|
|
|
180571
180609
|
trace: () => trace,
|
|
180572
180610
|
tracing: () => tracing,
|
|
180573
180611
|
tracingEnabled: () => tracingEnabled,
|
|
180612
|
+
transferSourceFileChildren: () => transferSourceFileChildren,
|
|
180574
180613
|
transform: () => transform,
|
|
180575
180614
|
transformClassFields: () => transformClassFields,
|
|
180576
180615
|
transformDeclarations: () => transformDeclarations,
|
|
@@ -183084,6 +183123,12 @@ var Project2 = class _Project {
|
|
|
183084
183123
|
this.hasAddedOrRemovedSymlinks = true;
|
|
183085
183124
|
}
|
|
183086
183125
|
/** @internal */
|
|
183126
|
+
onReleaseOldSourceFile(oldSourceFile, _oldOptions, hasSourceFileByPath, newSourceFileByResolvedPath) {
|
|
183127
|
+
if (!newSourceFileByResolvedPath || oldSourceFile.resolvedPath === oldSourceFile.path && newSourceFileByResolvedPath.resolvedPath !== oldSourceFile.path) {
|
|
183128
|
+
this.detachScriptInfoFromProject(oldSourceFile.fileName, hasSourceFileByPath);
|
|
183129
|
+
}
|
|
183130
|
+
}
|
|
183131
|
+
/** @internal */
|
|
183087
183132
|
updateFromProject() {
|
|
183088
183133
|
updateProjectIfDirty(this);
|
|
183089
183134
|
}
|
|
@@ -183267,30 +183312,6 @@ var Project2 = class _Project {
|
|
|
183267
183312
|
let hasNewProgram = false;
|
|
183268
183313
|
if (this.program && (!oldProgram || this.program !== oldProgram && this.program.structureIsReused !== 2 /* Completely */)) {
|
|
183269
183314
|
hasNewProgram = true;
|
|
183270
|
-
if (oldProgram) {
|
|
183271
|
-
for (const f of oldProgram.getSourceFiles()) {
|
|
183272
|
-
const newFile = this.program.getSourceFileByPath(f.resolvedPath);
|
|
183273
|
-
if (!newFile || f.resolvedPath === f.path && newFile.resolvedPath !== f.path) {
|
|
183274
|
-
this.detachScriptInfoFromProject(
|
|
183275
|
-
f.fileName,
|
|
183276
|
-
!!this.program.getSourceFileByPath(f.path),
|
|
183277
|
-
/*syncDirWatcherRemove*/
|
|
183278
|
-
true
|
|
183279
|
-
);
|
|
183280
|
-
}
|
|
183281
|
-
}
|
|
183282
|
-
oldProgram.forEachResolvedProjectReference((resolvedProjectReference) => {
|
|
183283
|
-
if (!this.program.getResolvedProjectReferenceByPath(resolvedProjectReference.sourceFile.path)) {
|
|
183284
|
-
this.detachScriptInfoFromProject(
|
|
183285
|
-
resolvedProjectReference.sourceFile.fileName,
|
|
183286
|
-
/*noRemoveResolution*/
|
|
183287
|
-
void 0,
|
|
183288
|
-
/*syncDirWatcherRemove*/
|
|
183289
|
-
true
|
|
183290
|
-
);
|
|
183291
|
-
}
|
|
183292
|
-
});
|
|
183293
|
-
}
|
|
183294
183315
|
this.rootFilesMap.forEach((value, path) => {
|
|
183295
183316
|
var _a2;
|
|
183296
183317
|
const file = this.program.getSourceFileByPath(path);
|
|
@@ -183415,12 +183436,12 @@ var Project2 = class _Project {
|
|
|
183415
183436
|
sendPerformanceEvent(kind, durationMs) {
|
|
183416
183437
|
this.projectService.sendPerformanceEvent(kind, durationMs);
|
|
183417
183438
|
}
|
|
183418
|
-
detachScriptInfoFromProject(uncheckedFileName, noRemoveResolution
|
|
183439
|
+
detachScriptInfoFromProject(uncheckedFileName, noRemoveResolution) {
|
|
183419
183440
|
const scriptInfoToDetach = this.projectService.getScriptInfo(uncheckedFileName);
|
|
183420
183441
|
if (scriptInfoToDetach) {
|
|
183421
183442
|
scriptInfoToDetach.detachFromProject(this);
|
|
183422
183443
|
if (!noRemoveResolution) {
|
|
183423
|
-
this.resolutionCache.removeResolutionsOfFile(scriptInfoToDetach.path
|
|
183444
|
+
this.resolutionCache.removeResolutionsOfFile(scriptInfoToDetach.path);
|
|
183424
183445
|
}
|
|
183425
183446
|
}
|
|
183426
183447
|
}
|
|
@@ -194946,6 +194967,7 @@ if (typeof console !== "undefined") {
|
|
|
194946
194967
|
trace,
|
|
194947
194968
|
tracing,
|
|
194948
194969
|
tracingEnabled,
|
|
194970
|
+
transferSourceFileChildren,
|
|
194949
194971
|
transform,
|
|
194950
194972
|
transformClassFields,
|
|
194951
194973
|
transformDeclarations,
|
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.6.0-dev.
|
|
5
|
+
"version": "5.6.0-dev.20240710",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"globals": "^13.24.0",
|
|
69
69
|
"hereby": "^1.8.9",
|
|
70
70
|
"jsonc-parser": "^3.3.1",
|
|
71
|
-
"knip": "^5.
|
|
71
|
+
"knip": "^5.25.1",
|
|
72
72
|
"minimist": "^1.2.8",
|
|
73
73
|
"mocha": "^10.5.2",
|
|
74
74
|
"mocha-fivemat-progress-reporter": "^0.1.0",
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"node": "20.1.0",
|
|
114
114
|
"npm": "8.19.4"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "a6a0f4ad58fc0d1a66c4a844dbeb53a855c13ab5"
|
|
117
117
|
}
|