lingo.dev 0.114.0 → 0.114.1
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 +160 -122
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +43 -5
- package/build/cli.mjs.map +1 -1
- package/package.json +4 -4
package/build/cli.cjs
CHANGED
|
@@ -2363,7 +2363,7 @@ async function parseAndroidDocument(input2) {
|
|
|
2363
2363
|
function buildPullResult(document) {
|
|
2364
2364
|
const result = {};
|
|
2365
2365
|
for (const resource of document.resourceNodes) {
|
|
2366
|
-
if (!resource
|
|
2366
|
+
if (!isTranslatable(resource)) {
|
|
2367
2367
|
continue;
|
|
2368
2368
|
}
|
|
2369
2369
|
switch (resource.type) {
|
|
@@ -2406,6 +2406,9 @@ function buildPullResult(document) {
|
|
|
2406
2406
|
}
|
|
2407
2407
|
return result;
|
|
2408
2408
|
}
|
|
2409
|
+
function isTranslatable(resource) {
|
|
2410
|
+
return resource.translatable;
|
|
2411
|
+
}
|
|
2409
2412
|
function buildTranslatedDocument(payload, existingDocument, sourceDocument) {
|
|
2410
2413
|
const templateDocument = sourceDocument;
|
|
2411
2414
|
const finalDocument = cloneDocumentStructure(templateDocument);
|
|
@@ -2434,6 +2437,9 @@ function buildTranslatedDocument(payload, existingDocument, sourceDocument) {
|
|
|
2434
2437
|
if (finalMap.has(resource.name)) {
|
|
2435
2438
|
continue;
|
|
2436
2439
|
}
|
|
2440
|
+
if (!isTranslatable(resource)) {
|
|
2441
|
+
continue;
|
|
2442
|
+
}
|
|
2437
2443
|
const cloned = cloneResourceNode(resource);
|
|
2438
2444
|
appendResourceNode(finalDocument, cloned);
|
|
2439
2445
|
finalMap.set(cloned.name, cloned);
|
|
@@ -2550,7 +2556,7 @@ function appendResourceNode(document, resourceNode) {
|
|
|
2550
2556
|
document.resourceNodes.push(resourceNode);
|
|
2551
2557
|
}
|
|
2552
2558
|
function setTextualNodeContent(node, value, useCdata) {
|
|
2553
|
-
const escapedValue = useCdata ? value : escapeAndroidString(value);
|
|
2559
|
+
const escapedValue = useCdata ? escapeApostrophesOnly(value) : escapeAndroidString(value);
|
|
2554
2560
|
node._ = escapedValue;
|
|
2555
2561
|
node.$$ = _nullishCoalesce(node.$$, () => ( []));
|
|
2556
2562
|
let textNode = node.$$.find(
|
|
@@ -2561,7 +2567,7 @@ function setTextualNodeContent(node, value, useCdata) {
|
|
|
2561
2567
|
node.$$.push(textNode);
|
|
2562
2568
|
}
|
|
2563
2569
|
textNode["#name"] = useCdata ? "__cdata" : "__text__";
|
|
2564
|
-
textNode._ =
|
|
2570
|
+
textNode._ = escapedValue;
|
|
2565
2571
|
}
|
|
2566
2572
|
function buildResourceNameMap(document) {
|
|
2567
2573
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -2721,6 +2727,9 @@ function asInteger(value, name) {
|
|
|
2721
2727
|
function escapeAndroidString(value) {
|
|
2722
2728
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/(?<!\\)'/g, "\\'");
|
|
2723
2729
|
}
|
|
2730
|
+
function escapeApostrophesOnly(value) {
|
|
2731
|
+
return value.replace(/(?<!\\)'/g, "\\'");
|
|
2732
|
+
}
|
|
2724
2733
|
function segmentsToString(segments) {
|
|
2725
2734
|
return segments.map((segment) => segment.value).join("");
|
|
2726
2735
|
}
|
|
@@ -2851,13 +2860,42 @@ function createResourceNodeFromValue(name, value) {
|
|
|
2851
2860
|
}
|
|
2852
2861
|
}
|
|
2853
2862
|
function cloneDocumentStructure(document) {
|
|
2863
|
+
const translatableResources = document.resourceNodes.filter(isTranslatable);
|
|
2854
2864
|
const resourcesClone = deepClone(document.resources);
|
|
2855
2865
|
const lookup = buildResourceLookup(resourcesClone);
|
|
2856
2866
|
const resourceNodes = [];
|
|
2857
|
-
for (const resource of
|
|
2867
|
+
for (const resource of translatableResources) {
|
|
2858
2868
|
const cloned = cloneResourceNodeFromLookup(resource, lookup);
|
|
2859
2869
|
resourceNodes.push(cloned);
|
|
2860
2870
|
}
|
|
2871
|
+
if (resourcesClone.$$ && Array.isArray(resourcesClone.$$)) {
|
|
2872
|
+
const includedKeys = new Set(
|
|
2873
|
+
resourceNodes.map((r) => resourceLookupKey(r.type, r.name))
|
|
2874
|
+
);
|
|
2875
|
+
let filtered = resourcesClone.$$.filter((child) => {
|
|
2876
|
+
const elementName = _optionalChain([child, 'optionalAccess', _128 => _128["#name"]]);
|
|
2877
|
+
const name = _optionalChain([child, 'optionalAccess', _129 => _129.$, 'optionalAccess', _130 => _130.name]);
|
|
2878
|
+
if (!isResourceElementName(elementName) || !name) {
|
|
2879
|
+
return true;
|
|
2880
|
+
}
|
|
2881
|
+
return includedKeys.has(resourceLookupKey(elementName, name));
|
|
2882
|
+
});
|
|
2883
|
+
const cleaned = [];
|
|
2884
|
+
let lastWasWhitespace = false;
|
|
2885
|
+
for (const child of filtered) {
|
|
2886
|
+
const isWhitespace = _optionalChain([child, 'optionalAccess', _131 => _131["#name"]]) === "__text__" && (!child._ || child._.trim() === "");
|
|
2887
|
+
if (isWhitespace) {
|
|
2888
|
+
if (!lastWasWhitespace) {
|
|
2889
|
+
cleaned.push(child);
|
|
2890
|
+
lastWasWhitespace = true;
|
|
2891
|
+
}
|
|
2892
|
+
} else {
|
|
2893
|
+
cleaned.push(child);
|
|
2894
|
+
lastWasWhitespace = false;
|
|
2895
|
+
}
|
|
2896
|
+
}
|
|
2897
|
+
resourcesClone.$$ = cleaned;
|
|
2898
|
+
}
|
|
2861
2899
|
return {
|
|
2862
2900
|
resources: resourcesClone,
|
|
2863
2901
|
resourceNodes
|
|
@@ -2867,8 +2905,8 @@ function buildResourceLookup(resources) {
|
|
|
2867
2905
|
const lookup = /* @__PURE__ */ new Map();
|
|
2868
2906
|
const children = Array.isArray(resources.$$) ? resources.$$ : [];
|
|
2869
2907
|
for (const child of children) {
|
|
2870
|
-
const type = _optionalChain([child, 'optionalAccess',
|
|
2871
|
-
const name = _optionalChain([child, 'optionalAccess',
|
|
2908
|
+
const type = _optionalChain([child, 'optionalAccess', _132 => _132["#name"]]);
|
|
2909
|
+
const name = _optionalChain([child, 'optionalAccess', _133 => _133.$, 'optionalAccess', _134 => _134.name]);
|
|
2872
2910
|
if (!type || !name || !isResourceElementName(type)) {
|
|
2873
2911
|
continue;
|
|
2874
2912
|
}
|
|
@@ -2897,7 +2935,7 @@ function cloneResourceNodeFromLookup(resource, lookup) {
|
|
|
2897
2935
|
}
|
|
2898
2936
|
case "string-array": {
|
|
2899
2937
|
const childItems = (Array.isArray(node.$$) ? node.$$ : []).filter(
|
|
2900
|
-
(child) => _optionalChain([child, 'optionalAccess',
|
|
2938
|
+
(child) => _optionalChain([child, 'optionalAccess', _135 => _135["#name"]]) === "item"
|
|
2901
2939
|
);
|
|
2902
2940
|
node.item = childItems;
|
|
2903
2941
|
if (childItems.length < resource.items.length) {
|
|
@@ -2926,12 +2964,12 @@ function cloneResourceNodeFromLookup(resource, lookup) {
|
|
|
2926
2964
|
}
|
|
2927
2965
|
case "plurals": {
|
|
2928
2966
|
const childItems = (Array.isArray(node.$$) ? node.$$ : []).filter(
|
|
2929
|
-
(child) => _optionalChain([child, 'optionalAccess',
|
|
2967
|
+
(child) => _optionalChain([child, 'optionalAccess', _136 => _136["#name"]]) === "item"
|
|
2930
2968
|
);
|
|
2931
2969
|
node.item = childItems;
|
|
2932
2970
|
const itemMap = /* @__PURE__ */ new Map();
|
|
2933
2971
|
for (const item of childItems) {
|
|
2934
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
2972
|
+
if (_optionalChain([item, 'optionalAccess', _137 => _137.$, 'optionalAccess', _138 => _138.quantity])) {
|
|
2935
2973
|
itemMap.set(item.$.quantity, item);
|
|
2936
2974
|
}
|
|
2937
2975
|
}
|
|
@@ -3221,7 +3259,7 @@ var _sync3 = require('csv-stringify/sync');
|
|
|
3221
3259
|
|
|
3222
3260
|
function detectKeyColumnName(csvString) {
|
|
3223
3261
|
const row = _sync.parse.call(void 0, csvString)[0];
|
|
3224
|
-
const firstColumn = _optionalChain([row, 'optionalAccess',
|
|
3262
|
+
const firstColumn = _optionalChain([row, 'optionalAccess', _139 => _139[0], 'optionalAccess', _140 => _140.trim, 'call', _141 => _141()]);
|
|
3225
3263
|
return firstColumn || "KEY";
|
|
3226
3264
|
}
|
|
3227
3265
|
function createCsvLoader() {
|
|
@@ -3323,7 +3361,7 @@ function createHtmlLoader() {
|
|
|
3323
3361
|
break;
|
|
3324
3362
|
}
|
|
3325
3363
|
const siblings = Array.from(parent.childNodes).filter(
|
|
3326
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
3364
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _142 => _142.textContent, 'optionalAccess', _143 => _143.trim, 'call', _144 => _144()])
|
|
3327
3365
|
);
|
|
3328
3366
|
const index = siblings.indexOf(current);
|
|
3329
3367
|
if (index !== -1) {
|
|
@@ -3359,15 +3397,15 @@ function createHtmlLoader() {
|
|
|
3359
3397
|
}
|
|
3360
3398
|
});
|
|
3361
3399
|
Array.from(element.childNodes).filter(
|
|
3362
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
3400
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _145 => _145.textContent, 'optionalAccess', _146 => _146.trim, 'call', _147 => _147()])
|
|
3363
3401
|
).forEach(processNode);
|
|
3364
3402
|
}
|
|
3365
3403
|
};
|
|
3366
3404
|
Array.from(document.head.childNodes).filter(
|
|
3367
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
3405
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _148 => _148.textContent, 'optionalAccess', _149 => _149.trim, 'call', _150 => _150()])
|
|
3368
3406
|
).forEach(processNode);
|
|
3369
3407
|
Array.from(document.body.childNodes).filter(
|
|
3370
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
3408
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _151 => _151.textContent, 'optionalAccess', _152 => _152.trim, 'call', _153 => _153()])
|
|
3371
3409
|
).forEach(processNode);
|
|
3372
3410
|
return result;
|
|
3373
3411
|
},
|
|
@@ -3392,7 +3430,7 @@ function createHtmlLoader() {
|
|
|
3392
3430
|
for (let i = 0; i < indices.length; i++) {
|
|
3393
3431
|
const index = parseInt(indices[i]);
|
|
3394
3432
|
const siblings = Array.from(parent.childNodes).filter(
|
|
3395
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
3433
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _154 => _154.textContent, 'optionalAccess', _155 => _155.trim, 'call', _156 => _156()])
|
|
3396
3434
|
);
|
|
3397
3435
|
if (index >= siblings.length) {
|
|
3398
3436
|
if (i === indices.length - 1) {
|
|
@@ -3443,7 +3481,7 @@ function createMarkdownLoader() {
|
|
|
3443
3481
|
yaml: yamlEngine
|
|
3444
3482
|
}
|
|
3445
3483
|
});
|
|
3446
|
-
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess',
|
|
3484
|
+
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _157 => _157.trim, 'call', _158 => _158()]), () => ( ""))).filter(Boolean);
|
|
3447
3485
|
return {
|
|
3448
3486
|
...Object.fromEntries(
|
|
3449
3487
|
sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
|
|
@@ -3462,7 +3500,7 @@ function createMarkdownLoader() {
|
|
|
3462
3500
|
);
|
|
3463
3501
|
let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(
|
|
3464
3502
|
([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())
|
|
3465
|
-
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess',
|
|
3503
|
+
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _159 => _159.trim, 'call', _160 => _160()]), () => ( ""))).filter(Boolean).join("\n\n");
|
|
3466
3504
|
if (Object.keys(frontmatter).length > 0) {
|
|
3467
3505
|
content = `
|
|
3468
3506
|
${content}`;
|
|
@@ -3487,7 +3525,7 @@ function createMarkdocLoader() {
|
|
|
3487
3525
|
const result = {};
|
|
3488
3526
|
const counters = {};
|
|
3489
3527
|
traverseAndExtract(ast, "", result, counters);
|
|
3490
|
-
if (_optionalChain([ast, 'access',
|
|
3528
|
+
if (_optionalChain([ast, 'access', _161 => _161.attributes, 'optionalAccess', _162 => _162.frontmatter])) {
|
|
3491
3529
|
const frontmatter = _yaml2.default.parse(ast.attributes.frontmatter);
|
|
3492
3530
|
Object.entries(frontmatter).forEach(([key, value]) => {
|
|
3493
3531
|
if (typeof value === "string") {
|
|
@@ -3533,7 +3571,7 @@ function traverseAndExtract(node, path19, result, counters, parentType) {
|
|
|
3533
3571
|
if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
|
|
3534
3572
|
semanticType = nodeSemanticType;
|
|
3535
3573
|
}
|
|
3536
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
3574
|
+
if (node.type === "text" && _optionalChain([node, 'access', _163 => _163.attributes, 'optionalAccess', _164 => _164.content])) {
|
|
3537
3575
|
const content = node.attributes.content;
|
|
3538
3576
|
if (typeof content === "string" && content.trim()) {
|
|
3539
3577
|
if (semanticType) {
|
|
@@ -3560,7 +3598,7 @@ function buildPathMap(node, path19, counters, pathMap, parentType) {
|
|
|
3560
3598
|
if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
|
|
3561
3599
|
semanticType = nodeSemanticType;
|
|
3562
3600
|
}
|
|
3563
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
3601
|
+
if (node.type === "text" && _optionalChain([node, 'access', _165 => _165.attributes, 'optionalAccess', _166 => _166.content])) {
|
|
3564
3602
|
const content = node.attributes.content;
|
|
3565
3603
|
if (typeof content === "string" && content.trim()) {
|
|
3566
3604
|
if (semanticType) {
|
|
@@ -3583,7 +3621,7 @@ function applyTranslations(node, path19, data, pathMap) {
|
|
|
3583
3621
|
if (!node || typeof node !== "object") {
|
|
3584
3622
|
return;
|
|
3585
3623
|
}
|
|
3586
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
3624
|
+
if (node.type === "text" && _optionalChain([node, 'access', _167 => _167.attributes, 'optionalAccess', _168 => _168.content])) {
|
|
3587
3625
|
const content = node.attributes.content;
|
|
3588
3626
|
if (typeof content === "string") {
|
|
3589
3627
|
const contentPath = path19 ? `${path19}/attributes/content` : "attributes/content";
|
|
@@ -3633,7 +3671,7 @@ function isSkippableLine(line) {
|
|
|
3633
3671
|
function parsePropertyLine(line) {
|
|
3634
3672
|
const [key, ...valueParts] = line.split("=");
|
|
3635
3673
|
return {
|
|
3636
|
-
key: _optionalChain([key, 'optionalAccess',
|
|
3674
|
+
key: _optionalChain([key, 'optionalAccess', _169 => _169.trim, 'call', _170 => _170()]) || "",
|
|
3637
3675
|
value: valueParts.join("=").trim()
|
|
3638
3676
|
};
|
|
3639
3677
|
}
|
|
@@ -3925,7 +3963,7 @@ var Parser = class {
|
|
|
3925
3963
|
}
|
|
3926
3964
|
}
|
|
3927
3965
|
expect(type) {
|
|
3928
|
-
if (_optionalChain([this, 'access',
|
|
3966
|
+
if (_optionalChain([this, 'access', _171 => _171.current, 'call', _172 => _172(), 'optionalAccess', _173 => _173.type]) === type) {
|
|
3929
3967
|
this.advance();
|
|
3930
3968
|
return true;
|
|
3931
3969
|
}
|
|
@@ -4002,7 +4040,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4002
4040
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
4003
4041
|
continue;
|
|
4004
4042
|
}
|
|
4005
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
4043
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _174 => _174.localizations, 'optionalAccess', _175 => _175[locale]]);
|
|
4006
4044
|
if (langTranslationEntity) {
|
|
4007
4045
|
if ("stringUnit" in langTranslationEntity) {
|
|
4008
4046
|
resultData[translationKey] = langTranslationEntity.stringUnit.value;
|
|
@@ -4011,7 +4049,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4011
4049
|
resultData[translationKey] = {};
|
|
4012
4050
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
4013
4051
|
for (const form in pluralForms) {
|
|
4014
|
-
if (_optionalChain([pluralForms, 'access',
|
|
4052
|
+
if (_optionalChain([pluralForms, 'access', _176 => _176[form], 'optionalAccess', _177 => _177.stringUnit, 'optionalAccess', _178 => _178.value])) {
|
|
4015
4053
|
resultData[translationKey][form] = pluralForms[form].stringUnit.value;
|
|
4016
4054
|
}
|
|
4017
4055
|
}
|
|
@@ -4037,7 +4075,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4037
4075
|
const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
|
|
4038
4076
|
if (typeof value === "string") {
|
|
4039
4077
|
langDataToMerge.strings[key] = {
|
|
4040
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
4078
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _179 => _179.strings, 'optionalAccess', _180 => _180[key], 'optionalAccess', _181 => _181.extractionState]),
|
|
4041
4079
|
localizations: {
|
|
4042
4080
|
[locale]: {
|
|
4043
4081
|
stringUnit: {
|
|
@@ -4095,7 +4133,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4095
4133
|
for (const [locale, localization] of Object.entries(
|
|
4096
4134
|
entity.localizations
|
|
4097
4135
|
)) {
|
|
4098
|
-
if (_optionalChain([localization, 'access',
|
|
4136
|
+
if (_optionalChain([localization, 'access', _182 => _182.variations, 'optionalAccess', _183 => _183.plural])) {
|
|
4099
4137
|
const pluralForms = localization.variations.plural;
|
|
4100
4138
|
for (const form in pluralForms) {
|
|
4101
4139
|
const pluralKey = `${translationKey}/${form}`;
|
|
@@ -4115,7 +4153,7 @@ function _removeLocale(input2, locale) {
|
|
|
4115
4153
|
const { strings } = input2;
|
|
4116
4154
|
const newStrings = _lodash2.default.cloneDeep(strings);
|
|
4117
4155
|
for (const [key, value] of Object.entries(newStrings)) {
|
|
4118
|
-
if (_optionalChain([value, 'access',
|
|
4156
|
+
if (_optionalChain([value, 'access', _184 => _184.localizations, 'optionalAccess', _185 => _185[locale]])) {
|
|
4119
4157
|
delete value.localizations[locale];
|
|
4120
4158
|
}
|
|
4121
4159
|
}
|
|
@@ -4307,14 +4345,14 @@ function pluralWithMetaToXcstrings(data) {
|
|
|
4307
4345
|
if (element.type === "literal") {
|
|
4308
4346
|
text += element.value;
|
|
4309
4347
|
} else if (element.type === "pound") {
|
|
4310
|
-
const pluralVar = Object.entries(_optionalChain([data, 'access',
|
|
4348
|
+
const pluralVar = Object.entries(_optionalChain([data, 'access', _186 => _186._meta, 'optionalAccess', _187 => _187.variables]) || {}).find(
|
|
4311
4349
|
([_36, meta]) => meta.role === "plural"
|
|
4312
4350
|
);
|
|
4313
|
-
text += _optionalChain([pluralVar, 'optionalAccess',
|
|
4351
|
+
text += _optionalChain([pluralVar, 'optionalAccess', _188 => _188[1], 'access', _189 => _189.format]) || "%lld";
|
|
4314
4352
|
} else if (element.type === "argument") {
|
|
4315
4353
|
const varName = element.value;
|
|
4316
|
-
const varMeta = _optionalChain([data, 'access',
|
|
4317
|
-
text += _optionalChain([varMeta, 'optionalAccess',
|
|
4354
|
+
const varMeta = _optionalChain([data, 'access', _190 => _190._meta, 'optionalAccess', _191 => _191.variables, 'optionalAccess', _192 => _192[varName]]);
|
|
4355
|
+
text += _optionalChain([varMeta, 'optionalAccess', _193 => _193.format]) || "%@";
|
|
4318
4356
|
}
|
|
4319
4357
|
}
|
|
4320
4358
|
let xcstringsFormName = form;
|
|
@@ -4692,8 +4730,8 @@ async function formatDataWithBiome(data, filePath, options) {
|
|
|
4692
4730
|
});
|
|
4693
4731
|
return formatted.content;
|
|
4694
4732
|
} catch (error) {
|
|
4695
|
-
const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access',
|
|
4696
|
-
if (_optionalChain([errorMessage, 'optionalAccess',
|
|
4733
|
+
const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access', _194 => _194.stackTrace, 'optionalAccess', _195 => _195.toString, 'call', _196 => _196(), 'access', _197 => _197.split, 'call', _198 => _198("\n"), 'access', _199 => _199[0]]) : "";
|
|
4734
|
+
if (_optionalChain([errorMessage, 'optionalAccess', _200 => _200.includes, 'call', _201 => _201("does not exist in the workspace")])) {
|
|
4697
4735
|
} else {
|
|
4698
4736
|
console.log(`\u26A0\uFE0F Biome skipped ${path14.default.basename(filePath)}`);
|
|
4699
4737
|
if (errorMessage) {
|
|
@@ -4740,7 +4778,7 @@ function createPoDataLoader(params) {
|
|
|
4740
4778
|
Object.entries(entries).forEach(([msgid, entry]) => {
|
|
4741
4779
|
if (msgid && entry.msgid) {
|
|
4742
4780
|
const context = entry.msgctxt || "";
|
|
4743
|
-
const fullEntry = _optionalChain([parsedPo, 'access',
|
|
4781
|
+
const fullEntry = _optionalChain([parsedPo, 'access', _202 => _202.translations, 'access', _203 => _203[context], 'optionalAccess', _204 => _204[msgid]]);
|
|
4744
4782
|
if (fullEntry) {
|
|
4745
4783
|
result[msgid] = fullEntry;
|
|
4746
4784
|
}
|
|
@@ -4750,8 +4788,8 @@ function createPoDataLoader(params) {
|
|
|
4750
4788
|
return result;
|
|
4751
4789
|
},
|
|
4752
4790
|
async push(locale, data, originalInput, originalLocale, pullInput) {
|
|
4753
|
-
const currentSections = _optionalChain([pullInput, 'optionalAccess',
|
|
4754
|
-
const originalSections = _optionalChain([originalInput, 'optionalAccess',
|
|
4791
|
+
const currentSections = _optionalChain([pullInput, 'optionalAccess', _205 => _205.split, 'call', _206 => _206("\n\n"), 'access', _207 => _207.filter, 'call', _208 => _208(Boolean)]) || [];
|
|
4792
|
+
const originalSections = _optionalChain([originalInput, 'optionalAccess', _209 => _209.split, 'call', _210 => _210("\n\n"), 'access', _211 => _211.filter, 'call', _212 => _212(Boolean)]) || [];
|
|
4755
4793
|
const result = originalSections.map((section) => {
|
|
4756
4794
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
4757
4795
|
if (Object.keys(sectionPo.translations).length === 0) {
|
|
@@ -4820,8 +4858,8 @@ function createPoContentLoader() {
|
|
|
4820
4858
|
{
|
|
4821
4859
|
...entry,
|
|
4822
4860
|
msgstr: [
|
|
4823
|
-
_optionalChain([data, 'access',
|
|
4824
|
-
_optionalChain([data, 'access',
|
|
4861
|
+
_optionalChain([data, 'access', _213 => _213[entry.msgid], 'optionalAccess', _214 => _214.singular]),
|
|
4862
|
+
_optionalChain([data, 'access', _215 => _215[entry.msgid], 'optionalAccess', _216 => _216.plural]) || null
|
|
4825
4863
|
].filter(Boolean)
|
|
4826
4864
|
}
|
|
4827
4865
|
]).fromPairs().value();
|
|
@@ -4943,7 +4981,7 @@ function pullV1(xliffElement, locale, originalLocale) {
|
|
|
4943
4981
|
let key = getTransUnitKey(unit);
|
|
4944
4982
|
if (!key) return;
|
|
4945
4983
|
if (seenKeys.has(key)) {
|
|
4946
|
-
const id = _optionalChain([unit, 'access',
|
|
4984
|
+
const id = _optionalChain([unit, 'access', _217 => _217.getAttribute, 'call', _218 => _218("id"), 'optionalAccess', _219 => _219.trim, 'call', _220 => _220()]);
|
|
4947
4985
|
if (id) {
|
|
4948
4986
|
key = `${key}#${id}`;
|
|
4949
4987
|
} else {
|
|
@@ -4991,7 +5029,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
4991
5029
|
let key = getTransUnitKey(unit);
|
|
4992
5030
|
if (!key) return;
|
|
4993
5031
|
if (seenKeys.has(key)) {
|
|
4994
|
-
const id = _optionalChain([unit, 'access',
|
|
5032
|
+
const id = _optionalChain([unit, 'access', _221 => _221.getAttribute, 'call', _222 => _222("id"), 'optionalAccess', _223 => _223.trim, 'call', _224 => _224()]);
|
|
4995
5033
|
if (id) {
|
|
4996
5034
|
key = `${key}#${id}`;
|
|
4997
5035
|
} else {
|
|
@@ -5033,7 +5071,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
5033
5071
|
const translationKeys = new Set(Object.keys(translations));
|
|
5034
5072
|
existingUnits.forEach((unit, key) => {
|
|
5035
5073
|
if (!translationKeys.has(key)) {
|
|
5036
|
-
_optionalChain([unit, 'access',
|
|
5074
|
+
_optionalChain([unit, 'access', _225 => _225.parentNode, 'optionalAccess', _226 => _226.removeChild, 'call', _227 => _227(unit)]);
|
|
5037
5075
|
}
|
|
5038
5076
|
});
|
|
5039
5077
|
return serializeWithDeclaration(
|
|
@@ -5076,18 +5114,18 @@ function traverseUnitsV2(container, fileId, currentPath, result) {
|
|
|
5076
5114
|
Array.from(container.children).forEach((child) => {
|
|
5077
5115
|
const tagName = child.tagName;
|
|
5078
5116
|
if (tagName === "unit") {
|
|
5079
|
-
const unitId = _optionalChain([child, 'access',
|
|
5117
|
+
const unitId = _optionalChain([child, 'access', _228 => _228.getAttribute, 'call', _229 => _229("id"), 'optionalAccess', _230 => _230.trim, 'call', _231 => _231()]);
|
|
5080
5118
|
if (!unitId) return;
|
|
5081
5119
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
5082
5120
|
const segment = child.querySelector("segment");
|
|
5083
|
-
const source = _optionalChain([segment, 'optionalAccess',
|
|
5121
|
+
const source = _optionalChain([segment, 'optionalAccess', _232 => _232.querySelector, 'call', _233 => _233("source")]);
|
|
5084
5122
|
if (source) {
|
|
5085
5123
|
result[key] = extractTextContent(source);
|
|
5086
5124
|
} else {
|
|
5087
5125
|
result[key] = unitId;
|
|
5088
5126
|
}
|
|
5089
5127
|
} else if (tagName === "group") {
|
|
5090
|
-
const groupId = _optionalChain([child, 'access',
|
|
5128
|
+
const groupId = _optionalChain([child, 'access', _234 => _234.getAttribute, 'call', _235 => _235("id"), 'optionalAccess', _236 => _236.trim, 'call', _237 => _237()]);
|
|
5091
5129
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
5092
5130
|
traverseUnitsV2(child, fileId, newPath, result);
|
|
5093
5131
|
}
|
|
@@ -5123,12 +5161,12 @@ function indexUnitsV2(container, fileId, currentPath, index) {
|
|
|
5123
5161
|
Array.from(container.children).forEach((child) => {
|
|
5124
5162
|
const tagName = child.tagName;
|
|
5125
5163
|
if (tagName === "unit") {
|
|
5126
|
-
const unitId = _optionalChain([child, 'access',
|
|
5164
|
+
const unitId = _optionalChain([child, 'access', _238 => _238.getAttribute, 'call', _239 => _239("id"), 'optionalAccess', _240 => _240.trim, 'call', _241 => _241()]);
|
|
5127
5165
|
if (!unitId) return;
|
|
5128
5166
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
5129
5167
|
index.set(key, child);
|
|
5130
5168
|
} else if (tagName === "group") {
|
|
5131
|
-
const groupId = _optionalChain([child, 'access',
|
|
5169
|
+
const groupId = _optionalChain([child, 'access', _242 => _242.getAttribute, 'call', _243 => _243("id"), 'optionalAccess', _244 => _244.trim, 'call', _245 => _245()]);
|
|
5132
5170
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
5133
5171
|
indexUnitsV2(child, fileId, newPath, index);
|
|
5134
5172
|
}
|
|
@@ -5149,9 +5187,9 @@ function updateUnitV2(unit, value) {
|
|
|
5149
5187
|
setTextContent(source, value);
|
|
5150
5188
|
}
|
|
5151
5189
|
function getTransUnitKey(transUnit) {
|
|
5152
|
-
const resname = _optionalChain([transUnit, 'access',
|
|
5190
|
+
const resname = _optionalChain([transUnit, 'access', _246 => _246.getAttribute, 'call', _247 => _247("resname"), 'optionalAccess', _248 => _248.trim, 'call', _249 => _249()]);
|
|
5153
5191
|
if (resname) return resname;
|
|
5154
|
-
const id = _optionalChain([transUnit, 'access',
|
|
5192
|
+
const id = _optionalChain([transUnit, 'access', _250 => _250.getAttribute, 'call', _251 => _251("id"), 'optionalAccess', _252 => _252.trim, 'call', _253 => _253()]);
|
|
5155
5193
|
if (id) return id;
|
|
5156
5194
|
const sourceElement = transUnit.querySelector("source");
|
|
5157
5195
|
if (sourceElement) {
|
|
@@ -5208,7 +5246,7 @@ function formatXml(xml) {
|
|
|
5208
5246
|
if (cdataNode) {
|
|
5209
5247
|
return `${indent2}${openTag}<![CDATA[${cdataNode.nodeValue}]]></${tagName}>`;
|
|
5210
5248
|
}
|
|
5211
|
-
const textContent = _optionalChain([element, 'access',
|
|
5249
|
+
const textContent = _optionalChain([element, 'access', _254 => _254.textContent, 'optionalAccess', _255 => _255.trim, 'call', _256 => _256()]) || "";
|
|
5212
5250
|
const hasOnlyText = element.childNodes.length === 1 && element.childNodes[0].nodeType === 3;
|
|
5213
5251
|
if (hasOnlyText && textContent) {
|
|
5214
5252
|
return `${indent2}${openTag}${textContent}</${tagName}>`;
|
|
@@ -5501,7 +5539,7 @@ function createDatoClient(params) {
|
|
|
5501
5539
|
ids: !records.length ? void 0 : records.join(",")
|
|
5502
5540
|
}
|
|
5503
5541
|
}).catch(
|
|
5504
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
5542
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _257 => _257.response, 'optionalAccess', _258 => _258.body, 'optionalAccess', _259 => _259.data, 'optionalAccess', _260 => _260[0]]) || error)
|
|
5505
5543
|
);
|
|
5506
5544
|
},
|
|
5507
5545
|
findRecordsForModel: async (modelId, records) => {
|
|
@@ -5512,10 +5550,10 @@ function createDatoClient(params) {
|
|
|
5512
5550
|
filter: {
|
|
5513
5551
|
type: modelId,
|
|
5514
5552
|
only_valid: "true",
|
|
5515
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
5553
|
+
ids: !_optionalChain([records, 'optionalAccess', _261 => _261.length]) ? void 0 : records.join(",")
|
|
5516
5554
|
}
|
|
5517
5555
|
}).catch(
|
|
5518
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
5556
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _262 => _262.response, 'optionalAccess', _263 => _263.body, 'optionalAccess', _264 => _264.data, 'optionalAccess', _265 => _265[0]]) || error)
|
|
5519
5557
|
);
|
|
5520
5558
|
return result;
|
|
5521
5559
|
} catch (_error) {
|
|
@@ -5531,10 +5569,10 @@ function createDatoClient(params) {
|
|
|
5531
5569
|
updateRecord: async (id, payload) => {
|
|
5532
5570
|
try {
|
|
5533
5571
|
await dato.items.update(id, payload).catch(
|
|
5534
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
5572
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _266 => _266.response, 'optionalAccess', _267 => _267.body, 'optionalAccess', _268 => _268.data, 'optionalAccess', _269 => _269[0]]) || error)
|
|
5535
5573
|
);
|
|
5536
5574
|
} catch (_error) {
|
|
5537
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
5575
|
+
if (_optionalChain([_error, 'optionalAccess', _270 => _270.attributes, 'optionalAccess', _271 => _271.details, 'optionalAccess', _272 => _272.message])) {
|
|
5538
5576
|
throw new Error(
|
|
5539
5577
|
[
|
|
5540
5578
|
`${_error.attributes.details.message}`,
|
|
@@ -5556,10 +5594,10 @@ function createDatoClient(params) {
|
|
|
5556
5594
|
enableFieldLocalization: async (args) => {
|
|
5557
5595
|
try {
|
|
5558
5596
|
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch(
|
|
5559
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
5597
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _273 => _273.response, 'optionalAccess', _274 => _274.body, 'optionalAccess', _275 => _275.data, 'optionalAccess', _276 => _276[0]]) || error)
|
|
5560
5598
|
);
|
|
5561
5599
|
} catch (_error) {
|
|
5562
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
5600
|
+
if (_optionalChain([_error, 'optionalAccess', _277 => _277.attributes, 'optionalAccess', _278 => _278.code]) === "NOT_FOUND") {
|
|
5563
5601
|
throw new Error(
|
|
5564
5602
|
[
|
|
5565
5603
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -5567,7 +5605,7 @@ function createDatoClient(params) {
|
|
|
5567
5605
|
].join("\n\n")
|
|
5568
5606
|
);
|
|
5569
5607
|
}
|
|
5570
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
5608
|
+
if (_optionalChain([_error, 'optionalAccess', _279 => _279.attributes, 'optionalAccess', _280 => _280.details, 'optionalAccess', _281 => _281.message])) {
|
|
5571
5609
|
throw new Error(
|
|
5572
5610
|
[
|
|
5573
5611
|
`${_error.attributes.details.message}`,
|
|
@@ -5645,7 +5683,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
5645
5683
|
const records = await dato.findRecordsForModel(modelId);
|
|
5646
5684
|
const recordChoices = createRecordChoices(
|
|
5647
5685
|
records,
|
|
5648
|
-
_optionalChain([config, 'access',
|
|
5686
|
+
_optionalChain([config, 'access', _282 => _282.models, 'access', _283 => _283[modelId], 'optionalAccess', _284 => _284.records]) || [],
|
|
5649
5687
|
project
|
|
5650
5688
|
);
|
|
5651
5689
|
const selectedRecords = await promptRecordSelection(
|
|
@@ -5664,14 +5702,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
5664
5702
|
},
|
|
5665
5703
|
async pull(locale, input2, initCtx) {
|
|
5666
5704
|
const result = {};
|
|
5667
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
5668
|
-
let records = _optionalChain([initCtx, 'optionalAccess',
|
|
5705
|
+
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _285 => _285.models]) || {})) {
|
|
5706
|
+
let records = _optionalChain([initCtx, 'optionalAccess', _286 => _286.models, 'access', _287 => _287[modelId], 'access', _288 => _288.records]) || [];
|
|
5669
5707
|
const recordIds = records.map((record) => record.id);
|
|
5670
5708
|
records = await dato.findRecords(recordIds);
|
|
5671
5709
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
5672
5710
|
if (records.length > 0) {
|
|
5673
5711
|
result[modelId] = {
|
|
5674
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
5712
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _289 => _289.models, 'optionalAccess', _290 => _290[modelId], 'optionalAccess', _291 => _291.fields]) || [],
|
|
5675
5713
|
records
|
|
5676
5714
|
};
|
|
5677
5715
|
}
|
|
@@ -5734,7 +5772,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
5734
5772
|
return records.map((record) => ({
|
|
5735
5773
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
5736
5774
|
value: record.id,
|
|
5737
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
5775
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _292 => _292.includes, 'call', _293 => _293(record.id)])
|
|
5738
5776
|
}));
|
|
5739
5777
|
}
|
|
5740
5778
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -6053,7 +6091,7 @@ function createVttLoader() {
|
|
|
6053
6091
|
if (!input2) {
|
|
6054
6092
|
return "";
|
|
6055
6093
|
}
|
|
6056
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
6094
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _294 => _294.parse, 'call', _295 => _295(input2), 'optionalAccess', _296 => _296.cues]);
|
|
6057
6095
|
if (Object.keys(vtt).length === 0) {
|
|
6058
6096
|
return {};
|
|
6059
6097
|
} else {
|
|
@@ -6116,7 +6154,7 @@ function variableExtractLoader(params) {
|
|
|
6116
6154
|
for (let i = 0; i < matches.length; i++) {
|
|
6117
6155
|
const match2 = matches[i];
|
|
6118
6156
|
const currentValue = result[key].value;
|
|
6119
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
6157
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _297 => _297.replace, 'call', _298 => _298(match2, `{variable:${i}}`)]);
|
|
6120
6158
|
result[key].value = newValue;
|
|
6121
6159
|
result[key].variables[i] = match2;
|
|
6122
6160
|
}
|
|
@@ -6129,7 +6167,7 @@ function variableExtractLoader(params) {
|
|
|
6129
6167
|
result[key] = valueObj.value;
|
|
6130
6168
|
const resultValue = result[key];
|
|
6131
6169
|
if (isICUPluralObject(resultValue)) {
|
|
6132
|
-
const originalValue = _optionalChain([originalInput, 'optionalAccess',
|
|
6170
|
+
const originalValue = _optionalChain([originalInput, 'optionalAccess', _299 => _299[key]]);
|
|
6133
6171
|
if (isICUPluralObject(originalValue) && originalValue._meta) {
|
|
6134
6172
|
resultValue._meta = originalValue._meta;
|
|
6135
6173
|
resultValue[Symbol.for("@lingo.dev/icu-plural-object")] = true;
|
|
@@ -6139,7 +6177,7 @@ function variableExtractLoader(params) {
|
|
|
6139
6177
|
const variable = valueObj.variables[i];
|
|
6140
6178
|
const currentValue = result[key];
|
|
6141
6179
|
if (typeof currentValue === "string") {
|
|
6142
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
6180
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _300 => _300.replace, 'call', _301 => _301(`{variable:${i}}`, variable)]);
|
|
6143
6181
|
result[key] = newValue;
|
|
6144
6182
|
}
|
|
6145
6183
|
}
|
|
@@ -6340,7 +6378,7 @@ function createVueJsonLoader() {
|
|
|
6340
6378
|
return createLoader({
|
|
6341
6379
|
pull: async (locale, input2, ctx) => {
|
|
6342
6380
|
const parsed = parseVueFile(input2);
|
|
6343
|
-
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess',
|
|
6381
|
+
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _302 => _302.i18n, 'optionalAccess', _303 => _303[locale]]), () => ( {}));
|
|
6344
6382
|
},
|
|
6345
6383
|
push: async (locale, data, originalInput) => {
|
|
6346
6384
|
const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
|
|
@@ -6525,7 +6563,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
|
|
|
6525
6563
|
objectExpression.properties.forEach((prop) => {
|
|
6526
6564
|
if (!t.isObjectProperty(prop)) return;
|
|
6527
6565
|
const key = getPropertyKey(prop);
|
|
6528
|
-
const incomingVal = _optionalChain([data, 'optionalAccess',
|
|
6566
|
+
const incomingVal = _optionalChain([data, 'optionalAccess', _304 => _304[key]]);
|
|
6529
6567
|
if (incomingVal === void 0) {
|
|
6530
6568
|
return;
|
|
6531
6569
|
}
|
|
@@ -6561,7 +6599,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
|
|
|
6561
6599
|
let modified = false;
|
|
6562
6600
|
arrayExpression.elements.forEach((element, index) => {
|
|
6563
6601
|
if (!element) return;
|
|
6564
|
-
const incomingVal = _optionalChain([incoming, 'optionalAccess',
|
|
6602
|
+
const incomingVal = _optionalChain([incoming, 'optionalAccess', _305 => _305[index]]);
|
|
6565
6603
|
if (incomingVal === void 0) return;
|
|
6566
6604
|
if (t.isStringLiteral(element) && typeof incomingVal === "string") {
|
|
6567
6605
|
if (element.value !== incomingVal) {
|
|
@@ -7052,7 +7090,7 @@ var AST = class _AST {
|
|
|
7052
7090
|
const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
|
|
7053
7091
|
if (this.isStart() && !this.type)
|
|
7054
7092
|
ret.unshift([]);
|
|
7055
|
-
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
7093
|
+
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _306 => _306.#parent, 'optionalAccess', _307 => _307.type]) === "!")) {
|
|
7056
7094
|
ret.push({});
|
|
7057
7095
|
}
|
|
7058
7096
|
return ret;
|
|
@@ -7060,7 +7098,7 @@ var AST = class _AST {
|
|
|
7060
7098
|
isStart() {
|
|
7061
7099
|
if (this.#root === this)
|
|
7062
7100
|
return true;
|
|
7063
|
-
if (!_optionalChain([this, 'access',
|
|
7101
|
+
if (!_optionalChain([this, 'access', _308 => _308.#parent, 'optionalAccess', _309 => _309.isStart, 'call', _310 => _310()]))
|
|
7064
7102
|
return false;
|
|
7065
7103
|
if (this.#parentIndex === 0)
|
|
7066
7104
|
return true;
|
|
@@ -7076,12 +7114,12 @@ var AST = class _AST {
|
|
|
7076
7114
|
isEnd() {
|
|
7077
7115
|
if (this.#root === this)
|
|
7078
7116
|
return true;
|
|
7079
|
-
if (_optionalChain([this, 'access',
|
|
7117
|
+
if (_optionalChain([this, 'access', _311 => _311.#parent, 'optionalAccess', _312 => _312.type]) === "!")
|
|
7080
7118
|
return true;
|
|
7081
|
-
if (!_optionalChain([this, 'access',
|
|
7119
|
+
if (!_optionalChain([this, 'access', _313 => _313.#parent, 'optionalAccess', _314 => _314.isEnd, 'call', _315 => _315()]))
|
|
7082
7120
|
return false;
|
|
7083
7121
|
if (!this.type)
|
|
7084
|
-
return _optionalChain([this, 'access',
|
|
7122
|
+
return _optionalChain([this, 'access', _316 => _316.#parent, 'optionalAccess', _317 => _317.isEnd, 'call', _318 => _318()]);
|
|
7085
7123
|
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
|
7086
7124
|
return this.#parentIndex === pl - 1;
|
|
7087
7125
|
}
|
|
@@ -7326,7 +7364,7 @@ var AST = class _AST {
|
|
|
7326
7364
|
}
|
|
7327
7365
|
}
|
|
7328
7366
|
let end = "";
|
|
7329
|
-
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
7367
|
+
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _319 => _319.#parent, 'optionalAccess', _320 => _320.type]) === "!") {
|
|
7330
7368
|
end = "(?:$|\\/)";
|
|
7331
7369
|
}
|
|
7332
7370
|
const final2 = start2 + src + end;
|
|
@@ -8416,7 +8454,7 @@ function createMdxSectionsSplit2Loader() {
|
|
|
8416
8454
|
const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
|
|
8417
8455
|
const result = {
|
|
8418
8456
|
frontmatter: data.frontmatter,
|
|
8419
|
-
codePlaceholders: _optionalChain([pullInput, 'optionalAccess',
|
|
8457
|
+
codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _321 => _321.codePlaceholders]) || {},
|
|
8420
8458
|
content
|
|
8421
8459
|
};
|
|
8422
8460
|
return result;
|
|
@@ -9517,7 +9555,7 @@ function createBasicTranslator(model, systemPrompt, settings = {}) {
|
|
|
9517
9555
|
]
|
|
9518
9556
|
});
|
|
9519
9557
|
const result = JSON.parse(response.text);
|
|
9520
|
-
return _optionalChain([result, 'optionalAccess',
|
|
9558
|
+
return _optionalChain([result, 'optionalAccess', _322 => _322.data]) || {};
|
|
9521
9559
|
}
|
|
9522
9560
|
}
|
|
9523
9561
|
function extractPayloadChunks(payload) {
|
|
@@ -9600,7 +9638,7 @@ function getPureModelProvider(provider) {
|
|
|
9600
9638
|
|
|
9601
9639
|
${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
|
|
9602
9640
|
`;
|
|
9603
|
-
switch (_optionalChain([provider, 'optionalAccess',
|
|
9641
|
+
switch (_optionalChain([provider, 'optionalAccess', _323 => _323.id])) {
|
|
9604
9642
|
case "openai": {
|
|
9605
9643
|
if (!process.env.OPENAI_API_KEY) {
|
|
9606
9644
|
throw new Error(
|
|
@@ -9658,7 +9696,7 @@ function getPureModelProvider(provider) {
|
|
|
9658
9696
|
})(provider.model);
|
|
9659
9697
|
}
|
|
9660
9698
|
default: {
|
|
9661
|
-
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess',
|
|
9699
|
+
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _324 => _324.id])));
|
|
9662
9700
|
}
|
|
9663
9701
|
}
|
|
9664
9702
|
}
|
|
@@ -9943,7 +9981,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
9943
9981
|
validateParams(i18nConfig, flags);
|
|
9944
9982
|
ora.succeed("Localization configuration is valid");
|
|
9945
9983
|
ora.start("Connecting to Lingo.dev Localization Engine...");
|
|
9946
|
-
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess',
|
|
9984
|
+
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _325 => _325.provider]);
|
|
9947
9985
|
if (isByokMode) {
|
|
9948
9986
|
authId = null;
|
|
9949
9987
|
ora.succeed("Using external provider (BYOK mode)");
|
|
@@ -9957,16 +9995,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
9957
9995
|
flags
|
|
9958
9996
|
});
|
|
9959
9997
|
let buckets = getBuckets(i18nConfig);
|
|
9960
|
-
if (_optionalChain([flags, 'access',
|
|
9998
|
+
if (_optionalChain([flags, 'access', _326 => _326.bucket, 'optionalAccess', _327 => _327.length])) {
|
|
9961
9999
|
buckets = buckets.filter(
|
|
9962
10000
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
9963
10001
|
);
|
|
9964
10002
|
}
|
|
9965
10003
|
ora.succeed("Buckets retrieved");
|
|
9966
|
-
if (_optionalChain([flags, 'access',
|
|
10004
|
+
if (_optionalChain([flags, 'access', _328 => _328.file, 'optionalAccess', _329 => _329.length])) {
|
|
9967
10005
|
buckets = buckets.map((bucket) => {
|
|
9968
10006
|
const paths = bucket.paths.filter(
|
|
9969
|
-
(path19) => flags.file.find((file) => _optionalChain([path19, 'access',
|
|
10007
|
+
(path19) => flags.file.find((file) => _optionalChain([path19, 'access', _330 => _330.pathPattern, 'optionalAccess', _331 => _331.includes, 'call', _332 => _332(file)]))
|
|
9970
10008
|
);
|
|
9971
10009
|
return { ...bucket, paths };
|
|
9972
10010
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -9987,7 +10025,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
9987
10025
|
});
|
|
9988
10026
|
}
|
|
9989
10027
|
}
|
|
9990
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
10028
|
+
const targetLocales = _optionalChain([flags, 'access', _333 => _333.locale, 'optionalAccess', _334 => _334.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
9991
10029
|
ora.start("Setting up localization cache...");
|
|
9992
10030
|
const checkLockfileProcessor = createDeltaProcessor("");
|
|
9993
10031
|
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
@@ -10275,7 +10313,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
10275
10313
|
}
|
|
10276
10314
|
const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
|
|
10277
10315
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
10278
|
-
if (!_optionalChain([flags, 'access',
|
|
10316
|
+
if (!_optionalChain([flags, 'access', _335 => _335.locale, 'optionalAccess', _336 => _336.length])) {
|
|
10279
10317
|
await deltaProcessor.saveChecksums(checksums);
|
|
10280
10318
|
}
|
|
10281
10319
|
}
|
|
@@ -10399,12 +10437,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
10399
10437
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
10400
10438
|
docUrl: "bucketNotFound"
|
|
10401
10439
|
});
|
|
10402
|
-
} else if (_optionalChain([flags, 'access',
|
|
10440
|
+
} else if (_optionalChain([flags, 'access', _337 => _337.locale, 'optionalAccess', _338 => _338.some, 'call', _339 => _339((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
10403
10441
|
throw new ValidationError({
|
|
10404
10442
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
10405
10443
|
docUrl: "localeTargetNotFound"
|
|
10406
10444
|
});
|
|
10407
|
-
} else if (_optionalChain([flags, 'access',
|
|
10445
|
+
} else if (_optionalChain([flags, 'access', _340 => _340.bucket, 'optionalAccess', _341 => _341.some, 'call', _342 => _342(
|
|
10408
10446
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
10409
10447
|
)])) {
|
|
10410
10448
|
throw new ValidationError({
|
|
@@ -10936,7 +10974,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
|
|
|
10936
10974
|
const response = await engine.whoami();
|
|
10937
10975
|
return {
|
|
10938
10976
|
authenticated: !!response,
|
|
10939
|
-
username: _optionalChain([response, 'optionalAccess',
|
|
10977
|
+
username: _optionalChain([response, 'optionalAccess', _343 => _343.email])
|
|
10940
10978
|
};
|
|
10941
10979
|
} catch (error) {
|
|
10942
10980
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -11052,7 +11090,7 @@ function createExplicitLocalizer(provider) {
|
|
|
11052
11090
|
}
|
|
11053
11091
|
function createAiSdkLocalizer(params) {
|
|
11054
11092
|
const skipAuth = params.skipAuth === true;
|
|
11055
|
-
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
11093
|
+
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _344 => _344.apiKeyName]), () => ( ""))];
|
|
11056
11094
|
if (!skipAuth && !apiKey || !params.apiKeyName) {
|
|
11057
11095
|
throw new Error(
|
|
11058
11096
|
_dedent2.default`
|
|
@@ -11186,8 +11224,8 @@ async function setup(input2) {
|
|
|
11186
11224
|
throw new Error(
|
|
11187
11225
|
"No buckets found in i18n.json. Please add at least one bucket containing i18n content."
|
|
11188
11226
|
);
|
|
11189
|
-
} else if (_optionalChain([ctx, 'access',
|
|
11190
|
-
(bucket) => !_optionalChain([ctx, 'access',
|
|
11227
|
+
} else if (_optionalChain([ctx, 'access', _345 => _345.flags, 'access', _346 => _346.bucket, 'optionalAccess', _347 => _347.some, 'call', _348 => _348(
|
|
11228
|
+
(bucket) => !_optionalChain([ctx, 'access', _349 => _349.config, 'optionalAccess', _350 => _350.buckets, 'access', _351 => _351[bucket]])
|
|
11191
11229
|
)])) {
|
|
11192
11230
|
throw new Error(
|
|
11193
11231
|
`One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
|
|
@@ -11200,7 +11238,7 @@ async function setup(input2) {
|
|
|
11200
11238
|
title: "Selecting localization provider",
|
|
11201
11239
|
task: async (ctx, task) => {
|
|
11202
11240
|
ctx.localizer = createLocalizer(
|
|
11203
|
-
_optionalChain([ctx, 'access',
|
|
11241
|
+
_optionalChain([ctx, 'access', _352 => _352.config, 'optionalAccess', _353 => _353.provider]),
|
|
11204
11242
|
ctx.flags.apiKey
|
|
11205
11243
|
);
|
|
11206
11244
|
if (!ctx.localizer) {
|
|
@@ -11213,7 +11251,7 @@ async function setup(input2) {
|
|
|
11213
11251
|
},
|
|
11214
11252
|
{
|
|
11215
11253
|
title: "Checking authentication",
|
|
11216
|
-
enabled: (ctx) => _optionalChain([ctx, 'access',
|
|
11254
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _354 => _354.localizer, 'optionalAccess', _355 => _355.id]) === "Lingo.dev",
|
|
11217
11255
|
task: async (ctx, task) => {
|
|
11218
11256
|
const authStatus = await ctx.localizer.checkAuth();
|
|
11219
11257
|
if (!authStatus.authenticated) {
|
|
@@ -11226,7 +11264,7 @@ async function setup(input2) {
|
|
|
11226
11264
|
},
|
|
11227
11265
|
{
|
|
11228
11266
|
title: "Validating configuration",
|
|
11229
|
-
enabled: (ctx) => _optionalChain([ctx, 'access',
|
|
11267
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _356 => _356.localizer, 'optionalAccess', _357 => _357.id]) !== "Lingo.dev",
|
|
11230
11268
|
task: async (ctx, task) => {
|
|
11231
11269
|
const validationStatus = await ctx.localizer.validateSettings();
|
|
11232
11270
|
if (!validationStatus.valid) {
|
|
@@ -11543,7 +11581,7 @@ function createWorkerTask(args) {
|
|
|
11543
11581
|
const processableData = _lodash2.default.chain(sourceData).entries().filter(
|
|
11544
11582
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
|
|
11545
11583
|
).filter(
|
|
11546
|
-
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access',
|
|
11584
|
+
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _358 => _358.onlyKeys, 'optionalAccess', _359 => _359.some, 'call', _360 => _360(
|
|
11547
11585
|
(pattern) => minimatch(key, pattern)
|
|
11548
11586
|
)])
|
|
11549
11587
|
).fromPairs().value();
|
|
@@ -11611,7 +11649,7 @@ function createWorkerTask(args) {
|
|
|
11611
11649
|
finalRenamedTargetData
|
|
11612
11650
|
);
|
|
11613
11651
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
11614
|
-
if (!_optionalChain([args, 'access',
|
|
11652
|
+
if (!_optionalChain([args, 'access', _361 => _361.ctx, 'access', _362 => _362.flags, 'access', _363 => _363.targetLocale, 'optionalAccess', _364 => _364.length])) {
|
|
11615
11653
|
await deltaProcessor.saveChecksums(checksums);
|
|
11616
11654
|
}
|
|
11617
11655
|
});
|
|
@@ -11816,10 +11854,10 @@ var flagsSchema2 = _zod.z.object({
|
|
|
11816
11854
|
async function frozen(input2) {
|
|
11817
11855
|
console.log(_chalk2.default.hex(colors.orange)("[Frozen]"));
|
|
11818
11856
|
let buckets = getBuckets(input2.config);
|
|
11819
|
-
if (_optionalChain([input2, 'access',
|
|
11857
|
+
if (_optionalChain([input2, 'access', _365 => _365.flags, 'access', _366 => _366.bucket, 'optionalAccess', _367 => _367.length])) {
|
|
11820
11858
|
buckets = buckets.filter((b) => input2.flags.bucket.includes(b.type));
|
|
11821
11859
|
}
|
|
11822
|
-
if (_optionalChain([input2, 'access',
|
|
11860
|
+
if (_optionalChain([input2, 'access', _368 => _368.flags, 'access', _369 => _369.file, 'optionalAccess', _370 => _370.length])) {
|
|
11823
11861
|
buckets = buckets.map((bucket) => {
|
|
11824
11862
|
const paths = bucket.paths.filter(
|
|
11825
11863
|
(p) => input2.flags.file.some(
|
|
@@ -11956,13 +11994,13 @@ async function frozen(input2) {
|
|
|
11956
11994
|
|
|
11957
11995
|
// src/cli/cmd/run/_utils.ts
|
|
11958
11996
|
async function determineAuthId(ctx) {
|
|
11959
|
-
const isByokMode = !!_optionalChain([ctx, 'access',
|
|
11997
|
+
const isByokMode = !!_optionalChain([ctx, 'access', _371 => _371.config, 'optionalAccess', _372 => _372.provider]);
|
|
11960
11998
|
if (isByokMode) {
|
|
11961
11999
|
return null;
|
|
11962
12000
|
} else {
|
|
11963
12001
|
try {
|
|
11964
|
-
const authStatus = await _optionalChain([ctx, 'access',
|
|
11965
|
-
return _optionalChain([authStatus, 'optionalAccess',
|
|
12002
|
+
const authStatus = await _optionalChain([ctx, 'access', _373 => _373.localizer, 'optionalAccess', _374 => _374.checkAuth, 'call', _375 => _375()]);
|
|
12003
|
+
return _optionalChain([authStatus, 'optionalAccess', _376 => _376.username]) || null;
|
|
11966
12004
|
} catch (e3) {
|
|
11967
12005
|
return null;
|
|
11968
12006
|
}
|
|
@@ -12159,7 +12197,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
12159
12197
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
12160
12198
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
12161
12199
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
12162
|
-
_optionalChain([this, 'access',
|
|
12200
|
+
_optionalChain([this, 'access', _377 => _377.platformKit, 'optionalAccess', _378 => _378.gitConfig, 'call', _379 => _379()]);
|
|
12163
12201
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
12164
12202
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
12165
12203
|
if (!processOwnCommits) {
|
|
@@ -12191,7 +12229,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
12191
12229
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
12192
12230
|
var PullRequestFlow = class extends InBranchFlow {
|
|
12193
12231
|
async preRun() {
|
|
12194
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
12232
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _380 => _380()]);
|
|
12195
12233
|
if (!canContinue) {
|
|
12196
12234
|
return false;
|
|
12197
12235
|
}
|
|
@@ -12454,10 +12492,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
12454
12492
|
repo_slug: this.platformConfig.repositoryName,
|
|
12455
12493
|
state: "OPEN"
|
|
12456
12494
|
}).then(({ data: { values } }) => {
|
|
12457
|
-
return _optionalChain([values, 'optionalAccess',
|
|
12458
|
-
({ source, destination }) => _optionalChain([source, 'optionalAccess',
|
|
12495
|
+
return _optionalChain([values, 'optionalAccess', _381 => _381.find, 'call', _382 => _382(
|
|
12496
|
+
({ source, destination }) => _optionalChain([source, 'optionalAccess', _383 => _383.branch, 'optionalAccess', _384 => _384.name]) === branch && _optionalChain([destination, 'optionalAccess', _385 => _385.branch, 'optionalAccess', _386 => _386.name]) === this.platformConfig.baseBranchName
|
|
12459
12497
|
)]);
|
|
12460
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
12498
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _387 => _387.id]));
|
|
12461
12499
|
}
|
|
12462
12500
|
async closePullRequest({ pullRequestNumber }) {
|
|
12463
12501
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -12553,7 +12591,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
12553
12591
|
repo: this.platformConfig.repositoryName,
|
|
12554
12592
|
base: this.platformConfig.baseBranchName,
|
|
12555
12593
|
state: "open"
|
|
12556
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
12594
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _388 => _388.number]));
|
|
12557
12595
|
}
|
|
12558
12596
|
async closePullRequest({ pullRequestNumber }) {
|
|
12559
12597
|
await this.octokit.rest.pulls.update({
|
|
@@ -12680,7 +12718,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
12680
12718
|
sourceBranch: branch,
|
|
12681
12719
|
state: "opened"
|
|
12682
12720
|
});
|
|
12683
|
-
return _optionalChain([mergeRequests, 'access',
|
|
12721
|
+
return _optionalChain([mergeRequests, 'access', _389 => _389[0], 'optionalAccess', _390 => _390.iid]);
|
|
12684
12722
|
}
|
|
12685
12723
|
async closePullRequest({
|
|
12686
12724
|
pullRequestNumber
|
|
@@ -12786,7 +12824,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
12786
12824
|
}
|
|
12787
12825
|
const env = {
|
|
12788
12826
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
12789
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
12827
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _391 => _391.pullRequest, 'optionalAccess', _392 => _392.toString, 'call', _393 => _393()]) || "false",
|
|
12790
12828
|
...options.commitMessage && {
|
|
12791
12829
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
12792
12830
|
},
|
|
@@ -12806,7 +12844,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
12806
12844
|
const { isPullRequestMode } = platformKit.config;
|
|
12807
12845
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
12808
12846
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
12809
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
12847
|
+
const canRun = await _optionalChain([flow, 'access', _394 => _394.preRun, 'optionalCall', _395 => _395()]);
|
|
12810
12848
|
if (canRun === false) {
|
|
12811
12849
|
return;
|
|
12812
12850
|
}
|
|
@@ -12816,7 +12854,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
12816
12854
|
if (!hasChanges) {
|
|
12817
12855
|
return;
|
|
12818
12856
|
}
|
|
12819
|
-
await _optionalChain([flow, 'access',
|
|
12857
|
+
await _optionalChain([flow, 'access', _396 => _396.postRun, 'optionalCall', _397 => _397()]);
|
|
12820
12858
|
});
|
|
12821
12859
|
function parseBooleanArg(val) {
|
|
12822
12860
|
if (val === true) return true;
|
|
@@ -12853,8 +12891,8 @@ function exitGracefully(elapsedMs = 0) {
|
|
|
12853
12891
|
}
|
|
12854
12892
|
}
|
|
12855
12893
|
function checkForPendingOperations() {
|
|
12856
|
-
const activeHandles = _optionalChain([process, 'access',
|
|
12857
|
-
const activeRequests = _optionalChain([process, 'access',
|
|
12894
|
+
const activeHandles = _optionalChain([process, 'access', _398 => _398._getActiveHandles, 'optionalCall', _399 => _399()]) || [];
|
|
12895
|
+
const activeRequests = _optionalChain([process, 'access', _400 => _400._getActiveRequests, 'optionalCall', _401 => _401()]) || [];
|
|
12858
12896
|
const nonStandardHandles = activeHandles.filter((handle) => {
|
|
12859
12897
|
if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
|
|
12860
12898
|
return false;
|
|
@@ -12923,17 +12961,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
12923
12961
|
flags
|
|
12924
12962
|
});
|
|
12925
12963
|
let buckets = getBuckets(i18nConfig);
|
|
12926
|
-
if (_optionalChain([flags, 'access',
|
|
12964
|
+
if (_optionalChain([flags, 'access', _402 => _402.bucket, 'optionalAccess', _403 => _403.length])) {
|
|
12927
12965
|
buckets = buckets.filter(
|
|
12928
12966
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
12929
12967
|
);
|
|
12930
12968
|
}
|
|
12931
12969
|
ora.succeed("Buckets retrieved");
|
|
12932
|
-
if (_optionalChain([flags, 'access',
|
|
12970
|
+
if (_optionalChain([flags, 'access', _404 => _404.file, 'optionalAccess', _405 => _405.length])) {
|
|
12933
12971
|
buckets = buckets.map((bucket) => {
|
|
12934
12972
|
const paths = bucket.paths.filter(
|
|
12935
12973
|
(path19) => flags.file.find(
|
|
12936
|
-
(file) => _optionalChain([path19, 'access',
|
|
12974
|
+
(file) => _optionalChain([path19, 'access', _406 => _406.pathPattern, 'optionalAccess', _407 => _407.includes, 'call', _408 => _408(file)]) || _optionalChain([path19, 'access', _409 => _409.pathPattern, 'optionalAccess', _410 => _410.match, 'call', _411 => _411(file)]) || minimatch(path19.pathPattern, file)
|
|
12937
12975
|
)
|
|
12938
12976
|
);
|
|
12939
12977
|
return { ...bucket, paths };
|
|
@@ -12953,7 +12991,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
12953
12991
|
});
|
|
12954
12992
|
}
|
|
12955
12993
|
}
|
|
12956
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
12994
|
+
const targetLocales = _optionalChain([flags, 'access', _412 => _412.locale, 'optionalAccess', _413 => _413.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
12957
12995
|
let totalSourceKeyCount = 0;
|
|
12958
12996
|
let uniqueKeysToTranslate = 0;
|
|
12959
12997
|
let totalExistingTranslations = 0;
|
|
@@ -13361,12 +13399,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
13361
13399
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
13362
13400
|
docUrl: "bucketNotFound"
|
|
13363
13401
|
});
|
|
13364
|
-
} else if (_optionalChain([flags, 'access',
|
|
13402
|
+
} else if (_optionalChain([flags, 'access', _414 => _414.locale, 'optionalAccess', _415 => _415.some, 'call', _416 => _416((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
13365
13403
|
throw new CLIError({
|
|
13366
13404
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
13367
13405
|
docUrl: "localeTargetNotFound"
|
|
13368
13406
|
});
|
|
13369
|
-
} else if (_optionalChain([flags, 'access',
|
|
13407
|
+
} else if (_optionalChain([flags, 'access', _417 => _417.bucket, 'optionalAccess', _418 => _418.some, 'call', _419 => _419(
|
|
13370
13408
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
13371
13409
|
)])) {
|
|
13372
13410
|
throw new CLIError({
|
|
@@ -13458,7 +13496,7 @@ async function renderHero2() {
|
|
|
13458
13496
|
// package.json
|
|
13459
13497
|
var package_default = {
|
|
13460
13498
|
name: "lingo.dev",
|
|
13461
|
-
version: "0.114.
|
|
13499
|
+
version: "0.114.1",
|
|
13462
13500
|
description: "Lingo.dev CLI",
|
|
13463
13501
|
private: false,
|
|
13464
13502
|
publishConfig: {
|
|
@@ -13749,7 +13787,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
|
|
|
13749
13787
|
if (options.file && options.file.length) {
|
|
13750
13788
|
buckets = buckets.map((bucket) => {
|
|
13751
13789
|
const paths = bucket.paths.filter(
|
|
13752
|
-
(bucketPath) => _optionalChain([options, 'access',
|
|
13790
|
+
(bucketPath) => _optionalChain([options, 'access', _420 => _420.file, 'optionalAccess', _421 => _421.some, 'call', _422 => _422((f) => bucketPath.pathPattern.includes(f))])
|
|
13753
13791
|
);
|
|
13754
13792
|
return { ...bucket, paths };
|
|
13755
13793
|
}).filter((bucket) => bucket.paths.length > 0);
|