lingo.dev 0.117.3 → 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 +136 -145
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +4 -13
- package/build/cli.mjs.map +1 -1
- package/package.json +2 -2
package/build/cli.cjs
CHANGED
|
@@ -2233,22 +2233,13 @@ function walkAndApply(node, path19, metadata) {
|
|
|
2233
2233
|
}
|
|
2234
2234
|
}
|
|
2235
2235
|
function isScalar(node) {
|
|
2236
|
-
|
|
2237
|
-
return true;
|
|
2238
|
-
}
|
|
2239
|
-
return node && typeof node === "object" && "value" in node && ("type" in node || "format" in node);
|
|
2236
|
+
return _yaml2.default.isScalar(node);
|
|
2240
2237
|
}
|
|
2241
2238
|
function isYAMLMap(node) {
|
|
2242
|
-
|
|
2243
|
-
return true;
|
|
2244
|
-
}
|
|
2245
|
-
return node && typeof node === "object" && "items" in node && Array.isArray(node.items) && !("value" in node);
|
|
2239
|
+
return _yaml2.default.isMap(node);
|
|
2246
2240
|
}
|
|
2247
2241
|
function isYAMLSeq(node) {
|
|
2248
|
-
|
|
2249
|
-
return true;
|
|
2250
|
-
}
|
|
2251
|
-
return node && typeof node === "object" && "items" in node && Array.isArray(node.items) && !("type" in node) && !("value" in node);
|
|
2242
|
+
return _yaml2.default.isSeq(node);
|
|
2252
2243
|
}
|
|
2253
2244
|
function getKeyValue(key) {
|
|
2254
2245
|
if (key === null || key === void 0) {
|
|
@@ -2441,7 +2432,7 @@ async function parseAndroidDocument(input2) {
|
|
|
2441
2432
|
const resourceNodes = [];
|
|
2442
2433
|
let metaIndex = 0;
|
|
2443
2434
|
for (const child of resourcesNode.$$) {
|
|
2444
|
-
const elementName = _optionalChain([child, 'optionalAccess',
|
|
2435
|
+
const elementName = _optionalChain([child, 'optionalAccess', _112 => _112["#name"]]);
|
|
2445
2436
|
if (!isResourceElementName(elementName)) {
|
|
2446
2437
|
continue;
|
|
2447
2438
|
}
|
|
@@ -2449,11 +2440,11 @@ async function parseAndroidDocument(input2) {
|
|
|
2449
2440
|
if (!meta || meta.type !== elementName) {
|
|
2450
2441
|
continue;
|
|
2451
2442
|
}
|
|
2452
|
-
const name = _nullishCoalesce(_optionalChain([child, 'optionalAccess',
|
|
2443
|
+
const name = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _113 => _113.$, 'optionalAccess', _114 => _114.name]), () => ( meta.name));
|
|
2453
2444
|
if (!name) {
|
|
2454
2445
|
continue;
|
|
2455
2446
|
}
|
|
2456
|
-
const translatable = (_nullishCoalesce(_optionalChain([child, 'optionalAccess',
|
|
2447
|
+
const translatable = (_nullishCoalesce(_optionalChain([child, 'optionalAccess', _115 => _115.$, 'optionalAccess', _116 => _116.translatable]), () => ( ""))).toLowerCase() !== "false";
|
|
2457
2448
|
switch (meta.type) {
|
|
2458
2449
|
case "string": {
|
|
2459
2450
|
resourceNodes.push({
|
|
@@ -2466,7 +2457,7 @@ async function parseAndroidDocument(input2) {
|
|
|
2466
2457
|
break;
|
|
2467
2458
|
}
|
|
2468
2459
|
case "string-array": {
|
|
2469
|
-
const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess',
|
|
2460
|
+
const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _117 => _117.item]), () => ( []));
|
|
2470
2461
|
const items = [];
|
|
2471
2462
|
const templateItems = meta.items;
|
|
2472
2463
|
for (let i = 0; i < Math.max(itemNodes.length, templateItems.length); i++) {
|
|
@@ -2490,7 +2481,7 @@ async function parseAndroidDocument(input2) {
|
|
|
2490
2481
|
break;
|
|
2491
2482
|
}
|
|
2492
2483
|
case "plurals": {
|
|
2493
|
-
const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess',
|
|
2484
|
+
const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _118 => _118.item]), () => ( []));
|
|
2494
2485
|
const templateItems = meta.items;
|
|
2495
2486
|
const items = [];
|
|
2496
2487
|
for (const templateItem of templateItems) {
|
|
@@ -2499,7 +2490,7 @@ async function parseAndroidDocument(input2) {
|
|
|
2499
2490
|
continue;
|
|
2500
2491
|
}
|
|
2501
2492
|
const nodeItem = itemNodes.find(
|
|
2502
|
-
(item) => _optionalChain([item, 'optionalAccess',
|
|
2493
|
+
(item) => _optionalChain([item, 'optionalAccess', _119 => _119.$, 'optionalAccess', _120 => _120.quantity]) === quantity
|
|
2503
2494
|
);
|
|
2504
2495
|
if (!nodeItem) {
|
|
2505
2496
|
continue;
|
|
@@ -2780,7 +2771,7 @@ function cloneResourceNode(resource) {
|
|
|
2780
2771
|
const nodeClone = deepClone(resource.node);
|
|
2781
2772
|
const itemNodes = _nullishCoalesce(nodeClone.item, () => ( []));
|
|
2782
2773
|
const items = itemNodes.map((itemNode, index) => {
|
|
2783
|
-
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([])));
|
|
2784
2775
|
return {
|
|
2785
2776
|
node: itemNode,
|
|
2786
2777
|
meta: cloneTextMeta(templateMeta)
|
|
@@ -2800,7 +2791,7 @@ function cloneResourceNode(resource) {
|
|
|
2800
2791
|
const items = [];
|
|
2801
2792
|
for (const templateItem of resource.items) {
|
|
2802
2793
|
const cloneNode = itemNodes.find(
|
|
2803
|
-
(item) => _optionalChain([item, 'optionalAccess',
|
|
2794
|
+
(item) => _optionalChain([item, 'optionalAccess', _127 => _127.$, 'optionalAccess', _128 => _128.quantity]) === templateItem.quantity
|
|
2804
2795
|
);
|
|
2805
2796
|
if (!cloneNode) {
|
|
2806
2797
|
continue;
|
|
@@ -3056,8 +3047,8 @@ function cloneDocumentStructure(document) {
|
|
|
3056
3047
|
resourceNodes.map((r) => resourceLookupKey(r.type, r.name))
|
|
3057
3048
|
);
|
|
3058
3049
|
let filtered = resourcesClone.$$.filter((child) => {
|
|
3059
|
-
const elementName = _optionalChain([child, 'optionalAccess',
|
|
3060
|
-
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]);
|
|
3061
3052
|
if (!isResourceElementName(elementName) || !name) {
|
|
3062
3053
|
return true;
|
|
3063
3054
|
}
|
|
@@ -3066,7 +3057,7 @@ function cloneDocumentStructure(document) {
|
|
|
3066
3057
|
const cleaned = [];
|
|
3067
3058
|
let lastWasWhitespace = false;
|
|
3068
3059
|
for (const child of filtered) {
|
|
3069
|
-
const isWhitespace = _optionalChain([child, 'optionalAccess',
|
|
3060
|
+
const isWhitespace = _optionalChain([child, 'optionalAccess', _132 => _132["#name"]]) === "__text__" && (!child._ || child._.trim() === "");
|
|
3070
3061
|
if (isWhitespace) {
|
|
3071
3062
|
if (!lastWasWhitespace) {
|
|
3072
3063
|
cleaned.push(child);
|
|
@@ -3088,8 +3079,8 @@ function buildResourceLookup(resources) {
|
|
|
3088
3079
|
const lookup = /* @__PURE__ */ new Map();
|
|
3089
3080
|
const children = Array.isArray(resources.$$) ? resources.$$ : [];
|
|
3090
3081
|
for (const child of children) {
|
|
3091
|
-
const type = _optionalChain([child, 'optionalAccess',
|
|
3092
|
-
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]);
|
|
3093
3084
|
if (!type || !name || !isResourceElementName(type)) {
|
|
3094
3085
|
continue;
|
|
3095
3086
|
}
|
|
@@ -3118,7 +3109,7 @@ function cloneResourceNodeFromLookup(resource, lookup) {
|
|
|
3118
3109
|
}
|
|
3119
3110
|
case "string-array": {
|
|
3120
3111
|
const childItems = (Array.isArray(node.$$) ? node.$$ : []).filter(
|
|
3121
|
-
(child) => _optionalChain([child, 'optionalAccess',
|
|
3112
|
+
(child) => _optionalChain([child, 'optionalAccess', _136 => _136["#name"]]) === "item"
|
|
3122
3113
|
);
|
|
3123
3114
|
node.item = childItems;
|
|
3124
3115
|
if (childItems.length < resource.items.length) {
|
|
@@ -3147,12 +3138,12 @@ function cloneResourceNodeFromLookup(resource, lookup) {
|
|
|
3147
3138
|
}
|
|
3148
3139
|
case "plurals": {
|
|
3149
3140
|
const childItems = (Array.isArray(node.$$) ? node.$$ : []).filter(
|
|
3150
|
-
(child) => _optionalChain([child, 'optionalAccess',
|
|
3141
|
+
(child) => _optionalChain([child, 'optionalAccess', _137 => _137["#name"]]) === "item"
|
|
3151
3142
|
);
|
|
3152
3143
|
node.item = childItems;
|
|
3153
3144
|
const itemMap = /* @__PURE__ */ new Map();
|
|
3154
3145
|
for (const item of childItems) {
|
|
3155
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
3146
|
+
if (_optionalChain([item, 'optionalAccess', _138 => _138.$, 'optionalAccess', _139 => _139.quantity])) {
|
|
3156
3147
|
itemMap.set(item.$.quantity, item);
|
|
3157
3148
|
}
|
|
3158
3149
|
}
|
|
@@ -3442,7 +3433,7 @@ var _sync3 = require('csv-stringify/sync');
|
|
|
3442
3433
|
|
|
3443
3434
|
function detectKeyColumnName(csvString) {
|
|
3444
3435
|
const row = _sync.parse.call(void 0, csvString)[0];
|
|
3445
|
-
const firstColumn = _optionalChain([row, 'optionalAccess',
|
|
3436
|
+
const firstColumn = _optionalChain([row, 'optionalAccess', _140 => _140[0], 'optionalAccess', _141 => _141.trim, 'call', _142 => _142()]);
|
|
3446
3437
|
return firstColumn || "KEY";
|
|
3447
3438
|
}
|
|
3448
3439
|
function createCsvLoader() {
|
|
@@ -3544,7 +3535,7 @@ function createHtmlLoader() {
|
|
|
3544
3535
|
break;
|
|
3545
3536
|
}
|
|
3546
3537
|
const siblings = Array.from(parent.childNodes).filter(
|
|
3547
|
-
(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()])
|
|
3548
3539
|
);
|
|
3549
3540
|
const index = siblings.indexOf(current);
|
|
3550
3541
|
if (index !== -1) {
|
|
@@ -3580,15 +3571,15 @@ function createHtmlLoader() {
|
|
|
3580
3571
|
}
|
|
3581
3572
|
});
|
|
3582
3573
|
Array.from(element.childNodes).filter(
|
|
3583
|
-
(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()])
|
|
3584
3575
|
).forEach(processNode);
|
|
3585
3576
|
}
|
|
3586
3577
|
};
|
|
3587
3578
|
Array.from(document.head.childNodes).filter(
|
|
3588
|
-
(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()])
|
|
3589
3580
|
).forEach(processNode);
|
|
3590
3581
|
Array.from(document.body.childNodes).filter(
|
|
3591
|
-
(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()])
|
|
3592
3583
|
).forEach(processNode);
|
|
3593
3584
|
return result;
|
|
3594
3585
|
},
|
|
@@ -3613,7 +3604,7 @@ function createHtmlLoader() {
|
|
|
3613
3604
|
for (let i = 0; i < indices.length; i++) {
|
|
3614
3605
|
const index = parseInt(indices[i]);
|
|
3615
3606
|
const siblings = Array.from(parent.childNodes).filter(
|
|
3616
|
-
(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()])
|
|
3617
3608
|
);
|
|
3618
3609
|
if (index >= siblings.length) {
|
|
3619
3610
|
if (i === indices.length - 1) {
|
|
@@ -3664,7 +3655,7 @@ function createMarkdownLoader() {
|
|
|
3664
3655
|
yaml: yamlEngine
|
|
3665
3656
|
}
|
|
3666
3657
|
});
|
|
3667
|
-
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);
|
|
3668
3659
|
return {
|
|
3669
3660
|
...Object.fromEntries(
|
|
3670
3661
|
sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
|
|
@@ -3683,7 +3674,7 @@ function createMarkdownLoader() {
|
|
|
3683
3674
|
);
|
|
3684
3675
|
let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(
|
|
3685
3676
|
([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())
|
|
3686
|
-
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess',
|
|
3677
|
+
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _160 => _160.trim, 'call', _161 => _161()]), () => ( ""))).filter(Boolean).join("\n\n");
|
|
3687
3678
|
if (Object.keys(frontmatter).length > 0) {
|
|
3688
3679
|
content = `
|
|
3689
3680
|
${content}`;
|
|
@@ -3708,7 +3699,7 @@ function createMarkdocLoader() {
|
|
|
3708
3699
|
const result = {};
|
|
3709
3700
|
const counters = {};
|
|
3710
3701
|
traverseAndExtract(ast, "", result, counters);
|
|
3711
|
-
if (_optionalChain([ast, 'access',
|
|
3702
|
+
if (_optionalChain([ast, 'access', _162 => _162.attributes, 'optionalAccess', _163 => _163.frontmatter])) {
|
|
3712
3703
|
const frontmatter = _yaml2.default.parse(ast.attributes.frontmatter);
|
|
3713
3704
|
Object.entries(frontmatter).forEach(([key, value]) => {
|
|
3714
3705
|
if (typeof value === "string") {
|
|
@@ -3754,7 +3745,7 @@ function traverseAndExtract(node, path19, result, counters, parentType) {
|
|
|
3754
3745
|
if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
|
|
3755
3746
|
semanticType = nodeSemanticType;
|
|
3756
3747
|
}
|
|
3757
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
3748
|
+
if (node.type === "text" && _optionalChain([node, 'access', _164 => _164.attributes, 'optionalAccess', _165 => _165.content])) {
|
|
3758
3749
|
const content = node.attributes.content;
|
|
3759
3750
|
if (typeof content === "string" && content.trim()) {
|
|
3760
3751
|
if (semanticType) {
|
|
@@ -3781,7 +3772,7 @@ function buildPathMap(node, path19, counters, pathMap, parentType) {
|
|
|
3781
3772
|
if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
|
|
3782
3773
|
semanticType = nodeSemanticType;
|
|
3783
3774
|
}
|
|
3784
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
3775
|
+
if (node.type === "text" && _optionalChain([node, 'access', _166 => _166.attributes, 'optionalAccess', _167 => _167.content])) {
|
|
3785
3776
|
const content = node.attributes.content;
|
|
3786
3777
|
if (typeof content === "string" && content.trim()) {
|
|
3787
3778
|
if (semanticType) {
|
|
@@ -3804,7 +3795,7 @@ function applyTranslations(node, path19, data, pathMap) {
|
|
|
3804
3795
|
if (!node || typeof node !== "object") {
|
|
3805
3796
|
return;
|
|
3806
3797
|
}
|
|
3807
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
3798
|
+
if (node.type === "text" && _optionalChain([node, 'access', _168 => _168.attributes, 'optionalAccess', _169 => _169.content])) {
|
|
3808
3799
|
const content = node.attributes.content;
|
|
3809
3800
|
if (typeof content === "string") {
|
|
3810
3801
|
const contentPath = path19 ? `${path19}/attributes/content` : "attributes/content";
|
|
@@ -3854,7 +3845,7 @@ function isSkippableLine(line) {
|
|
|
3854
3845
|
function parsePropertyLine(line) {
|
|
3855
3846
|
const [key, ...valueParts] = line.split("=");
|
|
3856
3847
|
return {
|
|
3857
|
-
key: _optionalChain([key, 'optionalAccess',
|
|
3848
|
+
key: _optionalChain([key, 'optionalAccess', _170 => _170.trim, 'call', _171 => _171()]) || "",
|
|
3858
3849
|
value: valueParts.join("=").trim()
|
|
3859
3850
|
};
|
|
3860
3851
|
}
|
|
@@ -4146,7 +4137,7 @@ var Parser = class {
|
|
|
4146
4137
|
}
|
|
4147
4138
|
}
|
|
4148
4139
|
expect(type) {
|
|
4149
|
-
if (_optionalChain([this, 'access',
|
|
4140
|
+
if (_optionalChain([this, 'access', _172 => _172.current, 'call', _173 => _173(), 'optionalAccess', _174 => _174.type]) === type) {
|
|
4150
4141
|
this.advance();
|
|
4151
4142
|
return true;
|
|
4152
4143
|
}
|
|
@@ -4223,7 +4214,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4223
4214
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
4224
4215
|
continue;
|
|
4225
4216
|
}
|
|
4226
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
4217
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _175 => _175.localizations, 'optionalAccess', _176 => _176[locale]]);
|
|
4227
4218
|
if (langTranslationEntity) {
|
|
4228
4219
|
if ("stringUnit" in langTranslationEntity) {
|
|
4229
4220
|
resultData[translationKey] = langTranslationEntity.stringUnit.value;
|
|
@@ -4237,7 +4228,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4237
4228
|
resultData[translationKey] = {};
|
|
4238
4229
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
4239
4230
|
for (const form in pluralForms) {
|
|
4240
|
-
if (_optionalChain([pluralForms, 'access',
|
|
4231
|
+
if (_optionalChain([pluralForms, 'access', _177 => _177[form], 'optionalAccess', _178 => _178.stringUnit, 'optionalAccess', _179 => _179.value])) {
|
|
4241
4232
|
resultData[translationKey][form] = pluralForms[form].stringUnit.value;
|
|
4242
4233
|
}
|
|
4243
4234
|
}
|
|
@@ -4263,7 +4254,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4263
4254
|
const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
|
|
4264
4255
|
if (typeof value === "string") {
|
|
4265
4256
|
langDataToMerge.strings[key] = {
|
|
4266
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
4257
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _180 => _180.strings, 'optionalAccess', _181 => _181[key], 'optionalAccess', _182 => _182.extractionState]),
|
|
4267
4258
|
localizations: {
|
|
4268
4259
|
[locale]: {
|
|
4269
4260
|
stringUnit: {
|
|
@@ -4278,7 +4269,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4278
4269
|
}
|
|
4279
4270
|
} else if (Array.isArray(value)) {
|
|
4280
4271
|
langDataToMerge.strings[key] = {
|
|
4281
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
4272
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _183 => _183.strings, 'optionalAccess', _184 => _184[key], 'optionalAccess', _185 => _185.extractionState]),
|
|
4282
4273
|
localizations: {
|
|
4283
4274
|
[locale]: {
|
|
4284
4275
|
stringSet: {
|
|
@@ -4336,7 +4327,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4336
4327
|
for (const [locale, localization] of Object.entries(
|
|
4337
4328
|
entity.localizations
|
|
4338
4329
|
)) {
|
|
4339
|
-
if (_optionalChain([localization, 'access',
|
|
4330
|
+
if (_optionalChain([localization, 'access', _186 => _186.variations, 'optionalAccess', _187 => _187.plural])) {
|
|
4340
4331
|
const pluralForms = localization.variations.plural;
|
|
4341
4332
|
for (const form in pluralForms) {
|
|
4342
4333
|
const pluralKey = `${translationKey}/${form}`;
|
|
@@ -4356,7 +4347,7 @@ function _removeLocale(input2, locale) {
|
|
|
4356
4347
|
const { strings } = input2;
|
|
4357
4348
|
const newStrings = _lodash2.default.cloneDeep(strings);
|
|
4358
4349
|
for (const [key, value] of Object.entries(newStrings)) {
|
|
4359
|
-
if (_optionalChain([value, 'access',
|
|
4350
|
+
if (_optionalChain([value, 'access', _188 => _188.localizations, 'optionalAccess', _189 => _189[locale]])) {
|
|
4360
4351
|
delete value.localizations[locale];
|
|
4361
4352
|
}
|
|
4362
4353
|
}
|
|
@@ -4487,7 +4478,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
4487
4478
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
4488
4479
|
continue;
|
|
4489
4480
|
}
|
|
4490
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
4481
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _190 => _190.localizations, 'optionalAccess', _191 => _191[locale]]);
|
|
4491
4482
|
if (langTranslationEntity) {
|
|
4492
4483
|
if (!resultData[translationKey]) {
|
|
4493
4484
|
resultData[translationKey] = {};
|
|
@@ -4499,7 +4490,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
4499
4490
|
for (const [subName, subData] of Object.entries(
|
|
4500
4491
|
langTranslationEntity.substitutions
|
|
4501
4492
|
)) {
|
|
4502
|
-
const pluralForms = _optionalChain([subData, 'access',
|
|
4493
|
+
const pluralForms = _optionalChain([subData, 'access', _192 => _192.variations, 'optionalAccess', _193 => _193.plural]);
|
|
4503
4494
|
if (pluralForms) {
|
|
4504
4495
|
const forms = {};
|
|
4505
4496
|
for (const [form, formData] of Object.entries(pluralForms)) {
|
|
@@ -4524,7 +4515,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
4524
4515
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
4525
4516
|
const forms = {};
|
|
4526
4517
|
for (const [form, formData] of Object.entries(pluralForms)) {
|
|
4527
|
-
if (_optionalChain([formData, 'optionalAccess',
|
|
4518
|
+
if (_optionalChain([formData, 'optionalAccess', _194 => _194.stringUnit, 'optionalAccess', _195 => _195.value])) {
|
|
4528
4519
|
forms[form] = formData.stringUnit.value;
|
|
4529
4520
|
}
|
|
4530
4521
|
}
|
|
@@ -4567,7 +4558,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
4567
4558
|
for (const [subName, subData] of Object.entries(
|
|
4568
4559
|
keyData.substitutions
|
|
4569
4560
|
)) {
|
|
4570
|
-
const pluralValue = _optionalChain([subData, 'optionalAccess',
|
|
4561
|
+
const pluralValue = _optionalChain([subData, 'optionalAccess', _196 => _196.variations, 'optionalAccess', _197 => _197.plural]);
|
|
4571
4562
|
if (pluralValue && isIcuPluralString(pluralValue)) {
|
|
4572
4563
|
try {
|
|
4573
4564
|
const pluralForms = parseIcuPluralString(pluralValue, locale);
|
|
@@ -4580,8 +4571,8 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
4580
4571
|
}
|
|
4581
4572
|
};
|
|
4582
4573
|
}
|
|
4583
|
-
const sourceLocale = _optionalChain([originalInput, 'optionalAccess',
|
|
4584
|
-
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;
|
|
4585
4576
|
subs[subName] = {
|
|
4586
4577
|
formatSpecifier: origFormatSpec,
|
|
4587
4578
|
variations: {
|
|
@@ -4606,7 +4597,7 @@ ${error instanceof Error ? error.message : String(error)}`
|
|
|
4606
4597
|
values: keyData.stringSet
|
|
4607
4598
|
};
|
|
4608
4599
|
}
|
|
4609
|
-
if ("variations" in keyData && _optionalChain([keyData, 'access',
|
|
4600
|
+
if ("variations" in keyData && _optionalChain([keyData, 'access', _206 => _206.variations, 'optionalAccess', _207 => _207.plural])) {
|
|
4610
4601
|
const pluralValue = keyData.variations.plural;
|
|
4611
4602
|
if (isIcuPluralString(pluralValue)) {
|
|
4612
4603
|
try {
|
|
@@ -4633,7 +4624,7 @@ ${error instanceof Error ? error.message : String(error)}`
|
|
|
4633
4624
|
}
|
|
4634
4625
|
if (Object.keys(localizationData).length > 0) {
|
|
4635
4626
|
langDataToMerge.strings[baseKey] = {
|
|
4636
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
4627
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _208 => _208.strings, 'optionalAccess', _209 => _209[baseKey], 'optionalAccess', _210 => _210.extractionState]),
|
|
4637
4628
|
localizations: {
|
|
4638
4629
|
[locale]: localizationData
|
|
4639
4630
|
}
|
|
@@ -4856,8 +4847,8 @@ async function formatDataWithBiome(data, filePath, options) {
|
|
|
4856
4847
|
});
|
|
4857
4848
|
return formatted.content;
|
|
4858
4849
|
} catch (error) {
|
|
4859
|
-
const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access',
|
|
4860
|
-
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")])) {
|
|
4861
4852
|
} else {
|
|
4862
4853
|
console.log(`\u26A0\uFE0F Biome skipped ${path14.default.basename(filePath)}`);
|
|
4863
4854
|
if (errorMessage) {
|
|
@@ -4904,7 +4895,7 @@ function createPoDataLoader(params) {
|
|
|
4904
4895
|
Object.entries(entries).forEach(([msgid, entry]) => {
|
|
4905
4896
|
if (msgid && entry.msgid) {
|
|
4906
4897
|
const context = entry.msgctxt || "";
|
|
4907
|
-
const fullEntry = _optionalChain([parsedPo, 'access',
|
|
4898
|
+
const fullEntry = _optionalChain([parsedPo, 'access', _219 => _219.translations, 'access', _220 => _220[context], 'optionalAccess', _221 => _221[msgid]]);
|
|
4908
4899
|
if (fullEntry) {
|
|
4909
4900
|
result[msgid] = fullEntry;
|
|
4910
4901
|
}
|
|
@@ -4914,8 +4905,8 @@ function createPoDataLoader(params) {
|
|
|
4914
4905
|
return result;
|
|
4915
4906
|
},
|
|
4916
4907
|
async push(locale, data, originalInput, originalLocale, pullInput) {
|
|
4917
|
-
const currentSections = _optionalChain([pullInput, 'optionalAccess',
|
|
4918
|
-
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)]) || [];
|
|
4919
4910
|
const result = originalSections.map((section) => {
|
|
4920
4911
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
4921
4912
|
if (Object.keys(sectionPo.translations).length === 0) {
|
|
@@ -4984,8 +4975,8 @@ function createPoContentLoader() {
|
|
|
4984
4975
|
{
|
|
4985
4976
|
...entry,
|
|
4986
4977
|
msgstr: [
|
|
4987
|
-
_optionalChain([data, 'access',
|
|
4988
|
-
_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
|
|
4989
4980
|
].filter(Boolean)
|
|
4990
4981
|
}
|
|
4991
4982
|
]).fromPairs().value();
|
|
@@ -5107,7 +5098,7 @@ function pullV1(xliffElement, locale, originalLocale) {
|
|
|
5107
5098
|
let key = getTransUnitKey(unit);
|
|
5108
5099
|
if (!key) return;
|
|
5109
5100
|
if (seenKeys.has(key)) {
|
|
5110
|
-
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()]);
|
|
5111
5102
|
if (id) {
|
|
5112
5103
|
key = `${key}#${id}`;
|
|
5113
5104
|
} else {
|
|
@@ -5155,7 +5146,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
5155
5146
|
let key = getTransUnitKey(unit);
|
|
5156
5147
|
if (!key) return;
|
|
5157
5148
|
if (seenKeys.has(key)) {
|
|
5158
|
-
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()]);
|
|
5159
5150
|
if (id) {
|
|
5160
5151
|
key = `${key}#${id}`;
|
|
5161
5152
|
} else {
|
|
@@ -5197,7 +5188,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
5197
5188
|
const translationKeys = new Set(Object.keys(translations));
|
|
5198
5189
|
existingUnits.forEach((unit, key) => {
|
|
5199
5190
|
if (!translationKeys.has(key)) {
|
|
5200
|
-
_optionalChain([unit, 'access',
|
|
5191
|
+
_optionalChain([unit, 'access', _242 => _242.parentNode, 'optionalAccess', _243 => _243.removeChild, 'call', _244 => _244(unit)]);
|
|
5201
5192
|
}
|
|
5202
5193
|
});
|
|
5203
5194
|
return serializeWithDeclaration(
|
|
@@ -5240,18 +5231,18 @@ function traverseUnitsV2(container, fileId, currentPath, result) {
|
|
|
5240
5231
|
Array.from(container.children).forEach((child) => {
|
|
5241
5232
|
const tagName = child.tagName;
|
|
5242
5233
|
if (tagName === "unit") {
|
|
5243
|
-
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()]);
|
|
5244
5235
|
if (!unitId) return;
|
|
5245
5236
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
5246
5237
|
const segment = child.querySelector("segment");
|
|
5247
|
-
const source = _optionalChain([segment, 'optionalAccess',
|
|
5238
|
+
const source = _optionalChain([segment, 'optionalAccess', _249 => _249.querySelector, 'call', _250 => _250("source")]);
|
|
5248
5239
|
if (source) {
|
|
5249
5240
|
result[key] = extractTextContent(source);
|
|
5250
5241
|
} else {
|
|
5251
5242
|
result[key] = unitId;
|
|
5252
5243
|
}
|
|
5253
5244
|
} else if (tagName === "group") {
|
|
5254
|
-
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()]);
|
|
5255
5246
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
5256
5247
|
traverseUnitsV2(child, fileId, newPath, result);
|
|
5257
5248
|
}
|
|
@@ -5287,12 +5278,12 @@ function indexUnitsV2(container, fileId, currentPath, index) {
|
|
|
5287
5278
|
Array.from(container.children).forEach((child) => {
|
|
5288
5279
|
const tagName = child.tagName;
|
|
5289
5280
|
if (tagName === "unit") {
|
|
5290
|
-
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()]);
|
|
5291
5282
|
if (!unitId) return;
|
|
5292
5283
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
5293
5284
|
index.set(key, child);
|
|
5294
5285
|
} else if (tagName === "group") {
|
|
5295
|
-
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()]);
|
|
5296
5287
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
5297
5288
|
indexUnitsV2(child, fileId, newPath, index);
|
|
5298
5289
|
}
|
|
@@ -5313,9 +5304,9 @@ function updateUnitV2(unit, value) {
|
|
|
5313
5304
|
setTextContent(source, value);
|
|
5314
5305
|
}
|
|
5315
5306
|
function getTransUnitKey(transUnit) {
|
|
5316
|
-
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()]);
|
|
5317
5308
|
if (resname) return resname;
|
|
5318
|
-
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()]);
|
|
5319
5310
|
if (id) return id;
|
|
5320
5311
|
const sourceElement = transUnit.querySelector("source");
|
|
5321
5312
|
if (sourceElement) {
|
|
@@ -5372,7 +5363,7 @@ function formatXml(xml) {
|
|
|
5372
5363
|
if (cdataNode) {
|
|
5373
5364
|
return `${indent2}${openTag}<![CDATA[${cdataNode.nodeValue}]]></${tagName}>`;
|
|
5374
5365
|
}
|
|
5375
|
-
const textContent = _optionalChain([element, 'access',
|
|
5366
|
+
const textContent = _optionalChain([element, 'access', _271 => _271.textContent, 'optionalAccess', _272 => _272.trim, 'call', _273 => _273()]) || "";
|
|
5376
5367
|
const hasOnlyText = element.childNodes.length === 1 && element.childNodes[0].nodeType === 3;
|
|
5377
5368
|
if (hasOnlyText && textContent) {
|
|
5378
5369
|
return `${indent2}${openTag}${textContent}</${tagName}>`;
|
|
@@ -5665,7 +5656,7 @@ function createDatoClient(params) {
|
|
|
5665
5656
|
ids: !records.length ? void 0 : records.join(",")
|
|
5666
5657
|
}
|
|
5667
5658
|
}).catch(
|
|
5668
|
-
(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)
|
|
5669
5660
|
);
|
|
5670
5661
|
},
|
|
5671
5662
|
findRecordsForModel: async (modelId, records) => {
|
|
@@ -5676,10 +5667,10 @@ function createDatoClient(params) {
|
|
|
5676
5667
|
filter: {
|
|
5677
5668
|
type: modelId,
|
|
5678
5669
|
only_valid: "true",
|
|
5679
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
5670
|
+
ids: !_optionalChain([records, 'optionalAccess', _278 => _278.length]) ? void 0 : records.join(",")
|
|
5680
5671
|
}
|
|
5681
5672
|
}).catch(
|
|
5682
|
-
(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)
|
|
5683
5674
|
);
|
|
5684
5675
|
return result;
|
|
5685
5676
|
} catch (_error) {
|
|
@@ -5695,10 +5686,10 @@ function createDatoClient(params) {
|
|
|
5695
5686
|
updateRecord: async (id, payload) => {
|
|
5696
5687
|
try {
|
|
5697
5688
|
await dato.items.update(id, payload).catch(
|
|
5698
|
-
(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)
|
|
5699
5690
|
);
|
|
5700
5691
|
} catch (_error) {
|
|
5701
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
5692
|
+
if (_optionalChain([_error, 'optionalAccess', _287 => _287.attributes, 'optionalAccess', _288 => _288.details, 'optionalAccess', _289 => _289.message])) {
|
|
5702
5693
|
throw new Error(
|
|
5703
5694
|
[
|
|
5704
5695
|
`${_error.attributes.details.message}`,
|
|
@@ -5720,10 +5711,10 @@ function createDatoClient(params) {
|
|
|
5720
5711
|
enableFieldLocalization: async (args) => {
|
|
5721
5712
|
try {
|
|
5722
5713
|
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch(
|
|
5723
|
-
(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)
|
|
5724
5715
|
);
|
|
5725
5716
|
} catch (_error) {
|
|
5726
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
5717
|
+
if (_optionalChain([_error, 'optionalAccess', _294 => _294.attributes, 'optionalAccess', _295 => _295.code]) === "NOT_FOUND") {
|
|
5727
5718
|
throw new Error(
|
|
5728
5719
|
[
|
|
5729
5720
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -5731,7 +5722,7 @@ function createDatoClient(params) {
|
|
|
5731
5722
|
].join("\n\n")
|
|
5732
5723
|
);
|
|
5733
5724
|
}
|
|
5734
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
5725
|
+
if (_optionalChain([_error, 'optionalAccess', _296 => _296.attributes, 'optionalAccess', _297 => _297.details, 'optionalAccess', _298 => _298.message])) {
|
|
5735
5726
|
throw new Error(
|
|
5736
5727
|
[
|
|
5737
5728
|
`${_error.attributes.details.message}`,
|
|
@@ -5809,7 +5800,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
5809
5800
|
const records = await dato.findRecordsForModel(modelId);
|
|
5810
5801
|
const recordChoices = createRecordChoices(
|
|
5811
5802
|
records,
|
|
5812
|
-
_optionalChain([config, 'access',
|
|
5803
|
+
_optionalChain([config, 'access', _299 => _299.models, 'access', _300 => _300[modelId], 'optionalAccess', _301 => _301.records]) || [],
|
|
5813
5804
|
project
|
|
5814
5805
|
);
|
|
5815
5806
|
const selectedRecords = await promptRecordSelection(
|
|
@@ -5828,14 +5819,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
5828
5819
|
},
|
|
5829
5820
|
async pull(locale, input2, initCtx) {
|
|
5830
5821
|
const result = {};
|
|
5831
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
5832
|
-
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]) || [];
|
|
5833
5824
|
const recordIds = records.map((record) => record.id);
|
|
5834
5825
|
records = await dato.findRecords(recordIds);
|
|
5835
5826
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
5836
5827
|
if (records.length > 0) {
|
|
5837
5828
|
result[modelId] = {
|
|
5838
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
5829
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _306 => _306.models, 'optionalAccess', _307 => _307[modelId], 'optionalAccess', _308 => _308.fields]) || [],
|
|
5839
5830
|
records
|
|
5840
5831
|
};
|
|
5841
5832
|
}
|
|
@@ -5898,7 +5889,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
5898
5889
|
return records.map((record) => ({
|
|
5899
5890
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
5900
5891
|
value: record.id,
|
|
5901
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
5892
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _309 => _309.includes, 'call', _310 => _310(record.id)])
|
|
5902
5893
|
}));
|
|
5903
5894
|
}
|
|
5904
5895
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -6217,7 +6208,7 @@ function createVttLoader() {
|
|
|
6217
6208
|
if (!input2) {
|
|
6218
6209
|
return "";
|
|
6219
6210
|
}
|
|
6220
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
6211
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _311 => _311.parse, 'call', _312 => _312(input2), 'optionalAccess', _313 => _313.cues]);
|
|
6221
6212
|
if (Object.keys(vtt).length === 0) {
|
|
6222
6213
|
return {};
|
|
6223
6214
|
} else {
|
|
@@ -6271,7 +6262,7 @@ function variableExtractLoader(params) {
|
|
|
6271
6262
|
for (let i = 0; i < matches.length; i++) {
|
|
6272
6263
|
const match2 = matches[i];
|
|
6273
6264
|
const currentValue = result[key].value;
|
|
6274
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
6265
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _314 => _314.replace, 'call', _315 => _315(match2, `{variable:${i}}`)]);
|
|
6275
6266
|
result[key].value = newValue;
|
|
6276
6267
|
result[key].variables[i] = match2;
|
|
6277
6268
|
}
|
|
@@ -6286,7 +6277,7 @@ function variableExtractLoader(params) {
|
|
|
6286
6277
|
const variable = valueObj.variables[i];
|
|
6287
6278
|
const currentValue = result[key];
|
|
6288
6279
|
if (typeof currentValue === "string") {
|
|
6289
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
6280
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _316 => _316.replaceAll, 'call', _317 => _317(
|
|
6290
6281
|
`{variable:${i}}`,
|
|
6291
6282
|
variable
|
|
6292
6283
|
)]);
|
|
@@ -6490,7 +6481,7 @@ function createVueJsonLoader() {
|
|
|
6490
6481
|
return createLoader({
|
|
6491
6482
|
pull: async (locale, input2, ctx) => {
|
|
6492
6483
|
const parsed = parseVueFile(input2);
|
|
6493
|
-
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess',
|
|
6484
|
+
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _318 => _318.i18n, 'optionalAccess', _319 => _319[locale]]), () => ( {}));
|
|
6494
6485
|
},
|
|
6495
6486
|
push: async (locale, data, originalInput) => {
|
|
6496
6487
|
const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
|
|
@@ -6675,7 +6666,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
|
|
|
6675
6666
|
objectExpression.properties.forEach((prop) => {
|
|
6676
6667
|
if (!t.isObjectProperty(prop)) return;
|
|
6677
6668
|
const key = getPropertyKey(prop);
|
|
6678
|
-
const incomingVal = _optionalChain([data, 'optionalAccess',
|
|
6669
|
+
const incomingVal = _optionalChain([data, 'optionalAccess', _320 => _320[key]]);
|
|
6679
6670
|
if (incomingVal === void 0) {
|
|
6680
6671
|
return;
|
|
6681
6672
|
}
|
|
@@ -6711,7 +6702,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
|
|
|
6711
6702
|
let modified = false;
|
|
6712
6703
|
arrayExpression.elements.forEach((element, index) => {
|
|
6713
6704
|
if (!element) return;
|
|
6714
|
-
const incomingVal = _optionalChain([incoming, 'optionalAccess',
|
|
6705
|
+
const incomingVal = _optionalChain([incoming, 'optionalAccess', _321 => _321[index]]);
|
|
6715
6706
|
if (incomingVal === void 0) return;
|
|
6716
6707
|
if (t.isStringLiteral(element) && typeof incomingVal === "string") {
|
|
6717
6708
|
if (element.value !== incomingVal) {
|
|
@@ -7205,7 +7196,7 @@ var AST = class _AST {
|
|
|
7205
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())];
|
|
7206
7197
|
if (this.isStart() && !this.type)
|
|
7207
7198
|
ret.unshift([]);
|
|
7208
|
-
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]) === "!")) {
|
|
7209
7200
|
ret.push({});
|
|
7210
7201
|
}
|
|
7211
7202
|
return ret;
|
|
@@ -7213,7 +7204,7 @@ var AST = class _AST {
|
|
|
7213
7204
|
isStart() {
|
|
7214
7205
|
if (this.#root === this)
|
|
7215
7206
|
return true;
|
|
7216
|
-
if (!_optionalChain([this, 'access',
|
|
7207
|
+
if (!_optionalChain([this, 'access', _324 => _324.#parent, 'optionalAccess', _325 => _325.isStart, 'call', _326 => _326()]))
|
|
7217
7208
|
return false;
|
|
7218
7209
|
if (this.#parentIndex === 0)
|
|
7219
7210
|
return true;
|
|
@@ -7229,12 +7220,12 @@ var AST = class _AST {
|
|
|
7229
7220
|
isEnd() {
|
|
7230
7221
|
if (this.#root === this)
|
|
7231
7222
|
return true;
|
|
7232
|
-
if (_optionalChain([this, 'access',
|
|
7223
|
+
if (_optionalChain([this, 'access', _327 => _327.#parent, 'optionalAccess', _328 => _328.type]) === "!")
|
|
7233
7224
|
return true;
|
|
7234
|
-
if (!_optionalChain([this, 'access',
|
|
7225
|
+
if (!_optionalChain([this, 'access', _329 => _329.#parent, 'optionalAccess', _330 => _330.isEnd, 'call', _331 => _331()]))
|
|
7235
7226
|
return false;
|
|
7236
7227
|
if (!this.type)
|
|
7237
|
-
return _optionalChain([this, 'access',
|
|
7228
|
+
return _optionalChain([this, 'access', _332 => _332.#parent, 'optionalAccess', _333 => _333.isEnd, 'call', _334 => _334()]);
|
|
7238
7229
|
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
|
7239
7230
|
return this.#parentIndex === pl - 1;
|
|
7240
7231
|
}
|
|
@@ -7479,7 +7470,7 @@ var AST = class _AST {
|
|
|
7479
7470
|
}
|
|
7480
7471
|
}
|
|
7481
7472
|
let end = "";
|
|
7482
|
-
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]) === "!") {
|
|
7483
7474
|
end = "(?:$|\\/)";
|
|
7484
7475
|
}
|
|
7485
7476
|
const final2 = start2 + src + end;
|
|
@@ -8580,7 +8571,7 @@ function createMdxSectionsSplit2Loader() {
|
|
|
8580
8571
|
const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
|
|
8581
8572
|
const result = {
|
|
8582
8573
|
frontmatter: data.frontmatter,
|
|
8583
|
-
codePlaceholders: _optionalChain([pullInput, 'optionalAccess',
|
|
8574
|
+
codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _337 => _337.codePlaceholders]) || {},
|
|
8584
8575
|
content
|
|
8585
8576
|
};
|
|
8586
8577
|
return result;
|
|
@@ -9680,7 +9671,7 @@ function createBasicTranslator(model, systemPrompt, settings = {}) {
|
|
|
9680
9671
|
]
|
|
9681
9672
|
});
|
|
9682
9673
|
const result = JSON.parse(response.text);
|
|
9683
|
-
return _optionalChain([result, 'optionalAccess',
|
|
9674
|
+
return _optionalChain([result, 'optionalAccess', _338 => _338.data]) || {};
|
|
9684
9675
|
}
|
|
9685
9676
|
}
|
|
9686
9677
|
function extractPayloadChunks(payload) {
|
|
@@ -9763,7 +9754,7 @@ function getPureModelProvider(provider) {
|
|
|
9763
9754
|
|
|
9764
9755
|
${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
|
|
9765
9756
|
`;
|
|
9766
|
-
switch (_optionalChain([provider, 'optionalAccess',
|
|
9757
|
+
switch (_optionalChain([provider, 'optionalAccess', _339 => _339.id])) {
|
|
9767
9758
|
case "openai": {
|
|
9768
9759
|
if (!process.env.OPENAI_API_KEY) {
|
|
9769
9760
|
throw new Error(
|
|
@@ -9821,7 +9812,7 @@ function getPureModelProvider(provider) {
|
|
|
9821
9812
|
})(provider.model);
|
|
9822
9813
|
}
|
|
9823
9814
|
default: {
|
|
9824
|
-
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess',
|
|
9815
|
+
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _340 => _340.id])));
|
|
9825
9816
|
}
|
|
9826
9817
|
}
|
|
9827
9818
|
}
|
|
@@ -10107,7 +10098,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
10107
10098
|
validateParams(i18nConfig, flags);
|
|
10108
10099
|
ora.succeed("Localization configuration is valid");
|
|
10109
10100
|
ora.start("Connecting to Lingo.dev Localization Engine...");
|
|
10110
|
-
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess',
|
|
10101
|
+
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _341 => _341.provider]);
|
|
10111
10102
|
if (isByokMode) {
|
|
10112
10103
|
authId = null;
|
|
10113
10104
|
ora.succeed("Using external provider (BYOK mode)");
|
|
@@ -10121,16 +10112,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
10121
10112
|
flags
|
|
10122
10113
|
});
|
|
10123
10114
|
let buckets = getBuckets(i18nConfig);
|
|
10124
|
-
if (_optionalChain([flags, 'access',
|
|
10115
|
+
if (_optionalChain([flags, 'access', _342 => _342.bucket, 'optionalAccess', _343 => _343.length])) {
|
|
10125
10116
|
buckets = buckets.filter(
|
|
10126
10117
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
10127
10118
|
);
|
|
10128
10119
|
}
|
|
10129
10120
|
ora.succeed("Buckets retrieved");
|
|
10130
|
-
if (_optionalChain([flags, 'access',
|
|
10121
|
+
if (_optionalChain([flags, 'access', _344 => _344.file, 'optionalAccess', _345 => _345.length])) {
|
|
10131
10122
|
buckets = buckets.map((bucket) => {
|
|
10132
10123
|
const paths = bucket.paths.filter(
|
|
10133
|
-
(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)]))
|
|
10134
10125
|
);
|
|
10135
10126
|
return { ...bucket, paths };
|
|
10136
10127
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -10151,7 +10142,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
10151
10142
|
});
|
|
10152
10143
|
}
|
|
10153
10144
|
}
|
|
10154
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
10145
|
+
const targetLocales = _optionalChain([flags, 'access', _349 => _349.locale, 'optionalAccess', _350 => _350.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
10155
10146
|
ora.start("Setting up localization cache...");
|
|
10156
10147
|
const checkLockfileProcessor = createDeltaProcessor("");
|
|
10157
10148
|
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
@@ -10436,7 +10427,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
10436
10427
|
}
|
|
10437
10428
|
const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
|
|
10438
10429
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
10439
|
-
if (!_optionalChain([flags, 'access',
|
|
10430
|
+
if (!_optionalChain([flags, 'access', _351 => _351.locale, 'optionalAccess', _352 => _352.length])) {
|
|
10440
10431
|
await deltaProcessor.saveChecksums(checksums);
|
|
10441
10432
|
}
|
|
10442
10433
|
}
|
|
@@ -10560,12 +10551,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
10560
10551
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
10561
10552
|
docUrl: "bucketNotFound"
|
|
10562
10553
|
});
|
|
10563
|
-
} 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))])) {
|
|
10564
10555
|
throw new ValidationError({
|
|
10565
10556
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
10566
10557
|
docUrl: "localeTargetNotFound"
|
|
10567
10558
|
});
|
|
10568
|
-
} else if (_optionalChain([flags, 'access',
|
|
10559
|
+
} else if (_optionalChain([flags, 'access', _356 => _356.bucket, 'optionalAccess', _357 => _357.some, 'call', _358 => _358(
|
|
10569
10560
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
10570
10561
|
)])) {
|
|
10571
10562
|
throw new ValidationError({
|
|
@@ -11099,7 +11090,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
|
|
|
11099
11090
|
const response = await engine.whoami();
|
|
11100
11091
|
return {
|
|
11101
11092
|
authenticated: !!response,
|
|
11102
|
-
username: _optionalChain([response, 'optionalAccess',
|
|
11093
|
+
username: _optionalChain([response, 'optionalAccess', _359 => _359.email])
|
|
11103
11094
|
};
|
|
11104
11095
|
} catch (error) {
|
|
11105
11096
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -11215,7 +11206,7 @@ function createExplicitLocalizer(provider) {
|
|
|
11215
11206
|
}
|
|
11216
11207
|
function createAiSdkLocalizer(params) {
|
|
11217
11208
|
const skipAuth = params.skipAuth === true;
|
|
11218
|
-
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
11209
|
+
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _360 => _360.apiKeyName]), () => ( ""))];
|
|
11219
11210
|
if (!skipAuth && !apiKey || !params.apiKeyName) {
|
|
11220
11211
|
throw new Error(
|
|
11221
11212
|
_dedent2.default`
|
|
@@ -11349,8 +11340,8 @@ async function setup(input2) {
|
|
|
11349
11340
|
throw new Error(
|
|
11350
11341
|
"No buckets found in i18n.json. Please add at least one bucket containing i18n content."
|
|
11351
11342
|
);
|
|
11352
|
-
} else if (_optionalChain([ctx, 'access',
|
|
11353
|
-
(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]])
|
|
11354
11345
|
)])) {
|
|
11355
11346
|
throw new Error(
|
|
11356
11347
|
`One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
|
|
@@ -11363,7 +11354,7 @@ async function setup(input2) {
|
|
|
11363
11354
|
title: "Selecting localization provider",
|
|
11364
11355
|
task: async (ctx, task) => {
|
|
11365
11356
|
ctx.localizer = createLocalizer(
|
|
11366
|
-
_optionalChain([ctx, 'access',
|
|
11357
|
+
_optionalChain([ctx, 'access', _368 => _368.config, 'optionalAccess', _369 => _369.provider]),
|
|
11367
11358
|
ctx.flags.apiKey
|
|
11368
11359
|
);
|
|
11369
11360
|
if (!ctx.localizer) {
|
|
@@ -11376,7 +11367,7 @@ async function setup(input2) {
|
|
|
11376
11367
|
},
|
|
11377
11368
|
{
|
|
11378
11369
|
title: "Checking authentication",
|
|
11379
|
-
enabled: (ctx) => _optionalChain([ctx, 'access',
|
|
11370
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _370 => _370.localizer, 'optionalAccess', _371 => _371.id]) === "Lingo.dev",
|
|
11380
11371
|
task: async (ctx, task) => {
|
|
11381
11372
|
const authStatus = await ctx.localizer.checkAuth();
|
|
11382
11373
|
if (!authStatus.authenticated) {
|
|
@@ -11389,7 +11380,7 @@ async function setup(input2) {
|
|
|
11389
11380
|
},
|
|
11390
11381
|
{
|
|
11391
11382
|
title: "Validating configuration",
|
|
11392
|
-
enabled: (ctx) => _optionalChain([ctx, 'access',
|
|
11383
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _372 => _372.localizer, 'optionalAccess', _373 => _373.id]) !== "Lingo.dev",
|
|
11393
11384
|
task: async (ctx, task) => {
|
|
11394
11385
|
const validationStatus = await ctx.localizer.validateSettings();
|
|
11395
11386
|
if (!validationStatus.valid) {
|
|
@@ -11720,7 +11711,7 @@ function createWorkerTask(args) {
|
|
|
11720
11711
|
const processableData = _lodash2.default.chain(sourceData).entries().filter(
|
|
11721
11712
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
|
|
11722
11713
|
).filter(
|
|
11723
|
-
([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(
|
|
11724
11715
|
(pattern) => minimatch(key, pattern)
|
|
11725
11716
|
)])
|
|
11726
11717
|
).fromPairs().value();
|
|
@@ -11788,7 +11779,7 @@ function createWorkerTask(args) {
|
|
|
11788
11779
|
finalRenamedTargetData
|
|
11789
11780
|
);
|
|
11790
11781
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
11791
|
-
if (!_optionalChain([args, 'access',
|
|
11782
|
+
if (!_optionalChain([args, 'access', _377 => _377.ctx, 'access', _378 => _378.flags, 'access', _379 => _379.targetLocale, 'optionalAccess', _380 => _380.length])) {
|
|
11792
11783
|
await deltaProcessor.saveChecksums(checksums);
|
|
11793
11784
|
}
|
|
11794
11785
|
});
|
|
@@ -11993,10 +11984,10 @@ var flagsSchema2 = _zod.z.object({
|
|
|
11993
11984
|
async function frozen(input2) {
|
|
11994
11985
|
console.log(_chalk2.default.hex(colors.orange)("[Frozen]"));
|
|
11995
11986
|
let buckets = getBuckets(input2.config);
|
|
11996
|
-
if (_optionalChain([input2, 'access',
|
|
11987
|
+
if (_optionalChain([input2, 'access', _381 => _381.flags, 'access', _382 => _382.bucket, 'optionalAccess', _383 => _383.length])) {
|
|
11997
11988
|
buckets = buckets.filter((b) => input2.flags.bucket.includes(b.type));
|
|
11998
11989
|
}
|
|
11999
|
-
if (_optionalChain([input2, 'access',
|
|
11990
|
+
if (_optionalChain([input2, 'access', _384 => _384.flags, 'access', _385 => _385.file, 'optionalAccess', _386 => _386.length])) {
|
|
12000
11991
|
buckets = buckets.map((bucket) => {
|
|
12001
11992
|
const paths = bucket.paths.filter(
|
|
12002
11993
|
(p) => input2.flags.file.some(
|
|
@@ -12133,13 +12124,13 @@ async function frozen(input2) {
|
|
|
12133
12124
|
|
|
12134
12125
|
// src/cli/cmd/run/_utils.ts
|
|
12135
12126
|
async function determineAuthId(ctx) {
|
|
12136
|
-
const isByokMode = !!_optionalChain([ctx, 'access',
|
|
12127
|
+
const isByokMode = !!_optionalChain([ctx, 'access', _387 => _387.config, 'optionalAccess', _388 => _388.provider]);
|
|
12137
12128
|
if (isByokMode) {
|
|
12138
12129
|
return null;
|
|
12139
12130
|
} else {
|
|
12140
12131
|
try {
|
|
12141
|
-
const authStatus = await _optionalChain([ctx, 'access',
|
|
12142
|
-
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;
|
|
12143
12134
|
} catch (e3) {
|
|
12144
12135
|
return null;
|
|
12145
12136
|
}
|
|
@@ -12337,7 +12328,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
12337
12328
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
12338
12329
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
12339
12330
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
12340
|
-
_optionalChain([this, 'access',
|
|
12331
|
+
_optionalChain([this, 'access', _393 => _393.platformKit, 'optionalAccess', _394 => _394.gitConfig, 'call', _395 => _395()]);
|
|
12341
12332
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
12342
12333
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
12343
12334
|
if (!processOwnCommits) {
|
|
@@ -12369,7 +12360,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
12369
12360
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
12370
12361
|
var PullRequestFlow = class extends InBranchFlow {
|
|
12371
12362
|
async preRun() {
|
|
12372
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
12363
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _396 => _396()]);
|
|
12373
12364
|
if (!canContinue) {
|
|
12374
12365
|
return false;
|
|
12375
12366
|
}
|
|
@@ -12636,10 +12627,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
12636
12627
|
repo_slug: this.platformConfig.repositoryName,
|
|
12637
12628
|
state: "OPEN"
|
|
12638
12629
|
}).then(({ data: { values } }) => {
|
|
12639
|
-
return _optionalChain([values, 'optionalAccess',
|
|
12640
|
-
({ 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
|
|
12641
12632
|
)]);
|
|
12642
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
12633
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _403 => _403.id]));
|
|
12643
12634
|
}
|
|
12644
12635
|
async closePullRequest({ pullRequestNumber }) {
|
|
12645
12636
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -12735,7 +12726,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
12735
12726
|
repo: this.platformConfig.repositoryName,
|
|
12736
12727
|
base: this.platformConfig.baseBranchName,
|
|
12737
12728
|
state: "open"
|
|
12738
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
12729
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _404 => _404.number]));
|
|
12739
12730
|
}
|
|
12740
12731
|
async closePullRequest({ pullRequestNumber }) {
|
|
12741
12732
|
await this.octokit.rest.pulls.update({
|
|
@@ -12862,7 +12853,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
12862
12853
|
sourceBranch: branch,
|
|
12863
12854
|
state: "opened"
|
|
12864
12855
|
});
|
|
12865
|
-
return _optionalChain([mergeRequests, 'access',
|
|
12856
|
+
return _optionalChain([mergeRequests, 'access', _405 => _405[0], 'optionalAccess', _406 => _406.iid]);
|
|
12866
12857
|
}
|
|
12867
12858
|
async closePullRequest({
|
|
12868
12859
|
pullRequestNumber
|
|
@@ -12974,7 +12965,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
12974
12965
|
}
|
|
12975
12966
|
const env = {
|
|
12976
12967
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
12977
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
12968
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _407 => _407.pullRequest, 'optionalAccess', _408 => _408.toString, 'call', _409 => _409()]) || "false",
|
|
12978
12969
|
...options.commitMessage && {
|
|
12979
12970
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
12980
12971
|
},
|
|
@@ -13000,7 +12991,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
13000
12991
|
const { isPullRequestMode } = platformKit.config;
|
|
13001
12992
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
13002
12993
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
13003
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
12994
|
+
const canRun = await _optionalChain([flow, 'access', _410 => _410.preRun, 'optionalCall', _411 => _411()]);
|
|
13004
12995
|
if (canRun === false) {
|
|
13005
12996
|
return;
|
|
13006
12997
|
}
|
|
@@ -13010,7 +13001,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
13010
13001
|
if (!hasChanges) {
|
|
13011
13002
|
return;
|
|
13012
13003
|
}
|
|
13013
|
-
await _optionalChain([flow, 'access',
|
|
13004
|
+
await _optionalChain([flow, 'access', _412 => _412.postRun, 'optionalCall', _413 => _413()]);
|
|
13014
13005
|
});
|
|
13015
13006
|
function parseBooleanArg(val) {
|
|
13016
13007
|
if (val === true) return true;
|
|
@@ -13047,8 +13038,8 @@ function exitGracefully(elapsedMs = 0) {
|
|
|
13047
13038
|
}
|
|
13048
13039
|
}
|
|
13049
13040
|
function checkForPendingOperations() {
|
|
13050
|
-
const activeHandles = _optionalChain([process, 'access',
|
|
13051
|
-
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()]) || [];
|
|
13052
13043
|
const nonStandardHandles = activeHandles.filter((handle) => {
|
|
13053
13044
|
if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
|
|
13054
13045
|
return false;
|
|
@@ -13117,17 +13108,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
13117
13108
|
flags
|
|
13118
13109
|
});
|
|
13119
13110
|
let buckets = getBuckets(i18nConfig);
|
|
13120
|
-
if (_optionalChain([flags, 'access',
|
|
13111
|
+
if (_optionalChain([flags, 'access', _418 => _418.bucket, 'optionalAccess', _419 => _419.length])) {
|
|
13121
13112
|
buckets = buckets.filter(
|
|
13122
13113
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
13123
13114
|
);
|
|
13124
13115
|
}
|
|
13125
13116
|
ora.succeed("Buckets retrieved");
|
|
13126
|
-
if (_optionalChain([flags, 'access',
|
|
13117
|
+
if (_optionalChain([flags, 'access', _420 => _420.file, 'optionalAccess', _421 => _421.length])) {
|
|
13127
13118
|
buckets = buckets.map((bucket) => {
|
|
13128
13119
|
const paths = bucket.paths.filter(
|
|
13129
13120
|
(path19) => flags.file.find(
|
|
13130
|
-
(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)
|
|
13131
13122
|
)
|
|
13132
13123
|
);
|
|
13133
13124
|
return { ...bucket, paths };
|
|
@@ -13147,7 +13138,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
13147
13138
|
});
|
|
13148
13139
|
}
|
|
13149
13140
|
}
|
|
13150
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
13141
|
+
const targetLocales = _optionalChain([flags, 'access', _428 => _428.locale, 'optionalAccess', _429 => _429.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
13151
13142
|
let totalSourceKeyCount = 0;
|
|
13152
13143
|
let uniqueKeysToTranslate = 0;
|
|
13153
13144
|
let totalExistingTranslations = 0;
|
|
@@ -13555,12 +13546,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
13555
13546
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
13556
13547
|
docUrl: "bucketNotFound"
|
|
13557
13548
|
});
|
|
13558
|
-
} 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))])) {
|
|
13559
13550
|
throw new CLIError({
|
|
13560
13551
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
13561
13552
|
docUrl: "localeTargetNotFound"
|
|
13562
13553
|
});
|
|
13563
|
-
} else if (_optionalChain([flags, 'access',
|
|
13554
|
+
} else if (_optionalChain([flags, 'access', _433 => _433.bucket, 'optionalAccess', _434 => _434.some, 'call', _435 => _435(
|
|
13564
13555
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
13565
13556
|
)])) {
|
|
13566
13557
|
throw new CLIError({
|
|
@@ -13652,7 +13643,7 @@ async function renderHero2() {
|
|
|
13652
13643
|
// package.json
|
|
13653
13644
|
var package_default = {
|
|
13654
13645
|
name: "lingo.dev",
|
|
13655
|
-
version: "0.117.
|
|
13646
|
+
version: "0.117.4",
|
|
13656
13647
|
description: "Lingo.dev CLI",
|
|
13657
13648
|
private: false,
|
|
13658
13649
|
publishConfig: {
|
|
@@ -13944,7 +13935,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
|
|
|
13944
13935
|
if (options.file && options.file.length) {
|
|
13945
13936
|
buckets = buckets.map((bucket) => {
|
|
13946
13937
|
const paths = bucket.paths.filter(
|
|
13947
|
-
(bucketPath) => _optionalChain([options, 'access',
|
|
13938
|
+
(bucketPath) => _optionalChain([options, 'access', _436 => _436.file, 'optionalAccess', _437 => _437.some, 'call', _438 => _438((f) => bucketPath.pathPattern.includes(f))])
|
|
13948
13939
|
);
|
|
13949
13940
|
return { ...bucket, paths };
|
|
13950
13941
|
}).filter((bucket) => bucket.paths.length > 0);
|