prettier 0.12.3 → 0.13.0

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.
@@ -12,7 +12,7 @@ var thirdParty = require('./third-party');
12
12
  var thirdParty__default = thirdParty['default'];
13
13
 
14
14
  var name = "prettier";
15
- var version$1 = "1.17.1";
15
+ var version$1 = "1.18.2";
16
16
  var description = "Prettier is an opinionated code formatter";
17
17
  var bin = {
18
18
  "prettier": "./bin/prettier.js"
@@ -29,8 +29,8 @@ var dependencies = {
29
29
  "@angular/compiler": "7.2.9",
30
30
  "@babel/code-frame": "7.0.0",
31
31
  "@babel/parser": "7.2.0",
32
- "@glimmer/syntax": "0.30.3",
33
- "@iarna/toml": "2.0.0",
32
+ "@glimmer/syntax": "0.38.4",
33
+ "@iarna/toml": "2.2.3",
34
34
  "@typescript-eslint/typescript-estree": "1.6.0",
35
35
  "angular-estree-parser": "1.1.5",
36
36
  "angular-html-parser": "1.2.0",
@@ -108,7 +108,7 @@ var devDependencies = {
108
108
  "jest-snapshot-serializer-raw": "1.1.0",
109
109
  "jest-watch-typeahead": "0.1.0",
110
110
  "mkdirp": "0.5.1",
111
- "prettier": "1.17.0",
111
+ "prettier": "1.18.0",
112
112
  "prettylint": "1.0.0",
113
113
  "rimraf": "2.6.2",
114
114
  "rollup": "0.47.6",
@@ -176,10 +176,6 @@ var _package$1 = Object.freeze({
176
176
  default: _package
177
177
  });
178
178
 
179
- var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
180
-
181
-
182
-
183
179
  function unwrapExports (x) {
184
180
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
185
181
  }
@@ -11566,7 +11562,7 @@ function printString(raw, options, isDirectiveLiteral) {
11566
11562
  // sure that we consistently output the minimum amount of escaped quotes.
11567
11563
 
11568
11564
 
11569
- return makeString(rawContent, enclosingQuote, !(options.parser === "css" || options.parser === "less" || options.parser === "scss" || options.parentParser === "html" || options.parentParser === "vue" || options.parentParser === "angular" || options.parentParser === "lwc"));
11565
+ return makeString(rawContent, enclosingQuote, !(options.parser === "css" || options.parser === "less" || options.parser === "scss" || options.embeddedInHtml));
11570
11566
  }
11571
11567
 
11572
11568
  function makeString(rawContent, enclosingQuote, unescapeUnnecessaryEscapes) {
@@ -11622,6 +11618,53 @@ function getMaxContinuousCount(str, target) {
11622
11618
  }, 0);
11623
11619
  }
11624
11620
 
11621
+ function getMinNotPresentContinuousCount(str, target) {
11622
+ var matches = str.match(new RegExp(`(${escapeStringRegexp(target)})+`, "g"));
11623
+
11624
+ if (matches === null) {
11625
+ return 0;
11626
+ }
11627
+
11628
+ var countPresent = new Map();
11629
+ var max = 0;
11630
+ var _iteratorNormalCompletion = true;
11631
+ var _didIteratorError = false;
11632
+ var _iteratorError = undefined;
11633
+
11634
+ try {
11635
+ for (var _iterator = matches[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
11636
+ var match = _step.value;
11637
+ var count = match.length / target.length;
11638
+ countPresent.set(count, true);
11639
+
11640
+ if (count > max) {
11641
+ max = count;
11642
+ }
11643
+ }
11644
+ } catch (err) {
11645
+ _didIteratorError = true;
11646
+ _iteratorError = err;
11647
+ } finally {
11648
+ try {
11649
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
11650
+ _iterator.return();
11651
+ }
11652
+ } finally {
11653
+ if (_didIteratorError) {
11654
+ throw _iteratorError;
11655
+ }
11656
+ }
11657
+ }
11658
+
11659
+ for (var i = 1; i < max; i++) {
11660
+ if (!countPresent.get(i)) {
11661
+ return i;
11662
+ }
11663
+ }
11664
+
11665
+ return max + 1;
11666
+ }
11667
+
11625
11668
  function getStringWidth$1(text) {
11626
11669
  if (!text) {
11627
11670
  return 0;
@@ -11712,13 +11755,13 @@ function isWithinParentArrayProperty(path$$1, propertyName) {
11712
11755
 
11713
11756
  function replaceEndOfLineWith(text, replacement) {
11714
11757
  var parts = [];
11715
- var _iteratorNormalCompletion = true;
11716
- var _didIteratorError = false;
11717
- var _iteratorError = undefined;
11758
+ var _iteratorNormalCompletion2 = true;
11759
+ var _didIteratorError2 = false;
11760
+ var _iteratorError2 = undefined;
11718
11761
 
11719
11762
  try {
11720
- for (var _iterator = text.split("\n")[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
11721
- var part = _step.value;
11763
+ for (var _iterator2 = text.split("\n")[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
11764
+ var part = _step2.value;
11722
11765
 
11723
11766
  if (parts.length !== 0) {
11724
11767
  parts.push(replacement);
@@ -11727,16 +11770,16 @@ function replaceEndOfLineWith(text, replacement) {
11727
11770
  parts.push(part);
11728
11771
  }
11729
11772
  } catch (err) {
11730
- _didIteratorError = true;
11731
- _iteratorError = err;
11773
+ _didIteratorError2 = true;
11774
+ _iteratorError2 = err;
11732
11775
  } finally {
11733
11776
  try {
11734
- if (!_iteratorNormalCompletion && _iterator.return != null) {
11735
- _iterator.return();
11777
+ if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
11778
+ _iterator2.return();
11736
11779
  }
11737
11780
  } finally {
11738
- if (_didIteratorError) {
11739
- throw _iteratorError;
11781
+ if (_didIteratorError2) {
11782
+ throw _iteratorError2;
11740
11783
  }
11741
11784
  }
11742
11785
  }
@@ -11748,6 +11791,7 @@ var util$1 = {
11748
11791
  replaceEndOfLineWith,
11749
11792
  getStringWidth: getStringWidth$1,
11750
11793
  getMaxContinuousCount,
11794
+ getMinNotPresentContinuousCount,
11751
11795
  getPrecedence,
11752
11796
  shouldFlatten,
11753
11797
  isBitwiseOperator,
@@ -12638,6 +12682,7 @@ var docUtils = {
12638
12682
  willBreak,
12639
12683
  isLineNext,
12640
12684
  traverseDoc,
12685
+ findInDoc,
12641
12686
  mapDoc: mapDoc$1,
12642
12687
  propagateBreaks,
12643
12688
  removeLines,
@@ -13449,6 +13494,7 @@ function printSubtree(path$$1, print, options$$1, printAstToDoc) {
13449
13494
  function textToDoc(text, partialNextOptions, parentOptions, printAstToDoc) {
13450
13495
  var nextOptions = normalize$3(Object.assign({}, parentOptions, partialNextOptions, {
13451
13496
  parentParser: parentOptions.parser,
13497
+ embeddedInHtml: !!(parentOptions.embeddedInHtml || parentOptions.parser === "html" || parentOptions.parser === "vue" || parentOptions.parser === "angular" || parentOptions.parser === "lwc"),
13452
13498
  originalText: text
13453
13499
  }), {
13454
13500
  passThrough: true
@@ -13516,7 +13562,7 @@ function printAstToDoc(ast, options) {
13516
13562
 
13517
13563
  var res;
13518
13564
 
13519
- if (printer.willPrintOwnComments && printer.willPrintOwnComments(path$$1)) {
13565
+ if (printer.willPrintOwnComments && printer.willPrintOwnComments(path$$1, options)) {
13520
13566
  res = callPluginPrintFunction(path$$1, options, printGenerically, args);
13521
13567
  } else {
13522
13568
  // printComments will call the plugin print function and check for
@@ -14752,7 +14798,7 @@ var lodash_uniqby = createCommonjsModule(function (module, exports) {
14752
14798
  typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
14753
14799
  /** Detect free variable `global` from Node.js. */
14754
14800
 
14755
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
14801
+ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
14756
14802
  /** Detect free variable `self`. */
14757
14803
 
14758
14804
  var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
@@ -17205,7 +17251,7 @@ var REJECTED = 'rejected';
17205
17251
 
17206
17252
  var NOOP = function NOOP() {};
17207
17253
 
17208
- var isNode = typeof commonjsGlobal !== 'undefined' && typeof commonjsGlobal.process !== 'undefined' && typeof commonjsGlobal.process.emit === 'function';
17254
+ var isNode = typeof global !== 'undefined' && typeof global.process !== 'undefined' && typeof global.process.emit === 'function';
17209
17255
  var asyncSetTimer = typeof setImmediate === 'undefined' ? setTimeout : setImmediate;
17210
17256
  var asyncQueue = [];
17211
17257
  var asyncTimer;
@@ -17353,12 +17399,12 @@ function publishRejection(promise) {
17353
17399
  publish(promise);
17354
17400
 
17355
17401
  if (!promise._handled && isNode) {
17356
- commonjsGlobal.process.emit('unhandledRejection', promise._data, promise);
17402
+ global.process.emit('unhandledRejection', promise._data, promise);
17357
17403
  }
17358
17404
  }
17359
17405
 
17360
17406
  function notifyRejectionHandled(promise) {
17361
- commonjsGlobal.process.emit('rejectionHandled', promise);
17407
+ global.process.emit('rejectionHandled', promise);
17362
17408
  }
17363
17409
  /**
17364
17410
  * @class
@@ -17537,7 +17583,7 @@ var arrayUniq = createCommonjsModule(function (module) {
17537
17583
  return ret === true;
17538
17584
  }
17539
17585
 
17540
- if ('Set' in commonjsGlobal) {
17586
+ if ('Set' in global) {
17541
17587
  if (typeof Set.prototype.forEach === 'function' && doesForEachActuallyWork()) {
17542
17588
  module.exports = uniqSetWithForEach;
17543
17589
  } else {
@@ -20821,7 +20867,7 @@ var timers = true;
20821
20867
  var tls = true;
20822
20868
  var tty = true;
20823
20869
  var url = true;
20824
- var util$4 = true;
20870
+ var util$3 = true;
20825
20871
  var v8 = ">= 1";
20826
20872
  var vm = true;
20827
20873
  var zlib = true;
@@ -20863,7 +20909,7 @@ var core$3 = {
20863
20909
  tls: tls,
20864
20910
  tty: tty,
20865
20911
  url: url,
20866
- util: util$4,
20912
+ util: util$3,
20867
20913
  v8: v8,
20868
20914
  vm: vm,
20869
20915
  zlib: zlib
@@ -20907,7 +20953,7 @@ var core$4 = Object.freeze({
20907
20953
  tls: tls,
20908
20954
  tty: tty,
20909
20955
  url: url,
20910
- util: util$4,
20956
+ util: util$3,
20911
20957
  v8: v8,
20912
20958
  vm: vm,
20913
20959
  zlib: zlib,
@@ -21680,7 +21726,7 @@ function handleCommentInEmptyParens(text, enclosingNode, comment, options) {
21680
21726
  // i.e. a function without any argument.
21681
21727
 
21682
21728
 
21683
- if (enclosingNode && ((enclosingNode.type === "FunctionDeclaration" || enclosingNode.type === "FunctionExpression" || enclosingNode.type === "ArrowFunctionExpression" && (enclosingNode.body.type !== "CallExpression" || enclosingNode.body.arguments.length === 0) || enclosingNode.type === "ClassMethod" || enclosingNode.type === "ObjectMethod") && enclosingNode.params.length === 0 || (enclosingNode.type === "CallExpression" || enclosingNode.type === "NewExpression") && enclosingNode.arguments.length === 0)) {
21729
+ if (enclosingNode && ((enclosingNode.type === "FunctionDeclaration" || enclosingNode.type === "FunctionExpression" || enclosingNode.type === "ArrowFunctionExpression" || enclosingNode.type === "ClassMethod" || enclosingNode.type === "ObjectMethod") && enclosingNode.params.length === 0 || (enclosingNode.type === "CallExpression" || enclosingNode.type === "NewExpression") && enclosingNode.arguments.length === 0)) {
21684
21730
  addDanglingComment$2(enclosingNode, comment);
21685
21731
  return true;
21686
21732
  }
@@ -21910,9 +21956,7 @@ var _require$$1$utils = doc.utils;
21910
21956
  var mapDoc$3 = _require$$1$utils.mapDoc;
21911
21957
  var stripTrailingHardline$1 = _require$$1$utils.stripTrailingHardline;
21912
21958
 
21913
- function embed(path$$1, print, textToDoc
21914
- /*, options */
21915
- ) {
21959
+ function embed(path$$1, print, textToDoc, options) {
21916
21960
  var node = path$$1.getValue();
21917
21961
  var parent = path$$1.getParentNode();
21918
21962
  var parentParent = path$$1.getParentNode(1);
@@ -22018,12 +22062,10 @@ function embed(path$$1, print, textToDoc
22018
22062
  return concat$5(["`", indent$3(concat$5([hardline$4, join$3(hardline$4, parts)])), hardline$4, "`"]);
22019
22063
  }
22020
22064
 
22021
- if (isHtml(path$$1)) {
22022
- return printHtmlTemplateLiteral(path$$1, print, textToDoc, "html");
22023
- }
22065
+ var htmlParser = isHtml(path$$1) ? "html" : isAngularComponentTemplate(path$$1) ? "angular" : undefined;
22024
22066
 
22025
- if (isAngularComponentTemplate(path$$1)) {
22026
- return printHtmlTemplateLiteral(path$$1, print, textToDoc, "angular");
22067
+ if (htmlParser) {
22068
+ return printHtmlTemplateLiteral(path$$1, print, textToDoc, htmlParser, options.embeddedInHtml);
22027
22069
  }
22028
22070
 
22029
22071
  break;
@@ -22063,6 +22105,10 @@ function getIndentation(str) {
22063
22105
  return firstMatchedIndent === null ? "" : firstMatchedIndent[1];
22064
22106
  }
22065
22107
 
22108
+ function uncook(cookedValue) {
22109
+ return cookedValue.replace(/([\\`]|\$\{)/g, "\\$1");
22110
+ }
22111
+
22066
22112
  function escapeTemplateCharacters(doc$$2, raw) {
22067
22113
  return mapDoc$3(doc$$2, function (currentDoc) {
22068
22114
  if (!currentDoc.parts) {
@@ -22072,7 +22118,7 @@ function escapeTemplateCharacters(doc$$2, raw) {
22072
22118
  var parts = [];
22073
22119
  currentDoc.parts.forEach(function (part) {
22074
22120
  if (typeof part === "string") {
22075
- parts.push(raw ? part.replace(/(\\*)`/g, "$1$1\\`") : part.replace(/([\\`]|\$\{)/g, "\\$1"));
22121
+ parts.push(raw ? part.replace(/(\\*)`/g, "$1$1\\`") : uncook(part));
22076
22122
  } else {
22077
22123
  parts.push(part);
22078
22124
  }
@@ -22183,8 +22229,11 @@ function printGraphqlComments(lines) {
22183
22229
  return parts.length === 0 ? null : join$3(hardline$4, parts);
22184
22230
  }
22185
22231
  /**
22186
- * Template literal in this context:
22232
+ * Template literal in these contexts:
22187
22233
  * <style jsx>{`div{color:red}`}</style>
22234
+ * css``
22235
+ * css.global``
22236
+ * css.resolve``
22188
22237
  */
22189
22238
 
22190
22239
 
@@ -22194,7 +22243,7 @@ function isStyledJsx(path$$1) {
22194
22243
  var parentParent = path$$1.getParentNode(1);
22195
22244
  return parentParent && node.quasis && parent.type === "JSXExpressionContainer" && parentParent.type === "JSXElement" && parentParent.openingElement.name.name === "style" && parentParent.openingElement.attributes.some(function (attribute) {
22196
22245
  return attribute.name.name === "jsx";
22197
- });
22246
+ }) || parent && parent.type === "TaggedTemplateExpression" && parent.tag.type === "Identifier" && parent.tag.name === "css" || parent && parent.type === "TaggedTemplateExpression" && parent.tag.type === "MemberExpression" && parent.tag.object.name === "css" && (parent.tag.property.name === "global" || parent.tag.property.name === "resolve");
22198
22247
  }
22199
22248
  /**
22200
22249
  * Angular Components can have:
@@ -22262,9 +22311,9 @@ function isStyledComponents(path$$1) {
22262
22311
 
22263
22312
  case "CallExpression":
22264
22313
  return (// styled(Component)``
22265
- isStyledIdentifier(tag.callee) || tag.callee.type === "MemberExpression" && (tag.callee.object.type === "MemberExpression" && ( // styled.foo.attr({})``
22266
- isStyledIdentifier(tag.callee.object.object) || // Component.extend.attr({)``
22267
- isStyledExtend(tag.callee.object)) || // styled(Component).attr({})``
22314
+ isStyledIdentifier(tag.callee) || tag.callee.type === "MemberExpression" && (tag.callee.object.type === "MemberExpression" && ( // styled.foo.attrs({})``
22315
+ isStyledIdentifier(tag.callee.object.object) || // Component.extend.attrs({})``
22316
+ isStyledExtend(tag.callee.object)) || // styled(Component).attrs({})``
22268
22317
  tag.callee.object.type === "CallExpression" && isStyledIdentifier(tag.callee.object.callee))
22269
22318
  );
22270
22319
 
@@ -22382,16 +22431,22 @@ function isHtml(path$$1) {
22382
22431
  }, function (node, name) {
22383
22432
  return node.type === "TaggedTemplateExpression" && node.tag.type === "Identifier" && node.tag.name === "html" && name === "quasi";
22384
22433
  }]);
22385
- }
22434
+ } // The counter is needed to distinguish nested embeds.
22435
+
22436
+
22437
+ var htmlTemplateLiteralCounter = 0;
22386
22438
 
22387
- function printHtmlTemplateLiteral(path$$1, print, textToDoc, parser) {
22439
+ function printHtmlTemplateLiteral(path$$1, print, textToDoc, parser, escapeClosingScriptTag) {
22388
22440
  var node = path$$1.getValue();
22389
- var placeholderPattern = "PRETTIER_HTML_PLACEHOLDER_(\\d+)_IN_JS";
22390
- var placeholders = node.expressions.map(function (_, i) {
22391
- return `PRETTIER_HTML_PLACEHOLDER_${i}_IN_JS`;
22392
- });
22441
+ var counter = htmlTemplateLiteralCounter;
22442
+ htmlTemplateLiteralCounter = htmlTemplateLiteralCounter + 1 >>> 0;
22443
+
22444
+ var composePlaceholder = function composePlaceholder(index) {
22445
+ return `PRETTIER_HTML_PLACEHOLDER_${index}_${counter}_IN_JS`;
22446
+ };
22447
+
22393
22448
  var text = node.quasis.map(function (quasi, index, quasis) {
22394
- return index === quasis.length - 1 ? quasi.value.raw : quasi.value.raw + placeholders[index];
22449
+ return index === quasis.length - 1 ? quasi.value.cooked : quasi.value.cooked + composePlaceholder(index);
22395
22450
  }).join("");
22396
22451
  var expressionDocs = path$$1.map(print, "expressions");
22397
22452
 
@@ -22399,13 +22454,11 @@ function printHtmlTemplateLiteral(path$$1, print, textToDoc, parser) {
22399
22454
  return "``";
22400
22455
  }
22401
22456
 
22457
+ var placeholderRegex = RegExp(composePlaceholder("(\\d+)"), "g");
22402
22458
  var contentDoc = mapDoc$3(stripTrailingHardline$1(textToDoc(text, {
22403
22459
  parser
22404
22460
  })), function (doc$$2) {
22405
- var placeholderRegex = new RegExp(placeholderPattern, "g");
22406
- var hasPlaceholder = typeof doc$$2 === "string" && placeholderRegex.test(doc$$2);
22407
-
22408
- if (!hasPlaceholder) {
22461
+ if (typeof doc$$2 !== "string") {
22409
22462
  return doc$$2;
22410
22463
  }
22411
22464
 
@@ -22417,6 +22470,12 @@ function printHtmlTemplateLiteral(path$$1, print, textToDoc, parser) {
22417
22470
 
22418
22471
  if (i % 2 === 0) {
22419
22472
  if (component) {
22473
+ component = uncook(component);
22474
+
22475
+ if (escapeClosingScriptTag) {
22476
+ component = component.replace(/<\/(script)\b/gi, "<\\/$1");
22477
+ }
22478
+
22420
22479
  parts.push(component);
22421
22480
  }
22422
22481
 
@@ -22816,12 +22875,65 @@ function hasNode$1(node, fn) {
22816
22875
  });
22817
22876
  }
22818
22877
 
22878
+ function hasNakedLeftSide$2(node) {
22879
+ return node.type === "AssignmentExpression" || node.type === "BinaryExpression" || node.type === "LogicalExpression" || node.type === "NGPipeExpression" || node.type === "ConditionalExpression" || node.type === "CallExpression" || node.type === "OptionalCallExpression" || node.type === "MemberExpression" || node.type === "OptionalMemberExpression" || node.type === "SequenceExpression" || node.type === "TaggedTemplateExpression" || node.type === "BindExpression" || node.type === "UpdateExpression" && !node.prefix || node.type === "TSAsExpression" || node.type === "TSNonNullExpression";
22880
+ }
22881
+
22882
+ function getLeftSide$1(node) {
22883
+ if (node.expressions) {
22884
+ return node.expressions[0];
22885
+ }
22886
+
22887
+ return node.left || node.test || node.callee || node.object || node.tag || node.argument || node.expression;
22888
+ }
22889
+
22890
+ function getLeftSidePathName$2(path$$1, node) {
22891
+ if (node.expressions) {
22892
+ return ["expressions", 0];
22893
+ }
22894
+
22895
+ if (node.left) {
22896
+ return ["left"];
22897
+ }
22898
+
22899
+ if (node.test) {
22900
+ return ["test"];
22901
+ }
22902
+
22903
+ if (node.object) {
22904
+ return ["object"];
22905
+ }
22906
+
22907
+ if (node.callee) {
22908
+ return ["callee"];
22909
+ }
22910
+
22911
+ if (node.tag) {
22912
+ return ["tag"];
22913
+ }
22914
+
22915
+ if (node.argument) {
22916
+ return ["argument"];
22917
+ }
22918
+
22919
+ if (node.expression) {
22920
+ return ["expression"];
22921
+ }
22922
+
22923
+ throw new Error("Unexpected node has no left side", node);
22924
+ }
22925
+
22819
22926
  var utils$4 = {
22927
+ getLeftSide: getLeftSide$1,
22928
+ getLeftSidePathName: getLeftSidePathName$2,
22929
+ hasNakedLeftSide: hasNakedLeftSide$2,
22820
22930
  hasNode: hasNode$1,
22821
22931
  hasFlowShorthandAnnotationComment: hasFlowShorthandAnnotationComment$2,
22822
22932
  hasFlowAnnotationComment: hasFlowAnnotationComment$1
22823
22933
  };
22824
22934
 
22935
+ var getLeftSidePathName$1 = utils$4.getLeftSidePathName;
22936
+ var hasNakedLeftSide$1 = utils$4.hasNakedLeftSide;
22825
22937
  var hasFlowShorthandAnnotationComment$1 = utils$4.hasFlowShorthandAnnotationComment;
22826
22938
 
22827
22939
  function hasClosureCompilerTypeCastComment(text, path$$1) {
@@ -22853,7 +22965,7 @@ function hasClosureCompilerTypeCastComment(text, path$$1) {
22853
22965
  return line.replace(/^[\s*]+/, "");
22854
22966
  }).join(" ").trim();
22855
22967
 
22856
- if (!/^@type\s+\{[^]+\}$/.test(cleaned)) {
22968
+ if (!/^@type\s*\{[^]+\}$/.test(cleaned)) {
22857
22969
  return false;
22858
22970
  }
22859
22971
 
@@ -22945,6 +23057,15 @@ function needsParens(path$$1, options) {
22945
23057
 
22946
23058
 
22947
23059
  if (node.type === "Identifier") {
23060
+ // ...unless those identifiers are embed placeholders. They might be substituted by complex
23061
+ // expressions, so the parens around them should not be dropped. Example (JS-in-HTML-in-JS):
23062
+ // let tpl = html`<script> f((${expr}) / 2); </script>`;
23063
+ // If the inner JS formatter removes the parens, the expression might change its meaning:
23064
+ // f((a + b) / 2) vs f(a + b / 2)
23065
+ if (node.extra && node.extra.parenthesized && /^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(node.name)) {
23066
+ return true;
23067
+ }
23068
+
22948
23069
  return false;
22949
23070
  }
22950
23071
 
@@ -22956,6 +23077,13 @@ function needsParens(path$$1, options) {
22956
23077
 
22957
23078
  if ((parent.type === "ClassDeclaration" || parent.type === "ClassExpression") && parent.superClass === node && (node.type === "ArrowFunctionExpression" || node.type === "AssignmentExpression" || node.type === "AwaitExpression" || node.type === "BinaryExpression" || node.type === "ConditionalExpression" || node.type === "LogicalExpression" || node.type === "NewExpression" || node.type === "ObjectExpression" || node.type === "ParenthesizedExpression" || node.type === "SequenceExpression" || node.type === "TaggedTemplateExpression" || node.type === "UnaryExpression" || node.type === "UpdateExpression" || node.type === "YieldExpression")) {
22958
23079
  return true;
23080
+ } // `export default function` or `export default class` can't be followed by
23081
+ // anything after. So an expression like `export default (function(){}).toString()`
23082
+ // needs to be followed by a parentheses
23083
+
23084
+
23085
+ if (parent.type === "ExportDefaultDeclaration") {
23086
+ return shouldWrapFunctionForExportDefault(path$$1, options);
22959
23087
  }
22960
23088
 
22961
23089
  if (parent.type === "Decorator" && parent.expression === node) {
@@ -23007,9 +23135,11 @@ function needsParens(path$$1, options) {
23007
23135
  case "CallExpression":
23008
23136
  {
23009
23137
  var firstParentNotMemberExpression = parent;
23010
- var i = 0;
23138
+ var i = 0; // tagged templates are basically member expressions from a grammar perspective
23139
+ // see https://tc39.github.io/ecma262/#prod-MemberExpression
23140
+ // so are typescript's non-null assertions, though there's no grammar to point to
23011
23141
 
23012
- while (firstParentNotMemberExpression && firstParentNotMemberExpression.type === "MemberExpression") {
23142
+ while (firstParentNotMemberExpression && (firstParentNotMemberExpression.type === "MemberExpression" && firstParentNotMemberExpression.object === path$$1.getParentNode(i - 1) || firstParentNotMemberExpression.type === "TaggedTemplateExpression" || firstParentNotMemberExpression.type === "TSNonNullExpression")) {
23013
23143
  firstParentNotMemberExpression = path$$1.getParentNode(++i);
23014
23144
  }
23015
23145
 
@@ -23113,6 +23243,7 @@ function needsParens(path$$1, options) {
23113
23243
  case "TSTypeAssertion":
23114
23244
  case "TaggedTemplateExpression":
23115
23245
  case "UnaryExpression":
23246
+ case "JSXSpreadAttribute":
23116
23247
  case "SpreadElement":
23117
23248
  case "SpreadProperty":
23118
23249
  case "BindExpression":
@@ -23192,7 +23323,7 @@ function needsParens(path$$1, options) {
23192
23323
  } // Delegate to inner TSParenthesizedType
23193
23324
 
23194
23325
 
23195
- if (node.typeAnnotation.type === "TSParenthesizedType") {
23326
+ if (node.typeAnnotation.type === "TSParenthesizedType" && parent.type !== "TSArrayType") {
23196
23327
  return false;
23197
23328
  }
23198
23329
 
@@ -23366,9 +23497,6 @@ function needsParens(path$$1, options) {
23366
23497
  return true;
23367
23498
  // This is basically a kind of IIFE.
23368
23499
 
23369
- case "ExportDefaultDeclaration":
23370
- return true;
23371
-
23372
23500
  default:
23373
23501
  return false;
23374
23502
  }
@@ -23403,9 +23531,6 @@ function needsParens(path$$1, options) {
23403
23531
 
23404
23532
  case "ClassExpression":
23405
23533
  switch (parent.type) {
23406
- case "ExportDefaultDeclaration":
23407
- return true;
23408
-
23409
23534
  case "NewExpression":
23410
23535
  return name === "callee" && parent.callee === node;
23411
23536
 
@@ -23436,7 +23561,7 @@ function needsParens(path$$1, options) {
23436
23561
  return false;
23437
23562
 
23438
23563
  case "BindExpression":
23439
- if (parent.type === "BindExpression" && name === "callee" && parent.callee === node || parent.type === "MemberExpression") {
23564
+ if (parent.type === "BindExpression" && name === "callee" && parent.callee === node || parent.type === "MemberExpression" && name === "object" && parent.object === node || parent.type === "NewExpression" && name === "callee" && parent.callee === node) {
23440
23565
  return true;
23441
23566
  }
23442
23567
 
@@ -23518,6 +23643,26 @@ function isFollowedByRightBracket(path$$1) {
23518
23643
  return false;
23519
23644
  }
23520
23645
 
23646
+ function shouldWrapFunctionForExportDefault(path$$1, options) {
23647
+ var node = path$$1.getValue();
23648
+ var parent = path$$1.getParentNode();
23649
+
23650
+ if (node.type === "FunctionExpression" || node.type === "ClassExpression") {
23651
+ return parent.type === "ExportDefaultDeclaration" || // in some cases the function is already wrapped
23652
+ // (e.g. `export default (function() {})();`)
23653
+ // in this case we don't need to add extra parens
23654
+ !needsParens(path$$1, options);
23655
+ }
23656
+
23657
+ if (!hasNakedLeftSide$1(node) || parent.type !== "ExportDefaultDeclaration" && needsParens(path$$1, options)) {
23658
+ return false;
23659
+ }
23660
+
23661
+ return path$$1.call.apply(path$$1, [function (childPath) {
23662
+ return shouldWrapFunctionForExportDefault(childPath, options);
23663
+ }].concat(getLeftSidePathName$1(path$$1, node)));
23664
+ }
23665
+
23521
23666
  var needsParens_1 = needsParens;
23522
23667
 
23523
23668
  var _require$$0$builders$1 = doc.builders;
@@ -23623,6 +23768,9 @@ var isIdentifierName = utils$2.keyword.isIdentifierNameES5;
23623
23768
  var insertPragma = pragma.insertPragma;
23624
23769
  var printHtmlBinding = htmlBinding.printHtmlBinding;
23625
23770
  var isVueEventBindingExpression = htmlBinding.isVueEventBindingExpression;
23771
+ var getLeftSide = utils$4.getLeftSide;
23772
+ var getLeftSidePathName = utils$4.getLeftSidePathName;
23773
+ var hasNakedLeftSide = utils$4.hasNakedLeftSide;
23626
23774
  var hasNode = utils$4.hasNode;
23627
23775
  var hasFlowAnnotationComment = utils$4.hasFlowAnnotationComment;
23628
23776
  var hasFlowShorthandAnnotationComment = utils$4.hasFlowShorthandAnnotationComment;
@@ -25197,85 +25345,23 @@ function printPathNoParens(path$$1, options, print, args) {
25197
25345
  var expressions = path$$1.map(print, "expressions");
25198
25346
 
25199
25347
  var _parentNode = path$$1.getParentNode();
25200
- /**
25201
- * describe.each`table`(name, fn)
25202
- * describe.only.each`table`(name, fn)
25203
- * describe.skip.each`table`(name, fn)
25204
- * test.each`table`(name, fn)
25205
- * test.only.each`table`(name, fn)
25206
- * test.skip.each`table`(name, fn)
25207
- *
25208
- * Ref: https://github.com/facebook/jest/pull/6102
25209
- */
25210
-
25211
25348
 
25212
- var jestEachTriggerRegex = /^[xf]?(describe|it|test)$/;
25349
+ if (isJestEachTemplateLiteral(n, _parentNode)) {
25350
+ var _printed2 = printJestEachTemplateLiteral(n, expressions, options);
25213
25351
 
25214
- if (_parentNode.type === "TaggedTemplateExpression" && _parentNode.quasi === n && _parentNode.tag.type === "MemberExpression" && _parentNode.tag.property.type === "Identifier" && _parentNode.tag.property.name === "each" && (_parentNode.tag.object.type === "Identifier" && jestEachTriggerRegex.test(_parentNode.tag.object.name) || _parentNode.tag.object.type === "MemberExpression" && _parentNode.tag.object.property.type === "Identifier" && (_parentNode.tag.object.property.name === "only" || _parentNode.tag.object.property.name === "skip") && _parentNode.tag.object.object.type === "Identifier" && jestEachTriggerRegex.test(_parentNode.tag.object.object.name))) {
25215
- /**
25216
- * a | b | expected
25217
- * ${1} | ${1} | ${2}
25218
- * ${1} | ${2} | ${3}
25219
- * ${2} | ${1} | ${3}
25220
- */
25221
- var headerNames = n.quasis[0].value.raw.trim().split(/\s*\|\s*/);
25222
-
25223
- if (headerNames.length > 1 || headerNames.some(function (headerName) {
25224
- return headerName.length !== 0;
25225
- })) {
25226
- var stringifiedExpressions = expressions.map(function (doc$$2) {
25227
- return "${" + printDocToString$2(doc$$2, Object.assign({}, options, {
25228
- printWidth: Infinity,
25229
- endOfLine: "lf"
25230
- })).formatted + "}";
25231
- });
25232
- var tableBody = [{
25233
- hasLineBreak: false,
25234
- cells: []
25235
- }];
25236
-
25237
- for (var _i = 1; _i < n.quasis.length; _i++) {
25238
- var row = tableBody[tableBody.length - 1];
25239
- var correspondingExpression = stringifiedExpressions[_i - 1];
25240
- row.cells.push(correspondingExpression);
25241
-
25242
- if (correspondingExpression.indexOf("\n") !== -1) {
25243
- row.hasLineBreak = true;
25244
- }
25352
+ if (_printed2) {
25353
+ return _printed2;
25354
+ }
25355
+ }
25245
25356
 
25246
- if (n.quasis[_i].value.raw.indexOf("\n") !== -1) {
25247
- tableBody.push({
25248
- hasLineBreak: false,
25249
- cells: []
25250
- });
25251
- }
25252
- }
25357
+ var isSimple = isSimpleTemplateLiteral(n);
25253
25358
 
25254
- var maxColumnCount = tableBody.reduce(function (maxColumnCount, row) {
25255
- return Math.max(maxColumnCount, row.cells.length);
25256
- }, headerNames.length);
25257
- var maxColumnWidths = Array.from(new Array(maxColumnCount), function () {
25258
- return 0;
25259
- });
25260
- var table = [{
25261
- cells: headerNames
25262
- }].concat(tableBody.filter(function (row) {
25263
- return row.cells.length !== 0;
25264
- }));
25265
- table.filter(function (row) {
25266
- return !row.hasLineBreak;
25267
- }).forEach(function (row) {
25268
- row.cells.forEach(function (cell, index) {
25269
- maxColumnWidths[index] = Math.max(maxColumnWidths[index], getStringWidth$2(cell));
25270
- });
25271
- });
25272
- parts.push("`", indent$2(concat$4([hardline$3, join$2(hardline$3, table.map(function (row) {
25273
- return join$2(" | ", row.cells.map(function (cell, index) {
25274
- return row.hasLineBreak ? cell : cell + " ".repeat(maxColumnWidths[index] - getStringWidth$2(cell));
25275
- }));
25276
- }))])), hardline$3, "`");
25277
- return concat$4(parts);
25278
- }
25359
+ if (isSimple) {
25360
+ expressions = expressions.map(function (doc$$2) {
25361
+ return printDocToString$2(doc$$2, Object.assign({}, options, {
25362
+ printWidth: Infinity
25363
+ })).formatted;
25364
+ });
25279
25365
  }
25280
25366
 
25281
25367
  parts.push("`");
@@ -25298,13 +25384,17 @@ function printPathNoParens(path$$1, options, print, args) {
25298
25384
  var tabWidth = options.tabWidth;
25299
25385
  var quasi = childPath.getValue();
25300
25386
  var indentSize = getIndentSize$1(quasi.value.raw, tabWidth);
25301
- var _printed2 = expressions[i];
25387
+ var _printed3 = expressions[i];
25302
25388
 
25303
- if (n.expressions[i].comments && n.expressions[i].comments.length || n.expressions[i].type === "MemberExpression" || n.expressions[i].type === "OptionalMemberExpression" || n.expressions[i].type === "ConditionalExpression") {
25304
- _printed2 = concat$4([indent$2(concat$4([softline$1, _printed2])), softline$1]);
25389
+ if (!isSimple) {
25390
+ // Breaks at the template element boundaries (${ and }) are preferred to breaking
25391
+ // in the middle of a MemberExpression
25392
+ if (n.expressions[i].comments && n.expressions[i].comments.length || n.expressions[i].type === "MemberExpression" || n.expressions[i].type === "OptionalMemberExpression" || n.expressions[i].type === "ConditionalExpression") {
25393
+ _printed3 = concat$4([indent$2(concat$4([softline$1, _printed3])), softline$1]);
25394
+ }
25305
25395
  }
25306
25396
 
25307
- var aligned = indentSize === 0 && quasi.value.raw.endsWith("\n") ? align$1(-Infinity, _printed2) : addAlignmentToDoc$2(_printed2, indentSize, tabWidth);
25397
+ var aligned = indentSize === 0 && quasi.value.raw.endsWith("\n") ? align$1(-Infinity, _printed3) : addAlignmentToDoc$2(_printed3, indentSize, tabWidth);
25308
25398
  parts.push(group$1(concat$4(["${", aligned, lineSuffixBoundary$1, "}"])));
25309
25399
  }
25310
25400
  }, "quasis");
@@ -25351,8 +25441,7 @@ function printPathNoParens(path$$1, options, print, args) {
25351
25441
  case "TupleTypeAnnotation":
25352
25442
  {
25353
25443
  var typesField = n.type === "TSTupleType" ? "elementTypes" : "types";
25354
- return group$1(concat$4(["[", indent$2(concat$4([softline$1, printArrayItems(path$$1, options, typesField, print)])), // TypeScript doesn't support trailing commas in tuple types
25355
- n.type === "TSTupleType" ? "" : ifBreak$1(shouldPrintComma(options) ? "," : ""), comments.printDanglingComments(path$$1, options,
25444
+ return group$1(concat$4(["[", indent$2(concat$4([softline$1, printArrayItems(path$$1, options, typesField, print)])), ifBreak$1(shouldPrintComma(options, "all") ? "," : ""), comments.printDanglingComments(path$$1, options,
25356
25445
  /* sameIndent */
25357
25446
  true), softline$1, "]"]));
25358
25447
  }
@@ -25520,22 +25609,22 @@ function printPathNoParens(path$$1, options, print, args) {
25520
25609
  var result = [];
25521
25610
  var wasIndented = false;
25522
25611
 
25523
- for (var _i2 = 0; _i2 < types.length; ++_i2) {
25524
- if (_i2 === 0) {
25525
- result.push(types[_i2]);
25526
- } else if (isObjectType(n.types[_i2 - 1]) && isObjectType(n.types[_i2])) {
25612
+ for (var _i = 0; _i < types.length; ++_i) {
25613
+ if (_i === 0) {
25614
+ result.push(types[_i]);
25615
+ } else if (isObjectType(n.types[_i - 1]) && isObjectType(n.types[_i])) {
25527
25616
  // If both are objects, don't indent
25528
- result.push(concat$4([" & ", wasIndented ? indent$2(types[_i2]) : types[_i2]]));
25529
- } else if (!isObjectType(n.types[_i2 - 1]) && !isObjectType(n.types[_i2])) {
25617
+ result.push(concat$4([" & ", wasIndented ? indent$2(types[_i]) : types[_i]]));
25618
+ } else if (!isObjectType(n.types[_i - 1]) && !isObjectType(n.types[_i])) {
25530
25619
  // If no object is involved, go to the next line if it breaks
25531
- result.push(indent$2(concat$4([" &", line$3, types[_i2]])));
25620
+ result.push(indent$2(concat$4([" &", line$3, types[_i]])));
25532
25621
  } else {
25533
25622
  // If you go from object to non-object or vis-versa, then inline it
25534
- if (_i2 > 1) {
25623
+ if (_i > 1) {
25535
25624
  wasIndented = true;
25536
25625
  }
25537
25626
 
25538
- result.push(" & ", _i2 > 1 ? indent$2(types[_i2]) : types[_i2]);
25627
+ result.push(" & ", _i > 1 ? indent$2(types[_i]) : types[_i]);
25539
25628
  }
25540
25629
  }
25541
25630
 
@@ -25564,7 +25653,7 @@ function printPathNoParens(path$$1, options, print, args) {
25564
25653
  // // comment
25565
25654
  // | child2
25566
25655
 
25567
- var _printed3 = path$$1.map(function (typePath) {
25656
+ var _printed4 = path$$1.map(function (typePath) {
25568
25657
  var printedType = typePath.call(print);
25569
25658
 
25570
25659
  if (!shouldHug) {
@@ -25577,11 +25666,11 @@ function printPathNoParens(path$$1, options, print, args) {
25577
25666
  }, "types");
25578
25667
 
25579
25668
  if (shouldHug) {
25580
- return join$2(" | ", _printed3);
25669
+ return join$2(" | ", _printed4);
25581
25670
  }
25582
25671
 
25583
25672
  var shouldAddStartLine = shouldIndent && !hasLeadingOwnLineComment(options.originalText, n, options);
25584
- var code = concat$4([ifBreak$1(concat$4([shouldAddStartLine ? line$3 : "", "| "])), join$2(concat$4([line$3, "| "]), _printed3)]);
25673
+ var code = concat$4([ifBreak$1(concat$4([shouldAddStartLine ? line$3 : "", "| "])), join$2(concat$4([line$3, "| "]), _printed4)]);
25585
25674
  var hasParens;
25586
25675
 
25587
25676
  if (n.type === "TSUnionType") {
@@ -25667,9 +25756,9 @@ function printPathNoParens(path$$1, options, print, args) {
25667
25756
  parts.push("declare ");
25668
25757
  }
25669
25758
 
25670
- var _printed4 = printAssignmentRight(n.id, n.right, path$$1.call(print, "right"), options);
25759
+ var _printed5 = printAssignmentRight(n.id, n.right, path$$1.call(print, "right"), options);
25671
25760
 
25672
- parts.push("type ", path$$1.call(print, "id"), path$$1.call(print, "typeParameters"), " =", _printed4, semi);
25761
+ parts.push("type ", path$$1.call(print, "id"), path$$1.call(print, "typeParameters"), " =", _printed5, semi);
25673
25762
  return group$1(concat$4(parts));
25674
25763
  }
25675
25764
 
@@ -25746,6 +25835,15 @@ function printPathNoParens(path$$1, options, print, args) {
25746
25835
 
25747
25836
  if (n["default"]) {
25748
25837
  parts.push(" = ", path$$1.call(print, "default"));
25838
+ } // Keep comma if the file extension is .tsx and
25839
+ // has one type parameter that isn't extend with any types.
25840
+ // Because, otherwise formatted result will be invalid as tsx.
25841
+
25842
+
25843
+ var _grandParent = path$$1.getNode(2);
25844
+
25845
+ if (_parent9.params && _parent9.params.length === 1 && options.filepath && /\.tsx$/i.test(options.filepath) && !n.constraint && _grandParent.type === "ArrowFunctionExpression") {
25846
+ parts.push(",");
25749
25847
  }
25750
25848
 
25751
25849
  return concat$4(parts);
@@ -25960,9 +26058,15 @@ function printPathNoParens(path$$1, options, print, args) {
25960
26058
  return concat$4([n.operator, " ", path$$1.call(print, "typeAnnotation")]);
25961
26059
 
25962
26060
  case "TSMappedType":
25963
- return group$1(concat$4(["{", indent$2(concat$4([options.bracketSpacing ? line$3 : softline$1, n.readonly ? concat$4([getTypeScriptMappedTypeModifier(n.readonly, "readonly"), " "]) : "", printTypeScriptModifiers(path$$1, options, print), path$$1.call(print, "typeParameter"), n.optional ? getTypeScriptMappedTypeModifier(n.optional, "?") : "", ": ", path$$1.call(print, "typeAnnotation")])), comments.printDanglingComments(path$$1, options,
25964
- /* sameIndent */
25965
- true), options.bracketSpacing ? line$3 : softline$1, "}"]));
26061
+ {
26062
+ var _shouldBreak2 = hasNewlineInRange$1(options.originalText, options.locStart(n), options.locEnd(n));
26063
+
26064
+ return group$1(concat$4(["{", indent$2(concat$4([options.bracketSpacing ? line$3 : softline$1, n.readonly ? concat$4([getTypeScriptMappedTypeModifier(n.readonly, "readonly"), " "]) : "", printTypeScriptModifiers(path$$1, options, print), path$$1.call(print, "typeParameter"), n.optional ? getTypeScriptMappedTypeModifier(n.optional, "?") : "", ": ", path$$1.call(print, "typeAnnotation"), _shouldBreak2 && options.semi ? ";" : ""])), comments.printDanglingComments(path$$1, options,
26065
+ /* sameIndent */
26066
+ true), options.bracketSpacing ? line$3 : softline$1, "}"]), {
26067
+ shouldBreak: _shouldBreak2
26068
+ });
26069
+ }
25966
26070
 
25967
26071
  case "TSMethodSignature":
25968
26072
  parts.push(n.accessibility ? concat$4([n.accessibility, " "]) : "", n.export ? "export " : "", n.static ? "static " : "", n.readonly ? "readonly " : "", n.computed ? "[" : "", path$$1.call(print, "key"), n.computed ? "]" : "", printOptionalToken(path$$1), printFunctionParams(path$$1, print, options,
@@ -26240,7 +26344,7 @@ function printPropertyKey(path$$1, options, print) {
26240
26344
 
26241
26345
  if (options.quoteProps === "consistent" && !needsQuoteProps.has(parent)) {
26242
26346
  var objectHasStringProp = (parent.properties || parent.body || parent.members).some(function (prop) {
26243
- return prop.key && prop.key.type !== "Identifier" && !isStringPropSafeToCoerceToIdentifier(prop, options);
26347
+ return !prop.computed && prop.key && isStringLiteral(prop.key) && !isStringPropSafeToCoerceToIdentifier(prop, options);
26244
26348
  });
26245
26349
  needsQuoteProps.set(parent, objectHasStringProp);
26246
26350
  }
@@ -26255,7 +26359,7 @@ function printPropertyKey(path$$1, options, print) {
26255
26359
  }, "key");
26256
26360
  }
26257
26361
 
26258
- if (isStringPropSafeToCoerceToIdentifier(node, options) && (options.quoteProps === "as-needed" || options.quoteProps === "consistent" && !needsQuoteProps.get(parent))) {
26362
+ if (!node.computed && isStringPropSafeToCoerceToIdentifier(node, options) && (options.quoteProps === "as-needed" || options.quoteProps === "consistent" && !needsQuoteProps.get(parent))) {
26259
26363
  // 'a' -> a
26260
26364
  return path$$1.call(function (keyPath) {
26261
26365
  return comments.printComments(keyPath, function () {
@@ -26310,7 +26414,18 @@ function printMethod(path$$1, options, print) {
26310
26414
  }
26311
26415
 
26312
26416
  function couldGroupArg(arg) {
26313
- return arg.type === "ObjectExpression" && (arg.properties.length > 0 || arg.comments) || arg.type === "ArrayExpression" && (arg.elements.length > 0 || arg.comments) || arg.type === "TSTypeAssertion" || arg.type === "TSAsExpression" || arg.type === "FunctionExpression" || arg.type === "ArrowFunctionExpression" && !arg.returnType && (arg.body.type === "BlockStatement" || arg.body.type === "ArrowFunctionExpression" || arg.body.type === "ObjectExpression" || arg.body.type === "ArrayExpression" || arg.body.type === "CallExpression" || arg.body.type === "OptionalCallExpression" || arg.body.type === "ConditionalExpression" || isJSXNode(arg.body));
26417
+ return arg.type === "ObjectExpression" && (arg.properties.length > 0 || arg.comments) || arg.type === "ArrayExpression" && (arg.elements.length > 0 || arg.comments) || arg.type === "TSTypeAssertion" || arg.type === "TSAsExpression" || arg.type === "FunctionExpression" || arg.type === "ArrowFunctionExpression" && ( // we want to avoid breaking inside composite return types but not simple keywords
26418
+ // https://github.com/prettier/prettier/issues/4070
26419
+ // export class Thing implements OtherThing {
26420
+ // do: (type: Type) => Provider<Prop> = memoize(
26421
+ // (type: ObjectType): Provider<Opts> => {}
26422
+ // );
26423
+ // }
26424
+ // https://github.com/prettier/prettier/issues/6099
26425
+ // app.get("/", (req, res): void => {
26426
+ // res.send("Hello World!");
26427
+ // });
26428
+ !arg.returnType || !arg.returnType.typeAnnotation || arg.returnType.typeAnnotation.type !== "TSTypeReference") && (arg.body.type === "BlockStatement" || arg.body.type === "ArrowFunctionExpression" || arg.body.type === "ObjectExpression" || arg.body.type === "ArrayExpression" || arg.body.type === "CallExpression" || arg.body.type === "OptionalCallExpression" || arg.body.type === "ConditionalExpression" || isJSXNode(arg.body));
26314
26429
  }
26315
26430
 
26316
26431
  function shouldGroupLastArg(args) {
@@ -26336,6 +26451,130 @@ function isSimpleFlowType(node) {
26336
26451
  return node && flowTypeAnnotations.indexOf(node.type) !== -1 && !(node.type === "GenericTypeAnnotation" && node.typeParameters);
26337
26452
  }
26338
26453
 
26454
+ function isJestEachTemplateLiteral(node, parentNode) {
26455
+ /**
26456
+ * describe.each`table`(name, fn)
26457
+ * describe.only.each`table`(name, fn)
26458
+ * describe.skip.each`table`(name, fn)
26459
+ * test.each`table`(name, fn)
26460
+ * test.only.each`table`(name, fn)
26461
+ * test.skip.each`table`(name, fn)
26462
+ *
26463
+ * Ref: https://github.com/facebook/jest/pull/6102
26464
+ */
26465
+ var jestEachTriggerRegex = /^[xf]?(describe|it|test)$/;
26466
+ return parentNode.type === "TaggedTemplateExpression" && parentNode.quasi === node && parentNode.tag.type === "MemberExpression" && parentNode.tag.property.type === "Identifier" && parentNode.tag.property.name === "each" && (parentNode.tag.object.type === "Identifier" && jestEachTriggerRegex.test(parentNode.tag.object.name) || parentNode.tag.object.type === "MemberExpression" && parentNode.tag.object.property.type === "Identifier" && (parentNode.tag.object.property.name === "only" || parentNode.tag.object.property.name === "skip") && parentNode.tag.object.object.type === "Identifier" && jestEachTriggerRegex.test(parentNode.tag.object.object.name));
26467
+ }
26468
+
26469
+ function printJestEachTemplateLiteral(node, expressions, options) {
26470
+ /**
26471
+ * a | b | expected
26472
+ * ${1} | ${1} | ${2}
26473
+ * ${1} | ${2} | ${3}
26474
+ * ${2} | ${1} | ${3}
26475
+ */
26476
+ var headerNames = node.quasis[0].value.raw.trim().split(/\s*\|\s*/);
26477
+
26478
+ if (headerNames.length > 1 || headerNames.some(function (headerName) {
26479
+ return headerName.length !== 0;
26480
+ })) {
26481
+ var parts = [];
26482
+ var stringifiedExpressions = expressions.map(function (doc$$2) {
26483
+ return "${" + printDocToString$2(doc$$2, Object.assign({}, options, {
26484
+ printWidth: Infinity,
26485
+ endOfLine: "lf"
26486
+ })).formatted + "}";
26487
+ });
26488
+ var tableBody = [{
26489
+ hasLineBreak: false,
26490
+ cells: []
26491
+ }];
26492
+
26493
+ for (var i = 1; i < node.quasis.length; i++) {
26494
+ var row = tableBody[tableBody.length - 1];
26495
+ var correspondingExpression = stringifiedExpressions[i - 1];
26496
+ row.cells.push(correspondingExpression);
26497
+
26498
+ if (correspondingExpression.indexOf("\n") !== -1) {
26499
+ row.hasLineBreak = true;
26500
+ }
26501
+
26502
+ if (node.quasis[i].value.raw.indexOf("\n") !== -1) {
26503
+ tableBody.push({
26504
+ hasLineBreak: false,
26505
+ cells: []
26506
+ });
26507
+ }
26508
+ }
26509
+
26510
+ var maxColumnCount = tableBody.reduce(function (maxColumnCount, row) {
26511
+ return Math.max(maxColumnCount, row.cells.length);
26512
+ }, headerNames.length);
26513
+ var maxColumnWidths = Array.from(new Array(maxColumnCount), function () {
26514
+ return 0;
26515
+ });
26516
+ var table = [{
26517
+ cells: headerNames
26518
+ }].concat(tableBody.filter(function (row) {
26519
+ return row.cells.length !== 0;
26520
+ }));
26521
+ table.filter(function (row) {
26522
+ return !row.hasLineBreak;
26523
+ }).forEach(function (row) {
26524
+ row.cells.forEach(function (cell, index) {
26525
+ maxColumnWidths[index] = Math.max(maxColumnWidths[index], getStringWidth$2(cell));
26526
+ });
26527
+ });
26528
+ parts.push("`", indent$2(concat$4([hardline$3, join$2(hardline$3, table.map(function (row) {
26529
+ return join$2(" | ", row.cells.map(function (cell, index) {
26530
+ return row.hasLineBreak ? cell : cell + " ".repeat(maxColumnWidths[index] - getStringWidth$2(cell));
26531
+ }));
26532
+ }))])), hardline$3, "`");
26533
+ return concat$4(parts);
26534
+ }
26535
+ }
26536
+ /** @param node {import("estree").TemplateLiteral} */
26537
+
26538
+
26539
+ function isSimpleTemplateLiteral(node) {
26540
+ if (node.expressions.length === 0) {
26541
+ return false;
26542
+ }
26543
+
26544
+ return node.expressions.every(function (expr) {
26545
+ // Disallow comments since printDocToString can't print them here
26546
+ if (expr.comments) {
26547
+ return false;
26548
+ } // Allow `x` and `this`
26549
+
26550
+
26551
+ if (expr.type === "Identifier" || expr.type === "ThisExpression") {
26552
+ return true;
26553
+ } // Allow `a.b.c`, `a.b[c]`, and `this.x.y`
26554
+
26555
+
26556
+ if ((expr.type === "MemberExpression" || expr.type === "OptionalMemberExpression") && (expr.property.type === "Identifier" || expr.property.type === "Literal")) {
26557
+ var ancestor = expr;
26558
+
26559
+ while (ancestor.type === "MemberExpression" || ancestor.type === "OptionalMemberExpression") {
26560
+ ancestor = ancestor.object;
26561
+
26562
+ if (ancestor.comments) {
26563
+ return false;
26564
+ }
26565
+ }
26566
+
26567
+ if (ancestor.type === "Identifier" || ancestor.type === "ThisExpression") {
26568
+ return true;
26569
+ }
26570
+
26571
+ return false;
26572
+ }
26573
+
26574
+ return false;
26575
+ });
26576
+ }
26577
+
26339
26578
  var functionCompositionFunctionNames = new Set(["pipe", // RxJS, Ramda
26340
26579
  "pipeP", // Ramda
26341
26580
  "pipeK", // Ramda
@@ -27471,11 +27710,10 @@ function printJSXChildren(path$$1, options, print, jsxWhitespace, isFacebookTran
27471
27710
 
27472
27711
 
27473
27712
  function printJSXElement(path$$1, options, print) {
27474
- var n = path$$1.getValue(); // Turn <div></div> into <div />
27713
+ var n = path$$1.getValue();
27475
27714
 
27476
27715
  if (n.type === "JSXElement" && isEmptyJSXElement(n)) {
27477
- n.openingElement.selfClosing = true;
27478
- return path$$1.call(print, "openingElement");
27716
+ return concat$4([path$$1.call(print, "openingElement"), path$$1.call(print, "closingElement")]);
27479
27717
  }
27480
27718
 
27481
27719
  var openingLines = n.type === "JSXElement" ? path$$1.call(print, "openingElement") : path$$1.call(print, "openingFragment");
@@ -27717,7 +27955,7 @@ function printAssignmentRight(leftNode, rightNode, printedRight, options) {
27717
27955
  }
27718
27956
 
27719
27957
  var canBreak = isBinaryish(rightNode) && !shouldInlineLogicalExpression(rightNode) || rightNode.type === "ConditionalExpression" && isBinaryish(rightNode.test) && !shouldInlineLogicalExpression(rightNode.test) || rightNode.type === "StringLiteralTypeAnnotation" || rightNode.type === "ClassExpression" && rightNode.decorators && rightNode.decorators.length || (leftNode.type === "Identifier" || isStringLiteral(leftNode) || leftNode.type === "MemberExpression") && (isStringLiteral(rightNode) || isMemberExpressionChain(rightNode)) && // do not put values on a separate line from the key in json
27720
- options.parser !== "json" && options.parser !== "json5";
27958
+ options.parser !== "json" && options.parser !== "json5" || rightNode.type === "SequenceExpression";
27721
27959
 
27722
27960
  if (canBreak) {
27723
27961
  return group$1(indent$2(concat$4([line$3, printedRight])));
@@ -27795,60 +28033,12 @@ function hasLeadingOwnLineComment(text, node, options) {
27795
28033
  return res;
27796
28034
  }
27797
28035
 
27798
- function hasNakedLeftSide(node) {
27799
- return node.type === "AssignmentExpression" || node.type === "BinaryExpression" || node.type === "LogicalExpression" || node.type === "NGPipeExpression" || node.type === "ConditionalExpression" || node.type === "CallExpression" || node.type === "OptionalCallExpression" || node.type === "MemberExpression" || node.type === "OptionalMemberExpression" || node.type === "SequenceExpression" || node.type === "TaggedTemplateExpression" || node.type === "BindExpression" || node.type === "UpdateExpression" && !node.prefix || node.type === "TSNonNullExpression";
27800
- }
27801
-
27802
28036
  function isFlowAnnotationComment(text, typeAnnotation, options) {
27803
28037
  var start = options.locStart(typeAnnotation);
27804
28038
  var end = skipWhitespace$1(text, options.locEnd(typeAnnotation));
27805
28039
  return text.substr(start, 2) === "/*" && text.substr(end, 2) === "*/";
27806
28040
  }
27807
28041
 
27808
- function getLeftSide(node) {
27809
- if (node.expressions) {
27810
- return node.expressions[0];
27811
- }
27812
-
27813
- return node.left || node.test || node.callee || node.object || node.tag || node.argument || node.expression;
27814
- }
27815
-
27816
- function getLeftSidePathName(path$$1, node) {
27817
- if (node.expressions) {
27818
- return ["expressions", 0];
27819
- }
27820
-
27821
- if (node.left) {
27822
- return ["left"];
27823
- }
27824
-
27825
- if (node.test) {
27826
- return ["test"];
27827
- }
27828
-
27829
- if (node.object) {
27830
- return ["object"];
27831
- }
27832
-
27833
- if (node.callee) {
27834
- return ["callee"];
27835
- }
27836
-
27837
- if (node.tag) {
27838
- return ["tag"];
27839
- }
27840
-
27841
- if (node.argument) {
27842
- return ["argument"];
27843
- }
27844
-
27845
- if (node.expression) {
27846
- return ["expression"];
27847
- }
27848
-
27849
- throw new Error("Unexpected node has no left side", node);
27850
- }
27851
-
27852
28042
  function exprNeedsASIProtection(path$$1, options) {
27853
28043
  var node = path$$1.getValue();
27854
28044
  var maybeASIProblem = needsParens_1(path$$1, options) || node.type === "ParenthesizedExpression" || node.type === "TypeCastExpression" || node.type === "ArrowFunctionExpression" && !shouldPrintParamsWithoutParens(path$$1, options) || node.type === "ArrayExpression" || node.type === "ArrayPattern" || node.type === "UnaryExpression" && node.prefix && (node.operator === "+" || node.operator === "-") || node.type === "TemplateLiteral" || node.type === "TemplateElement" || isJSXNode(node) || node.type === "BindExpression" && !node.object || node.type === "RegExpLiteral" || node.type === "Literal" && node.pattern || node.type === "Literal" && node.regex;
@@ -28091,7 +28281,7 @@ function isLiteral(node) {
28091
28281
  }
28092
28282
 
28093
28283
  function isStringPropSafeToCoerceToIdentifier(node, options) {
28094
- return isStringLiteral(node.key) && isIdentifierName(node.key.value) && !node.computed && options.parser !== "json" && !(options.parser === "typescript" && node.type === "ClassProperty");
28284
+ return isStringLiteral(node.key) && isIdentifierName(node.key.value) && options.parser !== "json" && !(options.parser === "typescript" && node.type === "ClassProperty");
28095
28285
  }
28096
28286
 
28097
28287
  function isNumericLiteral(node) {
@@ -28177,7 +28367,9 @@ function isTheOnlyJSXElementInMarkdown(options, path$$1) {
28177
28367
  return parent.type === "Program" && parent.body.length == 1;
28178
28368
  }
28179
28369
 
28180
- function willPrintOwnComments(path$$1) {
28370
+ function willPrintOwnComments(path$$1
28371
+ /*, options */
28372
+ ) {
28181
28373
  var node = path$$1.getValue();
28182
28374
  var parent = path$$1.getParentNode();
28183
28375
  return (node && (isJSXNode(node) || hasFlowShorthandAnnotationComment(node) || parent && parent.type === "CallExpression" && (hasFlowAnnotationComment(node.leadingComments) || hasFlowAnnotationComment(node.trailingComments))) || parent && (parent.type === "JSXSpreadAttribute" || parent.type === "JSXSpreadChild" || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType" || (parent.type === "ClassDeclaration" || parent.type === "ClassExpression") && parent.superClass === node)) && !hasIgnoreComment$1(path$$1);
@@ -28736,7 +28928,7 @@ var json5$1 = Object.freeze({
28736
28928
 
28737
28929
  var require$$0$21 = ( javascript$1 && javascript ) || javascript$1;
28738
28930
 
28739
- var require$$1$9 = ( jsx$1 && jsx ) || jsx$1;
28931
+ var require$$1$10 = ( jsx$1 && jsx ) || jsx$1;
28740
28932
 
28741
28933
  var require$$2$10 = ( typescript$1 && typescript ) || typescript$1;
28742
28934
 
@@ -28765,7 +28957,7 @@ var languages = [createLanguage(require$$0$21, {
28765
28957
  filenames: [],
28766
28958
  extensions: [".js.flow"]
28767
28959
  }
28768
- }), createLanguage(require$$1$9, {
28960
+ }), createLanguage(require$$1$10, {
28769
28961
  override: {
28770
28962
  since: "0.0.0",
28771
28963
  parsers: ["babel", "flow"],
@@ -30133,7 +30325,7 @@ var scss$1 = Object.freeze({
30133
30325
 
30134
30326
  var require$$0$23 = ( css$3 && css$2 ) || css$3;
30135
30327
 
30136
- var require$$1$10 = ( postcss$1 && postcss ) || postcss$1;
30328
+ var require$$1$11 = ( postcss$1 && postcss ) || postcss$1;
30137
30329
 
30138
30330
  var require$$2$11 = ( less$1 && less ) || less$1;
30139
30331
 
@@ -30145,7 +30337,7 @@ var languages$1 = [createLanguage(require$$0$23, {
30145
30337
  parsers: ["css"],
30146
30338
  vscodeLanguageIds: ["css"]
30147
30339
  }
30148
- }), createLanguage(require$$1$10, {
30340
+ }), createLanguage(require$$1$11, {
30149
30341
  override: {
30150
30342
  since: "1.4.0",
30151
30343
  parsers: ["css"],
@@ -30212,26 +30404,14 @@ function print(path$$1, options, print) {
30212
30404
  var isGlimmerComponent = tagFirstChar.toUpperCase() === tagFirstChar || isLocal;
30213
30405
  var hasChildren = n.children.length > 0;
30214
30406
  var isVoid = isGlimmerComponent && !hasChildren || voidTags.indexOf(n.tag) !== -1;
30215
- var closeTag = isVoid ? concat$10([" />", softline$4]) : ">";
30407
+ var closeTagForNoBreak = isVoid ? concat$10([" />", softline$4]) : ">";
30408
+ var closeTagForBreak = isVoid ? "/>" : ">";
30216
30409
 
30217
30410
  var _getParams = function _getParams(path$$1, print) {
30218
30411
  return indent$6(concat$10([n.attributes.length ? line$6 : "", join$7(line$6, path$$1.map(print, "attributes")), n.modifiers.length ? line$6 : "", join$7(line$6, path$$1.map(print, "modifiers")), n.comments.length ? line$6 : "", join$7(line$6, path$$1.map(print, "comments"))]));
30219
- }; // The problem here is that I want to not break at all if the children
30220
- // would not break but I need to force an indent, so I use a hardline.
30221
-
30222
- /**
30223
- * What happens now:
30224
- * <div>
30225
- * Hello
30226
- * </div>
30227
- * ==>
30228
- * <div>Hello</div>
30229
- * This is due to me using hasChildren to decide to put the hardline in.
30230
- * I would rather use a {DOES THE WHOLE THING NEED TO BREAK}
30231
- */
30232
-
30412
+ };
30233
30413
 
30234
- return concat$10([group$10(concat$10(["<", n.tag, _getParams(path$$1, print), n.blockParams.length ? ` as |${n.blockParams.join(" ")}|` : "", ifBreak$3(softline$4, ""), closeTag])), group$10(concat$10([indent$6(join$7(softline$4, [""].concat(path$$1.map(print, "children")))), ifBreak$3(hasChildren ? hardline$8 : "", ""), !isVoid ? concat$10(["</", n.tag, ">"]) : ""]))]);
30414
+ return concat$10([group$10(concat$10(["<", n.tag, _getParams(path$$1, print), n.blockParams.length ? ` as |${n.blockParams.join(" ")}|` : "", ifBreak$3(softline$4, ""), ifBreak$3(closeTagForBreak, closeTagForNoBreak)])), group$10(concat$10([indent$6(join$7(softline$4, [""].concat(path$$1.map(print, "children")))), ifBreak$3(hasChildren ? hardline$8 : "", ""), !isVoid ? concat$10(["</", n.tag, ">"]) : ""]))]);
30235
30415
  }
30236
30416
 
30237
30417
  case "BlockStatement":
@@ -31547,9 +31727,9 @@ function genericPrint$4(path$$1, options, print) {
31547
31727
 
31548
31728
  case "inlineCode":
31549
31729
  {
31550
- var backtickCount = util$1.getMaxContinuousCount(node.value, "`");
31730
+ var backtickCount = util$1.getMinNotPresentContinuousCount(node.value, "`");
31551
31731
 
31552
- var _style = backtickCount === 1 ? "``" : "`";
31732
+ var _style = "`".repeat(backtickCount || 1);
31553
31733
 
31554
31734
  var gap = backtickCount ? " " : "";
31555
31735
  return concat$12([_style, gap, node.value, gap, _style]);
@@ -33626,7 +33806,7 @@ var parseSrcset = createCommonjsModule(function (module) {
33626
33806
  // Browser globals (root is window)
33627
33807
  root.parseSrcset = factory();
33628
33808
  }
33629
- })(commonjsGlobal, function () {
33809
+ })(this, function () {
33630
33810
  // 1. Let input be the value passed to this algorithm.
33631
33811
  return function (input, options) {
33632
33812
  var logger = options && options.logger || console; // UTILITY FUNCTIONS
@@ -34076,7 +34256,7 @@ function embed$6(path$$1, print, textToDoc, options) {
34076
34256
  } // lit-html: html`<my-element obj=${obj}></my-element>`
34077
34257
 
34078
34258
 
34079
- if (/^PRETTIER_HTML_PLACEHOLDER_\d+_IN_JS$/.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
34259
+ if (/^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
34080
34260
  return concat$14([node.rawName, "=", node.value]);
34081
34261
  } // lwc: html`<my-element data-for={value}></my-elememt>`
34082
34262
 
@@ -34846,7 +35026,7 @@ var vue$1 = Object.freeze({
34846
35026
 
34847
35027
  var require$$0$31 = ( html$2 && html$1 ) || html$2;
34848
35028
 
34849
- var require$$1$11 = ( vue$1 && vue ) || vue$1;
35029
+ var require$$1$12 = ( vue$1 && vue ) || vue$1;
34850
35030
 
34851
35031
  var languages$5 = [createLanguage(require$$0$31, {
34852
35032
  override: {
@@ -34876,7 +35056,7 @@ var languages$5 = [createLanguage(require$$0$31, {
34876
35056
  extensions: [],
34877
35057
  filenames: []
34878
35058
  }
34879
- }), createLanguage(require$$1$11, {
35059
+ }), createLanguage(require$$1$12, {
34880
35060
  override: {
34881
35061
  since: "1.10.0",
34882
35062
  parsers: ["vue"],
@@ -39313,7 +39493,7 @@ var fnmatch = createCommonjsModule(function (module, exports) {
39313
39493
  var ini = createCommonjsModule(function (module, exports) {
39314
39494
  "use strict"; // Based on iniparser by shockie <https://npmjs.org/package/iniparser>
39315
39495
 
39316
- var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function (thisArg, _arguments, P, generator) {
39496
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
39317
39497
  return new (P || (P = Promise))(function (resolve, reject) {
39318
39498
  function fulfilled(value) {
39319
39499
  try {
@@ -39341,7 +39521,7 @@ var ini = createCommonjsModule(function (module, exports) {
39341
39521
  });
39342
39522
  };
39343
39523
 
39344
- var __generator = commonjsGlobal && commonjsGlobal.__generator || function (thisArg, body) {
39524
+ var __generator = this && this.__generator || function (thisArg, body) {
39345
39525
  var _ = {
39346
39526
  label: 0,
39347
39527
  sent: function sent() {
@@ -39452,7 +39632,7 @@ var ini = createCommonjsModule(function (module, exports) {
39452
39632
  }
39453
39633
  };
39454
39634
 
39455
- var __importStar = commonjsGlobal && commonjsGlobal.__importStar || function (mod) {
39635
+ var __importStar = this && this.__importStar || function (mod) {
39456
39636
  if (mod && mod.__esModule) return mod;
39457
39637
  var result = {};
39458
39638
  if (mod != null) for (var k in mod) {
@@ -39631,7 +39811,7 @@ var require$$4$6 = ( _package$3 && _package$2 ) || _package$3;
39631
39811
  var src$2 = createCommonjsModule(function (module, exports) {
39632
39812
  "use strict";
39633
39813
 
39634
- var __awaiter = commonjsGlobal && commonjsGlobal.__awaiter || function (thisArg, _arguments, P, generator) {
39814
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
39635
39815
  return new (P || (P = Promise))(function (resolve, reject) {
39636
39816
  function fulfilled(value) {
39637
39817
  try {
@@ -39659,7 +39839,7 @@ var src$2 = createCommonjsModule(function (module, exports) {
39659
39839
  });
39660
39840
  };
39661
39841
 
39662
- var __generator = commonjsGlobal && commonjsGlobal.__generator || function (thisArg, body) {
39842
+ var __generator = this && this.__generator || function (thisArg, body) {
39663
39843
  var _ = {
39664
39844
  label: 0,
39665
39845
  sent: function sent() {
@@ -39770,7 +39950,7 @@ var src$2 = createCommonjsModule(function (module, exports) {
39770
39950
  }
39771
39951
  };
39772
39952
 
39773
- var __importStar = commonjsGlobal && commonjsGlobal.__importStar || function (mod) {
39953
+ var __importStar = this && this.__importStar || function (mod) {
39774
39954
  if (mod && mod.__esModule) return mod;
39775
39955
  var result = {};
39776
39956
  if (mod != null) for (var k in mod) {
@@ -39780,7 +39960,7 @@ var src$2 = createCommonjsModule(function (module, exports) {
39780
39960
  return result;
39781
39961
  };
39782
39962
 
39783
- var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
39963
+ var __importDefault = this && this.__importDefault || function (mod) {
39784
39964
  return mod && mod.__esModule ? mod : {
39785
39965
  "default": mod
39786
39966
  };
@@ -40242,6 +40422,7 @@ function (_Error) {
40242
40422
  _classCallCheck(this, ParserError);
40243
40423
 
40244
40424
  _this = _possibleConstructorReturn(this, _getPrototypeOf(ParserError).call(this, '[ParserError] ' + msg, filename, linenumber));
40425
+ _this.name = 'ParserError';
40245
40426
  _this.code = 'ParserError';
40246
40427
  if (Error.captureStackTrace) Error.captureStackTrace(_assertThisInitialized(_assertThisInitialized(_this)), ParserError);
40247
40428
  return _this;
@@ -40365,7 +40546,7 @@ function () {
40365
40546
  key: "return",
40366
40547
  value: function _return(value) {
40367
40548
  /* istanbul ignore next */
40368
- if (!this.stack.length) throw this.error(new ParserError('Stack underflow'));
40549
+ if (this.stack.length === 0) throw this.error(new ParserError('Stack underflow'));
40369
40550
  if (value === undefined) value = this.state.buf;
40370
40551
  this.state = this.stack.pop();
40371
40552
  this.state.returned = value;
@@ -40481,7 +40662,7 @@ var createDatetimeFloat = createCommonjsModule(function (module) {
40481
40662
  var createDate = createCommonjsModule(function (module) {
40482
40663
  'use strict';
40483
40664
 
40484
- var DateTime = commonjsGlobal.Date;
40665
+ var DateTime = global.Date;
40485
40666
 
40486
40667
  var Date =
40487
40668
  /*#__PURE__*/
@@ -40578,6 +40759,7 @@ var tomlParser = createCommonjsModule(function (module) {
40578
40759
  _classCallCheck(this, TomlError);
40579
40760
 
40580
40761
  _this = _possibleConstructorReturn(this, _getPrototypeOf(TomlError).call(this, msg));
40762
+ _this.name = 'TomlError';
40581
40763
  /* istanbul ignore next */
40582
40764
 
40583
40765
  if (Error.captureStackTrace) Error.captureStackTrace(_assertThisInitialized(_assertThisInitialized(_this)), TomlError);
@@ -40646,13 +40828,13 @@ var tomlParser = createCommonjsModule(function (module) {
40646
40828
  var SURROGATE_FIRST = 0xD800;
40647
40829
  var SURROGATE_LAST = 0xDFFF;
40648
40830
  var escapes = {
40649
- [CHAR_b]: '\x08',
40650
- [CHAR_t]: '\x09',
40651
- [CHAR_n]: '\x0a',
40652
- [CHAR_f]: '\x0c',
40653
- [CHAR_r]: '\x0d',
40654
- [CHAR_QUOT]: '\x22',
40655
- [CHAR_BSOL]: '\x5c'
40831
+ [CHAR_b]: '\u0008',
40832
+ [CHAR_t]: '\u0009',
40833
+ [CHAR_n]: '\u000A',
40834
+ [CHAR_f]: '\u000C',
40835
+ [CHAR_r]: '\u000D',
40836
+ [CHAR_QUOT]: '\u0022',
40837
+ [CHAR_BSOL]: '\u005C'
40656
40838
  };
40657
40839
 
40658
40840
  function isDigit(cp) {
@@ -40683,6 +40865,21 @@ var tomlParser = createCommonjsModule(function (module) {
40683
40865
 
40684
40866
  var _declared = Symbol('declared');
40685
40867
 
40868
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
40869
+ var defineProperty = Object.defineProperty;
40870
+ var descriptor = {
40871
+ configurable: true,
40872
+ enumerable: true,
40873
+ writable: true,
40874
+ value: undefined
40875
+ };
40876
+
40877
+ function hasKey(obj, key) {
40878
+ if (hasOwnProperty.call(obj, key)) return true;
40879
+ if (key === '__proto__') defineProperty(obj, '__proto__', descriptor);
40880
+ return false;
40881
+ }
40882
+
40686
40883
  var INLINE_TABLE = Symbol('inline-table');
40687
40884
 
40688
40885
  function InlineTable() {
@@ -40753,10 +40950,18 @@ var tomlParser = createCommonjsModule(function (module) {
40753
40950
  } // in an eval, to let bundlers not slurp in a util proxy
40754
40951
 
40755
40952
 
40756
- var utilInspect = eval(`require('util').inspect`);
40953
+ var _custom;
40954
+
40955
+ try {
40956
+ var utilInspect = util.inspect;
40957
+ _custom = utilInspect.custom;
40958
+ } catch (_) {}
40959
+ /* eval require not available in transpiled bundle */
40960
+
40757
40961
  /* istanbul ignore next */
40758
40962
 
40759
- var _inspect = utilInspect && utilInspect.custom || 'inspect';
40963
+
40964
+ var _inspect = _custom || 'inspect';
40760
40965
 
40761
40966
  var BoxedBigInt =
40762
40967
  /*#__PURE__*/
@@ -40765,7 +40970,7 @@ var tomlParser = createCommonjsModule(function (module) {
40765
40970
  _classCallCheck(this, BoxedBigInt);
40766
40971
 
40767
40972
  try {
40768
- this.value = commonjsGlobal.BigInt(value);
40973
+ this.value = global.BigInt.asIntN(64, value);
40769
40974
  } catch (_) {
40770
40975
  /* istanbul ignore next */
40771
40976
  this.value = null;
@@ -40813,7 +41018,7 @@ var tomlParser = createCommonjsModule(function (module) {
40813
41018
  if (Object.is(num, -0)) num = 0;
40814
41019
  /* istanbul ignore else */
40815
41020
 
40816
- if (commonjsGlobal.BigInt && !Number.isSafeInteger(num)) {
41021
+ if (global.BigInt && !Number.isSafeInteger(num)) {
40817
41022
  return new BoxedBigInt(_value);
40818
41023
  } else {
40819
41024
  /* istanbul ignore next */
@@ -40980,7 +41185,7 @@ var tomlParser = createCommonjsModule(function (module) {
40980
41185
  for (var _iterator = kv.key[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
40981
41186
  var kw = _step.value;
40982
41187
 
40983
- if (kw in target && (!isTable(target[kw]) || target[kw][_declared])) {
41188
+ if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
40984
41189
  throw this.error(new TomlError("Can't redefine existing key"));
40985
41190
  }
40986
41191
 
@@ -41001,7 +41206,7 @@ var tomlParser = createCommonjsModule(function (module) {
41001
41206
  }
41002
41207
  }
41003
41208
 
41004
- if (finalKey in target) {
41209
+ if (hasKey(target, finalKey)) {
41005
41210
  throw this.error(new TomlError("Can't redefine existing key"));
41006
41211
  } // unbox our numbers
41007
41212
 
@@ -41119,7 +41324,7 @@ var tomlParser = createCommonjsModule(function (module) {
41119
41324
  if (this.char === CHAR_SP || this.char === CTRL_I) {
41120
41325
  return null;
41121
41326
  } else if (this.char === CHAR_RSQB) {
41122
- if (keyword in this.ctx && (!isTable(this.ctx[keyword]) || this.ctx[keyword][_declared])) {
41327
+ if (hasKey(this.ctx, keyword) && (!isTable(this.ctx[keyword]) || this.ctx[keyword][_declared])) {
41123
41328
  throw this.error(new TomlError("Can't redefine existing key"));
41124
41329
  } else {
41125
41330
  this.ctx = this.ctx[keyword] = this.ctx[keyword] || Table();
@@ -41128,7 +41333,7 @@ var tomlParser = createCommonjsModule(function (module) {
41128
41333
 
41129
41334
  return this.next(this.parseWhitespaceToEOL);
41130
41335
  } else if (this.char === CHAR_PERIOD) {
41131
- if (!(keyword in this.ctx)) {
41336
+ if (!hasKey(this.ctx, keyword)) {
41132
41337
  this.ctx = this.ctx[keyword] = Table();
41133
41338
  } else if (isTable(this.ctx[keyword])) {
41134
41339
  this.ctx = this.ctx[keyword];
@@ -41166,7 +41371,7 @@ var tomlParser = createCommonjsModule(function (module) {
41166
41371
  if (this.char === CHAR_SP || this.char === CTRL_I) {
41167
41372
  return null;
41168
41373
  } else if (this.char === CHAR_RSQB) {
41169
- if (!(keyword in this.ctx)) {
41374
+ if (!hasKey(this.ctx, keyword)) {
41170
41375
  this.ctx[keyword] = List();
41171
41376
  }
41172
41377
 
@@ -41182,7 +41387,7 @@ var tomlParser = createCommonjsModule(function (module) {
41182
41387
 
41183
41388
  return this.next(this.parseListEnd);
41184
41389
  } else if (this.char === CHAR_PERIOD) {
41185
- if (!(keyword in this.ctx)) {
41390
+ if (!hasKey(this.ctx, keyword)) {
41186
41391
  this.ctx = this.ctx[keyword] = Table();
41187
41392
  } else if (isInlineList(this.ctx[keyword])) {
41188
41393
  throw this.error(new TomlError("Can't extend an inline array"));
@@ -41562,8 +41767,8 @@ var tomlParser = createCommonjsModule(function (module) {
41562
41767
  }
41563
41768
 
41564
41769
  return this.returnNow(String.fromCodePoint(codePoint));
41565
- } catch (ex) {
41566
- throw this.error(TomlError.wrap(ex));
41770
+ } catch (err) {
41771
+ throw this.error(TomlError.wrap(err));
41567
41772
  }
41568
41773
  }
41569
41774
  }, {
@@ -41602,7 +41807,30 @@ var tomlParser = createCommonjsModule(function (module) {
41602
41807
  } else if (this.char === CHAR_n) {
41603
41808
  return this.next(this.parseNan);
41604
41809
  } else {
41605
- return this.callNow(this.parseNoUnder, this.parseNumberInteger);
41810
+ return this.callNow(this.parseNoUnder, this.parseNumberIntegerStart);
41811
+ }
41812
+ }
41813
+ }, {
41814
+ key: "parseNumberIntegerStart",
41815
+ value: function parseNumberIntegerStart() {
41816
+ if (this.char === CHAR_0) {
41817
+ this.consume();
41818
+ return this.next(this.parseNumberIntegerExponentOrDecimal);
41819
+ } else {
41820
+ return this.goto(this.parseNumberInteger);
41821
+ }
41822
+ }
41823
+ }, {
41824
+ key: "parseNumberIntegerExponentOrDecimal",
41825
+ value: function parseNumberIntegerExponentOrDecimal() {
41826
+ if (this.char === CHAR_PERIOD) {
41827
+ this.consume();
41828
+ return this.call(this.parseNoUnder, this.parseNumberFloat);
41829
+ } else if (this.char === CHAR_E || this.char === CHAR_e) {
41830
+ this.consume();
41831
+ return this.next(this.parseNumberExponentSign);
41832
+ } else {
41833
+ return this.returnNow(Integer(this.state.buf));
41606
41834
  }
41607
41835
  }
41608
41836
  }, {
@@ -41632,9 +41860,9 @@ var tomlParser = createCommonjsModule(function (module) {
41632
41860
  }, {
41633
41861
  key: "parseNoUnder",
41634
41862
  value: function parseNoUnder() {
41635
- if (this.char === CHAR_LOWBAR) {
41636
- throw this.error(new TomlError('Unexpected character, expected digit, exponent marker(e) or whitespace'));
41637
- } else if (this.atEndOfWord() || this.char === CHAR_E || this.char === CHAR_e) {
41863
+ if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD || this.char === CHAR_E || this.char === CHAR_e) {
41864
+ throw this.error(new TomlError('Unexpected character, expected digit'));
41865
+ } else if (this.atEndOfWord()) {
41638
41866
  throw this.error(new TomlError('Incomplete number'));
41639
41867
  }
41640
41868
 
@@ -42209,7 +42437,7 @@ var tomlParser = createCommonjsModule(function (module) {
42209
42437
  for (var _iterator2 = kv.key[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
42210
42438
  var kw = _step2.value;
42211
42439
 
42212
- if (kw in target && (!isTable(target[kw]) || target[kw][_declared])) {
42440
+ if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
42213
42441
  throw this.error(new TomlError("Can't redefine existing key"));
42214
42442
  }
42215
42443
 
@@ -42230,7 +42458,7 @@ var tomlParser = createCommonjsModule(function (module) {
42230
42458
  }
42231
42459
  }
42232
42460
 
42233
- if (finalKey in target) {
42461
+ if (hasKey(target, finalKey)) {
42234
42462
  throw this.error(new TomlError("Can't redefine existing key"));
42235
42463
  }
42236
42464
 
@@ -42310,7 +42538,7 @@ function prettyError(err, buf) {
42310
42538
  var parseString_1 = parseString;
42311
42539
 
42312
42540
  function parseString(str) {
42313
- if (commonjsGlobal.Buffer && commonjsGlobal.Buffer.isBuffer(str)) {
42541
+ if (global.Buffer && global.Buffer.isBuffer(str)) {
42314
42542
  str = str.toString('utf8');
42315
42543
  }
42316
42544
 
@@ -42319,8 +42547,8 @@ function parseString(str) {
42319
42547
  try {
42320
42548
  parser.parse(str);
42321
42549
  return parser.finish();
42322
- } catch (ex) {
42323
- throw parsePrettyError(ex, str);
42550
+ } catch (err) {
42551
+ throw parsePrettyError(err, str);
42324
42552
  }
42325
42553
  }
42326
42554
 
@@ -42498,7 +42726,8 @@ var resolveConfig_1 = createCommonjsModule(function (module) {
42498
42726
  var patternList = [].concat(patterns);
42499
42727
  var excludedPatternList = [].concat(excludedPatterns || []);
42500
42728
  var opts = {
42501
- matchBase: true
42729
+ matchBase: true,
42730
+ dot: true
42502
42731
  };
42503
42732
  return patternList.some(function (pattern) {
42504
42733
  return minimatch_1(filePath, pattern, opts);