lingo.dev 0.78.7 → 0.78.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 +59 -56
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +35 -32
- package/build/cli.mjs.map +1 -1
- package/package.json +1 -1
package/build/cli.cjs
CHANGED
|
@@ -602,9 +602,9 @@ function makeGitlabInitializer(spinner) {
|
|
|
602
602
|
|
|
603
603
|
// src/cli/cmd/init.ts
|
|
604
604
|
|
|
605
|
-
var openUrl = (
|
|
605
|
+
var openUrl = (path14) => {
|
|
606
606
|
const settings = getSettings(void 0);
|
|
607
|
-
_open2.default.call(void 0, `${settings.auth.webUrl}${
|
|
607
|
+
_open2.default.call(void 0, `${settings.auth.webUrl}${path14}`, { wait: false });
|
|
608
608
|
};
|
|
609
609
|
var throwHelpError = (option, value) => {
|
|
610
610
|
if (value === "help") {
|
|
@@ -944,8 +944,8 @@ var files_default = new (0, _interactivecommander.Command)().command("files").de
|
|
|
944
944
|
} else if (type.target) {
|
|
945
945
|
result.push(...targetPaths);
|
|
946
946
|
}
|
|
947
|
-
result.forEach((
|
|
948
|
-
console.log(
|
|
947
|
+
result.forEach((path14) => {
|
|
948
|
+
console.log(path14);
|
|
949
949
|
});
|
|
950
950
|
}
|
|
951
951
|
}
|
|
@@ -1513,9 +1513,9 @@ function createHtmlLoader() {
|
|
|
1513
1513
|
const bDepth = b.split("/").length;
|
|
1514
1514
|
return aDepth - bDepth;
|
|
1515
1515
|
});
|
|
1516
|
-
paths.forEach((
|
|
1517
|
-
const value = data[
|
|
1518
|
-
const [nodePath, attribute] =
|
|
1516
|
+
paths.forEach((path14) => {
|
|
1517
|
+
const value = data[path14];
|
|
1518
|
+
const [nodePath, attribute] = path14.split("#");
|
|
1519
1519
|
const [rootTag, ...indices] = nodePath.split("/");
|
|
1520
1520
|
let parent = rootTag === "head" ? document.head : document.body;
|
|
1521
1521
|
let current = parent;
|
|
@@ -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: {
|
|
@@ -1793,6 +1793,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
1793
1793
|
}
|
|
1794
1794
|
|
|
1795
1795
|
// src/cli/loaders/prettier.ts
|
|
1796
|
+
|
|
1796
1797
|
var _prettier = require('prettier'); var _prettier2 = _interopRequireDefault(_prettier);
|
|
1797
1798
|
function createPrettierLoader(options) {
|
|
1798
1799
|
return createLoader({
|
|
@@ -1800,8 +1801,10 @@ function createPrettierLoader(options) {
|
|
|
1800
1801
|
return data;
|
|
1801
1802
|
},
|
|
1802
1803
|
async push(locale, data) {
|
|
1803
|
-
const
|
|
1804
|
-
|
|
1804
|
+
const draftPath = options.bucketPathPattern.replaceAll("[locale]", locale);
|
|
1805
|
+
const finalPath = _path2.default.resolve(draftPath);
|
|
1806
|
+
const prettierConfig = await loadPrettierConfig(finalPath);
|
|
1807
|
+
if (!prettierConfig) {
|
|
1805
1808
|
return data;
|
|
1806
1809
|
}
|
|
1807
1810
|
const result = _prettier2.default.format(data, {
|
|
@@ -1818,9 +1821,9 @@ function createPrettierLoader(options) {
|
|
|
1818
1821
|
}
|
|
1819
1822
|
});
|
|
1820
1823
|
}
|
|
1821
|
-
async function loadPrettierConfig() {
|
|
1824
|
+
async function loadPrettierConfig(filePath) {
|
|
1822
1825
|
try {
|
|
1823
|
-
const config = await _prettier2.default.resolveConfig(
|
|
1826
|
+
const config = await _prettier2.default.resolveConfig(filePath);
|
|
1824
1827
|
return config;
|
|
1825
1828
|
} catch (error) {
|
|
1826
1829
|
return {};
|
|
@@ -1891,7 +1894,7 @@ function createPoDataLoader(params) {
|
|
|
1891
1894
|
Object.entries(entries).forEach(([msgid, entry]) => {
|
|
1892
1895
|
if (msgid && entry.msgid) {
|
|
1893
1896
|
const context = entry.msgctxt || "";
|
|
1894
|
-
const fullEntry = _optionalChain([parsedPo, 'access',
|
|
1897
|
+
const fullEntry = _optionalChain([parsedPo, 'access', _77 => _77.translations, 'access', _78 => _78[context], 'optionalAccess', _79 => _79[msgid]]);
|
|
1895
1898
|
if (fullEntry) {
|
|
1896
1899
|
result[msgid] = fullEntry;
|
|
1897
1900
|
}
|
|
@@ -1901,7 +1904,7 @@ function createPoDataLoader(params) {
|
|
|
1901
1904
|
return result;
|
|
1902
1905
|
},
|
|
1903
1906
|
async push(locale, data, originalInput) {
|
|
1904
|
-
const sections = _optionalChain([originalInput, 'optionalAccess',
|
|
1907
|
+
const sections = _optionalChain([originalInput, 'optionalAccess', _80 => _80.split, 'call', _81 => _81("\n\n"), 'access', _82 => _82.filter, 'call', _83 => _83(Boolean)]) || [];
|
|
1905
1908
|
const result = sections.map((section) => {
|
|
1906
1909
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
1907
1910
|
const contextKey = _lodash2.default.keys(sectionPo.translations)[0];
|
|
@@ -1943,7 +1946,7 @@ function createPoContentLoader() {
|
|
|
1943
1946
|
entry.msgid,
|
|
1944
1947
|
{
|
|
1945
1948
|
...entry,
|
|
1946
|
-
msgstr: [_optionalChain([data, 'access',
|
|
1949
|
+
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
1950
|
}
|
|
1948
1951
|
]).fromPairs().value();
|
|
1949
1952
|
return result;
|
|
@@ -2189,7 +2192,7 @@ function createDatoClient(params) {
|
|
|
2189
2192
|
only_valid: "true",
|
|
2190
2193
|
ids: !records.length ? void 0 : records.join(",")
|
|
2191
2194
|
}
|
|
2192
|
-
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2195
|
+
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _88 => _88.response, 'optionalAccess', _89 => _89.body, 'optionalAccess', _90 => _90.data, 'optionalAccess', _91 => _91[0]]) || error));
|
|
2193
2196
|
},
|
|
2194
2197
|
findRecordsForModel: async (modelId, records) => {
|
|
2195
2198
|
try {
|
|
@@ -2199,9 +2202,9 @@ function createDatoClient(params) {
|
|
|
2199
2202
|
filter: {
|
|
2200
2203
|
type: modelId,
|
|
2201
2204
|
only_valid: "true",
|
|
2202
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
2205
|
+
ids: !_optionalChain([records, 'optionalAccess', _92 => _92.length]) ? void 0 : records.join(",")
|
|
2203
2206
|
}
|
|
2204
|
-
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2207
|
+
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _93 => _93.response, 'optionalAccess', _94 => _94.body, 'optionalAccess', _95 => _95.data, 'optionalAccess', _96 => _96[0]]) || error));
|
|
2205
2208
|
return result;
|
|
2206
2209
|
} catch (_error) {
|
|
2207
2210
|
throw new Error(
|
|
@@ -2215,9 +2218,9 @@ function createDatoClient(params) {
|
|
|
2215
2218
|
},
|
|
2216
2219
|
updateRecord: async (id, payload) => {
|
|
2217
2220
|
try {
|
|
2218
|
-
await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2221
|
+
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
2222
|
} catch (_error) {
|
|
2220
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2223
|
+
if (_optionalChain([_error, 'optionalAccess', _101 => _101.attributes, 'optionalAccess', _102 => _102.details, 'optionalAccess', _103 => _103.message])) {
|
|
2221
2224
|
throw new Error(
|
|
2222
2225
|
[
|
|
2223
2226
|
`${_error.attributes.details.message}`,
|
|
@@ -2238,9 +2241,9 @@ function createDatoClient(params) {
|
|
|
2238
2241
|
},
|
|
2239
2242
|
enableFieldLocalization: async (args) => {
|
|
2240
2243
|
try {
|
|
2241
|
-
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2244
|
+
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
2245
|
} catch (_error) {
|
|
2243
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2246
|
+
if (_optionalChain([_error, 'optionalAccess', _108 => _108.attributes, 'optionalAccess', _109 => _109.code]) === "NOT_FOUND") {
|
|
2244
2247
|
throw new Error(
|
|
2245
2248
|
[
|
|
2246
2249
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -2248,7 +2251,7 @@ function createDatoClient(params) {
|
|
|
2248
2251
|
].join("\n\n")
|
|
2249
2252
|
);
|
|
2250
2253
|
}
|
|
2251
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2254
|
+
if (_optionalChain([_error, 'optionalAccess', _110 => _110.attributes, 'optionalAccess', _111 => _111.details, 'optionalAccess', _112 => _112.message])) {
|
|
2252
2255
|
throw new Error(
|
|
2253
2256
|
[`${_error.attributes.details.message}`, `Error: ${JSON.stringify(_error, null, 2)}`].join("\n\n")
|
|
2254
2257
|
);
|
|
@@ -2314,7 +2317,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
2314
2317
|
}
|
|
2315
2318
|
}
|
|
2316
2319
|
const records = await dato.findRecordsForModel(modelId);
|
|
2317
|
-
const recordChoices = createRecordChoices(records, _optionalChain([config, 'access',
|
|
2320
|
+
const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _113 => _113.models, 'access', _114 => _114[modelId], 'optionalAccess', _115 => _115.records]) || [], project);
|
|
2318
2321
|
const selectedRecords = await promptRecordSelection(modelName, recordChoices);
|
|
2319
2322
|
result.models[modelId].records = records.filter((record) => selectedRecords.includes(record.id));
|
|
2320
2323
|
updatedConfig.models[modelId].records = selectedRecords;
|
|
@@ -2326,14 +2329,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
2326
2329
|
},
|
|
2327
2330
|
async pull(locale, input2, initCtx) {
|
|
2328
2331
|
const result = {};
|
|
2329
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
2330
|
-
let records = _optionalChain([initCtx, 'optionalAccess',
|
|
2332
|
+
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _116 => _116.models]) || {})) {
|
|
2333
|
+
let records = _optionalChain([initCtx, 'optionalAccess', _117 => _117.models, 'access', _118 => _118[modelId], 'access', _119 => _119.records]) || [];
|
|
2331
2334
|
const recordIds = records.map((record) => record.id);
|
|
2332
2335
|
records = await dato.findRecords(recordIds);
|
|
2333
2336
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
2334
2337
|
if (records.length > 0) {
|
|
2335
2338
|
result[modelId] = {
|
|
2336
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
2339
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _120 => _120.models, 'optionalAccess', _121 => _121[modelId], 'optionalAccess', _122 => _122.fields]) || [],
|
|
2337
2340
|
records
|
|
2338
2341
|
};
|
|
2339
2342
|
}
|
|
@@ -2392,7 +2395,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
2392
2395
|
return records.map((record) => ({
|
|
2393
2396
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
2394
2397
|
value: record.id,
|
|
2395
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
2398
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _123 => _123.includes, 'call', _124 => _124(record.id)])
|
|
2396
2399
|
}));
|
|
2397
2400
|
}
|
|
2398
2401
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -2543,18 +2546,18 @@ function createRawDatoValue(parsedDatoValue, originalRawDatoValue, isClean = fal
|
|
|
2543
2546
|
}
|
|
2544
2547
|
function serializeStructuredText(rawStructuredText) {
|
|
2545
2548
|
return serializeStructuredTextNode(rawStructuredText);
|
|
2546
|
-
function serializeStructuredTextNode(node,
|
|
2549
|
+
function serializeStructuredTextNode(node, path14 = [], acc = {}) {
|
|
2547
2550
|
if ("document" in node) {
|
|
2548
|
-
return serializeStructuredTextNode(node.document, [...
|
|
2551
|
+
return serializeStructuredTextNode(node.document, [...path14, "document"], acc);
|
|
2549
2552
|
}
|
|
2550
2553
|
if (!_lodash2.default.isNil(node.value)) {
|
|
2551
|
-
acc[[...
|
|
2554
|
+
acc[[...path14, "value"].join(".")] = node.value;
|
|
2552
2555
|
} else if (_lodash2.default.get(node, "type") === "block") {
|
|
2553
|
-
acc[[...
|
|
2556
|
+
acc[[...path14, "item"].join(".")] = serializeBlock(node.item);
|
|
2554
2557
|
}
|
|
2555
2558
|
if (node.children) {
|
|
2556
2559
|
for (let i = 0; i < node.children.length; i++) {
|
|
2557
|
-
serializeStructuredTextNode(node.children[i], [...
|
|
2560
|
+
serializeStructuredTextNode(node.children[i], [...path14, i.toString()], acc);
|
|
2558
2561
|
}
|
|
2559
2562
|
}
|
|
2560
2563
|
return acc;
|
|
@@ -2613,8 +2616,8 @@ function deserializeBlockList(parsedBlockList, originalRawBlockList, isClean = f
|
|
|
2613
2616
|
}
|
|
2614
2617
|
function deserializeStructuredText(parsedStructuredText, originalRawStructuredText) {
|
|
2615
2618
|
const result = _lodash2.default.cloneDeep(originalRawStructuredText);
|
|
2616
|
-
for (const [
|
|
2617
|
-
const realPath = _lodash2.default.chain(
|
|
2619
|
+
for (const [path14, value] of _lodash2.default.entries(parsedStructuredText)) {
|
|
2620
|
+
const realPath = _lodash2.default.chain(path14.split(".")).flatMap((s) => !_lodash2.default.isNaN(_lodash2.default.toNumber(s)) ? ["children", s] : s).value();
|
|
2618
2621
|
const deserializedValue = createRawDatoValue(value, _lodash2.default.get(originalRawStructuredText, realPath), true);
|
|
2619
2622
|
_lodash2.default.set(result, realPath, deserializedValue);
|
|
2620
2623
|
}
|
|
@@ -2659,7 +2662,7 @@ var _nodewebvtt = require('node-webvtt'); var _nodewebvtt2 = _interopRequireDefa
|
|
|
2659
2662
|
function createVttLoader() {
|
|
2660
2663
|
return createLoader({
|
|
2661
2664
|
async pull(locale, input2) {
|
|
2662
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
2665
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _125 => _125.parse, 'call', _126 => _126(input2), 'optionalAccess', _127 => _127.cues]);
|
|
2663
2666
|
if (Object.keys(vtt).length === 0) {
|
|
2664
2667
|
return {};
|
|
2665
2668
|
} else {
|
|
@@ -2711,7 +2714,7 @@ function variableExtractLoader(params) {
|
|
|
2711
2714
|
for (let i = 0; i < matches.length; i++) {
|
|
2712
2715
|
const match = matches[i];
|
|
2713
2716
|
const currentValue = result[key].value;
|
|
2714
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
2717
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _128 => _128.replace, 'call', _129 => _129(match, `{variable:${i}}`)]);
|
|
2715
2718
|
result[key].value = newValue;
|
|
2716
2719
|
result[key].variables[i] = match;
|
|
2717
2720
|
}
|
|
@@ -2725,7 +2728,7 @@ function variableExtractLoader(params) {
|
|
|
2725
2728
|
for (let i = 0; i < valueObj.variables.length; i++) {
|
|
2726
2729
|
const variable = valueObj.variables[i];
|
|
2727
2730
|
const currentValue = result[key];
|
|
2728
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
2731
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _130 => _130.replace, 'call', _131 => _131(`{variable:${i}}`, variable)]);
|
|
2729
2732
|
result[key] = newValue;
|
|
2730
2733
|
}
|
|
2731
2734
|
}
|
|
@@ -2906,7 +2909,7 @@ function createVueJsonLoader() {
|
|
|
2906
2909
|
return createLoader({
|
|
2907
2910
|
pull: async (locale, input2, ctx) => {
|
|
2908
2911
|
const parsed = parseVueFile(input2);
|
|
2909
|
-
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess',
|
|
2912
|
+
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _132 => _132.i18n, 'optionalAccess', _133 => _133[locale]]), () => ( {}));
|
|
2910
2913
|
},
|
|
2911
2914
|
push: async (locale, data, originalInput) => {
|
|
2912
2915
|
const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
|
|
@@ -2959,7 +2962,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options) {
|
|
|
2959
2962
|
case "html":
|
|
2960
2963
|
return composeLoaders(
|
|
2961
2964
|
createTextFileLoader(bucketPathPattern),
|
|
2962
|
-
createPrettierLoader({ parser: "html",
|
|
2965
|
+
createPrettierLoader({ parser: "html", bucketPathPattern }),
|
|
2963
2966
|
createHtmlLoader(),
|
|
2964
2967
|
createSyncLoader(),
|
|
2965
2968
|
createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
|
|
@@ -2967,7 +2970,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options) {
|
|
|
2967
2970
|
case "json":
|
|
2968
2971
|
return composeLoaders(
|
|
2969
2972
|
createTextFileLoader(bucketPathPattern),
|
|
2970
|
-
createPrettierLoader({ parser: "json" }),
|
|
2973
|
+
createPrettierLoader({ parser: "json", bucketPathPattern }),
|
|
2971
2974
|
createJsonLoader(),
|
|
2972
2975
|
createFlatLoader(),
|
|
2973
2976
|
createSyncLoader(),
|
|
@@ -2976,7 +2979,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options) {
|
|
|
2976
2979
|
case "markdown":
|
|
2977
2980
|
return composeLoaders(
|
|
2978
2981
|
createTextFileLoader(bucketPathPattern),
|
|
2979
|
-
createPrettierLoader({ parser: "markdown" }),
|
|
2982
|
+
createPrettierLoader({ parser: "markdown", bucketPathPattern }),
|
|
2980
2983
|
createMarkdownLoader(),
|
|
2981
2984
|
createSyncLoader(),
|
|
2982
2985
|
createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
|
|
@@ -3026,7 +3029,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options) {
|
|
|
3026
3029
|
case "yaml":
|
|
3027
3030
|
return composeLoaders(
|
|
3028
3031
|
createTextFileLoader(bucketPathPattern),
|
|
3029
|
-
createPrettierLoader({ parser: "yaml" }),
|
|
3032
|
+
createPrettierLoader({ parser: "yaml", bucketPathPattern }),
|
|
3030
3033
|
createYamlLoader(),
|
|
3031
3034
|
createFlatLoader(),
|
|
3032
3035
|
createSyncLoader(),
|
|
@@ -3035,7 +3038,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options) {
|
|
|
3035
3038
|
case "yaml-root-key":
|
|
3036
3039
|
return composeLoaders(
|
|
3037
3040
|
createTextFileLoader(bucketPathPattern),
|
|
3038
|
-
createPrettierLoader({ parser: "yaml" }),
|
|
3041
|
+
createPrettierLoader({ parser: "yaml", bucketPathPattern }),
|
|
3039
3042
|
createYamlLoader(),
|
|
3040
3043
|
createRootKeyLoader(true),
|
|
3041
3044
|
createFlatLoader(),
|
|
@@ -3045,7 +3048,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options) {
|
|
|
3045
3048
|
case "flutter":
|
|
3046
3049
|
return composeLoaders(
|
|
3047
3050
|
createTextFileLoader(bucketPathPattern),
|
|
3048
|
-
createPrettierLoader({ parser: "json" }),
|
|
3051
|
+
createPrettierLoader({ parser: "json", bucketPathPattern }),
|
|
3049
3052
|
createJsonLoader(),
|
|
3050
3053
|
createFlutterLoader(),
|
|
3051
3054
|
createFlatLoader(),
|
|
@@ -3277,11 +3280,11 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
3277
3280
|
const auth = await validateAuth(settings);
|
|
3278
3281
|
ora.succeed(`Authenticated as ${auth.email}`);
|
|
3279
3282
|
let buckets = getBuckets(i18nConfig);
|
|
3280
|
-
if (_optionalChain([flags, 'access',
|
|
3283
|
+
if (_optionalChain([flags, 'access', _134 => _134.bucket, 'optionalAccess', _135 => _135.length])) {
|
|
3281
3284
|
buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
|
|
3282
3285
|
}
|
|
3283
3286
|
ora.succeed("Buckets retrieved");
|
|
3284
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
3287
|
+
const targetLocales = _optionalChain([flags, 'access', _136 => _136.locale, 'optionalAccess', _137 => _137.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
3285
3288
|
const lockfileHelper = createLockfileHelper();
|
|
3286
3289
|
ora.start("Ensuring i18n.lock exists...");
|
|
3287
3290
|
if (!lockfileHelper.isLockfileExists()) {
|
|
@@ -3611,12 +3614,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
3611
3614
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
3612
3615
|
docUrl: "bucketNotFound"
|
|
3613
3616
|
});
|
|
3614
|
-
} else if (_optionalChain([flags, 'access',
|
|
3617
|
+
} else if (_optionalChain([flags, 'access', _138 => _138.locale, 'optionalAccess', _139 => _139.some, 'call', _140 => _140((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
3615
3618
|
throw new CLIError({
|
|
3616
3619
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
3617
3620
|
docUrl: "localeTargetNotFound"
|
|
3618
3621
|
});
|
|
3619
|
-
} else if (_optionalChain([flags, 'access',
|
|
3622
|
+
} else if (_optionalChain([flags, 'access', _141 => _141.bucket, 'optionalAccess', _142 => _142.some, 'call', _143 => _143((bucket) => !i18nConfig.buckets[bucket])])) {
|
|
3620
3623
|
throw new CLIError({
|
|
3621
3624
|
message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
|
|
3622
3625
|
docUrl: "bucketNotFound"
|
|
@@ -3896,7 +3899,7 @@ var mcp_default = new (0, _interactivecommander.Command)().command("mcp").descri
|
|
|
3896
3899
|
// package.json
|
|
3897
3900
|
var package_default = {
|
|
3898
3901
|
name: "lingo.dev",
|
|
3899
|
-
version: "0.78.
|
|
3902
|
+
version: "0.78.9",
|
|
3900
3903
|
description: "Lingo.dev CLI",
|
|
3901
3904
|
private: false,
|
|
3902
3905
|
publishConfig: {
|