lingo.dev 0.111.16 → 0.112.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli.cjs +276 -110
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +193 -27
- package/build/cli.mjs.map +1 -1
- package/package.json +5 -4
package/build/cli.cjs
CHANGED
|
@@ -2713,6 +2713,133 @@ ${content}`;
|
|
|
2713
2713
|
});
|
|
2714
2714
|
}
|
|
2715
2715
|
|
|
2716
|
+
// src/cli/loaders/markdoc.ts
|
|
2717
|
+
var _markdoc = require('@markdoc/markdoc'); var _markdoc2 = _interopRequireDefault(_markdoc);
|
|
2718
|
+
|
|
2719
|
+
var FM_ATTR_PREFIX2 = "fm-attr-";
|
|
2720
|
+
function createMarkdocLoader() {
|
|
2721
|
+
return createLoader({
|
|
2722
|
+
async pull(locale, input2) {
|
|
2723
|
+
const ast = _markdoc2.default.parse(input2);
|
|
2724
|
+
const result = {};
|
|
2725
|
+
const counters = {};
|
|
2726
|
+
traverseAndExtract(ast, "", result, counters);
|
|
2727
|
+
if (_optionalChain([ast, 'access', _130 => _130.attributes, 'optionalAccess', _131 => _131.frontmatter])) {
|
|
2728
|
+
const frontmatter = _yaml2.default.parse(ast.attributes.frontmatter);
|
|
2729
|
+
Object.entries(frontmatter).forEach(([key, value]) => {
|
|
2730
|
+
if (typeof value === "string") {
|
|
2731
|
+
result[`${FM_ATTR_PREFIX2}${key}`] = value;
|
|
2732
|
+
}
|
|
2733
|
+
});
|
|
2734
|
+
}
|
|
2735
|
+
return result;
|
|
2736
|
+
},
|
|
2737
|
+
async push(locale, data, originalInput) {
|
|
2738
|
+
if (!originalInput) {
|
|
2739
|
+
throw new Error("Original input is required for push");
|
|
2740
|
+
}
|
|
2741
|
+
const ast = _markdoc2.default.parse(originalInput);
|
|
2742
|
+
const counters = {};
|
|
2743
|
+
const pathMap = {};
|
|
2744
|
+
buildPathMap(ast, "", counters, pathMap);
|
|
2745
|
+
const frontmatterEntries = Object.entries(data).filter(([key]) => key.startsWith(FM_ATTR_PREFIX2)).map(([key, value]) => [key.replace(FM_ATTR_PREFIX2, ""), value]);
|
|
2746
|
+
if (frontmatterEntries.length > 0 && ast.attributes) {
|
|
2747
|
+
const frontmatter = Object.fromEntries(frontmatterEntries);
|
|
2748
|
+
ast.attributes.frontmatter = _yaml2.default.stringify(frontmatter, {
|
|
2749
|
+
defaultStringType: "PLAIN"
|
|
2750
|
+
}).trim();
|
|
2751
|
+
}
|
|
2752
|
+
const contentData = Object.fromEntries(
|
|
2753
|
+
Object.entries(data).filter(([key]) => !key.startsWith(FM_ATTR_PREFIX2))
|
|
2754
|
+
);
|
|
2755
|
+
applyTranslations(ast, "", contentData, pathMap);
|
|
2756
|
+
return _markdoc2.default.format(ast);
|
|
2757
|
+
}
|
|
2758
|
+
});
|
|
2759
|
+
}
|
|
2760
|
+
function getSemanticNodeType(node) {
|
|
2761
|
+
if (node.type === "tag") return node.tag || "tag";
|
|
2762
|
+
return node.type;
|
|
2763
|
+
}
|
|
2764
|
+
function traverseAndExtract(node, path19, result, counters, parentType) {
|
|
2765
|
+
if (!node || typeof node !== "object") {
|
|
2766
|
+
return;
|
|
2767
|
+
}
|
|
2768
|
+
let semanticType = parentType;
|
|
2769
|
+
const nodeSemanticType = getSemanticNodeType(node);
|
|
2770
|
+
if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
|
|
2771
|
+
semanticType = nodeSemanticType;
|
|
2772
|
+
}
|
|
2773
|
+
if (node.type === "text" && _optionalChain([node, 'access', _132 => _132.attributes, 'optionalAccess', _133 => _133.content])) {
|
|
2774
|
+
const content = node.attributes.content;
|
|
2775
|
+
if (typeof content === "string" && content.trim()) {
|
|
2776
|
+
if (semanticType) {
|
|
2777
|
+
const index = counters[semanticType] || 0;
|
|
2778
|
+
counters[semanticType] = index + 1;
|
|
2779
|
+
const semanticKey = `${semanticType}-${index}`;
|
|
2780
|
+
result[semanticKey] = content;
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2783
|
+
}
|
|
2784
|
+
if (Array.isArray(node.children)) {
|
|
2785
|
+
node.children.forEach((child, index) => {
|
|
2786
|
+
const childPath = path19 ? `${path19}/children/${index}` : `children/${index}`;
|
|
2787
|
+
traverseAndExtract(child, childPath, result, counters, semanticType);
|
|
2788
|
+
});
|
|
2789
|
+
}
|
|
2790
|
+
}
|
|
2791
|
+
function buildPathMap(node, path19, counters, pathMap, parentType) {
|
|
2792
|
+
if (!node || typeof node !== "object") {
|
|
2793
|
+
return;
|
|
2794
|
+
}
|
|
2795
|
+
let semanticType = parentType;
|
|
2796
|
+
const nodeSemanticType = getSemanticNodeType(node);
|
|
2797
|
+
if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
|
|
2798
|
+
semanticType = nodeSemanticType;
|
|
2799
|
+
}
|
|
2800
|
+
if (node.type === "text" && _optionalChain([node, 'access', _134 => _134.attributes, 'optionalAccess', _135 => _135.content])) {
|
|
2801
|
+
const content = node.attributes.content;
|
|
2802
|
+
if (typeof content === "string" && content.trim()) {
|
|
2803
|
+
if (semanticType) {
|
|
2804
|
+
const index = counters[semanticType] || 0;
|
|
2805
|
+
counters[semanticType] = index + 1;
|
|
2806
|
+
const semanticKey = `${semanticType}-${index}`;
|
|
2807
|
+
const contentPath = path19 ? `${path19}/attributes/content` : "attributes/content";
|
|
2808
|
+
pathMap[semanticKey] = contentPath;
|
|
2809
|
+
}
|
|
2810
|
+
}
|
|
2811
|
+
}
|
|
2812
|
+
if (Array.isArray(node.children)) {
|
|
2813
|
+
node.children.forEach((child, index) => {
|
|
2814
|
+
const childPath = path19 ? `${path19}/children/${index}` : `children/${index}`;
|
|
2815
|
+
buildPathMap(child, childPath, counters, pathMap, semanticType);
|
|
2816
|
+
});
|
|
2817
|
+
}
|
|
2818
|
+
}
|
|
2819
|
+
function applyTranslations(node, path19, data, pathMap) {
|
|
2820
|
+
if (!node || typeof node !== "object") {
|
|
2821
|
+
return;
|
|
2822
|
+
}
|
|
2823
|
+
if (node.type === "text" && _optionalChain([node, 'access', _136 => _136.attributes, 'optionalAccess', _137 => _137.content])) {
|
|
2824
|
+
const content = node.attributes.content;
|
|
2825
|
+
if (typeof content === "string") {
|
|
2826
|
+
const contentPath = path19 ? `${path19}/attributes/content` : "attributes/content";
|
|
2827
|
+
const semanticKey = Object.keys(pathMap).find(
|
|
2828
|
+
(key) => pathMap[key] === contentPath
|
|
2829
|
+
);
|
|
2830
|
+
if (semanticKey && data[semanticKey] !== void 0) {
|
|
2831
|
+
node.attributes.content = data[semanticKey];
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
}
|
|
2835
|
+
if (Array.isArray(node.children)) {
|
|
2836
|
+
node.children.forEach((child, index) => {
|
|
2837
|
+
const childPath = path19 ? `${path19}/children/${index}` : `children/${index}`;
|
|
2838
|
+
applyTranslations(child, childPath, data, pathMap);
|
|
2839
|
+
});
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
2842
|
+
|
|
2716
2843
|
// src/cli/loaders/properties.ts
|
|
2717
2844
|
function createPropertiesLoader() {
|
|
2718
2845
|
return createLoader({
|
|
@@ -2743,7 +2870,7 @@ function isSkippableLine(line) {
|
|
|
2743
2870
|
function parsePropertyLine(line) {
|
|
2744
2871
|
const [key, ...valueParts] = line.split("=");
|
|
2745
2872
|
return {
|
|
2746
|
-
key: _optionalChain([key, 'optionalAccess',
|
|
2873
|
+
key: _optionalChain([key, 'optionalAccess', _138 => _138.trim, 'call', _139 => _139()]) || "",
|
|
2747
2874
|
value: valueParts.join("=").trim()
|
|
2748
2875
|
};
|
|
2749
2876
|
}
|
|
@@ -2831,7 +2958,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
2831
2958
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
2832
2959
|
continue;
|
|
2833
2960
|
}
|
|
2834
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
2961
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _140 => _140.localizations, 'optionalAccess', _141 => _141[locale]]);
|
|
2835
2962
|
if (langTranslationEntity) {
|
|
2836
2963
|
if ("stringUnit" in langTranslationEntity) {
|
|
2837
2964
|
resultData[translationKey] = langTranslationEntity.stringUnit.value;
|
|
@@ -2840,7 +2967,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
2840
2967
|
resultData[translationKey] = {};
|
|
2841
2968
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
2842
2969
|
for (const form in pluralForms) {
|
|
2843
|
-
if (_optionalChain([pluralForms, 'access',
|
|
2970
|
+
if (_optionalChain([pluralForms, 'access', _142 => _142[form], 'optionalAccess', _143 => _143.stringUnit, 'optionalAccess', _144 => _144.value])) {
|
|
2844
2971
|
resultData[translationKey][form] = pluralForms[form].stringUnit.value;
|
|
2845
2972
|
}
|
|
2846
2973
|
}
|
|
@@ -2866,7 +2993,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
2866
2993
|
const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
|
|
2867
2994
|
if (typeof value === "string") {
|
|
2868
2995
|
langDataToMerge.strings[key] = {
|
|
2869
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
2996
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _145 => _145.strings, 'optionalAccess', _146 => _146[key], 'optionalAccess', _147 => _147.extractionState]),
|
|
2870
2997
|
localizations: {
|
|
2871
2998
|
[locale]: {
|
|
2872
2999
|
stringUnit: {
|
|
@@ -2924,7 +3051,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
2924
3051
|
for (const [locale, localization] of Object.entries(
|
|
2925
3052
|
entity.localizations
|
|
2926
3053
|
)) {
|
|
2927
|
-
if (_optionalChain([localization, 'access',
|
|
3054
|
+
if (_optionalChain([localization, 'access', _148 => _148.variations, 'optionalAccess', _149 => _149.plural])) {
|
|
2928
3055
|
const pluralForms = localization.variations.plural;
|
|
2929
3056
|
for (const form in pluralForms) {
|
|
2930
3057
|
const pluralKey = `${translationKey}/${form}`;
|
|
@@ -2944,7 +3071,7 @@ function _removeLocale(input2, locale) {
|
|
|
2944
3071
|
const { strings } = input2;
|
|
2945
3072
|
const newStrings = _lodash2.default.cloneDeep(strings);
|
|
2946
3073
|
for (const [key, value] of Object.entries(newStrings)) {
|
|
2947
|
-
if (_optionalChain([value, 'access',
|
|
3074
|
+
if (_optionalChain([value, 'access', _150 => _150.localizations, 'optionalAccess', _151 => _151[locale]])) {
|
|
2948
3075
|
delete value.localizations[locale];
|
|
2949
3076
|
}
|
|
2950
3077
|
}
|
|
@@ -3147,8 +3274,8 @@ async function formatDataWithBiome(data, filePath, options) {
|
|
|
3147
3274
|
});
|
|
3148
3275
|
return formatted.content;
|
|
3149
3276
|
} catch (error) {
|
|
3150
|
-
const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access',
|
|
3151
|
-
if (_optionalChain([errorMessage, 'optionalAccess',
|
|
3277
|
+
const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access', _152 => _152.stackTrace, 'optionalAccess', _153 => _153.toString, 'call', _154 => _154(), 'access', _155 => _155.split, 'call', _156 => _156("\n"), 'access', _157 => _157[0]]) : "";
|
|
3278
|
+
if (_optionalChain([errorMessage, 'optionalAccess', _158 => _158.includes, 'call', _159 => _159("does not exist in the workspace")])) {
|
|
3152
3279
|
} else {
|
|
3153
3280
|
console.log(`\u26A0\uFE0F Biome skipped ${path14.default.basename(filePath)}`);
|
|
3154
3281
|
if (errorMessage) {
|
|
@@ -3195,7 +3322,7 @@ function createPoDataLoader(params) {
|
|
|
3195
3322
|
Object.entries(entries).forEach(([msgid, entry]) => {
|
|
3196
3323
|
if (msgid && entry.msgid) {
|
|
3197
3324
|
const context = entry.msgctxt || "";
|
|
3198
|
-
const fullEntry = _optionalChain([parsedPo, 'access',
|
|
3325
|
+
const fullEntry = _optionalChain([parsedPo, 'access', _160 => _160.translations, 'access', _161 => _161[context], 'optionalAccess', _162 => _162[msgid]]);
|
|
3199
3326
|
if (fullEntry) {
|
|
3200
3327
|
result[msgid] = fullEntry;
|
|
3201
3328
|
}
|
|
@@ -3205,8 +3332,8 @@ function createPoDataLoader(params) {
|
|
|
3205
3332
|
return result;
|
|
3206
3333
|
},
|
|
3207
3334
|
async push(locale, data, originalInput, originalLocale, pullInput) {
|
|
3208
|
-
const currentSections = _optionalChain([pullInput, 'optionalAccess',
|
|
3209
|
-
const originalSections = _optionalChain([originalInput, 'optionalAccess',
|
|
3335
|
+
const currentSections = _optionalChain([pullInput, 'optionalAccess', _163 => _163.split, 'call', _164 => _164("\n\n"), 'access', _165 => _165.filter, 'call', _166 => _166(Boolean)]) || [];
|
|
3336
|
+
const originalSections = _optionalChain([originalInput, 'optionalAccess', _167 => _167.split, 'call', _168 => _168("\n\n"), 'access', _169 => _169.filter, 'call', _170 => _170(Boolean)]) || [];
|
|
3210
3337
|
const result = originalSections.map((section) => {
|
|
3211
3338
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
3212
3339
|
if (Object.keys(sectionPo.translations).length === 0) {
|
|
@@ -3275,8 +3402,8 @@ function createPoContentLoader() {
|
|
|
3275
3402
|
{
|
|
3276
3403
|
...entry,
|
|
3277
3404
|
msgstr: [
|
|
3278
|
-
_optionalChain([data, 'access',
|
|
3279
|
-
_optionalChain([data, 'access',
|
|
3405
|
+
_optionalChain([data, 'access', _171 => _171[entry.msgid], 'optionalAccess', _172 => _172.singular]),
|
|
3406
|
+
_optionalChain([data, 'access', _173 => _173[entry.msgid], 'optionalAccess', _174 => _174.plural]) || null
|
|
3280
3407
|
].filter(Boolean)
|
|
3281
3408
|
}
|
|
3282
3409
|
]).fromPairs().value();
|
|
@@ -3398,7 +3525,7 @@ function pullV1(xliffElement, locale, originalLocale) {
|
|
|
3398
3525
|
let key = getTransUnitKey(unit);
|
|
3399
3526
|
if (!key) return;
|
|
3400
3527
|
if (seenKeys.has(key)) {
|
|
3401
|
-
const id = _optionalChain([unit, 'access',
|
|
3528
|
+
const id = _optionalChain([unit, 'access', _175 => _175.getAttribute, 'call', _176 => _176("id"), 'optionalAccess', _177 => _177.trim, 'call', _178 => _178()]);
|
|
3402
3529
|
if (id) {
|
|
3403
3530
|
key = `${key}#${id}`;
|
|
3404
3531
|
} else {
|
|
@@ -3446,7 +3573,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
3446
3573
|
let key = getTransUnitKey(unit);
|
|
3447
3574
|
if (!key) return;
|
|
3448
3575
|
if (seenKeys.has(key)) {
|
|
3449
|
-
const id = _optionalChain([unit, 'access',
|
|
3576
|
+
const id = _optionalChain([unit, 'access', _179 => _179.getAttribute, 'call', _180 => _180("id"), 'optionalAccess', _181 => _181.trim, 'call', _182 => _182()]);
|
|
3450
3577
|
if (id) {
|
|
3451
3578
|
key = `${key}#${id}`;
|
|
3452
3579
|
} else {
|
|
@@ -3488,7 +3615,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
3488
3615
|
const translationKeys = new Set(Object.keys(translations));
|
|
3489
3616
|
existingUnits.forEach((unit, key) => {
|
|
3490
3617
|
if (!translationKeys.has(key)) {
|
|
3491
|
-
_optionalChain([unit, 'access',
|
|
3618
|
+
_optionalChain([unit, 'access', _183 => _183.parentNode, 'optionalAccess', _184 => _184.removeChild, 'call', _185 => _185(unit)]);
|
|
3492
3619
|
}
|
|
3493
3620
|
});
|
|
3494
3621
|
return serializeWithDeclaration(
|
|
@@ -3531,18 +3658,18 @@ function traverseUnitsV2(container, fileId, currentPath, result) {
|
|
|
3531
3658
|
Array.from(container.children).forEach((child) => {
|
|
3532
3659
|
const tagName = child.tagName;
|
|
3533
3660
|
if (tagName === "unit") {
|
|
3534
|
-
const unitId = _optionalChain([child, 'access',
|
|
3661
|
+
const unitId = _optionalChain([child, 'access', _186 => _186.getAttribute, 'call', _187 => _187("id"), 'optionalAccess', _188 => _188.trim, 'call', _189 => _189()]);
|
|
3535
3662
|
if (!unitId) return;
|
|
3536
3663
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
3537
3664
|
const segment = child.querySelector("segment");
|
|
3538
|
-
const source = _optionalChain([segment, 'optionalAccess',
|
|
3665
|
+
const source = _optionalChain([segment, 'optionalAccess', _190 => _190.querySelector, 'call', _191 => _191("source")]);
|
|
3539
3666
|
if (source) {
|
|
3540
3667
|
result[key] = extractTextContent(source);
|
|
3541
3668
|
} else {
|
|
3542
3669
|
result[key] = unitId;
|
|
3543
3670
|
}
|
|
3544
3671
|
} else if (tagName === "group") {
|
|
3545
|
-
const groupId = _optionalChain([child, 'access',
|
|
3672
|
+
const groupId = _optionalChain([child, 'access', _192 => _192.getAttribute, 'call', _193 => _193("id"), 'optionalAccess', _194 => _194.trim, 'call', _195 => _195()]);
|
|
3546
3673
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
3547
3674
|
traverseUnitsV2(child, fileId, newPath, result);
|
|
3548
3675
|
}
|
|
@@ -3578,12 +3705,12 @@ function indexUnitsV2(container, fileId, currentPath, index) {
|
|
|
3578
3705
|
Array.from(container.children).forEach((child) => {
|
|
3579
3706
|
const tagName = child.tagName;
|
|
3580
3707
|
if (tagName === "unit") {
|
|
3581
|
-
const unitId = _optionalChain([child, 'access',
|
|
3708
|
+
const unitId = _optionalChain([child, 'access', _196 => _196.getAttribute, 'call', _197 => _197("id"), 'optionalAccess', _198 => _198.trim, 'call', _199 => _199()]);
|
|
3582
3709
|
if (!unitId) return;
|
|
3583
3710
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
3584
3711
|
index.set(key, child);
|
|
3585
3712
|
} else if (tagName === "group") {
|
|
3586
|
-
const groupId = _optionalChain([child, 'access',
|
|
3713
|
+
const groupId = _optionalChain([child, 'access', _200 => _200.getAttribute, 'call', _201 => _201("id"), 'optionalAccess', _202 => _202.trim, 'call', _203 => _203()]);
|
|
3587
3714
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
3588
3715
|
indexUnitsV2(child, fileId, newPath, index);
|
|
3589
3716
|
}
|
|
@@ -3604,9 +3731,9 @@ function updateUnitV2(unit, value) {
|
|
|
3604
3731
|
setTextContent(source, value);
|
|
3605
3732
|
}
|
|
3606
3733
|
function getTransUnitKey(transUnit) {
|
|
3607
|
-
const resname = _optionalChain([transUnit, 'access',
|
|
3734
|
+
const resname = _optionalChain([transUnit, 'access', _204 => _204.getAttribute, 'call', _205 => _205("resname"), 'optionalAccess', _206 => _206.trim, 'call', _207 => _207()]);
|
|
3608
3735
|
if (resname) return resname;
|
|
3609
|
-
const id = _optionalChain([transUnit, 'access',
|
|
3736
|
+
const id = _optionalChain([transUnit, 'access', _208 => _208.getAttribute, 'call', _209 => _209("id"), 'optionalAccess', _210 => _210.trim, 'call', _211 => _211()]);
|
|
3610
3737
|
if (id) return id;
|
|
3611
3738
|
const sourceElement = transUnit.querySelector("source");
|
|
3612
3739
|
if (sourceElement) {
|
|
@@ -3663,7 +3790,7 @@ function formatXml(xml) {
|
|
|
3663
3790
|
if (cdataNode) {
|
|
3664
3791
|
return `${indent2}${openTag}<![CDATA[${cdataNode.nodeValue}]]></${tagName}>`;
|
|
3665
3792
|
}
|
|
3666
|
-
const textContent = _optionalChain([element, 'access',
|
|
3793
|
+
const textContent = _optionalChain([element, 'access', _212 => _212.textContent, 'optionalAccess', _213 => _213.trim, 'call', _214 => _214()]) || "";
|
|
3667
3794
|
const hasOnlyText = element.childNodes.length === 1 && element.childNodes[0].nodeType === 3;
|
|
3668
3795
|
if (hasOnlyText && textContent) {
|
|
3669
3796
|
return `${indent2}${openTag}${textContent}</${tagName}>`;
|
|
@@ -3956,7 +4083,7 @@ function createDatoClient(params) {
|
|
|
3956
4083
|
ids: !records.length ? void 0 : records.join(",")
|
|
3957
4084
|
}
|
|
3958
4085
|
}).catch(
|
|
3959
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
4086
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _215 => _215.response, 'optionalAccess', _216 => _216.body, 'optionalAccess', _217 => _217.data, 'optionalAccess', _218 => _218[0]]) || error)
|
|
3960
4087
|
);
|
|
3961
4088
|
},
|
|
3962
4089
|
findRecordsForModel: async (modelId, records) => {
|
|
@@ -3967,10 +4094,10 @@ function createDatoClient(params) {
|
|
|
3967
4094
|
filter: {
|
|
3968
4095
|
type: modelId,
|
|
3969
4096
|
only_valid: "true",
|
|
3970
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
4097
|
+
ids: !_optionalChain([records, 'optionalAccess', _219 => _219.length]) ? void 0 : records.join(",")
|
|
3971
4098
|
}
|
|
3972
4099
|
}).catch(
|
|
3973
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
4100
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _220 => _220.response, 'optionalAccess', _221 => _221.body, 'optionalAccess', _222 => _222.data, 'optionalAccess', _223 => _223[0]]) || error)
|
|
3974
4101
|
);
|
|
3975
4102
|
return result;
|
|
3976
4103
|
} catch (_error) {
|
|
@@ -3986,10 +4113,10 @@ function createDatoClient(params) {
|
|
|
3986
4113
|
updateRecord: async (id, payload) => {
|
|
3987
4114
|
try {
|
|
3988
4115
|
await dato.items.update(id, payload).catch(
|
|
3989
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
4116
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _224 => _224.response, 'optionalAccess', _225 => _225.body, 'optionalAccess', _226 => _226.data, 'optionalAccess', _227 => _227[0]]) || error)
|
|
3990
4117
|
);
|
|
3991
4118
|
} catch (_error) {
|
|
3992
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
4119
|
+
if (_optionalChain([_error, 'optionalAccess', _228 => _228.attributes, 'optionalAccess', _229 => _229.details, 'optionalAccess', _230 => _230.message])) {
|
|
3993
4120
|
throw new Error(
|
|
3994
4121
|
[
|
|
3995
4122
|
`${_error.attributes.details.message}`,
|
|
@@ -4011,10 +4138,10 @@ function createDatoClient(params) {
|
|
|
4011
4138
|
enableFieldLocalization: async (args) => {
|
|
4012
4139
|
try {
|
|
4013
4140
|
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch(
|
|
4014
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
4141
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _231 => _231.response, 'optionalAccess', _232 => _232.body, 'optionalAccess', _233 => _233.data, 'optionalAccess', _234 => _234[0]]) || error)
|
|
4015
4142
|
);
|
|
4016
4143
|
} catch (_error) {
|
|
4017
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
4144
|
+
if (_optionalChain([_error, 'optionalAccess', _235 => _235.attributes, 'optionalAccess', _236 => _236.code]) === "NOT_FOUND") {
|
|
4018
4145
|
throw new Error(
|
|
4019
4146
|
[
|
|
4020
4147
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -4022,7 +4149,7 @@ function createDatoClient(params) {
|
|
|
4022
4149
|
].join("\n\n")
|
|
4023
4150
|
);
|
|
4024
4151
|
}
|
|
4025
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
4152
|
+
if (_optionalChain([_error, 'optionalAccess', _237 => _237.attributes, 'optionalAccess', _238 => _238.details, 'optionalAccess', _239 => _239.message])) {
|
|
4026
4153
|
throw new Error(
|
|
4027
4154
|
[
|
|
4028
4155
|
`${_error.attributes.details.message}`,
|
|
@@ -4100,7 +4227,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
4100
4227
|
const records = await dato.findRecordsForModel(modelId);
|
|
4101
4228
|
const recordChoices = createRecordChoices(
|
|
4102
4229
|
records,
|
|
4103
|
-
_optionalChain([config, 'access',
|
|
4230
|
+
_optionalChain([config, 'access', _240 => _240.models, 'access', _241 => _241[modelId], 'optionalAccess', _242 => _242.records]) || [],
|
|
4104
4231
|
project
|
|
4105
4232
|
);
|
|
4106
4233
|
const selectedRecords = await promptRecordSelection(
|
|
@@ -4119,14 +4246,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
4119
4246
|
},
|
|
4120
4247
|
async pull(locale, input2, initCtx) {
|
|
4121
4248
|
const result = {};
|
|
4122
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
4123
|
-
let records = _optionalChain([initCtx, 'optionalAccess',
|
|
4249
|
+
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _243 => _243.models]) || {})) {
|
|
4250
|
+
let records = _optionalChain([initCtx, 'optionalAccess', _244 => _244.models, 'access', _245 => _245[modelId], 'access', _246 => _246.records]) || [];
|
|
4124
4251
|
const recordIds = records.map((record) => record.id);
|
|
4125
4252
|
records = await dato.findRecords(recordIds);
|
|
4126
4253
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
4127
4254
|
if (records.length > 0) {
|
|
4128
4255
|
result[modelId] = {
|
|
4129
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
4256
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _247 => _247.models, 'optionalAccess', _248 => _248[modelId], 'optionalAccess', _249 => _249.fields]) || [],
|
|
4130
4257
|
records
|
|
4131
4258
|
};
|
|
4132
4259
|
}
|
|
@@ -4189,7 +4316,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
4189
4316
|
return records.map((record) => ({
|
|
4190
4317
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
4191
4318
|
value: record.id,
|
|
4192
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
4319
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _250 => _250.includes, 'call', _251 => _251(record.id)])
|
|
4193
4320
|
}));
|
|
4194
4321
|
}
|
|
4195
4322
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -4508,7 +4635,7 @@ function createVttLoader() {
|
|
|
4508
4635
|
if (!input2) {
|
|
4509
4636
|
return "";
|
|
4510
4637
|
}
|
|
4511
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
4638
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _252 => _252.parse, 'call', _253 => _253(input2), 'optionalAccess', _254 => _254.cues]);
|
|
4512
4639
|
if (Object.keys(vtt).length === 0) {
|
|
4513
4640
|
return {};
|
|
4514
4641
|
} else {
|
|
@@ -4562,7 +4689,7 @@ function variableExtractLoader(params) {
|
|
|
4562
4689
|
for (let i = 0; i < matches.length; i++) {
|
|
4563
4690
|
const match2 = matches[i];
|
|
4564
4691
|
const currentValue = result[key].value;
|
|
4565
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
4692
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _255 => _255.replace, 'call', _256 => _256(match2, `{variable:${i}}`)]);
|
|
4566
4693
|
result[key].value = newValue;
|
|
4567
4694
|
result[key].variables[i] = match2;
|
|
4568
4695
|
}
|
|
@@ -4576,7 +4703,7 @@ function variableExtractLoader(params) {
|
|
|
4576
4703
|
for (let i = 0; i < valueObj.variables.length; i++) {
|
|
4577
4704
|
const variable = valueObj.variables[i];
|
|
4578
4705
|
const currentValue = result[key];
|
|
4579
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
4706
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _257 => _257.replace, 'call', _258 => _258(`{variable:${i}}`, variable)]);
|
|
4580
4707
|
result[key] = newValue;
|
|
4581
4708
|
}
|
|
4582
4709
|
}
|
|
@@ -4776,7 +4903,7 @@ function createVueJsonLoader() {
|
|
|
4776
4903
|
return createLoader({
|
|
4777
4904
|
pull: async (locale, input2, ctx) => {
|
|
4778
4905
|
const parsed = parseVueFile(input2);
|
|
4779
|
-
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess',
|
|
4906
|
+
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _259 => _259.i18n, 'optionalAccess', _260 => _260[locale]]), () => ( {}));
|
|
4780
4907
|
},
|
|
4781
4908
|
push: async (locale, data, originalInput) => {
|
|
4782
4909
|
const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
|
|
@@ -4961,7 +5088,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
|
|
|
4961
5088
|
objectExpression.properties.forEach((prop) => {
|
|
4962
5089
|
if (!t.isObjectProperty(prop)) return;
|
|
4963
5090
|
const key = getPropertyKey(prop);
|
|
4964
|
-
const incomingVal = _optionalChain([data, 'optionalAccess',
|
|
5091
|
+
const incomingVal = _optionalChain([data, 'optionalAccess', _261 => _261[key]]);
|
|
4965
5092
|
if (incomingVal === void 0) {
|
|
4966
5093
|
return;
|
|
4967
5094
|
}
|
|
@@ -4997,7 +5124,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
|
|
|
4997
5124
|
let modified = false;
|
|
4998
5125
|
arrayExpression.elements.forEach((element, index) => {
|
|
4999
5126
|
if (!element) return;
|
|
5000
|
-
const incomingVal = _optionalChain([incoming, 'optionalAccess',
|
|
5127
|
+
const incomingVal = _optionalChain([incoming, 'optionalAccess', _262 => _262[index]]);
|
|
5001
5128
|
if (incomingVal === void 0) return;
|
|
5002
5129
|
if (t.isStringLiteral(element) && typeof incomingVal === "string") {
|
|
5003
5130
|
if (element.value !== incomingVal) {
|
|
@@ -5488,7 +5615,7 @@ var AST = class _AST {
|
|
|
5488
5615
|
const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
|
|
5489
5616
|
if (this.isStart() && !this.type)
|
|
5490
5617
|
ret.unshift([]);
|
|
5491
|
-
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
5618
|
+
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _263 => _263.#parent, 'optionalAccess', _264 => _264.type]) === "!")) {
|
|
5492
5619
|
ret.push({});
|
|
5493
5620
|
}
|
|
5494
5621
|
return ret;
|
|
@@ -5496,7 +5623,7 @@ var AST = class _AST {
|
|
|
5496
5623
|
isStart() {
|
|
5497
5624
|
if (this.#root === this)
|
|
5498
5625
|
return true;
|
|
5499
|
-
if (!_optionalChain([this, 'access',
|
|
5626
|
+
if (!_optionalChain([this, 'access', _265 => _265.#parent, 'optionalAccess', _266 => _266.isStart, 'call', _267 => _267()]))
|
|
5500
5627
|
return false;
|
|
5501
5628
|
if (this.#parentIndex === 0)
|
|
5502
5629
|
return true;
|
|
@@ -5512,12 +5639,12 @@ var AST = class _AST {
|
|
|
5512
5639
|
isEnd() {
|
|
5513
5640
|
if (this.#root === this)
|
|
5514
5641
|
return true;
|
|
5515
|
-
if (_optionalChain([this, 'access',
|
|
5642
|
+
if (_optionalChain([this, 'access', _268 => _268.#parent, 'optionalAccess', _269 => _269.type]) === "!")
|
|
5516
5643
|
return true;
|
|
5517
|
-
if (!_optionalChain([this, 'access',
|
|
5644
|
+
if (!_optionalChain([this, 'access', _270 => _270.#parent, 'optionalAccess', _271 => _271.isEnd, 'call', _272 => _272()]))
|
|
5518
5645
|
return false;
|
|
5519
5646
|
if (!this.type)
|
|
5520
|
-
return _optionalChain([this, 'access',
|
|
5647
|
+
return _optionalChain([this, 'access', _273 => _273.#parent, 'optionalAccess', _274 => _274.isEnd, 'call', _275 => _275()]);
|
|
5521
5648
|
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
|
5522
5649
|
return this.#parentIndex === pl - 1;
|
|
5523
5650
|
}
|
|
@@ -5762,7 +5889,7 @@ var AST = class _AST {
|
|
|
5762
5889
|
}
|
|
5763
5890
|
}
|
|
5764
5891
|
let end = "";
|
|
5765
|
-
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
5892
|
+
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _276 => _276.#parent, 'optionalAccess', _277 => _277.type]) === "!") {
|
|
5766
5893
|
end = "(?:$|\\/)";
|
|
5767
5894
|
}
|
|
5768
5895
|
const final2 = start2 + src + end;
|
|
@@ -6839,7 +6966,7 @@ function createMdxSectionsSplit2Loader() {
|
|
|
6839
6966
|
const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
|
|
6840
6967
|
const result = {
|
|
6841
6968
|
frontmatter: data.frontmatter,
|
|
6842
|
-
codePlaceholders: _optionalChain([pullInput, 'optionalAccess',
|
|
6969
|
+
codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _278 => _278.codePlaceholders]) || {},
|
|
6843
6970
|
content
|
|
6844
6971
|
};
|
|
6845
6972
|
return result;
|
|
@@ -7286,6 +7413,15 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
7286
7413
|
createSyncLoader(),
|
|
7287
7414
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
7288
7415
|
);
|
|
7416
|
+
case "markdoc":
|
|
7417
|
+
return composeLoaders(
|
|
7418
|
+
createTextFileLoader(bucketPathPattern),
|
|
7419
|
+
createMarkdocLoader(),
|
|
7420
|
+
createFlatLoader(),
|
|
7421
|
+
createEnsureKeyOrderLoader(),
|
|
7422
|
+
createSyncLoader(),
|
|
7423
|
+
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
7424
|
+
);
|
|
7289
7425
|
case "mdx":
|
|
7290
7426
|
return composeLoaders(
|
|
7291
7427
|
createTextFileLoader(bucketPathPattern),
|
|
@@ -7517,7 +7653,7 @@ function createLingoLocalizer(params) {
|
|
|
7517
7653
|
// src/cli/processor/basic.ts
|
|
7518
7654
|
var _ai = require('ai');
|
|
7519
7655
|
|
|
7520
|
-
function createBasicTranslator(model, systemPrompt) {
|
|
7656
|
+
function createBasicTranslator(model, systemPrompt, settings = {}) {
|
|
7521
7657
|
return async (input2, onProgress) => {
|
|
7522
7658
|
const chunks = extractPayloadChunks(input2.processableData);
|
|
7523
7659
|
const subResults = [];
|
|
@@ -7539,6 +7675,7 @@ function createBasicTranslator(model, systemPrompt) {
|
|
|
7539
7675
|
}
|
|
7540
7676
|
const response = await _ai.generateText.call(void 0, {
|
|
7541
7677
|
model,
|
|
7678
|
+
...settings,
|
|
7542
7679
|
messages: [
|
|
7543
7680
|
{
|
|
7544
7681
|
role: "system",
|
|
@@ -7578,7 +7715,7 @@ function createBasicTranslator(model, systemPrompt) {
|
|
|
7578
7715
|
]
|
|
7579
7716
|
});
|
|
7580
7717
|
const result = JSON.parse(response.text);
|
|
7581
|
-
return _optionalChain([result, 'optionalAccess',
|
|
7718
|
+
return _optionalChain([result, 'optionalAccess', _279 => _279.data]) || {};
|
|
7582
7719
|
}
|
|
7583
7720
|
}
|
|
7584
7721
|
function extractPayloadChunks(payload) {
|
|
@@ -7629,7 +7766,8 @@ function createProcessor(provider, params) {
|
|
|
7629
7766
|
return result;
|
|
7630
7767
|
} else {
|
|
7631
7768
|
const model = getPureModelProvider(provider);
|
|
7632
|
-
const
|
|
7769
|
+
const settings = provider.settings || {};
|
|
7770
|
+
const result = createBasicTranslator(model, provider.prompt, settings);
|
|
7633
7771
|
return result;
|
|
7634
7772
|
}
|
|
7635
7773
|
}
|
|
@@ -7660,7 +7798,7 @@ function getPureModelProvider(provider) {
|
|
|
7660
7798
|
|
|
7661
7799
|
${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
|
|
7662
7800
|
`;
|
|
7663
|
-
switch (_optionalChain([provider, 'optionalAccess',
|
|
7801
|
+
switch (_optionalChain([provider, 'optionalAccess', _280 => _280.id])) {
|
|
7664
7802
|
case "openai": {
|
|
7665
7803
|
if (!process.env.OPENAI_API_KEY) {
|
|
7666
7804
|
throw new Error(
|
|
@@ -7718,7 +7856,7 @@ function getPureModelProvider(provider) {
|
|
|
7718
7856
|
})(provider.model);
|
|
7719
7857
|
}
|
|
7720
7858
|
default: {
|
|
7721
|
-
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess',
|
|
7859
|
+
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _281 => _281.id])));
|
|
7722
7860
|
}
|
|
7723
7861
|
}
|
|
7724
7862
|
}
|
|
@@ -8003,7 +8141,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
8003
8141
|
validateParams(i18nConfig, flags);
|
|
8004
8142
|
ora.succeed("Localization configuration is valid");
|
|
8005
8143
|
ora.start("Connecting to Lingo.dev Localization Engine...");
|
|
8006
|
-
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess',
|
|
8144
|
+
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _282 => _282.provider]);
|
|
8007
8145
|
if (isByokMode) {
|
|
8008
8146
|
authId = null;
|
|
8009
8147
|
ora.succeed("Using external provider (BYOK mode)");
|
|
@@ -8017,16 +8155,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
8017
8155
|
flags
|
|
8018
8156
|
});
|
|
8019
8157
|
let buckets = getBuckets(i18nConfig);
|
|
8020
|
-
if (_optionalChain([flags, 'access',
|
|
8158
|
+
if (_optionalChain([flags, 'access', _283 => _283.bucket, 'optionalAccess', _284 => _284.length])) {
|
|
8021
8159
|
buckets = buckets.filter(
|
|
8022
8160
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
8023
8161
|
);
|
|
8024
8162
|
}
|
|
8025
8163
|
ora.succeed("Buckets retrieved");
|
|
8026
|
-
if (_optionalChain([flags, 'access',
|
|
8164
|
+
if (_optionalChain([flags, 'access', _285 => _285.file, 'optionalAccess', _286 => _286.length])) {
|
|
8027
8165
|
buckets = buckets.map((bucket) => {
|
|
8028
8166
|
const paths = bucket.paths.filter(
|
|
8029
|
-
(path19) => flags.file.find((file) => _optionalChain([path19, 'access',
|
|
8167
|
+
(path19) => flags.file.find((file) => _optionalChain([path19, 'access', _287 => _287.pathPattern, 'optionalAccess', _288 => _288.includes, 'call', _289 => _289(file)]))
|
|
8030
8168
|
);
|
|
8031
8169
|
return { ...bucket, paths };
|
|
8032
8170
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -8047,7 +8185,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
8047
8185
|
});
|
|
8048
8186
|
}
|
|
8049
8187
|
}
|
|
8050
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
8188
|
+
const targetLocales = _optionalChain([flags, 'access', _290 => _290.locale, 'optionalAccess', _291 => _291.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
8051
8189
|
ora.start("Setting up localization cache...");
|
|
8052
8190
|
const checkLockfileProcessor = createDeltaProcessor("");
|
|
8053
8191
|
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
@@ -8324,7 +8462,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
8324
8462
|
}
|
|
8325
8463
|
const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
|
|
8326
8464
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
8327
|
-
if (!_optionalChain([flags, 'access',
|
|
8465
|
+
if (!_optionalChain([flags, 'access', _292 => _292.locale, 'optionalAccess', _293 => _293.length])) {
|
|
8328
8466
|
await deltaProcessor.saveChecksums(checksums);
|
|
8329
8467
|
}
|
|
8330
8468
|
}
|
|
@@ -8448,12 +8586,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
8448
8586
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
8449
8587
|
docUrl: "bucketNotFound"
|
|
8450
8588
|
});
|
|
8451
|
-
} else if (_optionalChain([flags, 'access',
|
|
8589
|
+
} else if (_optionalChain([flags, 'access', _294 => _294.locale, 'optionalAccess', _295 => _295.some, 'call', _296 => _296((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
8452
8590
|
throw new ValidationError({
|
|
8453
8591
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
8454
8592
|
docUrl: "localeTargetNotFound"
|
|
8455
8593
|
});
|
|
8456
|
-
} else if (_optionalChain([flags, 'access',
|
|
8594
|
+
} else if (_optionalChain([flags, 'access', _297 => _297.bucket, 'optionalAccess', _298 => _298.some, 'call', _299 => _299(
|
|
8457
8595
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
8458
8596
|
)])) {
|
|
8459
8597
|
throw new ValidationError({
|
|
@@ -8979,10 +9117,11 @@ function createLingoDotDevLocalizer(explicitApiKey) {
|
|
|
8979
9117
|
const response = await engine.whoami();
|
|
8980
9118
|
return {
|
|
8981
9119
|
authenticated: !!response,
|
|
8982
|
-
username: _optionalChain([response, 'optionalAccess',
|
|
9120
|
+
username: _optionalChain([response, 'optionalAccess', _300 => _300.email])
|
|
8983
9121
|
};
|
|
8984
|
-
} catch (
|
|
8985
|
-
|
|
9122
|
+
} catch (error) {
|
|
9123
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
9124
|
+
return { authenticated: false, error: errorMessage };
|
|
8986
9125
|
}
|
|
8987
9126
|
},
|
|
8988
9127
|
localize: async (input2, onProgress) => {
|
|
@@ -9019,6 +9158,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
|
|
|
9019
9158
|
|
|
9020
9159
|
|
|
9021
9160
|
function createExplicitLocalizer(provider) {
|
|
9161
|
+
const settings = provider.settings || {};
|
|
9022
9162
|
switch (provider.id) {
|
|
9023
9163
|
default:
|
|
9024
9164
|
throw new Error(
|
|
@@ -9042,7 +9182,8 @@ function createExplicitLocalizer(provider) {
|
|
|
9042
9182
|
id: provider.id,
|
|
9043
9183
|
prompt: provider.prompt,
|
|
9044
9184
|
apiKeyName: "OPENAI_API_KEY",
|
|
9045
|
-
baseUrl: provider.baseUrl
|
|
9185
|
+
baseUrl: provider.baseUrl,
|
|
9186
|
+
settings
|
|
9046
9187
|
});
|
|
9047
9188
|
case "anthropic":
|
|
9048
9189
|
return createAiSdkLocalizer({
|
|
@@ -9050,7 +9191,8 @@ function createExplicitLocalizer(provider) {
|
|
|
9050
9191
|
id: provider.id,
|
|
9051
9192
|
prompt: provider.prompt,
|
|
9052
9193
|
apiKeyName: "ANTHROPIC_API_KEY",
|
|
9053
|
-
baseUrl: provider.baseUrl
|
|
9194
|
+
baseUrl: provider.baseUrl,
|
|
9195
|
+
settings
|
|
9054
9196
|
});
|
|
9055
9197
|
case "google":
|
|
9056
9198
|
return createAiSdkLocalizer({
|
|
@@ -9058,7 +9200,8 @@ function createExplicitLocalizer(provider) {
|
|
|
9058
9200
|
id: provider.id,
|
|
9059
9201
|
prompt: provider.prompt,
|
|
9060
9202
|
apiKeyName: "GOOGLE_API_KEY",
|
|
9061
|
-
baseUrl: provider.baseUrl
|
|
9203
|
+
baseUrl: provider.baseUrl,
|
|
9204
|
+
settings
|
|
9062
9205
|
});
|
|
9063
9206
|
case "openrouter":
|
|
9064
9207
|
return createAiSdkLocalizer({
|
|
@@ -9066,14 +9209,16 @@ function createExplicitLocalizer(provider) {
|
|
|
9066
9209
|
id: provider.id,
|
|
9067
9210
|
prompt: provider.prompt,
|
|
9068
9211
|
apiKeyName: "OPENROUTER_API_KEY",
|
|
9069
|
-
baseUrl: provider.baseUrl
|
|
9212
|
+
baseUrl: provider.baseUrl,
|
|
9213
|
+
settings
|
|
9070
9214
|
});
|
|
9071
9215
|
case "ollama":
|
|
9072
9216
|
return createAiSdkLocalizer({
|
|
9073
9217
|
factory: (_params) => _ollamaaiprovider.createOllama.call(void 0, ).languageModel(provider.model),
|
|
9074
9218
|
id: provider.id,
|
|
9075
9219
|
prompt: provider.prompt,
|
|
9076
|
-
skipAuth: true
|
|
9220
|
+
skipAuth: true,
|
|
9221
|
+
settings
|
|
9077
9222
|
});
|
|
9078
9223
|
case "mistral":
|
|
9079
9224
|
return createAiSdkLocalizer({
|
|
@@ -9081,13 +9226,14 @@ function createExplicitLocalizer(provider) {
|
|
|
9081
9226
|
id: provider.id,
|
|
9082
9227
|
prompt: provider.prompt,
|
|
9083
9228
|
apiKeyName: "MISTRAL_API_KEY",
|
|
9084
|
-
baseUrl: provider.baseUrl
|
|
9229
|
+
baseUrl: provider.baseUrl,
|
|
9230
|
+
settings
|
|
9085
9231
|
});
|
|
9086
9232
|
}
|
|
9087
9233
|
}
|
|
9088
9234
|
function createAiSdkLocalizer(params) {
|
|
9089
9235
|
const skipAuth = params.skipAuth === true;
|
|
9090
|
-
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
9236
|
+
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _301 => _301.apiKeyName]), () => ( ""))];
|
|
9091
9237
|
if (!skipAuth && !apiKey || !params.apiKeyName) {
|
|
9092
9238
|
throw new Error(
|
|
9093
9239
|
_dedent2.default`
|
|
@@ -9115,9 +9261,13 @@ function createAiSdkLocalizer(params) {
|
|
|
9115
9261
|
return {
|
|
9116
9262
|
id: params.id,
|
|
9117
9263
|
checkAuth: async () => {
|
|
9264
|
+
return { authenticated: true, username: "anonymous" };
|
|
9265
|
+
},
|
|
9266
|
+
validateSettings: async () => {
|
|
9118
9267
|
try {
|
|
9119
9268
|
await _ai.generateText.call(void 0, {
|
|
9120
9269
|
model,
|
|
9270
|
+
...params.settings,
|
|
9121
9271
|
messages: [
|
|
9122
9272
|
{ role: "system", content: "You are an echo server" },
|
|
9123
9273
|
{ role: "user", content: "OK" },
|
|
@@ -9125,9 +9275,10 @@ function createAiSdkLocalizer(params) {
|
|
|
9125
9275
|
{ role: "user", content: "OK" }
|
|
9126
9276
|
]
|
|
9127
9277
|
});
|
|
9128
|
-
return {
|
|
9278
|
+
return { valid: true };
|
|
9129
9279
|
} catch (error) {
|
|
9130
|
-
|
|
9280
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
9281
|
+
return { valid: false, error: errorMessage };
|
|
9131
9282
|
}
|
|
9132
9283
|
},
|
|
9133
9284
|
localize: async (input2) => {
|
|
@@ -9157,6 +9308,7 @@ function createAiSdkLocalizer(params) {
|
|
|
9157
9308
|
};
|
|
9158
9309
|
const response = await _ai.generateText.call(void 0, {
|
|
9159
9310
|
model,
|
|
9311
|
+
...params.settings,
|
|
9160
9312
|
messages: [
|
|
9161
9313
|
{ role: "system", content: systemPrompt },
|
|
9162
9314
|
{ role: "user", content: "OK" },
|
|
@@ -9170,6 +9322,9 @@ function createAiSdkLocalizer(params) {
|
|
|
9170
9322
|
]
|
|
9171
9323
|
});
|
|
9172
9324
|
const result = JSON.parse(response.text);
|
|
9325
|
+
if (typeof result.data === "object" && result.data !== null) {
|
|
9326
|
+
return result.data;
|
|
9327
|
+
}
|
|
9173
9328
|
const index = result.data.indexOf("{");
|
|
9174
9329
|
const lastIndex = result.data.lastIndexOf("}");
|
|
9175
9330
|
const trimmed = result.data.slice(index, lastIndex + 1);
|
|
@@ -9212,8 +9367,8 @@ async function setup(input2) {
|
|
|
9212
9367
|
throw new Error(
|
|
9213
9368
|
"No buckets found in i18n.json. Please add at least one bucket containing i18n content."
|
|
9214
9369
|
);
|
|
9215
|
-
} else if (_optionalChain([ctx, 'access',
|
|
9216
|
-
(bucket) => !_optionalChain([ctx, 'access',
|
|
9370
|
+
} else if (_optionalChain([ctx, 'access', _302 => _302.flags, 'access', _303 => _303.bucket, 'optionalAccess', _304 => _304.some, 'call', _305 => _305(
|
|
9371
|
+
(bucket) => !_optionalChain([ctx, 'access', _306 => _306.config, 'optionalAccess', _307 => _307.buckets, 'access', _308 => _308[bucket]])
|
|
9217
9372
|
)])) {
|
|
9218
9373
|
throw new Error(
|
|
9219
9374
|
`One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
|
|
@@ -9226,7 +9381,7 @@ async function setup(input2) {
|
|
|
9226
9381
|
title: "Selecting localization provider",
|
|
9227
9382
|
task: async (ctx, task) => {
|
|
9228
9383
|
ctx.localizer = createLocalizer(
|
|
9229
|
-
_optionalChain([ctx, 'access',
|
|
9384
|
+
_optionalChain([ctx, 'access', _309 => _309.config, 'optionalAccess', _310 => _310.provider]),
|
|
9230
9385
|
ctx.flags.apiKey
|
|
9231
9386
|
);
|
|
9232
9387
|
if (!ctx.localizer) {
|
|
@@ -9239,20 +9394,30 @@ async function setup(input2) {
|
|
|
9239
9394
|
},
|
|
9240
9395
|
{
|
|
9241
9396
|
title: "Checking authentication",
|
|
9397
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _311 => _311.localizer, 'optionalAccess', _312 => _312.id]) === "Lingo.dev",
|
|
9242
9398
|
task: async (ctx, task) => {
|
|
9243
9399
|
const authStatus = await ctx.localizer.checkAuth();
|
|
9244
9400
|
if (!authStatus.authenticated) {
|
|
9245
|
-
throw new Error(
|
|
9246
|
-
`Failed to authenticate with ${_chalk2.default.hex(colors.yellow)(
|
|
9247
|
-
ctx.localizer.id
|
|
9248
|
-
)} provider. Please check your API key and try again.`
|
|
9249
|
-
);
|
|
9401
|
+
throw new Error(authStatus.error || "Authentication failed");
|
|
9250
9402
|
}
|
|
9251
9403
|
task.title = `Authenticated as ${_chalk2.default.hex(colors.yellow)(
|
|
9252
9404
|
authStatus.username
|
|
9253
9405
|
)}`;
|
|
9254
9406
|
}
|
|
9255
9407
|
},
|
|
9408
|
+
{
|
|
9409
|
+
title: "Validating configuration",
|
|
9410
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _313 => _313.localizer, 'optionalAccess', _314 => _314.id]) !== "Lingo.dev",
|
|
9411
|
+
task: async (ctx, task) => {
|
|
9412
|
+
const validationStatus = await ctx.localizer.validateSettings();
|
|
9413
|
+
if (!validationStatus.valid) {
|
|
9414
|
+
throw new Error(
|
|
9415
|
+
validationStatus.error || "Configuration validation failed"
|
|
9416
|
+
);
|
|
9417
|
+
}
|
|
9418
|
+
task.title = `Configuration validated`;
|
|
9419
|
+
}
|
|
9420
|
+
},
|
|
9256
9421
|
{
|
|
9257
9422
|
title: "Initializing localization provider",
|
|
9258
9423
|
async task(ctx, task) {
|
|
@@ -9557,7 +9722,7 @@ function createWorkerTask(args) {
|
|
|
9557
9722
|
const processableData = _lodash2.default.chain(sourceData).entries().filter(
|
|
9558
9723
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
|
|
9559
9724
|
).filter(
|
|
9560
|
-
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access',
|
|
9725
|
+
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _315 => _315.onlyKeys, 'optionalAccess', _316 => _316.some, 'call', _317 => _317(
|
|
9561
9726
|
(pattern) => minimatch(key, pattern)
|
|
9562
9727
|
)])
|
|
9563
9728
|
).fromPairs().value();
|
|
@@ -9625,7 +9790,7 @@ function createWorkerTask(args) {
|
|
|
9625
9790
|
finalRenamedTargetData
|
|
9626
9791
|
);
|
|
9627
9792
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
9628
|
-
if (!_optionalChain([args, 'access',
|
|
9793
|
+
if (!_optionalChain([args, 'access', _318 => _318.ctx, 'access', _319 => _319.flags, 'access', _320 => _320.targetLocale, 'optionalAccess', _321 => _321.length])) {
|
|
9629
9794
|
await deltaProcessor.saveChecksums(checksums);
|
|
9630
9795
|
}
|
|
9631
9796
|
});
|
|
@@ -9824,14 +9989,14 @@ var flagsSchema2 = _zod.z.object({
|
|
|
9824
9989
|
|
|
9825
9990
|
// src/cli/cmd/run/_utils.ts
|
|
9826
9991
|
async function determineAuthId(ctx) {
|
|
9827
|
-
const isByokMode = !!_optionalChain([ctx, 'access',
|
|
9992
|
+
const isByokMode = !!_optionalChain([ctx, 'access', _322 => _322.config, 'optionalAccess', _323 => _323.provider]);
|
|
9828
9993
|
if (isByokMode) {
|
|
9829
9994
|
return null;
|
|
9830
9995
|
} else {
|
|
9831
9996
|
try {
|
|
9832
|
-
const authStatus = await _optionalChain([ctx, 'access',
|
|
9833
|
-
return _optionalChain([authStatus, 'optionalAccess',
|
|
9834
|
-
} catch (
|
|
9997
|
+
const authStatus = await _optionalChain([ctx, 'access', _324 => _324.localizer, 'optionalAccess', _325 => _325.checkAuth, 'call', _326 => _326()]);
|
|
9998
|
+
return _optionalChain([authStatus, 'optionalAccess', _327 => _327.username]) || null;
|
|
9999
|
+
} catch (e3) {
|
|
9835
10000
|
return null;
|
|
9836
10001
|
}
|
|
9837
10002
|
}
|
|
@@ -10022,7 +10187,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
10022
10187
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
10023
10188
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
10024
10189
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
10025
|
-
_optionalChain([this, 'access',
|
|
10190
|
+
_optionalChain([this, 'access', _328 => _328.platformKit, 'optionalAccess', _329 => _329.gitConfig, 'call', _330 => _330()]);
|
|
10026
10191
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
10027
10192
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
10028
10193
|
if (!processOwnCommits) {
|
|
@@ -10054,7 +10219,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
10054
10219
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
10055
10220
|
var PullRequestFlow = class extends InBranchFlow {
|
|
10056
10221
|
async preRun() {
|
|
10057
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
10222
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _331 => _331()]);
|
|
10058
10223
|
if (!canContinue) {
|
|
10059
10224
|
return false;
|
|
10060
10225
|
}
|
|
@@ -10317,10 +10482,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
10317
10482
|
repo_slug: this.platformConfig.repositoryName,
|
|
10318
10483
|
state: "OPEN"
|
|
10319
10484
|
}).then(({ data: { values } }) => {
|
|
10320
|
-
return _optionalChain([values, 'optionalAccess',
|
|
10321
|
-
({ source, destination }) => _optionalChain([source, 'optionalAccess',
|
|
10485
|
+
return _optionalChain([values, 'optionalAccess', _332 => _332.find, 'call', _333 => _333(
|
|
10486
|
+
({ source, destination }) => _optionalChain([source, 'optionalAccess', _334 => _334.branch, 'optionalAccess', _335 => _335.name]) === branch && _optionalChain([destination, 'optionalAccess', _336 => _336.branch, 'optionalAccess', _337 => _337.name]) === this.platformConfig.baseBranchName
|
|
10322
10487
|
)]);
|
|
10323
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
10488
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _338 => _338.id]));
|
|
10324
10489
|
}
|
|
10325
10490
|
async closePullRequest({ pullRequestNumber }) {
|
|
10326
10491
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -10416,7 +10581,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
10416
10581
|
repo: this.platformConfig.repositoryName,
|
|
10417
10582
|
base: this.platformConfig.baseBranchName,
|
|
10418
10583
|
state: "open"
|
|
10419
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
10584
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _339 => _339.number]));
|
|
10420
10585
|
}
|
|
10421
10586
|
async closePullRequest({ pullRequestNumber }) {
|
|
10422
10587
|
await this.octokit.rest.pulls.update({
|
|
@@ -10531,7 +10696,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
10531
10696
|
branch
|
|
10532
10697
|
);
|
|
10533
10698
|
return true;
|
|
10534
|
-
} catch (
|
|
10699
|
+
} catch (e4) {
|
|
10535
10700
|
return false;
|
|
10536
10701
|
}
|
|
10537
10702
|
}
|
|
@@ -10543,7 +10708,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
10543
10708
|
sourceBranch: branch,
|
|
10544
10709
|
state: "opened"
|
|
10545
10710
|
});
|
|
10546
|
-
return _optionalChain([mergeRequests, 'access',
|
|
10711
|
+
return _optionalChain([mergeRequests, 'access', _340 => _340[0], 'optionalAccess', _341 => _341.iid]);
|
|
10547
10712
|
}
|
|
10548
10713
|
async closePullRequest({
|
|
10549
10714
|
pullRequestNumber
|
|
@@ -10649,7 +10814,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
10649
10814
|
}
|
|
10650
10815
|
const env = {
|
|
10651
10816
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
10652
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
10817
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _342 => _342.pullRequest, 'optionalAccess', _343 => _343.toString, 'call', _344 => _344()]) || "false",
|
|
10653
10818
|
...options.commitMessage && {
|
|
10654
10819
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
10655
10820
|
},
|
|
@@ -10669,7 +10834,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
10669
10834
|
const { isPullRequestMode } = platformKit.config;
|
|
10670
10835
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
10671
10836
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
10672
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
10837
|
+
const canRun = await _optionalChain([flow, 'access', _345 => _345.preRun, 'optionalCall', _346 => _346()]);
|
|
10673
10838
|
if (canRun === false) {
|
|
10674
10839
|
return;
|
|
10675
10840
|
}
|
|
@@ -10679,7 +10844,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
10679
10844
|
if (!hasChanges) {
|
|
10680
10845
|
return;
|
|
10681
10846
|
}
|
|
10682
|
-
await _optionalChain([flow, 'access',
|
|
10847
|
+
await _optionalChain([flow, 'access', _347 => _347.postRun, 'optionalCall', _348 => _348()]);
|
|
10683
10848
|
});
|
|
10684
10849
|
function parseBooleanArg(val) {
|
|
10685
10850
|
if (val === true) return true;
|
|
@@ -10716,8 +10881,8 @@ function exitGracefully(elapsedMs = 0) {
|
|
|
10716
10881
|
}
|
|
10717
10882
|
}
|
|
10718
10883
|
function checkForPendingOperations() {
|
|
10719
|
-
const activeHandles = _optionalChain([process, 'access',
|
|
10720
|
-
const activeRequests = _optionalChain([process, 'access',
|
|
10884
|
+
const activeHandles = _optionalChain([process, 'access', _349 => _349._getActiveHandles, 'optionalCall', _350 => _350()]) || [];
|
|
10885
|
+
const activeRequests = _optionalChain([process, 'access', _351 => _351._getActiveRequests, 'optionalCall', _352 => _352()]) || [];
|
|
10721
10886
|
const nonStandardHandles = activeHandles.filter((handle) => {
|
|
10722
10887
|
if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
|
|
10723
10888
|
return false;
|
|
@@ -10786,17 +10951,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
10786
10951
|
flags
|
|
10787
10952
|
});
|
|
10788
10953
|
let buckets = getBuckets(i18nConfig);
|
|
10789
|
-
if (_optionalChain([flags, 'access',
|
|
10954
|
+
if (_optionalChain([flags, 'access', _353 => _353.bucket, 'optionalAccess', _354 => _354.length])) {
|
|
10790
10955
|
buckets = buckets.filter(
|
|
10791
10956
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
10792
10957
|
);
|
|
10793
10958
|
}
|
|
10794
10959
|
ora.succeed("Buckets retrieved");
|
|
10795
|
-
if (_optionalChain([flags, 'access',
|
|
10960
|
+
if (_optionalChain([flags, 'access', _355 => _355.file, 'optionalAccess', _356 => _356.length])) {
|
|
10796
10961
|
buckets = buckets.map((bucket) => {
|
|
10797
10962
|
const paths = bucket.paths.filter(
|
|
10798
10963
|
(path19) => flags.file.find(
|
|
10799
|
-
(file) => _optionalChain([path19, 'access',
|
|
10964
|
+
(file) => _optionalChain([path19, 'access', _357 => _357.pathPattern, 'optionalAccess', _358 => _358.includes, 'call', _359 => _359(file)]) || _optionalChain([path19, 'access', _360 => _360.pathPattern, 'optionalAccess', _361 => _361.match, 'call', _362 => _362(file)]) || minimatch(path19.pathPattern, file)
|
|
10800
10965
|
)
|
|
10801
10966
|
);
|
|
10802
10967
|
return { ...bucket, paths };
|
|
@@ -10816,7 +10981,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
10816
10981
|
});
|
|
10817
10982
|
}
|
|
10818
10983
|
}
|
|
10819
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
10984
|
+
const targetLocales = _optionalChain([flags, 'access', _363 => _363.locale, 'optionalAccess', _364 => _364.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
10820
10985
|
let totalSourceKeyCount = 0;
|
|
10821
10986
|
let uniqueKeysToTranslate = 0;
|
|
10822
10987
|
let totalExistingTranslations = 0;
|
|
@@ -11222,12 +11387,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
11222
11387
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
11223
11388
|
docUrl: "bucketNotFound"
|
|
11224
11389
|
});
|
|
11225
|
-
} else if (_optionalChain([flags, 'access',
|
|
11390
|
+
} else if (_optionalChain([flags, 'access', _365 => _365.locale, 'optionalAccess', _366 => _366.some, 'call', _367 => _367((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
11226
11391
|
throw new CLIError({
|
|
11227
11392
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
11228
11393
|
docUrl: "localeTargetNotFound"
|
|
11229
11394
|
});
|
|
11230
|
-
} else if (_optionalChain([flags, 'access',
|
|
11395
|
+
} else if (_optionalChain([flags, 'access', _368 => _368.bucket, 'optionalAccess', _369 => _369.some, 'call', _370 => _370(
|
|
11231
11396
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
11232
11397
|
)])) {
|
|
11233
11398
|
throw new CLIError({
|
|
@@ -11319,7 +11484,7 @@ async function renderHero2() {
|
|
|
11319
11484
|
// package.json
|
|
11320
11485
|
var package_default = {
|
|
11321
11486
|
name: "lingo.dev",
|
|
11322
|
-
version: "0.
|
|
11487
|
+
version: "0.112.0",
|
|
11323
11488
|
description: "Lingo.dev CLI",
|
|
11324
11489
|
private: false,
|
|
11325
11490
|
publishConfig: {
|
|
@@ -11460,6 +11625,7 @@ var package_default = {
|
|
|
11460
11625
|
"@lingo.dev/_react": "workspace:*",
|
|
11461
11626
|
"@lingo.dev/_sdk": "workspace:*",
|
|
11462
11627
|
"@lingo.dev/_spec": "workspace:*",
|
|
11628
|
+
"@markdoc/markdoc": "^0.5.4",
|
|
11463
11629
|
"@modelcontextprotocol/sdk": "^1.5.0",
|
|
11464
11630
|
"@openrouter/ai-sdk-provider": "^0.7.1",
|
|
11465
11631
|
"@paralleldrive/cuid2": "^2.2.2",
|
|
@@ -11608,7 +11774,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
|
|
|
11608
11774
|
if (options.file && options.file.length) {
|
|
11609
11775
|
buckets = buckets.map((bucket) => {
|
|
11610
11776
|
const paths = bucket.paths.filter(
|
|
11611
|
-
(bucketPath) => _optionalChain([options, 'access',
|
|
11777
|
+
(bucketPath) => _optionalChain([options, 'access', _371 => _371.file, 'optionalAccess', _372 => _372.some, 'call', _373 => _373((f) => bucketPath.pathPattern.includes(f))])
|
|
11612
11778
|
);
|
|
11613
11779
|
return { ...bucket, paths };
|
|
11614
11780
|
}).filter((bucket) => bucket.paths.length > 0);
|