lingo.dev 0.111.14 → 0.111.16
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/README.md +7 -1
- package/build/cli.cjs +180 -134
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +71 -25
- package/build/cli.mjs.map +1 -1
- package/package.json +4 -4
package/build/cli.mjs
CHANGED
|
@@ -569,26 +569,49 @@ async function pauseIfDebug(debug) {
|
|
|
569
569
|
}
|
|
570
570
|
async function renderSummary(results) {
|
|
571
571
|
console.log(chalk.hex(colors.green)("[Done]"));
|
|
572
|
-
const
|
|
572
|
+
const skippedResults = Array.from(results.values()).filter(
|
|
573
573
|
(r) => r.status === "skipped"
|
|
574
|
-
)
|
|
575
|
-
|
|
576
|
-
const succeededTasksCount = Array.from(results.values()).filter(
|
|
574
|
+
);
|
|
575
|
+
const succeededResults = Array.from(results.values()).filter(
|
|
577
576
|
(r) => r.status === "success"
|
|
578
|
-
)
|
|
579
|
-
|
|
580
|
-
const failedTasksCount = Array.from(results.values()).filter(
|
|
577
|
+
);
|
|
578
|
+
const failedResults = Array.from(results.values()).filter(
|
|
581
579
|
(r) => r.status === "error"
|
|
582
|
-
)
|
|
583
|
-
console.log(
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
580
|
+
);
|
|
581
|
+
console.log(
|
|
582
|
+
`\u2022 ${chalk.hex(colors.yellow)(skippedResults.length)} from cache`
|
|
583
|
+
);
|
|
584
|
+
console.log(
|
|
585
|
+
`\u2022 ${chalk.hex(colors.yellow)(succeededResults.length)} processed`
|
|
586
|
+
);
|
|
587
|
+
console.log(`\u2022 ${chalk.hex(colors.yellow)(failedResults.length)} failed`);
|
|
588
|
+
if (succeededResults.length > 0) {
|
|
589
|
+
console.log(chalk.hex(colors.green)("\n[Processed Files]"));
|
|
590
|
+
for (const result of succeededResults) {
|
|
591
|
+
const displayPath = result.pathPattern?.replace("[locale]", result.targetLocale) || "unknown";
|
|
589
592
|
console.log(
|
|
590
|
-
|
|
591
|
-
|
|
593
|
+
` \u2713 ${chalk.dim(displayPath)} ${chalk.hex(colors.yellow)(`(${result.sourceLocale} \u2192 ${result.targetLocale})`)}`
|
|
594
|
+
);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
if (skippedResults.length > 0) {
|
|
598
|
+
console.log(chalk.hex(colors.blue)("\n[Cached Files]"));
|
|
599
|
+
for (const result of skippedResults) {
|
|
600
|
+
const displayPath = result.pathPattern?.replace("[locale]", result.targetLocale) || "unknown";
|
|
601
|
+
console.log(
|
|
602
|
+
` \u26A1 ${chalk.dim(displayPath)} ${chalk.hex(colors.yellow)(`(${result.sourceLocale} \u2192 ${result.targetLocale})`)}`
|
|
603
|
+
);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
if (failedResults.length > 0) {
|
|
607
|
+
console.log(chalk.hex(colors.orange)("\n[Failed Files]"));
|
|
608
|
+
for (const result of failedResults) {
|
|
609
|
+
const displayPath = result.pathPattern?.replace("[locale]", result.targetLocale) || "unknown";
|
|
610
|
+
console.log(
|
|
611
|
+
` \u274C ${chalk.dim(displayPath)} ${chalk.hex(colors.yellow)(`(${result.sourceLocale} \u2192 ${result.targetLocale})`)}`
|
|
612
|
+
);
|
|
613
|
+
console.log(
|
|
614
|
+
` ${chalk.hex(colors.white)(String(result.error?.message || "Unknown error"))}`
|
|
592
615
|
);
|
|
593
616
|
}
|
|
594
617
|
}
|
|
@@ -9407,12 +9430,21 @@ async function execute(input2) {
|
|
|
9407
9430
|
title: `Processing localization tasks ${chalk12.dim(
|
|
9408
9431
|
`(tasks: ${input2.tasks.length}, concurrency: ${effectiveConcurrency})`
|
|
9409
9432
|
)}`,
|
|
9410
|
-
task: (ctx, task) => {
|
|
9433
|
+
task: async (ctx, task) => {
|
|
9411
9434
|
if (input2.tasks.length < 1) {
|
|
9412
9435
|
task.title = `Skipping, nothing to localize.`;
|
|
9413
9436
|
task.skip();
|
|
9414
9437
|
return;
|
|
9415
9438
|
}
|
|
9439
|
+
const initialChecksumsMap = /* @__PURE__ */ new Map();
|
|
9440
|
+
const uniqueBucketPatterns = _34.uniq(
|
|
9441
|
+
ctx.tasks.map((t2) => t2.bucketPathPattern)
|
|
9442
|
+
);
|
|
9443
|
+
for (const bucketPathPattern of uniqueBucketPatterns) {
|
|
9444
|
+
const deltaProcessor = createDeltaProcessor(bucketPathPattern);
|
|
9445
|
+
const checksums = await deltaProcessor.loadChecksums();
|
|
9446
|
+
initialChecksumsMap.set(bucketPathPattern, checksums);
|
|
9447
|
+
}
|
|
9416
9448
|
const i18nLimiter = pLimit(effectiveConcurrency);
|
|
9417
9449
|
const ioLimiter = pLimit(1);
|
|
9418
9450
|
const workersCount = effectiveConcurrency;
|
|
@@ -9427,6 +9459,7 @@ async function execute(input2) {
|
|
|
9427
9459
|
assignedTasks,
|
|
9428
9460
|
ioLimiter,
|
|
9429
9461
|
i18nLimiter,
|
|
9462
|
+
initialChecksumsMap,
|
|
9430
9463
|
onDone() {
|
|
9431
9464
|
task.title = createExecutionProgressMessage(ctx);
|
|
9432
9465
|
}
|
|
@@ -9506,6 +9539,7 @@ function createWorkerTask(args) {
|
|
|
9506
9539
|
const deltaProcessor = createDeltaProcessor(
|
|
9507
9540
|
assignedTask.bucketPathPattern
|
|
9508
9541
|
);
|
|
9542
|
+
const initialChecksums = args.initialChecksumsMap.get(assignedTask.bucketPathPattern) || {};
|
|
9509
9543
|
const taskResult = await args.i18nLimiter(async () => {
|
|
9510
9544
|
try {
|
|
9511
9545
|
const sourceData = await bucketLoader.pull(
|
|
@@ -9515,11 +9549,10 @@ function createWorkerTask(args) {
|
|
|
9515
9549
|
const targetData = await bucketLoader.pull(
|
|
9516
9550
|
assignedTask.targetLocale
|
|
9517
9551
|
);
|
|
9518
|
-
const checksums = await deltaProcessor.loadChecksums();
|
|
9519
9552
|
const delta = await deltaProcessor.calculateDelta({
|
|
9520
9553
|
sourceData,
|
|
9521
9554
|
targetData,
|
|
9522
|
-
checksums
|
|
9555
|
+
checksums: initialChecksums
|
|
9523
9556
|
});
|
|
9524
9557
|
const processableData = _34.chain(sourceData).entries().filter(
|
|
9525
9558
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
|
|
@@ -9532,7 +9565,12 @@ function createWorkerTask(args) {
|
|
|
9532
9565
|
await args.ioLimiter(async () => {
|
|
9533
9566
|
await bucketLoader.push(assignedTask.targetLocale, targetData);
|
|
9534
9567
|
});
|
|
9535
|
-
return {
|
|
9568
|
+
return {
|
|
9569
|
+
status: "skipped",
|
|
9570
|
+
pathPattern: assignedTask.bucketPathPattern,
|
|
9571
|
+
sourceLocale: assignedTask.sourceLocale,
|
|
9572
|
+
targetLocale: assignedTask.targetLocale
|
|
9573
|
+
};
|
|
9536
9574
|
}
|
|
9537
9575
|
const relevantHints = _34.pick(hints, Object.keys(processableData));
|
|
9538
9576
|
const processedTargetData = await args.ctx.localizer.localize(
|
|
@@ -9586,16 +9624,24 @@ function createWorkerTask(args) {
|
|
|
9586
9624
|
assignedTask.targetLocale,
|
|
9587
9625
|
finalRenamedTargetData
|
|
9588
9626
|
);
|
|
9589
|
-
const
|
|
9627
|
+
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
9590
9628
|
if (!args.ctx.flags.targetLocale?.length) {
|
|
9591
|
-
await deltaProcessor.saveChecksums(
|
|
9629
|
+
await deltaProcessor.saveChecksums(checksums);
|
|
9592
9630
|
}
|
|
9593
9631
|
});
|
|
9594
|
-
return {
|
|
9632
|
+
return {
|
|
9633
|
+
status: "success",
|
|
9634
|
+
pathPattern: assignedTask.bucketPathPattern,
|
|
9635
|
+
sourceLocale: assignedTask.sourceLocale,
|
|
9636
|
+
targetLocale: assignedTask.targetLocale
|
|
9637
|
+
};
|
|
9595
9638
|
} catch (error) {
|
|
9596
9639
|
return {
|
|
9597
9640
|
status: "error",
|
|
9598
|
-
error
|
|
9641
|
+
error,
|
|
9642
|
+
pathPattern: assignedTask.bucketPathPattern,
|
|
9643
|
+
sourceLocale: assignedTask.sourceLocale,
|
|
9644
|
+
targetLocale: assignedTask.targetLocale
|
|
9599
9645
|
};
|
|
9600
9646
|
}
|
|
9601
9647
|
});
|
|
@@ -11273,7 +11319,7 @@ async function renderHero2() {
|
|
|
11273
11319
|
// package.json
|
|
11274
11320
|
var package_default = {
|
|
11275
11321
|
name: "lingo.dev",
|
|
11276
|
-
version: "0.111.
|
|
11322
|
+
version: "0.111.16",
|
|
11277
11323
|
description: "Lingo.dev CLI",
|
|
11278
11324
|
private: false,
|
|
11279
11325
|
publishConfig: {
|