lingo.dev 0.113.8 → 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 +250 -133
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +133 -16
- package/build/cli.mjs.map +1 -1
- package/package.json +3 -3
package/build/cli.cjs
CHANGED
|
@@ -1908,10 +1908,11 @@ function createDenormalizeLoader(options) {
|
|
|
1908
1908
|
return encodeURIComponent(String(key));
|
|
1909
1909
|
}
|
|
1910
1910
|
});
|
|
1911
|
-
const denormalized = {
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1911
|
+
const denormalized = { ...flattened };
|
|
1912
|
+
for (const [key, value] of Object.entries(preservedObjects)) {
|
|
1913
|
+
const encodedKey = encodeURIComponent(String(key));
|
|
1914
|
+
denormalized[encodedKey] = value;
|
|
1915
|
+
}
|
|
1915
1916
|
const keysMap = buildDenormalizedKeysMap(denormalized);
|
|
1916
1917
|
return { denormalized, keysMap };
|
|
1917
1918
|
},
|
|
@@ -2362,7 +2363,7 @@ async function parseAndroidDocument(input2) {
|
|
|
2362
2363
|
function buildPullResult(document) {
|
|
2363
2364
|
const result = {};
|
|
2364
2365
|
for (const resource of document.resourceNodes) {
|
|
2365
|
-
if (!resource
|
|
2366
|
+
if (!isTranslatable(resource)) {
|
|
2366
2367
|
continue;
|
|
2367
2368
|
}
|
|
2368
2369
|
switch (resource.type) {
|
|
@@ -2405,6 +2406,9 @@ function buildPullResult(document) {
|
|
|
2405
2406
|
}
|
|
2406
2407
|
return result;
|
|
2407
2408
|
}
|
|
2409
|
+
function isTranslatable(resource) {
|
|
2410
|
+
return resource.translatable;
|
|
2411
|
+
}
|
|
2408
2412
|
function buildTranslatedDocument(payload, existingDocument, sourceDocument) {
|
|
2409
2413
|
const templateDocument = sourceDocument;
|
|
2410
2414
|
const finalDocument = cloneDocumentStructure(templateDocument);
|
|
@@ -2433,6 +2437,9 @@ function buildTranslatedDocument(payload, existingDocument, sourceDocument) {
|
|
|
2433
2437
|
if (finalMap.has(resource.name)) {
|
|
2434
2438
|
continue;
|
|
2435
2439
|
}
|
|
2440
|
+
if (!isTranslatable(resource)) {
|
|
2441
|
+
continue;
|
|
2442
|
+
}
|
|
2436
2443
|
const cloned = cloneResourceNode(resource);
|
|
2437
2444
|
appendResourceNode(finalDocument, cloned);
|
|
2438
2445
|
finalMap.set(cloned.name, cloned);
|
|
@@ -2549,7 +2556,7 @@ function appendResourceNode(document, resourceNode) {
|
|
|
2549
2556
|
document.resourceNodes.push(resourceNode);
|
|
2550
2557
|
}
|
|
2551
2558
|
function setTextualNodeContent(node, value, useCdata) {
|
|
2552
|
-
const escapedValue = useCdata ? value : escapeAndroidString(value);
|
|
2559
|
+
const escapedValue = useCdata ? escapeApostrophesOnly(value) : escapeAndroidString(value);
|
|
2553
2560
|
node._ = escapedValue;
|
|
2554
2561
|
node.$$ = _nullishCoalesce(node.$$, () => ( []));
|
|
2555
2562
|
let textNode = node.$$.find(
|
|
@@ -2560,7 +2567,7 @@ function setTextualNodeContent(node, value, useCdata) {
|
|
|
2560
2567
|
node.$$.push(textNode);
|
|
2561
2568
|
}
|
|
2562
2569
|
textNode["#name"] = useCdata ? "__cdata" : "__text__";
|
|
2563
|
-
textNode._ =
|
|
2570
|
+
textNode._ = escapedValue;
|
|
2564
2571
|
}
|
|
2565
2572
|
function buildResourceNameMap(document) {
|
|
2566
2573
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -2720,6 +2727,9 @@ function asInteger(value, name) {
|
|
|
2720
2727
|
function escapeAndroidString(value) {
|
|
2721
2728
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/(?<!\\)'/g, "\\'");
|
|
2722
2729
|
}
|
|
2730
|
+
function escapeApostrophesOnly(value) {
|
|
2731
|
+
return value.replace(/(?<!\\)'/g, "\\'");
|
|
2732
|
+
}
|
|
2723
2733
|
function segmentsToString(segments) {
|
|
2724
2734
|
return segments.map((segment) => segment.value).join("");
|
|
2725
2735
|
}
|
|
@@ -2850,13 +2860,42 @@ function createResourceNodeFromValue(name, value) {
|
|
|
2850
2860
|
}
|
|
2851
2861
|
}
|
|
2852
2862
|
function cloneDocumentStructure(document) {
|
|
2863
|
+
const translatableResources = document.resourceNodes.filter(isTranslatable);
|
|
2853
2864
|
const resourcesClone = deepClone(document.resources);
|
|
2854
2865
|
const lookup = buildResourceLookup(resourcesClone);
|
|
2855
2866
|
const resourceNodes = [];
|
|
2856
|
-
for (const resource of
|
|
2867
|
+
for (const resource of translatableResources) {
|
|
2857
2868
|
const cloned = cloneResourceNodeFromLookup(resource, lookup);
|
|
2858
2869
|
resourceNodes.push(cloned);
|
|
2859
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
|
+
}
|
|
2860
2899
|
return {
|
|
2861
2900
|
resources: resourcesClone,
|
|
2862
2901
|
resourceNodes
|
|
@@ -2866,8 +2905,8 @@ function buildResourceLookup(resources) {
|
|
|
2866
2905
|
const lookup = /* @__PURE__ */ new Map();
|
|
2867
2906
|
const children = Array.isArray(resources.$$) ? resources.$$ : [];
|
|
2868
2907
|
for (const child of children) {
|
|
2869
|
-
const type = _optionalChain([child, 'optionalAccess',
|
|
2870
|
-
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]);
|
|
2871
2910
|
if (!type || !name || !isResourceElementName(type)) {
|
|
2872
2911
|
continue;
|
|
2873
2912
|
}
|
|
@@ -2896,7 +2935,7 @@ function cloneResourceNodeFromLookup(resource, lookup) {
|
|
|
2896
2935
|
}
|
|
2897
2936
|
case "string-array": {
|
|
2898
2937
|
const childItems = (Array.isArray(node.$$) ? node.$$ : []).filter(
|
|
2899
|
-
(child) => _optionalChain([child, 'optionalAccess',
|
|
2938
|
+
(child) => _optionalChain([child, 'optionalAccess', _135 => _135["#name"]]) === "item"
|
|
2900
2939
|
);
|
|
2901
2940
|
node.item = childItems;
|
|
2902
2941
|
if (childItems.length < resource.items.length) {
|
|
@@ -2925,12 +2964,12 @@ function cloneResourceNodeFromLookup(resource, lookup) {
|
|
|
2925
2964
|
}
|
|
2926
2965
|
case "plurals": {
|
|
2927
2966
|
const childItems = (Array.isArray(node.$$) ? node.$$ : []).filter(
|
|
2928
|
-
(child) => _optionalChain([child, 'optionalAccess',
|
|
2967
|
+
(child) => _optionalChain([child, 'optionalAccess', _136 => _136["#name"]]) === "item"
|
|
2929
2968
|
);
|
|
2930
2969
|
node.item = childItems;
|
|
2931
2970
|
const itemMap = /* @__PURE__ */ new Map();
|
|
2932
2971
|
for (const item of childItems) {
|
|
2933
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
2972
|
+
if (_optionalChain([item, 'optionalAccess', _137 => _137.$, 'optionalAccess', _138 => _138.quantity])) {
|
|
2934
2973
|
itemMap.set(item.$.quantity, item);
|
|
2935
2974
|
}
|
|
2936
2975
|
}
|
|
@@ -3220,7 +3259,7 @@ var _sync3 = require('csv-stringify/sync');
|
|
|
3220
3259
|
|
|
3221
3260
|
function detectKeyColumnName(csvString) {
|
|
3222
3261
|
const row = _sync.parse.call(void 0, csvString)[0];
|
|
3223
|
-
const firstColumn = _optionalChain([row, 'optionalAccess',
|
|
3262
|
+
const firstColumn = _optionalChain([row, 'optionalAccess', _139 => _139[0], 'optionalAccess', _140 => _140.trim, 'call', _141 => _141()]);
|
|
3224
3263
|
return firstColumn || "KEY";
|
|
3225
3264
|
}
|
|
3226
3265
|
function createCsvLoader() {
|
|
@@ -3322,7 +3361,7 @@ function createHtmlLoader() {
|
|
|
3322
3361
|
break;
|
|
3323
3362
|
}
|
|
3324
3363
|
const siblings = Array.from(parent.childNodes).filter(
|
|
3325
|
-
(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()])
|
|
3326
3365
|
);
|
|
3327
3366
|
const index = siblings.indexOf(current);
|
|
3328
3367
|
if (index !== -1) {
|
|
@@ -3358,15 +3397,15 @@ function createHtmlLoader() {
|
|
|
3358
3397
|
}
|
|
3359
3398
|
});
|
|
3360
3399
|
Array.from(element.childNodes).filter(
|
|
3361
|
-
(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()])
|
|
3362
3401
|
).forEach(processNode);
|
|
3363
3402
|
}
|
|
3364
3403
|
};
|
|
3365
3404
|
Array.from(document.head.childNodes).filter(
|
|
3366
|
-
(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()])
|
|
3367
3406
|
).forEach(processNode);
|
|
3368
3407
|
Array.from(document.body.childNodes).filter(
|
|
3369
|
-
(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()])
|
|
3370
3409
|
).forEach(processNode);
|
|
3371
3410
|
return result;
|
|
3372
3411
|
},
|
|
@@ -3391,7 +3430,7 @@ function createHtmlLoader() {
|
|
|
3391
3430
|
for (let i = 0; i < indices.length; i++) {
|
|
3392
3431
|
const index = parseInt(indices[i]);
|
|
3393
3432
|
const siblings = Array.from(parent.childNodes).filter(
|
|
3394
|
-
(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()])
|
|
3395
3434
|
);
|
|
3396
3435
|
if (index >= siblings.length) {
|
|
3397
3436
|
if (i === indices.length - 1) {
|
|
@@ -3442,7 +3481,7 @@ function createMarkdownLoader() {
|
|
|
3442
3481
|
yaml: yamlEngine
|
|
3443
3482
|
}
|
|
3444
3483
|
});
|
|
3445
|
-
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);
|
|
3446
3485
|
return {
|
|
3447
3486
|
...Object.fromEntries(
|
|
3448
3487
|
sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
|
|
@@ -3461,7 +3500,7 @@ function createMarkdownLoader() {
|
|
|
3461
3500
|
);
|
|
3462
3501
|
let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(
|
|
3463
3502
|
([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())
|
|
3464
|
-
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess',
|
|
3503
|
+
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _159 => _159.trim, 'call', _160 => _160()]), () => ( ""))).filter(Boolean).join("\n\n");
|
|
3465
3504
|
if (Object.keys(frontmatter).length > 0) {
|
|
3466
3505
|
content = `
|
|
3467
3506
|
${content}`;
|
|
@@ -3486,7 +3525,7 @@ function createMarkdocLoader() {
|
|
|
3486
3525
|
const result = {};
|
|
3487
3526
|
const counters = {};
|
|
3488
3527
|
traverseAndExtract(ast, "", result, counters);
|
|
3489
|
-
if (_optionalChain([ast, 'access',
|
|
3528
|
+
if (_optionalChain([ast, 'access', _161 => _161.attributes, 'optionalAccess', _162 => _162.frontmatter])) {
|
|
3490
3529
|
const frontmatter = _yaml2.default.parse(ast.attributes.frontmatter);
|
|
3491
3530
|
Object.entries(frontmatter).forEach(([key, value]) => {
|
|
3492
3531
|
if (typeof value === "string") {
|
|
@@ -3532,7 +3571,7 @@ function traverseAndExtract(node, path19, result, counters, parentType) {
|
|
|
3532
3571
|
if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
|
|
3533
3572
|
semanticType = nodeSemanticType;
|
|
3534
3573
|
}
|
|
3535
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
3574
|
+
if (node.type === "text" && _optionalChain([node, 'access', _163 => _163.attributes, 'optionalAccess', _164 => _164.content])) {
|
|
3536
3575
|
const content = node.attributes.content;
|
|
3537
3576
|
if (typeof content === "string" && content.trim()) {
|
|
3538
3577
|
if (semanticType) {
|
|
@@ -3559,7 +3598,7 @@ function buildPathMap(node, path19, counters, pathMap, parentType) {
|
|
|
3559
3598
|
if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
|
|
3560
3599
|
semanticType = nodeSemanticType;
|
|
3561
3600
|
}
|
|
3562
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
3601
|
+
if (node.type === "text" && _optionalChain([node, 'access', _165 => _165.attributes, 'optionalAccess', _166 => _166.content])) {
|
|
3563
3602
|
const content = node.attributes.content;
|
|
3564
3603
|
if (typeof content === "string" && content.trim()) {
|
|
3565
3604
|
if (semanticType) {
|
|
@@ -3582,7 +3621,7 @@ function applyTranslations(node, path19, data, pathMap) {
|
|
|
3582
3621
|
if (!node || typeof node !== "object") {
|
|
3583
3622
|
return;
|
|
3584
3623
|
}
|
|
3585
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
3624
|
+
if (node.type === "text" && _optionalChain([node, 'access', _167 => _167.attributes, 'optionalAccess', _168 => _168.content])) {
|
|
3586
3625
|
const content = node.attributes.content;
|
|
3587
3626
|
if (typeof content === "string") {
|
|
3588
3627
|
const contentPath = path19 ? `${path19}/attributes/content` : "attributes/content";
|
|
@@ -3632,7 +3671,7 @@ function isSkippableLine(line) {
|
|
|
3632
3671
|
function parsePropertyLine(line) {
|
|
3633
3672
|
const [key, ...valueParts] = line.split("=");
|
|
3634
3673
|
return {
|
|
3635
|
-
key: _optionalChain([key, 'optionalAccess',
|
|
3674
|
+
key: _optionalChain([key, 'optionalAccess', _169 => _169.trim, 'call', _170 => _170()]) || "",
|
|
3636
3675
|
value: valueParts.join("=").trim()
|
|
3637
3676
|
};
|
|
3638
3677
|
}
|
|
@@ -3924,7 +3963,7 @@ var Parser = class {
|
|
|
3924
3963
|
}
|
|
3925
3964
|
}
|
|
3926
3965
|
expect(type) {
|
|
3927
|
-
if (_optionalChain([this, 'access',
|
|
3966
|
+
if (_optionalChain([this, 'access', _171 => _171.current, 'call', _172 => _172(), 'optionalAccess', _173 => _173.type]) === type) {
|
|
3928
3967
|
this.advance();
|
|
3929
3968
|
return true;
|
|
3930
3969
|
}
|
|
@@ -4001,7 +4040,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4001
4040
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
4002
4041
|
continue;
|
|
4003
4042
|
}
|
|
4004
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
4043
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _174 => _174.localizations, 'optionalAccess', _175 => _175[locale]]);
|
|
4005
4044
|
if (langTranslationEntity) {
|
|
4006
4045
|
if ("stringUnit" in langTranslationEntity) {
|
|
4007
4046
|
resultData[translationKey] = langTranslationEntity.stringUnit.value;
|
|
@@ -4010,7 +4049,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4010
4049
|
resultData[translationKey] = {};
|
|
4011
4050
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
4012
4051
|
for (const form in pluralForms) {
|
|
4013
|
-
if (_optionalChain([pluralForms, 'access',
|
|
4052
|
+
if (_optionalChain([pluralForms, 'access', _176 => _176[form], 'optionalAccess', _177 => _177.stringUnit, 'optionalAccess', _178 => _178.value])) {
|
|
4014
4053
|
resultData[translationKey][form] = pluralForms[form].stringUnit.value;
|
|
4015
4054
|
}
|
|
4016
4055
|
}
|
|
@@ -4036,7 +4075,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4036
4075
|
const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
|
|
4037
4076
|
if (typeof value === "string") {
|
|
4038
4077
|
langDataToMerge.strings[key] = {
|
|
4039
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
4078
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _179 => _179.strings, 'optionalAccess', _180 => _180[key], 'optionalAccess', _181 => _181.extractionState]),
|
|
4040
4079
|
localizations: {
|
|
4041
4080
|
[locale]: {
|
|
4042
4081
|
stringUnit: {
|
|
@@ -4094,7 +4133,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4094
4133
|
for (const [locale, localization] of Object.entries(
|
|
4095
4134
|
entity.localizations
|
|
4096
4135
|
)) {
|
|
4097
|
-
if (_optionalChain([localization, 'access',
|
|
4136
|
+
if (_optionalChain([localization, 'access', _182 => _182.variations, 'optionalAccess', _183 => _183.plural])) {
|
|
4098
4137
|
const pluralForms = localization.variations.plural;
|
|
4099
4138
|
for (const form in pluralForms) {
|
|
4100
4139
|
const pluralKey = `${translationKey}/${form}`;
|
|
@@ -4114,7 +4153,7 @@ function _removeLocale(input2, locale) {
|
|
|
4114
4153
|
const { strings } = input2;
|
|
4115
4154
|
const newStrings = _lodash2.default.cloneDeep(strings);
|
|
4116
4155
|
for (const [key, value] of Object.entries(newStrings)) {
|
|
4117
|
-
if (_optionalChain([value, 'access',
|
|
4156
|
+
if (_optionalChain([value, 'access', _184 => _184.localizations, 'optionalAccess', _185 => _185[locale]])) {
|
|
4118
4157
|
delete value.localizations[locale];
|
|
4119
4158
|
}
|
|
4120
4159
|
}
|
|
@@ -4306,14 +4345,14 @@ function pluralWithMetaToXcstrings(data) {
|
|
|
4306
4345
|
if (element.type === "literal") {
|
|
4307
4346
|
text += element.value;
|
|
4308
4347
|
} else if (element.type === "pound") {
|
|
4309
|
-
const pluralVar = Object.entries(_optionalChain([data, 'access',
|
|
4348
|
+
const pluralVar = Object.entries(_optionalChain([data, 'access', _186 => _186._meta, 'optionalAccess', _187 => _187.variables]) || {}).find(
|
|
4310
4349
|
([_36, meta]) => meta.role === "plural"
|
|
4311
4350
|
);
|
|
4312
|
-
text += _optionalChain([pluralVar, 'optionalAccess',
|
|
4351
|
+
text += _optionalChain([pluralVar, 'optionalAccess', _188 => _188[1], 'access', _189 => _189.format]) || "%lld";
|
|
4313
4352
|
} else if (element.type === "argument") {
|
|
4314
4353
|
const varName = element.value;
|
|
4315
|
-
const varMeta = _optionalChain([data, 'access',
|
|
4316
|
-
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]) || "%@";
|
|
4317
4356
|
}
|
|
4318
4357
|
}
|
|
4319
4358
|
let xcstringsFormName = form;
|
|
@@ -4691,8 +4730,8 @@ async function formatDataWithBiome(data, filePath, options) {
|
|
|
4691
4730
|
});
|
|
4692
4731
|
return formatted.content;
|
|
4693
4732
|
} catch (error) {
|
|
4694
|
-
const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access',
|
|
4695
|
-
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")])) {
|
|
4696
4735
|
} else {
|
|
4697
4736
|
console.log(`\u26A0\uFE0F Biome skipped ${path14.default.basename(filePath)}`);
|
|
4698
4737
|
if (errorMessage) {
|
|
@@ -4739,7 +4778,7 @@ function createPoDataLoader(params) {
|
|
|
4739
4778
|
Object.entries(entries).forEach(([msgid, entry]) => {
|
|
4740
4779
|
if (msgid && entry.msgid) {
|
|
4741
4780
|
const context = entry.msgctxt || "";
|
|
4742
|
-
const fullEntry = _optionalChain([parsedPo, 'access',
|
|
4781
|
+
const fullEntry = _optionalChain([parsedPo, 'access', _202 => _202.translations, 'access', _203 => _203[context], 'optionalAccess', _204 => _204[msgid]]);
|
|
4743
4782
|
if (fullEntry) {
|
|
4744
4783
|
result[msgid] = fullEntry;
|
|
4745
4784
|
}
|
|
@@ -4749,8 +4788,8 @@ function createPoDataLoader(params) {
|
|
|
4749
4788
|
return result;
|
|
4750
4789
|
},
|
|
4751
4790
|
async push(locale, data, originalInput, originalLocale, pullInput) {
|
|
4752
|
-
const currentSections = _optionalChain([pullInput, 'optionalAccess',
|
|
4753
|
-
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)]) || [];
|
|
4754
4793
|
const result = originalSections.map((section) => {
|
|
4755
4794
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
4756
4795
|
if (Object.keys(sectionPo.translations).length === 0) {
|
|
@@ -4819,8 +4858,8 @@ function createPoContentLoader() {
|
|
|
4819
4858
|
{
|
|
4820
4859
|
...entry,
|
|
4821
4860
|
msgstr: [
|
|
4822
|
-
_optionalChain([data, 'access',
|
|
4823
|
-
_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
|
|
4824
4863
|
].filter(Boolean)
|
|
4825
4864
|
}
|
|
4826
4865
|
]).fromPairs().value();
|
|
@@ -4942,7 +4981,7 @@ function pullV1(xliffElement, locale, originalLocale) {
|
|
|
4942
4981
|
let key = getTransUnitKey(unit);
|
|
4943
4982
|
if (!key) return;
|
|
4944
4983
|
if (seenKeys.has(key)) {
|
|
4945
|
-
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()]);
|
|
4946
4985
|
if (id) {
|
|
4947
4986
|
key = `${key}#${id}`;
|
|
4948
4987
|
} else {
|
|
@@ -4990,7 +5029,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
4990
5029
|
let key = getTransUnitKey(unit);
|
|
4991
5030
|
if (!key) return;
|
|
4992
5031
|
if (seenKeys.has(key)) {
|
|
4993
|
-
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()]);
|
|
4994
5033
|
if (id) {
|
|
4995
5034
|
key = `${key}#${id}`;
|
|
4996
5035
|
} else {
|
|
@@ -5032,7 +5071,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
5032
5071
|
const translationKeys = new Set(Object.keys(translations));
|
|
5033
5072
|
existingUnits.forEach((unit, key) => {
|
|
5034
5073
|
if (!translationKeys.has(key)) {
|
|
5035
|
-
_optionalChain([unit, 'access',
|
|
5074
|
+
_optionalChain([unit, 'access', _225 => _225.parentNode, 'optionalAccess', _226 => _226.removeChild, 'call', _227 => _227(unit)]);
|
|
5036
5075
|
}
|
|
5037
5076
|
});
|
|
5038
5077
|
return serializeWithDeclaration(
|
|
@@ -5075,18 +5114,18 @@ function traverseUnitsV2(container, fileId, currentPath, result) {
|
|
|
5075
5114
|
Array.from(container.children).forEach((child) => {
|
|
5076
5115
|
const tagName = child.tagName;
|
|
5077
5116
|
if (tagName === "unit") {
|
|
5078
|
-
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()]);
|
|
5079
5118
|
if (!unitId) return;
|
|
5080
5119
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
5081
5120
|
const segment = child.querySelector("segment");
|
|
5082
|
-
const source = _optionalChain([segment, 'optionalAccess',
|
|
5121
|
+
const source = _optionalChain([segment, 'optionalAccess', _232 => _232.querySelector, 'call', _233 => _233("source")]);
|
|
5083
5122
|
if (source) {
|
|
5084
5123
|
result[key] = extractTextContent(source);
|
|
5085
5124
|
} else {
|
|
5086
5125
|
result[key] = unitId;
|
|
5087
5126
|
}
|
|
5088
5127
|
} else if (tagName === "group") {
|
|
5089
|
-
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()]);
|
|
5090
5129
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
5091
5130
|
traverseUnitsV2(child, fileId, newPath, result);
|
|
5092
5131
|
}
|
|
@@ -5122,12 +5161,12 @@ function indexUnitsV2(container, fileId, currentPath, index) {
|
|
|
5122
5161
|
Array.from(container.children).forEach((child) => {
|
|
5123
5162
|
const tagName = child.tagName;
|
|
5124
5163
|
if (tagName === "unit") {
|
|
5125
|
-
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()]);
|
|
5126
5165
|
if (!unitId) return;
|
|
5127
5166
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
5128
5167
|
index.set(key, child);
|
|
5129
5168
|
} else if (tagName === "group") {
|
|
5130
|
-
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()]);
|
|
5131
5170
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
5132
5171
|
indexUnitsV2(child, fileId, newPath, index);
|
|
5133
5172
|
}
|
|
@@ -5148,9 +5187,9 @@ function updateUnitV2(unit, value) {
|
|
|
5148
5187
|
setTextContent(source, value);
|
|
5149
5188
|
}
|
|
5150
5189
|
function getTransUnitKey(transUnit) {
|
|
5151
|
-
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()]);
|
|
5152
5191
|
if (resname) return resname;
|
|
5153
|
-
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()]);
|
|
5154
5193
|
if (id) return id;
|
|
5155
5194
|
const sourceElement = transUnit.querySelector("source");
|
|
5156
5195
|
if (sourceElement) {
|
|
@@ -5207,7 +5246,7 @@ function formatXml(xml) {
|
|
|
5207
5246
|
if (cdataNode) {
|
|
5208
5247
|
return `${indent2}${openTag}<![CDATA[${cdataNode.nodeValue}]]></${tagName}>`;
|
|
5209
5248
|
}
|
|
5210
|
-
const textContent = _optionalChain([element, 'access',
|
|
5249
|
+
const textContent = _optionalChain([element, 'access', _254 => _254.textContent, 'optionalAccess', _255 => _255.trim, 'call', _256 => _256()]) || "";
|
|
5211
5250
|
const hasOnlyText = element.childNodes.length === 1 && element.childNodes[0].nodeType === 3;
|
|
5212
5251
|
if (hasOnlyText && textContent) {
|
|
5213
5252
|
return `${indent2}${openTag}${textContent}</${tagName}>`;
|
|
@@ -5500,7 +5539,7 @@ function createDatoClient(params) {
|
|
|
5500
5539
|
ids: !records.length ? void 0 : records.join(",")
|
|
5501
5540
|
}
|
|
5502
5541
|
}).catch(
|
|
5503
|
-
(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)
|
|
5504
5543
|
);
|
|
5505
5544
|
},
|
|
5506
5545
|
findRecordsForModel: async (modelId, records) => {
|
|
@@ -5511,10 +5550,10 @@ function createDatoClient(params) {
|
|
|
5511
5550
|
filter: {
|
|
5512
5551
|
type: modelId,
|
|
5513
5552
|
only_valid: "true",
|
|
5514
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
5553
|
+
ids: !_optionalChain([records, 'optionalAccess', _261 => _261.length]) ? void 0 : records.join(",")
|
|
5515
5554
|
}
|
|
5516
5555
|
}).catch(
|
|
5517
|
-
(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)
|
|
5518
5557
|
);
|
|
5519
5558
|
return result;
|
|
5520
5559
|
} catch (_error) {
|
|
@@ -5530,10 +5569,10 @@ function createDatoClient(params) {
|
|
|
5530
5569
|
updateRecord: async (id, payload) => {
|
|
5531
5570
|
try {
|
|
5532
5571
|
await dato.items.update(id, payload).catch(
|
|
5533
|
-
(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)
|
|
5534
5573
|
);
|
|
5535
5574
|
} catch (_error) {
|
|
5536
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
5575
|
+
if (_optionalChain([_error, 'optionalAccess', _270 => _270.attributes, 'optionalAccess', _271 => _271.details, 'optionalAccess', _272 => _272.message])) {
|
|
5537
5576
|
throw new Error(
|
|
5538
5577
|
[
|
|
5539
5578
|
`${_error.attributes.details.message}`,
|
|
@@ -5555,10 +5594,10 @@ function createDatoClient(params) {
|
|
|
5555
5594
|
enableFieldLocalization: async (args) => {
|
|
5556
5595
|
try {
|
|
5557
5596
|
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch(
|
|
5558
|
-
(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)
|
|
5559
5598
|
);
|
|
5560
5599
|
} catch (_error) {
|
|
5561
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
5600
|
+
if (_optionalChain([_error, 'optionalAccess', _277 => _277.attributes, 'optionalAccess', _278 => _278.code]) === "NOT_FOUND") {
|
|
5562
5601
|
throw new Error(
|
|
5563
5602
|
[
|
|
5564
5603
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -5566,7 +5605,7 @@ function createDatoClient(params) {
|
|
|
5566
5605
|
].join("\n\n")
|
|
5567
5606
|
);
|
|
5568
5607
|
}
|
|
5569
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
5608
|
+
if (_optionalChain([_error, 'optionalAccess', _279 => _279.attributes, 'optionalAccess', _280 => _280.details, 'optionalAccess', _281 => _281.message])) {
|
|
5570
5609
|
throw new Error(
|
|
5571
5610
|
[
|
|
5572
5611
|
`${_error.attributes.details.message}`,
|
|
@@ -5644,7 +5683,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
5644
5683
|
const records = await dato.findRecordsForModel(modelId);
|
|
5645
5684
|
const recordChoices = createRecordChoices(
|
|
5646
5685
|
records,
|
|
5647
|
-
_optionalChain([config, 'access',
|
|
5686
|
+
_optionalChain([config, 'access', _282 => _282.models, 'access', _283 => _283[modelId], 'optionalAccess', _284 => _284.records]) || [],
|
|
5648
5687
|
project
|
|
5649
5688
|
);
|
|
5650
5689
|
const selectedRecords = await promptRecordSelection(
|
|
@@ -5663,14 +5702,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
5663
5702
|
},
|
|
5664
5703
|
async pull(locale, input2, initCtx) {
|
|
5665
5704
|
const result = {};
|
|
5666
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
5667
|
-
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]) || [];
|
|
5668
5707
|
const recordIds = records.map((record) => record.id);
|
|
5669
5708
|
records = await dato.findRecords(recordIds);
|
|
5670
5709
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
5671
5710
|
if (records.length > 0) {
|
|
5672
5711
|
result[modelId] = {
|
|
5673
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
5712
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _289 => _289.models, 'optionalAccess', _290 => _290[modelId], 'optionalAccess', _291 => _291.fields]) || [],
|
|
5674
5713
|
records
|
|
5675
5714
|
};
|
|
5676
5715
|
}
|
|
@@ -5733,7 +5772,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
5733
5772
|
return records.map((record) => ({
|
|
5734
5773
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
5735
5774
|
value: record.id,
|
|
5736
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
5775
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _292 => _292.includes, 'call', _293 => _293(record.id)])
|
|
5737
5776
|
}));
|
|
5738
5777
|
}
|
|
5739
5778
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -6052,7 +6091,7 @@ function createVttLoader() {
|
|
|
6052
6091
|
if (!input2) {
|
|
6053
6092
|
return "";
|
|
6054
6093
|
}
|
|
6055
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
6094
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _294 => _294.parse, 'call', _295 => _295(input2), 'optionalAccess', _296 => _296.cues]);
|
|
6056
6095
|
if (Object.keys(vtt).length === 0) {
|
|
6057
6096
|
return {};
|
|
6058
6097
|
} else {
|
|
@@ -6115,7 +6154,7 @@ function variableExtractLoader(params) {
|
|
|
6115
6154
|
for (let i = 0; i < matches.length; i++) {
|
|
6116
6155
|
const match2 = matches[i];
|
|
6117
6156
|
const currentValue = result[key].value;
|
|
6118
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
6157
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _297 => _297.replace, 'call', _298 => _298(match2, `{variable:${i}}`)]);
|
|
6119
6158
|
result[key].value = newValue;
|
|
6120
6159
|
result[key].variables[i] = match2;
|
|
6121
6160
|
}
|
|
@@ -6128,7 +6167,7 @@ function variableExtractLoader(params) {
|
|
|
6128
6167
|
result[key] = valueObj.value;
|
|
6129
6168
|
const resultValue = result[key];
|
|
6130
6169
|
if (isICUPluralObject(resultValue)) {
|
|
6131
|
-
const originalValue = _optionalChain([originalInput, 'optionalAccess',
|
|
6170
|
+
const originalValue = _optionalChain([originalInput, 'optionalAccess', _299 => _299[key]]);
|
|
6132
6171
|
if (isICUPluralObject(originalValue) && originalValue._meta) {
|
|
6133
6172
|
resultValue._meta = originalValue._meta;
|
|
6134
6173
|
resultValue[Symbol.for("@lingo.dev/icu-plural-object")] = true;
|
|
@@ -6138,7 +6177,7 @@ function variableExtractLoader(params) {
|
|
|
6138
6177
|
const variable = valueObj.variables[i];
|
|
6139
6178
|
const currentValue = result[key];
|
|
6140
6179
|
if (typeof currentValue === "string") {
|
|
6141
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
6180
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _300 => _300.replace, 'call', _301 => _301(`{variable:${i}}`, variable)]);
|
|
6142
6181
|
result[key] = newValue;
|
|
6143
6182
|
}
|
|
6144
6183
|
}
|
|
@@ -6339,7 +6378,7 @@ function createVueJsonLoader() {
|
|
|
6339
6378
|
return createLoader({
|
|
6340
6379
|
pull: async (locale, input2, ctx) => {
|
|
6341
6380
|
const parsed = parseVueFile(input2);
|
|
6342
|
-
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess',
|
|
6381
|
+
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _302 => _302.i18n, 'optionalAccess', _303 => _303[locale]]), () => ( {}));
|
|
6343
6382
|
},
|
|
6344
6383
|
push: async (locale, data, originalInput) => {
|
|
6345
6384
|
const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
|
|
@@ -6524,7 +6563,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
|
|
|
6524
6563
|
objectExpression.properties.forEach((prop) => {
|
|
6525
6564
|
if (!t.isObjectProperty(prop)) return;
|
|
6526
6565
|
const key = getPropertyKey(prop);
|
|
6527
|
-
const incomingVal = _optionalChain([data, 'optionalAccess',
|
|
6566
|
+
const incomingVal = _optionalChain([data, 'optionalAccess', _304 => _304[key]]);
|
|
6528
6567
|
if (incomingVal === void 0) {
|
|
6529
6568
|
return;
|
|
6530
6569
|
}
|
|
@@ -6560,7 +6599,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
|
|
|
6560
6599
|
let modified = false;
|
|
6561
6600
|
arrayExpression.elements.forEach((element, index) => {
|
|
6562
6601
|
if (!element) return;
|
|
6563
|
-
const incomingVal = _optionalChain([incoming, 'optionalAccess',
|
|
6602
|
+
const incomingVal = _optionalChain([incoming, 'optionalAccess', _305 => _305[index]]);
|
|
6564
6603
|
if (incomingVal === void 0) return;
|
|
6565
6604
|
if (t.isStringLiteral(element) && typeof incomingVal === "string") {
|
|
6566
6605
|
if (element.value !== incomingVal) {
|
|
@@ -7051,7 +7090,7 @@ var AST = class _AST {
|
|
|
7051
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())];
|
|
7052
7091
|
if (this.isStart() && !this.type)
|
|
7053
7092
|
ret.unshift([]);
|
|
7054
|
-
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]) === "!")) {
|
|
7055
7094
|
ret.push({});
|
|
7056
7095
|
}
|
|
7057
7096
|
return ret;
|
|
@@ -7059,7 +7098,7 @@ var AST = class _AST {
|
|
|
7059
7098
|
isStart() {
|
|
7060
7099
|
if (this.#root === this)
|
|
7061
7100
|
return true;
|
|
7062
|
-
if (!_optionalChain([this, 'access',
|
|
7101
|
+
if (!_optionalChain([this, 'access', _308 => _308.#parent, 'optionalAccess', _309 => _309.isStart, 'call', _310 => _310()]))
|
|
7063
7102
|
return false;
|
|
7064
7103
|
if (this.#parentIndex === 0)
|
|
7065
7104
|
return true;
|
|
@@ -7075,12 +7114,12 @@ var AST = class _AST {
|
|
|
7075
7114
|
isEnd() {
|
|
7076
7115
|
if (this.#root === this)
|
|
7077
7116
|
return true;
|
|
7078
|
-
if (_optionalChain([this, 'access',
|
|
7117
|
+
if (_optionalChain([this, 'access', _311 => _311.#parent, 'optionalAccess', _312 => _312.type]) === "!")
|
|
7079
7118
|
return true;
|
|
7080
|
-
if (!_optionalChain([this, 'access',
|
|
7119
|
+
if (!_optionalChain([this, 'access', _313 => _313.#parent, 'optionalAccess', _314 => _314.isEnd, 'call', _315 => _315()]))
|
|
7081
7120
|
return false;
|
|
7082
7121
|
if (!this.type)
|
|
7083
|
-
return _optionalChain([this, 'access',
|
|
7122
|
+
return _optionalChain([this, 'access', _316 => _316.#parent, 'optionalAccess', _317 => _317.isEnd, 'call', _318 => _318()]);
|
|
7084
7123
|
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
|
7085
7124
|
return this.#parentIndex === pl - 1;
|
|
7086
7125
|
}
|
|
@@ -7325,7 +7364,7 @@ var AST = class _AST {
|
|
|
7325
7364
|
}
|
|
7326
7365
|
}
|
|
7327
7366
|
let end = "";
|
|
7328
|
-
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]) === "!") {
|
|
7329
7368
|
end = "(?:$|\\/)";
|
|
7330
7369
|
}
|
|
7331
7370
|
const final2 = start2 + src + end;
|
|
@@ -8415,7 +8454,7 @@ function createMdxSectionsSplit2Loader() {
|
|
|
8415
8454
|
const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
|
|
8416
8455
|
const result = {
|
|
8417
8456
|
frontmatter: data.frontmatter,
|
|
8418
|
-
codePlaceholders: _optionalChain([pullInput, 'optionalAccess',
|
|
8457
|
+
codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _321 => _321.codePlaceholders]) || {},
|
|
8419
8458
|
content
|
|
8420
8459
|
};
|
|
8421
8460
|
return result;
|
|
@@ -8423,7 +8462,7 @@ function createMdxSectionsSplit2Loader() {
|
|
|
8423
8462
|
});
|
|
8424
8463
|
}
|
|
8425
8464
|
|
|
8426
|
-
// src/cli/loaders/
|
|
8465
|
+
// src/cli/loaders/locked-patterns.ts
|
|
8427
8466
|
function extractLockedPatterns(content, patterns = []) {
|
|
8428
8467
|
let finalContent = content;
|
|
8429
8468
|
const lockedPlaceholders = {};
|
|
@@ -8450,7 +8489,7 @@ function extractLockedPatterns(content, patterns = []) {
|
|
|
8450
8489
|
lockedPlaceholders
|
|
8451
8490
|
};
|
|
8452
8491
|
}
|
|
8453
|
-
function
|
|
8492
|
+
function createLockedPatternsLoader(defaultPatterns) {
|
|
8454
8493
|
return createLoader({
|
|
8455
8494
|
async pull(locale, input2, initCtx, originalLocale) {
|
|
8456
8495
|
const patterns = defaultPatterns || [];
|
|
@@ -8784,18 +8823,24 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
8784
8823
|
case "android":
|
|
8785
8824
|
return composeLoaders(
|
|
8786
8825
|
createTextFileLoader(bucketPathPattern),
|
|
8826
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
8787
8827
|
createAndroidLoader(),
|
|
8788
8828
|
createEnsureKeyOrderLoader(),
|
|
8789
8829
|
createFlatLoader(),
|
|
8830
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
8831
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
8790
8832
|
createSyncLoader(),
|
|
8791
8833
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
8792
8834
|
);
|
|
8793
8835
|
case "csv":
|
|
8794
8836
|
return composeLoaders(
|
|
8795
8837
|
createTextFileLoader(bucketPathPattern),
|
|
8838
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
8796
8839
|
createCsvLoader(),
|
|
8797
8840
|
createEnsureKeyOrderLoader(),
|
|
8798
8841
|
createFlatLoader(),
|
|
8842
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
8843
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
8799
8844
|
createSyncLoader(),
|
|
8800
8845
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
8801
8846
|
);
|
|
@@ -8803,14 +8848,20 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
8803
8848
|
return composeLoaders(
|
|
8804
8849
|
createTextFileLoader(bucketPathPattern),
|
|
8805
8850
|
createFormatterLoader(options.formatter, "html", bucketPathPattern),
|
|
8851
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
8806
8852
|
createHtmlLoader(),
|
|
8853
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
8854
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
8807
8855
|
createSyncLoader(),
|
|
8808
8856
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
8809
8857
|
);
|
|
8810
8858
|
case "ejs":
|
|
8811
8859
|
return composeLoaders(
|
|
8812
8860
|
createTextFileLoader(bucketPathPattern),
|
|
8861
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
8813
8862
|
createEjsLoader(),
|
|
8863
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
8864
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
8814
8865
|
createSyncLoader(),
|
|
8815
8866
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
8816
8867
|
);
|
|
@@ -8818,6 +8869,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
8818
8869
|
return composeLoaders(
|
|
8819
8870
|
createTextFileLoader(bucketPathPattern),
|
|
8820
8871
|
createFormatterLoader(options.formatter, "json", bucketPathPattern),
|
|
8872
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
8821
8873
|
createJsonLoader(),
|
|
8822
8874
|
createEnsureKeyOrderLoader(),
|
|
8823
8875
|
createFlatLoader(),
|
|
@@ -8830,6 +8882,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
8830
8882
|
case "json5":
|
|
8831
8883
|
return composeLoaders(
|
|
8832
8884
|
createTextFileLoader(bucketPathPattern),
|
|
8885
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
8833
8886
|
createJson5Loader(),
|
|
8834
8887
|
createEnsureKeyOrderLoader(),
|
|
8835
8888
|
createFlatLoader(),
|
|
@@ -8842,6 +8895,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
8842
8895
|
case "jsonc":
|
|
8843
8896
|
return composeLoaders(
|
|
8844
8897
|
createTextFileLoader(bucketPathPattern),
|
|
8898
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
8845
8899
|
createJsoncLoader(),
|
|
8846
8900
|
createEnsureKeyOrderLoader(),
|
|
8847
8901
|
createFlatLoader(),
|
|
@@ -8855,16 +8909,22 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
8855
8909
|
return composeLoaders(
|
|
8856
8910
|
createTextFileLoader(bucketPathPattern),
|
|
8857
8911
|
createFormatterLoader(options.formatter, "markdown", bucketPathPattern),
|
|
8912
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
8858
8913
|
createMarkdownLoader(),
|
|
8914
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
8915
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
8859
8916
|
createSyncLoader(),
|
|
8860
8917
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
8861
8918
|
);
|
|
8862
8919
|
case "markdoc":
|
|
8863
8920
|
return composeLoaders(
|
|
8864
8921
|
createTextFileLoader(bucketPathPattern),
|
|
8922
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
8865
8923
|
createMarkdocLoader(),
|
|
8866
8924
|
createFlatLoader(),
|
|
8867
8925
|
createEnsureKeyOrderLoader(),
|
|
8926
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
8927
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
8868
8928
|
createSyncLoader(),
|
|
8869
8929
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
8870
8930
|
);
|
|
@@ -8873,7 +8933,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
8873
8933
|
createTextFileLoader(bucketPathPattern),
|
|
8874
8934
|
createFormatterLoader(options.formatter, "mdx", bucketPathPattern),
|
|
8875
8935
|
createMdxCodePlaceholderLoader(),
|
|
8876
|
-
|
|
8936
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
8877
8937
|
createMdxFrontmatterSplitLoader(),
|
|
8878
8938
|
createMdxSectionsSplit2Loader(),
|
|
8879
8939
|
createLocalizableMdxDocumentLoader(),
|
|
@@ -8887,9 +8947,12 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
8887
8947
|
case "po":
|
|
8888
8948
|
return composeLoaders(
|
|
8889
8949
|
createTextFileLoader(bucketPathPattern),
|
|
8950
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
8890
8951
|
createPoLoader(),
|
|
8891
8952
|
createFlatLoader(),
|
|
8892
8953
|
createEnsureKeyOrderLoader(),
|
|
8954
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
8955
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
8893
8956
|
createSyncLoader(),
|
|
8894
8957
|
createVariableLoader({ type: "python" }),
|
|
8895
8958
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
@@ -8897,23 +8960,32 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
8897
8960
|
case "properties":
|
|
8898
8961
|
return composeLoaders(
|
|
8899
8962
|
createTextFileLoader(bucketPathPattern),
|
|
8963
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
8900
8964
|
createPropertiesLoader(),
|
|
8965
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
8966
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
8901
8967
|
createSyncLoader(),
|
|
8902
8968
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
8903
8969
|
);
|
|
8904
8970
|
case "xcode-strings":
|
|
8905
8971
|
return composeLoaders(
|
|
8906
8972
|
createTextFileLoader(bucketPathPattern),
|
|
8973
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
8907
8974
|
createXcodeStringsLoader(),
|
|
8975
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
8976
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
8908
8977
|
createSyncLoader(),
|
|
8909
8978
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
8910
8979
|
);
|
|
8911
8980
|
case "xcode-stringsdict":
|
|
8912
8981
|
return composeLoaders(
|
|
8913
8982
|
createTextFileLoader(bucketPathPattern),
|
|
8983
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
8914
8984
|
createXcodeStringsdictLoader(),
|
|
8915
8985
|
createFlatLoader(),
|
|
8916
8986
|
createEnsureKeyOrderLoader(),
|
|
8987
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
8988
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
8917
8989
|
createSyncLoader(),
|
|
8918
8990
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
8919
8991
|
);
|
|
@@ -8921,6 +8993,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
8921
8993
|
return composeLoaders(
|
|
8922
8994
|
createTextFileLoader(bucketPathPattern),
|
|
8923
8995
|
createPlutilJsonTextLoader(),
|
|
8996
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
8924
8997
|
createJsonLoader(),
|
|
8925
8998
|
createXcodeXcstringsLoader(options.defaultLocale),
|
|
8926
8999
|
createFlatLoader(),
|
|
@@ -8935,12 +9008,14 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
8935
9008
|
return composeLoaders(
|
|
8936
9009
|
createTextFileLoader(bucketPathPattern),
|
|
8937
9010
|
createPlutilJsonTextLoader(),
|
|
9011
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
8938
9012
|
createJsonLoader(),
|
|
8939
9013
|
createXcodeXcstringsLoader(options.defaultLocale),
|
|
8940
9014
|
createXcodeXcstringsV2Loader(options.defaultLocale),
|
|
8941
9015
|
createFlatLoader({ shouldPreserveObject: isICUPluralObject }),
|
|
8942
9016
|
createEnsureKeyOrderLoader(),
|
|
8943
9017
|
createLockedKeysLoader(lockedKeys || []),
|
|
9018
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
8944
9019
|
createSyncLoader(),
|
|
8945
9020
|
createVariableLoader({ type: "ieee" }),
|
|
8946
9021
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
@@ -8949,6 +9024,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
8949
9024
|
return composeLoaders(
|
|
8950
9025
|
createTextFileLoader(bucketPathPattern),
|
|
8951
9026
|
createFormatterLoader(options.formatter, "yaml", bucketPathPattern),
|
|
9027
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
8952
9028
|
createYamlLoader(),
|
|
8953
9029
|
createFlatLoader(),
|
|
8954
9030
|
createEnsureKeyOrderLoader(),
|
|
@@ -8961,10 +9037,13 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
8961
9037
|
return composeLoaders(
|
|
8962
9038
|
createTextFileLoader(bucketPathPattern),
|
|
8963
9039
|
createFormatterLoader(options.formatter, "yaml", bucketPathPattern),
|
|
9040
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
8964
9041
|
createYamlLoader(),
|
|
8965
9042
|
createRootKeyLoader(true),
|
|
8966
9043
|
createFlatLoader(),
|
|
8967
9044
|
createEnsureKeyOrderLoader(),
|
|
9045
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
9046
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
8968
9047
|
createSyncLoader(),
|
|
8969
9048
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
8970
9049
|
);
|
|
@@ -8972,35 +9051,47 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
8972
9051
|
return composeLoaders(
|
|
8973
9052
|
createTextFileLoader(bucketPathPattern),
|
|
8974
9053
|
createFormatterLoader(options.formatter, "json", bucketPathPattern),
|
|
9054
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
8975
9055
|
createJsonLoader(),
|
|
8976
9056
|
createEnsureKeyOrderLoader(),
|
|
8977
9057
|
createFlutterLoader(),
|
|
8978
9058
|
createFlatLoader(),
|
|
9059
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
9060
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
8979
9061
|
createSyncLoader(),
|
|
8980
9062
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
8981
9063
|
);
|
|
8982
9064
|
case "xliff":
|
|
8983
9065
|
return composeLoaders(
|
|
8984
9066
|
createTextFileLoader(bucketPathPattern),
|
|
9067
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
8985
9068
|
createXliffLoader(),
|
|
8986
9069
|
createFlatLoader(),
|
|
8987
9070
|
createEnsureKeyOrderLoader(),
|
|
9071
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
9072
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
8988
9073
|
createSyncLoader(),
|
|
8989
9074
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
8990
9075
|
);
|
|
8991
9076
|
case "xml":
|
|
8992
9077
|
return composeLoaders(
|
|
8993
9078
|
createTextFileLoader(bucketPathPattern),
|
|
9079
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
8994
9080
|
createXmlLoader(),
|
|
8995
9081
|
createFlatLoader(),
|
|
8996
9082
|
createEnsureKeyOrderLoader(),
|
|
9083
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
9084
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
8997
9085
|
createSyncLoader(),
|
|
8998
9086
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
8999
9087
|
);
|
|
9000
9088
|
case "srt":
|
|
9001
9089
|
return composeLoaders(
|
|
9002
9090
|
createTextFileLoader(bucketPathPattern),
|
|
9091
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
9003
9092
|
createSrtLoader(),
|
|
9093
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
9094
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
9004
9095
|
createSyncLoader(),
|
|
9005
9096
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
9006
9097
|
);
|
|
@@ -9010,31 +9101,42 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
9010
9101
|
createSyncLoader(),
|
|
9011
9102
|
createFlatLoader(),
|
|
9012
9103
|
createEnsureKeyOrderLoader(),
|
|
9104
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
9105
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
9013
9106
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
9014
9107
|
);
|
|
9015
9108
|
case "vtt":
|
|
9016
9109
|
return composeLoaders(
|
|
9017
9110
|
createTextFileLoader(bucketPathPattern),
|
|
9111
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
9018
9112
|
createVttLoader(),
|
|
9113
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
9114
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
9019
9115
|
createSyncLoader(),
|
|
9020
9116
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
9021
9117
|
);
|
|
9022
9118
|
case "php":
|
|
9023
9119
|
return composeLoaders(
|
|
9024
9120
|
createTextFileLoader(bucketPathPattern),
|
|
9121
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
9025
9122
|
createPhpLoader(),
|
|
9026
9123
|
createSyncLoader(),
|
|
9027
9124
|
createFlatLoader(),
|
|
9028
9125
|
createEnsureKeyOrderLoader(),
|
|
9126
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
9127
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
9029
9128
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
9030
9129
|
);
|
|
9031
9130
|
case "vue-json":
|
|
9032
9131
|
return composeLoaders(
|
|
9033
9132
|
createTextFileLoader(bucketPathPattern),
|
|
9133
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
9034
9134
|
createVueJsonLoader(),
|
|
9035
9135
|
createSyncLoader(),
|
|
9036
9136
|
createFlatLoader(),
|
|
9037
9137
|
createEnsureKeyOrderLoader(),
|
|
9138
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
9139
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
9038
9140
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
9039
9141
|
);
|
|
9040
9142
|
case "typescript":
|
|
@@ -9045,6 +9147,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
9045
9147
|
"typescript",
|
|
9046
9148
|
bucketPathPattern
|
|
9047
9149
|
),
|
|
9150
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
9048
9151
|
createTypescriptLoader(),
|
|
9049
9152
|
createFlatLoader(),
|
|
9050
9153
|
createEnsureKeyOrderLoader(),
|
|
@@ -9056,7 +9159,10 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
9056
9159
|
case "txt":
|
|
9057
9160
|
return composeLoaders(
|
|
9058
9161
|
createTextFileLoader(bucketPathPattern),
|
|
9162
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
9059
9163
|
createTxtLoader(),
|
|
9164
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
9165
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
9060
9166
|
createSyncLoader(),
|
|
9061
9167
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
9062
9168
|
);
|
|
@@ -9064,6 +9170,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
9064
9170
|
return composeLoaders(
|
|
9065
9171
|
createTextFileLoader(bucketPathPattern),
|
|
9066
9172
|
createFormatterLoader(options.formatter, "json", bucketPathPattern),
|
|
9173
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
9067
9174
|
createJsonLoader(),
|
|
9068
9175
|
createJsonDictionaryLoader(),
|
|
9069
9176
|
createEnsureKeyOrderLoader(),
|
|
@@ -9448,7 +9555,7 @@ function createBasicTranslator(model, systemPrompt, settings = {}) {
|
|
|
9448
9555
|
]
|
|
9449
9556
|
});
|
|
9450
9557
|
const result = JSON.parse(response.text);
|
|
9451
|
-
return _optionalChain([result, 'optionalAccess',
|
|
9558
|
+
return _optionalChain([result, 'optionalAccess', _322 => _322.data]) || {};
|
|
9452
9559
|
}
|
|
9453
9560
|
}
|
|
9454
9561
|
function extractPayloadChunks(payload) {
|
|
@@ -9531,7 +9638,7 @@ function getPureModelProvider(provider) {
|
|
|
9531
9638
|
|
|
9532
9639
|
${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
|
|
9533
9640
|
`;
|
|
9534
|
-
switch (_optionalChain([provider, 'optionalAccess',
|
|
9641
|
+
switch (_optionalChain([provider, 'optionalAccess', _323 => _323.id])) {
|
|
9535
9642
|
case "openai": {
|
|
9536
9643
|
if (!process.env.OPENAI_API_KEY) {
|
|
9537
9644
|
throw new Error(
|
|
@@ -9589,7 +9696,7 @@ function getPureModelProvider(provider) {
|
|
|
9589
9696
|
})(provider.model);
|
|
9590
9697
|
}
|
|
9591
9698
|
default: {
|
|
9592
|
-
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess',
|
|
9699
|
+
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _324 => _324.id])));
|
|
9593
9700
|
}
|
|
9594
9701
|
}
|
|
9595
9702
|
}
|
|
@@ -9874,7 +9981,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
9874
9981
|
validateParams(i18nConfig, flags);
|
|
9875
9982
|
ora.succeed("Localization configuration is valid");
|
|
9876
9983
|
ora.start("Connecting to Lingo.dev Localization Engine...");
|
|
9877
|
-
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess',
|
|
9984
|
+
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _325 => _325.provider]);
|
|
9878
9985
|
if (isByokMode) {
|
|
9879
9986
|
authId = null;
|
|
9880
9987
|
ora.succeed("Using external provider (BYOK mode)");
|
|
@@ -9888,16 +9995,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
9888
9995
|
flags
|
|
9889
9996
|
});
|
|
9890
9997
|
let buckets = getBuckets(i18nConfig);
|
|
9891
|
-
if (_optionalChain([flags, 'access',
|
|
9998
|
+
if (_optionalChain([flags, 'access', _326 => _326.bucket, 'optionalAccess', _327 => _327.length])) {
|
|
9892
9999
|
buckets = buckets.filter(
|
|
9893
10000
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
9894
10001
|
);
|
|
9895
10002
|
}
|
|
9896
10003
|
ora.succeed("Buckets retrieved");
|
|
9897
|
-
if (_optionalChain([flags, 'access',
|
|
10004
|
+
if (_optionalChain([flags, 'access', _328 => _328.file, 'optionalAccess', _329 => _329.length])) {
|
|
9898
10005
|
buckets = buckets.map((bucket) => {
|
|
9899
10006
|
const paths = bucket.paths.filter(
|
|
9900
|
-
(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)]))
|
|
9901
10008
|
);
|
|
9902
10009
|
return { ...bucket, paths };
|
|
9903
10010
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -9918,7 +10025,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
9918
10025
|
});
|
|
9919
10026
|
}
|
|
9920
10027
|
}
|
|
9921
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
10028
|
+
const targetLocales = _optionalChain([flags, 'access', _333 => _333.locale, 'optionalAccess', _334 => _334.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
9922
10029
|
ora.start("Setting up localization cache...");
|
|
9923
10030
|
const checkLockfileProcessor = createDeltaProcessor("");
|
|
9924
10031
|
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
@@ -9973,7 +10080,9 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
9973
10080
|
returnUnlocalizedKeys: true,
|
|
9974
10081
|
injectLocale: bucket.injectLocale
|
|
9975
10082
|
},
|
|
9976
|
-
bucket.lockedKeys
|
|
10083
|
+
bucket.lockedKeys,
|
|
10084
|
+
bucket.lockedPatterns,
|
|
10085
|
+
bucket.ignoredKeys
|
|
9977
10086
|
);
|
|
9978
10087
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
9979
10088
|
await bucketLoader.init();
|
|
@@ -10204,7 +10313,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
10204
10313
|
}
|
|
10205
10314
|
const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
|
|
10206
10315
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
10207
|
-
if (!_optionalChain([flags, 'access',
|
|
10316
|
+
if (!_optionalChain([flags, 'access', _335 => _335.locale, 'optionalAccess', _336 => _336.length])) {
|
|
10208
10317
|
await deltaProcessor.saveChecksums(checksums);
|
|
10209
10318
|
}
|
|
10210
10319
|
}
|
|
@@ -10328,12 +10437,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
10328
10437
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
10329
10438
|
docUrl: "bucketNotFound"
|
|
10330
10439
|
});
|
|
10331
|
-
} 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))])) {
|
|
10332
10441
|
throw new ValidationError({
|
|
10333
10442
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
10334
10443
|
docUrl: "localeTargetNotFound"
|
|
10335
10444
|
});
|
|
10336
|
-
} else if (_optionalChain([flags, 'access',
|
|
10445
|
+
} else if (_optionalChain([flags, 'access', _340 => _340.bucket, 'optionalAccess', _341 => _341.some, 'call', _342 => _342(
|
|
10337
10446
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
10338
10447
|
)])) {
|
|
10339
10448
|
throw new ValidationError({
|
|
@@ -10572,7 +10681,10 @@ var lockfile_default = new (0, _interactivecommander.Command)().command("lockfil
|
|
|
10572
10681
|
{
|
|
10573
10682
|
defaultLocale: sourceLocale,
|
|
10574
10683
|
formatter: i18nConfig.formatter
|
|
10575
|
-
}
|
|
10684
|
+
},
|
|
10685
|
+
bucket.lockedKeys,
|
|
10686
|
+
bucket.lockedPatterns,
|
|
10687
|
+
bucket.ignoredKeys
|
|
10576
10688
|
);
|
|
10577
10689
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
10578
10690
|
const sourceData = await bucketLoader.pull(sourceLocale);
|
|
@@ -10640,7 +10752,10 @@ var cleanup_default = new (0, _interactivecommander.Command)().command("cleanup"
|
|
|
10640
10752
|
{
|
|
10641
10753
|
defaultLocale: sourceLocale,
|
|
10642
10754
|
formatter: i18nConfig.formatter
|
|
10643
|
-
}
|
|
10755
|
+
},
|
|
10756
|
+
bucket.lockedKeys,
|
|
10757
|
+
bucket.lockedPatterns,
|
|
10758
|
+
bucket.ignoredKeys
|
|
10644
10759
|
);
|
|
10645
10760
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
10646
10761
|
const sourceData = await bucketLoader.pull(sourceLocale);
|
|
@@ -10859,7 +10974,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
|
|
|
10859
10974
|
const response = await engine.whoami();
|
|
10860
10975
|
return {
|
|
10861
10976
|
authenticated: !!response,
|
|
10862
|
-
username: _optionalChain([response, 'optionalAccess',
|
|
10977
|
+
username: _optionalChain([response, 'optionalAccess', _343 => _343.email])
|
|
10863
10978
|
};
|
|
10864
10979
|
} catch (error) {
|
|
10865
10980
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -10975,7 +11090,7 @@ function createExplicitLocalizer(provider) {
|
|
|
10975
11090
|
}
|
|
10976
11091
|
function createAiSdkLocalizer(params) {
|
|
10977
11092
|
const skipAuth = params.skipAuth === true;
|
|
10978
|
-
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
11093
|
+
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _344 => _344.apiKeyName]), () => ( ""))];
|
|
10979
11094
|
if (!skipAuth && !apiKey || !params.apiKeyName) {
|
|
10980
11095
|
throw new Error(
|
|
10981
11096
|
_dedent2.default`
|
|
@@ -11109,8 +11224,8 @@ async function setup(input2) {
|
|
|
11109
11224
|
throw new Error(
|
|
11110
11225
|
"No buckets found in i18n.json. Please add at least one bucket containing i18n content."
|
|
11111
11226
|
);
|
|
11112
|
-
} else if (_optionalChain([ctx, 'access',
|
|
11113
|
-
(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]])
|
|
11114
11229
|
)])) {
|
|
11115
11230
|
throw new Error(
|
|
11116
11231
|
`One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
|
|
@@ -11123,7 +11238,7 @@ async function setup(input2) {
|
|
|
11123
11238
|
title: "Selecting localization provider",
|
|
11124
11239
|
task: async (ctx, task) => {
|
|
11125
11240
|
ctx.localizer = createLocalizer(
|
|
11126
|
-
_optionalChain([ctx, 'access',
|
|
11241
|
+
_optionalChain([ctx, 'access', _352 => _352.config, 'optionalAccess', _353 => _353.provider]),
|
|
11127
11242
|
ctx.flags.apiKey
|
|
11128
11243
|
);
|
|
11129
11244
|
if (!ctx.localizer) {
|
|
@@ -11136,7 +11251,7 @@ async function setup(input2) {
|
|
|
11136
11251
|
},
|
|
11137
11252
|
{
|
|
11138
11253
|
title: "Checking authentication",
|
|
11139
|
-
enabled: (ctx) => _optionalChain([ctx, 'access',
|
|
11254
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _354 => _354.localizer, 'optionalAccess', _355 => _355.id]) === "Lingo.dev",
|
|
11140
11255
|
task: async (ctx, task) => {
|
|
11141
11256
|
const authStatus = await ctx.localizer.checkAuth();
|
|
11142
11257
|
if (!authStatus.authenticated) {
|
|
@@ -11149,7 +11264,7 @@ async function setup(input2) {
|
|
|
11149
11264
|
},
|
|
11150
11265
|
{
|
|
11151
11266
|
title: "Validating configuration",
|
|
11152
|
-
enabled: (ctx) => _optionalChain([ctx, 'access',
|
|
11267
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _356 => _356.localizer, 'optionalAccess', _357 => _357.id]) !== "Lingo.dev",
|
|
11153
11268
|
task: async (ctx, task) => {
|
|
11154
11269
|
const validationStatus = await ctx.localizer.validateSettings();
|
|
11155
11270
|
if (!validationStatus.valid) {
|
|
@@ -11466,7 +11581,7 @@ function createWorkerTask(args) {
|
|
|
11466
11581
|
const processableData = _lodash2.default.chain(sourceData).entries().filter(
|
|
11467
11582
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
|
|
11468
11583
|
).filter(
|
|
11469
|
-
([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(
|
|
11470
11585
|
(pattern) => minimatch(key, pattern)
|
|
11471
11586
|
)])
|
|
11472
11587
|
).fromPairs().value();
|
|
@@ -11534,7 +11649,7 @@ function createWorkerTask(args) {
|
|
|
11534
11649
|
finalRenamedTargetData
|
|
11535
11650
|
);
|
|
11536
11651
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
11537
|
-
if (!_optionalChain([args, 'access',
|
|
11652
|
+
if (!_optionalChain([args, 'access', _361 => _361.ctx, 'access', _362 => _362.flags, 'access', _363 => _363.targetLocale, 'optionalAccess', _364 => _364.length])) {
|
|
11538
11653
|
await deltaProcessor.saveChecksums(checksums);
|
|
11539
11654
|
}
|
|
11540
11655
|
});
|
|
@@ -11739,10 +11854,10 @@ var flagsSchema2 = _zod.z.object({
|
|
|
11739
11854
|
async function frozen(input2) {
|
|
11740
11855
|
console.log(_chalk2.default.hex(colors.orange)("[Frozen]"));
|
|
11741
11856
|
let buckets = getBuckets(input2.config);
|
|
11742
|
-
if (_optionalChain([input2, 'access',
|
|
11857
|
+
if (_optionalChain([input2, 'access', _365 => _365.flags, 'access', _366 => _366.bucket, 'optionalAccess', _367 => _367.length])) {
|
|
11743
11858
|
buckets = buckets.filter((b) => input2.flags.bucket.includes(b.type));
|
|
11744
11859
|
}
|
|
11745
|
-
if (_optionalChain([input2, 'access',
|
|
11860
|
+
if (_optionalChain([input2, 'access', _368 => _368.flags, 'access', _369 => _369.file, 'optionalAccess', _370 => _370.length])) {
|
|
11746
11861
|
buckets = buckets.map((bucket) => {
|
|
11747
11862
|
const paths = bucket.paths.filter(
|
|
11748
11863
|
(p) => input2.flags.file.some(
|
|
@@ -11879,13 +11994,13 @@ async function frozen(input2) {
|
|
|
11879
11994
|
|
|
11880
11995
|
// src/cli/cmd/run/_utils.ts
|
|
11881
11996
|
async function determineAuthId(ctx) {
|
|
11882
|
-
const isByokMode = !!_optionalChain([ctx, 'access',
|
|
11997
|
+
const isByokMode = !!_optionalChain([ctx, 'access', _371 => _371.config, 'optionalAccess', _372 => _372.provider]);
|
|
11883
11998
|
if (isByokMode) {
|
|
11884
11999
|
return null;
|
|
11885
12000
|
} else {
|
|
11886
12001
|
try {
|
|
11887
|
-
const authStatus = await _optionalChain([ctx, 'access',
|
|
11888
|
-
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;
|
|
11889
12004
|
} catch (e3) {
|
|
11890
12005
|
return null;
|
|
11891
12006
|
}
|
|
@@ -12082,7 +12197,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
12082
12197
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
12083
12198
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
12084
12199
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
12085
|
-
_optionalChain([this, 'access',
|
|
12200
|
+
_optionalChain([this, 'access', _377 => _377.platformKit, 'optionalAccess', _378 => _378.gitConfig, 'call', _379 => _379()]);
|
|
12086
12201
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
12087
12202
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
12088
12203
|
if (!processOwnCommits) {
|
|
@@ -12114,7 +12229,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
12114
12229
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
12115
12230
|
var PullRequestFlow = class extends InBranchFlow {
|
|
12116
12231
|
async preRun() {
|
|
12117
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
12232
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _380 => _380()]);
|
|
12118
12233
|
if (!canContinue) {
|
|
12119
12234
|
return false;
|
|
12120
12235
|
}
|
|
@@ -12377,10 +12492,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
12377
12492
|
repo_slug: this.platformConfig.repositoryName,
|
|
12378
12493
|
state: "OPEN"
|
|
12379
12494
|
}).then(({ data: { values } }) => {
|
|
12380
|
-
return _optionalChain([values, 'optionalAccess',
|
|
12381
|
-
({ 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
|
|
12382
12497
|
)]);
|
|
12383
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
12498
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _387 => _387.id]));
|
|
12384
12499
|
}
|
|
12385
12500
|
async closePullRequest({ pullRequestNumber }) {
|
|
12386
12501
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -12476,7 +12591,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
12476
12591
|
repo: this.platformConfig.repositoryName,
|
|
12477
12592
|
base: this.platformConfig.baseBranchName,
|
|
12478
12593
|
state: "open"
|
|
12479
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
12594
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _388 => _388.number]));
|
|
12480
12595
|
}
|
|
12481
12596
|
async closePullRequest({ pullRequestNumber }) {
|
|
12482
12597
|
await this.octokit.rest.pulls.update({
|
|
@@ -12603,7 +12718,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
12603
12718
|
sourceBranch: branch,
|
|
12604
12719
|
state: "opened"
|
|
12605
12720
|
});
|
|
12606
|
-
return _optionalChain([mergeRequests, 'access',
|
|
12721
|
+
return _optionalChain([mergeRequests, 'access', _389 => _389[0], 'optionalAccess', _390 => _390.iid]);
|
|
12607
12722
|
}
|
|
12608
12723
|
async closePullRequest({
|
|
12609
12724
|
pullRequestNumber
|
|
@@ -12709,7 +12824,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
12709
12824
|
}
|
|
12710
12825
|
const env = {
|
|
12711
12826
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
12712
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
12827
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _391 => _391.pullRequest, 'optionalAccess', _392 => _392.toString, 'call', _393 => _393()]) || "false",
|
|
12713
12828
|
...options.commitMessage && {
|
|
12714
12829
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
12715
12830
|
},
|
|
@@ -12729,7 +12844,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
12729
12844
|
const { isPullRequestMode } = platformKit.config;
|
|
12730
12845
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
12731
12846
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
12732
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
12847
|
+
const canRun = await _optionalChain([flow, 'access', _394 => _394.preRun, 'optionalCall', _395 => _395()]);
|
|
12733
12848
|
if (canRun === false) {
|
|
12734
12849
|
return;
|
|
12735
12850
|
}
|
|
@@ -12739,7 +12854,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
12739
12854
|
if (!hasChanges) {
|
|
12740
12855
|
return;
|
|
12741
12856
|
}
|
|
12742
|
-
await _optionalChain([flow, 'access',
|
|
12857
|
+
await _optionalChain([flow, 'access', _396 => _396.postRun, 'optionalCall', _397 => _397()]);
|
|
12743
12858
|
});
|
|
12744
12859
|
function parseBooleanArg(val) {
|
|
12745
12860
|
if (val === true) return true;
|
|
@@ -12776,8 +12891,8 @@ function exitGracefully(elapsedMs = 0) {
|
|
|
12776
12891
|
}
|
|
12777
12892
|
}
|
|
12778
12893
|
function checkForPendingOperations() {
|
|
12779
|
-
const activeHandles = _optionalChain([process, 'access',
|
|
12780
|
-
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()]) || [];
|
|
12781
12896
|
const nonStandardHandles = activeHandles.filter((handle) => {
|
|
12782
12897
|
if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
|
|
12783
12898
|
return false;
|
|
@@ -12846,17 +12961,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
12846
12961
|
flags
|
|
12847
12962
|
});
|
|
12848
12963
|
let buckets = getBuckets(i18nConfig);
|
|
12849
|
-
if (_optionalChain([flags, 'access',
|
|
12964
|
+
if (_optionalChain([flags, 'access', _402 => _402.bucket, 'optionalAccess', _403 => _403.length])) {
|
|
12850
12965
|
buckets = buckets.filter(
|
|
12851
12966
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
12852
12967
|
);
|
|
12853
12968
|
}
|
|
12854
12969
|
ora.succeed("Buckets retrieved");
|
|
12855
|
-
if (_optionalChain([flags, 'access',
|
|
12970
|
+
if (_optionalChain([flags, 'access', _404 => _404.file, 'optionalAccess', _405 => _405.length])) {
|
|
12856
12971
|
buckets = buckets.map((bucket) => {
|
|
12857
12972
|
const paths = bucket.paths.filter(
|
|
12858
12973
|
(path19) => flags.file.find(
|
|
12859
|
-
(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)
|
|
12860
12975
|
)
|
|
12861
12976
|
);
|
|
12862
12977
|
return { ...bucket, paths };
|
|
@@ -12876,7 +12991,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
12876
12991
|
});
|
|
12877
12992
|
}
|
|
12878
12993
|
}
|
|
12879
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
12994
|
+
const targetLocales = _optionalChain([flags, 'access', _412 => _412.locale, 'optionalAccess', _413 => _413.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
12880
12995
|
let totalSourceKeyCount = 0;
|
|
12881
12996
|
let uniqueKeysToTranslate = 0;
|
|
12882
12997
|
let totalExistingTranslations = 0;
|
|
@@ -12912,7 +13027,9 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
12912
13027
|
injectLocale: bucket.injectLocale,
|
|
12913
13028
|
formatter: i18nConfig.formatter
|
|
12914
13029
|
},
|
|
12915
|
-
bucket.lockedKeys
|
|
13030
|
+
bucket.lockedKeys,
|
|
13031
|
+
bucket.lockedPatterns,
|
|
13032
|
+
bucket.ignoredKeys
|
|
12916
13033
|
);
|
|
12917
13034
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
12918
13035
|
await bucketLoader.init();
|
|
@@ -13282,12 +13399,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
13282
13399
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
13283
13400
|
docUrl: "bucketNotFound"
|
|
13284
13401
|
});
|
|
13285
|
-
} 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))])) {
|
|
13286
13403
|
throw new CLIError({
|
|
13287
13404
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
13288
13405
|
docUrl: "localeTargetNotFound"
|
|
13289
13406
|
});
|
|
13290
|
-
} else if (_optionalChain([flags, 'access',
|
|
13407
|
+
} else if (_optionalChain([flags, 'access', _417 => _417.bucket, 'optionalAccess', _418 => _418.some, 'call', _419 => _419(
|
|
13291
13408
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
13292
13409
|
)])) {
|
|
13293
13410
|
throw new CLIError({
|
|
@@ -13379,7 +13496,7 @@ async function renderHero2() {
|
|
|
13379
13496
|
// package.json
|
|
13380
13497
|
var package_default = {
|
|
13381
13498
|
name: "lingo.dev",
|
|
13382
|
-
version: "0.
|
|
13499
|
+
version: "0.114.1",
|
|
13383
13500
|
description: "Lingo.dev CLI",
|
|
13384
13501
|
private: false,
|
|
13385
13502
|
publishConfig: {
|
|
@@ -13670,7 +13787,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
|
|
|
13670
13787
|
if (options.file && options.file.length) {
|
|
13671
13788
|
buckets = buckets.map((bucket) => {
|
|
13672
13789
|
const paths = bucket.paths.filter(
|
|
13673
|
-
(bucketPath) => _optionalChain([options, 'access',
|
|
13790
|
+
(bucketPath) => _optionalChain([options, 'access', _420 => _420.file, 'optionalAccess', _421 => _421.some, 'call', _422 => _422((f) => bucketPath.pathPattern.includes(f))])
|
|
13674
13791
|
);
|
|
13675
13792
|
return { ...bucket, paths };
|
|
13676
13793
|
}).filter((bucket) => bucket.paths.length > 0);
|