prettier 2.1.1 → 2.1.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 +3 -3
- package/doc.js +14 -4
- package/index.js +594 -575
- package/package.json +1 -1
- package/parser-babel.js +1 -1
- package/parser-flow.js +1 -1
- package/parser-html.js +15 -15
- package/parser-markdown.js +1 -1
- package/parser-postcss.js +2 -2
- package/parser-typescript.js +1 -1
- package/parser-yaml.js +1 -1
- package/standalone.js +2 -2
package/index.js
CHANGED
|
@@ -21,7 +21,7 @@ var stream__default = /*#__PURE__*/_interopDefaultLegacy(stream$6);
|
|
|
21
21
|
var events__default = /*#__PURE__*/_interopDefaultLegacy(events$1);
|
|
22
22
|
|
|
23
23
|
var name = "prettier";
|
|
24
|
-
var version = "2.1.
|
|
24
|
+
var version = "2.1.2";
|
|
25
25
|
var description = "Prettier is an opinionated code formatter";
|
|
26
26
|
var bin = "./bin/prettier.js";
|
|
27
27
|
var repository = "prettier/prettier";
|
|
@@ -101,7 +101,7 @@ var dependencies = {
|
|
|
101
101
|
"unicode-regex": "3.0.0",
|
|
102
102
|
unified: "9.2.0",
|
|
103
103
|
vnopts: "1.0.2",
|
|
104
|
-
"yaml-unist-parser": "1.3.
|
|
104
|
+
"yaml-unist-parser": "1.3.1"
|
|
105
105
|
};
|
|
106
106
|
var devDependencies = {
|
|
107
107
|
"@babel/core": "7.11.4",
|
|
@@ -136,7 +136,7 @@ var devDependencies = {
|
|
|
136
136
|
"jest-snapshot-serializer-raw": "1.1.0",
|
|
137
137
|
"jest-watch-typeahead": "0.6.0",
|
|
138
138
|
"npm-run-all": "4.1.5",
|
|
139
|
-
prettier: "2.1.
|
|
139
|
+
prettier: "2.1.1",
|
|
140
140
|
rimraf: "3.0.2",
|
|
141
141
|
rollup: "2.26.5",
|
|
142
142
|
"rollup-plugin-node-globals": "1.4.0",
|
|
@@ -4619,6 +4619,11 @@ var docPrinter = {
|
|
|
4619
4619
|
printDocToString
|
|
4620
4620
|
};
|
|
4621
4621
|
|
|
4622
|
+
const {
|
|
4623
|
+
literalline: literalline$1,
|
|
4624
|
+
concat: concat$2
|
|
4625
|
+
} = docBuilders; // Using a unique object to compare by reference.
|
|
4626
|
+
|
|
4622
4627
|
const traverseDocOnExitStackMarker = {};
|
|
4623
4628
|
|
|
4624
4629
|
function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
|
|
@@ -4895,6 +4900,10 @@ function normalizeDoc(doc) {
|
|
|
4895
4900
|
});
|
|
4896
4901
|
}
|
|
4897
4902
|
|
|
4903
|
+
function replaceNewlinesWithLiterallines(doc) {
|
|
4904
|
+
return mapDoc(doc, currentDoc => typeof currentDoc === "string" && currentDoc.includes("\n") ? concat$2(currentDoc.split(/(\n)/g).map((v, i) => i % 2 === 0 ? v : literalline$1)) : currentDoc);
|
|
4905
|
+
}
|
|
4906
|
+
|
|
4898
4907
|
var docUtils = {
|
|
4899
4908
|
isEmpty,
|
|
4900
4909
|
willBreak,
|
|
@@ -4906,7 +4915,8 @@ var docUtils = {
|
|
|
4906
4915
|
removeLines,
|
|
4907
4916
|
stripTrailingHardline,
|
|
4908
4917
|
normalizeParts,
|
|
4909
|
-
normalizeDoc
|
|
4918
|
+
normalizeDoc,
|
|
4919
|
+
replaceNewlinesWithLiterallines
|
|
4910
4920
|
};
|
|
4911
4921
|
|
|
4912
4922
|
function flattenDoc(doc) {
|
|
@@ -13791,7 +13801,7 @@ var massageAst = massageAST;
|
|
|
13791
13801
|
|
|
13792
13802
|
|
|
13793
13803
|
const {
|
|
13794
|
-
concat: concat$
|
|
13804
|
+
concat: concat$3,
|
|
13795
13805
|
line: line$1,
|
|
13796
13806
|
hardline: hardline$1,
|
|
13797
13807
|
breakParent: breakParent$1,
|
|
@@ -14139,10 +14149,10 @@ function printLeadingComment(commentPath, options) {
|
|
|
14139
14149
|
const lineBreak = hasNewline$1(options.originalText, options.locEnd(comment)) ? hasNewline$1(options.originalText, options.locStart(comment), {
|
|
14140
14150
|
backwards: true
|
|
14141
14151
|
}) ? hardline$1 : line$1 : " ";
|
|
14142
|
-
return concat$
|
|
14152
|
+
return concat$3([contents, lineBreak]);
|
|
14143
14153
|
}
|
|
14144
14154
|
|
|
14145
|
-
return concat$
|
|
14155
|
+
return concat$3([contents, hardline$1]);
|
|
14146
14156
|
}
|
|
14147
14157
|
|
|
14148
14158
|
function printTrailingComment(commentPath, options) {
|
|
@@ -14176,13 +14186,13 @@ function printTrailingComment(commentPath, options) {
|
|
|
14176
14186
|
// if this a comment on its own line; normal trailing comments are
|
|
14177
14187
|
// always at the end of another expression.
|
|
14178
14188
|
const isLineBeforeEmpty = isPreviousLineEmpty$1(originalText, comment, locStart);
|
|
14179
|
-
return lineSuffix$1(concat$
|
|
14189
|
+
return lineSuffix$1(concat$3([hardline$1, isLineBeforeEmpty ? hardline$1 : "", contents]));
|
|
14180
14190
|
}
|
|
14181
14191
|
|
|
14182
|
-
let printed = concat$
|
|
14192
|
+
let printed = concat$3([" ", contents]); // Trailing block comments never need a newline
|
|
14183
14193
|
|
|
14184
14194
|
if (!isBlock) {
|
|
14185
|
-
printed = concat$
|
|
14195
|
+
printed = concat$3([lineSuffix$1(printed), breakParent$1]);
|
|
14186
14196
|
}
|
|
14187
14197
|
|
|
14188
14198
|
return printed;
|
|
@@ -14212,12 +14222,12 @@ function printDanglingComments(path, options, sameIndent, filter) {
|
|
|
14212
14222
|
return join$1(hardline$1, parts);
|
|
14213
14223
|
}
|
|
14214
14224
|
|
|
14215
|
-
return indent$1(concat$
|
|
14225
|
+
return indent$1(concat$3([hardline$1, join$1(hardline$1, parts)]));
|
|
14216
14226
|
}
|
|
14217
14227
|
|
|
14218
14228
|
function prependCursorPlaceholder(path, options, printed) {
|
|
14219
14229
|
if (path.getNode() === options.cursorNode && path.getValue()) {
|
|
14220
|
-
return concat$
|
|
14230
|
+
return concat$3([cursor$2, printed, cursor$2]);
|
|
14221
14231
|
}
|
|
14222
14232
|
|
|
14223
14233
|
return printed;
|
|
@@ -14260,7 +14270,7 @@ function printComments(path, print, options, needsSemi) {
|
|
|
14260
14270
|
trailingParts.push(printTrailingComment(commentPath, options));
|
|
14261
14271
|
}
|
|
14262
14272
|
}, "comments");
|
|
14263
|
-
return prependCursorPlaceholder(path, options, concat$
|
|
14273
|
+
return prependCursorPlaceholder(path, options, concat$3(leadingParts.concat(trailingParts)));
|
|
14264
14274
|
}
|
|
14265
14275
|
|
|
14266
14276
|
function ensureAllCommentsPrinted(astComments) {
|
|
@@ -14538,7 +14548,7 @@ var multiparser = {
|
|
|
14538
14548
|
const doc = document;
|
|
14539
14549
|
const docBuilders$1 = doc.builders;
|
|
14540
14550
|
const {
|
|
14541
|
-
concat: concat$
|
|
14551
|
+
concat: concat$4,
|
|
14542
14552
|
hardline: hardline$2,
|
|
14543
14553
|
addAlignmentToDoc: addAlignmentToDoc$1
|
|
14544
14554
|
} = docBuilders$1;
|
|
@@ -14608,7 +14618,7 @@ function printAstToDoc(ast, options, alignmentSize = 0) {
|
|
|
14608
14618
|
if (alignmentSize > 0) {
|
|
14609
14619
|
// Add a hardline to make the indents take effect
|
|
14610
14620
|
// It should be removed in index.js format()
|
|
14611
|
-
doc = addAlignmentToDoc$1(concat$
|
|
14621
|
+
doc = addAlignmentToDoc$1(concat$4([hardline$2, doc]), alignmentSize, options.tabWidth);
|
|
14612
14622
|
}
|
|
14613
14623
|
|
|
14614
14624
|
docUtils$1.propagateBreaks(doc);
|
|
@@ -37733,13 +37743,14 @@ const {
|
|
|
37733
37743
|
line: line$3,
|
|
37734
37744
|
hardline: hardline$3,
|
|
37735
37745
|
softline: softline$1,
|
|
37736
|
-
literalline: literalline$
|
|
37737
|
-
concat: concat$
|
|
37746
|
+
literalline: literalline$2,
|
|
37747
|
+
concat: concat$5,
|
|
37738
37748
|
group: group$1,
|
|
37739
37749
|
dedentToRoot: dedentToRoot$1
|
|
37740
37750
|
},
|
|
37741
37751
|
utils: {
|
|
37742
|
-
mapDoc: mapDoc$1
|
|
37752
|
+
mapDoc: mapDoc$1,
|
|
37753
|
+
replaceNewlinesWithLiterallines: replaceNewlinesWithLiterallines$1
|
|
37743
37754
|
}
|
|
37744
37755
|
} = document;
|
|
37745
37756
|
const {
|
|
@@ -37843,11 +37854,11 @@ function embed(path, print, textToDoc, options) {
|
|
|
37843
37854
|
}
|
|
37844
37855
|
|
|
37845
37856
|
if (expressionDoc) {
|
|
37846
|
-
parts.push(concat$
|
|
37857
|
+
parts.push(concat$5(["${", expressionDoc, "}"]));
|
|
37847
37858
|
}
|
|
37848
37859
|
}
|
|
37849
37860
|
|
|
37850
|
-
return concat$
|
|
37861
|
+
return concat$5(["`", indent$2(concat$5([hardline$3, join$2(hardline$3, parts)])), hardline$3, "`"]);
|
|
37851
37862
|
}
|
|
37852
37863
|
|
|
37853
37864
|
const htmlParser = isHtml(path) ? "html" : isAngularComponentTemplate(path) ? "angular" : undefined;
|
|
@@ -37869,7 +37880,7 @@ function embed(path, print, textToDoc, options) {
|
|
|
37869
37880
|
const text = parent.quasis[0].value.raw.replace(/((?:\\\\)*)\\`/g, (_, backslashes) => "\\".repeat(backslashes.length / 2) + "`");
|
|
37870
37881
|
const indentation = getIndentation(text);
|
|
37871
37882
|
const hasIndent = indentation !== "";
|
|
37872
|
-
return concat$
|
|
37883
|
+
return concat$5([hasIndent ? indent$2(concat$5([softline$1, printMarkdown(text.replace(new RegExp(`^${indentation}`, "gm"), ""))])) : concat$5([literalline$2, dedentToRoot$1(printMarkdown(text))]), softline$1]);
|
|
37873
37884
|
}
|
|
37874
37885
|
|
|
37875
37886
|
break;
|
|
@@ -37931,7 +37942,7 @@ function transformCssDoc(quasisDoc, path, print) {
|
|
|
37931
37942
|
throw new Error("Couldn't insert all the expressions");
|
|
37932
37943
|
}
|
|
37933
37944
|
|
|
37934
|
-
return concat$
|
|
37945
|
+
return concat$5(["`", indent$2(concat$5([hardline$3, newDoc])), softline$1, "`"]);
|
|
37935
37946
|
} // Search all the placeholders in the quasisDoc tree
|
|
37936
37947
|
// and replace them with the expression docs one by one
|
|
37937
37948
|
// returns a new doc with all the placeholders replaced,
|
|
@@ -37975,7 +37986,7 @@ function replacePlaceholders(quasisDoc, expressionDocs) {
|
|
|
37975
37986
|
part.split(/@prettier-placeholder-(\d+)-id/).forEach((component, idx) => {
|
|
37976
37987
|
// The placeholder is always at odd indices
|
|
37977
37988
|
if (idx % 2 === 0) {
|
|
37978
|
-
replacedParts.push(component);
|
|
37989
|
+
replacedParts.push(replaceNewlinesWithLiterallines$1(component));
|
|
37979
37990
|
return;
|
|
37980
37991
|
} // The component will always be a number at odd index
|
|
37981
37992
|
|
|
@@ -38004,7 +38015,7 @@ function printGraphqlComments(lines) {
|
|
|
38004
38015
|
if (array[i - 1] === "" && seenComment) {
|
|
38005
38016
|
// If a non-first comment is preceded by a blank (whitespace only) line,
|
|
38006
38017
|
// add in a blank line.
|
|
38007
|
-
parts.push(concat$
|
|
38018
|
+
parts.push(concat$5([hardline$3, textLine]));
|
|
38008
38019
|
} else {
|
|
38009
38020
|
parts.push(textLine);
|
|
38010
38021
|
}
|
|
@@ -38200,20 +38211,20 @@ function printHtmlTemplateLiteral(path, print, textToDoc, parser, options) {
|
|
|
38200
38211
|
}
|
|
38201
38212
|
|
|
38202
38213
|
const placeholderIndex = +component;
|
|
38203
|
-
parts.push(concat$
|
|
38214
|
+
parts.push(concat$5(["${", group$1(expressionDocs[placeholderIndex]), "}"]));
|
|
38204
38215
|
}
|
|
38205
38216
|
|
|
38206
|
-
return concat$
|
|
38217
|
+
return concat$5(parts);
|
|
38207
38218
|
});
|
|
38208
38219
|
const leadingWhitespace = /^\s/.test(text) ? " " : "";
|
|
38209
38220
|
const trailingWhitespace = /\s$/.test(text) ? " " : "";
|
|
38210
38221
|
const linebreak = options.htmlWhitespaceSensitivity === "ignore" ? hardline$3 : leadingWhitespace && trailingWhitespace ? line$3 : null;
|
|
38211
38222
|
|
|
38212
38223
|
if (linebreak) {
|
|
38213
|
-
return group$1(concat$
|
|
38224
|
+
return group$1(concat$5(["`", indent$2(concat$5([linebreak, group$1(contentDoc)])), linebreak, "`"]));
|
|
38214
38225
|
}
|
|
38215
38226
|
|
|
38216
|
-
return group$1(concat$
|
|
38227
|
+
return group$1(concat$5(["`", leadingWhitespace, topLevelCount > 1 ? indent$2(group$1(contentDoc)) : group$1(contentDoc), trailingWhitespace, "`"]));
|
|
38217
38228
|
}
|
|
38218
38229
|
|
|
38219
38230
|
var embed_1 = embed;
|
|
@@ -40985,7 +40996,7 @@ var needsParens_1 = needsParens;
|
|
|
40985
40996
|
|
|
40986
40997
|
const {
|
|
40987
40998
|
builders: {
|
|
40988
|
-
concat: concat$
|
|
40999
|
+
concat: concat$6,
|
|
40989
41000
|
join: join$3,
|
|
40990
41001
|
line: line$4
|
|
40991
41002
|
}
|
|
@@ -41007,12 +41018,12 @@ function printHtmlBinding(path, options, print) {
|
|
|
41007
41018
|
const {
|
|
41008
41019
|
params
|
|
41009
41020
|
} = functionDeclarationPath.getValue();
|
|
41010
|
-
return concat$
|
|
41021
|
+
return concat$6([params.length > 1 ? "(" : "", join$3(concat$6([",", line$4]), functionDeclarationPath.map(print, "params")), params.length > 1 ? ")" : ""]);
|
|
41011
41022
|
}, "program", "body", 0);
|
|
41012
41023
|
}
|
|
41013
41024
|
|
|
41014
41025
|
if (options.__isVueSlotScope) {
|
|
41015
|
-
return path.call(functionDeclarationPath => join$3(concat$
|
|
41026
|
+
return path.call(functionDeclarationPath => join$3(concat$6([",", line$4]), functionDeclarationPath.map(print, "params")), "program", "body", 0);
|
|
41016
41027
|
}
|
|
41017
41028
|
} // based on https://github.com/prettier/prettier/blob/master/src/language-html/syntax-vue.js isVueEventBindingExpression()
|
|
41018
41029
|
|
|
@@ -41078,7 +41089,7 @@ const {
|
|
|
41078
41089
|
} = utils$6;
|
|
41079
41090
|
const {
|
|
41080
41091
|
builders: {
|
|
41081
|
-
concat: concat$
|
|
41092
|
+
concat: concat$7,
|
|
41082
41093
|
line: line$5,
|
|
41083
41094
|
hardline: hardline$4,
|
|
41084
41095
|
softline: softline$2,
|
|
@@ -41099,14 +41110,14 @@ function printCallArguments(path, options, print) {
|
|
|
41099
41110
|
const args = isDynamicImport ? [node.source] : node.arguments;
|
|
41100
41111
|
|
|
41101
41112
|
if (args.length === 0) {
|
|
41102
|
-
return concat$
|
|
41113
|
+
return concat$7(["(", comments.printDanglingComments(path, options,
|
|
41103
41114
|
/* sameIndent */
|
|
41104
41115
|
true), ")"]);
|
|
41105
41116
|
} // useEffect(() => { ... }, [foo, bar, baz])
|
|
41106
41117
|
|
|
41107
41118
|
|
|
41108
41119
|
if (args.length === 2 && args[0].type === "ArrowFunctionExpression" && args[0].params.length === 0 && args[0].body.type === "BlockStatement" && args[1].type === "ArrayExpression" && !args.some(arg => arg.comments)) {
|
|
41109
|
-
return concat$
|
|
41120
|
+
return concat$7(["(", path.call(print, "arguments", 0), ", ", path.call(print, "arguments", 1), ")"]);
|
|
41110
41121
|
} // func(
|
|
41111
41122
|
// ({
|
|
41112
41123
|
// a,
|
|
@@ -41123,7 +41134,7 @@ function printCallArguments(path, options, print) {
|
|
|
41123
41134
|
|
|
41124
41135
|
let shouldBreak = false;
|
|
41125
41136
|
argPath.each(paramPath => {
|
|
41126
|
-
const printed = concat$
|
|
41137
|
+
const printed = concat$7([print(paramPath)]);
|
|
41127
41138
|
shouldBreak = shouldBreak || willBreak$1(printed);
|
|
41128
41139
|
}, "params");
|
|
41129
41140
|
return shouldBreak;
|
|
@@ -41150,7 +41161,7 @@ function printCallArguments(path, options, print) {
|
|
|
41150
41161
|
}
|
|
41151
41162
|
|
|
41152
41163
|
shouldBreakForArrowFunction = shouldBreakForArrowFunctionInArguments(arg, argPath);
|
|
41153
|
-
return concat$
|
|
41164
|
+
return concat$7(parts);
|
|
41154
41165
|
};
|
|
41155
41166
|
|
|
41156
41167
|
const printedArguments = isDynamicImport ? [path.call(path => printArgument(path, 0), "source")] : path.map(printArgument, "arguments");
|
|
@@ -41158,7 +41169,7 @@ function printCallArguments(path, options, print) {
|
|
|
41158
41169
|
!(isDynamicImport || node.callee && node.callee.type === "Import") && shouldPrintComma$1(options, "all") ? "," : "";
|
|
41159
41170
|
|
|
41160
41171
|
function allArgsBrokenOut() {
|
|
41161
|
-
return group$2(concat$
|
|
41172
|
+
return group$2(concat$7(["(", indent$3(concat$7([line$5, concat$7(printedArguments)])), maybeTrailingComma, line$5, ")"]), {
|
|
41162
41173
|
shouldBreak: true
|
|
41163
41174
|
});
|
|
41164
41175
|
}
|
|
@@ -41178,7 +41189,7 @@ function printCallArguments(path, options, print) {
|
|
|
41178
41189
|
|
|
41179
41190
|
const printArgument = argPath => {
|
|
41180
41191
|
if (shouldGroupFirst && i === 0) {
|
|
41181
|
-
printedExpanded = [concat$
|
|
41192
|
+
printedExpanded = [concat$7([argPath.call(p => print(p, {
|
|
41182
41193
|
expandFirstArg: true
|
|
41183
41194
|
})), printedArguments.length > 1 ? "," : "", hasEmptyLineFollowingFirstArg ? hardline$4 : line$5, hasEmptyLineFollowingFirstArg ? hardline$4 : ""])].concat(printedArguments.slice(1));
|
|
41184
41195
|
}
|
|
@@ -41199,17 +41210,17 @@ function printCallArguments(path, options, print) {
|
|
|
41199
41210
|
}
|
|
41200
41211
|
|
|
41201
41212
|
const somePrintedArgumentsWillBreak = printedArguments.some(willBreak$1);
|
|
41202
|
-
const simpleConcat = concat$
|
|
41203
|
-
return concat$
|
|
41213
|
+
const simpleConcat = concat$7(["(", concat$7(printedExpanded), ")"]);
|
|
41214
|
+
return concat$7([somePrintedArgumentsWillBreak ? breakParent$2 : "", conditionalGroup$1([!somePrintedArgumentsWillBreak && !node.typeArguments && !node.typeParameters ? simpleConcat : ifBreak$1(allArgsBrokenOut(), simpleConcat), shouldGroupFirst ? concat$7(["(", group$2(printedExpanded[0], {
|
|
41204
41215
|
shouldBreak: true
|
|
41205
|
-
}), concat$
|
|
41216
|
+
}), concat$7(printedExpanded.slice(1)), ")"]) : concat$7(["(", concat$7(printedArguments.slice(0, -1)), group$2(getLast$3(printedExpanded), {
|
|
41206
41217
|
shouldBreak: true
|
|
41207
41218
|
}), ")"]), allArgsBrokenOut()], {
|
|
41208
41219
|
shouldBreak
|
|
41209
41220
|
})]);
|
|
41210
41221
|
}
|
|
41211
41222
|
|
|
41212
|
-
const contents = concat$
|
|
41223
|
+
const contents = concat$7(["(", indent$3(concat$7([softline$2, concat$7(printedArguments)])), ifBreak$1(maybeTrailingComma), softline$2, ")"]);
|
|
41213
41224
|
|
|
41214
41225
|
if (isLongCurriedCallExpression$1(path)) {
|
|
41215
41226
|
// By not wrapping the arguments in a group, the printer prioritizes
|
|
@@ -41261,7 +41272,7 @@ const {
|
|
|
41261
41272
|
} = utils$6;
|
|
41262
41273
|
const {
|
|
41263
41274
|
builders: {
|
|
41264
|
-
concat: concat$
|
|
41275
|
+
concat: concat$8,
|
|
41265
41276
|
softline: softline$3,
|
|
41266
41277
|
group: group$3,
|
|
41267
41278
|
indent: indent$4
|
|
@@ -41304,18 +41315,18 @@ function printMemberLookup(path, options, print) {
|
|
|
41304
41315
|
const optional = printOptionalToken(path);
|
|
41305
41316
|
|
|
41306
41317
|
if (!n.computed) {
|
|
41307
|
-
return concat$
|
|
41318
|
+
return concat$8([optional, ".", property]);
|
|
41308
41319
|
}
|
|
41309
41320
|
|
|
41310
41321
|
if (!n.property || isNumericLiteral$1(n.property)) {
|
|
41311
|
-
return concat$
|
|
41322
|
+
return concat$8([optional, "[", property, "]"]);
|
|
41312
41323
|
}
|
|
41313
41324
|
|
|
41314
|
-
return group$3(concat$
|
|
41325
|
+
return group$3(concat$8([optional, "[", indent$4(concat$8([softline$3, property])), softline$3, "]"]));
|
|
41315
41326
|
}
|
|
41316
41327
|
|
|
41317
41328
|
function printBindExpressionCallee(path, options, print) {
|
|
41318
|
-
return concat$
|
|
41329
|
+
return concat$8(["::", path.call(print, "callee")]);
|
|
41319
41330
|
}
|
|
41320
41331
|
|
|
41321
41332
|
var misc = {
|
|
@@ -41343,7 +41354,7 @@ const {
|
|
|
41343
41354
|
} = utils$6;
|
|
41344
41355
|
const {
|
|
41345
41356
|
builders: {
|
|
41346
|
-
concat: concat$
|
|
41357
|
+
concat: concat$9,
|
|
41347
41358
|
join: join$4,
|
|
41348
41359
|
hardline: hardline$5,
|
|
41349
41360
|
group: group$4,
|
|
@@ -41406,7 +41417,7 @@ function printMemberChain(path, options, print) {
|
|
|
41406
41417
|
if (isCallOrOptionalCallExpression$1(node) && (isMemberish$1(node.callee) || isCallOrOptionalCallExpression$1(node.callee))) {
|
|
41407
41418
|
printedNodes.unshift({
|
|
41408
41419
|
node,
|
|
41409
|
-
printed: concat$
|
|
41420
|
+
printed: concat$9([comments.printComments(path, () => concat$9([printOptionalToken$1(path), printFunctionTypeParameters$1(path, options, print), callArguments(path, options, print)]), options), shouldInsertEmptyLineAfter(node) ? hardline$5 : ""])
|
|
41410
41421
|
});
|
|
41411
41422
|
path.call(callee => rec(callee), "callee");
|
|
41412
41423
|
} else if (isMemberish$1(node)) {
|
|
@@ -41436,7 +41447,7 @@ function printMemberChain(path, options, print) {
|
|
|
41436
41447
|
const node = path.getValue();
|
|
41437
41448
|
printedNodes.unshift({
|
|
41438
41449
|
node,
|
|
41439
|
-
printed: concat$
|
|
41450
|
+
printed: concat$9([printOptionalToken$1(path), printFunctionTypeParameters$1(path, options, print), callArguments(path, options, print)])
|
|
41440
41451
|
});
|
|
41441
41452
|
|
|
41442
41453
|
if (node.callee) {
|
|
@@ -41573,10 +41584,10 @@ function printMemberChain(path, options, print) {
|
|
|
41573
41584
|
// accordingly
|
|
41574
41585
|
|
|
41575
41586
|
if (printedGroup.length > 0 && printedGroup[printedGroup.length - 1].needsParens) {
|
|
41576
|
-
return concat$
|
|
41587
|
+
return concat$9(["(", ...printed, ")"]);
|
|
41577
41588
|
}
|
|
41578
41589
|
|
|
41579
|
-
return concat$
|
|
41590
|
+
return concat$9(printed);
|
|
41580
41591
|
}
|
|
41581
41592
|
|
|
41582
41593
|
function printIndentedGroup(groups) {
|
|
@@ -41585,11 +41596,11 @@ function printMemberChain(path, options, print) {
|
|
|
41585
41596
|
return "";
|
|
41586
41597
|
}
|
|
41587
41598
|
|
|
41588
|
-
return indent$5(group$4(concat$
|
|
41599
|
+
return indent$5(group$4(concat$9([hardline$5, join$4(hardline$5, groups.map(printGroup))])));
|
|
41589
41600
|
}
|
|
41590
41601
|
|
|
41591
41602
|
const printedGroups = groups.map(printGroup);
|
|
41592
|
-
const oneLine = concat$
|
|
41603
|
+
const oneLine = concat$9(printedGroups);
|
|
41593
41604
|
const cutoff = shouldMerge ? 3 : 2;
|
|
41594
41605
|
const flatGroups = flatten_1(groups);
|
|
41595
41606
|
const hasComment = flatGroups.slice(1, -1).some(node => hasLeadingComment$4(node.node)) || flatGroups.slice(0, -1).some(node => hasTrailingComment$2(node.node)) || groups[cutoff] && hasLeadingComment$4(groups[cutoff][0].node); // If we only have a single `.`, we shouldn't do anything fancy and just
|
|
@@ -41607,7 +41618,7 @@ function printMemberChain(path, options, print) {
|
|
|
41607
41618
|
|
|
41608
41619
|
const lastNodeBeforeIndent = getLast$4(groups[shouldMerge ? 1 : 0]).node;
|
|
41609
41620
|
const shouldHaveEmptyLineBeforeIndent = !isCallOrOptionalCallExpression$1(lastNodeBeforeIndent) && shouldInsertEmptyLineAfter(lastNodeBeforeIndent);
|
|
41610
|
-
const expanded = concat$
|
|
41621
|
+
const expanded = concat$9([printGroup(groups[0]), shouldMerge ? concat$9(groups.slice(1, 2).map(printGroup)) : "", shouldHaveEmptyLineBeforeIndent ? hardline$5 : "", printIndentedGroup(groups.slice(shouldMerge ? 2 : 1))]);
|
|
41611
41622
|
const callExpressions = printedNodes.map(({
|
|
41612
41623
|
node
|
|
41613
41624
|
}) => node).filter(isCallOrOptionalCallExpression$1);
|
|
@@ -41628,7 +41639,7 @@ function printMemberChain(path, options, print) {
|
|
|
41628
41639
|
return group$4(expanded);
|
|
41629
41640
|
}
|
|
41630
41641
|
|
|
41631
|
-
return concat$
|
|
41642
|
+
return concat$9([// We only need to check `oneLine` because if `expanded` is chosen
|
|
41632
41643
|
// that means that the parent group has already been broken
|
|
41633
41644
|
// naturally
|
|
41634
41645
|
willBreak$2(oneLine) || shouldHaveEmptyLineBeforeIndent ? breakParent$3 : "", conditionalGroup$2([oneLine, expanded])]);
|
|
@@ -41638,7 +41649,7 @@ var memberChain = printMemberChain;
|
|
|
41638
41649
|
|
|
41639
41650
|
const {
|
|
41640
41651
|
builders: {
|
|
41641
|
-
concat: concat$
|
|
41652
|
+
concat: concat$a,
|
|
41642
41653
|
softline: softline$4,
|
|
41643
41654
|
group: group$5,
|
|
41644
41655
|
indent: indent$6,
|
|
@@ -41656,7 +41667,7 @@ const {
|
|
|
41656
41667
|
|
|
41657
41668
|
function printModuleSource(path, options, print) {
|
|
41658
41669
|
const node = path.getValue();
|
|
41659
|
-
return node.source ? concat$
|
|
41670
|
+
return node.source ? concat$a([" from ", path.call(print, "source")]) : "";
|
|
41660
41671
|
}
|
|
41661
41672
|
|
|
41662
41673
|
function printModuleSpecifiers(path, options, print) {
|
|
@@ -41690,16 +41701,16 @@ function printModuleSpecifiers(path, options, print) {
|
|
|
41690
41701
|
const canBreak = groupedSpecifiers.length > 1 || standalonesSpecifiers.length > 0 || node.specifiers.some(node => node.comments);
|
|
41691
41702
|
|
|
41692
41703
|
if (canBreak) {
|
|
41693
|
-
parts.push(group$5(concat$
|
|
41704
|
+
parts.push(group$5(concat$a(["{", indent$6(concat$a([options.bracketSpacing ? line$6 : softline$4, join$5(concat$a([",", line$6]), groupedSpecifiers)])), ifBreak$2(shouldPrintComma$2(options) ? "," : ""), options.bracketSpacing ? line$6 : softline$4, "}"])));
|
|
41694
41705
|
} else {
|
|
41695
|
-
parts.push(concat$
|
|
41706
|
+
parts.push(concat$a(["{", options.bracketSpacing ? " " : "", concat$a(groupedSpecifiers), options.bracketSpacing ? " " : "", "}"]));
|
|
41696
41707
|
}
|
|
41697
41708
|
}
|
|
41698
41709
|
} else {
|
|
41699
41710
|
parts.push("{}");
|
|
41700
41711
|
}
|
|
41701
41712
|
|
|
41702
|
-
return concat$
|
|
41713
|
+
return concat$a(parts);
|
|
41703
41714
|
}
|
|
41704
41715
|
|
|
41705
41716
|
var module$2 = {
|
|
@@ -41715,7 +41726,7 @@ const {
|
|
|
41715
41726
|
} = util;
|
|
41716
41727
|
const {
|
|
41717
41728
|
builders: {
|
|
41718
|
-
concat: concat$
|
|
41729
|
+
concat: concat$b,
|
|
41719
41730
|
line: line$7,
|
|
41720
41731
|
softline: softline$5,
|
|
41721
41732
|
group: group$6,
|
|
@@ -41881,7 +41892,7 @@ function printTernaryOperator(path, options, print, operatorOptions) {
|
|
|
41881
41892
|
// parens when using ?: within JSX, because the parens are analogous to
|
|
41882
41893
|
// curly braces in an if statement.
|
|
41883
41894
|
|
|
41884
|
-
const wrap = doc => concat$
|
|
41895
|
+
const wrap = doc => concat$b([ifBreak$3("(", ""), indent$7(concat$b([softline$5, doc])), softline$5, ifBreak$3(")", "")]); // The only things we don't wrap are:
|
|
41885
41896
|
// * Nested conditional expressions in alternates
|
|
41886
41897
|
// * null
|
|
41887
41898
|
// * undefined
|
|
@@ -41892,7 +41903,7 @@ function printTernaryOperator(path, options, print, operatorOptions) {
|
|
|
41892
41903
|
parts.push(" ? ", isNil(consequentNode) ? path.call(print, operatorOptions.consequentNodePropertyName) : wrap(path.call(print, operatorOptions.consequentNodePropertyName)), " : ", alternateNode.type === operatorOptions.conditionalNodeType || isNil(alternateNode) ? path.call(print, operatorOptions.alternateNodePropertyName) : wrap(path.call(print, operatorOptions.alternateNodePropertyName)));
|
|
41893
41904
|
} else {
|
|
41894
41905
|
// normal mode
|
|
41895
|
-
const part = concat$
|
|
41906
|
+
const part = concat$b([line$7, "? ", consequentNode.type === operatorOptions.conditionalNodeType ? ifBreak$3("", "(") : "", align$1(2, path.call(print, operatorOptions.consequentNodePropertyName)), consequentNode.type === operatorOptions.conditionalNodeType ? ifBreak$3("", ")") : "", line$7, ": ", alternateNode.type === operatorOptions.conditionalNodeType ? path.call(print, operatorOptions.alternateNodePropertyName) : align$1(2, path.call(print, operatorOptions.alternateNodePropertyName))]);
|
|
41896
41907
|
parts.push(parent.type !== operatorOptions.conditionalNodeType || parent[operatorOptions.alternateNodePropertyName] === node || isParentTest ? part : options.useTabs ? dedent$1(indent$7(part)) : align$1(Math.max(0, options.tabWidth - 2), part));
|
|
41897
41908
|
} // We want a whole chain of ConditionalExpressions to all
|
|
41898
41909
|
// break if any of them break. That means we should only group around the
|
|
@@ -41904,7 +41915,7 @@ function printTernaryOperator(path, options, print, operatorOptions) {
|
|
|
41904
41915
|
|
|
41905
41916
|
const maybeGroup = doc => parent === firstNonConditionalParent ? group$6(doc, {
|
|
41906
41917
|
shouldBreak
|
|
41907
|
-
}) : shouldBreak ? concat$
|
|
41918
|
+
}) : shouldBreak ? concat$b([doc, breakParent$4]) : doc; // Break the closing paren to keep the chain right after it:
|
|
41908
41919
|
// (a
|
|
41909
41920
|
// ? b
|
|
41910
41921
|
// : c
|
|
@@ -41912,7 +41923,7 @@ function printTernaryOperator(path, options, print, operatorOptions) {
|
|
|
41912
41923
|
|
|
41913
41924
|
|
|
41914
41925
|
const breakClosingParen = !jsxMode && (parent.type === "MemberExpression" || parent.type === "OptionalMemberExpression" || parent.type === "NGPipeExpression" && parent.left === node) && !parent.computed;
|
|
41915
|
-
const result = maybeGroup(concat$
|
|
41926
|
+
const result = maybeGroup(concat$b([].concat((testDoc =>
|
|
41916
41927
|
/**
|
|
41917
41928
|
* a
|
|
41918
41929
|
* ? b
|
|
@@ -41923,8 +41934,8 @@ function printTernaryOperator(path, options, print, operatorOptions) {
|
|
|
41923
41934
|
* ? d
|
|
41924
41935
|
* : e
|
|
41925
41936
|
*/
|
|
41926
|
-
parent.type === operatorOptions.conditionalNodeType && parent[operatorOptions.alternateNodePropertyName] === node ? align$1(2, testDoc) : testDoc)(concat$
|
|
41927
|
-
return isParentTest ? group$6(concat$
|
|
41937
|
+
parent.type === operatorOptions.conditionalNodeType && parent[operatorOptions.alternateNodePropertyName] === node ? align$1(2, testDoc) : testDoc)(concat$b(operatorOptions.beforeParts())), forceNoIndent ? concat$b(parts) : indent$7(concat$b(parts)), operatorOptions.afterParts(breakClosingParen))));
|
|
41938
|
+
return isParentTest ? group$6(concat$b([indent$7(concat$b([softline$5, result])), softline$5])) : result;
|
|
41928
41939
|
}
|
|
41929
41940
|
|
|
41930
41941
|
var ternary = printTernaryOperator;
|
|
@@ -41954,12 +41965,12 @@ const {
|
|
|
41954
41965
|
} = utilShared;
|
|
41955
41966
|
const {
|
|
41956
41967
|
builders: {
|
|
41957
|
-
concat: concat$
|
|
41968
|
+
concat: concat$c,
|
|
41958
41969
|
join: join$6,
|
|
41959
41970
|
line: line$8,
|
|
41960
41971
|
hardline: hardline$6,
|
|
41961
41972
|
softline: softline$6,
|
|
41962
|
-
literalline: literalline$
|
|
41973
|
+
literalline: literalline$3,
|
|
41963
41974
|
group: group$7,
|
|
41964
41975
|
indent: indent$8,
|
|
41965
41976
|
align: align$2,
|
|
@@ -42130,15 +42141,15 @@ function genericPrint(path, options, printPath, args) {
|
|
|
42130
42141
|
}
|
|
42131
42142
|
|
|
42132
42143
|
if (decorators.length > 0) {
|
|
42133
|
-
return group$7(concat$
|
|
42144
|
+
return group$7(concat$c(decorators.concat(parts)));
|
|
42134
42145
|
}
|
|
42135
42146
|
|
|
42136
|
-
return concat$
|
|
42147
|
+
return concat$c(parts);
|
|
42137
42148
|
}
|
|
42138
42149
|
|
|
42139
42150
|
function printDecorators(path, options, print) {
|
|
42140
42151
|
const node = path.getValue();
|
|
42141
|
-
return group$7(concat$
|
|
42152
|
+
return group$7(concat$c([join$6(line$8, path.map(print, "decorators")), hasNewlineBetweenOrAfterDecorators$1(node, options) ? hardline$6 : line$8]));
|
|
42142
42153
|
}
|
|
42143
42154
|
|
|
42144
42155
|
function printPathNoParens(path, options, print, args) {
|
|
@@ -42168,7 +42179,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42168
42179
|
return path.call(print, "node");
|
|
42169
42180
|
|
|
42170
42181
|
case "JsonRoot":
|
|
42171
|
-
return concat$
|
|
42182
|
+
return concat$c([path.call(print, "node"), hardline$6]);
|
|
42172
42183
|
|
|
42173
42184
|
case "File":
|
|
42174
42185
|
// Print @babel/parser's InterpreterDirective here so that
|
|
@@ -42178,7 +42189,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42178
42189
|
}
|
|
42179
42190
|
|
|
42180
42191
|
parts.push(path.call(print, "program"));
|
|
42181
|
-
return concat$
|
|
42192
|
+
return concat$c(parts);
|
|
42182
42193
|
|
|
42183
42194
|
case "Program":
|
|
42184
42195
|
{
|
|
@@ -42208,7 +42219,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42208
42219
|
parts.push(hardline$6);
|
|
42209
42220
|
}
|
|
42210
42221
|
|
|
42211
|
-
return concat$
|
|
42222
|
+
return concat$c(parts);
|
|
42212
42223
|
}
|
|
42213
42224
|
// Babel extension.
|
|
42214
42225
|
|
|
@@ -42218,19 +42229,19 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42218
42229
|
case "ExpressionStatement":
|
|
42219
42230
|
// Detect Flow and TypeScript directives
|
|
42220
42231
|
if (n.directive) {
|
|
42221
|
-
return concat$
|
|
42232
|
+
return concat$c([nodeStr(n.expression, options, true), semi]);
|
|
42222
42233
|
}
|
|
42223
42234
|
|
|
42224
42235
|
if (options.parser === "__vue_event_binding") {
|
|
42225
42236
|
const parent = path.getParentNode();
|
|
42226
42237
|
|
|
42227
42238
|
if (parent.type === "Program" && parent.body.length === 1 && parent.body[0] === n) {
|
|
42228
|
-
return concat$
|
|
42239
|
+
return concat$c([path.call(print, "expression"), isVueEventBindingExpression$1(n.expression) ? ";" : ""]);
|
|
42229
42240
|
}
|
|
42230
42241
|
} // Do not append semicolon after the only JSX element in a program
|
|
42231
42242
|
|
|
42232
42243
|
|
|
42233
|
-
return concat$
|
|
42244
|
+
return concat$c([path.call(print, "expression"), isTheOnlyJSXElementInMarkdown$1(options, path) ? "" : semi]);
|
|
42234
42245
|
// Babel non-standard node. Used for Closure-style type casts. See postprocess.js.
|
|
42235
42246
|
|
|
42236
42247
|
case "ParenthesizedExpression":
|
|
@@ -42238,14 +42249,14 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42238
42249
|
const shouldHug = !n.expression.comments;
|
|
42239
42250
|
|
|
42240
42251
|
if (shouldHug) {
|
|
42241
|
-
return concat$
|
|
42252
|
+
return concat$c(["(", path.call(print, "expression"), ")"]);
|
|
42242
42253
|
}
|
|
42243
42254
|
|
|
42244
|
-
return group$7(concat$
|
|
42255
|
+
return group$7(concat$c(["(", indent$8(concat$c([softline$6, path.call(print, "expression")])), softline$6, ")"]));
|
|
42245
42256
|
}
|
|
42246
42257
|
|
|
42247
42258
|
case "AssignmentExpression":
|
|
42248
|
-
return printAssignment(n.left, path.call(print, "left"), concat$
|
|
42259
|
+
return printAssignment(n.left, path.call(print, "left"), concat$c([" ", n.operator]), n.right, path.call(print, "right"), options);
|
|
42249
42260
|
|
|
42250
42261
|
case "BinaryExpression":
|
|
42251
42262
|
case "LogicalExpression":
|
|
@@ -42268,7 +42279,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42268
42279
|
// ) {
|
|
42269
42280
|
|
|
42270
42281
|
if (isInsideParenthesis) {
|
|
42271
|
-
return concat$
|
|
42282
|
+
return concat$c(parts);
|
|
42272
42283
|
} // Break between the parens in
|
|
42273
42284
|
// unaries or in a member or specific call expression, i.e.
|
|
42274
42285
|
//
|
|
@@ -42280,7 +42291,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42280
42291
|
|
|
42281
42292
|
|
|
42282
42293
|
if ((parent.type === "CallExpression" || parent.type === "OptionalCallExpression") && parent.callee === n || parent.type === "UnaryExpression" || (parent.type === "MemberExpression" || parent.type === "OptionalMemberExpression") && !parent.computed) {
|
|
42283
|
-
return group$7(concat$
|
|
42294
|
+
return group$7(concat$c([indent$8(concat$c([softline$6, concat$c(parts)])), softline$6]));
|
|
42284
42295
|
} // Avoid indenting sub-expressions in some cases where the first sub-expression is already
|
|
42285
42296
|
// indented accordingly. We should indent sub-expressions where the first case isn't indented.
|
|
42286
42297
|
|
|
@@ -42290,7 +42301,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42290
42301
|
const samePrecedenceSubExpression = isBinaryish$1(n.left) && shouldFlatten$2(n.operator, n.left.operator);
|
|
42291
42302
|
|
|
42292
42303
|
if (shouldNotIndent || shouldInlineLogicalExpression(n) && !samePrecedenceSubExpression || !shouldInlineLogicalExpression(n) && shouldIndentIfInlining) {
|
|
42293
|
-
return group$7(concat$
|
|
42304
|
+
return group$7(concat$c(parts));
|
|
42294
42305
|
}
|
|
42295
42306
|
|
|
42296
42307
|
if (parts.length === 0) {
|
|
@@ -42309,9 +42320,9 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42309
42320
|
const firstGroupIndex = parts.findIndex(part => typeof part !== "string" && part.type === "group"); // Separate the leftmost expression, possibly with its leading comments.
|
|
42310
42321
|
|
|
42311
42322
|
const headParts = parts.slice(0, firstGroupIndex === -1 ? 1 : firstGroupIndex + 1);
|
|
42312
|
-
const rest = concat$
|
|
42323
|
+
const rest = concat$c(parts.slice(headParts.length, hasJSX ? -1 : undefined));
|
|
42313
42324
|
const groupId = Symbol("logicalChain-" + ++uid);
|
|
42314
|
-
const chain = group$7(concat$
|
|
42325
|
+
const chain = group$7(concat$c([// Don't include the initial expression in the indentation
|
|
42315
42326
|
// level. The first item is guaranteed to be the first
|
|
42316
42327
|
// left-most expression.
|
|
42317
42328
|
...headParts, indent$8(rest)]), {
|
|
@@ -42323,27 +42334,27 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42323
42334
|
}
|
|
42324
42335
|
|
|
42325
42336
|
const jsxPart = getLast$5(parts);
|
|
42326
|
-
return group$7(concat$
|
|
42337
|
+
return group$7(concat$c([chain, ifBreak$4(indent$8(jsxPart), jsxPart, {
|
|
42327
42338
|
groupId
|
|
42328
42339
|
})]));
|
|
42329
42340
|
}
|
|
42330
42341
|
|
|
42331
42342
|
case "AssignmentPattern":
|
|
42332
|
-
return concat$
|
|
42343
|
+
return concat$c([path.call(print, "left"), " = ", path.call(print, "right")]);
|
|
42333
42344
|
|
|
42334
42345
|
case "TSTypeAssertion":
|
|
42335
42346
|
{
|
|
42336
42347
|
const shouldBreakAfterCast = !(n.expression.type === "ArrayExpression" || n.expression.type === "ObjectExpression");
|
|
42337
|
-
const castGroup = group$7(concat$
|
|
42338
|
-
const exprContents = concat$
|
|
42348
|
+
const castGroup = group$7(concat$c(["<", indent$8(concat$c([softline$6, path.call(print, "typeAnnotation")])), softline$6, ">"]));
|
|
42349
|
+
const exprContents = concat$c([ifBreak$4("("), indent$8(concat$c([softline$6, path.call(print, "expression")])), softline$6, ifBreak$4(")")]);
|
|
42339
42350
|
|
|
42340
42351
|
if (shouldBreakAfterCast) {
|
|
42341
|
-
return conditionalGroup$3([concat$
|
|
42352
|
+
return conditionalGroup$3([concat$c([castGroup, path.call(print, "expression")]), concat$c([castGroup, group$7(exprContents, {
|
|
42342
42353
|
shouldBreak: true
|
|
42343
|
-
})]), concat$
|
|
42354
|
+
})]), concat$c([castGroup, path.call(print, "expression")])]);
|
|
42344
42355
|
}
|
|
42345
42356
|
|
|
42346
|
-
return group$7(concat$
|
|
42357
|
+
return group$7(concat$c([castGroup, path.call(print, "expression")]));
|
|
42347
42358
|
}
|
|
42348
42359
|
|
|
42349
42360
|
case "OptionalMemberExpression":
|
|
@@ -42359,27 +42370,27 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42359
42370
|
} while (firstNonMemberParent && (firstNonMemberParent.type === "MemberExpression" || firstNonMemberParent.type === "OptionalMemberExpression" || firstNonMemberParent.type === "TSNonNullExpression"));
|
|
42360
42371
|
|
|
42361
42372
|
const shouldInline = firstNonMemberParent && (firstNonMemberParent.type === "NewExpression" || firstNonMemberParent.type === "BindExpression" || firstNonMemberParent.type === "VariableDeclarator" && firstNonMemberParent.id.type !== "Identifier" || firstNonMemberParent.type === "AssignmentExpression" && firstNonMemberParent.left.type !== "Identifier") || n.computed || n.object.type === "Identifier" && n.property.type === "Identifier" && parent.type !== "MemberExpression" && parent.type !== "OptionalMemberExpression";
|
|
42362
|
-
return concat$
|
|
42373
|
+
return concat$c([path.call(print, "object"), shouldInline ? printMemberLookup$2(path, options, print) : group$7(indent$8(concat$c([softline$6, printMemberLookup$2(path, options, print)])))]);
|
|
42363
42374
|
}
|
|
42364
42375
|
|
|
42365
42376
|
case "MetaProperty":
|
|
42366
|
-
return concat$
|
|
42377
|
+
return concat$c([path.call(print, "meta"), ".", path.call(print, "property")]);
|
|
42367
42378
|
|
|
42368
42379
|
case "BindExpression":
|
|
42369
42380
|
if (n.object) {
|
|
42370
42381
|
parts.push(path.call(print, "object"));
|
|
42371
42382
|
}
|
|
42372
42383
|
|
|
42373
|
-
parts.push(group$7(indent$8(concat$
|
|
42374
|
-
return concat$
|
|
42384
|
+
parts.push(group$7(indent$8(concat$c([softline$6, printBindExpressionCallee$2(path, options, print)]))));
|
|
42385
|
+
return concat$c(parts);
|
|
42375
42386
|
|
|
42376
42387
|
case "Identifier":
|
|
42377
42388
|
{
|
|
42378
|
-
return concat$
|
|
42389
|
+
return concat$c([n.name, printOptionalToken$2(path), printTypeAnnotation(path, options, print)]);
|
|
42379
42390
|
}
|
|
42380
42391
|
|
|
42381
42392
|
case "V8IntrinsicIdentifier":
|
|
42382
|
-
return concat$
|
|
42393
|
+
return concat$c(["%", n.name]);
|
|
42383
42394
|
|
|
42384
42395
|
case "SpreadElement":
|
|
42385
42396
|
case "SpreadElementPattern":
|
|
@@ -42387,7 +42398,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42387
42398
|
case "SpreadPropertyPattern":
|
|
42388
42399
|
case "RestElement":
|
|
42389
42400
|
case "ObjectTypeSpreadProperty":
|
|
42390
|
-
return concat$
|
|
42401
|
+
return concat$c(["...", path.call(print, "argument"), printTypeAnnotation(path, options, print)]);
|
|
42391
42402
|
|
|
42392
42403
|
case "FunctionDeclaration":
|
|
42393
42404
|
case "FunctionExpression":
|
|
@@ -42397,7 +42408,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42397
42408
|
parts.push(semi);
|
|
42398
42409
|
}
|
|
42399
42410
|
|
|
42400
|
-
return concat$
|
|
42411
|
+
return concat$c(parts);
|
|
42401
42412
|
|
|
42402
42413
|
case "ArrowFunctionExpression":
|
|
42403
42414
|
{
|
|
@@ -42408,7 +42419,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42408
42419
|
if (shouldPrintParamsWithoutParens(path, options)) {
|
|
42409
42420
|
parts.push(path.call(print, "params", 0));
|
|
42410
42421
|
} else {
|
|
42411
|
-
parts.push(group$7(concat$
|
|
42422
|
+
parts.push(group$7(concat$c([printFunctionParams(path, print, options,
|
|
42412
42423
|
/* expandLast */
|
|
42413
42424
|
args && (args.expandLastArg || args.expandFirstArg),
|
|
42414
42425
|
/* printTypeParams */
|
|
@@ -42431,13 +42442,13 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42431
42442
|
// as the arrow.
|
|
42432
42443
|
|
|
42433
42444
|
if (!hasLeadingOwnLineComment$1(options.originalText, n.body, options) && (n.body.type === "ArrayExpression" || n.body.type === "ObjectExpression" || n.body.type === "BlockStatement" || isJSXNode$3(n.body) || isTemplateOnItsOwnLine$1(n.body, options.originalText, options) || n.body.type === "ArrowFunctionExpression" || n.body.type === "DoExpression")) {
|
|
42434
|
-
return group$7(concat$
|
|
42445
|
+
return group$7(concat$c([concat$c(parts), " ", body]));
|
|
42435
42446
|
} // We handle sequence expressions as the body of arrows specially,
|
|
42436
42447
|
// so that the required parentheses end up on their own lines.
|
|
42437
42448
|
|
|
42438
42449
|
|
|
42439
42450
|
if (n.body.type === "SequenceExpression") {
|
|
42440
|
-
return group$7(concat$
|
|
42451
|
+
return group$7(concat$c([concat$c(parts), group$7(concat$c([" (", indent$8(concat$c([softline$6, body])), softline$6, ")"]))]));
|
|
42441
42452
|
} // if the arrow function is expanded as last argument, we are adding a
|
|
42442
42453
|
// level of indentation and need to add a softline to align the closing )
|
|
42443
42454
|
// with the opening (, or if it's inside a JSXExpression (e.g. an attribute)
|
|
@@ -42452,7 +42463,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42452
42463
|
const shouldAddParens = n.body.type === "ConditionalExpression" && !startsWithNoLookaheadToken$2(n.body,
|
|
42453
42464
|
/* forbidFunctionAndClass */
|
|
42454
42465
|
false);
|
|
42455
|
-
return group$7(concat$
|
|
42466
|
+
return group$7(concat$c([concat$c(parts), group$7(concat$c([indent$8(concat$c([line$8, shouldAddParens ? ifBreak$4("", "(") : "", body, shouldAddParens ? ifBreak$4("", ")") : ""])), shouldAddSoftLine ? concat$c([ifBreak$4(printTrailingComma ? "," : ""), softline$6]) : ""]))]));
|
|
42456
42467
|
}
|
|
42457
42468
|
|
|
42458
42469
|
case "YieldExpression":
|
|
@@ -42466,7 +42477,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42466
42477
|
parts.push(" ", path.call(print, "argument"));
|
|
42467
42478
|
}
|
|
42468
42479
|
|
|
42469
|
-
return concat$
|
|
42480
|
+
return concat$c(parts);
|
|
42470
42481
|
|
|
42471
42482
|
case "AwaitExpression":
|
|
42472
42483
|
{
|
|
@@ -42479,10 +42490,10 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42479
42490
|
const parent = path.getParentNode();
|
|
42480
42491
|
|
|
42481
42492
|
if ((parent.type === "CallExpression" || parent.type === "OptionalCallExpression") && parent.callee === n || (parent.type === "MemberExpression" || parent.type === "OptionalMemberExpression") && parent.object === n) {
|
|
42482
|
-
return group$7(concat$
|
|
42493
|
+
return group$7(concat$c([indent$8(concat$c([softline$6, concat$c(parts)])), softline$6]));
|
|
42483
42494
|
}
|
|
42484
42495
|
|
|
42485
|
-
return concat$
|
|
42496
|
+
return concat$c(parts);
|
|
42486
42497
|
}
|
|
42487
42498
|
|
|
42488
42499
|
case "ImportSpecifier":
|
|
@@ -42496,7 +42507,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42496
42507
|
parts.push(" as ", path.call(print, "local"));
|
|
42497
42508
|
}
|
|
42498
42509
|
|
|
42499
|
-
return concat$
|
|
42510
|
+
return concat$c(parts);
|
|
42500
42511
|
|
|
42501
42512
|
case "ExportSpecifier":
|
|
42502
42513
|
parts.push(path.call(print, "local"));
|
|
@@ -42505,25 +42516,25 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42505
42516
|
parts.push(" as ", path.call(print, "exported"));
|
|
42506
42517
|
}
|
|
42507
42518
|
|
|
42508
|
-
return concat$
|
|
42519
|
+
return concat$c(parts);
|
|
42509
42520
|
|
|
42510
42521
|
case "ImportNamespaceSpecifier":
|
|
42511
42522
|
parts.push("* as ");
|
|
42512
42523
|
parts.push(path.call(print, "local"));
|
|
42513
|
-
return concat$
|
|
42524
|
+
return concat$c(parts);
|
|
42514
42525
|
|
|
42515
42526
|
case "ImportDefaultSpecifier":
|
|
42516
42527
|
return path.call(print, "local");
|
|
42517
42528
|
|
|
42518
42529
|
case "TSExportAssignment":
|
|
42519
|
-
return concat$
|
|
42530
|
+
return concat$c(["export = ", path.call(print, "expression"), semi]);
|
|
42520
42531
|
|
|
42521
42532
|
case "ExportDefaultDeclaration":
|
|
42522
42533
|
case "ExportNamedDeclaration":
|
|
42523
42534
|
return printExportDeclaration(path, options, print);
|
|
42524
42535
|
|
|
42525
42536
|
case "DeclareExportDeclaration":
|
|
42526
|
-
return concat$
|
|
42537
|
+
return concat$c(["declare ", printExportDeclaration(path, options, print)]);
|
|
42527
42538
|
|
|
42528
42539
|
case "ExportAllDeclaration":
|
|
42529
42540
|
parts.push("export");
|
|
@@ -42539,10 +42550,10 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42539
42550
|
}
|
|
42540
42551
|
|
|
42541
42552
|
parts.push(printModuleSource$1(path, options, print), semi);
|
|
42542
|
-
return concat$
|
|
42553
|
+
return concat$c(parts);
|
|
42543
42554
|
|
|
42544
42555
|
case "ExportNamespaceSpecifier":
|
|
42545
|
-
return concat$
|
|
42556
|
+
return concat$c(["* as ", path.call(print, "exported")]);
|
|
42546
42557
|
|
|
42547
42558
|
case "ExportDefaultSpecifier":
|
|
42548
42559
|
return path.call(print, "exported");
|
|
@@ -42566,15 +42577,15 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42566
42577
|
}
|
|
42567
42578
|
|
|
42568
42579
|
if (Array.isArray(n.attributes) && n.attributes.length !== 0) {
|
|
42569
|
-
parts.push(" with ", concat$
|
|
42580
|
+
parts.push(" with ", concat$c(path.map(print, "attributes")));
|
|
42570
42581
|
}
|
|
42571
42582
|
|
|
42572
42583
|
parts.push(semi);
|
|
42573
|
-
return concat$
|
|
42584
|
+
return concat$c(parts);
|
|
42574
42585
|
}
|
|
42575
42586
|
|
|
42576
42587
|
case "ImportAttribute":
|
|
42577
|
-
return concat$
|
|
42588
|
+
return concat$c([path.call(print, "key"), ": ", path.call(print, "value")]);
|
|
42578
42589
|
|
|
42579
42590
|
case "Import":
|
|
42580
42591
|
return "import";
|
|
@@ -42598,7 +42609,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42598
42609
|
|
|
42599
42610
|
if (hasDirectives) {
|
|
42600
42611
|
path.each(childPath => {
|
|
42601
|
-
parts.push(indent$8(concat$
|
|
42612
|
+
parts.push(indent$8(concat$c([hardline$6, print(childPath), semi])));
|
|
42602
42613
|
|
|
42603
42614
|
if (isNextLineEmpty$4(options.originalText, childPath.getValue(), options.locEnd)) {
|
|
42604
42615
|
parts.push(hardline$6);
|
|
@@ -42607,16 +42618,16 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42607
42618
|
}
|
|
42608
42619
|
|
|
42609
42620
|
if (hasContent) {
|
|
42610
|
-
parts.push(indent$8(concat$
|
|
42621
|
+
parts.push(indent$8(concat$c([hardline$6, naked])));
|
|
42611
42622
|
}
|
|
42612
42623
|
|
|
42613
42624
|
parts.push(comments.printDanglingComments(path, options));
|
|
42614
42625
|
parts.push(hardline$6, "}");
|
|
42615
|
-
return concat$
|
|
42626
|
+
return concat$c(parts);
|
|
42616
42627
|
}
|
|
42617
42628
|
|
|
42618
42629
|
case "ReturnStatement":
|
|
42619
|
-
return concat$
|
|
42630
|
+
return concat$c(["return", printReturnAndThrowArgument(path, options, print)]);
|
|
42620
42631
|
|
|
42621
42632
|
case "NewExpression":
|
|
42622
42633
|
case "ImportExpression":
|
|
@@ -42635,7 +42646,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42635
42646
|
args.length === 1 && isTemplateOnItsOwnLine$1(args[0], options.originalText, options) || // Keep test declarations on a single line
|
|
42636
42647
|
// e.g. `it('long name', () => {`
|
|
42637
42648
|
!isNew && isTestCall$1(n, path.getParentNode())) {
|
|
42638
|
-
return concat$
|
|
42649
|
+
return concat$c([isNew ? "new " : "", path.call(print, "callee"), optional, printFunctionTypeParameters$2(path, options, print), concat$c(["(", isDynamicImport ? path.call(print, "source") : join$6(", ", path.map(print, "arguments")), ")"])]);
|
|
42639
42650
|
} // Inline Flow annotation comments following Identifiers in Call nodes need to
|
|
42640
42651
|
// stay with the Identifier. For example:
|
|
42641
42652
|
//
|
|
@@ -42656,7 +42667,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42656
42667
|
return memberChain(path, options, print);
|
|
42657
42668
|
}
|
|
42658
42669
|
|
|
42659
|
-
const contents = concat$
|
|
42670
|
+
const contents = concat$c([isNew ? "new " : "", isDynamicImport ? "import" : path.call(print, "callee"), optional, isIdentifierWithFlowAnnotation ? `/*:: ${n.callee.trailingComments[0].value.slice(2).trim()} */` : "", printFunctionTypeParameters$2(path, options, print), callArguments(path, options, print)]); // We group here when the callee is itself a call expression.
|
|
42660
42671
|
// See `isLongCurriedCallExpression` for more info.
|
|
42661
42672
|
|
|
42662
42673
|
if (isDynamicImport || isCallOrOptionalCallExpression$2(n.callee)) {
|
|
@@ -42667,7 +42678,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42667
42678
|
}
|
|
42668
42679
|
|
|
42669
42680
|
case "ObjectTypeInternalSlot":
|
|
42670
|
-
return concat$
|
|
42681
|
+
return concat$c([n.static ? "static " : "", "[[", path.call(print, "id"), "]]", printOptionalToken$2(path), n.method ? "" : ": ", path.call(print, "value")]);
|
|
42671
42682
|
|
|
42672
42683
|
case "ObjectExpression":
|
|
42673
42684
|
case "ObjectPattern":
|
|
@@ -42717,7 +42728,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42717
42728
|
});
|
|
42718
42729
|
let separatorParts = [];
|
|
42719
42730
|
const props = propsAndLoc.sort((a, b) => a.loc - b.loc).map(prop => {
|
|
42720
|
-
const result = concat$
|
|
42731
|
+
const result = concat$c(separatorParts.concat(group$7(prop.printed)));
|
|
42721
42732
|
separatorParts = [separator, line$8];
|
|
42722
42733
|
|
|
42723
42734
|
if ((prop.node.type === "TSPropertySignature" || prop.node.type === "TSMethodSignature" || prop.node.type === "TSConstructSignatureDeclaration") && hasNodeIgnoreComment$2(prop.node)) {
|
|
@@ -42739,12 +42750,12 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42739
42750
|
const printedDanglingComments = comments.printDanglingComments(path, options,
|
|
42740
42751
|
/* sameIndent */
|
|
42741
42752
|
true);
|
|
42742
|
-
printed = concat$
|
|
42753
|
+
printed = concat$c([printedDanglingComments, hasLineComments || hasNewline$5(options.originalText, options.locEnd(n.comments[n.comments.length - 1])) ? hardline$6 : line$8, "..."]);
|
|
42743
42754
|
} else {
|
|
42744
42755
|
printed = "...";
|
|
42745
42756
|
}
|
|
42746
42757
|
|
|
42747
|
-
props.push(concat$
|
|
42758
|
+
props.push(concat$c(separatorParts.concat(printed)));
|
|
42748
42759
|
}
|
|
42749
42760
|
|
|
42750
42761
|
const lastElem = getLast$5(n[propertiesField]);
|
|
@@ -42753,12 +42764,12 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42753
42764
|
|
|
42754
42765
|
if (props.length === 0) {
|
|
42755
42766
|
if (!hasDanglingComments$1(n)) {
|
|
42756
|
-
return concat$
|
|
42767
|
+
return concat$c([leftBrace, rightBrace, printTypeAnnotation(path, options, print)]);
|
|
42757
42768
|
}
|
|
42758
42769
|
|
|
42759
|
-
content = group$7(concat$
|
|
42770
|
+
content = group$7(concat$c([leftBrace, comments.printDanglingComments(path, options), softline$6, rightBrace, printOptionalToken$2(path), printTypeAnnotation(path, options, print)]));
|
|
42760
42771
|
} else {
|
|
42761
|
-
content = concat$
|
|
42772
|
+
content = concat$c([leftBrace, indent$8(concat$c([options.bracketSpacing ? line$8 : softline$6, concat$c(props)])), ifBreak$4(canHaveTrailingSeparator && (separator !== "," || shouldPrintComma$3(options)) ? separator : ""), concat$c([options.bracketSpacing ? line$8 : softline$6, rightBrace]), printOptionalToken$2(path), printTypeAnnotation(path, options, print)]);
|
|
42762
42773
|
} // If we inline the object as first argument of the parent, we don't want
|
|
42763
42774
|
// to create another group so that the object breaks before the return
|
|
42764
42775
|
// type
|
|
@@ -42787,7 +42798,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42787
42798
|
parts.push(printAssignment(n.key, printPropertyKey(path, options, print), ":", n.value, path.call(print, "value"), options));
|
|
42788
42799
|
}
|
|
42789
42800
|
|
|
42790
|
-
return concat$
|
|
42801
|
+
return concat$c(parts);
|
|
42791
42802
|
// Babel 6
|
|
42792
42803
|
|
|
42793
42804
|
case "ClassMethod":
|
|
@@ -42812,13 +42823,13 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42812
42823
|
}
|
|
42813
42824
|
|
|
42814
42825
|
parts.push(printMethod(path, options, print));
|
|
42815
|
-
return concat$
|
|
42826
|
+
return concat$c(parts);
|
|
42816
42827
|
|
|
42817
42828
|
case "ObjectMethod":
|
|
42818
42829
|
return printMethod(path, options, print);
|
|
42819
42830
|
|
|
42820
42831
|
case "Decorator":
|
|
42821
|
-
return concat$
|
|
42832
|
+
return concat$c(["@", path.call(print, "expression"), path.call(print, "callee")]);
|
|
42822
42833
|
|
|
42823
42834
|
case "ArrayExpression":
|
|
42824
42835
|
case "ArrayPattern":
|
|
@@ -42831,7 +42842,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42831
42842
|
if (!hasDanglingComments$1(n)) {
|
|
42832
42843
|
parts.push(openBracket, closeBracket);
|
|
42833
42844
|
} else {
|
|
42834
|
-
parts.push(group$7(concat$
|
|
42845
|
+
parts.push(group$7(concat$c([openBracket, comments.printDanglingComments(path, options), softline$6, closeBracket])));
|
|
42835
42846
|
}
|
|
42836
42847
|
} else {
|
|
42837
42848
|
const lastElem = getLast$5(n.elements);
|
|
@@ -42863,7 +42874,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42863
42874
|
const itemsKey = elementType === "ArrayExpression" ? "elements" : "properties";
|
|
42864
42875
|
return element[itemsKey] && element[itemsKey].length > 1;
|
|
42865
42876
|
});
|
|
42866
|
-
parts.push(group$7(concat$
|
|
42877
|
+
parts.push(group$7(concat$c([openBracket, indent$8(concat$c([softline$6, printArrayItems(path, options, "elements", print)])), needsForcedTrailingComma ? "," : "", ifBreak$4(canHaveTrailingComma && !needsForcedTrailingComma && shouldPrintComma$3(options) ? "," : ""), comments.printDanglingComments(path, options,
|
|
42867
42878
|
/* sameIndent */
|
|
42868
42879
|
true), softline$6, closeBracket]), {
|
|
42869
42880
|
shouldBreak
|
|
@@ -42871,7 +42882,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42871
42882
|
}
|
|
42872
42883
|
|
|
42873
42884
|
parts.push(printOptionalToken$2(path), printTypeAnnotation(path, options, print));
|
|
42874
|
-
return concat$
|
|
42885
|
+
return concat$c(parts);
|
|
42875
42886
|
}
|
|
42876
42887
|
|
|
42877
42888
|
case "SequenceExpression":
|
|
@@ -42887,13 +42898,13 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42887
42898
|
if (p.getName() === 0) {
|
|
42888
42899
|
parts.push(print(p));
|
|
42889
42900
|
} else {
|
|
42890
|
-
parts.push(",", indent$8(concat$
|
|
42901
|
+
parts.push(",", indent$8(concat$c([line$8, print(p)])));
|
|
42891
42902
|
}
|
|
42892
42903
|
}, "expressions");
|
|
42893
|
-
return group$7(concat$
|
|
42904
|
+
return group$7(concat$c(parts));
|
|
42894
42905
|
}
|
|
42895
42906
|
|
|
42896
|
-
return group$7(concat$
|
|
42907
|
+
return group$7(concat$c([join$6(concat$c([",", line$8]), path.map(print, "expressions"))]));
|
|
42897
42908
|
}
|
|
42898
42909
|
|
|
42899
42910
|
case "ThisExpression":
|
|
@@ -42960,12 +42971,12 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42960
42971
|
}
|
|
42961
42972
|
|
|
42962
42973
|
if (n.argument.comments && n.argument.comments.length > 0) {
|
|
42963
|
-
parts.push(group$7(concat$
|
|
42974
|
+
parts.push(group$7(concat$c(["(", indent$8(concat$c([softline$6, path.call(print, "argument")])), softline$6, ")"])));
|
|
42964
42975
|
} else {
|
|
42965
42976
|
parts.push(path.call(print, "argument"));
|
|
42966
42977
|
}
|
|
42967
42978
|
|
|
42968
|
-
return concat$
|
|
42979
|
+
return concat$c(parts);
|
|
42969
42980
|
|
|
42970
42981
|
case "UpdateExpression":
|
|
42971
42982
|
parts.push(path.call(print, "argument"), n.operator);
|
|
@@ -42974,7 +42985,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
42974
42985
|
parts.reverse();
|
|
42975
42986
|
}
|
|
42976
42987
|
|
|
42977
|
-
return concat$
|
|
42988
|
+
return concat$c(parts);
|
|
42978
42989
|
|
|
42979
42990
|
case "ConditionalExpression":
|
|
42980
42991
|
return ternary(path, options, print, {
|
|
@@ -43006,13 +43017,13 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43006
43017
|
firstVariable = indent$8(printed[0]);
|
|
43007
43018
|
}
|
|
43008
43019
|
|
|
43009
|
-
parts = [n.declare ? "declare " : "", n.kind, firstVariable ? concat$
|
|
43020
|
+
parts = [n.declare ? "declare " : "", n.kind, firstVariable ? concat$c([" ", firstVariable]) : "", indent$8(concat$c(printed.slice(1).map(p => concat$c([",", hasValue && !isParentForLoop ? hardline$6 : line$8, p]))))];
|
|
43010
43021
|
|
|
43011
43022
|
if (!(isParentForLoop && parentNode.body !== n)) {
|
|
43012
43023
|
parts.push(semi);
|
|
43013
43024
|
}
|
|
43014
43025
|
|
|
43015
|
-
return group$7(concat$
|
|
43026
|
+
return group$7(concat$c(parts));
|
|
43016
43027
|
}
|
|
43017
43028
|
|
|
43018
43029
|
case "TSTypeAliasDeclaration":
|
|
@@ -43023,19 +43034,19 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43023
43034
|
|
|
43024
43035
|
const printed = printAssignmentRight(n.id, n.typeAnnotation, n.typeAnnotation && path.call(print, "typeAnnotation"), options);
|
|
43025
43036
|
parts.push("type ", path.call(print, "id"), path.call(print, "typeParameters"), " =", printed, semi);
|
|
43026
|
-
return group$7(concat$
|
|
43037
|
+
return group$7(concat$c(parts));
|
|
43027
43038
|
}
|
|
43028
43039
|
|
|
43029
43040
|
case "VariableDeclarator":
|
|
43030
43041
|
return printAssignment(n.id, path.call(print, "id"), " =", n.init, n.init && path.call(print, "init"), options);
|
|
43031
43042
|
|
|
43032
43043
|
case "WithStatement":
|
|
43033
|
-
return group$7(concat$
|
|
43044
|
+
return group$7(concat$c(["with (", path.call(print, "object"), ")", adjustClause(n.body, path.call(print, "body"))]));
|
|
43034
43045
|
|
|
43035
43046
|
case "IfStatement":
|
|
43036
43047
|
{
|
|
43037
43048
|
const con = adjustClause(n.consequent, path.call(print, "consequent"));
|
|
43038
|
-
const opening = group$7(concat$
|
|
43049
|
+
const opening = group$7(concat$c(["if (", group$7(concat$c([indent$8(concat$c([softline$6, path.call(print, "test")])), softline$6])), ")", con]));
|
|
43039
43050
|
parts.push(opening);
|
|
43040
43051
|
|
|
43041
43052
|
if (n.alternate) {
|
|
@@ -43050,7 +43061,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43050
43061
|
parts.push("else", group$7(adjustClause(n.alternate, path.call(print, "alternate"), n.alternate.type === "IfStatement")));
|
|
43051
43062
|
}
|
|
43052
43063
|
|
|
43053
|
-
return concat$
|
|
43064
|
+
return concat$c(parts);
|
|
43054
43065
|
}
|
|
43055
43066
|
|
|
43056
43067
|
case "ForStatement":
|
|
@@ -43062,29 +43073,29 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43062
43073
|
const dangling = comments.printDanglingComments(path, options,
|
|
43063
43074
|
/* sameLine */
|
|
43064
43075
|
true);
|
|
43065
|
-
const printedComments = dangling ? concat$
|
|
43076
|
+
const printedComments = dangling ? concat$c([dangling, softline$6]) : "";
|
|
43066
43077
|
|
|
43067
43078
|
if (!n.init && !n.test && !n.update) {
|
|
43068
|
-
return concat$
|
|
43079
|
+
return concat$c([printedComments, group$7(concat$c(["for (;;)", body]))]);
|
|
43069
43080
|
}
|
|
43070
43081
|
|
|
43071
|
-
return concat$
|
|
43082
|
+
return concat$c([printedComments, group$7(concat$c(["for (", group$7(concat$c([indent$8(concat$c([softline$6, path.call(print, "init"), ";", line$8, path.call(print, "test"), ";", line$8, path.call(print, "update")])), softline$6])), ")", body]))]);
|
|
43072
43083
|
}
|
|
43073
43084
|
|
|
43074
43085
|
case "WhileStatement":
|
|
43075
|
-
return group$7(concat$
|
|
43086
|
+
return group$7(concat$c(["while (", group$7(concat$c([indent$8(concat$c([softline$6, path.call(print, "test")])), softline$6])), ")", adjustClause(n.body, path.call(print, "body"))]));
|
|
43076
43087
|
|
|
43077
43088
|
case "ForInStatement":
|
|
43078
43089
|
// Note: esprima can't actually parse "for each (".
|
|
43079
|
-
return group$7(concat$
|
|
43090
|
+
return group$7(concat$c([n.each ? "for each (" : "for (", path.call(print, "left"), " in ", path.call(print, "right"), ")", adjustClause(n.body, path.call(print, "body"))]));
|
|
43080
43091
|
|
|
43081
43092
|
case "ForOfStatement":
|
|
43082
|
-
return group$7(concat$
|
|
43093
|
+
return group$7(concat$c(["for", n.await ? " await" : "", " (", path.call(print, "left"), " of ", path.call(print, "right"), ")", adjustClause(n.body, path.call(print, "body"))]));
|
|
43083
43094
|
|
|
43084
43095
|
case "DoWhileStatement":
|
|
43085
43096
|
{
|
|
43086
43097
|
const clause = adjustClause(n.body, path.call(print, "body"));
|
|
43087
|
-
const doBody = group$7(concat$
|
|
43098
|
+
const doBody = group$7(concat$c(["do", clause]));
|
|
43088
43099
|
parts = [doBody];
|
|
43089
43100
|
|
|
43090
43101
|
if (n.body.type === "BlockStatement") {
|
|
@@ -43094,12 +43105,12 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43094
43105
|
}
|
|
43095
43106
|
|
|
43096
43107
|
parts.push("while (");
|
|
43097
|
-
parts.push(group$7(concat$
|
|
43098
|
-
return concat$
|
|
43108
|
+
parts.push(group$7(concat$c([indent$8(concat$c([softline$6, path.call(print, "test")])), softline$6])), ")", semi);
|
|
43109
|
+
return concat$c(parts);
|
|
43099
43110
|
}
|
|
43100
43111
|
|
|
43101
43112
|
case "DoExpression":
|
|
43102
|
-
return concat$
|
|
43113
|
+
return concat$c(["do ", path.call(print, "body")]);
|
|
43103
43114
|
|
|
43104
43115
|
case "BreakStatement":
|
|
43105
43116
|
parts.push("break");
|
|
@@ -43109,7 +43120,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43109
43120
|
}
|
|
43110
43121
|
|
|
43111
43122
|
parts.push(semi);
|
|
43112
|
-
return concat$
|
|
43123
|
+
return concat$c(parts);
|
|
43113
43124
|
|
|
43114
43125
|
case "ContinueStatement":
|
|
43115
43126
|
parts.push("continue");
|
|
@@ -43119,17 +43130,17 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43119
43130
|
}
|
|
43120
43131
|
|
|
43121
43132
|
parts.push(semi);
|
|
43122
|
-
return concat$
|
|
43133
|
+
return concat$c(parts);
|
|
43123
43134
|
|
|
43124
43135
|
case "LabeledStatement":
|
|
43125
43136
|
if (n.body.type === "EmptyStatement") {
|
|
43126
|
-
return concat$
|
|
43137
|
+
return concat$c([path.call(print, "label"), ":;"]);
|
|
43127
43138
|
}
|
|
43128
43139
|
|
|
43129
|
-
return concat$
|
|
43140
|
+
return concat$c([path.call(print, "label"), ": ", path.call(print, "body")]);
|
|
43130
43141
|
|
|
43131
43142
|
case "TryStatement":
|
|
43132
|
-
return concat$
|
|
43143
|
+
return concat$c(["try ", path.call(print, "block"), n.handler ? concat$c([" ", path.call(print, "handler")]) : "", n.finalizer ? concat$c([" finally ", path.call(print, "finalizer")]) : ""]);
|
|
43133
43144
|
|
|
43134
43145
|
case "CatchClause":
|
|
43135
43146
|
if (n.param) {
|
|
@@ -43137,19 +43148,19 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43137
43148
|
backwards: true
|
|
43138
43149
|
}));
|
|
43139
43150
|
const param = path.call(print, "param");
|
|
43140
|
-
return concat$
|
|
43151
|
+
return concat$c(["catch ", hasComments ? concat$c(["(", indent$8(concat$c([softline$6, param])), softline$6, ") "]) : concat$c(["(", param, ") "]), path.call(print, "body")]);
|
|
43141
43152
|
}
|
|
43142
43153
|
|
|
43143
|
-
return concat$
|
|
43154
|
+
return concat$c(["catch ", path.call(print, "body")]);
|
|
43144
43155
|
|
|
43145
43156
|
case "ThrowStatement":
|
|
43146
|
-
return concat$
|
|
43157
|
+
return concat$c(["throw", printReturnAndThrowArgument(path, options, print)]);
|
|
43147
43158
|
// Note: ignoring n.lexical because it has no printing consequences.
|
|
43148
43159
|
|
|
43149
43160
|
case "SwitchStatement":
|
|
43150
|
-
return concat$
|
|
43161
|
+
return concat$c([group$7(concat$c(["switch (", indent$8(concat$c([softline$6, path.call(print, "discriminant")])), softline$6, ")"])), " {", n.cases.length > 0 ? indent$8(concat$c([hardline$6, join$6(hardline$6, path.map(casePath => {
|
|
43151
43162
|
const caseNode = casePath.getValue();
|
|
43152
|
-
return concat$
|
|
43163
|
+
return concat$c([casePath.call(print), n.cases.indexOf(caseNode) !== n.cases.length - 1 && isNextLineEmpty$4(options.originalText, caseNode, options.locEnd) ? hardline$6 : ""]);
|
|
43153
43164
|
}, "cases"))])) : "", hardline$6, "}"]);
|
|
43154
43165
|
|
|
43155
43166
|
case "SwitchCase":
|
|
@@ -43166,15 +43177,15 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43166
43177
|
const cons = path.call(consequentPath => {
|
|
43167
43178
|
return printStatementSequence(consequentPath, options, print);
|
|
43168
43179
|
}, "consequent");
|
|
43169
|
-
parts.push(consequent.length === 1 && consequent[0].type === "BlockStatement" ? concat$
|
|
43180
|
+
parts.push(consequent.length === 1 && consequent[0].type === "BlockStatement" ? concat$c([" ", cons]) : indent$8(concat$c([hardline$6, cons])));
|
|
43170
43181
|
}
|
|
43171
43182
|
|
|
43172
|
-
return concat$
|
|
43183
|
+
return concat$c(parts);
|
|
43173
43184
|
}
|
|
43174
43185
|
// JSX extensions below.
|
|
43175
43186
|
|
|
43176
43187
|
case "DebuggerStatement":
|
|
43177
|
-
return concat$
|
|
43188
|
+
return concat$c(["debugger", semi]);
|
|
43178
43189
|
|
|
43179
43190
|
case "JSXAttribute":
|
|
43180
43191
|
parts.push(path.call(print, "name"));
|
|
@@ -43189,7 +43200,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43189
43200
|
const quote = getPreferredQuote$1(final, options.jsxSingleQuote ? "'" : '"');
|
|
43190
43201
|
const escape = quote === "'" ? "'" : """;
|
|
43191
43202
|
final = final.slice(1, -1).replace(new RegExp(quote, "g"), escape);
|
|
43192
|
-
res = concat$
|
|
43203
|
+
res = concat$c([quote, final, quote]);
|
|
43193
43204
|
} else {
|
|
43194
43205
|
res = path.call(print, "value");
|
|
43195
43206
|
}
|
|
@@ -43197,7 +43208,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43197
43208
|
parts.push("=", res);
|
|
43198
43209
|
}
|
|
43199
43210
|
|
|
43200
|
-
return concat$
|
|
43211
|
+
return concat$c(parts);
|
|
43201
43212
|
|
|
43202
43213
|
case "JSXIdentifier":
|
|
43203
43214
|
return "" + n.name;
|
|
@@ -43214,15 +43225,15 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43214
43225
|
case "JSXSpreadAttribute":
|
|
43215
43226
|
case "JSXSpreadChild":
|
|
43216
43227
|
{
|
|
43217
|
-
return concat$
|
|
43218
|
-
const printed = concat$
|
|
43228
|
+
return concat$c(["{", path.call(p => {
|
|
43229
|
+
const printed = concat$c(["...", print(p)]);
|
|
43219
43230
|
const n = p.getValue();
|
|
43220
43231
|
|
|
43221
43232
|
if (!n.comments || !n.comments.length || !willPrintOwnComments(p)) {
|
|
43222
43233
|
return printed;
|
|
43223
43234
|
}
|
|
43224
43235
|
|
|
43225
|
-
return concat$
|
|
43236
|
+
return concat$c([indent$8(concat$c([softline$6, comments.printComments(p, () => printed, options)])), softline$6]);
|
|
43226
43237
|
}, n.type === "JSXSpreadAttribute" ? "argument" : "expression"), "}"]);
|
|
43227
43238
|
}
|
|
43228
43239
|
|
|
@@ -43233,10 +43244,10 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43233
43244
|
const shouldInline = n.expression.type === "JSXEmptyExpression" || !hasComments && (n.expression.type === "ArrayExpression" || n.expression.type === "ObjectExpression" || n.expression.type === "ArrowFunctionExpression" || n.expression.type === "CallExpression" || n.expression.type === "OptionalCallExpression" || n.expression.type === "FunctionExpression" || n.expression.type === "TemplateLiteral" || n.expression.type === "TaggedTemplateExpression" || n.expression.type === "DoExpression" || isJSXNode$3(parent) && (n.expression.type === "ConditionalExpression" || isBinaryish$1(n.expression)));
|
|
43234
43245
|
|
|
43235
43246
|
if (shouldInline) {
|
|
43236
|
-
return group$7(concat$
|
|
43247
|
+
return group$7(concat$c(["{", path.call(print, "expression"), lineSuffixBoundary$1, "}"]));
|
|
43237
43248
|
}
|
|
43238
43249
|
|
|
43239
|
-
return group$7(concat$
|
|
43250
|
+
return group$7(concat$c(["{", indent$8(concat$c([softline$6, path.call(print, "expression")])), softline$6, lineSuffixBoundary$1, "}"]));
|
|
43240
43251
|
}
|
|
43241
43252
|
|
|
43242
43253
|
case "JSXFragment":
|
|
@@ -43252,7 +43263,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43252
43263
|
const nameHasComments = n.name && n.name.comments && n.name.comments.length > 0 || n.typeParameters && n.typeParameters.comments && n.typeParameters.comments.length > 0; // Don't break self-closing elements with no attributes and no comments
|
|
43253
43264
|
|
|
43254
43265
|
if (n.selfClosing && !n.attributes.length && !nameHasComments) {
|
|
43255
|
-
return concat$
|
|
43266
|
+
return concat$c(["<", path.call(print, "name"), path.call(print, "typeParameters"), " />"]);
|
|
43256
43267
|
} // don't break up opening elements with a single long text attribute
|
|
43257
43268
|
|
|
43258
43269
|
|
|
@@ -43266,7 +43277,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43266
43277
|
// // comment
|
|
43267
43278
|
// >
|
|
43268
43279
|
!nameHasComments && (!n.attributes[0].comments || !n.attributes[0].comments.length)) {
|
|
43269
|
-
return group$7(concat$
|
|
43280
|
+
return group$7(concat$c(["<", path.call(print, "name"), path.call(print, "typeParameters"), " ", concat$c(path.map(print, "attributes")), n.selfClosing ? " />" : ">"]));
|
|
43270
43281
|
}
|
|
43271
43282
|
|
|
43272
43283
|
const lastAttrHasTrailingComments = n.attributes.length && hasTrailingComment$3(getLast$5(n.attributes));
|
|
@@ -43283,13 +43294,13 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43283
43294
|
// string literal with newlines
|
|
43284
43295
|
|
|
43285
43296
|
const shouldBreak = n.attributes && n.attributes.some(attr => attr.value && isStringLiteral$1(attr.value) && attr.value.value.includes("\n"));
|
|
43286
|
-
return group$7(concat$
|
|
43297
|
+
return group$7(concat$c(["<", path.call(print, "name"), path.call(print, "typeParameters"), concat$c([indent$8(concat$c(path.map(attr => concat$c([line$8, print(attr)]), "attributes"))), n.selfClosing ? line$8 : bracketSameLine ? ">" : softline$6]), n.selfClosing ? "/>" : bracketSameLine ? "" : ">"]), {
|
|
43287
43298
|
shouldBreak
|
|
43288
43299
|
});
|
|
43289
43300
|
}
|
|
43290
43301
|
|
|
43291
43302
|
case "JSXClosingElement":
|
|
43292
|
-
return concat$
|
|
43303
|
+
return concat$c(["</", path.call(print, "name"), ">"]);
|
|
43293
43304
|
|
|
43294
43305
|
case "JSXOpeningFragment":
|
|
43295
43306
|
case "JSXClosingFragment":
|
|
@@ -43297,7 +43308,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43297
43308
|
const hasComment = n.comments && n.comments.length;
|
|
43298
43309
|
const hasOwnLineComment = hasComment && !n.comments.every(comments$1.isBlockComment);
|
|
43299
43310
|
const isOpeningFragment = n.type === "JSXOpeningFragment";
|
|
43300
|
-
return concat$
|
|
43311
|
+
return concat$c([isOpeningFragment ? "<" : "</", indent$8(concat$c([hasOwnLineComment ? hardline$6 : hasComment && !isOpeningFragment ? " " : "", comments.printDanglingComments(path, options, true)])), hasOwnLineComment ? hardline$6 : "", ">"]);
|
|
43301
43312
|
}
|
|
43302
43313
|
|
|
43303
43314
|
case "JSXText":
|
|
@@ -43307,7 +43318,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43307
43318
|
case "JSXEmptyExpression":
|
|
43308
43319
|
{
|
|
43309
43320
|
const requiresHardline = n.comments && !n.comments.every(comments$1.isBlockComment);
|
|
43310
|
-
return concat$
|
|
43321
|
+
return concat$c([comments.printDanglingComments(path, options,
|
|
43311
43322
|
/* sameIndent */
|
|
43312
43323
|
!requiresHardline), requiresHardline ? hardline$6 : ""]);
|
|
43313
43324
|
}
|
|
@@ -43317,7 +43328,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43317
43328
|
return "{}";
|
|
43318
43329
|
}
|
|
43319
43330
|
|
|
43320
|
-
return concat$
|
|
43331
|
+
return concat$c(["{", n.body.length > 0 ? indent$8(concat$c([hardline$6, path.call(bodyPath => {
|
|
43321
43332
|
return printStatementSequence(bodyPath, options, print);
|
|
43322
43333
|
}, "body")])) : comments.printDanglingComments(path, options), hardline$6, "}"]);
|
|
43323
43334
|
|
|
@@ -43362,7 +43373,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43362
43373
|
}
|
|
43363
43374
|
|
|
43364
43375
|
parts.push(semi);
|
|
43365
|
-
return group$7(concat$
|
|
43376
|
+
return group$7(concat$c(parts));
|
|
43366
43377
|
}
|
|
43367
43378
|
|
|
43368
43379
|
case "ClassDeclaration":
|
|
@@ -43371,8 +43382,8 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43371
43382
|
parts.push("declare ");
|
|
43372
43383
|
}
|
|
43373
43384
|
|
|
43374
|
-
parts.push(concat$
|
|
43375
|
-
return concat$
|
|
43385
|
+
parts.push(concat$c(printClass(path, options, print)));
|
|
43386
|
+
return concat$c(parts);
|
|
43376
43387
|
|
|
43377
43388
|
case "TSInterfaceHeritage":
|
|
43378
43389
|
case "TSExpressionWithTypeArguments":
|
|
@@ -43383,10 +43394,10 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43383
43394
|
parts.push(path.call(print, "typeParameters"));
|
|
43384
43395
|
}
|
|
43385
43396
|
|
|
43386
|
-
return concat$
|
|
43397
|
+
return concat$c(parts);
|
|
43387
43398
|
|
|
43388
43399
|
case "TemplateElement":
|
|
43389
|
-
return join$6(literalline$
|
|
43400
|
+
return join$6(literalline$3, n.value.raw.split(/\r?\n/g));
|
|
43390
43401
|
|
|
43391
43402
|
case "TemplateLiteral":
|
|
43392
43403
|
{
|
|
@@ -43437,20 +43448,20 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43437
43448
|
// Breaks at the template element boundaries (${ and }) are preferred to breaking
|
|
43438
43449
|
// in the middle of a MemberExpression
|
|
43439
43450
|
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" || n.expressions[i].type === "SequenceExpression" || n.expressions[i].type === "TSAsExpression" || isBinaryish$1(n.expressions[i])) {
|
|
43440
|
-
printed = concat$
|
|
43451
|
+
printed = concat$c([indent$8(concat$c([softline$6, printed])), softline$6]);
|
|
43441
43452
|
}
|
|
43442
43453
|
}
|
|
43443
43454
|
|
|
43444
43455
|
const aligned = indentSize === 0 && quasi.value.raw.endsWith("\n") ? align$2(-Infinity, printed) : addAlignmentToDoc$2(printed, indentSize, tabWidth);
|
|
43445
|
-
parts.push(group$7(concat$
|
|
43456
|
+
parts.push(group$7(concat$c(["${", aligned, lineSuffixBoundary$1, "}"])));
|
|
43446
43457
|
}
|
|
43447
43458
|
}, "quasis");
|
|
43448
43459
|
parts.push("`");
|
|
43449
|
-
return concat$
|
|
43460
|
+
return concat$c(parts);
|
|
43450
43461
|
}
|
|
43451
43462
|
|
|
43452
43463
|
case "TaggedTemplateExpression":
|
|
43453
|
-
return concat$
|
|
43464
|
+
return concat$c([path.call(print, "tag"), path.call(print, "typeParameters"), path.call(print, "quasi")]);
|
|
43454
43465
|
// These types are unprintable because they serve as abstract
|
|
43455
43466
|
// supertypes for other (printable) types.
|
|
43456
43467
|
|
|
@@ -43485,14 +43496,14 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43485
43496
|
return "";
|
|
43486
43497
|
|
|
43487
43498
|
case "TSNamedTupleMember":
|
|
43488
|
-
return concat$
|
|
43499
|
+
return concat$c([path.call(print, "label"), n.optional ? "?" : "", ": ", path.call(print, "elementType")]);
|
|
43489
43500
|
|
|
43490
43501
|
case "TSTupleType":
|
|
43491
43502
|
case "TupleTypeAnnotation":
|
|
43492
43503
|
{
|
|
43493
43504
|
const typesField = n.type === "TSTupleType" ? "elementTypes" : "types";
|
|
43494
43505
|
const hasRest = n[typesField].length > 0 && getLast$5(n[typesField]).type === "TSRestType";
|
|
43495
|
-
return group$7(concat$
|
|
43506
|
+
return group$7(concat$c(["[", indent$8(concat$c([softline$6, printArrayItems(path, options, typesField, print)])), ifBreak$4(shouldPrintComma$3(options, "all") && !hasRest ? "," : ""), comments.printDanglingComments(path, options,
|
|
43496
43507
|
/* sameIndent */
|
|
43497
43508
|
true), softline$6, "]"]));
|
|
43498
43509
|
}
|
|
@@ -43510,7 +43521,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43510
43521
|
return "mixed";
|
|
43511
43522
|
|
|
43512
43523
|
case "ArrayTypeAnnotation":
|
|
43513
|
-
return concat$
|
|
43524
|
+
return concat$c([path.call(print, "elementType"), "[]"]);
|
|
43514
43525
|
|
|
43515
43526
|
case "BooleanTypeAnnotation":
|
|
43516
43527
|
return "boolean";
|
|
@@ -43524,7 +43535,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43524
43535
|
case "TSDeclareFunction":
|
|
43525
43536
|
// For TypeScript the TSDeclareFunction node shares the AST
|
|
43526
43537
|
// structure with FunctionDeclaration
|
|
43527
|
-
return concat$
|
|
43538
|
+
return concat$c([n.declare ? "declare " : "", printFunctionDeclaration(path, print, options), semi]);
|
|
43528
43539
|
|
|
43529
43540
|
case "DeclareFunction":
|
|
43530
43541
|
return printFlowDeclaration(path, ["function ", path.call(print, "id"), n.predicate ? " " : "", path.call(print, "predicate"), semi]);
|
|
@@ -43539,7 +43550,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43539
43550
|
return printFlowDeclaration(path, ["var ", path.call(print, "id"), semi]);
|
|
43540
43551
|
|
|
43541
43552
|
case "DeclareExportAllDeclaration":
|
|
43542
|
-
return concat$
|
|
43553
|
+
return concat$c(["declare export *", printModuleSource$1(path, options, print)]);
|
|
43543
43554
|
|
|
43544
43555
|
case "DeclareOpaqueType":
|
|
43545
43556
|
case "OpaqueType":
|
|
@@ -43560,11 +43571,11 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43560
43571
|
return printFlowDeclaration(path, parts);
|
|
43561
43572
|
}
|
|
43562
43573
|
|
|
43563
|
-
return concat$
|
|
43574
|
+
return concat$c(parts);
|
|
43564
43575
|
}
|
|
43565
43576
|
|
|
43566
43577
|
case "EnumDeclaration":
|
|
43567
|
-
return concat$
|
|
43578
|
+
return concat$c(["enum ", path.call(print, "id"), " ", path.call(print, "body")]);
|
|
43568
43579
|
|
|
43569
43580
|
case "EnumBooleanBody":
|
|
43570
43581
|
case "EnumNumberBody":
|
|
@@ -43596,20 +43607,20 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43596
43607
|
}
|
|
43597
43608
|
|
|
43598
43609
|
if (n.members.length === 0) {
|
|
43599
|
-
parts.push(group$7(concat$
|
|
43610
|
+
parts.push(group$7(concat$c(["{", comments.printDanglingComments(path, options), softline$6, "}"])));
|
|
43600
43611
|
} else {
|
|
43601
|
-
parts.push(group$7(concat$
|
|
43612
|
+
parts.push(group$7(concat$c(["{", indent$8(concat$c([hardline$6, printArrayItems(path, options, "members", print), shouldPrintComma$3(options) ? "," : ""])), comments.printDanglingComments(path, options,
|
|
43602
43613
|
/* sameIndent */
|
|
43603
43614
|
true), hardline$6, "}"])));
|
|
43604
43615
|
}
|
|
43605
43616
|
|
|
43606
|
-
return concat$
|
|
43617
|
+
return concat$c(parts);
|
|
43607
43618
|
}
|
|
43608
43619
|
|
|
43609
43620
|
case "EnumBooleanMember":
|
|
43610
43621
|
case "EnumNumberMember":
|
|
43611
43622
|
case "EnumStringMember":
|
|
43612
|
-
return concat$
|
|
43623
|
+
return concat$c([path.call(print, "id"), " = ", typeof n.init === "object" ? path.call(print, "init") : String(n.init)]);
|
|
43613
43624
|
|
|
43614
43625
|
case "EnumDefaultedMember":
|
|
43615
43626
|
return path.call(print, "id");
|
|
@@ -43654,20 +43665,20 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43654
43665
|
parts.push(")");
|
|
43655
43666
|
}
|
|
43656
43667
|
|
|
43657
|
-
return group$7(concat$
|
|
43668
|
+
return group$7(concat$c(parts));
|
|
43658
43669
|
}
|
|
43659
43670
|
|
|
43660
43671
|
case "TSRestType":
|
|
43661
|
-
return concat$
|
|
43672
|
+
return concat$c(["...", path.call(print, "typeAnnotation")]);
|
|
43662
43673
|
|
|
43663
43674
|
case "TSOptionalType":
|
|
43664
|
-
return concat$
|
|
43675
|
+
return concat$c([path.call(print, "typeAnnotation"), "?"]);
|
|
43665
43676
|
|
|
43666
43677
|
case "FunctionTypeParam":
|
|
43667
|
-
return concat$
|
|
43678
|
+
return concat$c([path.call(print, "name"), printOptionalToken$2(path), n.name ? ": " : "", path.call(print, "typeAnnotation")]);
|
|
43668
43679
|
|
|
43669
43680
|
case "GenericTypeAnnotation":
|
|
43670
|
-
return concat$
|
|
43681
|
+
return concat$c([path.call(print, "id"), path.call(print, "typeParameters")]);
|
|
43671
43682
|
|
|
43672
43683
|
case "DeclareInterface":
|
|
43673
43684
|
case "InterfaceDeclaration":
|
|
@@ -43695,31 +43706,31 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43695
43706
|
if (n.extends && n.extends.length !== 0) {
|
|
43696
43707
|
extendsParts.push(shouldIndentOnlyHeritageClauses ? ifBreak$4(" ", line$8, {
|
|
43697
43708
|
groupId: getTypeParametersGroupId(n.typeParameters)
|
|
43698
|
-
}) : line$8, "extends ", (n.extends.length === 1 ? identity$2 : indent$8)(join$6(concat$
|
|
43709
|
+
}) : line$8, "extends ", (n.extends.length === 1 ? identity$2 : indent$8)(join$6(concat$c([",", line$8]), path.map(print, "extends"))));
|
|
43699
43710
|
}
|
|
43700
43711
|
|
|
43701
43712
|
if (n.id && hasTrailingComment$3(n.id) || n.extends && n.extends.length !== 0) {
|
|
43702
|
-
const printedExtends = concat$
|
|
43713
|
+
const printedExtends = concat$c(extendsParts);
|
|
43703
43714
|
|
|
43704
43715
|
if (shouldIndentOnlyHeritageClauses) {
|
|
43705
|
-
parts.push(group$7(concat$
|
|
43716
|
+
parts.push(group$7(concat$c(partsGroup.concat(ifBreak$4(indent$8(printedExtends), printedExtends)))));
|
|
43706
43717
|
} else {
|
|
43707
|
-
parts.push(group$7(indent$8(concat$
|
|
43718
|
+
parts.push(group$7(indent$8(concat$c(partsGroup.concat(printedExtends)))));
|
|
43708
43719
|
}
|
|
43709
43720
|
} else {
|
|
43710
43721
|
parts.push(...partsGroup, ...extendsParts);
|
|
43711
43722
|
}
|
|
43712
43723
|
|
|
43713
43724
|
parts.push(" ", path.call(print, "body"));
|
|
43714
|
-
return group$7(concat$
|
|
43725
|
+
return group$7(concat$c(parts));
|
|
43715
43726
|
}
|
|
43716
43727
|
|
|
43717
43728
|
case "ClassImplements":
|
|
43718
43729
|
case "InterfaceExtends":
|
|
43719
|
-
return concat$
|
|
43730
|
+
return concat$c([path.call(print, "id"), path.call(print, "typeParameters")]);
|
|
43720
43731
|
|
|
43721
43732
|
case "TSClassImplements":
|
|
43722
|
-
return concat$
|
|
43733
|
+
return concat$c([path.call(print, "expression"), path.call(print, "typeParameters")]);
|
|
43723
43734
|
|
|
43724
43735
|
case "TSIntersectionType":
|
|
43725
43736
|
case "IntersectionTypeAnnotation":
|
|
@@ -43733,10 +43744,10 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43733
43744
|
result.push(types[i]);
|
|
43734
43745
|
} else if (isObjectType$1(n.types[i - 1]) && isObjectType$1(n.types[i])) {
|
|
43735
43746
|
// If both are objects, don't indent
|
|
43736
|
-
result.push(concat$
|
|
43747
|
+
result.push(concat$c([" & ", wasIndented ? indent$8(types[i]) : types[i]]));
|
|
43737
43748
|
} else if (!isObjectType$1(n.types[i - 1]) && !isObjectType$1(n.types[i])) {
|
|
43738
43749
|
// If no object is involved, go to the next line if it breaks
|
|
43739
|
-
result.push(indent$8(concat$
|
|
43750
|
+
result.push(indent$8(concat$c([" &", line$8, types[i]])));
|
|
43740
43751
|
} else {
|
|
43741
43752
|
// If you go from object to non-object or vis-versa, then inline it
|
|
43742
43753
|
if (i > 1) {
|
|
@@ -43747,7 +43758,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43747
43758
|
}
|
|
43748
43759
|
}
|
|
43749
43760
|
|
|
43750
|
-
return group$7(concat$
|
|
43761
|
+
return group$7(concat$c(result));
|
|
43751
43762
|
}
|
|
43752
43763
|
|
|
43753
43764
|
case "TSUnionType":
|
|
@@ -43786,21 +43797,21 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43786
43797
|
}
|
|
43787
43798
|
|
|
43788
43799
|
const shouldAddStartLine = shouldIndent && !hasLeadingOwnLineComment$1(options.originalText, n, options);
|
|
43789
|
-
const code = concat$
|
|
43800
|
+
const code = concat$c([ifBreak$4(concat$c([shouldAddStartLine ? line$8 : "", "| "])), join$6(concat$c([line$8, "| "]), printed)]);
|
|
43790
43801
|
|
|
43791
43802
|
if (needsParens_1(path, options)) {
|
|
43792
|
-
return group$7(concat$
|
|
43803
|
+
return group$7(concat$c([indent$8(code), softline$6]));
|
|
43793
43804
|
}
|
|
43794
43805
|
|
|
43795
43806
|
if (parent.type === "TupleTypeAnnotation" && parent.types.length > 1 || parent.type === "TSTupleType" && parent.elementTypes.length > 1) {
|
|
43796
|
-
return group$7(concat$
|
|
43807
|
+
return group$7(concat$c([indent$8(concat$c([ifBreak$4(concat$c(["(", softline$6])), code])), softline$6, ifBreak$4(")")]));
|
|
43797
43808
|
}
|
|
43798
43809
|
|
|
43799
43810
|
return group$7(shouldIndent ? indent$8(code) : code);
|
|
43800
43811
|
}
|
|
43801
43812
|
|
|
43802
43813
|
case "NullableTypeAnnotation":
|
|
43803
|
-
return concat$
|
|
43814
|
+
return concat$c(["?", path.call(print, "typeAnnotation")]);
|
|
43804
43815
|
|
|
43805
43816
|
case "TSNullKeyword":
|
|
43806
43817
|
case "NullLiteralTypeAnnotation":
|
|
@@ -43821,12 +43832,12 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43821
43832
|
}
|
|
43822
43833
|
|
|
43823
43834
|
parts.push(path.call(print, "value"));
|
|
43824
|
-
return concat$
|
|
43835
|
+
return concat$c(parts);
|
|
43825
43836
|
|
|
43826
43837
|
case "ObjectTypeIndexer":
|
|
43827
43838
|
{
|
|
43828
43839
|
const variance = getFlowVariance$1(n);
|
|
43829
|
-
return concat$
|
|
43840
|
+
return concat$c([variance || "", "[", path.call(print, "id"), n.id ? ": " : "", path.call(print, "key"), "]: ", path.call(print, "value")]);
|
|
43830
43841
|
}
|
|
43831
43842
|
|
|
43832
43843
|
case "ObjectTypeProperty":
|
|
@@ -43840,11 +43851,11 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43840
43851
|
modifier = "static ";
|
|
43841
43852
|
}
|
|
43842
43853
|
|
|
43843
|
-
return concat$
|
|
43854
|
+
return concat$c([modifier, isGetterOrSetter$1(n) ? n.kind + " " : "", variance || "", printPropertyKey(path, options, print), printOptionalToken$2(path), isFunctionNotation$1(n, options) ? "" : ": ", path.call(print, "value")]);
|
|
43844
43855
|
}
|
|
43845
43856
|
|
|
43846
43857
|
case "QualifiedTypeIdentifier":
|
|
43847
|
-
return concat$
|
|
43858
|
+
return concat$c([path.call(print, "qualification"), ".", path.call(print, "id")]);
|
|
43848
43859
|
|
|
43849
43860
|
case "StringLiteralTypeAnnotation":
|
|
43850
43861
|
return nodeStr(n, options);
|
|
@@ -43870,12 +43881,12 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43870
43881
|
|
|
43871
43882
|
const printed = printAssignmentRight(n.id, n.right, path.call(print, "right"), options);
|
|
43872
43883
|
parts.push("type ", path.call(print, "id"), path.call(print, "typeParameters"), " =", printed, semi);
|
|
43873
|
-
return group$7(concat$
|
|
43884
|
+
return group$7(concat$c(parts));
|
|
43874
43885
|
}
|
|
43875
43886
|
|
|
43876
43887
|
case "TypeCastExpression":
|
|
43877
43888
|
{
|
|
43878
|
-
return concat$
|
|
43889
|
+
return concat$c(["(", path.call(print, "expression"), printTypeAnnotation(path, options, print), ")"]);
|
|
43879
43890
|
}
|
|
43880
43891
|
|
|
43881
43892
|
case "TypeParameterDeclaration":
|
|
@@ -43888,7 +43899,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43888
43899
|
const commentSyntax = commentStart >= 0 && options.originalText.slice(commentStart).match(/^\/\*\s*::/);
|
|
43889
43900
|
|
|
43890
43901
|
if (commentSyntax) {
|
|
43891
|
-
return concat$
|
|
43902
|
+
return concat$c(["/*:: ", printTypeParameters(path, options, print, "params"), " */"]);
|
|
43892
43903
|
}
|
|
43893
43904
|
|
|
43894
43905
|
return printTypeParameters(path, options, print, "params");
|
|
@@ -43911,7 +43922,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43911
43922
|
}
|
|
43912
43923
|
|
|
43913
43924
|
parts.push("]");
|
|
43914
|
-
return concat$
|
|
43925
|
+
return concat$c(parts);
|
|
43915
43926
|
}
|
|
43916
43927
|
|
|
43917
43928
|
const variance = getFlowVariance$1(n);
|
|
@@ -43944,11 +43955,11 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43944
43955
|
parts.push(",");
|
|
43945
43956
|
}
|
|
43946
43957
|
|
|
43947
|
-
return concat$
|
|
43958
|
+
return concat$c(parts);
|
|
43948
43959
|
}
|
|
43949
43960
|
|
|
43950
43961
|
case "TypeofTypeAnnotation":
|
|
43951
|
-
return concat$
|
|
43962
|
+
return concat$c(["typeof ", path.call(print, "argument")]);
|
|
43952
43963
|
|
|
43953
43964
|
case "VoidTypeAnnotation":
|
|
43954
43965
|
return "void";
|
|
@@ -43960,7 +43971,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
43960
43971
|
// supported by the pretty-printer.
|
|
43961
43972
|
|
|
43962
43973
|
case "DeclaredPredicate":
|
|
43963
|
-
return concat$
|
|
43974
|
+
return concat$c(["%checks(", path.call(print, "value"), ")"]);
|
|
43964
43975
|
|
|
43965
43976
|
case "TSAbstractKeyword":
|
|
43966
43977
|
return "abstract";
|
|
@@ -44026,10 +44037,10 @@ function printPathNoParens(path, options, print, args) {
|
|
|
44026
44037
|
return "void";
|
|
44027
44038
|
|
|
44028
44039
|
case "TSAsExpression":
|
|
44029
|
-
return concat$
|
|
44040
|
+
return concat$c([path.call(print, "expression"), " as ", path.call(print, "typeAnnotation")]);
|
|
44030
44041
|
|
|
44031
44042
|
case "TSArrayType":
|
|
44032
|
-
return concat$
|
|
44043
|
+
return concat$c([path.call(print, "elementType"), "[]"]);
|
|
44033
44044
|
|
|
44034
44045
|
case "TSPropertySignature":
|
|
44035
44046
|
{
|
|
@@ -44061,7 +44072,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
44061
44072
|
parts.push(" = ", path.call(print, "initializer"));
|
|
44062
44073
|
}
|
|
44063
44074
|
|
|
44064
|
-
return concat$
|
|
44075
|
+
return concat$c(parts);
|
|
44065
44076
|
}
|
|
44066
44077
|
|
|
44067
44078
|
case "TSParameterProperty":
|
|
@@ -44082,13 +44093,13 @@ function printPathNoParens(path, options, print, args) {
|
|
|
44082
44093
|
}
|
|
44083
44094
|
|
|
44084
44095
|
parts.push(path.call(print, "parameter"));
|
|
44085
|
-
return concat$
|
|
44096
|
+
return concat$c(parts);
|
|
44086
44097
|
|
|
44087
44098
|
case "TSTypeReference":
|
|
44088
|
-
return concat$
|
|
44099
|
+
return concat$c([path.call(print, "typeName"), printTypeParameters(path, options, print, "typeParameters")]);
|
|
44089
44100
|
|
|
44090
44101
|
case "TSTypeQuery":
|
|
44091
|
-
return concat$
|
|
44102
|
+
return concat$c(["typeof ", path.call(print, "exprName")]);
|
|
44092
44103
|
|
|
44093
44104
|
case "TSIndexSignature":
|
|
44094
44105
|
{
|
|
@@ -44098,27 +44109,27 @@ function printPathNoParens(path, options, print, args) {
|
|
|
44098
44109
|
// So we leave off the trailing comma when there's just one parameter.
|
|
44099
44110
|
|
|
44100
44111
|
const trailingComma = n.parameters.length > 1 ? ifBreak$4(shouldPrintComma$3(options) ? "," : "") : "";
|
|
44101
|
-
const parametersGroup = group$7(concat$
|
|
44102
|
-
return concat$
|
|
44112
|
+
const parametersGroup = group$7(concat$c([indent$8(concat$c([softline$6, join$6(concat$c([", ", softline$6]), path.map(print, "parameters"))])), trailingComma, softline$6]));
|
|
44113
|
+
return concat$c([n.export ? "export " : "", n.accessibility ? concat$c([n.accessibility, " "]) : "", n.static ? "static " : "", n.readonly ? "readonly " : "", "[", n.parameters ? parametersGroup : "", n.typeAnnotation ? "]: " : "]", n.typeAnnotation ? path.call(print, "typeAnnotation") : "", parent.type === "ClassBody" ? semi : ""]);
|
|
44103
44114
|
}
|
|
44104
44115
|
|
|
44105
44116
|
case "TSTypePredicate":
|
|
44106
|
-
return concat$
|
|
44117
|
+
return concat$c([n.asserts ? "asserts " : "", path.call(print, "parameterName"), n.typeAnnotation ? concat$c([" is ", path.call(print, "typeAnnotation")]) : ""]);
|
|
44107
44118
|
|
|
44108
44119
|
case "TSNonNullExpression":
|
|
44109
|
-
return concat$
|
|
44120
|
+
return concat$c([path.call(print, "expression"), "!"]);
|
|
44110
44121
|
|
|
44111
44122
|
case "TSThisType":
|
|
44112
44123
|
return "this";
|
|
44113
44124
|
|
|
44114
44125
|
case "TSImportType":
|
|
44115
|
-
return concat$
|
|
44126
|
+
return concat$c([!n.isTypeOf ? "" : "typeof ", "import(", path.call(print, n.parameter ? "parameter" : "argument"), ")", !n.qualifier ? "" : concat$c([".", path.call(print, "qualifier")]), printTypeParameters(path, options, print, "typeParameters")]);
|
|
44116
44127
|
|
|
44117
44128
|
case "TSLiteralType":
|
|
44118
44129
|
return path.call(print, "literal");
|
|
44119
44130
|
|
|
44120
44131
|
case "TSIndexedAccessType":
|
|
44121
|
-
return concat$
|
|
44132
|
+
return concat$c([path.call(print, "objectType"), "[", path.call(print, "indexType"), "]"]);
|
|
44122
44133
|
|
|
44123
44134
|
case "TSConstructSignatureDeclaration":
|
|
44124
44135
|
case "TSCallSignatureDeclaration":
|
|
@@ -44139,16 +44150,16 @@ function printPathNoParens(path, options, print, args) {
|
|
|
44139
44150
|
parts.push(isType ? " => " : ": ", path.call(print, "returnType"), path.call(print, "typeAnnotation"));
|
|
44140
44151
|
}
|
|
44141
44152
|
|
|
44142
|
-
return concat$
|
|
44153
|
+
return concat$c(parts);
|
|
44143
44154
|
}
|
|
44144
44155
|
|
|
44145
44156
|
case "TSTypeOperator":
|
|
44146
|
-
return concat$
|
|
44157
|
+
return concat$c([n.operator, " ", path.call(print, "typeAnnotation")]);
|
|
44147
44158
|
|
|
44148
44159
|
case "TSMappedType":
|
|
44149
44160
|
{
|
|
44150
44161
|
const shouldBreak = hasNewlineInRange$5(options.originalText, options.locStart(n), options.locEnd(n));
|
|
44151
|
-
return group$7(concat$
|
|
44162
|
+
return group$7(concat$c(["{", indent$8(concat$c([options.bracketSpacing ? line$8 : softline$6, n.readonly ? concat$c([getTypeScriptMappedTypeModifier$1(n.readonly, "readonly"), " "]) : "", printTypeScriptModifiers(path, options, print), path.call(print, "typeParameter"), n.optional ? getTypeScriptMappedTypeModifier$1(n.optional, "?") : "", n.typeAnnotation ? ": " : "", path.call(print, "typeAnnotation"), ifBreak$4(semi, "")])), comments.printDanglingComments(path, options,
|
|
44152
44163
|
/* sameIndent */
|
|
44153
44164
|
true), options.bracketSpacing ? line$8 : softline$6, "}"]), {
|
|
44154
44165
|
shouldBreak
|
|
@@ -44156,7 +44167,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
44156
44167
|
}
|
|
44157
44168
|
|
|
44158
44169
|
case "TSMethodSignature":
|
|
44159
|
-
parts.push(n.accessibility ? concat$
|
|
44170
|
+
parts.push(n.accessibility ? concat$c([n.accessibility, " "]) : "", n.export ? "export " : "", n.static ? "static " : "", n.readonly ? "readonly " : "", n.computed ? "[" : "", path.call(print, "key"), n.computed ? "]" : "", printOptionalToken$2(path), printFunctionParams(path, print, options,
|
|
44160
44171
|
/* expandArg */
|
|
44161
44172
|
false,
|
|
44162
44173
|
/* printTypeParams */
|
|
@@ -44166,7 +44177,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
44166
44177
|
parts.push(": ", path.call(print, "returnType"), path.call(print, "typeAnnotation"));
|
|
44167
44178
|
}
|
|
44168
44179
|
|
|
44169
|
-
return group$7(concat$
|
|
44180
|
+
return group$7(concat$c(parts));
|
|
44170
44181
|
|
|
44171
44182
|
case "TSNamespaceExportDeclaration":
|
|
44172
44183
|
parts.push("export as namespace ", path.call(print, "id"));
|
|
@@ -44175,7 +44186,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
44175
44186
|
parts.push(";");
|
|
44176
44187
|
}
|
|
44177
44188
|
|
|
44178
|
-
return group$7(concat$
|
|
44189
|
+
return group$7(concat$c(parts));
|
|
44179
44190
|
|
|
44180
44191
|
case "TSEnumDeclaration":
|
|
44181
44192
|
if (n.declare) {
|
|
@@ -44193,14 +44204,14 @@ function printPathNoParens(path, options, print, args) {
|
|
|
44193
44204
|
parts.push("enum ", path.call(print, "id"), " ");
|
|
44194
44205
|
|
|
44195
44206
|
if (n.members.length === 0) {
|
|
44196
|
-
parts.push(group$7(concat$
|
|
44207
|
+
parts.push(group$7(concat$c(["{", comments.printDanglingComments(path, options), softline$6, "}"])));
|
|
44197
44208
|
} else {
|
|
44198
|
-
parts.push(group$7(concat$
|
|
44209
|
+
parts.push(group$7(concat$c(["{", indent$8(concat$c([hardline$6, printArrayItems(path, options, "members", print), shouldPrintComma$3(options, "es5") ? "," : ""])), comments.printDanglingComments(path, options,
|
|
44199
44210
|
/* sameIndent */
|
|
44200
44211
|
true), hardline$6, "}"])));
|
|
44201
44212
|
}
|
|
44202
44213
|
|
|
44203
|
-
return concat$
|
|
44214
|
+
return concat$c(parts);
|
|
44204
44215
|
|
|
44205
44216
|
case "TSEnumMember":
|
|
44206
44217
|
parts.push(path.call(print, "id"));
|
|
@@ -44209,7 +44220,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
44209
44220
|
parts.push(" = ", path.call(print, "initializer"));
|
|
44210
44221
|
}
|
|
44211
44222
|
|
|
44212
|
-
return concat$
|
|
44223
|
+
return concat$c(parts);
|
|
44213
44224
|
|
|
44214
44225
|
case "TSImportEqualsDeclaration":
|
|
44215
44226
|
if (n.isExport) {
|
|
@@ -44222,10 +44233,10 @@ function printPathNoParens(path, options, print, args) {
|
|
|
44222
44233
|
parts.push(";");
|
|
44223
44234
|
}
|
|
44224
44235
|
|
|
44225
|
-
return group$7(concat$
|
|
44236
|
+
return group$7(concat$c(parts));
|
|
44226
44237
|
|
|
44227
44238
|
case "TSExternalModuleReference":
|
|
44228
|
-
return concat$
|
|
44239
|
+
return concat$c(["require(", path.call(print, "expression"), ")"]);
|
|
44229
44240
|
|
|
44230
44241
|
case "TSModuleDeclaration":
|
|
44231
44242
|
{
|
|
@@ -44262,11 +44273,11 @@ function printPathNoParens(path, options, print, args) {
|
|
|
44262
44273
|
parts.push(semi);
|
|
44263
44274
|
}
|
|
44264
44275
|
|
|
44265
|
-
return concat$
|
|
44276
|
+
return concat$c(parts);
|
|
44266
44277
|
}
|
|
44267
44278
|
|
|
44268
44279
|
case "PrivateName":
|
|
44269
|
-
return concat$
|
|
44280
|
+
return concat$c(["#", path.call(print, "id")]);
|
|
44270
44281
|
// TODO: Temporary auto-generated node type. To remove when typescript-estree has proper support for private fields.
|
|
44271
44282
|
|
|
44272
44283
|
case "TSPrivateIdentifier":
|
|
@@ -44284,7 +44295,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
44284
44295
|
});
|
|
44285
44296
|
|
|
44286
44297
|
case "TSInferType":
|
|
44287
|
-
return concat$
|
|
44298
|
+
return concat$c(["infer", " ", path.call(print, "typeParameter")]);
|
|
44288
44299
|
|
|
44289
44300
|
case "InterpreterDirective":
|
|
44290
44301
|
parts.push("#!", n.value, hardline$6);
|
|
@@ -44293,42 +44304,42 @@ function printPathNoParens(path, options, print, args) {
|
|
|
44293
44304
|
parts.push(hardline$6);
|
|
44294
44305
|
}
|
|
44295
44306
|
|
|
44296
|
-
return concat$
|
|
44307
|
+
return concat$c(parts);
|
|
44297
44308
|
|
|
44298
44309
|
case "NGRoot":
|
|
44299
|
-
return concat$
|
|
44310
|
+
return concat$c([].concat(path.call(print, "node"), !n.node.comments || n.node.comments.length === 0 ? [] : concat$c([" //", n.node.comments[0].value.trimEnd()])));
|
|
44300
44311
|
|
|
44301
44312
|
case "NGChainedExpression":
|
|
44302
|
-
return group$7(join$6(concat$
|
|
44313
|
+
return group$7(join$6(concat$c([";", line$8]), path.map(childPath => hasNgSideEffect$1(childPath) ? print(childPath) : concat$c(["(", print(childPath), ")"]), "expressions")));
|
|
44303
44314
|
|
|
44304
44315
|
case "NGEmptyExpression":
|
|
44305
44316
|
return "";
|
|
44306
44317
|
|
|
44307
44318
|
case "NGQuotedExpression":
|
|
44308
|
-
return concat$
|
|
44319
|
+
return concat$c([n.prefix, ": ", n.value.trim()]);
|
|
44309
44320
|
|
|
44310
44321
|
case "NGMicrosyntax":
|
|
44311
|
-
return concat$
|
|
44322
|
+
return concat$c(path.map((childPath, index) => concat$c([index === 0 ? "" : isNgForOf$1(childPath.getValue(), index, n) ? " " : concat$c([";", line$8]), print(childPath)]), "body"));
|
|
44312
44323
|
|
|
44313
44324
|
case "NGMicrosyntaxKey":
|
|
44314
44325
|
return /^[$_a-z][\w$]*(-[$_a-z][\w$])*$/i.test(n.name) ? n.name : JSON.stringify(n.name);
|
|
44315
44326
|
|
|
44316
44327
|
case "NGMicrosyntaxExpression":
|
|
44317
|
-
return concat$
|
|
44328
|
+
return concat$c([path.call(print, "expression"), n.alias === null ? "" : concat$c([" as ", path.call(print, "alias")])]);
|
|
44318
44329
|
|
|
44319
44330
|
case "NGMicrosyntaxKeyedExpression":
|
|
44320
44331
|
{
|
|
44321
44332
|
const index = path.getName();
|
|
44322
44333
|
const parentNode = path.getParentNode();
|
|
44323
44334
|
const shouldNotPrintColon = isNgForOf$1(n, index, parentNode) || (index === 1 && (n.key.name === "then" || n.key.name === "else") || index === 2 && n.key.name === "else" && parentNode.body[index - 1].type === "NGMicrosyntaxKeyedExpression" && parentNode.body[index - 1].key.name === "then") && parentNode.body[0].type === "NGMicrosyntaxExpression";
|
|
44324
|
-
return concat$
|
|
44335
|
+
return concat$c([path.call(print, "key"), shouldNotPrintColon ? " " : ": ", path.call(print, "expression")]);
|
|
44325
44336
|
}
|
|
44326
44337
|
|
|
44327
44338
|
case "NGMicrosyntaxLet":
|
|
44328
|
-
return concat$
|
|
44339
|
+
return concat$c(["let ", path.call(print, "key"), n.value === null ? "" : concat$c([" = ", path.call(print, "value")])]);
|
|
44329
44340
|
|
|
44330
44341
|
case "NGMicrosyntaxAs":
|
|
44331
|
-
return concat$
|
|
44342
|
+
return concat$c([path.call(print, "key"), " as ", path.call(print, "alias")]);
|
|
44332
44343
|
|
|
44333
44344
|
case "PipelineBareFunction":
|
|
44334
44345
|
return path.call(print, "callee");
|
|
@@ -44339,7 +44350,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
44339
44350
|
case "PipelinePrimaryTopicReference":
|
|
44340
44351
|
{
|
|
44341
44352
|
parts.push("#");
|
|
44342
|
-
return concat$
|
|
44353
|
+
return concat$c(parts);
|
|
44343
44354
|
}
|
|
44344
44355
|
|
|
44345
44356
|
case "ArgumentPlaceholder":
|
|
@@ -44353,13 +44364,13 @@ function printPathNoParens(path, options, print, args) {
|
|
|
44353
44364
|
return "?";
|
|
44354
44365
|
|
|
44355
44366
|
case "TSJSDocNullableType":
|
|
44356
|
-
return concat$
|
|
44367
|
+
return concat$c(["?", path.call(print, "typeAnnotation")]);
|
|
44357
44368
|
|
|
44358
44369
|
case "TSJSDocNonNullableType":
|
|
44359
|
-
return concat$
|
|
44370
|
+
return concat$c(["!", path.call(print, "typeAnnotation")]);
|
|
44360
44371
|
|
|
44361
44372
|
case "TSJSDocFunctionType":
|
|
44362
|
-
return concat$
|
|
44373
|
+
return concat$c(["function(", // The parameters could be here, but typescript-estree doesn't convert them anyway (throws an error).
|
|
44363
44374
|
"): ", path.call(print, "typeAnnotation")]);
|
|
44364
44375
|
|
|
44365
44376
|
default:
|
|
@@ -44421,7 +44432,7 @@ function printStatementSequence(path, options, print) {
|
|
|
44421
44432
|
parts.push(hardline$6);
|
|
44422
44433
|
}
|
|
44423
44434
|
|
|
44424
|
-
printed.push(concat$
|
|
44435
|
+
printed.push(concat$c(parts));
|
|
44425
44436
|
});
|
|
44426
44437
|
return join$6(hardline$6, printed);
|
|
44427
44438
|
}
|
|
@@ -44430,7 +44441,7 @@ function printPropertyKey(path, options, print) {
|
|
|
44430
44441
|
const node = path.getNode();
|
|
44431
44442
|
|
|
44432
44443
|
if (node.computed) {
|
|
44433
|
-
return concat$
|
|
44444
|
+
return concat$c(["[", path.call(print, "key"), "]"]);
|
|
44434
44445
|
}
|
|
44435
44446
|
|
|
44436
44447
|
const parent = path.getParentNode();
|
|
@@ -44440,7 +44451,7 @@ function printPropertyKey(path, options, print) {
|
|
|
44440
44451
|
|
|
44441
44452
|
if (node.type === "ClassPrivateProperty" && // flow has `Identifier` key, and babel has `PrivateName` key
|
|
44442
44453
|
key.type === "Identifier") {
|
|
44443
|
-
return concat$
|
|
44454
|
+
return concat$c(["#", path.call(print, "key")]);
|
|
44444
44455
|
}
|
|
44445
44456
|
|
|
44446
44457
|
if (options.quoteProps === "consistent" && !needsQuoteProps.has(parent)) {
|
|
@@ -44491,11 +44502,11 @@ function printMethod(path, options, print) {
|
|
|
44491
44502
|
}
|
|
44492
44503
|
|
|
44493
44504
|
parts.push(printPropertyKey(path, options, print), node.optional || node.key.optional ? "?" : "", node === value ? printMethodInternal(path, options, print) : path.call(path => printMethodInternal(path, options, print), "value"));
|
|
44494
|
-
return concat$
|
|
44505
|
+
return concat$c(parts);
|
|
44495
44506
|
}
|
|
44496
44507
|
|
|
44497
44508
|
function printMethodInternal(path, options, print) {
|
|
44498
|
-
const parts = [printFunctionTypeParameters$2(path, options, print), group$7(concat$
|
|
44509
|
+
const parts = [printFunctionTypeParameters$2(path, options, print), group$7(concat$c([printFunctionParams(path, print, options), printReturnType(path, print, options)]))];
|
|
44499
44510
|
|
|
44500
44511
|
if (path.getNode().body) {
|
|
44501
44512
|
parts.push(" ", path.call(print, "body"));
|
|
@@ -44503,7 +44514,7 @@ function printMethodInternal(path, options, print) {
|
|
|
44503
44514
|
parts.push(options.semi ? ";" : "");
|
|
44504
44515
|
}
|
|
44505
44516
|
|
|
44506
|
-
return concat$
|
|
44517
|
+
return concat$c(parts);
|
|
44507
44518
|
}
|
|
44508
44519
|
|
|
44509
44520
|
function printJestEachTemplateLiteral(path, options, print) {
|
|
@@ -44563,8 +44574,8 @@ function printJestEachTemplateLiteral(path, options, print) {
|
|
|
44563
44574
|
});
|
|
44564
44575
|
}
|
|
44565
44576
|
|
|
44566
|
-
parts.push(lineSuffixBoundary$1, "`", indent$8(concat$
|
|
44567
|
-
return concat$
|
|
44577
|
+
parts.push(lineSuffixBoundary$1, "`", indent$8(concat$c([hardline$6, join$6(hardline$6, table.map(row => join$6(" | ", row.cells.map((cell, index) => row.hasLineBreak ? cell : cell + " ".repeat(maxColumnWidths[index] - getStringWidth$3(cell))))))])), hardline$6, "`");
|
|
44578
|
+
return concat$c(parts);
|
|
44568
44579
|
}
|
|
44569
44580
|
}
|
|
44570
44581
|
|
|
@@ -44580,10 +44591,10 @@ function printTypeAnnotation(path, options, print) {
|
|
|
44580
44591
|
const isFunctionDeclarationIdentifier = parentNode.type === "DeclareFunction" && parentNode.id === node;
|
|
44581
44592
|
|
|
44582
44593
|
if (isFlowAnnotationComment$1(options.originalText, node.typeAnnotation, options)) {
|
|
44583
|
-
return concat$
|
|
44594
|
+
return concat$c([" /*: ", path.call(print, "typeAnnotation"), " */"]);
|
|
44584
44595
|
}
|
|
44585
44596
|
|
|
44586
|
-
return concat$
|
|
44597
|
+
return concat$c([isFunctionDeclarationIdentifier ? "" : isDefinite ? "!: " : ": ", path.call(print, "typeAnnotation")]);
|
|
44587
44598
|
}
|
|
44588
44599
|
|
|
44589
44600
|
function printFunctionParams(path, print, options, expandArg, printTypeParams) {
|
|
@@ -44615,16 +44626,16 @@ function printFunctionParams(path, print, options, expandArg, printTypeParams) {
|
|
|
44615
44626
|
parts.push(",", line$8);
|
|
44616
44627
|
}
|
|
44617
44628
|
|
|
44618
|
-
return concat$
|
|
44629
|
+
return concat$c(parts);
|
|
44619
44630
|
}, paramsField);
|
|
44620
44631
|
}
|
|
44621
44632
|
|
|
44622
44633
|
if (fun.rest) {
|
|
44623
|
-
printed.push(concat$
|
|
44634
|
+
printed.push(concat$c(["...", path.call(print, "rest")]));
|
|
44624
44635
|
}
|
|
44625
44636
|
|
|
44626
44637
|
if (printed.length === 0) {
|
|
44627
|
-
return concat$
|
|
44638
|
+
return concat$c([typeParams, "(", comments.printDanglingComments(path, options,
|
|
44628
44639
|
/* sameIndent */
|
|
44629
44640
|
true, comment => getNextNonSpaceNonCommentCharacter$2(options.originalText, comment, options.locEnd) === ")"), ")"]);
|
|
44630
44641
|
}
|
|
@@ -44641,7 +44652,7 @@ function printFunctionParams(path, print, options, expandArg, printTypeParams) {
|
|
|
44641
44652
|
// })
|
|
44642
44653
|
|
|
44643
44654
|
if (shouldExpandParameters) {
|
|
44644
|
-
return group$7(concat$
|
|
44655
|
+
return group$7(concat$c([removeLines$1(typeParams), "(", concat$c(printed.map(removeLines$1)), ")"]));
|
|
44645
44656
|
} // Single object destructuring should hug
|
|
44646
44657
|
//
|
|
44647
44658
|
// function({
|
|
@@ -44654,26 +44665,26 @@ function printFunctionParams(path, print, options, expandArg, printTypeParams) {
|
|
|
44654
44665
|
const hasNotParameterDecorator = fun[paramsField].every(param => !param.decorators);
|
|
44655
44666
|
|
|
44656
44667
|
if (shouldHugParameters && hasNotParameterDecorator) {
|
|
44657
|
-
return concat$
|
|
44668
|
+
return concat$c([typeParams, "(", concat$c(printed), ")"]);
|
|
44658
44669
|
} // don't break in specs, eg; `it("should maintain parens around done even when long", (done) => {})`
|
|
44659
44670
|
|
|
44660
44671
|
|
|
44661
44672
|
if (isParametersInTestCall) {
|
|
44662
|
-
return concat$
|
|
44673
|
+
return concat$c([typeParams, "(", concat$c(printed), ")"]);
|
|
44663
44674
|
}
|
|
44664
44675
|
|
|
44665
44676
|
const isFlowShorthandWithOneArg = (isObjectTypePropertyAFunction$1(parent, options) || isTypeAnnotationAFunction$1(parent, options) || parent.type === "TypeAlias" || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType" || parent.type === "IntersectionTypeAnnotation" || parent.type === "FunctionTypeAnnotation" && parent.returnType === fun) && fun[paramsField].length === 1 && fun[paramsField][0].name === null && fun[paramsField][0].typeAnnotation && fun.typeParameters === null && isSimpleFlowType$1(fun[paramsField][0].typeAnnotation) && !fun.rest;
|
|
44666
44677
|
|
|
44667
44678
|
if (isFlowShorthandWithOneArg) {
|
|
44668
44679
|
if (options.arrowParens === "always") {
|
|
44669
|
-
return concat$
|
|
44680
|
+
return concat$c(["(", concat$c(printed), ")"]);
|
|
44670
44681
|
}
|
|
44671
44682
|
|
|
44672
|
-
return concat$
|
|
44683
|
+
return concat$c(printed);
|
|
44673
44684
|
}
|
|
44674
44685
|
|
|
44675
44686
|
const canHaveTrailingComma = !(lastParam && lastParam.type === "RestElement") && !fun.rest;
|
|
44676
|
-
return concat$
|
|
44687
|
+
return concat$c([typeParams, "(", indent$8(concat$c([softline$6, concat$c(printed)])), ifBreak$4(canHaveTrailingComma && shouldPrintComma$3(options, "all") ? "," : ""), softline$6, ")"]);
|
|
44677
44688
|
}
|
|
44678
44689
|
|
|
44679
44690
|
function shouldPrintParamsWithoutParens(path, options) {
|
|
@@ -44714,8 +44725,8 @@ function printFunctionDeclaration(path, print, options) {
|
|
|
44714
44725
|
parts.push(path.call(print, "id"));
|
|
44715
44726
|
}
|
|
44716
44727
|
|
|
44717
|
-
parts.push(printFunctionTypeParameters$2(path, options, print), group$7(concat$
|
|
44718
|
-
return concat$
|
|
44728
|
+
parts.push(printFunctionTypeParameters$2(path, options, print), group$7(concat$c([printFunctionParams(path, print, options), printReturnType(path, print, options)])), n.body ? " " : "", path.call(print, "body"));
|
|
44729
|
+
return concat$c(parts);
|
|
44719
44730
|
}
|
|
44720
44731
|
|
|
44721
44732
|
function printReturnType(path, print, options) {
|
|
@@ -44723,7 +44734,7 @@ function printReturnType(path, print, options) {
|
|
|
44723
44734
|
const returnType = path.call(print, "returnType");
|
|
44724
44735
|
|
|
44725
44736
|
if (n.returnType && isFlowAnnotationComment$1(options.originalText, n.returnType, options)) {
|
|
44726
|
-
return concat$
|
|
44737
|
+
return concat$c([" /*: ", returnType, " */"]);
|
|
44727
44738
|
}
|
|
44728
44739
|
|
|
44729
44740
|
const parts = [returnType]; // prepend colon to TypeScript type annotation
|
|
@@ -44738,7 +44749,7 @@ function printReturnType(path, print, options) {
|
|
|
44738
44749
|
parts.push(n.returnType ? " " : ": ", path.call(print, "predicate"));
|
|
44739
44750
|
}
|
|
44740
44751
|
|
|
44741
|
-
return concat$
|
|
44752
|
+
return concat$c(parts);
|
|
44742
44753
|
}
|
|
44743
44754
|
|
|
44744
44755
|
function printExportDeclaration(path, options, print) {
|
|
@@ -44774,7 +44785,7 @@ function printExportDeclaration(path, options, print) {
|
|
|
44774
44785
|
parts.push(semi);
|
|
44775
44786
|
}
|
|
44776
44787
|
|
|
44777
|
-
return concat$
|
|
44788
|
+
return concat$c(parts);
|
|
44778
44789
|
}
|
|
44779
44790
|
|
|
44780
44791
|
function printFlowDeclaration(path, parts) {
|
|
@@ -44789,7 +44800,7 @@ function printFlowDeclaration(path, parts) {
|
|
|
44789
44800
|
parts.unshift("declare ");
|
|
44790
44801
|
}
|
|
44791
44802
|
|
|
44792
|
-
return concat$
|
|
44803
|
+
return concat$c(parts);
|
|
44793
44804
|
}
|
|
44794
44805
|
|
|
44795
44806
|
function printTypeScriptModifiers(path, options, print) {
|
|
@@ -44799,7 +44810,7 @@ function printTypeScriptModifiers(path, options, print) {
|
|
|
44799
44810
|
return "";
|
|
44800
44811
|
}
|
|
44801
44812
|
|
|
44802
|
-
return concat$
|
|
44813
|
+
return concat$c([join$6(" ", path.map(print, "modifiers")), " "]);
|
|
44803
44814
|
}
|
|
44804
44815
|
|
|
44805
44816
|
const typeParametersGroupIds = new WeakMap();
|
|
@@ -44845,14 +44856,14 @@ function printTypeParameters(path, options, print, paramsKey) {
|
|
|
44845
44856
|
return printed;
|
|
44846
44857
|
}
|
|
44847
44858
|
|
|
44848
|
-
return concat$
|
|
44859
|
+
return concat$c([printed, hardline$6]);
|
|
44849
44860
|
}
|
|
44850
44861
|
|
|
44851
44862
|
if (shouldInline) {
|
|
44852
|
-
return concat$
|
|
44863
|
+
return concat$c(["<", join$6(", ", path.map(print, paramsKey)), printDanglingCommentsForInline(n), ">"]);
|
|
44853
44864
|
}
|
|
44854
44865
|
|
|
44855
|
-
return group$7(concat$
|
|
44866
|
+
return group$7(concat$c(["<", indent$8(concat$c([softline$6, join$6(concat$c([",", line$8]), path.map(print, paramsKey))])), ifBreak$4(options.parser !== "typescript" && options.parser !== "babel-ts" && shouldPrintComma$3(options, "all") ? "," : ""), softline$6, ">"]), {
|
|
44856
44867
|
id: getTypeParametersGroupId(n)
|
|
44857
44868
|
});
|
|
44858
44869
|
}
|
|
@@ -44890,12 +44901,12 @@ function printClass(path, options, print) {
|
|
|
44890
44901
|
}) => marker === listName);
|
|
44891
44902
|
extendsParts.push(shouldIndentOnlyHeritageClauses ? ifBreak$4(" ", line$8, {
|
|
44892
44903
|
groupId: getTypeParametersGroupId(n.typeParameters)
|
|
44893
|
-
}) : line$8, printedLeadingComments, printedLeadingComments && hardline$6, listName, group$7(indent$8(concat$
|
|
44904
|
+
}) : line$8, printedLeadingComments, printedLeadingComments && hardline$6, listName, group$7(indent$8(concat$c([line$8, join$6(concat$c([",", line$8]), path.map(print, listName))]))));
|
|
44894
44905
|
}
|
|
44895
44906
|
}
|
|
44896
44907
|
|
|
44897
44908
|
if (n.superClass) {
|
|
44898
|
-
const printed = concat$
|
|
44909
|
+
const printed = concat$c(["extends ", path.call(print, "superClass"), path.call(print, "superTypeParameters")]);
|
|
44899
44910
|
const printedWithComments = path.call(superClass => comments.printComments(superClass, () => printed, options), "superClass");
|
|
44900
44911
|
|
|
44901
44912
|
if (groupMode) {
|
|
@@ -44911,12 +44922,12 @@ function printClass(path, options, print) {
|
|
|
44911
44922
|
printList("implements");
|
|
44912
44923
|
|
|
44913
44924
|
if (groupMode) {
|
|
44914
|
-
const printedExtends = concat$
|
|
44925
|
+
const printedExtends = concat$c(extendsParts);
|
|
44915
44926
|
|
|
44916
44927
|
if (shouldIndentOnlyHeritageClauses) {
|
|
44917
|
-
parts.push(group$7(concat$
|
|
44928
|
+
parts.push(group$7(concat$c(partsGroup.concat(ifBreak$4(indent$8(printedExtends), printedExtends)))));
|
|
44918
44929
|
} else {
|
|
44919
|
-
parts.push(group$7(indent$8(concat$
|
|
44930
|
+
parts.push(group$7(indent$8(concat$c(partsGroup.concat(printedExtends)))));
|
|
44920
44931
|
}
|
|
44921
44932
|
} else {
|
|
44922
44933
|
parts.push(...partsGroup, ...extendsParts);
|
|
@@ -45067,14 +45078,14 @@ function printJSXElement(path, options, print) {
|
|
|
45067
45078
|
const n = path.getValue();
|
|
45068
45079
|
|
|
45069
45080
|
if (n.type === "JSXElement" && isEmptyJSXElement$1(n)) {
|
|
45070
|
-
return concat$
|
|
45081
|
+
return concat$c([path.call(print, "openingElement"), path.call(print, "closingElement")]);
|
|
45071
45082
|
}
|
|
45072
45083
|
|
|
45073
45084
|
const openingLines = n.type === "JSXElement" ? path.call(print, "openingElement") : path.call(print, "openingFragment");
|
|
45074
45085
|
const closingLines = n.type === "JSXElement" ? path.call(print, "closingElement") : path.call(print, "closingFragment");
|
|
45075
45086
|
|
|
45076
45087
|
if (n.children.length === 1 && n.children[0].type === "JSXExpressionContainer" && (n.children[0].expression.type === "TemplateLiteral" || n.children[0].expression.type === "TaggedTemplateExpression")) {
|
|
45077
|
-
return concat$
|
|
45088
|
+
return concat$c([openingLines, concat$c(path.map(print, "children")), closingLines]);
|
|
45078
45089
|
} // Convert `{" "}` to text nodes containing a space.
|
|
45079
45090
|
// This makes it easy to turn them into `jsxWhitespace` which
|
|
45080
45091
|
// can then print as either a space or `{" "}` when breaking.
|
|
@@ -45098,7 +45109,7 @@ function printJSXElement(path, options, print) {
|
|
|
45098
45109
|
let forcedBreak = willBreak$3(openingLines) || containsTag || containsMultipleAttributes || containsMultipleExpressions;
|
|
45099
45110
|
const isMdxBlock = path.getParentNode().rootMarker === "mdx";
|
|
45100
45111
|
const rawJsxWhitespace = options.singleQuote ? "{' '}" : '{" "}';
|
|
45101
|
-
const jsxWhitespace = isMdxBlock ? concat$
|
|
45112
|
+
const jsxWhitespace = isMdxBlock ? concat$c([" "]) : ifBreak$4(concat$c([rawJsxWhitespace, softline$6]), " ");
|
|
45102
45113
|
const isFacebookTranslationTag = n.openingElement && n.openingElement.name && n.openingElement.name.name === "fbt";
|
|
45103
45114
|
const children = printJSXChildren(path, options, print, jsxWhitespace, isFacebookTranslationTag);
|
|
45104
45115
|
const containsText = n.children.some(child => isMeaningfulJSXText$1(child)); // We can end up we multiple whitespace elements with empty string
|
|
@@ -45147,7 +45158,7 @@ function printJSXElement(path, options, print) {
|
|
|
45147
45158
|
} // Leading whitespace
|
|
45148
45159
|
|
|
45149
45160
|
|
|
45150
|
-
multilineChildren.push(concat$
|
|
45161
|
+
multilineChildren.push(concat$c([rawJsxWhitespace, hardline$6]));
|
|
45151
45162
|
return;
|
|
45152
45163
|
} else if (i === children.length - 1) {
|
|
45153
45164
|
// Trailing whitespace
|
|
@@ -45169,7 +45180,7 @@ function printJSXElement(path, options, print) {
|
|
|
45169
45180
|
// When there is no text (just tags and expressions) we use `group`
|
|
45170
45181
|
// to output each on a separate line.
|
|
45171
45182
|
|
|
45172
|
-
const content = containsText ? fill$3(multilineChildren) : group$7(concat$
|
|
45183
|
+
const content = containsText ? fill$3(multilineChildren) : group$7(concat$c(multilineChildren), {
|
|
45173
45184
|
shouldBreak: true
|
|
45174
45185
|
});
|
|
45175
45186
|
|
|
@@ -45177,13 +45188,13 @@ function printJSXElement(path, options, print) {
|
|
|
45177
45188
|
return content;
|
|
45178
45189
|
}
|
|
45179
45190
|
|
|
45180
|
-
const multiLineElem = group$7(concat$
|
|
45191
|
+
const multiLineElem = group$7(concat$c([openingLines, indent$8(concat$c([hardline$6, content])), hardline$6, closingLines]));
|
|
45181
45192
|
|
|
45182
45193
|
if (forcedBreak) {
|
|
45183
45194
|
return multiLineElem;
|
|
45184
45195
|
}
|
|
45185
45196
|
|
|
45186
|
-
return conditionalGroup$3([group$7(concat$
|
|
45197
|
+
return conditionalGroup$3([group$7(concat$c([openingLines, concat$c(children), closingLines])), multiLineElem]);
|
|
45187
45198
|
}
|
|
45188
45199
|
|
|
45189
45200
|
function maybeWrapJSXElementInParens(path, elem, options) {
|
|
@@ -45213,7 +45224,7 @@ function maybeWrapJSXElementInParens(path, elem, options) {
|
|
|
45213
45224
|
|
|
45214
45225
|
const shouldBreak = path.match(undefined, node => node.type === "ArrowFunctionExpression", isCallOrOptionalCallExpression$2, node => node.type === "JSXExpressionContainer");
|
|
45215
45226
|
const needsParens = needsParens_1(path, options);
|
|
45216
|
-
return group$7(concat$
|
|
45227
|
+
return group$7(concat$c([needsParens ? "" : ifBreak$4("("), indent$8(concat$c([softline$6, elem])), softline$6, needsParens ? "" : ifBreak$4(")")]), {
|
|
45217
45228
|
shouldBreak
|
|
45218
45229
|
});
|
|
45219
45230
|
}
|
|
@@ -45273,8 +45284,8 @@ function printBinaryishExpressions(path, print, options, isNested, isInsideParen
|
|
|
45273
45284
|
const shouldInline = shouldInlineLogicalExpression(node);
|
|
45274
45285
|
const lineBeforeOperator = (node.operator === "|>" || node.type === "NGPipeExpression" || node.operator === "|" && options.parser === "__vue_expression") && !hasLeadingOwnLineComment$1(options.originalText, node.right, options);
|
|
45275
45286
|
const operator = node.type === "NGPipeExpression" ? "|" : node.operator;
|
|
45276
|
-
const rightSuffix = node.type === "NGPipeExpression" && node.arguments.length !== 0 ? group$7(indent$8(concat$
|
|
45277
|
-
const right = shouldInline ? concat$
|
|
45287
|
+
const rightSuffix = node.type === "NGPipeExpression" && node.arguments.length !== 0 ? group$7(indent$8(concat$c([softline$6, ": ", join$6(concat$c([softline$6, ":", ifBreak$4(" ")]), path.map(print, "arguments").map(arg => align$2(2, group$7(arg))))]))) : "";
|
|
45288
|
+
const right = shouldInline ? concat$c([operator, " ", path.call(print, "right"), rightSuffix]) : concat$c([lineBeforeOperator ? line$8 : "", operator, lineBeforeOperator ? " " : line$8, path.call(print, "right"), rightSuffix]); // If there's only a single binary expression, we want to create a group
|
|
45278
45289
|
// in order to avoid having a small right part like -1 be on its own line.
|
|
45279
45290
|
|
|
45280
45291
|
const parent = path.getParentNode();
|
|
@@ -45287,7 +45298,7 @@ function printBinaryishExpressions(path, print, options, isNested, isInsideParen
|
|
|
45287
45298
|
// only for the left and right parts
|
|
45288
45299
|
|
|
45289
45300
|
if (isNested && node.comments) {
|
|
45290
|
-
parts = normalizeParts$1(comments.printComments(path, () => concat$
|
|
45301
|
+
parts = normalizeParts$1(comments.printComments(path, () => concat$c(parts), options).parts);
|
|
45291
45302
|
}
|
|
45292
45303
|
} else {
|
|
45293
45304
|
// Our stopping case. Simply print the node normally.
|
|
@@ -45299,17 +45310,17 @@ function printBinaryishExpressions(path, print, options, isNested, isInsideParen
|
|
|
45299
45310
|
|
|
45300
45311
|
function printAssignmentRight(leftNode, rightNode, printedRight, options) {
|
|
45301
45312
|
if (hasLeadingOwnLineComment$1(options.originalText, rightNode, options)) {
|
|
45302
|
-
return indent$8(concat$
|
|
45313
|
+
return indent$8(concat$c([line$8, printedRight]));
|
|
45303
45314
|
}
|
|
45304
45315
|
|
|
45305
45316
|
const canBreak = isBinaryish$1(rightNode) && !shouldInlineLogicalExpression(rightNode) || rightNode.type === "ConditionalExpression" && isBinaryish$1(rightNode.test) && !shouldInlineLogicalExpression(rightNode.test) || rightNode.type === "StringLiteralTypeAnnotation" || rightNode.type === "ClassExpression" && rightNode.decorators && rightNode.decorators.length || (leftNode.type === "Identifier" || isStringLiteral$1(leftNode) || leftNode.type === "MemberExpression") && (isStringLiteral$1(rightNode) || isMemberExpressionChain$1(rightNode)) && // do not put values on a separate line from the key in json
|
|
45306
45317
|
options.parser !== "json" && options.parser !== "json5" || rightNode.type === "SequenceExpression";
|
|
45307
45318
|
|
|
45308
45319
|
if (canBreak) {
|
|
45309
|
-
return group$7(indent$8(concat$
|
|
45320
|
+
return group$7(indent$8(concat$c([line$8, printedRight])));
|
|
45310
45321
|
}
|
|
45311
45322
|
|
|
45312
|
-
return concat$
|
|
45323
|
+
return concat$c([" ", printedRight]);
|
|
45313
45324
|
}
|
|
45314
45325
|
|
|
45315
45326
|
function printAssignment(leftNode, printedLeft, operator, rightNode, printedRight, options) {
|
|
@@ -45318,7 +45329,7 @@ function printAssignment(leftNode, printedLeft, operator, rightNode, printedRigh
|
|
|
45318
45329
|
}
|
|
45319
45330
|
|
|
45320
45331
|
const printed = printAssignmentRight(leftNode, rightNode, printedRight, options);
|
|
45321
|
-
return group$7(concat$
|
|
45332
|
+
return group$7(concat$c([printedLeft, operator, printed]));
|
|
45322
45333
|
}
|
|
45323
45334
|
|
|
45324
45335
|
function adjustClause(node, clause, forceSpace) {
|
|
@@ -45327,10 +45338,10 @@ function adjustClause(node, clause, forceSpace) {
|
|
|
45327
45338
|
}
|
|
45328
45339
|
|
|
45329
45340
|
if (node.type === "BlockStatement" || forceSpace) {
|
|
45330
|
-
return concat$
|
|
45341
|
+
return concat$c([" ", clause]);
|
|
45331
45342
|
}
|
|
45332
45343
|
|
|
45333
|
-
return indent$8(concat$
|
|
45344
|
+
return indent$8(concat$c([line$8, clause]));
|
|
45334
45345
|
}
|
|
45335
45346
|
|
|
45336
45347
|
function nodeStr(node, options, isFlowOrTypeScriptDirectiveLiteral) {
|
|
@@ -45406,7 +45417,7 @@ function printArrayItems(path, options, printPath, print) {
|
|
|
45406
45417
|
const printedElements = [];
|
|
45407
45418
|
let separatorParts = [];
|
|
45408
45419
|
path.each(childPath => {
|
|
45409
|
-
printedElements.push(concat$
|
|
45420
|
+
printedElements.push(concat$c(separatorParts));
|
|
45410
45421
|
printedElements.push(group$7(print(childPath)));
|
|
45411
45422
|
separatorParts = [",", line$8];
|
|
45412
45423
|
|
|
@@ -45414,7 +45425,7 @@ function printArrayItems(path, options, printPath, print) {
|
|
|
45414
45425
|
separatorParts.push(softline$6);
|
|
45415
45426
|
}
|
|
45416
45427
|
}, printPath);
|
|
45417
|
-
return concat$
|
|
45428
|
+
return concat$c(printedElements);
|
|
45418
45429
|
}
|
|
45419
45430
|
|
|
45420
45431
|
function printReturnAndThrowArgument(path, options, print) {
|
|
@@ -45424,9 +45435,9 @@ function printReturnAndThrowArgument(path, options, print) {
|
|
|
45424
45435
|
|
|
45425
45436
|
if (node.argument) {
|
|
45426
45437
|
if (returnArgumentHasLeadingComment$1(options, node.argument)) {
|
|
45427
|
-
parts.push(concat$
|
|
45438
|
+
parts.push(concat$c([" (", indent$8(concat$c([hardline$6, path.call(print, "argument")])), hardline$6, ")"]));
|
|
45428
45439
|
} else if (isBinaryish$1(node.argument) || node.argument.type === "SequenceExpression") {
|
|
45429
|
-
parts.push(group$7(concat$
|
|
45440
|
+
parts.push(group$7(concat$c([ifBreak$4(" (", " "), indent$8(concat$c([softline$6, path.call(print, "argument")])), softline$6, ifBreak$4(")")])));
|
|
45430
45441
|
} else {
|
|
45431
45442
|
parts.push(" ", path.call(print, "argument"));
|
|
45432
45443
|
}
|
|
@@ -45449,7 +45460,7 @@ function printReturnAndThrowArgument(path, options, print) {
|
|
|
45449
45460
|
parts.push(semi);
|
|
45450
45461
|
}
|
|
45451
45462
|
|
|
45452
|
-
return concat$
|
|
45463
|
+
return concat$c(parts);
|
|
45453
45464
|
}
|
|
45454
45465
|
|
|
45455
45466
|
function willPrintOwnComments(path
|
|
@@ -45479,7 +45490,7 @@ function printComment$1(commentPath, options) {
|
|
|
45479
45490
|
if (comment.trailing && !hasNewline$5(options.originalText, options.locStart(comment), {
|
|
45480
45491
|
backwards: true
|
|
45481
45492
|
})) {
|
|
45482
|
-
return concat$
|
|
45493
|
+
return concat$c([hardline$6, printed]);
|
|
45483
45494
|
}
|
|
45484
45495
|
|
|
45485
45496
|
return printed;
|
|
@@ -45512,7 +45523,7 @@ function isIndentableBlockComment(comment) {
|
|
|
45512
45523
|
|
|
45513
45524
|
function printIndentableBlockComment(comment) {
|
|
45514
45525
|
const lines = comment.value.split("\n");
|
|
45515
|
-
return concat$
|
|
45526
|
+
return concat$c(["/*", join$6(hardline$6, lines.map((line, index) => index === 0 ? line.trimEnd() : " " + (index < lines.length - 1 ? line.trim() : line.trimStart()))), "*/"]);
|
|
45516
45527
|
}
|
|
45517
45528
|
|
|
45518
45529
|
var printerEstree = {
|
|
@@ -45536,7 +45547,7 @@ var printerEstree = {
|
|
|
45536
45547
|
};
|
|
45537
45548
|
|
|
45538
45549
|
const {
|
|
45539
|
-
concat: concat$
|
|
45550
|
+
concat: concat$d,
|
|
45540
45551
|
hardline: hardline$7,
|
|
45541
45552
|
indent: indent$9,
|
|
45542
45553
|
join: join$7
|
|
@@ -45547,19 +45558,19 @@ function genericPrint$1(path, options, print) {
|
|
|
45547
45558
|
|
|
45548
45559
|
switch (node.type) {
|
|
45549
45560
|
case "JsonRoot":
|
|
45550
|
-
return concat$
|
|
45561
|
+
return concat$d([path.call(print, "node"), hardline$7]);
|
|
45551
45562
|
|
|
45552
45563
|
case "ArrayExpression":
|
|
45553
|
-
return node.elements.length === 0 ? "[]" : concat$
|
|
45564
|
+
return node.elements.length === 0 ? "[]" : concat$d(["[", indent$9(concat$d([hardline$7, join$7(concat$d([",", hardline$7]), path.map(print, "elements"))])), hardline$7, "]"]);
|
|
45554
45565
|
|
|
45555
45566
|
case "ObjectExpression":
|
|
45556
|
-
return node.properties.length === 0 ? "{}" : concat$
|
|
45567
|
+
return node.properties.length === 0 ? "{}" : concat$d(["{", indent$9(concat$d([hardline$7, join$7(concat$d([",", hardline$7]), path.map(print, "properties"))])), hardline$7, "}"]);
|
|
45557
45568
|
|
|
45558
45569
|
case "ObjectProperty":
|
|
45559
|
-
return concat$
|
|
45570
|
+
return concat$d([path.call(print, "key"), ": ", path.call(print, "value")]);
|
|
45560
45571
|
|
|
45561
45572
|
case "UnaryExpression":
|
|
45562
|
-
return concat$
|
|
45573
|
+
return concat$d([node.operator === "+" ? "" : node.operator, path.call(print, "argument")]);
|
|
45563
45574
|
|
|
45564
45575
|
case "NullLiteral":
|
|
45565
45576
|
return "null";
|
|
@@ -46386,7 +46397,7 @@ var clean_1$1 = clean$2;
|
|
|
46386
46397
|
const {
|
|
46387
46398
|
builders: {
|
|
46388
46399
|
hardline: hardline$8,
|
|
46389
|
-
concat: concat$
|
|
46400
|
+
concat: concat$e,
|
|
46390
46401
|
markAsRoot: markAsRoot$1
|
|
46391
46402
|
}
|
|
46392
46403
|
} = document;
|
|
@@ -46433,7 +46444,7 @@ function print$1(node, textToDoc) {
|
|
|
46433
46444
|
}, {
|
|
46434
46445
|
stripTrailingHardline: true
|
|
46435
46446
|
}) : "";
|
|
46436
|
-
return markAsRoot$1(concat$
|
|
46447
|
+
return markAsRoot$1(concat$e(["---", hardline$8, doc, doc ? hardline$8 : "", "---"]));
|
|
46437
46448
|
}
|
|
46438
46449
|
}
|
|
46439
46450
|
|
|
@@ -46445,7 +46456,7 @@ var frontMatter = {
|
|
|
46445
46456
|
const {
|
|
46446
46457
|
builders: {
|
|
46447
46458
|
hardline: hardline$9,
|
|
46448
|
-
concat: concat$
|
|
46459
|
+
concat: concat$f
|
|
46449
46460
|
}
|
|
46450
46461
|
} = document;
|
|
46451
46462
|
const {
|
|
@@ -46459,7 +46470,7 @@ function embed$1(path, print, textToDoc
|
|
|
46459
46470
|
|
|
46460
46471
|
if (node.type === "front-matter") {
|
|
46461
46472
|
const doc = printFrontMatter(node, textToDoc);
|
|
46462
|
-
return doc ? concat$
|
|
46473
|
+
return doc ? concat$f([doc, hardline$9]) : "";
|
|
46463
46474
|
}
|
|
46464
46475
|
}
|
|
46465
46476
|
|
|
@@ -46867,7 +46878,7 @@ const {
|
|
|
46867
46878
|
} = util;
|
|
46868
46879
|
const {
|
|
46869
46880
|
builders: {
|
|
46870
|
-
concat: concat$
|
|
46881
|
+
concat: concat$g,
|
|
46871
46882
|
join: join$8,
|
|
46872
46883
|
line: line$9,
|
|
46873
46884
|
hardline: hardline$a,
|
|
@@ -46950,13 +46961,13 @@ function genericPrint$2(path, options, print) {
|
|
|
46950
46961
|
|
|
46951
46962
|
switch (node.type) {
|
|
46952
46963
|
case "front-matter":
|
|
46953
|
-
return concat$
|
|
46964
|
+
return concat$g([node.raw, hardline$a]);
|
|
46954
46965
|
|
|
46955
46966
|
case "css-root":
|
|
46956
46967
|
{
|
|
46957
46968
|
const nodes = printNodeSequence(path, options, print);
|
|
46958
46969
|
const after = node.raws.after.trim();
|
|
46959
|
-
return concat$
|
|
46970
|
+
return concat$g([nodes, after ? ` ${after}` : "", nodes.parts.length && !options.__isHTMLStyleAttribute ? hardline$a : ""]);
|
|
46960
46971
|
}
|
|
46961
46972
|
|
|
46962
46973
|
case "css-comment":
|
|
@@ -46968,7 +46979,7 @@ function genericPrint$2(path, options, print) {
|
|
|
46968
46979
|
|
|
46969
46980
|
case "css-rule":
|
|
46970
46981
|
{
|
|
46971
|
-
return concat$
|
|
46982
|
+
return concat$g([path.call(print, "selector"), node.important ? " !important" : "", node.nodes ? concat$g([node.selector && node.selector.type === "selector-unknown" && lastLineHasInlineComment$1(node.selector.value) ? line$9 : " ", "{", node.nodes.length > 0 ? indent$a(concat$g([hardline$a, printNodeSequence(path, options, print)])) : "", hardline$a, "}", isDetachedRulesetDeclarationNode$1(node) ? ";" : ""]) : ";"]);
|
|
46972
46983
|
}
|
|
46973
46984
|
|
|
46974
46985
|
case "css-decl":
|
|
@@ -46982,10 +46993,10 @@ function genericPrint$2(path, options, print) {
|
|
|
46982
46993
|
let value = hasComposesNode$1(node) ? removeLines$2(path.call(print, "value")) : path.call(print, "value");
|
|
46983
46994
|
|
|
46984
46995
|
if (!isColon && lastLineHasInlineComment$1(trimmedBetween)) {
|
|
46985
|
-
value = indent$a(concat$
|
|
46996
|
+
value = indent$a(concat$g([hardline$a, dedent$2(value)]));
|
|
46986
46997
|
}
|
|
46987
46998
|
|
|
46988
|
-
return concat$
|
|
46999
|
+
return concat$g([node.raws.before.replace(/[\s;]/g, ""), insideICSSRuleNode$1(path) ? node.prop : maybeToLowerCase$1(node.prop), trimmedBetween.startsWith("//") ? " " : "", trimmedBetween, node.extend ? "" : " ", isLessParser$1(options) && node.extend && node.selector ? concat$g(["extend(", path.call(print, "selector"), ")"]) : "", value, node.raws.important ? node.raws.important.replace(/\s*!\s*important/i, " !important") : node.important ? " !important" : "", node.raws.scssDefault ? node.raws.scssDefault.replace(/\s*!default/i, " !default") : node.scssDefault ? " !default" : "", node.raws.scssGlobal ? node.raws.scssGlobal.replace(/\s*!global/i, " !global") : node.scssGlobal ? " !global" : "", node.nodes ? concat$g([" {", indent$a(concat$g([softline$7, printNodeSequence(path, options, print)])), softline$7, "}"]) : isTemplatePropNode$1(node) && !parentNode.raws.semicolon && options.originalText[options.locEnd(node) - 1] !== ";" ? "" : options.__isHTMLStyleAttribute && isLastNode$1(path, node) ? ifBreak$5(";", "") : ";"]);
|
|
46989
47000
|
}
|
|
46990
47001
|
|
|
46991
47002
|
case "css-atrule":
|
|
@@ -46995,22 +47006,22 @@ function genericPrint$2(path, options, print) {
|
|
|
46995
47006
|
|
|
46996
47007
|
if (isLessParser$1(options)) {
|
|
46997
47008
|
if (node.mixin) {
|
|
46998
|
-
return concat$
|
|
47009
|
+
return concat$g([path.call(print, "selector"), node.important ? " !important" : "", isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"]);
|
|
46999
47010
|
}
|
|
47000
47011
|
|
|
47001
47012
|
if (node.function) {
|
|
47002
|
-
return concat$
|
|
47013
|
+
return concat$g([node.name, concat$g([path.call(print, "params")]), isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"]);
|
|
47003
47014
|
}
|
|
47004
47015
|
|
|
47005
47016
|
if (node.variable) {
|
|
47006
|
-
return concat$
|
|
47017
|
+
return concat$g(["@", node.name, ": ", node.value ? concat$g([path.call(print, "value")]) : "", node.raws.between.trim() ? node.raws.between.trim() + " " : "", node.nodes ? concat$g(["{", indent$a(concat$g([node.nodes.length > 0 ? softline$7 : "", printNodeSequence(path, options, print)])), softline$7, "}"]) : "", isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"]);
|
|
47007
47018
|
}
|
|
47008
47019
|
}
|
|
47009
47020
|
|
|
47010
|
-
return concat$
|
|
47021
|
+
return concat$g(["@", // If a Less file ends up being parsed with the SCSS parser, Less
|
|
47011
47022
|
// variable declarations will be parsed as at-rules with names ending
|
|
47012
47023
|
// with a colon, so keep the original case then.
|
|
47013
|
-
isDetachedRulesetCallNode$1(node) || node.name.endsWith(":") ? node.name : maybeToLowerCase$1(node.name), node.params ? concat$
|
|
47024
|
+
isDetachedRulesetCallNode$1(node) || node.name.endsWith(":") ? node.name : maybeToLowerCase$1(node.name), node.params ? concat$g([isDetachedRulesetCallNode$1(node) ? "" : isTemplatePlaceholderNode$1(node) ? node.raws.afterName === "" ? "" : node.name.endsWith(":") ? " " : /^\s*\n\s*\n/.test(node.raws.afterName) ? concat$g([hardline$a, hardline$a]) : /^\s*\n/.test(node.raws.afterName) ? hardline$a : " " : " ", path.call(print, "params")]) : "", node.selector ? indent$a(concat$g([" ", path.call(print, "selector")])) : "", node.value ? group$b(concat$g([" ", path.call(print, "value"), isSCSSControlDirectiveNode$1(node) ? hasParensAroundNode$1(node) ? " " : line$9 : ""])) : node.name === "else" ? " " : "", node.nodes ? concat$g([isSCSSControlDirectiveNode$1(node) ? "" : node.selector && !node.selector.nodes && typeof node.selector.value === "string" && lastLineHasInlineComment$1(node.selector.value) || !node.selector && typeof node.params === "string" && lastLineHasInlineComment$1(node.params) ? line$9 : " ", "{", indent$a(concat$g([node.nodes.length > 0 ? softline$7 : "", printNodeSequence(path, options, print)])), softline$7, "}"]) : isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"]);
|
|
47014
47025
|
}
|
|
47015
47026
|
// postcss-media-query-parser
|
|
47016
47027
|
|
|
@@ -47031,7 +47042,7 @@ function genericPrint$2(path, options, print) {
|
|
|
47031
47042
|
|
|
47032
47043
|
case "media-query":
|
|
47033
47044
|
{
|
|
47034
|
-
return concat$
|
|
47045
|
+
return concat$g([join$8(" ", path.map(print, "nodes")), isLastNode$1(path, node) ? "" : ","]);
|
|
47035
47046
|
}
|
|
47036
47047
|
|
|
47037
47048
|
case "media-type":
|
|
@@ -47045,7 +47056,7 @@ function genericPrint$2(path, options, print) {
|
|
|
47045
47056
|
return node.value;
|
|
47046
47057
|
}
|
|
47047
47058
|
|
|
47048
|
-
return concat$
|
|
47059
|
+
return concat$g(["(", concat$g(path.map(print, "nodes")), ")"]);
|
|
47049
47060
|
}
|
|
47050
47061
|
|
|
47051
47062
|
case "media-feature":
|
|
@@ -47055,7 +47066,7 @@ function genericPrint$2(path, options, print) {
|
|
|
47055
47066
|
|
|
47056
47067
|
case "media-colon":
|
|
47057
47068
|
{
|
|
47058
|
-
return concat$
|
|
47069
|
+
return concat$g([node.value, " "]);
|
|
47059
47070
|
}
|
|
47060
47071
|
|
|
47061
47072
|
case "media-value":
|
|
@@ -47081,12 +47092,12 @@ function genericPrint$2(path, options, print) {
|
|
|
47081
47092
|
|
|
47082
47093
|
case "selector-root":
|
|
47083
47094
|
{
|
|
47084
|
-
return group$b(concat$
|
|
47095
|
+
return group$b(concat$g([insideAtRuleNode$1(path, "custom-selector") ? concat$g([getAncestorNode$1(path, "css-atrule").customSelector, line$9]) : "", join$8(concat$g([",", insideAtRuleNode$1(path, ["extend", "custom-selector", "nest"]) ? line$9 : hardline$a]), path.map(print, "nodes"))]));
|
|
47085
47096
|
}
|
|
47086
47097
|
|
|
47087
47098
|
case "selector-selector":
|
|
47088
47099
|
{
|
|
47089
|
-
return group$b(indent$a(concat$
|
|
47100
|
+
return group$b(indent$a(concat$g(path.map(print, "nodes"))));
|
|
47090
47101
|
}
|
|
47091
47102
|
|
|
47092
47103
|
case "selector-comment":
|
|
@@ -47104,22 +47115,22 @@ function genericPrint$2(path, options, print) {
|
|
|
47104
47115
|
const parentNode = path.getParentNode();
|
|
47105
47116
|
const index = parentNode && parentNode.nodes.indexOf(node);
|
|
47106
47117
|
const prevNode = index && parentNode.nodes[index - 1];
|
|
47107
|
-
return concat$
|
|
47118
|
+
return concat$g([node.namespace ? concat$g([node.namespace === true ? "" : node.namespace.trim(), "|"]) : "", prevNode.type === "selector-nesting" ? node.value : adjustNumbers(isKeyframeAtRuleKeywords$1(path, node.value) ? node.value.toLowerCase() : node.value)]);
|
|
47108
47119
|
}
|
|
47109
47120
|
|
|
47110
47121
|
case "selector-id":
|
|
47111
47122
|
{
|
|
47112
|
-
return concat$
|
|
47123
|
+
return concat$g(["#", node.value]);
|
|
47113
47124
|
}
|
|
47114
47125
|
|
|
47115
47126
|
case "selector-class":
|
|
47116
47127
|
{
|
|
47117
|
-
return concat$
|
|
47128
|
+
return concat$g([".", adjustNumbers(adjustStrings(node.value, options))]);
|
|
47118
47129
|
}
|
|
47119
47130
|
|
|
47120
47131
|
case "selector-attribute":
|
|
47121
47132
|
{
|
|
47122
|
-
return concat$
|
|
47133
|
+
return concat$g(["[", node.namespace ? concat$g([node.namespace === true ? "" : node.namespace.trim(), "|"]) : "", node.attribute.trim(), node.operator ? node.operator : "", node.value ? quoteAttributeValue(adjustStrings(node.value.trim(), options), options) : "", node.insensitive ? " i" : "", "]"]);
|
|
47123
47134
|
}
|
|
47124
47135
|
|
|
47125
47136
|
case "selector-combinator":
|
|
@@ -47127,22 +47138,22 @@ function genericPrint$2(path, options, print) {
|
|
|
47127
47138
|
if (node.value === "+" || node.value === ">" || node.value === "~" || node.value === ">>>") {
|
|
47128
47139
|
const parentNode = path.getParentNode();
|
|
47129
47140
|
const leading = parentNode.type === "selector-selector" && parentNode.nodes[0] === node ? "" : line$9;
|
|
47130
|
-
return concat$
|
|
47141
|
+
return concat$g([leading, node.value, isLastNode$1(path, node) ? "" : " "]);
|
|
47131
47142
|
}
|
|
47132
47143
|
|
|
47133
47144
|
const leading = node.value.trim().startsWith("(") ? line$9 : "";
|
|
47134
47145
|
const value = adjustNumbers(adjustStrings(node.value.trim(), options)) || line$9;
|
|
47135
|
-
return concat$
|
|
47146
|
+
return concat$g([leading, value]);
|
|
47136
47147
|
}
|
|
47137
47148
|
|
|
47138
47149
|
case "selector-universal":
|
|
47139
47150
|
{
|
|
47140
|
-
return concat$
|
|
47151
|
+
return concat$g([node.namespace ? concat$g([node.namespace === true ? "" : node.namespace.trim(), "|"]) : "", node.value]);
|
|
47141
47152
|
}
|
|
47142
47153
|
|
|
47143
47154
|
case "selector-pseudo":
|
|
47144
47155
|
{
|
|
47145
|
-
return concat$
|
|
47156
|
+
return concat$g([maybeToLowerCase$1(node.value), node.nodes && node.nodes.length > 0 ? concat$g(["(", join$8(", ", path.map(print, "nodes")), ")"]) : ""]);
|
|
47146
47157
|
}
|
|
47147
47158
|
|
|
47148
47159
|
case "selector-nesting":
|
|
@@ -47174,7 +47185,7 @@ function genericPrint$2(path, options, print) {
|
|
|
47174
47185
|
const start = options.locStart(parentNode.open) + 1;
|
|
47175
47186
|
const end = options.locEnd(parentNode.close) - 1;
|
|
47176
47187
|
const selector = options.originalText.slice(start, end).trim();
|
|
47177
|
-
return lastLineHasInlineComment$1(selector) ? concat$
|
|
47188
|
+
return lastLineHasInlineComment$1(selector) ? concat$g([breakParent$5, selector]) : selector;
|
|
47178
47189
|
}
|
|
47179
47190
|
|
|
47180
47191
|
return node.value;
|
|
@@ -47373,7 +47384,7 @@ function genericPrint$2(path, options, print) {
|
|
|
47373
47384
|
}
|
|
47374
47385
|
|
|
47375
47386
|
if (isControlDirective) {
|
|
47376
|
-
return group$b(indent$a(concat$
|
|
47387
|
+
return group$b(indent$a(concat$g(parts)));
|
|
47377
47388
|
} // Indent is not needed for import url when url is very long
|
|
47378
47389
|
// and node has two groups
|
|
47379
47390
|
// when type is value-comma_group
|
|
@@ -47392,7 +47403,7 @@ function genericPrint$2(path, options, print) {
|
|
|
47392
47403
|
const parentNode = path.getParentNode();
|
|
47393
47404
|
|
|
47394
47405
|
if (parentNode && isURLFunctionNode$1(parentNode) && (node.groups.length === 1 || node.groups.length > 0 && node.groups[0].type === "value-comma_group" && node.groups[0].groups.length > 0 && node.groups[0].groups[0].type === "value-word" && node.groups[0].groups[0].value.startsWith("data:"))) {
|
|
47395
|
-
return concat$
|
|
47406
|
+
return concat$g([node.open ? path.call(print, "open") : "", join$8(",", path.map(print, "groups")), node.close ? path.call(print, "close") : ""]);
|
|
47396
47407
|
}
|
|
47397
47408
|
|
|
47398
47409
|
if (!node.open) {
|
|
@@ -47401,7 +47412,7 @@ function genericPrint$2(path, options, print) {
|
|
|
47401
47412
|
|
|
47402
47413
|
for (let i = 0; i < printed.length; i++) {
|
|
47403
47414
|
if (i !== 0) {
|
|
47404
|
-
res.push(concat$
|
|
47415
|
+
res.push(concat$g([",", line$9]));
|
|
47405
47416
|
}
|
|
47406
47417
|
|
|
47407
47418
|
res.push(printed[i]);
|
|
@@ -47413,7 +47424,7 @@ function genericPrint$2(path, options, print) {
|
|
|
47413
47424
|
const isSCSSMapItem = isSCSSMapItemNode$1(path);
|
|
47414
47425
|
const lastItem = node.groups[node.groups.length - 1];
|
|
47415
47426
|
const isLastItemComment = lastItem && lastItem.type === "value-comment";
|
|
47416
|
-
return group$b(concat$
|
|
47427
|
+
return group$b(concat$g([node.open ? path.call(print, "open") : "", indent$a(concat$g([softline$7, join$8(concat$g([",", line$9]), path.map(childPath => {
|
|
47417
47428
|
const node = childPath.getValue();
|
|
47418
47429
|
const printed = print(childPath); // Key/Value pair in open paren already indented
|
|
47419
47430
|
|
|
@@ -47430,7 +47441,7 @@ function genericPrint$2(path, options, print) {
|
|
|
47430
47441
|
|
|
47431
47442
|
case "value-func":
|
|
47432
47443
|
{
|
|
47433
|
-
return concat$
|
|
47444
|
+
return concat$g([node.value, insideAtRuleNode$1(path, "supports") && isMediaAndSupportsKeywords$1(node) ? " " : "", path.call(print, "group")]);
|
|
47434
47445
|
}
|
|
47435
47446
|
|
|
47436
47447
|
case "value-paren":
|
|
@@ -47440,7 +47451,7 @@ function genericPrint$2(path, options, print) {
|
|
|
47440
47451
|
|
|
47441
47452
|
case "value-number":
|
|
47442
47453
|
{
|
|
47443
|
-
return concat$
|
|
47454
|
+
return concat$g([printCssNumber(node.value), maybeToLowerCase$1(node.unit)]);
|
|
47444
47455
|
}
|
|
47445
47456
|
|
|
47446
47457
|
case "value-operator":
|
|
@@ -47462,7 +47473,7 @@ function genericPrint$2(path, options, print) {
|
|
|
47462
47473
|
const parentNode = path.getParentNode();
|
|
47463
47474
|
const index = parentNode && parentNode.groups.indexOf(node);
|
|
47464
47475
|
const prevNode = index && parentNode.groups[index - 1];
|
|
47465
|
-
return concat$
|
|
47476
|
+
return concat$g([node.value, // Don't add spaces on escaped colon `:`, e.g: grid-template-rows: [row-1-00\:00] auto;
|
|
47466
47477
|
prevNode && prevNode.value[prevNode.value.length - 1] === "\\" || // Don't add spaces on `:` in `url` function (i.e. `url(fbglyph: cross-outline, fig-white)`)
|
|
47467
47478
|
insideValueFunctionNode$1(path, "url") ? "" : line$9]);
|
|
47468
47479
|
}
|
|
@@ -47472,7 +47483,7 @@ function genericPrint$2(path, options, print) {
|
|
|
47472
47483
|
|
|
47473
47484
|
case "value-comma":
|
|
47474
47485
|
{
|
|
47475
|
-
return concat$
|
|
47486
|
+
return concat$g([node.value, " "]);
|
|
47476
47487
|
}
|
|
47477
47488
|
|
|
47478
47489
|
case "value-string":
|
|
@@ -47482,7 +47493,7 @@ function genericPrint$2(path, options, print) {
|
|
|
47482
47493
|
|
|
47483
47494
|
case "value-atword":
|
|
47484
47495
|
{
|
|
47485
|
-
return concat$
|
|
47496
|
+
return concat$g(["@", node.value]);
|
|
47486
47497
|
}
|
|
47487
47498
|
|
|
47488
47499
|
case "value-unicode-range":
|
|
@@ -47531,7 +47542,7 @@ function printNodeSequence(path, options, print) {
|
|
|
47531
47542
|
|
|
47532
47543
|
i++;
|
|
47533
47544
|
}, "nodes");
|
|
47534
|
-
return concat$
|
|
47545
|
+
return concat$g(parts);
|
|
47535
47546
|
}
|
|
47536
47547
|
|
|
47537
47548
|
const STRING_REGEX$3 = /(["'])(?:(?!\1)[^\\]|\\[\S\s])*\1/g;
|
|
@@ -47887,7 +47898,7 @@ var utils$8 = {
|
|
|
47887
47898
|
};
|
|
47888
47899
|
|
|
47889
47900
|
const {
|
|
47890
|
-
concat: concat$
|
|
47901
|
+
concat: concat$h,
|
|
47891
47902
|
group: group$f,
|
|
47892
47903
|
hardline: hardline$b,
|
|
47893
47904
|
ifBreak: ifBreak$6,
|
|
@@ -47929,7 +47940,7 @@ function print$2(path, options, print) {
|
|
|
47929
47940
|
case "Program":
|
|
47930
47941
|
case "Template":
|
|
47931
47942
|
{
|
|
47932
|
-
return group$f(concat$
|
|
47943
|
+
return group$f(concat$h(path.map(print, "body")));
|
|
47933
47944
|
}
|
|
47934
47945
|
|
|
47935
47946
|
case "ElementNode":
|
|
@@ -47938,11 +47949,11 @@ function print$2(path, options, print) {
|
|
|
47938
47949
|
const bim = isNextNodeOfSomeType$1(path, ["ElementNode"]) ? hardline$b : "";
|
|
47939
47950
|
|
|
47940
47951
|
if (isVoid$1(n)) {
|
|
47941
|
-
return concat$
|
|
47952
|
+
return concat$h([group$f(printStartingTag(path, print)), bim]);
|
|
47942
47953
|
}
|
|
47943
47954
|
|
|
47944
47955
|
const isWhitespaceOnly = n.children.every(n => isWhitespaceNode$1(n));
|
|
47945
|
-
return concat$
|
|
47956
|
+
return concat$h([group$f(printStartingTag(path, print)), group$f(concat$h([isWhitespaceOnly ? "" : indent$b(printChildren(path, options, print)), n.children.length ? hardline$b : "", concat$h(["</", n.tag, ">"])])), bim]);
|
|
47946
47957
|
}
|
|
47947
47958
|
|
|
47948
47959
|
case "BlockStatement":
|
|
@@ -47951,15 +47962,15 @@ function print$2(path, options, print) {
|
|
|
47951
47962
|
const isElseIf = pp && pp.inverse && pp.inverse.body.length === 1 && pp.inverse.body[0] === n && pp.inverse.body[0].path.parts[0] === "if";
|
|
47952
47963
|
|
|
47953
47964
|
if (isElseIf) {
|
|
47954
|
-
return concat$
|
|
47965
|
+
return concat$h([printElseIfBlock(path, print), printProgram(path, print), printInverse(path, print)]);
|
|
47955
47966
|
}
|
|
47956
47967
|
|
|
47957
|
-
return concat$
|
|
47968
|
+
return concat$h([printOpenBlock(path, print), group$f(concat$h([printProgram(path, print), printInverse(path, print), printCloseBlock(path, print)]))]);
|
|
47958
47969
|
}
|
|
47959
47970
|
|
|
47960
47971
|
case "ElementModifierStatement":
|
|
47961
47972
|
{
|
|
47962
|
-
return group$f(concat$
|
|
47973
|
+
return group$f(concat$h(["{{", printPathAndParams(path, print), softline$8, "}}"]));
|
|
47963
47974
|
}
|
|
47964
47975
|
|
|
47965
47976
|
case "MustacheStatement":
|
|
@@ -47967,12 +47978,12 @@ function print$2(path, options, print) {
|
|
|
47967
47978
|
const isParentOfSpecifiedTypes = isParentOfSomeType$1(path, ["AttrNode", "ConcatStatement"]);
|
|
47968
47979
|
const isChildOfElementNodeAndDoesNotHaveParams = isParentOfSomeType$1(path, ["ElementNode"]) && doesNotHaveHashParams(n) && doesNotHavePositionalParams(n);
|
|
47969
47980
|
const shouldBreakOpeningMustache = isParentOfSpecifiedTypes || isChildOfElementNodeAndDoesNotHaveParams;
|
|
47970
|
-
return group$f(concat$
|
|
47981
|
+
return group$f(concat$h([printOpeningMustache(n), shouldBreakOpeningMustache ? indent$b(softline$8) : "", printPathAndParams(path, print), softline$8, printClosingMustache(n)]));
|
|
47971
47982
|
}
|
|
47972
47983
|
|
|
47973
47984
|
case "SubExpression":
|
|
47974
47985
|
{
|
|
47975
|
-
return group$f(concat$
|
|
47986
|
+
return group$f(concat$h(["(", printSubExpressionPathAndParams(path, print), softline$8, ")"]));
|
|
47976
47987
|
}
|
|
47977
47988
|
|
|
47978
47989
|
case "AttrNode":
|
|
@@ -47985,28 +47996,28 @@ function print$2(path, options, print) {
|
|
|
47985
47996
|
const isEmptyValue = isEmptyText && n.value.loc.start.column === n.value.loc.end.column;
|
|
47986
47997
|
|
|
47987
47998
|
if (isEmptyValue) {
|
|
47988
|
-
return concat$
|
|
47999
|
+
return concat$h([n.name]);
|
|
47989
48000
|
}
|
|
47990
48001
|
|
|
47991
48002
|
const value = path.call(print, "value");
|
|
47992
48003
|
const quotedValue = isText ? printStringLiteral(value.parts.join(), options) : value;
|
|
47993
|
-
return concat$
|
|
48004
|
+
return concat$h([n.name, "=", quotedValue]);
|
|
47994
48005
|
}
|
|
47995
48006
|
|
|
47996
48007
|
case "ConcatStatement":
|
|
47997
48008
|
{
|
|
47998
48009
|
const quote = options.singleQuote ? "'" : '"';
|
|
47999
|
-
return concat$
|
|
48010
|
+
return concat$h([quote, ...path.map(partPath => print(partPath), "parts"), quote]);
|
|
48000
48011
|
}
|
|
48001
48012
|
|
|
48002
48013
|
case "Hash":
|
|
48003
48014
|
{
|
|
48004
|
-
return concat$
|
|
48015
|
+
return concat$h([join$9(line$a, path.map(print, "pairs"))]);
|
|
48005
48016
|
}
|
|
48006
48017
|
|
|
48007
48018
|
case "HashPair":
|
|
48008
48019
|
{
|
|
48009
|
-
return concat$
|
|
48020
|
+
return concat$h([n.key, "=", path.call(print, "value")]);
|
|
48010
48021
|
}
|
|
48011
48022
|
|
|
48012
48023
|
case "TextNode":
|
|
@@ -48042,7 +48053,7 @@ function print$2(path, options, print) {
|
|
|
48042
48053
|
// TODO: format style and srcset attributes
|
|
48043
48054
|
// and cleanup concat that is not necessary
|
|
48044
48055
|
if (!isInAttributeOfName(path, "class")) {
|
|
48045
|
-
return concat$
|
|
48056
|
+
return concat$h([n.chars]);
|
|
48046
48057
|
}
|
|
48047
48058
|
|
|
48048
48059
|
let leadingSpace = "";
|
|
@@ -48058,7 +48069,7 @@ function print$2(path, options, print) {
|
|
|
48058
48069
|
}
|
|
48059
48070
|
}
|
|
48060
48071
|
|
|
48061
|
-
return concat$
|
|
48072
|
+
return concat$h([...generateHardlines(leadingLineBreaksCount, maxLineBreaksToPreserve), n.chars.replace(/^\s+/g, leadingSpace).replace(/\s+$/, trailingSpace), ...generateHardlines(trailingLineBreaksCount, maxLineBreaksToPreserve)]);
|
|
48062
48073
|
}
|
|
48063
48074
|
|
|
48064
48075
|
let leadingSpace = "";
|
|
@@ -48092,13 +48103,13 @@ function print$2(path, options, print) {
|
|
|
48092
48103
|
text = "\\" + text;
|
|
48093
48104
|
}
|
|
48094
48105
|
|
|
48095
|
-
return concat$
|
|
48106
|
+
return concat$h([...generateHardlines(leadingLineBreaksCount, maxLineBreaksToPreserve), text.replace(/^\s+/g, leadingSpace).replace(/\s+$/, trailingSpace), ...generateHardlines(trailingLineBreaksCount, maxLineBreaksToPreserve)]);
|
|
48096
48107
|
}
|
|
48097
48108
|
|
|
48098
48109
|
case "MustacheCommentStatement":
|
|
48099
48110
|
{
|
|
48100
48111
|
const dashes = n.value.includes("}}") ? "--" : "";
|
|
48101
|
-
return concat$
|
|
48112
|
+
return concat$h(["{{!", dashes, n.value, dashes, "}}"]);
|
|
48102
48113
|
}
|
|
48103
48114
|
|
|
48104
48115
|
case "PathExpression":
|
|
@@ -48113,7 +48124,7 @@ function print$2(path, options, print) {
|
|
|
48113
48124
|
|
|
48114
48125
|
case "CommentStatement":
|
|
48115
48126
|
{
|
|
48116
|
-
return concat$
|
|
48127
|
+
return concat$h(["<!--", n.value, "-->"]);
|
|
48117
48128
|
}
|
|
48118
48129
|
|
|
48119
48130
|
case "StringLiteral":
|
|
@@ -48147,18 +48158,18 @@ function print$2(path, options, print) {
|
|
|
48147
48158
|
|
|
48148
48159
|
function printStartingTag(path, print) {
|
|
48149
48160
|
const node = path.getValue();
|
|
48150
|
-
return concat$
|
|
48161
|
+
return concat$h(["<", node.tag, printAttributesLike(path, print), printBlockParams(node), printStartingTagEndMarker(node)]);
|
|
48151
48162
|
}
|
|
48152
48163
|
|
|
48153
48164
|
function printAttributesLike(path, print) {
|
|
48154
48165
|
const node = path.getValue();
|
|
48155
|
-
return indent$b(concat$
|
|
48166
|
+
return indent$b(concat$h([node.attributes.length ? line$a : "", join$9(line$a, path.map(print, "attributes")), node.modifiers.length ? line$a : "", join$9(line$a, path.map(print, "modifiers")), node.comments.length ? line$a : "", join$9(line$a, path.map(print, "comments"))]));
|
|
48156
48167
|
}
|
|
48157
48168
|
|
|
48158
48169
|
function printChildren(path, options, print) {
|
|
48159
|
-
return concat$
|
|
48170
|
+
return concat$h(path.map((childPath, childIndex) => {
|
|
48160
48171
|
if (childIndex === 0) {
|
|
48161
|
-
return concat$
|
|
48172
|
+
return concat$h([softline$8, print(childPath, options, print)]);
|
|
48162
48173
|
}
|
|
48163
48174
|
|
|
48164
48175
|
return print(childPath, options, print);
|
|
@@ -48167,10 +48178,10 @@ function printChildren(path, options, print) {
|
|
|
48167
48178
|
|
|
48168
48179
|
function printStartingTagEndMarker(node) {
|
|
48169
48180
|
if (isVoid$1(node)) {
|
|
48170
|
-
return ifBreak$6(concat$
|
|
48181
|
+
return ifBreak$6(concat$h([softline$8, "/>"]), concat$h([" />", softline$8]));
|
|
48171
48182
|
}
|
|
48172
48183
|
|
|
48173
|
-
return ifBreak$6(concat$
|
|
48184
|
+
return ifBreak$6(concat$h([softline$8, ">"]), ">");
|
|
48174
48185
|
}
|
|
48175
48186
|
/* MustacheStatement print helpers */
|
|
48176
48187
|
|
|
@@ -48178,13 +48189,13 @@ function printStartingTagEndMarker(node) {
|
|
|
48178
48189
|
function printOpeningMustache(node) {
|
|
48179
48190
|
const mustache = node.escaped === false ? "{{{" : "{{";
|
|
48180
48191
|
const strip = node.strip && node.strip.open ? "~" : "";
|
|
48181
|
-
return concat$
|
|
48192
|
+
return concat$h([mustache, strip]);
|
|
48182
48193
|
}
|
|
48183
48194
|
|
|
48184
48195
|
function printClosingMustache(node) {
|
|
48185
48196
|
const mustache = node.escaped === false ? "}}}" : "}}";
|
|
48186
48197
|
const strip = node.strip && node.strip.close ? "~" : "";
|
|
48187
|
-
return concat$
|
|
48198
|
+
return concat$h([strip, mustache]);
|
|
48188
48199
|
}
|
|
48189
48200
|
/* BlockStatement print helpers */
|
|
48190
48201
|
|
|
@@ -48192,56 +48203,56 @@ function printClosingMustache(node) {
|
|
|
48192
48203
|
function printOpeningBlockOpeningMustache(node) {
|
|
48193
48204
|
const opening = printOpeningMustache(node);
|
|
48194
48205
|
const strip = node.openStrip.open ? "~" : "";
|
|
48195
|
-
return concat$
|
|
48206
|
+
return concat$h([opening, strip, "#"]);
|
|
48196
48207
|
}
|
|
48197
48208
|
|
|
48198
48209
|
function printOpeningBlockClosingMustache(node) {
|
|
48199
48210
|
const closing = printClosingMustache(node);
|
|
48200
48211
|
const strip = node.openStrip.close ? "~" : "";
|
|
48201
|
-
return concat$
|
|
48212
|
+
return concat$h([strip, closing]);
|
|
48202
48213
|
}
|
|
48203
48214
|
|
|
48204
48215
|
function printClosingBlockOpeningMustache(node) {
|
|
48205
48216
|
const opening = printOpeningMustache(node);
|
|
48206
48217
|
const strip = node.closeStrip.open ? "~" : "";
|
|
48207
|
-
return concat$
|
|
48218
|
+
return concat$h([opening, strip, "/"]);
|
|
48208
48219
|
}
|
|
48209
48220
|
|
|
48210
48221
|
function printClosingBlockClosingMustache(node) {
|
|
48211
48222
|
const closing = printClosingMustache(node);
|
|
48212
48223
|
const strip = node.closeStrip.close ? "~" : "";
|
|
48213
|
-
return concat$
|
|
48224
|
+
return concat$h([strip, closing]);
|
|
48214
48225
|
}
|
|
48215
48226
|
|
|
48216
48227
|
function printInverseBlockOpeningMustache(node) {
|
|
48217
48228
|
const opening = printOpeningMustache(node);
|
|
48218
48229
|
const strip = node.inverseStrip.open ? "~" : "";
|
|
48219
|
-
return concat$
|
|
48230
|
+
return concat$h([opening, strip]);
|
|
48220
48231
|
}
|
|
48221
48232
|
|
|
48222
48233
|
function printInverseBlockClosingMustache(node) {
|
|
48223
48234
|
const closing = printClosingMustache(node);
|
|
48224
48235
|
const strip = node.inverseStrip.close ? "~" : "";
|
|
48225
|
-
return concat$
|
|
48236
|
+
return concat$h([strip, closing]);
|
|
48226
48237
|
}
|
|
48227
48238
|
|
|
48228
48239
|
function printOpenBlock(path, print) {
|
|
48229
48240
|
const node = path.getValue();
|
|
48230
|
-
return group$f(concat$
|
|
48241
|
+
return group$f(concat$h([printOpeningBlockOpeningMustache(node), printPathAndParams(path, print), printBlockParams(node.program), softline$8, printOpeningBlockClosingMustache(node)]));
|
|
48231
48242
|
}
|
|
48232
48243
|
|
|
48233
48244
|
function printElseBlock(node) {
|
|
48234
|
-
return concat$
|
|
48245
|
+
return concat$h([hardline$b, printInverseBlockOpeningMustache(node), "else", printInverseBlockClosingMustache(node)]);
|
|
48235
48246
|
}
|
|
48236
48247
|
|
|
48237
48248
|
function printElseIfBlock(path, print) {
|
|
48238
48249
|
const parentNode = path.getParentNode(1);
|
|
48239
|
-
return concat$
|
|
48250
|
+
return concat$h([printInverseBlockOpeningMustache(parentNode), "else ", printPathAndParams(path, print), printInverseBlockClosingMustache(parentNode)]);
|
|
48240
48251
|
}
|
|
48241
48252
|
|
|
48242
48253
|
function printCloseBlock(path, print) {
|
|
48243
48254
|
const node = path.getValue();
|
|
48244
|
-
return concat$
|
|
48255
|
+
return concat$h([blockStatementHasOnlyWhitespaceInProgram(node) ? softline$8 : hardline$b, printClosingBlockOpeningMustache(node), path.call(print, "path"), printClosingBlockClosingMustache(node)]);
|
|
48245
48256
|
}
|
|
48246
48257
|
|
|
48247
48258
|
function blockStatementHasOnlyWhitespaceInProgram(node) {
|
|
@@ -48264,20 +48275,20 @@ function printProgram(path, print) {
|
|
|
48264
48275
|
}
|
|
48265
48276
|
|
|
48266
48277
|
const program = path.call(print, "program");
|
|
48267
|
-
return indent$b(concat$
|
|
48278
|
+
return indent$b(concat$h([hardline$b, program]));
|
|
48268
48279
|
}
|
|
48269
48280
|
|
|
48270
48281
|
function printInverse(path, print) {
|
|
48271
48282
|
const node = path.getValue();
|
|
48272
48283
|
const inverse = path.call(print, "inverse");
|
|
48273
|
-
const parts = concat$
|
|
48284
|
+
const parts = concat$h([hardline$b, inverse]);
|
|
48274
48285
|
|
|
48275
48286
|
if (blockStatementHasElseIf(node)) {
|
|
48276
48287
|
return parts;
|
|
48277
48288
|
}
|
|
48278
48289
|
|
|
48279
48290
|
if (blockStatementHasElse(node)) {
|
|
48280
|
-
return concat$
|
|
48291
|
+
return concat$h([printElseBlock(node), indent$b(parts)]);
|
|
48281
48292
|
}
|
|
48282
48293
|
|
|
48283
48294
|
return "";
|
|
@@ -48348,7 +48359,7 @@ function printStringLiteral(stringLiteral, options) {
|
|
|
48348
48359
|
|
|
48349
48360
|
const enclosingQuote = shouldUseAlternateQuote ? alternate : preferred;
|
|
48350
48361
|
const escapedStringLiteral = stringLiteral.replace(enclosingQuote.regex, `\\${enclosingQuote.quote}`);
|
|
48351
|
-
return concat$
|
|
48362
|
+
return concat$h([enclosingQuote.quote, escapedStringLiteral, enclosingQuote.quote]);
|
|
48352
48363
|
}
|
|
48353
48364
|
/* SubExpression print helpers */
|
|
48354
48365
|
|
|
@@ -48361,7 +48372,7 @@ function printSubExpressionPathAndParams(path, print) {
|
|
|
48361
48372
|
return p;
|
|
48362
48373
|
}
|
|
48363
48374
|
|
|
48364
|
-
return indent$b(concat$
|
|
48375
|
+
return indent$b(concat$h([p, line$a, group$f(params)]));
|
|
48365
48376
|
}
|
|
48366
48377
|
/* misc. print helpers */
|
|
48367
48378
|
|
|
@@ -48374,7 +48385,7 @@ function printPathAndParams(path, print) {
|
|
|
48374
48385
|
return p;
|
|
48375
48386
|
}
|
|
48376
48387
|
|
|
48377
|
-
return indent$b(group$f(concat$
|
|
48388
|
+
return indent$b(group$f(concat$h([p, line$a, params])));
|
|
48378
48389
|
}
|
|
48379
48390
|
|
|
48380
48391
|
function printPath(path, print) {
|
|
@@ -48407,7 +48418,7 @@ function printBlockParams(node) {
|
|
|
48407
48418
|
return "";
|
|
48408
48419
|
}
|
|
48409
48420
|
|
|
48410
|
-
return concat$
|
|
48421
|
+
return concat$h([" as |", node.blockParams.join(" "), "|"]);
|
|
48411
48422
|
}
|
|
48412
48423
|
/* istanbul ignore next
|
|
48413
48424
|
https://github.com/glimmerjs/glimmer-vm/blob/master/packages/%40glimmer/compiler/lib/location.ts#L5-L29
|
|
@@ -48532,7 +48543,7 @@ var pragma$2 = {
|
|
|
48532
48543
|
};
|
|
48533
48544
|
|
|
48534
48545
|
const {
|
|
48535
|
-
concat: concat$
|
|
48546
|
+
concat: concat$i,
|
|
48536
48547
|
join: join$a,
|
|
48537
48548
|
hardline: hardline$c,
|
|
48538
48549
|
line: line$b,
|
|
@@ -48565,7 +48576,7 @@ function genericPrint$3(path, options, print) {
|
|
|
48565
48576
|
{
|
|
48566
48577
|
const parts = [];
|
|
48567
48578
|
path.map((pathChild, index) => {
|
|
48568
|
-
parts.push(concat$
|
|
48579
|
+
parts.push(concat$i([pathChild.call(print)]));
|
|
48569
48580
|
|
|
48570
48581
|
if (index !== n.definitions.length - 1) {
|
|
48571
48582
|
parts.push(hardline$c);
|
|
@@ -48575,29 +48586,29 @@ function genericPrint$3(path, options, print) {
|
|
|
48575
48586
|
}
|
|
48576
48587
|
}
|
|
48577
48588
|
}, "definitions");
|
|
48578
|
-
return concat$
|
|
48589
|
+
return concat$i([concat$i(parts), hardline$c]);
|
|
48579
48590
|
}
|
|
48580
48591
|
|
|
48581
48592
|
case "OperationDefinition":
|
|
48582
48593
|
{
|
|
48583
48594
|
const hasOperation = options.originalText[options.locStart(n)] !== "{";
|
|
48584
48595
|
const hasName = !!n.name;
|
|
48585
|
-
return concat$
|
|
48596
|
+
return concat$i([hasOperation ? n.operation : "", hasOperation && hasName ? concat$i([" ", path.call(print, "name")]) : "", n.variableDefinitions && n.variableDefinitions.length ? group$h(concat$i(["(", indent$c(concat$i([softline$9, join$a(concat$i([ifBreak$7("", ", "), softline$9]), path.map(print, "variableDefinitions"))])), softline$9, ")"])) : "", printDirectives(path, print, n), n.selectionSet ? !hasOperation && !hasName ? "" : " " : "", path.call(print, "selectionSet")]);
|
|
48586
48597
|
}
|
|
48587
48598
|
|
|
48588
48599
|
case "FragmentDefinition":
|
|
48589
48600
|
{
|
|
48590
|
-
return concat$
|
|
48601
|
+
return concat$i(["fragment ", path.call(print, "name"), n.variableDefinitions && n.variableDefinitions.length ? group$h(concat$i(["(", indent$c(concat$i([softline$9, join$a(concat$i([ifBreak$7("", ", "), softline$9]), path.map(print, "variableDefinitions"))])), softline$9, ")"])) : "", " on ", path.call(print, "typeCondition"), printDirectives(path, print, n), " ", path.call(print, "selectionSet")]);
|
|
48591
48602
|
}
|
|
48592
48603
|
|
|
48593
48604
|
case "SelectionSet":
|
|
48594
48605
|
{
|
|
48595
|
-
return concat$
|
|
48606
|
+
return concat$i(["{", indent$c(concat$i([hardline$c, join$a(hardline$c, path.call(selectionsPath => printSequence(selectionsPath, options, print), "selections"))])), hardline$c, "}"]);
|
|
48596
48607
|
}
|
|
48597
48608
|
|
|
48598
48609
|
case "Field":
|
|
48599
48610
|
{
|
|
48600
|
-
return group$h(concat$
|
|
48611
|
+
return group$h(concat$i([n.alias ? concat$i([path.call(print, "alias"), ": "]) : "", path.call(print, "name"), n.arguments.length > 0 ? group$h(concat$i(["(", indent$c(concat$i([softline$9, join$a(concat$i([ifBreak$7("", ", "), softline$9]), path.call(argsPath => printSequence(argsPath, options, print), "arguments"))])), softline$9, ")"])) : "", printDirectives(path, print, n), n.selectionSet ? " " : "", path.call(print, "selectionSet")]));
|
|
48601
48612
|
}
|
|
48602
48613
|
|
|
48603
48614
|
case "Name":
|
|
@@ -48608,10 +48619,10 @@ function genericPrint$3(path, options, print) {
|
|
|
48608
48619
|
case "StringValue":
|
|
48609
48620
|
{
|
|
48610
48621
|
if (n.block) {
|
|
48611
|
-
return concat$
|
|
48622
|
+
return concat$i(['"""', hardline$c, join$a(hardline$c, n.value.replace(/"""/g, "\\$&").split("\n")), hardline$c, '"""']);
|
|
48612
48623
|
}
|
|
48613
48624
|
|
|
48614
|
-
return concat$
|
|
48625
|
+
return concat$i(['"', n.value.replace(/["\\]/g, "\\$&").replace(/\n/g, "\\n"), '"']);
|
|
48615
48626
|
}
|
|
48616
48627
|
|
|
48617
48628
|
case "IntValue":
|
|
@@ -48633,28 +48644,28 @@ function genericPrint$3(path, options, print) {
|
|
|
48633
48644
|
|
|
48634
48645
|
case "Variable":
|
|
48635
48646
|
{
|
|
48636
|
-
return concat$
|
|
48647
|
+
return concat$i(["$", path.call(print, "name")]);
|
|
48637
48648
|
}
|
|
48638
48649
|
|
|
48639
48650
|
case "ListValue":
|
|
48640
48651
|
{
|
|
48641
|
-
return group$h(concat$
|
|
48652
|
+
return group$h(concat$i(["[", indent$c(concat$i([softline$9, join$a(concat$i([ifBreak$7("", ", "), softline$9]), path.map(print, "values"))])), softline$9, "]"]));
|
|
48642
48653
|
}
|
|
48643
48654
|
|
|
48644
48655
|
case "ObjectValue":
|
|
48645
48656
|
{
|
|
48646
|
-
return group$h(concat$
|
|
48657
|
+
return group$h(concat$i(["{", options.bracketSpacing && n.fields.length > 0 ? " " : "", indent$c(concat$i([softline$9, join$a(concat$i([ifBreak$7("", ", "), softline$9]), path.map(print, "fields"))])), softline$9, ifBreak$7("", options.bracketSpacing && n.fields.length > 0 ? " " : ""), "}"]));
|
|
48647
48658
|
}
|
|
48648
48659
|
|
|
48649
48660
|
case "ObjectField":
|
|
48650
48661
|
case "Argument":
|
|
48651
48662
|
{
|
|
48652
|
-
return concat$
|
|
48663
|
+
return concat$i([path.call(print, "name"), ": ", path.call(print, "value")]);
|
|
48653
48664
|
}
|
|
48654
48665
|
|
|
48655
48666
|
case "Directive":
|
|
48656
48667
|
{
|
|
48657
|
-
return concat$
|
|
48668
|
+
return concat$i(["@", path.call(print, "name"), n.arguments.length > 0 ? group$h(concat$i(["(", indent$c(concat$i([softline$9, join$a(concat$i([ifBreak$7("", ", "), softline$9]), path.call(argsPath => printSequence(argsPath, options, print), "arguments"))])), softline$9, ")"])) : ""]);
|
|
48658
48669
|
}
|
|
48659
48670
|
|
|
48660
48671
|
case "NamedType":
|
|
@@ -48664,93 +48675,93 @@ function genericPrint$3(path, options, print) {
|
|
|
48664
48675
|
|
|
48665
48676
|
case "VariableDefinition":
|
|
48666
48677
|
{
|
|
48667
|
-
return concat$
|
|
48678
|
+
return concat$i([path.call(print, "variable"), ": ", path.call(print, "type"), n.defaultValue ? concat$i([" = ", path.call(print, "defaultValue")]) : "", printDirectives(path, print, n)]);
|
|
48668
48679
|
}
|
|
48669
48680
|
|
|
48670
48681
|
case "ObjectTypeExtension":
|
|
48671
48682
|
case "ObjectTypeDefinition":
|
|
48672
48683
|
{
|
|
48673
|
-
return concat$
|
|
48684
|
+
return concat$i([path.call(print, "description"), n.description ? hardline$c : "", n.kind === "ObjectTypeExtension" ? "extend " : "", "type ", path.call(print, "name"), n.interfaces.length > 0 ? concat$i([" implements ", concat$i(printInterfaces(path, options, print))]) : "", printDirectives(path, print, n), n.fields.length > 0 ? concat$i([" {", indent$c(concat$i([hardline$c, join$a(hardline$c, path.call(fieldsPath => printSequence(fieldsPath, options, print), "fields"))])), hardline$c, "}"]) : ""]);
|
|
48674
48685
|
}
|
|
48675
48686
|
|
|
48676
48687
|
case "FieldDefinition":
|
|
48677
48688
|
{
|
|
48678
|
-
return concat$
|
|
48689
|
+
return concat$i([path.call(print, "description"), n.description ? hardline$c : "", path.call(print, "name"), n.arguments.length > 0 ? group$h(concat$i(["(", indent$c(concat$i([softline$9, join$a(concat$i([ifBreak$7("", ", "), softline$9]), path.call(argsPath => printSequence(argsPath, options, print), "arguments"))])), softline$9, ")"])) : "", ": ", path.call(print, "type"), printDirectives(path, print, n)]);
|
|
48679
48690
|
}
|
|
48680
48691
|
|
|
48681
48692
|
case "DirectiveDefinition":
|
|
48682
48693
|
{
|
|
48683
|
-
return concat$
|
|
48694
|
+
return concat$i([path.call(print, "description"), n.description ? hardline$c : "", "directive ", "@", path.call(print, "name"), n.arguments.length > 0 ? group$h(concat$i(["(", indent$c(concat$i([softline$9, join$a(concat$i([ifBreak$7("", ", "), softline$9]), path.call(argsPath => printSequence(argsPath, options, print), "arguments"))])), softline$9, ")"])) : "", n.repeatable ? " repeatable" : "", concat$i([" on ", join$a(" | ", path.map(print, "locations"))])]);
|
|
48684
48695
|
}
|
|
48685
48696
|
|
|
48686
48697
|
case "EnumTypeExtension":
|
|
48687
48698
|
case "EnumTypeDefinition":
|
|
48688
48699
|
{
|
|
48689
|
-
return concat$
|
|
48700
|
+
return concat$i([path.call(print, "description"), n.description ? hardline$c : "", n.kind === "EnumTypeExtension" ? "extend " : "", "enum ", path.call(print, "name"), printDirectives(path, print, n), n.values.length > 0 ? concat$i([" {", indent$c(concat$i([hardline$c, join$a(hardline$c, path.call(valuesPath => printSequence(valuesPath, options, print), "values"))])), hardline$c, "}"]) : ""]);
|
|
48690
48701
|
}
|
|
48691
48702
|
|
|
48692
48703
|
case "EnumValueDefinition":
|
|
48693
48704
|
{
|
|
48694
|
-
return concat$
|
|
48705
|
+
return concat$i([path.call(print, "description"), n.description ? hardline$c : "", path.call(print, "name"), printDirectives(path, print, n)]);
|
|
48695
48706
|
}
|
|
48696
48707
|
|
|
48697
48708
|
case "InputValueDefinition":
|
|
48698
48709
|
{
|
|
48699
|
-
return concat$
|
|
48710
|
+
return concat$i([path.call(print, "description"), n.description ? n.description.block ? hardline$c : line$b : "", path.call(print, "name"), ": ", path.call(print, "type"), n.defaultValue ? concat$i([" = ", path.call(print, "defaultValue")]) : "", printDirectives(path, print, n)]);
|
|
48700
48711
|
}
|
|
48701
48712
|
|
|
48702
48713
|
case "InputObjectTypeExtension":
|
|
48703
48714
|
case "InputObjectTypeDefinition":
|
|
48704
48715
|
{
|
|
48705
|
-
return concat$
|
|
48716
|
+
return concat$i([path.call(print, "description"), n.description ? hardline$c : "", n.kind === "InputObjectTypeExtension" ? "extend " : "", "input ", path.call(print, "name"), printDirectives(path, print, n), n.fields.length > 0 ? concat$i([" {", indent$c(concat$i([hardline$c, join$a(hardline$c, path.call(fieldsPath => printSequence(fieldsPath, options, print), "fields"))])), hardline$c, "}"]) : ""]);
|
|
48706
48717
|
}
|
|
48707
48718
|
|
|
48708
48719
|
case "SchemaDefinition":
|
|
48709
48720
|
{
|
|
48710
|
-
return concat$
|
|
48721
|
+
return concat$i(["schema", printDirectives(path, print, n), " {", n.operationTypes.length > 0 ? indent$c(concat$i([hardline$c, join$a(hardline$c, path.call(opsPath => printSequence(opsPath, options, print), "operationTypes"))])) : "", hardline$c, "}"]);
|
|
48711
48722
|
}
|
|
48712
48723
|
|
|
48713
48724
|
case "OperationTypeDefinition":
|
|
48714
48725
|
{
|
|
48715
|
-
return concat$
|
|
48726
|
+
return concat$i([path.call(print, "operation"), ": ", path.call(print, "type")]);
|
|
48716
48727
|
}
|
|
48717
48728
|
|
|
48718
48729
|
case "InterfaceTypeExtension":
|
|
48719
48730
|
case "InterfaceTypeDefinition":
|
|
48720
48731
|
{
|
|
48721
|
-
return concat$
|
|
48732
|
+
return concat$i([path.call(print, "description"), n.description ? hardline$c : "", n.kind === "InterfaceTypeExtension" ? "extend " : "", "interface ", path.call(print, "name"), n.interfaces.length > 0 ? concat$i([" implements ", concat$i(printInterfaces(path, options, print))]) : "", printDirectives(path, print, n), n.fields.length > 0 ? concat$i([" {", indent$c(concat$i([hardline$c, join$a(hardline$c, path.call(fieldsPath => printSequence(fieldsPath, options, print), "fields"))])), hardline$c, "}"]) : ""]);
|
|
48722
48733
|
}
|
|
48723
48734
|
|
|
48724
48735
|
case "FragmentSpread":
|
|
48725
48736
|
{
|
|
48726
|
-
return concat$
|
|
48737
|
+
return concat$i(["...", path.call(print, "name"), printDirectives(path, print, n)]);
|
|
48727
48738
|
}
|
|
48728
48739
|
|
|
48729
48740
|
case "InlineFragment":
|
|
48730
48741
|
{
|
|
48731
|
-
return concat$
|
|
48742
|
+
return concat$i(["...", n.typeCondition ? concat$i([" on ", path.call(print, "typeCondition")]) : "", printDirectives(path, print, n), " ", path.call(print, "selectionSet")]);
|
|
48732
48743
|
}
|
|
48733
48744
|
|
|
48734
48745
|
case "UnionTypeExtension":
|
|
48735
48746
|
case "UnionTypeDefinition":
|
|
48736
48747
|
{
|
|
48737
|
-
return group$h(concat$
|
|
48748
|
+
return group$h(concat$i([path.call(print, "description"), n.description ? hardline$c : "", group$h(concat$i([n.kind === "UnionTypeExtension" ? "extend " : "", "union ", path.call(print, "name"), printDirectives(path, print, n), n.types.length > 0 ? concat$i([" =", ifBreak$7("", " "), indent$c(concat$i([ifBreak$7(concat$i([line$b, " "])), join$a(concat$i([line$b, "| "]), path.map(print, "types"))]))]) : ""]))]));
|
|
48738
48749
|
}
|
|
48739
48750
|
|
|
48740
48751
|
case "ScalarTypeExtension":
|
|
48741
48752
|
case "ScalarTypeDefinition":
|
|
48742
48753
|
{
|
|
48743
|
-
return concat$
|
|
48754
|
+
return concat$i([path.call(print, "description"), n.description ? hardline$c : "", n.kind === "ScalarTypeExtension" ? "extend " : "", "scalar ", path.call(print, "name"), printDirectives(path, print, n)]);
|
|
48744
48755
|
}
|
|
48745
48756
|
|
|
48746
48757
|
case "NonNullType":
|
|
48747
48758
|
{
|
|
48748
|
-
return concat$
|
|
48759
|
+
return concat$i([path.call(print, "type"), "!"]);
|
|
48749
48760
|
}
|
|
48750
48761
|
|
|
48751
48762
|
case "ListType":
|
|
48752
48763
|
{
|
|
48753
|
-
return concat$
|
|
48764
|
+
return concat$i(["[", path.call(print, "type"), "]"]);
|
|
48754
48765
|
}
|
|
48755
48766
|
|
|
48756
48767
|
default:
|
|
@@ -48764,7 +48775,13 @@ function printDirectives(path, print, n) {
|
|
|
48764
48775
|
return "";
|
|
48765
48776
|
}
|
|
48766
48777
|
|
|
48767
|
-
|
|
48778
|
+
const printed = join$a(line$b, path.map(print, "directives"));
|
|
48779
|
+
|
|
48780
|
+
if (n.kind === "FragmentDefinition" || n.kind === "OperationDefinition") {
|
|
48781
|
+
return group$h(concat$i([line$b, printed]));
|
|
48782
|
+
}
|
|
48783
|
+
|
|
48784
|
+
return concat$i([" ", group$h(indent$c(concat$i([softline$9, printed])))]);
|
|
48768
48785
|
}
|
|
48769
48786
|
|
|
48770
48787
|
function printSequence(sequencePath, options, print) {
|
|
@@ -48773,7 +48790,7 @@ function printSequence(sequencePath, options, print) {
|
|
|
48773
48790
|
const printed = print(path);
|
|
48774
48791
|
|
|
48775
48792
|
if (isNextLineEmpty$6(options.originalText, path.getValue(), options.locEnd) && i < count - 1) {
|
|
48776
|
-
return concat$
|
|
48793
|
+
return concat$i([printed, hardline$c]);
|
|
48777
48794
|
}
|
|
48778
48795
|
|
|
48779
48796
|
return printed;
|
|
@@ -49095,12 +49112,11 @@ const {
|
|
|
49095
49112
|
const {
|
|
49096
49113
|
builders: {
|
|
49097
49114
|
hardline: hardline$d,
|
|
49098
|
-
|
|
49099
|
-
concat: concat$i,
|
|
49115
|
+
concat: concat$j,
|
|
49100
49116
|
markAsRoot: markAsRoot$2
|
|
49101
49117
|
},
|
|
49102
49118
|
utils: {
|
|
49103
|
-
|
|
49119
|
+
replaceNewlinesWithLiterallines: replaceNewlinesWithLiterallines$2
|
|
49104
49120
|
}
|
|
49105
49121
|
} = document;
|
|
49106
49122
|
const {
|
|
@@ -49127,7 +49143,7 @@ function embed$2(path, print, textToDoc, options) {
|
|
|
49127
49143
|
}, {
|
|
49128
49144
|
stripTrailingHardline: true
|
|
49129
49145
|
});
|
|
49130
|
-
return markAsRoot$2(concat$
|
|
49146
|
+
return markAsRoot$2(concat$j([style, node.lang, node.meta ? " " + node.meta : "", hardline$d, replaceNewlinesWithLiterallines$2(doc), hardline$d, style]));
|
|
49131
49147
|
}
|
|
49132
49148
|
}
|
|
49133
49149
|
|
|
@@ -49137,7 +49153,7 @@ function embed$2(path, print, textToDoc, options) {
|
|
|
49137
49153
|
// MDX
|
|
49138
49154
|
|
|
49139
49155
|
case "importExport":
|
|
49140
|
-
return concat$
|
|
49156
|
+
return concat$j([textToDoc(node.value, {
|
|
49141
49157
|
parser: "babel"
|
|
49142
49158
|
}, {
|
|
49143
49159
|
stripTrailingHardline: true
|
|
@@ -49153,10 +49169,6 @@ function embed$2(path, print, textToDoc, options) {
|
|
|
49153
49169
|
}
|
|
49154
49170
|
|
|
49155
49171
|
return null;
|
|
49156
|
-
|
|
49157
|
-
function replaceNewlinesWithLiterallines(doc) {
|
|
49158
|
-
return mapDoc$2(doc, currentDoc => typeof currentDoc === "string" && currentDoc.includes("\n") ? concat$i(currentDoc.split(/(\n)/g).map((v, i) => i % 2 === 0 ? v : literalline$3)) : currentDoc);
|
|
49159
|
-
}
|
|
49160
49172
|
}
|
|
49161
49173
|
|
|
49162
49174
|
var embed_1$2 = embed$2;
|
|
@@ -49455,7 +49467,7 @@ const {
|
|
|
49455
49467
|
const {
|
|
49456
49468
|
builders: {
|
|
49457
49469
|
breakParent: breakParent$6,
|
|
49458
|
-
concat: concat$
|
|
49470
|
+
concat: concat$k,
|
|
49459
49471
|
join: join$b,
|
|
49460
49472
|
line: line$c,
|
|
49461
49473
|
literalline: literalline$4,
|
|
@@ -49496,7 +49508,7 @@ function genericPrint$4(path, options, print) {
|
|
|
49496
49508
|
const node = path.getValue();
|
|
49497
49509
|
|
|
49498
49510
|
if (shouldRemainTheSameContent(path)) {
|
|
49499
|
-
return concat$
|
|
49511
|
+
return concat$k(splitText$2(options.originalText.slice(node.position.start.offset, node.position.end.offset), options).map(node => node.type === "word" ? node.value : node.value === "" ? "" : printLine(path, node.value, options)));
|
|
49500
49512
|
}
|
|
49501
49513
|
|
|
49502
49514
|
switch (node.type) {
|
|
@@ -49508,7 +49520,7 @@ function genericPrint$4(path, options, print) {
|
|
|
49508
49520
|
return "";
|
|
49509
49521
|
}
|
|
49510
49522
|
|
|
49511
|
-
return concat$
|
|
49523
|
+
return concat$k([normalizeDoc$1(printRoot(path, options, print)), !TRAILING_HARDLINE_NODES.has(getLastDescendantNode(node).type) ? hardline$e : ""]);
|
|
49512
49524
|
|
|
49513
49525
|
case "paragraph":
|
|
49514
49526
|
return printChildren$1(path, options, print, {
|
|
@@ -49563,21 +49575,21 @@ function genericPrint$4(path, options, print) {
|
|
|
49563
49575
|
style = hasPrevOrNextWord || getAncestorNode$2(path, "emphasis") ? "*" : "_";
|
|
49564
49576
|
}
|
|
49565
49577
|
|
|
49566
|
-
return concat$
|
|
49578
|
+
return concat$k([style, printChildren$1(path, options, print), style]);
|
|
49567
49579
|
}
|
|
49568
49580
|
|
|
49569
49581
|
case "strong":
|
|
49570
|
-
return concat$
|
|
49582
|
+
return concat$k(["**", printChildren$1(path, options, print), "**"]);
|
|
49571
49583
|
|
|
49572
49584
|
case "delete":
|
|
49573
|
-
return concat$
|
|
49585
|
+
return concat$k(["~~", printChildren$1(path, options, print), "~~"]);
|
|
49574
49586
|
|
|
49575
49587
|
case "inlineCode":
|
|
49576
49588
|
{
|
|
49577
49589
|
const backtickCount = getMinNotPresentContinuousCount$1(node.value, "`");
|
|
49578
49590
|
const style = "`".repeat(backtickCount || 1);
|
|
49579
49591
|
const gap = backtickCount && !/^\s/.test(node.value) ? " " : "";
|
|
49580
|
-
return concat$
|
|
49592
|
+
return concat$k([style, gap, node.value, gap, style]);
|
|
49581
49593
|
}
|
|
49582
49594
|
|
|
49583
49595
|
case "link":
|
|
@@ -49587,37 +49599,37 @@ function genericPrint$4(path, options, print) {
|
|
|
49587
49599
|
const mailto = "mailto:";
|
|
49588
49600
|
const url = // <hello@example.com> is parsed as { url: "mailto:hello@example.com" }
|
|
49589
49601
|
node.url.startsWith(mailto) && options.originalText.slice(node.position.start.offset + 1, node.position.start.offset + 1 + mailto.length) !== mailto ? node.url.slice(mailto.length) : node.url;
|
|
49590
|
-
return concat$
|
|
49602
|
+
return concat$k(["<", url, ">"]);
|
|
49591
49603
|
}
|
|
49592
49604
|
|
|
49593
49605
|
case "[":
|
|
49594
|
-
return concat$
|
|
49606
|
+
return concat$k(["[", printChildren$1(path, options, print), "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"]);
|
|
49595
49607
|
|
|
49596
49608
|
default:
|
|
49597
49609
|
return options.originalText.slice(node.position.start.offset, node.position.end.offset);
|
|
49598
49610
|
}
|
|
49599
49611
|
|
|
49600
49612
|
case "image":
|
|
49601
|
-
return concat$
|
|
49613
|
+
return concat$k([""), printTitle(node.title, options), ")"]);
|
|
49602
49614
|
|
|
49603
49615
|
case "blockquote":
|
|
49604
|
-
return concat$
|
|
49616
|
+
return concat$k(["> ", align$3("> ", printChildren$1(path, options, print))]);
|
|
49605
49617
|
|
|
49606
49618
|
case "heading":
|
|
49607
|
-
return concat$
|
|
49619
|
+
return concat$k(["#".repeat(node.depth) + " ", printChildren$1(path, options, print)]);
|
|
49608
49620
|
|
|
49609
49621
|
case "code":
|
|
49610
49622
|
{
|
|
49611
49623
|
if (node.isIndented) {
|
|
49612
49624
|
// indented code block
|
|
49613
49625
|
const alignment = " ".repeat(4);
|
|
49614
|
-
return align$3(alignment, concat$
|
|
49626
|
+
return align$3(alignment, concat$k([alignment, concat$k(replaceEndOfLineWith$1(node.value, hardline$e))]));
|
|
49615
49627
|
} // fenced code block
|
|
49616
49628
|
|
|
49617
49629
|
|
|
49618
49630
|
const styleUnit = options.__inJsTemplate ? "~" : "`";
|
|
49619
49631
|
const style = styleUnit.repeat(Math.max(3, getMaxContinuousCount$3(node.value, styleUnit) + 1));
|
|
49620
|
-
return concat$
|
|
49632
|
+
return concat$k([style, node.lang || "", node.meta ? " " + node.meta : "", hardline$e, concat$k(replaceEndOfLineWith$1(getFencedCodeBlockValue$2(node, options.originalText), hardline$e)), hardline$e, style]);
|
|
49621
49633
|
}
|
|
49622
49634
|
|
|
49623
49635
|
case "html":
|
|
@@ -49625,7 +49637,7 @@ function genericPrint$4(path, options, print) {
|
|
|
49625
49637
|
const parentNode = path.getParentNode();
|
|
49626
49638
|
const value = parentNode.type === "root" && getLast$7(parentNode.children) === node ? node.value.trimEnd() : node.value;
|
|
49627
49639
|
const isHtmlComment = /^<!--[\S\s]*-->$/.test(value);
|
|
49628
|
-
return concat$
|
|
49640
|
+
return concat$k(replaceEndOfLineWith$1(value, isHtmlComment ? hardline$e : markAsRoot$3(literalline$4)));
|
|
49629
49641
|
}
|
|
49630
49642
|
|
|
49631
49643
|
case "list":
|
|
@@ -49638,10 +49650,10 @@ function genericPrint$4(path, options, print) {
|
|
|
49638
49650
|
const childNode = childPath.getValue();
|
|
49639
49651
|
|
|
49640
49652
|
if (childNode.children.length === 2 && childNode.children[1].type === "html" && childNode.children[0].position.start.column !== childNode.children[1].position.start.column) {
|
|
49641
|
-
return concat$
|
|
49653
|
+
return concat$k([prefix, printListItem(childPath, options, print, prefix)]);
|
|
49642
49654
|
}
|
|
49643
49655
|
|
|
49644
|
-
return concat$
|
|
49656
|
+
return concat$k([prefix, align$3(" ".repeat(prefix.length), printListItem(childPath, options, print, prefix))]);
|
|
49645
49657
|
|
|
49646
49658
|
function getPrefix() {
|
|
49647
49659
|
const rawPrefix = node.ordered ? (index === 0 ? node.start : isGitDiffFriendlyOrderedList ? 1 : node.start + index) + (nthSiblingIndex % 2 === 0 ? ". " : ") ") : nthSiblingIndex % 2 === 0 ? "- " : "* ";
|
|
@@ -49666,21 +49678,21 @@ function genericPrint$4(path, options, print) {
|
|
|
49666
49678
|
}
|
|
49667
49679
|
|
|
49668
49680
|
case "linkReference":
|
|
49669
|
-
return concat$
|
|
49681
|
+
return concat$k(["[", printChildren$1(path, options, print), "]", node.referenceType === "full" ? concat$k(["[", node.identifier, "]"]) : node.referenceType === "collapsed" ? "[]" : ""]);
|
|
49670
49682
|
|
|
49671
49683
|
case "imageReference":
|
|
49672
49684
|
switch (node.referenceType) {
|
|
49673
49685
|
case "full":
|
|
49674
|
-
return concat$
|
|
49686
|
+
return concat$k(["![", node.alt || "", "][", node.identifier, "]"]);
|
|
49675
49687
|
|
|
49676
49688
|
default:
|
|
49677
|
-
return concat$
|
|
49689
|
+
return concat$k(["![", node.alt, "]", node.referenceType === "collapsed" ? "[]" : ""]);
|
|
49678
49690
|
}
|
|
49679
49691
|
|
|
49680
49692
|
case "definition":
|
|
49681
49693
|
{
|
|
49682
49694
|
const lineOrSpace = options.proseWrap === "always" ? line$c : " ";
|
|
49683
|
-
return group$i(concat$
|
|
49695
|
+
return group$i(concat$k([concat$k(["[", node.identifier, "]:"]), indent$d(concat$k([lineOrSpace, printUrl(node.url), node.title === null ? "" : concat$k([lineOrSpace, printTitle(node.title, options, false)])]))]));
|
|
49684
49696
|
}
|
|
49685
49697
|
// `footnote` requires `.use(footnotes, {inlineNotes: true})`, we are not using this option
|
|
49686
49698
|
// https://github.com/remarkjs/remark-footnotes#optionsinlinenotes
|
|
@@ -49688,18 +49700,18 @@ function genericPrint$4(path, options, print) {
|
|
|
49688
49700
|
/* istanbul ignore next */
|
|
49689
49701
|
|
|
49690
49702
|
case "footnote":
|
|
49691
|
-
return concat$
|
|
49703
|
+
return concat$k(["[^", printChildren$1(path, options, print), "]"]);
|
|
49692
49704
|
|
|
49693
49705
|
case "footnoteReference":
|
|
49694
|
-
return concat$
|
|
49706
|
+
return concat$k(["[^", node.identifier, "]"]);
|
|
49695
49707
|
|
|
49696
49708
|
case "footnoteDefinition":
|
|
49697
49709
|
{
|
|
49698
49710
|
const nextNode = path.getParentNode().children[path.getName() + 1];
|
|
49699
49711
|
const shouldInlineFootnote = node.children.length === 1 && node.children[0].type === "paragraph" && (options.proseWrap === "never" || options.proseWrap === "preserve" && node.children[0].position.start.line === node.children[0].position.end.line);
|
|
49700
|
-
return concat$
|
|
49712
|
+
return concat$k(["[^", node.identifier, "]: ", shouldInlineFootnote ? printChildren$1(path, options, print) : group$i(concat$k([align$3(" ".repeat(4), printChildren$1(path, options, print, {
|
|
49701
49713
|
processor: (childPath, index) => {
|
|
49702
|
-
return index === 0 ? group$i(concat$
|
|
49714
|
+
return index === 0 ? group$i(concat$k([softline$a, childPath.call(print)])) : childPath.call(print);
|
|
49703
49715
|
}
|
|
49704
49716
|
})), nextNode && nextNode.type === "footnoteDefinition" ? softline$a : ""]))]);
|
|
49705
49717
|
}
|
|
@@ -49711,20 +49723,20 @@ function genericPrint$4(path, options, print) {
|
|
|
49711
49723
|
return printChildren$1(path, options, print);
|
|
49712
49724
|
|
|
49713
49725
|
case "break":
|
|
49714
|
-
return /\s/.test(options.originalText[node.position.start.offset]) ? concat$
|
|
49726
|
+
return /\s/.test(options.originalText[node.position.start.offset]) ? concat$k([" ", markAsRoot$3(literalline$4)]) : concat$k(["\\", hardline$e]);
|
|
49715
49727
|
|
|
49716
49728
|
case "liquidNode":
|
|
49717
|
-
return concat$
|
|
49729
|
+
return concat$k(replaceEndOfLineWith$1(node.value, hardline$e));
|
|
49718
49730
|
// MDX
|
|
49719
49731
|
|
|
49720
49732
|
case "importExport":
|
|
49721
49733
|
case "jsx":
|
|
49722
49734
|
// fallback to the original text if multiparser failed
|
|
49723
49735
|
// or `embeddedLanguageFormatting: "off"`
|
|
49724
|
-
return concat$
|
|
49736
|
+
return concat$k([node.value, hardline$e]);
|
|
49725
49737
|
|
|
49726
49738
|
case "math":
|
|
49727
|
-
return concat$
|
|
49739
|
+
return concat$k(["$$", hardline$e, node.value ? concat$k([concat$k(replaceEndOfLineWith$1(node.value, hardline$e)), hardline$e]) : "", "$$"]);
|
|
49728
49740
|
|
|
49729
49741
|
case "inlineMath":
|
|
49730
49742
|
{
|
|
@@ -49746,7 +49758,7 @@ function genericPrint$4(path, options, print) {
|
|
|
49746
49758
|
function printListItem(path, options, print, listPrefix) {
|
|
49747
49759
|
const node = path.getValue();
|
|
49748
49760
|
const prefix = node.checked === null ? "" : node.checked ? "[x] " : "[ ] ";
|
|
49749
|
-
return concat$
|
|
49761
|
+
return concat$k([prefix, printChildren$1(path, options, print, {
|
|
49750
49762
|
processor: (childPath, index) => {
|
|
49751
49763
|
if (index === 0 && childPath.getValue().type !== "list") {
|
|
49752
49764
|
return align$3(" ".repeat(prefix.length), childPath.call(print));
|
|
@@ -49754,7 +49766,7 @@ function printListItem(path, options, print, listPrefix) {
|
|
|
49754
49766
|
|
|
49755
49767
|
const alignment = " ".repeat(clamp(options.tabWidth - listPrefix.length, 0, 3) // 4+ will cause indented code block
|
|
49756
49768
|
);
|
|
49757
|
-
return concat$
|
|
49769
|
+
return concat$k([alignment, align$3(alignment, childPath.call(print))]);
|
|
49758
49770
|
}
|
|
49759
49771
|
})]);
|
|
49760
49772
|
}
|
|
@@ -49838,7 +49850,7 @@ function printTable(path, options, print) {
|
|
|
49838
49850
|
const alignedTable = join$b(hardlineWithoutBreakParent, [printRow(contents[0]), printSeparator(), join$b(hardlineWithoutBreakParent, contents.slice(1).map(rowContents => printRow(rowContents)))]);
|
|
49839
49851
|
|
|
49840
49852
|
if (options.proseWrap !== "never") {
|
|
49841
|
-
return concat$
|
|
49853
|
+
return concat$k([breakParent$6, alignedTable]);
|
|
49842
49854
|
} // Only if the --prose-wrap never is set and it exceeds the print width.
|
|
49843
49855
|
|
|
49844
49856
|
|
|
@@ -49849,10 +49861,10 @@ function printTable(path, options, print) {
|
|
|
49849
49861
|
true), join$b(hardlineWithoutBreakParent, contents.slice(1).map(rowContents => printRow(rowContents,
|
|
49850
49862
|
/* isCompact */
|
|
49851
49863
|
true)))]);
|
|
49852
|
-
return concat$
|
|
49864
|
+
return concat$k([breakParent$6, group$i(ifBreak$8(compactTable, alignedTable))]);
|
|
49853
49865
|
|
|
49854
49866
|
function printSeparator(isCompact) {
|
|
49855
|
-
return concat$
|
|
49867
|
+
return concat$k(["| ", join$b(" | ", columnMaxWidths.map((width, index) => {
|
|
49856
49868
|
const spaces = isCompact ? 3 : width;
|
|
49857
49869
|
|
|
49858
49870
|
switch (node.align[index]) {
|
|
@@ -49872,7 +49884,7 @@ function printTable(path, options, print) {
|
|
|
49872
49884
|
}
|
|
49873
49885
|
|
|
49874
49886
|
function printRow(rowContents, isCompact) {
|
|
49875
|
-
return concat$
|
|
49887
|
+
return concat$k(["| ", join$b(" | ", isCompact ? rowContents : rowContents.map((rowContent, columnIndex) => {
|
|
49876
49888
|
switch (node.align[columnIndex]) {
|
|
49877
49889
|
case "right":
|
|
49878
49890
|
return alignRight(rowContent, columnMaxWidths[columnIndex]);
|
|
@@ -49888,19 +49900,19 @@ function printTable(path, options, print) {
|
|
|
49888
49900
|
|
|
49889
49901
|
function alignLeft(text, width) {
|
|
49890
49902
|
const spaces = width - getStringWidth$4(text);
|
|
49891
|
-
return concat$
|
|
49903
|
+
return concat$k([text, " ".repeat(spaces)]);
|
|
49892
49904
|
}
|
|
49893
49905
|
|
|
49894
49906
|
function alignRight(text, width) {
|
|
49895
49907
|
const spaces = width - getStringWidth$4(text);
|
|
49896
|
-
return concat$
|
|
49908
|
+
return concat$k([" ".repeat(spaces), text]);
|
|
49897
49909
|
}
|
|
49898
49910
|
|
|
49899
49911
|
function alignCenter(text, width) {
|
|
49900
49912
|
const spaces = width - getStringWidth$4(text);
|
|
49901
49913
|
const left = Math.floor(spaces / 2);
|
|
49902
49914
|
const right = spaces - left;
|
|
49903
|
-
return concat$
|
|
49915
|
+
return concat$k([" ".repeat(left), text, " ".repeat(right)]);
|
|
49904
49916
|
}
|
|
49905
49917
|
}
|
|
49906
49918
|
|
|
@@ -49948,7 +49960,7 @@ function printRoot(path, options, print) {
|
|
|
49948
49960
|
const ignoreRange = ignoreRanges[0];
|
|
49949
49961
|
|
|
49950
49962
|
if (index === ignoreRange.start.index) {
|
|
49951
|
-
return concat$
|
|
49963
|
+
return concat$k([children[ignoreRange.start.index].value, options.originalText.slice(ignoreRange.start.offset, ignoreRange.end.offset), children[ignoreRange.end.index].value]);
|
|
49952
49964
|
}
|
|
49953
49965
|
|
|
49954
49966
|
if (ignoreRange.start.index < index && index < ignoreRange.end.index) {
|
|
@@ -49968,7 +49980,7 @@ function printRoot(path, options, print) {
|
|
|
49968
49980
|
|
|
49969
49981
|
function printChildren$1(path, options, print, events) {
|
|
49970
49982
|
events = events || {};
|
|
49971
|
-
const postprocessor = events.postprocessor || concat$
|
|
49983
|
+
const postprocessor = events.postprocessor || concat$k;
|
|
49972
49984
|
|
|
49973
49985
|
const processor = events.processor || (childPath => childPath.call(print));
|
|
49974
49986
|
|
|
@@ -52259,7 +52271,7 @@ var pragma$4 = {
|
|
|
52259
52271
|
|
|
52260
52272
|
const {
|
|
52261
52273
|
builders: {
|
|
52262
|
-
concat: concat$
|
|
52274
|
+
concat: concat$l,
|
|
52263
52275
|
group: group$j
|
|
52264
52276
|
}
|
|
52265
52277
|
} = document;
|
|
@@ -52276,7 +52288,7 @@ function printVueFor(value, textToDoc) {
|
|
|
52276
52288
|
operator,
|
|
52277
52289
|
right
|
|
52278
52290
|
} = parseVueFor(value);
|
|
52279
|
-
return concat$
|
|
52291
|
+
return concat$l([group$j(textToDoc(`function _(${left}) {}`, {
|
|
52280
52292
|
parser: "babel",
|
|
52281
52293
|
__isVueForBindingLeft: true
|
|
52282
52294
|
})), " ", operator, " ", textToDoc(right, {
|
|
@@ -52668,7 +52680,7 @@ var parseSrcset = createCommonjsModule(function (module) {
|
|
|
52668
52680
|
|
|
52669
52681
|
const {
|
|
52670
52682
|
builders: {
|
|
52671
|
-
concat: concat$
|
|
52683
|
+
concat: concat$m,
|
|
52672
52684
|
ifBreak: ifBreak$9,
|
|
52673
52685
|
join: join$c,
|
|
52674
52686
|
line: line$d
|
|
@@ -52711,7 +52723,7 @@ function printImgSrcset(value) {
|
|
|
52711
52723
|
return index === -1 ? descriptor.length : index;
|
|
52712
52724
|
});
|
|
52713
52725
|
const maxDescriptorLeftLength = getMax(descriptorLeftLengths);
|
|
52714
|
-
return join$c(concat$
|
|
52726
|
+
return join$c(concat$m([",", line$d]), urls.map((url, index) => {
|
|
52715
52727
|
const parts = [url];
|
|
52716
52728
|
const descriptor = descriptors[index];
|
|
52717
52729
|
|
|
@@ -52722,7 +52734,7 @@ function printImgSrcset(value) {
|
|
|
52722
52734
|
parts.push(ifBreak$9(alignment, " "), descriptor + unit);
|
|
52723
52735
|
}
|
|
52724
52736
|
|
|
52725
|
-
return concat$
|
|
52737
|
+
return concat$m(parts);
|
|
52726
52738
|
}));
|
|
52727
52739
|
}
|
|
52728
52740
|
|
|
@@ -52738,7 +52750,7 @@ var syntaxAttribute = {
|
|
|
52738
52750
|
const {
|
|
52739
52751
|
builders,
|
|
52740
52752
|
utils: {
|
|
52741
|
-
mapDoc: mapDoc$
|
|
52753
|
+
mapDoc: mapDoc$2,
|
|
52742
52754
|
normalizeParts: normalizeParts$2
|
|
52743
52755
|
}
|
|
52744
52756
|
} = document;
|
|
@@ -52797,7 +52809,7 @@ const {
|
|
|
52797
52809
|
printClassNames: printClassNames$1
|
|
52798
52810
|
} = syntaxAttribute;
|
|
52799
52811
|
|
|
52800
|
-
function concat$
|
|
52812
|
+
function concat$n(parts) {
|
|
52801
52813
|
const newParts = normalizeParts$2(parts);
|
|
52802
52814
|
return newParts.length === 0 ? "" : newParts.length === 1 ? newParts[0] : builders.concat(newParts);
|
|
52803
52815
|
}
|
|
@@ -52833,7 +52845,7 @@ function embed$4(path, print, textToDoc, options) {
|
|
|
52833
52845
|
isEmpty = doc === "";
|
|
52834
52846
|
}
|
|
52835
52847
|
|
|
52836
|
-
return concat$
|
|
52848
|
+
return concat$n([printOpeningTagPrefix(node, options), group$k(printOpeningTag(path, options, print)), isEmpty ? "" : hardline$f, doc, isEmpty ? "" : hardline$f, printClosingTag(node, options), printClosingTagSuffix(node, options)]);
|
|
52837
52849
|
}
|
|
52838
52850
|
|
|
52839
52851
|
break;
|
|
@@ -52863,12 +52875,12 @@ function embed$4(path, print, textToDoc, options) {
|
|
|
52863
52875
|
textToDocOptions.__babelSourceType = sourceType;
|
|
52864
52876
|
}
|
|
52865
52877
|
|
|
52866
|
-
return builders.concat([concat$
|
|
52878
|
+
return builders.concat([concat$n([breakParent$7, printOpeningTagPrefix(node, options), textToDoc(value, textToDocOptions, {
|
|
52867
52879
|
stripTrailingHardline: true
|
|
52868
52880
|
}), printClosingTagSuffix(node, options)])]);
|
|
52869
52881
|
}
|
|
52870
52882
|
} else if (node.parent.type === "interpolation") {
|
|
52871
|
-
return concat$
|
|
52883
|
+
return concat$n([indent$e(concat$n([line$e, textToDoc(node.value, Object.assign({
|
|
52872
52884
|
__isInHtmlInterpolation: true
|
|
52873
52885
|
}, options.parser === "angular" ? {
|
|
52874
52886
|
parser: "__ng_interpolation",
|
|
@@ -52893,7 +52905,7 @@ function embed$4(path, print, textToDoc, options) {
|
|
|
52893
52905
|
|
|
52894
52906
|
|
|
52895
52907
|
if (/^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
|
|
52896
|
-
return concat$
|
|
52908
|
+
return concat$n([node.rawName, "=", node.value]);
|
|
52897
52909
|
} // lwc: html`<my-element data-for={value}></my-element>`
|
|
52898
52910
|
|
|
52899
52911
|
|
|
@@ -52901,7 +52913,7 @@ function embed$4(path, print, textToDoc, options) {
|
|
|
52901
52913
|
const interpolationRegex = /^{[\S\s]*}$/;
|
|
52902
52914
|
|
|
52903
52915
|
if (interpolationRegex.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
|
|
52904
|
-
return concat$
|
|
52916
|
+
return concat$n([node.rawName, "=", node.value]);
|
|
52905
52917
|
}
|
|
52906
52918
|
}
|
|
52907
52919
|
|
|
@@ -52913,7 +52925,7 @@ function embed$4(path, print, textToDoc, options) {
|
|
|
52913
52925
|
}), options);
|
|
52914
52926
|
|
|
52915
52927
|
if (embeddedAttributeValueDoc) {
|
|
52916
|
-
return concat$
|
|
52928
|
+
return concat$n([node.rawName, '="', group$k(mapDoc$2(embeddedAttributeValueDoc, doc => typeof doc === "string" ? doc.replace(/"/g, """) : doc)), '"']);
|
|
52917
52929
|
}
|
|
52918
52930
|
|
|
52919
52931
|
break;
|
|
@@ -52929,7 +52941,7 @@ function genericPrint$5(path, options, print) {
|
|
|
52929
52941
|
|
|
52930
52942
|
switch (node.type) {
|
|
52931
52943
|
case "front-matter":
|
|
52932
|
-
return concat$
|
|
52944
|
+
return concat$n(replaceEndOfLineWith$2(node.raw, literalline$5));
|
|
52933
52945
|
|
|
52934
52946
|
case "root":
|
|
52935
52947
|
if (options.__onHtmlRoot) {
|
|
@@ -52943,7 +52955,7 @@ function genericPrint$5(path, options, print) {
|
|
|
52943
52955
|
case "ieConditionalComment":
|
|
52944
52956
|
{
|
|
52945
52957
|
if (shouldPreserveContent$1(node, options)) {
|
|
52946
|
-
return concat$
|
|
52958
|
+
return concat$n([].concat(printOpeningTagPrefix(node, options), group$k(printOpeningTag(path, options, print)), replaceEndOfLineWith$2(getNodeContent(node, options), literalline$5), printClosingTag(node, options), printClosingTagSuffix(node, options)));
|
|
52947
52959
|
}
|
|
52948
52960
|
/**
|
|
52949
52961
|
* do not break:
|
|
@@ -52969,11 +52981,11 @@ function genericPrint$5(path, options, print) {
|
|
|
52969
52981
|
|
|
52970
52982
|
const shouldHugContent = node.children.length === 1 && node.firstChild.type === "interpolation" && node.firstChild.isLeadingSpaceSensitive && !node.firstChild.hasLeadingSpaces && node.lastChild.isTrailingSpaceSensitive && !node.lastChild.hasTrailingSpaces;
|
|
52971
52983
|
const attrGroupId = Symbol("element-attr-group-id");
|
|
52972
|
-
return concat$
|
|
52984
|
+
return concat$n([group$k(concat$n([group$k(printOpeningTag(path, options, print), {
|
|
52973
52985
|
id: attrGroupId
|
|
52974
|
-
}), node.children.length === 0 ? node.hasDanglingSpaces && node.isDanglingSpaceSensitive ? line$e : "" : concat$
|
|
52986
|
+
}), node.children.length === 0 ? node.hasDanglingSpaces && node.isDanglingSpaceSensitive ? line$e : "" : concat$n([forceBreakContent$1(node) ? breakParent$7 : "", (childrenDoc => shouldHugContent ? ifBreak$a(indent$e(childrenDoc), childrenDoc, {
|
|
52975
52987
|
groupId: attrGroupId
|
|
52976
|
-
}) : (isScriptLikeTag$1(node) || isVueCustomBlock$1(node, options)) && node.parent.type === "root" && options.parser === "vue" && !options.vueIndentScriptAndStyle ? childrenDoc : indent$e(childrenDoc))(concat$
|
|
52988
|
+
}) : (isScriptLikeTag$1(node) || isVueCustomBlock$1(node, options)) && node.parent.type === "root" && options.parser === "vue" && !options.vueIndentScriptAndStyle ? childrenDoc : indent$e(childrenDoc))(concat$n([shouldHugContent ? ifBreak$a(softline$b, "", {
|
|
52977
52989
|
groupId: attrGroupId
|
|
52978
52990
|
}) : node.firstChild.hasLeadingSpaces && node.firstChild.isLeadingSpaceSensitive ? line$e : node.firstChild.type === "text" && node.isWhitespaceSensitive && node.isIndentationSensitive ? dedentToRoot$2(softline$b) : softline$b, printChildren$2(path, options, print)])), (node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent)) ? node.lastChild.hasTrailingSpaces && node.lastChild.isTrailingSpaceSensitive ? " " : "" : shouldHugContent ? ifBreak$a(softline$b, "", {
|
|
52979
52991
|
groupId: attrGroupId
|
|
@@ -52991,10 +53003,10 @@ function genericPrint$5(path, options, print) {
|
|
|
52991
53003
|
|
|
52992
53004
|
case "ieConditionalStartComment":
|
|
52993
53005
|
case "ieConditionalEndComment":
|
|
52994
|
-
return concat$
|
|
53006
|
+
return concat$n([printOpeningTagStart(node), printClosingTagEnd(node)]);
|
|
52995
53007
|
|
|
52996
53008
|
case "interpolation":
|
|
52997
|
-
return concat$
|
|
53009
|
+
return concat$n([printOpeningTagStart(node, options), concat$n(path.map(print, "children")), printClosingTagEnd(node, options)]);
|
|
52998
53010
|
|
|
52999
53011
|
case "text":
|
|
53000
53012
|
{
|
|
@@ -53003,18 +53015,18 @@ function genericPrint$5(path, options, print) {
|
|
|
53003
53015
|
const trailingNewlineRegex = /\n[^\S\n]*?$/;
|
|
53004
53016
|
const hasTrailingNewline = trailingNewlineRegex.test(node.value);
|
|
53005
53017
|
const value = hasTrailingNewline ? node.value.replace(trailingNewlineRegex, "") : node.value;
|
|
53006
|
-
return concat$
|
|
53018
|
+
return concat$n([concat$n(replaceEndOfLineWith$2(value, literalline$5)), hasTrailingNewline ? hardline$f : ""]);
|
|
53007
53019
|
}
|
|
53008
53020
|
|
|
53009
53021
|
return fill$6(normalizeParts$2([].concat(printOpeningTagPrefix(node, options), getTextValueParts(node), printClosingTagSuffix(node, options))));
|
|
53010
53022
|
}
|
|
53011
53023
|
|
|
53012
53024
|
case "docType":
|
|
53013
|
-
return concat$
|
|
53025
|
+
return concat$n([group$k(concat$n([printOpeningTagStart(node, options), " ", node.value.replace(/^html\b/i, "html").replace(/\s+/g, " ")])), printClosingTagEnd(node, options)]);
|
|
53014
53026
|
|
|
53015
53027
|
case "comment":
|
|
53016
53028
|
{
|
|
53017
|
-
return concat$
|
|
53029
|
+
return concat$n([printOpeningTagPrefix(node, options), concat$n(replaceEndOfLineWith$2(options.originalText.slice(options.locStart(node), options.locEnd(node)), literalline$5)), printClosingTagSuffix(node, options)]);
|
|
53018
53030
|
}
|
|
53019
53031
|
|
|
53020
53032
|
case "attribute":
|
|
@@ -53027,7 +53039,7 @@ function genericPrint$5(path, options, print) {
|
|
|
53027
53039
|
const singleQuoteCount = countChars$1(value, "'");
|
|
53028
53040
|
const doubleQuoteCount = countChars$1(value, '"');
|
|
53029
53041
|
const quote = singleQuoteCount < doubleQuoteCount ? "'" : '"';
|
|
53030
|
-
return concat$
|
|
53042
|
+
return concat$n([node.rawName, concat$n(["=", quote, concat$n(replaceEndOfLineWith$2(quote === '"' ? value.replace(/"/g, """) : value.replace(/'/g, "'"), literalline$5)), quote])]);
|
|
53031
53043
|
}
|
|
53032
53044
|
|
|
53033
53045
|
default:
|
|
@@ -53040,15 +53052,15 @@ function printChildren$2(path, options, print) {
|
|
|
53040
53052
|
const node = path.getValue();
|
|
53041
53053
|
|
|
53042
53054
|
if (forceBreakChildren$1(node)) {
|
|
53043
|
-
return concat$
|
|
53055
|
+
return concat$n([breakParent$7, concat$n(path.map(childPath => {
|
|
53044
53056
|
const childNode = childPath.getValue();
|
|
53045
53057
|
const prevBetweenLine = !childNode.prev ? "" : printBetweenLine(childNode.prev, childNode);
|
|
53046
|
-
return concat$
|
|
53058
|
+
return concat$n([!prevBetweenLine ? "" : concat$n([prevBetweenLine, forceNextEmptyLine$1(childNode.prev) ? hardline$f : ""]), printChild(childPath)]);
|
|
53047
53059
|
}, "children"))]);
|
|
53048
53060
|
}
|
|
53049
53061
|
|
|
53050
53062
|
const groupIds = node.children.map(() => Symbol(""));
|
|
53051
|
-
return concat$
|
|
53063
|
+
return concat$n(path.map((childPath, childIndex) => {
|
|
53052
53064
|
const childNode = childPath.getValue();
|
|
53053
53065
|
|
|
53054
53066
|
if (isTextLikeNode$1(childNode)) {
|
|
@@ -53057,10 +53069,10 @@ function printChildren$2(path, options, print) {
|
|
|
53057
53069
|
|
|
53058
53070
|
if (prevBetweenLine) {
|
|
53059
53071
|
if (forceNextEmptyLine$1(childNode.prev)) {
|
|
53060
|
-
return concat$
|
|
53072
|
+
return concat$n([hardline$f, hardline$f, printChild(childPath)]);
|
|
53061
53073
|
}
|
|
53062
53074
|
|
|
53063
|
-
return concat$
|
|
53075
|
+
return concat$n([prevBetweenLine, printChild(childPath)]);
|
|
53064
53076
|
}
|
|
53065
53077
|
}
|
|
53066
53078
|
|
|
@@ -53104,7 +53116,7 @@ function printChildren$2(path, options, print) {
|
|
|
53104
53116
|
}
|
|
53105
53117
|
}
|
|
53106
53118
|
|
|
53107
|
-
return concat$
|
|
53119
|
+
return concat$n([].concat(prevParts, group$k(concat$n([concat$n(leadingParts), group$k(concat$n([printChild(childPath), concat$n(trailingParts)]), {
|
|
53108
53120
|
id: groupIds[childIndex]
|
|
53109
53121
|
})])), nextParts));
|
|
53110
53122
|
}, "children"));
|
|
@@ -53113,7 +53125,7 @@ function printChildren$2(path, options, print) {
|
|
|
53113
53125
|
const child = childPath.getValue();
|
|
53114
53126
|
|
|
53115
53127
|
if (hasPrettierIgnore$6(child)) {
|
|
53116
|
-
return concat$
|
|
53128
|
+
return concat$n([].concat(printOpeningTagPrefix(child, options), replaceEndOfLineWith$2(options.originalText.slice(options.locStart(child) + (child.prev && needsToBorrowNextOpeningTagStartMarker(child.prev) ? printOpeningTagStartMarker(child).length : 0), options.locEnd(child) - (child.next && needsToBorrowPrevClosingTagEndMarker(child.next) ? printClosingTagEndMarker(child, options).length : 0)), literalline$5), printClosingTagSuffix(child, options)));
|
|
53117
53129
|
}
|
|
53118
53130
|
|
|
53119
53131
|
return print(childPath);
|
|
@@ -53190,10 +53202,10 @@ function printAttributes(path, options, print) {
|
|
|
53190
53202
|
const hasPrettierIgnoreAttribute = typeof ignoreAttributeData === "boolean" ? () => ignoreAttributeData : Array.isArray(ignoreAttributeData) ? attribute => ignoreAttributeData.includes(attribute.rawName) : () => false;
|
|
53191
53203
|
const printedAttributes = path.map(attributePath => {
|
|
53192
53204
|
const attribute = attributePath.getValue();
|
|
53193
|
-
return hasPrettierIgnoreAttribute(attribute) ? concat$
|
|
53205
|
+
return hasPrettierIgnoreAttribute(attribute) ? concat$n(replaceEndOfLineWith$2(options.originalText.slice(options.locStart(attribute), options.locEnd(attribute)), literalline$5)) : print(attributePath);
|
|
53194
53206
|
}, "attrs");
|
|
53195
53207
|
const forceNotToBreakAttrContent = node.type === "element" && node.fullName === "script" && node.attrs.length === 1 && node.attrs[0].fullName === "src" && node.children.length === 0;
|
|
53196
|
-
const parts = [indent$e(concat$
|
|
53208
|
+
const parts = [indent$e(concat$n([forceNotToBreakAttrContent ? " " : line$e, join$d(line$e, printedAttributes)]))];
|
|
53197
53209
|
|
|
53198
53210
|
if (
|
|
53199
53211
|
/**
|
|
@@ -53215,16 +53227,16 @@ function printAttributes(path, options, print) {
|
|
|
53215
53227
|
parts.push(node.isSelfClosing ? line$e : softline$b);
|
|
53216
53228
|
}
|
|
53217
53229
|
|
|
53218
|
-
return concat$
|
|
53230
|
+
return concat$n(parts);
|
|
53219
53231
|
}
|
|
53220
53232
|
|
|
53221
53233
|
function printOpeningTag(path, options, print) {
|
|
53222
53234
|
const node = path.getValue();
|
|
53223
|
-
return concat$
|
|
53235
|
+
return concat$n([printOpeningTagStart(node, options), printAttributes(path, options, print), node.isSelfClosing ? "" : printOpeningTagEnd(node)]);
|
|
53224
53236
|
}
|
|
53225
53237
|
|
|
53226
53238
|
function printOpeningTagStart(node, options) {
|
|
53227
|
-
return node.prev && needsToBorrowNextOpeningTagStartMarker(node.prev) ? "" : concat$
|
|
53239
|
+
return node.prev && needsToBorrowNextOpeningTagStartMarker(node.prev) ? "" : concat$n([printOpeningTagPrefix(node, options), printOpeningTagStartMarker(node)]);
|
|
53228
53240
|
}
|
|
53229
53241
|
|
|
53230
53242
|
function printOpeningTagEnd(node) {
|
|
@@ -53232,15 +53244,15 @@ function printOpeningTagEnd(node) {
|
|
|
53232
53244
|
}
|
|
53233
53245
|
|
|
53234
53246
|
function printClosingTag(node, options) {
|
|
53235
|
-
return concat$
|
|
53247
|
+
return concat$n([node.isSelfClosing ? "" : printClosingTagStart(node, options), printClosingTagEnd(node, options)]);
|
|
53236
53248
|
}
|
|
53237
53249
|
|
|
53238
53250
|
function printClosingTagStart(node, options) {
|
|
53239
|
-
return node.lastChild && needsToBorrowParentClosingTagStartMarker(node.lastChild) ? "" : concat$
|
|
53251
|
+
return node.lastChild && needsToBorrowParentClosingTagStartMarker(node.lastChild) ? "" : concat$n([printClosingTagPrefix(node, options), printClosingTagStartMarker(node, options)]);
|
|
53240
53252
|
}
|
|
53241
53253
|
|
|
53242
53254
|
function printClosingTagEnd(node, options) {
|
|
53243
|
-
return (node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent)) ? "" : concat$
|
|
53255
|
+
return (node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent)) ? "" : concat$n([printClosingTagEndMarker(node, options), printClosingTagSuffix(node, options)]);
|
|
53244
53256
|
}
|
|
53245
53257
|
|
|
53246
53258
|
function needsToBorrowNextOpeningTagStartMarker(node) {
|
|
@@ -53435,7 +53447,7 @@ function printEmbeddedAttributeValue(node, originalTextToDoc, options) {
|
|
|
53435
53447
|
|
|
53436
53448
|
const printHug = doc => group$k(doc);
|
|
53437
53449
|
|
|
53438
|
-
const printExpand = (doc, canHaveTrailingWhitespace = true) => group$k(concat$
|
|
53450
|
+
const printExpand = (doc, canHaveTrailingWhitespace = true) => group$k(concat$n([indent$e(concat$n([softline$b, doc])), canHaveTrailingWhitespace ? softline$b : ""]));
|
|
53439
53451
|
|
|
53440
53452
|
const printMaybeHug = doc => shouldHug ? printHug(doc) : printExpand(doc);
|
|
53441
53453
|
|
|
@@ -53580,20 +53592,20 @@ function printEmbeddedAttributeValue(node, originalTextToDoc, options) {
|
|
|
53580
53592
|
const parts = [];
|
|
53581
53593
|
value.split(interpolationRegex).forEach((part, index) => {
|
|
53582
53594
|
if (index % 2 === 0) {
|
|
53583
|
-
parts.push(concat$
|
|
53595
|
+
parts.push(concat$n(replaceEndOfLineWith$2(part, literalline$5)));
|
|
53584
53596
|
} else {
|
|
53585
53597
|
try {
|
|
53586
|
-
parts.push(group$k(concat$
|
|
53598
|
+
parts.push(group$k(concat$n(["{{", indent$e(concat$n([line$e, ngTextToDoc(part, {
|
|
53587
53599
|
parser: "__ng_interpolation",
|
|
53588
53600
|
__isInHtmlInterpolation: true // to avoid unexpected `}}`
|
|
53589
53601
|
|
|
53590
53602
|
})])), line$e, "}}"])));
|
|
53591
53603
|
} catch (e) {
|
|
53592
|
-
parts.push("{{", concat$
|
|
53604
|
+
parts.push("{{", concat$n(replaceEndOfLineWith$2(part, literalline$5)), "}}");
|
|
53593
53605
|
}
|
|
53594
53606
|
}
|
|
53595
53607
|
});
|
|
53596
|
-
return group$k(concat$
|
|
53608
|
+
return group$k(concat$n(parts));
|
|
53597
53609
|
}
|
|
53598
53610
|
}
|
|
53599
53611
|
|
|
@@ -54039,7 +54051,7 @@ const docBuilders$2 = document.builders;
|
|
|
54039
54051
|
const {
|
|
54040
54052
|
conditionalGroup: conditionalGroup$4,
|
|
54041
54053
|
breakParent: breakParent$8,
|
|
54042
|
-
concat: concat$
|
|
54054
|
+
concat: concat$o,
|
|
54043
54055
|
dedent: dedent$3,
|
|
54044
54056
|
dedentToRoot: dedentToRoot$3,
|
|
54045
54057
|
fill: fill$7,
|
|
@@ -54116,22 +54128,22 @@ function genericPrint$6(path, options, print) {
|
|
|
54116
54128
|
const tag = !node.tag ? "" : path.call(print, "tag");
|
|
54117
54129
|
const anchor = !node.anchor ? "" : path.call(print, "anchor");
|
|
54118
54130
|
const nextEmptyLine = isNode$1(node, ["mapping", "sequence", "comment", "directive", "mappingItem", "sequenceItem"]) && !isLastDescendantNode$1(path) ? printNextEmptyLine(path, options.originalText) : "";
|
|
54119
|
-
return concat$
|
|
54131
|
+
return concat$o([node.type !== "mappingValue" && hasLeadingComments$1(node) ? concat$o([join$e(hardline$g, path.map(print, "leadingComments")), hardline$g]) : "", tag, tag && anchor ? " " : "", anchor, tag || anchor ? isNode$1(node, ["sequence", "mapping"]) && !hasMiddleComments$1(node) ? hardline$g : " " : "", hasMiddleComments$1(node) ? concat$o([node.middleComments.length === 1 ? "" : hardline$g, join$e(hardline$g, path.map(print, "middleComments")), hardline$g]) : "", hasPrettierIgnore$8(path) ? concat$o(replaceEndOfLineWith$3(options.originalText.slice(node.position.start.offset, node.position.end.offset).trimEnd(), literalline$6)) : group$l(_print(node, parentNode, path, options, print)), hasTrailingComment$5(node) && !isNode$1(node, ["document", "documentHead"]) ? lineSuffix$2(concat$o([node.type === "mappingValue" && !node.content ? "" : " ", parentNode.type === "mappingKey" && path.getParentNode(2).type === "mapping" && isInlineNode(node) ? "" : breakParent$8, path.call(print, "trailingComment")])) : "", shouldPrintEndComments(node) ? align$4(node.type === "sequenceItem" ? 2 : 0, concat$o([hardline$g, join$e(hardline$g, path.map(path => concat$o([isPreviousLineEmpty$3(options.originalText, path.getValue(), options.locStart) ? hardline$g : "", print(path)]), "endComments"))])) : "", nextEmptyLine]);
|
|
54120
54132
|
}
|
|
54121
54133
|
|
|
54122
54134
|
function _print(node, parentNode, path, options, print) {
|
|
54123
54135
|
switch (node.type) {
|
|
54124
54136
|
case "root":
|
|
54125
|
-
return concat$
|
|
54137
|
+
return concat$o([join$e(hardline$g, path.map((childPath, index) => {
|
|
54126
54138
|
const document = node.children[index];
|
|
54127
54139
|
const nextDocument = node.children[index + 1];
|
|
54128
|
-
return concat$
|
|
54140
|
+
return concat$o([print(childPath), shouldPrintDocumentEndMarker(document, nextDocument) ? concat$o([hardline$g, "...", hasTrailingComment$5(document) ? concat$o([" ", path.call(print, "trailingComment")]) : ""]) : !nextDocument || hasTrailingComment$5(nextDocument.head) ? "" : concat$o([hardline$g, "---"])]);
|
|
54129
54141
|
}, "children")), node.children.length === 0 || (lastDescendantNode => isNode$1(lastDescendantNode, ["blockLiteral", "blockFolded"]) && lastDescendantNode.chomping === "keep")(getLastDescendantNode$2(node)) ? "" : hardline$g]);
|
|
54130
54142
|
|
|
54131
54143
|
case "document":
|
|
54132
54144
|
{
|
|
54133
54145
|
const nextDocument = parentNode.children[path.getName() + 1];
|
|
54134
|
-
return join$e(hardline$g, [shouldPrintDocumentHeadEndMarker(node, nextDocument, parentNode, options) === "head" ? join$e(hardline$g, [node.head.children.length === 0 && node.head.endComments.length === 0 ? "" : path.call(print, "head"), concat$
|
|
54146
|
+
return join$e(hardline$g, [shouldPrintDocumentHeadEndMarker(node, nextDocument, parentNode, options) === "head" ? join$e(hardline$g, [node.head.children.length === 0 && node.head.endComments.length === 0 ? "" : path.call(print, "head"), concat$o(["---", hasTrailingComment$5(node.head) ? concat$o([" ", path.call(print, "head", "trailingComment")]) : ""])].filter(Boolean)) : "", shouldPrintDocumentBody(node) ? path.call(print, "body") : ""].filter(Boolean));
|
|
54135
54147
|
}
|
|
54136
54148
|
|
|
54137
54149
|
case "documentHead":
|
|
@@ -54143,24 +54155,24 @@ function _print(node, parentNode, path, options, print) {
|
|
|
54143
54155
|
const endComments = join$e(hardline$g, path.map(print, "endComments")).parts;
|
|
54144
54156
|
const separator = children.length === 0 || endComments.length === 0 ? "" : (lastDescendantNode => isNode$1(lastDescendantNode, ["blockFolded", "blockLiteral"]) ? lastDescendantNode.chomping === "keep" ? // there's already a newline printed at the end of blockValue (chomping=keep, lastDescendant=true)
|
|
54145
54157
|
"" : // an extra newline for better readability
|
|
54146
|
-
concat$
|
|
54147
|
-
return concat$
|
|
54158
|
+
concat$o([hardline$g, hardline$g]) : hardline$g)(getLastDescendantNode$2(node));
|
|
54159
|
+
return concat$o([].concat(children, separator, endComments));
|
|
54148
54160
|
}
|
|
54149
54161
|
|
|
54150
54162
|
case "directive":
|
|
54151
|
-
return concat$
|
|
54163
|
+
return concat$o(["%", join$e(" ", [node.name].concat(node.parameters))]);
|
|
54152
54164
|
|
|
54153
54165
|
case "comment":
|
|
54154
|
-
return concat$
|
|
54166
|
+
return concat$o(["#", node.value]);
|
|
54155
54167
|
|
|
54156
54168
|
case "alias":
|
|
54157
|
-
return concat$
|
|
54169
|
+
return concat$o(["*", node.value]);
|
|
54158
54170
|
|
|
54159
54171
|
case "tag":
|
|
54160
54172
|
return options.originalText.slice(node.position.start.offset, node.position.end.offset);
|
|
54161
54173
|
|
|
54162
54174
|
case "anchor":
|
|
54163
|
-
return concat$
|
|
54175
|
+
return concat$o(["&", node.value]);
|
|
54164
54176
|
|
|
54165
54177
|
case "plain":
|
|
54166
54178
|
return printFlowScalarContent(node.type, options.originalText.slice(node.position.start.offset, node.position.end.offset), options);
|
|
@@ -54176,19 +54188,19 @@ function _print(node, parentNode, path, options, print) {
|
|
|
54176
54188
|
// only quoteDouble can use escape chars
|
|
54177
54189
|
// and quoteSingle do not need to escape backslashes
|
|
54178
54190
|
const originalQuote = node.type === "quoteDouble" ? doubleQuote : singleQuote;
|
|
54179
|
-
return concat$
|
|
54191
|
+
return concat$o([originalQuote, printFlowScalarContent(node.type, raw, options), originalQuote]);
|
|
54180
54192
|
} else if (raw.includes(doubleQuote)) {
|
|
54181
|
-
return concat$
|
|
54193
|
+
return concat$o([singleQuote, printFlowScalarContent(node.type, node.type === "quoteDouble" ? raw // double quote needs to be escaped by backslash in quoteDouble
|
|
54182
54194
|
.replace(/\\"/g, doubleQuote).replace(/'/g, singleQuote.repeat(2)) : raw, options), singleQuote]);
|
|
54183
54195
|
}
|
|
54184
54196
|
|
|
54185
54197
|
if (raw.includes(singleQuote)) {
|
|
54186
|
-
return concat$
|
|
54198
|
+
return concat$o([doubleQuote, printFlowScalarContent(node.type, node.type === "quoteSingle" ? // single quote needs to be escaped by 2 single quotes in quoteSingle
|
|
54187
54199
|
raw.replace(/''/g, singleQuote) : raw, options), doubleQuote]);
|
|
54188
54200
|
}
|
|
54189
54201
|
|
|
54190
54202
|
const quote = options.singleQuote ? singleQuote : doubleQuote;
|
|
54191
|
-
return concat$
|
|
54203
|
+
return concat$o([quote, printFlowScalarContent(node.type, raw, options), quote]);
|
|
54192
54204
|
}
|
|
54193
54205
|
|
|
54194
54206
|
case "blockFolded":
|
|
@@ -54196,7 +54208,7 @@ function _print(node, parentNode, path, options, print) {
|
|
|
54196
54208
|
{
|
|
54197
54209
|
const parentIndent = getAncestorCount$1(path, ancestorNode => isNode$1(ancestorNode, ["sequence", "mapping"]));
|
|
54198
54210
|
const isLastDescendant = isLastDescendantNode$1(path);
|
|
54199
|
-
return concat$
|
|
54211
|
+
return concat$o([node.type === "blockFolded" ? ">" : "|", node.indent === null ? "" : node.indent.toString(), node.chomping === "clip" ? "" : node.chomping === "keep" ? "+" : "-", hasIndicatorComment$1(node) ? concat$o([" ", path.call(print, "indicatorComment")]) : "", (node.indent === null ? dedent$3 : dedentToRoot$3)(align$4(node.indent === null ? options.tabWidth : node.indent - 1 + parentIndent, concat$o(getBlockValueLineContents$1(node, {
|
|
54200
54212
|
parentIndent,
|
|
54201
54213
|
isLastDescendant,
|
|
54202
54214
|
options
|
|
@@ -54207,7 +54219,7 @@ function _print(node, parentNode, path, options, print) {
|
|
|
54207
54219
|
return join$e(hardline$g, path.map(print, "children"));
|
|
54208
54220
|
|
|
54209
54221
|
case "sequenceItem":
|
|
54210
|
-
return concat$
|
|
54222
|
+
return concat$o(["- ", align$4(2, !node.content ? "" : path.call(print, "content"))]);
|
|
54211
54223
|
|
|
54212
54224
|
case "mappingKey":
|
|
54213
54225
|
return !node.content ? "" : path.call(print, "content");
|
|
@@ -54225,26 +54237,26 @@ function _print(node, parentNode, path, options, print) {
|
|
|
54225
54237
|
const isEmptyMappingValue = isEmptyNode$1(node.value);
|
|
54226
54238
|
|
|
54227
54239
|
if (isEmptyMappingKey && isEmptyMappingValue) {
|
|
54228
|
-
return concat$
|
|
54240
|
+
return concat$o([": "]);
|
|
54229
54241
|
}
|
|
54230
54242
|
|
|
54231
54243
|
const key = path.call(print, "key");
|
|
54232
54244
|
const value = path.call(print, "value");
|
|
54233
54245
|
|
|
54234
54246
|
if (isEmptyMappingValue) {
|
|
54235
|
-
return node.type === "flowMappingItem" && parentNode.type === "flowMapping" ? key : node.type === "mappingItem" && isAbsolutelyPrintedAsSingleLineNode(node.key.content, options) && !hasTrailingComment$5(node.key.content) && (!parentNode.tag || parentNode.tag.value !== "tag:yaml.org,2002:set") ? concat$
|
|
54247
|
+
return node.type === "flowMappingItem" && parentNode.type === "flowMapping" ? key : node.type === "mappingItem" && isAbsolutelyPrintedAsSingleLineNode(node.key.content, options) && !hasTrailingComment$5(node.key.content) && (!parentNode.tag || parentNode.tag.value !== "tag:yaml.org,2002:set") ? concat$o([key, needsSpaceInFrontOfMappingValue(node) ? " " : "", ":"]) : concat$o(["? ", align$4(2, key)]);
|
|
54236
54248
|
}
|
|
54237
54249
|
|
|
54238
54250
|
if (isEmptyMappingKey) {
|
|
54239
|
-
return concat$
|
|
54251
|
+
return concat$o([": ", align$4(2, value)]);
|
|
54240
54252
|
}
|
|
54241
54253
|
|
|
54242
54254
|
const groupId = Symbol("mappingKey");
|
|
54243
54255
|
const forceExplicitKey = hasLeadingComments$1(node.value) || !isInlineNode(node.key.content);
|
|
54244
|
-
return forceExplicitKey ? concat$
|
|
54245
|
-
isSingleLineNode(node.key.content) && !hasLeadingComments$1(node.key.content) && !hasMiddleComments$1(node.key.content) && !hasTrailingComment$5(node.key.content) && !hasEndComments$1(node.key) && !hasLeadingComments$1(node.value.content) && !hasMiddleComments$1(node.value.content) && !hasEndComments$1(node.value) && isAbsolutelyPrintedAsSingleLineNode(node.value.content, options) ? concat$
|
|
54256
|
+
return forceExplicitKey ? concat$o(["? ", align$4(2, key), hardline$g, join$e("", path.map(print, "value", "leadingComments").map(comment => concat$o([comment, hardline$g]))), ": ", align$4(2, value)]) : // force singleline
|
|
54257
|
+
isSingleLineNode(node.key.content) && !hasLeadingComments$1(node.key.content) && !hasMiddleComments$1(node.key.content) && !hasTrailingComment$5(node.key.content) && !hasEndComments$1(node.key) && !hasLeadingComments$1(node.value.content) && !hasMiddleComments$1(node.value.content) && !hasEndComments$1(node.value) && isAbsolutelyPrintedAsSingleLineNode(node.value.content, options) ? concat$o([key, needsSpaceInFrontOfMappingValue(node) ? " " : "", ": ", value]) : conditionalGroup$4([concat$o([group$l(concat$o([ifBreak$b("? "), group$l(align$4(2, key), {
|
|
54246
54258
|
id: groupId
|
|
54247
|
-
})])), ifBreak$b(concat$
|
|
54259
|
+
})])), ifBreak$b(concat$o([hardline$g, ": ", align$4(2, value)]), indent(concat$o([needsSpaceInFrontOfMappingValue(node) ? " " : "", ":", hasLeadingComments$1(node.value.content) || hasEndComments$1(node.value) && node.value.content && !isNode$1(node.value.content, ["mapping", "sequence"]) || parentNode.type === "mapping" && hasTrailingComment$5(node.key.content) && isInlineNode(node.value.content) || isNode$1(node.value.content, ["mapping", "sequence"]) && node.value.content.tag === null && node.value.content.anchor === null ? hardline$g : !node.value.content ? "" : line$f, value])), {
|
|
54248
54260
|
groupId
|
|
54249
54261
|
})])]);
|
|
54250
54262
|
}
|
|
@@ -54258,7 +54270,7 @@ function _print(node, parentNode, path, options, print) {
|
|
|
54258
54270
|
|
|
54259
54271
|
const isLastItemEmptyMappingItem = node.children.length !== 0 && (lastItem => lastItem.type === "flowMappingItem" && isEmptyNode$1(lastItem.key) && isEmptyNode$1(lastItem.value))(getLast$9(node.children));
|
|
54260
54272
|
|
|
54261
|
-
return concat$
|
|
54273
|
+
return concat$o([openMarker, indent(concat$o([bracketSpacing, concat$o(path.map((childPath, index) => concat$o([print(childPath), index === node.children.length - 1 ? "" : concat$o([",", line$f, node.children[index].position.start.line !== node.children[index + 1].position.start.line ? printNextEmptyLine(childPath, options.originalText) : ""])]), "children")), ifBreak$b(",", "")])), isLastItemEmptyMappingItem ? "" : bracketSpacing, closeMarker]);
|
|
54262
54274
|
}
|
|
54263
54275
|
|
|
54264
54276
|
case "flowSequenceItem":
|
|
@@ -54418,6 +54430,10 @@ function needsSpaceInFrontOfMappingValue(node) {
|
|
|
54418
54430
|
return node.key.content && node.key.content.type === "alias";
|
|
54419
54431
|
}
|
|
54420
54432
|
|
|
54433
|
+
function shouldPrintEndComments(node) {
|
|
54434
|
+
return hasEndComments$1(node) && !isNode$1(node, ["documentHead", "documentBody"]);
|
|
54435
|
+
}
|
|
54436
|
+
|
|
54421
54437
|
function printNextEmptyLine(path, originalText) {
|
|
54422
54438
|
const node = path.getValue();
|
|
54423
54439
|
const root = path.stack[0];
|
|
@@ -54426,7 +54442,10 @@ function printNextEmptyLine(path, originalText) {
|
|
|
54426
54442
|
if (!root.isNextEmptyLinePrintedChecklist[node.position.end.line]) {
|
|
54427
54443
|
if (isNextLineEmpty$8(node, originalText)) {
|
|
54428
54444
|
root.isNextEmptyLinePrintedChecklist[node.position.end.line] = true;
|
|
54429
|
-
|
|
54445
|
+
|
|
54446
|
+
if (!shouldPrintEndComments(path.getParentNode())) {
|
|
54447
|
+
return softline$c;
|
|
54448
|
+
}
|
|
54430
54449
|
}
|
|
54431
54450
|
}
|
|
54432
54451
|
|