prettier 2.1.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin-prettier.js +182 -149
- package/doc.js +113 -136
- package/esm/parser-angular.mjs +46 -0
- package/esm/parser-babel.mjs +1 -0
- package/esm/parser-espree.mjs +1 -0
- package/esm/parser-flow.mjs +1 -0
- package/esm/parser-glimmer.mjs +1 -0
- package/esm/parser-graphql.mjs +1 -0
- package/esm/parser-html.mjs +113 -0
- package/esm/parser-markdown.mjs +19 -0
- package/esm/parser-meriyah.mjs +1 -0
- package/esm/parser-postcss.mjs +1 -0
- package/esm/parser-typescript.mjs +1 -0
- package/esm/parser-yaml.mjs +15 -0
- package/esm/standalone.mjs +55 -0
- package/index.js +10821 -7937
- package/package.json +3 -2
- package/parser-angular.js +7 -7
- package/parser-babel.js +1 -1
- package/parser-espree.js +1 -0
- package/parser-flow.js +1 -1
- package/parser-glimmer.js +1 -1
- package/parser-graphql.js +1 -1
- package/parser-html.js +15 -15
- package/parser-markdown.js +4 -4
- package/parser-meriyah.js +1 -0
- package/parser-postcss.js +1 -8
- package/parser-typescript.js +1 -14
- package/parser-yaml.js +2 -2
- package/standalone.js +42 -2
- package/third-party.js +33 -140
package/bin-prettier.js
CHANGED
|
@@ -7,8 +7,8 @@ var readline = require('readline');
|
|
|
7
7
|
var os = require('os');
|
|
8
8
|
var tty = require('tty');
|
|
9
9
|
var util$2 = require('util');
|
|
10
|
-
var
|
|
11
|
-
var
|
|
10
|
+
var stream_1 = require('stream');
|
|
11
|
+
var events_1 = require('events');
|
|
12
12
|
|
|
13
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
14
|
|
|
@@ -18,8 +18,8 @@ var readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);
|
|
|
18
18
|
var os__default = /*#__PURE__*/_interopDefaultLegacy(os);
|
|
19
19
|
var tty__default = /*#__PURE__*/_interopDefaultLegacy(tty);
|
|
20
20
|
var util__default = /*#__PURE__*/_interopDefaultLegacy(util$2);
|
|
21
|
-
var
|
|
22
|
-
var
|
|
21
|
+
var stream_1__default = /*#__PURE__*/_interopDefaultLegacy(stream_1);
|
|
22
|
+
var events_1__default = /*#__PURE__*/_interopDefaultLegacy(events_1);
|
|
23
23
|
|
|
24
24
|
var semverCompare = function cmp(a, b) {
|
|
25
25
|
var pa = a.split('.');
|
|
@@ -58,7 +58,7 @@ var pleaseUpgradeNode = function pleaseUpgradeNode(pkg, opts) {
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
var name = "prettier";
|
|
61
|
-
var version = "2.1
|
|
61
|
+
var version = "2.2.1";
|
|
62
62
|
var description = "Prettier is an opinionated code formatter";
|
|
63
63
|
var bin = "./bin/prettier.js";
|
|
64
64
|
var repository = "prettier/prettier";
|
|
@@ -78,33 +78,34 @@ var files = [
|
|
|
78
78
|
"bin"
|
|
79
79
|
];
|
|
80
80
|
var dependencies = {
|
|
81
|
-
"@angular/compiler": "10.
|
|
81
|
+
"@angular/compiler": "10.2.3",
|
|
82
82
|
"@babel/code-frame": "7.10.4",
|
|
83
|
-
"@babel/parser": "7.
|
|
84
|
-
"@glimmer/syntax": "0.
|
|
83
|
+
"@babel/parser": "7.12.5",
|
|
84
|
+
"@glimmer/syntax": "0.66.0",
|
|
85
85
|
"@iarna/toml": "2.2.5",
|
|
86
|
-
"@typescript-eslint/typescript-estree": "
|
|
87
|
-
"angular-estree-parser": "2.2.
|
|
86
|
+
"@typescript-eslint/typescript-estree": "4.8.1",
|
|
87
|
+
"angular-estree-parser": "2.2.1",
|
|
88
88
|
"angular-html-parser": "1.7.1",
|
|
89
|
-
camelcase: "6.
|
|
89
|
+
camelcase: "6.2.0",
|
|
90
90
|
chalk: "4.1.0",
|
|
91
91
|
"ci-info": "watson/ci-info#f43f6a1cefff47fb361c88cf4b943fdbcaafe540",
|
|
92
92
|
"cjk-regex": "2.0.0",
|
|
93
93
|
cosmiconfig: "7.0.0",
|
|
94
94
|
dashify: "2.0.0",
|
|
95
|
-
diff: "
|
|
95
|
+
diff: "5.0.0",
|
|
96
96
|
editorconfig: "0.15.3",
|
|
97
|
-
"editorconfig-to-prettier": "0.
|
|
97
|
+
"editorconfig-to-prettier": "0.2.0",
|
|
98
98
|
"escape-string-regexp": "4.0.0",
|
|
99
|
+
espree: "7.3.0",
|
|
99
100
|
esutils: "2.0.3",
|
|
100
101
|
"fast-glob": "3.2.4",
|
|
101
102
|
"fast-json-stable-stringify": "2.1.0",
|
|
102
103
|
"find-parent-dir": "0.3.0",
|
|
103
|
-
"flow-parser": "0.
|
|
104
|
-
"get-
|
|
104
|
+
"flow-parser": "0.138.0",
|
|
105
|
+
"get-stdin": "8.0.0",
|
|
105
106
|
globby: "11.0.1",
|
|
106
|
-
graphql: "15.
|
|
107
|
-
"html-element-attributes": "2.
|
|
107
|
+
graphql: "15.4.0",
|
|
108
|
+
"html-element-attributes": "2.3.0",
|
|
108
109
|
"html-styles": "1.0.0",
|
|
109
110
|
"html-tag-names": "1.1.5",
|
|
110
111
|
"html-void-elements": "1.0.5",
|
|
@@ -113,12 +114,13 @@ var dependencies = {
|
|
|
113
114
|
json5: "2.1.3",
|
|
114
115
|
leven: "3.1.0",
|
|
115
116
|
"lines-and-columns": "1.1.6",
|
|
116
|
-
"linguist-languages": "7.
|
|
117
|
+
"linguist-languages": "7.12.1",
|
|
117
118
|
lodash: "4.17.20",
|
|
118
|
-
mem: "
|
|
119
|
+
mem: "8.0.0",
|
|
120
|
+
meriyah: "3.1.6",
|
|
119
121
|
minimatch: "3.0.4",
|
|
120
122
|
minimist: "1.2.5",
|
|
121
|
-
"n-readlines": "1.0.
|
|
123
|
+
"n-readlines": "1.0.1",
|
|
122
124
|
outdent: "0.7.1",
|
|
123
125
|
"parse-srcset": "ikatyang/parse-srcset#54eb9c1cb21db5c62b4d0e275d7249516df6f0ee",
|
|
124
126
|
"please-upgrade-node": "3.2.0",
|
|
@@ -129,62 +131,64 @@ var dependencies = {
|
|
|
129
131
|
"postcss-values-parser": "2.0.1",
|
|
130
132
|
"regexp-util": "1.2.2",
|
|
131
133
|
"remark-footnotes": "2.0.0",
|
|
132
|
-
"remark-math": "
|
|
134
|
+
"remark-math": "3.0.1",
|
|
133
135
|
"remark-parse": "8.0.3",
|
|
134
|
-
resolve: "1.
|
|
136
|
+
resolve: "1.19.0",
|
|
135
137
|
semver: "7.3.2",
|
|
136
138
|
"string-width": "4.2.0",
|
|
137
|
-
typescript: "4.
|
|
139
|
+
typescript: "4.1.2",
|
|
138
140
|
"unicode-regex": "3.0.0",
|
|
139
141
|
unified: "9.2.0",
|
|
140
142
|
vnopts: "1.0.2",
|
|
141
|
-
"yaml-unist-parser": "1.3.
|
|
143
|
+
"yaml-unist-parser": "1.3.1"
|
|
142
144
|
};
|
|
143
145
|
var devDependencies = {
|
|
144
|
-
"@babel/core": "7.
|
|
145
|
-
"@babel/preset-env": "7.
|
|
146
|
-
"@babel/types": "7.
|
|
147
|
-
"@glimmer/reference": "0.
|
|
146
|
+
"@babel/core": "7.12.3",
|
|
147
|
+
"@babel/preset-env": "7.12.1",
|
|
148
|
+
"@babel/types": "7.12.6",
|
|
149
|
+
"@glimmer/reference": "0.66.0",
|
|
148
150
|
"@rollup/plugin-alias": "3.1.1",
|
|
149
|
-
"@rollup/plugin-babel": "5.2.
|
|
150
|
-
"@rollup/plugin-commonjs": "
|
|
151
|
+
"@rollup/plugin-babel": "5.2.1",
|
|
152
|
+
"@rollup/plugin-commonjs": "16.0.0",
|
|
151
153
|
"@rollup/plugin-json": "4.1.0",
|
|
152
|
-
"@rollup/plugin-node-resolve": "
|
|
153
|
-
"@rollup/plugin-replace": "2.3.
|
|
154
|
+
"@rollup/plugin-node-resolve": "10.0.0",
|
|
155
|
+
"@rollup/plugin-replace": "2.3.4",
|
|
154
156
|
"@types/estree": "0.0.45",
|
|
155
|
-
"@types/node": "14.
|
|
156
|
-
"@typescript-eslint/types": "
|
|
157
|
-
"babel-
|
|
157
|
+
"@types/node": "14.14.0",
|
|
158
|
+
"@typescript-eslint/types": "4.8.1",
|
|
159
|
+
"babel-jest": "26.6.3",
|
|
160
|
+
"babel-loader": "8.2.1",
|
|
158
161
|
benchmark: "2.1.4",
|
|
159
162
|
"builtin-modules": "3.1.0",
|
|
160
163
|
"cross-env": "7.0.2",
|
|
161
|
-
cspell: "4.
|
|
162
|
-
eslint: "7.
|
|
163
|
-
"eslint-config-prettier": "6.
|
|
164
|
+
cspell: "4.2.2",
|
|
165
|
+
eslint: "7.13.0",
|
|
166
|
+
"eslint-config-prettier": "6.15.0",
|
|
164
167
|
"eslint-formatter-friendly": "7.0.0",
|
|
165
|
-
"eslint-plugin-import": "2.22.
|
|
166
|
-
"eslint-plugin-jest": "
|
|
168
|
+
"eslint-plugin-import": "2.22.1",
|
|
169
|
+
"eslint-plugin-jest": "24.1.3",
|
|
167
170
|
"eslint-plugin-prettier-internal-rules": "file:scripts/tools/eslint-plugin-prettier-internal-rules",
|
|
168
|
-
"eslint-plugin-react": "7.
|
|
169
|
-
"eslint-plugin-unicorn": "
|
|
170
|
-
execa: "4.0
|
|
171
|
-
jest: "26.
|
|
171
|
+
"eslint-plugin-react": "7.21.5",
|
|
172
|
+
"eslint-plugin-unicorn": "23.0.0",
|
|
173
|
+
execa: "4.1.0",
|
|
174
|
+
jest: "26.6.3",
|
|
172
175
|
"jest-snapshot-serializer-ansi": "1.0.0",
|
|
173
176
|
"jest-snapshot-serializer-raw": "1.1.0",
|
|
174
|
-
"jest-watch-typeahead": "0.6.
|
|
177
|
+
"jest-watch-typeahead": "0.6.1",
|
|
175
178
|
"npm-run-all": "4.1.5",
|
|
176
|
-
|
|
179
|
+
"path-browserify": "1.0.1",
|
|
180
|
+
prettier: "2.2.0",
|
|
177
181
|
rimraf: "3.0.2",
|
|
178
|
-
rollup: "2.
|
|
182
|
+
rollup: "2.33.3",
|
|
179
183
|
"rollup-plugin-node-globals": "1.4.0",
|
|
180
|
-
"rollup-plugin-terser": "7.0.
|
|
184
|
+
"rollup-plugin-terser": "7.0.2",
|
|
181
185
|
shelljs: "0.8.4",
|
|
182
186
|
"snapshot-diff": "0.8.1",
|
|
183
187
|
"strip-ansi": "6.0.0",
|
|
184
|
-
"synchronous-promise": "2.0.
|
|
185
|
-
tempy: "0.
|
|
186
|
-
"terser-webpack-plugin": "
|
|
187
|
-
webpack: "
|
|
188
|
+
"synchronous-promise": "2.0.15",
|
|
189
|
+
tempy: "1.0.0",
|
|
190
|
+
"terser-webpack-plugin": "5.0.3",
|
|
191
|
+
webpack: "5.5.1"
|
|
188
192
|
};
|
|
189
193
|
var scripts = {
|
|
190
194
|
prepublishOnly: "echo \"Error: must publish from dist/\" && exit 1",
|
|
@@ -201,17 +205,17 @@ var scripts = {
|
|
|
201
205
|
"lint:typecheck": "tsc",
|
|
202
206
|
"lint:eslint": "cross-env EFF_NO_LINK_RULES=true eslint . --format friendly",
|
|
203
207
|
"lint:changelog": "node ./scripts/lint-changelog.js",
|
|
204
|
-
"lint:prettier": "prettier
|
|
205
|
-
"lint:dist": "eslint --no-eslintrc --no-ignore --env=es6,browser --parser-options=ecmaVersion:
|
|
208
|
+
"lint:prettier": "prettier . \"!test*\" --check",
|
|
209
|
+
"lint:dist": "eslint --no-eslintrc --no-ignore --env=es6,browser --parser-options=ecmaVersion:2018 \"dist/!(bin-prettier|index|third-party).js\"",
|
|
206
210
|
"lint:spellcheck": "cspell \"**/*\" \".github/**/*\"",
|
|
207
211
|
"lint:deps": "node ./scripts/check-deps.js",
|
|
208
212
|
fix: "run-s fix:eslint fix:prettier",
|
|
209
213
|
"fix:eslint": "yarn lint:eslint --fix",
|
|
210
214
|
"fix:prettier": "yarn lint:prettier --write",
|
|
211
|
-
build: "node ./scripts/build/build.js",
|
|
215
|
+
build: "node --max-old-space-size=3072 ./scripts/build/build.js",
|
|
212
216
|
"build-docs": "node ./scripts/build-docs.js"
|
|
213
217
|
};
|
|
214
|
-
var
|
|
218
|
+
var require$$1 = {
|
|
215
219
|
name: name,
|
|
216
220
|
version: version,
|
|
217
221
|
description: description,
|
|
@@ -230,27 +234,6 @@ var _package = {
|
|
|
230
234
|
scripts: scripts
|
|
231
235
|
};
|
|
232
236
|
|
|
233
|
-
var _package$1 = /*#__PURE__*/Object.freeze({
|
|
234
|
-
__proto__: null,
|
|
235
|
-
name: name,
|
|
236
|
-
version: version,
|
|
237
|
-
description: description,
|
|
238
|
-
bin: bin,
|
|
239
|
-
repository: repository,
|
|
240
|
-
homepage: homepage,
|
|
241
|
-
author: author,
|
|
242
|
-
license: license,
|
|
243
|
-
main: main,
|
|
244
|
-
browser: browser,
|
|
245
|
-
unpkg: unpkg,
|
|
246
|
-
engines: engines,
|
|
247
|
-
files: files,
|
|
248
|
-
dependencies: dependencies,
|
|
249
|
-
devDependencies: devDependencies,
|
|
250
|
-
scripts: scripts,
|
|
251
|
-
'default': _package
|
|
252
|
-
});
|
|
253
|
-
|
|
254
237
|
var fastJsonStableStringify = function (data, opts) {
|
|
255
238
|
if (!opts) opts = {};
|
|
256
239
|
if (typeof opts === 'function') opts = {
|
|
@@ -322,7 +305,7 @@ var fastJsonStableStringify = function (data, opts) {
|
|
|
322
305
|
|
|
323
306
|
var src = require("./index");
|
|
324
307
|
|
|
325
|
-
const preserveCamelCase = string => {
|
|
308
|
+
const preserveCamelCase = (string, locale) => {
|
|
326
309
|
let isLastCharLower = false;
|
|
327
310
|
let isLastCharUpper = false;
|
|
328
311
|
let isLastLastCharUpper = false;
|
|
@@ -342,26 +325,33 @@ const preserveCamelCase = string => {
|
|
|
342
325
|
isLastCharUpper = false;
|
|
343
326
|
isLastCharLower = true;
|
|
344
327
|
} else {
|
|
345
|
-
isLastCharLower = character.toLocaleLowerCase() === character && character.toLocaleUpperCase() !== character;
|
|
328
|
+
isLastCharLower = character.toLocaleLowerCase(locale) === character && character.toLocaleUpperCase(locale) !== character;
|
|
346
329
|
isLastLastCharUpper = isLastCharUpper;
|
|
347
|
-
isLastCharUpper = character.toLocaleUpperCase() === character && character.toLocaleLowerCase() !== character;
|
|
330
|
+
isLastCharUpper = character.toLocaleUpperCase(locale) === character && character.toLocaleLowerCase(locale) !== character;
|
|
348
331
|
}
|
|
349
332
|
}
|
|
350
333
|
|
|
351
334
|
return string;
|
|
352
335
|
};
|
|
353
336
|
|
|
337
|
+
const preserveConsecutiveUppercase = input => {
|
|
338
|
+
return input.replace(/^[\p{Lu}](?![\p{Lu}])/gu, m1 => m1.toLowerCase());
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
const postProcess = (input, options) => {
|
|
342
|
+
return input.replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu, (_, p1) => p1.toLocaleUpperCase(options.locale)).replace(/\d+([\p{Alpha}\p{N}_]|$)/gu, m => m.toLocaleUpperCase(options.locale));
|
|
343
|
+
};
|
|
344
|
+
|
|
354
345
|
const camelCase = (input, options) => {
|
|
355
346
|
if (!(typeof input === 'string' || Array.isArray(input))) {
|
|
356
347
|
throw new TypeError('Expected the input to be `string | string[]`');
|
|
357
348
|
}
|
|
358
349
|
|
|
359
|
-
options = Object.assign({
|
|
360
|
-
pascalCase: false
|
|
350
|
+
options = Object.assign({
|
|
351
|
+
pascalCase: false,
|
|
352
|
+
preserveConsecutiveUppercase: false
|
|
361
353
|
}, options);
|
|
362
354
|
|
|
363
|
-
const postProcess = x => options.pascalCase ? x.charAt(0).toLocaleUpperCase() + x.slice(1) : x;
|
|
364
|
-
|
|
365
355
|
if (Array.isArray(input)) {
|
|
366
356
|
input = input.map(x => x.trim()).filter(x => x.length).join('-');
|
|
367
357
|
} else {
|
|
@@ -373,17 +363,28 @@ const camelCase = (input, options) => {
|
|
|
373
363
|
}
|
|
374
364
|
|
|
375
365
|
if (input.length === 1) {
|
|
376
|
-
return options.pascalCase ? input.toLocaleUpperCase() : input.toLocaleLowerCase();
|
|
366
|
+
return options.pascalCase ? input.toLocaleUpperCase(options.locale) : input.toLocaleLowerCase(options.locale);
|
|
377
367
|
}
|
|
378
368
|
|
|
379
|
-
const hasUpperCase = input !== input.toLocaleLowerCase();
|
|
369
|
+
const hasUpperCase = input !== input.toLocaleLowerCase(options.locale);
|
|
380
370
|
|
|
381
371
|
if (hasUpperCase) {
|
|
382
|
-
input = preserveCamelCase(input);
|
|
372
|
+
input = preserveCamelCase(input, options.locale);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
input = input.replace(/^[_.\- ]+/, '');
|
|
376
|
+
|
|
377
|
+
if (options.preserveConsecutiveUppercase) {
|
|
378
|
+
input = preserveConsecutiveUppercase(input);
|
|
379
|
+
} else {
|
|
380
|
+
input = input.toLocaleLowerCase();
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
if (options.pascalCase) {
|
|
384
|
+
input = input.charAt(0).toLocaleUpperCase(options.locale) + input.slice(1);
|
|
383
385
|
}
|
|
384
386
|
|
|
385
|
-
|
|
386
|
-
return postProcess(input);
|
|
387
|
+
return postProcess(input, options);
|
|
387
388
|
};
|
|
388
389
|
|
|
389
390
|
var camelcase = camelCase; // TODO: Remove this for the next major release
|
|
@@ -405,18 +406,14 @@ var dashify = (str, options) => {
|
|
|
405
406
|
|
|
406
407
|
function createCommonjsModule(fn, basedir, module) {
|
|
407
408
|
return module = {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
409
|
+
path: basedir,
|
|
410
|
+
exports: {},
|
|
411
|
+
require: function (path, base) {
|
|
412
|
+
return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
|
|
413
|
+
}
|
|
413
414
|
}, fn(module, module.exports), module.exports;
|
|
414
415
|
}
|
|
415
416
|
|
|
416
|
-
function getCjsExportFromNamespace (n) {
|
|
417
|
-
return n && n['default'] || n;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
417
|
function commonjsRequire () {
|
|
421
418
|
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
422
419
|
}
|
|
@@ -11090,7 +11087,7 @@ var pattern = createCommonjsModule(function (module, exports) {
|
|
|
11090
11087
|
*/
|
|
11091
11088
|
|
|
11092
11089
|
|
|
11093
|
-
const PassThrough =
|
|
11090
|
+
const PassThrough = stream_1__default['default'].PassThrough;
|
|
11094
11091
|
const slice = Array.prototype.slice;
|
|
11095
11092
|
var merge2_1 = merge2;
|
|
11096
11093
|
|
|
@@ -12207,7 +12204,7 @@ var async$2 = createCommonjsModule(function (module, exports) {
|
|
|
12207
12204
|
super(_root, _settings);
|
|
12208
12205
|
this._settings = _settings;
|
|
12209
12206
|
this._scandir = out$1.scandir;
|
|
12210
|
-
this._emitter = new
|
|
12207
|
+
this._emitter = new events_1__default['default'].EventEmitter();
|
|
12211
12208
|
this._queue = queue(this._worker.bind(this), this._settings.concurrency);
|
|
12212
12209
|
this._isFatalError = false;
|
|
12213
12210
|
this._isDestroyed = false;
|
|
@@ -12371,7 +12368,7 @@ var stream$1 = createCommonjsModule(function (module, exports) {
|
|
|
12371
12368
|
this._root = _root;
|
|
12372
12369
|
this._settings = _settings;
|
|
12373
12370
|
this._reader = new async$2.default(this._root, this._settings);
|
|
12374
|
-
this._stream = new
|
|
12371
|
+
this._stream = new stream_1__default['default'].Readable({
|
|
12375
12372
|
objectMode: true,
|
|
12376
12373
|
read: () => {},
|
|
12377
12374
|
destroy: this._reader.destroy.bind(this._reader)
|
|
@@ -12640,7 +12637,7 @@ var stream$2 = createCommonjsModule(function (module, exports) {
|
|
|
12640
12637
|
|
|
12641
12638
|
static(patterns, options) {
|
|
12642
12639
|
const filepaths = patterns.map(this._getFullEntryPath, this);
|
|
12643
|
-
const stream = new
|
|
12640
|
+
const stream = new stream_1__default['default'].PassThrough({
|
|
12644
12641
|
objectMode: true
|
|
12645
12642
|
});
|
|
12646
12643
|
|
|
@@ -13147,7 +13144,7 @@ var stream$3 = createCommonjsModule(function (module, exports) {
|
|
|
13147
13144
|
const options = this._getReaderOptions(task);
|
|
13148
13145
|
|
|
13149
13146
|
const source = this.api(root, task, options);
|
|
13150
|
-
const destination = new
|
|
13147
|
+
const destination = new stream_1__default['default'].Readable({
|
|
13151
13148
|
objectMode: true,
|
|
13152
13149
|
read: () => {}
|
|
13153
13150
|
});
|
|
@@ -14359,7 +14356,8 @@ wordDiff.equals = function (left, right) {
|
|
|
14359
14356
|
};
|
|
14360
14357
|
|
|
14361
14358
|
wordDiff.tokenize = function (value) {
|
|
14362
|
-
|
|
14359
|
+
// All whitespace symbols except newline group into one token, each newline - in separate token
|
|
14360
|
+
var tokens = value.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/); // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.
|
|
14363
14361
|
|
|
14364
14362
|
for (var i = 0; i < tokens.length - 1; i++) {
|
|
14365
14363
|
// If we have an empty string in the next field and we have only word chars before and after, merge
|
|
@@ -14444,6 +14442,8 @@ function diffCss(oldStr, newStr, callback) {
|
|
|
14444
14442
|
}
|
|
14445
14443
|
|
|
14446
14444
|
function _typeof(obj) {
|
|
14445
|
+
"@babel/helpers - typeof";
|
|
14446
|
+
|
|
14447
14447
|
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
14448
14448
|
_typeof = function (obj) {
|
|
14449
14449
|
return typeof obj;
|
|
@@ -14458,23 +14458,36 @@ function _typeof(obj) {
|
|
|
14458
14458
|
}
|
|
14459
14459
|
|
|
14460
14460
|
function _toConsumableArray(arr) {
|
|
14461
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
|
|
14461
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
14462
14462
|
}
|
|
14463
14463
|
|
|
14464
14464
|
function _arrayWithoutHoles(arr) {
|
|
14465
|
-
if (Array.isArray(arr))
|
|
14466
|
-
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
|
14467
|
-
|
|
14468
|
-
return arr2;
|
|
14469
|
-
}
|
|
14465
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
14470
14466
|
}
|
|
14471
14467
|
|
|
14472
14468
|
function _iterableToArray(iter) {
|
|
14473
|
-
if (Symbol.iterator in Object(iter)
|
|
14469
|
+
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
|
|
14470
|
+
}
|
|
14471
|
+
|
|
14472
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
14473
|
+
if (!o) return;
|
|
14474
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
14475
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
14476
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
14477
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
14478
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
14479
|
+
}
|
|
14480
|
+
|
|
14481
|
+
function _arrayLikeToArray(arr, len) {
|
|
14482
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
14483
|
+
|
|
14484
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
14485
|
+
|
|
14486
|
+
return arr2;
|
|
14474
14487
|
}
|
|
14475
14488
|
|
|
14476
14489
|
function _nonIterableSpread() {
|
|
14477
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance");
|
|
14490
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
14478
14491
|
}
|
|
14479
14492
|
|
|
14480
14493
|
var objectPrototypeToString = Object.prototype.toString;
|
|
@@ -14664,12 +14677,23 @@ function parsePatch(uniDiff) {
|
|
|
14664
14677
|
chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
|
|
14665
14678
|
var hunk = {
|
|
14666
14679
|
oldStart: +chunkHeader[1],
|
|
14667
|
-
oldLines:
|
|
14680
|
+
oldLines: typeof chunkHeader[2] === 'undefined' ? 1 : +chunkHeader[2],
|
|
14668
14681
|
newStart: +chunkHeader[3],
|
|
14669
|
-
newLines:
|
|
14682
|
+
newLines: typeof chunkHeader[4] === 'undefined' ? 1 : +chunkHeader[4],
|
|
14670
14683
|
lines: [],
|
|
14671
14684
|
linedelimiters: []
|
|
14672
|
-
};
|
|
14685
|
+
}; // Unified Diff Format quirk: If the chunk size is 0,
|
|
14686
|
+
// the first number is one lower than one would expect.
|
|
14687
|
+
// https://www.artima.com/weblogs/viewpost.jsp?thread=164293
|
|
14688
|
+
|
|
14689
|
+
if (hunk.oldLines === 0) {
|
|
14690
|
+
hunk.oldStart += 1;
|
|
14691
|
+
}
|
|
14692
|
+
|
|
14693
|
+
if (hunk.newLines === 0) {
|
|
14694
|
+
hunk.newStart += 1;
|
|
14695
|
+
}
|
|
14696
|
+
|
|
14673
14697
|
var addCount = 0,
|
|
14674
14698
|
removeCount = 0;
|
|
14675
14699
|
|
|
@@ -14862,11 +14886,6 @@ function applyPatch(source, uniDiff) {
|
|
|
14862
14886
|
|
|
14863
14887
|
diffOffset += _hunk.newLines - _hunk.oldLines;
|
|
14864
14888
|
|
|
14865
|
-
if (_toPos < 0) {
|
|
14866
|
-
// Creating a new file
|
|
14867
|
-
_toPos = 0;
|
|
14868
|
-
}
|
|
14869
|
-
|
|
14870
14889
|
for (var j = 0; j < _hunk.lines.length; j++) {
|
|
14871
14890
|
var line = _hunk.lines[j],
|
|
14872
14891
|
operation = line.length > 0 ? line[0] : ' ',
|
|
@@ -15038,8 +15057,9 @@ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, ne
|
|
|
15038
15057
|
var newEOFNewline = /\n$/.test(newStr);
|
|
15039
15058
|
var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines;
|
|
15040
15059
|
|
|
15041
|
-
if (!oldEOFNewline && noNlBeforeAdds) {
|
|
15060
|
+
if (!oldEOFNewline && noNlBeforeAdds && oldStr.length > 0) {
|
|
15042
15061
|
// special case: old has no eol and no trailing context; no-nl can end up before adds
|
|
15062
|
+
// however, if the old file is empty, do not output the no-nl line
|
|
15043
15063
|
curRange.splice(hunk.oldLines, 0, '\');
|
|
15044
15064
|
}
|
|
15045
15065
|
|
|
@@ -15073,12 +15093,11 @@ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, ne
|
|
|
15073
15093
|
};
|
|
15074
15094
|
}
|
|
15075
15095
|
|
|
15076
|
-
function
|
|
15077
|
-
var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
|
|
15096
|
+
function formatPatch(diff) {
|
|
15078
15097
|
var ret = [];
|
|
15079
15098
|
|
|
15080
|
-
if (oldFileName == newFileName) {
|
|
15081
|
-
ret.push('Index: ' + oldFileName);
|
|
15099
|
+
if (diff.oldFileName == diff.newFileName) {
|
|
15100
|
+
ret.push('Index: ' + diff.oldFileName);
|
|
15082
15101
|
}
|
|
15083
15102
|
|
|
15084
15103
|
ret.push('===================================================================');
|
|
@@ -15086,7 +15105,18 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader
|
|
|
15086
15105
|
ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
|
|
15087
15106
|
|
|
15088
15107
|
for (var i = 0; i < diff.hunks.length; i++) {
|
|
15089
|
-
var hunk = diff.hunks[i];
|
|
15108
|
+
var hunk = diff.hunks[i]; // Unified Diff Format quirk: If the chunk size is 0,
|
|
15109
|
+
// the first number is one lower than one would expect.
|
|
15110
|
+
// https://www.artima.com/weblogs/viewpost.jsp?thread=164293
|
|
15111
|
+
|
|
15112
|
+
if (hunk.oldLines === 0) {
|
|
15113
|
+
hunk.oldStart -= 1;
|
|
15114
|
+
}
|
|
15115
|
+
|
|
15116
|
+
if (hunk.newLines === 0) {
|
|
15117
|
+
hunk.newStart -= 1;
|
|
15118
|
+
}
|
|
15119
|
+
|
|
15090
15120
|
ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
|
|
15091
15121
|
ret.push.apply(ret, hunk.lines);
|
|
15092
15122
|
}
|
|
@@ -15094,6 +15124,10 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader
|
|
|
15094
15124
|
return ret.join('\n') + '\n';
|
|
15095
15125
|
}
|
|
15096
15126
|
|
|
15127
|
+
function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
|
|
15128
|
+
return formatPatch(structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options));
|
|
15129
|
+
}
|
|
15130
|
+
|
|
15097
15131
|
function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
|
|
15098
15132
|
return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
|
|
15099
15133
|
}
|
|
@@ -15578,34 +15612,32 @@ function escapeHTML(s) {
|
|
|
15578
15612
|
var index_es6 = /*#__PURE__*/Object.freeze({
|
|
15579
15613
|
__proto__: null,
|
|
15580
15614
|
Diff: Diff,
|
|
15581
|
-
diffChars: diffChars,
|
|
15582
|
-
diffWords: diffWords,
|
|
15583
|
-
diffWordsWithSpace: diffWordsWithSpace,
|
|
15584
|
-
diffLines: diffLines,
|
|
15585
|
-
diffTrimmedLines: diffTrimmedLines,
|
|
15586
|
-
diffSentences: diffSentences,
|
|
15587
|
-
diffCss: diffCss,
|
|
15588
|
-
diffJson: diffJson,
|
|
15589
|
-
diffArrays: diffArrays,
|
|
15590
|
-
structuredPatch: structuredPatch,
|
|
15591
|
-
createTwoFilesPatch: createTwoFilesPatch,
|
|
15592
|
-
createPatch: createPatch,
|
|
15593
15615
|
applyPatch: applyPatch,
|
|
15594
15616
|
applyPatches: applyPatches,
|
|
15595
|
-
|
|
15596
|
-
merge: merge,
|
|
15617
|
+
canonicalize: canonicalize,
|
|
15597
15618
|
convertChangesToDMP: convertChangesToDMP,
|
|
15598
15619
|
convertChangesToXML: convertChangesToXML,
|
|
15599
|
-
|
|
15620
|
+
createPatch: createPatch,
|
|
15621
|
+
createTwoFilesPatch: createTwoFilesPatch,
|
|
15622
|
+
diffArrays: diffArrays,
|
|
15623
|
+
diffChars: diffChars,
|
|
15624
|
+
diffCss: diffCss,
|
|
15625
|
+
diffJson: diffJson,
|
|
15626
|
+
diffLines: diffLines,
|
|
15627
|
+
diffSentences: diffSentences,
|
|
15628
|
+
diffTrimmedLines: diffTrimmedLines,
|
|
15629
|
+
diffWords: diffWords,
|
|
15630
|
+
diffWordsWithSpace: diffWordsWithSpace,
|
|
15631
|
+
merge: merge,
|
|
15632
|
+
parsePatch: parsePatch,
|
|
15633
|
+
structuredPatch: structuredPatch
|
|
15600
15634
|
});
|
|
15601
15635
|
|
|
15602
|
-
var require$$3 = getCjsExportFromNamespace(index_es6);
|
|
15603
|
-
|
|
15604
15636
|
// eslint-disable-next-line no-restricted-modules
|
|
15605
15637
|
|
|
15606
15638
|
|
|
15607
15639
|
const {
|
|
15608
|
-
|
|
15640
|
+
getStdin
|
|
15609
15641
|
} = thirdParty;
|
|
15610
15642
|
const {
|
|
15611
15643
|
createIgnorer,
|
|
@@ -15644,7 +15676,7 @@ function cliifyOptions(object, apiDetailedOptionMap) {
|
|
|
15644
15676
|
}
|
|
15645
15677
|
|
|
15646
15678
|
function diff(a, b) {
|
|
15647
|
-
return
|
|
15679
|
+
return index_es6.createTwoFilesPatch("", "", a, b, "", "", {
|
|
15648
15680
|
context: 2
|
|
15649
15681
|
});
|
|
15650
15682
|
}
|
|
@@ -15932,7 +15964,7 @@ function formatStdin(context) {
|
|
|
15932
15964
|
// ignore path, not the current working directory.
|
|
15933
15965
|
|
|
15934
15966
|
const relativeFilepath = context.argv["ignore-path"] ? path__default['default'].relative(path__default['default'].dirname(context.argv["ignore-path"]), filepath) : path__default['default'].relative(process.cwd(), filepath);
|
|
15935
|
-
|
|
15967
|
+
getStdin().then(input => {
|
|
15936
15968
|
if (relativeFilepath && ignorer.ignores(fixWindowsSlashes$1(relativeFilepath))) {
|
|
15937
15969
|
writeOutput(context, {
|
|
15938
15970
|
formatted: input
|
|
@@ -16421,7 +16453,7 @@ function updateContextArgv(context, plugins, pluginSearchDirs) {
|
|
|
16421
16453
|
const minimistOptions = createMinimistOptions(context.detailedOptions);
|
|
16422
16454
|
const argv = minimist_1(context.args, minimistOptions);
|
|
16423
16455
|
context.argv = argv;
|
|
16424
|
-
context.filePatterns = argv._;
|
|
16456
|
+
context.filePatterns = argv._.map(file => String(file));
|
|
16425
16457
|
}
|
|
16426
16458
|
|
|
16427
16459
|
function normalizeContextArgv(context, keys) {
|
|
@@ -16447,8 +16479,6 @@ var util$1 = {
|
|
|
16447
16479
|
normalizeDetailedOptionMap
|
|
16448
16480
|
};
|
|
16449
16481
|
|
|
16450
|
-
var require$$1 = getCjsExportFromNamespace(_package$1);
|
|
16451
|
-
|
|
16452
16482
|
pleaseUpgradeNode(require$$1); // eslint-disable-next-line no-restricted-modules
|
|
16453
16483
|
|
|
16454
16484
|
function run(args) {
|
|
@@ -16521,3 +16551,6 @@ var cli = {
|
|
|
16521
16551
|
};
|
|
16522
16552
|
|
|
16523
16553
|
cli.run(process.argv.slice(2));
|
|
16554
|
+
var prettier = {};
|
|
16555
|
+
|
|
16556
|
+
module.exports = prettier;
|