lingo.dev 0.107.2 → 0.107.3
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 +224 -135
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +136 -47
- package/build/cli.mjs.map +1 -1
- package/package.json +4 -4
package/build/cli.mjs
CHANGED
|
@@ -510,7 +510,7 @@ async function waitForApiKey(cb) {
|
|
|
510
510
|
// src/cli/cmd/logout.ts
|
|
511
511
|
import { Command as Command3 } from "interactive-commander";
|
|
512
512
|
import Ora3 from "ora";
|
|
513
|
-
var logout_default = new Command3().command("logout").description("
|
|
513
|
+
var logout_default = new Command3().command("logout").description("Log out from Lingo.dev API").helpOption("-h, --help", "Show help").action(async () => {
|
|
514
514
|
try {
|
|
515
515
|
await renderClear();
|
|
516
516
|
await renderSpacer();
|
|
@@ -1483,7 +1483,7 @@ import {
|
|
|
1483
1483
|
} from "@lingo.dev/_spec";
|
|
1484
1484
|
import { Command as Command12 } from "interactive-commander";
|
|
1485
1485
|
import Z3 from "zod";
|
|
1486
|
-
import
|
|
1486
|
+
import _31 from "lodash";
|
|
1487
1487
|
import Ora7 from "ora";
|
|
1488
1488
|
|
|
1489
1489
|
// src/cli/loaders/_utils.ts
|
|
@@ -1708,7 +1708,7 @@ function createTextFileLoader(pathPattern) {
|
|
|
1708
1708
|
const trimmedResult = result.trim();
|
|
1709
1709
|
return trimmedResult;
|
|
1710
1710
|
},
|
|
1711
|
-
async push(locale, data,
|
|
1711
|
+
async push(locale, data, _35, originalLocale) {
|
|
1712
1712
|
const draftPath = pathPattern.replaceAll("[locale]", locale);
|
|
1713
1713
|
const finalPath = path10.resolve(draftPath);
|
|
1714
1714
|
const dirPath = path10.dirname(finalPath);
|
|
@@ -2287,7 +2287,7 @@ function createPropertiesLoader() {
|
|
|
2287
2287
|
return result;
|
|
2288
2288
|
},
|
|
2289
2289
|
async push(locale, payload) {
|
|
2290
|
-
const result = Object.entries(payload).filter(([
|
|
2290
|
+
const result = Object.entries(payload).filter(([_35, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
|
|
2291
2291
|
return result;
|
|
2292
2292
|
}
|
|
2293
2293
|
});
|
|
@@ -2558,12 +2558,12 @@ function createUnlocalizableLoader(returnUnlocalizedKeys = false) {
|
|
|
2558
2558
|
const unlocalizableKeys = _getUnlocalizableKeys(input2);
|
|
2559
2559
|
const result = _13.omitBy(
|
|
2560
2560
|
input2,
|
|
2561
|
-
(
|
|
2561
|
+
(_35, key) => unlocalizableKeys.includes(key)
|
|
2562
2562
|
);
|
|
2563
2563
|
if (returnUnlocalizedKeys) {
|
|
2564
2564
|
result.unlocalizable = _13.omitBy(
|
|
2565
2565
|
input2,
|
|
2566
|
-
(
|
|
2566
|
+
(_35, key) => !unlocalizableKeys.includes(key)
|
|
2567
2567
|
);
|
|
2568
2568
|
}
|
|
2569
2569
|
return result;
|
|
@@ -2573,7 +2573,7 @@ function createUnlocalizableLoader(returnUnlocalizedKeys = false) {
|
|
|
2573
2573
|
const result = _13.merge(
|
|
2574
2574
|
{},
|
|
2575
2575
|
data,
|
|
2576
|
-
_13.omitBy(originalInput, (
|
|
2576
|
+
_13.omitBy(originalInput, (_35, key) => !unlocalizableKeys.includes(key))
|
|
2577
2577
|
);
|
|
2578
2578
|
return result;
|
|
2579
2579
|
}
|
|
@@ -2604,7 +2604,7 @@ function _getUnlocalizableKeys(input2) {
|
|
|
2604
2604
|
}
|
|
2605
2605
|
}
|
|
2606
2606
|
return false;
|
|
2607
|
-
}).map(([key,
|
|
2607
|
+
}).map(([key, _35]) => key);
|
|
2608
2608
|
}
|
|
2609
2609
|
|
|
2610
2610
|
// src/cli/loaders/po/index.ts
|
|
@@ -5173,7 +5173,7 @@ var AST = class _AST {
|
|
|
5173
5173
|
if (!this.type) {
|
|
5174
5174
|
const noEmpty = this.isStart() && this.isEnd();
|
|
5175
5175
|
const src = this.#parts.map((p) => {
|
|
5176
|
-
const [re,
|
|
5176
|
+
const [re, _35, hasMagic, uflag] = typeof p === "string" ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
|
5177
5177
|
this.#hasMagic = this.#hasMagic || hasMagic;
|
|
5178
5178
|
this.#uflag = this.#uflag || uflag;
|
|
5179
5179
|
return re;
|
|
@@ -5246,7 +5246,7 @@ var AST = class _AST {
|
|
|
5246
5246
|
if (typeof p === "string") {
|
|
5247
5247
|
throw new Error("string type in extglob ast??");
|
|
5248
5248
|
}
|
|
5249
|
-
const [re,
|
|
5249
|
+
const [re, _35, _hasMagic, uflag] = p.toRegExpSource(dot);
|
|
5250
5250
|
this.#uflag = this.#uflag || uflag;
|
|
5251
5251
|
return re;
|
|
5252
5252
|
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
|
|
@@ -5491,7 +5491,7 @@ var Minimatch = class {
|
|
|
5491
5491
|
}
|
|
5492
5492
|
return false;
|
|
5493
5493
|
}
|
|
5494
|
-
debug(...
|
|
5494
|
+
debug(..._35) {
|
|
5495
5495
|
}
|
|
5496
5496
|
make() {
|
|
5497
5497
|
const pattern = this.pattern;
|
|
@@ -5513,7 +5513,7 @@ var Minimatch = class {
|
|
|
5513
5513
|
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
5514
5514
|
this.globParts = this.preprocess(rawGlobParts);
|
|
5515
5515
|
this.debug(this.pattern, this.globParts);
|
|
5516
|
-
let set = this.globParts.map((s,
|
|
5516
|
+
let set = this.globParts.map((s, _35, __) => {
|
|
5517
5517
|
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
5518
5518
|
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
5519
5519
|
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
@@ -6540,11 +6540,87 @@ function createTxtLoader() {
|
|
|
6540
6540
|
const sortedEntries = Object.entries(payload).sort(
|
|
6541
6541
|
([a], [b]) => parseInt(a) - parseInt(b)
|
|
6542
6542
|
);
|
|
6543
|
-
return sortedEntries.map(([
|
|
6543
|
+
return sortedEntries.map(([_35, value]) => value).join("\n");
|
|
6544
6544
|
}
|
|
6545
6545
|
});
|
|
6546
6546
|
}
|
|
6547
6547
|
|
|
6548
|
+
// src/cli/loaders/json-dictionary.ts
|
|
6549
|
+
import _28 from "lodash";
|
|
6550
|
+
function createJsonDictionaryLoader() {
|
|
6551
|
+
return createLoader({
|
|
6552
|
+
pull: async (locale, input2) => {
|
|
6553
|
+
return extractTranslatables(input2, locale);
|
|
6554
|
+
},
|
|
6555
|
+
push: async (locale, data, originalInput, originalLocale) => {
|
|
6556
|
+
if (!originalInput) {
|
|
6557
|
+
throw new Error("Error while parsing json-dictionary bucket");
|
|
6558
|
+
}
|
|
6559
|
+
const input2 = _28.cloneDeep(originalInput);
|
|
6560
|
+
function walk(obj, dataNode, path17 = []) {
|
|
6561
|
+
if (Array.isArray(obj) && Array.isArray(dataNode)) {
|
|
6562
|
+
obj.forEach(
|
|
6563
|
+
(item, idx) => walk(item, dataNode[idx], [...path17, String(idx)])
|
|
6564
|
+
);
|
|
6565
|
+
} else if (obj && typeof obj === "object" && dataNode && typeof dataNode === "object" && !Array.isArray(dataNode)) {
|
|
6566
|
+
for (const key of Object.keys(obj)) {
|
|
6567
|
+
if (dataNode.hasOwnProperty(key)) {
|
|
6568
|
+
walk(obj[key], dataNode[key], [...path17, key]);
|
|
6569
|
+
}
|
|
6570
|
+
}
|
|
6571
|
+
} else if (obj && typeof obj === "object" && !Array.isArray(obj) && typeof dataNode === "string") {
|
|
6572
|
+
setNestedLocale(input2, path17, locale, dataNode, originalLocale);
|
|
6573
|
+
}
|
|
6574
|
+
}
|
|
6575
|
+
walk(originalInput, data);
|
|
6576
|
+
return input2;
|
|
6577
|
+
}
|
|
6578
|
+
});
|
|
6579
|
+
}
|
|
6580
|
+
function extractTranslatables(obj, locale) {
|
|
6581
|
+
if (Array.isArray(obj)) {
|
|
6582
|
+
return obj.map((item) => extractTranslatables(item, locale));
|
|
6583
|
+
} else if (isTranslatableObject(obj, locale)) {
|
|
6584
|
+
return obj[locale];
|
|
6585
|
+
} else if (obj && typeof obj === "object") {
|
|
6586
|
+
const result = {};
|
|
6587
|
+
for (const key of Object.keys(obj)) {
|
|
6588
|
+
const value = extractTranslatables(obj[key], locale);
|
|
6589
|
+
if (typeof value === "object" && value !== null && Object.keys(value).length > 0 || Array.isArray(value) && value.length > 0 || typeof value === "string" && value.length > 0) {
|
|
6590
|
+
result[key] = value;
|
|
6591
|
+
}
|
|
6592
|
+
}
|
|
6593
|
+
return result;
|
|
6594
|
+
}
|
|
6595
|
+
return void 0;
|
|
6596
|
+
}
|
|
6597
|
+
function isTranslatableObject(obj, locale) {
|
|
6598
|
+
return obj && typeof obj === "object" && !Array.isArray(obj) && Object.prototype.hasOwnProperty.call(obj, locale);
|
|
6599
|
+
}
|
|
6600
|
+
function setNestedLocale(obj, path17, locale, value, originalLocale) {
|
|
6601
|
+
let curr = obj;
|
|
6602
|
+
for (let i = 0; i < path17.length - 1; i++) {
|
|
6603
|
+
const key = path17[i];
|
|
6604
|
+
if (!(key in curr)) curr[key] = {};
|
|
6605
|
+
curr = curr[key];
|
|
6606
|
+
}
|
|
6607
|
+
const last = path17[path17.length - 1];
|
|
6608
|
+
if (curr[last] && typeof curr[last] === "object") {
|
|
6609
|
+
curr[last][locale] = value;
|
|
6610
|
+
if (originalLocale && curr[last][originalLocale]) {
|
|
6611
|
+
const entries = Object.entries(curr[last]);
|
|
6612
|
+
const first = entries.filter(([k]) => k === originalLocale);
|
|
6613
|
+
const rest = entries.filter(([k]) => k !== originalLocale).sort(([a], [b]) => a.localeCompare(b));
|
|
6614
|
+
const ordered = [...first, ...rest];
|
|
6615
|
+
const reordered = {};
|
|
6616
|
+
for (const [k, v] of ordered) {
|
|
6617
|
+
reordered[k] = v;
|
|
6618
|
+
}
|
|
6619
|
+
curr[last] = reordered;
|
|
6620
|
+
}
|
|
6621
|
+
}
|
|
6622
|
+
}
|
|
6623
|
+
|
|
6548
6624
|
// src/cli/loaders/index.ts
|
|
6549
6625
|
function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys, lockedPatterns, ignoredKeys) {
|
|
6550
6626
|
switch (bucketType) {
|
|
@@ -6776,6 +6852,19 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
6776
6852
|
createSyncLoader(),
|
|
6777
6853
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
6778
6854
|
);
|
|
6855
|
+
case "json-dictionary":
|
|
6856
|
+
return composeLoaders(
|
|
6857
|
+
createTextFileLoader(bucketPathPattern),
|
|
6858
|
+
createPrettierLoader({ parser: "json", bucketPathPattern }),
|
|
6859
|
+
createJsonLoader(),
|
|
6860
|
+
createJsonDictionaryLoader(),
|
|
6861
|
+
createEnsureKeyOrderLoader(),
|
|
6862
|
+
createFlatLoader(),
|
|
6863
|
+
createInjectLocaleLoader(options.injectLocale),
|
|
6864
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
6865
|
+
createSyncLoader(),
|
|
6866
|
+
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
6867
|
+
);
|
|
6779
6868
|
}
|
|
6780
6869
|
}
|
|
6781
6870
|
|
|
@@ -6818,7 +6907,7 @@ function createLingoLocalizer(params) {
|
|
|
6818
6907
|
|
|
6819
6908
|
// src/cli/processor/basic.ts
|
|
6820
6909
|
import { generateText } from "ai";
|
|
6821
|
-
import
|
|
6910
|
+
import _29 from "lodash";
|
|
6822
6911
|
function createBasicTranslator(model, systemPrompt) {
|
|
6823
6912
|
return async (input2, onProgress) => {
|
|
6824
6913
|
const chunks = extractPayloadChunks(input2.processableData);
|
|
@@ -6832,7 +6921,7 @@ function createBasicTranslator(model, systemPrompt) {
|
|
|
6832
6921
|
subResults.push(result2);
|
|
6833
6922
|
onProgress(i / chunks.length * 100, chunk, result2);
|
|
6834
6923
|
}
|
|
6835
|
-
const result =
|
|
6924
|
+
const result = _29.merge({}, ...subResults);
|
|
6836
6925
|
return result;
|
|
6837
6926
|
};
|
|
6838
6927
|
async function doJob(input2) {
|
|
@@ -7079,7 +7168,7 @@ async function trackEvent(distinctId, event, properties) {
|
|
|
7079
7168
|
}
|
|
7080
7169
|
|
|
7081
7170
|
// src/cli/utils/delta.ts
|
|
7082
|
-
import
|
|
7171
|
+
import _30 from "lodash";
|
|
7083
7172
|
import z from "zod";
|
|
7084
7173
|
|
|
7085
7174
|
// src/cli/utils/fs.ts
|
|
@@ -7128,11 +7217,11 @@ function createDeltaProcessor(fileKey) {
|
|
|
7128
7217
|
return checkIfFileExists(lockfilePath);
|
|
7129
7218
|
},
|
|
7130
7219
|
async calculateDelta(params) {
|
|
7131
|
-
let added =
|
|
7220
|
+
let added = _30.difference(
|
|
7132
7221
|
Object.keys(params.sourceData),
|
|
7133
7222
|
Object.keys(params.targetData)
|
|
7134
7223
|
);
|
|
7135
|
-
let removed =
|
|
7224
|
+
let removed = _30.difference(
|
|
7136
7225
|
Object.keys(params.targetData),
|
|
7137
7226
|
Object.keys(params.sourceData)
|
|
7138
7227
|
);
|
|
@@ -7194,7 +7283,7 @@ function createDeltaProcessor(fileKey) {
|
|
|
7194
7283
|
await this.saveLock(lockfileData);
|
|
7195
7284
|
},
|
|
7196
7285
|
async createChecksums(sourceData) {
|
|
7197
|
-
const checksums =
|
|
7286
|
+
const checksums = _30.mapValues(sourceData, (value) => md5(value));
|
|
7198
7287
|
return checksums;
|
|
7199
7288
|
}
|
|
7200
7289
|
};
|
|
@@ -7364,7 +7453,7 @@ var i18n_default = new Command12().command("i18n").description("Run Localization
|
|
|
7364
7453
|
const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
|
|
7365
7454
|
const sourceChecksums = await deltaProcessor.createChecksums(sourceData);
|
|
7366
7455
|
const savedChecksums = await deltaProcessor.loadChecksums();
|
|
7367
|
-
const updatedSourceData =
|
|
7456
|
+
const updatedSourceData = _31.pickBy(
|
|
7368
7457
|
sourceData,
|
|
7369
7458
|
(value, key) => sourceChecksums[key] !== savedChecksums[key]
|
|
7370
7459
|
);
|
|
@@ -7378,15 +7467,15 @@ var i18n_default = new Command12().command("i18n").description("Run Localization
|
|
|
7378
7467
|
bucketPath.delimiter
|
|
7379
7468
|
);
|
|
7380
7469
|
const { unlocalizable: targetUnlocalizable, ...targetData } = await bucketLoader.pull(targetLocale);
|
|
7381
|
-
const missingKeys =
|
|
7470
|
+
const missingKeys = _31.difference(
|
|
7382
7471
|
Object.keys(sourceData),
|
|
7383
7472
|
Object.keys(targetData)
|
|
7384
7473
|
);
|
|
7385
|
-
const extraKeys =
|
|
7474
|
+
const extraKeys = _31.difference(
|
|
7386
7475
|
Object.keys(targetData),
|
|
7387
7476
|
Object.keys(sourceData)
|
|
7388
7477
|
);
|
|
7389
|
-
const unlocalizableDataDiff = !
|
|
7478
|
+
const unlocalizableDataDiff = !_31.isEqual(
|
|
7390
7479
|
sourceUnlocalizable,
|
|
7391
7480
|
targetUnlocalizable
|
|
7392
7481
|
);
|
|
@@ -7467,13 +7556,13 @@ var i18n_default = new Command12().command("i18n").description("Run Localization
|
|
|
7467
7556
|
targetData,
|
|
7468
7557
|
checksums: checksums2
|
|
7469
7558
|
});
|
|
7470
|
-
let processableData =
|
|
7559
|
+
let processableData = _31.chain(sourceData).entries().filter(
|
|
7471
7560
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!flags.force
|
|
7472
7561
|
).fromPairs().value();
|
|
7473
7562
|
if (flags.key) {
|
|
7474
|
-
processableData =
|
|
7563
|
+
processableData = _31.pickBy(
|
|
7475
7564
|
processableData,
|
|
7476
|
-
(
|
|
7565
|
+
(_35, key) => key === flags.key
|
|
7477
7566
|
);
|
|
7478
7567
|
}
|
|
7479
7568
|
if (flags.verbose) {
|
|
@@ -7506,13 +7595,13 @@ var i18n_default = new Command12().command("i18n").description("Run Localization
|
|
|
7506
7595
|
if (flags.verbose) {
|
|
7507
7596
|
bucketOra.info(JSON.stringify(processedTargetData, null, 2));
|
|
7508
7597
|
}
|
|
7509
|
-
let finalTargetData =
|
|
7598
|
+
let finalTargetData = _31.merge(
|
|
7510
7599
|
{},
|
|
7511
7600
|
sourceData,
|
|
7512
7601
|
targetData,
|
|
7513
7602
|
processedTargetData
|
|
7514
7603
|
);
|
|
7515
|
-
finalTargetData =
|
|
7604
|
+
finalTargetData = _31.chain(finalTargetData).entries().map(([key, value]) => {
|
|
7516
7605
|
const renaming = delta.renamed.find(
|
|
7517
7606
|
([oldKey, newKey]) => oldKey === key
|
|
7518
7607
|
);
|
|
@@ -7536,7 +7625,7 @@ var i18n_default = new Command12().command("i18n").description("Run Localization
|
|
|
7536
7625
|
`Applying changes to ${bucketPath} (${targetLocale})`
|
|
7537
7626
|
);
|
|
7538
7627
|
}
|
|
7539
|
-
const finalDiffSize =
|
|
7628
|
+
const finalDiffSize = _31.chain(finalTargetData).omitBy((value, key) => value === targetData[key]).size().value();
|
|
7540
7629
|
await bucketLoader.push(targetLocale, finalTargetData);
|
|
7541
7630
|
if (finalDiffSize > 0 || flags.force) {
|
|
7542
7631
|
bucketOra.succeed(
|
|
@@ -7713,7 +7802,7 @@ Reviewing changes for ${chalk6.blue(args.pathPattern)} (${chalk6.yellow(
|
|
|
7713
7802
|
return args.currentData;
|
|
7714
7803
|
}
|
|
7715
7804
|
const customData = { ...args.currentData };
|
|
7716
|
-
const changes =
|
|
7805
|
+
const changes = _31.reduce(
|
|
7717
7806
|
args.proposedData,
|
|
7718
7807
|
(result, value, key) => {
|
|
7719
7808
|
if (args.currentData[key] !== value) {
|
|
@@ -7786,7 +7875,7 @@ import path15 from "path";
|
|
|
7786
7875
|
import Z4 from "zod";
|
|
7787
7876
|
import YAML5 from "yaml";
|
|
7788
7877
|
import { MD5 as MD52 } from "object-hash";
|
|
7789
|
-
import
|
|
7878
|
+
import _32 from "lodash";
|
|
7790
7879
|
function createLockfileHelper() {
|
|
7791
7880
|
return {
|
|
7792
7881
|
isLockfileExists: () => {
|
|
@@ -7796,18 +7885,18 @@ function createLockfileHelper() {
|
|
|
7796
7885
|
registerSourceData: (pathPattern, sourceData) => {
|
|
7797
7886
|
const lockfile = _loadLockfile();
|
|
7798
7887
|
const sectionKey = MD52(pathPattern);
|
|
7799
|
-
const sectionChecksums =
|
|
7888
|
+
const sectionChecksums = _32.mapValues(sourceData, (value) => MD52(value));
|
|
7800
7889
|
lockfile.checksums[sectionKey] = sectionChecksums;
|
|
7801
7890
|
_saveLockfile(lockfile);
|
|
7802
7891
|
},
|
|
7803
7892
|
registerPartialSourceData: (pathPattern, partialSourceData) => {
|
|
7804
7893
|
const lockfile = _loadLockfile();
|
|
7805
7894
|
const sectionKey = MD52(pathPattern);
|
|
7806
|
-
const sectionChecksums =
|
|
7895
|
+
const sectionChecksums = _32.mapValues(
|
|
7807
7896
|
partialSourceData,
|
|
7808
7897
|
(value) => MD52(value)
|
|
7809
7898
|
);
|
|
7810
|
-
lockfile.checksums[sectionKey] =
|
|
7899
|
+
lockfile.checksums[sectionKey] = _32.merge(
|
|
7811
7900
|
{},
|
|
7812
7901
|
lockfile.checksums[sectionKey] ?? {},
|
|
7813
7902
|
sectionChecksums
|
|
@@ -7817,9 +7906,9 @@ function createLockfileHelper() {
|
|
|
7817
7906
|
extractUpdatedData: (pathPattern, sourceData) => {
|
|
7818
7907
|
const lockfile = _loadLockfile();
|
|
7819
7908
|
const sectionKey = MD52(pathPattern);
|
|
7820
|
-
const currentChecksums =
|
|
7909
|
+
const currentChecksums = _32.mapValues(sourceData, (value) => MD52(value));
|
|
7821
7910
|
const savedChecksums = lockfile.checksums[sectionKey] || {};
|
|
7822
|
-
const updatedData =
|
|
7911
|
+
const updatedData = _32.pickBy(
|
|
7823
7912
|
sourceData,
|
|
7824
7913
|
(value, key) => savedChecksums[key] !== currentChecksums[key]
|
|
7825
7914
|
);
|
|
@@ -7903,7 +7992,7 @@ var flagsSchema = Z5.object({
|
|
|
7903
7992
|
// src/cli/cmd/cleanup.ts
|
|
7904
7993
|
import { resolveOverriddenLocale as resolveOverriddenLocale5 } from "@lingo.dev/_spec";
|
|
7905
7994
|
import { Command as Command14 } from "interactive-commander";
|
|
7906
|
-
import
|
|
7995
|
+
import _33 from "lodash";
|
|
7907
7996
|
import Ora9 from "ora";
|
|
7908
7997
|
var cleanup_default = new Command14().command("cleanup").description(
|
|
7909
7998
|
"Remove keys from target files that do not exist in the source file"
|
|
@@ -7954,7 +8043,7 @@ var cleanup_default = new Command14().command("cleanup").description(
|
|
|
7954
8043
|
try {
|
|
7955
8044
|
const targetData = await bucketLoader.pull(targetLocale);
|
|
7956
8045
|
const targetKeys = Object.keys(targetData);
|
|
7957
|
-
const keysToRemove =
|
|
8046
|
+
const keysToRemove = _33.difference(targetKeys, sourceKeys);
|
|
7958
8047
|
if (keysToRemove.length === 0) {
|
|
7959
8048
|
bucketOra.succeed(`[${targetLocale}] No keys to remove`);
|
|
7960
8049
|
continue;
|
|
@@ -7969,7 +8058,7 @@ var cleanup_default = new Command14().command("cleanup").description(
|
|
|
7969
8058
|
);
|
|
7970
8059
|
}
|
|
7971
8060
|
if (!options.dryRun) {
|
|
7972
|
-
const cleanedData =
|
|
8061
|
+
const cleanedData = _33.pick(targetData, sourceKeys);
|
|
7973
8062
|
await bucketLoader.push(targetLocale, cleanedData);
|
|
7974
8063
|
bucketOra.succeed(
|
|
7975
8064
|
`[${targetLocale}] Removed ${keysToRemove.length} keys`
|
|
@@ -8030,7 +8119,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
8030
8119
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
8031
8120
|
import Z6 from "zod";
|
|
8032
8121
|
import { ReplexicaEngine } from "@lingo.dev/_sdk";
|
|
8033
|
-
var mcp_default = new Command15().command("mcp").description("Use Lingo.dev model context provider with your AI agent").helpOption("-h, --help", "Show help").action(async (
|
|
8122
|
+
var mcp_default = new Command15().command("mcp").description("Use Lingo.dev model context provider with your AI agent").helpOption("-h, --help", "Show help").action(async (_35, program) => {
|
|
8034
8123
|
const apiKey = program.args[0];
|
|
8035
8124
|
const settings = getSettings(apiKey);
|
|
8036
8125
|
if (!settings.auth.apiKey) {
|
|
@@ -8580,7 +8669,7 @@ async function plan(input2) {
|
|
|
8580
8669
|
import chalk12 from "chalk";
|
|
8581
8670
|
import { Listr as Listr3 } from "listr2";
|
|
8582
8671
|
import pLimit from "p-limit";
|
|
8583
|
-
import
|
|
8672
|
+
import _34 from "lodash";
|
|
8584
8673
|
var MAX_WORKER_COUNT = 10;
|
|
8585
8674
|
async function execute(input2) {
|
|
8586
8675
|
const effectiveConcurrency = Math.min(
|
|
@@ -8615,7 +8704,7 @@ async function execute(input2) {
|
|
|
8615
8704
|
const workerTasks = [];
|
|
8616
8705
|
for (let i = 0; i < workersCount; i++) {
|
|
8617
8706
|
const assignedTasks = ctx.tasks.filter(
|
|
8618
|
-
(
|
|
8707
|
+
(_35, idx) => idx % workersCount === i
|
|
8619
8708
|
);
|
|
8620
8709
|
workerTasks.push(
|
|
8621
8710
|
createWorkerTask({
|
|
@@ -8715,7 +8804,7 @@ function createWorkerTask(args) {
|
|
|
8715
8804
|
targetData,
|
|
8716
8805
|
checksums
|
|
8717
8806
|
});
|
|
8718
|
-
const processableData =
|
|
8807
|
+
const processableData = _34.chain(sourceData).entries().filter(
|
|
8719
8808
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
|
|
8720
8809
|
).filter(
|
|
8721
8810
|
([key]) => !assignedTask.onlyKeys.length || assignedTask.onlyKeys?.some(
|
|
@@ -8742,7 +8831,7 @@ function createWorkerTask(args) {
|
|
|
8742
8831
|
const latestTargetData = await bucketLoader.pull(
|
|
8743
8832
|
assignedTask.targetLocale
|
|
8744
8833
|
);
|
|
8745
|
-
const _partialData =
|
|
8834
|
+
const _partialData = _34.merge(
|
|
8746
8835
|
{},
|
|
8747
8836
|
latestTargetData,
|
|
8748
8837
|
processedChunk
|
|
@@ -8762,7 +8851,7 @@ function createWorkerTask(args) {
|
|
|
8762
8851
|
});
|
|
8763
8852
|
}
|
|
8764
8853
|
);
|
|
8765
|
-
const finalTargetData =
|
|
8854
|
+
const finalTargetData = _34.merge(
|
|
8766
8855
|
{},
|
|
8767
8856
|
sourceData,
|
|
8768
8857
|
targetData,
|
|
@@ -8803,7 +8892,7 @@ function countTasks(ctx, predicate) {
|
|
|
8803
8892
|
).length;
|
|
8804
8893
|
}
|
|
8805
8894
|
function processRenamedKeys(delta, targetData) {
|
|
8806
|
-
return
|
|
8895
|
+
return _34.chain(targetData).entries().map(([key, value]) => {
|
|
8807
8896
|
const renaming = delta.renamed.find(([oldKey]) => oldKey === key);
|
|
8808
8897
|
if (!renaming) {
|
|
8809
8898
|
return [key, value];
|
|
@@ -10373,7 +10462,7 @@ async function renderHero2() {
|
|
|
10373
10462
|
// package.json
|
|
10374
10463
|
var package_default = {
|
|
10375
10464
|
name: "lingo.dev",
|
|
10376
|
-
version: "0.107.
|
|
10465
|
+
version: "0.107.3",
|
|
10377
10466
|
description: "Lingo.dev CLI",
|
|
10378
10467
|
private: false,
|
|
10379
10468
|
publishConfig: {
|