lingo.dev 0.92.13 → 0.92.15
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 +158 -96
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +105 -43
- package/build/cli.mjs.map +1 -1
- package/package.json +3 -3
package/build/cli.cjs
CHANGED
|
@@ -26,9 +26,9 @@ function getSettings(explicitApiKey) {
|
|
|
26
26
|
_envVarsInfo();
|
|
27
27
|
return {
|
|
28
28
|
auth: {
|
|
29
|
-
apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access',
|
|
30
|
-
apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access',
|
|
31
|
-
webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access',
|
|
29
|
+
apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access', _31 => _31.auth, 'optionalAccess', _32 => _32.apiKey]) || defaults.auth.apiKey,
|
|
30
|
+
apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _33 => _33.auth, 'optionalAccess', _34 => _34.apiUrl]) || defaults.auth.apiUrl,
|
|
31
|
+
webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _35 => _35.auth, 'optionalAccess', _36 => _36.webUrl]) || defaults.auth.webUrl
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
}
|
|
@@ -99,7 +99,7 @@ Please use LINGODOTDEV_API_KEY instead.
|
|
|
99
99
|
function _envVarsInfo() {
|
|
100
100
|
const env = _loadEnv();
|
|
101
101
|
const systemFile = _loadSystemFile();
|
|
102
|
-
if (env.LINGODOTDEV_API_KEY && _optionalChain([systemFile, 'access',
|
|
102
|
+
if (env.LINGODOTDEV_API_KEY && _optionalChain([systemFile, 'access', _37 => _37.auth, 'optionalAccess', _38 => _38.apiKey])) {
|
|
103
103
|
console.info(
|
|
104
104
|
"\x1B[36m%s\x1B[0m",
|
|
105
105
|
`\u2139\uFE0F Using LINGODOTDEV_API_KEY env var instead of credentials from login flow (saved in .lingodotdevrc)`
|
|
@@ -154,7 +154,7 @@ function createAuthenticator(params) {
|
|
|
154
154
|
});
|
|
155
155
|
if (res.ok) {
|
|
156
156
|
const payload = await res.json();
|
|
157
|
-
if (!_optionalChain([payload, 'optionalAccess',
|
|
157
|
+
if (!_optionalChain([payload, 'optionalAccess', _39 => _39.email])) {
|
|
158
158
|
return null;
|
|
159
159
|
}
|
|
160
160
|
return {
|
|
@@ -774,7 +774,7 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
|
|
|
774
774
|
});
|
|
775
775
|
const auth2 = await newAuthenticator.whoami();
|
|
776
776
|
if (auth2) {
|
|
777
|
-
_ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess',
|
|
777
|
+
_ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _40 => _40.email])}`);
|
|
778
778
|
} else {
|
|
779
779
|
_ora2.default.call(void 0, ).fail("Authentication failed.");
|
|
780
780
|
}
|
|
@@ -859,7 +859,7 @@ function getBuckets(i18nConfig) {
|
|
|
859
859
|
const includeItems = bucketEntry.include.map(
|
|
860
860
|
(item) => resolveBucketItem(item)
|
|
861
861
|
);
|
|
862
|
-
const excludeItems = _optionalChain([bucketEntry, 'access',
|
|
862
|
+
const excludeItems = _optionalChain([bucketEntry, 'access', _41 => _41.exclude, 'optionalAccess', _42 => _42.map, 'call', _43 => _43(
|
|
863
863
|
(item) => resolveBucketItem(item)
|
|
864
864
|
)]);
|
|
865
865
|
const config = {
|
|
@@ -897,7 +897,7 @@ function extractPathPatterns(sourceLocale, include, exclude) {
|
|
|
897
897
|
delimiter: pattern.delimiter
|
|
898
898
|
}))
|
|
899
899
|
);
|
|
900
|
-
const excludedPatterns = _optionalChain([exclude, 'optionalAccess',
|
|
900
|
+
const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _44 => _44.flatMap, 'call', _45 => _45(
|
|
901
901
|
(pattern) => expandPlaceholderedGlob(
|
|
902
902
|
pattern.path,
|
|
903
903
|
__spec.resolveOverriddenLocale.call(void 0, sourceLocale, pattern.delimiter)
|
|
@@ -1033,12 +1033,12 @@ function composeLoaders(...loaders) {
|
|
|
1033
1033
|
return {
|
|
1034
1034
|
init: async () => {
|
|
1035
1035
|
for (const loader of loaders) {
|
|
1036
|
-
await _optionalChain([loader, 'access',
|
|
1036
|
+
await _optionalChain([loader, 'access', _46 => _46.init, 'optionalCall', _47 => _47()]);
|
|
1037
1037
|
}
|
|
1038
1038
|
},
|
|
1039
1039
|
setDefaultLocale(locale) {
|
|
1040
1040
|
for (const loader of loaders) {
|
|
1041
|
-
_optionalChain([loader, 'access',
|
|
1041
|
+
_optionalChain([loader, 'access', _48 => _48.setDefaultLocale, 'optionalCall', _49 => _49(locale)]);
|
|
1042
1042
|
}
|
|
1043
1043
|
return this;
|
|
1044
1044
|
},
|
|
@@ -1071,7 +1071,7 @@ function createLoader(lDefinition) {
|
|
|
1071
1071
|
if (state.initCtx) {
|
|
1072
1072
|
return state.initCtx;
|
|
1073
1073
|
}
|
|
1074
|
-
state.initCtx = await _optionalChain([lDefinition, 'access',
|
|
1074
|
+
state.initCtx = await _optionalChain([lDefinition, 'access', _50 => _50.init, 'optionalCall', _51 => _51()]);
|
|
1075
1075
|
return state.initCtx;
|
|
1076
1076
|
},
|
|
1077
1077
|
setDefaultLocale(locale) {
|
|
@@ -1175,7 +1175,7 @@ function createNormalizeLoader() {
|
|
|
1175
1175
|
return normalized;
|
|
1176
1176
|
},
|
|
1177
1177
|
push: async (locale, data, originalInput) => {
|
|
1178
|
-
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess',
|
|
1178
|
+
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _52 => _52.keysMap]), () => ( {}));
|
|
1179
1179
|
const input2 = mapDenormalizedKeys(data, keysMap);
|
|
1180
1180
|
const denormalized = _flat.unflatten.call(void 0, input2, {
|
|
1181
1181
|
delimiter: "/",
|
|
@@ -1249,7 +1249,7 @@ function createTextFileLoader(pathPattern) {
|
|
|
1249
1249
|
const trimmedResult = result.trim();
|
|
1250
1250
|
return trimmedResult;
|
|
1251
1251
|
},
|
|
1252
|
-
async push(locale, data,
|
|
1252
|
+
async push(locale, data, _30, originalLocale) {
|
|
1253
1253
|
const draftPath = pathPattern.replaceAll("[locale]", locale);
|
|
1254
1254
|
const finalPath = path12.default.resolve(draftPath);
|
|
1255
1255
|
const dirPath = path12.default.dirname(finalPath);
|
|
@@ -1278,8 +1278,8 @@ async function getTrailingNewLine(pathPattern, locale, originalLocale) {
|
|
|
1278
1278
|
if (!templateData) {
|
|
1279
1279
|
templateData = await readFileForLocale(pathPattern, originalLocale);
|
|
1280
1280
|
}
|
|
1281
|
-
if (_optionalChain([templateData, 'optionalAccess',
|
|
1282
|
-
const ending = _optionalChain([templateData, 'optionalAccess',
|
|
1281
|
+
if (_optionalChain([templateData, 'optionalAccess', _53 => _53.match, 'call', _54 => _54(/[\r\n]$/)])) {
|
|
1282
|
+
const ending = _optionalChain([templateData, 'optionalAccess', _55 => _55.includes, 'call', _56 => _56("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _57 => _57.includes, 'call', _58 => _58("\r")]) ? "\r" : "\n";
|
|
1283
1283
|
return ending;
|
|
1284
1284
|
}
|
|
1285
1285
|
return "";
|
|
@@ -1621,7 +1621,7 @@ function createHtmlLoader() {
|
|
|
1621
1621
|
break;
|
|
1622
1622
|
}
|
|
1623
1623
|
const siblings = Array.from(parent.childNodes).filter(
|
|
1624
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1624
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _59 => _59.textContent, 'optionalAccess', _60 => _60.trim, 'call', _61 => _61()])
|
|
1625
1625
|
);
|
|
1626
1626
|
const index = siblings.indexOf(current);
|
|
1627
1627
|
if (index !== -1) {
|
|
@@ -1656,11 +1656,11 @@ function createHtmlLoader() {
|
|
|
1656
1656
|
result[getPath(element, attr)] = value;
|
|
1657
1657
|
}
|
|
1658
1658
|
});
|
|
1659
|
-
Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1659
|
+
Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _62 => _62.textContent, 'optionalAccess', _63 => _63.trim, 'call', _64 => _64()])).forEach(processNode);
|
|
1660
1660
|
}
|
|
1661
1661
|
};
|
|
1662
|
-
Array.from(document.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1663
|
-
Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1662
|
+
Array.from(document.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _65 => _65.textContent, 'optionalAccess', _66 => _66.trim, 'call', _67 => _67()])).forEach(processNode);
|
|
1663
|
+
Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _68 => _68.textContent, 'optionalAccess', _69 => _69.trim, 'call', _70 => _70()])).forEach(processNode);
|
|
1664
1664
|
return result;
|
|
1665
1665
|
},
|
|
1666
1666
|
async push(locale, data, originalInput) {
|
|
@@ -1682,7 +1682,7 @@ function createHtmlLoader() {
|
|
|
1682
1682
|
for (let i = 0; i < indices.length; i++) {
|
|
1683
1683
|
const index = parseInt(indices[i]);
|
|
1684
1684
|
const siblings = Array.from(parent.childNodes).filter(
|
|
1685
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1685
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _71 => _71.textContent, 'optionalAccess', _72 => _72.trim, 'call', _73 => _73()])
|
|
1686
1686
|
);
|
|
1687
1687
|
if (index >= siblings.length) {
|
|
1688
1688
|
if (i === indices.length - 1) {
|
|
@@ -1733,7 +1733,7 @@ function createMarkdownLoader() {
|
|
|
1733
1733
|
yaml: yamlEngine
|
|
1734
1734
|
}
|
|
1735
1735
|
});
|
|
1736
|
-
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess',
|
|
1736
|
+
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _74 => _74.trim, 'call', _75 => _75()]), () => ( ""))).filter(Boolean);
|
|
1737
1737
|
return {
|
|
1738
1738
|
...Object.fromEntries(
|
|
1739
1739
|
sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
|
|
@@ -1745,7 +1745,7 @@ function createMarkdownLoader() {
|
|
|
1745
1745
|
const frontmatter = Object.fromEntries(
|
|
1746
1746
|
Object.entries(data).filter(([key]) => key.startsWith(FM_ATTR_PREFIX)).map(([key, value]) => [key.replace(FM_ATTR_PREFIX, ""), value])
|
|
1747
1747
|
);
|
|
1748
|
-
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',
|
|
1748
|
+
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', _76 => _76.trim, 'call', _77 => _77()]), () => ( ""))).filter(Boolean).join("\n\n");
|
|
1749
1749
|
if (Object.keys(frontmatter).length > 0) {
|
|
1750
1750
|
content = `
|
|
1751
1751
|
${content}`;
|
|
@@ -1778,7 +1778,7 @@ function createPropertiesLoader() {
|
|
|
1778
1778
|
return result;
|
|
1779
1779
|
},
|
|
1780
1780
|
async push(locale, payload) {
|
|
1781
|
-
const result = Object.entries(payload).filter(([
|
|
1781
|
+
const result = Object.entries(payload).filter(([_30, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
|
|
1782
1782
|
return result;
|
|
1783
1783
|
}
|
|
1784
1784
|
});
|
|
@@ -1789,7 +1789,7 @@ function isSkippableLine(line) {
|
|
|
1789
1789
|
function parsePropertyLine(line) {
|
|
1790
1790
|
const [key, ...valueParts] = line.split("=");
|
|
1791
1791
|
return {
|
|
1792
|
-
key: _optionalChain([key, 'optionalAccess',
|
|
1792
|
+
key: _optionalChain([key, 'optionalAccess', _78 => _78.trim, 'call', _79 => _79()]) || "",
|
|
1793
1793
|
value: valueParts.join("=").trim()
|
|
1794
1794
|
};
|
|
1795
1795
|
}
|
|
@@ -1875,7 +1875,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
1875
1875
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
1876
1876
|
continue;
|
|
1877
1877
|
}
|
|
1878
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
1878
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _80 => _80.localizations, 'optionalAccess', _81 => _81[locale]]);
|
|
1879
1879
|
if (langTranslationEntity) {
|
|
1880
1880
|
if ("stringUnit" in langTranslationEntity) {
|
|
1881
1881
|
resultData[translationKey] = langTranslationEntity.stringUnit.value;
|
|
@@ -1884,7 +1884,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
1884
1884
|
resultData[translationKey] = {};
|
|
1885
1885
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
1886
1886
|
for (const form in pluralForms) {
|
|
1887
|
-
if (_optionalChain([pluralForms, 'access',
|
|
1887
|
+
if (_optionalChain([pluralForms, 'access', _82 => _82[form], 'optionalAccess', _83 => _83.stringUnit, 'optionalAccess', _84 => _84.value])) {
|
|
1888
1888
|
resultData[translationKey][form] = pluralForms[form].stringUnit.value;
|
|
1889
1889
|
}
|
|
1890
1890
|
}
|
|
@@ -1907,7 +1907,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
1907
1907
|
const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
|
|
1908
1908
|
if (typeof value === "string") {
|
|
1909
1909
|
langDataToMerge.strings[key] = {
|
|
1910
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
1910
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _85 => _85.strings, 'optionalAccess', _86 => _86[key], 'optionalAccess', _87 => _87.extractionState]),
|
|
1911
1911
|
localizations: {
|
|
1912
1912
|
[locale]: {
|
|
1913
1913
|
stringUnit: {
|
|
@@ -2045,10 +2045,10 @@ function createUnlocalizableLoader(isCacheRestore = false, returnUnlocalizedKeys
|
|
|
2045
2045
|
}
|
|
2046
2046
|
}
|
|
2047
2047
|
return false;
|
|
2048
|
-
}).map(([key,
|
|
2049
|
-
const result = _lodash2.default.omitBy(input2, (
|
|
2048
|
+
}).map(([key, _30]) => key);
|
|
2049
|
+
const result = _lodash2.default.omitBy(input2, (_30, key) => passthroughKeys.includes(key));
|
|
2050
2050
|
if (returnUnlocalizedKeys) {
|
|
2051
|
-
result.unlocalizable = _lodash2.default.omitBy(input2, (
|
|
2051
|
+
result.unlocalizable = _lodash2.default.omitBy(input2, (_30, key) => !passthroughKeys.includes(key));
|
|
2052
2052
|
}
|
|
2053
2053
|
return result;
|
|
2054
2054
|
},
|
|
@@ -2087,7 +2087,7 @@ function createPoDataLoader(params) {
|
|
|
2087
2087
|
Object.entries(entries).forEach(([msgid, entry]) => {
|
|
2088
2088
|
if (msgid && entry.msgid) {
|
|
2089
2089
|
const context = entry.msgctxt || "";
|
|
2090
|
-
const fullEntry = _optionalChain([parsedPo, 'access',
|
|
2090
|
+
const fullEntry = _optionalChain([parsedPo, 'access', _88 => _88.translations, 'access', _89 => _89[context], 'optionalAccess', _90 => _90[msgid]]);
|
|
2091
2091
|
if (fullEntry) {
|
|
2092
2092
|
result[msgid] = fullEntry;
|
|
2093
2093
|
}
|
|
@@ -2097,8 +2097,8 @@ function createPoDataLoader(params) {
|
|
|
2097
2097
|
return result;
|
|
2098
2098
|
},
|
|
2099
2099
|
async push(locale, data, originalInput, originalLocale, pullInput) {
|
|
2100
|
-
const currentSections = _optionalChain([pullInput, 'optionalAccess',
|
|
2101
|
-
const originalSections = _optionalChain([originalInput, 'optionalAccess',
|
|
2100
|
+
const currentSections = _optionalChain([pullInput, 'optionalAccess', _91 => _91.split, 'call', _92 => _92("\n\n"), 'access', _93 => _93.filter, 'call', _94 => _94(Boolean)]) || [];
|
|
2101
|
+
const originalSections = _optionalChain([originalInput, 'optionalAccess', _95 => _95.split, 'call', _96 => _96("\n\n"), 'access', _97 => _97.filter, 'call', _98 => _98(Boolean)]) || [];
|
|
2102
2102
|
const result = originalSections.map((section) => {
|
|
2103
2103
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
2104
2104
|
const contextKey = _lodash2.default.keys(sectionPo.translations)[0];
|
|
@@ -2163,8 +2163,8 @@ function createPoContentLoader() {
|
|
|
2163
2163
|
{
|
|
2164
2164
|
...entry,
|
|
2165
2165
|
msgstr: [
|
|
2166
|
-
_optionalChain([data, 'access',
|
|
2167
|
-
_optionalChain([data, 'access',
|
|
2166
|
+
_optionalChain([data, 'access', _99 => _99[entry.msgid], 'optionalAccess', _100 => _100.singular]),
|
|
2167
|
+
_optionalChain([data, 'access', _101 => _101[entry.msgid], 'optionalAccess', _102 => _102.plural]) || null
|
|
2168
2168
|
].filter(Boolean)
|
|
2169
2169
|
}
|
|
2170
2170
|
]).fromPairs().value();
|
|
@@ -2411,7 +2411,7 @@ function createDatoClient(params) {
|
|
|
2411
2411
|
only_valid: "true",
|
|
2412
2412
|
ids: !records.length ? void 0 : records.join(",")
|
|
2413
2413
|
}
|
|
2414
|
-
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2414
|
+
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _103 => _103.response, 'optionalAccess', _104 => _104.body, 'optionalAccess', _105 => _105.data, 'optionalAccess', _106 => _106[0]]) || error));
|
|
2415
2415
|
},
|
|
2416
2416
|
findRecordsForModel: async (modelId, records) => {
|
|
2417
2417
|
try {
|
|
@@ -2421,9 +2421,9 @@ function createDatoClient(params) {
|
|
|
2421
2421
|
filter: {
|
|
2422
2422
|
type: modelId,
|
|
2423
2423
|
only_valid: "true",
|
|
2424
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
2424
|
+
ids: !_optionalChain([records, 'optionalAccess', _107 => _107.length]) ? void 0 : records.join(",")
|
|
2425
2425
|
}
|
|
2426
|
-
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2426
|
+
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _108 => _108.response, 'optionalAccess', _109 => _109.body, 'optionalAccess', _110 => _110.data, 'optionalAccess', _111 => _111[0]]) || error));
|
|
2427
2427
|
return result;
|
|
2428
2428
|
} catch (_error) {
|
|
2429
2429
|
throw new Error(
|
|
@@ -2437,9 +2437,9 @@ function createDatoClient(params) {
|
|
|
2437
2437
|
},
|
|
2438
2438
|
updateRecord: async (id, payload) => {
|
|
2439
2439
|
try {
|
|
2440
|
-
await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2440
|
+
await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _112 => _112.response, 'optionalAccess', _113 => _113.body, 'optionalAccess', _114 => _114.data, 'optionalAccess', _115 => _115[0]]) || error));
|
|
2441
2441
|
} catch (_error) {
|
|
2442
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2442
|
+
if (_optionalChain([_error, 'optionalAccess', _116 => _116.attributes, 'optionalAccess', _117 => _117.details, 'optionalAccess', _118 => _118.message])) {
|
|
2443
2443
|
throw new Error(
|
|
2444
2444
|
[
|
|
2445
2445
|
`${_error.attributes.details.message}`,
|
|
@@ -2460,9 +2460,9 @@ function createDatoClient(params) {
|
|
|
2460
2460
|
},
|
|
2461
2461
|
enableFieldLocalization: async (args) => {
|
|
2462
2462
|
try {
|
|
2463
|
-
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2463
|
+
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _119 => _119.response, 'optionalAccess', _120 => _120.body, 'optionalAccess', _121 => _121.data, 'optionalAccess', _122 => _122[0]]) || error));
|
|
2464
2464
|
} catch (_error) {
|
|
2465
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2465
|
+
if (_optionalChain([_error, 'optionalAccess', _123 => _123.attributes, 'optionalAccess', _124 => _124.code]) === "NOT_FOUND") {
|
|
2466
2466
|
throw new Error(
|
|
2467
2467
|
[
|
|
2468
2468
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -2470,7 +2470,7 @@ function createDatoClient(params) {
|
|
|
2470
2470
|
].join("\n\n")
|
|
2471
2471
|
);
|
|
2472
2472
|
}
|
|
2473
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2473
|
+
if (_optionalChain([_error, 'optionalAccess', _125 => _125.attributes, 'optionalAccess', _126 => _126.details, 'optionalAccess', _127 => _127.message])) {
|
|
2474
2474
|
throw new Error(
|
|
2475
2475
|
[`${_error.attributes.details.message}`, `Error: ${JSON.stringify(_error, null, 2)}`].join("\n\n")
|
|
2476
2476
|
);
|
|
@@ -2536,7 +2536,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
2536
2536
|
}
|
|
2537
2537
|
}
|
|
2538
2538
|
const records = await dato.findRecordsForModel(modelId);
|
|
2539
|
-
const recordChoices = createRecordChoices(records, _optionalChain([config, 'access',
|
|
2539
|
+
const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _128 => _128.models, 'access', _129 => _129[modelId], 'optionalAccess', _130 => _130.records]) || [], project);
|
|
2540
2540
|
const selectedRecords = await promptRecordSelection(modelName, recordChoices);
|
|
2541
2541
|
result.models[modelId].records = records.filter((record) => selectedRecords.includes(record.id));
|
|
2542
2542
|
updatedConfig.models[modelId].records = selectedRecords;
|
|
@@ -2548,14 +2548,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
2548
2548
|
},
|
|
2549
2549
|
async pull(locale, input2, initCtx) {
|
|
2550
2550
|
const result = {};
|
|
2551
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
2552
|
-
let records = _optionalChain([initCtx, 'optionalAccess',
|
|
2551
|
+
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _131 => _131.models]) || {})) {
|
|
2552
|
+
let records = _optionalChain([initCtx, 'optionalAccess', _132 => _132.models, 'access', _133 => _133[modelId], 'access', _134 => _134.records]) || [];
|
|
2553
2553
|
const recordIds = records.map((record) => record.id);
|
|
2554
2554
|
records = await dato.findRecords(recordIds);
|
|
2555
2555
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
2556
2556
|
if (records.length > 0) {
|
|
2557
2557
|
result[modelId] = {
|
|
2558
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
2558
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _135 => _135.models, 'optionalAccess', _136 => _136[modelId], 'optionalAccess', _137 => _137.fields]) || [],
|
|
2559
2559
|
records
|
|
2560
2560
|
};
|
|
2561
2561
|
}
|
|
@@ -2614,7 +2614,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
2614
2614
|
return records.map((record) => ({
|
|
2615
2615
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
2616
2616
|
value: record.id,
|
|
2617
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
2617
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _138 => _138.includes, 'call', _139 => _139(record.id)])
|
|
2618
2618
|
}));
|
|
2619
2619
|
}
|
|
2620
2620
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -2881,7 +2881,7 @@ var _nodewebvtt = require('node-webvtt'); var _nodewebvtt2 = _interopRequireDefa
|
|
|
2881
2881
|
function createVttLoader() {
|
|
2882
2882
|
return createLoader({
|
|
2883
2883
|
async pull(locale, input2) {
|
|
2884
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
2884
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _140 => _140.parse, 'call', _141 => _141(input2), 'optionalAccess', _142 => _142.cues]);
|
|
2885
2885
|
if (Object.keys(vtt).length === 0) {
|
|
2886
2886
|
return {};
|
|
2887
2887
|
} else {
|
|
@@ -2934,7 +2934,7 @@ function variableExtractLoader(params) {
|
|
|
2934
2934
|
for (let i = 0; i < matches.length; i++) {
|
|
2935
2935
|
const match = matches[i];
|
|
2936
2936
|
const currentValue = result[key].value;
|
|
2937
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
2937
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _143 => _143.replace, 'call', _144 => _144(match, `{variable:${i}}`)]);
|
|
2938
2938
|
result[key].value = newValue;
|
|
2939
2939
|
result[key].variables[i] = match;
|
|
2940
2940
|
}
|
|
@@ -2948,7 +2948,7 @@ function variableExtractLoader(params) {
|
|
|
2948
2948
|
for (let i = 0; i < valueObj.variables.length; i++) {
|
|
2949
2949
|
const variable = valueObj.variables[i];
|
|
2950
2950
|
const currentValue = result[key];
|
|
2951
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
2951
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _145 => _145.replace, 'call', _146 => _146(`{variable:${i}}`, variable)]);
|
|
2952
2952
|
result[key] = newValue;
|
|
2953
2953
|
}
|
|
2954
2954
|
}
|
|
@@ -3131,7 +3131,7 @@ function createVueJsonLoader() {
|
|
|
3131
3131
|
return createLoader({
|
|
3132
3132
|
pull: async (locale, input2, ctx) => {
|
|
3133
3133
|
const parsed = parseVueFile(input2);
|
|
3134
|
-
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess',
|
|
3134
|
+
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _147 => _147.i18n, 'optionalAccess', _148 => _148[locale]]), () => ( {}));
|
|
3135
3135
|
},
|
|
3136
3136
|
push: async (locale, data, originalInput) => {
|
|
3137
3137
|
const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
|
|
@@ -3312,7 +3312,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
|
|
|
3312
3312
|
objectExpression.properties.forEach((prop) => {
|
|
3313
3313
|
if (!t.isObjectProperty(prop)) return;
|
|
3314
3314
|
const key = getPropertyKey(prop);
|
|
3315
|
-
const incomingVal = _optionalChain([data, 'optionalAccess',
|
|
3315
|
+
const incomingVal = _optionalChain([data, 'optionalAccess', _149 => _149[key]]);
|
|
3316
3316
|
if (incomingVal === void 0) {
|
|
3317
3317
|
return;
|
|
3318
3318
|
}
|
|
@@ -3348,7 +3348,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
|
|
|
3348
3348
|
let modified = false;
|
|
3349
3349
|
arrayExpression.elements.forEach((element, index) => {
|
|
3350
3350
|
if (!element) return;
|
|
3351
|
-
const incomingVal = _optionalChain([incoming, 'optionalAccess',
|
|
3351
|
+
const incomingVal = _optionalChain([incoming, 'optionalAccess', _150 => _150[index]]);
|
|
3352
3352
|
if (incomingVal === void 0) return;
|
|
3353
3353
|
if (t.isStringLiteral(element) && typeof incomingVal === "string") {
|
|
3354
3354
|
if (element.value !== incomingVal) {
|
|
@@ -3624,7 +3624,7 @@ function createMdxSectionsSplit2Loader() {
|
|
|
3624
3624
|
const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
|
|
3625
3625
|
const result = {
|
|
3626
3626
|
frontmatter: data.frontmatter,
|
|
3627
|
-
codePlaceholders: _optionalChain([pullInput, 'optionalAccess',
|
|
3627
|
+
codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _151 => _151.codePlaceholders]) || {},
|
|
3628
3628
|
content
|
|
3629
3629
|
};
|
|
3630
3630
|
return result;
|
|
@@ -4005,8 +4005,24 @@ function createLingoLocalizer(params) {
|
|
|
4005
4005
|
|
|
4006
4006
|
// src/cli/processor/basic.ts
|
|
4007
4007
|
var _ai = require('ai');
|
|
4008
|
+
|
|
4008
4009
|
function createBasicTranslator(model, systemPrompt) {
|
|
4009
4010
|
return async (input2, onProgress) => {
|
|
4011
|
+
const chunks = extractPayloadChunks(input2.processableData);
|
|
4012
|
+
const subResults = [];
|
|
4013
|
+
for (let i = 0; i < chunks.length; i++) {
|
|
4014
|
+
const chunk = chunks[i];
|
|
4015
|
+
const result2 = await doJob({
|
|
4016
|
+
...input2,
|
|
4017
|
+
processableData: chunk
|
|
4018
|
+
});
|
|
4019
|
+
subResults.push(result2);
|
|
4020
|
+
onProgress(i / chunks.length * 100, chunk, result2);
|
|
4021
|
+
}
|
|
4022
|
+
const result = _lodash2.default.merge({}, ...subResults);
|
|
4023
|
+
return result;
|
|
4024
|
+
};
|
|
4025
|
+
async function doJob(input2) {
|
|
4010
4026
|
if (!Object.keys(input2.processableData).length) {
|
|
4011
4027
|
return input2.processableData;
|
|
4012
4028
|
}
|
|
@@ -4051,8 +4067,42 @@ function createBasicTranslator(model, systemPrompt) {
|
|
|
4051
4067
|
]
|
|
4052
4068
|
});
|
|
4053
4069
|
const result = JSON.parse(response.text);
|
|
4054
|
-
return _optionalChain([result, 'optionalAccess',
|
|
4055
|
-
}
|
|
4070
|
+
return _optionalChain([result, 'optionalAccess', _152 => _152.data]) || {};
|
|
4071
|
+
}
|
|
4072
|
+
}
|
|
4073
|
+
function extractPayloadChunks(payload) {
|
|
4074
|
+
const idealBatchItemSize = 250;
|
|
4075
|
+
const batchSize = 25;
|
|
4076
|
+
const result = [];
|
|
4077
|
+
let currentChunk = {};
|
|
4078
|
+
let currentChunkItemCount = 0;
|
|
4079
|
+
const payloadEntries = Object.entries(payload);
|
|
4080
|
+
for (let i = 0; i < payloadEntries.length; i++) {
|
|
4081
|
+
const [key, value] = payloadEntries[i];
|
|
4082
|
+
currentChunk[key] = value;
|
|
4083
|
+
currentChunkItemCount++;
|
|
4084
|
+
const currentChunkSize = countWordsInRecord(currentChunk);
|
|
4085
|
+
if (currentChunkSize > idealBatchItemSize || currentChunkItemCount >= batchSize || i === payloadEntries.length - 1) {
|
|
4086
|
+
result.push(currentChunk);
|
|
4087
|
+
currentChunk = {};
|
|
4088
|
+
currentChunkItemCount = 0;
|
|
4089
|
+
}
|
|
4090
|
+
}
|
|
4091
|
+
return result;
|
|
4092
|
+
}
|
|
4093
|
+
function countWordsInRecord(payload) {
|
|
4094
|
+
if (Array.isArray(payload)) {
|
|
4095
|
+
return payload.reduce((acc, item) => acc + countWordsInRecord(item), 0);
|
|
4096
|
+
} else if (typeof payload === "object" && payload !== null) {
|
|
4097
|
+
return Object.values(payload).reduce(
|
|
4098
|
+
(acc, item) => acc + countWordsInRecord(item),
|
|
4099
|
+
0
|
|
4100
|
+
);
|
|
4101
|
+
} else if (typeof payload === "string") {
|
|
4102
|
+
return payload.trim().split(/\s+/).filter(Boolean).length;
|
|
4103
|
+
} else {
|
|
4104
|
+
return 0;
|
|
4105
|
+
}
|
|
4056
4106
|
}
|
|
4057
4107
|
|
|
4058
4108
|
// src/cli/processor/index.ts
|
|
@@ -4099,7 +4149,7 @@ function getPureModelProvider(provider) {
|
|
|
4099
4149
|
|
|
4100
4150
|
${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
|
|
4101
4151
|
`;
|
|
4102
|
-
switch (_optionalChain([provider, 'optionalAccess',
|
|
4152
|
+
switch (_optionalChain([provider, 'optionalAccess', _153 => _153.id])) {
|
|
4103
4153
|
case "openai":
|
|
4104
4154
|
if (!process.env.OPENAI_API_KEY) {
|
|
4105
4155
|
throw new Error(
|
|
@@ -4120,7 +4170,7 @@ function getPureModelProvider(provider) {
|
|
|
4120
4170
|
apiKey: process.env.ANTHROPIC_API_KEY
|
|
4121
4171
|
})(provider.model);
|
|
4122
4172
|
default:
|
|
4123
|
-
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess',
|
|
4173
|
+
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _154 => _154.id])));
|
|
4124
4174
|
}
|
|
4125
4175
|
}
|
|
4126
4176
|
|
|
@@ -4344,7 +4394,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
4344
4394
|
validateParams(i18nConfig, flags);
|
|
4345
4395
|
ora.succeed("Localization configuration is valid");
|
|
4346
4396
|
ora.start("Connecting to Lingo.dev Localization Engine...");
|
|
4347
|
-
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess',
|
|
4397
|
+
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _155 => _155.provider]);
|
|
4348
4398
|
if (isByokMode) {
|
|
4349
4399
|
authId = null;
|
|
4350
4400
|
ora.succeed("Using external provider (BYOK mode)");
|
|
@@ -4358,16 +4408,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
4358
4408
|
flags
|
|
4359
4409
|
});
|
|
4360
4410
|
let buckets = getBuckets(i18nConfig);
|
|
4361
|
-
if (_optionalChain([flags, 'access',
|
|
4411
|
+
if (_optionalChain([flags, 'access', _156 => _156.bucket, 'optionalAccess', _157 => _157.length])) {
|
|
4362
4412
|
buckets = buckets.filter(
|
|
4363
4413
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
4364
4414
|
);
|
|
4365
4415
|
}
|
|
4366
4416
|
ora.succeed("Buckets retrieved");
|
|
4367
|
-
if (_optionalChain([flags, 'access',
|
|
4417
|
+
if (_optionalChain([flags, 'access', _158 => _158.file, 'optionalAccess', _159 => _159.length])) {
|
|
4368
4418
|
buckets = buckets.map((bucket) => {
|
|
4369
4419
|
const paths = bucket.paths.filter(
|
|
4370
|
-
(path16) => flags.file.find((file) => _optionalChain([path16, 'access',
|
|
4420
|
+
(path16) => flags.file.find((file) => _optionalChain([path16, 'access', _160 => _160.pathPattern, 'optionalAccess', _161 => _161.includes, 'call', _162 => _162(file)]))
|
|
4371
4421
|
);
|
|
4372
4422
|
return { ...bucket, paths };
|
|
4373
4423
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -4386,7 +4436,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
4386
4436
|
});
|
|
4387
4437
|
}
|
|
4388
4438
|
}
|
|
4389
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
4439
|
+
const targetLocales = _optionalChain([flags, 'access', _163 => _163.locale, 'optionalAccess', _164 => _164.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
4390
4440
|
ora.start("Setting up localization cache...");
|
|
4391
4441
|
const checkLockfileProcessor = createDeltaProcessor("");
|
|
4392
4442
|
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
@@ -4560,7 +4610,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
4560
4610
|
if (flags.key) {
|
|
4561
4611
|
processableData = _lodash2.default.pickBy(
|
|
4562
4612
|
processableData,
|
|
4563
|
-
(
|
|
4613
|
+
(_30, key) => key === flags.key
|
|
4564
4614
|
);
|
|
4565
4615
|
}
|
|
4566
4616
|
if (flags.verbose) {
|
|
@@ -4730,12 +4780,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
4730
4780
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
4731
4781
|
docUrl: "bucketNotFound"
|
|
4732
4782
|
});
|
|
4733
|
-
} else if (_optionalChain([flags, 'access',
|
|
4783
|
+
} else if (_optionalChain([flags, 'access', _165 => _165.locale, 'optionalAccess', _166 => _166.some, 'call', _167 => _167((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
4734
4784
|
throw new CLIError({
|
|
4735
4785
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
4736
4786
|
docUrl: "localeTargetNotFound"
|
|
4737
4787
|
});
|
|
4738
|
-
} else if (_optionalChain([flags, 'access',
|
|
4788
|
+
} else if (_optionalChain([flags, 'access', _168 => _168.bucket, 'optionalAccess', _169 => _169.some, 'call', _170 => _170(
|
|
4739
4789
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
4740
4790
|
)])) {
|
|
4741
4791
|
throw new CLIError({
|
|
@@ -5063,7 +5113,7 @@ var _stdiojs = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
|
5063
5113
|
var _mcpjs = require('@modelcontextprotocol/sdk/server/mcp.js');
|
|
5064
5114
|
|
|
5065
5115
|
|
|
5066
|
-
var mcp_default = new (0, _interactivecommander.Command)().command("mcp").description("Use Lingo.dev model context provider with your AI agent").helpOption("-h, --help", "Show help").action(async (
|
|
5116
|
+
var mcp_default = new (0, _interactivecommander.Command)().command("mcp").description("Use Lingo.dev model context provider with your AI agent").helpOption("-h, --help", "Show help").action(async (_30, program) => {
|
|
5067
5117
|
const apiKey = program.args[0];
|
|
5068
5118
|
const settings = getSettings(apiKey);
|
|
5069
5119
|
if (!settings.auth.apiKey) {
|
|
@@ -5200,7 +5250,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
5200
5250
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
5201
5251
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
5202
5252
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
5203
|
-
_optionalChain([this, 'access',
|
|
5253
|
+
_optionalChain([this, 'access', _171 => _171.platformKit, 'optionalAccess', _172 => _172.gitConfig, 'call', _173 => _173()]);
|
|
5204
5254
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
5205
5255
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
5206
5256
|
if (!processOwnCommits) {
|
|
@@ -5232,7 +5282,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
5232
5282
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
5233
5283
|
var PullRequestFlow = class extends InBranchFlow {
|
|
5234
5284
|
async preRun() {
|
|
5235
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
5285
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _174 => _174()]);
|
|
5236
5286
|
if (!canContinue) {
|
|
5237
5287
|
return false;
|
|
5238
5288
|
}
|
|
@@ -5484,10 +5534,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
5484
5534
|
repo_slug: this.platformConfig.repositoryName,
|
|
5485
5535
|
state: "OPEN"
|
|
5486
5536
|
}).then(({ data: { values } }) => {
|
|
5487
|
-
return _optionalChain([values, 'optionalAccess',
|
|
5488
|
-
({ source, destination }) => _optionalChain([source, 'optionalAccess',
|
|
5537
|
+
return _optionalChain([values, 'optionalAccess', _175 => _175.find, 'call', _176 => _176(
|
|
5538
|
+
({ source, destination }) => _optionalChain([source, 'optionalAccess', _177 => _177.branch, 'optionalAccess', _178 => _178.name]) === branch && _optionalChain([destination, 'optionalAccess', _179 => _179.branch, 'optionalAccess', _180 => _180.name]) === this.platformConfig.baseBranchName
|
|
5489
5539
|
)]);
|
|
5490
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
5540
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _181 => _181.id]));
|
|
5491
5541
|
}
|
|
5492
5542
|
async closePullRequest({ pullRequestNumber }) {
|
|
5493
5543
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -5583,7 +5633,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
5583
5633
|
repo: this.platformConfig.repositoryName,
|
|
5584
5634
|
base: this.platformConfig.baseBranchName,
|
|
5585
5635
|
state: "open"
|
|
5586
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
5636
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _182 => _182.number]));
|
|
5587
5637
|
}
|
|
5588
5638
|
async closePullRequest({ pullRequestNumber }) {
|
|
5589
5639
|
await this.octokit.rest.pulls.update({
|
|
@@ -5710,7 +5760,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
5710
5760
|
sourceBranch: branch,
|
|
5711
5761
|
state: "opened"
|
|
5712
5762
|
});
|
|
5713
|
-
return _optionalChain([mergeRequests, 'access',
|
|
5763
|
+
return _optionalChain([mergeRequests, 'access', _183 => _183[0], 'optionalAccess', _184 => _184.iid]);
|
|
5714
5764
|
}
|
|
5715
5765
|
async closePullRequest({
|
|
5716
5766
|
pullRequestNumber
|
|
@@ -5794,7 +5844,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
5794
5844
|
}
|
|
5795
5845
|
const env = {
|
|
5796
5846
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
5797
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
5847
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _185 => _185.pullRequest, 'optionalAccess', _186 => _186.toString, 'call', _187 => _187()]) || "false",
|
|
5798
5848
|
...options.commitMessage && {
|
|
5799
5849
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
5800
5850
|
},
|
|
@@ -5814,7 +5864,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
5814
5864
|
const { isPullRequestMode } = platformKit.config;
|
|
5815
5865
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
5816
5866
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
5817
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
5867
|
+
const canRun = await _optionalChain([flow, 'access', _188 => _188.preRun, 'optionalCall', _189 => _189()]);
|
|
5818
5868
|
if (canRun === false) {
|
|
5819
5869
|
return;
|
|
5820
5870
|
}
|
|
@@ -5822,7 +5872,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
5822
5872
|
if (!hasChanges) {
|
|
5823
5873
|
return;
|
|
5824
5874
|
}
|
|
5825
|
-
await _optionalChain([flow, 'access',
|
|
5875
|
+
await _optionalChain([flow, 'access', _190 => _190.postRun, 'optionalCall', _191 => _191()]);
|
|
5826
5876
|
});
|
|
5827
5877
|
|
|
5828
5878
|
// src/cli/cmd/status.ts
|
|
@@ -5866,13 +5916,13 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
5866
5916
|
flags
|
|
5867
5917
|
});
|
|
5868
5918
|
let buckets = getBuckets(i18nConfig);
|
|
5869
|
-
if (_optionalChain([flags, 'access',
|
|
5919
|
+
if (_optionalChain([flags, 'access', _192 => _192.bucket, 'optionalAccess', _193 => _193.length])) {
|
|
5870
5920
|
buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
|
|
5871
5921
|
}
|
|
5872
5922
|
ora.succeed("Buckets retrieved");
|
|
5873
|
-
if (_optionalChain([flags, 'access',
|
|
5923
|
+
if (_optionalChain([flags, 'access', _194 => _194.file, 'optionalAccess', _195 => _195.length])) {
|
|
5874
5924
|
buckets = buckets.map((bucket) => {
|
|
5875
|
-
const paths = bucket.paths.filter((path16) => flags.file.find((file) => _optionalChain([path16, 'access',
|
|
5925
|
+
const paths = bucket.paths.filter((path16) => flags.file.find((file) => _optionalChain([path16, 'access', _196 => _196.pathPattern, 'optionalAccess', _197 => _197.match, 'call', _198 => _198(file)])));
|
|
5876
5926
|
return { ...bucket, paths };
|
|
5877
5927
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
5878
5928
|
if (buckets.length === 0) {
|
|
@@ -5888,7 +5938,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
5888
5938
|
});
|
|
5889
5939
|
}
|
|
5890
5940
|
}
|
|
5891
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
5941
|
+
const targetLocales = _optionalChain([flags, 'access', _199 => _199.locale, 'optionalAccess', _200 => _200.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
5892
5942
|
let totalSourceKeyCount = 0;
|
|
5893
5943
|
let uniqueKeysToTranslate = 0;
|
|
5894
5944
|
let totalExistingTranslations = 0;
|
|
@@ -6229,12 +6279,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
6229
6279
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
6230
6280
|
docUrl: "bucketNotFound"
|
|
6231
6281
|
});
|
|
6232
|
-
} else if (_optionalChain([flags, 'access',
|
|
6282
|
+
} else if (_optionalChain([flags, 'access', _201 => _201.locale, 'optionalAccess', _202 => _202.some, 'call', _203 => _203((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
6233
6283
|
throw new CLIError({
|
|
6234
6284
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
6235
6285
|
docUrl: "localeTargetNotFound"
|
|
6236
6286
|
});
|
|
6237
|
-
} else if (_optionalChain([flags, 'access',
|
|
6287
|
+
} else if (_optionalChain([flags, 'access', _204 => _204.bucket, 'optionalAccess', _205 => _205.some, 'call', _206 => _206((bucket) => !i18nConfig.buckets[bucket])])) {
|
|
6238
6288
|
throw new CLIError({
|
|
6239
6289
|
message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
|
|
6240
6290
|
docUrl: "bucketNotFound"
|
|
@@ -6317,7 +6367,7 @@ async function renderHero() {
|
|
|
6317
6367
|
// package.json
|
|
6318
6368
|
var package_default = {
|
|
6319
6369
|
name: "lingo.dev",
|
|
6320
|
-
version: "0.92.
|
|
6370
|
+
version: "0.92.15",
|
|
6321
6371
|
description: "Lingo.dev CLI",
|
|
6322
6372
|
private: false,
|
|
6323
6373
|
publishConfig: {
|
|
@@ -6532,7 +6582,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
|
|
|
6532
6582
|
const response = await engine.whoami();
|
|
6533
6583
|
return {
|
|
6534
6584
|
authenticated: !!response,
|
|
6535
|
-
username: _optionalChain([response, 'optionalAccess',
|
|
6585
|
+
username: _optionalChain([response, 'optionalAccess', _207 => _207.email])
|
|
6536
6586
|
};
|
|
6537
6587
|
} catch (e3) {
|
|
6538
6588
|
return { authenticated: false };
|
|
@@ -6565,6 +6615,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
|
|
|
6565
6615
|
|
|
6566
6616
|
|
|
6567
6617
|
|
|
6618
|
+
|
|
6568
6619
|
function createExplicitLocalizer(provider) {
|
|
6569
6620
|
switch (provider.id) {
|
|
6570
6621
|
default:
|
|
@@ -6674,7 +6725,12 @@ function createAiSdkLocalizer(params) {
|
|
|
6674
6725
|
]
|
|
6675
6726
|
});
|
|
6676
6727
|
const result = JSON.parse(response.text);
|
|
6677
|
-
|
|
6728
|
+
const index = result.data.indexOf("{");
|
|
6729
|
+
const lastIndex = result.data.lastIndexOf("}");
|
|
6730
|
+
const trimmed = result.data.slice(index, lastIndex + 1);
|
|
6731
|
+
const repaired = _jsonrepair.jsonrepair.call(void 0, trimmed);
|
|
6732
|
+
const finalResult = JSON.parse(repaired);
|
|
6733
|
+
return finalResult.data;
|
|
6678
6734
|
}
|
|
6679
6735
|
};
|
|
6680
6736
|
}
|
|
@@ -6711,14 +6767,14 @@ async function setup(input2) {
|
|
|
6711
6767
|
throw new Error(
|
|
6712
6768
|
"No buckets found in i18n.json. Please add at least one bucket containing i18n content."
|
|
6713
6769
|
);
|
|
6714
|
-
} else if (_optionalChain([ctx, 'access',
|
|
6715
|
-
(locale) => !_optionalChain([ctx, 'access',
|
|
6770
|
+
} else if (_optionalChain([ctx, 'access', _208 => _208.flags, 'access', _209 => _209.locale, 'optionalAccess', _210 => _210.some, 'call', _211 => _211(
|
|
6771
|
+
(locale) => !_optionalChain([ctx, 'access', _212 => _212.config, 'optionalAccess', _213 => _213.locale, 'access', _214 => _214.targets, 'access', _215 => _215.includes, 'call', _216 => _216(locale)])
|
|
6716
6772
|
)])) {
|
|
6717
6773
|
throw new Error(
|
|
6718
6774
|
`One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list first and try again.`
|
|
6719
6775
|
);
|
|
6720
|
-
} else if (_optionalChain([ctx, 'access',
|
|
6721
|
-
(bucket) => !_optionalChain([ctx, 'access',
|
|
6776
|
+
} else if (_optionalChain([ctx, 'access', _217 => _217.flags, 'access', _218 => _218.bucket, 'optionalAccess', _219 => _219.some, 'call', _220 => _220(
|
|
6777
|
+
(bucket) => !_optionalChain([ctx, 'access', _221 => _221.config, 'optionalAccess', _222 => _222.buckets, 'access', _223 => _223[bucket]])
|
|
6722
6778
|
)])) {
|
|
6723
6779
|
throw new Error(
|
|
6724
6780
|
`One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
|
|
@@ -6730,7 +6786,7 @@ async function setup(input2) {
|
|
|
6730
6786
|
{
|
|
6731
6787
|
title: "Selecting localization provider",
|
|
6732
6788
|
task: async (ctx, task) => {
|
|
6733
|
-
ctx.localizer = createLocalizer(_optionalChain([ctx, 'access',
|
|
6789
|
+
ctx.localizer = createLocalizer(_optionalChain([ctx, 'access', _224 => _224.config, 'optionalAccess', _225 => _225.provider]));
|
|
6734
6790
|
if (!ctx.localizer) {
|
|
6735
6791
|
throw new Error(
|
|
6736
6792
|
"Could not create localization provider. Please check your i18n.json configuration."
|
|
@@ -6916,7 +6972,7 @@ async function execute(input2) {
|
|
|
6916
6972
|
const workerTasks = [];
|
|
6917
6973
|
for (let i = 0; i < workersCount; i++) {
|
|
6918
6974
|
const assignedTasks = ctx.tasks.filter(
|
|
6919
|
-
(
|
|
6975
|
+
(_30, idx) => idx % workersCount === i
|
|
6920
6976
|
);
|
|
6921
6977
|
workerTasks.push(
|
|
6922
6978
|
createWorkerTask({
|
|
@@ -7162,11 +7218,17 @@ async function waitForUserPrompt(message) {
|
|
|
7162
7218
|
}
|
|
7163
7219
|
async function renderSummary(ctx) {
|
|
7164
7220
|
console.log(_chalk2.default.hex(colors.green)("[Done]"));
|
|
7165
|
-
const skippedTasksCount = ctx.results.values().filter(
|
|
7221
|
+
const skippedTasksCount = Array.from(ctx.results.values()).filter(
|
|
7222
|
+
(r) => r.status === "skipped"
|
|
7223
|
+
).length;
|
|
7166
7224
|
console.log(`\u2022 ${_chalk2.default.hex(colors.yellow)(skippedTasksCount)} from cache`);
|
|
7167
|
-
const succeededTasksCount = ctx.results.values().filter(
|
|
7225
|
+
const succeededTasksCount = Array.from(ctx.results.values()).filter(
|
|
7226
|
+
(r) => r.status === "success"
|
|
7227
|
+
).length;
|
|
7168
7228
|
console.log(`\u2022 ${_chalk2.default.hex(colors.yellow)(succeededTasksCount)} processed`);
|
|
7169
|
-
const failedTasksCount = ctx.results.values().filter(
|
|
7229
|
+
const failedTasksCount = Array.from(ctx.results.values()).filter(
|
|
7230
|
+
(r) => r.status === "error"
|
|
7231
|
+
).length;
|
|
7170
7232
|
console.log(`\u2022 ${_chalk2.default.hex(colors.yellow)(failedTasksCount)} failed`);
|
|
7171
7233
|
}
|
|
7172
7234
|
|