typescript 5.3.0-dev.20230906 → 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/SECURITY.md CHANGED
@@ -1,18 +1,18 @@
1
- <!-- BEGIN MICROSOFT SECURITY.MD V0.0.5 BLOCK -->
1
+ <!-- BEGIN MICROSOFT SECURITY.MD V0.0.9 BLOCK -->
2
2
 
3
3
  ## Security
4
4
 
5
- Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
5
+ Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet) and [Xamarin](https://github.com/xamarin).
6
6
 
7
- If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below.
7
+ If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/security.md/definition), please report it to us as described below.
8
8
 
9
9
  ## Reporting Security Issues
10
10
 
11
11
  **Please do not report security vulnerabilities through public GitHub issues.**
12
12
 
13
- Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).
13
+ Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/security.md/msrc/create-report).
14
14
 
15
- If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
15
+ If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp).
16
16
 
17
17
  You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
18
18
 
@@ -28,7 +28,7 @@ Please include the requested information listed below (as much as you can provid
28
28
 
29
29
  This information will help us triage your report more quickly.
30
30
 
31
- If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs.
31
+ If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/security.md/msrc/bounty) page for more details about our active programs.
32
32
 
33
33
  ## Preferred Languages
34
34
 
@@ -36,6 +36,6 @@ We prefer all communications to be in English.
36
36
 
37
37
  ## Policy
38
38
 
39
- Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).
39
+ Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/security.md/cvd).
40
40
 
41
41
  <!-- END MICROSOFT SECURITY.MD BLOCK -->
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.20230906`;
21
+ var version = `${versionMajorMinor}.0-dev.20230908`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -37975,7 +37975,6 @@ function realPath(path, host, traceEnabled) {
37975
37975
  if (traceEnabled) {
37976
37976
  trace(host, Diagnostics.Resolving_real_path_for_0_result_1, path, real);
37977
37977
  }
37978
- Debug.assert(host.fileExists(real), `${path} linked to nonexistent file ${real}`);
37979
37978
  return real;
37980
37979
  }
37981
37980
  function nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, considerPackageJson) {
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.20230906`;
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";
@@ -42494,7 +42494,6 @@ function realPath(path, host, traceEnabled) {
42494
42494
  if (traceEnabled) {
42495
42495
  trace(host, Diagnostics.Resolving_real_path_for_0_result_1, path, real);
42496
42496
  }
42497
- Debug.assert(host.fileExists(real), `${path} linked to nonexistent file ${real}`);
42498
42497
  return real;
42499
42498
  }
42500
42499
  function nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, considerPackageJson) {
@@ -136429,30 +136428,37 @@ __export(ts_NavigateTo_exports, {
136429
136428
  });
136430
136429
 
136431
136430
  // src/services/navigateTo.ts
136432
- function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles) {
136431
+ function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles, excludeLibFiles) {
136433
136432
  const patternMatcher = createPatternMatcher(searchValue);
136434
136433
  if (!patternMatcher)
136435
136434
  return emptyArray;
136436
136435
  const rawItems = [];
136436
+ const singleCurrentFile = sourceFiles.length === 1 ? sourceFiles[0] : void 0;
136437
136437
  for (const sourceFile of sourceFiles) {
136438
136438
  cancellationToken.throwIfCancellationRequested();
136439
136439
  if (excludeDtsFiles && sourceFile.isDeclarationFile) {
136440
136440
  continue;
136441
136441
  }
136442
+ if (shouldExcludeFile(sourceFile, !!excludeLibFiles, singleCurrentFile)) {
136443
+ continue;
136444
+ }
136442
136445
  sourceFile.getNamedDeclarations().forEach((declarations, name) => {
136443
- getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, sourceFile.fileName, rawItems);
136446
+ getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, sourceFile.fileName, !!excludeLibFiles, singleCurrentFile, rawItems);
136444
136447
  });
136445
136448
  }
136446
136449
  rawItems.sort(compareNavigateToItems);
136447
136450
  return (maxResultCount === void 0 ? rawItems : rawItems.slice(0, maxResultCount)).map(createNavigateToItem);
136448
136451
  }
136449
- 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) {
136450
136456
  const match = patternMatcher.getMatchForLastSegmentOfPattern(name);
136451
136457
  if (!match) {
136452
136458
  return;
136453
136459
  }
136454
136460
  for (const declaration of declarations) {
136455
- if (!shouldKeepItem(declaration, checker))
136461
+ if (!shouldKeepItem(declaration, checker, excludeLibFiles, singleCurrentFile))
136456
136462
  continue;
136457
136463
  if (patternMatcher.patternContainsDots) {
136458
136464
  const fullMatch = patternMatcher.getFullMatch(getContainers(declaration), name);
@@ -136464,14 +136470,15 @@ function getItemsFromNamedDeclaration(patternMatcher, name, declarations, checke
136464
136470
  }
136465
136471
  }
136466
136472
  }
136467
- function shouldKeepItem(declaration, checker) {
136473
+ function shouldKeepItem(declaration, checker, excludeLibFiles, singleCurrentFile) {
136474
+ var _a;
136468
136475
  switch (declaration.kind) {
136469
136476
  case 273 /* ImportClause */:
136470
136477
  case 276 /* ImportSpecifier */:
136471
136478
  case 271 /* ImportEqualsDeclaration */:
136472
136479
  const importer = checker.getSymbolAtLocation(declaration.name);
136473
136480
  const imported = checker.getAliasedSymbol(importer);
136474
- 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)));
136475
136482
  default:
136476
136483
  return true;
136477
136484
  }
@@ -144163,10 +144170,10 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
144163
144170
  synchronizeHostData();
144164
144171
  return ts_FindAllReferences_exports.Core.getReferencesForFileName(fileName, program, program.getSourceFiles()).map(ts_FindAllReferences_exports.toReferenceEntry);
144165
144172
  }
144166
- function getNavigateToItems2(searchValue, maxResultCount, fileName, excludeDtsFiles = false) {
144173
+ function getNavigateToItems2(searchValue, maxResultCount, fileName, excludeDtsFiles = false, excludeLibFiles = false) {
144167
144174
  synchronizeHostData();
144168
144175
  const sourceFiles = fileName ? [getValidSourceFile(fileName)] : program.getSourceFiles();
144169
- return getNavigateToItems(sourceFiles, program.getTypeChecker(), cancellationToken, searchValue, maxResultCount, excludeDtsFiles);
144176
+ return getNavigateToItems(sourceFiles, program.getTypeChecker(), cancellationToken, searchValue, maxResultCount, excludeDtsFiles, excludeLibFiles);
144170
144177
  }
144171
144178
  function getEmitOutput(fileName, emitOnlyDtsFiles, forceDtsEmit) {
144172
144179
  synchronizeHostData();
@@ -184282,6 +184289,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
184282
184289
  const { file, project } = this.getFileAndProject(args);
184283
184290
  return [{ project, navigateToItems: project.getLanguageService().getNavigateToItems(searchValue, maxResultCount, file) }];
184284
184291
  }
184292
+ const preferences = this.getHostPreferences();
184285
184293
  const outputs = [];
184286
184294
  const seenItems = /* @__PURE__ */ new Map();
184287
184295
  if (!args.file && !projectFileName) {
@@ -184304,7 +184312,9 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
184304
184312
  /*fileName*/
184305
184313
  void 0,
184306
184314
  /*excludeDts*/
184307
- project.isNonTsProject()
184315
+ project.isNonTsProject(),
184316
+ /*excludeLibFiles*/
184317
+ preferences.excludeLibrarySymbolsInNavTo
184308
184318
  );
184309
184319
  const unseenItems = filter(projectItems, (item) => tryAddSeenItem(item) && !getMappedLocationForProject(documentSpanLocation(item), project));
184310
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.20230906`;
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";
@@ -40340,7 +40340,6 @@ ${lanes.join("\n")}
40340
40340
  if (traceEnabled) {
40341
40341
  trace(host, Diagnostics.Resolving_real_path_for_0_result_1, path, real);
40342
40342
  }
40343
- Debug.assert(host.fileExists(real), `${path} linked to nonexistent file ${real}`);
40344
40343
  return real;
40345
40344
  }
40346
40345
  function nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, considerPackageJson) {
@@ -134803,30 +134802,37 @@ ${lanes.join("\n")}
134803
134802
  });
134804
134803
 
134805
134804
  // src/services/navigateTo.ts
134806
- function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles) {
134805
+ function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles, excludeLibFiles) {
134807
134806
  const patternMatcher = createPatternMatcher(searchValue);
134808
134807
  if (!patternMatcher)
134809
134808
  return emptyArray;
134810
134809
  const rawItems = [];
134810
+ const singleCurrentFile = sourceFiles.length === 1 ? sourceFiles[0] : void 0;
134811
134811
  for (const sourceFile of sourceFiles) {
134812
134812
  cancellationToken.throwIfCancellationRequested();
134813
134813
  if (excludeDtsFiles && sourceFile.isDeclarationFile) {
134814
134814
  continue;
134815
134815
  }
134816
+ if (shouldExcludeFile(sourceFile, !!excludeLibFiles, singleCurrentFile)) {
134817
+ continue;
134818
+ }
134816
134819
  sourceFile.getNamedDeclarations().forEach((declarations, name) => {
134817
- getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, sourceFile.fileName, rawItems);
134820
+ getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, sourceFile.fileName, !!excludeLibFiles, singleCurrentFile, rawItems);
134818
134821
  });
134819
134822
  }
134820
134823
  rawItems.sort(compareNavigateToItems);
134821
134824
  return (maxResultCount === void 0 ? rawItems : rawItems.slice(0, maxResultCount)).map(createNavigateToItem);
134822
134825
  }
134823
- 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) {
134824
134830
  const match = patternMatcher.getMatchForLastSegmentOfPattern(name);
134825
134831
  if (!match) {
134826
134832
  return;
134827
134833
  }
134828
134834
  for (const declaration of declarations) {
134829
- if (!shouldKeepItem(declaration, checker))
134835
+ if (!shouldKeepItem(declaration, checker, excludeLibFiles, singleCurrentFile))
134830
134836
  continue;
134831
134837
  if (patternMatcher.patternContainsDots) {
134832
134838
  const fullMatch = patternMatcher.getFullMatch(getContainers(declaration), name);
@@ -134838,14 +134844,15 @@ ${lanes.join("\n")}
134838
134844
  }
134839
134845
  }
134840
134846
  }
134841
- function shouldKeepItem(declaration, checker) {
134847
+ function shouldKeepItem(declaration, checker, excludeLibFiles, singleCurrentFile) {
134848
+ var _a;
134842
134849
  switch (declaration.kind) {
134843
134850
  case 273 /* ImportClause */:
134844
134851
  case 276 /* ImportSpecifier */:
134845
134852
  case 271 /* ImportEqualsDeclaration */:
134846
134853
  const importer = checker.getSymbolAtLocation(declaration.name);
134847
134854
  const imported = checker.getAliasedSymbol(importer);
134848
- 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)));
134849
134856
  default:
134850
134857
  return true;
134851
134858
  }
@@ -142108,10 +142115,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
142108
142115
  synchronizeHostData();
142109
142116
  return ts_FindAllReferences_exports.Core.getReferencesForFileName(fileName, program, program.getSourceFiles()).map(ts_FindAllReferences_exports.toReferenceEntry);
142110
142117
  }
142111
- function getNavigateToItems2(searchValue, maxResultCount, fileName, excludeDtsFiles = false) {
142118
+ function getNavigateToItems2(searchValue, maxResultCount, fileName, excludeDtsFiles = false, excludeLibFiles = false) {
142112
142119
  synchronizeHostData();
142113
142120
  const sourceFiles = fileName ? [getValidSourceFile(fileName)] : program.getSourceFiles();
142114
- return getNavigateToItems(sourceFiles, program.getTypeChecker(), cancellationToken, searchValue, maxResultCount, excludeDtsFiles);
142121
+ return getNavigateToItems(sourceFiles, program.getTypeChecker(), cancellationToken, searchValue, maxResultCount, excludeDtsFiles, excludeLibFiles);
142115
142122
  }
142116
142123
  function getEmitOutput(fileName, emitOnlyDtsFiles, forceDtsEmit) {
142117
142124
  synchronizeHostData();
@@ -181697,6 +181704,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
181697
181704
  const { file, project } = this.getFileAndProject(args);
181698
181705
  return [{ project, navigateToItems: project.getLanguageService().getNavigateToItems(searchValue, maxResultCount, file) }];
181699
181706
  }
181707
+ const preferences = this.getHostPreferences();
181700
181708
  const outputs = [];
181701
181709
  const seenItems = /* @__PURE__ */ new Map();
181702
181710
  if (!args.file && !projectFileName) {
@@ -181719,7 +181727,9 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
181719
181727
  /*fileName*/
181720
181728
  void 0,
181721
181729
  /*excludeDts*/
181722
- project.isNonTsProject()
181730
+ project.isNonTsProject(),
181731
+ /*excludeLibFiles*/
181732
+ preferences.excludeLibrarySymbolsInNavTo
181723
181733
  );
181724
181734
  const unseenItems = filter(projectItems, (item) => tryAddSeenItem(item) && !getMappedLocationForProject(documentSpanLocation(item), project));
181725
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.20230906`;
57
+ var version = `${versionMajorMinor}.0-dev.20230908`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -27887,7 +27887,6 @@ function realPath(path2, host, traceEnabled) {
27887
27887
  if (traceEnabled) {
27888
27888
  trace(host, Diagnostics.Resolving_real_path_for_0_result_1, path2, real);
27889
27889
  }
27890
- Debug.assert(host.fileExists(real), `${path2} linked to nonexistent file ${real}`);
27891
27890
  return real;
27892
27891
  }
27893
27892
  function nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, considerPackageJson) {
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.20230906",
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": "6d520282878f87d381d5ce8cf465f1e16a54e797"
115
+ "gitHead": "eb374c28d6810e317b0c353d9b1330b0595458f4"
116
116
  }