prettier 2.7.1 → 2.8.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/LICENSE +10 -66
- package/cli.js +75 -24
- package/doc.js +178 -97
- package/esm/parser-angular.mjs +2 -2
- package/esm/parser-babel.mjs +22 -20
- package/esm/parser-espree.mjs +18 -18
- package/esm/parser-flow.mjs +24 -24
- package/esm/parser-glimmer.mjs +15 -15
- package/esm/parser-html.mjs +20 -20
- package/esm/parser-markdown.mjs +47 -47
- package/esm/parser-meriyah.mjs +11 -11
- package/esm/parser-postcss.mjs +36 -36
- package/esm/parser-typescript.mjs +47 -70
- package/esm/parser-yaml.mjs +133 -133
- package/esm/standalone.mjs +76 -76
- package/index.js +668 -61
- package/package.json +1 -1
- package/parser-angular.js +2 -2
- package/parser-babel.js +22 -20
- package/parser-espree.js +18 -18
- package/parser-flow.js +24 -24
- package/parser-glimmer.js +18 -18
- package/parser-html.js +20 -20
- package/parser-markdown.js +49 -49
- package/parser-meriyah.js +11 -11
- package/parser-postcss.js +57 -57
- package/parser-typescript.js +47 -70
- package/parser-yaml.js +130 -130
- package/standalone.js +78 -78
package/LICENSE
CHANGED
|
@@ -56,7 +56,7 @@ Repository: <https://github.com/babel/babel.git>
|
|
|
56
56
|
|
|
57
57
|
----------------------------------------
|
|
58
58
|
|
|
59
|
-
### @babel/helper-validator-identifier@v7.
|
|
59
|
+
### @babel/helper-validator-identifier@v7.18.6
|
|
60
60
|
|
|
61
61
|
License: MIT
|
|
62
62
|
By: The Babel Team
|
|
@@ -118,7 +118,7 @@ Repository: <https://github.com/babel/babel.git>
|
|
|
118
118
|
|
|
119
119
|
----------------------------------------
|
|
120
120
|
|
|
121
|
-
### @babel/parser@v7.
|
|
121
|
+
### @babel/parser@v7.20.1
|
|
122
122
|
|
|
123
123
|
License: MIT
|
|
124
124
|
By: The Babel Team
|
|
@@ -337,7 +337,7 @@ License: MIT
|
|
|
337
337
|
|
|
338
338
|
----------------------------------------
|
|
339
339
|
|
|
340
|
-
### @typescript-eslint/types@v5.
|
|
340
|
+
### @typescript-eslint/types@v5.45.0
|
|
341
341
|
|
|
342
342
|
License: MIT
|
|
343
343
|
Repository: <https://github.com/typescript-eslint/typescript-eslint.git>
|
|
@@ -366,7 +366,7 @@ Repository: <https://github.com/typescript-eslint/typescript-eslint.git>
|
|
|
366
366
|
|
|
367
367
|
----------------------------------------
|
|
368
368
|
|
|
369
|
-
### @typescript-eslint/typescript-estree@v5.
|
|
369
|
+
### @typescript-eslint/typescript-estree@v5.45.0
|
|
370
370
|
|
|
371
371
|
License: BSD-2-Clause
|
|
372
372
|
Repository: <https://github.com/typescript-eslint/typescript-eslint.git>
|
|
@@ -400,7 +400,7 @@ Repository: <https://github.com/typescript-eslint/typescript-eslint.git>
|
|
|
400
400
|
|
|
401
401
|
----------------------------------------
|
|
402
402
|
|
|
403
|
-
### @typescript-eslint/visitor-keys@v5.
|
|
403
|
+
### @typescript-eslint/visitor-keys@v5.45.0
|
|
404
404
|
|
|
405
405
|
License: MIT
|
|
406
406
|
Repository: <https://github.com/typescript-eslint/typescript-eslint.git>
|
|
@@ -429,14 +429,14 @@ Repository: <https://github.com/typescript-eslint/typescript-eslint.git>
|
|
|
429
429
|
|
|
430
430
|
----------------------------------------
|
|
431
431
|
|
|
432
|
-
### acorn@v8.
|
|
432
|
+
### acorn@v8.8.0
|
|
433
433
|
|
|
434
434
|
License: MIT
|
|
435
435
|
Repository: <https://github.com/acornjs/acorn.git>
|
|
436
436
|
|
|
437
437
|
> MIT License
|
|
438
438
|
>
|
|
439
|
-
> Copyright (C) 2012-
|
|
439
|
+
> Copyright (C) 2012-2022 by various contributors (see AUTHORS)
|
|
440
440
|
>
|
|
441
441
|
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
442
442
|
> of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1243,34 +1243,6 @@ By: Jon Schlinkert
|
|
|
1243
1243
|
|
|
1244
1244
|
----------------------------------------
|
|
1245
1245
|
|
|
1246
|
-
### debug@v4.3.4
|
|
1247
|
-
|
|
1248
|
-
License: MIT
|
|
1249
|
-
By: Josh Junon
|
|
1250
|
-
Repository: <git://github.com/debug-js/debug.git>
|
|
1251
|
-
|
|
1252
|
-
> (The MIT License)
|
|
1253
|
-
>
|
|
1254
|
-
> Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
|
|
1255
|
-
> Copyright (c) 2018-2021 Josh Junon
|
|
1256
|
-
>
|
|
1257
|
-
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
1258
|
-
> and associated documentation files (the 'Software'), to deal in the Software without restriction,
|
|
1259
|
-
> including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
1260
|
-
> and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
1261
|
-
> subject to the following conditions:
|
|
1262
|
-
>
|
|
1263
|
-
> The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
1264
|
-
> portions of the Software.
|
|
1265
|
-
>
|
|
1266
|
-
> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
|
1267
|
-
> LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
1268
|
-
> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
1269
|
-
> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
1270
|
-
> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1271
|
-
|
|
1272
|
-
----------------------------------------
|
|
1273
|
-
|
|
1274
1246
|
### defaults@v1.0.3
|
|
1275
1247
|
|
|
1276
1248
|
License: MIT
|
|
@@ -1739,7 +1711,7 @@ By: Toru Nagashima
|
|
|
1739
1711
|
|
|
1740
1712
|
----------------------------------------
|
|
1741
1713
|
|
|
1742
|
-
### espree@v9.
|
|
1714
|
+
### espree@v9.4.0
|
|
1743
1715
|
|
|
1744
1716
|
License: BSD-2-Clause
|
|
1745
1717
|
By: Nicholas C. Zakas
|
|
@@ -3330,7 +3302,7 @@ Repository: <git+https://github.com/isaacs/isexe.git>
|
|
|
3330
3302
|
|
|
3331
3303
|
----------------------------------------
|
|
3332
3304
|
|
|
3333
|
-
### jest-docblock@
|
|
3305
|
+
### jest-docblock@v28.1.1
|
|
3334
3306
|
|
|
3335
3307
|
License: MIT
|
|
3336
3308
|
Repository: <https://github.com/facebook/jest.git>
|
|
@@ -3903,34 +3875,6 @@ Repository: <git://github.com/substack/minimist.git>
|
|
|
3903
3875
|
|
|
3904
3876
|
----------------------------------------
|
|
3905
3877
|
|
|
3906
|
-
### ms@v2.1.2
|
|
3907
|
-
|
|
3908
|
-
License: MIT
|
|
3909
|
-
|
|
3910
|
-
> The MIT License (MIT)
|
|
3911
|
-
>
|
|
3912
|
-
> Copyright (c) 2016 Zeit, Inc.
|
|
3913
|
-
>
|
|
3914
|
-
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
3915
|
-
> of this software and associated documentation files (the "Software"), to deal
|
|
3916
|
-
> in the Software without restriction, including without limitation the rights
|
|
3917
|
-
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
3918
|
-
> copies of the Software, and to permit persons to whom the Software is
|
|
3919
|
-
> furnished to do so, subject to the following conditions:
|
|
3920
|
-
>
|
|
3921
|
-
> The above copyright notice and this permission notice shall be included in all
|
|
3922
|
-
> copies or substantial portions of the Software.
|
|
3923
|
-
>
|
|
3924
|
-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
3925
|
-
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
3926
|
-
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
3927
|
-
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
3928
|
-
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
3929
|
-
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
3930
|
-
> SOFTWARE.
|
|
3931
|
-
|
|
3932
|
-
----------------------------------------
|
|
3933
|
-
|
|
3934
3878
|
### n-readlines@v1.0.1
|
|
3935
3879
|
|
|
3936
3880
|
License: MIT
|
|
@@ -5353,7 +5297,7 @@ Repository: <https://github.com/ajafff/tsutils>
|
|
|
5353
5297
|
|
|
5354
5298
|
----------------------------------------
|
|
5355
5299
|
|
|
5356
|
-
### typescript@v4.
|
|
5300
|
+
### typescript@v4.9.3
|
|
5357
5301
|
|
|
5358
5302
|
License: Apache-2.0
|
|
5359
5303
|
By: Microsoft Corp.
|
package/cli.js
CHANGED
|
@@ -2399,7 +2399,8 @@ var require_logger = __commonJS2({
|
|
|
2399
2399
|
default: stripAnsi2
|
|
2400
2400
|
} = (init_strip_ansi(), __toCommonJS(strip_ansi_exports));
|
|
2401
2401
|
var {
|
|
2402
|
-
default: chalk2
|
|
2402
|
+
default: chalk2,
|
|
2403
|
+
chalkStderr: chalkStderr2
|
|
2403
2404
|
} = (init_source(), __toCommonJS(source_exports));
|
|
2404
2405
|
var countLines = (stream, text) => {
|
|
2405
2406
|
const columns = stream.columns || 80;
|
|
@@ -2435,8 +2436,9 @@ var require_logger = __commonJS2({
|
|
|
2435
2436
|
if (!shouldLog(loggerName)) {
|
|
2436
2437
|
return () => emptyLogResult;
|
|
2437
2438
|
}
|
|
2438
|
-
const prefix = color ? `[${chalk2[color](loggerName)}] ` : "";
|
|
2439
2439
|
const stream = process[loggerName === "log" ? "stdout" : "stderr"];
|
|
2440
|
+
const chalkInstance = loggerName === "log" ? chalk2 : chalkStderr2;
|
|
2441
|
+
const prefix = color ? `[${chalkInstance[color](loggerName)}] ` : "";
|
|
2440
2442
|
return (message, options) => {
|
|
2441
2443
|
options = Object.assign({
|
|
2442
2444
|
newline: true,
|
|
@@ -2641,6 +2643,10 @@ var require_constant = __commonJS2({
|
|
|
2641
2643
|
description: "Only format changed files. Cannot use with --stdin-filepath.",
|
|
2642
2644
|
type: "boolean"
|
|
2643
2645
|
},
|
|
2646
|
+
"cache-location": {
|
|
2647
|
+
description: "Path to the cache file.",
|
|
2648
|
+
type: "path"
|
|
2649
|
+
},
|
|
2644
2650
|
"cache-strategy": {
|
|
2645
2651
|
choices: [{
|
|
2646
2652
|
description: "Use the file metadata such as timestamps as cache keys",
|
|
@@ -3047,12 +3053,21 @@ var require_utils = __commonJS2({
|
|
|
3047
3053
|
}
|
|
3048
3054
|
}
|
|
3049
3055
|
}
|
|
3056
|
+
function isJson(value) {
|
|
3057
|
+
try {
|
|
3058
|
+
JSON.parse(value);
|
|
3059
|
+
return true;
|
|
3060
|
+
} catch {
|
|
3061
|
+
return false;
|
|
3062
|
+
}
|
|
3063
|
+
}
|
|
3050
3064
|
module2.exports = {
|
|
3051
3065
|
printToScreen: printToScreen2,
|
|
3052
3066
|
groupBy,
|
|
3053
3067
|
pick,
|
|
3054
3068
|
createHash,
|
|
3055
|
-
statSafe
|
|
3069
|
+
statSafe,
|
|
3070
|
+
isJson
|
|
3056
3071
|
};
|
|
3057
3072
|
}
|
|
3058
3073
|
});
|
|
@@ -9408,7 +9423,7 @@ var require_commondir = __commonJS2({
|
|
|
9408
9423
|
}
|
|
9409
9424
|
});
|
|
9410
9425
|
var require_p_try = __commonJS2({
|
|
9411
|
-
"node_modules/p-try/index.js"(exports2, module2) {
|
|
9426
|
+
"node_modules/pkg-dir/node_modules/p-try/index.js"(exports2, module2) {
|
|
9412
9427
|
"use strict";
|
|
9413
9428
|
var pTry = (fn, ...arguments_) => new Promise((resolve) => {
|
|
9414
9429
|
resolve(fn(...arguments_));
|
|
@@ -9418,7 +9433,7 @@ var require_p_try = __commonJS2({
|
|
|
9418
9433
|
}
|
|
9419
9434
|
});
|
|
9420
9435
|
var require_p_limit = __commonJS2({
|
|
9421
|
-
"node_modules/p-limit/index.js"(exports2, module2) {
|
|
9436
|
+
"node_modules/pkg-dir/node_modules/p-limit/index.js"(exports2, module2) {
|
|
9422
9437
|
"use strict";
|
|
9423
9438
|
var pTry = require_p_try();
|
|
9424
9439
|
var pLimit = (concurrency) => {
|
|
@@ -9467,7 +9482,7 @@ var require_p_limit = __commonJS2({
|
|
|
9467
9482
|
}
|
|
9468
9483
|
});
|
|
9469
9484
|
var require_p_locate = __commonJS2({
|
|
9470
|
-
"node_modules/p-locate/index.js"(exports2, module2) {
|
|
9485
|
+
"node_modules/pkg-dir/node_modules/p-locate/index.js"(exports2, module2) {
|
|
9471
9486
|
"use strict";
|
|
9472
9487
|
var pLimit = require_p_limit();
|
|
9473
9488
|
var EndError = class extends Error {
|
|
@@ -9506,7 +9521,7 @@ var require_p_locate = __commonJS2({
|
|
|
9506
9521
|
}
|
|
9507
9522
|
});
|
|
9508
9523
|
var require_locate_path = __commonJS2({
|
|
9509
|
-
"node_modules/locate-path/index.js"(exports2, module2) {
|
|
9524
|
+
"node_modules/pkg-dir/node_modules/locate-path/index.js"(exports2, module2) {
|
|
9510
9525
|
"use strict";
|
|
9511
9526
|
var path = require("path");
|
|
9512
9527
|
var fs = require("fs");
|
|
@@ -9593,7 +9608,7 @@ var require_path_exists = __commonJS2({
|
|
|
9593
9608
|
}
|
|
9594
9609
|
});
|
|
9595
9610
|
var require_find_up = __commonJS2({
|
|
9596
|
-
"node_modules/find-up/index.js"(exports2, module2) {
|
|
9611
|
+
"node_modules/pkg-dir/node_modules/find-up/index.js"(exports2, module2) {
|
|
9597
9612
|
"use strict";
|
|
9598
9613
|
var path = require("path");
|
|
9599
9614
|
var locatePath = require_locate_path();
|
|
@@ -10998,10 +11013,15 @@ var require_find_cache_dir = __commonJS2({
|
|
|
10998
11013
|
var require_find_cache_file = __commonJS2({
|
|
10999
11014
|
"src/cli/find-cache-file.js"(exports2, module2) {
|
|
11000
11015
|
"use strict";
|
|
11016
|
+
var fs = require("fs").promises;
|
|
11001
11017
|
var os2 = require("os");
|
|
11002
11018
|
var path = require("path");
|
|
11003
11019
|
var findCacheDir = require_find_cache_dir();
|
|
11004
|
-
|
|
11020
|
+
var {
|
|
11021
|
+
statSafe,
|
|
11022
|
+
isJson
|
|
11023
|
+
} = require_utils();
|
|
11024
|
+
function findDefaultCacheFile() {
|
|
11005
11025
|
const cacheDir = findCacheDir({
|
|
11006
11026
|
name: "prettier",
|
|
11007
11027
|
create: true
|
|
@@ -11009,6 +11029,27 @@ var require_find_cache_file = __commonJS2({
|
|
|
11009
11029
|
const cacheFilePath = path.join(cacheDir, ".prettier-cache");
|
|
11010
11030
|
return cacheFilePath;
|
|
11011
11031
|
}
|
|
11032
|
+
async function findCacheFileFromOption(cacheLocation) {
|
|
11033
|
+
const cacheFile = path.resolve(cacheLocation);
|
|
11034
|
+
const stat = await statSafe(cacheFile);
|
|
11035
|
+
if (stat) {
|
|
11036
|
+
if (stat.isDirectory()) {
|
|
11037
|
+
throw new Error(`Resolved --cache-location '${cacheFile}' is a directory`);
|
|
11038
|
+
}
|
|
11039
|
+
const data = await fs.readFile(cacheFile, "utf8");
|
|
11040
|
+
if (!isJson(data)) {
|
|
11041
|
+
throw new Error(`'${cacheFile}' isn't a valid JSON file`);
|
|
11042
|
+
}
|
|
11043
|
+
}
|
|
11044
|
+
return cacheFile;
|
|
11045
|
+
}
|
|
11046
|
+
async function findCacheFile(cacheLocation) {
|
|
11047
|
+
if (!cacheLocation) {
|
|
11048
|
+
return findDefaultCacheFile();
|
|
11049
|
+
}
|
|
11050
|
+
const cacheFile = await findCacheFileFromOption(cacheLocation);
|
|
11051
|
+
return cacheFile;
|
|
11052
|
+
}
|
|
11012
11053
|
module2.exports = findCacheFile;
|
|
11013
11054
|
}
|
|
11014
11055
|
});
|
|
@@ -14113,16 +14154,13 @@ var require_format_results_cache = __commonJS2({
|
|
|
14113
14154
|
}
|
|
14114
14155
|
existsAvailableFormatResultsCache(filePath, options) {
|
|
14115
14156
|
const fileDescriptor = this.fileEntryCache.getFileDescriptor(filePath);
|
|
14116
|
-
const hashOfOptions = getHashOfOptions(options);
|
|
14117
|
-
const meta = getMetadataFromFileDescriptor(fileDescriptor);
|
|
14118
|
-
const changed = fileDescriptor.changed || meta.hashOfOptions !== hashOfOptions;
|
|
14119
14157
|
if (fileDescriptor.notFound) {
|
|
14120
14158
|
return false;
|
|
14121
14159
|
}
|
|
14122
|
-
|
|
14123
|
-
|
|
14124
|
-
|
|
14125
|
-
return
|
|
14160
|
+
const hashOfOptions = getHashOfOptions(options);
|
|
14161
|
+
const meta = getMetadataFromFileDescriptor(fileDescriptor);
|
|
14162
|
+
const changed = fileDescriptor.changed || meta.hashOfOptions !== hashOfOptions;
|
|
14163
|
+
return !changed;
|
|
14126
14164
|
}
|
|
14127
14165
|
setFormatResultsCache(filePath, options) {
|
|
14128
14166
|
const fileDescriptor = this.fileEntryCache.getFileDescriptor(filePath);
|
|
@@ -14131,6 +14169,9 @@ var require_format_results_cache = __commonJS2({
|
|
|
14131
14169
|
meta.hashOfOptions = getHashOfOptions(options);
|
|
14132
14170
|
}
|
|
14133
14171
|
}
|
|
14172
|
+
removeFormatResultsCache(filePath) {
|
|
14173
|
+
this.fileEntryCache.removeEntry(filePath);
|
|
14174
|
+
}
|
|
14134
14175
|
reconcile() {
|
|
14135
14176
|
this.fileEntryCache.reconcile();
|
|
14136
14177
|
}
|
|
@@ -14785,7 +14826,7 @@ var require_format = __commonJS2({
|
|
|
14785
14826
|
}
|
|
14786
14827
|
}
|
|
14787
14828
|
async function formatFiles2(context) {
|
|
14788
|
-
var
|
|
14829
|
+
var _formatResultsCache4;
|
|
14789
14830
|
const ignorer = await createIgnorerFromContextOrDie(context);
|
|
14790
14831
|
let numberOfUnformattedFilesFound = 0;
|
|
14791
14832
|
const {
|
|
@@ -14795,7 +14836,7 @@ var require_format = __commonJS2({
|
|
|
14795
14836
|
context.logger.log("Checking formatting...");
|
|
14796
14837
|
}
|
|
14797
14838
|
let formatResultsCache;
|
|
14798
|
-
const cacheFilePath = findCacheFile();
|
|
14839
|
+
const cacheFilePath = await findCacheFile(context.argv.cacheLocation);
|
|
14799
14840
|
if (context.argv.cache) {
|
|
14800
14841
|
formatResultsCache = new FormatResultsCache(cacheFilePath, context.argv.cacheStrategy || "content");
|
|
14801
14842
|
} else {
|
|
@@ -14803,13 +14844,15 @@ var require_format = __commonJS2({
|
|
|
14803
14844
|
context.logger.error("`--cache-strategy` cannot be used without `--cache`.");
|
|
14804
14845
|
process.exit(2);
|
|
14805
14846
|
}
|
|
14806
|
-
|
|
14807
|
-
|
|
14808
|
-
|
|
14847
|
+
if (!context.argv.cacheLocation) {
|
|
14848
|
+
const stat = await statSafe(cacheFilePath);
|
|
14849
|
+
if (stat) {
|
|
14850
|
+
await fs.unlink(cacheFilePath);
|
|
14851
|
+
}
|
|
14809
14852
|
}
|
|
14810
14853
|
}
|
|
14811
14854
|
for await (const pathOrError of expandPatterns(context)) {
|
|
14812
|
-
var _formatResultsCache
|
|
14855
|
+
var _formatResultsCache;
|
|
14813
14856
|
if (typeof pathOrError === "object") {
|
|
14814
14857
|
context.logger.error(pathOrError.error);
|
|
14815
14858
|
process.exitCode = 2;
|
|
@@ -14864,8 +14907,8 @@ ${error.message}`);
|
|
|
14864
14907
|
handleError(context, filename, error, printedFilename);
|
|
14865
14908
|
continue;
|
|
14866
14909
|
}
|
|
14867
|
-
(_formatResultsCache2 = formatResultsCache) === null || _formatResultsCache2 === void 0 ? void 0 : _formatResultsCache2.setFormatResultsCache(filename, options);
|
|
14868
14910
|
const isDifferent = output !== input;
|
|
14911
|
+
let shouldSetCache = !isDifferent;
|
|
14869
14912
|
if (printedFilename) {
|
|
14870
14913
|
printedFilename.clear();
|
|
14871
14914
|
}
|
|
@@ -14880,6 +14923,7 @@ ${error.message}`);
|
|
|
14880
14923
|
}
|
|
14881
14924
|
try {
|
|
14882
14925
|
await fs.writeFile(filename, output, "utf8");
|
|
14926
|
+
shouldSetCache = true;
|
|
14883
14927
|
} catch (error) {
|
|
14884
14928
|
context.logger.error(`Unable to write file: ${filename}
|
|
14885
14929
|
${error.message}`);
|
|
@@ -14902,6 +14946,13 @@ ${error.message}`);
|
|
|
14902
14946
|
} else if (!context.argv.check && !context.argv.listDifferent) {
|
|
14903
14947
|
writeOutput(context, result, options);
|
|
14904
14948
|
}
|
|
14949
|
+
if (shouldSetCache) {
|
|
14950
|
+
var _formatResultsCache2;
|
|
14951
|
+
(_formatResultsCache2 = formatResultsCache) === null || _formatResultsCache2 === void 0 ? void 0 : _formatResultsCache2.setFormatResultsCache(filename, options);
|
|
14952
|
+
} else {
|
|
14953
|
+
var _formatResultsCache3;
|
|
14954
|
+
(_formatResultsCache3 = formatResultsCache) === null || _formatResultsCache3 === void 0 ? void 0 : _formatResultsCache3.removeFormatResultsCache(filename);
|
|
14955
|
+
}
|
|
14905
14956
|
if (isDifferent) {
|
|
14906
14957
|
if (context.argv.check) {
|
|
14907
14958
|
context.logger.warn(filename);
|
|
@@ -14911,7 +14962,7 @@ ${error.message}`);
|
|
|
14911
14962
|
numberOfUnformattedFilesFound += 1;
|
|
14912
14963
|
}
|
|
14913
14964
|
}
|
|
14914
|
-
(
|
|
14965
|
+
(_formatResultsCache4 = formatResultsCache) === null || _formatResultsCache4 === void 0 ? void 0 : _formatResultsCache4.reconcile();
|
|
14915
14966
|
if (context.argv.check) {
|
|
14916
14967
|
if (numberOfUnformattedFilesFound === 0) {
|
|
14917
14968
|
context.logger.log("All matched files use Prettier code style!");
|