mirror of
https://github.com/withastro/astro.git
synced 2025-02-17 22:44:24 -05:00
Remove vercel deprecated analytics option (#9184)
This commit is contained in:
parent
bd0c2e9ae3
commit
a145ac07e7
3 changed files with 12 additions and 30 deletions
5
.changeset/giant-snails-perform.md
Normal file
5
.changeset/giant-snails-perform.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@astrojs/vercel': major
|
||||
---
|
||||
|
||||
Removes deprecated `analytics` option. Use the `webAnalytics` option instead.
|
|
@ -71,11 +71,6 @@ function getAdapter({
|
|||
}
|
||||
|
||||
export interface VercelServerlessConfig {
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
analytics?: boolean;
|
||||
|
||||
/** Configuration for [Vercel Web Analytics](https://vercel.com/docs/concepts/analytics). */
|
||||
webAnalytics?: VercelWebAnalyticsConfig;
|
||||
|
||||
|
@ -108,7 +103,6 @@ export interface VercelServerlessConfig {
|
|||
}
|
||||
|
||||
export default function vercelServerless({
|
||||
analytics,
|
||||
webAnalytics,
|
||||
speedInsights,
|
||||
includeFiles,
|
||||
|
@ -151,13 +145,7 @@ export default function vercelServerless({
|
|||
);
|
||||
}
|
||||
|
||||
if (webAnalytics?.enabled || analytics) {
|
||||
if (analytics) {
|
||||
logger.warn(
|
||||
`The \`analytics\` property is deprecated. Please use the new \`webAnalytics\` and \`speedInsights\` properties instead.`
|
||||
);
|
||||
}
|
||||
|
||||
if (webAnalytics?.enabled) {
|
||||
injectScript(
|
||||
'head-inline',
|
||||
await getInjectableWebAnalyticsContent({
|
||||
|
@ -165,7 +153,7 @@ export default function vercelServerless({
|
|||
})
|
||||
);
|
||||
}
|
||||
if (command === 'build' && (speedInsights?.enabled || analytics)) {
|
||||
if (command === 'build' && speedInsights?.enabled) {
|
||||
injectScript('page', 'import "@astrojs/vercel/speed-insights"');
|
||||
}
|
||||
const outDir = getVercelOutput(config.root);
|
||||
|
@ -178,7 +166,7 @@ export default function vercelServerless({
|
|||
redirects: false,
|
||||
},
|
||||
vite: {
|
||||
...getSpeedInsightsViteConfig(speedInsights?.enabled || analytics),
|
||||
...getSpeedInsightsViteConfig(speedInsights?.enabled),
|
||||
ssr: {
|
||||
external: ['@vercel/nft'],
|
||||
},
|
||||
|
|
|
@ -41,10 +41,6 @@ function getAdapter(): AstroAdapter {
|
|||
}
|
||||
|
||||
export interface VercelStaticConfig {
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
analytics?: boolean;
|
||||
webAnalytics?: VercelWebAnalyticsConfig;
|
||||
speedInsights?: VercelSpeedInsightsConfig;
|
||||
imageService?: boolean;
|
||||
|
@ -53,7 +49,6 @@ export interface VercelStaticConfig {
|
|||
}
|
||||
|
||||
export default function vercelStatic({
|
||||
analytics,
|
||||
webAnalytics,
|
||||
speedInsights,
|
||||
imageService,
|
||||
|
@ -65,14 +60,8 @@ export default function vercelStatic({
|
|||
return {
|
||||
name: '@astrojs/vercel',
|
||||
hooks: {
|
||||
'astro:config:setup': async ({ command, config, injectScript, updateConfig, logger }) => {
|
||||
if (webAnalytics?.enabled || analytics) {
|
||||
if (analytics) {
|
||||
logger.warn(
|
||||
`The \`analytics\` property is deprecated. Please use the new \`webAnalytics\` and \`speedInsights\` properties instead.`
|
||||
);
|
||||
}
|
||||
|
||||
'astro:config:setup': async ({ command, config, injectScript, updateConfig }) => {
|
||||
if (webAnalytics?.enabled) {
|
||||
injectScript(
|
||||
'head-inline',
|
||||
await getInjectableWebAnalyticsContent({
|
||||
|
@ -80,7 +69,7 @@ export default function vercelStatic({
|
|||
})
|
||||
);
|
||||
}
|
||||
if (command === 'build' && (speedInsights?.enabled || analytics)) {
|
||||
if (command === 'build' && speedInsights?.enabled) {
|
||||
injectScript('page', 'import "@astrojs/vercel/speed-insights"');
|
||||
}
|
||||
const outDir = new URL('./static/', getVercelOutput(config.root));
|
||||
|
@ -91,7 +80,7 @@ export default function vercelStatic({
|
|||
redirects: false,
|
||||
},
|
||||
vite: {
|
||||
...getSpeedInsightsViteConfig(speedInsights?.enabled || analytics),
|
||||
...getSpeedInsightsViteConfig(speedInsights?.enabled),
|
||||
},
|
||||
...getAstroImageConfig(
|
||||
imageService,
|
||||
|
|
Loading…
Add table
Reference in a new issue