lingo.dev 0.92.18 → 0.92.19
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 +32 -2
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +32 -2
- package/build/cli.mjs.map +1 -1
- package/package.json +1 -1
package/build/cli.cjs
CHANGED
|
@@ -2311,10 +2311,11 @@ function createPoDataLoader(params) {
|
|
|
2311
2311
|
}
|
|
2312
2312
|
}
|
|
2313
2313
|
});
|
|
2314
|
-
|
|
2314
|
+
const updatedSection = _gettextparser2.default.po.compile(updatedPo, { foldLength: params.multiline ? 76 : false }).toString().replace(
|
|
2315
2315
|
[`msgid ""`, `msgstr "Content-Type: text/plain\\n"`].join("\n"),
|
|
2316
2316
|
""
|
|
2317
2317
|
).trim();
|
|
2318
|
+
return preserveCommentOrder(updatedSection, section);
|
|
2318
2319
|
}
|
|
2319
2320
|
return section.trim();
|
|
2320
2321
|
}).filter(Boolean).join("\n\n");
|
|
@@ -2354,6 +2355,35 @@ function createPoContentLoader() {
|
|
|
2354
2355
|
}
|
|
2355
2356
|
});
|
|
2356
2357
|
}
|
|
2358
|
+
function preserveCommentOrder(section, originalSection) {
|
|
2359
|
+
const sectionLines = section.split(/\r?\n/);
|
|
2360
|
+
const originalLines = originalSection.split(/\r?\n/);
|
|
2361
|
+
const isComment = (line) => line.trim().startsWith("#");
|
|
2362
|
+
const sectionComments = sectionLines.filter(isComment);
|
|
2363
|
+
const nonCommentLines = sectionLines.filter((line) => !isComment(line));
|
|
2364
|
+
if (sectionComments.length <= 1) {
|
|
2365
|
+
return section;
|
|
2366
|
+
}
|
|
2367
|
+
const originalCommentOrder = originalLines.filter(isComment);
|
|
2368
|
+
const commentMap = /* @__PURE__ */ new Map();
|
|
2369
|
+
for (const line of sectionComments) {
|
|
2370
|
+
commentMap.set(line.trim(), line);
|
|
2371
|
+
}
|
|
2372
|
+
const reorderedComments = [];
|
|
2373
|
+
for (const orig of originalCommentOrder) {
|
|
2374
|
+
const trimmed = orig.trim();
|
|
2375
|
+
if (commentMap.has(trimmed)) {
|
|
2376
|
+
reorderedComments.push(commentMap.get(trimmed));
|
|
2377
|
+
commentMap.delete(trimmed);
|
|
2378
|
+
}
|
|
2379
|
+
}
|
|
2380
|
+
for (const line of sectionComments) {
|
|
2381
|
+
if (!originalCommentOrder.some((orig) => orig.trim() === line.trim())) {
|
|
2382
|
+
reorderedComments.push(line);
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
return [...reorderedComments, ...nonCommentLines].join("\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
2386
|
+
}
|
|
2357
2387
|
|
|
2358
2388
|
// src/cli/loaders/xliff.ts
|
|
2359
2389
|
var _xliff = require('xliff'); var _xliff2 = _interopRequireDefault(_xliff);
|
|
@@ -6550,7 +6580,7 @@ async function renderHero() {
|
|
|
6550
6580
|
// package.json
|
|
6551
6581
|
var package_default = {
|
|
6552
6582
|
name: "lingo.dev",
|
|
6553
|
-
version: "0.92.
|
|
6583
|
+
version: "0.92.19",
|
|
6554
6584
|
description: "Lingo.dev CLI",
|
|
6555
6585
|
private: false,
|
|
6556
6586
|
publishConfig: {
|