summaryrefslogtreecommitdiff
path: root/packages/integrations/vercel/src/lib/speed-insights.ts
diff options
context:
space:
mode:
authorGravatar Bjorn Lu <bjornlu.dev@gmail.com> 2024-09-19 21:13:44 +0800
committerGravatar GitHub <noreply@github.com> 2024-09-19 21:13:44 +0800
commit997fd33c291cec374f2bc969c0919b422e5dcbd3 (patch)
treeb8f03aa661515e5eb8f9ab2132381ba56649ae8a /packages/integrations/vercel/src/lib/speed-insights.ts
parent7a4d252a17584afa08db199b692fd29cf38d8b55 (diff)
downloadastro-997fd33c291cec374f2bc969c0919b422e5dcbd3.tar.gz
astro-997fd33c291cec374f2bc969c0919b422e5dcbd3.tar.zst
astro-997fd33c291cec374f2bc969c0919b422e5dcbd3.zip
Remove vercel speedInsights option (#384)
Diffstat (limited to 'packages/integrations/vercel/src/lib/speed-insights.ts')
-rw-r--r--packages/integrations/vercel/src/lib/speed-insights.ts30
1 files changed, 0 insertions, 30 deletions
diff --git a/packages/integrations/vercel/src/lib/speed-insights.ts b/packages/integrations/vercel/src/lib/speed-insights.ts
deleted file mode 100644
index 033a705c5..000000000
--- a/packages/integrations/vercel/src/lib/speed-insights.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-export type VercelSpeedInsightsConfig = {
- enabled: boolean;
-};
-
-export function getSpeedInsightsViteConfig(enabled?: boolean) {
- if (enabled) {
- return {
- define: exposeEnv(['VERCEL_ANALYTICS_ID']),
- };
- }
-
- return {};
-}
-
-/**
- * While Vercel adds the `PUBLIC_` prefix for their `VERCEL_` env vars by default, some env vars
- * like `VERCEL_ANALYTICS_ID` aren't, so handle them here so that it works correctly in runtime.
- */
-export function exposeEnv(envs: string[]): Record<string, unknown> {
- const mapped: Record<string, unknown> = {};
-
- // biome-ignore lint/complexity/noForEach: <explanation>
- envs
- .filter((env) => process.env[env])
- .forEach((env) => {
- mapped[`import.meta.env.PUBLIC_${env}`] = JSON.stringify(process.env[env]);
- });
-
- return mapped;
-}