lingo.dev 0.111.15 → 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/README.md +7 -1
- package/build/cli.cjs +365 -153
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +263 -51
- package/build/cli.mjs.map +1 -1
- package/package.json +5 -4
package/build/cli.cjs
CHANGED
|
@@ -569,26 +569,49 @@ async function pauseIfDebug(debug) {
|
|
|
569
569
|
}
|
|
570
570
|
async function renderSummary(results) {
|
|
571
571
|
console.log(_chalk2.default.hex(colors.green)("[Done]"));
|
|
572
|
-
const
|
|
572
|
+
const skippedResults = Array.from(results.values()).filter(
|
|
573
573
|
(r) => r.status === "skipped"
|
|
574
|
-
)
|
|
575
|
-
|
|
576
|
-
const succeededTasksCount = Array.from(results.values()).filter(
|
|
574
|
+
);
|
|
575
|
+
const succeededResults = Array.from(results.values()).filter(
|
|
577
576
|
(r) => r.status === "success"
|
|
578
|
-
)
|
|
579
|
-
|
|
580
|
-
const failedTasksCount = Array.from(results.values()).filter(
|
|
577
|
+
);
|
|
578
|
+
const failedResults = Array.from(results.values()).filter(
|
|
581
579
|
(r) => r.status === "error"
|
|
582
|
-
)
|
|
583
|
-
console.log(
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
580
|
+
);
|
|
581
|
+
console.log(
|
|
582
|
+
`\u2022 ${_chalk2.default.hex(colors.yellow)(skippedResults.length)} from cache`
|
|
583
|
+
);
|
|
584
|
+
console.log(
|
|
585
|
+
`\u2022 ${_chalk2.default.hex(colors.yellow)(succeededResults.length)} processed`
|
|
586
|
+
);
|
|
587
|
+
console.log(`\u2022 ${_chalk2.default.hex(colors.yellow)(failedResults.length)} failed`);
|
|
588
|
+
if (succeededResults.length > 0) {
|
|
589
|
+
console.log(_chalk2.default.hex(colors.green)("\n[Processed Files]"));
|
|
590
|
+
for (const result of succeededResults) {
|
|
591
|
+
const displayPath = _optionalChain([result, 'access', _73 => _73.pathPattern, 'optionalAccess', _74 => _74.replace, 'call', _75 => _75("[locale]", result.targetLocale)]) || "unknown";
|
|
589
592
|
console.log(
|
|
590
|
-
|
|
591
|
-
|
|
593
|
+
` \u2713 ${_chalk2.default.dim(displayPath)} ${_chalk2.default.hex(colors.yellow)(`(${result.sourceLocale} \u2192 ${result.targetLocale})`)}`
|
|
594
|
+
);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
if (skippedResults.length > 0) {
|
|
598
|
+
console.log(_chalk2.default.hex(colors.blue)("\n[Cached Files]"));
|
|
599
|
+
for (const result of skippedResults) {
|
|
600
|
+
const displayPath = _optionalChain([result, 'access', _76 => _76.pathPattern, 'optionalAccess', _77 => _77.replace, 'call', _78 => _78("[locale]", result.targetLocale)]) || "unknown";
|
|
601
|
+
console.log(
|
|
602
|
+
` \u26A1 ${_chalk2.default.dim(displayPath)} ${_chalk2.default.hex(colors.yellow)(`(${result.sourceLocale} \u2192 ${result.targetLocale})`)}`
|
|
603
|
+
);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
if (failedResults.length > 0) {
|
|
607
|
+
console.log(_chalk2.default.hex(colors.orange)("\n[Failed Files]"));
|
|
608
|
+
for (const result of failedResults) {
|
|
609
|
+
const displayPath = _optionalChain([result, 'access', _79 => _79.pathPattern, 'optionalAccess', _80 => _80.replace, 'call', _81 => _81("[locale]", result.targetLocale)]) || "unknown";
|
|
610
|
+
console.log(
|
|
611
|
+
` \u274C ${_chalk2.default.dim(displayPath)} ${_chalk2.default.hex(colors.yellow)(`(${result.sourceLocale} \u2192 ${result.targetLocale})`)}`
|
|
612
|
+
);
|
|
613
|
+
console.log(
|
|
614
|
+
` ${_chalk2.default.hex(colors.white)(String(_optionalChain([result, 'access', _82 => _82.error, 'optionalAccess', _83 => _83.message]) || "Unknown error"))}`
|
|
592
615
|
);
|
|
593
616
|
}
|
|
594
617
|
}
|
|
@@ -1234,7 +1257,7 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
|
|
|
1234
1257
|
});
|
|
1235
1258
|
const auth2 = await newAuthenticator.whoami();
|
|
1236
1259
|
if (auth2) {
|
|
1237
|
-
_ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess',
|
|
1260
|
+
_ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _84 => _84.email])}`);
|
|
1238
1261
|
} else {
|
|
1239
1262
|
_ora2.default.call(void 0, ).fail("Authentication failed.");
|
|
1240
1263
|
}
|
|
@@ -1324,7 +1347,7 @@ function getBuckets(i18nConfig) {
|
|
|
1324
1347
|
const includeItems = bucketEntry.include.map(
|
|
1325
1348
|
(item) => resolveBucketItem(item)
|
|
1326
1349
|
);
|
|
1327
|
-
const excludeItems = _optionalChain([bucketEntry, 'access',
|
|
1350
|
+
const excludeItems = _optionalChain([bucketEntry, 'access', _85 => _85.exclude, 'optionalAccess', _86 => _86.map, 'call', _87 => _87(
|
|
1328
1351
|
(item) => resolveBucketItem(item)
|
|
1329
1352
|
)]);
|
|
1330
1353
|
const config = {
|
|
@@ -1362,7 +1385,7 @@ function extractPathPatterns(sourceLocale, include, exclude) {
|
|
|
1362
1385
|
delimiter: pattern.delimiter
|
|
1363
1386
|
}))
|
|
1364
1387
|
);
|
|
1365
|
-
const excludedPatterns = _optionalChain([exclude, 'optionalAccess',
|
|
1388
|
+
const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _88 => _88.flatMap, 'call', _89 => _89(
|
|
1366
1389
|
(pattern) => expandPlaceholderedGlob(
|
|
1367
1390
|
pattern.path,
|
|
1368
1391
|
__spec.resolveOverriddenLocale.call(void 0, sourceLocale, pattern.delimiter)
|
|
@@ -1665,12 +1688,12 @@ function composeLoaders(...loaders) {
|
|
|
1665
1688
|
return {
|
|
1666
1689
|
init: async () => {
|
|
1667
1690
|
for (const loader of loaders) {
|
|
1668
|
-
await _optionalChain([loader, 'access',
|
|
1691
|
+
await _optionalChain([loader, 'access', _90 => _90.init, 'optionalCall', _91 => _91()]);
|
|
1669
1692
|
}
|
|
1670
1693
|
},
|
|
1671
1694
|
setDefaultLocale(locale) {
|
|
1672
1695
|
for (const loader of loaders) {
|
|
1673
|
-
_optionalChain([loader, 'access',
|
|
1696
|
+
_optionalChain([loader, 'access', _92 => _92.setDefaultLocale, 'optionalCall', _93 => _93(locale)]);
|
|
1674
1697
|
}
|
|
1675
1698
|
return this;
|
|
1676
1699
|
},
|
|
@@ -1691,7 +1714,7 @@ function composeLoaders(...loaders) {
|
|
|
1691
1714
|
pullHints: async (originalInput) => {
|
|
1692
1715
|
let result = originalInput;
|
|
1693
1716
|
for (let i = 0; i < loaders.length; i++) {
|
|
1694
|
-
const subResult = await _optionalChain([loaders, 'access',
|
|
1717
|
+
const subResult = await _optionalChain([loaders, 'access', _94 => _94[i], 'access', _95 => _95.pullHints, 'optionalCall', _96 => _96(result)]);
|
|
1695
1718
|
if (subResult) {
|
|
1696
1719
|
result = subResult;
|
|
1697
1720
|
}
|
|
@@ -1713,7 +1736,7 @@ function createLoader(lDefinition) {
|
|
|
1713
1736
|
if (state.initCtx) {
|
|
1714
1737
|
return state.initCtx;
|
|
1715
1738
|
}
|
|
1716
|
-
state.initCtx = await _optionalChain([lDefinition, 'access',
|
|
1739
|
+
state.initCtx = await _optionalChain([lDefinition, 'access', _97 => _97.init, 'optionalCall', _98 => _98()]);
|
|
1717
1740
|
return state.initCtx;
|
|
1718
1741
|
},
|
|
1719
1742
|
setDefaultLocale(locale) {
|
|
@@ -1724,7 +1747,7 @@ function createLoader(lDefinition) {
|
|
|
1724
1747
|
return this;
|
|
1725
1748
|
},
|
|
1726
1749
|
async pullHints() {
|
|
1727
|
-
return _optionalChain([lDefinition, 'access',
|
|
1750
|
+
return _optionalChain([lDefinition, 'access', _99 => _99.pullHints, 'optionalCall', _100 => _100(state.originalInput)]);
|
|
1728
1751
|
},
|
|
1729
1752
|
async pull(locale, input2) {
|
|
1730
1753
|
if (!state.defaultLocale) {
|
|
@@ -2029,7 +2052,7 @@ function createNormalizeLoader() {
|
|
|
2029
2052
|
return normalized;
|
|
2030
2053
|
},
|
|
2031
2054
|
push: async (locale, data, originalInput) => {
|
|
2032
|
-
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess',
|
|
2055
|
+
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _101 => _101.keysMap]), () => ( {}));
|
|
2033
2056
|
const input2 = mapDenormalizedKeys(data, keysMap);
|
|
2034
2057
|
const denormalized = _flat.unflatten.call(void 0, input2, {
|
|
2035
2058
|
delimiter: "/",
|
|
@@ -2163,8 +2186,8 @@ async function getTrailingNewLine(pathPattern, locale, originalLocale) {
|
|
|
2163
2186
|
if (!templateData) {
|
|
2164
2187
|
templateData = await readFileForLocale(pathPattern, originalLocale);
|
|
2165
2188
|
}
|
|
2166
|
-
if (_optionalChain([templateData, 'optionalAccess',
|
|
2167
|
-
const ending = _optionalChain([templateData, 'optionalAccess',
|
|
2189
|
+
if (_optionalChain([templateData, 'optionalAccess', _102 => _102.match, 'call', _103 => _103(/[\r\n]$/)])) {
|
|
2190
|
+
const ending = _optionalChain([templateData, 'optionalAccess', _104 => _104.includes, 'call', _105 => _105("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _106 => _106.includes, 'call', _107 => _107("\r")]) ? "\r" : "\n";
|
|
2168
2191
|
return ending;
|
|
2169
2192
|
}
|
|
2170
2193
|
return "";
|
|
@@ -2435,7 +2458,7 @@ var _sync3 = require('csv-stringify/sync');
|
|
|
2435
2458
|
|
|
2436
2459
|
function detectKeyColumnName(csvString) {
|
|
2437
2460
|
const row = _sync.parse.call(void 0, csvString)[0];
|
|
2438
|
-
const firstColumn = _optionalChain([row, 'optionalAccess',
|
|
2461
|
+
const firstColumn = _optionalChain([row, 'optionalAccess', _108 => _108[0], 'optionalAccess', _109 => _109.trim, 'call', _110 => _110()]);
|
|
2439
2462
|
return firstColumn || "KEY";
|
|
2440
2463
|
}
|
|
2441
2464
|
function createCsvLoader() {
|
|
@@ -2537,7 +2560,7 @@ function createHtmlLoader() {
|
|
|
2537
2560
|
break;
|
|
2538
2561
|
}
|
|
2539
2562
|
const siblings = Array.from(parent.childNodes).filter(
|
|
2540
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2563
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _111 => _111.textContent, 'optionalAccess', _112 => _112.trim, 'call', _113 => _113()])
|
|
2541
2564
|
);
|
|
2542
2565
|
const index = siblings.indexOf(current);
|
|
2543
2566
|
if (index !== -1) {
|
|
@@ -2573,15 +2596,15 @@ function createHtmlLoader() {
|
|
|
2573
2596
|
}
|
|
2574
2597
|
});
|
|
2575
2598
|
Array.from(element.childNodes).filter(
|
|
2576
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2599
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _114 => _114.textContent, 'optionalAccess', _115 => _115.trim, 'call', _116 => _116()])
|
|
2577
2600
|
).forEach(processNode);
|
|
2578
2601
|
}
|
|
2579
2602
|
};
|
|
2580
2603
|
Array.from(document.head.childNodes).filter(
|
|
2581
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2604
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _117 => _117.textContent, 'optionalAccess', _118 => _118.trim, 'call', _119 => _119()])
|
|
2582
2605
|
).forEach(processNode);
|
|
2583
2606
|
Array.from(document.body.childNodes).filter(
|
|
2584
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2607
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _120 => _120.textContent, 'optionalAccess', _121 => _121.trim, 'call', _122 => _122()])
|
|
2585
2608
|
).forEach(processNode);
|
|
2586
2609
|
return result;
|
|
2587
2610
|
},
|
|
@@ -2606,7 +2629,7 @@ function createHtmlLoader() {
|
|
|
2606
2629
|
for (let i = 0; i < indices.length; i++) {
|
|
2607
2630
|
const index = parseInt(indices[i]);
|
|
2608
2631
|
const siblings = Array.from(parent.childNodes).filter(
|
|
2609
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
2632
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _123 => _123.textContent, 'optionalAccess', _124 => _124.trim, 'call', _125 => _125()])
|
|
2610
2633
|
);
|
|
2611
2634
|
if (index >= siblings.length) {
|
|
2612
2635
|
if (i === indices.length - 1) {
|
|
@@ -2657,7 +2680,7 @@ function createMarkdownLoader() {
|
|
|
2657
2680
|
yaml: yamlEngine
|
|
2658
2681
|
}
|
|
2659
2682
|
});
|
|
2660
|
-
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess',
|
|
2683
|
+
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _126 => _126.trim, 'call', _127 => _127()]), () => ( ""))).filter(Boolean);
|
|
2661
2684
|
return {
|
|
2662
2685
|
...Object.fromEntries(
|
|
2663
2686
|
sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
|
|
@@ -2676,7 +2699,7 @@ function createMarkdownLoader() {
|
|
|
2676
2699
|
);
|
|
2677
2700
|
let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(
|
|
2678
2701
|
([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())
|
|
2679
|
-
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess',
|
|
2702
|
+
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _128 => _128.trim, 'call', _129 => _129()]), () => ( ""))).filter(Boolean).join("\n\n");
|
|
2680
2703
|
if (Object.keys(frontmatter).length > 0) {
|
|
2681
2704
|
content = `
|
|
2682
2705
|
${content}`;
|
|
@@ -2690,6 +2713,133 @@ ${content}`;
|
|
|
2690
2713
|
});
|
|
2691
2714
|
}
|
|
2692
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
|
+
|
|
2693
2843
|
// src/cli/loaders/properties.ts
|
|
2694
2844
|
function createPropertiesLoader() {
|
|
2695
2845
|
return createLoader({
|
|
@@ -2720,7 +2870,7 @@ function isSkippableLine(line) {
|
|
|
2720
2870
|
function parsePropertyLine(line) {
|
|
2721
2871
|
const [key, ...valueParts] = line.split("=");
|
|
2722
2872
|
return {
|
|
2723
|
-
key: _optionalChain([key, 'optionalAccess',
|
|
2873
|
+
key: _optionalChain([key, 'optionalAccess', _138 => _138.trim, 'call', _139 => _139()]) || "",
|
|
2724
2874
|
value: valueParts.join("=").trim()
|
|
2725
2875
|
};
|
|
2726
2876
|
}
|
|
@@ -2808,7 +2958,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
2808
2958
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
2809
2959
|
continue;
|
|
2810
2960
|
}
|
|
2811
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
2961
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _140 => _140.localizations, 'optionalAccess', _141 => _141[locale]]);
|
|
2812
2962
|
if (langTranslationEntity) {
|
|
2813
2963
|
if ("stringUnit" in langTranslationEntity) {
|
|
2814
2964
|
resultData[translationKey] = langTranslationEntity.stringUnit.value;
|
|
@@ -2817,7 +2967,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
2817
2967
|
resultData[translationKey] = {};
|
|
2818
2968
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
2819
2969
|
for (const form in pluralForms) {
|
|
2820
|
-
if (_optionalChain([pluralForms, 'access',
|
|
2970
|
+
if (_optionalChain([pluralForms, 'access', _142 => _142[form], 'optionalAccess', _143 => _143.stringUnit, 'optionalAccess', _144 => _144.value])) {
|
|
2821
2971
|
resultData[translationKey][form] = pluralForms[form].stringUnit.value;
|
|
2822
2972
|
}
|
|
2823
2973
|
}
|
|
@@ -2843,7 +2993,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
2843
2993
|
const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
|
|
2844
2994
|
if (typeof value === "string") {
|
|
2845
2995
|
langDataToMerge.strings[key] = {
|
|
2846
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
2996
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _145 => _145.strings, 'optionalAccess', _146 => _146[key], 'optionalAccess', _147 => _147.extractionState]),
|
|
2847
2997
|
localizations: {
|
|
2848
2998
|
[locale]: {
|
|
2849
2999
|
stringUnit: {
|
|
@@ -2901,7 +3051,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
2901
3051
|
for (const [locale, localization] of Object.entries(
|
|
2902
3052
|
entity.localizations
|
|
2903
3053
|
)) {
|
|
2904
|
-
if (_optionalChain([localization, 'access',
|
|
3054
|
+
if (_optionalChain([localization, 'access', _148 => _148.variations, 'optionalAccess', _149 => _149.plural])) {
|
|
2905
3055
|
const pluralForms = localization.variations.plural;
|
|
2906
3056
|
for (const form in pluralForms) {
|
|
2907
3057
|
const pluralKey = `${translationKey}/${form}`;
|
|
@@ -2921,7 +3071,7 @@ function _removeLocale(input2, locale) {
|
|
|
2921
3071
|
const { strings } = input2;
|
|
2922
3072
|
const newStrings = _lodash2.default.cloneDeep(strings);
|
|
2923
3073
|
for (const [key, value] of Object.entries(newStrings)) {
|
|
2924
|
-
if (_optionalChain([value, 'access',
|
|
3074
|
+
if (_optionalChain([value, 'access', _150 => _150.localizations, 'optionalAccess', _151 => _151[locale]])) {
|
|
2925
3075
|
delete value.localizations[locale];
|
|
2926
3076
|
}
|
|
2927
3077
|
}
|
|
@@ -3124,8 +3274,8 @@ async function formatDataWithBiome(data, filePath, options) {
|
|
|
3124
3274
|
});
|
|
3125
3275
|
return formatted.content;
|
|
3126
3276
|
} catch (error) {
|
|
3127
|
-
const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access',
|
|
3128
|
-
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")])) {
|
|
3129
3279
|
} else {
|
|
3130
3280
|
console.log(`\u26A0\uFE0F Biome skipped ${path14.default.basename(filePath)}`);
|
|
3131
3281
|
if (errorMessage) {
|
|
@@ -3172,7 +3322,7 @@ function createPoDataLoader(params) {
|
|
|
3172
3322
|
Object.entries(entries).forEach(([msgid, entry]) => {
|
|
3173
3323
|
if (msgid && entry.msgid) {
|
|
3174
3324
|
const context = entry.msgctxt || "";
|
|
3175
|
-
const fullEntry = _optionalChain([parsedPo, 'access',
|
|
3325
|
+
const fullEntry = _optionalChain([parsedPo, 'access', _160 => _160.translations, 'access', _161 => _161[context], 'optionalAccess', _162 => _162[msgid]]);
|
|
3176
3326
|
if (fullEntry) {
|
|
3177
3327
|
result[msgid] = fullEntry;
|
|
3178
3328
|
}
|
|
@@ -3182,8 +3332,8 @@ function createPoDataLoader(params) {
|
|
|
3182
3332
|
return result;
|
|
3183
3333
|
},
|
|
3184
3334
|
async push(locale, data, originalInput, originalLocale, pullInput) {
|
|
3185
|
-
const currentSections = _optionalChain([pullInput, 'optionalAccess',
|
|
3186
|
-
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)]) || [];
|
|
3187
3337
|
const result = originalSections.map((section) => {
|
|
3188
3338
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
3189
3339
|
if (Object.keys(sectionPo.translations).length === 0) {
|
|
@@ -3252,8 +3402,8 @@ function createPoContentLoader() {
|
|
|
3252
3402
|
{
|
|
3253
3403
|
...entry,
|
|
3254
3404
|
msgstr: [
|
|
3255
|
-
_optionalChain([data, 'access',
|
|
3256
|
-
_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
|
|
3257
3407
|
].filter(Boolean)
|
|
3258
3408
|
}
|
|
3259
3409
|
]).fromPairs().value();
|
|
@@ -3375,7 +3525,7 @@ function pullV1(xliffElement, locale, originalLocale) {
|
|
|
3375
3525
|
let key = getTransUnitKey(unit);
|
|
3376
3526
|
if (!key) return;
|
|
3377
3527
|
if (seenKeys.has(key)) {
|
|
3378
|
-
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()]);
|
|
3379
3529
|
if (id) {
|
|
3380
3530
|
key = `${key}#${id}`;
|
|
3381
3531
|
} else {
|
|
@@ -3423,7 +3573,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
3423
3573
|
let key = getTransUnitKey(unit);
|
|
3424
3574
|
if (!key) return;
|
|
3425
3575
|
if (seenKeys.has(key)) {
|
|
3426
|
-
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()]);
|
|
3427
3577
|
if (id) {
|
|
3428
3578
|
key = `${key}#${id}`;
|
|
3429
3579
|
} else {
|
|
@@ -3465,7 +3615,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
3465
3615
|
const translationKeys = new Set(Object.keys(translations));
|
|
3466
3616
|
existingUnits.forEach((unit, key) => {
|
|
3467
3617
|
if (!translationKeys.has(key)) {
|
|
3468
|
-
_optionalChain([unit, 'access',
|
|
3618
|
+
_optionalChain([unit, 'access', _183 => _183.parentNode, 'optionalAccess', _184 => _184.removeChild, 'call', _185 => _185(unit)]);
|
|
3469
3619
|
}
|
|
3470
3620
|
});
|
|
3471
3621
|
return serializeWithDeclaration(
|
|
@@ -3508,18 +3658,18 @@ function traverseUnitsV2(container, fileId, currentPath, result) {
|
|
|
3508
3658
|
Array.from(container.children).forEach((child) => {
|
|
3509
3659
|
const tagName = child.tagName;
|
|
3510
3660
|
if (tagName === "unit") {
|
|
3511
|
-
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()]);
|
|
3512
3662
|
if (!unitId) return;
|
|
3513
3663
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
3514
3664
|
const segment = child.querySelector("segment");
|
|
3515
|
-
const source = _optionalChain([segment, 'optionalAccess',
|
|
3665
|
+
const source = _optionalChain([segment, 'optionalAccess', _190 => _190.querySelector, 'call', _191 => _191("source")]);
|
|
3516
3666
|
if (source) {
|
|
3517
3667
|
result[key] = extractTextContent(source);
|
|
3518
3668
|
} else {
|
|
3519
3669
|
result[key] = unitId;
|
|
3520
3670
|
}
|
|
3521
3671
|
} else if (tagName === "group") {
|
|
3522
|
-
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()]);
|
|
3523
3673
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
3524
3674
|
traverseUnitsV2(child, fileId, newPath, result);
|
|
3525
3675
|
}
|
|
@@ -3555,12 +3705,12 @@ function indexUnitsV2(container, fileId, currentPath, index) {
|
|
|
3555
3705
|
Array.from(container.children).forEach((child) => {
|
|
3556
3706
|
const tagName = child.tagName;
|
|
3557
3707
|
if (tagName === "unit") {
|
|
3558
|
-
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()]);
|
|
3559
3709
|
if (!unitId) return;
|
|
3560
3710
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
3561
3711
|
index.set(key, child);
|
|
3562
3712
|
} else if (tagName === "group") {
|
|
3563
|
-
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()]);
|
|
3564
3714
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
3565
3715
|
indexUnitsV2(child, fileId, newPath, index);
|
|
3566
3716
|
}
|
|
@@ -3581,9 +3731,9 @@ function updateUnitV2(unit, value) {
|
|
|
3581
3731
|
setTextContent(source, value);
|
|
3582
3732
|
}
|
|
3583
3733
|
function getTransUnitKey(transUnit) {
|
|
3584
|
-
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()]);
|
|
3585
3735
|
if (resname) return resname;
|
|
3586
|
-
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()]);
|
|
3587
3737
|
if (id) return id;
|
|
3588
3738
|
const sourceElement = transUnit.querySelector("source");
|
|
3589
3739
|
if (sourceElement) {
|
|
@@ -3640,7 +3790,7 @@ function formatXml(xml) {
|
|
|
3640
3790
|
if (cdataNode) {
|
|
3641
3791
|
return `${indent2}${openTag}<![CDATA[${cdataNode.nodeValue}]]></${tagName}>`;
|
|
3642
3792
|
}
|
|
3643
|
-
const textContent = _optionalChain([element, 'access',
|
|
3793
|
+
const textContent = _optionalChain([element, 'access', _212 => _212.textContent, 'optionalAccess', _213 => _213.trim, 'call', _214 => _214()]) || "";
|
|
3644
3794
|
const hasOnlyText = element.childNodes.length === 1 && element.childNodes[0].nodeType === 3;
|
|
3645
3795
|
if (hasOnlyText && textContent) {
|
|
3646
3796
|
return `${indent2}${openTag}${textContent}</${tagName}>`;
|
|
@@ -3933,7 +4083,7 @@ function createDatoClient(params) {
|
|
|
3933
4083
|
ids: !records.length ? void 0 : records.join(",")
|
|
3934
4084
|
}
|
|
3935
4085
|
}).catch(
|
|
3936
|
-
(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)
|
|
3937
4087
|
);
|
|
3938
4088
|
},
|
|
3939
4089
|
findRecordsForModel: async (modelId, records) => {
|
|
@@ -3944,10 +4094,10 @@ function createDatoClient(params) {
|
|
|
3944
4094
|
filter: {
|
|
3945
4095
|
type: modelId,
|
|
3946
4096
|
only_valid: "true",
|
|
3947
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
4097
|
+
ids: !_optionalChain([records, 'optionalAccess', _219 => _219.length]) ? void 0 : records.join(",")
|
|
3948
4098
|
}
|
|
3949
4099
|
}).catch(
|
|
3950
|
-
(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)
|
|
3951
4101
|
);
|
|
3952
4102
|
return result;
|
|
3953
4103
|
} catch (_error) {
|
|
@@ -3963,10 +4113,10 @@ function createDatoClient(params) {
|
|
|
3963
4113
|
updateRecord: async (id, payload) => {
|
|
3964
4114
|
try {
|
|
3965
4115
|
await dato.items.update(id, payload).catch(
|
|
3966
|
-
(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)
|
|
3967
4117
|
);
|
|
3968
4118
|
} catch (_error) {
|
|
3969
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
4119
|
+
if (_optionalChain([_error, 'optionalAccess', _228 => _228.attributes, 'optionalAccess', _229 => _229.details, 'optionalAccess', _230 => _230.message])) {
|
|
3970
4120
|
throw new Error(
|
|
3971
4121
|
[
|
|
3972
4122
|
`${_error.attributes.details.message}`,
|
|
@@ -3988,10 +4138,10 @@ function createDatoClient(params) {
|
|
|
3988
4138
|
enableFieldLocalization: async (args) => {
|
|
3989
4139
|
try {
|
|
3990
4140
|
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch(
|
|
3991
|
-
(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)
|
|
3992
4142
|
);
|
|
3993
4143
|
} catch (_error) {
|
|
3994
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
4144
|
+
if (_optionalChain([_error, 'optionalAccess', _235 => _235.attributes, 'optionalAccess', _236 => _236.code]) === "NOT_FOUND") {
|
|
3995
4145
|
throw new Error(
|
|
3996
4146
|
[
|
|
3997
4147
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -3999,7 +4149,7 @@ function createDatoClient(params) {
|
|
|
3999
4149
|
].join("\n\n")
|
|
4000
4150
|
);
|
|
4001
4151
|
}
|
|
4002
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
4152
|
+
if (_optionalChain([_error, 'optionalAccess', _237 => _237.attributes, 'optionalAccess', _238 => _238.details, 'optionalAccess', _239 => _239.message])) {
|
|
4003
4153
|
throw new Error(
|
|
4004
4154
|
[
|
|
4005
4155
|
`${_error.attributes.details.message}`,
|
|
@@ -4077,7 +4227,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
4077
4227
|
const records = await dato.findRecordsForModel(modelId);
|
|
4078
4228
|
const recordChoices = createRecordChoices(
|
|
4079
4229
|
records,
|
|
4080
|
-
_optionalChain([config, 'access',
|
|
4230
|
+
_optionalChain([config, 'access', _240 => _240.models, 'access', _241 => _241[modelId], 'optionalAccess', _242 => _242.records]) || [],
|
|
4081
4231
|
project
|
|
4082
4232
|
);
|
|
4083
4233
|
const selectedRecords = await promptRecordSelection(
|
|
@@ -4096,14 +4246,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
4096
4246
|
},
|
|
4097
4247
|
async pull(locale, input2, initCtx) {
|
|
4098
4248
|
const result = {};
|
|
4099
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
4100
|
-
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]) || [];
|
|
4101
4251
|
const recordIds = records.map((record) => record.id);
|
|
4102
4252
|
records = await dato.findRecords(recordIds);
|
|
4103
4253
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
4104
4254
|
if (records.length > 0) {
|
|
4105
4255
|
result[modelId] = {
|
|
4106
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
4256
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _247 => _247.models, 'optionalAccess', _248 => _248[modelId], 'optionalAccess', _249 => _249.fields]) || [],
|
|
4107
4257
|
records
|
|
4108
4258
|
};
|
|
4109
4259
|
}
|
|
@@ -4166,7 +4316,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
4166
4316
|
return records.map((record) => ({
|
|
4167
4317
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
4168
4318
|
value: record.id,
|
|
4169
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
4319
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _250 => _250.includes, 'call', _251 => _251(record.id)])
|
|
4170
4320
|
}));
|
|
4171
4321
|
}
|
|
4172
4322
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -4485,7 +4635,7 @@ function createVttLoader() {
|
|
|
4485
4635
|
if (!input2) {
|
|
4486
4636
|
return "";
|
|
4487
4637
|
}
|
|
4488
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
4638
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _252 => _252.parse, 'call', _253 => _253(input2), 'optionalAccess', _254 => _254.cues]);
|
|
4489
4639
|
if (Object.keys(vtt).length === 0) {
|
|
4490
4640
|
return {};
|
|
4491
4641
|
} else {
|
|
@@ -4539,7 +4689,7 @@ function variableExtractLoader(params) {
|
|
|
4539
4689
|
for (let i = 0; i < matches.length; i++) {
|
|
4540
4690
|
const match2 = matches[i];
|
|
4541
4691
|
const currentValue = result[key].value;
|
|
4542
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
4692
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _255 => _255.replace, 'call', _256 => _256(match2, `{variable:${i}}`)]);
|
|
4543
4693
|
result[key].value = newValue;
|
|
4544
4694
|
result[key].variables[i] = match2;
|
|
4545
4695
|
}
|
|
@@ -4553,7 +4703,7 @@ function variableExtractLoader(params) {
|
|
|
4553
4703
|
for (let i = 0; i < valueObj.variables.length; i++) {
|
|
4554
4704
|
const variable = valueObj.variables[i];
|
|
4555
4705
|
const currentValue = result[key];
|
|
4556
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
4706
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _257 => _257.replace, 'call', _258 => _258(`{variable:${i}}`, variable)]);
|
|
4557
4707
|
result[key] = newValue;
|
|
4558
4708
|
}
|
|
4559
4709
|
}
|
|
@@ -4753,7 +4903,7 @@ function createVueJsonLoader() {
|
|
|
4753
4903
|
return createLoader({
|
|
4754
4904
|
pull: async (locale, input2, ctx) => {
|
|
4755
4905
|
const parsed = parseVueFile(input2);
|
|
4756
|
-
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess',
|
|
4906
|
+
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _259 => _259.i18n, 'optionalAccess', _260 => _260[locale]]), () => ( {}));
|
|
4757
4907
|
},
|
|
4758
4908
|
push: async (locale, data, originalInput) => {
|
|
4759
4909
|
const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
|
|
@@ -4938,7 +5088,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
|
|
|
4938
5088
|
objectExpression.properties.forEach((prop) => {
|
|
4939
5089
|
if (!t.isObjectProperty(prop)) return;
|
|
4940
5090
|
const key = getPropertyKey(prop);
|
|
4941
|
-
const incomingVal = _optionalChain([data, 'optionalAccess',
|
|
5091
|
+
const incomingVal = _optionalChain([data, 'optionalAccess', _261 => _261[key]]);
|
|
4942
5092
|
if (incomingVal === void 0) {
|
|
4943
5093
|
return;
|
|
4944
5094
|
}
|
|
@@ -4974,7 +5124,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
|
|
|
4974
5124
|
let modified = false;
|
|
4975
5125
|
arrayExpression.elements.forEach((element, index) => {
|
|
4976
5126
|
if (!element) return;
|
|
4977
|
-
const incomingVal = _optionalChain([incoming, 'optionalAccess',
|
|
5127
|
+
const incomingVal = _optionalChain([incoming, 'optionalAccess', _262 => _262[index]]);
|
|
4978
5128
|
if (incomingVal === void 0) return;
|
|
4979
5129
|
if (t.isStringLiteral(element) && typeof incomingVal === "string") {
|
|
4980
5130
|
if (element.value !== incomingVal) {
|
|
@@ -5465,7 +5615,7 @@ var AST = class _AST {
|
|
|
5465
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())];
|
|
5466
5616
|
if (this.isStart() && !this.type)
|
|
5467
5617
|
ret.unshift([]);
|
|
5468
|
-
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]) === "!")) {
|
|
5469
5619
|
ret.push({});
|
|
5470
5620
|
}
|
|
5471
5621
|
return ret;
|
|
@@ -5473,7 +5623,7 @@ var AST = class _AST {
|
|
|
5473
5623
|
isStart() {
|
|
5474
5624
|
if (this.#root === this)
|
|
5475
5625
|
return true;
|
|
5476
|
-
if (!_optionalChain([this, 'access',
|
|
5626
|
+
if (!_optionalChain([this, 'access', _265 => _265.#parent, 'optionalAccess', _266 => _266.isStart, 'call', _267 => _267()]))
|
|
5477
5627
|
return false;
|
|
5478
5628
|
if (this.#parentIndex === 0)
|
|
5479
5629
|
return true;
|
|
@@ -5489,12 +5639,12 @@ var AST = class _AST {
|
|
|
5489
5639
|
isEnd() {
|
|
5490
5640
|
if (this.#root === this)
|
|
5491
5641
|
return true;
|
|
5492
|
-
if (_optionalChain([this, 'access',
|
|
5642
|
+
if (_optionalChain([this, 'access', _268 => _268.#parent, 'optionalAccess', _269 => _269.type]) === "!")
|
|
5493
5643
|
return true;
|
|
5494
|
-
if (!_optionalChain([this, 'access',
|
|
5644
|
+
if (!_optionalChain([this, 'access', _270 => _270.#parent, 'optionalAccess', _271 => _271.isEnd, 'call', _272 => _272()]))
|
|
5495
5645
|
return false;
|
|
5496
5646
|
if (!this.type)
|
|
5497
|
-
return _optionalChain([this, 'access',
|
|
5647
|
+
return _optionalChain([this, 'access', _273 => _273.#parent, 'optionalAccess', _274 => _274.isEnd, 'call', _275 => _275()]);
|
|
5498
5648
|
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
|
5499
5649
|
return this.#parentIndex === pl - 1;
|
|
5500
5650
|
}
|
|
@@ -5739,7 +5889,7 @@ var AST = class _AST {
|
|
|
5739
5889
|
}
|
|
5740
5890
|
}
|
|
5741
5891
|
let end = "";
|
|
5742
|
-
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]) === "!") {
|
|
5743
5893
|
end = "(?:$|\\/)";
|
|
5744
5894
|
}
|
|
5745
5895
|
const final2 = start2 + src + end;
|
|
@@ -6816,7 +6966,7 @@ function createMdxSectionsSplit2Loader() {
|
|
|
6816
6966
|
const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
|
|
6817
6967
|
const result = {
|
|
6818
6968
|
frontmatter: data.frontmatter,
|
|
6819
|
-
codePlaceholders: _optionalChain([pullInput, 'optionalAccess',
|
|
6969
|
+
codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _278 => _278.codePlaceholders]) || {},
|
|
6820
6970
|
content
|
|
6821
6971
|
};
|
|
6822
6972
|
return result;
|
|
@@ -7263,6 +7413,15 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
7263
7413
|
createSyncLoader(),
|
|
7264
7414
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
7265
7415
|
);
|
|
7416
|
+
case "markdoc":
|
|
7417
|
+
return composeLoaders(
|
|
7418
|
+
createTextFileLoader(bucketPathPattern),
|
|
7419
|
+
createMarkdocLoader(),
|
|
7420
|
+
createFlatLoader(),
|
|
7421
|
+
createEnsureKeyOrderLoader(),
|
|
7422
|
+
createSyncLoader(),
|
|
7423
|
+
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
7424
|
+
);
|
|
7266
7425
|
case "mdx":
|
|
7267
7426
|
return composeLoaders(
|
|
7268
7427
|
createTextFileLoader(bucketPathPattern),
|
|
@@ -7494,7 +7653,7 @@ function createLingoLocalizer(params) {
|
|
|
7494
7653
|
// src/cli/processor/basic.ts
|
|
7495
7654
|
var _ai = require('ai');
|
|
7496
7655
|
|
|
7497
|
-
function createBasicTranslator(model, systemPrompt) {
|
|
7656
|
+
function createBasicTranslator(model, systemPrompt, settings = {}) {
|
|
7498
7657
|
return async (input2, onProgress) => {
|
|
7499
7658
|
const chunks = extractPayloadChunks(input2.processableData);
|
|
7500
7659
|
const subResults = [];
|
|
@@ -7516,6 +7675,7 @@ function createBasicTranslator(model, systemPrompt) {
|
|
|
7516
7675
|
}
|
|
7517
7676
|
const response = await _ai.generateText.call(void 0, {
|
|
7518
7677
|
model,
|
|
7678
|
+
...settings,
|
|
7519
7679
|
messages: [
|
|
7520
7680
|
{
|
|
7521
7681
|
role: "system",
|
|
@@ -7555,7 +7715,7 @@ function createBasicTranslator(model, systemPrompt) {
|
|
|
7555
7715
|
]
|
|
7556
7716
|
});
|
|
7557
7717
|
const result = JSON.parse(response.text);
|
|
7558
|
-
return _optionalChain([result, 'optionalAccess',
|
|
7718
|
+
return _optionalChain([result, 'optionalAccess', _279 => _279.data]) || {};
|
|
7559
7719
|
}
|
|
7560
7720
|
}
|
|
7561
7721
|
function extractPayloadChunks(payload) {
|
|
@@ -7606,7 +7766,8 @@ function createProcessor(provider, params) {
|
|
|
7606
7766
|
return result;
|
|
7607
7767
|
} else {
|
|
7608
7768
|
const model = getPureModelProvider(provider);
|
|
7609
|
-
const
|
|
7769
|
+
const settings = provider.settings || {};
|
|
7770
|
+
const result = createBasicTranslator(model, provider.prompt, settings);
|
|
7610
7771
|
return result;
|
|
7611
7772
|
}
|
|
7612
7773
|
}
|
|
@@ -7637,7 +7798,7 @@ function getPureModelProvider(provider) {
|
|
|
7637
7798
|
|
|
7638
7799
|
${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
|
|
7639
7800
|
`;
|
|
7640
|
-
switch (_optionalChain([provider, 'optionalAccess',
|
|
7801
|
+
switch (_optionalChain([provider, 'optionalAccess', _280 => _280.id])) {
|
|
7641
7802
|
case "openai": {
|
|
7642
7803
|
if (!process.env.OPENAI_API_KEY) {
|
|
7643
7804
|
throw new Error(
|
|
@@ -7695,7 +7856,7 @@ function getPureModelProvider(provider) {
|
|
|
7695
7856
|
})(provider.model);
|
|
7696
7857
|
}
|
|
7697
7858
|
default: {
|
|
7698
|
-
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess',
|
|
7859
|
+
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _281 => _281.id])));
|
|
7699
7860
|
}
|
|
7700
7861
|
}
|
|
7701
7862
|
}
|
|
@@ -7980,7 +8141,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
7980
8141
|
validateParams(i18nConfig, flags);
|
|
7981
8142
|
ora.succeed("Localization configuration is valid");
|
|
7982
8143
|
ora.start("Connecting to Lingo.dev Localization Engine...");
|
|
7983
|
-
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess',
|
|
8144
|
+
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _282 => _282.provider]);
|
|
7984
8145
|
if (isByokMode) {
|
|
7985
8146
|
authId = null;
|
|
7986
8147
|
ora.succeed("Using external provider (BYOK mode)");
|
|
@@ -7994,16 +8155,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
7994
8155
|
flags
|
|
7995
8156
|
});
|
|
7996
8157
|
let buckets = getBuckets(i18nConfig);
|
|
7997
|
-
if (_optionalChain([flags, 'access',
|
|
8158
|
+
if (_optionalChain([flags, 'access', _283 => _283.bucket, 'optionalAccess', _284 => _284.length])) {
|
|
7998
8159
|
buckets = buckets.filter(
|
|
7999
8160
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
8000
8161
|
);
|
|
8001
8162
|
}
|
|
8002
8163
|
ora.succeed("Buckets retrieved");
|
|
8003
|
-
if (_optionalChain([flags, 'access',
|
|
8164
|
+
if (_optionalChain([flags, 'access', _285 => _285.file, 'optionalAccess', _286 => _286.length])) {
|
|
8004
8165
|
buckets = buckets.map((bucket) => {
|
|
8005
8166
|
const paths = bucket.paths.filter(
|
|
8006
|
-
(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)]))
|
|
8007
8168
|
);
|
|
8008
8169
|
return { ...bucket, paths };
|
|
8009
8170
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -8024,7 +8185,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
8024
8185
|
});
|
|
8025
8186
|
}
|
|
8026
8187
|
}
|
|
8027
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
8188
|
+
const targetLocales = _optionalChain([flags, 'access', _290 => _290.locale, 'optionalAccess', _291 => _291.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
8028
8189
|
ora.start("Setting up localization cache...");
|
|
8029
8190
|
const checkLockfileProcessor = createDeltaProcessor("");
|
|
8030
8191
|
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
@@ -8301,7 +8462,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
8301
8462
|
}
|
|
8302
8463
|
const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
|
|
8303
8464
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
8304
|
-
if (!_optionalChain([flags, 'access',
|
|
8465
|
+
if (!_optionalChain([flags, 'access', _292 => _292.locale, 'optionalAccess', _293 => _293.length])) {
|
|
8305
8466
|
await deltaProcessor.saveChecksums(checksums);
|
|
8306
8467
|
}
|
|
8307
8468
|
}
|
|
@@ -8425,12 +8586,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
8425
8586
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
8426
8587
|
docUrl: "bucketNotFound"
|
|
8427
8588
|
});
|
|
8428
|
-
} 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))])) {
|
|
8429
8590
|
throw new ValidationError({
|
|
8430
8591
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
8431
8592
|
docUrl: "localeTargetNotFound"
|
|
8432
8593
|
});
|
|
8433
|
-
} else if (_optionalChain([flags, 'access',
|
|
8594
|
+
} else if (_optionalChain([flags, 'access', _297 => _297.bucket, 'optionalAccess', _298 => _298.some, 'call', _299 => _299(
|
|
8434
8595
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
8435
8596
|
)])) {
|
|
8436
8597
|
throw new ValidationError({
|
|
@@ -8956,10 +9117,11 @@ function createLingoDotDevLocalizer(explicitApiKey) {
|
|
|
8956
9117
|
const response = await engine.whoami();
|
|
8957
9118
|
return {
|
|
8958
9119
|
authenticated: !!response,
|
|
8959
|
-
username: _optionalChain([response, 'optionalAccess',
|
|
9120
|
+
username: _optionalChain([response, 'optionalAccess', _300 => _300.email])
|
|
8960
9121
|
};
|
|
8961
|
-
} catch (
|
|
8962
|
-
|
|
9122
|
+
} catch (error) {
|
|
9123
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
9124
|
+
return { authenticated: false, error: errorMessage };
|
|
8963
9125
|
}
|
|
8964
9126
|
},
|
|
8965
9127
|
localize: async (input2, onProgress) => {
|
|
@@ -8996,6 +9158,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
|
|
|
8996
9158
|
|
|
8997
9159
|
|
|
8998
9160
|
function createExplicitLocalizer(provider) {
|
|
9161
|
+
const settings = provider.settings || {};
|
|
8999
9162
|
switch (provider.id) {
|
|
9000
9163
|
default:
|
|
9001
9164
|
throw new Error(
|
|
@@ -9019,7 +9182,8 @@ function createExplicitLocalizer(provider) {
|
|
|
9019
9182
|
id: provider.id,
|
|
9020
9183
|
prompt: provider.prompt,
|
|
9021
9184
|
apiKeyName: "OPENAI_API_KEY",
|
|
9022
|
-
baseUrl: provider.baseUrl
|
|
9185
|
+
baseUrl: provider.baseUrl,
|
|
9186
|
+
settings
|
|
9023
9187
|
});
|
|
9024
9188
|
case "anthropic":
|
|
9025
9189
|
return createAiSdkLocalizer({
|
|
@@ -9027,7 +9191,8 @@ function createExplicitLocalizer(provider) {
|
|
|
9027
9191
|
id: provider.id,
|
|
9028
9192
|
prompt: provider.prompt,
|
|
9029
9193
|
apiKeyName: "ANTHROPIC_API_KEY",
|
|
9030
|
-
baseUrl: provider.baseUrl
|
|
9194
|
+
baseUrl: provider.baseUrl,
|
|
9195
|
+
settings
|
|
9031
9196
|
});
|
|
9032
9197
|
case "google":
|
|
9033
9198
|
return createAiSdkLocalizer({
|
|
@@ -9035,7 +9200,8 @@ function createExplicitLocalizer(provider) {
|
|
|
9035
9200
|
id: provider.id,
|
|
9036
9201
|
prompt: provider.prompt,
|
|
9037
9202
|
apiKeyName: "GOOGLE_API_KEY",
|
|
9038
|
-
baseUrl: provider.baseUrl
|
|
9203
|
+
baseUrl: provider.baseUrl,
|
|
9204
|
+
settings
|
|
9039
9205
|
});
|
|
9040
9206
|
case "openrouter":
|
|
9041
9207
|
return createAiSdkLocalizer({
|
|
@@ -9043,14 +9209,16 @@ function createExplicitLocalizer(provider) {
|
|
|
9043
9209
|
id: provider.id,
|
|
9044
9210
|
prompt: provider.prompt,
|
|
9045
9211
|
apiKeyName: "OPENROUTER_API_KEY",
|
|
9046
|
-
baseUrl: provider.baseUrl
|
|
9212
|
+
baseUrl: provider.baseUrl,
|
|
9213
|
+
settings
|
|
9047
9214
|
});
|
|
9048
9215
|
case "ollama":
|
|
9049
9216
|
return createAiSdkLocalizer({
|
|
9050
9217
|
factory: (_params) => _ollamaaiprovider.createOllama.call(void 0, ).languageModel(provider.model),
|
|
9051
9218
|
id: provider.id,
|
|
9052
9219
|
prompt: provider.prompt,
|
|
9053
|
-
skipAuth: true
|
|
9220
|
+
skipAuth: true,
|
|
9221
|
+
settings
|
|
9054
9222
|
});
|
|
9055
9223
|
case "mistral":
|
|
9056
9224
|
return createAiSdkLocalizer({
|
|
@@ -9058,13 +9226,14 @@ function createExplicitLocalizer(provider) {
|
|
|
9058
9226
|
id: provider.id,
|
|
9059
9227
|
prompt: provider.prompt,
|
|
9060
9228
|
apiKeyName: "MISTRAL_API_KEY",
|
|
9061
|
-
baseUrl: provider.baseUrl
|
|
9229
|
+
baseUrl: provider.baseUrl,
|
|
9230
|
+
settings
|
|
9062
9231
|
});
|
|
9063
9232
|
}
|
|
9064
9233
|
}
|
|
9065
9234
|
function createAiSdkLocalizer(params) {
|
|
9066
9235
|
const skipAuth = params.skipAuth === true;
|
|
9067
|
-
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
9236
|
+
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _301 => _301.apiKeyName]), () => ( ""))];
|
|
9068
9237
|
if (!skipAuth && !apiKey || !params.apiKeyName) {
|
|
9069
9238
|
throw new Error(
|
|
9070
9239
|
_dedent2.default`
|
|
@@ -9092,9 +9261,13 @@ function createAiSdkLocalizer(params) {
|
|
|
9092
9261
|
return {
|
|
9093
9262
|
id: params.id,
|
|
9094
9263
|
checkAuth: async () => {
|
|
9264
|
+
return { authenticated: true, username: "anonymous" };
|
|
9265
|
+
},
|
|
9266
|
+
validateSettings: async () => {
|
|
9095
9267
|
try {
|
|
9096
9268
|
await _ai.generateText.call(void 0, {
|
|
9097
9269
|
model,
|
|
9270
|
+
...params.settings,
|
|
9098
9271
|
messages: [
|
|
9099
9272
|
{ role: "system", content: "You are an echo server" },
|
|
9100
9273
|
{ role: "user", content: "OK" },
|
|
@@ -9102,9 +9275,10 @@ function createAiSdkLocalizer(params) {
|
|
|
9102
9275
|
{ role: "user", content: "OK" }
|
|
9103
9276
|
]
|
|
9104
9277
|
});
|
|
9105
|
-
return {
|
|
9278
|
+
return { valid: true };
|
|
9106
9279
|
} catch (error) {
|
|
9107
|
-
|
|
9280
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
9281
|
+
return { valid: false, error: errorMessage };
|
|
9108
9282
|
}
|
|
9109
9283
|
},
|
|
9110
9284
|
localize: async (input2) => {
|
|
@@ -9134,6 +9308,7 @@ function createAiSdkLocalizer(params) {
|
|
|
9134
9308
|
};
|
|
9135
9309
|
const response = await _ai.generateText.call(void 0, {
|
|
9136
9310
|
model,
|
|
9311
|
+
...params.settings,
|
|
9137
9312
|
messages: [
|
|
9138
9313
|
{ role: "system", content: systemPrompt },
|
|
9139
9314
|
{ role: "user", content: "OK" },
|
|
@@ -9147,6 +9322,9 @@ function createAiSdkLocalizer(params) {
|
|
|
9147
9322
|
]
|
|
9148
9323
|
});
|
|
9149
9324
|
const result = JSON.parse(response.text);
|
|
9325
|
+
if (typeof result.data === "object" && result.data !== null) {
|
|
9326
|
+
return result.data;
|
|
9327
|
+
}
|
|
9150
9328
|
const index = result.data.indexOf("{");
|
|
9151
9329
|
const lastIndex = result.data.lastIndexOf("}");
|
|
9152
9330
|
const trimmed = result.data.slice(index, lastIndex + 1);
|
|
@@ -9189,8 +9367,8 @@ async function setup(input2) {
|
|
|
9189
9367
|
throw new Error(
|
|
9190
9368
|
"No buckets found in i18n.json. Please add at least one bucket containing i18n content."
|
|
9191
9369
|
);
|
|
9192
|
-
} else if (_optionalChain([ctx, 'access',
|
|
9193
|
-
(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]])
|
|
9194
9372
|
)])) {
|
|
9195
9373
|
throw new Error(
|
|
9196
9374
|
`One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
|
|
@@ -9203,7 +9381,7 @@ async function setup(input2) {
|
|
|
9203
9381
|
title: "Selecting localization provider",
|
|
9204
9382
|
task: async (ctx, task) => {
|
|
9205
9383
|
ctx.localizer = createLocalizer(
|
|
9206
|
-
_optionalChain([ctx, 'access',
|
|
9384
|
+
_optionalChain([ctx, 'access', _309 => _309.config, 'optionalAccess', _310 => _310.provider]),
|
|
9207
9385
|
ctx.flags.apiKey
|
|
9208
9386
|
);
|
|
9209
9387
|
if (!ctx.localizer) {
|
|
@@ -9216,20 +9394,30 @@ async function setup(input2) {
|
|
|
9216
9394
|
},
|
|
9217
9395
|
{
|
|
9218
9396
|
title: "Checking authentication",
|
|
9397
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _311 => _311.localizer, 'optionalAccess', _312 => _312.id]) === "Lingo.dev",
|
|
9219
9398
|
task: async (ctx, task) => {
|
|
9220
9399
|
const authStatus = await ctx.localizer.checkAuth();
|
|
9221
9400
|
if (!authStatus.authenticated) {
|
|
9222
|
-
throw new Error(
|
|
9223
|
-
`Failed to authenticate with ${_chalk2.default.hex(colors.yellow)(
|
|
9224
|
-
ctx.localizer.id
|
|
9225
|
-
)} provider. Please check your API key and try again.`
|
|
9226
|
-
);
|
|
9401
|
+
throw new Error(authStatus.error || "Authentication failed");
|
|
9227
9402
|
}
|
|
9228
9403
|
task.title = `Authenticated as ${_chalk2.default.hex(colors.yellow)(
|
|
9229
9404
|
authStatus.username
|
|
9230
9405
|
)}`;
|
|
9231
9406
|
}
|
|
9232
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
|
+
},
|
|
9233
9421
|
{
|
|
9234
9422
|
title: "Initializing localization provider",
|
|
9235
9423
|
async task(ctx, task) {
|
|
@@ -9407,12 +9595,21 @@ async function execute(input2) {
|
|
|
9407
9595
|
title: `Processing localization tasks ${_chalk2.default.dim(
|
|
9408
9596
|
`(tasks: ${input2.tasks.length}, concurrency: ${effectiveConcurrency})`
|
|
9409
9597
|
)}`,
|
|
9410
|
-
task: (ctx, task) => {
|
|
9598
|
+
task: async (ctx, task) => {
|
|
9411
9599
|
if (input2.tasks.length < 1) {
|
|
9412
9600
|
task.title = `Skipping, nothing to localize.`;
|
|
9413
9601
|
task.skip();
|
|
9414
9602
|
return;
|
|
9415
9603
|
}
|
|
9604
|
+
const initialChecksumsMap = /* @__PURE__ */ new Map();
|
|
9605
|
+
const uniqueBucketPatterns = _lodash2.default.uniq(
|
|
9606
|
+
ctx.tasks.map((t2) => t2.bucketPathPattern)
|
|
9607
|
+
);
|
|
9608
|
+
for (const bucketPathPattern of uniqueBucketPatterns) {
|
|
9609
|
+
const deltaProcessor = createDeltaProcessor(bucketPathPattern);
|
|
9610
|
+
const checksums = await deltaProcessor.loadChecksums();
|
|
9611
|
+
initialChecksumsMap.set(bucketPathPattern, checksums);
|
|
9612
|
+
}
|
|
9416
9613
|
const i18nLimiter = _plimit2.default.call(void 0, effectiveConcurrency);
|
|
9417
9614
|
const ioLimiter = _plimit2.default.call(void 0, 1);
|
|
9418
9615
|
const workersCount = effectiveConcurrency;
|
|
@@ -9427,6 +9624,7 @@ async function execute(input2) {
|
|
|
9427
9624
|
assignedTasks,
|
|
9428
9625
|
ioLimiter,
|
|
9429
9626
|
i18nLimiter,
|
|
9627
|
+
initialChecksumsMap,
|
|
9430
9628
|
onDone() {
|
|
9431
9629
|
task.title = createExecutionProgressMessage(ctx);
|
|
9432
9630
|
}
|
|
@@ -9506,6 +9704,7 @@ function createWorkerTask(args) {
|
|
|
9506
9704
|
const deltaProcessor = createDeltaProcessor(
|
|
9507
9705
|
assignedTask.bucketPathPattern
|
|
9508
9706
|
);
|
|
9707
|
+
const initialChecksums = args.initialChecksumsMap.get(assignedTask.bucketPathPattern) || {};
|
|
9509
9708
|
const taskResult = await args.i18nLimiter(async () => {
|
|
9510
9709
|
try {
|
|
9511
9710
|
const sourceData = await bucketLoader.pull(
|
|
@@ -9515,16 +9714,15 @@ function createWorkerTask(args) {
|
|
|
9515
9714
|
const targetData = await bucketLoader.pull(
|
|
9516
9715
|
assignedTask.targetLocale
|
|
9517
9716
|
);
|
|
9518
|
-
const checksums = await deltaProcessor.loadChecksums();
|
|
9519
9717
|
const delta = await deltaProcessor.calculateDelta({
|
|
9520
9718
|
sourceData,
|
|
9521
9719
|
targetData,
|
|
9522
|
-
checksums
|
|
9720
|
+
checksums: initialChecksums
|
|
9523
9721
|
});
|
|
9524
9722
|
const processableData = _lodash2.default.chain(sourceData).entries().filter(
|
|
9525
9723
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
|
|
9526
9724
|
).filter(
|
|
9527
|
-
([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(
|
|
9528
9726
|
(pattern) => minimatch(key, pattern)
|
|
9529
9727
|
)])
|
|
9530
9728
|
).fromPairs().value();
|
|
@@ -9532,7 +9730,12 @@ function createWorkerTask(args) {
|
|
|
9532
9730
|
await args.ioLimiter(async () => {
|
|
9533
9731
|
await bucketLoader.push(assignedTask.targetLocale, targetData);
|
|
9534
9732
|
});
|
|
9535
|
-
return {
|
|
9733
|
+
return {
|
|
9734
|
+
status: "skipped",
|
|
9735
|
+
pathPattern: assignedTask.bucketPathPattern,
|
|
9736
|
+
sourceLocale: assignedTask.sourceLocale,
|
|
9737
|
+
targetLocale: assignedTask.targetLocale
|
|
9738
|
+
};
|
|
9536
9739
|
}
|
|
9537
9740
|
const relevantHints = _lodash2.default.pick(hints, Object.keys(processableData));
|
|
9538
9741
|
const processedTargetData = await args.ctx.localizer.localize(
|
|
@@ -9586,16 +9789,24 @@ function createWorkerTask(args) {
|
|
|
9586
9789
|
assignedTask.targetLocale,
|
|
9587
9790
|
finalRenamedTargetData
|
|
9588
9791
|
);
|
|
9589
|
-
const
|
|
9590
|
-
if (!_optionalChain([args, 'access',
|
|
9591
|
-
await deltaProcessor.saveChecksums(
|
|
9792
|
+
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
9793
|
+
if (!_optionalChain([args, 'access', _318 => _318.ctx, 'access', _319 => _319.flags, 'access', _320 => _320.targetLocale, 'optionalAccess', _321 => _321.length])) {
|
|
9794
|
+
await deltaProcessor.saveChecksums(checksums);
|
|
9592
9795
|
}
|
|
9593
9796
|
});
|
|
9594
|
-
return {
|
|
9797
|
+
return {
|
|
9798
|
+
status: "success",
|
|
9799
|
+
pathPattern: assignedTask.bucketPathPattern,
|
|
9800
|
+
sourceLocale: assignedTask.sourceLocale,
|
|
9801
|
+
targetLocale: assignedTask.targetLocale
|
|
9802
|
+
};
|
|
9595
9803
|
} catch (error) {
|
|
9596
9804
|
return {
|
|
9597
9805
|
status: "error",
|
|
9598
|
-
error
|
|
9806
|
+
error,
|
|
9807
|
+
pathPattern: assignedTask.bucketPathPattern,
|
|
9808
|
+
sourceLocale: assignedTask.sourceLocale,
|
|
9809
|
+
targetLocale: assignedTask.targetLocale
|
|
9599
9810
|
};
|
|
9600
9811
|
}
|
|
9601
9812
|
});
|
|
@@ -9778,14 +9989,14 @@ var flagsSchema2 = _zod.z.object({
|
|
|
9778
9989
|
|
|
9779
9990
|
// src/cli/cmd/run/_utils.ts
|
|
9780
9991
|
async function determineAuthId(ctx) {
|
|
9781
|
-
const isByokMode = !!_optionalChain([ctx, 'access',
|
|
9992
|
+
const isByokMode = !!_optionalChain([ctx, 'access', _322 => _322.config, 'optionalAccess', _323 => _323.provider]);
|
|
9782
9993
|
if (isByokMode) {
|
|
9783
9994
|
return null;
|
|
9784
9995
|
} else {
|
|
9785
9996
|
try {
|
|
9786
|
-
const authStatus = await _optionalChain([ctx, 'access',
|
|
9787
|
-
return _optionalChain([authStatus, 'optionalAccess',
|
|
9788
|
-
} 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) {
|
|
9789
10000
|
return null;
|
|
9790
10001
|
}
|
|
9791
10002
|
}
|
|
@@ -9976,7 +10187,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
9976
10187
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
9977
10188
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
9978
10189
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
9979
|
-
_optionalChain([this, 'access',
|
|
10190
|
+
_optionalChain([this, 'access', _328 => _328.platformKit, 'optionalAccess', _329 => _329.gitConfig, 'call', _330 => _330()]);
|
|
9980
10191
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
9981
10192
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
9982
10193
|
if (!processOwnCommits) {
|
|
@@ -10008,7 +10219,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
10008
10219
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
10009
10220
|
var PullRequestFlow = class extends InBranchFlow {
|
|
10010
10221
|
async preRun() {
|
|
10011
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
10222
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _331 => _331()]);
|
|
10012
10223
|
if (!canContinue) {
|
|
10013
10224
|
return false;
|
|
10014
10225
|
}
|
|
@@ -10271,10 +10482,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
10271
10482
|
repo_slug: this.platformConfig.repositoryName,
|
|
10272
10483
|
state: "OPEN"
|
|
10273
10484
|
}).then(({ data: { values } }) => {
|
|
10274
|
-
return _optionalChain([values, 'optionalAccess',
|
|
10275
|
-
({ 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
|
|
10276
10487
|
)]);
|
|
10277
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
10488
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _338 => _338.id]));
|
|
10278
10489
|
}
|
|
10279
10490
|
async closePullRequest({ pullRequestNumber }) {
|
|
10280
10491
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -10370,7 +10581,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
10370
10581
|
repo: this.platformConfig.repositoryName,
|
|
10371
10582
|
base: this.platformConfig.baseBranchName,
|
|
10372
10583
|
state: "open"
|
|
10373
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
10584
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _339 => _339.number]));
|
|
10374
10585
|
}
|
|
10375
10586
|
async closePullRequest({ pullRequestNumber }) {
|
|
10376
10587
|
await this.octokit.rest.pulls.update({
|
|
@@ -10485,7 +10696,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
10485
10696
|
branch
|
|
10486
10697
|
);
|
|
10487
10698
|
return true;
|
|
10488
|
-
} catch (
|
|
10699
|
+
} catch (e4) {
|
|
10489
10700
|
return false;
|
|
10490
10701
|
}
|
|
10491
10702
|
}
|
|
@@ -10497,7 +10708,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
10497
10708
|
sourceBranch: branch,
|
|
10498
10709
|
state: "opened"
|
|
10499
10710
|
});
|
|
10500
|
-
return _optionalChain([mergeRequests, 'access',
|
|
10711
|
+
return _optionalChain([mergeRequests, 'access', _340 => _340[0], 'optionalAccess', _341 => _341.iid]);
|
|
10501
10712
|
}
|
|
10502
10713
|
async closePullRequest({
|
|
10503
10714
|
pullRequestNumber
|
|
@@ -10603,7 +10814,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
10603
10814
|
}
|
|
10604
10815
|
const env = {
|
|
10605
10816
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
10606
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
10817
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _342 => _342.pullRequest, 'optionalAccess', _343 => _343.toString, 'call', _344 => _344()]) || "false",
|
|
10607
10818
|
...options.commitMessage && {
|
|
10608
10819
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
10609
10820
|
},
|
|
@@ -10623,7 +10834,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
10623
10834
|
const { isPullRequestMode } = platformKit.config;
|
|
10624
10835
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
10625
10836
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
10626
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
10837
|
+
const canRun = await _optionalChain([flow, 'access', _345 => _345.preRun, 'optionalCall', _346 => _346()]);
|
|
10627
10838
|
if (canRun === false) {
|
|
10628
10839
|
return;
|
|
10629
10840
|
}
|
|
@@ -10633,7 +10844,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
10633
10844
|
if (!hasChanges) {
|
|
10634
10845
|
return;
|
|
10635
10846
|
}
|
|
10636
|
-
await _optionalChain([flow, 'access',
|
|
10847
|
+
await _optionalChain([flow, 'access', _347 => _347.postRun, 'optionalCall', _348 => _348()]);
|
|
10637
10848
|
});
|
|
10638
10849
|
function parseBooleanArg(val) {
|
|
10639
10850
|
if (val === true) return true;
|
|
@@ -10670,8 +10881,8 @@ function exitGracefully(elapsedMs = 0) {
|
|
|
10670
10881
|
}
|
|
10671
10882
|
}
|
|
10672
10883
|
function checkForPendingOperations() {
|
|
10673
|
-
const activeHandles = _optionalChain([process, 'access',
|
|
10674
|
-
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()]) || [];
|
|
10675
10886
|
const nonStandardHandles = activeHandles.filter((handle) => {
|
|
10676
10887
|
if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
|
|
10677
10888
|
return false;
|
|
@@ -10740,17 +10951,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
10740
10951
|
flags
|
|
10741
10952
|
});
|
|
10742
10953
|
let buckets = getBuckets(i18nConfig);
|
|
10743
|
-
if (_optionalChain([flags, 'access',
|
|
10954
|
+
if (_optionalChain([flags, 'access', _353 => _353.bucket, 'optionalAccess', _354 => _354.length])) {
|
|
10744
10955
|
buckets = buckets.filter(
|
|
10745
10956
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
10746
10957
|
);
|
|
10747
10958
|
}
|
|
10748
10959
|
ora.succeed("Buckets retrieved");
|
|
10749
|
-
if (_optionalChain([flags, 'access',
|
|
10960
|
+
if (_optionalChain([flags, 'access', _355 => _355.file, 'optionalAccess', _356 => _356.length])) {
|
|
10750
10961
|
buckets = buckets.map((bucket) => {
|
|
10751
10962
|
const paths = bucket.paths.filter(
|
|
10752
10963
|
(path19) => flags.file.find(
|
|
10753
|
-
(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)
|
|
10754
10965
|
)
|
|
10755
10966
|
);
|
|
10756
10967
|
return { ...bucket, paths };
|
|
@@ -10770,7 +10981,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
10770
10981
|
});
|
|
10771
10982
|
}
|
|
10772
10983
|
}
|
|
10773
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
10984
|
+
const targetLocales = _optionalChain([flags, 'access', _363 => _363.locale, 'optionalAccess', _364 => _364.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
10774
10985
|
let totalSourceKeyCount = 0;
|
|
10775
10986
|
let uniqueKeysToTranslate = 0;
|
|
10776
10987
|
let totalExistingTranslations = 0;
|
|
@@ -11176,12 +11387,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
11176
11387
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
11177
11388
|
docUrl: "bucketNotFound"
|
|
11178
11389
|
});
|
|
11179
|
-
} 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))])) {
|
|
11180
11391
|
throw new CLIError({
|
|
11181
11392
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
11182
11393
|
docUrl: "localeTargetNotFound"
|
|
11183
11394
|
});
|
|
11184
|
-
} else if (_optionalChain([flags, 'access',
|
|
11395
|
+
} else if (_optionalChain([flags, 'access', _368 => _368.bucket, 'optionalAccess', _369 => _369.some, 'call', _370 => _370(
|
|
11185
11396
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
11186
11397
|
)])) {
|
|
11187
11398
|
throw new CLIError({
|
|
@@ -11273,7 +11484,7 @@ async function renderHero2() {
|
|
|
11273
11484
|
// package.json
|
|
11274
11485
|
var package_default = {
|
|
11275
11486
|
name: "lingo.dev",
|
|
11276
|
-
version: "0.
|
|
11487
|
+
version: "0.112.0",
|
|
11277
11488
|
description: "Lingo.dev CLI",
|
|
11278
11489
|
private: false,
|
|
11279
11490
|
publishConfig: {
|
|
@@ -11414,6 +11625,7 @@ var package_default = {
|
|
|
11414
11625
|
"@lingo.dev/_react": "workspace:*",
|
|
11415
11626
|
"@lingo.dev/_sdk": "workspace:*",
|
|
11416
11627
|
"@lingo.dev/_spec": "workspace:*",
|
|
11628
|
+
"@markdoc/markdoc": "^0.5.4",
|
|
11417
11629
|
"@modelcontextprotocol/sdk": "^1.5.0",
|
|
11418
11630
|
"@openrouter/ai-sdk-provider": "^0.7.1",
|
|
11419
11631
|
"@paralleldrive/cuid2": "^2.2.2",
|
|
@@ -11562,7 +11774,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
|
|
|
11562
11774
|
if (options.file && options.file.length) {
|
|
11563
11775
|
buckets = buckets.map((bucket) => {
|
|
11564
11776
|
const paths = bucket.paths.filter(
|
|
11565
|
-
(bucketPath) => _optionalChain([options, 'access',
|
|
11777
|
+
(bucketPath) => _optionalChain([options, 'access', _371 => _371.file, 'optionalAccess', _372 => _372.some, 'call', _373 => _373((f) => bucketPath.pathPattern.includes(f))])
|
|
11566
11778
|
);
|
|
11567
11779
|
return { ...bucket, paths };
|
|
11568
11780
|
}).filter((bucket) => bucket.paths.length > 0);
|