@typescript-deploys/pr-build 4.8.0-pr-49625-17 → 4.8.0-pr-49668-4

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
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.8";
72
- ts.version = ts.versionMajorMinor + ".0-insiders.20220622";
72
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220624";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -1278,6 +1278,41 @@ var ts;
1278
1278
  return createMultiMap();
1279
1279
  }
1280
1280
  ts.createUnderscoreEscapedMultiMap = createUnderscoreEscapedMultiMap;
1281
+ function createQueue(items) {
1282
+ var elements = (items === null || items === void 0 ? void 0 : items.slice()) || [];
1283
+ var headIndex = 0;
1284
+ function isEmpty() {
1285
+ return headIndex === elements.length;
1286
+ }
1287
+ function enqueue() {
1288
+ var items = [];
1289
+ for (var _i = 0; _i < arguments.length; _i++) {
1290
+ items[_i] = arguments[_i];
1291
+ }
1292
+ elements.push.apply(elements, items);
1293
+ }
1294
+ function dequeue() {
1295
+ if (isEmpty()) {
1296
+ throw new Error("Queue is empty");
1297
+ }
1298
+ var result = elements[headIndex];
1299
+ elements[headIndex] = undefined;
1300
+ headIndex++;
1301
+ if (headIndex > 100 && headIndex > (elements.length >> 1)) {
1302
+ var newLength = elements.length - headIndex;
1303
+ elements.copyWithin(0, headIndex);
1304
+ elements.length = newLength;
1305
+ headIndex = 0;
1306
+ }
1307
+ return result;
1308
+ }
1309
+ return {
1310
+ enqueue: enqueue,
1311
+ dequeue: dequeue,
1312
+ isEmpty: isEmpty,
1313
+ };
1314
+ }
1315
+ ts.createQueue = createQueue;
1281
1316
  function createSet(getHashCode, equals) {
1282
1317
  var multiMap = new ts.Map();
1283
1318
  var size = 0;
@@ -2015,6 +2050,14 @@ var ts;
2015
2050
  }
2016
2051
  return s.slice(0, end + 1);
2017
2052
  }
2053
+ function startWhitespaceCount(s) {
2054
+ for (var i = 0; i < s.length; i++) {
2055
+ if (!ts.isWhiteSpaceLike(s.charCodeAt(i)))
2056
+ return i;
2057
+ }
2058
+ return s.length;
2059
+ }
2060
+ ts.startWhitespaceCount = startWhitespaceCount;
2018
2061
  })(ts || (ts = {}));
2019
2062
  var ts;
2020
2063
  (function (ts) {
@@ -39498,10 +39541,11 @@ var ts;
39498
39541
  }
39499
39542
  function isExportsOrModuleExportsOrAlias(sourceFile, node) {
39500
39543
  var i = 0;
39501
- var q = [node];
39502
- while (q.length && i < 100) {
39544
+ var q = ts.createQueue();
39545
+ q.enqueue(node);
39546
+ while (!q.isEmpty() && i < 100) {
39503
39547
  i++;
39504
- node = q.shift();
39548
+ node = q.dequeue();
39505
39549
  if (ts.isExportsIdentifier(node) || ts.isModuleExportsAccessExpression(node)) {
39506
39550
  return true;
39507
39551
  }
@@ -39509,10 +39553,10 @@ var ts;
39509
39553
  var symbol = lookupSymbolForName(sourceFile, node.escapedText);
39510
39554
  if (!!symbol && !!symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && !!symbol.valueDeclaration.initializer) {
39511
39555
  var init = symbol.valueDeclaration.initializer;
39512
- q.push(init);
39556
+ q.enqueue(init);
39513
39557
  if (ts.isAssignmentExpression(init, true)) {
39514
- q.push(init.left);
39515
- q.push(init.right);
39558
+ q.enqueue(init.left);
39559
+ q.enqueue(init.right);
39516
39560
  }
39517
39561
  }
39518
39562
  }
@@ -60004,18 +60048,16 @@ var ts;
60004
60048
  if (!assumeTrue) {
60005
60049
  return filterType(type, function (t) { return !isRelated(t, candidate); });
60006
60050
  }
60007
- var narrowedType = type.flags & 3 ? candidate :
60008
- mapType(candidate, function (c) {
60009
- var directlyRelated = mapType(type, function (t) { return isRelated(t, c) ? t : isRelated(c, t) ? c : neverType; });
60010
- return directlyRelated.flags & 131072 ?
60011
- mapType(type, function (t) { return maybeTypeOfKind(t, 465829888) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType; }) :
60012
- directlyRelated;
60013
- });
60014
- return !(narrowedType.flags & 131072) ? narrowedType :
60015
- isTypeSubtypeOf(candidate, type) ? candidate :
60016
- isTypeAssignableTo(type, candidate) ? type :
60017
- isTypeAssignableTo(candidate, type) ? candidate :
60018
- getIntersectionType([type, candidate]);
60051
+ if (type.flags & 1048576) {
60052
+ var assignableType = filterType(type, function (t) { return isRelated(t, candidate); });
60053
+ if (!(assignableType.flags & 131072)) {
60054
+ return assignableType;
60055
+ }
60056
+ }
60057
+ return isTypeSubtypeOf(candidate, type) ? candidate :
60058
+ isTypeAssignableTo(type, candidate) ? type :
60059
+ isTypeAssignableTo(candidate, type) ? candidate :
60060
+ getIntersectionType([type, candidate]);
60019
60061
  }
60020
60062
  function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
60021
60063
  if (hasMatchingArgument(callExpression, reference)) {
@@ -96660,8 +96702,8 @@ var ts;
96660
96702
  var gutterSeparator = " ";
96661
96703
  var resetEscapeSequence = "\u001b[0m";
96662
96704
  var ellipsis = "...";
96705
+ var bullet = "● ";
96663
96706
  var halfIndent = " ";
96664
- var indent = " ";
96665
96707
  function getCategoryFormat(category) {
96666
96708
  switch (category) {
96667
96709
  case ts.DiagnosticCategory.Error: return ForegroundColorEscapeSequences.Red;
@@ -96674,14 +96716,21 @@ var ts;
96674
96716
  return formatStyle + text + resetEscapeSequence;
96675
96717
  }
96676
96718
  ts.formatColorAndReset = formatColorAndReset;
96677
- function formatCodeSpan(file, start, length, indent, squiggleColor, host) {
96719
+ function formatCodeSpan(file, start, length, indent, underlineColor, host) {
96678
96720
  var _a = ts.getLineAndCharacterOfPosition(file, start), firstLine = _a.line, firstLineChar = _a.character;
96679
96721
  var _b = ts.getLineAndCharacterOfPosition(file, start + length), lastLine = _b.line, lastLineChar = _b.character;
96680
96722
  var lastLineInFile = ts.getLineAndCharacterOfPosition(file, file.text.length).line;
96723
+ var gutterWidth = 1;
96681
96724
  var hasMoreThanFiveLines = (lastLine - firstLine) >= 4;
96682
- var gutterWidth = (lastLine + 1 + "").length;
96683
- if (hasMoreThanFiveLines) {
96684
- gutterWidth = Math.max(ellipsis.length, gutterWidth);
96725
+ var whitespaceToTrim = Number.MAX_VALUE;
96726
+ for (var i = firstLine; i <= lastLine; i++) {
96727
+ if (hasMoreThanFiveLines && firstLine + 1 < i && i < lastLine - 1) {
96728
+ i = lastLine - 1;
96729
+ }
96730
+ var lineStart = ts.getPositionOfLineAndCharacter(file, i, 0);
96731
+ var lineEnd = i < lastLineInFile ? ts.getPositionOfLineAndCharacter(file, i + 1, 0) : file.text.length;
96732
+ var lineContent = file.text.slice(lineStart, lineEnd);
96733
+ whitespaceToTrim = Math.min(whitespaceToTrim, ts.startWhitespaceCount(lineContent));
96685
96734
  }
96686
96735
  var context = "";
96687
96736
  for (var i = firstLine; i <= lastLine; i++) {
@@ -96694,21 +96743,24 @@ var ts;
96694
96743
  var lineEnd = i < lastLineInFile ? ts.getPositionOfLineAndCharacter(file, i + 1, 0) : file.text.length;
96695
96744
  var lineContent = file.text.slice(lineStart, lineEnd);
96696
96745
  lineContent = ts.trimStringEnd(lineContent);
96746
+ lineContent = lineContent.slice(whitespaceToTrim);
96697
96747
  lineContent = lineContent.replace(/\t/g, " ");
96698
- context += indent + formatColorAndReset(ts.padLeft(i + 1 + "", gutterWidth), gutterStyleSequence) + gutterSeparator;
96748
+ var gutterLine = "|";
96749
+ context += indent + ts.padLeft(gutterLine, gutterWidth) + gutterSeparator;
96699
96750
  context += lineContent + host.getNewLine();
96700
- context += indent + formatColorAndReset(ts.padLeft("", gutterWidth), gutterStyleSequence) + gutterSeparator;
96701
- context += squiggleColor;
96751
+ context += indent + ts.padLeft("", gutterWidth) + gutterSeparator;
96752
+ context += underlineColor;
96702
96753
  if (i === firstLine) {
96703
96754
  var lastCharForLine = i === lastLine ? lastLineChar : undefined;
96704
- context += lineContent.slice(0, firstLineChar).replace(/\S/g, " ");
96705
- context += lineContent.slice(firstLineChar, lastCharForLine).replace(/./g, "~");
96755
+ context += lineContent.slice(0, firstLineChar - whitespaceToTrim).replace(/\S/g, " ");
96756
+ var amendedLastChar = lastCharForLine ? lastCharForLine - whitespaceToTrim : undefined;
96757
+ context += lineContent.slice(firstLineChar - whitespaceToTrim, amendedLastChar).replace(/./g, "▔");
96706
96758
  }
96707
96759
  else if (i === lastLine) {
96708
- context += lineContent.slice(0, lastLineChar).replace(/./g, "~");
96760
+ context += lineContent.slice(0, lastLineChar).replace(/./g, "▔");
96709
96761
  }
96710
96762
  else {
96711
- context += lineContent.replace(/./g, "~");
96763
+ context += lineContent.replace(/./g, "▔");
96712
96764
  }
96713
96765
  context += resetEscapeSequence;
96714
96766
  }
@@ -96728,41 +96780,56 @@ var ts;
96728
96780
  }
96729
96781
  ts.formatLocation = formatLocation;
96730
96782
  function formatDiagnosticsWithColorAndContext(diagnostics, host) {
96783
+ var _a, _b;
96784
+ var terminalWidth = (_b = (_a = ts.sys.getWidthOfTerminal) === null || _a === void 0 ? void 0 : _a.call(ts.sys)) !== null && _b !== void 0 ? _b : 0;
96785
+ var indent = terminalWidth < 60 ? "" : halfIndent;
96731
96786
  var output = "";
96732
96787
  for (var _i = 0, diagnostics_4 = diagnostics; _i < diagnostics_4.length; _i++) {
96733
96788
  var diagnostic = diagnostics_4[_i];
96789
+ var diagnosticCode = "TS" + diagnostic.code;
96790
+ var diagnosticCatName = ts.diagnosticCategoryName(diagnostic, false);
96791
+ var diagnosticCatNameColored = formatColorAndReset(diagnosticCatName, getCategoryFormat(diagnostic.category));
96734
96792
  if (diagnostic.file) {
96735
96793
  var file = diagnostic.file, start = diagnostic.start;
96736
- output += formatLocation(file, start, host);
96737
- output += " - ";
96738
- }
96739
- output += formatColorAndReset(ts.diagnosticCategoryName(diagnostic), getCategoryFormat(diagnostic.category));
96740
- output += formatColorAndReset(" TS" + diagnostic.code + ": ", ForegroundColorEscapeSequences.Grey);
96741
- output += flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine());
96742
- if (diagnostic.file) {
96794
+ var location = formatLocation(file, start, host);
96795
+ var locationLength = location.replace(/\u001b[[0-9]+m/g, "").length;
96796
+ var codeLength = diagnosticCode.length;
96797
+ output += formatColorAndReset(bullet, getCategoryFormat(diagnostic.category)) + location;
96798
+ var defaultPad = codeLength + 1;
96799
+ var padWidth = terminalWidth < 60 ? defaultPad : terminalWidth - (bullet.length + locationLength + codeLength + diagnosticCatName.length + 2);
96800
+ if (padWidth < diagnosticCode.length)
96801
+ padWidth = defaultPad;
96802
+ output += ts.padLeft(diagnosticCatNameColored, padWidth + (diagnosticCatNameColored.length - diagnosticCatName.length));
96803
+ output += " " + diagnosticCode;
96804
+ output += formatCodeSpan(diagnostic.file, diagnostic.start, diagnostic.length, indent, getCategoryFormat(diagnostic.category), host);
96743
96805
  output += host.getNewLine();
96744
- output += formatCodeSpan(diagnostic.file, diagnostic.start, diagnostic.length, "", getCategoryFormat(diagnostic.category), host);
96745
96806
  }
96807
+ else {
96808
+ output += formatColorAndReset(bullet, getCategoryFormat(diagnostic.category)) + " " + diagnosticCatNameColored + " " + diagnosticCode;
96809
+ }
96810
+ var diagnosticText = flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine(), 0, true);
96811
+ diagnosticText = ts.map(diagnosticText.split(host.getNewLine()), function (text) { return indent + text; }).join(host.getNewLine());
96812
+ output += diagnosticText;
96813
+ output += host.getNewLine();
96746
96814
  if (diagnostic.relatedInformation) {
96747
96815
  output += host.getNewLine();
96748
- for (var _a = 0, _b = diagnostic.relatedInformation; _a < _b.length; _a++) {
96749
- var _c = _b[_a], file = _c.file, start = _c.start, length_9 = _c.length, messageText = _c.messageText;
96816
+ for (var _c = 0, _d = diagnostic.relatedInformation; _c < _d.length; _c++) {
96817
+ var _e = _d[_c], file = _e.file, start = _e.start, length_9 = _e.length, messageText = _e.messageText;
96818
+ output += indent + ts.trimStringStart(flattenDiagnosticMessageText(messageText, host.getNewLine(), 0, true));
96750
96819
  if (file) {
96820
+ output += " " + formatLocation(file, start, host);
96751
96821
  output += host.getNewLine();
96752
- output += halfIndent + formatLocation(file, start, host);
96753
- output += formatCodeSpan(file, start, length_9, indent, ForegroundColorEscapeSequences.Cyan, host);
96822
+ output += formatCodeSpan(file, start, length_9, indent + " ", ForegroundColorEscapeSequences.Cyan, host);
96754
96823
  }
96755
- output += host.getNewLine();
96756
- output += indent + flattenDiagnosticMessageText(messageText, host.getNewLine());
96757
96824
  }
96758
96825
  }
96759
- output += host.getNewLine();
96760
96826
  }
96761
96827
  return output;
96762
96828
  }
96763
96829
  ts.formatDiagnosticsWithColorAndContext = formatDiagnosticsWithColorAndContext;
96764
- function flattenDiagnosticMessageText(diag, newLine, indent) {
96830
+ function flattenDiagnosticMessageText(diag, newLine, indent, pretty) {
96765
96831
  if (indent === void 0) { indent = 0; }
96832
+ if (pretty === void 0) { pretty = false; }
96766
96833
  if (ts.isString(diag)) {
96767
96834
  return diag;
96768
96835
  }
@@ -96772,9 +96839,14 @@ var ts;
96772
96839
  var result = "";
96773
96840
  if (indent) {
96774
96841
  result += newLine;
96775
- for (var i = 0; i < indent; i++) {
96776
- result += " ";
96842
+ var indentsToReplaceWithNewLines = pretty ? 1 : 0;
96843
+ if (indent > indentsToReplaceWithNewLines) {
96844
+ for (var i = indentsToReplaceWithNewLines; i < indent; i++) {
96845
+ result += " ";
96846
+ }
96777
96847
  }
96848
+ else
96849
+ result += newLine;
96778
96850
  }
96779
96851
  result += diag.messageText;
96780
96852
  indent++;