typescript 5.6.0-dev.20240703 → 5.6.0-dev.20240705

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.6";
21
- var version = `${versionMajorMinor}.0-dev.20240703`;
21
+ var version = `${versionMajorMinor}.0-dev.20240705`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -114395,7 +114395,13 @@ function createPrinter(printerOptions = {}, handlers = {}) {
114395
114395
  );
114396
114396
  }
114397
114397
  function emitLiteral(node, jsxAttributeEscape) {
114398
- const text = getLiteralTextOfNode(node, printerOptions.neverAsciiEscape, jsxAttributeEscape);
114398
+ const text = getLiteralTextOfNode(
114399
+ node,
114400
+ /*sourceFile*/
114401
+ void 0,
114402
+ printerOptions.neverAsciiEscape,
114403
+ jsxAttributeEscape
114404
+ );
114399
114405
  if ((printerOptions.sourceMap || printerOptions.inlineSourceMap) && (node.kind === 11 /* StringLiteral */ || isTemplateLiteralKind(node.kind))) {
114400
114406
  writeLiteral(text);
114401
114407
  } else {
@@ -114876,6 +114882,8 @@ function createPrinter(printerOptions = {}, handlers = {}) {
114876
114882
  if (isNumericLiteral(expression)) {
114877
114883
  const text = getLiteralTextOfNode(
114878
114884
  expression,
114885
+ /*sourceFile*/
114886
+ void 0,
114879
114887
  /*neverAsciiEscape*/
114880
114888
  true,
114881
114889
  /*jsxAttributeEscape*/
@@ -117017,18 +117025,18 @@ function createPrinter(printerOptions = {}, handlers = {}) {
117017
117025
  }
117018
117026
  return getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia);
117019
117027
  }
117020
- function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) {
117028
+ function getLiteralTextOfNode(node, sourceFile = currentSourceFile, neverAsciiEscape, jsxAttributeEscape) {
117021
117029
  if (node.kind === 11 /* StringLiteral */ && node.textSourceNode) {
117022
117030
  const textSourceNode = node.textSourceNode;
117023
117031
  if (isIdentifier(textSourceNode) || isPrivateIdentifier(textSourceNode) || isNumericLiteral(textSourceNode) || isJsxNamespacedName(textSourceNode)) {
117024
117032
  const text = isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode2(textSourceNode);
117025
117033
  return jsxAttributeEscape ? `"${escapeJsxAttributeString(text)}"` : neverAsciiEscape || getEmitFlags(node) & 16777216 /* NoAsciiEscaping */ ? `"${escapeString(text)}"` : `"${escapeNonAsciiString(text)}"`;
117026
117034
  } else {
117027
- return getLiteralTextOfNode(textSourceNode, neverAsciiEscape, jsxAttributeEscape);
117035
+ return getLiteralTextOfNode(textSourceNode, getSourceFileOfNode(textSourceNode), neverAsciiEscape, jsxAttributeEscape);
117028
117036
  }
117029
117037
  }
117030
117038
  const flags = (neverAsciiEscape ? 1 /* NeverAsciiEscape */ : 0) | (jsxAttributeEscape ? 2 /* JsxAttributeEscape */ : 0) | (printerOptions.terminateUnterminatedLiterals ? 4 /* TerminateUnterminatedLiterals */ : 0) | (printerOptions.target && printerOptions.target >= 8 /* ES2021 */ ? 8 /* AllowNumericSeparator */ : 0);
117031
- return getLiteralText(node, currentSourceFile, flags);
117039
+ return getLiteralText(node, sourceFile, flags);
117032
117040
  }
117033
117041
  function pushNameGenerationScope(node) {
117034
117042
  privateNameTempFlagsStack.push(privateNameTempFlags);
@@ -214,6 +214,22 @@ declare namespace ts {
214
214
  * The time spent creating or updating the auto-import program, in milliseconds.
215
215
  */
216
216
  createAutoImportProviderProgramDurationMs?: number;
217
+ /**
218
+ * The time spent computing diagnostics, in milliseconds.
219
+ */
220
+ diagnosticsDuration?: FileDiagnosticPerformanceData[];
221
+ }
222
+ /**
223
+ * Time spent computing each kind of diagnostics, in milliseconds.
224
+ */
225
+ export type DiagnosticPerformanceData = {
226
+ [Kind in DiagnosticEventKind]?: number;
227
+ };
228
+ export interface FileDiagnosticPerformanceData extends DiagnosticPerformanceData {
229
+ /**
230
+ * The file for which the performance data is reported.
231
+ */
232
+ file: string;
217
233
  }
218
234
  /**
219
235
  * Arguments for FileRequest messages.
@@ -1979,10 +1995,6 @@ declare namespace ts {
1979
1995
  * Spans where the region diagnostic was requested, if this is a region semantic diagnostic event.
1980
1996
  */
1981
1997
  spans?: TextSpan[];
1982
- /**
1983
- * Time spent computing the diagnostics, in milliseconds.
1984
- */
1985
- duration?: number;
1986
1998
  }
1987
1999
  export type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag" | "regionSemanticDiag";
1988
2000
  /**
@@ -3416,6 +3428,7 @@ declare namespace ts {
3416
3428
  constructor(opts: SessionOptions);
3417
3429
  private sendRequestCompletedEvent;
3418
3430
  private addPerformanceData;
3431
+ private addDiagnosticsPerformanceData;
3419
3432
  private performanceEventHandler;
3420
3433
  private defaultEventHandler;
3421
3434
  private projectsUpdatedInBackgroundEvent;
package/lib/typescript.js CHANGED
@@ -2250,7 +2250,7 @@ module.exports = __toCommonJS(typescript_exports);
2250
2250
 
2251
2251
  // src/compiler/corePublic.ts
2252
2252
  var versionMajorMinor = "5.6";
2253
- var version = `${versionMajorMinor}.0-dev.20240703`;
2253
+ var version = `${versionMajorMinor}.0-dev.20240705`;
2254
2254
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2255
2255
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2256
2256
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -119176,7 +119176,13 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119176
119176
  );
119177
119177
  }
119178
119178
  function emitLiteral(node, jsxAttributeEscape) {
119179
- const text = getLiteralTextOfNode(node, printerOptions.neverAsciiEscape, jsxAttributeEscape);
119179
+ const text = getLiteralTextOfNode(
119180
+ node,
119181
+ /*sourceFile*/
119182
+ void 0,
119183
+ printerOptions.neverAsciiEscape,
119184
+ jsxAttributeEscape
119185
+ );
119180
119186
  if ((printerOptions.sourceMap || printerOptions.inlineSourceMap) && (node.kind === 11 /* StringLiteral */ || isTemplateLiteralKind(node.kind))) {
119181
119187
  writeLiteral(text);
119182
119188
  } else {
@@ -119657,6 +119663,8 @@ function createPrinter(printerOptions = {}, handlers = {}) {
119657
119663
  if (isNumericLiteral(expression)) {
119658
119664
  const text = getLiteralTextOfNode(
119659
119665
  expression,
119666
+ /*sourceFile*/
119667
+ void 0,
119660
119668
  /*neverAsciiEscape*/
119661
119669
  true,
119662
119670
  /*jsxAttributeEscape*/
@@ -121798,18 +121806,18 @@ function createPrinter(printerOptions = {}, handlers = {}) {
121798
121806
  }
121799
121807
  return getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia);
121800
121808
  }
121801
- function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) {
121809
+ function getLiteralTextOfNode(node, sourceFile = currentSourceFile, neverAsciiEscape, jsxAttributeEscape) {
121802
121810
  if (node.kind === 11 /* StringLiteral */ && node.textSourceNode) {
121803
121811
  const textSourceNode = node.textSourceNode;
121804
121812
  if (isIdentifier(textSourceNode) || isPrivateIdentifier(textSourceNode) || isNumericLiteral(textSourceNode) || isJsxNamespacedName(textSourceNode)) {
121805
121813
  const text = isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode2(textSourceNode);
121806
121814
  return jsxAttributeEscape ? `"${escapeJsxAttributeString(text)}"` : neverAsciiEscape || getEmitFlags(node) & 16777216 /* NoAsciiEscaping */ ? `"${escapeString(text)}"` : `"${escapeNonAsciiString(text)}"`;
121807
121815
  } else {
121808
- return getLiteralTextOfNode(textSourceNode, neverAsciiEscape, jsxAttributeEscape);
121816
+ return getLiteralTextOfNode(textSourceNode, getSourceFileOfNode(textSourceNode), neverAsciiEscape, jsxAttributeEscape);
121809
121817
  }
121810
121818
  }
121811
121819
  const flags = (neverAsciiEscape ? 1 /* NeverAsciiEscape */ : 0) | (jsxAttributeEscape ? 2 /* JsxAttributeEscape */ : 0) | (printerOptions.terminateUnterminatedLiterals ? 4 /* TerminateUnterminatedLiterals */ : 0) | (printerOptions.target && printerOptions.target >= 8 /* ES2021 */ ? 8 /* AllowNumericSeparator */ : 0);
121812
- return getLiteralText(node, currentSourceFile, flags);
121820
+ return getLiteralText(node, sourceFile, flags);
121813
121821
  }
121814
121822
  function pushNameGenerationScope(node) {
121815
121823
  privateNameTempFlagsStack.push(privateNameTempFlags);
@@ -189594,7 +189602,13 @@ var Session3 = class _Session {
189594
189602
  }
189595
189603
  }
189596
189604
  sendRequestCompletedEvent(requestId, performanceData) {
189597
- this.event({ request_seq: requestId, performanceData }, "requestCompleted");
189605
+ this.event(
189606
+ {
189607
+ request_seq: requestId,
189608
+ performanceData: performanceData && toProtocolPerformanceData(performanceData)
189609
+ },
189610
+ "requestCompleted"
189611
+ );
189598
189612
  }
189599
189613
  addPerformanceData(key, value) {
189600
189614
  if (!this.performanceData) {
@@ -189602,6 +189616,15 @@ var Session3 = class _Session {
189602
189616
  }
189603
189617
  this.performanceData[key] = (this.performanceData[key] ?? 0) + value;
189604
189618
  }
189619
+ addDiagnosticsPerformanceData(file, kind, duration) {
189620
+ var _a, _b;
189621
+ if (!this.performanceData) {
189622
+ this.performanceData = {};
189623
+ }
189624
+ let fileDiagnosticDuration = (_a = this.performanceData.diagnosticsDuration) == null ? void 0 : _a.get(file);
189625
+ if (!fileDiagnosticDuration) ((_b = this.performanceData).diagnosticsDuration ?? (_b.diagnosticsDuration = /* @__PURE__ */ new Map())).set(file, fileDiagnosticDuration = {});
189626
+ fileDiagnosticDuration[kind] = duration;
189627
+ }
189605
189628
  performanceEventHandler(event) {
189606
189629
  switch (event.kind) {
189607
189630
  case "UpdateGraph":
@@ -189758,7 +189781,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
189758
189781
  command: cmdName,
189759
189782
  request_seq: reqSeq,
189760
189783
  success,
189761
- performanceData
189784
+ performanceData: performanceData && toProtocolPerformanceData(performanceData)
189762
189785
  };
189763
189786
  if (success) {
189764
189787
  let metadata;
@@ -189836,13 +189859,13 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
189836
189859
  const body = {
189837
189860
  file,
189838
189861
  diagnostics: diagnostics.map((diag2) => formatDiag(file, project, diag2)),
189839
- spans: spans == null ? void 0 : spans.map((span) => toProtocolTextSpan(span, scriptInfo)),
189840
- duration
189862
+ spans: spans == null ? void 0 : spans.map((span) => toProtocolTextSpan(span, scriptInfo))
189841
189863
  };
189842
189864
  this.event(
189843
189865
  body,
189844
189866
  kind
189845
189867
  );
189868
+ this.addDiagnosticsPerformanceData(file, kind, duration);
189846
189869
  } catch (err) {
189847
189870
  this.logError(err, kind);
189848
189871
  }
@@ -191749,6 +191772,10 @@ ${e.message}`;
191749
191772
  return this.projectService.getHostPreferences();
191750
191773
  }
191751
191774
  };
191775
+ function toProtocolPerformanceData(performanceData) {
191776
+ const diagnosticsDuration = performanceData.diagnosticsDuration && arrayFrom(performanceData.diagnosticsDuration, ([file, data]) => ({ ...data, file }));
191777
+ return { ...performanceData, diagnosticsDuration };
191778
+ }
191752
191779
  function toProtocolTextSpan(textSpan, scriptInfo) {
191753
191780
  return {
191754
191781
  start: scriptInfo.positionToLineOffset(textSpan.start),
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.6.0-dev.20240703",
5
+ "version": "5.6.0-dev.20240705",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -113,5 +113,5 @@
113
113
  "node": "20.1.0",
114
114
  "npm": "8.19.4"
115
115
  },
116
- "gitHead": "7bd7dfc007999f6ed2ab0491821d9d136b6293d4"
116
+ "gitHead": "3163fe7e3898c1f48cd9bc097b96e3426cd2a453"
117
117
  }