Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit 7d83f60

Browse files
authored
Remove vercel speedInsights option (#384)
1 parent 87ec8f1 commit 7d83f60

File tree

16 files changed

+6
-281
lines changed

16 files changed

+6
-281
lines changed

.changeset/silver-lemons-bow.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@astrojs/vercel': major
3+
---
4+
5+
Removes deprecated `speedInsights` option in favor of Vercel's direct support: https://vercel.com/docs/speed-insights/quickstart

packages/vercel/package.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"./serverless": "./dist/serverless/adapter.js",
2121
"./serverless/entrypoint": "./dist/serverless/entrypoint.js",
2222
"./static": "./dist/static/adapter.js",
23-
"./speed-insights": "./dist/speed-insights.js",
2423
"./build-image-service": "./dist/image/build-service.js",
2524
"./dev-image-service": "./dist/image/dev-service.js",
2625
"./package.json": "./package.json"
@@ -43,8 +42,7 @@
4342
"@vercel/edge": "^1.1.2",
4443
"@vercel/nft": "^0.27.4",
4544
"esbuild": "^0.21.5",
46-
"fast-glob": "^3.3.2",
47-
"web-vitals": "^3.5.2"
45+
"fast-glob": "^3.3.2"
4846
},
4947
"peerDependencies": {
5048
"astro": "^5.0.0-alpha.8"

packages/vercel/src/lib/speed-insights.ts

-30
This file was deleted.

packages/vercel/src/serverless/adapter.ts

-18
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ import {
1919
} from '../image/shared.js';
2020
import { copyDependenciesToFunction } from '../lib/nft.js';
2121
import { escapeRegex, getRedirects } from '../lib/redirects.js';
22-
import {
23-
type VercelSpeedInsightsConfig,
24-
getSpeedInsightsViteConfig,
25-
} from '../lib/speed-insights.js';
2622
import {
2723
type VercelWebAnalyticsConfig,
2824
getInjectableWebAnalyticsContent,
@@ -101,15 +97,6 @@ export interface VercelServerlessConfig {
10197
/** Configuration for [Vercel Web Analytics](https://vercel.com/docs/concepts/analytics). */
10298
webAnalytics?: VercelWebAnalyticsConfig;
10399

104-
/**
105-
* @deprecated This option lets you configure the legacy speed insights API which is now deprecated by Vercel.
106-
*
107-
* See [Vercel Speed Insights Quickstart](https://vercel.com/docs/speed-insights/quickstart) for instructions on how to use the library instead.
108-
*
109-
* https://vercel.com/docs/speed-insights/quickstart
110-
*/
111-
speedInsights?: VercelSpeedInsightsConfig;
112-
113100
/** Force files to be bundled with your function. This is helpful when you notice missing files. */
114101
includeFiles?: string[];
115102

@@ -168,7 +155,6 @@ interface VercelISRConfig {
168155

169156
export default function vercelServerless({
170157
webAnalytics,
171-
speedInsights,
172158
includeFiles: _includeFiles = [],
173159
excludeFiles: _excludeFiles = [],
174160
imageService,
@@ -222,9 +208,6 @@ export default function vercelServerless({
222208
})
223209
);
224210
}
225-
if (command === 'build' && speedInsights?.enabled) {
226-
injectScript('page', 'import "@astrojs/vercel/speed-insights"');
227-
}
228211

229212
const vercelConfigPath = new URL('vercel.json', config.root);
230213
if (existsSync(vercelConfigPath)) {
@@ -255,7 +238,6 @@ export default function vercelServerless({
255238
redirects: false,
256239
},
257240
vite: {
258-
...getSpeedInsightsViteConfig(speedInsights?.enabled),
259241
ssr: {
260242
external: ['@vercel/nft'],
261243
},

packages/vercel/src/speed-insights.ts

-68
This file was deleted.

packages/vercel/src/static/adapter.ts

-19
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ import {
88
getDefaultImageConfig,
99
} from '../image/shared.js';
1010
import { getRedirects } from '../lib/redirects.js';
11-
import {
12-
type VercelSpeedInsightsConfig,
13-
getSpeedInsightsViteConfig,
14-
} from '../lib/speed-insights.js';
1511
import {
1612
type VercelWebAnalyticsConfig,
1713
getInjectableWebAnalyticsContent,
@@ -38,22 +34,13 @@ function getAdapter(): AstroAdapter {
3834

3935
export interface VercelStaticConfig {
4036
webAnalytics?: VercelWebAnalyticsConfig;
41-
/**
42-
* @deprecated This option lets you configure the legacy speed insights API which is now deprecated by Vercel.
43-
*
44-
* See [Vercel Speed Insights Quickstart](https://vercel.com/docs/speed-insights/quickstart) for instructions on how to use the library instead.
45-
*
46-
* https://vercel.com/docs/speed-insights/quickstart
47-
*/
48-
speedInsights?: VercelSpeedInsightsConfig;
4937
imageService?: boolean;
5038
imagesConfig?: VercelImageConfig;
5139
devImageService?: DevImageService;
5240
}
5341

5442
export default function vercelStatic({
5543
webAnalytics,
56-
speedInsights,
5744
imageService,
5845
imagesConfig,
5946
devImageService = 'sharp',
@@ -72,19 +59,13 @@ export default function vercelStatic({
7259
})
7360
);
7461
}
75-
if (command === 'build' && speedInsights?.enabled) {
76-
injectScript('page', 'import "@astrojs/vercel/speed-insights"');
77-
}
7862
const outDir = new URL('./.vercel/output/static/', config.root);
7963
updateConfig({
8064
outDir,
8165
build: {
8266
format: 'directory',
8367
redirects: false,
8468
},
85-
vite: {
86-
...getSpeedInsightsViteConfig(speedInsights?.enabled),
87-
},
8869
...getAstroImageConfig(
8970
imageService,
9071
imagesConfig,

packages/vercel/test/fixtures/with-speed-insights-enabled/output-as-server/astro.config.mjs

-10
This file was deleted.

packages/vercel/test/fixtures/with-speed-insights-enabled/output-as-server/package.json

-9
This file was deleted.

packages/vercel/test/fixtures/with-speed-insights-enabled/output-as-server/src/pages/one.astro

-8
This file was deleted.

packages/vercel/test/fixtures/with-speed-insights-enabled/output-as-server/src/pages/two.astro

-8
This file was deleted.

packages/vercel/test/fixtures/with-speed-insights-enabled/output-as-static/astro.config.mjs

-10
This file was deleted.

packages/vercel/test/fixtures/with-speed-insights-enabled/output-as-static/package.json

-9
This file was deleted.

packages/vercel/test/fixtures/with-speed-insights-enabled/output-as-static/src/pages/one.astro

-8
This file was deleted.

packages/vercel/test/fixtures/with-speed-insights-enabled/output-as-static/src/pages/two.astro

-8
This file was deleted.

packages/vercel/test/speed-insights.test.js

-47
This file was deleted.

0 commit comments

Comments
 (0)