prettier 1.17.0 → 1.18.2
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/bin-prettier.js +524 -286
- package/doc.js +61 -12
- package/index.js +533 -295
- package/package.json +1 -1
- package/parser-babylon.js +1 -1
- package/parser-flow.js +1 -1
- package/parser-glimmer.js +1 -1
- package/parser-typescript.js +1 -1
- package/standalone.js +431 -238
- package/third-party.js +34 -3
package/bin-prettier.js
CHANGED
|
@@ -14,7 +14,7 @@ var thirdParty__default = thirdParty['default'];
|
|
|
14
14
|
var readline = _interopDefault(require('readline'));
|
|
15
15
|
|
|
16
16
|
var name = "prettier";
|
|
17
|
-
var version$1 = "1.
|
|
17
|
+
var version$1 = "1.18.2";
|
|
18
18
|
var description = "Prettier is an opinionated code formatter";
|
|
19
19
|
var bin = {
|
|
20
20
|
"prettier": "./bin/prettier.js"
|
|
@@ -31,8 +31,8 @@ var dependencies = {
|
|
|
31
31
|
"@angular/compiler": "7.2.9",
|
|
32
32
|
"@babel/code-frame": "7.0.0",
|
|
33
33
|
"@babel/parser": "7.2.0",
|
|
34
|
-
"@glimmer/syntax": "0.
|
|
35
|
-
"@iarna/toml": "2.
|
|
34
|
+
"@glimmer/syntax": "0.38.4",
|
|
35
|
+
"@iarna/toml": "2.2.3",
|
|
36
36
|
"@typescript-eslint/typescript-estree": "1.6.0",
|
|
37
37
|
"angular-estree-parser": "1.1.5",
|
|
38
38
|
"angular-html-parser": "1.2.0",
|
|
@@ -110,7 +110,7 @@ var devDependencies = {
|
|
|
110
110
|
"jest-snapshot-serializer-raw": "1.1.0",
|
|
111
111
|
"jest-watch-typeahead": "0.1.0",
|
|
112
112
|
"mkdirp": "0.5.1",
|
|
113
|
-
"prettier": "1.
|
|
113
|
+
"prettier": "1.18.0",
|
|
114
114
|
"prettylint": "1.0.0",
|
|
115
115
|
"rimraf": "2.6.2",
|
|
116
116
|
"rollup": "0.47.6",
|
|
@@ -178,10 +178,6 @@ var _package$1 = Object.freeze({
|
|
|
178
178
|
default: _package
|
|
179
179
|
});
|
|
180
180
|
|
|
181
|
-
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
181
|
function unwrapExports (x) {
|
|
186
182
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
187
183
|
}
|
|
@@ -11568,7 +11564,7 @@ function printString(raw, options, isDirectiveLiteral) {
|
|
|
11568
11564
|
// sure that we consistently output the minimum amount of escaped quotes.
|
|
11569
11565
|
|
|
11570
11566
|
|
|
11571
|
-
return makeString(rawContent, enclosingQuote, !(options.parser === "css" || options.parser === "less" || options.parser === "scss" || options.
|
|
11567
|
+
return makeString(rawContent, enclosingQuote, !(options.parser === "css" || options.parser === "less" || options.parser === "scss" || options.embeddedInHtml));
|
|
11572
11568
|
}
|
|
11573
11569
|
|
|
11574
11570
|
function makeString(rawContent, enclosingQuote, unescapeUnnecessaryEscapes) {
|
|
@@ -11624,6 +11620,53 @@ function getMaxContinuousCount(str, target) {
|
|
|
11624
11620
|
}, 0);
|
|
11625
11621
|
}
|
|
11626
11622
|
|
|
11623
|
+
function getMinNotPresentContinuousCount(str, target) {
|
|
11624
|
+
var matches = str.match(new RegExp(`(${escapeStringRegexp(target)})+`, "g"));
|
|
11625
|
+
|
|
11626
|
+
if (matches === null) {
|
|
11627
|
+
return 0;
|
|
11628
|
+
}
|
|
11629
|
+
|
|
11630
|
+
var countPresent = new Map();
|
|
11631
|
+
var max = 0;
|
|
11632
|
+
var _iteratorNormalCompletion = true;
|
|
11633
|
+
var _didIteratorError = false;
|
|
11634
|
+
var _iteratorError = undefined;
|
|
11635
|
+
|
|
11636
|
+
try {
|
|
11637
|
+
for (var _iterator = matches[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
11638
|
+
var match = _step.value;
|
|
11639
|
+
var count = match.length / target.length;
|
|
11640
|
+
countPresent.set(count, true);
|
|
11641
|
+
|
|
11642
|
+
if (count > max) {
|
|
11643
|
+
max = count;
|
|
11644
|
+
}
|
|
11645
|
+
}
|
|
11646
|
+
} catch (err) {
|
|
11647
|
+
_didIteratorError = true;
|
|
11648
|
+
_iteratorError = err;
|
|
11649
|
+
} finally {
|
|
11650
|
+
try {
|
|
11651
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
11652
|
+
_iterator.return();
|
|
11653
|
+
}
|
|
11654
|
+
} finally {
|
|
11655
|
+
if (_didIteratorError) {
|
|
11656
|
+
throw _iteratorError;
|
|
11657
|
+
}
|
|
11658
|
+
}
|
|
11659
|
+
}
|
|
11660
|
+
|
|
11661
|
+
for (var i = 1; i < max; i++) {
|
|
11662
|
+
if (!countPresent.get(i)) {
|
|
11663
|
+
return i;
|
|
11664
|
+
}
|
|
11665
|
+
}
|
|
11666
|
+
|
|
11667
|
+
return max + 1;
|
|
11668
|
+
}
|
|
11669
|
+
|
|
11627
11670
|
function getStringWidth$1(text) {
|
|
11628
11671
|
if (!text) {
|
|
11629
11672
|
return 0;
|
|
@@ -11714,13 +11757,13 @@ function isWithinParentArrayProperty(path$$1, propertyName) {
|
|
|
11714
11757
|
|
|
11715
11758
|
function replaceEndOfLineWith(text, replacement) {
|
|
11716
11759
|
var parts = [];
|
|
11717
|
-
var
|
|
11718
|
-
var
|
|
11719
|
-
var
|
|
11760
|
+
var _iteratorNormalCompletion2 = true;
|
|
11761
|
+
var _didIteratorError2 = false;
|
|
11762
|
+
var _iteratorError2 = undefined;
|
|
11720
11763
|
|
|
11721
11764
|
try {
|
|
11722
|
-
for (var
|
|
11723
|
-
var part =
|
|
11765
|
+
for (var _iterator2 = text.split("\n")[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
11766
|
+
var part = _step2.value;
|
|
11724
11767
|
|
|
11725
11768
|
if (parts.length !== 0) {
|
|
11726
11769
|
parts.push(replacement);
|
|
@@ -11729,16 +11772,16 @@ function replaceEndOfLineWith(text, replacement) {
|
|
|
11729
11772
|
parts.push(part);
|
|
11730
11773
|
}
|
|
11731
11774
|
} catch (err) {
|
|
11732
|
-
|
|
11733
|
-
|
|
11775
|
+
_didIteratorError2 = true;
|
|
11776
|
+
_iteratorError2 = err;
|
|
11734
11777
|
} finally {
|
|
11735
11778
|
try {
|
|
11736
|
-
if (!
|
|
11737
|
-
|
|
11779
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
11780
|
+
_iterator2.return();
|
|
11738
11781
|
}
|
|
11739
11782
|
} finally {
|
|
11740
|
-
if (
|
|
11741
|
-
throw
|
|
11783
|
+
if (_didIteratorError2) {
|
|
11784
|
+
throw _iteratorError2;
|
|
11742
11785
|
}
|
|
11743
11786
|
}
|
|
11744
11787
|
}
|
|
@@ -11750,6 +11793,7 @@ var util$1 = {
|
|
|
11750
11793
|
replaceEndOfLineWith,
|
|
11751
11794
|
getStringWidth: getStringWidth$1,
|
|
11752
11795
|
getMaxContinuousCount,
|
|
11796
|
+
getMinNotPresentContinuousCount,
|
|
11753
11797
|
getPrecedence,
|
|
11754
11798
|
shouldFlatten,
|
|
11755
11799
|
isBitwiseOperator,
|
|
@@ -12640,6 +12684,7 @@ var docUtils = {
|
|
|
12640
12684
|
willBreak,
|
|
12641
12685
|
isLineNext,
|
|
12642
12686
|
traverseDoc,
|
|
12687
|
+
findInDoc,
|
|
12643
12688
|
mapDoc: mapDoc$1,
|
|
12644
12689
|
propagateBreaks,
|
|
12645
12690
|
removeLines,
|
|
@@ -13451,6 +13496,7 @@ function printSubtree(path$$1, print, options$$1, printAstToDoc) {
|
|
|
13451
13496
|
function textToDoc(text, partialNextOptions, parentOptions, printAstToDoc) {
|
|
13452
13497
|
var nextOptions = normalize$3(Object.assign({}, parentOptions, partialNextOptions, {
|
|
13453
13498
|
parentParser: parentOptions.parser,
|
|
13499
|
+
embeddedInHtml: !!(parentOptions.embeddedInHtml || parentOptions.parser === "html" || parentOptions.parser === "vue" || parentOptions.parser === "angular" || parentOptions.parser === "lwc"),
|
|
13454
13500
|
originalText: text
|
|
13455
13501
|
}), {
|
|
13456
13502
|
passThrough: true
|
|
@@ -13518,7 +13564,7 @@ function printAstToDoc(ast, options) {
|
|
|
13518
13564
|
|
|
13519
13565
|
var res;
|
|
13520
13566
|
|
|
13521
|
-
if (printer.willPrintOwnComments && printer.willPrintOwnComments(path$$1)) {
|
|
13567
|
+
if (printer.willPrintOwnComments && printer.willPrintOwnComments(path$$1, options)) {
|
|
13522
13568
|
res = callPluginPrintFunction(path$$1, options, printGenerically, args);
|
|
13523
13569
|
} else {
|
|
13524
13570
|
// printComments will call the plugin print function and check for
|
|
@@ -13965,7 +14011,6 @@ function formatRange(text, opts) {
|
|
|
13965
14011
|
var rangeResult = coreFormat(rangeString, Object.assign({}, opts, {
|
|
13966
14012
|
rangeStart: 0,
|
|
13967
14013
|
rangeEnd: Infinity,
|
|
13968
|
-
printWidth: opts.printWidth - alignmentSize,
|
|
13969
14014
|
// track the cursor offset only if it's within our range
|
|
13970
14015
|
cursorOffset: opts.cursorOffset >= rangeStart && opts.cursorOffset < rangeEnd ? opts.cursorOffset - rangeStart : -1
|
|
13971
14016
|
}), alignmentSize); // Since the range contracts to avoid trailing whitespace,
|
|
@@ -14755,7 +14800,7 @@ var lodash_uniqby = createCommonjsModule(function (module, exports) {
|
|
|
14755
14800
|
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;
|
|
14756
14801
|
/** Detect free variable `global` from Node.js. */
|
|
14757
14802
|
|
|
14758
|
-
var freeGlobal = typeof
|
|
14803
|
+
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
|
14759
14804
|
/** Detect free variable `self`. */
|
|
14760
14805
|
|
|
14761
14806
|
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
@@ -17208,7 +17253,7 @@ var REJECTED = 'rejected';
|
|
|
17208
17253
|
|
|
17209
17254
|
var NOOP = function NOOP() {};
|
|
17210
17255
|
|
|
17211
|
-
var isNode = typeof
|
|
17256
|
+
var isNode = typeof global !== 'undefined' && typeof global.process !== 'undefined' && typeof global.process.emit === 'function';
|
|
17212
17257
|
var asyncSetTimer = typeof setImmediate === 'undefined' ? setTimeout : setImmediate;
|
|
17213
17258
|
var asyncQueue = [];
|
|
17214
17259
|
var asyncTimer;
|
|
@@ -17356,12 +17401,12 @@ function publishRejection(promise) {
|
|
|
17356
17401
|
publish(promise);
|
|
17357
17402
|
|
|
17358
17403
|
if (!promise._handled && isNode) {
|
|
17359
|
-
|
|
17404
|
+
global.process.emit('unhandledRejection', promise._data, promise);
|
|
17360
17405
|
}
|
|
17361
17406
|
}
|
|
17362
17407
|
|
|
17363
17408
|
function notifyRejectionHandled(promise) {
|
|
17364
|
-
|
|
17409
|
+
global.process.emit('rejectionHandled', promise);
|
|
17365
17410
|
}
|
|
17366
17411
|
/**
|
|
17367
17412
|
* @class
|
|
@@ -17540,7 +17585,7 @@ var arrayUniq = createCommonjsModule(function (module) {
|
|
|
17540
17585
|
return ret === true;
|
|
17541
17586
|
}
|
|
17542
17587
|
|
|
17543
|
-
if ('Set' in
|
|
17588
|
+
if ('Set' in global) {
|
|
17544
17589
|
if (typeof Set.prototype.forEach === 'function' && doesForEachActuallyWork()) {
|
|
17545
17590
|
module.exports = uniqSetWithForEach;
|
|
17546
17591
|
} else {
|
|
@@ -21683,7 +21728,7 @@ function handleCommentInEmptyParens(text, enclosingNode, comment, options) {
|
|
|
21683
21728
|
// i.e. a function without any argument.
|
|
21684
21729
|
|
|
21685
21730
|
|
|
21686
|
-
if (enclosingNode && ((enclosingNode.type === "FunctionDeclaration" || enclosingNode.type === "FunctionExpression" || enclosingNode.type === "ArrowFunctionExpression"
|
|
21731
|
+
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)) {
|
|
21687
21732
|
addDanglingComment$2(enclosingNode, comment);
|
|
21688
21733
|
return true;
|
|
21689
21734
|
}
|
|
@@ -21913,9 +21958,7 @@ var _require$$1$utils = doc.utils;
|
|
|
21913
21958
|
var mapDoc$3 = _require$$1$utils.mapDoc;
|
|
21914
21959
|
var stripTrailingHardline$1 = _require$$1$utils.stripTrailingHardline;
|
|
21915
21960
|
|
|
21916
|
-
function embed(path$$1, print, textToDoc
|
|
21917
|
-
/*, options */
|
|
21918
|
-
) {
|
|
21961
|
+
function embed(path$$1, print, textToDoc, options) {
|
|
21919
21962
|
var node = path$$1.getValue();
|
|
21920
21963
|
var parent = path$$1.getParentNode();
|
|
21921
21964
|
var parentParent = path$$1.getParentNode(1);
|
|
@@ -22021,12 +22064,10 @@ function embed(path$$1, print, textToDoc
|
|
|
22021
22064
|
return concat$5(["`", indent$3(concat$5([hardline$4, join$3(hardline$4, parts)])), hardline$4, "`"]);
|
|
22022
22065
|
}
|
|
22023
22066
|
|
|
22024
|
-
|
|
22025
|
-
return printHtmlTemplateLiteral(path$$1, print, textToDoc, "html");
|
|
22026
|
-
}
|
|
22067
|
+
var htmlParser = isHtml(path$$1) ? "html" : isAngularComponentTemplate(path$$1) ? "angular" : undefined;
|
|
22027
22068
|
|
|
22028
|
-
if (
|
|
22029
|
-
return printHtmlTemplateLiteral(path$$1, print, textToDoc,
|
|
22069
|
+
if (htmlParser) {
|
|
22070
|
+
return printHtmlTemplateLiteral(path$$1, print, textToDoc, htmlParser, options.embeddedInHtml);
|
|
22030
22071
|
}
|
|
22031
22072
|
|
|
22032
22073
|
break;
|
|
@@ -22066,6 +22107,10 @@ function getIndentation(str) {
|
|
|
22066
22107
|
return firstMatchedIndent === null ? "" : firstMatchedIndent[1];
|
|
22067
22108
|
}
|
|
22068
22109
|
|
|
22110
|
+
function uncook(cookedValue) {
|
|
22111
|
+
return cookedValue.replace(/([\\`]|\$\{)/g, "\\$1");
|
|
22112
|
+
}
|
|
22113
|
+
|
|
22069
22114
|
function escapeTemplateCharacters(doc$$2, raw) {
|
|
22070
22115
|
return mapDoc$3(doc$$2, function (currentDoc) {
|
|
22071
22116
|
if (!currentDoc.parts) {
|
|
@@ -22075,7 +22120,7 @@ function escapeTemplateCharacters(doc$$2, raw) {
|
|
|
22075
22120
|
var parts = [];
|
|
22076
22121
|
currentDoc.parts.forEach(function (part) {
|
|
22077
22122
|
if (typeof part === "string") {
|
|
22078
|
-
parts.push(raw ? part.replace(/(\\*)`/g, "$1$1\\`") : part
|
|
22123
|
+
parts.push(raw ? part.replace(/(\\*)`/g, "$1$1\\`") : uncook(part));
|
|
22079
22124
|
} else {
|
|
22080
22125
|
parts.push(part);
|
|
22081
22126
|
}
|
|
@@ -22186,8 +22231,11 @@ function printGraphqlComments(lines) {
|
|
|
22186
22231
|
return parts.length === 0 ? null : join$3(hardline$4, parts);
|
|
22187
22232
|
}
|
|
22188
22233
|
/**
|
|
22189
|
-
* Template literal in
|
|
22234
|
+
* Template literal in these contexts:
|
|
22190
22235
|
* <style jsx>{`div{color:red}`}</style>
|
|
22236
|
+
* css``
|
|
22237
|
+
* css.global``
|
|
22238
|
+
* css.resolve``
|
|
22191
22239
|
*/
|
|
22192
22240
|
|
|
22193
22241
|
|
|
@@ -22197,7 +22245,7 @@ function isStyledJsx(path$$1) {
|
|
|
22197
22245
|
var parentParent = path$$1.getParentNode(1);
|
|
22198
22246
|
return parentParent && node.quasis && parent.type === "JSXExpressionContainer" && parentParent.type === "JSXElement" && parentParent.openingElement.name.name === "style" && parentParent.openingElement.attributes.some(function (attribute) {
|
|
22199
22247
|
return attribute.name.name === "jsx";
|
|
22200
|
-
});
|
|
22248
|
+
}) || 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");
|
|
22201
22249
|
}
|
|
22202
22250
|
/**
|
|
22203
22251
|
* Angular Components can have:
|
|
@@ -22265,9 +22313,9 @@ function isStyledComponents(path$$1) {
|
|
|
22265
22313
|
|
|
22266
22314
|
case "CallExpression":
|
|
22267
22315
|
return (// styled(Component)``
|
|
22268
|
-
isStyledIdentifier(tag.callee) || tag.callee.type === "MemberExpression" && (tag.callee.object.type === "MemberExpression" && ( // styled.foo.
|
|
22269
|
-
isStyledIdentifier(tag.callee.object.object) || // Component.extend.
|
|
22270
|
-
isStyledExtend(tag.callee.object)) || // styled(Component).
|
|
22316
|
+
isStyledIdentifier(tag.callee) || tag.callee.type === "MemberExpression" && (tag.callee.object.type === "MemberExpression" && ( // styled.foo.attrs({})``
|
|
22317
|
+
isStyledIdentifier(tag.callee.object.object) || // Component.extend.attrs({})``
|
|
22318
|
+
isStyledExtend(tag.callee.object)) || // styled(Component).attrs({})``
|
|
22271
22319
|
tag.callee.object.type === "CallExpression" && isStyledIdentifier(tag.callee.object.callee))
|
|
22272
22320
|
);
|
|
22273
22321
|
|
|
@@ -22385,16 +22433,22 @@ function isHtml(path$$1) {
|
|
|
22385
22433
|
}, function (node, name) {
|
|
22386
22434
|
return node.type === "TaggedTemplateExpression" && node.tag.type === "Identifier" && node.tag.name === "html" && name === "quasi";
|
|
22387
22435
|
}]);
|
|
22388
|
-
}
|
|
22436
|
+
} // The counter is needed to distinguish nested embeds.
|
|
22437
|
+
|
|
22438
|
+
|
|
22439
|
+
var htmlTemplateLiteralCounter = 0;
|
|
22389
22440
|
|
|
22390
|
-
function printHtmlTemplateLiteral(path$$1, print, textToDoc, parser) {
|
|
22441
|
+
function printHtmlTemplateLiteral(path$$1, print, textToDoc, parser, escapeClosingScriptTag) {
|
|
22391
22442
|
var node = path$$1.getValue();
|
|
22392
|
-
var
|
|
22393
|
-
|
|
22394
|
-
|
|
22395
|
-
|
|
22443
|
+
var counter = htmlTemplateLiteralCounter;
|
|
22444
|
+
htmlTemplateLiteralCounter = htmlTemplateLiteralCounter + 1 >>> 0;
|
|
22445
|
+
|
|
22446
|
+
var composePlaceholder = function composePlaceholder(index) {
|
|
22447
|
+
return `PRETTIER_HTML_PLACEHOLDER_${index}_${counter}_IN_JS`;
|
|
22448
|
+
};
|
|
22449
|
+
|
|
22396
22450
|
var text = node.quasis.map(function (quasi, index, quasis) {
|
|
22397
|
-
return index === quasis.length - 1 ? quasi.value.
|
|
22451
|
+
return index === quasis.length - 1 ? quasi.value.cooked : quasi.value.cooked + composePlaceholder(index);
|
|
22398
22452
|
}).join("");
|
|
22399
22453
|
var expressionDocs = path$$1.map(print, "expressions");
|
|
22400
22454
|
|
|
@@ -22402,13 +22456,11 @@ function printHtmlTemplateLiteral(path$$1, print, textToDoc, parser) {
|
|
|
22402
22456
|
return "``";
|
|
22403
22457
|
}
|
|
22404
22458
|
|
|
22459
|
+
var placeholderRegex = RegExp(composePlaceholder("(\\d+)"), "g");
|
|
22405
22460
|
var contentDoc = mapDoc$3(stripTrailingHardline$1(textToDoc(text, {
|
|
22406
22461
|
parser
|
|
22407
22462
|
})), function (doc$$2) {
|
|
22408
|
-
|
|
22409
|
-
var hasPlaceholder = typeof doc$$2 === "string" && placeholderRegex.test(doc$$2);
|
|
22410
|
-
|
|
22411
|
-
if (!hasPlaceholder) {
|
|
22463
|
+
if (typeof doc$$2 !== "string") {
|
|
22412
22464
|
return doc$$2;
|
|
22413
22465
|
}
|
|
22414
22466
|
|
|
@@ -22420,6 +22472,12 @@ function printHtmlTemplateLiteral(path$$1, print, textToDoc, parser) {
|
|
|
22420
22472
|
|
|
22421
22473
|
if (i % 2 === 0) {
|
|
22422
22474
|
if (component) {
|
|
22475
|
+
component = uncook(component);
|
|
22476
|
+
|
|
22477
|
+
if (escapeClosingScriptTag) {
|
|
22478
|
+
component = component.replace(/<\/(script)\b/gi, "<\\/$1");
|
|
22479
|
+
}
|
|
22480
|
+
|
|
22423
22481
|
parts.push(component);
|
|
22424
22482
|
}
|
|
22425
22483
|
|
|
@@ -22819,35 +22877,97 @@ function hasNode$1(node, fn) {
|
|
|
22819
22877
|
});
|
|
22820
22878
|
}
|
|
22821
22879
|
|
|
22880
|
+
function hasNakedLeftSide$2(node) {
|
|
22881
|
+
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";
|
|
22882
|
+
}
|
|
22883
|
+
|
|
22884
|
+
function getLeftSide$1(node) {
|
|
22885
|
+
if (node.expressions) {
|
|
22886
|
+
return node.expressions[0];
|
|
22887
|
+
}
|
|
22888
|
+
|
|
22889
|
+
return node.left || node.test || node.callee || node.object || node.tag || node.argument || node.expression;
|
|
22890
|
+
}
|
|
22891
|
+
|
|
22892
|
+
function getLeftSidePathName$2(path$$1, node) {
|
|
22893
|
+
if (node.expressions) {
|
|
22894
|
+
return ["expressions", 0];
|
|
22895
|
+
}
|
|
22896
|
+
|
|
22897
|
+
if (node.left) {
|
|
22898
|
+
return ["left"];
|
|
22899
|
+
}
|
|
22900
|
+
|
|
22901
|
+
if (node.test) {
|
|
22902
|
+
return ["test"];
|
|
22903
|
+
}
|
|
22904
|
+
|
|
22905
|
+
if (node.object) {
|
|
22906
|
+
return ["object"];
|
|
22907
|
+
}
|
|
22908
|
+
|
|
22909
|
+
if (node.callee) {
|
|
22910
|
+
return ["callee"];
|
|
22911
|
+
}
|
|
22912
|
+
|
|
22913
|
+
if (node.tag) {
|
|
22914
|
+
return ["tag"];
|
|
22915
|
+
}
|
|
22916
|
+
|
|
22917
|
+
if (node.argument) {
|
|
22918
|
+
return ["argument"];
|
|
22919
|
+
}
|
|
22920
|
+
|
|
22921
|
+
if (node.expression) {
|
|
22922
|
+
return ["expression"];
|
|
22923
|
+
}
|
|
22924
|
+
|
|
22925
|
+
throw new Error("Unexpected node has no left side", node);
|
|
22926
|
+
}
|
|
22927
|
+
|
|
22822
22928
|
var utils$4 = {
|
|
22929
|
+
getLeftSide: getLeftSide$1,
|
|
22930
|
+
getLeftSidePathName: getLeftSidePathName$2,
|
|
22931
|
+
hasNakedLeftSide: hasNakedLeftSide$2,
|
|
22823
22932
|
hasNode: hasNode$1,
|
|
22824
22933
|
hasFlowShorthandAnnotationComment: hasFlowShorthandAnnotationComment$2,
|
|
22825
22934
|
hasFlowAnnotationComment: hasFlowAnnotationComment$1
|
|
22826
22935
|
};
|
|
22827
22936
|
|
|
22937
|
+
var getLeftSidePathName$1 = utils$4.getLeftSidePathName;
|
|
22938
|
+
var hasNakedLeftSide$1 = utils$4.hasNakedLeftSide;
|
|
22828
22939
|
var hasFlowShorthandAnnotationComment$1 = utils$4.hasFlowShorthandAnnotationComment;
|
|
22829
22940
|
|
|
22830
|
-
function hasClosureCompilerTypeCastComment(text, path$$1
|
|
22941
|
+
function hasClosureCompilerTypeCastComment(text, path$$1) {
|
|
22831
22942
|
// https://github.com/google/closure-compiler/wiki/Annotating-Types#type-casts
|
|
22832
22943
|
// Syntax example: var x = /** @type {string} */ (fruit);
|
|
22833
22944
|
var n = path$$1.getValue();
|
|
22834
|
-
return
|
|
22945
|
+
return isParenthesized(n) && (hasTypeCastComment(n) || hasAncestorTypeCastComment(0)); // for sub-item: /** @type {array} */ (numberOrString).map(x => x);
|
|
22835
22946
|
|
|
22836
22947
|
function hasAncestorTypeCastComment(index) {
|
|
22837
22948
|
var ancestor = path$$1.getParentNode(index);
|
|
22838
|
-
return ancestor &&
|
|
22949
|
+
return ancestor && !isParenthesized(ancestor) ? hasTypeCastComment(ancestor) || hasAncestorTypeCastComment(index + 1) : false;
|
|
22839
22950
|
}
|
|
22840
22951
|
|
|
22841
22952
|
function hasTypeCastComment(node) {
|
|
22842
22953
|
return node.comments && node.comments.some(function (comment) {
|
|
22843
|
-
return comment.leading && comments$3.isBlockComment(comment) && isTypeCastComment(comment.value)
|
|
22954
|
+
return comment.leading && comments$3.isBlockComment(comment) && isTypeCastComment(comment.value);
|
|
22844
22955
|
});
|
|
22845
22956
|
}
|
|
22846
22957
|
|
|
22958
|
+
function isParenthesized(node) {
|
|
22959
|
+
// Closure typecast comments only really make sense when _not_ using
|
|
22960
|
+
// typescript or flow parsers, so we take advantage of the babel parser's
|
|
22961
|
+
// parenthesized expressions.
|
|
22962
|
+
return node.extra && node.extra.parenthesized;
|
|
22963
|
+
}
|
|
22964
|
+
|
|
22847
22965
|
function isTypeCastComment(comment) {
|
|
22848
|
-
var
|
|
22966
|
+
var cleaned = comment.trim().split("\n").map(function (line) {
|
|
22967
|
+
return line.replace(/^[\s*]+/, "");
|
|
22968
|
+
}).join(" ").trim();
|
|
22849
22969
|
|
|
22850
|
-
if (
|
|
22970
|
+
if (!/^@type\s*\{[^]+\}$/.test(cleaned)) {
|
|
22851
22971
|
return false;
|
|
22852
22972
|
}
|
|
22853
22973
|
|
|
@@ -22858,7 +22978,7 @@ function hasClosureCompilerTypeCastComment(text, path$$1, locStart, locEnd) {
|
|
|
22858
22978
|
var _iteratorError = undefined;
|
|
22859
22979
|
|
|
22860
22980
|
try {
|
|
22861
|
-
for (var _iterator =
|
|
22981
|
+
for (var _iterator = cleaned[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
22862
22982
|
var char = _step.value;
|
|
22863
22983
|
|
|
22864
22984
|
if (char === "{") {
|
|
@@ -22926,7 +23046,7 @@ function needsParens(path$$1, options) {
|
|
|
22926
23046
|
// parentheses.
|
|
22927
23047
|
|
|
22928
23048
|
|
|
22929
|
-
if (hasClosureCompilerTypeCastComment(options.originalText, path$$1
|
|
23049
|
+
if (hasClosureCompilerTypeCastComment(options.originalText, path$$1)) {
|
|
22930
23050
|
return true;
|
|
22931
23051
|
}
|
|
22932
23052
|
|
|
@@ -22939,6 +23059,15 @@ function needsParens(path$$1, options) {
|
|
|
22939
23059
|
|
|
22940
23060
|
|
|
22941
23061
|
if (node.type === "Identifier") {
|
|
23062
|
+
// ...unless those identifiers are embed placeholders. They might be substituted by complex
|
|
23063
|
+
// expressions, so the parens around them should not be dropped. Example (JS-in-HTML-in-JS):
|
|
23064
|
+
// let tpl = html`<script> f((${expr}) / 2); </script>`;
|
|
23065
|
+
// If the inner JS formatter removes the parens, the expression might change its meaning:
|
|
23066
|
+
// f((a + b) / 2) vs f(a + b / 2)
|
|
23067
|
+
if (node.extra && node.extra.parenthesized && /^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(node.name)) {
|
|
23068
|
+
return true;
|
|
23069
|
+
}
|
|
23070
|
+
|
|
22942
23071
|
return false;
|
|
22943
23072
|
}
|
|
22944
23073
|
|
|
@@ -22950,6 +23079,13 @@ function needsParens(path$$1, options) {
|
|
|
22950
23079
|
|
|
22951
23080
|
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")) {
|
|
22952
23081
|
return true;
|
|
23082
|
+
} // `export default function` or `export default class` can't be followed by
|
|
23083
|
+
// anything after. So an expression like `export default (function(){}).toString()`
|
|
23084
|
+
// needs to be followed by a parentheses
|
|
23085
|
+
|
|
23086
|
+
|
|
23087
|
+
if (parent.type === "ExportDefaultDeclaration") {
|
|
23088
|
+
return shouldWrapFunctionForExportDefault(path$$1, options);
|
|
22953
23089
|
}
|
|
22954
23090
|
|
|
22955
23091
|
if (parent.type === "Decorator" && parent.expression === node) {
|
|
@@ -23001,9 +23137,11 @@ function needsParens(path$$1, options) {
|
|
|
23001
23137
|
case "CallExpression":
|
|
23002
23138
|
{
|
|
23003
23139
|
var firstParentNotMemberExpression = parent;
|
|
23004
|
-
var i = 0;
|
|
23140
|
+
var i = 0; // tagged templates are basically member expressions from a grammar perspective
|
|
23141
|
+
// see https://tc39.github.io/ecma262/#prod-MemberExpression
|
|
23142
|
+
// so are typescript's non-null assertions, though there's no grammar to point to
|
|
23005
23143
|
|
|
23006
|
-
while (firstParentNotMemberExpression && firstParentNotMemberExpression.type === "MemberExpression") {
|
|
23144
|
+
while (firstParentNotMemberExpression && (firstParentNotMemberExpression.type === "MemberExpression" && firstParentNotMemberExpression.object === path$$1.getParentNode(i - 1) || firstParentNotMemberExpression.type === "TaggedTemplateExpression" || firstParentNotMemberExpression.type === "TSNonNullExpression")) {
|
|
23007
23145
|
firstParentNotMemberExpression = path$$1.getParentNode(++i);
|
|
23008
23146
|
}
|
|
23009
23147
|
|
|
@@ -23107,6 +23245,7 @@ function needsParens(path$$1, options) {
|
|
|
23107
23245
|
case "TSTypeAssertion":
|
|
23108
23246
|
case "TaggedTemplateExpression":
|
|
23109
23247
|
case "UnaryExpression":
|
|
23248
|
+
case "JSXSpreadAttribute":
|
|
23110
23249
|
case "SpreadElement":
|
|
23111
23250
|
case "SpreadProperty":
|
|
23112
23251
|
case "BindExpression":
|
|
@@ -23186,7 +23325,7 @@ function needsParens(path$$1, options) {
|
|
|
23186
23325
|
} // Delegate to inner TSParenthesizedType
|
|
23187
23326
|
|
|
23188
23327
|
|
|
23189
|
-
if (node.typeAnnotation.type === "TSParenthesizedType") {
|
|
23328
|
+
if (node.typeAnnotation.type === "TSParenthesizedType" && parent.type !== "TSArrayType") {
|
|
23190
23329
|
return false;
|
|
23191
23330
|
}
|
|
23192
23331
|
|
|
@@ -23237,6 +23376,7 @@ function needsParens(path$$1, options) {
|
|
|
23237
23376
|
case "TSAsExpression":
|
|
23238
23377
|
case "TSNonNullExpression":
|
|
23239
23378
|
case "BindExpression":
|
|
23379
|
+
case "OptionalMemberExpression":
|
|
23240
23380
|
return true;
|
|
23241
23381
|
|
|
23242
23382
|
case "MemberExpression":
|
|
@@ -23359,9 +23499,6 @@ function needsParens(path$$1, options) {
|
|
|
23359
23499
|
return true;
|
|
23360
23500
|
// This is basically a kind of IIFE.
|
|
23361
23501
|
|
|
23362
|
-
case "ExportDefaultDeclaration":
|
|
23363
|
-
return true;
|
|
23364
|
-
|
|
23365
23502
|
default:
|
|
23366
23503
|
return false;
|
|
23367
23504
|
}
|
|
@@ -23396,9 +23533,6 @@ function needsParens(path$$1, options) {
|
|
|
23396
23533
|
|
|
23397
23534
|
case "ClassExpression":
|
|
23398
23535
|
switch (parent.type) {
|
|
23399
|
-
case "ExportDefaultDeclaration":
|
|
23400
|
-
return true;
|
|
23401
|
-
|
|
23402
23536
|
case "NewExpression":
|
|
23403
23537
|
return name === "callee" && parent.callee === node;
|
|
23404
23538
|
|
|
@@ -23429,7 +23563,7 @@ function needsParens(path$$1, options) {
|
|
|
23429
23563
|
return false;
|
|
23430
23564
|
|
|
23431
23565
|
case "BindExpression":
|
|
23432
|
-
if (parent.type === "BindExpression" && name === "callee" && parent.callee === node || parent.type === "MemberExpression") {
|
|
23566
|
+
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) {
|
|
23433
23567
|
return true;
|
|
23434
23568
|
}
|
|
23435
23569
|
|
|
@@ -23511,6 +23645,26 @@ function isFollowedByRightBracket(path$$1) {
|
|
|
23511
23645
|
return false;
|
|
23512
23646
|
}
|
|
23513
23647
|
|
|
23648
|
+
function shouldWrapFunctionForExportDefault(path$$1, options) {
|
|
23649
|
+
var node = path$$1.getValue();
|
|
23650
|
+
var parent = path$$1.getParentNode();
|
|
23651
|
+
|
|
23652
|
+
if (node.type === "FunctionExpression" || node.type === "ClassExpression") {
|
|
23653
|
+
return parent.type === "ExportDefaultDeclaration" || // in some cases the function is already wrapped
|
|
23654
|
+
// (e.g. `export default (function() {})();`)
|
|
23655
|
+
// in this case we don't need to add extra parens
|
|
23656
|
+
!needsParens(path$$1, options);
|
|
23657
|
+
}
|
|
23658
|
+
|
|
23659
|
+
if (!hasNakedLeftSide$1(node) || parent.type !== "ExportDefaultDeclaration" && needsParens(path$$1, options)) {
|
|
23660
|
+
return false;
|
|
23661
|
+
}
|
|
23662
|
+
|
|
23663
|
+
return path$$1.call.apply(path$$1, [function (childPath) {
|
|
23664
|
+
return shouldWrapFunctionForExportDefault(childPath, options);
|
|
23665
|
+
}].concat(getLeftSidePathName$1(path$$1, node)));
|
|
23666
|
+
}
|
|
23667
|
+
|
|
23514
23668
|
var needsParens_1 = needsParens;
|
|
23515
23669
|
|
|
23516
23670
|
var _require$$0$builders$1 = doc.builders;
|
|
@@ -23616,6 +23770,9 @@ var isIdentifierName = utils$2.keyword.isIdentifierNameES5;
|
|
|
23616
23770
|
var insertPragma = pragma.insertPragma;
|
|
23617
23771
|
var printHtmlBinding = htmlBinding.printHtmlBinding;
|
|
23618
23772
|
var isVueEventBindingExpression = htmlBinding.isVueEventBindingExpression;
|
|
23773
|
+
var getLeftSide = utils$4.getLeftSide;
|
|
23774
|
+
var getLeftSidePathName = utils$4.getLeftSidePathName;
|
|
23775
|
+
var hasNakedLeftSide = utils$4.hasNakedLeftSide;
|
|
23619
23776
|
var hasNode = utils$4.hasNode;
|
|
23620
23777
|
var hasFlowAnnotationComment = utils$4.hasFlowAnnotationComment;
|
|
23621
23778
|
var hasFlowShorthandAnnotationComment = utils$4.hasFlowShorthandAnnotationComment;
|
|
@@ -25190,85 +25347,23 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25190
25347
|
var expressions = path$$1.map(print, "expressions");
|
|
25191
25348
|
|
|
25192
25349
|
var _parentNode = path$$1.getParentNode();
|
|
25193
|
-
/**
|
|
25194
|
-
* describe.each`table`(name, fn)
|
|
25195
|
-
* describe.only.each`table`(name, fn)
|
|
25196
|
-
* describe.skip.each`table`(name, fn)
|
|
25197
|
-
* test.each`table`(name, fn)
|
|
25198
|
-
* test.only.each`table`(name, fn)
|
|
25199
|
-
* test.skip.each`table`(name, fn)
|
|
25200
|
-
*
|
|
25201
|
-
* Ref: https://github.com/facebook/jest/pull/6102
|
|
25202
|
-
*/
|
|
25203
|
-
|
|
25204
25350
|
|
|
25205
|
-
|
|
25351
|
+
if (isJestEachTemplateLiteral(n, _parentNode)) {
|
|
25352
|
+
var _printed2 = printJestEachTemplateLiteral(n, expressions, options);
|
|
25206
25353
|
|
|
25207
|
-
|
|
25208
|
-
|
|
25209
|
-
|
|
25210
|
-
|
|
25211
|
-
* ${1} | ${2} | ${3}
|
|
25212
|
-
* ${2} | ${1} | ${3}
|
|
25213
|
-
*/
|
|
25214
|
-
var headerNames = n.quasis[0].value.raw.trim().split(/\s*\|\s*/);
|
|
25215
|
-
|
|
25216
|
-
if (headerNames.length > 1 || headerNames.some(function (headerName) {
|
|
25217
|
-
return headerName.length !== 0;
|
|
25218
|
-
})) {
|
|
25219
|
-
var stringifiedExpressions = expressions.map(function (doc$$2) {
|
|
25220
|
-
return "${" + printDocToString$2(doc$$2, Object.assign({}, options, {
|
|
25221
|
-
printWidth: Infinity,
|
|
25222
|
-
endOfLine: "lf"
|
|
25223
|
-
})).formatted + "}";
|
|
25224
|
-
});
|
|
25225
|
-
var tableBody = [{
|
|
25226
|
-
hasLineBreak: false,
|
|
25227
|
-
cells: []
|
|
25228
|
-
}];
|
|
25229
|
-
|
|
25230
|
-
for (var _i = 1; _i < n.quasis.length; _i++) {
|
|
25231
|
-
var row = tableBody[tableBody.length - 1];
|
|
25232
|
-
var correspondingExpression = stringifiedExpressions[_i - 1];
|
|
25233
|
-
row.cells.push(correspondingExpression);
|
|
25234
|
-
|
|
25235
|
-
if (correspondingExpression.indexOf("\n") !== -1) {
|
|
25236
|
-
row.hasLineBreak = true;
|
|
25237
|
-
}
|
|
25354
|
+
if (_printed2) {
|
|
25355
|
+
return _printed2;
|
|
25356
|
+
}
|
|
25357
|
+
}
|
|
25238
25358
|
|
|
25239
|
-
|
|
25240
|
-
tableBody.push({
|
|
25241
|
-
hasLineBreak: false,
|
|
25242
|
-
cells: []
|
|
25243
|
-
});
|
|
25244
|
-
}
|
|
25245
|
-
}
|
|
25359
|
+
var isSimple = isSimpleTemplateLiteral(n);
|
|
25246
25360
|
|
|
25247
|
-
|
|
25248
|
-
|
|
25249
|
-
},
|
|
25250
|
-
|
|
25251
|
-
|
|
25252
|
-
|
|
25253
|
-
var table = [{
|
|
25254
|
-
cells: headerNames
|
|
25255
|
-
}].concat(tableBody.filter(function (row) {
|
|
25256
|
-
return row.cells.length !== 0;
|
|
25257
|
-
}));
|
|
25258
|
-
table.filter(function (row) {
|
|
25259
|
-
return !row.hasLineBreak;
|
|
25260
|
-
}).forEach(function (row) {
|
|
25261
|
-
row.cells.forEach(function (cell, index) {
|
|
25262
|
-
maxColumnWidths[index] = Math.max(maxColumnWidths[index], getStringWidth$2(cell));
|
|
25263
|
-
});
|
|
25264
|
-
});
|
|
25265
|
-
parts.push("`", indent$2(concat$4([hardline$3, join$2(hardline$3, table.map(function (row) {
|
|
25266
|
-
return join$2(" | ", row.cells.map(function (cell, index) {
|
|
25267
|
-
return row.hasLineBreak ? cell : cell + " ".repeat(maxColumnWidths[index] - getStringWidth$2(cell));
|
|
25268
|
-
}));
|
|
25269
|
-
}))])), hardline$3, "`");
|
|
25270
|
-
return concat$4(parts);
|
|
25271
|
-
}
|
|
25361
|
+
if (isSimple) {
|
|
25362
|
+
expressions = expressions.map(function (doc$$2) {
|
|
25363
|
+
return printDocToString$2(doc$$2, Object.assign({}, options, {
|
|
25364
|
+
printWidth: Infinity
|
|
25365
|
+
})).formatted;
|
|
25366
|
+
});
|
|
25272
25367
|
}
|
|
25273
25368
|
|
|
25274
25369
|
parts.push("`");
|
|
@@ -25291,13 +25386,17 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25291
25386
|
var tabWidth = options.tabWidth;
|
|
25292
25387
|
var quasi = childPath.getValue();
|
|
25293
25388
|
var indentSize = getIndentSize$1(quasi.value.raw, tabWidth);
|
|
25294
|
-
var
|
|
25389
|
+
var _printed3 = expressions[i];
|
|
25295
25390
|
|
|
25296
|
-
if (
|
|
25297
|
-
|
|
25391
|
+
if (!isSimple) {
|
|
25392
|
+
// Breaks at the template element boundaries (${ and }) are preferred to breaking
|
|
25393
|
+
// in the middle of a MemberExpression
|
|
25394
|
+
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") {
|
|
25395
|
+
_printed3 = concat$4([indent$2(concat$4([softline$1, _printed3])), softline$1]);
|
|
25396
|
+
}
|
|
25298
25397
|
}
|
|
25299
25398
|
|
|
25300
|
-
var aligned = indentSize === 0 && quasi.value.raw.endsWith("\n") ? align$1(-Infinity,
|
|
25399
|
+
var aligned = indentSize === 0 && quasi.value.raw.endsWith("\n") ? align$1(-Infinity, _printed3) : addAlignmentToDoc$2(_printed3, indentSize, tabWidth);
|
|
25301
25400
|
parts.push(group$1(concat$4(["${", aligned, lineSuffixBoundary$1, "}"])));
|
|
25302
25401
|
}
|
|
25303
25402
|
}, "quasis");
|
|
@@ -25344,8 +25443,7 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25344
25443
|
case "TupleTypeAnnotation":
|
|
25345
25444
|
{
|
|
25346
25445
|
var typesField = n.type === "TSTupleType" ? "elementTypes" : "types";
|
|
25347
|
-
return group$1(concat$4(["[", indent$2(concat$4([softline$1, printArrayItems(path$$1, options, typesField, print)])),
|
|
25348
|
-
n.type === "TSTupleType" ? "" : ifBreak$1(shouldPrintComma(options) ? "," : ""), comments.printDanglingComments(path$$1, options,
|
|
25446
|
+
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,
|
|
25349
25447
|
/* sameIndent */
|
|
25350
25448
|
true), softline$1, "]"]));
|
|
25351
25449
|
}
|
|
@@ -25513,22 +25611,22 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25513
25611
|
var result = [];
|
|
25514
25612
|
var wasIndented = false;
|
|
25515
25613
|
|
|
25516
|
-
for (var
|
|
25517
|
-
if (
|
|
25518
|
-
result.push(types[
|
|
25519
|
-
} else if (isObjectType(n.types[
|
|
25614
|
+
for (var _i = 0; _i < types.length; ++_i) {
|
|
25615
|
+
if (_i === 0) {
|
|
25616
|
+
result.push(types[_i]);
|
|
25617
|
+
} else if (isObjectType(n.types[_i - 1]) && isObjectType(n.types[_i])) {
|
|
25520
25618
|
// If both are objects, don't indent
|
|
25521
|
-
result.push(concat$4([" & ", wasIndented ? indent$2(types[
|
|
25522
|
-
} else if (!isObjectType(n.types[
|
|
25619
|
+
result.push(concat$4([" & ", wasIndented ? indent$2(types[_i]) : types[_i]]));
|
|
25620
|
+
} else if (!isObjectType(n.types[_i - 1]) && !isObjectType(n.types[_i])) {
|
|
25523
25621
|
// If no object is involved, go to the next line if it breaks
|
|
25524
|
-
result.push(indent$2(concat$4([" &", line$3, types[
|
|
25622
|
+
result.push(indent$2(concat$4([" &", line$3, types[_i]])));
|
|
25525
25623
|
} else {
|
|
25526
25624
|
// If you go from object to non-object or vis-versa, then inline it
|
|
25527
|
-
if (
|
|
25625
|
+
if (_i > 1) {
|
|
25528
25626
|
wasIndented = true;
|
|
25529
25627
|
}
|
|
25530
25628
|
|
|
25531
|
-
result.push(" & ",
|
|
25629
|
+
result.push(" & ", _i > 1 ? indent$2(types[_i]) : types[_i]);
|
|
25532
25630
|
}
|
|
25533
25631
|
}
|
|
25534
25632
|
|
|
@@ -25557,7 +25655,7 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25557
25655
|
// // comment
|
|
25558
25656
|
// | child2
|
|
25559
25657
|
|
|
25560
|
-
var
|
|
25658
|
+
var _printed4 = path$$1.map(function (typePath) {
|
|
25561
25659
|
var printedType = typePath.call(print);
|
|
25562
25660
|
|
|
25563
25661
|
if (!shouldHug) {
|
|
@@ -25570,11 +25668,11 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25570
25668
|
}, "types");
|
|
25571
25669
|
|
|
25572
25670
|
if (shouldHug) {
|
|
25573
|
-
return join$2(" | ",
|
|
25671
|
+
return join$2(" | ", _printed4);
|
|
25574
25672
|
}
|
|
25575
25673
|
|
|
25576
25674
|
var shouldAddStartLine = shouldIndent && !hasLeadingOwnLineComment(options.originalText, n, options);
|
|
25577
|
-
var code = concat$4([ifBreak$1(concat$4([shouldAddStartLine ? line$3 : "", "| "])), join$2(concat$4([line$3, "| "]),
|
|
25675
|
+
var code = concat$4([ifBreak$1(concat$4([shouldAddStartLine ? line$3 : "", "| "])), join$2(concat$4([line$3, "| "]), _printed4)]);
|
|
25578
25676
|
var hasParens;
|
|
25579
25677
|
|
|
25580
25678
|
if (n.type === "TSUnionType") {
|
|
@@ -25660,9 +25758,9 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25660
25758
|
parts.push("declare ");
|
|
25661
25759
|
}
|
|
25662
25760
|
|
|
25663
|
-
var
|
|
25761
|
+
var _printed5 = printAssignmentRight(n.id, n.right, path$$1.call(print, "right"), options);
|
|
25664
25762
|
|
|
25665
|
-
parts.push("type ", path$$1.call(print, "id"), path$$1.call(print, "typeParameters"), " =",
|
|
25763
|
+
parts.push("type ", path$$1.call(print, "id"), path$$1.call(print, "typeParameters"), " =", _printed5, semi);
|
|
25666
25764
|
return group$1(concat$4(parts));
|
|
25667
25765
|
}
|
|
25668
25766
|
|
|
@@ -25739,6 +25837,15 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25739
25837
|
|
|
25740
25838
|
if (n["default"]) {
|
|
25741
25839
|
parts.push(" = ", path$$1.call(print, "default"));
|
|
25840
|
+
} // Keep comma if the file extension is .tsx and
|
|
25841
|
+
// has one type parameter that isn't extend with any types.
|
|
25842
|
+
// Because, otherwise formatted result will be invalid as tsx.
|
|
25843
|
+
|
|
25844
|
+
|
|
25845
|
+
var _grandParent = path$$1.getNode(2);
|
|
25846
|
+
|
|
25847
|
+
if (_parent9.params && _parent9.params.length === 1 && options.filepath && /\.tsx$/i.test(options.filepath) && !n.constraint && _grandParent.type === "ArrowFunctionExpression") {
|
|
25848
|
+
parts.push(",");
|
|
25742
25849
|
}
|
|
25743
25850
|
|
|
25744
25851
|
return concat$4(parts);
|
|
@@ -25953,9 +26060,15 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25953
26060
|
return concat$4([n.operator, " ", path$$1.call(print, "typeAnnotation")]);
|
|
25954
26061
|
|
|
25955
26062
|
case "TSMappedType":
|
|
25956
|
-
|
|
25957
|
-
|
|
25958
|
-
|
|
26063
|
+
{
|
|
26064
|
+
var _shouldBreak2 = hasNewlineInRange$1(options.originalText, options.locStart(n), options.locEnd(n));
|
|
26065
|
+
|
|
26066
|
+
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,
|
|
26067
|
+
/* sameIndent */
|
|
26068
|
+
true), options.bracketSpacing ? line$3 : softline$1, "}"]), {
|
|
26069
|
+
shouldBreak: _shouldBreak2
|
|
26070
|
+
});
|
|
26071
|
+
}
|
|
25959
26072
|
|
|
25960
26073
|
case "TSMethodSignature":
|
|
25961
26074
|
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,
|
|
@@ -26233,7 +26346,7 @@ function printPropertyKey(path$$1, options, print) {
|
|
|
26233
26346
|
|
|
26234
26347
|
if (options.quoteProps === "consistent" && !needsQuoteProps.has(parent)) {
|
|
26235
26348
|
var objectHasStringProp = (parent.properties || parent.body || parent.members).some(function (prop) {
|
|
26236
|
-
return prop.
|
|
26349
|
+
return !prop.computed && prop.key && isStringLiteral(prop.key) && !isStringPropSafeToCoerceToIdentifier(prop, options);
|
|
26237
26350
|
});
|
|
26238
26351
|
needsQuoteProps.set(parent, objectHasStringProp);
|
|
26239
26352
|
}
|
|
@@ -26248,7 +26361,7 @@ function printPropertyKey(path$$1, options, print) {
|
|
|
26248
26361
|
}, "key");
|
|
26249
26362
|
}
|
|
26250
26363
|
|
|
26251
|
-
if (isStringPropSafeToCoerceToIdentifier(node, options) && (options.quoteProps === "as-needed" || options.quoteProps === "consistent" && !needsQuoteProps.get(parent))) {
|
|
26364
|
+
if (!node.computed && isStringPropSafeToCoerceToIdentifier(node, options) && (options.quoteProps === "as-needed" || options.quoteProps === "consistent" && !needsQuoteProps.get(parent))) {
|
|
26252
26365
|
// 'a' -> a
|
|
26253
26366
|
return path$$1.call(function (keyPath) {
|
|
26254
26367
|
return comments.printComments(keyPath, function () {
|
|
@@ -26303,7 +26416,18 @@ function printMethod(path$$1, options, print) {
|
|
|
26303
26416
|
}
|
|
26304
26417
|
|
|
26305
26418
|
function couldGroupArg(arg) {
|
|
26306
|
-
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" &&
|
|
26419
|
+
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
|
|
26420
|
+
// https://github.com/prettier/prettier/issues/4070
|
|
26421
|
+
// export class Thing implements OtherThing {
|
|
26422
|
+
// do: (type: Type) => Provider<Prop> = memoize(
|
|
26423
|
+
// (type: ObjectType): Provider<Opts> => {}
|
|
26424
|
+
// );
|
|
26425
|
+
// }
|
|
26426
|
+
// https://github.com/prettier/prettier/issues/6099
|
|
26427
|
+
// app.get("/", (req, res): void => {
|
|
26428
|
+
// res.send("Hello World!");
|
|
26429
|
+
// });
|
|
26430
|
+
!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));
|
|
26307
26431
|
}
|
|
26308
26432
|
|
|
26309
26433
|
function shouldGroupLastArg(args) {
|
|
@@ -26329,6 +26453,130 @@ function isSimpleFlowType(node) {
|
|
|
26329
26453
|
return node && flowTypeAnnotations.indexOf(node.type) !== -1 && !(node.type === "GenericTypeAnnotation" && node.typeParameters);
|
|
26330
26454
|
}
|
|
26331
26455
|
|
|
26456
|
+
function isJestEachTemplateLiteral(node, parentNode) {
|
|
26457
|
+
/**
|
|
26458
|
+
* describe.each`table`(name, fn)
|
|
26459
|
+
* describe.only.each`table`(name, fn)
|
|
26460
|
+
* describe.skip.each`table`(name, fn)
|
|
26461
|
+
* test.each`table`(name, fn)
|
|
26462
|
+
* test.only.each`table`(name, fn)
|
|
26463
|
+
* test.skip.each`table`(name, fn)
|
|
26464
|
+
*
|
|
26465
|
+
* Ref: https://github.com/facebook/jest/pull/6102
|
|
26466
|
+
*/
|
|
26467
|
+
var jestEachTriggerRegex = /^[xf]?(describe|it|test)$/;
|
|
26468
|
+
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));
|
|
26469
|
+
}
|
|
26470
|
+
|
|
26471
|
+
function printJestEachTemplateLiteral(node, expressions, options) {
|
|
26472
|
+
/**
|
|
26473
|
+
* a | b | expected
|
|
26474
|
+
* ${1} | ${1} | ${2}
|
|
26475
|
+
* ${1} | ${2} | ${3}
|
|
26476
|
+
* ${2} | ${1} | ${3}
|
|
26477
|
+
*/
|
|
26478
|
+
var headerNames = node.quasis[0].value.raw.trim().split(/\s*\|\s*/);
|
|
26479
|
+
|
|
26480
|
+
if (headerNames.length > 1 || headerNames.some(function (headerName) {
|
|
26481
|
+
return headerName.length !== 0;
|
|
26482
|
+
})) {
|
|
26483
|
+
var parts = [];
|
|
26484
|
+
var stringifiedExpressions = expressions.map(function (doc$$2) {
|
|
26485
|
+
return "${" + printDocToString$2(doc$$2, Object.assign({}, options, {
|
|
26486
|
+
printWidth: Infinity,
|
|
26487
|
+
endOfLine: "lf"
|
|
26488
|
+
})).formatted + "}";
|
|
26489
|
+
});
|
|
26490
|
+
var tableBody = [{
|
|
26491
|
+
hasLineBreak: false,
|
|
26492
|
+
cells: []
|
|
26493
|
+
}];
|
|
26494
|
+
|
|
26495
|
+
for (var i = 1; i < node.quasis.length; i++) {
|
|
26496
|
+
var row = tableBody[tableBody.length - 1];
|
|
26497
|
+
var correspondingExpression = stringifiedExpressions[i - 1];
|
|
26498
|
+
row.cells.push(correspondingExpression);
|
|
26499
|
+
|
|
26500
|
+
if (correspondingExpression.indexOf("\n") !== -1) {
|
|
26501
|
+
row.hasLineBreak = true;
|
|
26502
|
+
}
|
|
26503
|
+
|
|
26504
|
+
if (node.quasis[i].value.raw.indexOf("\n") !== -1) {
|
|
26505
|
+
tableBody.push({
|
|
26506
|
+
hasLineBreak: false,
|
|
26507
|
+
cells: []
|
|
26508
|
+
});
|
|
26509
|
+
}
|
|
26510
|
+
}
|
|
26511
|
+
|
|
26512
|
+
var maxColumnCount = tableBody.reduce(function (maxColumnCount, row) {
|
|
26513
|
+
return Math.max(maxColumnCount, row.cells.length);
|
|
26514
|
+
}, headerNames.length);
|
|
26515
|
+
var maxColumnWidths = Array.from(new Array(maxColumnCount), function () {
|
|
26516
|
+
return 0;
|
|
26517
|
+
});
|
|
26518
|
+
var table = [{
|
|
26519
|
+
cells: headerNames
|
|
26520
|
+
}].concat(tableBody.filter(function (row) {
|
|
26521
|
+
return row.cells.length !== 0;
|
|
26522
|
+
}));
|
|
26523
|
+
table.filter(function (row) {
|
|
26524
|
+
return !row.hasLineBreak;
|
|
26525
|
+
}).forEach(function (row) {
|
|
26526
|
+
row.cells.forEach(function (cell, index) {
|
|
26527
|
+
maxColumnWidths[index] = Math.max(maxColumnWidths[index], getStringWidth$2(cell));
|
|
26528
|
+
});
|
|
26529
|
+
});
|
|
26530
|
+
parts.push("`", indent$2(concat$4([hardline$3, join$2(hardline$3, table.map(function (row) {
|
|
26531
|
+
return join$2(" | ", row.cells.map(function (cell, index) {
|
|
26532
|
+
return row.hasLineBreak ? cell : cell + " ".repeat(maxColumnWidths[index] - getStringWidth$2(cell));
|
|
26533
|
+
}));
|
|
26534
|
+
}))])), hardline$3, "`");
|
|
26535
|
+
return concat$4(parts);
|
|
26536
|
+
}
|
|
26537
|
+
}
|
|
26538
|
+
/** @param node {import("estree").TemplateLiteral} */
|
|
26539
|
+
|
|
26540
|
+
|
|
26541
|
+
function isSimpleTemplateLiteral(node) {
|
|
26542
|
+
if (node.expressions.length === 0) {
|
|
26543
|
+
return false;
|
|
26544
|
+
}
|
|
26545
|
+
|
|
26546
|
+
return node.expressions.every(function (expr) {
|
|
26547
|
+
// Disallow comments since printDocToString can't print them here
|
|
26548
|
+
if (expr.comments) {
|
|
26549
|
+
return false;
|
|
26550
|
+
} // Allow `x` and `this`
|
|
26551
|
+
|
|
26552
|
+
|
|
26553
|
+
if (expr.type === "Identifier" || expr.type === "ThisExpression") {
|
|
26554
|
+
return true;
|
|
26555
|
+
} // Allow `a.b.c`, `a.b[c]`, and `this.x.y`
|
|
26556
|
+
|
|
26557
|
+
|
|
26558
|
+
if ((expr.type === "MemberExpression" || expr.type === "OptionalMemberExpression") && (expr.property.type === "Identifier" || expr.property.type === "Literal")) {
|
|
26559
|
+
var ancestor = expr;
|
|
26560
|
+
|
|
26561
|
+
while (ancestor.type === "MemberExpression" || ancestor.type === "OptionalMemberExpression") {
|
|
26562
|
+
ancestor = ancestor.object;
|
|
26563
|
+
|
|
26564
|
+
if (ancestor.comments) {
|
|
26565
|
+
return false;
|
|
26566
|
+
}
|
|
26567
|
+
}
|
|
26568
|
+
|
|
26569
|
+
if (ancestor.type === "Identifier" || ancestor.type === "ThisExpression") {
|
|
26570
|
+
return true;
|
|
26571
|
+
}
|
|
26572
|
+
|
|
26573
|
+
return false;
|
|
26574
|
+
}
|
|
26575
|
+
|
|
26576
|
+
return false;
|
|
26577
|
+
});
|
|
26578
|
+
}
|
|
26579
|
+
|
|
26332
26580
|
var functionCompositionFunctionNames = new Set(["pipe", // RxJS, Ramda
|
|
26333
26581
|
"pipeP", // Ramda
|
|
26334
26582
|
"pipeK", // Ramda
|
|
@@ -27464,11 +27712,10 @@ function printJSXChildren(path$$1, options, print, jsxWhitespace, isFacebookTran
|
|
|
27464
27712
|
|
|
27465
27713
|
|
|
27466
27714
|
function printJSXElement(path$$1, options, print) {
|
|
27467
|
-
var n = path$$1.getValue();
|
|
27715
|
+
var n = path$$1.getValue();
|
|
27468
27716
|
|
|
27469
27717
|
if (n.type === "JSXElement" && isEmptyJSXElement(n)) {
|
|
27470
|
-
|
|
27471
|
-
return path$$1.call(print, "openingElement");
|
|
27718
|
+
return concat$4([path$$1.call(print, "openingElement"), path$$1.call(print, "closingElement")]);
|
|
27472
27719
|
}
|
|
27473
27720
|
|
|
27474
27721
|
var openingLines = n.type === "JSXElement" ? path$$1.call(print, "openingElement") : path$$1.call(print, "openingFragment");
|
|
@@ -27710,7 +27957,7 @@ function printAssignmentRight(leftNode, rightNode, printedRight, options) {
|
|
|
27710
27957
|
}
|
|
27711
27958
|
|
|
27712
27959
|
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
|
|
27713
|
-
options.parser !== "json" && options.parser !== "json5";
|
|
27960
|
+
options.parser !== "json" && options.parser !== "json5" || rightNode.type === "SequenceExpression";
|
|
27714
27961
|
|
|
27715
27962
|
if (canBreak) {
|
|
27716
27963
|
return group$1(indent$2(concat$4([line$3, printedRight])));
|
|
@@ -27788,60 +28035,12 @@ function hasLeadingOwnLineComment(text, node, options) {
|
|
|
27788
28035
|
return res;
|
|
27789
28036
|
}
|
|
27790
28037
|
|
|
27791
|
-
function hasNakedLeftSide(node) {
|
|
27792
|
-
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";
|
|
27793
|
-
}
|
|
27794
|
-
|
|
27795
28038
|
function isFlowAnnotationComment(text, typeAnnotation, options) {
|
|
27796
28039
|
var start = options.locStart(typeAnnotation);
|
|
27797
28040
|
var end = skipWhitespace$1(text, options.locEnd(typeAnnotation));
|
|
27798
28041
|
return text.substr(start, 2) === "/*" && text.substr(end, 2) === "*/";
|
|
27799
28042
|
}
|
|
27800
28043
|
|
|
27801
|
-
function getLeftSide(node) {
|
|
27802
|
-
if (node.expressions) {
|
|
27803
|
-
return node.expressions[0];
|
|
27804
|
-
}
|
|
27805
|
-
|
|
27806
|
-
return node.left || node.test || node.callee || node.object || node.tag || node.argument || node.expression;
|
|
27807
|
-
}
|
|
27808
|
-
|
|
27809
|
-
function getLeftSidePathName(path$$1, node) {
|
|
27810
|
-
if (node.expressions) {
|
|
27811
|
-
return ["expressions", 0];
|
|
27812
|
-
}
|
|
27813
|
-
|
|
27814
|
-
if (node.left) {
|
|
27815
|
-
return ["left"];
|
|
27816
|
-
}
|
|
27817
|
-
|
|
27818
|
-
if (node.test) {
|
|
27819
|
-
return ["test"];
|
|
27820
|
-
}
|
|
27821
|
-
|
|
27822
|
-
if (node.object) {
|
|
27823
|
-
return ["object"];
|
|
27824
|
-
}
|
|
27825
|
-
|
|
27826
|
-
if (node.callee) {
|
|
27827
|
-
return ["callee"];
|
|
27828
|
-
}
|
|
27829
|
-
|
|
27830
|
-
if (node.tag) {
|
|
27831
|
-
return ["tag"];
|
|
27832
|
-
}
|
|
27833
|
-
|
|
27834
|
-
if (node.argument) {
|
|
27835
|
-
return ["argument"];
|
|
27836
|
-
}
|
|
27837
|
-
|
|
27838
|
-
if (node.expression) {
|
|
27839
|
-
return ["expression"];
|
|
27840
|
-
}
|
|
27841
|
-
|
|
27842
|
-
throw new Error("Unexpected node has no left side", node);
|
|
27843
|
-
}
|
|
27844
|
-
|
|
27845
28044
|
function exprNeedsASIProtection(path$$1, options) {
|
|
27846
28045
|
var node = path$$1.getValue();
|
|
27847
28046
|
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;
|
|
@@ -28084,7 +28283,7 @@ function isLiteral(node) {
|
|
|
28084
28283
|
}
|
|
28085
28284
|
|
|
28086
28285
|
function isStringPropSafeToCoerceToIdentifier(node, options) {
|
|
28087
|
-
return isStringLiteral(node.key) && isIdentifierName(node.key.value) &&
|
|
28286
|
+
return isStringLiteral(node.key) && isIdentifierName(node.key.value) && options.parser !== "json" && !(options.parser === "typescript" && node.type === "ClassProperty");
|
|
28088
28287
|
}
|
|
28089
28288
|
|
|
28090
28289
|
function isNumericLiteral(node) {
|
|
@@ -28170,7 +28369,9 @@ function isTheOnlyJSXElementInMarkdown(options, path$$1) {
|
|
|
28170
28369
|
return parent.type === "Program" && parent.body.length == 1;
|
|
28171
28370
|
}
|
|
28172
28371
|
|
|
28173
|
-
function willPrintOwnComments(path$$1
|
|
28372
|
+
function willPrintOwnComments(path$$1
|
|
28373
|
+
/*, options */
|
|
28374
|
+
) {
|
|
28174
28375
|
var node = path$$1.getValue();
|
|
28175
28376
|
var parent = path$$1.getParentNode();
|
|
28176
28377
|
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);
|
|
@@ -30205,33 +30406,21 @@ function print(path$$1, options, print) {
|
|
|
30205
30406
|
var isGlimmerComponent = tagFirstChar.toUpperCase() === tagFirstChar || isLocal;
|
|
30206
30407
|
var hasChildren = n.children.length > 0;
|
|
30207
30408
|
var isVoid = isGlimmerComponent && !hasChildren || voidTags.indexOf(n.tag) !== -1;
|
|
30208
|
-
var
|
|
30409
|
+
var closeTagForNoBreak = isVoid ? concat$10([" />", softline$4]) : ">";
|
|
30410
|
+
var closeTagForBreak = isVoid ? "/>" : ">";
|
|
30209
30411
|
|
|
30210
30412
|
var _getParams = function _getParams(path$$1, print) {
|
|
30211
30413
|
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"))]));
|
|
30212
|
-
};
|
|
30213
|
-
// would not break but I need to force an indent, so I use a hardline.
|
|
30214
|
-
|
|
30215
|
-
/**
|
|
30216
|
-
* What happens now:
|
|
30217
|
-
* <div>
|
|
30218
|
-
* Hello
|
|
30219
|
-
* </div>
|
|
30220
|
-
* ==>
|
|
30221
|
-
* <div>Hello</div>
|
|
30222
|
-
* This is due to me using hasChildren to decide to put the hardline in.
|
|
30223
|
-
* I would rather use a {DOES THE WHOLE THING NEED TO BREAK}
|
|
30224
|
-
*/
|
|
30225
|
-
|
|
30414
|
+
};
|
|
30226
30415
|
|
|
30227
|
-
return concat$10([group$10(concat$10(["<", n.tag, _getParams(path$$1, print), n.blockParams.length ? ` as |${n.blockParams.join(" ")}|` : "", ifBreak$3(softline$4, ""),
|
|
30416
|
+
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, ">"]) : ""]))]);
|
|
30228
30417
|
}
|
|
30229
30418
|
|
|
30230
30419
|
case "BlockStatement":
|
|
30231
30420
|
{
|
|
30232
30421
|
var pp = path$$1.getParentNode(1);
|
|
30233
|
-
var isElseIf = pp && pp.inverse && pp.inverse.body[0] === n && pp.inverse.body[0].path.parts[0] === "if";
|
|
30234
|
-
var hasElseIf = n.inverse && n.inverse.body
|
|
30422
|
+
var isElseIf = pp && pp.inverse && pp.inverse.body.length === 1 && pp.inverse.body[0] === n && pp.inverse.body[0].path.parts[0] === "if";
|
|
30423
|
+
var hasElseIf = n.inverse && n.inverse.body.length === 1 && n.inverse.body[0].type === "BlockStatement" && n.inverse.body[0].path.parts[0] === "if";
|
|
30235
30424
|
var indentElse = hasElseIf ? function (a) {
|
|
30236
30425
|
return a;
|
|
30237
30426
|
} : indent$6;
|
|
@@ -31540,9 +31729,9 @@ function genericPrint$4(path$$1, options, print) {
|
|
|
31540
31729
|
|
|
31541
31730
|
case "inlineCode":
|
|
31542
31731
|
{
|
|
31543
|
-
var backtickCount = util$1.
|
|
31732
|
+
var backtickCount = util$1.getMinNotPresentContinuousCount(node.value, "`");
|
|
31544
31733
|
|
|
31545
|
-
var _style = backtickCount
|
|
31734
|
+
var _style = "`".repeat(backtickCount || 1);
|
|
31546
31735
|
|
|
31547
31736
|
var gap = backtickCount ? " " : "";
|
|
31548
31737
|
return concat$12([_style, gap, node.value, gap, _style]);
|
|
@@ -33619,7 +33808,7 @@ var parseSrcset = createCommonjsModule(function (module) {
|
|
|
33619
33808
|
// Browser globals (root is window)
|
|
33620
33809
|
root.parseSrcset = factory();
|
|
33621
33810
|
}
|
|
33622
|
-
})(
|
|
33811
|
+
})(this, function () {
|
|
33623
33812
|
// 1. Let input be the value passed to this algorithm.
|
|
33624
33813
|
return function (input, options) {
|
|
33625
33814
|
var logger = options && options.logger || console; // UTILITY FUNCTIONS
|
|
@@ -34069,7 +34258,7 @@ function embed$6(path$$1, print, textToDoc, options) {
|
|
|
34069
34258
|
} // lit-html: html`<my-element obj=${obj}></my-element>`
|
|
34070
34259
|
|
|
34071
34260
|
|
|
34072
|
-
if (/^PRETTIER_HTML_PLACEHOLDER_\d+_IN_JS$/.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
|
|
34261
|
+
if (/^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
|
|
34073
34262
|
return concat$14([node.rawName, "=", node.value]);
|
|
34074
34263
|
} // lwc: html`<my-element data-for={value}></my-elememt>`
|
|
34075
34264
|
|
|
@@ -39306,7 +39495,7 @@ var fnmatch = createCommonjsModule(function (module, exports) {
|
|
|
39306
39495
|
var ini = createCommonjsModule(function (module, exports) {
|
|
39307
39496
|
"use strict"; // Based on iniparser by shockie <https://npmjs.org/package/iniparser>
|
|
39308
39497
|
|
|
39309
|
-
var __awaiter =
|
|
39498
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
39310
39499
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39311
39500
|
function fulfilled(value) {
|
|
39312
39501
|
try {
|
|
@@ -39334,7 +39523,7 @@ var ini = createCommonjsModule(function (module, exports) {
|
|
|
39334
39523
|
});
|
|
39335
39524
|
};
|
|
39336
39525
|
|
|
39337
|
-
var __generator =
|
|
39526
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
39338
39527
|
var _ = {
|
|
39339
39528
|
label: 0,
|
|
39340
39529
|
sent: function sent() {
|
|
@@ -39445,7 +39634,7 @@ var ini = createCommonjsModule(function (module, exports) {
|
|
|
39445
39634
|
}
|
|
39446
39635
|
};
|
|
39447
39636
|
|
|
39448
|
-
var __importStar =
|
|
39637
|
+
var __importStar = this && this.__importStar || function (mod) {
|
|
39449
39638
|
if (mod && mod.__esModule) return mod;
|
|
39450
39639
|
var result = {};
|
|
39451
39640
|
if (mod != null) for (var k in mod) {
|
|
@@ -39624,7 +39813,7 @@ var require$$4$6 = ( _package$3 && _package$2 ) || _package$3;
|
|
|
39624
39813
|
var src$2 = createCommonjsModule(function (module, exports) {
|
|
39625
39814
|
"use strict";
|
|
39626
39815
|
|
|
39627
|
-
var __awaiter =
|
|
39816
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
39628
39817
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39629
39818
|
function fulfilled(value) {
|
|
39630
39819
|
try {
|
|
@@ -39652,7 +39841,7 @@ var src$2 = createCommonjsModule(function (module, exports) {
|
|
|
39652
39841
|
});
|
|
39653
39842
|
};
|
|
39654
39843
|
|
|
39655
|
-
var __generator =
|
|
39844
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
39656
39845
|
var _ = {
|
|
39657
39846
|
label: 0,
|
|
39658
39847
|
sent: function sent() {
|
|
@@ -39763,7 +39952,7 @@ var src$2 = createCommonjsModule(function (module, exports) {
|
|
|
39763
39952
|
}
|
|
39764
39953
|
};
|
|
39765
39954
|
|
|
39766
|
-
var __importStar =
|
|
39955
|
+
var __importStar = this && this.__importStar || function (mod) {
|
|
39767
39956
|
if (mod && mod.__esModule) return mod;
|
|
39768
39957
|
var result = {};
|
|
39769
39958
|
if (mod != null) for (var k in mod) {
|
|
@@ -39773,7 +39962,7 @@ var src$2 = createCommonjsModule(function (module, exports) {
|
|
|
39773
39962
|
return result;
|
|
39774
39963
|
};
|
|
39775
39964
|
|
|
39776
|
-
var __importDefault =
|
|
39965
|
+
var __importDefault = this && this.__importDefault || function (mod) {
|
|
39777
39966
|
return mod && mod.__esModule ? mod : {
|
|
39778
39967
|
"default": mod
|
|
39779
39968
|
};
|
|
@@ -40235,6 +40424,7 @@ function (_Error) {
|
|
|
40235
40424
|
_classCallCheck(this, ParserError);
|
|
40236
40425
|
|
|
40237
40426
|
_this = _possibleConstructorReturn(this, _getPrototypeOf(ParserError).call(this, '[ParserError] ' + msg, filename, linenumber));
|
|
40427
|
+
_this.name = 'ParserError';
|
|
40238
40428
|
_this.code = 'ParserError';
|
|
40239
40429
|
if (Error.captureStackTrace) Error.captureStackTrace(_assertThisInitialized(_assertThisInitialized(_this)), ParserError);
|
|
40240
40430
|
return _this;
|
|
@@ -40358,7 +40548,7 @@ function () {
|
|
|
40358
40548
|
key: "return",
|
|
40359
40549
|
value: function _return(value) {
|
|
40360
40550
|
/* istanbul ignore next */
|
|
40361
|
-
if (
|
|
40551
|
+
if (this.stack.length === 0) throw this.error(new ParserError('Stack underflow'));
|
|
40362
40552
|
if (value === undefined) value = this.state.buf;
|
|
40363
40553
|
this.state = this.stack.pop();
|
|
40364
40554
|
this.state.returned = value;
|
|
@@ -40474,7 +40664,7 @@ var createDatetimeFloat = createCommonjsModule(function (module) {
|
|
|
40474
40664
|
var createDate = createCommonjsModule(function (module) {
|
|
40475
40665
|
'use strict';
|
|
40476
40666
|
|
|
40477
|
-
var DateTime =
|
|
40667
|
+
var DateTime = global.Date;
|
|
40478
40668
|
|
|
40479
40669
|
var Date =
|
|
40480
40670
|
/*#__PURE__*/
|
|
@@ -40571,6 +40761,7 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
40571
40761
|
_classCallCheck(this, TomlError);
|
|
40572
40762
|
|
|
40573
40763
|
_this = _possibleConstructorReturn(this, _getPrototypeOf(TomlError).call(this, msg));
|
|
40764
|
+
_this.name = 'TomlError';
|
|
40574
40765
|
/* istanbul ignore next */
|
|
40575
40766
|
|
|
40576
40767
|
if (Error.captureStackTrace) Error.captureStackTrace(_assertThisInitialized(_assertThisInitialized(_this)), TomlError);
|
|
@@ -40639,13 +40830,13 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
40639
40830
|
var SURROGATE_FIRST = 0xD800;
|
|
40640
40831
|
var SURROGATE_LAST = 0xDFFF;
|
|
40641
40832
|
var escapes = {
|
|
40642
|
-
[CHAR_b]: '\
|
|
40643
|
-
[CHAR_t]: '\
|
|
40644
|
-
[CHAR_n]: '\
|
|
40645
|
-
[CHAR_f]: '\
|
|
40646
|
-
[CHAR_r]: '\
|
|
40647
|
-
[CHAR_QUOT]: '\
|
|
40648
|
-
[CHAR_BSOL]: '\
|
|
40833
|
+
[CHAR_b]: '\u0008',
|
|
40834
|
+
[CHAR_t]: '\u0009',
|
|
40835
|
+
[CHAR_n]: '\u000A',
|
|
40836
|
+
[CHAR_f]: '\u000C',
|
|
40837
|
+
[CHAR_r]: '\u000D',
|
|
40838
|
+
[CHAR_QUOT]: '\u0022',
|
|
40839
|
+
[CHAR_BSOL]: '\u005C'
|
|
40649
40840
|
};
|
|
40650
40841
|
|
|
40651
40842
|
function isDigit(cp) {
|
|
@@ -40676,6 +40867,21 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
40676
40867
|
|
|
40677
40868
|
var _declared = Symbol('declared');
|
|
40678
40869
|
|
|
40870
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
40871
|
+
var defineProperty = Object.defineProperty;
|
|
40872
|
+
var descriptor = {
|
|
40873
|
+
configurable: true,
|
|
40874
|
+
enumerable: true,
|
|
40875
|
+
writable: true,
|
|
40876
|
+
value: undefined
|
|
40877
|
+
};
|
|
40878
|
+
|
|
40879
|
+
function hasKey(obj, key) {
|
|
40880
|
+
if (hasOwnProperty.call(obj, key)) return true;
|
|
40881
|
+
if (key === '__proto__') defineProperty(obj, '__proto__', descriptor);
|
|
40882
|
+
return false;
|
|
40883
|
+
}
|
|
40884
|
+
|
|
40679
40885
|
var INLINE_TABLE = Symbol('inline-table');
|
|
40680
40886
|
|
|
40681
40887
|
function InlineTable() {
|
|
@@ -40746,10 +40952,18 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
40746
40952
|
} // in an eval, to let bundlers not slurp in a util proxy
|
|
40747
40953
|
|
|
40748
40954
|
|
|
40749
|
-
var
|
|
40955
|
+
var _custom;
|
|
40956
|
+
|
|
40957
|
+
try {
|
|
40958
|
+
var utilInspect = eval("require('util').inspect");
|
|
40959
|
+
_custom = utilInspect.custom;
|
|
40960
|
+
} catch (_) {}
|
|
40961
|
+
/* eval require not available in transpiled bundle */
|
|
40962
|
+
|
|
40750
40963
|
/* istanbul ignore next */
|
|
40751
40964
|
|
|
40752
|
-
|
|
40965
|
+
|
|
40966
|
+
var _inspect = _custom || 'inspect';
|
|
40753
40967
|
|
|
40754
40968
|
var BoxedBigInt =
|
|
40755
40969
|
/*#__PURE__*/
|
|
@@ -40758,7 +40972,7 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
40758
40972
|
_classCallCheck(this, BoxedBigInt);
|
|
40759
40973
|
|
|
40760
40974
|
try {
|
|
40761
|
-
this.value =
|
|
40975
|
+
this.value = global.BigInt.asIntN(64, value);
|
|
40762
40976
|
} catch (_) {
|
|
40763
40977
|
/* istanbul ignore next */
|
|
40764
40978
|
this.value = null;
|
|
@@ -40806,7 +41020,7 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
40806
41020
|
if (Object.is(num, -0)) num = 0;
|
|
40807
41021
|
/* istanbul ignore else */
|
|
40808
41022
|
|
|
40809
|
-
if (
|
|
41023
|
+
if (global.BigInt && !Number.isSafeInteger(num)) {
|
|
40810
41024
|
return new BoxedBigInt(_value);
|
|
40811
41025
|
} else {
|
|
40812
41026
|
/* istanbul ignore next */
|
|
@@ -40973,7 +41187,7 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
40973
41187
|
for (var _iterator = kv.key[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
40974
41188
|
var kw = _step.value;
|
|
40975
41189
|
|
|
40976
|
-
if (kw
|
|
41190
|
+
if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
|
|
40977
41191
|
throw this.error(new TomlError("Can't redefine existing key"));
|
|
40978
41192
|
}
|
|
40979
41193
|
|
|
@@ -40994,7 +41208,7 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
40994
41208
|
}
|
|
40995
41209
|
}
|
|
40996
41210
|
|
|
40997
|
-
if (finalKey
|
|
41211
|
+
if (hasKey(target, finalKey)) {
|
|
40998
41212
|
throw this.error(new TomlError("Can't redefine existing key"));
|
|
40999
41213
|
} // unbox our numbers
|
|
41000
41214
|
|
|
@@ -41112,7 +41326,7 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
41112
41326
|
if (this.char === CHAR_SP || this.char === CTRL_I) {
|
|
41113
41327
|
return null;
|
|
41114
41328
|
} else if (this.char === CHAR_RSQB) {
|
|
41115
|
-
if (
|
|
41329
|
+
if (hasKey(this.ctx, keyword) && (!isTable(this.ctx[keyword]) || this.ctx[keyword][_declared])) {
|
|
41116
41330
|
throw this.error(new TomlError("Can't redefine existing key"));
|
|
41117
41331
|
} else {
|
|
41118
41332
|
this.ctx = this.ctx[keyword] = this.ctx[keyword] || Table();
|
|
@@ -41121,7 +41335,7 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
41121
41335
|
|
|
41122
41336
|
return this.next(this.parseWhitespaceToEOL);
|
|
41123
41337
|
} else if (this.char === CHAR_PERIOD) {
|
|
41124
|
-
if (!(
|
|
41338
|
+
if (!hasKey(this.ctx, keyword)) {
|
|
41125
41339
|
this.ctx = this.ctx[keyword] = Table();
|
|
41126
41340
|
} else if (isTable(this.ctx[keyword])) {
|
|
41127
41341
|
this.ctx = this.ctx[keyword];
|
|
@@ -41159,7 +41373,7 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
41159
41373
|
if (this.char === CHAR_SP || this.char === CTRL_I) {
|
|
41160
41374
|
return null;
|
|
41161
41375
|
} else if (this.char === CHAR_RSQB) {
|
|
41162
|
-
if (!(
|
|
41376
|
+
if (!hasKey(this.ctx, keyword)) {
|
|
41163
41377
|
this.ctx[keyword] = List();
|
|
41164
41378
|
}
|
|
41165
41379
|
|
|
@@ -41175,7 +41389,7 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
41175
41389
|
|
|
41176
41390
|
return this.next(this.parseListEnd);
|
|
41177
41391
|
} else if (this.char === CHAR_PERIOD) {
|
|
41178
|
-
if (!(
|
|
41392
|
+
if (!hasKey(this.ctx, keyword)) {
|
|
41179
41393
|
this.ctx = this.ctx[keyword] = Table();
|
|
41180
41394
|
} else if (isInlineList(this.ctx[keyword])) {
|
|
41181
41395
|
throw this.error(new TomlError("Can't extend an inline array"));
|
|
@@ -41555,8 +41769,8 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
41555
41769
|
}
|
|
41556
41770
|
|
|
41557
41771
|
return this.returnNow(String.fromCodePoint(codePoint));
|
|
41558
|
-
} catch (
|
|
41559
|
-
throw this.error(TomlError.wrap(
|
|
41772
|
+
} catch (err) {
|
|
41773
|
+
throw this.error(TomlError.wrap(err));
|
|
41560
41774
|
}
|
|
41561
41775
|
}
|
|
41562
41776
|
}, {
|
|
@@ -41595,7 +41809,30 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
41595
41809
|
} else if (this.char === CHAR_n) {
|
|
41596
41810
|
return this.next(this.parseNan);
|
|
41597
41811
|
} else {
|
|
41598
|
-
return this.callNow(this.parseNoUnder, this.
|
|
41812
|
+
return this.callNow(this.parseNoUnder, this.parseNumberIntegerStart);
|
|
41813
|
+
}
|
|
41814
|
+
}
|
|
41815
|
+
}, {
|
|
41816
|
+
key: "parseNumberIntegerStart",
|
|
41817
|
+
value: function parseNumberIntegerStart() {
|
|
41818
|
+
if (this.char === CHAR_0) {
|
|
41819
|
+
this.consume();
|
|
41820
|
+
return this.next(this.parseNumberIntegerExponentOrDecimal);
|
|
41821
|
+
} else {
|
|
41822
|
+
return this.goto(this.parseNumberInteger);
|
|
41823
|
+
}
|
|
41824
|
+
}
|
|
41825
|
+
}, {
|
|
41826
|
+
key: "parseNumberIntegerExponentOrDecimal",
|
|
41827
|
+
value: function parseNumberIntegerExponentOrDecimal() {
|
|
41828
|
+
if (this.char === CHAR_PERIOD) {
|
|
41829
|
+
this.consume();
|
|
41830
|
+
return this.call(this.parseNoUnder, this.parseNumberFloat);
|
|
41831
|
+
} else if (this.char === CHAR_E || this.char === CHAR_e) {
|
|
41832
|
+
this.consume();
|
|
41833
|
+
return this.next(this.parseNumberExponentSign);
|
|
41834
|
+
} else {
|
|
41835
|
+
return this.returnNow(Integer(this.state.buf));
|
|
41599
41836
|
}
|
|
41600
41837
|
}
|
|
41601
41838
|
}, {
|
|
@@ -41625,9 +41862,9 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
41625
41862
|
}, {
|
|
41626
41863
|
key: "parseNoUnder",
|
|
41627
41864
|
value: function parseNoUnder() {
|
|
41628
|
-
if (this.char === CHAR_LOWBAR) {
|
|
41629
|
-
throw this.error(new TomlError('Unexpected character, expected digit
|
|
41630
|
-
} else if (this.atEndOfWord()
|
|
41865
|
+
if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD || this.char === CHAR_E || this.char === CHAR_e) {
|
|
41866
|
+
throw this.error(new TomlError('Unexpected character, expected digit'));
|
|
41867
|
+
} else if (this.atEndOfWord()) {
|
|
41631
41868
|
throw this.error(new TomlError('Incomplete number'));
|
|
41632
41869
|
}
|
|
41633
41870
|
|
|
@@ -42202,7 +42439,7 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
42202
42439
|
for (var _iterator2 = kv.key[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
42203
42440
|
var kw = _step2.value;
|
|
42204
42441
|
|
|
42205
|
-
if (kw
|
|
42442
|
+
if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
|
|
42206
42443
|
throw this.error(new TomlError("Can't redefine existing key"));
|
|
42207
42444
|
}
|
|
42208
42445
|
|
|
@@ -42223,7 +42460,7 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
42223
42460
|
}
|
|
42224
42461
|
}
|
|
42225
42462
|
|
|
42226
|
-
if (finalKey
|
|
42463
|
+
if (hasKey(target, finalKey)) {
|
|
42227
42464
|
throw this.error(new TomlError("Can't redefine existing key"));
|
|
42228
42465
|
}
|
|
42229
42466
|
|
|
@@ -42303,7 +42540,7 @@ function prettyError(err, buf) {
|
|
|
42303
42540
|
var parseString_1 = parseString;
|
|
42304
42541
|
|
|
42305
42542
|
function parseString(str) {
|
|
42306
|
-
if (
|
|
42543
|
+
if (global.Buffer && global.Buffer.isBuffer(str)) {
|
|
42307
42544
|
str = str.toString('utf8');
|
|
42308
42545
|
}
|
|
42309
42546
|
|
|
@@ -42312,8 +42549,8 @@ function parseString(str) {
|
|
|
42312
42549
|
try {
|
|
42313
42550
|
parser.parse(str);
|
|
42314
42551
|
return parser.finish();
|
|
42315
|
-
} catch (
|
|
42316
|
-
throw parsePrettyError(
|
|
42552
|
+
} catch (err) {
|
|
42553
|
+
throw parsePrettyError(err, str);
|
|
42317
42554
|
}
|
|
42318
42555
|
}
|
|
42319
42556
|
|
|
@@ -42491,7 +42728,8 @@ var resolveConfig_1 = createCommonjsModule(function (module) {
|
|
|
42491
42728
|
var patternList = [].concat(patterns);
|
|
42492
42729
|
var excludedPatternList = [].concat(excludedPatterns || []);
|
|
42493
42730
|
var opts = {
|
|
42494
|
-
matchBase: true
|
|
42731
|
+
matchBase: true,
|
|
42732
|
+
dot: true
|
|
42495
42733
|
};
|
|
42496
42734
|
return patternList.some(function (pattern) {
|
|
42497
42735
|
return minimatch_1(filePath, pattern, opts);
|