-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
index.ts
34 lines (31 loc) · 786 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import type { AstroAdapter, AstroIntegration } from 'astro';
export function getAdapter(): AstroAdapter {
return {
name: '@astrojs/timer',
serverEntrypoint: '@astrojs/timer/server.js',
previewEntrypoint: '@astrojs/timer/preview.js',
exports: ['handler'],
};
}
export default function createIntegration(): AstroIntegration {
return {
name: '@astrojs/timer',
hooks: {
'astro:config:setup': ({ updateConfig }) => {
updateConfig({
vite: {
ssr: {
noExternal: ['@astrojs/timer'],
},
},
});
},
'astro:config:done': ({ setAdapter, config }) => {
setAdapter(getAdapter());
if (config.output === 'static') {
console.warn(`[@astrojs/timer] \`output: "server"\` is required to use this adapter.`);
}
},
},
};
}