lingo.dev 0.92.6 → 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 +169 -135
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +119 -85
- 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
|
|
|
@@ -4070,18 +4111,6 @@ async function trackEvent(distinctId, event, properties) {
|
|
|
4070
4111
|
try {
|
|
4071
4112
|
const actualId = distinctId || `device-${machineIdSync()}`;
|
|
4072
4113
|
const { PostHog } = await Promise.resolve().then(() => _interopRequireWildcard(require("posthog-node")));
|
|
4073
|
-
const safeProperties = properties ? JSON.parse(
|
|
4074
|
-
JSON.stringify(properties, (key, value) => {
|
|
4075
|
-
if (value instanceof Error) {
|
|
4076
|
-
return {
|
|
4077
|
-
name: value.name,
|
|
4078
|
-
message: value.message,
|
|
4079
|
-
stack: value.stack
|
|
4080
|
-
};
|
|
4081
|
-
}
|
|
4082
|
-
return value;
|
|
4083
|
-
})
|
|
4084
|
-
) : {};
|
|
4085
4114
|
const posthog = new PostHog(
|
|
4086
4115
|
"phc_eR0iSoQufBxNY36k0f0T15UvHJdTfHlh8rJcxsfhfXk",
|
|
4087
4116
|
{
|
|
@@ -4094,7 +4123,7 @@ async function trackEvent(distinctId, event, properties) {
|
|
|
4094
4123
|
distinctId: actualId,
|
|
4095
4124
|
event,
|
|
4096
4125
|
properties: {
|
|
4097
|
-
...
|
|
4126
|
+
...properties,
|
|
4098
4127
|
meta: {
|
|
4099
4128
|
version: process.env.npm_package_version,
|
|
4100
4129
|
isCi: process.env.CI === "true"
|
|
@@ -4277,7 +4306,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
4277
4306
|
validateParams(i18nConfig, flags);
|
|
4278
4307
|
ora.succeed("Localization configuration is valid");
|
|
4279
4308
|
ora.start("Connecting to Lingo.dev Localization Engine...");
|
|
4280
|
-
const isByokMode = _optionalChain([i18nConfig, 'optionalAccess',
|
|
4309
|
+
const isByokMode = _optionalChain([i18nConfig, 'optionalAccess', _153 => _153.provider]) && i18nConfig.provider.id !== "lingo";
|
|
4281
4310
|
if (isByokMode) {
|
|
4282
4311
|
authId = null;
|
|
4283
4312
|
ora.succeed("Using external provider (BYOK mode)");
|
|
@@ -4291,16 +4320,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
4291
4320
|
flags
|
|
4292
4321
|
});
|
|
4293
4322
|
let buckets = getBuckets(i18nConfig);
|
|
4294
|
-
if (_optionalChain([flags, 'access',
|
|
4323
|
+
if (_optionalChain([flags, 'access', _154 => _154.bucket, 'optionalAccess', _155 => _155.length])) {
|
|
4295
4324
|
buckets = buckets.filter(
|
|
4296
4325
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
4297
4326
|
);
|
|
4298
4327
|
}
|
|
4299
4328
|
ora.succeed("Buckets retrieved");
|
|
4300
|
-
if (_optionalChain([flags, 'access',
|
|
4329
|
+
if (_optionalChain([flags, 'access', _156 => _156.file, 'optionalAccess', _157 => _157.length])) {
|
|
4301
4330
|
buckets = buckets.map((bucket) => {
|
|
4302
4331
|
const paths = bucket.paths.filter(
|
|
4303
|
-
(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)]))
|
|
4304
4333
|
);
|
|
4305
4334
|
return { ...bucket, paths };
|
|
4306
4335
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -4319,7 +4348,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
4319
4348
|
});
|
|
4320
4349
|
}
|
|
4321
4350
|
}
|
|
4322
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
4351
|
+
const targetLocales = _optionalChain([flags, 'access', _161 => _161.locale, 'optionalAccess', _162 => _162.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
4323
4352
|
ora.start("Setting up localization cache...");
|
|
4324
4353
|
const checkLockfileProcessor = createDeltaProcessor("");
|
|
4325
4354
|
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
@@ -4340,7 +4369,8 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
4340
4369
|
injectLocale: bucket.injectLocale
|
|
4341
4370
|
},
|
|
4342
4371
|
bucket.lockedKeys,
|
|
4343
|
-
bucket.lockedPatterns
|
|
4372
|
+
bucket.lockedPatterns,
|
|
4373
|
+
bucket.ignoredKeys
|
|
4344
4374
|
);
|
|
4345
4375
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
4346
4376
|
await bucketLoader.init();
|
|
@@ -4527,7 +4557,8 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
4527
4557
|
injectLocale: bucket.injectLocale
|
|
4528
4558
|
},
|
|
4529
4559
|
bucket.lockedKeys,
|
|
4530
|
-
bucket.lockedPatterns
|
|
4560
|
+
bucket.lockedPatterns,
|
|
4561
|
+
bucket.ignoredKeys
|
|
4531
4562
|
);
|
|
4532
4563
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
4533
4564
|
await bucketLoader.init();
|
|
@@ -4558,7 +4589,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
4558
4589
|
if (flags.key) {
|
|
4559
4590
|
processableData = _lodash2.default.pickBy(
|
|
4560
4591
|
processableData,
|
|
4561
|
-
(
|
|
4592
|
+
(_28, key) => key === flags.key
|
|
4562
4593
|
);
|
|
4563
4594
|
}
|
|
4564
4595
|
if (flags.verbose) {
|
|
@@ -4668,6 +4699,9 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
4668
4699
|
});
|
|
4669
4700
|
} else {
|
|
4670
4701
|
ora.warn("Localization completed with errors.");
|
|
4702
|
+
trackEvent(authId || "unknown", "cmd.i18n.error", {
|
|
4703
|
+
flags
|
|
4704
|
+
});
|
|
4671
4705
|
}
|
|
4672
4706
|
} catch (error) {
|
|
4673
4707
|
ora.fail(error.message);
|
|
@@ -4724,12 +4758,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
4724
4758
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
4725
4759
|
docUrl: "bucketNotFound"
|
|
4726
4760
|
});
|
|
4727
|
-
} 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))])) {
|
|
4728
4762
|
throw new CLIError({
|
|
4729
4763
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
4730
4764
|
docUrl: "localeTargetNotFound"
|
|
4731
4765
|
});
|
|
4732
|
-
} else if (_optionalChain([flags, 'access',
|
|
4766
|
+
} else if (_optionalChain([flags, 'access', _166 => _166.bucket, 'optionalAccess', _167 => _167.some, 'call', _168 => _168(
|
|
4733
4767
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
4734
4768
|
)])) {
|
|
4735
4769
|
throw new CLIError({
|
|
@@ -5057,7 +5091,7 @@ var _stdiojs = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
|
5057
5091
|
var _mcpjs = require('@modelcontextprotocol/sdk/server/mcp.js');
|
|
5058
5092
|
|
|
5059
5093
|
|
|
5060
|
-
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) => {
|
|
5061
5095
|
const apiKey = program.args[0];
|
|
5062
5096
|
const settings = getSettings(apiKey);
|
|
5063
5097
|
if (!settings.auth.apiKey) {
|
|
@@ -5194,7 +5228,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
5194
5228
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
5195
5229
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
5196
5230
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
5197
|
-
_optionalChain([this, 'access',
|
|
5231
|
+
_optionalChain([this, 'access', _169 => _169.platformKit, 'optionalAccess', _170 => _170.gitConfig, 'call', _171 => _171()]);
|
|
5198
5232
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
5199
5233
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
5200
5234
|
if (!processOwnCommits) {
|
|
@@ -5226,7 +5260,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
5226
5260
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
5227
5261
|
var PullRequestFlow = class extends InBranchFlow {
|
|
5228
5262
|
async preRun() {
|
|
5229
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
5263
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _172 => _172()]);
|
|
5230
5264
|
if (!canContinue) {
|
|
5231
5265
|
return false;
|
|
5232
5266
|
}
|
|
@@ -5478,10 +5512,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
5478
5512
|
repo_slug: this.platformConfig.repositoryName,
|
|
5479
5513
|
state: "OPEN"
|
|
5480
5514
|
}).then(({ data: { values } }) => {
|
|
5481
|
-
return _optionalChain([values, 'optionalAccess',
|
|
5482
|
-
({ 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
|
|
5483
5517
|
)]);
|
|
5484
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
5518
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _179 => _179.id]));
|
|
5485
5519
|
}
|
|
5486
5520
|
async closePullRequest({ pullRequestNumber }) {
|
|
5487
5521
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -5577,7 +5611,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
5577
5611
|
repo: this.platformConfig.repositoryName,
|
|
5578
5612
|
base: this.platformConfig.baseBranchName,
|
|
5579
5613
|
state: "open"
|
|
5580
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
5614
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _180 => _180.number]));
|
|
5581
5615
|
}
|
|
5582
5616
|
async closePullRequest({ pullRequestNumber }) {
|
|
5583
5617
|
await this.octokit.rest.pulls.update({
|
|
@@ -5704,7 +5738,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
5704
5738
|
sourceBranch: branch,
|
|
5705
5739
|
state: "opened"
|
|
5706
5740
|
});
|
|
5707
|
-
return _optionalChain([mergeRequests, 'access',
|
|
5741
|
+
return _optionalChain([mergeRequests, 'access', _181 => _181[0], 'optionalAccess', _182 => _182.iid]);
|
|
5708
5742
|
}
|
|
5709
5743
|
async closePullRequest({
|
|
5710
5744
|
pullRequestNumber
|
|
@@ -5788,7 +5822,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
5788
5822
|
}
|
|
5789
5823
|
const env = {
|
|
5790
5824
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
5791
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
5825
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _183 => _183.pullRequest, 'optionalAccess', _184 => _184.toString, 'call', _185 => _185()]) || "false",
|
|
5792
5826
|
...options.commitMessage && {
|
|
5793
5827
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
5794
5828
|
},
|
|
@@ -5808,7 +5842,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
5808
5842
|
const { isPullRequestMode } = platformKit.config;
|
|
5809
5843
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
5810
5844
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
5811
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
5845
|
+
const canRun = await _optionalChain([flow, 'access', _186 => _186.preRun, 'optionalCall', _187 => _187()]);
|
|
5812
5846
|
if (canRun === false) {
|
|
5813
5847
|
return;
|
|
5814
5848
|
}
|
|
@@ -5816,7 +5850,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
5816
5850
|
if (!hasChanges) {
|
|
5817
5851
|
return;
|
|
5818
5852
|
}
|
|
5819
|
-
await _optionalChain([flow, 'access',
|
|
5853
|
+
await _optionalChain([flow, 'access', _188 => _188.postRun, 'optionalCall', _189 => _189()]);
|
|
5820
5854
|
});
|
|
5821
5855
|
|
|
5822
5856
|
// src/cli/cmd/status.ts
|
|
@@ -5860,13 +5894,13 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
5860
5894
|
flags
|
|
5861
5895
|
});
|
|
5862
5896
|
let buckets = getBuckets(i18nConfig);
|
|
5863
|
-
if (_optionalChain([flags, 'access',
|
|
5897
|
+
if (_optionalChain([flags, 'access', _190 => _190.bucket, 'optionalAccess', _191 => _191.length])) {
|
|
5864
5898
|
buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
|
|
5865
5899
|
}
|
|
5866
5900
|
ora.succeed("Buckets retrieved");
|
|
5867
|
-
if (_optionalChain([flags, 'access',
|
|
5901
|
+
if (_optionalChain([flags, 'access', _192 => _192.file, 'optionalAccess', _193 => _193.length])) {
|
|
5868
5902
|
buckets = buckets.map((bucket) => {
|
|
5869
|
-
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)])));
|
|
5870
5904
|
return { ...bucket, paths };
|
|
5871
5905
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
5872
5906
|
if (buckets.length === 0) {
|
|
@@ -5882,7 +5916,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
5882
5916
|
});
|
|
5883
5917
|
}
|
|
5884
5918
|
}
|
|
5885
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
5919
|
+
const targetLocales = _optionalChain([flags, 'access', _197 => _197.locale, 'optionalAccess', _198 => _198.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
5886
5920
|
let totalSourceKeyCount = 0;
|
|
5887
5921
|
let uniqueKeysToTranslate = 0;
|
|
5888
5922
|
let totalExistingTranslations = 0;
|
|
@@ -6223,12 +6257,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
6223
6257
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
6224
6258
|
docUrl: "bucketNotFound"
|
|
6225
6259
|
});
|
|
6226
|
-
} 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))])) {
|
|
6227
6261
|
throw new CLIError({
|
|
6228
6262
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
6229
6263
|
docUrl: "localeTargetNotFound"
|
|
6230
6264
|
});
|
|
6231
|
-
} 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])])) {
|
|
6232
6266
|
throw new CLIError({
|
|
6233
6267
|
message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
|
|
6234
6268
|
docUrl: "bucketNotFound"
|
|
@@ -6311,7 +6345,7 @@ async function renderHero() {
|
|
|
6311
6345
|
// package.json
|
|
6312
6346
|
var package_default = {
|
|
6313
6347
|
name: "lingo.dev",
|
|
6314
|
-
version: "0.92.
|
|
6348
|
+
version: "0.92.8",
|
|
6315
6349
|
description: "Lingo.dev CLI",
|
|
6316
6350
|
private: false,
|
|
6317
6351
|
publishConfig: {
|