nitro-nightly 3.0.1-alpha.2 → 3.0.260415-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/LICENSE +6 -0
  2. package/README.md +2 -2
  3. package/dist/THIRD-PARTY-LICENSES.md +1646 -0
  4. package/dist/_build/common.mjs +7259 -3815
  5. package/dist/_build/rolldown.mjs +32 -42
  6. package/dist/_build/rollup.mjs +28 -48
  7. package/dist/_build/vite.build.mjs +10 -10
  8. package/dist/_chunks/nitro.mjs +102 -327
  9. package/dist/_chunks/nitro2.mjs +8 -9
  10. package/dist/_chunks/nitro3.mjs +136 -0
  11. package/dist/_chunks/nitro4.mjs +127 -0
  12. package/dist/_chunks/utils.mjs +40 -29
  13. package/dist/_common.mjs +13 -25
  14. package/dist/_dev.d.mts +0 -3
  15. package/dist/{_chunks/dev.mjs → _dev.mjs} +132 -330
  16. package/dist/_libs/_.mjs +2 -0
  17. package/dist/_libs/_2.mjs +2 -0
  18. package/dist/_libs/_3.mjs +2 -0
  19. package/dist/_libs/_4.mjs +2 -0
  20. package/dist/_libs/_5.mjs +2 -0
  21. package/dist/_libs/_6.mjs +2 -0
  22. package/dist/_libs/_7.mjs +2 -0
  23. package/dist/_libs/c12+rc9.mjs +814 -0
  24. package/dist/_libs/{c12+giget+readdirp+chokidar.d.mts → c12+readdirp+chokidar.d.mts} +49 -40
  25. package/dist/_libs/citty.mjs +142 -41
  26. package/dist/_libs/commondir+is-reference.mjs +60 -56
  27. package/dist/_libs/compatx.d.mts +0 -2
  28. package/dist/_libs/compatx.mjs +1 -4
  29. package/dist/_libs/esbuild.d.mts +0 -1
  30. package/dist/_libs/escape-string-regexp.mjs +1 -4
  31. package/dist/_libs/{pluginutils+plugin-commonjs.d.mts → estree+pluginutils.d.mts} +0 -5
  32. package/dist/_libs/estree-walker.mjs +4 -92
  33. package/dist/_libs/exsolve.d.mts +1 -0
  34. package/dist/_libs/hasown+resolve+deepmerge.mjs +160 -246
  35. package/dist/_libs/httpxy.d.mts +20 -13
  36. package/dist/_libs/httpxy.mjs +519 -95
  37. package/dist/_libs/js-tokens.d.mts +1 -0
  38. package/dist/_libs/klona.mjs +1 -4
  39. package/dist/_libs/magic-string.d.mts +0 -2
  40. package/dist/_libs/mlly.d.mts +0 -2
  41. package/dist/_libs/nypm+tinyexec.mjs +822 -0
  42. package/dist/_libs/perfect-debounce.mjs +68 -0
  43. package/dist/_libs/pkg-types.d.mts +0 -3
  44. package/dist/_libs/plugin-alias.mjs +1 -5
  45. package/dist/_libs/plugin-inject.mjs +1 -7
  46. package/dist/_libs/plugin-json.mjs +1 -5
  47. package/dist/_libs/pluginutils.mjs +3 -35
  48. package/dist/_libs/readdirp+chokidar.mjs +187 -365
  49. package/dist/_libs/remapping.mjs +1 -5
  50. package/dist/_libs/resolve-uri+gen-mapping.mjs +15 -53
  51. package/dist/_libs/rou3.d.mts +1 -4
  52. package/dist/_libs/rou3.mjs +223 -78
  53. package/dist/_libs/std-env.d.mts +8 -2
  54. package/dist/_libs/strip-literal.d.mts +1 -0
  55. package/dist/_libs/tsconfck.mjs +21 -334
  56. package/dist/_libs/ultrahtml.mjs +3 -16
  57. package/dist/_libs/unimport+unplugin.mjs +244 -388
  58. package/dist/_libs/unplugin+unimport.d.mts +5 -15
  59. package/dist/_libs/unwasm.d.mts +0 -3
  60. package/dist/_presets.mjs +575 -488
  61. package/dist/builder.d.mts +5 -25
  62. package/dist/builder.mjs +3 -8
  63. package/dist/cli/_chunks/build.mjs +22 -25
  64. package/dist/cli/_chunks/common.mjs +1 -4
  65. package/dist/cli/_chunks/deploy.mjs +37 -0
  66. package/dist/cli/_chunks/dev.mjs +6 -11
  67. package/dist/cli/_chunks/docs.mjs +28 -0
  68. package/dist/cli/_chunks/list.mjs +4 -8
  69. package/dist/cli/_chunks/prepare.mjs +2 -6
  70. package/dist/cli/_chunks/preview.mjs +48 -0
  71. package/dist/cli/_chunks/run.mjs +7 -11
  72. package/dist/cli/_chunks/task.mjs +1 -5
  73. package/dist/cli/index.mjs +5 -6
  74. package/dist/docs/0.docs/0.index/index.md +56 -0
  75. package/dist/docs/0.docs/1.quick-start.md +110 -0
  76. package/dist/docs/0.docs/10.lifecycle.md +204 -0
  77. package/dist/docs/0.docs/11.openapi.md +291 -0
  78. package/dist/docs/0.docs/12.plugins.md +164 -0
  79. package/dist/docs/0.docs/13.tasks.md +277 -0
  80. package/dist/docs/0.docs/14.websocket.md +386 -0
  81. package/dist/docs/0.docs/15.migration.md +213 -0
  82. package/dist/docs/0.docs/16.nightly.md +31 -0
  83. package/dist/docs/0.docs/2.renderer.md +322 -0
  84. package/dist/docs/0.docs/3.routing.md +711 -0
  85. package/dist/docs/0.docs/4.server-entry.md +239 -0
  86. package/dist/docs/0.docs/5.cache.md +408 -0
  87. package/dist/docs/0.docs/6.storage.md +261 -0
  88. package/dist/docs/0.docs/7.assets.md +166 -0
  89. package/dist/docs/0.docs/8.configuration.md +256 -0
  90. package/dist/docs/0.docs/9.database.md +185 -0
  91. package/dist/docs/1.deploy/0.index/index.md +64 -0
  92. package/dist/docs/1.deploy/1.runtimes/0.node.md +63 -0
  93. package/dist/docs/1.deploy/1.runtimes/1.bun.md +15 -0
  94. package/dist/docs/1.deploy/1.runtimes/2.deno.md +19 -0
  95. package/dist/docs/1.deploy/2.providers/0.alwaysdata.md +50 -0
  96. package/dist/docs/1.deploy/2.providers/1.aws.md +47 -0
  97. package/dist/docs/1.deploy/2.providers/10.flightcontrol.md +67 -0
  98. package/dist/docs/1.deploy/2.providers/11.genezio.md +67 -0
  99. package/dist/docs/1.deploy/2.providers/12.github-pages.md +68 -0
  100. package/dist/docs/1.deploy/2.providers/13.gitlab-pages.md +37 -0
  101. package/dist/docs/1.deploy/2.providers/14.heroku.md +84 -0
  102. package/dist/docs/1.deploy/2.providers/15.iis.md +38 -0
  103. package/dist/docs/1.deploy/2.providers/16.koyeb.md +109 -0
  104. package/dist/docs/1.deploy/2.providers/17.netlify.md +47 -0
  105. package/dist/docs/1.deploy/2.providers/18.platform-sh.md +37 -0
  106. package/dist/docs/1.deploy/2.providers/19.render.md +37 -0
  107. package/dist/docs/1.deploy/2.providers/2.aws-amplify.md +81 -0
  108. package/dist/docs/1.deploy/2.providers/20.stormkit.md +24 -0
  109. package/dist/docs/1.deploy/2.providers/21.vercel.md +270 -0
  110. package/dist/docs/1.deploy/2.providers/22.zeabur.md +19 -0
  111. package/dist/docs/1.deploy/2.providers/23.zephyr.md +99 -0
  112. package/dist/docs/1.deploy/2.providers/24.zerops.md +102 -0
  113. package/dist/docs/1.deploy/2.providers/3.azure.md +72 -0
  114. package/dist/docs/1.deploy/2.providers/4.cleavr.md +33 -0
  115. package/dist/docs/1.deploy/2.providers/5.cloudflare.md +369 -0
  116. package/dist/docs/1.deploy/2.providers/6.deno-deploy.md +66 -0
  117. package/dist/docs/1.deploy/2.providers/7.digitalocean.md +46 -0
  118. package/dist/docs/1.deploy/2.providers/8.edgeone.md +20 -0
  119. package/dist/docs/1.deploy/2.providers/9.firebase.md +32 -0
  120. package/dist/docs/2.config/0.index/index.md +1221 -0
  121. package/dist/docs/3.examples/0.index/index.md +3 -0
  122. package/dist/docs/3.examples/1.api-routes.md +145 -0
  123. package/dist/docs/3.examples/10.hono.md +74 -0
  124. package/dist/docs/3.examples/11.import-alias.md +97 -0
  125. package/dist/docs/3.examples/12.middleware.md +91 -0
  126. package/dist/docs/3.examples/13.mono-jsx.md +68 -0
  127. package/dist/docs/3.examples/14.nano-jsx.md +70 -0
  128. package/dist/docs/3.examples/15.plugins.md +91 -0
  129. package/dist/docs/3.examples/16.renderer.md +113 -0
  130. package/dist/docs/3.examples/17.runtime-config.md +97 -0
  131. package/dist/docs/3.examples/18.server-fetch.md +87 -0
  132. package/dist/docs/3.examples/19.shiki.md +198 -0
  133. package/dist/docs/3.examples/2.auto-imports.md +92 -0
  134. package/dist/docs/3.examples/20.virtual-routes.md +74 -0
  135. package/dist/docs/3.examples/21.vite-nitro-plugin.md +79 -0
  136. package/dist/docs/3.examples/22.vite-rsc.md +1041 -0
  137. package/dist/docs/3.examples/23.vite-ssr-html.md +217 -0
  138. package/dist/docs/3.examples/24.vite-ssr-preact.md +247 -0
  139. package/dist/docs/3.examples/25.vite-ssr-react.md +226 -0
  140. package/dist/docs/3.examples/26.vite-ssr-solid.md +256 -0
  141. package/dist/docs/3.examples/27.vite-ssr-tsr-react.md +442 -0
  142. package/dist/docs/3.examples/28.vite-ssr-tss-react.md +444 -0
  143. package/dist/docs/3.examples/29.vite-ssr-vue-router.md +617 -0
  144. package/dist/docs/3.examples/3.cached-handler.md +81 -0
  145. package/dist/docs/3.examples/30.vite-trpc.md +335 -0
  146. package/dist/docs/3.examples/31.websocket.md +282 -0
  147. package/dist/docs/3.examples/4.custom-error-handler.md +98 -0
  148. package/dist/docs/3.examples/5.database.md +157 -0
  149. package/dist/docs/3.examples/6.elysia.md +70 -0
  150. package/dist/docs/3.examples/7.express.md +78 -0
  151. package/dist/docs/3.examples/8.fastify.md +79 -0
  152. package/dist/docs/3.examples/9.hello-world.md +68 -0
  153. package/dist/docs/README.md +86 -0
  154. package/dist/docs/index.md +121 -0
  155. package/dist/node_modules/@poppinss/dumper/build/formatters/html/main.js +8 -0
  156. package/dist/node_modules/@poppinss/dumper/package.json +1 -1
  157. package/dist/node_modules/@speed-highlight/core/dist/index.js +4 -4
  158. package/dist/node_modules/@speed-highlight/core/dist/terminal.js +2 -2
  159. package/dist/node_modules/@speed-highlight/core/package.json +1 -1
  160. package/dist/node_modules/cookie-es/dist/index.mjs +299 -250
  161. package/dist/node_modules/cookie-es/package.json +26 -23
  162. package/dist/node_modules/croner/dist/croner.js +1 -1
  163. package/dist/node_modules/croner/package.json +11 -1
  164. package/dist/node_modules/defu/dist/defu.mjs +2 -2
  165. package/dist/node_modules/defu/package.json +33 -28
  166. package/dist/node_modules/rendu/dist/_chunks/libs/cookie-es.mjs +151 -0
  167. package/dist/node_modules/rendu/dist/index.mjs +5 -112
  168. package/dist/node_modules/rendu/package.json +25 -24
  169. package/dist/node_modules/youch/build/helpers-B9BQYaS6.js +23 -0
  170. package/dist/node_modules/youch/build/index.js +204 -351
  171. package/dist/node_modules/youch/build/public/error_info/script.js +1 -1
  172. package/dist/node_modules/youch/build/public_dir-C5bujZKB.js +25 -0
  173. package/dist/node_modules/youch/build/src/templates/error_cause/main.js +44 -0
  174. package/dist/node_modules/youch/build/src/templates/error_info/main.js +72 -0
  175. package/dist/node_modules/youch/build/src/templates/error_metadata/main.js +65 -0
  176. package/dist/node_modules/youch/build/src/templates/error_stack/main.js +152 -0
  177. package/dist/node_modules/youch/build/src/templates/error_stack_source/main.js +46 -0
  178. package/dist/node_modules/youch/build/src/templates/header/main.js +24 -0
  179. package/dist/node_modules/youch/build/src/templates/layout/main.js +27 -0
  180. package/dist/node_modules/youch/package.json +35 -32
  181. package/dist/presets/_nitro/runtime/nitro-dev.mjs +12 -57
  182. package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +1 -0
  183. package/dist/presets/_nitro/runtime/service-worker.mjs +1 -2
  184. package/dist/presets/aws-lambda/runtime/_utils.mjs +6 -6
  185. package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +3 -1
  186. package/dist/presets/azure/runtime/_utils.mjs +5 -5
  187. package/dist/presets/azure/runtime/azure-swa.mjs +5 -5
  188. package/dist/presets/bun/runtime/bun.mjs +9 -6
  189. package/dist/presets/cloudflare/runtime/_module-handler.mjs +1 -1
  190. package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +4 -4
  191. package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +3 -3
  192. package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +2 -2
  193. package/dist/presets/cloudflare/runtime/plugin.dev.mjs +10 -21
  194. package/dist/presets/deno/runtime/deno-deploy.mjs +4 -4
  195. package/dist/presets/deno/runtime/deno-server.mjs +9 -6
  196. package/dist/presets/edgeone/runtime/edgeone.mjs +10 -0
  197. package/dist/presets/netlify/runtime/netlify-edge.mjs +2 -3
  198. package/dist/presets/netlify/runtime/netlify.mjs +1 -1
  199. package/dist/presets/node/runtime/node-cluster.mjs +5 -4
  200. package/dist/presets/node/runtime/node-middleware.mjs +1 -1
  201. package/dist/presets/node/runtime/node-server.mjs +8 -5
  202. package/dist/presets/stormkit/runtime/stormkit.mjs +1 -2
  203. package/dist/presets/vercel/runtime/cron-handler.mjs +25 -0
  204. package/dist/presets/vercel/runtime/queue-handler.mjs +21 -0
  205. package/dist/presets/vercel/runtime/vercel.node.mjs +3 -3
  206. package/dist/presets/vercel/runtime/vercel.web.mjs +3 -5
  207. package/dist/presets/winterjs/runtime/winterjs.mjs +10 -10
  208. package/dist/presets/zephyr/runtime/server.mjs +3 -0
  209. package/dist/runtime/internal/app.mjs +12 -11
  210. package/dist/runtime/internal/cache.d.mts +0 -4
  211. package/dist/runtime/internal/cache.mjs +32 -256
  212. package/dist/runtime/internal/context.d.mts +3 -1
  213. package/dist/runtime/internal/context.mjs +1 -9
  214. package/dist/runtime/internal/error/dev.d.mts +5 -4
  215. package/dist/runtime/internal/error/dev.mjs +47 -49
  216. package/dist/runtime/internal/error/hooks.d.mts +1 -1
  217. package/dist/runtime/internal/error/prod.d.mts +2 -5
  218. package/dist/runtime/internal/error/prod.mjs +19 -33
  219. package/dist/runtime/internal/error/utils.d.mts +4 -4
  220. package/dist/runtime/internal/meta.d.mts +1 -1
  221. package/dist/runtime/internal/plugin.d.mts +2 -2
  222. package/dist/runtime/internal/route-rules.d.mts +11 -4
  223. package/dist/runtime/internal/route-rules.mjs +15 -5
  224. package/dist/runtime/internal/routes/dev-tasks.d.mts +3 -2
  225. package/dist/runtime/internal/routes/dev-tasks.mjs +15 -10
  226. package/dist/runtime/internal/routes/openapi.mjs +2 -2
  227. package/dist/runtime/internal/routes/renderer-template.d.mts +1 -1
  228. package/dist/runtime/internal/routes/renderer-template.dev.d.mts +2 -1
  229. package/dist/runtime/internal/routes/scalar.mjs +3 -3
  230. package/dist/runtime/internal/routes/swagger.mjs +7 -4
  231. package/dist/runtime/internal/runtime-config.d.mts +1 -1
  232. package/dist/runtime/internal/runtime-config.mjs +2 -2
  233. package/dist/runtime/internal/static.mjs +5 -4
  234. package/dist/runtime/internal/task.d.mts +3 -1
  235. package/dist/runtime/internal/task.mjs +7 -7
  236. package/dist/runtime/internal/vite/dev-entry.mjs +6 -3
  237. package/dist/runtime/internal/vite/dev-worker.mjs +264 -0
  238. package/dist/runtime/meta.d.mts +1 -0
  239. package/dist/runtime/meta.mjs +2 -0
  240. package/dist/runtime/nitro.d.mts +2 -0
  241. package/dist/runtime/nitro.mjs +4 -2
  242. package/dist/runtime/virtual/error-handler.mjs +1 -1
  243. package/dist/runtime/virtual/renderer-template.mjs +1 -1
  244. package/dist/runtime/virtual/server-assets.d.mts +2 -1
  245. package/dist/runtime/virtual/tracing.d.mts +5 -0
  246. package/dist/runtime/virtual/tracing.mjs +1 -0
  247. package/dist/runtime/vite.d.mts +1 -1
  248. package/dist/types/index.d.mts +215 -195
  249. package/dist/types/index.mjs +1 -11
  250. package/dist/vite.d.mts +3 -8
  251. package/dist/vite.mjs +285 -253
  252. package/lib/tsconfig.json +3 -5
  253. package/package.json +97 -80
  254. package/dist/_libs/confbox.mjs +0 -2509
  255. package/dist/_libs/nypm+giget+tinyexec.mjs +0 -3603
  256. package/dist/_libs/rc9+c12+dotenv.mjs +0 -972
  257. package/dist/node_modules/hookable/dist/index.mjs +0 -266
  258. package/dist/node_modules/hookable/package.json +0 -52
  259. package/dist/node_modules/youch/build/chunk-4L7RY2JA.js +0 -42
  260. package/dist/node_modules/youch/build/chunk-7QV3D5YX.js +0 -83
  261. package/dist/node_modules/youch/build/chunk-AUGPHE32.js +0 -39
  262. package/dist/node_modules/youch/build/chunk-CM7DWJNZ.js +0 -44
  263. package/dist/node_modules/youch/build/chunk-EJH674NB.js +0 -223
  264. package/dist/node_modules/youch/build/chunk-OIJ3WD7L.js +0 -81
  265. package/dist/node_modules/youch/build/chunk-P36L72PL.js +0 -87
  266. package/dist/node_modules/youch/build/chunk-PE3GG3TN.js +0 -65
  267. package/dist/node_modules/youch/build/chunk-X53OIOJH.js +0 -70
  268. package/dist/presets/_nitro/runtime/nitro-dev.d.mts +0 -2
  269. package/dist/presets/_nitro/runtime/nitro-prerenderer.d.mts +0 -3
  270. package/dist/presets/_nitro/runtime/service-worker.d.mts +0 -2
  271. package/dist/presets/aws-amplify/runtime/aws-amplify.d.mts +0 -2
  272. package/dist/presets/aws-lambda/runtime/_utils.d.mts +0 -8
  273. package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.d.mts +0 -2
  274. package/dist/presets/aws-lambda/runtime/aws-lambda.d.mts +0 -3
  275. package/dist/presets/azure/runtime/_utils.d.mts +0 -2
  276. package/dist/presets/azure/runtime/azure-swa.d.mts +0 -5
  277. package/dist/presets/bun/runtime/bun.d.mts +0 -3
  278. package/dist/presets/cloudflare/runtime/_module-handler.d.mts +0 -16
  279. package/dist/presets/cloudflare/runtime/cloudflare-durable.d.mts +0 -11
  280. package/dist/presets/cloudflare/runtime/cloudflare-module.d.mts +0 -3
  281. package/dist/presets/cloudflare/runtime/cloudflare-pages.d.mts +0 -20
  282. package/dist/presets/cloudflare/runtime/plugin.dev.d.mts +0 -3
  283. package/dist/presets/deno/runtime/deno-deploy.d.mts +0 -5
  284. package/dist/presets/deno/runtime/deno-server.d.mts +0 -3
  285. package/dist/presets/netlify/runtime/netlify-edge.d.mts +0 -3
  286. package/dist/presets/netlify/runtime/netlify.d.mts +0 -4
  287. package/dist/presets/node/runtime/node-cluster.d.mts +0 -3
  288. package/dist/presets/node/runtime/node-middleware.d.mts +0 -3
  289. package/dist/presets/node/runtime/node-server.d.mts +0 -3
  290. package/dist/presets/standard/runtime/server.d.mts +0 -3
  291. package/dist/presets/stormkit/runtime/stormkit.d.mts +0 -21
  292. package/dist/presets/vercel/runtime/isr.d.mts +0 -2
  293. package/dist/presets/vercel/runtime/vercel.node.d.mts +0 -3
  294. package/dist/presets/vercel/runtime/vercel.web.d.mts +0 -8
  295. package/dist/presets/winterjs/runtime/winterjs.d.mts +0 -2
  296. package/dist/presets/zeabur/runtime/zeabur.d.mts +0 -3
  297. package/dist/runtime/internal/vite/node-runner.mjs +0 -359
@@ -0,0 +1,270 @@
1
+ # Vercel
2
+
3
+ > Deploy Nitro apps to Vercel.
4
+
5
+ **Preset:** `vercel`
6
+
7
+ <read-more></read-more>
8
+
9
+ <note>
10
+
11
+ Integration with this provider is possible with [zero configuration](/deploy/#zero-config-providers).
12
+ </note>
13
+
14
+ ## Getting started
15
+
16
+ Deploying to Vercel comes with the following features:
17
+
18
+ - [Preview deployments](https://vercel.com/docs/deployments/environments)
19
+ - [Fluid compute](https://vercel.com/docs/fluid-compute)
20
+ - [Observability](https://vercel.com/docs/observability)
21
+ - [Vercel Firewall](https://vercel.com/docs/vercel-firewall)
22
+ And much more. Learn more in [the Vercel documentation](https://vercel.com/docs).
23
+
24
+ ### Deploy with Git
25
+
26
+ Vercel supports Nitro with zero-configuration. [Deploy Nitro to Vercel now](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fvercel%2Ftree%2Fmain%2Fexamples%2Fnitro).
27
+
28
+ ## API routes
29
+
30
+ Nitro `/api` directory isn't compatible with Vercel. Instead, you should use:
31
+
32
+ - `routes/api/` for standalone usage
33
+
34
+ ## Bun runtime
35
+ <read-more></read-more>
36
+
37
+ You can use [Bun](https://bun.com) instead of Node.js by specifying the runtime using the `vercel.functions` key inside `nitro.config`:
38
+
39
+ ```ts [nitro.config.ts]
40
+ export default defineConfig({
41
+ vercel: {
42
+ functions: {
43
+ runtime: "bun1.x"
44
+ }
45
+ }
46
+ })
47
+ ```
48
+
49
+ Alternatively, Nitro also detects Bun automatically if you specify a `bunVersion` property in your `vercel.json`:
50
+
51
+ ```json [vercel.json]
52
+ {
53
+ "$schema": "https://openapi.vercel.sh/vercel.json",
54
+ "bunVersion": "1.x"
55
+ }
56
+ ```
57
+
58
+ ## Per-route function configuration
59
+
60
+ Use `vercel.functionRules` to override [serverless function settings](https://vercel.com/docs/build-output-api/primitives#serverless-function-configuration) for specific routes. Each key is a route pattern and its value is a partial function configuration object that gets merged with the base `vercel.functions` config. Note: array properties (e.g., `regions`) from route config will replace the base config arrays rather than merging them.
61
+
62
+ This is useful when certain routes need different resource limits, regions, or features like [Vercel Queues triggers](https://vercel.com/docs/queues).
63
+
64
+ ```ts [nitro.config.ts]
65
+ import { defineConfig } from "nitro";
66
+
67
+ export default defineConfig({
68
+ vercel: {
69
+ functionRules: {
70
+ "/api/heavy-computation": {
71
+ maxDuration: 800,
72
+ memory: 4096,
73
+ },
74
+ "/api/regional": {
75
+ regions: ["lhr1", "cdg1"],
76
+ },
77
+ "/api/queues/process-order": {
78
+ experimentalTriggers: [{ type: "queue/v2beta", topic: "orders" }],
79
+ },
80
+ },
81
+ },
82
+ });
83
+ ```
84
+
85
+ Route patterns support wildcards via [rou3](https://github.com/h3js/rou3) matching (e.g., `/api/slow/**` matches all routes under `/api/slow/`).
86
+
87
+ ## Proxy route rules
88
+
89
+ Nitro automatically optimizes `proxy` route rules on Vercel by generating [CDN-level rewrites](https://vercel.com/docs/rewrites) at build time. This means matching requests are proxied at the edge without invoking a serverless function, reducing latency and cost.
90
+
91
+ ```ts [nitro.config.ts]
92
+ export default defineConfig({
93
+ routeRules: {
94
+ // Proxied at CDN level — no function invocation
95
+ "/api/**": {
96
+ proxy: "https://api.example.com/**",
97
+ },
98
+ },
99
+ });
100
+ ```
101
+
102
+ ### When CDN rewrites apply
103
+
104
+ A proxy rule is offloaded to a Vercel CDN rewrite when **all** of the following are true:
105
+
106
+ - The target is an **external URL** (starts with `http://` or `https://`).
107
+ - No advanced `ProxyOptions` are set on the rule.
108
+
109
+ ### Fallback to runtime proxy
110
+ When the proxy rule uses any of the following `ProxyOptions`, Nitro keeps it as a runtime proxy handled by the serverless function:
111
+
112
+ - `headers` — custom headers on the outgoing request to the upstream
113
+ - `forwardHeaders` / `filterHeaders` — header filtering
114
+ - `fetchOptions` — custom fetch options
115
+ - `cookieDomainRewrite` / `cookiePathRewrite` — cookie manipulation
116
+ - `onResponse` — response callback
117
+
118
+ <note>
119
+
120
+ Response headers defined on the route rule via the `headers` option are still applied to CDN-level rewrites. Only request-level `ProxyOptions.headers` (sent to the upstream) require a runtime proxy.
121
+ </note>
122
+
123
+ ## Scheduled tasks (Cron Jobs)
124
+
125
+ <read-more></read-more>
126
+
127
+ Nitro automatically converts your [`scheduledTasks`](/docs/tasks#scheduled-tasks) configuration into [Vercel Cron Jobs](https://vercel.com/docs/cron-jobs) at build time. Define your schedules in your Nitro config and deploy - no manual `vercel.json` cron configuration required.
128
+
129
+ ```ts [nitro.config.ts]
130
+ import { defineConfig } from "nitro";
131
+
132
+ export default defineConfig({
133
+ experimental: {
134
+ tasks: true
135
+ },
136
+ scheduledTasks: {
137
+ // Run `cms:update` every hour
138
+ '0 * * * *': ['cms:update'],
139
+ // Run `db:cleanup` every day at midnight
140
+ '0 0 * * *': ['db:cleanup']
141
+ }
142
+ })
143
+ ```
144
+
145
+ ### Secure cron job endpoints
146
+
147
+ <read-more></read-more>
148
+
149
+ To prevent unauthorized access to the cron handler, set a `CRON_SECRET` environment variable in your Vercel project settings. When `CRON_SECRET` is set, Nitro validates the `Authorization` header on every cron invocation.
150
+
151
+ ## Queues
152
+
153
+ <read-more></read-more>
154
+
155
+ Nitro integrates with [Vercel Queues](https://vercel.com/docs/queues) to process messages asynchronously. Define your queue topics in the Nitro config and handle incoming messages with the `vercel:queue` runtime hook.
156
+
157
+ ```ts [nitro.config.ts]
158
+ export default defineNitroConfig({
159
+ vercel: {
160
+ queues: {
161
+ triggers: [
162
+ // Only `topic` is required
163
+ { topic: "notifications" },
164
+ { topic: "orders", retryAfterSeconds: 60, initialDelaySeconds: 5 },
165
+ ],
166
+ },
167
+ },
168
+ });
169
+ ```
170
+
171
+ ### Handling messages
172
+
173
+ Use the `vercel:queue` hook in a [Nitro plugin](/guide/plugins) to process incoming queue messages:
174
+
175
+ ```ts [server/plugins/queues.ts]
176
+ export default defineNitroPlugin((nitro) => {
177
+ nitro.hooks.hook("vercel:queue", ({ message, metadata, send }) => {
178
+ console.log(`[${metadata.topicName}] Message ${metadata.messageId}:`, message);
179
+ });
180
+ });
181
+ ```
182
+
183
+ ### Running tasks from queue messages
184
+
185
+ You can use queue messages to trigger [Nitro tasks](/docs/tasks):
186
+
187
+ ```ts [server/plugins/queues.ts]
188
+ import { runTask } from "nitro/task";
189
+
190
+ export default defineNitroPlugin((nitro) => {
191
+ nitro.hooks.hook("vercel:queue", async ({ message, metadata }) => {
192
+ if (metadata.topicName === "orders") {
193
+ await runTask("orders:fulfill", { payload: message });
194
+ }
195
+ });
196
+ });
197
+ ```
198
+
199
+ ### Sending messages
200
+
201
+ Use the `@vercel/queue` package directly to send messages to a topic:
202
+
203
+ ```ts [server/routes/api/orders.post.ts]
204
+ import { send } from "@vercel/queue";
205
+
206
+ export default defineEventHandler(async (event) => {
207
+ const order = await event.req.json();
208
+ const { messageId } = await send("orders", order);
209
+ return { messageId };
210
+ });
211
+ ```
212
+
213
+ ## Custom build output configuration
214
+
215
+ You can provide additional [build output configuration](https://vercel.com/docs/build-output-api/v3) using `vercel.config` key inside `nitro.config`. It will be merged with built-in auto-generated config.
216
+
217
+ ## On-Demand incremental static regeneration (ISR)
218
+
219
+ On-demand revalidation allows you to purge the cache for an ISR route whenever you want, foregoing the time interval required with background revalidation.
220
+
221
+ To revalidate a page on demand:
222
+
223
+ 1. Create an Environment Variable which will store a revalidation secret
224
+ - You can use the command `openssl rand -base64 32` or [Generate a Secret](https://generate-secret.vercel.app/32) to generate a random value.
225
+
226
+ - Update your configuration:
227
+
228
+ ```ts [nitro.config.ts]
229
+ import { defineConfig } from "nitro";
230
+
231
+ export default defineConfig({
232
+ vercel: {
233
+ config: {
234
+ bypassToken: process.env.VERCEL_BYPASS_TOKEN
235
+ }
236
+ }
237
+ })
238
+ ```
239
+
240
+ - To trigger "On-Demand Incremental Static Regeneration (ISR)" and revalidate a path to a Prerender Function, make a GET or HEAD request to that path with a header of x-prerender-revalidate: `bypassToken`. When that Prerender Function endpoint is accessed with this header set, the cache will be revalidated. The next request to that function should return a fresh response.
241
+
242
+
243
+ ### Fine-grained ISR config via route rules
244
+
245
+ By default, query params affect cache keys but are not passed to the route handler unless specified.
246
+
247
+ You can pass an options object to `isr` route rule to configure caching behavior.
248
+
249
+ - `expiration`: Expiration time (in seconds) before the cached asset will be re-generated by invoking the Serverless Function. Setting the value to `false` (or `isr: true` route rule) means it will never expire.
250
+ - `group`: Group number of the asset. Prerender assets with the same group number will all be re-validated at the same time.
251
+ - `allowQuery`: List of query string parameter names that will be cached independently. - If an empty array, query values are not considered for caching.
252
+ - If `undefined` each unique query value is cached independently.
253
+ - For wildcard `/**` route rules, `url` is always added
254
+
255
+ - `passQuery`: When `true`, the query string will be present on the `request` argument passed to the invoked function. The `allowQuery` filter still applies.
256
+ - `exposeErrBody`: When `true`, expose the response body regardless of status code including error status codes. (default `false`
257
+
258
+ ```ts
259
+ export default defineConfig({
260
+ routeRules: {
261
+ "/products/**": {
262
+ isr: {
263
+ allowQuery: ["q"],
264
+ passQuery: true,
265
+ exposeErrBody: true
266
+ },
267
+ },
268
+ },
269
+ });
270
+ ```
@@ -0,0 +1,19 @@
1
+ # Zeabur
2
+
3
+ > Deploy Nitro apps to [Zeabur](https://zeabur.com).
4
+
5
+ **Preset:** `zeabur`
6
+
7
+ <read-more></read-more>
8
+
9
+ <note>
10
+
11
+ Integration with this provider is possible with [zero configuration](/deploy/#zero-config-providers).
12
+ </note>
13
+
14
+ ## Deploy using git
15
+
16
+ 1. Push your code to your git repository (Currently only GitHub supported).
17
+ 2. [Import your project](https://zeabur.com/docs/get-started) into Zeabur.
18
+ 3. Zeabur will detect that you are using Nitro and will enable the correct settings for your deployment.
19
+ 4. Your application is deployed!
@@ -0,0 +1,99 @@
1
+ # Zephyr Cloud
2
+
3
+ > Deploy Nitro apps to [Zephyr Cloud](https://zephyr-cloud.io).
4
+
5
+ **Preset:** `zephyr`
6
+
7
+ <read-more></read-more>
8
+
9
+ Zephyr support is built into Nitro through the `zephyr` preset.
10
+
11
+ For most Zephyr-specific topics such as BYOC, cloud integrations, environments, and CI/CD authentication, refer to the [Zephyr Cloud docs](https://docs.zephyr-cloud.io).
12
+
13
+ <note>
14
+
15
+ Zephyr is a little different from most Nitro deployment providers. Instead of targeting a single hosting vendor directly, Zephyr acts as a deployment control plane on top of either Zephyr-managed infrastructure or your own cloud integrations.
16
+ </note>
17
+
18
+ ## BYOC model
19
+
20
+ Zephyr supports a BYOC (Bring Your Own Cloud) model. In Zephyr's architecture, the control plane stays managed by Zephyr, while the data plane (workers and storage) runs in your cloud accounts.
21
+
22
+ This lets you keep Zephyr's deployment workflow while using any supported Zephyr cloud integration. See the [Zephyr BYOC docs](https://docs.zephyr-cloud.io/features/byoc) for the current list of supported providers.
23
+
24
+ ## Deploy with Nitro CLI
25
+
26
+ Use Nitro's deploy command to build and upload your app to Zephyr in one step:
27
+
28
+ ```bash
29
+ npx nitro deploy --preset zephyr
30
+ ```
31
+
32
+ Nitro will upload the generated output using `zephyr-agent`. If `zephyr-agent` is missing, Nitro will prompt to install it locally and will install it automatically in CI.
33
+
34
+ ## Deploy during build
35
+
36
+ Zephyr is a little different here from most Nitro providers: we recommend enabling deployment during `nitro build` and treating build as the primary deployment step.
37
+
38
+ If your CI pipeline already runs `nitro build`, enable deployment during the build step:
39
+
40
+ ```ts [nitro.config.ts]
41
+ import { defineConfig } from "nitro";
42
+
43
+ export default defineConfig({
44
+ preset: "zephyr",
45
+ zephyr: {
46
+ deployOnBuild: true,
47
+ },
48
+ });
49
+ ```
50
+
51
+ Then your normal build command is enough:
52
+
53
+ <pm-run></pm-run>
54
+
55
+ After the build finishes, Nitro uploads the generated output to Zephyr, deploys it to the edge, and prints the deployment URL:
56
+
57
+ ```txt
58
+ ◐ Building [Nitro] (preset: zephyr, compatibility: YYYY-MM-DD)
59
+ ...
60
+ ZEPHYR Uploaded local snapshot in 110ms
61
+ ZEPHYR Deployed to Zephyr's edge in 700ms.
62
+ ZEPHYR
63
+ ZEPHYR https://my-app.zephyrcloud.app
64
+ ```
65
+
66
+ ## CI authentication
67
+
68
+ Zephyr requires an API token for non-interactive deployments. The example below uses the simpler personal-token style setup with `ZE_SECRET_TOKEN` together with `zephyr.deployOnBuild`.
69
+
70
+ ```yaml [.github/workflows/deploy.yml]
71
+ name: Deploy with Zephyr
72
+
73
+ on:
74
+ push:
75
+ branches: [main]
76
+
77
+ jobs:
78
+ deploy:
79
+ runs-on: ubuntu-latest
80
+ env:
81
+ ZE_SECRET_TOKEN: ${{ secrets.ZEPHYR_AUTH_TOKEN }}
82
+ steps:
83
+ - uses: actions/checkout@v4
84
+ - uses: actions/setup-node@v4
85
+ with:
86
+ node-version: 20
87
+ - run: npm ci
88
+ - run: npm run build
89
+ ```
90
+
91
+ For more advanced CI/CD setups, Zephyr also documents organization-level server-token authentication using `ZE_SERVER_TOKEN`. See the [Zephyr CI/CD server token docs](https://docs.zephyr-cloud.io/features/ci-cd-server-token).
92
+
93
+ ## Options
94
+
95
+ ### `zephyr.deployOnBuild`
96
+
97
+ Deploy to Zephyr during `nitro build` when using the `zephyr` preset.
98
+
99
+ - Default: `false`
@@ -0,0 +1,102 @@
1
+ # Zerops
2
+
3
+ > Deploy Nitro apps to [Zerops](https://zerops.io).
4
+
5
+ **Preset:** `zerops`
6
+
7
+ <read-more></read-more>
8
+
9
+ > [!IMPORTANT]
10
+ > 🚧 This preset is currently experimental.
11
+
12
+ Zerops supports deploying both static and server-side rendered apps with a simple configuration file in your project root.
13
+
14
+ ## Starter templates
15
+
16
+ If you want to quckly get started with zerops and nitro you can use repositories [`zeropsio/recipe-nitro-nodejs`](https://github.com/zeropsio/recipe-nitro-nodejs) and [`zeropsio/recipe-nitro-static`](https://github.com/zeropsio/recipe-nitro-static) starter templates.
17
+
18
+ ## Project setup
19
+
20
+ Projects and services can be added either through [project add wizard](https://app.zerops.io/dashboard/project-add) or imported using `zerops-project-import.yml`.
21
+
22
+ <code-group>
23
+
24
+ ```yml [zerops-project-import.yml (node.js)]
25
+ project:
26
+ name: nitro-app
27
+
28
+ services:
29
+ - hostname: app
30
+ type: nodejs@20
31
+ ```
32
+
33
+ ```yml [zerops-project-import.yml (static)]
34
+ project:
35
+ name: nitro-app
36
+
37
+ services:
38
+ - hostname: app
39
+ type: static
40
+ ```
41
+ </code-group>
42
+
43
+ Then create a `zerops.yml` config in your project root:
44
+
45
+ <code-group>
46
+
47
+ ```yml [zerops.yml (node.js)]
48
+ zerops:
49
+ - setup: app
50
+ build:
51
+ base: nodejs@20
52
+ envVariables:
53
+ NITRO_PRESET: zerops
54
+ buildCommands:
55
+ - pnpm i
56
+ - pnpm run build
57
+ deployFiles:
58
+ - .output
59
+ - package.json
60
+ - node_modules
61
+ run:
62
+ base: nodejs@20
63
+ ports:
64
+ - port: 3000
65
+ httpSupport: true
66
+ start: node .output/server/index.mjs
67
+ ```
68
+
69
+ ```yml [zerops.yml (static)]
70
+ zerops:
71
+ - setup: app
72
+ build:
73
+ base: nodejs@20
74
+ envVariables:
75
+ NITRO_PRESET: zerops-static
76
+ buildCommands:
77
+ - pnpm i
78
+ - pnpm build
79
+ deployFiles:
80
+ - .zerops/output/static/~
81
+ run:
82
+ base: static
83
+ ```
84
+ </code-group>
85
+
86
+ Now you can trigger the [build & deploy pipeline using the Zerops CLI](#building-deploying-your-app) or by connecting the app service with your [GitHub](https://docs.zerops.io/references/github-integration/) / [GitLab](https://docs.zerops.io/references/gitlab-integration) repository from inside the service detail.
87
+
88
+ ## Build and deploy
89
+
90
+ Open [Settings > Access Token Management](https://app.zerops.io/settings/token-management) in the Zerops app and generate a new access token.
91
+
92
+ Log in using your access token with the following command:
93
+
94
+ <pm-x></pm-x>
95
+
96
+ Navigate to the root of your app (where `zerops.yml` is located) and run the following command to trigger the deploy:
97
+
98
+ <pm-x></pm-x>
99
+
100
+ Your code can be deployed automatically on each commit or a new tag by connecting the service with your [GitHub](https://docs.zerops.io/references/gitlab-integration) / [GitLab](https://docs.zerops.io/references/gitlab-integration) repository. This connection can be set up in the service detail.
101
+
102
+ <read-more></read-more>
@@ -0,0 +1,72 @@
1
+ # Azure
2
+
3
+ > Deploy Nitro apps to Azure Static Web apps or functions.
4
+
5
+ ## Azure static web apps
6
+
7
+ **Preset:** `azure-swa`
8
+
9
+ <read-more></read-more>
10
+
11
+ <note>
12
+
13
+ Integration with this provider is possible with [zero configuration](/deploy/#zero-config-providers).
14
+ </note>
15
+
16
+ [Azure Static Web Apps](https://azure.microsoft.com/en-us/products/app-service/static) are designed to be deployed continuously in a [GitHub Actions workflow](https://docs.microsoft.com/en-us/azure/static-web-apps/github-actions-workflow). By default, Nitro will detect this deployment environment and enable the `azure` preset.
17
+
18
+ ### Local preview
19
+
20
+ Install [Azure Functions Core Tools](https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local) if you want to test locally.
21
+
22
+ You can invoke a development environment to preview before deploying.
23
+
24
+ ```bash
25
+ NITRO_PRESET=azure npx nypm@latest build
26
+ npx @azure/static-web-apps-cli start .output/public --api-location .output/server
27
+ ```
28
+
29
+ ### Configuration
30
+
31
+ Azure Static Web Apps are [configured](https://learn.microsoft.com/en-us/azure/static-web-apps/configuration) using the `staticwebapp.config.json` file.
32
+
33
+ Nitro automatically generates this configuration file whenever the application is built with the `azure` preset.
34
+
35
+ Nitro will automatically add the following properties based on the following criteria:
36
+ | Property | Criteria | Default |
37
+ | --- | --- | --- |
38
+ | **[platform.apiRuntime](https://learn.microsoft.com/en-us/azure/static-web-apps/configuration#platform)** | Will automatically set to `node:16` or `node:14` depending on your package configuration. | `node:16` |
39
+ | **[navigationFallback.rewrite](https://learn.microsoft.com/en-us/azure/static-web-apps/configuration#fallback-routes)** | Is always `/api/server` | `/api/server` |
40
+ | **[routes](https://learn.microsoft.com/en-us/azure/static-web-apps/configuration#routes)** | All prerendered routes are added. Additionally, if you do not have an `index.html` file an empty one is created for you for compatibility purposes and also requests to `/index.html` are redirected to the root directory which is handled by `/api/server`. | `[]` |
41
+
42
+ ### Custom configuration
43
+
44
+ You can alter the Nitro generated configuration using `azure.config` option.
45
+
46
+ Custom routes will be added and matched first. In the case of a conflict (determined if an object has the same route property), custom routes will override generated ones.
47
+
48
+ ### Deploy from CI/CD via GitHub actions
49
+
50
+ When you link your GitHub repository to Azure Static Web Apps, a workflow file is added to the repository.
51
+
52
+ When you are asked to select your framework, select custom and provide the following information:
53
+
54
+ | Input | Value |
55
+ | --- | --- |
56
+ | **app_location** | '/' |
57
+ | **api_location** | '.output/server' |
58
+ | **output_location** | '.output/public' |
59
+
60
+ If you miss this step, you can always find the build configuration section in your workflow and update the build configuration:
61
+
62
+ ```yaml [.github/workflows/azure-static-web-apps-<RANDOM_NAME>.yml]
63
+ ###### Repository/Build Configurations ######
64
+ app_location: '/'
65
+ api_location: '.output/server'
66
+ output_location: '.output/public'
67
+ ###### End of Repository/Build Configurations ######
68
+ ```
69
+
70
+ That's it! Now Azure Static Web Apps will automatically deploy your Nitro-powered application on push.
71
+
72
+ If you are using runtimeConfig, you will likely want to configure the corresponding [environment variables on Azure](https://docs.microsoft.com/en-us/azure/static-web-apps/application-settings).
@@ -0,0 +1,33 @@
1
+ # Cleavr
2
+
3
+ > Deploy Nitro apps to Cleavr.
4
+
5
+ **Preset:** `cleavr`
6
+
7
+ <read-more></read-more>
8
+
9
+ <note>
10
+
11
+ Integration with this provider is possible with [zero configuration](/deploy/#zero-config-providers).
12
+ </note>
13
+
14
+ ## Set up your web app
15
+
16
+ In your project, set Nitro preset to `cleavr`.
17
+
18
+ ```js
19
+ export default {
20
+ nitro: {
21
+ preset: 'cleavr'
22
+ }
23
+ }
24
+ ```
25
+
26
+ Push changes to your code repository.
27
+
28
+ **In your Cleavr panel:**
29
+
30
+ 1. Provision a new server
31
+ 2. Add a website, selecting **Nuxt 3** as the app type
32
+ 3. In web app > settings > Code Repo, point to your project's code repository
33
+ You're now all set to deploy your project!