lingo.dev 0.117.8 → 0.117.9
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 +253 -131
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +131 -9
- 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";
|
|
@@ -4296,7 +4406,7 @@ function isSkippableLine(line) {
|
|
|
4296
4406
|
function parsePropertyLine(line) {
|
|
4297
4407
|
const [key, ...valueParts] = line.split("=");
|
|
4298
4408
|
return {
|
|
4299
|
-
key: _optionalChain([key, 'optionalAccess',
|
|
4409
|
+
key: _optionalChain([key, 'optionalAccess', _167 => _167.trim, 'call', _168 => _168()]) || "",
|
|
4300
4410
|
value: valueParts.join("=").trim()
|
|
4301
4411
|
};
|
|
4302
4412
|
}
|
|
@@ -4588,7 +4698,7 @@ var Parser3 = class {
|
|
|
4588
4698
|
}
|
|
4589
4699
|
}
|
|
4590
4700
|
expect(type) {
|
|
4591
|
-
if (_optionalChain([this, 'access',
|
|
4701
|
+
if (_optionalChain([this, 'access', _169 => _169.current, 'call', _170 => _170(), 'optionalAccess', _171 => _171.type]) === type) {
|
|
4592
4702
|
this.advance();
|
|
4593
4703
|
return true;
|
|
4594
4704
|
}
|
|
@@ -4665,7 +4775,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4665
4775
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
4666
4776
|
continue;
|
|
4667
4777
|
}
|
|
4668
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
4778
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _172 => _172.localizations, 'optionalAccess', _173 => _173[locale]]);
|
|
4669
4779
|
if (langTranslationEntity) {
|
|
4670
4780
|
if ("stringUnit" in langTranslationEntity) {
|
|
4671
4781
|
resultData[translationKey] = langTranslationEntity.stringUnit.value;
|
|
@@ -4679,7 +4789,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4679
4789
|
resultData[translationKey] = {};
|
|
4680
4790
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
4681
4791
|
for (const form in pluralForms) {
|
|
4682
|
-
if (_optionalChain([pluralForms, 'access',
|
|
4792
|
+
if (_optionalChain([pluralForms, 'access', _174 => _174[form], 'optionalAccess', _175 => _175.stringUnit, 'optionalAccess', _176 => _176.value])) {
|
|
4683
4793
|
resultData[translationKey][form] = pluralForms[form].stringUnit.value;
|
|
4684
4794
|
}
|
|
4685
4795
|
}
|
|
@@ -4705,7 +4815,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4705
4815
|
const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
|
|
4706
4816
|
if (typeof value === "string") {
|
|
4707
4817
|
langDataToMerge.strings[key] = {
|
|
4708
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
4818
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _177 => _177.strings, 'optionalAccess', _178 => _178[key], 'optionalAccess', _179 => _179.extractionState]),
|
|
4709
4819
|
localizations: {
|
|
4710
4820
|
[locale]: {
|
|
4711
4821
|
stringUnit: {
|
|
@@ -4720,7 +4830,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4720
4830
|
}
|
|
4721
4831
|
} else if (Array.isArray(value)) {
|
|
4722
4832
|
langDataToMerge.strings[key] = {
|
|
4723
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
4833
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _180 => _180.strings, 'optionalAccess', _181 => _181[key], 'optionalAccess', _182 => _182.extractionState]),
|
|
4724
4834
|
localizations: {
|
|
4725
4835
|
[locale]: {
|
|
4726
4836
|
stringSet: {
|
|
@@ -4778,7 +4888,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
4778
4888
|
for (const [locale, localization] of Object.entries(
|
|
4779
4889
|
entity.localizations
|
|
4780
4890
|
)) {
|
|
4781
|
-
if (_optionalChain([localization, 'access',
|
|
4891
|
+
if (_optionalChain([localization, 'access', _183 => _183.variations, 'optionalAccess', _184 => _184.plural])) {
|
|
4782
4892
|
const pluralForms = localization.variations.plural;
|
|
4783
4893
|
for (const form in pluralForms) {
|
|
4784
4894
|
const pluralKey = `${translationKey}/${form}`;
|
|
@@ -4798,7 +4908,7 @@ function _removeLocale(input2, locale) {
|
|
|
4798
4908
|
const { strings } = input2;
|
|
4799
4909
|
const newStrings = _lodash2.default.cloneDeep(strings);
|
|
4800
4910
|
for (const [key, value] of Object.entries(newStrings)) {
|
|
4801
|
-
if (_optionalChain([value, 'access',
|
|
4911
|
+
if (_optionalChain([value, 'access', _185 => _185.localizations, 'optionalAccess', _186 => _186[locale]])) {
|
|
4802
4912
|
delete value.localizations[locale];
|
|
4803
4913
|
}
|
|
4804
4914
|
}
|
|
@@ -4929,7 +5039,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
4929
5039
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
4930
5040
|
continue;
|
|
4931
5041
|
}
|
|
4932
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
5042
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _187 => _187.localizations, 'optionalAccess', _188 => _188[locale]]);
|
|
4933
5043
|
if (langTranslationEntity) {
|
|
4934
5044
|
if (!resultData[translationKey]) {
|
|
4935
5045
|
resultData[translationKey] = {};
|
|
@@ -4941,7 +5051,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
4941
5051
|
for (const [subName, subData] of Object.entries(
|
|
4942
5052
|
langTranslationEntity.substitutions
|
|
4943
5053
|
)) {
|
|
4944
|
-
const pluralForms = _optionalChain([subData, 'access',
|
|
5054
|
+
const pluralForms = _optionalChain([subData, 'access', _189 => _189.variations, 'optionalAccess', _190 => _190.plural]);
|
|
4945
5055
|
if (pluralForms) {
|
|
4946
5056
|
const forms = {};
|
|
4947
5057
|
for (const [form, formData] of Object.entries(pluralForms)) {
|
|
@@ -4966,7 +5076,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
4966
5076
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
4967
5077
|
const forms = {};
|
|
4968
5078
|
for (const [form, formData] of Object.entries(pluralForms)) {
|
|
4969
|
-
if (_optionalChain([formData, 'optionalAccess',
|
|
5079
|
+
if (_optionalChain([formData, 'optionalAccess', _191 => _191.stringUnit, 'optionalAccess', _192 => _192.value])) {
|
|
4970
5080
|
forms[form] = formData.stringUnit.value;
|
|
4971
5081
|
}
|
|
4972
5082
|
}
|
|
@@ -5009,7 +5119,7 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
5009
5119
|
for (const [subName, subData] of Object.entries(
|
|
5010
5120
|
keyData.substitutions
|
|
5011
5121
|
)) {
|
|
5012
|
-
const pluralValue = _optionalChain([subData, 'optionalAccess',
|
|
5122
|
+
const pluralValue = _optionalChain([subData, 'optionalAccess', _193 => _193.variations, 'optionalAccess', _194 => _194.plural]);
|
|
5013
5123
|
if (pluralValue && isIcuPluralString(pluralValue)) {
|
|
5014
5124
|
try {
|
|
5015
5125
|
const pluralForms = parseIcuPluralString(pluralValue, locale);
|
|
@@ -5022,8 +5132,8 @@ function createXcodeXcstringsV2Loader(defaultLocale) {
|
|
|
5022
5132
|
}
|
|
5023
5133
|
};
|
|
5024
5134
|
}
|
|
5025
|
-
const sourceLocale = _optionalChain([originalInput, 'optionalAccess',
|
|
5026
|
-
const origFormatSpec = _optionalChain([originalInput, 'optionalAccess',
|
|
5135
|
+
const sourceLocale = _optionalChain([originalInput, 'optionalAccess', _195 => _195.sourceLanguage]) || "en";
|
|
5136
|
+
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
5137
|
subs[subName] = {
|
|
5028
5138
|
formatSpecifier: origFormatSpec,
|
|
5029
5139
|
variations: {
|
|
@@ -5048,7 +5158,7 @@ ${error instanceof Error ? error.message : String(error)}`
|
|
|
5048
5158
|
values: keyData.stringSet
|
|
5049
5159
|
};
|
|
5050
5160
|
}
|
|
5051
|
-
if ("variations" in keyData && _optionalChain([keyData, 'access',
|
|
5161
|
+
if ("variations" in keyData && _optionalChain([keyData, 'access', _203 => _203.variations, 'optionalAccess', _204 => _204.plural])) {
|
|
5052
5162
|
const pluralValue = keyData.variations.plural;
|
|
5053
5163
|
if (isIcuPluralString(pluralValue)) {
|
|
5054
5164
|
try {
|
|
@@ -5075,7 +5185,7 @@ ${error instanceof Error ? error.message : String(error)}`
|
|
|
5075
5185
|
}
|
|
5076
5186
|
if (Object.keys(localizationData).length > 0) {
|
|
5077
5187
|
langDataToMerge.strings[baseKey] = {
|
|
5078
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
5188
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _205 => _205.strings, 'optionalAccess', _206 => _206[baseKey], 'optionalAccess', _207 => _207.extractionState]),
|
|
5079
5189
|
localizations: {
|
|
5080
5190
|
[locale]: localizationData
|
|
5081
5191
|
}
|
|
@@ -5298,8 +5408,8 @@ async function formatDataWithBiome(data, filePath, options) {
|
|
|
5298
5408
|
});
|
|
5299
5409
|
return formatted.content;
|
|
5300
5410
|
} catch (error) {
|
|
5301
|
-
const errorMessage = error instanceof Error ? error.message || _optionalChain([error, 'access',
|
|
5302
|
-
if (_optionalChain([errorMessage, 'optionalAccess',
|
|
5411
|
+
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]]) : "";
|
|
5412
|
+
if (_optionalChain([errorMessage, 'optionalAccess', _214 => _214.includes, 'call', _215 => _215("does not exist in the workspace")])) {
|
|
5303
5413
|
} else {
|
|
5304
5414
|
console.log(`\u26A0\uFE0F Biome skipped ${path14.default.basename(filePath)}`);
|
|
5305
5415
|
if (errorMessage) {
|
|
@@ -5346,7 +5456,7 @@ function createPoDataLoader(params) {
|
|
|
5346
5456
|
Object.entries(entries).forEach(([msgid, entry]) => {
|
|
5347
5457
|
if (msgid && entry.msgid) {
|
|
5348
5458
|
const context = entry.msgctxt || "";
|
|
5349
|
-
const fullEntry = _optionalChain([parsedPo, 'access',
|
|
5459
|
+
const fullEntry = _optionalChain([parsedPo, 'access', _216 => _216.translations, 'access', _217 => _217[context], 'optionalAccess', _218 => _218[msgid]]);
|
|
5350
5460
|
if (fullEntry) {
|
|
5351
5461
|
result[msgid] = fullEntry;
|
|
5352
5462
|
}
|
|
@@ -5356,8 +5466,8 @@ function createPoDataLoader(params) {
|
|
|
5356
5466
|
return result;
|
|
5357
5467
|
},
|
|
5358
5468
|
async push(locale, data, originalInput, originalLocale, pullInput) {
|
|
5359
|
-
const currentSections = _optionalChain([pullInput, 'optionalAccess',
|
|
5360
|
-
const originalSections = _optionalChain([originalInput, 'optionalAccess',
|
|
5469
|
+
const currentSections = _optionalChain([pullInput, 'optionalAccess', _219 => _219.split, 'call', _220 => _220("\n\n"), 'access', _221 => _221.filter, 'call', _222 => _222(Boolean)]) || [];
|
|
5470
|
+
const originalSections = _optionalChain([originalInput, 'optionalAccess', _223 => _223.split, 'call', _224 => _224("\n\n"), 'access', _225 => _225.filter, 'call', _226 => _226(Boolean)]) || [];
|
|
5361
5471
|
const result = originalSections.map((section) => {
|
|
5362
5472
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
5363
5473
|
if (Object.keys(sectionPo.translations).length === 0) {
|
|
@@ -5426,8 +5536,8 @@ function createPoContentLoader() {
|
|
|
5426
5536
|
{
|
|
5427
5537
|
...entry,
|
|
5428
5538
|
msgstr: [
|
|
5429
|
-
_optionalChain([data, 'access',
|
|
5430
|
-
_optionalChain([data, 'access',
|
|
5539
|
+
_optionalChain([data, 'access', _227 => _227[entry.msgid], 'optionalAccess', _228 => _228.singular]),
|
|
5540
|
+
_optionalChain([data, 'access', _229 => _229[entry.msgid], 'optionalAccess', _230 => _230.plural]) || null
|
|
5431
5541
|
].filter(Boolean)
|
|
5432
5542
|
}
|
|
5433
5543
|
]).fromPairs().value();
|
|
@@ -5549,7 +5659,7 @@ function pullV1(xliffElement, locale, originalLocale) {
|
|
|
5549
5659
|
let key = getTransUnitKey(unit);
|
|
5550
5660
|
if (!key) return;
|
|
5551
5661
|
if (seenKeys.has(key)) {
|
|
5552
|
-
const id = _optionalChain([unit, 'access',
|
|
5662
|
+
const id = _optionalChain([unit, 'access', _231 => _231.getAttribute, 'call', _232 => _232("id"), 'optionalAccess', _233 => _233.trim, 'call', _234 => _234()]);
|
|
5553
5663
|
if (id) {
|
|
5554
5664
|
key = `${key}#${id}`;
|
|
5555
5665
|
} else {
|
|
@@ -5597,7 +5707,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
5597
5707
|
let key = getTransUnitKey(unit);
|
|
5598
5708
|
if (!key) return;
|
|
5599
5709
|
if (seenKeys.has(key)) {
|
|
5600
|
-
const id = _optionalChain([unit, 'access',
|
|
5710
|
+
const id = _optionalChain([unit, 'access', _235 => _235.getAttribute, 'call', _236 => _236("id"), 'optionalAccess', _237 => _237.trim, 'call', _238 => _238()]);
|
|
5601
5711
|
if (id) {
|
|
5602
5712
|
key = `${key}#${id}`;
|
|
5603
5713
|
} else {
|
|
@@ -5639,7 +5749,7 @@ function pushV1(dom, xliffElement, locale, translations, originalLocale, origina
|
|
|
5639
5749
|
const translationKeys = new Set(Object.keys(translations));
|
|
5640
5750
|
existingUnits.forEach((unit, key) => {
|
|
5641
5751
|
if (!translationKeys.has(key)) {
|
|
5642
|
-
_optionalChain([unit, 'access',
|
|
5752
|
+
_optionalChain([unit, 'access', _239 => _239.parentNode, 'optionalAccess', _240 => _240.removeChild, 'call', _241 => _241(unit)]);
|
|
5643
5753
|
}
|
|
5644
5754
|
});
|
|
5645
5755
|
return serializeWithDeclaration(
|
|
@@ -5682,18 +5792,18 @@ function traverseUnitsV2(container, fileId, currentPath, result) {
|
|
|
5682
5792
|
Array.from(container.children).forEach((child) => {
|
|
5683
5793
|
const tagName = child.tagName;
|
|
5684
5794
|
if (tagName === "unit") {
|
|
5685
|
-
const unitId = _optionalChain([child, 'access',
|
|
5795
|
+
const unitId = _optionalChain([child, 'access', _242 => _242.getAttribute, 'call', _243 => _243("id"), 'optionalAccess', _244 => _244.trim, 'call', _245 => _245()]);
|
|
5686
5796
|
if (!unitId) return;
|
|
5687
5797
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
5688
5798
|
const segment = child.querySelector("segment");
|
|
5689
|
-
const source = _optionalChain([segment, 'optionalAccess',
|
|
5799
|
+
const source = _optionalChain([segment, 'optionalAccess', _246 => _246.querySelector, 'call', _247 => _247("source")]);
|
|
5690
5800
|
if (source) {
|
|
5691
5801
|
result[key] = extractTextContent(source);
|
|
5692
5802
|
} else {
|
|
5693
5803
|
result[key] = unitId;
|
|
5694
5804
|
}
|
|
5695
5805
|
} else if (tagName === "group") {
|
|
5696
|
-
const groupId = _optionalChain([child, 'access',
|
|
5806
|
+
const groupId = _optionalChain([child, 'access', _248 => _248.getAttribute, 'call', _249 => _249("id"), 'optionalAccess', _250 => _250.trim, 'call', _251 => _251()]);
|
|
5697
5807
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
5698
5808
|
traverseUnitsV2(child, fileId, newPath, result);
|
|
5699
5809
|
}
|
|
@@ -5729,12 +5839,12 @@ function indexUnitsV2(container, fileId, currentPath, index) {
|
|
|
5729
5839
|
Array.from(container.children).forEach((child) => {
|
|
5730
5840
|
const tagName = child.tagName;
|
|
5731
5841
|
if (tagName === "unit") {
|
|
5732
|
-
const unitId = _optionalChain([child, 'access',
|
|
5842
|
+
const unitId = _optionalChain([child, 'access', _252 => _252.getAttribute, 'call', _253 => _253("id"), 'optionalAccess', _254 => _254.trim, 'call', _255 => _255()]);
|
|
5733
5843
|
if (!unitId) return;
|
|
5734
5844
|
const key = `resources/${fileId}/${currentPath}${unitId}/source`;
|
|
5735
5845
|
index.set(key, child);
|
|
5736
5846
|
} else if (tagName === "group") {
|
|
5737
|
-
const groupId = _optionalChain([child, 'access',
|
|
5847
|
+
const groupId = _optionalChain([child, 'access', _256 => _256.getAttribute, 'call', _257 => _257("id"), 'optionalAccess', _258 => _258.trim, 'call', _259 => _259()]);
|
|
5738
5848
|
const newPath = groupId ? `${currentPath}${groupId}/groupUnits/` : currentPath;
|
|
5739
5849
|
indexUnitsV2(child, fileId, newPath, index);
|
|
5740
5850
|
}
|
|
@@ -5755,9 +5865,9 @@ function updateUnitV2(unit, value) {
|
|
|
5755
5865
|
setTextContent(source, value);
|
|
5756
5866
|
}
|
|
5757
5867
|
function getTransUnitKey(transUnit) {
|
|
5758
|
-
const resname = _optionalChain([transUnit, 'access',
|
|
5868
|
+
const resname = _optionalChain([transUnit, 'access', _260 => _260.getAttribute, 'call', _261 => _261("resname"), 'optionalAccess', _262 => _262.trim, 'call', _263 => _263()]);
|
|
5759
5869
|
if (resname) return resname;
|
|
5760
|
-
const id = _optionalChain([transUnit, 'access',
|
|
5870
|
+
const id = _optionalChain([transUnit, 'access', _264 => _264.getAttribute, 'call', _265 => _265("id"), 'optionalAccess', _266 => _266.trim, 'call', _267 => _267()]);
|
|
5761
5871
|
if (id) return id;
|
|
5762
5872
|
const sourceElement = transUnit.querySelector("source");
|
|
5763
5873
|
if (sourceElement) {
|
|
@@ -5814,7 +5924,7 @@ function formatXml(xml) {
|
|
|
5814
5924
|
if (cdataNode) {
|
|
5815
5925
|
return `${indent2}${openTag}<![CDATA[${cdataNode.nodeValue}]]></${tagName}>`;
|
|
5816
5926
|
}
|
|
5817
|
-
const textContent3 = _optionalChain([element, 'access',
|
|
5927
|
+
const textContent3 = _optionalChain([element, 'access', _268 => _268.textContent, 'optionalAccess', _269 => _269.trim, 'call', _270 => _270()]) || "";
|
|
5818
5928
|
const hasOnlyText = element.childNodes.length === 1 && element.childNodes[0].nodeType === 3;
|
|
5819
5929
|
if (hasOnlyText && textContent3) {
|
|
5820
5930
|
return `${indent2}${openTag}${textContent3}</${tagName}>`;
|
|
@@ -6107,7 +6217,7 @@ function createDatoClient(params) {
|
|
|
6107
6217
|
ids: !records.length ? void 0 : records.join(",")
|
|
6108
6218
|
}
|
|
6109
6219
|
}).catch(
|
|
6110
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
6220
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _271 => _271.response, 'optionalAccess', _272 => _272.body, 'optionalAccess', _273 => _273.data, 'optionalAccess', _274 => _274[0]]) || error)
|
|
6111
6221
|
);
|
|
6112
6222
|
},
|
|
6113
6223
|
findRecordsForModel: async (modelId, records) => {
|
|
@@ -6118,10 +6228,10 @@ function createDatoClient(params) {
|
|
|
6118
6228
|
filter: {
|
|
6119
6229
|
type: modelId,
|
|
6120
6230
|
only_valid: "true",
|
|
6121
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
6231
|
+
ids: !_optionalChain([records, 'optionalAccess', _275 => _275.length]) ? void 0 : records.join(",")
|
|
6122
6232
|
}
|
|
6123
6233
|
}).catch(
|
|
6124
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
6234
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _276 => _276.response, 'optionalAccess', _277 => _277.body, 'optionalAccess', _278 => _278.data, 'optionalAccess', _279 => _279[0]]) || error)
|
|
6125
6235
|
);
|
|
6126
6236
|
return result;
|
|
6127
6237
|
} catch (_error) {
|
|
@@ -6137,10 +6247,10 @@ function createDatoClient(params) {
|
|
|
6137
6247
|
updateRecord: async (id, payload) => {
|
|
6138
6248
|
try {
|
|
6139
6249
|
await dato.items.update(id, payload).catch(
|
|
6140
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
6250
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _280 => _280.response, 'optionalAccess', _281 => _281.body, 'optionalAccess', _282 => _282.data, 'optionalAccess', _283 => _283[0]]) || error)
|
|
6141
6251
|
);
|
|
6142
6252
|
} catch (_error) {
|
|
6143
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
6253
|
+
if (_optionalChain([_error, 'optionalAccess', _284 => _284.attributes, 'optionalAccess', _285 => _285.details, 'optionalAccess', _286 => _286.message])) {
|
|
6144
6254
|
throw new Error(
|
|
6145
6255
|
[
|
|
6146
6256
|
`${_error.attributes.details.message}`,
|
|
@@ -6162,10 +6272,10 @@ function createDatoClient(params) {
|
|
|
6162
6272
|
enableFieldLocalization: async (args) => {
|
|
6163
6273
|
try {
|
|
6164
6274
|
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch(
|
|
6165
|
-
(error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
6275
|
+
(error) => Promise.reject(_optionalChain([error, 'optionalAccess', _287 => _287.response, 'optionalAccess', _288 => _288.body, 'optionalAccess', _289 => _289.data, 'optionalAccess', _290 => _290[0]]) || error)
|
|
6166
6276
|
);
|
|
6167
6277
|
} catch (_error) {
|
|
6168
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
6278
|
+
if (_optionalChain([_error, 'optionalAccess', _291 => _291.attributes, 'optionalAccess', _292 => _292.code]) === "NOT_FOUND") {
|
|
6169
6279
|
throw new Error(
|
|
6170
6280
|
[
|
|
6171
6281
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -6173,7 +6283,7 @@ function createDatoClient(params) {
|
|
|
6173
6283
|
].join("\n\n")
|
|
6174
6284
|
);
|
|
6175
6285
|
}
|
|
6176
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
6286
|
+
if (_optionalChain([_error, 'optionalAccess', _293 => _293.attributes, 'optionalAccess', _294 => _294.details, 'optionalAccess', _295 => _295.message])) {
|
|
6177
6287
|
throw new Error(
|
|
6178
6288
|
[
|
|
6179
6289
|
`${_error.attributes.details.message}`,
|
|
@@ -6251,7 +6361,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
6251
6361
|
const records = await dato.findRecordsForModel(modelId);
|
|
6252
6362
|
const recordChoices = createRecordChoices(
|
|
6253
6363
|
records,
|
|
6254
|
-
_optionalChain([config, 'access',
|
|
6364
|
+
_optionalChain([config, 'access', _296 => _296.models, 'access', _297 => _297[modelId], 'optionalAccess', _298 => _298.records]) || [],
|
|
6255
6365
|
project
|
|
6256
6366
|
);
|
|
6257
6367
|
const selectedRecords = await promptRecordSelection(
|
|
@@ -6270,14 +6380,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
6270
6380
|
},
|
|
6271
6381
|
async pull(locale, input2, initCtx) {
|
|
6272
6382
|
const result = {};
|
|
6273
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
6274
|
-
let records = _optionalChain([initCtx, 'optionalAccess',
|
|
6383
|
+
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _299 => _299.models]) || {})) {
|
|
6384
|
+
let records = _optionalChain([initCtx, 'optionalAccess', _300 => _300.models, 'access', _301 => _301[modelId], 'access', _302 => _302.records]) || [];
|
|
6275
6385
|
const recordIds = records.map((record) => record.id);
|
|
6276
6386
|
records = await dato.findRecords(recordIds);
|
|
6277
6387
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
6278
6388
|
if (records.length > 0) {
|
|
6279
6389
|
result[modelId] = {
|
|
6280
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
6390
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _303 => _303.models, 'optionalAccess', _304 => _304[modelId], 'optionalAccess', _305 => _305.fields]) || [],
|
|
6281
6391
|
records
|
|
6282
6392
|
};
|
|
6283
6393
|
}
|
|
@@ -6340,7 +6450,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
6340
6450
|
return records.map((record) => ({
|
|
6341
6451
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
6342
6452
|
value: record.id,
|
|
6343
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
6453
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _306 => _306.includes, 'call', _307 => _307(record.id)])
|
|
6344
6454
|
}));
|
|
6345
6455
|
}
|
|
6346
6456
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -6659,7 +6769,7 @@ function createVttLoader() {
|
|
|
6659
6769
|
if (!input2) {
|
|
6660
6770
|
return "";
|
|
6661
6771
|
}
|
|
6662
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
6772
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _308 => _308.parse, 'call', _309 => _309(input2), 'optionalAccess', _310 => _310.cues]);
|
|
6663
6773
|
if (Object.keys(vtt).length === 0) {
|
|
6664
6774
|
return {};
|
|
6665
6775
|
} else {
|
|
@@ -6713,7 +6823,7 @@ function variableExtractLoader(params) {
|
|
|
6713
6823
|
for (let i = 0; i < matches.length; i++) {
|
|
6714
6824
|
const match2 = matches[i];
|
|
6715
6825
|
const currentValue = result[key].value;
|
|
6716
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
6826
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _311 => _311.replace, 'call', _312 => _312(match2, `{variable:${i}}`)]);
|
|
6717
6827
|
result[key].value = newValue;
|
|
6718
6828
|
result[key].variables[i] = match2;
|
|
6719
6829
|
}
|
|
@@ -6728,7 +6838,7 @@ function variableExtractLoader(params) {
|
|
|
6728
6838
|
const variable = valueObj.variables[i];
|
|
6729
6839
|
const currentValue = result[key];
|
|
6730
6840
|
if (typeof currentValue === "string") {
|
|
6731
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
6841
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _313 => _313.replaceAll, 'call', _314 => _314(
|
|
6732
6842
|
`{variable:${i}}`,
|
|
6733
6843
|
variable
|
|
6734
6844
|
)]);
|
|
@@ -6932,7 +7042,7 @@ function createVueJsonLoader() {
|
|
|
6932
7042
|
return createLoader({
|
|
6933
7043
|
pull: async (locale, input2, ctx) => {
|
|
6934
7044
|
const parsed = parseVueFile(input2);
|
|
6935
|
-
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess',
|
|
7045
|
+
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _315 => _315.i18n, 'optionalAccess', _316 => _316[locale]]), () => ( {}));
|
|
6936
7046
|
},
|
|
6937
7047
|
push: async (locale, data, originalInput) => {
|
|
6938
7048
|
const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
|
|
@@ -7117,7 +7227,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
|
|
|
7117
7227
|
objectExpression.properties.forEach((prop) => {
|
|
7118
7228
|
if (!t.isObjectProperty(prop)) return;
|
|
7119
7229
|
const key = getPropertyKey(prop);
|
|
7120
|
-
const incomingVal = _optionalChain([data, 'optionalAccess',
|
|
7230
|
+
const incomingVal = _optionalChain([data, 'optionalAccess', _317 => _317[key]]);
|
|
7121
7231
|
if (incomingVal === void 0) {
|
|
7122
7232
|
return;
|
|
7123
7233
|
}
|
|
@@ -7153,7 +7263,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
|
|
|
7153
7263
|
let modified = false;
|
|
7154
7264
|
arrayExpression.elements.forEach((element, index) => {
|
|
7155
7265
|
if (!element) return;
|
|
7156
|
-
const incomingVal = _optionalChain([incoming, 'optionalAccess',
|
|
7266
|
+
const incomingVal = _optionalChain([incoming, 'optionalAccess', _318 => _318[index]]);
|
|
7157
7267
|
if (incomingVal === void 0) return;
|
|
7158
7268
|
if (t.isStringLiteral(element) && typeof incomingVal === "string") {
|
|
7159
7269
|
if (element.value !== incomingVal) {
|
|
@@ -7647,7 +7757,7 @@ var AST = class _AST {
|
|
|
7647
7757
|
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
7758
|
if (this.isStart() && !this.type)
|
|
7649
7759
|
ret.unshift([]);
|
|
7650
|
-
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
7760
|
+
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _319 => _319.#parent, 'optionalAccess', _320 => _320.type]) === "!")) {
|
|
7651
7761
|
ret.push({});
|
|
7652
7762
|
}
|
|
7653
7763
|
return ret;
|
|
@@ -7655,7 +7765,7 @@ var AST = class _AST {
|
|
|
7655
7765
|
isStart() {
|
|
7656
7766
|
if (this.#root === this)
|
|
7657
7767
|
return true;
|
|
7658
|
-
if (!_optionalChain([this, 'access',
|
|
7768
|
+
if (!_optionalChain([this, 'access', _321 => _321.#parent, 'optionalAccess', _322 => _322.isStart, 'call', _323 => _323()]))
|
|
7659
7769
|
return false;
|
|
7660
7770
|
if (this.#parentIndex === 0)
|
|
7661
7771
|
return true;
|
|
@@ -7671,12 +7781,12 @@ var AST = class _AST {
|
|
|
7671
7781
|
isEnd() {
|
|
7672
7782
|
if (this.#root === this)
|
|
7673
7783
|
return true;
|
|
7674
|
-
if (_optionalChain([this, 'access',
|
|
7784
|
+
if (_optionalChain([this, 'access', _324 => _324.#parent, 'optionalAccess', _325 => _325.type]) === "!")
|
|
7675
7785
|
return true;
|
|
7676
|
-
if (!_optionalChain([this, 'access',
|
|
7786
|
+
if (!_optionalChain([this, 'access', _326 => _326.#parent, 'optionalAccess', _327 => _327.isEnd, 'call', _328 => _328()]))
|
|
7677
7787
|
return false;
|
|
7678
7788
|
if (!this.type)
|
|
7679
|
-
return _optionalChain([this, 'access',
|
|
7789
|
+
return _optionalChain([this, 'access', _329 => _329.#parent, 'optionalAccess', _330 => _330.isEnd, 'call', _331 => _331()]);
|
|
7680
7790
|
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
|
7681
7791
|
return this.#parentIndex === pl - 1;
|
|
7682
7792
|
}
|
|
@@ -7921,7 +8031,7 @@ var AST = class _AST {
|
|
|
7921
8031
|
}
|
|
7922
8032
|
}
|
|
7923
8033
|
let end = "";
|
|
7924
|
-
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
8034
|
+
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _332 => _332.#parent, 'optionalAccess', _333 => _333.type]) === "!") {
|
|
7925
8035
|
end = "(?:$|\\/)";
|
|
7926
8036
|
}
|
|
7927
8037
|
const final2 = start2 + src + end;
|
|
@@ -9022,7 +9132,7 @@ function createMdxSectionsSplit2Loader() {
|
|
|
9022
9132
|
const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
|
|
9023
9133
|
const result = {
|
|
9024
9134
|
frontmatter: data.frontmatter,
|
|
9025
|
-
codePlaceholders: _optionalChain([pullInput, 'optionalAccess',
|
|
9135
|
+
codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _334 => _334.codePlaceholders]) || {},
|
|
9026
9136
|
content
|
|
9027
9137
|
};
|
|
9028
9138
|
return result;
|
|
@@ -9417,7 +9527,7 @@ function createTwigLoader() {
|
|
|
9417
9527
|
const attrs = LOCALIZABLE_ATTRIBUTES2[tagName];
|
|
9418
9528
|
if (!attrs) return;
|
|
9419
9529
|
for (const attr of attrs) {
|
|
9420
|
-
const value = _optionalChain([element, 'access',
|
|
9530
|
+
const value = _optionalChain([element, 'access', _335 => _335.attribs, 'optionalAccess', _336 => _336[attr]]);
|
|
9421
9531
|
if (value && value.trim()) {
|
|
9422
9532
|
const restoredValue = postprocessTwig(value.trim(), twigBlocks);
|
|
9423
9533
|
result[`${path19}#${attr}`] = restoredValue;
|
|
@@ -9750,6 +9860,18 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
9750
9860
|
switch (bucketType) {
|
|
9751
9861
|
default:
|
|
9752
9862
|
throw new Error(`Unsupported bucket type: ${bucketType}`);
|
|
9863
|
+
case "ail":
|
|
9864
|
+
return composeLoaders(
|
|
9865
|
+
createTextFileLoader(bucketPathPattern),
|
|
9866
|
+
createLockedPatternsLoader(lockedPatterns),
|
|
9867
|
+
createAilLoader(),
|
|
9868
|
+
createEnsureKeyOrderLoader(),
|
|
9869
|
+
createFlatLoader(),
|
|
9870
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
9871
|
+
createIgnoredKeysLoader(ignoredKeys || []),
|
|
9872
|
+
createSyncLoader(),
|
|
9873
|
+
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
9874
|
+
);
|
|
9753
9875
|
case "android":
|
|
9754
9876
|
return composeLoaders(
|
|
9755
9877
|
createTextFileLoader(bucketPathPattern),
|
|
@@ -10505,7 +10627,7 @@ function createBasicTranslator(model, systemPrompt, settings = {}) {
|
|
|
10505
10627
|
]
|
|
10506
10628
|
});
|
|
10507
10629
|
const result = JSON.parse(response.text);
|
|
10508
|
-
return _optionalChain([result, 'optionalAccess',
|
|
10630
|
+
return _optionalChain([result, 'optionalAccess', _337 => _337.data]) || {};
|
|
10509
10631
|
}
|
|
10510
10632
|
}
|
|
10511
10633
|
function extractPayloadChunks(payload) {
|
|
@@ -10588,7 +10710,7 @@ function getPureModelProvider(provider) {
|
|
|
10588
10710
|
|
|
10589
10711
|
${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
|
|
10590
10712
|
`;
|
|
10591
|
-
switch (_optionalChain([provider, 'optionalAccess',
|
|
10713
|
+
switch (_optionalChain([provider, 'optionalAccess', _338 => _338.id])) {
|
|
10592
10714
|
case "openai": {
|
|
10593
10715
|
if (!process.env.OPENAI_API_KEY) {
|
|
10594
10716
|
throw new Error(
|
|
@@ -10646,7 +10768,7 @@ function getPureModelProvider(provider) {
|
|
|
10646
10768
|
})(provider.model);
|
|
10647
10769
|
}
|
|
10648
10770
|
default: {
|
|
10649
|
-
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess',
|
|
10771
|
+
throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _339 => _339.id])));
|
|
10650
10772
|
}
|
|
10651
10773
|
}
|
|
10652
10774
|
}
|
|
@@ -10932,7 +11054,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
10932
11054
|
validateParams(i18nConfig, flags);
|
|
10933
11055
|
ora.succeed("Localization configuration is valid");
|
|
10934
11056
|
ora.start("Connecting to Lingo.dev Localization Engine...");
|
|
10935
|
-
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess',
|
|
11057
|
+
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _340 => _340.provider]);
|
|
10936
11058
|
if (isByokMode) {
|
|
10937
11059
|
authId = null;
|
|
10938
11060
|
ora.succeed("Using external provider (BYOK mode)");
|
|
@@ -10946,16 +11068,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
10946
11068
|
flags
|
|
10947
11069
|
});
|
|
10948
11070
|
let buckets = getBuckets(i18nConfig);
|
|
10949
|
-
if (_optionalChain([flags, 'access',
|
|
11071
|
+
if (_optionalChain([flags, 'access', _341 => _341.bucket, 'optionalAccess', _342 => _342.length])) {
|
|
10950
11072
|
buckets = buckets.filter(
|
|
10951
11073
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
10952
11074
|
);
|
|
10953
11075
|
}
|
|
10954
11076
|
ora.succeed("Buckets retrieved");
|
|
10955
|
-
if (_optionalChain([flags, 'access',
|
|
11077
|
+
if (_optionalChain([flags, 'access', _343 => _343.file, 'optionalAccess', _344 => _344.length])) {
|
|
10956
11078
|
buckets = buckets.map((bucket) => {
|
|
10957
11079
|
const paths = bucket.paths.filter(
|
|
10958
|
-
(path19) => flags.file.find((file) => _optionalChain([path19, 'access',
|
|
11080
|
+
(path19) => flags.file.find((file) => _optionalChain([path19, 'access', _345 => _345.pathPattern, 'optionalAccess', _346 => _346.includes, 'call', _347 => _347(file)]))
|
|
10959
11081
|
);
|
|
10960
11082
|
return { ...bucket, paths };
|
|
10961
11083
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -10976,7 +11098,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
10976
11098
|
});
|
|
10977
11099
|
}
|
|
10978
11100
|
}
|
|
10979
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
11101
|
+
const targetLocales = _optionalChain([flags, 'access', _348 => _348.locale, 'optionalAccess', _349 => _349.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
10980
11102
|
ora.start("Setting up localization cache...");
|
|
10981
11103
|
const checkLockfileProcessor = createDeltaProcessor("");
|
|
10982
11104
|
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
@@ -11261,7 +11383,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
11261
11383
|
}
|
|
11262
11384
|
const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
|
|
11263
11385
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
11264
|
-
if (!_optionalChain([flags, 'access',
|
|
11386
|
+
if (!_optionalChain([flags, 'access', _350 => _350.locale, 'optionalAccess', _351 => _351.length])) {
|
|
11265
11387
|
await deltaProcessor.saveChecksums(checksums);
|
|
11266
11388
|
}
|
|
11267
11389
|
}
|
|
@@ -11385,12 +11507,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
11385
11507
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
11386
11508
|
docUrl: "bucketNotFound"
|
|
11387
11509
|
});
|
|
11388
|
-
} else if (_optionalChain([flags, 'access',
|
|
11510
|
+
} else if (_optionalChain([flags, 'access', _352 => _352.locale, 'optionalAccess', _353 => _353.some, 'call', _354 => _354((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
11389
11511
|
throw new ValidationError({
|
|
11390
11512
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
11391
11513
|
docUrl: "localeTargetNotFound"
|
|
11392
11514
|
});
|
|
11393
|
-
} else if (_optionalChain([flags, 'access',
|
|
11515
|
+
} else if (_optionalChain([flags, 'access', _355 => _355.bucket, 'optionalAccess', _356 => _356.some, 'call', _357 => _357(
|
|
11394
11516
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
11395
11517
|
)])) {
|
|
11396
11518
|
throw new ValidationError({
|
|
@@ -11924,7 +12046,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
|
|
|
11924
12046
|
const response = await engine.whoami();
|
|
11925
12047
|
return {
|
|
11926
12048
|
authenticated: !!response,
|
|
11927
|
-
username: _optionalChain([response, 'optionalAccess',
|
|
12049
|
+
username: _optionalChain([response, 'optionalAccess', _358 => _358.email])
|
|
11928
12050
|
};
|
|
11929
12051
|
} catch (error) {
|
|
11930
12052
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -12040,7 +12162,7 @@ function createExplicitLocalizer(provider) {
|
|
|
12040
12162
|
}
|
|
12041
12163
|
function createAiSdkLocalizer(params) {
|
|
12042
12164
|
const skipAuth = params.skipAuth === true;
|
|
12043
|
-
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
12165
|
+
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _359 => _359.apiKeyName]), () => ( ""))];
|
|
12044
12166
|
if (!skipAuth && !apiKey || !params.apiKeyName) {
|
|
12045
12167
|
throw new Error(
|
|
12046
12168
|
_dedent2.default`
|
|
@@ -12174,8 +12296,8 @@ async function setup(input2) {
|
|
|
12174
12296
|
throw new Error(
|
|
12175
12297
|
"No buckets found in i18n.json. Please add at least one bucket containing i18n content."
|
|
12176
12298
|
);
|
|
12177
|
-
} else if (_optionalChain([ctx, 'access',
|
|
12178
|
-
(bucket) => !_optionalChain([ctx, 'access',
|
|
12299
|
+
} else if (_optionalChain([ctx, 'access', _360 => _360.flags, 'access', _361 => _361.bucket, 'optionalAccess', _362 => _362.some, 'call', _363 => _363(
|
|
12300
|
+
(bucket) => !_optionalChain([ctx, 'access', _364 => _364.config, 'optionalAccess', _365 => _365.buckets, 'access', _366 => _366[bucket]])
|
|
12179
12301
|
)])) {
|
|
12180
12302
|
throw new Error(
|
|
12181
12303
|
`One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
|
|
@@ -12188,7 +12310,7 @@ async function setup(input2) {
|
|
|
12188
12310
|
title: "Selecting localization provider",
|
|
12189
12311
|
task: async (ctx, task) => {
|
|
12190
12312
|
ctx.localizer = createLocalizer(
|
|
12191
|
-
_optionalChain([ctx, 'access',
|
|
12313
|
+
_optionalChain([ctx, 'access', _367 => _367.config, 'optionalAccess', _368 => _368.provider]),
|
|
12192
12314
|
ctx.flags.apiKey
|
|
12193
12315
|
);
|
|
12194
12316
|
if (!ctx.localizer) {
|
|
@@ -12201,7 +12323,7 @@ async function setup(input2) {
|
|
|
12201
12323
|
},
|
|
12202
12324
|
{
|
|
12203
12325
|
title: "Checking authentication",
|
|
12204
|
-
enabled: (ctx) => _optionalChain([ctx, 'access',
|
|
12326
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _369 => _369.localizer, 'optionalAccess', _370 => _370.id]) === "Lingo.dev",
|
|
12205
12327
|
task: async (ctx, task) => {
|
|
12206
12328
|
const authStatus = await ctx.localizer.checkAuth();
|
|
12207
12329
|
if (!authStatus.authenticated) {
|
|
@@ -12214,7 +12336,7 @@ async function setup(input2) {
|
|
|
12214
12336
|
},
|
|
12215
12337
|
{
|
|
12216
12338
|
title: "Validating configuration",
|
|
12217
|
-
enabled: (ctx) => _optionalChain([ctx, 'access',
|
|
12339
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _371 => _371.localizer, 'optionalAccess', _372 => _372.id]) !== "Lingo.dev",
|
|
12218
12340
|
task: async (ctx, task) => {
|
|
12219
12341
|
const validationStatus = await ctx.localizer.validateSettings();
|
|
12220
12342
|
if (!validationStatus.valid) {
|
|
@@ -12545,7 +12667,7 @@ function createWorkerTask(args) {
|
|
|
12545
12667
|
const processableData = _lodash2.default.chain(sourceData).entries().filter(
|
|
12546
12668
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
|
|
12547
12669
|
).filter(
|
|
12548
|
-
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access',
|
|
12670
|
+
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _373 => _373.onlyKeys, 'optionalAccess', _374 => _374.some, 'call', _375 => _375(
|
|
12549
12671
|
(pattern) => minimatch(key, pattern)
|
|
12550
12672
|
)])
|
|
12551
12673
|
).fromPairs().value();
|
|
@@ -12613,7 +12735,7 @@ function createWorkerTask(args) {
|
|
|
12613
12735
|
finalRenamedTargetData
|
|
12614
12736
|
);
|
|
12615
12737
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
12616
|
-
if (!_optionalChain([args, 'access',
|
|
12738
|
+
if (!_optionalChain([args, 'access', _376 => _376.ctx, 'access', _377 => _377.flags, 'access', _378 => _378.targetLocale, 'optionalAccess', _379 => _379.length])) {
|
|
12617
12739
|
await deltaProcessor.saveChecksums(checksums);
|
|
12618
12740
|
}
|
|
12619
12741
|
});
|
|
@@ -12818,10 +12940,10 @@ var flagsSchema2 = _zod.z.object({
|
|
|
12818
12940
|
async function frozen(input2) {
|
|
12819
12941
|
console.log(_chalk2.default.hex(colors.orange)("[Frozen]"));
|
|
12820
12942
|
let buckets = getBuckets(input2.config);
|
|
12821
|
-
if (_optionalChain([input2, 'access',
|
|
12943
|
+
if (_optionalChain([input2, 'access', _380 => _380.flags, 'access', _381 => _381.bucket, 'optionalAccess', _382 => _382.length])) {
|
|
12822
12944
|
buckets = buckets.filter((b) => input2.flags.bucket.includes(b.type));
|
|
12823
12945
|
}
|
|
12824
|
-
if (_optionalChain([input2, 'access',
|
|
12946
|
+
if (_optionalChain([input2, 'access', _383 => _383.flags, 'access', _384 => _384.file, 'optionalAccess', _385 => _385.length])) {
|
|
12825
12947
|
buckets = buckets.map((bucket) => {
|
|
12826
12948
|
const paths = bucket.paths.filter(
|
|
12827
12949
|
(p) => input2.flags.file.some(
|
|
@@ -12958,13 +13080,13 @@ async function frozen(input2) {
|
|
|
12958
13080
|
|
|
12959
13081
|
// src/cli/cmd/run/_utils.ts
|
|
12960
13082
|
async function determineAuthId(ctx) {
|
|
12961
|
-
const isByokMode = !!_optionalChain([ctx, 'access',
|
|
13083
|
+
const isByokMode = !!_optionalChain([ctx, 'access', _386 => _386.config, 'optionalAccess', _387 => _387.provider]);
|
|
12962
13084
|
if (isByokMode) {
|
|
12963
13085
|
return null;
|
|
12964
13086
|
} else {
|
|
12965
13087
|
try {
|
|
12966
|
-
const authStatus = await _optionalChain([ctx, 'access',
|
|
12967
|
-
return _optionalChain([authStatus, 'optionalAccess',
|
|
13088
|
+
const authStatus = await _optionalChain([ctx, 'access', _388 => _388.localizer, 'optionalAccess', _389 => _389.checkAuth, 'call', _390 => _390()]);
|
|
13089
|
+
return _optionalChain([authStatus, 'optionalAccess', _391 => _391.username]) || null;
|
|
12968
13090
|
} catch (e3) {
|
|
12969
13091
|
return null;
|
|
12970
13092
|
}
|
|
@@ -13162,7 +13284,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
13162
13284
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
13163
13285
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
13164
13286
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
13165
|
-
_optionalChain([this, 'access',
|
|
13287
|
+
_optionalChain([this, 'access', _392 => _392.platformKit, 'optionalAccess', _393 => _393.gitConfig, 'call', _394 => _394()]);
|
|
13166
13288
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
13167
13289
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
13168
13290
|
if (!processOwnCommits) {
|
|
@@ -13194,7 +13316,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
13194
13316
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
13195
13317
|
var PullRequestFlow = class extends InBranchFlow {
|
|
13196
13318
|
async preRun() {
|
|
13197
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
13319
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _395 => _395()]);
|
|
13198
13320
|
if (!canContinue) {
|
|
13199
13321
|
return false;
|
|
13200
13322
|
}
|
|
@@ -13461,10 +13583,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
13461
13583
|
repo_slug: this.platformConfig.repositoryName,
|
|
13462
13584
|
state: "OPEN"
|
|
13463
13585
|
}).then(({ data: { values } }) => {
|
|
13464
|
-
return _optionalChain([values, 'optionalAccess',
|
|
13465
|
-
({ source, destination }) => _optionalChain([source, 'optionalAccess',
|
|
13586
|
+
return _optionalChain([values, 'optionalAccess', _396 => _396.find, 'call', _397 => _397(
|
|
13587
|
+
({ 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
13588
|
)]);
|
|
13467
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
13589
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _402 => _402.id]));
|
|
13468
13590
|
}
|
|
13469
13591
|
async closePullRequest({ pullRequestNumber }) {
|
|
13470
13592
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -13560,7 +13682,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
13560
13682
|
repo: this.platformConfig.repositoryName,
|
|
13561
13683
|
base: this.platformConfig.baseBranchName,
|
|
13562
13684
|
state: "open"
|
|
13563
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
13685
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _403 => _403.number]));
|
|
13564
13686
|
}
|
|
13565
13687
|
async closePullRequest({ pullRequestNumber }) {
|
|
13566
13688
|
await this.octokit.rest.pulls.update({
|
|
@@ -13687,7 +13809,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
13687
13809
|
sourceBranch: branch,
|
|
13688
13810
|
state: "opened"
|
|
13689
13811
|
});
|
|
13690
|
-
return _optionalChain([mergeRequests, 'access',
|
|
13812
|
+
return _optionalChain([mergeRequests, 'access', _404 => _404[0], 'optionalAccess', _405 => _405.iid]);
|
|
13691
13813
|
}
|
|
13692
13814
|
async closePullRequest({
|
|
13693
13815
|
pullRequestNumber
|
|
@@ -13799,7 +13921,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
13799
13921
|
}
|
|
13800
13922
|
const env = {
|
|
13801
13923
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
13802
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
13924
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _406 => _406.pullRequest, 'optionalAccess', _407 => _407.toString, 'call', _408 => _408()]) || "false",
|
|
13803
13925
|
...options.commitMessage && {
|
|
13804
13926
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
13805
13927
|
},
|
|
@@ -13825,7 +13947,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
13825
13947
|
const { isPullRequestMode } = platformKit.config;
|
|
13826
13948
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
13827
13949
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
13828
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
13950
|
+
const canRun = await _optionalChain([flow, 'access', _409 => _409.preRun, 'optionalCall', _410 => _410()]);
|
|
13829
13951
|
if (canRun === false) {
|
|
13830
13952
|
return;
|
|
13831
13953
|
}
|
|
@@ -13835,7 +13957,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
13835
13957
|
if (!hasChanges) {
|
|
13836
13958
|
return;
|
|
13837
13959
|
}
|
|
13838
|
-
await _optionalChain([flow, 'access',
|
|
13960
|
+
await _optionalChain([flow, 'access', _411 => _411.postRun, 'optionalCall', _412 => _412()]);
|
|
13839
13961
|
});
|
|
13840
13962
|
function parseBooleanArg(val) {
|
|
13841
13963
|
if (val === true) return true;
|
|
@@ -13872,8 +13994,8 @@ function exitGracefully(elapsedMs = 0) {
|
|
|
13872
13994
|
}
|
|
13873
13995
|
}
|
|
13874
13996
|
function checkForPendingOperations() {
|
|
13875
|
-
const activeHandles = _optionalChain([process, 'access',
|
|
13876
|
-
const activeRequests = _optionalChain([process, 'access',
|
|
13997
|
+
const activeHandles = _optionalChain([process, 'access', _413 => _413._getActiveHandles, 'optionalCall', _414 => _414()]) || [];
|
|
13998
|
+
const activeRequests = _optionalChain([process, 'access', _415 => _415._getActiveRequests, 'optionalCall', _416 => _416()]) || [];
|
|
13877
13999
|
const nonStandardHandles = activeHandles.filter((handle) => {
|
|
13878
14000
|
if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
|
|
13879
14001
|
return false;
|
|
@@ -13942,17 +14064,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
13942
14064
|
flags
|
|
13943
14065
|
});
|
|
13944
14066
|
let buckets = getBuckets(i18nConfig);
|
|
13945
|
-
if (_optionalChain([flags, 'access',
|
|
14067
|
+
if (_optionalChain([flags, 'access', _417 => _417.bucket, 'optionalAccess', _418 => _418.length])) {
|
|
13946
14068
|
buckets = buckets.filter(
|
|
13947
14069
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
13948
14070
|
);
|
|
13949
14071
|
}
|
|
13950
14072
|
ora.succeed("Buckets retrieved");
|
|
13951
|
-
if (_optionalChain([flags, 'access',
|
|
14073
|
+
if (_optionalChain([flags, 'access', _419 => _419.file, 'optionalAccess', _420 => _420.length])) {
|
|
13952
14074
|
buckets = buckets.map((bucket) => {
|
|
13953
14075
|
const paths = bucket.paths.filter(
|
|
13954
14076
|
(path19) => flags.file.find(
|
|
13955
|
-
(file) => _optionalChain([path19, 'access',
|
|
14077
|
+
(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
14078
|
)
|
|
13957
14079
|
);
|
|
13958
14080
|
return { ...bucket, paths };
|
|
@@ -13972,7 +14094,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
13972
14094
|
});
|
|
13973
14095
|
}
|
|
13974
14096
|
}
|
|
13975
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
14097
|
+
const targetLocales = _optionalChain([flags, 'access', _427 => _427.locale, 'optionalAccess', _428 => _428.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
13976
14098
|
let totalSourceKeyCount = 0;
|
|
13977
14099
|
let uniqueKeysToTranslate = 0;
|
|
13978
14100
|
let totalExistingTranslations = 0;
|
|
@@ -14380,12 +14502,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
14380
14502
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
14381
14503
|
docUrl: "bucketNotFound"
|
|
14382
14504
|
});
|
|
14383
|
-
} else if (_optionalChain([flags, 'access',
|
|
14505
|
+
} else if (_optionalChain([flags, 'access', _429 => _429.locale, 'optionalAccess', _430 => _430.some, 'call', _431 => _431((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
14384
14506
|
throw new CLIError({
|
|
14385
14507
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
14386
14508
|
docUrl: "localeTargetNotFound"
|
|
14387
14509
|
});
|
|
14388
|
-
} else if (_optionalChain([flags, 'access',
|
|
14510
|
+
} else if (_optionalChain([flags, 'access', _432 => _432.bucket, 'optionalAccess', _433 => _433.some, 'call', _434 => _434(
|
|
14389
14511
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
14390
14512
|
)])) {
|
|
14391
14513
|
throw new CLIError({
|
|
@@ -14477,7 +14599,7 @@ async function renderHero2() {
|
|
|
14477
14599
|
// package.json
|
|
14478
14600
|
var package_default = {
|
|
14479
14601
|
name: "lingo.dev",
|
|
14480
|
-
version: "0.117.
|
|
14602
|
+
version: "0.117.9",
|
|
14481
14603
|
description: "Lingo.dev CLI",
|
|
14482
14604
|
private: false,
|
|
14483
14605
|
publishConfig: {
|
|
@@ -14773,7 +14895,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
|
|
|
14773
14895
|
if (options.file && options.file.length) {
|
|
14774
14896
|
buckets = buckets.map((bucket) => {
|
|
14775
14897
|
const paths = bucket.paths.filter(
|
|
14776
|
-
(bucketPath) => _optionalChain([options, 'access',
|
|
14898
|
+
(bucketPath) => _optionalChain([options, 'access', _435 => _435.file, 'optionalAccess', _436 => _436.some, 'call', _437 => _437((f) => bucketPath.pathPattern.includes(f))])
|
|
14777
14899
|
);
|
|
14778
14900
|
return { ...bucket, paths };
|
|
14779
14901
|
}).filter((bucket) => bucket.paths.length > 0);
|