lingo.dev 0.103.0 → 0.105.0
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 +169 -161
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +136 -128
- package/build/cli.mjs.map +1 -1
- package/package.json +4 -4
package/build/cli.cjs
CHANGED
|
@@ -5602,7 +5602,9 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
5602
5602
|
}
|
|
5603
5603
|
const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
|
|
5604
5604
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
5605
|
-
|
|
5605
|
+
if (!_optionalChain([flags, 'access', _198 => _198.locale, 'optionalAccess', _199 => _199.length])) {
|
|
5606
|
+
await deltaProcessor.saveChecksums(checksums);
|
|
5607
|
+
}
|
|
5606
5608
|
}
|
|
5607
5609
|
} catch (_error) {
|
|
5608
5610
|
const error = new Error(
|
|
@@ -5684,12 +5686,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
5684
5686
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
5685
5687
|
docUrl: "bucketNotFound"
|
|
5686
5688
|
});
|
|
5687
|
-
} else if (_optionalChain([flags, 'access',
|
|
5689
|
+
} else if (_optionalChain([flags, 'access', _200 => _200.locale, 'optionalAccess', _201 => _201.some, 'call', _202 => _202((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
5688
5690
|
throw new CLIError({
|
|
5689
5691
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
5690
5692
|
docUrl: "localeTargetNotFound"
|
|
5691
5693
|
});
|
|
5692
|
-
} else if (_optionalChain([flags, 'access',
|
|
5694
|
+
} else if (_optionalChain([flags, 'access', _203 => _203.bucket, 'optionalAccess', _204 => _204.some, 'call', _205 => _205(
|
|
5693
5695
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
5694
5696
|
)])) {
|
|
5695
5697
|
throw new CLIError({
|
|
@@ -6193,7 +6195,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
|
|
|
6193
6195
|
const response = await engine.whoami();
|
|
6194
6196
|
return {
|
|
6195
6197
|
authenticated: !!response,
|
|
6196
|
-
username: _optionalChain([response, 'optionalAccess',
|
|
6198
|
+
username: _optionalChain([response, 'optionalAccess', _206 => _206.email])
|
|
6197
6199
|
};
|
|
6198
6200
|
} catch (e2) {
|
|
6199
6201
|
return { authenticated: false };
|
|
@@ -6300,7 +6302,7 @@ function createExplicitLocalizer(provider) {
|
|
|
6300
6302
|
}
|
|
6301
6303
|
function createAiSdkLocalizer(params) {
|
|
6302
6304
|
const skipAuth = params.skipAuth === true;
|
|
6303
|
-
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
6305
|
+
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _207 => _207.apiKeyName]), () => ( ""))];
|
|
6304
6306
|
if (!skipAuth && !apiKey || !params.apiKeyName) {
|
|
6305
6307
|
throw new Error(
|
|
6306
6308
|
_dedent2.default`
|
|
@@ -6425,8 +6427,8 @@ async function setup(input2) {
|
|
|
6425
6427
|
throw new Error(
|
|
6426
6428
|
"No buckets found in i18n.json. Please add at least one bucket containing i18n content."
|
|
6427
6429
|
);
|
|
6428
|
-
} else if (_optionalChain([ctx, 'access',
|
|
6429
|
-
(bucket) => !_optionalChain([ctx, 'access',
|
|
6430
|
+
} else if (_optionalChain([ctx, 'access', _208 => _208.flags, 'access', _209 => _209.bucket, 'optionalAccess', _210 => _210.some, 'call', _211 => _211(
|
|
6431
|
+
(bucket) => !_optionalChain([ctx, 'access', _212 => _212.config, 'optionalAccess', _213 => _213.buckets, 'access', _214 => _214[bucket]])
|
|
6430
6432
|
)])) {
|
|
6431
6433
|
throw new Error(
|
|
6432
6434
|
`One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
|
|
@@ -6439,7 +6441,7 @@ async function setup(input2) {
|
|
|
6439
6441
|
title: "Selecting localization provider",
|
|
6440
6442
|
task: async (ctx, task) => {
|
|
6441
6443
|
ctx.localizer = createLocalizer(
|
|
6442
|
-
_optionalChain([ctx, 'access',
|
|
6444
|
+
_optionalChain([ctx, 'access', _215 => _215.config, 'optionalAccess', _216 => _216.provider]),
|
|
6443
6445
|
ctx.flags.apiKey
|
|
6444
6446
|
);
|
|
6445
6447
|
if (!ctx.localizer) {
|
|
@@ -6500,127 +6502,6 @@ async function setup(input2) {
|
|
|
6500
6502
|
|
|
6501
6503
|
|
|
6502
6504
|
|
|
6503
|
-
async function plan(input2) {
|
|
6504
|
-
console.log(_chalk2.default.hex(colors.orange)("[Planning]"));
|
|
6505
|
-
let buckets = getBuckets(input2.config);
|
|
6506
|
-
if (input2.flags.bucket) {
|
|
6507
|
-
buckets = buckets.filter((b) => input2.flags.bucket.includes(b.type));
|
|
6508
|
-
}
|
|
6509
|
-
const _sourceLocale = input2.flags.sourceLocale || input2.config.locale.source;
|
|
6510
|
-
if (!_sourceLocale) {
|
|
6511
|
-
throw new Error(
|
|
6512
|
-
`No source locale provided. Use --source-locale to specify the source locale or add it to i18n.json (locale.source)`
|
|
6513
|
-
);
|
|
6514
|
-
}
|
|
6515
|
-
const _targetLocales = input2.flags.targetLocale || input2.config.locale.targets;
|
|
6516
|
-
if (!_targetLocales.length) {
|
|
6517
|
-
throw new Error(
|
|
6518
|
-
`No target locales provided. Use --target-locale to specify the target locales or add them to i18n.json (locale.targets)`
|
|
6519
|
-
);
|
|
6520
|
-
}
|
|
6521
|
-
return new (0, _listr2.Listr)(
|
|
6522
|
-
[
|
|
6523
|
-
{
|
|
6524
|
-
title: "Locating content buckets",
|
|
6525
|
-
task: async (ctx, task) => {
|
|
6526
|
-
const bucketCount = buckets.length;
|
|
6527
|
-
const bucketFilter = input2.flags.bucket ? ` ${_chalk2.default.dim(
|
|
6528
|
-
`(filtered by: ${_chalk2.default.hex(colors.yellow)(
|
|
6529
|
-
input2.flags.bucket.join(", ")
|
|
6530
|
-
)})`
|
|
6531
|
-
)}` : "";
|
|
6532
|
-
task.title = `Found ${_chalk2.default.hex(colors.yellow)(
|
|
6533
|
-
bucketCount.toString()
|
|
6534
|
-
)} bucket(s)${bucketFilter}`;
|
|
6535
|
-
}
|
|
6536
|
-
},
|
|
6537
|
-
{
|
|
6538
|
-
title: "Detecting locales",
|
|
6539
|
-
task: async (ctx, task) => {
|
|
6540
|
-
task.title = `Found ${_chalk2.default.hex(colors.yellow)(
|
|
6541
|
-
_targetLocales.length.toString()
|
|
6542
|
-
)} target locale(s)`;
|
|
6543
|
-
}
|
|
6544
|
-
},
|
|
6545
|
-
{
|
|
6546
|
-
title: "Locating localizable files",
|
|
6547
|
-
task: async (ctx, task) => {
|
|
6548
|
-
const patterns = [];
|
|
6549
|
-
for (const bucket of buckets) {
|
|
6550
|
-
for (const bucketPath of bucket.paths) {
|
|
6551
|
-
if (input2.flags.file) {
|
|
6552
|
-
if (!input2.flags.file.some(
|
|
6553
|
-
(f) => bucketPath.pathPattern.includes(f)
|
|
6554
|
-
)) {
|
|
6555
|
-
continue;
|
|
6556
|
-
}
|
|
6557
|
-
}
|
|
6558
|
-
patterns.push(bucketPath.pathPattern);
|
|
6559
|
-
}
|
|
6560
|
-
}
|
|
6561
|
-
const fileFilter = input2.flags.file ? ` ${_chalk2.default.dim(
|
|
6562
|
-
`(filtered by: ${_chalk2.default.hex(colors.yellow)(
|
|
6563
|
-
input2.flags.file.join(", ")
|
|
6564
|
-
)})`
|
|
6565
|
-
)}` : "";
|
|
6566
|
-
task.title = `Found ${_chalk2.default.hex(colors.yellow)(
|
|
6567
|
-
patterns.length.toString()
|
|
6568
|
-
)} path pattern(s)${fileFilter}`;
|
|
6569
|
-
}
|
|
6570
|
-
},
|
|
6571
|
-
{
|
|
6572
|
-
title: "Computing translation tasks",
|
|
6573
|
-
task: async (ctx, task) => {
|
|
6574
|
-
for (const bucket of buckets) {
|
|
6575
|
-
for (const bucketPath of bucket.paths) {
|
|
6576
|
-
if (input2.flags.file) {
|
|
6577
|
-
if (!input2.flags.file.some(
|
|
6578
|
-
(f) => bucketPath.pathPattern.includes(f)
|
|
6579
|
-
)) {
|
|
6580
|
-
continue;
|
|
6581
|
-
}
|
|
6582
|
-
}
|
|
6583
|
-
const sourceLocale = __spec.resolveOverriddenLocale.call(void 0,
|
|
6584
|
-
_sourceLocale,
|
|
6585
|
-
bucketPath.delimiter
|
|
6586
|
-
);
|
|
6587
|
-
for (const _targetLocale of _targetLocales) {
|
|
6588
|
-
const targetLocale = __spec.resolveOverriddenLocale.call(void 0,
|
|
6589
|
-
_targetLocale,
|
|
6590
|
-
bucketPath.delimiter
|
|
6591
|
-
);
|
|
6592
|
-
if (sourceLocale === targetLocale) continue;
|
|
6593
|
-
ctx.tasks.push({
|
|
6594
|
-
sourceLocale,
|
|
6595
|
-
targetLocale,
|
|
6596
|
-
bucketType: bucket.type,
|
|
6597
|
-
bucketPathPattern: bucketPath.pathPattern,
|
|
6598
|
-
injectLocale: bucket.injectLocale || [],
|
|
6599
|
-
lockedKeys: bucket.lockedKeys || [],
|
|
6600
|
-
lockedPatterns: bucket.lockedPatterns || [],
|
|
6601
|
-
onlyKeys: input2.flags.key || []
|
|
6602
|
-
});
|
|
6603
|
-
}
|
|
6604
|
-
}
|
|
6605
|
-
}
|
|
6606
|
-
task.title = `Prepared ${_chalk2.default.hex(colors.green)(
|
|
6607
|
-
ctx.tasks.length.toString()
|
|
6608
|
-
)} translation task(s)`;
|
|
6609
|
-
}
|
|
6610
|
-
}
|
|
6611
|
-
],
|
|
6612
|
-
{
|
|
6613
|
-
rendererOptions: commonTaskRendererOptions
|
|
6614
|
-
}
|
|
6615
|
-
).run(input2);
|
|
6616
|
-
}
|
|
6617
|
-
|
|
6618
|
-
// src/cli/cmd/run/execute.ts
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
var _plimit = require('p-limit'); var _plimit2 = _interopRequireDefault(_plimit);
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
6505
|
// ../../node_modules/.pnpm/@isaacs+balanced-match@4.0.1/node_modules/@isaacs/balanced-match/dist/esm/index.js
|
|
6625
6506
|
var balanced = (a, b, str) => {
|
|
6626
6507
|
const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
|
|
@@ -7059,7 +6940,7 @@ var AST = class _AST {
|
|
|
7059
6940
|
const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
|
|
7060
6941
|
if (this.isStart() && !this.type)
|
|
7061
6942
|
ret.unshift([]);
|
|
7062
|
-
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
6943
|
+
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && _optionalChain([this, 'access', _217 => _217.#parent, 'optionalAccess', _218 => _218.type]) === "!")) {
|
|
7063
6944
|
ret.push({});
|
|
7064
6945
|
}
|
|
7065
6946
|
return ret;
|
|
@@ -7067,7 +6948,7 @@ var AST = class _AST {
|
|
|
7067
6948
|
isStart() {
|
|
7068
6949
|
if (this.#root === this)
|
|
7069
6950
|
return true;
|
|
7070
|
-
if (!_optionalChain([this, 'access',
|
|
6951
|
+
if (!_optionalChain([this, 'access', _219 => _219.#parent, 'optionalAccess', _220 => _220.isStart, 'call', _221 => _221()]))
|
|
7071
6952
|
return false;
|
|
7072
6953
|
if (this.#parentIndex === 0)
|
|
7073
6954
|
return true;
|
|
@@ -7083,12 +6964,12 @@ var AST = class _AST {
|
|
|
7083
6964
|
isEnd() {
|
|
7084
6965
|
if (this.#root === this)
|
|
7085
6966
|
return true;
|
|
7086
|
-
if (_optionalChain([this, 'access',
|
|
6967
|
+
if (_optionalChain([this, 'access', _222 => _222.#parent, 'optionalAccess', _223 => _223.type]) === "!")
|
|
7087
6968
|
return true;
|
|
7088
|
-
if (!_optionalChain([this, 'access',
|
|
6969
|
+
if (!_optionalChain([this, 'access', _224 => _224.#parent, 'optionalAccess', _225 => _225.isEnd, 'call', _226 => _226()]))
|
|
7089
6970
|
return false;
|
|
7090
6971
|
if (!this.type)
|
|
7091
|
-
return _optionalChain([this, 'access',
|
|
6972
|
+
return _optionalChain([this, 'access', _227 => _227.#parent, 'optionalAccess', _228 => _228.isEnd, 'call', _229 => _229()]);
|
|
7092
6973
|
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
|
7093
6974
|
return this.#parentIndex === pl - 1;
|
|
7094
6975
|
}
|
|
@@ -7333,7 +7214,7 @@ var AST = class _AST {
|
|
|
7333
7214
|
}
|
|
7334
7215
|
}
|
|
7335
7216
|
let end = "";
|
|
7336
|
-
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access',
|
|
7217
|
+
if (this.isEnd() && this.#root.#filledNegs && _optionalChain([this, 'access', _230 => _230.#parent, 'optionalAccess', _231 => _231.type]) === "!") {
|
|
7337
7218
|
end = "(?:$|\\/)";
|
|
7338
7219
|
}
|
|
7339
7220
|
const final2 = start2 + src + end;
|
|
@@ -8159,7 +8040,128 @@ minimatch.Minimatch = Minimatch;
|
|
|
8159
8040
|
minimatch.escape = escape;
|
|
8160
8041
|
minimatch.unescape = unescape;
|
|
8161
8042
|
|
|
8043
|
+
// src/cli/cmd/run/plan.ts
|
|
8044
|
+
|
|
8045
|
+
async function plan(input2) {
|
|
8046
|
+
console.log(_chalk2.default.hex(colors.orange)("[Planning]"));
|
|
8047
|
+
let buckets = getBuckets(input2.config);
|
|
8048
|
+
if (input2.flags.bucket) {
|
|
8049
|
+
buckets = buckets.filter((b) => input2.flags.bucket.includes(b.type));
|
|
8050
|
+
}
|
|
8051
|
+
const _sourceLocale = input2.flags.sourceLocale || input2.config.locale.source;
|
|
8052
|
+
if (!_sourceLocale) {
|
|
8053
|
+
throw new Error(
|
|
8054
|
+
`No source locale provided. Use --source-locale to specify the source locale or add it to i18n.json (locale.source)`
|
|
8055
|
+
);
|
|
8056
|
+
}
|
|
8057
|
+
const _targetLocales = input2.flags.targetLocale || input2.config.locale.targets;
|
|
8058
|
+
if (!_targetLocales.length) {
|
|
8059
|
+
throw new Error(
|
|
8060
|
+
`No target locales provided. Use --target-locale to specify the target locales or add them to i18n.json (locale.targets)`
|
|
8061
|
+
);
|
|
8062
|
+
}
|
|
8063
|
+
return new (0, _listr2.Listr)(
|
|
8064
|
+
[
|
|
8065
|
+
{
|
|
8066
|
+
title: "Locating content buckets",
|
|
8067
|
+
task: async (ctx, task) => {
|
|
8068
|
+
const bucketCount = buckets.length;
|
|
8069
|
+
const bucketFilter = input2.flags.bucket ? ` ${_chalk2.default.dim(
|
|
8070
|
+
`(filtered by: ${_chalk2.default.hex(colors.yellow)(
|
|
8071
|
+
input2.flags.bucket.join(", ")
|
|
8072
|
+
)})`
|
|
8073
|
+
)}` : "";
|
|
8074
|
+
task.title = `Found ${_chalk2.default.hex(colors.yellow)(
|
|
8075
|
+
bucketCount.toString()
|
|
8076
|
+
)} bucket(s)${bucketFilter}`;
|
|
8077
|
+
}
|
|
8078
|
+
},
|
|
8079
|
+
{
|
|
8080
|
+
title: "Detecting locales",
|
|
8081
|
+
task: async (ctx, task) => {
|
|
8082
|
+
task.title = `Found ${_chalk2.default.hex(colors.yellow)(
|
|
8083
|
+
_targetLocales.length.toString()
|
|
8084
|
+
)} target locale(s)`;
|
|
8085
|
+
}
|
|
8086
|
+
},
|
|
8087
|
+
{
|
|
8088
|
+
title: "Locating localizable files",
|
|
8089
|
+
task: async (ctx, task) => {
|
|
8090
|
+
const patterns = [];
|
|
8091
|
+
for (const bucket of buckets) {
|
|
8092
|
+
for (const bucketPath of bucket.paths) {
|
|
8093
|
+
if (input2.flags.file) {
|
|
8094
|
+
if (!input2.flags.file.some(
|
|
8095
|
+
(f) => bucketPath.pathPattern.includes(f) || minimatch(bucketPath.pathPattern, f)
|
|
8096
|
+
)) {
|
|
8097
|
+
continue;
|
|
8098
|
+
}
|
|
8099
|
+
}
|
|
8100
|
+
patterns.push(bucketPath.pathPattern);
|
|
8101
|
+
}
|
|
8102
|
+
}
|
|
8103
|
+
const fileFilter = input2.flags.file ? ` ${_chalk2.default.dim(
|
|
8104
|
+
`(filtered by: ${_chalk2.default.hex(colors.yellow)(
|
|
8105
|
+
input2.flags.file.join(", ")
|
|
8106
|
+
)})`
|
|
8107
|
+
)}` : "";
|
|
8108
|
+
task.title = `Found ${_chalk2.default.hex(colors.yellow)(
|
|
8109
|
+
patterns.length.toString()
|
|
8110
|
+
)} path pattern(s)${fileFilter}`;
|
|
8111
|
+
}
|
|
8112
|
+
},
|
|
8113
|
+
{
|
|
8114
|
+
title: "Computing translation tasks",
|
|
8115
|
+
task: async (ctx, task) => {
|
|
8116
|
+
for (const bucket of buckets) {
|
|
8117
|
+
for (const bucketPath of bucket.paths) {
|
|
8118
|
+
if (input2.flags.file) {
|
|
8119
|
+
if (!input2.flags.file.some(
|
|
8120
|
+
(f) => bucketPath.pathPattern.includes(f) || minimatch(bucketPath.pathPattern, f)
|
|
8121
|
+
)) {
|
|
8122
|
+
continue;
|
|
8123
|
+
}
|
|
8124
|
+
}
|
|
8125
|
+
const sourceLocale = __spec.resolveOverriddenLocale.call(void 0,
|
|
8126
|
+
_sourceLocale,
|
|
8127
|
+
bucketPath.delimiter
|
|
8128
|
+
);
|
|
8129
|
+
for (const _targetLocale of _targetLocales) {
|
|
8130
|
+
const targetLocale = __spec.resolveOverriddenLocale.call(void 0,
|
|
8131
|
+
_targetLocale,
|
|
8132
|
+
bucketPath.delimiter
|
|
8133
|
+
);
|
|
8134
|
+
if (sourceLocale === targetLocale) continue;
|
|
8135
|
+
ctx.tasks.push({
|
|
8136
|
+
sourceLocale,
|
|
8137
|
+
targetLocale,
|
|
8138
|
+
bucketType: bucket.type,
|
|
8139
|
+
bucketPathPattern: bucketPath.pathPattern,
|
|
8140
|
+
injectLocale: bucket.injectLocale || [],
|
|
8141
|
+
lockedKeys: bucket.lockedKeys || [],
|
|
8142
|
+
lockedPatterns: bucket.lockedPatterns || [],
|
|
8143
|
+
onlyKeys: input2.flags.key || []
|
|
8144
|
+
});
|
|
8145
|
+
}
|
|
8146
|
+
}
|
|
8147
|
+
}
|
|
8148
|
+
task.title = `Prepared ${_chalk2.default.hex(colors.green)(
|
|
8149
|
+
ctx.tasks.length.toString()
|
|
8150
|
+
)} translation task(s)`;
|
|
8151
|
+
}
|
|
8152
|
+
}
|
|
8153
|
+
],
|
|
8154
|
+
{
|
|
8155
|
+
rendererOptions: commonTaskRendererOptions
|
|
8156
|
+
}
|
|
8157
|
+
).run(input2);
|
|
8158
|
+
}
|
|
8159
|
+
|
|
8162
8160
|
// src/cli/cmd/run/execute.ts
|
|
8161
|
+
|
|
8162
|
+
|
|
8163
|
+
var _plimit = require('p-limit'); var _plimit2 = _interopRequireDefault(_plimit);
|
|
8164
|
+
|
|
8163
8165
|
var MAX_WORKER_COUNT = 10;
|
|
8164
8166
|
async function execute(input2) {
|
|
8165
8167
|
const effectiveConcurrency = Math.min(
|
|
@@ -8297,7 +8299,7 @@ function createWorkerTask(args) {
|
|
|
8297
8299
|
const processableData = _lodash2.default.chain(sourceData).entries().filter(
|
|
8298
8300
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
|
|
8299
8301
|
).filter(
|
|
8300
|
-
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access',
|
|
8302
|
+
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _232 => _232.onlyKeys, 'optionalAccess', _233 => _233.some, 'call', _234 => _234(
|
|
8301
8303
|
(pattern) => minimatch(key, pattern)
|
|
8302
8304
|
)])
|
|
8303
8305
|
).fromPairs().value();
|
|
@@ -8358,7 +8360,9 @@ function createWorkerTask(args) {
|
|
|
8358
8360
|
finalRenamedTargetData
|
|
8359
8361
|
);
|
|
8360
8362
|
const checksums2 = await deltaProcessor.createChecksums(sourceData);
|
|
8361
|
-
|
|
8363
|
+
if (!_optionalChain([args, 'access', _235 => _235.ctx, 'access', _236 => _236.flags, 'access', _237 => _237.targetLocale, 'optionalAccess', _238 => _238.length])) {
|
|
8364
|
+
await deltaProcessor.saveChecksums(checksums2);
|
|
8365
|
+
}
|
|
8362
8366
|
});
|
|
8363
8367
|
return { status: "success" };
|
|
8364
8368
|
} catch (error) {
|
|
@@ -8456,7 +8460,9 @@ async function getWatchPatterns(ctx) {
|
|
|
8456
8460
|
}
|
|
8457
8461
|
for (const bucketPath of bucket.paths) {
|
|
8458
8462
|
if (ctx.flags.file) {
|
|
8459
|
-
if (!ctx.flags.file.some(
|
|
8463
|
+
if (!ctx.flags.file.some(
|
|
8464
|
+
(f) => bucketPath.pathPattern.includes(f) || minimatch(bucketPath.pathPattern, f)
|
|
8465
|
+
)) {
|
|
8460
8466
|
continue;
|
|
8461
8467
|
}
|
|
8462
8468
|
}
|
|
@@ -8544,13 +8550,13 @@ var flagsSchema2 = _zod.z.object({
|
|
|
8544
8550
|
|
|
8545
8551
|
// src/cli/cmd/run/_utils.ts
|
|
8546
8552
|
async function determineAuthId(ctx) {
|
|
8547
|
-
const isByokMode = !!_optionalChain([ctx, 'access',
|
|
8553
|
+
const isByokMode = !!_optionalChain([ctx, 'access', _239 => _239.config, 'optionalAccess', _240 => _240.provider]);
|
|
8548
8554
|
if (isByokMode) {
|
|
8549
8555
|
return null;
|
|
8550
8556
|
} else {
|
|
8551
8557
|
try {
|
|
8552
|
-
const authStatus = await _optionalChain([ctx, 'access',
|
|
8553
|
-
return _optionalChain([authStatus, 'optionalAccess',
|
|
8558
|
+
const authStatus = await _optionalChain([ctx, 'access', _241 => _241.localizer, 'optionalAccess', _242 => _242.checkAuth, 'call', _243 => _243()]);
|
|
8559
|
+
return _optionalChain([authStatus, 'optionalAccess', _244 => _244.username]) || null;
|
|
8554
8560
|
} catch (e3) {
|
|
8555
8561
|
return null;
|
|
8556
8562
|
}
|
|
@@ -8571,7 +8577,7 @@ var run_default = new (0, _interactivecommander.Command)().command("run").descri
|
|
|
8571
8577
|
(val, prev) => prev ? [...prev, val] : [val]
|
|
8572
8578
|
).option(
|
|
8573
8579
|
"--file <file>",
|
|
8574
|
-
"File to process. Process only files that
|
|
8580
|
+
"File to process. Process only files that match this glob pattern in their path. Use quotes around patterns to prevent shell expansion (e.g., --file '**/*.json'). Useful if you have a lot of files and want to focus on a specific one. Specify more files separated by commas or spaces. Accepts glob patterns.",
|
|
8575
8581
|
(val, prev) => prev ? [...prev, val] : [val]
|
|
8576
8582
|
).option(
|
|
8577
8583
|
"--key <key>",
|
|
@@ -8710,7 +8716,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
8710
8716
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
8711
8717
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
8712
8718
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
8713
|
-
_optionalChain([this, 'access',
|
|
8719
|
+
_optionalChain([this, 'access', _245 => _245.platformKit, 'optionalAccess', _246 => _246.gitConfig, 'call', _247 => _247()]);
|
|
8714
8720
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
8715
8721
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
8716
8722
|
if (!processOwnCommits) {
|
|
@@ -8742,7 +8748,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
8742
8748
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
8743
8749
|
var PullRequestFlow = class extends InBranchFlow {
|
|
8744
8750
|
async preRun() {
|
|
8745
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
8751
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _248 => _248()]);
|
|
8746
8752
|
if (!canContinue) {
|
|
8747
8753
|
return false;
|
|
8748
8754
|
}
|
|
@@ -9005,10 +9011,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
9005
9011
|
repo_slug: this.platformConfig.repositoryName,
|
|
9006
9012
|
state: "OPEN"
|
|
9007
9013
|
}).then(({ data: { values } }) => {
|
|
9008
|
-
return _optionalChain([values, 'optionalAccess',
|
|
9009
|
-
({ source, destination }) => _optionalChain([source, 'optionalAccess',
|
|
9014
|
+
return _optionalChain([values, 'optionalAccess', _249 => _249.find, 'call', _250 => _250(
|
|
9015
|
+
({ source, destination }) => _optionalChain([source, 'optionalAccess', _251 => _251.branch, 'optionalAccess', _252 => _252.name]) === branch && _optionalChain([destination, 'optionalAccess', _253 => _253.branch, 'optionalAccess', _254 => _254.name]) === this.platformConfig.baseBranchName
|
|
9010
9016
|
)]);
|
|
9011
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
9017
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _255 => _255.id]));
|
|
9012
9018
|
}
|
|
9013
9019
|
async closePullRequest({ pullRequestNumber }) {
|
|
9014
9020
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -9104,7 +9110,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
9104
9110
|
repo: this.platformConfig.repositoryName,
|
|
9105
9111
|
base: this.platformConfig.baseBranchName,
|
|
9106
9112
|
state: "open"
|
|
9107
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
9113
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _256 => _256.number]));
|
|
9108
9114
|
}
|
|
9109
9115
|
async closePullRequest({ pullRequestNumber }) {
|
|
9110
9116
|
await this.octokit.rest.pulls.update({
|
|
@@ -9231,7 +9237,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
9231
9237
|
sourceBranch: branch,
|
|
9232
9238
|
state: "opened"
|
|
9233
9239
|
});
|
|
9234
|
-
return _optionalChain([mergeRequests, 'access',
|
|
9240
|
+
return _optionalChain([mergeRequests, 'access', _257 => _257[0], 'optionalAccess', _258 => _258.iid]);
|
|
9235
9241
|
}
|
|
9236
9242
|
async closePullRequest({
|
|
9237
9243
|
pullRequestNumber
|
|
@@ -9321,7 +9327,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
9321
9327
|
}
|
|
9322
9328
|
const env = {
|
|
9323
9329
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
9324
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
9330
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _259 => _259.pullRequest, 'optionalAccess', _260 => _260.toString, 'call', _261 => _261()]) || "false",
|
|
9325
9331
|
...options.commitMessage && {
|
|
9326
9332
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
9327
9333
|
},
|
|
@@ -9341,7 +9347,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
9341
9347
|
const { isPullRequestMode } = platformKit.config;
|
|
9342
9348
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
9343
9349
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
9344
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
9350
|
+
const canRun = await _optionalChain([flow, 'access', _262 => _262.preRun, 'optionalCall', _263 => _263()]);
|
|
9345
9351
|
if (canRun === false) {
|
|
9346
9352
|
return;
|
|
9347
9353
|
}
|
|
@@ -9351,7 +9357,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
9351
9357
|
if (!hasChanges) {
|
|
9352
9358
|
return;
|
|
9353
9359
|
}
|
|
9354
|
-
await _optionalChain([flow, 'access',
|
|
9360
|
+
await _optionalChain([flow, 'access', _264 => _264.postRun, 'optionalCall', _265 => _265()]);
|
|
9355
9361
|
});
|
|
9356
9362
|
function parseBooleanArg(val) {
|
|
9357
9363
|
if (val === true) return true;
|
|
@@ -9382,7 +9388,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
9382
9388
|
(val, prev) => prev ? [...prev, val] : [val]
|
|
9383
9389
|
).option(
|
|
9384
9390
|
"--file [files...]",
|
|
9385
|
-
"File to process. Process only
|
|
9391
|
+
"File to process. Process only files that include this string in their path. Useful if you have a lot of files and want to focus on a specific one. Specify more files separated by commas or spaces."
|
|
9386
9392
|
).option(
|
|
9387
9393
|
"--force",
|
|
9388
9394
|
"Ignore lockfile and process all keys, useful for estimating full re-translation"
|
|
@@ -9420,16 +9426,18 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
9420
9426
|
flags
|
|
9421
9427
|
});
|
|
9422
9428
|
let buckets = getBuckets(i18nConfig);
|
|
9423
|
-
if (_optionalChain([flags, 'access',
|
|
9429
|
+
if (_optionalChain([flags, 'access', _266 => _266.bucket, 'optionalAccess', _267 => _267.length])) {
|
|
9424
9430
|
buckets = buckets.filter(
|
|
9425
9431
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
9426
9432
|
);
|
|
9427
9433
|
}
|
|
9428
9434
|
ora.succeed("Buckets retrieved");
|
|
9429
|
-
if (_optionalChain([flags, 'access',
|
|
9435
|
+
if (_optionalChain([flags, 'access', _268 => _268.file, 'optionalAccess', _269 => _269.length])) {
|
|
9430
9436
|
buckets = buckets.map((bucket) => {
|
|
9431
9437
|
const paths = bucket.paths.filter(
|
|
9432
|
-
(path17) => flags.file.find(
|
|
9438
|
+
(path17) => flags.file.find(
|
|
9439
|
+
(file) => _optionalChain([path17, 'access', _270 => _270.pathPattern, 'optionalAccess', _271 => _271.includes, 'call', _272 => _272(file)]) || _optionalChain([path17, 'access', _273 => _273.pathPattern, 'optionalAccess', _274 => _274.match, 'call', _275 => _275(file)]) || minimatch(path17.pathPattern, file)
|
|
9440
|
+
)
|
|
9433
9441
|
);
|
|
9434
9442
|
return { ...bucket, paths };
|
|
9435
9443
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -9448,7 +9456,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
9448
9456
|
});
|
|
9449
9457
|
}
|
|
9450
9458
|
}
|
|
9451
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
9459
|
+
const targetLocales = _optionalChain([flags, 'access', _276 => _276.locale, 'optionalAccess', _277 => _277.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
9452
9460
|
let totalSourceKeyCount = 0;
|
|
9453
9461
|
let uniqueKeysToTranslate = 0;
|
|
9454
9462
|
let totalExistingTranslations = 0;
|
|
@@ -9852,12 +9860,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
9852
9860
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
9853
9861
|
docUrl: "bucketNotFound"
|
|
9854
9862
|
});
|
|
9855
|
-
} else if (_optionalChain([flags, 'access',
|
|
9863
|
+
} else if (_optionalChain([flags, 'access', _278 => _278.locale, 'optionalAccess', _279 => _279.some, 'call', _280 => _280((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
9856
9864
|
throw new CLIError({
|
|
9857
9865
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
9858
9866
|
docUrl: "localeTargetNotFound"
|
|
9859
9867
|
});
|
|
9860
|
-
} else if (_optionalChain([flags, 'access',
|
|
9868
|
+
} else if (_optionalChain([flags, 'access', _281 => _281.bucket, 'optionalAccess', _282 => _282.some, 'call', _283 => _283(
|
|
9861
9869
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
9862
9870
|
)])) {
|
|
9863
9871
|
throw new CLIError({
|
|
@@ -9946,7 +9954,7 @@ async function renderHero2() {
|
|
|
9946
9954
|
// package.json
|
|
9947
9955
|
var package_default = {
|
|
9948
9956
|
name: "lingo.dev",
|
|
9949
|
-
version: "0.
|
|
9957
|
+
version: "0.105.0",
|
|
9950
9958
|
description: "Lingo.dev CLI",
|
|
9951
9959
|
private: false,
|
|
9952
9960
|
publishConfig: {
|
|
@@ -10221,7 +10229,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
|
|
|
10221
10229
|
if (options.file && options.file.length) {
|
|
10222
10230
|
buckets = buckets.map((bucket) => {
|
|
10223
10231
|
const paths = bucket.paths.filter(
|
|
10224
|
-
(bucketPath) => _optionalChain([options, 'access',
|
|
10232
|
+
(bucketPath) => _optionalChain([options, 'access', _284 => _284.file, 'optionalAccess', _285 => _285.some, 'call', _286 => _286((f) => bucketPath.pathPattern.includes(f))])
|
|
10225
10233
|
);
|
|
10226
10234
|
return { ...bucket, paths };
|
|
10227
10235
|
}).filter((bucket) => bucket.paths.length > 0);
|