lingo.dev 0.111.2 → 0.111.3

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
@@ -7463,42 +7463,63 @@ function withExponentialBackoff(fn, maxAttempts = 3, baseDelay = 1e3) {
7463
7463
 
7464
7464
  // src/cli/utils/observability.ts
7465
7465
  var _nodemachineid = require('node-machine-id'); var _nodemachineid2 = _interopRequireDefault(_nodemachineid);
7466
+ var _https = require('https'); var _https2 = _interopRequireDefault(_https);
7466
7467
  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
- }
7479
- async function trackEvent(distinctId, event, properties) {
7480
- if (process.env.DO_NOT_TRACK) {
7468
+ var POSTHOG_API_KEY = "phc_eR0iSoQufBxNY36k0f0T15UvHJdTfHlh8rJcxsfhfXk";
7469
+ var POSTHOG_HOST = "eu.i.posthog.com";
7470
+ var POSTHOG_PATH = "/i/v0/e/";
7471
+ var REQUEST_TIMEOUT_MS = 1e3;
7472
+ function trackEvent(distinctId, event, properties) {
7473
+ if (process.env.DO_NOT_TRACK === "1") {
7481
7474
  return;
7482
7475
  }
7483
- try {
7484
- const actualId = distinctId || `device-${machineIdSync()}`;
7485
- const posthog = await createPosthogClient();
7486
- await posthog.capture({
7487
- distinctId: actualId,
7488
- event,
7489
- properties: {
7490
- ...properties,
7491
- meta: {
7492
- version: process.env.npm_package_version,
7493
- isCi: process.env.CI === "true"
7476
+ setImmediate(() => {
7477
+ try {
7478
+ const actualId = distinctId || `device-${machineIdSync()}`;
7479
+ const eventData = {
7480
+ api_key: POSTHOG_API_KEY,
7481
+ event,
7482
+ distinct_id: actualId,
7483
+ properties: {
7484
+ ...properties,
7485
+ $lib: "lingo.dev-cli",
7486
+ $lib_version: process.env.npm_package_version || "unknown"
7487
+ },
7488
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
7489
+ };
7490
+ const payload = JSON.stringify(eventData);
7491
+ const options = {
7492
+ hostname: POSTHOG_HOST,
7493
+ path: POSTHOG_PATH,
7494
+ method: "POST",
7495
+ headers: {
7496
+ "Content-Type": "application/json",
7497
+ "Content-Length": Buffer.byteLength(payload).toString()
7498
+ },
7499
+ timeout: REQUEST_TIMEOUT_MS
7500
+ };
7501
+ const req = _https2.default.request(options);
7502
+ req.on("timeout", () => {
7503
+ req.destroy();
7504
+ });
7505
+ req.on("error", (error) => {
7506
+ if (process.env.DEBUG === "true") {
7507
+ console.error("[Tracking] Error ignored:", error.message);
7494
7508
  }
7509
+ });
7510
+ req.write(payload);
7511
+ req.end();
7512
+ setTimeout(() => {
7513
+ if (!req.destroyed) {
7514
+ req.destroy();
7515
+ }
7516
+ }, REQUEST_TIMEOUT_MS);
7517
+ } catch (error) {
7518
+ if (process.env.DEBUG === "true") {
7519
+ console.error("[Tracking] Failed to send event:", error);
7495
7520
  }
7496
- });
7497
- } catch (error) {
7498
- if (process.env.DEBUG) {
7499
- console.error(error);
7500
7521
  }
7501
- }
7522
+ });
7502
7523
  }
7503
7524
 
7504
7525
  // src/cli/utils/delta.ts
@@ -10842,7 +10863,7 @@ async function renderHero2() {
10842
10863
  // package.json
10843
10864
  var package_default = {
10844
10865
  name: "lingo.dev",
10845
- version: "0.111.2",
10866
+ version: "0.111.3",
10846
10867
  description: "Lingo.dev CLI",
10847
10868
  private: false,
10848
10869
  publishConfig: {