prettier 1.13.4 → 1.14.0

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$1 = "1.13.4";
8
+ var version$1 = "1.14.0";
9
9
  var description = "Prettier is an opinionated code formatter";
10
10
  var bin = {
11
11
  "prettier": "./bin/prettier.js"
@@ -19,7 +19,7 @@ var engines = {
19
19
  "node": ">=6"
20
20
  };
21
21
  var dependencies = {
22
- "@babel/code-frame": "7.0.0-beta.49",
22
+ "@babel/code-frame": "7.0.0-beta.46",
23
23
  "@babel/parser": "7.0.0-beta.49",
24
24
  "@glimmer/syntax": "0.30.3",
25
25
  "camelcase": "4.1.0",
@@ -36,38 +36,44 @@ var dependencies = {
36
36
  "esutils": "2.0.2",
37
37
  "find-parent-dir": "0.3.0",
38
38
  "find-project-root": "1.1.1",
39
- "flow-parser": "0.73.0",
39
+ "flow-parser": "0.75.0",
40
40
  "get-stream": "3.0.0",
41
41
  "globby": "6.1.0",
42
42
  "graphql": "0.13.2",
43
43
  "html-tag-names": "1.1.2",
44
44
  "ignore": "3.3.7",
45
- "jest-docblock": "22.2.2",
45
+ "jest-docblock": "23.2.0",
46
46
  "json-stable-stringify": "1.0.1",
47
47
  "leven": "2.1.0",
48
+ "linguist-languages": "6.2.1-dev.20180706",
48
49
  "lodash.uniqby": "4.7.0",
49
50
  "mem": "1.1.0",
50
51
  "minimatch": "3.0.4",
51
52
  "minimist": "1.2.0",
53
+ "normalize-path": "3.0.0",
52
54
  "parse5": "3.0.3",
53
55
  "postcss-less": "1.1.5",
54
56
  "postcss-media-query-parser": "0.2.3",
55
- "postcss-scss": "1.0.5",
57
+ "postcss-scss": "1.0.6",
56
58
  "postcss-selector-parser": "2.2.3",
57
59
  "postcss-values-parser": "1.5.0",
58
60
  "remark-parse": "5.0.0",
59
61
  "resolve": "1.5.0",
60
62
  "semver": "5.4.1",
61
63
  "string-width": "2.1.1",
62
- "typescript": "2.9.0-dev.20180421",
63
- "typescript-eslint-parser": "eslint/typescript-eslint-parser#2960b002746c01fb9cb15bb5f4c1e7e925c6519a",
64
+ "typescript": "3.0.0-dev.20180626",
65
+ "typescript-eslint-parser": "17.0.0",
64
66
  "unicode-regex": "1.0.1",
65
- "unified": "6.1.6"
67
+ "unified": "6.1.6",
68
+ "yaml": "1.0.0-rc.7",
69
+ "yaml-unist-parser": "1.0.0-rc.2"
66
70
  };
67
71
  var devDependencies = {
68
72
  "@babel/cli": "7.0.0-beta.49",
69
73
  "@babel/core": "7.0.0-beta.49",
70
74
  "@babel/preset-env": "7.0.0-beta.49",
75
+ "babel-loader": "8.0.0-beta.3",
76
+ "benchmark": "2.1.4",
71
77
  "builtin-modules": "2.0.0",
72
78
  "codecov": "2.2.0",
73
79
  "cross-env": "5.0.5",
@@ -77,12 +83,16 @@ var devDependencies = {
77
83
  "eslint-plugin-import": "2.9.0",
78
84
  "eslint-plugin-prettier": "2.6.0",
79
85
  "eslint-plugin-react": "7.7.0",
80
- "jest": "21.1.0",
86
+ "execa": "0.10.0",
87
+ "jest": "23.3.0",
88
+ "jest-junit": "5.0.0",
89
+ "jest-watch-typeahead": "0.1.0",
81
90
  "mkdirp": "0.5.1",
82
- "prettier": "1.13.3",
91
+ "prettier": "1.13.7",
83
92
  "prettylint": "1.0.0",
84
93
  "rimraf": "2.6.2",
85
94
  "rollup": "0.47.6",
95
+ "rollup-plugin-alias": "1.4.0",
86
96
  "rollup-plugin-babel": "4.0.0-beta.4",
87
97
  "rollup-plugin-commonjs": "8.2.6",
88
98
  "rollup-plugin-json": "2.1.1",
@@ -92,10 +102,13 @@ var devDependencies = {
92
102
  "rollup-plugin-replace": "1.2.1",
93
103
  "rollup-plugin-uglify": "3.0.0",
94
104
  "shelljs": "0.8.1",
95
- "snapshot-diff": "0.2.2",
105
+ "snapshot-diff": "0.4.0",
96
106
  "strip-ansi": "4.0.0",
97
107
  "tempy": "0.2.1",
98
- "webpack": "2.6.1"
108
+ "webpack": "3.12.0"
109
+ };
110
+ var resolutions = {
111
+ "@babel/code-frame": "7.0.0-beta.46"
99
112
  };
100
113
  var scripts = {
101
114
  "prepublishOnly": "echo \"Error: must publish from dist/\" && exit 1",
@@ -103,6 +116,9 @@ var scripts = {
103
116
  "test": "jest",
104
117
  "test:dist": "node ./scripts/test-dist.js",
105
118
  "test-integration": "jest tests_integration",
119
+ "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",
120
+ "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",
121
+ "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",
106
122
  "lint": "cross-env EFF_NO_LINK_RULES=true eslint . --format node_modules/eslint-friendly-formatter",
107
123
  "lint-docs": "prettylint {.,docs,website,website/blog}/*.md",
108
124
  "build": "node ./scripts/build/build.js",
@@ -122,6 +138,7 @@ var _package = {
122
138
  engines: engines,
123
139
  dependencies: dependencies,
124
140
  devDependencies: devDependencies,
141
+ resolutions: resolutions,
125
142
  scripts: scripts
126
143
  };
127
144
 
@@ -138,6 +155,7 @@ var _package$1 = Object.freeze({
138
155
  engines: engines,
139
156
  dependencies: dependencies,
140
157
  devDependencies: devDependencies,
158
+ resolutions: resolutions,
141
159
  scripts: scripts,
142
160
  default: _package
143
161
  });
@@ -2050,6 +2068,43 @@ var lib = createCommonjsModule(function (module, exports) {
2050
2068
  });
2051
2069
  unwrapExports(lib);
2052
2070
 
2071
+ /*!
2072
+ * normalize-path <https://github.com/jonschlinkert/normalize-path>
2073
+ *
2074
+ * Copyright (c) 2014-2018, Jon Schlinkert.
2075
+ * Released under the MIT License.
2076
+ */
2077
+ var normalizePath = function normalizePath(path, stripTrailing) {
2078
+ if (typeof path !== 'string') {
2079
+ throw new TypeError('expected path to be a string');
2080
+ }
2081
+
2082
+ if (path === '\\' || path === '/') return '/';
2083
+ var len = path.length;
2084
+ if (len <= 1) return path; // ensure that win32 namespaces has two leading slashes, so that the path is
2085
+ // handled properly by the win32 version of path.parse() after being normalized
2086
+ // https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces
2087
+
2088
+ var prefix = '';
2089
+
2090
+ if (len > 4 && path[3] === '\\') {
2091
+ var ch = path[2];
2092
+
2093
+ if ((ch === '?' || ch === '.') && path.slice(0, 2) === '\\\\') {
2094
+ path = path.slice(2);
2095
+ prefix = '//';
2096
+ }
2097
+ }
2098
+
2099
+ var segs = path.split(/[/\\]+/);
2100
+
2101
+ if (stripTrailing !== false && segs[segs.length - 1] === '') {
2102
+ segs.pop();
2103
+ }
2104
+
2105
+ return prefix + segs.join('/');
2106
+ };
2107
+
2053
2108
  var ConfigError =
2054
2109
  /*#__PURE__*/
2055
2110
  function (_Error) {
@@ -3737,6 +3792,10 @@ var options$2 = {
3737
3792
  value: "vue",
3738
3793
  since: "1.10.0",
3739
3794
  description: "Vue"
3795
+ }, {
3796
+ value: "yaml",
3797
+ since: "1.14.0",
3798
+ description: "YAML"
3740
3799
  }]
3741
3800
  },
3742
3801
  plugins: {
@@ -3872,7 +3931,9 @@ function getSupportInfo$2(version, opts) {
3872
3931
  }, opts);
3873
3932
 
3874
3933
  if (!version) {
3875
- version = currentVersion;
3934
+ // pre-release version is smaller than the normal version in semver,
3935
+ // we need to treat it as the normal one so as to test new features.
3936
+ version = currentVersion.split("-", 1)[0];
3876
3937
  }
3877
3938
 
3878
3939
  var plugins = opts.plugins;
@@ -3925,7 +3986,7 @@ function getSupportInfo$2(version, opts) {
3925
3986
  });
3926
3987
  }
3927
3988
 
3928
- if (usePostCssParser && language.group === "CSS") {
3989
+ if (usePostCssParser && (language.name === "CSS" || language.group === "CSS")) {
3929
3990
  return Object.assign({}, language, {
3930
3991
  parsers: ["postcss"]
3931
3992
  });
@@ -4256,6 +4317,12 @@ var optionsNormalizer = {
4256
4317
  normalizeCliOptions: normalizeCliOptions
4257
4318
  };
4258
4319
 
4320
+ var _shim_path = {};
4321
+
4322
+ var _shim_path$1 = Object.freeze({
4323
+ default: _shim_path
4324
+ });
4325
+
4259
4326
  var getLast = function getLast(arr) {
4260
4327
  return arr.length > 0 ? arr[arr.length - 1] : null;
4261
4328
  };
@@ -6106,6 +6173,7 @@ var ansiStyles = createCommonjsModule(function (module) {
6106
6173
  };
6107
6174
 
6108
6175
  function assembleStyles() {
6176
+ var codes = new Map();
6109
6177
  var styles = {
6110
6178
  modifier: {
6111
6179
  reset: [0, 0],
@@ -6159,21 +6227,39 @@ var ansiStyles = createCommonjsModule(function (module) {
6159
6227
  }; // Fix humans
6160
6228
 
6161
6229
  styles.color.grey = styles.color.gray;
6162
- Object.keys(styles).forEach(function (groupName) {
6230
+
6231
+ var _arr = Object.keys(styles);
6232
+
6233
+ for (var _i = 0; _i < _arr.length; _i++) {
6234
+ var groupName = _arr[_i];
6163
6235
  var group = styles[groupName];
6164
- Object.keys(group).forEach(function (styleName) {
6236
+
6237
+ var _arr3 = Object.keys(group);
6238
+
6239
+ for (var _i3 = 0; _i3 < _arr3.length; _i3++) {
6240
+ var styleName = _arr3[_i3];
6165
6241
  var style = group[styleName];
6166
6242
  styles[styleName] = {
6167
6243
  open: "\x1B[".concat(style[0], "m"),
6168
6244
  close: "\x1B[".concat(style[1], "m")
6169
6245
  };
6170
6246
  group[styleName] = styles[styleName];
6171
- });
6247
+ codes.set(style[0], style[1]);
6248
+ }
6249
+
6172
6250
  Object.defineProperty(styles, groupName, {
6173
6251
  value: group,
6174
6252
  enumerable: false
6175
6253
  });
6176
- });
6254
+ Object.defineProperty(styles, 'codes', {
6255
+ value: codes,
6256
+ enumerable: false
6257
+ });
6258
+ }
6259
+
6260
+ var ansi2ansi = function ansi2ansi(n) {
6261
+ return n;
6262
+ };
6177
6263
 
6178
6264
  var rgb2rgb = function rgb2rgb(r, g, b) {
6179
6265
  return [r, g, b];
@@ -6181,21 +6267,29 @@ var ansiStyles = createCommonjsModule(function (module) {
6181
6267
 
6182
6268
  styles.color.close = "\x1B[39m";
6183
6269
  styles.bgColor.close = "\x1B[49m";
6184
- styles.color.ansi = {};
6185
- styles.color.ansi256 = {};
6270
+ styles.color.ansi = {
6271
+ ansi: wrapAnsi16(ansi2ansi, 0)
6272
+ };
6273
+ styles.color.ansi256 = {
6274
+ ansi256: wrapAnsi256(ansi2ansi, 0)
6275
+ };
6186
6276
  styles.color.ansi16m = {
6187
6277
  rgb: wrapAnsi16m(rgb2rgb, 0)
6188
6278
  };
6189
- styles.bgColor.ansi = {};
6190
- styles.bgColor.ansi256 = {};
6279
+ styles.bgColor.ansi = {
6280
+ ansi: wrapAnsi16(ansi2ansi, 10)
6281
+ };
6282
+ styles.bgColor.ansi256 = {
6283
+ ansi256: wrapAnsi256(ansi2ansi, 10)
6284
+ };
6191
6285
  styles.bgColor.ansi16m = {
6192
6286
  rgb: wrapAnsi16m(rgb2rgb, 10)
6193
6287
  };
6194
6288
 
6195
- var _arr = Object.keys(colorConvert);
6289
+ var _arr2 = Object.keys(colorConvert);
6196
6290
 
6197
- for (var _i = 0; _i < _arr.length; _i++) {
6198
- var key = _arr[_i];
6291
+ for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
6292
+ var key = _arr2[_i2];
6199
6293
 
6200
6294
  if (_typeof(colorConvert[key]) !== 'object') {
6201
6295
  continue;
@@ -6203,6 +6297,10 @@ var ansiStyles = createCommonjsModule(function (module) {
6203
6297
 
6204
6298
  var suite = colorConvert[key];
6205
6299
 
6300
+ if (key === 'ansi16') {
6301
+ key = 'ansi';
6302
+ }
6303
+
6206
6304
  if ('ansi16' in suite) {
6207
6305
  styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
6208
6306
  styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
@@ -6220,7 +6318,8 @@ var ansiStyles = createCommonjsModule(function (module) {
6220
6318
  }
6221
6319
 
6222
6320
  return styles;
6223
- }
6321
+ } // Make the export immutable
6322
+
6224
6323
 
6225
6324
  Object.defineProperty(module, 'exports', {
6226
6325
  enumerable: true,
@@ -6228,131 +6327,149 @@ var ansiStyles = createCommonjsModule(function (module) {
6228
6327
  });
6229
6328
  });
6230
6329
 
6231
- var hasFlag = function hasFlag(flag, argv$$1) {
6232
- argv$$1 = argv$$1 || process.argv;
6233
- var terminatorPos = argv$$1.indexOf('--');
6234
- var prefix = /^-{1,2}/.test(flag) ? '' : '--';
6235
- var pos = argv$$1.indexOf(prefix + flag);
6236
- return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
6330
+ var os = {
6331
+ EOL: "\n"
6237
6332
  };
6238
6333
 
6239
- var os$3 = {};
6334
+ var os$1 = Object.freeze({
6335
+ default: os
6336
+ });
6240
6337
 
6338
+ var hasFlag = createCommonjsModule(function (module) {
6339
+ 'use strict';
6241
6340
 
6242
- var os$5 = Object.freeze({
6243
- default: os$3,
6244
- __moduleExports: os$3
6341
+ module.exports = function (flag, argv$$1) {
6342
+ argv$$1 = argv$$1 || process.argv;
6343
+ var prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
6344
+ var pos = argv$$1.indexOf(prefix + flag);
6345
+ var terminatorPos = argv$$1.indexOf('--');
6346
+ return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
6347
+ };
6245
6348
  });
6246
6349
 
6247
- var os$2 = ( os$5 && os$3 ) || os$5;
6350
+ var require$$1$1 = ( os$1 && os ) || os$1;
6248
6351
 
6249
- var supportsColor = createCommonjsModule(function (module) {
6250
- 'use strict';
6352
+ var env$1 = process.env;
6353
+ var forceColor;
6354
+
6355
+ if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) {
6356
+ forceColor = false;
6357
+ } else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) {
6358
+ forceColor = true;
6359
+ }
6251
6360
 
6252
- var env$$1 = process.env;
6361
+ if ('FORCE_COLOR' in env$1) {
6362
+ forceColor = env$1.FORCE_COLOR.length === 0 || parseInt(env$1.FORCE_COLOR, 10) !== 0;
6363
+ }
6253
6364
 
6254
- var support = function support(level) {
6255
- if (level === 0) {
6256
- return false;
6257
- }
6365
+ function translateLevel(level) {
6366
+ if (level === 0) {
6367
+ return false;
6368
+ }
6258
6369
 
6259
- return {
6260
- level: level,
6261
- hasBasic: true,
6262
- has256: level >= 2,
6263
- has16m: level >= 3
6264
- };
6370
+ return {
6371
+ level: level,
6372
+ hasBasic: true,
6373
+ has256: level >= 2,
6374
+ has16m: level >= 3
6265
6375
  };
6376
+ }
6266
6377
 
6267
- var supportLevel = function () {
6268
- if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) {
6269
- return 0;
6270
- }
6271
-
6272
- if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) {
6273
- return 3;
6274
- }
6378
+ function supportsColor(stream) {
6379
+ if (forceColor === false) {
6380
+ return 0;
6381
+ }
6275
6382
 
6276
- if (hasFlag('color=256')) {
6277
- return 2;
6278
- }
6383
+ if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) {
6384
+ return 3;
6385
+ }
6279
6386
 
6280
- if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) {
6281
- return 1;
6282
- }
6387
+ if (hasFlag('color=256')) {
6388
+ return 2;
6389
+ }
6283
6390
 
6284
- if (process.stdout && !process.stdout.isTTY) {
6285
- return 0;
6286
- }
6391
+ if (stream && !stream.isTTY && forceColor !== true) {
6392
+ return 0;
6393
+ }
6287
6394
 
6288
- if (process.platform === 'win32') {
6289
- // Node.js 7.5.0 is the first version of Node.js to include a patch to
6290
- // libuv that enables 256 color output on Windows. Anything earlier and it
6291
- // won't work. However, here we target Node.js 8 at minimum as it is an LTS
6292
- // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
6293
- // release that supports 256 colors.
6294
- var osRelease = os$2.release().split('.');
6395
+ var min = forceColor ? 1 : 0;
6295
6396
 
6296
- if (Number(process.version.split('.')[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
6297
- return 2;
6298
- }
6397
+ if (process.platform === 'win32') {
6398
+ // Node.js 7.5.0 is the first version of Node.js to include a patch to
6399
+ // libuv that enables 256 color output on Windows. Anything earlier and it
6400
+ // won't work. However, here we target Node.js 8 at minimum as it is an LTS
6401
+ // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
6402
+ // release that supports 256 colors. Windows 10 build 14931 is the first release
6403
+ // that supports 16m/TrueColor.
6404
+ var osRelease = require$$1$1.release().split('.');
6299
6405
 
6300
- return 1;
6406
+ if (Number(process.versions.node.split('.')[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
6407
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
6301
6408
  }
6302
6409
 
6303
- if ('CI' in env$$1) {
6304
- if ('TRAVIS' in env$$1 || env$$1.CI === 'Travis' || 'CIRCLECI' in env$$1) {
6305
- return 1;
6306
- }
6307
-
6308
- return 0;
6309
- }
6410
+ return 1;
6411
+ }
6310
6412
 
6311
- if ('TEAMCITY_VERSION' in env$$1) {
6312
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$$1.TEAMCITY_VERSION) ? 1 : 0;
6413
+ if ('CI' in env$1) {
6414
+ if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(function (sign) {
6415
+ return sign in env$1;
6416
+ }) || env$1.CI_NAME === 'codeship') {
6417
+ return 1;
6313
6418
  }
6314
6419
 
6315
- if ('TERM_PROGRAM' in env$$1) {
6316
- var version = parseInt((env$$1.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
6420
+ return min;
6421
+ }
6317
6422
 
6318
- switch (env$$1.TERM_PROGRAM) {
6319
- case 'iTerm.app':
6320
- return version >= 3 ? 3 : 2;
6423
+ if ('TEAMCITY_VERSION' in env$1) {
6424
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$1.TEAMCITY_VERSION) ? 1 : 0;
6425
+ }
6321
6426
 
6322
- case 'Hyper':
6323
- return 3;
6427
+ if (env$1.COLORTERM === 'truecolor') {
6428
+ return 3;
6429
+ }
6324
6430
 
6325
- case 'Apple_Terminal':
6326
- return 2;
6327
- // No default
6328
- }
6329
- }
6431
+ if ('TERM_PROGRAM' in env$1) {
6432
+ var version = parseInt((env$1.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
6330
6433
 
6331
- if (/^(screen|xterm)-256(?:color)?/.test(env$$1.TERM)) {
6332
- return 2;
6333
- }
6434
+ switch (env$1.TERM_PROGRAM) {
6435
+ case 'iTerm.app':
6436
+ return version >= 3 ? 3 : 2;
6334
6437
 
6335
- if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(env$$1.TERM)) {
6336
- return 1;
6438
+ case 'Apple_Terminal':
6439
+ return 2;
6440
+ // No default
6337
6441
  }
6442
+ }
6338
6443
 
6339
- if ('COLORTERM' in env$$1) {
6340
- return 1;
6341
- }
6444
+ if (/-256(color)?$/i.test(env$1.TERM)) {
6445
+ return 2;
6446
+ }
6342
6447
 
6343
- if (env$$1.TERM === 'dumb') {
6344
- return 0;
6345
- }
6448
+ if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env$1.TERM)) {
6449
+ return 1;
6450
+ }
6346
6451
 
6347
- return 0;
6348
- }();
6452
+ if ('COLORTERM' in env$1) {
6453
+ return 1;
6454
+ }
6349
6455
 
6350
- if ('FORCE_COLOR' in env$$1) {
6351
- supportLevel = parseInt(env$$1.FORCE_COLOR, 10) === 0 ? 0 : supportLevel || 1;
6456
+ if (env$1.TERM === 'dumb') {
6457
+ return min;
6352
6458
  }
6353
6459
 
6354
- module.exports = process && support(supportLevel);
6355
- });
6460
+ return min;
6461
+ }
6462
+
6463
+ function getSupportLevel(stream) {
6464
+ var level = supportsColor(stream);
6465
+ return translateLevel(level);
6466
+ }
6467
+
6468
+ var supportsColor_1 = {
6469
+ supportsColor: getSupportLevel,
6470
+ stdout: getSupportLevel(process.stdout),
6471
+ stderr: getSupportLevel(process.stderr)
6472
+ };
6356
6473
 
6357
6474
  var templates = createCommonjsModule(function (module) {
6358
6475
  'use strict';
@@ -6543,6 +6660,7 @@ var templates = createCommonjsModule(function (module) {
6543
6660
  var chalk = createCommonjsModule(function (module) {
6544
6661
  'use strict';
6545
6662
 
6663
+ var stdoutColor = supportsColor_1.stdout;
6546
6664
  var isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); // `supportsColor.level` → `ansiStyles.color[name]` mapping
6547
6665
 
6548
6666
  var levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; // `color-convert` models to exclude from the Chalk API due to conflicts and such
@@ -6553,7 +6671,7 @@ var chalk = createCommonjsModule(function (module) {
6553
6671
  function applyOptions(obj, options) {
6554
6672
  options = options || {}; // Detect level if not set manually
6555
6673
 
6556
- var scLevel = supportsColor ? supportsColor.level : 0;
6674
+ var scLevel = stdoutColor ? stdoutColor.level : 0;
6557
6675
  obj.level = options.level === undefined ? scLevel : options.level;
6558
6676
  obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
6559
6677
  }
@@ -6797,7 +6915,7 @@ var chalk = createCommonjsModule(function (module) {
6797
6915
  Object.defineProperties(Chalk.prototype, styles);
6798
6916
  module.exports = Chalk(); // eslint-disable-line new-cap
6799
6917
 
6800
- module.exports.supportsColor = supportsColor;
6918
+ module.exports.supportsColor = stdoutColor;
6801
6919
  module.exports.default = module.exports; // For TypeScript
6802
6920
  });
6803
6921
 
@@ -6812,7 +6930,7 @@ var lib$2 = createCommonjsModule(function (module, exports) {
6812
6930
  exports.default = highlight;
6813
6931
 
6814
6932
  function _jsTokens() {
6815
- var data = _interopRequireWildcard$$1(jsTokens);
6933
+ var data = _interopRequireWildcard(jsTokens);
6816
6934
 
6817
6935
  _jsTokens = function _jsTokens() {
6818
6936
  return data;
@@ -6822,7 +6940,7 @@ var lib$2 = createCommonjsModule(function (module, exports) {
6822
6940
  }
6823
6941
 
6824
6942
  function _esutils() {
6825
- var data = _interopRequireDefault$$1(utils);
6943
+ var data = _interopRequireDefault(utils);
6826
6944
 
6827
6945
  _esutils = function _esutils() {
6828
6946
  return data;
@@ -6832,7 +6950,7 @@ var lib$2 = createCommonjsModule(function (module, exports) {
6832
6950
  }
6833
6951
 
6834
6952
  function _chalk() {
6835
- var data = _interopRequireDefault$$1(chalk);
6953
+ var data = _interopRequireDefault(chalk);
6836
6954
 
6837
6955
  _chalk = function _chalk() {
6838
6956
  return data;
@@ -6841,13 +6959,13 @@ var lib$2 = createCommonjsModule(function (module, exports) {
6841
6959
  return data;
6842
6960
  }
6843
6961
 
6844
- function _interopRequireDefault$$1(obj) {
6962
+ function _interopRequireDefault(obj) {
6845
6963
  return obj && obj.__esModule ? obj : {
6846
6964
  default: obj
6847
6965
  };
6848
6966
  }
6849
6967
 
6850
- function _interopRequireWildcard$$1(obj) {
6968
+ function _interopRequireWildcard(obj) {
6851
6969
  if (obj && obj.__esModule) {
6852
6970
  return obj;
6853
6971
  } else {
@@ -6892,9 +7010,8 @@ var lib$2 = createCommonjsModule(function (module, exports) {
6892
7010
 
6893
7011
  function getTokenType(match) {
6894
7012
  var _match$slice = match.slice(-2),
6895
- _match$slice2 = _slicedToArray(_match$slice, 2),
6896
- offset = _match$slice2[0],
6897
- text = _match$slice2[1];
7013
+ offset = _match$slice[0],
7014
+ text = _match$slice[1];
6898
7015
 
6899
7016
  var token = (0, _jsTokens().matchToToken)(match);
6900
7017
 
@@ -6959,8 +7076,10 @@ var lib$2 = createCommonjsModule(function (module, exports) {
6959
7076
  return chalk$$1;
6960
7077
  }
6961
7078
 
6962
- function highlight(code) {
6963
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
7079
+ function highlight(code, options) {
7080
+ if (options === void 0) {
7081
+ options = {};
7082
+ }
6964
7083
 
6965
7084
  if (shouldHighlight(options)) {
6966
7085
  var chalk$$1 = getChalk(options);
@@ -7030,7 +7149,7 @@ var lib$1 = createCommonjsModule(function (module, exports) {
7030
7149
  var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
7031
7150
 
7032
7151
  function getMarkerLines(loc, source, opts) {
7033
- var startLoc = Object.assign({
7152
+ var startLoc = Object.assign({}, {
7034
7153
  column: 0,
7035
7154
  line: -1
7036
7155
  }, loc.start);
@@ -7095,8 +7214,11 @@ var lib$1 = createCommonjsModule(function (module, exports) {
7095
7214
  };
7096
7215
  }
7097
7216
 
7098
- function codeFrameColumns(rawLines, loc) {
7099
- var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
7217
+ function codeFrameColumns(rawLines, loc, opts) {
7218
+ if (opts === void 0) {
7219
+ opts = {};
7220
+ }
7221
+
7100
7222
  var highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight().shouldHighlight)(opts);
7101
7223
  var chalk = (0, _highlight().getChalk)(opts);
7102
7224
  var defs = getDefs(chalk);
@@ -7117,8 +7239,8 @@ var lib$1 = createCommonjsModule(function (module, exports) {
7117
7239
  var numberMaxWidth = String(end).length;
7118
7240
  var frame = lines.slice(start, end).map(function (line, index) {
7119
7241
  var number = start + 1 + index;
7120
- var paddedNumber = " ".concat(number).slice(-numberMaxWidth);
7121
- var gutter = " ".concat(paddedNumber, " | ");
7242
+ var paddedNumber = (" " + number).slice(-numberMaxWidth);
7243
+ var gutter = " " + paddedNumber + " | ";
7122
7244
  var hasMarker = markerLines[number];
7123
7245
  var lastMarkerLine = !markerLines[number + 1];
7124
7246
 
@@ -7137,12 +7259,12 @@ var lib$1 = createCommonjsModule(function (module, exports) {
7137
7259
 
7138
7260
  return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
7139
7261
  } else {
7140
- return " ".concat(maybeHighlight(defs.gutter, gutter)).concat(line);
7262
+ return " " + maybeHighlight(defs.gutter, gutter) + line;
7141
7263
  }
7142
7264
  }).join("\n");
7143
7265
 
7144
7266
  if (opts.message && !hasColumns) {
7145
- frame = "".concat(" ".repeat(numberMaxWidth + 1)).concat(opts.message, "\n").concat(frame);
7267
+ frame = "" + " ".repeat(numberMaxWidth + 1) + opts.message + "\n" + frame;
7146
7268
  }
7147
7269
 
7148
7270
  if (highlighted) {
@@ -7152,8 +7274,10 @@ var lib$1 = createCommonjsModule(function (module, exports) {
7152
7274
  }
7153
7275
  }
7154
7276
 
7155
- function _default(rawLines, lineNumber, colNumber) {
7156
- var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
7277
+ function _default(rawLines, lineNumber, colNumber, opts) {
7278
+ if (opts === void 0) {
7279
+ opts = {};
7280
+ }
7157
7281
 
7158
7282
  if (!deprecationWarningShown) {
7159
7283
  deprecationWarningShown = true;
@@ -7180,15 +7304,7 @@ var lib$1 = createCommonjsModule(function (module, exports) {
7180
7304
  });
7181
7305
  unwrapExports(lib$1);
7182
7306
 
7183
- var path$5 = {};
7184
-
7185
-
7186
- var path$7 = Object.freeze({
7187
- default: path$5,
7188
- __moduleExports: path$5
7189
- });
7190
-
7191
- var path$4 = ( path$7 && path$5 ) || path$7;
7307
+ var path = ( _shim_path$1 && _shim_path ) || _shim_path$1;
7192
7308
 
7193
7309
  var ConfigError$1 = errors.ConfigError;
7194
7310
  var locStart = loc.locStart;
@@ -7274,7 +7390,7 @@ function resolveParser$1(opts, parsers) {
7274
7390
 
7275
7391
  try {
7276
7392
  return {
7277
- parse: eval("require")(path$4.resolve(process.cwd(), opts.parser)),
7393
+ parse: require(path.resolve(process.cwd(), opts.parser)),
7278
7394
  astFormat: "estree",
7279
7395
  locStart: locStart,
7280
7396
  locEnd: locEnd
@@ -7332,22 +7448,13 @@ var parser = {
7332
7448
  resolveParser: resolveParser$1
7333
7449
  };
7334
7450
 
7335
- var path$9 = {};
7336
-
7337
-
7338
- var path$11 = Object.freeze({
7339
- default: path$9,
7340
- __moduleExports: path$9
7341
- });
7342
-
7343
- var path$8 = ( path$11 && path$9 ) || path$11;
7344
-
7345
7451
  var UndefinedParserError = errors.UndefinedParserError;
7346
7452
  var getSupportInfo$1 = support.getSupportInfo;
7347
7453
  var resolveParser = parser.resolveParser;
7348
7454
  var hiddenDefaults = {
7349
7455
  astFormat: "estree",
7350
7456
  printer: {},
7457
+ originalText: undefined,
7351
7458
  locStart: null,
7352
7459
  locEnd: null
7353
7460
  }; // Copy options and fill in default values.
@@ -7429,12 +7536,14 @@ function getPlugin(options) {
7429
7536
  }
7430
7537
 
7431
7538
  function inferParser(filepath, plugins) {
7432
- var extension = path$8.extname(filepath);
7433
- var filename = path$8.basename(filepath).toLowerCase();
7539
+ var filepathParts = normalizePath(filepath).split("/");
7540
+ var filename = filepathParts[filepathParts.length - 1].toLowerCase();
7434
7541
  var language = getSupportInfo$1(null, {
7435
7542
  plugins: plugins
7436
7543
  }).languages.find(function (language) {
7437
- return language.since !== null && (language.extensions && language.extensions.indexOf(extension) > -1 || language.filenames && language.filenames.find(function (name) {
7544
+ return language.since !== null && (language.extensions && language.extensions.some(function (extension) {
7545
+ return filename.endsWith(extension);
7546
+ }) || language.filenames && language.filenames.find(function (name) {
7438
7547
  return name.toLowerCase() === filename;
7439
7548
  }));
7440
7549
  });
@@ -7489,29 +7598,19 @@ function massageAST(ast, options, parent) {
7489
7598
 
7490
7599
  var massageAst = massageAST;
7491
7600
 
7492
- var assert = {
7493
- ok: function ok() {},
7494
- strictEqual: function strictEqual() {}
7495
- };
7601
+ function assert() {}
7496
7602
 
7497
- function assertDoc(val) {
7498
- /* istanbul ignore if */
7499
- if (!(typeof val === "string" || val != null && typeof val.type === "string")) {
7500
- throw new Error("Value " + JSON.stringify(val) + " is not a valid document");
7501
- }
7502
- }
7603
+ assert.ok = function () {};
7503
7604
 
7504
- function concat$1(parts) {
7505
- if (process.env.NODE_ENV !== "production") {
7506
- parts.forEach(assertDoc);
7507
- } // We cannot do this until we change `printJSXElement` to not
7508
- // access the internals of a document directly.
7509
- // if(parts.length === 1) {
7510
- // // If it's a single document, no need to concat it.
7511
- // return parts[0];
7512
- // }
7605
+ assert.strictEqual = function () {};
7513
7606
 
7514
7607
 
7608
+
7609
+ var assert$2 = Object.freeze({
7610
+ default: assert
7611
+ });
7612
+
7613
+ function concat$1(parts) {
7515
7614
  return {
7516
7615
  type: "concat",
7517
7616
  parts: parts
@@ -7519,10 +7618,6 @@ function concat$1(parts) {
7519
7618
  }
7520
7619
 
7521
7620
  function indent$1(contents) {
7522
- if (process.env.NODE_ENV !== "production") {
7523
- assertDoc(contents);
7524
- }
7525
-
7526
7621
  return {
7527
7622
  type: "indent",
7528
7623
  contents: contents
@@ -7530,10 +7625,6 @@ function indent$1(contents) {
7530
7625
  }
7531
7626
 
7532
7627
  function align(n, contents) {
7533
- if (process.env.NODE_ENV !== "production") {
7534
- assertDoc(contents);
7535
- }
7536
-
7537
7628
  return {
7538
7629
  type: "align",
7539
7630
  contents: contents,
@@ -7544,12 +7635,9 @@ function align(n, contents) {
7544
7635
  function group(contents, opts) {
7545
7636
  opts = opts || {};
7546
7637
 
7547
- if (process.env.NODE_ENV !== "production") {
7548
- assertDoc(contents);
7549
- }
7550
-
7551
7638
  return {
7552
7639
  type: "group",
7640
+ id: opts.id,
7553
7641
  contents: contents,
7554
7642
  break: !!opts.shouldBreak,
7555
7643
  expandedStates: opts.expandedStates
@@ -7577,39 +7665,24 @@ function conditionalGroup(states, opts) {
7577
7665
  }
7578
7666
 
7579
7667
  function fill(parts) {
7580
- if (process.env.NODE_ENV !== "production") {
7581
- parts.forEach(assertDoc);
7582
- }
7583
-
7584
7668
  return {
7585
7669
  type: "fill",
7586
7670
  parts: parts
7587
7671
  };
7588
7672
  }
7589
7673
 
7590
- function ifBreak(breakContents, flatContents) {
7591
- if (process.env.NODE_ENV !== "production") {
7592
- if (breakContents) {
7593
- assertDoc(breakContents);
7594
- }
7595
-
7596
- if (flatContents) {
7597
- assertDoc(flatContents);
7598
- }
7599
- }
7674
+ function ifBreak(breakContents, flatContents, opts) {
7675
+ opts = opts || {};
7600
7676
 
7601
7677
  return {
7602
7678
  type: "if-break",
7603
7679
  breakContents: breakContents,
7604
- flatContents: flatContents
7680
+ flatContents: flatContents,
7681
+ groupId: opts.groupId
7605
7682
  };
7606
7683
  }
7607
7684
 
7608
7685
  function lineSuffix$1(contents) {
7609
- if (process.env.NODE_ENV !== "production") {
7610
- assertDoc(contents);
7611
- }
7612
-
7613
7686
  return {
7614
7687
  type: "line-suffix",
7615
7688
  contents: contents
@@ -7942,7 +8015,9 @@ var lib$5 = function lib(categories, flag) {
7942
8015
  return utils$2.build_regex(utils$2.normalize_ranges(ranges), flag);
7943
8016
  };
7944
8017
 
7945
- var emojiRegex = emojiRegex$1();
8018
+ var emojiRegex = emojiRegex$1(); // eslint-disable-next-line no-control-regex
8019
+
8020
+ var notAsciiRegex = /[^\x20-\x7F]/;
7946
8021
  var cjkPattern = lib$3().source; // http://spec.commonmark.org/0.25/#ascii-punctuation-character
7947
8022
 
7948
8023
  var asciiPunctuationCharRange = escapeStringRegexp("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"); // http://spec.commonmark.org/0.25/#punctuation-character
@@ -8559,9 +8634,14 @@ function splitText(text, options) {
8559
8634
  }
8560
8635
  }
8561
8636
 
8562
- function getStringWidth(text) {
8637
+ function getStringWidth$1(text) {
8563
8638
  if (!text) {
8564
8639
  return 0;
8640
+ } // shortcut to avoid needless string `RegExp`s, replacements, and allocations within `string-width`
8641
+
8642
+
8643
+ if (!notAsciiRegex.test(text)) {
8644
+ return text.length;
8565
8645
  } // emojis are considered 2-char width for consistency
8566
8646
  // see https://github.com/sindresorhus/string-width/issues/11
8567
8647
  // for the reason why not implemented in `string-width`
@@ -8581,6 +8661,24 @@ function hasNodeIgnoreComment(node) {
8581
8661
  });
8582
8662
  }
8583
8663
 
8664
+ function matchAncestorTypes(path, types, index) {
8665
+ index = index || 0;
8666
+ types = types.slice();
8667
+
8668
+ while (types.length) {
8669
+ var parent = path.getParentNode(index);
8670
+ var type = types.shift();
8671
+
8672
+ if (!parent || parent.type !== type) {
8673
+ return false;
8674
+ }
8675
+
8676
+ index++;
8677
+ }
8678
+
8679
+ return true;
8680
+ }
8681
+
8584
8682
  function addCommentHelper(node, comment) {
8585
8683
  var comments = node.comments || (node.comments = []);
8586
8684
  comments.push(comment);
@@ -8611,10 +8709,26 @@ function addTrailingComment$1(node, comment) {
8611
8709
  addCommentHelper(node, comment);
8612
8710
  }
8613
8711
 
8712
+ function isWithinParentArrayProperty(path, propertyName) {
8713
+ var node = path.getValue();
8714
+ var parent = path.getParentNode();
8715
+
8716
+ if (parent == null) {
8717
+ return false;
8718
+ }
8719
+
8720
+ if (!Array.isArray(parent[propertyName])) {
8721
+ return false;
8722
+ }
8723
+
8724
+ var key = path.getName();
8725
+ return parent[propertyName][key] === node;
8726
+ }
8727
+
8614
8728
  var util = {
8615
8729
  punctuationRegex: punctuationRegex,
8616
8730
  punctuationCharRange: punctuationCharRange,
8617
- getStringWidth: getStringWidth,
8731
+ getStringWidth: getStringWidth$1,
8618
8732
  splitText: splitText,
8619
8733
  getMaxContinuousCount: getMaxContinuousCount,
8620
8734
  getPrecedence: getPrecedence,
@@ -8645,14 +8759,20 @@ var util = {
8645
8759
  hasIgnoreComment: hasIgnoreComment,
8646
8760
  hasNodeIgnoreComment: hasNodeIgnoreComment,
8647
8761
  makeString: makeString,
8762
+ matchAncestorTypes: matchAncestorTypes,
8648
8763
  addLeadingComment: addLeadingComment$1,
8649
8764
  addDanglingComment: addDanglingComment$1,
8650
- addTrailingComment: addTrailingComment$1
8765
+ addTrailingComment: addTrailingComment$1,
8766
+ isWithinParentArrayProperty: isWithinParentArrayProperty
8651
8767
  };
8652
8768
 
8769
+ var getStringWidth = util.getStringWidth;
8653
8770
  var concat$2 = docBuilders.concat;
8654
8771
  var fill$1 = docBuilders.fill;
8655
8772
  var cursor$2 = docBuilders.cursor;
8773
+ /** @type {{[groupId: PropertyKey]: MODE}} */
8774
+
8775
+ var groupModeMap;
8656
8776
  var MODE_BREAK = 1;
8657
8777
  var MODE_FLAT = 2;
8658
8778
 
@@ -8810,7 +8930,7 @@ function fits(next, restCommands, width, options, mustBeFlat) {
8810
8930
  var doc = x[2];
8811
8931
 
8812
8932
  if (typeof doc === "string") {
8813
- width -= util.getStringWidth(doc);
8933
+ width -= getStringWidth(doc);
8814
8934
  } else {
8815
8935
  switch (doc.type) {
8816
8936
  case "concat":
@@ -8834,6 +8954,11 @@ function fits(next, restCommands, width, options, mustBeFlat) {
8834
8954
  }
8835
8955
 
8836
8956
  cmds.push([ind, doc.break ? MODE_BREAK : mode, doc.contents]);
8957
+
8958
+ if (doc.id) {
8959
+ groupModeMap[doc.id] = cmds[cmds.length - 1][1];
8960
+ }
8961
+
8837
8962
  break;
8838
8963
 
8839
8964
  case "fill":
@@ -8844,19 +8969,23 @@ function fits(next, restCommands, width, options, mustBeFlat) {
8844
8969
  break;
8845
8970
 
8846
8971
  case "if-break":
8847
- if (mode === MODE_BREAK) {
8848
- if (doc.breakContents) {
8849
- cmds.push([ind, mode, doc.breakContents]);
8972
+ {
8973
+ var groupMode = doc.groupId ? groupModeMap[doc.groupId] : mode;
8974
+
8975
+ if (groupMode === MODE_BREAK) {
8976
+ if (doc.breakContents) {
8977
+ cmds.push([ind, mode, doc.breakContents]);
8978
+ }
8850
8979
  }
8851
- }
8852
8980
 
8853
- if (mode === MODE_FLAT) {
8854
- if (doc.flatContents) {
8855
- cmds.push([ind, mode, doc.flatContents]);
8981
+ if (groupMode === MODE_FLAT) {
8982
+ if (doc.flatContents) {
8983
+ cmds.push([ind, mode, doc.flatContents]);
8984
+ }
8856
8985
  }
8857
- }
8858
8986
 
8859
- break;
8987
+ break;
8988
+ }
8860
8989
 
8861
8990
  case "line":
8862
8991
  switch (mode) {
@@ -8885,6 +9014,7 @@ function fits(next, restCommands, width, options, mustBeFlat) {
8885
9014
  }
8886
9015
 
8887
9016
  function printDocToString(doc, options) {
9017
+ groupModeMap = {};
8888
9018
  var width = options.printWidth;
8889
9019
  var newLine = options.newLine || "\n";
8890
9020
  var pos = 0; // cmds is basically a stack. We've turned a recursive call into a
@@ -8904,7 +9034,7 @@ function printDocToString(doc, options) {
8904
9034
 
8905
9035
  if (typeof _doc === "string") {
8906
9036
  out.push(_doc);
8907
- pos += util.getStringWidth(_doc);
9037
+ pos += getStringWidth(_doc);
8908
9038
  } else {
8909
9039
  switch (_doc.type) {
8910
9040
  case "cursor":
@@ -8983,6 +9113,10 @@ function printDocToString(doc, options) {
8983
9113
  }
8984
9114
  }
8985
9115
 
9116
+ if (_doc.id) {
9117
+ groupModeMap[_doc.id] = cmds[cmds.length - 1][1];
9118
+ }
9119
+
8986
9120
  break;
8987
9121
  // Fills each line with as much code as possible before moving to a new
8988
9122
  // line with the same indentation.
@@ -9075,19 +9209,23 @@ function printDocToString(doc, options) {
9075
9209
  }
9076
9210
 
9077
9211
  case "if-break":
9078
- if (mode === MODE_BREAK) {
9079
- if (_doc.breakContents) {
9080
- cmds.push([ind, mode, _doc.breakContents]);
9212
+ {
9213
+ var groupMode = _doc.groupId ? groupModeMap[_doc.groupId] : mode;
9214
+
9215
+ if (groupMode === MODE_BREAK) {
9216
+ if (_doc.breakContents) {
9217
+ cmds.push([ind, mode, _doc.breakContents]);
9218
+ }
9081
9219
  }
9082
- }
9083
9220
 
9084
- if (mode === MODE_FLAT) {
9085
- if (_doc.flatContents) {
9086
- cmds.push([ind, mode, _doc.flatContents]);
9221
+ if (groupMode === MODE_FLAT) {
9222
+ if (_doc.flatContents) {
9223
+ cmds.push([ind, mode, _doc.flatContents]);
9224
+ }
9087
9225
  }
9088
- }
9089
9226
 
9090
- break;
9227
+ break;
9228
+ }
9091
9229
 
9092
9230
  case "line-suffix":
9093
9231
  lineSuffix.push([ind, mode, _doc.contents]);
@@ -9148,8 +9286,7 @@ function printDocToString(doc, options) {
9148
9286
  out.pop();
9149
9287
  }
9150
9288
 
9151
- if (out.length && typeof out[out.length - 1] === "string" && (options.parser !== "markdown" || // preserve markdown's `break` node (two trailing spaces)
9152
- !/\S {2}$/.test(out[out.length - 1]))) {
9289
+ if (out.length && typeof out[out.length - 1] === "string") {
9153
9290
  out[out.length - 1] = out[out.length - 1].replace(/[^\S\n]*$/, "");
9154
9291
  }
9155
9292
  }
@@ -9191,46 +9328,62 @@ var docPrinter = {
9191
9328
  printDocToString: printDocToString
9192
9329
  };
9193
9330
 
9331
+ var traverseDocOnExitStackMarker = {};
9332
+
9194
9333
  function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
9195
- function traverseDocRec(doc) {
9334
+ var docsStack = [doc];
9335
+
9336
+ while (docsStack.length !== 0) {
9337
+ var _doc = docsStack.pop();
9338
+
9339
+ if (_doc === traverseDocOnExitStackMarker) {
9340
+ onExit(docsStack.pop());
9341
+ continue;
9342
+ }
9343
+
9196
9344
  var shouldRecurse = true;
9197
9345
 
9198
9346
  if (onEnter) {
9199
- if (onEnter(doc) === false) {
9347
+ if (onEnter(_doc) === false) {
9200
9348
  shouldRecurse = false;
9201
9349
  }
9202
9350
  }
9203
9351
 
9352
+ if (onExit) {
9353
+ docsStack.push(_doc);
9354
+ docsStack.push(traverseDocOnExitStackMarker);
9355
+ }
9356
+
9204
9357
  if (shouldRecurse) {
9205
- if (doc.type === "concat" || doc.type === "fill") {
9206
- for (var i = 0; i < doc.parts.length; i++) {
9207
- traverseDocRec(doc.parts[i]);
9358
+ // When there are multiple parts to process,
9359
+ // the parts need to be pushed onto the stack in reverse order,
9360
+ // so that they are processed in the original order
9361
+ // when the stack is popped.
9362
+ if (_doc.type === "concat" || _doc.type === "fill") {
9363
+ for (var ic = _doc.parts.length, i = ic - 1; i >= 0; --i) {
9364
+ docsStack.push(_doc.parts[i]);
9208
9365
  }
9209
- } else if (doc.type === "if-break") {
9210
- if (doc.breakContents) {
9211
- traverseDocRec(doc.breakContents);
9366
+ } else if (_doc.type === "if-break") {
9367
+ if (_doc.flatContents) {
9368
+ docsStack.push(_doc.flatContents);
9212
9369
  }
9213
9370
 
9214
- if (doc.flatContents) {
9215
- traverseDocRec(doc.flatContents);
9371
+ if (_doc.breakContents) {
9372
+ docsStack.push(_doc.breakContents);
9216
9373
  }
9217
- } else if (doc.type === "group" && doc.expandedStates) {
9374
+ } else if (_doc.type === "group" && _doc.expandedStates) {
9218
9375
  if (shouldTraverseConditionalGroups) {
9219
- doc.expandedStates.forEach(traverseDocRec);
9376
+ for (var _ic = _doc.expandedStates.length, _i = _ic - 1; _i >= 0; --_i) {
9377
+ docsStack.push(_doc.expandedStates[_i]);
9378
+ }
9220
9379
  } else {
9221
- traverseDocRec(doc.contents);
9380
+ docsStack.push(_doc.contents);
9222
9381
  }
9223
- } else if (doc.contents) {
9224
- traverseDocRec(doc.contents);
9382
+ } else if (_doc.contents) {
9383
+ docsStack.push(_doc.contents);
9225
9384
  }
9226
9385
  }
9227
-
9228
- if (onExit) {
9229
- onExit(doc);
9230
- }
9231
9386
  }
9232
-
9233
- traverseDocRec(doc);
9234
9387
  }
9235
9388
 
9236
9389
  function mapDoc(doc, cb) {
@@ -9261,7 +9414,8 @@ function mapDoc(doc, cb) {
9261
9414
  function findInDoc(doc, fn, defaultValue) {
9262
9415
  var result = defaultValue;
9263
9416
  var hasStopped = false;
9264
- traverseDoc(doc, function (doc) {
9417
+
9418
+ function findInDocOnEnterFn(doc) {
9265
9419
  var maybeResult = fn(doc);
9266
9420
 
9267
9421
  if (maybeResult !== undefined) {
@@ -9272,7 +9426,9 @@ function findInDoc(doc, fn, defaultValue) {
9272
9426
  if (hasStopped) {
9273
9427
  return false;
9274
9428
  }
9275
- });
9429
+ }
9430
+
9431
+ traverseDoc(doc, findInDocOnEnterFn);
9276
9432
  return result;
9277
9433
  }
9278
9434
 
@@ -9280,32 +9436,36 @@ function isEmpty(n) {
9280
9436
  return typeof n === "string" && n.length === 0;
9281
9437
  }
9282
9438
 
9283
- function isLineNext(doc) {
9284
- return findInDoc(doc, function (doc) {
9285
- if (typeof doc === "string") {
9286
- return false;
9287
- }
9439
+ function isLineNextFn(doc) {
9440
+ if (typeof doc === "string") {
9441
+ return false;
9442
+ }
9288
9443
 
9289
- if (doc.type === "line") {
9290
- return true;
9291
- }
9292
- }, false);
9444
+ if (doc.type === "line") {
9445
+ return true;
9446
+ }
9293
9447
  }
9294
9448
 
9295
- function willBreak(doc) {
9296
- return findInDoc(doc, function (doc) {
9297
- if (doc.type === "group" && doc.break) {
9298
- return true;
9299
- }
9449
+ function isLineNext(doc) {
9450
+ return findInDoc(doc, isLineNextFn, false);
9451
+ }
9300
9452
 
9301
- if (doc.type === "line" && doc.hard) {
9302
- return true;
9303
- }
9453
+ function willBreakFn(doc) {
9454
+ if (doc.type === "group" && doc.break) {
9455
+ return true;
9456
+ }
9304
9457
 
9305
- if (doc.type === "break-parent") {
9306
- return true;
9307
- }
9308
- }, false);
9458
+ if (doc.type === "line" && doc.hard) {
9459
+ return true;
9460
+ }
9461
+
9462
+ if (doc.type === "break-parent") {
9463
+ return true;
9464
+ }
9465
+ }
9466
+
9467
+ function willBreak(doc) {
9468
+ return findInDoc(doc, willBreakFn, false);
9309
9469
  }
9310
9470
 
9311
9471
  function breakParentGroup(groupStack) {
@@ -9322,9 +9482,10 @@ function breakParentGroup(groupStack) {
9322
9482
  }
9323
9483
 
9324
9484
  function propagateBreaks(doc) {
9325
- var alreadyVisited = new Map();
9485
+ var alreadyVisitedSet = new Set();
9326
9486
  var groupStack = [];
9327
- traverseDoc(doc, function (doc) {
9487
+
9488
+ function propagateBreaksOnEnterFn(doc) {
9328
9489
  if (doc.type === "break-parent") {
9329
9490
  breakParentGroup(groupStack);
9330
9491
  }
@@ -9332,13 +9493,15 @@ function propagateBreaks(doc) {
9332
9493
  if (doc.type === "group") {
9333
9494
  groupStack.push(doc);
9334
9495
 
9335
- if (alreadyVisited.has(doc)) {
9496
+ if (alreadyVisitedSet.has(doc)) {
9336
9497
  return false;
9337
9498
  }
9338
9499
 
9339
- alreadyVisited.set(doc, true);
9500
+ alreadyVisitedSet.add(doc);
9340
9501
  }
9341
- }, function (doc) {
9502
+ }
9503
+
9504
+ function propagateBreaksOnExitFn(doc) {
9342
9505
  if (doc.type === "group") {
9343
9506
  var group = groupStack.pop();
9344
9507
 
@@ -9346,25 +9509,29 @@ function propagateBreaks(doc) {
9346
9509
  breakParentGroup(groupStack);
9347
9510
  }
9348
9511
  }
9349
- },
9512
+ }
9513
+
9514
+ traverseDoc(doc, propagateBreaksOnEnterFn, propagateBreaksOnExitFn,
9350
9515
  /* shouldTraverseConditionalGroups */
9351
9516
  true);
9352
9517
  }
9353
9518
 
9354
- function removeLines(doc) {
9519
+ function removeLinesFn(doc) {
9355
9520
  // Force this doc into flat mode by statically converting all
9356
9521
  // lines into spaces (or soft lines into nothing). Hard lines
9357
9522
  // should still output because there's too great of a chance
9358
9523
  // of breaking existing assumptions otherwise.
9359
- return mapDoc(doc, function (d) {
9360
- if (d.type === "line" && !d.hard) {
9361
- return d.soft ? "" : " ";
9362
- } else if (d.type === "if-break") {
9363
- return d.flatContents || "";
9364
- }
9524
+ if (doc.type === "line" && !doc.hard) {
9525
+ return doc.soft ? "" : " ";
9526
+ } else if (doc.type === "if-break") {
9527
+ return doc.flatContents || "";
9528
+ }
9365
9529
 
9366
- return d;
9367
- });
9530
+ return doc;
9531
+ }
9532
+
9533
+ function removeLines(doc) {
9534
+ return mapDoc(doc, removeLinesFn);
9368
9535
  }
9369
9536
 
9370
9537
  function stripTrailingHardline(doc) {
@@ -9510,6 +9677,10 @@ function isNextLineEmpty$1(text, node, options) {
9510
9677
  return util.isNextLineEmpty(text, node, options.locEnd);
9511
9678
  }
9512
9679
 
9680
+ function isPreviousLineEmpty$2(text, node, options) {
9681
+ return util.isPreviousLineEmpty(text, node, options.locStart);
9682
+ }
9683
+
9513
9684
  function getNextNonSpaceNonCommentCharacterIndex$1(text, node, options) {
9514
9685
  return util.getNextNonSpaceNonCommentCharacterIndex(text, node, options.locEnd);
9515
9686
  }
@@ -9517,6 +9688,7 @@ function getNextNonSpaceNonCommentCharacterIndex$1(text, node, options) {
9517
9688
  var utilShared = {
9518
9689
  isNextLineEmpty: isNextLineEmpty$1,
9519
9690
  isNextLineEmptyAfterIndex: util.isNextLineEmptyAfterIndex,
9691
+ isPreviousLineEmpty: isPreviousLineEmpty$2,
9520
9692
  getNextNonSpaceNonCommentCharacterIndex: getNextNonSpaceNonCommentCharacterIndex$1,
9521
9693
  mapDoc: mapDoc$1,
9522
9694
  // TODO: remove in 2.0, we already exposed it in docUtils
@@ -9526,6 +9698,8 @@ var utilShared = {
9526
9698
  addTrailingComment: util.addTrailingComment
9527
9699
  };
9528
9700
 
9701
+ var assert$3 = ( assert$2 && assert ) || assert$2;
9702
+
9529
9703
  var _require$$0$builders = doc.builders;
9530
9704
  var concat = _require$$0$builders.concat;
9531
9705
  var hardline = _require$$0$builders.hardline;
@@ -9547,9 +9721,9 @@ function getSortedChildNodes(node, options, resultArray) {
9547
9721
  return;
9548
9722
  }
9549
9723
 
9550
- var printer = options.printer;
9551
- var locStart = options.locStart;
9552
- var locEnd = options.locEnd;
9724
+ var printer = options.printer,
9725
+ locStart = options.locStart,
9726
+ locEnd = options.locEnd;
9553
9727
 
9554
9728
  if (resultArray) {
9555
9729
  if (node && printer.canAttachComment && printer.canAttachComment(node)) {
@@ -9604,8 +9778,8 @@ function getSortedChildNodes(node, options, resultArray) {
9604
9778
 
9605
9779
 
9606
9780
  function decorateComment(node, comment, options) {
9607
- var locStart = options.locStart;
9608
- var locEnd = options.locEnd;
9781
+ var locStart = options.locStart,
9782
+ locEnd = options.locEnd;
9609
9783
  var childNodes = getSortedChildNodes(node, options);
9610
9784
  var precedingNode;
9611
9785
  var followingNode; // Time to dust off the old binary search robes and wizard hat.
@@ -9679,8 +9853,8 @@ function attach(comments, ast, text, options) {
9679
9853
  }
9680
9854
 
9681
9855
  var tiesToBreak = [];
9682
- var locStart = options.locStart;
9683
- var locEnd = options.locEnd;
9856
+ var locStart = options.locStart,
9857
+ locEnd = options.locEnd;
9684
9858
  comments.forEach(function (comment, i) {
9685
9859
  if ((options.parser === "json" || options.parser === "json5") && locStart(comment) - locStart(ast) <= 0) {
9686
9860
  addLeadingComment(ast, comment);
@@ -9688,9 +9862,9 @@ function attach(comments, ast, text, options) {
9688
9862
  }
9689
9863
 
9690
9864
  decorateComment(ast, comment, options);
9691
- var precedingNode = comment.precedingNode;
9692
- var enclosingNode = comment.enclosingNode;
9693
- var followingNode = comment.followingNode;
9865
+ var precedingNode = comment.precedingNode,
9866
+ enclosingNode = comment.enclosingNode,
9867
+ followingNode = comment.followingNode;
9694
9868
  var pluginHandleOwnLineComment = options.printer.handleComments && options.printer.handleComments.ownLine ? options.printer.handleComments.ownLine : function () {
9695
9869
  return false;
9696
9870
  };
@@ -9788,8 +9962,9 @@ function breakTies(tiesToBreak, text, options) {
9788
9962
  return;
9789
9963
  }
9790
9964
 
9791
- var precedingNode = tiesToBreak[0].precedingNode;
9792
- var followingNode = tiesToBreak[0].followingNode;
9965
+ var _tiesToBreak$ = tiesToBreak[0],
9966
+ precedingNode = _tiesToBreak$.precedingNode,
9967
+ followingNode = _tiesToBreak$.followingNode;
9793
9968
  var gapEndPos = options.locStart(followingNode); // Iterate backwards through tiesToBreak, examining the gaps
9794
9969
  // between the tied comments. In order to qualify as leading, a
9795
9970
  // comment must be separated from followingNode by an unbroken series of
@@ -9800,8 +9975,8 @@ function breakTies(tiesToBreak, text, options) {
9800
9975
 
9801
9976
  for (indexOfFirstLeadingComment = tieCount; indexOfFirstLeadingComment > 0; --indexOfFirstLeadingComment) {
9802
9977
  var comment = tiesToBreak[indexOfFirstLeadingComment - 1];
9803
- assert.strictEqual(comment.precedingNode, precedingNode);
9804
- assert.strictEqual(comment.followingNode, followingNode);
9978
+ assert$3.strictEqual(comment.precedingNode, precedingNode);
9979
+ assert$3.strictEqual(comment.followingNode, followingNode);
9805
9980
  var gap = text.slice(options.locEnd(comment), gapEndPos).trim();
9806
9981
 
9807
9982
  if (gap === "" || /^\(+$/.test(gap)) {
@@ -9967,8 +10142,8 @@ function printComments(path, print, options, needsSemi) {
9967
10142
  var trailingParts = [needsSemi ? ";" : "", printed];
9968
10143
  path.each(function (commentPath) {
9969
10144
  var comment = commentPath.getValue();
9970
- var leading = comment.leading;
9971
- var trailing = comment.trailing;
10145
+ var leading = comment.leading,
10146
+ trailing = comment.trailing;
9972
10147
 
9973
10148
  if (leading) {
9974
10149
  var contents = printLeadingComment(commentPath, print, options);
@@ -9998,7 +10173,7 @@ var comments = {
9998
10173
  };
9999
10174
 
10000
10175
  function FastPath(value) {
10001
- assert.ok(this instanceof FastPath);
10176
+ assert$3.ok(this instanceof FastPath);
10002
10177
  this.stack = [value];
10003
10178
  } // The name of the current property is always the penultimate element of
10004
10179
  // this.stack, and always a String.
@@ -10223,7 +10398,7 @@ function printAstToDoc(ast, options, addAlignmentSize) {
10223
10398
  }
10224
10399
 
10225
10400
  function genericPrint(path, options, printPath, args) {
10226
- assert.ok(path instanceof fastPath);
10401
+ assert$3.ok(path instanceof fastPath);
10227
10402
  var node = path.getValue();
10228
10403
  var printer = options.printer; // Escape hatch
10229
10404
 
@@ -10407,6 +10582,9 @@ function isSourceElement(opts, node) {
10407
10582
 
10408
10583
  case "graphql":
10409
10584
  return graphqlSourceElements.indexOf(node.kind) > -1;
10585
+
10586
+ case "vue":
10587
+ return node.tag !== "root";
10410
10588
  }
10411
10589
 
10412
10590
  return false;
@@ -10440,8 +10618,8 @@ function calculateRange(text, opts, ast) {
10440
10618
  }
10441
10619
 
10442
10620
  var siblingAncestors = findSiblingAncestors(startNodeAndParents, endNodeAndParents, opts);
10443
- var startNode = siblingAncestors.startNode;
10444
- var endNode = siblingAncestors.endNode;
10621
+ var startNode = siblingAncestors.startNode,
10622
+ endNode = siblingAncestors.endNode;
10445
10623
  var rangeStart = Math.min(opts.locStart(startNode, opts.locStart), opts.locStart(endNode, opts.locStart));
10446
10624
  var rangeEnd = Math.max(opts.locEnd(startNode, opts.locEnd), opts.locEnd(endNode, opts.locEnd));
10447
10625
  return {
@@ -10502,11 +10680,18 @@ function attachComments(text, ast, opts) {
10502
10680
  }
10503
10681
 
10504
10682
  ast.tokens = [];
10505
- opts.originalText = text.trimRight();
10683
+ opts.originalText = opts.parser === "yaml" ? text : text.trimRight();
10506
10684
  return astComments;
10507
10685
  }
10508
10686
 
10509
10687
  function coreFormat(text, opts, addAlignmentSize) {
10688
+ if (!text || !text.trim().length) {
10689
+ return {
10690
+ formatted: "",
10691
+ cursorOffset: 0
10692
+ };
10693
+ }
10694
+
10510
10695
  addAlignmentSize = addAlignmentSize || 0;
10511
10696
  var parsed = parser.parse(text, opts);
10512
10697
  var ast = parsed.ast;
@@ -10693,7 +10878,7 @@ function format(text, opts) {
10693
10878
  var core = {
10694
10879
  formatWithCursor: function formatWithCursor(text, opts) {
10695
10880
  opts = normalizeOptions(opts);
10696
- return format(text, normalizeOptions(opts));
10881
+ return format(text, opts);
10697
10882
  },
10698
10883
  parse: function parse(text, opts, massage) {
10699
10884
  opts = normalizeOptions(opts);
@@ -11144,7 +11329,12 @@ var embed_1 = embed;
11144
11329
  function clean(ast, newObj, parent) {
11145
11330
  ["range", "raw", "comments", "leadingComments", "trailingComments", "extra", "start", "end", "flags"].forEach(function (name) {
11146
11331
  delete newObj[name];
11147
- }); // We remove extra `;` and add them when needed
11332
+ });
11333
+
11334
+ if (ast.type === "BigIntLiteral") {
11335
+ newObj.value = newObj.value.toLowerCase();
11336
+ } // We remove extra `;` and add them when needed
11337
+
11148
11338
 
11149
11339
  if (ast.type === "EmptyStatement") {
11150
11340
  return null;
@@ -11292,20 +11482,10 @@ var detectNewline = createCommonjsModule(function (module) {
11292
11482
  };
11293
11483
  });
11294
11484
 
11295
- var os$8 = {};
11296
-
11297
-
11298
- var os$10 = Object.freeze({
11299
- default: os$8,
11300
- __moduleExports: os$8
11301
- });
11302
-
11303
- var require$$1$4 = ( os$10 && os$8 ) || os$10;
11304
-
11305
11485
  var build = createCommonjsModule(function (module, exports) {
11306
11486
  'use strict';
11307
11487
 
11308
- Object.defineProperty(exports, "__esModule", {
11488
+ Object.defineProperty(exports, '__esModule', {
11309
11489
  value: true
11310
11490
  });
11311
11491
  exports.extract = extract;
@@ -11323,7 +11503,7 @@ var build = createCommonjsModule(function (module, exports) {
11323
11503
  var _os;
11324
11504
 
11325
11505
  function _load_os() {
11326
- return _os = require$$1$4;
11506
+ return _os = require$$1$1;
11327
11507
  }
11328
11508
 
11329
11509
  function _interopRequireDefault(obj) {
@@ -11332,21 +11512,19 @@ var build = createCommonjsModule(function (module, exports) {
11332
11512
  };
11333
11513
  }
11334
11514
  /**
11335
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
11336
- *
11337
- * This source code is licensed under the MIT license found in the
11338
- * LICENSE file in the root directory of this source tree.
11339
- *
11340
- *
11341
- */
11515
+ * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
11516
+ *
11517
+ * This source code is licensed under the MIT license found in the
11518
+ * LICENSE file in the root directory of this source tree.
11519
+ *
11520
+ *
11521
+ */
11342
11522
 
11343
11523
 
11344
11524
  var commentEndRe = /\*\/$/;
11345
11525
  var commentStartRe = /^\/\*\*/;
11346
11526
  var docblockRe = /^\s*(\/\*\*?(.|\r?\n)*?\*\/)/;
11347
11527
  var lineCommentRe = /(^|\s+)\/\/([^\r\n]*)/g;
11348
- var ltrimRe = /^\s*/;
11349
- var rtrimRe = /\s*$/;
11350
11528
  var ltrimNewlineRe = /^(\r?\n)+/;
11351
11529
  var multilineRe = /(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *(?![^@\r\n]*\/\/[^]*)([^@\r\n\s][^@\r\n]+?) *\r?\n/g;
11352
11530
  var propertyRe = /(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g;
@@ -11354,7 +11532,7 @@ var build = createCommonjsModule(function (module, exports) {
11354
11532
 
11355
11533
  function extract(contents) {
11356
11534
  var match = contents.match(docblockRe);
11357
- return match ? match[0].replace(ltrimRe, '') || '' : '';
11535
+ return match ? match[0].trimLeft() : '';
11358
11536
  }
11359
11537
 
11360
11538
  function strip(contents) {
@@ -11378,9 +11556,9 @@ var build = createCommonjsModule(function (module, exports) {
11378
11556
  docblock = docblock.replace(multilineRe, "".concat(line, "$1 $2").concat(line));
11379
11557
  }
11380
11558
 
11381
- docblock = docblock.replace(ltrimNewlineRe, '').replace(rtrimRe, '');
11559
+ docblock = docblock.replace(ltrimNewlineRe, '').trimRight();
11382
11560
  var result = Object.create(null);
11383
- var comments = docblock.replace(propertyRe, '').replace(ltrimNewlineRe, '').replace(rtrimRe, '');
11561
+ var comments = docblock.replace(propertyRe, '').replace(ltrimNewlineRe, '').trimRight();
11384
11562
  var match;
11385
11563
 
11386
11564
  while (match = propertyRe.exec(docblock)) {
@@ -11475,9 +11653,9 @@ var addTrailingComment$2 = utilShared.addTrailingComment;
11475
11653
  var addDanglingComment$2 = utilShared.addDanglingComment;
11476
11654
 
11477
11655
  function handleOwnLineComment(comment, text, options, ast, isLastComment) {
11478
- var precedingNode = comment.precedingNode;
11479
- var enclosingNode = comment.enclosingNode;
11480
- var followingNode = comment.followingNode;
11656
+ var precedingNode = comment.precedingNode,
11657
+ enclosingNode = comment.enclosingNode,
11658
+ followingNode = comment.followingNode;
11481
11659
 
11482
11660
  if (handleLastFunctionArgComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleMemberExpressionComments(enclosingNode, followingNode, comment) || handleIfStatementComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleTryStatementComments(enclosingNode, followingNode, comment) || handleClassComments(enclosingNode, precedingNode, followingNode, comment) || handleImportSpecifierComments(enclosingNode, comment) || handleForComments(enclosingNode, precedingNode, comment) || handleUnionTypeComments(precedingNode, enclosingNode, followingNode, comment) || handleOnlyComments(enclosingNode, ast, comment, isLastComment) || handleImportDeclarationComments(text, enclosingNode, precedingNode, comment, options) || handleAssignmentPatternComments(enclosingNode, comment) || handleMethodNameComments(text, enclosingNode, precedingNode, comment, options)) {
11483
11661
  return true;
@@ -11487,9 +11665,9 @@ function handleOwnLineComment(comment, text, options, ast, isLastComment) {
11487
11665
  }
11488
11666
 
11489
11667
  function handleEndOfLineComment(comment, text, options, ast, isLastComment) {
11490
- var precedingNode = comment.precedingNode;
11491
- var enclosingNode = comment.enclosingNode;
11492
- var followingNode = comment.followingNode;
11668
+ var precedingNode = comment.precedingNode,
11669
+ enclosingNode = comment.enclosingNode,
11670
+ followingNode = comment.followingNode;
11493
11671
 
11494
11672
  if (handleLastFunctionArgComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleConditionalExpressionComments(enclosingNode, precedingNode, followingNode, comment, text, options) || handleImportSpecifierComments(enclosingNode, comment) || handleIfStatementComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleClassComments(enclosingNode, precedingNode, followingNode, comment) || handleLabeledStatementComments(enclosingNode, comment) || handleCallExpressionComments(precedingNode, enclosingNode, comment) || handlePropertyComments(enclosingNode, comment) || handleOnlyComments(enclosingNode, ast, comment, isLastComment) || handleTypeAliasComments(enclosingNode, followingNode, comment) || handleVariableDeclaratorComments(enclosingNode, followingNode, comment)) {
11495
11673
  return true;
@@ -11499,9 +11677,9 @@ function handleEndOfLineComment(comment, text, options, ast, isLastComment) {
11499
11677
  }
11500
11678
 
11501
11679
  function handleRemainingComment(comment, text, options, ast, isLastComment) {
11502
- var precedingNode = comment.precedingNode;
11503
- var enclosingNode = comment.enclosingNode;
11504
- var followingNode = comment.followingNode;
11680
+ var precedingNode = comment.precedingNode,
11681
+ enclosingNode = comment.enclosingNode,
11682
+ followingNode = comment.followingNode;
11505
11683
 
11506
11684
  if (handleIfStatementComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleObjectPropertyAssignment(enclosingNode, precedingNode, comment) || handleCommentInEmptyParens(text, enclosingNode, comment, options) || handleMethodNameComments(text, enclosingNode, precedingNode, comment, options) || handleOnlyComments(enclosingNode, ast, comment, isLastComment) || handleCommentAfterArrowParams(text, enclosingNode, comment, options) || handleFunctionNameComments(text, enclosingNode, precedingNode, comment, options) || handleTSMappedTypeComments(text, enclosingNode, precedingNode, followingNode, comment) || handleBreakAndContinueStatementComments(enclosingNode, comment)) {
11507
11685
  return true;
@@ -11902,12 +12080,22 @@ var comments$3 = {
11902
12080
  isBlockComment: isBlockComment
11903
12081
  };
11904
12082
 
11905
- function hasClosureCompilerTypeCastComment(text, node, locEnd) {
12083
+ function hasClosureCompilerTypeCastComment(text, path, locStart, locEnd) {
11906
12084
  // https://github.com/google/closure-compiler/wiki/Annotating-Types#type-casts
11907
12085
  // Syntax example: var x = /** @type {string} */ (fruit);
11908
- return node.comments && node.comments.some(function (comment) {
11909
- return comment.leading && comments$3.isBlockComment(comment) && comment.value.match(/^\*\s*@type\s*{[^}]+}\s*$/) && util.getNextNonSpaceNonCommentCharacter(text, comment, locEnd) === "(";
11910
- });
12086
+ var n = path.getValue();
12087
+ return util.getNextNonSpaceNonCommentCharacter(text, n, locEnd) === ")" && (hasTypeCastComment(n) || hasAncestorTypeCastComment(0)); // for sub-item: /** @type {array} */ (numberOrString).map(x => x);
12088
+
12089
+ function hasAncestorTypeCastComment(index) {
12090
+ var ancestor = path.getParentNode(index);
12091
+ return ancestor && util.getNextNonSpaceNonCommentCharacter(text, ancestor, locEnd) !== ")" && /^[\s(]*$/.test(text.slice(locStart(ancestor), locStart(n))) ? hasTypeCastComment(ancestor) || hasAncestorTypeCastComment(index + 1) : false;
12092
+ }
12093
+
12094
+ function hasTypeCastComment(node) {
12095
+ return node.comments && node.comments.some(function (comment) {
12096
+ return comment.leading && comments$3.isBlockComment(comment) && comment.value.match(/^\*\s*@type\s*{[^}]+}\s*$/) && util.getNextNonSpaceNonCommentCharacter(text, comment, locEnd) === "(";
12097
+ });
12098
+ }
11911
12099
  }
11912
12100
 
11913
12101
  function needsParens(path, options) {
@@ -11933,7 +12121,7 @@ function needsParens(path, options) {
11933
12121
  // parentheses.
11934
12122
 
11935
12123
 
11936
- if (hasClosureCompilerTypeCastComment(options.originalText, node, options.locEnd)) {
12124
+ if (hasClosureCompilerTypeCastComment(options.originalText, path, options.locStart, options.locEnd)) {
11937
12125
  return true;
11938
12126
  } // Identifiers never need parentheses.
11939
12127
 
@@ -12066,7 +12254,6 @@ function needsParens(path, options) {
12066
12254
  case "UnaryExpression":
12067
12255
  case "SpreadElement":
12068
12256
  case "SpreadProperty":
12069
- case "ExperimentalSpreadProperty":
12070
12257
  case "BindExpression":
12071
12258
  case "AwaitExpression":
12072
12259
  case "TSAsExpression":
@@ -12104,7 +12291,7 @@ function needsParens(path, options) {
12104
12291
  }
12105
12292
 
12106
12293
  if (pp === np && name === "right") {
12107
- assert.strictEqual(parent.right, node);
12294
+ assert$3.strictEqual(parent.right, node);
12108
12295
  return true;
12109
12296
  }
12110
12297
 
@@ -12186,9 +12373,9 @@ function needsParens(path, options) {
12186
12373
  case "LogicalExpression":
12187
12374
  case "SpreadElement":
12188
12375
  case "SpreadProperty":
12189
- case "ExperimentalSpreadProperty":
12190
12376
  case "TSAsExpression":
12191
12377
  case "TSNonNullExpression":
12378
+ case "BindExpression":
12192
12379
  return true;
12193
12380
 
12194
12381
  case "MemberExpression":
@@ -12269,7 +12456,6 @@ function needsParens(path, options) {
12269
12456
  case "UnaryExpression":
12270
12457
  case "SpreadElement":
12271
12458
  case "SpreadProperty":
12272
- case "ExperimentalSpreadProperty":
12273
12459
  case "BinaryExpression":
12274
12460
  case "LogicalExpression":
12275
12461
  case "ExportDefaultDeclaration":
@@ -12363,7 +12549,7 @@ var getNextNonSpaceNonCommentCharacter$1 = util.getNextNonSpaceNonCommentCharact
12363
12549
  var hasNewline$2 = util.hasNewline;
12364
12550
  var hasNewlineInRange$1 = util.hasNewlineInRange;
12365
12551
  var getLast$4 = util.getLast;
12366
- var getStringWidth$1 = util.getStringWidth;
12552
+ var getStringWidth$2 = util.getStringWidth;
12367
12553
  var printString$1 = util.printString;
12368
12554
  var printNumber$1 = util.printNumber;
12369
12555
  var hasIgnoreComment$1 = util.hasIgnoreComment;
@@ -12372,6 +12558,8 @@ var hasNodeIgnoreComment$1 = util.hasNodeIgnoreComment;
12372
12558
  var getPenultimate$1 = util.getPenultimate;
12373
12559
  var startsWithNoLookaheadToken$1 = util.startsWithNoLookaheadToken;
12374
12560
  var getIndentSize$1 = util.getIndentSize;
12561
+ var matchAncestorTypes$1 = util.matchAncestorTypes;
12562
+ var isWithinParentArrayProperty$1 = util.isWithinParentArrayProperty;
12375
12563
  var isNextLineEmpty$2 = utilShared.isNextLineEmpty;
12376
12564
  var isNextLineEmptyAfterIndex$1 = utilShared.isNextLineEmptyAfterIndex;
12377
12565
  var getNextNonSpaceNonCommentCharacterIndex$2 = utilShared.getNextNonSpaceNonCommentCharacterIndex;
@@ -12439,7 +12627,7 @@ function genericPrint$1(path, options, printPath, args) {
12439
12627
  if (node.decorators && node.decorators.length > 0 && // If the parent node is an export declaration, it will be
12440
12628
  // responsible for printing node.decorators.
12441
12629
  !getParentExportDeclaration$1(path)) {
12442
- var separator = hardline$3;
12630
+ var separator = node.decorators.length === 1 && isWithinParentArrayProperty$1(path, "params") ? line$3 : hardline$3;
12443
12631
  path.each(function (decoratorPath) {
12444
12632
  var decorator = decoratorPath.getValue();
12445
12633
 
@@ -12449,10 +12637,6 @@ function genericPrint$1(path, options, printPath, args) {
12449
12637
  decorator = decorator.callee;
12450
12638
  }
12451
12639
 
12452
- if (node.decorators.length === 1 && node.type !== "ClassDeclaration" && node.type !== "MethodDefinition" && node.type !== "ClassMethod" && (decorator.type === "Identifier" || decorator.type === "MemberExpression" || decorator.type === "OptionalMemberExpression" || (decorator.type === "CallExpression" || decorator.type === "OptionalCallExpression") && (decorator.arguments.length === 0 || decorator.arguments.length === 1 && (isStringLiteral(decorator.arguments[0]) || decorator.arguments[0].type === "Identifier" || decorator.arguments[0].type === "MemberExpression" || decorator.arguments[0].type === "OptionalMemberExpression")))) {
12453
- separator = line$3;
12454
- }
12455
-
12456
12640
  decorators.push(printPath(decoratorPath), separator);
12457
12641
  }, "decorators");
12458
12642
  } else if (isExportDeclaration$1(node) && node.declaration && node.declaration.decorators) {
@@ -12791,8 +12975,6 @@ function printPathNoParens(path, options, print, args) {
12791
12975
  case "SpreadElement":
12792
12976
  case "SpreadElementPattern":
12793
12977
  case "RestProperty":
12794
- case "ExperimentalRestProperty":
12795
- case "ExperimentalSpreadProperty":
12796
12978
  case "SpreadProperty":
12797
12979
  case "SpreadPropertyPattern":
12798
12980
  case "RestElement":
@@ -13182,7 +13364,7 @@ function printPathNoParens(path, options, print, args) {
13182
13364
  return result;
13183
13365
  });
13184
13366
  var lastElem = getLast$4(n[propertiesField]);
13185
- var canHaveTrailingSeparator = !(lastElem && (lastElem.type === "RestProperty" || lastElem.type === "RestElement" || lastElem.type === "ExperimentalRestProperty" || hasNodeIgnoreComment$1(lastElem)));
13367
+ var canHaveTrailingSeparator = !(lastElem && (lastElem.type === "RestProperty" || lastElem.type === "RestElement" || hasNodeIgnoreComment$1(lastElem)));
13186
13368
  var content;
13187
13369
 
13188
13370
  if (props.length === 0 && !n.typeAnnotation) {
@@ -13320,6 +13502,9 @@ function printPathNoParens(path, options, print, args) {
13320
13502
  // Babel 6 Literal split
13321
13503
  return printNumber$1(n.extra.raw);
13322
13504
 
13505
+ case "BigIntLiteral":
13506
+ return concat$4([printNumber$1(n.extra.rawValue), "n"]);
13507
+
13323
13508
  case "BooleanLiteral": // Babel 6 Literal split
13324
13509
 
13325
13510
  case "StringLiteral": // Babel 6 Literal split
@@ -13759,6 +13944,7 @@ function printPathNoParens(path, options, print, args) {
13759
13944
  parts.push(printPropertyKey(path, options, print));
13760
13945
  }
13761
13946
 
13947
+ parts.push(printOptionalToken(path));
13762
13948
  parts.push(printTypeAnnotation(path, options, print));
13763
13949
 
13764
13950
  if (n.value) {
@@ -13864,12 +14050,12 @@ function printPathNoParens(path, options, print, args) {
13864
14050
  return !row.hasLineBreak;
13865
14051
  }).forEach(function (row) {
13866
14052
  row.cells.forEach(function (cell, index) {
13867
- maxColumnWidths[index] = Math.max(maxColumnWidths[index], getStringWidth$1(cell));
14053
+ maxColumnWidths[index] = Math.max(maxColumnWidths[index], getStringWidth$2(cell));
13868
14054
  });
13869
14055
  });
13870
14056
  parts.push("`", indent$2(concat$4([hardline$3, join$2(hardline$3, table.map(function (row) {
13871
14057
  return join$2(" | ", row.cells.map(function (cell, index) {
13872
- return row.hasLineBreak ? cell : cell + " ".repeat(maxColumnWidths[index] - getStringWidth$1(cell));
14058
+ return row.hasLineBreak ? cell : cell + " ".repeat(maxColumnWidths[index] - getStringWidth$2(cell));
13873
14059
  }));
13874
14060
  }))])), hardline$3, "`");
13875
14061
  return concat$4(parts);
@@ -14070,6 +14256,12 @@ function printPathNoParens(path, options, print, args) {
14070
14256
  return group$1(concat$4(parts));
14071
14257
  }
14072
14258
 
14259
+ case "TSRestType":
14260
+ return concat$4(["...", path.call(print, "typeAnnotation")]);
14261
+
14262
+ case "TSOptionalType":
14263
+ return concat$4([path.call(print, "typeAnnotation"), "?"]);
14264
+
14073
14265
  case "FunctionTypeParam":
14074
14266
  return concat$4([path.call(print, "name"), printOptionalToken(path), n.name ? ": " : "", path.call(print, "typeAnnotation")]);
14075
14267
 
@@ -14078,7 +14270,6 @@ function printPathNoParens(path, options, print, args) {
14078
14270
 
14079
14271
  case "DeclareInterface":
14080
14272
  case "InterfaceDeclaration":
14081
- case "InterfaceType":
14082
14273
  case "InterfaceTypeAnnotation":
14083
14274
  {
14084
14275
  if (n.type === "DeclareInterface" || isNodeStartingWithDeclare(n, options)) {
@@ -14240,7 +14431,7 @@ function printPathNoParens(path, options, print, args) {
14240
14431
  return nodeStr(n, options);
14241
14432
 
14242
14433
  case "NumberLiteralTypeAnnotation":
14243
- assert.strictEqual(_typeof(n.value), "number");
14434
+ assert$3.strictEqual(_typeof(n.value), "number");
14244
14435
 
14245
14436
  if (n.extra != null) {
14246
14437
  return printNumber$1(n.extra.raw);
@@ -14382,6 +14573,9 @@ function printPathNoParens(path, options, print, args) {
14382
14573
  case "TSUndefinedKeyword":
14383
14574
  return "undefined";
14384
14575
 
14576
+ case "TSUnknownKeyword":
14577
+ return "unknown";
14578
+
14385
14579
  case "TSVoidKeyword":
14386
14580
  return "void";
14387
14581
 
@@ -14483,7 +14677,7 @@ function printPathNoParens(path, options, print, args) {
14483
14677
 
14484
14678
  case "TSLastTypeNode":
14485
14679
  // TSImportType
14486
- return concat$4([!n.isTypeOf ? "" : "typeof ", "import(", path.call(print, "argument"), ")", !n.qualifier ? "" : concat$4([".", path.call(print, "qualifier")])]);
14680
+ return concat$4([!n.isTypeOf ? "" : "typeof ", "import(", path.call(print, "argument"), ")", !n.qualifier ? "" : concat$4([".", path.call(print, "qualifier")]), printTypeParameters(path, options, print, "typeParameters")]);
14487
14681
 
14488
14682
  case "TSLiteralType":
14489
14683
  return path.call(print, "literal");
@@ -14772,7 +14966,7 @@ function printMethod(path, options, print) {
14772
14966
  parts.push("*");
14773
14967
  }
14774
14968
  } else {
14775
- assert.ok(kind === "get" || kind === "set");
14969
+ assert$3.ok(kind === "get" || kind === "set");
14776
14970
  parts.push(kind, " ");
14777
14971
  }
14778
14972
 
@@ -14814,7 +15008,7 @@ function shouldGroupFirstArg(args) {
14814
15008
 
14815
15009
  var firstArg = args[0];
14816
15010
  var secondArg = args[1];
14817
- return (!firstArg.comments || !firstArg.comments.length) && (firstArg.type === "FunctionExpression" || firstArg.type === "ArrowFunctionExpression" && firstArg.body.type === "BlockStatement") && !couldGroupArg(secondArg);
15011
+ return (!firstArg.comments || !firstArg.comments.length) && (firstArg.type === "FunctionExpression" || firstArg.type === "ArrowFunctionExpression" && firstArg.body.type === "BlockStatement") && secondArg.type !== "FunctionExpression" && secondArg.type !== "ArrowFunctionExpression" && !couldGroupArg(secondArg);
14818
15012
  }
14819
15013
 
14820
15014
  var functionCompositionFunctionNames = new Set(["pipe", // RxJS, Ramda
@@ -14829,12 +15023,28 @@ var functionCompositionFunctionNames = new Set(["pipe", // RxJS, Ramda
14829
15023
  "connect" // Redux
14830
15024
  ]);
14831
15025
 
15026
+ function isThisExpression(node) {
15027
+ switch (node.type) {
15028
+ case "OptionalMemberExpression":
15029
+ case "MemberExpression":
15030
+ {
15031
+ return isThisExpression(node.object);
15032
+ }
15033
+
15034
+ case "ThisExpression":
15035
+ case "Super":
15036
+ {
15037
+ return true;
15038
+ }
15039
+ }
15040
+ }
15041
+
14832
15042
  function isFunctionCompositionFunction(node) {
14833
15043
  switch (node.type) {
14834
15044
  case "OptionalMemberExpression":
14835
15045
  case "MemberExpression":
14836
15046
  {
14837
- return isFunctionCompositionFunction(node.property);
15047
+ return !isThisExpression(node.object) && isFunctionCompositionFunction(node.property);
14838
15048
  }
14839
15049
 
14840
15050
  case "Identifier":
@@ -15197,7 +15407,7 @@ function printFlowDeclaration(path, parts) {
15197
15407
  var parentExportDecl = getParentExportDeclaration$1(path);
15198
15408
 
15199
15409
  if (parentExportDecl) {
15200
- assert.strictEqual(parentExportDecl.type, "DeclareExportDeclaration");
15410
+ assert$3.strictEqual(parentExportDecl.type, "DeclareExportDeclaration");
15201
15411
  } else {
15202
15412
  // If the parent node has type DeclareExportDeclaration, then it
15203
15413
  // will be responsible for printing the "declare" token. Otherwise
@@ -15539,12 +15749,13 @@ function printMemberChain(path, options, print) {
15539
15749
  // .map(x => x)
15540
15750
  //
15541
15751
  // In order to detect those cases, we use an heuristic: if the first
15542
- // node is an identifier with the name starting with a capital letter.
15543
- // The rationale is that they are likely to be factories.
15752
+ // node is an identifier with the name starting with a capital
15753
+ // letter or just a sequence of _$. The rationale is that they are
15754
+ // likely to be factories.
15544
15755
 
15545
15756
 
15546
15757
  function isFactory(name) {
15547
- return /^[A-Z]/.test(name);
15758
+ return /^[A-Z]|^[_$]+$/.test(name);
15548
15759
  } // In case the Identifier is shorter than tab width, we can keep the
15549
15760
  // first call in a single line, if it's an ExpressionStatement.
15550
15761
  //
@@ -15767,6 +15978,30 @@ function getConditionalChainContents(node) {
15767
15978
 
15768
15979
  function isJSXWhitespaceExpression(node) {
15769
15980
  return node.type === "JSXExpressionContainer" && isLiteral(node.expression) && node.expression.value === " " && !node.expression.comments;
15981
+ }
15982
+
15983
+ function separatorNoWhitespace(isFacebookTranslationTag, child) {
15984
+ if (isFacebookTranslationTag) {
15985
+ return "";
15986
+ }
15987
+
15988
+ if (child.length === 1) {
15989
+ return softline$1;
15990
+ }
15991
+
15992
+ return hardline$3;
15993
+ }
15994
+
15995
+ function separatorWithWhitespace(isFacebookTranslationTag, child) {
15996
+ if (isFacebookTranslationTag) {
15997
+ return hardline$3;
15998
+ }
15999
+
16000
+ if (child.length === 1) {
16001
+ return softline$1;
16002
+ }
16003
+
16004
+ return hardline$3;
15770
16005
  } // JSX Children are strange, mostly for two reasons:
15771
16006
  // 1. JSX reads newlines into string values, instead of skipping them like JS
15772
16007
  // 2. up to one whitespace between elements within a line is significant,
@@ -15781,7 +16016,7 @@ function isJSXWhitespaceExpression(node) {
15781
16016
  // To ensure this we add dummy `""` content elements as needed.
15782
16017
 
15783
16018
 
15784
- function printJSXChildren(path, options, print, jsxWhitespace) {
16019
+ function printJSXChildren(path, options, print, jsxWhitespace, isFacebookTranslationTag) {
15785
16020
  var n = path.getValue();
15786
16021
  var children = []; // using `map` instead of `each` because it provides `i`
15787
16022
 
@@ -15799,7 +16034,7 @@ function printJSXChildren(path, options, print, jsxWhitespace) {
15799
16034
  words.shift();
15800
16035
 
15801
16036
  if (/\n/.test(words[0])) {
15802
- children.push(hardline$3);
16037
+ children.push(separatorWithWhitespace(isFacebookTranslationTag, words[1]));
15803
16038
  } else {
15804
16039
  children.push(jsxWhitespace);
15805
16040
  }
@@ -15829,21 +16064,12 @@ function printJSXChildren(path, options, print, jsxWhitespace) {
15829
16064
 
15830
16065
  if (endWhitespace !== undefined) {
15831
16066
  if (/\n/.test(endWhitespace)) {
15832
- children.push(hardline$3);
16067
+ children.push(separatorWithWhitespace(isFacebookTranslationTag, getLast$4(children)));
15833
16068
  } else {
15834
16069
  children.push(jsxWhitespace);
15835
16070
  }
15836
16071
  } else {
15837
- // Ideally this would be a `hardline` to allow a break between
15838
- // tags and text.
15839
- // Unfortunately Facebook have a custom translation pipeline
15840
- // (https://github.com/prettier/prettier/issues/1581#issuecomment-300975032)
15841
- // that uses the JSX syntax, but does not follow the React whitespace
15842
- // rules.
15843
- // Ensuring that we never have a break between tags and text in JSX
15844
- // will allow Facebook to adopt Prettier without too much of an
15845
- // adverse effect on formatting algorithm.
15846
- children.push("");
16072
+ children.push(separatorNoWhitespace(isFacebookTranslationTag, getLast$4(children)));
15847
16073
  }
15848
16074
  } else if (/\n/.test(text)) {
15849
16075
  // Keep (up to one) blank line between tags/expressions/text.
@@ -15860,13 +16086,11 @@ function printJSXChildren(path, options, print, jsxWhitespace) {
15860
16086
  var printedChild = print(childPath);
15861
16087
  children.push(printedChild);
15862
16088
  var next = n.children[i + 1];
15863
- var directlyFollowedByMeaningfulText = next && isMeaningfulJSXText(next) && !/^[ \n\r\t]/.test(rawText(next));
16089
+ var directlyFollowedByMeaningfulText = next && isMeaningfulJSXText(next);
15864
16090
 
15865
16091
  if (directlyFollowedByMeaningfulText) {
15866
- // Potentially this could be a hardline as well.
15867
- // See the comment above about the Facebook translation pipeline as
15868
- // to why this is an empty string.
15869
- children.push("");
16092
+ var firstWord = rawText(next).trim().split(matchJsxWhitespaceRegex)[0];
16093
+ children.push(separatorNoWhitespace(isFacebookTranslationTag, firstWord));
15870
16094
  } else {
15871
16095
  children.push(hardline$3);
15872
16096
  }
@@ -15928,7 +16152,8 @@ function printJSXElement(path, options, print) {
15928
16152
  var forcedBreak = willBreak$1(openingLines) || containsTag || containsMultipleAttributes || containsMultipleExpressions;
15929
16153
  var rawJsxWhitespace = options.singleQuote ? "{' '}" : '{" "}';
15930
16154
  var jsxWhitespace = ifBreak$1(concat$4([rawJsxWhitespace, softline$1]), " ");
15931
- var children = printJSXChildren(path, options, print, jsxWhitespace);
16155
+ var isFacebookTranslationTag = n.openingElement && n.openingElement.name && n.openingElement.name.name === "fbt";
16156
+ var children = printJSXChildren(path, options, print, jsxWhitespace, isFacebookTranslationTag);
15932
16157
  var containsText = n.children.filter(function (child) {
15933
16158
  return isMeaningfulJSXText(child);
15934
16159
  }).length > 0; // We can end up we multiple whitespace elements with empty string
@@ -16034,7 +16259,10 @@ function maybeWrapJSXElementInParens(path, elem) {
16034
16259
  return elem;
16035
16260
  }
16036
16261
 
16037
- return group$1(concat$4([ifBreak$1("("), indent$2(concat$4([softline$1, elem])), softline$1, ifBreak$1(")")]));
16262
+ var shouldBreak = matchAncestorTypes$1(path, ["ArrowFunctionExpression", "CallExpression", "JSXExpressionContainer"]);
16263
+ return group$1(concat$4([ifBreak$1("("), indent$2(concat$4([softline$1, elem])), softline$1, ifBreak$1(")")]), {
16264
+ shouldBreak: shouldBreak
16265
+ });
16038
16266
  }
16039
16267
 
16040
16268
  function isBinaryish(node) {
@@ -16127,7 +16355,8 @@ function printAssignmentRight(leftNode, rightNode, printedRight, options) {
16127
16355
  return indent$2(concat$4([hardline$3, printedRight]));
16128
16356
  }
16129
16357
 
16130
- var canBreak = isBinaryish(rightNode) && !shouldInlineLogicalExpression(rightNode) || rightNode.type === "ConditionalExpression" && isBinaryish(rightNode.test) && !shouldInlineLogicalExpression(rightNode.test) || rightNode.type === "StringLiteralTypeAnnotation" || (leftNode.type === "Identifier" || isStringLiteral(leftNode) || leftNode.type === "MemberExpression") && (isStringLiteral(rightNode) || isMemberExpressionChain(rightNode));
16358
+ var canBreak = isBinaryish(rightNode) && !shouldInlineLogicalExpression(rightNode) || rightNode.type === "ConditionalExpression" && isBinaryish(rightNode.test) && !shouldInlineLogicalExpression(rightNode.test) || rightNode.type === "StringLiteralTypeAnnotation" || (leftNode.type === "Identifier" || isStringLiteral(leftNode) || leftNode.type === "MemberExpression") && (isStringLiteral(rightNode) || isMemberExpressionChain(rightNode)) && // do not put values on a separate line from the key in json
16359
+ options.parser !== "json" && options.parser !== "json5";
16131
16360
 
16132
16361
  if (canBreak) {
16133
16362
  return indent$2(concat$4([line$3, printedRight]));
@@ -16686,6 +16915,10 @@ function genericPrint$2(path, options, print) {
16686
16915
 
16687
16916
  case "Identifier":
16688
16917
  return JSON.stringify(node.name);
16918
+
16919
+ default:
16920
+ /* istanbul ignore next */
16921
+ throw new Error("unknown type: " + JSON.stringify(node.type));
16689
16922
  }
16690
16923
  }
16691
16924
 
@@ -16732,6 +16965,40 @@ var commonOptions = {
16732
16965
  type: "boolean",
16733
16966
  default: false,
16734
16967
  description: "Use single quotes instead of double quotes."
16968
+ },
16969
+ proseWrap: {
16970
+ since: "1.8.2",
16971
+ category: CATEGORY_COMMON,
16972
+ type: "choice",
16973
+ default: [{
16974
+ since: "1.8.2",
16975
+ value: true
16976
+ }, {
16977
+ since: "1.9.0",
16978
+ value: "preserve"
16979
+ }],
16980
+ description: "How to wrap prose.",
16981
+ choices: [{
16982
+ since: "1.9.0",
16983
+ value: "always",
16984
+ description: "Wrap prose if it exceeds the print width."
16985
+ }, {
16986
+ since: "1.9.0",
16987
+ value: "never",
16988
+ description: "Do not wrap prose."
16989
+ }, {
16990
+ since: "1.9.0",
16991
+ value: "preserve",
16992
+ description: "Wrap prose as-is."
16993
+ }, {
16994
+ value: false,
16995
+ deprecated: "1.9.0",
16996
+ redirect: "never"
16997
+ }, {
16998
+ value: true,
16999
+ deprecated: "1.9.0",
17000
+ redirect: "always"
17001
+ }]
16735
17002
  }
16736
17003
  };
16737
17004
 
@@ -16802,89 +17069,310 @@ var options$3 = {
16802
17069
  }
16803
17070
  };
16804
17071
 
16805
- // https://github.com/github/linguist/blob/master/lib/linguist/languages.yml
17072
+ var languageExtend = function languageExtend() {
17073
+ var _arguments = arguments;
17074
+ var main = arguments[0];
17075
+
17076
+ var _loop = function _loop(i) {
17077
+ var arg = _arguments[i];
17078
+ Object.keys(arg).forEach(function (key) {
17079
+ var newKey = key === "languageId" ? "linguistLanguageId" : key;
17080
+ var value = arg[key];
17081
+
17082
+ if (Array.isArray(main[newKey])) {
17083
+ main[newKey] = main[newKey].concat(value);
17084
+ } else {
17085
+ main[newKey] = value;
17086
+ }
17087
+ });
17088
+ };
17089
+
17090
+ for (var i = 1; i < arguments.length; i++) {
17091
+ _loop(i);
17092
+ }
17093
+
17094
+ return main;
17095
+ };
17096
+
17097
+ var name$1 = "JavaScript";
17098
+ var type = "programming";
17099
+ var tmScope = "source.js";
17100
+ var aceMode = "javascript";
17101
+ var codemirrorMode = "javascript";
17102
+ var codemirrorMimeType = "text/javascript";
17103
+ var color = "#f1e05a";
17104
+ var aliases = ["js", "node"];
17105
+ var extensions = [".js", "._js", ".bones", ".es", ".es6", ".frag", ".gs", ".jake", ".jsb", ".jscad", ".jsfl", ".jsm", ".jss", ".mjs", ".njs", ".pac", ".sjs", ".ssjs", ".xsjs", ".xsjslib"];
17106
+ var filenames = ["Jakefile"];
17107
+ var interpreters = ["node"];
17108
+ var languageId = 183;
17109
+ var javascript = {
17110
+ name: name$1,
17111
+ type: type,
17112
+ tmScope: tmScope,
17113
+ aceMode: aceMode,
17114
+ codemirrorMode: codemirrorMode,
17115
+ codemirrorMimeType: codemirrorMimeType,
17116
+ color: color,
17117
+ aliases: aliases,
17118
+ extensions: extensions,
17119
+ filenames: filenames,
17120
+ interpreters: interpreters,
17121
+ languageId: languageId
17122
+ };
17123
+
17124
+ var javascript$1 = Object.freeze({
17125
+ name: name$1,
17126
+ type: type,
17127
+ tmScope: tmScope,
17128
+ aceMode: aceMode,
17129
+ codemirrorMode: codemirrorMode,
17130
+ codemirrorMimeType: codemirrorMimeType,
17131
+ color: color,
17132
+ aliases: aliases,
17133
+ extensions: extensions,
17134
+ filenames: filenames,
17135
+ interpreters: interpreters,
17136
+ languageId: languageId,
17137
+ default: javascript
17138
+ });
17139
+
17140
+ var name$2 = "JSX";
17141
+ var type$1 = "programming";
17142
+ var group$2 = "JavaScript";
17143
+ var extensions$1 = [".jsx"];
17144
+ var tmScope$1 = "source.js.jsx";
17145
+ var aceMode$1 = "javascript";
17146
+ var codemirrorMode$1 = "jsx";
17147
+ var codemirrorMimeType$1 = "text/jsx";
17148
+ var languageId$1 = 178;
17149
+ var jsx = {
17150
+ name: name$2,
17151
+ type: type$1,
17152
+ group: group$2,
17153
+ extensions: extensions$1,
17154
+ tmScope: tmScope$1,
17155
+ aceMode: aceMode$1,
17156
+ codemirrorMode: codemirrorMode$1,
17157
+ codemirrorMimeType: codemirrorMimeType$1,
17158
+ languageId: languageId$1
17159
+ };
17160
+
17161
+ var jsx$1 = Object.freeze({
17162
+ name: name$2,
17163
+ type: type$1,
17164
+ group: group$2,
17165
+ extensions: extensions$1,
17166
+ tmScope: tmScope$1,
17167
+ aceMode: aceMode$1,
17168
+ codemirrorMode: codemirrorMode$1,
17169
+ codemirrorMimeType: codemirrorMimeType$1,
17170
+ languageId: languageId$1,
17171
+ default: jsx
17172
+ });
17173
+
17174
+ var name$3 = "TypeScript";
17175
+ var type$2 = "programming";
17176
+ var color$1 = "#2b7489";
17177
+ var aliases$1 = ["ts"];
17178
+ var extensions$2 = [".ts", ".tsx"];
17179
+ var tmScope$2 = "source.ts";
17180
+ var aceMode$2 = "typescript";
17181
+ var codemirrorMode$2 = "javascript";
17182
+ var codemirrorMimeType$2 = "application/typescript";
17183
+ var languageId$2 = 378;
17184
+ var typescript = {
17185
+ name: name$3,
17186
+ type: type$2,
17187
+ color: color$1,
17188
+ aliases: aliases$1,
17189
+ extensions: extensions$2,
17190
+ tmScope: tmScope$2,
17191
+ aceMode: aceMode$2,
17192
+ codemirrorMode: codemirrorMode$2,
17193
+ codemirrorMimeType: codemirrorMimeType$2,
17194
+ languageId: languageId$2
17195
+ };
17196
+
17197
+ var typescript$1 = Object.freeze({
17198
+ name: name$3,
17199
+ type: type$2,
17200
+ color: color$1,
17201
+ aliases: aliases$1,
17202
+ extensions: extensions$2,
17203
+ tmScope: tmScope$2,
17204
+ aceMode: aceMode$2,
17205
+ codemirrorMode: codemirrorMode$2,
17206
+ codemirrorMimeType: codemirrorMimeType$2,
17207
+ languageId: languageId$2,
17208
+ default: typescript
17209
+ });
17210
+
17211
+ var name$4 = "JSON";
17212
+ var type$3 = "data";
17213
+ var tmScope$3 = "source.json";
17214
+ var group$3 = "JavaScript";
17215
+ var aceMode$3 = "json";
17216
+ var codemirrorMode$3 = "javascript";
17217
+ var codemirrorMimeType$3 = "application/json";
17218
+ var searchable = false;
17219
+ var extensions$3 = [".json", ".avsc", ".geojson", ".gltf", ".JSON-tmLanguage", ".jsonl", ".tfstate", ".tfstate.backup", ".topojson", ".webapp", ".webmanifest"];
17220
+ var filenames$1 = [".arcconfig", ".htmlhintrc", ".tern-config", ".tern-project", "composer.lock", "mcmod.info"];
17221
+ var languageId$3 = 174;
17222
+ var json$2 = {
17223
+ name: name$4,
17224
+ type: type$3,
17225
+ tmScope: tmScope$3,
17226
+ group: group$3,
17227
+ aceMode: aceMode$3,
17228
+ codemirrorMode: codemirrorMode$3,
17229
+ codemirrorMimeType: codemirrorMimeType$3,
17230
+ searchable: searchable,
17231
+ extensions: extensions$3,
17232
+ filenames: filenames$1,
17233
+ languageId: languageId$3
17234
+ };
17235
+
17236
+ var json$3 = Object.freeze({
17237
+ name: name$4,
17238
+ type: type$3,
17239
+ tmScope: tmScope$3,
17240
+ group: group$3,
17241
+ aceMode: aceMode$3,
17242
+ codemirrorMode: codemirrorMode$3,
17243
+ codemirrorMimeType: codemirrorMimeType$3,
17244
+ searchable: searchable,
17245
+ extensions: extensions$3,
17246
+ filenames: filenames$1,
17247
+ languageId: languageId$3,
17248
+ default: json$2
17249
+ });
17250
+
17251
+ var name$5 = "JSON with Comments";
17252
+ var type$4 = "data";
17253
+ var group$4 = "JSON";
17254
+ var tmScope$4 = "source.js";
17255
+ var aceMode$4 = "javascript";
17256
+ var codemirrorMode$4 = "javascript";
17257
+ var codemirrorMimeType$4 = "text/javascript";
17258
+ var aliases$2 = ["jsonc"];
17259
+ var extensions$4 = [".sublime-build", ".sublime-commands", ".sublime-completions", ".sublime-keymap", ".sublime-macro", ".sublime-menu", ".sublime-mousemap", ".sublime-project", ".sublime-settings", ".sublime-theme", ".sublime-workspace", ".sublime_metrics", ".sublime_session"];
17260
+ var filenames$2 = [".babelrc", ".eslintrc.json", ".jscsrc", ".jshintrc", ".jslintrc", "tsconfig.json"];
17261
+ var languageId$4 = 423;
17262
+ var jsonWithComments = {
17263
+ name: name$5,
17264
+ type: type$4,
17265
+ group: group$4,
17266
+ tmScope: tmScope$4,
17267
+ aceMode: aceMode$4,
17268
+ codemirrorMode: codemirrorMode$4,
17269
+ codemirrorMimeType: codemirrorMimeType$4,
17270
+ aliases: aliases$2,
17271
+ extensions: extensions$4,
17272
+ filenames: filenames$2,
17273
+ languageId: languageId$4
17274
+ };
17275
+
17276
+ var jsonWithComments$1 = Object.freeze({
17277
+ name: name$5,
17278
+ type: type$4,
17279
+ group: group$4,
17280
+ tmScope: tmScope$4,
17281
+ aceMode: aceMode$4,
17282
+ codemirrorMode: codemirrorMode$4,
17283
+ codemirrorMimeType: codemirrorMimeType$4,
17284
+ aliases: aliases$2,
17285
+ extensions: extensions$4,
17286
+ filenames: filenames$2,
17287
+ languageId: languageId$4,
17288
+ default: jsonWithComments
17289
+ });
17290
+
17291
+ var name$6 = "JSON5";
17292
+ var type$5 = "data";
17293
+ var extensions$5 = [".json5"];
17294
+ var tmScope$5 = "source.js";
17295
+ var aceMode$5 = "javascript";
17296
+ var codemirrorMode$5 = "javascript";
17297
+ var codemirrorMimeType$5 = "application/json";
17298
+ var languageId$5 = 175;
17299
+ var json5 = {
17300
+ name: name$6,
17301
+ type: type$5,
17302
+ extensions: extensions$5,
17303
+ tmScope: tmScope$5,
17304
+ aceMode: aceMode$5,
17305
+ codemirrorMode: codemirrorMode$5,
17306
+ codemirrorMimeType: codemirrorMimeType$5,
17307
+ languageId: languageId$5
17308
+ };
17309
+
17310
+ var json5$1 = Object.freeze({
17311
+ name: name$6,
17312
+ type: type$5,
17313
+ extensions: extensions$5,
17314
+ tmScope: tmScope$5,
17315
+ aceMode: aceMode$5,
17316
+ codemirrorMode: codemirrorMode$5,
17317
+ codemirrorMimeType: codemirrorMimeType$5,
17318
+ languageId: languageId$5,
17319
+ default: json5
17320
+ });
17321
+
17322
+ var require$$0$10 = ( javascript$1 && javascript ) || javascript$1;
17323
+
17324
+ var require$$1$6 = ( jsx$1 && jsx ) || jsx$1;
17325
+
17326
+ var require$$2$6 = ( typescript$1 && typescript ) || typescript$1;
17327
+
17328
+ var require$$3$1 = ( json$3 && json$2 ) || json$3;
16806
17329
 
17330
+ var require$$4 = ( jsonWithComments$1 && jsonWithComments ) || jsonWithComments$1;
16807
17331
 
16808
- var languages = [{
16809
- name: "JavaScript",
17332
+ var require$$5 = ( json5$1 && json5 ) || json5$1;
17333
+
17334
+ var languages = [languageExtend({}, require$$0$10, {
16810
17335
  since: "0.0.0",
16811
17336
  parsers: ["babylon", "flow"],
16812
- group: "JavaScript",
16813
- tmScope: "source.js",
16814
- aceMode: "javascript",
16815
- codemirrorMode: "javascript",
16816
- codemirrorMimeType: "text/javascript",
16817
- aliases: ["js", "node"],
16818
- extensions: [".js", "._js", ".bones", ".es", ".es6", ".frag", ".gs", ".jake", ".jsb", ".jscad", ".jsfl", ".jsm", ".jss", ".mjs", ".njs", ".pac", ".sjs", ".ssjs", ".xsjs", ".xsjslib"],
16819
- filenames: ["Jakefile"],
16820
- linguistLanguageId: 183,
16821
17337
  vscodeLanguageIds: ["javascript"]
16822
- }, {
16823
- name: "JSX",
17338
+ }), {
17339
+ name: "Flow",
17340
+ since: "0.0.0",
17341
+ parsers: ["babylon", "flow"],
17342
+ extensions: [".js.flow"]
17343
+ }, languageExtend({}, require$$1$6, {
16824
17344
  since: "0.0.0",
16825
17345
  parsers: ["babylon", "flow"],
16826
- group: "JavaScript",
16827
- extensions: [".jsx"],
16828
- tmScope: "source.js.jsx",
16829
- aceMode: "javascript",
16830
- codemirrorMode: "jsx",
16831
- codemirrorMimeType: "text/jsx",
16832
- liguistLanguageId: 178,
16833
17346
  vscodeLanguageIds: ["javascriptreact"]
16834
- }, {
16835
- name: "TypeScript",
17347
+ }), languageExtend({}, require$$2$6, {
16836
17348
  since: "1.4.0",
16837
17349
  parsers: ["typescript-eslint"],
16838
- group: "JavaScript",
16839
- aliases: ["ts"],
16840
- extensions: [".ts", ".tsx"],
16841
- tmScope: "source.ts",
16842
- aceMode: "typescript",
16843
- codemirrorMode: "javascript",
16844
- codemirrorMimeType: "application/typescript",
16845
- liguistLanguageId: 378,
16846
17350
  vscodeLanguageIds: ["typescript", "typescriptreact"]
16847
- }, {
17351
+ }), Object.assign(languageExtend({}, require$$3$1, {
16848
17352
  name: "JSON.stringify",
16849
17353
  since: "1.13.0",
16850
17354
  parsers: ["json-stringify"],
16851
- group: "JavaScript",
16852
- tmScope: "source.json",
16853
- aceMode: "json",
16854
- codemirrorMode: "javascript",
16855
- codemirrorMimeType: "application/json",
17355
+ vscodeLanguageIds: ["json"]
17356
+ }), // overwrite
17357
+ {
16856
17358
  extensions: [],
16857
17359
  // .json file defaults to json instead of json-stringify
16858
- filenames: ["package.json", "package-lock.json", "composer.json"],
16859
- linguistLanguageId: 174,
17360
+ filenames: ["package.json", "package-lock.json", "composer.json"]
17361
+ }), languageExtend({}, require$$3$1, {
17362
+ since: "1.5.0",
17363
+ parsers: ["json"],
17364
+ filenames: [".prettierrc"],
16860
17365
  vscodeLanguageIds: ["json"]
16861
- }, {
16862
- name: "JSON",
17366
+ }), languageExtend({}, require$$4, {
16863
17367
  since: "1.5.0",
16864
17368
  parsers: ["json"],
16865
- group: "JavaScript",
16866
- tmScope: "source.json",
16867
- aceMode: "json",
16868
- codemirrorMode: "javascript",
16869
- codemirrorMimeType: "application/json",
16870
- extensions: [".json", ".geojson", ".JSON-tmLanguage", ".topojson"],
16871
- filenames: [".arcconfig", ".jshintrc", ".eslintrc", ".prettierrc", "composer.lock", "mcmod.info"],
16872
- linguistLanguageId: 174,
16873
- vscodeLanguageIds: ["json", "jsonc"]
16874
- }, {
16875
- name: "JSON5",
17369
+ filenames: [".eslintrc"],
17370
+ vscodeLanguageIds: ["jsonc"]
17371
+ }), languageExtend({}, require$$5, {
16876
17372
  since: "1.13.0",
16877
17373
  parsers: ["json5"],
16878
- group: "JavaScript",
16879
- tmScope: "source.json",
16880
- aceMode: "json",
16881
- codemirrorMode: "javascript",
16882
- codemirrorMimeType: "application/json",
16883
- extensions: [".json5"],
16884
- filenames: [".babelrc"],
16885
- linguistLanguageId: 175,
16886
17374
  vscodeLanguageIds: ["json5"]
16887
- }];
17375
+ })];
16888
17376
  var printers = {
16889
17377
  estree: printerEstree,
16890
17378
  "estree-json": printerEstreeJson
@@ -16903,11 +17391,31 @@ var htmlTagNames = Object.freeze({
16903
17391
 
16904
17392
  var htmlTagNames$1 = ( htmlTagNames && index$5 ) || htmlTagNames;
16905
17393
 
16906
- function clean$3(ast, newObj) {
16907
- ["raws", "sourceIndex", "source", "before", "after", "trailingComma"].forEach(function (name) {
17394
+ function clean$3(ast, newObj, parent) {
17395
+ ["raw", // front-matter
17396
+ "raws", "sourceIndex", "source", "before", "after", "trailingComma"].forEach(function (name) {
16908
17397
  delete newObj[name];
16909
17398
  });
16910
17399
 
17400
+ if (ast.type === "yaml") {
17401
+ delete newObj.value;
17402
+ } // --insert-pragma
17403
+
17404
+
17405
+ if (ast.type === "css-comment" && parent.type === "css-root" && parent.nodes.length !== 0 && ( // first non-front-matter comment
17406
+ parent.nodes[0] === ast || (parent.nodes[0].type === "yaml" || parent.nodes[0].type === "toml") && parent.nodes[1] === ast)) {
17407
+ /**
17408
+ * something
17409
+ *
17410
+ * @format
17411
+ */
17412
+ delete newObj.text; // standalone pragma
17413
+
17414
+ if (/^\*\s*@(format|prettier)\s*$/.test(ast.text)) {
17415
+ return null;
17416
+ }
17417
+ }
17418
+
16911
17419
  if (ast.type === "media-query" || ast.type === "media-query-list" || ast.type === "media-feature-expression") {
16912
17420
  delete newObj.value;
16913
17421
  }
@@ -16999,6 +17507,85 @@ function cleanCSSStrings(value) {
16999
17507
 
17000
17508
  var clean_1$2 = clean$3;
17001
17509
 
17510
+ var _require$$0$builders$3 = doc.builders;
17511
+ var hardline$7 = _require$$0$builders$3.hardline;
17512
+ var literalline$3 = _require$$0$builders$3.literalline;
17513
+ var concat$8 = _require$$0$builders$3.concat;
17514
+ var markAsRoot$1 = _require$$0$builders$3.markAsRoot;
17515
+ var mapDoc$3 = doc.utils.mapDoc;
17516
+
17517
+ function embed$2(path, print, textToDoc
17518
+ /*, options */
17519
+ ) {
17520
+ var node = path.getValue();
17521
+
17522
+ if (node.type === "yaml") {
17523
+ return markAsRoot$1(concat$8(["---", hardline$7, node.value.trim() ? replaceNewlinesWithLiterallines(textToDoc(node.value, {
17524
+ parser: "yaml"
17525
+ })) : "", "---", hardline$7]));
17526
+ }
17527
+
17528
+ return null;
17529
+
17530
+ function replaceNewlinesWithLiterallines(doc$$2) {
17531
+ return mapDoc$3(doc$$2, function (currentDoc) {
17532
+ return typeof currentDoc === "string" && currentDoc.includes("\n") ? concat$8(currentDoc.split(/(\n)/g).map(function (v, i) {
17533
+ return i % 2 === 0 ? v : literalline$3;
17534
+ })) : currentDoc;
17535
+ });
17536
+ }
17537
+ }
17538
+
17539
+ var embed_1$2 = embed$2;
17540
+
17541
+ var DELIMITER_MAP = {
17542
+ "---": "yaml",
17543
+ "+++": "toml"
17544
+ };
17545
+
17546
+ function parse$3(text) {
17547
+ var delimiterRegex = Object.keys(DELIMITER_MAP).map(escapeStringRegexp).join("|");
17548
+ var match = text.match(new RegExp("^(".concat(delimiterRegex, ")\\n(?:([\\s\\S]*?)\\n)?\\1(\\n|$)")));
17549
+
17550
+ if (match === null) {
17551
+ return {
17552
+ frontMatter: null,
17553
+ content: text
17554
+ };
17555
+ }
17556
+
17557
+ var raw = match[0].trimRight();
17558
+ var delimiter = match[1];
17559
+ var value = match[2];
17560
+ return {
17561
+ frontMatter: {
17562
+ type: DELIMITER_MAP[delimiter],
17563
+ value: value,
17564
+ raw: raw
17565
+ },
17566
+ content: text.slice(raw.length)
17567
+ };
17568
+ }
17569
+
17570
+ var frontMatter = parse$3;
17571
+
17572
+ function hasPragma$1(text) {
17573
+ return pragma.hasPragma(frontMatter(text).content);
17574
+ }
17575
+
17576
+ function insertPragma$3(text) {
17577
+ var _parseFrontMatter = frontMatter(text),
17578
+ frontMatter$$1 = _parseFrontMatter.frontMatter,
17579
+ content = _parseFrontMatter.content;
17580
+
17581
+ return (frontMatter$$1 ? frontMatter$$1.raw + "\n\n" : "") + pragma.insertPragma(content);
17582
+ }
17583
+
17584
+ var pragma$2 = {
17585
+ hasPragma: hasPragma$1,
17586
+ insertPragma: insertPragma$3
17587
+ };
17588
+
17002
17589
  var colorAdjusterFunctions = ["red", "green", "blue", "alpha", "a", "rgb", "hue", "h", "saturation", "s", "lightness", "l", "whiteness", "w", "blackness", "b", "tint", "shade", "blend", "blenda", "contrast", "hsl", "hsla", "hwb", "hwba"];
17003
17590
 
17004
17591
  function getAncestorCounter(path, typeOrTypes) {
@@ -17295,22 +17882,23 @@ var utils$4 = {
17295
17882
  isColorAdjusterFuncNode: isColorAdjusterFuncNode$1
17296
17883
  };
17297
17884
 
17885
+ var insertPragma$2 = pragma$2.insertPragma;
17298
17886
  var printNumber$2 = util.printNumber;
17299
17887
  var printString$2 = util.printString;
17300
17888
  var hasIgnoreComment$2 = util.hasIgnoreComment;
17301
17889
  var hasNewline$3 = util.hasNewline;
17302
17890
  var isNextLineEmpty$3 = utilShared.isNextLineEmpty;
17303
- var _require$$2$builders = doc.builders;
17304
- var concat$7 = _require$$2$builders.concat;
17305
- var join$5 = _require$$2$builders.join;
17306
- var line$4 = _require$$2$builders.line;
17307
- var hardline$6 = _require$$2$builders.hardline;
17308
- var softline$3 = _require$$2$builders.softline;
17309
- var group$2 = _require$$2$builders.group;
17310
- var fill$3 = _require$$2$builders.fill;
17311
- var indent$5 = _require$$2$builders.indent;
17312
- var dedent$3 = _require$$2$builders.dedent;
17313
- var ifBreak$2 = _require$$2$builders.ifBreak;
17891
+ var _require$$3$builders = doc.builders;
17892
+ var concat$7 = _require$$3$builders.concat;
17893
+ var join$5 = _require$$3$builders.join;
17894
+ var line$4 = _require$$3$builders.line;
17895
+ var hardline$6 = _require$$3$builders.hardline;
17896
+ var softline$3 = _require$$3$builders.softline;
17897
+ var group$5 = _require$$3$builders.group;
17898
+ var fill$3 = _require$$3$builders.fill;
17899
+ var indent$5 = _require$$3$builders.indent;
17900
+ var dedent$3 = _require$$3$builders.dedent;
17901
+ var ifBreak$2 = _require$$3$builders.ifBreak;
17314
17902
  var removeLines$2 = doc.utils.removeLines;
17315
17903
  var getAncestorNode = utils$4.getAncestorNode;
17316
17904
  var getPropOfDeclNode = utils$4.getPropOfDeclNode;
@@ -17378,8 +17966,9 @@ function genericPrint$3(path, options, print) {
17378
17966
  }
17379
17967
 
17380
17968
  switch (node.type) {
17381
- case "front-matter":
17382
- return concat$7([node.value, hardline$6]);
17969
+ case "yaml":
17970
+ case "toml":
17971
+ return concat$7([node.raw, hardline$6]);
17383
17972
 
17384
17973
  case "css-root":
17385
17974
  {
@@ -17428,7 +18017,7 @@ function genericPrint$3(path, options, print) {
17428
18017
  return concat$7(["@", // If a Less file ends up being parsed with the SCSS parser, Less
17429
18018
  // variable declarations will be parsed as at-rules with names ending
17430
18019
  // with a colon, so keep the original case then.
17431
- isDetachedRulesetCallNode(node) || node.name.endsWith(":") ? node.name : maybeToLowerCase(node.name), node.params ? concat$7([isDetachedRulesetCallNode(node) ? "" : " ", path.call(print, "params")]) : "", node.selector ? indent$5(concat$7([" ", path.call(print, "selector")])) : "", node.value ? group$2(concat$7([" ", path.call(print, "value"), isSCSSControlDirectiveNode(node) ? hasParensAroundNode(node) ? " " : line$4 : ""])) : node.name === "else" ? " " : "", node.nodes ? concat$7([isSCSSControlDirectiveNode(node) ? "" : " ", "{", indent$5(concat$7([node.nodes.length > 0 ? softline$3 : "", printNodeSequence(path, options, print)])), softline$3, "}"]) : ";"]);
18020
+ isDetachedRulesetCallNode(node) || node.name.endsWith(":") ? node.name : maybeToLowerCase(node.name), node.params ? concat$7([isDetachedRulesetCallNode(node) ? "" : " ", path.call(print, "params")]) : "", node.selector ? indent$5(concat$7([" ", path.call(print, "selector")])) : "", node.value ? group$5(concat$7([" ", path.call(print, "value"), isSCSSControlDirectiveNode(node) ? hasParensAroundNode(node) ? " " : line$4 : ""])) : node.name === "else" ? " " : "", node.nodes ? concat$7([isSCSSControlDirectiveNode(node) ? "" : " ", "{", indent$5(concat$7([node.nodes.length > 0 ? softline$3 : "", printNodeSequence(path, options, print)])), softline$3, "}"]) : ";"]);
17432
18021
  }
17433
18022
  // postcss-media-query-parser
17434
18023
 
@@ -17444,7 +18033,7 @@ function genericPrint$3(path, options, print) {
17444
18033
 
17445
18034
  parts.push(childPath.call(print));
17446
18035
  }, "nodes");
17447
- return group$2(indent$5(join$5(line$4, parts)));
18036
+ return group$5(indent$5(join$5(line$4, parts)));
17448
18037
  }
17449
18038
 
17450
18039
  case "media-query":
@@ -17499,12 +18088,12 @@ function genericPrint$3(path, options, print) {
17499
18088
 
17500
18089
  case "selector-root":
17501
18090
  {
17502
- return group$2(concat$7([insideAtRuleNode(path, "custom-selector") ? concat$7([getAncestorNode(path, "css-atrule").customSelector, line$4]) : "", join$5(concat$7([",", insideAtRuleNode(path, ["extend", "custom-selector", "nest"]) ? line$4 : hardline$6]), path.map(print, "nodes"))]));
18091
+ return group$5(concat$7([insideAtRuleNode(path, "custom-selector") ? concat$7([getAncestorNode(path, "css-atrule").customSelector, line$4]) : "", join$5(concat$7([",", insideAtRuleNode(path, ["extend", "custom-selector", "nest"]) ? line$4 : hardline$6]), path.map(print, "nodes"))]));
17503
18092
  }
17504
18093
 
17505
18094
  case "selector-selector":
17506
18095
  {
17507
- return group$2(indent$5(concat$7(path.map(print, "nodes"))));
18096
+ return group$5(indent$5(concat$7(path.map(print, "nodes"))));
17508
18097
  }
17509
18098
 
17510
18099
  case "selector-comment":
@@ -17557,7 +18146,7 @@ function genericPrint$3(path, options, print) {
17557
18146
 
17558
18147
  case "selector-universal":
17559
18148
  {
17560
- return concat$7([node.namespace ? concat$7([node.namespace === true ? "" : node.namespace.trim(), "|"]) : "", adjustNumbers(node.value)]);
18149
+ return concat$7([node.namespace ? concat$7([node.namespace === true ? "" : node.namespace.trim(), "|"]) : "", node.value]);
17561
18150
  }
17562
18151
 
17563
18152
  case "selector-pseudo":
@@ -17757,7 +18346,7 @@ function genericPrint$3(path, options, print) {
17757
18346
  }
17758
18347
 
17759
18348
  if (isControlDirective) {
17760
- return group$2(indent$5(concat$7(_parts)));
18349
+ return group$5(indent$5(concat$7(_parts)));
17761
18350
  } // Indent is not needed for import url when url is very long
17762
18351
  // and node has two groups
17763
18352
  // when type is value-comma_group
@@ -17765,10 +18354,10 @@ function genericPrint$3(path, options, print) {
17765
18354
 
17766
18355
 
17767
18356
  if (insideURLFunctionInImportAtRuleNode(path)) {
17768
- return group$2(fill$3(_parts));
18357
+ return group$5(fill$3(_parts));
17769
18358
  }
17770
18359
 
17771
- return group$2(indent$5(fill$3(_parts)));
18360
+ return group$5(indent$5(fill$3(_parts)));
17772
18361
  }
17773
18362
 
17774
18363
  case "value-paren_group":
@@ -17792,17 +18381,17 @@ function genericPrint$3(path, options, print) {
17792
18381
  res.push(_printed[_i]);
17793
18382
  }
17794
18383
 
17795
- return group$2(indent$5(fill$3(res)));
18384
+ return group$5(indent$5(fill$3(res)));
17796
18385
  }
17797
18386
 
17798
18387
  var isSCSSMapItem = isSCSSMapItemNode(path);
17799
- return group$2(concat$7([node.open ? path.call(print, "open") : "", indent$5(concat$7([softline$3, join$5(concat$7([",", line$4]), path.map(function (childPath) {
18388
+ return group$5(concat$7([node.open ? path.call(print, "open") : "", indent$5(concat$7([softline$3, join$5(concat$7([",", line$4]), path.map(function (childPath) {
17800
18389
  var node = childPath.getValue();
17801
18390
  var printed = print(childPath); // Key/Value pair in open paren already indented
17802
18391
 
17803
18392
  if (isKeyValuePairNode(node) && node.type === "value-comma_group" && node.groups && node.groups[2] && node.groups[2].type === "value-paren_group") {
17804
- printed.contents.contents.parts[1] = group$2(printed.contents.contents.parts[1]);
17805
- return group$2(dedent$3(printed));
18393
+ printed.contents.contents.parts[1] = group$5(printed.contents.contents.parts[1]);
18394
+ return group$5(dedent$3(printed));
17806
18395
  }
17807
18396
 
17808
18397
  return printed;
@@ -17894,12 +18483,12 @@ function printNodeSequence(path, options, print) {
17894
18483
  if (i !== node.nodes.length - 1) {
17895
18484
  if (node.nodes[i + 1].type === "css-comment" && !hasNewline$3(options.originalText, options.locStart(node.nodes[i + 1]), {
17896
18485
  backwards: true
17897
- }) || node.nodes[i + 1].type === "css-atrule" && node.nodes[i + 1].name === "else" && node.nodes[i].type !== "css-comment") {
18486
+ }) && node.nodes[i].type !== "yaml" && node.nodes[i].type !== "toml" || node.nodes[i + 1].type === "css-atrule" && node.nodes[i + 1].name === "else" && node.nodes[i].type !== "css-comment") {
17898
18487
  parts.push(" ");
17899
18488
  } else {
17900
18489
  parts.push(hardline$6);
17901
18490
 
17902
- if (isNextLineEmpty$3(options.originalText, pathChild.getValue(), options)) {
18491
+ if (isNextLineEmpty$3(options.originalText, pathChild.getValue(), options) && node.nodes[i].type !== "yaml" && node.nodes[i].type !== "toml") {
17903
18492
  parts.push(hardline$6);
17904
18493
  }
17905
18494
  }
@@ -17940,6 +18529,8 @@ function printCssNumber(rawNumber) {
17940
18529
 
17941
18530
  var printerPostcss = {
17942
18531
  print: genericPrint$3,
18532
+ embed: embed_1$2,
18533
+ insertPragma: insertPragma$2,
17943
18534
  hasPrettierIgnore: hasIgnoreComment$2,
17944
18535
  massageAstNode: clean_1$2
17945
18536
  };
@@ -17948,46 +18539,162 @@ var options$6 = {
17948
18539
  singleQuote: commonOptions.singleQuote
17949
18540
  };
17950
18541
 
17951
- // https://github.com/github/linguist/blob/master/lib/linguist/languages.yml
18542
+ var name$7 = "CSS";
18543
+ var type$6 = "markup";
18544
+ var tmScope$6 = "source.css";
18545
+ var aceMode$6 = "css";
18546
+ var codemirrorMode$6 = "css";
18547
+ var codemirrorMimeType$6 = "text/css";
18548
+ var color$2 = "#563d7c";
18549
+ var extensions$6 = [".css"];
18550
+ var languageId$6 = 50;
18551
+ var css$2 = {
18552
+ name: name$7,
18553
+ type: type$6,
18554
+ tmScope: tmScope$6,
18555
+ aceMode: aceMode$6,
18556
+ codemirrorMode: codemirrorMode$6,
18557
+ codemirrorMimeType: codemirrorMimeType$6,
18558
+ color: color$2,
18559
+ extensions: extensions$6,
18560
+ languageId: languageId$6
18561
+ };
18562
+
18563
+ var css$3 = Object.freeze({
18564
+ name: name$7,
18565
+ type: type$6,
18566
+ tmScope: tmScope$6,
18567
+ aceMode: aceMode$6,
18568
+ codemirrorMode: codemirrorMode$6,
18569
+ codemirrorMimeType: codemirrorMimeType$6,
18570
+ color: color$2,
18571
+ extensions: extensions$6,
18572
+ languageId: languageId$6,
18573
+ default: css$2
18574
+ });
18575
+
18576
+ var name$8 = "PostCSS";
18577
+ var type$7 = "markup";
18578
+ var tmScope$7 = "source.postcss";
18579
+ var group$6 = "CSS";
18580
+ var extensions$7 = [".pcss"];
18581
+ var aceMode$7 = "text";
18582
+ var languageId$7 = 262764437;
18583
+ var postcss = {
18584
+ name: name$8,
18585
+ type: type$7,
18586
+ tmScope: tmScope$7,
18587
+ group: group$6,
18588
+ extensions: extensions$7,
18589
+ aceMode: aceMode$7,
18590
+ languageId: languageId$7
18591
+ };
18592
+
18593
+ var postcss$1 = Object.freeze({
18594
+ name: name$8,
18595
+ type: type$7,
18596
+ tmScope: tmScope$7,
18597
+ group: group$6,
18598
+ extensions: extensions$7,
18599
+ aceMode: aceMode$7,
18600
+ languageId: languageId$7,
18601
+ default: postcss
18602
+ });
18603
+
18604
+ var name$9 = "Less";
18605
+ var type$8 = "markup";
18606
+ var group$7 = "CSS";
18607
+ var extensions$8 = [".less"];
18608
+ var tmScope$8 = "source.css.less";
18609
+ var aceMode$8 = "less";
18610
+ var codemirrorMode$7 = "css";
18611
+ var codemirrorMimeType$7 = "text/css";
18612
+ var languageId$8 = 198;
18613
+ var less = {
18614
+ name: name$9,
18615
+ type: type$8,
18616
+ group: group$7,
18617
+ extensions: extensions$8,
18618
+ tmScope: tmScope$8,
18619
+ aceMode: aceMode$8,
18620
+ codemirrorMode: codemirrorMode$7,
18621
+ codemirrorMimeType: codemirrorMimeType$7,
18622
+ languageId: languageId$8
18623
+ };
18624
+
18625
+ var less$1 = Object.freeze({
18626
+ name: name$9,
18627
+ type: type$8,
18628
+ group: group$7,
18629
+ extensions: extensions$8,
18630
+ tmScope: tmScope$8,
18631
+ aceMode: aceMode$8,
18632
+ codemirrorMode: codemirrorMode$7,
18633
+ codemirrorMimeType: codemirrorMimeType$7,
18634
+ languageId: languageId$8,
18635
+ default: less
18636
+ });
18637
+
18638
+ var name$10 = "SCSS";
18639
+ var type$9 = "markup";
18640
+ var tmScope$9 = "source.scss";
18641
+ var group$8 = "CSS";
18642
+ var aceMode$9 = "scss";
18643
+ var codemirrorMode$8 = "css";
18644
+ var codemirrorMimeType$8 = "text/x-scss";
18645
+ var extensions$9 = [".scss"];
18646
+ var languageId$9 = 329;
18647
+ var scss = {
18648
+ name: name$10,
18649
+ type: type$9,
18650
+ tmScope: tmScope$9,
18651
+ group: group$8,
18652
+ aceMode: aceMode$9,
18653
+ codemirrorMode: codemirrorMode$8,
18654
+ codemirrorMimeType: codemirrorMimeType$8,
18655
+ extensions: extensions$9,
18656
+ languageId: languageId$9
18657
+ };
18658
+
18659
+ var scss$1 = Object.freeze({
18660
+ name: name$10,
18661
+ type: type$9,
18662
+ tmScope: tmScope$9,
18663
+ group: group$8,
18664
+ aceMode: aceMode$9,
18665
+ codemirrorMode: codemirrorMode$8,
18666
+ codemirrorMimeType: codemirrorMimeType$8,
18667
+ extensions: extensions$9,
18668
+ languageId: languageId$9,
18669
+ default: scss
18670
+ });
18671
+
18672
+ var require$$0$12 = ( css$3 && css$2 ) || css$3;
17952
18673
 
18674
+ var require$$1$7 = ( postcss$1 && postcss ) || postcss$1;
17953
18675
 
17954
- var languages$1 = [{
17955
- name: "CSS",
18676
+ var require$$2$7 = ( less$1 && less ) || less$1;
18677
+
18678
+ var require$$3$2 = ( scss$1 && scss ) || scss$1;
18679
+
18680
+ var languages$1 = [languageExtend({}, require$$0$12, {
18681
+ since: "1.4.0",
18682
+ parsers: ["css"],
18683
+ vscodeLanguageIds: ["css"]
18684
+ }), languageExtend({}, require$$1$7, {
17956
18685
  since: "1.4.0",
17957
18686
  parsers: ["css"],
17958
- group: "CSS",
17959
- tmScope: "source.css",
17960
- aceMode: "css",
17961
- codemirrorMode: "css",
17962
- codemirrorMimeType: "text/css",
17963
- extensions: [".css", ".pcss", ".postcss"],
17964
- liguistLanguageId: 50,
17965
- vscodeLanguageIds: ["css", "postcss"]
17966
- }, {
17967
- name: "Less",
18687
+ extensions: [".postcss"],
18688
+ vscodeLanguageIds: ["postcss"]
18689
+ }), languageExtend({}, require$$2$7, {
17968
18690
  since: "1.4.0",
17969
18691
  parsers: ["less"],
17970
- group: "CSS",
17971
- extensions: [".less"],
17972
- tmScope: "source.css.less",
17973
- aceMode: "less",
17974
- codemirrorMode: "css",
17975
- codemirrorMimeType: "text/css",
17976
- liguistLanguageId: 198,
17977
18692
  vscodeLanguageIds: ["less"]
17978
- }, {
17979
- name: "SCSS",
18693
+ }), languageExtend({}, require$$3$2, {
17980
18694
  since: "1.4.0",
17981
18695
  parsers: ["scss"],
17982
- group: "CSS",
17983
- tmScope: "source.scss",
17984
- aceMode: "scss",
17985
- codemirrorMode: "css",
17986
- codemirrorMimeType: "text/x-scss",
17987
- extensions: [".scss"],
17988
- liguistLanguageId: 329,
17989
18696
  vscodeLanguageIds: ["scss"]
17990
- }];
18697
+ })];
17991
18698
  var printers$1 = {
17992
18699
  postcss: printerPostcss
17993
18700
  };
@@ -17997,17 +18704,31 @@ var languageCss = {
17997
18704
  printers: printers$1
17998
18705
  };
17999
18706
 
18000
- var _require$$0$builders$3 = doc.builders;
18001
- var concat$8 = _require$$0$builders$3.concat;
18002
- var join$6 = _require$$0$builders$3.join;
18003
- var hardline$7 = _require$$0$builders$3.hardline;
18004
- var line$5 = _require$$0$builders$3.line;
18005
- var softline$4 = _require$$0$builders$3.softline;
18006
- var group$3 = _require$$0$builders$3.group;
18007
- var indent$6 = _require$$0$builders$3.indent;
18008
- var ifBreak$3 = _require$$0$builders$3.ifBreak;
18707
+ function hasPragma$2(text) {
18708
+ return /^\s*#[^\n\S]*@(format|prettier)\s*(\n|$)/.test(text);
18709
+ }
18710
+
18711
+ function insertPragma$5(text) {
18712
+ return "# @format\n\n" + text;
18713
+ }
18714
+
18715
+ var pragma$4 = {
18716
+ hasPragma: hasPragma$2,
18717
+ insertPragma: insertPragma$5
18718
+ };
18719
+
18720
+ var _require$$0$builders$4 = doc.builders;
18721
+ var concat$9 = _require$$0$builders$4.concat;
18722
+ var join$6 = _require$$0$builders$4.join;
18723
+ var hardline$8 = _require$$0$builders$4.hardline;
18724
+ var line$5 = _require$$0$builders$4.line;
18725
+ var softline$4 = _require$$0$builders$4.softline;
18726
+ var group$9 = _require$$0$builders$4.group;
18727
+ var indent$6 = _require$$0$builders$4.indent;
18728
+ var ifBreak$3 = _require$$0$builders$4.ifBreak;
18009
18729
  var hasIgnoreComment$3 = util.hasIgnoreComment;
18010
18730
  var isNextLineEmpty$4 = utilShared.isNextLineEmpty;
18731
+ var insertPragma$4 = pragma$4.insertPragma;
18011
18732
 
18012
18733
  function genericPrint$4(path, options, print) {
18013
18734
  var n = path.getValue();
@@ -18025,41 +18746,41 @@ function genericPrint$4(path, options, print) {
18025
18746
  {
18026
18747
  var parts = [];
18027
18748
  path.map(function (pathChild, index) {
18028
- parts.push(concat$8([pathChild.call(print)]));
18749
+ parts.push(concat$9([pathChild.call(print)]));
18029
18750
 
18030
18751
  if (index !== n.definitions.length - 1) {
18031
- parts.push(hardline$7);
18752
+ parts.push(hardline$8);
18032
18753
 
18033
18754
  if (isNextLineEmpty$4(options.originalText, pathChild.getValue(), options)) {
18034
- parts.push(hardline$7);
18755
+ parts.push(hardline$8);
18035
18756
  }
18036
18757
  }
18037
18758
  }, "definitions");
18038
- return concat$8([concat$8(parts), hardline$7]);
18759
+ return concat$9([concat$9(parts), hardline$8]);
18039
18760
  }
18040
18761
 
18041
18762
  case "OperationDefinition":
18042
18763
  {
18043
18764
  var hasOperation = options.originalText[options.locStart(n)] !== "{";
18044
18765
  var hasName = !!n.name;
18045
- return concat$8([hasOperation ? n.operation : "", hasOperation && hasName ? concat$8([" ", path.call(print, "name")]) : "", n.variableDefinitions && n.variableDefinitions.length ? group$3(concat$8(["(", indent$6(concat$8([softline$4, join$6(concat$8([ifBreak$3("", ", "), softline$4]), path.map(print, "variableDefinitions"))])), softline$4, ")"])) : "", printDirectives(path, print, n), n.selectionSet ? !hasOperation && !hasName ? "" : " " : "", path.call(print, "selectionSet")]);
18766
+ return concat$9([hasOperation ? n.operation : "", hasOperation && hasName ? concat$9([" ", path.call(print, "name")]) : "", n.variableDefinitions && n.variableDefinitions.length ? group$9(concat$9(["(", indent$6(concat$9([softline$4, join$6(concat$9([ifBreak$3("", ", "), softline$4]), path.map(print, "variableDefinitions"))])), softline$4, ")"])) : "", printDirectives(path, print, n), n.selectionSet ? !hasOperation && !hasName ? "" : " " : "", path.call(print, "selectionSet")]);
18046
18767
  }
18047
18768
 
18048
18769
  case "FragmentDefinition":
18049
18770
  {
18050
- return concat$8(["fragment ", path.call(print, "name"), " on ", path.call(print, "typeCondition"), printDirectives(path, print, n), " ", path.call(print, "selectionSet")]);
18771
+ return concat$9(["fragment ", path.call(print, "name"), " on ", path.call(print, "typeCondition"), printDirectives(path, print, n), " ", path.call(print, "selectionSet")]);
18051
18772
  }
18052
18773
 
18053
18774
  case "SelectionSet":
18054
18775
  {
18055
- return concat$8(["{", indent$6(concat$8([hardline$7, join$6(hardline$7, path.call(function (selectionsPath) {
18776
+ return concat$9(["{", indent$6(concat$9([hardline$8, join$6(hardline$8, path.call(function (selectionsPath) {
18056
18777
  return printSequence(selectionsPath, options, print);
18057
- }, "selections"))])), hardline$7, "}"]);
18778
+ }, "selections"))])), hardline$8, "}"]);
18058
18779
  }
18059
18780
 
18060
18781
  case "Field":
18061
18782
  {
18062
- return group$3(concat$8([n.alias ? concat$8([path.call(print, "alias"), ": "]) : "", path.call(print, "name"), n.arguments.length > 0 ? group$3(concat$8(["(", indent$6(concat$8([softline$4, join$6(concat$8([ifBreak$3("", ", "), softline$4]), path.call(function (argsPath) {
18783
+ return group$9(concat$9([n.alias ? concat$9([path.call(print, "alias"), ": "]) : "", path.call(print, "name"), n.arguments.length > 0 ? group$9(concat$9(["(", indent$6(concat$9([softline$4, join$6(concat$9([ifBreak$3("", ", "), softline$4]), path.call(function (argsPath) {
18063
18784
  return printSequence(argsPath, options, print);
18064
18785
  }, "arguments"))])), softline$4, ")"])) : "", printDirectives(path, print, n), n.selectionSet ? " " : "", path.call(print, "selectionSet")]));
18065
18786
  }
@@ -18072,10 +18793,10 @@ function genericPrint$4(path, options, print) {
18072
18793
  case "StringValue":
18073
18794
  {
18074
18795
  if (n.block) {
18075
- return concat$8(['"""', hardline$7, join$6(hardline$7, n.value.replace(/"""/g, "\\$&").split("\n")), hardline$7, '"""']);
18796
+ return concat$9(['"""', hardline$8, join$6(hardline$8, n.value.replace(/"""/g, "\\$&").split("\n")), hardline$8, '"""']);
18076
18797
  }
18077
18798
 
18078
- return concat$8(['"', n.value.replace(/["\\]/g, "\\$&"), '"']);
18799
+ return concat$9(['"', n.value.replace(/["\\]/g, "\\$&").replace(/\n/g, "\\n"), '"']);
18079
18800
  }
18080
18801
 
18081
18802
  case "IntValue":
@@ -18097,28 +18818,28 @@ function genericPrint$4(path, options, print) {
18097
18818
 
18098
18819
  case "Variable":
18099
18820
  {
18100
- return concat$8(["$", path.call(print, "name")]);
18821
+ return concat$9(["$", path.call(print, "name")]);
18101
18822
  }
18102
18823
 
18103
18824
  case "ListValue":
18104
18825
  {
18105
- return group$3(concat$8(["[", indent$6(concat$8([softline$4, join$6(concat$8([ifBreak$3("", ", "), softline$4]), path.map(print, "values"))])), softline$4, "]"]));
18826
+ return group$9(concat$9(["[", indent$6(concat$9([softline$4, join$6(concat$9([ifBreak$3("", ", "), softline$4]), path.map(print, "values"))])), softline$4, "]"]));
18106
18827
  }
18107
18828
 
18108
18829
  case "ObjectValue":
18109
18830
  {
18110
- return group$3(concat$8(["{", options.bracketSpacing && n.fields.length > 0 ? " " : "", indent$6(concat$8([softline$4, join$6(concat$8([ifBreak$3("", ", "), softline$4]), path.map(print, "fields"))])), softline$4, ifBreak$3("", options.bracketSpacing && n.fields.length > 0 ? " " : ""), "}"]));
18831
+ return group$9(concat$9(["{", options.bracketSpacing && n.fields.length > 0 ? " " : "", indent$6(concat$9([softline$4, join$6(concat$9([ifBreak$3("", ", "), softline$4]), path.map(print, "fields"))])), softline$4, ifBreak$3("", options.bracketSpacing && n.fields.length > 0 ? " " : ""), "}"]));
18111
18832
  }
18112
18833
 
18113
18834
  case "ObjectField":
18114
18835
  case "Argument":
18115
18836
  {
18116
- return concat$8([path.call(print, "name"), ": ", path.call(print, "value")]);
18837
+ return concat$9([path.call(print, "name"), ": ", path.call(print, "value")]);
18117
18838
  }
18118
18839
 
18119
18840
  case "Directive":
18120
18841
  {
18121
- return concat$8(["@", path.call(print, "name"), n.arguments.length > 0 ? group$3(concat$8(["(", indent$6(concat$8([softline$4, join$6(concat$8([ifBreak$3("", ", "), softline$4]), path.call(function (argsPath) {
18842
+ return concat$9(["@", path.call(print, "name"), n.arguments.length > 0 ? group$9(concat$9(["(", indent$6(concat$9([softline$4, join$6(concat$9([ifBreak$3("", ", "), softline$4]), path.call(function (argsPath) {
18122
18843
  return printSequence(argsPath, options, print);
18123
18844
  }, "arguments"))])), softline$4, ")"])) : ""]);
18124
18845
  }
@@ -18130,112 +18851,112 @@ function genericPrint$4(path, options, print) {
18130
18851
 
18131
18852
  case "VariableDefinition":
18132
18853
  {
18133
- return concat$8([path.call(print, "variable"), ": ", path.call(print, "type"), n.defaultValue ? concat$8([" = ", path.call(print, "defaultValue")]) : ""]);
18854
+ return concat$9([path.call(print, "variable"), ": ", path.call(print, "type"), n.defaultValue ? concat$9([" = ", path.call(print, "defaultValue")]) : ""]);
18134
18855
  }
18135
18856
 
18136
18857
  case "TypeExtensionDefinition":
18137
18858
  {
18138
- return concat$8(["extend ", path.call(print, "definition")]);
18859
+ return concat$9(["extend ", path.call(print, "definition")]);
18139
18860
  }
18140
18861
 
18141
18862
  case "ObjectTypeExtension":
18142
18863
  case "ObjectTypeDefinition":
18143
18864
  {
18144
- return concat$8([path.call(print, "description"), n.description ? hardline$7 : "", n.kind === "ObjectTypeExtension" ? "extend " : "", "type ", path.call(print, "name"), n.interfaces.length > 0 ? concat$8([" implements ", join$6(determineInterfaceSeparator(options.originalText.substr(options.locStart(n), options.locEnd(n))), path.map(print, "interfaces"))]) : "", printDirectives(path, print, n), n.fields.length > 0 ? concat$8([" {", indent$6(concat$8([hardline$7, join$6(hardline$7, path.call(function (fieldsPath) {
18865
+ return concat$9([path.call(print, "description"), n.description ? hardline$8 : "", n.kind === "ObjectTypeExtension" ? "extend " : "", "type ", path.call(print, "name"), n.interfaces.length > 0 ? concat$9([" implements ", join$6(determineInterfaceSeparator(options.originalText.substr(options.locStart(n), options.locEnd(n))), path.map(print, "interfaces"))]) : "", printDirectives(path, print, n), n.fields.length > 0 ? concat$9([" {", indent$6(concat$9([hardline$8, join$6(hardline$8, path.call(function (fieldsPath) {
18145
18866
  return printSequence(fieldsPath, options, print);
18146
- }, "fields"))])), hardline$7, "}"]) : ""]);
18867
+ }, "fields"))])), hardline$8, "}"]) : ""]);
18147
18868
  }
18148
18869
 
18149
18870
  case "FieldDefinition":
18150
18871
  {
18151
- return concat$8([path.call(print, "description"), n.description ? hardline$7 : "", path.call(print, "name"), n.arguments.length > 0 ? group$3(concat$8(["(", indent$6(concat$8([softline$4, join$6(concat$8([ifBreak$3("", ", "), softline$4]), path.call(function (argsPath) {
18872
+ return concat$9([path.call(print, "description"), n.description ? hardline$8 : "", path.call(print, "name"), n.arguments.length > 0 ? group$9(concat$9(["(", indent$6(concat$9([softline$4, join$6(concat$9([ifBreak$3("", ", "), softline$4]), path.call(function (argsPath) {
18152
18873
  return printSequence(argsPath, options, print);
18153
18874
  }, "arguments"))])), softline$4, ")"])) : "", ": ", path.call(print, "type"), printDirectives(path, print, n)]);
18154
18875
  }
18155
18876
 
18156
18877
  case "DirectiveDefinition":
18157
18878
  {
18158
- return concat$8([path.call(print, "description"), n.description ? hardline$7 : "", "directive ", "@", path.call(print, "name"), n.arguments.length > 0 ? group$3(concat$8(["(", indent$6(concat$8([softline$4, join$6(concat$8([ifBreak$3("", ", "), softline$4]), path.call(function (argsPath) {
18879
+ return concat$9([path.call(print, "description"), n.description ? hardline$8 : "", "directive ", "@", path.call(print, "name"), n.arguments.length > 0 ? group$9(concat$9(["(", indent$6(concat$9([softline$4, join$6(concat$9([ifBreak$3("", ", "), softline$4]), path.call(function (argsPath) {
18159
18880
  return printSequence(argsPath, options, print);
18160
- }, "arguments"))])), softline$4, ")"])) : "", concat$8([" on ", join$6(" | ", path.map(print, "locations"))])]);
18881
+ }, "arguments"))])), softline$4, ")"])) : "", concat$9([" on ", join$6(" | ", path.map(print, "locations"))])]);
18161
18882
  }
18162
18883
 
18163
18884
  case "EnumTypeExtension":
18164
18885
  case "EnumTypeDefinition":
18165
18886
  {
18166
- return concat$8([path.call(print, "description"), n.description ? hardline$7 : "", n.kind === "EnumTypeExtension" ? "extend " : "", "enum ", path.call(print, "name"), printDirectives(path, print, n), n.values.length > 0 ? concat$8([" {", indent$6(concat$8([hardline$7, join$6(hardline$7, path.call(function (valuesPath) {
18887
+ return concat$9([path.call(print, "description"), n.description ? hardline$8 : "", n.kind === "EnumTypeExtension" ? "extend " : "", "enum ", path.call(print, "name"), printDirectives(path, print, n), n.values.length > 0 ? concat$9([" {", indent$6(concat$9([hardline$8, join$6(hardline$8, path.call(function (valuesPath) {
18167
18888
  return printSequence(valuesPath, options, print);
18168
- }, "values"))])), hardline$7, "}"]) : ""]);
18889
+ }, "values"))])), hardline$8, "}"]) : ""]);
18169
18890
  }
18170
18891
 
18171
18892
  case "EnumValueDefinition":
18172
18893
  {
18173
- return concat$8([path.call(print, "description"), n.description ? hardline$7 : "", path.call(print, "name"), printDirectives(path, print, n)]);
18894
+ return concat$9([path.call(print, "description"), n.description ? hardline$8 : "", path.call(print, "name"), printDirectives(path, print, n)]);
18174
18895
  }
18175
18896
 
18176
18897
  case "InputValueDefinition":
18177
18898
  {
18178
- return concat$8([path.call(print, "description"), n.description ? n.description.block ? hardline$7 : line$5 : "", path.call(print, "name"), ": ", path.call(print, "type"), n.defaultValue ? concat$8([" = ", path.call(print, "defaultValue")]) : "", printDirectives(path, print, n)]);
18899
+ return concat$9([path.call(print, "description"), n.description ? n.description.block ? hardline$8 : line$5 : "", path.call(print, "name"), ": ", path.call(print, "type"), n.defaultValue ? concat$9([" = ", path.call(print, "defaultValue")]) : "", printDirectives(path, print, n)]);
18179
18900
  }
18180
18901
 
18181
18902
  case "InputObjectTypeExtension":
18182
18903
  case "InputObjectTypeDefinition":
18183
18904
  {
18184
- return concat$8([path.call(print, "description"), n.description ? hardline$7 : "", n.kind === "InputObjectTypeExtension" ? "extend " : "", "input ", path.call(print, "name"), printDirectives(path, print, n), n.fields.length > 0 ? concat$8([" {", indent$6(concat$8([hardline$7, join$6(hardline$7, path.call(function (fieldsPath) {
18905
+ return concat$9([path.call(print, "description"), n.description ? hardline$8 : "", n.kind === "InputObjectTypeExtension" ? "extend " : "", "input ", path.call(print, "name"), printDirectives(path, print, n), n.fields.length > 0 ? concat$9([" {", indent$6(concat$9([hardline$8, join$6(hardline$8, path.call(function (fieldsPath) {
18185
18906
  return printSequence(fieldsPath, options, print);
18186
- }, "fields"))])), hardline$7, "}"]) : ""]);
18907
+ }, "fields"))])), hardline$8, "}"]) : ""]);
18187
18908
  }
18188
18909
 
18189
18910
  case "SchemaDefinition":
18190
18911
  {
18191
- return concat$8(["schema", printDirectives(path, print, n), " {", n.operationTypes.length > 0 ? indent$6(concat$8([hardline$7, join$6(hardline$7, path.call(function (opsPath) {
18912
+ return concat$9(["schema", printDirectives(path, print, n), " {", n.operationTypes.length > 0 ? indent$6(concat$9([hardline$8, join$6(hardline$8, path.call(function (opsPath) {
18192
18913
  return printSequence(opsPath, options, print);
18193
- }, "operationTypes"))])) : "", hardline$7, "}"]);
18914
+ }, "operationTypes"))])) : "", hardline$8, "}"]);
18194
18915
  }
18195
18916
 
18196
18917
  case "OperationTypeDefinition":
18197
18918
  {
18198
- return concat$8([path.call(print, "operation"), ": ", path.call(print, "type")]);
18919
+ return concat$9([path.call(print, "operation"), ": ", path.call(print, "type")]);
18199
18920
  }
18200
18921
 
18201
18922
  case "InterfaceTypeExtension":
18202
18923
  case "InterfaceTypeDefinition":
18203
18924
  {
18204
- return concat$8([path.call(print, "description"), n.description ? hardline$7 : "", n.kind === "InterfaceTypeExtension" ? "extend " : "", "interface ", path.call(print, "name"), printDirectives(path, print, n), n.fields.length > 0 ? concat$8([" {", indent$6(concat$8([hardline$7, join$6(hardline$7, path.call(function (fieldsPath) {
18925
+ return concat$9([path.call(print, "description"), n.description ? hardline$8 : "", n.kind === "InterfaceTypeExtension" ? "extend " : "", "interface ", path.call(print, "name"), printDirectives(path, print, n), n.fields.length > 0 ? concat$9([" {", indent$6(concat$9([hardline$8, join$6(hardline$8, path.call(function (fieldsPath) {
18205
18926
  return printSequence(fieldsPath, options, print);
18206
- }, "fields"))])), hardline$7, "}"]) : ""]);
18927
+ }, "fields"))])), hardline$8, "}"]) : ""]);
18207
18928
  }
18208
18929
 
18209
18930
  case "FragmentSpread":
18210
18931
  {
18211
- return concat$8(["...", path.call(print, "name"), printDirectives(path, print, n)]);
18932
+ return concat$9(["...", path.call(print, "name"), printDirectives(path, print, n)]);
18212
18933
  }
18213
18934
 
18214
18935
  case "InlineFragment":
18215
18936
  {
18216
- return concat$8(["...", n.typeCondition ? concat$8([" on ", path.call(print, "typeCondition")]) : "", printDirectives(path, print, n), " ", path.call(print, "selectionSet")]);
18937
+ return concat$9(["...", n.typeCondition ? concat$9([" on ", path.call(print, "typeCondition")]) : "", printDirectives(path, print, n), " ", path.call(print, "selectionSet")]);
18217
18938
  }
18218
18939
 
18219
18940
  case "UnionTypeExtension":
18220
18941
  case "UnionTypeDefinition":
18221
18942
  {
18222
- return group$3(concat$8([path.call(print, "description"), n.description ? hardline$7 : "", group$3(concat$8([n.kind === "UnionTypeExtension" ? "extend " : "", "union ", path.call(print, "name"), printDirectives(path, print, n), n.types.length > 0 ? concat$8([" =", ifBreak$3("", " "), indent$6(concat$8([ifBreak$3(concat$8([line$5, " "])), join$6(concat$8([line$5, "| "]), path.map(print, "types"))]))]) : ""]))]));
18943
+ return group$9(concat$9([path.call(print, "description"), n.description ? hardline$8 : "", group$9(concat$9([n.kind === "UnionTypeExtension" ? "extend " : "", "union ", path.call(print, "name"), printDirectives(path, print, n), n.types.length > 0 ? concat$9([" =", ifBreak$3("", " "), indent$6(concat$9([ifBreak$3(concat$9([line$5, " "])), join$6(concat$9([line$5, "| "]), path.map(print, "types"))]))]) : ""]))]));
18223
18944
  }
18224
18945
 
18225
18946
  case "ScalarTypeExtension":
18226
18947
  case "ScalarTypeDefinition":
18227
18948
  {
18228
- return concat$8([path.call(print, "description"), n.description ? hardline$7 : "", n.kind === "ScalarTypeExtension" ? "extend " : "", "scalar ", path.call(print, "name"), printDirectives(path, print, n)]);
18949
+ return concat$9([path.call(print, "description"), n.description ? hardline$8 : "", n.kind === "ScalarTypeExtension" ? "extend " : "", "scalar ", path.call(print, "name"), printDirectives(path, print, n)]);
18229
18950
  }
18230
18951
 
18231
18952
  case "NonNullType":
18232
18953
  {
18233
- return concat$8([path.call(print, "type"), "!"]);
18954
+ return concat$9([path.call(print, "type"), "!"]);
18234
18955
  }
18235
18956
 
18236
18957
  case "ListType":
18237
18958
  {
18238
- return concat$8(["[", path.call(print, "type"), "]"]);
18959
+ return concat$9(["[", path.call(print, "type"), "]"]);
18239
18960
  }
18240
18961
 
18241
18962
  default:
@@ -18249,7 +18970,7 @@ function printDirectives(path, print, n) {
18249
18970
  return "";
18250
18971
  }
18251
18972
 
18252
- return concat$8([" ", group$3(indent$6(concat$8([softline$4, join$6(concat$8([ifBreak$3("", " "), softline$4]), path.map(print, "directives"))])))]);
18973
+ return concat$9([" ", group$9(indent$6(concat$9([softline$4, join$6(concat$9([ifBreak$3("", " "), softline$4]), path.map(print, "directives"))])))]);
18253
18974
  }
18254
18975
 
18255
18976
  function printSequence(sequencePath, options, print) {
@@ -18258,7 +18979,7 @@ function printSequence(sequencePath, options, print) {
18258
18979
  var printed = print(path);
18259
18980
 
18260
18981
  if (isNextLineEmpty$4(options.originalText, path.getValue(), options) && i < count - 1) {
18261
- return concat$8([printed, hardline$7]);
18982
+ return concat$9([printed, hardline$8]);
18262
18983
  }
18263
18984
 
18264
18985
  return printed;
@@ -18272,13 +18993,11 @@ function canAttachComment$1(node) {
18272
18993
  function printComment$2(commentPath) {
18273
18994
  var comment = commentPath.getValue();
18274
18995
 
18275
- switch (comment.kind) {
18276
- case "Comment":
18277
- return "#" + comment.value.trimRight();
18278
-
18279
- default:
18280
- throw new Error("Not a comment: " + JSON.stringify(comment));
18996
+ if (comment.kind === "Comment") {
18997
+ return "#" + comment.value.trimRight();
18281
18998
  }
18999
+
19000
+ throw new Error("Not a comment: " + JSON.stringify(comment));
18282
19001
  }
18283
19002
 
18284
19003
  function determineInterfaceSeparator(originalSource) {
@@ -18308,6 +19027,7 @@ var printerGraphql = {
18308
19027
  print: genericPrint$4,
18309
19028
  massageAstNode: clean$5,
18310
19029
  hasPrettierIgnore: hasIgnoreComment$3,
19030
+ insertPragma: insertPragma$4,
18311
19031
  printComment: printComment$2,
18312
19032
  canAttachComment: canAttachComment$1
18313
19033
  };
@@ -18316,19 +19036,38 @@ var options$9 = {
18316
19036
  bracketSpacing: commonOptions.bracketSpacing
18317
19037
  };
18318
19038
 
18319
- // https://github.com/github/linguist/blob/master/lib/linguist/languages.yml
19039
+ var name$11 = "GraphQL";
19040
+ var type$10 = "data";
19041
+ var extensions$10 = [".graphql", ".gql"];
19042
+ var tmScope$10 = "source.graphql";
19043
+ var aceMode$10 = "text";
19044
+ var languageId$10 = 139;
19045
+ var graphql = {
19046
+ name: name$11,
19047
+ type: type$10,
19048
+ extensions: extensions$10,
19049
+ tmScope: tmScope$10,
19050
+ aceMode: aceMode$10,
19051
+ languageId: languageId$10
19052
+ };
19053
+
19054
+ var graphql$1 = Object.freeze({
19055
+ name: name$11,
19056
+ type: type$10,
19057
+ extensions: extensions$10,
19058
+ tmScope: tmScope$10,
19059
+ aceMode: aceMode$10,
19060
+ languageId: languageId$10,
19061
+ default: graphql
19062
+ });
18320
19063
 
19064
+ var require$$0$13 = ( graphql$1 && graphql ) || graphql$1;
18321
19065
 
18322
- var languages$2 = [{
18323
- name: "GraphQL",
19066
+ var languages$2 = [languageExtend({}, require$$0$13, {
18324
19067
  since: "1.5.0",
18325
19068
  parsers: ["graphql"],
18326
- extensions: [".graphql", ".gql"],
18327
- tmScope: "source.graphql",
18328
- aceMode: "text",
18329
- liguistLanguageId: 139,
18330
19069
  vscodeLanguageIds: ["graphql"]
18331
- }];
19070
+ })];
18332
19071
  var printers$2 = {
18333
19072
  graphql: printerGraphql
18334
19073
  };
@@ -18338,19 +19077,20 @@ var languageGraphql = {
18338
19077
  printers: printers$2
18339
19078
  };
18340
19079
 
18341
- var _require$$0$builders$5 = doc.builders;
18342
- var hardline$9 = _require$$0$builders$5.hardline;
18343
- var literalline$3 = _require$$0$builders$5.literalline;
18344
- var concat$10 = _require$$0$builders$5.concat;
18345
- var markAsRoot$1 = _require$$0$builders$5.markAsRoot;
18346
- var mapDoc$4 = doc.utils.mapDoc;
19080
+ var _require$$0$builders$6 = doc.builders;
19081
+ var hardline$10 = _require$$0$builders$6.hardline;
19082
+ var literalline$5 = _require$$0$builders$6.literalline;
19083
+ var concat$11 = _require$$0$builders$6.concat;
19084
+ var markAsRoot$3 = _require$$0$builders$6.markAsRoot;
19085
+ var mapDoc$5 = doc.utils.mapDoc;
18347
19086
 
18348
- function embed$2(path, print, textToDoc, options) {
19087
+ function embed$4(path, print, textToDoc, options) {
18349
19088
  var node = path.getValue();
18350
19089
 
18351
19090
  if (node.type === "code" && node.lang !== null) {
18352
19091
  // only look for the first string so as to support [markdown-preview-enhanced](https://shd101wyy.github.io/markdown-preview-enhanced/#/code-chunk)
18353
- var lang = node.lang.split(/\s/, 1)[0];
19092
+ var langMatch = node.lang.match(/^[A-Za-z0-9_-]+/);
19093
+ var lang = langMatch ? langMatch[0] : "";
18354
19094
  var parser = getParserName(lang);
18355
19095
 
18356
19096
  if (parser) {
@@ -18359,10 +19099,16 @@ function embed$2(path, print, textToDoc, options) {
18359
19099
  var doc$$2 = textToDoc(node.value, {
18360
19100
  parser: parser
18361
19101
  });
18362
- return markAsRoot$1(concat$10([style, node.lang, hardline$9, replaceNewlinesWithLiterallines(doc$$2), style]));
19102
+ return markAsRoot$3(concat$11([style, node.lang, hardline$10, replaceNewlinesWithLiterallines(doc$$2), style]));
18363
19103
  }
18364
19104
  }
18365
19105
 
19106
+ if (node.type === "yaml") {
19107
+ return markAsRoot$3(concat$11(["---", hardline$10, node.value.trim() ? replaceNewlinesWithLiterallines(textToDoc(node.value, {
19108
+ parser: "yaml"
19109
+ })) : "", "---"]));
19110
+ }
19111
+
18366
19112
  return null;
18367
19113
 
18368
19114
  function getParserName(lang) {
@@ -18370,7 +19116,7 @@ function embed$2(path, print, textToDoc, options) {
18370
19116
  plugins: options.plugins
18371
19117
  });
18372
19118
  var language = supportInfo.languages.find(function (language) {
18373
- return language.name.toLowerCase() === lang || language.extensions && language.extensions.find(function (ext) {
19119
+ return language.name.toLowerCase() === lang || language.aliases && language.aliases.indexOf(lang) !== -1 || language.extensions && language.extensions.find(function (ext) {
18374
19120
  return ext.substring(1) === lang;
18375
19121
  });
18376
19122
  });
@@ -18383,44 +19129,17 @@ function embed$2(path, print, textToDoc, options) {
18383
19129
  }
18384
19130
 
18385
19131
  function replaceNewlinesWithLiterallines(doc$$2) {
18386
- return mapDoc$4(doc$$2, function (currentDoc) {
18387
- return typeof currentDoc === "string" && currentDoc.includes("\n") ? concat$10(currentDoc.split(/(\n)/g).map(function (v, i) {
18388
- return i % 2 === 0 ? v : literalline$3;
19132
+ return mapDoc$5(doc$$2, function (currentDoc) {
19133
+ return typeof currentDoc === "string" && currentDoc.includes("\n") ? concat$11(currentDoc.split(/(\n)/g).map(function (v, i) {
19134
+ return i % 2 === 0 ? v : literalline$5;
18389
19135
  })) : currentDoc;
18390
19136
  });
18391
19137
  }
18392
19138
  }
18393
19139
 
18394
- var embed_1$2 = embed$2;
18395
-
18396
- function parse$3(text) {
18397
- var delimiter;
18398
-
18399
- if (text.indexOf("---") === 0) {
18400
- delimiter = "---";
18401
- } else if (text.indexOf("+++") === 0) {
18402
- delimiter = "+++";
18403
- }
18404
-
18405
- var end = -1;
18406
-
18407
- if (!delimiter || (end = text.indexOf("\n".concat(delimiter), 3)) === -1) {
18408
- return {
18409
- frontMatter: null,
18410
- content: text
18411
- };
18412
- }
18413
-
18414
- end = end + 4;
18415
- return {
18416
- frontMatter: text.slice(0, end),
18417
- content: text.slice(end)
18418
- };
18419
- }
18420
-
18421
- var frontMatter = parse$3;
19140
+ var embed_1$4 = embed$4;
18422
19141
 
18423
- var pragma$2 = createCommonjsModule(function (module) {
19142
+ var pragma$6 = createCommonjsModule(function (module) {
18424
19143
  "use strict";
18425
19144
 
18426
19145
  var pragmas = ["format", "prettier"];
@@ -18440,23 +19159,44 @@ var pragma$2 = createCommonjsModule(function (module) {
18440
19159
  insertPragma: function insertPragma(text) {
18441
19160
  var extracted = frontMatter(text);
18442
19161
  var pragma = "<!-- @".concat(pragmas[0], " -->");
18443
- return extracted.frontMatter ? "".concat(extracted.frontMatter, "\n\n").concat(pragma, "\n\n").concat(extracted.content) : "".concat(pragma, "\n\n").concat(extracted.content);
19162
+ return extracted.frontMatter ? "".concat(extracted.frontMatter.raw, "\n\n").concat(pragma, "\n\n").concat(extracted.content) : "".concat(pragma, "\n\n").concat(extracted.content);
18444
19163
  }
18445
19164
  };
18446
19165
  });
18447
19166
 
18448
- var _require$$0$builders$4 = doc.builders;
18449
- var concat$9 = _require$$0$builders$4.concat;
18450
- var join$7 = _require$$0$builders$4.join;
18451
- var line$6 = _require$$0$builders$4.line;
18452
- var hardline$8 = _require$$0$builders$4.hardline;
18453
- var softline$5 = _require$$0$builders$4.softline;
18454
- var fill$4 = _require$$0$builders$4.fill;
18455
- var align$2 = _require$$0$builders$4.align;
18456
- var indent$7 = _require$$0$builders$4.indent;
18457
- var group$4 = _require$$0$builders$4.group;
18458
- var mapDoc$3 = doc.utils.mapDoc;
19167
+ function getOrderedListItemInfo$1(orderListItem, originalText) {
19168
+ var _originalText$slice$m = originalText.slice(orderListItem.position.start.offset, orderListItem.position.end.offset).match(/^\s*(\d+)(\.|\))(\s*)/),
19169
+ _originalText$slice$m2 = _slicedToArray(_originalText$slice$m, 4),
19170
+ numberText = _originalText$slice$m2[1],
19171
+ marker = _originalText$slice$m2[2],
19172
+ leadingSpaces = _originalText$slice$m2[3];
19173
+
19174
+ return {
19175
+ numberText: numberText,
19176
+ marker: marker,
19177
+ leadingSpaces: leadingSpaces
19178
+ };
19179
+ }
19180
+
19181
+ var utils$6 = {
19182
+ getOrderedListItemInfo: getOrderedListItemInfo$1
19183
+ };
19184
+
19185
+ var _require$$0$builders$5 = doc.builders;
19186
+ var concat$10 = _require$$0$builders$5.concat;
19187
+ var join$7 = _require$$0$builders$5.join;
19188
+ var line$6 = _require$$0$builders$5.line;
19189
+ var literalline$4 = _require$$0$builders$5.literalline;
19190
+ var markAsRoot$2 = _require$$0$builders$5.markAsRoot;
19191
+ var hardline$9 = _require$$0$builders$5.hardline;
19192
+ var softline$5 = _require$$0$builders$5.softline;
19193
+ var fill$4 = _require$$0$builders$5.fill;
19194
+ var align$2 = _require$$0$builders$5.align;
19195
+ var indent$7 = _require$$0$builders$5.indent;
19196
+ var group$10 = _require$$0$builders$5.group;
19197
+ var mapDoc$4 = doc.utils.mapDoc;
18459
19198
  var printDocToString$2 = doc.printer.printDocToString;
19199
+ var getOrderedListItemInfo = utils$6.getOrderedListItemInfo;
18460
19200
  var SINGLE_LINE_NODE_TYPES = ["heading", "tableCell", "link"];
18461
19201
  var SIBLING_NODE_TYPES = ["listItem", "definition", "footnoteDefinition"];
18462
19202
  var INLINE_NODE_TYPES = ["liquidNode", "inlineCode", "emphasis", "strong", "delete", "link", "linkReference", "image", "imageReference", "footnote", "footnoteReference", "sentence", "whitespace", "word", "break"];
@@ -18466,7 +19206,7 @@ function genericPrint$5(path, options, print) {
18466
19206
  var node = path.getValue();
18467
19207
 
18468
19208
  if (shouldRemainTheSameContent(path)) {
18469
- return concat$9(util.splitText(options.originalText.slice(node.position.start.offset, node.position.end.offset), options).map(function (node) {
19209
+ return concat$10(util.splitText(options.originalText.slice(node.position.start.offset, node.position.end.offset), options).map(function (node) {
18470
19210
  return node.type === "word" ? node.value : node.value === "" ? "" : printLine(path, node.value, options);
18471
19211
  }));
18472
19212
  }
@@ -18477,7 +19217,7 @@ function genericPrint$5(path, options, print) {
18477
19217
  return "";
18478
19218
  }
18479
19219
 
18480
- return concat$9([normalizeDoc(printRoot(path, options, print)), hardline$8]);
19220
+ return concat$10([normalizeDoc(printRoot(path, options, print)), hardline$9]);
18481
19221
 
18482
19222
  case "paragraph":
18483
19223
  return printChildren(path, options, print, {
@@ -18517,14 +19257,14 @@ function genericPrint$5(path, options, print) {
18517
19257
  var hasPrevOrNextWord = // `1*2*3` is considered emphais but `1_2_3` is not
18518
19258
  prevNode && prevNode.type === "sentence" && prevNode.children.length > 0 && util.getLast(prevNode.children).type === "word" && !util.getLast(prevNode.children).hasTrailingPunctuation || _nextNode && _nextNode.type === "sentence" && _nextNode.children.length > 0 && _nextNode.children[0].type === "word" && !_nextNode.children[0].hasLeadingPunctuation;
18519
19259
  var style = hasPrevOrNextWord || getAncestorNode$2(path, "emphasis") ? "*" : "_";
18520
- return concat$9([style, printChildren(path, options, print), style]);
19260
+ return concat$10([style, printChildren(path, options, print), style]);
18521
19261
  }
18522
19262
 
18523
19263
  case "strong":
18524
- return concat$9(["**", printChildren(path, options, print), "**"]);
19264
+ return concat$10(["**", printChildren(path, options, print), "**"]);
18525
19265
 
18526
19266
  case "delete":
18527
- return concat$9(["~~", printChildren(path, options, print), "~~"]);
19267
+ return concat$10(["~~", printChildren(path, options, print), "~~"]);
18528
19268
 
18529
19269
  case "inlineCode":
18530
19270
  {
@@ -18533,37 +19273,41 @@ function genericPrint$5(path, options, print) {
18533
19273
  var _style = backtickCount === 1 ? "``" : "`";
18534
19274
 
18535
19275
  var gap = backtickCount ? " " : "";
18536
- return concat$9([_style, gap, node.value, gap, _style]);
19276
+ return concat$10([_style, gap, node.value, gap, _style]);
18537
19277
  }
18538
19278
 
18539
19279
  case "link":
18540
19280
  switch (options.originalText[node.position.start.offset]) {
18541
19281
  case "<":
18542
- return concat$9(["<", node.url, ">"]);
19282
+ {
19283
+ var mailto = "mailto:";
19284
+ var url = // <hello@example.com> is parsed as { url: "mailto:hello@example.com" }
19285
+ node.url.startsWith(mailto) && options.originalText.slice(node.position.start.offset + 1, node.position.start.offset + 1 + mailto.length) !== mailto ? node.url.slice(mailto.length) : node.url;
19286
+ return concat$10(["<", url, ">"]);
19287
+ }
18543
19288
 
18544
19289
  case "[":
18545
- return concat$9(["[", printChildren(path, options, print), "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"]);
19290
+ return concat$10(["[", printChildren(path, options, print), "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"]);
18546
19291
 
18547
19292
  default:
18548
19293
  return options.originalText.slice(node.position.start.offset, node.position.end.offset);
18549
19294
  }
18550
19295
 
18551
19296
  case "image":
18552
- return concat$9(["![", node.alt || "", "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"]);
19297
+ return concat$10(["![", node.alt || "", "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"]);
18553
19298
 
18554
19299
  case "blockquote":
18555
- return concat$9(["> ", align$2("> ", printChildren(path, options, print))]);
19300
+ return concat$10(["> ", align$2("> ", printChildren(path, options, print))]);
18556
19301
 
18557
19302
  case "heading":
18558
- return concat$9(["#".repeat(node.depth) + " ", printChildren(path, options, print)]);
19303
+ return concat$10(["#".repeat(node.depth) + " ", printChildren(path, options, print)]);
18559
19304
 
18560
19305
  case "code":
18561
19306
  {
18562
- if ( // the first char may point to `\n`, e.g. `\n\t\tbar`, just ignore it
18563
- /^\n?( {4,}|\t)/.test(options.originalText.slice(node.position.start.offset, node.position.end.offset))) {
19307
+ if (node.isIndented) {
18564
19308
  // indented code block
18565
19309
  var alignment = " ".repeat(4);
18566
- return align$2(alignment, concat$9([alignment, join$7(hardline$8, node.value.split("\n"))]));
19310
+ return align$2(alignment, concat$10([alignment, join$7(hardline$9, node.value.split("\n"))]));
18567
19311
  } // fenced code block
18568
19312
 
18569
19313
 
@@ -18571,35 +19315,36 @@ function genericPrint$5(path, options, print) {
18571
19315
 
18572
19316
  var _style2 = styleUnit.repeat(Math.max(3, util.getMaxContinuousCount(node.value, styleUnit) + 1));
18573
19317
 
18574
- return concat$9([_style2, node.lang || "", hardline$8, join$7(hardline$8, node.value.split("\n")), hardline$8, _style2]);
19318
+ return concat$10([_style2, node.lang || "", hardline$9, join$7(hardline$9, node.value.split("\n")), hardline$9, _style2]);
18575
19319
  }
18576
19320
 
18577
- case "front-matter":
18578
- return node.value;
19321
+ case "yaml":
19322
+ case "toml":
19323
+ return options.originalText.slice(node.position.start.offset, node.position.end.offset);
18579
19324
 
18580
19325
  case "html":
18581
19326
  {
18582
19327
  var _parentNode2 = path.getParentNode();
18583
19328
 
18584
- return replaceNewlinesWithHardlines(_parentNode2.type === "root" && util.getLast(_parentNode2.children) === node ? node.value.trimRight() : node.value);
19329
+ var value = _parentNode2.type === "root" && util.getLast(_parentNode2.children) === node ? node.value.trimRight() : node.value;
19330
+ var isHtmlComment = /^<!--[\s\S]*-->$/.test(value);
19331
+ return replaceNewlinesWith(value, isHtmlComment ? hardline$9 : markAsRoot$2(literalline$4));
18585
19332
  }
18586
19333
 
18587
19334
  case "list":
18588
19335
  {
18589
19336
  var nthSiblingIndex = getNthListSiblingIndex(node, path.getParentNode());
18590
- var isGitDiffFriendlyOrderedList = node.ordered && node.children.length > 1 && /^\s*1(\.|\))/.test(options.originalText.slice(node.children[1].position.start.offset, node.children[1].position.end.offset));
19337
+ var isGitDiffFriendlyOrderedList = node.ordered && node.children.length > 1 && +getOrderedListItemInfo(node.children[1], options.originalText).numberText === 1;
18591
19338
  return printChildren(path, options, print, {
18592
19339
  processor: function processor(childPath, index) {
18593
19340
  var prefix = getPrefix();
18594
- return concat$9([prefix, align$2(" ".repeat(prefix.length), printListItem(childPath, options, print, prefix))]);
19341
+ return concat$10([prefix, align$2(" ".repeat(prefix.length), printListItem(childPath, options, print, prefix))]);
18595
19342
 
18596
19343
  function getPrefix() {
18597
- var rawPrefix = node.ordered ? (index === 0 ? node.start : isGitDiffFriendlyOrderedList ? 1 : node.start + index) + (nthSiblingIndex % 2 === 0 ? ". " : ") ") : nthSiblingIndex % 2 === 0 ? "- " : "* "; // do not print trailing spaces for empty list item since it might be treated as `break` node
18598
- // by [doc-printer](https://github.com/prettier/prettier/blob/1.10.2/src/doc/doc-printer.js#L395-L405),
18599
- // we don't want to preserve unnecessary trailing spaces.
18600
-
18601
- var listItem = childPath.getValue();
18602
- return listItem.children.length ? alignListPrefix(rawPrefix, options) : rawPrefix;
19344
+ var rawPrefix = node.ordered ? (index === 0 ? node.start : isGitDiffFriendlyOrderedList ? 1 : node.start + index) + (nthSiblingIndex % 2 === 0 ? ". " : ") ") : nthSiblingIndex % 2 === 0 ? "- " : "* ";
19345
+ return node.isAligned ||
19346
+ /* workaround for https://github.com/remarkjs/remark/issues/315 */
19347
+ node.hasIndentedCodeblock ? alignListPrefix(rawPrefix, options) : rawPrefix;
18603
19348
  }
18604
19349
  }
18605
19350
  });
@@ -18619,35 +19364,35 @@ function genericPrint$5(path, options, print) {
18619
19364
  }
18620
19365
 
18621
19366
  case "linkReference":
18622
- return concat$9(["[", printChildren(path, options, print), "]", node.referenceType === "full" ? concat$9(["[", node.identifier, "]"]) : node.referenceType === "collapsed" ? "[]" : ""]);
19367
+ return concat$10(["[", printChildren(path, options, print), "]", node.referenceType === "full" ? concat$10(["[", node.identifier, "]"]) : node.referenceType === "collapsed" ? "[]" : ""]);
18623
19368
 
18624
19369
  case "imageReference":
18625
19370
  switch (node.referenceType) {
18626
19371
  case "full":
18627
- return concat$9(["![", node.alt || "", "][", node.identifier, "]"]);
19372
+ return concat$10(["![", node.alt || "", "][", node.identifier, "]"]);
18628
19373
 
18629
19374
  default:
18630
- return concat$9(["![", node.alt, "]", node.referenceType === "collapsed" ? "[]" : ""]);
19375
+ return concat$10(["![", node.alt, "]", node.referenceType === "collapsed" ? "[]" : ""]);
18631
19376
  }
18632
19377
 
18633
19378
  case "definition":
18634
19379
  {
18635
19380
  var lineOrSpace = options.proseWrap === "always" ? line$6 : " ";
18636
- return group$4(concat$9([concat$9(["[", node.identifier, "]:"]), indent$7(concat$9([lineOrSpace, printUrl(node.url), node.title === null ? "" : concat$9([lineOrSpace, printTitle(node.title, options, false)])]))]));
19381
+ return group$10(concat$10([concat$10(["[", node.identifier, "]:"]), indent$7(concat$10([lineOrSpace, printUrl(node.url), node.title === null ? "" : concat$10([lineOrSpace, printTitle(node.title, options, false)])]))]));
18637
19382
  }
18638
19383
 
18639
19384
  case "footnote":
18640
- return concat$9(["[^", printChildren(path, options, print), "]"]);
19385
+ return concat$10(["[^", printChildren(path, options, print), "]"]);
18641
19386
 
18642
19387
  case "footnoteReference":
18643
- return concat$9(["[^", node.identifier, "]"]);
19388
+ return concat$10(["[^", node.identifier, "]"]);
18644
19389
 
18645
19390
  case "footnoteDefinition":
18646
19391
  {
18647
19392
  var _nextNode2 = path.getParentNode().children[path.getName() + 1];
18648
- return concat$9(["[^", node.identifier, "]: ", group$4(concat$9([align$2(" ".repeat(options.tabWidth), printChildren(path, options, print, {
19393
+ return concat$10(["[^", node.identifier, "]: ", group$10(concat$10([align$2(" ".repeat(options.tabWidth), printChildren(path, options, print, {
18649
19394
  processor: function processor(childPath, index) {
18650
- return index === 0 ? group$4(concat$9([softline$5, softline$5, childPath.call(print)])) : childPath.call(print);
19395
+ return index === 0 ? group$10(concat$10([softline$5, softline$5, childPath.call(print)])) : childPath.call(print);
18651
19396
  }
18652
19397
  })), _nextNode2 && _nextNode2.type === "footnoteDefinition" ? softline$5 : ""]))]);
18653
19398
  }
@@ -18659,10 +19404,10 @@ function genericPrint$5(path, options, print) {
18659
19404
  return printChildren(path, options, print);
18660
19405
 
18661
19406
  case "break":
18662
- return concat$9([/\s/.test(options.originalText[node.position.start.offset]) ? " " : "\\", hardline$8]);
19407
+ return /\s/.test(options.originalText[node.position.start.offset]) ? concat$10([" ", markAsRoot$2(literalline$4)]) : concat$10(["\\", hardline$9]);
18663
19408
 
18664
19409
  case "liquidNode":
18665
- return replaceNewlinesWithHardlines(node.value);
19410
+ return replaceNewlinesWith(node.value, hardline$9);
18666
19411
 
18667
19412
  case "tableRow": // handled in "table"
18668
19413
 
@@ -18676,7 +19421,7 @@ function genericPrint$5(path, options, print) {
18676
19421
  function printListItem(path, options, print, listPrefix) {
18677
19422
  var node = path.getValue();
18678
19423
  var prefix = node.checked === null ? "" : node.checked ? "[x] " : "[ ] ";
18679
- return concat$9([prefix, printChildren(path, options, print, {
19424
+ return concat$10([prefix, printChildren(path, options, print, {
18680
19425
  processor: function processor(childPath, index) {
18681
19426
  if (index === 0 && childPath.getValue().type !== "list") {
18682
19427
  return align$2(" ".repeat(prefix.length), childPath.call(print));
@@ -18684,7 +19429,7 @@ function printListItem(path, options, print, listPrefix) {
18684
19429
 
18685
19430
  var alignment = " ".repeat(clamp(options.tabWidth - listPrefix.length, 0, 3) // 4+ will cause indented code block
18686
19431
  );
18687
- return concat$9([alignment, align$2(alignment, childPath.call(print))]);
19432
+ return concat$10([alignment, align$2(alignment, childPath.call(print))]);
18688
19433
  }
18689
19434
  })]);
18690
19435
  }
@@ -18706,8 +19451,8 @@ function getNthListSiblingIndex(node, parentNode) {
18706
19451
  });
18707
19452
  }
18708
19453
 
18709
- function replaceNewlinesWithHardlines(str) {
18710
- return join$7(hardline$8, str.split("\n"));
19454
+ function replaceNewlinesWith(str, doc$$2) {
19455
+ return join$7(doc$$2, str.split("\n"));
18711
19456
  }
18712
19457
 
18713
19458
  function getNthSiblingIndex(node, parentNode, condition) {
@@ -18771,7 +19516,7 @@ function getAncestorNode$2(path, typeOrTypes) {
18771
19516
 
18772
19517
  function printLine(path, value, options) {
18773
19518
  if (options.proseWrap === "preserve" && value === "\n") {
18774
- return hardline$8;
19519
+ return hardline$9;
18775
19520
  }
18776
19521
 
18777
19522
  var isBreakable = options.proseWrap === "always" && !getAncestorNode$2(path, SINGLE_LINE_NODE_TYPES);
@@ -18797,10 +19542,10 @@ function printTable(path, options, print) {
18797
19542
  return 3;
18798
19543
  }) // minimum width = 3 (---, :--, :-:, --:)
18799
19544
  );
18800
- return join$7(hardline$8, [printRow(contents[0]), printSeparator(), join$7(hardline$8, contents.slice(1).map(printRow))]);
19545
+ return join$7(hardline$9, [printRow(contents[0]), printSeparator(), join$7(hardline$9, contents.slice(1).map(printRow))]);
18801
19546
 
18802
19547
  function printSeparator() {
18803
- return concat$9(["| ", join$7(" | ", columnMaxWidths.map(function (width, index) {
19548
+ return concat$10(["| ", join$7(" | ", columnMaxWidths.map(function (width, index) {
18804
19549
  switch (node.align[index]) {
18805
19550
  case "left":
18806
19551
  return ":" + "-".repeat(width - 1);
@@ -18818,7 +19563,7 @@ function printTable(path, options, print) {
18818
19563
  }
18819
19564
 
18820
19565
  function printRow(rowContents) {
18821
- return concat$9(["| ", join$7(" | ", rowContents.map(function (rowContent, columnIndex) {
19566
+ return concat$10(["| ", join$7(" | ", rowContents.map(function (rowContent, columnIndex) {
18822
19567
  switch (node.align[columnIndex]) {
18823
19568
  case "right":
18824
19569
  return alignRight(rowContent, columnMaxWidths[columnIndex]);
@@ -18833,18 +19578,18 @@ function printTable(path, options, print) {
18833
19578
  }
18834
19579
 
18835
19580
  function alignLeft(text, width) {
18836
- return concat$9([text, " ".repeat(width - util.getStringWidth(text))]);
19581
+ return concat$10([text, " ".repeat(width - util.getStringWidth(text))]);
18837
19582
  }
18838
19583
 
18839
19584
  function alignRight(text, width) {
18840
- return concat$9([" ".repeat(width - util.getStringWidth(text)), text]);
19585
+ return concat$10([" ".repeat(width - util.getStringWidth(text)), text]);
18841
19586
  }
18842
19587
 
18843
19588
  function alignCenter(text, width) {
18844
19589
  var spaces = width - util.getStringWidth(text);
18845
19590
  var left = Math.floor(spaces / 2);
18846
19591
  var right = spaces - left;
18847
- return concat$9([" ".repeat(left), text, " ".repeat(right)]);
19592
+ return concat$10([" ".repeat(left), text, " ".repeat(right)]);
18848
19593
  }
18849
19594
  }
18850
19595
 
@@ -18894,7 +19639,7 @@ function printRoot(path, options, print) {
18894
19639
  var ignoreRange = ignoreRanges[0];
18895
19640
 
18896
19641
  if (index === ignoreRange.start.index) {
18897
- return concat$9([children[ignoreRange.start.index].value, options.originalText.slice(ignoreRange.start.offset, ignoreRange.end.offset), children[ignoreRange.end.index].value]);
19642
+ return concat$10([children[ignoreRange.start.index].value, options.originalText.slice(ignoreRange.start.offset, ignoreRange.end.offset), children[ignoreRange.end.index].value]);
18898
19643
  }
18899
19644
 
18900
19645
  if (ignoreRange.start.index < index && index < ignoreRange.end.index) {
@@ -18914,7 +19659,7 @@ function printRoot(path, options, print) {
18914
19659
 
18915
19660
  function printChildren(path, options, print, events) {
18916
19661
  events = events || {};
18917
- var postprocessor = events.postprocessor || concat$9;
19662
+ var postprocessor = events.postprocessor || concat$10;
18918
19663
 
18919
19664
  var processor = events.processor || function (childPath) {
18920
19665
  return childPath.call(print);
@@ -18936,14 +19681,14 @@ function printChildren(path, options, print, events) {
18936
19681
  };
18937
19682
 
18938
19683
  if (!shouldNotPrePrintHardline(childNode, data)) {
18939
- parts.push(hardline$8);
19684
+ parts.push(hardline$9);
18940
19685
 
18941
19686
  if (shouldPrePrintDoubleHardline(childNode, data) || shouldPrePrintTripleHardline(childNode, data)) {
18942
- parts.push(hardline$8);
19687
+ parts.push(hardline$9);
18943
19688
  }
18944
19689
 
18945
19690
  if (shouldPrePrintTripleHardline(childNode, data)) {
18946
- parts.push(hardline$8);
19691
+ parts.push(hardline$9);
18947
19692
  }
18948
19693
  }
18949
19694
 
@@ -18984,7 +19729,7 @@ function shouldPrePrintDoubleHardline(node, data) {
18984
19729
 
18985
19730
  function shouldPrePrintTripleHardline(node, data) {
18986
19731
  var isPrevNodeList = data.prevNode && data.prevNode.type === "list";
18987
- var isIndentedCode = node.type === "code" && /\s/.test(data.options.originalText[node.position.start.offset]);
19732
+ var isIndentedCode = node.type === "code" && node.isIndented;
18988
19733
  return isPrevNodeList && isIndentedCode;
18989
19734
  }
18990
19735
 
@@ -18994,7 +19739,7 @@ function shouldRemainTheSameContent(path) {
18994
19739
  }
18995
19740
 
18996
19741
  function normalizeDoc(doc$$2) {
18997
- return mapDoc$3(doc$$2, function (currentDoc) {
19742
+ return mapDoc$4(doc$$2, function (currentDoc) {
18998
19743
  if (!currentDoc.parts) {
18999
19744
  return currentDoc;
19000
19745
  }
@@ -19068,10 +19813,16 @@ function clamp(value, min, max) {
19068
19813
  }
19069
19814
 
19070
19815
  function clean$6(ast, newObj, parent) {
19071
- delete newObj.position; // for codeblock
19816
+ delete newObj.position;
19817
+ delete newObj.raw; // front-matter
19818
+ // for codeblock
19072
19819
 
19073
- if (ast.type === "code") {
19820
+ if (ast.type === "code" || ast.type === "yaml") {
19074
19821
  delete newObj.value;
19822
+ }
19823
+
19824
+ if (ast.type === "list") {
19825
+ delete newObj.isAligned;
19075
19826
  } // for whitespace: "\n" and " " are considered the same
19076
19827
 
19077
19828
 
@@ -19080,7 +19831,7 @@ function clean$6(ast, newObj, parent) {
19080
19831
  } // for insert pragma
19081
19832
 
19082
19833
 
19083
- if (parent && parent.type === "root" && parent.children.length > 0 && (parent.children[0] === ast || parent.children[0].type === "front-matter" && parent.children[1] === ast) && ast.type === "html" && pragma$2.startWithPragma(ast.value)) {
19834
+ if (parent && parent.type === "root" && parent.children.length > 0 && (parent.children[0] === ast || (parent.children[0].type === "yaml" || parent.children[0].type === "toml") && parent.children[1] === ast) && ast.type === "html" && pragma$6.startWithPragma(ast.value)) {
19084
19835
  return null;
19085
19836
  }
19086
19837
  }
@@ -19098,70 +19849,62 @@ function hasPrettierIgnore$1(path) {
19098
19849
 
19099
19850
  var printerMarkdown = {
19100
19851
  print: genericPrint$5,
19101
- embed: embed_1$2,
19852
+ embed: embed_1$4,
19102
19853
  massageAstNode: clean$6,
19103
19854
  hasPrettierIgnore: hasPrettierIgnore$1,
19104
- insertPragma: pragma$2.insertPragma
19855
+ insertPragma: pragma$6.insertPragma
19105
19856
  };
19106
19857
 
19107
- var CATEGORY_MARKDOWN = "Markdown"; // format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
19108
-
19109
19858
  var options$12 = {
19110
- proseWrap: {
19111
- since: "1.8.2",
19112
- category: CATEGORY_MARKDOWN,
19113
- type: "choice",
19114
- default: [{
19115
- since: "1.8.2",
19116
- value: true
19117
- }, {
19118
- since: "1.9.0",
19119
- value: "preserve"
19120
- }],
19121
- description: "How to wrap prose. (markdown)",
19122
- choices: [{
19123
- since: "1.9.0",
19124
- value: "always",
19125
- description: "Wrap prose if it exceeds the print width."
19126
- }, {
19127
- since: "1.9.0",
19128
- value: "never",
19129
- description: "Do not wrap prose."
19130
- }, {
19131
- since: "1.9.0",
19132
- value: "preserve",
19133
- description: "Wrap prose as-is."
19134
- }, {
19135
- value: false,
19136
- deprecated: "1.9.0",
19137
- redirect: "never"
19138
- }, {
19139
- value: true,
19140
- deprecated: "1.9.0",
19141
- redirect: "always"
19142
- }]
19143
- },
19859
+ proseWrap: commonOptions.proseWrap,
19144
19860
  singleQuote: commonOptions.singleQuote
19145
19861
  };
19146
19862
 
19147
- // https://github.com/github/linguist/blob/master/lib/linguist/languages.yml
19863
+ var name$12 = "Markdown";
19864
+ var type$11 = "prose";
19865
+ var aliases$3 = ["pandoc"];
19866
+ var aceMode$11 = "markdown";
19867
+ var codemirrorMode$9 = "gfm";
19868
+ var codemirrorMimeType$9 = "text/x-gfm";
19869
+ var wrap = true;
19870
+ var extensions$11 = [".md", ".markdown", ".mdown", ".mdwn", ".mkd", ".mkdn", ".mkdown", ".ronn", ".workbook"];
19871
+ var tmScope$11 = "source.gfm";
19872
+ var languageId$11 = 222;
19873
+ var markdown = {
19874
+ name: name$12,
19875
+ type: type$11,
19876
+ aliases: aliases$3,
19877
+ aceMode: aceMode$11,
19878
+ codemirrorMode: codemirrorMode$9,
19879
+ codemirrorMimeType: codemirrorMimeType$9,
19880
+ wrap: wrap,
19881
+ extensions: extensions$11,
19882
+ tmScope: tmScope$11,
19883
+ languageId: languageId$11
19884
+ };
19885
+
19886
+ var markdown$1 = Object.freeze({
19887
+ name: name$12,
19888
+ type: type$11,
19889
+ aliases: aliases$3,
19890
+ aceMode: aceMode$11,
19891
+ codemirrorMode: codemirrorMode$9,
19892
+ codemirrorMimeType: codemirrorMimeType$9,
19893
+ wrap: wrap,
19894
+ extensions: extensions$11,
19895
+ tmScope: tmScope$11,
19896
+ languageId: languageId$11,
19897
+ default: markdown
19898
+ });
19148
19899
 
19900
+ var require$$0$14 = ( markdown$1 && markdown ) || markdown$1;
19149
19901
 
19150
- var languages$3 = [{
19151
- name: "Markdown",
19902
+ var languages$3 = [languageExtend({}, require$$0$14, {
19152
19903
  since: "1.8.0",
19153
19904
  parsers: ["remark"],
19154
- aliases: ["pandoc"],
19155
- aceMode: "markdown",
19156
- codemirrorMode: "gfm",
19157
- codemirrorMimeType: "text/x-gfm",
19158
- wrap: true,
19159
- extensions: [".md", ".markdown", ".mdown", ".mdwn", ".mkd", ".mkdn", ".mkdown", ".ron", ".workbook"],
19160
19905
  filenames: ["README"],
19161
- tmScope: "source.gfm",
19162
- linguistLanguageId: 222,
19163
19906
  vscodeLanguageIds: ["markdown"]
19164
- }];
19907
+ })];
19165
19908
  var printers$3 = {
19166
19909
  mdast: printerMarkdown
19167
19910
  };
@@ -19171,11 +19914,11 @@ var languageMarkdown = {
19171
19914
  printers: printers$3
19172
19915
  };
19173
19916
 
19174
- var _require$$0$builders$7 = doc.builders;
19175
- var concat$12 = _require$$0$builders$7.concat;
19176
- var hardline$11 = _require$$0$builders$7.hardline;
19917
+ var _require$$0$builders$8 = doc.builders;
19918
+ var concat$13 = _require$$0$builders$8.concat;
19919
+ var hardline$12 = _require$$0$builders$8.hardline;
19177
19920
 
19178
- function embed$4(path, print, textToDoc, options) {
19921
+ function embed$6(path, print, textToDoc, options) {
19179
19922
  var node = path.getValue();
19180
19923
  var parent = path.getParentNode();
19181
19924
 
@@ -19215,16 +19958,30 @@ function embed$4(path, print, textToDoc, options) {
19215
19958
  return null;
19216
19959
  }
19217
19960
 
19218
- return concat$12([options.originalText.slice(node.start, node.contentStart), hardline$11, textToDoc(options.originalText.slice(node.contentStart, node.contentEnd), {
19961
+ return concat$13([options.originalText.slice(node.start, node.contentStart), hardline$12, textToDoc(options.originalText.slice(node.contentStart, node.contentEnd), {
19219
19962
  parser: parser
19220
19963
  }), options.originalText.slice(node.contentEnd, node.end)]);
19221
19964
  }
19222
19965
 
19223
- var embed_1$4 = embed$4;
19966
+ var embed_1$6 = embed$6;
19224
19967
 
19225
- var _require$$0$builders$6 = doc.builders;
19226
- var concat$11 = _require$$0$builders$6.concat;
19227
- var hardline$10 = _require$$0$builders$6.hardline;
19968
+ function hasPragma$3(text) {
19969
+ return /^\s*<!--\s*@(format|prettier)\s*-->/.test(text);
19970
+ }
19971
+
19972
+ function insertPragma$7(text) {
19973
+ return "<!-- @format -->\n\n" + text.replace(/^\s*\n/, "");
19974
+ }
19975
+
19976
+ var pragma$9 = {
19977
+ hasPragma: hasPragma$3,
19978
+ insertPragma: insertPragma$7
19979
+ };
19980
+
19981
+ var _require$$0$builders$7 = doc.builders;
19982
+ var concat$12 = _require$$0$builders$7.concat;
19983
+ var hardline$11 = _require$$0$builders$7.hardline;
19984
+ var insertPragma$6 = pragma$9.insertPragma;
19228
19985
 
19229
19986
  function genericPrint$6(path, options, print) {
19230
19987
  var n = path.getValue();
@@ -19242,10 +19999,10 @@ function genericPrint$6(path, options, print) {
19242
19999
  res.push(options.originalText.slice(index, n.end)); // Only force a trailing newline if there were any contents.
19243
20000
 
19244
20001
  if (n.tag === "root" && n.children.length) {
19245
- res.push(hardline$10);
20002
+ res.push(hardline$11);
19246
20003
  }
19247
20004
 
19248
- return concat$11(res);
20005
+ return concat$12(res);
19249
20006
  }
19250
20007
 
19251
20008
  var clean$7 = function clean(ast, newObj) {
@@ -19257,26 +20014,49 @@ var clean$7 = function clean(ast, newObj) {
19257
20014
 
19258
20015
  var printerVue = {
19259
20016
  print: genericPrint$6,
19260
- embed: embed_1$4,
19261
- massageAstNode: clean$7
20017
+ embed: embed_1$6,
20018
+ insertPragma: insertPragma$6,
20019
+ massageAstNode: clean$7,
20020
+ canAttachComment: function canAttachComment(node) {
20021
+ return typeof node.tag === "string";
20022
+ }
20023
+ };
20024
+
20025
+ var name$13 = "Vue";
20026
+ var type$12 = "markup";
20027
+ var color$3 = "#2c3e50";
20028
+ var extensions$12 = [".vue"];
20029
+ var tmScope$12 = "text.html.vue";
20030
+ var aceMode$12 = "html";
20031
+ var languageId$12 = 391;
20032
+ var vue = {
20033
+ name: name$13,
20034
+ type: type$12,
20035
+ color: color$3,
20036
+ extensions: extensions$12,
20037
+ tmScope: tmScope$12,
20038
+ aceMode: aceMode$12,
20039
+ languageId: languageId$12
19262
20040
  };
19263
20041
 
19264
- // https://github.com/github/linguist/blob/master/lib/linguist/languages.yml
20042
+ var vue$1 = Object.freeze({
20043
+ name: name$13,
20044
+ type: type$12,
20045
+ color: color$3,
20046
+ extensions: extensions$12,
20047
+ tmScope: tmScope$12,
20048
+ aceMode: aceMode$12,
20049
+ languageId: languageId$12,
20050
+ default: vue
20051
+ });
19265
20052
 
20053
+ var require$$0$15 = ( vue$1 && vue ) || vue$1;
19266
20054
 
19267
- var languages$4 = [{
19268
- name: "Vue",
20055
+ var languages$4 = [languageExtend({}, require$$0$15, {
19269
20056
  since: "1.10.0",
19270
20057
  parsers: ["vue"],
19271
- group: "HTML",
19272
- tmScope: "text.html.vue",
19273
- aceMode: "html",
19274
- codemirrorMode: "htmlmixed",
19275
- codemirrorMimeType: "text/html",
19276
- extensions: [".vue"],
19277
- linguistLanguageId: 146,
19278
20058
  vscodeLanguageIds: ["vue"]
19279
- }];
20059
+ })];
19280
20060
  var printers$4 = {
19281
20061
  vue: printerVue
19282
20062
  };
@@ -19285,9 +20065,677 @@ var languageVue = {
19285
20065
  printers: printers$4
19286
20066
  };
19287
20067
 
20068
+ function isPragma$1(text) {
20069
+ return /^\s*@(prettier|format)\s*$/.test(text);
20070
+ }
20071
+
20072
+ function hasPragma$4(text) {
20073
+ return /^\s*#[^\n\S]*@(prettier|format)\s*?(\n|$)/.test(text);
20074
+ }
20075
+
20076
+ function insertPragma$9(text) {
20077
+ return "# @format\n\n".concat(text);
20078
+ }
20079
+
20080
+ var pragma$11 = {
20081
+ isPragma: isPragma$1,
20082
+ hasPragma: hasPragma$4,
20083
+ insertPragma: insertPragma$9
20084
+ };
20085
+
20086
+ function getLast$6(array) {
20087
+ return array[array.length - 1];
20088
+ }
20089
+
20090
+ function getAncestorCount$1(path, filter) {
20091
+ var counter = 0;
20092
+ var pathStackLength = path.stack.length - 1;
20093
+
20094
+ for (var i = 0; i < pathStackLength; i++) {
20095
+ var value = path.stack[i];
20096
+
20097
+ if (isNode$1(value) && filter(value)) {
20098
+ counter++;
20099
+ }
20100
+ }
20101
+
20102
+ return counter;
20103
+ }
20104
+
20105
+ function isNode$1(value) {
20106
+ return value && typeof value.type === "string";
20107
+ }
20108
+
20109
+ function mapNode(node, callback, parent) {
20110
+ return callback("children" in node ? Object.assign({}, node, {
20111
+ children: node.children.map(function (childNode) {
20112
+ return mapNode(childNode, callback, node);
20113
+ })
20114
+ }) : node, parent);
20115
+ }
20116
+
20117
+ function defineShortcut(x, key, getter) {
20118
+ Object.defineProperty(x, key, {
20119
+ get: getter,
20120
+ enumerable: false
20121
+ });
20122
+ }
20123
+
20124
+ function createNull() {
20125
+ return {
20126
+ type: "null",
20127
+ position: {
20128
+ start: {
20129
+ line: -1,
20130
+ column: -1,
20131
+ offset: -1
20132
+ },
20133
+ end: {
20134
+ line: -1,
20135
+ column: -1,
20136
+ offset: -1
20137
+ }
20138
+ }
20139
+ };
20140
+ }
20141
+
20142
+ function isNextLineEmpty$6(node, text) {
20143
+ var newlineCount = 0;
20144
+ var textLength = text.length;
20145
+
20146
+ for (var i = node.position.end.offset - 1; i < textLength; i++) {
20147
+ var char = text[i];
20148
+
20149
+ if (char === "\n") {
20150
+ newlineCount++;
20151
+ }
20152
+
20153
+ if (newlineCount === 1 && /\S/.test(char)) {
20154
+ return false;
20155
+ }
20156
+
20157
+ if (newlineCount === 2) {
20158
+ return true;
20159
+ }
20160
+ }
20161
+
20162
+ return false;
20163
+ }
20164
+
20165
+ function isLastDescendantNode$1(path) {
20166
+ var node = path.getValue();
20167
+
20168
+ switch (node.type) {
20169
+ case "comment":
20170
+ case "verbatimTag":
20171
+ case "shorthandTag":
20172
+ case "nonSpecificTag":
20173
+ return false;
20174
+ }
20175
+
20176
+ var pathStackLength = path.stack.length;
20177
+
20178
+ for (var i = 1; i < pathStackLength; i++) {
20179
+ var item = path.stack[i];
20180
+ var parentItem = path.stack[i - 1];
20181
+
20182
+ if (Array.isArray(parentItem) && typeof item === "number" && item !== parentItem.length - 1) {
20183
+ return false;
20184
+ }
20185
+ }
20186
+
20187
+ return true;
20188
+ }
20189
+
20190
+ function getLastDescendantNode$1(node) {
20191
+ return "children" in node && node.children.length !== 0 ? getLastDescendantNode$1(getLast$6(node.children)) : node;
20192
+ }
20193
+
20194
+ function isPrettierIgnore$1(comment) {
20195
+ return comment.value.trim() === "prettier-ignore";
20196
+ }
20197
+
20198
+ function hasPrettierIgnore$3(path) {
20199
+ var node = path.getValue();
20200
+
20201
+ if (node.type === "documentBody") {
20202
+ var document = path.getParentNode();
20203
+ return document.head.children.length !== 0 && function (lastItem) {
20204
+ return lastItem.type === "comment" && isPrettierIgnore$1(lastItem);
20205
+ }(getLast$6(document.head.children));
20206
+ }
20207
+
20208
+ return "leadingComments" in node && node.leadingComments.length !== 0 && isPrettierIgnore$1(getLast$6(node.leadingComments));
20209
+ }
20210
+
20211
+ function hasExplicitDocumentEndMarker$1(document, text) {
20212
+ return text.slice(document.position.end.offset - 4, document.position.end.offset) === "\n...";
20213
+ }
20214
+
20215
+ function isBlockValue$1(node) {
20216
+ switch (node.type) {
20217
+ case "blockFolded":
20218
+ case "blockLiteral":
20219
+ return true;
20220
+
20221
+ default:
20222
+ return false;
20223
+ }
20224
+ }
20225
+
20226
+ function hasLeadingComments$1(node) {
20227
+ return "leadingComments" in node && node.leadingComments.length !== 0;
20228
+ }
20229
+
20230
+ function hasMiddleComments$1(node) {
20231
+ return "middleComments" in node && node.middleComments.length !== 0;
20232
+ }
20233
+
20234
+ function hasTrailingComments$1(node) {
20235
+ return "trailingComments" in node && node.trailingComments.length !== 0;
20236
+ }
20237
+
20238
+ function hasEndComments$1(node) {
20239
+ return "endComments" in node && node.endComments.length !== 0;
20240
+ }
20241
+ /**
20242
+ * " a b c d e f " -> [" a b", "c d", "e f "]
20243
+ */
20244
+
20245
+
20246
+ function splitWithSingleSpace(text) {
20247
+ var parts = [];
20248
+ var lastPart = undefined;
20249
+ var _iteratorNormalCompletion = true;
20250
+ var _didIteratorError = false;
20251
+ var _iteratorError = undefined;
20252
+
20253
+ try {
20254
+ for (var _iterator = text.split(/( +)/g)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
20255
+ var part = _step.value;
20256
+
20257
+ if (part !== " ") {
20258
+ if (lastPart === " ") {
20259
+ parts.push(part);
20260
+ } else {
20261
+ parts.push((parts.pop() || "") + part);
20262
+ }
20263
+ } else if (lastPart === undefined) {
20264
+ parts.unshift("");
20265
+ }
20266
+
20267
+ lastPart = part;
20268
+ }
20269
+ } catch (err) {
20270
+ _didIteratorError = true;
20271
+ _iteratorError = err;
20272
+ } finally {
20273
+ try {
20274
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
20275
+ _iterator.return();
20276
+ }
20277
+ } finally {
20278
+ if (_didIteratorError) {
20279
+ throw _iteratorError;
20280
+ }
20281
+ }
20282
+ }
20283
+
20284
+ if (lastPart === " ") {
20285
+ parts.push((parts.pop() || "") + " ");
20286
+ }
20287
+
20288
+ if (parts[0] === "") {
20289
+ parts.shift();
20290
+ parts.unshift(" " + (parts.shift() || ""));
20291
+ }
20292
+
20293
+ return parts;
20294
+ }
20295
+
20296
+ function getFlowScalarLineContents$1(nodeType, content, options) {
20297
+ var rawLineContents = content.split("\n").map(function (lineContent, index, lineContents) {
20298
+ return index === 0 && index === lineContents.length - 1 ? lineContent : index !== 0 && index !== lineContents.length - 1 ? lineContent.trim() : index === 0 ? lineContent.trimRight() : lineContent.trimLeft();
20299
+ });
20300
+
20301
+ if (options.proseWrap === "preserve") {
20302
+ return rawLineContents.map(function (lineContent) {
20303
+ return lineContent.length === 0 ? [] : [lineContent];
20304
+ });
20305
+ }
20306
+
20307
+ return rawLineContents.map(function (lineContent) {
20308
+ return lineContent.length === 0 ? [] : splitWithSingleSpace(lineContent);
20309
+ }).reduce(function (reduced, lineContentWords, index) {
20310
+ return index !== 0 && rawLineContents[index - 1].length !== 0 && lineContentWords.length !== 0 && !( // trailing backslash in quoteDouble should be preserved
20311
+ nodeType === "quoteDouble" && getLast$6(getLast$6(reduced)).endsWith("\\")) ? reduced.concat([reduced.pop().concat(lineContentWords)]) : reduced.concat([lineContentWords]);
20312
+ }, []).map(function (lineContentWords) {
20313
+ return options.proseWrap === "never" ? [lineContentWords.join(" ")] : lineContentWords;
20314
+ });
20315
+ }
20316
+
20317
+ function getBlockValueLineContents$1(node, _ref) {
20318
+ var parentIndent = _ref.parentIndent,
20319
+ isLastDescendant = _ref.isLastDescendant,
20320
+ options = _ref.options;
20321
+ var content = node.position.start.line === node.position.end.line ? "" : options.originalText.slice(node.position.start.offset, node.position.end.offset) // exclude open line `>` or `|`
20322
+ .match(/^[^\n]*?\n([\s\S]*)$/)[1];
20323
+ var leadingSpaceCount = node.indent === null ? function (match) {
20324
+ return match ? match[1].length : Infinity;
20325
+ }(content.match(/^( *)\S/m)) : node.indent - 1 + parentIndent;
20326
+ var rawLineContents = content.split("\n").map(function (lineContent) {
20327
+ return lineContent.slice(leadingSpaceCount);
20328
+ });
20329
+
20330
+ if (options.proseWrap === "preserve" || node.type === "blockLiteral") {
20331
+ return removeUnnecessaryTrailingNewlines(rawLineContents.map(function (lineContent) {
20332
+ return lineContent.length === 0 ? [] : [lineContent];
20333
+ }));
20334
+ }
20335
+
20336
+ return removeUnnecessaryTrailingNewlines(rawLineContents.map(function (lineContent) {
20337
+ return lineContent.length === 0 ? [] : splitWithSingleSpace(lineContent);
20338
+ }).reduce(function (reduced, lineContentWords, index) {
20339
+ return index !== 0 && rawLineContents[index - 1].length !== 0 && lineContentWords.length !== 0 && !/^\s/.test(lineContentWords[0]) && !/^\s|\s$/.test(getLast$6(reduced)) ? reduced.concat([reduced.pop().concat(lineContentWords)]) : reduced.concat([lineContentWords]);
20340
+ }, []).map(function (lineContentWords) {
20341
+ return lineContentWords.reduce(function (reduced, word) {
20342
+ return (// disallow trailing spaces
20343
+ reduced.length !== 0 && /\s$/.test(getLast$6(reduced)) ? reduced.concat(reduced.pop() + " " + word) : reduced.concat(word)
20344
+ );
20345
+ }, []);
20346
+ }).map(function (lineContentWords) {
20347
+ return options.proseWrap === "never" ? [lineContentWords.join(" ")] : lineContentWords;
20348
+ }));
20349
+
20350
+ function removeUnnecessaryTrailingNewlines(lineContents) {
20351
+ if (node.chomping === "keep") {
20352
+ return getLast$6(lineContents).length === 0 ? lineContents.slice(0, -1) : lineContents;
20353
+ }
20354
+
20355
+ var trailingNewlineCount = 0;
20356
+
20357
+ for (var i = lineContents.length - 1; i >= 0; i--) {
20358
+ if (lineContents[i].length === 0) {
20359
+ trailingNewlineCount++;
20360
+ } else {
20361
+ break;
20362
+ }
20363
+ }
20364
+
20365
+ return trailingNewlineCount === 0 ? lineContents : trailingNewlineCount >= 2 && !isLastDescendant ? // next empty line
20366
+ lineContents.slice(0, -(trailingNewlineCount - 1)) : lineContents.slice(0, -trailingNewlineCount);
20367
+ }
20368
+ }
20369
+
20370
+ var utils$8 = {
20371
+ getLast: getLast$6,
20372
+ getAncestorCount: getAncestorCount$1,
20373
+ isNode: isNode$1,
20374
+ isBlockValue: isBlockValue$1,
20375
+ mapNode: mapNode,
20376
+ defineShortcut: defineShortcut,
20377
+ createNull: createNull,
20378
+ isNextLineEmpty: isNextLineEmpty$6,
20379
+ isLastDescendantNode: isLastDescendantNode$1,
20380
+ getBlockValueLineContents: getBlockValueLineContents$1,
20381
+ getFlowScalarLineContents: getFlowScalarLineContents$1,
20382
+ getLastDescendantNode: getLastDescendantNode$1,
20383
+ hasPrettierIgnore: hasPrettierIgnore$3,
20384
+ hasLeadingComments: hasLeadingComments$1,
20385
+ hasMiddleComments: hasMiddleComments$1,
20386
+ hasTrailingComments: hasTrailingComments$1,
20387
+ hasEndComments: hasEndComments$1,
20388
+ hasExplicitDocumentEndMarker: hasExplicitDocumentEndMarker$1
20389
+ };
20390
+
20391
+ var insertPragma$8 = pragma$11.insertPragma;
20392
+ var isPragma = pragma$11.isPragma;
20393
+ var getAncestorCount = utils$8.getAncestorCount;
20394
+ var getBlockValueLineContents = utils$8.getBlockValueLineContents;
20395
+ var getFlowScalarLineContents = utils$8.getFlowScalarLineContents;
20396
+ var getLast$5 = utils$8.getLast;
20397
+ var getLastDescendantNode = utils$8.getLastDescendantNode;
20398
+ var hasExplicitDocumentEndMarker = utils$8.hasExplicitDocumentEndMarker;
20399
+ var hasLeadingComments = utils$8.hasLeadingComments;
20400
+ var hasMiddleComments = utils$8.hasMiddleComments;
20401
+ var hasTrailingComments = utils$8.hasTrailingComments;
20402
+ var hasEndComments = utils$8.hasEndComments;
20403
+ var hasPrettierIgnore$2 = utils$8.hasPrettierIgnore;
20404
+ var isLastDescendantNode = utils$8.isLastDescendantNode;
20405
+ var isNextLineEmpty$5 = utils$8.isNextLineEmpty;
20406
+ var isNode = utils$8.isNode;
20407
+ var isBlockValue = utils$8.isBlockValue;
20408
+ var docBuilders$3 = doc.builders;
20409
+ var conditionalGroup$2 = docBuilders$3.conditionalGroup;
20410
+ var breakParent$3 = docBuilders$3.breakParent;
20411
+ var concat$14 = docBuilders$3.concat;
20412
+ var dedent$4 = docBuilders$3.dedent;
20413
+ var dedentToRoot$2 = docBuilders$3.dedentToRoot;
20414
+ var fill$5 = docBuilders$3.fill;
20415
+ var group$11 = docBuilders$3.group;
20416
+ var hardline$13 = docBuilders$3.hardline;
20417
+ var ifBreak$4 = docBuilders$3.ifBreak;
20418
+ var join$8 = docBuilders$3.join;
20419
+ var line$7 = docBuilders$3.line;
20420
+ var lineSuffix$2 = docBuilders$3.lineSuffix;
20421
+ var literalline$6 = docBuilders$3.literalline;
20422
+ var markAsRoot$4 = docBuilders$3.markAsRoot;
20423
+ var softline$6 = docBuilders$3.softline;
20424
+
20425
+ function genericPrint$7(path, options, print) {
20426
+ var node = path.getValue();
20427
+ var parentNode = path.getParentNode();
20428
+ var tag = "tag" in node && node.tag.type !== "null" ? path.call(print, "tag") : "";
20429
+ var anchor = "anchor" in node && node.anchor.type !== "null" ? path.call(print, "anchor") : "";
20430
+ var nextEmptyLine = (node.type === "mapping" || node.type === "sequence" || node.type === "comment" || node.type === "directive" || node.type === "mappingItem" || node.type === "sequenceItem") && !isLastDescendantNode(path) ? printNextEmptyLine(path, options.originalText) : "";
20431
+ return concat$14([node.type !== "mappingValue" && hasLeadingComments(node) ? concat$14([join$8(hardline$13, path.map(print, "leadingComments")), hardline$13]) : "", tag, tag && anchor ? " " : "", anchor, (node.type === "sequence" || node.type === "mapping") && node.middleComments.length === 0 ? tag || anchor ? hardline$13 : "" : tag || anchor ? " " : "", hasMiddleComments(node) ? concat$14([node.middleComments.length === 1 ? "" : hardline$13, join$8(hardline$13, path.map(print, "middleComments")), hardline$13]) : "", hasPrettierIgnore$2(path) ? options.originalText.slice(node.position.start.offset, node.position.end.offset) : group$11(_print(node, parentNode, path, options, print)), !isBlockValue(node) && hasTrailingComments(node) // trailing comments for block value are handled themselves
20432
+ ? lineSuffix$2(concat$14([" ", parentNode.type === "mappingKey" && path.getParentNode(2).type === "mapping" && isInlineNode(node) ? "" : breakParent$3, join$8(hardline$13, path.map(print, "trailingComments"))])) : "", nextEmptyLine, hasEndComments(node) ? function (endComments) {
20433
+ return node.type === "sequenceItem" ? align$3(2, endComments) : endComments;
20434
+ }(concat$14([hardline$13, join$8(hardline$13, path.map(print, "endComments"))])) : ""]);
20435
+ }
20436
+
20437
+ function _print(node, parentNode, path, options, print) {
20438
+ switch (node.type) {
20439
+ case "root":
20440
+ return concat$14([concat$14(path.map(function (childPath, index) {
20441
+ return index === node.children.length - 1 ? print(childPath) : concat$14([print(childPath), hasTrailingComments(node.children[index]) || childPath.call(hasPrettierIgnore$2, "body") && hasExplicitDocumentEndMarker(node.children[index], options.originalText) ? "" : concat$14([hardline$13, "..."]), hardline$13]);
20442
+ }, "children")), node.children.length === 0 || function (lastDescendantNode) {
20443
+ return isBlockValue(lastDescendantNode) && lastDescendantNode.chomping === "keep";
20444
+ }(getLastDescendantNode(node)) ? "" : hardline$13]);
20445
+
20446
+ case "document":
20447
+ return concat$14([node.head.children.length === 0 ? path.call(print, "body") : join$8(hardline$13, [path.call(print, "head"), "---"].concat(node.body.children.length === 0 ? [] : path.call(print, "body"))), hasTrailingComments(node) ? concat$14([hardline$13, "..."]) : ""]);
20448
+
20449
+ case "documentHead":
20450
+ case "documentBody":
20451
+ return join$8(hardline$13, path.map(print, "children"));
20452
+
20453
+ case "directive":
20454
+ return concat$14(["%", join$8(" ", [node.name].concat(node.parameters))]);
20455
+
20456
+ case "comment":
20457
+ return concat$14(["#", node.value]);
20458
+
20459
+ case "alias":
20460
+ return concat$14(["*", node.value]);
20461
+
20462
+ case "null":
20463
+ return "";
20464
+
20465
+ case "verbatimTag":
20466
+ return concat$14(["!<", node.value, ">"]);
20467
+
20468
+ case "shorthandTag":
20469
+ return concat$14([node.handle, node.suffix]);
20470
+
20471
+ case "nonSpecificTag":
20472
+ return "!";
20473
+
20474
+ case "anchor":
20475
+ return concat$14(["&", node.value]);
20476
+
20477
+ case "plain":
20478
+ return printFlowScalarContent(node.type, options.originalText.slice(node.position.start.offset, node.position.end.offset), options);
20479
+
20480
+ case "quoteDouble":
20481
+ case "quoteSingle":
20482
+ {
20483
+ var singleQuote = "'";
20484
+ var doubleQuote = '"';
20485
+ var raw = options.originalText.slice(node.position.start.offset + 1, node.position.end.offset - 1);
20486
+
20487
+ if (node.type === "quoteSingle" && raw.includes("\\") || node.type === "quoteDouble" && /\\[^"]/.test(raw)) {
20488
+ // only quoteDouble can use escape chars
20489
+ // and quoteSingle do not need to escape backslashes
20490
+ var originalQuote = node.type === "quoteDouble" ? doubleQuote : singleQuote;
20491
+ return concat$14([originalQuote, printFlowScalarContent(node.type, raw, options), originalQuote]);
20492
+ } else if (raw.includes(doubleQuote)) {
20493
+ return concat$14([singleQuote, printFlowScalarContent(node.type, node.type === "quoteDouble" ? // double quote needs to be escaped by backslash in quoteDouble
20494
+ raw.replace(/\\"/g, doubleQuote) : raw, options), singleQuote]);
20495
+ }
20496
+
20497
+ if (raw.includes(singleQuote)) {
20498
+ return concat$14([doubleQuote, printFlowScalarContent(node.type, node.type === "quoteSingle" ? // single quote needs to be escaped by 2 single quotes in quoteSingle
20499
+ raw.replace(/''/g, singleQuote) : raw, options), doubleQuote]);
20500
+ }
20501
+
20502
+ var quote = options.singleQuote ? singleQuote : doubleQuote;
20503
+ return concat$14([quote, printFlowScalarContent(node.type, raw, options), quote]);
20504
+ }
20505
+
20506
+ case "blockFolded":
20507
+ case "blockLiteral":
20508
+ {
20509
+ var parentIndent = getAncestorCount(path, function (ancestorNode) {
20510
+ return ancestorNode.type === "sequence" || ancestorNode.type === "mapping";
20511
+ });
20512
+ var isLastDescendant = isLastDescendantNode(path);
20513
+ return concat$14([node.type === "blockFolded" ? ">" : "|", node.indent === null ? "" : node.indent.toString(), node.chomping === "clip" ? "" : node.chomping === "keep" ? "+" : "-", hasTrailingComments(node) ? concat$14([" ", join$8(hardline$13, path.map(print, "trailingComments"))]) : "", (node.indent === null ? dedent$4 : dedentToRoot$2)(align$3(node.indent === null ? options.tabWidth : node.indent - 1 + parentIndent, concat$14(getBlockValueLineContents(node, {
20514
+ parentIndent: parentIndent,
20515
+ isLastDescendant: isLastDescendant,
20516
+ options: options
20517
+ }).reduce(function (reduced, lineWords, index, lineContents) {
20518
+ return reduced.concat(index === 0 ? hardline$13 : lineContents[index - 1].length === 0 ? hardline$13 : index === lineContents.length - 1 && lineWords.length === 0 ? dedentToRoot$2(literalline$6) : markAsRoot$4(literalline$6), fill$5(join$8(line$7, lineWords).parts), index === lineContents.length - 1 && node.chomping === "keep" && isLastDescendant ? lineWords.length === 0 || !getLast$5(lineWords).endsWith(" ") ? dedentToRoot$2(hardline$13) : dedentToRoot$2(literalline$6) : []);
20519
+ }, []))))]);
20520
+ }
20521
+
20522
+ case "sequence":
20523
+ return join$8(hardline$13, path.map(print, "children"));
20524
+
20525
+ case "sequenceItem":
20526
+ return concat$14(["- ", align$3(2, path.call(print, "node"))]);
20527
+
20528
+ case "mappingKey":
20529
+ return path.call(print, "node");
20530
+
20531
+ case "mappingValue":
20532
+ return path.call(print, "node");
20533
+
20534
+ case "mapping":
20535
+ return join$8(hardline$13, path.map(print, "children"));
20536
+
20537
+ case "mappingItem":
20538
+ case "flowMappingItem":
20539
+ {
20540
+ if (node.key.type === "null" && node.value.type === "null") {
20541
+ return concat$14([":", line$7]);
20542
+ }
20543
+
20544
+ var key = path.call(print, "key");
20545
+ var value = path.call(print, "value");
20546
+
20547
+ if (node.value.type === "null") {
20548
+ return node.type === "flowMappingItem" && path.getParentNode().type !== "flowSequence" ? key : concat$14(["? ", align$3(2, key)]);
20549
+ }
20550
+
20551
+ if (node.key.type === "null") {
20552
+ return concat$14([":", node.value.node.type === "null" ? "" : " ", align$3(2, value)]);
20553
+ }
20554
+
20555
+ var groupId = Symbol("mappingKey");
20556
+ var forceExplicitKey = hasLeadingComments(node.value) || node.key.type !== "null" && !isInlineNode(node.key.node);
20557
+ return forceExplicitKey ? concat$14(["? ", align$3(2, key), hardline$13, join$8("", path.map(print, "value", "leadingComments").map(function (comment) {
20558
+ return concat$14([comment, hardline$13]);
20559
+ })), ": ", align$3(2, value)]) : conditionalGroup$2([concat$14([group$11(concat$14([ifBreak$4("? "), group$11(align$3(2, key), {
20560
+ id: groupId
20561
+ })])), ifBreak$4(concat$14([hardline$13, ": ", align$3(2, value)]), indent(concat$14([needsSpaceInFrontOfMappingValue(node) ? " " : "", ":", hasLeadingComments(node.value.node) || parentNode.type === "mapping" && hasTrailingComments(node.key.node) && isInlineNode(node.value.node) || (node.value.node.type === "mapping" || node.value.node.type === "sequence") && node.value.node.tag.type === "null" && node.value.node.anchor.type === "null" ? hardline$13 : node.value.node.type === "null" ? "" : line$7, value])), {
20562
+ groupId: groupId
20563
+ })])]);
20564
+ }
20565
+
20566
+ case "flowMapping":
20567
+ case "flowSequence":
20568
+ {
20569
+ var openMarker = node.type === "flowMapping" ? "{" : "[";
20570
+ var closeMarker = node.type === "flowMapping" ? "}" : "]";
20571
+ var bracketSpacing = node.type === "flowMapping" && node.children.length !== 0 && options.bracketSpacing ? line$7 : softline$6;
20572
+
20573
+ var isLastItemEmptyMappingItem = node.children.length !== 0 && function (lastItem) {
20574
+ return lastItem.type === "flowMappingItem" && lastItem.key.type === "null" && lastItem.value.type === "null";
20575
+ }(getLast$5(node.children));
20576
+
20577
+ return concat$14([openMarker, indent(concat$14([bracketSpacing, concat$14(path.map(function (childPath, index) {
20578
+ return concat$14([print(childPath), index === node.children.length - 1 ? "" : concat$14([",", line$7, node.children[index].position.start.line !== node.children[index + 1].position.start.line ? printNextEmptyLine(childPath, options.originalText) : ""])]);
20579
+ }, "children")), ifBreak$4(",", "")])), isLastItemEmptyMappingItem ? "" : bracketSpacing, closeMarker]);
20580
+ }
20581
+
20582
+ case "flowSequenceItem":
20583
+ return path.call(print, "node");
20584
+ // istanbul ignore next
20585
+
20586
+ default:
20587
+ throw new Error("Unexpected node type ".concat(node.type));
20588
+ }
20589
+
20590
+ function indent(doc$$2) {
20591
+ return docBuilders$3.align(" ".repeat(options.tabWidth), doc$$2);
20592
+ }
20593
+ }
20594
+
20595
+ function align$3(n, doc$$2) {
20596
+ return typeof n === "number" && n > 0 ? docBuilders$3.align(" ".repeat(n), doc$$2) : docBuilders$3.align(n, doc$$2);
20597
+ }
20598
+
20599
+ function isInlineNode(node) {
20600
+ switch (node.type) {
20601
+ case "plain":
20602
+ case "quoteDouble":
20603
+ case "quoteSingle":
20604
+ case "alias":
20605
+ case "flowMapping":
20606
+ case "flowSequence":
20607
+ case "null":
20608
+ return true;
20609
+
20610
+ default:
20611
+ return false;
20612
+ }
20613
+ }
20614
+
20615
+ function needsSpaceInFrontOfMappingValue(node) {
20616
+ // istanbul ignore else
20617
+ if (node.key.type !== "null") {
20618
+ switch (node.key.node.type) {
20619
+ case "alias":
20620
+ return true;
20621
+ }
20622
+ }
20623
+
20624
+ return false;
20625
+ }
20626
+
20627
+ function printNextEmptyLine(path, originalText) {
20628
+ var node = path.getValue();
20629
+ var root = path.stack[0];
20630
+ root.isNextEmptyLinePrintedChecklist = root.isNextEmptyLinePrintedChecklist || [];
20631
+
20632
+ if (!root.isNextEmptyLinePrintedChecklist[node.position.end.line]) {
20633
+ if (isNextLineEmpty$5(node, originalText)) {
20634
+ root.isNextEmptyLinePrintedChecklist[node.position.end.line] = true;
20635
+ return softline$6;
20636
+ }
20637
+ }
20638
+
20639
+ return "";
20640
+ }
20641
+
20642
+ function printFlowScalarContent(nodeType, content, options) {
20643
+ var lineContents = getFlowScalarLineContents(nodeType, content, options);
20644
+ return join$8(hardline$13, lineContents.map(function (lineContentWords) {
20645
+ return fill$5(join$8(line$7, lineContentWords).parts);
20646
+ }));
20647
+ }
20648
+
20649
+ function clean$8(node, newNode
20650
+ /*, parent */
20651
+ ) {
20652
+ if (isNode(newNode)) {
20653
+ delete newNode.position;
20654
+
20655
+ switch (newNode.type) {
20656
+ case "comment":
20657
+ // insert pragma
20658
+ if (isPragma(newNode.value)) {
20659
+ return null;
20660
+ }
20661
+
20662
+ break;
20663
+
20664
+ case "quoteDouble":
20665
+ case "quoteSingle":
20666
+ newNode.type = "quote";
20667
+ break;
20668
+ }
20669
+ }
20670
+ }
20671
+
20672
+ var printerYaml = {
20673
+ print: genericPrint$7,
20674
+ massageAstNode: clean$8,
20675
+ insertPragma: insertPragma$8
20676
+ };
20677
+
20678
+ var options$15 = {
20679
+ bracketSpacing: commonOptions.bracketSpacing,
20680
+ singleQuote: commonOptions.singleQuote,
20681
+ proseWrap: commonOptions.proseWrap
20682
+ };
20683
+
20684
+ var name$14 = "YAML";
20685
+ var type$13 = "data";
20686
+ var tmScope$13 = "source.yaml";
20687
+ var aliases$4 = ["yml"];
20688
+ var extensions$13 = [".yml", ".mir", ".reek", ".rviz", ".sublime-syntax", ".syntax", ".yaml", ".yaml-tmlanguage", ".yml.mysql"];
20689
+ var filenames$3 = [".clang-format", ".clang-tidy", ".gemrc", "glide.lock"];
20690
+ var aceMode$13 = "yaml";
20691
+ var codemirrorMode$10 = "yaml";
20692
+ var codemirrorMimeType$10 = "text/x-yaml";
20693
+ var languageId$13 = 407;
20694
+ var yaml = {
20695
+ name: name$14,
20696
+ type: type$13,
20697
+ tmScope: tmScope$13,
20698
+ aliases: aliases$4,
20699
+ extensions: extensions$13,
20700
+ filenames: filenames$3,
20701
+ aceMode: aceMode$13,
20702
+ codemirrorMode: codemirrorMode$10,
20703
+ codemirrorMimeType: codemirrorMimeType$10,
20704
+ languageId: languageId$13
20705
+ };
20706
+
20707
+ var yaml$1 = Object.freeze({
20708
+ name: name$14,
20709
+ type: type$13,
20710
+ tmScope: tmScope$13,
20711
+ aliases: aliases$4,
20712
+ extensions: extensions$13,
20713
+ filenames: filenames$3,
20714
+ aceMode: aceMode$13,
20715
+ codemirrorMode: codemirrorMode$10,
20716
+ codemirrorMimeType: codemirrorMimeType$10,
20717
+ languageId: languageId$13,
20718
+ default: yaml
20719
+ });
20720
+
20721
+ var require$$0$17 = ( yaml$1 && yaml ) || yaml$1;
20722
+
20723
+ var languages$5 = [languageExtend({}, require$$0$17, {
20724
+ since: "1.14.0",
20725
+ parsers: ["yaml"],
20726
+ vscodeLanguageIds: ["yaml"]
20727
+ })];
20728
+ var languageYaml = {
20729
+ languages: languages$5,
20730
+ printers: {
20731
+ yaml: printerYaml
20732
+ },
20733
+ options: options$15
20734
+ };
20735
+
19288
20736
  var version = require$$0.version;
19289
20737
  var getSupportInfo = support.getSupportInfo;
19290
- var internalPlugins = [languageJs, languageCss, languageGraphql, languageMarkdown, languageVue];
20738
+ var internalPlugins = [languageJs, languageCss, languageGraphql, languageMarkdown, languageVue, languageYaml];
19291
20739
 
19292
20740
  var isArray = Array.isArray || function (arr) {
19293
20741
  return Object.prototype.toString.call(arr) === "[object Array]";