lingo.dev 0.117.8 → 0.117.10
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 +261 -134
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +138 -11
- package/build/cli.mjs.map +1 -1
- package/package.json +4 -4
package/build/cli.cjs
CHANGED
|
@@ -2325,9 +2325,119 @@ function _isMetadataKey(key) {
|
|
|
2325
2325
|
return key.startsWith("@");
|
|
2326
2326
|
}
|
|
2327
2327
|
|
|
2328
|
+
// src/cli/loaders/ail.ts
|
|
2329
|
+
var _xml2js = require('xml2js');
|
|
2330
|
+
function createAilLoader() {
|
|
2331
|
+
return createLoader({
|
|
2332
|
+
async pull(locale, input2) {
|
|
2333
|
+
const result = {};
|
|
2334
|
+
if (!input2 || !input2.trim()) {
|
|
2335
|
+
return result;
|
|
2336
|
+
}
|
|
2337
|
+
try {
|
|
2338
|
+
const parsed = await _xml2js.parseStringPromise.call(void 0, input2, {
|
|
2339
|
+
explicitArray: true,
|
|
2340
|
+
// Always use arrays for consistency
|
|
2341
|
+
mergeAttrs: false,
|
|
2342
|
+
// Keep attributes separate in $
|
|
2343
|
+
trim: true,
|
|
2344
|
+
explicitRoot: true
|
|
2345
|
+
});
|
|
2346
|
+
const dictionary = parsed.DICTIONARY;
|
|
2347
|
+
if (!dictionary) {
|
|
2348
|
+
return result;
|
|
2349
|
+
}
|
|
2350
|
+
const entries = dictionary.ENTRY || [];
|
|
2351
|
+
for (const entry of entries) {
|
|
2352
|
+
const id = _optionalChain([entry, 'access', _112 => _112.$, 'optionalAccess', _113 => _113.id]);
|
|
2353
|
+
if (!id) {
|
|
2354
|
+
continue;
|
|
2355
|
+
}
|
|
2356
|
+
const strings = entry.STRING || [];
|
|
2357
|
+
const sourceString = strings.find(
|
|
2358
|
+
(s) => _optionalChain([s, 'access', _114 => _114.$, 'optionalAccess', _115 => _115.lang]) === locale
|
|
2359
|
+
);
|
|
2360
|
+
if (_optionalChain([sourceString, 'optionalAccess', _116 => _116.$, 'access', _117 => _117.value])) {
|
|
2361
|
+
result[id] = sourceString.$.value;
|
|
2362
|
+
}
|
|
2363
|
+
}
|
|
2364
|
+
return result;
|
|
2365
|
+
} catch (error) {
|
|
2366
|
+
console.error("Failed to parse AIL file:", error);
|
|
2367
|
+
return result;
|
|
2368
|
+
}
|
|
2369
|
+
},
|
|
2370
|
+
async push(locale, data, originalInput) {
|
|
2371
|
+
if (!originalInput || !originalInput.trim()) {
|
|
2372
|
+
const dictionary = {
|
|
2373
|
+
$: { type: "multilanguage" },
|
|
2374
|
+
ENTRY: Object.entries(data).map(([id, value]) => ({
|
|
2375
|
+
$: { id },
|
|
2376
|
+
STRING: [
|
|
2377
|
+
{
|
|
2378
|
+
$: { lang: locale, value }
|
|
2379
|
+
}
|
|
2380
|
+
]
|
|
2381
|
+
}))
|
|
2382
|
+
};
|
|
2383
|
+
const builder = new (0, _xml2js.Builder)({
|
|
2384
|
+
xmldec: { version: "1.0", encoding: "UTF-8" },
|
|
2385
|
+
headless: false
|
|
2386
|
+
});
|
|
2387
|
+
return builder.buildObject({ DICTIONARY: dictionary });
|
|
2388
|
+
}
|
|
2389
|
+
try {
|
|
2390
|
+
const parsed = await _xml2js.parseStringPromise.call(void 0, originalInput, {
|
|
2391
|
+
explicitArray: true,
|
|
2392
|
+
mergeAttrs: false,
|
|
2393
|
+
trim: true,
|
|
2394
|
+
explicitRoot: true
|
|
2395
|
+
});
|
|
2396
|
+
const dictionary = parsed.DICTIONARY;
|
|
2397
|
+
if (!dictionary) {
|
|
2398
|
+
throw new Error("No DICTIONARY root element found");
|
|
2399
|
+
}
|
|
2400
|
+
const entries = dictionary.ENTRY || [];
|
|
2401
|
+
for (const [id, value] of Object.entries(data)) {
|
|
2402
|
+
let entry = entries.find((e) => _optionalChain([e, 'access', _118 => _118.$, 'optionalAccess', _119 => _119.id]) === id);
|
|
2403
|
+
if (!entry) {
|
|
2404
|
+
entry = {
|
|
2405
|
+
$: { id },
|
|
2406
|
+
STRING: []
|
|
2407
|
+
};
|
|
2408
|
+
entries.push(entry);
|
|
2409
|
+
}
|
|
2410
|
+
if (!entry.STRING) {
|
|
2411
|
+
entry.STRING = [];
|
|
2412
|
+
}
|
|
2413
|
+
let targetString = entry.STRING.find(
|
|
2414
|
+
(s) => _optionalChain([s, 'access', _120 => _120.$, 'optionalAccess', _121 => _121.lang]) === locale
|
|
2415
|
+
);
|
|
2416
|
+
if (targetString) {
|
|
2417
|
+
targetString.$.value = value;
|
|
2418
|
+
} else {
|
|
2419
|
+
entry.STRING.push({
|
|
2420
|
+
$: { lang: locale, value }
|
|
2421
|
+
});
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
dictionary.ENTRY = entries;
|
|
2425
|
+
const builder = new (0, _xml2js.Builder)({
|
|
2426
|
+
xmldec: { version: "1.0", encoding: "UTF-8" },
|
|
2427
|
+
headless: false
|
|
2428
|
+
});
|
|
2429
|
+
return builder.buildObject({ DICTIONARY: dictionary });
|
|
2430
|
+
} catch (error) {
|
|
2431
|
+
console.error("Failed to build AIL file:", error);
|
|
2432
|
+
throw error;
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
});
|
|
2436
|
+
}
|
|
2437
|
+
|
|
2328
2438
|
// src/cli/loaders/android.ts
|
|
2329
2439
|
var _module = require('module');
|
|
2330
|
-
|
|
2440
|
+
|
|
2331
2441
|
var require2 = _module.createRequire.call(void 0, _chunkHTMTB46Pcjs.importMetaUrl);
|
|
2332
2442
|
var sax = require2("sax");
|
|
2333
2443
|
var defaultAndroidResourcesXml = `<?xml version="1.0" encoding="utf-8"?>
|
|
@@ -2432,7 +2542,7 @@ async function parseAndroidDocument(input2) {
|
|
|
2432
2542
|
const resourceNodes = [];
|
|
2433
2543
|
let metaIndex = 0;
|
|
2434
2544
|
for (const child of resourcesNode.$$) {
|
|
2435
|
-
const elementName = _optionalChain([child, 'optionalAccess',
|
|
2545
|
+
const elementName = _optionalChain([child, 'optionalAccess', _122 => _122["#name"]]);
|
|
2436
2546
|
if (!isResourceElementName(elementName)) {
|
|
2437
2547
|
continue;
|
|
2438
2548
|
}
|
|
@@ -2440,11 +2550,11 @@ async function parseAndroidDocument(input2) {
|
|
|
2440
2550
|
if (!meta || meta.type !== elementName) {
|
|
2441
2551
|
continue;
|
|
2442
2552
|
}
|
|
2443
|
-
const name = _nullishCoalesce(_optionalChain([child, 'optionalAccess',
|
|
2553
|
+
const name = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _123 => _123.$, 'optionalAccess', _124 => _124.name]), () => ( meta.name));
|
|
2444
2554
|
if (!name) {
|
|
2445
2555
|
continue;
|
|
2446
2556
|
}
|
|
2447
|
-
const translatable = (_nullishCoalesce(_optionalChain([child, 'optionalAccess',
|
|
2557
|
+
const translatable = (_nullishCoalesce(_optionalChain([child, 'optionalAccess', _125 => _125.$, 'optionalAccess', _126 => _126.translatable]), () => ( ""))).toLowerCase() !== "false";
|
|
2448
2558
|
switch (meta.type) {
|
|
2449
2559
|
case "string": {
|
|
2450
2560
|
resourceNodes.push({
|
|
@@ -2457,7 +2567,7 @@ async function parseAndroidDocument(input2) {
|
|
|
2457
2567
|
break;
|
|
2458
2568
|
}
|
|
2459
2569
|
case "string-array": {
|
|
2460
|
-
const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess',
|
|
2570
|
+
const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _127 => _127.item]), () => ( []));
|
|
2461
2571
|
const items = [];
|
|
2462
2572
|
const templateItems = meta.items;
|
|
2463
2573
|
for (let i = 0; i < Math.max(itemNodes.length, templateItems.length); i++) {
|
|
@@ -2481,7 +2591,7 @@ async function parseAndroidDocument(input2) {
|
|
|
2481
2591
|
break;
|
|
2482
2592
|
}
|
|
2483
2593
|
case "plurals": {
|
|
2484
|
-
const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess',
|
|
2594
|
+
const itemNodes = _nullishCoalesce(_optionalChain([child, 'optionalAccess', _128 => _128.item]), () => ( []));
|
|
2485
2595
|
const templateItems = meta.items;
|
|
2486
2596
|
const items = [];
|
|
2487
2597
|
for (const templateItem of templateItems) {
|
|
@@ -2490,7 +2600,7 @@ async function parseAndroidDocument(input2) {
|
|
|
2490
2600
|
continue;
|
|
2491
2601
|
}
|
|
2492
2602
|
const nodeItem = itemNodes.find(
|
|
2493
|
-
(item) => _optionalChain([item, 'optionalAccess',
|
|
2603
|
+
(item) => _optionalChain([item, 'optionalAccess', _129 => _129.$, 'optionalAccess', _130 => _130.quantity]) === quantity
|
|
2494
2604
|
);
|
|
2495
2605
|
if (!nodeItem) {
|
|
2496
2606
|
continue;
|
|
@@ -2764,7 +2874,7 @@ function cloneResourceNode(resource) {
|
|
|
2764
2874
|
const nodeClone = deepClone(resource.node);
|
|
2765
2875
|
const itemNodes = _nullishCoalesce(nodeClone.item, () => ( []));
|
|
2766
2876
|
const items = itemNodes.map((itemNode, index) => {
|
|
2767
|
-
const templateMeta = _nullishCoalesce(_nullishCoalesce(_optionalChain([resource, 'access',
|
|
2877
|
+
const templateMeta = _nullishCoalesce(_nullishCoalesce(_optionalChain([resource, 'access', _131 => _131.items, 'access', _132 => _132[index], 'optionalAccess', _133 => _133.meta]), () => ( _optionalChain([resource, 'access', _134 => _134.items, 'access', _135 => _135[resource.items.length - 1], 'optionalAccess', _136 => _136.meta]))), () => ( makeTextMeta([])));
|
|
2768
2878
|
return {
|
|
2769
2879
|
node: itemNode,
|
|
2770
2880
|
meta: cloneTextMeta(templateMeta)
|
|
@@ -2784,7 +2894,7 @@ function cloneResourceNode(resource) {
|
|
|
2784
2894
|
const items = [];
|
|
2785
2895
|
for (const templateItem of resource.items) {
|
|
2786
2896
|
const cloneNode = itemNodes.find(
|
|
2787
|
-
(item) => _optionalChain([item, 'optionalAccess',
|
|
2897
|
+
(item) => _optionalChain([item, 'optionalAccess', _137 => _137.$, 'optionalAccess', _138 => _138.quantity]) === templateItem.quantity
|
|
2788
2898
|
);
|
|
2789
2899
|
if (!cloneNode) {
|
|
2790
2900
|
continue;
|
|
@@ -3040,8 +3150,8 @@ function cloneDocumentStructure(document) {
|
|
|
3040
3150
|
resourceNodes.map((r) => resourceLookupKey(r.type, r.name))
|
|
3041
3151
|
);
|
|
3042
3152
|
let filtered = resourcesClone.$$.filter((child) => {
|
|
3043
|
-
const elementName = _optionalChain([child, 'optionalAccess',
|
|
3044
|
-
const name = _optionalChain([child, 'optionalAccess',
|
|
3153
|
+
const elementName = _optionalChain([child, 'optionalAccess', _139 => _139["#name"]]);
|
|
3154
|
+
const name = _optionalChain([child, 'optionalAccess', _140 => _140.$, 'optionalAccess', _141 => _141.name]);
|
|
3045
3155
|
if (!isResourceElementName(elementName) || !name) {
|
|
3046
3156
|
return true;
|
|
3047
3157
|
}
|
|
@@ -3050,7 +3160,7 @@ function cloneDocumentStructure(document) {
|
|
|
3050
3160
|
const cleaned = [];
|
|
3051
3161
|
let lastWasWhitespace = false;
|
|
3052
3162
|
for (const child of filtered) {
|
|
3053
|
-
const isWhitespace = _optionalChain([child, 'optionalAccess',
|
|
3163
|
+
const isWhitespace = _optionalChain([child, 'optionalAccess', _142 => _142["#name"]]) === "__text__" && (!child._ || child._.trim() === "");
|
|
3054
3164
|
if (isWhitespace) {
|
|
3055
3165
|
if (!lastWasWhitespace) {
|
|
3056
3166
|
cleaned.push(child);
|
|
@@ -3072,8 +3182,8 @@ function buildResourceLookup(resources) {
|
|
|
3072
3182
|
const lookup = /* @__PURE__ */ new Map();
|
|
3073
3183
|
const children = Array.isArray(resources.$$) ? resources.$$ : [];
|
|
3074
3184
|
for (const child of children) {
|
|
3075
|
-
const type = _optionalChain([child, 'optionalAccess',
|
|
3076
|
-
const name = _optionalChain([child, 'optionalAccess',
|
|
3185
|
+
const type = _optionalChain([child, 'optionalAccess', _143 => _143["#name"]]);
|
|
3186
|
+
const name = _optionalChain([child, 'optionalAccess', _144 => _144.$, 'optionalAccess', _145 => _145.name]);
|
|
3077
3187
|
if (!type || !name || !isResourceElementName(type)) {
|
|
3078
3188
|
continue;
|
|
3079
3189
|
}
|
|
@@ -3102,7 +3212,7 @@ function cloneResourceNodeFromLookup(resource, lookup) {
|
|
|
3102
3212
|
}
|
|
3103
3213
|
case "string-array": {
|
|
3104
3214
|
const childItems = (Array.isArray(node.$$) ? node.$$ : []).filter(
|
|
3105
|
-
(child) => _optionalChain([child, 'optionalAccess',
|
|
3215
|
+
(child) => _optionalChain([child, 'optionalAccess', _146 => _146["#name"]]) === "item"
|
|
3106
3216
|
);
|
|
3107
3217
|
node.item = childItems;
|
|
3108
3218
|
if (childItems.length < resource.items.length) {
|
|
@@ -3131,12 +3241,12 @@ function cloneResourceNodeFromLookup(resource, lookup) {
|
|
|
3131
3241
|
}
|
|
3132
3242
|
case "plurals": {
|
|
3133
3243
|
const childItems = (Array.isArray(node.$$) ? node.$$ : []).filter(
|
|
3134
|
-
(child) => _optionalChain([child, 'optionalAccess',
|
|
3244
|
+
(child) => _optionalChain([child, 'optionalAccess', _147 => _147["#name"]]) === "item"
|
|
3135
3245
|
);
|
|
3136
3246
|
node.item = childItems;
|
|
3137
3247
|
const itemMap = /* @__PURE__ */ new Map();
|
|
3138
3248
|
for (const item of childItems) {
|
|
3139
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
3249
|
+
if (_optionalChain([item, 'optionalAccess', _148 => _148.$, 'optionalAccess', _149 => _149.quantity])) {
|
|
3140
3250
|
itemMap.set(item.$.quantity, item);
|
|
3141
3251
|
}
|
|
3142
3252
|
}
|
|
@@ -3426,7 +3536,7 @@ var _sync3 = require('csv-stringify/sync');
|
|
|
3426
3536
|
|
|
3427
3537
|
function detectKeyColumnName(csvString) {
|
|
3428
3538
|
const row = _sync.parse.call(void 0, csvString)[0];
|
|
3429
|
-
const firstColumn = _optionalChain([row, 'optionalAccess',
|
|
3539
|
+
const firstColumn = _optionalChain([row, 'optionalAccess', _150 => _150[0], 'optionalAccess', _151 => _151.trim, 'call', _152 => _152()]);
|
|
3430
3540
|
return firstColumn || "KEY";
|
|
3431
3541
|
}
|
|
3432
3542
|
function createCsvLoader() {
|
|
@@ -3656,7 +3766,7 @@ function createHtmlLoader() {
|
|
|
3656
3766
|
const attrs = LOCALIZABLE_ATTRIBUTES2[tagName];
|
|
3657
3767
|
if (!attrs) return;
|
|
3658
3768
|
for (const attr of attrs) {
|
|
3659
|
-
const value = _optionalChain([element, 'access',
|
|
3769
|
+
const value = _optionalChain([element, 'access', _153 => _153.attribs, 'optionalAccess', _154 => _154[attr]]);
|
|
3660
3770
|
if (value && value.trim()) {
|
|
3661
3771
|
result[`${path19}#${attr}`] = value.trim();
|
|
3662
3772
|
}
|
|
@@ -3848,7 +3958,7 @@ function createMarkdownLoader() {
|
|
|
3848
3958
|
yaml: yamlEngine
|
|
3849
3959
|
}
|
|
3850
3960
|
});
|
|
3851
|
-
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess',
|
|
3961
|
+
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _155 => _155.trim, 'call', _156 => _156()]), () => ( ""))).filter(Boolean);
|
|
3852
3962
|
return {
|
|
3853
3963
|
...Object.fromEntries(
|
|
3854
3964
|
sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
|
|
@@ -3867,7 +3977,7 @@ function createMarkdownLoader() {
|
|
|
3867
3977
|
);
|
|
3868
3978
|
let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(
|
|
3869
3979
|
([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())
|
|
3870
|
-
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess',
|
|
3980
|
+
).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _157 => _157.trim, 'call', _158 => _158()]), () => ( ""))).filter(Boolean).join("\n\n");
|
|
3871
3981
|
if (Object.keys(frontmatter).length > 0) {
|
|
3872
3982
|
content = `
|
|
3873
3983
|
${content}`;
|
|
@@ -3892,7 +4002,7 @@ function createMarkdocLoader() {
|
|
|
3892
4002
|
const result = {};
|
|
3893
4003
|
const counters = {};
|
|
3894
4004
|
traverseAndExtract(ast, "", result, counters);
|
|
3895
|
-
if (_optionalChain([ast, 'access',
|
|
4005
|
+
if (_optionalChain([ast, 'access', _159 => _159.attributes, 'optionalAccess', _160 => _160.frontmatter])) {
|
|
3896
4006
|
const frontmatter = _yaml2.default.parse(ast.attributes.frontmatter);
|
|
3897
4007
|
Object.entries(frontmatter).forEach(([key, value]) => {
|
|
3898
4008
|
if (typeof value === "string") {
|
|
@@ -3938,7 +4048,7 @@ function traverseAndExtract(node, path19, result, counters, parentType) {
|
|
|
3938
4048
|
if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
|
|
3939
4049
|
semanticType = nodeSemanticType;
|
|
3940
4050
|
}
|
|
3941
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
4051
|
+
if (node.type === "text" && _optionalChain([node, 'access', _161 => _161.attributes, 'optionalAccess', _162 => _162.content])) {
|
|
3942
4052
|
const content = node.attributes.content;
|
|
3943
4053
|
if (typeof content === "string" && content.trim()) {
|
|
3944
4054
|
if (semanticType) {
|
|
@@ -3965,7 +4075,7 @@ function buildPathMap(node, path19, counters, pathMap, parentType) {
|
|
|
3965
4075
|
if (nodeSemanticType && !["text", "strong", "em", "inline", "link"].includes(nodeSemanticType)) {
|
|
3966
4076
|
semanticType = nodeSemanticType;
|
|
3967
4077
|
}
|
|
3968
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
4078
|
+
if (node.type === "text" && _optionalChain([node, 'access', _163 => _163.attributes, 'optionalAccess', _164 => _164.content])) {
|
|
3969
4079
|
const content = node.attributes.content;
|
|
3970
4080
|
if (typeof content === "string" && content.trim()) {
|
|
3971
4081
|
if (semanticType) {
|
|
@@ -3988,7 +4098,7 @@ function applyTranslations(node, path19, data, pathMap) {
|
|
|
3988
4098
|
if (!node || typeof node !== "object") {
|
|
3989
4099
|
return;
|
|
3990
4100
|
}
|
|
3991
|
-
if (node.type === "text" && _optionalChain([node, 'access',
|
|
4101
|
+
if (node.type === "text" && _optionalChain([node, 'access', _165 => _165.attributes, 'optionalAccess', _166 => _166.content])) {
|
|
3992
4102
|
const content = node.attributes.content;
|
|
3993
4103
|
if (typeof content === "string") {
|
|
3994
4104
|
const contentPath = path19 ? `${path19}/attributes/content` : "attributes/content";
|
|
@@ -4040,6 +4150,9 @@ function createMjmlLoader() {
|
|
|
4040
4150
|
return createLoader({
|
|
4041
4151
|
async pull(locale, input2) {
|
|
4042
4152
|
const result = {};
|
|
4153
|
+
if (!input2 || input2.trim() === "") {
|
|
4154
|
+
return result;
|
|
4155
|
+
}
|
|
4043
4156
|
try {
|
|
4044
4157
|
const parsed = await _xml2js.parseStringPromise.call(void 0, input2, {
|
|
4045
4158
|
explicitArray: true,
|
|
@@ -4086,8 +4199,11 @@ function createMjmlLoader() {
|
|
|
4086
4199
|
return result;
|
|
4087
4200
|
},
|
|
4088
4201
|
async push(locale, data, originalInput) {
|
|
4202
|
+
if (!originalInput || originalInput.trim() === "") {
|
|
4203
|
+
return originalInput || "";
|
|
4204
|
+
}
|
|
4089
4205
|
try {
|
|
4090
|
-
const parsed = await _xml2js.parseStringPromise.call(void 0, originalInput
|
|
4206
|
+
const parsed = await _xml2js.parseStringPromise.call(void 0, originalInput, {
|
|
4091
4207
|
explicitArray: true,
|
|
4092
4208
|
explicitChildren: true,
|
|
4093
4209
|
preserveChildrenOrder: true,
|
|
@@ -4229,11 +4345,10 @@ function convertDomToXmlNode(domNode) {
|
|
|
4229
4345
|
return null;
|
|
4230
4346
|
}
|
|
4231
4347
|
function serializeMjml(parsed) {
|
|
4232
|
-
const xmlDec = '<?xml version="1.0" encoding="UTF-8"?>\n';
|
|
4233
4348
|
const rootKey = Object.keys(parsed).find((key) => !key.startsWith("_") && !key.startsWith("$"));
|
|
4234
4349
|
const rootNode = rootKey ? parsed[rootKey] : parsed;
|
|
4235
4350
|
const body = serializeElement2(rootNode);
|
|
4236
|
-
return
|
|
4351
|
+
return body;
|
|
4237
4352
|
}
|
|
4238
4353
|
function serializeElement2(node, indent2 = "") {
|
|
4239
4354
|
if (!node) {
|
|
@@ -4296,7 +4411,7 @@ function isSkippableLine(line) {
|
|
|
4296
4411
|
function parsePropertyLine(line) {
|
|
4297
4412
|
const [key, ...valueParts] = line.split("=");
|
|
4298
4413
|
return {
|
|
4299
|
-
key: _optionalChain([key, 'optionalAccess',
|
|
4414
|
+
key: _optionalChain([key, 'optionalAccess', _167 => _167.trim, 'call', _168 => _168()]) || "",
|
|
4300
4415
|
value: valueParts.join("=").trim()
|
|
4301
4416
|
};
|
|
4302
4417
|
}
|
|
@@ -4588,7 +4703,7 @@ var Parser3 = class {
|
|
|
4588
4703
|
}
|
|
4589
4704
|
}
|
|
4590
4705
|
expect(type) {
|
|
4591
|
-
if (_optionalChain([this, 'access',
|
|
4706
|
+
if (_optionalChain([this, 'access', _169 => _169.current, 'call', _170 => _170(), 'optionalAccess', _171 => _171.type]) === type) {
|
|
4592
4707
|
this.advance();
|
|
4593
4708
|
return true;
|
|
4594
4709
|
}
|
|
@@ -4665,7 +4780,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4665
4780
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
4666
4781
|
continue;
|
|
4667
4782
|
}
|
|
4668
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
4783
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _172 => _172.localizations, 'optionalAccess', _173 => _173[locale]]);
|
|
4669
4784
|
if (langTranslationEntity) {
|
|
4670
4785
|
if ("stringUnit" in langTranslationEntity) {
|
|
4671
4786
|
resultData[translationKey] = langTranslationEntity.stringUnit.value;
|
|
@@ -4679,7 +4794,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4679
4794
|
resultData[translationKey] = {};
|
|
4680
4795
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
4681
4796
|
for (const form in pluralForms) {
|
|
4682
|
-
if (_optionalChain([pluralForms, 'access',
|
|
4797
|
+
if (_optionalChain([pluralForms, 'access', _174 => _174[form], 'optionalAccess', _175 => _175.stringUnit, 'optionalAccess', _176 => _176.value])) {
|
|
4683
4798
|
resultData[translationKey][form] = pluralForms[form].stringUnit.value;
|
|
4684
4799
|
}
|
|
4685
4800
|
}
|
|
@@ -4705,7 +4820,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4705
4820
|
const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
|
|
4706
4821
|
if (typeof value === "string") {
|
|
4707
4822
|
langDataToMerge.strings[key] = {
|
|
4708
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
4823
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _177 => _177.strings, 'optionalAccess', _178 => _178[key], 'optionalAccess', _179 => _179.extractionState]),
|
|
4709
4824
|
localizations: {
|
|
4710
4825
|
[locale]: {
|
|
4711
4826
|
stringUnit: {
|
|
@@ -4720,7 +4835,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4720
4835
|
}
|
|
4721
4836
|
} else if (Array.isArray(value)) {
|
|
4722
4837
|
langDataToMerge.strings[key] = {
|
|
4723
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
4838
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _180 => _180.strings, 'optionalAccess', _181 => _181[key], 'optionalAccess', _182 => _182.extractionState]),
|
|
4724
4839
|
localizations: {
|
|
4725
4840
|
[locale]: {
|
|
4726
4841
|
stringSet: {
|
|
@@ -4778,7 +4893,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4778
4893
|
for (const [locale, localization] of Object.entries(
|
|
4779
4894
|
entity.localizations
|
|
4780
4895
|
)) {
|
|
4781
|
-
if (_optionalChain([localization, 'access',
|
|
4896
|
+
if (_optionalChain([localization, 'access', _183 => _183.variations, 'optionalAccess', _184 => _184.plural])) {
|
|
4782
4897
|
const pluralForms = localization.variations.plural;
|
|
4783
4898
|
for (const form in pluralForms) {
|
|
4784
4899
|
const pluralKey = `${translationKey}/${form}`;
|
|
@@ -4798,7 +4913,7 @@ function _removeLocale(input2, locale) {
|
|
|
4798
4913
|
const { strings } = input2;
|
|
4799
4914
|
const newStrings = _lodash2.default.cloneDeep(strings);
|
|
4800
4915
|
for (const [key, value] of Object.entries(newStrings)) {
|
|
4801
|
-
if (_optionalChain([value, 'access',
|
|
4916
|
+
if (_optionalChain([value, 'access', _185 => _185.localizations, 'optionalAccess', _186 => _186[locale]])) {
|
|
4802
4917
|
delete value.localizations[locale];
|
|
4803
4918
|
}
|
|
4804
4919
|
}
|
|
@@ -4929,7 +5044,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
4929
5044
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
4930
5045
|
continue;
|
|
4931
5046
|
}
|
|
4932
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
5047
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _187 => _187.localizations, 'optionalAccess', _188 => _188[locale]]);
|
|
4933
5048
|
if (langTranslationEntity) {
|
|
4934
5049
|
if (!resultData[translationKey]) {
|
|
4935
5050
|
resultData[translationKey] = {};
|
|
@@ -4941,7 +5056,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
4941
5056
|
for (const [subName, subData] of Object.entries(
|
|
4942
5057
|
langTranslationEntity.substitutions
|
|
4943
5058
|
)) {
|
|
4944
|
-
const pluralForms = _optionalChain([subData, 'access',
|
|
5059
|
+
const pluralForms = _optionalChain([subData, 'access', _189 => _189.variations, 'optionalAccess', _190 => _190.plural]);
|
|
4945
5060
|
if (pluralForms) {
|
|
4946
5061
|
const forms = {};
|
|
4947
5062
|
for (const [form, formData] of Object.entries(pluralForms)) {
|
|
@@ -4966,7 +5081,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
4966
5081
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
4967
5082
|
const forms = {};
|
|
4968
5083
|
for (const [form, formData] of Object.entries(pluralForms)) {
|
|
4969
|
-
if (_optionalChain([formData, 'optionalAccess',
|
|
5084
|
+
if (_optionalChain([formData, 'optionalAccess', _191 => _191.stringUnit, 'optionalAccess', _192 => _192.value])) {
|
|
4970
5085
|
forms[form] = formData.stringUnit.value;
|
|
4971
5086
|
}
|
|
4972
5087
|
}
|
|
@@ -5009,7 +5124,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
5009
5124
|
for (const [subName, subData] of Object.entries(
|
|
5010
5125
|
keyData.substitutions
|
|
5011
5126
|
)) {
|
|
5012
|
-
const pluralValue = _optionalChain([subData, 'optionalAccess',
|
|
5127
|
+
const pluralValue = _optionalChain([subData, 'optionalAccess', _193 => _193.variations, 'optionalAccess', _194 => _194.plural]);
|
|
5013
5128
|
if (pluralValue && isIcuPluralString(pluralValue)) {
|
|
5014
5129
|
try {
|
|
5015
5130
|
const pluralForms = parseIcuPluralString(pluralValue, locale);
|
|
@@ -5022,8 +5137,8 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
5022
5137
|
}
|
|
5023
5138
|
};
|
|
5024
5139
|
}
|
|
5025
|
-
const sourceLocale = _optionalChain([originalInput, 'optionalAccess',
|
|
5026
|
-
const origFormatSpec = _optionalChain([originalInput, 'optionalAccess',
|
|
5140
|
+
const sourceLocale = _optionalChain([originalInput, 'optionalAccess', _195 => _195.sourceLanguage]) || "en";
|
|
5141
|
+
const origFormatSpec = _optionalChain([originalInput, 'optionalAccess', _196 => _196.strings, 'optionalAccess', _197 => _197[baseKey], 'optionalAccess', _198 => _198.localizations, 'optionalAccess', _199 => _199[sourceLocale], 'optionalAccess', _200 => _200.substitutions, 'optionalAccess', _201 => _201[subName], 'optionalAccess', _202 => _202.formatSpecifier]) || subName;
|
|
5027
5142
|
subs[subName] = {
|
|
5028
5143
|
formatSpecifier: origFormatSpec,
|
|
5029
5144
|
variations: {
|
|
@@ -5048,7 +5163,7 @@ ${error instanceof Error ? error.message : String(error)}`
|
|
|
5048
5163
|
values: keyData.stringSet
|
|
5049
5164
|
};
|
|
5050
5165
|
}
|
|
5051
|
-
if ("variations" in keyData && _optionalChain([keyData, 'access',
|
|
5166
|
+
if ("variations" in keyData && _optionalChain([keyData, 'access', _203 => _203.variations, 'optionalAccess', _204 => _204.plural])) {
|
|
5052
5167
|
const pluralValue = keyData.variations.plural;
|
|
5053
5168
|
if (isIcuPluralString(pluralValue)) {
|
|
5054
5169
|
try {
|
|
@@ -5075,7 +5190,7 @@ ${error instanceof Error ? error.message : String(error)}`
|
|
|
5075
5190
|
}
|
|
5076
5191
|
if (Object.keys(localizationData).length > 0) {
|
|
5077
5192
|
langDataToMerge.strings[baseKey] = {
|
|
5078
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
5193
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _205 => _205.strings, 'optionalAccess', _206 => _206[baseKey], 'optionalAccess', _207 => _207.extractionState]),
|
|
5079
5194
|
localizations: {
|
|
5080
5195
|
[locale]: localizationData
|
|
5081
5196
|
}
|
|
@@ -5298,8 +5413,8 @@ async function formatDataWithBiome(data, filePath, options) {
|
|
|
5298
5413
|
});
|
|
5299
5414
|
return formatted.content;
|
|
5300
5415
|
} catch (error) {
|
|
5301
|
-
const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access',
|
|
5302
|
-
if (_optionalChain([errorMessage, 'optionalAccess',
|
|
5416
|
+
const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access', _208 => _208.stackTrace, 'optionalAccess', _209 => _209.toString, 'call', _210 => _210(), 'access', _211 => _211.split, 'call', _212 => _212("\n"), 'access', _213 => _213[0]]) : "";
|
|
5417
|
+
if (_optionalChain([errorMessage, 'optionalAccess', _214 => _214.includes, 'call', _215 => _215("does not exist in the workspace")])) {
|
|
5303
5418
|
} else {
|
|
5304
5419
|
console.log(`\u26A0\uFE0F Biome skipped ${path14.default.basename(filePath)}`);
|
|
5305
5420
|
if (errorMessage) {
|
|
@@ -5346,7 +5461,7 @@ function createPoDataLoader(params) {
|
|
|
5346
5461
|
Object.entries(entries).forEach(([msgid, entry]) => {
|
|
5347
5462
|
if (msgid && entry.msgid) {
|
|
5348
5463
|
const context = entry.msgctxt || "";
|
|
5349
|
-
const fullEntry = _optionalChain([parsedPo, 'access',
|
|
5464
|
+
const fullEntry = _optionalChain([parsedPo, 'access', _216 => _216.translations, 'access', _217 => _217[context], 'optionalAccess', _218 => _218[msgid]]);
|
|
5350
5465
|
if (fullEntry) {
|
|
5351
5466
|
result[msgid] = fullEntry;
|
|
5352
5467
|
}
|
|
@@ -5356,8 +5471,8 @@ function createPoDataLoader(params) {
|
|
|
5356
5471
|
return result;
|
|
5357
5472
|
},
|
|
5358
5473
|
async push(locale, data, originalInput, originalLocale, pullInput) {
|
|
5359
|
-
const currentSections = _optionalChain([pullInput, 'optionalAccess',
|
|
5360
|
-
const originalSections = _optionalChain([originalInput, 'optionalAccess',
|
|
5474
|
+
const currentSections = _optionalChain([pullInput, 'optionalAccess', _219 => _219.split, 'call', _220 => _220("\n\n"), 'access', _221 => _221.filter, 'call', _222 => _222(Boolean)]) || [];
|
|
5475
|
+
const originalSections = _optionalChain([originalInput, 'optionalAccess', _223 => _223.split, 'call', _224 => _224("\n\n"), 'access', _225 => _225.filter, 'call', _226 => _226(Boolean)]) || [];
|
|
5361
5476
|
const result = originalSections.map((section) => {
|
|
5362
5477
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
5363
5478
|
if (Object.keys(sectionPo.translations).length === 0) {
|
|
@@ -5426,8 +5541,8 @@ function createPoContentLoader() {
|
|
|
5426
5541
|
{
|
|
5427
5542
|
...entry,
|
|
5428
5543
|
msgstr: [
|
|
5429
|
-
_optionalChain([data, 'access',
|
|
5430
|
-
_optionalChain([data, 'access',
|
|
5544
|
+
_optionalChain([data, 'access', _227 => _227[entry.msgid], 'optionalAccess', _228 => _228.singular]),
|
|
5545
|
+
_optionalChain([data, 'access', _229 => _229[entry.msgid], 'optionalAccess', _230 => _230.plural]) || null
|
|
5431
5546
|
].filter(Boolean)
|
|
5432
5547
|
}
|
|
5433
5548
|
]).fromPairs().value();
|
|
@@ -5549,7 +5664,7 @@ function pullV1(xliffElement, locale, originalLocale) {
|
|
|
5549
5664
|
let key = getTransUnitKey(unit);
|
|
5550
5665
|
if (!key) return;
|
|
5551
5666
|
if (seenKeys.has(key)) {
|
|
5552
|
-
const id = _optionalChain([unit, 'access',
|
|
5667
|
+
const id = _optionalChain([unit, 'access', _231 => _231.getAttribute, 'call', _232 => _232("id"), 'optionalAccess', _233 => _233.trim, 'call', _234 => _234()]);
|
|
5553
5668
|
if (id) {
|
|
5554
5669
|
key = `${key}#${id}`;
|
|
5555
5670
|
} else {
|
|
@@ -5597,7 +5712,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
5597
5712
|
let key = getTransUnitKey(unit);
|
|
5598
5713
|
if (!key) return;
|
|
5599
5714
|
if (seenKeys.has(key)) {
|
|
5600
|
-
const id = _optionalChain([unit, 'access',
|
|
5715
|
+
const id = _optionalChain([unit, 'access', _235 => _235.getAttribute, 'call', _236 => _236("id"), 'optionalAccess', _237 => _237.trim, 'call', _238 => _238()]);
|
|
5601
5716
|
if (id) {
|
|
5602
5717
|
key = `${key}#${id}`;
|
|
5603
5718
|
} else {
|
|
@@ -5639,7 +5754,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
5639
5754
|
const translationKeys = new Set(Object.keys(translations));
|
|
5640
5755
|
existingUnits.forEach((unit, key) => {
|
|
5641
5756
|
if (!translationKeys.has(key)) {
|
|
5642
|
-
_optionalChain([unit, 'access',
|
|
5757
|
+
_optionalChain([unit, 'access', _239 => _239.parentNode, 'optionalAccess', _240 => _240.removeChild, 'call', _241 => _241(unit)]);
|
|
5643
5758
|
}
|
|
5644
5759
|
});
|
|
5645
5760
|
return serializeWithDeclaration(
|
|
@@ -5682,18 +5797,18 @@ function traverseUnitsV2(container, fileId, currentPath, result) {
|
|
|
5682
5797
|
Array.from(container.children).forEach((child) => {
|
|
5683
5798
|
const tagName = child.tagName;
|
|
5684
5799
|
if (tagName === "unit") {
|
|
5685
|
-
const unitId = _optionalChain([child, 'access',
|
|
5800
|
+
const unitId = _optionalChain([child, 'access', _242 => _242.getAttribute, 'call', _243 => _243("id"), 'optionalAccess', _244 => _244.trim, 'call', _245 => _245()]);
|
|
5686
5801
|
if (!unitId) return;
|
|
5687
5802
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
5688
5803
|
const segment = child.querySelector("segment");
|
|
5689
|
-
const source = _optionalChain([segment, 'optionalAccess',
|
|
5804
|
+
const source = _optionalChain([segment, 'optionalAccess', _246 => _246.querySelector, 'call', _247 => _247("source")]);
|
|
5690
5805
|
if (source) {
|
|
5691
5806
|
result[key] = extractTextContent(source);
|
|
5692
5807
|
} else {
|
|
5693
5808
|
result[key] = unitId;
|
|
5694
5809
|
}
|
|
5695
5810
|
} else if (tagName === "group") {
|
|
5696
|
-
const groupId = _optionalChain([child, 'access',
|
|
5811
|
+
const groupId = _optionalChain([child, 'access', _248 => _248.getAttribute, 'call', _249 => _249("id"), 'optionalAccess', _250 => _250.trim, 'call', _251 => _251()]);
|
|
5697
5812
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
5698
5813
|
traverseUnitsV2(child, fileId, newPath, result);
|
|
5699
5814
|
}
|
|
@@ -5729,12 +5844,12 @@ function indexUnitsV2(container, fileId, currentPath, index) {
|
|
|
5729
5844
|
Array.from(container.children).forEach((child) => {
|
|
5730
5845
|
const tagName = child.tagName;
|
|
5731
5846
|
if (tagName === "unit") {
|
|
5732
|
-
const unitId = _optionalChain([child, 'access',
|
|
5847
|
+
const unitId = _optionalChain([child, 'access', _252 => _252.getAttribute, 'call', _253 => _253("id"), 'optionalAccess', _254 => _254.trim, 'call', _255 => _255()]);
|
|
5733
5848
|
if (!unitId) return;
|
|
5734
5849
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
5735
5850
|
index.set(key, child);
|
|
5736
5851
|
} else if (tagName === "group") {
|
|
5737
|
-
const groupId = _optionalChain([child, 'access',
|
|
5852
|
+
const groupId = _optionalChain([child, 'access', _256 => _256.getAttribute, 'call', _257 => _257("id"), 'optionalAccess', _258 => _258.trim, 'call', _259 => _259()]);
|
|
5738
5853
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
5739
5854
|
indexUnitsV2(child, fileId, newPath, index);
|
|
5740
5855
|
}
|
|
@@ -5755,9 +5870,9 @@ function updateUnitV2(unit, value) {
|
|
|
5755
5870
|
setTextContent(source, value);
|
|
5756
5871
|
}
|
|
5757
5872
|
function getTransUnitKey(transUnit) {
|
|
5758
|
-
const resname = _optionalChain([transUnit, 'access',
|
|
5873
|
+
const resname = _optionalChain([transUnit, 'access', _260 => _260.getAttribute, 'call', _261 => _261("resname"), 'optionalAccess', _262 => _262.trim, 'call', _263 => _263()]);
|
|
5759
5874
|
if (resname) return resname;
|
|
5760
|
-
const id = _optionalChain([transUnit, 'access',
|
|
5875
|
+
const id = _optionalChain([transUnit, 'access', _264 => _264.getAttribute, 'call', _265 => _265("id"), 'optionalAccess', _266 => _266.trim, 'call', _267 => _267()]);
|
|
5761
5876
|
if (id) return id;
|
|
5762
5877
|
const sourceElement = transUnit.querySelector("source");
|
|
5763
5878
|
if (sourceElement) {
|
|
@@ -5814,7 +5929,7 @@ function formatXml(xml) {
|
|
|
5814
5929
|
if (cdataNode) {
|
|
5815
5930
|
return `${indent2}${openTag}<![CDATA[${cdataNode.nodeValue}]]></${tagName}>`;
|
|
5816
5931
|
}
|
|
5817
|
-
const textContent3 = _optionalChain([element, 'access',
|
|
5932
|
+
const textContent3 = _optionalChain([element, 'access', _268 => _268.textContent, 'optionalAccess', _269 => _269.trim, 'call', _270 => _270()]) || "";
|
|
5818
5933
|
const hasOnlyText = element.childNodes.length === 1 && element.childNodes[0].nodeType === 3;
|
|
5819
5934
|
if (hasOnlyText && textContent3) {
|
|
5820
5935
|
return `${indent2}${openTag}${textContent3}</${tagName}>`;
|
|
@@ -6107,7 +6222,7 @@ function createDatoClient(params) {
|
|
|
6107
6222
|
ids: !records.length ? void 0 : records.join(",")
|
|
6108
6223
|
}
|
|
6109
6224
|
}).catch(
|
|
6110
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
6225
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _271 => _271.response, 'optionalAccess', _272 => _272.body, 'optionalAccess', _273 => _273.data, 'optionalAccess', _274 => _274[0]]) || error)
|
|
6111
6226
|
);
|
|
6112
6227
|
},
|
|
6113
6228
|
findRecordsForModel: async (modelId, records) => {
|
|
@@ -6118,10 +6233,10 @@ function createDatoClient(params) {
|
|
|
6118
6233
|
filter: {
|
|
6119
6234
|
type: modelId,
|
|
6120
6235
|
only_valid: "true",
|
|
6121
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
6236
|
+
ids: !_optionalChain([records, 'optionalAccess', _275 => _275.length]) ? void 0 : records.join(",")
|
|
6122
6237
|
}
|
|
6123
6238
|
}).catch(
|
|
6124
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
6239
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _276 => _276.response, 'optionalAccess', _277 => _277.body, 'optionalAccess', _278 => _278.data, 'optionalAccess', _279 => _279[0]]) || error)
|
|
6125
6240
|
);
|
|
6126
6241
|
return result;
|
|
6127
6242
|
} catch (_error) {
|
|
@@ -6137,10 +6252,10 @@ function createDatoClient(params) {
|
|
|
6137
6252
|
updateRecord: async (id, payload) => {
|
|
6138
6253
|
try {
|
|
6139
6254
|
await dato.items.update(id, payload).catch(
|
|
6140
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
6255
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _280 => _280.response, 'optionalAccess', _281 => _281.body, 'optionalAccess', _282 => _282.data, 'optionalAccess', _283 => _283[0]]) || error)
|
|
6141
6256
|
);
|
|
6142
6257
|
} catch (_error) {
|
|
6143
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
6258
|
+
if (_optionalChain([_error, 'optionalAccess', _284 => _284.attributes, 'optionalAccess', _285 => _285.details, 'optionalAccess', _286 => _286.message])) {
|
|
6144
6259
|
throw new Error(
|
|
6145
6260
|
[
|
|
6146
6261
|
`${_error.attributes.details.message}`,
|
|
@@ -6162,10 +6277,10 @@ function createDatoClient(params) {
|
|
|
6162
6277
|
enableFieldLocalization: async (args) => {
|
|
6163
6278
|
try {
|
|
6164
6279
|
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch(
|
|
6165
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
6280
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _287 => _287.response, 'optionalAccess', _288 => _288.body, 'optionalAccess', _289 => _289.data, 'optionalAccess', _290 => _290[0]]) || error)
|
|
6166
6281
|
);
|
|
6167
6282
|
} catch (_error) {
|
|
6168
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
6283
|
+
if (_optionalChain([_error, 'optionalAccess', _291 => _291.attributes, 'optionalAccess', _292 => _292.code]) === "NOT_FOUND") {
|
|
6169
6284
|
throw new Error(
|
|
6170
6285
|
[
|
|
6171
6286
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -6173,7 +6288,7 @@ function createDatoClient(params) {
|
|
|
6173
6288
|
].join("\n\n")
|
|
6174
6289
|
);
|
|
6175
6290
|
}
|
|
6176
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
6291
|
+
if (_optionalChain([_error, 'optionalAccess', _293 => _293.attributes, 'optionalAccess', _294 => _294.details, 'optionalAccess', _295 => _295.message])) {
|
|
6177
6292
|
throw new Error(
|
|
6178
6293
|
[
|
|
6179
6294
|
`${_error.attributes.details.message}`,
|
|
@@ -6251,7 +6366,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
6251
6366
|
const records = await dato.findRecordsForModel(modelId);
|
|
6252
6367
|
const recordChoices = createRecordChoices(
|
|
6253
6368
|
records,
|
|
6254
|
-
_optionalChain([config, 'access',
|
|
6369
|
+
_optionalChain([config, 'access', _296 => _296.models, 'access', _297 => _297[modelId], 'optionalAccess', _298 => _298.records]) || [],
|
|
6255
6370
|
project
|
|
6256
6371
|
);
|
|
6257
6372
|
const selectedRecords = await promptRecordSelection(
|
|
@@ -6270,14 +6385,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
6270
6385
|
},
|
|
6271
6386
|
async pull(locale, input2, initCtx) {
|
|
6272
6387
|
const result = {};
|
|
6273
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
6274
|
-
let records = _optionalChain([initCtx, 'optionalAccess',
|
|
6388
|
+
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _299 => _299.models]) || {})) {
|
|
6389
|
+
let records = _optionalChain([initCtx, 'optionalAccess', _300 => _300.models, 'access', _301 => _301[modelId], 'access', _302 => _302.records]) || [];
|
|
6275
6390
|
const recordIds = records.map((record) => record.id);
|
|
6276
6391
|
records = await dato.findRecords(recordIds);
|
|
6277
6392
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
6278
6393
|
if (records.length > 0) {
|
|
6279
6394
|
result[modelId] = {
|
|
6280
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
6395
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _303 => _303.models, 'optionalAccess', _304 => _304[modelId], 'optionalAccess', _305 => _305.fields]) || [],
|
|
6281
6396
|
records
|
|
6282
6397
|
};
|
|
6283
6398
|
}
|
|
@@ -6340,7 +6455,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
6340
6455
|
return records.map((record) => ({
|
|
6341
6456
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
6342
6457
|
value: record.id,
|
|
6343
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
6458
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _306 => _306.includes, 'call', _307 => _307(record.id)])
|
|
6344
6459
|
}));
|
|
6345
6460
|
}
|
|
6346
6461
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -6659,7 +6774,7 @@ function createVttLoader() {
|
|
|
6659
6774
|
if (!input2) {
|
|
6660
6775
|
return "";
|
|
6661
6776
|
}
|
|
6662
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
6777
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _308 => _308.parse, 'call', _309 => _309(input2), 'optionalAccess', _310 => _310.cues]);
|
|
6663
6778
|
if (Object.keys(vtt).length === 0) {
|
|
6664
6779
|
return {};
|
|
6665
6780
|
} else {
|
|
@@ -6713,7 +6828,7 @@ function variableExtractLoader(params) {
|
|
|
6713
6828
|
for (let i = 0; i < matches.length; i++) {
|
|
6714
6829
|
const match2 = matches[i];
|
|
6715
6830
|
const currentValue = result[key].value;
|
|
6716
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
6831
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _311 => _311.replace, 'call', _312 => _312(match2, `{variable:${i}}`)]);
|
|
6717
6832
|
result[key].value = newValue;
|
|
6718
6833
|
result[key].variables[i] = match2;
|
|
6719
6834
|
}
|
|
@@ -6728,7 +6843,7 @@ function variableExtractLoader(params) {
|
|
|
6728
6843
|
const variable = valueObj.variables[i];
|
|
6729
6844
|
const currentValue = result[key];
|
|
6730
6845
|
if (typeof currentValue === "string") {
|
|
6731
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
6846
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _313 => _313.replaceAll, 'call', _314 => _314(
|
|
6732
6847
|
`{variable:${i}}`,
|
|
6733
6848
|
variable
|
|
6734
6849
|
)]);
|
|
@@ -6932,7 +7047,7 @@ function createVueJsonLoader() {
|
|
|
6932
7047
|
return createLoader({
|
|
6933
7048
|
pull: async (locale, input2, ctx) => {
|
|
6934
7049
|
const parsed = parseVueFile(input2);
|
|
6935
|
-
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess',
|
|
7050
|
+
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _315 => _315.i18n, 'optionalAccess', _316 => _316[locale]]), () => ( {}));
|
|
6936
7051
|
},
|
|
6937
7052
|
push: async (locale, data, originalInput) => {
|
|
6938
7053
|
const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
|
|
@@ -7117,7 +7232,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
|
|
|
7117
7232
|
objectExpression.properties.forEach((prop) => {
|
|
7118
7233
|
if (!t.isObjectProperty(prop)) return;
|
|
7119
7234
|
const key = getPropertyKey(prop);
|
|
7120
|
-
const incomingVal = _optionalChain([data, 'optionalAccess',
|
|
7235
|
+
const incomingVal = _optionalChain([data, 'optionalAccess', _317 => _317[key]]);
|
|
7121
7236
|
if (incomingVal === void 0) {
|
|
7122
7237
|
return;
|
|
7123
7238
|
}
|
|
@@ -7153,7 +7268,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
|
|
|
7153
7268
|
let modified = false;
|
|
7154
7269
|
arrayExpression.elements.forEach((element, index) => {
|
|
7155
7270
|
if (!element) return;
|
|
7156
|
-
const incomingVal = _optionalChain([incoming, 'optionalAccess',
|
|
7271
|
+
const incomingVal = _optionalChain([incoming, 'optionalAccess', _318 => _318[index]]);
|
|
7157
7272
|
if (incomingVal === void 0) return;
|
|
7158
7273
|
if (t.isStringLiteral(element) && typeof incomingVal === "string") {
|
|
7159
7274
|
if (element.value !== incomingVal) {
|
|
@@ -7647,7 +7762,7 @@ var AST = class _AST {
|
|
|
7647
7762
|
const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
|
|
7648
7763
|
if (this.isStart() && !this.type)
|
|
7649
7764
|
ret.unshift([]);
|
|
7650
|
-
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
7765
|
+
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _319 => _319.#parent, 'optionalAccess', _320 => _320.type]) === "!")) {
|
|
7651
7766
|
ret.push({});
|
|
7652
7767
|
}
|
|
7653
7768
|
return ret;
|
|
@@ -7655,7 +7770,7 @@ var AST = class _AST {
|
|
|
7655
7770
|
isStart() {
|
|
7656
7771
|
if (this.#root === this)
|
|
7657
7772
|
return true;
|
|
7658
|
-
if (!_optionalChain([this, 'access',
|
|
7773
|
+
if (!_optionalChain([this, 'access', _321 => _321.#parent, 'optionalAccess', _322 => _322.isStart, 'call', _323 => _323()]))
|
|
7659
7774
|
return false;
|
|
7660
7775
|
if (this.#parentIndex === 0)
|
|
7661
7776
|
return true;
|
|
@@ -7671,12 +7786,12 @@ var AST = class _AST {
|
|
|
7671
7786
|
isEnd() {
|
|
7672
7787
|
if (this.#root === this)
|
|
7673
7788
|
return true;
|
|
7674
|
-
if (_optionalChain([this, 'access',
|
|
7789
|
+
if (_optionalChain([this, 'access', _324 => _324.#parent, 'optionalAccess', _325 => _325.type]) === "!")
|
|
7675
7790
|
return true;
|
|
7676
|
-
if (!_optionalChain([this, 'access',
|
|
7791
|
+
if (!_optionalChain([this, 'access', _326 => _326.#parent, 'optionalAccess', _327 => _327.isEnd, 'call', _328 => _328()]))
|
|
7677
7792
|
return false;
|
|
7678
7793
|
if (!this.type)
|
|
7679
|
-
return _optionalChain([this, 'access',
|
|
7794
|
+
return _optionalChain([this, 'access', _329 => _329.#parent, 'optionalAccess', _330 => _330.isEnd, 'call', _331 => _331()]);
|
|
7680
7795
|
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
|
7681
7796
|
return this.#parentIndex === pl - 1;
|
|
7682
7797
|
}
|
|
@@ -7921,7 +8036,7 @@ var AST = class _AST {
|
|
|
7921
8036
|
}
|
|
7922
8037
|
}
|
|
7923
8038
|
let end = "";
|
|
7924
|
-
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
8039
|
+
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _332 => _332.#parent, 'optionalAccess', _333 => _333.type]) === "!") {
|
|
7925
8040
|
end = "(?:$|\\/)";
|
|
7926
8041
|
}
|
|
7927
8042
|
const final2 = start2 + src + end;
|
|
@@ -9022,7 +9137,7 @@ function createMdxSectionsSplit2Loader() {
|
|
|
9022
9137
|
const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
|
|
9023
9138
|
const result = {
|
|
9024
9139
|
frontmatter: data.frontmatter,
|
|
9025
|
-
codePlaceholders: _optionalChain([pullInput, 'optionalAccess',
|
|
9140
|
+
codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _334 => _334.codePlaceholders]) || {},
|
|
9026
9141
|
content
|
|
9027
9142
|
};
|
|
9028
9143
|
return result;
|
|
@@ -9417,7 +9532,7 @@ function createTwigLoader() {
|
|
|
9417
9532
|
const attrs = LOCALIZABLE_ATTRIBUTES2[tagName];
|
|
9418
9533
|
if (!attrs) return;
|
|
9419
9534
|
for (const attr of attrs) {
|
|
9420
|
-
const value = _optionalChain([element, 'access',
|
|
9535
|
+
const value = _optionalChain([element, 'access', _335 => _335.attribs, 'optionalAccess', _336 => _336[attr]]);
|
|
9421
9536
|
if (value && value.trim()) {
|
|
9422
9537
|
const restoredValue = postprocessTwig(value.trim(), twigBlocks);
|
|
9423
9538
|
result[`${path19}#${attr}`] = restoredValue;
|
|
@@ -9750,6 +9865,18 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
9750
9865
|
switch (bucketType) {
|
|
9751
9866
|
default:
|
|
9752
9867
|
throw new Error(`Unsupported bucket type: ${bucketType}`);
|
|
9868
|
+
case "ail":
|
|
9869
|
+
return composeLoaders(
|
|
9870
|
+
createTextFileLoader(bucketPathPattern),
|
|
9871
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
9872
|
+
createAilLoader(),
|
|
9873
|
+
createEnsureKeyOrderLoader(),
|
|
9874
|
+
createFlatLoader(),
|
|
9875
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
9876
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
9877
|
+
createSyncLoader(),
|
|
9878
|
+
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
9879
|
+
);
|
|
9753
9880
|
case "android":
|
|
9754
9881
|
return composeLoaders(
|
|
9755
9882
|
createTextFileLoader(bucketPathPattern),
|
|
@@ -10505,7 +10632,7 @@ function createBasicTranslator(model, systemPrompt, settings = {}) {
|
|
|
10505
10632
|
]
|
|
10506
10633
|
});
|
|
10507
10634
|
const result = JSON.parse(response.text);
|
|
10508
|
-
return _optionalChain([result, 'optionalAccess',
|
|
10635
|
+
return _optionalChain([result, 'optionalAccess', _337 => _337.data]) || {};
|
|
10509
10636
|
}
|
|
10510
10637
|
}
|
|
10511
10638
|
function extractPayloadChunks(payload) {
|
|
@@ -10588,7 +10715,7 @@ function getPureModelProvider(provider) {
|
|
|
10588
10715
|
|
|
10589
10716
|
${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
|
|
10590
10717
|
`;
|
|
10591
|
-
switch (_optionalChain([provider, 'optionalAccess',
|
|
10718
|
+
switch (_optionalChain([provider, 'optionalAccess', _338 => _338.id])) {
|
|
10592
10719
|
case "openai": {
|
|
10593
10720
|
if (!process.env.OPENAI_API_KEY) {
|
|
10594
10721
|
throw new Error(
|
|
@@ -10646,7 +10773,7 @@ function getPureModelProvider(provider) {
|
|
|
10646
10773
|
})(provider.model);
|
|
10647
10774
|
}
|
|
10648
10775
|
default: {
|
|
10649
|
-
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess',
|
|
10776
|
+
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _339 => _339.id])));
|
|
10650
10777
|
}
|
|
10651
10778
|
}
|
|
10652
10779
|
}
|
|
@@ -10932,7 +11059,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
10932
11059
|
validateParams(i18nConfig, flags);
|
|
10933
11060
|
ora.succeed("Localization configuration is valid");
|
|
10934
11061
|
ora.start("Connecting to Lingo.dev Localization Engine...");
|
|
10935
|
-
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess',
|
|
11062
|
+
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _340 => _340.provider]);
|
|
10936
11063
|
if (isByokMode) {
|
|
10937
11064
|
authId = null;
|
|
10938
11065
|
ora.succeed("Using external provider (BYOK mode)");
|
|
@@ -10946,16 +11073,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
10946
11073
|
flags
|
|
10947
11074
|
});
|
|
10948
11075
|
let buckets = getBuckets(i18nConfig);
|
|
10949
|
-
if (_optionalChain([flags, 'access',
|
|
11076
|
+
if (_optionalChain([flags, 'access', _341 => _341.bucket, 'optionalAccess', _342 => _342.length])) {
|
|
10950
11077
|
buckets = buckets.filter(
|
|
10951
11078
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
10952
11079
|
);
|
|
10953
11080
|
}
|
|
10954
11081
|
ora.succeed("Buckets retrieved");
|
|
10955
|
-
if (_optionalChain([flags, 'access',
|
|
11082
|
+
if (_optionalChain([flags, 'access', _343 => _343.file, 'optionalAccess', _344 => _344.length])) {
|
|
10956
11083
|
buckets = buckets.map((bucket) => {
|
|
10957
11084
|
const paths = bucket.paths.filter(
|
|
10958
|
-
(path19) => flags.file.find((file) => _optionalChain([path19, 'access',
|
|
11085
|
+
(path19) => flags.file.find((file) => _optionalChain([path19, 'access', _345 => _345.pathPattern, 'optionalAccess', _346 => _346.includes, 'call', _347 => _347(file)]))
|
|
10959
11086
|
);
|
|
10960
11087
|
return { ...bucket, paths };
|
|
10961
11088
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -10976,7 +11103,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
10976
11103
|
});
|
|
10977
11104
|
}
|
|
10978
11105
|
}
|
|
10979
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
11106
|
+
const targetLocales = _optionalChain([flags, 'access', _348 => _348.locale, 'optionalAccess', _349 => _349.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
10980
11107
|
ora.start("Setting up localization cache...");
|
|
10981
11108
|
const checkLockfileProcessor = createDeltaProcessor("");
|
|
10982
11109
|
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
@@ -11261,7 +11388,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
11261
11388
|
}
|
|
11262
11389
|
const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
|
|
11263
11390
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
11264
|
-
if (!_optionalChain([flags, 'access',
|
|
11391
|
+
if (!_optionalChain([flags, 'access', _350 => _350.locale, 'optionalAccess', _351 => _351.length])) {
|
|
11265
11392
|
await deltaProcessor.saveChecksums(checksums);
|
|
11266
11393
|
}
|
|
11267
11394
|
}
|
|
@@ -11385,12 +11512,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
11385
11512
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
11386
11513
|
docUrl: "bucketNotFound"
|
|
11387
11514
|
});
|
|
11388
|
-
} else if (_optionalChain([flags, 'access',
|
|
11515
|
+
} else if (_optionalChain([flags, 'access', _352 => _352.locale, 'optionalAccess', _353 => _353.some, 'call', _354 => _354((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
11389
11516
|
throw new ValidationError({
|
|
11390
11517
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
11391
11518
|
docUrl: "localeTargetNotFound"
|
|
11392
11519
|
});
|
|
11393
|
-
} else if (_optionalChain([flags, 'access',
|
|
11520
|
+
} else if (_optionalChain([flags, 'access', _355 => _355.bucket, 'optionalAccess', _356 => _356.some, 'call', _357 => _357(
|
|
11394
11521
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
11395
11522
|
)])) {
|
|
11396
11523
|
throw new ValidationError({
|
|
@@ -11924,7 +12051,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
|
|
|
11924
12051
|
const response = await engine.whoami();
|
|
11925
12052
|
return {
|
|
11926
12053
|
authenticated: !!response,
|
|
11927
|
-
username: _optionalChain([response, 'optionalAccess',
|
|
12054
|
+
username: _optionalChain([response, 'optionalAccess', _358 => _358.email])
|
|
11928
12055
|
};
|
|
11929
12056
|
} catch (error) {
|
|
11930
12057
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -12040,7 +12167,7 @@ function createExplicitLocalizer(provider) {
|
|
|
12040
12167
|
}
|
|
12041
12168
|
function createAiSdkLocalizer(params) {
|
|
12042
12169
|
const skipAuth = params.skipAuth === true;
|
|
12043
|
-
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
12170
|
+
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _359 => _359.apiKeyName]), () => ( ""))];
|
|
12044
12171
|
if (!skipAuth && !apiKey || !params.apiKeyName) {
|
|
12045
12172
|
throw new Error(
|
|
12046
12173
|
_dedent2.default`
|
|
@@ -12174,8 +12301,8 @@ async function setup(input2) {
|
|
|
12174
12301
|
throw new Error(
|
|
12175
12302
|
"No buckets found in i18n.json. Please add at least one bucket containing i18n content."
|
|
12176
12303
|
);
|
|
12177
|
-
} else if (_optionalChain([ctx, 'access',
|
|
12178
|
-
(bucket) => !_optionalChain([ctx, 'access',
|
|
12304
|
+
} else if (_optionalChain([ctx, 'access', _360 => _360.flags, 'access', _361 => _361.bucket, 'optionalAccess', _362 => _362.some, 'call', _363 => _363(
|
|
12305
|
+
(bucket) => !_optionalChain([ctx, 'access', _364 => _364.config, 'optionalAccess', _365 => _365.buckets, 'access', _366 => _366[bucket]])
|
|
12179
12306
|
)])) {
|
|
12180
12307
|
throw new Error(
|
|
12181
12308
|
`One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
|
|
@@ -12188,7 +12315,7 @@ async function setup(input2) {
|
|
|
12188
12315
|
title: "Selecting localization provider",
|
|
12189
12316
|
task: async (ctx, task) => {
|
|
12190
12317
|
ctx.localizer = createLocalizer(
|
|
12191
|
-
_optionalChain([ctx, 'access',
|
|
12318
|
+
_optionalChain([ctx, 'access', _367 => _367.config, 'optionalAccess', _368 => _368.provider]),
|
|
12192
12319
|
ctx.flags.apiKey
|
|
12193
12320
|
);
|
|
12194
12321
|
if (!ctx.localizer) {
|
|
@@ -12201,7 +12328,7 @@ async function setup(input2) {
|
|
|
12201
12328
|
},
|
|
12202
12329
|
{
|
|
12203
12330
|
title: "Checking authentication",
|
|
12204
|
-
enabled: (ctx) => _optionalChain([ctx, 'access',
|
|
12331
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _369 => _369.localizer, 'optionalAccess', _370 => _370.id]) === "Lingo.dev",
|
|
12205
12332
|
task: async (ctx, task) => {
|
|
12206
12333
|
const authStatus = await ctx.localizer.checkAuth();
|
|
12207
12334
|
if (!authStatus.authenticated) {
|
|
@@ -12214,7 +12341,7 @@ async function setup(input2) {
|
|
|
12214
12341
|
},
|
|
12215
12342
|
{
|
|
12216
12343
|
title: "Validating configuration",
|
|
12217
|
-
enabled: (ctx) => _optionalChain([ctx, 'access',
|
|
12344
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _371 => _371.localizer, 'optionalAccess', _372 => _372.id]) !== "Lingo.dev",
|
|
12218
12345
|
task: async (ctx, task) => {
|
|
12219
12346
|
const validationStatus = await ctx.localizer.validateSettings();
|
|
12220
12347
|
if (!validationStatus.valid) {
|
|
@@ -12545,7 +12672,7 @@ function createWorkerTask(args) {
|
|
|
12545
12672
|
const processableData = _lodash2.default.chain(sourceData).entries().filter(
|
|
12546
12673
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
|
|
12547
12674
|
).filter(
|
|
12548
|
-
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access',
|
|
12675
|
+
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _373 => _373.onlyKeys, 'optionalAccess', _374 => _374.some, 'call', _375 => _375(
|
|
12549
12676
|
(pattern) => minimatch(key, pattern)
|
|
12550
12677
|
)])
|
|
12551
12678
|
).fromPairs().value();
|
|
@@ -12613,7 +12740,7 @@ function createWorkerTask(args) {
|
|
|
12613
12740
|
finalRenamedTargetData
|
|
12614
12741
|
);
|
|
12615
12742
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
12616
|
-
if (!_optionalChain([args, 'access',
|
|
12743
|
+
if (!_optionalChain([args, 'access', _376 => _376.ctx, 'access', _377 => _377.flags, 'access', _378 => _378.targetLocale, 'optionalAccess', _379 => _379.length])) {
|
|
12617
12744
|
await deltaProcessor.saveChecksums(checksums);
|
|
12618
12745
|
}
|
|
12619
12746
|
});
|
|
@@ -12818,10 +12945,10 @@ var flagsSchema2 = _zod.z.object({
|
|
|
12818
12945
|
async function frozen(input2) {
|
|
12819
12946
|
console.log(_chalk2.default.hex(colors.orange)("[Frozen]"));
|
|
12820
12947
|
let buckets = getBuckets(input2.config);
|
|
12821
|
-
if (_optionalChain([input2, 'access',
|
|
12948
|
+
if (_optionalChain([input2, 'access', _380 => _380.flags, 'access', _381 => _381.bucket, 'optionalAccess', _382 => _382.length])) {
|
|
12822
12949
|
buckets = buckets.filter((b) => input2.flags.bucket.includes(b.type));
|
|
12823
12950
|
}
|
|
12824
|
-
if (_optionalChain([input2, 'access',
|
|
12951
|
+
if (_optionalChain([input2, 'access', _383 => _383.flags, 'access', _384 => _384.file, 'optionalAccess', _385 => _385.length])) {
|
|
12825
12952
|
buckets = buckets.map((bucket) => {
|
|
12826
12953
|
const paths = bucket.paths.filter(
|
|
12827
12954
|
(p) => input2.flags.file.some(
|
|
@@ -12958,13 +13085,13 @@ async function frozen(input2) {
|
|
|
12958
13085
|
|
|
12959
13086
|
// src/cli/cmd/run/_utils.ts
|
|
12960
13087
|
async function determineAuthId(ctx) {
|
|
12961
|
-
const isByokMode = !!_optionalChain([ctx, 'access',
|
|
13088
|
+
const isByokMode = !!_optionalChain([ctx, 'access', _386 => _386.config, 'optionalAccess', _387 => _387.provider]);
|
|
12962
13089
|
if (isByokMode) {
|
|
12963
13090
|
return null;
|
|
12964
13091
|
} else {
|
|
12965
13092
|
try {
|
|
12966
|
-
const authStatus = await _optionalChain([ctx, 'access',
|
|
12967
|
-
return _optionalChain([authStatus, 'optionalAccess',
|
|
13093
|
+
const authStatus = await _optionalChain([ctx, 'access', _388 => _388.localizer, 'optionalAccess', _389 => _389.checkAuth, 'call', _390 => _390()]);
|
|
13094
|
+
return _optionalChain([authStatus, 'optionalAccess', _391 => _391.username]) || null;
|
|
12968
13095
|
} catch (e3) {
|
|
12969
13096
|
return null;
|
|
12970
13097
|
}
|
|
@@ -13162,7 +13289,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
13162
13289
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
13163
13290
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
13164
13291
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
13165
|
-
_optionalChain([this, 'access',
|
|
13292
|
+
_optionalChain([this, 'access', _392 => _392.platformKit, 'optionalAccess', _393 => _393.gitConfig, 'call', _394 => _394()]);
|
|
13166
13293
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
13167
13294
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
13168
13295
|
if (!processOwnCommits) {
|
|
@@ -13194,7 +13321,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
13194
13321
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
13195
13322
|
var PullRequestFlow = class extends InBranchFlow {
|
|
13196
13323
|
async preRun() {
|
|
13197
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
13324
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _395 => _395()]);
|
|
13198
13325
|
if (!canContinue) {
|
|
13199
13326
|
return false;
|
|
13200
13327
|
}
|
|
@@ -13461,10 +13588,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
13461
13588
|
repo_slug: this.platformConfig.repositoryName,
|
|
13462
13589
|
state: "OPEN"
|
|
13463
13590
|
}).then(({ data: { values } }) => {
|
|
13464
|
-
return _optionalChain([values, 'optionalAccess',
|
|
13465
|
-
({ source, destination }) => _optionalChain([source, 'optionalAccess',
|
|
13591
|
+
return _optionalChain([values, 'optionalAccess', _396 => _396.find, 'call', _397 => _397(
|
|
13592
|
+
({ source, destination }) => _optionalChain([source, 'optionalAccess', _398 => _398.branch, 'optionalAccess', _399 => _399.name]) === branch && _optionalChain([destination, 'optionalAccess', _400 => _400.branch, 'optionalAccess', _401 => _401.name]) === this.platformConfig.baseBranchName
|
|
13466
13593
|
)]);
|
|
13467
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
13594
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _402 => _402.id]));
|
|
13468
13595
|
}
|
|
13469
13596
|
async closePullRequest({ pullRequestNumber }) {
|
|
13470
13597
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -13560,7 +13687,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
13560
13687
|
repo: this.platformConfig.repositoryName,
|
|
13561
13688
|
base: this.platformConfig.baseBranchName,
|
|
13562
13689
|
state: "open"
|
|
13563
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
13690
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _403 => _403.number]));
|
|
13564
13691
|
}
|
|
13565
13692
|
async closePullRequest({ pullRequestNumber }) {
|
|
13566
13693
|
await this.octokit.rest.pulls.update({
|
|
@@ -13687,7 +13814,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
13687
13814
|
sourceBranch: branch,
|
|
13688
13815
|
state: "opened"
|
|
13689
13816
|
});
|
|
13690
|
-
return _optionalChain([mergeRequests, 'access',
|
|
13817
|
+
return _optionalChain([mergeRequests, 'access', _404 => _404[0], 'optionalAccess', _405 => _405.iid]);
|
|
13691
13818
|
}
|
|
13692
13819
|
async closePullRequest({
|
|
13693
13820
|
pullRequestNumber
|
|
@@ -13799,7 +13926,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
13799
13926
|
}
|
|
13800
13927
|
const env = {
|
|
13801
13928
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
13802
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
13929
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _406 => _406.pullRequest, 'optionalAccess', _407 => _407.toString, 'call', _408 => _408()]) || "false",
|
|
13803
13930
|
...options.commitMessage && {
|
|
13804
13931
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
13805
13932
|
},
|
|
@@ -13825,7 +13952,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
13825
13952
|
const { isPullRequestMode } = platformKit.config;
|
|
13826
13953
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
13827
13954
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
13828
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
13955
|
+
const canRun = await _optionalChain([flow, 'access', _409 => _409.preRun, 'optionalCall', _410 => _410()]);
|
|
13829
13956
|
if (canRun === false) {
|
|
13830
13957
|
return;
|
|
13831
13958
|
}
|
|
@@ -13835,7 +13962,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
13835
13962
|
if (!hasChanges) {
|
|
13836
13963
|
return;
|
|
13837
13964
|
}
|
|
13838
|
-
await _optionalChain([flow, 'access',
|
|
13965
|
+
await _optionalChain([flow, 'access', _411 => _411.postRun, 'optionalCall', _412 => _412()]);
|
|
13839
13966
|
});
|
|
13840
13967
|
function parseBooleanArg(val) {
|
|
13841
13968
|
if (val === true) return true;
|
|
@@ -13872,8 +13999,8 @@ function exitGracefully(elapsedMs = 0) {
|
|
|
13872
13999
|
}
|
|
13873
14000
|
}
|
|
13874
14001
|
function checkForPendingOperations() {
|
|
13875
|
-
const activeHandles = _optionalChain([process, 'access',
|
|
13876
|
-
const activeRequests = _optionalChain([process, 'access',
|
|
14002
|
+
const activeHandles = _optionalChain([process, 'access', _413 => _413._getActiveHandles, 'optionalCall', _414 => _414()]) || [];
|
|
14003
|
+
const activeRequests = _optionalChain([process, 'access', _415 => _415._getActiveRequests, 'optionalCall', _416 => _416()]) || [];
|
|
13877
14004
|
const nonStandardHandles = activeHandles.filter((handle) => {
|
|
13878
14005
|
if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
|
|
13879
14006
|
return false;
|
|
@@ -13942,17 +14069,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
13942
14069
|
flags
|
|
13943
14070
|
});
|
|
13944
14071
|
let buckets = getBuckets(i18nConfig);
|
|
13945
|
-
if (_optionalChain([flags, 'access',
|
|
14072
|
+
if (_optionalChain([flags, 'access', _417 => _417.bucket, 'optionalAccess', _418 => _418.length])) {
|
|
13946
14073
|
buckets = buckets.filter(
|
|
13947
14074
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
13948
14075
|
);
|
|
13949
14076
|
}
|
|
13950
14077
|
ora.succeed("Buckets retrieved");
|
|
13951
|
-
if (_optionalChain([flags, 'access',
|
|
14078
|
+
if (_optionalChain([flags, 'access', _419 => _419.file, 'optionalAccess', _420 => _420.length])) {
|
|
13952
14079
|
buckets = buckets.map((bucket) => {
|
|
13953
14080
|
const paths = bucket.paths.filter(
|
|
13954
14081
|
(path19) => flags.file.find(
|
|
13955
|
-
(file) => _optionalChain([path19, 'access',
|
|
14082
|
+
(file) => _optionalChain([path19, 'access', _421 => _421.pathPattern, 'optionalAccess', _422 => _422.includes, 'call', _423 => _423(file)]) || _optionalChain([path19, 'access', _424 => _424.pathPattern, 'optionalAccess', _425 => _425.match, 'call', _426 => _426(file)]) || minimatch(path19.pathPattern, file)
|
|
13956
14083
|
)
|
|
13957
14084
|
);
|
|
13958
14085
|
return { ...bucket, paths };
|
|
@@ -13972,7 +14099,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
13972
14099
|
});
|
|
13973
14100
|
}
|
|
13974
14101
|
}
|
|
13975
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
14102
|
+
const targetLocales = _optionalChain([flags, 'access', _427 => _427.locale, 'optionalAccess', _428 => _428.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
13976
14103
|
let totalSourceKeyCount = 0;
|
|
13977
14104
|
let uniqueKeysToTranslate = 0;
|
|
13978
14105
|
let totalExistingTranslations = 0;
|
|
@@ -14380,12 +14507,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
14380
14507
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
14381
14508
|
docUrl: "bucketNotFound"
|
|
14382
14509
|
});
|
|
14383
|
-
} else if (_optionalChain([flags, 'access',
|
|
14510
|
+
} else if (_optionalChain([flags, 'access', _429 => _429.locale, 'optionalAccess', _430 => _430.some, 'call', _431 => _431((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
14384
14511
|
throw new CLIError({
|
|
14385
14512
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
14386
14513
|
docUrl: "localeTargetNotFound"
|
|
14387
14514
|
});
|
|
14388
|
-
} else if (_optionalChain([flags, 'access',
|
|
14515
|
+
} else if (_optionalChain([flags, 'access', _432 => _432.bucket, 'optionalAccess', _433 => _433.some, 'call', _434 => _434(
|
|
14389
14516
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
14390
14517
|
)])) {
|
|
14391
14518
|
throw new CLIError({
|
|
@@ -14477,7 +14604,7 @@ async function renderHero2() {
|
|
|
14477
14604
|
// package.json
|
|
14478
14605
|
var package_default = {
|
|
14479
14606
|
name: "lingo.dev",
|
|
14480
|
-
version: "0.117.
|
|
14607
|
+
version: "0.117.10",
|
|
14481
14608
|
description: "Lingo.dev CLI",
|
|
14482
14609
|
private: false,
|
|
14483
14610
|
publishConfig: {
|
|
@@ -14773,7 +14900,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
|
|
|
14773
14900
|
if (options.file && options.file.length) {
|
|
14774
14901
|
buckets = buckets.map((bucket) => {
|
|
14775
14902
|
const paths = bucket.paths.filter(
|
|
14776
|
-
(bucketPath) => _optionalChain([options, 'access',
|
|
14903
|
+
(bucketPath) => _optionalChain([options, 'access', _435 => _435.file, 'optionalAccess', _436 => _436.some, 'call', _437 => _437((f) => bucketPath.pathPattern.includes(f))])
|
|
14777
14904
|
);
|
|
14778
14905
|
return { ...bucket, paths };
|
|
14779
14906
|
}).filter((bucket) => bucket.paths.length > 0);
|