lingo.dev 0.75.0 → 0.75.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 +65 -56
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +24 -15
- package/build/cli.mjs.map +1 -1
- package/package.json +1 -1
package/build/cli.cjs
CHANGED
|
@@ -303,24 +303,31 @@ function findLocaleFilesWithExtension(ext) {
|
|
|
303
303
|
const files = _glob.glob.sync(`**/*${ext}`, {
|
|
304
304
|
ignore: ["node_modules/**", "package*.json", "i18n.json", "lingo.json"]
|
|
305
305
|
});
|
|
306
|
-
const localeFilePattern = new RegExp(
|
|
307
|
-
const localeDirectoryPattern = new RegExp(
|
|
306
|
+
const localeFilePattern = new RegExp(`/([a-z]{2}(-[A-Z]{2})?)${ext}$`);
|
|
307
|
+
const localeDirectoryPattern = new RegExp(`/([a-z]{2}(-[A-Z]{2})?)/[^/]+${ext}$`);
|
|
308
308
|
const potentialLocaleFiles = files.filter(
|
|
309
309
|
(file) => localeFilePattern.test(file) || localeDirectoryPattern.test(file)
|
|
310
310
|
);
|
|
311
|
-
const
|
|
312
|
-
const
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
const
|
|
316
|
-
return { file,
|
|
317
|
-
}).
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
311
|
+
const potantialLocaleFilesAndPatterns = potentialLocaleFiles.map((file) => {
|
|
312
|
+
const matchPotentialLocales = Array.from(
|
|
313
|
+
file.matchAll(new RegExp(`/([a-z]{2}(-[A-Z]{2})?|[^/]+)(?=/|${ext})`, "g"))
|
|
314
|
+
);
|
|
315
|
+
const potantialLocales = matchPotentialLocales.map((match) => match[1]);
|
|
316
|
+
return { file, potantialLocales };
|
|
317
|
+
}).map(({ file, potantialLocales }) => {
|
|
318
|
+
for (const locale of potantialLocales) {
|
|
319
|
+
try {
|
|
320
|
+
__spec.resolveLocaleCode.call(void 0, locale);
|
|
321
|
+
return { locale, file };
|
|
322
|
+
} catch (e) {
|
|
323
|
+
}
|
|
322
324
|
}
|
|
323
|
-
return
|
|
325
|
+
return { file, locale: null };
|
|
326
|
+
}).filter(({ locale }) => locale !== null);
|
|
327
|
+
const localeFilesAndPatterns = potantialLocaleFilesAndPatterns.map(({ file, locale }) => {
|
|
328
|
+
const localeInDir = file.match(`/${locale}/`);
|
|
329
|
+
const pattern = localeInDir ? file.replace(`/${locale}/`, `/[locale]/`) : _path2.default.join(_path2.default.dirname(file), `[locale]${ext}`);
|
|
330
|
+
return { pattern, file };
|
|
324
331
|
});
|
|
325
332
|
const grouppedFilesAndPatterns = _lodash2.default.groupBy(localeFilesAndPatterns, "pattern");
|
|
326
333
|
const patterns = Object.keys(grouppedFilesAndPatterns);
|
|
@@ -519,6 +526,8 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
|
|
|
519
526
|
});
|
|
520
527
|
} else {
|
|
521
528
|
spinner.succeed("No existing locale files found.");
|
|
529
|
+
}
|
|
530
|
+
if (selectedPatterns.length === 0) {
|
|
522
531
|
const useDefault = await _prompts.confirm.call(void 0, {
|
|
523
532
|
message: `Use (and create) default path ${patterns.join(", ")}?`
|
|
524
533
|
});
|
|
@@ -567,7 +576,7 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
|
|
|
567
576
|
});
|
|
568
577
|
const auth2 = await newAuthenticator.whoami();
|
|
569
578
|
if (auth2) {
|
|
570
|
-
_ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess',
|
|
579
|
+
_ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _29 => _29.email])}`);
|
|
571
580
|
} else {
|
|
572
581
|
_ora2.default.call(void 0, ).fail("Authentication failed.");
|
|
573
582
|
}
|
|
@@ -646,7 +655,7 @@ var locale_default = new (0, _interactivecommander.Command)().command("locale").
|
|
|
646
655
|
function getBuckets(i18nConfig) {
|
|
647
656
|
const result = Object.entries(i18nConfig.buckets).map(([bucketType, bucketEntry]) => {
|
|
648
657
|
const includeItems = bucketEntry.include.map((item) => resolveBucketItem(item));
|
|
649
|
-
const excludeItems = _optionalChain([bucketEntry, 'access',
|
|
658
|
+
const excludeItems = _optionalChain([bucketEntry, 'access', _30 => _30.exclude, 'optionalAccess', _31 => _31.map, 'call', _32 => _32((item) => resolveBucketItem(item))]);
|
|
650
659
|
return {
|
|
651
660
|
type: bucketType,
|
|
652
661
|
config: extractPathPatterns(i18nConfig.locale.source, includeItems, excludeItems)
|
|
@@ -663,7 +672,7 @@ function extractPathPatterns(sourceLocale, include, exclude) {
|
|
|
663
672
|
})
|
|
664
673
|
)
|
|
665
674
|
);
|
|
666
|
-
const excludedPatterns = _optionalChain([exclude, 'optionalAccess',
|
|
675
|
+
const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _33 => _33.flatMap, 'call', _34 => _34(
|
|
667
676
|
(pattern) => expandPlaceholderedGlob(pattern.path, __spec.resolveOverridenLocale.call(void 0, sourceLocale, pattern.delimiter)).map(
|
|
668
677
|
(pathPattern) => ({
|
|
669
678
|
pathPattern,
|
|
@@ -697,7 +706,7 @@ function expandPlaceholderedGlob(_pathPattern, sourceLocale) {
|
|
|
697
706
|
}
|
|
698
707
|
const pathPatternChunks = pathPattern.split(_path2.default.sep);
|
|
699
708
|
const localeSegmentIndex = pathPatternChunks.findIndex((segment) => segment.includes("[locale]"));
|
|
700
|
-
const localePlaceholderIndex = _nullishCoalesce(_optionalChain([pathPatternChunks, 'access',
|
|
709
|
+
const localePlaceholderIndex = _nullishCoalesce(_optionalChain([pathPatternChunks, 'access', _35 => _35[localeSegmentIndex], 'optionalAccess', _36 => _36.indexOf, 'call', _37 => _37("[locale]")]), () => ( -1));
|
|
701
710
|
const sourcePathPattern = pathPattern.replace(/\[locale\]/g, sourceLocale);
|
|
702
711
|
const sourcePaths = glob2.sync(sourcePathPattern, { follow: true, withFileTypes: true }).filter((file) => file.isFile() || file.isSymbolicLink()).map((file) => file.fullpath()).map((fullpath) => _path2.default.relative(process.cwd(), fullpath));
|
|
703
712
|
const placeholderedPaths = sourcePaths.map((sourcePath) => {
|
|
@@ -782,12 +791,12 @@ function composeLoaders(...loaders) {
|
|
|
782
791
|
return {
|
|
783
792
|
init: async () => {
|
|
784
793
|
for (const loader of loaders) {
|
|
785
|
-
await _optionalChain([loader, 'access',
|
|
794
|
+
await _optionalChain([loader, 'access', _38 => _38.init, 'optionalCall', _39 => _39()]);
|
|
786
795
|
}
|
|
787
796
|
},
|
|
788
797
|
setDefaultLocale(locale) {
|
|
789
798
|
for (const loader of loaders) {
|
|
790
|
-
_optionalChain([loader, 'access',
|
|
799
|
+
_optionalChain([loader, 'access', _40 => _40.setDefaultLocale, 'optionalCall', _41 => _41(locale)]);
|
|
791
800
|
}
|
|
792
801
|
return this;
|
|
793
802
|
},
|
|
@@ -818,7 +827,7 @@ function createLoader(lDefinition) {
|
|
|
818
827
|
if (state.initCtx) {
|
|
819
828
|
return state.initCtx;
|
|
820
829
|
}
|
|
821
|
-
state.initCtx = await _optionalChain([lDefinition, 'access',
|
|
830
|
+
state.initCtx = await _optionalChain([lDefinition, 'access', _42 => _42.init, 'optionalCall', _43 => _43()]);
|
|
822
831
|
return state.initCtx;
|
|
823
832
|
},
|
|
824
833
|
setDefaultLocale(locale) {
|
|
@@ -907,7 +916,7 @@ function createNormalizeLoader() {
|
|
|
907
916
|
return normalized;
|
|
908
917
|
},
|
|
909
918
|
push: async (locale, data, originalInput) => {
|
|
910
|
-
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess',
|
|
919
|
+
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _44 => _44.keysMap]), () => ( {}));
|
|
911
920
|
const input2 = mapDenormalizedKeys(data, keysMap);
|
|
912
921
|
const denormalized = _flat.unflatten.call(void 0, input2, {
|
|
913
922
|
delimiter: "/",
|
|
@@ -1010,8 +1019,8 @@ async function getTrailingNewLine(pathPattern, locale, originalLocale) {
|
|
|
1010
1019
|
if (!templateData) {
|
|
1011
1020
|
templateData = await readFileForLocale(pathPattern, originalLocale);
|
|
1012
1021
|
}
|
|
1013
|
-
if (_optionalChain([templateData, 'optionalAccess',
|
|
1014
|
-
const ending = _optionalChain([templateData, 'optionalAccess',
|
|
1022
|
+
if (_optionalChain([templateData, 'optionalAccess', _45 => _45.match, 'call', _46 => _46(/[\r\n]$/)])) {
|
|
1023
|
+
const ending = _optionalChain([templateData, 'optionalAccess', _47 => _47.includes, 'call', _48 => _48("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _49 => _49.includes, 'call', _50 => _50("\r")]) ? "\r" : "\n";
|
|
1015
1024
|
return ending;
|
|
1016
1025
|
}
|
|
1017
1026
|
return "";
|
|
@@ -1238,7 +1247,7 @@ function createHtmlLoader() {
|
|
|
1238
1247
|
break;
|
|
1239
1248
|
}
|
|
1240
1249
|
const siblings = Array.from(parent.childNodes).filter(
|
|
1241
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1250
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _51 => _51.textContent, 'optionalAccess', _52 => _52.trim, 'call', _53 => _53()])
|
|
1242
1251
|
);
|
|
1243
1252
|
const index = siblings.indexOf(current);
|
|
1244
1253
|
if (index !== -1) {
|
|
@@ -1273,11 +1282,11 @@ function createHtmlLoader() {
|
|
|
1273
1282
|
result[getPath(element, attr)] = value;
|
|
1274
1283
|
}
|
|
1275
1284
|
});
|
|
1276
|
-
Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1285
|
+
Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _54 => _54.textContent, 'optionalAccess', _55 => _55.trim, 'call', _56 => _56()])).forEach(processNode);
|
|
1277
1286
|
}
|
|
1278
1287
|
};
|
|
1279
|
-
Array.from(document.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1280
|
-
Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1288
|
+
Array.from(document.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _57 => _57.textContent, 'optionalAccess', _58 => _58.trim, 'call', _59 => _59()])).forEach(processNode);
|
|
1289
|
+
Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _60 => _60.textContent, 'optionalAccess', _61 => _61.trim, 'call', _62 => _62()])).forEach(processNode);
|
|
1281
1290
|
return result;
|
|
1282
1291
|
},
|
|
1283
1292
|
async push(locale, data, originalInput) {
|
|
@@ -1299,7 +1308,7 @@ function createHtmlLoader() {
|
|
|
1299
1308
|
for (let i = 0; i < indices.length; i++) {
|
|
1300
1309
|
const index = parseInt(indices[i]);
|
|
1301
1310
|
const siblings = Array.from(parent.childNodes).filter(
|
|
1302
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1311
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _63 => _63.textContent, 'optionalAccess', _64 => _64.trim, 'call', _65 => _65()])
|
|
1303
1312
|
);
|
|
1304
1313
|
if (index >= siblings.length) {
|
|
1305
1314
|
if (i === indices.length - 1) {
|
|
@@ -1406,7 +1415,7 @@ function isSkippableLine(line) {
|
|
|
1406
1415
|
function parsePropertyLine(line) {
|
|
1407
1416
|
const [key, ...valueParts] = line.split("=");
|
|
1408
1417
|
return {
|
|
1409
|
-
key: _optionalChain([key, 'optionalAccess',
|
|
1418
|
+
key: _optionalChain([key, 'optionalAccess', _66 => _66.trim, 'call', _67 => _67()]) || "",
|
|
1410
1419
|
value: valueParts.join("=").trim()
|
|
1411
1420
|
};
|
|
1412
1421
|
}
|
|
@@ -1488,7 +1497,7 @@ function createXcodeXcstringsLoader() {
|
|
|
1488
1497
|
const resultData = {};
|
|
1489
1498
|
for (const [translationKey, _translationEntity] of Object.entries(input2.strings)) {
|
|
1490
1499
|
const rootTranslationEntity = _translationEntity;
|
|
1491
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
1500
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _68 => _68.localizations, 'optionalAccess', _69 => _69[locale]]);
|
|
1492
1501
|
if (langTranslationEntity) {
|
|
1493
1502
|
if ("stringUnit" in langTranslationEntity) {
|
|
1494
1503
|
resultData[translationKey] = langTranslationEntity.stringUnit.value;
|
|
@@ -1497,7 +1506,7 @@ function createXcodeXcstringsLoader() {
|
|
|
1497
1506
|
resultData[translationKey] = {};
|
|
1498
1507
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
1499
1508
|
for (const form in pluralForms) {
|
|
1500
|
-
if (_optionalChain([pluralForms, 'access',
|
|
1509
|
+
if (_optionalChain([pluralForms, 'access', _70 => _70[form], 'optionalAccess', _71 => _71.stringUnit, 'optionalAccess', _72 => _72.value])) {
|
|
1501
1510
|
resultData[translationKey][form] = pluralForms[form].stringUnit.value;
|
|
1502
1511
|
}
|
|
1503
1512
|
}
|
|
@@ -1647,7 +1656,7 @@ function createPoDataLoader(params) {
|
|
|
1647
1656
|
Object.entries(entries).forEach(([msgid, entry]) => {
|
|
1648
1657
|
if (msgid && entry.msgid) {
|
|
1649
1658
|
const context = entry.msgctxt || "";
|
|
1650
|
-
const fullEntry = _optionalChain([parsedPo, 'access',
|
|
1659
|
+
const fullEntry = _optionalChain([parsedPo, 'access', _73 => _73.translations, 'access', _74 => _74[context], 'optionalAccess', _75 => _75[msgid]]);
|
|
1651
1660
|
if (fullEntry) {
|
|
1652
1661
|
result[msgid] = fullEntry;
|
|
1653
1662
|
}
|
|
@@ -1657,7 +1666,7 @@ function createPoDataLoader(params) {
|
|
|
1657
1666
|
return result;
|
|
1658
1667
|
},
|
|
1659
1668
|
async push(locale, data, originalInput) {
|
|
1660
|
-
const sections = _optionalChain([originalInput, 'optionalAccess',
|
|
1669
|
+
const sections = _optionalChain([originalInput, 'optionalAccess', _76 => _76.split, 'call', _77 => _77("\n\n"), 'access', _78 => _78.filter, 'call', _79 => _79(Boolean)]) || [];
|
|
1661
1670
|
const result = sections.map((section) => {
|
|
1662
1671
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
1663
1672
|
const contextKey = _lodash2.default.keys(sectionPo.translations)[0];
|
|
@@ -1699,7 +1708,7 @@ function createPoContentLoader() {
|
|
|
1699
1708
|
entry.msgid,
|
|
1700
1709
|
{
|
|
1701
1710
|
...entry,
|
|
1702
|
-
msgstr: [_optionalChain([data, 'access',
|
|
1711
|
+
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)
|
|
1703
1712
|
}
|
|
1704
1713
|
]).fromPairs().value();
|
|
1705
1714
|
return result;
|
|
@@ -1945,7 +1954,7 @@ function createDatoClient(params) {
|
|
|
1945
1954
|
only_valid: "true",
|
|
1946
1955
|
ids: !records.length ? void 0 : records.join(",")
|
|
1947
1956
|
}
|
|
1948
|
-
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
1957
|
+
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _84 => _84.response, 'optionalAccess', _85 => _85.body, 'optionalAccess', _86 => _86.data, 'optionalAccess', _87 => _87[0]]) || error));
|
|
1949
1958
|
},
|
|
1950
1959
|
findRecordsForModel: async (modelId, records) => {
|
|
1951
1960
|
try {
|
|
@@ -1955,9 +1964,9 @@ function createDatoClient(params) {
|
|
|
1955
1964
|
filter: {
|
|
1956
1965
|
type: modelId,
|
|
1957
1966
|
only_valid: "true",
|
|
1958
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
1967
|
+
ids: !_optionalChain([records, 'optionalAccess', _88 => _88.length]) ? void 0 : records.join(",")
|
|
1959
1968
|
}
|
|
1960
|
-
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
1969
|
+
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _89 => _89.response, 'optionalAccess', _90 => _90.body, 'optionalAccess', _91 => _91.data, 'optionalAccess', _92 => _92[0]]) || error));
|
|
1961
1970
|
return result;
|
|
1962
1971
|
} catch (_error) {
|
|
1963
1972
|
throw new Error(
|
|
@@ -1971,9 +1980,9 @@ function createDatoClient(params) {
|
|
|
1971
1980
|
},
|
|
1972
1981
|
updateRecord: async (id, payload) => {
|
|
1973
1982
|
try {
|
|
1974
|
-
await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
1983
|
+
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));
|
|
1975
1984
|
} catch (_error) {
|
|
1976
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
1985
|
+
if (_optionalChain([_error, 'optionalAccess', _97 => _97.attributes, 'optionalAccess', _98 => _98.details, 'optionalAccess', _99 => _99.message])) {
|
|
1977
1986
|
throw new Error(
|
|
1978
1987
|
[
|
|
1979
1988
|
`${_error.attributes.details.message}`,
|
|
@@ -1994,9 +2003,9 @@ function createDatoClient(params) {
|
|
|
1994
2003
|
},
|
|
1995
2004
|
enableFieldLocalization: async (args) => {
|
|
1996
2005
|
try {
|
|
1997
|
-
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2006
|
+
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));
|
|
1998
2007
|
} catch (_error) {
|
|
1999
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2008
|
+
if (_optionalChain([_error, 'optionalAccess', _104 => _104.attributes, 'optionalAccess', _105 => _105.code]) === "NOT_FOUND") {
|
|
2000
2009
|
throw new Error(
|
|
2001
2010
|
[
|
|
2002
2011
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -2004,7 +2013,7 @@ function createDatoClient(params) {
|
|
|
2004
2013
|
].join("\n\n")
|
|
2005
2014
|
);
|
|
2006
2015
|
}
|
|
2007
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2016
|
+
if (_optionalChain([_error, 'optionalAccess', _106 => _106.attributes, 'optionalAccess', _107 => _107.details, 'optionalAccess', _108 => _108.message])) {
|
|
2008
2017
|
throw new Error(
|
|
2009
2018
|
[`${_error.attributes.details.message}`, `Error: ${JSON.stringify(_error, null, 2)}`].join("\n\n")
|
|
2010
2019
|
);
|
|
@@ -2070,7 +2079,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
2070
2079
|
}
|
|
2071
2080
|
}
|
|
2072
2081
|
const records = await dato.findRecordsForModel(modelId);
|
|
2073
|
-
const recordChoices = createRecordChoices(records, _optionalChain([config, 'access',
|
|
2082
|
+
const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _109 => _109.models, 'access', _110 => _110[modelId], 'optionalAccess', _111 => _111.records]) || [], project);
|
|
2074
2083
|
const selectedRecords = await promptRecordSelection(modelName, recordChoices);
|
|
2075
2084
|
result.models[modelId].records = records.filter((record) => selectedRecords.includes(record.id));
|
|
2076
2085
|
updatedConfig.models[modelId].records = selectedRecords;
|
|
@@ -2082,14 +2091,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
2082
2091
|
},
|
|
2083
2092
|
async pull(locale, input2, initCtx) {
|
|
2084
2093
|
const result = {};
|
|
2085
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
2086
|
-
let records = _optionalChain([initCtx, 'optionalAccess',
|
|
2094
|
+
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _112 => _112.models]) || {})) {
|
|
2095
|
+
let records = _optionalChain([initCtx, 'optionalAccess', _113 => _113.models, 'access', _114 => _114[modelId], 'access', _115 => _115.records]) || [];
|
|
2087
2096
|
const recordIds = records.map((record) => record.id);
|
|
2088
2097
|
records = await dato.findRecords(recordIds);
|
|
2089
2098
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
2090
2099
|
if (records.length > 0) {
|
|
2091
2100
|
result[modelId] = {
|
|
2092
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
2101
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _116 => _116.models, 'optionalAccess', _117 => _117[modelId], 'optionalAccess', _118 => _118.fields]) || [],
|
|
2093
2102
|
records
|
|
2094
2103
|
};
|
|
2095
2104
|
}
|
|
@@ -2148,7 +2157,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
2148
2157
|
return records.map((record) => ({
|
|
2149
2158
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
2150
2159
|
value: record.id,
|
|
2151
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
2160
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _119 => _119.includes, 'call', _120 => _120(record.id)])
|
|
2152
2161
|
}));
|
|
2153
2162
|
}
|
|
2154
2163
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -2415,7 +2424,7 @@ var _nodewebvtt = require('node-webvtt'); var _nodewebvtt2 = _interopRequireDefa
|
|
|
2415
2424
|
function createVttLoader() {
|
|
2416
2425
|
return createLoader({
|
|
2417
2426
|
async pull(locale, input2) {
|
|
2418
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
2427
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _121 => _121.parse, 'call', _122 => _122(input2), 'optionalAccess', _123 => _123.cues]);
|
|
2419
2428
|
if (Object.keys(vtt).length === 0) {
|
|
2420
2429
|
return {};
|
|
2421
2430
|
} else {
|
|
@@ -2467,7 +2476,7 @@ function variableExtractLoader(params) {
|
|
|
2467
2476
|
for (let i = 0; i < matches.length; i++) {
|
|
2468
2477
|
const match = matches[i];
|
|
2469
2478
|
const currentValue = result[key].value;
|
|
2470
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
2479
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _124 => _124.replace, 'call', _125 => _125(match, `{variable:${i}}`)]);
|
|
2471
2480
|
result[key].value = newValue;
|
|
2472
2481
|
result[key].variables[i] = match;
|
|
2473
2482
|
}
|
|
@@ -2481,7 +2490,7 @@ function variableExtractLoader(params) {
|
|
|
2481
2490
|
for (let i = 0; i < valueObj.variables.length; i++) {
|
|
2482
2491
|
const variable = valueObj.variables[i];
|
|
2483
2492
|
const currentValue = result[key];
|
|
2484
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
2493
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _126 => _126.replace, 'call', _127 => _127(`{variable:${i}}`, variable)]);
|
|
2485
2494
|
result[key] = newValue;
|
|
2486
2495
|
}
|
|
2487
2496
|
}
|
|
@@ -2989,11 +2998,11 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
2989
2998
|
const auth = await validateAuth(settings);
|
|
2990
2999
|
ora.succeed(`Authenticated as ${auth.email}`);
|
|
2991
3000
|
let buckets = getBuckets(i18nConfig);
|
|
2992
|
-
if (_optionalChain([flags, 'access',
|
|
3001
|
+
if (_optionalChain([flags, 'access', _128 => _128.bucket, 'optionalAccess', _129 => _129.length])) {
|
|
2993
3002
|
buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
|
|
2994
3003
|
}
|
|
2995
3004
|
ora.succeed("Buckets retrieved");
|
|
2996
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
3005
|
+
const targetLocales = _optionalChain([flags, 'access', _130 => _130.locale, 'optionalAccess', _131 => _131.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
2997
3006
|
const lockfileHelper = createLockfileHelper();
|
|
2998
3007
|
ora.start("Ensuring i18n.lock exists...");
|
|
2999
3008
|
if (!lockfileHelper.isLockfileExists()) {
|
|
@@ -3279,12 +3288,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
3279
3288
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
3280
3289
|
docUrl: "bucketNotFound"
|
|
3281
3290
|
});
|
|
3282
|
-
} else if (_optionalChain([flags, 'access',
|
|
3291
|
+
} else if (_optionalChain([flags, 'access', _132 => _132.locale, 'optionalAccess', _133 => _133.some, 'call', _134 => _134((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
3283
3292
|
throw new CLIError({
|
|
3284
3293
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
3285
3294
|
docUrl: "localeTargetNotFound"
|
|
3286
3295
|
});
|
|
3287
|
-
} else if (_optionalChain([flags, 'access',
|
|
3296
|
+
} else if (_optionalChain([flags, 'access', _135 => _135.bucket, 'optionalAccess', _136 => _136.some, 'call', _137 => _137((bucket) => !i18nConfig.buckets[bucket])])) {
|
|
3288
3297
|
throw new CLIError({
|
|
3289
3298
|
message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
|
|
3290
3299
|
docUrl: "bucketNotFound"
|
|
@@ -3511,7 +3520,7 @@ function displaySummary(results) {
|
|
|
3511
3520
|
// package.json
|
|
3512
3521
|
var package_default = {
|
|
3513
3522
|
name: "lingo.dev",
|
|
3514
|
-
version: "0.75.
|
|
3523
|
+
version: "0.75.1",
|
|
3515
3524
|
description: "Lingo.dev CLI",
|
|
3516
3525
|
private: false,
|
|
3517
3526
|
publishConfig: {
|