lingo.dev 0.77.6 → 0.78.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
@@ -266,7 +266,6 @@ function _getConfigFilePath() {
266
266
 
267
267
 
268
268
 
269
- var _child_process = require('child_process');
270
269
 
271
270
  var _prompts = require('@inquirer/prompts');
272
271
 
@@ -602,9 +601,10 @@ function makeGitlabInitializer(spinner) {
602
601
  }
603
602
 
604
603
  // src/cli/cmd/init.ts
604
+
605
605
  var openUrl = (path13) => {
606
606
  const settings = getSettings(void 0);
607
- _child_process.spawn.call(void 0, "open", [`${settings.auth.webUrl}${path13}`]);
607
+ _open2.default.call(void 0, `${settings.auth.webUrl}${path13}`, { wait: false });
608
608
  };
609
609
  var throwHelpError = (option, value) => {
610
610
  if (value === "help") {
@@ -1665,12 +1665,16 @@ function createXcodeStringsdictLoader() {
1665
1665
 
1666
1666
  // src/cli/loaders/xcode-xcstrings.ts
1667
1667
 
1668
- function createXcodeXcstringsLoader() {
1668
+ function createXcodeXcstringsLoader(defaultLocale) {
1669
1669
  return createLoader({
1670
- async pull(locale, input2) {
1670
+ async pull(locale, input2, initCtx) {
1671
1671
  const resultData = {};
1672
+ const isSourceLanguage = locale === defaultLocale;
1672
1673
  for (const [translationKey, _translationEntity] of Object.entries(input2.strings)) {
1673
1674
  const rootTranslationEntity = _translationEntity;
1675
+ if (rootTranslationEntity.shouldTranslate === false) {
1676
+ continue;
1677
+ }
1674
1678
  const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _65 => _65.localizations, 'optionalAccess', _66 => _66[locale]]);
1675
1679
  if (langTranslationEntity) {
1676
1680
  if ("stringUnit" in langTranslationEntity) {
@@ -1686,6 +1690,11 @@ function createXcodeXcstringsLoader() {
1686
1690
  }
1687
1691
  }
1688
1692
  }
1693
+ } else if (isSourceLanguage) {
1694
+ const hasOtherLocalizations = _optionalChain([rootTranslationEntity, 'optionalAccess', _70 => _70.localizations]) && Object.keys(rootTranslationEntity.localizations).length > 0;
1695
+ if (hasOtherLocalizations) {
1696
+ resultData[translationKey] = translationKey;
1697
+ }
1689
1698
  }
1690
1699
  }
1691
1700
  return resultData;
@@ -1693,7 +1702,12 @@ function createXcodeXcstringsLoader() {
1693
1702
  async push(locale, payload, originalInput) {
1694
1703
  const langDataToMerge = {};
1695
1704
  langDataToMerge.strings = {};
1705
+ const input2 = _lodash2.default.cloneDeep(originalInput) || { sourceLanguage: locale, strings: {} };
1696
1706
  for (const [key, value] of Object.entries(payload)) {
1707
+ if (value === null || value === void 0) {
1708
+ continue;
1709
+ }
1710
+ const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
1697
1711
  if (typeof value === "string") {
1698
1712
  langDataToMerge.strings[key] = {
1699
1713
  extractionState: "manual",
@@ -1706,6 +1720,9 @@ function createXcodeXcstringsLoader() {
1706
1720
  }
1707
1721
  }
1708
1722
  };
1723
+ if (hasDoNotTranslateFlag) {
1724
+ langDataToMerge.strings[key].shouldTranslate = false;
1725
+ }
1709
1726
  } else {
1710
1727
  const updatedVariations = {};
1711
1728
  for (const form in value) {
@@ -1726,6 +1743,9 @@ function createXcodeXcstringsLoader() {
1726
1743
  }
1727
1744
  }
1728
1745
  };
1746
+ if (hasDoNotTranslateFlag) {
1747
+ langDataToMerge.strings[key].shouldTranslate = false;
1748
+ }
1729
1749
  }
1730
1750
  }
1731
1751
  const result = _lodash2.default.merge({}, originalInput, langDataToMerge);
@@ -1830,7 +1850,7 @@ function createPoDataLoader(params) {
1830
1850
  Object.entries(entries).forEach(([msgid, entry]) => {
1831
1851
  if (msgid && entry.msgid) {
1832
1852
  const context = entry.msgctxt || "";
1833
- const fullEntry = _optionalChain([parsedPo, 'access', _70 => _70.translations, 'access', _71 => _71[context], 'optionalAccess', _72 => _72[msgid]]);
1853
+ const fullEntry = _optionalChain([parsedPo, 'access', _71 => _71.translations, 'access', _72 => _72[context], 'optionalAccess', _73 => _73[msgid]]);
1834
1854
  if (fullEntry) {
1835
1855
  result[msgid] = fullEntry;
1836
1856
  }
@@ -1840,7 +1860,7 @@ function createPoDataLoader(params) {
1840
1860
  return result;
1841
1861
  },
1842
1862
  async push(locale, data, originalInput) {
1843
- const sections = _optionalChain([originalInput, 'optionalAccess', _73 => _73.split, 'call', _74 => _74("\n\n"), 'access', _75 => _75.filter, 'call', _76 => _76(Boolean)]) || [];
1863
+ const sections = _optionalChain([originalInput, 'optionalAccess', _74 => _74.split, 'call', _75 => _75("\n\n"), 'access', _76 => _76.filter, 'call', _77 => _77(Boolean)]) || [];
1844
1864
  const result = sections.map((section) => {
1845
1865
  const sectionPo = _gettextparser2.default.po.parse(section);
1846
1866
  const contextKey = _lodash2.default.keys(sectionPo.translations)[0];
@@ -1882,7 +1902,7 @@ function createPoContentLoader() {
1882
1902
  entry.msgid,
1883
1903
  {
1884
1904
  ...entry,
1885
- msgstr: [_optionalChain([data, 'access', _77 => _77[entry.msgid], 'optionalAccess', _78 => _78.singular]), _optionalChain([data, 'access', _79 => _79[entry.msgid], 'optionalAccess', _80 => _80.plural]) || null].filter(Boolean)
1905
+ 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)
1886
1906
  }
1887
1907
  ]).fromPairs().value();
1888
1908
  return result;
@@ -2128,7 +2148,7 @@ function createDatoClient(params) {
2128
2148
  only_valid: "true",
2129
2149
  ids: !records.length ? void 0 : records.join(",")
2130
2150
  }
2131
- }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _81 => _81.response, 'optionalAccess', _82 => _82.body, 'optionalAccess', _83 => _83.data, 'optionalAccess', _84 => _84[0]]) || error));
2151
+ }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _82 => _82.response, 'optionalAccess', _83 => _83.body, 'optionalAccess', _84 => _84.data, 'optionalAccess', _85 => _85[0]]) || error));
2132
2152
  },
2133
2153
  findRecordsForModel: async (modelId, records) => {
2134
2154
  try {
@@ -2138,9 +2158,9 @@ function createDatoClient(params) {
2138
2158
  filter: {
2139
2159
  type: modelId,
2140
2160
  only_valid: "true",
2141
- ids: !_optionalChain([records, 'optionalAccess', _85 => _85.length]) ? void 0 : records.join(",")
2161
+ ids: !_optionalChain([records, 'optionalAccess', _86 => _86.length]) ? void 0 : records.join(",")
2142
2162
  }
2143
- }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _86 => _86.response, 'optionalAccess', _87 => _87.body, 'optionalAccess', _88 => _88.data, 'optionalAccess', _89 => _89[0]]) || error));
2163
+ }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _87 => _87.response, 'optionalAccess', _88 => _88.body, 'optionalAccess', _89 => _89.data, 'optionalAccess', _90 => _90[0]]) || error));
2144
2164
  return result;
2145
2165
  } catch (_error) {
2146
2166
  throw new Error(
@@ -2154,9 +2174,9 @@ function createDatoClient(params) {
2154
2174
  },
2155
2175
  updateRecord: async (id, payload) => {
2156
2176
  try {
2157
- await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _90 => _90.response, 'optionalAccess', _91 => _91.body, 'optionalAccess', _92 => _92.data, 'optionalAccess', _93 => _93[0]]) || error));
2177
+ 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));
2158
2178
  } catch (_error) {
2159
- if (_optionalChain([_error, 'optionalAccess', _94 => _94.attributes, 'optionalAccess', _95 => _95.details, 'optionalAccess', _96 => _96.message])) {
2179
+ if (_optionalChain([_error, 'optionalAccess', _95 => _95.attributes, 'optionalAccess', _96 => _96.details, 'optionalAccess', _97 => _97.message])) {
2160
2180
  throw new Error(
2161
2181
  [
2162
2182
  `${_error.attributes.details.message}`,
@@ -2177,9 +2197,9 @@ function createDatoClient(params) {
2177
2197
  },
2178
2198
  enableFieldLocalization: async (args) => {
2179
2199
  try {
2180
- await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _97 => _97.response, 'optionalAccess', _98 => _98.body, 'optionalAccess', _99 => _99.data, 'optionalAccess', _100 => _100[0]]) || error));
2200
+ 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));
2181
2201
  } catch (_error) {
2182
- if (_optionalChain([_error, 'optionalAccess', _101 => _101.attributes, 'optionalAccess', _102 => _102.code]) === "NOT_FOUND") {
2202
+ if (_optionalChain([_error, 'optionalAccess', _102 => _102.attributes, 'optionalAccess', _103 => _103.code]) === "NOT_FOUND") {
2183
2203
  throw new Error(
2184
2204
  [
2185
2205
  `Field "${args.fieldId}" not found in model "${args.modelId}".`,
@@ -2187,7 +2207,7 @@ function createDatoClient(params) {
2187
2207
  ].join("\n\n")
2188
2208
  );
2189
2209
  }
2190
- if (_optionalChain([_error, 'optionalAccess', _103 => _103.attributes, 'optionalAccess', _104 => _104.details, 'optionalAccess', _105 => _105.message])) {
2210
+ if (_optionalChain([_error, 'optionalAccess', _104 => _104.attributes, 'optionalAccess', _105 => _105.details, 'optionalAccess', _106 => _106.message])) {
2191
2211
  throw new Error(
2192
2212
  [`${_error.attributes.details.message}`, `Error: ${JSON.stringify(_error, null, 2)}`].join("\n\n")
2193
2213
  );
@@ -2253,7 +2273,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
2253
2273
  }
2254
2274
  }
2255
2275
  const records = await dato.findRecordsForModel(modelId);
2256
- const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _106 => _106.models, 'access', _107 => _107[modelId], 'optionalAccess', _108 => _108.records]) || [], project);
2276
+ const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _107 => _107.models, 'access', _108 => _108[modelId], 'optionalAccess', _109 => _109.records]) || [], project);
2257
2277
  const selectedRecords = await promptRecordSelection(modelName, recordChoices);
2258
2278
  result.models[modelId].records = records.filter((record) => selectedRecords.includes(record.id));
2259
2279
  updatedConfig.models[modelId].records = selectedRecords;
@@ -2265,14 +2285,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
2265
2285
  },
2266
2286
  async pull(locale, input2, initCtx) {
2267
2287
  const result = {};
2268
- for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _109 => _109.models]) || {})) {
2269
- let records = _optionalChain([initCtx, 'optionalAccess', _110 => _110.models, 'access', _111 => _111[modelId], 'access', _112 => _112.records]) || [];
2288
+ for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _110 => _110.models]) || {})) {
2289
+ let records = _optionalChain([initCtx, 'optionalAccess', _111 => _111.models, 'access', _112 => _112[modelId], 'access', _113 => _113.records]) || [];
2270
2290
  const recordIds = records.map((record) => record.id);
2271
2291
  records = await dato.findRecords(recordIds);
2272
2292
  console.log(`Fetched ${records.length} records for model ${modelId}`);
2273
2293
  if (records.length > 0) {
2274
2294
  result[modelId] = {
2275
- fields: _optionalChain([initCtx, 'optionalAccess', _113 => _113.models, 'optionalAccess', _114 => _114[modelId], 'optionalAccess', _115 => _115.fields]) || [],
2295
+ fields: _optionalChain([initCtx, 'optionalAccess', _114 => _114.models, 'optionalAccess', _115 => _115[modelId], 'optionalAccess', _116 => _116.fields]) || [],
2276
2296
  records
2277
2297
  };
2278
2298
  }
@@ -2331,7 +2351,7 @@ function createRecordChoices(records, selectedIds = [], project) {
2331
2351
  return records.map((record) => ({
2332
2352
  name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
2333
2353
  value: record.id,
2334
- checked: _optionalChain([selectedIds, 'optionalAccess', _116 => _116.includes, 'call', _117 => _117(record.id)])
2354
+ checked: _optionalChain([selectedIds, 'optionalAccess', _117 => _117.includes, 'call', _118 => _118(record.id)])
2335
2355
  }));
2336
2356
  }
2337
2357
  async function promptRecordSelection(modelName, choices) {
@@ -2598,7 +2618,7 @@ var _nodewebvtt = require('node-webvtt'); var _nodewebvtt2 = _interopRequireDefa
2598
2618
  function createVttLoader() {
2599
2619
  return createLoader({
2600
2620
  async pull(locale, input2) {
2601
- const vtt = _optionalChain([_nodewebvtt2.default, 'access', _118 => _118.parse, 'call', _119 => _119(input2), 'optionalAccess', _120 => _120.cues]);
2621
+ const vtt = _optionalChain([_nodewebvtt2.default, 'access', _119 => _119.parse, 'call', _120 => _120(input2), 'optionalAccess', _121 => _121.cues]);
2602
2622
  if (Object.keys(vtt).length === 0) {
2603
2623
  return {};
2604
2624
  } else {
@@ -2650,7 +2670,7 @@ function variableExtractLoader(params) {
2650
2670
  for (let i = 0; i < matches.length; i++) {
2651
2671
  const match = matches[i];
2652
2672
  const currentValue = result[key].value;
2653
- const newValue = _optionalChain([currentValue, 'optionalAccess', _121 => _121.replace, 'call', _122 => _122(match, `{variable:${i}}`)]);
2673
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _122 => _122.replace, 'call', _123 => _123(match, `{variable:${i}}`)]);
2654
2674
  result[key].value = newValue;
2655
2675
  result[key].variables[i] = match;
2656
2676
  }
@@ -2664,7 +2684,7 @@ function variableExtractLoader(params) {
2664
2684
  for (let i = 0; i < valueObj.variables.length; i++) {
2665
2685
  const variable = valueObj.variables[i];
2666
2686
  const currentValue = result[key];
2667
- const newValue = _optionalChain([currentValue, 'optionalAccess', _123 => _123.replace, 'call', _124 => _124(`{variable:${i}}`, variable)]);
2687
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _124 => _124.replace, 'call', _125 => _125(`{variable:${i}}`, variable)]);
2668
2688
  result[key] = newValue;
2669
2689
  }
2670
2690
  }
@@ -2840,7 +2860,7 @@ function escapePhpString(str) {
2840
2860
  }
2841
2861
 
2842
2862
  // src/cli/loaders/index.ts
2843
- function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = false } = {}) {
2863
+ function createBucketLoader(bucketType, bucketPathPattern, options) {
2844
2864
  switch (bucketType) {
2845
2865
  default:
2846
2866
  throw new Error(`Unsupported bucket type: ${bucketType}`);
@@ -2850,7 +2870,7 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2850
2870
  createAndroidLoader(),
2851
2871
  createFlatLoader(),
2852
2872
  createSyncLoader(),
2853
- createUnlocalizableLoader(isCacheRestore)
2873
+ createUnlocalizableLoader(options.isCacheRestore)
2854
2874
  );
2855
2875
  case "csv":
2856
2876
  return composeLoaders(
@@ -2858,7 +2878,7 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2858
2878
  createCsvLoader(),
2859
2879
  createFlatLoader(),
2860
2880
  createSyncLoader(),
2861
- createUnlocalizableLoader(isCacheRestore)
2881
+ createUnlocalizableLoader(options.isCacheRestore)
2862
2882
  );
2863
2883
  case "html":
2864
2884
  return composeLoaders(
@@ -2866,7 +2886,7 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2866
2886
  createPrettierLoader({ parser: "html", alwaysFormat: true }),
2867
2887
  createHtmlLoader(),
2868
2888
  createSyncLoader(),
2869
- createUnlocalizableLoader(isCacheRestore)
2889
+ createUnlocalizableLoader(options.isCacheRestore)
2870
2890
  );
2871
2891
  case "json":
2872
2892
  return composeLoaders(
@@ -2875,7 +2895,7 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2875
2895
  createJsonLoader(),
2876
2896
  createFlatLoader(),
2877
2897
  createSyncLoader(),
2878
- createUnlocalizableLoader(isCacheRestore)
2898
+ createUnlocalizableLoader(options.isCacheRestore)
2879
2899
  );
2880
2900
  case "markdown":
2881
2901
  return composeLoaders(
@@ -2883,7 +2903,7 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2883
2903
  createPrettierLoader({ parser: "markdown" }),
2884
2904
  createMarkdownLoader(),
2885
2905
  createSyncLoader(),
2886
- createUnlocalizableLoader(isCacheRestore)
2906
+ createUnlocalizableLoader(options.isCacheRestore)
2887
2907
  );
2888
2908
  case "po":
2889
2909
  return composeLoaders(
@@ -2891,7 +2911,7 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2891
2911
  createPoLoader(),
2892
2912
  createFlatLoader(),
2893
2913
  createSyncLoader(),
2894
- createUnlocalizableLoader(isCacheRestore),
2914
+ createUnlocalizableLoader(options.isCacheRestore),
2895
2915
  createVariableLoader({ type: "python" })
2896
2916
  );
2897
2917
  case "properties":
@@ -2899,14 +2919,14 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2899
2919
  createTextFileLoader(bucketPathPattern),
2900
2920
  createPropertiesLoader(),
2901
2921
  createSyncLoader(),
2902
- createUnlocalizableLoader(isCacheRestore)
2922
+ createUnlocalizableLoader(options.isCacheRestore)
2903
2923
  );
2904
2924
  case "xcode-strings":
2905
2925
  return composeLoaders(
2906
2926
  createTextFileLoader(bucketPathPattern),
2907
2927
  createXcodeStringsLoader(),
2908
2928
  createSyncLoader(),
2909
- createUnlocalizableLoader(isCacheRestore)
2929
+ createUnlocalizableLoader(options.isCacheRestore)
2910
2930
  );
2911
2931
  case "xcode-stringsdict":
2912
2932
  return composeLoaders(
@@ -2914,17 +2934,17 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2914
2934
  createXcodeStringsdictLoader(),
2915
2935
  createFlatLoader(),
2916
2936
  createSyncLoader(),
2917
- createUnlocalizableLoader(isCacheRestore)
2937
+ createUnlocalizableLoader(options.isCacheRestore)
2918
2938
  );
2919
2939
  case "xcode-xcstrings":
2920
2940
  return composeLoaders(
2921
2941
  createTextFileLoader(bucketPathPattern),
2922
2942
  createPlutilJsonTextLoader(),
2923
2943
  createJsonLoader(),
2924
- createXcodeXcstringsLoader(),
2944
+ createXcodeXcstringsLoader(options.defaultLocale),
2925
2945
  createFlatLoader(),
2926
2946
  createSyncLoader(),
2927
- createUnlocalizableLoader(isCacheRestore),
2947
+ createUnlocalizableLoader(options.isCacheRestore),
2928
2948
  createVariableLoader({ type: "ieee" })
2929
2949
  );
2930
2950
  case "yaml":
@@ -2934,7 +2954,7 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2934
2954
  createYamlLoader(),
2935
2955
  createFlatLoader(),
2936
2956
  createSyncLoader(),
2937
- createUnlocalizableLoader(isCacheRestore)
2957
+ createUnlocalizableLoader(options.isCacheRestore)
2938
2958
  );
2939
2959
  case "yaml-root-key":
2940
2960
  return composeLoaders(
@@ -2944,7 +2964,7 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2944
2964
  createRootKeyLoader(true),
2945
2965
  createFlatLoader(),
2946
2966
  createSyncLoader(),
2947
- createUnlocalizableLoader(isCacheRestore)
2967
+ createUnlocalizableLoader(options.isCacheRestore)
2948
2968
  );
2949
2969
  case "flutter":
2950
2970
  return composeLoaders(
@@ -2954,7 +2974,7 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2954
2974
  createFlutterLoader(),
2955
2975
  createFlatLoader(),
2956
2976
  createSyncLoader(),
2957
- createUnlocalizableLoader(isCacheRestore)
2977
+ createUnlocalizableLoader(options.isCacheRestore)
2958
2978
  );
2959
2979
  case "xliff":
2960
2980
  return composeLoaders(
@@ -2962,7 +2982,7 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2962
2982
  createXliffLoader(),
2963
2983
  createFlatLoader(),
2964
2984
  createSyncLoader(),
2965
- createUnlocalizableLoader(isCacheRestore)
2985
+ createUnlocalizableLoader(options.isCacheRestore)
2966
2986
  );
2967
2987
  case "xml":
2968
2988
  return composeLoaders(
@@ -2970,28 +2990,28 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2970
2990
  createXmlLoader(),
2971
2991
  createFlatLoader(),
2972
2992
  createSyncLoader(),
2973
- createUnlocalizableLoader(isCacheRestore)
2993
+ createUnlocalizableLoader(options.isCacheRestore)
2974
2994
  );
2975
2995
  case "srt":
2976
2996
  return composeLoaders(
2977
2997
  createTextFileLoader(bucketPathPattern),
2978
2998
  createSrtLoader(),
2979
2999
  createSyncLoader(),
2980
- createUnlocalizableLoader(isCacheRestore)
3000
+ createUnlocalizableLoader(options.isCacheRestore)
2981
3001
  );
2982
3002
  case "dato":
2983
3003
  return composeLoaders(
2984
3004
  createDatoLoader(bucketPathPattern),
2985
3005
  createSyncLoader(),
2986
3006
  createFlatLoader(),
2987
- createUnlocalizableLoader(isCacheRestore)
3007
+ createUnlocalizableLoader(options.isCacheRestore)
2988
3008
  );
2989
3009
  case "vtt":
2990
3010
  return composeLoaders(
2991
3011
  createTextFileLoader(bucketPathPattern),
2992
3012
  createVttLoader(),
2993
3013
  createSyncLoader(),
2994
- createUnlocalizableLoader(isCacheRestore)
3014
+ createUnlocalizableLoader(options.isCacheRestore)
2995
3015
  );
2996
3016
  case "php":
2997
3017
  return composeLoaders(
@@ -2999,7 +3019,7 @@ function createBucketLoader(bucketType, bucketPathPattern, { isCacheRestore = fa
2999
3019
  createPhpLoader(),
3000
3020
  createSyncLoader(),
3001
3021
  createFlatLoader(),
3002
- createUnlocalizableLoader()
3022
+ createUnlocalizableLoader(options.isCacheRestore)
3003
3023
  );
3004
3024
  }
3005
3025
  }
@@ -3169,15 +3189,15 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3169
3189
  ora.start("Validating localization configuration...");
3170
3190
  validateParams(i18nConfig, flags);
3171
3191
  ora.succeed("Localization configuration is valid");
3172
- ora.start("Connecting to Replexica Localization Engine...");
3192
+ ora.start("Connecting to Lingo.dev Localization Engine...");
3173
3193
  const auth = await validateAuth(settings);
3174
3194
  ora.succeed(`Authenticated as ${auth.email}`);
3175
3195
  let buckets = getBuckets(i18nConfig);
3176
- if (_optionalChain([flags, 'access', _125 => _125.bucket, 'optionalAccess', _126 => _126.length])) {
3196
+ if (_optionalChain([flags, 'access', _126 => _126.bucket, 'optionalAccess', _127 => _127.length])) {
3177
3197
  buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
3178
3198
  }
3179
3199
  ora.succeed("Buckets retrieved");
3180
- const targetLocales = _optionalChain([flags, 'access', _127 => _127.locale, 'optionalAccess', _128 => _128.length]) ? flags.locale : i18nConfig.locale.targets;
3200
+ const targetLocales = _optionalChain([flags, 'access', _128 => _128.locale, 'optionalAccess', _129 => _129.length]) ? flags.locale : i18nConfig.locale.targets;
3181
3201
  const lockfileHelper = createLockfileHelper();
3182
3202
  ora.start("Ensuring i18n.lock exists...");
3183
3203
  if (!lockfileHelper.isLockfileExists()) {
@@ -3185,7 +3205,10 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3185
3205
  for (const bucket of buckets) {
3186
3206
  for (const bucketConfig of bucket.config) {
3187
3207
  const sourceLocale = __spec.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3188
- const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern);
3208
+ const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3209
+ isCacheRestore: false,
3210
+ defaultLocale: sourceLocale
3211
+ });
3189
3212
  bucketLoader.setDefaultLocale(sourceLocale);
3190
3213
  await bucketLoader.init();
3191
3214
  const sourceData = await bucketLoader.pull(i18nConfig.locale.source);
@@ -3207,7 +3230,10 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3207
3230
  const bucketOra = _ora2.default.call(void 0, { indent: 4 });
3208
3231
  bucketOra.info(`Processing path: ${bucketConfig.pathPattern}`);
3209
3232
  const sourceLocale = __spec.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3210
- const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, { isCacheRestore: true });
3233
+ const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3234
+ isCacheRestore: true,
3235
+ defaultLocale: sourceLocale
3236
+ });
3211
3237
  bucketLoader.setDefaultLocale(sourceLocale);
3212
3238
  await bucketLoader.init();
3213
3239
  const sourceData = await bucketLoader.pull(sourceLocale);
@@ -3242,7 +3268,10 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3242
3268
  for (const bucket of buckets) {
3243
3269
  for (const bucketConfig of bucket.config) {
3244
3270
  const sourceLocale = __spec.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3245
- const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern);
3271
+ const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3272
+ isCacheRestore: false,
3273
+ defaultLocale: sourceLocale
3274
+ });
3246
3275
  bucketLoader.setDefaultLocale(sourceLocale);
3247
3276
  await bucketLoader.init();
3248
3277
  const sourceData = await bucketLoader.pull(i18nConfig.locale.source);
@@ -3268,7 +3297,10 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3268
3297
  for (const bucketConfig of bucket.config) {
3269
3298
  const bucketOra = _ora2.default.call(void 0, { indent: 2 }).info(`Processing path: ${bucketConfig.pathPattern}`);
3270
3299
  const sourceLocale = __spec.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3271
- const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern);
3300
+ const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3301
+ isCacheRestore: false,
3302
+ defaultLocale: sourceLocale
3303
+ });
3272
3304
  bucketLoader.setDefaultLocale(sourceLocale);
3273
3305
  await bucketLoader.init();
3274
3306
  let sourceData = await bucketLoader.pull(sourceLocale);
@@ -3467,12 +3499,12 @@ function validateParams(i18nConfig, flags) {
3467
3499
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
3468
3500
  docUrl: "bucketNotFound"
3469
3501
  });
3470
- } else if (_optionalChain([flags, 'access', _129 => _129.locale, 'optionalAccess', _130 => _130.some, 'call', _131 => _131((locale) => !i18nConfig.locale.targets.includes(locale))])) {
3502
+ } else if (_optionalChain([flags, 'access', _130 => _130.locale, 'optionalAccess', _131 => _131.some, 'call', _132 => _132((locale) => !i18nConfig.locale.targets.includes(locale))])) {
3471
3503
  throw new CLIError({
3472
3504
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
3473
3505
  docUrl: "localeTargetNotFound"
3474
3506
  });
3475
- } else if (_optionalChain([flags, 'access', _132 => _132.bucket, 'optionalAccess', _133 => _133.some, 'call', _134 => _134((bucket) => !i18nConfig.buckets[bucket])])) {
3507
+ } else if (_optionalChain([flags, 'access', _133 => _133.bucket, 'optionalAccess', _134 => _134.some, 'call', _135 => _135((bucket) => !i18nConfig.buckets[bucket])])) {
3476
3508
  throw new CLIError({
3477
3509
  message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
3478
3510
  docUrl: "bucketNotFound"
@@ -3592,7 +3624,7 @@ var lockfile_default = new (0, _interactivecommander.Command)().command("lockfil
3592
3624
  for (const bucket of buckets) {
3593
3625
  for (const bucketConfig of bucket.config) {
3594
3626
  const sourceLocale = __spec.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3595
- const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern);
3627
+ const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, { isCacheRestore: false, defaultLocale: sourceLocale });
3596
3628
  bucketLoader.setDefaultLocale(sourceLocale);
3597
3629
  const sourceData = await bucketLoader.pull(sourceLocale);
3598
3630
  lockfileHelper.registerSourceData(bucketConfig.pathPattern, sourceData);
@@ -3629,7 +3661,7 @@ var cleanup_default = new (0, _interactivecommander.Command)().command("cleanup"
3629
3661
  for (const bucketConfig of bucket.config) {
3630
3662
  const sourceLocale = __spec.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3631
3663
  const bucketOra = _ora2.default.call(void 0, { indent: 2 }).info(`Processing path: ${bucketConfig.pathPattern}`);
3632
- const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern);
3664
+ const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, { isCacheRestore: false, defaultLocale: sourceLocale });
3633
3665
  bucketLoader.setDefaultLocale(sourceLocale);
3634
3666
  const sourceData = await bucketLoader.pull(sourceLocale);
3635
3667
  const sourceKeys = Object.keys(sourceData);
@@ -3752,7 +3784,7 @@ var mcp_default = new (0, _interactivecommander.Command)().command("mcp").descri
3752
3784
  // package.json
3753
3785
  var package_default = {
3754
3786
  name: "lingo.dev",
3755
- version: "0.77.6",
3787
+ version: "0.78.0",
3756
3788
  description: "Lingo.dev CLI",
3757
3789
  private: false,
3758
3790
  publishConfig: {
@@ -3777,6 +3809,19 @@ var package_default = {
3777
3809
  require: "./build/spec.cjs"
3778
3810
  }
3779
3811
  },
3812
+ typesVersions: {
3813
+ "*": {
3814
+ sdk: [
3815
+ "./build/sdk.d.ts"
3816
+ ],
3817
+ cli: [
3818
+ "./build/cli.d.ts"
3819
+ ],
3820
+ spec: [
3821
+ "./build/spec.d.ts"
3822
+ ]
3823
+ }
3824
+ },
3780
3825
  bin: {
3781
3826
  "lingo.dev": "./bin/cli.mjs"
3782
3827
  },