lingo.dev 0.94.6 → 0.95.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
@@ -1855,42 +1855,50 @@ function createAndroidLoader() {
1855
1855
  var _sync = require('csv-parse/sync');
1856
1856
  var _sync3 = require('csv-stringify/sync');
1857
1857
 
1858
+ function detectKeyColumnName(csvString) {
1859
+ const row = _sync.parse.call(void 0, csvString)[0];
1860
+ const firstColumn = _optionalChain([row, 'optionalAccess', _74 => _74[0], 'optionalAccess', _75 => _75.trim, 'call', _76 => _76()]);
1861
+ return firstColumn || "KEY";
1862
+ }
1858
1863
  function createCsvLoader() {
1864
+ return composeLoaders(_createCsvLoader(), createPullOutputCleaner());
1865
+ }
1866
+ function _createCsvLoader() {
1859
1867
  return createLoader({
1860
- async pull(locale, _input) {
1861
- const input2 = _sync.parse.call(void 0, _input, {
1868
+ async pull(locale, input2) {
1869
+ const keyColumnName = detectKeyColumnName(input2.split("\n").find((l) => l.length));
1870
+ const inputParsed = _sync.parse.call(void 0, input2, {
1862
1871
  columns: true,
1863
1872
  skip_empty_lines: true,
1864
1873
  relax_column_count_less: true
1865
1874
  });
1866
- const result = {};
1867
- _lodash2.default.forEach(input2, (row) => {
1868
- const key = row.id;
1875
+ const items = {};
1876
+ _lodash2.default.forEach(inputParsed, (row) => {
1877
+ const key = row[keyColumnName];
1869
1878
  if (key && row[locale] && row[locale].trim() !== "") {
1870
- result[key] = row[locale];
1879
+ items[key] = row[locale];
1871
1880
  }
1872
1881
  });
1873
- return result;
1882
+ return {
1883
+ inputParsed,
1884
+ keyColumnName,
1885
+ items
1886
+ };
1874
1887
  },
1875
- async push(locale, data, originalInput) {
1876
- const input2 = _sync.parse.call(void 0, originalInput || "", {
1877
- columns: true,
1878
- skip_empty_lines: true,
1879
- relax_column_count_less: true
1880
- });
1881
- const columns = input2.length > 0 ? Object.keys(input2[0]) : ["id", locale];
1888
+ async push(locale, { inputParsed, keyColumnName, items }) {
1889
+ const columns = inputParsed.length > 0 ? Object.keys(inputParsed[0]) : [keyColumnName, locale];
1882
1890
  if (!columns.includes(locale)) {
1883
1891
  columns.push(locale);
1884
1892
  }
1885
- const updatedRows = input2.map((row) => ({
1893
+ const updatedRows = inputParsed.map((row) => ({
1886
1894
  ...row,
1887
- [locale]: data[row.id] || row[locale] || ""
1895
+ [locale]: items[row[keyColumnName]] || row[locale] || ""
1888
1896
  }));
1889
- const existingKeys = new Set(input2.map((row) => row.id));
1890
- Object.entries(data).forEach(([key, value]) => {
1897
+ const existingKeys = new Set(inputParsed.map((row) => row[keyColumnName]));
1898
+ Object.entries(items).forEach(([key, value]) => {
1891
1899
  if (!existingKeys.has(key)) {
1892
1900
  const newRow = {
1893
- id: key,
1901
+ [keyColumnName]: key,
1894
1902
  ...Object.fromEntries(columns.map((column) => [column, ""]))
1895
1903
  };
1896
1904
  newRow[locale] = value;
@@ -1904,6 +1912,16 @@ function createCsvLoader() {
1904
1912
  }
1905
1913
  });
1906
1914
  }
1915
+ function createPullOutputCleaner() {
1916
+ return createLoader({
1917
+ async pull(_locale, input2) {
1918
+ return input2.items;
1919
+ },
1920
+ async push(_locale, data, _oI, _oL, pullInput) {
1921
+ return { ...pullInput, items: data };
1922
+ }
1923
+ });
1924
+ }
1907
1925
 
1908
1926
  // src/cli/loaders/html.ts
1909
1927
  var _jsdom = require('jsdom');
@@ -1937,7 +1955,7 @@ function createHtmlLoader() {
1937
1955
  break;
1938
1956
  }
1939
1957
  const siblings = Array.from(parent.childNodes).filter(
1940
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _74 => _74.textContent, 'optionalAccess', _75 => _75.trim, 'call', _76 => _76()])
1958
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _77 => _77.textContent, 'optionalAccess', _78 => _78.trim, 'call', _79 => _79()])
1941
1959
  );
1942
1960
  const index = siblings.indexOf(current);
1943
1961
  if (index !== -1) {
@@ -1972,11 +1990,11 @@ function createHtmlLoader() {
1972
1990
  result[getPath(element, attr)] = value;
1973
1991
  }
1974
1992
  });
1975
- Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _77 => _77.textContent, 'optionalAccess', _78 => _78.trim, 'call', _79 => _79()])).forEach(processNode);
1993
+ Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _80 => _80.textContent, 'optionalAccess', _81 => _81.trim, 'call', _82 => _82()])).forEach(processNode);
1976
1994
  }
1977
1995
  };
1978
- Array.from(document.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _80 => _80.textContent, 'optionalAccess', _81 => _81.trim, 'call', _82 => _82()])).forEach(processNode);
1979
- Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _83 => _83.textContent, 'optionalAccess', _84 => _84.trim, 'call', _85 => _85()])).forEach(processNode);
1996
+ Array.from(document.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _83 => _83.textContent, 'optionalAccess', _84 => _84.trim, 'call', _85 => _85()])).forEach(processNode);
1997
+ Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _86 => _86.textContent, 'optionalAccess', _87 => _87.trim, 'call', _88 => _88()])).forEach(processNode);
1980
1998
  return result;
1981
1999
  },
1982
2000
  async push(locale, data, originalInput) {
@@ -1998,7 +2016,7 @@ function createHtmlLoader() {
1998
2016
  for (let i = 0; i < indices.length; i++) {
1999
2017
  const index = parseInt(indices[i]);
2000
2018
  const siblings = Array.from(parent.childNodes).filter(
2001
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _86 => _86.textContent, 'optionalAccess', _87 => _87.trim, 'call', _88 => _88()])
2019
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _89 => _89.textContent, 'optionalAccess', _90 => _90.trim, 'call', _91 => _91()])
2002
2020
  );
2003
2021
  if (index >= siblings.length) {
2004
2022
  if (i === indices.length - 1) {
@@ -2049,7 +2067,7 @@ function createMarkdownLoader() {
2049
2067
  yaml: yamlEngine
2050
2068
  }
2051
2069
  });
2052
- const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _89 => _89.trim, 'call', _90 => _90()]), () => ( ""))).filter(Boolean);
2070
+ const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _92 => _92.trim, 'call', _93 => _93()]), () => ( ""))).filter(Boolean);
2053
2071
  return {
2054
2072
  ...Object.fromEntries(
2055
2073
  sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
@@ -2061,7 +2079,7 @@ function createMarkdownLoader() {
2061
2079
  const frontmatter = Object.fromEntries(
2062
2080
  Object.entries(data).filter(([key]) => key.startsWith(FM_ATTR_PREFIX)).map(([key, value]) => [key.replace(FM_ATTR_PREFIX, ""), value])
2063
2081
  );
2064
- 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', _91 => _91.trim, 'call', _92 => _92()]), () => ( ""))).filter(Boolean).join("\n\n");
2082
+ 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', _94 => _94.trim, 'call', _95 => _95()]), () => ( ""))).filter(Boolean).join("\n\n");
2065
2083
  if (Object.keys(frontmatter).length > 0) {
2066
2084
  content = `
2067
2085
  ${content}`;
@@ -2105,7 +2123,7 @@ function isSkippableLine(line) {
2105
2123
  function parsePropertyLine(line) {
2106
2124
  const [key, ...valueParts] = line.split("=");
2107
2125
  return {
2108
- key: _optionalChain([key, 'optionalAccess', _93 => _93.trim, 'call', _94 => _94()]) || "",
2126
+ key: _optionalChain([key, 'optionalAccess', _96 => _96.trim, 'call', _97 => _97()]) || "",
2109
2127
  value: valueParts.join("=").trim()
2110
2128
  };
2111
2129
  }
@@ -2191,7 +2209,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
2191
2209
  if (rootTranslationEntity.shouldTranslate === false) {
2192
2210
  continue;
2193
2211
  }
2194
- const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _95 => _95.localizations, 'optionalAccess', _96 => _96[locale]]);
2212
+ const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _98 => _98.localizations, 'optionalAccess', _99 => _99[locale]]);
2195
2213
  if (langTranslationEntity) {
2196
2214
  if ("stringUnit" in langTranslationEntity) {
2197
2215
  resultData[translationKey] = langTranslationEntity.stringUnit.value;
@@ -2200,7 +2218,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
2200
2218
  resultData[translationKey] = {};
2201
2219
  const pluralForms = langTranslationEntity.variations.plural;
2202
2220
  for (const form in pluralForms) {
2203
- if (_optionalChain([pluralForms, 'access', _97 => _97[form], 'optionalAccess', _98 => _98.stringUnit, 'optionalAccess', _99 => _99.value])) {
2221
+ if (_optionalChain([pluralForms, 'access', _100 => _100[form], 'optionalAccess', _101 => _101.stringUnit, 'optionalAccess', _102 => _102.value])) {
2204
2222
  resultData[translationKey][form] = pluralForms[form].stringUnit.value;
2205
2223
  }
2206
2224
  }
@@ -2223,7 +2241,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
2223
2241
  const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
2224
2242
  if (typeof value === "string") {
2225
2243
  langDataToMerge.strings[key] = {
2226
- extractionState: _optionalChain([originalInput, 'optionalAccess', _100 => _100.strings, 'optionalAccess', _101 => _101[key], 'optionalAccess', _102 => _102.extractionState]),
2244
+ extractionState: _optionalChain([originalInput, 'optionalAccess', _103 => _103.strings, 'optionalAccess', _104 => _104[key], 'optionalAccess', _105 => _105.extractionState]),
2227
2245
  localizations: {
2228
2246
  [locale]: {
2229
2247
  stringUnit: {
@@ -2406,7 +2424,7 @@ function createPoDataLoader(params) {
2406
2424
  Object.entries(entries).forEach(([msgid, entry]) => {
2407
2425
  if (msgid && entry.msgid) {
2408
2426
  const context = entry.msgctxt || "";
2409
- const fullEntry = _optionalChain([parsedPo, 'access', _103 => _103.translations, 'access', _104 => _104[context], 'optionalAccess', _105 => _105[msgid]]);
2427
+ const fullEntry = _optionalChain([parsedPo, 'access', _106 => _106.translations, 'access', _107 => _107[context], 'optionalAccess', _108 => _108[msgid]]);
2410
2428
  if (fullEntry) {
2411
2429
  result[msgid] = fullEntry;
2412
2430
  }
@@ -2416,8 +2434,8 @@ function createPoDataLoader(params) {
2416
2434
  return result;
2417
2435
  },
2418
2436
  async push(locale, data, originalInput, originalLocale, pullInput) {
2419
- const currentSections = _optionalChain([pullInput, 'optionalAccess', _106 => _106.split, 'call', _107 => _107("\n\n"), 'access', _108 => _108.filter, 'call', _109 => _109(Boolean)]) || [];
2420
- const originalSections = _optionalChain([originalInput, 'optionalAccess', _110 => _110.split, 'call', _111 => _111("\n\n"), 'access', _112 => _112.filter, 'call', _113 => _113(Boolean)]) || [];
2437
+ const currentSections = _optionalChain([pullInput, 'optionalAccess', _109 => _109.split, 'call', _110 => _110("\n\n"), 'access', _111 => _111.filter, 'call', _112 => _112(Boolean)]) || [];
2438
+ const originalSections = _optionalChain([originalInput, 'optionalAccess', _113 => _113.split, 'call', _114 => _114("\n\n"), 'access', _115 => _115.filter, 'call', _116 => _116(Boolean)]) || [];
2421
2439
  const result = originalSections.map((section) => {
2422
2440
  const sectionPo = _gettextparser2.default.po.parse(section);
2423
2441
  if (Object.keys(sectionPo.translations).length === 0) {
@@ -2486,8 +2504,8 @@ function createPoContentLoader() {
2486
2504
  {
2487
2505
  ...entry,
2488
2506
  msgstr: [
2489
- _optionalChain([data, 'access', _114 => _114[entry.msgid], 'optionalAccess', _115 => _115.singular]),
2490
- _optionalChain([data, 'access', _116 => _116[entry.msgid], 'optionalAccess', _117 => _117.plural]) || null
2507
+ _optionalChain([data, 'access', _117 => _117[entry.msgid], 'optionalAccess', _118 => _118.singular]),
2508
+ _optionalChain([data, 'access', _119 => _119[entry.msgid], 'optionalAccess', _120 => _120.plural]) || null
2491
2509
  ].filter(Boolean)
2492
2510
  }
2493
2511
  ]).fromPairs().value();
@@ -2763,7 +2781,7 @@ function createDatoClient(params) {
2763
2781
  only_valid: "true",
2764
2782
  ids: !records.length ? void 0 : records.join(",")
2765
2783
  }
2766
- }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _118 => _118.response, 'optionalAccess', _119 => _119.body, 'optionalAccess', _120 => _120.data, 'optionalAccess', _121 => _121[0]]) || error));
2784
+ }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _121 => _121.response, 'optionalAccess', _122 => _122.body, 'optionalAccess', _123 => _123.data, 'optionalAccess', _124 => _124[0]]) || error));
2767
2785
  },
2768
2786
  findRecordsForModel: async (modelId, records) => {
2769
2787
  try {
@@ -2773,9 +2791,9 @@ function createDatoClient(params) {
2773
2791
  filter: {
2774
2792
  type: modelId,
2775
2793
  only_valid: "true",
2776
- ids: !_optionalChain([records, 'optionalAccess', _122 => _122.length]) ? void 0 : records.join(",")
2794
+ ids: !_optionalChain([records, 'optionalAccess', _125 => _125.length]) ? void 0 : records.join(",")
2777
2795
  }
2778
- }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _123 => _123.response, 'optionalAccess', _124 => _124.body, 'optionalAccess', _125 => _125.data, 'optionalAccess', _126 => _126[0]]) || error));
2796
+ }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _126 => _126.response, 'optionalAccess', _127 => _127.body, 'optionalAccess', _128 => _128.data, 'optionalAccess', _129 => _129[0]]) || error));
2779
2797
  return result;
2780
2798
  } catch (_error) {
2781
2799
  throw new Error(
@@ -2789,9 +2807,9 @@ function createDatoClient(params) {
2789
2807
  },
2790
2808
  updateRecord: async (id, payload) => {
2791
2809
  try {
2792
- await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _127 => _127.response, 'optionalAccess', _128 => _128.body, 'optionalAccess', _129 => _129.data, 'optionalAccess', _130 => _130[0]]) || error));
2810
+ await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _130 => _130.response, 'optionalAccess', _131 => _131.body, 'optionalAccess', _132 => _132.data, 'optionalAccess', _133 => _133[0]]) || error));
2793
2811
  } catch (_error) {
2794
- if (_optionalChain([_error, 'optionalAccess', _131 => _131.attributes, 'optionalAccess', _132 => _132.details, 'optionalAccess', _133 => _133.message])) {
2812
+ if (_optionalChain([_error, 'optionalAccess', _134 => _134.attributes, 'optionalAccess', _135 => _135.details, 'optionalAccess', _136 => _136.message])) {
2795
2813
  throw new Error(
2796
2814
  [
2797
2815
  `${_error.attributes.details.message}`,
@@ -2812,9 +2830,9 @@ function createDatoClient(params) {
2812
2830
  },
2813
2831
  enableFieldLocalization: async (args) => {
2814
2832
  try {
2815
- await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _134 => _134.response, 'optionalAccess', _135 => _135.body, 'optionalAccess', _136 => _136.data, 'optionalAccess', _137 => _137[0]]) || error));
2833
+ await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _137 => _137.response, 'optionalAccess', _138 => _138.body, 'optionalAccess', _139 => _139.data, 'optionalAccess', _140 => _140[0]]) || error));
2816
2834
  } catch (_error) {
2817
- if (_optionalChain([_error, 'optionalAccess', _138 => _138.attributes, 'optionalAccess', _139 => _139.code]) === "NOT_FOUND") {
2835
+ if (_optionalChain([_error, 'optionalAccess', _141 => _141.attributes, 'optionalAccess', _142 => _142.code]) === "NOT_FOUND") {
2818
2836
  throw new Error(
2819
2837
  [
2820
2838
  `Field "${args.fieldId}" not found in model "${args.modelId}".`,
@@ -2822,7 +2840,7 @@ function createDatoClient(params) {
2822
2840
  ].join("\n\n")
2823
2841
  );
2824
2842
  }
2825
- if (_optionalChain([_error, 'optionalAccess', _140 => _140.attributes, 'optionalAccess', _141 => _141.details, 'optionalAccess', _142 => _142.message])) {
2843
+ if (_optionalChain([_error, 'optionalAccess', _143 => _143.attributes, 'optionalAccess', _144 => _144.details, 'optionalAccess', _145 => _145.message])) {
2826
2844
  throw new Error(
2827
2845
  [`${_error.attributes.details.message}`, `Error: ${JSON.stringify(_error, null, 2)}`].join("\n\n")
2828
2846
  );
@@ -2888,7 +2906,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
2888
2906
  }
2889
2907
  }
2890
2908
  const records = await dato.findRecordsForModel(modelId);
2891
- const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _143 => _143.models, 'access', _144 => _144[modelId], 'optionalAccess', _145 => _145.records]) || [], project);
2909
+ const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _146 => _146.models, 'access', _147 => _147[modelId], 'optionalAccess', _148 => _148.records]) || [], project);
2892
2910
  const selectedRecords = await promptRecordSelection(modelName, recordChoices);
2893
2911
  result.models[modelId].records = records.filter((record) => selectedRecords.includes(record.id));
2894
2912
  updatedConfig.models[modelId].records = selectedRecords;
@@ -2900,14 +2918,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
2900
2918
  },
2901
2919
  async pull(locale, input2, initCtx) {
2902
2920
  const result = {};
2903
- for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _146 => _146.models]) || {})) {
2904
- let records = _optionalChain([initCtx, 'optionalAccess', _147 => _147.models, 'access', _148 => _148[modelId], 'access', _149 => _149.records]) || [];
2921
+ for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _149 => _149.models]) || {})) {
2922
+ let records = _optionalChain([initCtx, 'optionalAccess', _150 => _150.models, 'access', _151 => _151[modelId], 'access', _152 => _152.records]) || [];
2905
2923
  const recordIds = records.map((record) => record.id);
2906
2924
  records = await dato.findRecords(recordIds);
2907
2925
  console.log(`Fetched ${records.length} records for model ${modelId}`);
2908
2926
  if (records.length > 0) {
2909
2927
  result[modelId] = {
2910
- fields: _optionalChain([initCtx, 'optionalAccess', _150 => _150.models, 'optionalAccess', _151 => _151[modelId], 'optionalAccess', _152 => _152.fields]) || [],
2928
+ fields: _optionalChain([initCtx, 'optionalAccess', _153 => _153.models, 'optionalAccess', _154 => _154[modelId], 'optionalAccess', _155 => _155.fields]) || [],
2911
2929
  records
2912
2930
  };
2913
2931
  }
@@ -2966,7 +2984,7 @@ function createRecordChoices(records, selectedIds = [], project) {
2966
2984
  return records.map((record) => ({
2967
2985
  name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
2968
2986
  value: record.id,
2969
- checked: _optionalChain([selectedIds, 'optionalAccess', _153 => _153.includes, 'call', _154 => _154(record.id)])
2987
+ checked: _optionalChain([selectedIds, 'optionalAccess', _156 => _156.includes, 'call', _157 => _157(record.id)])
2970
2988
  }));
2971
2989
  }
2972
2990
  async function promptRecordSelection(modelName, choices) {
@@ -3233,7 +3251,7 @@ var _nodewebvtt = require('node-webvtt'); var _nodewebvtt2 = _interopRequireDefa
3233
3251
  function createVttLoader() {
3234
3252
  return createLoader({
3235
3253
  async pull(locale, input2) {
3236
- const vtt = _optionalChain([_nodewebvtt2.default, 'access', _155 => _155.parse, 'call', _156 => _156(input2), 'optionalAccess', _157 => _157.cues]);
3254
+ const vtt = _optionalChain([_nodewebvtt2.default, 'access', _158 => _158.parse, 'call', _159 => _159(input2), 'optionalAccess', _160 => _160.cues]);
3237
3255
  if (Object.keys(vtt).length === 0) {
3238
3256
  return {};
3239
3257
  } else {
@@ -3287,7 +3305,7 @@ function variableExtractLoader(params) {
3287
3305
  for (let i = 0; i < matches.length; i++) {
3288
3306
  const match = matches[i];
3289
3307
  const currentValue = result[key].value;
3290
- const newValue = _optionalChain([currentValue, 'optionalAccess', _158 => _158.replace, 'call', _159 => _159(match, `{variable:${i}}`)]);
3308
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _161 => _161.replace, 'call', _162 => _162(match, `{variable:${i}}`)]);
3291
3309
  result[key].value = newValue;
3292
3310
  result[key].variables[i] = match;
3293
3311
  }
@@ -3301,7 +3319,7 @@ function variableExtractLoader(params) {
3301
3319
  for (let i = 0; i < valueObj.variables.length; i++) {
3302
3320
  const variable = valueObj.variables[i];
3303
3321
  const currentValue = result[key];
3304
- const newValue = _optionalChain([currentValue, 'optionalAccess', _160 => _160.replace, 'call', _161 => _161(`{variable:${i}}`, variable)]);
3322
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _163 => _163.replace, 'call', _164 => _164(`{variable:${i}}`, variable)]);
3305
3323
  result[key] = newValue;
3306
3324
  }
3307
3325
  }
@@ -3484,7 +3502,7 @@ function createVueJsonLoader() {
3484
3502
  return createLoader({
3485
3503
  pull: async (locale, input2, ctx) => {
3486
3504
  const parsed = parseVueFile(input2);
3487
- return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _162 => _162.i18n, 'optionalAccess', _163 => _163[locale]]), () => ( {}));
3505
+ return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _165 => _165.i18n, 'optionalAccess', _166 => _166[locale]]), () => ( {}));
3488
3506
  },
3489
3507
  push: async (locale, data, originalInput) => {
3490
3508
  const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
@@ -3665,7 +3683,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
3665
3683
  objectExpression.properties.forEach((prop) => {
3666
3684
  if (!t.isObjectProperty(prop)) return;
3667
3685
  const key = getPropertyKey(prop);
3668
- const incomingVal = _optionalChain([data, 'optionalAccess', _164 => _164[key]]);
3686
+ const incomingVal = _optionalChain([data, 'optionalAccess', _167 => _167[key]]);
3669
3687
  if (incomingVal === void 0) {
3670
3688
  return;
3671
3689
  }
@@ -3701,7 +3719,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
3701
3719
  let modified = false;
3702
3720
  arrayExpression.elements.forEach((element, index) => {
3703
3721
  if (!element) return;
3704
- const incomingVal = _optionalChain([incoming, 'optionalAccess', _165 => _165[index]]);
3722
+ const incomingVal = _optionalChain([incoming, 'optionalAccess', _168 => _168[index]]);
3705
3723
  if (incomingVal === void 0) return;
3706
3724
  if (t.isStringLiteral(element) && typeof incomingVal === "string") {
3707
3725
  if (element.value !== incomingVal) {
@@ -3977,7 +3995,7 @@ function createMdxSectionsSplit2Loader() {
3977
3995
  const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
3978
3996
  const result = {
3979
3997
  frontmatter: data.frontmatter,
3980
- codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _166 => _166.codePlaceholders]) || {},
3998
+ codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _169 => _169.codePlaceholders]) || {},
3981
3999
  content
3982
4000
  };
3983
4001
  return result;
@@ -4420,7 +4438,7 @@ function createBasicTranslator(model, systemPrompt) {
4420
4438
  ]
4421
4439
  });
4422
4440
  const result = JSON.parse(response.text);
4423
- return _optionalChain([result, 'optionalAccess', _167 => _167.data]) || {};
4441
+ return _optionalChain([result, 'optionalAccess', _170 => _170.data]) || {};
4424
4442
  }
4425
4443
  }
4426
4444
  function extractPayloadChunks(payload) {
@@ -4490,7 +4508,7 @@ function getPureModelProvider(provider) {
4490
4508
 
4491
4509
  ${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
4492
4510
  `;
4493
- switch (_optionalChain([provider, 'optionalAccess', _168 => _168.id])) {
4511
+ switch (_optionalChain([provider, 'optionalAccess', _171 => _171.id])) {
4494
4512
  case "openai":
4495
4513
  if (!process.env.OPENAI_API_KEY) {
4496
4514
  throw new Error(
@@ -4511,7 +4529,7 @@ function getPureModelProvider(provider) {
4511
4529
  apiKey: process.env.ANTHROPIC_API_KEY
4512
4530
  })(provider.model);
4513
4531
  default:
4514
- throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _169 => _169.id])));
4532
+ throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _172 => _172.id])));
4515
4533
  }
4516
4534
  }
4517
4535
 
@@ -4735,7 +4753,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
4735
4753
  validateParams(i18nConfig, flags);
4736
4754
  ora.succeed("Localization configuration is valid");
4737
4755
  ora.start("Connecting to Lingo.dev Localization Engine...");
4738
- const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _170 => _170.provider]);
4756
+ const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _173 => _173.provider]);
4739
4757
  if (isByokMode) {
4740
4758
  authId = null;
4741
4759
  ora.succeed("Using external provider (BYOK mode)");
@@ -4749,16 +4767,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
4749
4767
  flags
4750
4768
  });
4751
4769
  let buckets = getBuckets(i18nConfig);
4752
- if (_optionalChain([flags, 'access', _171 => _171.bucket, 'optionalAccess', _172 => _172.length])) {
4770
+ if (_optionalChain([flags, 'access', _174 => _174.bucket, 'optionalAccess', _175 => _175.length])) {
4753
4771
  buckets = buckets.filter(
4754
4772
  (bucket) => flags.bucket.includes(bucket.type)
4755
4773
  );
4756
4774
  }
4757
4775
  ora.succeed("Buckets retrieved");
4758
- if (_optionalChain([flags, 'access', _173 => _173.file, 'optionalAccess', _174 => _174.length])) {
4776
+ if (_optionalChain([flags, 'access', _176 => _176.file, 'optionalAccess', _177 => _177.length])) {
4759
4777
  buckets = buckets.map((bucket) => {
4760
4778
  const paths = bucket.paths.filter(
4761
- (path16) => flags.file.find((file) => _optionalChain([path16, 'access', _175 => _175.pathPattern, 'optionalAccess', _176 => _176.includes, 'call', _177 => _177(file)]))
4779
+ (path16) => flags.file.find((file) => _optionalChain([path16, 'access', _178 => _178.pathPattern, 'optionalAccess', _179 => _179.includes, 'call', _180 => _180(file)]))
4762
4780
  );
4763
4781
  return { ...bucket, paths };
4764
4782
  }).filter((bucket) => bucket.paths.length > 0);
@@ -4777,7 +4795,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
4777
4795
  });
4778
4796
  }
4779
4797
  }
4780
- const targetLocales = _optionalChain([flags, 'access', _178 => _178.locale, 'optionalAccess', _179 => _179.length]) ? flags.locale : i18nConfig.locale.targets;
4798
+ const targetLocales = _optionalChain([flags, 'access', _181 => _181.locale, 'optionalAccess', _182 => _182.length]) ? flags.locale : i18nConfig.locale.targets;
4781
4799
  ora.start("Setting up localization cache...");
4782
4800
  const checkLockfileProcessor = createDeltaProcessor("");
4783
4801
  const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
@@ -5121,12 +5139,12 @@ function validateParams(i18nConfig, flags) {
5121
5139
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
5122
5140
  docUrl: "bucketNotFound"
5123
5141
  });
5124
- } else if (_optionalChain([flags, 'access', _180 => _180.locale, 'optionalAccess', _181 => _181.some, 'call', _182 => _182((locale) => !i18nConfig.locale.targets.includes(locale))])) {
5142
+ } else if (_optionalChain([flags, 'access', _183 => _183.locale, 'optionalAccess', _184 => _184.some, 'call', _185 => _185((locale) => !i18nConfig.locale.targets.includes(locale))])) {
5125
5143
  throw new CLIError({
5126
5144
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
5127
5145
  docUrl: "localeTargetNotFound"
5128
5146
  });
5129
- } else if (_optionalChain([flags, 'access', _183 => _183.bucket, 'optionalAccess', _184 => _184.some, 'call', _185 => _185(
5147
+ } else if (_optionalChain([flags, 'access', _186 => _186.bucket, 'optionalAccess', _187 => _187.some, 'call', _188 => _188(
5130
5148
  (bucket) => !i18nConfig.buckets[bucket]
5131
5149
  )])) {
5132
5150
  throw new CLIError({
@@ -5576,7 +5594,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
5576
5594
  const response = await engine.whoami();
5577
5595
  return {
5578
5596
  authenticated: !!response,
5579
- username: _optionalChain([response, 'optionalAccess', _186 => _186.email])
5597
+ username: _optionalChain([response, 'optionalAccess', _189 => _189.email])
5580
5598
  };
5581
5599
  } catch (e2) {
5582
5600
  return { authenticated: false };
@@ -5761,8 +5779,8 @@ async function setup(input2) {
5761
5779
  throw new Error(
5762
5780
  "No buckets found in i18n.json. Please add at least one bucket containing i18n content."
5763
5781
  );
5764
- } else if (_optionalChain([ctx, 'access', _187 => _187.flags, 'access', _188 => _188.bucket, 'optionalAccess', _189 => _189.some, 'call', _190 => _190(
5765
- (bucket) => !_optionalChain([ctx, 'access', _191 => _191.config, 'optionalAccess', _192 => _192.buckets, 'access', _193 => _193[bucket]])
5782
+ } else if (_optionalChain([ctx, 'access', _190 => _190.flags, 'access', _191 => _191.bucket, 'optionalAccess', _192 => _192.some, 'call', _193 => _193(
5783
+ (bucket) => !_optionalChain([ctx, 'access', _194 => _194.config, 'optionalAccess', _195 => _195.buckets, 'access', _196 => _196[bucket]])
5766
5784
  )])) {
5767
5785
  throw new Error(
5768
5786
  `One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
@@ -5775,7 +5793,7 @@ async function setup(input2) {
5775
5793
  title: "Selecting localization provider",
5776
5794
  task: async (ctx, task) => {
5777
5795
  ctx.localizer = createLocalizer(
5778
- _optionalChain([ctx, 'access', _194 => _194.config, 'optionalAccess', _195 => _195.provider]),
5796
+ _optionalChain([ctx, 'access', _197 => _197.config, 'optionalAccess', _198 => _198.provider]),
5779
5797
  ctx.flags.apiKey
5780
5798
  );
5781
5799
  if (!ctx.localizer) {
@@ -6304,7 +6322,7 @@ var InBranchFlow = class extends IntegrationFlow {
6304
6322
  _child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
6305
6323
  _child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
6306
6324
  _child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
6307
- _optionalChain([this, 'access', _196 => _196.platformKit, 'optionalAccess', _197 => _197.gitConfig, 'call', _198 => _198()]);
6325
+ _optionalChain([this, 'access', _199 => _199.platformKit, 'optionalAccess', _200 => _200.gitConfig, 'call', _201 => _201()]);
6308
6326
  _child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
6309
6327
  _child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
6310
6328
  if (!processOwnCommits) {
@@ -6336,7 +6354,7 @@ var InBranchFlow = class extends IntegrationFlow {
6336
6354
  // src/cli/cmd/ci/flows/pull-request.ts
6337
6355
  var PullRequestFlow = class extends InBranchFlow {
6338
6356
  async preRun() {
6339
- const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _199 => _199()]);
6357
+ const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _202 => _202()]);
6340
6358
  if (!canContinue) {
6341
6359
  return false;
6342
6360
  }
@@ -6591,10 +6609,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
6591
6609
  repo_slug: this.platformConfig.repositoryName,
6592
6610
  state: "OPEN"
6593
6611
  }).then(({ data: { values } }) => {
6594
- return _optionalChain([values, 'optionalAccess', _200 => _200.find, 'call', _201 => _201(
6595
- ({ source, destination }) => _optionalChain([source, 'optionalAccess', _202 => _202.branch, 'optionalAccess', _203 => _203.name]) === branch && _optionalChain([destination, 'optionalAccess', _204 => _204.branch, 'optionalAccess', _205 => _205.name]) === this.platformConfig.baseBranchName
6612
+ return _optionalChain([values, 'optionalAccess', _203 => _203.find, 'call', _204 => _204(
6613
+ ({ source, destination }) => _optionalChain([source, 'optionalAccess', _205 => _205.branch, 'optionalAccess', _206 => _206.name]) === branch && _optionalChain([destination, 'optionalAccess', _207 => _207.branch, 'optionalAccess', _208 => _208.name]) === this.platformConfig.baseBranchName
6596
6614
  )]);
6597
- }).then((pr) => _optionalChain([pr, 'optionalAccess', _206 => _206.id]));
6615
+ }).then((pr) => _optionalChain([pr, 'optionalAccess', _209 => _209.id]));
6598
6616
  }
6599
6617
  async closePullRequest({ pullRequestNumber }) {
6600
6618
  await this.bb.repositories.declinePullRequest({
@@ -6690,7 +6708,7 @@ var GitHubPlatformKit = class extends PlatformKit {
6690
6708
  repo: this.platformConfig.repositoryName,
6691
6709
  base: this.platformConfig.baseBranchName,
6692
6710
  state: "open"
6693
- }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _207 => _207.number]));
6711
+ }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _210 => _210.number]));
6694
6712
  }
6695
6713
  async closePullRequest({ pullRequestNumber }) {
6696
6714
  await this.octokit.rest.pulls.update({
@@ -6817,7 +6835,7 @@ var GitlabPlatformKit = class extends PlatformKit {
6817
6835
  sourceBranch: branch,
6818
6836
  state: "opened"
6819
6837
  });
6820
- return _optionalChain([mergeRequests, 'access', _208 => _208[0], 'optionalAccess', _209 => _209.iid]);
6838
+ return _optionalChain([mergeRequests, 'access', _211 => _211[0], 'optionalAccess', _212 => _212.iid]);
6821
6839
  }
6822
6840
  async closePullRequest({
6823
6841
  pullRequestNumber
@@ -6907,7 +6925,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
6907
6925
  }
6908
6926
  const env = {
6909
6927
  LINGODOTDEV_API_KEY: settings.auth.apiKey,
6910
- LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _210 => _210.pullRequest, 'optionalAccess', _211 => _211.toString, 'call', _212 => _212()]) || "false",
6928
+ LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _213 => _213.pullRequest, 'optionalAccess', _214 => _214.toString, 'call', _215 => _215()]) || "false",
6911
6929
  ...options.commitMessage && {
6912
6930
  LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
6913
6931
  },
@@ -6927,7 +6945,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
6927
6945
  const { isPullRequestMode } = platformKit.config;
6928
6946
  ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
6929
6947
  const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
6930
- const canRun = await _optionalChain([flow, 'access', _213 => _213.preRun, 'optionalCall', _214 => _214()]);
6948
+ const canRun = await _optionalChain([flow, 'access', _216 => _216.preRun, 'optionalCall', _217 => _217()]);
6931
6949
  if (canRun === false) {
6932
6950
  return;
6933
6951
  }
@@ -6937,7 +6955,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
6937
6955
  if (!hasChanges) {
6938
6956
  return;
6939
6957
  }
6940
- await _optionalChain([flow, 'access', _215 => _215.postRun, 'optionalCall', _216 => _216()]);
6958
+ await _optionalChain([flow, 'access', _218 => _218.postRun, 'optionalCall', _219 => _219()]);
6941
6959
  });
6942
6960
  function parseBooleanArg(val) {
6943
6961
  if (val === true) return true;
@@ -6988,13 +7006,13 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
6988
7006
  flags
6989
7007
  });
6990
7008
  let buckets = getBuckets(i18nConfig);
6991
- if (_optionalChain([flags, 'access', _217 => _217.bucket, 'optionalAccess', _218 => _218.length])) {
7009
+ if (_optionalChain([flags, 'access', _220 => _220.bucket, 'optionalAccess', _221 => _221.length])) {
6992
7010
  buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
6993
7011
  }
6994
7012
  ora.succeed("Buckets retrieved");
6995
- if (_optionalChain([flags, 'access', _219 => _219.file, 'optionalAccess', _220 => _220.length])) {
7013
+ if (_optionalChain([flags, 'access', _222 => _222.file, 'optionalAccess', _223 => _223.length])) {
6996
7014
  buckets = buckets.map((bucket) => {
6997
- const paths = bucket.paths.filter((path16) => flags.file.find((file) => _optionalChain([path16, 'access', _221 => _221.pathPattern, 'optionalAccess', _222 => _222.match, 'call', _223 => _223(file)])));
7015
+ const paths = bucket.paths.filter((path16) => flags.file.find((file) => _optionalChain([path16, 'access', _224 => _224.pathPattern, 'optionalAccess', _225 => _225.match, 'call', _226 => _226(file)])));
6998
7016
  return { ...bucket, paths };
6999
7017
  }).filter((bucket) => bucket.paths.length > 0);
7000
7018
  if (buckets.length === 0) {
@@ -7010,7 +7028,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
7010
7028
  });
7011
7029
  }
7012
7030
  }
7013
- const targetLocales = _optionalChain([flags, 'access', _224 => _224.locale, 'optionalAccess', _225 => _225.length]) ? flags.locale : i18nConfig.locale.targets;
7031
+ const targetLocales = _optionalChain([flags, 'access', _227 => _227.locale, 'optionalAccess', _228 => _228.length]) ? flags.locale : i18nConfig.locale.targets;
7014
7032
  let totalSourceKeyCount = 0;
7015
7033
  let uniqueKeysToTranslate = 0;
7016
7034
  let totalExistingTranslations = 0;
@@ -7351,12 +7369,12 @@ function validateParams2(i18nConfig, flags) {
7351
7369
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
7352
7370
  docUrl: "bucketNotFound"
7353
7371
  });
7354
- } else if (_optionalChain([flags, 'access', _226 => _226.locale, 'optionalAccess', _227 => _227.some, 'call', _228 => _228((locale) => !i18nConfig.locale.targets.includes(locale))])) {
7372
+ } else if (_optionalChain([flags, 'access', _229 => _229.locale, 'optionalAccess', _230 => _230.some, 'call', _231 => _231((locale) => !i18nConfig.locale.targets.includes(locale))])) {
7355
7373
  throw new CLIError({
7356
7374
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
7357
7375
  docUrl: "localeTargetNotFound"
7358
7376
  });
7359
- } else if (_optionalChain([flags, 'access', _229 => _229.bucket, 'optionalAccess', _230 => _230.some, 'call', _231 => _231((bucket) => !i18nConfig.buckets[bucket])])) {
7377
+ } else if (_optionalChain([flags, 'access', _232 => _232.bucket, 'optionalAccess', _233 => _233.some, 'call', _234 => _234((bucket) => !i18nConfig.buckets[bucket])])) {
7360
7378
  throw new CLIError({
7361
7379
  message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
7362
7380
  docUrl: "bucketNotFound"
@@ -7439,7 +7457,7 @@ async function renderHero2() {
7439
7457
  // package.json
7440
7458
  var package_default = {
7441
7459
  name: "lingo.dev",
7442
- version: "0.94.6",
7460
+ version: "0.95.0",
7443
7461
  description: "Lingo.dev CLI",
7444
7462
  private: false,
7445
7463
  publishConfig: {