prettier 1.15.2 → 1.15.3
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/README.md +2 -2
- package/bin-prettier.js +410 -241
- package/index.js +405 -238
- package/package.json +1 -1
- package/parser-babylon.js +1 -1
- package/parser-html.js +1 -1
- package/parser-markdown.js +1 -1
- package/parser-postcss.js +2978 -3390
- package/parser-typescript.js +1 -1
- package/standalone.js +373 -237
- package/third-party.js +150 -17
package/index.js
CHANGED
|
@@ -12,7 +12,7 @@ var thirdParty = require('./third-party');
|
|
|
12
12
|
var thirdParty__default = thirdParty['default'];
|
|
13
13
|
|
|
14
14
|
var name = "prettier";
|
|
15
|
-
var version$1 = "1.15.
|
|
15
|
+
var version$1 = "1.15.3";
|
|
16
16
|
var description = "Prettier is an opinionated code formatter";
|
|
17
17
|
var bin = {
|
|
18
18
|
"prettier": "./bin/prettier.js"
|
|
@@ -28,20 +28,20 @@ var engines = {
|
|
|
28
28
|
var dependencies = {
|
|
29
29
|
"@angular/compiler": "6.1.10",
|
|
30
30
|
"@babel/code-frame": "7.0.0-beta.46",
|
|
31
|
-
"@babel/parser": "7.1.
|
|
31
|
+
"@babel/parser": "7.1.6",
|
|
32
32
|
"@glimmer/syntax": "0.30.3",
|
|
33
33
|
"@iarna/toml": "2.0.0",
|
|
34
34
|
"angular-estree-parser": "1.1.5",
|
|
35
|
-
"angular-html-parser": "1.
|
|
35
|
+
"angular-html-parser": "1.1.0",
|
|
36
36
|
"camelcase": "4.1.0",
|
|
37
37
|
"chalk": "2.1.0",
|
|
38
38
|
"cjk-regex": "2.0.0",
|
|
39
|
-
"cosmiconfig": "5.0.
|
|
39
|
+
"cosmiconfig": "5.0.7",
|
|
40
40
|
"dashify": "0.2.2",
|
|
41
41
|
"dedent": "0.7.0",
|
|
42
42
|
"diff": "3.2.0",
|
|
43
43
|
"editorconfig": "0.15.2",
|
|
44
|
-
"editorconfig-to-prettier": "0.1.
|
|
44
|
+
"editorconfig-to-prettier": "0.1.1",
|
|
45
45
|
"emoji-regex": "6.5.1",
|
|
46
46
|
"escape-string-regexp": "1.0.5",
|
|
47
47
|
"esutils": "2.0.2",
|
|
@@ -69,7 +69,7 @@ var dependencies = {
|
|
|
69
69
|
"parse-srcset": "ikatyang/parse-srcset#54eb9c1cb21db5c62b4d0e275d7249516df6f0ee",
|
|
70
70
|
"postcss-less": "1.1.5",
|
|
71
71
|
"postcss-media-query-parser": "0.2.3",
|
|
72
|
-
"postcss-scss": "
|
|
72
|
+
"postcss-scss": "2.0.0",
|
|
73
73
|
"postcss-selector-parser": "2.2.3",
|
|
74
74
|
"postcss-values-parser": "1.5.0",
|
|
75
75
|
"regexp-util": "1.2.2",
|
|
@@ -78,8 +78,8 @@ var dependencies = {
|
|
|
78
78
|
"resolve": "1.5.0",
|
|
79
79
|
"semver": "5.4.1",
|
|
80
80
|
"string-width": "2.1.1",
|
|
81
|
-
"typescript": "3.
|
|
82
|
-
"typescript-estree": "
|
|
81
|
+
"typescript": "3.2.1",
|
|
82
|
+
"typescript-estree": "6.0.0-rc.1",
|
|
83
83
|
"unicode-regex": "2.0.0",
|
|
84
84
|
"unified": "6.1.6",
|
|
85
85
|
"vnopts": "1.0.2",
|
|
@@ -108,7 +108,7 @@ var devDependencies = {
|
|
|
108
108
|
"jest-snapshot-serializer-raw": "1.1.0",
|
|
109
109
|
"jest-watch-typeahead": "0.1.0",
|
|
110
110
|
"mkdirp": "0.5.1",
|
|
111
|
-
"prettier": "1.15.
|
|
111
|
+
"prettier": "1.15.2",
|
|
112
112
|
"prettylint": "1.0.0",
|
|
113
113
|
"rimraf": "2.6.2",
|
|
114
114
|
"rollup": "0.47.6",
|
|
@@ -141,6 +141,7 @@ var scripts = {
|
|
|
141
141
|
"perf-benchmark": "yarn && yarn build && cross-env NODE_ENV=production node ./dist/bin-prettier.js --debug-benchmark --loglevel debug ${PERF_FILE:-./index.js} > /dev/null",
|
|
142
142
|
"lint": "cross-env EFF_NO_LINK_RULES=true eslint . --format node_modules/eslint-friendly-formatter",
|
|
143
143
|
"lint-docs": "prettylint {.,docs,website,website/blog}/*.md",
|
|
144
|
+
"lint-dist": "eslint --no-eslintrc --no-ignore --env=browser \"dist/!(bin-prettier|index|third-party).js\"",
|
|
144
145
|
"build": "node --max-old-space-size=2048 ./scripts/build/build.js",
|
|
145
146
|
"build-docs": "node ./scripts/build-docs.js",
|
|
146
147
|
"check-deps": "node ./scripts/check-deps.js"
|
|
@@ -6160,7 +6161,7 @@ function supportsColor(stream) {
|
|
|
6160
6161
|
return 2;
|
|
6161
6162
|
}
|
|
6162
6163
|
|
|
6163
|
-
if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
6164
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
6164
6165
|
return 1;
|
|
6165
6166
|
}
|
|
6166
6167
|
|
|
@@ -9608,7 +9609,7 @@ function supportsColor$4(stream) {
|
|
|
9608
9609
|
return 2;
|
|
9609
9610
|
}
|
|
9610
9611
|
|
|
9611
|
-
if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env$1.TERM)) {
|
|
9612
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$1.TERM)) {
|
|
9612
9613
|
return 1;
|
|
9613
9614
|
}
|
|
9614
9615
|
|
|
@@ -14451,7 +14452,7 @@ var createIgnorer_1 = createIgnorer;
|
|
|
14451
14452
|
|
|
14452
14453
|
function getFileInfo(filePath, opts) {
|
|
14453
14454
|
return createIgnorer_1(opts.ignorePath, opts.withNodeModules).then(function (ignorer) {
|
|
14454
|
-
return _getFileInfo(ignorer, filePath, opts.plugins);
|
|
14455
|
+
return _getFileInfo(ignorer, normalizeFilePath(filePath, opts.ignorePath), opts.plugins);
|
|
14455
14456
|
});
|
|
14456
14457
|
}
|
|
14457
14458
|
/**
|
|
@@ -14463,7 +14464,7 @@ function getFileInfo(filePath, opts) {
|
|
|
14463
14464
|
|
|
14464
14465
|
getFileInfo.sync = function (filePath, opts) {
|
|
14465
14466
|
var ignorer = createIgnorer_1.sync(opts.ignorePath, opts.withNodeModules);
|
|
14466
|
-
return _getFileInfo(ignorer, filePath, opts.plugins);
|
|
14467
|
+
return _getFileInfo(ignorer, normalizeFilePath(filePath, opts.ignorePath), opts.plugins);
|
|
14467
14468
|
};
|
|
14468
14469
|
|
|
14469
14470
|
function _getFileInfo(ignorer, filePath, plugins) {
|
|
@@ -14475,6 +14476,10 @@ function _getFileInfo(ignorer, filePath, plugins) {
|
|
|
14475
14476
|
};
|
|
14476
14477
|
}
|
|
14477
14478
|
|
|
14479
|
+
function normalizeFilePath(filePath, ignorePath) {
|
|
14480
|
+
return ignorePath ? path.relative(path.dirname(ignorePath), filePath) : filePath;
|
|
14481
|
+
}
|
|
14482
|
+
|
|
14478
14483
|
var getFileInfo_1 = getFileInfo;
|
|
14479
14484
|
|
|
14480
14485
|
var lodash_uniqby = createCommonjsModule(function (module, exports) {
|
|
@@ -21695,9 +21700,9 @@ function isHtml(path$$1) {
|
|
|
21695
21700
|
|
|
21696
21701
|
function printHtmlTemplateLiteral(path$$1, print, textToDoc, parser) {
|
|
21697
21702
|
var node = path$$1.getValue();
|
|
21698
|
-
var placeholderPattern = "
|
|
21703
|
+
var placeholderPattern = "PRETTIER_HTML_PLACEHOLDER_(\\d+)_IN_JS";
|
|
21699
21704
|
var placeholders = node.expressions.map(function (_, i) {
|
|
21700
|
-
return `
|
|
21705
|
+
return `PRETTIER_HTML_PLACEHOLDER_${i}_IN_JS`;
|
|
21701
21706
|
});
|
|
21702
21707
|
var text = node.quasis.map(function (quasi, index, quasis) {
|
|
21703
21708
|
return index === quasis.length - 1 ? quasi.value.raw : quasi.value.raw + placeholders[index];
|
|
@@ -22808,6 +22813,7 @@ function needsParens(path$$1, options) {
|
|
|
22808
22813
|
return true;
|
|
22809
22814
|
|
|
22810
22815
|
case "MemberExpression":
|
|
22816
|
+
case "OptionalMemberExpression":
|
|
22811
22817
|
return name === "object" && parent.object === node;
|
|
22812
22818
|
|
|
22813
22819
|
case "AssignmentExpression":
|
|
@@ -23157,9 +23163,31 @@ function printHtmlBinding$1(path$$1, options, print) {
|
|
|
23157
23163
|
return join$4(concat$6([",", line$4]), functionDeclarationPath.map(print, "params"));
|
|
23158
23164
|
}, "program", "body", 0);
|
|
23159
23165
|
}
|
|
23166
|
+
} // based on https://github.com/prettier/prettier/blob/master/src/language-html/syntax-vue.js isVueEventBindingExpression()
|
|
23167
|
+
|
|
23168
|
+
|
|
23169
|
+
function isVueEventBindingExpression$1(node) {
|
|
23170
|
+
switch (node.type) {
|
|
23171
|
+
case "MemberExpression":
|
|
23172
|
+
switch (node.property.type) {
|
|
23173
|
+
case "Identifier":
|
|
23174
|
+
case "NumericLiteral":
|
|
23175
|
+
case "StringLiteral":
|
|
23176
|
+
return isVueEventBindingExpression$1(node.object);
|
|
23177
|
+
}
|
|
23178
|
+
|
|
23179
|
+
return false;
|
|
23180
|
+
|
|
23181
|
+
case "Identifier":
|
|
23182
|
+
return true;
|
|
23183
|
+
|
|
23184
|
+
default:
|
|
23185
|
+
return false;
|
|
23186
|
+
}
|
|
23160
23187
|
}
|
|
23161
23188
|
|
|
23162
23189
|
var htmlBinding = {
|
|
23190
|
+
isVueEventBindingExpression: isVueEventBindingExpression$1,
|
|
23163
23191
|
printHtmlBinding: printHtmlBinding$1
|
|
23164
23192
|
};
|
|
23165
23193
|
|
|
@@ -23207,6 +23235,7 @@ var getNextNonSpaceNonCommentCharacterIndex$2 = utilShared.getNextNonSpaceNonCom
|
|
|
23207
23235
|
var isIdentifierName = utils$2.keyword.isIdentifierNameES5;
|
|
23208
23236
|
var insertPragma = pragma.insertPragma;
|
|
23209
23237
|
var printHtmlBinding = htmlBinding.printHtmlBinding;
|
|
23238
|
+
var isVueEventBindingExpression = htmlBinding.isVueEventBindingExpression;
|
|
23210
23239
|
var hasNode = utils$4.hasNode;
|
|
23211
23240
|
var hasFlowAnnotationComment = utils$4.hasFlowAnnotationComment;
|
|
23212
23241
|
var hasFlowShorthandAnnotationComment = utils$4.hasFlowShorthandAnnotationComment;
|
|
@@ -23271,7 +23300,7 @@ function genericPrint(path$$1, options, printPath, args) {
|
|
|
23271
23300
|
var parentExportDecl = getParentExportDeclaration$1(path$$1);
|
|
23272
23301
|
var decorators = [];
|
|
23273
23302
|
|
|
23274
|
-
if (node.type === "ClassMethod" || node.type === "ClassProperty" || node.type === "TSAbstractClassProperty" || node.type === "ClassPrivateProperty") {// their decorators are handled themselves
|
|
23303
|
+
if (node.type === "ClassMethod" || node.type === "ClassProperty" || node.type === "TSAbstractClassProperty" || node.type === "ClassPrivateProperty" || node.type === "MethodDefinition" || node.type === "TSAbstractMethodDefinition") {// their decorators are handled themselves
|
|
23275
23304
|
} else if (node.decorators && node.decorators.length > 0 && // If the parent node is an export declaration and the decorator
|
|
23276
23305
|
// was written before the export, the export will be responsible
|
|
23277
23306
|
// for printing the decorators.
|
|
@@ -23565,6 +23594,14 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
23565
23594
|
// Detect Flow-parsed directives
|
|
23566
23595
|
if (n.directive) {
|
|
23567
23596
|
return concat$4([nodeStr(n.expression, options, true), semi]);
|
|
23597
|
+
}
|
|
23598
|
+
|
|
23599
|
+
if (options.parser === "__vue_event_binding") {
|
|
23600
|
+
var parent = path$$1.getParentNode();
|
|
23601
|
+
|
|
23602
|
+
if (parent.type === "Program" && parent.body.length === 1 && parent.body[0] === n) {
|
|
23603
|
+
return concat$4([path$$1.call(print, "expression"), isVueEventBindingExpression(n.expression) ? ";" : ""]);
|
|
23604
|
+
}
|
|
23568
23605
|
} // Do not append semicolon after the only JSX element in a program
|
|
23569
23606
|
|
|
23570
23607
|
|
|
@@ -23581,9 +23618,10 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
23581
23618
|
case "LogicalExpression":
|
|
23582
23619
|
case "NGPipeExpression":
|
|
23583
23620
|
{
|
|
23584
|
-
var
|
|
23621
|
+
var _parent = path$$1.getParentNode();
|
|
23622
|
+
|
|
23585
23623
|
var parentParent = path$$1.getParentNode(1);
|
|
23586
|
-
var isInsideParenthesis = n !==
|
|
23624
|
+
var isInsideParenthesis = n !== _parent.body && (_parent.type === "IfStatement" || _parent.type === "WhileStatement" || _parent.type === "DoWhileStatement");
|
|
23587
23625
|
|
|
23588
23626
|
var _parts = printBinaryishExpressions(path$$1, print, options,
|
|
23589
23627
|
/* isNested */
|
|
@@ -23610,14 +23648,14 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
23610
23648
|
// ).call()
|
|
23611
23649
|
|
|
23612
23650
|
|
|
23613
|
-
if (
|
|
23651
|
+
if (_parent.type === "UnaryExpression" || (_parent.type === "MemberExpression" || _parent.type === "OptionalMemberExpression") && !_parent.computed) {
|
|
23614
23652
|
return group$1(concat$4([indent$2(concat$4([softline$1, concat$4(_parts)])), softline$1]));
|
|
23615
23653
|
} // Avoid indenting sub-expressions in some cases where the first sub-expression is already
|
|
23616
23654
|
// indented accordingly. We should indent sub-expressions where the first case isn't indented.
|
|
23617
23655
|
|
|
23618
23656
|
|
|
23619
|
-
var shouldNotIndent =
|
|
23620
|
-
var shouldIndentIfInlining =
|
|
23657
|
+
var shouldNotIndent = _parent.type === "ReturnStatement" || _parent.type === "JSXExpressionContainer" && parentParent.type === "JSXAttribute" || n.type !== "NGPipeExpression" && (_parent.type === "NGRoot" && options.parser === "__ng_binding" || _parent.type === "NGMicrosyntaxExpression" && parentParent.type === "NGMicrosyntax" && parentParent.body.length === 1) || n === _parent.body && _parent.type === "ArrowFunctionExpression" || n !== _parent.body && _parent.type === "ForStatement" || _parent.type === "ConditionalExpression" && parentParent.type !== "ReturnStatement" && parentParent.type !== "CallExpression";
|
|
23658
|
+
var shouldIndentIfInlining = _parent.type === "AssignmentExpression" || _parent.type === "VariableDeclarator" || _parent.type === "ClassProperty" || _parent.type === "TSAbstractClassProperty" || _parent.type === "ClassPrivateProperty" || _parent.type === "ObjectProperty" || _parent.type === "Property";
|
|
23621
23659
|
var samePrecedenceSubExpression = isBinaryish(n.left) && shouldFlatten$1(n.operator, n.left.operator);
|
|
23622
23660
|
|
|
23623
23661
|
if (shouldNotIndent || shouldInlineLogicalExpression(n) && !samePrecedenceSubExpression || !shouldInlineLogicalExpression(n) && shouldIndentIfInlining) {
|
|
@@ -23677,7 +23715,7 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
23677
23715
|
case "OptionalMemberExpression":
|
|
23678
23716
|
case "MemberExpression":
|
|
23679
23717
|
{
|
|
23680
|
-
var
|
|
23718
|
+
var _parent2 = path$$1.getParentNode();
|
|
23681
23719
|
|
|
23682
23720
|
var firstNonMemberParent;
|
|
23683
23721
|
var i = 0;
|
|
@@ -23687,7 +23725,7 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
23687
23725
|
i++;
|
|
23688
23726
|
} while (firstNonMemberParent && (firstNonMemberParent.type === "MemberExpression" || firstNonMemberParent.type === "OptionalMemberExpression" || firstNonMemberParent.type === "TSNonNullExpression"));
|
|
23689
23727
|
|
|
23690
|
-
var 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" &&
|
|
23728
|
+
var 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" && _parent2.type !== "MemberExpression" && _parent2.type !== "OptionalMemberExpression";
|
|
23691
23729
|
return concat$4([path$$1.call(print, "object"), shouldInline ? printMemberLookup(path$$1, options, print) : group$1(indent$2(concat$4([softline$1, printMemberLookup(path$$1, options, print)])))]);
|
|
23692
23730
|
}
|
|
23693
23731
|
|
|
@@ -23790,6 +23828,10 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
23790
23828
|
|
|
23791
23829
|
case "MethodDefinition":
|
|
23792
23830
|
case "TSAbstractMethodDefinition":
|
|
23831
|
+
if (n.decorators && n.decorators.length !== 0) {
|
|
23832
|
+
parts.push(printDecorators(path$$1, options, print));
|
|
23833
|
+
}
|
|
23834
|
+
|
|
23793
23835
|
if (n.accessibility) {
|
|
23794
23836
|
parts.push(n.accessibility + " ");
|
|
23795
23837
|
}
|
|
@@ -23933,6 +23975,7 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
23933
23975
|
case "Import":
|
|
23934
23976
|
return "import";
|
|
23935
23977
|
|
|
23978
|
+
case "TSModuleBlock":
|
|
23936
23979
|
case "BlockStatement":
|
|
23937
23980
|
{
|
|
23938
23981
|
var naked = path$$1.call(function (bodyPath) {
|
|
@@ -23943,11 +23986,11 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
23943
23986
|
});
|
|
23944
23987
|
var hasDirectives = n.directives && n.directives.length > 0;
|
|
23945
23988
|
|
|
23946
|
-
var
|
|
23989
|
+
var _parent3 = path$$1.getParentNode();
|
|
23947
23990
|
|
|
23948
23991
|
var _parentParent = path$$1.getParentNode(1);
|
|
23949
23992
|
|
|
23950
|
-
if (!hasContent && !hasDirectives && !hasDanglingComments(n) && (
|
|
23993
|
+
if (!hasContent && !hasDirectives && !hasDanglingComments(n) && (_parent3.type === "ArrowFunctionExpression" || _parent3.type === "FunctionExpression" || _parent3.type === "FunctionDeclaration" || _parent3.type === "ObjectMethod" || _parent3.type === "ClassMethod" || _parent3.type === "ForStatement" || _parent3.type === "WhileStatement" || _parent3.type === "DoWhileStatement" || _parent3.type === "DoExpression" || _parent3.type === "CatchClause" && !_parentParent.finalizer || _parent3.type === "TSModuleDeclaration")) {
|
|
23951
23994
|
return "{}";
|
|
23952
23995
|
}
|
|
23953
23996
|
|
|
@@ -24079,10 +24122,10 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
24079
24122
|
return options.locStart(a) - options.locStart(b);
|
|
24080
24123
|
})[0];
|
|
24081
24124
|
|
|
24082
|
-
var
|
|
24125
|
+
var _parent4 = path$$1.getParentNode(0);
|
|
24083
24126
|
|
|
24084
|
-
var isFlowInterfaceLikeBody = isTypeAnnotation &&
|
|
24085
|
-
var shouldBreak = n.type === "TSInterfaceBody" || isFlowInterfaceLikeBody || n.type === "ObjectPattern" &&
|
|
24127
|
+
var isFlowInterfaceLikeBody = isTypeAnnotation && _parent4 && (_parent4.type === "InterfaceDeclaration" || _parent4.type === "DeclareInterface" || _parent4.type === "DeclareClass") && path$$1.getName() === "body";
|
|
24128
|
+
var shouldBreak = n.type === "TSInterfaceBody" || isFlowInterfaceLikeBody || n.type === "ObjectPattern" && _parent4.type !== "FunctionDeclaration" && _parent4.type !== "FunctionExpression" && _parent4.type !== "ArrowFunctionExpression" && _parent4.type !== "AssignmentPattern" && _parent4.type !== "CatchClause" && n.properties.some(function (property) {
|
|
24086
24129
|
return property.value && (property.value.type === "ObjectPattern" || property.value.type === "ArrayPattern");
|
|
24087
24130
|
}) || n.type !== "ObjectPattern" && firstProperty && hasNewlineInRange$1(options.originalText, options.locStart(n), options.locStart(firstProperty));
|
|
24088
24131
|
var separator = isFlowInterfaceLikeBody ? ";" : n.type === "TSInterfaceBody" || n.type === "TSTypeLiteral" ? ifBreak$1(semi, ";") : ",";
|
|
@@ -24109,7 +24152,7 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
24109
24152
|
var result = concat$4(separatorParts.concat(group$1(prop.printed)));
|
|
24110
24153
|
separatorParts = [separator, line$3];
|
|
24111
24154
|
|
|
24112
|
-
if ((prop.node.type === "TSPropertySignature" || prop.node.type === "TSMethodSignature") && hasNodeIgnoreComment$1(prop.node)) {
|
|
24155
|
+
if ((prop.node.type === "TSPropertySignature" || prop.node.type === "TSMethodSignature" || prop.node.type === "TSConstructSignature") && hasNodeIgnoreComment$1(prop.node)) {
|
|
24113
24156
|
separatorParts.shift();
|
|
24114
24157
|
}
|
|
24115
24158
|
|
|
@@ -24143,7 +24186,7 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
24143
24186
|
|
|
24144
24187
|
var parentParentParent = path$$1.getParentNode(2);
|
|
24145
24188
|
|
|
24146
|
-
if (n.type === "ObjectPattern" &&
|
|
24189
|
+
if (n.type === "ObjectPattern" && _parent4 && shouldHugArguments(_parent4) && _parent4.params[0] === n || shouldHugType(n) && parentParentParent && shouldHugArguments(parentParentParent) && parentParentParent.params[0].typeAnnotation && parentParentParent.params[0].typeAnnotation.typeAnnotation === n) {
|
|
24147
24190
|
return content;
|
|
24148
24191
|
}
|
|
24149
24192
|
|
|
@@ -24229,9 +24272,9 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
24229
24272
|
|
|
24230
24273
|
case "SequenceExpression":
|
|
24231
24274
|
{
|
|
24232
|
-
var
|
|
24275
|
+
var _parent5 = path$$1.getParentNode(0);
|
|
24233
24276
|
|
|
24234
|
-
if (
|
|
24277
|
+
if (_parent5.type === "ExpressionStatement" || _parent5.type === "ForStatement") {
|
|
24235
24278
|
// For ExpressionStatements and for-loop heads, which are among
|
|
24236
24279
|
// the few places a SequenceExpression appears unparenthesized, we want
|
|
24237
24280
|
// to indent expressions after the first.
|
|
@@ -24268,7 +24311,8 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
24268
24311
|
return printNumber$1(n.extra.raw);
|
|
24269
24312
|
|
|
24270
24313
|
case "BigIntLiteral":
|
|
24271
|
-
return concat$4([printNumber$1(n.extra.rawValue
|
|
24314
|
+
return concat$4([printNumber$1(n.extra ? n.extra.rawValue : // TypeScript
|
|
24315
|
+
n.value), "n"]);
|
|
24272
24316
|
|
|
24273
24317
|
case "BooleanLiteral": // Babel 6 Literal split
|
|
24274
24318
|
|
|
@@ -24590,11 +24634,11 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
24590
24634
|
|
|
24591
24635
|
case "JSXExpressionContainer":
|
|
24592
24636
|
{
|
|
24593
|
-
var
|
|
24637
|
+
var _parent6 = path$$1.getParentNode(0);
|
|
24594
24638
|
|
|
24595
|
-
var preventInline =
|
|
24639
|
+
var preventInline = _parent6.type === "JSXAttribute" && n.expression.comments && n.expression.comments.length > 0;
|
|
24596
24640
|
|
|
24597
|
-
var _shouldInline = !preventInline && (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 === "JSXEmptyExpression" || n.expression.type === "TemplateLiteral" || n.expression.type === "TaggedTemplateExpression" || n.expression.type === "DoExpression" || isJSXNode(
|
|
24641
|
+
var _shouldInline = !preventInline && (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 === "JSXEmptyExpression" || n.expression.type === "TemplateLiteral" || n.expression.type === "TaggedTemplateExpression" || n.expression.type === "DoExpression" || isJSXNode(_parent6) && (n.expression.type === "ConditionalExpression" || isBinaryish(n.expression)));
|
|
24598
24642
|
|
|
24599
24643
|
if (_shouldInline) {
|
|
24600
24644
|
return group$1(concat$4(["{", path$$1.call(print, "expression"), lineSuffixBoundary$1, "}"]));
|
|
@@ -24604,7 +24648,6 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
24604
24648
|
}
|
|
24605
24649
|
|
|
24606
24650
|
case "JSXFragment":
|
|
24607
|
-
case "TSJsxFragment":
|
|
24608
24651
|
case "JSXElement":
|
|
24609
24652
|
{
|
|
24610
24653
|
var elem = comments.printComments(path$$1, function () {
|
|
@@ -24666,12 +24709,10 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
24666
24709
|
|
|
24667
24710
|
case "JSXOpeningFragment":
|
|
24668
24711
|
case "JSXClosingFragment":
|
|
24669
|
-
case "TSJsxOpeningFragment":
|
|
24670
|
-
case "TSJsxClosingFragment":
|
|
24671
24712
|
{
|
|
24672
24713
|
var hasComment = n.comments && n.comments.length;
|
|
24673
24714
|
var hasOwnLineComment = hasComment && !n.comments.every(comments$3.isBlockComment);
|
|
24674
|
-
var isOpeningFragment = n.type === "JSXOpeningFragment"
|
|
24715
|
+
var isOpeningFragment = n.type === "JSXOpeningFragment";
|
|
24675
24716
|
return concat$4([isOpeningFragment ? "<" : "</", indent$2(concat$4([hasOwnLineComment ? hardline$3 : hasComment && !isOpeningFragment ? " " : "", comments.printDanglingComments(path$$1, options, true)])), hasOwnLineComment ? hardline$3 : "", ">"]);
|
|
24676
24717
|
}
|
|
24677
24718
|
|
|
@@ -25004,20 +25045,20 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25004
25045
|
// FunctionTypeAnnotation is ambiguous:
|
|
25005
25046
|
// declare function foo(a: B): void; OR
|
|
25006
25047
|
// var A: (a: B) => void;
|
|
25007
|
-
var
|
|
25048
|
+
var _parent7 = path$$1.getParentNode(0);
|
|
25008
25049
|
|
|
25009
25050
|
var _parentParent2 = path$$1.getParentNode(1);
|
|
25010
25051
|
|
|
25011
25052
|
var _parentParentParent = path$$1.getParentNode(2);
|
|
25012
25053
|
|
|
25013
|
-
var isArrowFunctionTypeAnnotation = n.type === "TSFunctionType" || !((
|
|
25014
|
-
var needsColon = isArrowFunctionTypeAnnotation && (
|
|
25054
|
+
var isArrowFunctionTypeAnnotation = n.type === "TSFunctionType" || !((_parent7.type === "ObjectTypeProperty" || _parent7.type === "ObjectTypeInternalSlot") && !getFlowVariance(_parent7) && !_parent7.optional && options.locStart(_parent7) === options.locStart(n) || _parent7.type === "ObjectTypeCallProperty" || _parentParentParent && _parentParentParent.type === "DeclareFunction");
|
|
25055
|
+
var needsColon = isArrowFunctionTypeAnnotation && (_parent7.type === "TypeAnnotation" || _parent7.type === "TSTypeAnnotation"); // Sadly we can't put it inside of FastPath::needsColon because we are
|
|
25015
25056
|
// printing ":" as part of the expression and it would put parenthesis
|
|
25016
25057
|
// around :(
|
|
25017
25058
|
|
|
25018
|
-
var needsParens = needsColon && isArrowFunctionTypeAnnotation && (
|
|
25059
|
+
var needsParens = needsColon && isArrowFunctionTypeAnnotation && (_parent7.type === "TypeAnnotation" || _parent7.type === "TSTypeAnnotation") && _parentParent2.type === "ArrowFunctionExpression";
|
|
25019
25060
|
|
|
25020
|
-
if (isObjectTypePropertyAFunction(
|
|
25061
|
+
if (isObjectTypePropertyAFunction(_parent7, options)) {
|
|
25021
25062
|
isArrowFunctionTypeAnnotation = true;
|
|
25022
25063
|
needsColon = true;
|
|
25023
25064
|
}
|
|
@@ -25120,12 +25161,12 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25120
25161
|
// | A
|
|
25121
25162
|
// | B
|
|
25122
25163
|
// | C
|
|
25123
|
-
var
|
|
25164
|
+
var _parent8 = path$$1.getParentNode();
|
|
25124
25165
|
|
|
25125
25166
|
var _parentParent3 = path$$1.getParentNode(1); // If there's a leading comment, the parent is doing the indentation
|
|
25126
25167
|
|
|
25127
25168
|
|
|
25128
|
-
var shouldIndent =
|
|
25169
|
+
var shouldIndent = _parent8.type !== "TypeParameterInstantiation" && _parent8.type !== "TSTypeParameterInstantiation" && _parent8.type !== "GenericTypeAnnotation" && _parent8.type !== "TSTypeReference" && !(_parent8.type === "FunctionTypeParam" && !_parent8.name) && _parentParent3.type !== "TSTypeAssertionExpression" && !((_parent8.type === "TypeAlias" || _parent8.type === "VariableDeclarator") && hasLeadingOwnLineComment(options.originalText, n, options)); // {
|
|
25129
25170
|
// a: string
|
|
25130
25171
|
// } | null | void
|
|
25131
25172
|
// should be inlined and not be printed in the multi-line variant
|
|
@@ -25151,7 +25192,8 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25151
25192
|
return join$2(" | ", _printed2);
|
|
25152
25193
|
}
|
|
25153
25194
|
|
|
25154
|
-
var
|
|
25195
|
+
var shouldAddStartLine = shouldIndent && !hasLeadingOwnLineComment(options.originalText, n, options);
|
|
25196
|
+
var code = concat$4([ifBreak$1(concat$4([shouldAddStartLine ? line$3 : "", "| "])), join$2(concat$4([line$3, "| "]), _printed2)]);
|
|
25155
25197
|
var hasParens;
|
|
25156
25198
|
|
|
25157
25199
|
if (n.type === "TSUnionType") {
|
|
@@ -25284,9 +25326,9 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25284
25326
|
case "TSTypeParameter":
|
|
25285
25327
|
case "TypeParameter":
|
|
25286
25328
|
{
|
|
25287
|
-
var
|
|
25329
|
+
var _parent9 = path$$1.getParentNode();
|
|
25288
25330
|
|
|
25289
|
-
if (
|
|
25331
|
+
if (_parent9.type === "TSMappedType") {
|
|
25290
25332
|
parts.push("[", path$$1.call(print, "name"));
|
|
25291
25333
|
|
|
25292
25334
|
if (n.constraint) {
|
|
@@ -25348,6 +25390,9 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25348
25390
|
case "TSBooleanKeyword":
|
|
25349
25391
|
return "boolean";
|
|
25350
25392
|
|
|
25393
|
+
case "TSBigIntKeyword":
|
|
25394
|
+
return "bigint";
|
|
25395
|
+
|
|
25351
25396
|
case "TSConstKeyword":
|
|
25352
25397
|
return "const";
|
|
25353
25398
|
|
|
@@ -25478,9 +25523,9 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25478
25523
|
|
|
25479
25524
|
case "TSIndexSignature":
|
|
25480
25525
|
{
|
|
25481
|
-
var
|
|
25526
|
+
var _parent10 = path$$1.getParentNode();
|
|
25482
25527
|
|
|
25483
|
-
return concat$4([n.export ? "export " : "", n.accessibility ? concat$4([n.accessibility, " "]) : "", n.static ? "static " : "", n.readonly ? "readonly " : "", "[", path$$1.call(print, "index"), "]: ", path$$1.call(print, "typeAnnotation"),
|
|
25528
|
+
return concat$4([n.export ? "export " : "", n.accessibility ? concat$4([n.accessibility, " "]) : "", n.static ? "static " : "", n.readonly ? "readonly " : "", "[", path$$1.call(print, "index"), "]: ", path$$1.call(print, "typeAnnotation"), _parent10.type === "ClassBody" ? semi : ""]);
|
|
25484
25529
|
}
|
|
25485
25530
|
|
|
25486
25531
|
case "TSTypePredicate":
|
|
@@ -25601,10 +25646,10 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25601
25646
|
|
|
25602
25647
|
case "TSModuleDeclaration":
|
|
25603
25648
|
{
|
|
25604
|
-
var
|
|
25649
|
+
var _parent11 = path$$1.getParentNode();
|
|
25605
25650
|
|
|
25606
25651
|
var isExternalModule = isLiteral(n.id);
|
|
25607
|
-
var parentIsDeclaration =
|
|
25652
|
+
var parentIsDeclaration = _parent11.type === "TSModuleDeclaration";
|
|
25608
25653
|
var bodyIsDeclaration = n.body && n.body.type === "TSModuleDeclaration";
|
|
25609
25654
|
|
|
25610
25655
|
if (parentIsDeclaration) {
|
|
@@ -25621,7 +25666,7 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25621
25666
|
var isGlobalDeclaration = n.id.type === "Identifier" && n.id.name === "global" && !/namespace|module/.test(textBetweenNodeAndItsId);
|
|
25622
25667
|
|
|
25623
25668
|
if (!isGlobalDeclaration) {
|
|
25624
|
-
parts.push(isExternalModule ||
|
|
25669
|
+
parts.push(isExternalModule || /(^|\s)module(\s|$)/.test(textBetweenNodeAndItsId) ? "module " : "namespace ");
|
|
25625
25670
|
}
|
|
25626
25671
|
}
|
|
25627
25672
|
|
|
@@ -25630,9 +25675,7 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25630
25675
|
if (bodyIsDeclaration) {
|
|
25631
25676
|
parts.push(path$$1.call(print, "body"));
|
|
25632
25677
|
} else if (n.body) {
|
|
25633
|
-
parts.push("
|
|
25634
|
-
return comments.printDanglingComments(bodyPath, options, true);
|
|
25635
|
-
}, "body"), group$1(path$$1.call(print, "body"))])), line$3, "}");
|
|
25678
|
+
parts.push(" ", group$1(path$$1.call(print, "body")));
|
|
25636
25679
|
} else {
|
|
25637
25680
|
parts.push(semi);
|
|
25638
25681
|
}
|
|
@@ -25640,11 +25683,6 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25640
25683
|
return concat$4(parts);
|
|
25641
25684
|
}
|
|
25642
25685
|
|
|
25643
|
-
case "TSModuleBlock":
|
|
25644
|
-
return path$$1.call(function (bodyPath) {
|
|
25645
|
-
return printStatementSequence(bodyPath, options, print);
|
|
25646
|
-
}, "body");
|
|
25647
|
-
|
|
25648
25686
|
case "PrivateName":
|
|
25649
25687
|
return concat$4(["#", path$$1.call(print, "id")]);
|
|
25650
25688
|
|
|
@@ -25692,7 +25730,7 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25692
25730
|
|
|
25693
25731
|
case "NGMicrosyntax":
|
|
25694
25732
|
return concat$4(path$$1.map(function (childPath, index) {
|
|
25695
|
-
return concat$4([index === 0 ? "" : isNgForOf(childPath) ? " " : concat$4([";", line$3]), print(childPath)]);
|
|
25733
|
+
return concat$4([index === 0 ? "" : isNgForOf(childPath.getValue(), index, n) ? " " : concat$4([";", line$3]), print(childPath)]);
|
|
25696
25734
|
}, "body"));
|
|
25697
25735
|
|
|
25698
25736
|
case "NGMicrosyntaxKey":
|
|
@@ -25702,7 +25740,14 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25702
25740
|
return concat$4([path$$1.call(print, "expression"), n.alias === null ? "" : concat$4([" as ", path$$1.call(print, "alias")])]);
|
|
25703
25741
|
|
|
25704
25742
|
case "NGMicrosyntaxKeyedExpression":
|
|
25705
|
-
|
|
25743
|
+
{
|
|
25744
|
+
var index = path$$1.getName();
|
|
25745
|
+
|
|
25746
|
+
var _parentNode2 = path$$1.getParentNode();
|
|
25747
|
+
|
|
25748
|
+
var shouldNotPrintColon = isNgForOf(n, index, _parentNode2) || (index === 1 && (n.key.name === "then" || n.key.name === "else") || index === 2 && n.key.name === "else" && _parentNode2.body[index - 1].type === "NGMicrosyntaxKeyedExpression" && _parentNode2.body[index - 1].key.name === "then") && _parentNode2.body[0].type === "NGMicrosyntaxExpression";
|
|
25749
|
+
return concat$4([path$$1.call(print, "key"), shouldNotPrintColon ? " " : ": ", path$$1.call(print, "expression")]);
|
|
25750
|
+
}
|
|
25706
25751
|
|
|
25707
25752
|
case "NGMicrosyntaxLet":
|
|
25708
25753
|
return concat$4(["let ", path$$1.call(print, "key"), n.value === null ? "" : concat$4([" = ", path$$1.call(print, "value")])]);
|
|
@@ -25715,13 +25760,8 @@ function printPathNoParens(path$$1, options, print, args) {
|
|
|
25715
25760
|
throw new Error("unknown type: " + JSON.stringify(n.type));
|
|
25716
25761
|
}
|
|
25717
25762
|
}
|
|
25718
|
-
/** prefer `let hero of heros` over `let hero; of: heros` */
|
|
25719
|
-
|
|
25720
25763
|
|
|
25721
|
-
function isNgForOf(
|
|
25722
|
-
var node = path$$1.getValue();
|
|
25723
|
-
var index = path$$1.getName();
|
|
25724
|
-
var parentNode = path$$1.getParentNode();
|
|
25764
|
+
function isNgForOf(node, index, parentNode) {
|
|
25725
25765
|
return node.type === "NGMicrosyntaxKeyedExpression" && node.key.name === "of" && index === 1 && parentNode.body[0].type === "NGMicrosyntaxLet" && parentNode.body[0].value === null;
|
|
25726
25766
|
}
|
|
25727
25767
|
/** identify if an angular expression seems to have side effects */
|
|
@@ -26734,7 +26774,7 @@ function isCallOrOptionalCallExpression(node) {
|
|
|
26734
26774
|
}
|
|
26735
26775
|
|
|
26736
26776
|
function isJSXNode(node) {
|
|
26737
|
-
return node.type === "JSXElement" || node.type === "JSXFragment"
|
|
26777
|
+
return node.type === "JSXElement" || node.type === "JSXFragment";
|
|
26738
26778
|
}
|
|
26739
26779
|
|
|
26740
26780
|
function isEmptyJSXElement(node) {
|
|
@@ -27136,7 +27176,6 @@ function maybeWrapJSXElementInParens(path$$1, elem) {
|
|
|
27136
27176
|
JSXElement: true,
|
|
27137
27177
|
JSXExpressionContainer: true,
|
|
27138
27178
|
JSXFragment: true,
|
|
27139
|
-
TSJsxFragment: true,
|
|
27140
27179
|
ExpressionStatement: true,
|
|
27141
27180
|
CallExpression: true,
|
|
27142
27181
|
OptionalCallExpression: true,
|
|
@@ -30423,7 +30462,7 @@ var languageGraphql = {
|
|
|
30423
30462
|
printers: printers$3
|
|
30424
30463
|
};
|
|
30425
30464
|
|
|
30426
|
-
|
|
30465
|
+
var json$6 = {"cjkPattern":"[\\u02ea-\\u02eb\\u1100-\\u11ff\\u2e80-\\u2e99\\u2e9b-\\u2ef3\\u2f00-\\u2fd5\\u3000-\\u303f\\u3041-\\u3096\\u3099-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312e\\u3131-\\u318e\\u3190-\\u3191\\u3196-\\u31ba\\u31c0-\\u31e3\\u31f0-\\u321e\\u322a-\\u3247\\u3260-\\u327e\\u328a-\\u32b0\\u32c0-\\u32cb\\u32d0-\\u32fe\\u3300-\\u3370\\u337b-\\u337f\\u33e0-\\u33fe\\u3400-\\u4db5\\u4e00-\\u9fea\\ua960-\\ua97c\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufe10-\\ufe1f\\ufe30-\\ufe6f\\uff00-\\uffef]|[\\ud840-\\ud868\\ud86a-\\ud86c\\ud86f-\\ud872\\ud874-\\ud879][\\udc00-\\udfff]|\\ud82c[\\udc00-\\udd1e]|\\ud83c[\\ude00\\ude50-\\ude51]|\\ud869[\\udc00-\\uded6\\udf00-\\udfff]|\\ud86d[\\udc00-\\udf34\\udf40-\\udfff]|\\ud86e[\\udc00-\\udc1d\\udc20-\\udfff]|\\ud873[\\udc00-\\udea1\\udeb0-\\udfff]|\\ud87a[\\udc00-\\udfe0]|\\ud87e[\\udc00-\\ude1d]","kPattern":"[\\u1100-\\u11ff\\u3001-\\u3003\\u3008-\\u3011\\u3013-\\u301f\\u302e-\\u3030\\u3037\\u30fb\\u3131-\\u318e\\u3200-\\u321e\\u3260-\\u327e\\ua960-\\ua97c\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\ufe45-\\ufe46\\uff61-\\uff65\\uffa0-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc]","punctuationPattern":"[\\u0021-\\u002f\\u003a-\\u0040\\u005b-\\u0060\\u007b-\\u007e\\u00a1\\u00a7\\u00ab\\u00b6-\\u00b7\\u00bb\\u00bf\\u037e\\u0387\\u055a-\\u055f\\u0589-\\u058a\\u05be\\u05c0\\u05c3\\u05c6\\u05f3-\\u05f4\\u0609-\\u060a\\u060c-\\u060d\\u061b\\u061e-\\u061f\\u066a-\\u066d\\u06d4\\u0700-\\u070d\\u07f7-\\u07f9\\u0830-\\u083e\\u085e\\u0964-\\u0965\\u0970\\u09fd\\u0af0\\u0df4\\u0e4f\\u0e5a-\\u0e5b\\u0f04-\\u0f12\\u0f14\\u0f3a-\\u0f3d\\u0f85\\u0fd0-\\u0fd4\\u0fd9-\\u0fda\\u104a-\\u104f\\u10fb\\u1360-\\u1368\\u1400\\u166d-\\u166e\\u169b-\\u169c\\u16eb-\\u16ed\\u1735-\\u1736\\u17d4-\\u17d6\\u17d8-\\u17da\\u1800-\\u180a\\u1944-\\u1945\\u1a1e-\\u1a1f\\u1aa0-\\u1aa6\\u1aa8-\\u1aad\\u1b5a-\\u1b60\\u1bfc-\\u1bff\\u1c3b-\\u1c3f\\u1c7e-\\u1c7f\\u1cc0-\\u1cc7\\u1cd3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205e\\u207d-\\u207e\\u208d-\\u208e\\u2308-\\u230b\\u2329-\\u232a\\u2768-\\u2775\\u27c5-\\u27c6\\u27e6-\\u27ef\\u2983-\\u2998\\u29d8-\\u29db\\u29fc-\\u29fd\\u2cf9-\\u2cfc\\u2cfe-\\u2cff\\u2d70\\u2e00-\\u2e2e\\u2e30-\\u2e49\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301f\\u3030\\u303d\\u30a0\\u30fb\\ua4fe-\\ua4ff\\ua60d-\\ua60f\\ua673\\ua67e\\ua6f2-\\ua6f7\\ua874-\\ua877\\ua8ce-\\ua8cf\\ua8f8-\\ua8fa\\ua8fc\\ua92e-\\ua92f\\ua95f\\ua9c1-\\ua9cd\\ua9de-\\ua9df\\uaa5c-\\uaa5f\\uaade-\\uaadf\\uaaf0-\\uaaf1\\uabeb\\ufd3e-\\ufd3f\\ufe10-\\ufe19\\ufe30-\\ufe52\\ufe54-\\ufe61\\ufe63\\ufe68\\ufe6a-\\ufe6b\\uff01-\\uff03\\uff05-\\uff0a\\uff0c-\\uff0f\\uff1a-\\uff1b\\uff1f-\\uff20\\uff3b-\\uff3d\\uff3f\\uff5b\\uff5d\\uff5f-\\uff65]|\\ud800[\\udd00-\\udd02\\udf9f\\udfd0]|\\ud801[\\udd6f]|\\ud802[\\udc57\\udd1f\\udd3f\\ude50-\\ude58\\ude7f\\udef0-\\udef6\\udf39-\\udf3f\\udf99-\\udf9c]|\\ud804[\\udc47-\\udc4d\\udcbb-\\udcbc\\udcbe-\\udcc1\\udd40-\\udd43\\udd74-\\udd75\\uddc5-\\uddc9\\uddcd\\udddb\\udddd-\\udddf\\ude38-\\ude3d\\udea9]|\\ud805[\\udc4b-\\udc4f\\udc5b\\udc5d\\udcc6\\uddc1-\\uddd7\\ude41-\\ude43\\ude60-\\ude6c\\udf3c-\\udf3e]|\\ud806[\\ude3f-\\ude46\\ude9a-\\ude9c\\ude9e-\\udea2]|\\ud807[\\udc41-\\udc45\\udc70-\\udc71]|\\ud809[\\udc70-\\udc74]|\\ud81a[\\ude6e-\\ude6f\\udef5\\udf37-\\udf3b\\udf44]|\\ud82f[\\udc9f]|\\ud836[\\ude87-\\ude8b]|\\ud83a[\\udd5e-\\udd5f]"};
|
|
30427
30466
|
|
|
30428
30467
|
var cjkPattern = json$6.cjkPattern;
|
|
30429
30468
|
var kPattern = json$6.kPattern;
|
|
@@ -31199,11 +31238,9 @@ function genericPrint$4(path$$1, options, print) {
|
|
|
31199
31238
|
|
|
31200
31239
|
case "inlineMath":
|
|
31201
31240
|
{
|
|
31202
|
-
//
|
|
31203
|
-
//
|
|
31204
|
-
|
|
31205
|
-
|
|
31206
|
-
return concat$12([_style3, node.value, _style3]);
|
|
31241
|
+
// remark-math trims content but we don't want to remove whitespaces
|
|
31242
|
+
// since it's very possible that it's recognized as math accidentally
|
|
31243
|
+
return options.originalText.slice(options.locStart(node), options.locEnd(node));
|
|
31207
31244
|
}
|
|
31208
31245
|
|
|
31209
31246
|
case "tableRow": // handled in "table"
|
|
@@ -32016,7 +32053,7 @@ var htmlElementAttributes = Object.freeze({
|
|
|
32016
32053
|
default: index$13
|
|
32017
32054
|
});
|
|
32018
32055
|
|
|
32019
|
-
|
|
32056
|
+
var json$9 = {"CSS_DISPLAY_TAGS":{"area":"none","base":"none","basefont":"none","datalist":"none","head":"none","link":"none","meta":"none","noembed":"none","noframes":"none","param":"none","rp":"none","script":"none","source":"block","style":"none","template":"inline","track":"block","title":"none","html":"block","body":"block","address":"block","blockquote":"block","center":"block","div":"block","figure":"block","figcaption":"block","footer":"block","form":"block","header":"block","hr":"block","legend":"block","listing":"block","main":"block","p":"block","plaintext":"block","pre":"block","xmp":"block","slot":"contents","ruby":"ruby","rt":"ruby-text","article":"block","aside":"block","h1":"block","h2":"block","h3":"block","h4":"block","h5":"block","h6":"block","hgroup":"block","nav":"block","section":"block","dir":"block","dd":"block","dl":"block","dt":"block","ol":"block","ul":"block","li":"list-item","table":"table","caption":"table-caption","colgroup":"table-column-group","col":"table-column","thead":"table-header-group","tbody":"table-row-group","tfoot":"table-footer-group","tr":"table-row","td":"table-cell","th":"table-cell","fieldset":"block","button":"inline-block","video":"inline-block","audio":"inline-block"},"CSS_DISPLAY_DEFAULT":"inline","CSS_WHITE_SPACE_TAGS":{"listing":"pre","plaintext":"pre","pre":"pre","xmp":"pre","nobr":"nowrap","table":"initial","textarea":"pre-wrap"},"CSS_WHITE_SPACE_DEFAULT":"normal"};
|
|
32020
32057
|
|
|
32021
32058
|
var htmlElementAttributes$1 = ( htmlElementAttributes && index$13 ) || htmlElementAttributes;
|
|
32022
32059
|
|
|
@@ -32071,7 +32108,7 @@ function mapObject(object, fn) {
|
|
|
32071
32108
|
return newObject;
|
|
32072
32109
|
}
|
|
32073
32110
|
|
|
32074
|
-
function shouldPreserveContent$1(node) {
|
|
32111
|
+
function shouldPreserveContent$1(node, options) {
|
|
32075
32112
|
if (node.type === "element" && node.fullName === "template" && node.attrMap.lang && node.attrMap.lang !== "html") {
|
|
32076
32113
|
return true;
|
|
32077
32114
|
} // unterminated node in ie conditional comment
|
|
@@ -32086,10 +32123,17 @@ function shouldPreserveContent$1(node) {
|
|
|
32086
32123
|
|
|
32087
32124
|
if (node.type === "ieConditionalComment" && !node.complete) {
|
|
32088
32125
|
return true;
|
|
32126
|
+
} // top-level elements (excluding <template>, <style> and <script>) in Vue SFC are considered custom block
|
|
32127
|
+
// custom blocks can be written in other languages so we should preserve them to not break the code
|
|
32128
|
+
|
|
32129
|
+
|
|
32130
|
+
if (options.parser === "vue" && node.type === "element" && node.parent.type === "root" && ["template", "style", "script", // vue parser can be used for vue dom template as well, so we should still format top-level <html>
|
|
32131
|
+
"html"].indexOf(node.fullName) === -1) {
|
|
32132
|
+
return true;
|
|
32089
32133
|
} // TODO: handle non-text children in <pre>
|
|
32090
32134
|
|
|
32091
32135
|
|
|
32092
|
-
if (isPreLikeNode
|
|
32136
|
+
if (isPreLikeNode(node) && node.children.some(function (child) {
|
|
32093
32137
|
return child.type !== "text" && child.type !== "interpolation";
|
|
32094
32138
|
})) {
|
|
32095
32139
|
return true;
|
|
@@ -32099,7 +32143,7 @@ function shouldPreserveContent$1(node) {
|
|
|
32099
32143
|
}
|
|
32100
32144
|
|
|
32101
32145
|
function hasPrettierIgnore$3(node) {
|
|
32102
|
-
if (node.type === "attribute" || node
|
|
32146
|
+
if (node.type === "attribute" || isTextLikeNode$1(node)) {
|
|
32103
32147
|
return false;
|
|
32104
32148
|
}
|
|
32105
32149
|
|
|
@@ -32132,6 +32176,12 @@ function getPrettierIgnoreAttributeCommentData$1(value) {
|
|
|
32132
32176
|
|
|
32133
32177
|
return match[1].split(/\s+/);
|
|
32134
32178
|
}
|
|
32179
|
+
/** there's no opening/closing tag or it's considered not breakable */
|
|
32180
|
+
|
|
32181
|
+
|
|
32182
|
+
function isTextLikeNode$1(node) {
|
|
32183
|
+
return node.type === "text" || node.type === "comment";
|
|
32184
|
+
}
|
|
32135
32185
|
|
|
32136
32186
|
function isScriptLikeTag$1(node) {
|
|
32137
32187
|
return node.type === "element" && (node.fullName === "script" || node.fullName === "style" || node.fullName === "svg:style");
|
|
@@ -32154,35 +32204,41 @@ function isIndentationSensitiveNode(node) {
|
|
|
32154
32204
|
}
|
|
32155
32205
|
|
|
32156
32206
|
function isLeadingSpaceSensitiveNode(node) {
|
|
32157
|
-
|
|
32158
|
-
return false;
|
|
32159
|
-
}
|
|
32207
|
+
var isLeadingSpaceSensitive = _isLeadingSpaceSensitiveNode();
|
|
32160
32208
|
|
|
32161
|
-
if (
|
|
32162
|
-
return
|
|
32209
|
+
if (isLeadingSpaceSensitive && !node.prev && node.parent && node.parent.tagDefinition && node.parent.tagDefinition.ignoreFirstLf) {
|
|
32210
|
+
return node.type === "interpolation";
|
|
32163
32211
|
}
|
|
32164
32212
|
|
|
32165
|
-
|
|
32166
|
-
return false;
|
|
32167
|
-
}
|
|
32213
|
+
return isLeadingSpaceSensitive;
|
|
32168
32214
|
|
|
32169
|
-
|
|
32170
|
-
|
|
32171
|
-
|
|
32215
|
+
function _isLeadingSpaceSensitiveNode() {
|
|
32216
|
+
if (isFrontMatterNode(node)) {
|
|
32217
|
+
return false;
|
|
32218
|
+
}
|
|
32172
32219
|
|
|
32173
|
-
|
|
32174
|
-
|
|
32175
|
-
|
|
32220
|
+
if ((node.type === "text" || node.type === "interpolation") && node.prev && (node.prev.type === "text" || node.prev.type === "interpolation")) {
|
|
32221
|
+
return true;
|
|
32222
|
+
}
|
|
32176
32223
|
|
|
32177
|
-
|
|
32178
|
-
|
|
32179
|
-
|
|
32224
|
+
if (!node.parent || node.parent.cssDisplay === "none") {
|
|
32225
|
+
return false;
|
|
32226
|
+
}
|
|
32180
32227
|
|
|
32181
|
-
|
|
32182
|
-
|
|
32183
|
-
|
|
32228
|
+
if (isPreLikeNode(node.parent)) {
|
|
32229
|
+
return true;
|
|
32230
|
+
}
|
|
32184
32231
|
|
|
32185
|
-
|
|
32232
|
+
if (!node.prev && (node.parent.type === "root" || isScriptLikeTag$1(node.parent) || !isFirstChildLeadingSpaceSensitiveCssDisplay(node.parent.cssDisplay))) {
|
|
32233
|
+
return false;
|
|
32234
|
+
}
|
|
32235
|
+
|
|
32236
|
+
if (node.prev && !isNextLeadingSpaceSensitiveCssDisplay(node.prev.cssDisplay)) {
|
|
32237
|
+
return false;
|
|
32238
|
+
}
|
|
32239
|
+
|
|
32240
|
+
return true;
|
|
32241
|
+
}
|
|
32186
32242
|
}
|
|
32187
32243
|
|
|
32188
32244
|
function isTrailingSpaceSensitiveNode(node) {
|
|
@@ -32198,7 +32254,7 @@ function isTrailingSpaceSensitiveNode(node) {
|
|
|
32198
32254
|
return false;
|
|
32199
32255
|
}
|
|
32200
32256
|
|
|
32201
|
-
if (isPreLikeNode
|
|
32257
|
+
if (isPreLikeNode(node.parent)) {
|
|
32202
32258
|
return true;
|
|
32203
32259
|
}
|
|
32204
32260
|
|
|
@@ -32355,7 +32411,7 @@ function isDanglingSpaceSensitiveCssDisplay(cssDisplay) {
|
|
|
32355
32411
|
return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
|
|
32356
32412
|
}
|
|
32357
32413
|
|
|
32358
|
-
function isPreLikeNode
|
|
32414
|
+
function isPreLikeNode(node) {
|
|
32359
32415
|
return getNodeCssStyleWhiteSpace(node).startsWith("pre");
|
|
32360
32416
|
}
|
|
32361
32417
|
|
|
@@ -32428,58 +32484,6 @@ function getNodeCssStyleWhiteSpace(node) {
|
|
|
32428
32484
|
return node.type === "element" && !node.namespace && CSS_WHITE_SPACE_TAGS[node.name] || CSS_WHITE_SPACE_DEFAULT;
|
|
32429
32485
|
}
|
|
32430
32486
|
|
|
32431
|
-
function getCommentData$1(node) {
|
|
32432
|
-
var rightTrimmedValue = node.value.trimRight();
|
|
32433
|
-
var hasLeadingEmptyLine = /^[^\S\n]*?\n/.test(node.value);
|
|
32434
|
-
|
|
32435
|
-
if (hasLeadingEmptyLine) {
|
|
32436
|
-
/**
|
|
32437
|
-
* <!--
|
|
32438
|
-
* 123
|
|
32439
|
-
* 456
|
|
32440
|
-
* -->
|
|
32441
|
-
*/
|
|
32442
|
-
return dedentString$1(rightTrimmedValue.replace(/^\s*\n/, ""));
|
|
32443
|
-
}
|
|
32444
|
-
/**
|
|
32445
|
-
* <!-- 123 -->
|
|
32446
|
-
*
|
|
32447
|
-
* <!-- 123
|
|
32448
|
-
* -->
|
|
32449
|
-
*
|
|
32450
|
-
* <!-- 123
|
|
32451
|
-
*
|
|
32452
|
-
* -->
|
|
32453
|
-
*/
|
|
32454
|
-
|
|
32455
|
-
|
|
32456
|
-
if (!rightTrimmedValue.includes("\n")) {
|
|
32457
|
-
return rightTrimmedValue.trimLeft();
|
|
32458
|
-
}
|
|
32459
|
-
|
|
32460
|
-
var firstNewlineIndex = rightTrimmedValue.indexOf("\n");
|
|
32461
|
-
var dataWithoutLeadingLine = rightTrimmedValue.slice(firstNewlineIndex + 1);
|
|
32462
|
-
var minIndentationForDataWithoutLeadingLine = getMinIndentation(dataWithoutLeadingLine);
|
|
32463
|
-
var leadingSpaces = rightTrimmedValue.match(/^[^\n\S]*/)[0].length;
|
|
32464
|
-
var commentDataStartColumn = node.sourceSpan.start.col + "<!--".length + leadingSpaces;
|
|
32465
|
-
/**
|
|
32466
|
-
* <!-- 123
|
|
32467
|
-
* 456 -->
|
|
32468
|
-
*/
|
|
32469
|
-
|
|
32470
|
-
if (minIndentationForDataWithoutLeadingLine >= commentDataStartColumn) {
|
|
32471
|
-
return dedentString$1(" ".repeat(commentDataStartColumn) + rightTrimmedValue.slice(leadingSpaces));
|
|
32472
|
-
}
|
|
32473
|
-
|
|
32474
|
-
var leadingLineValue = rightTrimmedValue.slice(0, firstNewlineIndex);
|
|
32475
|
-
/**
|
|
32476
|
-
* <!-- 123
|
|
32477
|
-
* 456 -->
|
|
32478
|
-
*/
|
|
32479
|
-
|
|
32480
|
-
return leadingLineValue.trim() + "\n" + dedentString$1(dataWithoutLeadingLine, minIndentationForDataWithoutLeadingLine);
|
|
32481
|
-
}
|
|
32482
|
-
|
|
32483
32487
|
function getMinIndentation(text) {
|
|
32484
32488
|
var minIndentation = Infinity;
|
|
32485
32489
|
var _iteratorNormalCompletion2 = true;
|
|
@@ -32564,8 +32568,8 @@ function identity$2(x) {
|
|
|
32564
32568
|
return x;
|
|
32565
32569
|
}
|
|
32566
32570
|
|
|
32567
|
-
function shouldNotPrintClosingTag$1(node) {
|
|
32568
|
-
return !node.isSelfClosing && !node.endSourceSpan && (hasPrettierIgnore$3(node) || shouldPreserveContent$1(node.parent));
|
|
32571
|
+
function shouldNotPrintClosingTag$1(node, options) {
|
|
32572
|
+
return !node.isSelfClosing && !node.endSourceSpan && (hasPrettierIgnore$3(node) || shouldPreserveContent$1(node.parent, options));
|
|
32569
32573
|
}
|
|
32570
32574
|
|
|
32571
32575
|
var utils_1$3 = {
|
|
@@ -32577,7 +32581,6 @@ var utils_1$3 = {
|
|
|
32577
32581
|
forceBreakChildren: forceBreakChildren$1,
|
|
32578
32582
|
forceBreakContent: forceBreakContent$1,
|
|
32579
32583
|
forceNextEmptyLine: forceNextEmptyLine$1,
|
|
32580
|
-
getCommentData: getCommentData$1,
|
|
32581
32584
|
getLastDescendant: getLastDescendant$1,
|
|
32582
32585
|
getNodeCssStyleDisplay,
|
|
32583
32586
|
getNodeCssStyleWhiteSpace,
|
|
@@ -32589,8 +32592,9 @@ var utils_1$3 = {
|
|
|
32589
32592
|
isFrontMatterNode,
|
|
32590
32593
|
isIndentationSensitiveNode,
|
|
32591
32594
|
isLeadingSpaceSensitiveNode,
|
|
32592
|
-
isPreLikeNode
|
|
32595
|
+
isPreLikeNode,
|
|
32593
32596
|
isScriptLikeTag: isScriptLikeTag$1,
|
|
32597
|
+
isTextLikeNode: isTextLikeNode$1,
|
|
32594
32598
|
isTrailingSpaceSensitiveNode,
|
|
32595
32599
|
isWhitespaceSensitiveNode,
|
|
32596
32600
|
normalizeParts: normalizeParts$2,
|
|
@@ -32609,7 +32613,7 @@ var isIndentationSensitiveNode$1 = utils_1$3.isIndentationSensitiveNode;
|
|
|
32609
32613
|
var isLeadingSpaceSensitiveNode$1 = utils_1$3.isLeadingSpaceSensitiveNode;
|
|
32610
32614
|
var isTrailingSpaceSensitiveNode$1 = utils_1$3.isTrailingSpaceSensitiveNode;
|
|
32611
32615
|
var isWhitespaceSensitiveNode$1 = utils_1$3.isWhitespaceSensitiveNode;
|
|
32612
|
-
var PREPROCESS_PIPELINE = [removeIgnorableFirstLf, mergeCdataIntoText, extractInterpolation, extractWhitespaces, addCssDisplay, addIsSelfClosing, addIsSpaceSensitive, mergeSimpleElementIntoText];
|
|
32616
|
+
var PREPROCESS_PIPELINE = [removeIgnorableFirstLf, mergeIeConditonalStartEndCommentIntoElementOpeningTag, mergeCdataIntoText, extractInterpolation, extractWhitespaces, addCssDisplay, addIsSelfClosing, addHasHtmComponentClosingTag, addIsSpaceSensitive, mergeSimpleElementIntoText];
|
|
32613
32617
|
|
|
32614
32618
|
function preprocess$4(ast, options) {
|
|
32615
32619
|
for (var _i = 0; _i < PREPROCESS_PIPELINE.length; _i++) {
|
|
@@ -32637,6 +32641,59 @@ function removeIgnorableFirstLf(ast
|
|
|
32637
32641
|
});
|
|
32638
32642
|
}
|
|
32639
32643
|
|
|
32644
|
+
function mergeIeConditonalStartEndCommentIntoElementOpeningTag(ast
|
|
32645
|
+
/*, options */
|
|
32646
|
+
) {
|
|
32647
|
+
/**
|
|
32648
|
+
* <!--[if ...]><!--><target><!--<![endif]-->
|
|
32649
|
+
*/
|
|
32650
|
+
var isTarget = function isTarget(node) {
|
|
32651
|
+
return node.type === "element" && node.prev && node.prev.type === "ieConditionalStartComment" && node.prev.sourceSpan.end.offset === node.startSourceSpan.start.offset && node.firstChild && node.firstChild.type === "ieConditionalEndComment" && node.firstChild.sourceSpan.start.offset === node.startSourceSpan.end.offset;
|
|
32652
|
+
};
|
|
32653
|
+
|
|
32654
|
+
return ast.map(function (node) {
|
|
32655
|
+
if (node.children) {
|
|
32656
|
+
var isTargetResults = node.children.map(isTarget);
|
|
32657
|
+
|
|
32658
|
+
if (isTargetResults.some(Boolean)) {
|
|
32659
|
+
var newChildren = [];
|
|
32660
|
+
|
|
32661
|
+
for (var i = 0; i < node.children.length; i++) {
|
|
32662
|
+
var child = node.children[i];
|
|
32663
|
+
|
|
32664
|
+
if (isTargetResults[i + 1]) {
|
|
32665
|
+
// ieConditionalStartComment
|
|
32666
|
+
continue;
|
|
32667
|
+
}
|
|
32668
|
+
|
|
32669
|
+
if (isTargetResults[i]) {
|
|
32670
|
+
var ieConditionalStartComment = child.prev;
|
|
32671
|
+
var ieConditionalEndComment = child.firstChild;
|
|
32672
|
+
var ParseSourceSpan = child.sourceSpan.constructor;
|
|
32673
|
+
var startSourceSpan = new ParseSourceSpan(ieConditionalStartComment.sourceSpan.start, ieConditionalEndComment.sourceSpan.end);
|
|
32674
|
+
var sourceSpan = new ParseSourceSpan(startSourceSpan.start, child.sourceSpan.end);
|
|
32675
|
+
newChildren.push(child.clone({
|
|
32676
|
+
condition: ieConditionalStartComment.condition,
|
|
32677
|
+
sourceSpan,
|
|
32678
|
+
startSourceSpan,
|
|
32679
|
+
children: child.children.slice(1)
|
|
32680
|
+
}));
|
|
32681
|
+
continue;
|
|
32682
|
+
}
|
|
32683
|
+
|
|
32684
|
+
newChildren.push(child);
|
|
32685
|
+
}
|
|
32686
|
+
|
|
32687
|
+
return node.clone({
|
|
32688
|
+
children: newChildren
|
|
32689
|
+
});
|
|
32690
|
+
}
|
|
32691
|
+
}
|
|
32692
|
+
|
|
32693
|
+
return node;
|
|
32694
|
+
});
|
|
32695
|
+
}
|
|
32696
|
+
|
|
32640
32697
|
function mergeNodeIntoText(ast, shouldMerge, getValue) {
|
|
32641
32698
|
return ast.map(function (node) {
|
|
32642
32699
|
if (node.children) {
|
|
@@ -32844,19 +32901,14 @@ function extractWhitespaces(ast
|
|
|
32844
32901
|
var isWhitespaceSensitive = isWhitespaceSensitiveNode$1(node);
|
|
32845
32902
|
var isIndentationSensitive = isIndentationSensitiveNode$1(node);
|
|
32846
32903
|
return node.clone({
|
|
32904
|
+
isWhitespaceSensitive,
|
|
32905
|
+
isIndentationSensitive,
|
|
32847
32906
|
children: node.children // extract whitespace nodes
|
|
32848
32907
|
.reduce(function (newChildren, child) {
|
|
32849
|
-
if (child.type !== "text") {
|
|
32908
|
+
if (child.type !== "text" || isWhitespaceSensitive) {
|
|
32850
32909
|
return newChildren.concat(child);
|
|
32851
32910
|
}
|
|
32852
32911
|
|
|
32853
|
-
if (isWhitespaceSensitive) {
|
|
32854
|
-
return newChildren.concat(Object.assign({}, child, {
|
|
32855
|
-
isWhitespaceSensitive,
|
|
32856
|
-
isIndentationSensitive
|
|
32857
|
-
}));
|
|
32858
|
-
}
|
|
32859
|
-
|
|
32860
32912
|
var localChildren = [];
|
|
32861
32913
|
|
|
32862
32914
|
var _child$value$match = child.value.match(/^(\s*)([\s\S]*?)(\s*)$/),
|
|
@@ -32916,6 +32968,14 @@ function addIsSelfClosing(ast
|
|
|
32916
32968
|
});
|
|
32917
32969
|
}
|
|
32918
32970
|
|
|
32971
|
+
function addHasHtmComponentClosingTag(ast, options) {
|
|
32972
|
+
return ast.map(function (node) {
|
|
32973
|
+
return node.type !== "element" ? node : Object.assign(node, {
|
|
32974
|
+
hasHtmComponentClosingTag: node.endSourceSpan && /^<\s*\/\s*\/\s*>$/.test(options.originalText.slice(node.endSourceSpan.start.offset, node.endSourceSpan.end.offset))
|
|
32975
|
+
});
|
|
32976
|
+
});
|
|
32977
|
+
}
|
|
32978
|
+
|
|
32919
32979
|
function addCssDisplay(ast, options) {
|
|
32920
32980
|
return ast.map(function (node) {
|
|
32921
32981
|
return Object.assign(node, {
|
|
@@ -33040,7 +33100,19 @@ function printVueSlotScope$1(value, textToDoc) {
|
|
|
33040
33100
|
});
|
|
33041
33101
|
}
|
|
33042
33102
|
|
|
33103
|
+
function isVueEventBindingExpression$3(eventBindingValue) {
|
|
33104
|
+
// https://github.com/vuejs/vue/blob/v2.5.17/src/compiler/codegen/events.js#L3-L4
|
|
33105
|
+
// arrow function or anonymous function
|
|
33106
|
+
var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/; // simple member expression chain (a, a.b, a['b'], a["b"], a[0], a[b])
|
|
33107
|
+
|
|
33108
|
+
var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/; // https://github.com/vuejs/vue/blob/v2.5.17/src/compiler/helpers.js#L104
|
|
33109
|
+
|
|
33110
|
+
var value = eventBindingValue.trim();
|
|
33111
|
+
return fnExpRE.test(value) || simplePathRE.test(value);
|
|
33112
|
+
}
|
|
33113
|
+
|
|
33043
33114
|
var syntaxVue = {
|
|
33115
|
+
isVueEventBindingExpression: isVueEventBindingExpression$3,
|
|
33044
33116
|
printVueFor: printVueFor$1,
|
|
33045
33117
|
printVueSlotScope: printVueSlotScope$1
|
|
33046
33118
|
};
|
|
@@ -33445,6 +33517,7 @@ var _require$$0$utils$1 = doc.utils;
|
|
|
33445
33517
|
var stripTrailingHardline$2 = _require$$0$utils$1.stripTrailingHardline;
|
|
33446
33518
|
var mapDoc$6 = _require$$0$utils$1.mapDoc;
|
|
33447
33519
|
var breakParent$3 = builders.breakParent;
|
|
33520
|
+
var dedentToRoot$2 = builders.dedentToRoot;
|
|
33448
33521
|
var fill$5 = builders.fill;
|
|
33449
33522
|
var group$14 = builders.group;
|
|
33450
33523
|
var hardline$12 = builders.hardline;
|
|
@@ -33460,13 +33533,12 @@ var dedentString = utils_1$3.dedentString;
|
|
|
33460
33533
|
var forceBreakChildren = utils_1$3.forceBreakChildren;
|
|
33461
33534
|
var forceBreakContent = utils_1$3.forceBreakContent;
|
|
33462
33535
|
var forceNextEmptyLine = utils_1$3.forceNextEmptyLine;
|
|
33463
|
-
var getCommentData = utils_1$3.getCommentData;
|
|
33464
33536
|
var getLastDescendant = utils_1$3.getLastDescendant;
|
|
33465
33537
|
var getPrettierIgnoreAttributeCommentData = utils_1$3.getPrettierIgnoreAttributeCommentData;
|
|
33466
33538
|
var hasPrettierIgnore$2 = utils_1$3.hasPrettierIgnore;
|
|
33467
33539
|
var inferScriptParser = utils_1$3.inferScriptParser;
|
|
33468
|
-
var isPreLikeNode = utils_1$3.isPreLikeNode;
|
|
33469
33540
|
var isScriptLikeTag = utils_1$3.isScriptLikeTag;
|
|
33541
|
+
var isTextLikeNode = utils_1$3.isTextLikeNode;
|
|
33470
33542
|
var normalizeParts$1 = utils_1$3.normalizeParts;
|
|
33471
33543
|
var preferHardlineAsLeadingSpaces = utils_1$3.preferHardlineAsLeadingSpaces;
|
|
33472
33544
|
var replaceDocNewlines = utils_1$3.replaceDocNewlines;
|
|
@@ -33476,6 +33548,7 @@ var shouldPreserveContent = utils_1$3.shouldPreserveContent;
|
|
|
33476
33548
|
var insertPragma$6 = pragma$9.insertPragma;
|
|
33477
33549
|
var printVueFor = syntaxVue.printVueFor;
|
|
33478
33550
|
var printVueSlotScope = syntaxVue.printVueSlotScope;
|
|
33551
|
+
var isVueEventBindingExpression$2 = syntaxVue.isVueEventBindingExpression;
|
|
33479
33552
|
var printImgSrcset = syntaxAttribute.printImgSrcset;
|
|
33480
33553
|
|
|
33481
33554
|
function concat$14(parts) {
|
|
@@ -33494,9 +33567,9 @@ function embed$6(path$$1, print, textToDoc, options) {
|
|
|
33494
33567
|
|
|
33495
33568
|
if (parser) {
|
|
33496
33569
|
var value = parser === "markdown" ? dedentString(node.value.replace(/^[^\S\n]*?\n/, "")) : node.value;
|
|
33497
|
-
return builders.concat([concat$14([breakParent$3, printOpeningTagPrefix(node),
|
|
33570
|
+
return builders.concat([concat$14([breakParent$3, printOpeningTagPrefix(node, options), stripTrailingHardline$2(textToDoc(value, {
|
|
33498
33571
|
parser
|
|
33499
|
-
}))
|
|
33572
|
+
})), printClosingTagSuffix(node, options)])]);
|
|
33500
33573
|
}
|
|
33501
33574
|
} else if (node.parent.type === "interpolation") {
|
|
33502
33575
|
return concat$14([indent$9(concat$14([line$9, textToDoc(node.value, options.parser === "angular" ? {
|
|
@@ -33516,6 +33589,11 @@ function embed$6(path$$1, print, textToDoc, options) {
|
|
|
33516
33589
|
{
|
|
33517
33590
|
if (!node.value) {
|
|
33518
33591
|
break;
|
|
33592
|
+
} // lit-html: html`<my-element obj=${obj}></my-element>`
|
|
33593
|
+
|
|
33594
|
+
|
|
33595
|
+
if (/^PRETTIER_HTML_PLACEHOLDER_\d+_IN_JS$/.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
|
|
33596
|
+
return concat$14([node.rawName, "=", node.value]);
|
|
33519
33597
|
}
|
|
33520
33598
|
|
|
33521
33599
|
var embeddedAttributeValueDoc = printEmbeddedAttributeValue(node, function (code, opts) {
|
|
@@ -33527,9 +33605,9 @@ function embed$6(path$$1, print, textToDoc, options) {
|
|
|
33527
33605
|
}, options);
|
|
33528
33606
|
|
|
33529
33607
|
if (embeddedAttributeValueDoc) {
|
|
33530
|
-
return concat$14([node.rawName, '="', mapDoc$6(embeddedAttributeValueDoc, function (doc$$2) {
|
|
33608
|
+
return concat$14([node.rawName, '="', group$14(mapDoc$6(embeddedAttributeValueDoc, function (doc$$2) {
|
|
33531
33609
|
return typeof doc$$2 === "string" ? doc$$2.replace(/"/g, """) : doc$$2;
|
|
33532
|
-
}), '"']);
|
|
33610
|
+
})), '"']);
|
|
33533
33611
|
}
|
|
33534
33612
|
|
|
33535
33613
|
break;
|
|
@@ -33583,11 +33661,11 @@ function genericPrint$5(path$$1, options, print) {
|
|
|
33583
33661
|
}) : isScriptLikeTag(node) && node.parent.type === "root" && options.parser === "vue" ? childrenDoc : indent$9(childrenDoc);
|
|
33584
33662
|
}(concat$14([shouldHugContent ? ifBreak$5(softline$7, "", {
|
|
33585
33663
|
groupId: attrGroupId
|
|
33586
|
-
}) : node.firstChild.
|
|
33664
|
+
}) : node.firstChild.hasLeadingSpaces && node.firstChild.isLeadingSpaceSensitive ? line$9 : node.firstChild.type === "text" && node.isWhitespaceSensitive && node.isIndentationSensitive ? dedentToRoot$2(softline$7) : softline$7, printChildren$1(path$$1, options, print)])), (node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent)) ? node.lastChild.hasTrailingSpaces && node.lastChild.isTrailingSpaceSensitive ? " " : "" : shouldHugContent ? ifBreak$5(softline$7, "", {
|
|
33587
33665
|
groupId: attrGroupId
|
|
33588
|
-
}) : node.lastChild.hasTrailingSpaces && node.lastChild.isTrailingSpaceSensitive ? line$9 : node.type === "
|
|
33666
|
+
}) : node.lastChild.hasTrailingSpaces && node.lastChild.isTrailingSpaceSensitive ? line$9 : (node.lastChild.type === "comment" || node.lastChild.type === "text" && node.isWhitespaceSensitive && node.isIndentationSensitive) && new RegExp(`\\n\\s{${options.tabWidth * countParents(path$$1, function (n) {
|
|
33589
33667
|
return n.parent && n.parent.type !== "root";
|
|
33590
|
-
})}}$`).test(node.lastChild.value)
|
|
33668
|
+
})}}$`).test(node.lastChild.value) ?
|
|
33591
33669
|
/**
|
|
33592
33670
|
* <div>
|
|
33593
33671
|
* <pre>
|
|
@@ -33596,11 +33674,15 @@ function genericPrint$5(path$$1, options, print) {
|
|
|
33596
33674
|
* ~
|
|
33597
33675
|
* </div>
|
|
33598
33676
|
*/
|
|
33599
|
-
"" : softline$7])])), printClosingTag(node)]);
|
|
33677
|
+
"" : softline$7])])), printClosingTag(node, options)]);
|
|
33600
33678
|
}
|
|
33601
33679
|
|
|
33680
|
+
case "ieConditionalStartComment":
|
|
33681
|
+
case "ieConditionalEndComment":
|
|
33682
|
+
return concat$14([printOpeningTagStart(node), printClosingTagEnd(node)]);
|
|
33683
|
+
|
|
33602
33684
|
case "interpolation":
|
|
33603
|
-
return concat$14([printOpeningTagStart(node), concat$14(path$$1.map(print, "children")), printClosingTagEnd(node)]);
|
|
33685
|
+
return concat$14([printOpeningTagStart(node, options), concat$14(path$$1.map(print, "children")), printClosingTagEnd(node, options)]);
|
|
33604
33686
|
|
|
33605
33687
|
case "text":
|
|
33606
33688
|
{
|
|
@@ -33612,17 +33694,15 @@ function genericPrint$5(path$$1, options, print) {
|
|
|
33612
33694
|
return concat$14([concat$14(replaceNewlines(value, literalline$6)), hasTrailingNewline ? hardline$12 : ""]);
|
|
33613
33695
|
}
|
|
33614
33696
|
|
|
33615
|
-
return fill$5(normalizeParts$1([].concat(printOpeningTagPrefix(node), getTextValueParts(node), printClosingTagSuffix(node))));
|
|
33697
|
+
return fill$5(normalizeParts$1([].concat(printOpeningTagPrefix(node, options), getTextValueParts(node), printClosingTagSuffix(node, options))));
|
|
33616
33698
|
}
|
|
33617
33699
|
|
|
33618
33700
|
case "docType":
|
|
33619
|
-
return concat$14([group$14(concat$14([printOpeningTagStart(node), " ", node.value.replace(/^html\b/i, "html").replace(/\s+/g, " ")])), printClosingTagEnd(node)]);
|
|
33701
|
+
return concat$14([group$14(concat$14([printOpeningTagStart(node, options), " ", node.value.replace(/^html\b/i, "html").replace(/\s+/g, " ")])), printClosingTagEnd(node, options)]);
|
|
33620
33702
|
|
|
33621
33703
|
case "comment":
|
|
33622
33704
|
{
|
|
33623
|
-
|
|
33624
|
-
|
|
33625
|
-
return concat$14([group$14(concat$14([printOpeningTagStart(node), _value.trim().length === 0 ? "" : concat$14([indent$9(concat$14([node.prev && needsToBorrowNextOpeningTagStartMarker(node.prev) ? breakParent$3 : "", line$9, concat$14(replaceNewlines(_value, hardline$12))])), (node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent)) ? " " : line$9])])), printClosingTagEnd(node)]);
|
|
33705
|
+
return concat$14([printOpeningTagPrefix(node, options), concat$14(replaceNewlines(options.originalText.slice(options.locStart(node), options.locEnd(node)), literalline$6)), printClosingTagSuffix(node, options)]);
|
|
33626
33706
|
}
|
|
33627
33707
|
|
|
33628
33708
|
case "attribute":
|
|
@@ -33654,7 +33734,19 @@ function printChildren$1(path$$1, options, print) {
|
|
|
33654
33734
|
return concat$14(path$$1.map(function (childPath, childIndex) {
|
|
33655
33735
|
var childNode = childPath.getValue();
|
|
33656
33736
|
|
|
33657
|
-
if (childNode
|
|
33737
|
+
if (isTextLikeNode(childNode)) {
|
|
33738
|
+
if (childNode.prev && isTextLikeNode(childNode.prev)) {
|
|
33739
|
+
var _prevBetweenLine = printBetweenLine(childNode.prev, childNode);
|
|
33740
|
+
|
|
33741
|
+
if (_prevBetweenLine) {
|
|
33742
|
+
if (forceNextEmptyLine(childNode.prev)) {
|
|
33743
|
+
return concat$14([hardline$12, hardline$12, printChild(childPath)]);
|
|
33744
|
+
}
|
|
33745
|
+
|
|
33746
|
+
return concat$14([_prevBetweenLine, printChild(childPath)]);
|
|
33747
|
+
}
|
|
33748
|
+
}
|
|
33749
|
+
|
|
33658
33750
|
return printChild(childPath);
|
|
33659
33751
|
}
|
|
33660
33752
|
|
|
@@ -33671,7 +33763,7 @@ function printChildren$1(path$$1, options, print) {
|
|
|
33671
33763
|
} else if (prevBetweenLine === hardline$12) {
|
|
33672
33764
|
prevParts.push(hardline$12);
|
|
33673
33765
|
} else {
|
|
33674
|
-
if (childNode.prev
|
|
33766
|
+
if (isTextLikeNode(childNode.prev)) {
|
|
33675
33767
|
leadingParts.push(prevBetweenLine);
|
|
33676
33768
|
} else {
|
|
33677
33769
|
leadingParts.push(ifBreak$5("", softline$7, {
|
|
@@ -33683,11 +33775,11 @@ function printChildren$1(path$$1, options, print) {
|
|
|
33683
33775
|
|
|
33684
33776
|
if (nextBetweenLine) {
|
|
33685
33777
|
if (forceNextEmptyLine(childNode)) {
|
|
33686
|
-
if (childNode.next
|
|
33778
|
+
if (isTextLikeNode(childNode.next)) {
|
|
33687
33779
|
nextParts.push(hardline$12, hardline$12);
|
|
33688
33780
|
}
|
|
33689
33781
|
} else if (nextBetweenLine === hardline$12) {
|
|
33690
|
-
if (childNode.next
|
|
33782
|
+
if (isTextLikeNode(childNode.next)) {
|
|
33691
33783
|
nextParts.push(hardline$12);
|
|
33692
33784
|
}
|
|
33693
33785
|
} else {
|
|
@@ -33704,18 +33796,18 @@ function printChildren$1(path$$1, options, print) {
|
|
|
33704
33796
|
var child = childPath.getValue();
|
|
33705
33797
|
|
|
33706
33798
|
if (hasPrettierIgnore$2(child)) {
|
|
33707
|
-
return concat$14([].concat(printOpeningTagPrefix(child), replaceNewlines(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).length : 0)), literalline$6), printClosingTagSuffix(child)));
|
|
33799
|
+
return concat$14([].concat(printOpeningTagPrefix(child, options), replaceNewlines(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$6), printClosingTagSuffix(child, options)));
|
|
33708
33800
|
}
|
|
33709
33801
|
|
|
33710
|
-
if (shouldPreserveContent(child)) {
|
|
33711
|
-
return concat$14([].concat(printOpeningTagPrefix(child), group$14(printOpeningTag(childPath, options, print)), replaceNewlines(options.originalText.slice(child.startSourceSpan.end.offset
|
|
33802
|
+
if (shouldPreserveContent(child, options)) {
|
|
33803
|
+
return concat$14([].concat(printOpeningTagPrefix(child, options), group$14(printOpeningTag(childPath, options, print)), replaceNewlines(options.originalText.slice(child.startSourceSpan.end.offset + (child.firstChild && needsToBorrowParentOpeningTagEndMarker(child.firstChild) ? -printOpeningTagEndMarker(child).length : 0), child.endSourceSpan.start.offset + (child.lastChild && needsToBorrowParentClosingTagStartMarker(child.lastChild) ? printClosingTagStartMarker(child, options).length : needsToBorrowLastChildClosingTagEndMarker(child) ? -printClosingTagEndMarker(child.lastChild, options).length : 0)), literalline$6), printClosingTag(child, options), printClosingTagSuffix(child, options)));
|
|
33712
33804
|
}
|
|
33713
33805
|
|
|
33714
33806
|
return print(childPath);
|
|
33715
33807
|
}
|
|
33716
33808
|
|
|
33717
33809
|
function printBetweenLine(prevNode, nextNode) {
|
|
33718
|
-
return needsToBorrowNextOpeningTagStartMarker(prevNode) && (
|
|
33810
|
+
return isTextLikeNode(prevNode) && isTextLikeNode(nextNode) ? prevNode.isTrailingSpaceSensitive ? prevNode.hasTrailingSpaces ? preferHardlineAsLeadingSpaces(nextNode) ? hardline$12 : line$9 : "" : preferHardlineAsLeadingSpaces(nextNode) ? hardline$12 : softline$7 : needsToBorrowNextOpeningTagStartMarker(prevNode) && (
|
|
33719
33811
|
/**
|
|
33720
33812
|
* 123<a
|
|
33721
33813
|
* ~
|
|
@@ -33754,7 +33846,7 @@ function printChildren$1(path$$1, options, print) {
|
|
|
33754
33846
|
function printOpeningTag(path$$1, options, print) {
|
|
33755
33847
|
var node = path$$1.getValue();
|
|
33756
33848
|
var forceNotToBreakAttrContent = node.type === "element" && node.fullName === "script" && node.attrs.length === 1 && node.attrs[0].fullName === "src" && node.children.length === 0;
|
|
33757
|
-
return concat$14([printOpeningTagStart(node), !node.attrs || node.attrs.length === 0 ? node.isSelfClosing ?
|
|
33849
|
+
return concat$14([printOpeningTagStart(node, options), !node.attrs || node.attrs.length === 0 ? node.isSelfClosing ?
|
|
33758
33850
|
/**
|
|
33759
33851
|
* <br />
|
|
33760
33852
|
* ^
|
|
@@ -33788,24 +33880,24 @@ function printOpeningTag(path$$1, options, print) {
|
|
|
33788
33880
|
node.isSelfClosing && needsToBorrowLastChildClosingTagEndMarker(node.parent) ? "" : node.isSelfClosing ? forceNotToBreakAttrContent ? " " : line$9 : forceNotToBreakAttrContent ? "" : softline$7]), node.isSelfClosing ? "" : printOpeningTagEnd(node)]);
|
|
33789
33881
|
}
|
|
33790
33882
|
|
|
33791
|
-
function printOpeningTagStart(node) {
|
|
33792
|
-
return node.prev && needsToBorrowNextOpeningTagStartMarker(node.prev) ? "" : concat$14([printOpeningTagPrefix(node), printOpeningTagStartMarker(node)]);
|
|
33883
|
+
function printOpeningTagStart(node, options) {
|
|
33884
|
+
return node.prev && needsToBorrowNextOpeningTagStartMarker(node.prev) ? "" : concat$14([printOpeningTagPrefix(node, options), printOpeningTagStartMarker(node)]);
|
|
33793
33885
|
}
|
|
33794
33886
|
|
|
33795
33887
|
function printOpeningTagEnd(node) {
|
|
33796
33888
|
return node.firstChild && needsToBorrowParentOpeningTagEndMarker(node.firstChild) ? "" : printOpeningTagEndMarker(node);
|
|
33797
33889
|
}
|
|
33798
33890
|
|
|
33799
|
-
function printClosingTag(node) {
|
|
33800
|
-
return concat$14([node.isSelfClosing ? "" : printClosingTagStart(node), printClosingTagEnd(node)]);
|
|
33891
|
+
function printClosingTag(node, options) {
|
|
33892
|
+
return concat$14([node.isSelfClosing ? "" : printClosingTagStart(node, options), printClosingTagEnd(node, options)]);
|
|
33801
33893
|
}
|
|
33802
33894
|
|
|
33803
|
-
function printClosingTagStart(node) {
|
|
33804
|
-
return node.lastChild && needsToBorrowParentClosingTagStartMarker(node.lastChild) ? "" : concat$14([printClosingTagPrefix(node), printClosingTagStartMarker(node)]);
|
|
33895
|
+
function printClosingTagStart(node, options) {
|
|
33896
|
+
return node.lastChild && needsToBorrowParentClosingTagStartMarker(node.lastChild) ? "" : concat$14([printClosingTagPrefix(node, options), printClosingTagStartMarker(node, options)]);
|
|
33805
33897
|
}
|
|
33806
33898
|
|
|
33807
|
-
function printClosingTagEnd(node) {
|
|
33808
|
-
return (node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent)) ? "" : concat$14([printClosingTagEndMarker(node), printClosingTagSuffix(node)]);
|
|
33899
|
+
function printClosingTagEnd(node, options) {
|
|
33900
|
+
return (node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent)) ? "" : concat$14([printClosingTagEndMarker(node, options), printClosingTagSuffix(node, options)]);
|
|
33809
33901
|
}
|
|
33810
33902
|
|
|
33811
33903
|
function needsToBorrowNextOpeningTagStartMarker(node) {
|
|
@@ -33814,7 +33906,7 @@ function needsToBorrowNextOpeningTagStartMarker(node) {
|
|
|
33814
33906
|
* ^^
|
|
33815
33907
|
* >
|
|
33816
33908
|
*/
|
|
33817
|
-
return node.next && node.
|
|
33909
|
+
return node.next && !isTextLikeNode(node.next) && isTextLikeNode(node) && node.isTrailingSpaceSensitive && !node.hasTrailingSpaces;
|
|
33818
33910
|
}
|
|
33819
33911
|
|
|
33820
33912
|
function needsToBorrowParentOpeningTagEndMarker(node) {
|
|
@@ -33840,7 +33932,7 @@ function needsToBorrowPrevClosingTagEndMarker(node) {
|
|
|
33840
33932
|
* ><a
|
|
33841
33933
|
* ^
|
|
33842
33934
|
*/
|
|
33843
|
-
return node.prev && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces;
|
|
33935
|
+
return node.prev && !isTextLikeNode(node.prev) && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces;
|
|
33844
33936
|
}
|
|
33845
33937
|
|
|
33846
33938
|
function needsToBorrowLastChildClosingTagEndMarker(node) {
|
|
@@ -33851,7 +33943,7 @@ function needsToBorrowLastChildClosingTagEndMarker(node) {
|
|
|
33851
33943
|
* ^
|
|
33852
33944
|
* >
|
|
33853
33945
|
*/
|
|
33854
|
-
return node.lastChild && node.lastChild.isTrailingSpaceSensitive && !node.lastChild.hasTrailingSpaces && getLastDescendant(node.lastChild)
|
|
33946
|
+
return node.lastChild && node.lastChild.isTrailingSpaceSensitive && !node.lastChild.hasTrailingSpaces && !isTextLikeNode(getLastDescendant(node.lastChild));
|
|
33855
33947
|
}
|
|
33856
33948
|
|
|
33857
33949
|
function needsToBorrowParentClosingTagStartMarker(node) {
|
|
@@ -33866,35 +33958,43 @@ function needsToBorrowParentClosingTagStartMarker(node) {
|
|
|
33866
33958
|
* ^^^
|
|
33867
33959
|
* >
|
|
33868
33960
|
*/
|
|
33869
|
-
return !node.next && !node.hasTrailingSpaces && node.isTrailingSpaceSensitive && getLastDescendant(node)
|
|
33961
|
+
return !node.next && !node.hasTrailingSpaces && node.isTrailingSpaceSensitive && isTextLikeNode(getLastDescendant(node));
|
|
33870
33962
|
}
|
|
33871
33963
|
|
|
33872
|
-
function printOpeningTagPrefix(node) {
|
|
33873
|
-
return needsToBorrowParentOpeningTagEndMarker(node) ? printOpeningTagEndMarker(node.parent) : needsToBorrowPrevClosingTagEndMarker(node) ? printClosingTagEndMarker(node.prev) : "";
|
|
33964
|
+
function printOpeningTagPrefix(node, options) {
|
|
33965
|
+
return needsToBorrowParentOpeningTagEndMarker(node) ? printOpeningTagEndMarker(node.parent) : needsToBorrowPrevClosingTagEndMarker(node) ? printClosingTagEndMarker(node.prev, options) : "";
|
|
33874
33966
|
}
|
|
33875
33967
|
|
|
33876
|
-
function printClosingTagPrefix(node) {
|
|
33877
|
-
return needsToBorrowLastChildClosingTagEndMarker(node) ? printClosingTagEndMarker(node.lastChild) : "";
|
|
33968
|
+
function printClosingTagPrefix(node, options) {
|
|
33969
|
+
return needsToBorrowLastChildClosingTagEndMarker(node) ? printClosingTagEndMarker(node.lastChild, options) : "";
|
|
33878
33970
|
}
|
|
33879
33971
|
|
|
33880
|
-
function printClosingTagSuffix(node) {
|
|
33881
|
-
return needsToBorrowParentClosingTagStartMarker(node) ? printClosingTagStartMarker(node.parent) : needsToBorrowNextOpeningTagStartMarker(node) ? printOpeningTagStartMarker(node.next) : "";
|
|
33972
|
+
function printClosingTagSuffix(node, options) {
|
|
33973
|
+
return needsToBorrowParentClosingTagStartMarker(node) ? printClosingTagStartMarker(node.parent, options) : needsToBorrowNextOpeningTagStartMarker(node) ? printOpeningTagStartMarker(node.next) : "";
|
|
33882
33974
|
}
|
|
33883
33975
|
|
|
33884
33976
|
function printOpeningTagStartMarker(node) {
|
|
33885
33977
|
switch (node.type) {
|
|
33886
|
-
case "comment":
|
|
33887
|
-
return "<!--";
|
|
33888
|
-
|
|
33889
33978
|
case "ieConditionalComment":
|
|
33979
|
+
case "ieConditionalStartComment":
|
|
33890
33980
|
return `<!--[if ${node.condition}`;
|
|
33891
33981
|
|
|
33982
|
+
case "ieConditionalEndComment":
|
|
33983
|
+
return `<!--<!`;
|
|
33984
|
+
|
|
33892
33985
|
case "interpolation":
|
|
33893
33986
|
return "{{";
|
|
33894
33987
|
|
|
33895
33988
|
case "docType":
|
|
33896
33989
|
return "<!DOCTYPE";
|
|
33897
33990
|
|
|
33991
|
+
case "element":
|
|
33992
|
+
if (node.condition) {
|
|
33993
|
+
return `<!--[if ${node.condition}]><!--><${node.rawName}`;
|
|
33994
|
+
}
|
|
33995
|
+
|
|
33996
|
+
// fall through
|
|
33997
|
+
|
|
33898
33998
|
default:
|
|
33899
33999
|
return `<${node.rawName}`;
|
|
33900
34000
|
}
|
|
@@ -33907,15 +34007,22 @@ function printOpeningTagEndMarker(node) {
|
|
|
33907
34007
|
case "ieConditionalComment":
|
|
33908
34008
|
return "]>";
|
|
33909
34009
|
|
|
34010
|
+
case "element":
|
|
34011
|
+
if (node.condition) {
|
|
34012
|
+
return `><!--<![endif]-->`;
|
|
34013
|
+
}
|
|
34014
|
+
|
|
34015
|
+
// fall through
|
|
34016
|
+
|
|
33910
34017
|
default:
|
|
33911
34018
|
return `>`;
|
|
33912
34019
|
}
|
|
33913
34020
|
}
|
|
33914
34021
|
|
|
33915
|
-
function printClosingTagStartMarker(node) {
|
|
34022
|
+
function printClosingTagStartMarker(node, options) {
|
|
33916
34023
|
assert(!node.isSelfClosing);
|
|
33917
34024
|
|
|
33918
|
-
if (shouldNotPrintClosingTag(node)) {
|
|
34025
|
+
if (shouldNotPrintClosingTag(node, options)) {
|
|
33919
34026
|
return "";
|
|
33920
34027
|
}
|
|
33921
34028
|
|
|
@@ -33923,23 +34030,31 @@ function printClosingTagStartMarker(node) {
|
|
|
33923
34030
|
case "ieConditionalComment":
|
|
33924
34031
|
return "<!";
|
|
33925
34032
|
|
|
34033
|
+
case "element":
|
|
34034
|
+
if (node.hasHtmComponentClosingTag) {
|
|
34035
|
+
return "<//";
|
|
34036
|
+
}
|
|
34037
|
+
|
|
34038
|
+
// fall through
|
|
34039
|
+
|
|
33926
34040
|
default:
|
|
33927
34041
|
return `</${node.rawName}`;
|
|
33928
34042
|
}
|
|
33929
34043
|
}
|
|
33930
34044
|
|
|
33931
|
-
function printClosingTagEndMarker(node) {
|
|
33932
|
-
if (shouldNotPrintClosingTag(node)) {
|
|
34045
|
+
function printClosingTagEndMarker(node, options) {
|
|
34046
|
+
if (shouldNotPrintClosingTag(node, options)) {
|
|
33933
34047
|
return "";
|
|
33934
34048
|
}
|
|
33935
34049
|
|
|
33936
34050
|
switch (node.type) {
|
|
33937
|
-
case "comment":
|
|
33938
|
-
return "-->";
|
|
33939
|
-
|
|
33940
34051
|
case "ieConditionalComment":
|
|
34052
|
+
case "ieConditionalEndComment":
|
|
33941
34053
|
return `[endif]-->`;
|
|
33942
34054
|
|
|
34055
|
+
case "ieConditionalStartComment":
|
|
34056
|
+
return `]><!-->`;
|
|
34057
|
+
|
|
33943
34058
|
case "interpolation":
|
|
33944
34059
|
return "}}";
|
|
33945
34060
|
|
|
@@ -33957,7 +34072,7 @@ function printClosingTagEndMarker(node) {
|
|
|
33957
34072
|
|
|
33958
34073
|
function getTextValueParts(node) {
|
|
33959
34074
|
var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : node.value;
|
|
33960
|
-
return node.isWhitespaceSensitive ? node.isIndentationSensitive ? replaceNewlines(value, literalline$6) : replaceNewlines(dedentString(value.replace(/^\s*?\n|\n\s*?$/g, "")), hardline$12) : // non-breaking whitespace: 0xA0
|
|
34075
|
+
return node.parent.isWhitespaceSensitive ? node.parent.isIndentationSensitive ? replaceNewlines(value, literalline$6) : replaceNewlines(dedentString(value.replace(/^\s*?\n|\n\s*?$/g, "")), hardline$12) : // non-breaking whitespace: 0xA0
|
|
33961
34076
|
join$10(line$9, value.split(/[^\S\xA0]+/)).parts;
|
|
33962
34077
|
}
|
|
33963
34078
|
|
|
@@ -34032,15 +34147,11 @@ function printEmbeddedAttributeValue(node, originalTextToDoc, options) {
|
|
|
34032
34147
|
var jsExpressionBindingPatterns = ["^v-"];
|
|
34033
34148
|
|
|
34034
34149
|
if (isKeyMatched(vueEventBindingPatterns)) {
|
|
34035
|
-
|
|
34036
|
-
|
|
34037
|
-
var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
|
|
34038
|
-
var value = getValue() // https://github.com/vuejs/vue/blob/v2.5.17/src/compiler/helpers.js#L104
|
|
34039
|
-
.trim();
|
|
34040
|
-
return printMaybeHug(simplePathRE.test(value) || fnExpRE.test(value) ? textToDoc(value, {
|
|
34150
|
+
var value = getValue();
|
|
34151
|
+
return printMaybeHug(isVueEventBindingExpression$2(value) ? textToDoc(value, {
|
|
34041
34152
|
parser: "__js_expression"
|
|
34042
34153
|
}) : stripTrailingHardline$2(textToDoc(value, {
|
|
34043
|
-
parser: "
|
|
34154
|
+
parser: "__vue_event_binding"
|
|
34044
34155
|
})));
|
|
34045
34156
|
}
|
|
34046
34157
|
|
|
@@ -34103,6 +34214,30 @@ function printEmbeddedAttributeValue(node, originalTextToDoc, options) {
|
|
|
34103
34214
|
parser: "__ng_directive"
|
|
34104
34215
|
}));
|
|
34105
34216
|
}
|
|
34217
|
+
|
|
34218
|
+
var interpolationRegex = /\{\{([\s\S]+?)\}\}/g;
|
|
34219
|
+
|
|
34220
|
+
var _value = getValue();
|
|
34221
|
+
|
|
34222
|
+
if (interpolationRegex.test(_value)) {
|
|
34223
|
+
var parts = [];
|
|
34224
|
+
|
|
34225
|
+
_value.split(interpolationRegex).forEach(function (part, index) {
|
|
34226
|
+
if (index % 2 === 0) {
|
|
34227
|
+
parts.push(concat$14(replaceNewlines(part, literalline$6)));
|
|
34228
|
+
} else {
|
|
34229
|
+
try {
|
|
34230
|
+
parts.push(group$14(concat$14(["{{", indent$9(concat$14([line$9, ngTextToDoc(part, {
|
|
34231
|
+
parser: "__ng_interpolation"
|
|
34232
|
+
})])), line$9, "}}"])));
|
|
34233
|
+
} catch (e) {
|
|
34234
|
+
parts.push("{{", concat$14(replaceNewlines(part, literalline$6)), "}}");
|
|
34235
|
+
}
|
|
34236
|
+
}
|
|
34237
|
+
});
|
|
34238
|
+
|
|
34239
|
+
return group$14(concat$14(parts));
|
|
34240
|
+
}
|
|
34106
34241
|
}
|
|
34107
34242
|
|
|
34108
34243
|
return null;
|
|
@@ -34565,7 +34700,7 @@ var conditionalGroup$2 = docBuilders$3.conditionalGroup;
|
|
|
34565
34700
|
var breakParent$4 = docBuilders$3.breakParent;
|
|
34566
34701
|
var concat$18 = docBuilders$3.concat;
|
|
34567
34702
|
var dedent$4 = docBuilders$3.dedent;
|
|
34568
|
-
var dedentToRoot$
|
|
34703
|
+
var dedentToRoot$3 = docBuilders$3.dedentToRoot;
|
|
34569
34704
|
var fill$6 = docBuilders$3.fill;
|
|
34570
34705
|
var group$16 = docBuilders$3.group;
|
|
34571
34706
|
var hardline$13 = docBuilders$3.hardline;
|
|
@@ -34639,7 +34774,7 @@ function _print(node, parentNode, path$$1, options, print) {
|
|
|
34639
34774
|
case "document":
|
|
34640
34775
|
{
|
|
34641
34776
|
var nextDocument = parentNode.children[path$$1.getName() + 1];
|
|
34642
|
-
return join$12(hardline$13, [shouldPrintDocumentHeadEndMarker(node, nextDocument) === "head" ? join$12(hardline$13, [node.head.children.length === 0 && node.head.endComments.length === 0 ? "" : path$$1.call(print, "head"), concat$18(["---", hasTrailingComment$1(node.head) ? concat$18([" ", path$$1.call(print, "head", "trailingComment")]) : ""])].filter(Boolean)) : "", shouldPrintDocumentBody(node) ? path$$1.call(print, "body") : ""].filter(Boolean));
|
|
34777
|
+
return join$12(hardline$13, [shouldPrintDocumentHeadEndMarker(node, nextDocument, parentNode, options) === "head" ? join$12(hardline$13, [node.head.children.length === 0 && node.head.endComments.length === 0 ? "" : path$$1.call(print, "head"), concat$18(["---", hasTrailingComment$1(node.head) ? concat$18([" ", path$$1.call(print, "head", "trailingComment")]) : ""])].filter(Boolean)) : "", shouldPrintDocumentBody(node) ? path$$1.call(print, "body") : ""].filter(Boolean));
|
|
34643
34778
|
}
|
|
34644
34779
|
|
|
34645
34780
|
case "documentHead":
|
|
@@ -34708,12 +34843,12 @@ function _print(node, parentNode, path$$1, options, print) {
|
|
|
34708
34843
|
return isNode$1(ancestorNode, ["sequence", "mapping"]);
|
|
34709
34844
|
});
|
|
34710
34845
|
var isLastDescendant = isLastDescendantNode(path$$1);
|
|
34711
|
-
return concat$18([node.type === "blockFolded" ? ">" : "|", node.indent === null ? "" : node.indent.toString(), node.chomping === "clip" ? "" : node.chomping === "keep" ? "+" : "-", hasIndicatorComment(node) ? concat$18([" ", path$$1.call(print, "indicatorComment")]) : "", (node.indent === null ? dedent$4 : dedentToRoot$
|
|
34846
|
+
return concat$18([node.type === "blockFolded" ? ">" : "|", node.indent === null ? "" : node.indent.toString(), node.chomping === "clip" ? "" : node.chomping === "keep" ? "+" : "-", hasIndicatorComment(node) ? concat$18([" ", path$$1.call(print, "indicatorComment")]) : "", (node.indent === null ? dedent$4 : dedentToRoot$3)(align$3(node.indent === null ? options.tabWidth : node.indent - 1 + parentIndent, concat$18(getBlockValueLineContents(node, {
|
|
34712
34847
|
parentIndent,
|
|
34713
34848
|
isLastDescendant,
|
|
34714
34849
|
options
|
|
34715
34850
|
}).reduce(function (reduced, lineWords, index, lineContents) {
|
|
34716
|
-
return reduced.concat(index === 0 ? hardline$13 : "", fill$6(join$12(line$11, lineWords).parts), index !== lineContents.length - 1 ? lineWords.length === 0 ? hardline$13 : markAsRoot$5(literalline$7) : node.chomping === "keep" && isLastDescendant ? lineWords.length === 0 ? dedentToRoot$
|
|
34851
|
+
return reduced.concat(index === 0 ? hardline$13 : "", fill$6(join$12(line$11, lineWords).parts), index !== lineContents.length - 1 ? lineWords.length === 0 ? hardline$13 : markAsRoot$5(literalline$7) : node.chomping === "keep" && isLastDescendant ? lineWords.length === 0 ? dedentToRoot$3(hardline$13) : dedentToRoot$3(literalline$7) : "");
|
|
34717
34852
|
}, []))))]);
|
|
34718
34853
|
}
|
|
34719
34854
|
|
|
@@ -34861,8 +34996,13 @@ function shouldPrintDocumentEndMarker(document, nextDocument) {
|
|
|
34861
34996
|
);
|
|
34862
34997
|
}
|
|
34863
34998
|
|
|
34864
|
-
function shouldPrintDocumentHeadEndMarker(document, nextDocument) {
|
|
34999
|
+
function shouldPrintDocumentHeadEndMarker(document, nextDocument, root, options) {
|
|
34865
35000
|
if (
|
|
35001
|
+
/**
|
|
35002
|
+
* ---
|
|
35003
|
+
* preserve the first document head end marker
|
|
35004
|
+
*/
|
|
35005
|
+
root.children[0] === document && /---(\s|$)/.test(options.originalText.slice(options.locStart(document), options.locStart(document) + 4)) ||
|
|
34866
35006
|
/**
|
|
34867
35007
|
* %DIRECTIVE
|
|
34868
35008
|
* ---
|
|
@@ -35076,6 +35216,10 @@ languageJs, {
|
|
|
35076
35216
|
return require("./parser-babylon").parsers.__vue_expression;
|
|
35077
35217
|
},
|
|
35078
35218
|
|
|
35219
|
+
get __vue_event_binding() {
|
|
35220
|
+
return require("./parser-babylon").parsers.__vue_event_binding;
|
|
35221
|
+
},
|
|
35222
|
+
|
|
35079
35223
|
// JS - Flow
|
|
35080
35224
|
get flow() {
|
|
35081
35225
|
return require("./parser-flow").parsers.flow;
|
|
@@ -39388,8 +39532,31 @@ unwrapExports(src$2);
|
|
|
39388
39532
|
|
|
39389
39533
|
var editorconfigToPrettier = editorConfigToPrettier;
|
|
39390
39534
|
|
|
39535
|
+
function removeUnset(editorConfig) {
|
|
39536
|
+
var result = {};
|
|
39537
|
+
var keys = Object.keys(editorConfig);
|
|
39538
|
+
|
|
39539
|
+
for (var i = 0; i < keys.length; i++) {
|
|
39540
|
+
var key = keys[i];
|
|
39541
|
+
|
|
39542
|
+
if (editorConfig[key] === "unset") {
|
|
39543
|
+
continue;
|
|
39544
|
+
}
|
|
39545
|
+
|
|
39546
|
+
result[key] = editorConfig[key];
|
|
39547
|
+
}
|
|
39548
|
+
|
|
39549
|
+
return result;
|
|
39550
|
+
}
|
|
39551
|
+
|
|
39391
39552
|
function editorConfigToPrettier(editorConfig) {
|
|
39392
|
-
if (!editorConfig
|
|
39553
|
+
if (!editorConfig) {
|
|
39554
|
+
return null;
|
|
39555
|
+
}
|
|
39556
|
+
|
|
39557
|
+
editorConfig = removeUnset(editorConfig);
|
|
39558
|
+
|
|
39559
|
+
if (Object.keys(editorConfig).length === 0) {
|
|
39393
39560
|
return null;
|
|
39394
39561
|
}
|
|
39395
39562
|
|