@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,408 @@
1
+ # Cache
2
+
3
+ > Nitro provides a caching system built on top of the storage layer, powered by [ocache](https://github.com/unjs/ocache).
4
+
5
+ ## Cached handlers
6
+
7
+ To cache an event handler, you simply need to use the `defineCachedHandler` method.
8
+
9
+ It works like `defineHandler` but with an second parameter for the [cache options](#options).
10
+
11
+ ```ts [routes/cached.ts]
12
+ import { defineCachedHandler } from "nitro/cache";
13
+
14
+ export default defineCachedHandler((event) => {
15
+ return "I am cached for an hour";
16
+ }, { maxAge: 60 * 60 });
17
+ ```
18
+
19
+ With this example, the response will be cached for 1 hour and a stale value will be sent to the client while the cache is being updated in the background. If you want to immediately return the updated response set `swr: false`.
20
+
21
+ See the [options](#options) section for more details about the available options.
22
+
23
+ <important>
24
+
25
+ **Request headers are dropped** when handling cached responses. Use the [`varies` option](#options) to consider specific headers when caching and serving the responses.
26
+ </important>
27
+
28
+ ### Automatic HTTP headers
29
+
30
+ When using `defineCachedHandler`, Nitro automatically manages HTTP cache headers on cached responses:
31
+
32
+ - **`etag`** -- A weak ETag (`W/"..."`) is generated from the response body hash if not already set by the handler.
33
+ - **`last-modified`** -- Set to the current time when the response is first cached, if not already set.
34
+ - **`cache-control`** -- Automatically set based on the `swr`, `maxAge`, and `staleMaxAge` options: - With `swr: true`: `s-maxage=<maxAge>, stale-while-revalidate=<staleMaxAge>`
35
+ - With `swr: false`: `max-age=<maxAge>`
36
+
37
+
38
+ ### Conditional requests (304 Not Modified)
39
+ Cached handlers automatically support conditional requests. When a client sends `if-none-match` or `if-modified-since` headers matching the cached response, Nitro returns a `304 Not Modified` response without a body.
40
+
41
+ ### Request method filtering
42
+
43
+ Only `GET` and `HEAD` requests are cached. All other HTTP methods (`POST`, `PUT`, `DELETE`, etc.) automatically bypass the cache and call the handler directly.
44
+
45
+ ### Request deduplication
46
+
47
+ When multiple concurrent requests hit the same cache key while the cache is being resolved, only one invocation of the handler runs. All concurrent requests wait for and share the same result.
48
+
49
+ ## Cached functions
50
+
51
+ You can also cache a function using the `defineCachedFunction` function. This is useful for caching the result of a function that is not an event handler, but is part of one, and reusing it in multiple handlers.
52
+
53
+ For example, you might want to cache the result of an API call for one hour:
54
+
55
+ ```ts [routes/api/stars/[...repo\].ts]
56
+ import { defineCachedFunction } from "nitro/cache";
57
+ import { defineHandler, type H3Event } from "nitro";
58
+
59
+ export default defineHandler(async (event) => {
60
+ const { repo } = event.context.params;
61
+ const stars = await cachedGHStars(repo).catch(() => 0)
62
+
63
+ return { repo, stars }
64
+ });
65
+
66
+ const cachedGHStars = defineCachedFunction(async (repo: string) => {
67
+ const data = await fetch(`https://api.github.com/repos/${repo}`).then(res => res.json());
68
+
69
+ return data.stargazers_count;
70
+ }, {
71
+ maxAge: 60 * 60,
72
+ name: "ghStars",
73
+ getKey: (repo: string) => repo
74
+ });
75
+ ```
76
+
77
+ The stars will be cached in development inside `.nitro/cache/functions/ghStars/<owner>/<repo>.json` with `value` being the number of stars.
78
+
79
+ ```json
80
+ {"expires":1677851092249,"value":43991,"mtime":1677847492540,"integrity":"ZUHcsxCWEH"}
81
+ ```
82
+
83
+ <important>
84
+
85
+ Because the cached data is serialized to JSON, it is important that the cached function does not return anything that cannot be serialized, such as Symbols, Maps, Sets...
86
+ </important>
87
+
88
+ <callout>
89
+
90
+ If you are using edge workers to host your application, you should follow the instructions below.
91
+ :<collapsible></collapsible>
92
+ In edge workers, the instance is destroyed after each request. Nitro automatically uses `event.waitUntil` to keep the instance alive while the cache is being updated while the response is sent to the client.
93
+
94
+ To ensure that your cached functions work as expected in edge workers, **you should always pass the `event` as the first argument to the function using `defineCachedFunction`.**
95
+
96
+ ```ts [routes/api/stars/[...repo\].ts] {5,10,17}
97
+ import { defineCachedFunction } from "nitro/cache";
98
+
99
+
100
+ export default defineHandler(async (event) => {
101
+ const { repo } = event.context.params;
102
+ const stars = await cachedGHStars(event, repo).catch(() => 0)
103
+
104
+ return { repo, stars }
105
+ });
106
+
107
+ const cachedGHStars = defineCachedFunction(async (event: H3Event, repo: string) => {
108
+ const data = await fetch(`https://api.github.com/repos/${repo}`).then(res => res.json());
109
+
110
+ return data.stargazers_count;
111
+ }, {
112
+ maxAge: 60 * 60,
113
+ name: "ghStars",
114
+ getKey: (event: H3Event, repo: string) => repo
115
+ });
116
+ ```
117
+
118
+ This way, the function will be able to keep the instance alive while the cache is being updated without slowing down the response to the client.
119
+ </callout>
120
+
121
+ ::
122
+
123
+ ## Using route rules
124
+
125
+ This feature enables you to add caching routes based on a glob pattern directly in the main configuration file. This is especially useful to have a global cache strategy for a part of your application.
126
+
127
+ Cache all the blog routes for 1 hour with `stale-while-revalidate` behavior:
128
+
129
+ ```ts [nitro.config.ts]
130
+ import { defineNitroConfig } from "nitro/config";
131
+
132
+ export default defineNitroConfig({
133
+ routeRules: {
134
+ "/blog/**": { cache: { maxAge: 60 * 60 } },
135
+ },
136
+ });
137
+ ```
138
+
139
+ If we want to use a [custom cache storage](#cache-storage) mount point, we can use the `base` option.
140
+
141
+ ```ts [nitro.config.ts]
142
+ import { defineNitroConfig } from "nitro/config";
143
+
144
+ export default defineNitroConfig({
145
+ storage: {
146
+ redis: {
147
+ driver: "redis",
148
+ url: "redis://localhost:6379",
149
+ },
150
+ },
151
+ routeRules: {
152
+ "/blog/**": { cache: { maxAge: 60 * 60, base: "redis" } },
153
+ },
154
+ });
155
+ ```
156
+
157
+ ### Route rules shortcuts
158
+
159
+ You can use the `swr` shortcut for enabling `stale-while-revalidate` caching on route rules. When set to `true`, SWR is enabled with the default `maxAge`. When set to a number, it is used as the `maxAge` value in seconds.
160
+
161
+ ```ts [nitro.config.ts]
162
+ import { defineNitroConfig } from "nitro/config";
163
+
164
+ export default defineNitroConfig({
165
+ routeRules: {
166
+ "/blog/**": { swr: true },
167
+ "/api/**": { swr: 3600 },
168
+ },
169
+ });
170
+ ```
171
+
172
+ To explicitly disable caching on a route, set `cache: false`:
173
+
174
+ ```ts [nitro.config.ts]
175
+ import { defineNitroConfig } from "nitro/config";
176
+
177
+ export default defineNitroConfig({
178
+ routeRules: {
179
+ "/api/realtime/**": { cache: false },
180
+ },
181
+ });
182
+ ```
183
+
184
+ <note>
185
+
186
+ When using route rules, cached handlers use the group `'nitro/route-rules'` instead of the default `'nitro/handlers'`.
187
+ </note>
188
+
189
+ ## Cache storage
190
+
191
+ Nitro stores the data in the `cache` storage mount point.
192
+
193
+ - In production, it will use the [memory driver](https://unstorage.unjs.io/drivers/memory) by default.
194
+ - In development, it will use the [filesystem driver](https://unstorage.unjs.io/drivers/fs), writing to a temporary dir (`.nitro/cache`).
195
+ To overwrite the production storage, set the `cache` mount point using the `storage` option:
196
+
197
+ ```ts [nitro.config.ts]
198
+ import { defineNitroConfig } from "nitro/config";
199
+
200
+ export default defineNitroConfig({
201
+ storage: {
202
+ cache: {
203
+ driver: 'redis',
204
+ /* redis connector options */
205
+ }
206
+ }
207
+ })
208
+ ```
209
+
210
+ In development, you can also overwrite the cache mount point using the `devStorage` option:
211
+
212
+ ```ts [nitro.config.ts]
213
+ import { defineNitroConfig } from "nitro/config";
214
+
215
+ export default defineNitroConfig({
216
+ storage: {
217
+ cache: {
218
+ // production cache storage
219
+ },
220
+ },
221
+ devStorage: {
222
+ cache: {
223
+ // development cache storage
224
+ }
225
+ }
226
+ })
227
+ ```
228
+
229
+ ## Options
230
+
231
+ The `defineCachedHandler` and `defineCachedFunction` functions accept the following options:
232
+
233
+ ### Shared options
234
+
235
+ These options are available for both `defineCachedHandler` and `defineCachedFunction`:
236
+
237
+ <field-group>
238
+
239
+ <field>
240
+
241
+ Name of the storage mountpoint to use for caching. :br
242
+ Default to `cache`.
243
+ </field>
244
+
245
+ <field>
246
+
247
+ Guessed from function name if not provided, and falls back to `'_'` otherwise.
248
+ </field>
249
+
250
+ <field>
251
+
252
+ Defaults to `'nitro/handlers'` for handlers and `'nitro/functions'` for functions.
253
+ </field>
254
+
255
+ <field>
256
+
257
+ A function that accepts the same arguments as the original function and returns a cache key (`String`). :br
258
+ If not provided, a built-in hash function will be used to generate a key based on the function arguments. For cached handlers, the key is derived from the request URL path and search params.
259
+ </field>
260
+
261
+ <field>
262
+
263
+ A value that invalidates the cache when changed. :br
264
+ By default, it is computed from **function code**, used in development to invalidate the cache when the function code changes.
265
+ </field>
266
+
267
+ <field>
268
+
269
+ Maximum age that cache is valid, in seconds. :br
270
+ Default to `1` (second).
271
+ </field>
272
+
273
+ <field>
274
+
275
+ Maximum age that a stale cache is valid, in seconds. If set to `-1` a stale value will still be sent to the client while the cache updates in the background. :br
276
+ Defaults to `0` (disabled).
277
+ </field>
278
+
279
+ <field>
280
+
281
+ Enable `stale-while-revalidate` behavior to serve a stale cached response while asynchronously revalidating it. :br
282
+ When enabled, stale cached values are returned immediately while revalidation happens in the background. When disabled, the caller waits for the fresh value before responding (the stale entry is cleared). :br
283
+ Defaults to `true`.
284
+ </field>
285
+
286
+ <field>
287
+
288
+ A function that returns a `boolean` to invalidate the current cache and create a new one.
289
+ </field>
290
+
291
+ <field>
292
+
293
+ A function that returns a `boolean` to bypass the current cache without invalidating the existing entry.
294
+ </field>
295
+
296
+ <field>
297
+
298
+ A custom error handler called when the cached function throws. :br
299
+ By default, errors are logged to the console and captured by the Nitro error handler.
300
+ </field>
301
+ </field-group>
302
+
303
+ ### Handler-only options
304
+
305
+ These options are only available for `defineCachedHandler`:
306
+
307
+ <field-group>
308
+
309
+ <field>
310
+
311
+ When `true`, skip full response caching and only handle conditional request headers (`if-none-match`, `if-modified-since`) for `304 Not Modified` responses. The handler is called on every request but benefits from conditional caching.
312
+ </field>
313
+
314
+ <field>
315
+
316
+ An array of request header names to vary the cache key on. Headers listed here are preserved on the request during cache resolution and included in the cache key, making the cache unique per combination of header values. :br :br
317
+ Headers **not** listed in `varies` are stripped from the request before calling the handler to ensure consistent cache hits. :br :br
318
+ For multi-tenant environments, you may want to pass `['host', 'x-forwarded-host']` to ensure these headers are not discarded and that the cache is unique per tenant.
319
+ </field>
320
+ </field-group>
321
+
322
+ ### Function-only options
323
+
324
+ These options are only available for `defineCachedFunction`:
325
+
326
+ <field-group>
327
+
328
+ <field>
329
+
330
+ Transform the cache entry before returning. The return value replaces the cached value.
331
+ </field>
332
+
333
+ <field>
334
+
335
+ Validate a cache entry. Return `false` to treat the entry as invalid and trigger re-resolution.
336
+ </field>
337
+ </field-group>
338
+
339
+ ## SWR behavior
340
+
341
+ The `stale-while-revalidate` (SWR) pattern is enabled by default (`swr: true`). Understanding how it interacts with other options:
342
+
343
+ | `swr` | `maxAge` | Behavior |
344
+ | --- | --- | --- |
345
+ | `true` (default) | `1` (default) | Cache for 1 second, serve stale while revalidating |
346
+ | `true` | `3600` | Cache for 1 hour, serve stale while revalidating |
347
+ | `false` | `3600` | Cache for 1 hour, wait for fresh value when expired |
348
+ | `true` | `3600` with `staleMaxAge: 600` | Cache for 1 hour, serve stale for up to 10 minutes while revalidating |
349
+
350
+ When `swr` is enabled and a cached value exists but has expired:
351
+
352
+ 1. The stale cached value is returned immediately to the client.
353
+ 2. The function/handler is called in the background to refresh the cache.
354
+ 3. On edge workers, `event.waitUntil` is used to keep the background refresh alive.
355
+ When `swr` is disabled and a cached value has expired:
356
+
357
+ 1. The stale entry is cleared.
358
+ 2. The client waits for the function/handler to resolve with a fresh value.
359
+
360
+ ## Cache keys and invalidation
361
+ When using the `defineCachedFunction` or `defineCachedHandler` functions, the cache key is generated using the following pattern:
362
+
363
+ ```ts
364
+ `${options.base}:${options.group}:${options.name}:${options.getKey(...args)}.json`
365
+ ```
366
+
367
+ For example, the following function:
368
+
369
+ ```ts
370
+ import { defineCachedFunction } from "nitro/cache";
371
+
372
+ const getAccessToken = defineCachedFunction(() => {
373
+ return String(Date.now())
374
+ }, {
375
+ maxAge: 10,
376
+ name: "getAccessToken",
377
+ getKey: () => "default"
378
+ });
379
+ ```
380
+
381
+ Will generate the following cache key:
382
+
383
+ ```ts
384
+ cache:nitro/functions:getAccessToken:default.json
385
+ ```
386
+
387
+ You can invalidate the cached function entry with:
388
+
389
+ ```ts
390
+ import { useStorage } from "nitro/storage";
391
+
392
+ await useStorage('cache').removeItem('nitro/functions:getAccessToken:default.json')
393
+ ```
394
+
395
+ <note>
396
+
397
+ For cached handlers, the cache key includes a hash of the URL path and, when using the [`varies`](#handler-only-options) option, hashes of the specified header values appended to the key.
398
+ </note>
399
+
400
+ <note>
401
+
402
+ Responses with HTTP status codes `>= 400` or with an undefined body are not cached. This prevents caching error responses.
403
+ </note>
404
+
405
+ <read-more>
406
+
407
+ Read more about the Nitro storage.
408
+ </read-more>
@@ -0,0 +1,256 @@
1
+ # Configuration
2
+
3
+ > Customize and extend Nitro defaults.
4
+
5
+ <read-more>
6
+
7
+ See [config reference](/config) for available options.
8
+ </read-more>
9
+
10
+ ## Config file
11
+
12
+ You can customize your Nitro builder with a configuration file.
13
+
14
+ ```ts [nitro.config.ts]
15
+ import { defineNitroConfig } from "nitro/config";
16
+
17
+ export default defineNitroConfig({
18
+ // Nitro options
19
+ })
20
+ ```
21
+
22
+ ```ts [vite.config.ts]
23
+ import { defineConfig } from 'vite'
24
+ import { nitro } from 'nitro/vite'
25
+
26
+ export default defineConfig({
27
+ plugins: [
28
+ nitro()
29
+ ],
30
+ nitro: {
31
+ // Nitro options
32
+ }
33
+ })
34
+
35
+ ```
36
+
37
+ > [!TIP]
38
+ > Nitro loads the configuration using [c12](https://github.com/unjs/c12), giving more possibilities such as using `.nitrorc` file in current working directory or in the user's home directory.
39
+
40
+ ### Environment-specific config
41
+
42
+ Using [c12](https://github.com/unjs/c12) conventions, you can provide environment-specific overrides using `$development` and `$production` keys:
43
+
44
+ ```ts [nitro.config.ts]
45
+ import { defineNitroConfig } from "nitro/config";
46
+
47
+ export default defineNitroConfig({
48
+ logLevel: 3,
49
+ $development: {
50
+ // Options applied only in development mode
51
+ debug: true,
52
+ },
53
+ $production: {
54
+ // Options applied only in production builds
55
+ minify: true,
56
+ },
57
+ })
58
+ ```
59
+
60
+ The environment name is `"development"` during `nitro dev` and `"production"` during `nitro build`.
61
+
62
+ ### Extending configs
63
+
64
+ You can extend from other configs or presets using the `extends` key:
65
+
66
+ ```ts [nitro.config.ts]
67
+ import { defineNitroConfig } from "nitro/config";
68
+
69
+ export default defineNitroConfig({
70
+ extends: "./base.config",
71
+ })
72
+ ```
73
+
74
+ ### Config from `package.json`
75
+
76
+ You can also provide Nitro configuration under the `nitro` key in your `package.json` file.
77
+
78
+ ## Directory options
79
+
80
+ Nitro provides several options for controlling directory structure:
81
+
82
+ | Option | Default | Description |
83
+ | --- | --- | --- |
84
+ | `rootDir` | `.` (current directory) | The root directory of the project. |
85
+ | `serverDir` | `false` | Server source directory (set to `"server"` or `"./"` to enable). |
86
+ | `buildDir` | `node_modules/.nitro` | Directory for build artifacts. |
87
+ | `output.dir` | `.output` | Production output directory. |
88
+ | `output.serverDir` | `.output/server` | Server output directory. |
89
+ | `output.publicDir` | `.output/public` | Public assets output directory. |
90
+
91
+ ```ts [nitro.config.ts]
92
+ import { defineNitroConfig } from "nitro/config";
93
+
94
+ export default defineNitroConfig({
95
+ serverDir: "server",
96
+ buildDir: "node_modules/.nitro",
97
+ output: {
98
+ dir: ".output",
99
+ },
100
+ })
101
+ ```
102
+
103
+ > [!NOTE]
104
+ > The `srcDir` option is deprecated. Use `serverDir` instead.
105
+
106
+ ## Environment variables
107
+
108
+ Certain Nitro behaviors can be configured using environment variables:
109
+
110
+ | Variable | Description |
111
+ | --- | --- |
112
+ | `NITRO_PRESET` | Override the deployment preset. |
113
+ | `NITRO_COMPATIBILITY_DATE` | Set the compatibility date. |
114
+ | `NITRO_APP_BASE_URL` | Override the base URL (default: `/`). |
115
+
116
+ ## Runtime configuration
117
+
118
+ Nitro provides a runtime config API to expose configuration within your application, with the ability to update it at runtime by setting environment variables. This is useful when you want to expose different configuration values for different environments (e.g. development, staging, production). For example, you can use this to expose different API endpoints for different environments or to expose different feature flags.
119
+
120
+ First, you need to define the runtime config in your configuration file.
121
+
122
+ ```ts [nitro.config.ts]
123
+ import { defineNitroConfig } from "nitro/config";
124
+
125
+ export default defineNitroConfig({
126
+ runtimeConfig: {
127
+ apiToken: "dev_token", // `dev_token` is the default value
128
+ }
129
+ });
130
+ ```
131
+
132
+ You can now access the runtime config using `useRuntimeConfig()`.
133
+
134
+ ```ts [api/example.get.ts]
135
+ import { defineHandler } from "nitro";
136
+ import { useRuntimeConfig } from "nitro/runtime-config";
137
+
138
+ export default defineHandler((event) => {
139
+ return useRuntimeConfig().apiToken; // Returns `dev_token`
140
+ });
141
+ ```
142
+
143
+ ### Nested objects
144
+
145
+ Runtime config supports nested objects. Keys at any depth are mapped to environment variables using the `NITRO_` prefix and `UPPER_SNAKE_CASE` conversion:
146
+
147
+ ```ts [nitro.config.ts]
148
+ import { defineNitroConfig } from "nitro/config";
149
+
150
+ export default defineNitroConfig({
151
+ runtimeConfig: {
152
+ database: {
153
+ host: "localhost",
154
+ port: 5432,
155
+ },
156
+ },
157
+ });
158
+ ```
159
+
160
+ ```bash [.env]
161
+ NITRO_DATABASE_HOST="db.example.com"
162
+ NITRO_DATABASE_PORT="5433"
163
+ ```
164
+
165
+ > [!NOTE]
166
+ > Only keys defined in `runtimeConfig` in your config file will be considered. You cannot introduce new keys using environment variables alone.
167
+
168
+ ### Serialization
169
+
170
+ Runtime config values must be serializable (strings, numbers, booleans, plain objects, and arrays). Non-serializable values (class instances, functions, etc.) will trigger a warning at build time.
171
+
172
+ Values that are `undefined` or `null` in the config are replaced with empty strings (`""`) as a fallback.
173
+
174
+ ### Local development
175
+
176
+ You can update the runtime config using environment variables. You can use a `.env` or `.env.local` file in development and use platform variables in production (see below).
177
+
178
+ Create an `.env` file in your project root:
179
+
180
+ ```bash [.env]
181
+ NITRO_API_TOKEN="123"
182
+ ```
183
+
184
+ Re-start the development server, fetch the `/api/example` endpoint and you should see `123` as the response instead of `dev_token`.
185
+
186
+ > [!NOTE]
187
+ > The `.env` and `.env.local` files are only loaded during development (`nitro dev`). In production, use your platform's native environment variable mechanism.
188
+
189
+ Do not forget that you can still universally access environment variables using `import.meta.env` or `process.env` but avoid using them in ambient global contexts to prevent unexpected behavior.
190
+
191
+ ### Production
192
+
193
+ You can define variables in your production environment to update the runtime config.
194
+
195
+ <warning>
196
+
197
+ All variables must be prefixed with `NITRO_` to be applied to the runtime config. They will override the runtime config variables defined within your `nitro.config.ts` file.
198
+ </warning>
199
+
200
+ ```bash [.env]
201
+ NITRO_API_TOKEN="123"
202
+ ```
203
+
204
+ In runtime config, define key using camelCase. In environment variables, define key using snake_case and uppercase.
205
+
206
+ ```ts
207
+ {
208
+ helloWorld: "foo"
209
+ }
210
+ ```
211
+
212
+ ```bash
213
+ NITRO_HELLO_WORLD="foo"
214
+ ```
215
+
216
+ ### Custom env prefix
217
+
218
+ You can configure a secondary environment variable prefix using the `nitro.envPrefix` runtime config key. This prefix is checked in addition to the default `NITRO_` prefix:
219
+
220
+ ```ts [nitro.config.ts]
221
+ import { defineNitroConfig } from "nitro/config";
222
+
223
+ export default defineNitroConfig({
224
+ runtimeConfig: {
225
+ nitro: {
226
+ envPrefix: "APP_",
227
+ },
228
+ apiToken: "",
229
+ },
230
+ });
231
+ ```
232
+
233
+ With this configuration, both `NITRO_API_TOKEN` and `APP_API_TOKEN` will be checked as overrides.
234
+
235
+ ### Env expansion
236
+
237
+ When enabled, environment variable references using `{{VAR_NAME}}` syntax in runtime config string values are expanded at runtime:
238
+
239
+ ```ts [nitro.config.ts]
240
+ import { defineNitroConfig } from "nitro/config";
241
+
242
+ export default defineNitroConfig({
243
+ experimental: {
244
+ envExpansion: true,
245
+ },
246
+ runtimeConfig: {
247
+ url: "https://{{APP_DOMAIN}}/api",
248
+ },
249
+ });
250
+ ```
251
+
252
+ ```bash
253
+ APP_DOMAIN="example.com"
254
+ ```
255
+
256
+ At runtime, `useRuntimeConfig().url` will resolve to `"https://example.com/api"`.