lingo.dev 0.87.11 → 0.87.13
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 +57 -18
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +63 -24
- package/build/cli.mjs.map +1 -1
- package/package.json +1 -1
package/build/cli.cjs
CHANGED
|
@@ -1066,7 +1066,12 @@ function createLoader(lDefinition) {
|
|
|
1066
1066
|
state.originalInput = input2 || null;
|
|
1067
1067
|
}
|
|
1068
1068
|
state.pullInput = input2;
|
|
1069
|
-
const result = await lDefinition.pull(
|
|
1069
|
+
const result = await lDefinition.pull(
|
|
1070
|
+
locale,
|
|
1071
|
+
input2,
|
|
1072
|
+
state.initCtx,
|
|
1073
|
+
state.defaultLocale
|
|
1074
|
+
);
|
|
1070
1075
|
state.pullOutput = result;
|
|
1071
1076
|
return result;
|
|
1072
1077
|
},
|
|
@@ -1185,7 +1190,7 @@ function denormalizeObjectKeys(obj) {
|
|
|
1185
1190
|
obj,
|
|
1186
1191
|
(result, value, key) => {
|
|
1187
1192
|
const newKey = !isNaN(Number(key)) ? `${OBJECT_NUMERIC_KEY_PREFIX}${key}` : key;
|
|
1188
|
-
result[newKey] = _lodash2.default.isObject(value) ? denormalizeObjectKeys(value) : value;
|
|
1193
|
+
result[newKey] = _lodash2.default.isObject(value) && !_lodash2.default.isDate(value) ? denormalizeObjectKeys(value) : value;
|
|
1189
1194
|
},
|
|
1190
1195
|
{}
|
|
1191
1196
|
);
|
|
@@ -1199,7 +1204,7 @@ function normalizeObjectKeys(obj) {
|
|
|
1199
1204
|
obj,
|
|
1200
1205
|
(result, value, key) => {
|
|
1201
1206
|
const newKey = `${key}`.replace(OBJECT_NUMERIC_KEY_PREFIX, "");
|
|
1202
|
-
result[newKey] = _lodash2.default.isObject(value) ? normalizeObjectKeys(value) : value;
|
|
1207
|
+
result[newKey] = _lodash2.default.isObject(value) && !_lodash2.default.isDate(value) ? normalizeObjectKeys(value) : value;
|
|
1203
1208
|
},
|
|
1204
1209
|
{}
|
|
1205
1210
|
);
|
|
@@ -1990,7 +1995,9 @@ function createPoDataLoader(params) {
|
|
|
1990
1995
|
const csPo = _gettextparser2.default.po.parse(cs);
|
|
1991
1996
|
const csContextKey = _lodash2.default.keys(csPo.translations)[0];
|
|
1992
1997
|
const csEntries = csPo.translations[csContextKey];
|
|
1993
|
-
const csMsgid = Object.keys(csEntries).find(
|
|
1998
|
+
const csMsgid = Object.keys(csEntries).find(
|
|
1999
|
+
(key) => csEntries[key].msgid
|
|
2000
|
+
);
|
|
1994
2001
|
return csMsgid === msgid;
|
|
1995
2002
|
});
|
|
1996
2003
|
if (currentSection) {
|
|
@@ -2008,7 +2015,10 @@ function createPoDataLoader(params) {
|
|
|
2008
2015
|
}
|
|
2009
2016
|
}
|
|
2010
2017
|
});
|
|
2011
|
-
return _gettextparser2.default.po.compile(updatedPo, { foldLength: params.multiline ? 76 : false }).toString().replace(
|
|
2018
|
+
return _gettextparser2.default.po.compile(updatedPo, { foldLength: params.multiline ? 76 : false }).toString().replace(
|
|
2019
|
+
[`msgid ""`, `msgstr "Content-Type: text/plain\\n"`].join("\n"),
|
|
2020
|
+
""
|
|
2021
|
+
).trim();
|
|
2012
2022
|
}
|
|
2013
2023
|
return section.trim();
|
|
2014
2024
|
}).join("\n\n");
|
|
@@ -2018,14 +2028,19 @@ function createPoDataLoader(params) {
|
|
|
2018
2028
|
}
|
|
2019
2029
|
function createPoContentLoader() {
|
|
2020
2030
|
return createLoader({
|
|
2021
|
-
async pull(locale, input2) {
|
|
2022
|
-
const result = _lodash2.default.chain(input2).entries().filter(([, entry]) => !!entry.msgid).map(([, entry]) =>
|
|
2023
|
-
entry.msgid
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2031
|
+
async pull(locale, input2, initCtx, originalLocale) {
|
|
2032
|
+
const result = _lodash2.default.chain(input2).entries().filter(([, entry]) => !!entry.msgid).map(([, entry]) => {
|
|
2033
|
+
const singularFallback = locale === originalLocale ? entry.msgid : null;
|
|
2034
|
+
const pluralFallback = locale === originalLocale ? entry.msgid_plural || entry.msgid : null;
|
|
2035
|
+
const hasPlural = entry.msgstr.length > 1;
|
|
2036
|
+
return [
|
|
2037
|
+
entry.msgid,
|
|
2038
|
+
{
|
|
2039
|
+
singular: entry.msgstr[0] || singularFallback,
|
|
2040
|
+
plural: hasPlural ? entry.msgstr[1] || pluralFallback : null
|
|
2041
|
+
}
|
|
2042
|
+
];
|
|
2043
|
+
}).fromPairs().value();
|
|
2029
2044
|
return result;
|
|
2030
2045
|
},
|
|
2031
2046
|
async push(locale, data, originalInput) {
|
|
@@ -2033,7 +2048,10 @@ function createPoContentLoader() {
|
|
|
2033
2048
|
entry.msgid,
|
|
2034
2049
|
{
|
|
2035
2050
|
...entry,
|
|
2036
|
-
msgstr: [
|
|
2051
|
+
msgstr: [
|
|
2052
|
+
_optionalChain([data, 'access', _95 => _95[entry.msgid], 'optionalAccess', _96 => _96.singular]),
|
|
2053
|
+
_optionalChain([data, 'access', _97 => _97[entry.msgid], 'optionalAccess', _98 => _98.plural]) || null
|
|
2054
|
+
].filter(Boolean)
|
|
2037
2055
|
}
|
|
2038
2056
|
]).fromPairs().value();
|
|
2039
2057
|
return result;
|
|
@@ -3073,11 +3091,13 @@ function createLockedKeysLoader(lockedKeys, isCacheRestore = false) {
|
|
|
3073
3091
|
|
|
3074
3092
|
// src/cli/loaders/mdx2/frontmatter-split.ts
|
|
3075
3093
|
|
|
3094
|
+
|
|
3076
3095
|
function createMdxFrontmatterSplitLoader() {
|
|
3096
|
+
const fmEngine = createFmEngine();
|
|
3077
3097
|
return createLoader({
|
|
3078
3098
|
async pull(locale, input2) {
|
|
3079
3099
|
const source = input2 || "";
|
|
3080
|
-
const { data: frontmatter, content } =
|
|
3100
|
+
const { data: frontmatter, content } = fmEngine.parse(source);
|
|
3081
3101
|
return {
|
|
3082
3102
|
frontmatter,
|
|
3083
3103
|
content
|
|
@@ -3085,11 +3105,29 @@ function createMdxFrontmatterSplitLoader() {
|
|
|
3085
3105
|
},
|
|
3086
3106
|
async push(locale, data) {
|
|
3087
3107
|
const { frontmatter = {}, content = "" } = data || {};
|
|
3088
|
-
const result =
|
|
3108
|
+
const result = fmEngine.stringify(content, frontmatter).trim();
|
|
3089
3109
|
return result;
|
|
3090
3110
|
}
|
|
3091
3111
|
});
|
|
3092
3112
|
}
|
|
3113
|
+
function createFmEngine() {
|
|
3114
|
+
const yamlEngine2 = {
|
|
3115
|
+
parse: (str) => _yaml2.default.parse(str),
|
|
3116
|
+
stringify: (obj) => _yaml2.default.stringify(obj, { defaultStringType: "PLAIN" })
|
|
3117
|
+
};
|
|
3118
|
+
return {
|
|
3119
|
+
parse: (input2) => _graymatter2.default.call(void 0, input2, {
|
|
3120
|
+
engines: {
|
|
3121
|
+
yaml: yamlEngine2
|
|
3122
|
+
}
|
|
3123
|
+
}),
|
|
3124
|
+
stringify: (content, frontmatter) => _graymatter2.default.stringify(content, frontmatter, {
|
|
3125
|
+
engines: {
|
|
3126
|
+
yaml: yamlEngine2
|
|
3127
|
+
}
|
|
3128
|
+
})
|
|
3129
|
+
};
|
|
3130
|
+
}
|
|
3093
3131
|
|
|
3094
3132
|
// src/cli/utils/md5.ts
|
|
3095
3133
|
var _objecthash = require('object-hash');
|
|
@@ -3282,15 +3320,16 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
|
|
|
3282
3320
|
case "mdx":
|
|
3283
3321
|
return composeLoaders(
|
|
3284
3322
|
createTextFileLoader(bucketPathPattern),
|
|
3285
|
-
createMdxCodePlaceholderLoader(),
|
|
3286
3323
|
createPrettierLoader({
|
|
3287
3324
|
parser: "mdx",
|
|
3288
3325
|
bucketPathPattern
|
|
3289
3326
|
}),
|
|
3327
|
+
createMdxCodePlaceholderLoader(),
|
|
3290
3328
|
createMdxFrontmatterSplitLoader(),
|
|
3291
3329
|
createMdxSectionsSplit2Loader(),
|
|
3292
3330
|
createLocalizableMdxDocumentLoader(),
|
|
3293
3331
|
createFlatLoader(),
|
|
3332
|
+
createLockedKeysLoader(lockedKeys || [], options.isCacheRestore),
|
|
3294
3333
|
createSyncLoader(),
|
|
3295
3334
|
createUnlocalizableLoader(
|
|
3296
3335
|
options.isCacheRestore,
|
|
@@ -5661,7 +5700,7 @@ function validateParams2(i18nConfig, flags) {
|
|
|
5661
5700
|
// package.json
|
|
5662
5701
|
var package_default = {
|
|
5663
5702
|
name: "lingo.dev",
|
|
5664
|
-
version: "0.87.
|
|
5703
|
+
version: "0.87.13",
|
|
5665
5704
|
description: "Lingo.dev CLI",
|
|
5666
5705
|
private: false,
|
|
5667
5706
|
publishConfig: {
|