@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,164 @@
1
+ # Plugins
2
+
3
+ > Use plugins to extend Nitro's runtime behavior.
4
+
5
+ Nitro plugins are **executed once** during server startup in order to allow extending Nitro's runtime behavior.
6
+ They receive `nitroApp` context, which can be used to hook into lifecycle events.
7
+
8
+ Plugins are auto-registered from the `plugins/` directory and run synchronously by file name order on the first Nitro initialization. Plugin functions themselves must be synchronous (return `void`), but the hooks they register can be async.
9
+
10
+ **Example:**
11
+
12
+ ```ts [plugins/test.ts]
13
+ import { definePlugin } from "nitro";
14
+
15
+ export default definePlugin((nitroApp) => {
16
+ console.log('Nitro plugin', nitroApp)
17
+ })
18
+ ```
19
+
20
+ If you have plugins in another directory, you can use the `plugins` option:
21
+
22
+ ```ts [nitro.config.ts]
23
+ import { defineNitroConfig } from "nitro/config";
24
+
25
+ export default defineNitroConfig({
26
+ plugins: ['my-plugins/hello.ts']
27
+ })
28
+ ```
29
+
30
+ ## The `nitroApp` context
31
+
32
+ The plugin function receives a `nitroApp` object with the following properties:
33
+
34
+ | Property | Type | Description |
35
+ | --- | --- | --- |
36
+ | `hooks` | [`HookableCore`](https://github.com/unjs/hookable) | Hook system for registering lifecycle callbacks. |
37
+ | `h3` | `H3Core` | The underlying [H3](https://github.com/h3js/h3) application instance. |
38
+ | `fetch` | `(req: Request) => Response \| Promise<Response>` | The app's internal fetch handler. |
39
+ | `captureError` | `(error: Error, context) => void` | Programmatically capture errors into the error hook pipeline. |
40
+
41
+ ## Nitro runtime hooks
42
+
43
+ You can use Nitro [hooks](https://github.com/unjs/hookable) to extend the default runtime behaviour of Nitro by registering custom functions to the lifecycle events within plugins.
44
+
45
+ **Example:**
46
+
47
+ ```ts
48
+ import { definePlugin } from "nitro";
49
+
50
+ export default definePlugin((nitroApp) => {
51
+ nitroApp.hooks.hook("close", async () => {
52
+ // Will run when nitro is being closed
53
+ });
54
+ })
55
+ ```
56
+
57
+ ### Available hooks
58
+
59
+ | Hook | Signature | Description |
60
+ | --- | --- | --- |
61
+ | `request` | `(event: HTTPEvent) => void \| Promise<void>` | Called at the start of each request. |
62
+ | `response` | `(res: Response, event: HTTPEvent) => void \| Promise<void>` | Called after the response is created. |
63
+ | `error` | `(error: Error, context: { event?: HTTPEvent, tags?: string[] }) => void` | Called when an error is captured. |
64
+ | `close` | `() => void` | Called when the Nitro server is shutting down. |
65
+
66
+ > [!NOTE]
67
+ > The `NitroRuntimeHooks` interface is augmentable. Deployment presets (such as Cloudflare) can extend it with platform-specific hooks like `cloudflare:scheduled` and `cloudflare:email`.
68
+
69
+ ### Unregistering hooks
70
+
71
+ The `hook()` method returns an unregister function that can be called to remove the hook:
72
+
73
+ ```ts
74
+ import { definePlugin } from "nitro";
75
+
76
+ export default definePlugin((nitroApp) => {
77
+ const unregister = nitroApp.hooks.hook("request", (event) => {
78
+ // ...
79
+ });
80
+
81
+ // Later, remove the hook
82
+ unregister();
83
+ });
84
+ ```
85
+
86
+ ## Examples
87
+
88
+ ### Capturing errors
89
+
90
+ You can use plugins to capture all application errors.
91
+
92
+ ```ts
93
+ import { definePlugin } from "nitro";
94
+
95
+ export default definePlugin((nitroApp) => {
96
+ nitroApp.hooks.hook("error", async (error, { event }) => {
97
+ console.error(`${event?.path} Application error:`, error)
98
+ });
99
+ })
100
+ ```
101
+
102
+ The `context` object includes an optional `tags` array that identifies the error source (e.g., `"request"`, `"response"`, `"cache"`, `"plugin"`, `"unhandledRejection"`, `"uncaughtException"`).
103
+
104
+ ### Programmatic error capture
105
+
106
+ You can use `captureError` to manually feed errors into the error hook pipeline:
107
+
108
+ ```ts
109
+ import { definePlugin } from "nitro";
110
+
111
+ export default definePlugin((nitroApp) => {
112
+ nitroApp.captureError(new Error("something went wrong"), {
113
+ tags: ["startup"],
114
+ });
115
+ });
116
+ ```
117
+
118
+ ### Graceful shutdown
119
+
120
+ Server will gracefully shutdown and wait for any background pending tasks initiated by `event.waitUntil`.
121
+
122
+ ```ts
123
+ import { definePlugin } from "nitro";
124
+
125
+ export default definePlugin((nitroApp) => {
126
+ nitroApp.hooks.hook("close", async () => {
127
+ // Clean up resources, close connections, etc.
128
+ });
129
+ });
130
+ ```
131
+
132
+ ### Request and response lifecycle
133
+
134
+ You can use plugins to register hooks that run on the request lifecycle:
135
+
136
+ ```ts
137
+ import { definePlugin } from "nitro";
138
+
139
+ export default definePlugin((nitroApp) => {
140
+ nitroApp.hooks.hook("request", (event) => {
141
+ console.log("on request", event.path);
142
+ });
143
+
144
+ nitroApp.hooks.hook("response", (res, event) => {
145
+ // Modify or inspect the response
146
+ console.log("on response", res.status);
147
+ });
148
+ });
149
+ ```
150
+
151
+ ### Modifying response headers
152
+
153
+ ```ts
154
+ import { definePlugin } from "nitro";
155
+
156
+ export default definePlugin((nitroApp) => {
157
+ nitroApp.hooks.hook("response", (res, event) => {
158
+ const { pathname } = new URL(event.req.url);
159
+ if (pathname.endsWith(".css") || pathname.endsWith(".js")) {
160
+ res.headers.append("Vary", "Origin");
161
+ }
162
+ });
163
+ });
164
+ ```
@@ -0,0 +1,110 @@
1
+ # Quick Start
2
+
3
+ > Start with a fresh Nitro project or adopt it in your current Vite project.
4
+
5
+ ## Try Nitro online
6
+
7
+ Get a taste of Nitro in your browser using our playground.
8
+
9
+ [Play with Nitro in StackBlitz](https://stackblitz.com/github/nitrojs/starter/tree/v3-vite?file=index.html,server.ts)
10
+
11
+ ## Create a Nitro project
12
+
13
+ The fastest way to create a Nitro application is using the `create-nitro-app`.
14
+
15
+ > [!NOTE]
16
+ > Make sure to have installed the latest LTS version of either [Node.js](https://nodejs.org/en), [Bun](https://bun.sh/), or [Deno](https://deno.com/).
17
+
18
+ <pm-x></pm-x>
19
+
20
+ Follow the instructions from the CLI and you will be ready to start your development server.
21
+
22
+ ## Add to a Vite project
23
+
24
+ You can add Nitro to any existing Vite project to get API routes, server-side rendering, and more.
25
+
26
+ <steps>
27
+
28
+ ### Install `nitro` and `vite`
29
+
30
+ <pm-install></pm-install>
31
+
32
+ ### Add Nitro plugin to Vite
33
+
34
+ Add the Nitro plugin to your `vite.config.ts`:
35
+
36
+ ```ts [vite.config.ts] {2,6}
37
+ import { defineConfig } from "vite";
38
+ import { nitro } from "nitro/vite";
39
+
40
+ export default defineConfig({
41
+ plugins: [
42
+ nitro()
43
+ ],
44
+ });
45
+ ```
46
+
47
+ ### Configure Nitro
48
+
49
+ Create a `nitro.config.ts` to configure the server directory:
50
+
51
+ ```ts [nitro.config.ts]
52
+ import { defineNitroConfig } from "nitro/config";
53
+
54
+ export default defineNitroConfig({
55
+ serverDir: "./server",
56
+ });
57
+ ```
58
+
59
+ The `serverDir` option tells Nitro where to look for your server routes. In this example, all routes will be inside the `server/` directory.
60
+
61
+ ### Create an API route
62
+
63
+ Create your first API route at `server/api/test.ts`:
64
+
65
+ <code-tree>
66
+
67
+ ```ts [server/api/test.ts]
68
+ import { defineHandler } from "nitro";
69
+
70
+ export default defineHandler(() => {
71
+ return { message: "Hello Nitro!" };
72
+ });
73
+ ```
74
+
75
+ ```ts [nitro.config.ts]
76
+ import { defineNitroConfig } from "nitro/config";
77
+
78
+ export default defineNitroConfig({
79
+ serverDir: "./server",
80
+ });
81
+ ```
82
+
83
+ ```ts [vite.config.ts]
84
+ import { defineConfig } from "vite";
85
+ import { nitro } from "nitro/vite";
86
+
87
+ export default defineConfig({
88
+ plugins: [nitro()],
89
+ });
90
+ ```
91
+ </code-tree>
92
+
93
+ The file path maps directly to the route URL — `server/api/test.ts` becomes `/api/test`.
94
+
95
+ <tip>
96
+
97
+ As an alternative to filesystem routing, you can declare routes programmatically using the `routes` config option. See [Programmatic route handlers](/docs/routing#programmatic-route-handlers) for more details.
98
+ </tip>
99
+
100
+ <tip>
101
+
102
+ You can return strings, JSON objects, `Response` instances, or readable streams from your handlers. See [Routing](/docs/routing) for more about dynamic routes, methods, and middleware.
103
+ </tip>
104
+
105
+ ### Start the development server
106
+
107
+ <pm-run></pm-run>
108
+
109
+ Your API route is now accessible at `http://localhost:3000/api/test` :sparkles:
110
+ </steps>
@@ -0,0 +1,322 @@
1
+ # Nitro Renderer
2
+
3
+ > Use a renderer to handle all unmatched routes with custom HTML or a templating system.
4
+
5
+ The renderer is a special handler in Nitro that catches all routes that don't match any specific API or route handler. It's commonly used for server-side rendering (SSR), serving single-page applications (SPAs), or creating custom HTML responses.
6
+
7
+ ## Configuration
8
+
9
+ The renderer is configured using the `renderer` option in your Nitro config:
10
+
11
+ ```ts [nitro.config.ts]
12
+ import { defineNitroConfig } from "nitro/config";
13
+
14
+ export default defineNitroConfig({
15
+ renderer: {
16
+ template: './index.html', // Path to HTML template file
17
+ handler: './renderer.ts', // Path to custom renderer handler
18
+ static: false, // Treat template as static HTML (no rendu processing)
19
+ }
20
+ })
21
+ ```
22
+
23
+ | Option | Type | Description |
24
+ | --- | --- | --- |
25
+ | `template` | `string` | Path to an HTML file used as the renderer template. |
26
+ | `handler` | `string` | Path to a custom renderer handler module. |
27
+ | `static` | `boolean` | When `true`, skips rendu template processing and serves the HTML as-is. Auto-detected based on template syntax when not set. |
28
+
29
+ Set `renderer: false` in the config to explicitly disable the renderer entirely (including auto-detection of `index.html`).
30
+
31
+ ## HTML template
32
+
33
+ ### Auto-detected `index.html`
34
+
35
+ By default, Nitro automatically looks for an `index.html` file in your project src dir.
36
+
37
+ If found, Nitro will use it as the renderer template and serve it for all unmatched routes.
38
+
39
+ <code-group>
40
+
41
+ ```html [index.html]
42
+ <!DOCTYPE html>
43
+ <html lang="en">
44
+ <head>
45
+ <meta charset="UTF-8" />
46
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
47
+ <title>My Vite + Nitro App</title>
48
+ </head>
49
+ <body>
50
+ <div id="app"></div>
51
+ <script type="module" src="/src/main.ts"></script>
52
+ </body>
53
+ </html>
54
+ ```
55
+
56
+ ```ts [routes/api/hello.ts]
57
+ import { defineHandler } from "nitro";
58
+
59
+ export default defineHandler((event) => {
60
+ return { hello: "API" };
61
+ });
62
+ ```
63
+ </code-group>
64
+
65
+ <tip>
66
+
67
+ When `index.html` is detected, Nitro will automatically log in the terminal: `Using index.html as renderer template.`
68
+ </tip>
69
+
70
+ With this setup:
71
+
72
+ - `/api/hello` → Handled by your API routes
73
+ - `/about`, `/contact`, etc. → Served with `index.html`
74
+
75
+ ### Custom HTML file
76
+ You can specify a custom HTML template file using the `renderer.template` option in your Nitro configuration.
77
+
78
+ <code-group>
79
+
80
+ ```ts [nitro.config.ts]
81
+ import { defineNitroConfig } from "nitro/config";
82
+
83
+ export default defineNitroConfig({
84
+ renderer: {
85
+ template: './app.html'
86
+ }
87
+ })
88
+ ```
89
+
90
+ ```html [app.html]
91
+ <!DOCTYPE html>
92
+ <html lang="en">
93
+ <head>
94
+ <meta charset="UTF-8" />
95
+ <title>Custom Template</title>
96
+ </head>
97
+ <body>
98
+ <div id="root">Loading...</div>
99
+ <script type="module" src="/src/main.js"></script>
100
+ </body>
101
+ </html>
102
+ ```
103
+ </code-group>
104
+
105
+ ### Static templates
106
+
107
+ By default, Nitro auto-detects whether your HTML template contains [rendu](#hypertext-preprocessor-experimental) syntax. If it does, the template is processed dynamically on each request. If it doesn't, it's served as static HTML.
108
+
109
+ You can override this behavior with the `static` option:
110
+
111
+ ```ts [nitro.config.ts]
112
+ import { defineNitroConfig } from "nitro/config";
113
+
114
+ export default defineNitroConfig({
115
+ renderer: {
116
+ template: './index.html',
117
+ static: true // Force static serving, skip template processing
118
+ }
119
+ })
120
+ ```
121
+
122
+ In production, static templates are inlined into the server bundle and served directly for optimal performance.
123
+
124
+ ### Hypertext Preprocessor (experimental)
125
+
126
+ Nitro uses [rendu](https://github.com/h3js/rendu) Hypertext Preprocessor, which provides a simple and powerful way to create dynamic HTML templates with JavaScript expressions.
127
+
128
+ #### Output expressions
129
+
130
+ - `{{ expression }}` — HTML-escaped output
131
+ - `{{{ expression }}}` or `<?= expression ?>` — raw (unescaped) output
132
+
133
+ ```html
134
+ <h1>Hello {{ $URL.pathname }}</h1>
135
+ <div>{{{ '<strong>raw html</strong>' }}}</div>
136
+ ```
137
+
138
+ #### Control flow
139
+ Use `<? ... ?>` for JavaScript control flow:
140
+
141
+ ```html
142
+ <? if ($METHOD === 'POST') { ?>
143
+ <p>Form submitted!</p>
144
+ <? } else { ?>
145
+ <form method="POST">
146
+ <button type="submit">Submit</button>
147
+ </form>
148
+ <? } ?>
149
+
150
+ <ul>
151
+ <? for (const item of ['a', 'b', 'c']) { ?>
152
+ <li>{{ item }}</li>
153
+ <? } ?>
154
+ </ul>
155
+ ```
156
+
157
+ #### Server scripts
158
+
159
+ Use `<script server>` to execute JavaScript on the server:
160
+
161
+ ```html
162
+ <script server>
163
+ const data = await fetch('https://api.example.com/data').then(r => r.json());
164
+ </script>
165
+ <pre>{{ JSON.stringify(data) }}</pre>
166
+ ```
167
+
168
+ #### Streaming content
169
+
170
+ Use the `echo()` function for streaming content. It accepts strings, functions, Promises, Response objects, or ReadableStreams:
171
+
172
+ ```html
173
+ <script server>
174
+ echo("Loading...");
175
+ echo(async () => fetch("https://api.example.com/data"));
176
+ </script>
177
+ ```
178
+
179
+ #### Global variables
180
+
181
+ Access request context within templates:
182
+
183
+ | Variable | Description |
184
+ | --- | --- |
185
+ | `$REQUEST` | The incoming `Request` object |
186
+ | `$METHOD` | HTTP method (`GET`, `POST`, etc.) |
187
+ | `$URL` | Request `URL` object |
188
+ | `$HEADERS` | Request headers |
189
+ | `$RESPONSE` | Response configuration object |
190
+ | `$COOKIES` | Read-only object containing request cookies |
191
+
192
+ #### Built-in functions
193
+
194
+ | Function | Description |
195
+ | --- | --- |
196
+ | `htmlspecialchars(str)` | Escape HTML characters (automatically applied in `{{ }}` syntax) |
197
+ | `setCookie(name, value, options?)` | Set a cookie in the response |
198
+ | `redirect(url)` | Redirect the user to another URL |
199
+ | `echo(content)` | Stream content to the response |
200
+
201
+ ```html [index.html]
202
+ <!DOCTYPE html>
203
+ <html lang="en">
204
+ <head>
205
+ <meta charset="UTF-8" />
206
+ <title>Dynamic template</title>
207
+ </head>
208
+ <body>
209
+ <h1>Hello {{ $REQUEST.url }}</h1>
210
+ <p>Welcome, <?= $COOKIES["user"] || "Guest" ?>!</p>
211
+ <script server>
212
+ setCookie("visited", "true", { maxAge: 3600 });
213
+ </script>
214
+ </body>
215
+ </html>
216
+ ```
217
+
218
+ <read-more></read-more>
219
+
220
+ ## Custom renderer handler
221
+
222
+ For more complex scenarios, you can create a custom renderer handler that programmatically generates responses.
223
+
224
+ The handler is a default export function that receives an H3 event object. You can access the incoming `Request` via `event.req`:
225
+
226
+ ```ts [renderer.ts]
227
+ export default function renderer({ req }: { req: Request }) {
228
+ const url = new URL(req.url);
229
+ return new Response(
230
+ /* html */ `<!DOCTYPE html>
231
+ <html>
232
+ <head>
233
+ <title>Custom Renderer</title>
234
+ </head>
235
+ <body>
236
+ <h1>Hello from custom renderer!</h1>
237
+ <p>Current path: ${url.pathname}</p>
238
+ </body>
239
+ </html>`,
240
+ { headers: { "content-type": "text/html; charset=utf-8" } }
241
+ );
242
+ }
243
+ ```
244
+
245
+ Then, specify the renderer entry in the Nitro config:
246
+
247
+ ```ts [nitro.config.ts]
248
+ import { defineNitroConfig } from "nitro/config";
249
+
250
+ export default defineNitroConfig({
251
+ renderer: {
252
+ handler: './renderer.ts'
253
+ }
254
+ })
255
+ ```
256
+
257
+ <note>
258
+
259
+ When `renderer.handler` is set, it takes full control of rendering. The `renderer.template` option is ignored.
260
+ </note>
261
+
262
+ ## Renderer priority
263
+
264
+ The renderer always acts as a catch-all route (`/**`) and has the **lowest priority**. This means:
265
+
266
+ 1. Specific API routes are matched first (e.g., `/api/users`)
267
+ 2. Specific server routes are matched next (e.g., `/about`)
268
+ 3. The renderer catches everything else
269
+
270
+ ```md
271
+ api/
272
+ users.ts → /api/users (matched first)
273
+ routes/
274
+ about.ts → /about (matched second)
275
+ renderer.ts → /** (catches all other routes)
276
+ ```
277
+
278
+ <warning>
279
+
280
+ If you define a catch-all route (`[...].ts`) in your routes, Nitro will warn you that the renderer will override it. Use more specific routes or different HTTP methods to avoid conflicts.
281
+ </warning>
282
+
283
+ <read-more></read-more>
284
+
285
+ ## Vite integration
286
+
287
+ When using Nitro with Vite, the renderer integrates with Vite's build pipeline and dev server.
288
+
289
+ ### Development mode
290
+
291
+ In development, the renderer template is read from disk on each request, so changes to `index.html` are reflected immediately without restarting the server. Vite's `transformIndexHtml` hook is applied to inject HMR client scripts and other dev-time transforms.
292
+
293
+ ### SSR with `<!--ssr-outlet-->`
294
+
295
+ When using Vite environments with an `ssr` service, you can add an `<!--ssr-outlet-->` comment to your `index.html`. Nitro will replace it with the output from your SSR entry during rendering:
296
+
297
+ ```html [index.html]
298
+ <!DOCTYPE html>
299
+ <html lang="en">
300
+ <head>
301
+ <meta charset="UTF-8" />
302
+ <title>SSR App</title>
303
+ </head>
304
+ <body>
305
+ <div id="app"><!--ssr-outlet--></div>
306
+ <script type="module" src="/src/main.ts"></script>
307
+ </body>
308
+ </html>
309
+ ```
310
+
311
+ ### Production build
312
+
313
+ During production builds, Vite processes the `index.html` through its build pipeline (resolving scripts, CSS, and other assets), then Nitro inlines the transformed HTML into the server bundle.
314
+
315
+ ## Use Cases
316
+
317
+ ### Single-Page Application (SPA)
318
+
319
+ Serve your SPA's `index.html` for all routes to enable client-side routing:
320
+
321
+ > [!TIP]
322
+ > This is the default behavior of Nitro when used with Vite.