2022-03-24 11:26:25 +00: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-25 04:18:02 +00:00
|
|
|
'astro:config:done': ({ setAdapter, config }) => {
|
2022-03-24 11:26:25 +00:00
|
|
|
setAdapter(getAdapter());
|
2022-07-25 04:18:02 +00:00
|
|
|
|
2022-07-25 04:20:38 +00:00
|
|
|
if (config.output === 'static') {
|
2022-07-25 04:18:02 +00:00
|
|
|
console.warn(`[@astrojs/Node] \`output: "server"\` is required to use this adapter.`);
|
|
|
|
}
|
2022-04-14 13:52:56 +00:00
|
|
|
},
|
2022-03-24 11:27:15 +00:00
|
|
|
},
|
2022-03-24 11:26:25 +00:00
|
|
|
};
|
|
|
|
}
|