prettier 2.0.1 → 2.0.5

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/standalone.js CHANGED
@@ -5,7 +5,7 @@
5
5
  }(this, (function () { 'use strict';
6
6
 
7
7
  var name = "prettier";
8
- var version = "2.0.1";
8
+ var version = "2.0.5";
9
9
  var description = "Prettier is an opinionated code formatter";
10
10
  var bin = "./bin/prettier.js";
11
11
  var repository = "prettier/prettier";
@@ -19,14 +19,14 @@
19
19
  var dependencies = {
20
20
  "@angular/compiler": "9.0.5",
21
21
  "@babel/code-frame": "7.8.0",
22
- "@babel/parser": "7.9.2",
23
- "@glimmer/syntax": "0.48.0",
22
+ "@babel/parser": "7.9.4",
23
+ "@glimmer/syntax": "0.50.0",
24
24
  "@iarna/toml": "2.2.3",
25
- "@typescript-eslint/typescript-estree": "2.24.0",
25
+ "@typescript-eslint/typescript-estree": "2.26.0",
26
26
  "angular-estree-parser": "1.3.0",
27
27
  "angular-html-parser": "1.4.0",
28
28
  camelcase: "5.3.1",
29
- chalk: "3.0.0",
29
+ chalk: "4.0.0",
30
30
  "ci-info": "watson/ci-info#f43f6a1cefff47fb361c88cf4b943fdbcaafe540",
31
31
  "cjk-regex": "2.0.0",
32
32
  cosmiconfig: "6.0.0",
@@ -40,24 +40,25 @@
40
40
  "fast-glob": "3.2.2",
41
41
  "find-parent-dir": "0.3.0",
42
42
  "find-project-root": "1.1.1",
43
- "flow-parser": "0.121.0",
43
+ "flow-parser": "0.122.0",
44
44
  "get-stream": "5.1.0",
45
45
  globby: "11.0.0",
46
- graphql: "14.6.0",
46
+ graphql: "15.0.0",
47
47
  "html-element-attributes": "2.2.1",
48
48
  "html-styles": "1.0.0",
49
49
  "html-tag-names": "1.1.5",
50
50
  ignore: "4.0.6",
51
- "jest-docblock": "25.1.0",
51
+ "jest-docblock": "25.2.6",
52
52
  "json-stable-stringify": "1.0.1",
53
53
  leven: "3.1.0",
54
54
  "lines-and-columns": "1.1.6",
55
- "linguist-languages": "7.8.0",
55
+ "linguist-languages": "7.9.0",
56
56
  lodash: "4.17.15",
57
57
  mem: "6.0.1",
58
58
  minimatch: "3.0.4",
59
59
  minimist: "1.2.5",
60
60
  "n-readlines": "1.0.0",
61
+ "please-upgrade-node": "3.2.0",
61
62
  "postcss-less": "3.1.4",
62
63
  "postcss-media-query-parser": "0.2.3",
63
64
  "postcss-scss": "2.0.0",
@@ -66,45 +67,45 @@
66
67
  "regexp-util": "1.2.2",
67
68
  "remark-math": "1.0.6",
68
69
  "remark-parse": "5.0.0",
70
+ resolve: "1.16.1",
69
71
  semver: "7.1.3",
70
72
  srcset: "2.0.1",
71
73
  "string-width": "4.2.0",
72
74
  typescript: "3.8.3",
73
75
  "unicode-regex": "3.0.0",
74
- unified: "8.4.2",
76
+ unified: "9.0.0",
75
77
  vnopts: "1.0.2",
76
78
  "yaml-unist-parser": "1.1.1"
77
79
  };
78
80
  var devDependencies = {
79
- "@babel/core": "7.8.7",
80
- "@babel/preset-env": "7.8.7",
81
+ "@babel/core": "7.9.0",
82
+ "@babel/preset-env": "7.9.0",
81
83
  "@rollup/plugin-alias": "3.0.1",
82
84
  "@rollup/plugin-commonjs": "11.0.2",
83
85
  "@rollup/plugin-json": "4.0.2",
84
86
  "@rollup/plugin-node-resolve": "7.1.1",
85
87
  "@rollup/plugin-replace": "2.3.1",
86
- "babel-loader": "8.0.6",
88
+ "babel-loader": "8.1.0",
87
89
  benchmark: "2.1.4",
88
90
  "builtin-modules": "3.1.0",
89
91
  codecov: "3.6.5",
90
92
  "cross-env": "7.0.2",
91
93
  cspell: "4.0.55",
92
94
  eslint: "6.8.0",
93
- "eslint-config-prettier": "6.10.0",
95
+ "eslint-config-prettier": "6.10.1",
94
96
  "eslint-formatter-friendly": "7.0.0",
95
- "eslint-plugin-import": "2.20.1",
97
+ "eslint-plugin-import": "2.20.2",
96
98
  "eslint-plugin-prettier": "3.1.2",
97
99
  "eslint-plugin-react": "7.19.0",
98
- "eslint-plugin-unicorn": "17.2.0",
100
+ "eslint-plugin-unicorn": "18.0.1",
99
101
  execa: "4.0.0",
100
- jest: "25.1.0",
101
- "jest-junit": "10.0.0",
102
+ jest: "25.2.7",
102
103
  "jest-snapshot-serializer-ansi": "1.0.0",
103
104
  "jest-snapshot-serializer-raw": "1.1.0",
104
- "jest-watch-typeahead": "0.4.2",
105
- prettier: "2.0.0",
105
+ "jest-watch-typeahead": "0.5.0",
106
+ prettier: "2.0.4",
106
107
  rimraf: "3.0.2",
107
- rollup: "2.1.0",
108
+ rollup: "2.3.2",
108
109
  "rollup-plugin-babel": "4.4.0",
109
110
  "rollup-plugin-node-globals": "1.4.0",
110
111
  "rollup-plugin-terser": "5.3.0",
@@ -114,13 +115,14 @@
114
115
  "synchronous-promise": "2.0.10",
115
116
  tempy: "0.5.0",
116
117
  "terser-webpack-plugin": "2.3.5",
117
- webpack: "4.42.0"
118
+ webpack: "4.42.1"
118
119
  };
119
120
  var scripts = {
120
121
  prepublishOnly: "echo \"Error: must publish from dist/\" && exit 1",
121
122
  "prepare-release": "yarn && yarn build && yarn test:dist",
122
123
  test: "jest",
123
- "test:dist": "node ./scripts/test-dist.js",
124
+ "test:dist": "cross-env NODE_ENV=production jest",
125
+ "test:dist-standalone": "cross-env NODE_ENV=production TEST_STANDALONE=1 jest tests/",
124
126
  "test:integration": "jest tests_integration",
125
127
  "perf:repeat": "yarn && yarn build && cross-env NODE_ENV=production node ./dist/bin-prettier.js --debug-repeat ${PERF_REPEAT:-1000} --loglevel debug ${PERF_FILE:-./index.js} > /dev/null",
126
128
  "perf:repeat-inspect": "yarn && yarn build && cross-env NODE_ENV=production node --inspect-brk ./dist/bin-prettier.js --debug-repeat ${PERF_REPEAT:-1000} --loglevel debug ${PERF_FILE:-./index.js} > /dev/null",
@@ -130,7 +132,7 @@
130
132
  "lint:changelog": "node ./scripts/lint-changelog.js",
131
133
  "lint:prettier": "prettier \"**/*.{md,json,yml,html,css}\" --check",
132
134
  "lint:dist": "eslint --no-eslintrc --no-ignore --env=es6,browser --parser-options=ecmaVersion:2016 \"dist/!(bin-prettier|index|third-party).js\"",
133
- "lint:spellcheck": "cspell {bin,scripts,src}/**/*.js {docs,website/blog,changelog_unreleased}/**/*.md",
135
+ "lint:spellcheck": "cspell {bin,scripts,src,website}/**/*.js {docs,website/blog,changelog_unreleased}/**/*.md",
134
136
  "lint:deps": "node ./scripts/check-deps.js",
135
137
  build: "node --max-old-space-size=3072 ./scripts/build/build.js",
136
138
  "build-docs": "node ./scripts/build-docs.js"
@@ -10178,7 +10180,7 @@
10178
10180
  const TEMPLATE_REGEX$1 = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
10179
10181
  const STYLE_REGEX$1 = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
10180
10182
  const STRING_REGEX$1 = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
10181
- const ESCAPE_REGEX$1 = /\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi;
10183
+ const ESCAPE_REGEX$1 = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
10182
10184
  const ESCAPES$1 = new Map([['n', '\n'], ['r', '\r'], ['t', '\t'], ['b', '\b'], ['f', '\f'], ['v', '\v'], ['0', '\0'], ['\\', '\\'], ['e', '\u001B'], ['a', '\u0007']]);
10183
10185
 
10184
10186
  function unescape$1(c) {
@@ -10292,8 +10294,8 @@
10292
10294
  chunks.push(chunk.join(''));
10293
10295
 
10294
10296
  if (styles.length > 0) {
10295
- const errMsg = "Chalk template literal is missing ".concat(styles.length, " closing bracket").concat(styles.length === 1 ? '' : 's', " (`}`)");
10296
- throw new Error(errMsg);
10297
+ const errMessage = "Chalk template literal is missing ".concat(styles.length, " closing bracket").concat(styles.length === 1 ? '' : 's', " (`}`)");
10298
+ throw new Error(errMessage);
10297
10299
  }
10298
10300
 
10299
10301
  return chunks.join('');
@@ -10312,7 +10314,7 @@
10312
10314
  const styles = Object.create(null);
10313
10315
 
10314
10316
  const applyOptions = (object, options = {}) => {
10315
- if (options.level > 3 || options.level < 0) {
10317
+ if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
10316
10318
  throw new Error('The `level` option should be an integer from 0 to 3');
10317
10319
  } // Detect level if not set manually
10318
10320
 
@@ -10323,6 +10325,7 @@
10323
10325
 
10324
10326
  class ChalkClass {
10325
10327
  constructor(options) {
10328
+ // eslint-disable-next-line no-constructor-return
10326
10329
  return chalkFactory(options);
10327
10330
  }
10328
10331
 
@@ -10446,12 +10449,11 @@
10446
10449
  // Single argument is hot path, implicit coercion is faster than anything
10447
10450
  // eslint-disable-next-line no-implicit-coercion
10448
10451
  return applyStyle(builder, arguments_.length === 1 ? '' + arguments_[0] : arguments_.join(' '));
10449
- }; // `__proto__` is used because we must return a function, but there is
10452
+ }; // We alter the prototype because we must return a function, but there is
10450
10453
  // no way to create a function with a different prototype
10451
10454
 
10452
10455
 
10453
- builder.__proto__ = proto; // eslint-disable-line no-proto
10454
-
10456
+ Object.setPrototypeOf(builder, proto);
10455
10457
  builder._generator = self;
10456
10458
  builder._styler = _styler;
10457
10459
  builder._isEmpty = _isEmpty;
@@ -10529,18 +10531,7 @@
10529
10531
  level: stderrColor ? stderrColor.level : 0
10530
10532
  }); // eslint-disable-line new-cap
10531
10533
 
10532
- chalk$1.stderr.supportsColor = stderrColor; // For TypeScript
10533
-
10534
- chalk$1.Level = {
10535
- None: 0,
10536
- Basic: 1,
10537
- Ansi256: 2,
10538
- TrueColor: 3,
10539
- 0: 'None',
10540
- 1: 'Basic',
10541
- 2: 'Ansi256',
10542
- 3: 'TrueColor'
10543
- };
10534
+ chalk$1.stderr.supportsColor = stderrColor;
10544
10535
  var source = chalk$1;
10545
10536
 
10546
10537
  const cliDescriptor = {
@@ -13842,6 +13833,7 @@
13842
13833
  try {
13843
13834
  fd = fs.openSync(filepath, "r");
13844
13835
  } catch (err) {
13836
+ // istanbul ignore next
13845
13837
  return "";
13846
13838
  }
13847
13839
 
@@ -13878,13 +13870,20 @@
13878
13870
  }
13879
13871
 
13880
13872
  function inferParser(filepath, plugins) {
13881
- const filename = path.basename(filepath).toLowerCase(); // If the file has no extension, we can try to infer the language from the
13873
+ const filename = path.basename(filepath).toLowerCase();
13874
+ const languages = getSupportInfo$1({
13875
+ plugins
13876
+ }).languages.filter(language => language.since !== null); // If the file has no extension, we can try to infer the language from the
13882
13877
  // interpreter in the shebang line, if any; but since this requires FS access,
13883
13878
  // do it last.
13884
13879
 
13885
- const language = getSupportInfo$1({
13886
- plugins
13887
- }).languages.find(language => language.since !== null && (language.extensions && language.extensions.some(extension => filename.endsWith(extension)) || language.filenames && language.filenames.find(name => name.toLowerCase() === filename) || !filename.includes(".") && language.interpreters && language.interpreters.includes(getInterpreter(filepath))));
13880
+ let language = languages.find(language => language.extensions && language.extensions.some(extension => filename.endsWith(extension)) || language.filenames && language.filenames.find(name => name.toLowerCase() === filename));
13881
+
13882
+ if (!language && !filename.includes(".")) {
13883
+ const interpreter = getInterpreter(filepath);
13884
+ language = languages.find(language => language.interpreters && language.interpreters.includes(interpreter));
13885
+ }
13886
+
13888
13887
  return language && language.parsers[0];
13889
13888
  }
13890
13889
 
@@ -14984,7 +14983,11 @@
14984
14983
  }
14985
14984
 
14986
14985
  function hasNodeIgnoreComment(node) {
14987
- return node && node.comments && node.comments.length > 0 && node.comments.some(comment => comment.value.trim() === "prettier-ignore");
14986
+ return node && (node.comments && node.comments.length > 0 && node.comments.some(comment => isNodeIgnoreComment(comment) && !comment.unignore) || node.prettierIgnore);
14987
+ }
14988
+
14989
+ function isNodeIgnoreComment(comment) {
14990
+ return comment.value.trim() === "prettier-ignore";
14988
14991
  }
14989
14992
 
14990
14993
  function addCommentHelper(node, comment) {
@@ -15084,6 +15087,7 @@
15084
15087
  printNumber,
15085
15088
  hasIgnoreComment,
15086
15089
  hasNodeIgnoreComment,
15090
+ isNodeIgnoreComment,
15087
15091
  makeString,
15088
15092
  addLeadingComment,
15089
15093
  addDanglingComment,
@@ -15396,8 +15400,9 @@
15396
15400
  const [ind, mode, doc] = cmds.pop();
15397
15401
 
15398
15402
  if (typeof doc === "string") {
15399
- out.push(doc);
15400
- pos += getStringWidth$1(doc);
15403
+ const formatted = newLine !== "\n" && doc.includes("\n") ? doc.replace(/\n/g, newLine) : doc;
15404
+ out.push(formatted);
15405
+ pos += getStringWidth$1(formatted);
15401
15406
  } else {
15402
15407
  switch (doc.type) {
15403
15408
  case "cursor":
@@ -17067,9 +17072,6 @@
17067
17072
  convertEndOfLineToChars: convertEndOfLineToChars$2
17068
17073
  } = endOfLine;
17069
17074
  const {
17070
- utils: {
17071
- mapDoc: mapDoc$1
17072
- },
17073
17075
  printer: {
17074
17076
  printDocToString: printDocToString$1
17075
17077
  },
@@ -17091,7 +17093,7 @@
17091
17093
  }
17092
17094
 
17093
17095
  for (let i = 0; i < astComments.length; ++i) {
17094
- if (astComments[i].value.trim() === "prettier-ignore") {
17096
+ if (util$1.isNodeIgnoreComment(astComments[i])) {
17095
17097
  // If there's a prettier-ignore, we're not printing that sub-tree so we
17096
17098
  // don't know if the comments was printed or not.
17097
17099
  return;
@@ -17145,8 +17147,7 @@
17145
17147
 
17146
17148
  const astComments = attachComments(text, ast, opts);
17147
17149
  const doc = astToDoc(ast, opts, addAlignmentSize);
17148
- const eol = convertEndOfLineToChars$2(opts.endOfLine);
17149
- const result = printDocToString$1(opts.endOfLine === "lf" ? doc : mapDoc$1(doc, currentDoc => typeof currentDoc === "string" && currentDoc.includes("\n") ? currentDoc.replace(/\n/g, eol) : currentDoc), opts);
17150
+ const result = printDocToString$1(doc, opts);
17150
17151
  ensureAllCommentsPrinted(astComments); // Remove extra leading indentation as well as the added indentation after last newline
17151
17152
 
17152
17153
  if (addAlignmentSize > 0) {
@@ -17552,7 +17553,7 @@
17552
17553
  markAsRoot: markAsRoot$1
17553
17554
  },
17554
17555
  utils: {
17555
- mapDoc: mapDoc$2
17556
+ mapDoc: mapDoc$1
17556
17557
  }
17557
17558
  } = document;
17558
17559
 
@@ -17570,7 +17571,7 @@
17570
17571
  return null;
17571
17572
 
17572
17573
  function replaceNewlinesWithLiterallines(doc) {
17573
- return mapDoc$2(doc, currentDoc => typeof currentDoc === "string" && currentDoc.includes("\n") ? concat$4(currentDoc.split(/(\n)/g).map((v, i) => i % 2 === 0 ? v : literalline$1)) : currentDoc);
17574
+ return mapDoc$1(doc, currentDoc => typeof currentDoc === "string" && currentDoc.includes("\n") ? concat$4(currentDoc.split(/(\n)/g).map((v, i) => i % 2 === 0 ? v : literalline$1)) : currentDoc);
17574
17575
  }
17575
17576
  }
17576
17577
 
@@ -18041,7 +18042,7 @@
18041
18042
 
18042
18043
  function isSCSS(parser, text) {
18043
18044
  const hasExplicitParserChoice = parser === "less" || parser === "scss";
18044
- const IS_POSSIBLY_SCSS = /(\w\s*: [^}:]+|#){|@import[^\n]+(url|,)/;
18045
+ const IS_POSSIBLY_SCSS = /(\w\s*:\s*[^}:]+|#){|@import[^\n]+(?:url|,)/;
18045
18046
  return hasExplicitParserChoice ? parser === "scss" : IS_POSSIBLY_SCSS.test(text);
18046
18047
  }
18047
18048
 
@@ -18485,7 +18486,7 @@
18485
18486
  return concat$5(["@", // If a Less file ends up being parsed with the SCSS parser, Less
18486
18487
  // variable declarations will be parsed as at-rules with names ending
18487
18488
  // with a colon, so keep the original case then.
18488
- isDetachedRulesetCallNode$1(node) || node.name.endsWith(":") ? node.name : maybeToLowerCase$1(node.name), node.params ? concat$5([isDetachedRulesetCallNode$1(node) ? "" : isTemplatePlaceholderNode$1(node) && /^\s*\n/.test(node.raws.afterName) ? /^\s*\n\s*\n/.test(node.raws.afterName) ? concat$5([hardline$4, hardline$4]) : hardline$4 : " ", path.call(print, "params")]) : "", node.selector ? indent$2(concat$5([" ", path.call(print, "selector")])) : "", node.value ? group$1(concat$5([" ", path.call(print, "value"), isSCSSControlDirectiveNode$1(node) ? hasParensAroundNode$1(node) ? " " : line$2 : ""])) : node.name === "else" ? " " : "", node.nodes ? concat$5([isSCSSControlDirectiveNode$1(node) ? "" : " ", "{", indent$2(concat$5([node.nodes.length > 0 ? softline$1 : "", printNodeSequence(path, options, print)])), softline$1, "}"]) : isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"]);
18489
+ isDetachedRulesetCallNode$1(node) || node.name.endsWith(":") ? node.name : maybeToLowerCase$1(node.name), node.params ? concat$5([isDetachedRulesetCallNode$1(node) ? "" : isTemplatePlaceholderNode$1(node) ? node.raws.afterName === "" ? "" : node.name.endsWith(":") ? " " : /^\s*\n\s*\n/.test(node.raws.afterName) ? concat$5([hardline$4, hardline$4]) : /^\s*\n/.test(node.raws.afterName) ? hardline$4 : " " : " ", path.call(print, "params")]) : "", node.selector ? indent$2(concat$5([" ", path.call(print, "selector")])) : "", node.value ? group$1(concat$5([" ", path.call(print, "value"), isSCSSControlDirectiveNode$1(node) ? hasParensAroundNode$1(node) ? " " : line$2 : ""])) : node.name === "else" ? " " : "", node.nodes ? concat$5([isSCSSControlDirectiveNode$1(node) ? "" : " ", "{", indent$2(concat$5([node.nodes.length > 0 ? softline$1 : "", printNodeSequence(path, options, print)])), softline$1, "}"]) : isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"]);
18489
18490
  }
18490
18491
  // postcss-media-query-parser
18491
18492
 
@@ -18691,6 +18692,11 @@
18691
18692
 
18692
18693
  if (!iNextNode) {
18693
18694
  continue;
18695
+ } // styled.div` background: var(--${one}); `
18696
+
18697
+
18698
+ if (!iPrevNode && iNode.value === "--" && iNextNode.type === "value-atword") {
18699
+ continue;
18694
18700
  } // Ignore spaces before/after string interpolation (i.e. `"#{my-fn("_")}"`)
18695
18701
 
18696
18702
 
@@ -21344,7 +21350,7 @@
21344
21350
  }
21345
21351
 
21346
21352
  function isScriptLikeTag(node) {
21347
- return node.type === "element" && (node.fullName === "script" || node.fullName === "style" || node.fullName === "svg:style");
21353
+ return node.type === "element" && (node.fullName === "script" || node.fullName === "style" || node.fullName === "svg:style" || isUnknownNamespace(node) && (node.name === "script" || node.name === "style"));
21348
21354
  }
21349
21355
 
21350
21356
  function isFrontMatterNode(node) {
@@ -22345,7 +22351,7 @@
22345
22351
  builders,
22346
22352
  utils: {
22347
22353
  stripTrailingHardline: stripTrailingHardline$1,
22348
- mapDoc: mapDoc$3
22354
+ mapDoc: mapDoc$2
22349
22355
  }
22350
22356
  } = document;
22351
22357
  const {
@@ -22459,7 +22465,7 @@
22459
22465
  }, opts)), options);
22460
22466
 
22461
22467
  if (embeddedAttributeValueDoc) {
22462
- return concat$a([node.rawName, '="', group$9(mapDoc$3(embeddedAttributeValueDoc, doc => typeof doc === "string" ? doc.replace(/"/g, "&quot;") : doc)), '"']);
22468
+ return concat$a([node.rawName, '="', group$9(mapDoc$2(embeddedAttributeValueDoc, doc => typeof doc === "string" ? doc.replace(/"/g, "&quot;") : doc)), '"']);
22463
22469
  }
22464
22470
 
22465
22471
  break;
@@ -22667,7 +22673,7 @@
22667
22673
  }
22668
22674
 
22669
22675
  function printBetweenLine(prevNode, nextNode) {
22670
- return isTextLikeNode$1(prevNode) && isTextLikeNode$1(nextNode) ? prevNode.isTrailingSpaceSensitive ? prevNode.hasTrailingSpaces ? preferHardlineAsLeadingSpaces$1(nextNode) ? hardline$7 : line$6 : "" : preferHardlineAsLeadingSpaces$1(nextNode) ? hardline$7 : softline$4 : needsToBorrowNextOpeningTagStartMarker(prevNode) && (
22676
+ return isTextLikeNode$1(prevNode) && isTextLikeNode$1(nextNode) ? prevNode.isTrailingSpaceSensitive ? prevNode.hasTrailingSpaces ? preferHardlineAsLeadingSpaces$1(nextNode) ? hardline$7 : line$6 : "" : preferHardlineAsLeadingSpaces$1(nextNode) ? hardline$7 : softline$4 : needsToBorrowNextOpeningTagStartMarker(prevNode) && (hasPrettierIgnore$3(nextNode) ||
22671
22677
  /**
22672
22678
  * 123<a
22673
22679
  * ~
@@ -23638,8 +23644,22 @@
23638
23644
 
23639
23645
  function handleUnionTypeComments(precedingNode, enclosingNode, followingNode, comment) {
23640
23646
  if (enclosingNode && (enclosingNode.type === "UnionTypeAnnotation" || enclosingNode.type === "TSUnionType")) {
23641
- addTrailingComment$3(precedingNode, comment);
23642
- return true;
23647
+ if (util$1.isNodeIgnoreComment(comment)) {
23648
+ followingNode.prettierIgnore = true;
23649
+ comment.unignore = true;
23650
+ }
23651
+
23652
+ if (precedingNode) {
23653
+ addTrailingComment$3(precedingNode, comment);
23654
+ return true;
23655
+ }
23656
+
23657
+ return false;
23658
+ }
23659
+
23660
+ if (followingNode && (followingNode.type === "UnionTypeAnnotation" || followingNode.type === "TSUnionType") && util$1.isNodeIgnoreComment(comment)) {
23661
+ followingNode.types[0].prettierIgnore = true;
23662
+ comment.unignore = true;
23643
23663
  }
23644
23664
 
23645
23665
  return false;
@@ -23825,7 +23845,7 @@
23825
23845
  dedentToRoot: dedentToRoot$2
23826
23846
  },
23827
23847
  utils: {
23828
- mapDoc: mapDoc$4,
23848
+ mapDoc: mapDoc$3,
23829
23849
  stripTrailingHardline: stripTrailingHardline$2
23830
23850
  }
23831
23851
  } = document;
@@ -23848,7 +23868,7 @@
23848
23868
  return idx === 0 ? currVal : prevVal + "@prettier-placeholder-" + placeholderID++ + "-id" + currVal;
23849
23869
  }, "");
23850
23870
  const doc = textToDoc(text, {
23851
- parser: "css"
23871
+ parser: "scss"
23852
23872
  });
23853
23873
  return transformCssDoc(doc, path, print);
23854
23874
  }
@@ -23974,7 +23994,7 @@
23974
23994
  }
23975
23995
 
23976
23996
  function escapeTemplateCharacters(doc, raw) {
23977
- return mapDoc$4(doc, currentDoc => {
23997
+ return mapDoc$3(doc, currentDoc => {
23978
23998
  if (!currentDoc.parts) {
23979
23999
  return currentDoc;
23980
24000
  }
@@ -24023,7 +24043,7 @@
24023
24043
 
24024
24044
  const expressions = expressionDocs.slice();
24025
24045
  let replaceCounter = 0;
24026
- const newDoc = mapDoc$4(quasisDoc, doc => {
24046
+ const newDoc = mapDoc$3(quasisDoc, doc => {
24027
24047
  if (!doc || !doc.parts || !doc.parts.length) {
24028
24048
  return doc;
24029
24049
  }
@@ -24238,7 +24258,7 @@
24238
24258
 
24239
24259
  const placeholderRegex = new RegExp(composePlaceholder("(\\d+)"), "g");
24240
24260
  let topLevelCount = 0;
24241
- const contentDoc = mapDoc$4(stripTrailingHardline$2(textToDoc(text, {
24261
+ const contentDoc = mapDoc$3(stripTrailingHardline$2(textToDoc(text, {
24242
24262
  parser,
24243
24263
 
24244
24264
  __onHtmlRoot(root) {
@@ -24622,8 +24642,10 @@
24622
24642
  return (node.type === "TypeAnnotation" || node.type === "TSTypeAnnotation") && node.typeAnnotation.type === "FunctionTypeAnnotation" && !node.static && !sameLocStart(node, node.typeAnnotation, options);
24623
24643
  }
24624
24644
 
24645
+ const binaryishNodeTypes = new Set(["BinaryExpression", "LogicalExpression", "NGPipeExpression"]);
24646
+
24625
24647
  function isBinaryish(node) {
24626
- return node.type === "BinaryExpression" || node.type === "LogicalExpression" || node.type === "NGPipeExpression";
24648
+ return binaryishNodeTypes.has(node.type);
24627
24649
  }
24628
24650
 
24629
24651
  function isMemberish(node) {
@@ -25176,7 +25198,7 @@
25176
25198
  }
25177
25199
 
25178
25200
  if (node.type === "ArrayExpression") {
25179
- return node.elements.every(isChildSimple);
25201
+ return node.elements.every(x => x == null || isChildSimple(x));
25180
25202
  }
25181
25203
 
25182
25204
  if (node.type === "CallExpression" || node.type === "OptionalCallExpression" || node.type === "NewExpression") {
@@ -25850,7 +25872,7 @@
25850
25872
  }
25851
25873
 
25852
25874
  function isStatement(node) {
25853
- return node.type === "BlockStatement" || node.type === "BreakStatement" || node.type === "ClassBody" || node.type === "ClassDeclaration" || node.type === "ClassMethod" || node.type === "ClassProperty" || node.type === "ClassPrivateProperty" || node.type === "ContinueStatement" || node.type === "DebuggerStatement" || node.type === "DeclareClass" || node.type === "DeclareExportAllDeclaration" || node.type === "DeclareExportDeclaration" || node.type === "DeclareFunction" || node.type === "DeclareInterface" || node.type === "DeclareModule" || node.type === "DeclareModuleExports" || node.type === "DeclareVariable" || node.type === "DoWhileStatement" || node.type === "EnumDeclaration" || node.type === "ExportAllDeclaration" || node.type === "ExportDefaultDeclaration" || node.type === "ExportNamedDeclaration" || node.type === "ExpressionStatement" || node.type === "ForAwaitStatement" || node.type === "ForInStatement" || node.type === "ForOfStatement" || node.type === "ForStatement" || node.type === "FunctionDeclaration" || node.type === "IfStatement" || node.type === "ImportDeclaration" || node.type === "InterfaceDeclaration" || node.type === "LabeledStatement" || node.type === "MethodDefinition" || node.type === "ReturnStatement" || node.type === "SwitchStatement" || node.type === "ThrowStatement" || node.type === "TryStatement" || node.type === "TSDeclareFunction" || node.type === "TSEnumDeclaration" || node.type === "TSImportEqualsDeclaration" || node.type === "TSInterfaceDeclaration" || node.type === "TSModuleDeclaration" || node.type === "TSNamespaceExportDeclaration" || node.type === "TypeAlias" || node.type === "VariableDeclaration" || node.type === "WhileStatement" || node.type === "WithStatement";
25875
+ return node.type === "BlockStatement" || node.type === "BreakStatement" || node.type === "ClassBody" || node.type === "ClassDeclaration" || node.type === "ClassMethod" || node.type === "ClassProperty" || node.type === "ClassPrivateProperty" || node.type === "ContinueStatement" || node.type === "DebuggerStatement" || node.type === "DeclareClass" || node.type === "DeclareExportAllDeclaration" || node.type === "DeclareExportDeclaration" || node.type === "DeclareFunction" || node.type === "DeclareInterface" || node.type === "DeclareModule" || node.type === "DeclareModuleExports" || node.type === "DeclareVariable" || node.type === "DoWhileStatement" || node.type === "EnumDeclaration" || node.type === "ExportAllDeclaration" || node.type === "ExportDefaultDeclaration" || node.type === "ExportNamedDeclaration" || node.type === "ExpressionStatement" || node.type === "ForInStatement" || node.type === "ForOfStatement" || node.type === "ForStatement" || node.type === "FunctionDeclaration" || node.type === "IfStatement" || node.type === "ImportDeclaration" || node.type === "InterfaceDeclaration" || node.type === "LabeledStatement" || node.type === "MethodDefinition" || node.type === "ReturnStatement" || node.type === "SwitchStatement" || node.type === "ThrowStatement" || node.type === "TryStatement" || node.type === "TSDeclareFunction" || node.type === "TSEnumDeclaration" || node.type === "TSImportEqualsDeclaration" || node.type === "TSInterfaceDeclaration" || node.type === "TSModuleDeclaration" || node.type === "TSNamespaceExportDeclaration" || node.type === "TypeAlias" || node.type === "VariableDeclaration" || node.type === "WhileStatement" || node.type === "WithStatement";
25854
25876
  }
25855
25877
 
25856
25878
  function includesFunctionTypeInObjectType(node) {
@@ -26389,7 +26411,9 @@
26389
26411
  /* sameIndent */
26390
26412
  true)); // Only force a trailing newline if there were any contents.
26391
26413
 
26392
- if (n.body.length || n.comments) {
26414
+ if (!n.body.every(({
26415
+ type
26416
+ }) => type === "EmptyStatement") || n.comments) {
26393
26417
  parts.push(hardline$9);
26394
26418
  }
26395
26419
 
@@ -26564,7 +26588,6 @@
26564
26588
 
26565
26589
  case "SpreadElement":
26566
26590
  case "SpreadElementPattern":
26567
- case "RestProperty":
26568
26591
  case "SpreadProperty":
26569
26592
  case "SpreadPropertyPattern":
26570
26593
  case "RestElement":
@@ -26931,11 +26954,23 @@
26931
26954
  });
26932
26955
 
26933
26956
  if (n.inexact) {
26934
- props.push(concat$d(separatorParts.concat(group$b("..."))));
26957
+ let printed;
26958
+
26959
+ if (hasDanglingComments$1(n)) {
26960
+ const hasLineComments = !n.comments.every(comments$1.isBlockComment);
26961
+ const printedDanglingComments = comments.printDanglingComments(path, options,
26962
+ /* sameIndent */
26963
+ true);
26964
+ printed = concat$d([printedDanglingComments, hasLineComments || hasNewline$5(options.originalText, options.locEnd(n.comments[n.comments.length - 1])) ? hardline$9 : line$9, "..."]);
26965
+ } else {
26966
+ printed = "...";
26967
+ }
26968
+
26969
+ props.push(concat$d(separatorParts.concat(printed)));
26935
26970
  }
26936
26971
 
26937
26972
  const lastElem = getLast$3(n[propertiesField]);
26938
- const canHaveTrailingSeparator = !(lastElem && (lastElem.type === "RestProperty" || lastElem.type === "RestElement" || hasNodeIgnoreComment$2(lastElem) || n.inexact));
26973
+ const canHaveTrailingSeparator = !(n.inexact || lastElem && (lastElem.type === "RestElement" || hasNodeIgnoreComment$2(lastElem)));
26939
26974
  let content;
26940
26975
 
26941
26976
  if (props.length === 0) {
@@ -27174,7 +27209,7 @@
27174
27209
  // semicolon, except when they in the () part of for loops.
27175
27210
 
27176
27211
  const parentNode = path.getParentNode();
27177
- const isParentForLoop = parentNode.type === "ForStatement" || parentNode.type === "ForInStatement" || parentNode.type === "ForOfStatement" || parentNode.type === "ForAwaitStatement";
27212
+ const isParentForLoop = parentNode.type === "ForStatement" || parentNode.type === "ForInStatement" || parentNode.type === "ForOfStatement";
27178
27213
  const hasValue = n.declarations.some(decl => decl.init);
27179
27214
  let firstVariable;
27180
27215
 
@@ -27258,14 +27293,7 @@
27258
27293
  return group$b(concat$d([n.each ? "for each (" : "for (", path.call(print, "left"), " in ", path.call(print, "right"), ")", adjustClause(n.body, path.call(print, "body"))]));
27259
27294
 
27260
27295
  case "ForOfStatement":
27261
- case "ForAwaitStatement":
27262
- {
27263
- // Babel 7 removed ForAwaitStatement in favor of ForOfStatement
27264
- // with `"await": true`:
27265
- // https://github.com/estree/estree/pull/138
27266
- const isAwait = n.type === "ForAwaitStatement" || n.await;
27267
- return group$b(concat$d(["for", isAwait ? " await" : "", " (", path.call(print, "left"), " of ", path.call(print, "right"), ")", adjustClause(n.body, path.call(print, "body"))]));
27268
- }
27296
+ return group$b(concat$d(["for", n.await ? " await" : "", " (", path.call(print, "left"), " of ", path.call(print, "right"), ")", adjustClause(n.body, path.call(print, "body"))]));
27269
27297
 
27270
27298
  case "DoWhileStatement":
27271
27299
  {
@@ -27415,8 +27443,8 @@
27415
27443
  case "JSXExpressionContainer":
27416
27444
  {
27417
27445
  const parent = path.getParentNode(0);
27418
- const preventInline = parent.type === "JSXAttribute" && n.expression.comments && n.expression.comments.length > 0;
27419
- const 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$1(parent) && (n.expression.type === "ConditionalExpression" || isBinaryish$1(n.expression)));
27446
+ const hasComments = n.expression.comments && n.expression.comments.length > 0;
27447
+ const shouldInline = n.expression.type === "JSXEmptyExpression" || !hasComments && (n.expression.type === "ArrayExpression" || n.expression.type === "ObjectExpression" || n.expression.type === "ArrowFunctionExpression" || n.expression.type === "CallExpression" || n.expression.type === "OptionalCallExpression" || n.expression.type === "FunctionExpression" || n.expression.type === "TemplateLiteral" || n.expression.type === "TaggedTemplateExpression" || n.expression.type === "DoExpression" || isJSXNode$1(parent) && (n.expression.type === "ConditionalExpression" || isBinaryish$1(n.expression)));
27420
27448
 
27421
27449
  if (shouldInline) {
27422
27450
  return group$b(concat$d(["{", path.call(print, "expression"), lineSuffixBoundary$1, "}"]));
@@ -27622,7 +27650,7 @@
27622
27650
  if (!isSimple) {
27623
27651
  // Breaks at the template element boundaries (${ and }) are preferred to breaking
27624
27652
  // in the middle of a MemberExpression
27625
- if (n.expressions[i].comments && n.expressions[i].comments.length || n.expressions[i].type === "MemberExpression" || n.expressions[i].type === "OptionalMemberExpression" || n.expressions[i].type === "ConditionalExpression" || n.expressions[i].type === "LogicalExpression" || n.expressions[i].type === "BinaryExpression" || n.expressions[i].type === "SequenceExpression" || n.expressions[i].type === "TSAsExpression") {
27653
+ if (n.expressions[i].comments && n.expressions[i].comments.length || n.expressions[i].type === "MemberExpression" || n.expressions[i].type === "OptionalMemberExpression" || n.expressions[i].type === "ConditionalExpression" || n.expressions[i].type === "SequenceExpression" || n.expressions[i].type === "TSAsExpression" || isBinaryish$1(n.expressions[i])) {
27626
27654
  printed = concat$d([indent$7(concat$d([softline$6, printed])), softline$6]);
27627
27655
  }
27628
27656
  }
@@ -28255,8 +28283,13 @@
28255
28283
 
28256
28284
  case "TSIndexSignature":
28257
28285
  {
28258
- const parent = path.getParentNode();
28259
- const parametersGroup = group$b(concat$d([indent$7(concat$d([softline$6, join$9(concat$d([", ", softline$6]), path.map(print, "parameters"))])), ifBreak$6(shouldPrintComma$1(options) ? "," : ""), softline$6]));
28286
+ const parent = path.getParentNode(); // The typescript parser accepts multiple parameters here. If you're
28287
+ // using them, it makes sense to have a trailing comma. But if you
28288
+ // aren't, this is more like a computed property name than an array.
28289
+ // So we leave off the trailing comma when there's just one parameter.
28290
+
28291
+ const trailingComma = n.parameters.length > 1 ? ifBreak$6(shouldPrintComma$1(options) ? "," : "") : "";
28292
+ const parametersGroup = group$b(concat$d([indent$7(concat$d([softline$6, join$9(concat$d([", ", softline$6]), path.map(print, "parameters"))])), trailingComma, softline$6]));
28260
28293
  return concat$d([n.export ? "export " : "", n.accessibility ? concat$d([n.accessibility, " "]) : "", n.static ? "static " : "", n.readonly ? "readonly " : "", "[", n.parameters ? parametersGroup : "", n.typeAnnotation ? "]: " : "]", n.typeAnnotation ? path.call(print, "typeAnnotation") : "", parent.type === "ClassBody" ? semi : ""]);
28261
28294
  }
28262
28295
 
@@ -28463,7 +28496,7 @@
28463
28496
  return "";
28464
28497
 
28465
28498
  case "NGQuotedExpression":
28466
- return concat$d([n.prefix, ":", n.value]);
28499
+ return concat$d([n.prefix, ": ", n.value.trim()]);
28467
28500
 
28468
28501
  case "NGMicrosyntax":
28469
28502
  return concat$d(path.map((childPath, index) => concat$d([index === 0 ? "" : isNgForOf$1(childPath.getValue(), index, n) ? " " : concat$d([";", line$9]), print(childPath)]), "body"));
@@ -30020,7 +30053,7 @@
30020
30053
  if (node.argument) {
30021
30054
  if (returnArgumentHasLeadingComment$1(options, node.argument)) {
30022
30055
  parts.push(concat$d([" (", indent$7(concat$d([hardline$9, path.call(print, "argument")])), hardline$9, ")"]));
30023
- } else if (node.argument.type === "LogicalExpression" || node.argument.type === "BinaryExpression" || node.argument.type === "SequenceExpression") {
30056
+ } else if (isBinaryish$1(node.argument) || node.argument.type === "SequenceExpression") {
30024
30057
  parts.push(group$b(concat$d([ifBreak$6(" (", " "), indent$7(concat$d([softline$6, path.call(print, "argument")])), softline$6, ifBreak$6(")")])));
30025
30058
  } else {
30026
30059
  parts.push(" ", path.call(print, "argument"));
@@ -30052,7 +30085,7 @@
30052
30085
  ) {
30053
30086
  const node = path.getValue();
30054
30087
  const parent = path.getParentNode();
30055
- return (node && (isJSXNode$1(node) || hasFlowShorthandAnnotationComment$2(node) || parent && (parent.type === "CallExpression" || parent.type === "OptionalCallExpression") && (hasFlowAnnotationComment$1(node.leadingComments) || hasFlowAnnotationComment$1(node.trailingComments))) || parent && (parent.type === "JSXSpreadAttribute" || parent.type === "JSXSpreadChild" || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType" || (parent.type === "ClassDeclaration" || parent.type === "ClassExpression") && parent.superClass === node)) && !hasIgnoreComment$4(path);
30088
+ return (node && (isJSXNode$1(node) || hasFlowShorthandAnnotationComment$2(node) || parent && (parent.type === "CallExpression" || parent.type === "OptionalCallExpression") && (hasFlowAnnotationComment$1(node.leadingComments) || hasFlowAnnotationComment$1(node.trailingComments))) || parent && (parent.type === "JSXSpreadAttribute" || parent.type === "JSXSpreadChild" || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType" || (parent.type === "ClassDeclaration" || parent.type === "ClassExpression") && parent.superClass === node)) && (!hasIgnoreComment$4(path) || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType");
30056
30089
  }
30057
30090
 
30058
30091
  function canAttachComment$1(node) {
@@ -30575,6 +30608,7 @@
30575
30608
  "jsonc"
30576
30609
  ];
30577
30610
  var extensions$d = [
30611
+ ".jsonc",
30578
30612
  ".sublime-build",
30579
30613
  ".sublime-commands",
30580
30614
  ".sublime-completions",
@@ -30928,7 +30962,7 @@
30928
30962
  markAsRoot: markAsRoot$3
30929
30963
  },
30930
30964
  utils: {
30931
- mapDoc: mapDoc$5
30965
+ mapDoc: mapDoc$4
30932
30966
  }
30933
30967
  } = document;
30934
30968
  const {
@@ -30990,7 +31024,7 @@
30990
31024
  }
30991
31025
 
30992
31026
  function replaceNewlinesWithLiterallines(doc) {
30993
- return mapDoc$5(doc, currentDoc => typeof currentDoc === "string" && currentDoc.includes("\n") ? concat$f(currentDoc.split(/(\n)/g).map((v, i) => i % 2 === 0 ? v : literalline$5)) : currentDoc);
31027
+ return mapDoc$4(doc, currentDoc => typeof currentDoc === "string" && currentDoc.includes("\n") ? concat$f(currentDoc.split(/(\n)/g).map((v, i) => i % 2 === 0 ? v : literalline$5)) : currentDoc);
30994
31028
  }
30995
31029
  }
30996
31030
 
@@ -31295,7 +31329,7 @@
31295
31329
  group: group$f
31296
31330
  },
31297
31331
  utils: {
31298
- mapDoc: mapDoc$6
31332
+ mapDoc: mapDoc$5
31299
31333
  },
31300
31334
  printer: {
31301
31335
  printDocToString: printDocToString$3
@@ -31612,19 +31646,6 @@
31612
31646
  }
31613
31647
 
31614
31648
  function printLine(path, value, options) {
31615
- const greatGrandParentNode = path.getParentNode(2);
31616
-
31617
- if (greatGrandParentNode && greatGrandParentNode.type === "listItem") {
31618
- const parentNode = path.getParentNode();
31619
- const grandParentNode = path.getParentNode(1);
31620
- const index = grandParentNode.children.indexOf(parentNode);
31621
- const prevGrandParentNode = grandParentNode.children[index - 1];
31622
-
31623
- if (prevGrandParentNode && prevGrandParentNode.type === "break") {
31624
- return "";
31625
- }
31626
- }
31627
-
31628
31649
  if (options.proseWrap === "preserve" && value === "\n") {
31629
31650
  return hardline$c;
31630
31651
  }
@@ -31876,7 +31897,7 @@
31876
31897
  }
31877
31898
 
31878
31899
  function normalizeDoc(doc) {
31879
- return mapDoc$6(doc, currentDoc => {
31900
+ return mapDoc$5(doc, currentDoc => {
31880
31901
  if (!currentDoc.parts) {
31881
31902
  return currentDoc;
31882
31903
  }
@@ -32795,7 +32816,8 @@
32795
32816
  ".clang-format",
32796
32817
  ".clang-tidy",
32797
32818
  ".gemrc",
32798
- "glide.lock"
32819
+ "glide.lock",
32820
+ "yarn.lock"
32799
32821
  ];
32800
32822
  var aceMode$g = "yaml";
32801
32823
  var codemirrorMode$c = "yaml";
@@ -32831,10 +32853,12 @@
32831
32853
 
32832
32854
  var require$$0$8 = getCjsExportFromNamespace(YAML$1);
32833
32855
 
32834
- const languages$6 = [createLanguage(require$$0$8, () => ({
32856
+ const languages$6 = [createLanguage(require$$0$8, data => ({
32835
32857
  since: "1.14.0",
32836
32858
  parsers: ["yaml"],
32837
- vscodeLanguageIds: ["yaml"]
32859
+ vscodeLanguageIds: ["yaml"],
32860
+ // yarn.lock is not YAML: https://github.com/yarnpkg/yarn/issues/5629
32861
+ filenames: data.filenames.filter(filename => filename !== "yarn.lock")
32838
32862
  }))];
32839
32863
  var languageYaml = {
32840
32864
  languages: languages$6,