prettier 3.0.1 → 3.0.3
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 +68 -22
- package/doc.d.ts +3 -0
- package/index.cjs +1 -1
- package/index.d.ts +9 -0
- package/index.mjs +166 -87
- package/internal/cli.mjs +310 -10
- package/internal/internal.mjs +61 -37
- package/package.json +3 -2
- package/plugins/babel.js +11 -11
- package/plugins/babel.mjs +11 -11
- package/plugins/estree.js +23 -23
- package/plugins/estree.mjs +23 -23
- package/plugins/flow.js +17 -17
- package/plugins/flow.mjs +17 -17
- package/plugins/html.js +15 -15
- package/plugins/html.mjs +15 -15
- package/plugins/markdown.js +38 -38
- package/plugins/markdown.mjs +38 -38
- package/plugins/postcss.js +5 -5
- package/plugins/postcss.mjs +5 -5
- package/plugins/typescript.js +20 -20
- package/plugins/typescript.mjs +20 -20
- package/standalone.js +24 -24
- package/standalone.mjs +24 -24
package/internal/cli.mjs
CHANGED
|
@@ -1197,6 +1197,264 @@ var require_common_path_prefix = __commonJS({
|
|
|
1197
1197
|
}
|
|
1198
1198
|
});
|
|
1199
1199
|
|
|
1200
|
+
// node_modules/json-buffer/index.js
|
|
1201
|
+
var require_json_buffer = __commonJS({
|
|
1202
|
+
"node_modules/json-buffer/index.js"(exports) {
|
|
1203
|
+
exports.stringify = function stringify4(o) {
|
|
1204
|
+
if ("undefined" == typeof o)
|
|
1205
|
+
return o;
|
|
1206
|
+
if (o && Buffer.isBuffer(o))
|
|
1207
|
+
return JSON.stringify(":base64:" + o.toString("base64"));
|
|
1208
|
+
if (o && o.toJSON)
|
|
1209
|
+
o = o.toJSON();
|
|
1210
|
+
if (o && "object" === typeof o) {
|
|
1211
|
+
var s = "";
|
|
1212
|
+
var array2 = Array.isArray(o);
|
|
1213
|
+
s = array2 ? "[" : "{";
|
|
1214
|
+
var first = true;
|
|
1215
|
+
for (var k in o) {
|
|
1216
|
+
var ignore = "function" == typeof o[k] || !array2 && "undefined" === typeof o[k];
|
|
1217
|
+
if (Object.hasOwnProperty.call(o, k) && !ignore) {
|
|
1218
|
+
if (!first)
|
|
1219
|
+
s += ",";
|
|
1220
|
+
first = false;
|
|
1221
|
+
if (array2) {
|
|
1222
|
+
if (o[k] == void 0)
|
|
1223
|
+
s += "null";
|
|
1224
|
+
else
|
|
1225
|
+
s += stringify4(o[k]);
|
|
1226
|
+
} else if (o[k] !== void 0) {
|
|
1227
|
+
s += stringify4(k) + ":" + stringify4(o[k]);
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
s += array2 ? "]" : "}";
|
|
1232
|
+
return s;
|
|
1233
|
+
} else if ("string" === typeof o) {
|
|
1234
|
+
return JSON.stringify(/^:/.test(o) ? ":" + o : o);
|
|
1235
|
+
} else if ("undefined" === typeof o) {
|
|
1236
|
+
return "null";
|
|
1237
|
+
} else
|
|
1238
|
+
return JSON.stringify(o);
|
|
1239
|
+
};
|
|
1240
|
+
exports.parse = function(s) {
|
|
1241
|
+
return JSON.parse(s, function(key, value) {
|
|
1242
|
+
if ("string" === typeof value) {
|
|
1243
|
+
if (/^:base64:/.test(value))
|
|
1244
|
+
return Buffer.from(value.substring(8), "base64");
|
|
1245
|
+
else
|
|
1246
|
+
return /^:/.test(value) ? value.substring(1) : value;
|
|
1247
|
+
}
|
|
1248
|
+
return value;
|
|
1249
|
+
});
|
|
1250
|
+
};
|
|
1251
|
+
}
|
|
1252
|
+
});
|
|
1253
|
+
|
|
1254
|
+
// node_modules/keyv/src/index.js
|
|
1255
|
+
var require_src = __commonJS({
|
|
1256
|
+
"node_modules/keyv/src/index.js"(exports, module) {
|
|
1257
|
+
"use strict";
|
|
1258
|
+
var EventEmitter = __require("events");
|
|
1259
|
+
var JSONB = require_json_buffer();
|
|
1260
|
+
var loadStore = (options) => {
|
|
1261
|
+
const adapters = {
|
|
1262
|
+
redis: "@keyv/redis",
|
|
1263
|
+
rediss: "@keyv/redis",
|
|
1264
|
+
mongodb: "@keyv/mongo",
|
|
1265
|
+
mongo: "@keyv/mongo",
|
|
1266
|
+
sqlite: "@keyv/sqlite",
|
|
1267
|
+
postgresql: "@keyv/postgres",
|
|
1268
|
+
postgres: "@keyv/postgres",
|
|
1269
|
+
mysql: "@keyv/mysql",
|
|
1270
|
+
etcd: "@keyv/etcd",
|
|
1271
|
+
offline: "@keyv/offline",
|
|
1272
|
+
tiered: "@keyv/tiered"
|
|
1273
|
+
};
|
|
1274
|
+
if (options.adapter || options.uri) {
|
|
1275
|
+
const adapter = options.adapter || /^[^:+]*/.exec(options.uri)[0];
|
|
1276
|
+
return new (__require(adapters[adapter]))(options);
|
|
1277
|
+
}
|
|
1278
|
+
return /* @__PURE__ */ new Map();
|
|
1279
|
+
};
|
|
1280
|
+
var iterableAdapters = [
|
|
1281
|
+
"sqlite",
|
|
1282
|
+
"postgres",
|
|
1283
|
+
"mysql",
|
|
1284
|
+
"mongo",
|
|
1285
|
+
"redis",
|
|
1286
|
+
"tiered"
|
|
1287
|
+
];
|
|
1288
|
+
var Keyv = class extends EventEmitter {
|
|
1289
|
+
constructor(uri, { emitErrors = true, ...options } = {}) {
|
|
1290
|
+
super();
|
|
1291
|
+
this.opts = {
|
|
1292
|
+
namespace: "keyv",
|
|
1293
|
+
serialize: JSONB.stringify,
|
|
1294
|
+
deserialize: JSONB.parse,
|
|
1295
|
+
...typeof uri === "string" ? { uri } : uri,
|
|
1296
|
+
...options
|
|
1297
|
+
};
|
|
1298
|
+
if (!this.opts.store) {
|
|
1299
|
+
const adapterOptions = { ...this.opts };
|
|
1300
|
+
this.opts.store = loadStore(adapterOptions);
|
|
1301
|
+
}
|
|
1302
|
+
if (this.opts.compression) {
|
|
1303
|
+
const compression = this.opts.compression;
|
|
1304
|
+
this.opts.serialize = compression.serialize.bind(compression);
|
|
1305
|
+
this.opts.deserialize = compression.deserialize.bind(compression);
|
|
1306
|
+
}
|
|
1307
|
+
if (typeof this.opts.store.on === "function" && emitErrors) {
|
|
1308
|
+
this.opts.store.on("error", (error) => this.emit("error", error));
|
|
1309
|
+
}
|
|
1310
|
+
this.opts.store.namespace = this.opts.namespace;
|
|
1311
|
+
const generateIterator = (iterator) => async function* () {
|
|
1312
|
+
for await (const [key, raw] of typeof iterator === "function" ? iterator(this.opts.store.namespace) : iterator) {
|
|
1313
|
+
const data = await this.opts.deserialize(raw);
|
|
1314
|
+
if (this.opts.store.namespace && !key.includes(this.opts.store.namespace)) {
|
|
1315
|
+
continue;
|
|
1316
|
+
}
|
|
1317
|
+
if (typeof data.expires === "number" && Date.now() > data.expires) {
|
|
1318
|
+
this.delete(key);
|
|
1319
|
+
continue;
|
|
1320
|
+
}
|
|
1321
|
+
yield [this._getKeyUnprefix(key), data.value];
|
|
1322
|
+
}
|
|
1323
|
+
};
|
|
1324
|
+
if (typeof this.opts.store[Symbol.iterator] === "function" && this.opts.store instanceof Map) {
|
|
1325
|
+
this.iterator = generateIterator(this.opts.store);
|
|
1326
|
+
} else if (typeof this.opts.store.iterator === "function" && this.opts.store.opts && this._checkIterableAdaptar()) {
|
|
1327
|
+
this.iterator = generateIterator(this.opts.store.iterator.bind(this.opts.store));
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
_checkIterableAdaptar() {
|
|
1331
|
+
return iterableAdapters.includes(this.opts.store.opts.dialect) || iterableAdapters.findIndex((element) => this.opts.store.opts.url.includes(element)) >= 0;
|
|
1332
|
+
}
|
|
1333
|
+
_getKeyPrefix(key) {
|
|
1334
|
+
return `${this.opts.namespace}:${key}`;
|
|
1335
|
+
}
|
|
1336
|
+
_getKeyPrefixArray(keys) {
|
|
1337
|
+
return keys.map((key) => `${this.opts.namespace}:${key}`);
|
|
1338
|
+
}
|
|
1339
|
+
_getKeyUnprefix(key) {
|
|
1340
|
+
return key.split(":").splice(1).join(":");
|
|
1341
|
+
}
|
|
1342
|
+
get(key, options) {
|
|
1343
|
+
const { store } = this.opts;
|
|
1344
|
+
const isArray = Array.isArray(key);
|
|
1345
|
+
const keyPrefixed = isArray ? this._getKeyPrefixArray(key) : this._getKeyPrefix(key);
|
|
1346
|
+
if (isArray && store.getMany === void 0) {
|
|
1347
|
+
const promises = [];
|
|
1348
|
+
for (const key2 of keyPrefixed) {
|
|
1349
|
+
promises.push(
|
|
1350
|
+
Promise.resolve().then(() => store.get(key2)).then((data) => typeof data === "string" ? this.opts.deserialize(data) : this.opts.compression ? this.opts.deserialize(data) : data).then((data) => {
|
|
1351
|
+
if (data === void 0 || data === null) {
|
|
1352
|
+
return void 0;
|
|
1353
|
+
}
|
|
1354
|
+
if (typeof data.expires === "number" && Date.now() > data.expires) {
|
|
1355
|
+
return this.delete(key2).then(() => void 0);
|
|
1356
|
+
}
|
|
1357
|
+
return options && options.raw ? data : data.value;
|
|
1358
|
+
})
|
|
1359
|
+
);
|
|
1360
|
+
}
|
|
1361
|
+
return Promise.allSettled(promises).then((values) => {
|
|
1362
|
+
const data = [];
|
|
1363
|
+
for (const value of values) {
|
|
1364
|
+
data.push(value.value);
|
|
1365
|
+
}
|
|
1366
|
+
return data;
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1369
|
+
return Promise.resolve().then(() => isArray ? store.getMany(keyPrefixed) : store.get(keyPrefixed)).then((data) => typeof data === "string" ? this.opts.deserialize(data) : this.opts.compression ? this.opts.deserialize(data) : data).then((data) => {
|
|
1370
|
+
if (data === void 0 || data === null) {
|
|
1371
|
+
return void 0;
|
|
1372
|
+
}
|
|
1373
|
+
if (isArray) {
|
|
1374
|
+
const result = [];
|
|
1375
|
+
for (let row of data) {
|
|
1376
|
+
if (typeof row === "string") {
|
|
1377
|
+
row = this.opts.deserialize(row);
|
|
1378
|
+
}
|
|
1379
|
+
if (row === void 0 || row === null) {
|
|
1380
|
+
result.push(void 0);
|
|
1381
|
+
continue;
|
|
1382
|
+
}
|
|
1383
|
+
if (typeof row.expires === "number" && Date.now() > row.expires) {
|
|
1384
|
+
this.delete(key).then(() => void 0);
|
|
1385
|
+
result.push(void 0);
|
|
1386
|
+
} else {
|
|
1387
|
+
result.push(options && options.raw ? row : row.value);
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
return result;
|
|
1391
|
+
}
|
|
1392
|
+
if (typeof data.expires === "number" && Date.now() > data.expires) {
|
|
1393
|
+
return this.delete(key).then(() => void 0);
|
|
1394
|
+
}
|
|
1395
|
+
return options && options.raw ? data : data.value;
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
set(key, value, ttl) {
|
|
1399
|
+
const keyPrefixed = this._getKeyPrefix(key);
|
|
1400
|
+
if (typeof ttl === "undefined") {
|
|
1401
|
+
ttl = this.opts.ttl;
|
|
1402
|
+
}
|
|
1403
|
+
if (ttl === 0) {
|
|
1404
|
+
ttl = void 0;
|
|
1405
|
+
}
|
|
1406
|
+
const { store } = this.opts;
|
|
1407
|
+
return Promise.resolve().then(() => {
|
|
1408
|
+
const expires = typeof ttl === "number" ? Date.now() + ttl : null;
|
|
1409
|
+
if (typeof value === "symbol") {
|
|
1410
|
+
this.emit("error", "symbol cannot be serialized");
|
|
1411
|
+
}
|
|
1412
|
+
value = { value, expires };
|
|
1413
|
+
return this.opts.serialize(value);
|
|
1414
|
+
}).then((value2) => store.set(keyPrefixed, value2, ttl)).then(() => true);
|
|
1415
|
+
}
|
|
1416
|
+
delete(key) {
|
|
1417
|
+
const { store } = this.opts;
|
|
1418
|
+
if (Array.isArray(key)) {
|
|
1419
|
+
const keyPrefixed2 = this._getKeyPrefixArray(key);
|
|
1420
|
+
if (store.deleteMany === void 0) {
|
|
1421
|
+
const promises = [];
|
|
1422
|
+
for (const key2 of keyPrefixed2) {
|
|
1423
|
+
promises.push(store.delete(key2));
|
|
1424
|
+
}
|
|
1425
|
+
return Promise.allSettled(promises).then((values) => values.every((x) => x.value === true));
|
|
1426
|
+
}
|
|
1427
|
+
return Promise.resolve().then(() => store.deleteMany(keyPrefixed2));
|
|
1428
|
+
}
|
|
1429
|
+
const keyPrefixed = this._getKeyPrefix(key);
|
|
1430
|
+
return Promise.resolve().then(() => store.delete(keyPrefixed));
|
|
1431
|
+
}
|
|
1432
|
+
clear() {
|
|
1433
|
+
const { store } = this.opts;
|
|
1434
|
+
return Promise.resolve().then(() => store.clear());
|
|
1435
|
+
}
|
|
1436
|
+
has(key) {
|
|
1437
|
+
const keyPrefixed = this._getKeyPrefix(key);
|
|
1438
|
+
const { store } = this.opts;
|
|
1439
|
+
return Promise.resolve().then(async () => {
|
|
1440
|
+
if (typeof store.has === "function") {
|
|
1441
|
+
return store.has(keyPrefixed);
|
|
1442
|
+
}
|
|
1443
|
+
const value = await store.get(keyPrefixed);
|
|
1444
|
+
return value !== void 0;
|
|
1445
|
+
});
|
|
1446
|
+
}
|
|
1447
|
+
disconnect() {
|
|
1448
|
+
const { store } = this.opts;
|
|
1449
|
+
if (typeof store.disconnect === "function") {
|
|
1450
|
+
return store.disconnect();
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
};
|
|
1454
|
+
module.exports = Keyv;
|
|
1455
|
+
}
|
|
1456
|
+
});
|
|
1457
|
+
|
|
1200
1458
|
// node_modules/flatted/cjs/index.js
|
|
1201
1459
|
var require_cjs = __commonJS({
|
|
1202
1460
|
"node_modules/flatted/cjs/index.js"(exports) {
|
|
@@ -4008,6 +4266,7 @@ var require_cache = __commonJS({
|
|
|
4008
4266
|
"node_modules/flat-cache/src/cache.js"(exports, module) {
|
|
4009
4267
|
var path10 = __require("path");
|
|
4010
4268
|
var fs6 = __require("fs");
|
|
4269
|
+
var Keyv = require_src();
|
|
4011
4270
|
var utils = require_utils();
|
|
4012
4271
|
var del = require_del();
|
|
4013
4272
|
var writeJSON = utils.writeJSON;
|
|
@@ -4023,13 +4282,28 @@ var require_cache = __commonJS({
|
|
|
4023
4282
|
*/
|
|
4024
4283
|
load: function(docId, cacheDir) {
|
|
4025
4284
|
var me = this;
|
|
4026
|
-
me.
|
|
4027
|
-
me.
|
|
4285
|
+
me.keyv = new Keyv();
|
|
4286
|
+
me.__visited = {};
|
|
4287
|
+
me.__persisted = {};
|
|
4028
4288
|
me._pathToFile = cacheDir ? path10.resolve(cacheDir, docId) : path10.resolve(__dirname, "../.cache/", docId);
|
|
4029
4289
|
if (fs6.existsSync(me._pathToFile)) {
|
|
4030
4290
|
me._persisted = utils.tryParse(me._pathToFile, {});
|
|
4031
4291
|
}
|
|
4032
4292
|
},
|
|
4293
|
+
get _persisted() {
|
|
4294
|
+
return this.__persisted;
|
|
4295
|
+
},
|
|
4296
|
+
set _persisted(value) {
|
|
4297
|
+
this.__persisted = value;
|
|
4298
|
+
this.keyv.set("persisted", value);
|
|
4299
|
+
},
|
|
4300
|
+
get _visited() {
|
|
4301
|
+
return this.__visited;
|
|
4302
|
+
},
|
|
4303
|
+
set _visited(value) {
|
|
4304
|
+
this.__visited = value;
|
|
4305
|
+
this.keyv.set("visited", value);
|
|
4306
|
+
},
|
|
4033
4307
|
/**
|
|
4034
4308
|
* Load the cache from the provided file
|
|
4035
4309
|
* @method loadFile
|
|
@@ -5404,12 +5678,30 @@ var preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUp
|
|
|
5404
5678
|
};
|
|
5405
5679
|
var preserveConsecutiveUppercase = (input, toLowerCase) => {
|
|
5406
5680
|
LEADING_CAPITAL.lastIndex = 0;
|
|
5407
|
-
return
|
|
5681
|
+
return string_replace_all_default(
|
|
5682
|
+
/* isOptionalObject*/
|
|
5683
|
+
false,
|
|
5684
|
+
input,
|
|
5685
|
+
LEADING_CAPITAL,
|
|
5686
|
+
(match) => toLowerCase(match)
|
|
5687
|
+
);
|
|
5408
5688
|
};
|
|
5409
5689
|
var postProcess = (input, toUpperCase) => {
|
|
5410
5690
|
SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
|
|
5411
5691
|
NUMBERS_AND_IDENTIFIER.lastIndex = 0;
|
|
5412
|
-
return
|
|
5692
|
+
return string_replace_all_default(
|
|
5693
|
+
/* isOptionalObject*/
|
|
5694
|
+
false,
|
|
5695
|
+
string_replace_all_default(
|
|
5696
|
+
/* isOptionalObject*/
|
|
5697
|
+
false,
|
|
5698
|
+
input,
|
|
5699
|
+
NUMBERS_AND_IDENTIFIER,
|
|
5700
|
+
(match, pattern, offset) => ["_", "-"].includes(input.charAt(offset + match.length)) ? match : toUpperCase(match)
|
|
5701
|
+
),
|
|
5702
|
+
SEPARATORS_AND_IDENTIFIER,
|
|
5703
|
+
(_, identifier) => toUpperCase(identifier)
|
|
5704
|
+
);
|
|
5413
5705
|
};
|
|
5414
5706
|
function camelCase(input, options) {
|
|
5415
5707
|
if (!(typeof input === "string" || Array.isArray(input))) {
|
|
@@ -5963,9 +6255,10 @@ async function* expandPatternsInternal(context) {
|
|
|
5963
6255
|
});
|
|
5964
6256
|
} else if (stat.isDirectory()) {
|
|
5965
6257
|
const relativePath = path2.relative(cwd2, absolutePath) || ".";
|
|
6258
|
+
const prefix = escapePathForGlob(fixWindowsSlashes(relativePath));
|
|
5966
6259
|
entries.push({
|
|
5967
6260
|
type: "dir",
|
|
5968
|
-
glob:
|
|
6261
|
+
glob: getSupportedFilesGlob().map((pattern2) => `${prefix}/**/${pattern2}`),
|
|
5969
6262
|
input: pattern
|
|
5970
6263
|
});
|
|
5971
6264
|
}
|
|
@@ -6007,13 +6300,20 @@ ${message}`
|
|
|
6007
6300
|
}
|
|
6008
6301
|
}
|
|
6009
6302
|
function getSupportedFilesGlob() {
|
|
6010
|
-
|
|
6011
|
-
const extensions = context.languages.flatMap((lang) => lang.extensions || []);
|
|
6012
|
-
const filenames = context.languages.flatMap((lang) => lang.filenames || []);
|
|
6013
|
-
supportedFilesGlob = `**/{${[...extensions.map((ext) => "*" + (ext[0] === "." ? ext : "." + ext)), ...filenames]}}`;
|
|
6014
|
-
}
|
|
6303
|
+
supportedFilesGlob ?? (supportedFilesGlob = [...getSupportedFilesGlobWithoutCache()]);
|
|
6015
6304
|
return supportedFilesGlob;
|
|
6016
6305
|
}
|
|
6306
|
+
function* getSupportedFilesGlobWithoutCache() {
|
|
6307
|
+
for (const {
|
|
6308
|
+
extensions = [],
|
|
6309
|
+
filenames = []
|
|
6310
|
+
} of context.languages) {
|
|
6311
|
+
yield* filenames;
|
|
6312
|
+
for (const extension of extensions) {
|
|
6313
|
+
yield `*${extension.startsWith(".") ? extension : `.${extension}`}`;
|
|
6314
|
+
}
|
|
6315
|
+
}
|
|
6316
|
+
}
|
|
6017
6317
|
}
|
|
6018
6318
|
var errorMessages = {
|
|
6019
6319
|
globError: {
|
package/internal/internal.mjs
CHANGED
|
@@ -673,9 +673,9 @@ var require_lib = __commonJS({
|
|
|
673
673
|
}
|
|
674
674
|
});
|
|
675
675
|
|
|
676
|
-
// node_modules/@babel/
|
|
676
|
+
// node_modules/@babel/code-frame/node_modules/escape-string-regexp/index.js
|
|
677
677
|
var require_escape_string_regexp = __commonJS({
|
|
678
|
-
"node_modules/@babel/
|
|
678
|
+
"node_modules/@babel/code-frame/node_modules/escape-string-regexp/index.js"(exports, module) {
|
|
679
679
|
"use strict";
|
|
680
680
|
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
|
|
681
681
|
module.exports = function(str) {
|
|
@@ -1829,9 +1829,9 @@ var require_ansi_styles = __commonJS({
|
|
|
1829
1829
|
}
|
|
1830
1830
|
});
|
|
1831
1831
|
|
|
1832
|
-
// node_modules/@babel/
|
|
1832
|
+
// node_modules/@babel/code-frame/node_modules/has-flag/index.js
|
|
1833
1833
|
var require_has_flag = __commonJS({
|
|
1834
|
-
"node_modules/@babel/
|
|
1834
|
+
"node_modules/@babel/code-frame/node_modules/has-flag/index.js"(exports, module) {
|
|
1835
1835
|
"use strict";
|
|
1836
1836
|
module.exports = (flag, argv) => {
|
|
1837
1837
|
argv = argv || process.argv;
|
|
@@ -1843,9 +1843,9 @@ var require_has_flag = __commonJS({
|
|
|
1843
1843
|
}
|
|
1844
1844
|
});
|
|
1845
1845
|
|
|
1846
|
-
// node_modules/@babel/
|
|
1846
|
+
// node_modules/@babel/code-frame/node_modules/supports-color/index.js
|
|
1847
1847
|
var require_supports_color = __commonJS({
|
|
1848
|
-
"node_modules/@babel/
|
|
1848
|
+
"node_modules/@babel/code-frame/node_modules/supports-color/index.js"(exports, module) {
|
|
1849
1849
|
"use strict";
|
|
1850
1850
|
var os = __require("os");
|
|
1851
1851
|
var hasFlag = require_has_flag();
|
|
@@ -1938,9 +1938,9 @@ var require_supports_color = __commonJS({
|
|
|
1938
1938
|
}
|
|
1939
1939
|
});
|
|
1940
1940
|
|
|
1941
|
-
// node_modules/@babel/
|
|
1941
|
+
// node_modules/@babel/code-frame/node_modules/chalk/templates.js
|
|
1942
1942
|
var require_templates = __commonJS({
|
|
1943
|
-
"node_modules/@babel/
|
|
1943
|
+
"node_modules/@babel/code-frame/node_modules/chalk/templates.js"(exports, module) {
|
|
1944
1944
|
"use strict";
|
|
1945
1945
|
var TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
|
|
1946
1946
|
var STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
|
|
@@ -2049,9 +2049,9 @@ var require_templates = __commonJS({
|
|
|
2049
2049
|
}
|
|
2050
2050
|
});
|
|
2051
2051
|
|
|
2052
|
-
// node_modules/@babel/
|
|
2052
|
+
// node_modules/@babel/code-frame/node_modules/chalk/index.js
|
|
2053
2053
|
var require_chalk = __commonJS({
|
|
2054
|
-
"node_modules/@babel/
|
|
2054
|
+
"node_modules/@babel/code-frame/node_modules/chalk/index.js"(exports, module) {
|
|
2055
2055
|
"use strict";
|
|
2056
2056
|
var escapeStringRegexp = require_escape_string_regexp();
|
|
2057
2057
|
var ansiStyles = require_ansi_styles();
|
|
@@ -2224,23 +2224,23 @@ var require_lib2 = __commonJS({
|
|
|
2224
2224
|
value: true
|
|
2225
2225
|
});
|
|
2226
2226
|
exports.default = highlight;
|
|
2227
|
-
exports.getChalk = getChalk;
|
|
2228
2227
|
exports.shouldHighlight = shouldHighlight;
|
|
2229
2228
|
var _jsTokens = require_js_tokens();
|
|
2230
2229
|
var _helperValidatorIdentifier = require_lib();
|
|
2231
|
-
var
|
|
2230
|
+
var _chalk2 = require_chalk();
|
|
2231
|
+
var chalk = _chalk2;
|
|
2232
2232
|
var sometimesKeywords = /* @__PURE__ */ new Set(["as", "async", "from", "get", "of", "set"]);
|
|
2233
|
-
function getDefs(
|
|
2233
|
+
function getDefs(chalk2) {
|
|
2234
2234
|
return {
|
|
2235
|
-
keyword:
|
|
2236
|
-
capitalized:
|
|
2237
|
-
jsxIdentifier:
|
|
2238
|
-
punctuator:
|
|
2239
|
-
number:
|
|
2240
|
-
string:
|
|
2241
|
-
regex:
|
|
2242
|
-
comment:
|
|
2243
|
-
invalid:
|
|
2235
|
+
keyword: chalk2.cyan,
|
|
2236
|
+
capitalized: chalk2.yellow,
|
|
2237
|
+
jsxIdentifier: chalk2.yellow,
|
|
2238
|
+
punctuator: chalk2.yellow,
|
|
2239
|
+
number: chalk2.magenta,
|
|
2240
|
+
string: chalk2.green,
|
|
2241
|
+
regex: chalk2.magenta,
|
|
2242
|
+
comment: chalk2.grey,
|
|
2243
|
+
invalid: chalk2.white.bgRed.bold
|
|
2244
2244
|
};
|
|
2245
2245
|
}
|
|
2246
2246
|
var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
|
@@ -2295,18 +2295,28 @@ var require_lib2 = __commonJS({
|
|
|
2295
2295
|
return highlighted;
|
|
2296
2296
|
}
|
|
2297
2297
|
function shouldHighlight(options) {
|
|
2298
|
-
return !!
|
|
2298
|
+
return !!chalk.supportsColor || options.forceColor;
|
|
2299
|
+
}
|
|
2300
|
+
var chalkWithForcedColor = void 0;
|
|
2301
|
+
function getChalk(forceColor) {
|
|
2302
|
+
if (forceColor) {
|
|
2303
|
+
var _chalkWithForcedColor;
|
|
2304
|
+
(_chalkWithForcedColor = chalkWithForcedColor) != null ? _chalkWithForcedColor : chalkWithForcedColor = new chalk.constructor({
|
|
2305
|
+
enabled: true,
|
|
2306
|
+
level: 1
|
|
2307
|
+
});
|
|
2308
|
+
return chalkWithForcedColor;
|
|
2309
|
+
}
|
|
2310
|
+
return chalk;
|
|
2299
2311
|
}
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
}) : _chalk;
|
|
2312
|
+
{
|
|
2313
|
+
{
|
|
2314
|
+
exports.getChalk = (options) => getChalk(options.forceColor);
|
|
2315
|
+
}
|
|
2305
2316
|
}
|
|
2306
2317
|
function highlight(code, options = {}) {
|
|
2307
2318
|
if (code !== "" && shouldHighlight(options)) {
|
|
2308
|
-
const
|
|
2309
|
-
const defs = getDefs(chalk);
|
|
2319
|
+
const defs = getDefs(getChalk(options.forceColor));
|
|
2310
2320
|
return highlightTokens(defs, code);
|
|
2311
2321
|
} else {
|
|
2312
2322
|
return code;
|
|
@@ -2325,12 +2335,26 @@ var require_lib3 = __commonJS({
|
|
|
2325
2335
|
exports.codeFrameColumns = codeFrameColumns;
|
|
2326
2336
|
exports.default = _default;
|
|
2327
2337
|
var _highlight = require_lib2();
|
|
2338
|
+
var _chalk2 = require_chalk();
|
|
2339
|
+
var chalk = _chalk2;
|
|
2340
|
+
var chalkWithForcedColor = void 0;
|
|
2341
|
+
function getChalk(forceColor) {
|
|
2342
|
+
if (forceColor) {
|
|
2343
|
+
var _chalkWithForcedColor;
|
|
2344
|
+
(_chalkWithForcedColor = chalkWithForcedColor) != null ? _chalkWithForcedColor : chalkWithForcedColor = new chalk.constructor({
|
|
2345
|
+
enabled: true,
|
|
2346
|
+
level: 1
|
|
2347
|
+
});
|
|
2348
|
+
return chalkWithForcedColor;
|
|
2349
|
+
}
|
|
2350
|
+
return chalk;
|
|
2351
|
+
}
|
|
2328
2352
|
var deprecationWarningShown = false;
|
|
2329
|
-
function getDefs(
|
|
2353
|
+
function getDefs(chalk2) {
|
|
2330
2354
|
return {
|
|
2331
|
-
gutter:
|
|
2332
|
-
marker:
|
|
2333
|
-
message:
|
|
2355
|
+
gutter: chalk2.grey,
|
|
2356
|
+
marker: chalk2.red.bold,
|
|
2357
|
+
message: chalk2.red.bold
|
|
2334
2358
|
};
|
|
2335
2359
|
}
|
|
2336
2360
|
var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
|
@@ -2392,8 +2416,8 @@ var require_lib3 = __commonJS({
|
|
|
2392
2416
|
}
|
|
2393
2417
|
function codeFrameColumns(rawLines, loc, opts = {}) {
|
|
2394
2418
|
const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
|
|
2395
|
-
const
|
|
2396
|
-
const defs = getDefs(
|
|
2419
|
+
const chalk2 = getChalk(opts.forceColor);
|
|
2420
|
+
const defs = getDefs(chalk2);
|
|
2397
2421
|
const maybeHighlight = (chalkFn, string) => {
|
|
2398
2422
|
return highlighted ? chalkFn(string) : string;
|
|
2399
2423
|
};
|
|
@@ -2432,7 +2456,7 @@ var require_lib3 = __commonJS({
|
|
|
2432
2456
|
${frame}`;
|
|
2433
2457
|
}
|
|
2434
2458
|
if (highlighted) {
|
|
2435
|
-
return
|
|
2459
|
+
return chalk2.reset(frame);
|
|
2436
2460
|
} else {
|
|
2437
2461
|
return frame;
|
|
2438
2462
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prettier",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "Prettier is an opinionated code formatter",
|
|
5
5
|
"bin": "./bin/prettier.cjs",
|
|
6
6
|
"repository": "prettier/prettier",
|
|
@@ -190,5 +190,6 @@
|
|
|
190
190
|
"standalone.d.ts",
|
|
191
191
|
"standalone.js",
|
|
192
192
|
"standalone.mjs"
|
|
193
|
-
]
|
|
193
|
+
],
|
|
194
|
+
"preferUnplugged": true
|
|
194
195
|
}
|