blob: 74ec5186e6c59ad5d741cde8a558361441e01d95 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import type { AstroIntegration } from 'astro';
import type { PrefetchOptions } from './client.js';
export default function (options: PrefetchOptions = {}): AstroIntegration {
return {
name: '@astrojs/prefetch',
hooks: {
'astro:config:setup': ({ injectScript }) => {
// Inject the necessary polyfills on every page (inlined for speed).
injectScript(
'page',
`import prefetch from "@astrojs/prefetch/client.js"; prefetch(${JSON.stringify(
options
)});`
);
},
},
};
}
|