lingo.dev 0.94.6 → 0.96.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 +133 -87
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +66 -20
- package/build/cli.mjs.map +1 -1
- package/package.json +3 -3
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,
|
|
1861
|
-
const
|
|
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
|
|
1867
|
-
_lodash2.default.forEach(
|
|
1868
|
-
const key = row
|
|
1875
|
+
const items = {};
|
|
1876
|
+
_lodash2.default.forEach(inputParsed, (row) => {
|
|
1877
|
+
const key = row[keyColumnName];
|
|
1869
1878
|
if (key && row[locale] && row[locale].trim() !== "") {
|
|
1870
|
-
|
|
1879
|
+
items[key] = row[locale];
|
|
1871
1880
|
}
|
|
1872
1881
|
});
|
|
1873
|
-
return
|
|
1882
|
+
return {
|
|
1883
|
+
inputParsed,
|
|
1884
|
+
keyColumnName,
|
|
1885
|
+
items
|
|
1886
|
+
};
|
|
1874
1887
|
},
|
|
1875
|
-
async push(locale,
|
|
1876
|
-
const
|
|
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 =
|
|
1893
|
+
const updatedRows = inputParsed.map((row) => ({
|
|
1886
1894
|
...row,
|
|
1887
|
-
[locale]:
|
|
1895
|
+
[locale]: items[row[keyColumnName]] || row[locale] || ""
|
|
1888
1896
|
}));
|
|
1889
|
-
const existingKeys = new Set(
|
|
1890
|
-
Object.entries(
|
|
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
|
-
|
|
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',
|
|
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',
|
|
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',
|
|
1979
|
-
Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
2420
|
-
const originalSections = _optionalChain([originalInput, 'optionalAccess',
|
|
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',
|
|
2490
|
-
_optionalChain([data, 'access',
|
|
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',
|
|
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',
|
|
2794
|
+
ids: !_optionalChain([records, 'optionalAccess', _125 => _125.length]) ? void 0 : records.join(",")
|
|
2777
2795
|
}
|
|
2778
|
-
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
2904
|
-
let records = _optionalChain([initCtx, 'optionalAccess',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
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',
|
|
5765
|
-
(bucket) => !_optionalChain([ctx, 'access',
|
|
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',
|
|
5796
|
+
_optionalChain([ctx, 'access', _197 => _197.config, 'optionalAccess', _198 => _198.provider]),
|
|
5779
5797
|
ctx.flags.apiKey
|
|
5780
5798
|
);
|
|
5781
5799
|
if (!ctx.localizer) {
|
|
@@ -6152,6 +6170,23 @@ var flagsSchema2 = _zod.z.object({
|
|
|
6152
6170
|
|
|
6153
6171
|
// src/cli/cmd/run/index.ts
|
|
6154
6172
|
|
|
6173
|
+
|
|
6174
|
+
// src/cli/cmd/run/_utils.ts
|
|
6175
|
+
async function determineAuthId(ctx) {
|
|
6176
|
+
const isByokMode = !!_optionalChain([ctx, 'access', _199 => _199.config, 'optionalAccess', _200 => _200.provider]);
|
|
6177
|
+
if (isByokMode) {
|
|
6178
|
+
return null;
|
|
6179
|
+
} else {
|
|
6180
|
+
try {
|
|
6181
|
+
const authStatus = await _optionalChain([ctx, 'access', _201 => _201.localizer, 'optionalAccess', _202 => _202.checkAuth, 'call', _203 => _203()]);
|
|
6182
|
+
return _optionalChain([authStatus, 'optionalAccess', _204 => _204.username]) || null;
|
|
6183
|
+
} catch (e3) {
|
|
6184
|
+
return null;
|
|
6185
|
+
}
|
|
6186
|
+
}
|
|
6187
|
+
}
|
|
6188
|
+
|
|
6189
|
+
// src/cli/cmd/run/index.ts
|
|
6155
6190
|
var run_default = new (0, _interactivecommander.Command)().command("run").description("Run Lingo.dev localization engine").helpOption("-h, --help", "Show help").option(
|
|
6156
6191
|
"--source-locale <source-locale>",
|
|
6157
6192
|
"Locale to use as source locale. Defaults to i18n.json locale.source",
|
|
@@ -6208,6 +6243,7 @@ var run_default = new (0, _interactivecommander.Command)().command("run").descri
|
|
|
6208
6243
|
"Number of concurrent tasks to run",
|
|
6209
6244
|
(val) => parseInt(val)
|
|
6210
6245
|
).action(async (args) => {
|
|
6246
|
+
let authId = null;
|
|
6211
6247
|
try {
|
|
6212
6248
|
const ctx = {
|
|
6213
6249
|
flags: flagsSchema2.parse(args),
|
|
@@ -6223,6 +6259,11 @@ var run_default = new (0, _interactivecommander.Command)().command("run").descri
|
|
|
6223
6259
|
await renderHero();
|
|
6224
6260
|
await renderSpacer();
|
|
6225
6261
|
await setup(ctx);
|
|
6262
|
+
authId = await determineAuthId(ctx);
|
|
6263
|
+
trackEvent(authId, "cmd.run.start", {
|
|
6264
|
+
config: ctx.config,
|
|
6265
|
+
flags: ctx.flags
|
|
6266
|
+
});
|
|
6226
6267
|
await renderSpacer();
|
|
6227
6268
|
await plan(ctx);
|
|
6228
6269
|
await renderSpacer();
|
|
@@ -6230,7 +6271,12 @@ var run_default = new (0, _interactivecommander.Command)().command("run").descri
|
|
|
6230
6271
|
await renderSpacer();
|
|
6231
6272
|
await renderSummary(ctx.results);
|
|
6232
6273
|
await renderSpacer();
|
|
6274
|
+
trackEvent(authId, "cmd.run.success", {
|
|
6275
|
+
config: ctx.config,
|
|
6276
|
+
flags: ctx.flags
|
|
6277
|
+
});
|
|
6233
6278
|
} catch (error) {
|
|
6279
|
+
trackEvent(authId || "unknown", "cmd.run.error", {});
|
|
6234
6280
|
process.exit(1);
|
|
6235
6281
|
}
|
|
6236
6282
|
});
|
|
@@ -6304,7 +6350,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
6304
6350
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
6305
6351
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
6306
6352
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
6307
|
-
_optionalChain([this, 'access',
|
|
6353
|
+
_optionalChain([this, 'access', _205 => _205.platformKit, 'optionalAccess', _206 => _206.gitConfig, 'call', _207 => _207()]);
|
|
6308
6354
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
6309
6355
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
6310
6356
|
if (!processOwnCommits) {
|
|
@@ -6336,7 +6382,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
6336
6382
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
6337
6383
|
var PullRequestFlow = class extends InBranchFlow {
|
|
6338
6384
|
async preRun() {
|
|
6339
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
6385
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _208 => _208()]);
|
|
6340
6386
|
if (!canContinue) {
|
|
6341
6387
|
return false;
|
|
6342
6388
|
}
|
|
@@ -6591,10 +6637,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
6591
6637
|
repo_slug: this.platformConfig.repositoryName,
|
|
6592
6638
|
state: "OPEN"
|
|
6593
6639
|
}).then(({ data: { values } }) => {
|
|
6594
|
-
return _optionalChain([values, 'optionalAccess',
|
|
6595
|
-
({ source, destination }) => _optionalChain([source, 'optionalAccess',
|
|
6640
|
+
return _optionalChain([values, 'optionalAccess', _209 => _209.find, 'call', _210 => _210(
|
|
6641
|
+
({ source, destination }) => _optionalChain([source, 'optionalAccess', _211 => _211.branch, 'optionalAccess', _212 => _212.name]) === branch && _optionalChain([destination, 'optionalAccess', _213 => _213.branch, 'optionalAccess', _214 => _214.name]) === this.platformConfig.baseBranchName
|
|
6596
6642
|
)]);
|
|
6597
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
6643
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _215 => _215.id]));
|
|
6598
6644
|
}
|
|
6599
6645
|
async closePullRequest({ pullRequestNumber }) {
|
|
6600
6646
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -6690,7 +6736,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
6690
6736
|
repo: this.platformConfig.repositoryName,
|
|
6691
6737
|
base: this.platformConfig.baseBranchName,
|
|
6692
6738
|
state: "open"
|
|
6693
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
6739
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _216 => _216.number]));
|
|
6694
6740
|
}
|
|
6695
6741
|
async closePullRequest({ pullRequestNumber }) {
|
|
6696
6742
|
await this.octokit.rest.pulls.update({
|
|
@@ -6805,7 +6851,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
6805
6851
|
branch
|
|
6806
6852
|
);
|
|
6807
6853
|
return true;
|
|
6808
|
-
} catch (
|
|
6854
|
+
} catch (e4) {
|
|
6809
6855
|
return false;
|
|
6810
6856
|
}
|
|
6811
6857
|
}
|
|
@@ -6817,7 +6863,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
6817
6863
|
sourceBranch: branch,
|
|
6818
6864
|
state: "opened"
|
|
6819
6865
|
});
|
|
6820
|
-
return _optionalChain([mergeRequests, 'access',
|
|
6866
|
+
return _optionalChain([mergeRequests, 'access', _217 => _217[0], 'optionalAccess', _218 => _218.iid]);
|
|
6821
6867
|
}
|
|
6822
6868
|
async closePullRequest({
|
|
6823
6869
|
pullRequestNumber
|
|
@@ -6907,7 +6953,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
6907
6953
|
}
|
|
6908
6954
|
const env = {
|
|
6909
6955
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
6910
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
6956
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _219 => _219.pullRequest, 'optionalAccess', _220 => _220.toString, 'call', _221 => _221()]) || "false",
|
|
6911
6957
|
...options.commitMessage && {
|
|
6912
6958
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
6913
6959
|
},
|
|
@@ -6927,7 +6973,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
6927
6973
|
const { isPullRequestMode } = platformKit.config;
|
|
6928
6974
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
6929
6975
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
6930
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
6976
|
+
const canRun = await _optionalChain([flow, 'access', _222 => _222.preRun, 'optionalCall', _223 => _223()]);
|
|
6931
6977
|
if (canRun === false) {
|
|
6932
6978
|
return;
|
|
6933
6979
|
}
|
|
@@ -6937,7 +6983,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
6937
6983
|
if (!hasChanges) {
|
|
6938
6984
|
return;
|
|
6939
6985
|
}
|
|
6940
|
-
await _optionalChain([flow, 'access',
|
|
6986
|
+
await _optionalChain([flow, 'access', _224 => _224.postRun, 'optionalCall', _225 => _225()]);
|
|
6941
6987
|
});
|
|
6942
6988
|
function parseBooleanArg(val) {
|
|
6943
6989
|
if (val === true) return true;
|
|
@@ -6988,13 +7034,13 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
6988
7034
|
flags
|
|
6989
7035
|
});
|
|
6990
7036
|
let buckets = getBuckets(i18nConfig);
|
|
6991
|
-
if (_optionalChain([flags, 'access',
|
|
7037
|
+
if (_optionalChain([flags, 'access', _226 => _226.bucket, 'optionalAccess', _227 => _227.length])) {
|
|
6992
7038
|
buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
|
|
6993
7039
|
}
|
|
6994
7040
|
ora.succeed("Buckets retrieved");
|
|
6995
|
-
if (_optionalChain([flags, 'access',
|
|
7041
|
+
if (_optionalChain([flags, 'access', _228 => _228.file, 'optionalAccess', _229 => _229.length])) {
|
|
6996
7042
|
buckets = buckets.map((bucket) => {
|
|
6997
|
-
const paths = bucket.paths.filter((path16) => flags.file.find((file) => _optionalChain([path16, 'access',
|
|
7043
|
+
const paths = bucket.paths.filter((path16) => flags.file.find((file) => _optionalChain([path16, 'access', _230 => _230.pathPattern, 'optionalAccess', _231 => _231.match, 'call', _232 => _232(file)])));
|
|
6998
7044
|
return { ...bucket, paths };
|
|
6999
7045
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
7000
7046
|
if (buckets.length === 0) {
|
|
@@ -7010,7 +7056,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
7010
7056
|
});
|
|
7011
7057
|
}
|
|
7012
7058
|
}
|
|
7013
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
7059
|
+
const targetLocales = _optionalChain([flags, 'access', _233 => _233.locale, 'optionalAccess', _234 => _234.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
7014
7060
|
let totalSourceKeyCount = 0;
|
|
7015
7061
|
let uniqueKeysToTranslate = 0;
|
|
7016
7062
|
let totalExistingTranslations = 0;
|
|
@@ -7351,12 +7397,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
7351
7397
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
7352
7398
|
docUrl: "bucketNotFound"
|
|
7353
7399
|
});
|
|
7354
|
-
} else if (_optionalChain([flags, 'access',
|
|
7400
|
+
} else if (_optionalChain([flags, 'access', _235 => _235.locale, 'optionalAccess', _236 => _236.some, 'call', _237 => _237((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
7355
7401
|
throw new CLIError({
|
|
7356
7402
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
7357
7403
|
docUrl: "localeTargetNotFound"
|
|
7358
7404
|
});
|
|
7359
|
-
} else if (_optionalChain([flags, 'access',
|
|
7405
|
+
} else if (_optionalChain([flags, 'access', _238 => _238.bucket, 'optionalAccess', _239 => _239.some, 'call', _240 => _240((bucket) => !i18nConfig.buckets[bucket])])) {
|
|
7360
7406
|
throw new CLIError({
|
|
7361
7407
|
message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
|
|
7362
7408
|
docUrl: "bucketNotFound"
|
|
@@ -7439,7 +7485,7 @@ async function renderHero2() {
|
|
|
7439
7485
|
// package.json
|
|
7440
7486
|
var package_default = {
|
|
7441
7487
|
name: "lingo.dev",
|
|
7442
|
-
version: "0.
|
|
7488
|
+
version: "0.96.0",
|
|
7443
7489
|
description: "Lingo.dev CLI",
|
|
7444
7490
|
private: false,
|
|
7445
7491
|
publishConfig: {
|