prettier 1.13.7 → 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/README.md +3 -2
- package/bin-prettier.js +2544 -1111
- package/index.js +2311 -795
- package/package.json +4 -1
- package/parser-babylon.js +1 -1
- package/parser-flow.js +1 -1
- package/parser-graphql.js +1 -1
- package/parser-markdown.js +1 -1
- package/parser-postcss.js +26130 -23152
- package/parser-typescript.js +1 -1
- package/parser-vue.js +1 -1
- package/parser-yaml.js +1 -0
- package/standalone.js +2185 -761
- package/third-party.js +22 -5
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.
|
|
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.
|
|
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",
|
|
@@ -42,32 +42,38 @@ var dependencies = {
|
|
|
42
42
|
"graphql": "0.13.2",
|
|
43
43
|
"html-tag-names": "1.1.2",
|
|
44
44
|
"ignore": "3.3.7",
|
|
45
|
-
"jest-docblock": "
|
|
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.
|
|
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": "
|
|
63
|
-
"typescript-eslint-parser": "
|
|
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
|
-
"
|
|
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.
|
|
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.
|
|
105
|
+
"snapshot-diff": "0.4.0",
|
|
96
106
|
"strip-ansi": "4.0.0",
|
|
97
107
|
"tempy": "0.2.1",
|
|
98
|
-
"webpack": "
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
6289
|
+
var _arr2 = Object.keys(colorConvert);
|
|
6196
6290
|
|
|
6197
|
-
for (var
|
|
6198
|
-
var key =
|
|
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
|
|
6232
|
-
|
|
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$
|
|
6334
|
+
var os$1 = Object.freeze({
|
|
6335
|
+
default: os
|
|
6336
|
+
});
|
|
6240
6337
|
|
|
6338
|
+
var hasFlag = createCommonjsModule(function (module) {
|
|
6339
|
+
'use strict';
|
|
6241
6340
|
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
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
|
|
6350
|
+
var require$$1$1 = ( os$1 && os ) || os$1;
|
|
6248
6351
|
|
|
6249
|
-
var
|
|
6250
|
-
|
|
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
|
-
|
|
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
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6365
|
+
function translateLevel(level) {
|
|
6366
|
+
if (level === 0) {
|
|
6367
|
+
return false;
|
|
6368
|
+
}
|
|
6258
6369
|
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
};
|
|
6370
|
+
return {
|
|
6371
|
+
level: level,
|
|
6372
|
+
hasBasic: true,
|
|
6373
|
+
has256: level >= 2,
|
|
6374
|
+
has16m: level >= 3
|
|
6265
6375
|
};
|
|
6376
|
+
}
|
|
6266
6377
|
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
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
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6383
|
+
if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) {
|
|
6384
|
+
return 3;
|
|
6385
|
+
}
|
|
6279
6386
|
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6387
|
+
if (hasFlag('color=256')) {
|
|
6388
|
+
return 2;
|
|
6389
|
+
}
|
|
6283
6390
|
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6391
|
+
if (stream && !stream.isTTY && forceColor !== true) {
|
|
6392
|
+
return 0;
|
|
6393
|
+
}
|
|
6287
6394
|
|
|
6288
|
-
|
|
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
|
-
|
|
6297
|
-
|
|
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
|
-
|
|
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
|
-
|
|
6304
|
-
|
|
6305
|
-
return 1;
|
|
6306
|
-
}
|
|
6307
|
-
|
|
6308
|
-
return 0;
|
|
6309
|
-
}
|
|
6410
|
+
return 1;
|
|
6411
|
+
}
|
|
6310
6412
|
|
|
6311
|
-
|
|
6312
|
-
|
|
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
|
-
|
|
6316
|
-
|
|
6420
|
+
return min;
|
|
6421
|
+
}
|
|
6317
6422
|
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
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
|
-
|
|
6323
|
-
|
|
6427
|
+
if (env$1.COLORTERM === 'truecolor') {
|
|
6428
|
+
return 3;
|
|
6429
|
+
}
|
|
6324
6430
|
|
|
6325
|
-
|
|
6326
|
-
|
|
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
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6434
|
+
switch (env$1.TERM_PROGRAM) {
|
|
6435
|
+
case 'iTerm.app':
|
|
6436
|
+
return version >= 3 ? 3 : 2;
|
|
6334
6437
|
|
|
6335
|
-
|
|
6336
|
-
|
|
6438
|
+
case 'Apple_Terminal':
|
|
6439
|
+
return 2;
|
|
6440
|
+
// No default
|
|
6337
6441
|
}
|
|
6442
|
+
}
|
|
6338
6443
|
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6444
|
+
if (/-256(color)?$/i.test(env$1.TERM)) {
|
|
6445
|
+
return 2;
|
|
6446
|
+
}
|
|
6342
6447
|
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6448
|
+
if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env$1.TERM)) {
|
|
6449
|
+
return 1;
|
|
6450
|
+
}
|
|
6346
6451
|
|
|
6347
|
-
|
|
6348
|
-
|
|
6452
|
+
if ('COLORTERM' in env$1) {
|
|
6453
|
+
return 1;
|
|
6454
|
+
}
|
|
6349
6455
|
|
|
6350
|
-
if ('
|
|
6351
|
-
|
|
6456
|
+
if (env$1.TERM === 'dumb') {
|
|
6457
|
+
return min;
|
|
6352
6458
|
}
|
|
6353
6459
|
|
|
6354
|
-
|
|
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 =
|
|
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 =
|
|
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
|
|
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
|
|
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
|
|
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
|
|
6962
|
+
function _interopRequireDefault(obj) {
|
|
6845
6963
|
return obj && obj.__esModule ? obj : {
|
|
6846
6964
|
default: obj
|
|
6847
6965
|
};
|
|
6848
6966
|
}
|
|
6849
6967
|
|
|
6850
|
-
function _interopRequireWildcard
|
|
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
|
-
|
|
6896
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 = " "
|
|
7121
|
-
var gutter = " "
|
|
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 " "
|
|
7262
|
+
return " " + maybeHighlight(defs.gutter, gutter) + line;
|
|
7141
7263
|
}
|
|
7142
7264
|
}).join("\n");
|
|
7143
7265
|
|
|
7144
7266
|
if (opts.message && !hasColumns) {
|
|
7145
|
-
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
|
-
|
|
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
|
|
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: require(path
|
|
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
|
|
7433
|
-
var filename =
|
|
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.
|
|
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
|
-
|
|
7493
|
-
ok: function ok() {},
|
|
7494
|
-
strictEqual: function strictEqual() {}
|
|
7495
|
-
};
|
|
7601
|
+
function assert() {}
|
|
7496
7602
|
|
|
7497
|
-
function
|
|
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
|
|
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
|
-
|
|
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 -=
|
|
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
|
-
|
|
8848
|
-
|
|
8849
|
-
|
|
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
|
-
|
|
8854
|
-
|
|
8855
|
-
|
|
8981
|
+
if (groupMode === MODE_FLAT) {
|
|
8982
|
+
if (doc.flatContents) {
|
|
8983
|
+
cmds.push([ind, mode, doc.flatContents]);
|
|
8984
|
+
}
|
|
8856
8985
|
}
|
|
8857
|
-
}
|
|
8858
8986
|
|
|
8859
|
-
|
|
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 +=
|
|
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
|
-
|
|
9079
|
-
|
|
9080
|
-
|
|
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
|
-
|
|
9085
|
-
|
|
9086
|
-
|
|
9221
|
+
if (groupMode === MODE_FLAT) {
|
|
9222
|
+
if (_doc.flatContents) {
|
|
9223
|
+
cmds.push([ind, mode, _doc.flatContents]);
|
|
9224
|
+
}
|
|
9087
9225
|
}
|
|
9088
|
-
}
|
|
9089
9226
|
|
|
9090
|
-
|
|
9227
|
+
break;
|
|
9228
|
+
}
|
|
9091
9229
|
|
|
9092
9230
|
case "line-suffix":
|
|
9093
9231
|
lineSuffix.push([ind, mode, _doc.contents]);
|
|
@@ -9190,46 +9328,62 @@ var docPrinter = {
|
|
|
9190
9328
|
printDocToString: printDocToString
|
|
9191
9329
|
};
|
|
9192
9330
|
|
|
9331
|
+
var traverseDocOnExitStackMarker = {};
|
|
9332
|
+
|
|
9193
9333
|
function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
|
|
9194
|
-
|
|
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
|
+
|
|
9195
9344
|
var shouldRecurse = true;
|
|
9196
9345
|
|
|
9197
9346
|
if (onEnter) {
|
|
9198
|
-
if (onEnter(
|
|
9347
|
+
if (onEnter(_doc) === false) {
|
|
9199
9348
|
shouldRecurse = false;
|
|
9200
9349
|
}
|
|
9201
9350
|
}
|
|
9202
9351
|
|
|
9352
|
+
if (onExit) {
|
|
9353
|
+
docsStack.push(_doc);
|
|
9354
|
+
docsStack.push(traverseDocOnExitStackMarker);
|
|
9355
|
+
}
|
|
9356
|
+
|
|
9203
9357
|
if (shouldRecurse) {
|
|
9204
|
-
|
|
9205
|
-
|
|
9206
|
-
|
|
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]);
|
|
9207
9365
|
}
|
|
9208
|
-
} else if (
|
|
9209
|
-
if (
|
|
9210
|
-
|
|
9366
|
+
} else if (_doc.type === "if-break") {
|
|
9367
|
+
if (_doc.flatContents) {
|
|
9368
|
+
docsStack.push(_doc.flatContents);
|
|
9211
9369
|
}
|
|
9212
9370
|
|
|
9213
|
-
if (
|
|
9214
|
-
|
|
9371
|
+
if (_doc.breakContents) {
|
|
9372
|
+
docsStack.push(_doc.breakContents);
|
|
9215
9373
|
}
|
|
9216
|
-
} else if (
|
|
9374
|
+
} else if (_doc.type === "group" && _doc.expandedStates) {
|
|
9217
9375
|
if (shouldTraverseConditionalGroups) {
|
|
9218
|
-
|
|
9376
|
+
for (var _ic = _doc.expandedStates.length, _i = _ic - 1; _i >= 0; --_i) {
|
|
9377
|
+
docsStack.push(_doc.expandedStates[_i]);
|
|
9378
|
+
}
|
|
9219
9379
|
} else {
|
|
9220
|
-
|
|
9380
|
+
docsStack.push(_doc.contents);
|
|
9221
9381
|
}
|
|
9222
|
-
} else if (
|
|
9223
|
-
|
|
9382
|
+
} else if (_doc.contents) {
|
|
9383
|
+
docsStack.push(_doc.contents);
|
|
9224
9384
|
}
|
|
9225
9385
|
}
|
|
9226
|
-
|
|
9227
|
-
if (onExit) {
|
|
9228
|
-
onExit(doc);
|
|
9229
|
-
}
|
|
9230
9386
|
}
|
|
9231
|
-
|
|
9232
|
-
traverseDocRec(doc);
|
|
9233
9387
|
}
|
|
9234
9388
|
|
|
9235
9389
|
function mapDoc(doc, cb) {
|
|
@@ -9260,7 +9414,8 @@ function mapDoc(doc, cb) {
|
|
|
9260
9414
|
function findInDoc(doc, fn, defaultValue) {
|
|
9261
9415
|
var result = defaultValue;
|
|
9262
9416
|
var hasStopped = false;
|
|
9263
|
-
|
|
9417
|
+
|
|
9418
|
+
function findInDocOnEnterFn(doc) {
|
|
9264
9419
|
var maybeResult = fn(doc);
|
|
9265
9420
|
|
|
9266
9421
|
if (maybeResult !== undefined) {
|
|
@@ -9271,7 +9426,9 @@ function findInDoc(doc, fn, defaultValue) {
|
|
|
9271
9426
|
if (hasStopped) {
|
|
9272
9427
|
return false;
|
|
9273
9428
|
}
|
|
9274
|
-
}
|
|
9429
|
+
}
|
|
9430
|
+
|
|
9431
|
+
traverseDoc(doc, findInDocOnEnterFn);
|
|
9275
9432
|
return result;
|
|
9276
9433
|
}
|
|
9277
9434
|
|
|
@@ -9279,32 +9436,36 @@ function isEmpty(n) {
|
|
|
9279
9436
|
return typeof n === "string" && n.length === 0;
|
|
9280
9437
|
}
|
|
9281
9438
|
|
|
9282
|
-
function
|
|
9283
|
-
|
|
9284
|
-
|
|
9285
|
-
|
|
9286
|
-
}
|
|
9439
|
+
function isLineNextFn(doc) {
|
|
9440
|
+
if (typeof doc === "string") {
|
|
9441
|
+
return false;
|
|
9442
|
+
}
|
|
9287
9443
|
|
|
9288
|
-
|
|
9289
|
-
|
|
9290
|
-
|
|
9291
|
-
}, false);
|
|
9444
|
+
if (doc.type === "line") {
|
|
9445
|
+
return true;
|
|
9446
|
+
}
|
|
9292
9447
|
}
|
|
9293
9448
|
|
|
9294
|
-
function
|
|
9295
|
-
return findInDoc(doc,
|
|
9296
|
-
|
|
9297
|
-
return true;
|
|
9298
|
-
}
|
|
9449
|
+
function isLineNext(doc) {
|
|
9450
|
+
return findInDoc(doc, isLineNextFn, false);
|
|
9451
|
+
}
|
|
9299
9452
|
|
|
9300
|
-
|
|
9301
|
-
|
|
9302
|
-
|
|
9453
|
+
function willBreakFn(doc) {
|
|
9454
|
+
if (doc.type === "group" && doc.break) {
|
|
9455
|
+
return true;
|
|
9456
|
+
}
|
|
9303
9457
|
|
|
9304
|
-
|
|
9305
|
-
|
|
9306
|
-
|
|
9307
|
-
|
|
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);
|
|
9308
9469
|
}
|
|
9309
9470
|
|
|
9310
9471
|
function breakParentGroup(groupStack) {
|
|
@@ -9321,9 +9482,10 @@ function breakParentGroup(groupStack) {
|
|
|
9321
9482
|
}
|
|
9322
9483
|
|
|
9323
9484
|
function propagateBreaks(doc) {
|
|
9324
|
-
var
|
|
9485
|
+
var alreadyVisitedSet = new Set();
|
|
9325
9486
|
var groupStack = [];
|
|
9326
|
-
|
|
9487
|
+
|
|
9488
|
+
function propagateBreaksOnEnterFn(doc) {
|
|
9327
9489
|
if (doc.type === "break-parent") {
|
|
9328
9490
|
breakParentGroup(groupStack);
|
|
9329
9491
|
}
|
|
@@ -9331,13 +9493,15 @@ function propagateBreaks(doc) {
|
|
|
9331
9493
|
if (doc.type === "group") {
|
|
9332
9494
|
groupStack.push(doc);
|
|
9333
9495
|
|
|
9334
|
-
if (
|
|
9496
|
+
if (alreadyVisitedSet.has(doc)) {
|
|
9335
9497
|
return false;
|
|
9336
9498
|
}
|
|
9337
9499
|
|
|
9338
|
-
|
|
9500
|
+
alreadyVisitedSet.add(doc);
|
|
9339
9501
|
}
|
|
9340
|
-
}
|
|
9502
|
+
}
|
|
9503
|
+
|
|
9504
|
+
function propagateBreaksOnExitFn(doc) {
|
|
9341
9505
|
if (doc.type === "group") {
|
|
9342
9506
|
var group = groupStack.pop();
|
|
9343
9507
|
|
|
@@ -9345,25 +9509,29 @@ function propagateBreaks(doc) {
|
|
|
9345
9509
|
breakParentGroup(groupStack);
|
|
9346
9510
|
}
|
|
9347
9511
|
}
|
|
9348
|
-
}
|
|
9512
|
+
}
|
|
9513
|
+
|
|
9514
|
+
traverseDoc(doc, propagateBreaksOnEnterFn, propagateBreaksOnExitFn,
|
|
9349
9515
|
/* shouldTraverseConditionalGroups */
|
|
9350
9516
|
true);
|
|
9351
9517
|
}
|
|
9352
9518
|
|
|
9353
|
-
function
|
|
9519
|
+
function removeLinesFn(doc) {
|
|
9354
9520
|
// Force this doc into flat mode by statically converting all
|
|
9355
9521
|
// lines into spaces (or soft lines into nothing). Hard lines
|
|
9356
9522
|
// should still output because there's too great of a chance
|
|
9357
9523
|
// of breaking existing assumptions otherwise.
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
}
|
|
9524
|
+
if (doc.type === "line" && !doc.hard) {
|
|
9525
|
+
return doc.soft ? "" : " ";
|
|
9526
|
+
} else if (doc.type === "if-break") {
|
|
9527
|
+
return doc.flatContents || "";
|
|
9528
|
+
}
|
|
9364
9529
|
|
|
9365
|
-
|
|
9366
|
-
|
|
9530
|
+
return doc;
|
|
9531
|
+
}
|
|
9532
|
+
|
|
9533
|
+
function removeLines(doc) {
|
|
9534
|
+
return mapDoc(doc, removeLinesFn);
|
|
9367
9535
|
}
|
|
9368
9536
|
|
|
9369
9537
|
function stripTrailingHardline(doc) {
|
|
@@ -9509,6 +9677,10 @@ function isNextLineEmpty$1(text, node, options) {
|
|
|
9509
9677
|
return util.isNextLineEmpty(text, node, options.locEnd);
|
|
9510
9678
|
}
|
|
9511
9679
|
|
|
9680
|
+
function isPreviousLineEmpty$2(text, node, options) {
|
|
9681
|
+
return util.isPreviousLineEmpty(text, node, options.locStart);
|
|
9682
|
+
}
|
|
9683
|
+
|
|
9512
9684
|
function getNextNonSpaceNonCommentCharacterIndex$1(text, node, options) {
|
|
9513
9685
|
return util.getNextNonSpaceNonCommentCharacterIndex(text, node, options.locEnd);
|
|
9514
9686
|
}
|
|
@@ -9516,6 +9688,7 @@ function getNextNonSpaceNonCommentCharacterIndex$1(text, node, options) {
|
|
|
9516
9688
|
var utilShared = {
|
|
9517
9689
|
isNextLineEmpty: isNextLineEmpty$1,
|
|
9518
9690
|
isNextLineEmptyAfterIndex: util.isNextLineEmptyAfterIndex,
|
|
9691
|
+
isPreviousLineEmpty: isPreviousLineEmpty$2,
|
|
9519
9692
|
getNextNonSpaceNonCommentCharacterIndex: getNextNonSpaceNonCommentCharacterIndex$1,
|
|
9520
9693
|
mapDoc: mapDoc$1,
|
|
9521
9694
|
// TODO: remove in 2.0, we already exposed it in docUtils
|
|
@@ -9525,6 +9698,8 @@ var utilShared = {
|
|
|
9525
9698
|
addTrailingComment: util.addTrailingComment
|
|
9526
9699
|
};
|
|
9527
9700
|
|
|
9701
|
+
var assert$3 = ( assert$2 && assert ) || assert$2;
|
|
9702
|
+
|
|
9528
9703
|
var _require$$0$builders = doc.builders;
|
|
9529
9704
|
var concat = _require$$0$builders.concat;
|
|
9530
9705
|
var hardline = _require$$0$builders.hardline;
|
|
@@ -9546,9 +9721,9 @@ function getSortedChildNodes(node, options, resultArray) {
|
|
|
9546
9721
|
return;
|
|
9547
9722
|
}
|
|
9548
9723
|
|
|
9549
|
-
var printer = options.printer
|
|
9550
|
-
|
|
9551
|
-
|
|
9724
|
+
var printer = options.printer,
|
|
9725
|
+
locStart = options.locStart,
|
|
9726
|
+
locEnd = options.locEnd;
|
|
9552
9727
|
|
|
9553
9728
|
if (resultArray) {
|
|
9554
9729
|
if (node && printer.canAttachComment && printer.canAttachComment(node)) {
|
|
@@ -9603,8 +9778,8 @@ function getSortedChildNodes(node, options, resultArray) {
|
|
|
9603
9778
|
|
|
9604
9779
|
|
|
9605
9780
|
function decorateComment(node, comment, options) {
|
|
9606
|
-
var locStart = options.locStart
|
|
9607
|
-
|
|
9781
|
+
var locStart = options.locStart,
|
|
9782
|
+
locEnd = options.locEnd;
|
|
9608
9783
|
var childNodes = getSortedChildNodes(node, options);
|
|
9609
9784
|
var precedingNode;
|
|
9610
9785
|
var followingNode; // Time to dust off the old binary search robes and wizard hat.
|
|
@@ -9678,8 +9853,8 @@ function attach(comments, ast, text, options) {
|
|
|
9678
9853
|
}
|
|
9679
9854
|
|
|
9680
9855
|
var tiesToBreak = [];
|
|
9681
|
-
var locStart = options.locStart
|
|
9682
|
-
|
|
9856
|
+
var locStart = options.locStart,
|
|
9857
|
+
locEnd = options.locEnd;
|
|
9683
9858
|
comments.forEach(function (comment, i) {
|
|
9684
9859
|
if ((options.parser === "json" || options.parser === "json5") && locStart(comment) - locStart(ast) <= 0) {
|
|
9685
9860
|
addLeadingComment(ast, comment);
|
|
@@ -9687,9 +9862,9 @@ function attach(comments, ast, text, options) {
|
|
|
9687
9862
|
}
|
|
9688
9863
|
|
|
9689
9864
|
decorateComment(ast, comment, options);
|
|
9690
|
-
var precedingNode = comment.precedingNode
|
|
9691
|
-
|
|
9692
|
-
|
|
9865
|
+
var precedingNode = comment.precedingNode,
|
|
9866
|
+
enclosingNode = comment.enclosingNode,
|
|
9867
|
+
followingNode = comment.followingNode;
|
|
9693
9868
|
var pluginHandleOwnLineComment = options.printer.handleComments && options.printer.handleComments.ownLine ? options.printer.handleComments.ownLine : function () {
|
|
9694
9869
|
return false;
|
|
9695
9870
|
};
|
|
@@ -9787,8 +9962,9 @@ function breakTies(tiesToBreak, text, options) {
|
|
|
9787
9962
|
return;
|
|
9788
9963
|
}
|
|
9789
9964
|
|
|
9790
|
-
var
|
|
9791
|
-
|
|
9965
|
+
var _tiesToBreak$ = tiesToBreak[0],
|
|
9966
|
+
precedingNode = _tiesToBreak$.precedingNode,
|
|
9967
|
+
followingNode = _tiesToBreak$.followingNode;
|
|
9792
9968
|
var gapEndPos = options.locStart(followingNode); // Iterate backwards through tiesToBreak, examining the gaps
|
|
9793
9969
|
// between the tied comments. In order to qualify as leading, a
|
|
9794
9970
|
// comment must be separated from followingNode by an unbroken series of
|
|
@@ -9799,8 +9975,8 @@ function breakTies(tiesToBreak, text, options) {
|
|
|
9799
9975
|
|
|
9800
9976
|
for (indexOfFirstLeadingComment = tieCount; indexOfFirstLeadingComment > 0; --indexOfFirstLeadingComment) {
|
|
9801
9977
|
var comment = tiesToBreak[indexOfFirstLeadingComment - 1];
|
|
9802
|
-
assert.strictEqual(comment.precedingNode, precedingNode);
|
|
9803
|
-
assert.strictEqual(comment.followingNode, followingNode);
|
|
9978
|
+
assert$3.strictEqual(comment.precedingNode, precedingNode);
|
|
9979
|
+
assert$3.strictEqual(comment.followingNode, followingNode);
|
|
9804
9980
|
var gap = text.slice(options.locEnd(comment), gapEndPos).trim();
|
|
9805
9981
|
|
|
9806
9982
|
if (gap === "" || /^\(+$/.test(gap)) {
|
|
@@ -9966,8 +10142,8 @@ function printComments(path, print, options, needsSemi) {
|
|
|
9966
10142
|
var trailingParts = [needsSemi ? ";" : "", printed];
|
|
9967
10143
|
path.each(function (commentPath) {
|
|
9968
10144
|
var comment = commentPath.getValue();
|
|
9969
|
-
var leading = comment.leading
|
|
9970
|
-
|
|
10145
|
+
var leading = comment.leading,
|
|
10146
|
+
trailing = comment.trailing;
|
|
9971
10147
|
|
|
9972
10148
|
if (leading) {
|
|
9973
10149
|
var contents = printLeadingComment(commentPath, print, options);
|
|
@@ -9997,7 +10173,7 @@ var comments = {
|
|
|
9997
10173
|
};
|
|
9998
10174
|
|
|
9999
10175
|
function FastPath(value) {
|
|
10000
|
-
assert.ok(this instanceof FastPath);
|
|
10176
|
+
assert$3.ok(this instanceof FastPath);
|
|
10001
10177
|
this.stack = [value];
|
|
10002
10178
|
} // The name of the current property is always the penultimate element of
|
|
10003
10179
|
// this.stack, and always a String.
|
|
@@ -10222,7 +10398,7 @@ function printAstToDoc(ast, options, addAlignmentSize) {
|
|
|
10222
10398
|
}
|
|
10223
10399
|
|
|
10224
10400
|
function genericPrint(path, options, printPath, args) {
|
|
10225
|
-
assert.ok(path instanceof fastPath);
|
|
10401
|
+
assert$3.ok(path instanceof fastPath);
|
|
10226
10402
|
var node = path.getValue();
|
|
10227
10403
|
var printer = options.printer; // Escape hatch
|
|
10228
10404
|
|
|
@@ -10406,6 +10582,9 @@ function isSourceElement(opts, node) {
|
|
|
10406
10582
|
|
|
10407
10583
|
case "graphql":
|
|
10408
10584
|
return graphqlSourceElements.indexOf(node.kind) > -1;
|
|
10585
|
+
|
|
10586
|
+
case "vue":
|
|
10587
|
+
return node.tag !== "root";
|
|
10409
10588
|
}
|
|
10410
10589
|
|
|
10411
10590
|
return false;
|
|
@@ -10439,8 +10618,8 @@ function calculateRange(text, opts, ast) {
|
|
|
10439
10618
|
}
|
|
10440
10619
|
|
|
10441
10620
|
var siblingAncestors = findSiblingAncestors(startNodeAndParents, endNodeAndParents, opts);
|
|
10442
|
-
var startNode = siblingAncestors.startNode
|
|
10443
|
-
|
|
10621
|
+
var startNode = siblingAncestors.startNode,
|
|
10622
|
+
endNode = siblingAncestors.endNode;
|
|
10444
10623
|
var rangeStart = Math.min(opts.locStart(startNode, opts.locStart), opts.locStart(endNode, opts.locStart));
|
|
10445
10624
|
var rangeEnd = Math.max(opts.locEnd(startNode, opts.locEnd), opts.locEnd(endNode, opts.locEnd));
|
|
10446
10625
|
return {
|
|
@@ -10501,7 +10680,7 @@ function attachComments(text, ast, opts) {
|
|
|
10501
10680
|
}
|
|
10502
10681
|
|
|
10503
10682
|
ast.tokens = [];
|
|
10504
|
-
opts.originalText = text.trimRight();
|
|
10683
|
+
opts.originalText = opts.parser === "yaml" ? text : text.trimRight();
|
|
10505
10684
|
return astComments;
|
|
10506
10685
|
}
|
|
10507
10686
|
|
|
@@ -10699,7 +10878,7 @@ function format(text, opts) {
|
|
|
10699
10878
|
var core = {
|
|
10700
10879
|
formatWithCursor: function formatWithCursor(text, opts) {
|
|
10701
10880
|
opts = normalizeOptions(opts);
|
|
10702
|
-
return format(text,
|
|
10881
|
+
return format(text, opts);
|
|
10703
10882
|
},
|
|
10704
10883
|
parse: function parse(text, opts, massage) {
|
|
10705
10884
|
opts = normalizeOptions(opts);
|
|
@@ -11150,7 +11329,12 @@ var embed_1 = embed;
|
|
|
11150
11329
|
function clean(ast, newObj, parent) {
|
|
11151
11330
|
["range", "raw", "comments", "leadingComments", "trailingComments", "extra", "start", "end", "flags"].forEach(function (name) {
|
|
11152
11331
|
delete newObj[name];
|
|
11153
|
-
});
|
|
11332
|
+
});
|
|
11333
|
+
|
|
11334
|
+
if (ast.type === "BigIntLiteral") {
|
|
11335
|
+
newObj.value = newObj.value.toLowerCase();
|
|
11336
|
+
} // We remove extra `;` and add them when needed
|
|
11337
|
+
|
|
11154
11338
|
|
|
11155
11339
|
if (ast.type === "EmptyStatement") {
|
|
11156
11340
|
return null;
|
|
@@ -11298,20 +11482,10 @@ var detectNewline = createCommonjsModule(function (module) {
|
|
|
11298
11482
|
};
|
|
11299
11483
|
});
|
|
11300
11484
|
|
|
11301
|
-
var os$8 = {};
|
|
11302
|
-
|
|
11303
|
-
|
|
11304
|
-
var os$10 = Object.freeze({
|
|
11305
|
-
default: os$8,
|
|
11306
|
-
__moduleExports: os$8
|
|
11307
|
-
});
|
|
11308
|
-
|
|
11309
|
-
var require$$1$4 = ( os$10 && os$8 ) || os$10;
|
|
11310
|
-
|
|
11311
11485
|
var build = createCommonjsModule(function (module, exports) {
|
|
11312
11486
|
'use strict';
|
|
11313
11487
|
|
|
11314
|
-
Object.defineProperty(exports,
|
|
11488
|
+
Object.defineProperty(exports, '__esModule', {
|
|
11315
11489
|
value: true
|
|
11316
11490
|
});
|
|
11317
11491
|
exports.extract = extract;
|
|
@@ -11329,7 +11503,7 @@ var build = createCommonjsModule(function (module, exports) {
|
|
|
11329
11503
|
var _os;
|
|
11330
11504
|
|
|
11331
11505
|
function _load_os() {
|
|
11332
|
-
return _os = require$$1$
|
|
11506
|
+
return _os = require$$1$1;
|
|
11333
11507
|
}
|
|
11334
11508
|
|
|
11335
11509
|
function _interopRequireDefault(obj) {
|
|
@@ -11338,21 +11512,19 @@ var build = createCommonjsModule(function (module, exports) {
|
|
|
11338
11512
|
};
|
|
11339
11513
|
}
|
|
11340
11514
|
/**
|
|
11341
|
-
|
|
11342
|
-
|
|
11343
|
-
|
|
11344
|
-
|
|
11345
|
-
|
|
11346
|
-
|
|
11347
|
-
|
|
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
|
+
*/
|
|
11348
11522
|
|
|
11349
11523
|
|
|
11350
11524
|
var commentEndRe = /\*\/$/;
|
|
11351
11525
|
var commentStartRe = /^\/\*\*/;
|
|
11352
11526
|
var docblockRe = /^\s*(\/\*\*?(.|\r?\n)*?\*\/)/;
|
|
11353
11527
|
var lineCommentRe = /(^|\s+)\/\/([^\r\n]*)/g;
|
|
11354
|
-
var ltrimRe = /^\s*/;
|
|
11355
|
-
var rtrimRe = /\s*$/;
|
|
11356
11528
|
var ltrimNewlineRe = /^(\r?\n)+/;
|
|
11357
11529
|
var multilineRe = /(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *(?![^@\r\n]*\/\/[^]*)([^@\r\n\s][^@\r\n]+?) *\r?\n/g;
|
|
11358
11530
|
var propertyRe = /(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g;
|
|
@@ -11360,7 +11532,7 @@ var build = createCommonjsModule(function (module, exports) {
|
|
|
11360
11532
|
|
|
11361
11533
|
function extract(contents) {
|
|
11362
11534
|
var match = contents.match(docblockRe);
|
|
11363
|
-
return match ? match[0].
|
|
11535
|
+
return match ? match[0].trimLeft() : '';
|
|
11364
11536
|
}
|
|
11365
11537
|
|
|
11366
11538
|
function strip(contents) {
|
|
@@ -11384,9 +11556,9 @@ var build = createCommonjsModule(function (module, exports) {
|
|
|
11384
11556
|
docblock = docblock.replace(multilineRe, "".concat(line, "$1 $2").concat(line));
|
|
11385
11557
|
}
|
|
11386
11558
|
|
|
11387
|
-
docblock = docblock.replace(ltrimNewlineRe, '').
|
|
11559
|
+
docblock = docblock.replace(ltrimNewlineRe, '').trimRight();
|
|
11388
11560
|
var result = Object.create(null);
|
|
11389
|
-
var comments = docblock.replace(propertyRe, '').replace(ltrimNewlineRe, '').
|
|
11561
|
+
var comments = docblock.replace(propertyRe, '').replace(ltrimNewlineRe, '').trimRight();
|
|
11390
11562
|
var match;
|
|
11391
11563
|
|
|
11392
11564
|
while (match = propertyRe.exec(docblock)) {
|
|
@@ -11481,9 +11653,9 @@ var addTrailingComment$2 = utilShared.addTrailingComment;
|
|
|
11481
11653
|
var addDanglingComment$2 = utilShared.addDanglingComment;
|
|
11482
11654
|
|
|
11483
11655
|
function handleOwnLineComment(comment, text, options, ast, isLastComment) {
|
|
11484
|
-
var precedingNode = comment.precedingNode
|
|
11485
|
-
|
|
11486
|
-
|
|
11656
|
+
var precedingNode = comment.precedingNode,
|
|
11657
|
+
enclosingNode = comment.enclosingNode,
|
|
11658
|
+
followingNode = comment.followingNode;
|
|
11487
11659
|
|
|
11488
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)) {
|
|
11489
11661
|
return true;
|
|
@@ -11493,9 +11665,9 @@ function handleOwnLineComment(comment, text, options, ast, isLastComment) {
|
|
|
11493
11665
|
}
|
|
11494
11666
|
|
|
11495
11667
|
function handleEndOfLineComment(comment, text, options, ast, isLastComment) {
|
|
11496
|
-
var precedingNode = comment.precedingNode
|
|
11497
|
-
|
|
11498
|
-
|
|
11668
|
+
var precedingNode = comment.precedingNode,
|
|
11669
|
+
enclosingNode = comment.enclosingNode,
|
|
11670
|
+
followingNode = comment.followingNode;
|
|
11499
11671
|
|
|
11500
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)) {
|
|
11501
11673
|
return true;
|
|
@@ -11505,9 +11677,9 @@ function handleEndOfLineComment(comment, text, options, ast, isLastComment) {
|
|
|
11505
11677
|
}
|
|
11506
11678
|
|
|
11507
11679
|
function handleRemainingComment(comment, text, options, ast, isLastComment) {
|
|
11508
|
-
var precedingNode = comment.precedingNode
|
|
11509
|
-
|
|
11510
|
-
|
|
11680
|
+
var precedingNode = comment.precedingNode,
|
|
11681
|
+
enclosingNode = comment.enclosingNode,
|
|
11682
|
+
followingNode = comment.followingNode;
|
|
11511
11683
|
|
|
11512
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)) {
|
|
11513
11685
|
return true;
|
|
@@ -12082,7 +12254,6 @@ function needsParens(path, options) {
|
|
|
12082
12254
|
case "UnaryExpression":
|
|
12083
12255
|
case "SpreadElement":
|
|
12084
12256
|
case "SpreadProperty":
|
|
12085
|
-
case "ExperimentalSpreadProperty":
|
|
12086
12257
|
case "BindExpression":
|
|
12087
12258
|
case "AwaitExpression":
|
|
12088
12259
|
case "TSAsExpression":
|
|
@@ -12120,7 +12291,7 @@ function needsParens(path, options) {
|
|
|
12120
12291
|
}
|
|
12121
12292
|
|
|
12122
12293
|
if (pp === np && name === "right") {
|
|
12123
|
-
assert.strictEqual(parent.right, node);
|
|
12294
|
+
assert$3.strictEqual(parent.right, node);
|
|
12124
12295
|
return true;
|
|
12125
12296
|
}
|
|
12126
12297
|
|
|
@@ -12202,9 +12373,9 @@ function needsParens(path, options) {
|
|
|
12202
12373
|
case "LogicalExpression":
|
|
12203
12374
|
case "SpreadElement":
|
|
12204
12375
|
case "SpreadProperty":
|
|
12205
|
-
case "ExperimentalSpreadProperty":
|
|
12206
12376
|
case "TSAsExpression":
|
|
12207
12377
|
case "TSNonNullExpression":
|
|
12378
|
+
case "BindExpression":
|
|
12208
12379
|
return true;
|
|
12209
12380
|
|
|
12210
12381
|
case "MemberExpression":
|
|
@@ -12285,7 +12456,6 @@ function needsParens(path, options) {
|
|
|
12285
12456
|
case "UnaryExpression":
|
|
12286
12457
|
case "SpreadElement":
|
|
12287
12458
|
case "SpreadProperty":
|
|
12288
|
-
case "ExperimentalSpreadProperty":
|
|
12289
12459
|
case "BinaryExpression":
|
|
12290
12460
|
case "LogicalExpression":
|
|
12291
12461
|
case "ExportDefaultDeclaration":
|
|
@@ -12379,7 +12549,7 @@ var getNextNonSpaceNonCommentCharacter$1 = util.getNextNonSpaceNonCommentCharact
|
|
|
12379
12549
|
var hasNewline$2 = util.hasNewline;
|
|
12380
12550
|
var hasNewlineInRange$1 = util.hasNewlineInRange;
|
|
12381
12551
|
var getLast$4 = util.getLast;
|
|
12382
|
-
var getStringWidth$
|
|
12552
|
+
var getStringWidth$2 = util.getStringWidth;
|
|
12383
12553
|
var printString$1 = util.printString;
|
|
12384
12554
|
var printNumber$1 = util.printNumber;
|
|
12385
12555
|
var hasIgnoreComment$1 = util.hasIgnoreComment;
|
|
@@ -12388,6 +12558,8 @@ var hasNodeIgnoreComment$1 = util.hasNodeIgnoreComment;
|
|
|
12388
12558
|
var getPenultimate$1 = util.getPenultimate;
|
|
12389
12559
|
var startsWithNoLookaheadToken$1 = util.startsWithNoLookaheadToken;
|
|
12390
12560
|
var getIndentSize$1 = util.getIndentSize;
|
|
12561
|
+
var matchAncestorTypes$1 = util.matchAncestorTypes;
|
|
12562
|
+
var isWithinParentArrayProperty$1 = util.isWithinParentArrayProperty;
|
|
12391
12563
|
var isNextLineEmpty$2 = utilShared.isNextLineEmpty;
|
|
12392
12564
|
var isNextLineEmptyAfterIndex$1 = utilShared.isNextLineEmptyAfterIndex;
|
|
12393
12565
|
var getNextNonSpaceNonCommentCharacterIndex$2 = utilShared.getNextNonSpaceNonCommentCharacterIndex;
|
|
@@ -12455,7 +12627,7 @@ function genericPrint$1(path, options, printPath, args) {
|
|
|
12455
12627
|
if (node.decorators && node.decorators.length > 0 && // If the parent node is an export declaration, it will be
|
|
12456
12628
|
// responsible for printing node.decorators.
|
|
12457
12629
|
!getParentExportDeclaration$1(path)) {
|
|
12458
|
-
var separator = hardline$3;
|
|
12630
|
+
var separator = node.decorators.length === 1 && isWithinParentArrayProperty$1(path, "params") ? line$3 : hardline$3;
|
|
12459
12631
|
path.each(function (decoratorPath) {
|
|
12460
12632
|
var decorator = decoratorPath.getValue();
|
|
12461
12633
|
|
|
@@ -12465,10 +12637,6 @@ function genericPrint$1(path, options, printPath, args) {
|
|
|
12465
12637
|
decorator = decorator.callee;
|
|
12466
12638
|
}
|
|
12467
12639
|
|
|
12468
|
-
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")))) {
|
|
12469
|
-
separator = line$3;
|
|
12470
|
-
}
|
|
12471
|
-
|
|
12472
12640
|
decorators.push(printPath(decoratorPath), separator);
|
|
12473
12641
|
}, "decorators");
|
|
12474
12642
|
} else if (isExportDeclaration$1(node) && node.declaration && node.declaration.decorators) {
|
|
@@ -12807,8 +12975,6 @@ function printPathNoParens(path, options, print, args) {
|
|
|
12807
12975
|
case "SpreadElement":
|
|
12808
12976
|
case "SpreadElementPattern":
|
|
12809
12977
|
case "RestProperty":
|
|
12810
|
-
case "ExperimentalRestProperty":
|
|
12811
|
-
case "ExperimentalSpreadProperty":
|
|
12812
12978
|
case "SpreadProperty":
|
|
12813
12979
|
case "SpreadPropertyPattern":
|
|
12814
12980
|
case "RestElement":
|
|
@@ -13198,7 +13364,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
13198
13364
|
return result;
|
|
13199
13365
|
});
|
|
13200
13366
|
var lastElem = getLast$4(n[propertiesField]);
|
|
13201
|
-
var canHaveTrailingSeparator = !(lastElem && (lastElem.type === "RestProperty" || lastElem.type === "RestElement" ||
|
|
13367
|
+
var canHaveTrailingSeparator = !(lastElem && (lastElem.type === "RestProperty" || lastElem.type === "RestElement" || hasNodeIgnoreComment$1(lastElem)));
|
|
13202
13368
|
var content;
|
|
13203
13369
|
|
|
13204
13370
|
if (props.length === 0 && !n.typeAnnotation) {
|
|
@@ -13336,6 +13502,9 @@ function printPathNoParens(path, options, print, args) {
|
|
|
13336
13502
|
// Babel 6 Literal split
|
|
13337
13503
|
return printNumber$1(n.extra.raw);
|
|
13338
13504
|
|
|
13505
|
+
case "BigIntLiteral":
|
|
13506
|
+
return concat$4([printNumber$1(n.extra.rawValue), "n"]);
|
|
13507
|
+
|
|
13339
13508
|
case "BooleanLiteral": // Babel 6 Literal split
|
|
13340
13509
|
|
|
13341
13510
|
case "StringLiteral": // Babel 6 Literal split
|
|
@@ -13775,6 +13944,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
13775
13944
|
parts.push(printPropertyKey(path, options, print));
|
|
13776
13945
|
}
|
|
13777
13946
|
|
|
13947
|
+
parts.push(printOptionalToken(path));
|
|
13778
13948
|
parts.push(printTypeAnnotation(path, options, print));
|
|
13779
13949
|
|
|
13780
13950
|
if (n.value) {
|
|
@@ -13880,12 +14050,12 @@ function printPathNoParens(path, options, print, args) {
|
|
|
13880
14050
|
return !row.hasLineBreak;
|
|
13881
14051
|
}).forEach(function (row) {
|
|
13882
14052
|
row.cells.forEach(function (cell, index) {
|
|
13883
|
-
maxColumnWidths[index] = Math.max(maxColumnWidths[index], getStringWidth$
|
|
14053
|
+
maxColumnWidths[index] = Math.max(maxColumnWidths[index], getStringWidth$2(cell));
|
|
13884
14054
|
});
|
|
13885
14055
|
});
|
|
13886
14056
|
parts.push("`", indent$2(concat$4([hardline$3, join$2(hardline$3, table.map(function (row) {
|
|
13887
14057
|
return join$2(" | ", row.cells.map(function (cell, index) {
|
|
13888
|
-
return row.hasLineBreak ? cell : cell + " ".repeat(maxColumnWidths[index] - getStringWidth$
|
|
14058
|
+
return row.hasLineBreak ? cell : cell + " ".repeat(maxColumnWidths[index] - getStringWidth$2(cell));
|
|
13889
14059
|
}));
|
|
13890
14060
|
}))])), hardline$3, "`");
|
|
13891
14061
|
return concat$4(parts);
|
|
@@ -14086,6 +14256,12 @@ function printPathNoParens(path, options, print, args) {
|
|
|
14086
14256
|
return group$1(concat$4(parts));
|
|
14087
14257
|
}
|
|
14088
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
|
+
|
|
14089
14265
|
case "FunctionTypeParam":
|
|
14090
14266
|
return concat$4([path.call(print, "name"), printOptionalToken(path), n.name ? ": " : "", path.call(print, "typeAnnotation")]);
|
|
14091
14267
|
|
|
@@ -14255,7 +14431,7 @@ function printPathNoParens(path, options, print, args) {
|
|
|
14255
14431
|
return nodeStr(n, options);
|
|
14256
14432
|
|
|
14257
14433
|
case "NumberLiteralTypeAnnotation":
|
|
14258
|
-
assert.strictEqual(_typeof(n.value), "number");
|
|
14434
|
+
assert$3.strictEqual(_typeof(n.value), "number");
|
|
14259
14435
|
|
|
14260
14436
|
if (n.extra != null) {
|
|
14261
14437
|
return printNumber$1(n.extra.raw);
|
|
@@ -14397,6 +14573,9 @@ function printPathNoParens(path, options, print, args) {
|
|
|
14397
14573
|
case "TSUndefinedKeyword":
|
|
14398
14574
|
return "undefined";
|
|
14399
14575
|
|
|
14576
|
+
case "TSUnknownKeyword":
|
|
14577
|
+
return "unknown";
|
|
14578
|
+
|
|
14400
14579
|
case "TSVoidKeyword":
|
|
14401
14580
|
return "void";
|
|
14402
14581
|
|
|
@@ -14787,7 +14966,7 @@ function printMethod(path, options, print) {
|
|
|
14787
14966
|
parts.push("*");
|
|
14788
14967
|
}
|
|
14789
14968
|
} else {
|
|
14790
|
-
assert.ok(kind === "get" || kind === "set");
|
|
14969
|
+
assert$3.ok(kind === "get" || kind === "set");
|
|
14791
14970
|
parts.push(kind, " ");
|
|
14792
14971
|
}
|
|
14793
14972
|
|
|
@@ -14829,7 +15008,7 @@ function shouldGroupFirstArg(args) {
|
|
|
14829
15008
|
|
|
14830
15009
|
var firstArg = args[0];
|
|
14831
15010
|
var secondArg = args[1];
|
|
14832
|
-
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);
|
|
14833
15012
|
}
|
|
14834
15013
|
|
|
14835
15014
|
var functionCompositionFunctionNames = new Set(["pipe", // RxJS, Ramda
|
|
@@ -14844,12 +15023,28 @@ var functionCompositionFunctionNames = new Set(["pipe", // RxJS, Ramda
|
|
|
14844
15023
|
"connect" // Redux
|
|
14845
15024
|
]);
|
|
14846
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
|
+
|
|
14847
15042
|
function isFunctionCompositionFunction(node) {
|
|
14848
15043
|
switch (node.type) {
|
|
14849
15044
|
case "OptionalMemberExpression":
|
|
14850
15045
|
case "MemberExpression":
|
|
14851
15046
|
{
|
|
14852
|
-
return isFunctionCompositionFunction(node.property);
|
|
15047
|
+
return !isThisExpression(node.object) && isFunctionCompositionFunction(node.property);
|
|
14853
15048
|
}
|
|
14854
15049
|
|
|
14855
15050
|
case "Identifier":
|
|
@@ -15212,7 +15407,7 @@ function printFlowDeclaration(path, parts) {
|
|
|
15212
15407
|
var parentExportDecl = getParentExportDeclaration$1(path);
|
|
15213
15408
|
|
|
15214
15409
|
if (parentExportDecl) {
|
|
15215
|
-
assert.strictEqual(parentExportDecl.type, "DeclareExportDeclaration");
|
|
15410
|
+
assert$3.strictEqual(parentExportDecl.type, "DeclareExportDeclaration");
|
|
15216
15411
|
} else {
|
|
15217
15412
|
// If the parent node has type DeclareExportDeclaration, then it
|
|
15218
15413
|
// will be responsible for printing the "declare" token. Otherwise
|
|
@@ -15783,6 +15978,30 @@ function getConditionalChainContents(node) {
|
|
|
15783
15978
|
|
|
15784
15979
|
function isJSXWhitespaceExpression(node) {
|
|
15785
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;
|
|
15786
16005
|
} // JSX Children are strange, mostly for two reasons:
|
|
15787
16006
|
// 1. JSX reads newlines into string values, instead of skipping them like JS
|
|
15788
16007
|
// 2. up to one whitespace between elements within a line is significant,
|
|
@@ -15797,7 +16016,7 @@ function isJSXWhitespaceExpression(node) {
|
|
|
15797
16016
|
// To ensure this we add dummy `""` content elements as needed.
|
|
15798
16017
|
|
|
15799
16018
|
|
|
15800
|
-
function printJSXChildren(path, options, print, jsxWhitespace) {
|
|
16019
|
+
function printJSXChildren(path, options, print, jsxWhitespace, isFacebookTranslationTag) {
|
|
15801
16020
|
var n = path.getValue();
|
|
15802
16021
|
var children = []; // using `map` instead of `each` because it provides `i`
|
|
15803
16022
|
|
|
@@ -15815,7 +16034,7 @@ function printJSXChildren(path, options, print, jsxWhitespace) {
|
|
|
15815
16034
|
words.shift();
|
|
15816
16035
|
|
|
15817
16036
|
if (/\n/.test(words[0])) {
|
|
15818
|
-
children.push(
|
|
16037
|
+
children.push(separatorWithWhitespace(isFacebookTranslationTag, words[1]));
|
|
15819
16038
|
} else {
|
|
15820
16039
|
children.push(jsxWhitespace);
|
|
15821
16040
|
}
|
|
@@ -15845,21 +16064,12 @@ function printJSXChildren(path, options, print, jsxWhitespace) {
|
|
|
15845
16064
|
|
|
15846
16065
|
if (endWhitespace !== undefined) {
|
|
15847
16066
|
if (/\n/.test(endWhitespace)) {
|
|
15848
|
-
children.push(
|
|
16067
|
+
children.push(separatorWithWhitespace(isFacebookTranslationTag, getLast$4(children)));
|
|
15849
16068
|
} else {
|
|
15850
16069
|
children.push(jsxWhitespace);
|
|
15851
16070
|
}
|
|
15852
16071
|
} else {
|
|
15853
|
-
|
|
15854
|
-
// tags and text.
|
|
15855
|
-
// Unfortunately Facebook have a custom translation pipeline
|
|
15856
|
-
// (https://github.com/prettier/prettier/issues/1581#issuecomment-300975032)
|
|
15857
|
-
// that uses the JSX syntax, but does not follow the React whitespace
|
|
15858
|
-
// rules.
|
|
15859
|
-
// Ensuring that we never have a break between tags and text in JSX
|
|
15860
|
-
// will allow Facebook to adopt Prettier without too much of an
|
|
15861
|
-
// adverse effect on formatting algorithm.
|
|
15862
|
-
children.push("");
|
|
16072
|
+
children.push(separatorNoWhitespace(isFacebookTranslationTag, getLast$4(children)));
|
|
15863
16073
|
}
|
|
15864
16074
|
} else if (/\n/.test(text)) {
|
|
15865
16075
|
// Keep (up to one) blank line between tags/expressions/text.
|
|
@@ -15876,13 +16086,11 @@ function printJSXChildren(path, options, print, jsxWhitespace) {
|
|
|
15876
16086
|
var printedChild = print(childPath);
|
|
15877
16087
|
children.push(printedChild);
|
|
15878
16088
|
var next = n.children[i + 1];
|
|
15879
|
-
var directlyFollowedByMeaningfulText = next && isMeaningfulJSXText(next)
|
|
16089
|
+
var directlyFollowedByMeaningfulText = next && isMeaningfulJSXText(next);
|
|
15880
16090
|
|
|
15881
16091
|
if (directlyFollowedByMeaningfulText) {
|
|
15882
|
-
|
|
15883
|
-
|
|
15884
|
-
// to why this is an empty string.
|
|
15885
|
-
children.push("");
|
|
16092
|
+
var firstWord = rawText(next).trim().split(matchJsxWhitespaceRegex)[0];
|
|
16093
|
+
children.push(separatorNoWhitespace(isFacebookTranslationTag, firstWord));
|
|
15886
16094
|
} else {
|
|
15887
16095
|
children.push(hardline$3);
|
|
15888
16096
|
}
|
|
@@ -15944,7 +16152,8 @@ function printJSXElement(path, options, print) {
|
|
|
15944
16152
|
var forcedBreak = willBreak$1(openingLines) || containsTag || containsMultipleAttributes || containsMultipleExpressions;
|
|
15945
16153
|
var rawJsxWhitespace = options.singleQuote ? "{' '}" : '{" "}';
|
|
15946
16154
|
var jsxWhitespace = ifBreak$1(concat$4([rawJsxWhitespace, softline$1]), " ");
|
|
15947
|
-
var
|
|
16155
|
+
var isFacebookTranslationTag = n.openingElement && n.openingElement.name && n.openingElement.name.name === "fbt";
|
|
16156
|
+
var children = printJSXChildren(path, options, print, jsxWhitespace, isFacebookTranslationTag);
|
|
15948
16157
|
var containsText = n.children.filter(function (child) {
|
|
15949
16158
|
return isMeaningfulJSXText(child);
|
|
15950
16159
|
}).length > 0; // We can end up we multiple whitespace elements with empty string
|
|
@@ -16050,7 +16259,10 @@ function maybeWrapJSXElementInParens(path, elem) {
|
|
|
16050
16259
|
return elem;
|
|
16051
16260
|
}
|
|
16052
16261
|
|
|
16053
|
-
|
|
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
|
+
});
|
|
16054
16266
|
}
|
|
16055
16267
|
|
|
16056
16268
|
function isBinaryish(node) {
|
|
@@ -16143,7 +16355,8 @@ function printAssignmentRight(leftNode, rightNode, printedRight, options) {
|
|
|
16143
16355
|
return indent$2(concat$4([hardline$3, printedRight]));
|
|
16144
16356
|
}
|
|
16145
16357
|
|
|
16146
|
-
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";
|
|
16147
16360
|
|
|
16148
16361
|
if (canBreak) {
|
|
16149
16362
|
return indent$2(concat$4([line$3, printedRight]));
|
|
@@ -16752,6 +16965,40 @@ var commonOptions = {
|
|
|
16752
16965
|
type: "boolean",
|
|
16753
16966
|
default: false,
|
|
16754
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
|
+
}]
|
|
16755
17002
|
}
|
|
16756
17003
|
};
|
|
16757
17004
|
|
|
@@ -16822,89 +17069,310 @@ var options$3 = {
|
|
|
16822
17069
|
}
|
|
16823
17070
|
};
|
|
16824
17071
|
|
|
16825
|
-
|
|
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;
|
|
16826
17327
|
|
|
17328
|
+
var require$$3$1 = ( json$3 && json$2 ) || json$3;
|
|
16827
17329
|
|
|
16828
|
-
var
|
|
16829
|
-
|
|
17330
|
+
var require$$4 = ( jsonWithComments$1 && jsonWithComments ) || jsonWithComments$1;
|
|
17331
|
+
|
|
17332
|
+
var require$$5 = ( json5$1 && json5 ) || json5$1;
|
|
17333
|
+
|
|
17334
|
+
var languages = [languageExtend({}, require$$0$10, {
|
|
16830
17335
|
since: "0.0.0",
|
|
16831
17336
|
parsers: ["babylon", "flow"],
|
|
16832
|
-
group: "JavaScript",
|
|
16833
|
-
tmScope: "source.js",
|
|
16834
|
-
aceMode: "javascript",
|
|
16835
|
-
codemirrorMode: "javascript",
|
|
16836
|
-
codemirrorMimeType: "text/javascript",
|
|
16837
|
-
aliases: ["js", "node"],
|
|
16838
|
-
extensions: [".js", "._js", ".bones", ".es", ".es6", ".frag", ".gs", ".jake", ".jsb", ".jscad", ".jsfl", ".jsm", ".jss", ".mjs", ".njs", ".pac", ".sjs", ".ssjs", ".xsjs", ".xsjslib"],
|
|
16839
|
-
filenames: ["Jakefile"],
|
|
16840
|
-
linguistLanguageId: 183,
|
|
16841
17337
|
vscodeLanguageIds: ["javascript"]
|
|
16842
|
-
}, {
|
|
16843
|
-
name: "
|
|
17338
|
+
}), {
|
|
17339
|
+
name: "Flow",
|
|
17340
|
+
since: "0.0.0",
|
|
17341
|
+
parsers: ["babylon", "flow"],
|
|
17342
|
+
extensions: [".js.flow"]
|
|
17343
|
+
}, languageExtend({}, require$$1$6, {
|
|
16844
17344
|
since: "0.0.0",
|
|
16845
17345
|
parsers: ["babylon", "flow"],
|
|
16846
|
-
group: "JavaScript",
|
|
16847
|
-
extensions: [".jsx"],
|
|
16848
|
-
tmScope: "source.js.jsx",
|
|
16849
|
-
aceMode: "javascript",
|
|
16850
|
-
codemirrorMode: "jsx",
|
|
16851
|
-
codemirrorMimeType: "text/jsx",
|
|
16852
|
-
liguistLanguageId: 178,
|
|
16853
17346
|
vscodeLanguageIds: ["javascriptreact"]
|
|
16854
|
-
}, {
|
|
16855
|
-
name: "TypeScript",
|
|
17347
|
+
}), languageExtend({}, require$$2$6, {
|
|
16856
17348
|
since: "1.4.0",
|
|
16857
17349
|
parsers: ["typescript-eslint"],
|
|
16858
|
-
group: "JavaScript",
|
|
16859
|
-
aliases: ["ts"],
|
|
16860
|
-
extensions: [".ts", ".tsx"],
|
|
16861
|
-
tmScope: "source.ts",
|
|
16862
|
-
aceMode: "typescript",
|
|
16863
|
-
codemirrorMode: "javascript",
|
|
16864
|
-
codemirrorMimeType: "application/typescript",
|
|
16865
|
-
liguistLanguageId: 378,
|
|
16866
17350
|
vscodeLanguageIds: ["typescript", "typescriptreact"]
|
|
16867
|
-
}, {
|
|
17351
|
+
}), Object.assign(languageExtend({}, require$$3$1, {
|
|
16868
17352
|
name: "JSON.stringify",
|
|
16869
17353
|
since: "1.13.0",
|
|
16870
17354
|
parsers: ["json-stringify"],
|
|
16871
|
-
|
|
16872
|
-
|
|
16873
|
-
|
|
16874
|
-
codemirrorMode: "javascript",
|
|
16875
|
-
codemirrorMimeType: "application/json",
|
|
17355
|
+
vscodeLanguageIds: ["json"]
|
|
17356
|
+
}), // overwrite
|
|
17357
|
+
{
|
|
16876
17358
|
extensions: [],
|
|
16877
17359
|
// .json file defaults to json instead of json-stringify
|
|
16878
|
-
filenames: ["package.json", "package-lock.json", "composer.json"]
|
|
16879
|
-
|
|
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"],
|
|
16880
17365
|
vscodeLanguageIds: ["json"]
|
|
16881
|
-
}, {
|
|
16882
|
-
name: "JSON",
|
|
17366
|
+
}), languageExtend({}, require$$4, {
|
|
16883
17367
|
since: "1.5.0",
|
|
16884
17368
|
parsers: ["json"],
|
|
16885
|
-
|
|
16886
|
-
|
|
16887
|
-
|
|
16888
|
-
codemirrorMode: "javascript",
|
|
16889
|
-
codemirrorMimeType: "application/json",
|
|
16890
|
-
extensions: [".json", ".geojson", ".JSON-tmLanguage", ".topojson"],
|
|
16891
|
-
filenames: [".arcconfig", ".jshintrc", ".eslintrc", ".prettierrc", "composer.lock", "mcmod.info"],
|
|
16892
|
-
linguistLanguageId: 174,
|
|
16893
|
-
vscodeLanguageIds: ["json", "jsonc"]
|
|
16894
|
-
}, {
|
|
16895
|
-
name: "JSON5",
|
|
17369
|
+
filenames: [".eslintrc"],
|
|
17370
|
+
vscodeLanguageIds: ["jsonc"]
|
|
17371
|
+
}), languageExtend({}, require$$5, {
|
|
16896
17372
|
since: "1.13.0",
|
|
16897
17373
|
parsers: ["json5"],
|
|
16898
|
-
group: "JavaScript",
|
|
16899
|
-
tmScope: "source.json",
|
|
16900
|
-
aceMode: "json",
|
|
16901
|
-
codemirrorMode: "javascript",
|
|
16902
|
-
codemirrorMimeType: "application/json",
|
|
16903
|
-
extensions: [".json5"],
|
|
16904
|
-
filenames: [".babelrc"],
|
|
16905
|
-
linguistLanguageId: 175,
|
|
16906
17374
|
vscodeLanguageIds: ["json5"]
|
|
16907
|
-
}];
|
|
17375
|
+
})];
|
|
16908
17376
|
var printers = {
|
|
16909
17377
|
estree: printerEstree,
|
|
16910
17378
|
"estree-json": printerEstreeJson
|
|
@@ -16923,11 +17391,31 @@ var htmlTagNames = Object.freeze({
|
|
|
16923
17391
|
|
|
16924
17392
|
var htmlTagNames$1 = ( htmlTagNames && index$5 ) || htmlTagNames;
|
|
16925
17393
|
|
|
16926
|
-
function clean$3(ast, newObj) {
|
|
16927
|
-
["
|
|
17394
|
+
function clean$3(ast, newObj, parent) {
|
|
17395
|
+
["raw", // front-matter
|
|
17396
|
+
"raws", "sourceIndex", "source", "before", "after", "trailingComma"].forEach(function (name) {
|
|
16928
17397
|
delete newObj[name];
|
|
16929
17398
|
});
|
|
16930
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
|
+
|
|
16931
17419
|
if (ast.type === "media-query" || ast.type === "media-query-list" || ast.type === "media-feature-expression") {
|
|
16932
17420
|
delete newObj.value;
|
|
16933
17421
|
}
|
|
@@ -17019,6 +17507,85 @@ function cleanCSSStrings(value) {
|
|
|
17019
17507
|
|
|
17020
17508
|
var clean_1$2 = clean$3;
|
|
17021
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
|
+
|
|
17022
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"];
|
|
17023
17590
|
|
|
17024
17591
|
function getAncestorCounter(path, typeOrTypes) {
|
|
@@ -17315,22 +17882,23 @@ var utils$4 = {
|
|
|
17315
17882
|
isColorAdjusterFuncNode: isColorAdjusterFuncNode$1
|
|
17316
17883
|
};
|
|
17317
17884
|
|
|
17885
|
+
var insertPragma$2 = pragma$2.insertPragma;
|
|
17318
17886
|
var printNumber$2 = util.printNumber;
|
|
17319
17887
|
var printString$2 = util.printString;
|
|
17320
17888
|
var hasIgnoreComment$2 = util.hasIgnoreComment;
|
|
17321
17889
|
var hasNewline$3 = util.hasNewline;
|
|
17322
17890
|
var isNextLineEmpty$3 = utilShared.isNextLineEmpty;
|
|
17323
|
-
var _require$$
|
|
17324
|
-
var concat$7 = _require$$
|
|
17325
|
-
var join$5 = _require$$
|
|
17326
|
-
var line$4 = _require$$
|
|
17327
|
-
var hardline$6 = _require$$
|
|
17328
|
-
var softline$3 = _require$$
|
|
17329
|
-
var group$
|
|
17330
|
-
var fill$3 = _require$$
|
|
17331
|
-
var indent$5 = _require$$
|
|
17332
|
-
var dedent$3 = _require$$
|
|
17333
|
-
var ifBreak$2 = _require$$
|
|
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;
|
|
17334
17902
|
var removeLines$2 = doc.utils.removeLines;
|
|
17335
17903
|
var getAncestorNode = utils$4.getAncestorNode;
|
|
17336
17904
|
var getPropOfDeclNode = utils$4.getPropOfDeclNode;
|
|
@@ -17398,8 +17966,9 @@ function genericPrint$3(path, options, print) {
|
|
|
17398
17966
|
}
|
|
17399
17967
|
|
|
17400
17968
|
switch (node.type) {
|
|
17401
|
-
case "
|
|
17402
|
-
|
|
17969
|
+
case "yaml":
|
|
17970
|
+
case "toml":
|
|
17971
|
+
return concat$7([node.raw, hardline$6]);
|
|
17403
17972
|
|
|
17404
17973
|
case "css-root":
|
|
17405
17974
|
{
|
|
@@ -17448,7 +18017,7 @@ function genericPrint$3(path, options, print) {
|
|
|
17448
18017
|
return concat$7(["@", // If a Less file ends up being parsed with the SCSS parser, Less
|
|
17449
18018
|
// variable declarations will be parsed as at-rules with names ending
|
|
17450
18019
|
// with a colon, so keep the original case then.
|
|
17451
|
-
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$
|
|
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, "}"]) : ";"]);
|
|
17452
18021
|
}
|
|
17453
18022
|
// postcss-media-query-parser
|
|
17454
18023
|
|
|
@@ -17464,7 +18033,7 @@ function genericPrint$3(path, options, print) {
|
|
|
17464
18033
|
|
|
17465
18034
|
parts.push(childPath.call(print));
|
|
17466
18035
|
}, "nodes");
|
|
17467
|
-
return group$
|
|
18036
|
+
return group$5(indent$5(join$5(line$4, parts)));
|
|
17468
18037
|
}
|
|
17469
18038
|
|
|
17470
18039
|
case "media-query":
|
|
@@ -17519,12 +18088,12 @@ function genericPrint$3(path, options, print) {
|
|
|
17519
18088
|
|
|
17520
18089
|
case "selector-root":
|
|
17521
18090
|
{
|
|
17522
|
-
return group$
|
|
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"))]));
|
|
17523
18092
|
}
|
|
17524
18093
|
|
|
17525
18094
|
case "selector-selector":
|
|
17526
18095
|
{
|
|
17527
|
-
return group$
|
|
18096
|
+
return group$5(indent$5(concat$7(path.map(print, "nodes"))));
|
|
17528
18097
|
}
|
|
17529
18098
|
|
|
17530
18099
|
case "selector-comment":
|
|
@@ -17577,7 +18146,7 @@ function genericPrint$3(path, options, print) {
|
|
|
17577
18146
|
|
|
17578
18147
|
case "selector-universal":
|
|
17579
18148
|
{
|
|
17580
|
-
return concat$7([node.namespace ? concat$7([node.namespace === true ? "" : node.namespace.trim(), "|"]) : "",
|
|
18149
|
+
return concat$7([node.namespace ? concat$7([node.namespace === true ? "" : node.namespace.trim(), "|"]) : "", node.value]);
|
|
17581
18150
|
}
|
|
17582
18151
|
|
|
17583
18152
|
case "selector-pseudo":
|
|
@@ -17777,7 +18346,7 @@ function genericPrint$3(path, options, print) {
|
|
|
17777
18346
|
}
|
|
17778
18347
|
|
|
17779
18348
|
if (isControlDirective) {
|
|
17780
|
-
return group$
|
|
18349
|
+
return group$5(indent$5(concat$7(_parts)));
|
|
17781
18350
|
} // Indent is not needed for import url when url is very long
|
|
17782
18351
|
// and node has two groups
|
|
17783
18352
|
// when type is value-comma_group
|
|
@@ -17785,10 +18354,10 @@ function genericPrint$3(path, options, print) {
|
|
|
17785
18354
|
|
|
17786
18355
|
|
|
17787
18356
|
if (insideURLFunctionInImportAtRuleNode(path)) {
|
|
17788
|
-
return group$
|
|
18357
|
+
return group$5(fill$3(_parts));
|
|
17789
18358
|
}
|
|
17790
18359
|
|
|
17791
|
-
return group$
|
|
18360
|
+
return group$5(indent$5(fill$3(_parts)));
|
|
17792
18361
|
}
|
|
17793
18362
|
|
|
17794
18363
|
case "value-paren_group":
|
|
@@ -17812,17 +18381,17 @@ function genericPrint$3(path, options, print) {
|
|
|
17812
18381
|
res.push(_printed[_i]);
|
|
17813
18382
|
}
|
|
17814
18383
|
|
|
17815
|
-
return group$
|
|
18384
|
+
return group$5(indent$5(fill$3(res)));
|
|
17816
18385
|
}
|
|
17817
18386
|
|
|
17818
18387
|
var isSCSSMapItem = isSCSSMapItemNode(path);
|
|
17819
|
-
return group$
|
|
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) {
|
|
17820
18389
|
var node = childPath.getValue();
|
|
17821
18390
|
var printed = print(childPath); // Key/Value pair in open paren already indented
|
|
17822
18391
|
|
|
17823
18392
|
if (isKeyValuePairNode(node) && node.type === "value-comma_group" && node.groups && node.groups[2] && node.groups[2].type === "value-paren_group") {
|
|
17824
|
-
printed.contents.contents.parts[1] = group$
|
|
17825
|
-
return group$
|
|
18393
|
+
printed.contents.contents.parts[1] = group$5(printed.contents.contents.parts[1]);
|
|
18394
|
+
return group$5(dedent$3(printed));
|
|
17826
18395
|
}
|
|
17827
18396
|
|
|
17828
18397
|
return printed;
|
|
@@ -17914,12 +18483,12 @@ function printNodeSequence(path, options, print) {
|
|
|
17914
18483
|
if (i !== node.nodes.length - 1) {
|
|
17915
18484
|
if (node.nodes[i + 1].type === "css-comment" && !hasNewline$3(options.originalText, options.locStart(node.nodes[i + 1]), {
|
|
17916
18485
|
backwards: true
|
|
17917
|
-
}) || 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") {
|
|
17918
18487
|
parts.push(" ");
|
|
17919
18488
|
} else {
|
|
17920
18489
|
parts.push(hardline$6);
|
|
17921
18490
|
|
|
17922
|
-
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") {
|
|
17923
18492
|
parts.push(hardline$6);
|
|
17924
18493
|
}
|
|
17925
18494
|
}
|
|
@@ -17960,6 +18529,8 @@ function printCssNumber(rawNumber) {
|
|
|
17960
18529
|
|
|
17961
18530
|
var printerPostcss = {
|
|
17962
18531
|
print: genericPrint$3,
|
|
18532
|
+
embed: embed_1$2,
|
|
18533
|
+
insertPragma: insertPragma$2,
|
|
17963
18534
|
hasPrettierIgnore: hasIgnoreComment$2,
|
|
17964
18535
|
massageAstNode: clean_1$2
|
|
17965
18536
|
};
|
|
@@ -17968,46 +18539,162 @@ var options$6 = {
|
|
|
17968
18539
|
singleQuote: commonOptions.singleQuote
|
|
17969
18540
|
};
|
|
17970
18541
|
|
|
17971
|
-
|
|
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;
|
|
17972
18673
|
|
|
18674
|
+
var require$$1$7 = ( postcss$1 && postcss ) || postcss$1;
|
|
17973
18675
|
|
|
17974
|
-
var
|
|
17975
|
-
|
|
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, {
|
|
17976
18685
|
since: "1.4.0",
|
|
17977
18686
|
parsers: ["css"],
|
|
17978
|
-
|
|
17979
|
-
|
|
17980
|
-
|
|
17981
|
-
codemirrorMode: "css",
|
|
17982
|
-
codemirrorMimeType: "text/css",
|
|
17983
|
-
extensions: [".css", ".pcss", ".postcss"],
|
|
17984
|
-
liguistLanguageId: 50,
|
|
17985
|
-
vscodeLanguageIds: ["css", "postcss"]
|
|
17986
|
-
}, {
|
|
17987
|
-
name: "Less",
|
|
18687
|
+
extensions: [".postcss"],
|
|
18688
|
+
vscodeLanguageIds: ["postcss"]
|
|
18689
|
+
}), languageExtend({}, require$$2$7, {
|
|
17988
18690
|
since: "1.4.0",
|
|
17989
18691
|
parsers: ["less"],
|
|
17990
|
-
group: "CSS",
|
|
17991
|
-
extensions: [".less"],
|
|
17992
|
-
tmScope: "source.css.less",
|
|
17993
|
-
aceMode: "less",
|
|
17994
|
-
codemirrorMode: "css",
|
|
17995
|
-
codemirrorMimeType: "text/css",
|
|
17996
|
-
liguistLanguageId: 198,
|
|
17997
18692
|
vscodeLanguageIds: ["less"]
|
|
17998
|
-
}, {
|
|
17999
|
-
name: "SCSS",
|
|
18693
|
+
}), languageExtend({}, require$$3$2, {
|
|
18000
18694
|
since: "1.4.0",
|
|
18001
18695
|
parsers: ["scss"],
|
|
18002
|
-
group: "CSS",
|
|
18003
|
-
tmScope: "source.scss",
|
|
18004
|
-
aceMode: "scss",
|
|
18005
|
-
codemirrorMode: "css",
|
|
18006
|
-
codemirrorMimeType: "text/x-scss",
|
|
18007
|
-
extensions: [".scss"],
|
|
18008
|
-
liguistLanguageId: 329,
|
|
18009
18696
|
vscodeLanguageIds: ["scss"]
|
|
18010
|
-
}];
|
|
18697
|
+
})];
|
|
18011
18698
|
var printers$1 = {
|
|
18012
18699
|
postcss: printerPostcss
|
|
18013
18700
|
};
|
|
@@ -18017,17 +18704,31 @@ var languageCss = {
|
|
|
18017
18704
|
printers: printers$1
|
|
18018
18705
|
};
|
|
18019
18706
|
|
|
18020
|
-
|
|
18021
|
-
|
|
18022
|
-
|
|
18023
|
-
|
|
18024
|
-
|
|
18025
|
-
|
|
18026
|
-
|
|
18027
|
-
|
|
18028
|
-
var
|
|
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;
|
|
18029
18729
|
var hasIgnoreComment$3 = util.hasIgnoreComment;
|
|
18030
18730
|
var isNextLineEmpty$4 = utilShared.isNextLineEmpty;
|
|
18731
|
+
var insertPragma$4 = pragma$4.insertPragma;
|
|
18031
18732
|
|
|
18032
18733
|
function genericPrint$4(path, options, print) {
|
|
18033
18734
|
var n = path.getValue();
|
|
@@ -18045,41 +18746,41 @@ function genericPrint$4(path, options, print) {
|
|
|
18045
18746
|
{
|
|
18046
18747
|
var parts = [];
|
|
18047
18748
|
path.map(function (pathChild, index) {
|
|
18048
|
-
parts.push(concat$
|
|
18749
|
+
parts.push(concat$9([pathChild.call(print)]));
|
|
18049
18750
|
|
|
18050
18751
|
if (index !== n.definitions.length - 1) {
|
|
18051
|
-
parts.push(hardline$
|
|
18752
|
+
parts.push(hardline$8);
|
|
18052
18753
|
|
|
18053
18754
|
if (isNextLineEmpty$4(options.originalText, pathChild.getValue(), options)) {
|
|
18054
|
-
parts.push(hardline$
|
|
18755
|
+
parts.push(hardline$8);
|
|
18055
18756
|
}
|
|
18056
18757
|
}
|
|
18057
18758
|
}, "definitions");
|
|
18058
|
-
return concat$
|
|
18759
|
+
return concat$9([concat$9(parts), hardline$8]);
|
|
18059
18760
|
}
|
|
18060
18761
|
|
|
18061
18762
|
case "OperationDefinition":
|
|
18062
18763
|
{
|
|
18063
18764
|
var hasOperation = options.originalText[options.locStart(n)] !== "{";
|
|
18064
18765
|
var hasName = !!n.name;
|
|
18065
|
-
return concat$
|
|
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")]);
|
|
18066
18767
|
}
|
|
18067
18768
|
|
|
18068
18769
|
case "FragmentDefinition":
|
|
18069
18770
|
{
|
|
18070
|
-
return concat$
|
|
18771
|
+
return concat$9(["fragment ", path.call(print, "name"), " on ", path.call(print, "typeCondition"), printDirectives(path, print, n), " ", path.call(print, "selectionSet")]);
|
|
18071
18772
|
}
|
|
18072
18773
|
|
|
18073
18774
|
case "SelectionSet":
|
|
18074
18775
|
{
|
|
18075
|
-
return concat$
|
|
18776
|
+
return concat$9(["{", indent$6(concat$9([hardline$8, join$6(hardline$8, path.call(function (selectionsPath) {
|
|
18076
18777
|
return printSequence(selectionsPath, options, print);
|
|
18077
|
-
}, "selections"))])), hardline$
|
|
18778
|
+
}, "selections"))])), hardline$8, "}"]);
|
|
18078
18779
|
}
|
|
18079
18780
|
|
|
18080
18781
|
case "Field":
|
|
18081
18782
|
{
|
|
18082
|
-
return group$
|
|
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) {
|
|
18083
18784
|
return printSequence(argsPath, options, print);
|
|
18084
18785
|
}, "arguments"))])), softline$4, ")"])) : "", printDirectives(path, print, n), n.selectionSet ? " " : "", path.call(print, "selectionSet")]));
|
|
18085
18786
|
}
|
|
@@ -18092,10 +18793,10 @@ function genericPrint$4(path, options, print) {
|
|
|
18092
18793
|
case "StringValue":
|
|
18093
18794
|
{
|
|
18094
18795
|
if (n.block) {
|
|
18095
|
-
return concat$
|
|
18796
|
+
return concat$9(['"""', hardline$8, join$6(hardline$8, n.value.replace(/"""/g, "\\$&").split("\n")), hardline$8, '"""']);
|
|
18096
18797
|
}
|
|
18097
18798
|
|
|
18098
|
-
return concat$
|
|
18799
|
+
return concat$9(['"', n.value.replace(/["\\]/g, "\\$&").replace(/\n/g, "\\n"), '"']);
|
|
18099
18800
|
}
|
|
18100
18801
|
|
|
18101
18802
|
case "IntValue":
|
|
@@ -18117,28 +18818,28 @@ function genericPrint$4(path, options, print) {
|
|
|
18117
18818
|
|
|
18118
18819
|
case "Variable":
|
|
18119
18820
|
{
|
|
18120
|
-
return concat$
|
|
18821
|
+
return concat$9(["$", path.call(print, "name")]);
|
|
18121
18822
|
}
|
|
18122
18823
|
|
|
18123
18824
|
case "ListValue":
|
|
18124
18825
|
{
|
|
18125
|
-
return group$
|
|
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, "]"]));
|
|
18126
18827
|
}
|
|
18127
18828
|
|
|
18128
18829
|
case "ObjectValue":
|
|
18129
18830
|
{
|
|
18130
|
-
return group$
|
|
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 ? " " : ""), "}"]));
|
|
18131
18832
|
}
|
|
18132
18833
|
|
|
18133
18834
|
case "ObjectField":
|
|
18134
18835
|
case "Argument":
|
|
18135
18836
|
{
|
|
18136
|
-
return concat$
|
|
18837
|
+
return concat$9([path.call(print, "name"), ": ", path.call(print, "value")]);
|
|
18137
18838
|
}
|
|
18138
18839
|
|
|
18139
18840
|
case "Directive":
|
|
18140
18841
|
{
|
|
18141
|
-
return concat$
|
|
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) {
|
|
18142
18843
|
return printSequence(argsPath, options, print);
|
|
18143
18844
|
}, "arguments"))])), softline$4, ")"])) : ""]);
|
|
18144
18845
|
}
|
|
@@ -18150,112 +18851,112 @@ function genericPrint$4(path, options, print) {
|
|
|
18150
18851
|
|
|
18151
18852
|
case "VariableDefinition":
|
|
18152
18853
|
{
|
|
18153
|
-
return concat$
|
|
18854
|
+
return concat$9([path.call(print, "variable"), ": ", path.call(print, "type"), n.defaultValue ? concat$9([" = ", path.call(print, "defaultValue")]) : ""]);
|
|
18154
18855
|
}
|
|
18155
18856
|
|
|
18156
18857
|
case "TypeExtensionDefinition":
|
|
18157
18858
|
{
|
|
18158
|
-
return concat$
|
|
18859
|
+
return concat$9(["extend ", path.call(print, "definition")]);
|
|
18159
18860
|
}
|
|
18160
18861
|
|
|
18161
18862
|
case "ObjectTypeExtension":
|
|
18162
18863
|
case "ObjectTypeDefinition":
|
|
18163
18864
|
{
|
|
18164
|
-
return concat$
|
|
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) {
|
|
18165
18866
|
return printSequence(fieldsPath, options, print);
|
|
18166
|
-
}, "fields"))])), hardline$
|
|
18867
|
+
}, "fields"))])), hardline$8, "}"]) : ""]);
|
|
18167
18868
|
}
|
|
18168
18869
|
|
|
18169
18870
|
case "FieldDefinition":
|
|
18170
18871
|
{
|
|
18171
|
-
return concat$
|
|
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) {
|
|
18172
18873
|
return printSequence(argsPath, options, print);
|
|
18173
18874
|
}, "arguments"))])), softline$4, ")"])) : "", ": ", path.call(print, "type"), printDirectives(path, print, n)]);
|
|
18174
18875
|
}
|
|
18175
18876
|
|
|
18176
18877
|
case "DirectiveDefinition":
|
|
18177
18878
|
{
|
|
18178
|
-
return concat$
|
|
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) {
|
|
18179
18880
|
return printSequence(argsPath, options, print);
|
|
18180
|
-
}, "arguments"))])), softline$4, ")"])) : "", concat$
|
|
18881
|
+
}, "arguments"))])), softline$4, ")"])) : "", concat$9([" on ", join$6(" | ", path.map(print, "locations"))])]);
|
|
18181
18882
|
}
|
|
18182
18883
|
|
|
18183
18884
|
case "EnumTypeExtension":
|
|
18184
18885
|
case "EnumTypeDefinition":
|
|
18185
18886
|
{
|
|
18186
|
-
return concat$
|
|
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) {
|
|
18187
18888
|
return printSequence(valuesPath, options, print);
|
|
18188
|
-
}, "values"))])), hardline$
|
|
18889
|
+
}, "values"))])), hardline$8, "}"]) : ""]);
|
|
18189
18890
|
}
|
|
18190
18891
|
|
|
18191
18892
|
case "EnumValueDefinition":
|
|
18192
18893
|
{
|
|
18193
|
-
return concat$
|
|
18894
|
+
return concat$9([path.call(print, "description"), n.description ? hardline$8 : "", path.call(print, "name"), printDirectives(path, print, n)]);
|
|
18194
18895
|
}
|
|
18195
18896
|
|
|
18196
18897
|
case "InputValueDefinition":
|
|
18197
18898
|
{
|
|
18198
|
-
return concat$
|
|
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)]);
|
|
18199
18900
|
}
|
|
18200
18901
|
|
|
18201
18902
|
case "InputObjectTypeExtension":
|
|
18202
18903
|
case "InputObjectTypeDefinition":
|
|
18203
18904
|
{
|
|
18204
|
-
return concat$
|
|
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) {
|
|
18205
18906
|
return printSequence(fieldsPath, options, print);
|
|
18206
|
-
}, "fields"))])), hardline$
|
|
18907
|
+
}, "fields"))])), hardline$8, "}"]) : ""]);
|
|
18207
18908
|
}
|
|
18208
18909
|
|
|
18209
18910
|
case "SchemaDefinition":
|
|
18210
18911
|
{
|
|
18211
|
-
return concat$
|
|
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) {
|
|
18212
18913
|
return printSequence(opsPath, options, print);
|
|
18213
|
-
}, "operationTypes"))])) : "", hardline$
|
|
18914
|
+
}, "operationTypes"))])) : "", hardline$8, "}"]);
|
|
18214
18915
|
}
|
|
18215
18916
|
|
|
18216
18917
|
case "OperationTypeDefinition":
|
|
18217
18918
|
{
|
|
18218
|
-
return concat$
|
|
18919
|
+
return concat$9([path.call(print, "operation"), ": ", path.call(print, "type")]);
|
|
18219
18920
|
}
|
|
18220
18921
|
|
|
18221
18922
|
case "InterfaceTypeExtension":
|
|
18222
18923
|
case "InterfaceTypeDefinition":
|
|
18223
18924
|
{
|
|
18224
|
-
return concat$
|
|
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) {
|
|
18225
18926
|
return printSequence(fieldsPath, options, print);
|
|
18226
|
-
}, "fields"))])), hardline$
|
|
18927
|
+
}, "fields"))])), hardline$8, "}"]) : ""]);
|
|
18227
18928
|
}
|
|
18228
18929
|
|
|
18229
18930
|
case "FragmentSpread":
|
|
18230
18931
|
{
|
|
18231
|
-
return concat$
|
|
18932
|
+
return concat$9(["...", path.call(print, "name"), printDirectives(path, print, n)]);
|
|
18232
18933
|
}
|
|
18233
18934
|
|
|
18234
18935
|
case "InlineFragment":
|
|
18235
18936
|
{
|
|
18236
|
-
return concat$
|
|
18937
|
+
return concat$9(["...", n.typeCondition ? concat$9([" on ", path.call(print, "typeCondition")]) : "", printDirectives(path, print, n), " ", path.call(print, "selectionSet")]);
|
|
18237
18938
|
}
|
|
18238
18939
|
|
|
18239
18940
|
case "UnionTypeExtension":
|
|
18240
18941
|
case "UnionTypeDefinition":
|
|
18241
18942
|
{
|
|
18242
|
-
return group$
|
|
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"))]))]) : ""]))]));
|
|
18243
18944
|
}
|
|
18244
18945
|
|
|
18245
18946
|
case "ScalarTypeExtension":
|
|
18246
18947
|
case "ScalarTypeDefinition":
|
|
18247
18948
|
{
|
|
18248
|
-
return concat$
|
|
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)]);
|
|
18249
18950
|
}
|
|
18250
18951
|
|
|
18251
18952
|
case "NonNullType":
|
|
18252
18953
|
{
|
|
18253
|
-
return concat$
|
|
18954
|
+
return concat$9([path.call(print, "type"), "!"]);
|
|
18254
18955
|
}
|
|
18255
18956
|
|
|
18256
18957
|
case "ListType":
|
|
18257
18958
|
{
|
|
18258
|
-
return concat$
|
|
18959
|
+
return concat$9(["[", path.call(print, "type"), "]"]);
|
|
18259
18960
|
}
|
|
18260
18961
|
|
|
18261
18962
|
default:
|
|
@@ -18269,7 +18970,7 @@ function printDirectives(path, print, n) {
|
|
|
18269
18970
|
return "";
|
|
18270
18971
|
}
|
|
18271
18972
|
|
|
18272
|
-
return concat$
|
|
18973
|
+
return concat$9([" ", group$9(indent$6(concat$9([softline$4, join$6(concat$9([ifBreak$3("", " "), softline$4]), path.map(print, "directives"))])))]);
|
|
18273
18974
|
}
|
|
18274
18975
|
|
|
18275
18976
|
function printSequence(sequencePath, options, print) {
|
|
@@ -18278,7 +18979,7 @@ function printSequence(sequencePath, options, print) {
|
|
|
18278
18979
|
var printed = print(path);
|
|
18279
18980
|
|
|
18280
18981
|
if (isNextLineEmpty$4(options.originalText, path.getValue(), options) && i < count - 1) {
|
|
18281
|
-
return concat$
|
|
18982
|
+
return concat$9([printed, hardline$8]);
|
|
18282
18983
|
}
|
|
18283
18984
|
|
|
18284
18985
|
return printed;
|
|
@@ -18292,13 +18993,11 @@ function canAttachComment$1(node) {
|
|
|
18292
18993
|
function printComment$2(commentPath) {
|
|
18293
18994
|
var comment = commentPath.getValue();
|
|
18294
18995
|
|
|
18295
|
-
|
|
18296
|
-
|
|
18297
|
-
return "#" + comment.value.trimRight();
|
|
18298
|
-
|
|
18299
|
-
default:
|
|
18300
|
-
throw new Error("Not a comment: " + JSON.stringify(comment));
|
|
18996
|
+
if (comment.kind === "Comment") {
|
|
18997
|
+
return "#" + comment.value.trimRight();
|
|
18301
18998
|
}
|
|
18999
|
+
|
|
19000
|
+
throw new Error("Not a comment: " + JSON.stringify(comment));
|
|
18302
19001
|
}
|
|
18303
19002
|
|
|
18304
19003
|
function determineInterfaceSeparator(originalSource) {
|
|
@@ -18328,6 +19027,7 @@ var printerGraphql = {
|
|
|
18328
19027
|
print: genericPrint$4,
|
|
18329
19028
|
massageAstNode: clean$5,
|
|
18330
19029
|
hasPrettierIgnore: hasIgnoreComment$3,
|
|
19030
|
+
insertPragma: insertPragma$4,
|
|
18331
19031
|
printComment: printComment$2,
|
|
18332
19032
|
canAttachComment: canAttachComment$1
|
|
18333
19033
|
};
|
|
@@ -18336,19 +19036,38 @@ var options$9 = {
|
|
|
18336
19036
|
bracketSpacing: commonOptions.bracketSpacing
|
|
18337
19037
|
};
|
|
18338
19038
|
|
|
18339
|
-
|
|
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
|
+
});
|
|
18340
19063
|
|
|
19064
|
+
var require$$0$13 = ( graphql$1 && graphql ) || graphql$1;
|
|
18341
19065
|
|
|
18342
|
-
var languages$2 = [{
|
|
18343
|
-
name: "GraphQL",
|
|
19066
|
+
var languages$2 = [languageExtend({}, require$$0$13, {
|
|
18344
19067
|
since: "1.5.0",
|
|
18345
19068
|
parsers: ["graphql"],
|
|
18346
|
-
extensions: [".graphql", ".gql"],
|
|
18347
|
-
tmScope: "source.graphql",
|
|
18348
|
-
aceMode: "text",
|
|
18349
|
-
liguistLanguageId: 139,
|
|
18350
19069
|
vscodeLanguageIds: ["graphql"]
|
|
18351
|
-
}];
|
|
19070
|
+
})];
|
|
18352
19071
|
var printers$2 = {
|
|
18353
19072
|
graphql: printerGraphql
|
|
18354
19073
|
};
|
|
@@ -18358,19 +19077,20 @@ var languageGraphql = {
|
|
|
18358
19077
|
printers: printers$2
|
|
18359
19078
|
};
|
|
18360
19079
|
|
|
18361
|
-
var _require$$0$builders$
|
|
18362
|
-
var hardline$
|
|
18363
|
-
var literalline$
|
|
18364
|
-
var concat$
|
|
18365
|
-
var markAsRoot$
|
|
18366
|
-
var 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;
|
|
18367
19086
|
|
|
18368
|
-
function embed$
|
|
19087
|
+
function embed$4(path, print, textToDoc, options) {
|
|
18369
19088
|
var node = path.getValue();
|
|
18370
19089
|
|
|
18371
19090
|
if (node.type === "code" && node.lang !== null) {
|
|
18372
19091
|
// only look for the first string so as to support [markdown-preview-enhanced](https://shd101wyy.github.io/markdown-preview-enhanced/#/code-chunk)
|
|
18373
|
-
var
|
|
19092
|
+
var langMatch = node.lang.match(/^[A-Za-z0-9_-]+/);
|
|
19093
|
+
var lang = langMatch ? langMatch[0] : "";
|
|
18374
19094
|
var parser = getParserName(lang);
|
|
18375
19095
|
|
|
18376
19096
|
if (parser) {
|
|
@@ -18379,10 +19099,16 @@ function embed$2(path, print, textToDoc, options) {
|
|
|
18379
19099
|
var doc$$2 = textToDoc(node.value, {
|
|
18380
19100
|
parser: parser
|
|
18381
19101
|
});
|
|
18382
|
-
return markAsRoot$
|
|
19102
|
+
return markAsRoot$3(concat$11([style, node.lang, hardline$10, replaceNewlinesWithLiterallines(doc$$2), style]));
|
|
18383
19103
|
}
|
|
18384
19104
|
}
|
|
18385
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
|
+
|
|
18386
19112
|
return null;
|
|
18387
19113
|
|
|
18388
19114
|
function getParserName(lang) {
|
|
@@ -18390,7 +19116,7 @@ function embed$2(path, print, textToDoc, options) {
|
|
|
18390
19116
|
plugins: options.plugins
|
|
18391
19117
|
});
|
|
18392
19118
|
var language = supportInfo.languages.find(function (language) {
|
|
18393
|
-
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) {
|
|
18394
19120
|
return ext.substring(1) === lang;
|
|
18395
19121
|
});
|
|
18396
19122
|
});
|
|
@@ -18403,45 +19129,18 @@ function embed$2(path, print, textToDoc, options) {
|
|
|
18403
19129
|
}
|
|
18404
19130
|
|
|
18405
19131
|
function replaceNewlinesWithLiterallines(doc$$2) {
|
|
18406
|
-
return mapDoc$
|
|
18407
|
-
return typeof currentDoc === "string" && currentDoc.includes("\n") ? concat$
|
|
18408
|
-
return i % 2 === 0 ? v : literalline$
|
|
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;
|
|
18409
19135
|
})) : currentDoc;
|
|
18410
19136
|
});
|
|
18411
19137
|
}
|
|
18412
19138
|
}
|
|
18413
19139
|
|
|
18414
|
-
var embed_1$
|
|
19140
|
+
var embed_1$4 = embed$4;
|
|
18415
19141
|
|
|
18416
|
-
|
|
18417
|
-
|
|
18418
|
-
|
|
18419
|
-
if (text.indexOf("---") === 0) {
|
|
18420
|
-
delimiter = "---";
|
|
18421
|
-
} else if (text.indexOf("+++") === 0) {
|
|
18422
|
-
delimiter = "+++";
|
|
18423
|
-
}
|
|
18424
|
-
|
|
18425
|
-
var end = -1;
|
|
18426
|
-
|
|
18427
|
-
if (!delimiter || (end = text.indexOf("\n".concat(delimiter), 3)) === -1) {
|
|
18428
|
-
return {
|
|
18429
|
-
frontMatter: null,
|
|
18430
|
-
content: text
|
|
18431
|
-
};
|
|
18432
|
-
}
|
|
18433
|
-
|
|
18434
|
-
end = end + 4;
|
|
18435
|
-
return {
|
|
18436
|
-
frontMatter: text.slice(0, end),
|
|
18437
|
-
content: text.slice(end)
|
|
18438
|
-
};
|
|
18439
|
-
}
|
|
18440
|
-
|
|
18441
|
-
var frontMatter = parse$3;
|
|
18442
|
-
|
|
18443
|
-
var pragma$2 = createCommonjsModule(function (module) {
|
|
18444
|
-
"use strict";
|
|
19142
|
+
var pragma$6 = createCommonjsModule(function (module) {
|
|
19143
|
+
"use strict";
|
|
18445
19144
|
|
|
18446
19145
|
var pragmas = ["format", "prettier"];
|
|
18447
19146
|
|
|
@@ -18460,25 +19159,44 @@ var pragma$2 = createCommonjsModule(function (module) {
|
|
|
18460
19159
|
insertPragma: function insertPragma(text) {
|
|
18461
19160
|
var extracted = frontMatter(text);
|
|
18462
19161
|
var pragma = "<!-- @".concat(pragmas[0], " -->");
|
|
18463
|
-
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);
|
|
18464
19163
|
}
|
|
18465
19164
|
};
|
|
18466
19165
|
});
|
|
18467
19166
|
|
|
18468
|
-
|
|
18469
|
-
var
|
|
18470
|
-
|
|
18471
|
-
|
|
18472
|
-
|
|
18473
|
-
|
|
18474
|
-
|
|
18475
|
-
|
|
18476
|
-
|
|
18477
|
-
|
|
18478
|
-
|
|
18479
|
-
|
|
18480
|
-
|
|
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;
|
|
18481
19198
|
var printDocToString$2 = doc.printer.printDocToString;
|
|
19199
|
+
var getOrderedListItemInfo = utils$6.getOrderedListItemInfo;
|
|
18482
19200
|
var SINGLE_LINE_NODE_TYPES = ["heading", "tableCell", "link"];
|
|
18483
19201
|
var SIBLING_NODE_TYPES = ["listItem", "definition", "footnoteDefinition"];
|
|
18484
19202
|
var INLINE_NODE_TYPES = ["liquidNode", "inlineCode", "emphasis", "strong", "delete", "link", "linkReference", "image", "imageReference", "footnote", "footnoteReference", "sentence", "whitespace", "word", "break"];
|
|
@@ -18488,7 +19206,7 @@ function genericPrint$5(path, options, print) {
|
|
|
18488
19206
|
var node = path.getValue();
|
|
18489
19207
|
|
|
18490
19208
|
if (shouldRemainTheSameContent(path)) {
|
|
18491
|
-
return concat$
|
|
19209
|
+
return concat$10(util.splitText(options.originalText.slice(node.position.start.offset, node.position.end.offset), options).map(function (node) {
|
|
18492
19210
|
return node.type === "word" ? node.value : node.value === "" ? "" : printLine(path, node.value, options);
|
|
18493
19211
|
}));
|
|
18494
19212
|
}
|
|
@@ -18499,7 +19217,7 @@ function genericPrint$5(path, options, print) {
|
|
|
18499
19217
|
return "";
|
|
18500
19218
|
}
|
|
18501
19219
|
|
|
18502
|
-
return concat$
|
|
19220
|
+
return concat$10([normalizeDoc(printRoot(path, options, print)), hardline$9]);
|
|
18503
19221
|
|
|
18504
19222
|
case "paragraph":
|
|
18505
19223
|
return printChildren(path, options, print, {
|
|
@@ -18539,14 +19257,14 @@ function genericPrint$5(path, options, print) {
|
|
|
18539
19257
|
var hasPrevOrNextWord = // `1*2*3` is considered emphais but `1_2_3` is not
|
|
18540
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;
|
|
18541
19259
|
var style = hasPrevOrNextWord || getAncestorNode$2(path, "emphasis") ? "*" : "_";
|
|
18542
|
-
return concat$
|
|
19260
|
+
return concat$10([style, printChildren(path, options, print), style]);
|
|
18543
19261
|
}
|
|
18544
19262
|
|
|
18545
19263
|
case "strong":
|
|
18546
|
-
return concat$
|
|
19264
|
+
return concat$10(["**", printChildren(path, options, print), "**"]);
|
|
18547
19265
|
|
|
18548
19266
|
case "delete":
|
|
18549
|
-
return concat$
|
|
19267
|
+
return concat$10(["~~", printChildren(path, options, print), "~~"]);
|
|
18550
19268
|
|
|
18551
19269
|
case "inlineCode":
|
|
18552
19270
|
{
|
|
@@ -18555,37 +19273,41 @@ function genericPrint$5(path, options, print) {
|
|
|
18555
19273
|
var _style = backtickCount === 1 ? "``" : "`";
|
|
18556
19274
|
|
|
18557
19275
|
var gap = backtickCount ? " " : "";
|
|
18558
|
-
return concat$
|
|
19276
|
+
return concat$10([_style, gap, node.value, gap, _style]);
|
|
18559
19277
|
}
|
|
18560
19278
|
|
|
18561
19279
|
case "link":
|
|
18562
19280
|
switch (options.originalText[node.position.start.offset]) {
|
|
18563
19281
|
case "<":
|
|
18564
|
-
|
|
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
|
+
}
|
|
18565
19288
|
|
|
18566
19289
|
case "[":
|
|
18567
|
-
return concat$
|
|
19290
|
+
return concat$10(["[", printChildren(path, options, print), "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"]);
|
|
18568
19291
|
|
|
18569
19292
|
default:
|
|
18570
19293
|
return options.originalText.slice(node.position.start.offset, node.position.end.offset);
|
|
18571
19294
|
}
|
|
18572
19295
|
|
|
18573
19296
|
case "image":
|
|
18574
|
-
return concat$
|
|
19297
|
+
return concat$10([""), printTitle(node.title, options), ")"]);
|
|
18575
19298
|
|
|
18576
19299
|
case "blockquote":
|
|
18577
|
-
return concat$
|
|
19300
|
+
return concat$10(["> ", align$2("> ", printChildren(path, options, print))]);
|
|
18578
19301
|
|
|
18579
19302
|
case "heading":
|
|
18580
|
-
return concat$
|
|
19303
|
+
return concat$10(["#".repeat(node.depth) + " ", printChildren(path, options, print)]);
|
|
18581
19304
|
|
|
18582
19305
|
case "code":
|
|
18583
19306
|
{
|
|
18584
|
-
if (
|
|
18585
|
-
/^\n?( {4,}|\t)/.test(options.originalText.slice(node.position.start.offset, node.position.end.offset))) {
|
|
19307
|
+
if (node.isIndented) {
|
|
18586
19308
|
// indented code block
|
|
18587
19309
|
var alignment = " ".repeat(4);
|
|
18588
|
-
return align$2(alignment, concat$
|
|
19310
|
+
return align$2(alignment, concat$10([alignment, join$7(hardline$9, node.value.split("\n"))]));
|
|
18589
19311
|
} // fenced code block
|
|
18590
19312
|
|
|
18591
19313
|
|
|
@@ -18593,11 +19315,12 @@ function genericPrint$5(path, options, print) {
|
|
|
18593
19315
|
|
|
18594
19316
|
var _style2 = styleUnit.repeat(Math.max(3, util.getMaxContinuousCount(node.value, styleUnit) + 1));
|
|
18595
19317
|
|
|
18596
|
-
return concat$
|
|
19318
|
+
return concat$10([_style2, node.lang || "", hardline$9, join$7(hardline$9, node.value.split("\n")), hardline$9, _style2]);
|
|
18597
19319
|
}
|
|
18598
19320
|
|
|
18599
|
-
case "
|
|
18600
|
-
|
|
19321
|
+
case "yaml":
|
|
19322
|
+
case "toml":
|
|
19323
|
+
return options.originalText.slice(node.position.start.offset, node.position.end.offset);
|
|
18601
19324
|
|
|
18602
19325
|
case "html":
|
|
18603
19326
|
{
|
|
@@ -18605,25 +19328,23 @@ function genericPrint$5(path, options, print) {
|
|
|
18605
19328
|
|
|
18606
19329
|
var value = _parentNode2.type === "root" && util.getLast(_parentNode2.children) === node ? node.value.trimRight() : node.value;
|
|
18607
19330
|
var isHtmlComment = /^<!--[\s\S]*-->$/.test(value);
|
|
18608
|
-
return replaceNewlinesWith(value, isHtmlComment ? hardline$
|
|
19331
|
+
return replaceNewlinesWith(value, isHtmlComment ? hardline$9 : markAsRoot$2(literalline$4));
|
|
18609
19332
|
}
|
|
18610
19333
|
|
|
18611
19334
|
case "list":
|
|
18612
19335
|
{
|
|
18613
19336
|
var nthSiblingIndex = getNthListSiblingIndex(node, path.getParentNode());
|
|
18614
|
-
var isGitDiffFriendlyOrderedList = node.ordered && node.children.length > 1 &&
|
|
19337
|
+
var isGitDiffFriendlyOrderedList = node.ordered && node.children.length > 1 && +getOrderedListItemInfo(node.children[1], options.originalText).numberText === 1;
|
|
18615
19338
|
return printChildren(path, options, print, {
|
|
18616
19339
|
processor: function processor(childPath, index) {
|
|
18617
19340
|
var prefix = getPrefix();
|
|
18618
|
-
return concat$
|
|
19341
|
+
return concat$10([prefix, align$2(" ".repeat(prefix.length), printListItem(childPath, options, print, prefix))]);
|
|
18619
19342
|
|
|
18620
19343
|
function getPrefix() {
|
|
18621
|
-
var rawPrefix = node.ordered ? (index === 0 ? node.start : isGitDiffFriendlyOrderedList ? 1 : node.start + index) + (nthSiblingIndex % 2 === 0 ? ". " : ") ") : nthSiblingIndex % 2 === 0 ? "- " : "* ";
|
|
18622
|
-
|
|
18623
|
-
|
|
18624
|
-
|
|
18625
|
-
var listItem = childPath.getValue();
|
|
18626
|
-
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;
|
|
18627
19348
|
}
|
|
18628
19349
|
}
|
|
18629
19350
|
});
|
|
@@ -18643,35 +19364,35 @@ function genericPrint$5(path, options, print) {
|
|
|
18643
19364
|
}
|
|
18644
19365
|
|
|
18645
19366
|
case "linkReference":
|
|
18646
|
-
return concat$
|
|
19367
|
+
return concat$10(["[", printChildren(path, options, print), "]", node.referenceType === "full" ? concat$10(["[", node.identifier, "]"]) : node.referenceType === "collapsed" ? "[]" : ""]);
|
|
18647
19368
|
|
|
18648
19369
|
case "imageReference":
|
|
18649
19370
|
switch (node.referenceType) {
|
|
18650
19371
|
case "full":
|
|
18651
|
-
return concat$
|
|
19372
|
+
return concat$10(["![", node.alt || "", "][", node.identifier, "]"]);
|
|
18652
19373
|
|
|
18653
19374
|
default:
|
|
18654
|
-
return concat$
|
|
19375
|
+
return concat$10(["![", node.alt, "]", node.referenceType === "collapsed" ? "[]" : ""]);
|
|
18655
19376
|
}
|
|
18656
19377
|
|
|
18657
19378
|
case "definition":
|
|
18658
19379
|
{
|
|
18659
19380
|
var lineOrSpace = options.proseWrap === "always" ? line$6 : " ";
|
|
18660
|
-
return group$
|
|
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)])]))]));
|
|
18661
19382
|
}
|
|
18662
19383
|
|
|
18663
19384
|
case "footnote":
|
|
18664
|
-
return concat$
|
|
19385
|
+
return concat$10(["[^", printChildren(path, options, print), "]"]);
|
|
18665
19386
|
|
|
18666
19387
|
case "footnoteReference":
|
|
18667
|
-
return concat$
|
|
19388
|
+
return concat$10(["[^", node.identifier, "]"]);
|
|
18668
19389
|
|
|
18669
19390
|
case "footnoteDefinition":
|
|
18670
19391
|
{
|
|
18671
19392
|
var _nextNode2 = path.getParentNode().children[path.getName() + 1];
|
|
18672
|
-
return concat$
|
|
19393
|
+
return concat$10(["[^", node.identifier, "]: ", group$10(concat$10([align$2(" ".repeat(options.tabWidth), printChildren(path, options, print, {
|
|
18673
19394
|
processor: function processor(childPath, index) {
|
|
18674
|
-
return index === 0 ? group$
|
|
19395
|
+
return index === 0 ? group$10(concat$10([softline$5, softline$5, childPath.call(print)])) : childPath.call(print);
|
|
18675
19396
|
}
|
|
18676
19397
|
})), _nextNode2 && _nextNode2.type === "footnoteDefinition" ? softline$5 : ""]))]);
|
|
18677
19398
|
}
|
|
@@ -18683,10 +19404,10 @@ function genericPrint$5(path, options, print) {
|
|
|
18683
19404
|
return printChildren(path, options, print);
|
|
18684
19405
|
|
|
18685
19406
|
case "break":
|
|
18686
|
-
return /\s/.test(options.originalText[node.position.start.offset]) ? concat$
|
|
19407
|
+
return /\s/.test(options.originalText[node.position.start.offset]) ? concat$10([" ", markAsRoot$2(literalline$4)]) : concat$10(["\\", hardline$9]);
|
|
18687
19408
|
|
|
18688
19409
|
case "liquidNode":
|
|
18689
|
-
return replaceNewlinesWith(node.value, hardline$
|
|
19410
|
+
return replaceNewlinesWith(node.value, hardline$9);
|
|
18690
19411
|
|
|
18691
19412
|
case "tableRow": // handled in "table"
|
|
18692
19413
|
|
|
@@ -18700,7 +19421,7 @@ function genericPrint$5(path, options, print) {
|
|
|
18700
19421
|
function printListItem(path, options, print, listPrefix) {
|
|
18701
19422
|
var node = path.getValue();
|
|
18702
19423
|
var prefix = node.checked === null ? "" : node.checked ? "[x] " : "[ ] ";
|
|
18703
|
-
return concat$
|
|
19424
|
+
return concat$10([prefix, printChildren(path, options, print, {
|
|
18704
19425
|
processor: function processor(childPath, index) {
|
|
18705
19426
|
if (index === 0 && childPath.getValue().type !== "list") {
|
|
18706
19427
|
return align$2(" ".repeat(prefix.length), childPath.call(print));
|
|
@@ -18708,7 +19429,7 @@ function printListItem(path, options, print, listPrefix) {
|
|
|
18708
19429
|
|
|
18709
19430
|
var alignment = " ".repeat(clamp(options.tabWidth - listPrefix.length, 0, 3) // 4+ will cause indented code block
|
|
18710
19431
|
);
|
|
18711
|
-
return concat$
|
|
19432
|
+
return concat$10([alignment, align$2(alignment, childPath.call(print))]);
|
|
18712
19433
|
}
|
|
18713
19434
|
})]);
|
|
18714
19435
|
}
|
|
@@ -18795,7 +19516,7 @@ function getAncestorNode$2(path, typeOrTypes) {
|
|
|
18795
19516
|
|
|
18796
19517
|
function printLine(path, value, options) {
|
|
18797
19518
|
if (options.proseWrap === "preserve" && value === "\n") {
|
|
18798
|
-
return hardline$
|
|
19519
|
+
return hardline$9;
|
|
18799
19520
|
}
|
|
18800
19521
|
|
|
18801
19522
|
var isBreakable = options.proseWrap === "always" && !getAncestorNode$2(path, SINGLE_LINE_NODE_TYPES);
|
|
@@ -18821,10 +19542,10 @@ function printTable(path, options, print) {
|
|
|
18821
19542
|
return 3;
|
|
18822
19543
|
}) // minimum width = 3 (---, :--, :-:, --:)
|
|
18823
19544
|
);
|
|
18824
|
-
return join$7(hardline$
|
|
19545
|
+
return join$7(hardline$9, [printRow(contents[0]), printSeparator(), join$7(hardline$9, contents.slice(1).map(printRow))]);
|
|
18825
19546
|
|
|
18826
19547
|
function printSeparator() {
|
|
18827
|
-
return concat$
|
|
19548
|
+
return concat$10(["| ", join$7(" | ", columnMaxWidths.map(function (width, index) {
|
|
18828
19549
|
switch (node.align[index]) {
|
|
18829
19550
|
case "left":
|
|
18830
19551
|
return ":" + "-".repeat(width - 1);
|
|
@@ -18842,7 +19563,7 @@ function printTable(path, options, print) {
|
|
|
18842
19563
|
}
|
|
18843
19564
|
|
|
18844
19565
|
function printRow(rowContents) {
|
|
18845
|
-
return concat$
|
|
19566
|
+
return concat$10(["| ", join$7(" | ", rowContents.map(function (rowContent, columnIndex) {
|
|
18846
19567
|
switch (node.align[columnIndex]) {
|
|
18847
19568
|
case "right":
|
|
18848
19569
|
return alignRight(rowContent, columnMaxWidths[columnIndex]);
|
|
@@ -18857,18 +19578,18 @@ function printTable(path, options, print) {
|
|
|
18857
19578
|
}
|
|
18858
19579
|
|
|
18859
19580
|
function alignLeft(text, width) {
|
|
18860
|
-
return concat$
|
|
19581
|
+
return concat$10([text, " ".repeat(width - util.getStringWidth(text))]);
|
|
18861
19582
|
}
|
|
18862
19583
|
|
|
18863
19584
|
function alignRight(text, width) {
|
|
18864
|
-
return concat$
|
|
19585
|
+
return concat$10([" ".repeat(width - util.getStringWidth(text)), text]);
|
|
18865
19586
|
}
|
|
18866
19587
|
|
|
18867
19588
|
function alignCenter(text, width) {
|
|
18868
19589
|
var spaces = width - util.getStringWidth(text);
|
|
18869
19590
|
var left = Math.floor(spaces / 2);
|
|
18870
19591
|
var right = spaces - left;
|
|
18871
|
-
return concat$
|
|
19592
|
+
return concat$10([" ".repeat(left), text, " ".repeat(right)]);
|
|
18872
19593
|
}
|
|
18873
19594
|
}
|
|
18874
19595
|
|
|
@@ -18918,7 +19639,7 @@ function printRoot(path, options, print) {
|
|
|
18918
19639
|
var ignoreRange = ignoreRanges[0];
|
|
18919
19640
|
|
|
18920
19641
|
if (index === ignoreRange.start.index) {
|
|
18921
|
-
return concat$
|
|
19642
|
+
return concat$10([children[ignoreRange.start.index].value, options.originalText.slice(ignoreRange.start.offset, ignoreRange.end.offset), children[ignoreRange.end.index].value]);
|
|
18922
19643
|
}
|
|
18923
19644
|
|
|
18924
19645
|
if (ignoreRange.start.index < index && index < ignoreRange.end.index) {
|
|
@@ -18938,7 +19659,7 @@ function printRoot(path, options, print) {
|
|
|
18938
19659
|
|
|
18939
19660
|
function printChildren(path, options, print, events) {
|
|
18940
19661
|
events = events || {};
|
|
18941
|
-
var postprocessor = events.postprocessor || concat$
|
|
19662
|
+
var postprocessor = events.postprocessor || concat$10;
|
|
18942
19663
|
|
|
18943
19664
|
var processor = events.processor || function (childPath) {
|
|
18944
19665
|
return childPath.call(print);
|
|
@@ -18960,14 +19681,14 @@ function printChildren(path, options, print, events) {
|
|
|
18960
19681
|
};
|
|
18961
19682
|
|
|
18962
19683
|
if (!shouldNotPrePrintHardline(childNode, data)) {
|
|
18963
|
-
parts.push(hardline$
|
|
19684
|
+
parts.push(hardline$9);
|
|
18964
19685
|
|
|
18965
19686
|
if (shouldPrePrintDoubleHardline(childNode, data) || shouldPrePrintTripleHardline(childNode, data)) {
|
|
18966
|
-
parts.push(hardline$
|
|
19687
|
+
parts.push(hardline$9);
|
|
18967
19688
|
}
|
|
18968
19689
|
|
|
18969
19690
|
if (shouldPrePrintTripleHardline(childNode, data)) {
|
|
18970
|
-
parts.push(hardline$
|
|
19691
|
+
parts.push(hardline$9);
|
|
18971
19692
|
}
|
|
18972
19693
|
}
|
|
18973
19694
|
|
|
@@ -19008,7 +19729,7 @@ function shouldPrePrintDoubleHardline(node, data) {
|
|
|
19008
19729
|
|
|
19009
19730
|
function shouldPrePrintTripleHardline(node, data) {
|
|
19010
19731
|
var isPrevNodeList = data.prevNode && data.prevNode.type === "list";
|
|
19011
|
-
var isIndentedCode = node.type === "code" &&
|
|
19732
|
+
var isIndentedCode = node.type === "code" && node.isIndented;
|
|
19012
19733
|
return isPrevNodeList && isIndentedCode;
|
|
19013
19734
|
}
|
|
19014
19735
|
|
|
@@ -19018,7 +19739,7 @@ function shouldRemainTheSameContent(path) {
|
|
|
19018
19739
|
}
|
|
19019
19740
|
|
|
19020
19741
|
function normalizeDoc(doc$$2) {
|
|
19021
|
-
return mapDoc$
|
|
19742
|
+
return mapDoc$4(doc$$2, function (currentDoc) {
|
|
19022
19743
|
if (!currentDoc.parts) {
|
|
19023
19744
|
return currentDoc;
|
|
19024
19745
|
}
|
|
@@ -19092,10 +19813,16 @@ function clamp(value, min, max) {
|
|
|
19092
19813
|
}
|
|
19093
19814
|
|
|
19094
19815
|
function clean$6(ast, newObj, parent) {
|
|
19095
|
-
delete newObj.position;
|
|
19816
|
+
delete newObj.position;
|
|
19817
|
+
delete newObj.raw; // front-matter
|
|
19818
|
+
// for codeblock
|
|
19096
19819
|
|
|
19097
|
-
if (ast.type === "code") {
|
|
19820
|
+
if (ast.type === "code" || ast.type === "yaml") {
|
|
19098
19821
|
delete newObj.value;
|
|
19822
|
+
}
|
|
19823
|
+
|
|
19824
|
+
if (ast.type === "list") {
|
|
19825
|
+
delete newObj.isAligned;
|
|
19099
19826
|
} // for whitespace: "\n" and " " are considered the same
|
|
19100
19827
|
|
|
19101
19828
|
|
|
@@ -19104,7 +19831,7 @@ function clean$6(ast, newObj, parent) {
|
|
|
19104
19831
|
} // for insert pragma
|
|
19105
19832
|
|
|
19106
19833
|
|
|
19107
|
-
if (parent && parent.type === "root" && parent.children.length > 0 && (parent.children[0] === ast || parent.children[0].type === "
|
|
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)) {
|
|
19108
19835
|
return null;
|
|
19109
19836
|
}
|
|
19110
19837
|
}
|
|
@@ -19122,70 +19849,62 @@ function hasPrettierIgnore$1(path) {
|
|
|
19122
19849
|
|
|
19123
19850
|
var printerMarkdown = {
|
|
19124
19851
|
print: genericPrint$5,
|
|
19125
|
-
embed: embed_1$
|
|
19852
|
+
embed: embed_1$4,
|
|
19126
19853
|
massageAstNode: clean$6,
|
|
19127
19854
|
hasPrettierIgnore: hasPrettierIgnore$1,
|
|
19128
|
-
insertPragma: pragma$
|
|
19855
|
+
insertPragma: pragma$6.insertPragma
|
|
19129
19856
|
};
|
|
19130
19857
|
|
|
19131
|
-
var CATEGORY_MARKDOWN = "Markdown"; // format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
|
|
19132
|
-
|
|
19133
19858
|
var options$12 = {
|
|
19134
|
-
proseWrap:
|
|
19135
|
-
since: "1.8.2",
|
|
19136
|
-
category: CATEGORY_MARKDOWN,
|
|
19137
|
-
type: "choice",
|
|
19138
|
-
default: [{
|
|
19139
|
-
since: "1.8.2",
|
|
19140
|
-
value: true
|
|
19141
|
-
}, {
|
|
19142
|
-
since: "1.9.0",
|
|
19143
|
-
value: "preserve"
|
|
19144
|
-
}],
|
|
19145
|
-
description: "How to wrap prose. (markdown)",
|
|
19146
|
-
choices: [{
|
|
19147
|
-
since: "1.9.0",
|
|
19148
|
-
value: "always",
|
|
19149
|
-
description: "Wrap prose if it exceeds the print width."
|
|
19150
|
-
}, {
|
|
19151
|
-
since: "1.9.0",
|
|
19152
|
-
value: "never",
|
|
19153
|
-
description: "Do not wrap prose."
|
|
19154
|
-
}, {
|
|
19155
|
-
since: "1.9.0",
|
|
19156
|
-
value: "preserve",
|
|
19157
|
-
description: "Wrap prose as-is."
|
|
19158
|
-
}, {
|
|
19159
|
-
value: false,
|
|
19160
|
-
deprecated: "1.9.0",
|
|
19161
|
-
redirect: "never"
|
|
19162
|
-
}, {
|
|
19163
|
-
value: true,
|
|
19164
|
-
deprecated: "1.9.0",
|
|
19165
|
-
redirect: "always"
|
|
19166
|
-
}]
|
|
19167
|
-
},
|
|
19859
|
+
proseWrap: commonOptions.proseWrap,
|
|
19168
19860
|
singleQuote: commonOptions.singleQuote
|
|
19169
19861
|
};
|
|
19170
19862
|
|
|
19171
|
-
|
|
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
|
+
};
|
|
19172
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
|
+
});
|
|
19899
|
+
|
|
19900
|
+
var require$$0$14 = ( markdown$1 && markdown ) || markdown$1;
|
|
19173
19901
|
|
|
19174
|
-
var languages$3 = [{
|
|
19175
|
-
name: "Markdown",
|
|
19902
|
+
var languages$3 = [languageExtend({}, require$$0$14, {
|
|
19176
19903
|
since: "1.8.0",
|
|
19177
19904
|
parsers: ["remark"],
|
|
19178
|
-
aliases: ["pandoc"],
|
|
19179
|
-
aceMode: "markdown",
|
|
19180
|
-
codemirrorMode: "gfm",
|
|
19181
|
-
codemirrorMimeType: "text/x-gfm",
|
|
19182
|
-
wrap: true,
|
|
19183
|
-
extensions: [".md", ".markdown", ".mdown", ".mdwn", ".mkd", ".mkdn", ".mkdown", ".ron", ".workbook"],
|
|
19184
19905
|
filenames: ["README"],
|
|
19185
|
-
tmScope: "source.gfm",
|
|
19186
|
-
linguistLanguageId: 222,
|
|
19187
19906
|
vscodeLanguageIds: ["markdown"]
|
|
19188
|
-
}];
|
|
19907
|
+
})];
|
|
19189
19908
|
var printers$3 = {
|
|
19190
19909
|
mdast: printerMarkdown
|
|
19191
19910
|
};
|
|
@@ -19195,11 +19914,11 @@ var languageMarkdown = {
|
|
|
19195
19914
|
printers: printers$3
|
|
19196
19915
|
};
|
|
19197
19916
|
|
|
19198
|
-
var _require$$0$builders$
|
|
19199
|
-
var concat$
|
|
19200
|
-
var 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;
|
|
19201
19920
|
|
|
19202
|
-
function embed$
|
|
19921
|
+
function embed$6(path, print, textToDoc, options) {
|
|
19203
19922
|
var node = path.getValue();
|
|
19204
19923
|
var parent = path.getParentNode();
|
|
19205
19924
|
|
|
@@ -19239,16 +19958,30 @@ function embed$4(path, print, textToDoc, options) {
|
|
|
19239
19958
|
return null;
|
|
19240
19959
|
}
|
|
19241
19960
|
|
|
19242
|
-
return concat$
|
|
19961
|
+
return concat$13([options.originalText.slice(node.start, node.contentStart), hardline$12, textToDoc(options.originalText.slice(node.contentStart, node.contentEnd), {
|
|
19243
19962
|
parser: parser
|
|
19244
19963
|
}), options.originalText.slice(node.contentEnd, node.end)]);
|
|
19245
19964
|
}
|
|
19246
19965
|
|
|
19247
|
-
var embed_1$
|
|
19966
|
+
var embed_1$6 = embed$6;
|
|
19248
19967
|
|
|
19249
|
-
|
|
19250
|
-
|
|
19251
|
-
|
|
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;
|
|
19252
19985
|
|
|
19253
19986
|
function genericPrint$6(path, options, print) {
|
|
19254
19987
|
var n = path.getValue();
|
|
@@ -19266,10 +19999,10 @@ function genericPrint$6(path, options, print) {
|
|
|
19266
19999
|
res.push(options.originalText.slice(index, n.end)); // Only force a trailing newline if there were any contents.
|
|
19267
20000
|
|
|
19268
20001
|
if (n.tag === "root" && n.children.length) {
|
|
19269
|
-
res.push(hardline$
|
|
20002
|
+
res.push(hardline$11);
|
|
19270
20003
|
}
|
|
19271
20004
|
|
|
19272
|
-
return concat$
|
|
20005
|
+
return concat$12(res);
|
|
19273
20006
|
}
|
|
19274
20007
|
|
|
19275
20008
|
var clean$7 = function clean(ast, newObj) {
|
|
@@ -19281,26 +20014,49 @@ var clean$7 = function clean(ast, newObj) {
|
|
|
19281
20014
|
|
|
19282
20015
|
var printerVue = {
|
|
19283
20016
|
print: genericPrint$6,
|
|
19284
|
-
embed: embed_1$
|
|
19285
|
-
|
|
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
|
|
19286
20040
|
};
|
|
19287
20041
|
|
|
19288
|
-
|
|
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
|
+
});
|
|
19289
20052
|
|
|
20053
|
+
var require$$0$15 = ( vue$1 && vue ) || vue$1;
|
|
19290
20054
|
|
|
19291
|
-
var languages$4 = [{
|
|
19292
|
-
name: "Vue",
|
|
20055
|
+
var languages$4 = [languageExtend({}, require$$0$15, {
|
|
19293
20056
|
since: "1.10.0",
|
|
19294
20057
|
parsers: ["vue"],
|
|
19295
|
-
group: "HTML",
|
|
19296
|
-
tmScope: "text.html.vue",
|
|
19297
|
-
aceMode: "html",
|
|
19298
|
-
codemirrorMode: "htmlmixed",
|
|
19299
|
-
codemirrorMimeType: "text/html",
|
|
19300
|
-
extensions: [".vue"],
|
|
19301
|
-
linguistLanguageId: 146,
|
|
19302
20058
|
vscodeLanguageIds: ["vue"]
|
|
19303
|
-
}];
|
|
20059
|
+
})];
|
|
19304
20060
|
var printers$4 = {
|
|
19305
20061
|
vue: printerVue
|
|
19306
20062
|
};
|
|
@@ -19309,9 +20065,677 @@ var languageVue = {
|
|
|
19309
20065
|
printers: printers$4
|
|
19310
20066
|
};
|
|
19311
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
|
+
|
|
19312
20736
|
var version = require$$0.version;
|
|
19313
20737
|
var getSupportInfo = support.getSupportInfo;
|
|
19314
|
-
var internalPlugins = [languageJs, languageCss, languageGraphql, languageMarkdown, languageVue];
|
|
20738
|
+
var internalPlugins = [languageJs, languageCss, languageGraphql, languageMarkdown, languageVue, languageYaml];
|
|
19315
20739
|
|
|
19316
20740
|
var isArray = Array.isArray || function (arr) {
|
|
19317
20741
|
return Object.prototype.toString.call(arr) === "[object Array]";
|