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/index.js
CHANGED
|
@@ -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.
|
|
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.
|
|
33
|
-
"@iarna/toml": "2.
|
|
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.
|
|
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.
|
|
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
|
|
11716
|
-
var
|
|
11717
|
-
var
|
|
11758
|
+
var _iteratorNormalCompletion2 = true;
|
|
11759
|
+
var _didIteratorError2 = false;
|
|
11760
|
+
var _iteratorError2 = undefined;
|
|
11718
11761
|
|
|
11719
11762
|
try {
|
|
11720
|
-
for (var
|
|
11721
|
-
var part =
|
|
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
|
-
|
|
11731
|
-
|
|
11773
|
+
_didIteratorError2 = true;
|
|
11774
|
+
_iteratorError2 = err;
|
|
11732
11775
|
} finally {
|
|
11733
11776
|
try {
|
|
11734
|
-
if (!
|
|
11735
|
-
|
|
11777
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
11778
|
+
_iterator2.return();
|
|
11736
11779
|
}
|
|
11737
11780
|
} finally {
|
|
11738
|
-
if (
|
|
11739
|
-
throw
|
|
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
|
|
@@ -13963,7 +14009,6 @@ function formatRange(text, opts) {
|
|
|
13963
14009
|
var rangeResult = coreFormat(rangeString, Object.assign({}, opts, {
|
|
13964
14010
|
rangeStart: 0,
|
|
13965
14011
|
rangeEnd: Infinity,
|
|
13966
|
-
printWidth: opts.printWidth - alignmentSize,
|
|
13967
14012
|
// track the cursor offset only if it's within our range
|
|
13968
14013
|
cursorOffset: opts.cursorOffset >= rangeStart && opts.cursorOffset < rangeEnd ? opts.cursorOffset - rangeStart : -1
|
|
13969
14014
|
}), alignmentSize); // Since the range contracts to avoid trailing whitespace,
|
|
@@ -14753,7 +14798,7 @@ var lodash_uniqby = createCommonjsModule(function (module, exports) {
|
|
|
14753
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;
|
|
14754
14799
|
/** Detect free variable `global` from Node.js. */
|
|
14755
14800
|
|
|
14756
|
-
var freeGlobal = typeof
|
|
14801
|
+
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
|
14757
14802
|
/** Detect free variable `self`. */
|
|
14758
14803
|
|
|
14759
14804
|
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
@@ -17206,7 +17251,7 @@ var REJECTED = 'rejected';
|
|
|
17206
17251
|
|
|
17207
17252
|
var NOOP = function NOOP() {};
|
|
17208
17253
|
|
|
17209
|
-
var isNode = typeof
|
|
17254
|
+
var isNode = typeof global !== 'undefined' && typeof global.process !== 'undefined' && typeof global.process.emit === 'function';
|
|
17210
17255
|
var asyncSetTimer = typeof setImmediate === 'undefined' ? setTimeout : setImmediate;
|
|
17211
17256
|
var asyncQueue = [];
|
|
17212
17257
|
var asyncTimer;
|
|
@@ -17354,12 +17399,12 @@ function publishRejection(promise) {
|
|
|
17354
17399
|
publish(promise);
|
|
17355
17400
|
|
|
17356
17401
|
if (!promise._handled && isNode) {
|
|
17357
|
-
|
|
17402
|
+
global.process.emit('unhandledRejection', promise._data, promise);
|
|
17358
17403
|
}
|
|
17359
17404
|
}
|
|
17360
17405
|
|
|
17361
17406
|
function notifyRejectionHandled(promise) {
|
|
17362
|
-
|
|
17407
|
+
global.process.emit('rejectionHandled', promise);
|
|
17363
17408
|
}
|
|
17364
17409
|
/**
|
|
17365
17410
|
* @class
|
|
@@ -17538,7 +17583,7 @@ var arrayUniq = createCommonjsModule(function (module) {
|
|
|
17538
17583
|
return ret === true;
|
|
17539
17584
|
}
|
|
17540
17585
|
|
|
17541
|
-
if ('Set' in
|
|
17586
|
+
if ('Set' in global) {
|
|
17542
17587
|
if (typeof Set.prototype.forEach === 'function' && doesForEachActuallyWork()) {
|
|
17543
17588
|
module.exports = uniqSetWithForEach;
|
|
17544
17589
|
} else {
|
|
@@ -20822,7 +20867,7 @@ var timers = true;
|
|
|
20822
20867
|
var tls = true;
|
|
20823
20868
|
var tty = true;
|
|
20824
20869
|
var url = true;
|
|
20825
|
-
var util$
|
|
20870
|
+
var util$3 = true;
|
|
20826
20871
|
var v8 = ">= 1";
|
|
20827
20872
|
var vm = true;
|
|
20828
20873
|
var zlib = true;
|
|
@@ -20864,7 +20909,7 @@ var core$3 = {
|
|
|
20864
20909
|
tls: tls,
|
|
20865
20910
|
tty: tty,
|
|
20866
20911
|
url: url,
|
|
20867
|
-
util: util$
|
|
20912
|
+
util: util$3,
|
|
20868
20913
|
v8: v8,
|
|
20869
20914
|
vm: vm,
|
|
20870
20915
|
zlib: zlib
|
|
@@ -20908,7 +20953,7 @@ var core$4 = Object.freeze({
|
|
|
20908
20953
|
tls: tls,
|
|
20909
20954
|
tty: tty,
|
|
20910
20955
|
url: url,
|
|
20911
|
-
util: util$
|
|
20956
|
+
util: util$3,
|
|
20912
20957
|
v8: v8,
|
|
20913
20958
|
vm: vm,
|
|
20914
20959
|
zlib: zlib,
|
|
@@ -21681,7 +21726,7 @@ function handleCommentInEmptyParens(text, enclosingNode, comment, options) {
|
|
|
21681
21726
|
// i.e. a function without any argument.
|
|
21682
21727
|
|
|
21683
21728
|
|
|
21684
|
-
if (enclosingNode && ((enclosingNode.type === "FunctionDeclaration" || enclosingNode.type === "FunctionExpression" || enclosingNode.type === "ArrowFunctionExpression"
|
|
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)) {
|
|
21685
21730
|
addDanglingComment$2(enclosingNode, comment);
|
|
21686
21731
|
return true;
|
|
21687
21732
|
}
|
|
@@ -21911,9 +21956,7 @@ var _require$$1$utils = doc.utils;
|
|
|
21911
21956
|
var mapDoc$3 = _require$$1$utils.mapDoc;
|
|
21912
21957
|
var stripTrailingHardline$1 = _require$$1$utils.stripTrailingHardline;
|
|
21913
21958
|
|
|
21914
|
-
function embed(path$$1, print, textToDoc
|
|
21915
|
-
/*, options */
|
|
21916
|
-
) {
|
|
21959
|
+
function embed(path$$1, print, textToDoc, options) {
|
|
21917
21960
|
var node = path$$1.getValue();
|
|
21918
21961
|
var parent = path$$1.getParentNode();
|
|
21919
21962
|
var parentParent = path$$1.getParentNode(1);
|
|
@@ -22019,12 +22062,10 @@ function embed(path$$1, print, textToDoc
|
|
|
22019
22062
|
return concat$5(["`", indent$3(concat$5([hardline$4, join$3(hardline$4, parts)])), hardline$4, "`"]);
|
|
22020
22063
|
}
|
|
22021
22064
|
|
|
22022
|
-
|
|
22023
|
-
return printHtmlTemplateLiteral(path$$1, print, textToDoc, "html");
|
|
22024
|
-
}
|
|
22065
|
+
var htmlParser = isHtml(path$$1) ? "html" : isAngularComponentTemplate(path$$1) ? "angular" : undefined;
|
|
22025
22066
|
|
|
22026
|
-
if (
|
|
22027
|
-
return printHtmlTemplateLiteral(path$$1, print, textToDoc,
|
|
22067
|
+
if (htmlParser) {
|
|
22068
|
+
return printHtmlTemplateLiteral(path$$1, print, textToDoc, htmlParser, options.embeddedInHtml);
|
|
22028
22069
|
}
|
|
22029
22070
|
|
|
22030
22071
|
break;
|
|
@@ -22064,6 +22105,10 @@ function getIndentation(str) {
|
|
|
22064
22105
|
return firstMatchedIndent === null ? "" : firstMatchedIndent[1];
|
|
22065
22106
|
}
|
|
22066
22107
|
|
|
22108
|
+
function uncook(cookedValue) {
|
|
22109
|
+
return cookedValue.replace(/([\\`]|\$\{)/g, "\\$1");
|
|
22110
|
+
}
|
|
22111
|
+
|
|
22067
22112
|
function escapeTemplateCharacters(doc$$2, raw) {
|
|
22068
22113
|
return mapDoc$3(doc$$2, function (currentDoc) {
|
|
22069
22114
|
if (!currentDoc.parts) {
|
|
@@ -22073,7 +22118,7 @@ function escapeTemplateCharacters(doc$$2, raw) {
|
|
|
22073
22118
|
var parts = [];
|
|
22074
22119
|
currentDoc.parts.forEach(function (part) {
|
|
22075
22120
|
if (typeof part === "string") {
|
|
22076
|
-
parts.push(raw ? part.replace(/(\\*)`/g, "$1$1\\`") : part
|
|
22121
|
+
parts.push(raw ? part.replace(/(\\*)`/g, "$1$1\\`") : uncook(part));
|
|
22077
22122
|
} else {
|
|
22078
22123
|
parts.push(part);
|
|
22079
22124
|
}
|
|
@@ -22184,8 +22229,11 @@ function printGraphqlComments(lines) {
|
|
|
22184
22229
|
return parts.length === 0 ? null : join$3(hardline$4, parts);
|
|
22185
22230
|
}
|
|
22186
22231
|
/**
|
|
22187
|
-
* Template literal in
|
|
22232
|
+
* Template literal in these contexts:
|
|
22188
22233
|
* <style jsx>{`div{color:red}`}</style>
|
|
22234
|
+
* css``
|
|
22235
|
+
* css.global``
|
|
22236
|
+
* css.resolve``
|
|
22189
22237
|
*/
|
|
22190
22238
|
|
|
22191
22239
|
|
|
@@ -22195,7 +22243,7 @@ function isStyledJsx(path$$1) {
|
|
|
22195
22243
|
var parentParent = path$$1.getParentNode(1);
|
|
22196
22244
|
return parentParent && node.quasis && parent.type === "JSXExpressionContainer" && parentParent.type === "JSXElement" && parentParent.openingElement.name.name === "style" && parentParent.openingElement.attributes.some(function (attribute) {
|
|
22197
22245
|
return attribute.name.name === "jsx";
|
|
22198
|
-
});
|
|
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");
|
|
22199
22247
|
}
|
|
22200
22248
|
/**
|
|
22201
22249
|
* Angular Components can have:
|
|
@@ -22263,9 +22311,9 @@ function isStyledComponents(path$$1) {
|
|
|
22263
22311
|
|
|
22264
22312
|
case "CallExpression":
|
|
22265
22313
|
return (// styled(Component)``
|
|
22266
|
-
isStyledIdentifier(tag.callee) || tag.callee.type === "MemberExpression" && (tag.callee.object.type === "MemberExpression" && ( // styled.foo.
|
|
22267
|
-
isStyledIdentifier(tag.callee.object.object) || // Component.extend.
|
|
22268
|
-
isStyledExtend(tag.callee.object)) || // styled(Component).
|
|
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({})``
|
|
22269
22317
|
tag.callee.object.type === "CallExpression" && isStyledIdentifier(tag.callee.object.callee))
|
|
22270
22318
|
);
|
|
22271
22319
|
|
|
@@ -22383,16 +22431,22 @@ function isHtml(path$$1) {
|
|
|
22383
22431
|
}, function (node, name) {
|
|
22384
22432
|
return node.type === "TaggedTemplateExpression" && node.tag.type === "Identifier" && node.tag.name === "html" && name === "quasi";
|
|
22385
22433
|
}]);
|
|
22386
|
-
}
|
|
22434
|
+
} // The counter is needed to distinguish nested embeds.
|
|
22435
|
+
|
|
22387
22436
|
|
|
22388
|
-
|
|
22437
|
+
var htmlTemplateLiteralCounter = 0;
|
|
22438
|
+
|
|
22439
|
+
function printHtmlTemplateLiteral(path$$1, print, textToDoc, parser, escapeClosingScriptTag) {
|
|
22389
22440
|
var node = path$$1.getValue();
|
|
22390
|
-
var
|
|
22391
|
-
|
|
22392
|
-
|
|
22393
|
-
|
|
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
|
+
|
|
22394
22448
|
var text = node.quasis.map(function (quasi, index, quasis) {
|
|
22395
|
-
return index === quasis.length - 1 ? quasi.value.
|
|
22449
|
+
return index === quasis.length - 1 ? quasi.value.cooked : quasi.value.cooked + composePlaceholder(index);
|
|
22396
22450
|
}).join("");
|
|
22397
22451
|
var expressionDocs = path$$1.map(print, "expressions");
|
|
22398
22452
|
|
|
@@ -22400,13 +22454,11 @@ function printHtmlTemplateLiteral(path$$1, print, textToDoc, parser) {
|
|
|
22400
22454
|
return "``";
|
|
22401
22455
|
}
|
|
22402
22456
|
|
|
22457
|
+
var placeholderRegex = RegExp(composePlaceholder("(\\d+)"), "g");
|
|
22403
22458
|
var contentDoc = mapDoc$3(stripTrailingHardline$1(textToDoc(text, {
|
|
22404
22459
|
parser
|
|
22405
22460
|
})), function (doc$$2) {
|
|
22406
|
-
|
|
22407
|
-
var hasPlaceholder = typeof doc$$2 === "string" && placeholderRegex.test(doc$$2);
|
|
22408
|
-
|
|
22409
|
-
if (!hasPlaceholder) {
|
|
22461
|
+
if (typeof doc$$2 !== "string") {
|
|
22410
22462
|
return doc$$2;
|
|
22411
22463
|
}
|
|
22412
22464
|
|
|
@@ -22418,6 +22470,12 @@ function printHtmlTemplateLiteral(path$$1, print, textToDoc, parser) {
|
|
|
22418
22470
|
|
|
22419
22471
|
if (i % 2 === 0) {
|
|
22420
22472
|
if (component) {
|
|
22473
|
+
component = uncook(component);
|
|
22474
|
+
|
|
22475
|
+
if (escapeClosingScriptTag) {
|
|
22476
|
+
component = component.replace(/<\/(script)\b/gi, "<\\/$1");
|
|
22477
|
+
}
|
|
22478
|
+
|
|
22421
22479
|
parts.push(component);
|
|
22422
22480
|
}
|
|
22423
22481
|
|
|
@@ -22817,35 +22875,97 @@ function hasNode$1(node, fn) {
|
|
|
22817
22875
|
});
|
|
22818
22876
|
}
|
|
22819
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
|
+
|
|
22820
22926
|
var utils$4 = {
|
|
22927
|
+
getLeftSide: getLeftSide$1,
|
|
22928
|
+
getLeftSidePathName: getLeftSidePathName$2,
|
|
22929
|
+
hasNakedLeftSide: hasNakedLeftSide$2,
|
|
22821
22930
|
hasNode: hasNode$1,
|
|
22822
22931
|
hasFlowShorthandAnnotationComment: hasFlowShorthandAnnotationComment$2,
|
|
22823
22932
|
hasFlowAnnotationComment: hasFlowAnnotationComment$1
|
|
22824
22933
|
};
|
|
22825
22934
|
|
|
22935
|
+
var getLeftSidePathName$1 = utils$4.getLeftSidePathName;
|
|
22936
|
+
var hasNakedLeftSide$1 = utils$4.hasNakedLeftSide;
|
|
22826
22937
|
var hasFlowShorthandAnnotationComment$1 = utils$4.hasFlowShorthandAnnotationComment;
|
|
22827
22938
|
|
|
22828
|
-
function hasClosureCompilerTypeCastComment(text, path$$1
|
|
22939
|
+
function hasClosureCompilerTypeCastComment(text, path$$1) {
|
|
22829
22940
|
// https://github.com/google/closure-compiler/wiki/Annotating-Types#type-casts
|
|
22830
22941
|
// Syntax example: var x = /** @type {string} */ (fruit);
|
|
22831
22942
|
var n = path$$1.getValue();
|
|
22832
|
-
return
|
|
22943
|
+
return isParenthesized(n) && (hasTypeCastComment(n) || hasAncestorTypeCastComment(0)); // for sub-item: /** @type {array} */ (numberOrString).map(x => x);
|
|
22833
22944
|
|
|
22834
22945
|
function hasAncestorTypeCastComment(index) {
|
|
22835
22946
|
var ancestor = path$$1.getParentNode(index);
|
|
22836
|
-
return ancestor &&
|
|
22947
|
+
return ancestor && !isParenthesized(ancestor) ? hasTypeCastComment(ancestor) || hasAncestorTypeCastComment(index + 1) : false;
|
|
22837
22948
|
}
|
|
22838
22949
|
|
|
22839
22950
|
function hasTypeCastComment(node) {
|
|
22840
22951
|
return node.comments && node.comments.some(function (comment) {
|
|
22841
|
-
return comment.leading && comments$3.isBlockComment(comment) && isTypeCastComment(comment.value)
|
|
22952
|
+
return comment.leading && comments$3.isBlockComment(comment) && isTypeCastComment(comment.value);
|
|
22842
22953
|
});
|
|
22843
22954
|
}
|
|
22844
22955
|
|
|
22956
|
+
function isParenthesized(node) {
|
|
22957
|
+
// Closure typecast comments only really make sense when _not_ using
|
|
22958
|
+
// typescript or flow parsers, so we take advantage of the babel parser's
|
|
22959
|
+
// parenthesized expressions.
|
|
22960
|
+
return node.extra && node.extra.parenthesized;
|
|
22961
|
+
}
|
|
22962
|
+
|
|
22845
22963
|
function isTypeCastComment(comment) {
|
|
22846
|
-
var
|
|
22964
|
+
var cleaned = comment.trim().split("\n").map(function (line) {
|
|
22965
|
+
return line.replace(/^[\s*]+/, "");
|
|
22966
|
+
}).join(" ").trim();
|
|
22847
22967
|
|
|
22848
|
-
if (
|
|
22968
|
+
if (!/^@type\s*\{[^]+\}$/.test(cleaned)) {
|
|
22849
22969
|
return false;
|
|
22850
22970
|
}
|
|
22851
22971
|
|
|
@@ -22856,7 +22976,7 @@ function hasClosureCompilerTypeCastComment(text, path$$1, locStart, locEnd) {
|
|
|
22856
22976
|
var _iteratorError = undefined;
|
|
22857
22977
|
|
|
22858
22978
|
try {
|
|
22859
|
-
for (var _iterator =
|
|
22979
|
+
for (var _iterator = cleaned[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
22860
22980
|
var char = _step.value;
|
|
22861
22981
|
|
|
22862
22982
|
if (char === "{") {
|
|
@@ -22924,7 +23044,7 @@ function needsParens(path$$1, options) {
|
|
|
22924
23044
|
// parentheses.
|
|
22925
23045
|
|
|
22926
23046
|
|
|
22927
|
-
if (hasClosureCompilerTypeCastComment(options.originalText, path$$1
|
|
23047
|
+
if (hasClosureCompilerTypeCastComment(options.originalText, path$$1)) {
|
|
22928
23048
|
return true;
|
|
22929
23049
|
}
|
|
22930
23050
|
|
|
@@ -22937,6 +23057,15 @@ function needsParens(path$$1, options) {
|
|
|
22937
23057
|
|
|
22938
23058
|
|
|
22939
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
|
+
|
|
22940
23069
|
return false;
|
|
22941
23070
|
}
|
|
22942
23071
|
|
|
@@ -22948,6 +23077,13 @@ function needsParens(path$$1, options) {
|
|
|
22948
23077
|
|
|
22949
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")) {
|
|
22950
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);
|
|
22951
23087
|
}
|
|
22952
23088
|
|
|
22953
23089
|
if (parent.type === "Decorator" && parent.expression === node) {
|
|
@@ -22999,9 +23135,11 @@ function needsParens(path$$1, options) {
|
|
|
22999
23135
|
case "CallExpression":
|
|
23000
23136
|
{
|
|
23001
23137
|
var firstParentNotMemberExpression = parent;
|
|
23002
|
-
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
|
|
23003
23141
|
|
|
23004
|
-
while (firstParentNotMemberExpression && firstParentNotMemberExpression.type === "MemberExpression") {
|
|
23142
|
+
while (firstParentNotMemberExpression && (firstParentNotMemberExpression.type === "MemberExpression" && firstParentNotMemberExpression.object === path$$1.getParentNode(i - 1) || firstParentNotMemberExpression.type === "TaggedTemplateExpression" || firstParentNotMemberExpression.type === "TSNonNullExpression")) {
|
|
23005
23143
|
firstParentNotMemberExpression = path$$1.getParentNode(++i);
|
|
23006
23144
|
}
|
|
23007
23145
|
|
|
@@ -23105,6 +23243,7 @@ function needsParens(path$$1, options) {
|
|
|
23105
23243
|
case "TSTypeAssertion":
|
|
23106
23244
|
case "TaggedTemplateExpression":
|
|
23107
23245
|
case "UnaryExpression":
|
|
23246
|
+
case "JSXSpreadAttribute":
|
|
23108
23247
|
case "SpreadElement":
|
|
23109
23248
|
case "SpreadProperty":
|
|
23110
23249
|
case "BindExpression":
|
|
@@ -23184,7 +23323,7 @@ function needsParens(path$$1, options) {
|
|
|
23184
23323
|
} // Delegate to inner TSParenthesizedType
|
|
23185
23324
|
|
|
23186
23325
|
|
|
23187
|
-
if (node.typeAnnotation.type === "TSParenthesizedType") {
|
|
23326
|
+
if (node.typeAnnotation.type === "TSParenthesizedType" && parent.type !== "TSArrayType") {
|
|
23188
23327
|
return false;
|
|
23189
23328
|
}
|
|
23190
23329
|
|
|
@@ -23235,6 +23374,7 @@ function needsParens(path$$1, options) {
|
|
|
23235
23374
|
case "TSAsExpression":
|
|
23236
23375
|
case "TSNonNullExpression":
|
|
23237
23376
|
case "BindExpression":
|
|
23377
|
+
case "OptionalMemberExpression":
|
|
23238
23378
|
return true;
|
|
23239
23379
|
|
|
23240
23380
|
case "MemberExpression":
|
|
@@ -23357,9 +23497,6 @@ function needsParens(path$$1, options) {
|
|
|
23357
23497
|
return true;
|
|
23358
23498
|
// This is basically a kind of IIFE.
|
|
23359
23499
|
|
|
23360
|
-
case "ExportDefaultDeclaration":
|
|
23361
|
-
return true;
|
|
23362
|
-
|
|
23363
23500
|
default:
|
|
23364
23501
|
return false;
|
|
23365
23502
|
}
|
|
@@ -23394,9 +23531,6 @@ function needsParens(path$$1, options) {
|
|
|
23394
23531
|
|
|
23395
23532
|
case "ClassExpression":
|
|
23396
23533
|
switch (parent.type) {
|
|
23397
|
-
case "ExportDefaultDeclaration":
|
|
23398
|
-
return true;
|
|
23399
|
-
|
|
23400
23534
|
case "NewExpression":
|
|
23401
23535
|
return name === "callee" && parent.callee === node;
|
|
23402
23536
|
|
|
@@ -23427,7 +23561,7 @@ function needsParens(path$$1, options) {
|
|
|
23427
23561
|
return false;
|
|
23428
23562
|
|
|
23429
23563
|
case "BindExpression":
|
|
23430
|
-
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) {
|
|
23431
23565
|
return true;
|
|
23432
23566
|
}
|
|
23433
23567
|
|
|
@@ -23509,6 +23643,26 @@ function isFollowedByRightBracket(path$$1) {
|
|
|
23509
23643
|
return false;
|
|
23510
23644
|
}
|
|
23511
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
|
+
|
|
23512
23666
|
var needsParens_1 = needsParens;
|
|
23513
23667
|
|
|
23514
23668
|
var _require$$0$builders$1 = doc.builders;
|
|
@@ -23614,6 +23768,9 @@ var isIdentifierName = utils$2.keyword.isIdentifierNameES5;
|
|
|
23614
23768
|
var insertPragma = pragma.insertPragma;
|
|
23615
23769
|
var printHtmlBinding = htmlBinding.printHtmlBinding;
|
|
23616
23770
|
var isVueEventBindingExpression = htmlBinding.isVueEventBindingExpression;
|
|
23771
|
+
var getLeftSide = utils$4.getLeftSide;
|
|
23772
|
+
var getLeftSidePathName = utils$4.getLeftSidePathName;
|
|
23773
|
+
var hasNakedLeftSide = utils$4.hasNakedLeftSide;
|
|
23617
23774
|
var hasNode = utils$4.hasNode;
|
|
23618
23775
|
var hasFlowAnnotationComment = utils$4.hasFlowAnnotationComment;
|
|
23619
23776
|
var hasFlowShorthandAnnotationComment = utils$4.hasFlowShorthandAnnotationComment;
|
|
@@ -25188,85 +25345,23 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25188
25345
|
var expressions = path$$1.map(print, "expressions");
|
|
25189
25346
|
|
|
25190
25347
|
var _parentNode = path$$1.getParentNode();
|
|
25191
|
-
/**
|
|
25192
|
-
* describe.each`table`(name, fn)
|
|
25193
|
-
* describe.only.each`table`(name, fn)
|
|
25194
|
-
* describe.skip.each`table`(name, fn)
|
|
25195
|
-
* test.each`table`(name, fn)
|
|
25196
|
-
* test.only.each`table`(name, fn)
|
|
25197
|
-
* test.skip.each`table`(name, fn)
|
|
25198
|
-
*
|
|
25199
|
-
* Ref: https://github.com/facebook/jest/pull/6102
|
|
25200
|
-
*/
|
|
25201
|
-
|
|
25202
|
-
|
|
25203
|
-
var jestEachTriggerRegex = /^[xf]?(describe|it|test)$/;
|
|
25204
25348
|
|
|
25205
|
-
if (
|
|
25206
|
-
|
|
25207
|
-
* a | b | expected
|
|
25208
|
-
* ${1} | ${1} | ${2}
|
|
25209
|
-
* ${1} | ${2} | ${3}
|
|
25210
|
-
* ${2} | ${1} | ${3}
|
|
25211
|
-
*/
|
|
25212
|
-
var headerNames = n.quasis[0].value.raw.trim().split(/\s*\|\s*/);
|
|
25349
|
+
if (isJestEachTemplateLiteral(n, _parentNode)) {
|
|
25350
|
+
var _printed2 = printJestEachTemplateLiteral(n, expressions, options);
|
|
25213
25351
|
|
|
25214
|
-
if (
|
|
25215
|
-
return
|
|
25216
|
-
}
|
|
25217
|
-
|
|
25218
|
-
return "${" + printDocToString$2(doc$$2, Object.assign({}, options, {
|
|
25219
|
-
printWidth: Infinity,
|
|
25220
|
-
endOfLine: "lf"
|
|
25221
|
-
})).formatted + "}";
|
|
25222
|
-
});
|
|
25223
|
-
var tableBody = [{
|
|
25224
|
-
hasLineBreak: false,
|
|
25225
|
-
cells: []
|
|
25226
|
-
}];
|
|
25227
|
-
|
|
25228
|
-
for (var _i = 1; _i < n.quasis.length; _i++) {
|
|
25229
|
-
var row = tableBody[tableBody.length - 1];
|
|
25230
|
-
var correspondingExpression = stringifiedExpressions[_i - 1];
|
|
25231
|
-
row.cells.push(correspondingExpression);
|
|
25232
|
-
|
|
25233
|
-
if (correspondingExpression.indexOf("\n") !== -1) {
|
|
25234
|
-
row.hasLineBreak = true;
|
|
25235
|
-
}
|
|
25352
|
+
if (_printed2) {
|
|
25353
|
+
return _printed2;
|
|
25354
|
+
}
|
|
25355
|
+
}
|
|
25236
25356
|
|
|
25237
|
-
|
|
25238
|
-
tableBody.push({
|
|
25239
|
-
hasLineBreak: false,
|
|
25240
|
-
cells: []
|
|
25241
|
-
});
|
|
25242
|
-
}
|
|
25243
|
-
}
|
|
25357
|
+
var isSimple = isSimpleTemplateLiteral(n);
|
|
25244
25358
|
|
|
25245
|
-
|
|
25246
|
-
|
|
25247
|
-
},
|
|
25248
|
-
|
|
25249
|
-
|
|
25250
|
-
|
|
25251
|
-
var table = [{
|
|
25252
|
-
cells: headerNames
|
|
25253
|
-
}].concat(tableBody.filter(function (row) {
|
|
25254
|
-
return row.cells.length !== 0;
|
|
25255
|
-
}));
|
|
25256
|
-
table.filter(function (row) {
|
|
25257
|
-
return !row.hasLineBreak;
|
|
25258
|
-
}).forEach(function (row) {
|
|
25259
|
-
row.cells.forEach(function (cell, index) {
|
|
25260
|
-
maxColumnWidths[index] = Math.max(maxColumnWidths[index], getStringWidth$2(cell));
|
|
25261
|
-
});
|
|
25262
|
-
});
|
|
25263
|
-
parts.push("`", indent$2(concat$4([hardline$3, join$2(hardline$3, table.map(function (row) {
|
|
25264
|
-
return join$2(" | ", row.cells.map(function (cell, index) {
|
|
25265
|
-
return row.hasLineBreak ? cell : cell + " ".repeat(maxColumnWidths[index] - getStringWidth$2(cell));
|
|
25266
|
-
}));
|
|
25267
|
-
}))])), hardline$3, "`");
|
|
25268
|
-
return concat$4(parts);
|
|
25269
|
-
}
|
|
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
|
+
});
|
|
25270
25365
|
}
|
|
25271
25366
|
|
|
25272
25367
|
parts.push("`");
|
|
@@ -25289,13 +25384,17 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25289
25384
|
var tabWidth = options.tabWidth;
|
|
25290
25385
|
var quasi = childPath.getValue();
|
|
25291
25386
|
var indentSize = getIndentSize$1(quasi.value.raw, tabWidth);
|
|
25292
|
-
var
|
|
25387
|
+
var _printed3 = expressions[i];
|
|
25293
25388
|
|
|
25294
|
-
if (
|
|
25295
|
-
|
|
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
|
+
}
|
|
25296
25395
|
}
|
|
25297
25396
|
|
|
25298
|
-
var aligned = indentSize === 0 && quasi.value.raw.endsWith("\n") ? align$1(-Infinity,
|
|
25397
|
+
var aligned = indentSize === 0 && quasi.value.raw.endsWith("\n") ? align$1(-Infinity, _printed3) : addAlignmentToDoc$2(_printed3, indentSize, tabWidth);
|
|
25299
25398
|
parts.push(group$1(concat$4(["${", aligned, lineSuffixBoundary$1, "}"])));
|
|
25300
25399
|
}
|
|
25301
25400
|
}, "quasis");
|
|
@@ -25342,8 +25441,7 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25342
25441
|
case "TupleTypeAnnotation":
|
|
25343
25442
|
{
|
|
25344
25443
|
var typesField = n.type === "TSTupleType" ? "elementTypes" : "types";
|
|
25345
|
-
return group$1(concat$4(["[", indent$2(concat$4([softline$1, printArrayItems(path$$1, options, typesField, print)])),
|
|
25346
|
-
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,
|
|
25347
25445
|
/* sameIndent */
|
|
25348
25446
|
true), softline$1, "]"]));
|
|
25349
25447
|
}
|
|
@@ -25511,22 +25609,22 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25511
25609
|
var result = [];
|
|
25512
25610
|
var wasIndented = false;
|
|
25513
25611
|
|
|
25514
|
-
for (var
|
|
25515
|
-
if (
|
|
25516
|
-
result.push(types[
|
|
25517
|
-
} else if (isObjectType(n.types[
|
|
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])) {
|
|
25518
25616
|
// If both are objects, don't indent
|
|
25519
|
-
result.push(concat$4([" & ", wasIndented ? indent$2(types[
|
|
25520
|
-
} else if (!isObjectType(n.types[
|
|
25617
|
+
result.push(concat$4([" & ", wasIndented ? indent$2(types[_i]) : types[_i]]));
|
|
25618
|
+
} else if (!isObjectType(n.types[_i - 1]) && !isObjectType(n.types[_i])) {
|
|
25521
25619
|
// If no object is involved, go to the next line if it breaks
|
|
25522
|
-
result.push(indent$2(concat$4([" &", line$3, types[
|
|
25620
|
+
result.push(indent$2(concat$4([" &", line$3, types[_i]])));
|
|
25523
25621
|
} else {
|
|
25524
25622
|
// If you go from object to non-object or vis-versa, then inline it
|
|
25525
|
-
if (
|
|
25623
|
+
if (_i > 1) {
|
|
25526
25624
|
wasIndented = true;
|
|
25527
25625
|
}
|
|
25528
25626
|
|
|
25529
|
-
result.push(" & ",
|
|
25627
|
+
result.push(" & ", _i > 1 ? indent$2(types[_i]) : types[_i]);
|
|
25530
25628
|
}
|
|
25531
25629
|
}
|
|
25532
25630
|
|
|
@@ -25555,7 +25653,7 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25555
25653
|
// // comment
|
|
25556
25654
|
// | child2
|
|
25557
25655
|
|
|
25558
|
-
var
|
|
25656
|
+
var _printed4 = path$$1.map(function (typePath) {
|
|
25559
25657
|
var printedType = typePath.call(print);
|
|
25560
25658
|
|
|
25561
25659
|
if (!shouldHug) {
|
|
@@ -25568,11 +25666,11 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25568
25666
|
}, "types");
|
|
25569
25667
|
|
|
25570
25668
|
if (shouldHug) {
|
|
25571
|
-
return join$2(" | ",
|
|
25669
|
+
return join$2(" | ", _printed4);
|
|
25572
25670
|
}
|
|
25573
25671
|
|
|
25574
25672
|
var shouldAddStartLine = shouldIndent && !hasLeadingOwnLineComment(options.originalText, n, options);
|
|
25575
|
-
var code = concat$4([ifBreak$1(concat$4([shouldAddStartLine ? line$3 : "", "| "])), join$2(concat$4([line$3, "| "]),
|
|
25673
|
+
var code = concat$4([ifBreak$1(concat$4([shouldAddStartLine ? line$3 : "", "| "])), join$2(concat$4([line$3, "| "]), _printed4)]);
|
|
25576
25674
|
var hasParens;
|
|
25577
25675
|
|
|
25578
25676
|
if (n.type === "TSUnionType") {
|
|
@@ -25658,9 +25756,9 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25658
25756
|
parts.push("declare ");
|
|
25659
25757
|
}
|
|
25660
25758
|
|
|
25661
|
-
var
|
|
25759
|
+
var _printed5 = printAssignmentRight(n.id, n.right, path$$1.call(print, "right"), options);
|
|
25662
25760
|
|
|
25663
|
-
parts.push("type ", path$$1.call(print, "id"), path$$1.call(print, "typeParameters"), " =",
|
|
25761
|
+
parts.push("type ", path$$1.call(print, "id"), path$$1.call(print, "typeParameters"), " =", _printed5, semi);
|
|
25664
25762
|
return group$1(concat$4(parts));
|
|
25665
25763
|
}
|
|
25666
25764
|
|
|
@@ -25737,6 +25835,15 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25737
25835
|
|
|
25738
25836
|
if (n["default"]) {
|
|
25739
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(",");
|
|
25740
25847
|
}
|
|
25741
25848
|
|
|
25742
25849
|
return concat$4(parts);
|
|
@@ -25951,9 +26058,15 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25951
26058
|
return concat$4([n.operator, " ", path$$1.call(print, "typeAnnotation")]);
|
|
25952
26059
|
|
|
25953
26060
|
case "TSMappedType":
|
|
25954
|
-
|
|
25955
|
-
|
|
25956
|
-
|
|
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
|
+
}
|
|
25957
26070
|
|
|
25958
26071
|
case "TSMethodSignature":
|
|
25959
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,
|
|
@@ -26231,7 +26344,7 @@ function printPropertyKey(path$$1, options, print) {
|
|
|
26231
26344
|
|
|
26232
26345
|
if (options.quoteProps === "consistent" && !needsQuoteProps.has(parent)) {
|
|
26233
26346
|
var objectHasStringProp = (parent.properties || parent.body || parent.members).some(function (prop) {
|
|
26234
|
-
return prop.
|
|
26347
|
+
return !prop.computed && prop.key && isStringLiteral(prop.key) && !isStringPropSafeToCoerceToIdentifier(prop, options);
|
|
26235
26348
|
});
|
|
26236
26349
|
needsQuoteProps.set(parent, objectHasStringProp);
|
|
26237
26350
|
}
|
|
@@ -26246,7 +26359,7 @@ function printPropertyKey(path$$1, options, print) {
|
|
|
26246
26359
|
}, "key");
|
|
26247
26360
|
}
|
|
26248
26361
|
|
|
26249
|
-
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))) {
|
|
26250
26363
|
// 'a' -> a
|
|
26251
26364
|
return path$$1.call(function (keyPath) {
|
|
26252
26365
|
return comments.printComments(keyPath, function () {
|
|
@@ -26301,7 +26414,18 @@ function printMethod(path$$1, options, print) {
|
|
|
26301
26414
|
}
|
|
26302
26415
|
|
|
26303
26416
|
function couldGroupArg(arg) {
|
|
26304
|
-
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" &&
|
|
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));
|
|
26305
26429
|
}
|
|
26306
26430
|
|
|
26307
26431
|
function shouldGroupLastArg(args) {
|
|
@@ -26327,6 +26451,130 @@ function isSimpleFlowType(node) {
|
|
|
26327
26451
|
return node && flowTypeAnnotations.indexOf(node.type) !== -1 && !(node.type === "GenericTypeAnnotation" && node.typeParameters);
|
|
26328
26452
|
}
|
|
26329
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
|
+
|
|
26330
26578
|
var functionCompositionFunctionNames = new Set(["pipe", // RxJS, Ramda
|
|
26331
26579
|
"pipeP", // Ramda
|
|
26332
26580
|
"pipeK", // Ramda
|
|
@@ -27462,11 +27710,10 @@ function printJSXChildren(path$$1, options, print, jsxWhitespace, isFacebookTran
|
|
|
27462
27710
|
|
|
27463
27711
|
|
|
27464
27712
|
function printJSXElement(path$$1, options, print) {
|
|
27465
|
-
var n = path$$1.getValue();
|
|
27713
|
+
var n = path$$1.getValue();
|
|
27466
27714
|
|
|
27467
27715
|
if (n.type === "JSXElement" && isEmptyJSXElement(n)) {
|
|
27468
|
-
|
|
27469
|
-
return path$$1.call(print, "openingElement");
|
|
27716
|
+
return concat$4([path$$1.call(print, "openingElement"), path$$1.call(print, "closingElement")]);
|
|
27470
27717
|
}
|
|
27471
27718
|
|
|
27472
27719
|
var openingLines = n.type === "JSXElement" ? path$$1.call(print, "openingElement") : path$$1.call(print, "openingFragment");
|
|
@@ -27708,7 +27955,7 @@ function printAssignmentRight(leftNode, rightNode, printedRight, options) {
|
|
|
27708
27955
|
}
|
|
27709
27956
|
|
|
27710
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
|
|
27711
|
-
options.parser !== "json" && options.parser !== "json5";
|
|
27958
|
+
options.parser !== "json" && options.parser !== "json5" || rightNode.type === "SequenceExpression";
|
|
27712
27959
|
|
|
27713
27960
|
if (canBreak) {
|
|
27714
27961
|
return group$1(indent$2(concat$4([line$3, printedRight])));
|
|
@@ -27786,60 +28033,12 @@ function hasLeadingOwnLineComment(text, node, options) {
|
|
|
27786
28033
|
return res;
|
|
27787
28034
|
}
|
|
27788
28035
|
|
|
27789
|
-
function hasNakedLeftSide(node) {
|
|
27790
|
-
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";
|
|
27791
|
-
}
|
|
27792
|
-
|
|
27793
28036
|
function isFlowAnnotationComment(text, typeAnnotation, options) {
|
|
27794
28037
|
var start = options.locStart(typeAnnotation);
|
|
27795
28038
|
var end = skipWhitespace$1(text, options.locEnd(typeAnnotation));
|
|
27796
28039
|
return text.substr(start, 2) === "/*" && text.substr(end, 2) === "*/";
|
|
27797
28040
|
}
|
|
27798
28041
|
|
|
27799
|
-
function getLeftSide(node) {
|
|
27800
|
-
if (node.expressions) {
|
|
27801
|
-
return node.expressions[0];
|
|
27802
|
-
}
|
|
27803
|
-
|
|
27804
|
-
return node.left || node.test || node.callee || node.object || node.tag || node.argument || node.expression;
|
|
27805
|
-
}
|
|
27806
|
-
|
|
27807
|
-
function getLeftSidePathName(path$$1, node) {
|
|
27808
|
-
if (node.expressions) {
|
|
27809
|
-
return ["expressions", 0];
|
|
27810
|
-
}
|
|
27811
|
-
|
|
27812
|
-
if (node.left) {
|
|
27813
|
-
return ["left"];
|
|
27814
|
-
}
|
|
27815
|
-
|
|
27816
|
-
if (node.test) {
|
|
27817
|
-
return ["test"];
|
|
27818
|
-
}
|
|
27819
|
-
|
|
27820
|
-
if (node.object) {
|
|
27821
|
-
return ["object"];
|
|
27822
|
-
}
|
|
27823
|
-
|
|
27824
|
-
if (node.callee) {
|
|
27825
|
-
return ["callee"];
|
|
27826
|
-
}
|
|
27827
|
-
|
|
27828
|
-
if (node.tag) {
|
|
27829
|
-
return ["tag"];
|
|
27830
|
-
}
|
|
27831
|
-
|
|
27832
|
-
if (node.argument) {
|
|
27833
|
-
return ["argument"];
|
|
27834
|
-
}
|
|
27835
|
-
|
|
27836
|
-
if (node.expression) {
|
|
27837
|
-
return ["expression"];
|
|
27838
|
-
}
|
|
27839
|
-
|
|
27840
|
-
throw new Error("Unexpected node has no left side", node);
|
|
27841
|
-
}
|
|
27842
|
-
|
|
27843
28042
|
function exprNeedsASIProtection(path$$1, options) {
|
|
27844
28043
|
var node = path$$1.getValue();
|
|
27845
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;
|
|
@@ -28082,7 +28281,7 @@ function isLiteral(node) {
|
|
|
28082
28281
|
}
|
|
28083
28282
|
|
|
28084
28283
|
function isStringPropSafeToCoerceToIdentifier(node, options) {
|
|
28085
|
-
return isStringLiteral(node.key) && isIdentifierName(node.key.value) &&
|
|
28284
|
+
return isStringLiteral(node.key) && isIdentifierName(node.key.value) && options.parser !== "json" && !(options.parser === "typescript" && node.type === "ClassProperty");
|
|
28086
28285
|
}
|
|
28087
28286
|
|
|
28088
28287
|
function isNumericLiteral(node) {
|
|
@@ -28168,7 +28367,9 @@ function isTheOnlyJSXElementInMarkdown(options, path$$1) {
|
|
|
28168
28367
|
return parent.type === "Program" && parent.body.length == 1;
|
|
28169
28368
|
}
|
|
28170
28369
|
|
|
28171
|
-
function willPrintOwnComments(path$$1
|
|
28370
|
+
function willPrintOwnComments(path$$1
|
|
28371
|
+
/*, options */
|
|
28372
|
+
) {
|
|
28172
28373
|
var node = path$$1.getValue();
|
|
28173
28374
|
var parent = path$$1.getParentNode();
|
|
28174
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);
|
|
@@ -28727,7 +28928,7 @@ var json5$1 = Object.freeze({
|
|
|
28727
28928
|
|
|
28728
28929
|
var require$$0$21 = ( javascript$1 && javascript ) || javascript$1;
|
|
28729
28930
|
|
|
28730
|
-
var require$$1$
|
|
28931
|
+
var require$$1$10 = ( jsx$1 && jsx ) || jsx$1;
|
|
28731
28932
|
|
|
28732
28933
|
var require$$2$10 = ( typescript$1 && typescript ) || typescript$1;
|
|
28733
28934
|
|
|
@@ -28756,7 +28957,7 @@ var languages = [createLanguage(require$$0$21, {
|
|
|
28756
28957
|
filenames: [],
|
|
28757
28958
|
extensions: [".js.flow"]
|
|
28758
28959
|
}
|
|
28759
|
-
}), createLanguage(require$$1$
|
|
28960
|
+
}), createLanguage(require$$1$10, {
|
|
28760
28961
|
override: {
|
|
28761
28962
|
since: "0.0.0",
|
|
28762
28963
|
parsers: ["babel", "flow"],
|
|
@@ -30124,7 +30325,7 @@ var scss$1 = Object.freeze({
|
|
|
30124
30325
|
|
|
30125
30326
|
var require$$0$23 = ( css$3 && css$2 ) || css$3;
|
|
30126
30327
|
|
|
30127
|
-
var require$$1$
|
|
30328
|
+
var require$$1$11 = ( postcss$1 && postcss ) || postcss$1;
|
|
30128
30329
|
|
|
30129
30330
|
var require$$2$11 = ( less$1 && less ) || less$1;
|
|
30130
30331
|
|
|
@@ -30136,7 +30337,7 @@ var languages$1 = [createLanguage(require$$0$23, {
|
|
|
30136
30337
|
parsers: ["css"],
|
|
30137
30338
|
vscodeLanguageIds: ["css"]
|
|
30138
30339
|
}
|
|
30139
|
-
}), createLanguage(require$$1$
|
|
30340
|
+
}), createLanguage(require$$1$11, {
|
|
30140
30341
|
override: {
|
|
30141
30342
|
since: "1.4.0",
|
|
30142
30343
|
parsers: ["css"],
|
|
@@ -30203,33 +30404,21 @@ function print(path$$1, options, print) {
|
|
|
30203
30404
|
var isGlimmerComponent = tagFirstChar.toUpperCase() === tagFirstChar || isLocal;
|
|
30204
30405
|
var hasChildren = n.children.length > 0;
|
|
30205
30406
|
var isVoid = isGlimmerComponent && !hasChildren || voidTags.indexOf(n.tag) !== -1;
|
|
30206
|
-
var
|
|
30407
|
+
var closeTagForNoBreak = isVoid ? concat$10([" />", softline$4]) : ">";
|
|
30408
|
+
var closeTagForBreak = isVoid ? "/>" : ">";
|
|
30207
30409
|
|
|
30208
30410
|
var _getParams = function _getParams(path$$1, print) {
|
|
30209
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"))]));
|
|
30210
|
-
};
|
|
30211
|
-
// would not break but I need to force an indent, so I use a hardline.
|
|
30212
|
-
|
|
30213
|
-
/**
|
|
30214
|
-
* What happens now:
|
|
30215
|
-
* <div>
|
|
30216
|
-
* Hello
|
|
30217
|
-
* </div>
|
|
30218
|
-
* ==>
|
|
30219
|
-
* <div>Hello</div>
|
|
30220
|
-
* This is due to me using hasChildren to decide to put the hardline in.
|
|
30221
|
-
* I would rather use a {DOES THE WHOLE THING NEED TO BREAK}
|
|
30222
|
-
*/
|
|
30223
|
-
|
|
30412
|
+
};
|
|
30224
30413
|
|
|
30225
|
-
return concat$10([group$10(concat$10(["<", n.tag, _getParams(path$$1, print), n.blockParams.length ? ` as |${n.blockParams.join(" ")}|` : "", ifBreak$3(softline$4, ""),
|
|
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, ">"]) : ""]))]);
|
|
30226
30415
|
}
|
|
30227
30416
|
|
|
30228
30417
|
case "BlockStatement":
|
|
30229
30418
|
{
|
|
30230
30419
|
var pp = path$$1.getParentNode(1);
|
|
30231
|
-
var isElseIf = pp && pp.inverse && pp.inverse.body[0] === n && pp.inverse.body[0].path.parts[0] === "if";
|
|
30232
|
-
var hasElseIf = n.inverse && n.inverse.body
|
|
30420
|
+
var isElseIf = pp && pp.inverse && pp.inverse.body.length === 1 && pp.inverse.body[0] === n && pp.inverse.body[0].path.parts[0] === "if";
|
|
30421
|
+
var hasElseIf = n.inverse && n.inverse.body.length === 1 && n.inverse.body[0].type === "BlockStatement" && n.inverse.body[0].path.parts[0] === "if";
|
|
30233
30422
|
var indentElse = hasElseIf ? function (a) {
|
|
30234
30423
|
return a;
|
|
30235
30424
|
} : indent$6;
|
|
@@ -31538,9 +31727,9 @@ function genericPrint$4(path$$1, options, print) {
|
|
|
31538
31727
|
|
|
31539
31728
|
case "inlineCode":
|
|
31540
31729
|
{
|
|
31541
|
-
var backtickCount = util$1.
|
|
31730
|
+
var backtickCount = util$1.getMinNotPresentContinuousCount(node.value, "`");
|
|
31542
31731
|
|
|
31543
|
-
var _style = backtickCount
|
|
31732
|
+
var _style = "`".repeat(backtickCount || 1);
|
|
31544
31733
|
|
|
31545
31734
|
var gap = backtickCount ? " " : "";
|
|
31546
31735
|
return concat$12([_style, gap, node.value, gap, _style]);
|
|
@@ -33617,7 +33806,7 @@ var parseSrcset = createCommonjsModule(function (module) {
|
|
|
33617
33806
|
// Browser globals (root is window)
|
|
33618
33807
|
root.parseSrcset = factory();
|
|
33619
33808
|
}
|
|
33620
|
-
})(
|
|
33809
|
+
})(this, function () {
|
|
33621
33810
|
// 1. Let input be the value passed to this algorithm.
|
|
33622
33811
|
return function (input, options) {
|
|
33623
33812
|
var logger = options && options.logger || console; // UTILITY FUNCTIONS
|
|
@@ -34067,7 +34256,7 @@ function embed$6(path$$1, print, textToDoc, options) {
|
|
|
34067
34256
|
} // lit-html: html`<my-element obj=${obj}></my-element>`
|
|
34068
34257
|
|
|
34069
34258
|
|
|
34070
|
-
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))) {
|
|
34071
34260
|
return concat$14([node.rawName, "=", node.value]);
|
|
34072
34261
|
} // lwc: html`<my-element data-for={value}></my-elememt>`
|
|
34073
34262
|
|
|
@@ -34837,7 +35026,7 @@ var vue$1 = Object.freeze({
|
|
|
34837
35026
|
|
|
34838
35027
|
var require$$0$31 = ( html$2 && html$1 ) || html$2;
|
|
34839
35028
|
|
|
34840
|
-
var require$$1$
|
|
35029
|
+
var require$$1$12 = ( vue$1 && vue ) || vue$1;
|
|
34841
35030
|
|
|
34842
35031
|
var languages$5 = [createLanguage(require$$0$31, {
|
|
34843
35032
|
override: {
|
|
@@ -34867,7 +35056,7 @@ var languages$5 = [createLanguage(require$$0$31, {
|
|
|
34867
35056
|
extensions: [],
|
|
34868
35057
|
filenames: []
|
|
34869
35058
|
}
|
|
34870
|
-
}), createLanguage(require$$1$
|
|
35059
|
+
}), createLanguage(require$$1$12, {
|
|
34871
35060
|
override: {
|
|
34872
35061
|
since: "1.10.0",
|
|
34873
35062
|
parsers: ["vue"],
|
|
@@ -39304,7 +39493,7 @@ var fnmatch = createCommonjsModule(function (module, exports) {
|
|
|
39304
39493
|
var ini = createCommonjsModule(function (module, exports) {
|
|
39305
39494
|
"use strict"; // Based on iniparser by shockie <https://npmjs.org/package/iniparser>
|
|
39306
39495
|
|
|
39307
|
-
var __awaiter =
|
|
39496
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
39308
39497
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39309
39498
|
function fulfilled(value) {
|
|
39310
39499
|
try {
|
|
@@ -39332,7 +39521,7 @@ var ini = createCommonjsModule(function (module, exports) {
|
|
|
39332
39521
|
});
|
|
39333
39522
|
};
|
|
39334
39523
|
|
|
39335
|
-
var __generator =
|
|
39524
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
39336
39525
|
var _ = {
|
|
39337
39526
|
label: 0,
|
|
39338
39527
|
sent: function sent() {
|
|
@@ -39443,7 +39632,7 @@ var ini = createCommonjsModule(function (module, exports) {
|
|
|
39443
39632
|
}
|
|
39444
39633
|
};
|
|
39445
39634
|
|
|
39446
|
-
var __importStar =
|
|
39635
|
+
var __importStar = this && this.__importStar || function (mod) {
|
|
39447
39636
|
if (mod && mod.__esModule) return mod;
|
|
39448
39637
|
var result = {};
|
|
39449
39638
|
if (mod != null) for (var k in mod) {
|
|
@@ -39622,7 +39811,7 @@ var require$$4$6 = ( _package$3 && _package$2 ) || _package$3;
|
|
|
39622
39811
|
var src$2 = createCommonjsModule(function (module, exports) {
|
|
39623
39812
|
"use strict";
|
|
39624
39813
|
|
|
39625
|
-
var __awaiter =
|
|
39814
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
39626
39815
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39627
39816
|
function fulfilled(value) {
|
|
39628
39817
|
try {
|
|
@@ -39650,7 +39839,7 @@ var src$2 = createCommonjsModule(function (module, exports) {
|
|
|
39650
39839
|
});
|
|
39651
39840
|
};
|
|
39652
39841
|
|
|
39653
|
-
var __generator =
|
|
39842
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
39654
39843
|
var _ = {
|
|
39655
39844
|
label: 0,
|
|
39656
39845
|
sent: function sent() {
|
|
@@ -39761,7 +39950,7 @@ var src$2 = createCommonjsModule(function (module, exports) {
|
|
|
39761
39950
|
}
|
|
39762
39951
|
};
|
|
39763
39952
|
|
|
39764
|
-
var __importStar =
|
|
39953
|
+
var __importStar = this && this.__importStar || function (mod) {
|
|
39765
39954
|
if (mod && mod.__esModule) return mod;
|
|
39766
39955
|
var result = {};
|
|
39767
39956
|
if (mod != null) for (var k in mod) {
|
|
@@ -39771,7 +39960,7 @@ var src$2 = createCommonjsModule(function (module, exports) {
|
|
|
39771
39960
|
return result;
|
|
39772
39961
|
};
|
|
39773
39962
|
|
|
39774
|
-
var __importDefault =
|
|
39963
|
+
var __importDefault = this && this.__importDefault || function (mod) {
|
|
39775
39964
|
return mod && mod.__esModule ? mod : {
|
|
39776
39965
|
"default": mod
|
|
39777
39966
|
};
|
|
@@ -40233,6 +40422,7 @@ function (_Error) {
|
|
|
40233
40422
|
_classCallCheck(this, ParserError);
|
|
40234
40423
|
|
|
40235
40424
|
_this = _possibleConstructorReturn(this, _getPrototypeOf(ParserError).call(this, '[ParserError] ' + msg, filename, linenumber));
|
|
40425
|
+
_this.name = 'ParserError';
|
|
40236
40426
|
_this.code = 'ParserError';
|
|
40237
40427
|
if (Error.captureStackTrace) Error.captureStackTrace(_assertThisInitialized(_assertThisInitialized(_this)), ParserError);
|
|
40238
40428
|
return _this;
|
|
@@ -40356,7 +40546,7 @@ function () {
|
|
|
40356
40546
|
key: "return",
|
|
40357
40547
|
value: function _return(value) {
|
|
40358
40548
|
/* istanbul ignore next */
|
|
40359
|
-
if (
|
|
40549
|
+
if (this.stack.length === 0) throw this.error(new ParserError('Stack underflow'));
|
|
40360
40550
|
if (value === undefined) value = this.state.buf;
|
|
40361
40551
|
this.state = this.stack.pop();
|
|
40362
40552
|
this.state.returned = value;
|
|
@@ -40472,7 +40662,7 @@ var createDatetimeFloat = createCommonjsModule(function (module) {
|
|
|
40472
40662
|
var createDate = createCommonjsModule(function (module) {
|
|
40473
40663
|
'use strict';
|
|
40474
40664
|
|
|
40475
|
-
var DateTime =
|
|
40665
|
+
var DateTime = global.Date;
|
|
40476
40666
|
|
|
40477
40667
|
var Date =
|
|
40478
40668
|
/*#__PURE__*/
|
|
@@ -40569,6 +40759,7 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
40569
40759
|
_classCallCheck(this, TomlError);
|
|
40570
40760
|
|
|
40571
40761
|
_this = _possibleConstructorReturn(this, _getPrototypeOf(TomlError).call(this, msg));
|
|
40762
|
+
_this.name = 'TomlError';
|
|
40572
40763
|
/* istanbul ignore next */
|
|
40573
40764
|
|
|
40574
40765
|
if (Error.captureStackTrace) Error.captureStackTrace(_assertThisInitialized(_assertThisInitialized(_this)), TomlError);
|
|
@@ -40637,13 +40828,13 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
40637
40828
|
var SURROGATE_FIRST = 0xD800;
|
|
40638
40829
|
var SURROGATE_LAST = 0xDFFF;
|
|
40639
40830
|
var escapes = {
|
|
40640
|
-
[CHAR_b]: '\
|
|
40641
|
-
[CHAR_t]: '\
|
|
40642
|
-
[CHAR_n]: '\
|
|
40643
|
-
[CHAR_f]: '\
|
|
40644
|
-
[CHAR_r]: '\
|
|
40645
|
-
[CHAR_QUOT]: '\
|
|
40646
|
-
[CHAR_BSOL]: '\
|
|
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'
|
|
40647
40838
|
};
|
|
40648
40839
|
|
|
40649
40840
|
function isDigit(cp) {
|
|
@@ -40674,6 +40865,21 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
40674
40865
|
|
|
40675
40866
|
var _declared = Symbol('declared');
|
|
40676
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
|
+
|
|
40677
40883
|
var INLINE_TABLE = Symbol('inline-table');
|
|
40678
40884
|
|
|
40679
40885
|
function InlineTable() {
|
|
@@ -40744,10 +40950,18 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
40744
40950
|
} // in an eval, to let bundlers not slurp in a util proxy
|
|
40745
40951
|
|
|
40746
40952
|
|
|
40747
|
-
var
|
|
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
|
+
|
|
40748
40961
|
/* istanbul ignore next */
|
|
40749
40962
|
|
|
40750
|
-
|
|
40963
|
+
|
|
40964
|
+
var _inspect = _custom || 'inspect';
|
|
40751
40965
|
|
|
40752
40966
|
var BoxedBigInt =
|
|
40753
40967
|
/*#__PURE__*/
|
|
@@ -40756,7 +40970,7 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
40756
40970
|
_classCallCheck(this, BoxedBigInt);
|
|
40757
40971
|
|
|
40758
40972
|
try {
|
|
40759
|
-
this.value =
|
|
40973
|
+
this.value = global.BigInt.asIntN(64, value);
|
|
40760
40974
|
} catch (_) {
|
|
40761
40975
|
/* istanbul ignore next */
|
|
40762
40976
|
this.value = null;
|
|
@@ -40804,7 +41018,7 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
40804
41018
|
if (Object.is(num, -0)) num = 0;
|
|
40805
41019
|
/* istanbul ignore else */
|
|
40806
41020
|
|
|
40807
|
-
if (
|
|
41021
|
+
if (global.BigInt && !Number.isSafeInteger(num)) {
|
|
40808
41022
|
return new BoxedBigInt(_value);
|
|
40809
41023
|
} else {
|
|
40810
41024
|
/* istanbul ignore next */
|
|
@@ -40971,7 +41185,7 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
40971
41185
|
for (var _iterator = kv.key[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
40972
41186
|
var kw = _step.value;
|
|
40973
41187
|
|
|
40974
|
-
if (kw
|
|
41188
|
+
if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
|
|
40975
41189
|
throw this.error(new TomlError("Can't redefine existing key"));
|
|
40976
41190
|
}
|
|
40977
41191
|
|
|
@@ -40992,7 +41206,7 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
40992
41206
|
}
|
|
40993
41207
|
}
|
|
40994
41208
|
|
|
40995
|
-
if (finalKey
|
|
41209
|
+
if (hasKey(target, finalKey)) {
|
|
40996
41210
|
throw this.error(new TomlError("Can't redefine existing key"));
|
|
40997
41211
|
} // unbox our numbers
|
|
40998
41212
|
|
|
@@ -41110,7 +41324,7 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
41110
41324
|
if (this.char === CHAR_SP || this.char === CTRL_I) {
|
|
41111
41325
|
return null;
|
|
41112
41326
|
} else if (this.char === CHAR_RSQB) {
|
|
41113
|
-
if (
|
|
41327
|
+
if (hasKey(this.ctx, keyword) && (!isTable(this.ctx[keyword]) || this.ctx[keyword][_declared])) {
|
|
41114
41328
|
throw this.error(new TomlError("Can't redefine existing key"));
|
|
41115
41329
|
} else {
|
|
41116
41330
|
this.ctx = this.ctx[keyword] = this.ctx[keyword] || Table();
|
|
@@ -41119,7 +41333,7 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
41119
41333
|
|
|
41120
41334
|
return this.next(this.parseWhitespaceToEOL);
|
|
41121
41335
|
} else if (this.char === CHAR_PERIOD) {
|
|
41122
|
-
if (!(
|
|
41336
|
+
if (!hasKey(this.ctx, keyword)) {
|
|
41123
41337
|
this.ctx = this.ctx[keyword] = Table();
|
|
41124
41338
|
} else if (isTable(this.ctx[keyword])) {
|
|
41125
41339
|
this.ctx = this.ctx[keyword];
|
|
@@ -41157,7 +41371,7 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
41157
41371
|
if (this.char === CHAR_SP || this.char === CTRL_I) {
|
|
41158
41372
|
return null;
|
|
41159
41373
|
} else if (this.char === CHAR_RSQB) {
|
|
41160
|
-
if (!(
|
|
41374
|
+
if (!hasKey(this.ctx, keyword)) {
|
|
41161
41375
|
this.ctx[keyword] = List();
|
|
41162
41376
|
}
|
|
41163
41377
|
|
|
@@ -41173,7 +41387,7 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
41173
41387
|
|
|
41174
41388
|
return this.next(this.parseListEnd);
|
|
41175
41389
|
} else if (this.char === CHAR_PERIOD) {
|
|
41176
|
-
if (!(
|
|
41390
|
+
if (!hasKey(this.ctx, keyword)) {
|
|
41177
41391
|
this.ctx = this.ctx[keyword] = Table();
|
|
41178
41392
|
} else if (isInlineList(this.ctx[keyword])) {
|
|
41179
41393
|
throw this.error(new TomlError("Can't extend an inline array"));
|
|
@@ -41553,8 +41767,8 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
41553
41767
|
}
|
|
41554
41768
|
|
|
41555
41769
|
return this.returnNow(String.fromCodePoint(codePoint));
|
|
41556
|
-
} catch (
|
|
41557
|
-
throw this.error(TomlError.wrap(
|
|
41770
|
+
} catch (err) {
|
|
41771
|
+
throw this.error(TomlError.wrap(err));
|
|
41558
41772
|
}
|
|
41559
41773
|
}
|
|
41560
41774
|
}, {
|
|
@@ -41593,7 +41807,30 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
41593
41807
|
} else if (this.char === CHAR_n) {
|
|
41594
41808
|
return this.next(this.parseNan);
|
|
41595
41809
|
} else {
|
|
41596
|
-
return this.callNow(this.parseNoUnder, this.
|
|
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));
|
|
41597
41834
|
}
|
|
41598
41835
|
}
|
|
41599
41836
|
}, {
|
|
@@ -41623,9 +41860,9 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
41623
41860
|
}, {
|
|
41624
41861
|
key: "parseNoUnder",
|
|
41625
41862
|
value: function parseNoUnder() {
|
|
41626
|
-
if (this.char === CHAR_LOWBAR) {
|
|
41627
|
-
throw this.error(new TomlError('Unexpected character, expected digit
|
|
41628
|
-
} else if (this.atEndOfWord()
|
|
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()) {
|
|
41629
41866
|
throw this.error(new TomlError('Incomplete number'));
|
|
41630
41867
|
}
|
|
41631
41868
|
|
|
@@ -42200,7 +42437,7 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
42200
42437
|
for (var _iterator2 = kv.key[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
42201
42438
|
var kw = _step2.value;
|
|
42202
42439
|
|
|
42203
|
-
if (kw
|
|
42440
|
+
if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
|
|
42204
42441
|
throw this.error(new TomlError("Can't redefine existing key"));
|
|
42205
42442
|
}
|
|
42206
42443
|
|
|
@@ -42221,7 +42458,7 @@ var tomlParser = createCommonjsModule(function (module) {
|
|
|
42221
42458
|
}
|
|
42222
42459
|
}
|
|
42223
42460
|
|
|
42224
|
-
if (finalKey
|
|
42461
|
+
if (hasKey(target, finalKey)) {
|
|
42225
42462
|
throw this.error(new TomlError("Can't redefine existing key"));
|
|
42226
42463
|
}
|
|
42227
42464
|
|
|
@@ -42301,7 +42538,7 @@ function prettyError(err, buf) {
|
|
|
42301
42538
|
var parseString_1 = parseString;
|
|
42302
42539
|
|
|
42303
42540
|
function parseString(str) {
|
|
42304
|
-
if (
|
|
42541
|
+
if (global.Buffer && global.Buffer.isBuffer(str)) {
|
|
42305
42542
|
str = str.toString('utf8');
|
|
42306
42543
|
}
|
|
42307
42544
|
|
|
@@ -42310,8 +42547,8 @@ function parseString(str) {
|
|
|
42310
42547
|
try {
|
|
42311
42548
|
parser.parse(str);
|
|
42312
42549
|
return parser.finish();
|
|
42313
|
-
} catch (
|
|
42314
|
-
throw parsePrettyError(
|
|
42550
|
+
} catch (err) {
|
|
42551
|
+
throw parsePrettyError(err, str);
|
|
42315
42552
|
}
|
|
42316
42553
|
}
|
|
42317
42554
|
|
|
@@ -42489,7 +42726,8 @@ var resolveConfig_1 = createCommonjsModule(function (module) {
|
|
|
42489
42726
|
var patternList = [].concat(patterns);
|
|
42490
42727
|
var excludedPatternList = [].concat(excludedPatterns || []);
|
|
42491
42728
|
var opts = {
|
|
42492
|
-
matchBase: true
|
|
42729
|
+
matchBase: true,
|
|
42730
|
+
dot: true
|
|
42493
42731
|
};
|
|
42494
42732
|
return patternList.some(function (pattern) {
|
|
42495
42733
|
return minimatch_1(filePath, pattern, opts);
|