mirror of
https://github.com/withastro/astro.git
synced 2025-01-27 22:19:04 -05:00
148e61d249
* feat: remove webapi in favor of a smaller polyfill
* test: remove old test
* test: 🤦♀️
* chore: changeset
23 lines
698 B
TypeScript
23 lines
698 B
TypeScript
import type { SSRManifest } from 'astro';
|
|
import { NodeApp, applyPolyfills } from 'astro/app/node';
|
|
import middleware from './nodeMiddleware.js';
|
|
import startServer from './standalone.js';
|
|
import type { Options } from './types';
|
|
|
|
applyPolyfills();
|
|
export function createExports(manifest: SSRManifest, options: Options) {
|
|
const app = new NodeApp(manifest);
|
|
return {
|
|
handler: middleware(app, options.mode),
|
|
startServer: () => startServer(app, options),
|
|
};
|
|
}
|
|
|
|
export function start(manifest: SSRManifest, options: Options) {
|
|
if (options.mode !== 'standalone' || process.env.ASTRO_NODE_AUTOSTART === 'disabled') {
|
|
return;
|
|
}
|
|
|
|
const app = new NodeApp(manifest);
|
|
startServer(app, options);
|
|
}
|