2022-03-24 06:26:25 -05:00
|
|
|
import type { AstroAdapter, AstroIntegration } from 'astro';
|
|
|
|
|
|
|
|
export function getAdapter(): AstroAdapter {
|
|
|
|
return {
|
|
|
|
name: '@astrojs/node',
|
|
|
|
serverEntrypoint: '@astrojs/node/server.js',
|
|
|
|
exports: ['handler'],
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default function createIntegration(): AstroIntegration {
|
|
|
|
return {
|
|
|
|
name: '@astrojs/node',
|
|
|
|
hooks: {
|
2022-07-24 23:18:02 -05:00
|
|
|
'astro:config:done': ({ setAdapter, config }) => {
|
2022-03-24 06:26:25 -05:00
|
|
|
setAdapter(getAdapter());
|
2022-07-24 23:18:02 -05:00
|
|
|
|
2022-07-24 23:20:38 -05:00
|
|
|
if (config.output === 'static') {
|
2022-08-29 04:02:44 -05:00
|
|
|
console.warn(`[@astrojs/node] \`output: "server"\` is required to use this adapter.`);
|
2022-07-24 23:18:02 -05:00
|
|
|
}
|
2022-04-14 08:52:56 -05:00
|
|
|
},
|
2022-03-24 06:27:15 -05:00
|
|
|
},
|
2022-03-24 06:26:25 -05:00
|
|
|
};
|
|
|
|
}
|