lingo.dev 0.74.15 → 0.74.16

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
@@ -25,9 +25,9 @@ function getSettings(explicitApiKey) {
25
25
  _legacyEnvVarWarning();
26
26
  return {
27
27
  auth: {
28
- apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access', _21 => _21.auth, 'optionalAccess', _22 => _22.apiKey]) || defaults.auth.apiKey,
29
- apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _23 => _23.auth, 'optionalAccess', _24 => _24.apiUrl]) || defaults.auth.apiUrl,
30
- webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _25 => _25.auth, 'optionalAccess', _26 => _26.webUrl]) || defaults.auth.webUrl
28
+ apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access', _22 => _22.auth, 'optionalAccess', _23 => _23.apiKey]) || defaults.auth.apiKey,
29
+ apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _24 => _24.auth, 'optionalAccess', _25 => _25.apiUrl]) || defaults.auth.apiUrl,
30
+ webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _26 => _26.auth, 'optionalAccess', _27 => _27.webUrl]) || defaults.auth.webUrl
31
31
  }
32
32
  };
33
33
  }
@@ -137,7 +137,7 @@ function createAuthenticator(params) {
137
137
  });
138
138
  if (res.ok) {
139
139
  const payload = await res.json();
140
- if (!_optionalChain([payload, 'optionalAccess', _27 => _27.email])) {
140
+ if (!_optionalChain([payload, 'optionalAccess', _28 => _28.email])) {
141
141
  return null;
142
142
  }
143
143
  return {
@@ -269,9 +269,167 @@ function _getConfigFilePath() {
269
269
  var _child_process = require('child_process');
270
270
 
271
271
  var _prompts = require('@inquirer/prompts');
272
- var openUrl = (path9) => {
272
+
273
+ // src/cli/utils/find-locale-paths.ts
274
+
275
+ var _glob = require('glob'); var glob2 = _interopRequireWildcard(_glob);
276
+
277
+
278
+ function findLocaleFiles(bucket) {
279
+ switch (bucket) {
280
+ case "json":
281
+ return findLocaleFilesWithExtension(".json");
282
+ case "yaml":
283
+ return findLocaleFilesWithExtension(".yml");
284
+ case "flutter":
285
+ return findLocaleFilesWithExtension(".arb");
286
+ case "android":
287
+ return findLocaleFilesWithExtension(".xml");
288
+ case "markdown":
289
+ return findLocaleFilesWithExtension(".md");
290
+ case "xcode-xcstrings":
291
+ return findLocaleFilesForFilename("Localizable.xcstrings");
292
+ case "xcode-strings":
293
+ return findLocaleFilesForFilename("Localizable.strings");
294
+ case "xcode-stringsdict":
295
+ return findLocaleFilesForFilename("Localizable.stringsdict");
296
+ default:
297
+ throw new Error(`Unsupported bucket type: ${bucket}`);
298
+ }
299
+ }
300
+ function findLocaleFilesWithExtension(ext) {
301
+ const files = _glob.glob.sync(`**/*${ext}`, {
302
+ ignore: ["node_modules/**", "package*.json", "i18n.json", "lingo.json"]
303
+ });
304
+ const localeFilePattern = new RegExp(`[/\\\\]([a-z]{2}(-[A-Z]{2})?)${ext}$`);
305
+ const localeDirectoryPattern = new RegExp(`[/\\\\]([a-z]{2}(-[A-Z]{2})?)[/\\\\][^/\\\\]+${ext}$`);
306
+ const potentialLocaleFiles = files.filter(
307
+ (file) => localeFilePattern.test(file) || localeDirectoryPattern.test(file)
308
+ );
309
+ const localeFilesAndPatterns = potentialLocaleFiles.map((file) => {
310
+ const match = file.match(new RegExp(`[/|\\\\]([a-z]{2}(-[A-Z]{2})?)(/|\\\\|${ext})`));
311
+ const locale = _optionalChain([match, 'optionalAccess', _29 => _29[1]]);
312
+ const localeInDir = _optionalChain([match, 'optionalAccess', _30 => _30[3]]) !== ext;
313
+ const filePattern = localeInDir ? file.replace(`/${locale}/`, `/[locale]/`) : _path2.default.join(_path2.default.dirname(file), `[locale]${ext}`);
314
+ return { file, locale, pattern: filePattern };
315
+ }).filter(({ locale }) => {
316
+ try {
317
+ __spec.resolveLocaleCode.call(void 0, locale);
318
+ return true;
319
+ } catch (e) {
320
+ }
321
+ return false;
322
+ });
323
+ const grouppedFilesAndPatterns = _lodash2.default.groupBy(localeFilesAndPatterns, "pattern");
324
+ const patterns = Object.keys(grouppedFilesAndPatterns);
325
+ if (patterns.length > 0) {
326
+ return { found: true, patterns };
327
+ }
328
+ return { found: false, patterns: [`i18n/[locale]${ext}`] };
329
+ }
330
+ function findLocaleFilesForFilename(fileName) {
331
+ const pattern = fileName;
332
+ const localeFiles = _glob.glob.sync(`**/${fileName}`, {
333
+ ignore: ["node_modules/**", "package*.json", "i18n.json", "lingo.json"]
334
+ });
335
+ const localeFilesAndPatterns = localeFiles.map((file) => ({
336
+ file,
337
+ pattern: _path2.default.join(_path2.default.dirname(file), pattern)
338
+ }));
339
+ const grouppedFilesAndPatterns = _lodash2.default.groupBy(localeFilesAndPatterns, "pattern");
340
+ const patterns = Object.keys(grouppedFilesAndPatterns);
341
+ if (patterns.length > 0) {
342
+ return { found: true, patterns };
343
+ }
344
+ return { found: false, patterns: [fileName] };
345
+ }
346
+
347
+ // src/cli/utils/ensure-patterns.ts
348
+
349
+
350
+ function ensurePatterns(patterns, source) {
351
+ if (patterns.length === 0) {
352
+ throw new Error("No patterns found");
353
+ }
354
+ patterns.forEach((pattern) => {
355
+ const filePath = pattern.replace("[locale]", source);
356
+ if (!_fs2.default.existsSync(filePath)) {
357
+ const defaultContent = getDefaultContent(_path2.default.extname(filePath), source);
358
+ _fs2.default.mkdirSync(_path2.default.dirname(filePath), { recursive: true });
359
+ _fs2.default.writeFileSync(filePath, defaultContent);
360
+ }
361
+ });
362
+ }
363
+ function getDefaultContent(ext, source) {
364
+ const defaultGreeting = "Hello from Lingo.dev";
365
+ switch (ext) {
366
+ case ".json":
367
+ case ".arb":
368
+ return `{
369
+ "greeting": "${defaultGreeting}"
370
+ }`;
371
+ case ".yml":
372
+ return `${source}:
373
+ greeting: "${defaultGreeting}"`;
374
+ case ".xml":
375
+ return `<resources>
376
+ <string name="greeting">${defaultGreeting}</string>
377
+ </resources>`;
378
+ case ".md":
379
+ return `# ${defaultGreeting}`;
380
+ case ".xcstrings":
381
+ return `{
382
+ "sourceLanguage" : "${source}",
383
+ "strings" : {
384
+ "${defaultGreeting}" : {
385
+ "extractionState" : "manual",
386
+ "localizations" : {
387
+ "${source}" : {
388
+ "stringUnit" : {
389
+ "state" : "translated",
390
+ "value" : "${defaultGreeting}"
391
+ }
392
+ }
393
+ }
394
+ }
395
+ }
396
+ }`;
397
+ case ".strings":
398
+ return `"greeting" = "${defaultGreeting}";`;
399
+ case ".stringsdict":
400
+ return `<?xml version="1.0" encoding="UTF-8"?>
401
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
402
+ <plist version="1.0">
403
+ <dict>
404
+ <key>key</key>
405
+ <dict>
406
+ <key>NSStringLocalizedFormatKey</key>
407
+ <string>%#@count@</string>
408
+ <key>count</key>
409
+ <dict>
410
+ <key>NSStringFormatSpecTypeKey</key>
411
+ <string>NSStringPluralRuleType</string>
412
+ <key>NSStringFormatValueTypeKey</key>
413
+ <string>d</string>
414
+ <key>zero</key>
415
+ <string>No items</string>
416
+ <key>one</key>
417
+ <string>One item</string>
418
+ <key>other</key>
419
+ <string>%d items</string>
420
+ </dict>
421
+ </dict>
422
+ </dict>
423
+ </plist>`;
424
+ default:
425
+ throw new Error(`Unsupported file extension: ${ext}`);
426
+ }
427
+ }
428
+
429
+ // src/cli/cmd/init.ts
430
+ var openUrl = (path11) => {
273
431
  const settings = getSettings(void 0);
274
- _child_process.spawn.call(void 0, "open", [`${settings.auth.webUrl}${path9}`]);
432
+ _child_process.spawn.call(void 0, "open", [`${settings.auth.webUrl}${path11}`]);
275
433
  };
276
434
  var throwHelpError = (option, value) => {
277
435
  if (value === "help") {
@@ -327,9 +485,10 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
327
485
  }
328
486
  }
329
487
  return values;
330
- }).default([])
488
+ }).prompt(void 0).default([])
331
489
  ).action(async (options) => {
332
490
  const settings = getSettings(void 0);
491
+ const isInteractive = options.interactive;
333
492
  const spinner = _ora2.default.call(void 0, ).start("Initializing Lingo.dev project");
334
493
  let existingConfig = await getConfig(false);
335
494
  if (existingConfig && !options.force) {
@@ -339,14 +498,47 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
339
498
  const newConfig = _lodash2.default.cloneDeep(__spec.defaultConfig);
340
499
  newConfig.locale.source = options.source;
341
500
  newConfig.locale.targets = options.targets;
342
- newConfig.buckets = {
343
- [options.bucket]: {
344
- include: options.paths || []
501
+ if (!isInteractive) {
502
+ newConfig.buckets = {
503
+ [options.bucket]: {
504
+ include: options.paths || []
505
+ }
506
+ };
507
+ } else {
508
+ let selectedPatterns = [];
509
+ const { found, patterns } = findLocaleFiles(options.bucket);
510
+ if (found) {
511
+ spinner.succeed("Found existing locale files:");
512
+ selectedPatterns = await _prompts.checkbox.call(void 0, {
513
+ message: "Select the paths to use",
514
+ choices: patterns.map((value) => ({
515
+ value
516
+ }))
517
+ });
518
+ } else {
519
+ spinner.succeed("No existing locale files found.");
520
+ const useDefault = await _prompts.confirm.call(void 0, {
521
+ message: `Use default path ${patterns.join(", ")}?`
522
+ });
523
+ ensurePatterns(patterns, options.source);
524
+ if (useDefault) {
525
+ selectedPatterns = patterns;
526
+ }
345
527
  }
346
- };
528
+ if (selectedPatterns.length === 0) {
529
+ const customPaths = await _prompts.input.call(void 0, {
530
+ message: "Enter paths to use"
531
+ });
532
+ selectedPatterns = customPaths.includes(",") ? customPaths.split(",") : customPaths.split(" ");
533
+ }
534
+ newConfig.buckets = {
535
+ [options.bucket]: {
536
+ include: selectedPatterns || []
537
+ }
538
+ };
539
+ }
347
540
  await saveConfig(newConfig);
348
541
  spinner.succeed("Lingo.dev project initialized");
349
- const isInteractive = !process.argv.includes("-y") && !process.argv.includes("--no-interactive");
350
542
  if (isInteractive) {
351
543
  const openDocs = await _prompts.confirm.call(void 0, { message: "Would you like to see our docs?" });
352
544
  if (openDocs) {
@@ -373,7 +565,7 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
373
565
  });
374
566
  const auth2 = await newAuthenticator.whoami();
375
567
  if (auth2) {
376
- _ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _28 => _28.email])}`);
568
+ _ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _31 => _31.email])}`);
377
569
  } else {
378
570
  _ora2.default.call(void 0, ).fail("Authentication failed.");
379
571
  }
@@ -447,12 +639,12 @@ var locale_default = new (0, _interactivecommander.Command)().command("locale").
447
639
  // src/cli/utils/buckets.ts
448
640
 
449
641
 
450
- var _glob = require('glob'); var glob = _interopRequireWildcard(_glob);
642
+
451
643
 
452
644
  function getBuckets(i18nConfig) {
453
645
  const result = Object.entries(i18nConfig.buckets).map(([bucketType, bucketEntry]) => {
454
646
  const includeItems = bucketEntry.include.map((item) => resolveBucketItem(item));
455
- const excludeItems = _optionalChain([bucketEntry, 'access', _29 => _29.exclude, 'optionalAccess', _30 => _30.map, 'call', _31 => _31((item) => resolveBucketItem(item))]);
647
+ const excludeItems = _optionalChain([bucketEntry, 'access', _32 => _32.exclude, 'optionalAccess', _33 => _33.map, 'call', _34 => _34((item) => resolveBucketItem(item))]);
456
648
  return {
457
649
  type: bucketType,
458
650
  config: extractPathPatterns(i18nConfig.locale.source, includeItems, excludeItems)
@@ -469,7 +661,7 @@ function extractPathPatterns(sourceLocale, include, exclude) {
469
661
  })
470
662
  )
471
663
  );
472
- const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _32 => _32.flatMap, 'call', _33 => _33(
664
+ const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _35 => _35.flatMap, 'call', _36 => _36(
473
665
  (pattern) => expandPlaceholderedGlob(pattern.path, __spec.resolveOverridenLocale.call(void 0, sourceLocale, pattern.delimiter)).map(
474
666
  (pathPattern) => ({
475
667
  pathPattern,
@@ -503,9 +695,9 @@ function expandPlaceholderedGlob(_pathPattern, sourceLocale) {
503
695
  }
504
696
  const pathPatternChunks = pathPattern.split(_path2.default.sep);
505
697
  const localeSegmentIndex = pathPatternChunks.findIndex((segment) => segment.includes("[locale]"));
506
- const localePlaceholderIndex = _nullishCoalesce(_optionalChain([pathPatternChunks, 'access', _34 => _34[localeSegmentIndex], 'optionalAccess', _35 => _35.indexOf, 'call', _36 => _36("[locale]")]), () => ( -1));
698
+ const localePlaceholderIndex = _nullishCoalesce(_optionalChain([pathPatternChunks, 'access', _37 => _37[localeSegmentIndex], 'optionalAccess', _38 => _38.indexOf, 'call', _39 => _39("[locale]")]), () => ( -1));
507
699
  const sourcePathPattern = pathPattern.replace(/\[locale\]/g, sourceLocale);
508
- const sourcePaths = glob.sync(sourcePathPattern, { follow: true, withFileTypes: true }).filter((file) => file.isFile() || file.isSymbolicLink()).map((file) => file.fullpath()).map((fullpath) => _path2.default.relative(process.cwd(), fullpath));
700
+ const sourcePaths = glob2.sync(sourcePathPattern, { follow: true, withFileTypes: true }).filter((file) => file.isFile() || file.isSymbolicLink()).map((file) => file.fullpath()).map((fullpath) => _path2.default.relative(process.cwd(), fullpath));
509
701
  const placeholderedPaths = sourcePaths.map((sourcePath) => {
510
702
  const sourcePathChunks = sourcePath.split(_path2.default.sep);
511
703
  if (localeSegmentIndex >= 0 && localePlaceholderIndex >= 0) {
@@ -555,8 +747,8 @@ var files_default = new (0, _interactivecommander.Command)().command("files").de
555
747
  } else if (type.target) {
556
748
  result.push(...targetPaths);
557
749
  }
558
- result.forEach((path9) => {
559
- console.log(path9);
750
+ result.forEach((path11) => {
751
+ console.log(path11);
560
752
  });
561
753
  }
562
754
  }
@@ -588,17 +780,17 @@ function composeLoaders(...loaders) {
588
780
  return {
589
781
  init: async () => {
590
782
  for (const loader of loaders) {
591
- await _optionalChain([loader, 'access', _37 => _37.init, 'optionalCall', _38 => _38()]);
783
+ await _optionalChain([loader, 'access', _40 => _40.init, 'optionalCall', _41 => _41()]);
592
784
  }
593
785
  },
594
786
  setDefaultLocale(locale) {
595
787
  for (const loader of loaders) {
596
- _optionalChain([loader, 'access', _39 => _39.setDefaultLocale, 'optionalCall', _40 => _40(locale)]);
788
+ _optionalChain([loader, 'access', _42 => _42.setDefaultLocale, 'optionalCall', _43 => _43(locale)]);
597
789
  }
598
790
  return this;
599
791
  },
600
- pull: async (locale, input) => {
601
- let result = input;
792
+ pull: async (locale, input2) => {
793
+ let result = input2;
602
794
  for (let i = 0; i < loaders.length; i++) {
603
795
  result = await loaders[i].pull(locale, result);
604
796
  }
@@ -624,7 +816,7 @@ function createLoader(lDefinition) {
624
816
  if (state.initCtx) {
625
817
  return state.initCtx;
626
818
  }
627
- state.initCtx = await _optionalChain([lDefinition, 'access', _41 => _41.init, 'optionalCall', _42 => _42()]);
819
+ state.initCtx = await _optionalChain([lDefinition, 'access', _44 => _44.init, 'optionalCall', _45 => _45()]);
628
820
  return state.initCtx;
629
821
  },
630
822
  setDefaultLocale(locale) {
@@ -634,7 +826,7 @@ function createLoader(lDefinition) {
634
826
  state.defaultLocale = locale;
635
827
  return this;
636
828
  },
637
- async pull(locale, input) {
829
+ async pull(locale, input2) {
638
830
  if (!state.defaultLocale) {
639
831
  throw new Error("Default locale not set");
640
832
  }
@@ -642,9 +834,9 @@ function createLoader(lDefinition) {
642
834
  throw new Error("The first pull must be for the default locale");
643
835
  }
644
836
  if (locale === state.defaultLocale) {
645
- state.originalInput = input || null;
837
+ state.originalInput = input2 || null;
646
838
  }
647
- return lDefinition.pull(locale, input, state.initCtx);
839
+ return lDefinition.pull(locale, input2, state.initCtx);
648
840
  },
649
841
  async push(locale, data) {
650
842
  if (!state.defaultLocale) {
@@ -663,8 +855,8 @@ function createLoader(lDefinition) {
663
855
  var _jsonrepair = require('jsonrepair');
664
856
  function createJsonLoader() {
665
857
  return createLoader({
666
- pull: async (locale, input) => {
667
- const jsonString = input || "{}";
858
+ pull: async (locale, input2) => {
859
+ const jsonString = input2 || "{}";
668
860
  let result;
669
861
  try {
670
862
  result = JSON.parse(jsonString);
@@ -685,30 +877,43 @@ var _flat = require('flat');
685
877
 
686
878
  var OBJECT_NUMERIC_KEY_PREFIX = "__lingodotdev__obj__";
687
879
  function createFlatLoader() {
688
- let denormalizedKeysMap = {};
880
+ return composeLoaders(createDenormalizeLoader(), createNormalizeLoader());
881
+ }
882
+ function createDenormalizeLoader() {
689
883
  return createLoader({
690
- pull: async (locale, input) => {
691
- const denormalized = denormalizeObjectKeys(input || {});
692
- const flattened = _flat.flatten.call(void 0, denormalized, {
884
+ pull: async (locale, input2) => {
885
+ const inputDenormalized = denormalizeObjectKeys(input2 || {});
886
+ const denormalized = _flat.flatten.call(void 0, inputDenormalized, {
693
887
  delimiter: "/",
694
888
  transformKey(key) {
695
889
  return encodeURIComponent(String(key));
696
890
  }
697
891
  });
698
- denormalizedKeysMap = { ...denormalizedKeysMap, ...buildDenormalizedKeysMap(flattened) };
699
- const normalized = normalizeObjectKeys(flattened);
892
+ const keysMap = buildDenormalizedKeysMap(denormalized);
893
+ return { denormalized, keysMap };
894
+ },
895
+ push: async (locale, { denormalized }) => {
896
+ const normalized = normalizeObjectKeys(denormalized);
897
+ return normalized;
898
+ }
899
+ });
900
+ }
901
+ function createNormalizeLoader() {
902
+ return createLoader({
903
+ pull: async (locale, input2) => {
904
+ const normalized = normalizeObjectKeys(input2.denormalized);
700
905
  return normalized;
701
906
  },
702
- push: async (locale, data) => {
703
- const denormalized = mapDenormalizedKeys(data, denormalizedKeysMap);
704
- const unflattened = _flat.unflatten.call(void 0, denormalized || {}, {
907
+ push: async (locale, data, originalInput) => {
908
+ const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _46 => _46.keysMap]), () => ( {}));
909
+ const input2 = mapDenormalizedKeys(data, keysMap);
910
+ const denormalized = _flat.unflatten.call(void 0, input2, {
705
911
  delimiter: "/",
706
912
  transformKey(key) {
707
913
  return decodeURIComponent(String(key));
708
914
  }
709
915
  });
710
- const normalized = normalizeObjectKeys(unflattened);
711
- return normalized;
916
+ return { denormalized, keysMap: keysMap || {} };
712
917
  }
713
918
  });
714
919
  }
@@ -728,7 +933,7 @@ function buildDenormalizedKeysMap(obj) {
728
933
  function mapDenormalizedKeys(obj, denormalizedKeysMap) {
729
934
  return Object.keys(obj).reduce(
730
935
  (acc, key) => {
731
- const denormalizedKey = denormalizedKeysMap[key];
936
+ const denormalizedKey = _nullishCoalesce(denormalizedKeysMap[key], () => ( key));
732
937
  acc[denormalizedKey] = obj[key];
733
938
  return acc;
734
939
  },
@@ -774,7 +979,7 @@ function createTextFileLoader(pathPattern) {
774
979
  const trimmedResult = result.trim();
775
980
  return trimmedResult;
776
981
  },
777
- async push(locale, data, _20, originalLocale) {
982
+ async push(locale, data, _21, originalLocale) {
778
983
  const draftPath = pathPattern.replace("[locale]", locale);
779
984
  const finalPath = _path2.default.resolve(draftPath);
780
985
  const dirPath = _path2.default.dirname(finalPath);
@@ -803,8 +1008,8 @@ async function getTrailingNewLine(pathPattern, locale, originalLocale) {
803
1008
  if (!templateData) {
804
1009
  templateData = await readFileForLocale(pathPattern, originalLocale);
805
1010
  }
806
- if (_optionalChain([templateData, 'optionalAccess', _43 => _43.match, 'call', _44 => _44(/[\r\n]$/)])) {
807
- const ending = _optionalChain([templateData, 'optionalAccess', _45 => _45.includes, 'call', _46 => _46("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _47 => _47.includes, 'call', _48 => _48("\r")]) ? "\r" : "\n";
1011
+ if (_optionalChain([templateData, 'optionalAccess', _47 => _47.match, 'call', _48 => _48(/[\r\n]$/)])) {
1012
+ 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";
808
1013
  return ending;
809
1014
  }
810
1015
  return "";
@@ -814,8 +1019,8 @@ async function getTrailingNewLine(pathPattern, locale, originalLocale) {
814
1019
  var _yaml = require('yaml'); var _yaml2 = _interopRequireDefault(_yaml);
815
1020
  function createYamlLoader() {
816
1021
  return createLoader({
817
- async pull(locale, input) {
818
- return _yaml2.default.parse(input) || {};
1022
+ async pull(locale, input2) {
1023
+ return _yaml2.default.parse(input2) || {};
819
1024
  },
820
1025
  async push(locale, payload) {
821
1026
  return _yaml2.default.stringify(payload, {
@@ -828,8 +1033,8 @@ function createYamlLoader() {
828
1033
  // src/cli/loaders/root-key.ts
829
1034
  function createRootKeyLoader(replaceAll = false) {
830
1035
  return createLoader({
831
- async pull(locale, input) {
832
- const result = input[locale];
1036
+ async pull(locale, input2) {
1037
+ const result = input2[locale];
833
1038
  return result;
834
1039
  },
835
1040
  async push(locale, data, originalInput) {
@@ -846,8 +1051,8 @@ function createRootKeyLoader(replaceAll = false) {
846
1051
 
847
1052
  function createFlutterLoader() {
848
1053
  return createLoader({
849
- async pull(locale, input) {
850
- const result = _lodash2.default.pickBy(input, (value, key) => !key.startsWith("@"));
1054
+ async pull(locale, input2) {
1055
+ const result = _lodash2.default.pickBy(input2, (value, key) => !key.startsWith("@"));
851
1056
  return result;
852
1057
  },
853
1058
  async push(locale, data, originalInput) {
@@ -861,10 +1066,10 @@ function createFlutterLoader() {
861
1066
  var _xml2js = require('xml2js');
862
1067
  function createAndroidLoader() {
863
1068
  return createLoader({
864
- async pull(locale, input) {
1069
+ async pull(locale, input2) {
865
1070
  try {
866
1071
  const result = {};
867
- const parsed = !input ? { resources: {} } : await _xml2js.parseStringPromise.call(void 0, input, { explicitArray: true });
1072
+ const parsed = !input2 ? { resources: {} } : await _xml2js.parseStringPromise.call(void 0, input2, { explicitArray: true });
868
1073
  if (!parsed || !parsed.resources) {
869
1074
  console.warn("No resources found in the Android resource file");
870
1075
  return result;
@@ -957,12 +1162,12 @@ var _sync3 = require('csv-stringify/sync');
957
1162
  function createCsvLoader() {
958
1163
  return createLoader({
959
1164
  async pull(locale, _input) {
960
- const input = _sync.parse.call(void 0, _input, {
1165
+ const input2 = _sync.parse.call(void 0, _input, {
961
1166
  columns: true,
962
1167
  skip_empty_lines: true
963
1168
  });
964
1169
  const result = {};
965
- _lodash2.default.forEach(input, (row) => {
1170
+ _lodash2.default.forEach(input2, (row) => {
966
1171
  const key = row.id;
967
1172
  if (key && row[locale] && row[locale].trim() !== "") {
968
1173
  result[key] = row[locale];
@@ -971,16 +1176,16 @@ function createCsvLoader() {
971
1176
  return result;
972
1177
  },
973
1178
  async push(locale, data, originalInput) {
974
- const input = _sync.parse.call(void 0, originalInput || "", {
1179
+ const input2 = _sync.parse.call(void 0, originalInput || "", {
975
1180
  columns: true,
976
1181
  skip_empty_lines: true
977
1182
  });
978
- const columns = input.length > 0 ? Object.keys(input[0]) : ["id", locale];
979
- const updatedRows = input.map((row) => ({
1183
+ const columns = input2.length > 0 ? Object.keys(input2[0]) : ["id", locale];
1184
+ const updatedRows = input2.map((row) => ({
980
1185
  ...row,
981
1186
  [locale]: data[row.id] || row[locale] || ""
982
1187
  }));
983
- const existingKeys = new Set(input.map((row) => row.id));
1188
+ const existingKeys = new Set(input2.map((row) => row.id));
984
1189
  Object.entries(data).forEach(([key, value]) => {
985
1190
  if (!existingKeys.has(key)) {
986
1191
  const newRow = {
@@ -1015,9 +1220,9 @@ function createHtmlLoader() {
1015
1220
  };
1016
1221
  const UNLOCALIZABLE_TAGS = ["script", "style"];
1017
1222
  return createLoader({
1018
- async pull(locale, input) {
1223
+ async pull(locale, input2) {
1019
1224
  const result = {};
1020
- const dom = new (0, _jsdom.JSDOM)(input);
1225
+ const dom = new (0, _jsdom.JSDOM)(input2);
1021
1226
  const document = dom.window.document;
1022
1227
  const getPath = (node, attribute) => {
1023
1228
  const indices = [];
@@ -1031,7 +1236,7 @@ function createHtmlLoader() {
1031
1236
  break;
1032
1237
  }
1033
1238
  const siblings = Array.from(parent.childNodes).filter(
1034
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _49 => _49.textContent, 'optionalAccess', _50 => _50.trim, 'call', _51 => _51()])
1239
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _53 => _53.textContent, 'optionalAccess', _54 => _54.trim, 'call', _55 => _55()])
1035
1240
  );
1036
1241
  const index = siblings.indexOf(current);
1037
1242
  if (index !== -1) {
@@ -1066,11 +1271,11 @@ function createHtmlLoader() {
1066
1271
  result[getPath(element, attr)] = value;
1067
1272
  }
1068
1273
  });
1069
- Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _52 => _52.textContent, 'optionalAccess', _53 => _53.trim, 'call', _54 => _54()])).forEach(processNode);
1274
+ 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);
1070
1275
  }
1071
1276
  };
1072
- Array.from(document.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _55 => _55.textContent, 'optionalAccess', _56 => _56.trim, 'call', _57 => _57()])).forEach(processNode);
1073
- Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _58 => _58.textContent, 'optionalAccess', _59 => _59.trim, 'call', _60 => _60()])).forEach(processNode);
1277
+ 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);
1278
+ 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);
1074
1279
  return result;
1075
1280
  },
1076
1281
  async push(locale, data, originalInput) {
@@ -1083,16 +1288,16 @@ function createHtmlLoader() {
1083
1288
  const bDepth = b.split("/").length;
1084
1289
  return aDepth - bDepth;
1085
1290
  });
1086
- paths.forEach((path9) => {
1087
- const value = data[path9];
1088
- const [nodePath, attribute] = path9.split("#");
1291
+ paths.forEach((path11) => {
1292
+ const value = data[path11];
1293
+ const [nodePath, attribute] = path11.split("#");
1089
1294
  const [rootTag, ...indices] = nodePath.split("/");
1090
1295
  let parent = rootTag === "head" ? document.head : document.body;
1091
1296
  let current = parent;
1092
1297
  for (let i = 0; i < indices.length; i++) {
1093
1298
  const index = parseInt(indices[i]);
1094
1299
  const siblings = Array.from(parent.childNodes).filter(
1095
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _61 => _61.textContent, 'optionalAccess', _62 => _62.trim, 'call', _63 => _63()])
1300
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _65 => _65.textContent, 'optionalAccess', _66 => _66.trim, 'call', _67 => _67()])
1096
1301
  );
1097
1302
  if (index >= siblings.length) {
1098
1303
  if (i === indices.length - 1) {
@@ -1137,8 +1342,8 @@ var yamlEngine = {
1137
1342
  };
1138
1343
  function createMarkdownLoader() {
1139
1344
  return createLoader({
1140
- async pull(locale, input) {
1141
- const { data: frontmatter, content } = _graymatter2.default.call(void 0, input, {
1345
+ async pull(locale, input2) {
1346
+ const { data: frontmatter, content } = _graymatter2.default.call(void 0, input2, {
1142
1347
  engines: {
1143
1348
  yaml: yamlEngine
1144
1349
  }
@@ -1188,7 +1393,7 @@ function createPropertiesLoader() {
1188
1393
  return result;
1189
1394
  },
1190
1395
  async push(locale, payload) {
1191
- const result = Object.entries(payload).filter(([_20, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
1396
+ const result = Object.entries(payload).filter(([_21, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
1192
1397
  return result;
1193
1398
  }
1194
1399
  });
@@ -1199,7 +1404,7 @@ function isSkippableLine(line) {
1199
1404
  function parsePropertyLine(line) {
1200
1405
  const [key, ...valueParts] = line.split("=");
1201
1406
  return {
1202
- key: _optionalChain([key, 'optionalAccess', _64 => _64.trim, 'call', _65 => _65()]) || "",
1407
+ key: _optionalChain([key, 'optionalAccess', _68 => _68.trim, 'call', _69 => _69()]) || "",
1203
1408
  value: valueParts.join("=").trim()
1204
1409
  };
1205
1410
  }
@@ -1207,8 +1412,8 @@ function parsePropertyLine(line) {
1207
1412
  // src/cli/loaders/xcode-strings.ts
1208
1413
  function createXcodeStringsLoader() {
1209
1414
  return createLoader({
1210
- async pull(locale, input) {
1211
- const lines = input.split("\n");
1415
+ async pull(locale, input2) {
1416
+ const lines = input2.split("\n");
1212
1417
  const result = {};
1213
1418
  for (const line of lines) {
1214
1419
  const trimmedLine = line.trim();
@@ -1249,9 +1454,9 @@ var emptyData = [
1249
1454
  ].join("\n");
1250
1455
  function createXcodeStringsdictLoader() {
1251
1456
  return createLoader({
1252
- async pull(locale, input) {
1457
+ async pull(locale, input2) {
1253
1458
  try {
1254
- const parsed = _plist2.default.parse(input || emptyData);
1459
+ const parsed = _plist2.default.parse(input2 || emptyData);
1255
1460
  if (typeof parsed !== "object" || parsed === null) {
1256
1461
  throw new CLIError({
1257
1462
  message: "Invalid .stringsdict format",
@@ -1277,11 +1482,11 @@ function createXcodeStringsdictLoader() {
1277
1482
 
1278
1483
  function createXcodeXcstringsLoader() {
1279
1484
  return createLoader({
1280
- async pull(locale, input) {
1485
+ async pull(locale, input2) {
1281
1486
  const resultData = {};
1282
- for (const [translationKey, _translationEntity] of Object.entries(input.strings)) {
1487
+ for (const [translationKey, _translationEntity] of Object.entries(input2.strings)) {
1283
1488
  const rootTranslationEntity = _translationEntity;
1284
- const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _66 => _66.localizations, 'optionalAccess', _67 => _67[locale]]);
1489
+ const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _70 => _70.localizations, 'optionalAccess', _71 => _71[locale]]);
1285
1490
  if (langTranslationEntity) {
1286
1491
  if ("stringUnit" in langTranslationEntity) {
1287
1492
  resultData[translationKey] = langTranslationEntity.stringUnit.value;
@@ -1290,7 +1495,7 @@ function createXcodeXcstringsLoader() {
1290
1495
  resultData[translationKey] = {};
1291
1496
  const pluralForms = langTranslationEntity.variations.plural;
1292
1497
  for (const form in pluralForms) {
1293
- if (_optionalChain([pluralForms, 'access', _68 => _68[form], 'optionalAccess', _69 => _69.stringUnit, 'optionalAccess', _70 => _70.value])) {
1498
+ if (_optionalChain([pluralForms, 'access', _72 => _72[form], 'optionalAccess', _73 => _73.stringUnit, 'optionalAccess', _74 => _74.value])) {
1294
1499
  resultData[translationKey][form] = pluralForms[form].stringUnit.value;
1295
1500
  }
1296
1501
  }
@@ -1393,16 +1598,16 @@ function createUnlocalizableLoader() {
1393
1598
  isUrl: (v) => _lodash2.default.isString(v) && _isurl2.default.call(void 0, v)
1394
1599
  };
1395
1600
  return createLoader({
1396
- async pull(locale, input) {
1397
- const passthroughKeys = Object.entries(input).filter(([key, value]) => {
1601
+ async pull(locale, input2) {
1602
+ const passthroughKeys = Object.entries(input2).filter(([key, value]) => {
1398
1603
  for (const [ruleName, rule] of Object.entries(rules)) {
1399
1604
  if (rule(value)) {
1400
1605
  return true;
1401
1606
  }
1402
1607
  }
1403
1608
  return false;
1404
- }).map(([key, _20]) => key);
1405
- const result = _lodash2.default.omitBy(input, (_20, key) => passthroughKeys.includes(key));
1609
+ }).map(([key, _21]) => key);
1610
+ const result = _lodash2.default.omitBy(input2, (_21, key) => passthroughKeys.includes(key));
1406
1611
  return result;
1407
1612
  },
1408
1613
  async push(locale, data, originalInput) {
@@ -1426,10 +1631,10 @@ function createPoLoader(params = { multiline: false }) {
1426
1631
  }
1427
1632
  function createPoDataLoader(params) {
1428
1633
  return createLoader({
1429
- async pull(locale, input) {
1430
- const parsedPo = _gettextparser2.default.po.parse(input);
1634
+ async pull(locale, input2) {
1635
+ const parsedPo = _gettextparser2.default.po.parse(input2);
1431
1636
  const result = {};
1432
- const sections = input.split("\n\n").filter(Boolean);
1637
+ const sections = input2.split("\n\n").filter(Boolean);
1433
1638
  for (const section of sections) {
1434
1639
  const sectionPo = _gettextparser2.default.po.parse(section);
1435
1640
  const contextKey = _lodash2.default.keys(sectionPo.translations)[0];
@@ -1437,7 +1642,7 @@ function createPoDataLoader(params) {
1437
1642
  Object.entries(entries).forEach(([msgid, entry]) => {
1438
1643
  if (msgid && entry.msgid) {
1439
1644
  const context = entry.msgctxt || "";
1440
- const fullEntry = _optionalChain([parsedPo, 'access', _71 => _71.translations, 'access', _72 => _72[context], 'optionalAccess', _73 => _73[msgid]]);
1645
+ const fullEntry = _optionalChain([parsedPo, 'access', _75 => _75.translations, 'access', _76 => _76[context], 'optionalAccess', _77 => _77[msgid]]);
1441
1646
  if (fullEntry) {
1442
1647
  result[msgid] = fullEntry;
1443
1648
  }
@@ -1447,7 +1652,7 @@ function createPoDataLoader(params) {
1447
1652
  return result;
1448
1653
  },
1449
1654
  async push(locale, data, originalInput) {
1450
- const sections = _optionalChain([originalInput, 'optionalAccess', _74 => _74.split, 'call', _75 => _75("\n\n"), 'access', _76 => _76.filter, 'call', _77 => _77(Boolean)]) || [];
1655
+ const sections = _optionalChain([originalInput, 'optionalAccess', _78 => _78.split, 'call', _79 => _79("\n\n"), 'access', _80 => _80.filter, 'call', _81 => _81(Boolean)]) || [];
1451
1656
  const result = sections.map((section) => {
1452
1657
  const sectionPo = _gettextparser2.default.po.parse(section);
1453
1658
  const contextKey = _lodash2.default.keys(sectionPo.translations)[0];
@@ -1474,8 +1679,8 @@ function createPoDataLoader(params) {
1474
1679
  }
1475
1680
  function createPoContentLoader() {
1476
1681
  return createLoader({
1477
- async pull(locale, input) {
1478
- const result = _lodash2.default.chain(input).entries().filter(([, entry]) => !!entry.msgid).map(([, entry]) => [
1682
+ async pull(locale, input2) {
1683
+ const result = _lodash2.default.chain(input2).entries().filter(([, entry]) => !!entry.msgid).map(([, entry]) => [
1479
1684
  entry.msgid,
1480
1685
  {
1481
1686
  singular: entry.msgstr[0] || entry.msgid,
@@ -1489,7 +1694,7 @@ function createPoContentLoader() {
1489
1694
  entry.msgid,
1490
1695
  {
1491
1696
  ...entry,
1492
- msgstr: [_optionalChain([data, 'access', _78 => _78[entry.msgid], 'optionalAccess', _79 => _79.singular]), _optionalChain([data, 'access', _80 => _80[entry.msgid], 'optionalAccess', _81 => _81.plural]) || null].filter(Boolean)
1697
+ msgstr: [_optionalChain([data, 'access', _82 => _82[entry.msgid], 'optionalAccess', _83 => _83.singular]), _optionalChain([data, 'access', _84 => _84[entry.msgid], 'optionalAccess', _85 => _85.plural]) || null].filter(Boolean)
1493
1698
  }
1494
1699
  ]).fromPairs().value();
1495
1700
  return result;
@@ -1501,8 +1706,8 @@ function createPoContentLoader() {
1501
1706
  var _xliff = require('xliff'); var _xliff2 = _interopRequireDefault(_xliff);
1502
1707
  function createXliffLoader() {
1503
1708
  return createLoader({
1504
- async pull(locale, input) {
1505
- const js = await _xliff2.default.xliff2js(input);
1709
+ async pull(locale, input2) {
1710
+ const js = await _xliff2.default.xliff2js(input2);
1506
1711
  return js || {};
1507
1712
  },
1508
1713
  async push(locale, payload) {
@@ -1519,10 +1724,10 @@ function normalizeXMLString(xmlString) {
1519
1724
  }
1520
1725
  function createXmlLoader() {
1521
1726
  return createLoader({
1522
- async pull(locale, input) {
1727
+ async pull(locale, input2) {
1523
1728
  let result = {};
1524
1729
  try {
1525
- const parsed = await _xml2js.parseStringPromise.call(void 0, input, {
1730
+ const parsed = await _xml2js.parseStringPromise.call(void 0, input2, {
1526
1731
  explicitArray: false,
1527
1732
  mergeAttrs: false,
1528
1733
  normalize: true,
@@ -1557,8 +1762,8 @@ var _srtparser2 = require('srt-parser-2'); var _srtparser22 = _interopRequireDef
1557
1762
  function createSrtLoader() {
1558
1763
  const parser = new (0, _srtparser22.default)();
1559
1764
  return createLoader({
1560
- async pull(locale, input) {
1561
- const parsed = parser.fromSrt(input) || [];
1765
+ async pull(locale, input2) {
1766
+ const parsed = parser.fromSrt(input2) || [];
1562
1767
  const result = {};
1563
1768
  parsed.forEach((entry) => {
1564
1769
  const key = `${entry.id}#${entry.startTime}-${entry.endTime}`;
@@ -1611,9 +1816,9 @@ var datoSettingsSchema = _zod2.default.object({
1611
1816
 
1612
1817
  function createDatoFilterLoader() {
1613
1818
  return createLoader({
1614
- async pull(locale, input) {
1819
+ async pull(locale, input2) {
1615
1820
  const result = {};
1616
- for (const [modelId, modelInfo] of _lodash2.default.entries(input)) {
1821
+ for (const [modelId, modelInfo] of _lodash2.default.entries(input2)) {
1617
1822
  result[modelId] = {};
1618
1823
  for (const record of modelInfo.records) {
1619
1824
  result[modelId][record.id] = _lodash2.default.chain(modelInfo.fields).mapKeys((field) => field.api_key).mapValues((field) => _lodash2.default.get(record, [field.api_key, locale])).value();
@@ -1735,7 +1940,7 @@ function createDatoClient(params) {
1735
1940
  only_valid: "true",
1736
1941
  ids: !records.length ? void 0 : records.join(",")
1737
1942
  }
1738
- }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _82 => _82.response, 'optionalAccess', _83 => _83.body, 'optionalAccess', _84 => _84.data, 'optionalAccess', _85 => _85[0]]) || error));
1943
+ }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _86 => _86.response, 'optionalAccess', _87 => _87.body, 'optionalAccess', _88 => _88.data, 'optionalAccess', _89 => _89[0]]) || error));
1739
1944
  },
1740
1945
  findRecordsForModel: async (modelId, records) => {
1741
1946
  try {
@@ -1745,9 +1950,9 @@ function createDatoClient(params) {
1745
1950
  filter: {
1746
1951
  type: modelId,
1747
1952
  only_valid: "true",
1748
- ids: !_optionalChain([records, 'optionalAccess', _86 => _86.length]) ? void 0 : records.join(",")
1953
+ ids: !_optionalChain([records, 'optionalAccess', _90 => _90.length]) ? void 0 : records.join(",")
1749
1954
  }
1750
- }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _87 => _87.response, 'optionalAccess', _88 => _88.body, 'optionalAccess', _89 => _89.data, 'optionalAccess', _90 => _90[0]]) || error));
1955
+ }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _91 => _91.response, 'optionalAccess', _92 => _92.body, 'optionalAccess', _93 => _93.data, 'optionalAccess', _94 => _94[0]]) || error));
1751
1956
  return result;
1752
1957
  } catch (_error) {
1753
1958
  throw new Error(
@@ -1761,9 +1966,9 @@ function createDatoClient(params) {
1761
1966
  },
1762
1967
  updateRecord: async (id, payload) => {
1763
1968
  try {
1764
- await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _91 => _91.response, 'optionalAccess', _92 => _92.body, 'optionalAccess', _93 => _93.data, 'optionalAccess', _94 => _94[0]]) || error));
1969
+ await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _95 => _95.response, 'optionalAccess', _96 => _96.body, 'optionalAccess', _97 => _97.data, 'optionalAccess', _98 => _98[0]]) || error));
1765
1970
  } catch (_error) {
1766
- if (_optionalChain([_error, 'optionalAccess', _95 => _95.attributes, 'optionalAccess', _96 => _96.details, 'optionalAccess', _97 => _97.message])) {
1971
+ if (_optionalChain([_error, 'optionalAccess', _99 => _99.attributes, 'optionalAccess', _100 => _100.details, 'optionalAccess', _101 => _101.message])) {
1767
1972
  throw new Error(
1768
1973
  [
1769
1974
  `${_error.attributes.details.message}`,
@@ -1784,9 +1989,9 @@ function createDatoClient(params) {
1784
1989
  },
1785
1990
  enableFieldLocalization: async (args) => {
1786
1991
  try {
1787
- await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _98 => _98.response, 'optionalAccess', _99 => _99.body, 'optionalAccess', _100 => _100.data, 'optionalAccess', _101 => _101[0]]) || error));
1992
+ await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _102 => _102.response, 'optionalAccess', _103 => _103.body, 'optionalAccess', _104 => _104.data, 'optionalAccess', _105 => _105[0]]) || error));
1788
1993
  } catch (_error) {
1789
- if (_optionalChain([_error, 'optionalAccess', _102 => _102.attributes, 'optionalAccess', _103 => _103.code]) === "NOT_FOUND") {
1994
+ if (_optionalChain([_error, 'optionalAccess', _106 => _106.attributes, 'optionalAccess', _107 => _107.code]) === "NOT_FOUND") {
1790
1995
  throw new Error(
1791
1996
  [
1792
1997
  `Field "${args.fieldId}" not found in model "${args.modelId}".`,
@@ -1794,7 +1999,7 @@ function createDatoClient(params) {
1794
1999
  ].join("\n\n")
1795
2000
  );
1796
2001
  }
1797
- if (_optionalChain([_error, 'optionalAccess', _104 => _104.attributes, 'optionalAccess', _105 => _105.details, 'optionalAccess', _106 => _106.message])) {
2002
+ if (_optionalChain([_error, 'optionalAccess', _108 => _108.attributes, 'optionalAccess', _109 => _109.details, 'optionalAccess', _110 => _110.message])) {
1798
2003
  throw new Error(
1799
2004
  [`${_error.attributes.details.message}`, `Error: ${JSON.stringify(_error, null, 2)}`].join("\n\n")
1800
2005
  );
@@ -1860,7 +2065,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
1860
2065
  }
1861
2066
  }
1862
2067
  const records = await dato.findRecordsForModel(modelId);
1863
- const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _107 => _107.models, 'access', _108 => _108[modelId], 'optionalAccess', _109 => _109.records]) || [], project);
2068
+ const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _111 => _111.models, 'access', _112 => _112[modelId], 'optionalAccess', _113 => _113.records]) || [], project);
1864
2069
  const selectedRecords = await promptRecordSelection(modelName, recordChoices);
1865
2070
  result.models[modelId].records = records.filter((record) => selectedRecords.includes(record.id));
1866
2071
  updatedConfig.models[modelId].records = selectedRecords;
@@ -1870,16 +2075,16 @@ function createDatoApiLoader(config, onConfigUpdate) {
1870
2075
  onConfigUpdate(updatedConfig);
1871
2076
  return result;
1872
2077
  },
1873
- async pull(locale, input, initCtx) {
2078
+ async pull(locale, input2, initCtx) {
1874
2079
  const result = {};
1875
- for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _110 => _110.models]) || {})) {
1876
- let records = _optionalChain([initCtx, 'optionalAccess', _111 => _111.models, 'access', _112 => _112[modelId], 'access', _113 => _113.records]) || [];
2080
+ for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _114 => _114.models]) || {})) {
2081
+ let records = _optionalChain([initCtx, 'optionalAccess', _115 => _115.models, 'access', _116 => _116[modelId], 'access', _117 => _117.records]) || [];
1877
2082
  const recordIds = records.map((record) => record.id);
1878
2083
  records = await dato.findRecords(recordIds);
1879
2084
  console.log(`Fetched ${records.length} records for model ${modelId}`);
1880
2085
  if (records.length > 0) {
1881
2086
  result[modelId] = {
1882
- fields: _optionalChain([initCtx, 'optionalAccess', _114 => _114.models, 'optionalAccess', _115 => _115[modelId], 'optionalAccess', _116 => _116.fields]) || [],
2087
+ fields: _optionalChain([initCtx, 'optionalAccess', _118 => _118.models, 'optionalAccess', _119 => _119[modelId], 'optionalAccess', _120 => _120.fields]) || [],
1883
2088
  records
1884
2089
  };
1885
2090
  }
@@ -1938,7 +2143,7 @@ function createRecordChoices(records, selectedIds = [], project) {
1938
2143
  return records.map((record) => ({
1939
2144
  name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
1940
2145
  value: record.id,
1941
- checked: _optionalChain([selectedIds, 'optionalAccess', _117 => _117.includes, 'call', _118 => _118(record.id)])
2146
+ checked: _optionalChain([selectedIds, 'optionalAccess', _121 => _121.includes, 'call', _122 => _122(record.id)])
1942
2147
  }));
1943
2148
  }
1944
2149
  async function promptRecordSelection(modelName, choices) {
@@ -1982,9 +2187,9 @@ async function promptModelSelection(choices) {
1982
2187
 
1983
2188
  function createDatoExtractLoader() {
1984
2189
  return createLoader({
1985
- async pull(locale, input) {
2190
+ async pull(locale, input2) {
1986
2191
  const result = {};
1987
- for (const [modelId, modelInfo] of _lodash2.default.entries(input)) {
2192
+ for (const [modelId, modelInfo] of _lodash2.default.entries(input2)) {
1988
2193
  for (const [recordId, record] of _lodash2.default.entries(modelInfo)) {
1989
2194
  for (const [fieldName, fieldValue] of _lodash2.default.entries(record)) {
1990
2195
  const parsedValue = createParsedDatoValue(fieldValue);
@@ -2089,18 +2294,18 @@ function createRawDatoValue(parsedDatoValue, originalRawDatoValue, isClean = fal
2089
2294
  }
2090
2295
  function serializeStructuredText(rawStructuredText) {
2091
2296
  return serializeStructuredTextNode(rawStructuredText);
2092
- function serializeStructuredTextNode(node, path9 = [], acc = {}) {
2297
+ function serializeStructuredTextNode(node, path11 = [], acc = {}) {
2093
2298
  if ("document" in node) {
2094
- return serializeStructuredTextNode(node.document, [...path9, "document"], acc);
2299
+ return serializeStructuredTextNode(node.document, [...path11, "document"], acc);
2095
2300
  }
2096
2301
  if (!_lodash2.default.isNil(node.value)) {
2097
- acc[[...path9, "value"].join(".")] = node.value;
2302
+ acc[[...path11, "value"].join(".")] = node.value;
2098
2303
  } else if (_lodash2.default.get(node, "type") === "block") {
2099
- acc[[...path9, "item"].join(".")] = serializeBlock(node.item);
2304
+ acc[[...path11, "item"].join(".")] = serializeBlock(node.item);
2100
2305
  }
2101
2306
  if (node.children) {
2102
2307
  for (let i = 0; i < node.children.length; i++) {
2103
- serializeStructuredTextNode(node.children[i], [...path9, i.toString()], acc);
2308
+ serializeStructuredTextNode(node.children[i], [...path11, i.toString()], acc);
2104
2309
  }
2105
2310
  }
2106
2311
  return acc;
@@ -2159,8 +2364,8 @@ function deserializeBlockList(parsedBlockList, originalRawBlockList, isClean = f
2159
2364
  }
2160
2365
  function deserializeStructuredText(parsedStructuredText, originalRawStructuredText) {
2161
2366
  const result = _lodash2.default.cloneDeep(originalRawStructuredText);
2162
- for (const [path9, value] of _lodash2.default.entries(parsedStructuredText)) {
2163
- const realPath = _lodash2.default.chain(path9.split(".")).flatMap((s) => !_lodash2.default.isNaN(_lodash2.default.toNumber(s)) ? ["children", s] : s).value();
2367
+ for (const [path11, value] of _lodash2.default.entries(parsedStructuredText)) {
2368
+ const realPath = _lodash2.default.chain(path11.split(".")).flatMap((s) => !_lodash2.default.isNaN(_lodash2.default.toNumber(s)) ? ["children", s] : s).value();
2164
2369
  const deserializedValue = createRawDatoValue(value, _lodash2.default.get(originalRawStructuredText, realPath), true);
2165
2370
  _lodash2.default.set(result, realPath, deserializedValue);
2166
2371
  }
@@ -2204,8 +2409,8 @@ function createDatoLoader(configFilePath) {
2204
2409
  var _nodewebvtt = require('node-webvtt'); var _nodewebvtt2 = _interopRequireDefault(_nodewebvtt);
2205
2410
  function createVttLoader() {
2206
2411
  return createLoader({
2207
- async pull(locale, input) {
2208
- const vtt = _optionalChain([_nodewebvtt2.default, 'access', _119 => _119.parse, 'call', _120 => _120(input), 'optionalAccess', _121 => _121.cues]);
2412
+ async pull(locale, input2) {
2413
+ const vtt = _optionalChain([_nodewebvtt2.default, 'access', _123 => _123.parse, 'call', _124 => _124(input2), 'optionalAccess', _125 => _125.cues]);
2209
2414
  if (Object.keys(vtt).length === 0) {
2210
2415
  return {};
2211
2416
  } else {
@@ -2228,12 +2433,12 @@ function createVttLoader() {
2228
2433
  text
2229
2434
  };
2230
2435
  });
2231
- const input = {
2436
+ const input2 = {
2232
2437
  valid: true,
2233
2438
  strict: true,
2234
2439
  cues: output
2235
2440
  };
2236
- return _nodewebvtt2.default.compile(input);
2441
+ return _nodewebvtt2.default.compile(input2);
2237
2442
  }
2238
2443
  });
2239
2444
  }
@@ -2246,9 +2451,9 @@ function createVariableLoader(params) {
2246
2451
  function variableExtractLoader(params) {
2247
2452
  const specifierPattern = getFormatSpecifierPattern(params.type);
2248
2453
  return createLoader({
2249
- pull: async (locale, input) => {
2454
+ pull: async (locale, input2) => {
2250
2455
  const result = {};
2251
- for (const [key, value] of Object.entries(input)) {
2456
+ for (const [key, value] of Object.entries(input2)) {
2252
2457
  const matches = value.match(specifierPattern) || [];
2253
2458
  result[key] = result[key] || {
2254
2459
  value,
@@ -2257,7 +2462,7 @@ function variableExtractLoader(params) {
2257
2462
  for (let i = 0; i < matches.length; i++) {
2258
2463
  const match = matches[i];
2259
2464
  const currentValue = result[key].value;
2260
- const newValue = _optionalChain([currentValue, 'optionalAccess', _122 => _122.replace, 'call', _123 => _123(match, `{variable:${i}}`)]);
2465
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _126 => _126.replace, 'call', _127 => _127(match, `{variable:${i}}`)]);
2261
2466
  result[key].value = newValue;
2262
2467
  result[key].variables[i] = match;
2263
2468
  }
@@ -2271,7 +2476,7 @@ function variableExtractLoader(params) {
2271
2476
  for (let i = 0; i < valueObj.variables.length; i++) {
2272
2477
  const variable = valueObj.variables[i];
2273
2478
  const currentValue = result[key];
2274
- const newValue = _optionalChain([currentValue, 'optionalAccess', _124 => _124.replace, 'call', _125 => _125(`{variable:${i}}`, variable)]);
2479
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _128 => _128.replace, 'call', _129 => _129(`{variable:${i}}`, variable)]);
2275
2480
  result[key] = newValue;
2276
2481
  }
2277
2482
  }
@@ -2281,8 +2486,8 @@ function variableExtractLoader(params) {
2281
2486
  }
2282
2487
  function variableContentLoader() {
2283
2488
  return createLoader({
2284
- pull: async (locale, input) => {
2285
- const result = _lodash2.default.mapValues(input, (payload) => payload.value);
2489
+ pull: async (locale, input2) => {
2490
+ const result = _lodash2.default.mapValues(input2, (payload) => payload.value);
2286
2491
  return result;
2287
2492
  },
2288
2493
  push: async (locale, data, originalInput) => {
@@ -2312,11 +2517,11 @@ function getFormatSpecifierPattern(type) {
2312
2517
 
2313
2518
  function createSyncLoader() {
2314
2519
  return createLoader({
2315
- async pull(locale, input, originalInput) {
2520
+ async pull(locale, input2, originalInput) {
2316
2521
  if (!originalInput) {
2317
- return input;
2522
+ return input2;
2318
2523
  }
2319
- return _lodash2.default.chain(originalInput).mapValues((value, key) => input[key]).value();
2524
+ return _lodash2.default.chain(originalInput).mapValues((value, key) => input2[key]).value();
2320
2525
  },
2321
2526
  async push(locale, data, originalInput) {
2322
2527
  if (!originalInput) {
@@ -2711,11 +2916,11 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
2711
2916
  const auth = await validateAuth(settings);
2712
2917
  ora.succeed(`Authenticated as ${auth.email}`);
2713
2918
  let buckets = getBuckets(i18nConfig);
2714
- if (_optionalChain([flags, 'access', _126 => _126.bucket, 'optionalAccess', _127 => _127.length])) {
2919
+ if (_optionalChain([flags, 'access', _130 => _130.bucket, 'optionalAccess', _131 => _131.length])) {
2715
2920
  buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
2716
2921
  }
2717
2922
  ora.succeed("Buckets retrieved");
2718
- const targetLocales = _optionalChain([flags, 'access', _128 => _128.locale, 'optionalAccess', _129 => _129.length]) ? flags.locale : i18nConfig.locale.targets;
2923
+ const targetLocales = _optionalChain([flags, 'access', _132 => _132.locale, 'optionalAccess', _133 => _133.length]) ? flags.locale : i18nConfig.locale.targets;
2719
2924
  const lockfileHelper = createLockfileHelper();
2720
2925
  ora.start("Ensuring i18n.lock exists...");
2721
2926
  if (!lockfileHelper.isLockfileExists()) {
@@ -2823,7 +3028,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
2823
3028
  targetData
2824
3029
  });
2825
3030
  if (flags.key) {
2826
- processableData = _lodash2.default.pickBy(processableData, (_20, key) => key === flags.key);
3031
+ processableData = _lodash2.default.pickBy(processableData, (_21, key) => key === flags.key);
2827
3032
  }
2828
3033
  if (flags.verbose) {
2829
3034
  bucketOra.info(JSON.stringify(processableData, null, 2));
@@ -3001,12 +3206,12 @@ function validateParams(i18nConfig, flags) {
3001
3206
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
3002
3207
  docUrl: "bucketNotFound"
3003
3208
  });
3004
- } else if (_optionalChain([flags, 'access', _130 => _130.locale, 'optionalAccess', _131 => _131.some, 'call', _132 => _132((locale) => !i18nConfig.locale.targets.includes(locale))])) {
3209
+ } else if (_optionalChain([flags, 'access', _134 => _134.locale, 'optionalAccess', _135 => _135.some, 'call', _136 => _136((locale) => !i18nConfig.locale.targets.includes(locale))])) {
3005
3210
  throw new CLIError({
3006
3211
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
3007
3212
  docUrl: "localeTargetNotFound"
3008
3213
  });
3009
- } else if (_optionalChain([flags, 'access', _133 => _133.bucket, 'optionalAccess', _134 => _134.some, 'call', _135 => _135((bucket) => !i18nConfig.buckets[bucket])])) {
3214
+ } else if (_optionalChain([flags, 'access', _137 => _137.bucket, 'optionalAccess', _138 => _138.some, 'call', _139 => _139((bucket) => !i18nConfig.buckets[bucket])])) {
3010
3215
  throw new CLIError({
3011
3216
  message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
3012
3217
  docUrl: "bucketNotFound"
@@ -3233,7 +3438,7 @@ function displaySummary(results) {
3233
3438
  // package.json
3234
3439
  var package_default = {
3235
3440
  name: "lingo.dev",
3236
- version: "0.74.15",
3441
+ version: "0.74.16",
3237
3442
  description: "Lingo.dev CLI",
3238
3443
  private: false,
3239
3444
  publishConfig: {