lingo.dev 0.117.15 → 0.117.17
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 +167 -64
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +157 -54
- package/build/cli.mjs.map +1 -1
- package/package.json +3 -3
package/build/cli.cjs
CHANGED
|
@@ -5481,23 +5481,25 @@ function createPoDataLoader(params) {
|
|
|
5481
5481
|
const contextKey = _lodash2.default.keys(sectionPo.translations)[0];
|
|
5482
5482
|
const entries = sectionPo.translations[contextKey];
|
|
5483
5483
|
const msgid = Object.keys(entries).find((key) => entries[key].msgid);
|
|
5484
|
+
const currentSection = currentSections.find((cs) => {
|
|
5485
|
+
const csPo = _gettextparser2.default.po.parse(cs);
|
|
5486
|
+
const csContextKey = _lodash2.default.keys(csPo.translations)[0];
|
|
5487
|
+
const csEntries = csPo.translations[csContextKey];
|
|
5488
|
+
const csMsgid = Object.keys(csEntries).find(
|
|
5489
|
+
(key) => csEntries[key].msgid
|
|
5490
|
+
);
|
|
5491
|
+
return csMsgid === msgid;
|
|
5492
|
+
});
|
|
5484
5493
|
if (!msgid) {
|
|
5485
|
-
const currentSection = currentSections.find((cs) => {
|
|
5486
|
-
const csPo = _gettextparser2.default.po.parse(cs);
|
|
5487
|
-
const csContextKey = _lodash2.default.keys(csPo.translations)[0];
|
|
5488
|
-
const csEntries = csPo.translations[csContextKey];
|
|
5489
|
-
const csMsgid = Object.keys(csEntries).find(
|
|
5490
|
-
(key) => csEntries[key].msgid
|
|
5491
|
-
);
|
|
5492
|
-
return csMsgid === msgid;
|
|
5493
|
-
});
|
|
5494
5494
|
if (currentSection) {
|
|
5495
5495
|
return currentSection;
|
|
5496
5496
|
}
|
|
5497
5497
|
return section;
|
|
5498
5498
|
}
|
|
5499
5499
|
if (data[msgid]) {
|
|
5500
|
+
const headers = currentSection ? _gettextparser2.default.po.parse(currentSection).headers : sectionPo.headers;
|
|
5500
5501
|
const updatedPo = _lodash2.default.merge({}, sectionPo, {
|
|
5502
|
+
headers,
|
|
5501
5503
|
translations: {
|
|
5502
5504
|
[contextKey]: {
|
|
5503
5505
|
[msgid]: {
|
|
@@ -10800,27 +10802,128 @@ function withExponentialBackoff(fn, maxAttempts = 3, baseDelay = 1e3) {
|
|
|
10800
10802
|
// src/cli/utils/observability.ts
|
|
10801
10803
|
var _nodemachineid = require('node-machine-id'); var _nodemachineid2 = _interopRequireDefault(_nodemachineid);
|
|
10802
10804
|
var _https = require('https'); var _https2 = _interopRequireDefault(_https);
|
|
10805
|
+
|
|
10806
|
+
// src/cli/utils/repository-id.ts
|
|
10807
|
+
var _child_process = require('child_process'); var cp = _interopRequireWildcard(_child_process);
|
|
10808
|
+
var cachedGitRepoId = void 0;
|
|
10809
|
+
function getRepositoryId() {
|
|
10810
|
+
const ciRepoId = getCIRepositoryId();
|
|
10811
|
+
if (ciRepoId) return ciRepoId;
|
|
10812
|
+
const gitRepoId = getGitRepositoryId();
|
|
10813
|
+
if (gitRepoId) return gitRepoId;
|
|
10814
|
+
return null;
|
|
10815
|
+
}
|
|
10816
|
+
function getCIRepositoryId() {
|
|
10817
|
+
if (process.env.GITHUB_REPOSITORY) {
|
|
10818
|
+
return `github:${process.env.GITHUB_REPOSITORY}`;
|
|
10819
|
+
}
|
|
10820
|
+
if (process.env.CI_PROJECT_PATH) {
|
|
10821
|
+
return `gitlab:${process.env.CI_PROJECT_PATH}`;
|
|
10822
|
+
}
|
|
10823
|
+
if (process.env.BITBUCKET_REPO_FULL_NAME) {
|
|
10824
|
+
return `bitbucket:${process.env.BITBUCKET_REPO_FULL_NAME}`;
|
|
10825
|
+
}
|
|
10826
|
+
return null;
|
|
10827
|
+
}
|
|
10828
|
+
function getGitRepositoryId() {
|
|
10829
|
+
if (cachedGitRepoId !== void 0) {
|
|
10830
|
+
return cachedGitRepoId;
|
|
10831
|
+
}
|
|
10832
|
+
try {
|
|
10833
|
+
const remoteUrl = _child_process.execSync.call(void 0, "git config --get remote.origin.url", {
|
|
10834
|
+
encoding: "utf8",
|
|
10835
|
+
stdio: ["pipe", "pipe", "ignore"]
|
|
10836
|
+
}).trim();
|
|
10837
|
+
if (!remoteUrl) {
|
|
10838
|
+
cachedGitRepoId = null;
|
|
10839
|
+
return null;
|
|
10840
|
+
}
|
|
10841
|
+
cachedGitRepoId = parseGitUrl(remoteUrl);
|
|
10842
|
+
return cachedGitRepoId;
|
|
10843
|
+
} catch (e3) {
|
|
10844
|
+
cachedGitRepoId = null;
|
|
10845
|
+
return null;
|
|
10846
|
+
}
|
|
10847
|
+
}
|
|
10848
|
+
function parseGitUrl(url) {
|
|
10849
|
+
const cleanUrl = url.replace(/\.git$/, "");
|
|
10850
|
+
let platform = null;
|
|
10851
|
+
if (cleanUrl.includes("github.com")) {
|
|
10852
|
+
platform = "github";
|
|
10853
|
+
} else if (cleanUrl.includes("gitlab.com")) {
|
|
10854
|
+
platform = "gitlab";
|
|
10855
|
+
} else if (cleanUrl.includes("bitbucket.org")) {
|
|
10856
|
+
platform = "bitbucket";
|
|
10857
|
+
}
|
|
10858
|
+
const sshMatch = cleanUrl.match(/[@:]([^:/@]+\/[^:/@]+)$/);
|
|
10859
|
+
const httpsMatch = cleanUrl.match(/\/([^/]+\/[^/]+)$/);
|
|
10860
|
+
const repoPath = _optionalChain([sshMatch, 'optionalAccess', _340 => _340[1]]) || _optionalChain([httpsMatch, 'optionalAccess', _341 => _341[1]]);
|
|
10861
|
+
if (!repoPath) return null;
|
|
10862
|
+
if (platform) {
|
|
10863
|
+
return `${platform}:${repoPath}`;
|
|
10864
|
+
}
|
|
10865
|
+
return `git:${repoPath}`;
|
|
10866
|
+
}
|
|
10867
|
+
|
|
10868
|
+
// src/cli/utils/observability.ts
|
|
10803
10869
|
var { machineIdSync } = _nodemachineid2.default;
|
|
10804
10870
|
var POSTHOG_API_KEY = "phc_eR0iSoQufBxNY36k0f0T15UvHJdTfHlh8rJcxsfhfXk";
|
|
10805
10871
|
var POSTHOG_HOST = "eu.i.posthog.com";
|
|
10806
10872
|
var POSTHOG_PATH = "/i/v0/e/";
|
|
10807
10873
|
var REQUEST_TIMEOUT_MS = 1e3;
|
|
10874
|
+
var TRACKING_VERSION = "2.0";
|
|
10875
|
+
function determineDistinctId(providedId) {
|
|
10876
|
+
if (providedId) {
|
|
10877
|
+
const projectId = getRepositoryId();
|
|
10878
|
+
return {
|
|
10879
|
+
distinct_id: providedId,
|
|
10880
|
+
distinct_id_source: "email",
|
|
10881
|
+
project_id: projectId
|
|
10882
|
+
};
|
|
10883
|
+
}
|
|
10884
|
+
const repoId = getRepositoryId();
|
|
10885
|
+
if (repoId) {
|
|
10886
|
+
return {
|
|
10887
|
+
distinct_id: repoId,
|
|
10888
|
+
distinct_id_source: "git_repo",
|
|
10889
|
+
project_id: repoId
|
|
10890
|
+
};
|
|
10891
|
+
}
|
|
10892
|
+
const deviceId = `device-${machineIdSync()}`;
|
|
10893
|
+
if (process.env.DEBUG === "true") {
|
|
10894
|
+
console.warn(
|
|
10895
|
+
"[Tracking] Using device ID fallback. Consider using git repository for consistent tracking."
|
|
10896
|
+
);
|
|
10897
|
+
}
|
|
10898
|
+
return {
|
|
10899
|
+
distinct_id: deviceId,
|
|
10900
|
+
distinct_id_source: "device",
|
|
10901
|
+
project_id: null
|
|
10902
|
+
};
|
|
10903
|
+
}
|
|
10808
10904
|
function trackEvent(distinctId, event, properties) {
|
|
10809
10905
|
if (process.env.DO_NOT_TRACK === "1") {
|
|
10810
10906
|
return;
|
|
10811
10907
|
}
|
|
10812
10908
|
setImmediate(() => {
|
|
10813
10909
|
try {
|
|
10814
|
-
const
|
|
10910
|
+
const identityInfo = determineDistinctId(distinctId);
|
|
10911
|
+
if (process.env.DEBUG === "true") {
|
|
10912
|
+
console.log(
|
|
10913
|
+
`[Tracking] Event: ${event}, ID: ${identityInfo.distinct_id}, Source: ${identityInfo.distinct_id_source}`
|
|
10914
|
+
);
|
|
10915
|
+
}
|
|
10815
10916
|
const eventData = {
|
|
10816
10917
|
api_key: POSTHOG_API_KEY,
|
|
10817
10918
|
event,
|
|
10818
|
-
distinct_id:
|
|
10919
|
+
distinct_id: identityInfo.distinct_id,
|
|
10819
10920
|
properties: {
|
|
10820
10921
|
...properties,
|
|
10821
10922
|
$lib: "lingo.dev-cli",
|
|
10822
10923
|
$lib_version: process.env.npm_package_version || "unknown",
|
|
10823
|
-
|
|
10924
|
+
tracking_version: TRACKING_VERSION,
|
|
10925
|
+
distinct_id_source: identityInfo.distinct_id_source,
|
|
10926
|
+
project_id: identityInfo.project_id,
|
|
10824
10927
|
node_version: process.version,
|
|
10825
10928
|
is_ci: !!process.env.CI,
|
|
10826
10929
|
debug_enabled: process.env.DEBUG === "true"
|
|
@@ -11030,7 +11133,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
11030
11133
|
try {
|
|
11031
11134
|
flags = parseFlags(options);
|
|
11032
11135
|
} catch (parseError) {
|
|
11033
|
-
await trackEvent(
|
|
11136
|
+
await trackEvent(null, "cmd.i18n.error", {
|
|
11034
11137
|
errorType: "validation_error",
|
|
11035
11138
|
errorName: parseError.name || "ValidationError",
|
|
11036
11139
|
errorMessage: parseError.message || "Invalid command line options",
|
|
@@ -11062,7 +11165,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
11062
11165
|
validateParams(i18nConfig, flags);
|
|
11063
11166
|
ora.succeed("Localization configuration is valid");
|
|
11064
11167
|
ora.start("Connecting to Lingo.dev Localization Engine...");
|
|
11065
|
-
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess',
|
|
11168
|
+
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _342 => _342.provider]);
|
|
11066
11169
|
if (isByokMode) {
|
|
11067
11170
|
authId = null;
|
|
11068
11171
|
ora.succeed("Using external provider (BYOK mode)");
|
|
@@ -11076,16 +11179,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
11076
11179
|
flags
|
|
11077
11180
|
});
|
|
11078
11181
|
let buckets = getBuckets(i18nConfig);
|
|
11079
|
-
if (_optionalChain([flags, 'access',
|
|
11182
|
+
if (_optionalChain([flags, 'access', _343 => _343.bucket, 'optionalAccess', _344 => _344.length])) {
|
|
11080
11183
|
buckets = buckets.filter(
|
|
11081
11184
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
11082
11185
|
);
|
|
11083
11186
|
}
|
|
11084
11187
|
ora.succeed("Buckets retrieved");
|
|
11085
|
-
if (_optionalChain([flags, 'access',
|
|
11188
|
+
if (_optionalChain([flags, 'access', _345 => _345.file, 'optionalAccess', _346 => _346.length])) {
|
|
11086
11189
|
buckets = buckets.map((bucket) => {
|
|
11087
11190
|
const paths = bucket.paths.filter(
|
|
11088
|
-
(path19) => flags.file.find((file) => _optionalChain([path19, 'access',
|
|
11191
|
+
(path19) => flags.file.find((file) => _optionalChain([path19, 'access', _347 => _347.pathPattern, 'optionalAccess', _348 => _348.includes, 'call', _349 => _349(file)]))
|
|
11089
11192
|
);
|
|
11090
11193
|
return { ...bucket, paths };
|
|
11091
11194
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -11106,7 +11209,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
11106
11209
|
});
|
|
11107
11210
|
}
|
|
11108
11211
|
}
|
|
11109
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
11212
|
+
const targetLocales = _optionalChain([flags, 'access', _350 => _350.locale, 'optionalAccess', _351 => _351.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
11110
11213
|
ora.start("Setting up localization cache...");
|
|
11111
11214
|
const checkLockfileProcessor = createDeltaProcessor("");
|
|
11112
11215
|
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
@@ -11391,7 +11494,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
11391
11494
|
}
|
|
11392
11495
|
const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
|
|
11393
11496
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
11394
|
-
if (!_optionalChain([flags, 'access',
|
|
11497
|
+
if (!_optionalChain([flags, 'access', _352 => _352.locale, 'optionalAccess', _353 => _353.length])) {
|
|
11395
11498
|
await deltaProcessor.saveChecksums(checksums);
|
|
11396
11499
|
}
|
|
11397
11500
|
}
|
|
@@ -11430,7 +11533,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
11430
11533
|
});
|
|
11431
11534
|
} else {
|
|
11432
11535
|
ora.warn("Localization completed with errors.");
|
|
11433
|
-
await trackEvent(authId
|
|
11536
|
+
await trackEvent(authId, "cmd.i18n.error", {
|
|
11434
11537
|
flags,
|
|
11435
11538
|
...aggregateErrorAnalytics(
|
|
11436
11539
|
errorDetails,
|
|
@@ -11456,7 +11559,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
11456
11559
|
bucket: error.bucket
|
|
11457
11560
|
};
|
|
11458
11561
|
}
|
|
11459
|
-
await trackEvent(authId
|
|
11562
|
+
await trackEvent(authId, "cmd.i18n.error", {
|
|
11460
11563
|
flags,
|
|
11461
11564
|
errorType,
|
|
11462
11565
|
errorName: error.name || "Error",
|
|
@@ -11515,12 +11618,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
11515
11618
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
11516
11619
|
docUrl: "bucketNotFound"
|
|
11517
11620
|
});
|
|
11518
|
-
} else if (_optionalChain([flags, 'access',
|
|
11621
|
+
} else if (_optionalChain([flags, 'access', _354 => _354.locale, 'optionalAccess', _355 => _355.some, 'call', _356 => _356((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
11519
11622
|
throw new ValidationError({
|
|
11520
11623
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
11521
11624
|
docUrl: "localeTargetNotFound"
|
|
11522
11625
|
});
|
|
11523
|
-
} else if (_optionalChain([flags, 'access',
|
|
11626
|
+
} else if (_optionalChain([flags, 'access', _357 => _357.bucket, 'optionalAccess', _358 => _358.some, 'call', _359 => _359(
|
|
11524
11627
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
11525
11628
|
)])) {
|
|
11526
11629
|
throw new ValidationError({
|
|
@@ -11976,7 +12079,7 @@ var mcp_default = new (0, _interactivecommander.Command)().command("mcp").descri
|
|
|
11976
12079
|
|
|
11977
12080
|
|
|
11978
12081
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
11979
|
-
|
|
12082
|
+
|
|
11980
12083
|
|
|
11981
12084
|
// src/cli/cmd/ci/flows/in-branch.ts
|
|
11982
12085
|
|
|
@@ -12054,7 +12157,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
|
|
|
12054
12157
|
const response = await engine.whoami();
|
|
12055
12158
|
return {
|
|
12056
12159
|
authenticated: !!response,
|
|
12057
|
-
username: _optionalChain([response, 'optionalAccess',
|
|
12160
|
+
username: _optionalChain([response, 'optionalAccess', _360 => _360.email])
|
|
12058
12161
|
};
|
|
12059
12162
|
} catch (error) {
|
|
12060
12163
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -12170,7 +12273,7 @@ function createExplicitLocalizer(provider) {
|
|
|
12170
12273
|
}
|
|
12171
12274
|
function createAiSdkLocalizer(params) {
|
|
12172
12275
|
const skipAuth = params.skipAuth === true;
|
|
12173
|
-
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
12276
|
+
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _361 => _361.apiKeyName]), () => ( ""))];
|
|
12174
12277
|
if (!skipAuth && !apiKey || !params.apiKeyName) {
|
|
12175
12278
|
throw new Error(
|
|
12176
12279
|
_dedent2.default`
|
|
@@ -12304,8 +12407,8 @@ async function setup(input2) {
|
|
|
12304
12407
|
throw new Error(
|
|
12305
12408
|
"No buckets found in i18n.json. Please add at least one bucket containing i18n content."
|
|
12306
12409
|
);
|
|
12307
|
-
} else if (_optionalChain([ctx, 'access',
|
|
12308
|
-
(bucket) => !_optionalChain([ctx, 'access',
|
|
12410
|
+
} else if (_optionalChain([ctx, 'access', _362 => _362.flags, 'access', _363 => _363.bucket, 'optionalAccess', _364 => _364.some, 'call', _365 => _365(
|
|
12411
|
+
(bucket) => !_optionalChain([ctx, 'access', _366 => _366.config, 'optionalAccess', _367 => _367.buckets, 'access', _368 => _368[bucket]])
|
|
12309
12412
|
)])) {
|
|
12310
12413
|
throw new Error(
|
|
12311
12414
|
`One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
|
|
@@ -12318,7 +12421,7 @@ async function setup(input2) {
|
|
|
12318
12421
|
title: "Selecting localization provider",
|
|
12319
12422
|
task: async (ctx, task) => {
|
|
12320
12423
|
ctx.localizer = createLocalizer(
|
|
12321
|
-
_optionalChain([ctx, 'access',
|
|
12424
|
+
_optionalChain([ctx, 'access', _369 => _369.config, 'optionalAccess', _370 => _370.provider]),
|
|
12322
12425
|
ctx.flags.apiKey
|
|
12323
12426
|
);
|
|
12324
12427
|
if (!ctx.localizer) {
|
|
@@ -12331,7 +12434,7 @@ async function setup(input2) {
|
|
|
12331
12434
|
},
|
|
12332
12435
|
{
|
|
12333
12436
|
title: "Checking authentication",
|
|
12334
|
-
enabled: (ctx) => _optionalChain([ctx, 'access',
|
|
12437
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _371 => _371.localizer, 'optionalAccess', _372 => _372.id]) === "Lingo.dev",
|
|
12335
12438
|
task: async (ctx, task) => {
|
|
12336
12439
|
const authStatus = await ctx.localizer.checkAuth();
|
|
12337
12440
|
if (!authStatus.authenticated) {
|
|
@@ -12344,7 +12447,7 @@ async function setup(input2) {
|
|
|
12344
12447
|
},
|
|
12345
12448
|
{
|
|
12346
12449
|
title: "Validating configuration",
|
|
12347
|
-
enabled: (ctx) => _optionalChain([ctx, 'access',
|
|
12450
|
+
enabled: (ctx) => _optionalChain([ctx, 'access', _373 => _373.localizer, 'optionalAccess', _374 => _374.id]) !== "Lingo.dev",
|
|
12348
12451
|
task: async (ctx, task) => {
|
|
12349
12452
|
const validationStatus = await ctx.localizer.validateSettings();
|
|
12350
12453
|
if (!validationStatus.valid) {
|
|
@@ -12675,7 +12778,7 @@ function createWorkerTask(args) {
|
|
|
12675
12778
|
const processableData = _lodash2.default.chain(sourceData).entries().filter(
|
|
12676
12779
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
|
|
12677
12780
|
).filter(
|
|
12678
|
-
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access',
|
|
12781
|
+
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _375 => _375.onlyKeys, 'optionalAccess', _376 => _376.some, 'call', _377 => _377(
|
|
12679
12782
|
(pattern) => minimatch(key, pattern)
|
|
12680
12783
|
)])
|
|
12681
12784
|
).fromPairs().value();
|
|
@@ -12743,7 +12846,7 @@ function createWorkerTask(args) {
|
|
|
12743
12846
|
finalRenamedTargetData
|
|
12744
12847
|
);
|
|
12745
12848
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
12746
|
-
if (!_optionalChain([args, 'access',
|
|
12849
|
+
if (!_optionalChain([args, 'access', _378 => _378.ctx, 'access', _379 => _379.flags, 'access', _380 => _380.targetLocale, 'optionalAccess', _381 => _381.length])) {
|
|
12747
12850
|
await deltaProcessor.saveChecksums(checksums);
|
|
12748
12851
|
}
|
|
12749
12852
|
});
|
|
@@ -12948,10 +13051,10 @@ var flagsSchema2 = _zod.z.object({
|
|
|
12948
13051
|
async function frozen(input2) {
|
|
12949
13052
|
console.log(_chalk2.default.hex(colors.orange)("[Frozen]"));
|
|
12950
13053
|
let buckets = getBuckets(input2.config);
|
|
12951
|
-
if (_optionalChain([input2, 'access',
|
|
13054
|
+
if (_optionalChain([input2, 'access', _382 => _382.flags, 'access', _383 => _383.bucket, 'optionalAccess', _384 => _384.length])) {
|
|
12952
13055
|
buckets = buckets.filter((b) => input2.flags.bucket.includes(b.type));
|
|
12953
13056
|
}
|
|
12954
|
-
if (_optionalChain([input2, 'access',
|
|
13057
|
+
if (_optionalChain([input2, 'access', _385 => _385.flags, 'access', _386 => _386.file, 'optionalAccess', _387 => _387.length])) {
|
|
12955
13058
|
buckets = buckets.map((bucket) => {
|
|
12956
13059
|
const paths = bucket.paths.filter(
|
|
12957
13060
|
(p) => input2.flags.file.some(
|
|
@@ -13088,14 +13191,14 @@ async function frozen(input2) {
|
|
|
13088
13191
|
|
|
13089
13192
|
// src/cli/cmd/run/_utils.ts
|
|
13090
13193
|
async function determineAuthId(ctx) {
|
|
13091
|
-
const isByokMode = !!_optionalChain([ctx, 'access',
|
|
13194
|
+
const isByokMode = !!_optionalChain([ctx, 'access', _388 => _388.config, 'optionalAccess', _389 => _389.provider]);
|
|
13092
13195
|
if (isByokMode) {
|
|
13093
13196
|
return null;
|
|
13094
13197
|
} else {
|
|
13095
13198
|
try {
|
|
13096
|
-
const authStatus = await _optionalChain([ctx, 'access',
|
|
13097
|
-
return _optionalChain([authStatus, 'optionalAccess',
|
|
13098
|
-
} catch (
|
|
13199
|
+
const authStatus = await _optionalChain([ctx, 'access', _390 => _390.localizer, 'optionalAccess', _391 => _391.checkAuth, 'call', _392 => _392()]);
|
|
13200
|
+
return _optionalChain([authStatus, 'optionalAccess', _393 => _393.username]) || null;
|
|
13201
|
+
} catch (e4) {
|
|
13099
13202
|
return null;
|
|
13100
13203
|
}
|
|
13101
13204
|
}
|
|
@@ -13212,7 +13315,7 @@ var run_default = new (0, _interactivecommander.Command)().command("run").descri
|
|
|
13212
13315
|
flags: ctx.flags
|
|
13213
13316
|
});
|
|
13214
13317
|
} catch (error) {
|
|
13215
|
-
await trackEvent(authId
|
|
13318
|
+
await trackEvent(authId, "cmd.run.error", {});
|
|
13216
13319
|
if (args.sound) {
|
|
13217
13320
|
await playSound("failure");
|
|
13218
13321
|
}
|
|
@@ -13292,7 +13395,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
13292
13395
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
13293
13396
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
13294
13397
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
13295
|
-
_optionalChain([this, 'access',
|
|
13398
|
+
_optionalChain([this, 'access', _394 => _394.platformKit, 'optionalAccess', _395 => _395.gitConfig, 'call', _396 => _396()]);
|
|
13296
13399
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
13297
13400
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
13298
13401
|
if (!processOwnCommits) {
|
|
@@ -13324,7 +13427,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
13324
13427
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
13325
13428
|
var PullRequestFlow = class extends InBranchFlow {
|
|
13326
13429
|
async preRun() {
|
|
13327
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
13430
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _397 => _397()]);
|
|
13328
13431
|
if (!canContinue) {
|
|
13329
13432
|
return false;
|
|
13330
13433
|
}
|
|
@@ -13591,10 +13694,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
13591
13694
|
repo_slug: this.platformConfig.repositoryName,
|
|
13592
13695
|
state: "OPEN"
|
|
13593
13696
|
}).then(({ data: { values } }) => {
|
|
13594
|
-
return _optionalChain([values, 'optionalAccess',
|
|
13595
|
-
({ source, destination }) => _optionalChain([source, 'optionalAccess',
|
|
13697
|
+
return _optionalChain([values, 'optionalAccess', _398 => _398.find, 'call', _399 => _399(
|
|
13698
|
+
({ source, destination }) => _optionalChain([source, 'optionalAccess', _400 => _400.branch, 'optionalAccess', _401 => _401.name]) === branch && _optionalChain([destination, 'optionalAccess', _402 => _402.branch, 'optionalAccess', _403 => _403.name]) === this.platformConfig.baseBranchName
|
|
13596
13699
|
)]);
|
|
13597
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
13700
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _404 => _404.id]));
|
|
13598
13701
|
}
|
|
13599
13702
|
async closePullRequest({ pullRequestNumber }) {
|
|
13600
13703
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -13690,7 +13793,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
13690
13793
|
repo: this.platformConfig.repositoryName,
|
|
13691
13794
|
base: this.platformConfig.baseBranchName,
|
|
13692
13795
|
state: "open"
|
|
13693
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
13796
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _405 => _405.number]));
|
|
13694
13797
|
}
|
|
13695
13798
|
async closePullRequest({ pullRequestNumber }) {
|
|
13696
13799
|
await this.octokit.rest.pulls.update({
|
|
@@ -13805,7 +13908,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
13805
13908
|
branch
|
|
13806
13909
|
);
|
|
13807
13910
|
return true;
|
|
13808
|
-
} catch (
|
|
13911
|
+
} catch (e5) {
|
|
13809
13912
|
return false;
|
|
13810
13913
|
}
|
|
13811
13914
|
}
|
|
@@ -13817,7 +13920,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
13817
13920
|
sourceBranch: branch,
|
|
13818
13921
|
state: "opened"
|
|
13819
13922
|
});
|
|
13820
|
-
return _optionalChain([mergeRequests, 'access',
|
|
13923
|
+
return _optionalChain([mergeRequests, 'access', _406 => _406[0], 'optionalAccess', _407 => _407.iid]);
|
|
13821
13924
|
}
|
|
13822
13925
|
async closePullRequest({
|
|
13823
13926
|
pullRequestNumber
|
|
@@ -13929,7 +14032,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
13929
14032
|
}
|
|
13930
14033
|
const env = {
|
|
13931
14034
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
13932
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
14035
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _408 => _408.pullRequest, 'optionalAccess', _409 => _409.toString, 'call', _410 => _410()]) || "false",
|
|
13933
14036
|
...options.commitMessage && {
|
|
13934
14037
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
13935
14038
|
},
|
|
@@ -13955,7 +14058,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
13955
14058
|
const { isPullRequestMode } = platformKit.config;
|
|
13956
14059
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
13957
14060
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
13958
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
14061
|
+
const canRun = await _optionalChain([flow, 'access', _411 => _411.preRun, 'optionalCall', _412 => _412()]);
|
|
13959
14062
|
if (canRun === false) {
|
|
13960
14063
|
return;
|
|
13961
14064
|
}
|
|
@@ -13965,7 +14068,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
13965
14068
|
if (!hasChanges) {
|
|
13966
14069
|
return;
|
|
13967
14070
|
}
|
|
13968
|
-
await _optionalChain([flow, 'access',
|
|
14071
|
+
await _optionalChain([flow, 'access', _413 => _413.postRun, 'optionalCall', _414 => _414()]);
|
|
13969
14072
|
});
|
|
13970
14073
|
function parseBooleanArg(val) {
|
|
13971
14074
|
if (val === true) return true;
|
|
@@ -14002,8 +14105,8 @@ function exitGracefully(elapsedMs = 0) {
|
|
|
14002
14105
|
}
|
|
14003
14106
|
}
|
|
14004
14107
|
function checkForPendingOperations() {
|
|
14005
|
-
const activeHandles = _optionalChain([process, 'access',
|
|
14006
|
-
const activeRequests = _optionalChain([process, 'access',
|
|
14108
|
+
const activeHandles = _optionalChain([process, 'access', _415 => _415._getActiveHandles, 'optionalCall', _416 => _416()]) || [];
|
|
14109
|
+
const activeRequests = _optionalChain([process, 'access', _417 => _417._getActiveRequests, 'optionalCall', _418 => _418()]) || [];
|
|
14007
14110
|
const nonStandardHandles = activeHandles.filter((handle) => {
|
|
14008
14111
|
if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
|
|
14009
14112
|
return false;
|
|
@@ -14067,22 +14170,22 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
14067
14170
|
ora.start("Validating localization configuration...");
|
|
14068
14171
|
validateParams2(i18nConfig, flags);
|
|
14069
14172
|
ora.succeed("Localization configuration is valid");
|
|
14070
|
-
trackEvent(authId
|
|
14173
|
+
trackEvent(authId, "cmd.status.start", {
|
|
14071
14174
|
i18nConfig,
|
|
14072
14175
|
flags
|
|
14073
14176
|
});
|
|
14074
14177
|
let buckets = getBuckets(i18nConfig);
|
|
14075
|
-
if (_optionalChain([flags, 'access',
|
|
14178
|
+
if (_optionalChain([flags, 'access', _419 => _419.bucket, 'optionalAccess', _420 => _420.length])) {
|
|
14076
14179
|
buckets = buckets.filter(
|
|
14077
14180
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
14078
14181
|
);
|
|
14079
14182
|
}
|
|
14080
14183
|
ora.succeed("Buckets retrieved");
|
|
14081
|
-
if (_optionalChain([flags, 'access',
|
|
14184
|
+
if (_optionalChain([flags, 'access', _421 => _421.file, 'optionalAccess', _422 => _422.length])) {
|
|
14082
14185
|
buckets = buckets.map((bucket) => {
|
|
14083
14186
|
const paths = bucket.paths.filter(
|
|
14084
14187
|
(path19) => flags.file.find(
|
|
14085
|
-
(file) => _optionalChain([path19, 'access',
|
|
14188
|
+
(file) => _optionalChain([path19, 'access', _423 => _423.pathPattern, 'optionalAccess', _424 => _424.includes, 'call', _425 => _425(file)]) || _optionalChain([path19, 'access', _426 => _426.pathPattern, 'optionalAccess', _427 => _427.match, 'call', _428 => _428(file)]) || minimatch(path19.pathPattern, file)
|
|
14086
14189
|
)
|
|
14087
14190
|
);
|
|
14088
14191
|
return { ...bucket, paths };
|
|
@@ -14102,7 +14205,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
14102
14205
|
});
|
|
14103
14206
|
}
|
|
14104
14207
|
}
|
|
14105
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
14208
|
+
const targetLocales = _optionalChain([flags, 'access', _429 => _429.locale, 'optionalAccess', _430 => _430.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
14106
14209
|
let totalSourceKeyCount = 0;
|
|
14107
14210
|
let uniqueKeysToTranslate = 0;
|
|
14108
14211
|
let totalExistingTranslations = 0;
|
|
@@ -14454,7 +14557,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
14454
14557
|
`\u2022 Try 'lingo.dev@latest i18n --locale ${targetLocales[0]}' to process just one language`
|
|
14455
14558
|
);
|
|
14456
14559
|
}
|
|
14457
|
-
trackEvent(authId
|
|
14560
|
+
trackEvent(authId, "cmd.status.success", {
|
|
14458
14561
|
i18nConfig,
|
|
14459
14562
|
flags,
|
|
14460
14563
|
totalSourceKeyCount,
|
|
@@ -14465,7 +14568,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
|
|
|
14465
14568
|
exitGracefully();
|
|
14466
14569
|
} catch (error) {
|
|
14467
14570
|
ora.fail(error.message);
|
|
14468
|
-
trackEvent(authId
|
|
14571
|
+
trackEvent(authId, "cmd.status.error", {
|
|
14469
14572
|
flags,
|
|
14470
14573
|
error: error.message,
|
|
14471
14574
|
authenticated: !!authId
|
|
@@ -14510,12 +14613,12 @@ function validateParams2(i18nConfig, flags) {
|
|
|
14510
14613
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
14511
14614
|
docUrl: "bucketNotFound"
|
|
14512
14615
|
});
|
|
14513
|
-
} else if (_optionalChain([flags, 'access',
|
|
14616
|
+
} else if (_optionalChain([flags, 'access', _431 => _431.locale, 'optionalAccess', _432 => _432.some, 'call', _433 => _433((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
14514
14617
|
throw new CLIError({
|
|
14515
14618
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
14516
14619
|
docUrl: "localeTargetNotFound"
|
|
14517
14620
|
});
|
|
14518
|
-
} else if (_optionalChain([flags, 'access',
|
|
14621
|
+
} else if (_optionalChain([flags, 'access', _434 => _434.bucket, 'optionalAccess', _435 => _435.some, 'call', _436 => _436(
|
|
14519
14622
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
14520
14623
|
)])) {
|
|
14521
14624
|
throw new CLIError({
|
|
@@ -14607,7 +14710,7 @@ async function renderHero2() {
|
|
|
14607
14710
|
// package.json
|
|
14608
14711
|
var package_default = {
|
|
14609
14712
|
name: "lingo.dev",
|
|
14610
|
-
version: "0.117.
|
|
14713
|
+
version: "0.117.17",
|
|
14611
14714
|
description: "Lingo.dev CLI",
|
|
14612
14715
|
private: false,
|
|
14613
14716
|
repository: {
|
|
@@ -14909,7 +15012,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
|
|
|
14909
15012
|
if (options.file && options.file.length) {
|
|
14910
15013
|
buckets = buckets.map((bucket) => {
|
|
14911
15014
|
const paths = bucket.paths.filter(
|
|
14912
|
-
(bucketPath) => _optionalChain([options, 'access',
|
|
15015
|
+
(bucketPath) => _optionalChain([options, 'access', _437 => _437.file, 'optionalAccess', _438 => _438.some, 'call', _439 => _439((f) => bucketPath.pathPattern.includes(f))])
|
|
14913
15016
|
);
|
|
14914
15017
|
return { ...bucket, paths };
|
|
14915
15018
|
}).filter((bucket) => bucket.paths.length > 0);
|