lingo.dev 0.78.7 → 0.78.8
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 +32 -32
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +4 -4
- package/build/cli.mjs.map +1 -1
- package/package.json +3 -3
package/build/cli.cjs
CHANGED
|
@@ -1573,10 +1573,10 @@ function createMarkdownLoader() {
|
|
|
1573
1573
|
yaml: yamlEngine
|
|
1574
1574
|
}
|
|
1575
1575
|
});
|
|
1576
|
-
const sections = content.split(SECTION_REGEX).map((section) => section.trim()).filter(Boolean);
|
|
1576
|
+
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _63 => _63.trim, 'call', _64 => _64()]), () => ( ""))).filter(Boolean);
|
|
1577
1577
|
return {
|
|
1578
1578
|
...Object.fromEntries(
|
|
1579
|
-
sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section
|
|
1579
|
+
sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
|
|
1580
1580
|
),
|
|
1581
1581
|
...Object.fromEntries(Object.entries(frontmatter).map(([key, value]) => [`${FM_ATTR_PREFIX}${key}`, value]))
|
|
1582
1582
|
};
|
|
@@ -1585,7 +1585,7 @@ function createMarkdownLoader() {
|
|
|
1585
1585
|
const frontmatter = Object.fromEntries(
|
|
1586
1586
|
Object.entries(data).filter(([key]) => key.startsWith(FM_ATTR_PREFIX)).map(([key, value]) => [key.replace(FM_ATTR_PREFIX, ""), value])
|
|
1587
1587
|
);
|
|
1588
|
-
let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())).map(([, value]) => value.trim()).filter(Boolean).join("\n\n");
|
|
1588
|
+
let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _65 => _65.trim, 'call', _66 => _66()]), () => ( ""))).filter(Boolean).join("\n\n");
|
|
1589
1589
|
if (Object.keys(frontmatter).length > 0) {
|
|
1590
1590
|
content = `
|
|
1591
1591
|
${content}`;
|
|
@@ -1629,7 +1629,7 @@ function isSkippableLine(line) {
|
|
|
1629
1629
|
function parsePropertyLine(line) {
|
|
1630
1630
|
const [key, ...valueParts] = line.split("=");
|
|
1631
1631
|
return {
|
|
1632
|
-
key: _optionalChain([key, 'optionalAccess',
|
|
1632
|
+
key: _optionalChain([key, 'optionalAccess', _67 => _67.trim, 'call', _68 => _68()]) || "",
|
|
1633
1633
|
value: valueParts.join("=").trim()
|
|
1634
1634
|
};
|
|
1635
1635
|
}
|
|
@@ -1715,7 +1715,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
1715
1715
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
1716
1716
|
continue;
|
|
1717
1717
|
}
|
|
1718
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
1718
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _69 => _69.localizations, 'optionalAccess', _70 => _70[locale]]);
|
|
1719
1719
|
if (langTranslationEntity) {
|
|
1720
1720
|
if ("stringUnit" in langTranslationEntity) {
|
|
1721
1721
|
resultData[translationKey] = langTranslationEntity.stringUnit.value;
|
|
@@ -1724,7 +1724,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
1724
1724
|
resultData[translationKey] = {};
|
|
1725
1725
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
1726
1726
|
for (const form in pluralForms) {
|
|
1727
|
-
if (_optionalChain([pluralForms, 'access',
|
|
1727
|
+
if (_optionalChain([pluralForms, 'access', _71 => _71[form], 'optionalAccess', _72 => _72.stringUnit, 'optionalAccess', _73 => _73.value])) {
|
|
1728
1728
|
resultData[translationKey][form] = pluralForms[form].stringUnit.value;
|
|
1729
1729
|
}
|
|
1730
1730
|
}
|
|
@@ -1748,7 +1748,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
1748
1748
|
const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
|
|
1749
1749
|
if (typeof value === "string") {
|
|
1750
1750
|
langDataToMerge.strings[key] = {
|
|
1751
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
1751
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _74 => _74.strings, 'optionalAccess', _75 => _75[key], 'optionalAccess', _76 => _76.extractionState]),
|
|
1752
1752
|
localizations: {
|
|
1753
1753
|
[locale]: {
|
|
1754
1754
|
stringUnit: {
|
|
@@ -1891,7 +1891,7 @@ function createPoDataLoader(params) {
|
|
|
1891
1891
|
Object.entries(entries).forEach(([msgid, entry]) => {
|
|
1892
1892
|
if (msgid && entry.msgid) {
|
|
1893
1893
|
const context = entry.msgctxt || "";
|
|
1894
|
-
const fullEntry = _optionalChain([parsedPo, 'access',
|
|
1894
|
+
const fullEntry = _optionalChain([parsedPo, 'access', _77 => _77.translations, 'access', _78 => _78[context], 'optionalAccess', _79 => _79[msgid]]);
|
|
1895
1895
|
if (fullEntry) {
|
|
1896
1896
|
result[msgid] = fullEntry;
|
|
1897
1897
|
}
|
|
@@ -1901,7 +1901,7 @@ function createPoDataLoader(params) {
|
|
|
1901
1901
|
return result;
|
|
1902
1902
|
},
|
|
1903
1903
|
async push(locale, data, originalInput) {
|
|
1904
|
-
const sections = _optionalChain([originalInput, 'optionalAccess',
|
|
1904
|
+
const sections = _optionalChain([originalInput, 'optionalAccess', _80 => _80.split, 'call', _81 => _81("\n\n"), 'access', _82 => _82.filter, 'call', _83 => _83(Boolean)]) || [];
|
|
1905
1905
|
const result = sections.map((section) => {
|
|
1906
1906
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
1907
1907
|
const contextKey = _lodash2.default.keys(sectionPo.translations)[0];
|
|
@@ -1943,7 +1943,7 @@ function createPoContentLoader() {
|
|
|
1943
1943
|
entry.msgid,
|
|
1944
1944
|
{
|
|
1945
1945
|
...entry,
|
|
1946
|
-
msgstr: [_optionalChain([data, 'access',
|
|
1946
|
+
msgstr: [_optionalChain([data, 'access', _84 => _84[entry.msgid], 'optionalAccess', _85 => _85.singular]), _optionalChain([data, 'access', _86 => _86[entry.msgid], 'optionalAccess', _87 => _87.plural]) || null].filter(Boolean)
|
|
1947
1947
|
}
|
|
1948
1948
|
]).fromPairs().value();
|
|
1949
1949
|
return result;
|
|
@@ -2189,7 +2189,7 @@ function createDatoClient(params) {
|
|
|
2189
2189
|
only_valid: "true",
|
|
2190
2190
|
ids: !records.length ? void 0 : records.join(",")
|
|
2191
2191
|
}
|
|
2192
|
-
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2192
|
+
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _88 => _88.response, 'optionalAccess', _89 => _89.body, 'optionalAccess', _90 => _90.data, 'optionalAccess', _91 => _91[0]]) || error));
|
|
2193
2193
|
},
|
|
2194
2194
|
findRecordsForModel: async (modelId, records) => {
|
|
2195
2195
|
try {
|
|
@@ -2199,9 +2199,9 @@ function createDatoClient(params) {
|
|
|
2199
2199
|
filter: {
|
|
2200
2200
|
type: modelId,
|
|
2201
2201
|
only_valid: "true",
|
|
2202
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
2202
|
+
ids: !_optionalChain([records, 'optionalAccess', _92 => _92.length]) ? void 0 : records.join(",")
|
|
2203
2203
|
}
|
|
2204
|
-
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2204
|
+
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _93 => _93.response, 'optionalAccess', _94 => _94.body, 'optionalAccess', _95 => _95.data, 'optionalAccess', _96 => _96[0]]) || error));
|
|
2205
2205
|
return result;
|
|
2206
2206
|
} catch (_error) {
|
|
2207
2207
|
throw new Error(
|
|
@@ -2215,9 +2215,9 @@ function createDatoClient(params) {
|
|
|
2215
2215
|
},
|
|
2216
2216
|
updateRecord: async (id, payload) => {
|
|
2217
2217
|
try {
|
|
2218
|
-
await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2218
|
+
await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _97 => _97.response, 'optionalAccess', _98 => _98.body, 'optionalAccess', _99 => _99.data, 'optionalAccess', _100 => _100[0]]) || error));
|
|
2219
2219
|
} catch (_error) {
|
|
2220
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2220
|
+
if (_optionalChain([_error, 'optionalAccess', _101 => _101.attributes, 'optionalAccess', _102 => _102.details, 'optionalAccess', _103 => _103.message])) {
|
|
2221
2221
|
throw new Error(
|
|
2222
2222
|
[
|
|
2223
2223
|
`${_error.attributes.details.message}`,
|
|
@@ -2238,9 +2238,9 @@ function createDatoClient(params) {
|
|
|
2238
2238
|
},
|
|
2239
2239
|
enableFieldLocalization: async (args) => {
|
|
2240
2240
|
try {
|
|
2241
|
-
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2241
|
+
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _104 => _104.response, 'optionalAccess', _105 => _105.body, 'optionalAccess', _106 => _106.data, 'optionalAccess', _107 => _107[0]]) || error));
|
|
2242
2242
|
} catch (_error) {
|
|
2243
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2243
|
+
if (_optionalChain([_error, 'optionalAccess', _108 => _108.attributes, 'optionalAccess', _109 => _109.code]) === "NOT_FOUND") {
|
|
2244
2244
|
throw new Error(
|
|
2245
2245
|
[
|
|
2246
2246
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -2248,7 +2248,7 @@ function createDatoClient(params) {
|
|
|
2248
2248
|
].join("\n\n")
|
|
2249
2249
|
);
|
|
2250
2250
|
}
|
|
2251
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2251
|
+
if (_optionalChain([_error, 'optionalAccess', _110 => _110.attributes, 'optionalAccess', _111 => _111.details, 'optionalAccess', _112 => _112.message])) {
|
|
2252
2252
|
throw new Error(
|
|
2253
2253
|
[`${_error.attributes.details.message}`, `Error: ${JSON.stringify(_error, null, 2)}`].join("\n\n")
|
|
2254
2254
|
);
|
|
@@ -2314,7 +2314,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
2314
2314
|
}
|
|
2315
2315
|
}
|
|
2316
2316
|
const records = await dato.findRecordsForModel(modelId);
|
|
2317
|
-
const recordChoices = createRecordChoices(records, _optionalChain([config, 'access',
|
|
2317
|
+
const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _113 => _113.models, 'access', _114 => _114[modelId], 'optionalAccess', _115 => _115.records]) || [], project);
|
|
2318
2318
|
const selectedRecords = await promptRecordSelection(modelName, recordChoices);
|
|
2319
2319
|
result.models[modelId].records = records.filter((record) => selectedRecords.includes(record.id));
|
|
2320
2320
|
updatedConfig.models[modelId].records = selectedRecords;
|
|
@@ -2326,14 +2326,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
2326
2326
|
},
|
|
2327
2327
|
async pull(locale, input2, initCtx) {
|
|
2328
2328
|
const result = {};
|
|
2329
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
2330
|
-
let records = _optionalChain([initCtx, 'optionalAccess',
|
|
2329
|
+
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _116 => _116.models]) || {})) {
|
|
2330
|
+
let records = _optionalChain([initCtx, 'optionalAccess', _117 => _117.models, 'access', _118 => _118[modelId], 'access', _119 => _119.records]) || [];
|
|
2331
2331
|
const recordIds = records.map((record) => record.id);
|
|
2332
2332
|
records = await dato.findRecords(recordIds);
|
|
2333
2333
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
2334
2334
|
if (records.length > 0) {
|
|
2335
2335
|
result[modelId] = {
|
|
2336
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
2336
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _120 => _120.models, 'optionalAccess', _121 => _121[modelId], 'optionalAccess', _122 => _122.fields]) || [],
|
|
2337
2337
|
records
|
|
2338
2338
|
};
|
|
2339
2339
|
}
|
|
@@ -2392,7 +2392,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
2392
2392
|
return records.map((record) => ({
|
|
2393
2393
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
2394
2394
|
value: record.id,
|
|
2395
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
2395
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _123 => _123.includes, 'call', _124 => _124(record.id)])
|
|
2396
2396
|
}));
|
|
2397
2397
|
}
|
|
2398
2398
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -2659,7 +2659,7 @@ var _nodewebvtt = require('node-webvtt'); var _nodewebvtt2 = _interopRequireDefa
|
|
|
2659
2659
|
function createVttLoader() {
|
|
2660
2660
|
return createLoader({
|
|
2661
2661
|
async pull(locale, input2) {
|
|
2662
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
2662
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _125 => _125.parse, 'call', _126 => _126(input2), 'optionalAccess', _127 => _127.cues]);
|
|
2663
2663
|
if (Object.keys(vtt).length === 0) {
|
|
2664
2664
|
return {};
|
|
2665
2665
|
} else {
|
|
@@ -2711,7 +2711,7 @@ function variableExtractLoader(params) {
|
|
|
2711
2711
|
for (let i = 0; i < matches.length; i++) {
|
|
2712
2712
|
const match = matches[i];
|
|
2713
2713
|
const currentValue = result[key].value;
|
|
2714
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
2714
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _128 => _128.replace, 'call', _129 => _129(match, `{variable:${i}}`)]);
|
|
2715
2715
|
result[key].value = newValue;
|
|
2716
2716
|
result[key].variables[i] = match;
|
|
2717
2717
|
}
|
|
@@ -2725,7 +2725,7 @@ function variableExtractLoader(params) {
|
|
|
2725
2725
|
for (let i = 0; i < valueObj.variables.length; i++) {
|
|
2726
2726
|
const variable = valueObj.variables[i];
|
|
2727
2727
|
const currentValue = result[key];
|
|
2728
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
2728
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _130 => _130.replace, 'call', _131 => _131(`{variable:${i}}`, variable)]);
|
|
2729
2729
|
result[key] = newValue;
|
|
2730
2730
|
}
|
|
2731
2731
|
}
|
|
@@ -2906,7 +2906,7 @@ function createVueJsonLoader() {
|
|
|
2906
2906
|
return createLoader({
|
|
2907
2907
|
pull: async (locale, input2, ctx) => {
|
|
2908
2908
|
const parsed = parseVueFile(input2);
|
|
2909
|
-
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess',
|
|
2909
|
+
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _132 => _132.i18n, 'optionalAccess', _133 => _133[locale]]), () => ( {}));
|
|
2910
2910
|
},
|
|
2911
2911
|
push: async (locale, data, originalInput) => {
|
|
2912
2912
|
const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
|
|
@@ -3277,11 +3277,11 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
3277
3277
|
const auth = await validateAuth(settings);
|
|
3278
3278
|
ora.succeed(`Authenticated as ${auth.email}`);
|
|
3279
3279
|
let buckets = getBuckets(i18nConfig);
|
|
3280
|
-
if (_optionalChain([flags, 'access',
|
|
3280
|
+
if (_optionalChain([flags, 'access', _134 => _134.bucket, 'optionalAccess', _135 => _135.length])) {
|
|
3281
3281
|
buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
|
|
3282
3282
|
}
|
|
3283
3283
|
ora.succeed("Buckets retrieved");
|
|
3284
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
3284
|
+
const targetLocales = _optionalChain([flags, 'access', _136 => _136.locale, 'optionalAccess', _137 => _137.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
3285
3285
|
const lockfileHelper = createLockfileHelper();
|
|
3286
3286
|
ora.start("Ensuring i18n.lock exists...");
|
|
3287
3287
|
if (!lockfileHelper.isLockfileExists()) {
|
|
@@ -3611,12 +3611,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
3611
3611
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
3612
3612
|
docUrl: "bucketNotFound"
|
|
3613
3613
|
});
|
|
3614
|
-
} else if (_optionalChain([flags, 'access',
|
|
3614
|
+
} else if (_optionalChain([flags, 'access', _138 => _138.locale, 'optionalAccess', _139 => _139.some, 'call', _140 => _140((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
3615
3615
|
throw new CLIError({
|
|
3616
3616
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
3617
3617
|
docUrl: "localeTargetNotFound"
|
|
3618
3618
|
});
|
|
3619
|
-
} else if (_optionalChain([flags, 'access',
|
|
3619
|
+
} else if (_optionalChain([flags, 'access', _141 => _141.bucket, 'optionalAccess', _142 => _142.some, 'call', _143 => _143((bucket) => !i18nConfig.buckets[bucket])])) {
|
|
3620
3620
|
throw new CLIError({
|
|
3621
3621
|
message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
|
|
3622
3622
|
docUrl: "bucketNotFound"
|
|
@@ -3896,7 +3896,7 @@ var mcp_default = new (0, _interactivecommander.Command)().command("mcp").descri
|
|
|
3896
3896
|
// package.json
|
|
3897
3897
|
var package_default = {
|
|
3898
3898
|
name: "lingo.dev",
|
|
3899
|
-
version: "0.78.
|
|
3899
|
+
version: "0.78.8",
|
|
3900
3900
|
description: "Lingo.dev CLI",
|
|
3901
3901
|
private: false,
|
|
3902
3902
|
publishConfig: {
|