lingo.dev 0.87.12 → 0.87.14
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 +50 -5
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +56 -11
- package/build/cli.mjs.map +1 -1
- package/package.json +1 -1
package/build/cli.cjs
CHANGED
|
@@ -1190,7 +1190,7 @@ function denormalizeObjectKeys(obj) {
|
|
|
1190
1190
|
obj,
|
|
1191
1191
|
(result, value, key) => {
|
|
1192
1192
|
const newKey = !isNaN(Number(key)) ? `${OBJECT_NUMERIC_KEY_PREFIX}${key}` : key;
|
|
1193
|
-
result[newKey] = _lodash2.default.isObject(value) ? denormalizeObjectKeys(value) : value;
|
|
1193
|
+
result[newKey] = _lodash2.default.isObject(value) && !_lodash2.default.isDate(value) ? denormalizeObjectKeys(value) : value;
|
|
1194
1194
|
},
|
|
1195
1195
|
{}
|
|
1196
1196
|
);
|
|
@@ -1204,7 +1204,7 @@ function normalizeObjectKeys(obj) {
|
|
|
1204
1204
|
obj,
|
|
1205
1205
|
(result, value, key) => {
|
|
1206
1206
|
const newKey = `${key}`.replace(OBJECT_NUMERIC_KEY_PREFIX, "");
|
|
1207
|
-
result[newKey] = _lodash2.default.isObject(value) ? normalizeObjectKeys(value) : value;
|
|
1207
|
+
result[newKey] = _lodash2.default.isObject(value) && !_lodash2.default.isDate(value) ? normalizeObjectKeys(value) : value;
|
|
1208
1208
|
},
|
|
1209
1209
|
{}
|
|
1210
1210
|
);
|
|
@@ -3091,11 +3091,13 @@ function createLockedKeysLoader(lockedKeys, isCacheRestore = false) {
|
|
|
3091
3091
|
|
|
3092
3092
|
// src/cli/loaders/mdx2/frontmatter-split.ts
|
|
3093
3093
|
|
|
3094
|
+
|
|
3094
3095
|
function createMdxFrontmatterSplitLoader() {
|
|
3096
|
+
const fmEngine = createFmEngine();
|
|
3095
3097
|
return createLoader({
|
|
3096
3098
|
async pull(locale, input2) {
|
|
3097
3099
|
const source = input2 || "";
|
|
3098
|
-
const { data: frontmatter, content } =
|
|
3100
|
+
const { data: frontmatter, content } = fmEngine.parse(source);
|
|
3099
3101
|
return {
|
|
3100
3102
|
frontmatter,
|
|
3101
3103
|
content
|
|
@@ -3103,11 +3105,29 @@ function createMdxFrontmatterSplitLoader() {
|
|
|
3103
3105
|
},
|
|
3104
3106
|
async push(locale, data) {
|
|
3105
3107
|
const { frontmatter = {}, content = "" } = data || {};
|
|
3106
|
-
const result =
|
|
3108
|
+
const result = fmEngine.stringify(content, frontmatter).trim();
|
|
3107
3109
|
return result;
|
|
3108
3110
|
}
|
|
3109
3111
|
});
|
|
3110
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
|
+
}
|
|
3111
3131
|
|
|
3112
3132
|
// src/cli/utils/md5.ts
|
|
3113
3133
|
var _objecthash = require('object-hash');
|
|
@@ -3119,6 +3139,29 @@ function md5(input2) {
|
|
|
3119
3139
|
|
|
3120
3140
|
var fenceRegex = /([ \t]*)(^>\s*)?```([\s\S]*?)```/gm;
|
|
3121
3141
|
var inlineCodeRegex = /(?<!`)`([^`\r\n]+?)`(?!`)/g;
|
|
3142
|
+
var imageRegex = /([ \t]*)(^>\s*)?!\[[^\]]*?\]\([^\n\r]*?\)/gm;
|
|
3143
|
+
function ensureSurroundingImageNewlines(_content) {
|
|
3144
|
+
let found = false;
|
|
3145
|
+
let content = _content;
|
|
3146
|
+
let workingContent = content;
|
|
3147
|
+
do {
|
|
3148
|
+
found = false;
|
|
3149
|
+
const matches = workingContent.match(imageRegex);
|
|
3150
|
+
if (matches) {
|
|
3151
|
+
const match = matches[0];
|
|
3152
|
+
const replacement = match.trim().startsWith(">") ? match : `
|
|
3153
|
+
|
|
3154
|
+
${match}
|
|
3155
|
+
|
|
3156
|
+
`;
|
|
3157
|
+
content = content.replaceAll(match, replacement);
|
|
3158
|
+
workingContent = workingContent.replaceAll(match, "");
|
|
3159
|
+
found = true;
|
|
3160
|
+
}
|
|
3161
|
+
} while (found);
|
|
3162
|
+
content = _lodash2.default.chain(content).split("\n\n").map((section) => _lodash2.default.trim(section, "\n")).filter(Boolean).join("\n\n").value();
|
|
3163
|
+
return content;
|
|
3164
|
+
}
|
|
3122
3165
|
function ensureTrailingFenceNewline(_content) {
|
|
3123
3166
|
let found = false;
|
|
3124
3167
|
let content = _content;
|
|
@@ -3144,6 +3187,7 @@ ${match}
|
|
|
3144
3187
|
function extractCodePlaceholders(content) {
|
|
3145
3188
|
let finalContent = content;
|
|
3146
3189
|
finalContent = ensureTrailingFenceNewline(finalContent);
|
|
3190
|
+
finalContent = ensureSurroundingImageNewlines(finalContent);
|
|
3147
3191
|
const codePlaceholders = {};
|
|
3148
3192
|
const codeBlockMatches = finalContent.matchAll(fenceRegex);
|
|
3149
3193
|
for (const match of codeBlockMatches) {
|
|
@@ -3309,6 +3353,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys)
|
|
|
3309
3353
|
createMdxSectionsSplit2Loader(),
|
|
3310
3354
|
createLocalizableMdxDocumentLoader(),
|
|
3311
3355
|
createFlatLoader(),
|
|
3356
|
+
createLockedKeysLoader(lockedKeys || [], options.isCacheRestore),
|
|
3312
3357
|
createSyncLoader(),
|
|
3313
3358
|
createUnlocalizableLoader(
|
|
3314
3359
|
options.isCacheRestore,
|
|
@@ -5679,7 +5724,7 @@ function validateParams2(i18nConfig, flags) {
|
|
|
5679
5724
|
// package.json
|
|
5680
5725
|
var package_default = {
|
|
5681
5726
|
name: "lingo.dev",
|
|
5682
|
-
version: "0.87.
|
|
5727
|
+
version: "0.87.14",
|
|
5683
5728
|
description: "Lingo.dev CLI",
|
|
5684
5729
|
private: false,
|
|
5685
5730
|
publishConfig: {
|