lingo.dev 0.87.0 → 0.87.2

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();
@@ -26,9 +26,9 @@ function getSettings(explicitApiKey) {
26
26
  _envVarsInfo();
27
27
  return {
28
28
  auth: {
29
- apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access', _25 => _25.auth, 'optionalAccess', _26 => _26.apiKey]) || defaults.auth.apiKey,
30
- apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _27 => _27.auth, 'optionalAccess', _28 => _28.apiUrl]) || defaults.auth.apiUrl,
31
- webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _29 => _29.auth, 'optionalAccess', _30 => _30.webUrl]) || defaults.auth.webUrl
29
+ apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access', _27 => _27.auth, 'optionalAccess', _28 => _28.apiKey]) || defaults.auth.apiKey,
30
+ apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _29 => _29.auth, 'optionalAccess', _30 => _30.apiUrl]) || defaults.auth.apiUrl,
31
+ webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _31 => _31.auth, 'optionalAccess', _32 => _32.webUrl]) || defaults.auth.webUrl
32
32
  }
33
33
  };
34
34
  }
@@ -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() {
@@ -99,7 +99,7 @@ Please use LINGODOTDEV_API_KEY instead.
99
99
  function _envVarsInfo() {
100
100
  const env = _loadEnv();
101
101
  const systemFile = _loadSystemFile();
102
- if (env.LINGODOTDEV_API_KEY && _optionalChain([systemFile, 'access', _31 => _31.auth, 'optionalAccess', _32 => _32.apiKey])) {
102
+ if (env.LINGODOTDEV_API_KEY && _optionalChain([systemFile, 'access', _33 => _33.auth, 'optionalAccess', _34 => _34.apiKey])) {
103
103
  console.info(
104
104
  "\x1B[36m%s\x1B[0m",
105
105
  `\u2139\uFE0F Using LINGODOTDEV_API_KEY env var instead of credentials from login flow (saved in .lingodotdevrc)`
@@ -154,7 +154,7 @@ function createAuthenticator(params) {
154
154
  });
155
155
  if (res.ok) {
156
156
  const payload = await res.json();
157
- if (!_optionalChain([payload, 'optionalAccess', _33 => _33.email])) {
157
+ if (!_optionalChain([payload, 'optionalAccess', _35 => _35.email])) {
158
158
  return null;
159
159
  }
160
160
  return {
@@ -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
  }
@@ -774,7 +774,7 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
774
774
  });
775
775
  const auth2 = await newAuthenticator.whoami();
776
776
  if (auth2) {
777
- _ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _34 => _34.email])}`);
777
+ _ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _36 => _36.email])}`);
778
778
  } else {
779
779
  _ora2.default.call(void 0, ).fail("Authentication failed.");
780
780
  }
@@ -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
  }
@@ -854,7 +854,7 @@ var locale_default = new (0, _interactivecommander.Command)().command("locale").
854
854
  function getBuckets(i18nConfig) {
855
855
  const result = Object.entries(i18nConfig.buckets).map(([bucketType, bucketEntry]) => {
856
856
  const includeItems = bucketEntry.include.map((item) => resolveBucketItem(item));
857
- const excludeItems = _optionalChain([bucketEntry, 'access', _35 => _35.exclude, 'optionalAccess', _36 => _36.map, 'call', _37 => _37((item) => resolveBucketItem(item))]);
857
+ const excludeItems = _optionalChain([bucketEntry, 'access', _37 => _37.exclude, 'optionalAccess', _38 => _38.map, 'call', _39 => _39((item) => resolveBucketItem(item))]);
858
858
  const config = {
859
859
  type: bucketType,
860
860
  paths: extractPathPatterns(i18nConfig.locale.source, includeItems, excludeItems)
@@ -878,7 +878,7 @@ function extractPathPatterns(sourceLocale, include, exclude) {
878
878
  })
879
879
  )
880
880
  );
881
- const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _38 => _38.flatMap, 'call', _39 => _39(
881
+ const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _40 => _40.flatMap, 'call', _41 => _41(
882
882
  (pattern) => expandPlaceholderedGlob(pattern.path, __spec.resolveOverriddenLocale.call(void 0, sourceLocale, pattern.delimiter)).map(
883
883
  (pathPattern) => ({
884
884
  pathPattern,
@@ -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
  }
@@ -1007,12 +1007,12 @@ function composeLoaders(...loaders) {
1007
1007
  return {
1008
1008
  init: async () => {
1009
1009
  for (const loader of loaders) {
1010
- await _optionalChain([loader, 'access', _40 => _40.init, 'optionalCall', _41 => _41()]);
1010
+ await _optionalChain([loader, 'access', _42 => _42.init, 'optionalCall', _43 => _43()]);
1011
1011
  }
1012
1012
  },
1013
1013
  setDefaultLocale(locale) {
1014
1014
  for (const loader of loaders) {
1015
- _optionalChain([loader, 'access', _42 => _42.setDefaultLocale, 'optionalCall', _43 => _43(locale)]);
1015
+ _optionalChain([loader, 'access', _44 => _44.setDefaultLocale, 'optionalCall', _45 => _45(locale)]);
1016
1016
  }
1017
1017
  return this;
1018
1018
  },
@@ -1045,7 +1045,7 @@ function createLoader(lDefinition) {
1045
1045
  if (state.initCtx) {
1046
1046
  return state.initCtx;
1047
1047
  }
1048
- state.initCtx = await _optionalChain([lDefinition, 'access', _44 => _44.init, 'optionalCall', _45 => _45()]);
1048
+ state.initCtx = await _optionalChain([lDefinition, 'access', _46 => _46.init, 'optionalCall', _47 => _47()]);
1049
1049
  return state.initCtx;
1050
1050
  },
1051
1051
  setDefaultLocale(locale) {
@@ -1144,7 +1144,7 @@ function createNormalizeLoader() {
1144
1144
  return normalized;
1145
1145
  },
1146
1146
  push: async (locale, data, originalInput) => {
1147
- const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _46 => _46.keysMap]), () => ( {}));
1147
+ const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _48 => _48.keysMap]), () => ( {}));
1148
1148
  const input2 = mapDenormalizedKeys(data, keysMap);
1149
1149
  const denormalized = _flat.unflatten.call(void 0, input2, {
1150
1150
  delimiter: "/",
@@ -1218,10 +1218,10 @@ function createTextFileLoader(pathPattern) {
1218
1218
  const trimmedResult = result.trim();
1219
1219
  return trimmedResult;
1220
1220
  },
1221
- async push(locale, data, _24, originalLocale) {
1221
+ async push(locale, data, _26, originalLocale) {
1222
1222
  const draftPath = pathPattern.replaceAll("[locale]", locale);
1223
- const finalPath = path15.default.resolve(draftPath);
1224
- const dirPath = path15.default.dirname(finalPath);
1223
+ const finalPath = path14.default.resolve(draftPath);
1224
+ const dirPath = path14.default.dirname(finalPath);
1225
1225
  await _promises4.default.mkdir(dirPath, { recursive: true });
1226
1226
  const trimmedPayload = data.trim();
1227
1227
  const trailingNewLine = await getTrailingNewLine(pathPattern, locale, originalLocale);
@@ -1235,7 +1235,7 @@ function createTextFileLoader(pathPattern) {
1235
1235
  }
1236
1236
  async function readFileForLocale(pathPattern, locale) {
1237
1237
  const draftPath = pathPattern.replaceAll("[locale]", locale);
1238
- const finalPath = path15.default.resolve(draftPath);
1238
+ const finalPath = path14.default.resolve(draftPath);
1239
1239
  const exists = await _promises4.default.access(finalPath).then(() => true).catch(() => false);
1240
1240
  if (!exists) {
1241
1241
  return "";
@@ -1247,8 +1247,8 @@ async function getTrailingNewLine(pathPattern, locale, originalLocale) {
1247
1247
  if (!templateData) {
1248
1248
  templateData = await readFileForLocale(pathPattern, originalLocale);
1249
1249
  }
1250
- if (_optionalChain([templateData, 'optionalAccess', _47 => _47.match, 'call', _48 => _48(/[\r\n]$/)])) {
1251
- const ending = _optionalChain([templateData, 'optionalAccess', _49 => _49.includes, 'call', _50 => _50("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _51 => _51.includes, 'call', _52 => _52("\r")]) ? "\r" : "\n";
1250
+ if (_optionalChain([templateData, 'optionalAccess', _49 => _49.match, 'call', _50 => _50(/[\r\n]$/)])) {
1251
+ const ending = _optionalChain([templateData, 'optionalAccess', _51 => _51.includes, 'call', _52 => _52("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _53 => _53.includes, 'call', _54 => _54("\r")]) ? "\r" : "\n";
1252
1252
  return ending;
1253
1253
  }
1254
1254
  return "";
@@ -1502,7 +1502,7 @@ function createHtmlLoader() {
1502
1502
  break;
1503
1503
  }
1504
1504
  const siblings = Array.from(parent.childNodes).filter(
1505
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _53 => _53.textContent, 'optionalAccess', _54 => _54.trim, 'call', _55 => _55()])
1505
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _55 => _55.textContent, 'optionalAccess', _56 => _56.trim, 'call', _57 => _57()])
1506
1506
  );
1507
1507
  const index = siblings.indexOf(current);
1508
1508
  if (index !== -1) {
@@ -1537,11 +1537,11 @@ function createHtmlLoader() {
1537
1537
  result[getPath(element, attr)] = value;
1538
1538
  }
1539
1539
  });
1540
- Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _56 => _56.textContent, 'optionalAccess', _57 => _57.trim, 'call', _58 => _58()])).forEach(processNode);
1540
+ Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _58 => _58.textContent, 'optionalAccess', _59 => _59.trim, 'call', _60 => _60()])).forEach(processNode);
1541
1541
  }
1542
1542
  };
1543
- Array.from(document.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _59 => _59.textContent, 'optionalAccess', _60 => _60.trim, 'call', _61 => _61()])).forEach(processNode);
1544
- Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _62 => _62.textContent, 'optionalAccess', _63 => _63.trim, 'call', _64 => _64()])).forEach(processNode);
1543
+ Array.from(document.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _61 => _61.textContent, 'optionalAccess', _62 => _62.trim, 'call', _63 => _63()])).forEach(processNode);
1544
+ Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _64 => _64.textContent, 'optionalAccess', _65 => _65.trim, 'call', _66 => _66()])).forEach(processNode);
1545
1545
  return result;
1546
1546
  },
1547
1547
  async push(locale, data, originalInput) {
@@ -1554,16 +1554,16 @@ function createHtmlLoader() {
1554
1554
  const bDepth = b.split("/").length;
1555
1555
  return aDepth - bDepth;
1556
1556
  });
1557
- paths.forEach((path18) => {
1558
- const value = data[path18];
1559
- const [nodePath, attribute] = path18.split("#");
1557
+ paths.forEach((path17) => {
1558
+ const value = data[path17];
1559
+ const [nodePath, attribute] = path17.split("#");
1560
1560
  const [rootTag, ...indices] = nodePath.split("/");
1561
1561
  let parent = rootTag === "head" ? document.head : document.body;
1562
1562
  let current = parent;
1563
1563
  for (let i = 0; i < indices.length; i++) {
1564
1564
  const index = parseInt(indices[i]);
1565
1565
  const siblings = Array.from(parent.childNodes).filter(
1566
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _65 => _65.textContent, 'optionalAccess', _66 => _66.trim, 'call', _67 => _67()])
1566
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _67 => _67.textContent, 'optionalAccess', _68 => _68.trim, 'call', _69 => _69()])
1567
1567
  );
1568
1568
  if (index >= siblings.length) {
1569
1569
  if (i === indices.length - 1) {
@@ -1614,7 +1614,7 @@ function createMarkdownLoader() {
1614
1614
  yaml: yamlEngine
1615
1615
  }
1616
1616
  });
1617
- const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _68 => _68.trim, 'call', _69 => _69()]), () => ( ""))).filter(Boolean);
1617
+ const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _70 => _70.trim, 'call', _71 => _71()]), () => ( ""))).filter(Boolean);
1618
1618
  return {
1619
1619
  ...Object.fromEntries(
1620
1620
  sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
@@ -1626,7 +1626,7 @@ function createMarkdownLoader() {
1626
1626
  const frontmatter = Object.fromEntries(
1627
1627
  Object.entries(data).filter(([key]) => key.startsWith(FM_ATTR_PREFIX)).map(([key, value]) => [key.replace(FM_ATTR_PREFIX, ""), value])
1628
1628
  );
1629
- let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _70 => _70.trim, 'call', _71 => _71()]), () => ( ""))).filter(Boolean).join("\n\n");
1629
+ let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _72 => _72.trim, 'call', _73 => _73()]), () => ( ""))).filter(Boolean).join("\n\n");
1630
1630
  if (Object.keys(frontmatter).length > 0) {
1631
1631
  content = `
1632
1632
  ${content}`;
@@ -1659,7 +1659,7 @@ function createPropertiesLoader() {
1659
1659
  return result;
1660
1660
  },
1661
1661
  async push(locale, payload) {
1662
- const result = Object.entries(payload).filter(([_24, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
1662
+ const result = Object.entries(payload).filter(([_26, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
1663
1663
  return result;
1664
1664
  }
1665
1665
  });
@@ -1670,7 +1670,7 @@ function isSkippableLine(line) {
1670
1670
  function parsePropertyLine(line) {
1671
1671
  const [key, ...valueParts] = line.split("=");
1672
1672
  return {
1673
- key: _optionalChain([key, 'optionalAccess', _72 => _72.trim, 'call', _73 => _73()]) || "",
1673
+ key: _optionalChain([key, 'optionalAccess', _74 => _74.trim, 'call', _75 => _75()]) || "",
1674
1674
  value: valueParts.join("=").trim()
1675
1675
  };
1676
1676
  }
@@ -1756,7 +1756,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
1756
1756
  if (rootTranslationEntity.shouldTranslate === false) {
1757
1757
  continue;
1758
1758
  }
1759
- const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _74 => _74.localizations, 'optionalAccess', _75 => _75[locale]]);
1759
+ const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _76 => _76.localizations, 'optionalAccess', _77 => _77[locale]]);
1760
1760
  if (langTranslationEntity) {
1761
1761
  if ("stringUnit" in langTranslationEntity) {
1762
1762
  resultData[translationKey] = langTranslationEntity.stringUnit.value;
@@ -1765,7 +1765,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
1765
1765
  resultData[translationKey] = {};
1766
1766
  const pluralForms = langTranslationEntity.variations.plural;
1767
1767
  for (const form in pluralForms) {
1768
- if (_optionalChain([pluralForms, 'access', _76 => _76[form], 'optionalAccess', _77 => _77.stringUnit, 'optionalAccess', _78 => _78.value])) {
1768
+ if (_optionalChain([pluralForms, 'access', _78 => _78[form], 'optionalAccess', _79 => _79.stringUnit, 'optionalAccess', _80 => _80.value])) {
1769
1769
  resultData[translationKey][form] = pluralForms[form].stringUnit.value;
1770
1770
  }
1771
1771
  }
@@ -1788,7 +1788,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
1788
1788
  const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
1789
1789
  if (typeof value === "string") {
1790
1790
  langDataToMerge.strings[key] = {
1791
- extractionState: _optionalChain([originalInput, 'optionalAccess', _79 => _79.strings, 'optionalAccess', _80 => _80[key], 'optionalAccess', _81 => _81.extractionState]),
1791
+ extractionState: _optionalChain([originalInput, 'optionalAccess', _81 => _81.strings, 'optionalAccess', _82 => _82[key], 'optionalAccess', _83 => _83.extractionState]),
1792
1792
  localizations: {
1793
1793
  [locale]: {
1794
1794
  stringUnit: {
@@ -1836,21 +1836,28 @@ function createXcodeXcstringsLoader(defaultLocale) {
1836
1836
 
1837
1837
  var _prettier = require('prettier'); var _prettier2 = _interopRequireDefault(_prettier);
1838
1838
  function createPrettierLoader(options) {
1839
+ const stage = options.stage || "both";
1839
1840
  return createLoader({
1840
1841
  async pull(locale, data) {
1842
+ if (!["pull", "both"].includes(stage)) {
1843
+ return data;
1844
+ }
1841
1845
  const draftPath = options.bucketPathPattern.replaceAll(
1842
1846
  "[locale]",
1843
1847
  locale
1844
1848
  );
1845
- const finalPath = path15.default.resolve(draftPath);
1849
+ const finalPath = path14.default.resolve(draftPath);
1846
1850
  return await formatDataWithPrettier(data, finalPath, options);
1847
1851
  },
1848
1852
  async push(locale, data) {
1853
+ if (!["push", "both"].includes(stage)) {
1854
+ return data;
1855
+ }
1849
1856
  const draftPath = options.bucketPathPattern.replaceAll(
1850
1857
  "[locale]",
1851
1858
  locale
1852
1859
  );
1853
- const finalPath = path15.default.resolve(draftPath);
1860
+ const finalPath = path14.default.resolve(draftPath);
1854
1861
  return await formatDataWithPrettier(data, finalPath, options);
1855
1862
  }
1856
1863
  });
@@ -1919,10 +1926,10 @@ function createUnlocalizableLoader(isCacheRestore = false, returnUnlocalizedKeys
1919
1926
  }
1920
1927
  }
1921
1928
  return false;
1922
- }).map(([key, _24]) => key);
1923
- const result = _lodash2.default.omitBy(input2, (_24, key) => passthroughKeys.includes(key));
1929
+ }).map(([key, _26]) => key);
1930
+ const result = _lodash2.default.omitBy(input2, (_26, key) => passthroughKeys.includes(key));
1924
1931
  if (returnUnlocalizedKeys) {
1925
- result.unlocalizable = _lodash2.default.omitBy(input2, (_24, key) => !passthroughKeys.includes(key));
1932
+ result.unlocalizable = _lodash2.default.omitBy(input2, (_26, key) => !passthroughKeys.includes(key));
1926
1933
  }
1927
1934
  return result;
1928
1935
  },
@@ -1961,7 +1968,7 @@ function createPoDataLoader(params) {
1961
1968
  Object.entries(entries).forEach(([msgid, entry]) => {
1962
1969
  if (msgid && entry.msgid) {
1963
1970
  const context = entry.msgctxt || "";
1964
- const fullEntry = _optionalChain([parsedPo, 'access', _82 => _82.translations, 'access', _83 => _83[context], 'optionalAccess', _84 => _84[msgid]]);
1971
+ const fullEntry = _optionalChain([parsedPo, 'access', _84 => _84.translations, 'access', _85 => _85[context], 'optionalAccess', _86 => _86[msgid]]);
1965
1972
  if (fullEntry) {
1966
1973
  result[msgid] = fullEntry;
1967
1974
  }
@@ -1971,8 +1978,8 @@ function createPoDataLoader(params) {
1971
1978
  return result;
1972
1979
  },
1973
1980
  async push(locale, data, originalInput, originalLocale, pullInput) {
1974
- const currentSections = _optionalChain([pullInput, 'optionalAccess', _85 => _85.split, 'call', _86 => _86("\n\n"), 'access', _87 => _87.filter, 'call', _88 => _88(Boolean)]) || [];
1975
- const originalSections = _optionalChain([originalInput, 'optionalAccess', _89 => _89.split, 'call', _90 => _90("\n\n"), 'access', _91 => _91.filter, 'call', _92 => _92(Boolean)]) || [];
1981
+ const currentSections = _optionalChain([pullInput, 'optionalAccess', _87 => _87.split, 'call', _88 => _88("\n\n"), 'access', _89 => _89.filter, 'call', _90 => _90(Boolean)]) || [];
1982
+ const originalSections = _optionalChain([originalInput, 'optionalAccess', _91 => _91.split, 'call', _92 => _92("\n\n"), 'access', _93 => _93.filter, 'call', _94 => _94(Boolean)]) || [];
1976
1983
  const result = originalSections.map((section) => {
1977
1984
  const sectionPo = _gettextparser2.default.po.parse(section);
1978
1985
  const contextKey = _lodash2.default.keys(sectionPo.translations)[0];
@@ -2026,7 +2033,7 @@ function createPoContentLoader() {
2026
2033
  entry.msgid,
2027
2034
  {
2028
2035
  ...entry,
2029
- msgstr: [_optionalChain([data, 'access', _93 => _93[entry.msgid], 'optionalAccess', _94 => _94.singular]), _optionalChain([data, 'access', _95 => _95[entry.msgid], 'optionalAccess', _96 => _96.plural]) || null].filter(Boolean)
2036
+ msgstr: [_optionalChain([data, 'access', _95 => _95[entry.msgid], 'optionalAccess', _96 => _96.singular]), _optionalChain([data, 'access', _97 => _97[entry.msgid], 'optionalAccess', _98 => _98.plural]) || null].filter(Boolean)
2030
2037
  }
2031
2038
  ]).fromPairs().value();
2032
2039
  return result;
@@ -2092,10 +2099,10 @@ function createXmlLoader() {
2092
2099
  // src/cli/loaders/srt.ts
2093
2100
  var _srtparser2 = require('srt-parser-2'); var _srtparser22 = _interopRequireDefault(_srtparser2);
2094
2101
  function createSrtLoader() {
2095
- const parser2 = new (0, _srtparser22.default)();
2102
+ const parser = new (0, _srtparser22.default)();
2096
2103
  return createLoader({
2097
2104
  async pull(locale, input2) {
2098
- const parsed = parser2.fromSrt(input2) || [];
2105
+ const parsed = parser.fromSrt(input2) || [];
2099
2106
  const result = {};
2100
2107
  parsed.forEach((entry) => {
2101
2108
  const key = `${entry.id}#${entry.startTime}-${entry.endTime}`;
@@ -2116,7 +2123,7 @@ function createSrtLoader() {
2116
2123
  text
2117
2124
  };
2118
2125
  });
2119
- const srtContent = parser2.toSrt(output).trim().replace(/\r?\n/g, "\n");
2126
+ const srtContent = parser.toSrt(output).trim().replace(/\r?\n/g, "\n");
2120
2127
  return srtContent;
2121
2128
  }
2122
2129
  });
@@ -2272,7 +2279,7 @@ function createDatoClient(params) {
2272
2279
  only_valid: "true",
2273
2280
  ids: !records.length ? void 0 : records.join(",")
2274
2281
  }
2275
- }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _97 => _97.response, 'optionalAccess', _98 => _98.body, 'optionalAccess', _99 => _99.data, 'optionalAccess', _100 => _100[0]]) || error));
2282
+ }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _99 => _99.response, 'optionalAccess', _100 => _100.body, 'optionalAccess', _101 => _101.data, 'optionalAccess', _102 => _102[0]]) || error));
2276
2283
  },
2277
2284
  findRecordsForModel: async (modelId, records) => {
2278
2285
  try {
@@ -2282,9 +2289,9 @@ function createDatoClient(params) {
2282
2289
  filter: {
2283
2290
  type: modelId,
2284
2291
  only_valid: "true",
2285
- ids: !_optionalChain([records, 'optionalAccess', _101 => _101.length]) ? void 0 : records.join(",")
2292
+ ids: !_optionalChain([records, 'optionalAccess', _103 => _103.length]) ? void 0 : records.join(",")
2286
2293
  }
2287
- }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _102 => _102.response, 'optionalAccess', _103 => _103.body, 'optionalAccess', _104 => _104.data, 'optionalAccess', _105 => _105[0]]) || error));
2294
+ }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _104 => _104.response, 'optionalAccess', _105 => _105.body, 'optionalAccess', _106 => _106.data, 'optionalAccess', _107 => _107[0]]) || error));
2288
2295
  return result;
2289
2296
  } catch (_error) {
2290
2297
  throw new Error(
@@ -2298,9 +2305,9 @@ function createDatoClient(params) {
2298
2305
  },
2299
2306
  updateRecord: async (id, payload) => {
2300
2307
  try {
2301
- await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _106 => _106.response, 'optionalAccess', _107 => _107.body, 'optionalAccess', _108 => _108.data, 'optionalAccess', _109 => _109[0]]) || error));
2308
+ await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _108 => _108.response, 'optionalAccess', _109 => _109.body, 'optionalAccess', _110 => _110.data, 'optionalAccess', _111 => _111[0]]) || error));
2302
2309
  } catch (_error) {
2303
- if (_optionalChain([_error, 'optionalAccess', _110 => _110.attributes, 'optionalAccess', _111 => _111.details, 'optionalAccess', _112 => _112.message])) {
2310
+ if (_optionalChain([_error, 'optionalAccess', _112 => _112.attributes, 'optionalAccess', _113 => _113.details, 'optionalAccess', _114 => _114.message])) {
2304
2311
  throw new Error(
2305
2312
  [
2306
2313
  `${_error.attributes.details.message}`,
@@ -2321,9 +2328,9 @@ function createDatoClient(params) {
2321
2328
  },
2322
2329
  enableFieldLocalization: async (args) => {
2323
2330
  try {
2324
- await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _113 => _113.response, 'optionalAccess', _114 => _114.body, 'optionalAccess', _115 => _115.data, 'optionalAccess', _116 => _116[0]]) || error));
2331
+ await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _115 => _115.response, 'optionalAccess', _116 => _116.body, 'optionalAccess', _117 => _117.data, 'optionalAccess', _118 => _118[0]]) || error));
2325
2332
  } catch (_error) {
2326
- if (_optionalChain([_error, 'optionalAccess', _117 => _117.attributes, 'optionalAccess', _118 => _118.code]) === "NOT_FOUND") {
2333
+ if (_optionalChain([_error, 'optionalAccess', _119 => _119.attributes, 'optionalAccess', _120 => _120.code]) === "NOT_FOUND") {
2327
2334
  throw new Error(
2328
2335
  [
2329
2336
  `Field "${args.fieldId}" not found in model "${args.modelId}".`,
@@ -2331,7 +2338,7 @@ function createDatoClient(params) {
2331
2338
  ].join("\n\n")
2332
2339
  );
2333
2340
  }
2334
- if (_optionalChain([_error, 'optionalAccess', _119 => _119.attributes, 'optionalAccess', _120 => _120.details, 'optionalAccess', _121 => _121.message])) {
2341
+ if (_optionalChain([_error, 'optionalAccess', _121 => _121.attributes, 'optionalAccess', _122 => _122.details, 'optionalAccess', _123 => _123.message])) {
2335
2342
  throw new Error(
2336
2343
  [`${_error.attributes.details.message}`, `Error: ${JSON.stringify(_error, null, 2)}`].join("\n\n")
2337
2344
  );
@@ -2397,7 +2404,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
2397
2404
  }
2398
2405
  }
2399
2406
  const records = await dato.findRecordsForModel(modelId);
2400
- const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _122 => _122.models, 'access', _123 => _123[modelId], 'optionalAccess', _124 => _124.records]) || [], project);
2407
+ const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _124 => _124.models, 'access', _125 => _125[modelId], 'optionalAccess', _126 => _126.records]) || [], project);
2401
2408
  const selectedRecords = await promptRecordSelection(modelName, recordChoices);
2402
2409
  result.models[modelId].records = records.filter((record) => selectedRecords.includes(record.id));
2403
2410
  updatedConfig.models[modelId].records = selectedRecords;
@@ -2409,14 +2416,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
2409
2416
  },
2410
2417
  async pull(locale, input2, initCtx) {
2411
2418
  const result = {};
2412
- for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _125 => _125.models]) || {})) {
2413
- let records = _optionalChain([initCtx, 'optionalAccess', _126 => _126.models, 'access', _127 => _127[modelId], 'access', _128 => _128.records]) || [];
2419
+ for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _127 => _127.models]) || {})) {
2420
+ let records = _optionalChain([initCtx, 'optionalAccess', _128 => _128.models, 'access', _129 => _129[modelId], 'access', _130 => _130.records]) || [];
2414
2421
  const recordIds = records.map((record) => record.id);
2415
2422
  records = await dato.findRecords(recordIds);
2416
2423
  console.log(`Fetched ${records.length} records for model ${modelId}`);
2417
2424
  if (records.length > 0) {
2418
2425
  result[modelId] = {
2419
- fields: _optionalChain([initCtx, 'optionalAccess', _129 => _129.models, 'optionalAccess', _130 => _130[modelId], 'optionalAccess', _131 => _131.fields]) || [],
2426
+ fields: _optionalChain([initCtx, 'optionalAccess', _131 => _131.models, 'optionalAccess', _132 => _132[modelId], 'optionalAccess', _133 => _133.fields]) || [],
2420
2427
  records
2421
2428
  };
2422
2429
  }
@@ -2475,7 +2482,7 @@ function createRecordChoices(records, selectedIds = [], project) {
2475
2482
  return records.map((record) => ({
2476
2483
  name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
2477
2484
  value: record.id,
2478
- checked: _optionalChain([selectedIds, 'optionalAccess', _132 => _132.includes, 'call', _133 => _133(record.id)])
2485
+ checked: _optionalChain([selectedIds, 'optionalAccess', _134 => _134.includes, 'call', _135 => _135(record.id)])
2479
2486
  }));
2480
2487
  }
2481
2488
  async function promptRecordSelection(modelName, choices) {
@@ -2626,18 +2633,18 @@ function createRawDatoValue(parsedDatoValue, originalRawDatoValue, isClean = fal
2626
2633
  }
2627
2634
  function serializeStructuredText(rawStructuredText) {
2628
2635
  return serializeStructuredTextNode(rawStructuredText);
2629
- function serializeStructuredTextNode(node, path18 = [], acc = {}) {
2636
+ function serializeStructuredTextNode(node, path17 = [], acc = {}) {
2630
2637
  if ("document" in node) {
2631
- return serializeStructuredTextNode(node.document, [...path18, "document"], acc);
2638
+ return serializeStructuredTextNode(node.document, [...path17, "document"], acc);
2632
2639
  }
2633
2640
  if (!_lodash2.default.isNil(node.value)) {
2634
- acc[[...path18, "value"].join(".")] = node.value;
2641
+ acc[[...path17, "value"].join(".")] = node.value;
2635
2642
  } else if (_lodash2.default.get(node, "type") === "block") {
2636
- acc[[...path18, "item"].join(".")] = serializeBlock(node.item);
2643
+ acc[[...path17, "item"].join(".")] = serializeBlock(node.item);
2637
2644
  }
2638
2645
  if (node.children) {
2639
2646
  for (let i = 0; i < node.children.length; i++) {
2640
- serializeStructuredTextNode(node.children[i], [...path18, i.toString()], acc);
2647
+ serializeStructuredTextNode(node.children[i], [...path17, i.toString()], acc);
2641
2648
  }
2642
2649
  }
2643
2650
  return acc;
@@ -2696,8 +2703,8 @@ function deserializeBlockList(parsedBlockList, originalRawBlockList, isClean = f
2696
2703
  }
2697
2704
  function deserializeStructuredText(parsedStructuredText, originalRawStructuredText) {
2698
2705
  const result = _lodash2.default.cloneDeep(originalRawStructuredText);
2699
- for (const [path18, value] of _lodash2.default.entries(parsedStructuredText)) {
2700
- 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();
2701
2708
  const deserializedValue = createRawDatoValue(value, _lodash2.default.get(originalRawStructuredText, realPath), true);
2702
2709
  _lodash2.default.set(result, realPath, deserializedValue);
2703
2710
  }
@@ -2722,12 +2729,12 @@ function _isVideo(rawDatoValue) {
2722
2729
  // src/cli/loaders/dato/index.ts
2723
2730
  function createDatoLoader(configFilePath) {
2724
2731
  try {
2725
- const configContent = fs11.default.readFileSync(configFilePath, "utf-8");
2732
+ const configContent = fs10.default.readFileSync(configFilePath, "utf-8");
2726
2733
  const datoConfig = datoConfigSchema.parse(_json52.default.parse(configContent));
2727
2734
  return composeLoaders(
2728
2735
  createDatoApiLoader(
2729
2736
  datoConfig,
2730
- (updatedConfig) => fs11.default.writeFileSync(configFilePath, _json52.default.stringify(updatedConfig, null, 2))
2737
+ (updatedConfig) => fs10.default.writeFileSync(configFilePath, _json52.default.stringify(updatedConfig, null, 2))
2731
2738
  ),
2732
2739
  createDatoFilterLoader(),
2733
2740
  createDatoExtractLoader()
@@ -2742,7 +2749,7 @@ var _nodewebvtt = require('node-webvtt'); var _nodewebvtt2 = _interopRequireDefa
2742
2749
  function createVttLoader() {
2743
2750
  return createLoader({
2744
2751
  async pull(locale, input2) {
2745
- const vtt = _optionalChain([_nodewebvtt2.default, 'access', _134 => _134.parse, 'call', _135 => _135(input2), 'optionalAccess', _136 => _136.cues]);
2752
+ const vtt = _optionalChain([_nodewebvtt2.default, 'access', _136 => _136.parse, 'call', _137 => _137(input2), 'optionalAccess', _138 => _138.cues]);
2746
2753
  if (Object.keys(vtt).length === 0) {
2747
2754
  return {};
2748
2755
  } else {
@@ -2795,7 +2802,7 @@ function variableExtractLoader(params) {
2795
2802
  for (let i = 0; i < matches.length; i++) {
2796
2803
  const match = matches[i];
2797
2804
  const currentValue = result[key].value;
2798
- const newValue = _optionalChain([currentValue, 'optionalAccess', _137 => _137.replace, 'call', _138 => _138(match, `{variable:${i}}`)]);
2805
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _139 => _139.replace, 'call', _140 => _140(match, `{variable:${i}}`)]);
2799
2806
  result[key].value = newValue;
2800
2807
  result[key].variables[i] = match;
2801
2808
  }
@@ -2809,7 +2816,7 @@ function variableExtractLoader(params) {
2809
2816
  for (let i = 0; i < valueObj.variables.length; i++) {
2810
2817
  const variable = valueObj.variables[i];
2811
2818
  const currentValue = result[key];
2812
- const newValue = _optionalChain([currentValue, 'optionalAccess', _139 => _139.replace, 'call', _140 => _140(`{variable:${i}}`, variable)]);
2819
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _141 => _141.replace, 'call', _142 => _142(`{variable:${i}}`, variable)]);
2813
2820
  result[key] = newValue;
2814
2821
  }
2815
2822
  }
@@ -2990,7 +2997,7 @@ function createVueJsonLoader() {
2990
2997
  return createLoader({
2991
2998
  pull: async (locale, input2, ctx) => {
2992
2999
  const parsed = parseVueFile(input2);
2993
- return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _141 => _141.i18n, 'optionalAccess', _142 => _142[locale]]), () => ( {}));
3000
+ return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _143 => _143.i18n, 'optionalAccess', _144 => _144[locale]]), () => ( {}));
2994
3001
  },
2995
3002
  push: async (locale, data, originalInput) => {
2996
3003
  const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
@@ -3084,16 +3091,6 @@ function createMdxFrontmatterSplitLoader() {
3084
3091
  });
3085
3092
  }
3086
3093
 
3087
- // src/cli/loaders/mdx2/_utils.ts
3088
- function traverseMdast(ast, visitor) {
3089
- visitor(ast);
3090
- if ("children" in ast && Array.isArray(ast.children)) {
3091
- for (const child of ast.children) {
3092
- traverseMdast(child, visitor);
3093
- }
3094
- }
3095
- }
3096
-
3097
3094
  // src/cli/utils/md5.ts
3098
3095
  var _objecthash = require('object-hash');
3099
3096
  function md5(input2) {
@@ -3101,41 +3098,40 @@ function md5(input2) {
3101
3098
  }
3102
3099
 
3103
3100
  // src/cli/loaders/mdx2/code-placeholder.ts
3104
- var _unified = require('unified');
3105
- var _remarkparse = require('remark-parse'); var _remarkparse2 = _interopRequireDefault(_remarkparse);
3106
- var _remarkgfm = require('remark-gfm'); var _remarkgfm2 = _interopRequireDefault(_remarkgfm);
3107
- var _vfile = require('vfile');
3108
- var _remarkmdx = require('remark-mdx'); var _remarkmdx2 = _interopRequireDefault(_remarkmdx);
3109
- function parseMdast(content) {
3110
- const file = new (0, _vfile.VFile)(content);
3111
- const parser2 = _unified.unified.call(void 0, ).use(_remarkparse2.default).use(_remarkgfm2.default).use(_remarkmdx2.default);
3112
- const result = parser2.parse(file);
3113
- return result;
3101
+
3102
+ var unindentedFenceRegex = /(?<!\n\n)```([\s\S]*?)```(?!\n\n)/g;
3103
+ var indentedFenceRegex = /```([\s\S]*?)```/g;
3104
+ function ensureTrailingFenceNewline(_content) {
3105
+ let found = false;
3106
+ let content = _content;
3107
+ do {
3108
+ found = false;
3109
+ const matches = content.match(unindentedFenceRegex);
3110
+ if (matches) {
3111
+ const match = matches[0];
3112
+ content = content.replace(match, `
3113
+
3114
+ ${match}
3115
+
3116
+ `);
3117
+ found = true;
3118
+ }
3119
+ } while (found);
3120
+ content = _lodash2.default.chain(content).split("\n\n").filter(Boolean).join("\n\n").value();
3121
+ return content;
3114
3122
  }
3115
3123
  function extractCodePlaceholders(content) {
3116
- const ast = parseMdast(content);
3117
- const placeholderableElements = [
3118
- "code",
3119
- "inlineCode"
3120
- ];
3121
3124
  let finalContent = content;
3125
+ finalContent = ensureTrailingFenceNewline(finalContent);
3122
3126
  const codePlaceholders = {};
3123
- traverseMdast(ast, (_node) => {
3124
- if (!placeholderableElements.includes(_node.type)) {
3125
- return;
3126
- }
3127
- const node = _node;
3128
- const nodeContent = node.value;
3129
- const nodeContentHash = md5(nodeContent);
3130
- const placeholderId = `__PLACEHOLDER_${nodeContentHash}__`;
3131
- const nodeContentStart = _optionalChain([node, 'access', _143 => _143.position, 'optionalAccess', _144 => _144.start, 'access', _145 => _145.offset]);
3132
- const nodeContentEnd = _optionalChain([node, 'access', _146 => _146.position, 'optionalAccess', _147 => _147.end, 'access', _148 => _148.offset]);
3133
- if (!nodeContentStart || !nodeContentEnd) {
3134
- return;
3135
- }
3136
- codePlaceholders[placeholderId] = nodeContent;
3137
- finalContent = finalContent.split(nodeContent).join(placeholderId);
3138
- });
3127
+ const codeBlockMatches = finalContent.matchAll(indentedFenceRegex);
3128
+ for (const match of codeBlockMatches) {
3129
+ const codeBlock = match[0];
3130
+ const codeBlockHash = md5(codeBlock);
3131
+ const placeholderId = `---CODE_PLACEHOLDER_${codeBlockHash}---`;
3132
+ codePlaceholders[placeholderId] = codeBlock;
3133
+ finalContent = finalContent.replace(codeBlock, placeholderId);
3134
+ }
3139
3135
  return {
3140
3136
  content: finalContent,
3141
3137
  codePlaceholders
@@ -3144,314 +3140,22 @@ function extractCodePlaceholders(content) {
3144
3140
  function createMdxCodePlaceholderLoader() {
3145
3141
  return createLoader({
3146
3142
  async pull(locale, input2) {
3147
- const { frontmatter = {}, content = "" } = input2 || {
3148
- frontmatter: {},
3149
- content: ""
3150
- };
3151
- const { content: resultContent, codePlaceholders } = extractCodePlaceholders(content);
3152
- return {
3153
- frontmatter,
3154
- content: resultContent,
3155
- codePlaceholders
3156
- };
3143
+ const response = extractCodePlaceholders(input2);
3144
+ return response.content;
3157
3145
  },
3158
3146
  async push(locale, data, originalInput) {
3159
- const { codePlaceholders } = extractCodePlaceholders(
3160
- _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _149 => _149.content]), () => ( ""))
3161
- );
3162
- let finalContent = data.content;
3163
- for (const [placeholder, original] of Object.entries(codePlaceholders)) {
3164
- finalContent = finalContent.replaceAll(placeholder, () => original);
3147
+ const response = extractCodePlaceholders(_nullishCoalesce(originalInput, () => ( "")));
3148
+ let result = data;
3149
+ for (const [placeholder, original] of Object.entries(
3150
+ response.codePlaceholders
3151
+ )) {
3152
+ result = result.replaceAll(placeholder, original);
3165
3153
  }
3166
- const result = {
3167
- frontmatter: data.frontmatter,
3168
- content: finalContent
3169
- };
3170
3154
  return result;
3171
3155
  }
3172
3156
  });
3173
3157
  }
3174
3158
 
3175
- // src/cli/loaders/mdx2/section-split.ts
3176
-
3177
-
3178
-
3179
-
3180
-
3181
- var parser = _unified.unified.call(void 0, ).use(_remarkparse2.default).use(_remarkgfm2.default).use(_remarkmdx2.default);
3182
- var SPACING_MATRIX = [
3183
- // HEADING as previous type
3184
- ["\n\n", "\n\n", "\n\n", "\n\n", "\n\n", "\n\n"],
3185
- // JSX_OPENING_TAG as previous type
3186
- ["\n\n", "\n", "\n", "\n", "\n", "\n\n"],
3187
- // JSX_CLOSING_TAG as previous type
3188
- ["\n\n", "\n", "\n", "\n", "\n\n", "\n\n"],
3189
- // JSX_SELF_CLOSING_TAG as previous type
3190
- ["\n\n", "\n", "\n", "\n", "\n", "\n\n"],
3191
- // CONTENT as previous type
3192
- ["\n\n", "\n\n", "\n", "\n\n", "\n\n", "\n\n"],
3193
- // UNKNOWN as previous type
3194
- ["\n\n", "\n\n", "\n\n", "\n\n", "\n\n", "\n\n"]
3195
- ];
3196
- function createMdxSectionSplitLoader() {
3197
- return createLoader({
3198
- async pull(_locale, input2) {
3199
- const {
3200
- frontmatter = {},
3201
- content = "",
3202
- codePlaceholders = {}
3203
- } = input2 || {
3204
- frontmatter: {},
3205
- content: "",
3206
- codePlaceholders: {}
3207
- };
3208
- if (!content.trim()) {
3209
- return {
3210
- frontmatter,
3211
- sections: {}
3212
- };
3213
- }
3214
- const file = new (0, _vfile.VFile)(content);
3215
- const ast = parser.parse(file);
3216
- const boundaries = findSectionBoundaries(ast, content);
3217
- const sections = createSectionsFromBoundaries(boundaries, content);
3218
- return {
3219
- frontmatter,
3220
- sections
3221
- };
3222
- },
3223
- async push(_locale, data, originalInput, _originalLocale) {
3224
- const sectionsArray = Object.values(data.sections);
3225
- if (sectionsArray.length === 0) {
3226
- return {
3227
- frontmatter: data.frontmatter,
3228
- content: "",
3229
- codePlaceholders: _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _150 => _150.codePlaceholders]), () => ( {}))
3230
- };
3231
- }
3232
- const resultParts = new Array(sectionsArray.length * 2 - 1);
3233
- const sectionTypes = new Array(sectionsArray.length);
3234
- for (let i = 0; i < sectionsArray.length; i++) {
3235
- sectionTypes[i] = determineJsxSectionType(sectionsArray[i]);
3236
- }
3237
- resultParts[0] = sectionsArray[0];
3238
- for (let i = 1, j = 1; i < sectionsArray.length; i++, j += 2) {
3239
- const prevType = sectionTypes[i - 1];
3240
- const currentType = sectionTypes[i];
3241
- resultParts[j] = SPACING_MATRIX[prevType][currentType];
3242
- resultParts[j + 1] = sectionsArray[i];
3243
- }
3244
- const content = resultParts.join("");
3245
- return {
3246
- frontmatter: data.frontmatter,
3247
- content,
3248
- codePlaceholders: _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _151 => _151.codePlaceholders]), () => ( {}))
3249
- };
3250
- }
3251
- });
3252
- }
3253
- function determineJsxSectionType(section) {
3254
- section = section.trim();
3255
- if (!section) return 5 /* UNKNOWN */;
3256
- const firstChar = section.charAt(0);
3257
- const lastChar = section.charAt(section.length - 1);
3258
- if (firstChar === "#") {
3259
- if (/^#{1,6}\s/.test(section)) {
3260
- return 0 /* HEADING */;
3261
- }
3262
- }
3263
- if (firstChar === "<") {
3264
- if (section.endsWith("/>")) {
3265
- return 3 /* JSX_SELF_CLOSING_TAG */;
3266
- }
3267
- if (section.startsWith("</")) {
3268
- return 2 /* JSX_CLOSING_TAG */;
3269
- }
3270
- if (lastChar === ">") {
3271
- return 1 /* JSX_OPENING_TAG */;
3272
- }
3273
- }
3274
- return 4 /* CONTENT */;
3275
- }
3276
- function isJsxOrHtml(node) {
3277
- return node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement" || node.type === "html";
3278
- }
3279
- function findOpeningTagEnd(text) {
3280
- let depth = 0;
3281
- let inQuotes = false;
3282
- let quoteChar = "";
3283
- for (let i = 0; i < text.length; i++) {
3284
- const char = text[i];
3285
- if ((char === '"' || char === "'") && (i === 0 || text[i - 1] !== "\\")) {
3286
- if (!inQuotes) {
3287
- inQuotes = true;
3288
- quoteChar = char;
3289
- } else if (char === quoteChar) {
3290
- inQuotes = false;
3291
- }
3292
- }
3293
- if (!inQuotes) {
3294
- if (char === "<") depth++;
3295
- if (char === ">") {
3296
- depth--;
3297
- if (depth === 0) return i + 1;
3298
- }
3299
- }
3300
- }
3301
- return -1;
3302
- }
3303
- function findClosingTagStart(text) {
3304
- const openTagMatch = /<([^\s/>]+)/.exec(text);
3305
- if (!openTagMatch) return -1;
3306
- const tagName = openTagMatch[1];
3307
- const closingTagRegex = new RegExp(`</${tagName}\\s*>`, "g");
3308
- let lastMatch = null;
3309
- let match;
3310
- while ((match = closingTagRegex.exec(text)) !== null) {
3311
- lastMatch = match;
3312
- }
3313
- return lastMatch ? lastMatch.index : -1;
3314
- }
3315
- function processJsxNode(node, content, boundaries) {
3316
- if (!node.position || typeof node.position.start.offset !== "number" || typeof node.position.end.offset !== "number") {
3317
- return;
3318
- }
3319
- const nodeStart = node.position.start.offset;
3320
- const nodeEnd = node.position.end.offset;
3321
- const nodeContent = content.slice(nodeStart, nodeEnd);
3322
- if (node.type === "html") {
3323
- extractHtmlTags(nodeStart, nodeContent, boundaries);
3324
- return;
3325
- }
3326
- if (node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement") {
3327
- const isSelfClosing = node.selfClosing === true;
3328
- if (isSelfClosing) {
3329
- boundaries.push({
3330
- start: nodeStart,
3331
- end: nodeEnd,
3332
- isolateSelf: true
3333
- });
3334
- } else {
3335
- extractJsxTags(node, nodeContent, boundaries);
3336
- if (node.children) {
3337
- for (const child of node.children) {
3338
- if (isJsxOrHtml(child)) {
3339
- processJsxNode(child, content, boundaries);
3340
- }
3341
- }
3342
- }
3343
- }
3344
- }
3345
- }
3346
- function extractHtmlTags(nodeStart, nodeContent, boundaries) {
3347
- const tagRegex = /<\/?[a-zA-Z][a-zA-Z0-9:._-]*(?:\s+[a-zA-Z:_][a-zA-Z0-9:._-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^'">\s]+))?)*\s*\/?>/g;
3348
- let match;
3349
- while ((match = tagRegex.exec(nodeContent)) !== null) {
3350
- const tagStart = nodeStart + match.index;
3351
- const tagEnd = tagStart + match[0].length;
3352
- boundaries.push({
3353
- start: tagStart,
3354
- end: tagEnd,
3355
- isolateSelf: true
3356
- });
3357
- }
3358
- }
3359
- function extractJsxTags(node, nodeContent, boundaries) {
3360
- const nodeStart = node.position.start.offset;
3361
- const nodeEnd = node.position.end.offset;
3362
- if (!nodeStart || !nodeEnd) {
3363
- return;
3364
- }
3365
- const openingTagEnd = findOpeningTagEnd(nodeContent);
3366
- if (openingTagEnd > 0) {
3367
- boundaries.push({
3368
- start: nodeStart,
3369
- end: nodeStart + openingTagEnd,
3370
- isolateSelf: true
3371
- });
3372
- }
3373
- const closingTagStart = findClosingTagStart(nodeContent);
3374
- if (closingTagStart > 0 && closingTagStart < nodeContent.length) {
3375
- boundaries.push({
3376
- start: nodeStart + closingTagStart,
3377
- end: nodeEnd,
3378
- isolateSelf: true
3379
- });
3380
- }
3381
- }
3382
- function findSectionBoundaries(ast, content) {
3383
- const boundaries = [];
3384
- const nodePositions = /* @__PURE__ */ new Map();
3385
- traverseMdast(ast, (node) => {
3386
- if (node.position && typeof node.position.start.offset === "number" && typeof node.position.end.offset === "number") {
3387
- nodePositions.set(node, {
3388
- start: node.position.start.offset,
3389
- end: node.position.end.offset
3390
- });
3391
- }
3392
- });
3393
- for (const child of ast.children) {
3394
- const position = nodePositions.get(child);
3395
- if (!position) continue;
3396
- if (child.type === "heading") {
3397
- boundaries.push({
3398
- start: position.start,
3399
- end: position.end,
3400
- isolateSelf: false
3401
- });
3402
- } else if (isJsxOrHtml(child)) {
3403
- processJsxNode(child, content, boundaries);
3404
- }
3405
- }
3406
- return boundaries.sort((a, b) => a.start - b.start);
3407
- }
3408
- function createSectionsFromBoundaries(boundaries, content) {
3409
- const sections = {};
3410
- if (!content.trim() || boundaries.length === 0) {
3411
- const trimmed = content.trim();
3412
- if (trimmed) {
3413
- sections["0"] = trimmed;
3414
- }
3415
- return sections;
3416
- }
3417
- let idx = 0;
3418
- let lastEnd = 0;
3419
- const sectionsArray = [];
3420
- for (let i = 0; i < boundaries.length; i++) {
3421
- const { start, end, isolateSelf } = boundaries[i];
3422
- if (start > lastEnd) {
3423
- const segment = content.slice(lastEnd, start).trim();
3424
- if (segment) {
3425
- sectionsArray.push(segment);
3426
- }
3427
- }
3428
- if (isolateSelf) {
3429
- const segment = content.slice(start, end).trim();
3430
- if (segment) {
3431
- sectionsArray.push(segment);
3432
- }
3433
- lastEnd = end;
3434
- } else {
3435
- const nextStart = i + 1 < boundaries.length ? boundaries[i + 1].start : content.length;
3436
- const segment = content.slice(start, nextStart).trim();
3437
- if (segment) {
3438
- sectionsArray.push(segment);
3439
- }
3440
- lastEnd = nextStart;
3441
- }
3442
- }
3443
- if (lastEnd < content.length) {
3444
- const segment = content.slice(lastEnd).trim();
3445
- if (segment) {
3446
- sectionsArray.push(segment);
3447
- }
3448
- }
3449
- sectionsArray.forEach((section, index) => {
3450
- sections[index.toString()] = section;
3451
- });
3452
- return sections;
3453
- }
3454
-
3455
3159
  // src/cli/loaders/mdx2/localizable-document.ts
3456
3160
  function createLocalizableMdxDocumentLoader() {
3457
3161
  return createLoader({
@@ -3471,14 +3175,28 @@ function createLocalizableMdxDocumentLoader() {
3471
3175
  });
3472
3176
  }
3473
3177
 
3474
- // src/cli/loaders/mdx2/index.ts
3475
- function createMdxLoader() {
3476
- return composeLoaders(
3477
- createMdxFrontmatterSplitLoader(),
3478
- createMdxCodePlaceholderLoader(),
3479
- createMdxSectionSplitLoader(),
3480
- createLocalizableMdxDocumentLoader()
3481
- );
3178
+ // src/cli/loaders/mdx2/sections-split-2.ts
3179
+
3180
+ function createMdxSectionsSplit2Loader() {
3181
+ return createLoader({
3182
+ async pull(locale, input2) {
3183
+ const sections = _lodash2.default.chain(input2.content).split("\n\n").filter(Boolean).map((section, index) => [index, section]).fromPairs().value();
3184
+ const result = {
3185
+ frontmatter: input2.frontmatter,
3186
+ sections
3187
+ };
3188
+ return result;
3189
+ },
3190
+ async push(locale, data, originalInput, _originalLocale, pullInput) {
3191
+ const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
3192
+ const result = {
3193
+ frontmatter: data.frontmatter,
3194
+ codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _145 => _145.codePlaceholders]) || {},
3195
+ content
3196
+ };
3197
+ return result;
3198
+ }
3199
+ });
3482
3200
  }
3483
3201
 
3484
3202
  // src/cli/loaders/index.ts
@@ -3547,8 +3265,14 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
3547
3265
  case "mdx":
3548
3266
  return composeLoaders(
3549
3267
  createTextFileLoader(bucketPathPattern),
3550
- createPrettierLoader({ parser: "mdx", bucketPathPattern }),
3551
- createMdxLoader(),
3268
+ createMdxCodePlaceholderLoader(),
3269
+ createPrettierLoader({
3270
+ parser: "mdx",
3271
+ bucketPathPattern
3272
+ }),
3273
+ createMdxFrontmatterSplitLoader(),
3274
+ createMdxSectionsSplit2Loader(),
3275
+ createLocalizableMdxDocumentLoader(),
3552
3276
  createFlatLoader(),
3553
3277
  createSyncLoader(),
3554
3278
  createUnlocalizableLoader(
@@ -3735,37 +3459,6 @@ var _diff = require('diff');
3735
3459
 
3736
3460
  var _externaleditor = require('external-editor'); var _externaleditor2 = _interopRequireDefault(_externaleditor);
3737
3461
 
3738
- // src/cli/utils/cache.ts
3739
-
3740
-
3741
- var cacheChunk = (targetLocale, sourceChunk, processedChunk) => {
3742
- const rows = Object.entries(sourceChunk).map(([key, source]) => ({
3743
- targetLocale,
3744
- key,
3745
- source,
3746
- processed: processedChunk[key]
3747
- }));
3748
- _appendToCache(rows);
3749
- };
3750
- function deleteCache() {
3751
- const cacheFilePath = _getCacheFilePath();
3752
- try {
3753
- fs11.default.unlinkSync(cacheFilePath);
3754
- } catch (e) {
3755
- }
3756
- }
3757
- function _appendToCache(rows) {
3758
- const cacheFilePath = _getCacheFilePath();
3759
- const lines = _buildJSONLines(rows);
3760
- fs11.default.appendFileSync(cacheFilePath, lines);
3761
- }
3762
- function _getCacheFilePath() {
3763
- return path15.default.join(process.cwd(), "i18n.cache");
3764
- }
3765
- function _buildJSONLines(rows) {
3766
- return rows.map((row) => JSON.stringify(row)).join("\n") + "\n";
3767
- }
3768
-
3769
3462
  // src/cli/processor/lingo.ts
3770
3463
  var __sdk = require('@lingo.dev/_sdk');
3771
3464
  function createLingoLocalizer(params) {
@@ -3844,7 +3537,7 @@ function createBasicTranslator(model, systemPrompt) {
3844
3537
  ]
3845
3538
  });
3846
3539
  const result = JSON.parse(response.text);
3847
- return _optionalChain([result, 'optionalAccess', _152 => _152.data]) || {};
3540
+ return _optionalChain([result, 'optionalAccess', _146 => _146.data]) || {};
3848
3541
  };
3849
3542
  }
3850
3543
 
@@ -3862,7 +3555,7 @@ function createProcessor(provider, params) {
3862
3555
  }
3863
3556
  }
3864
3557
  function getPureModelProvider(provider) {
3865
- switch (_optionalChain([provider, 'optionalAccess', _153 => _153.id])) {
3558
+ switch (_optionalChain([provider, 'optionalAccess', _147 => _147.id])) {
3866
3559
  case "openai":
3867
3560
  if (!process.env.OPENAI_API_KEY) {
3868
3561
  throw new Error("OPENAI_API_KEY is not set.");
@@ -3879,7 +3572,7 @@ function getPureModelProvider(provider) {
3879
3572
  apiKey: process.env.ANTHROPIC_API_KEY
3880
3573
  })(provider.model);
3881
3574
  default:
3882
- throw new Error(`Unsupported provider: ${_optionalChain([provider, 'optionalAccess', _154 => _154.id])}`);
3575
+ throw new Error(`Unsupported provider: ${_optionalChain([provider, 'optionalAccess', _148 => _148.id])}`);
3883
3576
  }
3884
3577
  }
3885
3578
 
@@ -3939,21 +3632,21 @@ async function trackEvent(distinctId, event, properties) {
3939
3632
 
3940
3633
  function tryReadFile(filePath, defaultValue = null) {
3941
3634
  try {
3942
- const content = fs11.readFileSync(filePath, "utf-8");
3635
+ const content = fs10.readFileSync(filePath, "utf-8");
3943
3636
  return content;
3944
3637
  } catch (error) {
3945
3638
  return defaultValue;
3946
3639
  }
3947
3640
  }
3948
3641
  function writeFile(filePath, content) {
3949
- const dir = path13.dirname(filePath);
3950
- if (!fs11.existsSync(dir)) {
3951
- fs11.mkdirSync(dir, { recursive: true });
3642
+ const dir = path12.dirname(filePath);
3643
+ if (!fs10.existsSync(dir)) {
3644
+ fs10.mkdirSync(dir, { recursive: true });
3952
3645
  }
3953
- fs11.writeFileSync(filePath, content);
3646
+ fs10.writeFileSync(filePath, content);
3954
3647
  }
3955
3648
  function checkIfFileExists(filePath) {
3956
- return fs11.existsSync(filePath);
3649
+ return fs10.existsSync(filePath);
3957
3650
  }
3958
3651
 
3959
3652
  // src/cli/utils/delta.ts
@@ -3974,7 +3667,7 @@ var LockSchema = _zod2.default.object({
3974
3667
  ).default({})
3975
3668
  });
3976
3669
  function createDeltaProcessor(fileKey) {
3977
- const lockfilePath = path14.join(process.cwd(), "i18n.lock");
3670
+ const lockfilePath = path13.join(process.cwd(), "i18n.lock");
3978
3671
  return {
3979
3672
  async checkIfLockExists() {
3980
3673
  return checkIfFileExists(lockfilePath);
@@ -4106,16 +3799,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
4106
3799
  flags
4107
3800
  });
4108
3801
  let buckets = getBuckets(i18nConfig);
4109
- if (_optionalChain([flags, 'access', _155 => _155.bucket, 'optionalAccess', _156 => _156.length])) {
3802
+ if (_optionalChain([flags, 'access', _149 => _149.bucket, 'optionalAccess', _150 => _150.length])) {
4110
3803
  buckets = buckets.filter(
4111
3804
  (bucket) => flags.bucket.includes(bucket.type)
4112
3805
  );
4113
3806
  }
4114
3807
  ora.succeed("Buckets retrieved");
4115
- if (_optionalChain([flags, 'access', _157 => _157.file, 'optionalAccess', _158 => _158.length])) {
3808
+ if (_optionalChain([flags, 'access', _151 => _151.file, 'optionalAccess', _152 => _152.length])) {
4116
3809
  buckets = buckets.map((bucket) => {
4117
3810
  const paths = bucket.paths.filter(
4118
- (path18) => flags.file.find((file) => _optionalChain([path18, 'access', _159 => _159.pathPattern, 'optionalAccess', _160 => _160.includes, 'call', _161 => _161(file)]))
3811
+ (path17) => flags.file.find((file) => _optionalChain([path17, 'access', _153 => _153.pathPattern, 'optionalAccess', _154 => _154.includes, 'call', _155 => _155(file)]))
4119
3812
  );
4120
3813
  return { ...bucket, paths };
4121
3814
  }).filter((bucket) => bucket.paths.length > 0);
@@ -4128,13 +3821,13 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
4128
3821
  ora.info(`\x1B[36mProcessing only filtered buckets:\x1B[0m`);
4129
3822
  buckets.map((bucket) => {
4130
3823
  ora.info(` ${bucket.type}:`);
4131
- bucket.paths.forEach((path18) => {
4132
- ora.info(` - ${path18.pathPattern}`);
3824
+ bucket.paths.forEach((path17) => {
3825
+ ora.info(` - ${path17.pathPattern}`);
4133
3826
  });
4134
3827
  });
4135
3828
  }
4136
3829
  }
4137
- const targetLocales = _optionalChain([flags, 'access', _162 => _162.locale, 'optionalAccess', _163 => _163.length]) ? flags.locale : i18nConfig.locale.targets;
3830
+ const targetLocales = _optionalChain([flags, 'access', _156 => _156.locale, 'optionalAccess', _157 => _157.length]) ? flags.locale : i18nConfig.locale.targets;
4138
3831
  ora.start("Setting up localization cache...");
4139
3832
  const checkLockfileProcessor = createDeltaProcessor("");
4140
3833
  const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
@@ -4181,7 +3874,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
4181
3874
  bucketPath.delimiter
4182
3875
  );
4183
3876
  const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
4184
- const sourcePath = path15.join(
3877
+ const sourcePath = path14.join(
4185
3878
  process.cwd(),
4186
3879
  bucketPath.pathPattern.replace("[locale]", sourceLocale)
4187
3880
  );
@@ -4198,7 +3891,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
4198
3891
  _targetLocale,
4199
3892
  bucketPath.delimiter
4200
3893
  );
4201
- const targetPath = path15.join(
3894
+ const targetPath = path14.join(
4202
3895
  process.cwd(),
4203
3896
  bucketPath.pathPattern.replace("[locale]", targetLocale)
4204
3897
  );
@@ -4371,7 +4064,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
4371
4064
  if (flags.key) {
4372
4065
  processableData = _lodash2.default.pickBy(
4373
4066
  processableData,
4374
- (_24, key) => key === flags.key
4067
+ (_26, key) => key === flags.key
4375
4068
  );
4376
4069
  }
4377
4070
  if (flags.verbose) {
@@ -4398,7 +4091,6 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
4398
4091
  targetData
4399
4092
  },
4400
4093
  (progress, sourceChunk, processedChunk) => {
4401
- cacheChunk(targetLocale, sourceChunk, processedChunk);
4402
4094
  const progressLog = `[${sourceLocale} -> ${targetLocale}] [${Object.keys(processableData).length} entries] (${progress}%) AI localization in progress...`;
4403
4095
  if (flags.verbose) {
4404
4096
  bucketOra.info(progressLog);
@@ -4476,10 +4168,6 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
4476
4168
  console.log();
4477
4169
  if (!hasErrors) {
4478
4170
  ora.succeed("Localization completed.");
4479
- deleteCache();
4480
- if (flags.verbose) {
4481
- ora.info("Cache file deleted.");
4482
- }
4483
4171
  trackEvent(auth.id, "cmd.i18n.success", {
4484
4172
  i18nConfig,
4485
4173
  flags
@@ -4542,12 +4230,12 @@ function validateParams(i18nConfig, flags) {
4542
4230
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
4543
4231
  docUrl: "bucketNotFound"
4544
4232
  });
4545
- } else if (_optionalChain([flags, 'access', _164 => _164.locale, 'optionalAccess', _165 => _165.some, 'call', _166 => _166((locale) => !i18nConfig.locale.targets.includes(locale))])) {
4233
+ } else if (_optionalChain([flags, 'access', _158 => _158.locale, 'optionalAccess', _159 => _159.some, 'call', _160 => _160((locale) => !i18nConfig.locale.targets.includes(locale))])) {
4546
4234
  throw new CLIError({
4547
4235
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
4548
4236
  docUrl: "localeTargetNotFound"
4549
4237
  });
4550
- } else if (_optionalChain([flags, 'access', _167 => _167.bucket, 'optionalAccess', _168 => _168.some, 'call', _169 => _169(
4238
+ } else if (_optionalChain([flags, 'access', _161 => _161.bucket, 'optionalAccess', _162 => _162.some, 'call', _163 => _163(
4551
4239
  (bucket) => !i18nConfig.buckets[bucket]
4552
4240
  )])) {
4553
4241
  throw new CLIError({
@@ -4684,7 +4372,7 @@ function createLockfileHelper() {
4684
4372
  return {
4685
4373
  isLockfileExists: () => {
4686
4374
  const lockfilePath = _getLockfilePath();
4687
- return fs11.default.existsSync(lockfilePath);
4375
+ return fs10.default.existsSync(lockfilePath);
4688
4376
  },
4689
4377
  registerSourceData: (pathPattern, sourceData) => {
4690
4378
  const lockfile = _loadLockfile();
@@ -4711,20 +4399,20 @@ function createLockfileHelper() {
4711
4399
  };
4712
4400
  function _loadLockfile() {
4713
4401
  const lockfilePath = _getLockfilePath();
4714
- if (!fs11.default.existsSync(lockfilePath)) {
4402
+ if (!fs10.default.existsSync(lockfilePath)) {
4715
4403
  return LockfileSchema.parse({});
4716
4404
  }
4717
- const content = fs11.default.readFileSync(lockfilePath, "utf-8");
4405
+ const content = fs10.default.readFileSync(lockfilePath, "utf-8");
4718
4406
  const result = LockfileSchema.parse(_yaml2.default.parse(content));
4719
4407
  return result;
4720
4408
  }
4721
4409
  function _saveLockfile(lockfile) {
4722
4410
  const lockfilePath = _getLockfilePath();
4723
4411
  const content = _yaml2.default.stringify(lockfile);
4724
- fs11.default.writeFileSync(lockfilePath, content);
4412
+ fs10.default.writeFileSync(lockfilePath, content);
4725
4413
  }
4726
4414
  function _getLockfilePath() {
4727
- return path15.default.join(process.cwd(), "i18n.lock");
4415
+ return path14.default.join(process.cwd(), "i18n.lock");
4728
4416
  }
4729
4417
  }
4730
4418
  var LockfileSchema = _zod2.default.object({
@@ -4875,7 +4563,7 @@ var _stdiojs = require('@modelcontextprotocol/sdk/server/stdio.js');
4875
4563
  var _mcpjs = require('@modelcontextprotocol/sdk/server/mcp.js');
4876
4564
 
4877
4565
 
4878
- var mcp_default = new (0, _interactivecommander.Command)().command("mcp").description("Use Lingo.dev model context provider with your AI agent").helpOption("-h, --help", "Show help").action(async (_24, program) => {
4566
+ var mcp_default = new (0, _interactivecommander.Command)().command("mcp").description("Use Lingo.dev model context provider with your AI agent").helpOption("-h, --help", "Show help").action(async (_26, program) => {
4879
4567
  const apiKey = program.args[0];
4880
4568
  const settings = getSettings(apiKey);
4881
4569
  if (!settings.auth.apiKey) {
@@ -4998,7 +4686,7 @@ var InBranchFlow = class extends IntegrationFlow {
4998
4686
  _child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
4999
4687
  _child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
5000
4688
  _child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
5001
- _optionalChain([this, 'access', _170 => _170.platformKit, 'optionalAccess', _171 => _171.gitConfig, 'call', _172 => _172()]);
4689
+ _optionalChain([this, 'access', _164 => _164.platformKit, 'optionalAccess', _165 => _165.gitConfig, 'call', _166 => _166()]);
5002
4690
  _child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
5003
4691
  _child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
5004
4692
  if (!processOwnCommits) {
@@ -5011,7 +4699,7 @@ var InBranchFlow = class extends IntegrationFlow {
5011
4699
  return false;
5012
4700
  }
5013
4701
  }
5014
- const workingDir = path15.default.resolve(process.cwd(), this.platformKit.config.workingDir);
4702
+ const workingDir = path14.default.resolve(process.cwd(), this.platformKit.config.workingDir);
5015
4703
  if (workingDir !== process.cwd()) {
5016
4704
  this.ora.info(`Changing to working directory: ${this.platformKit.config.workingDir}`);
5017
4705
  process.chdir(workingDir);
@@ -5023,7 +4711,7 @@ var InBranchFlow = class extends IntegrationFlow {
5023
4711
  // ../../action/src/flows/pull-request.ts
5024
4712
  var PullRequestFlow = class extends InBranchFlow {
5025
4713
  async preRun() {
5026
- const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _173 => _173()]);
4714
+ const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _167 => _167()]);
5027
4715
  if (!canContinue) {
5028
4716
  return false;
5029
4717
  }
@@ -5241,10 +4929,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
5241
4929
  repo_slug: this.platformConfig.repositoryName,
5242
4930
  state: "OPEN"
5243
4931
  }).then(({ data: { values } }) => {
5244
- return _optionalChain([values, 'optionalAccess', _174 => _174.find, 'call', _175 => _175(
5245
- ({ source, destination }) => _optionalChain([source, 'optionalAccess', _176 => _176.branch, 'optionalAccess', _177 => _177.name]) === branch && _optionalChain([destination, 'optionalAccess', _178 => _178.branch, 'optionalAccess', _179 => _179.name]) === this.platformConfig.baseBranchName
4932
+ return _optionalChain([values, 'optionalAccess', _168 => _168.find, 'call', _169 => _169(
4933
+ ({ source, destination }) => _optionalChain([source, 'optionalAccess', _170 => _170.branch, 'optionalAccess', _171 => _171.name]) === branch && _optionalChain([destination, 'optionalAccess', _172 => _172.branch, 'optionalAccess', _173 => _173.name]) === this.platformConfig.baseBranchName
5246
4934
  )]);
5247
- }).then((pr) => _optionalChain([pr, 'optionalAccess', _180 => _180.id]));
4935
+ }).then((pr) => _optionalChain([pr, 'optionalAccess', _174 => _174.id]));
5248
4936
  }
5249
4937
  async closePullRequest({ pullRequestNumber }) {
5250
4938
  await this.bb.repositories.declinePullRequest({
@@ -5330,7 +5018,7 @@ var GitHubPlatformKit = class extends PlatformKit {
5330
5018
  repo: this.platformConfig.repositoryName,
5331
5019
  base: this.platformConfig.baseBranchName,
5332
5020
  state: "open"
5333
- }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _181 => _181.number]));
5021
+ }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _175 => _175.number]));
5334
5022
  }
5335
5023
  async closePullRequest({ pullRequestNumber }) {
5336
5024
  await this.octokit.rest.pulls.update({
@@ -5443,7 +5131,7 @@ var GitlabPlatformKit = class extends PlatformKit {
5443
5131
  sourceBranch: branch,
5444
5132
  state: "opened"
5445
5133
  });
5446
- return _optionalChain([mergeRequests, 'access', _182 => _182[0], 'optionalAccess', _183 => _183.iid]);
5134
+ return _optionalChain([mergeRequests, 'access', _176 => _176[0], 'optionalAccess', _177 => _177.iid]);
5447
5135
  }
5448
5136
  async closePullRequest({ pullRequestNumber }) {
5449
5137
  await this.gitlab.MergeRequests.edit(this.platformConfig.gitlabProjectId, pullRequestNumber, {
@@ -5496,7 +5184,7 @@ async function main() {
5496
5184
  const { isPullRequestMode } = platformKit.config;
5497
5185
  ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
5498
5186
  const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
5499
- const canRun = await _optionalChain([flow, 'access', _184 => _184.preRun, 'optionalCall', _185 => _185()]);
5187
+ const canRun = await _optionalChain([flow, 'access', _178 => _178.preRun, 'optionalCall', _179 => _179()]);
5500
5188
  if (canRun === false) {
5501
5189
  return;
5502
5190
  }
@@ -5504,7 +5192,7 @@ async function main() {
5504
5192
  if (!hasChanges) {
5505
5193
  return;
5506
5194
  }
5507
- await _optionalChain([flow, 'access', _186 => _186.postRun, 'optionalCall', _187 => _187()]);
5195
+ await _optionalChain([flow, 'access', _180 => _180.postRun, 'optionalCall', _181 => _181()]);
5508
5196
  }
5509
5197
 
5510
5198
  // src/cli/cmd/ci.ts
@@ -5526,7 +5214,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
5526
5214
  }
5527
5215
  const env = {
5528
5216
  LINGODOTDEV_API_KEY: settings.auth.apiKey,
5529
- LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _188 => _188.pullRequest, 'optionalAccess', _189 => _189.toString, 'call', _190 => _190()]) || "false",
5217
+ LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _182 => _182.pullRequest, 'optionalAccess', _183 => _183.toString, 'call', _184 => _184()]) || "false",
5530
5218
  ...options.commitMessage && { LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage },
5531
5219
  ...options.pullRequestTitle && { LINGODOTDEV_PULL_REQUEST_TITLE: options.pullRequestTitle },
5532
5220
  ...options.workingDirectory && { LINGODOTDEV_WORKING_DIRECTORY: options.workingDirectory },
@@ -5577,13 +5265,13 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
5577
5265
  flags
5578
5266
  });
5579
5267
  let buckets = getBuckets(i18nConfig);
5580
- if (_optionalChain([flags, 'access', _191 => _191.bucket, 'optionalAccess', _192 => _192.length])) {
5268
+ if (_optionalChain([flags, 'access', _185 => _185.bucket, 'optionalAccess', _186 => _186.length])) {
5581
5269
  buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
5582
5270
  }
5583
5271
  ora.succeed("Buckets retrieved");
5584
- if (_optionalChain([flags, 'access', _193 => _193.file, 'optionalAccess', _194 => _194.length])) {
5272
+ if (_optionalChain([flags, 'access', _187 => _187.file, 'optionalAccess', _188 => _188.length])) {
5585
5273
  buckets = buckets.map((bucket) => {
5586
- const paths = bucket.paths.filter((path18) => flags.file.find((file) => _optionalChain([path18, 'access', _195 => _195.pathPattern, 'optionalAccess', _196 => _196.match, 'call', _197 => _197(file)])));
5274
+ const paths = bucket.paths.filter((path17) => flags.file.find((file) => _optionalChain([path17, 'access', _189 => _189.pathPattern, 'optionalAccess', _190 => _190.match, 'call', _191 => _191(file)])));
5587
5275
  return { ...bucket, paths };
5588
5276
  }).filter((bucket) => bucket.paths.length > 0);
5589
5277
  if (buckets.length === 0) {
@@ -5593,13 +5281,13 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
5593
5281
  ora.info(`\x1B[36mProcessing only filtered buckets:\x1B[0m`);
5594
5282
  buckets.map((bucket) => {
5595
5283
  ora.info(` ${bucket.type}:`);
5596
- bucket.paths.forEach((path18) => {
5597
- ora.info(` - ${path18.pathPattern}`);
5284
+ bucket.paths.forEach((path17) => {
5285
+ ora.info(` - ${path17.pathPattern}`);
5598
5286
  });
5599
5287
  });
5600
5288
  }
5601
5289
  }
5602
- const targetLocales = _optionalChain([flags, 'access', _198 => _198.locale, 'optionalAccess', _199 => _199.length]) ? flags.locale : i18nConfig.locale.targets;
5290
+ const targetLocales = _optionalChain([flags, 'access', _192 => _192.locale, 'optionalAccess', _193 => _193.length]) ? flags.locale : i18nConfig.locale.targets;
5603
5291
  let totalSourceKeyCount = 0;
5604
5292
  let uniqueKeysToTranslate = 0;
5605
5293
  let totalExistingTranslations = 0;
@@ -5823,10 +5511,10 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
5823
5511
  if (flags.confirm && Object.keys(fileStats).length > 0) {
5824
5512
  console.log(_chalk2.default.bold(`
5825
5513
  \u{1F4D1} BREAKDOWN BY FILE:`));
5826
- Object.entries(fileStats).sort((a, b) => b[1].wordCount - a[1].wordCount).forEach(([path18, stats]) => {
5514
+ Object.entries(fileStats).sort((a, b) => b[1].wordCount - a[1].wordCount).forEach(([path17, stats]) => {
5827
5515
  if (stats.sourceKeys === 0) return;
5828
5516
  console.log(_chalk2.default.bold(`
5829
- \u2022 ${path18}:`));
5517
+ \u2022 ${path17}:`));
5830
5518
  console.log(` ${stats.sourceKeys} source keys, ~${stats.wordCount.toLocaleString()} source words`);
5831
5519
  const fileTable = new (0, _clitable32.default)({
5832
5520
  head: ["Language", "Status", "Details"],
@@ -5940,12 +5628,12 @@ function validateParams2(i18nConfig, flags) {
5940
5628
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
5941
5629
  docUrl: "bucketNotFound"
5942
5630
  });
5943
- } else if (_optionalChain([flags, 'access', _200 => _200.locale, 'optionalAccess', _201 => _201.some, 'call', _202 => _202((locale) => !i18nConfig.locale.targets.includes(locale))])) {
5631
+ } else if (_optionalChain([flags, 'access', _194 => _194.locale, 'optionalAccess', _195 => _195.some, 'call', _196 => _196((locale) => !i18nConfig.locale.targets.includes(locale))])) {
5944
5632
  throw new CLIError({
5945
5633
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
5946
5634
  docUrl: "localeTargetNotFound"
5947
5635
  });
5948
- } else if (_optionalChain([flags, 'access', _203 => _203.bucket, 'optionalAccess', _204 => _204.some, 'call', _205 => _205((bucket) => !i18nConfig.buckets[bucket])])) {
5636
+ } else if (_optionalChain([flags, 'access', _197 => _197.bucket, 'optionalAccess', _198 => _198.some, 'call', _199 => _199((bucket) => !i18nConfig.buckets[bucket])])) {
5949
5637
  throw new CLIError({
5950
5638
  message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
5951
5639
  docUrl: "bucketNotFound"
@@ -5956,7 +5644,7 @@ function validateParams2(i18nConfig, flags) {
5956
5644
  // package.json
5957
5645
  var package_default = {
5958
5646
  name: "lingo.dev",
5959
- version: "0.87.0",
5647
+ version: "0.87.2",
5960
5648
  description: "Lingo.dev CLI",
5961
5649
  private: false,
5962
5650
  publishConfig: {