lingo.dev 0.117.22 → 0.117.24

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
@@ -51,20 +51,24 @@
51
51
  Install once:
52
52
 
53
53
  ```bash
54
- npm install lingo.dev
54
+ npm install @lingo.dev/compiler
55
55
  ```
56
56
 
57
57
  Enable in your build config:
58
58
 
59
- ```js
60
- import lingoCompiler from "lingo.dev/compiler";
61
-
62
- const existingNextConfig = {};
63
-
64
- export default lingoCompiler.next({
65
- sourceLocale: "en",
66
- targetLocales: ["es", "fr"],
67
- })(existingNextConfig);
59
+ ```ts
60
+ import type { NextConfig } from "next";
61
+ import { withLingo } from "@lingo.dev/compiler/next";
62
+
63
+ const nextConfig: NextConfig = {};
64
+
65
+ export default async function (): Promise<NextConfig> {
66
+ return await withLingo(nextConfig, {
67
+ sourceLocale: "en",
68
+ targetLocales: ["es", "fr"],
69
+ models: "lingo.dev",
70
+ });
71
+ }
68
72
  ```
69
73
 
70
74
  Run `next build` and watch Spanish and French bundles pop out ✨
@@ -165,7 +169,7 @@ We're community-driven and love contributions!
165
169
 
166
170
  ## ⭐ Star History
167
171
 
168
- If you like what we're doing, give us a ⭐ and help us reach 5,000 stars! 🌟
172
+ If you like what we're doing, give us a ⭐ and help us reach 6,000 stars! 🌟
169
173
 
170
174
  [![Star History Chart](https://api.star-history.com/svg?repos=lingodotdev/lingo.dev&type=Date)](https://www.star-history.com/#lingodotdev/lingo.dev&Date)
171
175
 
package/build/cli.cjs CHANGED
@@ -10927,11 +10927,11 @@ var POSTHOG_HOST = "eu.i.posthog.com";
10927
10927
  var POSTHOG_PATH = "/i/v0/e/";
10928
10928
  var REQUEST_TIMEOUT_MS = 3e3;
10929
10929
  var TRACKING_VERSION = "2.0";
10930
- function determineDistinctId(providedId) {
10931
- if (providedId) {
10930
+ function determineDistinctId(email) {
10931
+ if (email) {
10932
10932
  const projectId = getRepositoryId();
10933
10933
  return {
10934
- distinct_id: providedId,
10934
+ distinct_id: email,
10935
10935
  distinct_id_source: "email",
10936
10936
  project_id: projectId
10937
10937
  };
@@ -10956,13 +10956,13 @@ function determineDistinctId(providedId) {
10956
10956
  project_id: null
10957
10957
  };
10958
10958
  }
10959
- function trackEvent(distinctId, event, properties) {
10959
+ function trackEvent(email, event, properties) {
10960
10960
  if (process.env.DO_NOT_TRACK === "1") {
10961
10961
  return;
10962
10962
  }
10963
10963
  setImmediate(() => {
10964
10964
  try {
10965
- const identityInfo = determineDistinctId(distinctId);
10965
+ const identityInfo = determineDistinctId(email);
10966
10966
  if (process.env.DEBUG === "true") {
10967
10967
  console.log(
10968
10968
  `[Tracking] Event: ${event}, ID: ${identityInfo.distinct_id}, Source: ${identityInfo.distinct_id_source}`
@@ -11210,7 +11210,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
11210
11210
  ]);
11211
11211
  }
11212
11212
  let hasErrors = false;
11213
- let authId = null;
11213
+ let email = null;
11214
11214
  const errorDetails = [];
11215
11215
  try {
11216
11216
  ora.start("Loading configuration...");
@@ -11223,14 +11223,14 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
11223
11223
  ora.start("Connecting to Lingo.dev Localization Engine...");
11224
11224
  const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _343 => _343.provider]);
11225
11225
  if (isByokMode) {
11226
- authId = null;
11226
+ email = null;
11227
11227
  ora.succeed("Using external provider (BYOK mode)");
11228
11228
  } else {
11229
11229
  const auth = await validateAuth(settings);
11230
- authId = auth.id;
11230
+ email = auth.email;
11231
11231
  ora.succeed(`Authenticated as ${auth.email}`);
11232
11232
  }
11233
- await trackEvent(authId, "cmd.i18n.start", {
11233
+ await trackEvent(email, "cmd.i18n.start", {
11234
11234
  i18nConfig,
11235
11235
  flags
11236
11236
  });
@@ -11576,7 +11576,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
11576
11576
  console.log();
11577
11577
  if (!hasErrors) {
11578
11578
  ora.succeed("Localization completed.");
11579
- await trackEvent(authId, "cmd.i18n.success", {
11579
+ await trackEvent(email, "cmd.i18n.success", {
11580
11580
  i18nConfig: {
11581
11581
  sourceLocale: i18nConfig.locale.source,
11582
11582
  targetLocales: i18nConfig.locale.targets,
@@ -11590,7 +11590,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
11590
11590
  await new Promise((resolve) => setTimeout(resolve, 50));
11591
11591
  } else {
11592
11592
  ora.warn("Localization completed with errors.");
11593
- await trackEvent(authId, "cmd.i18n.error", {
11593
+ await trackEvent(email, "cmd.i18n.error", {
11594
11594
  flags,
11595
11595
  ...aggregateErrorAnalytics(
11596
11596
  errorDetails,
@@ -11617,7 +11617,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
11617
11617
  bucket: error.bucket
11618
11618
  };
11619
11619
  }
11620
- await trackEvent(authId, "cmd.i18n.error", {
11620
+ await trackEvent(email, "cmd.i18n.error", {
11621
11621
  flags,
11622
11622
  errorType,
11623
11623
  errorName: error.name || "Error",
@@ -13249,7 +13249,7 @@ async function frozen(input2) {
13249
13249
  }
13250
13250
 
13251
13251
  // src/cli/cmd/run/_utils.ts
13252
- async function determineAuthId(ctx) {
13252
+ async function determineEmail(ctx) {
13253
13253
  const isByokMode = !!_optionalChain([ctx, 'access', _389 => _389.config, 'optionalAccess', _390 => _390.provider]);
13254
13254
  if (isByokMode) {
13255
13255
  return null;
@@ -13333,7 +13333,7 @@ var run_default = new (0, _interactivecommander.Command)().command("run").descri
13333
13333
  "--sound",
13334
13334
  "Play audio feedback when translations complete (success or failure sounds)"
13335
13335
  ).action(async (args) => {
13336
- let authId = null;
13336
+ let email = null;
13337
13337
  try {
13338
13338
  const ctx = {
13339
13339
  flags: flagsSchema2.parse(args),
@@ -13349,8 +13349,8 @@ var run_default = new (0, _interactivecommander.Command)().command("run").descri
13349
13349
  await renderHero();
13350
13350
  await renderSpacer();
13351
13351
  await setup(ctx);
13352
- authId = await determineAuthId(ctx);
13353
- await trackEvent(authId, "cmd.run.start", {
13352
+ email = await determineEmail(ctx);
13353
+ await trackEvent(email, "cmd.run.start", {
13354
13354
  config: ctx.config,
13355
13355
  flags: ctx.flags
13356
13356
  });
@@ -13369,13 +13369,17 @@ var run_default = new (0, _interactivecommander.Command)().command("run").descri
13369
13369
  if (ctx.flags.watch) {
13370
13370
  await watch2(ctx);
13371
13371
  }
13372
- await trackEvent(authId, "cmd.run.success", {
13372
+ await trackEvent(email, "cmd.run.success", {
13373
13373
  config: ctx.config,
13374
13374
  flags: ctx.flags
13375
13375
  });
13376
13376
  await new Promise((resolve) => setTimeout(resolve, 50));
13377
13377
  } catch (error) {
13378
- await trackEvent(authId, "cmd.run.error", {});
13378
+ await trackEvent(email, "cmd.run.error", {
13379
+ flags: args,
13380
+ error: error.message,
13381
+ authenticated: !!email
13382
+ });
13379
13383
  await new Promise((resolve) => setTimeout(resolve, 50));
13380
13384
  if (args.sound) {
13381
13385
  await playSound("failure");
@@ -14208,7 +14212,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
14208
14212
  ).action(async function(options) {
14209
14213
  const ora = _ora2.default.call(void 0, );
14210
14214
  const flags = parseFlags2(options);
14211
- let authId = null;
14215
+ let email = null;
14212
14216
  try {
14213
14217
  ora.start("Loading configuration...");
14214
14218
  const i18nConfig = getConfig();
@@ -14218,7 +14222,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
14218
14222
  ora.start("Checking authentication status...");
14219
14223
  const auth = await tryAuthenticate(settings);
14220
14224
  if (auth) {
14221
- authId = auth.id;
14225
+ email = auth.email;
14222
14226
  ora.succeed(`Authenticated as ${auth.email}`);
14223
14227
  } else {
14224
14228
  ora.info(
@@ -14231,10 +14235,11 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
14231
14235
  ora.start("Validating localization configuration...");
14232
14236
  validateParams2(i18nConfig, flags);
14233
14237
  ora.succeed("Localization configuration is valid");
14234
- trackEvent(authId, "cmd.status.start", {
14238
+ trackEvent(email, "cmd.status.start", {
14235
14239
  i18nConfig,
14236
14240
  flags
14237
14241
  });
14242
+ await new Promise((resolve) => setTimeout(resolve, 50));
14238
14243
  let buckets = getBuckets(i18nConfig);
14239
14244
  if (_optionalChain([flags, 'access', _420 => _420.bucket, 'optionalAccess', _421 => _421.length])) {
14240
14245
  buckets = buckets.filter(
@@ -14618,22 +14623,22 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
14618
14623
  `\u2022 Try 'lingo.dev@latest i18n --locale ${targetLocales[0]}' to process just one language`
14619
14624
  );
14620
14625
  }
14621
- trackEvent(authId, "cmd.status.success", {
14626
+ trackEvent(email, "cmd.status.success", {
14622
14627
  i18nConfig,
14623
14628
  flags,
14624
14629
  totalSourceKeyCount,
14625
14630
  languageStats,
14626
14631
  totalWordsToTranslate,
14627
- authenticated: !!authId
14632
+ authenticated: !!email
14628
14633
  });
14629
14634
  await new Promise((resolve) => setTimeout(resolve, 50));
14630
14635
  exitGracefully();
14631
14636
  } catch (error) {
14632
14637
  ora.fail(error.message);
14633
- trackEvent(authId, "cmd.status.error", {
14638
+ trackEvent(email, "cmd.status.error", {
14634
14639
  flags,
14635
14640
  error: error.message,
14636
- authenticated: !!authId
14641
+ authenticated: !!email
14637
14642
  });
14638
14643
  await new Promise((resolve) => setTimeout(resolve, 50));
14639
14644
  process.exit(1);
@@ -14773,7 +14778,7 @@ async function renderHero2() {
14773
14778
  // package.json
14774
14779
  var package_default = {
14775
14780
  name: "lingo.dev",
14776
- version: "0.117.22",
14781
+ version: "0.117.24",
14777
14782
  description: "Lingo.dev CLI",
14778
14783
  private: false,
14779
14784
  repository: {