lingo.dev 0.74.3 → 0.74.5
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 +36 -40
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +23 -27
- package/build/cli.mjs.map +1 -1
- package/build/sdk.cjs +2 -7
- package/build/sdk.cjs.map +1 -1
- package/build/sdk.mjs +2 -7
- package/build/sdk.mjs.map +1 -1
- package/build/spec.cjs +2 -46
- package/build/spec.cjs.map +1 -1
- package/build/spec.mjs +2 -46
- package/build/spec.mjs.map +1 -1
- package/package.json +1 -1
- package/build/chunk-B6KMMXCA.mjs +0 -494
- package/build/chunk-B6KMMXCA.mjs.map +0 -1
- package/build/chunk-JZIJPDHI.cjs +0 -331
- package/build/chunk-JZIJPDHI.cjs.map +0 -1
- package/build/chunk-U3YIG2HS.cjs +0 -494
- package/build/chunk-U3YIG2HS.cjs.map +0 -1
- package/build/chunk-XU7ZJKQ2.mjs +0 -331
- package/build/chunk-XU7ZJKQ2.mjs.map +0 -1
package/build/cli.mjs
CHANGED
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ReplexicaEngine
|
|
3
|
-
} from "./chunk-XU7ZJKQ2.mjs";
|
|
4
|
-
import {
|
|
5
|
-
bucketTypeSchema,
|
|
6
|
-
bucketTypes,
|
|
7
|
-
defaultConfig,
|
|
8
|
-
localeCodeSchema,
|
|
9
|
-
localeCodes,
|
|
10
|
-
parseI18nConfig,
|
|
11
|
-
resolveLocaleCode,
|
|
12
|
-
resolveOverridenLocale
|
|
13
|
-
} from "./chunk-B6KMMXCA.mjs";
|
|
14
|
-
|
|
15
1
|
// src/cli/index.ts
|
|
16
2
|
import dotenv from "dotenv";
|
|
17
3
|
import { InteractiveCommand as InteractiveCommand2 } from "interactive-commander";
|
|
@@ -250,6 +236,7 @@ import Ora2 from "ora";
|
|
|
250
236
|
import _ from "lodash";
|
|
251
237
|
import fs2 from "fs";
|
|
252
238
|
import path2 from "path";
|
|
239
|
+
import { parseI18nConfig } from "@lingo.dev/_spec";
|
|
253
240
|
function getConfig(resave = true) {
|
|
254
241
|
const configFilePath = _getConfigFilePath();
|
|
255
242
|
const configFileExists = fs2.existsSync(configFilePath);
|
|
@@ -276,6 +263,7 @@ function _getConfigFilePath() {
|
|
|
276
263
|
}
|
|
277
264
|
|
|
278
265
|
// src/cli/cmd/init.ts
|
|
266
|
+
import { defaultConfig, resolveLocaleCode, bucketTypes } from "@lingo.dev/_spec";
|
|
279
267
|
import fs3 from "fs";
|
|
280
268
|
import { spawn } from "child_process";
|
|
281
269
|
import _2 from "lodash";
|
|
@@ -404,9 +392,10 @@ import { Command as Command2 } from "interactive-commander";
|
|
|
404
392
|
import _3 from "lodash";
|
|
405
393
|
import fs4 from "fs";
|
|
406
394
|
import path3 from "path";
|
|
395
|
+
import { defaultConfig as defaultConfig2 } from "@lingo.dev/_spec";
|
|
407
396
|
var config_default = new Command2().command("config").description("Print out the current configuration").helpOption("-h, --help", "Show help").action(async (options) => {
|
|
408
397
|
const fileConfig = loadReplexicaFileConfig();
|
|
409
|
-
const config = _3.merge({},
|
|
398
|
+
const config = _3.merge({}, defaultConfig2, fileConfig);
|
|
410
399
|
console.log(JSON.stringify(config, null, 2));
|
|
411
400
|
});
|
|
412
401
|
function loadReplexicaFileConfig() {
|
|
@@ -423,6 +412,7 @@ function loadReplexicaFileConfig() {
|
|
|
423
412
|
// src/cli/cmd/show/locale.ts
|
|
424
413
|
import { Command as Command3 } from "interactive-commander";
|
|
425
414
|
import Ora3 from "ora";
|
|
415
|
+
import { localeCodes } from "@lingo.dev/_spec";
|
|
426
416
|
var locale_default = new Command3().command("locale").description("Print out the list of locales").helpOption("-h, --help", "Show help").argument("<type>", 'Type of locales to show, either "sources" or "targets"').action(async (type) => {
|
|
427
417
|
const ora = Ora3();
|
|
428
418
|
try {
|
|
@@ -453,6 +443,7 @@ import Ora4 from "ora";
|
|
|
453
443
|
import _4 from "lodash";
|
|
454
444
|
import path4 from "path";
|
|
455
445
|
import * as glob from "glob";
|
|
446
|
+
import { resolveOverridenLocale } from "@lingo.dev/_spec";
|
|
456
447
|
function getBuckets(i18nConfig) {
|
|
457
448
|
const result = Object.entries(i18nConfig.buckets).map(([bucketType, bucketEntry]) => {
|
|
458
449
|
const includeItems = bucketEntry.include.map((item) => resolveBucketItem(item));
|
|
@@ -530,6 +521,7 @@ function resolveBucketItem(bucketItem) {
|
|
|
530
521
|
}
|
|
531
522
|
|
|
532
523
|
// src/cli/cmd/show/files.ts
|
|
524
|
+
import { resolveOverridenLocale as resolveOverridenLocale2 } from "@lingo.dev/_spec";
|
|
533
525
|
var files_default = new Command4().command("files").description("Print out the list of files managed by Lingo.dev").option("--source", "Only show source files").option("--target", "Only show target files").helpOption("-h, --help", "Show help").action(async (type) => {
|
|
534
526
|
const ora = Ora4();
|
|
535
527
|
try {
|
|
@@ -544,10 +536,10 @@ var files_default = new Command4().command("files").description("Print out the l
|
|
|
544
536
|
const buckets = getBuckets(i18nConfig);
|
|
545
537
|
for (const bucket of buckets) {
|
|
546
538
|
for (const bucketConfig of bucket.config) {
|
|
547
|
-
const sourceLocale =
|
|
539
|
+
const sourceLocale = resolveOverridenLocale2(i18nConfig.locale.source, bucketConfig.delimiter);
|
|
548
540
|
const sourcePath = bucketConfig.pathPattern.replace(/\[locale\]/g, sourceLocale);
|
|
549
541
|
const targetPaths = i18nConfig.locale.targets.map((_targetLocale) => {
|
|
550
|
-
const targetLocale =
|
|
542
|
+
const targetLocale = resolveOverridenLocale2(_targetLocale, bucketConfig.delimiter);
|
|
551
543
|
return bucketConfig.pathPattern.replace(/\[locale\]/g, targetLocale);
|
|
552
544
|
});
|
|
553
545
|
const result = [];
|
|
@@ -579,6 +571,8 @@ var files_default = new Command4().command("files").description("Print out the l
|
|
|
579
571
|
var show_default = new Command5().command("show").description("Prints out the current configuration").helpOption("-h, --help", "Show help").addCommand(config_default).addCommand(locale_default).addCommand(files_default);
|
|
580
572
|
|
|
581
573
|
// src/cli/cmd/i18n.ts
|
|
574
|
+
import { bucketTypeSchema, localeCodeSchema, resolveOverridenLocale as resolveOverridenLocale3 } from "@lingo.dev/_spec";
|
|
575
|
+
import { ReplexicaEngine } from "@lingo.dev/_sdk";
|
|
582
576
|
import { Command as Command6 } from "interactive-commander";
|
|
583
577
|
import Z4 from "zod";
|
|
584
578
|
import _17 from "lodash";
|
|
@@ -2308,6 +2302,7 @@ function createNewLineLoader() {
|
|
|
2308
2302
|
},
|
|
2309
2303
|
async push(locale, data, originalInput) {
|
|
2310
2304
|
if (!data) return "";
|
|
2305
|
+
console.log(data);
|
|
2311
2306
|
const trimmed = data.replace(/[\r\n]+$/, "");
|
|
2312
2307
|
if (originalInput?.match(/[\r\n]$/)) {
|
|
2313
2308
|
const ending = originalInput?.includes("\r\n") ? "\r\n" : originalInput?.includes("\r") ? "\r" : "\n";
|
|
@@ -2477,7 +2472,6 @@ function createBucketLoader(bucketType, bucketPathPattern) {
|
|
|
2477
2472
|
case "dato":
|
|
2478
2473
|
return composeLoaders(
|
|
2479
2474
|
createDatoLoader(bucketPathPattern),
|
|
2480
|
-
createNewLineLoader(),
|
|
2481
2475
|
createSyncLoader(),
|
|
2482
2476
|
createFlatLoader(),
|
|
2483
2477
|
createUnlocalizableLoader()
|
|
@@ -2672,7 +2666,7 @@ var i18n_default = new Command6().command("i18n").description("Run Localization
|
|
|
2672
2666
|
ora.start("Creating i18n.lock...");
|
|
2673
2667
|
for (const bucket of buckets) {
|
|
2674
2668
|
for (const bucketConfig of bucket.config) {
|
|
2675
|
-
const sourceLocale =
|
|
2669
|
+
const sourceLocale = resolveOverridenLocale3(i18nConfig.locale.source, bucketConfig.delimiter);
|
|
2676
2670
|
const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern);
|
|
2677
2671
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
2678
2672
|
await bucketLoader.init();
|
|
@@ -2693,7 +2687,7 @@ var i18n_default = new Command6().command("i18n").description("Run Localization
|
|
|
2693
2687
|
cacheOra.info(`Processing bucket: ${bucket.type}`);
|
|
2694
2688
|
for (const bucketConfig of bucket.config) {
|
|
2695
2689
|
const bucketOra = ora.info(`Processing path: ${bucketConfig.pathPattern}`);
|
|
2696
|
-
const sourceLocale =
|
|
2690
|
+
const sourceLocale = resolveOverridenLocale3(i18nConfig.locale.source, bucketConfig.delimiter);
|
|
2697
2691
|
const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern);
|
|
2698
2692
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
2699
2693
|
await bucketLoader.init();
|
|
@@ -2728,7 +2722,7 @@ var i18n_default = new Command6().command("i18n").description("Run Localization
|
|
|
2728
2722
|
let requiresUpdate = false;
|
|
2729
2723
|
for (const bucket of buckets) {
|
|
2730
2724
|
for (const bucketConfig of bucket.config) {
|
|
2731
|
-
const sourceLocale =
|
|
2725
|
+
const sourceLocale = resolveOverridenLocale3(i18nConfig.locale.source, bucketConfig.delimiter);
|
|
2732
2726
|
const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern);
|
|
2733
2727
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
2734
2728
|
await bucketLoader.init();
|
|
@@ -2754,13 +2748,13 @@ var i18n_default = new Command6().command("i18n").description("Run Localization
|
|
|
2754
2748
|
ora.info(`Processing bucket: ${bucket.type}`);
|
|
2755
2749
|
for (const bucketConfig of bucket.config) {
|
|
2756
2750
|
const bucketOra = Ora5({ indent: 2 }).info(`Processing path: ${bucketConfig.pathPattern}`);
|
|
2757
|
-
const sourceLocale =
|
|
2751
|
+
const sourceLocale = resolveOverridenLocale3(i18nConfig.locale.source, bucketConfig.delimiter);
|
|
2758
2752
|
const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern);
|
|
2759
2753
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
2760
2754
|
await bucketLoader.init();
|
|
2761
2755
|
let sourceData = await bucketLoader.pull(sourceLocale);
|
|
2762
2756
|
for (const _targetLocale of targetLocales) {
|
|
2763
|
-
const targetLocale =
|
|
2757
|
+
const targetLocale = resolveOverridenLocale3(_targetLocale, bucketConfig.delimiter);
|
|
2764
2758
|
try {
|
|
2765
2759
|
bucketOra.start(`[${sourceLocale} -> ${targetLocale}] (0%) Localization in progress...`);
|
|
2766
2760
|
sourceData = await bucketLoader.pull(sourceLocale);
|
|
@@ -3062,6 +3056,7 @@ Editing value for: ${chalk.cyan(key)}`);
|
|
|
3062
3056
|
import { Command as Command7 } from "interactive-commander";
|
|
3063
3057
|
import Z5 from "zod";
|
|
3064
3058
|
import Ora6 from "ora";
|
|
3059
|
+
import { resolveOverridenLocale as resolveOverridenLocale4 } from "@lingo.dev/_spec";
|
|
3065
3060
|
var lockfile_default = new Command7().command("lockfile").description("Create a lockfile if it does not exist").helpOption("-h, --help", "Show help").option("-f, --force", "Force create a lockfile").action(async (options) => {
|
|
3066
3061
|
const flags = flagsSchema.parse(options);
|
|
3067
3062
|
const ora = Ora6();
|
|
@@ -3073,7 +3068,7 @@ var lockfile_default = new Command7().command("lockfile").description("Create a
|
|
|
3073
3068
|
const buckets = getBuckets(i18nConfig);
|
|
3074
3069
|
for (const bucket of buckets) {
|
|
3075
3070
|
for (const bucketConfig of bucket.config) {
|
|
3076
|
-
const sourceLocale =
|
|
3071
|
+
const sourceLocale = resolveOverridenLocale4(i18nConfig.locale.source, bucketConfig.delimiter);
|
|
3077
3072
|
const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern);
|
|
3078
3073
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
3079
3074
|
const sourceData = await bucketLoader.pull(sourceLocale);
|
|
@@ -3088,6 +3083,7 @@ var flagsSchema = Z5.object({
|
|
|
3088
3083
|
});
|
|
3089
3084
|
|
|
3090
3085
|
// src/cli/cmd/cleanup.ts
|
|
3086
|
+
import { resolveOverridenLocale as resolveOverridenLocale5 } from "@lingo.dev/_spec";
|
|
3091
3087
|
import { Command as Command8 } from "interactive-commander";
|
|
3092
3088
|
import _18 from "lodash";
|
|
3093
3089
|
import Ora7 from "ora";
|
|
@@ -3108,14 +3104,14 @@ var cleanup_default = new Command8().command("cleanup").description("Remove keys
|
|
|
3108
3104
|
console.log();
|
|
3109
3105
|
ora.info(`Processing bucket: ${bucket.type}`);
|
|
3110
3106
|
for (const bucketConfig of bucket.config) {
|
|
3111
|
-
const sourceLocale =
|
|
3107
|
+
const sourceLocale = resolveOverridenLocale5(i18nConfig.locale.source, bucketConfig.delimiter);
|
|
3112
3108
|
const bucketOra = Ora7({ indent: 2 }).info(`Processing path: ${bucketConfig.pathPattern}`);
|
|
3113
3109
|
const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern);
|
|
3114
3110
|
bucketLoader.setDefaultLocale(sourceLocale);
|
|
3115
3111
|
const sourceData = await bucketLoader.pull(sourceLocale);
|
|
3116
3112
|
const sourceKeys = Object.keys(sourceData);
|
|
3117
3113
|
for (const _targetLocale of targetLocales) {
|
|
3118
|
-
const targetLocale =
|
|
3114
|
+
const targetLocale = resolveOverridenLocale5(_targetLocale, bucketConfig.delimiter);
|
|
3119
3115
|
try {
|
|
3120
3116
|
const targetData = await bucketLoader.pull(targetLocale);
|
|
3121
3117
|
const targetKeys = Object.keys(targetData);
|
|
@@ -3180,7 +3176,7 @@ function displaySummary(results) {
|
|
|
3180
3176
|
// package.json
|
|
3181
3177
|
var package_default = {
|
|
3182
3178
|
name: "lingo.dev",
|
|
3183
|
-
version: "0.74.
|
|
3179
|
+
version: "0.74.5",
|
|
3184
3180
|
description: "Lingo.dev CLI",
|
|
3185
3181
|
private: false,
|
|
3186
3182
|
publishConfig: {
|