typescript 5.3.0-dev.20230907 → 5.3.0-dev.20230908

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 CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.3";
21
- var version = `${versionMajorMinor}.0-dev.20230907`;
21
+ var version = `${versionMajorMinor}.0-dev.20230908`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
package/lib/tsserver.js CHANGED
@@ -2327,7 +2327,7 @@ module.exports = __toCommonJS(server_exports);
2327
2327
 
2328
2328
  // src/compiler/corePublic.ts
2329
2329
  var versionMajorMinor = "5.3";
2330
- var version = `${versionMajorMinor}.0-dev.20230907`;
2330
+ var version = `${versionMajorMinor}.0-dev.20230908`;
2331
2331
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2332
2332
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2333
2333
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -136428,30 +136428,37 @@ __export(ts_NavigateTo_exports, {
136428
136428
  });
136429
136429
 
136430
136430
  // src/services/navigateTo.ts
136431
- function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles) {
136431
+ function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles, excludeLibFiles) {
136432
136432
  const patternMatcher = createPatternMatcher(searchValue);
136433
136433
  if (!patternMatcher)
136434
136434
  return emptyArray;
136435
136435
  const rawItems = [];
136436
+ const singleCurrentFile = sourceFiles.length === 1 ? sourceFiles[0] : void 0;
136436
136437
  for (const sourceFile of sourceFiles) {
136437
136438
  cancellationToken.throwIfCancellationRequested();
136438
136439
  if (excludeDtsFiles && sourceFile.isDeclarationFile) {
136439
136440
  continue;
136440
136441
  }
136442
+ if (shouldExcludeFile(sourceFile, !!excludeLibFiles, singleCurrentFile)) {
136443
+ continue;
136444
+ }
136441
136445
  sourceFile.getNamedDeclarations().forEach((declarations, name) => {
136442
- getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, sourceFile.fileName, rawItems);
136446
+ getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, sourceFile.fileName, !!excludeLibFiles, singleCurrentFile, rawItems);
136443
136447
  });
136444
136448
  }
136445
136449
  rawItems.sort(compareNavigateToItems);
136446
136450
  return (maxResultCount === void 0 ? rawItems : rawItems.slice(0, maxResultCount)).map(createNavigateToItem);
136447
136451
  }
136448
- function getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, fileName, rawItems) {
136452
+ function shouldExcludeFile(file, excludeLibFiles, singleCurrentFile) {
136453
+ return file !== singleCurrentFile && excludeLibFiles && (isInsideNodeModules(file.path) || file.hasNoDefaultLib);
136454
+ }
136455
+ function getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, fileName, excludeLibFiles, singleCurrentFile, rawItems) {
136449
136456
  const match = patternMatcher.getMatchForLastSegmentOfPattern(name);
136450
136457
  if (!match) {
136451
136458
  return;
136452
136459
  }
136453
136460
  for (const declaration of declarations) {
136454
- if (!shouldKeepItem(declaration, checker))
136461
+ if (!shouldKeepItem(declaration, checker, excludeLibFiles, singleCurrentFile))
136455
136462
  continue;
136456
136463
  if (patternMatcher.patternContainsDots) {
136457
136464
  const fullMatch = patternMatcher.getFullMatch(getContainers(declaration), name);
@@ -136463,14 +136470,15 @@ function getItemsFromNamedDeclaration(patternMatcher, name, declarations, checke
136463
136470
  }
136464
136471
  }
136465
136472
  }
136466
- function shouldKeepItem(declaration, checker) {
136473
+ function shouldKeepItem(declaration, checker, excludeLibFiles, singleCurrentFile) {
136474
+ var _a;
136467
136475
  switch (declaration.kind) {
136468
136476
  case 273 /* ImportClause */:
136469
136477
  case 276 /* ImportSpecifier */:
136470
136478
  case 271 /* ImportEqualsDeclaration */:
136471
136479
  const importer = checker.getSymbolAtLocation(declaration.name);
136472
136480
  const imported = checker.getAliasedSymbol(importer);
136473
- return importer.escapedName !== imported.escapedName;
136481
+ return importer.escapedName !== imported.escapedName && !((_a = imported.declarations) == null ? void 0 : _a.every((d) => shouldExcludeFile(d.getSourceFile(), excludeLibFiles, singleCurrentFile)));
136474
136482
  default:
136475
136483
  return true;
136476
136484
  }
@@ -144162,10 +144170,10 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
144162
144170
  synchronizeHostData();
144163
144171
  return ts_FindAllReferences_exports.Core.getReferencesForFileName(fileName, program, program.getSourceFiles()).map(ts_FindAllReferences_exports.toReferenceEntry);
144164
144172
  }
144165
- function getNavigateToItems2(searchValue, maxResultCount, fileName, excludeDtsFiles = false) {
144173
+ function getNavigateToItems2(searchValue, maxResultCount, fileName, excludeDtsFiles = false, excludeLibFiles = false) {
144166
144174
  synchronizeHostData();
144167
144175
  const sourceFiles = fileName ? [getValidSourceFile(fileName)] : program.getSourceFiles();
144168
- return getNavigateToItems(sourceFiles, program.getTypeChecker(), cancellationToken, searchValue, maxResultCount, excludeDtsFiles);
144176
+ return getNavigateToItems(sourceFiles, program.getTypeChecker(), cancellationToken, searchValue, maxResultCount, excludeDtsFiles, excludeLibFiles);
144169
144177
  }
144170
144178
  function getEmitOutput(fileName, emitOnlyDtsFiles, forceDtsEmit) {
144171
144179
  synchronizeHostData();
@@ -184281,6 +184289,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
184281
184289
  const { file, project } = this.getFileAndProject(args);
184282
184290
  return [{ project, navigateToItems: project.getLanguageService().getNavigateToItems(searchValue, maxResultCount, file) }];
184283
184291
  }
184292
+ const preferences = this.getHostPreferences();
184284
184293
  const outputs = [];
184285
184294
  const seenItems = /* @__PURE__ */ new Map();
184286
184295
  if (!args.file && !projectFileName) {
@@ -184303,7 +184312,9 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
184303
184312
  /*fileName*/
184304
184313
  void 0,
184305
184314
  /*excludeDts*/
184306
- project.isNonTsProject()
184315
+ project.isNonTsProject(),
184316
+ /*excludeLibFiles*/
184317
+ preferences.excludeLibrarySymbolsInNavTo
184307
184318
  );
184308
184319
  const unseenItems = filter(projectItems, (item) => tryAddSeenItem(item) && !getMappedLocationForProject(documentSpanLocation(item), project));
184309
184320
  if (unseenItems.length) {
@@ -2897,6 +2897,10 @@ declare namespace ts {
2897
2897
  * Indicates whether {@link ReferencesResponseItem.lineText} is supported.
2898
2898
  */
2899
2899
  readonly disableLineTextInReferences?: boolean;
2900
+ /**
2901
+ * Indicates whether to exclude standard library and node_modules file symbols from navTo results.
2902
+ */
2903
+ readonly excludeLibrarySymbolsInNavTo?: boolean;
2900
2904
  }
2901
2905
  interface CompilerOptions {
2902
2906
  allowJs?: boolean;
@@ -8640,6 +8644,7 @@ declare namespace ts {
8640
8644
  readonly organizeImportsNumericCollation?: boolean;
8641
8645
  readonly organizeImportsAccentCollation?: boolean;
8642
8646
  readonly organizeImportsCaseFirst?: "upper" | "lower" | false;
8647
+ readonly excludeLibrarySymbolsInNavTo?: boolean;
8643
8648
  }
8644
8649
  /** Represents a bigint literal value without requiring bigint support */
8645
8650
  interface PseudoBigInt {
@@ -10396,7 +10401,7 @@ declare namespace ts {
10396
10401
  findReferences(fileName: string, position: number): ReferencedSymbol[] | undefined;
10397
10402
  getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[] | undefined;
10398
10403
  getFileReferences(fileName: string): ReferenceEntry[];
10399
- getNavigateToItems(searchValue: string, maxResultCount?: number, fileName?: string, excludeDtsFiles?: boolean): NavigateToItem[];
10404
+ getNavigateToItems(searchValue: string, maxResultCount?: number, fileName?: string, excludeDtsFiles?: boolean, excludeLibFiles?: boolean): NavigateToItem[];
10400
10405
  getNavigationBarItems(fileName: string): NavigationBarItem[];
10401
10406
  getNavigationTree(fileName: string): NavigationTree;
10402
10407
  prepareCallHierarchy(fileName: string, position: number): CallHierarchyItem | CallHierarchyItem[] | undefined;
package/lib/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.3";
38
- version = `${versionMajorMinor}.0-dev.20230907`;
38
+ version = `${versionMajorMinor}.0-dev.20230908`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -134802,30 +134802,37 @@ ${lanes.join("\n")}
134802
134802
  });
134803
134803
 
134804
134804
  // src/services/navigateTo.ts
134805
- function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles) {
134805
+ function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles, excludeLibFiles) {
134806
134806
  const patternMatcher = createPatternMatcher(searchValue);
134807
134807
  if (!patternMatcher)
134808
134808
  return emptyArray;
134809
134809
  const rawItems = [];
134810
+ const singleCurrentFile = sourceFiles.length === 1 ? sourceFiles[0] : void 0;
134810
134811
  for (const sourceFile of sourceFiles) {
134811
134812
  cancellationToken.throwIfCancellationRequested();
134812
134813
  if (excludeDtsFiles && sourceFile.isDeclarationFile) {
134813
134814
  continue;
134814
134815
  }
134816
+ if (shouldExcludeFile(sourceFile, !!excludeLibFiles, singleCurrentFile)) {
134817
+ continue;
134818
+ }
134815
134819
  sourceFile.getNamedDeclarations().forEach((declarations, name) => {
134816
- getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, sourceFile.fileName, rawItems);
134820
+ getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, sourceFile.fileName, !!excludeLibFiles, singleCurrentFile, rawItems);
134817
134821
  });
134818
134822
  }
134819
134823
  rawItems.sort(compareNavigateToItems);
134820
134824
  return (maxResultCount === void 0 ? rawItems : rawItems.slice(0, maxResultCount)).map(createNavigateToItem);
134821
134825
  }
134822
- function getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, fileName, rawItems) {
134826
+ function shouldExcludeFile(file, excludeLibFiles, singleCurrentFile) {
134827
+ return file !== singleCurrentFile && excludeLibFiles && (isInsideNodeModules(file.path) || file.hasNoDefaultLib);
134828
+ }
134829
+ function getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, fileName, excludeLibFiles, singleCurrentFile, rawItems) {
134823
134830
  const match = patternMatcher.getMatchForLastSegmentOfPattern(name);
134824
134831
  if (!match) {
134825
134832
  return;
134826
134833
  }
134827
134834
  for (const declaration of declarations) {
134828
- if (!shouldKeepItem(declaration, checker))
134835
+ if (!shouldKeepItem(declaration, checker, excludeLibFiles, singleCurrentFile))
134829
134836
  continue;
134830
134837
  if (patternMatcher.patternContainsDots) {
134831
134838
  const fullMatch = patternMatcher.getFullMatch(getContainers(declaration), name);
@@ -134837,14 +134844,15 @@ ${lanes.join("\n")}
134837
134844
  }
134838
134845
  }
134839
134846
  }
134840
- function shouldKeepItem(declaration, checker) {
134847
+ function shouldKeepItem(declaration, checker, excludeLibFiles, singleCurrentFile) {
134848
+ var _a;
134841
134849
  switch (declaration.kind) {
134842
134850
  case 273 /* ImportClause */:
134843
134851
  case 276 /* ImportSpecifier */:
134844
134852
  case 271 /* ImportEqualsDeclaration */:
134845
134853
  const importer = checker.getSymbolAtLocation(declaration.name);
134846
134854
  const imported = checker.getAliasedSymbol(importer);
134847
- return importer.escapedName !== imported.escapedName;
134855
+ return importer.escapedName !== imported.escapedName && !((_a = imported.declarations) == null ? void 0 : _a.every((d) => shouldExcludeFile(d.getSourceFile(), excludeLibFiles, singleCurrentFile)));
134848
134856
  default:
134849
134857
  return true;
134850
134858
  }
@@ -142107,10 +142115,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
142107
142115
  synchronizeHostData();
142108
142116
  return ts_FindAllReferences_exports.Core.getReferencesForFileName(fileName, program, program.getSourceFiles()).map(ts_FindAllReferences_exports.toReferenceEntry);
142109
142117
  }
142110
- function getNavigateToItems2(searchValue, maxResultCount, fileName, excludeDtsFiles = false) {
142118
+ function getNavigateToItems2(searchValue, maxResultCount, fileName, excludeDtsFiles = false, excludeLibFiles = false) {
142111
142119
  synchronizeHostData();
142112
142120
  const sourceFiles = fileName ? [getValidSourceFile(fileName)] : program.getSourceFiles();
142113
- return getNavigateToItems(sourceFiles, program.getTypeChecker(), cancellationToken, searchValue, maxResultCount, excludeDtsFiles);
142121
+ return getNavigateToItems(sourceFiles, program.getTypeChecker(), cancellationToken, searchValue, maxResultCount, excludeDtsFiles, excludeLibFiles);
142114
142122
  }
142115
142123
  function getEmitOutput(fileName, emitOnlyDtsFiles, forceDtsEmit) {
142116
142124
  synchronizeHostData();
@@ -181696,6 +181704,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
181696
181704
  const { file, project } = this.getFileAndProject(args);
181697
181705
  return [{ project, navigateToItems: project.getLanguageService().getNavigateToItems(searchValue, maxResultCount, file) }];
181698
181706
  }
181707
+ const preferences = this.getHostPreferences();
181699
181708
  const outputs = [];
181700
181709
  const seenItems = /* @__PURE__ */ new Map();
181701
181710
  if (!args.file && !projectFileName) {
@@ -181718,7 +181727,9 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
181718
181727
  /*fileName*/
181719
181728
  void 0,
181720
181729
  /*excludeDts*/
181721
- project.isNonTsProject()
181730
+ project.isNonTsProject(),
181731
+ /*excludeLibFiles*/
181732
+ preferences.excludeLibrarySymbolsInNavTo
181722
181733
  );
181723
181734
  const unseenItems = filter(projectItems, (item) => tryAddSeenItem(item) && !getMappedLocationForProject(documentSpanLocation(item), project));
181724
181735
  if (unseenItems.length) {
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.3";
57
- var version = `${versionMajorMinor}.0-dev.20230907`;
57
+ var version = `${versionMajorMinor}.0-dev.20230908`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
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.3.0-dev.20230907",
5
+ "version": "5.3.0-dev.20230908",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -112,5 +112,5 @@
112
112
  "node": "20.1.0",
113
113
  "npm": "8.19.4"
114
114
  },
115
- "gitHead": "6cc605fcfe66118eafb50b2fdbd386da7e419795"
115
+ "gitHead": "eb374c28d6810e317b0c353d9b1330b0595458f4"
116
116
  }