lingo.dev 0.117.3 → 0.117.5
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 +454 -259
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +332 -137
- package/build/cli.mjs.map +1 -1
- package/package.json +6 -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
|
}
|
|
@@ -3423,8 +3414,8 @@ function serializeElement(node) {
|
|
|
3423
3414
|
const attrString = Object.entries(attributes).map(([key, value]) => ` ${key}="${escapeAttributeValue(String(value))}"`).join("");
|
|
3424
3415
|
const children = Array.isArray(node.$$) ? node.$$ : [];
|
|
3425
3416
|
if (children.length === 0) {
|
|
3426
|
-
const
|
|
3427
|
-
return `<${name}${attrString}>${
|
|
3417
|
+
const textContent2 = _nullishCoalesce(node._, () => ( ""));
|
|
3418
|
+
return `<${name}${attrString}>${textContent2}</${name}>`;
|
|
3428
3419
|
}
|
|
3429
3420
|
const childContent = children.map(serializeElement).join("");
|
|
3430
3421
|
return `<${name}${attrString}>${childContent}</${name}>`;
|
|
@@ -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() {
|
|
@@ -3513,135 +3504,335 @@ function createPullOutputCleaner() {
|
|
|
3513
3504
|
}
|
|
3514
3505
|
|
|
3515
3506
|
// src/cli/loaders/html.ts
|
|
3516
|
-
var
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
return trimmed;
|
|
3521
|
-
}
|
|
3507
|
+
var _htmlparser2 = require('htmlparser2'); var htmlparser2 = _interopRequireWildcard(_htmlparser2);
|
|
3508
|
+
var _domhandler = require('domhandler');
|
|
3509
|
+
var _domutils = require('domutils'); var domutils = _interopRequireWildcard(_domutils);
|
|
3510
|
+
var _domserializer = require('dom-serializer'); var DomSerializer = _interopRequireWildcard(_domserializer);
|
|
3522
3511
|
function createHtmlLoader() {
|
|
3512
|
+
const PHRASING_ELEMENTS = /* @__PURE__ */ new Set([
|
|
3513
|
+
// Text-level semantics
|
|
3514
|
+
"a",
|
|
3515
|
+
"abbr",
|
|
3516
|
+
"b",
|
|
3517
|
+
"bdi",
|
|
3518
|
+
"bdo",
|
|
3519
|
+
"br",
|
|
3520
|
+
"cite",
|
|
3521
|
+
"code",
|
|
3522
|
+
"data",
|
|
3523
|
+
"dfn",
|
|
3524
|
+
"em",
|
|
3525
|
+
"i",
|
|
3526
|
+
"kbd",
|
|
3527
|
+
"mark",
|
|
3528
|
+
"q",
|
|
3529
|
+
"ruby",
|
|
3530
|
+
"s",
|
|
3531
|
+
"samp",
|
|
3532
|
+
"small",
|
|
3533
|
+
"span",
|
|
3534
|
+
"strong",
|
|
3535
|
+
"sub",
|
|
3536
|
+
"sup",
|
|
3537
|
+
"time",
|
|
3538
|
+
"u",
|
|
3539
|
+
"var",
|
|
3540
|
+
"wbr",
|
|
3541
|
+
// Media
|
|
3542
|
+
"audio",
|
|
3543
|
+
"img",
|
|
3544
|
+
"video",
|
|
3545
|
+
"picture",
|
|
3546
|
+
// Interactive
|
|
3547
|
+
"button",
|
|
3548
|
+
"input",
|
|
3549
|
+
"label",
|
|
3550
|
+
"select",
|
|
3551
|
+
"textarea",
|
|
3552
|
+
// Embedded
|
|
3553
|
+
"canvas",
|
|
3554
|
+
"iframe",
|
|
3555
|
+
"object",
|
|
3556
|
+
"svg",
|
|
3557
|
+
"math",
|
|
3558
|
+
// Other
|
|
3559
|
+
"del",
|
|
3560
|
+
"ins",
|
|
3561
|
+
"map",
|
|
3562
|
+
"area"
|
|
3563
|
+
]);
|
|
3564
|
+
const BLOCK_ELEMENTS = /* @__PURE__ */ new Set([
|
|
3565
|
+
"div",
|
|
3566
|
+
"p",
|
|
3567
|
+
"h1",
|
|
3568
|
+
"h2",
|
|
3569
|
+
"h3",
|
|
3570
|
+
"h4",
|
|
3571
|
+
"h5",
|
|
3572
|
+
"h6",
|
|
3573
|
+
"ul",
|
|
3574
|
+
"ol",
|
|
3575
|
+
"li",
|
|
3576
|
+
"dl",
|
|
3577
|
+
"dt",
|
|
3578
|
+
"dd",
|
|
3579
|
+
"blockquote",
|
|
3580
|
+
"pre",
|
|
3581
|
+
"article",
|
|
3582
|
+
"aside",
|
|
3583
|
+
"nav",
|
|
3584
|
+
"section",
|
|
3585
|
+
"header",
|
|
3586
|
+
"footer",
|
|
3587
|
+
"main",
|
|
3588
|
+
"figure",
|
|
3589
|
+
"figcaption",
|
|
3590
|
+
"table",
|
|
3591
|
+
"thead",
|
|
3592
|
+
"tbody",
|
|
3593
|
+
"tfoot",
|
|
3594
|
+
"tr",
|
|
3595
|
+
"td",
|
|
3596
|
+
"th",
|
|
3597
|
+
"caption",
|
|
3598
|
+
"form",
|
|
3599
|
+
"fieldset",
|
|
3600
|
+
"legend",
|
|
3601
|
+
"details",
|
|
3602
|
+
"summary",
|
|
3603
|
+
"address",
|
|
3604
|
+
"hr",
|
|
3605
|
+
"search",
|
|
3606
|
+
"dialog",
|
|
3607
|
+
"noscript",
|
|
3608
|
+
"title"
|
|
3609
|
+
// <title> should be treated as a block element for translation
|
|
3610
|
+
]);
|
|
3611
|
+
const UNLOCALIZABLE_TAGS = /* @__PURE__ */ new Set(["script", "style"]);
|
|
3523
3612
|
const LOCALIZABLE_ATTRIBUTES = {
|
|
3524
3613
|
meta: ["content"],
|
|
3525
|
-
img: ["alt"],
|
|
3526
|
-
input: ["placeholder"],
|
|
3527
|
-
|
|
3614
|
+
img: ["alt", "title"],
|
|
3615
|
+
input: ["placeholder", "title"],
|
|
3616
|
+
textarea: ["placeholder", "title"],
|
|
3617
|
+
a: ["title"],
|
|
3618
|
+
abbr: ["title"],
|
|
3619
|
+
button: ["title"],
|
|
3620
|
+
link: ["title"]
|
|
3528
3621
|
};
|
|
3529
|
-
const UNLOCALIZABLE_TAGS = ["script", "style"];
|
|
3530
3622
|
return createLoader({
|
|
3531
3623
|
async pull(locale, input2) {
|
|
3532
3624
|
const result = {};
|
|
3533
|
-
const
|
|
3534
|
-
const
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3625
|
+
const handler = new (0, _domhandler.DomHandler)();
|
|
3626
|
+
const parser = new htmlparser2.Parser(handler, {
|
|
3627
|
+
lowerCaseTags: false,
|
|
3628
|
+
lowerCaseAttributeNames: false
|
|
3629
|
+
});
|
|
3630
|
+
parser.write(input2);
|
|
3631
|
+
parser.end();
|
|
3632
|
+
const dom = handler.dom;
|
|
3633
|
+
function isInsideUnlocalizableTag(element) {
|
|
3634
|
+
let current = element.parent;
|
|
3635
|
+
while (current && current.type === "tag") {
|
|
3636
|
+
if (UNLOCALIZABLE_TAGS.has(current.name.toLowerCase())) {
|
|
3637
|
+
return true;
|
|
3545
3638
|
}
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3639
|
+
current = current.parent;
|
|
3640
|
+
}
|
|
3641
|
+
return false;
|
|
3642
|
+
}
|
|
3643
|
+
function hasTranslatableContent(element) {
|
|
3644
|
+
const text = domutils.textContent(element);
|
|
3645
|
+
return text.trim().length > 0;
|
|
3646
|
+
}
|
|
3647
|
+
function isLeafBlock(element) {
|
|
3648
|
+
const childElements = element.children.filter(
|
|
3649
|
+
(child) => child.type === "tag"
|
|
3650
|
+
);
|
|
3651
|
+
for (const child of childElements) {
|
|
3652
|
+
if (BLOCK_ELEMENTS.has(child.name.toLowerCase())) {
|
|
3653
|
+
return false;
|
|
3552
3654
|
}
|
|
3553
|
-
current = parent;
|
|
3554
3655
|
}
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3656
|
+
return hasTranslatableContent(element);
|
|
3657
|
+
}
|
|
3658
|
+
function getInnerHTML(element) {
|
|
3659
|
+
return element.children.map((child) => DomSerializer.default(child, { encodeEntities: false })).join("");
|
|
3660
|
+
}
|
|
3661
|
+
function extractAttributes(element, path19) {
|
|
3662
|
+
const tagName = element.name.toLowerCase();
|
|
3663
|
+
const attrs = LOCALIZABLE_ATTRIBUTES[tagName];
|
|
3664
|
+
if (!attrs) return;
|
|
3665
|
+
for (const attr of attrs) {
|
|
3666
|
+
const value = _optionalChain([element, 'access', _143 => _143.attribs, 'optionalAccess', _144 => _144[attr]]);
|
|
3667
|
+
if (value && value.trim()) {
|
|
3668
|
+
result[`${path19}#${attr}`] = value.trim();
|
|
3563
3669
|
}
|
|
3564
|
-
parent = parent.parentElement;
|
|
3565
3670
|
}
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3671
|
+
}
|
|
3672
|
+
function extractFromElement(element, pathParts) {
|
|
3673
|
+
const path19 = pathParts.join("/");
|
|
3674
|
+
if (isInsideUnlocalizableTag(element)) {
|
|
3675
|
+
return;
|
|
3676
|
+
}
|
|
3677
|
+
extractAttributes(element, path19);
|
|
3678
|
+
const tagName = element.name.toLowerCase();
|
|
3679
|
+
if (BLOCK_ELEMENTS.has(tagName) && isLeafBlock(element)) {
|
|
3680
|
+
const content = getInnerHTML(element).trim();
|
|
3681
|
+
if (content) {
|
|
3682
|
+
result[path19] = content;
|
|
3571
3683
|
}
|
|
3572
|
-
|
|
3573
|
-
const element = node;
|
|
3574
|
-
const tagName = element.tagName.toLowerCase();
|
|
3575
|
-
const attributes = LOCALIZABLE_ATTRIBUTES[tagName] || [];
|
|
3576
|
-
attributes.forEach((attr) => {
|
|
3577
|
-
const value = element.getAttribute(attr);
|
|
3578
|
-
if (value) {
|
|
3579
|
-
result[getPath(element, attr)] = value;
|
|
3580
|
-
}
|
|
3581
|
-
});
|
|
3582
|
-
Array.from(element.childNodes).filter(
|
|
3583
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _152 => _152.textContent, 'optionalAccess', _153 => _153.trim, 'call', _154 => _154()])
|
|
3584
|
-
).forEach(processNode);
|
|
3684
|
+
return;
|
|
3585
3685
|
}
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3686
|
+
if (PHRASING_ELEMENTS.has(tagName) && hasTranslatableContent(element)) {
|
|
3687
|
+
const content = getInnerHTML(element).trim();
|
|
3688
|
+
if (content) {
|
|
3689
|
+
result[path19] = content;
|
|
3690
|
+
}
|
|
3691
|
+
return;
|
|
3692
|
+
}
|
|
3693
|
+
let childIndex = 0;
|
|
3694
|
+
const childElements = element.children.filter(
|
|
3695
|
+
(child) => child.type === "tag"
|
|
3696
|
+
);
|
|
3697
|
+
for (const child of childElements) {
|
|
3698
|
+
extractFromElement(child, [...pathParts, childIndex++]);
|
|
3699
|
+
}
|
|
3700
|
+
}
|
|
3701
|
+
const html = domutils.findOne(
|
|
3702
|
+
(elem) => elem.type === "tag" && elem.name.toLowerCase() === "html",
|
|
3703
|
+
dom,
|
|
3704
|
+
true
|
|
3705
|
+
);
|
|
3706
|
+
if (html) {
|
|
3707
|
+
const head = domutils.findOne(
|
|
3708
|
+
(elem) => elem.type === "tag" && elem.name.toLowerCase() === "head",
|
|
3709
|
+
html.children,
|
|
3710
|
+
true
|
|
3711
|
+
);
|
|
3712
|
+
const body = domutils.findOne(
|
|
3713
|
+
(elem) => elem.type === "tag" && elem.name.toLowerCase() === "body",
|
|
3714
|
+
html.children,
|
|
3715
|
+
true
|
|
3716
|
+
);
|
|
3717
|
+
if (head) {
|
|
3718
|
+
let headIndex = 0;
|
|
3719
|
+
const headChildren = head.children.filter(
|
|
3720
|
+
(child) => child.type === "tag"
|
|
3721
|
+
);
|
|
3722
|
+
for (const child of headChildren) {
|
|
3723
|
+
extractFromElement(child, ["head", headIndex++]);
|
|
3724
|
+
}
|
|
3725
|
+
}
|
|
3726
|
+
if (body) {
|
|
3727
|
+
let bodyIndex = 0;
|
|
3728
|
+
const bodyChildren = body.children.filter(
|
|
3729
|
+
(child) => child.type === "tag"
|
|
3730
|
+
);
|
|
3731
|
+
for (const child of bodyChildren) {
|
|
3732
|
+
extractFromElement(child, ["body", bodyIndex++]);
|
|
3733
|
+
}
|
|
3734
|
+
}
|
|
3735
|
+
} else {
|
|
3736
|
+
let rootIndex = 0;
|
|
3737
|
+
const rootElements = dom.filter(
|
|
3738
|
+
(child) => child.type === "tag"
|
|
3739
|
+
);
|
|
3740
|
+
for (const child of rootElements) {
|
|
3741
|
+
extractFromElement(child, [rootIndex++]);
|
|
3742
|
+
}
|
|
3743
|
+
}
|
|
3593
3744
|
return result;
|
|
3594
3745
|
},
|
|
3595
3746
|
async push(locale, data, originalInput) {
|
|
3596
|
-
const
|
|
3747
|
+
const handler = new (0, _domhandler.DomHandler)();
|
|
3748
|
+
const parser = new htmlparser2.Parser(handler, {
|
|
3749
|
+
lowerCaseTags: false,
|
|
3750
|
+
lowerCaseAttributeNames: false
|
|
3751
|
+
});
|
|
3752
|
+
parser.write(
|
|
3597
3753
|
_nullishCoalesce(originalInput, () => ( "<!DOCTYPE html><html><head></head><body></body></html>"))
|
|
3598
3754
|
);
|
|
3599
|
-
|
|
3600
|
-
const
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
let
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
const index = parseInt(
|
|
3615
|
-
const
|
|
3616
|
-
(
|
|
3755
|
+
parser.end();
|
|
3756
|
+
const dom = handler.dom;
|
|
3757
|
+
const html = domutils.findOne(
|
|
3758
|
+
(elem) => elem.type === "tag" && elem.name.toLowerCase() === "html",
|
|
3759
|
+
dom,
|
|
3760
|
+
true
|
|
3761
|
+
);
|
|
3762
|
+
if (html) {
|
|
3763
|
+
html.attribs = html.attribs || {};
|
|
3764
|
+
html.attribs.lang = locale;
|
|
3765
|
+
}
|
|
3766
|
+
function traverseByIndices(element, indices) {
|
|
3767
|
+
let current = element;
|
|
3768
|
+
for (const indexStr of indices) {
|
|
3769
|
+
if (!current) return null;
|
|
3770
|
+
const index = parseInt(indexStr, 10);
|
|
3771
|
+
const children = current.children.filter(
|
|
3772
|
+
(child) => child.type === "tag"
|
|
3617
3773
|
);
|
|
3618
|
-
if (index >=
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3774
|
+
if (index >= children.length) {
|
|
3775
|
+
return null;
|
|
3776
|
+
}
|
|
3777
|
+
current = children[index];
|
|
3778
|
+
}
|
|
3779
|
+
return current;
|
|
3780
|
+
}
|
|
3781
|
+
function resolvePathToElement(path19) {
|
|
3782
|
+
const parts = path19.split("/");
|
|
3783
|
+
const [rootTag, ...indices] = parts;
|
|
3784
|
+
let current = null;
|
|
3785
|
+
if (html) {
|
|
3786
|
+
if (rootTag === "head") {
|
|
3787
|
+
current = domutils.findOne(
|
|
3788
|
+
(elem) => elem.type === "tag" && elem.name.toLowerCase() === "head",
|
|
3789
|
+
html.children,
|
|
3790
|
+
true
|
|
3791
|
+
);
|
|
3792
|
+
} else if (rootTag === "body") {
|
|
3793
|
+
current = domutils.findOne(
|
|
3794
|
+
(elem) => elem.type === "tag" && elem.name.toLowerCase() === "body",
|
|
3795
|
+
html.children,
|
|
3796
|
+
true
|
|
3797
|
+
);
|
|
3798
|
+
}
|
|
3799
|
+
if (!current) return null;
|
|
3800
|
+
return traverseByIndices(current, indices);
|
|
3801
|
+
} else {
|
|
3802
|
+
const rootElements = dom.filter(
|
|
3803
|
+
(child) => child.type === "tag"
|
|
3804
|
+
);
|
|
3805
|
+
const rootIndex = parseInt(rootTag, 10);
|
|
3806
|
+
if (rootIndex >= rootElements.length) {
|
|
3807
|
+
return null;
|
|
3634
3808
|
}
|
|
3809
|
+
current = rootElements[rootIndex];
|
|
3810
|
+
return traverseByIndices(current, indices);
|
|
3635
3811
|
}
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3812
|
+
}
|
|
3813
|
+
for (const [path19, value] of Object.entries(data)) {
|
|
3814
|
+
const [nodePath, attribute] = path19.split("#");
|
|
3815
|
+
const element = resolvePathToElement(nodePath);
|
|
3816
|
+
if (!element) {
|
|
3817
|
+
console.warn(`Path not found in original HTML: ${nodePath}`);
|
|
3818
|
+
continue;
|
|
3819
|
+
}
|
|
3820
|
+
if (attribute) {
|
|
3821
|
+
element.attribs = element.attribs || {};
|
|
3822
|
+
element.attribs[attribute] = value;
|
|
3823
|
+
} else {
|
|
3824
|
+
if (value) {
|
|
3825
|
+
const valueHandler = new (0, _domhandler.DomHandler)();
|
|
3826
|
+
const valueParser = new htmlparser2.Parser(valueHandler);
|
|
3827
|
+
valueParser.write(value);
|
|
3828
|
+
valueParser.end();
|
|
3829
|
+
element.children = valueHandler.dom;
|
|
3639
3830
|
} else {
|
|
3640
|
-
|
|
3831
|
+
element.children = [];
|
|
3641
3832
|
}
|
|
3642
3833
|
}
|
|
3643
|
-
}
|
|
3644
|
-
return
|
|
3834
|
+
}
|
|
3835
|
+
return DomSerializer.default(dom, { encodeEntities: false });
|
|
3645
3836
|
}
|
|
3646
3837
|
});
|
|
3647
3838
|
}
|
|
@@ -3664,7 +3855,7 @@ function createMarkdownLoader() {
|
|
|
3664
3855
|
yaml: yamlEngine
|
|
3665
3856
|
}
|
|
3666
3857
|
});
|
|
3667
|
-
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess',
|
|
3858
|
+
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _145 => _145.trim, 'call', _146 => _146()]), () => ( ""))).filter(Boolean);
|
|
3668
3859
|
return {
|
|
3669
3860
|
...Object.fromEntries(
|
|
3670
3861
|
sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
|
|
@@ -3683,7 +3874,7 @@ function createMarkdownLoader() {
|
|
|
3683
3874
|
);
|
|
3684
3875
|
let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(
|
|
3685
3876
|
([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())
|
|
3686
|
-
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess',
|
|
3877
|
+
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _147 => _147.trim, 'call', _148 => _148()]), () => ( ""))).filter(Boolean).join("\n\n");
|
|
3687
3878
|
if (Object.keys(frontmatter).length > 0) {
|
|
3688
3879
|
content = `
|
|
3689
3880
|
${content}`;
|
|
@@ -3708,7 +3899,7 @@ function createMarkdocLoader() {
|
|
|
3708
3899
|
const result = {};
|
|
3709
3900
|
const counters = {};
|
|
3710
3901
|
traverseAndExtract(ast, "", result, counters);
|
|
3711
|
-
if (_optionalChain([ast, 'access',
|
|
3902
|
+
if (_optionalChain([ast, 'access', _149 => _149.attributes, 'optionalAccess', _150 => _150.frontmatter])) {
|
|
3712
3903
|
const frontmatter = _yaml2.default.parse(ast.attributes.frontmatter);
|
|
3713
3904
|
Object.entries(frontmatter).forEach(([key, value]) => {
|
|
3714
3905
|
if (typeof value === "string") {
|
|
@@ -3754,7 +3945,7 @@ function traverseAndExtract(node, path19, result, counters, parentType) {
|
|
|
3754
3945
|
if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
|
|
3755
3946
|
semanticType = nodeSemanticType;
|
|
3756
3947
|
}
|
|
3757
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
3948
|
+
if (node.type === "text" && _optionalChain([node, 'access', _151 => _151.attributes, 'optionalAccess', _152 => _152.content])) {
|
|
3758
3949
|
const content = node.attributes.content;
|
|
3759
3950
|
if (typeof content === "string" && content.trim()) {
|
|
3760
3951
|
if (semanticType) {
|
|
@@ -3781,7 +3972,7 @@ function buildPathMap(node, path19, counters, pathMap, parentType) {
|
|
|
3781
3972
|
if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
|
|
3782
3973
|
semanticType = nodeSemanticType;
|
|
3783
3974
|
}
|
|
3784
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
3975
|
+
if (node.type === "text" && _optionalChain([node, 'access', _153 => _153.attributes, 'optionalAccess', _154 => _154.content])) {
|
|
3785
3976
|
const content = node.attributes.content;
|
|
3786
3977
|
if (typeof content === "string" && content.trim()) {
|
|
3787
3978
|
if (semanticType) {
|
|
@@ -3804,7 +3995,7 @@ function applyTranslations(node, path19, data, pathMap) {
|
|
|
3804
3995
|
if (!node || typeof node !== "object") {
|
|
3805
3996
|
return;
|
|
3806
3997
|
}
|
|
3807
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
3998
|
+
if (node.type === "text" && _optionalChain([node, 'access', _155 => _155.attributes, 'optionalAccess', _156 => _156.content])) {
|
|
3808
3999
|
const content = node.attributes.content;
|
|
3809
4000
|
if (typeof content === "string") {
|
|
3810
4001
|
const contentPath = path19 ? `${path19}/attributes/content` : "attributes/content";
|
|
@@ -3854,7 +4045,7 @@ function isSkippableLine(line) {
|
|
|
3854
4045
|
function parsePropertyLine(line) {
|
|
3855
4046
|
const [key, ...valueParts] = line.split("=");
|
|
3856
4047
|
return {
|
|
3857
|
-
key: _optionalChain([key, 'optionalAccess',
|
|
4048
|
+
key: _optionalChain([key, 'optionalAccess', _157 => _157.trim, 'call', _158 => _158()]) || "",
|
|
3858
4049
|
value: valueParts.join("=").trim()
|
|
3859
4050
|
};
|
|
3860
4051
|
}
|
|
@@ -4087,7 +4278,7 @@ function escapeString(str) {
|
|
|
4087
4278
|
}
|
|
4088
4279
|
|
|
4089
4280
|
// src/cli/loaders/xcode-strings/parser.ts
|
|
4090
|
-
var
|
|
4281
|
+
var Parser2 = class {
|
|
4091
4282
|
|
|
4092
4283
|
|
|
4093
4284
|
constructor(tokens) {
|
|
@@ -4146,7 +4337,7 @@ var Parser = class {
|
|
|
4146
4337
|
}
|
|
4147
4338
|
}
|
|
4148
4339
|
expect(type) {
|
|
4149
|
-
if (_optionalChain([this, 'access',
|
|
4340
|
+
if (_optionalChain([this, 'access', _159 => _159.current, 'call', _160 => _160(), 'optionalAccess', _161 => _161.type]) === type) {
|
|
4150
4341
|
this.advance();
|
|
4151
4342
|
return true;
|
|
4152
4343
|
}
|
|
@@ -4160,7 +4351,7 @@ function createXcodeStringsLoader() {
|
|
|
4160
4351
|
async pull(locale, input2) {
|
|
4161
4352
|
const tokenizer = new Tokenizer(input2);
|
|
4162
4353
|
const tokens = tokenizer.tokenize();
|
|
4163
|
-
const parser = new
|
|
4354
|
+
const parser = new Parser2(tokens);
|
|
4164
4355
|
const result = parser.parse();
|
|
4165
4356
|
return result;
|
|
4166
4357
|
},
|
|
@@ -4223,7 +4414,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4223
4414
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
4224
4415
|
continue;
|
|
4225
4416
|
}
|
|
4226
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
4417
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _162 => _162.localizations, 'optionalAccess', _163 => _163[locale]]);
|
|
4227
4418
|
if (langTranslationEntity) {
|
|
4228
4419
|
if ("stringUnit" in langTranslationEntity) {
|
|
4229
4420
|
resultData[translationKey] = langTranslationEntity.stringUnit.value;
|
|
@@ -4237,7 +4428,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4237
4428
|
resultData[translationKey] = {};
|
|
4238
4429
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
4239
4430
|
for (const form in pluralForms) {
|
|
4240
|
-
if (_optionalChain([pluralForms, 'access',
|
|
4431
|
+
if (_optionalChain([pluralForms, 'access', _164 => _164[form], 'optionalAccess', _165 => _165.stringUnit, 'optionalAccess', _166 => _166.value])) {
|
|
4241
4432
|
resultData[translationKey][form] = pluralForms[form].stringUnit.value;
|
|
4242
4433
|
}
|
|
4243
4434
|
}
|
|
@@ -4263,7 +4454,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4263
4454
|
const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
|
|
4264
4455
|
if (typeof value === "string") {
|
|
4265
4456
|
langDataToMerge.strings[key] = {
|
|
4266
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
4457
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _167 => _167.strings, 'optionalAccess', _168 => _168[key], 'optionalAccess', _169 => _169.extractionState]),
|
|
4267
4458
|
localizations: {
|
|
4268
4459
|
[locale]: {
|
|
4269
4460
|
stringUnit: {
|
|
@@ -4278,7 +4469,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4278
4469
|
}
|
|
4279
4470
|
} else if (Array.isArray(value)) {
|
|
4280
4471
|
langDataToMerge.strings[key] = {
|
|
4281
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
4472
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _170 => _170.strings, 'optionalAccess', _171 => _171[key], 'optionalAccess', _172 => _172.extractionState]),
|
|
4282
4473
|
localizations: {
|
|
4283
4474
|
[locale]: {
|
|
4284
4475
|
stringSet: {
|
|
@@ -4336,7 +4527,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4336
4527
|
for (const [locale, localization] of Object.entries(
|
|
4337
4528
|
entity.localizations
|
|
4338
4529
|
)) {
|
|
4339
|
-
if (_optionalChain([localization, 'access',
|
|
4530
|
+
if (_optionalChain([localization, 'access', _173 => _173.variations, 'optionalAccess', _174 => _174.plural])) {
|
|
4340
4531
|
const pluralForms = localization.variations.plural;
|
|
4341
4532
|
for (const form in pluralForms) {
|
|
4342
4533
|
const pluralKey = `${translationKey}/${form}`;
|
|
@@ -4356,7 +4547,7 @@ function _removeLocale(input2, locale) {
|
|
|
4356
4547
|
const { strings } = input2;
|
|
4357
4548
|
const newStrings = _lodash2.default.cloneDeep(strings);
|
|
4358
4549
|
for (const [key, value] of Object.entries(newStrings)) {
|
|
4359
|
-
if (_optionalChain([value, 'access',
|
|
4550
|
+
if (_optionalChain([value, 'access', _175 => _175.localizations, 'optionalAccess', _176 => _176[locale]])) {
|
|
4360
4551
|
delete value.localizations[locale];
|
|
4361
4552
|
}
|
|
4362
4553
|
}
|
|
@@ -4487,7 +4678,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
4487
4678
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
4488
4679
|
continue;
|
|
4489
4680
|
}
|
|
4490
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
4681
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _177 => _177.localizations, 'optionalAccess', _178 => _178[locale]]);
|
|
4491
4682
|
if (langTranslationEntity) {
|
|
4492
4683
|
if (!resultData[translationKey]) {
|
|
4493
4684
|
resultData[translationKey] = {};
|
|
@@ -4499,7 +4690,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
4499
4690
|
for (const [subName, subData] of Object.entries(
|
|
4500
4691
|
langTranslationEntity.substitutions
|
|
4501
4692
|
)) {
|
|
4502
|
-
const pluralForms = _optionalChain([subData, 'access',
|
|
4693
|
+
const pluralForms = _optionalChain([subData, 'access', _179 => _179.variations, 'optionalAccess', _180 => _180.plural]);
|
|
4503
4694
|
if (pluralForms) {
|
|
4504
4695
|
const forms = {};
|
|
4505
4696
|
for (const [form, formData] of Object.entries(pluralForms)) {
|
|
@@ -4524,7 +4715,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
4524
4715
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
4525
4716
|
const forms = {};
|
|
4526
4717
|
for (const [form, formData] of Object.entries(pluralForms)) {
|
|
4527
|
-
if (_optionalChain([formData, 'optionalAccess',
|
|
4718
|
+
if (_optionalChain([formData, 'optionalAccess', _181 => _181.stringUnit, 'optionalAccess', _182 => _182.value])) {
|
|
4528
4719
|
forms[form] = formData.stringUnit.value;
|
|
4529
4720
|
}
|
|
4530
4721
|
}
|
|
@@ -4567,7 +4758,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
4567
4758
|
for (const [subName, subData] of Object.entries(
|
|
4568
4759
|
keyData.substitutions
|
|
4569
4760
|
)) {
|
|
4570
|
-
const pluralValue = _optionalChain([subData, 'optionalAccess',
|
|
4761
|
+
const pluralValue = _optionalChain([subData, 'optionalAccess', _183 => _183.variations, 'optionalAccess', _184 => _184.plural]);
|
|
4571
4762
|
if (pluralValue && isIcuPluralString(pluralValue)) {
|
|
4572
4763
|
try {
|
|
4573
4764
|
const pluralForms = parseIcuPluralString(pluralValue, locale);
|
|
@@ -4580,8 +4771,8 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
4580
4771
|
}
|
|
4581
4772
|
};
|
|
4582
4773
|
}
|
|
4583
|
-
const sourceLocale = _optionalChain([originalInput, 'optionalAccess',
|
|
4584
|
-
const origFormatSpec = _optionalChain([originalInput, 'optionalAccess',
|
|
4774
|
+
const sourceLocale = _optionalChain([originalInput, 'optionalAccess', _185 => _185.sourceLanguage]) || "en";
|
|
4775
|
+
const origFormatSpec = _optionalChain([originalInput, 'optionalAccess', _186 => _186.strings, 'optionalAccess', _187 => _187[baseKey], 'optionalAccess', _188 => _188.localizations, 'optionalAccess', _189 => _189[sourceLocale], 'optionalAccess', _190 => _190.substitutions, 'optionalAccess', _191 => _191[subName], 'optionalAccess', _192 => _192.formatSpecifier]) || subName;
|
|
4585
4776
|
subs[subName] = {
|
|
4586
4777
|
formatSpecifier: origFormatSpec,
|
|
4587
4778
|
variations: {
|
|
@@ -4606,7 +4797,7 @@ ${error instanceof Error ? error.message : String(error)}`
|
|
|
4606
4797
|
values: keyData.stringSet
|
|
4607
4798
|
};
|
|
4608
4799
|
}
|
|
4609
|
-
if ("variations" in keyData && _optionalChain([keyData, 'access',
|
|
4800
|
+
if ("variations" in keyData && _optionalChain([keyData, 'access', _193 => _193.variations, 'optionalAccess', _194 => _194.plural])) {
|
|
4610
4801
|
const pluralValue = keyData.variations.plural;
|
|
4611
4802
|
if (isIcuPluralString(pluralValue)) {
|
|
4612
4803
|
try {
|
|
@@ -4633,7 +4824,7 @@ ${error instanceof Error ? error.message : String(error)}`
|
|
|
4633
4824
|
}
|
|
4634
4825
|
if (Object.keys(localizationData).length > 0) {
|
|
4635
4826
|
langDataToMerge.strings[baseKey] = {
|
|
4636
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
4827
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _195 => _195.strings, 'optionalAccess', _196 => _196[baseKey], 'optionalAccess', _197 => _197.extractionState]),
|
|
4637
4828
|
localizations: {
|
|
4638
4829
|
[locale]: localizationData
|
|
4639
4830
|
}
|
|
@@ -4856,8 +5047,8 @@ async function formatDataWithBiome(data, filePath, options) {
|
|
|
4856
5047
|
});
|
|
4857
5048
|
return formatted.content;
|
|
4858
5049
|
} catch (error) {
|
|
4859
|
-
const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access',
|
|
4860
|
-
if (_optionalChain([errorMessage, 'optionalAccess',
|
|
5050
|
+
const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access', _198 => _198.stackTrace, 'optionalAccess', _199 => _199.toString, 'call', _200 => _200(), 'access', _201 => _201.split, 'call', _202 => _202("\n"), 'access', _203 => _203[0]]) : "";
|
|
5051
|
+
if (_optionalChain([errorMessage, 'optionalAccess', _204 => _204.includes, 'call', _205 => _205("does not exist in the workspace")])) {
|
|
4861
5052
|
} else {
|
|
4862
5053
|
console.log(`\u26A0\uFE0F Biome skipped ${path14.default.basename(filePath)}`);
|
|
4863
5054
|
if (errorMessage) {
|
|
@@ -4904,7 +5095,7 @@ function createPoDataLoader(params) {
|
|
|
4904
5095
|
Object.entries(entries).forEach(([msgid, entry]) => {
|
|
4905
5096
|
if (msgid && entry.msgid) {
|
|
4906
5097
|
const context = entry.msgctxt || "";
|
|
4907
|
-
const fullEntry = _optionalChain([parsedPo, 'access',
|
|
5098
|
+
const fullEntry = _optionalChain([parsedPo, 'access', _206 => _206.translations, 'access', _207 => _207[context], 'optionalAccess', _208 => _208[msgid]]);
|
|
4908
5099
|
if (fullEntry) {
|
|
4909
5100
|
result[msgid] = fullEntry;
|
|
4910
5101
|
}
|
|
@@ -4914,8 +5105,8 @@ function createPoDataLoader(params) {
|
|
|
4914
5105
|
return result;
|
|
4915
5106
|
},
|
|
4916
5107
|
async push(locale, data, originalInput, originalLocale, pullInput) {
|
|
4917
|
-
const currentSections = _optionalChain([pullInput, 'optionalAccess',
|
|
4918
|
-
const originalSections = _optionalChain([originalInput, 'optionalAccess',
|
|
5108
|
+
const currentSections = _optionalChain([pullInput, 'optionalAccess', _209 => _209.split, 'call', _210 => _210("\n\n"), 'access', _211 => _211.filter, 'call', _212 => _212(Boolean)]) || [];
|
|
5109
|
+
const originalSections = _optionalChain([originalInput, 'optionalAccess', _213 => _213.split, 'call', _214 => _214("\n\n"), 'access', _215 => _215.filter, 'call', _216 => _216(Boolean)]) || [];
|
|
4919
5110
|
const result = originalSections.map((section) => {
|
|
4920
5111
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
4921
5112
|
if (Object.keys(sectionPo.translations).length === 0) {
|
|
@@ -4984,8 +5175,8 @@ function createPoContentLoader() {
|
|
|
4984
5175
|
{
|
|
4985
5176
|
...entry,
|
|
4986
5177
|
msgstr: [
|
|
4987
|
-
_optionalChain([data, 'access',
|
|
4988
|
-
_optionalChain([data, 'access',
|
|
5178
|
+
_optionalChain([data, 'access', _217 => _217[entry.msgid], 'optionalAccess', _218 => _218.singular]),
|
|
5179
|
+
_optionalChain([data, 'access', _219 => _219[entry.msgid], 'optionalAccess', _220 => _220.plural]) || null
|
|
4989
5180
|
].filter(Boolean)
|
|
4990
5181
|
}
|
|
4991
5182
|
]).fromPairs().value();
|
|
@@ -5024,7 +5215,7 @@ function preserveCommentOrder(section, originalSection) {
|
|
|
5024
5215
|
}
|
|
5025
5216
|
|
|
5026
5217
|
// src/cli/loaders/xliff.ts
|
|
5027
|
-
|
|
5218
|
+
var _jsdom = require('jsdom');
|
|
5028
5219
|
function createXliffLoader() {
|
|
5029
5220
|
return createLoader({
|
|
5030
5221
|
async pull(locale, input2, _ctx, originalLocale) {
|
|
@@ -5107,7 +5298,7 @@ function pullV1(xliffElement, locale, originalLocale) {
|
|
|
5107
5298
|
let key = getTransUnitKey(unit);
|
|
5108
5299
|
if (!key) return;
|
|
5109
5300
|
if (seenKeys.has(key)) {
|
|
5110
|
-
const id = _optionalChain([unit, 'access',
|
|
5301
|
+
const id = _optionalChain([unit, 'access', _221 => _221.getAttribute, 'call', _222 => _222("id"), 'optionalAccess', _223 => _223.trim, 'call', _224 => _224()]);
|
|
5111
5302
|
if (id) {
|
|
5112
5303
|
key = `${key}#${id}`;
|
|
5113
5304
|
} else {
|
|
@@ -5155,7 +5346,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
5155
5346
|
let key = getTransUnitKey(unit);
|
|
5156
5347
|
if (!key) return;
|
|
5157
5348
|
if (seenKeys.has(key)) {
|
|
5158
|
-
const id = _optionalChain([unit, 'access',
|
|
5349
|
+
const id = _optionalChain([unit, 'access', _225 => _225.getAttribute, 'call', _226 => _226("id"), 'optionalAccess', _227 => _227.trim, 'call', _228 => _228()]);
|
|
5159
5350
|
if (id) {
|
|
5160
5351
|
key = `${key}#${id}`;
|
|
5161
5352
|
} else {
|
|
@@ -5197,7 +5388,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
5197
5388
|
const translationKeys = new Set(Object.keys(translations));
|
|
5198
5389
|
existingUnits.forEach((unit, key) => {
|
|
5199
5390
|
if (!translationKeys.has(key)) {
|
|
5200
|
-
_optionalChain([unit, 'access',
|
|
5391
|
+
_optionalChain([unit, 'access', _229 => _229.parentNode, 'optionalAccess', _230 => _230.removeChild, 'call', _231 => _231(unit)]);
|
|
5201
5392
|
}
|
|
5202
5393
|
});
|
|
5203
5394
|
return serializeWithDeclaration(
|
|
@@ -5240,18 +5431,18 @@ function traverseUnitsV2(container, fileId, currentPath, result) {
|
|
|
5240
5431
|
Array.from(container.children).forEach((child) => {
|
|
5241
5432
|
const tagName = child.tagName;
|
|
5242
5433
|
if (tagName === "unit") {
|
|
5243
|
-
const unitId = _optionalChain([child, 'access',
|
|
5434
|
+
const unitId = _optionalChain([child, 'access', _232 => _232.getAttribute, 'call', _233 => _233("id"), 'optionalAccess', _234 => _234.trim, 'call', _235 => _235()]);
|
|
5244
5435
|
if (!unitId) return;
|
|
5245
5436
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
5246
5437
|
const segment = child.querySelector("segment");
|
|
5247
|
-
const source = _optionalChain([segment, 'optionalAccess',
|
|
5438
|
+
const source = _optionalChain([segment, 'optionalAccess', _236 => _236.querySelector, 'call', _237 => _237("source")]);
|
|
5248
5439
|
if (source) {
|
|
5249
5440
|
result[key] = extractTextContent(source);
|
|
5250
5441
|
} else {
|
|
5251
5442
|
result[key] = unitId;
|
|
5252
5443
|
}
|
|
5253
5444
|
} else if (tagName === "group") {
|
|
5254
|
-
const groupId = _optionalChain([child, 'access',
|
|
5445
|
+
const groupId = _optionalChain([child, 'access', _238 => _238.getAttribute, 'call', _239 => _239("id"), 'optionalAccess', _240 => _240.trim, 'call', _241 => _241()]);
|
|
5255
5446
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
5256
5447
|
traverseUnitsV2(child, fileId, newPath, result);
|
|
5257
5448
|
}
|
|
@@ -5287,12 +5478,12 @@ function indexUnitsV2(container, fileId, currentPath, index) {
|
|
|
5287
5478
|
Array.from(container.children).forEach((child) => {
|
|
5288
5479
|
const tagName = child.tagName;
|
|
5289
5480
|
if (tagName === "unit") {
|
|
5290
|
-
const unitId = _optionalChain([child, 'access',
|
|
5481
|
+
const unitId = _optionalChain([child, 'access', _242 => _242.getAttribute, 'call', _243 => _243("id"), 'optionalAccess', _244 => _244.trim, 'call', _245 => _245()]);
|
|
5291
5482
|
if (!unitId) return;
|
|
5292
5483
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
5293
5484
|
index.set(key, child);
|
|
5294
5485
|
} else if (tagName === "group") {
|
|
5295
|
-
const groupId = _optionalChain([child, 'access',
|
|
5486
|
+
const groupId = _optionalChain([child, 'access', _246 => _246.getAttribute, 'call', _247 => _247("id"), 'optionalAccess', _248 => _248.trim, 'call', _249 => _249()]);
|
|
5296
5487
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
5297
5488
|
indexUnitsV2(child, fileId, newPath, index);
|
|
5298
5489
|
}
|
|
@@ -5313,9 +5504,9 @@ function updateUnitV2(unit, value) {
|
|
|
5313
5504
|
setTextContent(source, value);
|
|
5314
5505
|
}
|
|
5315
5506
|
function getTransUnitKey(transUnit) {
|
|
5316
|
-
const resname = _optionalChain([transUnit, 'access',
|
|
5507
|
+
const resname = _optionalChain([transUnit, 'access', _250 => _250.getAttribute, 'call', _251 => _251("resname"), 'optionalAccess', _252 => _252.trim, 'call', _253 => _253()]);
|
|
5317
5508
|
if (resname) return resname;
|
|
5318
|
-
const id = _optionalChain([transUnit, 'access',
|
|
5509
|
+
const id = _optionalChain([transUnit, 'access', _254 => _254.getAttribute, 'call', _255 => _255("id"), 'optionalAccess', _256 => _256.trim, 'call', _257 => _257()]);
|
|
5319
5510
|
if (id) return id;
|
|
5320
5511
|
const sourceElement = transUnit.querySelector("source");
|
|
5321
5512
|
if (sourceElement) {
|
|
@@ -5372,10 +5563,10 @@ function formatXml(xml) {
|
|
|
5372
5563
|
if (cdataNode) {
|
|
5373
5564
|
return `${indent2}${openTag}<![CDATA[${cdataNode.nodeValue}]]></${tagName}>`;
|
|
5374
5565
|
}
|
|
5375
|
-
const
|
|
5566
|
+
const textContent2 = _optionalChain([element, 'access', _258 => _258.textContent, 'optionalAccess', _259 => _259.trim, 'call', _260 => _260()]) || "";
|
|
5376
5567
|
const hasOnlyText = element.childNodes.length === 1 && element.childNodes[0].nodeType === 3;
|
|
5377
|
-
if (hasOnlyText &&
|
|
5378
|
-
return `${indent2}${openTag}${
|
|
5568
|
+
if (hasOnlyText && textContent2) {
|
|
5569
|
+
return `${indent2}${openTag}${textContent2}</${tagName}>`;
|
|
5379
5570
|
}
|
|
5380
5571
|
const children = Array.from(element.children);
|
|
5381
5572
|
if (children.length === 0) {
|
|
@@ -5665,7 +5856,7 @@ function createDatoClient(params) {
|
|
|
5665
5856
|
ids: !records.length ? void 0 : records.join(",")
|
|
5666
5857
|
}
|
|
5667
5858
|
}).catch(
|
|
5668
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
5859
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _261 => _261.response, 'optionalAccess', _262 => _262.body, 'optionalAccess', _263 => _263.data, 'optionalAccess', _264 => _264[0]]) || error)
|
|
5669
5860
|
);
|
|
5670
5861
|
},
|
|
5671
5862
|
findRecordsForModel: async (modelId, records) => {
|
|
@@ -5676,10 +5867,10 @@ function createDatoClient(params) {
|
|
|
5676
5867
|
filter: {
|
|
5677
5868
|
type: modelId,
|
|
5678
5869
|
only_valid: "true",
|
|
5679
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
5870
|
+
ids: !_optionalChain([records, 'optionalAccess', _265 => _265.length]) ? void 0 : records.join(",")
|
|
5680
5871
|
}
|
|
5681
5872
|
}).catch(
|
|
5682
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
5873
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _266 => _266.response, 'optionalAccess', _267 => _267.body, 'optionalAccess', _268 => _268.data, 'optionalAccess', _269 => _269[0]]) || error)
|
|
5683
5874
|
);
|
|
5684
5875
|
return result;
|
|
5685
5876
|
} catch (_error) {
|
|
@@ -5695,10 +5886,10 @@ function createDatoClient(params) {
|
|
|
5695
5886
|
updateRecord: async (id, payload) => {
|
|
5696
5887
|
try {
|
|
5697
5888
|
await dato.items.update(id, payload).catch(
|
|
5698
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
5889
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _270 => _270.response, 'optionalAccess', _271 => _271.body, 'optionalAccess', _272 => _272.data, 'optionalAccess', _273 => _273[0]]) || error)
|
|
5699
5890
|
);
|
|
5700
5891
|
} catch (_error) {
|
|
5701
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
5892
|
+
if (_optionalChain([_error, 'optionalAccess', _274 => _274.attributes, 'optionalAccess', _275 => _275.details, 'optionalAccess', _276 => _276.message])) {
|
|
5702
5893
|
throw new Error(
|
|
5703
5894
|
[
|
|
5704
5895
|
`${_error.attributes.details.message}`,
|
|
@@ -5720,10 +5911,10 @@ function createDatoClient(params) {
|
|
|
5720
5911
|
enableFieldLocalization: async (args) => {
|
|
5721
5912
|
try {
|
|
5722
5913
|
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch(
|
|
5723
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
5914
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _277 => _277.response, 'optionalAccess', _278 => _278.body, 'optionalAccess', _279 => _279.data, 'optionalAccess', _280 => _280[0]]) || error)
|
|
5724
5915
|
);
|
|
5725
5916
|
} catch (_error) {
|
|
5726
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
5917
|
+
if (_optionalChain([_error, 'optionalAccess', _281 => _281.attributes, 'optionalAccess', _282 => _282.code]) === "NOT_FOUND") {
|
|
5727
5918
|
throw new Error(
|
|
5728
5919
|
[
|
|
5729
5920
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -5731,7 +5922,7 @@ function createDatoClient(params) {
|
|
|
5731
5922
|
].join("\n\n")
|
|
5732
5923
|
);
|
|
5733
5924
|
}
|
|
5734
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
5925
|
+
if (_optionalChain([_error, 'optionalAccess', _283 => _283.attributes, 'optionalAccess', _284 => _284.details, 'optionalAccess', _285 => _285.message])) {
|
|
5735
5926
|
throw new Error(
|
|
5736
5927
|
[
|
|
5737
5928
|
`${_error.attributes.details.message}`,
|
|
@@ -5809,7 +6000,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
5809
6000
|
const records = await dato.findRecordsForModel(modelId);
|
|
5810
6001
|
const recordChoices = createRecordChoices(
|
|
5811
6002
|
records,
|
|
5812
|
-
_optionalChain([config, 'access',
|
|
6003
|
+
_optionalChain([config, 'access', _286 => _286.models, 'access', _287 => _287[modelId], 'optionalAccess', _288 => _288.records]) || [],
|
|
5813
6004
|
project
|
|
5814
6005
|
);
|
|
5815
6006
|
const selectedRecords = await promptRecordSelection(
|
|
@@ -5828,14 +6019,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
5828
6019
|
},
|
|
5829
6020
|
async pull(locale, input2, initCtx) {
|
|
5830
6021
|
const result = {};
|
|
5831
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
5832
|
-
let records = _optionalChain([initCtx, 'optionalAccess',
|
|
6022
|
+
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _289 => _289.models]) || {})) {
|
|
6023
|
+
let records = _optionalChain([initCtx, 'optionalAccess', _290 => _290.models, 'access', _291 => _291[modelId], 'access', _292 => _292.records]) || [];
|
|
5833
6024
|
const recordIds = records.map((record) => record.id);
|
|
5834
6025
|
records = await dato.findRecords(recordIds);
|
|
5835
6026
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
5836
6027
|
if (records.length > 0) {
|
|
5837
6028
|
result[modelId] = {
|
|
5838
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
6029
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _293 => _293.models, 'optionalAccess', _294 => _294[modelId], 'optionalAccess', _295 => _295.fields]) || [],
|
|
5839
6030
|
records
|
|
5840
6031
|
};
|
|
5841
6032
|
}
|
|
@@ -5898,7 +6089,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
5898
6089
|
return records.map((record) => ({
|
|
5899
6090
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
5900
6091
|
value: record.id,
|
|
5901
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
6092
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _296 => _296.includes, 'call', _297 => _297(record.id)])
|
|
5902
6093
|
}));
|
|
5903
6094
|
}
|
|
5904
6095
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -6217,7 +6408,7 @@ function createVttLoader() {
|
|
|
6217
6408
|
if (!input2) {
|
|
6218
6409
|
return "";
|
|
6219
6410
|
}
|
|
6220
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
6411
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _298 => _298.parse, 'call', _299 => _299(input2), 'optionalAccess', _300 => _300.cues]);
|
|
6221
6412
|
if (Object.keys(vtt).length === 0) {
|
|
6222
6413
|
return {};
|
|
6223
6414
|
} else {
|
|
@@ -6271,7 +6462,7 @@ function variableExtractLoader(params) {
|
|
|
6271
6462
|
for (let i = 0; i < matches.length; i++) {
|
|
6272
6463
|
const match2 = matches[i];
|
|
6273
6464
|
const currentValue = result[key].value;
|
|
6274
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
6465
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _301 => _301.replace, 'call', _302 => _302(match2, `{variable:${i}}`)]);
|
|
6275
6466
|
result[key].value = newValue;
|
|
6276
6467
|
result[key].variables[i] = match2;
|
|
6277
6468
|
}
|
|
@@ -6286,7 +6477,7 @@ function variableExtractLoader(params) {
|
|
|
6286
6477
|
const variable = valueObj.variables[i];
|
|
6287
6478
|
const currentValue = result[key];
|
|
6288
6479
|
if (typeof currentValue === "string") {
|
|
6289
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
6480
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _303 => _303.replaceAll, 'call', _304 => _304(
|
|
6290
6481
|
`{variable:${i}}`,
|
|
6291
6482
|
variable
|
|
6292
6483
|
)]);
|
|
@@ -6490,7 +6681,7 @@ function createVueJsonLoader() {
|
|
|
6490
6681
|
return createLoader({
|
|
6491
6682
|
pull: async (locale, input2, ctx) => {
|
|
6492
6683
|
const parsed = parseVueFile(input2);
|
|
6493
|
-
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess',
|
|
6684
|
+
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _305 => _305.i18n, 'optionalAccess', _306 => _306[locale]]), () => ( {}));
|
|
6494
6685
|
},
|
|
6495
6686
|
push: async (locale, data, originalInput) => {
|
|
6496
6687
|
const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
|
|
@@ -6675,7 +6866,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
|
|
|
6675
6866
|
objectExpression.properties.forEach((prop) => {
|
|
6676
6867
|
if (!t.isObjectProperty(prop)) return;
|
|
6677
6868
|
const key = getPropertyKey(prop);
|
|
6678
|
-
const incomingVal = _optionalChain([data, 'optionalAccess',
|
|
6869
|
+
const incomingVal = _optionalChain([data, 'optionalAccess', _307 => _307[key]]);
|
|
6679
6870
|
if (incomingVal === void 0) {
|
|
6680
6871
|
return;
|
|
6681
6872
|
}
|
|
@@ -6711,7 +6902,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
|
|
|
6711
6902
|
let modified = false;
|
|
6712
6903
|
arrayExpression.elements.forEach((element, index) => {
|
|
6713
6904
|
if (!element) return;
|
|
6714
|
-
const incomingVal = _optionalChain([incoming, 'optionalAccess',
|
|
6905
|
+
const incomingVal = _optionalChain([incoming, 'optionalAccess', _308 => _308[index]]);
|
|
6715
6906
|
if (incomingVal === void 0) return;
|
|
6716
6907
|
if (t.isStringLiteral(element) && typeof incomingVal === "string") {
|
|
6717
6908
|
if (element.value !== incomingVal) {
|
|
@@ -7205,7 +7396,7 @@ var AST = class _AST {
|
|
|
7205
7396
|
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
7397
|
if (this.isStart() && !this.type)
|
|
7207
7398
|
ret.unshift([]);
|
|
7208
|
-
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
7399
|
+
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _309 => _309.#parent, 'optionalAccess', _310 => _310.type]) === "!")) {
|
|
7209
7400
|
ret.push({});
|
|
7210
7401
|
}
|
|
7211
7402
|
return ret;
|
|
@@ -7213,7 +7404,7 @@ var AST = class _AST {
|
|
|
7213
7404
|
isStart() {
|
|
7214
7405
|
if (this.#root === this)
|
|
7215
7406
|
return true;
|
|
7216
|
-
if (!_optionalChain([this, 'access',
|
|
7407
|
+
if (!_optionalChain([this, 'access', _311 => _311.#parent, 'optionalAccess', _312 => _312.isStart, 'call', _313 => _313()]))
|
|
7217
7408
|
return false;
|
|
7218
7409
|
if (this.#parentIndex === 0)
|
|
7219
7410
|
return true;
|
|
@@ -7229,12 +7420,12 @@ var AST = class _AST {
|
|
|
7229
7420
|
isEnd() {
|
|
7230
7421
|
if (this.#root === this)
|
|
7231
7422
|
return true;
|
|
7232
|
-
if (_optionalChain([this, 'access',
|
|
7423
|
+
if (_optionalChain([this, 'access', _314 => _314.#parent, 'optionalAccess', _315 => _315.type]) === "!")
|
|
7233
7424
|
return true;
|
|
7234
|
-
if (!_optionalChain([this, 'access',
|
|
7425
|
+
if (!_optionalChain([this, 'access', _316 => _316.#parent, 'optionalAccess', _317 => _317.isEnd, 'call', _318 => _318()]))
|
|
7235
7426
|
return false;
|
|
7236
7427
|
if (!this.type)
|
|
7237
|
-
return _optionalChain([this, 'access',
|
|
7428
|
+
return _optionalChain([this, 'access', _319 => _319.#parent, 'optionalAccess', _320 => _320.isEnd, 'call', _321 => _321()]);
|
|
7238
7429
|
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
|
7239
7430
|
return this.#parentIndex === pl - 1;
|
|
7240
7431
|
}
|
|
@@ -7479,7 +7670,7 @@ var AST = class _AST {
|
|
|
7479
7670
|
}
|
|
7480
7671
|
}
|
|
7481
7672
|
let end = "";
|
|
7482
|
-
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
7673
|
+
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _322 => _322.#parent, 'optionalAccess', _323 => _323.type]) === "!") {
|
|
7483
7674
|
end = "(?:$|\\/)";
|
|
7484
7675
|
}
|
|
7485
7676
|
const final2 = start2 + src + end;
|
|
@@ -8580,7 +8771,7 @@ function createMdxSectionsSplit2Loader() {
|
|
|
8580
8771
|
const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
|
|
8581
8772
|
const result = {
|
|
8582
8773
|
frontmatter: data.frontmatter,
|
|
8583
|
-
codePlaceholders: _optionalChain([pullInput, 'optionalAccess',
|
|
8774
|
+
codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _324 => _324.codePlaceholders]) || {},
|
|
8584
8775
|
content
|
|
8585
8776
|
};
|
|
8586
8777
|
return result;
|
|
@@ -8695,14 +8886,14 @@ function parseEjsForTranslation(input2) {
|
|
|
8695
8886
|
if (part.type === "ejs") {
|
|
8696
8887
|
template += part.content;
|
|
8697
8888
|
} else {
|
|
8698
|
-
const
|
|
8889
|
+
const textContent2 = part.content;
|
|
8699
8890
|
const htmlTagRegex = /<[^>]+>/g;
|
|
8700
8891
|
const textParts = [];
|
|
8701
8892
|
let lastTextIndex = 0;
|
|
8702
8893
|
let htmlMatch;
|
|
8703
|
-
while ((htmlMatch = htmlTagRegex.exec(
|
|
8894
|
+
while ((htmlMatch = htmlTagRegex.exec(textContent2)) !== null) {
|
|
8704
8895
|
if (htmlMatch.index > lastTextIndex) {
|
|
8705
|
-
const textBefore =
|
|
8896
|
+
const textBefore = textContent2.slice(lastTextIndex, htmlMatch.index);
|
|
8706
8897
|
if (textBefore.trim()) {
|
|
8707
8898
|
textParts.push({ type: "text", content: textBefore });
|
|
8708
8899
|
} else {
|
|
@@ -8712,8 +8903,8 @@ function parseEjsForTranslation(input2) {
|
|
|
8712
8903
|
textParts.push({ type: "html", content: htmlMatch[0] });
|
|
8713
8904
|
lastTextIndex = htmlMatch.index + htmlMatch[0].length;
|
|
8714
8905
|
}
|
|
8715
|
-
if (lastTextIndex <
|
|
8716
|
-
const remainingText =
|
|
8906
|
+
if (lastTextIndex < textContent2.length) {
|
|
8907
|
+
const remainingText = textContent2.slice(lastTextIndex);
|
|
8717
8908
|
if (remainingText.trim()) {
|
|
8718
8909
|
textParts.push({ type: "text", content: remainingText });
|
|
8719
8910
|
} else {
|
|
@@ -8721,11 +8912,11 @@ function parseEjsForTranslation(input2) {
|
|
|
8721
8912
|
}
|
|
8722
8913
|
}
|
|
8723
8914
|
if (textParts.length === 0) {
|
|
8724
|
-
const trimmedContent =
|
|
8915
|
+
const trimmedContent = textContent2.trim();
|
|
8725
8916
|
if (trimmedContent) {
|
|
8726
|
-
textParts.push({ type: "text", content:
|
|
8917
|
+
textParts.push({ type: "text", content: textContent2 });
|
|
8727
8918
|
} else {
|
|
8728
|
-
textParts.push({ type: "html", content:
|
|
8919
|
+
textParts.push({ type: "html", content: textContent2 });
|
|
8729
8920
|
}
|
|
8730
8921
|
}
|
|
8731
8922
|
for (const textPart of textParts) {
|
|
@@ -9680,7 +9871,7 @@ function createBasicTranslator(model, systemPrompt, settings = {}) {
|
|
|
9680
9871
|
]
|
|
9681
9872
|
});
|
|
9682
9873
|
const result = JSON.parse(response.text);
|
|
9683
|
-
return _optionalChain([result, 'optionalAccess',
|
|
9874
|
+
return _optionalChain([result, 'optionalAccess', _325 => _325.data]) || {};
|
|
9684
9875
|
}
|
|
9685
9876
|
}
|
|
9686
9877
|
function extractPayloadChunks(payload) {
|
|
@@ -9763,7 +9954,7 @@ function getPureModelProvider(provider) {
|
|
|
9763
9954
|
|
|
9764
9955
|
${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
|
|
9765
9956
|
`;
|
|
9766
|
-
switch (_optionalChain([provider, 'optionalAccess',
|
|
9957
|
+
switch (_optionalChain([provider, 'optionalAccess', _326 => _326.id])) {
|
|
9767
9958
|
case "openai": {
|
|
9768
9959
|
if (!process.env.OPENAI_API_KEY) {
|
|
9769
9960
|
throw new Error(
|
|
@@ -9821,7 +10012,7 @@ function getPureModelProvider(provider) {
|
|
|
9821
10012
|
})(provider.model);
|
|
9822
10013
|
}
|
|
9823
10014
|
default: {
|
|
9824
|
-
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess',
|
|
10015
|
+
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _327 => _327.id])));
|
|
9825
10016
|
}
|
|
9826
10017
|
}
|
|
9827
10018
|
}
|
|
@@ -10107,7 +10298,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
10107
10298
|
validateParams(i18nConfig, flags);
|
|
10108
10299
|
ora.succeed("Localization configuration is valid");
|
|
10109
10300
|
ora.start("Connecting to Lingo.dev Localization Engine...");
|
|
10110
|
-
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess',
|
|
10301
|
+
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _328 => _328.provider]);
|
|
10111
10302
|
if (isByokMode) {
|
|
10112
10303
|
authId = null;
|
|
10113
10304
|
ora.succeed("Using external provider (BYOK mode)");
|
|
@@ -10121,16 +10312,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
10121
10312
|
flags
|
|
10122
10313
|
});
|
|
10123
10314
|
let buckets = getBuckets(i18nConfig);
|
|
10124
|
-
if (_optionalChain([flags, 'access',
|
|
10315
|
+
if (_optionalChain([flags, 'access', _329 => _329.bucket, 'optionalAccess', _330 => _330.length])) {
|
|
10125
10316
|
buckets = buckets.filter(
|
|
10126
10317
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
10127
10318
|
);
|
|
10128
10319
|
}
|
|
10129
10320
|
ora.succeed("Buckets retrieved");
|
|
10130
|
-
if (_optionalChain([flags, 'access',
|
|
10321
|
+
if (_optionalChain([flags, 'access', _331 => _331.file, 'optionalAccess', _332 => _332.length])) {
|
|
10131
10322
|
buckets = buckets.map((bucket) => {
|
|
10132
10323
|
const paths = bucket.paths.filter(
|
|
10133
|
-
(path19) => flags.file.find((file) => _optionalChain([path19, 'access',
|
|
10324
|
+
(path19) => flags.file.find((file) => _optionalChain([path19, 'access', _333 => _333.pathPattern, 'optionalAccess', _334 => _334.includes, 'call', _335 => _335(file)]))
|
|
10134
10325
|
);
|
|
10135
10326
|
return { ...bucket, paths };
|
|
10136
10327
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -10151,7 +10342,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
10151
10342
|
});
|
|
10152
10343
|
}
|
|
10153
10344
|
}
|
|
10154
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
10345
|
+
const targetLocales = _optionalChain([flags, 'access', _336 => _336.locale, 'optionalAccess', _337 => _337.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
10155
10346
|
ora.start("Setting up localization cache...");
|
|
10156
10347
|
const checkLockfileProcessor = createDeltaProcessor("");
|
|
10157
10348
|
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
@@ -10436,7 +10627,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
10436
10627
|
}
|
|
10437
10628
|
const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
|
|
10438
10629
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
10439
|
-
if (!_optionalChain([flags, 'access',
|
|
10630
|
+
if (!_optionalChain([flags, 'access', _338 => _338.locale, 'optionalAccess', _339 => _339.length])) {
|
|
10440
10631
|
await deltaProcessor.saveChecksums(checksums);
|
|
10441
10632
|
}
|
|
10442
10633
|
}
|
|
@@ -10560,12 +10751,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
10560
10751
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
10561
10752
|
docUrl: "bucketNotFound"
|
|
10562
10753
|
});
|
|
10563
|
-
} else if (_optionalChain([flags, 'access',
|
|
10754
|
+
} else if (_optionalChain([flags, 'access', _340 => _340.locale, 'optionalAccess', _341 => _341.some, 'call', _342 => _342((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
10564
10755
|
throw new ValidationError({
|
|
10565
10756
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
10566
10757
|
docUrl: "localeTargetNotFound"
|
|
10567
10758
|
});
|
|
10568
|
-
} else if (_optionalChain([flags, 'access',
|
|
10759
|
+
} else if (_optionalChain([flags, 'access', _343 => _343.bucket, 'optionalAccess', _344 => _344.some, 'call', _345 => _345(
|
|
10569
10760
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
10570
10761
|
)])) {
|
|
10571
10762
|
throw new ValidationError({
|
|
@@ -11099,7 +11290,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
|
|
|
11099
11290
|
const response = await engine.whoami();
|
|
11100
11291
|
return {
|
|
11101
11292
|
authenticated: !!response,
|
|
11102
|
-
username: _optionalChain([response, 'optionalAccess',
|
|
11293
|
+
username: _optionalChain([response, 'optionalAccess', _346 => _346.email])
|
|
11103
11294
|
};
|
|
11104
11295
|
} catch (error) {
|
|
11105
11296
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -11215,7 +11406,7 @@ function createExplicitLocalizer(provider) {
|
|
|
11215
11406
|
}
|
|
11216
11407
|
function createAiSdkLocalizer(params) {
|
|
11217
11408
|
const skipAuth = params.skipAuth === true;
|
|
11218
|
-
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
11409
|
+
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _347 => _347.apiKeyName]), () => ( ""))];
|
|
11219
11410
|
if (!skipAuth && !apiKey || !params.apiKeyName) {
|
|
11220
11411
|
throw new Error(
|
|
11221
11412
|
_dedent2.default`
|
|
@@ -11349,8 +11540,8 @@ async function setup(input2) {
|
|
|
11349
11540
|
throw new Error(
|
|
11350
11541
|
"No buckets found in i18n.json. Please add at least one bucket containing i18n content."
|
|
11351
11542
|
);
|
|
11352
|
-
} else if (_optionalChain([ctx, 'access',
|
|
11353
|
-
(bucket) => !_optionalChain([ctx, 'access',
|
|
11543
|
+
} else if (_optionalChain([ctx, 'access', _348 => _348.flags, 'access', _349 => _349.bucket, 'optionalAccess', _350 => _350.some, 'call', _351 => _351(
|
|
11544
|
+
(bucket) => !_optionalChain([ctx, 'access', _352 => _352.config, 'optionalAccess', _353 => _353.buckets, 'access', _354 => _354[bucket]])
|
|
11354
11545
|
)])) {
|
|
11355
11546
|
throw new Error(
|
|
11356
11547
|
`One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
|
|
@@ -11363,7 +11554,7 @@ async function setup(input2) {
|
|
|
11363
11554
|
title: "Selecting localization provider",
|
|
11364
11555
|
task: async (ctx, task) => {
|
|
11365
11556
|
ctx.localizer = createLocalizer(
|
|
11366
|
-
_optionalChain([ctx, 'access',
|
|
11557
|
+
_optionalChain([ctx, 'access', _355 => _355.config, 'optionalAccess', _356 => _356.provider]),
|
|
11367
11558
|
ctx.flags.apiKey
|
|
11368
11559
|
);
|
|
11369
11560
|
if (!ctx.localizer) {
|
|
@@ -11376,7 +11567,7 @@ async function setup(input2) {
|
|
|
11376
11567
|
},
|
|
11377
11568
|
{
|
|
11378
11569
|
title: "Checking authentication",
|
|
11379
|
-
enabled: (ctx) => _optionalChain([ctx, 'access',
|
|
11570
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _357 => _357.localizer, 'optionalAccess', _358 => _358.id]) === "Lingo.dev",
|
|
11380
11571
|
task: async (ctx, task) => {
|
|
11381
11572
|
const authStatus = await ctx.localizer.checkAuth();
|
|
11382
11573
|
if (!authStatus.authenticated) {
|
|
@@ -11389,7 +11580,7 @@ async function setup(input2) {
|
|
|
11389
11580
|
},
|
|
11390
11581
|
{
|
|
11391
11582
|
title: "Validating configuration",
|
|
11392
|
-
enabled: (ctx) => _optionalChain([ctx, 'access',
|
|
11583
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _359 => _359.localizer, 'optionalAccess', _360 => _360.id]) !== "Lingo.dev",
|
|
11393
11584
|
task: async (ctx, task) => {
|
|
11394
11585
|
const validationStatus = await ctx.localizer.validateSettings();
|
|
11395
11586
|
if (!validationStatus.valid) {
|
|
@@ -11720,7 +11911,7 @@ function createWorkerTask(args) {
|
|
|
11720
11911
|
const processableData = _lodash2.default.chain(sourceData).entries().filter(
|
|
11721
11912
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
|
|
11722
11913
|
).filter(
|
|
11723
|
-
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access',
|
|
11914
|
+
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _361 => _361.onlyKeys, 'optionalAccess', _362 => _362.some, 'call', _363 => _363(
|
|
11724
11915
|
(pattern) => minimatch(key, pattern)
|
|
11725
11916
|
)])
|
|
11726
11917
|
).fromPairs().value();
|
|
@@ -11788,7 +11979,7 @@ function createWorkerTask(args) {
|
|
|
11788
11979
|
finalRenamedTargetData
|
|
11789
11980
|
);
|
|
11790
11981
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
11791
|
-
if (!_optionalChain([args, 'access',
|
|
11982
|
+
if (!_optionalChain([args, 'access', _364 => _364.ctx, 'access', _365 => _365.flags, 'access', _366 => _366.targetLocale, 'optionalAccess', _367 => _367.length])) {
|
|
11792
11983
|
await deltaProcessor.saveChecksums(checksums);
|
|
11793
11984
|
}
|
|
11794
11985
|
});
|
|
@@ -11993,10 +12184,10 @@ var flagsSchema2 = _zod.z.object({
|
|
|
11993
12184
|
async function frozen(input2) {
|
|
11994
12185
|
console.log(_chalk2.default.hex(colors.orange)("[Frozen]"));
|
|
11995
12186
|
let buckets = getBuckets(input2.config);
|
|
11996
|
-
if (_optionalChain([input2, 'access',
|
|
12187
|
+
if (_optionalChain([input2, 'access', _368 => _368.flags, 'access', _369 => _369.bucket, 'optionalAccess', _370 => _370.length])) {
|
|
11997
12188
|
buckets = buckets.filter((b) => input2.flags.bucket.includes(b.type));
|
|
11998
12189
|
}
|
|
11999
|
-
if (_optionalChain([input2, 'access',
|
|
12190
|
+
if (_optionalChain([input2, 'access', _371 => _371.flags, 'access', _372 => _372.file, 'optionalAccess', _373 => _373.length])) {
|
|
12000
12191
|
buckets = buckets.map((bucket) => {
|
|
12001
12192
|
const paths = bucket.paths.filter(
|
|
12002
12193
|
(p) => input2.flags.file.some(
|
|
@@ -12133,13 +12324,13 @@ async function frozen(input2) {
|
|
|
12133
12324
|
|
|
12134
12325
|
// src/cli/cmd/run/_utils.ts
|
|
12135
12326
|
async function determineAuthId(ctx) {
|
|
12136
|
-
const isByokMode = !!_optionalChain([ctx, 'access',
|
|
12327
|
+
const isByokMode = !!_optionalChain([ctx, 'access', _374 => _374.config, 'optionalAccess', _375 => _375.provider]);
|
|
12137
12328
|
if (isByokMode) {
|
|
12138
12329
|
return null;
|
|
12139
12330
|
} else {
|
|
12140
12331
|
try {
|
|
12141
|
-
const authStatus = await _optionalChain([ctx, 'access',
|
|
12142
|
-
return _optionalChain([authStatus, 'optionalAccess',
|
|
12332
|
+
const authStatus = await _optionalChain([ctx, 'access', _376 => _376.localizer, 'optionalAccess', _377 => _377.checkAuth, 'call', _378 => _378()]);
|
|
12333
|
+
return _optionalChain([authStatus, 'optionalAccess', _379 => _379.username]) || null;
|
|
12143
12334
|
} catch (e3) {
|
|
12144
12335
|
return null;
|
|
12145
12336
|
}
|
|
@@ -12337,7 +12528,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
12337
12528
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
12338
12529
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
12339
12530
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
12340
|
-
_optionalChain([this, 'access',
|
|
12531
|
+
_optionalChain([this, 'access', _380 => _380.platformKit, 'optionalAccess', _381 => _381.gitConfig, 'call', _382 => _382()]);
|
|
12341
12532
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
12342
12533
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
12343
12534
|
if (!processOwnCommits) {
|
|
@@ -12369,7 +12560,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
12369
12560
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
12370
12561
|
var PullRequestFlow = class extends InBranchFlow {
|
|
12371
12562
|
async preRun() {
|
|
12372
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
12563
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _383 => _383()]);
|
|
12373
12564
|
if (!canContinue) {
|
|
12374
12565
|
return false;
|
|
12375
12566
|
}
|
|
@@ -12636,10 +12827,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
12636
12827
|
repo_slug: this.platformConfig.repositoryName,
|
|
12637
12828
|
state: "OPEN"
|
|
12638
12829
|
}).then(({ data: { values } }) => {
|
|
12639
|
-
return _optionalChain([values, 'optionalAccess',
|
|
12640
|
-
({ source, destination }) => _optionalChain([source, 'optionalAccess',
|
|
12830
|
+
return _optionalChain([values, 'optionalAccess', _384 => _384.find, 'call', _385 => _385(
|
|
12831
|
+
({ source, destination }) => _optionalChain([source, 'optionalAccess', _386 => _386.branch, 'optionalAccess', _387 => _387.name]) === branch && _optionalChain([destination, 'optionalAccess', _388 => _388.branch, 'optionalAccess', _389 => _389.name]) === this.platformConfig.baseBranchName
|
|
12641
12832
|
)]);
|
|
12642
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
12833
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _390 => _390.id]));
|
|
12643
12834
|
}
|
|
12644
12835
|
async closePullRequest({ pullRequestNumber }) {
|
|
12645
12836
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -12735,7 +12926,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
12735
12926
|
repo: this.platformConfig.repositoryName,
|
|
12736
12927
|
base: this.platformConfig.baseBranchName,
|
|
12737
12928
|
state: "open"
|
|
12738
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
12929
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _391 => _391.number]));
|
|
12739
12930
|
}
|
|
12740
12931
|
async closePullRequest({ pullRequestNumber }) {
|
|
12741
12932
|
await this.octokit.rest.pulls.update({
|
|
@@ -12862,7 +13053,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
12862
13053
|
sourceBranch: branch,
|
|
12863
13054
|
state: "opened"
|
|
12864
13055
|
});
|
|
12865
|
-
return _optionalChain([mergeRequests, 'access',
|
|
13056
|
+
return _optionalChain([mergeRequests, 'access', _392 => _392[0], 'optionalAccess', _393 => _393.iid]);
|
|
12866
13057
|
}
|
|
12867
13058
|
async closePullRequest({
|
|
12868
13059
|
pullRequestNumber
|
|
@@ -12974,7 +13165,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
12974
13165
|
}
|
|
12975
13166
|
const env = {
|
|
12976
13167
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
12977
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
13168
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _394 => _394.pullRequest, 'optionalAccess', _395 => _395.toString, 'call', _396 => _396()]) || "false",
|
|
12978
13169
|
...options.commitMessage && {
|
|
12979
13170
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
12980
13171
|
},
|
|
@@ -13000,7 +13191,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
13000
13191
|
const { isPullRequestMode } = platformKit.config;
|
|
13001
13192
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
13002
13193
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
13003
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
13194
|
+
const canRun = await _optionalChain([flow, 'access', _397 => _397.preRun, 'optionalCall', _398 => _398()]);
|
|
13004
13195
|
if (canRun === false) {
|
|
13005
13196
|
return;
|
|
13006
13197
|
}
|
|
@@ -13010,7 +13201,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
13010
13201
|
if (!hasChanges) {
|
|
13011
13202
|
return;
|
|
13012
13203
|
}
|
|
13013
|
-
await _optionalChain([flow, 'access',
|
|
13204
|
+
await _optionalChain([flow, 'access', _399 => _399.postRun, 'optionalCall', _400 => _400()]);
|
|
13014
13205
|
});
|
|
13015
13206
|
function parseBooleanArg(val) {
|
|
13016
13207
|
if (val === true) return true;
|
|
@@ -13047,8 +13238,8 @@ function exitGracefully(elapsedMs = 0) {
|
|
|
13047
13238
|
}
|
|
13048
13239
|
}
|
|
13049
13240
|
function checkForPendingOperations() {
|
|
13050
|
-
const activeHandles = _optionalChain([process, 'access',
|
|
13051
|
-
const activeRequests = _optionalChain([process, 'access',
|
|
13241
|
+
const activeHandles = _optionalChain([process, 'access', _401 => _401._getActiveHandles, 'optionalCall', _402 => _402()]) || [];
|
|
13242
|
+
const activeRequests = _optionalChain([process, 'access', _403 => _403._getActiveRequests, 'optionalCall', _404 => _404()]) || [];
|
|
13052
13243
|
const nonStandardHandles = activeHandles.filter((handle) => {
|
|
13053
13244
|
if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
|
|
13054
13245
|
return false;
|
|
@@ -13117,17 +13308,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
13117
13308
|
flags
|
|
13118
13309
|
});
|
|
13119
13310
|
let buckets = getBuckets(i18nConfig);
|
|
13120
|
-
if (_optionalChain([flags, 'access',
|
|
13311
|
+
if (_optionalChain([flags, 'access', _405 => _405.bucket, 'optionalAccess', _406 => _406.length])) {
|
|
13121
13312
|
buckets = buckets.filter(
|
|
13122
13313
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
13123
13314
|
);
|
|
13124
13315
|
}
|
|
13125
13316
|
ora.succeed("Buckets retrieved");
|
|
13126
|
-
if (_optionalChain([flags, 'access',
|
|
13317
|
+
if (_optionalChain([flags, 'access', _407 => _407.file, 'optionalAccess', _408 => _408.length])) {
|
|
13127
13318
|
buckets = buckets.map((bucket) => {
|
|
13128
13319
|
const paths = bucket.paths.filter(
|
|
13129
13320
|
(path19) => flags.file.find(
|
|
13130
|
-
(file) => _optionalChain([path19, 'access',
|
|
13321
|
+
(file) => _optionalChain([path19, 'access', _409 => _409.pathPattern, 'optionalAccess', _410 => _410.includes, 'call', _411 => _411(file)]) || _optionalChain([path19, 'access', _412 => _412.pathPattern, 'optionalAccess', _413 => _413.match, 'call', _414 => _414(file)]) || minimatch(path19.pathPattern, file)
|
|
13131
13322
|
)
|
|
13132
13323
|
);
|
|
13133
13324
|
return { ...bucket, paths };
|
|
@@ -13147,7 +13338,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
13147
13338
|
});
|
|
13148
13339
|
}
|
|
13149
13340
|
}
|
|
13150
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
13341
|
+
const targetLocales = _optionalChain([flags, 'access', _415 => _415.locale, 'optionalAccess', _416 => _416.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
13151
13342
|
let totalSourceKeyCount = 0;
|
|
13152
13343
|
let uniqueKeysToTranslate = 0;
|
|
13153
13344
|
let totalExistingTranslations = 0;
|
|
@@ -13555,12 +13746,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
13555
13746
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
13556
13747
|
docUrl: "bucketNotFound"
|
|
13557
13748
|
});
|
|
13558
|
-
} else if (_optionalChain([flags, 'access',
|
|
13749
|
+
} else if (_optionalChain([flags, 'access', _417 => _417.locale, 'optionalAccess', _418 => _418.some, 'call', _419 => _419((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
13559
13750
|
throw new CLIError({
|
|
13560
13751
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
13561
13752
|
docUrl: "localeTargetNotFound"
|
|
13562
13753
|
});
|
|
13563
|
-
} else if (_optionalChain([flags, 'access',
|
|
13754
|
+
} else if (_optionalChain([flags, 'access', _420 => _420.bucket, 'optionalAccess', _421 => _421.some, 'call', _422 => _422(
|
|
13564
13755
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
13565
13756
|
)])) {
|
|
13566
13757
|
throw new CLIError({
|
|
@@ -13652,7 +13843,7 @@ async function renderHero2() {
|
|
|
13652
13843
|
// package.json
|
|
13653
13844
|
var package_default = {
|
|
13654
13845
|
name: "lingo.dev",
|
|
13655
|
-
version: "0.117.
|
|
13846
|
+
version: "0.117.5",
|
|
13656
13847
|
description: "Lingo.dev CLI",
|
|
13657
13848
|
private: false,
|
|
13658
13849
|
publishConfig: {
|
|
@@ -13810,6 +14001,9 @@ var package_default = {
|
|
|
13810
14001
|
"date-fns": "4.1.0",
|
|
13811
14002
|
dedent: "1.7.0",
|
|
13812
14003
|
diff: "7.0.0",
|
|
14004
|
+
"dom-serializer": "2.0.0",
|
|
14005
|
+
domhandler: "5.0.3",
|
|
14006
|
+
domutils: "3.2.2",
|
|
13813
14007
|
dotenv: "16.4.7",
|
|
13814
14008
|
ejs: "3.1.10",
|
|
13815
14009
|
express: "5.1.0",
|
|
@@ -13820,6 +14014,7 @@ var package_default = {
|
|
|
13820
14014
|
glob: "11.1.0",
|
|
13821
14015
|
"gradient-string": "3.0.0",
|
|
13822
14016
|
"gray-matter": "4.0.3",
|
|
14017
|
+
htmlparser2: "10.0.0",
|
|
13823
14018
|
ini: "5.0.0",
|
|
13824
14019
|
ink: "4.2.0",
|
|
13825
14020
|
"ink-progress-bar": "3.0.0",
|
|
@@ -13944,7 +14139,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
|
|
|
13944
14139
|
if (options.file && options.file.length) {
|
|
13945
14140
|
buckets = buckets.map((bucket) => {
|
|
13946
14141
|
const paths = bucket.paths.filter(
|
|
13947
|
-
(bucketPath) => _optionalChain([options, 'access',
|
|
14142
|
+
(bucketPath) => _optionalChain([options, 'access', _423 => _423.file, 'optionalAccess', _424 => _424.some, 'call', _425 => _425((f) => bucketPath.pathPattern.includes(f))])
|
|
13948
14143
|
);
|
|
13949
14144
|
return { ...bucket, paths };
|
|
13950
14145
|
}).filter((bucket) => bucket.paths.length > 0);
|