@typescript-deploys/pr-build 5.1.0-pr-53001-3 → 5.1.0-pr-53040-3

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/README.md CHANGED
@@ -5,6 +5,8 @@
5
5
  [![Devops Build Status](https://dev.azure.com/typescript/TypeScript/_apis/build/status/Typescript/node10)](https://dev.azure.com/typescript/TypeScript/_build?definitionId=7)
6
6
  [![npm version](https://badge.fury.io/js/typescript.svg)](https://www.npmjs.com/package/typescript)
7
7
  [![Downloads](https://img.shields.io/npm/dm/typescript.svg)](https://www.npmjs.com/package/typescript)
8
+ [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/microsoft/TypeScript/badge)](https://api.securityscorecards.dev/projects/github.com/microsoft/TypeScript)
9
+
8
10
 
9
11
  [TypeScript](https://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types to JavaScript that support tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](https://www.typescriptlang.org/play/), and stay up to date via [our blog](https://blogs.msdn.microsoft.com/typescript) and [Twitter account](https://twitter.com/typescript).
10
12
 
@@ -82,7 +82,7 @@ interface WeakMap<K extends object, V> {
82
82
  }
83
83
 
84
84
  interface WeakMapConstructor {
85
- new <K extends object = object, V = any>(entries?: readonly [K, V][] | null): WeakMap<K, V>;
85
+ new <K extends object = object, V = any>(entries?: readonly (readonly [K, V])[] | null): WeakMap<K, V>;
86
86
  readonly prototype: WeakMap<object, any>;
87
87
  }
88
88
  declare var WeakMap: WeakMapConstructor;
package/lib/tsc.js CHANGED
@@ -23,7 +23,7 @@ var __export = (target, all) => {
23
23
 
24
24
  // src/compiler/corePublic.ts
25
25
  var versionMajorMinor = "5.1";
26
- var version = `${versionMajorMinor}.0-insiders.20230228`;
26
+ var version = `${versionMajorMinor}.0-insiders.20230301`;
27
27
 
28
28
  // src/compiler/core.ts
29
29
  var emptyArray = [];
@@ -842,9 +842,6 @@ function multiMapRemove(key, value) {
842
842
  }
843
843
  }
844
844
  }
845
- function createUnderscoreEscapedMultiMap() {
846
- return createMultiMap();
847
- }
848
845
  function createQueue(items) {
849
846
  const elements = (items == null ? void 0 : items.slice()) || [];
850
847
  let headIndex = 0;
@@ -46264,9 +46261,21 @@ function createTypeChecker(host) {
46264
46261
  });
46265
46262
  }
46266
46263
  function getSymbolIfSameReference(s1, s2) {
46267
- if (getMergedSymbol(resolveSymbol(getMergedSymbol(s1))) === getMergedSymbol(resolveSymbol(getMergedSymbol(s2)))) {
46268
- return s1;
46269
- }
46264
+ if (s1 === s2)
46265
+ return true;
46266
+ s1 = getMergedSymbol(s1);
46267
+ s2 = getMergedSymbol(s2);
46268
+ if (s1 === s2)
46269
+ return true;
46270
+ s1 = resolveSymbol(s1);
46271
+ s2 = resolveSymbol(s2);
46272
+ if (s1 === s2)
46273
+ return true;
46274
+ s1 = getMergedSymbol(s1);
46275
+ s2 = getMergedSymbol(s2);
46276
+ if (s1 === s2)
46277
+ return true;
46278
+ return false;
46270
46279
  }
46271
46280
  function getExportSymbolOfValueSymbolIfExported(symbol) {
46272
46281
  return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 && symbol.exportSymbol || symbol);
@@ -47794,7 +47803,7 @@ function createTypeChecker(host) {
47794
47803
  }
47795
47804
  }
47796
47805
  const mayHaveNameCollisions = !(context.flags & 64 /* UseFullyQualifiedType */);
47797
- const seenNames = mayHaveNameCollisions ? createUnderscoreEscapedMultiMap() : void 0;
47806
+ const seenNames = mayHaveNameCollisions ? createMultiMap() : void 0;
47798
47807
  const result = [];
47799
47808
  let i = 0;
47800
47809
  for (const type of types) {
package/lib/tsserver.js CHANGED
@@ -472,7 +472,6 @@ __export(server_exports, {
472
472
  createTypeChecker: () => createTypeChecker,
473
473
  createTypeReferenceDirectiveResolutionCache: () => createTypeReferenceDirectiveResolutionCache,
474
474
  createTypeReferenceResolutionLoader: () => createTypeReferenceResolutionLoader,
475
- createUnderscoreEscapedMultiMap: () => createUnderscoreEscapedMultiMap,
476
475
  createUnparsedSourceFile: () => createUnparsedSourceFile,
477
476
  createWatchCompilerHost: () => createWatchCompilerHost2,
478
477
  createWatchCompilerHostOfConfigFile: () => createWatchCompilerHostOfConfigFile,
@@ -2288,7 +2287,7 @@ module.exports = __toCommonJS(server_exports);
2288
2287
 
2289
2288
  // src/compiler/corePublic.ts
2290
2289
  var versionMajorMinor = "5.1";
2291
- var version = `${versionMajorMinor}.0-insiders.20230228`;
2290
+ var version = `${versionMajorMinor}.0-insiders.20230301`;
2292
2291
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2293
2292
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2294
2293
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -3271,9 +3270,6 @@ function multiMapRemove(key, value) {
3271
3270
  }
3272
3271
  }
3273
3272
  }
3274
- function createUnderscoreEscapedMultiMap() {
3275
- return createMultiMap();
3276
- }
3277
3273
  function createQueue(items) {
3278
3274
  const elements = (items == null ? void 0 : items.slice()) || [];
3279
3275
  let headIndex = 0;
@@ -50871,9 +50867,21 @@ function createTypeChecker(host) {
50871
50867
  });
50872
50868
  }
50873
50869
  function getSymbolIfSameReference(s1, s2) {
50874
- if (getMergedSymbol(resolveSymbol(getMergedSymbol(s1))) === getMergedSymbol(resolveSymbol(getMergedSymbol(s2)))) {
50875
- return s1;
50876
- }
50870
+ if (s1 === s2)
50871
+ return true;
50872
+ s1 = getMergedSymbol(s1);
50873
+ s2 = getMergedSymbol(s2);
50874
+ if (s1 === s2)
50875
+ return true;
50876
+ s1 = resolveSymbol(s1);
50877
+ s2 = resolveSymbol(s2);
50878
+ if (s1 === s2)
50879
+ return true;
50880
+ s1 = getMergedSymbol(s1);
50881
+ s2 = getMergedSymbol(s2);
50882
+ if (s1 === s2)
50883
+ return true;
50884
+ return false;
50877
50885
  }
50878
50886
  function getExportSymbolOfValueSymbolIfExported(symbol) {
50879
50887
  return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 && symbol.exportSymbol || symbol);
@@ -52401,7 +52409,7 @@ function createTypeChecker(host) {
52401
52409
  }
52402
52410
  }
52403
52411
  const mayHaveNameCollisions = !(context.flags & 64 /* UseFullyQualifiedType */);
52404
- const seenNames = mayHaveNameCollisions ? createUnderscoreEscapedMultiMap() : void 0;
52412
+ const seenNames = mayHaveNameCollisions ? createMultiMap() : void 0;
52405
52413
  const result = [];
52406
52414
  let i = 0;
52407
52415
  for (const type of types) {
@@ -146251,7 +146259,7 @@ function inferTypeFromReferences(program, references, cancellationToken) {
146251
146259
  const props = createMultiMap();
146252
146260
  for (const anon2 of anons) {
146253
146261
  for (const p of checker.getPropertiesOfType(anon2)) {
146254
- props.add(p.name, p.valueDeclaration ? checker.getTypeOfSymbolAtLocation(p, p.valueDeclaration) : checker.getAnyType());
146262
+ props.add(p.escapedName, p.valueDeclaration ? checker.getTypeOfSymbolAtLocation(p, p.valueDeclaration) : checker.getAnyType());
146255
146263
  }
146256
146264
  calls.push(...checker.getSignaturesOfType(anon2, 0 /* Call */));
146257
146265
  constructs.push(...checker.getSignaturesOfType(anon2, 1 /* Construct */));
@@ -150115,7 +150123,8 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
150115
150123
  }
150116
150124
  log("getCompletionData: Semantic work: " + (timestamp() - semanticStart));
150117
150125
  const contextualType = previousToken && getContextualType(previousToken, position, sourceFile, typeChecker);
150118
- const literals = mapDefined(
150126
+ const isLiteralExpected = !tryCast(previousToken, isStringLiteralLike) && !isJsxIdentifierExpected;
150127
+ const literals = !isLiteralExpected ? [] : mapDefined(
150119
150128
  contextualType && (contextualType.isUnion() ? contextualType.types : [contextualType]),
150120
150129
  (t) => t.isLiteral() && !(t.flags & 1024 /* EnumLiteral */) ? t.value : void 0
150121
150130
  );
@@ -168107,7 +168116,6 @@ __export(ts_exports3, {
168107
168116
  createTypeChecker: () => createTypeChecker,
168108
168117
  createTypeReferenceDirectiveResolutionCache: () => createTypeReferenceDirectiveResolutionCache,
168109
168118
  createTypeReferenceResolutionLoader: () => createTypeReferenceResolutionLoader,
168110
- createUnderscoreEscapedMultiMap: () => createUnderscoreEscapedMultiMap,
168111
168119
  createUnparsedSourceFile: () => createUnparsedSourceFile,
168112
168120
  createWatchCompilerHost: () => createWatchCompilerHost2,
168113
168121
  createWatchCompilerHostOfConfigFile: () => createWatchCompilerHostOfConfigFile,
@@ -170600,14 +170608,17 @@ var TextStorage = class {
170600
170608
  * True when reloading contents of file from the disk is pending
170601
170609
  */
170602
170610
  this.pendingReloadFromDisk = false;
170603
- this.version = initialVersion || 0;
170611
+ this.version = initialVersion || { svc: 0, text: 0 };
170604
170612
  }
170605
170613
  getVersion() {
170606
- return this.svc ? `SVC-${this.version}-${this.svc.getSnapshotVersion()}` : `Text-${this.version}`;
170614
+ return this.svc ? `SVC-${this.version.svc}-${this.svc.getSnapshotVersion()}` : `Text-${this.version.text}`;
170607
170615
  }
170608
170616
  hasScriptVersionCache_TestOnly() {
170609
170617
  return this.svc !== void 0;
170610
170618
  }
170619
+ useScriptVersionCache_TestOnly() {
170620
+ this.switchToScriptVersionCache();
170621
+ }
170611
170622
  resetSourceMapInfo() {
170612
170623
  this.info.sourceFileLike = void 0;
170613
170624
  this.info.closeSourceMapFileWatcher();
@@ -170620,17 +170631,15 @@ var TextStorage = class {
170620
170631
  useText(newText) {
170621
170632
  this.svc = void 0;
170622
170633
  this.text = newText;
170623
- this.textSnapshot = void 0;
170624
170634
  this.lineMap = void 0;
170625
170635
  this.fileSize = void 0;
170626
170636
  this.resetSourceMapInfo();
170627
- this.version++;
170637
+ this.version.text++;
170628
170638
  }
170629
170639
  edit(start2, end, newText) {
170630
170640
  this.switchToScriptVersionCache().edit(start2, end - start2, newText);
170631
170641
  this.ownFileText = false;
170632
170642
  this.text = void 0;
170633
- this.textSnapshot = void 0;
170634
170643
  this.lineMap = void 0;
170635
170644
  this.fileSize = void 0;
170636
170645
  this.resetSourceMapInfo();
@@ -170642,9 +170651,6 @@ var TextStorage = class {
170642
170651
  reload(newText) {
170643
170652
  Debug.assert(newText !== void 0);
170644
170653
  this.pendingReloadFromDisk = false;
170645
- if (!this.text && this.svc) {
170646
- this.text = getSnapshotText(this.svc.getSnapshot());
170647
- }
170648
170654
  if (this.text !== newText) {
170649
170655
  this.useText(newText);
170650
170656
  this.ownFileText = false;
@@ -170657,18 +170663,21 @@ var TextStorage = class {
170657
170663
  * returns true if text changed
170658
170664
  */
170659
170665
  reloadWithFileText(tempFileName) {
170660
- const { text: newText, fileSize } = tempFileName || !this.info.isDynamicOrHasMixedContent() ? this.getFileTextAndSize(tempFileName) : { text: "", fileSize: void 0 };
170666
+ const { text: newText, fileSize } = this.getFileTextAndSize(tempFileName);
170661
170667
  const reloaded = this.reload(newText);
170662
170668
  this.fileSize = fileSize;
170663
170669
  this.ownFileText = !tempFileName || tempFileName === this.info.fileName;
170664
170670
  return reloaded;
170665
170671
  }
170666
170672
  /**
170667
- * Schedule reload from the disk if its not already scheduled and its not own text
170668
- * returns true when scheduling reload
170673
+ * Reloads the contents from the file if there is no pending reload from disk or the contents of file are same as file text
170674
+ * returns true if text changed
170669
170675
  */
170670
- scheduleReloadIfNeeded() {
170671
- return !this.pendingReloadFromDisk && !this.ownFileText ? this.pendingReloadFromDisk = true : false;
170676
+ reloadFromDisk() {
170677
+ if (!this.pendingReloadFromDisk && !this.ownFileText) {
170678
+ return this.reloadWithFileText();
170679
+ }
170680
+ return false;
170672
170681
  }
170673
170682
  delayReloadFromFileIntoText() {
170674
170683
  this.pendingReloadFromDisk = true;
@@ -170684,48 +170693,39 @@ var TextStorage = class {
170684
170693
  return !!this.fileSize ? this.fileSize : !!this.text ? this.text.length : !!this.svc ? this.svc.getSnapshot().getLength() : this.getSnapshot().getLength();
170685
170694
  }
170686
170695
  getSnapshot() {
170687
- var _a2, _b;
170688
- return ((_a2 = this.tryUseScriptVersionCache()) == null ? void 0 : _a2.getSnapshot()) || ((_b = this.textSnapshot) != null ? _b : this.textSnapshot = ScriptSnapshot.fromString(Debug.checkDefined(this.text)));
170696
+ return this.useScriptVersionCacheIfValidOrOpen() ? this.svc.getSnapshot() : ScriptSnapshot.fromString(this.getOrLoadText());
170689
170697
  }
170690
- getAbsolutePositionAndLineText(oneBasedLine) {
170691
- const svc = this.tryUseScriptVersionCache();
170692
- if (svc)
170693
- return svc.getAbsolutePositionAndLineText(oneBasedLine);
170694
- const lineMap = this.getLineMap();
170695
- return oneBasedLine <= lineMap.length ? {
170696
- absolutePosition: lineMap[oneBasedLine - 1],
170697
- lineText: this.text.substring(lineMap[oneBasedLine - 1], lineMap[oneBasedLine])
170698
- } : {
170699
- absolutePosition: this.text.length,
170700
- lineText: void 0
170701
- };
170698
+ getAbsolutePositionAndLineText(line) {
170699
+ return this.switchToScriptVersionCache().getAbsolutePositionAndLineText(line);
170702
170700
  }
170703
170701
  /**
170704
170702
  * @param line 0 based index
170705
170703
  */
170706
170704
  lineToTextSpan(line) {
170707
- const svc = this.tryUseScriptVersionCache();
170708
- if (svc)
170709
- return svc.lineToTextSpan(line);
170710
- const lineMap = this.getLineMap();
170711
- const start2 = lineMap[line];
170712
- const end = line + 1 < lineMap.length ? lineMap[line + 1] : this.text.length;
170713
- return createTextSpanFromBounds(start2, end);
170705
+ if (!this.useScriptVersionCacheIfValidOrOpen()) {
170706
+ const lineMap = this.getLineMap();
170707
+ const start2 = lineMap[line];
170708
+ const end = line + 1 < lineMap.length ? lineMap[line + 1] : this.text.length;
170709
+ return createTextSpanFromBounds(start2, end);
170710
+ }
170711
+ return this.svc.lineToTextSpan(line);
170714
170712
  }
170715
170713
  /**
170716
170714
  * @param line 1 based index
170717
170715
  * @param offset 1 based index
170718
170716
  */
170719
170717
  lineOffsetToPosition(line, offset, allowEdits) {
170720
- const svc = this.tryUseScriptVersionCache();
170721
- return svc ? svc.lineOffsetToPosition(line, offset) : computePositionOfLineAndCharacter(this.getLineMap(), line - 1, offset - 1, this.text, allowEdits);
170718
+ if (!this.useScriptVersionCacheIfValidOrOpen()) {
170719
+ return computePositionOfLineAndCharacter(this.getLineMap(), line - 1, offset - 1, this.text, allowEdits);
170720
+ }
170721
+ return this.svc.lineOffsetToPosition(line, offset);
170722
170722
  }
170723
170723
  positionToLineOffset(position) {
170724
- const svc = this.tryUseScriptVersionCache();
170725
- if (svc)
170726
- return svc.positionToLineOffset(position);
170727
- const { line, character } = computeLineAndCharacterOfPosition(this.getLineMap(), position);
170728
- return { line: line + 1, offset: character + 1 };
170724
+ if (!this.useScriptVersionCacheIfValidOrOpen()) {
170725
+ const { line, character } = computeLineAndCharacterOfPosition(this.getLineMap(), position);
170726
+ return { line: line + 1, offset: character + 1 };
170727
+ }
170728
+ return this.svc.positionToLineOffset(position);
170729
170729
  }
170730
170730
  getFileTextAndSize(tempFileName) {
170731
170731
  let text;
@@ -170743,25 +170743,19 @@ var TextStorage = class {
170743
170743
  }
170744
170744
  return { text: getText() };
170745
170745
  }
170746
- /** @internal */
170747
170746
  switchToScriptVersionCache() {
170748
170747
  if (!this.svc || this.pendingReloadFromDisk) {
170749
170748
  this.svc = ScriptVersionCache.fromString(this.getOrLoadText());
170750
- this.textSnapshot = void 0;
170751
- this.version++;
170749
+ this.version.svc++;
170752
170750
  }
170753
170751
  return this.svc;
170754
170752
  }
170755
- tryUseScriptVersionCache() {
170756
- if (!this.svc || this.pendingReloadFromDisk) {
170757
- this.getOrLoadText();
170758
- }
170753
+ useScriptVersionCacheIfValidOrOpen() {
170759
170754
  if (this.isOpen) {
170760
- if (!this.svc && !this.textSnapshot) {
170761
- this.svc = ScriptVersionCache.fromString(Debug.checkDefined(this.text));
170762
- this.textSnapshot = void 0;
170763
- }
170764
- return this.svc;
170755
+ return this.switchToScriptVersionCache();
170756
+ }
170757
+ if (this.pendingReloadFromDisk) {
170758
+ this.reloadWithFileText();
170765
170759
  }
170766
170760
  return this.svc;
170767
170761
  }
@@ -170774,14 +170768,13 @@ var TextStorage = class {
170774
170768
  }
170775
170769
  getLineMap() {
170776
170770
  Debug.assert(!this.svc, "ScriptVersionCache should not be set");
170777
- return this.lineMap || (this.lineMap = computeLineStarts(Debug.checkDefined(this.text)));
170771
+ return this.lineMap || (this.lineMap = computeLineStarts(this.getOrLoadText()));
170778
170772
  }
170779
170773
  getLineInfo() {
170780
- const svc = this.tryUseScriptVersionCache();
170781
- if (svc) {
170774
+ if (this.svc) {
170782
170775
  return {
170783
- getLineCount: () => svc.getLineCount(),
170784
- getLineText: (line) => svc.getAbsolutePositionAndLineText(line + 1).lineText
170776
+ getLineCount: () => this.svc.getLineCount(),
170777
+ getLineText: (line) => this.svc.getAbsolutePositionAndLineText(line + 1).lineText
170785
170778
  };
170786
170779
  }
170787
170780
  const lineMap = this.getLineMap();
@@ -170805,11 +170798,20 @@ var ScriptInfo = class {
170805
170798
  this.isDynamic = isDynamicFileName(fileName);
170806
170799
  this.textStorage = new TextStorage(host, this, initialVersion);
170807
170800
  if (hasMixedContent || this.isDynamic) {
170801
+ this.textStorage.reload("");
170808
170802
  this.realpath = this.path;
170809
170803
  }
170810
170804
  this.scriptKind = scriptKind ? scriptKind : getScriptKindFromFileName(fileName);
170811
170805
  }
170812
170806
  /** @internal */
170807
+ getVersion() {
170808
+ return this.textStorage.version;
170809
+ }
170810
+ /** @internal */
170811
+ getTelemetryFileSize() {
170812
+ return this.textStorage.getTelemetryFileSize();
170813
+ }
170814
+ /** @internal */
170813
170815
  isDynamicOrHasMixedContent() {
170814
170816
  return this.hasMixedContent || this.isDynamic;
170815
170817
  }
@@ -170824,7 +170826,11 @@ var ScriptInfo = class {
170824
170826
  }
170825
170827
  close(fileExists = true) {
170826
170828
  this.textStorage.isOpen = false;
170827
- if (fileExists && this.textStorage.scheduleReloadIfNeeded()) {
170829
+ if (this.isDynamicOrHasMixedContent() || !fileExists) {
170830
+ if (this.textStorage.reload("")) {
170831
+ this.markContainingProjectsAsDirty();
170832
+ }
170833
+ } else if (this.textStorage.reloadFromDisk()) {
170828
170834
  this.markContainingProjectsAsDirty();
170829
170835
  }
170830
170836
  }
@@ -171004,12 +171010,22 @@ var ScriptInfo = class {
171004
171010
  this.markContainingProjectsAsDirty();
171005
171011
  }
171006
171012
  reloadFromFile(tempFileName) {
171007
- if (this.textStorage.reloadWithFileText(tempFileName)) {
171013
+ if (this.isDynamicOrHasMixedContent()) {
171014
+ this.textStorage.reload("");
171008
171015
  this.markContainingProjectsAsDirty();
171009
171016
  return true;
171017
+ } else {
171018
+ if (this.textStorage.reloadWithFileText(tempFileName)) {
171019
+ this.markContainingProjectsAsDirty();
171020
+ return true;
171021
+ }
171010
171022
  }
171011
171023
  return false;
171012
171024
  }
171025
+ /** @internal */
171026
+ getAbsolutePositionAndLineText(line) {
171027
+ return this.textStorage.getAbsolutePositionAndLineText(line);
171028
+ }
171013
171029
  editContent(start2, end, newText) {
171014
171030
  this.textStorage.edit(start2, end, newText);
171015
171031
  this.markContainingProjectsAsDirty();
@@ -171049,6 +171065,10 @@ var ScriptInfo = class {
171049
171065
  return this.scriptKind === 1 /* JS */ || this.scriptKind === 2 /* JSX */;
171050
171066
  }
171051
171067
  /** @internal */
171068
+ getLineInfo() {
171069
+ return this.textStorage.getLineInfo();
171070
+ }
171071
+ /** @internal */
171052
171072
  closeSourceMapFileWatcher() {
171053
171073
  if (this.sourceMapFilePath && !isString(this.sourceMapFilePath)) {
171054
171074
  closeFileWatcherOf(this.sourceMapFilePath);
@@ -171193,7 +171213,7 @@ function countEachFileTypes(infos, includeSizes = false) {
171193
171213
  deferredSize: 0
171194
171214
  };
171195
171215
  for (const info of infos) {
171196
- const fileSize = includeSizes ? info.textStorage.getTelemetryFileSize() : 0;
171216
+ const fileSize = includeSizes ? info.getTelemetryFileSize() : 0;
171197
171217
  switch (info.scriptKind) {
171198
171218
  case 1 /* JS */:
171199
171219
  result.js += 1;
@@ -172177,26 +172197,10 @@ var Project3 = class {
172177
172197
  const elapsed = timestamp() - start2;
172178
172198
  this.sendPerformanceEvent("UpdateGraph", elapsed);
172179
172199
  this.writeLog(`Finishing updateGraphWorker: Project: ${this.getProjectName()} Version: ${this.getProjectVersion()} structureChanged: ${hasNewProgram}${this.program ? ` structureIsReused:: ${StructureIsReused[this.program.structureIsReused]}` : ""} Elapsed: ${elapsed}ms`);
172180
- if (this.projectService.logger.isTestLogger) {
172181
- if (this.program !== oldProgram) {
172182
- this.print(
172183
- /*writeProjectFileNames*/
172184
- true,
172185
- this.hasAddedorRemovedFiles,
172186
- /*writeFileVersionAndText*/
172187
- true
172188
- );
172189
- } else {
172190
- this.writeLog(`Same program as before`);
172191
- }
172192
- } else if (this.hasAddedorRemovedFiles) {
172200
+ if (this.hasAddedorRemovedFiles) {
172193
172201
  this.print(
172194
172202
  /*writeProjectFileNames*/
172195
- true,
172196
- /*writeFileExplaination*/
172197
- true,
172198
- /*writeFileVersionAndText*/
172199
- false
172203
+ true
172200
172204
  );
172201
172205
  } else if (this.program !== oldProgram) {
172202
172206
  this.writeLog(`Different program with same set of files`);
@@ -172306,16 +172310,6 @@ var Project3 = class {
172306
172310
  return this.projectService.getScriptInfo(uncheckedFileName);
172307
172311
  }
172308
172312
  filesToString(writeProjectFileNames) {
172309
- return this.filesToStringWorker(
172310
- writeProjectFileNames,
172311
- /*writeFileExplaination*/
172312
- true,
172313
- /*writeFileVersionAndText*/
172314
- false
172315
- );
172316
- }
172317
- /** @internal */
172318
- filesToStringWorker(writeProjectFileNames, writeFileExplaination, writeFileVersionAndText) {
172319
172313
  if (this.isInitialLoadPending())
172320
172314
  return " Files (0) InitialLoadPending\n";
172321
172315
  if (!this.program)
@@ -172325,33 +172319,23 @@ var Project3 = class {
172325
172319
  `;
172326
172320
  if (writeProjectFileNames) {
172327
172321
  for (const file of sourceFiles) {
172328
- strBuilder += ` ${file.fileName}${writeFileVersionAndText ? ` ${file.version} ${JSON.stringify(file.text)}` : ""}
172322
+ strBuilder += ` ${file.fileName}
172329
172323
  `;
172330
172324
  }
172331
- if (writeFileExplaination) {
172332
- strBuilder += "\n\n";
172333
- explainFiles(this.program, (s) => strBuilder += ` ${s}
172325
+ strBuilder += "\n\n";
172326
+ explainFiles(this.program, (s) => strBuilder += ` ${s}
172334
172327
  `);
172335
- }
172336
172328
  }
172337
172329
  return strBuilder;
172338
172330
  }
172339
172331
  /** @internal */
172340
- print(writeProjectFileNames, writeFileExplaination, writeFileVersionAndText) {
172332
+ print(writeProjectFileNames) {
172341
172333
  this.writeLog(`Project '${this.projectName}' (${ProjectKind[this.projectKind]})`);
172342
- this.writeLog(this.filesToStringWorker(
172343
- writeProjectFileNames && this.projectService.logger.hasLevel(3 /* verbose */),
172344
- writeFileExplaination && this.projectService.logger.hasLevel(3 /* verbose */),
172345
- writeFileVersionAndText && this.projectService.logger.hasLevel(3 /* verbose */)
172346
- ));
172334
+ this.writeLog(this.filesToString(writeProjectFileNames && this.projectService.logger.hasLevel(3 /* verbose */)));
172347
172335
  this.writeLog("-----------------------------------------------");
172348
172336
  if (this.autoImportProviderHost) {
172349
172337
  this.autoImportProviderHost.print(
172350
172338
  /*writeProjectFileNames*/
172351
- false,
172352
- /*writeFileExplaination*/
172353
- false,
172354
- /*writeFileVersionAndText*/
172355
172339
  false
172356
172340
  );
172357
172341
  }
@@ -174306,11 +174290,7 @@ var _ProjectService = class {
174306
174290
  this.logger.info("`remove Project::");
174307
174291
  project.print(
174308
174292
  /*writeProjectFileNames*/
174309
- true,
174310
- /*writeFileExplaination*/
174311
- true,
174312
- /*writeFileVersionAndText*/
174313
- false
174293
+ true
174314
174294
  );
174315
174295
  project.close();
174316
174296
  if (Debug.shouldAssert(1 /* Normal */)) {
@@ -174449,7 +174429,7 @@ var _ProjectService = class {
174449
174429
  }
174450
174430
  deleteScriptInfo(info) {
174451
174431
  this.filenameToScriptInfo.delete(info.path);
174452
- this.filenameToScriptInfoVersion.set(info.path, info.textStorage.version);
174432
+ this.filenameToScriptInfoVersion.set(info.path, info.getVersion());
174453
174433
  const realpath = info.getRealpathIfDifferent();
174454
174434
  if (realpath) {
174455
174435
  this.realpathToScriptInfos.remove(realpath, info);
@@ -175533,7 +175513,7 @@ Dynamic files must always be opened with service's current directory or service
175533
175513
  const documentPositionMapper = getDocumentPositionMapper(
175534
175514
  { getCanonicalFileName: this.toCanonicalFileName, log: (s) => this.logger.info(s), getSourceFileLike: (f) => this.getSourceFileLike(f, projectName, declarationInfo) },
175535
175515
  declarationInfo.fileName,
175536
- declarationInfo.textStorage.getLineInfo(),
175516
+ declarationInfo.getLineInfo(),
175537
175517
  readMapFile
175538
175518
  );
175539
175519
  readMapFile = void 0;
@@ -176664,10 +176644,6 @@ function isConfigFile(config) {
176664
176644
  function printProjectWithoutFileNames(project) {
176665
176645
  project.print(
176666
176646
  /*writeProjectFileNames*/
176667
- false,
176668
- /*writeFileExplaination*/
176669
- false,
176670
- /*writeFileVersionAndText*/
176671
176647
  false
176672
176648
  );
176673
176649
  }
@@ -179129,7 +179105,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
179129
179105
  formatOptions
179130
179106
  );
179131
179107
  if (args.key === "\n" && (!edits || edits.length === 0 || allEditsBeforePos(edits, position))) {
179132
- const { lineText, absolutePosition } = scriptInfo.textStorage.getAbsolutePositionAndLineText(args.line);
179108
+ const { lineText, absolutePosition } = scriptInfo.getAbsolutePositionAndLineText(args.line);
179133
179109
  if (lineText && lineText.search("\\S") < 0) {
179134
179110
  const preferredIndent = languageService.getIndentationAtPosition(file, position, formatOptions);
179135
179111
  let hasIndent = 0;
@@ -179354,7 +179330,6 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
179354
179330
  change(args) {
179355
179331
  const scriptInfo = this.projectService.getScriptInfo(args.file);
179356
179332
  Debug.assert(!!scriptInfo);
179357
- scriptInfo.textStorage.switchToScriptVersionCache();
179358
179333
  const start2 = scriptInfo.lineOffsetToPosition(args.line, args.offset);
179359
179334
  const end = scriptInfo.lineOffsetToPosition(args.endLine, args.endOffset);
179360
179335
  if (start2 >= 0) {
@@ -182090,7 +182065,6 @@ start(initializeNodeSystem(), require("os").platform());
182090
182065
  createTypeChecker,
182091
182066
  createTypeReferenceDirectiveResolutionCache,
182092
182067
  createTypeReferenceResolutionLoader,
182093
- createUnderscoreEscapedMultiMap,
182094
182068
  createUnparsedSourceFile,
182095
182069
  createWatchCompilerHost,
182096
182070
  createWatchCompilerHostOfConfigFile,
@@ -3065,6 +3065,10 @@ declare namespace ts {
3065
3065
  remove(path: NormalizedPath): void;
3066
3066
  }
3067
3067
  function isDynamicFileName(fileName: NormalizedPath): boolean;
3068
+ interface ScriptInfoVersion {
3069
+ svc: number;
3070
+ text: number;
3071
+ }
3068
3072
  class ScriptInfo {
3069
3073
  private readonly host;
3070
3074
  readonly fileName: NormalizedPath;
@@ -3077,9 +3081,10 @@ declare namespace ts {
3077
3081
  readonly containingProjects: Project[];
3078
3082
  private formatSettings;
3079
3083
  private preferences;
3080
- constructor(host: ServerHost, fileName: NormalizedPath, scriptKind: ScriptKind, hasMixedContent: boolean, path: Path, initialVersion?: number);
3084
+ private textStorage;
3085
+ constructor(host: ServerHost, fileName: NormalizedPath, scriptKind: ScriptKind, hasMixedContent: boolean, path: Path, initialVersion?: ScriptInfoVersion);
3081
3086
  isScriptOpen(): boolean;
3082
- open(newText: string | undefined): void;
3087
+ open(newText: string): void;
3083
3088
  close(fileExists?: boolean): void;
3084
3089
  getSnapshot(): IScriptSnapshot;
3085
3090
  private ensureRealPath;
@@ -6631,14 +6636,12 @@ declare namespace ts {
6631
6636
  }) | (void & {
6632
6637
  __escapedIdentifier: void;
6633
6638
  }) | InternalSymbolName;
6634
- /** ReadonlyMap where keys are `__String`s. */
6635
- interface ReadonlyUnderscoreEscapedMap<T> extends ReadonlyMap<__String, T> {
6636
- }
6637
- /** Map where keys are `__String`s. */
6638
- interface UnderscoreEscapedMap<T> extends Map<__String, T> {
6639
- }
6639
+ /** @deprecated Use ReadonlyMap<__String, T> instead. */
6640
+ type ReadonlyUnderscoreEscapedMap<T> = ReadonlyMap<__String, T>;
6641
+ /** @deprecated Use Map<__String, T> instead. */
6642
+ type UnderscoreEscapedMap<T> = Map<__String, T>;
6640
6643
  /** SymbolTable based on ES6 Map interface. */
6641
- type SymbolTable = UnderscoreEscapedMap<Symbol>;
6644
+ type SymbolTable = Map<__String, Symbol>;
6642
6645
  enum TypeFlags {
6643
6646
  Any = 1,
6644
6647
  Unknown = 2,
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.1";
38
- version = `${versionMajorMinor}.0-insiders.20230228`;
38
+ version = `${versionMajorMinor}.0-insiders.20230301`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -1000,9 +1000,6 @@ var ts = (() => {
1000
1000
  }
1001
1001
  }
1002
1002
  }
1003
- function createUnderscoreEscapedMultiMap() {
1004
- return createMultiMap();
1005
- }
1006
1003
  function createQueue(items) {
1007
1004
  const elements = (items == null ? void 0 : items.slice()) || [];
1008
1005
  let headIndex = 0;
@@ -48679,9 +48676,21 @@ ${lanes.join("\n")}
48679
48676
  });
48680
48677
  }
48681
48678
  function getSymbolIfSameReference(s1, s2) {
48682
- if (getMergedSymbol(resolveSymbol(getMergedSymbol(s1))) === getMergedSymbol(resolveSymbol(getMergedSymbol(s2)))) {
48683
- return s1;
48684
- }
48679
+ if (s1 === s2)
48680
+ return true;
48681
+ s1 = getMergedSymbol(s1);
48682
+ s2 = getMergedSymbol(s2);
48683
+ if (s1 === s2)
48684
+ return true;
48685
+ s1 = resolveSymbol(s1);
48686
+ s2 = resolveSymbol(s2);
48687
+ if (s1 === s2)
48688
+ return true;
48689
+ s1 = getMergedSymbol(s1);
48690
+ s2 = getMergedSymbol(s2);
48691
+ if (s1 === s2)
48692
+ return true;
48693
+ return false;
48685
48694
  }
48686
48695
  function getExportSymbolOfValueSymbolIfExported(symbol) {
48687
48696
  return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 && symbol.exportSymbol || symbol);
@@ -50209,7 +50218,7 @@ ${lanes.join("\n")}
50209
50218
  }
50210
50219
  }
50211
50220
  const mayHaveNameCollisions = !(context.flags & 64 /* UseFullyQualifiedType */);
50212
- const seenNames = mayHaveNameCollisions ? createUnderscoreEscapedMultiMap() : void 0;
50221
+ const seenNames = mayHaveNameCollisions ? createMultiMap() : void 0;
50213
50222
  const result = [];
50214
50223
  let i = 0;
50215
50224
  for (const type of types) {
@@ -145036,7 +145045,7 @@ ${lanes.join("\n")}
145036
145045
  const props = createMultiMap();
145037
145046
  for (const anon2 of anons) {
145038
145047
  for (const p of checker.getPropertiesOfType(anon2)) {
145039
- props.add(p.name, p.valueDeclaration ? checker.getTypeOfSymbolAtLocation(p, p.valueDeclaration) : checker.getAnyType());
145048
+ props.add(p.escapedName, p.valueDeclaration ? checker.getTypeOfSymbolAtLocation(p, p.valueDeclaration) : checker.getAnyType());
145040
145049
  }
145041
145050
  calls.push(...checker.getSignaturesOfType(anon2, 0 /* Call */));
145042
145051
  constructs.push(...checker.getSignaturesOfType(anon2, 1 /* Construct */));
@@ -149158,7 +149167,8 @@ ${lanes.join("\n")}
149158
149167
  }
149159
149168
  log("getCompletionData: Semantic work: " + (timestamp() - semanticStart));
149160
149169
  const contextualType = previousToken && getContextualType(previousToken, position, sourceFile, typeChecker);
149161
- const literals = mapDefined(
149170
+ const isLiteralExpected = !tryCast(previousToken, isStringLiteralLike) && !isJsxIdentifierExpected;
149171
+ const literals = !isLiteralExpected ? [] : mapDefined(
149162
149172
  contextualType && (contextualType.isUnion() ? contextualType.types : [contextualType]),
149163
149173
  (t) => t.isLiteral() && !(t.flags & 1024 /* EnumLiteral */) ? t.value : void 0
149164
149174
  );
@@ -167926,14 +167936,17 @@ ${options.prefix}` : "\n" : options.prefix
167926
167936
  * True when reloading contents of file from the disk is pending
167927
167937
  */
167928
167938
  this.pendingReloadFromDisk = false;
167929
- this.version = initialVersion || 0;
167939
+ this.version = initialVersion || { svc: 0, text: 0 };
167930
167940
  }
167931
167941
  getVersion() {
167932
- return this.svc ? `SVC-${this.version}-${this.svc.getSnapshotVersion()}` : `Text-${this.version}`;
167942
+ return this.svc ? `SVC-${this.version.svc}-${this.svc.getSnapshotVersion()}` : `Text-${this.version.text}`;
167933
167943
  }
167934
167944
  hasScriptVersionCache_TestOnly() {
167935
167945
  return this.svc !== void 0;
167936
167946
  }
167947
+ useScriptVersionCache_TestOnly() {
167948
+ this.switchToScriptVersionCache();
167949
+ }
167937
167950
  resetSourceMapInfo() {
167938
167951
  this.info.sourceFileLike = void 0;
167939
167952
  this.info.closeSourceMapFileWatcher();
@@ -167946,17 +167959,15 @@ ${options.prefix}` : "\n" : options.prefix
167946
167959
  useText(newText) {
167947
167960
  this.svc = void 0;
167948
167961
  this.text = newText;
167949
- this.textSnapshot = void 0;
167950
167962
  this.lineMap = void 0;
167951
167963
  this.fileSize = void 0;
167952
167964
  this.resetSourceMapInfo();
167953
- this.version++;
167965
+ this.version.text++;
167954
167966
  }
167955
167967
  edit(start, end, newText) {
167956
167968
  this.switchToScriptVersionCache().edit(start, end - start, newText);
167957
167969
  this.ownFileText = false;
167958
167970
  this.text = void 0;
167959
- this.textSnapshot = void 0;
167960
167971
  this.lineMap = void 0;
167961
167972
  this.fileSize = void 0;
167962
167973
  this.resetSourceMapInfo();
@@ -167968,9 +167979,6 @@ ${options.prefix}` : "\n" : options.prefix
167968
167979
  reload(newText) {
167969
167980
  Debug.assert(newText !== void 0);
167970
167981
  this.pendingReloadFromDisk = false;
167971
- if (!this.text && this.svc) {
167972
- this.text = getSnapshotText(this.svc.getSnapshot());
167973
- }
167974
167982
  if (this.text !== newText) {
167975
167983
  this.useText(newText);
167976
167984
  this.ownFileText = false;
@@ -167983,18 +167991,21 @@ ${options.prefix}` : "\n" : options.prefix
167983
167991
  * returns true if text changed
167984
167992
  */
167985
167993
  reloadWithFileText(tempFileName) {
167986
- const { text: newText, fileSize } = tempFileName || !this.info.isDynamicOrHasMixedContent() ? this.getFileTextAndSize(tempFileName) : { text: "", fileSize: void 0 };
167994
+ const { text: newText, fileSize } = this.getFileTextAndSize(tempFileName);
167987
167995
  const reloaded = this.reload(newText);
167988
167996
  this.fileSize = fileSize;
167989
167997
  this.ownFileText = !tempFileName || tempFileName === this.info.fileName;
167990
167998
  return reloaded;
167991
167999
  }
167992
168000
  /**
167993
- * Schedule reload from the disk if its not already scheduled and its not own text
167994
- * returns true when scheduling reload
168001
+ * Reloads the contents from the file if there is no pending reload from disk or the contents of file are same as file text
168002
+ * returns true if text changed
167995
168003
  */
167996
- scheduleReloadIfNeeded() {
167997
- return !this.pendingReloadFromDisk && !this.ownFileText ? this.pendingReloadFromDisk = true : false;
168004
+ reloadFromDisk() {
168005
+ if (!this.pendingReloadFromDisk && !this.ownFileText) {
168006
+ return this.reloadWithFileText();
168007
+ }
168008
+ return false;
167998
168009
  }
167999
168010
  delayReloadFromFileIntoText() {
168000
168011
  this.pendingReloadFromDisk = true;
@@ -168010,48 +168021,39 @@ ${options.prefix}` : "\n" : options.prefix
168010
168021
  return !!this.fileSize ? this.fileSize : !!this.text ? this.text.length : !!this.svc ? this.svc.getSnapshot().getLength() : this.getSnapshot().getLength();
168011
168022
  }
168012
168023
  getSnapshot() {
168013
- var _a2, _b;
168014
- return ((_a2 = this.tryUseScriptVersionCache()) == null ? void 0 : _a2.getSnapshot()) || ((_b = this.textSnapshot) != null ? _b : this.textSnapshot = ScriptSnapshot.fromString(Debug.checkDefined(this.text)));
168024
+ return this.useScriptVersionCacheIfValidOrOpen() ? this.svc.getSnapshot() : ScriptSnapshot.fromString(this.getOrLoadText());
168015
168025
  }
168016
- getAbsolutePositionAndLineText(oneBasedLine) {
168017
- const svc = this.tryUseScriptVersionCache();
168018
- if (svc)
168019
- return svc.getAbsolutePositionAndLineText(oneBasedLine);
168020
- const lineMap = this.getLineMap();
168021
- return oneBasedLine <= lineMap.length ? {
168022
- absolutePosition: lineMap[oneBasedLine - 1],
168023
- lineText: this.text.substring(lineMap[oneBasedLine - 1], lineMap[oneBasedLine])
168024
- } : {
168025
- absolutePosition: this.text.length,
168026
- lineText: void 0
168027
- };
168026
+ getAbsolutePositionAndLineText(line) {
168027
+ return this.switchToScriptVersionCache().getAbsolutePositionAndLineText(line);
168028
168028
  }
168029
168029
  /**
168030
168030
  * @param line 0 based index
168031
168031
  */
168032
168032
  lineToTextSpan(line) {
168033
- const svc = this.tryUseScriptVersionCache();
168034
- if (svc)
168035
- return svc.lineToTextSpan(line);
168036
- const lineMap = this.getLineMap();
168037
- const start = lineMap[line];
168038
- const end = line + 1 < lineMap.length ? lineMap[line + 1] : this.text.length;
168039
- return createTextSpanFromBounds(start, end);
168033
+ if (!this.useScriptVersionCacheIfValidOrOpen()) {
168034
+ const lineMap = this.getLineMap();
168035
+ const start = lineMap[line];
168036
+ const end = line + 1 < lineMap.length ? lineMap[line + 1] : this.text.length;
168037
+ return createTextSpanFromBounds(start, end);
168038
+ }
168039
+ return this.svc.lineToTextSpan(line);
168040
168040
  }
168041
168041
  /**
168042
168042
  * @param line 1 based index
168043
168043
  * @param offset 1 based index
168044
168044
  */
168045
168045
  lineOffsetToPosition(line, offset, allowEdits) {
168046
- const svc = this.tryUseScriptVersionCache();
168047
- return svc ? svc.lineOffsetToPosition(line, offset) : computePositionOfLineAndCharacter(this.getLineMap(), line - 1, offset - 1, this.text, allowEdits);
168046
+ if (!this.useScriptVersionCacheIfValidOrOpen()) {
168047
+ return computePositionOfLineAndCharacter(this.getLineMap(), line - 1, offset - 1, this.text, allowEdits);
168048
+ }
168049
+ return this.svc.lineOffsetToPosition(line, offset);
168048
168050
  }
168049
168051
  positionToLineOffset(position) {
168050
- const svc = this.tryUseScriptVersionCache();
168051
- if (svc)
168052
- return svc.positionToLineOffset(position);
168053
- const { line, character } = computeLineAndCharacterOfPosition(this.getLineMap(), position);
168054
- return { line: line + 1, offset: character + 1 };
168052
+ if (!this.useScriptVersionCacheIfValidOrOpen()) {
168053
+ const { line, character } = computeLineAndCharacterOfPosition(this.getLineMap(), position);
168054
+ return { line: line + 1, offset: character + 1 };
168055
+ }
168056
+ return this.svc.positionToLineOffset(position);
168055
168057
  }
168056
168058
  getFileTextAndSize(tempFileName) {
168057
168059
  let text;
@@ -168069,25 +168071,19 @@ ${options.prefix}` : "\n" : options.prefix
168069
168071
  }
168070
168072
  return { text: getText() };
168071
168073
  }
168072
- /** @internal */
168073
168074
  switchToScriptVersionCache() {
168074
168075
  if (!this.svc || this.pendingReloadFromDisk) {
168075
168076
  this.svc = ScriptVersionCache.fromString(this.getOrLoadText());
168076
- this.textSnapshot = void 0;
168077
- this.version++;
168077
+ this.version.svc++;
168078
168078
  }
168079
168079
  return this.svc;
168080
168080
  }
168081
- tryUseScriptVersionCache() {
168082
- if (!this.svc || this.pendingReloadFromDisk) {
168083
- this.getOrLoadText();
168084
- }
168081
+ useScriptVersionCacheIfValidOrOpen() {
168085
168082
  if (this.isOpen) {
168086
- if (!this.svc && !this.textSnapshot) {
168087
- this.svc = ScriptVersionCache.fromString(Debug.checkDefined(this.text));
168088
- this.textSnapshot = void 0;
168089
- }
168090
- return this.svc;
168083
+ return this.switchToScriptVersionCache();
168084
+ }
168085
+ if (this.pendingReloadFromDisk) {
168086
+ this.reloadWithFileText();
168091
168087
  }
168092
168088
  return this.svc;
168093
168089
  }
@@ -168100,14 +168096,13 @@ ${options.prefix}` : "\n" : options.prefix
168100
168096
  }
168101
168097
  getLineMap() {
168102
168098
  Debug.assert(!this.svc, "ScriptVersionCache should not be set");
168103
- return this.lineMap || (this.lineMap = computeLineStarts(Debug.checkDefined(this.text)));
168099
+ return this.lineMap || (this.lineMap = computeLineStarts(this.getOrLoadText()));
168104
168100
  }
168105
168101
  getLineInfo() {
168106
- const svc = this.tryUseScriptVersionCache();
168107
- if (svc) {
168102
+ if (this.svc) {
168108
168103
  return {
168109
- getLineCount: () => svc.getLineCount(),
168110
- getLineText: (line) => svc.getAbsolutePositionAndLineText(line + 1).lineText
168104
+ getLineCount: () => this.svc.getLineCount(),
168105
+ getLineText: (line) => this.svc.getAbsolutePositionAndLineText(line + 1).lineText
168111
168106
  };
168112
168107
  }
168113
168108
  const lineMap = this.getLineMap();
@@ -168128,11 +168123,20 @@ ${options.prefix}` : "\n" : options.prefix
168128
168123
  this.isDynamic = isDynamicFileName(fileName);
168129
168124
  this.textStorage = new TextStorage(host, this, initialVersion);
168130
168125
  if (hasMixedContent || this.isDynamic) {
168126
+ this.textStorage.reload("");
168131
168127
  this.realpath = this.path;
168132
168128
  }
168133
168129
  this.scriptKind = scriptKind ? scriptKind : getScriptKindFromFileName(fileName);
168134
168130
  }
168135
168131
  /** @internal */
168132
+ getVersion() {
168133
+ return this.textStorage.version;
168134
+ }
168135
+ /** @internal */
168136
+ getTelemetryFileSize() {
168137
+ return this.textStorage.getTelemetryFileSize();
168138
+ }
168139
+ /** @internal */
168136
168140
  isDynamicOrHasMixedContent() {
168137
168141
  return this.hasMixedContent || this.isDynamic;
168138
168142
  }
@@ -168147,7 +168151,11 @@ ${options.prefix}` : "\n" : options.prefix
168147
168151
  }
168148
168152
  close(fileExists = true) {
168149
168153
  this.textStorage.isOpen = false;
168150
- if (fileExists && this.textStorage.scheduleReloadIfNeeded()) {
168154
+ if (this.isDynamicOrHasMixedContent() || !fileExists) {
168155
+ if (this.textStorage.reload("")) {
168156
+ this.markContainingProjectsAsDirty();
168157
+ }
168158
+ } else if (this.textStorage.reloadFromDisk()) {
168151
168159
  this.markContainingProjectsAsDirty();
168152
168160
  }
168153
168161
  }
@@ -168327,12 +168335,22 @@ ${options.prefix}` : "\n" : options.prefix
168327
168335
  this.markContainingProjectsAsDirty();
168328
168336
  }
168329
168337
  reloadFromFile(tempFileName) {
168330
- if (this.textStorage.reloadWithFileText(tempFileName)) {
168338
+ if (this.isDynamicOrHasMixedContent()) {
168339
+ this.textStorage.reload("");
168331
168340
  this.markContainingProjectsAsDirty();
168332
168341
  return true;
168342
+ } else {
168343
+ if (this.textStorage.reloadWithFileText(tempFileName)) {
168344
+ this.markContainingProjectsAsDirty();
168345
+ return true;
168346
+ }
168333
168347
  }
168334
168348
  return false;
168335
168349
  }
168350
+ /** @internal */
168351
+ getAbsolutePositionAndLineText(line) {
168352
+ return this.textStorage.getAbsolutePositionAndLineText(line);
168353
+ }
168336
168354
  editContent(start, end, newText) {
168337
168355
  this.textStorage.edit(start, end, newText);
168338
168356
  this.markContainingProjectsAsDirty();
@@ -168372,6 +168390,10 @@ ${options.prefix}` : "\n" : options.prefix
168372
168390
  return this.scriptKind === 1 /* JS */ || this.scriptKind === 2 /* JSX */;
168373
168391
  }
168374
168392
  /** @internal */
168393
+ getLineInfo() {
168394
+ return this.textStorage.getLineInfo();
168395
+ }
168396
+ /** @internal */
168375
168397
  closeSourceMapFileWatcher() {
168376
168398
  if (this.sourceMapFilePath && !isString(this.sourceMapFilePath)) {
168377
168399
  closeFileWatcherOf(this.sourceMapFilePath);
@@ -168502,7 +168524,7 @@ ${options.prefix}` : "\n" : options.prefix
168502
168524
  deferredSize: 0
168503
168525
  };
168504
168526
  for (const info of infos) {
168505
- const fileSize = includeSizes ? info.textStorage.getTelemetryFileSize() : 0;
168527
+ const fileSize = includeSizes ? info.getTelemetryFileSize() : 0;
168506
168528
  switch (info.scriptKind) {
168507
168529
  case 1 /* JS */:
168508
168530
  result.js += 1;
@@ -169532,26 +169554,10 @@ ${options.prefix}` : "\n" : options.prefix
169532
169554
  const elapsed = timestamp() - start;
169533
169555
  this.sendPerformanceEvent("UpdateGraph", elapsed);
169534
169556
  this.writeLog(`Finishing updateGraphWorker: Project: ${this.getProjectName()} Version: ${this.getProjectVersion()} structureChanged: ${hasNewProgram}${this.program ? ` structureIsReused:: ${StructureIsReused[this.program.structureIsReused]}` : ""} Elapsed: ${elapsed}ms`);
169535
- if (this.projectService.logger.isTestLogger) {
169536
- if (this.program !== oldProgram) {
169537
- this.print(
169538
- /*writeProjectFileNames*/
169539
- true,
169540
- this.hasAddedorRemovedFiles,
169541
- /*writeFileVersionAndText*/
169542
- true
169543
- );
169544
- } else {
169545
- this.writeLog(`Same program as before`);
169546
- }
169547
- } else if (this.hasAddedorRemovedFiles) {
169557
+ if (this.hasAddedorRemovedFiles) {
169548
169558
  this.print(
169549
169559
  /*writeProjectFileNames*/
169550
- true,
169551
- /*writeFileExplaination*/
169552
- true,
169553
- /*writeFileVersionAndText*/
169554
- false
169560
+ true
169555
169561
  );
169556
169562
  } else if (this.program !== oldProgram) {
169557
169563
  this.writeLog(`Different program with same set of files`);
@@ -169661,16 +169667,6 @@ ${options.prefix}` : "\n" : options.prefix
169661
169667
  return this.projectService.getScriptInfo(uncheckedFileName);
169662
169668
  }
169663
169669
  filesToString(writeProjectFileNames) {
169664
- return this.filesToStringWorker(
169665
- writeProjectFileNames,
169666
- /*writeFileExplaination*/
169667
- true,
169668
- /*writeFileVersionAndText*/
169669
- false
169670
- );
169671
- }
169672
- /** @internal */
169673
- filesToStringWorker(writeProjectFileNames, writeFileExplaination, writeFileVersionAndText) {
169674
169670
  if (this.isInitialLoadPending())
169675
169671
  return " Files (0) InitialLoadPending\n";
169676
169672
  if (!this.program)
@@ -169680,33 +169676,23 @@ ${options.prefix}` : "\n" : options.prefix
169680
169676
  `;
169681
169677
  if (writeProjectFileNames) {
169682
169678
  for (const file of sourceFiles) {
169683
- strBuilder += ` ${file.fileName}${writeFileVersionAndText ? ` ${file.version} ${JSON.stringify(file.text)}` : ""}
169679
+ strBuilder += ` ${file.fileName}
169684
169680
  `;
169685
169681
  }
169686
- if (writeFileExplaination) {
169687
- strBuilder += "\n\n";
169688
- explainFiles(this.program, (s) => strBuilder += ` ${s}
169682
+ strBuilder += "\n\n";
169683
+ explainFiles(this.program, (s) => strBuilder += ` ${s}
169689
169684
  `);
169690
- }
169691
169685
  }
169692
169686
  return strBuilder;
169693
169687
  }
169694
169688
  /** @internal */
169695
- print(writeProjectFileNames, writeFileExplaination, writeFileVersionAndText) {
169689
+ print(writeProjectFileNames) {
169696
169690
  this.writeLog(`Project '${this.projectName}' (${ProjectKind[this.projectKind]})`);
169697
- this.writeLog(this.filesToStringWorker(
169698
- writeProjectFileNames && this.projectService.logger.hasLevel(3 /* verbose */),
169699
- writeFileExplaination && this.projectService.logger.hasLevel(3 /* verbose */),
169700
- writeFileVersionAndText && this.projectService.logger.hasLevel(3 /* verbose */)
169701
- ));
169691
+ this.writeLog(this.filesToString(writeProjectFileNames && this.projectService.logger.hasLevel(3 /* verbose */)));
169702
169692
  this.writeLog("-----------------------------------------------");
169703
169693
  if (this.autoImportProviderHost) {
169704
169694
  this.autoImportProviderHost.print(
169705
169695
  /*writeProjectFileNames*/
169706
- false,
169707
- /*writeFileExplaination*/
169708
- false,
169709
- /*writeFileVersionAndText*/
169710
169696
  false
169711
169697
  );
169712
169698
  }
@@ -170957,10 +170943,6 @@ ${options.prefix}` : "\n" : options.prefix
170957
170943
  function printProjectWithoutFileNames(project) {
170958
170944
  project.print(
170959
170945
  /*writeProjectFileNames*/
170960
- false,
170961
- /*writeFileExplaination*/
170962
- false,
170963
- /*writeFileVersionAndText*/
170964
170946
  false
170965
170947
  );
170966
170948
  }
@@ -171665,11 +171647,7 @@ ${options.prefix}` : "\n" : options.prefix
171665
171647
  this.logger.info("`remove Project::");
171666
171648
  project.print(
171667
171649
  /*writeProjectFileNames*/
171668
- true,
171669
- /*writeFileExplaination*/
171670
- true,
171671
- /*writeFileVersionAndText*/
171672
- false
171650
+ true
171673
171651
  );
171674
171652
  project.close();
171675
171653
  if (Debug.shouldAssert(1 /* Normal */)) {
@@ -171808,7 +171786,7 @@ ${options.prefix}` : "\n" : options.prefix
171808
171786
  }
171809
171787
  deleteScriptInfo(info) {
171810
171788
  this.filenameToScriptInfo.delete(info.path);
171811
- this.filenameToScriptInfoVersion.set(info.path, info.textStorage.version);
171789
+ this.filenameToScriptInfoVersion.set(info.path, info.getVersion());
171812
171790
  const realpath = info.getRealpathIfDifferent();
171813
171791
  if (realpath) {
171814
171792
  this.realpathToScriptInfos.remove(realpath, info);
@@ -172892,7 +172870,7 @@ Dynamic files must always be opened with service's current directory or service
172892
172870
  const documentPositionMapper = getDocumentPositionMapper(
172893
172871
  { getCanonicalFileName: this.toCanonicalFileName, log: (s) => this.logger.info(s), getSourceFileLike: (f) => this.getSourceFileLike(f, projectName, declarationInfo) },
172894
172872
  declarationInfo.fileName,
172895
- declarationInfo.textStorage.getLineInfo(),
172873
+ declarationInfo.getLineInfo(),
172896
172874
  readMapFile
172897
172875
  );
172898
172876
  readMapFile = void 0;
@@ -176544,7 +176522,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
176544
176522
  formatOptions
176545
176523
  );
176546
176524
  if (args.key === "\n" && (!edits || edits.length === 0 || allEditsBeforePos(edits, position))) {
176547
- const { lineText, absolutePosition } = scriptInfo.textStorage.getAbsolutePositionAndLineText(args.line);
176525
+ const { lineText, absolutePosition } = scriptInfo.getAbsolutePositionAndLineText(args.line);
176548
176526
  if (lineText && lineText.search("\\S") < 0) {
176549
176527
  const preferredIndent = languageService.getIndentationAtPosition(file, position, formatOptions);
176550
176528
  let hasIndent = 0;
@@ -176769,7 +176747,6 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
176769
176747
  change(args) {
176770
176748
  const scriptInfo = this.projectService.getScriptInfo(args.file);
176771
176749
  Debug.assert(!!scriptInfo);
176772
- scriptInfo.textStorage.switchToScriptVersionCache();
176773
176750
  const start = scriptInfo.lineOffsetToPosition(args.line, args.offset);
176774
176751
  const end = scriptInfo.lineOffsetToPosition(args.endLine, args.endOffset);
176775
176752
  if (start >= 0) {
@@ -178725,7 +178702,6 @@ ${e.message}`;
178725
178702
  createTypeChecker: () => createTypeChecker,
178726
178703
  createTypeReferenceDirectiveResolutionCache: () => createTypeReferenceDirectiveResolutionCache,
178727
178704
  createTypeReferenceResolutionLoader: () => createTypeReferenceResolutionLoader,
178728
- createUnderscoreEscapedMultiMap: () => createUnderscoreEscapedMultiMap,
178729
178705
  createUnparsedSourceFile: () => createUnparsedSourceFile,
178730
178706
  createWatchCompilerHost: () => createWatchCompilerHost2,
178731
178707
  createWatchCompilerHostOfConfigFile: () => createWatchCompilerHostOfConfigFile,
@@ -181085,7 +181061,6 @@ ${e.message}`;
181085
181061
  createTypeChecker: () => createTypeChecker,
181086
181062
  createTypeReferenceDirectiveResolutionCache: () => createTypeReferenceDirectiveResolutionCache,
181087
181063
  createTypeReferenceResolutionLoader: () => createTypeReferenceResolutionLoader,
181088
- createUnderscoreEscapedMultiMap: () => createUnderscoreEscapedMultiMap,
181089
181064
  createUnparsedSourceFile: () => createUnparsedSourceFile,
181090
181065
  createWatchCompilerHost: () => createWatchCompilerHost2,
181091
181066
  createWatchCompilerHostOfConfigFile: () => createWatchCompilerHostOfConfigFile,
@@ -2661,14 +2661,12 @@ declare namespace ts {
2661
2661
  }) | (void & {
2662
2662
  __escapedIdentifier: void;
2663
2663
  }) | InternalSymbolName;
2664
- /** ReadonlyMap where keys are `__String`s. */
2665
- interface ReadonlyUnderscoreEscapedMap<T> extends ReadonlyMap<__String, T> {
2666
- }
2667
- /** Map where keys are `__String`s. */
2668
- interface UnderscoreEscapedMap<T> extends Map<__String, T> {
2669
- }
2664
+ /** @deprecated Use ReadonlyMap<__String, T> instead. */
2665
+ type ReadonlyUnderscoreEscapedMap<T> = ReadonlyMap<__String, T>;
2666
+ /** @deprecated Use Map<__String, T> instead. */
2667
+ type UnderscoreEscapedMap<T> = Map<__String, T>;
2670
2668
  /** SymbolTable based on ES6 Map interface. */
2671
- type SymbolTable = UnderscoreEscapedMap<Symbol>;
2669
+ type SymbolTable = Map<__String, Symbol>;
2672
2670
  enum TypeFlags {
2673
2671
  Any = 1,
2674
2672
  Unknown = 2,
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.1";
38
- version = `${versionMajorMinor}.0-insiders.20230228`;
38
+ version = `${versionMajorMinor}.0-insiders.20230301`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -1000,9 +1000,6 @@ var ts = (() => {
1000
1000
  }
1001
1001
  }
1002
1002
  }
1003
- function createUnderscoreEscapedMultiMap() {
1004
- return createMultiMap();
1005
- }
1006
1003
  function createQueue(items) {
1007
1004
  const elements = (items == null ? void 0 : items.slice()) || [];
1008
1005
  let headIndex = 0;
@@ -48679,9 +48676,21 @@ ${lanes.join("\n")}
48679
48676
  });
48680
48677
  }
48681
48678
  function getSymbolIfSameReference(s1, s2) {
48682
- if (getMergedSymbol(resolveSymbol(getMergedSymbol(s1))) === getMergedSymbol(resolveSymbol(getMergedSymbol(s2)))) {
48683
- return s1;
48684
- }
48679
+ if (s1 === s2)
48680
+ return true;
48681
+ s1 = getMergedSymbol(s1);
48682
+ s2 = getMergedSymbol(s2);
48683
+ if (s1 === s2)
48684
+ return true;
48685
+ s1 = resolveSymbol(s1);
48686
+ s2 = resolveSymbol(s2);
48687
+ if (s1 === s2)
48688
+ return true;
48689
+ s1 = getMergedSymbol(s1);
48690
+ s2 = getMergedSymbol(s2);
48691
+ if (s1 === s2)
48692
+ return true;
48693
+ return false;
48685
48694
  }
48686
48695
  function getExportSymbolOfValueSymbolIfExported(symbol) {
48687
48696
  return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 && symbol.exportSymbol || symbol);
@@ -50209,7 +50218,7 @@ ${lanes.join("\n")}
50209
50218
  }
50210
50219
  }
50211
50220
  const mayHaveNameCollisions = !(context.flags & 64 /* UseFullyQualifiedType */);
50212
- const seenNames = mayHaveNameCollisions ? createUnderscoreEscapedMultiMap() : void 0;
50221
+ const seenNames = mayHaveNameCollisions ? createMultiMap() : void 0;
50213
50222
  const result = [];
50214
50223
  let i = 0;
50215
50224
  for (const type of types) {
@@ -145050,7 +145059,7 @@ ${lanes.join("\n")}
145050
145059
  const props = createMultiMap();
145051
145060
  for (const anon2 of anons) {
145052
145061
  for (const p of checker.getPropertiesOfType(anon2)) {
145053
- props.add(p.name, p.valueDeclaration ? checker.getTypeOfSymbolAtLocation(p, p.valueDeclaration) : checker.getAnyType());
145062
+ props.add(p.escapedName, p.valueDeclaration ? checker.getTypeOfSymbolAtLocation(p, p.valueDeclaration) : checker.getAnyType());
145054
145063
  }
145055
145064
  calls.push(...checker.getSignaturesOfType(anon2, 0 /* Call */));
145056
145065
  constructs.push(...checker.getSignaturesOfType(anon2, 1 /* Construct */));
@@ -149172,7 +149181,8 @@ ${lanes.join("\n")}
149172
149181
  }
149173
149182
  log("getCompletionData: Semantic work: " + (timestamp() - semanticStart));
149174
149183
  const contextualType = previousToken && getContextualType(previousToken, position, sourceFile, typeChecker);
149175
- const literals = mapDefined(
149184
+ const isLiteralExpected = !tryCast(previousToken, isStringLiteralLike) && !isJsxIdentifierExpected;
149185
+ const literals = !isLiteralExpected ? [] : mapDefined(
149176
149186
  contextualType && (contextualType.isUnion() ? contextualType.types : [contextualType]),
149177
149187
  (t) => t.isLiteral() && !(t.flags & 1024 /* EnumLiteral */) ? t.value : void 0
149178
149188
  );
@@ -167873,7 +167883,6 @@ ${options.prefix}` : "\n" : options.prefix
167873
167883
  createTypeChecker: () => createTypeChecker,
167874
167884
  createTypeReferenceDirectiveResolutionCache: () => createTypeReferenceDirectiveResolutionCache,
167875
167885
  createTypeReferenceResolutionLoader: () => createTypeReferenceResolutionLoader,
167876
- createUnderscoreEscapedMultiMap: () => createUnderscoreEscapedMultiMap,
167877
167886
  createUnparsedSourceFile: () => createUnparsedSourceFile,
167878
167887
  createWatchCompilerHost: () => createWatchCompilerHost2,
167879
167888
  createWatchCompilerHostOfConfigFile: () => createWatchCompilerHostOfConfigFile,
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.1";
57
- var version = `${versionMajorMinor}.0-insiders.20230228`;
57
+ var version = `${versionMajorMinor}.0-insiders.20230301`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.1.0-pr-53001-3",
5
+ "version": "5.1.0-pr-53040-3",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -41,21 +41,21 @@
41
41
  "devDependencies": {
42
42
  "@esfx/canceltoken": "^1.0.0",
43
43
  "@octokit/rest": "latest",
44
- "@types/chai": "latest",
44
+ "@types/chai": "^4.3.4",
45
45
  "@types/fs-extra": "^9.0.13",
46
- "@types/glob": "latest",
47
- "@types/microsoft__typescript-etw": "latest",
48
- "@types/minimist": "latest",
49
- "@types/mocha": "latest",
50
- "@types/ms": "latest",
46
+ "@types/glob": "^8.1.0",
47
+ "@types/microsoft__typescript-etw": "^0.1.1",
48
+ "@types/minimist": "^1.2.2",
49
+ "@types/mocha": "^10.0.1",
50
+ "@types/ms": "^0.7.31",
51
51
  "@types/node": "latest",
52
- "@types/source-map-support": "latest",
52
+ "@types/source-map-support": "^0.5.6",
53
53
  "@types/which": "^2.0.1",
54
54
  "@typescript-eslint/eslint-plugin": "^5.33.1",
55
55
  "@typescript-eslint/parser": "^5.33.1",
56
56
  "@typescript-eslint/utils": "^5.33.1",
57
57
  "azure-devops-node-api": "^11.2.0",
58
- "chai": "latest",
58
+ "chai": "^4.3.7",
59
59
  "chalk": "^4.1.2",
60
60
  "chokidar": "^3.5.3",
61
61
  "del": "^6.1.1",
@@ -72,12 +72,12 @@
72
72
  "glob": "^8.1.0",
73
73
  "hereby": "^1.6.4",
74
74
  "jsonc-parser": "^3.2.0",
75
- "minimist": "latest",
76
- "mocha": "latest",
77
- "mocha-fivemat-progress-reporter": "latest",
75
+ "minimist": "^1.2.8",
76
+ "mocha": "^10.2.0",
77
+ "mocha-fivemat-progress-reporter": "^0.1.0",
78
78
  "ms": "^2.1.3",
79
79
  "node-fetch": "^3.2.10",
80
- "source-map-support": "latest",
80
+ "source-map-support": "^0.5.21",
81
81
  "typescript": "5.0.0-dev.20230112",
82
82
  "which": "^2.0.2"
83
83
  },