lingo.dev 0.86.0 → 0.87.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/build/cli.cjs CHANGED
@@ -14,9 +14,9 @@ var _promises = require('readline/promises'); var _promises2 = _interopRequireDe
14
14
 
15
15
  // src/cli/utils/settings.ts
16
16
  var _os = require('os'); var _os2 = _interopRequireDefault(_os);
17
- var _path = require('path'); var path15 = _interopRequireWildcard(_path); var path13 = _interopRequireWildcard(_path); var path14 = _interopRequireWildcard(_path);
17
+ var _path = require('path'); var path14 = _interopRequireWildcard(_path); var path12 = _interopRequireWildcard(_path); var path13 = _interopRequireWildcard(_path);
18
18
  var _zod = require('zod'); var _zod2 = _interopRequireDefault(_zod);
19
- var _fs = require('fs'); var fs11 = _interopRequireWildcard(_fs);
19
+ var _fs = require('fs'); var fs10 = _interopRequireWildcard(_fs);
20
20
  var _ini = require('ini'); var _ini2 = _interopRequireDefault(_ini);
21
21
  function getSettings(explicitApiKey) {
22
22
  const env = _loadEnv();
@@ -60,7 +60,7 @@ function _loadEnv() {
60
60
  }
61
61
  function _loadSystemFile() {
62
62
  const settingsFilePath = _getSettingsFilePath();
63
- const content = fs11.default.existsSync(settingsFilePath) ? fs11.default.readFileSync(settingsFilePath, "utf-8") : "";
63
+ const content = fs10.default.existsSync(settingsFilePath) ? fs10.default.readFileSync(settingsFilePath, "utf-8") : "";
64
64
  const data = _ini2.default.parse(content);
65
65
  return _zod2.default.object({
66
66
  auth: _zod2.default.object({
@@ -73,12 +73,12 @@ function _loadSystemFile() {
73
73
  function _saveSystemFile(settings) {
74
74
  const settingsFilePath = _getSettingsFilePath();
75
75
  const content = _ini2.default.stringify(settings);
76
- fs11.default.writeFileSync(settingsFilePath, content);
76
+ fs10.default.writeFileSync(settingsFilePath, content);
77
77
  }
78
78
  function _getSettingsFilePath() {
79
79
  const settingsFile = ".lingodotdevrc";
80
80
  const homedir = _os2.default.homedir();
81
- const settingsFilePath = path15.default.join(homedir, settingsFile);
81
+ const settingsFilePath = path14.default.join(homedir, settingsFile);
82
82
  return settingsFilePath;
83
83
  }
84
84
  function _legacyEnvVarWarning() {
@@ -257,11 +257,11 @@ var _lodash = require('lodash'); var _lodash2 = _interopRequireDefault(_lodash);
257
257
  var __spec = require('@lingo.dev/_spec');
258
258
  function getConfig(resave = true) {
259
259
  const configFilePath = _getConfigFilePath();
260
- const configFileExists = fs11.default.existsSync(configFilePath);
260
+ const configFileExists = fs10.default.existsSync(configFilePath);
261
261
  if (!configFileExists) {
262
262
  return null;
263
263
  }
264
- const fileContents = fs11.default.readFileSync(configFilePath, "utf8");
264
+ const fileContents = fs10.default.readFileSync(configFilePath, "utf8");
265
265
  const rawConfig = JSON.parse(fileContents);
266
266
  const result = __spec.parseI18nConfig.call(void 0, rawConfig);
267
267
  const didConfigChange = !_lodash2.default.isEqual(rawConfig, result);
@@ -273,11 +273,11 @@ function getConfig(resave = true) {
273
273
  function saveConfig(config) {
274
274
  const configFilePath = _getConfigFilePath();
275
275
  const serialized = JSON.stringify(config, null, 2);
276
- fs11.default.writeFileSync(configFilePath, serialized);
276
+ fs10.default.writeFileSync(configFilePath, serialized);
277
277
  return config;
278
278
  }
279
279
  function _getConfigFilePath() {
280
- return path15.default.join(process.cwd(), "i18n.json");
280
+ return path14.default.join(process.cwd(), "i18n.json");
281
281
  }
282
282
 
283
283
  // src/cli/cmd/init.ts
@@ -362,7 +362,7 @@ function findLocaleFilesForFilename(fileName) {
362
362
  });
363
363
  const localeFilesAndPatterns = localeFiles.map((file) => ({
364
364
  file,
365
- pattern: path15.default.join(path15.default.dirname(file), pattern)
365
+ pattern: path14.default.join(path14.default.dirname(file), pattern)
366
366
  }));
367
367
  const grouppedFilesAndPatterns = _lodash2.default.groupBy(localeFilesAndPatterns, "pattern");
368
368
  const patterns = Object.keys(grouppedFilesAndPatterns);
@@ -382,10 +382,10 @@ function ensurePatterns(patterns, source) {
382
382
  }
383
383
  patterns.forEach((pattern) => {
384
384
  const filePath = pattern.replace("[locale]", source);
385
- if (!fs11.default.existsSync(filePath)) {
386
- const defaultContent = getDefaultContent(path15.default.extname(filePath), source);
387
- fs11.default.mkdirSync(path15.default.dirname(filePath), { recursive: true });
388
- fs11.default.writeFileSync(filePath, defaultContent);
385
+ if (!fs10.default.existsSync(filePath)) {
386
+ const defaultContent = getDefaultContent(path14.default.extname(filePath), source);
387
+ fs10.default.mkdirSync(path14.default.dirname(filePath), { recursive: true });
388
+ fs10.default.writeFileSync(filePath, defaultContent);
389
389
  }
390
390
  });
391
391
  }
@@ -464,31 +464,31 @@ function updateGitignore() {
464
464
  if (!projectRoot) {
465
465
  return;
466
466
  }
467
- const gitignorePath = path15.default.join(projectRoot, ".gitignore");
468
- if (!fs11.default.existsSync(gitignorePath)) {
467
+ const gitignorePath = path14.default.join(projectRoot, ".gitignore");
468
+ if (!fs10.default.existsSync(gitignorePath)) {
469
469
  return;
470
470
  }
471
- const gitignore = fs11.default.readFileSync(gitignorePath, "utf8").split("\n");
471
+ const gitignore = fs10.default.readFileSync(gitignorePath, "utf8").split("\n");
472
472
  const cacheIsIgnored = gitignore.includes(cacheFile);
473
473
  if (!cacheIsIgnored) {
474
474
  let content = "";
475
- content = fs11.default.readFileSync(gitignorePath, "utf8");
475
+ content = fs10.default.readFileSync(gitignorePath, "utf8");
476
476
  if (content !== "" && !content.endsWith("\n")) {
477
477
  content += "\n";
478
478
  }
479
479
  content += `${cacheFile}
480
480
  `;
481
- fs11.default.writeFileSync(gitignorePath, content);
481
+ fs10.default.writeFileSync(gitignorePath, content);
482
482
  }
483
483
  }
484
484
  function findCurrentProjectRoot() {
485
485
  let currentDir = process.cwd();
486
- while (currentDir !== path15.default.parse(currentDir).root) {
487
- const gitDirPath = path15.default.join(currentDir, ".git");
488
- if (fs11.default.existsSync(gitDirPath) && fs11.default.lstatSync(gitDirPath).isDirectory()) {
486
+ while (currentDir !== path14.default.parse(currentDir).root) {
487
+ const gitDirPath = path14.default.join(currentDir, ".git");
488
+ if (fs10.default.existsSync(gitDirPath) && fs10.default.lstatSync(gitDirPath).isDirectory()) {
489
489
  return currentDir;
490
490
  }
491
- currentDir = path15.default.dirname(currentDir);
491
+ currentDir = path14.default.dirname(currentDir);
492
492
  }
493
493
  return null;
494
494
  }
@@ -530,24 +530,24 @@ function makePlatformInitializer(config, spinner) {
530
530
  return {
531
531
  name: config.name,
532
532
  isEnabled: () => {
533
- const filePath = path15.default.join(process.cwd(), config.checkPath);
534
- return fs11.default.existsSync(filePath);
533
+ const filePath = path14.default.join(process.cwd(), config.checkPath);
534
+ return fs10.default.existsSync(filePath);
535
535
  },
536
536
  init: async () => {
537
- const filePath = path15.default.join(process.cwd(), config.ciConfigPath);
538
- const dirPath = path15.default.dirname(filePath);
539
- if (!fs11.default.existsSync(dirPath)) {
540
- fs11.default.mkdirSync(dirPath, { recursive: true });
537
+ const filePath = path14.default.join(process.cwd(), config.ciConfigPath);
538
+ const dirPath = path14.default.dirname(filePath);
539
+ if (!fs10.default.existsSync(dirPath)) {
540
+ fs10.default.mkdirSync(dirPath, { recursive: true });
541
541
  }
542
542
  let canWrite = true;
543
- if (fs11.default.existsSync(filePath)) {
543
+ if (fs10.default.existsSync(filePath)) {
544
544
  canWrite = await _prompts.confirm.call(void 0, {
545
545
  message: `File ${filePath} already exists. Do you want to overwrite it?`,
546
546
  default: false
547
547
  });
548
548
  }
549
549
  if (canWrite) {
550
- fs11.default.writeFileSync(filePath, config.ciConfigContent);
550
+ fs10.default.writeFileSync(filePath, config.ciConfigContent);
551
551
  spinner.succeed(`CI/CD initialized for ${config.name}`);
552
552
  } else {
553
553
  spinner.warn(`CI/CD not initialized for ${config.name}`);
@@ -621,9 +621,9 @@ function makeGitlabInitializer(spinner) {
621
621
 
622
622
  // src/cli/cmd/init.ts
623
623
 
624
- var openUrl = (path18) => {
624
+ var openUrl = (path17) => {
625
625
  const settings = getSettings(void 0);
626
- _open2.default.call(void 0, `${settings.auth.webUrl}${path18}`, { wait: false });
626
+ _open2.default.call(void 0, `${settings.auth.webUrl}${path17}`, { wait: false });
627
627
  };
628
628
  var throwHelpError = (option, value) => {
629
629
  if (value === "help") {
@@ -669,8 +669,8 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
669
669
  const values = value.includes(",") ? value.split(",") : value.split(" ");
670
670
  for (const p of values) {
671
671
  try {
672
- const dirPath = path15.default.dirname(p);
673
- const stats = fs11.default.statSync(dirPath);
672
+ const dirPath = path14.default.dirname(p);
673
+ const stats = fs10.default.statSync(dirPath);
674
674
  if (!stats.isDirectory()) {
675
675
  throw new Error(`${dirPath} is not a directory`);
676
676
  }
@@ -806,12 +806,12 @@ var config_default = new (0, _interactivecommander.Command)().command("config").
806
806
  console.log(JSON.stringify(config, null, 2));
807
807
  });
808
808
  function loadReplexicaFileConfig() {
809
- const replexicaConfigPath = path15.default.resolve(process.cwd(), "i18n.json");
810
- const fileExists = fs11.default.existsSync(replexicaConfigPath);
809
+ const replexicaConfigPath = path14.default.resolve(process.cwd(), "i18n.json");
810
+ const fileExists = fs10.default.existsSync(replexicaConfigPath);
811
811
  if (!fileExists) {
812
812
  return void 0;
813
813
  }
814
- const fileContent = fs11.default.readFileSync(replexicaConfigPath, "utf-8");
814
+ const fileContent = fs10.default.readFileSync(replexicaConfigPath, "utf-8");
815
815
  const replexicaFileConfig = JSON.parse(fileContent);
816
816
  return replexicaFileConfig;
817
817
  }
@@ -890,9 +890,9 @@ function extractPathPatterns(sourceLocale, include, exclude) {
890
890
  return result;
891
891
  }
892
892
  function expandPlaceholderedGlob(_pathPattern, sourceLocale) {
893
- const absolutePathPattern = path15.default.resolve(_pathPattern);
894
- const pathPattern = path15.default.relative(process.cwd(), absolutePathPattern);
895
- if (path15.default.relative(process.cwd(), pathPattern).startsWith("..")) {
893
+ const absolutePathPattern = path14.default.resolve(_pathPattern);
894
+ const pathPattern = path14.default.relative(process.cwd(), absolutePathPattern);
895
+ if (path14.default.relative(process.cwd(), pathPattern).startsWith("..")) {
896
896
  throw new CLIError({
897
897
  message: `Invalid path pattern: ${pathPattern}. Path pattern must be within the current working directory.`,
898
898
  docUrl: "invalidPathPattern"
@@ -904,7 +904,7 @@ function expandPlaceholderedGlob(_pathPattern, sourceLocale) {
904
904
  docUrl: "invalidPathPattern"
905
905
  });
906
906
  }
907
- const pathPatternChunks = pathPattern.split(path15.default.sep);
907
+ const pathPatternChunks = pathPattern.split(path14.default.sep);
908
908
  const localeSegmentIndexes = pathPatternChunks.reduce((indexes, segment, index) => {
909
909
  if (segment.includes("[locale]")) {
910
910
  indexes.push(index);
@@ -912,9 +912,9 @@ function expandPlaceholderedGlob(_pathPattern, sourceLocale) {
912
912
  return indexes;
913
913
  }, []);
914
914
  const sourcePathPattern = pathPattern.replaceAll(/\[locale\]/g, sourceLocale);
915
- const sourcePaths = _glob.glob.sync(sourcePathPattern, { follow: true, withFileTypes: true }).filter((file) => file.isFile() || file.isSymbolicLink()).map((file) => file.fullpath()).map((fullpath) => path15.default.relative(process.cwd(), fullpath));
915
+ const sourcePaths = _glob.glob.sync(sourcePathPattern, { follow: true, withFileTypes: true }).filter((file) => file.isFile() || file.isSymbolicLink()).map((file) => file.fullpath()).map((fullpath) => path14.default.relative(process.cwd(), fullpath));
916
916
  const placeholderedPaths = sourcePaths.map((sourcePath) => {
917
- const sourcePathChunks = sourcePath.split(path15.default.sep);
917
+ const sourcePathChunks = sourcePath.split(path14.default.sep);
918
918
  localeSegmentIndexes.forEach((localeSegmentIndex) => {
919
919
  const pathPatternChunk = pathPatternChunks[localeSegmentIndex];
920
920
  const sourcePathChunk = sourcePathChunks[localeSegmentIndex];
@@ -928,7 +928,7 @@ function expandPlaceholderedGlob(_pathPattern, sourceLocale) {
928
928
  sourcePathChunks[localeSegmentIndex] = placeholderedSegment;
929
929
  }
930
930
  });
931
- const placeholderedPath = sourcePathChunks.join(path15.default.sep);
931
+ const placeholderedPath = sourcePathChunks.join(path14.default.sep);
932
932
  return placeholderedPath;
933
933
  });
934
934
  return placeholderedPaths;
@@ -970,8 +970,8 @@ var files_default = new (0, _interactivecommander.Command)().command("files").de
970
970
  } else if (type.target) {
971
971
  result.push(...targetPaths);
972
972
  }
973
- result.forEach((path18) => {
974
- console.log(path18);
973
+ result.forEach((path17) => {
974
+ console.log(path17);
975
975
  });
976
976
  }
977
977
  }
@@ -998,6 +998,10 @@ var show_default = new (0, _interactivecommander.Command)().command("show").desc
998
998
 
999
999
 
1000
1000
 
1001
+
1002
+
1003
+
1004
+
1001
1005
  // src/cli/loaders/_utils.ts
1002
1006
  function composeLoaders(...loaders) {
1003
1007
  return {
@@ -1216,8 +1220,8 @@ function createTextFileLoader(pathPattern) {
1216
1220
  },
1217
1221
  async push(locale, data, _25, originalLocale) {
1218
1222
  const draftPath = pathPattern.replaceAll("[locale]", locale);
1219
- const finalPath = path15.default.resolve(draftPath);
1220
- const dirPath = path15.default.dirname(finalPath);
1223
+ const finalPath = path14.default.resolve(draftPath);
1224
+ const dirPath = path14.default.dirname(finalPath);
1221
1225
  await _promises4.default.mkdir(dirPath, { recursive: true });
1222
1226
  const trimmedPayload = data.trim();
1223
1227
  const trailingNewLine = await getTrailingNewLine(pathPattern, locale, originalLocale);
@@ -1231,7 +1235,7 @@ function createTextFileLoader(pathPattern) {
1231
1235
  }
1232
1236
  async function readFileForLocale(pathPattern, locale) {
1233
1237
  const draftPath = pathPattern.replaceAll("[locale]", locale);
1234
- const finalPath = path15.default.resolve(draftPath);
1238
+ const finalPath = path14.default.resolve(draftPath);
1235
1239
  const exists = await _promises4.default.access(finalPath).then(() => true).catch(() => false);
1236
1240
  if (!exists) {
1237
1241
  return "";
@@ -1285,7 +1289,6 @@ function getStringType(yamlString) {
1285
1289
  const trimmedLine = line.trim();
1286
1290
  return (trimmedLine.startsWith('"') || trimmedLine.match(/:\s*"/)) && (trimmedLine.endsWith('"') || trimmedLine.endsWith('",'));
1287
1291
  });
1288
- console.log("hasDoubleQuotes", hasDoubleQuotes);
1289
1292
  if (hasDoubleQuotes) {
1290
1293
  return "QUOTE_DOUBLE";
1291
1294
  }
@@ -1551,9 +1554,9 @@ function createHtmlLoader() {
1551
1554
  const bDepth = b.split("/").length;
1552
1555
  return aDepth - bDepth;
1553
1556
  });
1554
- paths.forEach((path18) => {
1555
- const value = data[path18];
1556
- const [nodePath, attribute] = path18.split("#");
1557
+ paths.forEach((path17) => {
1558
+ const value = data[path17];
1559
+ const [nodePath, attribute] = path17.split("#");
1557
1560
  const [rootTag, ...indices] = nodePath.split("/");
1558
1561
  let parent = rootTag === "head" ? document.head : document.body;
1559
1562
  let current = parent;
@@ -1637,96 +1640,6 @@ ${content}`;
1637
1640
  });
1638
1641
  }
1639
1642
 
1640
- // src/cli/loaders/mdx.ts
1641
-
1642
- var _unified = require('unified');
1643
- var _remarkparse = require('remark-parse'); var _remarkparse2 = _interopRequireDefault(_remarkparse);
1644
- var _remarkfrontmatter = require('remark-frontmatter'); var _remarkfrontmatter2 = _interopRequireDefault(_remarkfrontmatter);
1645
- var _remarkgfm = require('remark-gfm'); var _remarkgfm2 = _interopRequireDefault(_remarkgfm);
1646
- var _remarkstringify = require('remark-stringify'); var _remarkstringify2 = _interopRequireDefault(_remarkstringify);
1647
- var _vfile = require('vfile');
1648
- var parser = _unified.unified.call(void 0, ).use(_remarkparse2.default).use(_remarkfrontmatter2.default, ["yaml"]).use(_remarkgfm2.default);
1649
- var serializer = _unified.unified.call(void 0, ).use(_remarkstringify2.default).use(_remarkfrontmatter2.default, ["yaml"]).use(_remarkgfm2.default);
1650
- function createMdxFormatLoader() {
1651
- const skippedTypes = ["code", "inlineCode"];
1652
- return createLoader({
1653
- async pull(locale, input2) {
1654
- const file = new (0, _vfile.VFile)(input2);
1655
- const ast = parser.parse(file);
1656
- const result = _lodash2.default.cloneDeep(ast);
1657
- traverseMdast(result, (node) => {
1658
- if (skippedTypes.includes(node.type)) {
1659
- if ("value" in node) {
1660
- node.value = "";
1661
- }
1662
- }
1663
- });
1664
- return result;
1665
- },
1666
- async push(locale, data, originalInput, originalLocale, pullInput, pullOutput) {
1667
- const file = new (0, _vfile.VFile)(originalInput);
1668
- const ast = parser.parse(file);
1669
- const result = _lodash2.default.cloneDeep(ast);
1670
- traverseMdast(result, (node, indexPath) => {
1671
- if ("value" in node) {
1672
- const incomingValue = findNodeByIndexPath(data, indexPath);
1673
- if (incomingValue && "value" in incomingValue && !_lodash2.default.isEmpty(incomingValue.value)) {
1674
- node.value = incomingValue.value;
1675
- }
1676
- }
1677
- });
1678
- return String(serializer.stringify(result));
1679
- }
1680
- });
1681
- }
1682
- function createDoubleSerializationLoader() {
1683
- return createLoader({
1684
- async pull(locale, input2) {
1685
- return input2;
1686
- },
1687
- async push(locale, data) {
1688
- const file = new (0, _vfile.VFile)(data);
1689
- const ast = parser.parse(file);
1690
- const finalContent = String(serializer.stringify(ast));
1691
- return finalContent;
1692
- }
1693
- });
1694
- }
1695
- function createMdxStructureLoader() {
1696
- return createLoader({
1697
- async pull(locale, input2) {
1698
- const result = _lodash2.default.chain(input2).pickBy((value, key) => key.endsWith("/value")).value();
1699
- return result;
1700
- },
1701
- async push(locale, data, originalInput) {
1702
- const result = _lodash2.default.merge({}, originalInput, data);
1703
- return result;
1704
- }
1705
- });
1706
- }
1707
- function traverseMdast(ast, visitor, indexPath = []) {
1708
- visitor(ast, indexPath);
1709
- if ("children" in ast && Array.isArray(ast.children)) {
1710
- for (let i = 0; i < ast.children.length; i++) {
1711
- traverseMdast(ast.children[i], visitor, [...indexPath, i]);
1712
- }
1713
- }
1714
- }
1715
- function findNodeByIndexPath(ast, indexPath) {
1716
- let result = null;
1717
- const stringifiedIndexPath = indexPath.join(".");
1718
- traverseMdast(ast, (node, path18) => {
1719
- if (result) {
1720
- return;
1721
- }
1722
- const currentStringifiedPath = path18.join(".");
1723
- if (currentStringifiedPath === stringifiedIndexPath) {
1724
- result = node;
1725
- }
1726
- });
1727
- return result;
1728
- }
1729
-
1730
1643
  // src/cli/loaders/properties.ts
1731
1644
  function createPropertiesLoader() {
1732
1645
  return createLoader({
@@ -1862,7 +1775,6 @@ function createXcodeXcstringsLoader(defaultLocale) {
1862
1775
  resultData[translationKey] = translationKey;
1863
1776
  }
1864
1777
  }
1865
- console.log(resultData);
1866
1778
  return resultData;
1867
1779
  },
1868
1780
  async push(locale, payload, originalInput) {
@@ -1924,43 +1836,29 @@ function createXcodeXcstringsLoader(defaultLocale) {
1924
1836
 
1925
1837
  var _prettier = require('prettier'); var _prettier2 = _interopRequireDefault(_prettier);
1926
1838
  function createPrettierLoader(options) {
1839
+ const stage = options.stage || "both";
1927
1840
  return createLoader({
1928
1841
  async pull(locale, data) {
1929
- return data;
1842
+ if (!["pull", "both"].includes(stage)) {
1843
+ return data;
1844
+ }
1845
+ const draftPath = options.bucketPathPattern.replaceAll(
1846
+ "[locale]",
1847
+ locale
1848
+ );
1849
+ const finalPath = path14.default.resolve(draftPath);
1850
+ return await formatDataWithPrettier(data, finalPath, options);
1930
1851
  },
1931
1852
  async push(locale, data) {
1932
- const draftPath = options.bucketPathPattern.replaceAll("[locale]", locale);
1933
- const finalPath = path15.default.resolve(draftPath);
1934
- const prettierConfig = await loadPrettierConfig(finalPath);
1935
- if (!prettierConfig) {
1853
+ if (!["push", "both"].includes(stage)) {
1936
1854
  return data;
1937
1855
  }
1938
- const config = {
1939
- ...prettierConfig || { printWidth: 2500, bracketSameLine: false },
1940
- parser: options.parser,
1941
- // For HTML parser, preserve comments and quotes
1942
- ...options.parser === "html" ? {
1943
- htmlWhitespaceSensitivity: "ignore",
1944
- singleQuote: false,
1945
- embeddedLanguageFormatting: "off"
1946
- } : {}
1947
- };
1948
- try {
1949
- const result = await _prettier2.default.format(data, config);
1950
- return result;
1951
- } catch (error) {
1952
- if (error instanceof Error && error.message.startsWith("Cannot find package")) {
1953
- console.log();
1954
- console.log("\u26A0\uFE0F Prettier plugins are not installed. Formatting without plugins.");
1955
- console.log("\u26A0\uFE0F To use prettier plugins install project dependencies before running Lingo.dev.");
1956
- config.plugins = [];
1957
- await _prettier2.default.clearConfigCache();
1958
- const result = await _prettier2.default.format(data, config);
1959
- return result;
1960
- } else {
1961
- throw error;
1962
- }
1963
- }
1856
+ const draftPath = options.bucketPathPattern.replaceAll(
1857
+ "[locale]",
1858
+ locale
1859
+ );
1860
+ const finalPath = path14.default.resolve(draftPath);
1861
+ return await formatDataWithPrettier(data, finalPath, options);
1964
1862
  }
1965
1863
  });
1966
1864
  }
@@ -1972,6 +1870,39 @@ async function loadPrettierConfig(filePath) {
1972
1870
  return {};
1973
1871
  }
1974
1872
  }
1873
+ async function formatDataWithPrettier(data, filePath, options) {
1874
+ const prettierConfig = await loadPrettierConfig(filePath);
1875
+ if (!prettierConfig && !options.alwaysFormat) {
1876
+ return data;
1877
+ }
1878
+ const config = {
1879
+ ...prettierConfig || { printWidth: 2500, bracketSameLine: false },
1880
+ parser: options.parser,
1881
+ // For HTML parser, preserve comments and quotes
1882
+ ...options.parser === "html" ? {
1883
+ htmlWhitespaceSensitivity: "ignore",
1884
+ singleQuote: false,
1885
+ embeddedLanguageFormatting: "off"
1886
+ } : {}
1887
+ };
1888
+ try {
1889
+ return await _prettier2.default.format(data, config);
1890
+ } catch (error) {
1891
+ if (error instanceof Error && error.message.startsWith("Cannot find package")) {
1892
+ console.log();
1893
+ console.log(
1894
+ "\u26A0\uFE0F Prettier plugins are not installed. Formatting without plugins."
1895
+ );
1896
+ console.log(
1897
+ "\u26A0\uFE0F To use prettier plugins install project dependencies before running Lingo.dev."
1898
+ );
1899
+ config.plugins = [];
1900
+ await _prettier2.default.clearConfigCache();
1901
+ return await _prettier2.default.format(data, config);
1902
+ }
1903
+ throw error;
1904
+ }
1905
+ }
1975
1906
 
1976
1907
  // src/cli/loaders/unlocalizable.ts
1977
1908
 
@@ -2168,10 +2099,10 @@ function createXmlLoader() {
2168
2099
  // src/cli/loaders/srt.ts
2169
2100
  var _srtparser2 = require('srt-parser-2'); var _srtparser22 = _interopRequireDefault(_srtparser2);
2170
2101
  function createSrtLoader() {
2171
- const parser2 = new (0, _srtparser22.default)();
2102
+ const parser = new (0, _srtparser22.default)();
2172
2103
  return createLoader({
2173
2104
  async pull(locale, input2) {
2174
- const parsed = parser2.fromSrt(input2) || [];
2105
+ const parsed = parser.fromSrt(input2) || [];
2175
2106
  const result = {};
2176
2107
  parsed.forEach((entry) => {
2177
2108
  const key = `${entry.id}#${entry.startTime}-${entry.endTime}`;
@@ -2192,7 +2123,7 @@ function createSrtLoader() {
2192
2123
  text
2193
2124
  };
2194
2125
  });
2195
- const srtContent = parser2.toSrt(output).trim().replace(/\r?\n/g, "\n");
2126
+ const srtContent = parser.toSrt(output).trim().replace(/\r?\n/g, "\n");
2196
2127
  return srtContent;
2197
2128
  }
2198
2129
  });
@@ -2702,18 +2633,18 @@ function createRawDatoValue(parsedDatoValue, originalRawDatoValue, isClean = fal
2702
2633
  }
2703
2634
  function serializeStructuredText(rawStructuredText) {
2704
2635
  return serializeStructuredTextNode(rawStructuredText);
2705
- function serializeStructuredTextNode(node, path18 = [], acc = {}) {
2636
+ function serializeStructuredTextNode(node, path17 = [], acc = {}) {
2706
2637
  if ("document" in node) {
2707
- return serializeStructuredTextNode(node.document, [...path18, "document"], acc);
2638
+ return serializeStructuredTextNode(node.document, [...path17, "document"], acc);
2708
2639
  }
2709
2640
  if (!_lodash2.default.isNil(node.value)) {
2710
- acc[[...path18, "value"].join(".")] = node.value;
2641
+ acc[[...path17, "value"].join(".")] = node.value;
2711
2642
  } else if (_lodash2.default.get(node, "type") === "block") {
2712
- acc[[...path18, "item"].join(".")] = serializeBlock(node.item);
2643
+ acc[[...path17, "item"].join(".")] = serializeBlock(node.item);
2713
2644
  }
2714
2645
  if (node.children) {
2715
2646
  for (let i = 0; i < node.children.length; i++) {
2716
- serializeStructuredTextNode(node.children[i], [...path18, i.toString()], acc);
2647
+ serializeStructuredTextNode(node.children[i], [...path17, i.toString()], acc);
2717
2648
  }
2718
2649
  }
2719
2650
  return acc;
@@ -2772,8 +2703,8 @@ function deserializeBlockList(parsedBlockList, originalRawBlockList, isClean = f
2772
2703
  }
2773
2704
  function deserializeStructuredText(parsedStructuredText, originalRawStructuredText) {
2774
2705
  const result = _lodash2.default.cloneDeep(originalRawStructuredText);
2775
- for (const [path18, value] of _lodash2.default.entries(parsedStructuredText)) {
2776
- const realPath = _lodash2.default.chain(path18.split(".")).flatMap((s) => !_lodash2.default.isNaN(_lodash2.default.toNumber(s)) ? ["children", s] : s).value();
2706
+ for (const [path17, value] of _lodash2.default.entries(parsedStructuredText)) {
2707
+ const realPath = _lodash2.default.chain(path17.split(".")).flatMap((s) => !_lodash2.default.isNaN(_lodash2.default.toNumber(s)) ? ["children", s] : s).value();
2777
2708
  const deserializedValue = createRawDatoValue(value, _lodash2.default.get(originalRawStructuredText, realPath), true);
2778
2709
  _lodash2.default.set(result, realPath, deserializedValue);
2779
2710
  }
@@ -2798,12 +2729,12 @@ function _isVideo(rawDatoValue) {
2798
2729
  // src/cli/loaders/dato/index.ts
2799
2730
  function createDatoLoader(configFilePath) {
2800
2731
  try {
2801
- const configContent = fs11.default.readFileSync(configFilePath, "utf-8");
2732
+ const configContent = fs10.default.readFileSync(configFilePath, "utf-8");
2802
2733
  const datoConfig = datoConfigSchema.parse(_json52.default.parse(configContent));
2803
2734
  return composeLoaders(
2804
2735
  createDatoApiLoader(
2805
2736
  datoConfig,
2806
- (updatedConfig) => fs11.default.writeFileSync(configFilePath, _json52.default.stringify(updatedConfig, null, 2))
2737
+ (updatedConfig) => fs10.default.writeFileSync(configFilePath, _json52.default.stringify(updatedConfig, null, 2))
2807
2738
  ),
2808
2739
  createDatoFilterLoader(),
2809
2740
  createDatoExtractLoader()
@@ -3140,6 +3071,117 @@ function createLockedKeysLoader(lockedKeys, isCacheRestore = false) {
3140
3071
  });
3141
3072
  }
3142
3073
 
3074
+ // src/cli/loaders/mdx2/frontmatter-split.ts
3075
+
3076
+ function createMdxFrontmatterSplitLoader() {
3077
+ return createLoader({
3078
+ async pull(locale, input2) {
3079
+ const source = input2 || "";
3080
+ const { data: frontmatter, content } = _graymatter2.default.call(void 0, source);
3081
+ return {
3082
+ frontmatter,
3083
+ content
3084
+ };
3085
+ },
3086
+ async push(locale, data) {
3087
+ const { frontmatter = {}, content = "" } = data || {};
3088
+ const result = _graymatter2.default.stringify(content, frontmatter).trim();
3089
+ return result;
3090
+ }
3091
+ });
3092
+ }
3093
+
3094
+ // src/cli/utils/md5.ts
3095
+ var _objecthash = require('object-hash');
3096
+ function md5(input2) {
3097
+ return _objecthash.MD5.call(void 0, input2);
3098
+ }
3099
+
3100
+ // src/cli/loaders/mdx2/code-placeholder.ts
3101
+ var _unified = require('unified');
3102
+ var _remarkparse = require('remark-parse'); var _remarkparse2 = _interopRequireDefault(_remarkparse);
3103
+ var _remarkgfm = require('remark-gfm'); var _remarkgfm2 = _interopRequireDefault(_remarkgfm);
3104
+ var _vfile = require('vfile');
3105
+ var _remarkmdx = require('remark-mdx'); var _remarkmdx2 = _interopRequireDefault(_remarkmdx);
3106
+ function extractCodePlaceholders(content) {
3107
+ let finalContent = content;
3108
+ const codePlaceholders = {};
3109
+ const codeBlockRegex = /^```.*\n([\s\S]*?)^```$/gm;
3110
+ const codeBlockMatches = finalContent.matchAll(codeBlockRegex);
3111
+ for (const match of codeBlockMatches) {
3112
+ const codeBlock = match[0];
3113
+ const codeBlockHash = md5(codeBlock);
3114
+ const placeholderId = `---CODE_PLACEHOLDER_${codeBlockHash}---`;
3115
+ codePlaceholders[placeholderId] = codeBlock;
3116
+ finalContent = finalContent.replace(codeBlock, placeholderId);
3117
+ }
3118
+ return {
3119
+ content: finalContent,
3120
+ codePlaceholders
3121
+ };
3122
+ }
3123
+ function createMdxCodePlaceholderLoader() {
3124
+ return createLoader({
3125
+ async pull(locale, input2) {
3126
+ const response = extractCodePlaceholders(input2);
3127
+ return response.content;
3128
+ },
3129
+ async push(locale, data, originalInput) {
3130
+ const response = extractCodePlaceholders(_nullishCoalesce(originalInput, () => ( "")));
3131
+ let result = data;
3132
+ for (const [placeholder, original] of Object.entries(
3133
+ response.codePlaceholders
3134
+ )) {
3135
+ result = result.replaceAll(placeholder, original);
3136
+ }
3137
+ return result;
3138
+ }
3139
+ });
3140
+ }
3141
+
3142
+ // src/cli/loaders/mdx2/localizable-document.ts
3143
+ function createLocalizableMdxDocumentLoader() {
3144
+ return createLoader({
3145
+ async pull(_locale, input2) {
3146
+ return {
3147
+ meta: input2.frontmatter,
3148
+ content: input2.sections
3149
+ };
3150
+ },
3151
+ async push(_locale, data, originalInput, _originalLocale, pullInput) {
3152
+ const result = {
3153
+ frontmatter: data.meta || {},
3154
+ sections: data.content || {}
3155
+ };
3156
+ return result;
3157
+ }
3158
+ });
3159
+ }
3160
+
3161
+ // src/cli/loaders/mdx2/sections-split-2.ts
3162
+
3163
+ function createMdxSectionsSplit2Loader() {
3164
+ return createLoader({
3165
+ async pull(locale, input2) {
3166
+ const sections = _lodash2.default.chain(input2.content).split("\n\n").filter(Boolean).map((section, index) => [index, section]).fromPairs().value();
3167
+ const result = {
3168
+ frontmatter: input2.frontmatter,
3169
+ sections
3170
+ };
3171
+ return result;
3172
+ },
3173
+ async push(locale, data, originalInput, _originalLocale, pullInput) {
3174
+ const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
3175
+ const result = {
3176
+ frontmatter: data.frontmatter,
3177
+ codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _144 => _144.codePlaceholders]) || {},
3178
+ content
3179
+ };
3180
+ return result;
3181
+ }
3182
+ });
3183
+ }
3184
+
3143
3185
  // src/cli/loaders/index.ts
3144
3186
  function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys) {
3145
3187
  switch (bucketType) {
@@ -3151,7 +3193,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3151
3193
  createAndroidLoader(),
3152
3194
  createFlatLoader(),
3153
3195
  createSyncLoader(),
3154
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3196
+ createUnlocalizableLoader(
3197
+ options.isCacheRestore,
3198
+ options.returnUnlocalizedKeys
3199
+ )
3155
3200
  );
3156
3201
  case "csv":
3157
3202
  return composeLoaders(
@@ -3159,7 +3204,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3159
3204
  createCsvLoader(),
3160
3205
  createFlatLoader(),
3161
3206
  createSyncLoader(),
3162
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3207
+ createUnlocalizableLoader(
3208
+ options.isCacheRestore,
3209
+ options.returnUnlocalizedKeys
3210
+ )
3163
3211
  );
3164
3212
  case "html":
3165
3213
  return composeLoaders(
@@ -3167,7 +3215,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3167
3215
  createPrettierLoader({ parser: "html", bucketPathPattern }),
3168
3216
  createHtmlLoader(),
3169
3217
  createSyncLoader(),
3170
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3218
+ createUnlocalizableLoader(
3219
+ options.isCacheRestore,
3220
+ options.returnUnlocalizedKeys
3221
+ )
3171
3222
  );
3172
3223
  case "json":
3173
3224
  return composeLoaders(
@@ -3178,7 +3229,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3178
3229
  createFlatLoader(),
3179
3230
  createLockedKeysLoader(lockedKeys || [], options.isCacheRestore),
3180
3231
  createSyncLoader(),
3181
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3232
+ createUnlocalizableLoader(
3233
+ options.isCacheRestore,
3234
+ options.returnUnlocalizedKeys
3235
+ )
3182
3236
  );
3183
3237
  case "markdown":
3184
3238
  return composeLoaders(
@@ -3186,18 +3240,28 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3186
3240
  createPrettierLoader({ parser: "markdown", bucketPathPattern }),
3187
3241
  createMarkdownLoader(),
3188
3242
  createSyncLoader(),
3189
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3243
+ createUnlocalizableLoader(
3244
+ options.isCacheRestore,
3245
+ options.returnUnlocalizedKeys
3246
+ )
3190
3247
  );
3191
3248
  case "mdx":
3192
3249
  return composeLoaders(
3193
3250
  createTextFileLoader(bucketPathPattern),
3194
- createDoubleSerializationLoader(),
3195
- createPrettierLoader({ parser: "mdx", bucketPathPattern }),
3196
- createMdxFormatLoader(),
3251
+ createMdxCodePlaceholderLoader(),
3252
+ createPrettierLoader({
3253
+ parser: "mdx",
3254
+ bucketPathPattern
3255
+ }),
3256
+ createMdxFrontmatterSplitLoader(),
3257
+ createMdxSectionsSplit2Loader(),
3258
+ createLocalizableMdxDocumentLoader(),
3197
3259
  createFlatLoader(),
3198
- createMdxStructureLoader(),
3199
3260
  createSyncLoader(),
3200
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3261
+ createUnlocalizableLoader(
3262
+ options.isCacheRestore,
3263
+ options.returnUnlocalizedKeys
3264
+ )
3201
3265
  );
3202
3266
  case "po":
3203
3267
  return composeLoaders(
@@ -3206,21 +3270,30 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3206
3270
  createFlatLoader(),
3207
3271
  createSyncLoader(),
3208
3272
  createVariableLoader({ type: "python" }),
3209
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3273
+ createUnlocalizableLoader(
3274
+ options.isCacheRestore,
3275
+ options.returnUnlocalizedKeys
3276
+ )
3210
3277
  );
3211
3278
  case "properties":
3212
3279
  return composeLoaders(
3213
3280
  createTextFileLoader(bucketPathPattern),
3214
3281
  createPropertiesLoader(),
3215
3282
  createSyncLoader(),
3216
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3283
+ createUnlocalizableLoader(
3284
+ options.isCacheRestore,
3285
+ options.returnUnlocalizedKeys
3286
+ )
3217
3287
  );
3218
3288
  case "xcode-strings":
3219
3289
  return composeLoaders(
3220
3290
  createTextFileLoader(bucketPathPattern),
3221
3291
  createXcodeStringsLoader(),
3222
3292
  createSyncLoader(),
3223
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3293
+ createUnlocalizableLoader(
3294
+ options.isCacheRestore,
3295
+ options.returnUnlocalizedKeys
3296
+ )
3224
3297
  );
3225
3298
  case "xcode-stringsdict":
3226
3299
  return composeLoaders(
@@ -3228,7 +3301,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3228
3301
  createXcodeStringsdictLoader(),
3229
3302
  createFlatLoader(),
3230
3303
  createSyncLoader(),
3231
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3304
+ createUnlocalizableLoader(
3305
+ options.isCacheRestore,
3306
+ options.returnUnlocalizedKeys
3307
+ )
3232
3308
  );
3233
3309
  case "xcode-xcstrings":
3234
3310
  return composeLoaders(
@@ -3239,7 +3315,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3239
3315
  createFlatLoader(),
3240
3316
  createSyncLoader(),
3241
3317
  createVariableLoader({ type: "ieee" }),
3242
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3318
+ createUnlocalizableLoader(
3319
+ options.isCacheRestore,
3320
+ options.returnUnlocalizedKeys
3321
+ )
3243
3322
  );
3244
3323
  case "yaml":
3245
3324
  return composeLoaders(
@@ -3249,7 +3328,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3249
3328
  createFlatLoader(),
3250
3329
  createLockedKeysLoader(lockedKeys || [], options.isCacheRestore),
3251
3330
  createSyncLoader(),
3252
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3331
+ createUnlocalizableLoader(
3332
+ options.isCacheRestore,
3333
+ options.returnUnlocalizedKeys
3334
+ )
3253
3335
  );
3254
3336
  case "yaml-root-key":
3255
3337
  return composeLoaders(
@@ -3259,7 +3341,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3259
3341
  createRootKeyLoader(true),
3260
3342
  createFlatLoader(),
3261
3343
  createSyncLoader(),
3262
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3344
+ createUnlocalizableLoader(
3345
+ options.isCacheRestore,
3346
+ options.returnUnlocalizedKeys
3347
+ )
3263
3348
  );
3264
3349
  case "flutter":
3265
3350
  return composeLoaders(
@@ -3269,7 +3354,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3269
3354
  createFlutterLoader(),
3270
3355
  createFlatLoader(),
3271
3356
  createSyncLoader(),
3272
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3357
+ createUnlocalizableLoader(
3358
+ options.isCacheRestore,
3359
+ options.returnUnlocalizedKeys
3360
+ )
3273
3361
  );
3274
3362
  case "xliff":
3275
3363
  return composeLoaders(
@@ -3277,7 +3365,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3277
3365
  createXliffLoader(),
3278
3366
  createFlatLoader(),
3279
3367
  createSyncLoader(),
3280
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3368
+ createUnlocalizableLoader(
3369
+ options.isCacheRestore,
3370
+ options.returnUnlocalizedKeys
3371
+ )
3281
3372
  );
3282
3373
  case "xml":
3283
3374
  return composeLoaders(
@@ -3285,28 +3376,40 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3285
3376
  createXmlLoader(),
3286
3377
  createFlatLoader(),
3287
3378
  createSyncLoader(),
3288
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3379
+ createUnlocalizableLoader(
3380
+ options.isCacheRestore,
3381
+ options.returnUnlocalizedKeys
3382
+ )
3289
3383
  );
3290
3384
  case "srt":
3291
3385
  return composeLoaders(
3292
3386
  createTextFileLoader(bucketPathPattern),
3293
3387
  createSrtLoader(),
3294
3388
  createSyncLoader(),
3295
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3389
+ createUnlocalizableLoader(
3390
+ options.isCacheRestore,
3391
+ options.returnUnlocalizedKeys
3392
+ )
3296
3393
  );
3297
3394
  case "dato":
3298
3395
  return composeLoaders(
3299
3396
  createDatoLoader(bucketPathPattern),
3300
3397
  createSyncLoader(),
3301
3398
  createFlatLoader(),
3302
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3399
+ createUnlocalizableLoader(
3400
+ options.isCacheRestore,
3401
+ options.returnUnlocalizedKeys
3402
+ )
3303
3403
  );
3304
3404
  case "vtt":
3305
3405
  return composeLoaders(
3306
3406
  createTextFileLoader(bucketPathPattern),
3307
3407
  createVttLoader(),
3308
3408
  createSyncLoader(),
3309
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3409
+ createUnlocalizableLoader(
3410
+ options.isCacheRestore,
3411
+ options.returnUnlocalizedKeys
3412
+ )
3310
3413
  );
3311
3414
  case "php":
3312
3415
  return composeLoaders(
@@ -3314,7 +3417,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3314
3417
  createPhpLoader(),
3315
3418
  createSyncLoader(),
3316
3419
  createFlatLoader(),
3317
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3420
+ createUnlocalizableLoader(
3421
+ options.isCacheRestore,
3422
+ options.returnUnlocalizedKeys
3423
+ )
3318
3424
  );
3319
3425
  case "vue-json":
3320
3426
  return composeLoaders(
@@ -3322,7 +3428,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3322
3428
  createVueJsonLoader(),
3323
3429
  createSyncLoader(),
3324
3430
  createFlatLoader(),
3325
- createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
3431
+ createUnlocalizableLoader(
3432
+ options.isCacheRestore,
3433
+ options.returnUnlocalizedKeys
3434
+ )
3326
3435
  );
3327
3436
  }
3328
3437
  }
@@ -3333,73 +3442,6 @@ var _diff = require('diff');
3333
3442
 
3334
3443
  var _externaleditor = require('external-editor'); var _externaleditor2 = _interopRequireDefault(_externaleditor);
3335
3444
 
3336
- // src/cli/utils/cache.ts
3337
-
3338
-
3339
- var cacheChunk = (targetLocale, sourceChunk, processedChunk) => {
3340
- const rows = Object.entries(sourceChunk).map(([key, source]) => ({
3341
- targetLocale,
3342
- key,
3343
- source,
3344
- processed: processedChunk[key]
3345
- }));
3346
- _appendToCache(rows);
3347
- };
3348
- function getNormalizedCache() {
3349
- const rows = _loadCache();
3350
- if (!rows.length) {
3351
- return null;
3352
- }
3353
- const normalized = {};
3354
- for (const row of rows) {
3355
- if (!normalized[row.targetLocale]) {
3356
- normalized[row.targetLocale] = {};
3357
- }
3358
- normalized[row.targetLocale][row.key] = {
3359
- source: row.source,
3360
- result: row.processed
3361
- };
3362
- }
3363
- return normalized;
3364
- }
3365
- function deleteCache() {
3366
- const cacheFilePath = _getCacheFilePath();
3367
- try {
3368
- fs11.default.unlinkSync(cacheFilePath);
3369
- } catch (e) {
3370
- }
3371
- }
3372
- function _loadCache() {
3373
- const cacheFilePath = _getCacheFilePath();
3374
- if (!fs11.default.existsSync(cacheFilePath)) {
3375
- return [];
3376
- }
3377
- const content = fs11.default.readFileSync(cacheFilePath, "utf-8");
3378
- const result = _parseJSONLines(content);
3379
- return result;
3380
- }
3381
- function _appendToCache(rows) {
3382
- const cacheFilePath = _getCacheFilePath();
3383
- const lines = _buildJSONLines(rows);
3384
- fs11.default.appendFileSync(cacheFilePath, lines);
3385
- }
3386
- function _getCacheFilePath() {
3387
- return path15.default.join(process.cwd(), "i18n.cache");
3388
- }
3389
- function _buildJSONLines(rows) {
3390
- return rows.map((row) => JSON.stringify(row)).join("\n") + "\n";
3391
- }
3392
- function _parseJSONLines(lines) {
3393
- return lines.split("\n").map(_tryParseJSON).filter((line) => line !== null);
3394
- }
3395
- function _tryParseJSON(line) {
3396
- try {
3397
- return JSON.parse(line);
3398
- } catch (e) {
3399
- return null;
3400
- }
3401
- }
3402
-
3403
3445
  // src/cli/processor/lingo.ts
3404
3446
  var __sdk = require('@lingo.dev/_sdk');
3405
3447
  function createLingoLocalizer(params) {
@@ -3478,7 +3520,7 @@ function createBasicTranslator(model, systemPrompt) {
3478
3520
  ]
3479
3521
  });
3480
3522
  const result = JSON.parse(response.text);
3481
- return _optionalChain([result, 'optionalAccess', _144 => _144.data]) || {};
3523
+ return _optionalChain([result, 'optionalAccess', _145 => _145.data]) || {};
3482
3524
  };
3483
3525
  }
3484
3526
 
@@ -3496,7 +3538,7 @@ function createProcessor(provider, params) {
3496
3538
  }
3497
3539
  }
3498
3540
  function getPureModelProvider(provider) {
3499
- switch (_optionalChain([provider, 'optionalAccess', _145 => _145.id])) {
3541
+ switch (_optionalChain([provider, 'optionalAccess', _146 => _146.id])) {
3500
3542
  case "openai":
3501
3543
  if (!process.env.OPENAI_API_KEY) {
3502
3544
  throw new Error("OPENAI_API_KEY is not set.");
@@ -3513,7 +3555,7 @@ function getPureModelProvider(provider) {
3513
3555
  apiKey: process.env.ANTHROPIC_API_KEY
3514
3556
  })(provider.model);
3515
3557
  default:
3516
- throw new Error(`Unsupported provider: ${_optionalChain([provider, 'optionalAccess', _146 => _146.id])}`);
3558
+ throw new Error(`Unsupported provider: ${_optionalChain([provider, 'optionalAccess', _147 => _147.id])}`);
3517
3559
  }
3518
3560
  }
3519
3561
 
@@ -3567,28 +3609,27 @@ async function trackEvent(distinctId, event, properties) {
3567
3609
  // src/cli/utils/delta.ts
3568
3610
 
3569
3611
 
3570
- var _objecthash = require('object-hash');
3571
3612
 
3572
3613
  // src/cli/utils/fs.ts
3573
3614
 
3574
3615
 
3575
3616
  function tryReadFile(filePath, defaultValue = null) {
3576
3617
  try {
3577
- const content = fs11.readFileSync(filePath, "utf-8");
3618
+ const content = fs10.readFileSync(filePath, "utf-8");
3578
3619
  return content;
3579
3620
  } catch (error) {
3580
3621
  return defaultValue;
3581
3622
  }
3582
3623
  }
3583
3624
  function writeFile(filePath, content) {
3584
- const dir = path13.dirname(filePath);
3585
- if (!fs11.existsSync(dir)) {
3586
- fs11.mkdirSync(dir, { recursive: true });
3625
+ const dir = path12.dirname(filePath);
3626
+ if (!fs10.existsSync(dir)) {
3627
+ fs10.mkdirSync(dir, { recursive: true });
3587
3628
  }
3588
- fs11.writeFileSync(filePath, content);
3629
+ fs10.writeFileSync(filePath, content);
3589
3630
  }
3590
3631
  function checkIfFileExists(filePath) {
3591
- return fs11.existsSync(filePath);
3632
+ return fs10.existsSync(filePath);
3592
3633
  }
3593
3634
 
3594
3635
  // src/cli/utils/delta.ts
@@ -3609,7 +3650,7 @@ var LockSchema = _zod2.default.object({
3609
3650
  ).default({})
3610
3651
  });
3611
3652
  function createDeltaProcessor(fileKey) {
3612
- const lockfilePath = path14.join(process.cwd(), "i18n.lock");
3653
+ const lockfilePath = path13.join(process.cwd(), "i18n.lock");
3613
3654
  return {
3614
3655
  async checkIfLockExists() {
3615
3656
  return checkIfFileExists(lockfilePath);
@@ -3618,11 +3659,11 @@ function createDeltaProcessor(fileKey) {
3618
3659
  let added = _lodash2.default.difference(Object.keys(params.sourceData), Object.keys(params.targetData));
3619
3660
  let removed = _lodash2.default.difference(Object.keys(params.targetData), Object.keys(params.sourceData));
3620
3661
  const updated = _lodash2.default.filter(Object.keys(params.sourceData), (key) => {
3621
- return _objecthash.MD5.call(void 0, params.sourceData[key]) !== params.checksums[key] && params.checksums[key];
3662
+ return md5(params.sourceData[key]) !== params.checksums[key] && params.checksums[key];
3622
3663
  });
3623
3664
  const renamed = [];
3624
3665
  for (const addedKey of added) {
3625
- const addedHash = _objecthash.MD5.call(void 0, params.sourceData[addedKey]);
3666
+ const addedHash = md5(params.sourceData[addedKey]);
3626
3667
  for (const removedKey of removed) {
3627
3668
  if (params.checksums[removedKey] === addedHash) {
3628
3669
  renamed.push([removedKey, addedKey]);
@@ -3655,18 +3696,18 @@ function createDeltaProcessor(fileKey) {
3655
3696
  writeFile(lockfilePath, lockfileYaml);
3656
3697
  },
3657
3698
  async loadChecksums() {
3658
- const id = _objecthash.MD5.call(void 0, fileKey);
3699
+ const id = md5(fileKey);
3659
3700
  const lockfileData = await this.loadLock();
3660
3701
  return lockfileData.checksums[id] || {};
3661
3702
  },
3662
3703
  async saveChecksums(checksums) {
3663
- const id = _objecthash.MD5.call(void 0, fileKey);
3704
+ const id = md5(fileKey);
3664
3705
  const lockfileData = await this.loadLock();
3665
3706
  lockfileData.checksums[id] = checksums;
3666
3707
  await this.saveLock(lockfileData);
3667
3708
  },
3668
3709
  async createChecksums(sourceData) {
3669
- const checksums = _lodash2.default.mapValues(sourceData, (value) => _objecthash.MD5.call(void 0, value));
3710
+ const checksums = _lodash2.default.mapValues(sourceData, (value) => md5(value));
3670
3711
  return checksums;
3671
3712
  }
3672
3713
  };
@@ -3674,7 +3715,15 @@ function createDeltaProcessor(fileKey) {
3674
3715
 
3675
3716
  // src/cli/cmd/i18n.ts
3676
3717
 
3677
- var i18n_default = new (0, _interactivecommander.Command)().command("i18n").description("Run Localization engine").helpOption("-h, --help", "Show help").option("--locale <locale>", "Locale to process", (val, prev) => prev ? [...prev, val] : [val]).option("--bucket <bucket>", "Bucket to process", (val, prev) => prev ? [...prev, val] : [val]).option(
3718
+ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").description("Run Localization engine").helpOption("-h, --help", "Show help").option(
3719
+ "--locale <locale>",
3720
+ "Locale to process",
3721
+ (val, prev) => prev ? [...prev, val] : [val]
3722
+ ).option(
3723
+ "--bucket <bucket>",
3724
+ "Bucket to process",
3725
+ (val, prev) => prev ? [...prev, val] : [val]
3726
+ ).option(
3678
3727
  "--key <key>",
3679
3728
  "Key to process. Process only a specific translation key, useful for debugging or updating a single entry"
3680
3729
  ).option(
@@ -3683,7 +3732,25 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3683
3732
  ).option(
3684
3733
  "--frozen",
3685
3734
  `Run in read-only mode - fails if any translations need updating, useful for CI/CD pipelines to detect missing translations`
3686
- ).option("--force", "Ignore lockfile and process all keys, useful for full re-translation").option("--verbose", "Show detailed output including intermediate processing data and API communication details").option("--interactive", "Enable interactive mode for reviewing and editing translations before they are applied").option("--api-key <api-key>", "Explicitly set the API key to use, override the default API key from settings").option("--debug", "Pause execution at start for debugging purposes, waits for user confirmation before proceeding").option("--strict", "Stop processing on first error instead of continuing with other locales/buckets").action(async function(options) {
3735
+ ).option(
3736
+ "--force",
3737
+ "Ignore lockfile and process all keys, useful for full re-translation"
3738
+ ).option(
3739
+ "--verbose",
3740
+ "Show detailed output including intermediate processing data and API communication details"
3741
+ ).option(
3742
+ "--interactive",
3743
+ "Enable interactive mode for reviewing and editing translations before they are applied"
3744
+ ).option(
3745
+ "--api-key <api-key>",
3746
+ "Explicitly set the API key to use, override the default API key from settings"
3747
+ ).option(
3748
+ "--debug",
3749
+ "Pause execution at start for debugging purposes, waits for user confirmation before proceeding"
3750
+ ).option(
3751
+ "--strict",
3752
+ "Stop processing on first error instead of continuing with other locales/buckets"
3753
+ ).action(async function(options) {
3687
3754
  updateGitignore();
3688
3755
  const ora = _ora2.default.call(void 0, );
3689
3756
  const flags = parseFlags(options);
@@ -3715,31 +3782,35 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3715
3782
  flags
3716
3783
  });
3717
3784
  let buckets = getBuckets(i18nConfig);
3718
- if (_optionalChain([flags, 'access', _147 => _147.bucket, 'optionalAccess', _148 => _148.length])) {
3719
- buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
3785
+ if (_optionalChain([flags, 'access', _148 => _148.bucket, 'optionalAccess', _149 => _149.length])) {
3786
+ buckets = buckets.filter(
3787
+ (bucket) => flags.bucket.includes(bucket.type)
3788
+ );
3720
3789
  }
3721
3790
  ora.succeed("Buckets retrieved");
3722
- if (_optionalChain([flags, 'access', _149 => _149.file, 'optionalAccess', _150 => _150.length])) {
3791
+ if (_optionalChain([flags, 'access', _150 => _150.file, 'optionalAccess', _151 => _151.length])) {
3723
3792
  buckets = buckets.map((bucket) => {
3724
3793
  const paths = bucket.paths.filter(
3725
- (path18) => flags.file.find((file) => _optionalChain([path18, 'access', _151 => _151.pathPattern, 'optionalAccess', _152 => _152.includes, 'call', _153 => _153(file)]))
3794
+ (path17) => flags.file.find((file) => _optionalChain([path17, 'access', _152 => _152.pathPattern, 'optionalAccess', _153 => _153.includes, 'call', _154 => _154(file)]))
3726
3795
  );
3727
3796
  return { ...bucket, paths };
3728
3797
  }).filter((bucket) => bucket.paths.length > 0);
3729
3798
  if (buckets.length === 0) {
3730
- ora.fail("No buckets found. All buckets were filtered out by --file option.");
3799
+ ora.fail(
3800
+ "No buckets found. All buckets were filtered out by --file option."
3801
+ );
3731
3802
  process.exit(1);
3732
3803
  } else {
3733
3804
  ora.info(`\x1B[36mProcessing only filtered buckets:\x1B[0m`);
3734
3805
  buckets.map((bucket) => {
3735
3806
  ora.info(` ${bucket.type}:`);
3736
- bucket.paths.forEach((path18) => {
3737
- ora.info(` - ${path18.pathPattern}`);
3807
+ bucket.paths.forEach((path17) => {
3808
+ ora.info(` - ${path17.pathPattern}`);
3738
3809
  });
3739
3810
  });
3740
3811
  }
3741
3812
  }
3742
- const targetLocales = _optionalChain([flags, 'access', _154 => _154.locale, 'optionalAccess', _155 => _155.length]) ? flags.locale : i18nConfig.locale.targets;
3813
+ const targetLocales = _optionalChain([flags, 'access', _155 => _155.locale, 'optionalAccess', _156 => _156.length]) ? flags.locale : i18nConfig.locale.targets;
3743
3814
  ora.start("Setting up localization cache...");
3744
3815
  const checkLockfileProcessor = createDeltaProcessor("");
3745
3816
  const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
@@ -3747,7 +3818,10 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3747
3818
  ora.start("Creating i18n.lock...");
3748
3819
  for (const bucket of buckets) {
3749
3820
  for (const bucketPath of bucket.paths) {
3750
- const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketPath.delimiter);
3821
+ const sourceLocale = __spec.resolveOverriddenLocale.call(void 0,
3822
+ i18nConfig.locale.source,
3823
+ bucketPath.delimiter
3824
+ );
3751
3825
  const bucketLoader = createBucketLoader(
3752
3826
  bucket.type,
3753
3827
  bucketPath.pathPattern,
@@ -3760,7 +3834,9 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3760
3834
  );
3761
3835
  bucketLoader.setDefaultLocale(sourceLocale);
3762
3836
  await bucketLoader.init();
3763
- const sourceData = await bucketLoader.pull(i18nConfig.locale.source);
3837
+ const sourceData = await bucketLoader.pull(
3838
+ i18nConfig.locale.source
3839
+ );
3764
3840
  const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
3765
3841
  const checksums = await deltaProcessor.createChecksums(sourceData);
3766
3842
  await deltaProcessor.saveChecksums(checksums);
@@ -3776,9 +3852,15 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3776
3852
  }
3777
3853
  ora.start("Validating localization state...");
3778
3854
  for (const bucketPath of bucket.paths) {
3779
- const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketPath.delimiter);
3855
+ const sourceLocale = __spec.resolveOverriddenLocale.call(void 0,
3856
+ i18nConfig.locale.source,
3857
+ bucketPath.delimiter
3858
+ );
3780
3859
  const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
3781
- const sourcePath = path15.join(process.cwd(), bucketPath.pathPattern.replace("[locale]", sourceLocale));
3860
+ const sourcePath = path14.join(
3861
+ process.cwd(),
3862
+ bucketPath.pathPattern.replace("[locale]", sourceLocale)
3863
+ );
3782
3864
  const sourceContent = tryReadFile(sourcePath, null);
3783
3865
  const sourceData = JSON.parse(sourceContent || "{}");
3784
3866
  const sourceFlattenedData = _flat.flatten.call(void 0, sourceData, {
@@ -3788,8 +3870,14 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3788
3870
  }
3789
3871
  });
3790
3872
  for (const _targetLocale of targetLocales) {
3791
- const targetLocale = __spec.resolveOverriddenLocale.call(void 0, _targetLocale, bucketPath.delimiter);
3792
- const targetPath = path15.join(process.cwd(), bucketPath.pathPattern.replace("[locale]", targetLocale));
3873
+ const targetLocale = __spec.resolveOverriddenLocale.call(void 0,
3874
+ _targetLocale,
3875
+ bucketPath.delimiter
3876
+ );
3877
+ const targetPath = path14.join(
3878
+ process.cwd(),
3879
+ bucketPath.pathPattern.replace("[locale]", targetLocale)
3880
+ );
3793
3881
  const targetContent = tryReadFile(targetPath, null);
3794
3882
  const targetData = JSON.parse(targetContent || "{}");
3795
3883
  const targetFlattenedData = _flat.flatten.call(void 0, targetData, {
@@ -3817,68 +3905,23 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3817
3905
  return decodeURIComponent(key);
3818
3906
  }
3819
3907
  });
3820
- await writeFile(targetPath, JSON.stringify(updatedTargetData, null, 2));
3821
- }
3822
- }
3823
- ora.succeed("Localization state check completed");
3824
- }
3825
- const cache = getNormalizedCache();
3826
- if (cache) {
3827
- console.log();
3828
- ora.succeed(`Cache loaded. Attempting recovery...`);
3829
- const cacheOra = _ora2.default.call(void 0, { indent: 2 });
3830
- for (const bucket of buckets) {
3831
- cacheOra.info(`Processing bucket: ${bucket.type}`);
3832
- for (const bucketPath of bucket.paths) {
3833
- const bucketOra = _ora2.default.call(void 0, { indent: 4 });
3834
- bucketOra.info(`Processing path: ${bucketPath.pathPattern}`);
3835
- const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketPath.delimiter);
3836
- const bucketLoader = createBucketLoader(
3837
- bucket.type,
3838
- bucketPath.pathPattern,
3839
- {
3840
- isCacheRestore: true,
3841
- defaultLocale: sourceLocale,
3842
- injectLocale: bucket.injectLocale
3843
- },
3844
- bucket.lockedKeys
3908
+ await writeFile(
3909
+ targetPath,
3910
+ JSON.stringify(updatedTargetData, null, 2)
3845
3911
  );
3846
- bucketLoader.setDefaultLocale(sourceLocale);
3847
- await bucketLoader.init();
3848
- const sourceData = await bucketLoader.pull(sourceLocale);
3849
- const cachedSourceData = {};
3850
- for (const targetLocale in cache) {
3851
- const targetData = await bucketLoader.pull(targetLocale);
3852
- for (const key in cache[targetLocale]) {
3853
- const { source, result } = cache[targetLocale][key];
3854
- if (sourceData[key] === source && targetData[key] !== result) {
3855
- targetData[key] = result;
3856
- cachedSourceData[key] = source;
3857
- }
3858
- }
3859
- await bucketLoader.push(targetLocale, targetData);
3860
- const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
3861
- const checksums = await deltaProcessor.createChecksums(cachedSourceData);
3862
- await deltaProcessor.saveChecksums(checksums);
3863
- bucketOra.succeed(
3864
- `[${sourceLocale} -> ${targetLocale}] Recovered ${Object.keys(cachedSourceData).length} entries from cache`
3865
- );
3866
- }
3867
3912
  }
3868
3913
  }
3869
- deleteCache();
3870
- if (flags.verbose) {
3871
- cacheOra.info("Cache file deleted.");
3872
- }
3873
- } else if (flags.verbose) {
3874
- ora.info("Cache file not found. Skipping recovery.");
3914
+ ora.succeed("Localization state check completed");
3875
3915
  }
3876
3916
  if (flags.frozen) {
3877
3917
  ora.start("Checking for lockfile updates...");
3878
3918
  let requiresUpdate = null;
3879
3919
  bucketLoop: for (const bucket of buckets) {
3880
3920
  for (const bucketPath of bucket.paths) {
3881
- const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketPath.delimiter);
3921
+ const sourceLocale = __spec.resolveOverriddenLocale.call(void 0,
3922
+ i18nConfig.locale.source,
3923
+ bucketPath.delimiter
3924
+ );
3882
3925
  const bucketLoader = createBucketLoader(
3883
3926
  bucket.type,
3884
3927
  bucketPath.pathPattern,
@@ -3892,9 +3935,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3892
3935
  );
3893
3936
  bucketLoader.setDefaultLocale(sourceLocale);
3894
3937
  await bucketLoader.init();
3895
- const { unlocalizable: sourceUnlocalizable, ...sourceData } = await bucketLoader.pull(
3896
- i18nConfig.locale.source
3897
- );
3938
+ const { unlocalizable: sourceUnlocalizable, ...sourceData } = await bucketLoader.pull(i18nConfig.locale.source);
3898
3939
  const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
3899
3940
  const sourceChecksums = await deltaProcessor.createChecksums(sourceData);
3900
3941
  const savedChecksums = await deltaProcessor.loadChecksums();
@@ -3907,11 +3948,23 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3907
3948
  break bucketLoop;
3908
3949
  }
3909
3950
  for (const _targetLocale of targetLocales) {
3910
- const targetLocale = __spec.resolveOverriddenLocale.call(void 0, _targetLocale, bucketPath.delimiter);
3951
+ const targetLocale = __spec.resolveOverriddenLocale.call(void 0,
3952
+ _targetLocale,
3953
+ bucketPath.delimiter
3954
+ );
3911
3955
  const { unlocalizable: targetUnlocalizable, ...targetData } = await bucketLoader.pull(targetLocale);
3912
- const missingKeys = _lodash2.default.difference(Object.keys(sourceData), Object.keys(targetData));
3913
- const extraKeys = _lodash2.default.difference(Object.keys(targetData), Object.keys(sourceData));
3914
- const unlocalizableDataDiff = !_lodash2.default.isEqual(sourceUnlocalizable, targetUnlocalizable);
3956
+ const missingKeys = _lodash2.default.difference(
3957
+ Object.keys(sourceData),
3958
+ Object.keys(targetData)
3959
+ );
3960
+ const extraKeys = _lodash2.default.difference(
3961
+ Object.keys(targetData),
3962
+ Object.keys(sourceData)
3963
+ );
3964
+ const unlocalizableDataDiff = !_lodash2.default.isEqual(
3965
+ sourceUnlocalizable,
3966
+ targetUnlocalizable
3967
+ );
3915
3968
  if (missingKeys.length > 0) {
3916
3969
  requiresUpdate = "missing";
3917
3970
  break bucketLoop;
@@ -3934,7 +3987,9 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3934
3987
  extra: "Target file has extra translations not present in the source file.",
3935
3988
  unlocalizable: "Unlocalizable data (such as booleans, dates, URLs, etc.) do not match."
3936
3989
  }[requiresUpdate];
3937
- ora.fail(`Localization data has changed; please update i18n.lock or run without --frozen.`);
3990
+ ora.fail(
3991
+ `Localization data has changed; please update i18n.lock or run without --frozen.`
3992
+ );
3938
3993
  ora.fail(` Details: ${message}`);
3939
3994
  process.exit(1);
3940
3995
  } else {
@@ -3946,8 +4001,13 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3946
4001
  console.log();
3947
4002
  ora.info(`Processing bucket: ${bucket.type}`);
3948
4003
  for (const bucketPath of bucket.paths) {
3949
- const bucketOra = _ora2.default.call(void 0, { indent: 2 }).info(`Processing path: ${bucketPath.pathPattern}`);
3950
- const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketPath.delimiter);
4004
+ const bucketOra = _ora2.default.call(void 0, { indent: 2 }).info(
4005
+ `Processing path: ${bucketPath.pathPattern}`
4006
+ );
4007
+ const sourceLocale = __spec.resolveOverriddenLocale.call(void 0,
4008
+ i18nConfig.locale.source,
4009
+ bucketPath.delimiter
4010
+ );
3951
4011
  const bucketLoader = createBucketLoader(
3952
4012
  bucket.type,
3953
4013
  bucketPath.pathPattern,
@@ -3962,21 +4022,33 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3962
4022
  await bucketLoader.init();
3963
4023
  let sourceData = await bucketLoader.pull(sourceLocale);
3964
4024
  for (const _targetLocale of targetLocales) {
3965
- const targetLocale = __spec.resolveOverriddenLocale.call(void 0, _targetLocale, bucketPath.delimiter);
4025
+ const targetLocale = __spec.resolveOverriddenLocale.call(void 0,
4026
+ _targetLocale,
4027
+ bucketPath.delimiter
4028
+ );
3966
4029
  try {
3967
- bucketOra.start(`[${sourceLocale} -> ${targetLocale}] (0%) Localization in progress...`);
4030
+ bucketOra.start(
4031
+ `[${sourceLocale} -> ${targetLocale}] (0%) Localization in progress...`
4032
+ );
3968
4033
  sourceData = await bucketLoader.pull(sourceLocale);
3969
4034
  const targetData = await bucketLoader.pull(targetLocale);
3970
- const deltaProcessor2 = createDeltaProcessor(bucketPath.pathPattern);
4035
+ const deltaProcessor2 = createDeltaProcessor(
4036
+ bucketPath.pathPattern
4037
+ );
3971
4038
  const checksums2 = await deltaProcessor2.loadChecksums();
3972
4039
  const delta = await deltaProcessor2.calculateDelta({
3973
4040
  sourceData,
3974
4041
  targetData,
3975
4042
  checksums: checksums2
3976
4043
  });
3977
- let processableData = _lodash2.default.chain(sourceData).entries().filter(([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!flags.force).fromPairs().value();
4044
+ let processableData = _lodash2.default.chain(sourceData).entries().filter(
4045
+ ([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!flags.force
4046
+ ).fromPairs().value();
3978
4047
  if (flags.key) {
3979
- processableData = _lodash2.default.pickBy(processableData, (_25, key) => key === flags.key);
4048
+ processableData = _lodash2.default.pickBy(
4049
+ processableData,
4050
+ (_25, key) => key === flags.key
4051
+ );
3980
4052
  }
3981
4053
  if (flags.verbose) {
3982
4054
  bucketOra.info(JSON.stringify(processableData, null, 2));
@@ -3988,7 +4060,11 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3988
4060
  apiKey: settings.auth.apiKey,
3989
4061
  apiUrl: settings.auth.apiUrl
3990
4062
  });
3991
- processPayload = withExponentialBackoff(processPayload, 3, 1e3);
4063
+ processPayload = withExponentialBackoff(
4064
+ processPayload,
4065
+ 3,
4066
+ 1e3
4067
+ );
3992
4068
  const processedTargetData = await processPayload(
3993
4069
  {
3994
4070
  sourceLocale,
@@ -3998,7 +4074,6 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3998
4074
  targetData
3999
4075
  },
4000
4076
  (progress, sourceChunk, processedChunk) => {
4001
- cacheChunk(targetLocale, sourceChunk, processedChunk);
4002
4077
  const progressLog = `[${sourceLocale} -> ${targetLocale}] [${Object.keys(processableData).length} entries] (${progress}%) AI localization in progress...`;
4003
4078
  if (flags.verbose) {
4004
4079
  bucketOra.info(progressLog);
@@ -4013,7 +4088,12 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
4013
4088
  if (flags.verbose) {
4014
4089
  bucketOra.info(JSON.stringify(processedTargetData, null, 2));
4015
4090
  }
4016
- let finalTargetData = _lodash2.default.merge({}, sourceData, targetData, processedTargetData);
4091
+ let finalTargetData = _lodash2.default.merge(
4092
+ {},
4093
+ sourceData,
4094
+ targetData,
4095
+ processedTargetData
4096
+ );
4017
4097
  if (flags.interactive) {
4018
4098
  bucketOra.stop();
4019
4099
  const reviewedData = await reviewChanges({
@@ -4025,17 +4105,25 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
4025
4105
  force: flags.force
4026
4106
  });
4027
4107
  finalTargetData = reviewedData;
4028
- bucketOra.start(`Applying changes to ${bucketPath} (${targetLocale})`);
4108
+ bucketOra.start(
4109
+ `Applying changes to ${bucketPath} (${targetLocale})`
4110
+ );
4029
4111
  }
4030
4112
  const finalDiffSize = _lodash2.default.chain(finalTargetData).omitBy((value, key) => value === targetData[key]).size().value();
4031
4113
  await bucketLoader.push(targetLocale, finalTargetData);
4032
4114
  if (finalDiffSize > 0 || flags.force) {
4033
- bucketOra.succeed(`[${sourceLocale} -> ${targetLocale}] Localization completed`);
4115
+ bucketOra.succeed(
4116
+ `[${sourceLocale} -> ${targetLocale}] Localization completed`
4117
+ );
4034
4118
  } else {
4035
- bucketOra.succeed(`[${sourceLocale} -> ${targetLocale}] Localization completed (no changes).`);
4119
+ bucketOra.succeed(
4120
+ `[${sourceLocale} -> ${targetLocale}] Localization completed (no changes).`
4121
+ );
4036
4122
  }
4037
4123
  } catch (_error) {
4038
- const error = new Error(`[${sourceLocale} -> ${targetLocale}] Localization failed: ${_error.message}`);
4124
+ const error = new Error(
4125
+ `[${sourceLocale} -> ${targetLocale}] Localization failed: ${_error.message}`
4126
+ );
4039
4127
  if (flags.strict) {
4040
4128
  throw error;
4041
4129
  } else {
@@ -4049,7 +4137,9 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
4049
4137
  await deltaProcessor.saveChecksums(checksums);
4050
4138
  }
4051
4139
  } catch (_error) {
4052
- const error = new Error(`Failed to process bucket ${bucket.type}: ${_error.message}`);
4140
+ const error = new Error(
4141
+ `Failed to process bucket ${bucket.type}: ${_error.message}`
4142
+ );
4053
4143
  if (flags.strict) {
4054
4144
  throw error;
4055
4145
  } else {
@@ -4061,10 +4151,6 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
4061
4151
  console.log();
4062
4152
  if (!hasErrors) {
4063
4153
  ora.succeed("Localization completed.");
4064
- deleteCache();
4065
- if (flags.verbose) {
4066
- ora.info("Cache file deleted.");
4067
- }
4068
4154
  trackEvent(auth.id, "cmd.i18n.success", {
4069
4155
  i18nConfig,
4070
4156
  flags
@@ -4127,12 +4213,14 @@ function validateParams(i18nConfig, flags) {
4127
4213
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
4128
4214
  docUrl: "bucketNotFound"
4129
4215
  });
4130
- } else if (_optionalChain([flags, 'access', _156 => _156.locale, 'optionalAccess', _157 => _157.some, 'call', _158 => _158((locale) => !i18nConfig.locale.targets.includes(locale))])) {
4216
+ } else if (_optionalChain([flags, 'access', _157 => _157.locale, 'optionalAccess', _158 => _158.some, 'call', _159 => _159((locale) => !i18nConfig.locale.targets.includes(locale))])) {
4131
4217
  throw new CLIError({
4132
4218
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
4133
4219
  docUrl: "localeTargetNotFound"
4134
4220
  });
4135
- } else if (_optionalChain([flags, 'access', _159 => _159.bucket, 'optionalAccess', _160 => _160.some, 'call', _161 => _161((bucket) => !i18nConfig.buckets[bucket])])) {
4221
+ } else if (_optionalChain([flags, 'access', _160 => _160.bucket, 'optionalAccess', _161 => _161.some, 'call', _162 => _162(
4222
+ (bucket) => !i18nConfig.buckets[bucket]
4223
+ )])) {
4136
4224
  throw new CLIError({
4137
4225
  message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
4138
4226
  docUrl: "bucketNotFound"
@@ -4164,8 +4252,10 @@ ${_chalk2.default.blue(args.pathPattern)} (${_chalk2.default.yellow(args.targetL
4164
4252
  if (line.startsWith("@")) return _chalk2.default.cyan(line);
4165
4253
  return line;
4166
4254
  }).join("\n");
4167
- console.log(`
4168
- Reviewing changes for ${_chalk2.default.blue(args.pathPattern)} (${_chalk2.default.yellow(args.targetLocale)}):`);
4255
+ console.log(
4256
+ `
4257
+ Reviewing changes for ${_chalk2.default.blue(args.pathPattern)} (${_chalk2.default.yellow(args.targetLocale)}):`
4258
+ );
4169
4259
  console.log(coloredDiff);
4170
4260
  const { action } = await _inquirer2.default.prompt([
4171
4261
  {
@@ -4201,9 +4291,19 @@ Reviewing changes for ${_chalk2.default.blue(args.pathPattern)} (${_chalk2.defau
4201
4291
  console.log(`
4202
4292
  Editing value for: ${_chalk2.default.cyan(key)}`);
4203
4293
  console.log(_chalk2.default.gray("Source text:"), _chalk2.default.blue(args.sourceData[key]));
4204
- console.log(_chalk2.default.gray("Current value:"), _chalk2.default.red(args.currentData[key] || "(empty)"));
4205
- console.log(_chalk2.default.gray("Suggested value:"), _chalk2.default.green(args.proposedData[key]));
4206
- console.log(_chalk2.default.gray("\nYour editor will open. Edit the text and save to continue."));
4294
+ console.log(
4295
+ _chalk2.default.gray("Current value:"),
4296
+ _chalk2.default.red(args.currentData[key] || "(empty)")
4297
+ );
4298
+ console.log(
4299
+ _chalk2.default.gray("Suggested value:"),
4300
+ _chalk2.default.green(args.proposedData[key])
4301
+ );
4302
+ console.log(
4303
+ _chalk2.default.gray(
4304
+ "\nYour editor will open. Edit the text and save to continue."
4305
+ )
4306
+ );
4207
4307
  console.log(_chalk2.default.gray("------------"));
4208
4308
  try {
4209
4309
  const editorContent = [
@@ -4224,11 +4324,15 @@ Editing value for: ${_chalk2.default.cyan(key)}`);
4224
4324
  if (customValue) {
4225
4325
  customData[key] = customValue;
4226
4326
  } else {
4227
- console.log(_chalk2.default.yellow("Empty value provided, keeping the current value."));
4327
+ console.log(
4328
+ _chalk2.default.yellow("Empty value provided, keeping the current value.")
4329
+ );
4228
4330
  customData[key] = args.currentData[key] || args.proposedData[key];
4229
4331
  }
4230
4332
  } catch (error) {
4231
- console.log(_chalk2.default.red("Error while editing, keeping the suggested value."));
4333
+ console.log(
4334
+ _chalk2.default.red("Error while editing, keeping the suggested value.")
4335
+ );
4232
4336
  customData[key] = args.proposedData[key];
4233
4337
  }
4234
4338
  }
@@ -4251,7 +4355,7 @@ function createLockfileHelper() {
4251
4355
  return {
4252
4356
  isLockfileExists: () => {
4253
4357
  const lockfilePath = _getLockfilePath();
4254
- return fs11.default.existsSync(lockfilePath);
4358
+ return fs10.default.existsSync(lockfilePath);
4255
4359
  },
4256
4360
  registerSourceData: (pathPattern, sourceData) => {
4257
4361
  const lockfile = _loadLockfile();
@@ -4278,20 +4382,20 @@ function createLockfileHelper() {
4278
4382
  };
4279
4383
  function _loadLockfile() {
4280
4384
  const lockfilePath = _getLockfilePath();
4281
- if (!fs11.default.existsSync(lockfilePath)) {
4385
+ if (!fs10.default.existsSync(lockfilePath)) {
4282
4386
  return LockfileSchema.parse({});
4283
4387
  }
4284
- const content = fs11.default.readFileSync(lockfilePath, "utf-8");
4388
+ const content = fs10.default.readFileSync(lockfilePath, "utf-8");
4285
4389
  const result = LockfileSchema.parse(_yaml2.default.parse(content));
4286
4390
  return result;
4287
4391
  }
4288
4392
  function _saveLockfile(lockfile) {
4289
4393
  const lockfilePath = _getLockfilePath();
4290
4394
  const content = _yaml2.default.stringify(lockfile);
4291
- fs11.default.writeFileSync(lockfilePath, content);
4395
+ fs10.default.writeFileSync(lockfilePath, content);
4292
4396
  }
4293
4397
  function _getLockfilePath() {
4294
- return path15.default.join(process.cwd(), "i18n.lock");
4398
+ return path14.default.join(process.cwd(), "i18n.lock");
4295
4399
  }
4296
4400
  }
4297
4401
  var LockfileSchema = _zod2.default.object({
@@ -4565,7 +4669,7 @@ var InBranchFlow = class extends IntegrationFlow {
4565
4669
  _child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
4566
4670
  _child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
4567
4671
  _child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
4568
- _optionalChain([this, 'access', _162 => _162.platformKit, 'optionalAccess', _163 => _163.gitConfig, 'call', _164 => _164()]);
4672
+ _optionalChain([this, 'access', _163 => _163.platformKit, 'optionalAccess', _164 => _164.gitConfig, 'call', _165 => _165()]);
4569
4673
  _child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
4570
4674
  _child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
4571
4675
  if (!processOwnCommits) {
@@ -4578,7 +4682,7 @@ var InBranchFlow = class extends IntegrationFlow {
4578
4682
  return false;
4579
4683
  }
4580
4684
  }
4581
- const workingDir = path15.default.resolve(process.cwd(), this.platformKit.config.workingDir);
4685
+ const workingDir = path14.default.resolve(process.cwd(), this.platformKit.config.workingDir);
4582
4686
  if (workingDir !== process.cwd()) {
4583
4687
  this.ora.info(`Changing to working directory: ${this.platformKit.config.workingDir}`);
4584
4688
  process.chdir(workingDir);
@@ -4590,7 +4694,7 @@ var InBranchFlow = class extends IntegrationFlow {
4590
4694
  // ../../action/src/flows/pull-request.ts
4591
4695
  var PullRequestFlow = class extends InBranchFlow {
4592
4696
  async preRun() {
4593
- const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _165 => _165()]);
4697
+ const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _166 => _166()]);
4594
4698
  if (!canContinue) {
4595
4699
  return false;
4596
4700
  }
@@ -4808,10 +4912,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
4808
4912
  repo_slug: this.platformConfig.repositoryName,
4809
4913
  state: "OPEN"
4810
4914
  }).then(({ data: { values } }) => {
4811
- return _optionalChain([values, 'optionalAccess', _166 => _166.find, 'call', _167 => _167(
4812
- ({ source, destination }) => _optionalChain([source, 'optionalAccess', _168 => _168.branch, 'optionalAccess', _169 => _169.name]) === branch && _optionalChain([destination, 'optionalAccess', _170 => _170.branch, 'optionalAccess', _171 => _171.name]) === this.platformConfig.baseBranchName
4915
+ return _optionalChain([values, 'optionalAccess', _167 => _167.find, 'call', _168 => _168(
4916
+ ({ source, destination }) => _optionalChain([source, 'optionalAccess', _169 => _169.branch, 'optionalAccess', _170 => _170.name]) === branch && _optionalChain([destination, 'optionalAccess', _171 => _171.branch, 'optionalAccess', _172 => _172.name]) === this.platformConfig.baseBranchName
4813
4917
  )]);
4814
- }).then((pr) => _optionalChain([pr, 'optionalAccess', _172 => _172.id]));
4918
+ }).then((pr) => _optionalChain([pr, 'optionalAccess', _173 => _173.id]));
4815
4919
  }
4816
4920
  async closePullRequest({ pullRequestNumber }) {
4817
4921
  await this.bb.repositories.declinePullRequest({
@@ -4897,7 +5001,7 @@ var GitHubPlatformKit = class extends PlatformKit {
4897
5001
  repo: this.platformConfig.repositoryName,
4898
5002
  base: this.platformConfig.baseBranchName,
4899
5003
  state: "open"
4900
- }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _173 => _173.number]));
5004
+ }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _174 => _174.number]));
4901
5005
  }
4902
5006
  async closePullRequest({ pullRequestNumber }) {
4903
5007
  await this.octokit.rest.pulls.update({
@@ -5010,7 +5114,7 @@ var GitlabPlatformKit = class extends PlatformKit {
5010
5114
  sourceBranch: branch,
5011
5115
  state: "opened"
5012
5116
  });
5013
- return _optionalChain([mergeRequests, 'access', _174 => _174[0], 'optionalAccess', _175 => _175.iid]);
5117
+ return _optionalChain([mergeRequests, 'access', _175 => _175[0], 'optionalAccess', _176 => _176.iid]);
5014
5118
  }
5015
5119
  async closePullRequest({ pullRequestNumber }) {
5016
5120
  await this.gitlab.MergeRequests.edit(this.platformConfig.gitlabProjectId, pullRequestNumber, {
@@ -5063,7 +5167,7 @@ async function main() {
5063
5167
  const { isPullRequestMode } = platformKit.config;
5064
5168
  ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
5065
5169
  const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
5066
- const canRun = await _optionalChain([flow, 'access', _176 => _176.preRun, 'optionalCall', _177 => _177()]);
5170
+ const canRun = await _optionalChain([flow, 'access', _177 => _177.preRun, 'optionalCall', _178 => _178()]);
5067
5171
  if (canRun === false) {
5068
5172
  return;
5069
5173
  }
@@ -5071,7 +5175,7 @@ async function main() {
5071
5175
  if (!hasChanges) {
5072
5176
  return;
5073
5177
  }
5074
- await _optionalChain([flow, 'access', _178 => _178.postRun, 'optionalCall', _179 => _179()]);
5178
+ await _optionalChain([flow, 'access', _179 => _179.postRun, 'optionalCall', _180 => _180()]);
5075
5179
  }
5076
5180
 
5077
5181
  // src/cli/cmd/ci.ts
@@ -5093,7 +5197,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
5093
5197
  }
5094
5198
  const env = {
5095
5199
  LINGODOTDEV_API_KEY: settings.auth.apiKey,
5096
- LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _180 => _180.pullRequest, 'optionalAccess', _181 => _181.toString, 'call', _182 => _182()]) || "false",
5200
+ LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _181 => _181.pullRequest, 'optionalAccess', _182 => _182.toString, 'call', _183 => _183()]) || "false",
5097
5201
  ...options.commitMessage && { LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage },
5098
5202
  ...options.pullRequestTitle && { LINGODOTDEV_PULL_REQUEST_TITLE: options.pullRequestTitle },
5099
5203
  ...options.workingDirectory && { LINGODOTDEV_WORKING_DIRECTORY: options.workingDirectory },
@@ -5144,13 +5248,13 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
5144
5248
  flags
5145
5249
  });
5146
5250
  let buckets = getBuckets(i18nConfig);
5147
- if (_optionalChain([flags, 'access', _183 => _183.bucket, 'optionalAccess', _184 => _184.length])) {
5251
+ if (_optionalChain([flags, 'access', _184 => _184.bucket, 'optionalAccess', _185 => _185.length])) {
5148
5252
  buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
5149
5253
  }
5150
5254
  ora.succeed("Buckets retrieved");
5151
- if (_optionalChain([flags, 'access', _185 => _185.file, 'optionalAccess', _186 => _186.length])) {
5255
+ if (_optionalChain([flags, 'access', _186 => _186.file, 'optionalAccess', _187 => _187.length])) {
5152
5256
  buckets = buckets.map((bucket) => {
5153
- const paths = bucket.paths.filter((path18) => flags.file.find((file) => _optionalChain([path18, 'access', _187 => _187.pathPattern, 'optionalAccess', _188 => _188.match, 'call', _189 => _189(file)])));
5257
+ const paths = bucket.paths.filter((path17) => flags.file.find((file) => _optionalChain([path17, 'access', _188 => _188.pathPattern, 'optionalAccess', _189 => _189.match, 'call', _190 => _190(file)])));
5154
5258
  return { ...bucket, paths };
5155
5259
  }).filter((bucket) => bucket.paths.length > 0);
5156
5260
  if (buckets.length === 0) {
@@ -5160,13 +5264,13 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
5160
5264
  ora.info(`\x1B[36mProcessing only filtered buckets:\x1B[0m`);
5161
5265
  buckets.map((bucket) => {
5162
5266
  ora.info(` ${bucket.type}:`);
5163
- bucket.paths.forEach((path18) => {
5164
- ora.info(` - ${path18.pathPattern}`);
5267
+ bucket.paths.forEach((path17) => {
5268
+ ora.info(` - ${path17.pathPattern}`);
5165
5269
  });
5166
5270
  });
5167
5271
  }
5168
5272
  }
5169
- const targetLocales = _optionalChain([flags, 'access', _190 => _190.locale, 'optionalAccess', _191 => _191.length]) ? flags.locale : i18nConfig.locale.targets;
5273
+ const targetLocales = _optionalChain([flags, 'access', _191 => _191.locale, 'optionalAccess', _192 => _192.length]) ? flags.locale : i18nConfig.locale.targets;
5170
5274
  let totalSourceKeyCount = 0;
5171
5275
  let uniqueKeysToTranslate = 0;
5172
5276
  let totalExistingTranslations = 0;
@@ -5390,10 +5494,10 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
5390
5494
  if (flags.confirm && Object.keys(fileStats).length > 0) {
5391
5495
  console.log(_chalk2.default.bold(`
5392
5496
  \u{1F4D1} BREAKDOWN BY FILE:`));
5393
- Object.entries(fileStats).sort((a, b) => b[1].wordCount - a[1].wordCount).forEach(([path18, stats]) => {
5497
+ Object.entries(fileStats).sort((a, b) => b[1].wordCount - a[1].wordCount).forEach(([path17, stats]) => {
5394
5498
  if (stats.sourceKeys === 0) return;
5395
5499
  console.log(_chalk2.default.bold(`
5396
- \u2022 ${path18}:`));
5500
+ \u2022 ${path17}:`));
5397
5501
  console.log(` ${stats.sourceKeys} source keys, ~${stats.wordCount.toLocaleString()} source words`);
5398
5502
  const fileTable = new (0, _clitable32.default)({
5399
5503
  head: ["Language", "Status", "Details"],
@@ -5507,12 +5611,12 @@ function validateParams2(i18nConfig, flags) {
5507
5611
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
5508
5612
  docUrl: "bucketNotFound"
5509
5613
  });
5510
- } else if (_optionalChain([flags, 'access', _192 => _192.locale, 'optionalAccess', _193 => _193.some, 'call', _194 => _194((locale) => !i18nConfig.locale.targets.includes(locale))])) {
5614
+ } else if (_optionalChain([flags, 'access', _193 => _193.locale, 'optionalAccess', _194 => _194.some, 'call', _195 => _195((locale) => !i18nConfig.locale.targets.includes(locale))])) {
5511
5615
  throw new CLIError({
5512
5616
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
5513
5617
  docUrl: "localeTargetNotFound"
5514
5618
  });
5515
- } else if (_optionalChain([flags, 'access', _195 => _195.bucket, 'optionalAccess', _196 => _196.some, 'call', _197 => _197((bucket) => !i18nConfig.buckets[bucket])])) {
5619
+ } else if (_optionalChain([flags, 'access', _196 => _196.bucket, 'optionalAccess', _197 => _197.some, 'call', _198 => _198((bucket) => !i18nConfig.buckets[bucket])])) {
5516
5620
  throw new CLIError({
5517
5621
  message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
5518
5622
  docUrl: "bucketNotFound"
@@ -5523,7 +5627,7 @@ function validateParams2(i18nConfig, flags) {
5523
5627
  // package.json
5524
5628
  var package_default = {
5525
5629
  name: "lingo.dev",
5526
- version: "0.86.0",
5630
+ version: "0.87.1",
5527
5631
  description: "Lingo.dev CLI",
5528
5632
  private: false,
5529
5633
  publishConfig: {
@@ -5597,6 +5701,7 @@ var package_default = {
5597
5701
  "csv-parse": "^5.6.0",
5598
5702
  "csv-stringify": "^6.5.2",
5599
5703
  "date-fns": "^4.1.0",
5704
+ dedent: "^1.5.3",
5600
5705
  diff: "^7.0.0",
5601
5706
  dotenv: "^16.4.7",
5602
5707
  express: "^4.21.2",
@@ -5616,6 +5721,9 @@ var package_default = {
5616
5721
  jsonrepair: "^3.11.2",
5617
5722
  lodash: "^4.17.21",
5618
5723
  marked: "^15.0.6",
5724
+ "mdast-util-from-markdown": "^2.0.2",
5725
+ "mdast-util-gfm": "^3.1.0",
5726
+ "micromark-extension-gfm": "^3.0.0",
5619
5727
  "node-webvtt": "^1.9.4",
5620
5728
  "object-hash": "^3.0.0",
5621
5729
  octokit: "^4.0.2",
@@ -5626,14 +5734,18 @@ var package_default = {
5626
5734
  plist: "^3.1.0",
5627
5735
  "posthog-node": "^4.11.2",
5628
5736
  prettier: "^3.4.2",
5737
+ "rehype-stringify": "^10.0.1",
5738
+ "remark-disable-tokenizers": "^1.1.1",
5629
5739
  "remark-frontmatter": "^5.0.0",
5630
5740
  "remark-gfm": "^4.0.1",
5631
5741
  "remark-mdx": "^3.1.0",
5632
5742
  "remark-mdx-frontmatter": "^5.1.0",
5633
5743
  "remark-parse": "^11.0.0",
5744
+ "remark-rehype": "^11.1.2",
5634
5745
  "remark-stringify": "^11.0.0",
5635
5746
  "srt-parser-2": "^1.2.3",
5636
5747
  unified: "^11.0.5",
5748
+ "unist-util-visit": "^5.0.0",
5637
5749
  vfile: "^6.0.3",
5638
5750
  xliff: "^6.2.1",
5639
5751
  xml2js: "^0.6.2",