diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index cb4cdccc51b9..316417d6f498 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -734,16 +734,50 @@ export interface AstroUserConfig { */ serverEntry?: string; + /** + * @docs + * @name build.serverlessEntryPrefix + * @type {string} + * @default `'entry'` + * @description + * Option used when `build.mode` is set to `"serverless"`. Astro will prepend + * the emitted files using this option. + * + * ```js + * { + * build: { + * serverlessEntryPrefix: 'main' + * } + * } + * ``` + */ + serverlessEntryPrefix?: string; + /** * @docs * @name build.mode * @type {string} - * @default `'server'` + * @default {'server' | 'serverless'} * @description * Defines how the SSR should be bundled. SSR code for "server" * will be built in one single file. * + * When "serverless" is specified, Astro will emit a file for each page. + * Each file emitted will render only one page. The pages will be emitted + * inside a `pages/` directory, and emitted file will keep the same file paths + * of the `src/pages` directory. + * + * Each emitted file will be prefixed with `entry`. You can use {@link build.serverlessEntryPrefix} + * to change the prefix. * + * Inside the `dist/` directory, the pages + * ```plaintext + * ├── pages + * │ ├── blog + * │ │ ├── entry._slug_.astro.mjs + * │ │ └── entry.about.astro.mjs + * │ └── entry.index.astro.mjs + * ``` * * ```js * { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 635c51a2f190..f33227a85b7f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3362,6 +3362,18 @@ importers: specifier: ^10.11.0 version: 10.13.2 + packages/astro/test/fixtures/ssr-serverless: + dependencies: + astro: + specifier: workspace:* + version: link:../../.. + + packages/astro/test/fixtures/ssr-serverless-manifest: + dependencies: + astro: + specifier: workspace:* + version: link:../../.. + packages/astro/test/fixtures/static-build: dependencies: '@astrojs/preact':