lingo.dev 0.107.2 → 0.107.4
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 +239 -135
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +151 -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,102 @@ 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
|
+
var TOP_LEVEL_KEY = "--content--";
|
|
6551
|
+
function createJsonDictionaryLoader() {
|
|
6552
|
+
return createLoader({
|
|
6553
|
+
pull: async (locale, input2) => {
|
|
6554
|
+
const result = extractTranslatables(input2, locale);
|
|
6555
|
+
if (typeof result === "string") {
|
|
6556
|
+
return { [TOP_LEVEL_KEY]: result };
|
|
6557
|
+
}
|
|
6558
|
+
return result;
|
|
6559
|
+
},
|
|
6560
|
+
push: async (locale, data, originalInput, originalLocale) => {
|
|
6561
|
+
if (!originalInput) {
|
|
6562
|
+
throw new Error("Error while parsing json-dictionary bucket");
|
|
6563
|
+
}
|
|
6564
|
+
const input2 = _28.cloneDeep(originalInput);
|
|
6565
|
+
if (Object.keys(data).length === 1 && Object.keys(data)[0] === TOP_LEVEL_KEY) {
|
|
6566
|
+
setNestedLocale(
|
|
6567
|
+
{ [TOP_LEVEL_KEY]: input2 },
|
|
6568
|
+
[TOP_LEVEL_KEY],
|
|
6569
|
+
locale,
|
|
6570
|
+
data[TOP_LEVEL_KEY],
|
|
6571
|
+
originalLocale
|
|
6572
|
+
);
|
|
6573
|
+
return input2;
|
|
6574
|
+
}
|
|
6575
|
+
function walk(obj, dataNode, path17 = []) {
|
|
6576
|
+
if (Array.isArray(obj) && Array.isArray(dataNode)) {
|
|
6577
|
+
obj.forEach(
|
|
6578
|
+
(item, idx) => walk(item, dataNode[idx], [...path17, String(idx)])
|
|
6579
|
+
);
|
|
6580
|
+
} else if (obj && typeof obj === "object" && dataNode && typeof dataNode === "object" && !Array.isArray(dataNode)) {
|
|
6581
|
+
for (const key of Object.keys(obj)) {
|
|
6582
|
+
if (dataNode.hasOwnProperty(key)) {
|
|
6583
|
+
walk(obj[key], dataNode[key], [...path17, key]);
|
|
6584
|
+
}
|
|
6585
|
+
}
|
|
6586
|
+
} else if (obj && typeof obj === "object" && !Array.isArray(obj) && typeof dataNode === "string") {
|
|
6587
|
+
setNestedLocale(input2, path17, locale, dataNode, originalLocale);
|
|
6588
|
+
}
|
|
6589
|
+
}
|
|
6590
|
+
walk(input2, data);
|
|
6591
|
+
return input2;
|
|
6592
|
+
}
|
|
6593
|
+
});
|
|
6594
|
+
}
|
|
6595
|
+
function extractTranslatables(obj, locale) {
|
|
6596
|
+
if (Array.isArray(obj)) {
|
|
6597
|
+
return obj.map((item) => extractTranslatables(item, locale));
|
|
6598
|
+
} else if (isTranslatableObject(obj, locale)) {
|
|
6599
|
+
return obj[locale];
|
|
6600
|
+
} else if (obj && typeof obj === "object") {
|
|
6601
|
+
const result = {};
|
|
6602
|
+
for (const key of Object.keys(obj)) {
|
|
6603
|
+
const value = extractTranslatables(obj[key], locale);
|
|
6604
|
+
if (typeof value === "object" && value !== null && Object.keys(value).length > 0 || Array.isArray(value) && value.length > 0 || typeof value === "string" && value.length > 0) {
|
|
6605
|
+
result[key] = value;
|
|
6606
|
+
}
|
|
6607
|
+
}
|
|
6608
|
+
return result;
|
|
6609
|
+
}
|
|
6610
|
+
return void 0;
|
|
6611
|
+
}
|
|
6612
|
+
function isTranslatableObject(obj, locale) {
|
|
6613
|
+
return obj && typeof obj === "object" && !Array.isArray(obj) && Object.prototype.hasOwnProperty.call(obj, locale);
|
|
6614
|
+
}
|
|
6615
|
+
function setNestedLocale(obj, path17, locale, value, originalLocale) {
|
|
6616
|
+
let curr = obj;
|
|
6617
|
+
for (let i = 0; i < path17.length - 1; i++) {
|
|
6618
|
+
const key = path17[i];
|
|
6619
|
+
if (!(key in curr)) curr[key] = {};
|
|
6620
|
+
curr = curr[key];
|
|
6621
|
+
}
|
|
6622
|
+
const last = path17[path17.length - 1];
|
|
6623
|
+
if (curr[last] && typeof curr[last] === "object") {
|
|
6624
|
+
curr[last][locale] = value;
|
|
6625
|
+
if (originalLocale && curr[last][originalLocale]) {
|
|
6626
|
+
const entries = Object.entries(curr[last]);
|
|
6627
|
+
const first = entries.filter(([k]) => k === originalLocale);
|
|
6628
|
+
const rest = entries.filter(([k]) => k !== originalLocale).sort(([a], [b]) => a.localeCompare(b));
|
|
6629
|
+
const ordered = [...first, ...rest];
|
|
6630
|
+
const reordered = {};
|
|
6631
|
+
for (const [k, v] of ordered) {
|
|
6632
|
+
reordered[k] = v;
|
|
6633
|
+
}
|
|
6634
|
+
curr[last] = reordered;
|
|
6635
|
+
}
|
|
6636
|
+
}
|
|
6637
|
+
}
|
|
6638
|
+
|
|
6548
6639
|
// src/cli/loaders/index.ts
|
|
6549
6640
|
function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys, lockedPatterns, ignoredKeys) {
|
|
6550
6641
|
switch (bucketType) {
|
|
@@ -6776,6 +6867,19 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
|
|
|
6776
6867
|
createSyncLoader(),
|
|
6777
6868
|
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
6778
6869
|
);
|
|
6870
|
+
case "json-dictionary":
|
|
6871
|
+
return composeLoaders(
|
|
6872
|
+
createTextFileLoader(bucketPathPattern),
|
|
6873
|
+
createPrettierLoader({ parser: "json", bucketPathPattern }),
|
|
6874
|
+
createJsonLoader(),
|
|
6875
|
+
createJsonDictionaryLoader(),
|
|
6876
|
+
createEnsureKeyOrderLoader(),
|
|
6877
|
+
createFlatLoader(),
|
|
6878
|
+
createInjectLocaleLoader(options.injectLocale),
|
|
6879
|
+
createLockedKeysLoader(lockedKeys || []),
|
|
6880
|
+
createSyncLoader(),
|
|
6881
|
+
createUnlocalizableLoader(options.returnUnlocalizedKeys)
|
|
6882
|
+
);
|
|
6779
6883
|
}
|
|
6780
6884
|
}
|
|
6781
6885
|
|
|
@@ -6818,7 +6922,7 @@ function createLingoLocalizer(params) {
|
|
|
6818
6922
|
|
|
6819
6923
|
// src/cli/processor/basic.ts
|
|
6820
6924
|
import { generateText } from "ai";
|
|
6821
|
-
import
|
|
6925
|
+
import _29 from "lodash";
|
|
6822
6926
|
function createBasicTranslator(model, systemPrompt) {
|
|
6823
6927
|
return async (input2, onProgress) => {
|
|
6824
6928
|
const chunks = extractPayloadChunks(input2.processableData);
|
|
@@ -6832,7 +6936,7 @@ function createBasicTranslator(model, systemPrompt) {
|
|
|
6832
6936
|
subResults.push(result2);
|
|
6833
6937
|
onProgress(i / chunks.length * 100, chunk, result2);
|
|
6834
6938
|
}
|
|
6835
|
-
const result =
|
|
6939
|
+
const result = _29.merge({}, ...subResults);
|
|
6836
6940
|
return result;
|
|
6837
6941
|
};
|
|
6838
6942
|
async function doJob(input2) {
|
|
@@ -7079,7 +7183,7 @@ async function trackEvent(distinctId, event, properties) {
|
|
|
7079
7183
|
}
|
|
7080
7184
|
|
|
7081
7185
|
// src/cli/utils/delta.ts
|
|
7082
|
-
import
|
|
7186
|
+
import _30 from "lodash";
|
|
7083
7187
|
import z from "zod";
|
|
7084
7188
|
|
|
7085
7189
|
// src/cli/utils/fs.ts
|
|
@@ -7128,11 +7232,11 @@ function createDeltaProcessor(fileKey) {
|
|
|
7128
7232
|
return checkIfFileExists(lockfilePath);
|
|
7129
7233
|
},
|
|
7130
7234
|
async calculateDelta(params) {
|
|
7131
|
-
let added =
|
|
7235
|
+
let added = _30.difference(
|
|
7132
7236
|
Object.keys(params.sourceData),
|
|
7133
7237
|
Object.keys(params.targetData)
|
|
7134
7238
|
);
|
|
7135
|
-
let removed =
|
|
7239
|
+
let removed = _30.difference(
|
|
7136
7240
|
Object.keys(params.targetData),
|
|
7137
7241
|
Object.keys(params.sourceData)
|
|
7138
7242
|
);
|
|
@@ -7194,7 +7298,7 @@ function createDeltaProcessor(fileKey) {
|
|
|
7194
7298
|
await this.saveLock(lockfileData);
|
|
7195
7299
|
},
|
|
7196
7300
|
async createChecksums(sourceData) {
|
|
7197
|
-
const checksums =
|
|
7301
|
+
const checksums = _30.mapValues(sourceData, (value) => md5(value));
|
|
7198
7302
|
return checksums;
|
|
7199
7303
|
}
|
|
7200
7304
|
};
|
|
@@ -7364,7 +7468,7 @@ var i18n_default = new Command12().command("i18n").description("Run Localization
|
|
|
7364
7468
|
const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
|
|
7365
7469
|
const sourceChecksums = await deltaProcessor.createChecksums(sourceData);
|
|
7366
7470
|
const savedChecksums = await deltaProcessor.loadChecksums();
|
|
7367
|
-
const updatedSourceData =
|
|
7471
|
+
const updatedSourceData = _31.pickBy(
|
|
7368
7472
|
sourceData,
|
|
7369
7473
|
(value, key) => sourceChecksums[key] !== savedChecksums[key]
|
|
7370
7474
|
);
|
|
@@ -7378,15 +7482,15 @@ var i18n_default = new Command12().command("i18n").description("Run Localization
|
|
|
7378
7482
|
bucketPath.delimiter
|
|
7379
7483
|
);
|
|
7380
7484
|
const { unlocalizable: targetUnlocalizable, ...targetData } = await bucketLoader.pull(targetLocale);
|
|
7381
|
-
const missingKeys =
|
|
7485
|
+
const missingKeys = _31.difference(
|
|
7382
7486
|
Object.keys(sourceData),
|
|
7383
7487
|
Object.keys(targetData)
|
|
7384
7488
|
);
|
|
7385
|
-
const extraKeys =
|
|
7489
|
+
const extraKeys = _31.difference(
|
|
7386
7490
|
Object.keys(targetData),
|
|
7387
7491
|
Object.keys(sourceData)
|
|
7388
7492
|
);
|
|
7389
|
-
const unlocalizableDataDiff = !
|
|
7493
|
+
const unlocalizableDataDiff = !_31.isEqual(
|
|
7390
7494
|
sourceUnlocalizable,
|
|
7391
7495
|
targetUnlocalizable
|
|
7392
7496
|
);
|
|
@@ -7467,13 +7571,13 @@ var i18n_default = new Command12().command("i18n").description("Run Localization
|
|
|
7467
7571
|
targetData,
|
|
7468
7572
|
checksums: checksums2
|
|
7469
7573
|
});
|
|
7470
|
-
let processableData =
|
|
7574
|
+
let processableData = _31.chain(sourceData).entries().filter(
|
|
7471
7575
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!flags.force
|
|
7472
7576
|
).fromPairs().value();
|
|
7473
7577
|
if (flags.key) {
|
|
7474
|
-
processableData =
|
|
7578
|
+
processableData = _31.pickBy(
|
|
7475
7579
|
processableData,
|
|
7476
|
-
(
|
|
7580
|
+
(_35, key) => key === flags.key
|
|
7477
7581
|
);
|
|
7478
7582
|
}
|
|
7479
7583
|
if (flags.verbose) {
|
|
@@ -7506,13 +7610,13 @@ var i18n_default = new Command12().command("i18n").description("Run Localization
|
|
|
7506
7610
|
if (flags.verbose) {
|
|
7507
7611
|
bucketOra.info(JSON.stringify(processedTargetData, null, 2));
|
|
7508
7612
|
}
|
|
7509
|
-
let finalTargetData =
|
|
7613
|
+
let finalTargetData = _31.merge(
|
|
7510
7614
|
{},
|
|
7511
7615
|
sourceData,
|
|
7512
7616
|
targetData,
|
|
7513
7617
|
processedTargetData
|
|
7514
7618
|
);
|
|
7515
|
-
finalTargetData =
|
|
7619
|
+
finalTargetData = _31.chain(finalTargetData).entries().map(([key, value]) => {
|
|
7516
7620
|
const renaming = delta.renamed.find(
|
|
7517
7621
|
([oldKey, newKey]) => oldKey === key
|
|
7518
7622
|
);
|
|
@@ -7536,7 +7640,7 @@ var i18n_default = new Command12().command("i18n").description("Run Localization
|
|
|
7536
7640
|
`Applying changes to ${bucketPath} (${targetLocale})`
|
|
7537
7641
|
);
|
|
7538
7642
|
}
|
|
7539
|
-
const finalDiffSize =
|
|
7643
|
+
const finalDiffSize = _31.chain(finalTargetData).omitBy((value, key) => value === targetData[key]).size().value();
|
|
7540
7644
|
await bucketLoader.push(targetLocale, finalTargetData);
|
|
7541
7645
|
if (finalDiffSize > 0 || flags.force) {
|
|
7542
7646
|
bucketOra.succeed(
|
|
@@ -7713,7 +7817,7 @@ Reviewing changes for ${chalk6.blue(args.pathPattern)} (${chalk6.yellow(
|
|
|
7713
7817
|
return args.currentData;
|
|
7714
7818
|
}
|
|
7715
7819
|
const customData = { ...args.currentData };
|
|
7716
|
-
const changes =
|
|
7820
|
+
const changes = _31.reduce(
|
|
7717
7821
|
args.proposedData,
|
|
7718
7822
|
(result, value, key) => {
|
|
7719
7823
|
if (args.currentData[key] !== value) {
|
|
@@ -7786,7 +7890,7 @@ import path15 from "path";
|
|
|
7786
7890
|
import Z4 from "zod";
|
|
7787
7891
|
import YAML5 from "yaml";
|
|
7788
7892
|
import { MD5 as MD52 } from "object-hash";
|
|
7789
|
-
import
|
|
7893
|
+
import _32 from "lodash";
|
|
7790
7894
|
function createLockfileHelper() {
|
|
7791
7895
|
return {
|
|
7792
7896
|
isLockfileExists: () => {
|
|
@@ -7796,18 +7900,18 @@ function createLockfileHelper() {
|
|
|
7796
7900
|
registerSourceData: (pathPattern, sourceData) => {
|
|
7797
7901
|
const lockfile = _loadLockfile();
|
|
7798
7902
|
const sectionKey = MD52(pathPattern);
|
|
7799
|
-
const sectionChecksums =
|
|
7903
|
+
const sectionChecksums = _32.mapValues(sourceData, (value) => MD52(value));
|
|
7800
7904
|
lockfile.checksums[sectionKey] = sectionChecksums;
|
|
7801
7905
|
_saveLockfile(lockfile);
|
|
7802
7906
|
},
|
|
7803
7907
|
registerPartialSourceData: (pathPattern, partialSourceData) => {
|
|
7804
7908
|
const lockfile = _loadLockfile();
|
|
7805
7909
|
const sectionKey = MD52(pathPattern);
|
|
7806
|
-
const sectionChecksums =
|
|
7910
|
+
const sectionChecksums = _32.mapValues(
|
|
7807
7911
|
partialSourceData,
|
|
7808
7912
|
(value) => MD52(value)
|
|
7809
7913
|
);
|
|
7810
|
-
lockfile.checksums[sectionKey] =
|
|
7914
|
+
lockfile.checksums[sectionKey] = _32.merge(
|
|
7811
7915
|
{},
|
|
7812
7916
|
lockfile.checksums[sectionKey] ?? {},
|
|
7813
7917
|
sectionChecksums
|
|
@@ -7817,9 +7921,9 @@ function createLockfileHelper() {
|
|
|
7817
7921
|
extractUpdatedData: (pathPattern, sourceData) => {
|
|
7818
7922
|
const lockfile = _loadLockfile();
|
|
7819
7923
|
const sectionKey = MD52(pathPattern);
|
|
7820
|
-
const currentChecksums =
|
|
7924
|
+
const currentChecksums = _32.mapValues(sourceData, (value) => MD52(value));
|
|
7821
7925
|
const savedChecksums = lockfile.checksums[sectionKey] || {};
|
|
7822
|
-
const updatedData =
|
|
7926
|
+
const updatedData = _32.pickBy(
|
|
7823
7927
|
sourceData,
|
|
7824
7928
|
(value, key) => savedChecksums[key] !== currentChecksums[key]
|
|
7825
7929
|
);
|
|
@@ -7903,7 +8007,7 @@ var flagsSchema = Z5.object({
|
|
|
7903
8007
|
// src/cli/cmd/cleanup.ts
|
|
7904
8008
|
import { resolveOverriddenLocale as resolveOverriddenLocale5 } from "@lingo.dev/_spec";
|
|
7905
8009
|
import { Command as Command14 } from "interactive-commander";
|
|
7906
|
-
import
|
|
8010
|
+
import _33 from "lodash";
|
|
7907
8011
|
import Ora9 from "ora";
|
|
7908
8012
|
var cleanup_default = new Command14().command("cleanup").description(
|
|
7909
8013
|
"Remove keys from target files that do not exist in the source file"
|
|
@@ -7954,7 +8058,7 @@ var cleanup_default = new Command14().command("cleanup").description(
|
|
|
7954
8058
|
try {
|
|
7955
8059
|
const targetData = await bucketLoader.pull(targetLocale);
|
|
7956
8060
|
const targetKeys = Object.keys(targetData);
|
|
7957
|
-
const keysToRemove =
|
|
8061
|
+
const keysToRemove = _33.difference(targetKeys, sourceKeys);
|
|
7958
8062
|
if (keysToRemove.length === 0) {
|
|
7959
8063
|
bucketOra.succeed(`[${targetLocale}] No keys to remove`);
|
|
7960
8064
|
continue;
|
|
@@ -7969,7 +8073,7 @@ var cleanup_default = new Command14().command("cleanup").description(
|
|
|
7969
8073
|
);
|
|
7970
8074
|
}
|
|
7971
8075
|
if (!options.dryRun) {
|
|
7972
|
-
const cleanedData =
|
|
8076
|
+
const cleanedData = _33.pick(targetData, sourceKeys);
|
|
7973
8077
|
await bucketLoader.push(targetLocale, cleanedData);
|
|
7974
8078
|
bucketOra.succeed(
|
|
7975
8079
|
`[${targetLocale}] Removed ${keysToRemove.length} keys`
|
|
@@ -8030,7 +8134,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
8030
8134
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
8031
8135
|
import Z6 from "zod";
|
|
8032
8136
|
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 (
|
|
8137
|
+
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
8138
|
const apiKey = program.args[0];
|
|
8035
8139
|
const settings = getSettings(apiKey);
|
|
8036
8140
|
if (!settings.auth.apiKey) {
|
|
@@ -8580,7 +8684,7 @@ async function plan(input2) {
|
|
|
8580
8684
|
import chalk12 from "chalk";
|
|
8581
8685
|
import { Listr as Listr3 } from "listr2";
|
|
8582
8686
|
import pLimit from "p-limit";
|
|
8583
|
-
import
|
|
8687
|
+
import _34 from "lodash";
|
|
8584
8688
|
var MAX_WORKER_COUNT = 10;
|
|
8585
8689
|
async function execute(input2) {
|
|
8586
8690
|
const effectiveConcurrency = Math.min(
|
|
@@ -8615,7 +8719,7 @@ async function execute(input2) {
|
|
|
8615
8719
|
const workerTasks = [];
|
|
8616
8720
|
for (let i = 0; i < workersCount; i++) {
|
|
8617
8721
|
const assignedTasks = ctx.tasks.filter(
|
|
8618
|
-
(
|
|
8722
|
+
(_35, idx) => idx % workersCount === i
|
|
8619
8723
|
);
|
|
8620
8724
|
workerTasks.push(
|
|
8621
8725
|
createWorkerTask({
|
|
@@ -8715,7 +8819,7 @@ function createWorkerTask(args) {
|
|
|
8715
8819
|
targetData,
|
|
8716
8820
|
checksums
|
|
8717
8821
|
});
|
|
8718
|
-
const processableData =
|
|
8822
|
+
const processableData = _34.chain(sourceData).entries().filter(
|
|
8719
8823
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
|
|
8720
8824
|
).filter(
|
|
8721
8825
|
([key]) => !assignedTask.onlyKeys.length || assignedTask.onlyKeys?.some(
|
|
@@ -8742,7 +8846,7 @@ function createWorkerTask(args) {
|
|
|
8742
8846
|
const latestTargetData = await bucketLoader.pull(
|
|
8743
8847
|
assignedTask.targetLocale
|
|
8744
8848
|
);
|
|
8745
|
-
const _partialData =
|
|
8849
|
+
const _partialData = _34.merge(
|
|
8746
8850
|
{},
|
|
8747
8851
|
latestTargetData,
|
|
8748
8852
|
processedChunk
|
|
@@ -8762,7 +8866,7 @@ function createWorkerTask(args) {
|
|
|
8762
8866
|
});
|
|
8763
8867
|
}
|
|
8764
8868
|
);
|
|
8765
|
-
const finalTargetData =
|
|
8869
|
+
const finalTargetData = _34.merge(
|
|
8766
8870
|
{},
|
|
8767
8871
|
sourceData,
|
|
8768
8872
|
targetData,
|
|
@@ -8803,7 +8907,7 @@ function countTasks(ctx, predicate) {
|
|
|
8803
8907
|
).length;
|
|
8804
8908
|
}
|
|
8805
8909
|
function processRenamedKeys(delta, targetData) {
|
|
8806
|
-
return
|
|
8910
|
+
return _34.chain(targetData).entries().map(([key, value]) => {
|
|
8807
8911
|
const renaming = delta.renamed.find(([oldKey]) => oldKey === key);
|
|
8808
8912
|
if (!renaming) {
|
|
8809
8913
|
return [key, value];
|
|
@@ -10373,7 +10477,7 @@ async function renderHero2() {
|
|
|
10373
10477
|
// package.json
|
|
10374
10478
|
var package_default = {
|
|
10375
10479
|
name: "lingo.dev",
|
|
10376
|
-
version: "0.107.
|
|
10480
|
+
version: "0.107.4",
|
|
10377
10481
|
description: "Lingo.dev CLI",
|
|
10378
10482
|
private: false,
|
|
10379
10483
|
publishConfig: {
|