lingo.dev 0.92.7 → 0.92.8
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 +165 -122
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +115 -72
- 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', _29 => _29.auth, 'optionalAccess', _30 => _30.apiKey]) || defaults.auth.apiKey,
|
|
30
|
+
apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _31 => _31.auth, 'optionalAccess', _32 => _32.apiUrl]) || defaults.auth.apiUrl,
|
|
31
|
+
webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _33 => _33.auth, 'optionalAccess', _34 => _34.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', _35 => _35.auth, 'optionalAccess', _36 => _36.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', _37 => _37.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', _38 => _38.email])}`);
|
|
778
778
|
} else {
|
|
779
779
|
_ora2.default.call(void 0, ).fail("Authentication failed.");
|
|
780
780
|
}
|
|
@@ -851,45 +851,66 @@ var locale_default = new (0, _interactivecommander.Command)().command("locale").
|
|
|
851
851
|
|
|
852
852
|
|
|
853
853
|
|
|
854
|
+
|
|
855
|
+
|
|
854
856
|
function getBuckets(i18nConfig) {
|
|
855
|
-
const result = Object.entries(i18nConfig.buckets).map(
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
config
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
857
|
+
const result = Object.entries(i18nConfig.buckets).map(
|
|
858
|
+
([bucketType, bucketEntry]) => {
|
|
859
|
+
const includeItems = bucketEntry.include.map(
|
|
860
|
+
(item) => resolveBucketItem(item)
|
|
861
|
+
);
|
|
862
|
+
const excludeItems = _optionalChain([bucketEntry, 'access', _39 => _39.exclude, 'optionalAccess', _40 => _40.map, 'call', _41 => _41(
|
|
863
|
+
(item) => resolveBucketItem(item)
|
|
864
|
+
)]);
|
|
865
|
+
const config = {
|
|
866
|
+
type: bucketType,
|
|
867
|
+
paths: extractPathPatterns(
|
|
868
|
+
i18nConfig.locale.source,
|
|
869
|
+
includeItems,
|
|
870
|
+
excludeItems
|
|
871
|
+
)
|
|
872
|
+
};
|
|
873
|
+
if (bucketEntry.injectLocale) {
|
|
874
|
+
config.injectLocale = bucketEntry.injectLocale;
|
|
875
|
+
}
|
|
876
|
+
if (bucketEntry.lockedKeys) {
|
|
877
|
+
config.lockedKeys = bucketEntry.lockedKeys;
|
|
878
|
+
}
|
|
879
|
+
if (bucketEntry.lockedPatterns) {
|
|
880
|
+
config.lockedPatterns = bucketEntry.lockedPatterns;
|
|
881
|
+
}
|
|
882
|
+
if (bucketEntry.ignoredKeys) {
|
|
883
|
+
config.ignoredKeys = bucketEntry.ignoredKeys;
|
|
884
|
+
}
|
|
885
|
+
return config;
|
|
870
886
|
}
|
|
871
|
-
|
|
872
|
-
});
|
|
887
|
+
);
|
|
873
888
|
return result;
|
|
874
889
|
}
|
|
875
890
|
function extractPathPatterns(sourceLocale, include, exclude) {
|
|
876
891
|
const includedPatterns = include.flatMap(
|
|
877
|
-
(pattern) => expandPlaceholderedGlob(
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
892
|
+
(pattern) => expandPlaceholderedGlob(
|
|
893
|
+
pattern.path,
|
|
894
|
+
__spec.resolveOverriddenLocale.call(void 0, sourceLocale, pattern.delimiter)
|
|
895
|
+
).map((pathPattern) => ({
|
|
896
|
+
pathPattern,
|
|
897
|
+
delimiter: pattern.delimiter
|
|
898
|
+
}))
|
|
883
899
|
);
|
|
884
|
-
const excludedPatterns = _optionalChain([exclude, 'optionalAccess',
|
|
885
|
-
(pattern) => expandPlaceholderedGlob(
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
900
|
+
const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _42 => _42.flatMap, 'call', _43 => _43(
|
|
901
|
+
(pattern) => expandPlaceholderedGlob(
|
|
902
|
+
pattern.path,
|
|
903
|
+
__spec.resolveOverriddenLocale.call(void 0, sourceLocale, pattern.delimiter)
|
|
904
|
+
).map((pathPattern) => ({
|
|
905
|
+
pathPattern,
|
|
906
|
+
delimiter: pattern.delimiter
|
|
907
|
+
}))
|
|
891
908
|
)]);
|
|
892
|
-
const result = _lodash2.default.differenceBy(
|
|
909
|
+
const result = _lodash2.default.differenceBy(
|
|
910
|
+
includedPatterns,
|
|
911
|
+
_nullishCoalesce(excludedPatterns, () => ( [])),
|
|
912
|
+
(item) => item.pathPattern
|
|
913
|
+
);
|
|
893
914
|
return result;
|
|
894
915
|
}
|
|
895
916
|
function expandPlaceholderedGlob(_pathPattern, sourceLocale) {
|
|
@@ -908,12 +929,15 @@ function expandPlaceholderedGlob(_pathPattern, sourceLocale) {
|
|
|
908
929
|
});
|
|
909
930
|
}
|
|
910
931
|
const pathPatternChunks = pathPattern.split(path14.default.sep);
|
|
911
|
-
const localeSegmentIndexes = pathPatternChunks.reduce(
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
932
|
+
const localeSegmentIndexes = pathPatternChunks.reduce(
|
|
933
|
+
(indexes, segment, index) => {
|
|
934
|
+
if (segment.includes("[locale]")) {
|
|
935
|
+
indexes.push(index);
|
|
936
|
+
}
|
|
937
|
+
return indexes;
|
|
938
|
+
},
|
|
939
|
+
[]
|
|
940
|
+
);
|
|
917
941
|
const sourcePathPattern = pathPattern.replaceAll(/\[locale\]/g, sourceLocale);
|
|
918
942
|
const sourcePaths = _glob.glob.sync(sourcePathPattern, { follow: true, withFileTypes: true }).filter((file) => file.isFile() || file.isSymbolicLink()).map((file) => file.fullpath()).map((fullpath) => path14.default.relative(process.cwd(), fullpath));
|
|
919
943
|
const placeholderedPaths = sourcePaths.map((sourcePath) => {
|
|
@@ -1010,12 +1034,12 @@ function composeLoaders(...loaders) {
|
|
|
1010
1034
|
return {
|
|
1011
1035
|
init: async () => {
|
|
1012
1036
|
for (const loader of loaders) {
|
|
1013
|
-
await _optionalChain([loader, 'access',
|
|
1037
|
+
await _optionalChain([loader, 'access', _44 => _44.init, 'optionalCall', _45 => _45()]);
|
|
1014
1038
|
}
|
|
1015
1039
|
},
|
|
1016
1040
|
setDefaultLocale(locale) {
|
|
1017
1041
|
for (const loader of loaders) {
|
|
1018
|
-
_optionalChain([loader, 'access',
|
|
1042
|
+
_optionalChain([loader, 'access', _46 => _46.setDefaultLocale, 'optionalCall', _47 => _47(locale)]);
|
|
1019
1043
|
}
|
|
1020
1044
|
return this;
|
|
1021
1045
|
},
|
|
@@ -1048,7 +1072,7 @@ function createLoader(lDefinition) {
|
|
|
1048
1072
|
if (state.initCtx) {
|
|
1049
1073
|
return state.initCtx;
|
|
1050
1074
|
}
|
|
1051
|
-
state.initCtx = await _optionalChain([lDefinition, 'access',
|
|
1075
|
+
state.initCtx = await _optionalChain([lDefinition, 'access', _48 => _48.init, 'optionalCall', _49 => _49()]);
|
|
1052
1076
|
return state.initCtx;
|
|
1053
1077
|
},
|
|
1054
1078
|
setDefaultLocale(locale) {
|
|
@@ -1152,7 +1176,7 @@ function createNormalizeLoader() {
|
|
|
1152
1176
|
return normalized;
|
|
1153
1177
|
},
|
|
1154
1178
|
push: async (locale, data, originalInput) => {
|
|
1155
|
-
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess',
|
|
1179
|
+
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _50 => _50.keysMap]), () => ( {}));
|
|
1156
1180
|
const input2 = mapDenormalizedKeys(data, keysMap);
|
|
1157
1181
|
const denormalized = _flat.unflatten.call(void 0, input2, {
|
|
1158
1182
|
delimiter: "/",
|
|
@@ -1226,7 +1250,7 @@ function createTextFileLoader(pathPattern) {
|
|
|
1226
1250
|
const trimmedResult = result.trim();
|
|
1227
1251
|
return trimmedResult;
|
|
1228
1252
|
},
|
|
1229
|
-
async push(locale, data,
|
|
1253
|
+
async push(locale, data, _28, originalLocale) {
|
|
1230
1254
|
const draftPath = pathPattern.replaceAll("[locale]", locale);
|
|
1231
1255
|
const finalPath = path14.default.resolve(draftPath);
|
|
1232
1256
|
const dirPath = path14.default.dirname(finalPath);
|
|
@@ -1255,8 +1279,8 @@ async function getTrailingNewLine(pathPattern, locale, originalLocale) {
|
|
|
1255
1279
|
if (!templateData) {
|
|
1256
1280
|
templateData = await readFileForLocale(pathPattern, originalLocale);
|
|
1257
1281
|
}
|
|
1258
|
-
if (_optionalChain([templateData, 'optionalAccess',
|
|
1259
|
-
const ending = _optionalChain([templateData, 'optionalAccess',
|
|
1282
|
+
if (_optionalChain([templateData, 'optionalAccess', _51 => _51.match, 'call', _52 => _52(/[\r\n]$/)])) {
|
|
1283
|
+
const ending = _optionalChain([templateData, 'optionalAccess', _53 => _53.includes, 'call', _54 => _54("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _55 => _55.includes, 'call', _56 => _56("\r")]) ? "\r" : "\n";
|
|
1260
1284
|
return ending;
|
|
1261
1285
|
}
|
|
1262
1286
|
return "";
|
|
@@ -1595,7 +1619,7 @@ function createHtmlLoader() {
|
|
|
1595
1619
|
break;
|
|
1596
1620
|
}
|
|
1597
1621
|
const siblings = Array.from(parent.childNodes).filter(
|
|
1598
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1622
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _57 => _57.textContent, 'optionalAccess', _58 => _58.trim, 'call', _59 => _59()])
|
|
1599
1623
|
);
|
|
1600
1624
|
const index = siblings.indexOf(current);
|
|
1601
1625
|
if (index !== -1) {
|
|
@@ -1630,11 +1654,11 @@ function createHtmlLoader() {
|
|
|
1630
1654
|
result[getPath(element, attr)] = value;
|
|
1631
1655
|
}
|
|
1632
1656
|
});
|
|
1633
|
-
Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1657
|
+
Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _60 => _60.textContent, 'optionalAccess', _61 => _61.trim, 'call', _62 => _62()])).forEach(processNode);
|
|
1634
1658
|
}
|
|
1635
1659
|
};
|
|
1636
|
-
Array.from(document.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1637
|
-
Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1660
|
+
Array.from(document.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _63 => _63.textContent, 'optionalAccess', _64 => _64.trim, 'call', _65 => _65()])).forEach(processNode);
|
|
1661
|
+
Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _66 => _66.textContent, 'optionalAccess', _67 => _67.trim, 'call', _68 => _68()])).forEach(processNode);
|
|
1638
1662
|
return result;
|
|
1639
1663
|
},
|
|
1640
1664
|
async push(locale, data, originalInput) {
|
|
@@ -1656,7 +1680,7 @@ function createHtmlLoader() {
|
|
|
1656
1680
|
for (let i = 0; i < indices.length; i++) {
|
|
1657
1681
|
const index = parseInt(indices[i]);
|
|
1658
1682
|
const siblings = Array.from(parent.childNodes).filter(
|
|
1659
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1683
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _69 => _69.textContent, 'optionalAccess', _70 => _70.trim, 'call', _71 => _71()])
|
|
1660
1684
|
);
|
|
1661
1685
|
if (index >= siblings.length) {
|
|
1662
1686
|
if (i === indices.length - 1) {
|
|
@@ -1707,7 +1731,7 @@ function createMarkdownLoader() {
|
|
|
1707
1731
|
yaml: yamlEngine
|
|
1708
1732
|
}
|
|
1709
1733
|
});
|
|
1710
|
-
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess',
|
|
1734
|
+
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _72 => _72.trim, 'call', _73 => _73()]), () => ( ""))).filter(Boolean);
|
|
1711
1735
|
return {
|
|
1712
1736
|
...Object.fromEntries(
|
|
1713
1737
|
sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
|
|
@@ -1719,7 +1743,7 @@ function createMarkdownLoader() {
|
|
|
1719
1743
|
const frontmatter = Object.fromEntries(
|
|
1720
1744
|
Object.entries(data).filter(([key]) => key.startsWith(FM_ATTR_PREFIX)).map(([key, value]) => [key.replace(FM_ATTR_PREFIX, ""), value])
|
|
1721
1745
|
);
|
|
1722
|
-
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',
|
|
1746
|
+
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', _74 => _74.trim, 'call', _75 => _75()]), () => ( ""))).filter(Boolean).join("\n\n");
|
|
1723
1747
|
if (Object.keys(frontmatter).length > 0) {
|
|
1724
1748
|
content = `
|
|
1725
1749
|
${content}`;
|
|
@@ -1752,7 +1776,7 @@ function createPropertiesLoader() {
|
|
|
1752
1776
|
return result;
|
|
1753
1777
|
},
|
|
1754
1778
|
async push(locale, payload) {
|
|
1755
|
-
const result = Object.entries(payload).filter(([
|
|
1779
|
+
const result = Object.entries(payload).filter(([_28, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
|
|
1756
1780
|
return result;
|
|
1757
1781
|
}
|
|
1758
1782
|
});
|
|
@@ -1763,7 +1787,7 @@ function isSkippableLine(line) {
|
|
|
1763
1787
|
function parsePropertyLine(line) {
|
|
1764
1788
|
const [key, ...valueParts] = line.split("=");
|
|
1765
1789
|
return {
|
|
1766
|
-
key: _optionalChain([key, 'optionalAccess',
|
|
1790
|
+
key: _optionalChain([key, 'optionalAccess', _76 => _76.trim, 'call', _77 => _77()]) || "",
|
|
1767
1791
|
value: valueParts.join("=").trim()
|
|
1768
1792
|
};
|
|
1769
1793
|
}
|
|
@@ -1849,7 +1873,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
1849
1873
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
1850
1874
|
continue;
|
|
1851
1875
|
}
|
|
1852
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
1876
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _78 => _78.localizations, 'optionalAccess', _79 => _79[locale]]);
|
|
1853
1877
|
if (langTranslationEntity) {
|
|
1854
1878
|
if ("stringUnit" in langTranslationEntity) {
|
|
1855
1879
|
resultData[translationKey] = langTranslationEntity.stringUnit.value;
|
|
@@ -1858,7 +1882,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
1858
1882
|
resultData[translationKey] = {};
|
|
1859
1883
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
1860
1884
|
for (const form in pluralForms) {
|
|
1861
|
-
if (_optionalChain([pluralForms, 'access',
|
|
1885
|
+
if (_optionalChain([pluralForms, 'access', _80 => _80[form], 'optionalAccess', _81 => _81.stringUnit, 'optionalAccess', _82 => _82.value])) {
|
|
1862
1886
|
resultData[translationKey][form] = pluralForms[form].stringUnit.value;
|
|
1863
1887
|
}
|
|
1864
1888
|
}
|
|
@@ -1881,7 +1905,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
1881
1905
|
const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
|
|
1882
1906
|
if (typeof value === "string") {
|
|
1883
1907
|
langDataToMerge.strings[key] = {
|
|
1884
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
1908
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _83 => _83.strings, 'optionalAccess', _84 => _84[key], 'optionalAccess', _85 => _85.extractionState]),
|
|
1885
1909
|
localizations: {
|
|
1886
1910
|
[locale]: {
|
|
1887
1911
|
stringUnit: {
|
|
@@ -2019,10 +2043,10 @@ function createUnlocalizableLoader(isCacheRestore = false, returnUnlocalizedKeys
|
|
|
2019
2043
|
}
|
|
2020
2044
|
}
|
|
2021
2045
|
return false;
|
|
2022
|
-
}).map(([key,
|
|
2023
|
-
const result = _lodash2.default.omitBy(input2, (
|
|
2046
|
+
}).map(([key, _28]) => key);
|
|
2047
|
+
const result = _lodash2.default.omitBy(input2, (_28, key) => passthroughKeys.includes(key));
|
|
2024
2048
|
if (returnUnlocalizedKeys) {
|
|
2025
|
-
result.unlocalizable = _lodash2.default.omitBy(input2, (
|
|
2049
|
+
result.unlocalizable = _lodash2.default.omitBy(input2, (_28, key) => !passthroughKeys.includes(key));
|
|
2026
2050
|
}
|
|
2027
2051
|
return result;
|
|
2028
2052
|
},
|
|
@@ -2061,7 +2085,7 @@ function createPoDataLoader(params) {
|
|
|
2061
2085
|
Object.entries(entries).forEach(([msgid, entry]) => {
|
|
2062
2086
|
if (msgid && entry.msgid) {
|
|
2063
2087
|
const context = entry.msgctxt || "";
|
|
2064
|
-
const fullEntry = _optionalChain([parsedPo, 'access',
|
|
2088
|
+
const fullEntry = _optionalChain([parsedPo, 'access', _86 => _86.translations, 'access', _87 => _87[context], 'optionalAccess', _88 => _88[msgid]]);
|
|
2065
2089
|
if (fullEntry) {
|
|
2066
2090
|
result[msgid] = fullEntry;
|
|
2067
2091
|
}
|
|
@@ -2071,8 +2095,8 @@ function createPoDataLoader(params) {
|
|
|
2071
2095
|
return result;
|
|
2072
2096
|
},
|
|
2073
2097
|
async push(locale, data, originalInput, originalLocale, pullInput) {
|
|
2074
|
-
const currentSections = _optionalChain([pullInput, 'optionalAccess',
|
|
2075
|
-
const originalSections = _optionalChain([originalInput, 'optionalAccess',
|
|
2098
|
+
const currentSections = _optionalChain([pullInput, 'optionalAccess', _89 => _89.split, 'call', _90 => _90("\n\n"), 'access', _91 => _91.filter, 'call', _92 => _92(Boolean)]) || [];
|
|
2099
|
+
const originalSections = _optionalChain([originalInput, 'optionalAccess', _93 => _93.split, 'call', _94 => _94("\n\n"), 'access', _95 => _95.filter, 'call', _96 => _96(Boolean)]) || [];
|
|
2076
2100
|
const result = originalSections.map((section) => {
|
|
2077
2101
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
2078
2102
|
const contextKey = _lodash2.default.keys(sectionPo.translations)[0];
|
|
@@ -2137,8 +2161,8 @@ function createPoContentLoader() {
|
|
|
2137
2161
|
{
|
|
2138
2162
|
...entry,
|
|
2139
2163
|
msgstr: [
|
|
2140
|
-
_optionalChain([data, 'access',
|
|
2141
|
-
_optionalChain([data, 'access',
|
|
2164
|
+
_optionalChain([data, 'access', _97 => _97[entry.msgid], 'optionalAccess', _98 => _98.singular]),
|
|
2165
|
+
_optionalChain([data, 'access', _99 => _99[entry.msgid], 'optionalAccess', _100 => _100.plural]) || null
|
|
2142
2166
|
].filter(Boolean)
|
|
2143
2167
|
}
|
|
2144
2168
|
]).fromPairs().value();
|
|
@@ -2385,7 +2409,7 @@ function createDatoClient(params) {
|
|
|
2385
2409
|
only_valid: "true",
|
|
2386
2410
|
ids: !records.length ? void 0 : records.join(",")
|
|
2387
2411
|
}
|
|
2388
|
-
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2412
|
+
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _101 => _101.response, 'optionalAccess', _102 => _102.body, 'optionalAccess', _103 => _103.data, 'optionalAccess', _104 => _104[0]]) || error));
|
|
2389
2413
|
},
|
|
2390
2414
|
findRecordsForModel: async (modelId, records) => {
|
|
2391
2415
|
try {
|
|
@@ -2395,9 +2419,9 @@ function createDatoClient(params) {
|
|
|
2395
2419
|
filter: {
|
|
2396
2420
|
type: modelId,
|
|
2397
2421
|
only_valid: "true",
|
|
2398
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
2422
|
+
ids: !_optionalChain([records, 'optionalAccess', _105 => _105.length]) ? void 0 : records.join(",")
|
|
2399
2423
|
}
|
|
2400
|
-
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2424
|
+
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _106 => _106.response, 'optionalAccess', _107 => _107.body, 'optionalAccess', _108 => _108.data, 'optionalAccess', _109 => _109[0]]) || error));
|
|
2401
2425
|
return result;
|
|
2402
2426
|
} catch (_error) {
|
|
2403
2427
|
throw new Error(
|
|
@@ -2411,9 +2435,9 @@ function createDatoClient(params) {
|
|
|
2411
2435
|
},
|
|
2412
2436
|
updateRecord: async (id, payload) => {
|
|
2413
2437
|
try {
|
|
2414
|
-
await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2438
|
+
await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _110 => _110.response, 'optionalAccess', _111 => _111.body, 'optionalAccess', _112 => _112.data, 'optionalAccess', _113 => _113[0]]) || error));
|
|
2415
2439
|
} catch (_error) {
|
|
2416
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2440
|
+
if (_optionalChain([_error, 'optionalAccess', _114 => _114.attributes, 'optionalAccess', _115 => _115.details, 'optionalAccess', _116 => _116.message])) {
|
|
2417
2441
|
throw new Error(
|
|
2418
2442
|
[
|
|
2419
2443
|
`${_error.attributes.details.message}`,
|
|
@@ -2434,9 +2458,9 @@ function createDatoClient(params) {
|
|
|
2434
2458
|
},
|
|
2435
2459
|
enableFieldLocalization: async (args) => {
|
|
2436
2460
|
try {
|
|
2437
|
-
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2461
|
+
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _117 => _117.response, 'optionalAccess', _118 => _118.body, 'optionalAccess', _119 => _119.data, 'optionalAccess', _120 => _120[0]]) || error));
|
|
2438
2462
|
} catch (_error) {
|
|
2439
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2463
|
+
if (_optionalChain([_error, 'optionalAccess', _121 => _121.attributes, 'optionalAccess', _122 => _122.code]) === "NOT_FOUND") {
|
|
2440
2464
|
throw new Error(
|
|
2441
2465
|
[
|
|
2442
2466
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -2444,7 +2468,7 @@ function createDatoClient(params) {
|
|
|
2444
2468
|
].join("\n\n")
|
|
2445
2469
|
);
|
|
2446
2470
|
}
|
|
2447
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2471
|
+
if (_optionalChain([_error, 'optionalAccess', _123 => _123.attributes, 'optionalAccess', _124 => _124.details, 'optionalAccess', _125 => _125.message])) {
|
|
2448
2472
|
throw new Error(
|
|
2449
2473
|
[`${_error.attributes.details.message}`, `Error: ${JSON.stringify(_error, null, 2)}`].join("\n\n")
|
|
2450
2474
|
);
|
|
@@ -2510,7 +2534,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
2510
2534
|
}
|
|
2511
2535
|
}
|
|
2512
2536
|
const records = await dato.findRecordsForModel(modelId);
|
|
2513
|
-
const recordChoices = createRecordChoices(records, _optionalChain([config, 'access',
|
|
2537
|
+
const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _126 => _126.models, 'access', _127 => _127[modelId], 'optionalAccess', _128 => _128.records]) || [], project);
|
|
2514
2538
|
const selectedRecords = await promptRecordSelection(modelName, recordChoices);
|
|
2515
2539
|
result.models[modelId].records = records.filter((record) => selectedRecords.includes(record.id));
|
|
2516
2540
|
updatedConfig.models[modelId].records = selectedRecords;
|
|
@@ -2522,14 +2546,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
2522
2546
|
},
|
|
2523
2547
|
async pull(locale, input2, initCtx) {
|
|
2524
2548
|
const result = {};
|
|
2525
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
2526
|
-
let records = _optionalChain([initCtx, 'optionalAccess',
|
|
2549
|
+
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _129 => _129.models]) || {})) {
|
|
2550
|
+
let records = _optionalChain([initCtx, 'optionalAccess', _130 => _130.models, 'access', _131 => _131[modelId], 'access', _132 => _132.records]) || [];
|
|
2527
2551
|
const recordIds = records.map((record) => record.id);
|
|
2528
2552
|
records = await dato.findRecords(recordIds);
|
|
2529
2553
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
2530
2554
|
if (records.length > 0) {
|
|
2531
2555
|
result[modelId] = {
|
|
2532
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
2556
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _133 => _133.models, 'optionalAccess', _134 => _134[modelId], 'optionalAccess', _135 => _135.fields]) || [],
|
|
2533
2557
|
records
|
|
2534
2558
|
};
|
|
2535
2559
|
}
|
|
@@ -2588,7 +2612,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
2588
2612
|
return records.map((record) => ({
|
|
2589
2613
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
2590
2614
|
value: record.id,
|
|
2591
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
2615
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _136 => _136.includes, 'call', _137 => _137(record.id)])
|
|
2592
2616
|
}));
|
|
2593
2617
|
}
|
|
2594
2618
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -2855,7 +2879,7 @@ var _nodewebvtt = require('node-webvtt'); var _nodewebvtt2 = _interopRequireDefa
|
|
|
2855
2879
|
function createVttLoader() {
|
|
2856
2880
|
return createLoader({
|
|
2857
2881
|
async pull(locale, input2) {
|
|
2858
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
2882
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _138 => _138.parse, 'call', _139 => _139(input2), 'optionalAccess', _140 => _140.cues]);
|
|
2859
2883
|
if (Object.keys(vtt).length === 0) {
|
|
2860
2884
|
return {};
|
|
2861
2885
|
} else {
|
|
@@ -2908,7 +2932,7 @@ function variableExtractLoader(params) {
|
|
|
2908
2932
|
for (let i = 0; i < matches.length; i++) {
|
|
2909
2933
|
const match = matches[i];
|
|
2910
2934
|
const currentValue = result[key].value;
|
|
2911
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
2935
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _141 => _141.replace, 'call', _142 => _142(match, `{variable:${i}}`)]);
|
|
2912
2936
|
result[key].value = newValue;
|
|
2913
2937
|
result[key].variables[i] = match;
|
|
2914
2938
|
}
|
|
@@ -2922,7 +2946,7 @@ function variableExtractLoader(params) {
|
|
|
2922
2946
|
for (let i = 0; i < valueObj.variables.length; i++) {
|
|
2923
2947
|
const variable = valueObj.variables[i];
|
|
2924
2948
|
const currentValue = result[key];
|
|
2925
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
2949
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _143 => _143.replace, 'call', _144 => _144(`{variable:${i}}`, variable)]);
|
|
2926
2950
|
result[key] = newValue;
|
|
2927
2951
|
}
|
|
2928
2952
|
}
|
|
@@ -3103,7 +3127,7 @@ function createVueJsonLoader() {
|
|
|
3103
3127
|
return createLoader({
|
|
3104
3128
|
pull: async (locale, input2, ctx) => {
|
|
3105
3129
|
const parsed = parseVueFile(input2);
|
|
3106
|
-
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess',
|
|
3130
|
+
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _145 => _145.i18n, 'optionalAccess', _146 => _146[locale]]), () => ( {}));
|
|
3107
3131
|
},
|
|
3108
3132
|
push: async (locale, data, originalInput) => {
|
|
3109
3133
|
const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
|
|
@@ -3284,7 +3308,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
|
|
|
3284
3308
|
objectExpression.properties.forEach((prop) => {
|
|
3285
3309
|
if (!t.isObjectProperty(prop)) return;
|
|
3286
3310
|
const key = getPropertyKey(prop);
|
|
3287
|
-
const incomingVal = _optionalChain([data, 'optionalAccess',
|
|
3311
|
+
const incomingVal = _optionalChain([data, 'optionalAccess', _147 => _147[key]]);
|
|
3288
3312
|
if (incomingVal === void 0) {
|
|
3289
3313
|
return;
|
|
3290
3314
|
}
|
|
@@ -3320,7 +3344,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
|
|
|
3320
3344
|
let modified = false;
|
|
3321
3345
|
arrayExpression.elements.forEach((element, index) => {
|
|
3322
3346
|
if (!element) return;
|
|
3323
|
-
const incomingVal = _optionalChain([incoming, 'optionalAccess',
|
|
3347
|
+
const incomingVal = _optionalChain([incoming, 'optionalAccess', _148 => _148[index]]);
|
|
3324
3348
|
if (incomingVal === void 0) return;
|
|
3325
3349
|
if (t.isStringLiteral(element) && typeof incomingVal === "string") {
|
|
3326
3350
|
if (element.value !== incomingVal) {
|
|
@@ -3596,7 +3620,7 @@ function createMdxSectionsSplit2Loader() {
|
|
|
3596
3620
|
const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
|
|
3597
3621
|
const result = {
|
|
3598
3622
|
frontmatter: data.frontmatter,
|
|
3599
|
-
codePlaceholders: _optionalChain([pullInput, 'optionalAccess',
|
|
3623
|
+
codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _149 => _149.codePlaceholders]) || {},
|
|
3600
3624
|
content
|
|
3601
3625
|
};
|
|
3602
3626
|
return result;
|
|
@@ -3653,8 +3677,23 @@ function createMdxLockedPatternsLoader(defaultPatterns) {
|
|
|
3653
3677
|
});
|
|
3654
3678
|
}
|
|
3655
3679
|
|
|
3680
|
+
// src/cli/loaders/ignored-keys.ts
|
|
3681
|
+
|
|
3682
|
+
function createIgnoredKeysLoader(ignoredKeys) {
|
|
3683
|
+
return createLoader({
|
|
3684
|
+
pull: async (locale, data) => {
|
|
3685
|
+
const result = _lodash2.default.chain(data).omit(ignoredKeys).value();
|
|
3686
|
+
return result;
|
|
3687
|
+
},
|
|
3688
|
+
push: async (locale, data, originalInput, originalLocale, pullInput) => {
|
|
3689
|
+
const result = _lodash2.default.merge({}, data, _lodash2.default.pick(pullInput, ignoredKeys));
|
|
3690
|
+
return result;
|
|
3691
|
+
}
|
|
3692
|
+
});
|
|
3693
|
+
}
|
|
3694
|
+
|
|
3656
3695
|
// src/cli/loaders/index.ts
|
|
3657
|
-
function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys, lockedPatterns) {
|
|
3696
|
+
function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys, lockedPatterns, ignoredKeys) {
|
|
3658
3697
|
switch (bucketType) {
|
|
3659
3698
|
default:
|
|
3660
3699
|
throw new Error(`Unsupported bucket type: ${bucketType}`);
|
|
@@ -3913,6 +3952,8 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
3913
3952
|
createTypescriptLoader(),
|
|
3914
3953
|
createFlatLoader(),
|
|
3915
3954
|
createSyncLoader(),
|
|
3955
|
+
createLockedKeysLoader(lockedKeys || [], options.isCacheRestore),
|
|
3956
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
3916
3957
|
createUnlocalizableLoader(
|
|
3917
3958
|
options.isCacheRestore,
|
|
3918
3959
|
options.returnUnlocalizedKeys
|
|
@@ -4005,7 +4046,7 @@ function createBasicTranslator(model, systemPrompt) {
|
|
|
4005
4046
|
]
|
|
4006
4047
|
});
|
|
4007
4048
|
const result = JSON.parse(response.text);
|
|
4008
|
-
return _optionalChain([result, 'optionalAccess',
|
|
4049
|
+
return _optionalChain([result, 'optionalAccess', _150 => _150.data]) || {};
|
|
4009
4050
|
};
|
|
4010
4051
|
}
|
|
4011
4052
|
|
|
@@ -4023,7 +4064,7 @@ function createProcessor(provider, params) {
|
|
|
4023
4064
|
}
|
|
4024
4065
|
}
|
|
4025
4066
|
function getPureModelProvider(provider) {
|
|
4026
|
-
switch (_optionalChain([provider, 'optionalAccess',
|
|
4067
|
+
switch (_optionalChain([provider, 'optionalAccess', _151 => _151.id])) {
|
|
4027
4068
|
case "openai":
|
|
4028
4069
|
if (!process.env.OPENAI_API_KEY) {
|
|
4029
4070
|
throw new Error("OPENAI_API_KEY is not set.");
|
|
@@ -4040,7 +4081,7 @@ function getPureModelProvider(provider) {
|
|
|
4040
4081
|
apiKey: process.env.ANTHROPIC_API_KEY
|
|
4041
4082
|
})(provider.model);
|
|
4042
4083
|
default:
|
|
4043
|
-
throw new Error(`Unsupported provider: ${_optionalChain([provider, 'optionalAccess',
|
|
4084
|
+
throw new Error(`Unsupported provider: ${_optionalChain([provider, 'optionalAccess', _152 => _152.id])}`);
|
|
4044
4085
|
}
|
|
4045
4086
|
}
|
|
4046
4087
|
|
|
@@ -4265,7 +4306,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
4265
4306
|
validateParams(i18nConfig, flags);
|
|
4266
4307
|
ora.succeed("Localization configuration is valid");
|
|
4267
4308
|
ora.start("Connecting to Lingo.dev Localization Engine...");
|
|
4268
|
-
const isByokMode = _optionalChain([i18nConfig, 'optionalAccess',
|
|
4309
|
+
const isByokMode = _optionalChain([i18nConfig, 'optionalAccess', _153 => _153.provider]) && i18nConfig.provider.id !== "lingo";
|
|
4269
4310
|
if (isByokMode) {
|
|
4270
4311
|
authId = null;
|
|
4271
4312
|
ora.succeed("Using external provider (BYOK mode)");
|
|
@@ -4279,16 +4320,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
4279
4320
|
flags
|
|
4280
4321
|
});
|
|
4281
4322
|
let buckets = getBuckets(i18nConfig);
|
|
4282
|
-
if (_optionalChain([flags, 'access',
|
|
4323
|
+
if (_optionalChain([flags, 'access', _154 => _154.bucket, 'optionalAccess', _155 => _155.length])) {
|
|
4283
4324
|
buckets = buckets.filter(
|
|
4284
4325
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
4285
4326
|
);
|
|
4286
4327
|
}
|
|
4287
4328
|
ora.succeed("Buckets retrieved");
|
|
4288
|
-
if (_optionalChain([flags, 'access',
|
|
4329
|
+
if (_optionalChain([flags, 'access', _156 => _156.file, 'optionalAccess', _157 => _157.length])) {
|
|
4289
4330
|
buckets = buckets.map((bucket) => {
|
|
4290
4331
|
const paths = bucket.paths.filter(
|
|
4291
|
-
(path17) => flags.file.find((file) => _optionalChain([path17, 'access',
|
|
4332
|
+
(path17) => flags.file.find((file) => _optionalChain([path17, 'access', _158 => _158.pathPattern, 'optionalAccess', _159 => _159.includes, 'call', _160 => _160(file)]))
|
|
4292
4333
|
);
|
|
4293
4334
|
return { ...bucket, paths };
|
|
4294
4335
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -4307,7 +4348,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
4307
4348
|
});
|
|
4308
4349
|
}
|
|
4309
4350
|
}
|
|
4310
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
4351
|
+
const targetLocales = _optionalChain([flags, 'access', _161 => _161.locale, 'optionalAccess', _162 => _162.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
4311
4352
|
ora.start("Setting up localization cache...");
|
|
4312
4353
|
const checkLockfileProcessor = createDeltaProcessor("");
|
|
4313
4354
|
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
@@ -4328,7 +4369,8 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
4328
4369
|
injectLocale: bucket.injectLocale
|
|
4329
4370
|
},
|
|
4330
4371
|
bucket.lockedKeys,
|
|
4331
|
-
bucket.lockedPatterns
|
|
4372
|
+
bucket.lockedPatterns,
|
|
4373
|
+
bucket.ignoredKeys
|
|
4332
4374
|
);
|
|
4333
4375
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
4334
4376
|
await bucketLoader.init();
|
|
@@ -4515,7 +4557,8 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
4515
4557
|
injectLocale: bucket.injectLocale
|
|
4516
4558
|
},
|
|
4517
4559
|
bucket.lockedKeys,
|
|
4518
|
-
bucket.lockedPatterns
|
|
4560
|
+
bucket.lockedPatterns,
|
|
4561
|
+
bucket.ignoredKeys
|
|
4519
4562
|
);
|
|
4520
4563
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
4521
4564
|
await bucketLoader.init();
|
|
@@ -4546,7 +4589,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
4546
4589
|
if (flags.key) {
|
|
4547
4590
|
processableData = _lodash2.default.pickBy(
|
|
4548
4591
|
processableData,
|
|
4549
|
-
(
|
|
4592
|
+
(_28, key) => key === flags.key
|
|
4550
4593
|
);
|
|
4551
4594
|
}
|
|
4552
4595
|
if (flags.verbose) {
|
|
@@ -4715,12 +4758,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
4715
4758
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
4716
4759
|
docUrl: "bucketNotFound"
|
|
4717
4760
|
});
|
|
4718
|
-
} else if (_optionalChain([flags, 'access',
|
|
4761
|
+
} else if (_optionalChain([flags, 'access', _163 => _163.locale, 'optionalAccess', _164 => _164.some, 'call', _165 => _165((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
4719
4762
|
throw new CLIError({
|
|
4720
4763
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
4721
4764
|
docUrl: "localeTargetNotFound"
|
|
4722
4765
|
});
|
|
4723
|
-
} else if (_optionalChain([flags, 'access',
|
|
4766
|
+
} else if (_optionalChain([flags, 'access', _166 => _166.bucket, 'optionalAccess', _167 => _167.some, 'call', _168 => _168(
|
|
4724
4767
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
4725
4768
|
)])) {
|
|
4726
4769
|
throw new CLIError({
|
|
@@ -5048,7 +5091,7 @@ var _stdiojs = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
|
5048
5091
|
var _mcpjs = require('@modelcontextprotocol/sdk/server/mcp.js');
|
|
5049
5092
|
|
|
5050
5093
|
|
|
5051
|
-
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 (
|
|
5094
|
+
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 (_28, program) => {
|
|
5052
5095
|
const apiKey = program.args[0];
|
|
5053
5096
|
const settings = getSettings(apiKey);
|
|
5054
5097
|
if (!settings.auth.apiKey) {
|
|
@@ -5185,7 +5228,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
5185
5228
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
5186
5229
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
5187
5230
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
5188
|
-
_optionalChain([this, 'access',
|
|
5231
|
+
_optionalChain([this, 'access', _169 => _169.platformKit, 'optionalAccess', _170 => _170.gitConfig, 'call', _171 => _171()]);
|
|
5189
5232
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
5190
5233
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
5191
5234
|
if (!processOwnCommits) {
|
|
@@ -5217,7 +5260,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
5217
5260
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
5218
5261
|
var PullRequestFlow = class extends InBranchFlow {
|
|
5219
5262
|
async preRun() {
|
|
5220
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
5263
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _172 => _172()]);
|
|
5221
5264
|
if (!canContinue) {
|
|
5222
5265
|
return false;
|
|
5223
5266
|
}
|
|
@@ -5469,10 +5512,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
5469
5512
|
repo_slug: this.platformConfig.repositoryName,
|
|
5470
5513
|
state: "OPEN"
|
|
5471
5514
|
}).then(({ data: { values } }) => {
|
|
5472
|
-
return _optionalChain([values, 'optionalAccess',
|
|
5473
|
-
({ source, destination }) => _optionalChain([source, 'optionalAccess',
|
|
5515
|
+
return _optionalChain([values, 'optionalAccess', _173 => _173.find, 'call', _174 => _174(
|
|
5516
|
+
({ source, destination }) => _optionalChain([source, 'optionalAccess', _175 => _175.branch, 'optionalAccess', _176 => _176.name]) === branch && _optionalChain([destination, 'optionalAccess', _177 => _177.branch, 'optionalAccess', _178 => _178.name]) === this.platformConfig.baseBranchName
|
|
5474
5517
|
)]);
|
|
5475
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
5518
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _179 => _179.id]));
|
|
5476
5519
|
}
|
|
5477
5520
|
async closePullRequest({ pullRequestNumber }) {
|
|
5478
5521
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -5568,7 +5611,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
5568
5611
|
repo: this.platformConfig.repositoryName,
|
|
5569
5612
|
base: this.platformConfig.baseBranchName,
|
|
5570
5613
|
state: "open"
|
|
5571
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
5614
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _180 => _180.number]));
|
|
5572
5615
|
}
|
|
5573
5616
|
async closePullRequest({ pullRequestNumber }) {
|
|
5574
5617
|
await this.octokit.rest.pulls.update({
|
|
@@ -5695,7 +5738,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
5695
5738
|
sourceBranch: branch,
|
|
5696
5739
|
state: "opened"
|
|
5697
5740
|
});
|
|
5698
|
-
return _optionalChain([mergeRequests, 'access',
|
|
5741
|
+
return _optionalChain([mergeRequests, 'access', _181 => _181[0], 'optionalAccess', _182 => _182.iid]);
|
|
5699
5742
|
}
|
|
5700
5743
|
async closePullRequest({
|
|
5701
5744
|
pullRequestNumber
|
|
@@ -5779,7 +5822,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
5779
5822
|
}
|
|
5780
5823
|
const env = {
|
|
5781
5824
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
5782
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
5825
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _183 => _183.pullRequest, 'optionalAccess', _184 => _184.toString, 'call', _185 => _185()]) || "false",
|
|
5783
5826
|
...options.commitMessage && {
|
|
5784
5827
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
5785
5828
|
},
|
|
@@ -5799,7 +5842,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
5799
5842
|
const { isPullRequestMode } = platformKit.config;
|
|
5800
5843
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
5801
5844
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
5802
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
5845
|
+
const canRun = await _optionalChain([flow, 'access', _186 => _186.preRun, 'optionalCall', _187 => _187()]);
|
|
5803
5846
|
if (canRun === false) {
|
|
5804
5847
|
return;
|
|
5805
5848
|
}
|
|
@@ -5807,7 +5850,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
5807
5850
|
if (!hasChanges) {
|
|
5808
5851
|
return;
|
|
5809
5852
|
}
|
|
5810
|
-
await _optionalChain([flow, 'access',
|
|
5853
|
+
await _optionalChain([flow, 'access', _188 => _188.postRun, 'optionalCall', _189 => _189()]);
|
|
5811
5854
|
});
|
|
5812
5855
|
|
|
5813
5856
|
// src/cli/cmd/status.ts
|
|
@@ -5851,13 +5894,13 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
5851
5894
|
flags
|
|
5852
5895
|
});
|
|
5853
5896
|
let buckets = getBuckets(i18nConfig);
|
|
5854
|
-
if (_optionalChain([flags, 'access',
|
|
5897
|
+
if (_optionalChain([flags, 'access', _190 => _190.bucket, 'optionalAccess', _191 => _191.length])) {
|
|
5855
5898
|
buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
|
|
5856
5899
|
}
|
|
5857
5900
|
ora.succeed("Buckets retrieved");
|
|
5858
|
-
if (_optionalChain([flags, 'access',
|
|
5901
|
+
if (_optionalChain([flags, 'access', _192 => _192.file, 'optionalAccess', _193 => _193.length])) {
|
|
5859
5902
|
buckets = buckets.map((bucket) => {
|
|
5860
|
-
const paths = bucket.paths.filter((path17) => flags.file.find((file) => _optionalChain([path17, 'access',
|
|
5903
|
+
const paths = bucket.paths.filter((path17) => flags.file.find((file) => _optionalChain([path17, 'access', _194 => _194.pathPattern, 'optionalAccess', _195 => _195.match, 'call', _196 => _196(file)])));
|
|
5861
5904
|
return { ...bucket, paths };
|
|
5862
5905
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
5863
5906
|
if (buckets.length === 0) {
|
|
@@ -5873,7 +5916,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
5873
5916
|
});
|
|
5874
5917
|
}
|
|
5875
5918
|
}
|
|
5876
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
5919
|
+
const targetLocales = _optionalChain([flags, 'access', _197 => _197.locale, 'optionalAccess', _198 => _198.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
5877
5920
|
let totalSourceKeyCount = 0;
|
|
5878
5921
|
let uniqueKeysToTranslate = 0;
|
|
5879
5922
|
let totalExistingTranslations = 0;
|
|
@@ -6214,12 +6257,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
6214
6257
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
6215
6258
|
docUrl: "bucketNotFound"
|
|
6216
6259
|
});
|
|
6217
|
-
} else if (_optionalChain([flags, 'access',
|
|
6260
|
+
} else if (_optionalChain([flags, 'access', _199 => _199.locale, 'optionalAccess', _200 => _200.some, 'call', _201 => _201((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
6218
6261
|
throw new CLIError({
|
|
6219
6262
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
6220
6263
|
docUrl: "localeTargetNotFound"
|
|
6221
6264
|
});
|
|
6222
|
-
} else if (_optionalChain([flags, 'access',
|
|
6265
|
+
} else if (_optionalChain([flags, 'access', _202 => _202.bucket, 'optionalAccess', _203 => _203.some, 'call', _204 => _204((bucket) => !i18nConfig.buckets[bucket])])) {
|
|
6223
6266
|
throw new CLIError({
|
|
6224
6267
|
message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
|
|
6225
6268
|
docUrl: "bucketNotFound"
|
|
@@ -6302,7 +6345,7 @@ async function renderHero() {
|
|
|
6302
6345
|
// package.json
|
|
6303
6346
|
var package_default = {
|
|
6304
6347
|
name: "lingo.dev",
|
|
6305
|
-
version: "0.92.
|
|
6348
|
+
version: "0.92.8",
|
|
6306
6349
|
description: "Lingo.dev CLI",
|
|
6307
6350
|
private: false,
|
|
6308
6351
|
publishConfig: {
|