Skip to content

Commit 7cd5811

Browse files
1 parent 0a0e5fd commit 7cd5811

File tree

4 files changed

+43
-43
lines changed

4 files changed

+43
-43
lines changed

Configuration/ESBuild/Output.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Configuration/ESBuild/Output.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Source/ESBuild/Output.js

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -64,40 +64,40 @@ export default {
6464
},
6565
// RestPlugin activated only when Compiler=Rest env var is set.
6666
...(RestPlugin ? [RestPlugin] : []),
67-
// PostHog build telemetry — fire-and-forget on build end
68-
{
69-
name: "PostHogBuildTelemetry",
70-
setup({ onEnd }) {
71-
const StartTime = performance.now();
72-
onEnd(async (Result) => {
73-
const DurationMs = Math.round(performance.now() - StartTime);
74-
try {
75-
const { request } = await import("node:https");
76-
const Body = JSON.stringify({
77-
api_key: "phc_mCwHy7LgvbnEqh6a2DyMiLUJcaZvmmj7JNmmpQzvr7mA",
78-
event: "output:build:complete",
79-
properties: {
80-
distinct_id: `land-dev-${process.env["USER"] || "unknown"}`,
81-
$app: "land-editor",
82-
$component: "output",
83-
$build_mode: On ? "development" : "production",
84-
duration_ms: DurationMs,
85-
errors: Result.errors.length,
86-
warnings: Result.warnings.length,
87-
compiler: process.env["Compiler"] || "esbuild",
88-
},
89-
timestamp: new Date().toISOString(),
90-
});
91-
const Url = new URL("https://eu.i.posthog.com/capture/");
92-
const Req = request({ hostname: Url.hostname, port: 443, path: Url.pathname, method: "POST", headers: { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(Body) } });
93-
Req.on("error", () => { });
94-
Req.write(Body);
95-
Req.end();
96-
}
97-
catch { }
98-
});
99-
},
100-
},
67+
// PostHog build telemetry — debug only, skipped in production
68+
...(process.env["NODE_ENV"] !== "production" ? [{
69+
name: "PostHogBuildTelemetry",
70+
setup({ onEnd }) {
71+
const StartTime = performance.now();
72+
onEnd(async (Result) => {
73+
const DurationMs = Math.round(performance.now() - StartTime);
74+
try {
75+
const { request } = await import("node:https");
76+
const Body = JSON.stringify({
77+
api_key: "phc_mCwHy7LgvbnEqh6a2DyMiLUJcaZvmmj7JNmmpQzvr7mA",
78+
event: "output:build:complete",
79+
properties: {
80+
distinct_id: `land-dev-${process.env["USER"] || "unknown"}`,
81+
$app: "land-editor",
82+
$component: "output",
83+
$build_mode: On ? "development" : "production",
84+
duration_ms: DurationMs,
85+
errors: Result.errors.length,
86+
warnings: Result.warnings.length,
87+
compiler: process.env["Compiler"] || "esbuild",
88+
},
89+
timestamp: new Date().toISOString(),
90+
});
91+
const Url = new URL("https://eu.i.posthog.com/capture/");
92+
const Req = request({ hostname: Url.hostname, port: 443, path: Url.pathname, method: "POST", headers: { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(Body) } });
93+
Req.on("error", () => { });
94+
Req.write(Body);
95+
Req.end();
96+
}
97+
catch { }
98+
});
99+
},
100+
}] : []),
101101
].filter(Boolean),
102102
loader: {
103103
".json": "copy",

Source/ESBuild/Output.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ export default {
9393
// RestPlugin activated only when Compiler=Rest env var is set.
9494
...(RestPlugin ? [RestPlugin] : []),
9595

96-
// PostHog build telemetry — fire-and-forget on build end
97-
{
96+
// PostHog build telemetry — debug only, skipped in production
97+
...(process.env["NODE_ENV"] !== "production" ? [{
9898
name: "PostHogBuildTelemetry",
99-
setup({ onEnd }) {
99+
setup({ onEnd }: { onEnd: (Callback: (Result: { errors: unknown[]; warnings: unknown[] }) => Promise<void>) => void }) {
100100
const StartTime = performance.now();
101101
onEnd(async (Result) => {
102102
const DurationMs = Math.round(performance.now() - StartTime);
@@ -125,7 +125,7 @@ export default {
125125
} catch {}
126126
});
127127
},
128-
},
128+
}] : []),
129129
].filter(Boolean),
130130

131131
loader: {

0 commit comments

Comments
 (0)