lingo.dev 0.117.2 → 0.117.4
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 +175 -151
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +43 -19
- package/build/cli.mjs.map +1 -1
- package/package.json +2 -2
package/build/cli.cjs
CHANGED
|
@@ -2097,14 +2097,15 @@ function createYamlLoader() {
|
|
|
2097
2097
|
}
|
|
2098
2098
|
try {
|
|
2099
2099
|
const sourceDoc = _yaml2.default.parseDocument(originalInput);
|
|
2100
|
-
const metadata = extractQuotingMetadata(sourceDoc);
|
|
2101
2100
|
const outputDoc = _yaml2.default.parseDocument(
|
|
2102
2101
|
_yaml2.default.stringify(payload, {
|
|
2103
2102
|
lineWidth: -1,
|
|
2104
2103
|
defaultKeyType: "PLAIN"
|
|
2105
2104
|
})
|
|
2106
2105
|
);
|
|
2107
|
-
|
|
2106
|
+
const isRootKeyFormat = detectRootKeyFormat(sourceDoc, outputDoc);
|
|
2107
|
+
const metadata = extractQuotingMetadata(sourceDoc, isRootKeyFormat);
|
|
2108
|
+
applyQuotingMetadata(outputDoc, metadata, isRootKeyFormat);
|
|
2108
2109
|
return outputDoc.toString({ lineWidth: -1 });
|
|
2109
2110
|
} catch (error) {
|
|
2110
2111
|
console.warn("Failed to preserve YAML formatting:", error);
|
|
@@ -2117,14 +2118,39 @@ function createYamlLoader() {
|
|
|
2117
2118
|
}
|
|
2118
2119
|
});
|
|
2119
2120
|
}
|
|
2120
|
-
function
|
|
2121
|
+
function detectRootKeyFormat(sourceDoc, outputDoc) {
|
|
2122
|
+
const sourceRoot = sourceDoc.contents;
|
|
2123
|
+
const outputRoot = outputDoc.contents;
|
|
2124
|
+
if (!isYAMLMap(sourceRoot) || !isYAMLMap(outputRoot)) {
|
|
2125
|
+
return false;
|
|
2126
|
+
}
|
|
2127
|
+
const sourceMap = sourceRoot;
|
|
2128
|
+
const outputMap = outputRoot;
|
|
2129
|
+
if (!sourceMap.items || sourceMap.items.length !== 1 || !outputMap.items || outputMap.items.length !== 1) {
|
|
2130
|
+
return false;
|
|
2131
|
+
}
|
|
2132
|
+
const sourceRootKey = getKeyValue(sourceMap.items[0].key);
|
|
2133
|
+
const outputRootKey = getKeyValue(outputMap.items[0].key);
|
|
2134
|
+
if (sourceRootKey !== outputRootKey && typeof sourceRootKey === "string" && typeof outputRootKey === "string") {
|
|
2135
|
+
return true;
|
|
2136
|
+
}
|
|
2137
|
+
return false;
|
|
2138
|
+
}
|
|
2139
|
+
function extractQuotingMetadata(doc, skipRootKey) {
|
|
2121
2140
|
const metadata = {
|
|
2122
2141
|
keys: /* @__PURE__ */ new Map(),
|
|
2123
2142
|
values: /* @__PURE__ */ new Map()
|
|
2124
2143
|
};
|
|
2125
2144
|
const root = doc.contents;
|
|
2126
2145
|
if (!root) return metadata;
|
|
2127
|
-
|
|
2146
|
+
let startNode = root;
|
|
2147
|
+
if (skipRootKey && isYAMLMap(root)) {
|
|
2148
|
+
const rootMap = root;
|
|
2149
|
+
if (rootMap.items && rootMap.items.length === 1) {
|
|
2150
|
+
startNode = rootMap.items[0].value;
|
|
2151
|
+
}
|
|
2152
|
+
}
|
|
2153
|
+
walkAndExtract(startNode, [], metadata);
|
|
2128
2154
|
return metadata;
|
|
2129
2155
|
}
|
|
2130
2156
|
function walkAndExtract(node, path19, metadata) {
|
|
@@ -2159,10 +2185,17 @@ function walkAndExtract(node, path19, metadata) {
|
|
|
2159
2185
|
}
|
|
2160
2186
|
}
|
|
2161
2187
|
}
|
|
2162
|
-
function applyQuotingMetadata(doc, metadata) {
|
|
2188
|
+
function applyQuotingMetadata(doc, metadata, skipRootKey) {
|
|
2163
2189
|
const root = doc.contents;
|
|
2164
2190
|
if (!root) return;
|
|
2165
|
-
|
|
2191
|
+
let startNode = root;
|
|
2192
|
+
if (skipRootKey && isYAMLMap(root)) {
|
|
2193
|
+
const rootMap = root;
|
|
2194
|
+
if (rootMap.items && rootMap.items.length === 1) {
|
|
2195
|
+
startNode = rootMap.items[0].value;
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
walkAndApply(startNode, [], metadata);
|
|
2166
2199
|
}
|
|
2167
2200
|
function walkAndApply(node, path19, metadata) {
|
|
2168
2201
|
if (isScalar(node)) {
|
|
@@ -2200,22 +2233,13 @@ function walkAndApply(node, path19, metadata) {
|
|
|
2200
2233
|
}
|
|
2201
2234
|
}
|
|
2202
2235
|
function isScalar(node) {
|
|
2203
|
-
|
|
2204
|
-
return true;
|
|
2205
|
-
}
|
|
2206
|
-
return node && typeof node === "object" && "value" in node && ("type" in node || "format" in node);
|
|
2236
|
+
return _yaml2.default.isScalar(node);
|
|
2207
2237
|
}
|
|
2208
2238
|
function isYAMLMap(node) {
|
|
2209
|
-
|
|
2210
|
-
return true;
|
|
2211
|
-
}
|
|
2212
|
-
return node && typeof node === "object" && "items" in node && Array.isArray(node.items) && !("value" in node);
|
|
2239
|
+
return _yaml2.default.isMap(node);
|
|
2213
2240
|
}
|
|
2214
2241
|
function isYAMLSeq(node) {
|
|
2215
|
-
|
|
2216
|
-
return true;
|
|
2217
|
-
}
|
|
2218
|
-
return node && typeof node === "object" && "items" in node && Array.isArray(node.items) && !("type" in node) && !("value" in node);
|
|
2242
|
+
return _yaml2.default.isSeq(node);
|
|
2219
2243
|
}
|
|
2220
2244
|
function getKeyValue(key) {
|
|
2221
2245
|
if (key === null || key === void 0) {
|
|
@@ -2408,7 +2432,7 @@ async function parseAndroidDocument(input2) {
|
|
|
2408
2432
|
const resourceNodes = [];
|
|
2409
2433
|
let metaIndex = 0;
|
|
2410
2434
|
for (const child of resourcesNode.$$) {
|
|
2411
|
-
const elementName = _optionalChain([child, 'optionalAccess',
|
|
2435
|
+
const elementName = _optionalChain([child, 'optionalAccess', _112 => _112["#name"]]);
|
|
2412
2436
|
if (!isResourceElementName(elementName)) {
|
|
2413
2437
|
continue;
|
|
2414
2438
|
}
|
|
@@ -2416,11 +2440,11 @@ async function parseAndroidDocument(input2) {
|
|
|
2416
2440
|
if (!meta || meta.type !== elementName) {
|
|
2417
2441
|
continue;
|
|
2418
2442
|
}
|
|
2419
|
-
const name = _nullishCoalesce(_optionalChain([child, 'optionalAccess',
|
|
2443
|
+
const name = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _113 => _113.$, 'optionalAccess', _114 => _114.name]), () => ( meta.name));
|
|
2420
2444
|
if (!name) {
|
|
2421
2445
|
continue;
|
|
2422
2446
|
}
|
|
2423
|
-
const translatable = (_nullishCoalesce(_optionalChain([child, 'optionalAccess',
|
|
2447
|
+
const translatable = (_nullishCoalesce(_optionalChain([child, 'optionalAccess', _115 => _115.$, 'optionalAccess', _116 => _116.translatable]), () => ( ""))).toLowerCase() !== "false";
|
|
2424
2448
|
switch (meta.type) {
|
|
2425
2449
|
case "string": {
|
|
2426
2450
|
resourceNodes.push({
|
|
@@ -2433,7 +2457,7 @@ async function parseAndroidDocument(input2) {
|
|
|
2433
2457
|
break;
|
|
2434
2458
|
}
|
|
2435
2459
|
case "string-array": {
|
|
2436
|
-
const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess',
|
|
2460
|
+
const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _117 => _117.item]), () => ( []));
|
|
2437
2461
|
const items = [];
|
|
2438
2462
|
const templateItems = meta.items;
|
|
2439
2463
|
for (let i = 0; i < Math.max(itemNodes.length, templateItems.length); i++) {
|
|
@@ -2457,7 +2481,7 @@ async function parseAndroidDocument(input2) {
|
|
|
2457
2481
|
break;
|
|
2458
2482
|
}
|
|
2459
2483
|
case "plurals": {
|
|
2460
|
-
const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess',
|
|
2484
|
+
const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _118 => _118.item]), () => ( []));
|
|
2461
2485
|
const templateItems = meta.items;
|
|
2462
2486
|
const items = [];
|
|
2463
2487
|
for (const templateItem of templateItems) {
|
|
@@ -2466,7 +2490,7 @@ async function parseAndroidDocument(input2) {
|
|
|
2466
2490
|
continue;
|
|
2467
2491
|
}
|
|
2468
2492
|
const nodeItem = itemNodes.find(
|
|
2469
|
-
(item) => _optionalChain([item, 'optionalAccess',
|
|
2493
|
+
(item) => _optionalChain([item, 'optionalAccess', _119 => _119.$, 'optionalAccess', _120 => _120.quantity]) === quantity
|
|
2470
2494
|
);
|
|
2471
2495
|
if (!nodeItem) {
|
|
2472
2496
|
continue;
|
|
@@ -2747,7 +2771,7 @@ function cloneResourceNode(resource) {
|
|
|
2747
2771
|
const nodeClone = deepClone(resource.node);
|
|
2748
2772
|
const itemNodes = _nullishCoalesce(nodeClone.item, () => ( []));
|
|
2749
2773
|
const items = itemNodes.map((itemNode, index) => {
|
|
2750
|
-
const templateMeta = _nullishCoalesce(_nullishCoalesce(_optionalChain([resource, 'access',
|
|
2774
|
+
const templateMeta = _nullishCoalesce(_nullishCoalesce(_optionalChain([resource, 'access', _121 => _121.items, 'access', _122 => _122[index], 'optionalAccess', _123 => _123.meta]), () => ( _optionalChain([resource, 'access', _124 => _124.items, 'access', _125 => _125[resource.items.length - 1], 'optionalAccess', _126 => _126.meta]))), () => ( makeTextMeta([])));
|
|
2751
2775
|
return {
|
|
2752
2776
|
node: itemNode,
|
|
2753
2777
|
meta: cloneTextMeta(templateMeta)
|
|
@@ -2767,7 +2791,7 @@ function cloneResourceNode(resource) {
|
|
|
2767
2791
|
const items = [];
|
|
2768
2792
|
for (const templateItem of resource.items) {
|
|
2769
2793
|
const cloneNode = itemNodes.find(
|
|
2770
|
-
(item) => _optionalChain([item, 'optionalAccess',
|
|
2794
|
+
(item) => _optionalChain([item, 'optionalAccess', _127 => _127.$, 'optionalAccess', _128 => _128.quantity]) === templateItem.quantity
|
|
2771
2795
|
);
|
|
2772
2796
|
if (!cloneNode) {
|
|
2773
2797
|
continue;
|
|
@@ -3023,8 +3047,8 @@ function cloneDocumentStructure(document) {
|
|
|
3023
3047
|
resourceNodes.map((r) => resourceLookupKey(r.type, r.name))
|
|
3024
3048
|
);
|
|
3025
3049
|
let filtered = resourcesClone.$$.filter((child) => {
|
|
3026
|
-
const elementName = _optionalChain([child, 'optionalAccess',
|
|
3027
|
-
const name = _optionalChain([child, 'optionalAccess',
|
|
3050
|
+
const elementName = _optionalChain([child, 'optionalAccess', _129 => _129["#name"]]);
|
|
3051
|
+
const name = _optionalChain([child, 'optionalAccess', _130 => _130.$, 'optionalAccess', _131 => _131.name]);
|
|
3028
3052
|
if (!isResourceElementName(elementName) || !name) {
|
|
3029
3053
|
return true;
|
|
3030
3054
|
}
|
|
@@ -3033,7 +3057,7 @@ function cloneDocumentStructure(document) {
|
|
|
3033
3057
|
const cleaned = [];
|
|
3034
3058
|
let lastWasWhitespace = false;
|
|
3035
3059
|
for (const child of filtered) {
|
|
3036
|
-
const isWhitespace = _optionalChain([child, 'optionalAccess',
|
|
3060
|
+
const isWhitespace = _optionalChain([child, 'optionalAccess', _132 => _132["#name"]]) === "__text__" && (!child._ || child._.trim() === "");
|
|
3037
3061
|
if (isWhitespace) {
|
|
3038
3062
|
if (!lastWasWhitespace) {
|
|
3039
3063
|
cleaned.push(child);
|
|
@@ -3055,8 +3079,8 @@ function buildResourceLookup(resources) {
|
|
|
3055
3079
|
const lookup = /* @__PURE__ */ new Map();
|
|
3056
3080
|
const children = Array.isArray(resources.$$) ? resources.$$ : [];
|
|
3057
3081
|
for (const child of children) {
|
|
3058
|
-
const type = _optionalChain([child, 'optionalAccess',
|
|
3059
|
-
const name = _optionalChain([child, 'optionalAccess',
|
|
3082
|
+
const type = _optionalChain([child, 'optionalAccess', _133 => _133["#name"]]);
|
|
3083
|
+
const name = _optionalChain([child, 'optionalAccess', _134 => _134.$, 'optionalAccess', _135 => _135.name]);
|
|
3060
3084
|
if (!type || !name || !isResourceElementName(type)) {
|
|
3061
3085
|
continue;
|
|
3062
3086
|
}
|
|
@@ -3085,7 +3109,7 @@ function cloneResourceNodeFromLookup(resource, lookup) {
|
|
|
3085
3109
|
}
|
|
3086
3110
|
case "string-array": {
|
|
3087
3111
|
const childItems = (Array.isArray(node.$$) ? node.$$ : []).filter(
|
|
3088
|
-
(child) => _optionalChain([child, 'optionalAccess',
|
|
3112
|
+
(child) => _optionalChain([child, 'optionalAccess', _136 => _136["#name"]]) === "item"
|
|
3089
3113
|
);
|
|
3090
3114
|
node.item = childItems;
|
|
3091
3115
|
if (childItems.length < resource.items.length) {
|
|
@@ -3114,12 +3138,12 @@ function cloneResourceNodeFromLookup(resource, lookup) {
|
|
|
3114
3138
|
}
|
|
3115
3139
|
case "plurals": {
|
|
3116
3140
|
const childItems = (Array.isArray(node.$$) ? node.$$ : []).filter(
|
|
3117
|
-
(child) => _optionalChain([child, 'optionalAccess',
|
|
3141
|
+
(child) => _optionalChain([child, 'optionalAccess', _137 => _137["#name"]]) === "item"
|
|
3118
3142
|
);
|
|
3119
3143
|
node.item = childItems;
|
|
3120
3144
|
const itemMap = /* @__PURE__ */ new Map();
|
|
3121
3145
|
for (const item of childItems) {
|
|
3122
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
3146
|
+
if (_optionalChain([item, 'optionalAccess', _138 => _138.$, 'optionalAccess', _139 => _139.quantity])) {
|
|
3123
3147
|
itemMap.set(item.$.quantity, item);
|
|
3124
3148
|
}
|
|
3125
3149
|
}
|
|
@@ -3409,7 +3433,7 @@ var _sync3 = require('csv-stringify/sync');
|
|
|
3409
3433
|
|
|
3410
3434
|
function detectKeyColumnName(csvString) {
|
|
3411
3435
|
const row = _sync.parse.call(void 0, csvString)[0];
|
|
3412
|
-
const firstColumn = _optionalChain([row, 'optionalAccess',
|
|
3436
|
+
const firstColumn = _optionalChain([row, 'optionalAccess', _140 => _140[0], 'optionalAccess', _141 => _141.trim, 'call', _142 => _142()]);
|
|
3413
3437
|
return firstColumn || "KEY";
|
|
3414
3438
|
}
|
|
3415
3439
|
function createCsvLoader() {
|
|
@@ -3511,7 +3535,7 @@ function createHtmlLoader() {
|
|
|
3511
3535
|
break;
|
|
3512
3536
|
}
|
|
3513
3537
|
const siblings = Array.from(parent.childNodes).filter(
|
|
3514
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
3538
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _143 => _143.textContent, 'optionalAccess', _144 => _144.trim, 'call', _145 => _145()])
|
|
3515
3539
|
);
|
|
3516
3540
|
const index = siblings.indexOf(current);
|
|
3517
3541
|
if (index !== -1) {
|
|
@@ -3547,15 +3571,15 @@ function createHtmlLoader() {
|
|
|
3547
3571
|
}
|
|
3548
3572
|
});
|
|
3549
3573
|
Array.from(element.childNodes).filter(
|
|
3550
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
3574
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _146 => _146.textContent, 'optionalAccess', _147 => _147.trim, 'call', _148 => _148()])
|
|
3551
3575
|
).forEach(processNode);
|
|
3552
3576
|
}
|
|
3553
3577
|
};
|
|
3554
3578
|
Array.from(document.head.childNodes).filter(
|
|
3555
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
3579
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _149 => _149.textContent, 'optionalAccess', _150 => _150.trim, 'call', _151 => _151()])
|
|
3556
3580
|
).forEach(processNode);
|
|
3557
3581
|
Array.from(document.body.childNodes).filter(
|
|
3558
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
3582
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _152 => _152.textContent, 'optionalAccess', _153 => _153.trim, 'call', _154 => _154()])
|
|
3559
3583
|
).forEach(processNode);
|
|
3560
3584
|
return result;
|
|
3561
3585
|
},
|
|
@@ -3580,7 +3604,7 @@ function createHtmlLoader() {
|
|
|
3580
3604
|
for (let i = 0; i < indices.length; i++) {
|
|
3581
3605
|
const index = parseInt(indices[i]);
|
|
3582
3606
|
const siblings = Array.from(parent.childNodes).filter(
|
|
3583
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
3607
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _155 => _155.textContent, 'optionalAccess', _156 => _156.trim, 'call', _157 => _157()])
|
|
3584
3608
|
);
|
|
3585
3609
|
if (index >= siblings.length) {
|
|
3586
3610
|
if (i === indices.length - 1) {
|
|
@@ -3631,7 +3655,7 @@ function createMarkdownLoader() {
|
|
|
3631
3655
|
yaml: yamlEngine
|
|
3632
3656
|
}
|
|
3633
3657
|
});
|
|
3634
|
-
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess',
|
|
3658
|
+
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _158 => _158.trim, 'call', _159 => _159()]), () => ( ""))).filter(Boolean);
|
|
3635
3659
|
return {
|
|
3636
3660
|
...Object.fromEntries(
|
|
3637
3661
|
sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
|
|
@@ -3650,7 +3674,7 @@ function createMarkdownLoader() {
|
|
|
3650
3674
|
);
|
|
3651
3675
|
let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(
|
|
3652
3676
|
([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())
|
|
3653
|
-
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess',
|
|
3677
|
+
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _160 => _160.trim, 'call', _161 => _161()]), () => ( ""))).filter(Boolean).join("\n\n");
|
|
3654
3678
|
if (Object.keys(frontmatter).length > 0) {
|
|
3655
3679
|
content = `
|
|
3656
3680
|
${content}`;
|
|
@@ -3675,7 +3699,7 @@ function createMarkdocLoader() {
|
|
|
3675
3699
|
const result = {};
|
|
3676
3700
|
const counters = {};
|
|
3677
3701
|
traverseAndExtract(ast, "", result, counters);
|
|
3678
|
-
if (_optionalChain([ast, 'access',
|
|
3702
|
+
if (_optionalChain([ast, 'access', _162 => _162.attributes, 'optionalAccess', _163 => _163.frontmatter])) {
|
|
3679
3703
|
const frontmatter = _yaml2.default.parse(ast.attributes.frontmatter);
|
|
3680
3704
|
Object.entries(frontmatter).forEach(([key, value]) => {
|
|
3681
3705
|
if (typeof value === "string") {
|
|
@@ -3721,7 +3745,7 @@ function traverseAndExtract(node, path19, result, counters, parentType) {
|
|
|
3721
3745
|
if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
|
|
3722
3746
|
semanticType = nodeSemanticType;
|
|
3723
3747
|
}
|
|
3724
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
3748
|
+
if (node.type === "text" && _optionalChain([node, 'access', _164 => _164.attributes, 'optionalAccess', _165 => _165.content])) {
|
|
3725
3749
|
const content = node.attributes.content;
|
|
3726
3750
|
if (typeof content === "string" && content.trim()) {
|
|
3727
3751
|
if (semanticType) {
|
|
@@ -3748,7 +3772,7 @@ function buildPathMap(node, path19, counters, pathMap, parentType) {
|
|
|
3748
3772
|
if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
|
|
3749
3773
|
semanticType = nodeSemanticType;
|
|
3750
3774
|
}
|
|
3751
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
3775
|
+
if (node.type === "text" && _optionalChain([node, 'access', _166 => _166.attributes, 'optionalAccess', _167 => _167.content])) {
|
|
3752
3776
|
const content = node.attributes.content;
|
|
3753
3777
|
if (typeof content === "string" && content.trim()) {
|
|
3754
3778
|
if (semanticType) {
|
|
@@ -3771,7 +3795,7 @@ function applyTranslations(node, path19, data, pathMap) {
|
|
|
3771
3795
|
if (!node || typeof node !== "object") {
|
|
3772
3796
|
return;
|
|
3773
3797
|
}
|
|
3774
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
3798
|
+
if (node.type === "text" && _optionalChain([node, 'access', _168 => _168.attributes, 'optionalAccess', _169 => _169.content])) {
|
|
3775
3799
|
const content = node.attributes.content;
|
|
3776
3800
|
if (typeof content === "string") {
|
|
3777
3801
|
const contentPath = path19 ? `${path19}/attributes/content` : "attributes/content";
|
|
@@ -3821,7 +3845,7 @@ function isSkippableLine(line) {
|
|
|
3821
3845
|
function parsePropertyLine(line) {
|
|
3822
3846
|
const [key, ...valueParts] = line.split("=");
|
|
3823
3847
|
return {
|
|
3824
|
-
key: _optionalChain([key, 'optionalAccess',
|
|
3848
|
+
key: _optionalChain([key, 'optionalAccess', _170 => _170.trim, 'call', _171 => _171()]) || "",
|
|
3825
3849
|
value: valueParts.join("=").trim()
|
|
3826
3850
|
};
|
|
3827
3851
|
}
|
|
@@ -4113,7 +4137,7 @@ var Parser = class {
|
|
|
4113
4137
|
}
|
|
4114
4138
|
}
|
|
4115
4139
|
expect(type) {
|
|
4116
|
-
if (_optionalChain([this, 'access',
|
|
4140
|
+
if (_optionalChain([this, 'access', _172 => _172.current, 'call', _173 => _173(), 'optionalAccess', _174 => _174.type]) === type) {
|
|
4117
4141
|
this.advance();
|
|
4118
4142
|
return true;
|
|
4119
4143
|
}
|
|
@@ -4190,7 +4214,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4190
4214
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
4191
4215
|
continue;
|
|
4192
4216
|
}
|
|
4193
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
4217
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _175 => _175.localizations, 'optionalAccess', _176 => _176[locale]]);
|
|
4194
4218
|
if (langTranslationEntity) {
|
|
4195
4219
|
if ("stringUnit" in langTranslationEntity) {
|
|
4196
4220
|
resultData[translationKey] = langTranslationEntity.stringUnit.value;
|
|
@@ -4204,7 +4228,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4204
4228
|
resultData[translationKey] = {};
|
|
4205
4229
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
4206
4230
|
for (const form in pluralForms) {
|
|
4207
|
-
if (_optionalChain([pluralForms, 'access',
|
|
4231
|
+
if (_optionalChain([pluralForms, 'access', _177 => _177[form], 'optionalAccess', _178 => _178.stringUnit, 'optionalAccess', _179 => _179.value])) {
|
|
4208
4232
|
resultData[translationKey][form] = pluralForms[form].stringUnit.value;
|
|
4209
4233
|
}
|
|
4210
4234
|
}
|
|
@@ -4230,7 +4254,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4230
4254
|
const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
|
|
4231
4255
|
if (typeof value === "string") {
|
|
4232
4256
|
langDataToMerge.strings[key] = {
|
|
4233
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
4257
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _180 => _180.strings, 'optionalAccess', _181 => _181[key], 'optionalAccess', _182 => _182.extractionState]),
|
|
4234
4258
|
localizations: {
|
|
4235
4259
|
[locale]: {
|
|
4236
4260
|
stringUnit: {
|
|
@@ -4245,7 +4269,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4245
4269
|
}
|
|
4246
4270
|
} else if (Array.isArray(value)) {
|
|
4247
4271
|
langDataToMerge.strings[key] = {
|
|
4248
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
4272
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _183 => _183.strings, 'optionalAccess', _184 => _184[key], 'optionalAccess', _185 => _185.extractionState]),
|
|
4249
4273
|
localizations: {
|
|
4250
4274
|
[locale]: {
|
|
4251
4275
|
stringSet: {
|
|
@@ -4303,7 +4327,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4303
4327
|
for (const [locale, localization] of Object.entries(
|
|
4304
4328
|
entity.localizations
|
|
4305
4329
|
)) {
|
|
4306
|
-
if (_optionalChain([localization, 'access',
|
|
4330
|
+
if (_optionalChain([localization, 'access', _186 => _186.variations, 'optionalAccess', _187 => _187.plural])) {
|
|
4307
4331
|
const pluralForms = localization.variations.plural;
|
|
4308
4332
|
for (const form in pluralForms) {
|
|
4309
4333
|
const pluralKey = `${translationKey}/${form}`;
|
|
@@ -4323,7 +4347,7 @@ function _removeLocale(input2, locale) {
|
|
|
4323
4347
|
const { strings } = input2;
|
|
4324
4348
|
const newStrings = _lodash2.default.cloneDeep(strings);
|
|
4325
4349
|
for (const [key, value] of Object.entries(newStrings)) {
|
|
4326
|
-
if (_optionalChain([value, 'access',
|
|
4350
|
+
if (_optionalChain([value, 'access', _188 => _188.localizations, 'optionalAccess', _189 => _189[locale]])) {
|
|
4327
4351
|
delete value.localizations[locale];
|
|
4328
4352
|
}
|
|
4329
4353
|
}
|
|
@@ -4454,7 +4478,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
4454
4478
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
4455
4479
|
continue;
|
|
4456
4480
|
}
|
|
4457
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
4481
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _190 => _190.localizations, 'optionalAccess', _191 => _191[locale]]);
|
|
4458
4482
|
if (langTranslationEntity) {
|
|
4459
4483
|
if (!resultData[translationKey]) {
|
|
4460
4484
|
resultData[translationKey] = {};
|
|
@@ -4466,7 +4490,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
4466
4490
|
for (const [subName, subData] of Object.entries(
|
|
4467
4491
|
langTranslationEntity.substitutions
|
|
4468
4492
|
)) {
|
|
4469
|
-
const pluralForms = _optionalChain([subData, 'access',
|
|
4493
|
+
const pluralForms = _optionalChain([subData, 'access', _192 => _192.variations, 'optionalAccess', _193 => _193.plural]);
|
|
4470
4494
|
if (pluralForms) {
|
|
4471
4495
|
const forms = {};
|
|
4472
4496
|
for (const [form, formData] of Object.entries(pluralForms)) {
|
|
@@ -4491,7 +4515,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
4491
4515
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
4492
4516
|
const forms = {};
|
|
4493
4517
|
for (const [form, formData] of Object.entries(pluralForms)) {
|
|
4494
|
-
if (_optionalChain([formData, 'optionalAccess',
|
|
4518
|
+
if (_optionalChain([formData, 'optionalAccess', _194 => _194.stringUnit, 'optionalAccess', _195 => _195.value])) {
|
|
4495
4519
|
forms[form] = formData.stringUnit.value;
|
|
4496
4520
|
}
|
|
4497
4521
|
}
|
|
@@ -4534,7 +4558,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
4534
4558
|
for (const [subName, subData] of Object.entries(
|
|
4535
4559
|
keyData.substitutions
|
|
4536
4560
|
)) {
|
|
4537
|
-
const pluralValue = _optionalChain([subData, 'optionalAccess',
|
|
4561
|
+
const pluralValue = _optionalChain([subData, 'optionalAccess', _196 => _196.variations, 'optionalAccess', _197 => _197.plural]);
|
|
4538
4562
|
if (pluralValue && isIcuPluralString(pluralValue)) {
|
|
4539
4563
|
try {
|
|
4540
4564
|
const pluralForms = parseIcuPluralString(pluralValue, locale);
|
|
@@ -4547,8 +4571,8 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
4547
4571
|
}
|
|
4548
4572
|
};
|
|
4549
4573
|
}
|
|
4550
|
-
const sourceLocale = _optionalChain([originalInput, 'optionalAccess',
|
|
4551
|
-
const origFormatSpec = _optionalChain([originalInput, 'optionalAccess',
|
|
4574
|
+
const sourceLocale = _optionalChain([originalInput, 'optionalAccess', _198 => _198.sourceLanguage]) || "en";
|
|
4575
|
+
const origFormatSpec = _optionalChain([originalInput, 'optionalAccess', _199 => _199.strings, 'optionalAccess', _200 => _200[baseKey], 'optionalAccess', _201 => _201.localizations, 'optionalAccess', _202 => _202[sourceLocale], 'optionalAccess', _203 => _203.substitutions, 'optionalAccess', _204 => _204[subName], 'optionalAccess', _205 => _205.formatSpecifier]) || subName;
|
|
4552
4576
|
subs[subName] = {
|
|
4553
4577
|
formatSpecifier: origFormatSpec,
|
|
4554
4578
|
variations: {
|
|
@@ -4573,7 +4597,7 @@ ${error instanceof Error ? error.message : String(error)}`
|
|
|
4573
4597
|
values: keyData.stringSet
|
|
4574
4598
|
};
|
|
4575
4599
|
}
|
|
4576
|
-
if ("variations" in keyData && _optionalChain([keyData, 'access',
|
|
4600
|
+
if ("variations" in keyData && _optionalChain([keyData, 'access', _206 => _206.variations, 'optionalAccess', _207 => _207.plural])) {
|
|
4577
4601
|
const pluralValue = keyData.variations.plural;
|
|
4578
4602
|
if (isIcuPluralString(pluralValue)) {
|
|
4579
4603
|
try {
|
|
@@ -4600,7 +4624,7 @@ ${error instanceof Error ? error.message : String(error)}`
|
|
|
4600
4624
|
}
|
|
4601
4625
|
if (Object.keys(localizationData).length > 0) {
|
|
4602
4626
|
langDataToMerge.strings[baseKey] = {
|
|
4603
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
4627
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _208 => _208.strings, 'optionalAccess', _209 => _209[baseKey], 'optionalAccess', _210 => _210.extractionState]),
|
|
4604
4628
|
localizations: {
|
|
4605
4629
|
[locale]: localizationData
|
|
4606
4630
|
}
|
|
@@ -4823,8 +4847,8 @@ async function formatDataWithBiome(data, filePath, options) {
|
|
|
4823
4847
|
});
|
|
4824
4848
|
return formatted.content;
|
|
4825
4849
|
} catch (error) {
|
|
4826
|
-
const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access',
|
|
4827
|
-
if (_optionalChain([errorMessage, 'optionalAccess',
|
|
4850
|
+
const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access', _211 => _211.stackTrace, 'optionalAccess', _212 => _212.toString, 'call', _213 => _213(), 'access', _214 => _214.split, 'call', _215 => _215("\n"), 'access', _216 => _216[0]]) : "";
|
|
4851
|
+
if (_optionalChain([errorMessage, 'optionalAccess', _217 => _217.includes, 'call', _218 => _218("does not exist in the workspace")])) {
|
|
4828
4852
|
} else {
|
|
4829
4853
|
console.log(`\u26A0\uFE0F Biome skipped ${path14.default.basename(filePath)}`);
|
|
4830
4854
|
if (errorMessage) {
|
|
@@ -4871,7 +4895,7 @@ function createPoDataLoader(params) {
|
|
|
4871
4895
|
Object.entries(entries).forEach(([msgid, entry]) => {
|
|
4872
4896
|
if (msgid && entry.msgid) {
|
|
4873
4897
|
const context = entry.msgctxt || "";
|
|
4874
|
-
const fullEntry = _optionalChain([parsedPo, 'access',
|
|
4898
|
+
const fullEntry = _optionalChain([parsedPo, 'access', _219 => _219.translations, 'access', _220 => _220[context], 'optionalAccess', _221 => _221[msgid]]);
|
|
4875
4899
|
if (fullEntry) {
|
|
4876
4900
|
result[msgid] = fullEntry;
|
|
4877
4901
|
}
|
|
@@ -4881,8 +4905,8 @@ function createPoDataLoader(params) {
|
|
|
4881
4905
|
return result;
|
|
4882
4906
|
},
|
|
4883
4907
|
async push(locale, data, originalInput, originalLocale, pullInput) {
|
|
4884
|
-
const currentSections = _optionalChain([pullInput, 'optionalAccess',
|
|
4885
|
-
const originalSections = _optionalChain([originalInput, 'optionalAccess',
|
|
4908
|
+
const currentSections = _optionalChain([pullInput, 'optionalAccess', _222 => _222.split, 'call', _223 => _223("\n\n"), 'access', _224 => _224.filter, 'call', _225 => _225(Boolean)]) || [];
|
|
4909
|
+
const originalSections = _optionalChain([originalInput, 'optionalAccess', _226 => _226.split, 'call', _227 => _227("\n\n"), 'access', _228 => _228.filter, 'call', _229 => _229(Boolean)]) || [];
|
|
4886
4910
|
const result = originalSections.map((section) => {
|
|
4887
4911
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
4888
4912
|
if (Object.keys(sectionPo.translations).length === 0) {
|
|
@@ -4951,8 +4975,8 @@ function createPoContentLoader() {
|
|
|
4951
4975
|
{
|
|
4952
4976
|
...entry,
|
|
4953
4977
|
msgstr: [
|
|
4954
|
-
_optionalChain([data, 'access',
|
|
4955
|
-
_optionalChain([data, 'access',
|
|
4978
|
+
_optionalChain([data, 'access', _230 => _230[entry.msgid], 'optionalAccess', _231 => _231.singular]),
|
|
4979
|
+
_optionalChain([data, 'access', _232 => _232[entry.msgid], 'optionalAccess', _233 => _233.plural]) || null
|
|
4956
4980
|
].filter(Boolean)
|
|
4957
4981
|
}
|
|
4958
4982
|
]).fromPairs().value();
|
|
@@ -5074,7 +5098,7 @@ function pullV1(xliffElement, locale, originalLocale) {
|
|
|
5074
5098
|
let key = getTransUnitKey(unit);
|
|
5075
5099
|
if (!key) return;
|
|
5076
5100
|
if (seenKeys.has(key)) {
|
|
5077
|
-
const id = _optionalChain([unit, 'access',
|
|
5101
|
+
const id = _optionalChain([unit, 'access', _234 => _234.getAttribute, 'call', _235 => _235("id"), 'optionalAccess', _236 => _236.trim, 'call', _237 => _237()]);
|
|
5078
5102
|
if (id) {
|
|
5079
5103
|
key = `${key}#${id}`;
|
|
5080
5104
|
} else {
|
|
@@ -5122,7 +5146,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
5122
5146
|
let key = getTransUnitKey(unit);
|
|
5123
5147
|
if (!key) return;
|
|
5124
5148
|
if (seenKeys.has(key)) {
|
|
5125
|
-
const id = _optionalChain([unit, 'access',
|
|
5149
|
+
const id = _optionalChain([unit, 'access', _238 => _238.getAttribute, 'call', _239 => _239("id"), 'optionalAccess', _240 => _240.trim, 'call', _241 => _241()]);
|
|
5126
5150
|
if (id) {
|
|
5127
5151
|
key = `${key}#${id}`;
|
|
5128
5152
|
} else {
|
|
@@ -5164,7 +5188,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
5164
5188
|
const translationKeys = new Set(Object.keys(translations));
|
|
5165
5189
|
existingUnits.forEach((unit, key) => {
|
|
5166
5190
|
if (!translationKeys.has(key)) {
|
|
5167
|
-
_optionalChain([unit, 'access',
|
|
5191
|
+
_optionalChain([unit, 'access', _242 => _242.parentNode, 'optionalAccess', _243 => _243.removeChild, 'call', _244 => _244(unit)]);
|
|
5168
5192
|
}
|
|
5169
5193
|
});
|
|
5170
5194
|
return serializeWithDeclaration(
|
|
@@ -5207,18 +5231,18 @@ function traverseUnitsV2(container, fileId, currentPath, result) {
|
|
|
5207
5231
|
Array.from(container.children).forEach((child) => {
|
|
5208
5232
|
const tagName = child.tagName;
|
|
5209
5233
|
if (tagName === "unit") {
|
|
5210
|
-
const unitId = _optionalChain([child, 'access',
|
|
5234
|
+
const unitId = _optionalChain([child, 'access', _245 => _245.getAttribute, 'call', _246 => _246("id"), 'optionalAccess', _247 => _247.trim, 'call', _248 => _248()]);
|
|
5211
5235
|
if (!unitId) return;
|
|
5212
5236
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
5213
5237
|
const segment = child.querySelector("segment");
|
|
5214
|
-
const source = _optionalChain([segment, 'optionalAccess',
|
|
5238
|
+
const source = _optionalChain([segment, 'optionalAccess', _249 => _249.querySelector, 'call', _250 => _250("source")]);
|
|
5215
5239
|
if (source) {
|
|
5216
5240
|
result[key] = extractTextContent(source);
|
|
5217
5241
|
} else {
|
|
5218
5242
|
result[key] = unitId;
|
|
5219
5243
|
}
|
|
5220
5244
|
} else if (tagName === "group") {
|
|
5221
|
-
const groupId = _optionalChain([child, 'access',
|
|
5245
|
+
const groupId = _optionalChain([child, 'access', _251 => _251.getAttribute, 'call', _252 => _252("id"), 'optionalAccess', _253 => _253.trim, 'call', _254 => _254()]);
|
|
5222
5246
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
5223
5247
|
traverseUnitsV2(child, fileId, newPath, result);
|
|
5224
5248
|
}
|
|
@@ -5254,12 +5278,12 @@ function indexUnitsV2(container, fileId, currentPath, index) {
|
|
|
5254
5278
|
Array.from(container.children).forEach((child) => {
|
|
5255
5279
|
const tagName = child.tagName;
|
|
5256
5280
|
if (tagName === "unit") {
|
|
5257
|
-
const unitId = _optionalChain([child, 'access',
|
|
5281
|
+
const unitId = _optionalChain([child, 'access', _255 => _255.getAttribute, 'call', _256 => _256("id"), 'optionalAccess', _257 => _257.trim, 'call', _258 => _258()]);
|
|
5258
5282
|
if (!unitId) return;
|
|
5259
5283
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
5260
5284
|
index.set(key, child);
|
|
5261
5285
|
} else if (tagName === "group") {
|
|
5262
|
-
const groupId = _optionalChain([child, 'access',
|
|
5286
|
+
const groupId = _optionalChain([child, 'access', _259 => _259.getAttribute, 'call', _260 => _260("id"), 'optionalAccess', _261 => _261.trim, 'call', _262 => _262()]);
|
|
5263
5287
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
5264
5288
|
indexUnitsV2(child, fileId, newPath, index);
|
|
5265
5289
|
}
|
|
@@ -5280,9 +5304,9 @@ function updateUnitV2(unit, value) {
|
|
|
5280
5304
|
setTextContent(source, value);
|
|
5281
5305
|
}
|
|
5282
5306
|
function getTransUnitKey(transUnit) {
|
|
5283
|
-
const resname = _optionalChain([transUnit, 'access',
|
|
5307
|
+
const resname = _optionalChain([transUnit, 'access', _263 => _263.getAttribute, 'call', _264 => _264("resname"), 'optionalAccess', _265 => _265.trim, 'call', _266 => _266()]);
|
|
5284
5308
|
if (resname) return resname;
|
|
5285
|
-
const id = _optionalChain([transUnit, 'access',
|
|
5309
|
+
const id = _optionalChain([transUnit, 'access', _267 => _267.getAttribute, 'call', _268 => _268("id"), 'optionalAccess', _269 => _269.trim, 'call', _270 => _270()]);
|
|
5286
5310
|
if (id) return id;
|
|
5287
5311
|
const sourceElement = transUnit.querySelector("source");
|
|
5288
5312
|
if (sourceElement) {
|
|
@@ -5339,7 +5363,7 @@ function formatXml(xml) {
|
|
|
5339
5363
|
if (cdataNode) {
|
|
5340
5364
|
return `${indent2}${openTag}<![CDATA[${cdataNode.nodeValue}]]></${tagName}>`;
|
|
5341
5365
|
}
|
|
5342
|
-
const textContent = _optionalChain([element, 'access',
|
|
5366
|
+
const textContent = _optionalChain([element, 'access', _271 => _271.textContent, 'optionalAccess', _272 => _272.trim, 'call', _273 => _273()]) || "";
|
|
5343
5367
|
const hasOnlyText = element.childNodes.length === 1 && element.childNodes[0].nodeType === 3;
|
|
5344
5368
|
if (hasOnlyText && textContent) {
|
|
5345
5369
|
return `${indent2}${openTag}${textContent}</${tagName}>`;
|
|
@@ -5632,7 +5656,7 @@ function createDatoClient(params) {
|
|
|
5632
5656
|
ids: !records.length ? void 0 : records.join(",")
|
|
5633
5657
|
}
|
|
5634
5658
|
}).catch(
|
|
5635
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
5659
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _274 => _274.response, 'optionalAccess', _275 => _275.body, 'optionalAccess', _276 => _276.data, 'optionalAccess', _277 => _277[0]]) || error)
|
|
5636
5660
|
);
|
|
5637
5661
|
},
|
|
5638
5662
|
findRecordsForModel: async (modelId, records) => {
|
|
@@ -5643,10 +5667,10 @@ function createDatoClient(params) {
|
|
|
5643
5667
|
filter: {
|
|
5644
5668
|
type: modelId,
|
|
5645
5669
|
only_valid: "true",
|
|
5646
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
5670
|
+
ids: !_optionalChain([records, 'optionalAccess', _278 => _278.length]) ? void 0 : records.join(",")
|
|
5647
5671
|
}
|
|
5648
5672
|
}).catch(
|
|
5649
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
5673
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _279 => _279.response, 'optionalAccess', _280 => _280.body, 'optionalAccess', _281 => _281.data, 'optionalAccess', _282 => _282[0]]) || error)
|
|
5650
5674
|
);
|
|
5651
5675
|
return result;
|
|
5652
5676
|
} catch (_error) {
|
|
@@ -5662,10 +5686,10 @@ function createDatoClient(params) {
|
|
|
5662
5686
|
updateRecord: async (id, payload) => {
|
|
5663
5687
|
try {
|
|
5664
5688
|
await dato.items.update(id, payload).catch(
|
|
5665
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
5689
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _283 => _283.response, 'optionalAccess', _284 => _284.body, 'optionalAccess', _285 => _285.data, 'optionalAccess', _286 => _286[0]]) || error)
|
|
5666
5690
|
);
|
|
5667
5691
|
} catch (_error) {
|
|
5668
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
5692
|
+
if (_optionalChain([_error, 'optionalAccess', _287 => _287.attributes, 'optionalAccess', _288 => _288.details, 'optionalAccess', _289 => _289.message])) {
|
|
5669
5693
|
throw new Error(
|
|
5670
5694
|
[
|
|
5671
5695
|
`${_error.attributes.details.message}`,
|
|
@@ -5687,10 +5711,10 @@ function createDatoClient(params) {
|
|
|
5687
5711
|
enableFieldLocalization: async (args) => {
|
|
5688
5712
|
try {
|
|
5689
5713
|
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch(
|
|
5690
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
5714
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _290 => _290.response, 'optionalAccess', _291 => _291.body, 'optionalAccess', _292 => _292.data, 'optionalAccess', _293 => _293[0]]) || error)
|
|
5691
5715
|
);
|
|
5692
5716
|
} catch (_error) {
|
|
5693
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
5717
|
+
if (_optionalChain([_error, 'optionalAccess', _294 => _294.attributes, 'optionalAccess', _295 => _295.code]) === "NOT_FOUND") {
|
|
5694
5718
|
throw new Error(
|
|
5695
5719
|
[
|
|
5696
5720
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -5698,7 +5722,7 @@ function createDatoClient(params) {
|
|
|
5698
5722
|
].join("\n\n")
|
|
5699
5723
|
);
|
|
5700
5724
|
}
|
|
5701
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
5725
|
+
if (_optionalChain([_error, 'optionalAccess', _296 => _296.attributes, 'optionalAccess', _297 => _297.details, 'optionalAccess', _298 => _298.message])) {
|
|
5702
5726
|
throw new Error(
|
|
5703
5727
|
[
|
|
5704
5728
|
`${_error.attributes.details.message}`,
|
|
@@ -5776,7 +5800,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
5776
5800
|
const records = await dato.findRecordsForModel(modelId);
|
|
5777
5801
|
const recordChoices = createRecordChoices(
|
|
5778
5802
|
records,
|
|
5779
|
-
_optionalChain([config, 'access',
|
|
5803
|
+
_optionalChain([config, 'access', _299 => _299.models, 'access', _300 => _300[modelId], 'optionalAccess', _301 => _301.records]) || [],
|
|
5780
5804
|
project
|
|
5781
5805
|
);
|
|
5782
5806
|
const selectedRecords = await promptRecordSelection(
|
|
@@ -5795,14 +5819,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
5795
5819
|
},
|
|
5796
5820
|
async pull(locale, input2, initCtx) {
|
|
5797
5821
|
const result = {};
|
|
5798
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
5799
|
-
let records = _optionalChain([initCtx, 'optionalAccess',
|
|
5822
|
+
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _302 => _302.models]) || {})) {
|
|
5823
|
+
let records = _optionalChain([initCtx, 'optionalAccess', _303 => _303.models, 'access', _304 => _304[modelId], 'access', _305 => _305.records]) || [];
|
|
5800
5824
|
const recordIds = records.map((record) => record.id);
|
|
5801
5825
|
records = await dato.findRecords(recordIds);
|
|
5802
5826
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
5803
5827
|
if (records.length > 0) {
|
|
5804
5828
|
result[modelId] = {
|
|
5805
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
5829
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _306 => _306.models, 'optionalAccess', _307 => _307[modelId], 'optionalAccess', _308 => _308.fields]) || [],
|
|
5806
5830
|
records
|
|
5807
5831
|
};
|
|
5808
5832
|
}
|
|
@@ -5865,7 +5889,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
5865
5889
|
return records.map((record) => ({
|
|
5866
5890
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
5867
5891
|
value: record.id,
|
|
5868
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
5892
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _309 => _309.includes, 'call', _310 => _310(record.id)])
|
|
5869
5893
|
}));
|
|
5870
5894
|
}
|
|
5871
5895
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -6184,7 +6208,7 @@ function createVttLoader() {
|
|
|
6184
6208
|
if (!input2) {
|
|
6185
6209
|
return "";
|
|
6186
6210
|
}
|
|
6187
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
6211
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _311 => _311.parse, 'call', _312 => _312(input2), 'optionalAccess', _313 => _313.cues]);
|
|
6188
6212
|
if (Object.keys(vtt).length === 0) {
|
|
6189
6213
|
return {};
|
|
6190
6214
|
} else {
|
|
@@ -6238,7 +6262,7 @@ function variableExtractLoader(params) {
|
|
|
6238
6262
|
for (let i = 0; i < matches.length; i++) {
|
|
6239
6263
|
const match2 = matches[i];
|
|
6240
6264
|
const currentValue = result[key].value;
|
|
6241
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
6265
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _314 => _314.replace, 'call', _315 => _315(match2, `{variable:${i}}`)]);
|
|
6242
6266
|
result[key].value = newValue;
|
|
6243
6267
|
result[key].variables[i] = match2;
|
|
6244
6268
|
}
|
|
@@ -6253,7 +6277,7 @@ function variableExtractLoader(params) {
|
|
|
6253
6277
|
const variable = valueObj.variables[i];
|
|
6254
6278
|
const currentValue = result[key];
|
|
6255
6279
|
if (typeof currentValue === "string") {
|
|
6256
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
6280
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _316 => _316.replaceAll, 'call', _317 => _317(
|
|
6257
6281
|
`{variable:${i}}`,
|
|
6258
6282
|
variable
|
|
6259
6283
|
)]);
|
|
@@ -6457,7 +6481,7 @@ function createVueJsonLoader() {
|
|
|
6457
6481
|
return createLoader({
|
|
6458
6482
|
pull: async (locale, input2, ctx) => {
|
|
6459
6483
|
const parsed = parseVueFile(input2);
|
|
6460
|
-
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess',
|
|
6484
|
+
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _318 => _318.i18n, 'optionalAccess', _319 => _319[locale]]), () => ( {}));
|
|
6461
6485
|
},
|
|
6462
6486
|
push: async (locale, data, originalInput) => {
|
|
6463
6487
|
const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
|
|
@@ -6642,7 +6666,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
|
|
|
6642
6666
|
objectExpression.properties.forEach((prop) => {
|
|
6643
6667
|
if (!t.isObjectProperty(prop)) return;
|
|
6644
6668
|
const key = getPropertyKey(prop);
|
|
6645
|
-
const incomingVal = _optionalChain([data, 'optionalAccess',
|
|
6669
|
+
const incomingVal = _optionalChain([data, 'optionalAccess', _320 => _320[key]]);
|
|
6646
6670
|
if (incomingVal === void 0) {
|
|
6647
6671
|
return;
|
|
6648
6672
|
}
|
|
@@ -6678,7 +6702,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
|
|
|
6678
6702
|
let modified = false;
|
|
6679
6703
|
arrayExpression.elements.forEach((element, index) => {
|
|
6680
6704
|
if (!element) return;
|
|
6681
|
-
const incomingVal = _optionalChain([incoming, 'optionalAccess',
|
|
6705
|
+
const incomingVal = _optionalChain([incoming, 'optionalAccess', _321 => _321[index]]);
|
|
6682
6706
|
if (incomingVal === void 0) return;
|
|
6683
6707
|
if (t.isStringLiteral(element) && typeof incomingVal === "string") {
|
|
6684
6708
|
if (element.value !== incomingVal) {
|
|
@@ -7172,7 +7196,7 @@ var AST = class _AST {
|
|
|
7172
7196
|
const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
|
|
7173
7197
|
if (this.isStart() && !this.type)
|
|
7174
7198
|
ret.unshift([]);
|
|
7175
|
-
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
7199
|
+
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _322 => _322.#parent, 'optionalAccess', _323 => _323.type]) === "!")) {
|
|
7176
7200
|
ret.push({});
|
|
7177
7201
|
}
|
|
7178
7202
|
return ret;
|
|
@@ -7180,7 +7204,7 @@ var AST = class _AST {
|
|
|
7180
7204
|
isStart() {
|
|
7181
7205
|
if (this.#root === this)
|
|
7182
7206
|
return true;
|
|
7183
|
-
if (!_optionalChain([this, 'access',
|
|
7207
|
+
if (!_optionalChain([this, 'access', _324 => _324.#parent, 'optionalAccess', _325 => _325.isStart, 'call', _326 => _326()]))
|
|
7184
7208
|
return false;
|
|
7185
7209
|
if (this.#parentIndex === 0)
|
|
7186
7210
|
return true;
|
|
@@ -7196,12 +7220,12 @@ var AST = class _AST {
|
|
|
7196
7220
|
isEnd() {
|
|
7197
7221
|
if (this.#root === this)
|
|
7198
7222
|
return true;
|
|
7199
|
-
if (_optionalChain([this, 'access',
|
|
7223
|
+
if (_optionalChain([this, 'access', _327 => _327.#parent, 'optionalAccess', _328 => _328.type]) === "!")
|
|
7200
7224
|
return true;
|
|
7201
|
-
if (!_optionalChain([this, 'access',
|
|
7225
|
+
if (!_optionalChain([this, 'access', _329 => _329.#parent, 'optionalAccess', _330 => _330.isEnd, 'call', _331 => _331()]))
|
|
7202
7226
|
return false;
|
|
7203
7227
|
if (!this.type)
|
|
7204
|
-
return _optionalChain([this, 'access',
|
|
7228
|
+
return _optionalChain([this, 'access', _332 => _332.#parent, 'optionalAccess', _333 => _333.isEnd, 'call', _334 => _334()]);
|
|
7205
7229
|
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
|
7206
7230
|
return this.#parentIndex === pl - 1;
|
|
7207
7231
|
}
|
|
@@ -7446,7 +7470,7 @@ var AST = class _AST {
|
|
|
7446
7470
|
}
|
|
7447
7471
|
}
|
|
7448
7472
|
let end = "";
|
|
7449
|
-
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
7473
|
+
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _335 => _335.#parent, 'optionalAccess', _336 => _336.type]) === "!") {
|
|
7450
7474
|
end = "(?:$|\\/)";
|
|
7451
7475
|
}
|
|
7452
7476
|
const final2 = start2 + src + end;
|
|
@@ -8547,7 +8571,7 @@ function createMdxSectionsSplit2Loader() {
|
|
|
8547
8571
|
const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
|
|
8548
8572
|
const result = {
|
|
8549
8573
|
frontmatter: data.frontmatter,
|
|
8550
|
-
codePlaceholders: _optionalChain([pullInput, 'optionalAccess',
|
|
8574
|
+
codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _337 => _337.codePlaceholders]) || {},
|
|
8551
8575
|
content
|
|
8552
8576
|
};
|
|
8553
8577
|
return result;
|
|
@@ -9647,7 +9671,7 @@ function createBasicTranslator(model, systemPrompt, settings = {}) {
|
|
|
9647
9671
|
]
|
|
9648
9672
|
});
|
|
9649
9673
|
const result = JSON.parse(response.text);
|
|
9650
|
-
return _optionalChain([result, 'optionalAccess',
|
|
9674
|
+
return _optionalChain([result, 'optionalAccess', _338 => _338.data]) || {};
|
|
9651
9675
|
}
|
|
9652
9676
|
}
|
|
9653
9677
|
function extractPayloadChunks(payload) {
|
|
@@ -9730,7 +9754,7 @@ function getPureModelProvider(provider) {
|
|
|
9730
9754
|
|
|
9731
9755
|
${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
|
|
9732
9756
|
`;
|
|
9733
|
-
switch (_optionalChain([provider, 'optionalAccess',
|
|
9757
|
+
switch (_optionalChain([provider, 'optionalAccess', _339 => _339.id])) {
|
|
9734
9758
|
case "openai": {
|
|
9735
9759
|
if (!process.env.OPENAI_API_KEY) {
|
|
9736
9760
|
throw new Error(
|
|
@@ -9788,7 +9812,7 @@ function getPureModelProvider(provider) {
|
|
|
9788
9812
|
})(provider.model);
|
|
9789
9813
|
}
|
|
9790
9814
|
default: {
|
|
9791
|
-
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess',
|
|
9815
|
+
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _340 => _340.id])));
|
|
9792
9816
|
}
|
|
9793
9817
|
}
|
|
9794
9818
|
}
|
|
@@ -10074,7 +10098,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
10074
10098
|
validateParams(i18nConfig, flags);
|
|
10075
10099
|
ora.succeed("Localization configuration is valid");
|
|
10076
10100
|
ora.start("Connecting to Lingo.dev Localization Engine...");
|
|
10077
|
-
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess',
|
|
10101
|
+
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _341 => _341.provider]);
|
|
10078
10102
|
if (isByokMode) {
|
|
10079
10103
|
authId = null;
|
|
10080
10104
|
ora.succeed("Using external provider (BYOK mode)");
|
|
@@ -10088,16 +10112,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
10088
10112
|
flags
|
|
10089
10113
|
});
|
|
10090
10114
|
let buckets = getBuckets(i18nConfig);
|
|
10091
|
-
if (_optionalChain([flags, 'access',
|
|
10115
|
+
if (_optionalChain([flags, 'access', _342 => _342.bucket, 'optionalAccess', _343 => _343.length])) {
|
|
10092
10116
|
buckets = buckets.filter(
|
|
10093
10117
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
10094
10118
|
);
|
|
10095
10119
|
}
|
|
10096
10120
|
ora.succeed("Buckets retrieved");
|
|
10097
|
-
if (_optionalChain([flags, 'access',
|
|
10121
|
+
if (_optionalChain([flags, 'access', _344 => _344.file, 'optionalAccess', _345 => _345.length])) {
|
|
10098
10122
|
buckets = buckets.map((bucket) => {
|
|
10099
10123
|
const paths = bucket.paths.filter(
|
|
10100
|
-
(path19) => flags.file.find((file) => _optionalChain([path19, 'access',
|
|
10124
|
+
(path19) => flags.file.find((file) => _optionalChain([path19, 'access', _346 => _346.pathPattern, 'optionalAccess', _347 => _347.includes, 'call', _348 => _348(file)]))
|
|
10101
10125
|
);
|
|
10102
10126
|
return { ...bucket, paths };
|
|
10103
10127
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -10118,7 +10142,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
10118
10142
|
});
|
|
10119
10143
|
}
|
|
10120
10144
|
}
|
|
10121
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
10145
|
+
const targetLocales = _optionalChain([flags, 'access', _349 => _349.locale, 'optionalAccess', _350 => _350.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
10122
10146
|
ora.start("Setting up localization cache...");
|
|
10123
10147
|
const checkLockfileProcessor = createDeltaProcessor("");
|
|
10124
10148
|
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
@@ -10403,7 +10427,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
10403
10427
|
}
|
|
10404
10428
|
const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
|
|
10405
10429
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
10406
|
-
if (!_optionalChain([flags, 'access',
|
|
10430
|
+
if (!_optionalChain([flags, 'access', _351 => _351.locale, 'optionalAccess', _352 => _352.length])) {
|
|
10407
10431
|
await deltaProcessor.saveChecksums(checksums);
|
|
10408
10432
|
}
|
|
10409
10433
|
}
|
|
@@ -10527,12 +10551,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
10527
10551
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
10528
10552
|
docUrl: "bucketNotFound"
|
|
10529
10553
|
});
|
|
10530
|
-
} else if (_optionalChain([flags, 'access',
|
|
10554
|
+
} else if (_optionalChain([flags, 'access', _353 => _353.locale, 'optionalAccess', _354 => _354.some, 'call', _355 => _355((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
10531
10555
|
throw new ValidationError({
|
|
10532
10556
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
10533
10557
|
docUrl: "localeTargetNotFound"
|
|
10534
10558
|
});
|
|
10535
|
-
} else if (_optionalChain([flags, 'access',
|
|
10559
|
+
} else if (_optionalChain([flags, 'access', _356 => _356.bucket, 'optionalAccess', _357 => _357.some, 'call', _358 => _358(
|
|
10536
10560
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
10537
10561
|
)])) {
|
|
10538
10562
|
throw new ValidationError({
|
|
@@ -11066,7 +11090,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
|
|
|
11066
11090
|
const response = await engine.whoami();
|
|
11067
11091
|
return {
|
|
11068
11092
|
authenticated: !!response,
|
|
11069
|
-
username: _optionalChain([response, 'optionalAccess',
|
|
11093
|
+
username: _optionalChain([response, 'optionalAccess', _359 => _359.email])
|
|
11070
11094
|
};
|
|
11071
11095
|
} catch (error) {
|
|
11072
11096
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -11182,7 +11206,7 @@ function createExplicitLocalizer(provider) {
|
|
|
11182
11206
|
}
|
|
11183
11207
|
function createAiSdkLocalizer(params) {
|
|
11184
11208
|
const skipAuth = params.skipAuth === true;
|
|
11185
|
-
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
11209
|
+
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _360 => _360.apiKeyName]), () => ( ""))];
|
|
11186
11210
|
if (!skipAuth && !apiKey || !params.apiKeyName) {
|
|
11187
11211
|
throw new Error(
|
|
11188
11212
|
_dedent2.default`
|
|
@@ -11316,8 +11340,8 @@ async function setup(input2) {
|
|
|
11316
11340
|
throw new Error(
|
|
11317
11341
|
"No buckets found in i18n.json. Please add at least one bucket containing i18n content."
|
|
11318
11342
|
);
|
|
11319
|
-
} else if (_optionalChain([ctx, 'access',
|
|
11320
|
-
(bucket) => !_optionalChain([ctx, 'access',
|
|
11343
|
+
} else if (_optionalChain([ctx, 'access', _361 => _361.flags, 'access', _362 => _362.bucket, 'optionalAccess', _363 => _363.some, 'call', _364 => _364(
|
|
11344
|
+
(bucket) => !_optionalChain([ctx, 'access', _365 => _365.config, 'optionalAccess', _366 => _366.buckets, 'access', _367 => _367[bucket]])
|
|
11321
11345
|
)])) {
|
|
11322
11346
|
throw new Error(
|
|
11323
11347
|
`One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
|
|
@@ -11330,7 +11354,7 @@ async function setup(input2) {
|
|
|
11330
11354
|
title: "Selecting localization provider",
|
|
11331
11355
|
task: async (ctx, task) => {
|
|
11332
11356
|
ctx.localizer = createLocalizer(
|
|
11333
|
-
_optionalChain([ctx, 'access',
|
|
11357
|
+
_optionalChain([ctx, 'access', _368 => _368.config, 'optionalAccess', _369 => _369.provider]),
|
|
11334
11358
|
ctx.flags.apiKey
|
|
11335
11359
|
);
|
|
11336
11360
|
if (!ctx.localizer) {
|
|
@@ -11343,7 +11367,7 @@ async function setup(input2) {
|
|
|
11343
11367
|
},
|
|
11344
11368
|
{
|
|
11345
11369
|
title: "Checking authentication",
|
|
11346
|
-
enabled: (ctx) => _optionalChain([ctx, 'access',
|
|
11370
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _370 => _370.localizer, 'optionalAccess', _371 => _371.id]) === "Lingo.dev",
|
|
11347
11371
|
task: async (ctx, task) => {
|
|
11348
11372
|
const authStatus = await ctx.localizer.checkAuth();
|
|
11349
11373
|
if (!authStatus.authenticated) {
|
|
@@ -11356,7 +11380,7 @@ async function setup(input2) {
|
|
|
11356
11380
|
},
|
|
11357
11381
|
{
|
|
11358
11382
|
title: "Validating configuration",
|
|
11359
|
-
enabled: (ctx) => _optionalChain([ctx, 'access',
|
|
11383
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _372 => _372.localizer, 'optionalAccess', _373 => _373.id]) !== "Lingo.dev",
|
|
11360
11384
|
task: async (ctx, task) => {
|
|
11361
11385
|
const validationStatus = await ctx.localizer.validateSettings();
|
|
11362
11386
|
if (!validationStatus.valid) {
|
|
@@ -11687,7 +11711,7 @@ function createWorkerTask(args) {
|
|
|
11687
11711
|
const processableData = _lodash2.default.chain(sourceData).entries().filter(
|
|
11688
11712
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
|
|
11689
11713
|
).filter(
|
|
11690
|
-
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access',
|
|
11714
|
+
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _374 => _374.onlyKeys, 'optionalAccess', _375 => _375.some, 'call', _376 => _376(
|
|
11691
11715
|
(pattern) => minimatch(key, pattern)
|
|
11692
11716
|
)])
|
|
11693
11717
|
).fromPairs().value();
|
|
@@ -11755,7 +11779,7 @@ function createWorkerTask(args) {
|
|
|
11755
11779
|
finalRenamedTargetData
|
|
11756
11780
|
);
|
|
11757
11781
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
11758
|
-
if (!_optionalChain([args, 'access',
|
|
11782
|
+
if (!_optionalChain([args, 'access', _377 => _377.ctx, 'access', _378 => _378.flags, 'access', _379 => _379.targetLocale, 'optionalAccess', _380 => _380.length])) {
|
|
11759
11783
|
await deltaProcessor.saveChecksums(checksums);
|
|
11760
11784
|
}
|
|
11761
11785
|
});
|
|
@@ -11960,10 +11984,10 @@ var flagsSchema2 = _zod.z.object({
|
|
|
11960
11984
|
async function frozen(input2) {
|
|
11961
11985
|
console.log(_chalk2.default.hex(colors.orange)("[Frozen]"));
|
|
11962
11986
|
let buckets = getBuckets(input2.config);
|
|
11963
|
-
if (_optionalChain([input2, 'access',
|
|
11987
|
+
if (_optionalChain([input2, 'access', _381 => _381.flags, 'access', _382 => _382.bucket, 'optionalAccess', _383 => _383.length])) {
|
|
11964
11988
|
buckets = buckets.filter((b) => input2.flags.bucket.includes(b.type));
|
|
11965
11989
|
}
|
|
11966
|
-
if (_optionalChain([input2, 'access',
|
|
11990
|
+
if (_optionalChain([input2, 'access', _384 => _384.flags, 'access', _385 => _385.file, 'optionalAccess', _386 => _386.length])) {
|
|
11967
11991
|
buckets = buckets.map((bucket) => {
|
|
11968
11992
|
const paths = bucket.paths.filter(
|
|
11969
11993
|
(p) => input2.flags.file.some(
|
|
@@ -12100,13 +12124,13 @@ async function frozen(input2) {
|
|
|
12100
12124
|
|
|
12101
12125
|
// src/cli/cmd/run/_utils.ts
|
|
12102
12126
|
async function determineAuthId(ctx) {
|
|
12103
|
-
const isByokMode = !!_optionalChain([ctx, 'access',
|
|
12127
|
+
const isByokMode = !!_optionalChain([ctx, 'access', _387 => _387.config, 'optionalAccess', _388 => _388.provider]);
|
|
12104
12128
|
if (isByokMode) {
|
|
12105
12129
|
return null;
|
|
12106
12130
|
} else {
|
|
12107
12131
|
try {
|
|
12108
|
-
const authStatus = await _optionalChain([ctx, 'access',
|
|
12109
|
-
return _optionalChain([authStatus, 'optionalAccess',
|
|
12132
|
+
const authStatus = await _optionalChain([ctx, 'access', _389 => _389.localizer, 'optionalAccess', _390 => _390.checkAuth, 'call', _391 => _391()]);
|
|
12133
|
+
return _optionalChain([authStatus, 'optionalAccess', _392 => _392.username]) || null;
|
|
12110
12134
|
} catch (e3) {
|
|
12111
12135
|
return null;
|
|
12112
12136
|
}
|
|
@@ -12304,7 +12328,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
12304
12328
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
12305
12329
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
12306
12330
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
12307
|
-
_optionalChain([this, 'access',
|
|
12331
|
+
_optionalChain([this, 'access', _393 => _393.platformKit, 'optionalAccess', _394 => _394.gitConfig, 'call', _395 => _395()]);
|
|
12308
12332
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
12309
12333
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
12310
12334
|
if (!processOwnCommits) {
|
|
@@ -12336,7 +12360,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
12336
12360
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
12337
12361
|
var PullRequestFlow = class extends InBranchFlow {
|
|
12338
12362
|
async preRun() {
|
|
12339
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
12363
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _396 => _396()]);
|
|
12340
12364
|
if (!canContinue) {
|
|
12341
12365
|
return false;
|
|
12342
12366
|
}
|
|
@@ -12603,10 +12627,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
12603
12627
|
repo_slug: this.platformConfig.repositoryName,
|
|
12604
12628
|
state: "OPEN"
|
|
12605
12629
|
}).then(({ data: { values } }) => {
|
|
12606
|
-
return _optionalChain([values, 'optionalAccess',
|
|
12607
|
-
({ source, destination }) => _optionalChain([source, 'optionalAccess',
|
|
12630
|
+
return _optionalChain([values, 'optionalAccess', _397 => _397.find, 'call', _398 => _398(
|
|
12631
|
+
({ source, destination }) => _optionalChain([source, 'optionalAccess', _399 => _399.branch, 'optionalAccess', _400 => _400.name]) === branch && _optionalChain([destination, 'optionalAccess', _401 => _401.branch, 'optionalAccess', _402 => _402.name]) === this.platformConfig.baseBranchName
|
|
12608
12632
|
)]);
|
|
12609
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
12633
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _403 => _403.id]));
|
|
12610
12634
|
}
|
|
12611
12635
|
async closePullRequest({ pullRequestNumber }) {
|
|
12612
12636
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -12702,7 +12726,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
12702
12726
|
repo: this.platformConfig.repositoryName,
|
|
12703
12727
|
base: this.platformConfig.baseBranchName,
|
|
12704
12728
|
state: "open"
|
|
12705
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
12729
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _404 => _404.number]));
|
|
12706
12730
|
}
|
|
12707
12731
|
async closePullRequest({ pullRequestNumber }) {
|
|
12708
12732
|
await this.octokit.rest.pulls.update({
|
|
@@ -12829,7 +12853,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
12829
12853
|
sourceBranch: branch,
|
|
12830
12854
|
state: "opened"
|
|
12831
12855
|
});
|
|
12832
|
-
return _optionalChain([mergeRequests, 'access',
|
|
12856
|
+
return _optionalChain([mergeRequests, 'access', _405 => _405[0], 'optionalAccess', _406 => _406.iid]);
|
|
12833
12857
|
}
|
|
12834
12858
|
async closePullRequest({
|
|
12835
12859
|
pullRequestNumber
|
|
@@ -12941,7 +12965,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
12941
12965
|
}
|
|
12942
12966
|
const env = {
|
|
12943
12967
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
12944
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
12968
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _407 => _407.pullRequest, 'optionalAccess', _408 => _408.toString, 'call', _409 => _409()]) || "false",
|
|
12945
12969
|
...options.commitMessage && {
|
|
12946
12970
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
12947
12971
|
},
|
|
@@ -12967,7 +12991,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
12967
12991
|
const { isPullRequestMode } = platformKit.config;
|
|
12968
12992
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
12969
12993
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
12970
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
12994
|
+
const canRun = await _optionalChain([flow, 'access', _410 => _410.preRun, 'optionalCall', _411 => _411()]);
|
|
12971
12995
|
if (canRun === false) {
|
|
12972
12996
|
return;
|
|
12973
12997
|
}
|
|
@@ -12977,7 +13001,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
12977
13001
|
if (!hasChanges) {
|
|
12978
13002
|
return;
|
|
12979
13003
|
}
|
|
12980
|
-
await _optionalChain([flow, 'access',
|
|
13004
|
+
await _optionalChain([flow, 'access', _412 => _412.postRun, 'optionalCall', _413 => _413()]);
|
|
12981
13005
|
});
|
|
12982
13006
|
function parseBooleanArg(val) {
|
|
12983
13007
|
if (val === true) return true;
|
|
@@ -13014,8 +13038,8 @@ function exitGracefully(elapsedMs = 0) {
|
|
|
13014
13038
|
}
|
|
13015
13039
|
}
|
|
13016
13040
|
function checkForPendingOperations() {
|
|
13017
|
-
const activeHandles = _optionalChain([process, 'access',
|
|
13018
|
-
const activeRequests = _optionalChain([process, 'access',
|
|
13041
|
+
const activeHandles = _optionalChain([process, 'access', _414 => _414._getActiveHandles, 'optionalCall', _415 => _415()]) || [];
|
|
13042
|
+
const activeRequests = _optionalChain([process, 'access', _416 => _416._getActiveRequests, 'optionalCall', _417 => _417()]) || [];
|
|
13019
13043
|
const nonStandardHandles = activeHandles.filter((handle) => {
|
|
13020
13044
|
if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
|
|
13021
13045
|
return false;
|
|
@@ -13084,17 +13108,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
13084
13108
|
flags
|
|
13085
13109
|
});
|
|
13086
13110
|
let buckets = getBuckets(i18nConfig);
|
|
13087
|
-
if (_optionalChain([flags, 'access',
|
|
13111
|
+
if (_optionalChain([flags, 'access', _418 => _418.bucket, 'optionalAccess', _419 => _419.length])) {
|
|
13088
13112
|
buckets = buckets.filter(
|
|
13089
13113
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
13090
13114
|
);
|
|
13091
13115
|
}
|
|
13092
13116
|
ora.succeed("Buckets retrieved");
|
|
13093
|
-
if (_optionalChain([flags, 'access',
|
|
13117
|
+
if (_optionalChain([flags, 'access', _420 => _420.file, 'optionalAccess', _421 => _421.length])) {
|
|
13094
13118
|
buckets = buckets.map((bucket) => {
|
|
13095
13119
|
const paths = bucket.paths.filter(
|
|
13096
13120
|
(path19) => flags.file.find(
|
|
13097
|
-
(file) => _optionalChain([path19, 'access',
|
|
13121
|
+
(file) => _optionalChain([path19, 'access', _422 => _422.pathPattern, 'optionalAccess', _423 => _423.includes, 'call', _424 => _424(file)]) || _optionalChain([path19, 'access', _425 => _425.pathPattern, 'optionalAccess', _426 => _426.match, 'call', _427 => _427(file)]) || minimatch(path19.pathPattern, file)
|
|
13098
13122
|
)
|
|
13099
13123
|
);
|
|
13100
13124
|
return { ...bucket, paths };
|
|
@@ -13114,7 +13138,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
13114
13138
|
});
|
|
13115
13139
|
}
|
|
13116
13140
|
}
|
|
13117
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
13141
|
+
const targetLocales = _optionalChain([flags, 'access', _428 => _428.locale, 'optionalAccess', _429 => _429.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
13118
13142
|
let totalSourceKeyCount = 0;
|
|
13119
13143
|
let uniqueKeysToTranslate = 0;
|
|
13120
13144
|
let totalExistingTranslations = 0;
|
|
@@ -13522,12 +13546,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
13522
13546
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
13523
13547
|
docUrl: "bucketNotFound"
|
|
13524
13548
|
});
|
|
13525
|
-
} else if (_optionalChain([flags, 'access',
|
|
13549
|
+
} else if (_optionalChain([flags, 'access', _430 => _430.locale, 'optionalAccess', _431 => _431.some, 'call', _432 => _432((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
13526
13550
|
throw new CLIError({
|
|
13527
13551
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
13528
13552
|
docUrl: "localeTargetNotFound"
|
|
13529
13553
|
});
|
|
13530
|
-
} else if (_optionalChain([flags, 'access',
|
|
13554
|
+
} else if (_optionalChain([flags, 'access', _433 => _433.bucket, 'optionalAccess', _434 => _434.some, 'call', _435 => _435(
|
|
13531
13555
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
13532
13556
|
)])) {
|
|
13533
13557
|
throw new CLIError({
|
|
@@ -13619,7 +13643,7 @@ async function renderHero2() {
|
|
|
13619
13643
|
// package.json
|
|
13620
13644
|
var package_default = {
|
|
13621
13645
|
name: "lingo.dev",
|
|
13622
|
-
version: "0.117.
|
|
13646
|
+
version: "0.117.4",
|
|
13623
13647
|
description: "Lingo.dev CLI",
|
|
13624
13648
|
private: false,
|
|
13625
13649
|
publishConfig: {
|
|
@@ -13911,7 +13935,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
|
|
|
13911
13935
|
if (options.file && options.file.length) {
|
|
13912
13936
|
buckets = buckets.map((bucket) => {
|
|
13913
13937
|
const paths = bucket.paths.filter(
|
|
13914
|
-
(bucketPath) => _optionalChain([options, 'access',
|
|
13938
|
+
(bucketPath) => _optionalChain([options, 'access', _436 => _436.file, 'optionalAccess', _437 => _437.some, 'call', _438 => _438((f) => bucketPath.pathPattern.includes(f))])
|
|
13915
13939
|
);
|
|
13916
13940
|
return { ...bucket, paths };
|
|
13917
13941
|
}).filter((bucket) => bucket.paths.length > 0);
|