@depup/nitro 3.0.260311-beta-depup.0

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 (370) hide show
  1. package/LICENSE +27 -0
  2. package/README.md +32 -0
  3. package/changes.json +14 -0
  4. package/dist/THIRD-PARTY-LICENSES.md +1646 -0
  5. package/dist/_build/common.mjs +29361 -0
  6. package/dist/_build/rolldown.mjs +173 -0
  7. package/dist/_build/rollup.mjs +194 -0
  8. package/dist/_build/vite.build.mjs +18 -0
  9. package/dist/_chunks/nitro.mjs +1159 -0
  10. package/dist/_chunks/nitro2.mjs +102 -0
  11. package/dist/_chunks/nitro3.mjs +129 -0
  12. package/dist/_chunks/utils.mjs +272 -0
  13. package/dist/_common.mjs +35 -0
  14. package/dist/_dev.d.mts +12 -0
  15. package/dist/_dev.mjs +519 -0
  16. package/dist/_libs/_.mjs +3 -0
  17. package/dist/_libs/_2.mjs +2 -0
  18. package/dist/_libs/_3.mjs +3 -0
  19. package/dist/_libs/_4.mjs +2 -0
  20. package/dist/_libs/_5.mjs +3 -0
  21. package/dist/_libs/_6.mjs +4 -0
  22. package/dist/_libs/_7.mjs +5 -0
  23. package/dist/_libs/c12+rc9.mjs +812 -0
  24. package/dist/_libs/c12+readdirp+chokidar.d.mts +230 -0
  25. package/dist/_libs/citty.mjs +361 -0
  26. package/dist/_libs/commondir+is-reference.mjs +1311 -0
  27. package/dist/_libs/compatx.d.mts +47 -0
  28. package/dist/_libs/compatx.mjs +45 -0
  29. package/dist/_libs/esbuild.d.mts +20 -0
  30. package/dist/_libs/escape-string-regexp.mjs +7 -0
  31. package/dist/_libs/estree+pluginutils.d.mts +241 -0
  32. package/dist/_libs/estree-walker.mjs +184 -0
  33. package/dist/_libs/exsolve.d.mts +1 -0
  34. package/dist/_libs/hasown+resolve+deepmerge.mjs +1949 -0
  35. package/dist/_libs/httpxy.d.mts +82 -0
  36. package/dist/_libs/httpxy.mjs +671 -0
  37. package/dist/_libs/js-tokens.d.mts +1 -0
  38. package/dist/_libs/klona.mjs +37 -0
  39. package/dist/_libs/magic-string.d.mts +220 -0
  40. package/dist/_libs/mlly.d.mts +57 -0
  41. package/dist/_libs/nypm+tinyexec.mjs +845 -0
  42. package/dist/_libs/perfect-debounce.mjs +88 -0
  43. package/dist/_libs/pkg-types.d.mts +23 -0
  44. package/dist/_libs/plugin-alias.mjs +64 -0
  45. package/dist/_libs/plugin-inject.mjs +131 -0
  46. package/dist/_libs/plugin-json.mjs +34 -0
  47. package/dist/_libs/pluginutils.mjs +646 -0
  48. package/dist/_libs/readdirp+chokidar.mjs +1606 -0
  49. package/dist/_libs/remapping.mjs +115 -0
  50. package/dist/_libs/resolve-uri+gen-mapping.mjs +442 -0
  51. package/dist/_libs/rou3.d.mts +44 -0
  52. package/dist/_libs/rou3.mjs +496 -0
  53. package/dist/_libs/std-env.d.mts +12 -0
  54. package/dist/_libs/strip-literal.d.mts +1 -0
  55. package/dist/_libs/tsconfck.mjs +813 -0
  56. package/dist/_libs/ultrahtml.mjs +127 -0
  57. package/dist/_libs/unimport+unplugin.mjs +1684 -0
  58. package/dist/_libs/unplugin+unimport.d.mts +423 -0
  59. package/dist/_libs/unwasm.d.mts +29 -0
  60. package/dist/_presets.mjs +1759 -0
  61. package/dist/builder.d.mts +64 -0
  62. package/dist/builder.mjs +15 -0
  63. package/dist/cli/_chunks/build.mjs +47 -0
  64. package/dist/cli/_chunks/common.mjs +14 -0
  65. package/dist/cli/_chunks/deploy.mjs +40 -0
  66. package/dist/cli/_chunks/dev.mjs +62 -0
  67. package/dist/cli/_chunks/docs.mjs +30 -0
  68. package/dist/cli/_chunks/list.mjs +25 -0
  69. package/dist/cli/_chunks/prepare.mjs +17 -0
  70. package/dist/cli/_chunks/preview.mjs +51 -0
  71. package/dist/cli/_chunks/run.mjs +53 -0
  72. package/dist/cli/_chunks/task.mjs +14 -0
  73. package/dist/cli/index.d.mts +1 -0
  74. package/dist/cli/index.mjs +22 -0
  75. package/dist/node_modules/@poppinss/colors/build/index.js +139 -0
  76. package/dist/node_modules/@poppinss/colors/package.json +118 -0
  77. package/dist/node_modules/@poppinss/dumper/build/chunk-26HALFTP.js +602 -0
  78. package/dist/node_modules/@poppinss/dumper/build/formatters/console/main.js +441 -0
  79. package/dist/node_modules/@poppinss/dumper/build/formatters/html/main.js +725 -0
  80. package/dist/node_modules/@poppinss/dumper/package.json +122 -0
  81. package/dist/node_modules/@poppinss/exception/build/index.js +44 -0
  82. package/dist/node_modules/@poppinss/exception/package.json +109 -0
  83. package/dist/node_modules/@sindresorhus/is/distribution/index.js +1354 -0
  84. package/dist/node_modules/@sindresorhus/is/distribution/utilities.js +3 -0
  85. package/dist/node_modules/@sindresorhus/is/package.json +81 -0
  86. package/dist/node_modules/@speed-highlight/core/dist/index.js +4 -0
  87. package/dist/node_modules/@speed-highlight/core/dist/terminal.js +2 -0
  88. package/dist/node_modules/@speed-highlight/core/package.json +94 -0
  89. package/dist/node_modules/cookie-es/dist/index.mjs +262 -0
  90. package/dist/node_modules/cookie-es/package.json +37 -0
  91. package/dist/node_modules/croner/dist/croner.js +1 -0
  92. package/dist/node_modules/croner/package.json +73 -0
  93. package/dist/node_modules/defu/dist/defu.mjs +69 -0
  94. package/dist/node_modules/defu/package.json +43 -0
  95. package/dist/node_modules/destr/dist/index.mjs +72 -0
  96. package/dist/node_modules/destr/package.json +47 -0
  97. package/dist/node_modules/error-stack-parser-es/dist/index.mjs +38 -0
  98. package/dist/node_modules/error-stack-parser-es/dist/lite.mjs +167 -0
  99. package/dist/node_modules/error-stack-parser-es/package.json +83 -0
  100. package/dist/node_modules/get-port-please/dist/index.mjs +430 -0
  101. package/dist/node_modules/get-port-please/package.json +39 -0
  102. package/dist/node_modules/kleur/index.mjs +110 -0
  103. package/dist/node_modules/kleur/package.json +51 -0
  104. package/dist/node_modules/rendu/dist/index.mjs +380 -0
  105. package/dist/node_modules/rendu/package.json +47 -0
  106. package/dist/node_modules/scule/dist/index.mjs +80 -0
  107. package/dist/node_modules/scule/package.json +43 -0
  108. package/dist/node_modules/source-map/lib/array-set.js +100 -0
  109. package/dist/node_modules/source-map/lib/base64-vlq.js +94 -0
  110. package/dist/node_modules/source-map/lib/base64.js +19 -0
  111. package/dist/node_modules/source-map/lib/binary-search.js +113 -0
  112. package/dist/node_modules/source-map/lib/mapping-list.js +83 -0
  113. package/dist/node_modules/source-map/lib/mappings.wasm +0 -0
  114. package/dist/node_modules/source-map/lib/read-wasm.js +27 -0
  115. package/dist/node_modules/source-map/lib/source-map-consumer.js +1081 -0
  116. package/dist/node_modules/source-map/lib/source-map-generator.js +439 -0
  117. package/dist/node_modules/source-map/lib/source-node.js +430 -0
  118. package/dist/node_modules/source-map/lib/url.js +13 -0
  119. package/dist/node_modules/source-map/lib/util.js +444 -0
  120. package/dist/node_modules/source-map/lib/wasm.js +138 -0
  121. package/dist/node_modules/source-map/package.json +79 -0
  122. package/dist/node_modules/source-map/source-map.js +10 -0
  123. package/dist/node_modules/supports-color/index.js +202 -0
  124. package/dist/node_modules/supports-color/package.json +64 -0
  125. package/dist/node_modules/ufo/dist/index.mjs +645 -0
  126. package/dist/node_modules/ufo/package.json +48 -0
  127. package/dist/node_modules/unctx/dist/index.mjs +131 -0
  128. package/dist/node_modules/unctx/package.json +67 -0
  129. package/dist/node_modules/youch/build/helpers-B9BQYaS6.js +23 -0
  130. package/dist/node_modules/youch/build/index.js +212 -0
  131. package/dist/node_modules/youch/build/public/error_cause/style.css +5 -0
  132. package/dist/node_modules/youch/build/public/error_info/script.js +13 -0
  133. package/dist/node_modules/youch/build/public/error_info/style.css +145 -0
  134. package/dist/node_modules/youch/build/public/error_metadata/style.css +3 -0
  135. package/dist/node_modules/youch/build/public/error_stack/script.js +72 -0
  136. package/dist/node_modules/youch/build/public/error_stack/style.css +219 -0
  137. package/dist/node_modules/youch/build/public/error_stack_source/style.css +123 -0
  138. package/dist/node_modules/youch/build/public/header/script.js +14 -0
  139. package/dist/node_modules/youch/build/public/header/style.css +56 -0
  140. package/dist/node_modules/youch/build/public/layout/script.js +12 -0
  141. package/dist/node_modules/youch/build/public/layout/style.css +435 -0
  142. package/dist/node_modules/youch/build/public_dir-C5bujZKB.js +25 -0
  143. package/dist/node_modules/youch/build/src/templates/error_cause/main.js +44 -0
  144. package/dist/node_modules/youch/build/src/templates/error_info/main.js +72 -0
  145. package/dist/node_modules/youch/build/src/templates/error_metadata/main.js +65 -0
  146. package/dist/node_modules/youch/build/src/templates/error_stack/main.js +152 -0
  147. package/dist/node_modules/youch/build/src/templates/error_stack_source/main.js +46 -0
  148. package/dist/node_modules/youch/build/src/templates/header/main.js +24 -0
  149. package/dist/node_modules/youch/build/src/templates/layout/main.js +27 -0
  150. package/dist/node_modules/youch/package.json +135 -0
  151. package/dist/node_modules/youch-core/build/index.js +316 -0
  152. package/dist/node_modules/youch-core/package.json +124 -0
  153. package/dist/presets/_nitro/runtime/nitro-dev.mjs +20 -0
  154. package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +15 -0
  155. package/dist/presets/_nitro/runtime/service-worker.mjs +23 -0
  156. package/dist/presets/aws-amplify/runtime/aws-amplify.mjs +14 -0
  157. package/dist/presets/aws-lambda/runtime/_utils.mjs +116 -0
  158. package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +31 -0
  159. package/dist/presets/aws-lambda/runtime/aws-lambda.mjs +13 -0
  160. package/dist/presets/azure/runtime/_utils.mjs +50 -0
  161. package/dist/presets/azure/runtime/azure-swa.mjs +30 -0
  162. package/dist/presets/bun/runtime/bun.mjs +40 -0
  163. package/dist/presets/cloudflare/runtime/_module-handler.mjs +87 -0
  164. package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +72 -0
  165. package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +17 -0
  166. package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +39 -0
  167. package/dist/presets/cloudflare/runtime/plugin.dev.mjs +96 -0
  168. package/dist/presets/cloudflare/runtime/shims/workers.dev.mjs +27 -0
  169. package/dist/presets/deno/runtime/deno-deploy.mjs +19 -0
  170. package/dist/presets/deno/runtime/deno-server.mjs +39 -0
  171. package/dist/presets/netlify/runtime/netlify-edge.mjs +20 -0
  172. package/dist/presets/netlify/runtime/netlify.mjs +20 -0
  173. package/dist/presets/node/runtime/node-cluster.mjs +54 -0
  174. package/dist/presets/node/runtime/node-middleware.mjs +14 -0
  175. package/dist/presets/node/runtime/node-server.mjs +47 -0
  176. package/dist/presets/standard/runtime/server.mjs +4 -0
  177. package/dist/presets/stormkit/runtime/stormkit.mjs +27 -0
  178. package/dist/presets/vercel/runtime/cron-handler.mjs +25 -0
  179. package/dist/presets/vercel/runtime/isr.mjs +19 -0
  180. package/dist/presets/vercel/runtime/vercel.node.mjs +24 -0
  181. package/dist/presets/vercel/runtime/vercel.web.mjs +23 -0
  182. package/dist/presets/winterjs/runtime/winterjs.mjs +91 -0
  183. package/dist/presets/zeabur/runtime/zeabur.mjs +4 -0
  184. package/dist/presets/zephyr/runtime/server.mjs +3 -0
  185. package/dist/runtime/app.d.mts +1 -0
  186. package/dist/runtime/app.mjs +1 -0
  187. package/dist/runtime/cache.d.mts +1 -0
  188. package/dist/runtime/cache.mjs +1 -0
  189. package/dist/runtime/config.d.mts +3 -0
  190. package/dist/runtime/config.mjs +4 -0
  191. package/dist/runtime/context.d.mts +1 -0
  192. package/dist/runtime/context.mjs +1 -0
  193. package/dist/runtime/database.d.mts +1 -0
  194. package/dist/runtime/database.mjs +1 -0
  195. package/dist/runtime/internal/app.d.mts +16 -0
  196. package/dist/runtime/internal/app.mjs +208 -0
  197. package/dist/runtime/internal/cache.d.mts +7 -0
  198. package/dist/runtime/internal/cache.mjs +41 -0
  199. package/dist/runtime/internal/context.d.mts +14 -0
  200. package/dist/runtime/internal/context.mjs +24 -0
  201. package/dist/runtime/internal/database.d.mts +2 -0
  202. package/dist/runtime/internal/database.mjs +12 -0
  203. package/dist/runtime/internal/empty.mjs +0 -0
  204. package/dist/runtime/internal/error/dev.d.mts +10 -0
  205. package/dist/runtime/internal/error/dev.mjs +121 -0
  206. package/dist/runtime/internal/error/hooks.d.mts +1 -0
  207. package/dist/runtime/internal/error/hooks.mjs +9 -0
  208. package/dist/runtime/internal/error/prod.d.mts +6 -0
  209. package/dist/runtime/internal/error/prod.mjs +40 -0
  210. package/dist/runtime/internal/error/utils.d.mts +8 -0
  211. package/dist/runtime/internal/error/utils.mjs +3 -0
  212. package/dist/runtime/internal/meta.d.mts +2 -0
  213. package/dist/runtime/internal/meta.mjs +3 -0
  214. package/dist/runtime/internal/plugin.d.mts +3 -0
  215. package/dist/runtime/internal/plugin.mjs +4 -0
  216. package/dist/runtime/internal/route-rules.d.mts +9 -0
  217. package/dist/runtime/internal/route-rules.mjs +72 -0
  218. package/dist/runtime/internal/routes/dev-tasks.d.mts +3 -0
  219. package/dist/runtime/internal/routes/dev-tasks.mjs +25 -0
  220. package/dist/runtime/internal/routes/openapi.d.mts +3 -0
  221. package/dist/runtime/internal/routes/openapi.mjs +94 -0
  222. package/dist/runtime/internal/routes/renderer-template.d.mts +2 -0
  223. package/dist/runtime/internal/routes/renderer-template.dev.d.mts +3 -0
  224. package/dist/runtime/internal/routes/renderer-template.dev.mjs +19 -0
  225. package/dist/runtime/internal/routes/renderer-template.mjs +4 -0
  226. package/dist/runtime/internal/routes/scalar.d.mts +3 -0
  227. package/dist/runtime/internal/routes/scalar.mjs +193 -0
  228. package/dist/runtime/internal/routes/swagger.d.mts +3 -0
  229. package/dist/runtime/internal/routes/swagger.mjs +42 -0
  230. package/dist/runtime/internal/runtime-config.d.mts +9 -0
  231. package/dist/runtime/internal/runtime-config.mjs +54 -0
  232. package/dist/runtime/internal/static.d.mts +3 -0
  233. package/dist/runtime/internal/static.mjs +67 -0
  234. package/dist/runtime/internal/storage.d.mts +2 -0
  235. package/dist/runtime/internal/storage.mjs +6 -0
  236. package/dist/runtime/internal/task.d.mts +19 -0
  237. package/dist/runtime/internal/task.mjs +69 -0
  238. package/dist/runtime/internal/vite/dev-entry.mjs +18 -0
  239. package/dist/runtime/internal/vite/dev-worker.mjs +264 -0
  240. package/dist/runtime/internal/vite/ssr-renderer.mjs +6 -0
  241. package/dist/runtime/meta.d.mts +5 -0
  242. package/dist/runtime/meta.mjs +27 -0
  243. package/dist/runtime/nitro.d.mts +11 -0
  244. package/dist/runtime/nitro.mjs +34 -0
  245. package/dist/runtime/runtime-config.d.mts +1 -0
  246. package/dist/runtime/runtime-config.mjs +1 -0
  247. package/dist/runtime/storage.d.mts +1 -0
  248. package/dist/runtime/storage.mjs +1 -0
  249. package/dist/runtime/task.d.mts +1 -0
  250. package/dist/runtime/task.mjs +1 -0
  251. package/dist/runtime/virtual/_runtime_warn.d.mts +1 -0
  252. package/dist/runtime/virtual/_runtime_warn.mjs +5 -0
  253. package/dist/runtime/virtual/database.d.mts +8 -0
  254. package/dist/runtime/virtual/database.mjs +2 -0
  255. package/dist/runtime/virtual/error-handler.d.mts +6 -0
  256. package/dist/runtime/virtual/error-handler.mjs +9 -0
  257. package/dist/runtime/virtual/feature-flags.d.mts +7 -0
  258. package/dist/runtime/virtual/feature-flags.mjs +7 -0
  259. package/dist/runtime/virtual/plugins.d.mts +3 -0
  260. package/dist/runtime/virtual/plugins.mjs +2 -0
  261. package/dist/runtime/virtual/polyfills.d.mts +3 -0
  262. package/dist/runtime/virtual/polyfills.mjs +2 -0
  263. package/dist/runtime/virtual/public-assets.d.mts +9 -0
  264. package/dist/runtime/virtual/public-assets.mjs +8 -0
  265. package/dist/runtime/virtual/renderer-template.d.mts +4 -0
  266. package/dist/runtime/virtual/renderer-template.mjs +7 -0
  267. package/dist/runtime/virtual/routing-meta.d.mts +7 -0
  268. package/dist/runtime/virtual/routing-meta.mjs +2 -0
  269. package/dist/runtime/virtual/routing.d.mts +8 -0
  270. package/dist/runtime/virtual/routing.mjs +11 -0
  271. package/dist/runtime/virtual/runtime-config.d.mts +3 -0
  272. package/dist/runtime/virtual/runtime-config.mjs +5 -0
  273. package/dist/runtime/virtual/server-assets.d.mts +7 -0
  274. package/dist/runtime/virtual/server-assets.mjs +12 -0
  275. package/dist/runtime/virtual/storage.d.mts +3 -0
  276. package/dist/runtime/virtual/storage.mjs +5 -0
  277. package/dist/runtime/virtual/tasks.d.mts +10 -0
  278. package/dist/runtime/virtual/tasks.mjs +3 -0
  279. package/dist/runtime/vite.d.mts +8 -0
  280. package/dist/runtime/vite.mjs +9 -0
  281. package/dist/types/index.d.mts +3010 -0
  282. package/dist/types/index.mjs +1 -0
  283. package/dist/vite.d.mts +52 -0
  284. package/dist/vite.mjs +740 -0
  285. package/lib/h3.d.mts +1 -0
  286. package/lib/h3.mjs +1 -0
  287. package/lib/tsconfig.json +27 -0
  288. package/lib/vite.types.d.mts +26 -0
  289. package/lib/vite.types.mjs +2 -0
  290. package/package.json +256 -0
  291. package/skills/nitro/SKILL.md +10 -0
  292. package/skills/nitro/docs/TOC.md +83 -0
  293. package/skills/nitro/docs/_navigation.json +679 -0
  294. package/skills/nitro/docs/config/index.md +1147 -0
  295. package/skills/nitro/docs/deploy/index.md +64 -0
  296. package/skills/nitro/docs/deploy/providers/alwaysdata.md +50 -0
  297. package/skills/nitro/docs/deploy/providers/aws-amplify.md +81 -0
  298. package/skills/nitro/docs/deploy/providers/aws.md +47 -0
  299. package/skills/nitro/docs/deploy/providers/azure.md +72 -0
  300. package/skills/nitro/docs/deploy/providers/cleavr.md +33 -0
  301. package/skills/nitro/docs/deploy/providers/cloudflare.md +375 -0
  302. package/skills/nitro/docs/deploy/providers/deno-deploy.md +66 -0
  303. package/skills/nitro/docs/deploy/providers/digitalocean.md +46 -0
  304. package/skills/nitro/docs/deploy/providers/firebase.md +32 -0
  305. package/skills/nitro/docs/deploy/providers/flightcontrol.md +67 -0
  306. package/skills/nitro/docs/deploy/providers/genezio.md +67 -0
  307. package/skills/nitro/docs/deploy/providers/github-pages.md +68 -0
  308. package/skills/nitro/docs/deploy/providers/gitlab-pages.md +37 -0
  309. package/skills/nitro/docs/deploy/providers/heroku.md +84 -0
  310. package/skills/nitro/docs/deploy/providers/iis.md +38 -0
  311. package/skills/nitro/docs/deploy/providers/koyeb.md +109 -0
  312. package/skills/nitro/docs/deploy/providers/netlify.md +47 -0
  313. package/skills/nitro/docs/deploy/providers/platform-sh.md +37 -0
  314. package/skills/nitro/docs/deploy/providers/render.md +37 -0
  315. package/skills/nitro/docs/deploy/providers/stormkit.md +24 -0
  316. package/skills/nitro/docs/deploy/providers/vercel.md +179 -0
  317. package/skills/nitro/docs/deploy/providers/zeabur.md +19 -0
  318. package/skills/nitro/docs/deploy/providers/zephyr.md +99 -0
  319. package/skills/nitro/docs/deploy/providers/zerops.md +102 -0
  320. package/skills/nitro/docs/deploy/runtimes/bun.md +15 -0
  321. package/skills/nitro/docs/deploy/runtimes/deno.md +19 -0
  322. package/skills/nitro/docs/deploy/runtimes/node.md +63 -0
  323. package/skills/nitro/docs/docs/assets.md +166 -0
  324. package/skills/nitro/docs/docs/cache.md +408 -0
  325. package/skills/nitro/docs/docs/configuration.md +256 -0
  326. package/skills/nitro/docs/docs/database.md +185 -0
  327. package/skills/nitro/docs/docs/index.md +56 -0
  328. package/skills/nitro/docs/docs/lifecycle.md +204 -0
  329. package/skills/nitro/docs/docs/migration.md +215 -0
  330. package/skills/nitro/docs/docs/nightly.md +31 -0
  331. package/skills/nitro/docs/docs/plugins.md +164 -0
  332. package/skills/nitro/docs/docs/quick-start.md +110 -0
  333. package/skills/nitro/docs/docs/renderer.md +322 -0
  334. package/skills/nitro/docs/docs/routing.md +711 -0
  335. package/skills/nitro/docs/docs/server-entry.md +239 -0
  336. package/skills/nitro/docs/docs/storage.md +261 -0
  337. package/skills/nitro/docs/docs/tasks.md +277 -0
  338. package/skills/nitro/docs/examples/api-routes.md +145 -0
  339. package/skills/nitro/docs/examples/auto-imports.md +93 -0
  340. package/skills/nitro/docs/examples/cached-handler.md +81 -0
  341. package/skills/nitro/docs/examples/custom-error-handler.md +98 -0
  342. package/skills/nitro/docs/examples/database.md +157 -0
  343. package/skills/nitro/docs/examples/elysia.md +70 -0
  344. package/skills/nitro/docs/examples/express.md +78 -0
  345. package/skills/nitro/docs/examples/fastify.md +79 -0
  346. package/skills/nitro/docs/examples/hello-world.md +68 -0
  347. package/skills/nitro/docs/examples/hono.md +74 -0
  348. package/skills/nitro/docs/examples/import-alias.md +100 -0
  349. package/skills/nitro/docs/examples/index.md +3 -0
  350. package/skills/nitro/docs/examples/middleware.md +91 -0
  351. package/skills/nitro/docs/examples/mono-jsx.md +68 -0
  352. package/skills/nitro/docs/examples/nano-jsx.md +70 -0
  353. package/skills/nitro/docs/examples/plugins.md +91 -0
  354. package/skills/nitro/docs/examples/renderer.md +113 -0
  355. package/skills/nitro/docs/examples/runtime-config.md +97 -0
  356. package/skills/nitro/docs/examples/server-fetch.md +87 -0
  357. package/skills/nitro/docs/examples/shiki.md +198 -0
  358. package/skills/nitro/docs/examples/virtual-routes.md +74 -0
  359. package/skills/nitro/docs/examples/vite-nitro-plugin.md +79 -0
  360. package/skills/nitro/docs/examples/vite-rsc.md +1041 -0
  361. package/skills/nitro/docs/examples/vite-ssr-html.md +217 -0
  362. package/skills/nitro/docs/examples/vite-ssr-preact.md +247 -0
  363. package/skills/nitro/docs/examples/vite-ssr-react.md +226 -0
  364. package/skills/nitro/docs/examples/vite-ssr-solid.md +256 -0
  365. package/skills/nitro/docs/examples/vite-ssr-tsr-react.md +442 -0
  366. package/skills/nitro/docs/examples/vite-ssr-tss-react.md +444 -0
  367. package/skills/nitro/docs/examples/vite-ssr-vue-router.md +616 -0
  368. package/skills/nitro/docs/examples/vite-trpc.md +335 -0
  369. package/skills/nitro/docs/examples/websocket.md +282 -0
  370. package/skills/nitro/docs/index.md +121 -0
@@ -0,0 +1,1147 @@
1
+ # Config
2
+
3
+ <read-more></read-more>
4
+
5
+ ## General
6
+
7
+ ### `preset`
8
+
9
+ Use `preset` option or `NITRO_PRESET` environment variable for custom **production** preset.
10
+
11
+ Preset for development mode is always `nitro_dev` and default `node_server` for production building a standalone Node.js server.
12
+
13
+ The preset will automatically be detected when the `preset` option is not set and running in known environments.
14
+
15
+ ```ts
16
+ export default defineNitroConfig({
17
+ preset: "cloudflare_pages", // deploy to Cloudflare Pages
18
+ });
19
+ ```
20
+
21
+ ### `debug`
22
+
23
+ - Default: `false` (`true` when `DEBUG` environment variable is set)
24
+ Enable debug mode for verbose logging and additional development information.
25
+
26
+ ```ts
27
+ export default defineNitroConfig({
28
+ debug: true,
29
+ });
30
+ ```
31
+
32
+ ### `logLevel`
33
+
34
+ - Default: `3` (`1` when the testing environment is detected)
35
+ Log verbosity level. See [consola](https://github.com/unjs/consola?tab=readme-ov-file#log-level) for more information.
36
+
37
+ ```ts
38
+ export default defineNitroConfig({
39
+ logLevel: 4, // verbose logging
40
+ });
41
+ ```
42
+
43
+ ### `runtimeConfig`
44
+
45
+ - Default: `{ nitro: { ... }, ...yourOptions }`
46
+ Server runtime configuration.
47
+
48
+ **Note:** `nitro` namespace is reserved.
49
+
50
+ ```ts
51
+ export default defineNitroConfig({
52
+ runtimeConfig: {
53
+ apiSecret: "default-secret", // override with NITRO_API_SECRET
54
+ },
55
+ });
56
+ ```
57
+
58
+ ### `compatibilityDate`
59
+
60
+ Deployment providers introduce new features that Nitro presets can leverage, but some of them need to be explicitly opted into.
61
+
62
+ Set it to latest tested date in `YYYY-MM-DD` format to leverage latest preset features.
63
+
64
+ If this configuration is not provided, Nitro will use `"latest"` behavior by default.
65
+
66
+ ```ts
67
+ export default defineNitroConfig({
68
+ compatibilityDate: "2025-01-01",
69
+ });
70
+ ```
71
+
72
+ ### `static`
73
+
74
+ - Default: `false`
75
+ Enable static site generation mode.
76
+
77
+ ```ts
78
+ export default defineNitroConfig({
79
+ static: true, // prerender all routes
80
+ });
81
+ ```
82
+
83
+ ## Features
84
+
85
+ ### `features`
86
+
87
+ - Default: `{}`
88
+ Enable built-in features.
89
+
90
+ #### `runtimeHooks`
91
+
92
+ - Default: auto-detected (enabled if there is at least one nitro plugin)
93
+ Enable runtime hooks for request and response.
94
+
95
+ #### `websocket`
96
+
97
+ - Default: `false`
98
+ Enable WebSocket support.
99
+
100
+ ```ts
101
+ export default defineNitroConfig({
102
+ features: {
103
+ runtimeHooks: true,
104
+ websocket: true, // enable WebSocket support
105
+ },
106
+ });
107
+ ```
108
+
109
+ ### `experimental`
110
+
111
+ - Default: `{}`
112
+ Enable experimental features.
113
+
114
+ #### `openAPI`
115
+
116
+ - Default: `false`
117
+ Enable `/_scalar`, `/_swagger` and `/_openapi.json` endpoints.
118
+
119
+ <note>
120
+
121
+ Prefer using the top-level [`openAPI`](#openapi) option for configuration.
122
+ </note>
123
+
124
+ #### `typescriptBundlerResolution`
125
+
126
+ Enable TypeScript bundler module resolution. See [TypeScript#51669](https://github.com/microsoft/TypeScript/pull/51669).
127
+
128
+ #### `asyncContext`
129
+
130
+ Enable native async context support for `useRequest()`.
131
+
132
+ #### `sourcemapMinify`
133
+
134
+ Set to `false` to disable experimental sourcemap minification.
135
+
136
+ #### `envExpansion`
137
+
138
+ Allow env expansion in runtime config. See [#2043](https://github.com/nitrojs/nitro/pull/2043).
139
+
140
+ #### `database`
141
+
142
+ Enable experimental database support. See [Database](/docs/database).
143
+
144
+ #### `tasks`
145
+
146
+ Enable experimental tasks support. See [Tasks](/docs/tasks).
147
+
148
+ #### `tsconfigPaths`
149
+
150
+ - Default: `true`
151
+ Infer path aliases from `tsconfig.json`.
152
+
153
+ ```ts
154
+ export default defineNitroConfig({
155
+ experimental: {
156
+ typescriptBundlerResolution: true,
157
+ asyncContext: true,
158
+ envExpansion: true,
159
+ database: true,
160
+ tasks: true,
161
+ },
162
+ });
163
+ ```
164
+
165
+ ### `openAPI`
166
+
167
+ Top-level OpenAPI configuration.
168
+
169
+ You can pass an object to modify your OpenAPI specification:
170
+
171
+ ```js
172
+ openAPI: {
173
+ meta: {
174
+ title: 'My Awesome Project',
175
+ description: 'This might become the next big thing.',
176
+ version: '1.0'
177
+ }
178
+ }
179
+ ```
180
+
181
+ These routes are disabled by default in production. To enable them, use the `production` key.
182
+ `"runtime"` allows middleware usage, and `"prerender"` is the most efficient because the JSON response is constant.
183
+
184
+ ```js
185
+ openAPI: {
186
+ // IMPORTANT: make sure to protect OpenAPI routes if necessary!
187
+ production: "runtime", // or "prerender"
188
+ }
189
+ ```
190
+
191
+ If you like to customize the Scalar integration, you can [pass a configuration object](https://github.com/scalar/scalar) like this:
192
+
193
+ ```js
194
+ openAPI: {
195
+ ui: {
196
+ scalar: {
197
+ theme: 'purple'
198
+ }
199
+ }
200
+ }
201
+ ```
202
+
203
+ Or if you want to customize the endpoints:
204
+
205
+ ```js
206
+ openAPI: {
207
+ route: "/_docs/openapi.json",
208
+ ui: {
209
+ scalar: {
210
+ route: "/_docs/scalar"
211
+ },
212
+ swagger: {
213
+ route: "/_docs/swagger"
214
+ }
215
+ }
216
+ }
217
+ ```
218
+
219
+ ### `future`
220
+
221
+ - Default: `{}`
222
+ New features pending for a major version to avoid breaking changes.
223
+
224
+ #### `nativeSWR`
225
+
226
+ Uses built-in SWR functionality (using caching layer and storage) for Netlify and Vercel presets instead of falling back to ISR behavior.
227
+
228
+ ```ts
229
+ export default defineNitroConfig({
230
+ future: {
231
+ nativeSWR: true,
232
+ },
233
+ });
234
+ ```
235
+
236
+ ### `storage`
237
+
238
+ - Default: `{}`
239
+ Storage configuration, read more in the [Storage Layer](/docs/storage) section.
240
+
241
+ ```ts
242
+ export default defineNitroConfig({
243
+ storage: {
244
+ redis: {
245
+ driver: "redis",
246
+ url: "redis://localhost:6379",
247
+ },
248
+ },
249
+ });
250
+ ```
251
+
252
+ ### `devStorage`
253
+
254
+ - Default: `{}`
255
+ Storage configuration overrides for development mode.
256
+
257
+ ```ts
258
+ export default defineNitroConfig({
259
+ devStorage: {
260
+ redis: {
261
+ driver: "fs",
262
+ base: "./data/redis", // use filesystem in development
263
+ },
264
+ },
265
+ });
266
+ ```
267
+
268
+ ### `database`
269
+
270
+ Database connection configurations. Requires `experimental.database: true`.
271
+
272
+ ```ts
273
+ database: {
274
+ default: {
275
+ connector: "sqlite",
276
+ options: { name: "db" }
277
+ }
278
+ }
279
+ ```
280
+
281
+ ### `devDatabase`
282
+
283
+ Database connection configuration overrides for development mode.
284
+
285
+ ```ts
286
+ export default defineNitroConfig({
287
+ devDatabase: {
288
+ default: {
289
+ connector: "sqlite",
290
+ options: { name: "db-dev" }, // separate dev database
291
+ },
292
+ },
293
+ });
294
+ ```
295
+
296
+ ### `renderer`
297
+
298
+ - Type: `false` | `{ handler?: string, static?: boolean, template?: string }`
299
+ Points to main render entry (file should export an event handler as default).
300
+
301
+ ```ts
302
+ export default defineNitroConfig({
303
+ renderer: {
304
+ handler: "~/renderer", // path to the render handler
305
+ },
306
+ });
307
+ ```
308
+
309
+ ### `serveStatic`
310
+
311
+ - Type: `boolean` | `'node'` | `'deno'` | `'inline'`
312
+ - Default: depends on the deployment preset used.
313
+ Serve `public/` assets in production.
314
+
315
+ **Note:** It is highly recommended that your edge CDN (Nginx, Apache, Cloud) serves the `.output/public/` directory instead to enable compression and higher level caching.
316
+
317
+ ```ts
318
+ export default defineNitroConfig({
319
+ serveStatic: "node", // serve static assets using Node.js
320
+ });
321
+ ```
322
+
323
+ ### `noPublicDir`
324
+
325
+ - Default: `false`
326
+ If enabled, disables `.output/public` directory creation. Skips copying `public/` dir and also disables pre-rendering.
327
+
328
+ ```ts
329
+ export default defineNitroConfig({
330
+ noPublicDir: true, // skip public directory output
331
+ });
332
+ ```
333
+
334
+ ### `publicAssets`
335
+
336
+ Public asset directories to serve in development and bundle in production.
337
+
338
+ If a `public/` directory is detected, it will be added by default, but you can add more by yourself too!
339
+
340
+ It's possible to set Cache-Control headers for assets using the `maxAge` option:
341
+
342
+ ```ts
343
+ publicAssets: [
344
+ {
345
+ baseURL: "images",
346
+ dir: "public/images",
347
+ maxAge: 60 * 60 * 24 * 7, // 7 days
348
+ },
349
+ ],
350
+ ```
351
+
352
+ The config above generates the following header in the assets under `public/images/` folder:
353
+
354
+ `cache-control: public, max-age=604800, immutable`
355
+
356
+ The `dir` option is where your files live on your file system; the `baseURL` option is the folder they will be accessible from when served/bundled.
357
+
358
+ ### `compressPublicAssets`
359
+
360
+ - Default: `{ gzip: false, brotli: false, zstd: false }`
361
+ If enabled, Nitro will generate a pre-compressed (gzip, brotli, and/or zstd) version of supported types of public assets and prerendered routes
362
+ larger than 1024 bytes into the public directory. Default compression levels are used. Using this option you can support zero overhead asset compression without using a CDN.
363
+
364
+ ```ts
365
+ export default defineNitroConfig({
366
+ compressPublicAssets: {
367
+ gzip: true,
368
+ brotli: true, // enable gzip and brotli pre-compression
369
+ },
370
+ });
371
+ ```
372
+
373
+ ### `serverAssets`
374
+
375
+ Assets can be accessed in server logic and bundled in production. [Read more](/docs/assets#server-assets).
376
+
377
+ ```ts
378
+ export default defineNitroConfig({
379
+ serverAssets: [
380
+ {
381
+ baseName: "templates",
382
+ dir: "./templates", // bundle templates/ as server assets
383
+ },
384
+ ],
385
+ });
386
+ ```
387
+
388
+ ### `modules`
389
+
390
+ - Default: `[]`
391
+ An array of Nitro modules. Modules can be a string (path), a module object with a `setup` function, or a function.
392
+
393
+ ```ts
394
+ export default defineNitroConfig({
395
+ modules: [
396
+ "./modules/my-module.ts",
397
+ (nitro) => {
398
+ nitro.hooks.hook("compiled", () => { /* ... */ });
399
+ },
400
+ ],
401
+ });
402
+ ```
403
+
404
+ ### `plugins`
405
+
406
+ - Default: `[]`
407
+ An array of paths to nitro plugins. They will be executed by order on the first initialization.
408
+
409
+ Note that Nitro auto-registers the plugins in the `plugins/` directory, [learn more](/docs/plugins).
410
+
411
+ ```ts
412
+ export default defineNitroConfig({
413
+ plugins: [
414
+ "~/plugins/my-plugin.ts",
415
+ ],
416
+ });
417
+ ```
418
+
419
+ ### `tasks`
420
+
421
+ - Default: `{}`
422
+ Task definitions. Each key is a task name with a `handler` path and optional `description`.
423
+
424
+ ```ts
425
+ tasks: {
426
+ 'db:migrate': {
427
+ handler: './tasks/db-migrate',
428
+ description: 'Run database migrations'
429
+ }
430
+ }
431
+ ```
432
+
433
+ ### `scheduledTasks`
434
+
435
+ - Default: `{}`
436
+ Map of cron expressions to task name(s).
437
+
438
+ ```ts
439
+ scheduledTasks: {
440
+ '0 * * * *': 'cleanup:temp',
441
+ '*/5 * * * *': ['health:check', 'metrics:collect']
442
+ }
443
+ ```
444
+
445
+ ### `imports`
446
+
447
+ - Default: `false`
448
+ Auto import options. Set to an object to enable. See [unimport](https://github.com/unjs/unimport) for more information.
449
+
450
+ ```ts
451
+ export default defineNitroConfig({
452
+ imports: {
453
+ dirs: ["./utils"], // auto-import from utils/ directory
454
+ },
455
+ });
456
+ ```
457
+
458
+ ### `virtual`
459
+
460
+ - Default: `{}`
461
+ A map from dynamic virtual import names to their contents or an (async) function that returns it.
462
+
463
+ ```ts
464
+ export default defineNitroConfig({
465
+ virtual: {
466
+ "#config": `export default { version: "1.0.0" }`,
467
+ },
468
+ });
469
+ ```
470
+
471
+ ### `ignore`
472
+
473
+ - Default: `[]`
474
+ Array of glob patterns to ignore when scanning directories.
475
+
476
+ ```ts
477
+ export default defineNitroConfig({
478
+ ignore: [
479
+ "routes/_legacy/**", // skip legacy route handlers
480
+ ],
481
+ });
482
+ ```
483
+
484
+ ### `wasm`
485
+
486
+ - Default: `{}`
487
+ - Type: `false` | `UnwasmPluginOptions`
488
+ WASM support configuration. See [unwasm](https://github.com/unjs/unwasm) for options.
489
+
490
+ ```ts
491
+ export default defineNitroConfig({
492
+ wasm: {}, // enable WASM import support
493
+ });
494
+ ```
495
+
496
+ ## Dev
497
+
498
+ ### `devServer`
499
+
500
+ - Default: `{ watch: [] }`
501
+ Dev server options. You can use `watch` to make the dev server reload if any file changes in specified paths.
502
+
503
+ Supports `port`, `hostname`, `watch`, and `runner` options.
504
+
505
+ ```ts
506
+ export default defineNitroConfig({
507
+ devServer: {
508
+ port: 3001,
509
+ watch: ["./server/plugins"],
510
+ },
511
+ });
512
+ ```
513
+
514
+ ### `watchOptions`
515
+
516
+ Watch options for development mode. See [chokidar](https://github.com/paulmillr/chokidar) for more information.
517
+
518
+ ```ts
519
+ export default defineNitroConfig({
520
+ watchOptions: {
521
+ ignored: ["**/node_modules/**", "**/dist/**"],
522
+ },
523
+ });
524
+ ```
525
+
526
+ ### `devProxy`
527
+
528
+ Proxy configuration for development server.
529
+
530
+ You can use this option to override development server routes and proxy-pass requests.
531
+
532
+ ```js
533
+ {
534
+ devProxy: {
535
+ '/proxy/test': 'http://localhost:3001',
536
+ '/proxy/example': { target: 'https://example.com', changeOrigin: true }
537
+ }
538
+ }
539
+ ```
540
+
541
+ See [httpxy](https://github.com/unjs/httpxy) for all available target options.
542
+
543
+ ## Logging
544
+
545
+ ### `logging`
546
+
547
+ - Default: `{ compressedSizes: true, buildSuccess: true }`
548
+ Control build logging behavior. Set `compressedSizes` to `false` to skip reporting compressed bundle sizes. Set `buildSuccess` to `false` to suppress the build success message.
549
+
550
+ ```ts
551
+ export default defineNitroConfig({
552
+ logging: {
553
+ compressedSizes: false, // skip compressed size reporting
554
+ buildSuccess: false,
555
+ },
556
+ });
557
+ ```
558
+
559
+ ## Routing
560
+
561
+ ### `baseURL`
562
+
563
+ Default: `/` (or `NITRO_APP_BASE_URL` environment variable if provided)
564
+
565
+ Server's main base URL.
566
+
567
+ ```ts
568
+ export default defineNitroConfig({
569
+ baseURL: "/app/", // serve app under /app/ prefix
570
+ });
571
+ ```
572
+
573
+ ### `apiBaseURL`
574
+
575
+ - Default: `/api`
576
+ Changes the default API base URL prefix.
577
+
578
+ ```ts
579
+ export default defineNitroConfig({
580
+ apiBaseURL: "/server/api", // api routes under /server/api/
581
+ });
582
+ ```
583
+
584
+ ### `handlers`
585
+
586
+ Server handlers and routes.
587
+
588
+ If `routes/`, `api/` or `middleware/` directories exist inside the server directory, they will be automatically added to the handlers array.
589
+
590
+ ```ts
591
+ export default defineNitroConfig({
592
+ handlers: [
593
+ { route: "/health", handler: "./handlers/health.ts" },
594
+ { route: "/admin/**", handler: "./handlers/admin.ts", method: "get" },
595
+ ],
596
+ });
597
+ ```
598
+
599
+ ### `devHandlers`
600
+
601
+ Regular handlers refer to the path of handlers to be imported and transformed by the bundler.
602
+
603
+ There are situations in that we directly want to provide a handler instance with programmatic usage.
604
+
605
+ We can use `devHandlers` but note that they are **only available in development mode** and **not in production build**.
606
+
607
+ ```ts
608
+ export default defineNitroConfig({
609
+ devHandlers: [
610
+ { route: "/__dev", handler: eventHandler(() => "dev-only route") },
611
+ ],
612
+ });
613
+ ```
614
+
615
+ ### `routes`
616
+
617
+ - Default: `{}`
618
+ Inline route definitions. A map from route pattern to handler path or handler options.
619
+
620
+ ```ts
621
+ export default defineNitroConfig({
622
+ routes: {
623
+ "/hello": "./routes/hello.ts",
624
+ "/greet": { handler: "./routes/greet.ts", method: "post" },
625
+ },
626
+ });
627
+ ```
628
+
629
+ ### `errorHandler`
630
+
631
+ - Type: `string` | `string[]`
632
+ Path(s) to custom runtime error handler(s). Replaces nitro's built-in error page.
633
+
634
+ **Example:**
635
+
636
+ ```js [nitro.config]
637
+ import { defineNitroConfig } from "nitro/config";
638
+
639
+ export default defineNitroConfig({
640
+ errorHandler: "~/error",
641
+ });
642
+ ```
643
+
644
+ ```js [error.ts]
645
+ export default defineNitroErrorHandler((error, event) => {
646
+ return new Response('[custom error handler] ' + error.stack, {
647
+ headers: { 'Content-Type': 'text/plain' }
648
+ });
649
+ });
650
+ ```
651
+
652
+ ### `routeRules`
653
+
654
+ **🧪 Experimental!**
655
+
656
+ Route options. It is a map from route pattern (following [rou3](https://github.com/h3js/rou3)) to route options.
657
+
658
+ When `cache` option is set, handlers matching pattern will be automatically wrapped with `defineCachedEventHandler`.
659
+
660
+ See the [Cache API](/docs/cache) for all available cache options.
661
+
662
+ <note>
663
+
664
+ `swr: true|number` is shortcut for `cache: { swr: true, maxAge: number }`
665
+ </note>
666
+
667
+ **Example:**
668
+
669
+ ```js
670
+ routeRules: {
671
+ '/blog/**': { swr: true },
672
+ '/blog/**': { swr: 600 },
673
+ '/blog/**': { static: true },
674
+ '/blog/**': { cache: { /* cache options*/ } },
675
+ '/assets/**': { headers: { 'cache-control': 's-maxage=0' } },
676
+ '/api/v1/**': { cors: true, headers: { 'access-control-allow-methods': 'GET' } },
677
+ '/old-page': { redirect: '/new-page' }, // uses status code 307 (Temporary Redirect)
678
+ '/old-page2': { redirect: { to:'/new-page2', statusCode: 301 } },
679
+ '/old-page/**': { redirect: '/new-page/**' },
680
+ '/proxy/example': { proxy: 'https://example.com' },
681
+ '/proxy/**': { proxy: '/api/**' },
682
+ '/admin/**': { basicAuth: { username: 'admin', password: 'secret' } },
683
+ }
684
+ ```
685
+
686
+ ### `prerender`
687
+
688
+ Default:
689
+
690
+ ```ts
691
+ {
692
+ autoSubfolderIndex: true,
693
+ concurrency: 1,
694
+ interval: 0,
695
+ failOnError: false,
696
+ crawlLinks: false,
697
+ ignore: [],
698
+ routes: [],
699
+ retry: 3,
700
+ retryDelay: 500
701
+ }
702
+ ```
703
+
704
+ Prerendered options. Any route specified will be fetched during the build and copied to the `.output/public` directory as a static asset.
705
+
706
+ Any route (string) that starts with a prefix listed in `ignore` or matches a regular expression or function will be ignored.
707
+
708
+ If `crawlLinks` option is set to `true`, nitro starts with `/` by default (or all routes in `routes` array) and for HTML pages extracts `<a>` tags and prerender them as well.
709
+
710
+ You can set `failOnError` option to `true` to stop the CI when Nitro could not prerender a route.
711
+
712
+ The `interval` and `concurrency` options lets you control the speed of pre-rendering, can be useful to avoid hitting some rate-limit if you call external APIs.
713
+
714
+ Set `autoSubfolderIndex` lets you control how to generate the files in the `.output/public` directory:
715
+
716
+ ```bash
717
+ # autoSubfolderIndex: true (default)
718
+ /about -> .output/public/about/index.html
719
+ # autoSubfolderIndex: false
720
+ /about -> .output/public/about.html
721
+ ```
722
+
723
+ This option is useful when your hosting provider does not give you an option regarding the trailing slash.
724
+
725
+ The prerenderer will attempt to render pages 3 times with a delay of 500ms. Use `retry` and `retryDelay` to change this behavior.
726
+
727
+ ## Directories
728
+
729
+ ### `workspaceDir`
730
+
731
+ Project workspace root directory.
732
+
733
+ The workspace (e.g. pnpm workspace) directory is automatically detected when the `workspaceDir` option is not set.
734
+
735
+ ```ts
736
+ export default defineNitroConfig({
737
+ workspaceDir: "../", // monorepo root
738
+ });
739
+ ```
740
+
741
+ ### `rootDir`
742
+
743
+ Project main directory.
744
+
745
+ ```ts
746
+ export default defineNitroConfig({
747
+ rootDir: "./src/server",
748
+ });
749
+ ```
750
+
751
+ ### `serverDir`
752
+
753
+ - Default: `false`
754
+ - Type: `boolean` | `"./"` | `"./server"` | `string`
755
+ Server directory for scanning `api/`, `routes/`, `plugins/`, `utils/`, `middleware/`, `assets/`, and `tasks/` folders.
756
+
757
+ When set to `false`, automatic directory scanning is disabled. Set to `"./"` to use the root directory, or `"./server"` to use a `server/` subdirectory.
758
+
759
+ ```ts
760
+ export default defineNitroConfig({
761
+ serverDir: "./server", // scan server/ subdirectory
762
+ });
763
+ ```
764
+
765
+ ### `scanDirs`
766
+
767
+ - Default: (source directory when empty array)
768
+ List of directories to scan and auto-register files, such as API routes.
769
+
770
+ ```ts
771
+ export default defineNitroConfig({
772
+ scanDirs: ["./modules/auth/api", "./modules/billing/api"],
773
+ });
774
+ ```
775
+
776
+ ### `apiDir`
777
+
778
+ - Default: `api`
779
+ Defines a different directory to scan for api route handlers.
780
+
781
+ ```ts
782
+ export default defineNitroConfig({
783
+ apiDir: "endpoints", // scan endpoints/ instead of api/
784
+ });
785
+ ```
786
+
787
+ ### `routesDir`
788
+
789
+ - Default: `routes`
790
+ Defines a different directory to scan for route handlers.
791
+
792
+ ```ts
793
+ export default defineNitroConfig({
794
+ routesDir: "pages", // scan pages/ instead of routes/
795
+ });
796
+ ```
797
+
798
+ ### `buildDir`
799
+
800
+ - Default: `node_modules/.nitro`
801
+ Nitro's temporary working directory for generating build-related files.
802
+
803
+ ```ts
804
+ export default defineNitroConfig({
805
+ buildDir: ".nitro", // use .nitro/ in project root
806
+ });
807
+ ```
808
+
809
+ ### `output`
810
+
811
+ - Default: `{ dir: '.output', serverDir: '.output/server', publicDir: '.output/public' }`
812
+ Output directories for production bundle.
813
+
814
+ ```ts
815
+ export default defineNitroConfig({
816
+ output: {
817
+ dir: "dist",
818
+ serverDir: "dist/server",
819
+ publicDir: "dist/public",
820
+ },
821
+ });
822
+ ```
823
+
824
+ ## Build
825
+
826
+ ### `builder`
827
+
828
+ - Type: `"rollup"` | `"rolldown"` | `"vite"`
829
+ - Default: `undefined` (auto-detected)
830
+ Specify the bundler to use for building.
831
+
832
+ ```ts
833
+ export default defineNitroConfig({
834
+ builder: "vite",
835
+ });
836
+ ```
837
+
838
+ ### `rollupConfig`
839
+
840
+ Additional rollup configuration.
841
+
842
+ ```ts
843
+ export default defineNitroConfig({
844
+ rollupConfig: {
845
+ output: { manualChunks: { vendor: ["lodash-es"] } },
846
+ },
847
+ });
848
+ ```
849
+
850
+ ### `rolldownConfig`
851
+
852
+ Additional rolldown configuration.
853
+
854
+ ```ts
855
+ export default defineNitroConfig({
856
+ rolldownConfig: {
857
+ output: { banner: "/* built with nitro */" },
858
+ },
859
+ });
860
+ ```
861
+
862
+ ### `entry`
863
+
864
+ Bundler entry point.
865
+
866
+ ```ts
867
+ export default defineNitroConfig({
868
+ entry: "./server/entry.ts", // custom entry file
869
+ });
870
+ ```
871
+
872
+ ### `unenv`
873
+
874
+ [unenv](https://github.com/unjs/unenv/) preset(s) for environment compatibility.
875
+
876
+ ```ts
877
+ export default defineNitroConfig({
878
+ unenv: {
879
+ alias: { "my-module": "my-module/web" },
880
+ },
881
+ });
882
+ ```
883
+
884
+ ### `alias`
885
+
886
+ Path aliases for module resolution.
887
+
888
+ ```ts
889
+ export default defineNitroConfig({
890
+ alias: {
891
+ "~utils": "./src/utils",
892
+ "#shared": "./shared",
893
+ },
894
+ });
895
+ ```
896
+
897
+ ### `minify`
898
+
899
+ - Default: `false`
900
+ Minify bundle.
901
+
902
+ ```ts
903
+ export default defineNitroConfig({
904
+ minify: true, // minify production bundle
905
+ });
906
+ ```
907
+
908
+ ### `inlineDynamicImports`
909
+
910
+ - Default: `false`
911
+ Bundle all code into a single file instead of creating separate chunks per route.
912
+
913
+ When `false`, each route handler becomes a separate chunk loaded on-demand. When `true`, everything is bundled together. Some presets enable this by default.
914
+
915
+ ```ts
916
+ export default defineNitroConfig({
917
+ inlineDynamicImports: true, // single output file
918
+ });
919
+ ```
920
+
921
+ ### `sourcemap`
922
+
923
+ - Default: `false`
924
+ Enable source map generation. See [options](https://rollupjs.org/configuration-options/#output-sourcemap).
925
+
926
+ ```ts
927
+ export default defineNitroConfig({
928
+ sourcemap: true, // generate .map files
929
+ });
930
+ ```
931
+
932
+ ### `node`
933
+
934
+ - Default: `true`
935
+ Specify whether the build is used for Node.js or not. If set to `false`, nitro tries to mock Node.js dependencies using [unenv](https://github.com/unjs/unenv) and adjust its behavior.
936
+
937
+ ```ts
938
+ export default defineNitroConfig({
939
+ node: false, // target non-Node.js runtimes
940
+ });
941
+ ```
942
+
943
+ ### `moduleSideEffects`
944
+
945
+ Default: `['unenv/polyfill/']`
946
+
947
+ Specifies module imports that have side-effects.
948
+
949
+ ```ts
950
+ export default defineNitroConfig({
951
+ moduleSideEffects: ["unenv/polyfill/", "reflect-metadata"],
952
+ });
953
+ ```
954
+
955
+ ### `replace`
956
+
957
+ Build-time string replacements.
958
+
959
+ ```ts
960
+ export default defineNitroConfig({
961
+ replace: {
962
+ "process.env.APP_VERSION": JSON.stringify("1.0.0"),
963
+ },
964
+ });
965
+ ```
966
+
967
+ ### `commonJS`
968
+
969
+ Specifies additional configuration for the rollup CommonJS plugin.
970
+
971
+ ```ts
972
+ export default defineNitroConfig({
973
+ commonJS: {
974
+ requireReturnsDefault: "auto",
975
+ },
976
+ });
977
+ ```
978
+
979
+ ### `exportConditions`
980
+
981
+ Custom export conditions for module resolution.
982
+
983
+ ```ts
984
+ export default defineNitroConfig({
985
+ exportConditions: ["worker", "production"],
986
+ });
987
+ ```
988
+
989
+ ### `noExternals`
990
+
991
+ - Default: `false`
992
+ Prevent specific packages from being externalized. Set to `true` to bundle all dependencies, or pass an array of package names/patterns.
993
+
994
+ ```ts
995
+ export default defineNitroConfig({
996
+ noExternals: true, // bundle all dependencies
997
+ });
998
+ ```
999
+
1000
+ ### `traceDeps`
1001
+
1002
+ - Default: `[]`
1003
+ Additional dependencies to trace and include in the build output.
1004
+
1005
+ ```ts
1006
+ export default defineNitroConfig({
1007
+ traceDeps: ["sharp", "better-sqlite3"],
1008
+ });
1009
+ ```
1010
+
1011
+ ### `oxc`
1012
+
1013
+ OXC options for rolldown builds. Includes `minify` and `transform` sub-options.
1014
+
1015
+ ```ts
1016
+ export default defineNitroConfig({
1017
+ oxc: {
1018
+ minify: { compress: true, mangle: true },
1019
+ },
1020
+ });
1021
+ ```
1022
+
1023
+ ## Advanced
1024
+
1025
+ ### `dev`
1026
+
1027
+ - Default: `true` for development and `false` for production.
1028
+ **⚠️ Caution! This is an advanced configuration. Things can go wrong if misconfigured.**
1029
+
1030
+ ```ts
1031
+ export default defineNitroConfig({
1032
+ dev: true, // force development mode behavior
1033
+ });
1034
+ ```
1035
+
1036
+ ### `typescript`
1037
+
1038
+ Default: `{ strict: true, generateRuntimeConfigTypes: false, generateTsConfig: false }`
1039
+
1040
+ TypeScript configuration options including `strict`, `generateRuntimeConfigTypes`, `generateTsConfig`, `tsConfig`, `generatedTypesDir`, and `tsconfigPath`.
1041
+
1042
+ ```ts
1043
+ export default defineNitroConfig({
1044
+ typescript: {
1045
+ strict: true,
1046
+ generateTsConfig: true,
1047
+ },
1048
+ });
1049
+ ```
1050
+
1051
+ ### `hooks`
1052
+
1053
+ **⚠️ Caution! This is an advanced configuration. Things can go wrong if misconfigured.**
1054
+
1055
+ nitro hooks. See [hookable](https://github.com/unjs/hookable) for more information.
1056
+
1057
+ ```ts
1058
+ export default defineNitroConfig({
1059
+ hooks: {
1060
+ compiled(nitro) {
1061
+ console.log("Build compiled successfully!");
1062
+ },
1063
+ },
1064
+ });
1065
+ ```
1066
+
1067
+ ### `commands`
1068
+
1069
+ **⚠️ Caution! This is an advanced configuration. Things can go wrong if misconfigured.**
1070
+
1071
+ Preview and deploy command hints are usually filled by deployment presets.
1072
+
1073
+ ```ts
1074
+ export default defineNitroConfig({
1075
+ commands: {
1076
+ preview: "node ./server/index.mjs",
1077
+ },
1078
+ });
1079
+ ```
1080
+
1081
+ ### `devErrorHandler`
1082
+
1083
+ **⚠️ Caution! This is an advanced configuration. Things can go wrong if misconfigured.**
1084
+
1085
+ A custom error handler function for development errors.
1086
+
1087
+ ```ts
1088
+ export default defineNitroConfig({
1089
+ devErrorHandler: (error, event) => {
1090
+ return new Response(`Dev error: ${error.message}`, { status: 500 });
1091
+ },
1092
+ });
1093
+ ```
1094
+
1095
+ ### `framework`
1096
+
1097
+ - Default: `{ name: "nitro", version: "<current>" }`
1098
+ Framework information. Used by presets and build info. Typically set by higher-level frameworks (e.g. Nuxt).
1099
+
1100
+ ```ts
1101
+ export default defineNitroConfig({
1102
+ framework: { name: "my-framework", version: "2.0.0" },
1103
+ });
1104
+ ```
1105
+
1106
+ ## Preset options
1107
+
1108
+ ### `firebase`
1109
+
1110
+ The options for the firebase functions preset. See [Preset Docs](/deploy/providers/firebase#options)
1111
+
1112
+ ```ts
1113
+ export default defineNitroConfig({
1114
+ firebase: {
1115
+ gen: 2, // use Cloud Functions 2nd gen
1116
+ region: "us-central1",
1117
+ },
1118
+ });
1119
+ ```
1120
+
1121
+ ### `vercel`
1122
+
1123
+ The options for the vercel preset. See [Preset Docs](/deploy/providers/vercel)
1124
+
1125
+ ```ts
1126
+ export default defineNitroConfig({
1127
+ vercel: {
1128
+ config: { runtime: "nodejs20.x" },
1129
+ },
1130
+ });
1131
+ ```
1132
+
1133
+ ### `cloudflare`
1134
+
1135
+ The options for the cloudflare preset. See [Preset Docs](/deploy/providers/cloudflare)
1136
+
1137
+ ```ts
1138
+ export default defineNitroConfig({
1139
+ cloudflare: {
1140
+ wrangler: { compatibility_date: "2025-01-01" },
1141
+ },
1142
+ });
1143
+ ```
1144
+
1145
+ ### `zephyr`
1146
+
1147
+ The options for the zephyr preset. See [Preset Docs](/deploy/providers/zephyr#options)