lingo.dev 0.119.0 → 0.121.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 CHANGED
@@ -9986,10 +9986,67 @@ function setNestedLocale(obj, path20, locale, value, originalLocale) {
9986
9986
  }
9987
9987
  }
9988
9988
 
9989
+ // src/cli/loaders/csv-per-locale.ts
9990
+
9991
+
9992
+ function dedupeHeaders(headers) {
9993
+ const seen = /* @__PURE__ */ new Map();
9994
+ return headers.map((h) => {
9995
+ const count = _nullishCoalesce(seen.get(h), () => ( 0));
9996
+ seen.set(h, count + 1);
9997
+ return count === 0 ? h : `${h}__${count + 1}`;
9998
+ });
9999
+ }
10000
+ function createCsvPerLocaleLoader() {
10001
+ return createLoader({
10002
+ async pull(_locale, input2) {
10003
+ if (!_optionalChain([input2, 'optionalAccess', _344 => _344.trim, 'call', _345 => _345()])) return {};
10004
+ const parsed = _sync.parse.call(void 0, input2, {
10005
+ skip_empty_lines: true,
10006
+ columns: (headers) => {
10007
+ const dedupedHeaders = dedupeHeaders(headers);
10008
+ return dedupedHeaders;
10009
+ }
10010
+ });
10011
+ if (parsed.length === 0) return {};
10012
+ return parsed;
10013
+ },
10014
+ async push(_locale, data, originalInput) {
10015
+ const rawRows = _sync.parse.call(void 0, originalInput || "", {
10016
+ skip_empty_lines: true
10017
+ });
10018
+ const originalHeaders = rawRows[0];
10019
+ const dedupedHeaders = dedupeHeaders(originalHeaders);
10020
+ const columns = originalHeaders.map((header, i) => ({
10021
+ key: dedupedHeaders[i],
10022
+ header
10023
+ }));
10024
+ const rows = Object.values(data).filter(
10025
+ (row) => row && Object.values(row).some(
10026
+ (v) => v !== void 0 && v !== null
10027
+ )
10028
+ );
10029
+ const output = _sync3.stringify.call(void 0, rows, {
10030
+ header: true,
10031
+ columns
10032
+ }).trimEnd();
10033
+ return output;
10034
+ }
10035
+ });
10036
+ }
10037
+
9989
10038
  // src/cli/loaders/index.ts
9990
10039
  function encodeKeys(keys) {
9991
10040
  return keys.map((key) => encodeURIComponent(key));
9992
10041
  }
10042
+ function normalizeCsvPatterns(patterns) {
10043
+ return patterns.map((pattern) => {
10044
+ if (pattern.includes("/") || pattern.startsWith("*/")) {
10045
+ return pattern;
10046
+ }
10047
+ return `*/${pattern}`;
10048
+ });
10049
+ }
9993
10050
  function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys, lockedPatterns, ignoredKeys) {
9994
10051
  switch (bucketType) {
9995
10052
  default:
@@ -10030,6 +10087,18 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
10030
10087
  createSyncLoader(),
10031
10088
  createUnlocalizableLoader(options.returnUnlocalizedKeys)
10032
10089
  );
10090
+ case "csv-per-locale":
10091
+ return composeLoaders(
10092
+ createTextFileLoader(bucketPathPattern),
10093
+ createLockedPatternsLoader(lockedPatterns),
10094
+ createCsvPerLocaleLoader(),
10095
+ createEnsureKeyOrderLoader(),
10096
+ createFlatLoader(),
10097
+ createLockedKeysLoader(normalizeCsvPatterns(lockedKeys || [])),
10098
+ createIgnoredKeysLoader(normalizeCsvPatterns(ignoredKeys || [])),
10099
+ createSyncLoader(),
10100
+ createUnlocalizableLoader(options.returnUnlocalizedKeys)
10101
+ );
10033
10102
  case "html":
10034
10103
  return composeLoaders(
10035
10104
  createTextFileLoader(bucketPathPattern),
@@ -10761,7 +10830,7 @@ function createBasicTranslator(model, systemPrompt, settings = {}) {
10761
10830
  ]
10762
10831
  });
10763
10832
  const result = JSON.parse(response.text);
10764
- return _optionalChain([result, 'optionalAccess', _344 => _344.data]) || {};
10833
+ return _optionalChain([result, 'optionalAccess', _346 => _346.data]) || {};
10765
10834
  }
10766
10835
  }
10767
10836
  function extractPayloadChunks(payload) {
@@ -10844,7 +10913,7 @@ function getPureModelProvider(provider) {
10844
10913
 
10845
10914
  ${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
10846
10915
  `;
10847
- switch (_optionalChain([provider, 'optionalAccess', _345 => _345.id])) {
10916
+ switch (_optionalChain([provider, 'optionalAccess', _347 => _347.id])) {
10848
10917
  case "openai": {
10849
10918
  if (!process.env.OPENAI_API_KEY) {
10850
10919
  throw new Error(
@@ -10902,7 +10971,7 @@ function getPureModelProvider(provider) {
10902
10971
  })(provider.model);
10903
10972
  }
10904
10973
  default: {
10905
- throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _346 => _346.id])));
10974
+ throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _348 => _348.id])));
10906
10975
  }
10907
10976
  }
10908
10977
  }
@@ -10994,7 +11063,7 @@ function parseGitUrl(url) {
10994
11063
  }
10995
11064
  const sshMatch = cleanUrl.match(/[@:]([^:/@]+\/[^:/@]+)$/);
10996
11065
  const httpsMatch = cleanUrl.match(/\/([^/]+\/[^/]+)$/);
10997
- const repoPath = _optionalChain([sshMatch, 'optionalAccess', _347 => _347[1]]) || _optionalChain([httpsMatch, 'optionalAccess', _348 => _348[1]]);
11066
+ const repoPath = _optionalChain([sshMatch, 'optionalAccess', _349 => _349[1]]) || _optionalChain([httpsMatch, 'optionalAccess', _350 => _350[1]]);
10998
11067
  if (!repoPath) return null;
10999
11068
  const hashedPath = hashProjectName(repoPath);
11000
11069
  if (platform) {
@@ -11304,7 +11373,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
11304
11373
  validateParams(i18nConfig, flags);
11305
11374
  ora.succeed("Localization configuration is valid");
11306
11375
  ora.start("Connecting to Lingo.dev Localization Engine...");
11307
- const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _349 => _349.provider]);
11376
+ const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _351 => _351.provider]);
11308
11377
  if (isByokMode) {
11309
11378
  email = null;
11310
11379
  ora.succeed("Using external provider (BYOK mode)");
@@ -11318,16 +11387,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
11318
11387
  flags
11319
11388
  });
11320
11389
  let buckets = getBuckets(i18nConfig);
11321
- if (_optionalChain([flags, 'access', _350 => _350.bucket, 'optionalAccess', _351 => _351.length])) {
11390
+ if (_optionalChain([flags, 'access', _352 => _352.bucket, 'optionalAccess', _353 => _353.length])) {
11322
11391
  buckets = buckets.filter(
11323
11392
  (bucket) => flags.bucket.includes(bucket.type)
11324
11393
  );
11325
11394
  }
11326
11395
  ora.succeed("Buckets retrieved");
11327
- if (_optionalChain([flags, 'access', _352 => _352.file, 'optionalAccess', _353 => _353.length])) {
11396
+ if (_optionalChain([flags, 'access', _354 => _354.file, 'optionalAccess', _355 => _355.length])) {
11328
11397
  buckets = buckets.map((bucket) => {
11329
11398
  const paths = bucket.paths.filter(
11330
- (path20) => flags.file.find((file) => _optionalChain([path20, 'access', _354 => _354.pathPattern, 'optionalAccess', _355 => _355.includes, 'call', _356 => _356(file)]))
11399
+ (path20) => flags.file.find((file) => _optionalChain([path20, 'access', _356 => _356.pathPattern, 'optionalAccess', _357 => _357.includes, 'call', _358 => _358(file)]))
11331
11400
  );
11332
11401
  return { ...bucket, paths };
11333
11402
  }).filter((bucket) => bucket.paths.length > 0);
@@ -11348,7 +11417,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
11348
11417
  });
11349
11418
  }
11350
11419
  }
11351
- const targetLocales = _optionalChain([flags, 'access', _357 => _357.locale, 'optionalAccess', _358 => _358.length]) ? flags.locale : i18nConfig.locale.targets;
11420
+ const targetLocales = _optionalChain([flags, 'access', _359 => _359.locale, 'optionalAccess', _360 => _360.length]) ? flags.locale : i18nConfig.locale.targets;
11352
11421
  ora.start("Setting up localization cache...");
11353
11422
  const checkLockfileProcessor = createDeltaProcessor("");
11354
11423
  const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
@@ -11633,7 +11702,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
11633
11702
  }
11634
11703
  const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
11635
11704
  const checksums = await deltaProcessor.createChecksums(sourceData);
11636
- if (!_optionalChain([flags, 'access', _359 => _359.locale, 'optionalAccess', _360 => _360.length])) {
11705
+ if (!_optionalChain([flags, 'access', _361 => _361.locale, 'optionalAccess', _362 => _362.length])) {
11637
11706
  await deltaProcessor.saveChecksums(checksums);
11638
11707
  }
11639
11708
  }
@@ -11760,12 +11829,12 @@ function validateParams(i18nConfig, flags) {
11760
11829
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
11761
11830
  docUrl: "bucketNotFound"
11762
11831
  });
11763
- } else if (_optionalChain([flags, 'access', _361 => _361.locale, 'optionalAccess', _362 => _362.some, 'call', _363 => _363((locale) => !i18nConfig.locale.targets.includes(locale))])) {
11832
+ } else if (_optionalChain([flags, 'access', _363 => _363.locale, 'optionalAccess', _364 => _364.some, 'call', _365 => _365((locale) => !i18nConfig.locale.targets.includes(locale))])) {
11764
11833
  throw new ValidationError({
11765
11834
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
11766
11835
  docUrl: "localeTargetNotFound"
11767
11836
  });
11768
- } else if (_optionalChain([flags, 'access', _364 => _364.bucket, 'optionalAccess', _365 => _365.some, 'call', _366 => _366(
11837
+ } else if (_optionalChain([flags, 'access', _366 => _366.bucket, 'optionalAccess', _367 => _367.some, 'call', _368 => _368(
11769
11838
  (bucket) => !i18nConfig.buckets[bucket]
11770
11839
  )])) {
11771
11840
  throw new ValidationError({
@@ -12299,7 +12368,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
12299
12368
  const response = await engine.whoami();
12300
12369
  return {
12301
12370
  authenticated: !!response,
12302
- username: _optionalChain([response, 'optionalAccess', _367 => _367.email])
12371
+ username: _optionalChain([response, 'optionalAccess', _369 => _369.email])
12303
12372
  };
12304
12373
  } catch (error) {
12305
12374
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -12441,7 +12510,7 @@ function countWordsInRecord2(payload) {
12441
12510
  }
12442
12511
  function createLingoDotDevVNextLocalizer(processId) {
12443
12512
  const settings = getSettings(void 0);
12444
- const apiKey = process.env.LINGO_API_KEY || _optionalChain([settings, 'access', _368 => _368.auth, 'access', _369 => _369.vnext, 'optionalAccess', _370 => _370.apiKey]);
12513
+ const apiKey = process.env.LINGO_API_KEY || _optionalChain([settings, 'access', _370 => _370.auth, 'access', _371 => _371.vnext, 'optionalAccess', _372 => _372.apiKey]);
12445
12514
  if (!apiKey) {
12446
12515
  throw new Error(
12447
12516
  _dedent2.default`
@@ -12468,7 +12537,7 @@ function createLingoDotDevVNextLocalizer(processId) {
12468
12537
  const response = await engine.whoami();
12469
12538
  return {
12470
12539
  authenticated: !!response,
12471
- username: _optionalChain([response, 'optionalAccess', _371 => _371.email])
12540
+ username: _optionalChain([response, 'optionalAccess', _373 => _373.email])
12472
12541
  };
12473
12542
  } catch (error) {
12474
12543
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -12584,8 +12653,8 @@ function createExplicitLocalizer(provider) {
12584
12653
  }
12585
12654
  function createAiSdkLocalizer(params) {
12586
12655
  const skipAuth = params.skipAuth === true;
12587
- const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _372 => _372.apiKeyName]), () => ( ""))];
12588
- if (!skipAuth && !apiKey || !params.apiKeyName) {
12656
+ const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _374 => _374.apiKeyName]), () => ( ""))];
12657
+ if (!skipAuth && (!apiKey || !params.apiKeyName)) {
12589
12658
  throw new Error(
12590
12659
  _dedent2.default`
12591
12660
  You're trying to use raw ${_chalk2.default.dim(params.id)} API for translation. ${params.apiKeyName ? `However, ${_chalk2.default.dim(
@@ -12843,8 +12912,8 @@ async function setup(input2) {
12843
12912
  throw new Error(
12844
12913
  "No buckets found in i18n.json. Please add at least one bucket containing i18n content."
12845
12914
  );
12846
- } else if (_optionalChain([ctx, 'access', _373 => _373.flags, 'access', _374 => _374.bucket, 'optionalAccess', _375 => _375.some, 'call', _376 => _376(
12847
- (bucket) => !_optionalChain([ctx, 'access', _377 => _377.config, 'optionalAccess', _378 => _378.buckets, 'access', _379 => _379[bucket]])
12915
+ } else if (_optionalChain([ctx, 'access', _375 => _375.flags, 'access', _376 => _376.bucket, 'optionalAccess', _377 => _377.some, 'call', _378 => _378(
12916
+ (bucket) => !_optionalChain([ctx, 'access', _379 => _379.config, 'optionalAccess', _380 => _380.buckets, 'access', _381 => _381[bucket]])
12848
12917
  )])) {
12849
12918
  throw new Error(
12850
12919
  `One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
@@ -12856,8 +12925,8 @@ async function setup(input2) {
12856
12925
  {
12857
12926
  title: "Selecting localization provider",
12858
12927
  task: async (ctx, task) => {
12859
- const provider = ctx.flags.pseudo ? "pseudo" : _optionalChain([ctx, 'access', _380 => _380.config, 'optionalAccess', _381 => _381.provider]);
12860
- const vNext = _optionalChain([ctx, 'access', _382 => _382.config, 'optionalAccess', _383 => _383.vNext]);
12928
+ const provider = ctx.flags.pseudo ? "pseudo" : _optionalChain([ctx, 'access', _382 => _382.config, 'optionalAccess', _383 => _383.provider]);
12929
+ const vNext = _optionalChain([ctx, 'access', _384 => _384.config, 'optionalAccess', _385 => _385.vNext]);
12861
12930
  ctx.localizer = createLocalizer(provider, ctx.flags.apiKey, vNext);
12862
12931
  if (!ctx.localizer) {
12863
12932
  throw new Error(
@@ -12869,7 +12938,7 @@ async function setup(input2) {
12869
12938
  },
12870
12939
  {
12871
12940
  title: "Checking authentication",
12872
- enabled: (ctx) => (_optionalChain([ctx, 'access', _384 => _384.localizer, 'optionalAccess', _385 => _385.id]) === "Lingo.dev" || _optionalChain([ctx, 'access', _386 => _386.localizer, 'optionalAccess', _387 => _387.id]) === "Lingo.dev vNext") && !ctx.flags.pseudo,
12941
+ enabled: (ctx) => (_optionalChain([ctx, 'access', _386 => _386.localizer, 'optionalAccess', _387 => _387.id]) === "Lingo.dev" || _optionalChain([ctx, 'access', _388 => _388.localizer, 'optionalAccess', _389 => _389.id]) === "Lingo.dev vNext") && !ctx.flags.pseudo,
12873
12942
  task: async (ctx, task) => {
12874
12943
  const authStatus = await ctx.localizer.checkAuth();
12875
12944
  if (!authStatus.authenticated) {
@@ -12882,7 +12951,7 @@ async function setup(input2) {
12882
12951
  },
12883
12952
  {
12884
12953
  title: "Validating configuration",
12885
- enabled: (ctx) => _optionalChain([ctx, 'access', _388 => _388.localizer, 'optionalAccess', _389 => _389.id]) !== "Lingo.dev" && _optionalChain([ctx, 'access', _390 => _390.localizer, 'optionalAccess', _391 => _391.id]) !== "Lingo.dev vNext",
12954
+ enabled: (ctx) => _optionalChain([ctx, 'access', _390 => _390.localizer, 'optionalAccess', _391 => _391.id]) !== "Lingo.dev" && _optionalChain([ctx, 'access', _392 => _392.localizer, 'optionalAccess', _393 => _393.id]) !== "Lingo.dev vNext",
12886
12955
  task: async (ctx, task) => {
12887
12956
  const validationStatus = await ctx.localizer.validateSettings();
12888
12957
  if (!validationStatus.valid) {
@@ -13055,13 +13124,19 @@ async function plan(input2) {
13055
13124
 
13056
13125
  var _plimit = require('p-limit'); var _plimit2 = _interopRequireDefault(_plimit);
13057
13126
 
13058
- var MAX_WORKER_COUNT = 10;
13127
+ var WARN_CONCURRENCY_COUNT = 30;
13059
13128
  async function execute(input2) {
13060
13129
  const effectiveConcurrency = Math.min(
13061
13130
  input2.flags.concurrency,
13062
- input2.tasks.length,
13063
- MAX_WORKER_COUNT
13131
+ input2.tasks.length
13064
13132
  );
13133
+ if (effectiveConcurrency >= WARN_CONCURRENCY_COUNT) {
13134
+ console.warn(
13135
+ _chalk2.default.yellow(
13136
+ `\u26A0\uFE0F High concurrency (${effectiveConcurrency}) may cause failures in some environments.`
13137
+ )
13138
+ );
13139
+ }
13065
13140
  console.log(_chalk2.default.hex(colors.orange)(`[Localization]`));
13066
13141
  return new (0, _listr2.Listr)(
13067
13142
  [
@@ -13219,7 +13294,7 @@ function createWorkerTask(args) {
13219
13294
  const processableData = _lodash2.default.chain(sourceData).entries().filter(
13220
13295
  ([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
13221
13296
  ).filter(
13222
- ([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _392 => _392.onlyKeys, 'optionalAccess', _393 => _393.some, 'call', _394 => _394(
13297
+ ([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _394 => _394.onlyKeys, 'optionalAccess', _395 => _395.some, 'call', _396 => _396(
13223
13298
  (pattern) => minimatch(key, pattern)
13224
13299
  )])
13225
13300
  ).fromPairs().value();
@@ -13287,7 +13362,7 @@ function createWorkerTask(args) {
13287
13362
  finalRenamedTargetData
13288
13363
  );
13289
13364
  const checksums = await deltaProcessor.createChecksums(sourceData);
13290
- if (!_optionalChain([args, 'access', _395 => _395.ctx, 'access', _396 => _396.flags, 'access', _397 => _397.targetLocale, 'optionalAccess', _398 => _398.length])) {
13365
+ if (!_optionalChain([args, 'access', _397 => _397.ctx, 'access', _398 => _398.flags, 'access', _399 => _399.targetLocale, 'optionalAccess', _400 => _400.length])) {
13291
13366
  await deltaProcessor.saveChecksums(checksums);
13292
13367
  }
13293
13368
  });
@@ -13493,10 +13568,10 @@ var flagsSchema2 = _zod.z.object({
13493
13568
  async function frozen(input2) {
13494
13569
  console.log(_chalk2.default.hex(colors.orange)("[Frozen]"));
13495
13570
  let buckets = getBuckets(input2.config);
13496
- if (_optionalChain([input2, 'access', _399 => _399.flags, 'access', _400 => _400.bucket, 'optionalAccess', _401 => _401.length])) {
13571
+ if (_optionalChain([input2, 'access', _401 => _401.flags, 'access', _402 => _402.bucket, 'optionalAccess', _403 => _403.length])) {
13497
13572
  buckets = buckets.filter((b) => input2.flags.bucket.includes(b.type));
13498
13573
  }
13499
- if (_optionalChain([input2, 'access', _402 => _402.flags, 'access', _403 => _403.file, 'optionalAccess', _404 => _404.length])) {
13574
+ if (_optionalChain([input2, 'access', _404 => _404.flags, 'access', _405 => _405.file, 'optionalAccess', _406 => _406.length])) {
13500
13575
  buckets = buckets.map((bucket) => {
13501
13576
  const paths = bucket.paths.filter(
13502
13577
  (p) => input2.flags.file.some(
@@ -13633,13 +13708,13 @@ async function frozen(input2) {
13633
13708
 
13634
13709
  // src/cli/cmd/run/_utils.ts
13635
13710
  async function determineEmail(ctx) {
13636
- const isByokMode = !!_optionalChain([ctx, 'access', _405 => _405.config, 'optionalAccess', _406 => _406.provider]);
13711
+ const isByokMode = !!_optionalChain([ctx, 'access', _407 => _407.config, 'optionalAccess', _408 => _408.provider]);
13637
13712
  if (isByokMode) {
13638
13713
  return null;
13639
13714
  } else {
13640
13715
  try {
13641
- const authStatus = await _optionalChain([ctx, 'access', _407 => _407.localizer, 'optionalAccess', _408 => _408.checkAuth, 'call', _409 => _409()]);
13642
- return _optionalChain([authStatus, 'optionalAccess', _410 => _410.username]) || null;
13716
+ const authStatus = await _optionalChain([ctx, 'access', _409 => _409.localizer, 'optionalAccess', _410 => _410.checkAuth, 'call', _411 => _411()]);
13717
+ return _optionalChain([authStatus, 'optionalAccess', _412 => _412.username]) || null;
13643
13718
  } catch (e4) {
13644
13719
  return null;
13645
13720
  }
@@ -13846,7 +13921,7 @@ var InBranchFlow = class extends IntegrationFlow {
13846
13921
  _child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
13847
13922
  _child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
13848
13923
  _child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
13849
- _optionalChain([this, 'access', _411 => _411.platformKit, 'optionalAccess', _412 => _412.gitConfig, 'call', _413 => _413()]);
13924
+ _optionalChain([this, 'access', _413 => _413.platformKit, 'optionalAccess', _414 => _414.gitConfig, 'call', _415 => _415()]);
13850
13925
  _child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
13851
13926
  _child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
13852
13927
  if (!processOwnCommits) {
@@ -13878,7 +13953,7 @@ var InBranchFlow = class extends IntegrationFlow {
13878
13953
  // src/cli/cmd/ci/flows/pull-request.ts
13879
13954
  var PullRequestFlow = class extends InBranchFlow {
13880
13955
  async preRun() {
13881
- const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _414 => _414()]);
13956
+ const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _416 => _416()]);
13882
13957
  if (!canContinue) {
13883
13958
  return false;
13884
13959
  }
@@ -14145,10 +14220,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
14145
14220
  repo_slug: this.platformConfig.repositoryName,
14146
14221
  state: "OPEN"
14147
14222
  }).then(({ data: { values } }) => {
14148
- return _optionalChain([values, 'optionalAccess', _415 => _415.find, 'call', _416 => _416(
14149
- ({ source, destination }) => _optionalChain([source, 'optionalAccess', _417 => _417.branch, 'optionalAccess', _418 => _418.name]) === branch && _optionalChain([destination, 'optionalAccess', _419 => _419.branch, 'optionalAccess', _420 => _420.name]) === this.platformConfig.baseBranchName
14223
+ return _optionalChain([values, 'optionalAccess', _417 => _417.find, 'call', _418 => _418(
14224
+ ({ source, destination }) => _optionalChain([source, 'optionalAccess', _419 => _419.branch, 'optionalAccess', _420 => _420.name]) === branch && _optionalChain([destination, 'optionalAccess', _421 => _421.branch, 'optionalAccess', _422 => _422.name]) === this.platformConfig.baseBranchName
14150
14225
  )]);
14151
- }).then((pr) => _optionalChain([pr, 'optionalAccess', _421 => _421.id]));
14226
+ }).then((pr) => _optionalChain([pr, 'optionalAccess', _423 => _423.id]));
14152
14227
  }
14153
14228
  async closePullRequest({ pullRequestNumber }) {
14154
14229
  await this.bb.repositories.declinePullRequest({
@@ -14244,7 +14319,7 @@ var GitHubPlatformKit = class extends PlatformKit {
14244
14319
  repo: this.platformConfig.repositoryName,
14245
14320
  base: this.platformConfig.baseBranchName,
14246
14321
  state: "open"
14247
- }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _422 => _422.number]));
14322
+ }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _424 => _424.number]));
14248
14323
  }
14249
14324
  async closePullRequest({ pullRequestNumber }) {
14250
14325
  await this.octokit.rest.pulls.update({
@@ -14371,7 +14446,7 @@ var GitlabPlatformKit = class extends PlatformKit {
14371
14446
  sourceBranch: branch,
14372
14447
  state: "opened"
14373
14448
  });
14374
- return _optionalChain([mergeRequests, 'access', _423 => _423[0], 'optionalAccess', _424 => _424.iid]);
14449
+ return _optionalChain([mergeRequests, 'access', _425 => _425[0], 'optionalAccess', _426 => _426.iid]);
14375
14450
  }
14376
14451
  async closePullRequest({
14377
14452
  pullRequestNumber
@@ -14483,7 +14558,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
14483
14558
  }
14484
14559
  const env = {
14485
14560
  LINGODOTDEV_API_KEY: settings.auth.apiKey,
14486
- LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _425 => _425.pullRequest, 'optionalAccess', _426 => _426.toString, 'call', _427 => _427()]) || "false",
14561
+ LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _427 => _427.pullRequest, 'optionalAccess', _428 => _428.toString, 'call', _429 => _429()]) || "false",
14487
14562
  ...options.commitMessage && {
14488
14563
  LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
14489
14564
  },
@@ -14509,7 +14584,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
14509
14584
  const { isPullRequestMode } = platformKit.config;
14510
14585
  ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
14511
14586
  const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
14512
- const canRun = await _optionalChain([flow, 'access', _428 => _428.preRun, 'optionalCall', _429 => _429()]);
14587
+ const canRun = await _optionalChain([flow, 'access', _430 => _430.preRun, 'optionalCall', _431 => _431()]);
14513
14588
  if (canRun === false) {
14514
14589
  return;
14515
14590
  }
@@ -14519,7 +14594,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
14519
14594
  if (!hasChanges) {
14520
14595
  return;
14521
14596
  }
14522
- await _optionalChain([flow, 'access', _430 => _430.postRun, 'optionalCall', _431 => _431()]);
14597
+ await _optionalChain([flow, 'access', _432 => _432.postRun, 'optionalCall', _433 => _433()]);
14523
14598
  });
14524
14599
  function parseBooleanArg(val) {
14525
14600
  if (val === true) return true;
@@ -14556,8 +14631,8 @@ function exitGracefully(elapsedMs = 0) {
14556
14631
  }
14557
14632
  }
14558
14633
  function checkForPendingOperations() {
14559
- const activeHandles = _optionalChain([process, 'access', _432 => _432._getActiveHandles, 'optionalCall', _433 => _433()]) || [];
14560
- const activeRequests = _optionalChain([process, 'access', _434 => _434._getActiveRequests, 'optionalCall', _435 => _435()]) || [];
14634
+ const activeHandles = _optionalChain([process, 'access', _434 => _434._getActiveHandles, 'optionalCall', _435 => _435()]) || [];
14635
+ const activeRequests = _optionalChain([process, 'access', _436 => _436._getActiveRequests, 'optionalCall', _437 => _437()]) || [];
14561
14636
  const nonStandardHandles = activeHandles.filter((handle) => {
14562
14637
  if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
14563
14638
  return false;
@@ -14627,17 +14702,17 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
14627
14702
  });
14628
14703
  await new Promise((resolve) => setTimeout(resolve, 50));
14629
14704
  let buckets = getBuckets(i18nConfig);
14630
- if (_optionalChain([flags, 'access', _436 => _436.bucket, 'optionalAccess', _437 => _437.length])) {
14705
+ if (_optionalChain([flags, 'access', _438 => _438.bucket, 'optionalAccess', _439 => _439.length])) {
14631
14706
  buckets = buckets.filter(
14632
14707
  (bucket) => flags.bucket.includes(bucket.type)
14633
14708
  );
14634
14709
  }
14635
14710
  ora.succeed("Buckets retrieved");
14636
- if (_optionalChain([flags, 'access', _438 => _438.file, 'optionalAccess', _439 => _439.length])) {
14711
+ if (_optionalChain([flags, 'access', _440 => _440.file, 'optionalAccess', _441 => _441.length])) {
14637
14712
  buckets = buckets.map((bucket) => {
14638
14713
  const paths = bucket.paths.filter(
14639
14714
  (path20) => flags.file.find(
14640
- (file) => _optionalChain([path20, 'access', _440 => _440.pathPattern, 'optionalAccess', _441 => _441.includes, 'call', _442 => _442(file)]) || _optionalChain([path20, 'access', _443 => _443.pathPattern, 'optionalAccess', _444 => _444.match, 'call', _445 => _445(file)]) || minimatch(path20.pathPattern, file)
14715
+ (file) => _optionalChain([path20, 'access', _442 => _442.pathPattern, 'optionalAccess', _443 => _443.includes, 'call', _444 => _444(file)]) || _optionalChain([path20, 'access', _445 => _445.pathPattern, 'optionalAccess', _446 => _446.match, 'call', _447 => _447(file)]) || minimatch(path20.pathPattern, file)
14641
14716
  )
14642
14717
  );
14643
14718
  return { ...bucket, paths };
@@ -14657,7 +14732,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
14657
14732
  });
14658
14733
  }
14659
14734
  }
14660
- const targetLocales = _optionalChain([flags, 'access', _446 => _446.locale, 'optionalAccess', _447 => _447.length]) ? flags.locale : i18nConfig.locale.targets;
14735
+ const targetLocales = _optionalChain([flags, 'access', _448 => _448.locale, 'optionalAccess', _449 => _449.length]) ? flags.locale : i18nConfig.locale.targets;
14661
14736
  let totalSourceKeyCount = 0;
14662
14737
  let uniqueKeysToTranslate = 0;
14663
14738
  let totalExistingTranslations = 0;
@@ -15067,12 +15142,12 @@ function validateParams2(i18nConfig, flags) {
15067
15142
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
15068
15143
  docUrl: "bucketNotFound"
15069
15144
  });
15070
- } else if (_optionalChain([flags, 'access', _448 => _448.locale, 'optionalAccess', _449 => _449.some, 'call', _450 => _450((locale) => !i18nConfig.locale.targets.includes(locale))])) {
15145
+ } else if (_optionalChain([flags, 'access', _450 => _450.locale, 'optionalAccess', _451 => _451.some, 'call', _452 => _452((locale) => !i18nConfig.locale.targets.includes(locale))])) {
15071
15146
  throw new CLIError({
15072
15147
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
15073
15148
  docUrl: "localeTargetNotFound"
15074
15149
  });
15075
- } else if (_optionalChain([flags, 'access', _451 => _451.bucket, 'optionalAccess', _452 => _452.some, 'call', _453 => _453(
15150
+ } else if (_optionalChain([flags, 'access', _453 => _453.bucket, 'optionalAccess', _454 => _454.some, 'call', _455 => _455(
15076
15151
  (bucket) => !i18nConfig.buckets[bucket]
15077
15152
  )])) {
15078
15153
  throw new CLIError({
@@ -15164,7 +15239,7 @@ async function renderHero2() {
15164
15239
  // package.json
15165
15240
  var package_default = {
15166
15241
  name: "lingo.dev",
15167
- version: "0.119.0",
15242
+ version: "0.121.0",
15168
15243
  description: "Lingo.dev CLI",
15169
15244
  private: false,
15170
15245
  repository: {
@@ -15467,7 +15542,7 @@ var purge_default = new (0, _interactivecommander.Command)().command("purge").de
15467
15542
  if (options.file && options.file.length) {
15468
15543
  buckets = buckets.map((bucket) => {
15469
15544
  const paths = bucket.paths.filter(
15470
- (bucketPath) => _optionalChain([options, 'access', _454 => _454.file, 'optionalAccess', _455 => _455.some, 'call', _456 => _456((f) => bucketPath.pathPattern.includes(f))])
15545
+ (bucketPath) => _optionalChain([options, 'access', _456 => _456.file, 'optionalAccess', _457 => _457.some, 'call', _458 => _458((f) => bucketPath.pathPattern.includes(f))])
15471
15546
  );
15472
15547
  return { ...bucket, paths };
15473
15548
  }).filter((bucket) => bucket.paths.length > 0);