prettier 3.3.3 → 3.4.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/internal/cli.mjs CHANGED
@@ -628,9 +628,9 @@ var require_cjs = __commonJS({
628
628
  var primitive = "string";
629
629
  var ignore = {};
630
630
  var object = "object";
631
- var noop = (_, value) => value;
631
+ var noop = (_2, value) => value;
632
632
  var primitives = (value) => value instanceof Primitive ? Primitive(value) : value;
633
- var Primitives = (_, value) => typeof value === primitive ? new Primitive(value) : value;
633
+ var Primitives = (_2, value) => typeof value === primitive ? new Primitive(value) : value;
634
634
  var revive = (input, parsed, output, $) => {
635
635
  const lazy = [];
636
636
  for (let ke = keys(output), { length } = ke, y = 0; y < length; y++) {
@@ -701,9 +701,9 @@ var require_cjs = __commonJS({
701
701
  }
702
702
  });
703
703
 
704
- // node_modules/file-entry-cache/node_modules/flat-cache/src/utils.js
704
+ // node_modules/flat-cache/src/utils.js
705
705
  var require_utils = __commonJS({
706
- "node_modules/file-entry-cache/node_modules/flat-cache/src/utils.js"(exports, module) {
706
+ "node_modules/flat-cache/src/utils.js"(exports, module) {
707
707
  var fs6 = __require("fs");
708
708
  var path10 = __require("path");
709
709
  var flatted = require_cjs();
@@ -733,9 +733,9 @@ var require_utils = __commonJS({
733
733
  }
734
734
  });
735
735
 
736
- // node_modules/file-entry-cache/node_modules/flat-cache/src/del.js
736
+ // node_modules/flat-cache/src/del.js
737
737
  var require_del = __commonJS({
738
- "node_modules/file-entry-cache/node_modules/flat-cache/src/del.js"(exports, module) {
738
+ "node_modules/flat-cache/src/del.js"(exports, module) {
739
739
  var fs6 = __require("fs");
740
740
  var path10 = __require("path");
741
741
  function del(targetPath) {
@@ -763,9 +763,9 @@ var require_del = __commonJS({
763
763
  }
764
764
  });
765
765
 
766
- // node_modules/file-entry-cache/node_modules/flat-cache/src/cache.js
766
+ // node_modules/flat-cache/src/cache.js
767
767
  var require_cache = __commonJS({
768
- "node_modules/file-entry-cache/node_modules/flat-cache/src/cache.js"(exports, module) {
768
+ "node_modules/flat-cache/src/cache.js"(exports, module) {
769
769
  var path10 = __require("path");
770
770
  var fs6 = __require("fs");
771
771
  var Keyv = require_src();
@@ -963,15 +963,14 @@ var require_cache = __commonJS({
963
963
  var require_cache2 = __commonJS({
964
964
  "node_modules/file-entry-cache/cache.js"(exports, module) {
965
965
  var path10 = __require("path");
966
- var process5 = __require("process");
967
966
  var crypto = __require("crypto");
968
967
  module.exports = {
969
- createFromFile(filePath, useChecksum) {
968
+ createFromFile(filePath, useChecksum, currentWorkingDir) {
970
969
  const fname = path10.basename(filePath);
971
970
  const dir = path10.dirname(filePath);
972
- return this.create(fname, dir, useChecksum);
971
+ return this.create(fname, dir, useChecksum, currentWorkingDir);
973
972
  },
974
- create(cacheId, _path, useChecksum) {
973
+ create(cacheId, _path, useChecksum, currentWorkingDir) {
975
974
  const fs6 = __require("fs");
976
975
  const flatCache = require_cache();
977
976
  const cache = flatCache.load(cacheId, _path);
@@ -980,7 +979,11 @@ var require_cache2 = __commonJS({
980
979
  const cachedEntries = cache.keys();
981
980
  for (const fPath of cachedEntries) {
982
981
  try {
983
- fs6.statSync(fPath);
982
+ let filePath = fPath;
983
+ if (currentWorkingDir) {
984
+ filePath = path10.join(currentWorkingDir, fPath);
985
+ }
986
+ fs6.statSync(filePath);
984
987
  } catch (error) {
985
988
  if (error.code === "ENOENT") {
986
989
  cache.removeKey(fPath);
@@ -995,6 +998,11 @@ var require_cache2 = __commonJS({
995
998
  * @type {Object}
996
999
  */
997
1000
  cache,
1001
+ /**
1002
+ * To enable relative paths as the key with current working directory
1003
+ * @type {string}
1004
+ */
1005
+ currentWorkingDir: currentWorkingDir ?? void 0,
998
1006
  /**
999
1007
  * Given a buffer, calculate md5 hash of its content.
1000
1008
  * @method getHash
@@ -1046,9 +1054,6 @@ var require_cache2 = __commonJS({
1046
1054
  getFileDescriptor(file) {
1047
1055
  let fstat;
1048
1056
  try {
1049
- if (!path10.isAbsolute(file)) {
1050
- file = path10.resolve(process5.cwd(), file);
1051
- }
1052
1057
  fstat = fs6.statSync(file);
1053
1058
  } catch (error) {
1054
1059
  this.removeEntry(file);
@@ -1059,8 +1064,14 @@ var require_cache2 = __commonJS({
1059
1064
  }
1060
1065
  return this._getFileDescriptorUsingMtimeAndSize(file, fstat);
1061
1066
  },
1067
+ _getFileKey(file) {
1068
+ if (this.currentWorkingDir) {
1069
+ return file.split(this.currentWorkingDir).pop();
1070
+ }
1071
+ return file;
1072
+ },
1062
1073
  _getFileDescriptorUsingMtimeAndSize(file, fstat) {
1063
- let meta = cache.getKey(file);
1074
+ let meta = cache.getKey(this._getFileKey(file));
1064
1075
  const cacheExists = Boolean(meta);
1065
1076
  const cSize = fstat.size;
1066
1077
  const cTime = fstat.mtime.getTime();
@@ -1072,15 +1083,15 @@ var require_cache2 = __commonJS({
1072
1083
  } else {
1073
1084
  meta = { size: cSize, mtime: cTime };
1074
1085
  }
1075
- const nEntry = normalizedEntries[file] = {
1076
- key: file,
1086
+ const nEntry = normalizedEntries[this._getFileKey(file)] = {
1087
+ key: this._getFileKey(file),
1077
1088
  changed: !cacheExists || isDifferentDate || isDifferentSize,
1078
1089
  meta
1079
1090
  };
1080
1091
  return nEntry;
1081
1092
  },
1082
1093
  _getFileDescriptorUsingChecksum(file) {
1083
- let meta = cache.getKey(file);
1094
+ let meta = cache.getKey(this._getFileKey(file));
1084
1095
  const cacheExists = Boolean(meta);
1085
1096
  let contentBuffer;
1086
1097
  try {
@@ -1095,8 +1106,8 @@ var require_cache2 = __commonJS({
1095
1106
  } else {
1096
1107
  meta = { hash };
1097
1108
  }
1098
- const nEntry = normalizedEntries[file] = {
1099
- key: file,
1109
+ const nEntry = normalizedEntries[this._getFileKey(file)] = {
1110
+ key: this._getFileKey(file),
1100
1111
  changed: !cacheExists || isDifferent,
1101
1112
  meta
1102
1113
  };
@@ -1135,11 +1146,8 @@ var require_cache2 = __commonJS({
1135
1146
  * @param entryName
1136
1147
  */
1137
1148
  removeEntry(entryName) {
1138
- if (!path10.isAbsolute(entryName)) {
1139
- entryName = path10.resolve(process5.cwd(), entryName);
1140
- }
1141
- delete normalizedEntries[entryName];
1142
- cache.removeKey(entryName);
1149
+ delete normalizedEntries[this._getFileKey(entryName)];
1150
+ cache.removeKey(this._getFileKey(entryName));
1143
1151
  },
1144
1152
  /**
1145
1153
  * Delete the cache file from the disk
@@ -1156,7 +1164,11 @@ var require_cache2 = __commonJS({
1156
1164
  cache.destroy();
1157
1165
  },
1158
1166
  _getMetaForFileUsingCheckSum(cacheEntry) {
1159
- const contentBuffer = fs6.readFileSync(cacheEntry.key);
1167
+ let filePath = cacheEntry.key;
1168
+ if (this.currentWorkingDir) {
1169
+ filePath = path10.join(this.currentWorkingDir, filePath);
1170
+ }
1171
+ const contentBuffer = fs6.readFileSync(filePath);
1160
1172
  const hash = this.getHash(contentBuffer);
1161
1173
  const meta = Object.assign(cacheEntry.meta, { hash });
1162
1174
  delete meta.size;
@@ -1164,7 +1176,11 @@ var require_cache2 = __commonJS({
1164
1176
  return meta;
1165
1177
  },
1166
1178
  _getMetaForFileUsingMtimeAndSize(cacheEntry) {
1167
- const stat = fs6.statSync(cacheEntry.key);
1179
+ let filePath = cacheEntry.key;
1180
+ if (currentWorkingDir) {
1181
+ filePath = path10.join(currentWorkingDir, filePath);
1182
+ }
1183
+ const stat = fs6.statSync(filePath);
1168
1184
  const meta = Object.assign(cacheEntry.meta, {
1169
1185
  size: stat.size,
1170
1186
  mtime: stat.mtime.getTime()
@@ -1189,7 +1205,7 @@ var require_cache2 = __commonJS({
1189
1205
  const cacheEntry = entries[entryName];
1190
1206
  try {
1191
1207
  const meta = useChecksum ? me._getMetaForFileUsingCheckSum(cacheEntry) : me._getMetaForFileUsingMtimeAndSize(cacheEntry);
1192
- cache.setKey(entryName, meta);
1208
+ cache.setKey(this._getFileKey(entryName), meta);
1193
1209
  } catch (error) {
1194
1210
  if (error.code !== "ENOENT") {
1195
1211
  throw error;
@@ -1204,223 +1220,6 @@ var require_cache2 = __commonJS({
1204
1220
  }
1205
1221
  });
1206
1222
 
1207
- // node_modules/wcwidth.js/combining.js
1208
- var require_combining = __commonJS({
1209
- "node_modules/wcwidth.js/combining.js"(exports, module) {
1210
- module.exports = [
1211
- [768, 879],
1212
- [1155, 1158],
1213
- [1160, 1161],
1214
- [1425, 1469],
1215
- [1471, 1471],
1216
- [1473, 1474],
1217
- [1476, 1477],
1218
- [1479, 1479],
1219
- [1536, 1539],
1220
- [1552, 1557],
1221
- [1611, 1630],
1222
- [1648, 1648],
1223
- [1750, 1764],
1224
- [1767, 1768],
1225
- [1770, 1773],
1226
- [1807, 1807],
1227
- [1809, 1809],
1228
- [1840, 1866],
1229
- [1958, 1968],
1230
- [2027, 2035],
1231
- [2305, 2306],
1232
- [2364, 2364],
1233
- [2369, 2376],
1234
- [2381, 2381],
1235
- [2385, 2388],
1236
- [2402, 2403],
1237
- [2433, 2433],
1238
- [2492, 2492],
1239
- [2497, 2500],
1240
- [2509, 2509],
1241
- [2530, 2531],
1242
- [2561, 2562],
1243
- [2620, 2620],
1244
- [2625, 2626],
1245
- [2631, 2632],
1246
- [2635, 2637],
1247
- [2672, 2673],
1248
- [2689, 2690],
1249
- [2748, 2748],
1250
- [2753, 2757],
1251
- [2759, 2760],
1252
- [2765, 2765],
1253
- [2786, 2787],
1254
- [2817, 2817],
1255
- [2876, 2876],
1256
- [2879, 2879],
1257
- [2881, 2883],
1258
- [2893, 2893],
1259
- [2902, 2902],
1260
- [2946, 2946],
1261
- [3008, 3008],
1262
- [3021, 3021],
1263
- [3134, 3136],
1264
- [3142, 3144],
1265
- [3146, 3149],
1266
- [3157, 3158],
1267
- [3260, 3260],
1268
- [3263, 3263],
1269
- [3270, 3270],
1270
- [3276, 3277],
1271
- [3298, 3299],
1272
- [3393, 3395],
1273
- [3405, 3405],
1274
- [3530, 3530],
1275
- [3538, 3540],
1276
- [3542, 3542],
1277
- [3633, 3633],
1278
- [3636, 3642],
1279
- [3655, 3662],
1280
- [3761, 3761],
1281
- [3764, 3769],
1282
- [3771, 3772],
1283
- [3784, 3789],
1284
- [3864, 3865],
1285
- [3893, 3893],
1286
- [3895, 3895],
1287
- [3897, 3897],
1288
- [3953, 3966],
1289
- [3968, 3972],
1290
- [3974, 3975],
1291
- [3984, 3991],
1292
- [3993, 4028],
1293
- [4038, 4038],
1294
- [4141, 4144],
1295
- [4146, 4146],
1296
- [4150, 4151],
1297
- [4153, 4153],
1298
- [4184, 4185],
1299
- [4448, 4607],
1300
- [4959, 4959],
1301
- [5906, 5908],
1302
- [5938, 5940],
1303
- [5970, 5971],
1304
- [6002, 6003],
1305
- [6068, 6069],
1306
- [6071, 6077],
1307
- [6086, 6086],
1308
- [6089, 6099],
1309
- [6109, 6109],
1310
- [6155, 6157],
1311
- [6313, 6313],
1312
- [6432, 6434],
1313
- [6439, 6440],
1314
- [6450, 6450],
1315
- [6457, 6459],
1316
- [6679, 6680],
1317
- [6912, 6915],
1318
- [6964, 6964],
1319
- [6966, 6970],
1320
- [6972, 6972],
1321
- [6978, 6978],
1322
- [7019, 7027],
1323
- [7616, 7626],
1324
- [7678, 7679],
1325
- [8203, 8207],
1326
- [8234, 8238],
1327
- [8288, 8291],
1328
- [8298, 8303],
1329
- [8400, 8431],
1330
- [12330, 12335],
1331
- [12441, 12442],
1332
- [43014, 43014],
1333
- [43019, 43019],
1334
- [43045, 43046],
1335
- [64286, 64286],
1336
- [65024, 65039],
1337
- [65056, 65059],
1338
- [65279, 65279],
1339
- [65529, 65531],
1340
- [68097, 68099],
1341
- [68101, 68102],
1342
- [68108, 68111],
1343
- [68152, 68154],
1344
- [68159, 68159],
1345
- [119143, 119145],
1346
- [119155, 119170],
1347
- [119173, 119179],
1348
- [119210, 119213],
1349
- [119362, 119364],
1350
- [917505, 917505],
1351
- [917536, 917631],
1352
- [917760, 917999]
1353
- ];
1354
- }
1355
- });
1356
-
1357
- // node_modules/wcwidth.js/index.js
1358
- var require_wcwidth = __commonJS({
1359
- "node_modules/wcwidth.js/index.js"(exports, module) {
1360
- var combining = require_combining();
1361
- var DEFAULTS = {
1362
- nul: 0,
1363
- control: 0
1364
- };
1365
- function bisearch(ucs) {
1366
- let min = 0;
1367
- let max = combining.length - 1;
1368
- let mid;
1369
- if (ucs < combining[0][0] || ucs > combining[max][1]) return false;
1370
- while (max >= min) {
1371
- mid = Math.floor((min + max) / 2);
1372
- if (ucs > combining[mid][1]) min = mid + 1;
1373
- else if (ucs < combining[mid][0]) max = mid - 1;
1374
- else return true;
1375
- }
1376
- return false;
1377
- }
1378
- function wcwidth2(ucs, opts) {
1379
- if (ucs === 0) return opts.nul;
1380
- if (ucs < 32 || ucs >= 127 && ucs < 160) return opts.control;
1381
- if (bisearch(ucs)) return 0;
1382
- return 1 + (ucs >= 4352 && (ucs <= 4447 || // Hangul Jamo init. consonants
1383
- ucs == 9001 || ucs == 9002 || ucs >= 11904 && ucs <= 42191 && ucs != 12351 || // CJK ... Yi
1384
- ucs >= 44032 && ucs <= 55203 || // Hangul Syllables
1385
- ucs >= 63744 && ucs <= 64255 || // CJK Compatibility Ideographs
1386
- ucs >= 65040 && ucs <= 65049 || // Vertical forms
1387
- ucs >= 65072 && ucs <= 65135 || // CJK Compatibility Forms
1388
- ucs >= 65280 && ucs <= 65376 || // Fullwidth Forms
1389
- ucs >= 65504 && ucs <= 65510 || ucs >= 131072 && ucs <= 196605 || ucs >= 196608 && ucs <= 262141));
1390
- }
1391
- function wcswidth(str, opts) {
1392
- let h;
1393
- let l;
1394
- let s = 0;
1395
- let n;
1396
- if (typeof str !== "string") return wcwidth2(str, opts);
1397
- for (let i = 0; i < str.length; i++) {
1398
- h = str.charCodeAt(i);
1399
- if (h >= 55296 && h <= 56319) {
1400
- l = str.charCodeAt(++i);
1401
- if (l >= 56320 && l <= 57343) {
1402
- h = (h - 55296) * 1024 + (l - 56320) + 65536;
1403
- } else {
1404
- i--;
1405
- }
1406
- }
1407
- n = wcwidth2(h, opts);
1408
- if (n < 0) return -1;
1409
- s += n;
1410
- }
1411
- return s;
1412
- }
1413
- module.exports = (str) => wcswidth(str, DEFAULTS);
1414
- module.exports.config = (opts = {}) => {
1415
- opts = {
1416
- ...DEFAULTS,
1417
- ...opts
1418
- };
1419
- return (str) => wcswidth(str, opts);
1420
- };
1421
- }
1422
- });
1423
-
1424
1223
  // src/cli/index.js
1425
1224
  import * as prettier2 from "../index.mjs";
1426
1225
 
@@ -1760,7 +1559,7 @@ var postProcess = (input, toUpperCase) => {
1760
1559
  (match, pattern, offset) => ["_", "-"].includes(input.charAt(offset + match.length)) ? match : toUpperCase(match)
1761
1560
  ),
1762
1561
  SEPARATORS_AND_IDENTIFIER,
1763
- (_, identifier) => toUpperCase(identifier)
1562
+ (_2, identifier) => toUpperCase(identifier)
1764
1563
  );
1765
1564
  };
1766
1565
  function camelCase(input, options) {
@@ -1868,11 +1667,7 @@ var normalizeToPosix = path.sep === "\\" ? (filepath) => string_replace_all_defa
1868
1667
  "\\",
1869
1668
  "/"
1870
1669
  ) : (filepath) => filepath;
1871
- var {
1872
- isNonEmptyArray,
1873
- partition,
1874
- omit
1875
- } = sharedWithCli2.utils;
1670
+ var { omit } = sharedWithCli2.utils;
1876
1671
 
1877
1672
  // src/cli/options/create-minimist-options.js
1878
1673
  function createMinimistOptions(detailedOptions) {
@@ -2538,22 +2333,16 @@ function parseArgvWithoutPlugins(rawArguments, logger, keys) {
2538
2333
  // src/cli/context.js
2539
2334
  var _stack;
2540
2335
  var Context = class {
2541
- constructor({
2542
- rawArguments,
2543
- logger
2544
- }) {
2336
+ constructor({ rawArguments, logger }) {
2545
2337
  __privateAdd(this, _stack, []);
2546
2338
  this.rawArguments = rawArguments;
2547
2339
  this.logger = logger;
2548
2340
  }
2549
2341
  async init() {
2550
- const {
2551
- rawArguments,
2552
- logger
2553
- } = this;
2554
- const {
2555
- plugins
2556
- } = parseArgvWithoutPlugins(rawArguments, logger, ["plugin"]);
2342
+ const { rawArguments, logger } = this;
2343
+ const { plugins } = parseArgvWithoutPlugins(rawArguments, logger, [
2344
+ "plugin"
2345
+ ]);
2557
2346
  await this.pushContextPlugins(plugins);
2558
2347
  const argv = parseArgv(rawArguments, this.detailedOptions, logger);
2559
2348
  this.argv = argv;
@@ -2578,10 +2367,7 @@ var Context = class {
2578
2367
  }
2579
2368
  // eslint-disable-next-line getter-return
2580
2369
  get performanceTestFlag() {
2581
- const {
2582
- debugBenchmark,
2583
- debugRepeat
2584
- } = this.argv;
2370
+ const { debugBenchmark, debugRepeat } = this.argv;
2585
2371
  if (debugBenchmark) {
2586
2372
  return {
2587
2373
  name: "--debug-benchmark",
@@ -2594,9 +2380,7 @@ var Context = class {
2594
2380
  debugRepeat
2595
2381
  };
2596
2382
  }
2597
- const {
2598
- PRETTIER_PERF_REPEAT
2599
- } = process.env;
2383
+ const { PRETTIER_PERF_REPEAT } = process.env;
2600
2384
  if (PRETTIER_PERF_REPEAT && /^\d+$/u.test(PRETTIER_PERF_REPEAT)) {
2601
2385
  return {
2602
2386
  name: "PRETTIER_PERF_REPEAT (environment variable)",
@@ -2653,16 +2437,12 @@ import path3 from "path";
2653
2437
  async function* expandPatterns(context) {
2654
2438
  const seen = /* @__PURE__ */ new Set();
2655
2439
  let noResults = true;
2656
- for await (const {
2657
- filePath,
2658
- ignoreUnknown,
2659
- error
2660
- } of expandPatternsInternal(context)) {
2440
+ for await (const { filePath, ignoreUnknown, error } of expandPatternsInternal(
2441
+ context
2442
+ )) {
2661
2443
  noResults = false;
2662
2444
  if (error) {
2663
- yield {
2664
- error
2665
- };
2445
+ yield { error };
2666
2446
  continue;
2667
2447
  }
2668
2448
  const filename = path3.resolve(filePath);
@@ -2670,10 +2450,7 @@ async function* expandPatterns(context) {
2670
2450
  continue;
2671
2451
  }
2672
2452
  seen.add(filename);
2673
- yield {
2674
- filename,
2675
- ignoreUnknown
2676
- };
2453
+ yield { filename, ignoreUnknown };
2677
2454
  }
2678
2455
  if (noResults && context.argv.errorOnUnmatchedPattern !== false) {
2679
2456
  yield {
@@ -2682,7 +2459,7 @@ async function* expandPatterns(context) {
2682
2459
  }
2683
2460
  }
2684
2461
  async function* expandPatternsInternal(context) {
2685
- const silentlyIgnoredDirs = [".git", ".sl", ".svn", ".hg"];
2462
+ const silentlyIgnoredDirs = [".git", ".sl", ".svn", ".hg", ".jj"];
2686
2463
  if (context.argv.withNodeModules !== true) {
2687
2464
  silentlyIgnoredDirs.push("node_modules");
2688
2465
  }
@@ -2706,7 +2483,9 @@ async function* expandPatternsInternal(context) {
2706
2483
  error: `Explicitly specified pattern "${pattern}" is a symbolic link.`
2707
2484
  };
2708
2485
  } else {
2709
- context.logger.debug(`Skipping pattern "${pattern}", as it is a symbolic link.`);
2486
+ context.logger.debug(
2487
+ `Skipping pattern "${pattern}", as it is a symbolic link.`
2488
+ );
2710
2489
  }
2711
2490
  } else if (stat.isFile()) {
2712
2491
  entries.push({
@@ -2734,18 +2513,11 @@ async function* expandPatternsInternal(context) {
2734
2513
  });
2735
2514
  }
2736
2515
  }
2737
- for (const {
2738
- type,
2739
- glob,
2740
- input,
2741
- ignoreUnknown
2742
- } of entries) {
2516
+ for (const { type, glob, input, ignoreUnknown } of entries) {
2743
2517
  let result;
2744
2518
  try {
2745
2519
  result = await fastGlob(glob, globOptions);
2746
- } catch ({
2747
- message
2748
- }) {
2520
+ } catch ({ message }) {
2749
2521
  yield {
2750
2522
  error: `${errorMessages.globError[type]}: "${input}".
2751
2523
  ${message}`
@@ -2754,15 +2526,10 @@ ${message}`
2754
2526
  }
2755
2527
  if (result.length === 0) {
2756
2528
  if (context.argv.errorOnUnmatchedPattern !== false) {
2757
- yield {
2758
- error: `${errorMessages.emptyResults[type]}: "${input}".`
2759
- };
2529
+ yield { error: `${errorMessages.emptyResults[type]}: "${input}".` };
2760
2530
  }
2761
2531
  } else {
2762
- yield* sortPaths(result).map((filePath) => ({
2763
- filePath,
2764
- ignoreUnknown
2765
- }));
2532
+ yield* sortPaths(result).map((filePath) => ({ filePath, ignoreUnknown }));
2766
2533
  }
2767
2534
  }
2768
2535
  }
@@ -2828,7 +2595,7 @@ import path6 from "path";
2828
2595
  import path5 from "path";
2829
2596
  import { fileURLToPath as fileURLToPath2 } from "url";
2830
2597
 
2831
- // node_modules/pkg-dir/node_modules/locate-path/index.js
2598
+ // node_modules/locate-path/index.js
2832
2599
  import process3 from "process";
2833
2600
  import path4 from "path";
2834
2601
  import fs2, { promises as fsPromises } from "fs";
@@ -3552,11 +3319,12 @@ ${error2.message}`
3552
3319
  // src/cli/logger.js
3553
3320
  import readline from "readline";
3554
3321
 
3555
- // node_modules/ansi-regex/index.js
3322
+ // node_modules/strip-ansi/node_modules/ansi-regex/index.js
3556
3323
  function ansiRegex({ onlyFirst = false } = {}) {
3324
+ const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
3557
3325
  const pattern = [
3558
- "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
3559
- "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
3326
+ `[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
3327
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
3560
3328
  ].join("|");
3561
3329
  return new RegExp(pattern, onlyFirst ? void 0 : "g");
3562
3330
  }
@@ -3570,13 +3338,221 @@ function stripAnsi(string) {
3570
3338
  return string.replace(regex, "");
3571
3339
  }
3572
3340
 
3341
+ // node_modules/wcwidth.js/combining.js
3342
+ var combining_default = [
3343
+ [768, 879],
3344
+ [1155, 1158],
3345
+ [1160, 1161],
3346
+ [1425, 1469],
3347
+ [1471, 1471],
3348
+ [1473, 1474],
3349
+ [1476, 1477],
3350
+ [1479, 1479],
3351
+ [1536, 1539],
3352
+ [1552, 1557],
3353
+ [1611, 1630],
3354
+ [1648, 1648],
3355
+ [1750, 1764],
3356
+ [1767, 1768],
3357
+ [1770, 1773],
3358
+ [1807, 1807],
3359
+ [1809, 1809],
3360
+ [1840, 1866],
3361
+ [1958, 1968],
3362
+ [2027, 2035],
3363
+ [2305, 2306],
3364
+ [2364, 2364],
3365
+ [2369, 2376],
3366
+ [2381, 2381],
3367
+ [2385, 2388],
3368
+ [2402, 2403],
3369
+ [2433, 2433],
3370
+ [2492, 2492],
3371
+ [2497, 2500],
3372
+ [2509, 2509],
3373
+ [2530, 2531],
3374
+ [2561, 2562],
3375
+ [2620, 2620],
3376
+ [2625, 2626],
3377
+ [2631, 2632],
3378
+ [2635, 2637],
3379
+ [2672, 2673],
3380
+ [2689, 2690],
3381
+ [2748, 2748],
3382
+ [2753, 2757],
3383
+ [2759, 2760],
3384
+ [2765, 2765],
3385
+ [2786, 2787],
3386
+ [2817, 2817],
3387
+ [2876, 2876],
3388
+ [2879, 2879],
3389
+ [2881, 2883],
3390
+ [2893, 2893],
3391
+ [2902, 2902],
3392
+ [2946, 2946],
3393
+ [3008, 3008],
3394
+ [3021, 3021],
3395
+ [3134, 3136],
3396
+ [3142, 3144],
3397
+ [3146, 3149],
3398
+ [3157, 3158],
3399
+ [3260, 3260],
3400
+ [3263, 3263],
3401
+ [3270, 3270],
3402
+ [3276, 3277],
3403
+ [3298, 3299],
3404
+ [3393, 3395],
3405
+ [3405, 3405],
3406
+ [3530, 3530],
3407
+ [3538, 3540],
3408
+ [3542, 3542],
3409
+ [3633, 3633],
3410
+ [3636, 3642],
3411
+ [3655, 3662],
3412
+ [3761, 3761],
3413
+ [3764, 3769],
3414
+ [3771, 3772],
3415
+ [3784, 3789],
3416
+ [3864, 3865],
3417
+ [3893, 3893],
3418
+ [3895, 3895],
3419
+ [3897, 3897],
3420
+ [3953, 3966],
3421
+ [3968, 3972],
3422
+ [3974, 3975],
3423
+ [3984, 3991],
3424
+ [3993, 4028],
3425
+ [4038, 4038],
3426
+ [4141, 4144],
3427
+ [4146, 4146],
3428
+ [4150, 4151],
3429
+ [4153, 4153],
3430
+ [4184, 4185],
3431
+ [4448, 4607],
3432
+ [4959, 4959],
3433
+ [5906, 5908],
3434
+ [5938, 5940],
3435
+ [5970, 5971],
3436
+ [6002, 6003],
3437
+ [6068, 6069],
3438
+ [6071, 6077],
3439
+ [6086, 6086],
3440
+ [6089, 6099],
3441
+ [6109, 6109],
3442
+ [6155, 6157],
3443
+ [6313, 6313],
3444
+ [6432, 6434],
3445
+ [6439, 6440],
3446
+ [6450, 6450],
3447
+ [6457, 6459],
3448
+ [6679, 6680],
3449
+ [6912, 6915],
3450
+ [6964, 6964],
3451
+ [6966, 6970],
3452
+ [6972, 6972],
3453
+ [6978, 6978],
3454
+ [7019, 7027],
3455
+ [7616, 7626],
3456
+ [7678, 7679],
3457
+ [8203, 8207],
3458
+ [8234, 8238],
3459
+ [8288, 8291],
3460
+ [8298, 8303],
3461
+ [8400, 8431],
3462
+ [12330, 12335],
3463
+ [12441, 12442],
3464
+ [43014, 43014],
3465
+ [43019, 43019],
3466
+ [43045, 43046],
3467
+ [64286, 64286],
3468
+ [65024, 65039],
3469
+ [65056, 65059],
3470
+ [65279, 65279],
3471
+ [65529, 65531],
3472
+ [68097, 68099],
3473
+ [68101, 68102],
3474
+ [68108, 68111],
3475
+ [68152, 68154],
3476
+ [68159, 68159],
3477
+ [119143, 119145],
3478
+ [119155, 119170],
3479
+ [119173, 119179],
3480
+ [119210, 119213],
3481
+ [119362, 119364],
3482
+ [917505, 917505],
3483
+ [917536, 917631],
3484
+ [917760, 917999]
3485
+ ];
3486
+
3487
+ // node_modules/wcwidth.js/index.js
3488
+ var DEFAULTS = {
3489
+ nul: 0,
3490
+ control: 0
3491
+ };
3492
+ function bisearch(ucs) {
3493
+ let min = 0;
3494
+ let max = combining_default.length - 1;
3495
+ let mid;
3496
+ if (ucs < combining_default[0][0] || ucs > combining_default[max][1]) return false;
3497
+ while (max >= min) {
3498
+ mid = Math.floor((min + max) / 2);
3499
+ if (ucs > combining_default[mid][1]) min = mid + 1;
3500
+ else if (ucs < combining_default[mid][0]) max = mid - 1;
3501
+ else return true;
3502
+ }
3503
+ return false;
3504
+ }
3505
+ function wcwidth(ucs, opts) {
3506
+ if (ucs === 0) return opts.nul;
3507
+ if (ucs < 32 || ucs >= 127 && ucs < 160) return opts.control;
3508
+ if (bisearch(ucs)) return 0;
3509
+ return 1 + (ucs >= 4352 && (ucs <= 4447 || // Hangul Jamo init. consonants
3510
+ ucs == 9001 || ucs == 9002 || ucs >= 11904 && ucs <= 42191 && ucs != 12351 || // CJK ... Yi
3511
+ ucs >= 44032 && ucs <= 55203 || // Hangul Syllables
3512
+ ucs >= 63744 && ucs <= 64255 || // CJK Compatibility Ideographs
3513
+ ucs >= 65040 && ucs <= 65049 || // Vertical forms
3514
+ ucs >= 65072 && ucs <= 65135 || // CJK Compatibility Forms
3515
+ ucs >= 65280 && ucs <= 65376 || // Fullwidth Forms
3516
+ ucs >= 65504 && ucs <= 65510 || ucs >= 131072 && ucs <= 196605 || ucs >= 196608 && ucs <= 262141));
3517
+ }
3518
+ function wcswidth(str, opts) {
3519
+ let h;
3520
+ let l;
3521
+ let s = 0;
3522
+ let n;
3523
+ if (typeof str !== "string") return wcwidth(str, opts);
3524
+ for (let i = 0; i < str.length; i++) {
3525
+ h = str.charCodeAt(i);
3526
+ if (h >= 55296 && h <= 56319) {
3527
+ l = str.charCodeAt(++i);
3528
+ if (l >= 56320 && l <= 57343) {
3529
+ h = (h - 55296) * 1024 + (l - 56320) + 65536;
3530
+ } else {
3531
+ i--;
3532
+ }
3533
+ }
3534
+ n = wcwidth(h, opts);
3535
+ if (n < 0) return -1;
3536
+ s += n;
3537
+ }
3538
+ return s;
3539
+ }
3540
+ var _ = (str) => wcswidth(str, DEFAULTS);
3541
+ _.config = (opts = {}) => {
3542
+ opts = {
3543
+ ...DEFAULTS,
3544
+ ...opts
3545
+ };
3546
+ return (str) => wcswidth(str, opts);
3547
+ };
3548
+ var wcwidth_default = _;
3549
+
3573
3550
  // src/cli/logger.js
3574
- var import_wcwidth = __toESM(require_wcwidth(), 1);
3575
3551
  var countLines = (stream, text) => {
3576
3552
  const columns = stream.columns || 80;
3577
3553
  let lineCount = 0;
3578
3554
  for (const line of stripAnsi(text).split("\n")) {
3579
- lineCount += Math.max(1, Math.ceil((0, import_wcwidth.default)(line) / columns));
3555
+ lineCount += Math.max(1, Math.ceil(wcwidth_default(line) / columns));
3580
3556
  }
3581
3557
  return lineCount;
3582
3558
  };
@@ -3590,10 +3566,8 @@ var clear = (stream, text) => () => {
3590
3566
  readline.cursorTo(stream, 0);
3591
3567
  }
3592
3568
  };
3593
- var emptyLogResult = {
3594
- clear() {
3595
- }
3596
- };
3569
+ var emptyLogResult = { clear() {
3570
+ } };
3597
3571
  function createLogger(logLevel = "log") {
3598
3572
  return {
3599
3573
  logLevel,
@@ -3638,14 +3612,17 @@ function createLogger(logLevel = "log") {
3638
3612
  if (loggerName === "debug") {
3639
3613
  return true;
3640
3614
  }
3615
+ // fall through
3641
3616
  case "log":
3642
3617
  if (loggerName === "log") {
3643
3618
  return true;
3644
3619
  }
3620
+ // fall through
3645
3621
  case "warn":
3646
3622
  if (loggerName === "warn") {
3647
3623
  return true;
3648
3624
  }
3625
+ // fall through
3649
3626
  case "error":
3650
3627
  return loggerName === "error";
3651
3628
  }
@@ -3697,14 +3674,16 @@ function createDefaultValueDisplay(value) {
3697
3674
  }
3698
3675
  function getOptionDefaultValue(context, optionName) {
3699
3676
  var _a;
3700
- const option = context.detailedOptions.find(({
3701
- name
3702
- }) => name === optionName);
3677
+ const option = context.detailedOptions.find(
3678
+ ({ name }) => name === optionName
3679
+ );
3703
3680
  if ((option == null ? void 0 : option.default) !== void 0) {
3704
3681
  return option.default;
3705
3682
  }
3706
3683
  const optionCamelName = camelCase(optionName);
3707
- return formatOptionsHiddenDefaults[optionCamelName] ?? ((_a = context.supportOptions.find((option2) => !option2.deprecated && option2.name === optionCamelName)) == null ? void 0 : _a.default);
3684
+ return formatOptionsHiddenDefaults[optionCamelName] ?? ((_a = context.supportOptions.find(
3685
+ (option2) => !option2.deprecated && option2.name === optionCamelName
3686
+ )) == null ? void 0 : _a.default);
3708
3687
  }
3709
3688
  function createOptionUsageHeader(option) {
3710
3689
  const name = `--${option.name}`;
@@ -3738,25 +3717,39 @@ function createOptionUsageType(option) {
3738
3717
  function createChoiceUsages(choices, margin, indentation) {
3739
3718
  const activeChoices = choices.filter((choice) => !choice.deprecated);
3740
3719
  const threshold = Math.max(0, ...activeChoices.map((choice) => choice.value.length)) + margin;
3741
- return activeChoices.map((choice) => indent(createOptionUsageRow(choice.value, choice.description, threshold), indentation));
3720
+ return activeChoices.map(
3721
+ (choice) => indent(
3722
+ createOptionUsageRow(choice.value, choice.description, threshold),
3723
+ indentation
3724
+ )
3725
+ );
3742
3726
  }
3743
3727
  function createOptionUsage(context, option, threshold) {
3744
3728
  const header = createOptionUsageHeader(option);
3745
3729
  const optionDefaultValue = getOptionDefaultValue(context, option.name);
3746
- return createOptionUsageRow(header, `${option.description}${optionDefaultValue === void 0 ? "" : `
3747
- Defaults to ${createDefaultValueDisplay(optionDefaultValue)}.`}`, threshold);
3730
+ return createOptionUsageRow(
3731
+ header,
3732
+ `${option.description}${optionDefaultValue === void 0 ? "" : `
3733
+ Defaults to ${createDefaultValueDisplay(optionDefaultValue)}.`}`,
3734
+ threshold
3735
+ );
3748
3736
  }
3749
3737
  function getOptionsWithOpposites(options) {
3750
- const optionsWithOpposites = options.map((option) => [option.description ? option : null, option.oppositeDescription ? {
3751
- ...option,
3752
- name: `no-${option.name}`,
3753
- type: "boolean",
3754
- description: option.oppositeDescription
3755
- } : null]);
3738
+ const optionsWithOpposites = options.map((option) => [
3739
+ option.description ? option : null,
3740
+ option.oppositeDescription ? {
3741
+ ...option,
3742
+ name: `no-${option.name}`,
3743
+ type: "boolean",
3744
+ description: option.oppositeDescription
3745
+ } : null
3746
+ ]);
3756
3747
  return optionsWithOpposites.flat().filter(Boolean);
3757
3748
  }
3758
3749
  function createUsage(context) {
3759
- const sortedOptions = context.detailedOptions.sort((optionA, optionB) => optionA.name.localeCompare(optionB.name));
3750
+ const sortedOptions = context.detailedOptions.sort(
3751
+ (optionA, optionB) => optionA.name.localeCompare(optionB.name)
3752
+ );
3760
3753
  const options = getOptionsWithOpposites(sortedOptions).filter(
3761
3754
  // remove unnecessary option (e.g. `semi`, `color`, etc.), which is only used for --help <flag>
3762
3755
  (option) => !(option.type === "boolean" && option.oppositeDescription && !option.name.startsWith("no-"))
@@ -3764,10 +3757,18 @@ function createUsage(context) {
3764
3757
  const groupedOptions = groupBy(options, (option) => option.category);
3765
3758
  const firstCategories = categoryOrder.slice(0, -1);
3766
3759
  const lastCategories = categoryOrder.slice(-1);
3767
- const restCategories = Object.keys(groupedOptions).filter((category) => !categoryOrder.includes(category));
3768
- const allCategories = [...firstCategories, ...restCategories, ...lastCategories];
3760
+ const restCategories = Object.keys(groupedOptions).filter(
3761
+ (category) => !categoryOrder.includes(category)
3762
+ );
3763
+ const allCategories = [
3764
+ ...firstCategories,
3765
+ ...restCategories,
3766
+ ...lastCategories
3767
+ ];
3769
3768
  const optionsUsage = allCategories.map((category) => {
3770
- const categoryOptions = groupedOptions[category].map((option) => createOptionUsage(context, option, OPTION_USAGE_THRESHOLD)).join("\n");
3769
+ const categoryOptions = groupedOptions[category].map(
3770
+ (option) => createOptionUsage(context, option, OPTION_USAGE_THRESHOLD)
3771
+ ).join("\n");
3771
3772
  return `${category} options:
3772
3773
 
3773
3774
  ${indent(categoryOptions, 2)}`;
@@ -3778,13 +3779,19 @@ function createPluginDefaults(pluginDefaults) {
3778
3779
  if (!pluginDefaults || Object.keys(pluginDefaults).length === 0) {
3779
3780
  return "";
3780
3781
  }
3781
- const defaults = Object.entries(pluginDefaults).sort(([pluginNameA], [pluginNameB]) => pluginNameA.localeCompare(pluginNameB)).map(([plugin, value]) => `* ${plugin}: ${createDefaultValueDisplay(value)}`).join("\n");
3782
+ const defaults = Object.entries(pluginDefaults).sort(
3783
+ ([pluginNameA], [pluginNameB]) => pluginNameA.localeCompare(pluginNameB)
3784
+ ).map(
3785
+ ([plugin, value]) => `* ${plugin}: ${createDefaultValueDisplay(value)}`
3786
+ ).join("\n");
3782
3787
  return `
3783
3788
  Plugin defaults:
3784
3789
  ${defaults}`;
3785
3790
  }
3786
3791
  function createDetailedUsage(context, flag) {
3787
- const option = getOptionsWithOpposites(context.detailedOptions).find((option2) => option2.name === flag || option2.alias === flag);
3792
+ const option = getOptionsWithOpposites(context.detailedOptions).find(
3793
+ (option2) => option2.name === flag || option2.alias === flag
3794
+ );
3788
3795
  const header = createOptionUsageHeader(option);
3789
3796
  const description = `
3790
3797
 
@@ -3793,7 +3800,11 @@ ${indent(option.description, 2)}`;
3793
3800
 
3794
3801
  Valid options:
3795
3802
 
3796
- ${createChoiceUsages(option.choices, CHOICE_USAGE_MARGIN, CHOICE_USAGE_INDENTATION).join("\n")}`;
3803
+ ${createChoiceUsages(
3804
+ option.choices,
3805
+ CHOICE_USAGE_MARGIN,
3806
+ CHOICE_USAGE_INDENTATION
3807
+ ).join("\n")}`;
3797
3808
  const optionDefaultValue = getOptionDefaultValue(context, option.name);
3798
3809
  const defaults = optionDefaultValue !== void 0 ? `
3799
3810