lingo.dev 0.85.6 → 0.86.0
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 +122 -59
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +79 -16
- package/build/cli.mjs.map +1 -1
- package/package.json +1 -1
package/build/cli.cjs
CHANGED
|
@@ -1032,6 +1032,8 @@ function createLoader(lDefinition) {
|
|
|
1032
1032
|
const state = {
|
|
1033
1033
|
defaultLocale: void 0,
|
|
1034
1034
|
originalInput: void 0,
|
|
1035
|
+
pullInput: void 0,
|
|
1036
|
+
pullOutput: void 0,
|
|
1035
1037
|
initCtx: void 0
|
|
1036
1038
|
};
|
|
1037
1039
|
return {
|
|
@@ -1059,7 +1061,10 @@ function createLoader(lDefinition) {
|
|
|
1059
1061
|
if (locale === state.defaultLocale) {
|
|
1060
1062
|
state.originalInput = input2 || null;
|
|
1061
1063
|
}
|
|
1062
|
-
|
|
1064
|
+
state.pullInput = input2;
|
|
1065
|
+
const result = await lDefinition.pull(locale, input2, state.initCtx);
|
|
1066
|
+
state.pullOutput = result;
|
|
1067
|
+
return result;
|
|
1063
1068
|
},
|
|
1064
1069
|
async push(locale, data) {
|
|
1065
1070
|
if (!state.defaultLocale) {
|
|
@@ -1068,7 +1073,14 @@ function createLoader(lDefinition) {
|
|
|
1068
1073
|
if (state.originalInput === void 0) {
|
|
1069
1074
|
throw new Error("Cannot push data without pulling first");
|
|
1070
1075
|
}
|
|
1071
|
-
const pushResult = await lDefinition.push(
|
|
1076
|
+
const pushResult = await lDefinition.push(
|
|
1077
|
+
locale,
|
|
1078
|
+
data,
|
|
1079
|
+
state.originalInput,
|
|
1080
|
+
state.defaultLocale,
|
|
1081
|
+
state.pullInput,
|
|
1082
|
+
state.pullOutput
|
|
1083
|
+
);
|
|
1072
1084
|
return pushResult;
|
|
1073
1085
|
}
|
|
1074
1086
|
};
|
|
@@ -1629,25 +1641,41 @@ ${content}`;
|
|
|
1629
1641
|
|
|
1630
1642
|
var _unified = require('unified');
|
|
1631
1643
|
var _remarkparse = require('remark-parse'); var _remarkparse2 = _interopRequireDefault(_remarkparse);
|
|
1632
|
-
var _remarkmdx = require('remark-mdx'); var _remarkmdx2 = _interopRequireDefault(_remarkmdx);
|
|
1633
1644
|
var _remarkfrontmatter = require('remark-frontmatter'); var _remarkfrontmatter2 = _interopRequireDefault(_remarkfrontmatter);
|
|
1634
1645
|
var _remarkgfm = require('remark-gfm'); var _remarkgfm2 = _interopRequireDefault(_remarkgfm);
|
|
1635
1646
|
var _remarkstringify = require('remark-stringify'); var _remarkstringify2 = _interopRequireDefault(_remarkstringify);
|
|
1636
|
-
var _remarkmdxfrontmatter = require('remark-mdx-frontmatter'); var _remarkmdxfrontmatter2 = _interopRequireDefault(_remarkmdxfrontmatter);
|
|
1637
1647
|
var _vfile = require('vfile');
|
|
1638
|
-
var parser = _unified.unified.call(void 0, ).use(_remarkparse2.default).use(
|
|
1639
|
-
var serializer = _unified.unified.call(void 0, ).use(_remarkstringify2.default).use(
|
|
1648
|
+
var parser = _unified.unified.call(void 0, ).use(_remarkparse2.default).use(_remarkfrontmatter2.default, ["yaml"]).use(_remarkgfm2.default);
|
|
1649
|
+
var serializer = _unified.unified.call(void 0, ).use(_remarkstringify2.default).use(_remarkfrontmatter2.default, ["yaml"]).use(_remarkgfm2.default);
|
|
1640
1650
|
function createMdxFormatLoader() {
|
|
1651
|
+
const skippedTypes = ["code", "inlineCode"];
|
|
1641
1652
|
return createLoader({
|
|
1642
1653
|
async pull(locale, input2) {
|
|
1643
1654
|
const file = new (0, _vfile.VFile)(input2);
|
|
1644
1655
|
const ast = parser.parse(file);
|
|
1645
|
-
|
|
1656
|
+
const result = _lodash2.default.cloneDeep(ast);
|
|
1657
|
+
traverseMdast(result, (node) => {
|
|
1658
|
+
if (skippedTypes.includes(node.type)) {
|
|
1659
|
+
if ("value" in node) {
|
|
1660
|
+
node.value = "";
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
});
|
|
1664
|
+
return result;
|
|
1646
1665
|
},
|
|
1647
|
-
async push(locale, data) {
|
|
1648
|
-
const
|
|
1649
|
-
const
|
|
1650
|
-
|
|
1666
|
+
async push(locale, data, originalInput, originalLocale, pullInput, pullOutput) {
|
|
1667
|
+
const file = new (0, _vfile.VFile)(originalInput);
|
|
1668
|
+
const ast = parser.parse(file);
|
|
1669
|
+
const result = _lodash2.default.cloneDeep(ast);
|
|
1670
|
+
traverseMdast(result, (node, indexPath) => {
|
|
1671
|
+
if ("value" in node) {
|
|
1672
|
+
const incomingValue = findNodeByIndexPath(data, indexPath);
|
|
1673
|
+
if (incomingValue && "value" in incomingValue && !_lodash2.default.isEmpty(incomingValue.value)) {
|
|
1674
|
+
node.value = incomingValue.value;
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
});
|
|
1678
|
+
return String(serializer.stringify(result));
|
|
1651
1679
|
}
|
|
1652
1680
|
});
|
|
1653
1681
|
}
|
|
@@ -1676,6 +1704,28 @@ function createMdxStructureLoader() {
|
|
|
1676
1704
|
}
|
|
1677
1705
|
});
|
|
1678
1706
|
}
|
|
1707
|
+
function traverseMdast(ast, visitor, indexPath = []) {
|
|
1708
|
+
visitor(ast, indexPath);
|
|
1709
|
+
if ("children" in ast && Array.isArray(ast.children)) {
|
|
1710
|
+
for (let i = 0; i < ast.children.length; i++) {
|
|
1711
|
+
traverseMdast(ast.children[i], visitor, [...indexPath, i]);
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
function findNodeByIndexPath(ast, indexPath) {
|
|
1716
|
+
let result = null;
|
|
1717
|
+
const stringifiedIndexPath = indexPath.join(".");
|
|
1718
|
+
traverseMdast(ast, (node, path18) => {
|
|
1719
|
+
if (result) {
|
|
1720
|
+
return;
|
|
1721
|
+
}
|
|
1722
|
+
const currentStringifiedPath = path18.join(".");
|
|
1723
|
+
if (currentStringifiedPath === stringifiedIndexPath) {
|
|
1724
|
+
result = node;
|
|
1725
|
+
}
|
|
1726
|
+
});
|
|
1727
|
+
return result;
|
|
1728
|
+
}
|
|
1679
1729
|
|
|
1680
1730
|
// src/cli/loaders/properties.ts
|
|
1681
1731
|
function createPropertiesLoader() {
|
|
@@ -1996,14 +2046,27 @@ function createPoDataLoader(params) {
|
|
|
1996
2046
|
}
|
|
1997
2047
|
return result;
|
|
1998
2048
|
},
|
|
1999
|
-
async push(locale, data, originalInput) {
|
|
2000
|
-
const
|
|
2001
|
-
const
|
|
2049
|
+
async push(locale, data, originalInput, originalLocale, pullInput) {
|
|
2050
|
+
const currentSections = _optionalChain([pullInput, 'optionalAccess', _86 => _86.split, 'call', _87 => _87("\n\n"), 'access', _88 => _88.filter, 'call', _89 => _89(Boolean)]) || [];
|
|
2051
|
+
const originalSections = _optionalChain([originalInput, 'optionalAccess', _90 => _90.split, 'call', _91 => _91("\n\n"), 'access', _92 => _92.filter, 'call', _93 => _93(Boolean)]) || [];
|
|
2052
|
+
const result = originalSections.map((section) => {
|
|
2002
2053
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
2003
2054
|
const contextKey = _lodash2.default.keys(sectionPo.translations)[0];
|
|
2004
2055
|
const entries = sectionPo.translations[contextKey];
|
|
2005
2056
|
const msgid = Object.keys(entries).find((key) => entries[key].msgid);
|
|
2006
|
-
if (!msgid)
|
|
2057
|
+
if (!msgid) {
|
|
2058
|
+
const currentSection = currentSections.find((cs) => {
|
|
2059
|
+
const csPo = _gettextparser2.default.po.parse(cs);
|
|
2060
|
+
const csContextKey = _lodash2.default.keys(csPo.translations)[0];
|
|
2061
|
+
const csEntries = csPo.translations[csContextKey];
|
|
2062
|
+
const csMsgid = Object.keys(csEntries).find((key) => csEntries[key].msgid);
|
|
2063
|
+
return csMsgid === msgid;
|
|
2064
|
+
});
|
|
2065
|
+
if (currentSection) {
|
|
2066
|
+
return currentSection;
|
|
2067
|
+
}
|
|
2068
|
+
return section;
|
|
2069
|
+
}
|
|
2007
2070
|
if (data[msgid]) {
|
|
2008
2071
|
const updatedPo = _lodash2.default.merge({}, sectionPo, {
|
|
2009
2072
|
translations: {
|
|
@@ -2039,7 +2102,7 @@ function createPoContentLoader() {
|
|
|
2039
2102
|
entry.msgid,
|
|
2040
2103
|
{
|
|
2041
2104
|
...entry,
|
|
2042
|
-
msgstr: [_optionalChain([data, 'access',
|
|
2105
|
+
msgstr: [_optionalChain([data, 'access', _94 => _94[entry.msgid], 'optionalAccess', _95 => _95.singular]), _optionalChain([data, 'access', _96 => _96[entry.msgid], 'optionalAccess', _97 => _97.plural]) || null].filter(Boolean)
|
|
2043
2106
|
}
|
|
2044
2107
|
]).fromPairs().value();
|
|
2045
2108
|
return result;
|
|
@@ -2285,7 +2348,7 @@ function createDatoClient(params) {
|
|
|
2285
2348
|
only_valid: "true",
|
|
2286
2349
|
ids: !records.length ? void 0 : records.join(",")
|
|
2287
2350
|
}
|
|
2288
|
-
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2351
|
+
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _98 => _98.response, 'optionalAccess', _99 => _99.body, 'optionalAccess', _100 => _100.data, 'optionalAccess', _101 => _101[0]]) || error));
|
|
2289
2352
|
},
|
|
2290
2353
|
findRecordsForModel: async (modelId, records) => {
|
|
2291
2354
|
try {
|
|
@@ -2295,9 +2358,9 @@ function createDatoClient(params) {
|
|
|
2295
2358
|
filter: {
|
|
2296
2359
|
type: modelId,
|
|
2297
2360
|
only_valid: "true",
|
|
2298
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
2361
|
+
ids: !_optionalChain([records, 'optionalAccess', _102 => _102.length]) ? void 0 : records.join(",")
|
|
2299
2362
|
}
|
|
2300
|
-
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2363
|
+
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _103 => _103.response, 'optionalAccess', _104 => _104.body, 'optionalAccess', _105 => _105.data, 'optionalAccess', _106 => _106[0]]) || error));
|
|
2301
2364
|
return result;
|
|
2302
2365
|
} catch (_error) {
|
|
2303
2366
|
throw new Error(
|
|
@@ -2311,9 +2374,9 @@ function createDatoClient(params) {
|
|
|
2311
2374
|
},
|
|
2312
2375
|
updateRecord: async (id, payload) => {
|
|
2313
2376
|
try {
|
|
2314
|
-
await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2377
|
+
await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _107 => _107.response, 'optionalAccess', _108 => _108.body, 'optionalAccess', _109 => _109.data, 'optionalAccess', _110 => _110[0]]) || error));
|
|
2315
2378
|
} catch (_error) {
|
|
2316
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2379
|
+
if (_optionalChain([_error, 'optionalAccess', _111 => _111.attributes, 'optionalAccess', _112 => _112.details, 'optionalAccess', _113 => _113.message])) {
|
|
2317
2380
|
throw new Error(
|
|
2318
2381
|
[
|
|
2319
2382
|
`${_error.attributes.details.message}`,
|
|
@@ -2334,9 +2397,9 @@ function createDatoClient(params) {
|
|
|
2334
2397
|
},
|
|
2335
2398
|
enableFieldLocalization: async (args) => {
|
|
2336
2399
|
try {
|
|
2337
|
-
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2400
|
+
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _114 => _114.response, 'optionalAccess', _115 => _115.body, 'optionalAccess', _116 => _116.data, 'optionalAccess', _117 => _117[0]]) || error));
|
|
2338
2401
|
} catch (_error) {
|
|
2339
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2402
|
+
if (_optionalChain([_error, 'optionalAccess', _118 => _118.attributes, 'optionalAccess', _119 => _119.code]) === "NOT_FOUND") {
|
|
2340
2403
|
throw new Error(
|
|
2341
2404
|
[
|
|
2342
2405
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -2344,7 +2407,7 @@ function createDatoClient(params) {
|
|
|
2344
2407
|
].join("\n\n")
|
|
2345
2408
|
);
|
|
2346
2409
|
}
|
|
2347
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2410
|
+
if (_optionalChain([_error, 'optionalAccess', _120 => _120.attributes, 'optionalAccess', _121 => _121.details, 'optionalAccess', _122 => _122.message])) {
|
|
2348
2411
|
throw new Error(
|
|
2349
2412
|
[`${_error.attributes.details.message}`, `Error: ${JSON.stringify(_error, null, 2)}`].join("\n\n")
|
|
2350
2413
|
);
|
|
@@ -2410,7 +2473,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
2410
2473
|
}
|
|
2411
2474
|
}
|
|
2412
2475
|
const records = await dato.findRecordsForModel(modelId);
|
|
2413
|
-
const recordChoices = createRecordChoices(records, _optionalChain([config, 'access',
|
|
2476
|
+
const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _123 => _123.models, 'access', _124 => _124[modelId], 'optionalAccess', _125 => _125.records]) || [], project);
|
|
2414
2477
|
const selectedRecords = await promptRecordSelection(modelName, recordChoices);
|
|
2415
2478
|
result.models[modelId].records = records.filter((record) => selectedRecords.includes(record.id));
|
|
2416
2479
|
updatedConfig.models[modelId].records = selectedRecords;
|
|
@@ -2422,14 +2485,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
2422
2485
|
},
|
|
2423
2486
|
async pull(locale, input2, initCtx) {
|
|
2424
2487
|
const result = {};
|
|
2425
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
2426
|
-
let records = _optionalChain([initCtx, 'optionalAccess',
|
|
2488
|
+
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _126 => _126.models]) || {})) {
|
|
2489
|
+
let records = _optionalChain([initCtx, 'optionalAccess', _127 => _127.models, 'access', _128 => _128[modelId], 'access', _129 => _129.records]) || [];
|
|
2427
2490
|
const recordIds = records.map((record) => record.id);
|
|
2428
2491
|
records = await dato.findRecords(recordIds);
|
|
2429
2492
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
2430
2493
|
if (records.length > 0) {
|
|
2431
2494
|
result[modelId] = {
|
|
2432
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
2495
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _130 => _130.models, 'optionalAccess', _131 => _131[modelId], 'optionalAccess', _132 => _132.fields]) || [],
|
|
2433
2496
|
records
|
|
2434
2497
|
};
|
|
2435
2498
|
}
|
|
@@ -2488,7 +2551,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
2488
2551
|
return records.map((record) => ({
|
|
2489
2552
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
2490
2553
|
value: record.id,
|
|
2491
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
2554
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _133 => _133.includes, 'call', _134 => _134(record.id)])
|
|
2492
2555
|
}));
|
|
2493
2556
|
}
|
|
2494
2557
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -2755,7 +2818,7 @@ var _nodewebvtt = require('node-webvtt'); var _nodewebvtt2 = _interopRequireDefa
|
|
|
2755
2818
|
function createVttLoader() {
|
|
2756
2819
|
return createLoader({
|
|
2757
2820
|
async pull(locale, input2) {
|
|
2758
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
2821
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _135 => _135.parse, 'call', _136 => _136(input2), 'optionalAccess', _137 => _137.cues]);
|
|
2759
2822
|
if (Object.keys(vtt).length === 0) {
|
|
2760
2823
|
return {};
|
|
2761
2824
|
} else {
|
|
@@ -2808,7 +2871,7 @@ function variableExtractLoader(params) {
|
|
|
2808
2871
|
for (let i = 0; i < matches.length; i++) {
|
|
2809
2872
|
const match = matches[i];
|
|
2810
2873
|
const currentValue = result[key].value;
|
|
2811
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
2874
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _138 => _138.replace, 'call', _139 => _139(match, `{variable:${i}}`)]);
|
|
2812
2875
|
result[key].value = newValue;
|
|
2813
2876
|
result[key].variables[i] = match;
|
|
2814
2877
|
}
|
|
@@ -2822,7 +2885,7 @@ function variableExtractLoader(params) {
|
|
|
2822
2885
|
for (let i = 0; i < valueObj.variables.length; i++) {
|
|
2823
2886
|
const variable = valueObj.variables[i];
|
|
2824
2887
|
const currentValue = result[key];
|
|
2825
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
2888
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _140 => _140.replace, 'call', _141 => _141(`{variable:${i}}`, variable)]);
|
|
2826
2889
|
result[key] = newValue;
|
|
2827
2890
|
}
|
|
2828
2891
|
}
|
|
@@ -3003,7 +3066,7 @@ function createVueJsonLoader() {
|
|
|
3003
3066
|
return createLoader({
|
|
3004
3067
|
pull: async (locale, input2, ctx) => {
|
|
3005
3068
|
const parsed = parseVueFile(input2);
|
|
3006
|
-
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess',
|
|
3069
|
+
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _142 => _142.i18n, 'optionalAccess', _143 => _143[locale]]), () => ( {}));
|
|
3007
3070
|
},
|
|
3008
3071
|
push: async (locale, data, originalInput) => {
|
|
3009
3072
|
const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
|
|
@@ -3415,7 +3478,7 @@ function createBasicTranslator(model, systemPrompt) {
|
|
|
3415
3478
|
]
|
|
3416
3479
|
});
|
|
3417
3480
|
const result = JSON.parse(response.text);
|
|
3418
|
-
return _optionalChain([result, 'optionalAccess',
|
|
3481
|
+
return _optionalChain([result, 'optionalAccess', _144 => _144.data]) || {};
|
|
3419
3482
|
};
|
|
3420
3483
|
}
|
|
3421
3484
|
|
|
@@ -3433,7 +3496,7 @@ function createProcessor(provider, params) {
|
|
|
3433
3496
|
}
|
|
3434
3497
|
}
|
|
3435
3498
|
function getPureModelProvider(provider) {
|
|
3436
|
-
switch (_optionalChain([provider, 'optionalAccess',
|
|
3499
|
+
switch (_optionalChain([provider, 'optionalAccess', _145 => _145.id])) {
|
|
3437
3500
|
case "openai":
|
|
3438
3501
|
if (!process.env.OPENAI_API_KEY) {
|
|
3439
3502
|
throw new Error("OPENAI_API_KEY is not set.");
|
|
@@ -3450,7 +3513,7 @@ function getPureModelProvider(provider) {
|
|
|
3450
3513
|
apiKey: process.env.ANTHROPIC_API_KEY
|
|
3451
3514
|
})(provider.model);
|
|
3452
3515
|
default:
|
|
3453
|
-
throw new Error(`Unsupported provider: ${_optionalChain([provider, 'optionalAccess',
|
|
3516
|
+
throw new Error(`Unsupported provider: ${_optionalChain([provider, 'optionalAccess', _146 => _146.id])}`);
|
|
3454
3517
|
}
|
|
3455
3518
|
}
|
|
3456
3519
|
|
|
@@ -3652,14 +3715,14 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
3652
3715
|
flags
|
|
3653
3716
|
});
|
|
3654
3717
|
let buckets = getBuckets(i18nConfig);
|
|
3655
|
-
if (_optionalChain([flags, 'access',
|
|
3718
|
+
if (_optionalChain([flags, 'access', _147 => _147.bucket, 'optionalAccess', _148 => _148.length])) {
|
|
3656
3719
|
buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
|
|
3657
3720
|
}
|
|
3658
3721
|
ora.succeed("Buckets retrieved");
|
|
3659
|
-
if (_optionalChain([flags, 'access',
|
|
3722
|
+
if (_optionalChain([flags, 'access', _149 => _149.file, 'optionalAccess', _150 => _150.length])) {
|
|
3660
3723
|
buckets = buckets.map((bucket) => {
|
|
3661
3724
|
const paths = bucket.paths.filter(
|
|
3662
|
-
(path18) => flags.file.find((file) => _optionalChain([path18, 'access',
|
|
3725
|
+
(path18) => flags.file.find((file) => _optionalChain([path18, 'access', _151 => _151.pathPattern, 'optionalAccess', _152 => _152.includes, 'call', _153 => _153(file)]))
|
|
3663
3726
|
);
|
|
3664
3727
|
return { ...bucket, paths };
|
|
3665
3728
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -3676,7 +3739,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
3676
3739
|
});
|
|
3677
3740
|
}
|
|
3678
3741
|
}
|
|
3679
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
3742
|
+
const targetLocales = _optionalChain([flags, 'access', _154 => _154.locale, 'optionalAccess', _155 => _155.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
3680
3743
|
ora.start("Setting up localization cache...");
|
|
3681
3744
|
const checkLockfileProcessor = createDeltaProcessor("");
|
|
3682
3745
|
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
@@ -4064,12 +4127,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
4064
4127
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
4065
4128
|
docUrl: "bucketNotFound"
|
|
4066
4129
|
});
|
|
4067
|
-
} else if (_optionalChain([flags, 'access',
|
|
4130
|
+
} else if (_optionalChain([flags, 'access', _156 => _156.locale, 'optionalAccess', _157 => _157.some, 'call', _158 => _158((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
4068
4131
|
throw new CLIError({
|
|
4069
4132
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
4070
4133
|
docUrl: "localeTargetNotFound"
|
|
4071
4134
|
});
|
|
4072
|
-
} else if (_optionalChain([flags, 'access',
|
|
4135
|
+
} else if (_optionalChain([flags, 'access', _159 => _159.bucket, 'optionalAccess', _160 => _160.some, 'call', _161 => _161((bucket) => !i18nConfig.buckets[bucket])])) {
|
|
4073
4136
|
throw new CLIError({
|
|
4074
4137
|
message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
|
|
4075
4138
|
docUrl: "bucketNotFound"
|
|
@@ -4502,7 +4565,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
4502
4565
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
4503
4566
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
4504
4567
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
4505
|
-
_optionalChain([this, 'access',
|
|
4568
|
+
_optionalChain([this, 'access', _162 => _162.platformKit, 'optionalAccess', _163 => _163.gitConfig, 'call', _164 => _164()]);
|
|
4506
4569
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
4507
4570
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
4508
4571
|
if (!processOwnCommits) {
|
|
@@ -4527,7 +4590,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
4527
4590
|
// ../../action/src/flows/pull-request.ts
|
|
4528
4591
|
var PullRequestFlow = class extends InBranchFlow {
|
|
4529
4592
|
async preRun() {
|
|
4530
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
4593
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _165 => _165()]);
|
|
4531
4594
|
if (!canContinue) {
|
|
4532
4595
|
return false;
|
|
4533
4596
|
}
|
|
@@ -4745,10 +4808,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
4745
4808
|
repo_slug: this.platformConfig.repositoryName,
|
|
4746
4809
|
state: "OPEN"
|
|
4747
4810
|
}).then(({ data: { values } }) => {
|
|
4748
|
-
return _optionalChain([values, 'optionalAccess',
|
|
4749
|
-
({ source, destination }) => _optionalChain([source, 'optionalAccess',
|
|
4811
|
+
return _optionalChain([values, 'optionalAccess', _166 => _166.find, 'call', _167 => _167(
|
|
4812
|
+
({ source, destination }) => _optionalChain([source, 'optionalAccess', _168 => _168.branch, 'optionalAccess', _169 => _169.name]) === branch && _optionalChain([destination, 'optionalAccess', _170 => _170.branch, 'optionalAccess', _171 => _171.name]) === this.platformConfig.baseBranchName
|
|
4750
4813
|
)]);
|
|
4751
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
4814
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _172 => _172.id]));
|
|
4752
4815
|
}
|
|
4753
4816
|
async closePullRequest({ pullRequestNumber }) {
|
|
4754
4817
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -4834,7 +4897,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
4834
4897
|
repo: this.platformConfig.repositoryName,
|
|
4835
4898
|
base: this.platformConfig.baseBranchName,
|
|
4836
4899
|
state: "open"
|
|
4837
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
4900
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _173 => _173.number]));
|
|
4838
4901
|
}
|
|
4839
4902
|
async closePullRequest({ pullRequestNumber }) {
|
|
4840
4903
|
await this.octokit.rest.pulls.update({
|
|
@@ -4947,7 +5010,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
4947
5010
|
sourceBranch: branch,
|
|
4948
5011
|
state: "opened"
|
|
4949
5012
|
});
|
|
4950
|
-
return _optionalChain([mergeRequests, 'access',
|
|
5013
|
+
return _optionalChain([mergeRequests, 'access', _174 => _174[0], 'optionalAccess', _175 => _175.iid]);
|
|
4951
5014
|
}
|
|
4952
5015
|
async closePullRequest({ pullRequestNumber }) {
|
|
4953
5016
|
await this.gitlab.MergeRequests.edit(this.platformConfig.gitlabProjectId, pullRequestNumber, {
|
|
@@ -5000,7 +5063,7 @@ async function main() {
|
|
|
5000
5063
|
const { isPullRequestMode } = platformKit.config;
|
|
5001
5064
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
5002
5065
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
5003
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
5066
|
+
const canRun = await _optionalChain([flow, 'access', _176 => _176.preRun, 'optionalCall', _177 => _177()]);
|
|
5004
5067
|
if (canRun === false) {
|
|
5005
5068
|
return;
|
|
5006
5069
|
}
|
|
@@ -5008,7 +5071,7 @@ async function main() {
|
|
|
5008
5071
|
if (!hasChanges) {
|
|
5009
5072
|
return;
|
|
5010
5073
|
}
|
|
5011
|
-
await _optionalChain([flow, 'access',
|
|
5074
|
+
await _optionalChain([flow, 'access', _178 => _178.postRun, 'optionalCall', _179 => _179()]);
|
|
5012
5075
|
}
|
|
5013
5076
|
|
|
5014
5077
|
// src/cli/cmd/ci.ts
|
|
@@ -5030,7 +5093,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
5030
5093
|
}
|
|
5031
5094
|
const env = {
|
|
5032
5095
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
5033
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
5096
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _180 => _180.pullRequest, 'optionalAccess', _181 => _181.toString, 'call', _182 => _182()]) || "false",
|
|
5034
5097
|
...options.commitMessage && { LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage },
|
|
5035
5098
|
...options.pullRequestTitle && { LINGODOTDEV_PULL_REQUEST_TITLE: options.pullRequestTitle },
|
|
5036
5099
|
...options.workingDirectory && { LINGODOTDEV_WORKING_DIRECTORY: options.workingDirectory },
|
|
@@ -5081,13 +5144,13 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
5081
5144
|
flags
|
|
5082
5145
|
});
|
|
5083
5146
|
let buckets = getBuckets(i18nConfig);
|
|
5084
|
-
if (_optionalChain([flags, 'access',
|
|
5147
|
+
if (_optionalChain([flags, 'access', _183 => _183.bucket, 'optionalAccess', _184 => _184.length])) {
|
|
5085
5148
|
buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
|
|
5086
5149
|
}
|
|
5087
5150
|
ora.succeed("Buckets retrieved");
|
|
5088
|
-
if (_optionalChain([flags, 'access',
|
|
5151
|
+
if (_optionalChain([flags, 'access', _185 => _185.file, 'optionalAccess', _186 => _186.length])) {
|
|
5089
5152
|
buckets = buckets.map((bucket) => {
|
|
5090
|
-
const paths = bucket.paths.filter((path18) => flags.file.find((file) => _optionalChain([path18, 'access',
|
|
5153
|
+
const paths = bucket.paths.filter((path18) => flags.file.find((file) => _optionalChain([path18, 'access', _187 => _187.pathPattern, 'optionalAccess', _188 => _188.match, 'call', _189 => _189(file)])));
|
|
5091
5154
|
return { ...bucket, paths };
|
|
5092
5155
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
5093
5156
|
if (buckets.length === 0) {
|
|
@@ -5103,7 +5166,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
5103
5166
|
});
|
|
5104
5167
|
}
|
|
5105
5168
|
}
|
|
5106
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
5169
|
+
const targetLocales = _optionalChain([flags, 'access', _190 => _190.locale, 'optionalAccess', _191 => _191.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
5107
5170
|
let totalSourceKeyCount = 0;
|
|
5108
5171
|
let uniqueKeysToTranslate = 0;
|
|
5109
5172
|
let totalExistingTranslations = 0;
|
|
@@ -5444,12 +5507,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
5444
5507
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
5445
5508
|
docUrl: "bucketNotFound"
|
|
5446
5509
|
});
|
|
5447
|
-
} else if (_optionalChain([flags, 'access',
|
|
5510
|
+
} else if (_optionalChain([flags, 'access', _192 => _192.locale, 'optionalAccess', _193 => _193.some, 'call', _194 => _194((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
5448
5511
|
throw new CLIError({
|
|
5449
5512
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
5450
5513
|
docUrl: "localeTargetNotFound"
|
|
5451
5514
|
});
|
|
5452
|
-
} else if (_optionalChain([flags, 'access',
|
|
5515
|
+
} else if (_optionalChain([flags, 'access', _195 => _195.bucket, 'optionalAccess', _196 => _196.some, 'call', _197 => _197((bucket) => !i18nConfig.buckets[bucket])])) {
|
|
5453
5516
|
throw new CLIError({
|
|
5454
5517
|
message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
|
|
5455
5518
|
docUrl: "bucketNotFound"
|
|
@@ -5460,7 +5523,7 @@ function validateParams2(i18nConfig, flags) {
|
|
|
5460
5523
|
// package.json
|
|
5461
5524
|
var package_default = {
|
|
5462
5525
|
name: "lingo.dev",
|
|
5463
|
-
version: "0.
|
|
5526
|
+
version: "0.86.0",
|
|
5464
5527
|
description: "Lingo.dev CLI",
|
|
5465
5528
|
private: false,
|
|
5466
5529
|
publishConfig: {
|