Skip to content

Commit 51edf13

Browse files
committed
Update LKG
1 parent 2451fff commit 51edf13

File tree

5 files changed

+103
-15
lines changed

5 files changed

+103
-15
lines changed

lib/tsc.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63104,8 +63104,9 @@ var ts;
6310463104
if (isInDirectoryPath(rootPath, failedLookupLocationPath)) {
6310563105
return { dir: rootDir, dirPath: rootPath };
6310663106
}
63107-
var dir = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory()));
63108-
var dirPath = ts.getDirectoryPath(failedLookupLocationPath);
63107+
return getDirectoryToWatchFromFailedLookupLocationDirectory(ts.getDirectoryPath(ts.getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory())), ts.getDirectoryPath(failedLookupLocationPath));
63108+
}
63109+
function getDirectoryToWatchFromFailedLookupLocationDirectory(dir, dirPath) {
6310963110
while (ts.stringContains(dirPath, "/node_modules/")) {
6311063111
dir = ts.getDirectoryPath(dir);
6311163112
dirPath = ts.getDirectoryPath(dirPath);
@@ -63307,13 +63308,27 @@ var ts;
6330763308
function closeTypeRootsWatch() {
6330863309
ts.clearMap(typeRootsWatches, ts.closeFileWatcher);
6330963310
}
63310-
function createTypeRootsWatch(_typeRootPath, typeRoot) {
63311+
function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath) {
63312+
if (allFilesHaveInvalidatedResolution) {
63313+
return undefined;
63314+
}
63315+
if (isInDirectoryPath(rootPath, typeRootPath)) {
63316+
return rootPath;
63317+
}
63318+
var _a = getDirectoryToWatchFromFailedLookupLocationDirectory(typeRoot, typeRootPath), dirPath = _a.dirPath, ignore = _a.ignore;
63319+
return !ignore && directoryWatchesOfFailedLookups.has(dirPath) && dirPath;
63320+
}
63321+
function createTypeRootsWatch(typeRootPath, typeRoot) {
6331163322
return resolutionHost.watchTypeRootsDirectory(typeRoot, function (fileOrDirectory) {
6331263323
var fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
6331363324
if (cachedDirectoryStructureHost) {
6331463325
cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
6331563326
}
6331663327
resolutionHost.onChangedAutomaticTypeDirectiveNames();
63328+
var dirPath = getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath);
63329+
if (dirPath && invalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath)) {
63330+
resolutionHost.onInvalidatedResolution();
63331+
}
6331763332
}, 1);
6331863333
}
6331963334
function updateTypeRootsWatch() {

lib/tsserver.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79274,6 +79274,7 @@ var ts;
7927479274
if (!newClassDeclaration) {
7927579275
return undefined;
7927679276
}
79277+
copyComments(ctorDeclaration, newClassDeclaration, sourceFile);
7927779278
changes.insertNodeAfter(sourceFile, precedingNode, newClassDeclaration);
7927879279
for (var _i = 0, deletes_1 = deletes; _i < deletes_1.length; _i++) {
7927979280
var deleteCallback = deletes_1[_i];
@@ -87032,8 +87033,9 @@ var ts;
8703287033
if (isInDirectoryPath(rootPath, failedLookupLocationPath)) {
8703387034
return { dir: rootDir, dirPath: rootPath };
8703487035
}
87035-
var dir = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory()));
87036-
var dirPath = ts.getDirectoryPath(failedLookupLocationPath);
87036+
return getDirectoryToWatchFromFailedLookupLocationDirectory(ts.getDirectoryPath(ts.getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory())), ts.getDirectoryPath(failedLookupLocationPath));
87037+
}
87038+
function getDirectoryToWatchFromFailedLookupLocationDirectory(dir, dirPath) {
8703787039
while (ts.stringContains(dirPath, "/node_modules/")) {
8703887040
dir = ts.getDirectoryPath(dir);
8703987041
dirPath = ts.getDirectoryPath(dirPath);
@@ -87235,13 +87237,27 @@ var ts;
8723587237
function closeTypeRootsWatch() {
8723687238
ts.clearMap(typeRootsWatches, ts.closeFileWatcher);
8723787239
}
87238-
function createTypeRootsWatch(_typeRootPath, typeRoot) {
87240+
function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath) {
87241+
if (allFilesHaveInvalidatedResolution) {
87242+
return undefined;
87243+
}
87244+
if (isInDirectoryPath(rootPath, typeRootPath)) {
87245+
return rootPath;
87246+
}
87247+
var _a = getDirectoryToWatchFromFailedLookupLocationDirectory(typeRoot, typeRootPath), dirPath = _a.dirPath, ignore = _a.ignore;
87248+
return !ignore && directoryWatchesOfFailedLookups.has(dirPath) && dirPath;
87249+
}
87250+
function createTypeRootsWatch(typeRootPath, typeRoot) {
8723987251
return resolutionHost.watchTypeRootsDirectory(typeRoot, function (fileOrDirectory) {
8724087252
var fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
8724187253
if (cachedDirectoryStructureHost) {
8724287254
cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
8724387255
}
8724487256
resolutionHost.onChangedAutomaticTypeDirectiveNames();
87257+
var dirPath = getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath);
87258+
if (dirPath && invalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath)) {
87259+
resolutionHost.onInvalidatedResolution();
87260+
}
8724587261
}, 1);
8724687262
}
8724787263
function updateTypeRootsWatch() {

lib/tsserverlibrary.js

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94589,6 +94589,7 @@ var ts;
9458994589
this.changes.push({ kind: ChangeKind.Remove, sourceFile: sourceFile, range: range });
9459094590
return this;
9459194591
};
94592+
/** Warning: This deletes comments too. See `copyComments` in `convertFunctionToEs6Class`. */
9459294593
ChangeTracker.prototype.deleteNode = function (sourceFile, node, options) {
9459394594
if (options === void 0) { options = {}; }
9459494595
var startPosition = getAdjustedStartPosition(sourceFile, node, options, Position.FullStart);
@@ -95585,6 +95586,7 @@ var ts;
9558595586
if (!newClassDeclaration) {
9558695587
return undefined;
9558795588
}
95589+
copyComments(ctorDeclaration, newClassDeclaration, sourceFile);
9558895590
// Because the preceding node could be touched, we need to insert nodes before delete nodes.
9558995591
changes.insertNodeAfter(sourceFile, precedingNode, newClassDeclaration);
9559095592
for (var _i = 0, deletes_1 = deletes; _i < deletes_1.length; _i++) {
@@ -106407,8 +106409,9 @@ var ts;
106407106409
if (isInDirectoryPath(rootPath, failedLookupLocationPath)) {
106408106410
return { dir: rootDir, dirPath: rootPath };
106409106411
}
106410-
var dir = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory()));
106411-
var dirPath = ts.getDirectoryPath(failedLookupLocationPath);
106412+
return getDirectoryToWatchFromFailedLookupLocationDirectory(ts.getDirectoryPath(ts.getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory())), ts.getDirectoryPath(failedLookupLocationPath));
106413+
}
106414+
function getDirectoryToWatchFromFailedLookupLocationDirectory(dir, dirPath) {
106412106415
// If directory path contains node module, get the most parent node_modules directory for watching
106413106416
while (ts.stringContains(dirPath, "/node_modules/")) {
106414106417
dir = ts.getDirectoryPath(dir);
@@ -106635,7 +106638,17 @@ var ts;
106635106638
function closeTypeRootsWatch() {
106636106639
ts.clearMap(typeRootsWatches, ts.closeFileWatcher);
106637106640
}
106638-
function createTypeRootsWatch(_typeRootPath, typeRoot) {
106641+
function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath) {
106642+
if (allFilesHaveInvalidatedResolution) {
106643+
return undefined;
106644+
}
106645+
if (isInDirectoryPath(rootPath, typeRootPath)) {
106646+
return rootPath;
106647+
}
106648+
var _a = getDirectoryToWatchFromFailedLookupLocationDirectory(typeRoot, typeRootPath), dirPath = _a.dirPath, ignore = _a.ignore;
106649+
return !ignore && directoryWatchesOfFailedLookups.has(dirPath) && dirPath;
106650+
}
106651+
function createTypeRootsWatch(typeRootPath, typeRoot) {
106639106652
// Create new watch and recursive info
106640106653
return resolutionHost.watchTypeRootsDirectory(typeRoot, function (fileOrDirectory) {
106641106654
var fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
@@ -106647,6 +106660,12 @@ var ts;
106647106660
// We could potentially store more data here about whether it was/would be really be used or not
106648106661
// and with that determine to trigger compilation but for now this is enough
106649106662
resolutionHost.onChangedAutomaticTypeDirectiveNames();
106663+
// Since directory watchers invoked are flaky, the failed lookup location events might not be triggered
106664+
// So handle to failed lookup locations here as well to ensure we are invalidating resolutions
106665+
var dirPath = getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath);
106666+
if (dirPath && invalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath)) {
106667+
resolutionHost.onInvalidatedResolution();
106668+
}
106650106669
}, 1 /* Recursive */);
106651106670
}
106652106671
/**

lib/typescript.js

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78594,8 +78594,9 @@ var ts;
7859478594
if (isInDirectoryPath(rootPath, failedLookupLocationPath)) {
7859578595
return { dir: rootDir, dirPath: rootPath };
7859678596
}
78597-
var dir = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory()));
78598-
var dirPath = ts.getDirectoryPath(failedLookupLocationPath);
78597+
return getDirectoryToWatchFromFailedLookupLocationDirectory(ts.getDirectoryPath(ts.getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory())), ts.getDirectoryPath(failedLookupLocationPath));
78598+
}
78599+
function getDirectoryToWatchFromFailedLookupLocationDirectory(dir, dirPath) {
7859978600
// If directory path contains node module, get the most parent node_modules directory for watching
7860078601
while (ts.stringContains(dirPath, "/node_modules/")) {
7860178602
dir = ts.getDirectoryPath(dir);
@@ -78822,7 +78823,17 @@ var ts;
7882278823
function closeTypeRootsWatch() {
7882378824
ts.clearMap(typeRootsWatches, ts.closeFileWatcher);
7882478825
}
78825-
function createTypeRootsWatch(_typeRootPath, typeRoot) {
78826+
function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath) {
78827+
if (allFilesHaveInvalidatedResolution) {
78828+
return undefined;
78829+
}
78830+
if (isInDirectoryPath(rootPath, typeRootPath)) {
78831+
return rootPath;
78832+
}
78833+
var _a = getDirectoryToWatchFromFailedLookupLocationDirectory(typeRoot, typeRootPath), dirPath = _a.dirPath, ignore = _a.ignore;
78834+
return !ignore && directoryWatchesOfFailedLookups.has(dirPath) && dirPath;
78835+
}
78836+
function createTypeRootsWatch(typeRootPath, typeRoot) {
7882678837
// Create new watch and recursive info
7882778838
return resolutionHost.watchTypeRootsDirectory(typeRoot, function (fileOrDirectory) {
7882878839
var fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
@@ -78834,6 +78845,12 @@ var ts;
7883478845
// We could potentially store more data here about whether it was/would be really be used or not
7883578846
// and with that determine to trigger compilation but for now this is enough
7883678847
resolutionHost.onChangedAutomaticTypeDirectiveNames();
78848+
// Since directory watchers invoked are flaky, the failed lookup location events might not be triggered
78849+
// So handle to failed lookup locations here as well to ensure we are invalidating resolutions
78850+
var dirPath = getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath);
78851+
if (dirPath && invalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath)) {
78852+
resolutionHost.onInvalidatedResolution();
78853+
}
7883778854
}, 1 /* Recursive */);
7883878855
}
7883978856
/**
@@ -96151,6 +96168,7 @@ var ts;
9615196168
this.changes.push({ kind: ChangeKind.Remove, sourceFile: sourceFile, range: range });
9615296169
return this;
9615396170
};
96171+
/** Warning: This deletes comments too. See `copyComments` in `convertFunctionToEs6Class`. */
9615496172
ChangeTracker.prototype.deleteNode = function (sourceFile, node, options) {
9615596173
if (options === void 0) { options = {}; }
9615696174
var startPosition = getAdjustedStartPosition(sourceFile, node, options, Position.FullStart);
@@ -97147,6 +97165,7 @@ var ts;
9714797165
if (!newClassDeclaration) {
9714897166
return undefined;
9714997167
}
97168+
copyComments(ctorDeclaration, newClassDeclaration, sourceFile);
9715097169
// Because the preceding node could be touched, we need to insert nodes before delete nodes.
9715197170
changes.insertNodeAfter(sourceFile, precedingNode, newClassDeclaration);
9715297171
for (var _i = 0, deletes_1 = deletes; _i < deletes_1.length; _i++) {

lib/typescriptServices.js

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78594,8 +78594,9 @@ var ts;
7859478594
if (isInDirectoryPath(rootPath, failedLookupLocationPath)) {
7859578595
return { dir: rootDir, dirPath: rootPath };
7859678596
}
78597-
var dir = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory()));
78598-
var dirPath = ts.getDirectoryPath(failedLookupLocationPath);
78597+
return getDirectoryToWatchFromFailedLookupLocationDirectory(ts.getDirectoryPath(ts.getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory())), ts.getDirectoryPath(failedLookupLocationPath));
78598+
}
78599+
function getDirectoryToWatchFromFailedLookupLocationDirectory(dir, dirPath) {
7859978600
// If directory path contains node module, get the most parent node_modules directory for watching
7860078601
while (ts.stringContains(dirPath, "/node_modules/")) {
7860178602
dir = ts.getDirectoryPath(dir);
@@ -78822,7 +78823,17 @@ var ts;
7882278823
function closeTypeRootsWatch() {
7882378824
ts.clearMap(typeRootsWatches, ts.closeFileWatcher);
7882478825
}
78825-
function createTypeRootsWatch(_typeRootPath, typeRoot) {
78826+
function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath) {
78827+
if (allFilesHaveInvalidatedResolution) {
78828+
return undefined;
78829+
}
78830+
if (isInDirectoryPath(rootPath, typeRootPath)) {
78831+
return rootPath;
78832+
}
78833+
var _a = getDirectoryToWatchFromFailedLookupLocationDirectory(typeRoot, typeRootPath), dirPath = _a.dirPath, ignore = _a.ignore;
78834+
return !ignore && directoryWatchesOfFailedLookups.has(dirPath) && dirPath;
78835+
}
78836+
function createTypeRootsWatch(typeRootPath, typeRoot) {
7882678837
// Create new watch and recursive info
7882778838
return resolutionHost.watchTypeRootsDirectory(typeRoot, function (fileOrDirectory) {
7882878839
var fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
@@ -78834,6 +78845,12 @@ var ts;
7883478845
// We could potentially store more data here about whether it was/would be really be used or not
7883578846
// and with that determine to trigger compilation but for now this is enough
7883678847
resolutionHost.onChangedAutomaticTypeDirectiveNames();
78848+
// Since directory watchers invoked are flaky, the failed lookup location events might not be triggered
78849+
// So handle to failed lookup locations here as well to ensure we are invalidating resolutions
78850+
var dirPath = getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath);
78851+
if (dirPath && invalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath)) {
78852+
resolutionHost.onInvalidatedResolution();
78853+
}
7883778854
}, 1 /* Recursive */);
7883878855
}
7883978856
/**
@@ -96151,6 +96168,7 @@ var ts;
9615196168
this.changes.push({ kind: ChangeKind.Remove, sourceFile: sourceFile, range: range });
9615296169
return this;
9615396170
};
96171+
/** Warning: This deletes comments too. See `copyComments` in `convertFunctionToEs6Class`. */
9615496172
ChangeTracker.prototype.deleteNode = function (sourceFile, node, options) {
9615596173
if (options === void 0) { options = {}; }
9615696174
var startPosition = getAdjustedStartPosition(sourceFile, node, options, Position.FullStart);
@@ -97147,6 +97165,7 @@ var ts;
9714797165
if (!newClassDeclaration) {
9714897166
return undefined;
9714997167
}
97168+
copyComments(ctorDeclaration, newClassDeclaration, sourceFile);
9715097169
// Because the preceding node could be touched, we need to insert nodes before delete nodes.
9715197170
changes.insertNodeAfter(sourceFile, precedingNode, newClassDeclaration);
9715297171
for (var _i = 0, deletes_1 = deletes; _i < deletes_1.length; _i++) {

0 commit comments

Comments
 (0)