lingo.dev 0.79.1 → 0.79.3

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
@@ -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', _22 => _22.auth, 'optionalAccess', _23 => _23.apiKey]) || defaults.auth.apiKey,
30
- apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _24 => _24.auth, 'optionalAccess', _25 => _25.apiUrl]) || defaults.auth.apiUrl,
31
- webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _26 => _26.auth, 'optionalAccess', _27 => _27.webUrl]) || defaults.auth.webUrl
29
+ apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access', _23 => _23.auth, 'optionalAccess', _24 => _24.apiKey]) || defaults.auth.apiKey,
30
+ apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _25 => _25.auth, 'optionalAccess', _26 => _26.apiUrl]) || defaults.auth.apiUrl,
31
+ webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _27 => _27.auth, 'optionalAccess', _28 => _28.webUrl]) || defaults.auth.webUrl
32
32
  }
33
33
  };
34
34
  }
@@ -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', _28 => _28.auth, 'optionalAccess', _29 => _29.apiKey])) {
102
+ if (env.LINGODOTDEV_API_KEY && _optionalChain([systemFile, 'access', _29 => _29.auth, 'optionalAccess', _30 => _30.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', _30 => _30.email])) {
157
+ if (!_optionalChain([payload, 'optionalAccess', _31 => _31.email])) {
158
158
  return null;
159
159
  }
160
160
  return {
@@ -773,7 +773,7 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
773
773
  });
774
774
  const auth2 = await newAuthenticator.whoami();
775
775
  if (auth2) {
776
- _ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _31 => _31.email])}`);
776
+ _ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _32 => _32.email])}`);
777
777
  } else {
778
778
  _ora2.default.call(void 0, ).fail("Authentication failed.");
779
779
  }
@@ -853,11 +853,15 @@ var locale_default = new (0, _interactivecommander.Command)().command("locale").
853
853
  function getBuckets(i18nConfig) {
854
854
  const result = Object.entries(i18nConfig.buckets).map(([bucketType, bucketEntry]) => {
855
855
  const includeItems = bucketEntry.include.map((item) => resolveBucketItem(item));
856
- const excludeItems = _optionalChain([bucketEntry, 'access', _32 => _32.exclude, 'optionalAccess', _33 => _33.map, 'call', _34 => _34((item) => resolveBucketItem(item))]);
857
- return {
856
+ const excludeItems = _optionalChain([bucketEntry, 'access', _33 => _33.exclude, 'optionalAccess', _34 => _34.map, 'call', _35 => _35((item) => resolveBucketItem(item))]);
857
+ const config = {
858
858
  type: bucketType,
859
- config: extractPathPatterns(i18nConfig.locale.source, includeItems, excludeItems)
859
+ paths: extractPathPatterns(i18nConfig.locale.source, includeItems, excludeItems)
860
860
  };
861
+ if (bucketEntry.injectLocale) {
862
+ config.injectLocale = bucketEntry.injectLocale;
863
+ }
864
+ return config;
861
865
  });
862
866
  return result;
863
867
  }
@@ -870,7 +874,7 @@ function extractPathPatterns(sourceLocale, include, exclude) {
870
874
  })
871
875
  )
872
876
  );
873
- const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _35 => _35.flatMap, 'call', _36 => _36(
877
+ const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _36 => _36.flatMap, 'call', _37 => _37(
874
878
  (pattern) => expandPlaceholderedGlob(pattern.path, __spec.resolveOverriddenLocale.call(void 0, sourceLocale, pattern.delimiter)).map(
875
879
  (pathPattern) => ({
876
880
  pathPattern,
@@ -947,7 +951,7 @@ var files_default = new (0, _interactivecommander.Command)().command("files").de
947
951
  }
948
952
  const buckets = getBuckets(i18nConfig);
949
953
  for (const bucket of buckets) {
950
- for (const bucketConfig of bucket.config) {
954
+ for (const bucketConfig of bucket.paths) {
951
955
  const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
952
956
  const sourcePath = bucketConfig.pathPattern.replace(/\[locale\]/g, sourceLocale);
953
957
  const targetPaths = i18nConfig.locale.targets.map((_targetLocale) => {
@@ -995,12 +999,12 @@ function composeLoaders(...loaders) {
995
999
  return {
996
1000
  init: async () => {
997
1001
  for (const loader of loaders) {
998
- await _optionalChain([loader, 'access', _37 => _37.init, 'optionalCall', _38 => _38()]);
1002
+ await _optionalChain([loader, 'access', _38 => _38.init, 'optionalCall', _39 => _39()]);
999
1003
  }
1000
1004
  },
1001
1005
  setDefaultLocale(locale) {
1002
1006
  for (const loader of loaders) {
1003
- _optionalChain([loader, 'access', _39 => _39.setDefaultLocale, 'optionalCall', _40 => _40(locale)]);
1007
+ _optionalChain([loader, 'access', _40 => _40.setDefaultLocale, 'optionalCall', _41 => _41(locale)]);
1004
1008
  }
1005
1009
  return this;
1006
1010
  },
@@ -1031,7 +1035,7 @@ function createLoader(lDefinition) {
1031
1035
  if (state.initCtx) {
1032
1036
  return state.initCtx;
1033
1037
  }
1034
- state.initCtx = await _optionalChain([lDefinition, 'access', _41 => _41.init, 'optionalCall', _42 => _42()]);
1038
+ state.initCtx = await _optionalChain([lDefinition, 'access', _42 => _42.init, 'optionalCall', _43 => _43()]);
1035
1039
  return state.initCtx;
1036
1040
  },
1037
1041
  setDefaultLocale(locale) {
@@ -1120,7 +1124,7 @@ function createNormalizeLoader() {
1120
1124
  return normalized;
1121
1125
  },
1122
1126
  push: async (locale, data, originalInput) => {
1123
- const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _43 => _43.keysMap]), () => ( {}));
1127
+ const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _44 => _44.keysMap]), () => ( {}));
1124
1128
  const input2 = mapDenormalizedKeys(data, keysMap);
1125
1129
  const denormalized = _flat.unflatten.call(void 0, input2, {
1126
1130
  delimiter: "/",
@@ -1194,7 +1198,7 @@ function createTextFileLoader(pathPattern) {
1194
1198
  const trimmedResult = result.trim();
1195
1199
  return trimmedResult;
1196
1200
  },
1197
- async push(locale, data, _21, originalLocale) {
1201
+ async push(locale, data, _22, originalLocale) {
1198
1202
  const draftPath = pathPattern.replaceAll("[locale]", locale);
1199
1203
  const finalPath = _path2.default.resolve(draftPath);
1200
1204
  const dirPath = _path2.default.dirname(finalPath);
@@ -1223,8 +1227,8 @@ async function getTrailingNewLine(pathPattern, locale, originalLocale) {
1223
1227
  if (!templateData) {
1224
1228
  templateData = await readFileForLocale(pathPattern, originalLocale);
1225
1229
  }
1226
- if (_optionalChain([templateData, 'optionalAccess', _44 => _44.match, 'call', _45 => _45(/[\r\n]$/)])) {
1227
- const ending = _optionalChain([templateData, 'optionalAccess', _46 => _46.includes, 'call', _47 => _47("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _48 => _48.includes, 'call', _49 => _49("\r")]) ? "\r" : "\n";
1230
+ if (_optionalChain([templateData, 'optionalAccess', _45 => _45.match, 'call', _46 => _46(/[\r\n]$/)])) {
1231
+ 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";
1228
1232
  return ending;
1229
1233
  }
1230
1234
  return "";
@@ -1479,7 +1483,7 @@ function createHtmlLoader() {
1479
1483
  break;
1480
1484
  }
1481
1485
  const siblings = Array.from(parent.childNodes).filter(
1482
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _50 => _50.textContent, 'optionalAccess', _51 => _51.trim, 'call', _52 => _52()])
1486
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _51 => _51.textContent, 'optionalAccess', _52 => _52.trim, 'call', _53 => _53()])
1483
1487
  );
1484
1488
  const index = siblings.indexOf(current);
1485
1489
  if (index !== -1) {
@@ -1514,11 +1518,11 @@ function createHtmlLoader() {
1514
1518
  result[getPath(element, attr)] = value;
1515
1519
  }
1516
1520
  });
1517
- Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _53 => _53.textContent, 'optionalAccess', _54 => _54.trim, 'call', _55 => _55()])).forEach(processNode);
1521
+ 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);
1518
1522
  }
1519
1523
  };
1520
- Array.from(document.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _56 => _56.textContent, 'optionalAccess', _57 => _57.trim, 'call', _58 => _58()])).forEach(processNode);
1521
- Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _59 => _59.textContent, 'optionalAccess', _60 => _60.trim, 'call', _61 => _61()])).forEach(processNode);
1524
+ 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);
1525
+ 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);
1522
1526
  return result;
1523
1527
  },
1524
1528
  async push(locale, data, originalInput) {
@@ -1540,7 +1544,7 @@ function createHtmlLoader() {
1540
1544
  for (let i = 0; i < indices.length; i++) {
1541
1545
  const index = parseInt(indices[i]);
1542
1546
  const siblings = Array.from(parent.childNodes).filter(
1543
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _62 => _62.textContent, 'optionalAccess', _63 => _63.trim, 'call', _64 => _64()])
1547
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _63 => _63.textContent, 'optionalAccess', _64 => _64.trim, 'call', _65 => _65()])
1544
1548
  );
1545
1549
  if (index >= siblings.length) {
1546
1550
  if (i === indices.length - 1) {
@@ -1591,7 +1595,7 @@ function createMarkdownLoader() {
1591
1595
  yaml: yamlEngine
1592
1596
  }
1593
1597
  });
1594
- const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _65 => _65.trim, 'call', _66 => _66()]), () => ( ""))).filter(Boolean);
1598
+ const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _66 => _66.trim, 'call', _67 => _67()]), () => ( ""))).filter(Boolean);
1595
1599
  return {
1596
1600
  ...Object.fromEntries(
1597
1601
  sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
@@ -1603,7 +1607,7 @@ function createMarkdownLoader() {
1603
1607
  const frontmatter = Object.fromEntries(
1604
1608
  Object.entries(data).filter(([key]) => key.startsWith(FM_ATTR_PREFIX)).map(([key, value]) => [key.replace(FM_ATTR_PREFIX, ""), value])
1605
1609
  );
1606
- 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', _67 => _67.trim, 'call', _68 => _68()]), () => ( ""))).filter(Boolean).join("\n\n");
1610
+ 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', _68 => _68.trim, 'call', _69 => _69()]), () => ( ""))).filter(Boolean).join("\n\n");
1607
1611
  if (Object.keys(frontmatter).length > 0) {
1608
1612
  content = `
1609
1613
  ${content}`;
@@ -1636,7 +1640,7 @@ function createPropertiesLoader() {
1636
1640
  return result;
1637
1641
  },
1638
1642
  async push(locale, payload) {
1639
- const result = Object.entries(payload).filter(([_21, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
1643
+ const result = Object.entries(payload).filter(([_22, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
1640
1644
  return result;
1641
1645
  }
1642
1646
  });
@@ -1647,7 +1651,7 @@ function isSkippableLine(line) {
1647
1651
  function parsePropertyLine(line) {
1648
1652
  const [key, ...valueParts] = line.split("=");
1649
1653
  return {
1650
- key: _optionalChain([key, 'optionalAccess', _69 => _69.trim, 'call', _70 => _70()]) || "",
1654
+ key: _optionalChain([key, 'optionalAccess', _70 => _70.trim, 'call', _71 => _71()]) || "",
1651
1655
  value: valueParts.join("=").trim()
1652
1656
  };
1653
1657
  }
@@ -1733,7 +1737,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
1733
1737
  if (rootTranslationEntity.shouldTranslate === false) {
1734
1738
  continue;
1735
1739
  }
1736
- const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _71 => _71.localizations, 'optionalAccess', _72 => _72[locale]]);
1740
+ const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _72 => _72.localizations, 'optionalAccess', _73 => _73[locale]]);
1737
1741
  if (langTranslationEntity) {
1738
1742
  if ("stringUnit" in langTranslationEntity) {
1739
1743
  resultData[translationKey] = langTranslationEntity.stringUnit.value;
@@ -1742,7 +1746,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
1742
1746
  resultData[translationKey] = {};
1743
1747
  const pluralForms = langTranslationEntity.variations.plural;
1744
1748
  for (const form in pluralForms) {
1745
- if (_optionalChain([pluralForms, 'access', _73 => _73[form], 'optionalAccess', _74 => _74.stringUnit, 'optionalAccess', _75 => _75.value])) {
1749
+ if (_optionalChain([pluralForms, 'access', _74 => _74[form], 'optionalAccess', _75 => _75.stringUnit, 'optionalAccess', _76 => _76.value])) {
1746
1750
  resultData[translationKey][form] = pluralForms[form].stringUnit.value;
1747
1751
  }
1748
1752
  }
@@ -1766,7 +1770,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
1766
1770
  const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
1767
1771
  if (typeof value === "string") {
1768
1772
  langDataToMerge.strings[key] = {
1769
- extractionState: _optionalChain([originalInput, 'optionalAccess', _76 => _76.strings, 'optionalAccess', _77 => _77[key], 'optionalAccess', _78 => _78.extractionState]),
1773
+ extractionState: _optionalChain([originalInput, 'optionalAccess', _77 => _77.strings, 'optionalAccess', _78 => _78[key], 'optionalAccess', _79 => _79.extractionState]),
1770
1774
  localizations: {
1771
1775
  [locale]: {
1772
1776
  stringUnit: {
@@ -1871,13 +1875,17 @@ async function installDependencies() {
1871
1875
  }
1872
1876
  async function getPackageManager() {
1873
1877
  const yarnLockfile = _path2.default.resolve(process.cwd(), "yarn.lock");
1874
- const pnpmLockfile = _path2.default.resolve(process.cwd(), "pnpm-lock.yaml");
1875
1878
  if (_fs2.default.existsSync(yarnLockfile)) {
1876
1879
  return "yarn";
1877
1880
  }
1881
+ const pnpmLockfile = _path2.default.resolve(process.cwd(), "pnpm-lock.yaml");
1878
1882
  if (_fs2.default.existsSync(pnpmLockfile)) {
1879
1883
  return "pnpm";
1880
1884
  }
1885
+ const bunLockfile = _path2.default.resolve(process.cwd(), "bun.lock");
1886
+ if (_fs2.default.existsSync(bunLockfile)) {
1887
+ return "bun";
1888
+ }
1881
1889
  return "npm";
1882
1890
  }
1883
1891
 
@@ -1903,10 +1911,10 @@ function createUnlocalizableLoader(isCacheRestore = false, returnUnlocalizedKeys
1903
1911
  }
1904
1912
  }
1905
1913
  return false;
1906
- }).map(([key, _21]) => key);
1907
- const result = _lodash2.default.omitBy(input2, (_21, key) => passthroughKeys.includes(key));
1914
+ }).map(([key, _22]) => key);
1915
+ const result = _lodash2.default.omitBy(input2, (_22, key) => passthroughKeys.includes(key));
1908
1916
  if (returnUnlocalizedKeys) {
1909
- result.unlocalizable = _lodash2.default.omitBy(input2, (_21, key) => !passthroughKeys.includes(key));
1917
+ result.unlocalizable = _lodash2.default.omitBy(input2, (_22, key) => !passthroughKeys.includes(key));
1910
1918
  }
1911
1919
  return result;
1912
1920
  },
@@ -1945,7 +1953,7 @@ function createPoDataLoader(params) {
1945
1953
  Object.entries(entries).forEach(([msgid, entry]) => {
1946
1954
  if (msgid && entry.msgid) {
1947
1955
  const context = entry.msgctxt || "";
1948
- const fullEntry = _optionalChain([parsedPo, 'access', _79 => _79.translations, 'access', _80 => _80[context], 'optionalAccess', _81 => _81[msgid]]);
1956
+ const fullEntry = _optionalChain([parsedPo, 'access', _80 => _80.translations, 'access', _81 => _81[context], 'optionalAccess', _82 => _82[msgid]]);
1949
1957
  if (fullEntry) {
1950
1958
  result[msgid] = fullEntry;
1951
1959
  }
@@ -1955,7 +1963,7 @@ function createPoDataLoader(params) {
1955
1963
  return result;
1956
1964
  },
1957
1965
  async push(locale, data, originalInput) {
1958
- const sections = _optionalChain([originalInput, 'optionalAccess', _82 => _82.split, 'call', _83 => _83("\n\n"), 'access', _84 => _84.filter, 'call', _85 => _85(Boolean)]) || [];
1966
+ const sections = _optionalChain([originalInput, 'optionalAccess', _83 => _83.split, 'call', _84 => _84("\n\n"), 'access', _85 => _85.filter, 'call', _86 => _86(Boolean)]) || [];
1959
1967
  const result = sections.map((section) => {
1960
1968
  const sectionPo = _gettextparser2.default.po.parse(section);
1961
1969
  const contextKey = _lodash2.default.keys(sectionPo.translations)[0];
@@ -1997,7 +2005,7 @@ function createPoContentLoader() {
1997
2005
  entry.msgid,
1998
2006
  {
1999
2007
  ...entry,
2000
- msgstr: [_optionalChain([data, 'access', _86 => _86[entry.msgid], 'optionalAccess', _87 => _87.singular]), _optionalChain([data, 'access', _88 => _88[entry.msgid], 'optionalAccess', _89 => _89.plural]) || null].filter(Boolean)
2008
+ msgstr: [_optionalChain([data, 'access', _87 => _87[entry.msgid], 'optionalAccess', _88 => _88.singular]), _optionalChain([data, 'access', _89 => _89[entry.msgid], 'optionalAccess', _90 => _90.plural]) || null].filter(Boolean)
2001
2009
  }
2002
2010
  ]).fromPairs().value();
2003
2011
  return result;
@@ -2243,7 +2251,7 @@ function createDatoClient(params) {
2243
2251
  only_valid: "true",
2244
2252
  ids: !records.length ? void 0 : records.join(",")
2245
2253
  }
2246
- }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _90 => _90.response, 'optionalAccess', _91 => _91.body, 'optionalAccess', _92 => _92.data, 'optionalAccess', _93 => _93[0]]) || error));
2254
+ }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _91 => _91.response, 'optionalAccess', _92 => _92.body, 'optionalAccess', _93 => _93.data, 'optionalAccess', _94 => _94[0]]) || error));
2247
2255
  },
2248
2256
  findRecordsForModel: async (modelId, records) => {
2249
2257
  try {
@@ -2253,9 +2261,9 @@ function createDatoClient(params) {
2253
2261
  filter: {
2254
2262
  type: modelId,
2255
2263
  only_valid: "true",
2256
- ids: !_optionalChain([records, 'optionalAccess', _94 => _94.length]) ? void 0 : records.join(",")
2264
+ ids: !_optionalChain([records, 'optionalAccess', _95 => _95.length]) ? void 0 : records.join(",")
2257
2265
  }
2258
- }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _95 => _95.response, 'optionalAccess', _96 => _96.body, 'optionalAccess', _97 => _97.data, 'optionalAccess', _98 => _98[0]]) || error));
2266
+ }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _96 => _96.response, 'optionalAccess', _97 => _97.body, 'optionalAccess', _98 => _98.data, 'optionalAccess', _99 => _99[0]]) || error));
2259
2267
  return result;
2260
2268
  } catch (_error) {
2261
2269
  throw new Error(
@@ -2269,9 +2277,9 @@ function createDatoClient(params) {
2269
2277
  },
2270
2278
  updateRecord: async (id, payload) => {
2271
2279
  try {
2272
- await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _99 => _99.response, 'optionalAccess', _100 => _100.body, 'optionalAccess', _101 => _101.data, 'optionalAccess', _102 => _102[0]]) || error));
2280
+ await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _100 => _100.response, 'optionalAccess', _101 => _101.body, 'optionalAccess', _102 => _102.data, 'optionalAccess', _103 => _103[0]]) || error));
2273
2281
  } catch (_error) {
2274
- if (_optionalChain([_error, 'optionalAccess', _103 => _103.attributes, 'optionalAccess', _104 => _104.details, 'optionalAccess', _105 => _105.message])) {
2282
+ if (_optionalChain([_error, 'optionalAccess', _104 => _104.attributes, 'optionalAccess', _105 => _105.details, 'optionalAccess', _106 => _106.message])) {
2275
2283
  throw new Error(
2276
2284
  [
2277
2285
  `${_error.attributes.details.message}`,
@@ -2292,9 +2300,9 @@ function createDatoClient(params) {
2292
2300
  },
2293
2301
  enableFieldLocalization: async (args) => {
2294
2302
  try {
2295
- await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _106 => _106.response, 'optionalAccess', _107 => _107.body, 'optionalAccess', _108 => _108.data, 'optionalAccess', _109 => _109[0]]) || error));
2303
+ await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _107 => _107.response, 'optionalAccess', _108 => _108.body, 'optionalAccess', _109 => _109.data, 'optionalAccess', _110 => _110[0]]) || error));
2296
2304
  } catch (_error) {
2297
- if (_optionalChain([_error, 'optionalAccess', _110 => _110.attributes, 'optionalAccess', _111 => _111.code]) === "NOT_FOUND") {
2305
+ if (_optionalChain([_error, 'optionalAccess', _111 => _111.attributes, 'optionalAccess', _112 => _112.code]) === "NOT_FOUND") {
2298
2306
  throw new Error(
2299
2307
  [
2300
2308
  `Field "${args.fieldId}" not found in model "${args.modelId}".`,
@@ -2302,7 +2310,7 @@ function createDatoClient(params) {
2302
2310
  ].join("\n\n")
2303
2311
  );
2304
2312
  }
2305
- if (_optionalChain([_error, 'optionalAccess', _112 => _112.attributes, 'optionalAccess', _113 => _113.details, 'optionalAccess', _114 => _114.message])) {
2313
+ if (_optionalChain([_error, 'optionalAccess', _113 => _113.attributes, 'optionalAccess', _114 => _114.details, 'optionalAccess', _115 => _115.message])) {
2306
2314
  throw new Error(
2307
2315
  [`${_error.attributes.details.message}`, `Error: ${JSON.stringify(_error, null, 2)}`].join("\n\n")
2308
2316
  );
@@ -2368,7 +2376,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
2368
2376
  }
2369
2377
  }
2370
2378
  const records = await dato.findRecordsForModel(modelId);
2371
- const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _115 => _115.models, 'access', _116 => _116[modelId], 'optionalAccess', _117 => _117.records]) || [], project);
2379
+ const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _116 => _116.models, 'access', _117 => _117[modelId], 'optionalAccess', _118 => _118.records]) || [], project);
2372
2380
  const selectedRecords = await promptRecordSelection(modelName, recordChoices);
2373
2381
  result.models[modelId].records = records.filter((record) => selectedRecords.includes(record.id));
2374
2382
  updatedConfig.models[modelId].records = selectedRecords;
@@ -2380,14 +2388,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
2380
2388
  },
2381
2389
  async pull(locale, input2, initCtx) {
2382
2390
  const result = {};
2383
- for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _118 => _118.models]) || {})) {
2384
- let records = _optionalChain([initCtx, 'optionalAccess', _119 => _119.models, 'access', _120 => _120[modelId], 'access', _121 => _121.records]) || [];
2391
+ for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _119 => _119.models]) || {})) {
2392
+ let records = _optionalChain([initCtx, 'optionalAccess', _120 => _120.models, 'access', _121 => _121[modelId], 'access', _122 => _122.records]) || [];
2385
2393
  const recordIds = records.map((record) => record.id);
2386
2394
  records = await dato.findRecords(recordIds);
2387
2395
  console.log(`Fetched ${records.length} records for model ${modelId}`);
2388
2396
  if (records.length > 0) {
2389
2397
  result[modelId] = {
2390
- fields: _optionalChain([initCtx, 'optionalAccess', _122 => _122.models, 'optionalAccess', _123 => _123[modelId], 'optionalAccess', _124 => _124.fields]) || [],
2398
+ fields: _optionalChain([initCtx, 'optionalAccess', _123 => _123.models, 'optionalAccess', _124 => _124[modelId], 'optionalAccess', _125 => _125.fields]) || [],
2391
2399
  records
2392
2400
  };
2393
2401
  }
@@ -2446,7 +2454,7 @@ function createRecordChoices(records, selectedIds = [], project) {
2446
2454
  return records.map((record) => ({
2447
2455
  name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
2448
2456
  value: record.id,
2449
- checked: _optionalChain([selectedIds, 'optionalAccess', _125 => _125.includes, 'call', _126 => _126(record.id)])
2457
+ checked: _optionalChain([selectedIds, 'optionalAccess', _126 => _126.includes, 'call', _127 => _127(record.id)])
2450
2458
  }));
2451
2459
  }
2452
2460
  async function promptRecordSelection(modelName, choices) {
@@ -2713,7 +2721,7 @@ var _nodewebvtt = require('node-webvtt'); var _nodewebvtt2 = _interopRequireDefa
2713
2721
  function createVttLoader() {
2714
2722
  return createLoader({
2715
2723
  async pull(locale, input2) {
2716
- const vtt = _optionalChain([_nodewebvtt2.default, 'access', _127 => _127.parse, 'call', _128 => _128(input2), 'optionalAccess', _129 => _129.cues]);
2724
+ const vtt = _optionalChain([_nodewebvtt2.default, 'access', _128 => _128.parse, 'call', _129 => _129(input2), 'optionalAccess', _130 => _130.cues]);
2717
2725
  if (Object.keys(vtt).length === 0) {
2718
2726
  return {};
2719
2727
  } else {
@@ -2765,7 +2773,7 @@ function variableExtractLoader(params) {
2765
2773
  for (let i = 0; i < matches.length; i++) {
2766
2774
  const match = matches[i];
2767
2775
  const currentValue = result[key].value;
2768
- const newValue = _optionalChain([currentValue, 'optionalAccess', _130 => _130.replace, 'call', _131 => _131(match, `{variable:${i}}`)]);
2776
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _131 => _131.replace, 'call', _132 => _132(match, `{variable:${i}}`)]);
2769
2777
  result[key].value = newValue;
2770
2778
  result[key].variables[i] = match;
2771
2779
  }
@@ -2779,7 +2787,7 @@ function variableExtractLoader(params) {
2779
2787
  for (let i = 0; i < valueObj.variables.length; i++) {
2780
2788
  const variable = valueObj.variables[i];
2781
2789
  const currentValue = result[key];
2782
- const newValue = _optionalChain([currentValue, 'optionalAccess', _132 => _132.replace, 'call', _133 => _133(`{variable:${i}}`, variable)]);
2790
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _133 => _133.replace, 'call', _134 => _134(`{variable:${i}}`, variable)]);
2783
2791
  result[key] = newValue;
2784
2792
  }
2785
2793
  }
@@ -2960,7 +2968,7 @@ function createVueJsonLoader() {
2960
2968
  return createLoader({
2961
2969
  pull: async (locale, input2, ctx) => {
2962
2970
  const parsed = parseVueFile(input2);
2963
- return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _134 => _134.i18n, 'optionalAccess', _135 => _135[locale]]), () => ( {}));
2971
+ return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _135 => _135.i18n, 'optionalAccess', _136 => _136[locale]]), () => ( {}));
2964
2972
  },
2965
2973
  push: async (locale, data, originalInput) => {
2966
2974
  const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
@@ -2989,6 +2997,34 @@ function parseVueFile(input2) {
2989
2997
  return { before, after, i18n };
2990
2998
  }
2991
2999
 
3000
+ // src/cli/loaders/inject-locale.ts
3001
+
3002
+ function createInjectLocaleLoader(injectLocaleKeys) {
3003
+ return createLoader({
3004
+ async pull(locale, data) {
3005
+ if (!injectLocaleKeys) {
3006
+ return data;
3007
+ }
3008
+ const omitKeys = injectLocaleKeys.filter((key) => {
3009
+ return _lodash2.default.get(data, key) === locale;
3010
+ });
3011
+ const result = _lodash2.default.omit(data, omitKeys);
3012
+ return result;
3013
+ },
3014
+ async push(locale, data, originalInput, originalLocale) {
3015
+ if (!injectLocaleKeys) {
3016
+ return data;
3017
+ }
3018
+ injectLocaleKeys.forEach((key) => {
3019
+ if (_lodash2.default.get(originalInput, key) === originalLocale) {
3020
+ _lodash2.default.set(data, key, locale);
3021
+ }
3022
+ });
3023
+ return data;
3024
+ }
3025
+ });
3026
+ }
3027
+
2992
3028
  // src/cli/loaders/index.ts
2993
3029
  function createBucketLoader(bucketType, bucketPathPattern, options) {
2994
3030
  switch (bucketType) {
@@ -3023,6 +3059,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options) {
3023
3059
  createTextFileLoader(bucketPathPattern),
3024
3060
  createPrettierLoader({ parser: "json", bucketPathPattern }),
3025
3061
  createJsonLoader(),
3062
+ createInjectLocaleLoader(options.injectLocale),
3026
3063
  createFlatLoader(),
3027
3064
  createSyncLoader(),
3028
3065
  createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
@@ -3340,17 +3377,15 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3340
3377
  const auth = await validateAuth(settings);
3341
3378
  ora.succeed(`Authenticated as ${auth.email}`);
3342
3379
  let buckets = getBuckets(i18nConfig);
3343
- if (_optionalChain([flags, 'access', _136 => _136.bucket, 'optionalAccess', _137 => _137.length])) {
3380
+ if (_optionalChain([flags, 'access', _137 => _137.bucket, 'optionalAccess', _138 => _138.length])) {
3344
3381
  buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
3345
3382
  }
3346
3383
  ora.succeed("Buckets retrieved");
3347
- if (_optionalChain([flags, 'access', _138 => _138.file, 'optionalAccess', _139 => _139.length])) {
3384
+ if (_optionalChain([flags, 'access', _139 => _139.file, 'optionalAccess', _140 => _140.length])) {
3348
3385
  buckets = buckets.map((bucket) => {
3349
- const config = bucket.config.filter(
3350
- (config2) => flags.file.find((file) => _optionalChain([config2, 'access', _140 => _140.pathPattern, 'optionalAccess', _141 => _141.match, 'call', _142 => _142(file)]))
3351
- );
3352
- return { ...bucket, config };
3353
- }).filter((bucket) => bucket.config.length > 0);
3386
+ const paths = bucket.paths.filter((path15) => flags.file.find((file) => _optionalChain([path15, 'access', _141 => _141.pathPattern, 'optionalAccess', _142 => _142.match, 'call', _143 => _143(file)])));
3387
+ return { ...bucket, paths };
3388
+ }).filter((bucket) => bucket.paths.length > 0);
3354
3389
  if (buckets.length === 0) {
3355
3390
  ora.fail("No buckets found. All buckets were filtered out by --file option.");
3356
3391
  process.exit(1);
@@ -3358,28 +3393,29 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3358
3393
  ora.info(`\x1B[36mProcessing only filtered buckets:\x1B[0m`);
3359
3394
  buckets.map((bucket) => {
3360
3395
  ora.info(` ${bucket.type}:`);
3361
- bucket.config.forEach((config) => {
3362
- ora.info(` - ${config.pathPattern}`);
3396
+ bucket.paths.forEach((path15) => {
3397
+ ora.info(` - ${path15.pathPattern}`);
3363
3398
  });
3364
3399
  });
3365
3400
  }
3366
3401
  }
3367
- const targetLocales = _optionalChain([flags, 'access', _143 => _143.locale, 'optionalAccess', _144 => _144.length]) ? flags.locale : i18nConfig.locale.targets;
3402
+ const targetLocales = _optionalChain([flags, 'access', _144 => _144.locale, 'optionalAccess', _145 => _145.length]) ? flags.locale : i18nConfig.locale.targets;
3368
3403
  const lockfileHelper = createLockfileHelper();
3369
3404
  ora.start("Ensuring i18n.lock exists...");
3370
3405
  if (!lockfileHelper.isLockfileExists()) {
3371
3406
  ora.start("Creating i18n.lock...");
3372
3407
  for (const bucket of buckets) {
3373
- for (const bucketConfig of bucket.config) {
3374
- const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3375
- const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3408
+ for (const bucketPath of bucket.paths) {
3409
+ const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketPath.delimiter);
3410
+ const bucketLoader = createBucketLoader(bucket.type, bucketPath.pathPattern, {
3376
3411
  isCacheRestore: false,
3377
- defaultLocale: sourceLocale
3412
+ defaultLocale: sourceLocale,
3413
+ injectLocale: bucket.injectLocale
3378
3414
  });
3379
3415
  bucketLoader.setDefaultLocale(sourceLocale);
3380
3416
  await bucketLoader.init();
3381
3417
  const sourceData = await bucketLoader.pull(i18nConfig.locale.source);
3382
- lockfileHelper.registerSourceData(bucketConfig.pathPattern, sourceData);
3418
+ lockfileHelper.registerSourceData(bucketPath.pathPattern, sourceData);
3383
3419
  }
3384
3420
  }
3385
3421
  ora.succeed("i18n.lock created");
@@ -3393,13 +3429,14 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3393
3429
  const cacheOra = _ora2.default.call(void 0, { indent: 2 });
3394
3430
  for (const bucket of buckets) {
3395
3431
  cacheOra.info(`Processing bucket: ${bucket.type}`);
3396
- for (const bucketConfig of bucket.config) {
3432
+ for (const bucketPath of bucket.paths) {
3397
3433
  const bucketOra = _ora2.default.call(void 0, { indent: 4 });
3398
- bucketOra.info(`Processing path: ${bucketConfig.pathPattern}`);
3399
- const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3400
- const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3434
+ bucketOra.info(`Processing path: ${bucketPath.pathPattern}`);
3435
+ const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketPath.delimiter);
3436
+ const bucketLoader = createBucketLoader(bucket.type, bucketPath.pathPattern, {
3401
3437
  isCacheRestore: true,
3402
- defaultLocale: sourceLocale
3438
+ defaultLocale: sourceLocale,
3439
+ injectLocale: bucket.injectLocale
3403
3440
  });
3404
3441
  bucketLoader.setDefaultLocale(sourceLocale);
3405
3442
  await bucketLoader.init();
@@ -3415,7 +3452,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3415
3452
  }
3416
3453
  }
3417
3454
  await bucketLoader.push(targetLocale, targetData);
3418
- lockfileHelper.registerPartialSourceData(bucketConfig.pathPattern, cachedSourceData);
3455
+ lockfileHelper.registerPartialSourceData(bucketPath.pathPattern, cachedSourceData);
3419
3456
  bucketOra.succeed(
3420
3457
  `[${sourceLocale} -> ${targetLocale}] Recovered ${Object.keys(cachedSourceData).length} entries from cache`
3421
3458
  );
@@ -3433,25 +3470,26 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3433
3470
  ora.start("Checking for lockfile updates...");
3434
3471
  let requiresUpdate = null;
3435
3472
  bucketLoop: for (const bucket of buckets) {
3436
- for (const bucketConfig of bucket.config) {
3437
- const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3438
- const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3473
+ for (const bucketPath of bucket.paths) {
3474
+ const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketPath.delimiter);
3475
+ const bucketLoader = createBucketLoader(bucket.type, bucketPath.pathPattern, {
3439
3476
  isCacheRestore: false,
3440
3477
  defaultLocale: sourceLocale,
3441
- returnUnlocalizedKeys: true
3478
+ returnUnlocalizedKeys: true,
3479
+ injectLocale: bucket.injectLocale
3442
3480
  });
3443
3481
  bucketLoader.setDefaultLocale(sourceLocale);
3444
3482
  await bucketLoader.init();
3445
3483
  const { unlocalizable: sourceUnlocalizable, ...sourceData } = await bucketLoader.pull(
3446
3484
  i18nConfig.locale.source
3447
3485
  );
3448
- const updatedSourceData = lockfileHelper.extractUpdatedData(bucketConfig.pathPattern, sourceData);
3486
+ const updatedSourceData = lockfileHelper.extractUpdatedData(bucketPath.pathPattern, sourceData);
3449
3487
  if (Object.keys(updatedSourceData).length > 0) {
3450
3488
  requiresUpdate = "updated";
3451
3489
  break bucketLoop;
3452
3490
  }
3453
3491
  for (const _targetLocale of targetLocales) {
3454
- const targetLocale = __spec.resolveOverriddenLocale.call(void 0, _targetLocale, bucketConfig.delimiter);
3492
+ const targetLocale = __spec.resolveOverriddenLocale.call(void 0, _targetLocale, bucketPath.delimiter);
3455
3493
  const { unlocalizable: targetUnlocalizable, ...targetData } = await bucketLoader.pull(targetLocale);
3456
3494
  const missingKeys = _lodash2.default.difference(Object.keys(sourceData), Object.keys(targetData));
3457
3495
  const extraKeys = _lodash2.default.difference(Object.keys(targetData), Object.keys(sourceData));
@@ -3489,22 +3527,23 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3489
3527
  try {
3490
3528
  console.log();
3491
3529
  ora.info(`Processing bucket: ${bucket.type}`);
3492
- for (const bucketConfig of bucket.config) {
3493
- const bucketOra = _ora2.default.call(void 0, { indent: 2 }).info(`Processing path: ${bucketConfig.pathPattern}`);
3494
- const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3495
- const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3530
+ for (const bucketPath of bucket.paths) {
3531
+ const bucketOra = _ora2.default.call(void 0, { indent: 2 }).info(`Processing path: ${bucketPath.pathPattern}`);
3532
+ const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketPath.delimiter);
3533
+ const bucketLoader = createBucketLoader(bucket.type, bucketPath.pathPattern, {
3496
3534
  isCacheRestore: false,
3497
- defaultLocale: sourceLocale
3535
+ defaultLocale: sourceLocale,
3536
+ injectLocale: bucket.injectLocale
3498
3537
  });
3499
3538
  bucketLoader.setDefaultLocale(sourceLocale);
3500
3539
  await bucketLoader.init();
3501
3540
  let sourceData = await bucketLoader.pull(sourceLocale);
3502
3541
  for (const _targetLocale of targetLocales) {
3503
- const targetLocale = __spec.resolveOverriddenLocale.call(void 0, _targetLocale, bucketConfig.delimiter);
3542
+ const targetLocale = __spec.resolveOverriddenLocale.call(void 0, _targetLocale, bucketPath.delimiter);
3504
3543
  try {
3505
3544
  bucketOra.start(`[${sourceLocale} -> ${targetLocale}] (0%) Localization in progress...`);
3506
3545
  sourceData = await bucketLoader.pull(sourceLocale);
3507
- const updatedSourceData = flags.force ? sourceData : lockfileHelper.extractUpdatedData(bucketConfig.pathPattern, sourceData);
3546
+ const updatedSourceData = flags.force ? sourceData : lockfileHelper.extractUpdatedData(bucketPath.pathPattern, sourceData);
3508
3547
  const targetData = await bucketLoader.pull(targetLocale);
3509
3548
  let processableData = calculateDataDelta({
3510
3549
  sourceData,
@@ -3512,7 +3551,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3512
3551
  targetData
3513
3552
  });
3514
3553
  if (flags.key) {
3515
- processableData = _lodash2.default.pickBy(processableData, (_21, key) => key === flags.key);
3554
+ processableData = _lodash2.default.pickBy(processableData, (_22, key) => key === flags.key);
3516
3555
  }
3517
3556
  if (flags.verbose) {
3518
3557
  bucketOra.info(JSON.stringify(processableData, null, 2));
@@ -3552,7 +3591,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3552
3591
  if (flags.interactive) {
3553
3592
  bucketOra.stop();
3554
3593
  const reviewedData = await reviewChanges({
3555
- pathPattern: bucketConfig.pathPattern,
3594
+ pathPattern: bucketPath.pathPattern,
3556
3595
  targetLocale,
3557
3596
  currentData: targetData,
3558
3597
  proposedData: finalTargetData,
@@ -3560,7 +3599,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3560
3599
  force: flags.force
3561
3600
  });
3562
3601
  finalTargetData = reviewedData;
3563
- bucketOra.start(`Applying changes to ${bucketConfig} (${targetLocale})`);
3602
+ bucketOra.start(`Applying changes to ${bucketPath} (${targetLocale})`);
3564
3603
  }
3565
3604
  const finalDiffSize = _lodash2.default.chain(finalTargetData).omitBy((value, key) => value === targetData[key]).size().value();
3566
3605
  await bucketLoader.push(targetLocale, finalTargetData);
@@ -3579,7 +3618,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3579
3618
  }
3580
3619
  }
3581
3620
  }
3582
- lockfileHelper.registerSourceData(bucketConfig.pathPattern, sourceData);
3621
+ lockfileHelper.registerSourceData(bucketPath.pathPattern, sourceData);
3583
3622
  }
3584
3623
  } catch (_error) {
3585
3624
  const error = new Error(`Failed to process bucket ${bucket.type}: ${_error.message}`);
@@ -3695,12 +3734,12 @@ function validateParams(i18nConfig, flags) {
3695
3734
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
3696
3735
  docUrl: "bucketNotFound"
3697
3736
  });
3698
- } else if (_optionalChain([flags, 'access', _145 => _145.locale, 'optionalAccess', _146 => _146.some, 'call', _147 => _147((locale) => !i18nConfig.locale.targets.includes(locale))])) {
3737
+ } else if (_optionalChain([flags, 'access', _146 => _146.locale, 'optionalAccess', _147 => _147.some, 'call', _148 => _148((locale) => !i18nConfig.locale.targets.includes(locale))])) {
3699
3738
  throw new CLIError({
3700
3739
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
3701
3740
  docUrl: "localeTargetNotFound"
3702
3741
  });
3703
- } else if (_optionalChain([flags, 'access', _148 => _148.bucket, 'optionalAccess', _149 => _149.some, 'call', _150 => _150((bucket) => !i18nConfig.buckets[bucket])])) {
3742
+ } else if (_optionalChain([flags, 'access', _149 => _149.bucket, 'optionalAccess', _150 => _150.some, 'call', _151 => _151((bucket) => !i18nConfig.buckets[bucket])])) {
3704
3743
  throw new CLIError({
3705
3744
  message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
3706
3745
  docUrl: "bucketNotFound"
@@ -3818,7 +3857,7 @@ var lockfile_default = new (0, _interactivecommander.Command)().command("lockfil
3818
3857
  const i18nConfig = getConfig();
3819
3858
  const buckets = getBuckets(i18nConfig);
3820
3859
  for (const bucket of buckets) {
3821
- for (const bucketConfig of bucket.config) {
3860
+ for (const bucketConfig of bucket.paths) {
3822
3861
  const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3823
3862
  const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3824
3863
  isCacheRestore: false,
@@ -3841,7 +3880,10 @@ var flagsSchema = _zod2.default.object({
3841
3880
 
3842
3881
 
3843
3882
 
3844
- var cleanup_default = new (0, _interactivecommander.Command)().command("cleanup").description("Remove keys from target files that do not exist in the source file").helpOption("-h, --help", "Show help").option("--locale <locale>", "Specific locale to cleanup").option("--bucket <bucket>", "Specific bucket to cleanup").option("--dry-run", "Show what would be removed without making changes").option("--verbose", "Show detailed output including:\n - List of keys that would be removed.\n - Processing steps.").action(async function(options) {
3883
+ var cleanup_default = new (0, _interactivecommander.Command)().command("cleanup").description("Remove keys from target files that do not exist in the source file").helpOption("-h, --help", "Show help").option("--locale <locale>", "Specific locale to cleanup").option("--bucket <bucket>", "Specific bucket to cleanup").option("--dry-run", "Show what would be removed without making changes").option(
3884
+ "--verbose",
3885
+ "Show detailed output including:\n - List of keys that would be removed.\n - Processing steps."
3886
+ ).action(async function(options) {
3845
3887
  const ora = _ora2.default.call(void 0, );
3846
3888
  const results = [];
3847
3889
  try {
@@ -3857,7 +3899,7 @@ var cleanup_default = new (0, _interactivecommander.Command)().command("cleanup"
3857
3899
  for (const bucket of buckets) {
3858
3900
  console.log();
3859
3901
  ora.info(`Processing bucket: ${bucket.type}`);
3860
- for (const bucketConfig of bucket.config) {
3902
+ for (const bucketConfig of bucket.paths) {
3861
3903
  const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3862
3904
  const bucketOra = _ora2.default.call(void 0, { indent: 2 }).info(`Processing path: ${bucketConfig.pathPattern}`);
3863
3905
  const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
@@ -3936,7 +3978,7 @@ var _stdiojs = require('@modelcontextprotocol/sdk/server/stdio.js');
3936
3978
  var _mcpjs = require('@modelcontextprotocol/sdk/server/mcp.js');
3937
3979
 
3938
3980
 
3939
- 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 (_21, program) => {
3981
+ 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 (_22, program) => {
3940
3982
  const apiKey = program.args[0];
3941
3983
  const settings = getSettings(apiKey);
3942
3984
  if (!settings.auth.apiKey) {
@@ -4059,7 +4101,7 @@ var InBranchFlow = class extends IntegrationFlow {
4059
4101
  _child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
4060
4102
  _child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
4061
4103
  _child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
4062
- _optionalChain([this, 'access', _151 => _151.platformKit, 'optionalAccess', _152 => _152.gitConfig, 'call', _153 => _153()]);
4104
+ _optionalChain([this, 'access', _152 => _152.platformKit, 'optionalAccess', _153 => _153.gitConfig, 'call', _154 => _154()]);
4063
4105
  _child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
4064
4106
  _child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
4065
4107
  if (!processOwnCommits) {
@@ -4084,7 +4126,7 @@ var InBranchFlow = class extends IntegrationFlow {
4084
4126
  // ../../action/src/flows/pull-request.ts
4085
4127
  var PullRequestFlow = class extends InBranchFlow {
4086
4128
  async preRun() {
4087
- const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _154 => _154()]);
4129
+ const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _155 => _155()]);
4088
4130
  if (!canContinue) {
4089
4131
  return false;
4090
4132
  }
@@ -4131,35 +4173,21 @@ var PullRequestFlow = class extends InBranchFlow {
4131
4173
  this.ora.start(
4132
4174
  `Checking for existing PR with head ${i18nBranchName} and base ${this.platformKit.platformConfig.baseBranchName}`
4133
4175
  );
4134
- const existingPrNumber = await this.platformKit.getOpenPullRequestNumber({
4176
+ let prNumber = await this.platformKit.getOpenPullRequestNumber({
4135
4177
  branch: i18nBranchName
4136
4178
  });
4137
- this.ora.succeed(existingPrNumber ? "PR found" : "No PR found");
4138
- if (existingPrNumber) {
4139
- this.ora.start(`Closing existing PR ${existingPrNumber}`);
4140
- await this.platformKit.closePullRequest({
4141
- pullRequestNumber: existingPrNumber
4142
- });
4143
- this.ora.succeed(`Closed existing PR ${existingPrNumber}`);
4144
- }
4145
- this.ora.start(`Creating new PR`);
4146
- const newPrNumber = await this.platformKit.createPullRequest({
4147
- head: i18nBranchName,
4148
- title: this.platformKit.config.pullRequestTitle,
4149
- body: this.getPrBodyContent()
4150
- });
4151
- this.ora.succeed(`Created new PR ${newPrNumber}`);
4152
- if (existingPrNumber) {
4153
- this.ora.start(`Posting comment about outdated PR ${existingPrNumber}`);
4154
- await this.platformKit.commentOnPullRequest({
4155
- pullRequestNumber: existingPrNumber,
4156
- body: `This PR is now outdated. A new version has been created at ${this.platformKit.buildPullRequestUrl(
4157
- newPrNumber
4158
- )}`
4179
+ if (prNumber) {
4180
+ this.ora.succeed(`Existing PR found: #${prNumber}`);
4181
+ } else {
4182
+ this.ora.start(`Creating new PR`);
4183
+ prNumber = await this.platformKit.createPullRequest({
4184
+ head: i18nBranchName,
4185
+ title: this.platformKit.config.pullRequestTitle,
4186
+ body: this.getPrBodyContent()
4159
4187
  });
4160
- this.ora.succeed(`Posted comment about outdated PR ${existingPrNumber}`);
4188
+ this.ora.succeed(`Created new PR: #${prNumber}`);
4161
4189
  }
4162
- return newPrNumber;
4190
+ return prNumber;
4163
4191
  }
4164
4192
  checkoutI18nBranch(i18nBranchName) {
4165
4193
  _child_process.execSync.call(void 0, `git fetch origin ${i18nBranchName}`, { stdio: "inherit" });
@@ -4310,10 +4338,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
4310
4338
  repo_slug: this.platformConfig.repositoryName,
4311
4339
  state: "OPEN"
4312
4340
  }).then(({ data: { values } }) => {
4313
- return _optionalChain([values, 'optionalAccess', _155 => _155.find, 'call', _156 => _156(
4314
- ({ source, destination }) => _optionalChain([source, 'optionalAccess', _157 => _157.branch, 'optionalAccess', _158 => _158.name]) === branch && _optionalChain([destination, 'optionalAccess', _159 => _159.branch, 'optionalAccess', _160 => _160.name]) === this.platformConfig.baseBranchName
4341
+ return _optionalChain([values, 'optionalAccess', _156 => _156.find, 'call', _157 => _157(
4342
+ ({ source, destination }) => _optionalChain([source, 'optionalAccess', _158 => _158.branch, 'optionalAccess', _159 => _159.name]) === branch && _optionalChain([destination, 'optionalAccess', _160 => _160.branch, 'optionalAccess', _161 => _161.name]) === this.platformConfig.baseBranchName
4315
4343
  )]);
4316
- }).then((pr) => _optionalChain([pr, 'optionalAccess', _161 => _161.id]));
4344
+ }).then((pr) => _optionalChain([pr, 'optionalAccess', _162 => _162.id]));
4317
4345
  }
4318
4346
  async closePullRequest({ pullRequestNumber }) {
4319
4347
  await this.bb.repositories.declinePullRequest({
@@ -4400,7 +4428,7 @@ var GitHubPlatformKit = class extends PlatformKit {
4400
4428
  repo: this.platformConfig.repositoryName,
4401
4429
  base: this.platformConfig.baseBranchName,
4402
4430
  state: "open"
4403
- }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _162 => _162.number]));
4431
+ }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _163 => _163.number]));
4404
4432
  }
4405
4433
  async closePullRequest({ pullRequestNumber }) {
4406
4434
  await this.octokit.rest.pulls.update({
@@ -4516,7 +4544,7 @@ var GitlabPlatformKit = class extends PlatformKit {
4516
4544
  sourceBranch: branch,
4517
4545
  state: "opened"
4518
4546
  });
4519
- return _optionalChain([mergeRequests, 'access', _163 => _163[0], 'optionalAccess', _164 => _164.iid]);
4547
+ return _optionalChain([mergeRequests, 'access', _164 => _164[0], 'optionalAccess', _165 => _165.iid]);
4520
4548
  }
4521
4549
  async closePullRequest({ pullRequestNumber }) {
4522
4550
  await this.gitlab.MergeRequests.edit(this.platformConfig.gitlabProjectId, pullRequestNumber, {
@@ -4570,7 +4598,7 @@ async function main() {
4570
4598
  const { isPullRequestMode } = platformKit.config;
4571
4599
  ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
4572
4600
  const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
4573
- const canRun = await _optionalChain([flow, 'access', _165 => _165.preRun, 'optionalCall', _166 => _166()]);
4601
+ const canRun = await _optionalChain([flow, 'access', _166 => _166.preRun, 'optionalCall', _167 => _167()]);
4574
4602
  if (canRun === false) {
4575
4603
  return;
4576
4604
  }
@@ -4578,7 +4606,7 @@ async function main() {
4578
4606
  if (!hasChanges) {
4579
4607
  return;
4580
4608
  }
4581
- await _optionalChain([flow, 'access', _167 => _167.postRun, 'optionalCall', _168 => _168()]);
4609
+ await _optionalChain([flow, 'access', _168 => _168.postRun, 'optionalCall', _169 => _169()]);
4582
4610
  }
4583
4611
 
4584
4612
  // src/cli/cmd/ci.ts
@@ -4600,7 +4628,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
4600
4628
  }
4601
4629
  const env = {
4602
4630
  LINGODOTDEV_API_KEY: settings.auth.apiKey,
4603
- LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _169 => _169.pullRequest, 'optionalAccess', _170 => _170.toString, 'call', _171 => _171()]) || "false",
4631
+ LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _170 => _170.pullRequest, 'optionalAccess', _171 => _171.toString, 'call', _172 => _172()]) || "false",
4604
4632
  ...options.commitMessage && { LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage },
4605
4633
  ...options.pullRequestTitle && { LINGODOTDEV_PULL_REQUEST_TITLE: options.pullRequestTitle },
4606
4634
  ...options.workingDirectory && { LINGODOTDEV_WORKING_DIRECTORY: options.workingDirectory },
@@ -4613,7 +4641,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
4613
4641
  // package.json
4614
4642
  var package_default = {
4615
4643
  name: "lingo.dev",
4616
- version: "0.79.1",
4644
+ version: "0.79.3",
4617
4645
  description: "Lingo.dev CLI",
4618
4646
  private: false,
4619
4647
  publishConfig: {