@formatjs/cli 6.14.5 → 6.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/formatjs CHANGED
@@ -2,11 +2,12 @@
2
2
  import { fileURLToPath as _furl } from "node:url";
3
3
  import { dirname as _dname } from "node:path";
4
4
  _dname(_furl(import.meta.url));
5
- import { _ as __exportAll, a as warn, c as require_json_stable_stringify, d as isPluralElement, f as isSelectElement, g as __commonJSMin, h as parse, i as getStdinAsString, l as TYPE, m as isTagElement, n as interpolateName, o as writeStderr, p as isStructurallySame, r as debug, s as writeStdout, t as parseScript, u as isLiteralElement, v as __require, y as __toESM } from "./parse_script-Dh6HQV8l.js";
5
+ import { a as debug, c as writeStderr, d as __commonJSMin, f as __exportAll, i as parse, l as writeStdout, m as __toESM, n as interpolateName, o as getStdinAsString, p as __require, r as isStructurallySame, s as warn, t as parseScript, u as require_json_stable_stringify } from "./parse_script-3um9mN8Y.js";
6
6
  import { basename, join, resolve } from "path";
7
7
  import { readFileSync } from "fs";
8
8
  import { readFile } from "fs/promises";
9
9
  import { pathToFileURL } from "url";
10
+ import { createRequire } from "module";
10
11
  import { error } from "console";
11
12
  //#region node_modules/.aspect_rules_js/commander@14.0.3/node_modules/commander/lib/error.js
12
13
  var require_error$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -9706,7 +9707,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9706
9707
  }
9707
9708
  }));
9708
9709
  //#endregion
9709
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/fs/index.js
9710
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/fs/index.js
9710
9711
  var require_fs = /* @__PURE__ */ __commonJSMin(((exports) => {
9711
9712
  const u = require_universalify().fromCallback;
9712
9713
  const fs = require_graceful_fs();
@@ -9814,7 +9815,7 @@ var require_fs = /* @__PURE__ */ __commonJSMin(((exports) => {
9814
9815
  else process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?", "Warning", "fs-extra-WARN0003");
9815
9816
  }));
9816
9817
  //#endregion
9817
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/utils.js
9818
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/mkdirs/utils.js
9818
9819
  var require_utils$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9819
9820
  const path$11 = __require("path");
9820
9821
  module.exports.checkPath = function checkPath(pth) {
@@ -9828,7 +9829,7 @@ var require_utils$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9828
9829
  };
9829
9830
  }));
9830
9831
  //#endregion
9831
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/make-dir.js
9832
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/mkdirs/make-dir.js
9832
9833
  var require_make_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9833
9834
  const fs = require_fs();
9834
9835
  const { checkPath } = require_utils$1();
@@ -9856,7 +9857,7 @@ var require_make_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9856
9857
  };
9857
9858
  }));
9858
9859
  //#endregion
9859
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/mkdirs/index.js
9860
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/mkdirs/index.js
9860
9861
  var require_mkdirs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9861
9862
  const u = require_universalify().fromPromise;
9862
9863
  const { makeDir: _makeDir, makeDirSync } = require_make_dir();
@@ -9871,7 +9872,7 @@ var require_mkdirs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9871
9872
  };
9872
9873
  }));
9873
9874
  //#endregion
9874
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/path-exists/index.js
9875
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/path-exists/index.js
9875
9876
  var require_path_exists = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9876
9877
  const u = require_universalify().fromPromise;
9877
9878
  const fs = require_fs();
@@ -9884,28 +9885,41 @@ var require_path_exists = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9884
9885
  };
9885
9886
  }));
9886
9887
  //#endregion
9887
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/util/utimes.js
9888
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/util/utimes.js
9888
9889
  var require_utimes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9889
9890
  const fs = require_fs();
9890
9891
  const u = require_universalify().fromPromise;
9891
9892
  async function utimesMillis(path, atime, mtime) {
9892
9893
  const fd = await fs.open(path, "r+");
9893
- let closeErr = null;
9894
+ let error = null;
9894
9895
  try {
9895
9896
  await fs.futimes(fd, atime, mtime);
9897
+ } catch (futimesErr) {
9898
+ error = futimesErr;
9896
9899
  } finally {
9897
9900
  try {
9898
9901
  await fs.close(fd);
9899
- } catch (e) {
9900
- closeErr = e;
9902
+ } catch (closeErr) {
9903
+ if (!error) error = closeErr;
9901
9904
  }
9902
9905
  }
9903
- if (closeErr) throw closeErr;
9906
+ if (error) throw error;
9904
9907
  }
9905
9908
  function utimesMillisSync(path, atime, mtime) {
9906
9909
  const fd = fs.openSync(path, "r+");
9907
- fs.futimesSync(fd, atime, mtime);
9908
- return fs.closeSync(fd);
9910
+ let error = null;
9911
+ try {
9912
+ fs.futimesSync(fd, atime, mtime);
9913
+ } catch (futimesErr) {
9914
+ error = futimesErr;
9915
+ } finally {
9916
+ try {
9917
+ fs.closeSync(fd);
9918
+ } catch (closeErr) {
9919
+ if (!error) error = closeErr;
9920
+ }
9921
+ }
9922
+ if (error) throw error;
9909
9923
  }
9910
9924
  module.exports = {
9911
9925
  utimesMillis: u(utimesMillis),
@@ -9913,7 +9927,7 @@ var require_utimes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9913
9927
  };
9914
9928
  }));
9915
9929
  //#endregion
9916
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/util/stat.js
9930
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/util/stat.js
9917
9931
  var require_stat = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9918
9932
  const fs = require_fs();
9919
9933
  const path$10 = __require("path");
@@ -10039,7 +10053,7 @@ var require_stat = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10039
10053
  };
10040
10054
  }));
10041
10055
  //#endregion
10042
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/util/async.js
10056
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/util/async.js
10043
10057
  var require_async = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10044
10058
  async function asyncIteratorConcurrentProcess(iterator, fn) {
10045
10059
  const promises = [];
@@ -10051,7 +10065,7 @@ var require_async = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10051
10065
  module.exports = { asyncIteratorConcurrentProcess };
10052
10066
  }));
10053
10067
  //#endregion
10054
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/copy.js
10068
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/copy/copy.js
10055
10069
  var require_copy$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10056
10070
  const fs = require_fs();
10057
10071
  const path$9 = __require("path");
@@ -10142,7 +10156,7 @@ var require_copy$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10142
10156
  module.exports = copy;
10143
10157
  }));
10144
10158
  //#endregion
10145
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/copy-sync.js
10159
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/copy/copy-sync.js
10146
10160
  var require_copy_sync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10147
10161
  const fs = require_graceful_fs();
10148
10162
  const path$8 = __require("path");
@@ -10255,7 +10269,7 @@ var require_copy_sync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10255
10269
  module.exports = copySync;
10256
10270
  }));
10257
10271
  //#endregion
10258
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/copy/index.js
10272
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/copy/index.js
10259
10273
  var require_copy = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10260
10274
  const u = require_universalify().fromPromise;
10261
10275
  module.exports = {
@@ -10264,7 +10278,7 @@ var require_copy = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10264
10278
  };
10265
10279
  }));
10266
10280
  //#endregion
10267
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/remove/index.js
10281
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/remove/index.js
10268
10282
  var require_remove = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10269
10283
  const fs = require_graceful_fs();
10270
10284
  const u = require_universalify().fromCallback;
@@ -10286,7 +10300,7 @@ var require_remove = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10286
10300
  };
10287
10301
  }));
10288
10302
  //#endregion
10289
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/empty/index.js
10303
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/empty/index.js
10290
10304
  var require_empty = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10291
10305
  const u = require_universalify().fromPromise;
10292
10306
  const fs = require_fs();
@@ -10322,7 +10336,7 @@ var require_empty = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10322
10336
  };
10323
10337
  }));
10324
10338
  //#endregion
10325
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/file.js
10339
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/ensure/file.js
10326
10340
  var require_file = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10327
10341
  const u = require_universalify().fromPromise;
10328
10342
  const path$6 = __require("path");
@@ -10369,7 +10383,7 @@ var require_file = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10369
10383
  };
10370
10384
  }));
10371
10385
  //#endregion
10372
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/link.js
10386
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/ensure/link.js
10373
10387
  var require_link = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10374
10388
  const u = require_universalify().fromPromise;
10375
10389
  const path$5 = __require("path");
@@ -10380,11 +10394,11 @@ var require_link = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10380
10394
  async function createLink(srcpath, dstpath) {
10381
10395
  let dstStat;
10382
10396
  try {
10383
- dstStat = await fs.lstat(dstpath);
10397
+ dstStat = await fs.lstat(dstpath, { bigint: true });
10384
10398
  } catch {}
10385
10399
  let srcStat;
10386
10400
  try {
10387
- srcStat = await fs.lstat(srcpath);
10401
+ srcStat = await fs.lstat(srcpath, { bigint: true });
10388
10402
  } catch (err) {
10389
10403
  err.message = err.message.replace("lstat", "ensureLink");
10390
10404
  throw err;
@@ -10397,10 +10411,10 @@ var require_link = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10397
10411
  function createLinkSync(srcpath, dstpath) {
10398
10412
  let dstStat;
10399
10413
  try {
10400
- dstStat = fs.lstatSync(dstpath);
10414
+ dstStat = fs.lstatSync(dstpath, { bigint: true });
10401
10415
  } catch {}
10402
10416
  try {
10403
- const srcStat = fs.lstatSync(srcpath);
10417
+ const srcStat = fs.lstatSync(srcpath, { bigint: true });
10404
10418
  if (dstStat && areIdentical(srcStat, dstStat)) return;
10405
10419
  } catch (err) {
10406
10420
  err.message = err.message.replace("lstat", "ensureLink");
@@ -10417,7 +10431,7 @@ var require_link = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10417
10431
  };
10418
10432
  }));
10419
10433
  //#endregion
10420
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink-paths.js
10434
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/ensure/symlink-paths.js
10421
10435
  var require_symlink_paths = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10422
10436
  const path$4 = __require("path");
10423
10437
  const fs = require_fs();
@@ -10500,7 +10514,7 @@ var require_symlink_paths = /* @__PURE__ */ __commonJSMin(((exports, module) =>
10500
10514
  };
10501
10515
  }));
10502
10516
  //#endregion
10503
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink-type.js
10517
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/ensure/symlink-type.js
10504
10518
  var require_symlink_type = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10505
10519
  const fs = require_fs();
10506
10520
  const u = require_universalify().fromPromise;
@@ -10530,7 +10544,7 @@ var require_symlink_type = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10530
10544
  };
10531
10545
  }));
10532
10546
  //#endregion
10533
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/symlink.js
10547
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/ensure/symlink.js
10534
10548
  var require_symlink = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10535
10549
  const u = require_universalify().fromPromise;
10536
10550
  const path$3 = __require("path");
@@ -10547,17 +10561,17 @@ var require_symlink = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10547
10561
  } catch {}
10548
10562
  if (stats && stats.isSymbolicLink()) {
10549
10563
  let srcStat;
10550
- if (path$3.isAbsolute(srcpath)) srcStat = await fs.stat(srcpath);
10564
+ if (path$3.isAbsolute(srcpath)) srcStat = await fs.stat(srcpath, { bigint: true });
10551
10565
  else {
10552
10566
  const dstdir = path$3.dirname(dstpath);
10553
10567
  const relativeToDst = path$3.join(dstdir, srcpath);
10554
10568
  try {
10555
- srcStat = await fs.stat(relativeToDst);
10569
+ srcStat = await fs.stat(relativeToDst, { bigint: true });
10556
10570
  } catch {
10557
- srcStat = await fs.stat(srcpath);
10571
+ srcStat = await fs.stat(srcpath, { bigint: true });
10558
10572
  }
10559
10573
  }
10560
- const dstStat = await fs.stat(dstpath);
10574
+ const dstStat = await fs.stat(dstpath, { bigint: true });
10561
10575
  if (areIdentical(srcStat, dstStat)) return;
10562
10576
  }
10563
10577
  const relative = await symlinkPaths(srcpath, dstpath);
@@ -10574,17 +10588,17 @@ var require_symlink = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10574
10588
  } catch {}
10575
10589
  if (stats && stats.isSymbolicLink()) {
10576
10590
  let srcStat;
10577
- if (path$3.isAbsolute(srcpath)) srcStat = fs.statSync(srcpath);
10591
+ if (path$3.isAbsolute(srcpath)) srcStat = fs.statSync(srcpath, { bigint: true });
10578
10592
  else {
10579
10593
  const dstdir = path$3.dirname(dstpath);
10580
10594
  const relativeToDst = path$3.join(dstdir, srcpath);
10581
10595
  try {
10582
- srcStat = fs.statSync(relativeToDst);
10596
+ srcStat = fs.statSync(relativeToDst, { bigint: true });
10583
10597
  } catch {
10584
- srcStat = fs.statSync(srcpath);
10598
+ srcStat = fs.statSync(srcpath, { bigint: true });
10585
10599
  }
10586
10600
  }
10587
- const dstStat = fs.statSync(dstpath);
10601
+ const dstStat = fs.statSync(dstpath, { bigint: true });
10588
10602
  if (areIdentical(srcStat, dstStat)) return;
10589
10603
  }
10590
10604
  const relative = symlinkPathsSync(srcpath, dstpath);
@@ -10601,7 +10615,7 @@ var require_symlink = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10601
10615
  };
10602
10616
  }));
10603
10617
  //#endregion
10604
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/ensure/index.js
10618
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/ensure/index.js
10605
10619
  var require_ensure = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10606
10620
  const { createFile, createFileSync } = require_file();
10607
10621
  const { createLink, createLinkSync } = require_link();
@@ -10622,11 +10636,13 @@ var require_ensure = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10622
10636
  };
10623
10637
  }));
10624
10638
  //#endregion
10625
- //#region node_modules/.aspect_rules_js/jsonfile@6.2.0/node_modules/jsonfile/utils.js
10639
+ //#region node_modules/.aspect_rules_js/jsonfile@6.2.1/node_modules/jsonfile/utils.js
10626
10640
  var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10627
10641
  function stringify(obj, { EOL = "\n", finalEOL = true, replacer = null, spaces } = {}) {
10628
10642
  const EOF = finalEOL ? EOL : "";
10629
- return JSON.stringify(obj, replacer, spaces).replace(/\n/g, EOL) + EOF;
10643
+ const str = JSON.stringify(obj, replacer, spaces);
10644
+ if (str === void 0) throw new TypeError(`Converting ${typeof obj} value to JSON is not supported`);
10645
+ return str.replace(/\n/g, EOL) + EOF;
10630
10646
  }
10631
10647
  function stripBom(content) {
10632
10648
  if (Buffer.isBuffer(content)) content = content.toString("utf8");
@@ -10638,7 +10654,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10638
10654
  };
10639
10655
  }));
10640
10656
  //#endregion
10641
- //#region node_modules/.aspect_rules_js/jsonfile@6.2.0/node_modules/jsonfile/index.js
10657
+ //#region node_modules/.aspect_rules_js/jsonfile@6.2.1/node_modules/jsonfile/index.js
10642
10658
  var require_jsonfile$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10643
10659
  let _fs;
10644
10660
  try {
@@ -10700,7 +10716,7 @@ var require_jsonfile$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10700
10716
  };
10701
10717
  }));
10702
10718
  //#endregion
10703
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/json/jsonfile.js
10719
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/json/jsonfile.js
10704
10720
  var require_jsonfile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10705
10721
  const jsonFile = require_jsonfile$1();
10706
10722
  module.exports = {
@@ -10711,7 +10727,7 @@ var require_jsonfile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10711
10727
  };
10712
10728
  }));
10713
10729
  //#endregion
10714
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/output-file/index.js
10730
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/output-file/index.js
10715
10731
  var require_output_file = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10716
10732
  const u = require_universalify().fromPromise;
10717
10733
  const fs = require_fs();
@@ -10734,7 +10750,7 @@ var require_output_file = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10734
10750
  };
10735
10751
  }));
10736
10752
  //#endregion
10737
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/json/output-json.js
10753
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/json/output-json.js
10738
10754
  var require_output_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10739
10755
  const { stringify } = require_utils();
10740
10756
  const { outputFile } = require_output_file();
@@ -10744,7 +10760,7 @@ var require_output_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10744
10760
  module.exports = outputJson;
10745
10761
  }));
10746
10762
  //#endregion
10747
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/json/output-json-sync.js
10763
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/json/output-json-sync.js
10748
10764
  var require_output_json_sync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10749
10765
  const { stringify } = require_utils();
10750
10766
  const { outputFileSync } = require_output_file();
@@ -10754,7 +10770,7 @@ var require_output_json_sync = /* @__PURE__ */ __commonJSMin(((exports, module)
10754
10770
  module.exports = outputJsonSync;
10755
10771
  }));
10756
10772
  //#endregion
10757
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/json/index.js
10773
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/json/index.js
10758
10774
  var require_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10759
10775
  const u = require_universalify().fromPromise;
10760
10776
  const jsonFile = require_jsonfile();
@@ -10769,7 +10785,7 @@ var require_json = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10769
10785
  module.exports = jsonFile;
10770
10786
  }));
10771
10787
  //#endregion
10772
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/move/move.js
10788
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/move/move.js
10773
10789
  var require_move$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10774
10790
  const fs = require_fs();
10775
10791
  const path$1 = __require("path");
@@ -10809,7 +10825,7 @@ var require_move$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10809
10825
  module.exports = move;
10810
10826
  }));
10811
10827
  //#endregion
10812
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/move/move-sync.js
10828
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/move/move-sync.js
10813
10829
  var require_move_sync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10814
10830
  const fs = require_graceful_fs();
10815
10831
  const path = __require("path");
@@ -10857,7 +10873,7 @@ var require_move_sync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10857
10873
  module.exports = moveSync;
10858
10874
  }));
10859
10875
  //#endregion
10860
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/move/index.js
10876
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/move/index.js
10861
10877
  var require_move = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10862
10878
  const u = require_universalify().fromPromise;
10863
10879
  module.exports = {
@@ -10866,7 +10882,7 @@ var require_move = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10866
10882
  };
10867
10883
  }));
10868
10884
  //#endregion
10869
- //#region node_modules/.aspect_rules_js/fs-extra@11.3.4/node_modules/fs-extra/lib/esm.mjs
10885
+ //#region node_modules/.aspect_rules_js/fs-extra@11.3.5/node_modules/fs-extra/lib/esm.mjs
10870
10886
  var import_out = /* @__PURE__ */ __toESM(require_out());
10871
10887
  var import_loud_rejection = /* @__PURE__ */ __toESM(require_loud_rejection());
10872
10888
  var import_copy = /* @__PURE__ */ __toESM(require_copy(), 1);
@@ -10934,10 +10950,153 @@ import_remove.default.removeSync;
10934
10950
  ...import_remove.default
10935
10951
  });
10936
10952
  //#endregion
10937
- //#region packages/cli-lib/formatters/crowdin.ts
10953
+ //#region packages/cli-lib/native.ts
10938
10954
  var import_json_stable_stringify = /* @__PURE__ */ __toESM(require_json_stable_stringify());
10955
+ const require$1 = createRequire(import.meta.url);
10956
+ const NATIVE_PACKAGES = {
10957
+ "darwin-arm64": "@formatjs/cli-native-darwin-arm64",
10958
+ "linux-x64": "@formatjs/cli-native-linux-x64"
10959
+ };
10960
+ let nativeBinding;
10961
+ function loadNative() {
10962
+ if (nativeBinding !== void 0) {
10963
+ if (nativeBinding) return nativeBinding;
10964
+ throw new Error("Native @formatjs/cli-lib binding is unavailable");
10965
+ }
10966
+ const candidates = [process.env.FORMATJS_CLI_LIB_NATIVE_PATH, NATIVE_PACKAGES[`${process.platform}-${process.arch}`]].filter(Boolean);
10967
+ const loadErrors = [];
10968
+ for (const candidate of candidates) try {
10969
+ nativeBinding = require$1(candidate);
10970
+ return nativeBinding;
10971
+ } catch (e) {
10972
+ loadErrors.push(`${candidate}: ${e.message}`);
10973
+ }
10974
+ nativeBinding = null;
10975
+ throw new Error(`Native @formatjs/cli-lib binding is unavailable.\n${loadErrors.join("\n")}`);
10976
+ }
10977
+ function compileWithNative(inputFiles, opts = {}) {
10978
+ return loadNative().compile(inputFiles, {
10979
+ ast: opts.ast,
10980
+ format: opts.format,
10981
+ followLinks: opts.followLinks,
10982
+ ignoreTag: opts.ignoreTag,
10983
+ pseudoLocale: opts.pseudoLocale,
10984
+ skipErrors: opts.skipErrors
10985
+ });
10986
+ }
10987
+ function compileMessagesWithNative(messages, opts = {}) {
10988
+ return loadNative().compileMessages(messages, {
10989
+ ast: opts.ast,
10990
+ ignoreTag: opts.ignoreTag,
10991
+ pseudoLocale: opts.pseudoLocale,
10992
+ skipErrors: opts.skipErrors
10993
+ });
10994
+ }
10995
+ //#endregion
10996
+ //#region packages/cli-lib/compile.ts
10997
+ const dynamicImport = new Function("specifier", "return import(specifier)");
10998
+ const globSync$1 = import_out.sync;
10999
+ const stringify$1 = import_json_stable_stringify.default || import_json_stable_stringify;
11000
+ const CUSTOM_FORMATTER_FILE_DEPRECATION_WARNING = "Passing a custom formatter file to --format during compilation is deprecated and will be removed in a future release. Prefer a built-in formatter name or pre-process translation files before running formatjs compile.";
11001
+ const BUILTIN_FORMATTERS = new Set([
11002
+ "default",
11003
+ "simple",
11004
+ "transifex",
11005
+ "smartling",
11006
+ "lokalise",
11007
+ "crowdin"
11008
+ ]);
11009
+ /**
11010
+ * Compile extracted translation files with the native formatjs CLI binding.
11011
+ * @param inputFiles Input files or glob patterns
11012
+ * @param opts Options
11013
+ * @returns serialized result in string format
11014
+ */
11015
+ async function compile$6(inputFiles, opts = {}) {
11016
+ debug("Compiling files:", inputFiles);
11017
+ const { ast, format, pseudoLocale, skipErrors, ignoreTag, signal, followLinks } = opts;
11018
+ signal?.throwIfAborted();
11019
+ if (format && !isBuiltinFormatter(format)) return compileWithCustomFormatter(inputFiles, opts);
11020
+ return compileWithNative(inputFiles, {
11021
+ ast,
11022
+ format: typeof format === "string" ? format : void 0,
11023
+ followLinks,
11024
+ ignoreTag,
11025
+ pseudoLocale,
11026
+ skipErrors
11027
+ });
11028
+ }
11029
+ function isBuiltinFormatter(format) {
11030
+ return typeof format === "string" && BUILTIN_FORMATTERS.has(format);
11031
+ }
11032
+ async function compileWithCustomFormatter(inputFiles, opts) {
11033
+ if (typeof opts.format === "string") await warn(CUSTOM_FORMATTER_FILE_DEPRECATION_WARNING);
11034
+ const formatter = await resolveCustomFormatter(opts.format);
11035
+ const files = globSync$1(inputFiles, { followSymbolicLinks: opts.followLinks ?? true });
11036
+ if (!files.length) throw new Error("No translation files found matching the patterns");
11037
+ const messages = [];
11038
+ await Promise.all(files.map(async (file) => {
11039
+ opts.signal?.throwIfAborted();
11040
+ const content = await readFile(file, {
11041
+ encoding: "utf8",
11042
+ signal: opts.signal
11043
+ });
11044
+ const compiled = formatter.compile(JSON.parse(content));
11045
+ for (const id of Object.keys(compiled)) messages.push({
11046
+ id,
11047
+ message: compiled[id],
11048
+ sourceFile: file
11049
+ });
11050
+ }));
11051
+ const serialized = compileMessagesWithNative(messages, {
11052
+ ast: opts.ast,
11053
+ ignoreTag: opts.ignoreTag,
11054
+ pseudoLocale: opts.pseudoLocale,
11055
+ skipErrors: opts.skipErrors
11056
+ });
11057
+ if (formatter.compareMessages) return stringify$1(JSON.parse(serialized), {
11058
+ space: 2,
11059
+ cmp: formatter.compareMessages
11060
+ }) ?? "";
11061
+ return serialized;
11062
+ }
11063
+ async function resolveCustomFormatter(format) {
11064
+ if (!format) throw new Error("A custom formatter is required");
11065
+ if (typeof format !== "string") return format;
11066
+ try {
11067
+ return dynamicImport(pathToFileURL(resolve(process.cwd(), format)).href);
11068
+ } catch (e) {
11069
+ console.error(`Cannot resolve formatter ${format}`);
11070
+ throw e;
11071
+ }
11072
+ }
11073
+ /**
11074
+ * Compile extracted translation files with the native formatjs CLI binding and
11075
+ * write output to `outFile` when provided.
11076
+ * @param inputFiles Input files or glob patterns
11077
+ * @param compileOpts options
11078
+ * @returns A `Promise` that resolves if file was written successfully
11079
+ */
11080
+ async function compileAndWrite(inputFiles, compileOpts = {}) {
11081
+ const { outFile, ...opts } = compileOpts;
11082
+ const serializedResult = await compile$6(inputFiles, opts) + "\n";
11083
+ if (outFile) {
11084
+ debug("Writing output file:", outFile);
11085
+ return outputFile(outFile, serializedResult);
11086
+ }
11087
+ await writeStdout(serializedResult);
11088
+ }
11089
+ //#endregion
11090
+ //#region packages/cli-lib/compile_folder.ts
11091
+ async function compileFolder(files, outFolder, opts = {}) {
11092
+ const results = await Promise.all(files.map((f) => compile$6([f], opts)));
11093
+ const outFiles = files.map((f) => join(outFolder, basename(f)));
11094
+ return Promise.all(outFiles.map((outFile, i) => outputFile(outFile, results[i] + "\n")));
11095
+ }
11096
+ //#endregion
11097
+ //#region packages/cli-lib/formatters/crowdin.ts
10939
11098
  var crowdin_exports = /* @__PURE__ */ __exportAll({
10940
- compile: () => compile$6,
11099
+ compile: () => compile$5,
10941
11100
  format: () => format$5
10942
11101
  });
10943
11102
  const format$5 = (msgs) => {
@@ -10948,7 +11107,7 @@ const format$5 = (msgs) => {
10948
11107
  };
10949
11108
  return results;
10950
11109
  };
10951
- const compile$6 = (msgs) => {
11110
+ const compile$5 = (msgs) => {
10952
11111
  const results = {};
10953
11112
  for (const [id, msg] of Object.entries(msgs)) {
10954
11113
  if (id === "smartling") continue;
@@ -10959,11 +11118,11 @@ const compile$6 = (msgs) => {
10959
11118
  //#endregion
10960
11119
  //#region packages/cli-lib/formatters/default.ts
10961
11120
  var default_exports = /* @__PURE__ */ __exportAll({
10962
- compile: () => compile$5,
11121
+ compile: () => compile$4,
10963
11122
  format: () => format$4
10964
11123
  });
10965
11124
  const format$4 = (msgs) => msgs;
10966
- const compile$5 = (msgs) => {
11125
+ const compile$4 = (msgs) => {
10967
11126
  const results = {};
10968
11127
  for (const k in msgs) results[k] = msgs[k].defaultMessage;
10969
11128
  return results;
@@ -10971,7 +11130,7 @@ const compile$5 = (msgs) => {
10971
11130
  //#endregion
10972
11131
  //#region packages/cli-lib/formatters/lokalise.ts
10973
11132
  var lokalise_exports = /* @__PURE__ */ __exportAll({
10974
- compile: () => compile$4,
11133
+ compile: () => compile$3,
10975
11134
  format: () => format$3
10976
11135
  });
10977
11136
  const format$3 = (msgs) => {
@@ -10982,7 +11141,7 @@ const format$3 = (msgs) => {
10982
11141
  };
10983
11142
  return results;
10984
11143
  };
10985
- const compile$4 = (msgs) => {
11144
+ const compile$3 = (msgs) => {
10986
11145
  const results = {};
10987
11146
  for (const [id, msg] of Object.entries(msgs)) results[id] = msg.translation;
10988
11147
  return results;
@@ -10990,7 +11149,7 @@ const compile$4 = (msgs) => {
10990
11149
  //#endregion
10991
11150
  //#region packages/cli-lib/formatters/simple.ts
10992
11151
  var simple_exports = /* @__PURE__ */ __exportAll({
10993
- compile: () => compile$3,
11152
+ compile: () => compile$2,
10994
11153
  format: () => format$2
10995
11154
  });
10996
11155
  const format$2 = (msgs) => {
@@ -10999,12 +11158,12 @@ const format$2 = (msgs) => {
10999
11158
  return all;
11000
11159
  }, {});
11001
11160
  };
11002
- const compile$3 = (msgs) => msgs;
11161
+ const compile$2 = (msgs) => msgs;
11003
11162
  //#endregion
11004
11163
  //#region packages/cli-lib/formatters/smartling.ts
11005
11164
  var smartling_exports = /* @__PURE__ */ __exportAll({
11006
11165
  compareMessages: () => compareMessages,
11007
- compile: () => compile$2,
11166
+ compile: () => compile$1,
11008
11167
  format: () => format$1
11009
11168
  });
11010
11169
  const format$1 = (msgs) => {
@@ -11028,7 +11187,7 @@ const compareMessages = (el1, el2) => {
11028
11187
  if (el2.key === "smartling") return 1;
11029
11188
  return el1.key < el2.key ? -1 : el1.key === el2.key ? 0 : 1;
11030
11189
  };
11031
- const compile$2 = (msgs) => {
11190
+ const compile$1 = (msgs) => {
11032
11191
  const results = {};
11033
11192
  for (const [id, msg] of Object.entries(msgs)) {
11034
11193
  if (id === "smartling") continue;
@@ -11039,7 +11198,7 @@ const compile$2 = (msgs) => {
11039
11198
  //#endregion
11040
11199
  //#region packages/cli-lib/formatters/transifex.ts
11041
11200
  var transifex_exports = /* @__PURE__ */ __exportAll({
11042
- compile: () => compile$1,
11201
+ compile: () => compile,
11043
11202
  format: () => format
11044
11203
  });
11045
11204
  const format = (msgs) => {
@@ -11050,7 +11209,7 @@ const format = (msgs) => {
11050
11209
  };
11051
11210
  return results;
11052
11211
  };
11053
- const compile$1 = (msgs) => {
11212
+ const compile = (msgs) => {
11054
11213
  const results = {};
11055
11214
  for (const [id, msg] of Object.entries(msgs)) results[id] = msg.string;
11056
11215
  return results;
@@ -11075,320 +11234,6 @@ async function resolveBuiltinFormatter(format) {
11075
11234
  }
11076
11235
  }
11077
11236
  //#endregion
11078
- //#region packages/cli-lib/pseudo_locale.ts
11079
- function forEachLiteralElement(ast, fn) {
11080
- ast.forEach((el) => {
11081
- if (isLiteralElement(el)) fn(el);
11082
- else if (isPluralElement(el) || isSelectElement(el)) for (const opt of Object.values(el.options)) forEachLiteralElement(opt.value, fn);
11083
- else if (isTagElement(el)) forEachLiteralElement(el.children, fn);
11084
- });
11085
- }
11086
- function generateXXLS(msg) {
11087
- const ast = typeof msg === "string" ? parse(msg) : msg;
11088
- const lastChunk = ast[ast.length - 1];
11089
- if (lastChunk && isLiteralElement(lastChunk)) {
11090
- lastChunk.value += "SSSSSSSSSSSSSSSSSSSSSSSSS";
11091
- return ast;
11092
- }
11093
- return [...ast, {
11094
- type: TYPE.literal,
11095
- value: "SSSSSSSSSSSSSSSSSSSSSSSSS"
11096
- }];
11097
- }
11098
- function generateXXAC(msg) {
11099
- const ast = typeof msg === "string" ? parse(msg) : msg;
11100
- forEachLiteralElement(ast, (el) => {
11101
- el.value = el.value.toUpperCase();
11102
- });
11103
- return ast;
11104
- }
11105
- function generateXXHA(msg) {
11106
- const ast = typeof msg === "string" ? parse(msg) : msg;
11107
- const [firstChunk, ...rest] = ast;
11108
- if (firstChunk && isLiteralElement(firstChunk)) {
11109
- firstChunk.value = "[javascript]" + firstChunk.value;
11110
- return [firstChunk, ...rest];
11111
- }
11112
- return [{
11113
- type: TYPE.literal,
11114
- value: "[javascript]"
11115
- }, ...ast];
11116
- }
11117
- const ACCENTED_MAP = {
11118
- "caps": [
11119
- 550,
11120
- 385,
11121
- 391,
11122
- 7698,
11123
- 7702,
11124
- 401,
11125
- 403,
11126
- 294,
11127
- 298,
11128
- 308,
11129
- 310,
11130
- 319,
11131
- 7742,
11132
- 544,
11133
- 510,
11134
- 420,
11135
- 586,
11136
- 344,
11137
- 350,
11138
- 358,
11139
- 364,
11140
- 7804,
11141
- 7814,
11142
- 7818,
11143
- 7822,
11144
- 7824
11145
- ],
11146
- "small": [
11147
- 551,
11148
- 384,
11149
- 392,
11150
- 7699,
11151
- 7703,
11152
- 402,
11153
- 608,
11154
- 295,
11155
- 299,
11156
- 309,
11157
- 311,
11158
- 320,
11159
- 7743,
11160
- 414,
11161
- 511,
11162
- 421,
11163
- 587,
11164
- 345,
11165
- 351,
11166
- 359,
11167
- 365,
11168
- 7805,
11169
- 7815,
11170
- 7819,
11171
- 7823,
11172
- 7825
11173
- ]
11174
- };
11175
- const FLIPPED_MAP = {
11176
- "caps": [
11177
- 8704,
11178
- 1296,
11179
- 8579,
11180
- 5601,
11181
- 398,
11182
- 8498,
11183
- 8513,
11184
- 72,
11185
- 73,
11186
- 383,
11187
- 1276,
11188
- 8514,
11189
- 87,
11190
- 78,
11191
- 79,
11192
- 1280,
11193
- 210,
11194
- 7450,
11195
- 83,
11196
- 8869,
11197
- 8745,
11198
- 581,
11199
- 77,
11200
- 88,
11201
- 8516,
11202
- 90
11203
- ],
11204
- "small": [
11205
- 592,
11206
- 113,
11207
- 596,
11208
- 112,
11209
- 477,
11210
- 607,
11211
- 387,
11212
- 613,
11213
- 305,
11214
- 638,
11215
- 670,
11216
- 645,
11217
- 623,
11218
- 117,
11219
- 111,
11220
- 100,
11221
- 98,
11222
- 633,
11223
- 115,
11224
- 647,
11225
- 110,
11226
- 652,
11227
- 653,
11228
- 120,
11229
- 654,
11230
- 122
11231
- ]
11232
- };
11233
- /**
11234
- * Based on: https://hg.mozilla.org/mozilla-central/file/a1f74e8c8fb72390d22054d6b00c28b1a32f6c43/intl/l10n/L10nRegistry.jsm#l425
11235
- */
11236
- function transformString(map, elongate = false, msg) {
11237
- return msg.replace(/[a-z]/gi, (ch) => {
11238
- const cc = ch.charCodeAt(0);
11239
- if (cc >= 97 && cc <= 122) {
11240
- const newChar = String.fromCodePoint(map.small[cc - 97]);
11241
- if (elongate && (cc === 97 || cc === 101 || cc === 111 || cc === 117)) return newChar + newChar;
11242
- return newChar;
11243
- }
11244
- if (cc >= 65 && cc <= 90) return String.fromCodePoint(map.caps[cc - 65]);
11245
- return ch;
11246
- });
11247
- }
11248
- /**
11249
- * accented - Ȧȧƈƈḗḗƞŧḗḗḓ Ḗḗƞɠŀīīşħ
11250
- * --------------------------------
11251
- *
11252
- * This locale replaces all Latin characters with their accented equivalents, and duplicates some
11253
- * vowels to create roughly 30% longer strings. Strings are wrapped in markers (square brackets),
11254
- * which help with detecting truncation.
11255
- */
11256
- function generateENXA(msg) {
11257
- const ast = typeof msg === "string" ? parse(msg) : msg;
11258
- forEachLiteralElement(ast, (el) => {
11259
- el.value = transformString(ACCENTED_MAP, true, el.value);
11260
- });
11261
- return [
11262
- {
11263
- type: TYPE.literal,
11264
- value: "["
11265
- },
11266
- ...ast,
11267
- {
11268
- type: TYPE.literal,
11269
- value: "]"
11270
- }
11271
- ];
11272
- }
11273
- /**
11274
- * bidi - ɥsıʅƃuƎ ıpıԐ
11275
- * -------------------
11276
- *
11277
- * This strategy replaces all Latin characters with their 180 degree rotated versions and enforces
11278
- * right to left text flow using Unicode UAX#9 Explicit Directional Embeddings. In this mode, the UI
11279
- * directionality will also be set to right-to-left.
11280
- */
11281
- function generateENXB(msg) {
11282
- const ast = typeof msg === "string" ? parse(msg) : msg;
11283
- forEachLiteralElement(ast, (el) => {
11284
- el.value = transformString(FLIPPED_MAP, false, el.value);
11285
- });
11286
- return [
11287
- {
11288
- type: TYPE.literal,
11289
- value: "‮"
11290
- },
11291
- ...ast,
11292
- {
11293
- type: TYPE.literal,
11294
- value: "‬"
11295
- }
11296
- ];
11297
- }
11298
- //#endregion
11299
- //#region packages/cli-lib/compile.ts
11300
- const stringify$1 = import_json_stable_stringify.default || import_json_stable_stringify;
11301
- /**
11302
- * Aggregate `inputFiles` into a single JSON blob and compile.
11303
- * Also checks for conflicting IDs.
11304
- * Then returns the serialized result as a `string` since key order
11305
- * makes a difference in some vendor.
11306
- * @param inputFiles Input files
11307
- * @param opts Options
11308
- * @returns serialized result in string format
11309
- */
11310
- async function compile(inputFiles, opts = {}) {
11311
- debug("Compiling files:", inputFiles);
11312
- const { ast, format, pseudoLocale, skipErrors, ignoreTag, signal } = opts;
11313
- signal?.throwIfAborted();
11314
- const formatter = await resolveBuiltinFormatter(format);
11315
- const messages = {};
11316
- const messageAsts = {};
11317
- const idsWithFileName = {};
11318
- const compiledFiles = await Promise.all(inputFiles.map((f) => readFile(f, {
11319
- encoding: "utf8",
11320
- signal
11321
- }).then((content) => JSON.parse(content)).then(formatter.compile)));
11322
- debug("Compiled files:", compiledFiles);
11323
- for (let i = 0; i < inputFiles.length; i++) {
11324
- const inputFile = inputFiles[i];
11325
- debug("Processing file:", inputFile);
11326
- const compiled = compiledFiles[i];
11327
- for (const id in compiled) {
11328
- if (messages[id] && messages[id] !== compiled[id]) throw new Error(`Conflicting ID "${id}" with different translation found in these 2 files:
11329
- ID: ${id}
11330
- Message from ${idsWithFileName[id]}: ${messages[id]}
11331
- Message from ${inputFile}: ${compiled[id]}
11332
- `);
11333
- try {
11334
- const msgAst = parse(compiled[id], { ignoreTag });
11335
- messages[id] = compiled[id];
11336
- switch (pseudoLocale) {
11337
- case "xx-LS":
11338
- messageAsts[id] = generateXXLS(msgAst);
11339
- break;
11340
- case "xx-AC":
11341
- messageAsts[id] = generateXXAC(msgAst);
11342
- break;
11343
- case "xx-HA":
11344
- messageAsts[id] = generateXXHA(msgAst);
11345
- break;
11346
- case "en-XA":
11347
- messageAsts[id] = generateENXA(msgAst);
11348
- break;
11349
- case "en-XB":
11350
- messageAsts[id] = generateENXB(msgAst);
11351
- break;
11352
- default:
11353
- messageAsts[id] = msgAst;
11354
- break;
11355
- }
11356
- idsWithFileName[id] = inputFile;
11357
- } catch (e) {
11358
- warn("Error validating message \"%s\" with ID \"%s\" in file \"%s\"", compiled[id], id, inputFile);
11359
- if (!skipErrors) throw e;
11360
- }
11361
- }
11362
- }
11363
- return stringify$1(ast ? messageAsts : messages, {
11364
- space: 2,
11365
- cmp: formatter.compareMessages || void 0
11366
- }) ?? "";
11367
- }
11368
- /**
11369
- * Aggregate `inputFiles` into a single JSON blob and compile.
11370
- * Also checks for conflicting IDs and write output to `outFile`.
11371
- * @param inputFiles Input files
11372
- * @param compileOpts options
11373
- * @returns A `Promise` that resolves if file was written successfully
11374
- */
11375
- async function compileAndWrite(inputFiles, compileOpts = {}) {
11376
- const { outFile, ...opts } = compileOpts;
11377
- const serializedResult = await compile(inputFiles, opts) + "\n";
11378
- if (outFile) {
11379
- debug("Writing output file:", outFile);
11380
- return outputFile(outFile, serializedResult);
11381
- }
11382
- await writeStdout(serializedResult);
11383
- }
11384
- //#endregion
11385
- //#region packages/cli-lib/compile_folder.ts
11386
- async function compileFolder(files, outFolder, opts = {}) {
11387
- const results = await Promise.all(files.map((f) => compile([f], opts)));
11388
- const outFiles = files.map((f) => join(outFolder, basename(f)));
11389
- return Promise.all(outFiles.map((outFile, i) => outputFile(outFile, results[i] + "\n")));
11390
- }
11391
- //#endregion
11392
11237
  //#region packages/cli-lib/extract.ts
11393
11238
  const stringify = import_json_stable_stringify.default || import_json_stable_stringify;
11394
11239
  function calculateLineColFromOffset(text, start) {
@@ -11444,7 +11289,7 @@ async function processFile(source, fn, { idInterpolationPattern, ...opts }) {
11444
11289
  parseFile(source, fn, opts);
11445
11290
  } else if (fn.endsWith(".gts") || fn.endsWith(".gjs")) {
11446
11291
  debug("Processing %s as gts/gjs file", fn);
11447
- const { parseFile } = await import("./gts_extractor-CEZNDfvc.js");
11292
+ const { parseFile } = await import("./gts_extractor-C_xuju_3.js");
11448
11293
  parseFile(source, fn, opts);
11449
11294
  } else {
11450
11295
  debug("Processing %s using typescript extractor", fn);
@@ -11751,29 +11596,12 @@ sentences are not translator-friendly.`).option("--follow-links", `Whether to fo
11751
11596
  });
11752
11597
  process.exit(0);
11753
11598
  });
11754
- program.command("compile [translation_files...]").description(`Compile extracted translation file into react-intl consumable JSON We also verify that the messages are valid ICU and not malformed. <translation_files> can be a glob like "foo/**/en.json"`).option("--format <path>", `Path to a formatter file that converts \`<translation_file>\` to \`Record<string, string>\` so we can compile. The file must export a function named \`compile\` with the signature:
11755
- \`\`\`
11756
- type CompileFn = <T = Record<string, MessageDescriptor>>(
11757
- msgs: T
11758
- ) => Record<string, string>;
11759
- \`\`\`
11760
- This is especially useful to convert from a TMS-specific format back to react-intl format
11761
- `).option("--out-file <path>", `Compiled translation output file. If this is not provided, result will be printed to stdout`).option("--ast", `Whether to compile to AST. See https://formatjs.github.io/docs/guides/advanced-usage#pre-parsing-messages for more information`).option("--skip-errors", `Whether to continue compiling messages after encountering an error. Any keys with errors will not be included in the output file.`).option("--pseudo-locale <pseudoLocale>", `Whether to generate pseudo-locale files. See https://formatjs.github.io/docs/tooling/cli#--pseudo-locale-pseudolocale for possible values. "--ast" is required for this to work.`).option("--ignore-tag", `Whether the parser to treat HTML/XML tags as string literal instead of parsing them as tag token. When this is false we only allow simple tags without any attributes.`).option("--follow-links", `Whether to follow symbolic links when traversing directories. Defaults to true for compatibility with pnpm symlinked node_modules. Use --no-follow-links to disable.`, true).action(async (filePatterns, opts) => {
11599
+ program.command("compile [translation_files...]").description(`Compile extracted translation file into react-intl consumable JSON We also verify that the messages are valid ICU and not malformed. <translation_files> can be a glob like "foo/**/en.json"`).option("--format <name-or-path>", `Built-in formatter name that converts \`<translation_file>\` to \`Record<string, string>\` so we can compile. Custom formatter file paths are deprecated. Built-in formatters: default, simple, transifex, smartling, lokalise, crowdin.`).option("--out-file <path>", `Compiled translation output file. If this is not provided, result will be printed to stdout`).option("--ast", `Whether to compile to AST. See https://formatjs.github.io/docs/guides/advanced-usage#pre-parsing-messages for more information`).option("--skip-errors", `Whether to continue compiling messages after encountering an error. Any keys with errors will not be included in the output file.`).option("--pseudo-locale <pseudoLocale>", `Whether to generate pseudo-locale files. See https://formatjs.github.io/docs/tooling/cli#--pseudo-locale-pseudolocale for possible values. "--ast" is required for this to work.`).option("--ignore-tag", `Whether the parser to treat HTML/XML tags as string literal instead of parsing them as tag token. When this is false we only allow simple tags without any attributes.`).option("--follow-links", `Whether to follow symbolic links when traversing directories. Defaults to true for compatibility with pnpm symlinked node_modules. Use --no-follow-links to disable.`, true).action(async (filePatterns, opts) => {
11762
11600
  debug("File pattern:", filePatterns);
11763
11601
  debug("Options:", opts);
11764
- const files = globSync(filePatterns, { followSymbolicLinks: opts.followLinks ?? true });
11765
- if (!files.length) throw new Error(`No input file found with pattern ${filePatterns}`);
11766
- debug("Files to compile:", files);
11767
- await compileAndWrite(files, opts);
11602
+ await compileAndWrite(filePatterns, opts);
11768
11603
  });
11769
- program.command("compile-folder <folder> <outFolder>").description(`Batch compile all extracted translation JSON files in <folder> to <outFolder> containing react-intl consumable JSON. We also verify that the messages are valid ICU and not malformed.`).option("--format <path>", `Path to a formatter file that converts JSON files in \`<folder>\` to \`Record<string, string>\` so we can compile. The file must export a function named \`compile\` with the signature:
11770
- \`\`\`
11771
- type CompileFn = <T = Record<string, MessageDescriptor>>(
11772
- msgs: T
11773
- ) => Record<string, string>;
11774
- \`\`\`
11775
- This is especially useful to convert from a TMS-specific format back to react-intl format
11776
- `).option("--ast", `Whether to compile to AST. See https://formatjs.github.io/docs/guides/advanced-usage#pre-parsing-messages for more information`).option("--skip-errors", `Whether to continue compiling messages after encountering an error. Any keys with errors will not be included in the output file.`).option("--pseudo-locale <pseudoLocale>", `Whether to generate pseudo-locale files. See https://formatjs.github.io/docs/tooling/cli#--pseudo-locale-pseudolocale for possible values. "--ast" is required for this to work.`).option("--ignore-tag", `Whether the parser to treat HTML/XML tags as string literal instead of parsing them as tag token. When this is false we only allow simple tags without any attributes.`).action(async (folder, outFolder, opts) => {
11604
+ program.command("compile-folder <folder> <outFolder>").description(`Batch compile all extracted translation JSON files in <folder> to <outFolder> containing react-intl consumable JSON. We also verify that the messages are valid ICU and not malformed.`).option("--format <name-or-path>", `Built-in formatter name that converts JSON files in \`<folder>\` to \`Record<string, string>\` so we can compile. Custom formatter file paths are deprecated. Built-in formatters: default, simple, transifex, smartling, lokalise, crowdin.`).option("--ast", `Whether to compile to AST. See https://formatjs.github.io/docs/guides/advanced-usage#pre-parsing-messages for more information`).option("--skip-errors", `Whether to continue compiling messages after encountering an error. Any keys with errors will not be included in the output file.`).option("--pseudo-locale <pseudoLocale>", `Whether to generate pseudo-locale files. See https://formatjs.github.io/docs/tooling/cli#--pseudo-locale-pseudolocale for possible values. "--ast" is required for this to work.`).option("--ignore-tag", `Whether the parser to treat HTML/XML tags as string literal instead of parsing them as tag token. When this is false we only allow simple tags without any attributes.`).action(async (folder, outFolder, opts) => {
11777
11605
  debug("Folder:", folder);
11778
11606
  debug("Options:", opts);
11779
11607
  const files = globSync(`${folder}/*.json`);