lingo.dev 0.75.0 → 0.76.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/cli.cjs CHANGED
@@ -303,24 +303,30 @@ function findLocaleFilesWithExtension(ext) {
303
303
  const files = _glob.glob.sync(`**/*${ext}`, {
304
304
  ignore: ["node_modules/**", "package*.json", "i18n.json", "lingo.json"]
305
305
  });
306
- const localeFilePattern = new RegExp(`[/\\\\]([a-z]{2}(-[A-Z]{2})?)${ext}$`);
307
- const localeDirectoryPattern = new RegExp(`[/\\\\]([a-z]{2}(-[A-Z]{2})?)[/\\\\][^/\\\\]+${ext}$`);
306
+ const localeFilePattern = new RegExp(`/([a-z]{2}(-[A-Z]{2})?)${ext}$`);
307
+ const localeDirectoryPattern = new RegExp(`/([a-z]{2}(-[A-Z]{2})?)/[^/]+${ext}$`);
308
308
  const potentialLocaleFiles = files.filter(
309
309
  (file) => localeFilePattern.test(file) || localeDirectoryPattern.test(file)
310
310
  );
311
- const localeFilesAndPatterns = potentialLocaleFiles.map((file) => {
312
- const match = file.match(new RegExp(`[/|\\\\]([a-z]{2}(-[A-Z]{2})?)(/|\\\\|${ext})`));
313
- const locale = _optionalChain([match, 'optionalAccess', _29 => _29[1]]);
314
- const localeInDir = _optionalChain([match, 'optionalAccess', _30 => _30[3]]) !== ext;
315
- const filePattern = localeInDir ? file.replace(`/${locale}/`, `/[locale]/`) : _path2.default.join(_path2.default.dirname(file), `[locale]${ext}`);
316
- return { file, locale, pattern: filePattern };
317
- }).filter(({ locale }) => {
318
- try {
319
- __spec.resolveLocaleCode.call(void 0, locale);
320
- return true;
321
- } catch (e) {
311
+ const potantialLocaleFilesAndPatterns = potentialLocaleFiles.map((file) => {
312
+ const matchPotentialLocales = Array.from(
313
+ file.matchAll(new RegExp(`/([a-z]{2}(-[A-Z]{2})?|[^/]+)(?=/|${ext})`, "g"))
314
+ );
315
+ const potantialLocales = matchPotentialLocales.map((match) => match[1]);
316
+ return { file, potantialLocales };
317
+ }).map(({ file, potantialLocales }) => {
318
+ for (const locale of potantialLocales) {
319
+ try {
320
+ __spec.resolveLocaleCode.call(void 0, locale);
321
+ return { locale, file };
322
+ } catch (e) {
323
+ }
322
324
  }
323
- return false;
325
+ return { file, locale: null };
326
+ }).filter(({ locale }) => locale !== null);
327
+ const localeFilesAndPatterns = potantialLocaleFilesAndPatterns.map(({ file, locale }) => {
328
+ const pattern = file.replaceAll(new RegExp(`/${locale}${ext}`, "g"), `/[locale]${ext}`).replaceAll(new RegExp(`/${locale}/`, "g"), `/[locale]/`).replaceAll(new RegExp(`/${locale}/`, "g"), `/[locale]/`);
329
+ return { pattern, file };
324
330
  });
325
331
  const grouppedFilesAndPatterns = _lodash2.default.groupBy(localeFilesAndPatterns, "pattern");
326
332
  const patterns = Object.keys(grouppedFilesAndPatterns);
@@ -519,6 +525,8 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
519
525
  });
520
526
  } else {
521
527
  spinner.succeed("No existing locale files found.");
528
+ }
529
+ if (selectedPatterns.length === 0) {
522
530
  const useDefault = await _prompts.confirm.call(void 0, {
523
531
  message: `Use (and create) default path ${patterns.join(", ")}?`
524
532
  });
@@ -567,7 +575,7 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
567
575
  });
568
576
  const auth2 = await newAuthenticator.whoami();
569
577
  if (auth2) {
570
- _ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _31 => _31.email])}`);
578
+ _ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _29 => _29.email])}`);
571
579
  } else {
572
580
  _ora2.default.call(void 0, ).fail("Authentication failed.");
573
581
  }
@@ -646,7 +654,7 @@ var locale_default = new (0, _interactivecommander.Command)().command("locale").
646
654
  function getBuckets(i18nConfig) {
647
655
  const result = Object.entries(i18nConfig.buckets).map(([bucketType, bucketEntry]) => {
648
656
  const includeItems = bucketEntry.include.map((item) => resolveBucketItem(item));
649
- const excludeItems = _optionalChain([bucketEntry, 'access', _32 => _32.exclude, 'optionalAccess', _33 => _33.map, 'call', _34 => _34((item) => resolveBucketItem(item))]);
657
+ const excludeItems = _optionalChain([bucketEntry, 'access', _30 => _30.exclude, 'optionalAccess', _31 => _31.map, 'call', _32 => _32((item) => resolveBucketItem(item))]);
650
658
  return {
651
659
  type: bucketType,
652
660
  config: extractPathPatterns(i18nConfig.locale.source, includeItems, excludeItems)
@@ -663,7 +671,7 @@ function extractPathPatterns(sourceLocale, include, exclude) {
663
671
  })
664
672
  )
665
673
  );
666
- const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _35 => _35.flatMap, 'call', _36 => _36(
674
+ const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _33 => _33.flatMap, 'call', _34 => _34(
667
675
  (pattern) => expandPlaceholderedGlob(pattern.path, __spec.resolveOverridenLocale.call(void 0, sourceLocale, pattern.delimiter)).map(
668
676
  (pathPattern) => ({
669
677
  pathPattern,
@@ -689,24 +697,25 @@ function expandPlaceholderedGlob(_pathPattern, sourceLocale) {
689
697
  docUrl: "invalidPathPattern"
690
698
  });
691
699
  }
692
- if (pathPattern.split("[locale]").length > 2) {
693
- throw new CLIError({
694
- message: `Invalid path pattern: ${pathPattern}. Path pattern must contain at most one "[locale]" placeholder.`,
695
- docUrl: "invalidPathPattern"
696
- });
697
- }
698
700
  const pathPatternChunks = pathPattern.split(_path2.default.sep);
699
- const localeSegmentIndex = pathPatternChunks.findIndex((segment) => segment.includes("[locale]"));
700
- const localePlaceholderIndex = _nullishCoalesce(_optionalChain([pathPatternChunks, 'access', _37 => _37[localeSegmentIndex], 'optionalAccess', _38 => _38.indexOf, 'call', _39 => _39("[locale]")]), () => ( -1));
701
- const sourcePathPattern = pathPattern.replace(/\[locale\]/g, sourceLocale);
701
+ const localeSegmentIndexes = pathPatternChunks.reduce((indexes, segment, index) => {
702
+ if (segment.includes("[locale]")) {
703
+ indexes.push(index);
704
+ }
705
+ return indexes;
706
+ }, []);
707
+ const sourcePathPattern = pathPattern.replaceAll(/\[locale\]/g, sourceLocale);
702
708
  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));
703
709
  const placeholderedPaths = sourcePaths.map((sourcePath) => {
704
710
  const sourcePathChunks = sourcePath.split(_path2.default.sep);
705
- if (localeSegmentIndex >= 0 && localePlaceholderIndex >= 0) {
706
- const placeholderedPathChunk = sourcePathChunks[localeSegmentIndex];
707
- const placeholderedSegment = placeholderedPathChunk.substring(0, localePlaceholderIndex) + "[locale]" + placeholderedPathChunk.substring(localePlaceholderIndex + sourceLocale.length);
708
- sourcePathChunks[localeSegmentIndex] = placeholderedSegment;
709
- }
711
+ localeSegmentIndexes.forEach((localeSegmentIndex) => {
712
+ const localePlaceholderIndex = _nullishCoalesce(_optionalChain([pathPatternChunks, 'access', _35 => _35[localeSegmentIndex], 'optionalAccess', _36 => _36.indexOf, 'call', _37 => _37("[locale]")]), () => ( -1));
713
+ if (localeSegmentIndex >= 0 && localePlaceholderIndex >= 0) {
714
+ const placeholderedPathChunk = sourcePathChunks[localeSegmentIndex];
715
+ const placeholderedSegment = placeholderedPathChunk.substring(0, localePlaceholderIndex) + "[locale]" + placeholderedPathChunk.substring(localePlaceholderIndex + sourceLocale.length);
716
+ sourcePathChunks[localeSegmentIndex] = placeholderedSegment;
717
+ }
718
+ });
710
719
  const placeholderedPath = sourcePathChunks.join(_path2.default.sep);
711
720
  return placeholderedPath;
712
721
  });
@@ -782,12 +791,12 @@ function composeLoaders(...loaders) {
782
791
  return {
783
792
  init: async () => {
784
793
  for (const loader of loaders) {
785
- await _optionalChain([loader, 'access', _40 => _40.init, 'optionalCall', _41 => _41()]);
794
+ await _optionalChain([loader, 'access', _38 => _38.init, 'optionalCall', _39 => _39()]);
786
795
  }
787
796
  },
788
797
  setDefaultLocale(locale) {
789
798
  for (const loader of loaders) {
790
- _optionalChain([loader, 'access', _42 => _42.setDefaultLocale, 'optionalCall', _43 => _43(locale)]);
799
+ _optionalChain([loader, 'access', _40 => _40.setDefaultLocale, 'optionalCall', _41 => _41(locale)]);
791
800
  }
792
801
  return this;
793
802
  },
@@ -818,7 +827,7 @@ function createLoader(lDefinition) {
818
827
  if (state.initCtx) {
819
828
  return state.initCtx;
820
829
  }
821
- state.initCtx = await _optionalChain([lDefinition, 'access', _44 => _44.init, 'optionalCall', _45 => _45()]);
830
+ state.initCtx = await _optionalChain([lDefinition, 'access', _42 => _42.init, 'optionalCall', _43 => _43()]);
822
831
  return state.initCtx;
823
832
  },
824
833
  setDefaultLocale(locale) {
@@ -907,7 +916,7 @@ function createNormalizeLoader() {
907
916
  return normalized;
908
917
  },
909
918
  push: async (locale, data, originalInput) => {
910
- const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _46 => _46.keysMap]), () => ( {}));
919
+ const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _44 => _44.keysMap]), () => ( {}));
911
920
  const input2 = mapDenormalizedKeys(data, keysMap);
912
921
  const denormalized = _flat.unflatten.call(void 0, input2, {
913
922
  delimiter: "/",
@@ -982,7 +991,7 @@ function createTextFileLoader(pathPattern) {
982
991
  return trimmedResult;
983
992
  },
984
993
  async push(locale, data, _21, originalLocale) {
985
- const draftPath = pathPattern.replace("[locale]", locale);
994
+ const draftPath = pathPattern.replaceAll("[locale]", locale);
986
995
  const finalPath = _path2.default.resolve(draftPath);
987
996
  const dirPath = _path2.default.dirname(finalPath);
988
997
  await _promises4.default.mkdir(dirPath, { recursive: true });
@@ -997,7 +1006,7 @@ function createTextFileLoader(pathPattern) {
997
1006
  });
998
1007
  }
999
1008
  async function readFileForLocale(pathPattern, locale) {
1000
- const draftPath = pathPattern.replace("[locale]", locale);
1009
+ const draftPath = pathPattern.replaceAll("[locale]", locale);
1001
1010
  const finalPath = _path2.default.resolve(draftPath);
1002
1011
  const exists = await _promises4.default.access(finalPath).then(() => true).catch(() => false);
1003
1012
  if (!exists) {
@@ -1010,8 +1019,8 @@ async function getTrailingNewLine(pathPattern, locale, originalLocale) {
1010
1019
  if (!templateData) {
1011
1020
  templateData = await readFileForLocale(pathPattern, originalLocale);
1012
1021
  }
1013
- if (_optionalChain([templateData, 'optionalAccess', _47 => _47.match, 'call', _48 => _48(/[\r\n]$/)])) {
1014
- 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";
1022
+ if (_optionalChain([templateData, 'optionalAccess', _45 => _45.match, 'call', _46 => _46(/[\r\n]$/)])) {
1023
+ const ending = _optionalChain([templateData, 'optionalAccess', _47 => _47.includes, 'call', _48 => _48("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _49 => _49.includes, 'call', _50 => _50("\r")]) ? "\r" : "\n";
1015
1024
  return ending;
1016
1025
  }
1017
1026
  return "";
@@ -1238,7 +1247,7 @@ function createHtmlLoader() {
1238
1247
  break;
1239
1248
  }
1240
1249
  const siblings = Array.from(parent.childNodes).filter(
1241
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _53 => _53.textContent, 'optionalAccess', _54 => _54.trim, 'call', _55 => _55()])
1250
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _51 => _51.textContent, 'optionalAccess', _52 => _52.trim, 'call', _53 => _53()])
1242
1251
  );
1243
1252
  const index = siblings.indexOf(current);
1244
1253
  if (index !== -1) {
@@ -1273,11 +1282,11 @@ function createHtmlLoader() {
1273
1282
  result[getPath(element, attr)] = value;
1274
1283
  }
1275
1284
  });
1276
- 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);
1285
+ Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _54 => _54.textContent, 'optionalAccess', _55 => _55.trim, 'call', _56 => _56()])).forEach(processNode);
1277
1286
  }
1278
1287
  };
1279
- 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);
1280
- 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);
1288
+ Array.from(document.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _57 => _57.textContent, 'optionalAccess', _58 => _58.trim, 'call', _59 => _59()])).forEach(processNode);
1289
+ Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _60 => _60.textContent, 'optionalAccess', _61 => _61.trim, 'call', _62 => _62()])).forEach(processNode);
1281
1290
  return result;
1282
1291
  },
1283
1292
  async push(locale, data, originalInput) {
@@ -1299,7 +1308,7 @@ function createHtmlLoader() {
1299
1308
  for (let i = 0; i < indices.length; i++) {
1300
1309
  const index = parseInt(indices[i]);
1301
1310
  const siblings = Array.from(parent.childNodes).filter(
1302
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _65 => _65.textContent, 'optionalAccess', _66 => _66.trim, 'call', _67 => _67()])
1311
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _63 => _63.textContent, 'optionalAccess', _64 => _64.trim, 'call', _65 => _65()])
1303
1312
  );
1304
1313
  if (index >= siblings.length) {
1305
1314
  if (i === indices.length - 1) {
@@ -1406,7 +1415,7 @@ function isSkippableLine(line) {
1406
1415
  function parsePropertyLine(line) {
1407
1416
  const [key, ...valueParts] = line.split("=");
1408
1417
  return {
1409
- key: _optionalChain([key, 'optionalAccess', _68 => _68.trim, 'call', _69 => _69()]) || "",
1418
+ key: _optionalChain([key, 'optionalAccess', _66 => _66.trim, 'call', _67 => _67()]) || "",
1410
1419
  value: valueParts.join("=").trim()
1411
1420
  };
1412
1421
  }
@@ -1488,7 +1497,7 @@ function createXcodeXcstringsLoader() {
1488
1497
  const resultData = {};
1489
1498
  for (const [translationKey, _translationEntity] of Object.entries(input2.strings)) {
1490
1499
  const rootTranslationEntity = _translationEntity;
1491
- const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _70 => _70.localizations, 'optionalAccess', _71 => _71[locale]]);
1500
+ const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _68 => _68.localizations, 'optionalAccess', _69 => _69[locale]]);
1492
1501
  if (langTranslationEntity) {
1493
1502
  if ("stringUnit" in langTranslationEntity) {
1494
1503
  resultData[translationKey] = langTranslationEntity.stringUnit.value;
@@ -1497,7 +1506,7 @@ function createXcodeXcstringsLoader() {
1497
1506
  resultData[translationKey] = {};
1498
1507
  const pluralForms = langTranslationEntity.variations.plural;
1499
1508
  for (const form in pluralForms) {
1500
- if (_optionalChain([pluralForms, 'access', _72 => _72[form], 'optionalAccess', _73 => _73.stringUnit, 'optionalAccess', _74 => _74.value])) {
1509
+ if (_optionalChain([pluralForms, 'access', _70 => _70[form], 'optionalAccess', _71 => _71.stringUnit, 'optionalAccess', _72 => _72.value])) {
1501
1510
  resultData[translationKey][form] = pluralForms[form].stringUnit.value;
1502
1511
  }
1503
1512
  }
@@ -1647,7 +1656,7 @@ function createPoDataLoader(params) {
1647
1656
  Object.entries(entries).forEach(([msgid, entry]) => {
1648
1657
  if (msgid && entry.msgid) {
1649
1658
  const context = entry.msgctxt || "";
1650
- const fullEntry = _optionalChain([parsedPo, 'access', _75 => _75.translations, 'access', _76 => _76[context], 'optionalAccess', _77 => _77[msgid]]);
1659
+ const fullEntry = _optionalChain([parsedPo, 'access', _73 => _73.translations, 'access', _74 => _74[context], 'optionalAccess', _75 => _75[msgid]]);
1651
1660
  if (fullEntry) {
1652
1661
  result[msgid] = fullEntry;
1653
1662
  }
@@ -1657,7 +1666,7 @@ function createPoDataLoader(params) {
1657
1666
  return result;
1658
1667
  },
1659
1668
  async push(locale, data, originalInput) {
1660
- const sections = _optionalChain([originalInput, 'optionalAccess', _78 => _78.split, 'call', _79 => _79("\n\n"), 'access', _80 => _80.filter, 'call', _81 => _81(Boolean)]) || [];
1669
+ const sections = _optionalChain([originalInput, 'optionalAccess', _76 => _76.split, 'call', _77 => _77("\n\n"), 'access', _78 => _78.filter, 'call', _79 => _79(Boolean)]) || [];
1661
1670
  const result = sections.map((section) => {
1662
1671
  const sectionPo = _gettextparser2.default.po.parse(section);
1663
1672
  const contextKey = _lodash2.default.keys(sectionPo.translations)[0];
@@ -1699,7 +1708,7 @@ function createPoContentLoader() {
1699
1708
  entry.msgid,
1700
1709
  {
1701
1710
  ...entry,
1702
- 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)
1711
+ msgstr: [_optionalChain([data, 'access', _80 => _80[entry.msgid], 'optionalAccess', _81 => _81.singular]), _optionalChain([data, 'access', _82 => _82[entry.msgid], 'optionalAccess', _83 => _83.plural]) || null].filter(Boolean)
1703
1712
  }
1704
1713
  ]).fromPairs().value();
1705
1714
  return result;
@@ -1945,7 +1954,7 @@ function createDatoClient(params) {
1945
1954
  only_valid: "true",
1946
1955
  ids: !records.length ? void 0 : records.join(",")
1947
1956
  }
1948
- }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _86 => _86.response, 'optionalAccess', _87 => _87.body, 'optionalAccess', _88 => _88.data, 'optionalAccess', _89 => _89[0]]) || error));
1957
+ }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _84 => _84.response, 'optionalAccess', _85 => _85.body, 'optionalAccess', _86 => _86.data, 'optionalAccess', _87 => _87[0]]) || error));
1949
1958
  },
1950
1959
  findRecordsForModel: async (modelId, records) => {
1951
1960
  try {
@@ -1955,9 +1964,9 @@ function createDatoClient(params) {
1955
1964
  filter: {
1956
1965
  type: modelId,
1957
1966
  only_valid: "true",
1958
- ids: !_optionalChain([records, 'optionalAccess', _90 => _90.length]) ? void 0 : records.join(",")
1967
+ ids: !_optionalChain([records, 'optionalAccess', _88 => _88.length]) ? void 0 : records.join(",")
1959
1968
  }
1960
- }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _91 => _91.response, 'optionalAccess', _92 => _92.body, 'optionalAccess', _93 => _93.data, 'optionalAccess', _94 => _94[0]]) || error));
1969
+ }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _89 => _89.response, 'optionalAccess', _90 => _90.body, 'optionalAccess', _91 => _91.data, 'optionalAccess', _92 => _92[0]]) || error));
1961
1970
  return result;
1962
1971
  } catch (_error) {
1963
1972
  throw new Error(
@@ -1971,9 +1980,9 @@ function createDatoClient(params) {
1971
1980
  },
1972
1981
  updateRecord: async (id, payload) => {
1973
1982
  try {
1974
- 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));
1983
+ await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _93 => _93.response, 'optionalAccess', _94 => _94.body, 'optionalAccess', _95 => _95.data, 'optionalAccess', _96 => _96[0]]) || error));
1975
1984
  } catch (_error) {
1976
- if (_optionalChain([_error, 'optionalAccess', _99 => _99.attributes, 'optionalAccess', _100 => _100.details, 'optionalAccess', _101 => _101.message])) {
1985
+ if (_optionalChain([_error, 'optionalAccess', _97 => _97.attributes, 'optionalAccess', _98 => _98.details, 'optionalAccess', _99 => _99.message])) {
1977
1986
  throw new Error(
1978
1987
  [
1979
1988
  `${_error.attributes.details.message}`,
@@ -1994,9 +2003,9 @@ function createDatoClient(params) {
1994
2003
  },
1995
2004
  enableFieldLocalization: async (args) => {
1996
2005
  try {
1997
- 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));
2006
+ await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _100 => _100.response, 'optionalAccess', _101 => _101.body, 'optionalAccess', _102 => _102.data, 'optionalAccess', _103 => _103[0]]) || error));
1998
2007
  } catch (_error) {
1999
- if (_optionalChain([_error, 'optionalAccess', _106 => _106.attributes, 'optionalAccess', _107 => _107.code]) === "NOT_FOUND") {
2008
+ if (_optionalChain([_error, 'optionalAccess', _104 => _104.attributes, 'optionalAccess', _105 => _105.code]) === "NOT_FOUND") {
2000
2009
  throw new Error(
2001
2010
  [
2002
2011
  `Field "${args.fieldId}" not found in model "${args.modelId}".`,
@@ -2004,7 +2013,7 @@ function createDatoClient(params) {
2004
2013
  ].join("\n\n")
2005
2014
  );
2006
2015
  }
2007
- if (_optionalChain([_error, 'optionalAccess', _108 => _108.attributes, 'optionalAccess', _109 => _109.details, 'optionalAccess', _110 => _110.message])) {
2016
+ if (_optionalChain([_error, 'optionalAccess', _106 => _106.attributes, 'optionalAccess', _107 => _107.details, 'optionalAccess', _108 => _108.message])) {
2008
2017
  throw new Error(
2009
2018
  [`${_error.attributes.details.message}`, `Error: ${JSON.stringify(_error, null, 2)}`].join("\n\n")
2010
2019
  );
@@ -2070,7 +2079,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
2070
2079
  }
2071
2080
  }
2072
2081
  const records = await dato.findRecordsForModel(modelId);
2073
- const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _111 => _111.models, 'access', _112 => _112[modelId], 'optionalAccess', _113 => _113.records]) || [], project);
2082
+ const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _109 => _109.models, 'access', _110 => _110[modelId], 'optionalAccess', _111 => _111.records]) || [], project);
2074
2083
  const selectedRecords = await promptRecordSelection(modelName, recordChoices);
2075
2084
  result.models[modelId].records = records.filter((record) => selectedRecords.includes(record.id));
2076
2085
  updatedConfig.models[modelId].records = selectedRecords;
@@ -2082,14 +2091,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
2082
2091
  },
2083
2092
  async pull(locale, input2, initCtx) {
2084
2093
  const result = {};
2085
- for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _114 => _114.models]) || {})) {
2086
- let records = _optionalChain([initCtx, 'optionalAccess', _115 => _115.models, 'access', _116 => _116[modelId], 'access', _117 => _117.records]) || [];
2094
+ for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _112 => _112.models]) || {})) {
2095
+ let records = _optionalChain([initCtx, 'optionalAccess', _113 => _113.models, 'access', _114 => _114[modelId], 'access', _115 => _115.records]) || [];
2087
2096
  const recordIds = records.map((record) => record.id);
2088
2097
  records = await dato.findRecords(recordIds);
2089
2098
  console.log(`Fetched ${records.length} records for model ${modelId}`);
2090
2099
  if (records.length > 0) {
2091
2100
  result[modelId] = {
2092
- fields: _optionalChain([initCtx, 'optionalAccess', _118 => _118.models, 'optionalAccess', _119 => _119[modelId], 'optionalAccess', _120 => _120.fields]) || [],
2101
+ fields: _optionalChain([initCtx, 'optionalAccess', _116 => _116.models, 'optionalAccess', _117 => _117[modelId], 'optionalAccess', _118 => _118.fields]) || [],
2093
2102
  records
2094
2103
  };
2095
2104
  }
@@ -2148,7 +2157,7 @@ function createRecordChoices(records, selectedIds = [], project) {
2148
2157
  return records.map((record) => ({
2149
2158
  name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
2150
2159
  value: record.id,
2151
- checked: _optionalChain([selectedIds, 'optionalAccess', _121 => _121.includes, 'call', _122 => _122(record.id)])
2160
+ checked: _optionalChain([selectedIds, 'optionalAccess', _119 => _119.includes, 'call', _120 => _120(record.id)])
2152
2161
  }));
2153
2162
  }
2154
2163
  async function promptRecordSelection(modelName, choices) {
@@ -2415,7 +2424,7 @@ var _nodewebvtt = require('node-webvtt'); var _nodewebvtt2 = _interopRequireDefa
2415
2424
  function createVttLoader() {
2416
2425
  return createLoader({
2417
2426
  async pull(locale, input2) {
2418
- const vtt = _optionalChain([_nodewebvtt2.default, 'access', _123 => _123.parse, 'call', _124 => _124(input2), 'optionalAccess', _125 => _125.cues]);
2427
+ const vtt = _optionalChain([_nodewebvtt2.default, 'access', _121 => _121.parse, 'call', _122 => _122(input2), 'optionalAccess', _123 => _123.cues]);
2419
2428
  if (Object.keys(vtt).length === 0) {
2420
2429
  return {};
2421
2430
  } else {
@@ -2467,7 +2476,7 @@ function variableExtractLoader(params) {
2467
2476
  for (let i = 0; i < matches.length; i++) {
2468
2477
  const match = matches[i];
2469
2478
  const currentValue = result[key].value;
2470
- const newValue = _optionalChain([currentValue, 'optionalAccess', _126 => _126.replace, 'call', _127 => _127(match, `{variable:${i}}`)]);
2479
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _124 => _124.replace, 'call', _125 => _125(match, `{variable:${i}}`)]);
2471
2480
  result[key].value = newValue;
2472
2481
  result[key].variables[i] = match;
2473
2482
  }
@@ -2481,7 +2490,7 @@ function variableExtractLoader(params) {
2481
2490
  for (let i = 0; i < valueObj.variables.length; i++) {
2482
2491
  const variable = valueObj.variables[i];
2483
2492
  const currentValue = result[key];
2484
- const newValue = _optionalChain([currentValue, 'optionalAccess', _128 => _128.replace, 'call', _129 => _129(`{variable:${i}}`, variable)]);
2493
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _126 => _126.replace, 'call', _127 => _127(`{variable:${i}}`, variable)]);
2485
2494
  result[key] = newValue;
2486
2495
  }
2487
2496
  }
@@ -2989,11 +2998,11 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
2989
2998
  const auth = await validateAuth(settings);
2990
2999
  ora.succeed(`Authenticated as ${auth.email}`);
2991
3000
  let buckets = getBuckets(i18nConfig);
2992
- if (_optionalChain([flags, 'access', _130 => _130.bucket, 'optionalAccess', _131 => _131.length])) {
3001
+ if (_optionalChain([flags, 'access', _128 => _128.bucket, 'optionalAccess', _129 => _129.length])) {
2993
3002
  buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
2994
3003
  }
2995
3004
  ora.succeed("Buckets retrieved");
2996
- const targetLocales = _optionalChain([flags, 'access', _132 => _132.locale, 'optionalAccess', _133 => _133.length]) ? flags.locale : i18nConfig.locale.targets;
3005
+ const targetLocales = _optionalChain([flags, 'access', _130 => _130.locale, 'optionalAccess', _131 => _131.length]) ? flags.locale : i18nConfig.locale.targets;
2997
3006
  const lockfileHelper = createLockfileHelper();
2998
3007
  ora.start("Ensuring i18n.lock exists...");
2999
3008
  if (!lockfileHelper.isLockfileExists()) {
@@ -3279,12 +3288,12 @@ function validateParams(i18nConfig, flags) {
3279
3288
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
3280
3289
  docUrl: "bucketNotFound"
3281
3290
  });
3282
- } else if (_optionalChain([flags, 'access', _134 => _134.locale, 'optionalAccess', _135 => _135.some, 'call', _136 => _136((locale) => !i18nConfig.locale.targets.includes(locale))])) {
3291
+ } else if (_optionalChain([flags, 'access', _132 => _132.locale, 'optionalAccess', _133 => _133.some, 'call', _134 => _134((locale) => !i18nConfig.locale.targets.includes(locale))])) {
3283
3292
  throw new CLIError({
3284
3293
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
3285
3294
  docUrl: "localeTargetNotFound"
3286
3295
  });
3287
- } else if (_optionalChain([flags, 'access', _137 => _137.bucket, 'optionalAccess', _138 => _138.some, 'call', _139 => _139((bucket) => !i18nConfig.buckets[bucket])])) {
3296
+ } else if (_optionalChain([flags, 'access', _135 => _135.bucket, 'optionalAccess', _136 => _136.some, 'call', _137 => _137((bucket) => !i18nConfig.buckets[bucket])])) {
3288
3297
  throw new CLIError({
3289
3298
  message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
3290
3299
  docUrl: "bucketNotFound"
@@ -3511,7 +3520,7 @@ function displaySummary(results) {
3511
3520
  // package.json
3512
3521
  var package_default = {
3513
3522
  name: "lingo.dev",
3514
- version: "0.75.0",
3523
+ version: "0.76.0",
3515
3524
  description: "Lingo.dev CLI",
3516
3525
  private: false,
3517
3526
  publishConfig: {