diff --git a/playground/nitro.config.ts b/playground/nitro.config.ts index 2d5eb0abf7..a6c326b882 100644 --- a/playground/nitro.config.ts +++ b/playground/nitro.config.ts @@ -2,4 +2,7 @@ import { defineNitroConfig } from "nitropack/config"; export default defineNitroConfig({ compatibilityDate: "2024-09-19", + awsLambda: { + streaming: true, + }, }); diff --git a/scripts/gen-presets.ts b/scripts/gen-presets.ts index 66b2df350f..f7ccf9f8e5 100644 --- a/scripts/gen-presets.ts +++ b/scripts/gen-presets.ts @@ -103,6 +103,8 @@ ${presetsWithType .join("\n")} } +export const presetsWithConfig = ${JSON.stringify(presetsWithType.map((p) => camelCase(p)))} as const; + export type PresetName = ${names.map((name) => `"${name}"`).join(" | ")}; export type PresetNameInput = ${names diff --git a/src/core/build/prod.ts b/src/core/build/prod.ts index f58c87b42b..201c91fd75 100644 --- a/src/core/build/prod.ts +++ b/src/core/build/prod.ts @@ -5,6 +5,7 @@ import { version as nitroVersion } from "nitropack/meta"; import type { Nitro, NitroBuildInfo, RollupConfig } from "nitropack/types"; import { dirname, join, relative, resolve } from "pathe"; import * as rollup from "rollup"; +import { presetsWithConfig } from "../../presets/_types.gen"; import { scanHandlers } from "../scan"; import { generateFSTree } from "../utils/fs-tree"; import { nitroServerName } from "../utils/nitro"; @@ -45,6 +46,11 @@ export async function buildProduction( preview: nitro.options.commands.preview, deploy: nitro.options.commands.deploy, }, + config: { + ...Object.fromEntries( + presetsWithConfig.map((key) => [key, nitro.options[key]]) + ), + }, }; await writeFile(buildInfoPath, JSON.stringify(buildInfo, null, 2)); diff --git a/src/presets/_types.gen.ts b/src/presets/_types.gen.ts index 8d3dc009c3..48a4a0ca68 100644 --- a/src/presets/_types.gen.ts +++ b/src/presets/_types.gen.ts @@ -18,6 +18,8 @@ export interface PresetOptions { vercel: VercelOptions; } +export const presetsWithConfig = ["awsAmplify","awsLambda","azure","cloudflare","firebase","netlify","vercel"] as const; + export type PresetName = "alwaysdata" | "aws-amplify" | "aws-lambda" | "azure" | "azure-functions" | "azure-swa" | "base-worker" | "bun" | "cleavr" | "cli" | "cloudflare" | "cloudflare-durable" | "cloudflare-module" | "cloudflare-module-legacy" | "cloudflare-pages" | "cloudflare-pages-static" | "cloudflare-worker" | "deno" | "deno-deploy" | "deno-server" | "digital-ocean" | "edgio" | "firebase" | "flight-control" | "genezio" | "github-pages" | "gitlab-pages" | "heroku" | "iis" | "iis-handler" | "iis-node" | "koyeb" | "layer0" | "netlify" | "netlify-builder" | "netlify-edge" | "netlify-legacy" | "netlify-static" | "nitro-dev" | "nitro-prerender" | "node" | "node-cluster" | "node-listener" | "node-server" | "platform-sh" | "render-com" | "service-worker" | "static" | "stormkit" | "vercel" | "vercel-edge" | "vercel-static" | "winterjs" | "zeabur" | "zeabur-static" | "zerops" | "zerops-static"; export type PresetNameInput = "alwaysdata" | "aws-amplify" | "awsAmplify" | "aws_amplify" | "aws-lambda" | "awsLambda" | "aws_lambda" | "azure" | "azure-functions" | "azureFunctions" | "azure_functions" | "azure-swa" | "azureSwa" | "azure_swa" | "base-worker" | "baseWorker" | "base_worker" | "bun" | "cleavr" | "cli" | "cloudflare" | "cloudflare-durable" | "cloudflareDurable" | "cloudflare_durable" | "cloudflare-module" | "cloudflareModule" | "cloudflare_module" | "cloudflare-module-legacy" | "cloudflareModuleLegacy" | "cloudflare_module_legacy" | "cloudflare-pages" | "cloudflarePages" | "cloudflare_pages" | "cloudflare-pages-static" | "cloudflarePagesStatic" | "cloudflare_pages_static" | "cloudflare-worker" | "cloudflareWorker" | "cloudflare_worker" | "deno" | "deno-deploy" | "denoDeploy" | "deno_deploy" | "deno-server" | "denoServer" | "deno_server" | "digital-ocean" | "digitalOcean" | "digital_ocean" | "edgio" | "firebase" | "flight-control" | "flightControl" | "flight_control" | "genezio" | "github-pages" | "githubPages" | "github_pages" | "gitlab-pages" | "gitlabPages" | "gitlab_pages" | "heroku" | "iis" | "iis-handler" | "iisHandler" | "iis_handler" | "iis-node" | "iisNode" | "iis_node" | "koyeb" | "layer0" | "netlify" | "netlify-builder" | "netlifyBuilder" | "netlify_builder" | "netlify-edge" | "netlifyEdge" | "netlify_edge" | "netlify-legacy" | "netlifyLegacy" | "netlify_legacy" | "netlify-static" | "netlifyStatic" | "netlify_static" | "nitro-dev" | "nitroDev" | "nitro_dev" | "nitro-prerender" | "nitroPrerender" | "nitro_prerender" | "node" | "node-cluster" | "nodeCluster" | "node_cluster" | "node-listener" | "nodeListener" | "node_listener" | "node-server" | "nodeServer" | "node_server" | "platform-sh" | "platformSh" | "platform_sh" | "render-com" | "renderCom" | "render_com" | "service-worker" | "serviceWorker" | "service_worker" | "static" | "stormkit" | "vercel" | "vercel-edge" | "vercelEdge" | "vercel_edge" | "vercel-static" | "vercelStatic" | "vercel_static" | "winterjs" | "zeabur" | "zeabur-static" | "zeaburStatic" | "zeabur_static" | "zerops" | "zerops-static" | "zeropsStatic" | "zerops_static" | (string & {}); diff --git a/src/types/nitro.ts b/src/types/nitro.ts index 36d1a13d2e..c8f56de252 100644 --- a/src/types/nitro.ts +++ b/src/types/nitro.ts @@ -1,7 +1,7 @@ import type { ConsolaInstance } from "consola"; import type { RouterMethod } from "h3"; import type { Hookable } from "hookable"; -import type { PresetName } from "nitropack/presets"; +import type { PresetName, PresetOptions } from "nitropack/presets"; import type { Unimport } from "unimport"; import type { Storage } from "unstorage"; import type { NitroConfig, NitroOptions } from "./config"; @@ -56,4 +56,5 @@ export interface NitroBuildInfo { pid: number; workerAddress: { host: string; port: number; socketPath?: string }; }; + config?: Partial; }