lingo.dev 0.81.0 → 0.82.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 +156 -109
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +115 -68
- 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', _25 => _25.auth, 'optionalAccess', _26 => _26.apiKey]) || defaults.auth.apiKey,
|
|
30
|
+
apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _27 => _27.auth, 'optionalAccess', _28 => _28.apiUrl]) || defaults.auth.apiUrl,
|
|
31
|
+
webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _29 => _29.auth, 'optionalAccess', _30 => _30.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', _31 => _31.auth, 'optionalAccess', _32 => _32.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', _33 => _33.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', _34 => _34.email])}`);
|
|
778
778
|
} else {
|
|
779
779
|
_ora2.default.call(void 0, ).fail("Authentication failed.");
|
|
780
780
|
}
|
|
@@ -854,7 +854,7 @@ var locale_default = new (0, _interactivecommander.Command)().command("locale").
|
|
|
854
854
|
function getBuckets(i18nConfig) {
|
|
855
855
|
const result = Object.entries(i18nConfig.buckets).map(([bucketType, bucketEntry]) => {
|
|
856
856
|
const includeItems = bucketEntry.include.map((item) => resolveBucketItem(item));
|
|
857
|
-
const excludeItems = _optionalChain([bucketEntry, 'access',
|
|
857
|
+
const excludeItems = _optionalChain([bucketEntry, 'access', _35 => _35.exclude, 'optionalAccess', _36 => _36.map, 'call', _37 => _37((item) => resolveBucketItem(item))]);
|
|
858
858
|
const config = {
|
|
859
859
|
type: bucketType,
|
|
860
860
|
paths: extractPathPatterns(i18nConfig.locale.source, includeItems, excludeItems)
|
|
@@ -862,6 +862,9 @@ function getBuckets(i18nConfig) {
|
|
|
862
862
|
if (bucketEntry.injectLocale) {
|
|
863
863
|
config.injectLocale = bucketEntry.injectLocale;
|
|
864
864
|
}
|
|
865
|
+
if (bucketEntry.lockedKeys) {
|
|
866
|
+
config.lockedKeys = bucketEntry.lockedKeys;
|
|
867
|
+
}
|
|
865
868
|
return config;
|
|
866
869
|
});
|
|
867
870
|
return result;
|
|
@@ -875,7 +878,7 @@ function extractPathPatterns(sourceLocale, include, exclude) {
|
|
|
875
878
|
})
|
|
876
879
|
)
|
|
877
880
|
);
|
|
878
|
-
const excludedPatterns = _optionalChain([exclude, 'optionalAccess',
|
|
881
|
+
const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _38 => _38.flatMap, 'call', _39 => _39(
|
|
879
882
|
(pattern) => expandPlaceholderedGlob(pattern.path, __spec.resolveOverriddenLocale.call(void 0, sourceLocale, pattern.delimiter)).map(
|
|
880
883
|
(pathPattern) => ({
|
|
881
884
|
pathPattern,
|
|
@@ -1000,12 +1003,12 @@ function composeLoaders(...loaders) {
|
|
|
1000
1003
|
return {
|
|
1001
1004
|
init: async () => {
|
|
1002
1005
|
for (const loader of loaders) {
|
|
1003
|
-
await _optionalChain([loader, 'access',
|
|
1006
|
+
await _optionalChain([loader, 'access', _40 => _40.init, 'optionalCall', _41 => _41()]);
|
|
1004
1007
|
}
|
|
1005
1008
|
},
|
|
1006
1009
|
setDefaultLocale(locale) {
|
|
1007
1010
|
for (const loader of loaders) {
|
|
1008
|
-
_optionalChain([loader, 'access',
|
|
1011
|
+
_optionalChain([loader, 'access', _42 => _42.setDefaultLocale, 'optionalCall', _43 => _43(locale)]);
|
|
1009
1012
|
}
|
|
1010
1013
|
return this;
|
|
1011
1014
|
},
|
|
@@ -1036,7 +1039,7 @@ function createLoader(lDefinition) {
|
|
|
1036
1039
|
if (state.initCtx) {
|
|
1037
1040
|
return state.initCtx;
|
|
1038
1041
|
}
|
|
1039
|
-
state.initCtx = await _optionalChain([lDefinition, 'access',
|
|
1042
|
+
state.initCtx = await _optionalChain([lDefinition, 'access', _44 => _44.init, 'optionalCall', _45 => _45()]);
|
|
1040
1043
|
return state.initCtx;
|
|
1041
1044
|
},
|
|
1042
1045
|
setDefaultLocale(locale) {
|
|
@@ -1125,7 +1128,7 @@ function createNormalizeLoader() {
|
|
|
1125
1128
|
return normalized;
|
|
1126
1129
|
},
|
|
1127
1130
|
push: async (locale, data, originalInput) => {
|
|
1128
|
-
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess',
|
|
1131
|
+
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _46 => _46.keysMap]), () => ( {}));
|
|
1129
1132
|
const input2 = mapDenormalizedKeys(data, keysMap);
|
|
1130
1133
|
const denormalized = _flat.unflatten.call(void 0, input2, {
|
|
1131
1134
|
delimiter: "/",
|
|
@@ -1199,7 +1202,7 @@ function createTextFileLoader(pathPattern) {
|
|
|
1199
1202
|
const trimmedResult = result.trim();
|
|
1200
1203
|
return trimmedResult;
|
|
1201
1204
|
},
|
|
1202
|
-
async push(locale, data,
|
|
1205
|
+
async push(locale, data, _24, originalLocale) {
|
|
1203
1206
|
const draftPath = pathPattern.replaceAll("[locale]", locale);
|
|
1204
1207
|
const finalPath = path15.default.resolve(draftPath);
|
|
1205
1208
|
const dirPath = path15.default.dirname(finalPath);
|
|
@@ -1228,8 +1231,8 @@ async function getTrailingNewLine(pathPattern, locale, originalLocale) {
|
|
|
1228
1231
|
if (!templateData) {
|
|
1229
1232
|
templateData = await readFileForLocale(pathPattern, originalLocale);
|
|
1230
1233
|
}
|
|
1231
|
-
if (_optionalChain([templateData, 'optionalAccess',
|
|
1232
|
-
const ending = _optionalChain([templateData, 'optionalAccess',
|
|
1234
|
+
if (_optionalChain([templateData, 'optionalAccess', _47 => _47.match, 'call', _48 => _48(/[\r\n]$/)])) {
|
|
1235
|
+
const ending = _optionalChain([templateData, 'optionalAccess', _49 => _49.includes, 'call', _50 => _50("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _51 => _51.includes, 'call', _52 => _52("\r")]) ? "\r" : "\n";
|
|
1233
1236
|
return ending;
|
|
1234
1237
|
}
|
|
1235
1238
|
return "";
|
|
@@ -1484,7 +1487,7 @@ function createHtmlLoader() {
|
|
|
1484
1487
|
break;
|
|
1485
1488
|
}
|
|
1486
1489
|
const siblings = Array.from(parent.childNodes).filter(
|
|
1487
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1490
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _53 => _53.textContent, 'optionalAccess', _54 => _54.trim, 'call', _55 => _55()])
|
|
1488
1491
|
);
|
|
1489
1492
|
const index = siblings.indexOf(current);
|
|
1490
1493
|
if (index !== -1) {
|
|
@@ -1519,11 +1522,11 @@ function createHtmlLoader() {
|
|
|
1519
1522
|
result[getPath(element, attr)] = value;
|
|
1520
1523
|
}
|
|
1521
1524
|
});
|
|
1522
|
-
Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1525
|
+
Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _56 => _56.textContent, 'optionalAccess', _57 => _57.trim, 'call', _58 => _58()])).forEach(processNode);
|
|
1523
1526
|
}
|
|
1524
1527
|
};
|
|
1525
|
-
Array.from(document.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1526
|
-
Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1528
|
+
Array.from(document.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _59 => _59.textContent, 'optionalAccess', _60 => _60.trim, 'call', _61 => _61()])).forEach(processNode);
|
|
1529
|
+
Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _62 => _62.textContent, 'optionalAccess', _63 => _63.trim, 'call', _64 => _64()])).forEach(processNode);
|
|
1527
1530
|
return result;
|
|
1528
1531
|
},
|
|
1529
1532
|
async push(locale, data, originalInput) {
|
|
@@ -1545,7 +1548,7 @@ function createHtmlLoader() {
|
|
|
1545
1548
|
for (let i = 0; i < indices.length; i++) {
|
|
1546
1549
|
const index = parseInt(indices[i]);
|
|
1547
1550
|
const siblings = Array.from(parent.childNodes).filter(
|
|
1548
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1551
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _65 => _65.textContent, 'optionalAccess', _66 => _66.trim, 'call', _67 => _67()])
|
|
1549
1552
|
);
|
|
1550
1553
|
if (index >= siblings.length) {
|
|
1551
1554
|
if (i === indices.length - 1) {
|
|
@@ -1596,7 +1599,7 @@ function createMarkdownLoader() {
|
|
|
1596
1599
|
yaml: yamlEngine
|
|
1597
1600
|
}
|
|
1598
1601
|
});
|
|
1599
|
-
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess',
|
|
1602
|
+
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _68 => _68.trim, 'call', _69 => _69()]), () => ( ""))).filter(Boolean);
|
|
1600
1603
|
return {
|
|
1601
1604
|
...Object.fromEntries(
|
|
1602
1605
|
sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
|
|
@@ -1608,7 +1611,7 @@ function createMarkdownLoader() {
|
|
|
1608
1611
|
const frontmatter = Object.fromEntries(
|
|
1609
1612
|
Object.entries(data).filter(([key]) => key.startsWith(FM_ATTR_PREFIX)).map(([key, value]) => [key.replace(FM_ATTR_PREFIX, ""), value])
|
|
1610
1613
|
);
|
|
1611
|
-
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',
|
|
1614
|
+
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', _70 => _70.trim, 'call', _71 => _71()]), () => ( ""))).filter(Boolean).join("\n\n");
|
|
1612
1615
|
if (Object.keys(frontmatter).length > 0) {
|
|
1613
1616
|
content = `
|
|
1614
1617
|
${content}`;
|
|
@@ -1641,7 +1644,7 @@ function createPropertiesLoader() {
|
|
|
1641
1644
|
return result;
|
|
1642
1645
|
},
|
|
1643
1646
|
async push(locale, payload) {
|
|
1644
|
-
const result = Object.entries(payload).filter(([
|
|
1647
|
+
const result = Object.entries(payload).filter(([_24, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
|
|
1645
1648
|
return result;
|
|
1646
1649
|
}
|
|
1647
1650
|
});
|
|
@@ -1652,7 +1655,7 @@ function isSkippableLine(line) {
|
|
|
1652
1655
|
function parsePropertyLine(line) {
|
|
1653
1656
|
const [key, ...valueParts] = line.split("=");
|
|
1654
1657
|
return {
|
|
1655
|
-
key: _optionalChain([key, 'optionalAccess',
|
|
1658
|
+
key: _optionalChain([key, 'optionalAccess', _72 => _72.trim, 'call', _73 => _73()]) || "",
|
|
1656
1659
|
value: valueParts.join("=").trim()
|
|
1657
1660
|
};
|
|
1658
1661
|
}
|
|
@@ -1738,7 +1741,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
1738
1741
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
1739
1742
|
continue;
|
|
1740
1743
|
}
|
|
1741
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
1744
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _74 => _74.localizations, 'optionalAccess', _75 => _75[locale]]);
|
|
1742
1745
|
if (langTranslationEntity) {
|
|
1743
1746
|
if ("stringUnit" in langTranslationEntity) {
|
|
1744
1747
|
resultData[translationKey] = langTranslationEntity.stringUnit.value;
|
|
@@ -1747,7 +1750,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
1747
1750
|
resultData[translationKey] = {};
|
|
1748
1751
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
1749
1752
|
for (const form in pluralForms) {
|
|
1750
|
-
if (_optionalChain([pluralForms, 'access',
|
|
1753
|
+
if (_optionalChain([pluralForms, 'access', _76 => _76[form], 'optionalAccess', _77 => _77.stringUnit, 'optionalAccess', _78 => _78.value])) {
|
|
1751
1754
|
resultData[translationKey][form] = pluralForms[form].stringUnit.value;
|
|
1752
1755
|
}
|
|
1753
1756
|
}
|
|
@@ -1771,7 +1774,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
1771
1774
|
const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
|
|
1772
1775
|
if (typeof value === "string") {
|
|
1773
1776
|
langDataToMerge.strings[key] = {
|
|
1774
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
1777
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _79 => _79.strings, 'optionalAccess', _80 => _80[key], 'optionalAccess', _81 => _81.extractionState]),
|
|
1775
1778
|
localizations: {
|
|
1776
1779
|
[locale]: {
|
|
1777
1780
|
stringUnit: {
|
|
@@ -1890,10 +1893,10 @@ function createUnlocalizableLoader(isCacheRestore = false, returnUnlocalizedKeys
|
|
|
1890
1893
|
}
|
|
1891
1894
|
}
|
|
1892
1895
|
return false;
|
|
1893
|
-
}).map(([key,
|
|
1894
|
-
const result = _lodash2.default.omitBy(input2, (
|
|
1896
|
+
}).map(([key, _24]) => key);
|
|
1897
|
+
const result = _lodash2.default.omitBy(input2, (_24, key) => passthroughKeys.includes(key));
|
|
1895
1898
|
if (returnUnlocalizedKeys) {
|
|
1896
|
-
result.unlocalizable = _lodash2.default.omitBy(input2, (
|
|
1899
|
+
result.unlocalizable = _lodash2.default.omitBy(input2, (_24, key) => !passthroughKeys.includes(key));
|
|
1897
1900
|
}
|
|
1898
1901
|
return result;
|
|
1899
1902
|
},
|
|
@@ -1932,7 +1935,7 @@ function createPoDataLoader(params) {
|
|
|
1932
1935
|
Object.entries(entries).forEach(([msgid, entry]) => {
|
|
1933
1936
|
if (msgid && entry.msgid) {
|
|
1934
1937
|
const context = entry.msgctxt || "";
|
|
1935
|
-
const fullEntry = _optionalChain([parsedPo, 'access',
|
|
1938
|
+
const fullEntry = _optionalChain([parsedPo, 'access', _82 => _82.translations, 'access', _83 => _83[context], 'optionalAccess', _84 => _84[msgid]]);
|
|
1936
1939
|
if (fullEntry) {
|
|
1937
1940
|
result[msgid] = fullEntry;
|
|
1938
1941
|
}
|
|
@@ -1942,7 +1945,7 @@ function createPoDataLoader(params) {
|
|
|
1942
1945
|
return result;
|
|
1943
1946
|
},
|
|
1944
1947
|
async push(locale, data, originalInput) {
|
|
1945
|
-
const sections = _optionalChain([originalInput, 'optionalAccess',
|
|
1948
|
+
const sections = _optionalChain([originalInput, 'optionalAccess', _85 => _85.split, 'call', _86 => _86("\n\n"), 'access', _87 => _87.filter, 'call', _88 => _88(Boolean)]) || [];
|
|
1946
1949
|
const result = sections.map((section) => {
|
|
1947
1950
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
1948
1951
|
const contextKey = _lodash2.default.keys(sectionPo.translations)[0];
|
|
@@ -1984,7 +1987,7 @@ function createPoContentLoader() {
|
|
|
1984
1987
|
entry.msgid,
|
|
1985
1988
|
{
|
|
1986
1989
|
...entry,
|
|
1987
|
-
msgstr: [_optionalChain([data, 'access',
|
|
1990
|
+
msgstr: [_optionalChain([data, 'access', _89 => _89[entry.msgid], 'optionalAccess', _90 => _90.singular]), _optionalChain([data, 'access', _91 => _91[entry.msgid], 'optionalAccess', _92 => _92.plural]) || null].filter(Boolean)
|
|
1988
1991
|
}
|
|
1989
1992
|
]).fromPairs().value();
|
|
1990
1993
|
return result;
|
|
@@ -2230,7 +2233,7 @@ function createDatoClient(params) {
|
|
|
2230
2233
|
only_valid: "true",
|
|
2231
2234
|
ids: !records.length ? void 0 : records.join(",")
|
|
2232
2235
|
}
|
|
2233
|
-
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2236
|
+
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _93 => _93.response, 'optionalAccess', _94 => _94.body, 'optionalAccess', _95 => _95.data, 'optionalAccess', _96 => _96[0]]) || error));
|
|
2234
2237
|
},
|
|
2235
2238
|
findRecordsForModel: async (modelId, records) => {
|
|
2236
2239
|
try {
|
|
@@ -2240,9 +2243,9 @@ function createDatoClient(params) {
|
|
|
2240
2243
|
filter: {
|
|
2241
2244
|
type: modelId,
|
|
2242
2245
|
only_valid: "true",
|
|
2243
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
2246
|
+
ids: !_optionalChain([records, 'optionalAccess', _97 => _97.length]) ? void 0 : records.join(",")
|
|
2244
2247
|
}
|
|
2245
|
-
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2248
|
+
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _98 => _98.response, 'optionalAccess', _99 => _99.body, 'optionalAccess', _100 => _100.data, 'optionalAccess', _101 => _101[0]]) || error));
|
|
2246
2249
|
return result;
|
|
2247
2250
|
} catch (_error) {
|
|
2248
2251
|
throw new Error(
|
|
@@ -2256,9 +2259,9 @@ function createDatoClient(params) {
|
|
|
2256
2259
|
},
|
|
2257
2260
|
updateRecord: async (id, payload) => {
|
|
2258
2261
|
try {
|
|
2259
|
-
await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2262
|
+
await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _102 => _102.response, 'optionalAccess', _103 => _103.body, 'optionalAccess', _104 => _104.data, 'optionalAccess', _105 => _105[0]]) || error));
|
|
2260
2263
|
} catch (_error) {
|
|
2261
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2264
|
+
if (_optionalChain([_error, 'optionalAccess', _106 => _106.attributes, 'optionalAccess', _107 => _107.details, 'optionalAccess', _108 => _108.message])) {
|
|
2262
2265
|
throw new Error(
|
|
2263
2266
|
[
|
|
2264
2267
|
`${_error.attributes.details.message}`,
|
|
@@ -2279,9 +2282,9 @@ function createDatoClient(params) {
|
|
|
2279
2282
|
},
|
|
2280
2283
|
enableFieldLocalization: async (args) => {
|
|
2281
2284
|
try {
|
|
2282
|
-
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2285
|
+
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _109 => _109.response, 'optionalAccess', _110 => _110.body, 'optionalAccess', _111 => _111.data, 'optionalAccess', _112 => _112[0]]) || error));
|
|
2283
2286
|
} catch (_error) {
|
|
2284
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2287
|
+
if (_optionalChain([_error, 'optionalAccess', _113 => _113.attributes, 'optionalAccess', _114 => _114.code]) === "NOT_FOUND") {
|
|
2285
2288
|
throw new Error(
|
|
2286
2289
|
[
|
|
2287
2290
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -2289,7 +2292,7 @@ function createDatoClient(params) {
|
|
|
2289
2292
|
].join("\n\n")
|
|
2290
2293
|
);
|
|
2291
2294
|
}
|
|
2292
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2295
|
+
if (_optionalChain([_error, 'optionalAccess', _115 => _115.attributes, 'optionalAccess', _116 => _116.details, 'optionalAccess', _117 => _117.message])) {
|
|
2293
2296
|
throw new Error(
|
|
2294
2297
|
[`${_error.attributes.details.message}`, `Error: ${JSON.stringify(_error, null, 2)}`].join("\n\n")
|
|
2295
2298
|
);
|
|
@@ -2355,7 +2358,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
2355
2358
|
}
|
|
2356
2359
|
}
|
|
2357
2360
|
const records = await dato.findRecordsForModel(modelId);
|
|
2358
|
-
const recordChoices = createRecordChoices(records, _optionalChain([config, 'access',
|
|
2361
|
+
const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _118 => _118.models, 'access', _119 => _119[modelId], 'optionalAccess', _120 => _120.records]) || [], project);
|
|
2359
2362
|
const selectedRecords = await promptRecordSelection(modelName, recordChoices);
|
|
2360
2363
|
result.models[modelId].records = records.filter((record) => selectedRecords.includes(record.id));
|
|
2361
2364
|
updatedConfig.models[modelId].records = selectedRecords;
|
|
@@ -2367,14 +2370,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
2367
2370
|
},
|
|
2368
2371
|
async pull(locale, input2, initCtx) {
|
|
2369
2372
|
const result = {};
|
|
2370
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
2371
|
-
let records = _optionalChain([initCtx, 'optionalAccess',
|
|
2373
|
+
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _121 => _121.models]) || {})) {
|
|
2374
|
+
let records = _optionalChain([initCtx, 'optionalAccess', _122 => _122.models, 'access', _123 => _123[modelId], 'access', _124 => _124.records]) || [];
|
|
2372
2375
|
const recordIds = records.map((record) => record.id);
|
|
2373
2376
|
records = await dato.findRecords(recordIds);
|
|
2374
2377
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
2375
2378
|
if (records.length > 0) {
|
|
2376
2379
|
result[modelId] = {
|
|
2377
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
2380
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _125 => _125.models, 'optionalAccess', _126 => _126[modelId], 'optionalAccess', _127 => _127.fields]) || [],
|
|
2378
2381
|
records
|
|
2379
2382
|
};
|
|
2380
2383
|
}
|
|
@@ -2433,7 +2436,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
2433
2436
|
return records.map((record) => ({
|
|
2434
2437
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
2435
2438
|
value: record.id,
|
|
2436
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
2439
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _128 => _128.includes, 'call', _129 => _129(record.id)])
|
|
2437
2440
|
}));
|
|
2438
2441
|
}
|
|
2439
2442
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -2700,7 +2703,7 @@ var _nodewebvtt = require('node-webvtt'); var _nodewebvtt2 = _interopRequireDefa
|
|
|
2700
2703
|
function createVttLoader() {
|
|
2701
2704
|
return createLoader({
|
|
2702
2705
|
async pull(locale, input2) {
|
|
2703
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
2706
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _130 => _130.parse, 'call', _131 => _131(input2), 'optionalAccess', _132 => _132.cues]);
|
|
2704
2707
|
if (Object.keys(vtt).length === 0) {
|
|
2705
2708
|
return {};
|
|
2706
2709
|
} else {
|
|
@@ -2753,7 +2756,7 @@ function variableExtractLoader(params) {
|
|
|
2753
2756
|
for (let i = 0; i < matches.length; i++) {
|
|
2754
2757
|
const match = matches[i];
|
|
2755
2758
|
const currentValue = result[key].value;
|
|
2756
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
2759
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _133 => _133.replace, 'call', _134 => _134(match, `{variable:${i}}`)]);
|
|
2757
2760
|
result[key].value = newValue;
|
|
2758
2761
|
result[key].variables[i] = match;
|
|
2759
2762
|
}
|
|
@@ -2767,7 +2770,7 @@ function variableExtractLoader(params) {
|
|
|
2767
2770
|
for (let i = 0; i < valueObj.variables.length; i++) {
|
|
2768
2771
|
const variable = valueObj.variables[i];
|
|
2769
2772
|
const currentValue = result[key];
|
|
2770
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
2773
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _135 => _135.replace, 'call', _136 => _136(`{variable:${i}}`, variable)]);
|
|
2771
2774
|
result[key] = newValue;
|
|
2772
2775
|
}
|
|
2773
2776
|
}
|
|
@@ -2948,7 +2951,7 @@ function createVueJsonLoader() {
|
|
|
2948
2951
|
return createLoader({
|
|
2949
2952
|
pull: async (locale, input2, ctx) => {
|
|
2950
2953
|
const parsed = parseVueFile(input2);
|
|
2951
|
-
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess',
|
|
2954
|
+
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _137 => _137.i18n, 'optionalAccess', _138 => _138[locale]]), () => ( {}));
|
|
2952
2955
|
},
|
|
2953
2956
|
push: async (locale, data, originalInput) => {
|
|
2954
2957
|
const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
|
|
@@ -3006,8 +3009,24 @@ function createInjectLocaleLoader(injectLocaleKeys) {
|
|
|
3006
3009
|
});
|
|
3007
3010
|
}
|
|
3008
3011
|
|
|
3012
|
+
// src/cli/loaders/locked-keys.ts
|
|
3013
|
+
|
|
3014
|
+
function createLockedKeysLoader(lockedKeys, isCacheRestore = false) {
|
|
3015
|
+
return createLoader({
|
|
3016
|
+
pull: async (locale, data) => _lodash2.default.chain(data).pickBy((value, key) => !lockedKeys.includes(key)).value(),
|
|
3017
|
+
push: async (locale, data, originalInput) => {
|
|
3018
|
+
const lockedSubObject = _lodash2.default.chain(originalInput).pickBy((value, key) => lockedKeys.includes(key)).value();
|
|
3019
|
+
if (isCacheRestore) {
|
|
3020
|
+
return _lodash2.default.merge({}, data, lockedSubObject);
|
|
3021
|
+
} else {
|
|
3022
|
+
return _lodash2.default.merge({}, originalInput, data, lockedSubObject);
|
|
3023
|
+
}
|
|
3024
|
+
}
|
|
3025
|
+
});
|
|
3026
|
+
}
|
|
3027
|
+
|
|
3009
3028
|
// src/cli/loaders/index.ts
|
|
3010
|
-
function createBucketLoader(bucketType, bucketPathPattern, options) {
|
|
3029
|
+
function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys) {
|
|
3011
3030
|
switch (bucketType) {
|
|
3012
3031
|
default:
|
|
3013
3032
|
throw new Error(`Unsupported bucket type: ${bucketType}`);
|
|
@@ -3042,6 +3061,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options) {
|
|
|
3042
3061
|
createJsonLoader(),
|
|
3043
3062
|
createInjectLocaleLoader(options.injectLocale),
|
|
3044
3063
|
createFlatLoader(),
|
|
3064
|
+
createLockedKeysLoader(lockedKeys || [], options.isCacheRestore),
|
|
3045
3065
|
createSyncLoader(),
|
|
3046
3066
|
createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
|
|
3047
3067
|
);
|
|
@@ -3101,6 +3121,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options) {
|
|
|
3101
3121
|
createPrettierLoader({ parser: "yaml", bucketPathPattern }),
|
|
3102
3122
|
createYamlLoader(),
|
|
3103
3123
|
createFlatLoader(),
|
|
3124
|
+
createLockedKeysLoader(lockedKeys || [], options.isCacheRestore),
|
|
3104
3125
|
createSyncLoader(),
|
|
3105
3126
|
createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
|
|
3106
3127
|
);
|
|
@@ -3331,7 +3352,7 @@ function createBasicTranslator(model, systemPrompt) {
|
|
|
3331
3352
|
]
|
|
3332
3353
|
});
|
|
3333
3354
|
const result = JSON.parse(response.text);
|
|
3334
|
-
return _optionalChain([result, 'optionalAccess',
|
|
3355
|
+
return _optionalChain([result, 'optionalAccess', _139 => _139.data]) || {};
|
|
3335
3356
|
};
|
|
3336
3357
|
}
|
|
3337
3358
|
|
|
@@ -3349,7 +3370,7 @@ function createProcessor(provider, params) {
|
|
|
3349
3370
|
}
|
|
3350
3371
|
}
|
|
3351
3372
|
function getPureModelProvider(provider) {
|
|
3352
|
-
switch (_optionalChain([provider, 'optionalAccess',
|
|
3373
|
+
switch (_optionalChain([provider, 'optionalAccess', _140 => _140.id])) {
|
|
3353
3374
|
case "openai":
|
|
3354
3375
|
if (!process.env.OPENAI_API_KEY) {
|
|
3355
3376
|
throw new Error("OPENAI_API_KEY is not set.");
|
|
@@ -3366,7 +3387,7 @@ function getPureModelProvider(provider) {
|
|
|
3366
3387
|
apiKey: process.env.ANTHROPIC_API_KEY
|
|
3367
3388
|
})(provider.model);
|
|
3368
3389
|
default:
|
|
3369
|
-
throw new Error(`Unsupported provider: ${_optionalChain([provider, 'optionalAccess',
|
|
3390
|
+
throw new Error(`Unsupported provider: ${_optionalChain([provider, 'optionalAccess', _141 => _141.id])}`);
|
|
3370
3391
|
}
|
|
3371
3392
|
}
|
|
3372
3393
|
|
|
@@ -3392,23 +3413,29 @@ async function trackEvent(distinctId, event, properties) {
|
|
|
3392
3413
|
if (process.env.DO_NOT_TRACK) {
|
|
3393
3414
|
return;
|
|
3394
3415
|
}
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3416
|
+
try {
|
|
3417
|
+
const posthog = new (0, _posthognode.PostHog)("phc_eR0iSoQufBxNY36k0f0T15UvHJdTfHlh8rJcxsfhfXk", {
|
|
3418
|
+
host: "https://eu.i.posthog.com",
|
|
3419
|
+
flushAt: 1,
|
|
3420
|
+
flushInterval: 0
|
|
3421
|
+
});
|
|
3422
|
+
await posthog.capture({
|
|
3423
|
+
distinctId,
|
|
3424
|
+
event,
|
|
3425
|
+
properties: {
|
|
3426
|
+
...properties,
|
|
3427
|
+
meta: {
|
|
3428
|
+
version: process.env.npm_package_version,
|
|
3429
|
+
isCi: process.env.CI === "true"
|
|
3430
|
+
}
|
|
3408
3431
|
}
|
|
3432
|
+
});
|
|
3433
|
+
await posthog.shutdown();
|
|
3434
|
+
} catch (error) {
|
|
3435
|
+
if (process.env.DEBUG) {
|
|
3436
|
+
console.error(error);
|
|
3409
3437
|
}
|
|
3410
|
-
}
|
|
3411
|
-
await posthog.shutdown();
|
|
3438
|
+
}
|
|
3412
3439
|
}
|
|
3413
3440
|
|
|
3414
3441
|
// src/cli/utils/delta.ts
|
|
@@ -3562,13 +3589,13 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
3562
3589
|
flags
|
|
3563
3590
|
});
|
|
3564
3591
|
let buckets = getBuckets(i18nConfig);
|
|
3565
|
-
if (_optionalChain([flags, 'access',
|
|
3592
|
+
if (_optionalChain([flags, 'access', _142 => _142.bucket, 'optionalAccess', _143 => _143.length])) {
|
|
3566
3593
|
buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
|
|
3567
3594
|
}
|
|
3568
3595
|
ora.succeed("Buckets retrieved");
|
|
3569
|
-
if (_optionalChain([flags, 'access',
|
|
3596
|
+
if (_optionalChain([flags, 'access', _144 => _144.file, 'optionalAccess', _145 => _145.length])) {
|
|
3570
3597
|
buckets = buckets.map((bucket) => {
|
|
3571
|
-
const paths = bucket.paths.filter((path18) => flags.file.find((file) => _optionalChain([path18, 'access',
|
|
3598
|
+
const paths = bucket.paths.filter((path18) => flags.file.find((file) => _optionalChain([path18, 'access', _146 => _146.pathPattern, 'optionalAccess', _147 => _147.match, 'call', _148 => _148(file)])));
|
|
3572
3599
|
return { ...bucket, paths };
|
|
3573
3600
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
3574
3601
|
if (buckets.length === 0) {
|
|
@@ -3584,7 +3611,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
3584
3611
|
});
|
|
3585
3612
|
}
|
|
3586
3613
|
}
|
|
3587
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
3614
|
+
const targetLocales = _optionalChain([flags, 'access', _149 => _149.locale, 'optionalAccess', _150 => _150.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
3588
3615
|
ora.start("Setting up localization cache...");
|
|
3589
3616
|
const checkLockfileProcessor = createDeltaProcessor("");
|
|
3590
3617
|
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
@@ -3593,11 +3620,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
3593
3620
|
for (const bucket of buckets) {
|
|
3594
3621
|
for (const bucketPath of bucket.paths) {
|
|
3595
3622
|
const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketPath.delimiter);
|
|
3596
|
-
const bucketLoader = createBucketLoader(
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3623
|
+
const bucketLoader = createBucketLoader(
|
|
3624
|
+
bucket.type,
|
|
3625
|
+
bucketPath.pathPattern,
|
|
3626
|
+
{
|
|
3627
|
+
isCacheRestore: false,
|
|
3628
|
+
defaultLocale: sourceLocale,
|
|
3629
|
+
injectLocale: bucket.injectLocale
|
|
3630
|
+
},
|
|
3631
|
+
bucket.lockedKeys
|
|
3632
|
+
);
|
|
3601
3633
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
3602
3634
|
await bucketLoader.init();
|
|
3603
3635
|
const sourceData = await bucketLoader.pull(i18nConfig.locale.source);
|
|
@@ -3673,11 +3705,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
3673
3705
|
const bucketOra = _ora2.default.call(void 0, { indent: 4 });
|
|
3674
3706
|
bucketOra.info(`Processing path: ${bucketPath.pathPattern}`);
|
|
3675
3707
|
const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketPath.delimiter);
|
|
3676
|
-
const bucketLoader = createBucketLoader(
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3708
|
+
const bucketLoader = createBucketLoader(
|
|
3709
|
+
bucket.type,
|
|
3710
|
+
bucketPath.pathPattern,
|
|
3711
|
+
{
|
|
3712
|
+
isCacheRestore: true,
|
|
3713
|
+
defaultLocale: sourceLocale,
|
|
3714
|
+
injectLocale: bucket.injectLocale
|
|
3715
|
+
},
|
|
3716
|
+
bucket.lockedKeys
|
|
3717
|
+
);
|
|
3681
3718
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
3682
3719
|
await bucketLoader.init();
|
|
3683
3720
|
const sourceData = await bucketLoader.pull(sourceLocale);
|
|
@@ -3714,12 +3751,17 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
3714
3751
|
bucketLoop: for (const bucket of buckets) {
|
|
3715
3752
|
for (const bucketPath of bucket.paths) {
|
|
3716
3753
|
const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketPath.delimiter);
|
|
3717
|
-
const bucketLoader = createBucketLoader(
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3754
|
+
const bucketLoader = createBucketLoader(
|
|
3755
|
+
bucket.type,
|
|
3756
|
+
bucketPath.pathPattern,
|
|
3757
|
+
{
|
|
3758
|
+
isCacheRestore: false,
|
|
3759
|
+
defaultLocale: sourceLocale,
|
|
3760
|
+
returnUnlocalizedKeys: true,
|
|
3761
|
+
injectLocale: bucket.injectLocale
|
|
3762
|
+
},
|
|
3763
|
+
bucket.lockedKeys
|
|
3764
|
+
);
|
|
3723
3765
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
3724
3766
|
await bucketLoader.init();
|
|
3725
3767
|
const { unlocalizable: sourceUnlocalizable, ...sourceData } = await bucketLoader.pull(
|
|
@@ -3778,11 +3820,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
3778
3820
|
for (const bucketPath of bucket.paths) {
|
|
3779
3821
|
const bucketOra = _ora2.default.call(void 0, { indent: 2 }).info(`Processing path: ${bucketPath.pathPattern}`);
|
|
3780
3822
|
const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketPath.delimiter);
|
|
3781
|
-
const bucketLoader = createBucketLoader(
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3823
|
+
const bucketLoader = createBucketLoader(
|
|
3824
|
+
bucket.type,
|
|
3825
|
+
bucketPath.pathPattern,
|
|
3826
|
+
{
|
|
3827
|
+
isCacheRestore: false,
|
|
3828
|
+
defaultLocale: sourceLocale,
|
|
3829
|
+
injectLocale: bucket.injectLocale
|
|
3830
|
+
},
|
|
3831
|
+
bucket.lockedKeys
|
|
3832
|
+
);
|
|
3786
3833
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
3787
3834
|
await bucketLoader.init();
|
|
3788
3835
|
let sourceData = await bucketLoader.pull(sourceLocale);
|
|
@@ -3801,7 +3848,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
3801
3848
|
});
|
|
3802
3849
|
let processableData = _lodash2.default.chain(sourceData).entries().filter(([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!flags.force).fromPairs().value();
|
|
3803
3850
|
if (flags.key) {
|
|
3804
|
-
processableData = _lodash2.default.pickBy(processableData, (
|
|
3851
|
+
processableData = _lodash2.default.pickBy(processableData, (_24, key) => key === flags.key);
|
|
3805
3852
|
}
|
|
3806
3853
|
if (flags.verbose) {
|
|
3807
3854
|
bucketOra.info(JSON.stringify(processableData, null, 2));
|
|
@@ -3952,12 +3999,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
3952
3999
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
3953
4000
|
docUrl: "bucketNotFound"
|
|
3954
4001
|
});
|
|
3955
|
-
} else if (_optionalChain([flags, 'access',
|
|
4002
|
+
} else if (_optionalChain([flags, 'access', _151 => _151.locale, 'optionalAccess', _152 => _152.some, 'call', _153 => _153((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
3956
4003
|
throw new CLIError({
|
|
3957
4004
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
3958
4005
|
docUrl: "localeTargetNotFound"
|
|
3959
4006
|
});
|
|
3960
|
-
} else if (_optionalChain([flags, 'access',
|
|
4007
|
+
} else if (_optionalChain([flags, 'access', _154 => _154.bucket, 'optionalAccess', _155 => _155.some, 'call', _156 => _156((bucket) => !i18nConfig.buckets[bucket])])) {
|
|
3961
4008
|
throw new CLIError({
|
|
3962
4009
|
message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
|
|
3963
4010
|
docUrl: "bucketNotFound"
|
|
@@ -4267,7 +4314,7 @@ var _stdiojs = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
|
4267
4314
|
var _mcpjs = require('@modelcontextprotocol/sdk/server/mcp.js');
|
|
4268
4315
|
|
|
4269
4316
|
|
|
4270
|
-
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 (
|
|
4317
|
+
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 (_24, program) => {
|
|
4271
4318
|
const apiKey = program.args[0];
|
|
4272
4319
|
const settings = getSettings(apiKey);
|
|
4273
4320
|
if (!settings.auth.apiKey) {
|
|
@@ -4390,7 +4437,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
4390
4437
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
4391
4438
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
4392
4439
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
4393
|
-
_optionalChain([this, 'access',
|
|
4440
|
+
_optionalChain([this, 'access', _157 => _157.platformKit, 'optionalAccess', _158 => _158.gitConfig, 'call', _159 => _159()]);
|
|
4394
4441
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
4395
4442
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
4396
4443
|
if (!processOwnCommits) {
|
|
@@ -4415,7 +4462,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
4415
4462
|
// ../../action/src/flows/pull-request.ts
|
|
4416
4463
|
var PullRequestFlow = class extends InBranchFlow {
|
|
4417
4464
|
async preRun() {
|
|
4418
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
4465
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _160 => _160()]);
|
|
4419
4466
|
if (!canContinue) {
|
|
4420
4467
|
return false;
|
|
4421
4468
|
}
|
|
@@ -4633,10 +4680,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
4633
4680
|
repo_slug: this.platformConfig.repositoryName,
|
|
4634
4681
|
state: "OPEN"
|
|
4635
4682
|
}).then(({ data: { values } }) => {
|
|
4636
|
-
return _optionalChain([values, 'optionalAccess',
|
|
4637
|
-
({ source, destination }) => _optionalChain([source, 'optionalAccess',
|
|
4683
|
+
return _optionalChain([values, 'optionalAccess', _161 => _161.find, 'call', _162 => _162(
|
|
4684
|
+
({ source, destination }) => _optionalChain([source, 'optionalAccess', _163 => _163.branch, 'optionalAccess', _164 => _164.name]) === branch && _optionalChain([destination, 'optionalAccess', _165 => _165.branch, 'optionalAccess', _166 => _166.name]) === this.platformConfig.baseBranchName
|
|
4638
4685
|
)]);
|
|
4639
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
4686
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _167 => _167.id]));
|
|
4640
4687
|
}
|
|
4641
4688
|
async closePullRequest({ pullRequestNumber }) {
|
|
4642
4689
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -4722,7 +4769,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
4722
4769
|
repo: this.platformConfig.repositoryName,
|
|
4723
4770
|
base: this.platformConfig.baseBranchName,
|
|
4724
4771
|
state: "open"
|
|
4725
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
4772
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _168 => _168.number]));
|
|
4726
4773
|
}
|
|
4727
4774
|
async closePullRequest({ pullRequestNumber }) {
|
|
4728
4775
|
await this.octokit.rest.pulls.update({
|
|
@@ -4835,7 +4882,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
4835
4882
|
sourceBranch: branch,
|
|
4836
4883
|
state: "opened"
|
|
4837
4884
|
});
|
|
4838
|
-
return _optionalChain([mergeRequests, 'access',
|
|
4885
|
+
return _optionalChain([mergeRequests, 'access', _169 => _169[0], 'optionalAccess', _170 => _170.iid]);
|
|
4839
4886
|
}
|
|
4840
4887
|
async closePullRequest({ pullRequestNumber }) {
|
|
4841
4888
|
await this.gitlab.MergeRequests.edit(this.platformConfig.gitlabProjectId, pullRequestNumber, {
|
|
@@ -4888,7 +4935,7 @@ async function main() {
|
|
|
4888
4935
|
const { isPullRequestMode } = platformKit.config;
|
|
4889
4936
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
4890
4937
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
4891
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
4938
|
+
const canRun = await _optionalChain([flow, 'access', _171 => _171.preRun, 'optionalCall', _172 => _172()]);
|
|
4892
4939
|
if (canRun === false) {
|
|
4893
4940
|
return;
|
|
4894
4941
|
}
|
|
@@ -4896,7 +4943,7 @@ async function main() {
|
|
|
4896
4943
|
if (!hasChanges) {
|
|
4897
4944
|
return;
|
|
4898
4945
|
}
|
|
4899
|
-
await _optionalChain([flow, 'access',
|
|
4946
|
+
await _optionalChain([flow, 'access', _173 => _173.postRun, 'optionalCall', _174 => _174()]);
|
|
4900
4947
|
}
|
|
4901
4948
|
|
|
4902
4949
|
// src/cli/cmd/ci.ts
|
|
@@ -4918,7 +4965,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
4918
4965
|
}
|
|
4919
4966
|
const env = {
|
|
4920
4967
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
4921
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
4968
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _175 => _175.pullRequest, 'optionalAccess', _176 => _176.toString, 'call', _177 => _177()]) || "false",
|
|
4922
4969
|
...options.commitMessage && { LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage },
|
|
4923
4970
|
...options.pullRequestTitle && { LINGODOTDEV_PULL_REQUEST_TITLE: options.pullRequestTitle },
|
|
4924
4971
|
...options.workingDirectory && { LINGODOTDEV_WORKING_DIRECTORY: options.workingDirectory },
|
|
@@ -4931,7 +4978,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
4931
4978
|
// package.json
|
|
4932
4979
|
var package_default = {
|
|
4933
4980
|
name: "lingo.dev",
|
|
4934
|
-
version: "0.
|
|
4981
|
+
version: "0.82.0",
|
|
4935
4982
|
description: "Lingo.dev CLI",
|
|
4936
4983
|
private: false,
|
|
4937
4984
|
publishConfig: {
|