typescript 4.7.0-dev.20220319 → 4.7.0-dev.20220322

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/tsserver.js CHANGED
@@ -100,7 +100,7 @@ var ts;
100
100
  // The following is baselined as a literal template type without intervention
101
101
  /** The version of the TypeScript compiler release */
102
102
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
103
- ts.version = ts.versionMajorMinor + ".0-dev.20220319";
103
+ ts.version = ts.versionMajorMinor + ".0-dev.20220322";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -127954,7 +127954,7 @@ var ts;
127954
127954
  packageName = ts.unmangleScopedPackageName(ts.getPackageNameFromTypesPackageName(moduleFile.fileName.substring(topLevelPackageNameIndex + 1, packageRootIndex)));
127955
127955
  if (ts.startsWith(importingFile, moduleFile.path.substring(0, topLevelNodeModulesIndex))) {
127956
127956
  var prevDeepestNodeModulesPath = packages.get(packageName);
127957
- var nodeModulesPath = moduleFile.fileName.substring(0, topLevelPackageNameIndex);
127957
+ var nodeModulesPath = moduleFile.fileName.substring(0, topLevelPackageNameIndex + 1);
127958
127958
  if (prevDeepestNodeModulesPath) {
127959
127959
  var prevDeepestNodeModulesIndex = prevDeepestNodeModulesPath.indexOf(ts.nodeModulesPathPart);
127960
127960
  if (topLevelNodeModulesIndex > prevDeepestNodeModulesIndex) {
@@ -128125,6 +128125,9 @@ var ts;
128125
128125
  function isNotShadowedByDeeperNodeModulesPackage(info, packageName) {
128126
128126
  if (!packageName || !info.moduleFileName)
128127
128127
  return true;
128128
+ var typingsCacheLocation = host.getGlobalTypingsCacheLocation();
128129
+ if (typingsCacheLocation && ts.startsWith(info.moduleFileName, typingsCacheLocation))
128130
+ return true;
128128
128131
  var packageDeepestNodeModulesPath = packages.get(packageName);
128129
128132
  return !packageDeepestNodeModulesPath || ts.startsWith(info.moduleFileName, packageDeepestNodeModulesPath);
128130
128133
  }
@@ -128203,6 +128206,7 @@ var ts;
128203
128206
  var cache = ((_b = host.getCachedExportInfoMap) === null || _b === void 0 ? void 0 : _b.call(host)) || createCacheableExportInfoMap({
128204
128207
  getCurrentProgram: function () { return program; },
128205
128208
  getPackageJsonAutoImportProvider: function () { var _a; return (_a = host.getPackageJsonAutoImportProvider) === null || _a === void 0 ? void 0 : _a.call(host); },
128209
+ getGlobalTypingsCacheLocation: function () { var _a; return (_a = host.getGlobalTypingsCacheLocation) === null || _a === void 0 ? void 0 : _a.call(host); },
128206
128210
  });
128207
128211
  if (cache.isUsableByFile(importingFile.path)) {
128208
128212
  (_c = host.log) === null || _c === void 0 ? void 0 : _c.call(host, "getExportInfoMap: cache hit");
@@ -168792,13 +168796,12 @@ var ts;
168792
168796
  }
168793
168797
  var dependenciesAdded = 0;
168794
168798
  if (dependencyNames) {
168795
- var symlinkCache = hostProject.getSymlinkCache();
168796
- for (var _c = 0, _d = ts.arrayFrom(dependencyNames.keys()); _c < _d.length; _c++) {
168797
- var name = _d[_c];
168799
+ var symlinkCache_1 = hostProject.getSymlinkCache();
168800
+ var _loop_2 = function (name) {
168798
168801
  // Avoid creating a large project that would significantly slow down time to editor interactivity
168799
- if (dependencySelection === 2 /* Auto */ && dependenciesAdded > this.maxDependencies) {
168800
- hostProject.log("AutoImportProviderProject: attempted to add more than " + this.maxDependencies + " dependencies. Aborting.");
168801
- return ts.emptyArray;
168802
+ if (dependencySelection === 2 /* Auto */ && dependenciesAdded > this_2.maxDependencies) {
168803
+ hostProject.log("AutoImportProviderProject: attempted to add more than " + this_2.maxDependencies + " dependencies. Aborting.");
168804
+ return { value: ts.emptyArray };
168802
168805
  }
168803
168806
  // 1. Try to load from the implementation package. For many dependencies, the
168804
168807
  // package.json will exist, but the package will not contain any typings,
@@ -168806,29 +168809,43 @@ var ts;
168806
168809
  // is missing altogether, we will move on to trying the @types package (2).
168807
168810
  var packageJson = ts.resolvePackageNameToPackageJson(name, hostProject.currentDirectory, compilerOptions, moduleResolutionHost, program.getModuleResolutionCache());
168808
168811
  if (packageJson) {
168809
- var entrypoints = getRootNamesFromPackageJson(packageJson, program, symlinkCache);
168812
+ var entrypoints = getRootNamesFromPackageJson(packageJson, program, symlinkCache_1);
168810
168813
  if (entrypoints) {
168811
168814
  rootNames = ts.concatenate(rootNames, entrypoints);
168812
168815
  dependenciesAdded += entrypoints.length ? 1 : 0;
168813
- continue;
168816
+ return "continue";
168814
168817
  }
168815
168818
  }
168816
- // 2. Try to load from the @types package.
168817
- var typesPackageJson = ts.resolvePackageNameToPackageJson("@types/" + name, hostProject.currentDirectory, compilerOptions, moduleResolutionHost, program.getModuleResolutionCache());
168818
- if (typesPackageJson) {
168819
- var entrypoints = getRootNamesFromPackageJson(typesPackageJson, program, symlinkCache);
168820
- rootNames = ts.concatenate(rootNames, entrypoints);
168821
- dependenciesAdded += (entrypoints === null || entrypoints === void 0 ? void 0 : entrypoints.length) ? 1 : 0;
168822
- continue;
168823
- }
168819
+ // 2. Try to load from the @types package in the tree and in the global
168820
+ // typings cache location, if enabled.
168821
+ var done = ts.forEach([hostProject.currentDirectory, hostProject.getGlobalTypingsCacheLocation()], function (directory) {
168822
+ if (directory) {
168823
+ var typesPackageJson = ts.resolvePackageNameToPackageJson("@types/" + name, directory, compilerOptions, moduleResolutionHost, program.getModuleResolutionCache());
168824
+ if (typesPackageJson) {
168825
+ var entrypoints = getRootNamesFromPackageJson(typesPackageJson, program, symlinkCache_1);
168826
+ rootNames = ts.concatenate(rootNames, entrypoints);
168827
+ dependenciesAdded += (entrypoints === null || entrypoints === void 0 ? void 0 : entrypoints.length) ? 1 : 0;
168828
+ return true;
168829
+ }
168830
+ }
168831
+ });
168832
+ if (done)
168833
+ return "continue";
168824
168834
  // 3. If the @types package did not exist and the user has settings that
168825
168835
  // allow processing JS from node_modules, go back to the implementation
168826
168836
  // package and load the JS.
168827
168837
  if (packageJson && compilerOptions.allowJs && compilerOptions.maxNodeModuleJsDepth) {
168828
- var entrypoints = getRootNamesFromPackageJson(packageJson, program, symlinkCache, /*allowJs*/ true);
168838
+ var entrypoints = getRootNamesFromPackageJson(packageJson, program, symlinkCache_1, /*allowJs*/ true);
168829
168839
  rootNames = ts.concatenate(rootNames, entrypoints);
168830
168840
  dependenciesAdded += (entrypoints === null || entrypoints === void 0 ? void 0 : entrypoints.length) ? 1 : 0;
168831
168841
  }
168842
+ };
168843
+ var this_2 = this;
168844
+ for (var _c = 0, _d = ts.arrayFrom(dependencyNames.keys()); _c < _d.length; _c++) {
168845
+ var name = _d[_c];
168846
+ var state_1 = _loop_2(name);
168847
+ if (typeof state_1 === "object")
168848
+ return state_1.value;
168832
168849
  }
168833
168850
  }
168834
168851
  if (rootNames === null || rootNames === void 0 ? void 0 : rootNames.length) {
@@ -170227,7 +170244,7 @@ var ts;
170227
170244
  }
170228
170245
  project.updateGraph();
170229
170246
  if (!this.useSingleInferredProject && !project.projectRootPath) {
170230
- var _loop_2 = function (inferredProject) {
170247
+ var _loop_3 = function (inferredProject) {
170231
170248
  if (inferredProject === project || inferredProject.isOrphan()) {
170232
170249
  return "continue";
170233
170250
  }
@@ -170248,7 +170265,7 @@ var ts;
170248
170265
  // Note that we need to create a copy of the array since the list of project can change
170249
170266
  for (var _i = 0, _a = this.inferredProjects; _i < _a.length; _i++) {
170250
170267
  var inferredProject = _a[_i];
170251
- _loop_2(inferredProject);
170268
+ _loop_3(inferredProject);
170252
170269
  }
170253
170270
  }
170254
170271
  return project;
@@ -171189,7 +171206,7 @@ var ts;
171189
171206
  return projects;
171190
171207
  function combineProjects(toAddInfo) {
171191
171208
  if (toAddInfo !== info) {
171192
- var _loop_3 = function (project) {
171209
+ var _loop_4 = function (project) {
171193
171210
  // Add the projects only if they can use symLink targets and not already in the list
171194
171211
  if (project.languageServiceEnabled &&
171195
171212
  !project.isOrphan() &&
@@ -171206,7 +171223,7 @@ var ts;
171206
171223
  };
171207
171224
  for (var _i = 0, _a = toAddInfo.containingProjects; _i < _a.length; _i++) {
171208
171225
  var project = _a[_i];
171209
- _loop_3(project);
171226
+ _loop_4(project);
171210
171227
  }
171211
171228
  }
171212
171229
  }
@@ -172136,13 +172153,13 @@ var ts;
172136
172153
  return result;
172137
172154
  };
172138
172155
  ProjectService.prototype.collectChanges = function (lastKnownProjectVersions, currentProjects, includeProjectReferenceRedirectInfo, result) {
172139
- var _loop_4 = function (proj) {
172156
+ var _loop_5 = function (proj) {
172140
172157
  var knownProject = ts.find(lastKnownProjectVersions, function (p) { return p.projectName === proj.getProjectName(); });
172141
172158
  result.push(proj.getChangesSinceVersion(knownProject && knownProject.version, includeProjectReferenceRedirectInfo));
172142
172159
  };
172143
172160
  for (var _i = 0, currentProjects_1 = currentProjects; _i < currentProjects_1.length; _i++) {
172144
172161
  var proj = currentProjects_1[_i];
172145
- _loop_4(proj);
172162
+ _loop_5(proj);
172146
172163
  }
172147
172164
  };
172148
172165
  /* @internal */
@@ -172282,12 +172299,12 @@ var ts;
172282
172299
  var excludeRules = [];
172283
172300
  var normalizedNames = rootFiles.map(function (f) { return ts.normalizeSlashes(f.fileName); });
172284
172301
  var excludedFiles = [];
172285
- var _loop_5 = function (name) {
172286
- var rule = this_2.safelist[name];
172302
+ var _loop_6 = function (name) {
172303
+ var rule = this_3.safelist[name];
172287
172304
  for (var _b = 0, normalizedNames_1 = normalizedNames; _b < normalizedNames_1.length; _b++) {
172288
172305
  var root = normalizedNames_1[_b];
172289
172306
  if (rule.match.test(root)) {
172290
- this_2.logger.info("Excluding files based on rule " + name + " matching file '" + root + "'");
172307
+ this_3.logger.info("Excluding files based on rule " + name + " matching file '" + root + "'");
172291
172308
  // If the file matches, collect its types packages and exclude rules
172292
172309
  if (rule.types) {
172293
172310
  for (var _c = 0, _d = rule.types; _c < _d.length; _c++) {
@@ -172300,7 +172317,7 @@ var ts;
172300
172317
  }
172301
172318
  }
172302
172319
  if (rule.exclude) {
172303
- var _loop_7 = function (exclude) {
172320
+ var _loop_8 = function (exclude) {
172304
172321
  var processedRule = root.replace(rule.match, function () {
172305
172322
  var groups = [];
172306
172323
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -172327,7 +172344,7 @@ var ts;
172327
172344
  };
172328
172345
  for (var _e = 0, _f = rule.exclude; _e < _f.length; _e++) {
172329
172346
  var exclude = _f[_e];
172330
- _loop_7(exclude);
172347
+ _loop_8(exclude);
172331
172348
  }
172332
172349
  }
172333
172350
  else {
@@ -172340,14 +172357,14 @@ var ts;
172340
172357
  }
172341
172358
  }
172342
172359
  };
172343
- var this_2 = this;
172360
+ var this_3 = this;
172344
172361
  for (var _i = 0, _a = Object.keys(this.safelist); _i < _a.length; _i++) {
172345
172362
  var name = _a[_i];
172346
- _loop_5(name);
172363
+ _loop_6(name);
172347
172364
  }
172348
172365
  var excludeRegexes = excludeRules.map(function (e) { return new RegExp(e, "i"); });
172349
172366
  var filesToKeep = [];
172350
- var _loop_6 = function (i) {
172367
+ var _loop_7 = function (i) {
172351
172368
  if (excludeRegexes.some(function (re) { return re.test(normalizedNames[i]); })) {
172352
172369
  excludedFiles.push(normalizedNames[i]);
172353
172370
  }
@@ -172358,9 +172375,9 @@ var ts;
172358
172375
  if (ts.fileExtensionIs(baseName, "js")) {
172359
172376
  var inferredTypingName = ts.removeFileExtension(baseName);
172360
172377
  var cleanedTypingName = ts.removeMinAndVersionNumbers(inferredTypingName);
172361
- var typeName = this_3.legacySafelist.get(cleanedTypingName);
172378
+ var typeName = this_4.legacySafelist.get(cleanedTypingName);
172362
172379
  if (typeName !== undefined) {
172363
- this_3.logger.info("Excluded '" + normalizedNames[i] + "' because it matched " + cleanedTypingName + " from the legacy safelist");
172380
+ this_4.logger.info("Excluded '" + normalizedNames[i] + "' because it matched " + cleanedTypingName + " from the legacy safelist");
172364
172381
  excludedFiles.push(normalizedNames[i]);
172365
172382
  // *exclude* it from the project...
172366
172383
  exclude = true;
@@ -172383,9 +172400,9 @@ var ts;
172383
172400
  }
172384
172401
  }
172385
172402
  };
172386
- var this_3 = this;
172403
+ var this_4 = this;
172387
172404
  for (var i = 0; i < proj.rootFiles.length; i++) {
172388
- _loop_6(i);
172405
+ _loop_7(i);
172389
172406
  }
172390
172407
  proj.rootFiles = filesToKeep;
172391
172408
  return excludedFiles;
@@ -173039,7 +173056,7 @@ var ts;
173039
173056
  logger.info("Finding references to " + location.fileName + " position " + location.pos + " in project " + project.getProjectName());
173040
173057
  var projectOutputs = project.getLanguageService().findReferences(location.fileName, location.pos);
173041
173058
  if (projectOutputs) {
173042
- var _loop_8 = function (referencedSymbol) {
173059
+ var _loop_9 = function (referencedSymbol) {
173043
173060
  var mappedDefinitionFile = getMappedLocation(project, documentSpanLocation(referencedSymbol.definition));
173044
173061
  var definition = mappedDefinitionFile === undefined ?
173045
173062
  referencedSymbol.definition : __assign(__assign({}, referencedSymbol.definition), { textSpan: ts.createTextSpan(mappedDefinitionFile.pos, referencedSymbol.definition.textSpan.length), fileName: mappedDefinitionFile.fileName, contextSpan: getMappedContextSpan(referencedSymbol.definition, project) });
@@ -173058,7 +173075,7 @@ var ts;
173058
173075
  };
173059
173076
  for (var _i = 0, projectOutputs_2 = projectOutputs; _i < projectOutputs_2.length; _i++) {
173060
173077
  var referencedSymbol = projectOutputs_2[_i];
173061
- _loop_8(referencedSymbol);
173078
+ _loop_9(referencedSymbol);
173062
173079
  }
173063
173080
  }
173064
173081
  });
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20220319";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220322";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -128565,7 +128565,7 @@ var ts;
128565
128565
  packageName = ts.unmangleScopedPackageName(ts.getPackageNameFromTypesPackageName(moduleFile.fileName.substring(topLevelPackageNameIndex + 1, packageRootIndex)));
128566
128566
  if (ts.startsWith(importingFile, moduleFile.path.substring(0, topLevelNodeModulesIndex))) {
128567
128567
  var prevDeepestNodeModulesPath = packages.get(packageName);
128568
- var nodeModulesPath = moduleFile.fileName.substring(0, topLevelPackageNameIndex);
128568
+ var nodeModulesPath = moduleFile.fileName.substring(0, topLevelPackageNameIndex + 1);
128569
128569
  if (prevDeepestNodeModulesPath) {
128570
128570
  var prevDeepestNodeModulesIndex = prevDeepestNodeModulesPath.indexOf(ts.nodeModulesPathPart);
128571
128571
  if (topLevelNodeModulesIndex > prevDeepestNodeModulesIndex) {
@@ -128736,6 +128736,9 @@ var ts;
128736
128736
  function isNotShadowedByDeeperNodeModulesPackage(info, packageName) {
128737
128737
  if (!packageName || !info.moduleFileName)
128738
128738
  return true;
128739
+ var typingsCacheLocation = host.getGlobalTypingsCacheLocation();
128740
+ if (typingsCacheLocation && ts.startsWith(info.moduleFileName, typingsCacheLocation))
128741
+ return true;
128739
128742
  var packageDeepestNodeModulesPath = packages.get(packageName);
128740
128743
  return !packageDeepestNodeModulesPath || ts.startsWith(info.moduleFileName, packageDeepestNodeModulesPath);
128741
128744
  }
@@ -128814,6 +128817,7 @@ var ts;
128814
128817
  var cache = ((_b = host.getCachedExportInfoMap) === null || _b === void 0 ? void 0 : _b.call(host)) || createCacheableExportInfoMap({
128815
128818
  getCurrentProgram: function () { return program; },
128816
128819
  getPackageJsonAutoImportProvider: function () { var _a; return (_a = host.getPackageJsonAutoImportProvider) === null || _a === void 0 ? void 0 : _a.call(host); },
128820
+ getGlobalTypingsCacheLocation: function () { var _a; return (_a = host.getGlobalTypingsCacheLocation) === null || _a === void 0 ? void 0 : _a.call(host); },
128817
128821
  });
128818
128822
  if (cache.isUsableByFile(importingFile.path)) {
128819
128823
  (_c = host.log) === null || _c === void 0 ? void 0 : _c.call(host, "getExportInfoMap: cache hit");
@@ -168986,13 +168990,12 @@ var ts;
168986
168990
  }
168987
168991
  var dependenciesAdded = 0;
168988
168992
  if (dependencyNames) {
168989
- var symlinkCache = hostProject.getSymlinkCache();
168990
- for (var _c = 0, _d = ts.arrayFrom(dependencyNames.keys()); _c < _d.length; _c++) {
168991
- var name = _d[_c];
168993
+ var symlinkCache_1 = hostProject.getSymlinkCache();
168994
+ var _loop_2 = function (name) {
168992
168995
  // Avoid creating a large project that would significantly slow down time to editor interactivity
168993
- if (dependencySelection === 2 /* Auto */ && dependenciesAdded > this.maxDependencies) {
168994
- hostProject.log("AutoImportProviderProject: attempted to add more than " + this.maxDependencies + " dependencies. Aborting.");
168995
- return ts.emptyArray;
168996
+ if (dependencySelection === 2 /* Auto */ && dependenciesAdded > this_2.maxDependencies) {
168997
+ hostProject.log("AutoImportProviderProject: attempted to add more than " + this_2.maxDependencies + " dependencies. Aborting.");
168998
+ return { value: ts.emptyArray };
168996
168999
  }
168997
169000
  // 1. Try to load from the implementation package. For many dependencies, the
168998
169001
  // package.json will exist, but the package will not contain any typings,
@@ -169000,29 +169003,43 @@ var ts;
169000
169003
  // is missing altogether, we will move on to trying the @types package (2).
169001
169004
  var packageJson = ts.resolvePackageNameToPackageJson(name, hostProject.currentDirectory, compilerOptions, moduleResolutionHost, program.getModuleResolutionCache());
169002
169005
  if (packageJson) {
169003
- var entrypoints = getRootNamesFromPackageJson(packageJson, program, symlinkCache);
169006
+ var entrypoints = getRootNamesFromPackageJson(packageJson, program, symlinkCache_1);
169004
169007
  if (entrypoints) {
169005
169008
  rootNames = ts.concatenate(rootNames, entrypoints);
169006
169009
  dependenciesAdded += entrypoints.length ? 1 : 0;
169007
- continue;
169010
+ return "continue";
169008
169011
  }
169009
169012
  }
169010
- // 2. Try to load from the @types package.
169011
- var typesPackageJson = ts.resolvePackageNameToPackageJson("@types/" + name, hostProject.currentDirectory, compilerOptions, moduleResolutionHost, program.getModuleResolutionCache());
169012
- if (typesPackageJson) {
169013
- var entrypoints = getRootNamesFromPackageJson(typesPackageJson, program, symlinkCache);
169014
- rootNames = ts.concatenate(rootNames, entrypoints);
169015
- dependenciesAdded += (entrypoints === null || entrypoints === void 0 ? void 0 : entrypoints.length) ? 1 : 0;
169016
- continue;
169017
- }
169013
+ // 2. Try to load from the @types package in the tree and in the global
169014
+ // typings cache location, if enabled.
169015
+ var done = ts.forEach([hostProject.currentDirectory, hostProject.getGlobalTypingsCacheLocation()], function (directory) {
169016
+ if (directory) {
169017
+ var typesPackageJson = ts.resolvePackageNameToPackageJson("@types/" + name, directory, compilerOptions, moduleResolutionHost, program.getModuleResolutionCache());
169018
+ if (typesPackageJson) {
169019
+ var entrypoints = getRootNamesFromPackageJson(typesPackageJson, program, symlinkCache_1);
169020
+ rootNames = ts.concatenate(rootNames, entrypoints);
169021
+ dependenciesAdded += (entrypoints === null || entrypoints === void 0 ? void 0 : entrypoints.length) ? 1 : 0;
169022
+ return true;
169023
+ }
169024
+ }
169025
+ });
169026
+ if (done)
169027
+ return "continue";
169018
169028
  // 3. If the @types package did not exist and the user has settings that
169019
169029
  // allow processing JS from node_modules, go back to the implementation
169020
169030
  // package and load the JS.
169021
169031
  if (packageJson && compilerOptions.allowJs && compilerOptions.maxNodeModuleJsDepth) {
169022
- var entrypoints = getRootNamesFromPackageJson(packageJson, program, symlinkCache, /*allowJs*/ true);
169032
+ var entrypoints = getRootNamesFromPackageJson(packageJson, program, symlinkCache_1, /*allowJs*/ true);
169023
169033
  rootNames = ts.concatenate(rootNames, entrypoints);
169024
169034
  dependenciesAdded += (entrypoints === null || entrypoints === void 0 ? void 0 : entrypoints.length) ? 1 : 0;
169025
169035
  }
169036
+ };
169037
+ var this_2 = this;
169038
+ for (var _c = 0, _d = ts.arrayFrom(dependencyNames.keys()); _c < _d.length; _c++) {
169039
+ var name = _d[_c];
169040
+ var state_1 = _loop_2(name);
169041
+ if (typeof state_1 === "object")
169042
+ return state_1.value;
169026
169043
  }
169027
169044
  }
169028
169045
  if (rootNames === null || rootNames === void 0 ? void 0 : rootNames.length) {
@@ -170421,7 +170438,7 @@ var ts;
170421
170438
  }
170422
170439
  project.updateGraph();
170423
170440
  if (!this.useSingleInferredProject && !project.projectRootPath) {
170424
- var _loop_2 = function (inferredProject) {
170441
+ var _loop_3 = function (inferredProject) {
170425
170442
  if (inferredProject === project || inferredProject.isOrphan()) {
170426
170443
  return "continue";
170427
170444
  }
@@ -170442,7 +170459,7 @@ var ts;
170442
170459
  // Note that we need to create a copy of the array since the list of project can change
170443
170460
  for (var _i = 0, _a = this.inferredProjects; _i < _a.length; _i++) {
170444
170461
  var inferredProject = _a[_i];
170445
- _loop_2(inferredProject);
170462
+ _loop_3(inferredProject);
170446
170463
  }
170447
170464
  }
170448
170465
  return project;
@@ -171383,7 +171400,7 @@ var ts;
171383
171400
  return projects;
171384
171401
  function combineProjects(toAddInfo) {
171385
171402
  if (toAddInfo !== info) {
171386
- var _loop_3 = function (project) {
171403
+ var _loop_4 = function (project) {
171387
171404
  // Add the projects only if they can use symLink targets and not already in the list
171388
171405
  if (project.languageServiceEnabled &&
171389
171406
  !project.isOrphan() &&
@@ -171400,7 +171417,7 @@ var ts;
171400
171417
  };
171401
171418
  for (var _i = 0, _a = toAddInfo.containingProjects; _i < _a.length; _i++) {
171402
171419
  var project = _a[_i];
171403
- _loop_3(project);
171420
+ _loop_4(project);
171404
171421
  }
171405
171422
  }
171406
171423
  }
@@ -172330,13 +172347,13 @@ var ts;
172330
172347
  return result;
172331
172348
  };
172332
172349
  ProjectService.prototype.collectChanges = function (lastKnownProjectVersions, currentProjects, includeProjectReferenceRedirectInfo, result) {
172333
- var _loop_4 = function (proj) {
172350
+ var _loop_5 = function (proj) {
172334
172351
  var knownProject = ts.find(lastKnownProjectVersions, function (p) { return p.projectName === proj.getProjectName(); });
172335
172352
  result.push(proj.getChangesSinceVersion(knownProject && knownProject.version, includeProjectReferenceRedirectInfo));
172336
172353
  };
172337
172354
  for (var _i = 0, currentProjects_1 = currentProjects; _i < currentProjects_1.length; _i++) {
172338
172355
  var proj = currentProjects_1[_i];
172339
- _loop_4(proj);
172356
+ _loop_5(proj);
172340
172357
  }
172341
172358
  };
172342
172359
  /* @internal */
@@ -172476,12 +172493,12 @@ var ts;
172476
172493
  var excludeRules = [];
172477
172494
  var normalizedNames = rootFiles.map(function (f) { return ts.normalizeSlashes(f.fileName); });
172478
172495
  var excludedFiles = [];
172479
- var _loop_5 = function (name) {
172480
- var rule = this_2.safelist[name];
172496
+ var _loop_6 = function (name) {
172497
+ var rule = this_3.safelist[name];
172481
172498
  for (var _b = 0, normalizedNames_1 = normalizedNames; _b < normalizedNames_1.length; _b++) {
172482
172499
  var root = normalizedNames_1[_b];
172483
172500
  if (rule.match.test(root)) {
172484
- this_2.logger.info("Excluding files based on rule " + name + " matching file '" + root + "'");
172501
+ this_3.logger.info("Excluding files based on rule " + name + " matching file '" + root + "'");
172485
172502
  // If the file matches, collect its types packages and exclude rules
172486
172503
  if (rule.types) {
172487
172504
  for (var _c = 0, _d = rule.types; _c < _d.length; _c++) {
@@ -172494,7 +172511,7 @@ var ts;
172494
172511
  }
172495
172512
  }
172496
172513
  if (rule.exclude) {
172497
- var _loop_7 = function (exclude) {
172514
+ var _loop_8 = function (exclude) {
172498
172515
  var processedRule = root.replace(rule.match, function () {
172499
172516
  var groups = [];
172500
172517
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -172521,7 +172538,7 @@ var ts;
172521
172538
  };
172522
172539
  for (var _e = 0, _f = rule.exclude; _e < _f.length; _e++) {
172523
172540
  var exclude = _f[_e];
172524
- _loop_7(exclude);
172541
+ _loop_8(exclude);
172525
172542
  }
172526
172543
  }
172527
172544
  else {
@@ -172534,14 +172551,14 @@ var ts;
172534
172551
  }
172535
172552
  }
172536
172553
  };
172537
- var this_2 = this;
172554
+ var this_3 = this;
172538
172555
  for (var _i = 0, _a = Object.keys(this.safelist); _i < _a.length; _i++) {
172539
172556
  var name = _a[_i];
172540
- _loop_5(name);
172557
+ _loop_6(name);
172541
172558
  }
172542
172559
  var excludeRegexes = excludeRules.map(function (e) { return new RegExp(e, "i"); });
172543
172560
  var filesToKeep = [];
172544
- var _loop_6 = function (i) {
172561
+ var _loop_7 = function (i) {
172545
172562
  if (excludeRegexes.some(function (re) { return re.test(normalizedNames[i]); })) {
172546
172563
  excludedFiles.push(normalizedNames[i]);
172547
172564
  }
@@ -172552,9 +172569,9 @@ var ts;
172552
172569
  if (ts.fileExtensionIs(baseName, "js")) {
172553
172570
  var inferredTypingName = ts.removeFileExtension(baseName);
172554
172571
  var cleanedTypingName = ts.removeMinAndVersionNumbers(inferredTypingName);
172555
- var typeName = this_3.legacySafelist.get(cleanedTypingName);
172572
+ var typeName = this_4.legacySafelist.get(cleanedTypingName);
172556
172573
  if (typeName !== undefined) {
172557
- this_3.logger.info("Excluded '" + normalizedNames[i] + "' because it matched " + cleanedTypingName + " from the legacy safelist");
172574
+ this_4.logger.info("Excluded '" + normalizedNames[i] + "' because it matched " + cleanedTypingName + " from the legacy safelist");
172558
172575
  excludedFiles.push(normalizedNames[i]);
172559
172576
  // *exclude* it from the project...
172560
172577
  exclude = true;
@@ -172577,9 +172594,9 @@ var ts;
172577
172594
  }
172578
172595
  }
172579
172596
  };
172580
- var this_3 = this;
172597
+ var this_4 = this;
172581
172598
  for (var i = 0; i < proj.rootFiles.length; i++) {
172582
- _loop_6(i);
172599
+ _loop_7(i);
172583
172600
  }
172584
172601
  proj.rootFiles = filesToKeep;
172585
172602
  return excludedFiles;
@@ -173233,7 +173250,7 @@ var ts;
173233
173250
  logger.info("Finding references to " + location.fileName + " position " + location.pos + " in project " + project.getProjectName());
173234
173251
  var projectOutputs = project.getLanguageService().findReferences(location.fileName, location.pos);
173235
173252
  if (projectOutputs) {
173236
- var _loop_8 = function (referencedSymbol) {
173253
+ var _loop_9 = function (referencedSymbol) {
173237
173254
  var mappedDefinitionFile = getMappedLocation(project, documentSpanLocation(referencedSymbol.definition));
173238
173255
  var definition = mappedDefinitionFile === undefined ?
173239
173256
  referencedSymbol.definition : __assign(__assign({}, referencedSymbol.definition), { textSpan: ts.createTextSpan(mappedDefinitionFile.pos, referencedSymbol.definition.textSpan.length), fileName: mappedDefinitionFile.fileName, contextSpan: getMappedContextSpan(referencedSymbol.definition, project) });
@@ -173252,7 +173269,7 @@ var ts;
173252
173269
  };
173253
173270
  for (var _i = 0, projectOutputs_2 = projectOutputs; _i < projectOutputs_2.length; _i++) {
173254
173271
  var referencedSymbol = projectOutputs_2[_i];
173255
- _loop_8(referencedSymbol);
173272
+ _loop_9(referencedSymbol);
173256
173273
  }
173257
173274
  }
173258
173275
  });
package/lib/typescript.js CHANGED
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20220319";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220322";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -128565,7 +128565,7 @@ var ts;
128565
128565
  packageName = ts.unmangleScopedPackageName(ts.getPackageNameFromTypesPackageName(moduleFile.fileName.substring(topLevelPackageNameIndex + 1, packageRootIndex)));
128566
128566
  if (ts.startsWith(importingFile, moduleFile.path.substring(0, topLevelNodeModulesIndex))) {
128567
128567
  var prevDeepestNodeModulesPath = packages.get(packageName);
128568
- var nodeModulesPath = moduleFile.fileName.substring(0, topLevelPackageNameIndex);
128568
+ var nodeModulesPath = moduleFile.fileName.substring(0, topLevelPackageNameIndex + 1);
128569
128569
  if (prevDeepestNodeModulesPath) {
128570
128570
  var prevDeepestNodeModulesIndex = prevDeepestNodeModulesPath.indexOf(ts.nodeModulesPathPart);
128571
128571
  if (topLevelNodeModulesIndex > prevDeepestNodeModulesIndex) {
@@ -128736,6 +128736,9 @@ var ts;
128736
128736
  function isNotShadowedByDeeperNodeModulesPackage(info, packageName) {
128737
128737
  if (!packageName || !info.moduleFileName)
128738
128738
  return true;
128739
+ var typingsCacheLocation = host.getGlobalTypingsCacheLocation();
128740
+ if (typingsCacheLocation && ts.startsWith(info.moduleFileName, typingsCacheLocation))
128741
+ return true;
128739
128742
  var packageDeepestNodeModulesPath = packages.get(packageName);
128740
128743
  return !packageDeepestNodeModulesPath || ts.startsWith(info.moduleFileName, packageDeepestNodeModulesPath);
128741
128744
  }
@@ -128814,6 +128817,7 @@ var ts;
128814
128817
  var cache = ((_b = host.getCachedExportInfoMap) === null || _b === void 0 ? void 0 : _b.call(host)) || createCacheableExportInfoMap({
128815
128818
  getCurrentProgram: function () { return program; },
128816
128819
  getPackageJsonAutoImportProvider: function () { var _a; return (_a = host.getPackageJsonAutoImportProvider) === null || _a === void 0 ? void 0 : _a.call(host); },
128820
+ getGlobalTypingsCacheLocation: function () { var _a; return (_a = host.getGlobalTypingsCacheLocation) === null || _a === void 0 ? void 0 : _a.call(host); },
128817
128821
  });
128818
128822
  if (cache.isUsableByFile(importingFile.path)) {
128819
128823
  (_c = host.log) === null || _c === void 0 ? void 0 : _c.call(host, "getExportInfoMap: cache hit");
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20220319";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220322";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -128565,7 +128565,7 @@ var ts;
128565
128565
  packageName = ts.unmangleScopedPackageName(ts.getPackageNameFromTypesPackageName(moduleFile.fileName.substring(topLevelPackageNameIndex + 1, packageRootIndex)));
128566
128566
  if (ts.startsWith(importingFile, moduleFile.path.substring(0, topLevelNodeModulesIndex))) {
128567
128567
  var prevDeepestNodeModulesPath = packages.get(packageName);
128568
- var nodeModulesPath = moduleFile.fileName.substring(0, topLevelPackageNameIndex);
128568
+ var nodeModulesPath = moduleFile.fileName.substring(0, topLevelPackageNameIndex + 1);
128569
128569
  if (prevDeepestNodeModulesPath) {
128570
128570
  var prevDeepestNodeModulesIndex = prevDeepestNodeModulesPath.indexOf(ts.nodeModulesPathPart);
128571
128571
  if (topLevelNodeModulesIndex > prevDeepestNodeModulesIndex) {
@@ -128736,6 +128736,9 @@ var ts;
128736
128736
  function isNotShadowedByDeeperNodeModulesPackage(info, packageName) {
128737
128737
  if (!packageName || !info.moduleFileName)
128738
128738
  return true;
128739
+ var typingsCacheLocation = host.getGlobalTypingsCacheLocation();
128740
+ if (typingsCacheLocation && ts.startsWith(info.moduleFileName, typingsCacheLocation))
128741
+ return true;
128739
128742
  var packageDeepestNodeModulesPath = packages.get(packageName);
128740
128743
  return !packageDeepestNodeModulesPath || ts.startsWith(info.moduleFileName, packageDeepestNodeModulesPath);
128741
128744
  }
@@ -128814,6 +128817,7 @@ var ts;
128814
128817
  var cache = ((_b = host.getCachedExportInfoMap) === null || _b === void 0 ? void 0 : _b.call(host)) || createCacheableExportInfoMap({
128815
128818
  getCurrentProgram: function () { return program; },
128816
128819
  getPackageJsonAutoImportProvider: function () { var _a; return (_a = host.getPackageJsonAutoImportProvider) === null || _a === void 0 ? void 0 : _a.call(host); },
128820
+ getGlobalTypingsCacheLocation: function () { var _a; return (_a = host.getGlobalTypingsCacheLocation) === null || _a === void 0 ? void 0 : _a.call(host); },
128817
128821
  });
128818
128822
  if (cache.isUsableByFile(importingFile.path)) {
128819
128823
  (_c = host.log) === null || _c === void 0 ? void 0 : _c.call(host, "getExportInfoMap: cache hit");
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = ts.versionMajorMinor + ".0-dev.20220319";
92
+ ts.version = ts.versionMajorMinor + ".0-dev.20220322";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {