0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-30 22:03:56 -05:00
astro/packages/integrations/deno/src/index.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
702 B
TypeScript
Raw Normal View History

import type { AstroAdapter, AstroIntegration } from 'astro';
interface Options {
port?: number;
hostname?: string;
}
export function getAdapter(args?: Options): AstroAdapter {
return {
name: '@astrojs/deno',
serverEntrypoint: '@astrojs/deno/server.js',
args: args ?? {},
exports: ['stop', 'handle', 'start', 'running'],
};
}
export default function createIntegration(args?: Options): AstroIntegration {
return {
name: '@astrojs/deno',
hooks: {
'astro:config:done': ({ setAdapter }) => {
setAdapter(getAdapter(args));
},
'astro:build:setup': ({ vite, target }) => {
2022-03-30 07:43:13 -05:00
if (target === 'server') {
vite.ssr = {
2022-03-30 07:43:13 -05:00
noExternal: true,
};
}
2022-03-30 07:43:13 -05:00
},
},
};
}