lingo.dev 0.104.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 +41 -37
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +7 -3
- 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) {
|
|
@@ -6938,7 +6940,7 @@ var AST = class _AST {
|
|
|
6938
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())];
|
|
6939
6941
|
if (this.isStart() && !this.type)
|
|
6940
6942
|
ret.unshift([]);
|
|
6941
|
-
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]) === "!")) {
|
|
6942
6944
|
ret.push({});
|
|
6943
6945
|
}
|
|
6944
6946
|
return ret;
|
|
@@ -6946,7 +6948,7 @@ var AST = class _AST {
|
|
|
6946
6948
|
isStart() {
|
|
6947
6949
|
if (this.#root === this)
|
|
6948
6950
|
return true;
|
|
6949
|
-
if (!_optionalChain([this, 'access',
|
|
6951
|
+
if (!_optionalChain([this, 'access', _219 => _219.#parent, 'optionalAccess', _220 => _220.isStart, 'call', _221 => _221()]))
|
|
6950
6952
|
return false;
|
|
6951
6953
|
if (this.#parentIndex === 0)
|
|
6952
6954
|
return true;
|
|
@@ -6962,12 +6964,12 @@ var AST = class _AST {
|
|
|
6962
6964
|
isEnd() {
|
|
6963
6965
|
if (this.#root === this)
|
|
6964
6966
|
return true;
|
|
6965
|
-
if (_optionalChain([this, 'access',
|
|
6967
|
+
if (_optionalChain([this, 'access', _222 => _222.#parent, 'optionalAccess', _223 => _223.type]) === "!")
|
|
6966
6968
|
return true;
|
|
6967
|
-
if (!_optionalChain([this, 'access',
|
|
6969
|
+
if (!_optionalChain([this, 'access', _224 => _224.#parent, 'optionalAccess', _225 => _225.isEnd, 'call', _226 => _226()]))
|
|
6968
6970
|
return false;
|
|
6969
6971
|
if (!this.type)
|
|
6970
|
-
return _optionalChain([this, 'access',
|
|
6972
|
+
return _optionalChain([this, 'access', _227 => _227.#parent, 'optionalAccess', _228 => _228.isEnd, 'call', _229 => _229()]);
|
|
6971
6973
|
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
|
6972
6974
|
return this.#parentIndex === pl - 1;
|
|
6973
6975
|
}
|
|
@@ -7212,7 +7214,7 @@ var AST = class _AST {
|
|
|
7212
7214
|
}
|
|
7213
7215
|
}
|
|
7214
7216
|
let end = "";
|
|
7215
|
-
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]) === "!") {
|
|
7216
7218
|
end = "(?:$|\\/)";
|
|
7217
7219
|
}
|
|
7218
7220
|
const final2 = start2 + src + end;
|
|
@@ -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) {
|
|
@@ -8546,13 +8550,13 @@ var flagsSchema2 = _zod.z.object({
|
|
|
8546
8550
|
|
|
8547
8551
|
// src/cli/cmd/run/_utils.ts
|
|
8548
8552
|
async function determineAuthId(ctx) {
|
|
8549
|
-
const isByokMode = !!_optionalChain([ctx, 'access',
|
|
8553
|
+
const isByokMode = !!_optionalChain([ctx, 'access', _239 => _239.config, 'optionalAccess', _240 => _240.provider]);
|
|
8550
8554
|
if (isByokMode) {
|
|
8551
8555
|
return null;
|
|
8552
8556
|
} else {
|
|
8553
8557
|
try {
|
|
8554
|
-
const authStatus = await _optionalChain([ctx, 'access',
|
|
8555
|
-
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;
|
|
8556
8560
|
} catch (e3) {
|
|
8557
8561
|
return null;
|
|
8558
8562
|
}
|
|
@@ -8712,7 +8716,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
8712
8716
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
8713
8717
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
8714
8718
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
8715
|
-
_optionalChain([this, 'access',
|
|
8719
|
+
_optionalChain([this, 'access', _245 => _245.platformKit, 'optionalAccess', _246 => _246.gitConfig, 'call', _247 => _247()]);
|
|
8716
8720
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
8717
8721
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
8718
8722
|
if (!processOwnCommits) {
|
|
@@ -8744,7 +8748,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
8744
8748
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
8745
8749
|
var PullRequestFlow = class extends InBranchFlow {
|
|
8746
8750
|
async preRun() {
|
|
8747
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
8751
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _248 => _248()]);
|
|
8748
8752
|
if (!canContinue) {
|
|
8749
8753
|
return false;
|
|
8750
8754
|
}
|
|
@@ -9007,10 +9011,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
9007
9011
|
repo_slug: this.platformConfig.repositoryName,
|
|
9008
9012
|
state: "OPEN"
|
|
9009
9013
|
}).then(({ data: { values } }) => {
|
|
9010
|
-
return _optionalChain([values, 'optionalAccess',
|
|
9011
|
-
({ 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
|
|
9012
9016
|
)]);
|
|
9013
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
9017
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _255 => _255.id]));
|
|
9014
9018
|
}
|
|
9015
9019
|
async closePullRequest({ pullRequestNumber }) {
|
|
9016
9020
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -9106,7 +9110,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
9106
9110
|
repo: this.platformConfig.repositoryName,
|
|
9107
9111
|
base: this.platformConfig.baseBranchName,
|
|
9108
9112
|
state: "open"
|
|
9109
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
9113
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _256 => _256.number]));
|
|
9110
9114
|
}
|
|
9111
9115
|
async closePullRequest({ pullRequestNumber }) {
|
|
9112
9116
|
await this.octokit.rest.pulls.update({
|
|
@@ -9233,7 +9237,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
9233
9237
|
sourceBranch: branch,
|
|
9234
9238
|
state: "opened"
|
|
9235
9239
|
});
|
|
9236
|
-
return _optionalChain([mergeRequests, 'access',
|
|
9240
|
+
return _optionalChain([mergeRequests, 'access', _257 => _257[0], 'optionalAccess', _258 => _258.iid]);
|
|
9237
9241
|
}
|
|
9238
9242
|
async closePullRequest({
|
|
9239
9243
|
pullRequestNumber
|
|
@@ -9323,7 +9327,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
9323
9327
|
}
|
|
9324
9328
|
const env = {
|
|
9325
9329
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
9326
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
9330
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _259 => _259.pullRequest, 'optionalAccess', _260 => _260.toString, 'call', _261 => _261()]) || "false",
|
|
9327
9331
|
...options.commitMessage && {
|
|
9328
9332
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
9329
9333
|
},
|
|
@@ -9343,7 +9347,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
9343
9347
|
const { isPullRequestMode } = platformKit.config;
|
|
9344
9348
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
9345
9349
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
9346
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
9350
|
+
const canRun = await _optionalChain([flow, 'access', _262 => _262.preRun, 'optionalCall', _263 => _263()]);
|
|
9347
9351
|
if (canRun === false) {
|
|
9348
9352
|
return;
|
|
9349
9353
|
}
|
|
@@ -9353,7 +9357,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
9353
9357
|
if (!hasChanges) {
|
|
9354
9358
|
return;
|
|
9355
9359
|
}
|
|
9356
|
-
await _optionalChain([flow, 'access',
|
|
9360
|
+
await _optionalChain([flow, 'access', _264 => _264.postRun, 'optionalCall', _265 => _265()]);
|
|
9357
9361
|
});
|
|
9358
9362
|
function parseBooleanArg(val) {
|
|
9359
9363
|
if (val === true) return true;
|
|
@@ -9422,17 +9426,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
9422
9426
|
flags
|
|
9423
9427
|
});
|
|
9424
9428
|
let buckets = getBuckets(i18nConfig);
|
|
9425
|
-
if (_optionalChain([flags, 'access',
|
|
9429
|
+
if (_optionalChain([flags, 'access', _266 => _266.bucket, 'optionalAccess', _267 => _267.length])) {
|
|
9426
9430
|
buckets = buckets.filter(
|
|
9427
9431
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
9428
9432
|
);
|
|
9429
9433
|
}
|
|
9430
9434
|
ora.succeed("Buckets retrieved");
|
|
9431
|
-
if (_optionalChain([flags, 'access',
|
|
9435
|
+
if (_optionalChain([flags, 'access', _268 => _268.file, 'optionalAccess', _269 => _269.length])) {
|
|
9432
9436
|
buckets = buckets.map((bucket) => {
|
|
9433
9437
|
const paths = bucket.paths.filter(
|
|
9434
9438
|
(path17) => flags.file.find(
|
|
9435
|
-
(file) => _optionalChain([path17, 'access',
|
|
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)
|
|
9436
9440
|
)
|
|
9437
9441
|
);
|
|
9438
9442
|
return { ...bucket, paths };
|
|
@@ -9452,7 +9456,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
9452
9456
|
});
|
|
9453
9457
|
}
|
|
9454
9458
|
}
|
|
9455
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
9459
|
+
const targetLocales = _optionalChain([flags, 'access', _276 => _276.locale, 'optionalAccess', _277 => _277.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
9456
9460
|
let totalSourceKeyCount = 0;
|
|
9457
9461
|
let uniqueKeysToTranslate = 0;
|
|
9458
9462
|
let totalExistingTranslations = 0;
|
|
@@ -9856,12 +9860,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
9856
9860
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
9857
9861
|
docUrl: "bucketNotFound"
|
|
9858
9862
|
});
|
|
9859
|
-
} 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))])) {
|
|
9860
9864
|
throw new CLIError({
|
|
9861
9865
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
9862
9866
|
docUrl: "localeTargetNotFound"
|
|
9863
9867
|
});
|
|
9864
|
-
} else if (_optionalChain([flags, 'access',
|
|
9868
|
+
} else if (_optionalChain([flags, 'access', _281 => _281.bucket, 'optionalAccess', _282 => _282.some, 'call', _283 => _283(
|
|
9865
9869
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
9866
9870
|
)])) {
|
|
9867
9871
|
throw new CLIError({
|
|
@@ -9950,7 +9954,7 @@ async function renderHero2() {
|
|
|
9950
9954
|
// package.json
|
|
9951
9955
|
var package_default = {
|
|
9952
9956
|
name: "lingo.dev",
|
|
9953
|
-
version: "0.
|
|
9957
|
+
version: "0.105.0",
|
|
9954
9958
|
description: "Lingo.dev CLI",
|
|
9955
9959
|
private: false,
|
|
9956
9960
|
publishConfig: {
|
|
@@ -10225,7 +10229,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
|
|
|
10225
10229
|
if (options.file && options.file.length) {
|
|
10226
10230
|
buckets = buckets.map((bucket) => {
|
|
10227
10231
|
const paths = bucket.paths.filter(
|
|
10228
|
-
(bucketPath) => _optionalChain([options, 'access',
|
|
10232
|
+
(bucketPath) => _optionalChain([options, 'access', _284 => _284.file, 'optionalAccess', _285 => _285.some, 'call', _286 => _286((f) => bucketPath.pathPattern.includes(f))])
|
|
10229
10233
|
);
|
|
10230
10234
|
return { ...bucket, paths };
|
|
10231
10235
|
}).filter((bucket) => bucket.paths.length > 0);
|