Skip to content

Commit

Permalink
fix: astro check fails on @vercel/speed-insights/astro missing types (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
feugy authored Jan 16, 2024
1 parent 6151e9c commit 60cf8a8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
5 changes: 3 additions & 2 deletions packages/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vercel/speed-insights",
"version": "1.0.3",
"version": "1.0.4",
"description": "Speed Insights is a tool for measuring web performance and providing suggestions for improvement.",
"keywords": [
"speed-insights",
Expand All @@ -19,7 +19,8 @@
"require": "./dist/index.js"
},
"./astro": {
"import": "./dist/astro/index.astro"
"import": "./dist/astro/index.astro",
"types": "./dist/astro/index.astro.tsx"
},
"./next": {
"browser": "./dist/next/index.mjs",
Expand Down
9 changes: 4 additions & 5 deletions packages/web/src/astro/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import type { SpeedInsightsProps } from '../index.d.ts';
type Props = Omit<SpeedInsightsProps, 'framework' | 'beforeSend'>;
// beforeSend?
const propsStr = JSON.stringify(Astro.props);
const paramsStr = JSON.stringify(Astro.params);
---
Expand All @@ -25,11 +24,11 @@ const paramsStr = JSON.stringify(Astro.params);
const props = JSON.parse(this.dataset.props ?? '{}');
const params = JSON.parse(this.dataset.params ?? '{}');
const route = computeRoute(this.dataset.pathname ?? '', params);
injectSpeedInsights({
route,
...props,
injectSpeedInsights({
route,
...props,
framework: 'astro',
beforeSend: window.speedInsightsBeforeSend
beforeSend: window.speedInsightsBeforeSend,
});
} catch (err) {
throw new Error(`Failed to parse SpeedInsights properties: ${err}`);
Expand Down
4 changes: 3 additions & 1 deletion packages/web/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ declare global {
siq?: SpeedInsights['queue'];

sil?: boolean;
// vam?: Mode;

/** used by Astro component only */
speedInsightsBeforeSend?: BeforeSendMiddleware;
}
}

5 comments on commit 60cf8a8

@vercel
Copy link

@vercel vercel bot commented on 60cf8a8 Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 60cf8a8 Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 60cf8a8 Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 60cf8a8 Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 60cf8a8 Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.