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/bin-prettier.js CHANGED
@@ -14,7 +14,7 @@ var thirdParty__default = thirdParty['default'];
14
14
  var readline = _interopDefault(require('readline'));
15
15
 
16
16
  var name = "prettier";
17
- var version$1 = "1.15.2";
17
+ var version$1 = "1.15.3";
18
18
  var description = "Prettier is an opinionated code formatter";
19
19
  var bin = {
20
20
  "prettier": "./bin/prettier.js"
@@ -30,20 +30,20 @@ var engines = {
30
30
  var dependencies = {
31
31
  "@angular/compiler": "6.1.10",
32
32
  "@babel/code-frame": "7.0.0-beta.46",
33
- "@babel/parser": "7.1.5",
33
+ "@babel/parser": "7.1.6",
34
34
  "@glimmer/syntax": "0.30.3",
35
35
  "@iarna/toml": "2.0.0",
36
36
  "angular-estree-parser": "1.1.5",
37
- "angular-html-parser": "1.0.0",
37
+ "angular-html-parser": "1.1.0",
38
38
  "camelcase": "4.1.0",
39
39
  "chalk": "2.1.0",
40
40
  "cjk-regex": "2.0.0",
41
- "cosmiconfig": "5.0.6",
41
+ "cosmiconfig": "5.0.7",
42
42
  "dashify": "0.2.2",
43
43
  "dedent": "0.7.0",
44
44
  "diff": "3.2.0",
45
45
  "editorconfig": "0.15.2",
46
- "editorconfig-to-prettier": "0.1.0",
46
+ "editorconfig-to-prettier": "0.1.1",
47
47
  "emoji-regex": "6.5.1",
48
48
  "escape-string-regexp": "1.0.5",
49
49
  "esutils": "2.0.2",
@@ -71,7 +71,7 @@ var dependencies = {
71
71
  "parse-srcset": "ikatyang/parse-srcset#54eb9c1cb21db5c62b4d0e275d7249516df6f0ee",
72
72
  "postcss-less": "1.1.5",
73
73
  "postcss-media-query-parser": "0.2.3",
74
- "postcss-scss": "1.0.6",
74
+ "postcss-scss": "2.0.0",
75
75
  "postcss-selector-parser": "2.2.3",
76
76
  "postcss-values-parser": "1.5.0",
77
77
  "regexp-util": "1.2.2",
@@ -80,8 +80,8 @@ var dependencies = {
80
80
  "resolve": "1.5.0",
81
81
  "semver": "5.4.1",
82
82
  "string-width": "2.1.1",
83
- "typescript": "3.0.1",
84
- "typescript-estree": "1.0.0",
83
+ "typescript": "3.2.1",
84
+ "typescript-estree": "6.0.0-rc.1",
85
85
  "unicode-regex": "2.0.0",
86
86
  "unified": "6.1.6",
87
87
  "vnopts": "1.0.2",
@@ -110,7 +110,7 @@ var devDependencies = {
110
110
  "jest-snapshot-serializer-raw": "1.1.0",
111
111
  "jest-watch-typeahead": "0.1.0",
112
112
  "mkdirp": "0.5.1",
113
- "prettier": "1.15.1",
113
+ "prettier": "1.15.2",
114
114
  "prettylint": "1.0.0",
115
115
  "rimraf": "2.6.2",
116
116
  "rollup": "0.47.6",
@@ -143,6 +143,7 @@ var scripts = {
143
143
  "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",
144
144
  "lint": "cross-env EFF_NO_LINK_RULES=true eslint . --format node_modules/eslint-friendly-formatter",
145
145
  "lint-docs": "prettylint {.,docs,website,website/blog}/*.md",
146
+ "lint-dist": "eslint --no-eslintrc --no-ignore --env=browser \"dist/!(bin-prettier|index|third-party).js\"",
146
147
  "build": "node --max-old-space-size=2048 ./scripts/build/build.js",
147
148
  "build-docs": "node ./scripts/build-docs.js",
148
149
  "check-deps": "node ./scripts/check-deps.js"
@@ -6162,7 +6163,7 @@ function supportsColor(stream) {
6162
6163
  return 2;
6163
6164
  }
6164
6165
 
6165
- if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
6166
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
6166
6167
  return 1;
6167
6168
  }
6168
6169
 
@@ -9610,7 +9611,7 @@ function supportsColor$4(stream) {
9610
9611
  return 2;
9611
9612
  }
9612
9613
 
9613
- if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env$1.TERM)) {
9614
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$1.TERM)) {
9614
9615
  return 1;
9615
9616
  }
9616
9617
 
@@ -14453,7 +14454,7 @@ var createIgnorer_1 = createIgnorer;
14453
14454
 
14454
14455
  function getFileInfo(filePath, opts) {
14455
14456
  return createIgnorer_1(opts.ignorePath, opts.withNodeModules).then(function (ignorer) {
14456
- return _getFileInfo(ignorer, filePath, opts.plugins);
14457
+ return _getFileInfo(ignorer, normalizeFilePath(filePath, opts.ignorePath), opts.plugins);
14457
14458
  });
14458
14459
  }
14459
14460
  /**
@@ -14465,7 +14466,7 @@ function getFileInfo(filePath, opts) {
14465
14466
 
14466
14467
  getFileInfo.sync = function (filePath, opts) {
14467
14468
  var ignorer = createIgnorer_1.sync(opts.ignorePath, opts.withNodeModules);
14468
- return _getFileInfo(ignorer, filePath, opts.plugins);
14469
+ return _getFileInfo(ignorer, normalizeFilePath(filePath, opts.ignorePath), opts.plugins);
14469
14470
  };
14470
14471
 
14471
14472
  function _getFileInfo(ignorer, filePath, plugins) {
@@ -14477,6 +14478,10 @@ function _getFileInfo(ignorer, filePath, plugins) {
14477
14478
  };
14478
14479
  }
14479
14480
 
14481
+ function normalizeFilePath(filePath, ignorePath) {
14482
+ return ignorePath ? path.relative(path.dirname(ignorePath), filePath) : filePath;
14483
+ }
14484
+
14480
14485
  var getFileInfo_1 = getFileInfo;
14481
14486
 
14482
14487
  var lodash_uniqby = createCommonjsModule(function (module, exports) {
@@ -21697,9 +21702,9 @@ function isHtml(path$$1) {
21697
21702
 
21698
21703
  function printHtmlTemplateLiteral(path$$1, print, textToDoc, parser) {
21699
21704
  var node = path$$1.getValue();
21700
- var placeholderPattern = "prettierhtmlplaceholder(\\d+)redlohecalplmthreitterp";
21705
+ var placeholderPattern = "PRETTIER_HTML_PLACEHOLDER_(\\d+)_IN_JS";
21701
21706
  var placeholders = node.expressions.map(function (_, i) {
21702
- return `prettierhtmlplaceholder${i}redlohecalplmthreitterp`;
21707
+ return `PRETTIER_HTML_PLACEHOLDER_${i}_IN_JS`;
21703
21708
  });
21704
21709
  var text = node.quasis.map(function (quasi, index, quasis) {
21705
21710
  return index === quasis.length - 1 ? quasi.value.raw : quasi.value.raw + placeholders[index];
@@ -22810,6 +22815,7 @@ function needsParens(path$$1, options) {
22810
22815
  return true;
22811
22816
 
22812
22817
  case "MemberExpression":
22818
+ case "OptionalMemberExpression":
22813
22819
  return name === "object" && parent.object === node;
22814
22820
 
22815
22821
  case "AssignmentExpression":
@@ -23159,9 +23165,31 @@ function printHtmlBinding$1(path$$1, options, print) {
23159
23165
  return join$4(concat$6([",", line$4]), functionDeclarationPath.map(print, "params"));
23160
23166
  }, "program", "body", 0);
23161
23167
  }
23168
+ } // based on https://github.com/prettier/prettier/blob/master/src/language-html/syntax-vue.js isVueEventBindingExpression()
23169
+
23170
+
23171
+ function isVueEventBindingExpression$1(node) {
23172
+ switch (node.type) {
23173
+ case "MemberExpression":
23174
+ switch (node.property.type) {
23175
+ case "Identifier":
23176
+ case "NumericLiteral":
23177
+ case "StringLiteral":
23178
+ return isVueEventBindingExpression$1(node.object);
23179
+ }
23180
+
23181
+ return false;
23182
+
23183
+ case "Identifier":
23184
+ return true;
23185
+
23186
+ default:
23187
+ return false;
23188
+ }
23162
23189
  }
23163
23190
 
23164
23191
  var htmlBinding = {
23192
+ isVueEventBindingExpression: isVueEventBindingExpression$1,
23165
23193
  printHtmlBinding: printHtmlBinding$1
23166
23194
  };
23167
23195
 
@@ -23209,6 +23237,7 @@ var getNextNonSpaceNonCommentCharacterIndex$2 = utilShared.getNextNonSpaceNonCom
23209
23237
  var isIdentifierName = utils$2.keyword.isIdentifierNameES5;
23210
23238
  var insertPragma = pragma.insertPragma;
23211
23239
  var printHtmlBinding = htmlBinding.printHtmlBinding;
23240
+ var isVueEventBindingExpression = htmlBinding.isVueEventBindingExpression;
23212
23241
  var hasNode = utils$4.hasNode;
23213
23242
  var hasFlowAnnotationComment = utils$4.hasFlowAnnotationComment;
23214
23243
  var hasFlowShorthandAnnotationComment = utils$4.hasFlowShorthandAnnotationComment;
@@ -23273,7 +23302,7 @@ function genericPrint(path$$1, options, printPath, args) {
23273
23302
  var parentExportDecl = getParentExportDeclaration$1(path$$1);
23274
23303
  var decorators = [];
23275
23304
 
23276
- if (node.type === "ClassMethod" || node.type === "ClassProperty" || node.type === "TSAbstractClassProperty" || node.type === "ClassPrivateProperty") {// their decorators are handled themselves
23305
+ if (node.type === "ClassMethod" || node.type === "ClassProperty" || node.type === "TSAbstractClassProperty" || node.type === "ClassPrivateProperty" || node.type === "MethodDefinition" || node.type === "TSAbstractMethodDefinition") {// their decorators are handled themselves
23277
23306
  } else if (node.decorators && node.decorators.length > 0 && // If the parent node is an export declaration and the decorator
23278
23307
  // was written before the export, the export will be responsible
23279
23308
  // for printing the decorators.
@@ -23567,6 +23596,14 @@ function printPathNoParens(path$$1, options, print, args) {
23567
23596
  // Detect Flow-parsed directives
23568
23597
  if (n.directive) {
23569
23598
  return concat$4([nodeStr(n.expression, options, true), semi]);
23599
+ }
23600
+
23601
+ if (options.parser === "__vue_event_binding") {
23602
+ var parent = path$$1.getParentNode();
23603
+
23604
+ if (parent.type === "Program" && parent.body.length === 1 && parent.body[0] === n) {
23605
+ return concat$4([path$$1.call(print, "expression"), isVueEventBindingExpression(n.expression) ? ";" : ""]);
23606
+ }
23570
23607
  } // Do not append semicolon after the only JSX element in a program
23571
23608
 
23572
23609
 
@@ -23583,9 +23620,10 @@ function printPathNoParens(path$$1, options, print, args) {
23583
23620
  case "LogicalExpression":
23584
23621
  case "NGPipeExpression":
23585
23622
  {
23586
- var parent = path$$1.getParentNode();
23623
+ var _parent = path$$1.getParentNode();
23624
+
23587
23625
  var parentParent = path$$1.getParentNode(1);
23588
- var isInsideParenthesis = n !== parent.body && (parent.type === "IfStatement" || parent.type === "WhileStatement" || parent.type === "DoWhileStatement");
23626
+ var isInsideParenthesis = n !== _parent.body && (_parent.type === "IfStatement" || _parent.type === "WhileStatement" || _parent.type === "DoWhileStatement");
23589
23627
 
23590
23628
  var _parts = printBinaryishExpressions(path$$1, print, options,
23591
23629
  /* isNested */
@@ -23612,14 +23650,14 @@ function printPathNoParens(path$$1, options, print, args) {
23612
23650
  // ).call()
23613
23651
 
23614
23652
 
23615
- if (parent.type === "UnaryExpression" || (parent.type === "MemberExpression" || parent.type === "OptionalMemberExpression") && !parent.computed) {
23653
+ if (_parent.type === "UnaryExpression" || (_parent.type === "MemberExpression" || _parent.type === "OptionalMemberExpression") && !_parent.computed) {
23616
23654
  return group$1(concat$4([indent$2(concat$4([softline$1, concat$4(_parts)])), softline$1]));
23617
23655
  } // Avoid indenting sub-expressions in some cases where the first sub-expression is already
23618
23656
  // indented accordingly. We should indent sub-expressions where the first case isn't indented.
23619
23657
 
23620
23658
 
23621
- 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";
23622
- var shouldIndentIfInlining = parent.type === "AssignmentExpression" || parent.type === "VariableDeclarator" || parent.type === "ClassProperty" || parent.type === "TSAbstractClassProperty" || parent.type === "ClassPrivateProperty" || parent.type === "ObjectProperty" || parent.type === "Property";
23659
+ 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";
23660
+ var shouldIndentIfInlining = _parent.type === "AssignmentExpression" || _parent.type === "VariableDeclarator" || _parent.type === "ClassProperty" || _parent.type === "TSAbstractClassProperty" || _parent.type === "ClassPrivateProperty" || _parent.type === "ObjectProperty" || _parent.type === "Property";
23623
23661
  var samePrecedenceSubExpression = isBinaryish(n.left) && shouldFlatten$1(n.operator, n.left.operator);
23624
23662
 
23625
23663
  if (shouldNotIndent || shouldInlineLogicalExpression(n) && !samePrecedenceSubExpression || !shouldInlineLogicalExpression(n) && shouldIndentIfInlining) {
@@ -23679,7 +23717,7 @@ function printPathNoParens(path$$1, options, print, args) {
23679
23717
  case "OptionalMemberExpression":
23680
23718
  case "MemberExpression":
23681
23719
  {
23682
- var _parent = path$$1.getParentNode();
23720
+ var _parent2 = path$$1.getParentNode();
23683
23721
 
23684
23722
  var firstNonMemberParent;
23685
23723
  var i = 0;
@@ -23689,7 +23727,7 @@ function printPathNoParens(path$$1, options, print, args) {
23689
23727
  i++;
23690
23728
  } while (firstNonMemberParent && (firstNonMemberParent.type === "MemberExpression" || firstNonMemberParent.type === "OptionalMemberExpression" || firstNonMemberParent.type === "TSNonNullExpression"));
23691
23729
 
23692
- 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" && _parent.type !== "MemberExpression" && _parent.type !== "OptionalMemberExpression";
23730
+ 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";
23693
23731
  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)])))]);
23694
23732
  }
23695
23733
 
@@ -23792,6 +23830,10 @@ function printPathNoParens(path$$1, options, print, args) {
23792
23830
 
23793
23831
  case "MethodDefinition":
23794
23832
  case "TSAbstractMethodDefinition":
23833
+ if (n.decorators && n.decorators.length !== 0) {
23834
+ parts.push(printDecorators(path$$1, options, print));
23835
+ }
23836
+
23795
23837
  if (n.accessibility) {
23796
23838
  parts.push(n.accessibility + " ");
23797
23839
  }
@@ -23935,6 +23977,7 @@ function printPathNoParens(path$$1, options, print, args) {
23935
23977
  case "Import":
23936
23978
  return "import";
23937
23979
 
23980
+ case "TSModuleBlock":
23938
23981
  case "BlockStatement":
23939
23982
  {
23940
23983
  var naked = path$$1.call(function (bodyPath) {
@@ -23945,11 +23988,11 @@ function printPathNoParens(path$$1, options, print, args) {
23945
23988
  });
23946
23989
  var hasDirectives = n.directives && n.directives.length > 0;
23947
23990
 
23948
- var _parent2 = path$$1.getParentNode();
23991
+ var _parent3 = path$$1.getParentNode();
23949
23992
 
23950
23993
  var _parentParent = path$$1.getParentNode(1);
23951
23994
 
23952
- if (!hasContent && !hasDirectives && !hasDanglingComments(n) && (_parent2.type === "ArrowFunctionExpression" || _parent2.type === "FunctionExpression" || _parent2.type === "FunctionDeclaration" || _parent2.type === "ObjectMethod" || _parent2.type === "ClassMethod" || _parent2.type === "ForStatement" || _parent2.type === "WhileStatement" || _parent2.type === "DoWhileStatement" || _parent2.type === "DoExpression" || _parent2.type === "CatchClause" && !_parentParent.finalizer)) {
23995
+ 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")) {
23953
23996
  return "{}";
23954
23997
  }
23955
23998
 
@@ -24081,10 +24124,10 @@ function printPathNoParens(path$$1, options, print, args) {
24081
24124
  return options.locStart(a) - options.locStart(b);
24082
24125
  })[0];
24083
24126
 
24084
- var _parent3 = path$$1.getParentNode(0);
24127
+ var _parent4 = path$$1.getParentNode(0);
24085
24128
 
24086
- var isFlowInterfaceLikeBody = isTypeAnnotation && _parent3 && (_parent3.type === "InterfaceDeclaration" || _parent3.type === "DeclareInterface" || _parent3.type === "DeclareClass") && path$$1.getName() === "body";
24087
- var shouldBreak = n.type === "TSInterfaceBody" || isFlowInterfaceLikeBody || n.type === "ObjectPattern" && _parent3.type !== "FunctionDeclaration" && _parent3.type !== "FunctionExpression" && _parent3.type !== "ArrowFunctionExpression" && _parent3.type !== "AssignmentPattern" && _parent3.type !== "CatchClause" && n.properties.some(function (property) {
24129
+ var isFlowInterfaceLikeBody = isTypeAnnotation && _parent4 && (_parent4.type === "InterfaceDeclaration" || _parent4.type === "DeclareInterface" || _parent4.type === "DeclareClass") && path$$1.getName() === "body";
24130
+ 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) {
24088
24131
  return property.value && (property.value.type === "ObjectPattern" || property.value.type === "ArrayPattern");
24089
24132
  }) || n.type !== "ObjectPattern" && firstProperty && hasNewlineInRange$1(options.originalText, options.locStart(n), options.locStart(firstProperty));
24090
24133
  var separator = isFlowInterfaceLikeBody ? ";" : n.type === "TSInterfaceBody" || n.type === "TSTypeLiteral" ? ifBreak$1(semi, ";") : ",";
@@ -24111,7 +24154,7 @@ function printPathNoParens(path$$1, options, print, args) {
24111
24154
  var result = concat$4(separatorParts.concat(group$1(prop.printed)));
24112
24155
  separatorParts = [separator, line$3];
24113
24156
 
24114
- if ((prop.node.type === "TSPropertySignature" || prop.node.type === "TSMethodSignature") && hasNodeIgnoreComment$1(prop.node)) {
24157
+ if ((prop.node.type === "TSPropertySignature" || prop.node.type === "TSMethodSignature" || prop.node.type === "TSConstructSignature") && hasNodeIgnoreComment$1(prop.node)) {
24115
24158
  separatorParts.shift();
24116
24159
  }
24117
24160
 
@@ -24145,7 +24188,7 @@ function printPathNoParens(path$$1, options, print, args) {
24145
24188
 
24146
24189
  var parentParentParent = path$$1.getParentNode(2);
24147
24190
 
24148
- if (n.type === "ObjectPattern" && _parent3 && shouldHugArguments(_parent3) && _parent3.params[0] === n || shouldHugType(n) && parentParentParent && shouldHugArguments(parentParentParent) && parentParentParent.params[0].typeAnnotation && parentParentParent.params[0].typeAnnotation.typeAnnotation === n) {
24191
+ 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) {
24149
24192
  return content;
24150
24193
  }
24151
24194
 
@@ -24231,9 +24274,9 @@ function printPathNoParens(path$$1, options, print, args) {
24231
24274
 
24232
24275
  case "SequenceExpression":
24233
24276
  {
24234
- var _parent4 = path$$1.getParentNode(0);
24277
+ var _parent5 = path$$1.getParentNode(0);
24235
24278
 
24236
- if (_parent4.type === "ExpressionStatement" || _parent4.type === "ForStatement") {
24279
+ if (_parent5.type === "ExpressionStatement" || _parent5.type === "ForStatement") {
24237
24280
  // For ExpressionStatements and for-loop heads, which are among
24238
24281
  // the few places a SequenceExpression appears unparenthesized, we want
24239
24282
  // to indent expressions after the first.
@@ -24270,7 +24313,8 @@ function printPathNoParens(path$$1, options, print, args) {
24270
24313
  return printNumber$1(n.extra.raw);
24271
24314
 
24272
24315
  case "BigIntLiteral":
24273
- return concat$4([printNumber$1(n.extra.rawValue), "n"]);
24316
+ return concat$4([printNumber$1(n.extra ? n.extra.rawValue : // TypeScript
24317
+ n.value), "n"]);
24274
24318
 
24275
24319
  case "BooleanLiteral": // Babel 6 Literal split
24276
24320
 
@@ -24592,11 +24636,11 @@ function printPathNoParens(path$$1, options, print, args) {
24592
24636
 
24593
24637
  case "JSXExpressionContainer":
24594
24638
  {
24595
- var _parent5 = path$$1.getParentNode(0);
24639
+ var _parent6 = path$$1.getParentNode(0);
24596
24640
 
24597
- var preventInline = _parent5.type === "JSXAttribute" && n.expression.comments && n.expression.comments.length > 0;
24641
+ var preventInline = _parent6.type === "JSXAttribute" && n.expression.comments && n.expression.comments.length > 0;
24598
24642
 
24599
- 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(_parent5) && (n.expression.type === "ConditionalExpression" || isBinaryish(n.expression)));
24643
+ 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)));
24600
24644
 
24601
24645
  if (_shouldInline) {
24602
24646
  return group$1(concat$4(["{", path$$1.call(print, "expression"), lineSuffixBoundary$1, "}"]));
@@ -24606,7 +24650,6 @@ function printPathNoParens(path$$1, options, print, args) {
24606
24650
  }
24607
24651
 
24608
24652
  case "JSXFragment":
24609
- case "TSJsxFragment":
24610
24653
  case "JSXElement":
24611
24654
  {
24612
24655
  var elem = comments.printComments(path$$1, function () {
@@ -24668,12 +24711,10 @@ function printPathNoParens(path$$1, options, print, args) {
24668
24711
 
24669
24712
  case "JSXOpeningFragment":
24670
24713
  case "JSXClosingFragment":
24671
- case "TSJsxOpeningFragment":
24672
- case "TSJsxClosingFragment":
24673
24714
  {
24674
24715
  var hasComment = n.comments && n.comments.length;
24675
24716
  var hasOwnLineComment = hasComment && !n.comments.every(comments$3.isBlockComment);
24676
- var isOpeningFragment = n.type === "JSXOpeningFragment" || n.type === "TSJsxOpeningFragment";
24717
+ var isOpeningFragment = n.type === "JSXOpeningFragment";
24677
24718
  return concat$4([isOpeningFragment ? "<" : "</", indent$2(concat$4([hasOwnLineComment ? hardline$3 : hasComment && !isOpeningFragment ? " " : "", comments.printDanglingComments(path$$1, options, true)])), hasOwnLineComment ? hardline$3 : "", ">"]);
24678
24719
  }
24679
24720
 
@@ -25006,20 +25047,20 @@ function printPathNoParens(path$$1, options, print, args) {
25006
25047
  // FunctionTypeAnnotation is ambiguous:
25007
25048
  // declare function foo(a: B): void; OR
25008
25049
  // var A: (a: B) => void;
25009
- var _parent6 = path$$1.getParentNode(0);
25050
+ var _parent7 = path$$1.getParentNode(0);
25010
25051
 
25011
25052
  var _parentParent2 = path$$1.getParentNode(1);
25012
25053
 
25013
25054
  var _parentParentParent = path$$1.getParentNode(2);
25014
25055
 
25015
- var isArrowFunctionTypeAnnotation = n.type === "TSFunctionType" || !((_parent6.type === "ObjectTypeProperty" || _parent6.type === "ObjectTypeInternalSlot") && !getFlowVariance(_parent6) && !_parent6.optional && options.locStart(_parent6) === options.locStart(n) || _parent6.type === "ObjectTypeCallProperty" || _parentParentParent && _parentParentParent.type === "DeclareFunction");
25016
- var needsColon = isArrowFunctionTypeAnnotation && (_parent6.type === "TypeAnnotation" || _parent6.type === "TSTypeAnnotation"); // Sadly we can't put it inside of FastPath::needsColon because we are
25056
+ 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");
25057
+ var needsColon = isArrowFunctionTypeAnnotation && (_parent7.type === "TypeAnnotation" || _parent7.type === "TSTypeAnnotation"); // Sadly we can't put it inside of FastPath::needsColon because we are
25017
25058
  // printing ":" as part of the expression and it would put parenthesis
25018
25059
  // around :(
25019
25060
 
25020
- var needsParens = needsColon && isArrowFunctionTypeAnnotation && (_parent6.type === "TypeAnnotation" || _parent6.type === "TSTypeAnnotation") && _parentParent2.type === "ArrowFunctionExpression";
25061
+ var needsParens = needsColon && isArrowFunctionTypeAnnotation && (_parent7.type === "TypeAnnotation" || _parent7.type === "TSTypeAnnotation") && _parentParent2.type === "ArrowFunctionExpression";
25021
25062
 
25022
- if (isObjectTypePropertyAFunction(_parent6, options)) {
25063
+ if (isObjectTypePropertyAFunction(_parent7, options)) {
25023
25064
  isArrowFunctionTypeAnnotation = true;
25024
25065
  needsColon = true;
25025
25066
  }
@@ -25122,12 +25163,12 @@ function printPathNoParens(path$$1, options, print, args) {
25122
25163
  // | A
25123
25164
  // | B
25124
25165
  // | C
25125
- var _parent7 = path$$1.getParentNode();
25166
+ var _parent8 = path$$1.getParentNode();
25126
25167
 
25127
25168
  var _parentParent3 = path$$1.getParentNode(1); // If there's a leading comment, the parent is doing the indentation
25128
25169
 
25129
25170
 
25130
- var shouldIndent = _parent7.type !== "TypeParameterInstantiation" && _parent7.type !== "TSTypeParameterInstantiation" && _parent7.type !== "GenericTypeAnnotation" && _parent7.type !== "TSTypeReference" && !(_parent7.type === "FunctionTypeParam" && !_parent7.name) && _parentParent3.type !== "TSTypeAssertionExpression" && !((_parent7.type === "TypeAlias" || _parent7.type === "VariableDeclarator") && hasLeadingOwnLineComment(options.originalText, n, options)); // {
25171
+ 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)); // {
25131
25172
  // a: string
25132
25173
  // } | null | void
25133
25174
  // should be inlined and not be printed in the multi-line variant
@@ -25153,7 +25194,8 @@ function printPathNoParens(path$$1, options, print, args) {
25153
25194
  return join$2(" | ", _printed2);
25154
25195
  }
25155
25196
 
25156
- var code = concat$4([ifBreak$1(concat$4([shouldIndent ? line$3 : "", "| "])), join$2(concat$4([line$3, "| "]), _printed2)]);
25197
+ var shouldAddStartLine = shouldIndent && !hasLeadingOwnLineComment(options.originalText, n, options);
25198
+ var code = concat$4([ifBreak$1(concat$4([shouldAddStartLine ? line$3 : "", "| "])), join$2(concat$4([line$3, "| "]), _printed2)]);
25157
25199
  var hasParens;
25158
25200
 
25159
25201
  if (n.type === "TSUnionType") {
@@ -25286,9 +25328,9 @@ function printPathNoParens(path$$1, options, print, args) {
25286
25328
  case "TSTypeParameter":
25287
25329
  case "TypeParameter":
25288
25330
  {
25289
- var _parent8 = path$$1.getParentNode();
25331
+ var _parent9 = path$$1.getParentNode();
25290
25332
 
25291
- if (_parent8.type === "TSMappedType") {
25333
+ if (_parent9.type === "TSMappedType") {
25292
25334
  parts.push("[", path$$1.call(print, "name"));
25293
25335
 
25294
25336
  if (n.constraint) {
@@ -25350,6 +25392,9 @@ function printPathNoParens(path$$1, options, print, args) {
25350
25392
  case "TSBooleanKeyword":
25351
25393
  return "boolean";
25352
25394
 
25395
+ case "TSBigIntKeyword":
25396
+ return "bigint";
25397
+
25353
25398
  case "TSConstKeyword":
25354
25399
  return "const";
25355
25400
 
@@ -25480,9 +25525,9 @@ function printPathNoParens(path$$1, options, print, args) {
25480
25525
 
25481
25526
  case "TSIndexSignature":
25482
25527
  {
25483
- var _parent9 = path$$1.getParentNode();
25528
+ var _parent10 = path$$1.getParentNode();
25484
25529
 
25485
- 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"), _parent9.type === "ClassBody" ? semi : ""]);
25530
+ 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 : ""]);
25486
25531
  }
25487
25532
 
25488
25533
  case "TSTypePredicate":
@@ -25603,10 +25648,10 @@ function printPathNoParens(path$$1, options, print, args) {
25603
25648
 
25604
25649
  case "TSModuleDeclaration":
25605
25650
  {
25606
- var _parent10 = path$$1.getParentNode();
25651
+ var _parent11 = path$$1.getParentNode();
25607
25652
 
25608
25653
  var isExternalModule = isLiteral(n.id);
25609
- var parentIsDeclaration = _parent10.type === "TSModuleDeclaration";
25654
+ var parentIsDeclaration = _parent11.type === "TSModuleDeclaration";
25610
25655
  var bodyIsDeclaration = n.body && n.body.type === "TSModuleDeclaration";
25611
25656
 
25612
25657
  if (parentIsDeclaration) {
@@ -25623,7 +25668,7 @@ function printPathNoParens(path$$1, options, print, args) {
25623
25668
  var isGlobalDeclaration = n.id.type === "Identifier" && n.id.name === "global" && !/namespace|module/.test(textBetweenNodeAndItsId);
25624
25669
 
25625
25670
  if (!isGlobalDeclaration) {
25626
- parts.push(isExternalModule || /\smodule\s/.test(textBetweenNodeAndItsId) ? "module " : "namespace ");
25671
+ parts.push(isExternalModule || /(^|\s)module(\s|$)/.test(textBetweenNodeAndItsId) ? "module " : "namespace ");
25627
25672
  }
25628
25673
  }
25629
25674
 
@@ -25632,9 +25677,7 @@ function printPathNoParens(path$$1, options, print, args) {
25632
25677
  if (bodyIsDeclaration) {
25633
25678
  parts.push(path$$1.call(print, "body"));
25634
25679
  } else if (n.body) {
25635
- parts.push(" {", indent$2(concat$4([line$3, path$$1.call(function (bodyPath) {
25636
- return comments.printDanglingComments(bodyPath, options, true);
25637
- }, "body"), group$1(path$$1.call(print, "body"))])), line$3, "}");
25680
+ parts.push(" ", group$1(path$$1.call(print, "body")));
25638
25681
  } else {
25639
25682
  parts.push(semi);
25640
25683
  }
@@ -25642,11 +25685,6 @@ function printPathNoParens(path$$1, options, print, args) {
25642
25685
  return concat$4(parts);
25643
25686
  }
25644
25687
 
25645
- case "TSModuleBlock":
25646
- return path$$1.call(function (bodyPath) {
25647
- return printStatementSequence(bodyPath, options, print);
25648
- }, "body");
25649
-
25650
25688
  case "PrivateName":
25651
25689
  return concat$4(["#", path$$1.call(print, "id")]);
25652
25690
 
@@ -25694,7 +25732,7 @@ function printPathNoParens(path$$1, options, print, args) {
25694
25732
 
25695
25733
  case "NGMicrosyntax":
25696
25734
  return concat$4(path$$1.map(function (childPath, index) {
25697
- return concat$4([index === 0 ? "" : isNgForOf(childPath) ? " " : concat$4([";", line$3]), print(childPath)]);
25735
+ return concat$4([index === 0 ? "" : isNgForOf(childPath.getValue(), index, n) ? " " : concat$4([";", line$3]), print(childPath)]);
25698
25736
  }, "body"));
25699
25737
 
25700
25738
  case "NGMicrosyntaxKey":
@@ -25704,7 +25742,14 @@ function printPathNoParens(path$$1, options, print, args) {
25704
25742
  return concat$4([path$$1.call(print, "expression"), n.alias === null ? "" : concat$4([" as ", path$$1.call(print, "alias")])]);
25705
25743
 
25706
25744
  case "NGMicrosyntaxKeyedExpression":
25707
- return concat$4([path$$1.call(print, "key"), isNgForOf(path$$1) ? " " : ": ", path$$1.call(print, "expression")]);
25745
+ {
25746
+ var index = path$$1.getName();
25747
+
25748
+ var _parentNode2 = path$$1.getParentNode();
25749
+
25750
+ 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";
25751
+ return concat$4([path$$1.call(print, "key"), shouldNotPrintColon ? " " : ": ", path$$1.call(print, "expression")]);
25752
+ }
25708
25753
 
25709
25754
  case "NGMicrosyntaxLet":
25710
25755
  return concat$4(["let ", path$$1.call(print, "key"), n.value === null ? "" : concat$4([" = ", path$$1.call(print, "value")])]);
@@ -25717,13 +25762,8 @@ function printPathNoParens(path$$1, options, print, args) {
25717
25762
  throw new Error("unknown type: " + JSON.stringify(n.type));
25718
25763
  }
25719
25764
  }
25720
- /** prefer `let hero of heros` over `let hero; of: heros` */
25721
25765
 
25722
-
25723
- function isNgForOf(path$$1) {
25724
- var node = path$$1.getValue();
25725
- var index = path$$1.getName();
25726
- var parentNode = path$$1.getParentNode();
25766
+ function isNgForOf(node, index, parentNode) {
25727
25767
  return node.type === "NGMicrosyntaxKeyedExpression" && node.key.name === "of" && index === 1 && parentNode.body[0].type === "NGMicrosyntaxLet" && parentNode.body[0].value === null;
25728
25768
  }
25729
25769
  /** identify if an angular expression seems to have side effects */
@@ -26736,7 +26776,7 @@ function isCallOrOptionalCallExpression(node) {
26736
26776
  }
26737
26777
 
26738
26778
  function isJSXNode(node) {
26739
- return node.type === "JSXElement" || node.type === "JSXFragment" || node.type === "TSJsxFragment";
26779
+ return node.type === "JSXElement" || node.type === "JSXFragment";
26740
26780
  }
26741
26781
 
26742
26782
  function isEmptyJSXElement(node) {
@@ -27138,7 +27178,6 @@ function maybeWrapJSXElementInParens(path$$1, elem) {
27138
27178
  JSXElement: true,
27139
27179
  JSXExpressionContainer: true,
27140
27180
  JSXFragment: true,
27141
- TSJsxFragment: true,
27142
27181
  ExpressionStatement: true,
27143
27182
  CallExpression: true,
27144
27183
  OptionalCallExpression: true,
@@ -30425,7 +30464,7 @@ var languageGraphql = {
30425
30464
  printers: printers$3
30426
30465
  };
30427
30466
 
30428
- const json$6 = {"cjkPattern":"[\\u1100-\\u11ff\\u2e80-\\u2e99\\u2e9b-\\u2ef3\\u2f00-\\u2fd5\\u3000-\\u303f\\u3041-\\u3096\\u309d-\\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]"};
30467
+ 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]"};
30429
30468
 
30430
30469
  var cjkPattern = json$6.cjkPattern;
30431
30470
  var kPattern = json$6.kPattern;
@@ -31201,11 +31240,9 @@ function genericPrint$4(path$$1, options, print) {
31201
31240
 
31202
31241
  case "inlineMath":
31203
31242
  {
31204
- // $$math$$ can be block math in some variants
31205
- // see https://github.com/Rokt33r/remark-math#double-dollars-in-inline
31206
- var _style3 = options.originalText[node.position.start.offset + 1] === "$" ? "$$" : "$";
31207
-
31208
- return concat$12([_style3, node.value, _style3]);
31243
+ // remark-math trims content but we don't want to remove whitespaces
31244
+ // since it's very possible that it's recognized as math accidentally
31245
+ return options.originalText.slice(options.locStart(node), options.locEnd(node));
31209
31246
  }
31210
31247
 
31211
31248
  case "tableRow": // handled in "table"
@@ -32018,7 +32055,7 @@ var htmlElementAttributes = Object.freeze({
32018
32055
  default: index$13
32019
32056
  });
32020
32057
 
32021
- const 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"};
32058
+ 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"};
32022
32059
 
32023
32060
  var htmlElementAttributes$1 = ( htmlElementAttributes && index$13 ) || htmlElementAttributes;
32024
32061
 
@@ -32073,7 +32110,7 @@ function mapObject(object, fn) {
32073
32110
  return newObject;
32074
32111
  }
32075
32112
 
32076
- function shouldPreserveContent$1(node) {
32113
+ function shouldPreserveContent$1(node, options) {
32077
32114
  if (node.type === "element" && node.fullName === "template" && node.attrMap.lang && node.attrMap.lang !== "html") {
32078
32115
  return true;
32079
32116
  } // unterminated node in ie conditional comment
@@ -32088,10 +32125,17 @@ function shouldPreserveContent$1(node) {
32088
32125
 
32089
32126
  if (node.type === "ieConditionalComment" && !node.complete) {
32090
32127
  return true;
32128
+ } // top-level elements (excluding <template>, <style> and <script>) in Vue SFC are considered custom block
32129
+ // custom blocks can be written in other languages so we should preserve them to not break the code
32130
+
32131
+
32132
+ 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>
32133
+ "html"].indexOf(node.fullName) === -1) {
32134
+ return true;
32091
32135
  } // TODO: handle non-text children in <pre>
32092
32136
 
32093
32137
 
32094
- if (isPreLikeNode$1(node) && node.children.some(function (child) {
32138
+ if (isPreLikeNode(node) && node.children.some(function (child) {
32095
32139
  return child.type !== "text" && child.type !== "interpolation";
32096
32140
  })) {
32097
32141
  return true;
@@ -32101,7 +32145,7 @@ function shouldPreserveContent$1(node) {
32101
32145
  }
32102
32146
 
32103
32147
  function hasPrettierIgnore$3(node) {
32104
- if (node.type === "attribute" || node.type === "text") {
32148
+ if (node.type === "attribute" || isTextLikeNode$1(node)) {
32105
32149
  return false;
32106
32150
  }
32107
32151
 
@@ -32134,6 +32178,12 @@ function getPrettierIgnoreAttributeCommentData$1(value) {
32134
32178
 
32135
32179
  return match[1].split(/\s+/);
32136
32180
  }
32181
+ /** there's no opening/closing tag or it's considered not breakable */
32182
+
32183
+
32184
+ function isTextLikeNode$1(node) {
32185
+ return node.type === "text" || node.type === "comment";
32186
+ }
32137
32187
 
32138
32188
  function isScriptLikeTag$1(node) {
32139
32189
  return node.type === "element" && (node.fullName === "script" || node.fullName === "style" || node.fullName === "svg:style");
@@ -32156,35 +32206,41 @@ function isIndentationSensitiveNode(node) {
32156
32206
  }
32157
32207
 
32158
32208
  function isLeadingSpaceSensitiveNode(node) {
32159
- if (isFrontMatterNode(node)) {
32160
- return false;
32161
- }
32209
+ var isLeadingSpaceSensitive = _isLeadingSpaceSensitiveNode();
32162
32210
 
32163
- if ((node.type === "text" || node.type === "interpolation") && node.prev && (node.prev.type === "text" || node.prev.type === "interpolation")) {
32164
- return true;
32211
+ if (isLeadingSpaceSensitive && !node.prev && node.parent && node.parent.tagDefinition && node.parent.tagDefinition.ignoreFirstLf) {
32212
+ return node.type === "interpolation";
32165
32213
  }
32166
32214
 
32167
- if (!node.parent || node.parent.cssDisplay === "none") {
32168
- return false;
32169
- }
32215
+ return isLeadingSpaceSensitive;
32170
32216
 
32171
- if (!node.prev && node.parent.type === "element" && node.parent.tagDefinition.ignoreFirstLf) {
32172
- return false;
32173
- }
32217
+ function _isLeadingSpaceSensitiveNode() {
32218
+ if (isFrontMatterNode(node)) {
32219
+ return false;
32220
+ }
32174
32221
 
32175
- if (isPreLikeNode$1(node.parent)) {
32176
- return true;
32177
- }
32222
+ if ((node.type === "text" || node.type === "interpolation") && node.prev && (node.prev.type === "text" || node.prev.type === "interpolation")) {
32223
+ return true;
32224
+ }
32178
32225
 
32179
- if (!node.prev && (node.parent.type === "root" || isScriptLikeTag$1(node.parent) || !isFirstChildLeadingSpaceSensitiveCssDisplay(node.parent.cssDisplay))) {
32180
- return false;
32181
- }
32226
+ if (!node.parent || node.parent.cssDisplay === "none") {
32227
+ return false;
32228
+ }
32182
32229
 
32183
- if (node.prev && !isNextLeadingSpaceSensitiveCssDisplay(node.prev.cssDisplay)) {
32184
- return false;
32185
- }
32230
+ if (isPreLikeNode(node.parent)) {
32231
+ return true;
32232
+ }
32186
32233
 
32187
- return true;
32234
+ if (!node.prev && (node.parent.type === "root" || isScriptLikeTag$1(node.parent) || !isFirstChildLeadingSpaceSensitiveCssDisplay(node.parent.cssDisplay))) {
32235
+ return false;
32236
+ }
32237
+
32238
+ if (node.prev && !isNextLeadingSpaceSensitiveCssDisplay(node.prev.cssDisplay)) {
32239
+ return false;
32240
+ }
32241
+
32242
+ return true;
32243
+ }
32188
32244
  }
32189
32245
 
32190
32246
  function isTrailingSpaceSensitiveNode(node) {
@@ -32200,7 +32256,7 @@ function isTrailingSpaceSensitiveNode(node) {
32200
32256
  return false;
32201
32257
  }
32202
32258
 
32203
- if (isPreLikeNode$1(node.parent)) {
32259
+ if (isPreLikeNode(node.parent)) {
32204
32260
  return true;
32205
32261
  }
32206
32262
 
@@ -32357,7 +32413,7 @@ function isDanglingSpaceSensitiveCssDisplay(cssDisplay) {
32357
32413
  return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
32358
32414
  }
32359
32415
 
32360
- function isPreLikeNode$1(node) {
32416
+ function isPreLikeNode(node) {
32361
32417
  return getNodeCssStyleWhiteSpace(node).startsWith("pre");
32362
32418
  }
32363
32419
 
@@ -32430,58 +32486,6 @@ function getNodeCssStyleWhiteSpace(node) {
32430
32486
  return node.type === "element" && !node.namespace && CSS_WHITE_SPACE_TAGS[node.name] || CSS_WHITE_SPACE_DEFAULT;
32431
32487
  }
32432
32488
 
32433
- function getCommentData$1(node) {
32434
- var rightTrimmedValue = node.value.trimRight();
32435
- var hasLeadingEmptyLine = /^[^\S\n]*?\n/.test(node.value);
32436
-
32437
- if (hasLeadingEmptyLine) {
32438
- /**
32439
- * <!--
32440
- * 123
32441
- * 456
32442
- * -->
32443
- */
32444
- return dedentString$1(rightTrimmedValue.replace(/^\s*\n/, ""));
32445
- }
32446
- /**
32447
- * <!-- 123 -->
32448
- *
32449
- * <!-- 123
32450
- * -->
32451
- *
32452
- * <!-- 123
32453
- *
32454
- * -->
32455
- */
32456
-
32457
-
32458
- if (!rightTrimmedValue.includes("\n")) {
32459
- return rightTrimmedValue.trimLeft();
32460
- }
32461
-
32462
- var firstNewlineIndex = rightTrimmedValue.indexOf("\n");
32463
- var dataWithoutLeadingLine = rightTrimmedValue.slice(firstNewlineIndex + 1);
32464
- var minIndentationForDataWithoutLeadingLine = getMinIndentation(dataWithoutLeadingLine);
32465
- var leadingSpaces = rightTrimmedValue.match(/^[^\n\S]*/)[0].length;
32466
- var commentDataStartColumn = node.sourceSpan.start.col + "<!--".length + leadingSpaces;
32467
- /**
32468
- * <!-- 123
32469
- * 456 -->
32470
- */
32471
-
32472
- if (minIndentationForDataWithoutLeadingLine >= commentDataStartColumn) {
32473
- return dedentString$1(" ".repeat(commentDataStartColumn) + rightTrimmedValue.slice(leadingSpaces));
32474
- }
32475
-
32476
- var leadingLineValue = rightTrimmedValue.slice(0, firstNewlineIndex);
32477
- /**
32478
- * <!-- 123
32479
- * 456 -->
32480
- */
32481
-
32482
- return leadingLineValue.trim() + "\n" + dedentString$1(dataWithoutLeadingLine, minIndentationForDataWithoutLeadingLine);
32483
- }
32484
-
32485
32489
  function getMinIndentation(text) {
32486
32490
  var minIndentation = Infinity;
32487
32491
  var _iteratorNormalCompletion2 = true;
@@ -32566,8 +32570,8 @@ function identity$2(x) {
32566
32570
  return x;
32567
32571
  }
32568
32572
 
32569
- function shouldNotPrintClosingTag$1(node) {
32570
- return !node.isSelfClosing && !node.endSourceSpan && (hasPrettierIgnore$3(node) || shouldPreserveContent$1(node.parent));
32573
+ function shouldNotPrintClosingTag$1(node, options) {
32574
+ return !node.isSelfClosing && !node.endSourceSpan && (hasPrettierIgnore$3(node) || shouldPreserveContent$1(node.parent, options));
32571
32575
  }
32572
32576
 
32573
32577
  var utils_1$3 = {
@@ -32579,7 +32583,6 @@ var utils_1$3 = {
32579
32583
  forceBreakChildren: forceBreakChildren$1,
32580
32584
  forceBreakContent: forceBreakContent$1,
32581
32585
  forceNextEmptyLine: forceNextEmptyLine$1,
32582
- getCommentData: getCommentData$1,
32583
32586
  getLastDescendant: getLastDescendant$1,
32584
32587
  getNodeCssStyleDisplay,
32585
32588
  getNodeCssStyleWhiteSpace,
@@ -32591,8 +32594,9 @@ var utils_1$3 = {
32591
32594
  isFrontMatterNode,
32592
32595
  isIndentationSensitiveNode,
32593
32596
  isLeadingSpaceSensitiveNode,
32594
- isPreLikeNode: isPreLikeNode$1,
32597
+ isPreLikeNode,
32595
32598
  isScriptLikeTag: isScriptLikeTag$1,
32599
+ isTextLikeNode: isTextLikeNode$1,
32596
32600
  isTrailingSpaceSensitiveNode,
32597
32601
  isWhitespaceSensitiveNode,
32598
32602
  normalizeParts: normalizeParts$2,
@@ -32611,7 +32615,7 @@ var isIndentationSensitiveNode$1 = utils_1$3.isIndentationSensitiveNode;
32611
32615
  var isLeadingSpaceSensitiveNode$1 = utils_1$3.isLeadingSpaceSensitiveNode;
32612
32616
  var isTrailingSpaceSensitiveNode$1 = utils_1$3.isTrailingSpaceSensitiveNode;
32613
32617
  var isWhitespaceSensitiveNode$1 = utils_1$3.isWhitespaceSensitiveNode;
32614
- var PREPROCESS_PIPELINE = [removeIgnorableFirstLf, mergeCdataIntoText, extractInterpolation, extractWhitespaces, addCssDisplay, addIsSelfClosing, addIsSpaceSensitive, mergeSimpleElementIntoText];
32618
+ var PREPROCESS_PIPELINE = [removeIgnorableFirstLf, mergeIeConditonalStartEndCommentIntoElementOpeningTag, mergeCdataIntoText, extractInterpolation, extractWhitespaces, addCssDisplay, addIsSelfClosing, addHasHtmComponentClosingTag, addIsSpaceSensitive, mergeSimpleElementIntoText];
32615
32619
 
32616
32620
  function preprocess$4(ast, options) {
32617
32621
  for (var _i = 0; _i < PREPROCESS_PIPELINE.length; _i++) {
@@ -32639,6 +32643,59 @@ function removeIgnorableFirstLf(ast
32639
32643
  });
32640
32644
  }
32641
32645
 
32646
+ function mergeIeConditonalStartEndCommentIntoElementOpeningTag(ast
32647
+ /*, options */
32648
+ ) {
32649
+ /**
32650
+ * <!--[if ...]><!--><target><!--<![endif]-->
32651
+ */
32652
+ var isTarget = function isTarget(node) {
32653
+ 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;
32654
+ };
32655
+
32656
+ return ast.map(function (node) {
32657
+ if (node.children) {
32658
+ var isTargetResults = node.children.map(isTarget);
32659
+
32660
+ if (isTargetResults.some(Boolean)) {
32661
+ var newChildren = [];
32662
+
32663
+ for (var i = 0; i < node.children.length; i++) {
32664
+ var child = node.children[i];
32665
+
32666
+ if (isTargetResults[i + 1]) {
32667
+ // ieConditionalStartComment
32668
+ continue;
32669
+ }
32670
+
32671
+ if (isTargetResults[i]) {
32672
+ var ieConditionalStartComment = child.prev;
32673
+ var ieConditionalEndComment = child.firstChild;
32674
+ var ParseSourceSpan = child.sourceSpan.constructor;
32675
+ var startSourceSpan = new ParseSourceSpan(ieConditionalStartComment.sourceSpan.start, ieConditionalEndComment.sourceSpan.end);
32676
+ var sourceSpan = new ParseSourceSpan(startSourceSpan.start, child.sourceSpan.end);
32677
+ newChildren.push(child.clone({
32678
+ condition: ieConditionalStartComment.condition,
32679
+ sourceSpan,
32680
+ startSourceSpan,
32681
+ children: child.children.slice(1)
32682
+ }));
32683
+ continue;
32684
+ }
32685
+
32686
+ newChildren.push(child);
32687
+ }
32688
+
32689
+ return node.clone({
32690
+ children: newChildren
32691
+ });
32692
+ }
32693
+ }
32694
+
32695
+ return node;
32696
+ });
32697
+ }
32698
+
32642
32699
  function mergeNodeIntoText(ast, shouldMerge, getValue) {
32643
32700
  return ast.map(function (node) {
32644
32701
  if (node.children) {
@@ -32846,19 +32903,14 @@ function extractWhitespaces(ast
32846
32903
  var isWhitespaceSensitive = isWhitespaceSensitiveNode$1(node);
32847
32904
  var isIndentationSensitive = isIndentationSensitiveNode$1(node);
32848
32905
  return node.clone({
32906
+ isWhitespaceSensitive,
32907
+ isIndentationSensitive,
32849
32908
  children: node.children // extract whitespace nodes
32850
32909
  .reduce(function (newChildren, child) {
32851
- if (child.type !== "text") {
32910
+ if (child.type !== "text" || isWhitespaceSensitive) {
32852
32911
  return newChildren.concat(child);
32853
32912
  }
32854
32913
 
32855
- if (isWhitespaceSensitive) {
32856
- return newChildren.concat(Object.assign({}, child, {
32857
- isWhitespaceSensitive,
32858
- isIndentationSensitive
32859
- }));
32860
- }
32861
-
32862
32914
  var localChildren = [];
32863
32915
 
32864
32916
  var _child$value$match = child.value.match(/^(\s*)([\s\S]*?)(\s*)$/),
@@ -32918,6 +32970,14 @@ function addIsSelfClosing(ast
32918
32970
  });
32919
32971
  }
32920
32972
 
32973
+ function addHasHtmComponentClosingTag(ast, options) {
32974
+ return ast.map(function (node) {
32975
+ return node.type !== "element" ? node : Object.assign(node, {
32976
+ hasHtmComponentClosingTag: node.endSourceSpan && /^<\s*\/\s*\/\s*>$/.test(options.originalText.slice(node.endSourceSpan.start.offset, node.endSourceSpan.end.offset))
32977
+ });
32978
+ });
32979
+ }
32980
+
32921
32981
  function addCssDisplay(ast, options) {
32922
32982
  return ast.map(function (node) {
32923
32983
  return Object.assign(node, {
@@ -33042,7 +33102,19 @@ function printVueSlotScope$1(value, textToDoc) {
33042
33102
  });
33043
33103
  }
33044
33104
 
33105
+ function isVueEventBindingExpression$3(eventBindingValue) {
33106
+ // https://github.com/vuejs/vue/blob/v2.5.17/src/compiler/codegen/events.js#L3-L4
33107
+ // arrow function or anonymous function
33108
+ var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/; // simple member expression chain (a, a.b, a['b'], a["b"], a[0], a[b])
33109
+
33110
+ 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
33111
+
33112
+ var value = eventBindingValue.trim();
33113
+ return fnExpRE.test(value) || simplePathRE.test(value);
33114
+ }
33115
+
33045
33116
  var syntaxVue = {
33117
+ isVueEventBindingExpression: isVueEventBindingExpression$3,
33046
33118
  printVueFor: printVueFor$1,
33047
33119
  printVueSlotScope: printVueSlotScope$1
33048
33120
  };
@@ -33447,6 +33519,7 @@ var _require$$0$utils$1 = doc.utils;
33447
33519
  var stripTrailingHardline$2 = _require$$0$utils$1.stripTrailingHardline;
33448
33520
  var mapDoc$6 = _require$$0$utils$1.mapDoc;
33449
33521
  var breakParent$3 = builders.breakParent;
33522
+ var dedentToRoot$2 = builders.dedentToRoot;
33450
33523
  var fill$5 = builders.fill;
33451
33524
  var group$14 = builders.group;
33452
33525
  var hardline$12 = builders.hardline;
@@ -33462,13 +33535,12 @@ var dedentString = utils_1$3.dedentString;
33462
33535
  var forceBreakChildren = utils_1$3.forceBreakChildren;
33463
33536
  var forceBreakContent = utils_1$3.forceBreakContent;
33464
33537
  var forceNextEmptyLine = utils_1$3.forceNextEmptyLine;
33465
- var getCommentData = utils_1$3.getCommentData;
33466
33538
  var getLastDescendant = utils_1$3.getLastDescendant;
33467
33539
  var getPrettierIgnoreAttributeCommentData = utils_1$3.getPrettierIgnoreAttributeCommentData;
33468
33540
  var hasPrettierIgnore$2 = utils_1$3.hasPrettierIgnore;
33469
33541
  var inferScriptParser = utils_1$3.inferScriptParser;
33470
- var isPreLikeNode = utils_1$3.isPreLikeNode;
33471
33542
  var isScriptLikeTag = utils_1$3.isScriptLikeTag;
33543
+ var isTextLikeNode = utils_1$3.isTextLikeNode;
33472
33544
  var normalizeParts$1 = utils_1$3.normalizeParts;
33473
33545
  var preferHardlineAsLeadingSpaces = utils_1$3.preferHardlineAsLeadingSpaces;
33474
33546
  var replaceDocNewlines = utils_1$3.replaceDocNewlines;
@@ -33478,6 +33550,7 @@ var shouldPreserveContent = utils_1$3.shouldPreserveContent;
33478
33550
  var insertPragma$6 = pragma$9.insertPragma;
33479
33551
  var printVueFor = syntaxVue.printVueFor;
33480
33552
  var printVueSlotScope = syntaxVue.printVueSlotScope;
33553
+ var isVueEventBindingExpression$2 = syntaxVue.isVueEventBindingExpression;
33481
33554
  var printImgSrcset = syntaxAttribute.printImgSrcset;
33482
33555
 
33483
33556
  function concat$14(parts) {
@@ -33496,9 +33569,9 @@ function embed$6(path$$1, print, textToDoc, options) {
33496
33569
 
33497
33570
  if (parser) {
33498
33571
  var value = parser === "markdown" ? dedentString(node.value.replace(/^[^\S\n]*?\n/, "")) : node.value;
33499
- return builders.concat([concat$14([breakParent$3, printOpeningTagPrefix(node), markAsRoot$4(stripTrailingHardline$2(textToDoc(value, {
33572
+ return builders.concat([concat$14([breakParent$3, printOpeningTagPrefix(node, options), stripTrailingHardline$2(textToDoc(value, {
33500
33573
  parser
33501
- }))), printClosingTagSuffix(node)])]);
33574
+ })), printClosingTagSuffix(node, options)])]);
33502
33575
  }
33503
33576
  } else if (node.parent.type === "interpolation") {
33504
33577
  return concat$14([indent$9(concat$14([line$9, textToDoc(node.value, options.parser === "angular" ? {
@@ -33518,6 +33591,11 @@ function embed$6(path$$1, print, textToDoc, options) {
33518
33591
  {
33519
33592
  if (!node.value) {
33520
33593
  break;
33594
+ } // lit-html: html`<my-element obj=${obj}></my-element>`
33595
+
33596
+
33597
+ if (/^PRETTIER_HTML_PLACEHOLDER_\d+_IN_JS$/.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
33598
+ return concat$14([node.rawName, "=", node.value]);
33521
33599
  }
33522
33600
 
33523
33601
  var embeddedAttributeValueDoc = printEmbeddedAttributeValue(node, function (code, opts) {
@@ -33529,9 +33607,9 @@ function embed$6(path$$1, print, textToDoc, options) {
33529
33607
  }, options);
33530
33608
 
33531
33609
  if (embeddedAttributeValueDoc) {
33532
- return concat$14([node.rawName, '="', mapDoc$6(embeddedAttributeValueDoc, function (doc$$2) {
33610
+ return concat$14([node.rawName, '="', group$14(mapDoc$6(embeddedAttributeValueDoc, function (doc$$2) {
33533
33611
  return typeof doc$$2 === "string" ? doc$$2.replace(/"/g, "&quot;") : doc$$2;
33534
- }), '"']);
33612
+ })), '"']);
33535
33613
  }
33536
33614
 
33537
33615
  break;
@@ -33585,11 +33663,11 @@ function genericPrint$5(path$$1, options, print) {
33585
33663
  }) : isScriptLikeTag(node) && node.parent.type === "root" && options.parser === "vue" ? childrenDoc : indent$9(childrenDoc);
33586
33664
  }(concat$14([shouldHugContent ? ifBreak$5(softline$7, "", {
33587
33665
  groupId: attrGroupId
33588
- }) : node.firstChild.type === "text" && node.firstChild.isWhitespaceSensitive && node.firstChild.isIndentationSensitive ? node.children.length === 1 && node.firstChild.type === "text" && node.firstChild.value.indexOf("\n") === -1 || node.firstChild.sourceSpan.start.line === node.lastChild.sourceSpan.end.line ? "" : literalline$6 : node.firstChild.hasLeadingSpaces && node.firstChild.isLeadingSpaceSensitive ? line$9 : 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, "", {
33666
+ }) : 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, "", {
33589
33667
  groupId: attrGroupId
33590
- }) : node.lastChild.hasTrailingSpaces && node.lastChild.isTrailingSpaceSensitive ? line$9 : node.type === "element" && isPreLikeNode(node) && node.lastChild.type === "text" && (node.lastChild.value.indexOf("\n") === -1 || new RegExp(`\\n\\s{${options.tabWidth * countParents(path$$1, function (n) {
33668
+ }) : 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) {
33591
33669
  return n.parent && n.parent.type !== "root";
33592
- })}}$`).test(node.lastChild.value)) ?
33670
+ })}}$`).test(node.lastChild.value) ?
33593
33671
  /**
33594
33672
  * <div>
33595
33673
  * <pre>
@@ -33598,11 +33676,15 @@ function genericPrint$5(path$$1, options, print) {
33598
33676
  * ~
33599
33677
  * </div>
33600
33678
  */
33601
- "" : softline$7])])), printClosingTag(node)]);
33679
+ "" : softline$7])])), printClosingTag(node, options)]);
33602
33680
  }
33603
33681
 
33682
+ case "ieConditionalStartComment":
33683
+ case "ieConditionalEndComment":
33684
+ return concat$14([printOpeningTagStart(node), printClosingTagEnd(node)]);
33685
+
33604
33686
  case "interpolation":
33605
- return concat$14([printOpeningTagStart(node), concat$14(path$$1.map(print, "children")), printClosingTagEnd(node)]);
33687
+ return concat$14([printOpeningTagStart(node, options), concat$14(path$$1.map(print, "children")), printClosingTagEnd(node, options)]);
33606
33688
 
33607
33689
  case "text":
33608
33690
  {
@@ -33614,17 +33696,15 @@ function genericPrint$5(path$$1, options, print) {
33614
33696
  return concat$14([concat$14(replaceNewlines(value, literalline$6)), hasTrailingNewline ? hardline$12 : ""]);
33615
33697
  }
33616
33698
 
33617
- return fill$5(normalizeParts$1([].concat(printOpeningTagPrefix(node), getTextValueParts(node), printClosingTagSuffix(node))));
33699
+ return fill$5(normalizeParts$1([].concat(printOpeningTagPrefix(node, options), getTextValueParts(node), printClosingTagSuffix(node, options))));
33618
33700
  }
33619
33701
 
33620
33702
  case "docType":
33621
- return concat$14([group$14(concat$14([printOpeningTagStart(node), " ", node.value.replace(/^html\b/i, "html").replace(/\s+/g, " ")])), printClosingTagEnd(node)]);
33703
+ return concat$14([group$14(concat$14([printOpeningTagStart(node, options), " ", node.value.replace(/^html\b/i, "html").replace(/\s+/g, " ")])), printClosingTagEnd(node, options)]);
33622
33704
 
33623
33705
  case "comment":
33624
33706
  {
33625
- var _value = getCommentData(node);
33626
-
33627
- 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)]);
33707
+ return concat$14([printOpeningTagPrefix(node, options), concat$14(replaceNewlines(options.originalText.slice(options.locStart(node), options.locEnd(node)), literalline$6)), printClosingTagSuffix(node, options)]);
33628
33708
  }
33629
33709
 
33630
33710
  case "attribute":
@@ -33656,7 +33736,19 @@ function printChildren$1(path$$1, options, print) {
33656
33736
  return concat$14(path$$1.map(function (childPath, childIndex) {
33657
33737
  var childNode = childPath.getValue();
33658
33738
 
33659
- if (childNode.type === "text") {
33739
+ if (isTextLikeNode(childNode)) {
33740
+ if (childNode.prev && isTextLikeNode(childNode.prev)) {
33741
+ var _prevBetweenLine = printBetweenLine(childNode.prev, childNode);
33742
+
33743
+ if (_prevBetweenLine) {
33744
+ if (forceNextEmptyLine(childNode.prev)) {
33745
+ return concat$14([hardline$12, hardline$12, printChild(childPath)]);
33746
+ }
33747
+
33748
+ return concat$14([_prevBetweenLine, printChild(childPath)]);
33749
+ }
33750
+ }
33751
+
33660
33752
  return printChild(childPath);
33661
33753
  }
33662
33754
 
@@ -33673,7 +33765,7 @@ function printChildren$1(path$$1, options, print) {
33673
33765
  } else if (prevBetweenLine === hardline$12) {
33674
33766
  prevParts.push(hardline$12);
33675
33767
  } else {
33676
- if (childNode.prev.type === "text") {
33768
+ if (isTextLikeNode(childNode.prev)) {
33677
33769
  leadingParts.push(prevBetweenLine);
33678
33770
  } else {
33679
33771
  leadingParts.push(ifBreak$5("", softline$7, {
@@ -33685,11 +33777,11 @@ function printChildren$1(path$$1, options, print) {
33685
33777
 
33686
33778
  if (nextBetweenLine) {
33687
33779
  if (forceNextEmptyLine(childNode)) {
33688
- if (childNode.next.type === "text") {
33780
+ if (isTextLikeNode(childNode.next)) {
33689
33781
  nextParts.push(hardline$12, hardline$12);
33690
33782
  }
33691
33783
  } else if (nextBetweenLine === hardline$12) {
33692
- if (childNode.next.type === "text") {
33784
+ if (isTextLikeNode(childNode.next)) {
33693
33785
  nextParts.push(hardline$12);
33694
33786
  }
33695
33787
  } else {
@@ -33706,18 +33798,18 @@ function printChildren$1(path$$1, options, print) {
33706
33798
  var child = childPath.getValue();
33707
33799
 
33708
33800
  if (hasPrettierIgnore$2(child)) {
33709
- 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)));
33801
+ 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)));
33710
33802
  }
33711
33803
 
33712
- if (shouldPreserveContent(child)) {
33713
- return concat$14([].concat(printOpeningTagPrefix(child), 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).length : 0)), literalline$6), printClosingTag(child), printClosingTagSuffix(child)));
33804
+ if (shouldPreserveContent(child, options)) {
33805
+ 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)));
33714
33806
  }
33715
33807
 
33716
33808
  return print(childPath);
33717
33809
  }
33718
33810
 
33719
33811
  function printBetweenLine(prevNode, nextNode) {
33720
- return needsToBorrowNextOpeningTagStartMarker(prevNode) && (
33812
+ return isTextLikeNode(prevNode) && isTextLikeNode(nextNode) ? prevNode.isTrailingSpaceSensitive ? prevNode.hasTrailingSpaces ? preferHardlineAsLeadingSpaces(nextNode) ? hardline$12 : line$9 : "" : preferHardlineAsLeadingSpaces(nextNode) ? hardline$12 : softline$7 : needsToBorrowNextOpeningTagStartMarker(prevNode) && (
33721
33813
  /**
33722
33814
  * 123<a
33723
33815
  * ~
@@ -33756,7 +33848,7 @@ function printChildren$1(path$$1, options, print) {
33756
33848
  function printOpeningTag(path$$1, options, print) {
33757
33849
  var node = path$$1.getValue();
33758
33850
  var forceNotToBreakAttrContent = node.type === "element" && node.fullName === "script" && node.attrs.length === 1 && node.attrs[0].fullName === "src" && node.children.length === 0;
33759
- return concat$14([printOpeningTagStart(node), !node.attrs || node.attrs.length === 0 ? node.isSelfClosing ?
33851
+ return concat$14([printOpeningTagStart(node, options), !node.attrs || node.attrs.length === 0 ? node.isSelfClosing ?
33760
33852
  /**
33761
33853
  * <br />
33762
33854
  * ^
@@ -33790,24 +33882,24 @@ function printOpeningTag(path$$1, options, print) {
33790
33882
  node.isSelfClosing && needsToBorrowLastChildClosingTagEndMarker(node.parent) ? "" : node.isSelfClosing ? forceNotToBreakAttrContent ? " " : line$9 : forceNotToBreakAttrContent ? "" : softline$7]), node.isSelfClosing ? "" : printOpeningTagEnd(node)]);
33791
33883
  }
33792
33884
 
33793
- function printOpeningTagStart(node) {
33794
- return node.prev && needsToBorrowNextOpeningTagStartMarker(node.prev) ? "" : concat$14([printOpeningTagPrefix(node), printOpeningTagStartMarker(node)]);
33885
+ function printOpeningTagStart(node, options) {
33886
+ return node.prev && needsToBorrowNextOpeningTagStartMarker(node.prev) ? "" : concat$14([printOpeningTagPrefix(node, options), printOpeningTagStartMarker(node)]);
33795
33887
  }
33796
33888
 
33797
33889
  function printOpeningTagEnd(node) {
33798
33890
  return node.firstChild && needsToBorrowParentOpeningTagEndMarker(node.firstChild) ? "" : printOpeningTagEndMarker(node);
33799
33891
  }
33800
33892
 
33801
- function printClosingTag(node) {
33802
- return concat$14([node.isSelfClosing ? "" : printClosingTagStart(node), printClosingTagEnd(node)]);
33893
+ function printClosingTag(node, options) {
33894
+ return concat$14([node.isSelfClosing ? "" : printClosingTagStart(node, options), printClosingTagEnd(node, options)]);
33803
33895
  }
33804
33896
 
33805
- function printClosingTagStart(node) {
33806
- return node.lastChild && needsToBorrowParentClosingTagStartMarker(node.lastChild) ? "" : concat$14([printClosingTagPrefix(node), printClosingTagStartMarker(node)]);
33897
+ function printClosingTagStart(node, options) {
33898
+ return node.lastChild && needsToBorrowParentClosingTagStartMarker(node.lastChild) ? "" : concat$14([printClosingTagPrefix(node, options), printClosingTagStartMarker(node, options)]);
33807
33899
  }
33808
33900
 
33809
- function printClosingTagEnd(node) {
33810
- return (node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent)) ? "" : concat$14([printClosingTagEndMarker(node), printClosingTagSuffix(node)]);
33901
+ function printClosingTagEnd(node, options) {
33902
+ return (node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent)) ? "" : concat$14([printClosingTagEndMarker(node, options), printClosingTagSuffix(node, options)]);
33811
33903
  }
33812
33904
 
33813
33905
  function needsToBorrowNextOpeningTagStartMarker(node) {
@@ -33816,7 +33908,7 @@ function needsToBorrowNextOpeningTagStartMarker(node) {
33816
33908
  * ^^
33817
33909
  * >
33818
33910
  */
33819
- return node.next && node.type === "text" && node.isTrailingSpaceSensitive && !node.hasTrailingSpaces;
33911
+ return node.next && !isTextLikeNode(node.next) && isTextLikeNode(node) && node.isTrailingSpaceSensitive && !node.hasTrailingSpaces;
33820
33912
  }
33821
33913
 
33822
33914
  function needsToBorrowParentOpeningTagEndMarker(node) {
@@ -33842,7 +33934,7 @@ function needsToBorrowPrevClosingTagEndMarker(node) {
33842
33934
  * ><a
33843
33935
  * ^
33844
33936
  */
33845
- return node.prev && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces;
33937
+ return node.prev && !isTextLikeNode(node.prev) && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces;
33846
33938
  }
33847
33939
 
33848
33940
  function needsToBorrowLastChildClosingTagEndMarker(node) {
@@ -33853,7 +33945,7 @@ function needsToBorrowLastChildClosingTagEndMarker(node) {
33853
33945
  * ^
33854
33946
  * >
33855
33947
  */
33856
- return node.lastChild && node.lastChild.isTrailingSpaceSensitive && !node.lastChild.hasTrailingSpaces && getLastDescendant(node.lastChild).type !== "text";
33948
+ return node.lastChild && node.lastChild.isTrailingSpaceSensitive && !node.lastChild.hasTrailingSpaces && !isTextLikeNode(getLastDescendant(node.lastChild));
33857
33949
  }
33858
33950
 
33859
33951
  function needsToBorrowParentClosingTagStartMarker(node) {
@@ -33868,35 +33960,43 @@ function needsToBorrowParentClosingTagStartMarker(node) {
33868
33960
  * ^^^
33869
33961
  * >
33870
33962
  */
33871
- return !node.next && !node.hasTrailingSpaces && node.isTrailingSpaceSensitive && getLastDescendant(node).type === "text";
33963
+ return !node.next && !node.hasTrailingSpaces && node.isTrailingSpaceSensitive && isTextLikeNode(getLastDescendant(node));
33872
33964
  }
33873
33965
 
33874
- function printOpeningTagPrefix(node) {
33875
- return needsToBorrowParentOpeningTagEndMarker(node) ? printOpeningTagEndMarker(node.parent) : needsToBorrowPrevClosingTagEndMarker(node) ? printClosingTagEndMarker(node.prev) : "";
33966
+ function printOpeningTagPrefix(node, options) {
33967
+ return needsToBorrowParentOpeningTagEndMarker(node) ? printOpeningTagEndMarker(node.parent) : needsToBorrowPrevClosingTagEndMarker(node) ? printClosingTagEndMarker(node.prev, options) : "";
33876
33968
  }
33877
33969
 
33878
- function printClosingTagPrefix(node) {
33879
- return needsToBorrowLastChildClosingTagEndMarker(node) ? printClosingTagEndMarker(node.lastChild) : "";
33970
+ function printClosingTagPrefix(node, options) {
33971
+ return needsToBorrowLastChildClosingTagEndMarker(node) ? printClosingTagEndMarker(node.lastChild, options) : "";
33880
33972
  }
33881
33973
 
33882
- function printClosingTagSuffix(node) {
33883
- return needsToBorrowParentClosingTagStartMarker(node) ? printClosingTagStartMarker(node.parent) : needsToBorrowNextOpeningTagStartMarker(node) ? printOpeningTagStartMarker(node.next) : "";
33974
+ function printClosingTagSuffix(node, options) {
33975
+ return needsToBorrowParentClosingTagStartMarker(node) ? printClosingTagStartMarker(node.parent, options) : needsToBorrowNextOpeningTagStartMarker(node) ? printOpeningTagStartMarker(node.next) : "";
33884
33976
  }
33885
33977
 
33886
33978
  function printOpeningTagStartMarker(node) {
33887
33979
  switch (node.type) {
33888
- case "comment":
33889
- return "<!--";
33890
-
33891
33980
  case "ieConditionalComment":
33981
+ case "ieConditionalStartComment":
33892
33982
  return `<!--[if ${node.condition}`;
33893
33983
 
33984
+ case "ieConditionalEndComment":
33985
+ return `<!--<!`;
33986
+
33894
33987
  case "interpolation":
33895
33988
  return "{{";
33896
33989
 
33897
33990
  case "docType":
33898
33991
  return "<!DOCTYPE";
33899
33992
 
33993
+ case "element":
33994
+ if (node.condition) {
33995
+ return `<!--[if ${node.condition}]><!--><${node.rawName}`;
33996
+ }
33997
+
33998
+ // fall through
33999
+
33900
34000
  default:
33901
34001
  return `<${node.rawName}`;
33902
34002
  }
@@ -33909,15 +34009,22 @@ function printOpeningTagEndMarker(node) {
33909
34009
  case "ieConditionalComment":
33910
34010
  return "]>";
33911
34011
 
34012
+ case "element":
34013
+ if (node.condition) {
34014
+ return `><!--<![endif]-->`;
34015
+ }
34016
+
34017
+ // fall through
34018
+
33912
34019
  default:
33913
34020
  return `>`;
33914
34021
  }
33915
34022
  }
33916
34023
 
33917
- function printClosingTagStartMarker(node) {
34024
+ function printClosingTagStartMarker(node, options) {
33918
34025
  assert(!node.isSelfClosing);
33919
34026
 
33920
- if (shouldNotPrintClosingTag(node)) {
34027
+ if (shouldNotPrintClosingTag(node, options)) {
33921
34028
  return "";
33922
34029
  }
33923
34030
 
@@ -33925,23 +34032,31 @@ function printClosingTagStartMarker(node) {
33925
34032
  case "ieConditionalComment":
33926
34033
  return "<!";
33927
34034
 
34035
+ case "element":
34036
+ if (node.hasHtmComponentClosingTag) {
34037
+ return "<//";
34038
+ }
34039
+
34040
+ // fall through
34041
+
33928
34042
  default:
33929
34043
  return `</${node.rawName}`;
33930
34044
  }
33931
34045
  }
33932
34046
 
33933
- function printClosingTagEndMarker(node) {
33934
- if (shouldNotPrintClosingTag(node)) {
34047
+ function printClosingTagEndMarker(node, options) {
34048
+ if (shouldNotPrintClosingTag(node, options)) {
33935
34049
  return "";
33936
34050
  }
33937
34051
 
33938
34052
  switch (node.type) {
33939
- case "comment":
33940
- return "-->";
33941
-
33942
34053
  case "ieConditionalComment":
34054
+ case "ieConditionalEndComment":
33943
34055
  return `[endif]-->`;
33944
34056
 
34057
+ case "ieConditionalStartComment":
34058
+ return `]><!-->`;
34059
+
33945
34060
  case "interpolation":
33946
34061
  return "}}";
33947
34062
 
@@ -33959,7 +34074,7 @@ function printClosingTagEndMarker(node) {
33959
34074
 
33960
34075
  function getTextValueParts(node) {
33961
34076
  var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : node.value;
33962
- return node.isWhitespaceSensitive ? node.isIndentationSensitive ? replaceNewlines(value, literalline$6) : replaceNewlines(dedentString(value.replace(/^\s*?\n|\n\s*?$/g, "")), hardline$12) : // non-breaking whitespace: 0xA0
34077
+ 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
33963
34078
  join$10(line$9, value.split(/[^\S\xA0]+/)).parts;
33964
34079
  }
33965
34080
 
@@ -34034,15 +34149,11 @@ function printEmbeddedAttributeValue(node, originalTextToDoc, options) {
34034
34149
  var jsExpressionBindingPatterns = ["^v-"];
34035
34150
 
34036
34151
  if (isKeyMatched(vueEventBindingPatterns)) {
34037
- // copied from https://github.com/vuejs/vue/blob/v2.5.17/src/compiler/codegen/events.js#L3-L4
34038
- var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
34039
- var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
34040
- var value = getValue() // https://github.com/vuejs/vue/blob/v2.5.17/src/compiler/helpers.js#L104
34041
- .trim();
34042
- return printMaybeHug(simplePathRE.test(value) || fnExpRE.test(value) ? textToDoc(value, {
34152
+ var value = getValue();
34153
+ return printMaybeHug(isVueEventBindingExpression$2(value) ? textToDoc(value, {
34043
34154
  parser: "__js_expression"
34044
34155
  }) : stripTrailingHardline$2(textToDoc(value, {
34045
- parser: "babylon"
34156
+ parser: "__vue_event_binding"
34046
34157
  })));
34047
34158
  }
34048
34159
 
@@ -34105,6 +34216,30 @@ function printEmbeddedAttributeValue(node, originalTextToDoc, options) {
34105
34216
  parser: "__ng_directive"
34106
34217
  }));
34107
34218
  }
34219
+
34220
+ var interpolationRegex = /\{\{([\s\S]+?)\}\}/g;
34221
+
34222
+ var _value = getValue();
34223
+
34224
+ if (interpolationRegex.test(_value)) {
34225
+ var parts = [];
34226
+
34227
+ _value.split(interpolationRegex).forEach(function (part, index) {
34228
+ if (index % 2 === 0) {
34229
+ parts.push(concat$14(replaceNewlines(part, literalline$6)));
34230
+ } else {
34231
+ try {
34232
+ parts.push(group$14(concat$14(["{{", indent$9(concat$14([line$9, ngTextToDoc(part, {
34233
+ parser: "__ng_interpolation"
34234
+ })])), line$9, "}}"])));
34235
+ } catch (e) {
34236
+ parts.push("{{", concat$14(replaceNewlines(part, literalline$6)), "}}");
34237
+ }
34238
+ }
34239
+ });
34240
+
34241
+ return group$14(concat$14(parts));
34242
+ }
34108
34243
  }
34109
34244
 
34110
34245
  return null;
@@ -34567,7 +34702,7 @@ var conditionalGroup$2 = docBuilders$3.conditionalGroup;
34567
34702
  var breakParent$4 = docBuilders$3.breakParent;
34568
34703
  var concat$18 = docBuilders$3.concat;
34569
34704
  var dedent$4 = docBuilders$3.dedent;
34570
- var dedentToRoot$2 = docBuilders$3.dedentToRoot;
34705
+ var dedentToRoot$3 = docBuilders$3.dedentToRoot;
34571
34706
  var fill$6 = docBuilders$3.fill;
34572
34707
  var group$16 = docBuilders$3.group;
34573
34708
  var hardline$13 = docBuilders$3.hardline;
@@ -34641,7 +34776,7 @@ function _print(node, parentNode, path$$1, options, print) {
34641
34776
  case "document":
34642
34777
  {
34643
34778
  var nextDocument = parentNode.children[path$$1.getName() + 1];
34644
- 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));
34779
+ 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));
34645
34780
  }
34646
34781
 
34647
34782
  case "documentHead":
@@ -34710,12 +34845,12 @@ function _print(node, parentNode, path$$1, options, print) {
34710
34845
  return isNode$1(ancestorNode, ["sequence", "mapping"]);
34711
34846
  });
34712
34847
  var isLastDescendant = isLastDescendantNode(path$$1);
34713
- 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$2)(align$3(node.indent === null ? options.tabWidth : node.indent - 1 + parentIndent, concat$18(getBlockValueLineContents(node, {
34848
+ 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, {
34714
34849
  parentIndent,
34715
34850
  isLastDescendant,
34716
34851
  options
34717
34852
  }).reduce(function (reduced, lineWords, index, lineContents) {
34718
- 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$2(hardline$13) : dedentToRoot$2(literalline$7) : "");
34853
+ 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) : "");
34719
34854
  }, []))))]);
34720
34855
  }
34721
34856
 
@@ -34863,8 +34998,13 @@ function shouldPrintDocumentEndMarker(document, nextDocument) {
34863
34998
  );
34864
34999
  }
34865
35000
 
34866
- function shouldPrintDocumentHeadEndMarker(document, nextDocument) {
35001
+ function shouldPrintDocumentHeadEndMarker(document, nextDocument, root, options) {
34867
35002
  if (
35003
+ /**
35004
+ * ---
35005
+ * preserve the first document head end marker
35006
+ */
35007
+ root.children[0] === document && /---(\s|$)/.test(options.originalText.slice(options.locStart(document), options.locStart(document) + 4)) ||
34868
35008
  /**
34869
35009
  * %DIRECTIVE
34870
35010
  * ---
@@ -35078,6 +35218,10 @@ languageJs, {
35078
35218
  return require("./parser-babylon").parsers.__vue_expression;
35079
35219
  },
35080
35220
 
35221
+ get __vue_event_binding() {
35222
+ return require("./parser-babylon").parsers.__vue_event_binding;
35223
+ },
35224
+
35081
35225
  // JS - Flow
35082
35226
  get flow() {
35083
35227
  return require("./parser-flow").parsers.flow;
@@ -39390,8 +39534,31 @@ unwrapExports(src$2);
39390
39534
 
39391
39535
  var editorconfigToPrettier = editorConfigToPrettier;
39392
39536
 
39537
+ function removeUnset(editorConfig) {
39538
+ var result = {};
39539
+ var keys = Object.keys(editorConfig);
39540
+
39541
+ for (var i = 0; i < keys.length; i++) {
39542
+ var key = keys[i];
39543
+
39544
+ if (editorConfig[key] === "unset") {
39545
+ continue;
39546
+ }
39547
+
39548
+ result[key] = editorConfig[key];
39549
+ }
39550
+
39551
+ return result;
39552
+ }
39553
+
39393
39554
  function editorConfigToPrettier(editorConfig) {
39394
- if (!editorConfig || Object.keys(editorConfig).length === 0) {
39555
+ if (!editorConfig) {
39556
+ return null;
39557
+ }
39558
+
39559
+ editorConfig = removeUnset(editorConfig);
39560
+
39561
+ if (Object.keys(editorConfig).length === 0) {
39395
39562
  return null;
39396
39563
  }
39397
39564
 
@@ -43043,9 +43210,8 @@ function listDifferent(context, input, options$$2, filename) {
43043
43210
  if (!prettier$2.check(input, options$$2)) {
43044
43211
  if (!context.argv["write"]) {
43045
43212
  context.logger.log(filename);
43213
+ process.exitCode = 1;
43046
43214
  }
43047
-
43048
- process.exitCode = 1;
43049
43215
  }
43050
43216
  } catch (error) {
43051
43217
  context.logger.error(error.message);
@@ -43354,7 +43520,10 @@ function formatFiles(context) {
43354
43520
 
43355
43521
  if (context.argv["list-different"] && isDifferent) {
43356
43522
  context.logger.log(filename);
43357
- process.exitCode = 1;
43523
+
43524
+ if (!context.argv["write"]) {
43525
+ process.exitCode = 1;
43526
+ }
43358
43527
  }
43359
43528
 
43360
43529
  if (context.argv["write"]) {