lingo.dev 0.111.1 → 0.111.2

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/README.md CHANGED
@@ -27,6 +27,12 @@
27
27
  <a href="https://github.com/lingodotdev/lingo.dev/commits/main">
28
28
  <img src="https://img.shields.io/github/last-commit/lingodotdev/lingo.dev" alt="Last Commit" />
29
29
  </a>
30
+ <a href="https://lingo.dev/en">
31
+ <img src="https://img.shields.io/badge/Product%20Hunt-%231%20Product%20of%20the%20Day-orange?logo=producthunt&style=flat-square" alt="Product Hunt #1 Product of the Day" />
32
+ </a>
33
+ <a href="https://lingo.dev/en">
34
+ <img src="https://img.shields.io/badge/GitHub-Trending-blue?logo=github&style=flat-square" alt="Github trending" />
35
+ </a>
30
36
  </p>
31
37
 
32
38
  ---
package/build/cli.cjs CHANGED
@@ -7464,21 +7464,25 @@ function withExponentialBackoff(fn, maxAttempts = 3, baseDelay = 1e3) {
7464
7464
  // src/cli/utils/observability.ts
7465
7465
  var _nodemachineid = require('node-machine-id'); var _nodemachineid2 = _interopRequireDefault(_nodemachineid);
7466
7466
  var { machineIdSync } = _nodemachineid2.default;
7467
+ async function createPosthogClient() {
7468
+ const { PostHog } = await Promise.resolve().then(() => _interopRequireWildcard(require("posthog-node")));
7469
+ const posthog = new PostHog(
7470
+ "phc_eR0iSoQufBxNY36k0f0T15UvHJdTfHlh8rJcxsfhfXk",
7471
+ {
7472
+ host: "https://eu.i.posthog.com",
7473
+ flushAt: 1,
7474
+ flushInterval: 0
7475
+ }
7476
+ );
7477
+ return posthog;
7478
+ }
7467
7479
  async function trackEvent(distinctId, event, properties) {
7468
7480
  if (process.env.DO_NOT_TRACK) {
7469
7481
  return;
7470
7482
  }
7471
7483
  try {
7472
7484
  const actualId = distinctId || `device-${machineIdSync()}`;
7473
- const { PostHog } = await Promise.resolve().then(() => _interopRequireWildcard(require("posthog-node")));
7474
- const posthog = new PostHog(
7475
- "phc_eR0iSoQufBxNY36k0f0T15UvHJdTfHlh8rJcxsfhfXk",
7476
- {
7477
- host: "https://eu.i.posthog.com",
7478
- flushAt: 1,
7479
- flushInterval: 0
7480
- }
7481
- );
7485
+ const posthog = await createPosthogClient();
7482
7486
  await posthog.capture({
7483
7487
  distinctId: actualId,
7484
7488
  event,
@@ -7490,7 +7494,6 @@ async function trackEvent(distinctId, event, properties) {
7490
7494
  }
7491
7495
  }
7492
7496
  });
7493
- await posthog.shutdown();
7494
7497
  } catch (error) {
7495
7498
  if (process.env.DEBUG) {
7496
7499
  console.error(error);
@@ -7620,39 +7623,6 @@ function createDeltaProcessor(fileKey) {
7620
7623
  };
7621
7624
  }
7622
7625
 
7623
- // src/cli/utils/exit-gracefully.ts
7624
- var STEP_WAIT_INTERVAL = 250;
7625
- var MAX_WAIT_INTERVAL = 2e3;
7626
- function exitGracefully(elapsedMs = 0) {
7627
- const hasPendingOperations = checkForPendingOperations();
7628
- if (hasPendingOperations && elapsedMs < MAX_WAIT_INTERVAL) {
7629
- setTimeout(
7630
- () => exitGracefully(elapsedMs + STEP_WAIT_INTERVAL),
7631
- STEP_WAIT_INTERVAL
7632
- );
7633
- } else {
7634
- process.exit(0);
7635
- }
7636
- }
7637
- function checkForPendingOperations() {
7638
- const activeHandles = _optionalChain([process, 'access', _251 => _251._getActiveHandles, 'optionalCall', _252 => _252()]) || [];
7639
- const activeRequests = _optionalChain([process, 'access', _253 => _253._getActiveRequests, 'optionalCall', _254 => _254()]) || [];
7640
- const nonStandardHandles = activeHandles.filter((handle) => {
7641
- if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
7642
- return false;
7643
- }
7644
- if (handle && typeof handle === "object" && "hasRef" in handle && !handle.hasRef()) {
7645
- return false;
7646
- }
7647
- return true;
7648
- });
7649
- const hasFileWatchers = nonStandardHandles.some(
7650
- (handle) => handle && typeof handle === "object" && "close" in handle
7651
- );
7652
- const hasPendingPromises = activeRequests.length > 0;
7653
- return nonStandardHandles.length > 0 || hasFileWatchers || hasPendingPromises;
7654
- }
7655
-
7656
7626
  // src/cli/cmd/i18n.ts
7657
7627
  var i18n_default = new (0, _interactivecommander.Command)().command("i18n").description("Run Localization engine").helpOption("-h, --help", "Show help").option(
7658
7628
  "--locale <locale>",
@@ -7713,7 +7683,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
7713
7683
  validateParams(i18nConfig, flags);
7714
7684
  ora.succeed("Localization configuration is valid");
7715
7685
  ora.start("Connecting to Lingo.dev Localization Engine...");
7716
- const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _255 => _255.provider]);
7686
+ const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _251 => _251.provider]);
7717
7687
  if (isByokMode) {
7718
7688
  authId = null;
7719
7689
  ora.succeed("Using external provider (BYOK mode)");
@@ -7722,21 +7692,21 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
7722
7692
  authId = auth.id;
7723
7693
  ora.succeed(`Authenticated as ${auth.email}`);
7724
7694
  }
7725
- trackEvent(authId, "cmd.i18n.start", {
7695
+ await trackEvent(authId, "cmd.i18n.start", {
7726
7696
  i18nConfig,
7727
7697
  flags
7728
7698
  });
7729
7699
  let buckets = getBuckets(i18nConfig);
7730
- if (_optionalChain([flags, 'access', _256 => _256.bucket, 'optionalAccess', _257 => _257.length])) {
7700
+ if (_optionalChain([flags, 'access', _252 => _252.bucket, 'optionalAccess', _253 => _253.length])) {
7731
7701
  buckets = buckets.filter(
7732
7702
  (bucket) => flags.bucket.includes(bucket.type)
7733
7703
  );
7734
7704
  }
7735
7705
  ora.succeed("Buckets retrieved");
7736
- if (_optionalChain([flags, 'access', _258 => _258.file, 'optionalAccess', _259 => _259.length])) {
7706
+ if (_optionalChain([flags, 'access', _254 => _254.file, 'optionalAccess', _255 => _255.length])) {
7737
7707
  buckets = buckets.map((bucket) => {
7738
7708
  const paths = bucket.paths.filter(
7739
- (path17) => flags.file.find((file) => _optionalChain([path17, 'access', _260 => _260.pathPattern, 'optionalAccess', _261 => _261.includes, 'call', _262 => _262(file)]))
7709
+ (path17) => flags.file.find((file) => _optionalChain([path17, 'access', _256 => _256.pathPattern, 'optionalAccess', _257 => _257.includes, 'call', _258 => _258(file)]))
7740
7710
  );
7741
7711
  return { ...bucket, paths };
7742
7712
  }).filter((bucket) => bucket.paths.length > 0);
@@ -7744,7 +7714,9 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
7744
7714
  ora.fail(
7745
7715
  "No buckets found. All buckets were filtered out by --file option."
7746
7716
  );
7747
- process.exit(1);
7717
+ throw new Error(
7718
+ "No buckets found. All buckets were filtered out by --file option."
7719
+ );
7748
7720
  } else {
7749
7721
  ora.info(`\x1B[36mProcessing only filtered buckets:\x1B[0m`);
7750
7722
  buckets.map((bucket) => {
@@ -7755,7 +7727,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
7755
7727
  });
7756
7728
  }
7757
7729
  }
7758
- const targetLocales = _optionalChain([flags, 'access', _263 => _263.locale, 'optionalAccess', _264 => _264.length]) ? flags.locale : i18nConfig.locale.targets;
7730
+ const targetLocales = _optionalChain([flags, 'access', _259 => _259.locale, 'optionalAccess', _260 => _260.length]) ? flags.locale : i18nConfig.locale.targets;
7759
7731
  ora.start("Setting up localization cache...");
7760
7732
  const checkLockfileProcessor = createDeltaProcessor("");
7761
7733
  const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
@@ -7869,7 +7841,9 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
7869
7841
  `Localization data has changed; please update i18n.lock or run without --frozen.`
7870
7842
  );
7871
7843
  ora.fail(` Details: ${message}`);
7872
- process.exit(1);
7844
+ throw new Error(
7845
+ `Localization data has changed; please update i18n.lock or run without --frozen. Details: ${message}`
7846
+ );
7873
7847
  } else {
7874
7848
  ora.succeed("No lockfile updates required.");
7875
7849
  }
@@ -8014,7 +7988,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
8014
7988
  }
8015
7989
  const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
8016
7990
  const checksums = await deltaProcessor.createChecksums(sourceData);
8017
- if (!_optionalChain([flags, 'access', _265 => _265.locale, 'optionalAccess', _266 => _266.length])) {
7991
+ if (!_optionalChain([flags, 'access', _261 => _261.locale, 'optionalAccess', _262 => _262.length])) {
8018
7992
  await deltaProcessor.saveChecksums(checksums);
8019
7993
  }
8020
7994
  }
@@ -8033,24 +8007,22 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
8033
8007
  console.log();
8034
8008
  if (!hasErrors) {
8035
8009
  ora.succeed("Localization completed.");
8036
- trackEvent(authId, "cmd.i18n.success", {
8010
+ await trackEvent(authId, "cmd.i18n.success", {
8037
8011
  i18nConfig,
8038
8012
  flags
8039
8013
  });
8040
8014
  } else {
8041
8015
  ora.warn("Localization completed with errors.");
8042
- trackEvent(authId || "unknown", "cmd.i18n.error", {
8016
+ await trackEvent(authId || "unknown", "cmd.i18n.error", {
8043
8017
  flags
8044
8018
  });
8045
8019
  }
8046
- exitGracefully();
8047
8020
  } catch (error) {
8048
8021
  ora.fail(error.message);
8049
- trackEvent(authId || "unknown", "cmd.i18n.error", {
8022
+ await trackEvent(authId || "unknown", "cmd.i18n.error", {
8050
8023
  flags,
8051
8024
  error
8052
8025
  });
8053
- process.exit(1);
8054
8026
  }
8055
8027
  });
8056
8028
  function parseFlags(options) {
@@ -8099,12 +8071,12 @@ function validateParams(i18nConfig, flags) {
8099
8071
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
8100
8072
  docUrl: "bucketNotFound"
8101
8073
  });
8102
- } else if (_optionalChain([flags, 'access', _267 => _267.locale, 'optionalAccess', _268 => _268.some, 'call', _269 => _269((locale) => !i18nConfig.locale.targets.includes(locale))])) {
8074
+ } else if (_optionalChain([flags, 'access', _263 => _263.locale, 'optionalAccess', _264 => _264.some, 'call', _265 => _265((locale) => !i18nConfig.locale.targets.includes(locale))])) {
8103
8075
  throw new CLIError({
8104
8076
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
8105
8077
  docUrl: "localeTargetNotFound"
8106
8078
  });
8107
- } else if (_optionalChain([flags, 'access', _270 => _270.bucket, 'optionalAccess', _271 => _271.some, 'call', _272 => _272(
8079
+ } else if (_optionalChain([flags, 'access', _266 => _266.bucket, 'optionalAccess', _267 => _267.some, 'call', _268 => _268(
8108
8080
  (bucket) => !i18nConfig.buckets[bucket]
8109
8081
  )])) {
8110
8082
  throw new CLIError({
@@ -8608,7 +8580,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
8608
8580
  const response = await engine.whoami();
8609
8581
  return {
8610
8582
  authenticated: !!response,
8611
- username: _optionalChain([response, 'optionalAccess', _273 => _273.email])
8583
+ username: _optionalChain([response, 'optionalAccess', _269 => _269.email])
8612
8584
  };
8613
8585
  } catch (e2) {
8614
8586
  return { authenticated: false };
@@ -8716,7 +8688,7 @@ function createExplicitLocalizer(provider) {
8716
8688
  }
8717
8689
  function createAiSdkLocalizer(params) {
8718
8690
  const skipAuth = params.skipAuth === true;
8719
- const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _274 => _274.apiKeyName]), () => ( ""))];
8691
+ const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _270 => _270.apiKeyName]), () => ( ""))];
8720
8692
  if (!skipAuth && !apiKey || !params.apiKeyName) {
8721
8693
  throw new Error(
8722
8694
  _dedent2.default`
@@ -8841,8 +8813,8 @@ async function setup(input2) {
8841
8813
  throw new Error(
8842
8814
  "No buckets found in i18n.json. Please add at least one bucket containing i18n content."
8843
8815
  );
8844
- } else if (_optionalChain([ctx, 'access', _275 => _275.flags, 'access', _276 => _276.bucket, 'optionalAccess', _277 => _277.some, 'call', _278 => _278(
8845
- (bucket) => !_optionalChain([ctx, 'access', _279 => _279.config, 'optionalAccess', _280 => _280.buckets, 'access', _281 => _281[bucket]])
8816
+ } else if (_optionalChain([ctx, 'access', _271 => _271.flags, 'access', _272 => _272.bucket, 'optionalAccess', _273 => _273.some, 'call', _274 => _274(
8817
+ (bucket) => !_optionalChain([ctx, 'access', _275 => _275.config, 'optionalAccess', _276 => _276.buckets, 'access', _277 => _277[bucket]])
8846
8818
  )])) {
8847
8819
  throw new Error(
8848
8820
  `One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
@@ -8855,7 +8827,7 @@ async function setup(input2) {
8855
8827
  title: "Selecting localization provider",
8856
8828
  task: async (ctx, task) => {
8857
8829
  ctx.localizer = createLocalizer(
8858
- _optionalChain([ctx, 'access', _282 => _282.config, 'optionalAccess', _283 => _283.provider]),
8830
+ _optionalChain([ctx, 'access', _278 => _278.config, 'optionalAccess', _279 => _279.provider]),
8859
8831
  ctx.flags.apiKey
8860
8832
  );
8861
8833
  if (!ctx.localizer) {
@@ -9174,7 +9146,7 @@ function createWorkerTask(args) {
9174
9146
  const processableData = _lodash2.default.chain(sourceData).entries().filter(
9175
9147
  ([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
9176
9148
  ).filter(
9177
- ([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _284 => _284.onlyKeys, 'optionalAccess', _285 => _285.some, 'call', _286 => _286(
9149
+ ([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _280 => _280.onlyKeys, 'optionalAccess', _281 => _281.some, 'call', _282 => _282(
9178
9150
  (pattern) => minimatch(key, pattern)
9179
9151
  )])
9180
9152
  ).fromPairs().value();
@@ -9237,7 +9209,7 @@ function createWorkerTask(args) {
9237
9209
  finalRenamedTargetData
9238
9210
  );
9239
9211
  const checksums2 = await deltaProcessor.createChecksums(sourceData);
9240
- if (!_optionalChain([args, 'access', _287 => _287.ctx, 'access', _288 => _288.flags, 'access', _289 => _289.targetLocale, 'optionalAccess', _290 => _290.length])) {
9212
+ if (!_optionalChain([args, 'access', _283 => _283.ctx, 'access', _284 => _284.flags, 'access', _285 => _285.targetLocale, 'optionalAccess', _286 => _286.length])) {
9241
9213
  await deltaProcessor.saveChecksums(checksums2);
9242
9214
  }
9243
9215
  });
@@ -9427,13 +9399,13 @@ var flagsSchema2 = _zod.z.object({
9427
9399
 
9428
9400
  // src/cli/cmd/run/_utils.ts
9429
9401
  async function determineAuthId(ctx) {
9430
- const isByokMode = !!_optionalChain([ctx, 'access', _291 => _291.config, 'optionalAccess', _292 => _292.provider]);
9402
+ const isByokMode = !!_optionalChain([ctx, 'access', _287 => _287.config, 'optionalAccess', _288 => _288.provider]);
9431
9403
  if (isByokMode) {
9432
9404
  return null;
9433
9405
  } else {
9434
9406
  try {
9435
- const authStatus = await _optionalChain([ctx, 'access', _293 => _293.localizer, 'optionalAccess', _294 => _294.checkAuth, 'call', _295 => _295()]);
9436
- return _optionalChain([authStatus, 'optionalAccess', _296 => _296.username]) || null;
9407
+ const authStatus = await _optionalChain([ctx, 'access', _289 => _289.localizer, 'optionalAccess', _290 => _290.checkAuth, 'call', _291 => _291()]);
9408
+ return _optionalChain([authStatus, 'optionalAccess', _292 => _292.username]) || null;
9437
9409
  } catch (e3) {
9438
9410
  return null;
9439
9411
  }
@@ -9498,7 +9470,7 @@ var run_default = new (0, _interactivecommander.Command)().command("run").descri
9498
9470
  await renderSpacer();
9499
9471
  await setup(ctx);
9500
9472
  authId = await determineAuthId(ctx);
9501
- trackEvent(authId, "cmd.run.start", {
9473
+ await trackEvent(authId, "cmd.run.start", {
9502
9474
  config: ctx.config,
9503
9475
  flags: ctx.flags
9504
9476
  });
@@ -9512,14 +9484,13 @@ var run_default = new (0, _interactivecommander.Command)().command("run").descri
9512
9484
  if (ctx.flags.watch) {
9513
9485
  await watch2(ctx);
9514
9486
  }
9515
- trackEvent(authId, "cmd.run.success", {
9487
+ await trackEvent(authId, "cmd.run.success", {
9516
9488
  config: ctx.config,
9517
9489
  flags: ctx.flags
9518
9490
  });
9519
- exitGracefully();
9520
9491
  } catch (error) {
9521
- trackEvent(authId || "unknown", "cmd.run.error", {});
9522
- process.exit(1);
9492
+ await trackEvent(authId || "unknown", "cmd.run.error", {});
9493
+ throw error;
9523
9494
  }
9524
9495
  });
9525
9496
 
@@ -9594,7 +9565,7 @@ var InBranchFlow = class extends IntegrationFlow {
9594
9565
  _child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
9595
9566
  _child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
9596
9567
  _child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
9597
- _optionalChain([this, 'access', _297 => _297.platformKit, 'optionalAccess', _298 => _298.gitConfig, 'call', _299 => _299()]);
9568
+ _optionalChain([this, 'access', _293 => _293.platformKit, 'optionalAccess', _294 => _294.gitConfig, 'call', _295 => _295()]);
9598
9569
  _child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
9599
9570
  _child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
9600
9571
  if (!processOwnCommits) {
@@ -9626,7 +9597,7 @@ var InBranchFlow = class extends IntegrationFlow {
9626
9597
  // src/cli/cmd/ci/flows/pull-request.ts
9627
9598
  var PullRequestFlow = class extends InBranchFlow {
9628
9599
  async preRun() {
9629
- const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _300 => _300()]);
9600
+ const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _296 => _296()]);
9630
9601
  if (!canContinue) {
9631
9602
  return false;
9632
9603
  }
@@ -9889,10 +9860,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
9889
9860
  repo_slug: this.platformConfig.repositoryName,
9890
9861
  state: "OPEN"
9891
9862
  }).then(({ data: { values } }) => {
9892
- return _optionalChain([values, 'optionalAccess', _301 => _301.find, 'call', _302 => _302(
9893
- ({ source, destination }) => _optionalChain([source, 'optionalAccess', _303 => _303.branch, 'optionalAccess', _304 => _304.name]) === branch && _optionalChain([destination, 'optionalAccess', _305 => _305.branch, 'optionalAccess', _306 => _306.name]) === this.platformConfig.baseBranchName
9863
+ return _optionalChain([values, 'optionalAccess', _297 => _297.find, 'call', _298 => _298(
9864
+ ({ source, destination }) => _optionalChain([source, 'optionalAccess', _299 => _299.branch, 'optionalAccess', _300 => _300.name]) === branch && _optionalChain([destination, 'optionalAccess', _301 => _301.branch, 'optionalAccess', _302 => _302.name]) === this.platformConfig.baseBranchName
9894
9865
  )]);
9895
- }).then((pr) => _optionalChain([pr, 'optionalAccess', _307 => _307.id]));
9866
+ }).then((pr) => _optionalChain([pr, 'optionalAccess', _303 => _303.id]));
9896
9867
  }
9897
9868
  async closePullRequest({ pullRequestNumber }) {
9898
9869
  await this.bb.repositories.declinePullRequest({
@@ -9988,7 +9959,7 @@ var GitHubPlatformKit = class extends PlatformKit {
9988
9959
  repo: this.platformConfig.repositoryName,
9989
9960
  base: this.platformConfig.baseBranchName,
9990
9961
  state: "open"
9991
- }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _308 => _308.number]));
9962
+ }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _304 => _304.number]));
9992
9963
  }
9993
9964
  async closePullRequest({ pullRequestNumber }) {
9994
9965
  await this.octokit.rest.pulls.update({
@@ -10115,7 +10086,7 @@ var GitlabPlatformKit = class extends PlatformKit {
10115
10086
  sourceBranch: branch,
10116
10087
  state: "opened"
10117
10088
  });
10118
- return _optionalChain([mergeRequests, 'access', _309 => _309[0], 'optionalAccess', _310 => _310.iid]);
10089
+ return _optionalChain([mergeRequests, 'access', _305 => _305[0], 'optionalAccess', _306 => _306.iid]);
10119
10090
  }
10120
10091
  async closePullRequest({
10121
10092
  pullRequestNumber
@@ -10205,7 +10176,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
10205
10176
  }
10206
10177
  const env = {
10207
10178
  LINGODOTDEV_API_KEY: settings.auth.apiKey,
10208
- LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _311 => _311.pullRequest, 'optionalAccess', _312 => _312.toString, 'call', _313 => _313()]) || "false",
10179
+ LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _307 => _307.pullRequest, 'optionalAccess', _308 => _308.toString, 'call', _309 => _309()]) || "false",
10209
10180
  ...options.commitMessage && {
10210
10181
  LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
10211
10182
  },
@@ -10225,7 +10196,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
10225
10196
  const { isPullRequestMode } = platformKit.config;
10226
10197
  ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
10227
10198
  const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
10228
- const canRun = await _optionalChain([flow, 'access', _314 => _314.preRun, 'optionalCall', _315 => _315()]);
10199
+ const canRun = await _optionalChain([flow, 'access', _310 => _310.preRun, 'optionalCall', _311 => _311()]);
10229
10200
  if (canRun === false) {
10230
10201
  return;
10231
10202
  }
@@ -10235,7 +10206,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
10235
10206
  if (!hasChanges) {
10236
10207
  return;
10237
10208
  }
10238
- await _optionalChain([flow, 'access', _316 => _316.postRun, 'optionalCall', _317 => _317()]);
10209
+ await _optionalChain([flow, 'access', _312 => _312.postRun, 'optionalCall', _313 => _313()]);
10239
10210
  });
10240
10211
  function parseBooleanArg(val) {
10241
10212
  if (val === true) return true;
@@ -10256,6 +10227,41 @@ function parseBooleanArg(val) {
10256
10227
 
10257
10228
 
10258
10229
  var _clitable3 = require('cli-table3'); var _clitable32 = _interopRequireDefault(_clitable3);
10230
+
10231
+ // src/cli/utils/exit-gracefully.ts
10232
+ var STEP_WAIT_INTERVAL = 250;
10233
+ var MAX_WAIT_INTERVAL = 2e3;
10234
+ function exitGracefully(elapsedMs = 0) {
10235
+ const hasPendingOperations = checkForPendingOperations();
10236
+ if (hasPendingOperations && elapsedMs < MAX_WAIT_INTERVAL) {
10237
+ setTimeout(
10238
+ () => exitGracefully(elapsedMs + STEP_WAIT_INTERVAL),
10239
+ STEP_WAIT_INTERVAL
10240
+ );
10241
+ } else {
10242
+ process.exit(0);
10243
+ }
10244
+ }
10245
+ function checkForPendingOperations() {
10246
+ const activeHandles = _optionalChain([process, 'access', _314 => _314._getActiveHandles, 'optionalCall', _315 => _315()]) || [];
10247
+ const activeRequests = _optionalChain([process, 'access', _316 => _316._getActiveRequests, 'optionalCall', _317 => _317()]) || [];
10248
+ const nonStandardHandles = activeHandles.filter((handle) => {
10249
+ if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
10250
+ return false;
10251
+ }
10252
+ if (handle && typeof handle === "object" && "hasRef" in handle && !handle.hasRef()) {
10253
+ return false;
10254
+ }
10255
+ return true;
10256
+ });
10257
+ const hasFileWatchers = nonStandardHandles.some(
10258
+ (handle) => handle && typeof handle === "object" && "close" in handle
10259
+ );
10260
+ const hasPendingPromises = activeRequests.length > 0;
10261
+ return nonStandardHandles.length > 0 || hasFileWatchers || hasPendingPromises;
10262
+ }
10263
+
10264
+ // src/cli/cmd/status.ts
10259
10265
  var status_default = new (0, _interactivecommander.Command)().command("status").description("Show the status of the localization process").helpOption("-h, --help", "Show help").option(
10260
10266
  "--locale <locale>",
10261
10267
  "Locale to process",
@@ -10836,7 +10842,7 @@ async function renderHero2() {
10836
10842
  // package.json
10837
10843
  var package_default = {
10838
10844
  name: "lingo.dev",
10839
- version: "0.111.1",
10845
+ version: "0.111.2",
10840
10846
  description: "Lingo.dev CLI",
10841
10847
  private: false,
10842
10848
  publishConfig: {
@@ -11018,7 +11024,7 @@ var package_default = {
11018
11024
  "p-limit": "^6.2.0",
11019
11025
  "php-array-reader": "^2.1.2",
11020
11026
  plist: "^3.1.0",
11021
- "posthog-node": "^5.5.1",
11027
+ "posthog-node": "^5.8.1",
11022
11028
  prettier: "^3.4.2",
11023
11029
  react: "^18.3.1",
11024
11030
  "rehype-stringify": "^10.0.1",