mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
18 lines
520 B
TypeScript
18 lines
520 B
TypeScript
|
import type { AstroIntegration } from 'astro';
|
||
|
import type { PrefetchOptions } from './client.js';
|
||
|
|
||
|
export default function (options: PrefetchOptions = {}): AstroIntegration {
|
||
|
return {
|
||
|
name: '@astrojs/lit',
|
||
|
hooks: {
|
||
|
'astro:config:setup': ({ updateConfig, addRenderer, injectScript }) => {
|
||
|
// Inject the necessary polyfills on every page (inlined for speed).
|
||
|
injectScript(
|
||
|
'page',
|
||
|
`import prefetch from "@astrojs/prefetch/client.js"; prefetch(${JSON.stringify(options)});`
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
}
|