lingo.dev 0.78.0 → 0.78.1
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 +27 -29
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +4 -6
- package/build/cli.mjs.map +1 -1
- package/package.json +3 -3
package/build/cli.cjs
CHANGED
|
@@ -1691,12 +1691,10 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
1691
1691
|
}
|
|
1692
1692
|
}
|
|
1693
1693
|
} else if (isSourceLanguage) {
|
|
1694
|
-
|
|
1695
|
-
if (hasOtherLocalizations) {
|
|
1696
|
-
resultData[translationKey] = translationKey;
|
|
1697
|
-
}
|
|
1694
|
+
resultData[translationKey] = translationKey;
|
|
1698
1695
|
}
|
|
1699
1696
|
}
|
|
1697
|
+
console.log(resultData);
|
|
1700
1698
|
return resultData;
|
|
1701
1699
|
},
|
|
1702
1700
|
async push(locale, payload, originalInput) {
|
|
@@ -1710,7 +1708,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
1710
1708
|
const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
|
|
1711
1709
|
if (typeof value === "string") {
|
|
1712
1710
|
langDataToMerge.strings[key] = {
|
|
1713
|
-
extractionState:
|
|
1711
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _70 => _70.strings, 'optionalAccess', _71 => _71[key], 'optionalAccess', _72 => _72.extractionState]),
|
|
1714
1712
|
localizations: {
|
|
1715
1713
|
[locale]: {
|
|
1716
1714
|
stringUnit: {
|
|
@@ -1850,7 +1848,7 @@ function createPoDataLoader(params) {
|
|
|
1850
1848
|
Object.entries(entries).forEach(([msgid, entry]) => {
|
|
1851
1849
|
if (msgid && entry.msgid) {
|
|
1852
1850
|
const context = entry.msgctxt || "";
|
|
1853
|
-
const fullEntry = _optionalChain([parsedPo, 'access',
|
|
1851
|
+
const fullEntry = _optionalChain([parsedPo, 'access', _73 => _73.translations, 'access', _74 => _74[context], 'optionalAccess', _75 => _75[msgid]]);
|
|
1854
1852
|
if (fullEntry) {
|
|
1855
1853
|
result[msgid] = fullEntry;
|
|
1856
1854
|
}
|
|
@@ -1860,7 +1858,7 @@ function createPoDataLoader(params) {
|
|
|
1860
1858
|
return result;
|
|
1861
1859
|
},
|
|
1862
1860
|
async push(locale, data, originalInput) {
|
|
1863
|
-
const sections = _optionalChain([originalInput, 'optionalAccess',
|
|
1861
|
+
const sections = _optionalChain([originalInput, 'optionalAccess', _76 => _76.split, 'call', _77 => _77("\n\n"), 'access', _78 => _78.filter, 'call', _79 => _79(Boolean)]) || [];
|
|
1864
1862
|
const result = sections.map((section) => {
|
|
1865
1863
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
1866
1864
|
const contextKey = _lodash2.default.keys(sectionPo.translations)[0];
|
|
@@ -1902,7 +1900,7 @@ function createPoContentLoader() {
|
|
|
1902
1900
|
entry.msgid,
|
|
1903
1901
|
{
|
|
1904
1902
|
...entry,
|
|
1905
|
-
msgstr: [_optionalChain([data, 'access',
|
|
1903
|
+
msgstr: [_optionalChain([data, 'access', _80 => _80[entry.msgid], 'optionalAccess', _81 => _81.singular]), _optionalChain([data, 'access', _82 => _82[entry.msgid], 'optionalAccess', _83 => _83.plural]) || null].filter(Boolean)
|
|
1906
1904
|
}
|
|
1907
1905
|
]).fromPairs().value();
|
|
1908
1906
|
return result;
|
|
@@ -2148,7 +2146,7 @@ function createDatoClient(params) {
|
|
|
2148
2146
|
only_valid: "true",
|
|
2149
2147
|
ids: !records.length ? void 0 : records.join(",")
|
|
2150
2148
|
}
|
|
2151
|
-
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2149
|
+
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _84 => _84.response, 'optionalAccess', _85 => _85.body, 'optionalAccess', _86 => _86.data, 'optionalAccess', _87 => _87[0]]) || error));
|
|
2152
2150
|
},
|
|
2153
2151
|
findRecordsForModel: async (modelId, records) => {
|
|
2154
2152
|
try {
|
|
@@ -2158,9 +2156,9 @@ function createDatoClient(params) {
|
|
|
2158
2156
|
filter: {
|
|
2159
2157
|
type: modelId,
|
|
2160
2158
|
only_valid: "true",
|
|
2161
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
2159
|
+
ids: !_optionalChain([records, 'optionalAccess', _88 => _88.length]) ? void 0 : records.join(",")
|
|
2162
2160
|
}
|
|
2163
|
-
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2161
|
+
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _89 => _89.response, 'optionalAccess', _90 => _90.body, 'optionalAccess', _91 => _91.data, 'optionalAccess', _92 => _92[0]]) || error));
|
|
2164
2162
|
return result;
|
|
2165
2163
|
} catch (_error) {
|
|
2166
2164
|
throw new Error(
|
|
@@ -2174,9 +2172,9 @@ function createDatoClient(params) {
|
|
|
2174
2172
|
},
|
|
2175
2173
|
updateRecord: async (id, payload) => {
|
|
2176
2174
|
try {
|
|
2177
|
-
await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2175
|
+
await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _93 => _93.response, 'optionalAccess', _94 => _94.body, 'optionalAccess', _95 => _95.data, 'optionalAccess', _96 => _96[0]]) || error));
|
|
2178
2176
|
} catch (_error) {
|
|
2179
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2177
|
+
if (_optionalChain([_error, 'optionalAccess', _97 => _97.attributes, 'optionalAccess', _98 => _98.details, 'optionalAccess', _99 => _99.message])) {
|
|
2180
2178
|
throw new Error(
|
|
2181
2179
|
[
|
|
2182
2180
|
`${_error.attributes.details.message}`,
|
|
@@ -2197,9 +2195,9 @@ function createDatoClient(params) {
|
|
|
2197
2195
|
},
|
|
2198
2196
|
enableFieldLocalization: async (args) => {
|
|
2199
2197
|
try {
|
|
2200
|
-
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2198
|
+
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _100 => _100.response, 'optionalAccess', _101 => _101.body, 'optionalAccess', _102 => _102.data, 'optionalAccess', _103 => _103[0]]) || error));
|
|
2201
2199
|
} catch (_error) {
|
|
2202
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2200
|
+
if (_optionalChain([_error, 'optionalAccess', _104 => _104.attributes, 'optionalAccess', _105 => _105.code]) === "NOT_FOUND") {
|
|
2203
2201
|
throw new Error(
|
|
2204
2202
|
[
|
|
2205
2203
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -2207,7 +2205,7 @@ function createDatoClient(params) {
|
|
|
2207
2205
|
].join("\n\n")
|
|
2208
2206
|
);
|
|
2209
2207
|
}
|
|
2210
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2208
|
+
if (_optionalChain([_error, 'optionalAccess', _106 => _106.attributes, 'optionalAccess', _107 => _107.details, 'optionalAccess', _108 => _108.message])) {
|
|
2211
2209
|
throw new Error(
|
|
2212
2210
|
[`${_error.attributes.details.message}`, `Error: ${JSON.stringify(_error, null, 2)}`].join("\n\n")
|
|
2213
2211
|
);
|
|
@@ -2273,7 +2271,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
2273
2271
|
}
|
|
2274
2272
|
}
|
|
2275
2273
|
const records = await dato.findRecordsForModel(modelId);
|
|
2276
|
-
const recordChoices = createRecordChoices(records, _optionalChain([config, 'access',
|
|
2274
|
+
const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _109 => _109.models, 'access', _110 => _110[modelId], 'optionalAccess', _111 => _111.records]) || [], project);
|
|
2277
2275
|
const selectedRecords = await promptRecordSelection(modelName, recordChoices);
|
|
2278
2276
|
result.models[modelId].records = records.filter((record) => selectedRecords.includes(record.id));
|
|
2279
2277
|
updatedConfig.models[modelId].records = selectedRecords;
|
|
@@ -2285,14 +2283,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
2285
2283
|
},
|
|
2286
2284
|
async pull(locale, input2, initCtx) {
|
|
2287
2285
|
const result = {};
|
|
2288
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
2289
|
-
let records = _optionalChain([initCtx, 'optionalAccess',
|
|
2286
|
+
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _112 => _112.models]) || {})) {
|
|
2287
|
+
let records = _optionalChain([initCtx, 'optionalAccess', _113 => _113.models, 'access', _114 => _114[modelId], 'access', _115 => _115.records]) || [];
|
|
2290
2288
|
const recordIds = records.map((record) => record.id);
|
|
2291
2289
|
records = await dato.findRecords(recordIds);
|
|
2292
2290
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
2293
2291
|
if (records.length > 0) {
|
|
2294
2292
|
result[modelId] = {
|
|
2295
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
2293
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _116 => _116.models, 'optionalAccess', _117 => _117[modelId], 'optionalAccess', _118 => _118.fields]) || [],
|
|
2296
2294
|
records
|
|
2297
2295
|
};
|
|
2298
2296
|
}
|
|
@@ -2351,7 +2349,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
2351
2349
|
return records.map((record) => ({
|
|
2352
2350
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
2353
2351
|
value: record.id,
|
|
2354
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
2352
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _119 => _119.includes, 'call', _120 => _120(record.id)])
|
|
2355
2353
|
}));
|
|
2356
2354
|
}
|
|
2357
2355
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -2618,7 +2616,7 @@ var _nodewebvtt = require('node-webvtt'); var _nodewebvtt2 = _interopRequireDefa
|
|
|
2618
2616
|
function createVttLoader() {
|
|
2619
2617
|
return createLoader({
|
|
2620
2618
|
async pull(locale, input2) {
|
|
2621
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
2619
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _121 => _121.parse, 'call', _122 => _122(input2), 'optionalAccess', _123 => _123.cues]);
|
|
2622
2620
|
if (Object.keys(vtt).length === 0) {
|
|
2623
2621
|
return {};
|
|
2624
2622
|
} else {
|
|
@@ -2670,7 +2668,7 @@ function variableExtractLoader(params) {
|
|
|
2670
2668
|
for (let i = 0; i < matches.length; i++) {
|
|
2671
2669
|
const match = matches[i];
|
|
2672
2670
|
const currentValue = result[key].value;
|
|
2673
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
2671
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _124 => _124.replace, 'call', _125 => _125(match, `{variable:${i}}`)]);
|
|
2674
2672
|
result[key].value = newValue;
|
|
2675
2673
|
result[key].variables[i] = match;
|
|
2676
2674
|
}
|
|
@@ -2684,7 +2682,7 @@ function variableExtractLoader(params) {
|
|
|
2684
2682
|
for (let i = 0; i < valueObj.variables.length; i++) {
|
|
2685
2683
|
const variable = valueObj.variables[i];
|
|
2686
2684
|
const currentValue = result[key];
|
|
2687
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
2685
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _126 => _126.replace, 'call', _127 => _127(`{variable:${i}}`, variable)]);
|
|
2688
2686
|
result[key] = newValue;
|
|
2689
2687
|
}
|
|
2690
2688
|
}
|
|
@@ -3193,11 +3191,11 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
3193
3191
|
const auth = await validateAuth(settings);
|
|
3194
3192
|
ora.succeed(`Authenticated as ${auth.email}`);
|
|
3195
3193
|
let buckets = getBuckets(i18nConfig);
|
|
3196
|
-
if (_optionalChain([flags, 'access',
|
|
3194
|
+
if (_optionalChain([flags, 'access', _128 => _128.bucket, 'optionalAccess', _129 => _129.length])) {
|
|
3197
3195
|
buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
|
|
3198
3196
|
}
|
|
3199
3197
|
ora.succeed("Buckets retrieved");
|
|
3200
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
3198
|
+
const targetLocales = _optionalChain([flags, 'access', _130 => _130.locale, 'optionalAccess', _131 => _131.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
3201
3199
|
const lockfileHelper = createLockfileHelper();
|
|
3202
3200
|
ora.start("Ensuring i18n.lock exists...");
|
|
3203
3201
|
if (!lockfileHelper.isLockfileExists()) {
|
|
@@ -3499,12 +3497,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
3499
3497
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
3500
3498
|
docUrl: "bucketNotFound"
|
|
3501
3499
|
});
|
|
3502
|
-
} else if (_optionalChain([flags, 'access',
|
|
3500
|
+
} else if (_optionalChain([flags, 'access', _132 => _132.locale, 'optionalAccess', _133 => _133.some, 'call', _134 => _134((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
3503
3501
|
throw new CLIError({
|
|
3504
3502
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
3505
3503
|
docUrl: "localeTargetNotFound"
|
|
3506
3504
|
});
|
|
3507
|
-
} else if (_optionalChain([flags, 'access',
|
|
3505
|
+
} else if (_optionalChain([flags, 'access', _135 => _135.bucket, 'optionalAccess', _136 => _136.some, 'call', _137 => _137((bucket) => !i18nConfig.buckets[bucket])])) {
|
|
3508
3506
|
throw new CLIError({
|
|
3509
3507
|
message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
|
|
3510
3508
|
docUrl: "bucketNotFound"
|
|
@@ -3784,7 +3782,7 @@ var mcp_default = new (0, _interactivecommander.Command)().command("mcp").descri
|
|
|
3784
3782
|
// package.json
|
|
3785
3783
|
var package_default = {
|
|
3786
3784
|
name: "lingo.dev",
|
|
3787
|
-
version: "0.78.
|
|
3785
|
+
version: "0.78.1",
|
|
3788
3786
|
description: "Lingo.dev CLI",
|
|
3789
3787
|
private: false,
|
|
3790
3788
|
publishConfig: {
|