nitro-nightly 3.0.0-beta-28969273.f7aa9de6 → 4.0.0-20251010-091516-7cafddba

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 (417) hide show
  1. package/README.md +8 -39
  2. package/dist/_chunks/app.mjs +19797 -0
  3. package/dist/_chunks/build.mjs +84 -0
  4. package/dist/_chunks/build2.mjs +318 -0
  5. package/dist/_chunks/build3.mjs +6452 -0
  6. package/dist/_chunks/detect-acorn.mjs +503 -0
  7. package/dist/_chunks/index.mjs +22242 -0
  8. package/dist/_chunks/index2.mjs +297 -0
  9. package/dist/_chunks/index3.mjs +1058 -0
  10. package/dist/_chunks/index4.mjs +1206 -0
  11. package/dist/_chunks/info.mjs +11157 -0
  12. package/dist/_chunks/json5.mjs +68 -0
  13. package/dist/_chunks/jsonc.mjs +51 -0
  14. package/dist/_chunks/pathe.M-eThtNZ.mjs +204 -0
  15. package/dist/_chunks/plugin.mjs +960 -0
  16. package/dist/_chunks/server.mjs +254 -0
  17. package/dist/_chunks/snapshot.mjs +284 -0
  18. package/dist/_chunks/toml.mjs +259 -0
  19. package/dist/_chunks/yaml.mjs +86 -0
  20. package/dist/cli/build.mjs +10 -3
  21. package/dist/cli/dev.mjs +41 -9
  22. package/dist/cli/index.mjs +460 -1
  23. package/dist/cli/index2.mjs +4 -1
  24. package/dist/cli/list.mjs +10 -4
  25. package/dist/cli/prepare.mjs +6 -3
  26. package/dist/cli/run.mjs +7 -4
  27. package/dist/index.d.mts +52 -0
  28. package/dist/index.mjs +55 -0
  29. package/dist/node_modules/@poppinss/colors/build/index.js +169 -0
  30. package/dist/node_modules/@poppinss/colors/package.json +116 -0
  31. package/dist/node_modules/@poppinss/dumper/build/chunk-26HALFTP.js +602 -0
  32. package/dist/node_modules/@poppinss/dumper/build/formatters/console/main.js +441 -0
  33. package/dist/node_modules/@poppinss/dumper/build/formatters/html/main.js +717 -0
  34. package/dist/node_modules/@poppinss/dumper/package.json +122 -0
  35. package/dist/node_modules/@poppinss/exception/build/index.js +63 -0
  36. package/dist/node_modules/@poppinss/exception/package.json +106 -0
  37. package/dist/node_modules/@sindresorhus/is/distribution/index.js +1313 -0
  38. package/dist/node_modules/@sindresorhus/is/distribution/utilities.js +3 -0
  39. package/dist/node_modules/@sindresorhus/is/package.json +81 -0
  40. package/dist/node_modules/@speed-highlight/core/dist/index.js +4 -0
  41. package/dist/node_modules/@speed-highlight/core/dist/terminal.js +2 -0
  42. package/dist/node_modules/@speed-highlight/core/package.json +90 -0
  43. package/dist/node_modules/cookie/dist/index.js +239 -0
  44. package/dist/node_modules/cookie/package.json +42 -0
  45. package/dist/node_modules/croner/dist/croner.js +1 -0
  46. package/dist/node_modules/croner/package.json +63 -0
  47. package/dist/node_modules/defu/dist/defu.mjs +69 -0
  48. package/dist/node_modules/defu/package.json +43 -0
  49. package/dist/node_modules/destr/dist/index.mjs +72 -0
  50. package/dist/node_modules/destr/package.json +47 -0
  51. package/dist/node_modules/error-stack-parser-es/dist/index.mjs +38 -0
  52. package/dist/node_modules/error-stack-parser-es/dist/lite.mjs +167 -0
  53. package/dist/node_modules/error-stack-parser-es/package.json +83 -0
  54. package/dist/node_modules/get-port-please/dist/index.mjs +430 -0
  55. package/dist/node_modules/get-port-please/package.json +39 -0
  56. package/dist/node_modules/hookable/dist/index.mjs +290 -0
  57. package/dist/node_modules/hookable/package.json +49 -0
  58. package/dist/node_modules/kleur/index.js +110 -0
  59. package/dist/node_modules/kleur/index.mjs +110 -0
  60. package/dist/node_modules/kleur/package.json +51 -0
  61. package/dist/node_modules/klona/dist/index.mjs +81 -0
  62. package/dist/node_modules/klona/full/index.mjs +53 -0
  63. package/dist/node_modules/klona/package.json +74 -0
  64. package/dist/node_modules/scule/dist/index.mjs +80 -0
  65. package/dist/node_modules/scule/package.json +43 -0
  66. package/dist/node_modules/source-map/lib/array-set.js +100 -0
  67. package/dist/node_modules/source-map/lib/base64-vlq.js +94 -0
  68. package/dist/node_modules/source-map/lib/base64.js +19 -0
  69. package/dist/node_modules/source-map/lib/binary-search.js +113 -0
  70. package/dist/node_modules/source-map/lib/mapping-list.js +83 -0
  71. package/dist/node_modules/source-map/lib/mappings.wasm +0 -0
  72. package/dist/node_modules/source-map/lib/read-wasm.js +27 -0
  73. package/dist/node_modules/source-map/lib/source-map-consumer.js +1081 -0
  74. package/dist/node_modules/source-map/lib/source-map-generator.js +439 -0
  75. package/dist/node_modules/source-map/lib/source-node.js +430 -0
  76. package/dist/node_modules/source-map/lib/url.js +13 -0
  77. package/dist/node_modules/source-map/lib/util.js +444 -0
  78. package/dist/node_modules/source-map/lib/wasm.js +138 -0
  79. package/dist/node_modules/source-map/package.json +79 -0
  80. package/dist/node_modules/source-map/source-map.js +10 -0
  81. package/dist/node_modules/std-env/dist/index.mjs +1 -0
  82. package/dist/node_modules/std-env/package.json +46 -0
  83. package/dist/node_modules/supports-color/index.js +202 -0
  84. package/dist/node_modules/supports-color/package.json +64 -0
  85. package/dist/node_modules/ufo/dist/index.mjs +638 -0
  86. package/dist/node_modules/ufo/package.json +47 -0
  87. package/dist/node_modules/unctx/dist/index.mjs +131 -0
  88. package/dist/node_modules/unctx/package.json +67 -0
  89. package/dist/node_modules/youch/build/chunk-4L7RY2JA.js +42 -0
  90. package/dist/node_modules/youch/build/chunk-4XB2BYKC.js +85 -0
  91. package/dist/node_modules/youch/build/chunk-4YEN7HVQ.js +61 -0
  92. package/dist/node_modules/youch/build/chunk-EUJBVOYB.js +83 -0
  93. package/dist/node_modules/youch/build/chunk-HFSXRSKS.js +85 -0
  94. package/dist/node_modules/youch/build/chunk-JAN2TFI2.js +222 -0
  95. package/dist/node_modules/youch/build/chunk-OSUFJZHZ.js +6 -0
  96. package/dist/node_modules/youch/build/chunk-PINJDICN.js +72 -0
  97. package/dist/node_modules/youch/build/chunk-PUHGL6HA.js +41 -0
  98. package/dist/node_modules/youch/build/chunk-VE4LENUR.js +45 -0
  99. package/dist/node_modules/youch/build/index.js +352 -0
  100. package/dist/node_modules/youch/build/public/error_cause/style.css +5 -0
  101. package/dist/node_modules/youch/build/public/error_info/script.js +13 -0
  102. package/dist/node_modules/youch/build/public/error_info/style.css +144 -0
  103. package/dist/node_modules/youch/build/public/error_stack/script.js +74 -0
  104. package/dist/node_modules/youch/build/public/error_stack/style.css +220 -0
  105. package/dist/node_modules/youch/build/public/error_stack_source/style.css +123 -0
  106. package/dist/node_modules/youch/build/public/header/script.js +16 -0
  107. package/dist/node_modules/youch/build/public/header/style.css +56 -0
  108. package/dist/node_modules/youch/build/public/layout/script.js +20 -0
  109. package/dist/node_modules/youch/build/public/layout/style.css +431 -0
  110. package/dist/node_modules/youch/package.json +133 -0
  111. package/dist/node_modules/youch-core/build/index.js +316 -0
  112. package/dist/node_modules/youch-core/package.json +124 -0
  113. package/dist/presets/_nitro/runtime/nitro-dev.mjs +48 -73
  114. package/dist/presets/_nitro/runtime/{nitro-prerenderer.d.ts → nitro-prerenderer.d.mts} +1 -1
  115. package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +12 -1
  116. package/dist/presets/_nitro/runtime/service-worker.mjs +5 -15
  117. package/dist/presets/aws-amplify/runtime/aws-amplify.mjs +2 -2
  118. package/dist/presets/aws-lambda/runtime/_utils.d.mts +18 -0
  119. package/dist/presets/aws-lambda/runtime/_utils.mjs +102 -0
  120. package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.d.mts +3 -0
  121. package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +12 -32
  122. package/dist/presets/aws-lambda/runtime/aws-lambda.d.mts +3 -0
  123. package/dist/presets/aws-lambda/runtime/aws-lambda.mjs +6 -38
  124. package/dist/{runtime/internal/utils.azure.d.ts → presets/azure/runtime/_utils.d.mts} +1 -1
  125. package/dist/{runtime/internal/utils.azure.mjs → presets/azure/runtime/_utils.mjs} +3 -4
  126. package/dist/presets/azure/runtime/azure-swa.mjs +11 -13
  127. package/dist/presets/bun/runtime/bun.mjs +13 -18
  128. package/dist/presets/cloudflare/runtime/_module-handler.d.mts +13 -0
  129. package/dist/presets/cloudflare/runtime/_module-handler.mjs +93 -0
  130. package/dist/presets/cloudflare/runtime/cloudflare-durable.d.mts +19 -0
  131. package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +74 -0
  132. package/dist/presets/cloudflare/runtime/cloudflare-module.d.mts +9 -0
  133. package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +13 -97
  134. package/dist/presets/cloudflare/runtime/{cloudflare-pages.d.ts → cloudflare-pages.d.mts} +1 -1
  135. package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +19 -27
  136. package/dist/{runtime/internal/timing.d.ts → presets/cloudflare/runtime/plugin.dev.d.mts} +1 -0
  137. package/dist/presets/cloudflare/runtime/plugin.dev.mjs +89 -0
  138. package/dist/presets/deno/runtime/deno-deploy.mjs +11 -25
  139. package/dist/presets/deno/runtime/deno-server.d.mts +6 -0
  140. package/dist/presets/deno/runtime/deno-server.mjs +15 -21
  141. package/dist/presets/netlify/runtime/netlify-edge.d.mts +3 -0
  142. package/dist/presets/netlify/runtime/netlify-edge.mjs +8 -16
  143. package/dist/presets/netlify/runtime/netlify.mjs +16 -45
  144. package/dist/presets/node/runtime/{cluster.mjs → node-cluster.mjs} +1 -3
  145. package/dist/presets/node/runtime/node-middleware.d.mts +4 -0
  146. package/dist/presets/node/runtime/{node-listener.mjs → node-middleware.mjs} +3 -4
  147. package/dist/presets/node/runtime/node-server.mjs +3 -4
  148. package/dist/presets/standard/runtime/server.d.mts +5 -0
  149. package/dist/presets/standard/runtime/server.mjs +6 -0
  150. package/dist/presets/stormkit/runtime/stormkit.mjs +8 -12
  151. package/dist/presets/vercel/runtime/vercel.d.mts +8 -0
  152. package/dist/presets/vercel/runtime/vercel.mjs +11 -11
  153. package/dist/presets/winterjs/runtime/winterjs.mjs +22 -4
  154. package/dist/presets/{node/runtime/node-server.d.ts → zeabur/runtime/zeabur.d.mts} +1 -1
  155. package/dist/presets/zeabur/runtime/zeabur.mjs +2 -6
  156. package/dist/presets.mjs +2460 -0
  157. package/dist/runtime/index.d.mts +11 -0
  158. package/dist/runtime/index.mjs +8 -8
  159. package/dist/runtime/internal/app.d.mts +2 -0
  160. package/dist/runtime/internal/app.mjs +129 -128
  161. package/dist/runtime/internal/cache.d.mts +7 -0
  162. package/dist/runtime/internal/cache.mjs +82 -175
  163. package/dist/runtime/internal/{context.d.ts → context.d.mts} +3 -3
  164. package/dist/runtime/internal/context.mjs +6 -6
  165. package/dist/runtime/internal/error/dev.d.mts +9 -0
  166. package/dist/runtime/internal/error/dev.mjs +122 -0
  167. package/dist/runtime/internal/error/prod.d.mts +8 -0
  168. package/dist/runtime/internal/error/prod.mjs +62 -0
  169. package/dist/runtime/internal/error/utils.d.mts +8 -0
  170. package/dist/runtime/internal/error/utils.mjs +3 -0
  171. package/dist/runtime/internal/index.d.mts +3 -0
  172. package/dist/runtime/internal/index.mjs +1 -14
  173. package/dist/runtime/internal/renderer.d.mts +3 -0
  174. package/dist/runtime/internal/renderer.mjs +29 -33
  175. package/dist/runtime/internal/route-rules.d.mts +8 -0
  176. package/dist/runtime/internal/route-rules.mjs +58 -63
  177. package/dist/runtime/internal/routes/dev-tasks.d.mts +3 -0
  178. package/dist/runtime/internal/routes/dev-tasks.mjs +23 -0
  179. package/dist/runtime/internal/routes/openapi.d.mts +3 -0
  180. package/dist/runtime/internal/routes/openapi.mjs +24 -9
  181. package/dist/runtime/internal/routes/renderer-template.d.mts +2 -0
  182. package/dist/runtime/internal/routes/renderer-template.dev.d.mts +3 -0
  183. package/dist/runtime/internal/routes/renderer-template.dev.mjs +21 -0
  184. package/dist/runtime/internal/routes/renderer-template.mjs +4 -0
  185. package/dist/runtime/internal/routes/scalar.d.mts +3 -0
  186. package/dist/runtime/internal/routes/scalar.mjs +7 -4
  187. package/dist/runtime/internal/routes/swagger.d.mts +3 -0
  188. package/dist/runtime/internal/routes/swagger.mjs +5 -4
  189. package/dist/runtime/internal/{utils.env.d.ts → runtime-config.d.mts} +4 -2
  190. package/dist/runtime/internal/{utils.env.mjs → runtime-config.mjs} +16 -6
  191. package/dist/runtime/internal/static.d.mts +3 -0
  192. package/dist/runtime/internal/static.mjs +24 -36
  193. package/dist/runtime/internal/storage.mjs +2 -1
  194. package/dist/runtime/internal/task.mjs +6 -6
  195. package/dist/runtime/internal/utils.d.mts +1 -0
  196. package/dist/runtime/internal/utils.mjs +1 -116
  197. package/dist/runtime/internal/vite/dev-entry.d.mts +1 -0
  198. package/dist/runtime/internal/vite/dev-entry.mjs +6 -0
  199. package/dist/runtime/internal/vite/dev-worker.mjs +362 -0
  200. package/dist/runtime/internal/vite/prod-setup.d.mts +4 -0
  201. package/dist/runtime/internal/vite/prod-setup.mjs +55 -0
  202. package/dist/runtime/internal/vite/ssr-renderer.d.mts +4 -0
  203. package/dist/runtime/internal/vite/ssr-renderer.mjs +4 -0
  204. package/dist/types/index.d.mts +2688 -138
  205. package/dist/vite.d.mts +59 -0
  206. package/dist/vite.mjs +68 -0
  207. package/lib/config.d.mts +9 -0
  208. package/lib/deps/h3.d.mts +1 -0
  209. package/lib/deps/h3.mjs +1 -0
  210. package/lib/deps/ofetch.mjs +1 -0
  211. package/lib/deps/ofetch.mts +1 -0
  212. package/lib/meta.d.mts +5 -0
  213. package/lib/meta.mjs +21 -0
  214. package/{runtime-meta.d.ts → lib/runtime-meta.d.mts} +1 -0
  215. package/{runtime-meta.mjs → lib/runtime-meta.mjs} +12 -4
  216. package/package.json +142 -160
  217. package/cli.d.ts +0 -1
  218. package/config.d.ts +0 -1
  219. package/core.d.ts +0 -1
  220. package/dist/cli/index.d.ts +0 -1
  221. package/dist/config/index.d.mts +0 -6
  222. package/dist/config/index.d.ts +0 -6
  223. package/dist/core/index.d.mts +0 -30
  224. package/dist/core/index.d.ts +0 -30
  225. package/dist/core/index.mjs +0 -2456
  226. package/dist/kit/index.d.mts +0 -44
  227. package/dist/kit/index.d.ts +0 -44
  228. package/dist/kit/index.mjs +0 -71
  229. package/dist/meta/index.d.mts +0 -3
  230. package/dist/meta/index.d.ts +0 -3
  231. package/dist/meta/index.mjs +0 -3
  232. package/dist/presets/_all.gen.d.ts +0 -2
  233. package/dist/presets/_all.gen.mjs +0 -52
  234. package/dist/presets/_nitro/base-worker.d.ts +0 -2
  235. package/dist/presets/_nitro/base-worker.mjs +0 -25
  236. package/dist/presets/_nitro/nitro-dev.d.ts +0 -2
  237. package/dist/presets/_nitro/nitro-dev.mjs +0 -19
  238. package/dist/presets/_nitro/nitro-prerender.d.ts +0 -2
  239. package/dist/presets/_nitro/nitro-prerender.mjs +0 -17
  240. package/dist/presets/_nitro/preset.d.ts +0 -2
  241. package/dist/presets/_nitro/preset.mjs +0 -5
  242. package/dist/presets/_nitro/service-worker.d.ts +0 -2
  243. package/dist/presets/_nitro/service-worker.mjs +0 -110
  244. package/dist/presets/_resolve.d.ts +0 -8
  245. package/dist/presets/_resolve.mjs +0 -44
  246. package/dist/presets/_static/preset.d.ts +0 -2
  247. package/dist/presets/_static/preset.mjs +0 -69
  248. package/dist/presets/_types.gen.d.ts +0 -16
  249. package/dist/presets/alwaysdata/preset.d.ts +0 -2
  250. package/dist/presets/alwaysdata/preset.mjs +0 -14
  251. package/dist/presets/aws-amplify/preset.d.ts +0 -3
  252. package/dist/presets/aws-amplify/preset.mjs +0 -27
  253. package/dist/presets/aws-amplify/types.d.ts +0 -141
  254. package/dist/presets/aws-amplify/utils.d.ts +0 -2
  255. package/dist/presets/aws-amplify/utils.mjs +0 -82
  256. package/dist/presets/aws-lambda/preset.d.ts +0 -2
  257. package/dist/presets/aws-lambda/preset.mjs +0 -21
  258. package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.d.ts +0 -14
  259. package/dist/presets/aws-lambda/runtime/aws-lambda.d.ts +0 -4
  260. package/dist/presets/azure/preset.d.ts +0 -3
  261. package/dist/presets/azure/preset.mjs +0 -44
  262. package/dist/presets/azure/runtime/azure-functions.mjs +0 -24
  263. package/dist/presets/azure/runtime/azure-swa.d.ts +0 -5
  264. package/dist/presets/azure/types.d.ts +0 -13
  265. package/dist/presets/azure/types.mjs +0 -0
  266. package/dist/presets/azure/utils.d.ts +0 -3
  267. package/dist/presets/azure/utils.mjs +0 -183
  268. package/dist/presets/bun/preset.d.ts +0 -2
  269. package/dist/presets/bun/preset.mjs +0 -17
  270. package/dist/presets/cleavr/preset.d.ts +0 -2
  271. package/dist/presets/cleavr/preset.mjs +0 -12
  272. package/dist/presets/cloudflare/preset.d.ts +0 -3
  273. package/dist/presets/cloudflare/preset.mjs +0 -145
  274. package/dist/presets/cloudflare/runtime/cloudflare-module.d.ts +0 -13
  275. package/dist/presets/cloudflare/runtime/cloudflare-worker.mjs +0 -64
  276. package/dist/presets/cloudflare/types.d.ts +0 -89
  277. package/dist/presets/cloudflare/types.mjs +0 -0
  278. package/dist/presets/cloudflare/types.wrangler.d.ts +0 -974
  279. package/dist/presets/cloudflare/types.wrangler.mjs +0 -0
  280. package/dist/presets/cloudflare/utils.d.ts +0 -3
  281. package/dist/presets/cloudflare/utils.mjs +0 -163
  282. package/dist/presets/deno/preset.d.ts +0 -2
  283. package/dist/presets/deno/preset.mjs +0 -148
  284. package/dist/presets/deno/runtime/_deno-env-polyfill.d.ts +0 -0
  285. package/dist/presets/deno/runtime/_deno-env-polyfill.mjs +0 -1
  286. package/dist/presets/digitalocean/preset.d.ts +0 -2
  287. package/dist/presets/digitalocean/preset.mjs +0 -11
  288. package/dist/presets/edgio/preset.d.ts +0 -2
  289. package/dist/presets/edgio/preset.mjs +0 -95
  290. package/dist/presets/firebase/preset.d.ts +0 -3
  291. package/dist/presets/firebase/preset.mjs +0 -50
  292. package/dist/presets/firebase/runtime/firebase-gen-1.d.ts +0 -2
  293. package/dist/presets/firebase/runtime/firebase-gen-1.mjs +0 -7
  294. package/dist/presets/firebase/runtime/firebase-gen-2.d.ts +0 -2
  295. package/dist/presets/firebase/runtime/firebase-gen-2.mjs +0 -14
  296. package/dist/presets/firebase/runtime/firebase-gen-default.d.ts +0 -1
  297. package/dist/presets/firebase/runtime/firebase-gen-default.mjs +0 -1
  298. package/dist/presets/firebase/types.d.ts +0 -38
  299. package/dist/presets/firebase/types.mjs +0 -0
  300. package/dist/presets/firebase/utils.d.ts +0 -3
  301. package/dist/presets/firebase/utils.mjs +0 -50
  302. package/dist/presets/flightcontrol/preset.d.ts +0 -2
  303. package/dist/presets/flightcontrol/preset.mjs +0 -11
  304. package/dist/presets/heroku/preset.d.ts +0 -2
  305. package/dist/presets/heroku/preset.mjs +0 -11
  306. package/dist/presets/iis/preset.d.ts +0 -2
  307. package/dist/presets/iis/preset.mjs +0 -32
  308. package/dist/presets/iis/utils.d.ts +0 -3
  309. package/dist/presets/iis/utils.mjs +0 -161
  310. package/dist/presets/index.d.mts +0 -1
  311. package/dist/presets/index.d.ts +0 -2
  312. package/dist/presets/index.mjs +0 -1
  313. package/dist/presets/koyeb/preset.d.ts +0 -2
  314. package/dist/presets/koyeb/preset.mjs +0 -11
  315. package/dist/presets/netlify/legacy/preset.d.ts +0 -2
  316. package/dist/presets/netlify/legacy/preset.mjs +0 -143
  317. package/dist/presets/netlify/legacy/runtime/_deno-env-polyfill.d.ts +0 -0
  318. package/dist/presets/netlify/legacy/runtime/_deno-env-polyfill.mjs +0 -1
  319. package/dist/presets/netlify/legacy/runtime/netlify-builder.d.ts +0 -3
  320. package/dist/presets/netlify/legacy/runtime/netlify-builder.mjs +0 -5
  321. package/dist/presets/netlify/legacy/runtime/netlify-edge.d.ts +0 -2
  322. package/dist/presets/netlify/legacy/runtime/netlify-edge.mjs +0 -25
  323. package/dist/presets/netlify/legacy/runtime/netlify-lambda.d.ts +0 -3
  324. package/dist/presets/netlify/legacy/runtime/netlify-lambda.mjs +0 -38
  325. package/dist/presets/netlify/legacy/runtime/netlify.d.ts +0 -4
  326. package/dist/presets/netlify/legacy/runtime/netlify.mjs +0 -22
  327. package/dist/presets/netlify/legacy/utils.d.ts +0 -4
  328. package/dist/presets/netlify/legacy/utils.mjs +0 -113
  329. package/dist/presets/netlify/preset.d.ts +0 -3
  330. package/dist/presets/netlify/preset.mjs +0 -128
  331. package/dist/presets/netlify/runtime/_deno-env-polyfill.d.ts +0 -0
  332. package/dist/presets/netlify/runtime/_deno-env-polyfill.mjs +0 -1
  333. package/dist/presets/netlify/runtime/netlify-edge.d.ts +0 -2
  334. package/dist/presets/netlify/types.d.ts +0 -12
  335. package/dist/presets/netlify/types.mjs +0 -0
  336. package/dist/presets/netlify/utils.d.ts +0 -5
  337. package/dist/presets/netlify/utils.mjs +0 -94
  338. package/dist/presets/node/preset.d.ts +0 -2
  339. package/dist/presets/node/preset.mjs +0 -49
  340. package/dist/presets/node/runtime/cli.d.ts +0 -1
  341. package/dist/presets/node/runtime/cli.mjs +0 -22
  342. package/dist/presets/node/runtime/node-listener.d.ts +0 -6
  343. package/dist/presets/platform.sh/preset.d.ts +0 -2
  344. package/dist/presets/platform.sh/preset.mjs +0 -11
  345. package/dist/presets/render.com/preset.d.ts +0 -2
  346. package/dist/presets/render.com/preset.mjs +0 -11
  347. package/dist/presets/stormkit/preset.d.ts +0 -2
  348. package/dist/presets/stormkit/preset.mjs +0 -15
  349. package/dist/presets/vercel/preset.d.ts +0 -3
  350. package/dist/presets/vercel/preset.mjs +0 -104
  351. package/dist/presets/vercel/runtime/vercel-edge.d.ts +0 -2
  352. package/dist/presets/vercel/runtime/vercel-edge.mjs +0 -22
  353. package/dist/presets/vercel/runtime/vercel.d.ts +0 -4
  354. package/dist/presets/vercel/types.d.ts +0 -78
  355. package/dist/presets/vercel/types.mjs +0 -0
  356. package/dist/presets/vercel/utils.d.ts +0 -5
  357. package/dist/presets/vercel/utils.mjs +0 -186
  358. package/dist/presets/winterjs/preset.d.ts +0 -2
  359. package/dist/presets/winterjs/preset.mjs +0 -20
  360. package/dist/presets/winterjs/runtime/winterjs.d.ts +0 -1
  361. package/dist/presets/zeabur/preset.d.ts +0 -2
  362. package/dist/presets/zeabur/preset.mjs +0 -70
  363. package/dist/presets/zeabur/runtime/zeabur.d.ts +0 -4
  364. package/dist/rollup/index.d.mts +0 -5
  365. package/dist/rollup/index.d.ts +0 -5
  366. package/dist/rollup/index.mjs +0 -1673
  367. package/dist/runtime/index.d.ts +0 -12
  368. package/dist/runtime/internal/app.d.ts +0 -3
  369. package/dist/runtime/internal/cache.d.ts +0 -8
  370. package/dist/runtime/internal/client.mjs +0 -4
  371. package/dist/runtime/internal/config.d.ts +0 -5
  372. package/dist/runtime/internal/config.mjs +0 -45
  373. package/dist/runtime/internal/error.d.ts +0 -4
  374. package/dist/runtime/internal/error.mjs +0 -73
  375. package/dist/runtime/internal/index.d.ts +0 -6
  376. package/dist/runtime/internal/renderer.d.ts +0 -2
  377. package/dist/runtime/internal/route-rules.d.ts +0 -14
  378. package/dist/runtime/internal/routes/openapi.d.ts +0 -3
  379. package/dist/runtime/internal/routes/scalar.d.ts +0 -2
  380. package/dist/runtime/internal/routes/swagger.d.ts +0 -2
  381. package/dist/runtime/internal/static.d.ts +0 -2
  382. package/dist/runtime/internal/timing.mjs +0 -29
  383. package/dist/runtime/internal/utils.d.ts +0 -21
  384. package/dist/runtime/internal/utils.lambda.d.ts +0 -10
  385. package/dist/runtime/internal/utils.lambda.mjs +0 -30
  386. package/dist/shared/nitro.bra5i6ER.d.mts +0 -620
  387. package/dist/shared/nitro.bra5i6ER.d.ts +0 -620
  388. package/dist/types/index.d.ts +0 -260
  389. package/kit.d.ts +0 -1
  390. package/meta.d.ts +0 -1
  391. package/presets.d.ts +0 -1
  392. package/rollup.d.ts +0 -1
  393. package/runtime.d.ts +0 -1
  394. package/types.d.ts +0 -1
  395. /package/dist/presets/_nitro/runtime/{nitro-dev.d.ts → nitro-dev.d.mts} +0 -0
  396. /package/dist/presets/_nitro/runtime/{service-worker.d.ts → service-worker.d.mts} +0 -0
  397. /package/dist/presets/aws-amplify/runtime/{aws-amplify.d.ts → aws-amplify.d.mts} +0 -0
  398. /package/dist/presets/azure/runtime/{azure-functions.d.ts → azure-swa.d.mts} +0 -0
  399. /package/dist/presets/bun/runtime/{bun.d.ts → bun.d.mts} +0 -0
  400. /package/dist/presets/{cloudflare/runtime/cloudflare-worker.d.ts → deno/runtime/deno-deploy.d.mts} +0 -0
  401. /package/dist/presets/netlify/runtime/{netlify.d.ts → netlify.d.mts} +0 -0
  402. /package/dist/presets/node/runtime/{cluster.d.ts → node-cluster.d.mts} +0 -0
  403. /package/dist/presets/{deno/runtime/deno-server.d.ts → node/runtime/node-server.d.mts} +0 -0
  404. /package/dist/presets/stormkit/runtime/{stormkit.d.ts → stormkit.d.mts} +0 -0
  405. /package/dist/presets/{deno/runtime/deno-deploy.d.ts → winterjs/runtime/winterjs.d.mts} +0 -0
  406. /package/dist/runtime/internal/{database.d.ts → database.d.mts} +0 -0
  407. /package/dist/runtime/internal/{debug.d.ts → debug.d.mts} +0 -0
  408. /package/dist/{presets/_types.gen.mjs → runtime/internal/empty.d.mts} +0 -0
  409. /package/dist/{presets/aws-amplify/types.mjs → runtime/internal/empty.mjs} +0 -0
  410. /package/dist/runtime/internal/lib/{http-graceful-shutdown.d.ts → http-graceful-shutdown.d.mts} +0 -0
  411. /package/dist/runtime/internal/{meta.d.ts → meta.d.mts} +0 -0
  412. /package/dist/runtime/internal/{plugin.d.ts → plugin.d.mts} +0 -0
  413. /package/dist/runtime/internal/{shutdown.d.ts → shutdown.d.mts} +0 -0
  414. /package/dist/runtime/internal/{storage.d.ts → storage.d.mts} +0 -0
  415. /package/dist/runtime/internal/{task.d.ts → task.d.mts} +0 -0
  416. /package/dist/runtime/internal/{client.d.ts → vite/dev-worker.d.mts} +0 -0
  417. /package/{dist/config/index.mjs → lib/config.mjs} +0 -0
@@ -1,36 +1,99 @@
1
- import { App, Router, H3Event, AppOptions, RouterMethod } from 'h3';
1
+ import { HTTPMethod, HTTPEvent, H3Core, H3EventContext, HTTPHandler, HTTPError, ProxyOptions, Middleware } from 'h3';
2
2
  import { FetchRequest, FetchOptions, FetchResponse } from 'ofetch';
3
- import { a as NitroConfig, N as NitroModule, b as NitroOptions } from '../shared/nitro.bra5i6ER.mjs';
4
- export { C as CacheEntry, c as CacheOptions, d as CachedEventHandlerOptions, e as CompressOptions, g as DatabaseConnectionConfig, h as DatabaseConnectionConfigs, D as DatabaseConnectionName, k as DevServerOptions, G as EsbuildOptions, K as HTTPStatusCode, L as LoadConfigOptions, t as Nitro, x as NitroBuildInfo, p as NitroDevEventHandler, m as NitroDevServer, u as NitroDynamicConfig, q as NitroErrorHandler, o as NitroEventHandler, w as NitroFrameworkInfo, r as NitroHooks, s as NitroModuleInput, A as NitroPreset, B as NitroPresetMeta, M as NitroRouteConfig, n as NitroRouteMeta, O as NitroRouteRules, j as NitroRuntimeConfig, i as NitroRuntimeConfigApp, v as NitroTypes, l as NitroWorker, H as NodeExternalsOptions, z as PrerenderGenerateRoute, y as PrerenderRoute, P as PublicAssetDir, J as RawOptions, R as ResponseCacheEntry, E as RollupConfig, F as RollupVirtualOptions, S as ServerAssetDir, I as ServerAssetOptions, f as StorageMounts, V as VirtualModule } from '../shared/nitro.bra5i6ER.mjs';
5
- import { Hookable } from 'hookable';
6
- import { createCall, createFetch } from 'unenv/runtime/fetch/index';
7
- import { CaptureError as CaptureError$1, CapturedErrorContext as CapturedErrorContext$1, CacheOptions } from 'nitro/types';
8
- import 'consola';
9
- import 'nitro/presets';
10
- import 'unimport';
11
- import 'unstorage';
12
- import '@rollup/plugin-commonjs';
13
- import 'c12';
14
- import 'chokidar';
15
- import 'compatx';
16
- import 'db0';
17
- import 'httpxy';
18
- import 'pkg-types';
19
- import 'rollup-plugin-visualizer';
20
- import 'unenv';
21
- import 'unimport/unplugin';
22
- import 'unwasm/plugin';
23
- import 'node:http';
24
- import 'node:stream';
25
- import 'node:worker_threads';
26
- import 'listhen';
27
- import 'openapi-typescript';
28
- import '@rollup/pluginutils';
29
- import '@vercel/nft';
30
- import 'esbuild';
31
- import 'rollup';
32
- import '@scalar/api-reference';
33
- import 'std-env';
3
+ import { Hookable, NestedHooks } from 'hookable';
4
+ import { ServerRequestContext, ServerRequest } from 'srvx';
5
+ import { Jiti, JitiOptions } from 'jiti';
6
+ import { Stats } from 'fs';
7
+ import { diff } from 'ohash/utils';
8
+ import { ConsolaInstance, LogLevel } from 'consola';
9
+ import { ConnectorName } from 'db0';
10
+ import * as stream from 'node:stream';
11
+ import { Duplex } from 'node:stream';
12
+ import { PresetName, PresetOptions, PresetNameInput } from 'nitro/presets';
13
+ import { CompilerOptions, TypeAcquisition } from 'typescript';
14
+ import { Preset as Preset$1 } from 'unenv';
15
+ import { Storage, BuiltinDriverName } from 'unstorage';
16
+ import { IncomingMessage, OutgoingMessage } from 'node:http';
17
+ import { TransformOptions, Loader } from 'esbuild';
18
+ import { InputOptions, OutputOptions } from 'rollup';
19
+ import { ProviderName } from 'std-env';
20
+ import { ExternalsPluginOptions } from 'nf3';
21
+ export { ExternalsPluginOptions as NodeExternalsOptions } from 'nf3';
22
+
23
+ interface InternalApi {
24
+ }
25
+ type RouterMethod = Lowercase<HTTPMethod>;
26
+ type NitroFetchRequest = Exclude<keyof InternalApi, `/_${string}` | `/api/_${string}`> | Exclude<FetchRequest, string> | (string & {});
27
+ type MiddlewareOf<Route extends string, Method extends RouterMethod | "default"> = Method extends keyof InternalApi[MatchedRoutes<Route>] ? InternalApi[MatchedRoutes<Route>][Method] : never;
28
+ type TypedInternalResponse<Route, Default = unknown, Method extends RouterMethod = RouterMethod> = Default extends string | boolean | number | null | void | object ? Default : Route extends string ? MiddlewareOf<Route, Method> extends never ? MiddlewareOf<Route, "default"> extends never ? Default : MiddlewareOf<Route, "default"> : MiddlewareOf<Route, Method> : Default;
29
+ type AvailableRouterMethod<R extends NitroFetchRequest> = R extends string ? keyof InternalApi[MatchedRoutes<R>] extends undefined ? RouterMethod : Extract<keyof InternalApi[MatchedRoutes<R>], "default"> extends undefined ? Extract<RouterMethod, keyof InternalApi[MatchedRoutes<R>]> : RouterMethod : RouterMethod;
30
+ interface NitroFetchOptions<R extends NitroFetchRequest, M extends AvailableRouterMethod<R> = AvailableRouterMethod<R>> extends FetchOptions {
31
+ method?: Uppercase<M> | M;
32
+ }
33
+ type ExtractedRouteMethod<R extends NitroFetchRequest, O extends NitroFetchOptions<R>> = O extends undefined ? "get" : Lowercase<Exclude<O["method"], undefined>> extends RouterMethod ? Lowercase<Exclude<O["method"], undefined>> : "get";
34
+ type Base$Fetch<DefaultT = unknown, DefaultR extends NitroFetchRequest = NitroFetchRequest> = <T = DefaultT, R extends NitroFetchRequest = DefaultR, O extends NitroFetchOptions<R> = NitroFetchOptions<R>>(request: R, opts?: O) => Promise<TypedInternalResponse<R, T, NitroFetchOptions<R> extends O ? "get" : ExtractedRouteMethod<R, O>>>;
35
+ interface $Fetch<DefaultT = unknown, DefaultR extends NitroFetchRequest = NitroFetchRequest> extends Base$Fetch<DefaultT, DefaultR> {
36
+ raw<T = DefaultT, R extends NitroFetchRequest = DefaultR, O extends NitroFetchOptions<R> = NitroFetchOptions<R>>(request: R, opts?: O): Promise<FetchResponse<TypedInternalResponse<R, T, NitroFetchOptions<R> extends O ? "get" : ExtractedRouteMethod<R, O>>>>;
37
+ create<T = DefaultT, R extends NitroFetchRequest = DefaultR>(defaults: FetchOptions): $Fetch<T, R>;
38
+ }
39
+
40
+ type MatchResult<Key extends string, Exact extends boolean = false, Score extends any[] = [], catchAll extends boolean = false> = {
41
+ [k in Key]: {
42
+ key: k;
43
+ exact: Exact;
44
+ score: Score;
45
+ catchAll: catchAll;
46
+ };
47
+ }[Key];
48
+ type Subtract<Minuend extends any[] = [], Subtrahend extends any[] = []> = Minuend extends [...Subtrahend, ...infer Remainder] ? Remainder : never;
49
+ type TupleIfDiff<First extends string, Second extends string, Tuple extends any[] = []> = First extends `${Second}${infer Diff}` ? Diff extends "" ? [] : Tuple : [];
50
+ type MaxTuple<N extends any[] = [], T extends any[] = []> = {
51
+ current: T;
52
+ result: MaxTuple<N, ["", ...T]>;
53
+ }[[N["length"]] extends [Partial<T>["length"]] ? "current" : "result"];
54
+ type CalcMatchScore<Key extends string, Route extends string, Score extends any[] = [], Init extends boolean = false, FirstKeySegMatcher extends string = Init extends true ? ":Invalid:" : ""> = `${Key}/` extends `${infer KeySeg}/${infer KeyRest}` ? KeySeg extends FirstKeySegMatcher ? Subtract<[
55
+ ...Score,
56
+ ...TupleIfDiff<Route, Key, ["", ""]>
57
+ ], TupleIfDiff<Key, Route, ["", ""]>> : `${Route}/` extends `${infer RouteSeg}/${infer RouteRest}` ? `${RouteSeg}?` extends `${infer RouteSegWithoutQuery}?${string}` ? RouteSegWithoutQuery extends KeySeg ? CalcMatchScore<KeyRest, RouteRest, [...Score, "", ""]> : KeySeg extends `:${string}` ? RouteSegWithoutQuery extends "" ? never : CalcMatchScore<KeyRest, RouteRest, [...Score, ""]> : KeySeg extends RouteSegWithoutQuery ? CalcMatchScore<KeyRest, RouteRest, [...Score, ""]> : never : never : never : never;
58
+ type _MatchedRoutes<Route extends string, MatchedResultUnion extends MatchResult<string> = MatchResult<keyof InternalApi>> = MatchedResultUnion["key"] extends infer MatchedKeys ? MatchedKeys extends string ? Route extends MatchedKeys ? MatchResult<MatchedKeys, true> : MatchedKeys extends `${infer Root}/**${string}` ? MatchedKeys extends `${string}/**` ? Route extends `${Root}/${string}` ? MatchResult<MatchedKeys, false, [], true> : never : MatchResult<MatchedKeys, false, CalcMatchScore<Root, Route, [], true>> : MatchResult<MatchedKeys, false, CalcMatchScore<MatchedKeys, Route, [], true>> : never : never;
59
+ type MatchedRoutes<Route extends string, MatchedKeysResult extends MatchResult<string> = MatchResult<keyof InternalApi>, Matches extends MatchResult<string> = _MatchedRoutes<Route, MatchedKeysResult>> = Route extends "/" ? keyof InternalApi : Extract<Matches, {
60
+ exact: true;
61
+ }> extends never ? Extract<Exclude<Matches, {
62
+ score: never;
63
+ }>, {
64
+ score: MaxTuple<Matches["score"]>;
65
+ }>["key"] | Extract<Matches, {
66
+ catchAll: true;
67
+ }>["key"] : Extract<Matches, {
68
+ exact: true;
69
+ }>["key"];
70
+
71
+ /**
72
+ * @link https://github.com/remix-run/remix/blob/2248669ed59fd716e267ea41df5d665d4781f4a9/packages/remix-server-runtime/serialize.ts
73
+ */
74
+ type JsonPrimitive = string | number | boolean | string | number | boolean | null;
75
+ type NonJsonPrimitive = undefined | Function | symbol;
76
+ type IsAny<T> = 0 extends 1 & T ? true : false;
77
+ type FilterKeys<TObj extends object, TFilter> = {
78
+ [TKey in keyof TObj]: TObj[TKey] extends TFilter ? TKey : never;
79
+ }[keyof TObj];
80
+ type Serialize<T> = IsAny<T> extends true ? any : T extends JsonPrimitive | undefined ? T : T extends Map<any, any> | Set<any> ? Record<string, never> : T extends NonJsonPrimitive ? never : T extends {
81
+ toJSON(): infer U;
82
+ } ? U : T extends [] ? [] : T extends [unknown, ...unknown[]] ? SerializeTuple<T> : T extends ReadonlyArray<infer U> ? (U extends NonJsonPrimitive ? null : Serialize<U>)[] : T extends object ? SerializeObject<T> : never;
83
+ /** JSON serialize [tuples](https://www.typescriptlang.org/docs/handbook/2/objects.html#tuple-types) */
84
+ type SerializeTuple<T extends [unknown, ...unknown[]]> = {
85
+ [k in keyof T]: T[k] extends NonJsonPrimitive ? null : Serialize<T[k]>;
86
+ };
87
+ /** JSON serialize objects (not including arrays) and classes */
88
+ type SerializeObject<T extends object> = {
89
+ [k in keyof Omit<T, FilterKeys<T, NonJsonPrimitive>>]: Serialize<T[k]>;
90
+ };
91
+ /**
92
+ * @see https://github.com/ianstormtaylor/superstruct/blob/7973400cd04d8ad92bbdc2b6f35acbfb3c934079/src/utils.ts#L323-L325
93
+ */
94
+ type Simplify<TType> = TType extends any[] | Date ? TType : {
95
+ [K in keyof TType]: Simplify<TType[K]>;
96
+ };
34
97
 
35
98
  interface PublicAsset {
36
99
  type: string;
@@ -47,44 +110,79 @@ interface AssetMeta {
47
110
  mtime?: string;
48
111
  }
49
112
 
113
+ interface CacheEntry<T = any> {
114
+ value?: T;
115
+ expires?: number;
116
+ mtime?: number;
117
+ integrity?: string;
118
+ }
119
+ interface CacheOptions<T = any, ArgsT extends unknown[] = any[]> {
120
+ name?: string;
121
+ getKey?: (...args: ArgsT) => string | Promise<string>;
122
+ transform?: (entry: CacheEntry<T>, ...args: ArgsT) => any;
123
+ validate?: (entry: CacheEntry<T>, ...args: ArgsT) => boolean;
124
+ shouldInvalidateCache?: (...args: ArgsT) => boolean | Promise<boolean>;
125
+ shouldBypassCache?: (...args: ArgsT) => boolean | Promise<boolean>;
126
+ group?: string;
127
+ integrity?: any;
128
+ /**
129
+ * Number of seconds to cache the response. Defaults to 1.
130
+ */
131
+ maxAge?: number;
132
+ swr?: boolean;
133
+ staleMaxAge?: number;
134
+ base?: string;
135
+ }
136
+ interface ResponseCacheEntry {
137
+ status: number;
138
+ statusText: string | undefined;
139
+ headers: Record<string, string>;
140
+ body: string | undefined;
141
+ }
142
+ interface CachedEventHandlerOptions extends Omit<CacheOptions<ResponseCacheEntry, [HTTPEvent]>, "transform" | "validate"> {
143
+ headersOnly?: boolean;
144
+ varies?: string[] | readonly string[];
145
+ }
146
+
50
147
  interface NitroApp {
51
- h3App: App;
52
- router: Router;
148
+ _h3?: H3Core;
53
149
  hooks: Hookable<NitroRuntimeHooks>;
54
- localCall: ReturnType<typeof createCall>;
55
- localFetch: ReturnType<typeof createFetch>;
150
+ fetch: (req: string | URL | Request, init?: RequestInit, context?: ServerRequestContext | H3EventContext) => Promise<Response>;
56
151
  captureError: CaptureError;
57
152
  }
58
153
  interface NitroAppPlugin {
59
154
  (nitro: NitroApp): void;
60
155
  }
61
156
  interface NitroAsyncContext {
62
- event: H3Event;
157
+ request: ServerRequest;
63
158
  }
64
159
  interface RenderResponse {
65
160
  body: any;
66
- statusCode: number;
67
- statusMessage: string;
161
+ status: number;
162
+ statusText: string;
68
163
  headers: Record<string, string>;
69
164
  }
70
- type RenderHandler = (event: H3Event) => Partial<RenderResponse> | Promise<Partial<RenderResponse>>;
165
+ type RenderHandler = (event: HTTPEvent) => Partial<RenderResponse> | Promise<Partial<RenderResponse>>;
166
+ interface RenderContext {
167
+ event: HTTPEvent;
168
+ render: RenderHandler;
169
+ response?: Partial<RenderResponse>;
170
+ }
71
171
  interface CapturedErrorContext {
72
- event?: H3Event;
73
- [key: string]: unknown;
172
+ event?: HTTPEvent;
173
+ tags?: string[];
74
174
  }
75
175
  type CaptureError = (error: Error, context: CapturedErrorContext) => void;
76
176
  interface NitroRuntimeHooks {
77
177
  close: () => void;
78
178
  error: CaptureError;
79
- request: NonNullable<AppOptions["onRequest"]>;
80
- beforeResponse: NonNullable<AppOptions["onBeforeResponse"]>;
81
- afterResponse: NonNullable<AppOptions["onAfterResponse"]>;
82
- "render:response": (response: Partial<RenderResponse>, context: {
83
- event: H3Event;
84
- }) => void;
179
+ request: (event: HTTPEvent) => void | Promise<void>;
180
+ response: (res: Response, event: HTTPEvent) => void | Promise<void>;
181
+ "render:before": (context: RenderContext) => void;
182
+ "render:response": (response: Partial<RenderResponse>, context: RenderContext) => void;
85
183
  }
86
184
 
87
- type MaybePromise<T> = T | Promise<T>;
185
+ type MaybePromise$2<T> = T | Promise<T>;
88
186
  /** @experimental */
89
187
  interface TaskContext {
90
188
  }
@@ -110,7 +208,7 @@ interface TaskResult<RT = unknown> {
110
208
  /** @experimental */
111
209
  interface Task<RT = unknown> {
112
210
  meta?: TaskMeta;
113
- run(event: TaskEvent): MaybePromise<{
211
+ run(event: TaskEvent): MaybePromise$2<{
114
212
  result?: RT;
115
213
  }>;
116
214
  }
@@ -120,87 +218,2548 @@ interface TaskRunnerOptions {
120
218
  buildDir?: string;
121
219
  }
122
220
 
123
- interface InternalApi {
221
+ /**
222
+ * A valid `picomatch` glob pattern, or array of patterns.
223
+ */
224
+ type FilterPattern$1 = ReadonlyArray<string | RegExp> | string | RegExp | null;
225
+
226
+ type RequireReturnsDefaultOption = boolean | 'auto' | 'preferred' | 'namespace';
227
+ type DefaultIsModuleExportsOption = boolean | 'auto';
228
+
229
+ interface RollupCommonJSOptions {
230
+ /**
231
+ * A picomatch pattern, or array of patterns, which specifies the files in
232
+ * the build the plugin should operate on. By default, all files with
233
+ * extension `".cjs"` or those in `extensions` are included, but you can
234
+ * narrow this list by only including specific files. These files will be
235
+ * analyzed and transpiled if either the analysis does not find ES module
236
+ * specific statements or `transformMixedEsModules` is `true`.
237
+ * @default undefined
238
+ */
239
+ include?: FilterPattern$1;
240
+ /**
241
+ * A picomatch pattern, or array of patterns, which specifies the files in
242
+ * the build the plugin should _ignore_. By default, all files with
243
+ * extensions other than those in `extensions` or `".cjs"` are ignored, but you
244
+ * can exclude additional files. See also the `include` option.
245
+ * @default undefined
246
+ */
247
+ exclude?: FilterPattern$1;
248
+ /**
249
+ * For extensionless imports, search for extensions other than .js in the
250
+ * order specified. Note that you need to make sure that non-JavaScript files
251
+ * are transpiled by another plugin first.
252
+ * @default [ '.js' ]
253
+ */
254
+ extensions?: ReadonlyArray<string>;
255
+ /**
256
+ * If true then uses of `global` won't be dealt with by this plugin
257
+ * @default false
258
+ */
259
+ ignoreGlobal?: boolean;
260
+ /**
261
+ * If false, skips source map generation for CommonJS modules. This will
262
+ * improve performance.
263
+ * @default true
264
+ */
265
+ sourceMap?: boolean;
266
+ /**
267
+ * Some `require` calls cannot be resolved statically to be translated to
268
+ * imports.
269
+ * When this option is set to `false`, the generated code will either
270
+ * directly throw an error when such a call is encountered or, when
271
+ * `dynamicRequireTargets` is used, when such a call cannot be resolved with a
272
+ * configured dynamic require target.
273
+ * Setting this option to `true` will instead leave the `require` call in the
274
+ * code or use it as a fallback for `dynamicRequireTargets`.
275
+ * @default false
276
+ */
277
+ ignoreDynamicRequires?: boolean;
278
+ /**
279
+ * Instructs the plugin whether to enable mixed module transformations. This
280
+ * is useful in scenarios with modules that contain a mix of ES `import`
281
+ * statements and CommonJS `require` expressions. Set to `true` if `require`
282
+ * calls should be transformed to imports in mixed modules, or `false` if the
283
+ * `require` expressions should survive the transformation. The latter can be
284
+ * important if the code contains environment detection, or you are coding
285
+ * for an environment with special treatment for `require` calls such as
286
+ * ElectronJS. See also the `ignore` option.
287
+ * @default false
288
+ */
289
+ transformMixedEsModules?: boolean;
290
+ /**
291
+ * By default, this plugin will try to hoist `require` statements as imports
292
+ * to the top of each file. While this works well for many code bases and
293
+ * allows for very efficient ESM output, it does not perfectly capture
294
+ * CommonJS semantics as the order of side effects like log statements may
295
+ * change. But it is especially problematic when there are circular `require`
296
+ * calls between CommonJS modules as those often rely on the lazy execution of
297
+ * nested `require` calls.
298
+ *
299
+ * Setting this option to `true` will wrap all CommonJS files in functions
300
+ * which are executed when they are required for the first time, preserving
301
+ * NodeJS semantics. Note that this can have an impact on the size and
302
+ * performance of the generated code.
303
+ *
304
+ * The default value of `"auto"` will only wrap CommonJS files when they are
305
+ * part of a CommonJS dependency cycle, e.g. an index file that is required by
306
+ * many of its dependencies. All other CommonJS files are hoisted. This is the
307
+ * recommended setting for most code bases.
308
+ *
309
+ * `false` will entirely prevent wrapping and hoist all files. This may still
310
+ * work depending on the nature of cyclic dependencies but will often cause
311
+ * problems.
312
+ *
313
+ * You can also provide a picomatch pattern, or array of patterns, to only
314
+ * specify a subset of files which should be wrapped in functions for proper
315
+ * `require` semantics.
316
+ *
317
+ * `"debug"` works like `"auto"` but after bundling, it will display a warning
318
+ * containing a list of ids that have been wrapped which can be used as
319
+ * picomatch pattern for fine-tuning.
320
+ * @default "auto"
321
+ */
322
+ strictRequires?: boolean | FilterPattern$1;
323
+ /**
324
+ * Sometimes you have to leave require statements unconverted. Pass an array
325
+ * containing the IDs or a `id => boolean` function.
326
+ * @default []
327
+ */
328
+ ignore?: ReadonlyArray<string> | ((id: string) => boolean);
329
+ /**
330
+ * In most cases, where `require` calls are inside a `try-catch` clause,
331
+ * they should be left unconverted as it requires an optional dependency
332
+ * that may or may not be installed beside the rolled up package.
333
+ * Due to the conversion of `require` to a static `import` - the call is
334
+ * hoisted to the top of the file, outside the `try-catch` clause.
335
+ *
336
+ * - `true`: Default. All `require` calls inside a `try` will be left unconverted.
337
+ * - `false`: All `require` calls inside a `try` will be converted as if the
338
+ * `try-catch` clause is not there.
339
+ * - `remove`: Remove all `require` calls from inside any `try` block.
340
+ * - `string[]`: Pass an array containing the IDs to left unconverted.
341
+ * - `((id: string) => boolean|'remove')`: Pass a function that controls
342
+ * individual IDs.
343
+ *
344
+ * @default true
345
+ */
346
+ ignoreTryCatch?:
347
+ | boolean
348
+ | 'remove'
349
+ | ReadonlyArray<string>
350
+ | ((id: string) => boolean | 'remove');
351
+ /**
352
+ * Controls how to render imports from external dependencies. By default,
353
+ * this plugin assumes that all external dependencies are CommonJS. This
354
+ * means they are rendered as default imports to be compatible with e.g.
355
+ * NodeJS where ES modules can only import a default export from a CommonJS
356
+ * dependency.
357
+ *
358
+ * If you set `esmExternals` to `true`, this plugin assumes that all
359
+ * external dependencies are ES modules and respect the
360
+ * `requireReturnsDefault` option. If that option is not set, they will be
361
+ * rendered as namespace imports.
362
+ *
363
+ * You can also supply an array of ids to be treated as ES modules, or a
364
+ * function that will be passed each external id to determine whether it is
365
+ * an ES module.
366
+ * @default false
367
+ */
368
+ esmExternals?: boolean | ReadonlyArray<string> | ((id: string) => boolean);
369
+ /**
370
+ * Controls what is returned when requiring an ES module from a CommonJS file.
371
+ * When using the `esmExternals` option, this will also apply to external
372
+ * modules. By default, this plugin will render those imports as namespace
373
+ * imports i.e.
374
+ *
375
+ * ```js
376
+ * // input
377
+ * const foo = require('foo');
378
+ *
379
+ * // output
380
+ * import * as foo from 'foo';
381
+ * ```
382
+ *
383
+ * However, there are some situations where this may not be desired.
384
+ * For these situations, you can change Rollup's behaviour either globally or
385
+ * per module. To change it globally, set the `requireReturnsDefault` option
386
+ * to one of the following values:
387
+ *
388
+ * - `false`: This is the default, requiring an ES module returns its
389
+ * namespace. This is the only option that will also add a marker
390
+ * `__esModule: true` to the namespace to support interop patterns in
391
+ * CommonJS modules that are transpiled ES modules.
392
+ * - `"namespace"`: Like `false`, requiring an ES module returns its
393
+ * namespace, but the plugin does not add the `__esModule` marker and thus
394
+ * creates more efficient code. For external dependencies when using
395
+ * `esmExternals: true`, no additional interop code is generated.
396
+ * - `"auto"`: This is complementary to how `output.exports: "auto"` works in
397
+ * Rollup: If a module has a default export and no named exports, requiring
398
+ * that module returns the default export. In all other cases, the namespace
399
+ * is returned. For external dependencies when using `esmExternals: true`, a
400
+ * corresponding interop helper is added.
401
+ * - `"preferred"`: If a module has a default export, requiring that module
402
+ * always returns the default export, no matter whether additional named
403
+ * exports exist. This is similar to how previous versions of this plugin
404
+ * worked. Again for external dependencies when using `esmExternals: true`,
405
+ * an interop helper is added.
406
+ * - `true`: This will always try to return the default export on require
407
+ * without checking if it actually exists. This can throw at build time if
408
+ * there is no default export. This is how external dependencies are handled
409
+ * when `esmExternals` is not used. The advantage over the other options is
410
+ * that, like `false`, this does not add an interop helper for external
411
+ * dependencies, keeping the code lean.
412
+ *
413
+ * To change this for individual modules, you can supply a function for
414
+ * `requireReturnsDefault` instead. This function will then be called once for
415
+ * each required ES module or external dependency with the corresponding id
416
+ * and allows you to return different values for different modules.
417
+ * @default false
418
+ */
419
+ requireReturnsDefault?:
420
+ | RequireReturnsDefaultOption
421
+ | ((id: string) => RequireReturnsDefaultOption);
422
+
423
+ /**
424
+ * @default "auto"
425
+ */
426
+ defaultIsModuleExports?:
427
+ | DefaultIsModuleExportsOption
428
+ | ((id: string) => DefaultIsModuleExportsOption);
429
+ /**
430
+ * Some modules contain dynamic `require` calls, or require modules that
431
+ * contain circular dependencies, which are not handled well by static
432
+ * imports. Including those modules as `dynamicRequireTargets` will simulate a
433
+ * CommonJS (NodeJS-like) environment for them with support for dynamic
434
+ * dependencies. It also enables `strictRequires` for those modules.
435
+ *
436
+ * Note: In extreme cases, this feature may result in some paths being
437
+ * rendered as absolute in the final bundle. The plugin tries to avoid
438
+ * exposing paths from the local machine, but if you are `dynamicRequirePaths`
439
+ * with paths that are far away from your project's folder, that may require
440
+ * replacing strings like `"/Users/John/Desktop/foo-project/"` -> `"/"`.
441
+ */
442
+ dynamicRequireTargets?: string | ReadonlyArray<string>;
443
+ /**
444
+ * To avoid long paths when using the `dynamicRequireTargets` option, you can use this option to specify a directory
445
+ * that is a common parent for all files that use dynamic require statements. Using a directory higher up such as `/`
446
+ * may lead to unnecessarily long paths in the generated code and may expose directory names on your machine like your
447
+ * home directory name. By default, it uses the current working directory.
448
+ */
449
+ dynamicRequireRoot?: string;
124
450
  }
125
- type NitroFetchRequest = Exclude<keyof InternalApi, `/_${string}` | `/api/_${string}`> | Exclude<FetchRequest, string> | (string & {});
126
- type MiddlewareOf<Route extends string, Method extends RouterMethod | "default"> = Method extends keyof InternalApi[MatchedRoutes<Route>] ? InternalApi[MatchedRoutes<Route>][Method] : never;
127
- type TypedInternalResponse<Route, Default = unknown, Method extends RouterMethod = RouterMethod> = Default extends string | boolean | number | null | void | object ? Default : Route extends string ? MiddlewareOf<Route, Method> extends never ? MiddlewareOf<Route, "default"> extends never ? Default : MiddlewareOf<Route, "default"> : MiddlewareOf<Route, Method> : Default;
128
- type AvailableRouterMethod<R extends NitroFetchRequest> = R extends string ? keyof InternalApi[MatchedRoutes<R>] extends undefined ? RouterMethod : Extract<keyof InternalApi[MatchedRoutes<R>], "default"> extends undefined ? Extract<RouterMethod, keyof InternalApi[MatchedRoutes<R>]> : RouterMethod : RouterMethod;
129
- interface NitroFetchOptions<R extends NitroFetchRequest, M extends AvailableRouterMethod<R> = AvailableRouterMethod<R>> extends FetchOptions {
130
- method?: Uppercase<M> | M;
451
+
452
+ interface TemplateInfo {
453
+ name: string;
454
+ tar: string;
455
+ version?: string;
456
+ subdir?: string;
457
+ url?: string;
458
+ defaultDir?: string;
459
+ headers?: Record<string, string | undefined>;
460
+ source?: never;
461
+ dir?: never;
462
+ [key: string]: any;
131
463
  }
132
- type ExtractedRouteMethod<R extends NitroFetchRequest, O extends NitroFetchOptions<R>> = O extends undefined ? "get" : Lowercase<Exclude<O["method"], undefined>> extends RouterMethod ? Lowercase<Exclude<O["method"], undefined>> : "get";
133
- interface $Fetch<DefaultT = unknown, DefaultR extends NitroFetchRequest = NitroFetchRequest> {
134
- <T = DefaultT, R extends NitroFetchRequest = DefaultR, O extends NitroFetchOptions<R> = NitroFetchOptions<R>>(request: R, opts?: O): Promise<TypedInternalResponse<R, T, NitroFetchOptions<R> extends O ? "get" : ExtractedRouteMethod<R, O>>>;
135
- raw<T = DefaultT, R extends NitroFetchRequest = DefaultR, O extends NitroFetchOptions<R> = NitroFetchOptions<R>>(request: R, opts?: O): Promise<FetchResponse<TypedInternalResponse<R, T, NitroFetchOptions<R> extends O ? "get" : ExtractedRouteMethod<R, O>>>>;
136
- create<T = DefaultT, R extends NitroFetchRequest = DefaultR>(defaults: FetchOptions): $Fetch<T, R>;
464
+ type TemplateProvider = (input: string, options: {
465
+ auth?: string;
466
+ }) => TemplateInfo | Promise<TemplateInfo> | null;
467
+
468
+ interface DownloadTemplateOptions {
469
+ provider?: string;
470
+ force?: boolean;
471
+ forceClean?: boolean;
472
+ offline?: boolean;
473
+ preferOffline?: boolean;
474
+ providers?: Record<string, TemplateProvider>;
475
+ dir?: string;
476
+ registry?: false | string;
477
+ cwd?: string;
478
+ auth?: string;
479
+ install?: boolean;
480
+ silent?: boolean;
481
+ }
482
+
483
+ /*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) */
484
+
485
+ type AWF = {
486
+ stabilityThreshold: number;
487
+ pollInterval: number;
488
+ };
489
+ type BasicOpts = {
490
+ persistent: boolean;
491
+ ignoreInitial: boolean;
492
+ followSymlinks: boolean;
493
+ cwd?: string;
494
+ usePolling: boolean;
495
+ interval: number;
496
+ binaryInterval: number;
497
+ alwaysStat?: boolean;
498
+ depth?: number;
499
+ ignorePermissionErrors: boolean;
500
+ atomic: boolean | number;
501
+ };
502
+ type ChokidarOptions = Partial<BasicOpts & {
503
+ ignored: Matcher | Matcher[];
504
+ awaitWriteFinish: boolean | Partial<AWF>;
505
+ }>;
506
+ type MatchFunction = (val: string, stats?: Stats) => boolean;
507
+ interface MatcherObject {
508
+ path: string;
509
+ recursive?: boolean;
510
+ }
511
+ type Matcher = string | RegExp | MatchFunction | MatcherObject;
512
+
513
+ interface DotenvOptions {
514
+ /**
515
+ * The project root directory (either absolute or relative to the current working directory).
516
+ *
517
+ * Defaults to `options.cwd` in `loadConfig` context, or `process.cwd()` when used as standalone.
518
+ */
519
+ cwd?: string;
520
+ /**
521
+ * What file or files to look in for environment variables (either absolute or relative
522
+ * to the current working directory). For example, `.env`.
523
+ * With the array type, the order enforce the env loading priority (last one overrides).
524
+ */
525
+ fileName?: string | string[];
526
+ /**
527
+ * Whether to interpolate variables within .env.
528
+ *
529
+ * @example
530
+ * ```env
531
+ * BASE_DIR="/test"
532
+ * # resolves to "/test/further"
533
+ * ANOTHER_DIR="${BASE_DIR}/further"
534
+ * ```
535
+ */
536
+ interpolate?: boolean;
537
+ /**
538
+ * An object describing environment variables (key, value pairs).
539
+ */
540
+ env?: NodeJS.ProcessEnv;
137
541
  }
138
542
  declare global {
139
- var $fetch: $Fetch;
140
- namespace NodeJS {
141
- interface Global {
142
- $fetch: $Fetch;
143
- }
144
- }
543
+ var __c12_dotenv_vars__: Map<Record<string, any>, Set<string>>;
145
544
  }
146
545
 
147
- type MatchResult<Key extends string, Exact extends boolean = false, Score extends any[] = [], catchAll extends boolean = false> = {
148
- [k in Key]: {
149
- key: k;
150
- exact: Exact;
151
- score: Score;
152
- catchAll: catchAll;
546
+ interface ConfigLayerMeta {
547
+ name?: string;
548
+ [key: string]: any;
549
+ }
550
+ type UserInputConfig = Record<string, any>;
551
+ interface C12InputConfig<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> {
552
+ $test?: T;
553
+ $development?: T;
554
+ $production?: T;
555
+ $env?: Record<string, T>;
556
+ $meta?: MT;
557
+ }
558
+ interface SourceOptions<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> {
559
+ /** Custom meta for layer */
560
+ meta?: MT;
561
+ /** Layer config overrides */
562
+ overrides?: T;
563
+ [key: string]: any;
564
+ /**
565
+ * Options for cloning remote sources
566
+ *
567
+ * @see https://giget.unjs.io
568
+ */
569
+ giget?: DownloadTemplateOptions;
570
+ /**
571
+ * Install dependencies after cloning
572
+ *
573
+ * @see https://nypm.unjs.io
574
+ */
575
+ install?: boolean;
576
+ /**
577
+ * Token for cloning private sources
578
+ *
579
+ * @see https://giget.unjs.io#providing-token-for-private-repositories
580
+ */
581
+ auth?: string;
582
+ }
583
+ interface ConfigLayer<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> {
584
+ config: T | null;
585
+ source?: string;
586
+ sourceOptions?: SourceOptions<T, MT>;
587
+ meta?: MT;
588
+ cwd?: string;
589
+ configFile?: string;
590
+ }
591
+ interface ResolvedConfig<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> extends ConfigLayer<T, MT> {
592
+ config: T;
593
+ layers?: ConfigLayer<T, MT>[];
594
+ cwd?: string;
595
+ _configFile?: string;
596
+ }
597
+ type ConfigSource = "overrides" | "main" | "rc" | "packageJson" | "defaultConfig";
598
+ interface ConfigFunctionContext {
599
+ [key: string]: any;
600
+ }
601
+ interface ResolvableConfigContext<T extends UserInputConfig = UserInputConfig> {
602
+ configs: Record<ConfigSource, T | null | undefined>;
603
+ rawConfigs: Record<ConfigSource, ResolvableConfig<T> | null | undefined>;
604
+ }
605
+ type MaybePromise$1<T> = T | Promise<T>;
606
+ type ResolvableConfig<T extends UserInputConfig = UserInputConfig> = MaybePromise$1<T | null | undefined> | ((ctx: ResolvableConfigContext<T>) => MaybePromise$1<T | null | undefined>);
607
+ interface LoadConfigOptions$1<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> {
608
+ name?: string;
609
+ cwd?: string;
610
+ configFile?: string;
611
+ rcFile?: false | string;
612
+ globalRc?: boolean;
613
+ dotenv?: boolean | DotenvOptions;
614
+ envName?: string | false;
615
+ packageJson?: boolean | string | string[];
616
+ defaults?: T;
617
+ defaultConfig?: ResolvableConfig<T>;
618
+ overrides?: ResolvableConfig<T>;
619
+ omit$Keys?: boolean;
620
+ /** Context passed to config functions */
621
+ context?: ConfigFunctionContext;
622
+ resolve?: (id: string, options: LoadConfigOptions$1<T, MT>) => null | undefined | ResolvedConfig<T, MT> | Promise<ResolvedConfig<T, MT> | undefined | null>;
623
+ jiti?: Jiti;
624
+ jitiOptions?: JitiOptions;
625
+ giget?: false | DownloadTemplateOptions;
626
+ merger?: (...sources: Array<T | null | undefined>) => T;
627
+ extend?: false | {
628
+ extendKey?: string | string[];
153
629
  };
154
- }[Key];
155
- type Subtract<Minuend extends any[] = [], Subtrahend extends any[] = []> = Minuend extends [...Subtrahend, ...infer Remainder] ? Remainder : never;
156
- type TupleIfDiff<First extends string, Second extends string, Tuple extends any[] = []> = First extends `${Second}${infer Diff}` ? Diff extends "" ? [] : Tuple : [];
157
- type MaxTuple<N extends any[] = [], T extends any[] = []> = {
158
- current: T;
159
- result: MaxTuple<N, ["", ...T]>;
160
- }[[N["length"]] extends [Partial<T>["length"]] ? "current" : "result"];
161
- type CalcMatchScore<Key extends string, Route extends string, Score extends any[] = [], Init extends boolean = false, FirstKeySegMatcher extends string = Init extends true ? ":Invalid:" : ""> = `${Key}/` extends `${infer KeySeg}/${infer KeyRest}` ? KeySeg extends FirstKeySegMatcher ? Subtract<[
162
- ...Score,
163
- ...TupleIfDiff<Route, Key, ["", ""]>
164
- ], TupleIfDiff<Key, Route, ["", ""]>> : `${Route}/` extends `${infer RouteSeg}/${infer RouteRest}` ? `${RouteSeg}?` extends `${infer RouteSegWithoutQuery}?${string}` ? RouteSegWithoutQuery extends KeySeg ? CalcMatchScore<KeyRest, RouteRest, [...Score, "", ""]> : KeySeg extends `:${string}` ? RouteSegWithoutQuery extends "" ? never : CalcMatchScore<KeyRest, RouteRest, [...Score, ""]> : KeySeg extends RouteSegWithoutQuery ? CalcMatchScore<KeyRest, RouteRest, [...Score, ""]> : never : never : never : never;
165
- type _MatchedRoutes<Route extends string, MatchedResultUnion extends MatchResult<string> = MatchResult<keyof InternalApi>> = MatchedResultUnion["key"] extends infer MatchedKeys ? MatchedKeys extends string ? Route extends MatchedKeys ? MatchResult<MatchedKeys, true> : MatchedKeys extends `${infer Root}/**${string}` ? MatchedKeys extends `${string}/**` ? Route extends `${Root}/${string}` ? MatchResult<MatchedKeys, false, [], true> : never : MatchResult<MatchedKeys, false, CalcMatchScore<Root, Route, [], true>> : MatchResult<MatchedKeys, false, CalcMatchScore<MatchedKeys, Route, [], true>> : never : never;
166
- type MatchedRoutes<Route extends string, MatchedKeysResult extends MatchResult<string> = MatchResult<keyof InternalApi>, Matches extends MatchResult<string> = _MatchedRoutes<Route, MatchedKeysResult>> = Route extends "/" ? keyof InternalApi : Extract<Matches, {
167
- exact: true;
168
- }> extends never ? Extract<Exclude<Matches, {
169
- score: never;
170
- }>, {
171
- score: MaxTuple<Matches["score"]>;
172
- }>["key"] | Extract<Matches, {
173
- catchAll: true;
174
- }>["key"] : Extract<Matches, {
175
- exact: true;
176
- }>["key"];
630
+ configFileRequired?: boolean;
631
+ }
632
+
633
+ type DiffEntries = ReturnType<typeof diff>;
634
+ type ConfigWatcher<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> = ResolvedConfig<T, MT> & {
635
+ watchingFiles: string[];
636
+ unwatch: () => Promise<void>;
637
+ };
638
+ interface WatchConfigOptions<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> extends LoadConfigOptions$1<T, MT> {
639
+ chokidarOptions?: ChokidarOptions;
640
+ debounce?: false | number;
641
+ onWatch?: (event: {
642
+ type: "created" | "updated" | "removed";
643
+ path: string;
644
+ }) => void | Promise<void>;
645
+ acceptHMR?: (context: {
646
+ getDiff: () => DiffEntries;
647
+ newConfig: ResolvedConfig<T, MT>;
648
+ oldConfig: ResolvedConfig<T, MT>;
649
+ }) => void | boolean | Promise<void | boolean>;
650
+ onUpdate?: (context: {
651
+ getDiff: () => ReturnType<typeof diff>;
652
+ newConfig: ResolvedConfig<T, MT>;
653
+ oldConfig: ResolvedConfig<T, MT>;
654
+ }) => void | Promise<void>;
655
+ }
177
656
 
178
657
  /**
179
- * @link https://github.com/remix-run/remix/blob/2248669ed59fd716e267ea41df5d665d4781f4a9/packages/remix-server-runtime/serialize.ts
658
+ * Known platform names
180
659
  */
181
- type JsonPrimitive = string | number | boolean | String | Number | Boolean | null;
182
- type NonJsonPrimitive = undefined | Function | symbol;
183
- type IsAny<T> = 0 extends 1 & T ? true : false;
184
- type FilterKeys<TObj extends object, TFilter> = {
185
- [TKey in keyof TObj]: TObj[TKey] extends TFilter ? TKey : never;
186
- }[keyof TObj];
187
- type Serialize<T> = IsAny<T> extends true ? any : T extends JsonPrimitive | undefined ? T : T extends Map<any, any> | Set<any> ? Record<string, never> : T extends NonJsonPrimitive ? never : T extends {
188
- toJSON(): infer U;
189
- } ? U : T extends [] ? [] : T extends [unknown, ...unknown[]] ? SerializeTuple<T> : T extends ReadonlyArray<infer U> ? (U extends NonJsonPrimitive ? null : Serialize<U>)[] : T extends object ? SerializeObject<T> : never;
190
- /** JSON serialize [tuples](https://www.typescriptlang.org/docs/handbook/2/objects.html#tuple-types) */
191
- type SerializeTuple<T extends [unknown, ...unknown[]]> = {
192
- [k in keyof T]: T[k] extends NonJsonPrimitive ? null : Serialize<T[k]>;
660
+ declare const platforms: readonly ["aws", "azure", "cloudflare", "deno", "firebase", "netlify", "vercel"];
661
+ /**
662
+ * Known platform name
663
+ */
664
+ type PlatformName = (typeof platforms)[number] | (string & {});
665
+ type Year = `${number}${number}${number}${number}`;
666
+ type Month = `${"0" | "1"}${number}`;
667
+ type Day = `${"0" | "1" | "2" | "3"}${number}`;
668
+ /**
669
+ * Typed date string in `YYYY-MM-DD` format
670
+ *
671
+ * Empty string is used to represent an "unspecified" date.
672
+ *
673
+ * "latest" is used to represent the latest date available (date of today).
674
+ */
675
+ type DateString = "" | "latest" | `${Year}-${Month}-${Day}`;
676
+ /**
677
+ * Last known compatibility dates for platforms
678
+ *
679
+ * @example
680
+ * {
681
+ * "default": "2024-01-01",
682
+ * "cloudflare": "2024-03-01",
683
+ * }
684
+ */
685
+ type CompatibilityDates = {
686
+ /**
687
+ * Default compatibility date for all unspecified platforms (required)
688
+ */
689
+ default: DateString;
690
+ } & Partial<Record<PlatformName, DateString>>;
691
+ /**
692
+ * Last known compatibility date for the used platform
693
+ */
694
+ type CompatibilityDateSpec = DateString | Partial<CompatibilityDates>;
695
+
696
+ interface ProxyTargetDetailed {
697
+ host: string;
698
+ port: number;
699
+ protocol?: string;
700
+ hostname?: string;
701
+ socketPath?: string;
702
+ key?: string;
703
+ passphrase?: string;
704
+ pfx?: Buffer | string;
705
+ cert?: string;
706
+ ca?: string;
707
+ ciphers?: string;
708
+ secureProtocol?: string;
709
+ }
710
+ type ProxyTarget = ProxyTargetUrl | ProxyTargetDetailed;
711
+ type ProxyTargetUrl = string | Partial<URL>;
712
+ interface ProxyServerOptions {
713
+ /** URL string to be parsed with the url module. */
714
+ target?: ProxyTarget;
715
+ /** URL string to be parsed with the url module. */
716
+ forward?: ProxyTargetUrl;
717
+ /** Object to be passed to http(s).request. */
718
+ agent?: any;
719
+ /** Object to be passed to https.createServer(). */
720
+ ssl?: any;
721
+ /** If you want to proxy websockets. */
722
+ ws?: boolean;
723
+ /** Adds x- forward headers. */
724
+ xfwd?: boolean;
725
+ /** Verify SSL certificate. */
726
+ secure?: boolean;
727
+ /** Explicitly specify if we are proxying to another proxy. */
728
+ toProxy?: boolean;
729
+ /** Specify whether you want to prepend the target's path to the proxy path. */
730
+ prependPath?: boolean;
731
+ /** Specify whether you want to ignore the proxy path of the incoming request. */
732
+ ignorePath?: boolean;
733
+ /** Local interface string to bind for outgoing connections. */
734
+ localAddress?: string;
735
+ /** Changes the origin of the host header to the target URL. */
736
+ changeOrigin?: boolean;
737
+ /** specify whether you want to keep letter case of response header key */
738
+ preserveHeaderKeyCase?: boolean;
739
+ /** Basic authentication i.e. 'user:password' to compute an Authorization header. */
740
+ auth?: string;
741
+ /** Rewrites the location hostname on (301 / 302 / 307 / 308) redirects, Default: null. */
742
+ hostRewrite?: string;
743
+ /** Rewrites the location host/ port on (301 / 302 / 307 / 308) redirects based on requested host/ port.Default: false. */
744
+ autoRewrite?: boolean;
745
+ /** Rewrites the location protocol on (301 / 302 / 307 / 308) redirects to 'http' or 'https'.Default: null. */
746
+ protocolRewrite?: string;
747
+ /** Rewrites domain of set-cookie headers. */
748
+ cookieDomainRewrite?: false | string | {
749
+ [oldDomain: string]: string;
750
+ };
751
+ /** Rewrites path of set-cookie headers. Default: false */
752
+ cookiePathRewrite?: false | string | {
753
+ [oldPath: string]: string;
754
+ };
755
+ /** Object with extra headers to be added to target requests. */
756
+ headers?: {
757
+ [header: string]: string;
758
+ };
759
+ /** Timeout (in milliseconds) when proxy receives no response from target. Default: 120000 (2 minutes) */
760
+ proxyTimeout?: number;
761
+ /** Timeout (in milliseconds) for incoming requests */
762
+ timeout?: number;
763
+ /** If set to true, none of the webOutgoing passes are called and it's your responsibility to appropriately return the response by listening and acting on the proxyRes event */
764
+ selfHandleResponse?: boolean;
765
+ /** Buffer */
766
+ buffer?: stream.Stream;
767
+ }
768
+
769
+ type StripEnums<T extends Record<string, any>> = {
770
+ [K in keyof T]: T[K] extends boolean ? T[K] : T[K] extends string ? T[K] : T[K] extends object ? T[K] : T[K] extends Array<any> ? T[K] : T[K] extends undefined ? undefined : any;
193
771
  };
194
- /** JSON serialize objects (not including arrays) and classes */
195
- type SerializeObject<T extends object> = {
196
- [k in keyof Omit<T, FilterKeys<T, NonJsonPrimitive>>]: Serialize<T[k]>;
772
+ interface TSConfig {
773
+ compilerOptions?: StripEnums<CompilerOptions>;
774
+ exclude?: string[];
775
+ compileOnSave?: boolean;
776
+ extends?: string | string[];
777
+ files?: string[];
778
+ include?: string[];
779
+ typeAcquisition?: TypeAcquisition;
780
+ references?: {
781
+ path: string;
782
+ }[];
783
+ }
784
+
785
+ //#region src/filter.d.ts
786
+ /**
787
+ * A valid `picomatch` glob pattern, or array of patterns.
788
+ */
789
+ type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
790
+
791
+ interface SourceMapOptions {
792
+ /**
793
+ * Whether the mapping should be high-resolution.
794
+ * Hi-res mappings map every single character, meaning (for example) your devtools will always
795
+ * be able to pinpoint the exact location of function calls and so on.
796
+ * With lo-res mappings, devtools may only be able to identify the correct
797
+ * line - but they're quicker to generate and less bulky.
798
+ * You can also set `"boundary"` to generate a semi-hi-res mappings segmented per word boundary
799
+ * instead of per character, suitable for string semantics that are separated by words.
800
+ * If sourcemap locations have been specified with s.addSourceMapLocation(), they will be used here.
801
+ */
802
+ hires?: boolean | 'boundary';
803
+ /**
804
+ * The filename where you plan to write the sourcemap.
805
+ */
806
+ file?: string;
807
+ /**
808
+ * The filename of the file containing the original source.
809
+ */
810
+ source?: string;
811
+ /**
812
+ * Whether to include the original content in the map's sourcesContent array.
813
+ */
814
+ includeContent?: boolean;
815
+ }
816
+
817
+ type SourceMapSegment =
818
+ | [number]
819
+ | [number, number, number, number]
820
+ | [number, number, number, number, number];
821
+
822
+ interface DecodedSourceMap {
823
+ file: string;
824
+ sources: string[];
825
+ sourcesContent?: string[];
826
+ names: string[];
827
+ mappings: SourceMapSegment[][];
828
+ x_google_ignoreList?: number[];
829
+ }
830
+
831
+ declare class SourceMap {
832
+ constructor(properties: DecodedSourceMap);
833
+
834
+ version: number;
835
+ file: string;
836
+ sources: string[];
837
+ sourcesContent?: string[];
838
+ names: string[];
839
+ mappings: string;
840
+ x_google_ignoreList?: number[];
841
+ debugId?: string;
842
+
843
+ /**
844
+ * Returns the equivalent of `JSON.stringify(map)`
845
+ */
846
+ toString(): string;
847
+ /**
848
+ * Returns a DataURI containing the sourcemap. Useful for doing this sort of thing:
849
+ * `generateMap(options?: SourceMapOptions): SourceMap;`
850
+ */
851
+ toUrl(): string;
852
+ }
853
+
854
+ type ExclusionRange = [number, number];
855
+
856
+ interface MagicStringOptions {
857
+ filename?: string;
858
+ indentExclusionRanges?: ExclusionRange | Array<ExclusionRange>;
859
+ offset?: number;
860
+ }
861
+
862
+ interface IndentOptions {
863
+ exclude?: ExclusionRange | Array<ExclusionRange>;
864
+ indentStart?: boolean;
865
+ }
866
+
867
+ interface OverwriteOptions {
868
+ storeName?: boolean;
869
+ contentOnly?: boolean;
870
+ }
871
+
872
+ interface UpdateOptions {
873
+ storeName?: boolean;
874
+ overwrite?: boolean;
875
+ }
876
+
877
+ declare class MagicString {
878
+ constructor(str: string, options?: MagicStringOptions);
879
+ /**
880
+ * Adds the specified character index (with respect to the original string) to sourcemap mappings, if `hires` is false.
881
+ */
882
+ addSourcemapLocation(char: number): void;
883
+ /**
884
+ * Appends the specified content to the end of the string.
885
+ */
886
+ append(content: string): this;
887
+ /**
888
+ * Appends the specified content at the index in the original string.
889
+ * If a range *ending* with index is subsequently moved, the insert will be moved with it.
890
+ * See also `s.prependLeft(...)`.
891
+ */
892
+ appendLeft(index: number, content: string): this;
893
+ /**
894
+ * Appends the specified content at the index in the original string.
895
+ * If a range *starting* with index is subsequently moved, the insert will be moved with it.
896
+ * See also `s.prependRight(...)`.
897
+ */
898
+ appendRight(index: number, content: string): this;
899
+ /**
900
+ * Does what you'd expect.
901
+ */
902
+ clone(): this;
903
+ /**
904
+ * Generates a version 3 sourcemap.
905
+ */
906
+ generateMap(options?: SourceMapOptions): SourceMap;
907
+ /**
908
+ * Generates a sourcemap object with raw mappings in array form, rather than encoded as a string.
909
+ * Useful if you need to manipulate the sourcemap further, but most of the time you will use `generateMap` instead.
910
+ */
911
+ generateDecodedMap(options?: SourceMapOptions): DecodedSourceMap;
912
+ getIndentString(): string;
913
+
914
+ /**
915
+ * Prefixes each line of the string with prefix.
916
+ * If prefix is not supplied, the indentation will be guessed from the original content, falling back to a single tab character.
917
+ */
918
+ indent(options?: IndentOptions): this;
919
+ /**
920
+ * Prefixes each line of the string with prefix.
921
+ * If prefix is not supplied, the indentation will be guessed from the original content, falling back to a single tab character.
922
+ *
923
+ * The options argument can have an exclude property, which is an array of [start, end] character ranges.
924
+ * These ranges will be excluded from the indentation - useful for (e.g.) multiline strings.
925
+ */
926
+ indent(indentStr?: string, options?: IndentOptions): this;
927
+ indentExclusionRanges: ExclusionRange | Array<ExclusionRange>;
928
+
929
+ /**
930
+ * Moves the characters from `start` and `end` to `index`.
931
+ */
932
+ move(start: number, end: number, index: number): this;
933
+ /**
934
+ * Replaces the characters from `start` to `end` with `content`, along with the appended/prepended content in
935
+ * that range. The same restrictions as `s.remove()` apply.
936
+ *
937
+ * The fourth argument is optional. It can have a storeName property — if true, the original name will be stored
938
+ * for later inclusion in a sourcemap's names array — and a contentOnly property which determines whether only
939
+ * the content is overwritten, or anything that was appended/prepended to the range as well.
940
+ *
941
+ * It may be preferred to use `s.update(...)` instead if you wish to avoid overwriting the appended/prepended content.
942
+ */
943
+ overwrite(
944
+ start: number,
945
+ end: number,
946
+ content: string,
947
+ options?: boolean | OverwriteOptions,
948
+ ): this;
949
+ /**
950
+ * Replaces the characters from `start` to `end` with `content`. The same restrictions as `s.remove()` apply.
951
+ *
952
+ * The fourth argument is optional. It can have a storeName property — if true, the original name will be stored
953
+ * for later inclusion in a sourcemap's names array — and an overwrite property which determines whether only
954
+ * the content is overwritten, or anything that was appended/prepended to the range as well.
955
+ */
956
+ update(start: number, end: number, content: string, options?: boolean | UpdateOptions): this;
957
+ /**
958
+ * Prepends the string with the specified content.
959
+ */
960
+ prepend(content: string): this;
961
+ /**
962
+ * Same as `s.appendLeft(...)`, except that the inserted content will go *before* any previous appends or prepends at index
963
+ */
964
+ prependLeft(index: number, content: string): this;
965
+ /**
966
+ * Same as `s.appendRight(...)`, except that the inserted content will go *before* any previous appends or prepends at `index`
967
+ */
968
+ prependRight(index: number, content: string): this;
969
+ /**
970
+ * Removes the characters from `start` to `end` (of the original string, **not** the generated string).
971
+ * Removing the same content twice, or making removals that partially overlap, will cause an error.
972
+ */
973
+ remove(start: number, end: number): this;
974
+ /**
975
+ * Reset the modified characters from `start` to `end` (of the original string, **not** the generated string).
976
+ */
977
+ reset(start: number, end: number): this;
978
+ /**
979
+ * Returns the content of the generated string that corresponds to the slice between `start` and `end` of the original string.
980
+ * Throws error if the indices are for characters that were already removed.
981
+ */
982
+ slice(start: number, end: number): string;
983
+ /**
984
+ * Returns a clone of `s`, with all content before the `start` and `end` characters of the original string removed.
985
+ */
986
+ snip(start: number, end: number): this;
987
+ /**
988
+ * Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the start and end.
989
+ */
990
+ trim(charType?: string): this;
991
+ /**
992
+ * Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the start.
993
+ */
994
+ trimStart(charType?: string): this;
995
+ /**
996
+ * Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the end.
997
+ */
998
+ trimEnd(charType?: string): this;
999
+ /**
1000
+ * Removes empty lines from the start and end.
1001
+ */
1002
+ trimLines(): this;
1003
+ /**
1004
+ * String replacement with RegExp or string.
1005
+ */
1006
+ replace(
1007
+ regex: RegExp | string,
1008
+ replacement: string | ((substring: string, ...args: any[]) => string),
1009
+ ): this;
1010
+ /**
1011
+ * Same as `s.replace`, but replace all matched strings instead of just one.
1012
+ */
1013
+ replaceAll(
1014
+ regex: RegExp | string,
1015
+ replacement: string | ((substring: string, ...args: any[]) => string),
1016
+ ): this;
1017
+
1018
+ lastChar(): string;
1019
+ lastLine(): string;
1020
+ /**
1021
+ * Returns true if the resulting source is empty (disregarding white space).
1022
+ */
1023
+ isEmpty(): boolean;
1024
+ length(): number;
1025
+
1026
+ /**
1027
+ * Indicates if the string has been changed.
1028
+ */
1029
+ hasChanged(): boolean;
1030
+
1031
+ original: string;
1032
+ /**
1033
+ * Returns the generated string.
1034
+ */
1035
+ toString(): string;
1036
+
1037
+ offset: number;
1038
+ }
1039
+
1040
+ /**
1041
+ * Represents a general structure for ECMAScript module exports.
1042
+ */
1043
+ interface ESMExport {
1044
+ /**
1045
+ * Optional explicit type for complex scenarios, often used internally.
1046
+ * @optional
1047
+ */
1048
+ _type?: "declaration" | "named" | "default" | "star";
1049
+ /**
1050
+ * The type of export (declaration, named, default or star).
1051
+ */
1052
+ type: "declaration" | "named" | "default" | "star";
1053
+ /**
1054
+ * The specific type of declaration being exported, if applicable.
1055
+ * @optional
1056
+ */
1057
+ declarationType?: "let" | "var" | "const" | "enum" | "const enum" | "class" | "function" | "async function";
1058
+ /**
1059
+ * The full code snippet of the export statement.
1060
+ */
1061
+ code: string;
1062
+ /**
1063
+ * The starting position (index) of the export declaration in the source code.
1064
+ */
1065
+ start: number;
1066
+ /**
1067
+ * The end position (index) of the export declaration in the source code.
1068
+ */
1069
+ end: number;
1070
+ /**
1071
+ * The name of the variable, function or class being exported, if given explicitly.
1072
+ * @optional
1073
+ */
1074
+ name?: string;
1075
+ /**
1076
+ * The name used for default exports when a specific identifier isn't given.
1077
+ * @optional
1078
+ */
1079
+ defaultName?: string;
1080
+ /**
1081
+ * An array of names to export, applicable to named and destructured exports.
1082
+ */
1083
+ names: string[];
1084
+ /**
1085
+ * The module specifier, if any, from which exports are being re-exported.
1086
+ * @optional
1087
+ */
1088
+ specifier?: string;
1089
+ }
1090
+
1091
+ declare const builtinPresets: {
1092
+ '@vue/composition-api': InlinePreset;
1093
+ '@vueuse/core': () => Preset;
1094
+ '@vueuse/head': InlinePreset;
1095
+ pinia: InlinePreset;
1096
+ preact: InlinePreset;
1097
+ quasar: InlinePreset;
1098
+ react: InlinePreset;
1099
+ 'react-router': InlinePreset;
1100
+ 'react-router-dom': InlinePreset;
1101
+ svelte: InlinePreset;
1102
+ 'svelte/animate': InlinePreset;
1103
+ 'svelte/easing': InlinePreset;
1104
+ 'svelte/motion': InlinePreset;
1105
+ 'svelte/store': InlinePreset;
1106
+ 'svelte/transition': InlinePreset;
1107
+ 'vee-validate': InlinePreset;
1108
+ vitepress: InlinePreset;
1109
+ 'vue-demi': InlinePreset;
1110
+ 'vue-i18n': InlinePreset;
1111
+ 'vue-router': InlinePreset;
1112
+ 'vue-router-composables': InlinePreset;
1113
+ vue: InlinePreset;
1114
+ 'vue/macros': InlinePreset;
1115
+ vuex: InlinePreset;
1116
+ vitest: InlinePreset;
1117
+ 'uni-app': InlinePreset;
1118
+ 'solid-js': InlinePreset;
1119
+ 'solid-app-router': InlinePreset;
1120
+ rxjs: InlinePreset;
1121
+ 'date-fns': InlinePreset;
197
1122
  };
1123
+ type BuiltinPresetName = keyof typeof builtinPresets;
1124
+
1125
+ type ModuleId = string;
1126
+ type ImportName = string;
1127
+ interface ImportCommon {
1128
+ /** Module specifier to import from */
1129
+ from: ModuleId;
1130
+ /**
1131
+ * Priority of the import, if multiple imports have the same name, the one with the highest priority will be used
1132
+ * @default 1
1133
+ */
1134
+ priority?: number;
1135
+ /** If this import is disabled */
1136
+ disabled?: boolean;
1137
+ /** Won't output import in declaration file if true */
1138
+ dtsDisabled?: boolean;
1139
+ /** Import declaration type like const / var / enum */
1140
+ declarationType?: ESMExport['declarationType'];
1141
+ /**
1142
+ * Metadata of the import
1143
+ */
1144
+ meta?: {
1145
+ /** Short description of the import */
1146
+ description?: string;
1147
+ /** URL to the documentation */
1148
+ docsUrl?: string;
1149
+ /** Additional metadata */
1150
+ [key: string]: any;
1151
+ };
1152
+ /**
1153
+ * If this import is a pure type import
1154
+ */
1155
+ type?: boolean;
1156
+ /**
1157
+ * Using this as the from when generating type declarations
1158
+ */
1159
+ typeFrom?: ModuleId;
1160
+ }
1161
+ interface Import extends ImportCommon {
1162
+ /** Import name to be detected */
1163
+ name: ImportName;
1164
+ /** Import as this name */
1165
+ as?: ImportName;
1166
+ /**
1167
+ * With properties
1168
+ *
1169
+ * Ignored for CJS imports.
1170
+ */
1171
+ with?: Record<string, string>;
1172
+ }
1173
+ type PresetImport = Omit<Import, 'from'> | ImportName | [name: ImportName, as?: ImportName, from?: ModuleId];
1174
+ interface InlinePreset extends ImportCommon {
1175
+ imports: (PresetImport | InlinePreset)[];
1176
+ }
198
1177
  /**
199
- * @see https://github.com/ianstormtaylor/superstruct/blob/7973400cd04d8ad92bbdc2b6f35acbfb3c934079/src/utils.ts#L323-L325
1178
+ * Auto extract exports from a package for auto import
200
1179
  */
201
- type Simplify<TType> = TType extends any[] | Date ? TType : {
202
- [K in keyof TType]: Simplify<TType[K]>;
1180
+ interface PackagePreset {
1181
+ /**
1182
+ * Name of the package
1183
+ */
1184
+ package: string;
1185
+ /**
1186
+ * Path of the importer
1187
+ * @default process.cwd()
1188
+ */
1189
+ url?: string;
1190
+ /**
1191
+ * RegExp, string, or custom function to exclude names of the extracted imports
1192
+ */
1193
+ ignore?: (string | RegExp | ((name: string) => boolean))[];
1194
+ /**
1195
+ * Use local cache if exits
1196
+ * @default true
1197
+ */
1198
+ cache?: boolean;
1199
+ }
1200
+ type Preset = InlinePreset | PackagePreset;
1201
+ interface UnimportContext {
1202
+ readonly version: string;
1203
+ options: Partial<UnimportOptions>;
1204
+ staticImports: Import[];
1205
+ dynamicImports: Import[];
1206
+ addons: Addon[];
1207
+ getImports: () => Promise<Import[]>;
1208
+ getImportMap: () => Promise<Map<string, Import>>;
1209
+ getMetadata: () => UnimportMeta | undefined;
1210
+ modifyDynamicImports: (fn: (imports: Import[]) => Thenable<void | Import[]>) => Promise<void>;
1211
+ clearDynamicImports: () => void;
1212
+ replaceImports: (imports: UnimportOptions['imports']) => Promise<Import[]>;
1213
+ invalidate: () => void;
1214
+ resolveId: (id: string, parentId?: string) => Thenable<string | null | undefined | void>;
1215
+ }
1216
+ interface DetectImportResult {
1217
+ s: MagicString;
1218
+ strippedCode: string;
1219
+ isCJSContext: boolean;
1220
+ matchedImports: Import[];
1221
+ firstOccurrence: number;
1222
+ }
1223
+ interface Unimport {
1224
+ readonly version: string;
1225
+ init: () => Promise<void>;
1226
+ clearDynamicImports: UnimportContext['clearDynamicImports'];
1227
+ getImportMap: UnimportContext['getImportMap'];
1228
+ getImports: UnimportContext['getImports'];
1229
+ getInternalContext: () => UnimportContext;
1230
+ getMetadata: UnimportContext['getMetadata'];
1231
+ modifyDynamicImports: UnimportContext['modifyDynamicImports'];
1232
+ generateTypeDeclarations: (options?: TypeDeclarationOptions) => Promise<string>;
1233
+ /**
1234
+ * Get un-imported usages from code
1235
+ */
1236
+ detectImports: (code: string | MagicString) => Promise<DetectImportResult>;
1237
+ /**
1238
+ * Insert missing imports statements to code
1239
+ */
1240
+ injectImports: (code: string | MagicString, id?: string, options?: InjectImportsOptions) => Promise<ImportInjectionResult>;
1241
+ scanImportsFromDir: (dir?: (string | ScanDir)[], options?: ScanDirExportsOptions) => Promise<Import[]>;
1242
+ scanImportsFromFile: (file: string, includeTypes?: boolean) => Promise<Import[]>;
1243
+ /**
1244
+ * @deprecated
1245
+ */
1246
+ toExports: (filepath?: string, includeTypes?: boolean) => Promise<string>;
1247
+ }
1248
+ interface InjectionUsageRecord {
1249
+ import: Import;
1250
+ count: number;
1251
+ moduleIds: string[];
1252
+ }
1253
+ interface UnimportMeta {
1254
+ injectionUsage: Record<string, InjectionUsageRecord>;
1255
+ }
1256
+ interface AddonsOptions {
1257
+ addons?: Addon[];
1258
+ /**
1259
+ * Enable auto import inside for Vue's <template>
1260
+ *
1261
+ * @default false
1262
+ */
1263
+ vueTemplate?: boolean;
1264
+ /**
1265
+ * Enable auto import directives for Vue's SFC.
1266
+ *
1267
+ * Library authors should include `meta.vueDirective: true` in the import metadata.
1268
+ *
1269
+ * When using a local directives folder, provide the `isDirective`
1270
+ * callback to check if the import is a Vue directive.
1271
+ */
1272
+ vueDirectives?: true | AddonVueDirectivesOptions;
1273
+ }
1274
+ interface AddonVueDirectivesOptions {
1275
+ /**
1276
+ * Checks if the import is a Vue directive.
1277
+ *
1278
+ * **NOTES**:
1279
+ * - imports from a library should include `meta.vueDirective: true`.
1280
+ * - this callback is only invoked for local directives (only when meta.vueDirective is not set).
1281
+ *
1282
+ * @param from The path of the import normalized.
1283
+ * @param importEntry The import entry.
1284
+ */
1285
+ isDirective?: (from: string, importEntry: Import) => boolean;
1286
+ }
1287
+ interface UnimportOptions extends Pick<InjectImportsOptions, 'injectAtEnd' | 'mergeExisting' | 'parser'> {
1288
+ /**
1289
+ * Auto import items
1290
+ */
1291
+ imports: Import[];
1292
+ /**
1293
+ * Auto import preset
1294
+ */
1295
+ presets: (Preset | BuiltinPresetName)[];
1296
+ /**
1297
+ * Custom warning function
1298
+ * @default console.warn
1299
+ */
1300
+ warn: (msg: string) => void;
1301
+ /**
1302
+ * Custom debug log function
1303
+ * @default console.log
1304
+ */
1305
+ debugLog: (msg: string) => void;
1306
+ /**
1307
+ * Unimport Addons.
1308
+ * To use built-in addons, use:
1309
+ * ```js
1310
+ * addons: {
1311
+ * addons: [<custom-addons-here>] // if you want to use also custom addons
1312
+ * vueTemplate: true,
1313
+ * vueDirectives: [<the-directives-here>]
1314
+ * }
1315
+ * ```
1316
+ *
1317
+ * Built-in addons:
1318
+ * - vueDirectives: enable auto import directives for Vue's SFC
1319
+ * - vueTemplate: enable auto import inside for Vue's <template>
1320
+ *
1321
+ * @default {}
1322
+ */
1323
+ addons: AddonsOptions | Addon[];
1324
+ /**
1325
+ * Name of virtual modules that exposed all the registed auto-imports
1326
+ * @default []
1327
+ */
1328
+ virtualImports: string[];
1329
+ /**
1330
+ * Directories to scan for auto import
1331
+ * @default []
1332
+ */
1333
+ dirs?: (string | ScanDir)[];
1334
+ /**
1335
+ * Options for scanning directories for auto import
1336
+ */
1337
+ dirsScanOptions?: ScanDirExportsOptions;
1338
+ /**
1339
+ * Custom resolver to auto import id
1340
+ */
1341
+ resolveId?: (id: string, importee?: string) => Thenable<string | void>;
1342
+ /**
1343
+ * Custom magic comments to be opt-out for auto import, per file/module
1344
+ *
1345
+ * @default ['@unimport-disable', '@imports-disable']
1346
+ */
1347
+ commentsDisable?: string[];
1348
+ /**
1349
+ * Custom magic comments to debug auto import, printed to console
1350
+ *
1351
+ * @default ['@unimport-debug', '@imports-debug']
1352
+ */
1353
+ commentsDebug?: string[];
1354
+ /**
1355
+ * Collect meta data for each auto import. Accessible via `ctx.meta`
1356
+ */
1357
+ collectMeta?: boolean;
1358
+ }
1359
+ type PathFromResolver = (_import: Import) => string | undefined;
1360
+ interface ScanDirExportsOptions {
1361
+ /**
1362
+ * Glob patterns for matching files
1363
+ *
1364
+ * @default ['*.{ts,js,mjs,cjs,mts,cts,tsx,jsx}']
1365
+ */
1366
+ filePatterns?: string[];
1367
+ /**
1368
+ * Custom function to filter scanned files
1369
+ */
1370
+ fileFilter?: (file: string) => boolean;
1371
+ /**
1372
+ * Register type exports
1373
+ *
1374
+ * @default true
1375
+ */
1376
+ types?: boolean;
1377
+ /**
1378
+ * Current working directory
1379
+ *
1380
+ * @default process.cwd()
1381
+ */
1382
+ cwd?: string;
1383
+ }
1384
+ interface ScanDir {
1385
+ /**
1386
+ * Path pattern of the directory
1387
+ */
1388
+ glob: string;
1389
+ /**
1390
+ * Register type exports
1391
+ *
1392
+ * @default true
1393
+ */
1394
+ types?: boolean;
1395
+ }
1396
+ interface TypeDeclarationOptions {
1397
+ /**
1398
+ * Custom resolver for path of the import
1399
+ */
1400
+ resolvePath?: PathFromResolver;
1401
+ /**
1402
+ * Append `export {}` to the end of the file
1403
+ *
1404
+ * @default true
1405
+ */
1406
+ exportHelper?: boolean;
1407
+ /**
1408
+ * Auto-import for type exports
1409
+ *
1410
+ * @default true
1411
+ */
1412
+ typeReExports?: boolean;
1413
+ }
1414
+ interface InjectImportsOptions {
1415
+ /**
1416
+ * Merge the existing imports
1417
+ *
1418
+ * @default false
1419
+ */
1420
+ mergeExisting?: boolean;
1421
+ /**
1422
+ * If the module should be auto imported
1423
+ *
1424
+ * @default true
1425
+ */
1426
+ autoImport?: boolean;
1427
+ /**
1428
+ * If the module should be transformed for virtual modules.
1429
+ * Only available when `virtualImports` is set.
1430
+ *
1431
+ * @default true
1432
+ */
1433
+ transformVirtualImports?: boolean;
1434
+ /**
1435
+ * Parser to use for parsing the code
1436
+ *
1437
+ * Note that `acorn` only takes valid JS Code, should usually only be used after transformationa and transpilation
1438
+ *
1439
+ * @default 'regex'
1440
+ */
1441
+ parser?: 'acorn' | 'regex';
1442
+ /**
1443
+ * Inject the imports at the end of other imports
1444
+ *
1445
+ * @default false
1446
+ */
1447
+ injectAtEnd?: boolean;
1448
+ }
1449
+ type Thenable<T> = Promise<T> | T;
1450
+ interface Addon {
1451
+ name?: string;
1452
+ transform?: (this: UnimportContext, code: MagicString, id: string | undefined) => Thenable<MagicString>;
1453
+ declaration?: (this: UnimportContext, dts: string, options: TypeDeclarationOptions) => Thenable<string>;
1454
+ matchImports?: (this: UnimportContext, identifiers: Set<string>, matched: Import[]) => Thenable<Import[] | void>;
1455
+ /**
1456
+ * Extend or modify the imports list before injecting
1457
+ */
1458
+ extendImports?: (this: UnimportContext, imports: Import[]) => Import[] | void;
1459
+ /**
1460
+ * Resolve imports before injecting
1461
+ */
1462
+ injectImportsResolved?: (this: UnimportContext, imports: Import[], code: MagicString, id?: string) => Import[] | void;
1463
+ /**
1464
+ * Modify the injection code before injecting
1465
+ */
1466
+ injectImportsStringified?: (this: UnimportContext, injection: string, imports: Import[], code: MagicString, id?: string) => string | void;
1467
+ }
1468
+ interface MagicStringResult {
1469
+ s: MagicString;
1470
+ code: string;
1471
+ }
1472
+ interface ImportInjectionResult extends MagicStringResult {
1473
+ imports: Import[];
1474
+ }
1475
+
1476
+ interface UnimportPluginOptions extends UnimportOptions {
1477
+ include: FilterPattern;
1478
+ exclude: FilterPattern;
1479
+ dts: boolean | string;
1480
+ /**
1481
+ * Enable implicit auto import.
1482
+ * Generate global TypeScript definitions.
1483
+ *
1484
+ * @default true
1485
+ */
1486
+ autoImport?: boolean;
1487
+ }
1488
+
1489
+ interface UnwasmPluginOptions {
1490
+ /**
1491
+ * Directly import the `.wasm` files instead of bundling as base64 string.
1492
+ *
1493
+ * @default false
1494
+ */
1495
+ esmImport?: boolean;
1496
+ /**
1497
+ * Avoid using top level await and always use a proxy.
1498
+ *
1499
+ * Useful for compatibility with environments that don't support top level await.
1500
+ *
1501
+ * @default false
1502
+ */
1503
+ lazy?: boolean;
1504
+ }
1505
+
1506
+ type Enumerate<N extends number, Acc extends number[] = []> = Acc["length"] extends N ? Acc[number] : Enumerate<N, [...Acc, Acc["length"]]>;
1507
+ type IntRange<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;
1508
+ type ExcludeFunctions<G extends Record<string, any>> = Pick<G, {
1509
+ [P in keyof G]: NonNullable<G[P]> extends Function ? never : P;
1510
+ }[keyof G]>;
1511
+ type DeepPartial<T> = T extends (...args: never) => any ? T : T extends Record<string, any> ? {
1512
+ [P in keyof T]?: DeepPartial<T[P]>;
1513
+ } : T;
1514
+
1515
+ type FetchHandler = (req: Request) => Promise<Response>;
1516
+ type DevMessageListener = (data: unknown) => void;
1517
+ type UpgradeHandler = (req: IncomingMessage, socket: OutgoingMessage<IncomingMessage> | Duplex, head: any) => void;
1518
+ interface DevRPCHooks {
1519
+ sendMessage: (message: unknown) => void;
1520
+ onMessage: (listener: DevMessageListener) => void;
1521
+ offMessage: (listener: DevMessageListener) => void;
1522
+ }
1523
+ type WorkerAddress = {
1524
+ host: string;
1525
+ port: number;
1526
+ socketPath?: string;
1527
+ };
1528
+ interface WorkerHooks {
1529
+ onClose?: (worker: DevWorker, cause?: unknown) => void;
1530
+ onReady?: (worker: DevWorker, address?: WorkerAddress) => void;
1531
+ }
1532
+ interface DevWorker extends WorkerHooks, DevRPCHooks {
1533
+ readonly ready: boolean;
1534
+ readonly closed: boolean;
1535
+ fetch: FetchHandler;
1536
+ upgrade: UpgradeHandler;
1537
+ close(): Promise<void>;
1538
+ }
1539
+ interface NitroDevServerOptions {
1540
+ port: number;
1541
+ hostname: string;
1542
+ watch: string[];
1543
+ }
1544
+
1545
+ /**
1546
+ Source: (inlined because of install size concernes)
1547
+
1548
+ https://github.com/openapi-ts/openapi-typescript/blob/fc3f7/packages/openapi-typescript/src/types.ts
1549
+
1550
+ MIT License
1551
+
1552
+ Copyright (c) 2020 Drew Powers
1553
+
1554
+ Permission is hereby granted, free of charge, to any person obtaining a copy
1555
+ of this software and associated documentation files (the "Software"), to deal
1556
+ in the Software without restriction, including without limitation the rights
1557
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1558
+ copies of the Software, and to permit persons to whom the Software is
1559
+ furnished to do so, subject to the following conditions:
1560
+
1561
+ The above copyright notice and this permission notice shall be included in all
1562
+ copies or substantial portions of the Software.
1563
+
1564
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1565
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1566
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1567
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1568
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1569
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1570
+ SOFTWARE.
1571
+ */
1572
+ interface Extensable {
1573
+ [key: `x-${string}`]: any;
1574
+ }
1575
+ /**
1576
+ * [4.8] Schema
1577
+ * @see https://spec.openapis.org/oas/v3.1.0#schema
1578
+ */
1579
+ interface OpenAPI3 extends Extensable {
1580
+ /** REQUIRED. This string MUST be the version number of the OpenAPI Specification that the OpenAPI document uses. The openapi field SHOULD be used by tooling to interpret the OpenAPI document. This is not related to the API info.version string. */
1581
+ openapi: string;
1582
+ /** REQUIRED. Provides metadata about the API. The metadata MAY be used by tooling as required. */
1583
+ info: InfoObject;
1584
+ /** The default value for the $schema keyword within Schema Objects contained within this OAS document. This MUST be in the form of a URI. */
1585
+ jsonSchemaDialect?: string;
1586
+ /** An array of Server Objects, which provide connectivity information to a target server. If the servers property is not provided, or is an empty array, the default value would be a Server Object with a url value of /. */
1587
+ servers?: ServerObject[];
1588
+ /** The available paths and operations for the API. */
1589
+ paths?: PathsObject;
1590
+ /** The incoming webhooks that MAY be received as part of this API and that the API consumer MAY choose to implement. Closely related to the callbacks feature, this section describes requests initiated other than by an API call, for example by an out of band registration. The key name is a unique string to refer to each webhook, while the (optionally referenced) Path Item Object describes a request that may be initiated by the API provider and the expected responses. An example is available. */
1591
+ webhooks?: {
1592
+ [id: string]: PathItemObject | ReferenceObject;
1593
+ };
1594
+ /** An element to hold various schemas for the document. */
1595
+ components?: ComponentsObject;
1596
+ /** A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. To make security optional, an empty security requirement ({}) can be included in the array. */
1597
+ security?: SecurityRequirementObject[];
1598
+ /** A list of tags used by the document with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the Operation Object must be declared. The tags that are not declared MAY be organized randomly or based on the tools’ logic. Each tag name in the list MUST be unique. */
1599
+ tags?: TagObject[];
1600
+ /** Additional external documentation. */
1601
+ externalDocs?: ExternalDocumentationObject;
1602
+ $defs?: $defs;
1603
+ }
1604
+ /**
1605
+ * [4.8.2] Info Object
1606
+ * The object provides metadata about the API.
1607
+ */
1608
+ interface InfoObject extends Extensable {
1609
+ /** REQUIRED. The title of the API. */
1610
+ title: string;
1611
+ /** A short summary of the API. */
1612
+ summary?: string;
1613
+ /** A description of the API. CommonMark syntax MAY be used for rich text representation. */
1614
+ description?: string;
1615
+ /** A URL to the Terms of Service for the API. This MUST be in the form of a URL. */
1616
+ termsOfService?: string;
1617
+ /** The contact information for the exposed API. */
1618
+ contact?: ContactObject;
1619
+ /** The license information for the exposed API. */
1620
+ license?: LicenseObject;
1621
+ /** REQUIRED. The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API implementation version). */
1622
+ version: string;
1623
+ }
1624
+ /**
1625
+ * [4.8.3] Contact Object
1626
+ * Contact information for the exposed API.
1627
+ */
1628
+ interface ContactObject extends Extensable {
1629
+ /** The identifying name of the contact person/organization. */
1630
+ name?: string;
1631
+ /** The URL pointing to the contact information. This MUST be in the form of a URL. */
1632
+ url?: string;
1633
+ /** The email address of the contact person/organization. This MUST be in the form of an email address. */
1634
+ email?: string;
1635
+ }
1636
+ /**
1637
+ * [4.8.4] License object
1638
+ * License information for the exposed API.
1639
+ */
1640
+ interface LicenseObject extends Extensable {
1641
+ /** REQUIRED. The license name used for the API. */
1642
+ name: string;
1643
+ /** An SPDX license expression for the API. The identifier field is mutually exclusive of the url field. */
1644
+ identifier: string;
1645
+ /** A URL to the license used for the API. This MUST be in the form of a URL. The url field is mutually exclusive of the identifier field. */
1646
+ url: string;
1647
+ }
1648
+ /**
1649
+ * [4.8.5] Server Object
1650
+ * An object representing a Server.
1651
+ */
1652
+ interface ServerObject extends Extensable {
1653
+ /** REQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named in {brackets}. */
1654
+ url: string;
1655
+ /** An optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text representation. */
1656
+ description: string;
1657
+ /** A map between a variable name and its value. The value is used for substitution in the server’s URL template. */
1658
+ variables: {
1659
+ [name: string]: ServerVariableObject;
1660
+ };
1661
+ }
1662
+ /**
1663
+ * [4.8.6] Server Variable Object
1664
+ * An object representing a Server Variable for server URL template substitution.
1665
+ */
1666
+ interface ServerVariableObject extends Extensable {
1667
+ /** An enumeration of string values to be used if the substitution options are from a limited set. The array MUST NOT be empty. */
1668
+ enum?: string[];
1669
+ /** REQUIRED. The default value to use for substitution, which SHALL be sent if an alternate value is not supplied. Note this behavior is different than the Schema Object’s treatment of default values, because in those cases parameter values are optional. If the enum is defined, the value MUST exist in the enum’s values. */
1670
+ default: string;
1671
+ /** An optional description for the server variable. CommonMark syntax MAY be used for rich text representation. */
1672
+ description?: string;
1673
+ }
1674
+ /**
1675
+ * [4.8.7] Components Object
1676
+ * Holds a set of reusable objects for different aspects of the OAS.
1677
+ */
1678
+ interface ComponentsObject extends Extensable {
1679
+ /** An object to hold reusable Schema Objects.*/
1680
+ schemas?: Record<string, SchemaObject>;
1681
+ /** An object to hold reusable Response Objects. */
1682
+ responses?: Record<string, ResponseObject | ReferenceObject>;
1683
+ /** An object to hold reusable Parameter Objects. */
1684
+ parameters?: Record<string, ParameterObject | ReferenceObject>;
1685
+ /** An object to hold reusable Example Objects. */
1686
+ examples?: Record<string, ExampleObject | ReferenceObject>;
1687
+ /** An object to hold reusable Request Body Objects. */
1688
+ requestBodies?: Record<string, RequestBodyObject | ReferenceObject>;
1689
+ /** An object to hold reusable Header Objects. */
1690
+ headers?: Record<string, HeaderObject | ReferenceObject>;
1691
+ /** An object to hold reusable Security Scheme Objects. */
1692
+ securitySchemes?: Record<string, SecuritySchemeObject | ReferenceObject>;
1693
+ /** An object to hold reusable Link Objects. */
1694
+ links?: Record<string, LinkObject | ReferenceObject>;
1695
+ /** An object to hold reusable Callback Objects. */
1696
+ callbacks?: Record<string, CallbackObject | ReferenceObject>;
1697
+ /** An object to hold reusable Path Item Objects. */
1698
+ pathItems?: Record<string, PathItemObject | ReferenceObject>;
1699
+ }
1700
+ /**
1701
+ * [4.8.8] Paths Object
1702
+ * Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the Server Object in order to construct the full URL. The Paths MAY be empty, due to Access Control List (ACL) constraints.
1703
+ */
1704
+ interface PathsObject {
1705
+ [pathname: string]: PathItemObject | ReferenceObject;
1706
+ }
1707
+ /**
1708
+ * [4.8.9] Path Item Object
1709
+ * Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.
1710
+ */
1711
+ interface PathItemObject extends Extensable {
1712
+ /** A definition of a GET operation on this path. */
1713
+ get?: OperationObject | ReferenceObject;
1714
+ /** A definition of a PUT operation on this path. */
1715
+ put?: OperationObject | ReferenceObject;
1716
+ /** A definition of a POST operation on this path. */
1717
+ post?: OperationObject | ReferenceObject;
1718
+ /** A definition of a DELETE operation on this path. */
1719
+ delete?: OperationObject | ReferenceObject;
1720
+ /** A definition of a OPTIONS operation on this path. */
1721
+ options?: OperationObject | ReferenceObject;
1722
+ /** A definition of a HEAD operation on this path. */
1723
+ head?: OperationObject | ReferenceObject;
1724
+ /** A definition of a PATCH operation on this path. */
1725
+ patch?: OperationObject | ReferenceObject;
1726
+ /** A definition of a TRACE operation on this path. */
1727
+ trace?: OperationObject | ReferenceObject;
1728
+ /** An alternative server array to service all operations in this path. */
1729
+ servers?: ServerObject[];
1730
+ /** A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a name and location. The list can use the Reference Object to link to parameters that are defined at the OpenAPI Object’s components/parameters. */
1731
+ parameters?: (ParameterObject | ReferenceObject)[];
1732
+ }
1733
+ /**
1734
+ * [4.8.10] Operation Object
1735
+ * Describes a single API operation on a path.
1736
+ */
1737
+ interface OperationObject extends Extensable {
1738
+ /** A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier. */
1739
+ tags?: string[];
1740
+ /** A short summary of what the operation does. */
1741
+ summary?: string;
1742
+ /** A verbose explanation of the operation behavior. CommonMark syntax MAY be used for rich text representation. */
1743
+ description?: string;
1744
+ /** Additional external documentation for this operation. */
1745
+ externalDocs?: ExternalDocumentationObject;
1746
+ /** Unique string used to identify the operation. The id MUST be unique among all operations described in the API. The operationId value is case-sensitive. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions. */
1747
+ operationId?: string;
1748
+ /** A list of parameters that are applicable for this operation. If a parameter is already defined at the Path Item, the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a name and location. The list can use the Reference Object to link to parameters that are defined at the OpenAPI Object’s components/parameters. */
1749
+ parameters?: (ParameterObject | ReferenceObject)[];
1750
+ /** The request body applicable for this operation. The requestBody is fully supported in HTTP methods where the HTTP 1.1 specification [RFC7231] has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague (such as GET, HEAD and DELETE), requestBody is permitted but does not have well-defined semantics and SHOULD be avoided if possible. */
1751
+ requestBody?: RequestBodyObject | ReferenceObject;
1752
+ /** The list of possible responses as they are returned from executing this operation. */
1753
+ responses?: ResponsesObject;
1754
+ /** A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a Callback Object that describes a request that may be initiated by the API provider and the expected responses. */
1755
+ callbacks?: Record<string, CallbackObject | ReferenceObject>;
1756
+ /** Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is false. */
1757
+ deprecated?: boolean;
1758
+ /** A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. To make security optional, an empty security requirement ({}) can be included in the array. This definition overrides any declared top-level security. To remove a top-level security declaration, an empty array can be used. */
1759
+ security?: SecurityRequirementObject[];
1760
+ /** An alternative server array to service this operation. If an alternative server object is specified at the Path Item Object or Root level, it will be overridden by this value. */
1761
+ servers?: ServerObject[];
1762
+ }
1763
+ /**
1764
+ * [4.8.11] External Documentation Object
1765
+ * Allows referencing an external resource for extended documentation.
1766
+ */
1767
+ interface ExternalDocumentationObject extends Extensable {
1768
+ /** A description of the target documentation. CommonMark syntax MAY be used for rich text representation. */
1769
+ description?: string;
1770
+ /** REQUIRED. The URL for the target documentation. This MUST be in the form of a URL. */
1771
+ url: string;
1772
+ }
1773
+ /**
1774
+ * [4.8.12] Parameter Object
1775
+ * Describes a single operation parameter.
1776
+ * A unique parameter is defined by a combination of a name and location.
1777
+ */
1778
+ interface ParameterObject extends Extensable {
1779
+ /**
1780
+ * REQUIRED. The name of the parameter. Parameter names are case sensitive.
1781
+ *
1782
+ * - If `in` is `"path"`, the `name` field MUST correspond to a template expression occurring within the path field in the Paths Object. See Path Templating for further information.
1783
+ * - If `in` is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`, the parameter definition SHALL be ignored.
1784
+ * - For all other cases, the `name` corresponds to the parameter name used by the `in` property.
1785
+ */
1786
+ name: string;
1787
+ /** REQUIRED. The location of the parameter. Possible values are "query", "header", "path" or "cookie".*/
1788
+ in: "query" | "header" | "path" | "cookie";
1789
+ /** A brief description of the parameter. This could contain examples of use. CommonMark syntax MAY be used for rich text representation. */
1790
+ description?: string;
1791
+ /** Determines whether this parameter is mandatory. If the parameter location is "path", this property is REQUIRED and its value MUST be true. Otherwise, the property MAY be included and its default value is false. */
1792
+ required?: boolean;
1793
+ /** Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. Default value is false. */
1794
+ deprecated?: boolean;
1795
+ /** Sets the ability to pass empty-valued parameters. This is valid only for query parameters and allows sending a parameter with an empty value. Default value is false. If style is used, and if behavior is n/a (cannot be serialized), the value of allowEmptyValue SHALL be ignored. Use of this property is NOT RECOMMENDED, as it is likely to be removed in a later revision. */
1796
+ allowEmptyValue?: boolean;
1797
+ /** Describes how the parameter value will be serialized depending on the type of the parameter value. Default values (based on value of in): for query - form; for path - simple; for header - simple; for cookie - form. */
1798
+ style?: string;
1799
+ /** When this is true, parameter values of type `array` or `object` generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters this property has no effect. When `style` is `form`, the default value is `true`. For all other styles, the default value is `false`. */
1800
+ explode?: boolean;
1801
+ /** Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986] `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. This property only applies to parameters with an `in` value of `query`. The default value is `false`. */
1802
+ allowReserved?: boolean;
1803
+ /** The schema defining the type used for the parameter. */
1804
+ schema?: SchemaObject;
1805
+ /** Example of the parameter’s potential value. */
1806
+ example?: any;
1807
+ /** Examples of the parameter’s potential value. */
1808
+ examples?: {
1809
+ [name: string]: ExampleObject | ReferenceObject;
1810
+ };
1811
+ /** A map containing the representations for the parameter. */
1812
+ content?: {
1813
+ [contentType: string]: MediaTypeObject | ReferenceObject;
1814
+ };
1815
+ }
1816
+ /**
1817
+ * [4.8.13] Request Body Object
1818
+ * Describes a single request body.
1819
+ */
1820
+ interface RequestBodyObject extends Extensable {
1821
+ /** A brief description of the request body. This could contain examples of use. CommonMark syntax MAY be used for rich text representation. */
1822
+ description?: string;
1823
+ /** REQUIRED. The content of the request body. The key is a media type or media type range and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text */
1824
+ content: {
1825
+ [contentType: string]: MediaTypeObject | ReferenceObject;
1826
+ };
1827
+ /** Determines if the request body is required in the request. Defaults to false. */
1828
+ required?: boolean;
1829
+ }
1830
+ /**
1831
+ * [4.8.14] Media Type Object
1832
+ */
1833
+ interface MediaTypeObject extends Extensable {
1834
+ /** The schema defining the content of the request, response, or parameter. */
1835
+ schema?: SchemaObject | ReferenceObject;
1836
+ /** Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The example field is mutually exclusive of the examples field. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema. */
1837
+ example?: any;
1838
+ /** Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The examples field is mutually exclusive of the example field. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema. */
1839
+ examples?: {
1840
+ [name: string]: ExampleObject | ReferenceObject;
1841
+ };
1842
+ /** A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to requestBody objects when the media type is multipart or application/x-www-form-urlencoded. */
1843
+ encoding?: {
1844
+ [propertyName: string]: EncodingObject;
1845
+ };
1846
+ }
1847
+ /**
1848
+ * [4.8.15] Encoding Object
1849
+ * A single encoding definition applied to a single schema property.
1850
+ */
1851
+ interface EncodingObject extends Extensable {
1852
+ /** The Content-Type for encoding a specific property. Default value depends on the property type: for object - application/json; for array – the default is defined based on the inner type; for all other cases the default is application/octet-stream. The value can be a specific media type (e.g. application/json), a wildcard media type (e.g. image/*), or a comma-separated list of the two types. */
1853
+ contentType?: string;
1854
+ /** A map allowing additional information to be provided as headers, for example Content-Disposition. Content-Type is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a multipart. */
1855
+ headers?: {
1856
+ [name: string]: HeaderObject | ReferenceObject;
1857
+ };
1858
+ /** Describes how a specific property value will be serialized depending on its type. See Parameter Object for details on the style property. The behavior follows the same values as query parameters, including default values. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded or multipart/form-data. If a value is explicitly defined, then the value of contentType (implicit or explicit) SHALL be ignored. */
1859
+ style?: string;
1860
+ /** When this is true, property values of type array or object generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When style is form, the default value is true. For all other styles, the default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded or multipart/form-data. If a value is explicitly defined, then the value of contentType (implicit or explicit) SHALL be ignored. */
1861
+ explode?: string;
1862
+ /** Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986] :/?#[]@!$&'()*+,;= to be included without percent-encoding. The default value is false. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded or multipart/form-data. If a value is explicitly defined, then the value of contentType (implicit or explicit) SHALL be ignored. */
1863
+ allowReserved?: string;
1864
+ }
1865
+ /**
1866
+ * [4.8.16] Responses Object
1867
+ * A container for the expected responses of an operation. The container maps a HTTP response code to the expected response.
1868
+ */
1869
+ type ResponsesObject = {
1870
+ [responseCode: string]: ResponseObject | ReferenceObject;
1871
+ } & {
1872
+ /** The documentation of responses other than the ones declared for specific HTTP response codes. Use this field to cover undeclared responses. */
1873
+ default?: ResponseObject | ReferenceObject;
1874
+ };
1875
+ /**
1876
+ * [4.8.17] Response Object
1877
+ * Describes a single response from an API Operation, including design-time, static links to operations based on the response.
1878
+ */
1879
+ interface ResponseObject extends Extensable {
1880
+ /** REQUIRED. A description of the response. CommonMark syntax MAY be used for rich text representation. */
1881
+ description: string;
1882
+ /** Maps a header name to its definition. [RFC7230] states header names are case insensitive. If a response header is defined with the name "Content-Type", it SHALL be ignored. */
1883
+ headers?: {
1884
+ [name: string]: HeaderObject | ReferenceObject;
1885
+ };
1886
+ /** A map containing descriptions of potential response payloads. The key is a media type or media type range and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text */
1887
+ content?: {
1888
+ [contentType: string]: MediaTypeObject;
1889
+ };
1890
+ /** A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for Component Objects. */
1891
+ links?: {
1892
+ [name: string]: LinkObject | ReferenceObject;
1893
+ };
1894
+ }
1895
+ /**
1896
+ * [4.8.18] Callback Object
1897
+ * A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the path item object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.
1898
+ */
1899
+ type CallbackObject = Record<string, PathItemObject>;
1900
+ /**
1901
+ * [4.8.19[ Example Object
1902
+ */
1903
+ interface ExampleObject extends Extensable {
1904
+ /** Short description for the example. */
1905
+ summary?: string;
1906
+ /** Long description for the example. CommonMark syntax MAY be used for rich text representation. */
1907
+ description?: string;
1908
+ /** Embedded literal example. The value field and externalValue field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary. */
1909
+ value?: any;
1910
+ /** A URI that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The value field and externalValue field are mutually exclusive. See the rules for resolving Relative References. */
1911
+ externalValue?: string;
1912
+ }
1913
+ /**
1914
+ * [4.8.20] Link Object
1915
+ * The Link object represents a possible design-time link for a response. The presence of a link does not guarantee the caller’s ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.
1916
+ */
1917
+ interface LinkObject extends Extensable {
1918
+ /** A relative or absolute URI reference to an OAS operation. This field is mutually exclusive of the operationId field, and MUST point to an Operation Object. Relative operationRef values MAY be used to locate an existing Operation Object in the OpenAPI definition. See the rules for resolving Relative References. */
1919
+ operationRef?: string;
1920
+ /** The name of an existing, resolvable OAS operation, as defined with a unique operationId. This field is mutually exclusive of the operationRef field. */
1921
+ operationId?: string;
1922
+ /** A map representing parameters to pass to an operation as specified with operationId or identified via operationRef. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the parameter location [{in}.]{name} for operations that use the same parameter name in different locations (e.g. path.id). */
1923
+ parameters?: {
1924
+ [name: string]: `$${string}`;
1925
+ };
1926
+ /** A literal value or {expression} to use as a request body when calling the target operation. */
1927
+ requestBody?: `$${string}`;
1928
+ /** A description of the link. CommonMark syntax MAY be used for rich text representation. */
1929
+ description?: string;
1930
+ /** A server object to be used by the target operation. */
1931
+ server?: ServerObject;
1932
+ }
1933
+ /**
1934
+ * [4.8.21] Header Object
1935
+ * The Header Object follows the structure of the Parameter Object with the following changes:
1936
+ *
1937
+ * 1. `name` MUST NOT be specified, it is given in the corresponding `headers` map.
1938
+ * 2. `in` MUST NOT be specified, it is implicitly in `header`.
1939
+ * 3. All traits that are affected by the location MUST be applicable to a location of `heade`r (for example, `style`).
1940
+ */
1941
+ type HeaderObject = Omit<ParameterObject, "name" | "in">;
1942
+ /**
1943
+ * [4.8.22] Tag Object
1944
+ * Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.
1945
+ */
1946
+ interface TagObject extends Extensable {
1947
+ /** REQUIRED. The name of the tag. */
1948
+ name: string;
1949
+ /** A description for the tag. CommonMark syntax MAY be used for rich text representation. */
1950
+ description?: string;
1951
+ /** Additional external documentation for this tag. */
1952
+ externalDocs?: ExternalDocumentationObject;
1953
+ }
1954
+ /**
1955
+ * [4.8.23] Reference Object
1956
+ * A simple object to allow referencing other components in the OpenAPI document, internally and externally. The $ref string value contains a URI [RFC3986], which identifies the location of the value being referenced. See the rules for resolving Relative References.
1957
+ */
1958
+ interface ReferenceObject extends Extensable {
1959
+ /** REQUIRED. The reference identifier. This MUST be in the form of a URI. */
1960
+ $ref: string;
1961
+ /** A short summary which by default SHOULD override that of the referenced component. If the referenced object-type does not allow a summary field, then this field has no effect. */
1962
+ summary?: string;
1963
+ /** A description which by default SHOULD override that of the referenced component. CommonMark syntax MAY be used for rich text representation. If the referenced object-type does not allow a description field, then this field has no effect. */
1964
+ description?: string;
1965
+ }
1966
+ /**
1967
+ * [4.8.24] Schema Object
1968
+ * The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is a superset of the JSON Schema Specification Draft 2020-12.
1969
+ */
1970
+ type SchemaObject = {
1971
+ /** The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is a superset of the JSON Schema Specification Draft 2020-12. */
1972
+ discriminator?: DiscriminatorObject;
1973
+ /** MAY be used only on properties schemas. It has no effect on root schemas. Adds additional metadata to describe the XML representation of this property. */
1974
+ xml?: XMLObject;
1975
+ /** Additional external documentation for this schema. */
1976
+ externalDocs?: ExternalDocumentationObject;
1977
+ /** @deprecated */
1978
+ example?: any;
1979
+ title?: string;
1980
+ description?: string;
1981
+ $comment?: string;
1982
+ deprecated?: boolean;
1983
+ readOnly?: boolean;
1984
+ writeOnly?: boolean;
1985
+ enum?: unknown[];
1986
+ /** Use of this keyword is functionally equivalent to an "enum" (Section 6.1.2) with a single value. */
1987
+ const?: unknown;
1988
+ default?: unknown;
1989
+ format?: string;
1990
+ /** @deprecated in 3.1 (still valid for 3.0) */
1991
+ nullable?: boolean;
1992
+ oneOf?: (SchemaObject | ReferenceObject)[];
1993
+ allOf?: (SchemaObject | ReferenceObject)[];
1994
+ anyOf?: (SchemaObject | ReferenceObject)[];
1995
+ required?: string[];
1996
+ [key: `x-${string}`]: any;
1997
+ } & (StringSubtype | NumberSubtype | IntegerSubtype | ArraySubtype | BooleanSubtype | NullSubtype | ObjectSubtype | {
1998
+ type: ("string" | "number" | "integer" | "array" | "boolean" | "null" | "object")[];
1999
+ });
2000
+ interface StringSubtype {
2001
+ type: "string" | ["string", "null"];
2002
+ enum?: (string | ReferenceObject)[];
2003
+ }
2004
+ interface NumberSubtype {
2005
+ type: "number" | ["number", "null"];
2006
+ minimum?: number;
2007
+ maximum?: number;
2008
+ enum?: (number | ReferenceObject)[];
2009
+ }
2010
+ interface IntegerSubtype {
2011
+ type: "integer" | ["integer", "null"];
2012
+ minimum?: number;
2013
+ maximum?: number;
2014
+ enum?: (number | ReferenceObject)[];
2015
+ }
2016
+ interface ArraySubtype {
2017
+ type: "array" | ["array", "null"];
2018
+ prefixItems?: (SchemaObject | ReferenceObject)[];
2019
+ items?: SchemaObject | ReferenceObject | (SchemaObject | ReferenceObject)[];
2020
+ minItems?: number;
2021
+ maxItems?: number;
2022
+ enum?: (SchemaObject | ReferenceObject)[];
2023
+ }
2024
+ interface BooleanSubtype {
2025
+ type: "boolean" | ["boolean", "null"];
2026
+ enum?: (boolean | ReferenceObject)[];
2027
+ }
2028
+ interface NullSubtype {
2029
+ type: "null";
2030
+ }
2031
+ interface ObjectSubtype {
2032
+ type: "object" | ["object", "null"];
2033
+ properties?: {
2034
+ [name: string]: SchemaObject | ReferenceObject;
2035
+ };
2036
+ additionalProperties?: boolean | Record<string, never> | SchemaObject | ReferenceObject;
2037
+ required?: string[];
2038
+ allOf?: (SchemaObject | ReferenceObject)[];
2039
+ anyOf?: (SchemaObject | ReferenceObject)[];
2040
+ enum?: (SchemaObject | ReferenceObject)[];
2041
+ $defs?: $defs;
2042
+ }
2043
+ /**
2044
+ * [4.8.25] Discriminator Object
2045
+ * When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the document of an alternative schema based on the value associated with it.
2046
+ */
2047
+ interface DiscriminatorObject {
2048
+ /** REQUIRED. The name of the property in the payload that will hold the discriminator value. */
2049
+ propertyName: string;
2050
+ /** An object to hold mappings between payload values and schema names or references. */
2051
+ mapping?: Record<string, string>;
2052
+ /** If this exists, then a discriminator type should be added to objects matching this path */
2053
+ oneOf?: string[];
2054
+ }
2055
+ /**
2056
+ * [4.8.26] XML Object
2057
+ * A metadata object that allows for more fine-tuned XML model definitions. When using arrays, XML element names are not inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information. See examples for expected behavior.
2058
+ */
2059
+ interface XMLObject extends Extensable {
2060
+ /** Replaces the name of the element/attribute used for the described schema property. When defined within `items`, it will affect the name of the individual XML elements within the list. When defined alongside `type` being `array` (outside the `items`), it will affect the wrapping element and only if `wrapped` is `true`. If `wrapped` is `false`, it will be ignored. */
2061
+ name?: string;
2062
+ /** The URI of the namespace definition. This MUST be in the form of an absolute URI. */
2063
+ namespace?: string;
2064
+ /** The prefix to be used for the name. */
2065
+ prefix?: string;
2066
+ /** Declares whether the property definition translates to an attribute instead of an element. Default value is `false`. */
2067
+ attribute?: boolean;
2068
+ /** MAY be used only for an array definition. Signifies whether the array is wrapped (for example, `<books><book/><book/></books>`) or unwrapped (`<book/><book/>`). Default value is `false`. The definition takes effect only when defined alongside `type` being `array` (outside the `items`). */
2069
+ wrapped?: boolean;
2070
+ }
2071
+ /**
2072
+ * [4.8.27] Security Scheme Object
2073
+ * Defines a security scheme that can be used by the operations.
2074
+ */
2075
+ type SecuritySchemeObject = {
2076
+ /** A description for security scheme. CommonMark syntax MAY be used for rich text representation. */
2077
+ description?: string;
2078
+ [key: `x-${string}`]: any;
2079
+ } & ({
2080
+ /** REQUIRED. The type of the security scheme. */
2081
+ type: "apiKey";
2082
+ /** REQUIRED. The name of the header, query or cookie parameter to be used. */
2083
+ name: string;
2084
+ /** REQUIRED. The location of the API key. */
2085
+ in: "query" | "header" | "cookie";
2086
+ } | {
2087
+ /** REQUIRED. The type of the security scheme. */
2088
+ type: "http";
2089
+ /** REQUIRED. The name of the HTTP Authorization scheme to be used in the Authorization header as defined in [RFC7235]. The values used SHOULD be registered in the IANA Authentication Scheme registry. */
2090
+ scheme: string;
2091
+ /** A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. */
2092
+ bearer?: string;
2093
+ } | {
2094
+ /** REQUIRED. The type of the security scheme. */
2095
+ type: "mutualTLS";
2096
+ } | {
2097
+ /** REQUIRED. Tye type of the security scheme. */
2098
+ type: "oauth2";
2099
+ /** REQUIRED. An object containing configuration information for the flow types supported. */
2100
+ flows: OAuthFlowsObject;
2101
+ } | {
2102
+ /** REQUIRED. Tye type of the security scheme. */
2103
+ type: "openIdConnect";
2104
+ /** REQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL. The OpenID Connect standard requires the use of TLS. */
2105
+ openIdConnectUrl: string;
2106
+ });
2107
+ /**
2108
+ * [4.8.26] OAuth Flows Object
2109
+ * Allows configuration of the supported OAuth Flows.
2110
+ */
2111
+ interface OAuthFlowsObject extends Extensable {
2112
+ /** Configuration for the OAuth Implicit flow */
2113
+ implicit?: OAuthFlowObject;
2114
+ /** Configuration for the OAuth Resource Owner Password flow */
2115
+ password?: OAuthFlowObject;
2116
+ /** Configuration for the OAuth Client Credentials flow. Previously called `application` in OpenAPI 2.0. */
2117
+ clientCredentials?: OAuthFlowObject;
2118
+ /** Configuration for the OAuth Authorization Code flow. Previously called `accessCode` in OpenAPI 2.0. */
2119
+ authorizationCode?: OAuthFlowObject;
2120
+ }
2121
+ /**
2122
+ * [4.8.29] OAuth Flow Object
2123
+ * Configuration details for a supported OAuth Flow
2124
+ */
2125
+ interface OAuthFlowObject extends Extensable {
2126
+ /** REQUIRED. The authorization URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS. */
2127
+ authorizationUrl: string;
2128
+ /** REQUIRED. The token URL to be used for this flow. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS. */
2129
+ tokenUrl: string;
2130
+ /** The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. The OAuth2 standard requires the use of TLS. */
2131
+ refreshUrl: string;
2132
+ /** REQUIRED. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. The map MAY be empty. */
2133
+ scopes: {
2134
+ [name: string]: string;
2135
+ };
2136
+ }
2137
+ /**
2138
+ * [4.8.30] Security Requirements Object
2139
+ * Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object.
2140
+ */
2141
+ type SecurityRequirementObject = {
2142
+ [P in keyof ComponentsObject["securitySchemes"]]?: string[];
2143
+ };
2144
+ type $defs = Record<string, SchemaObject>;
2145
+
2146
+ type MaybeArray<T> = T | T[];
2147
+ /** @exprerimental */
2148
+ interface NitroRouteMeta {
2149
+ openAPI?: OperationObject & {
2150
+ $global?: Pick<OpenAPI3, "components"> & Extensable;
2151
+ };
2152
+ }
2153
+ interface NitroHandlerCommon {
2154
+ /**
2155
+ * HTTP pathname pattern to match
2156
+ *
2157
+ * Examples: `/test`, `/api/:id`, `/blog/**`
2158
+ */
2159
+ route: string;
2160
+ /**
2161
+ * HTTP method to match
2162
+ */
2163
+ method?: HTTPMethod;
2164
+ /**
2165
+ * Run handler as a middleware before other route handlings
2166
+ */
2167
+ middleware?: boolean;
2168
+ /**
2169
+ * Extra Meta
2170
+ */
2171
+ meta?: NitroRouteMeta;
2172
+ }
2173
+ interface NitroEventHandler extends NitroHandlerCommon {
2174
+ /**
2175
+ * Use lazy loading to import handler
2176
+ */
2177
+ lazy?: boolean;
2178
+ /**
2179
+ * Path to event handler
2180
+ */
2181
+ handler: string;
2182
+ env?: MaybeArray<"dev" | "prod" | "prerender" | PresetName | (string & {})>;
2183
+ }
2184
+ interface NitroDevEventHandler extends NitroHandlerCommon {
2185
+ /**
2186
+ * Event handler function
2187
+ */
2188
+ handler: HTTPHandler;
2189
+ }
2190
+ type MaybePromise<T> = T | Promise<T>;
2191
+ type NitroErrorHandler = (error: HTTPError, event: HTTPEvent, _: {
2192
+ defaultHandler: (error: HTTPError, event: HTTPEvent, opts?: {
2193
+ silent?: boolean;
2194
+ json?: boolean;
2195
+ }) => MaybePromise<{
2196
+ status: number;
2197
+ statusText: string | undefined;
2198
+ headers: Record<string, string>;
2199
+ body: string | Record<string, any>;
2200
+ }>;
2201
+ }) => Response | Promise<Response>;
2202
+
2203
+ interface DevWorkerData {
2204
+ name?: string;
2205
+ globals?: Record<string, unknown>;
2206
+ [key: string]: unknown;
2207
+ }
2208
+
2209
+ interface PrerenderRoute {
2210
+ route: string;
2211
+ contents?: string;
2212
+ data?: ArrayBuffer;
2213
+ fileName?: string;
2214
+ error?: Error & {
2215
+ status: number;
2216
+ statusText: string;
2217
+ };
2218
+ generateTimeMS?: number;
2219
+ skip?: boolean;
2220
+ contentType?: string;
2221
+ }
2222
+ /** @deprecated Internal type will be removed in future versions */
2223
+ type PrerenderGenerateRoute = PrerenderRoute;
2224
+
2225
+ //#endregion
2226
+ //#region src/compiler.d.ts
2227
+ interface RouterCompilerOptions<T = any> {
2228
+ matchAll?: boolean;
2229
+ serialize?: (data: T) => string;
2230
+ }
2231
+
2232
+ interface Route<T = unknown> {
2233
+ route: string;
2234
+ method: string;
2235
+ data: T;
2236
+ }
2237
+ declare class Router<T> {
2238
+ #private;
2239
+ constructor(matchAll?: boolean);
2240
+ get routes(): Route<T>[];
2241
+ _update(routes: Route<T>[]): void;
2242
+ compileToString(opts?: RouterCompilerOptions): string;
2243
+ match(method: string, path: string): undefined | T;
2244
+ matchAll(method: string, path: string): T[];
2245
+ }
2246
+
2247
+ type HTTPstatus = IntRange<100, 600>;
2248
+ interface NitroRouteConfig {
2249
+ cache?: ExcludeFunctions<CachedEventHandlerOptions> | false;
2250
+ headers?: Record<string, string>;
2251
+ redirect?: string | {
2252
+ to: string;
2253
+ status?: HTTPstatus;
2254
+ };
2255
+ prerender?: boolean;
2256
+ proxy?: string | ({
2257
+ to: string;
2258
+ } & ProxyOptions);
2259
+ isr?: number | boolean | VercelISRConfig;
2260
+ cors?: boolean;
2261
+ swr?: boolean | number;
2262
+ static?: boolean | number;
2263
+ }
2264
+ interface NitroRouteRules extends Omit<NitroRouteConfig, "redirect" | "cors" | "swr" | "static"> {
2265
+ redirect?: {
2266
+ to: string;
2267
+ status: HTTPstatus;
2268
+ };
2269
+ proxy?: {
2270
+ to: string;
2271
+ } & ProxyOptions;
2272
+ [key: string]: any;
2273
+ }
2274
+ type MatchedRouteRule<K extends keyof NitroRouteRules = "custom"> = {
2275
+ name: K;
2276
+ options: Exclude<NitroRouteRules[K], false>;
2277
+ route: string;
2278
+ params?: Record<string, string>;
2279
+ handler?: (opts: unknown) => Middleware;
2280
+ };
2281
+ type MatchedRouteRules = {
2282
+ [K in keyof NitroRouteRules]: MatchedRouteRule<K>;
2283
+ };
2284
+ interface VercelISRConfig {
2285
+ /**
2286
+ * (vercel)
2287
+ * Expiration time (in seconds) before the cached asset will be re-generated by invoking the Serverless Function.
2288
+ * Setting the value to `false` (or `isr: true` route rule) means it will never expire.
2289
+ */
2290
+ expiration?: number | false;
2291
+ /**
2292
+ * (vercel)
2293
+ * Group number of the asset.
2294
+ * Prerender assets with the same group number will all be re-validated at the same time.
2295
+ */
2296
+ group?: number;
2297
+ /**
2298
+ * (vercel)
2299
+ * List of query string parameter names that will be cached independently.
2300
+ * - If an empty array, query values are not considered for caching.
2301
+ * - If undefined each unique query value is cached independently
2302
+ * - For wildcard `/**` route rules, `url` is always added.
2303
+ */
2304
+ allowQuery?: string[];
2305
+ /**
2306
+ * (vercel)
2307
+ * When `true`, the query string will be present on the `request` argument passed to the invoked function. The `allowQuery` filter still applies.
2308
+ */
2309
+ passQuery?: boolean;
2310
+ }
2311
+
2312
+ interface Nitro {
2313
+ options: NitroOptions;
2314
+ scannedHandlers: NitroEventHandler[];
2315
+ vfs: Record<string, string>;
2316
+ hooks: Hookable<NitroHooks>;
2317
+ unimport?: Unimport;
2318
+ logger: ConsolaInstance;
2319
+ storage: Storage;
2320
+ close: () => Promise<void>;
2321
+ updateConfig: (config: NitroDynamicConfig) => void | Promise<void>;
2322
+ routing: Readonly<{
2323
+ sync: () => void;
2324
+ routeRules: Router<NitroRouteRules & {
2325
+ _route: string;
2326
+ }>;
2327
+ routes: Router<NitroEventHandler & {
2328
+ _importHash: string;
2329
+ }>;
2330
+ globalMiddleware: (NitroEventHandler & {
2331
+ _importHash: string;
2332
+ })[];
2333
+ routedMiddleware: Router<NitroEventHandler & {
2334
+ _importHash: string;
2335
+ }>;
2336
+ }>;
2337
+ _prerenderedRoutes?: PrerenderRoute[];
2338
+ _prerenderMeta?: Record<string, {
2339
+ contentType?: string;
2340
+ }>;
2341
+ }
2342
+ type NitroDynamicConfig = Pick<NitroConfig, "runtimeConfig" | "routeRules">;
2343
+ type NitroTypes = {
2344
+ routes: Record<string, Partial<Record<HTTPMethod | "default", string[]>>>;
2345
+ tsConfig?: TSConfig;
2346
+ };
2347
+ interface NitroFrameworkInfo {
2348
+ name?: "nitro" | (string & {});
2349
+ version?: string;
2350
+ }
2351
+ /** Build info written to `.output/nitro.json` or `.nitro/dev/nitro.json` */
2352
+ interface NitroBuildInfo {
2353
+ date: string;
2354
+ preset: PresetName;
2355
+ framework: NitroFrameworkInfo;
2356
+ versions: {
2357
+ nitro: string;
2358
+ [key: string]: string;
2359
+ };
2360
+ commands?: {
2361
+ preview?: string;
2362
+ deploy?: string;
2363
+ };
2364
+ dev?: {
2365
+ pid: number;
2366
+ workerAddress?: {
2367
+ host: string;
2368
+ port: number;
2369
+ socketPath?: string;
2370
+ };
2371
+ };
2372
+ config?: Partial<PresetOptions>;
2373
+ }
2374
+
2375
+ type RollupConfig = InputOptions & {
2376
+ output: OutputOptions;
2377
+ };
2378
+ type VirtualModule = string | (() => string | Promise<string>);
2379
+ interface RollupVirtualOptions {
2380
+ [id: string]: VirtualModule;
2381
+ }
2382
+ interface EsbuildOptions extends TransformOptions {
2383
+ include?: FilterPattern;
2384
+ exclude?: FilterPattern;
2385
+ sourceMap?: boolean | "inline" | "hidden";
2386
+ /**
2387
+ * Map extension to esbuild loader
2388
+ * Note that each entry (the extension) needs to start with a dot
2389
+ */
2390
+ loaders?: {
2391
+ [ext: string]: Loader | false;
2392
+ };
2393
+ }
2394
+ interface ServerAssetOptions {
2395
+ inline: boolean;
2396
+ dirs: {
2397
+ [assetdir: string]: {
2398
+ dir: string;
2399
+ meta?: boolean;
2400
+ };
2401
+ };
2402
+ }
2403
+ interface RawOptions {
2404
+ extensions?: string[];
2405
+ }
2406
+
2407
+ type HookResult = void | Promise<void>;
2408
+ interface NitroHooks {
2409
+ "types:extend": (types: NitroTypes) => HookResult;
2410
+ "build:before": (nitro: Nitro) => HookResult;
2411
+ "rollup:before": (nitro: Nitro, config: RollupConfig) => HookResult;
2412
+ compiled: (nitro: Nitro) => HookResult;
2413
+ "dev:reload": (payload?: {
2414
+ entry?: string;
2415
+ workerData?: DevWorkerData;
2416
+ }) => HookResult;
2417
+ "dev:start": () => HookResult;
2418
+ "dev:error": (cause?: unknown) => HookResult;
2419
+ "rollup:reload": () => HookResult;
2420
+ restart: () => HookResult;
2421
+ close: () => HookResult;
2422
+ "prerender:routes": (routes: Set<string>) => HookResult;
2423
+ "prerender:config": (config: NitroConfig) => HookResult;
2424
+ "prerender:init": (prerenderer: Nitro) => HookResult;
2425
+ "prerender:generate": (route: PrerenderRoute, nitro: Nitro) => HookResult;
2426
+ "prerender:route": (route: PrerenderRoute) => HookResult;
2427
+ "prerender:done": (result: {
2428
+ prerenderedRoutes: PrerenderRoute[];
2429
+ failedRoutes: PrerenderRoute[];
2430
+ }) => HookResult;
2431
+ }
2432
+
2433
+ type NitroModuleInput = string | NitroModule | NitroModule["setup"];
2434
+ interface NitroModule {
2435
+ name?: string;
2436
+ setup: (this: void, nitro: Nitro) => void | Promise<void>;
2437
+ }
2438
+
2439
+ /**
2440
+ * Nitro OpenAPI configuration
2441
+ */
2442
+ interface NitroOpenAPIConfig {
2443
+ /**
2444
+ * OpenAPI meta information
2445
+ */
2446
+ meta?: {
2447
+ title?: string;
2448
+ description?: string;
2449
+ version?: string;
2450
+ };
2451
+ /**
2452
+ * OpenAPI json route
2453
+ *
2454
+ * Default is `/_openapi.json`
2455
+ */
2456
+ route?: string;
2457
+ /**
2458
+ * Enable OpenAPI generation for production builds
2459
+ */
2460
+ production?: false | "runtime" | "prerender";
2461
+ /**
2462
+ * UI configurations
2463
+ */
2464
+ ui?: {
2465
+ /**
2466
+ * Scalar UI configuration
2467
+ */
2468
+ scalar?: false | (Partial<unknown> & {
2469
+ /**
2470
+ * Scalar UI route
2471
+ *
2472
+ * Default is `/_scalar`
2473
+ */
2474
+ route?: string;
2475
+ });
2476
+ /**
2477
+ * Swagger UI configuration
2478
+ */
2479
+ swagger?: false | {
2480
+ /**
2481
+ * Swagger UI route
2482
+ *
2483
+ * Default is `/_swagger`
2484
+ */
2485
+ route?: string;
2486
+ };
2487
+ };
2488
+ }
2489
+
2490
+ type NitroPreset = NitroConfig | (() => NitroConfig);
2491
+ interface NitroPresetMeta {
2492
+ name: string;
2493
+ stdName?: ProviderName;
2494
+ aliases?: string[];
2495
+ static?: boolean;
2496
+ dev?: boolean;
2497
+ compatibilityDate?: DateString;
2498
+ }
2499
+
2500
+ /**
2501
+ * Nitro normalized options (nitro.options)
2502
+ */
2503
+ interface NitroOptions extends PresetOptions {
2504
+ _config: NitroConfig;
2505
+ _c12: ResolvedConfig<NitroConfig> | ConfigWatcher<NitroConfig>;
2506
+ _cli?: {
2507
+ command?: string;
2508
+ };
2509
+ compatibilityDate: CompatibilityDates;
2510
+ debug: boolean;
2511
+ preset: PresetName;
2512
+ static: boolean;
2513
+ logLevel: LogLevel;
2514
+ runtimeConfig: NitroRuntimeConfig;
2515
+ workspaceDir: string;
2516
+ rootDir: string;
2517
+ srcDir: string;
2518
+ scanDirs: string[];
2519
+ apiDir: string;
2520
+ routesDir: string;
2521
+ buildDir: string;
2522
+ output: {
2523
+ dir: string;
2524
+ serverDir: string;
2525
+ publicDir: string;
2526
+ };
2527
+ storage: StorageMounts;
2528
+ devStorage: StorageMounts;
2529
+ database: DatabaseConnectionConfigs;
2530
+ devDatabase: DatabaseConnectionConfigs;
2531
+ bundledStorage: string[];
2532
+ renderer?: {
2533
+ entry?: string;
2534
+ template?: string;
2535
+ };
2536
+ ssrRoutes: string[];
2537
+ serveStatic: boolean | "node" | "deno" | "inline";
2538
+ noPublicDir: boolean;
2539
+ /**
2540
+ * @experimental Requires `experimental.wasm` to work
2541
+ *
2542
+ * @see https://github.com/unjs/unwasm
2543
+ */
2544
+ wasm?: UnwasmPluginOptions;
2545
+ openAPI?: NitroOpenAPIConfig;
2546
+ experimental: {
2547
+ openAPI?: boolean;
2548
+ /**
2549
+ * See https://github.com/microsoft/TypeScript/pull/51669
2550
+ */
2551
+ typescriptBundlerResolution?: boolean;
2552
+ /**
2553
+ * Enable native async context support for useRequest()
2554
+ */
2555
+ asyncContext?: boolean;
2556
+ /**
2557
+ * Enable Experimental WebAssembly Support
2558
+ *
2559
+ * @see https://github.com/unjs/unwasm
2560
+ */
2561
+ wasm?: boolean;
2562
+ /**
2563
+ * Disable Experimental bundling of Nitro Runtime Dependencies
2564
+ */
2565
+ bundleRuntimeDependencies?: false;
2566
+ /**
2567
+ * Disable Experimental Sourcemap Minification
2568
+ */
2569
+ sourcemapMinify?: false;
2570
+ /**
2571
+ * Allow env expansion in runtime config
2572
+ *
2573
+ * @see https://github.com/nitrojs/nitro/pull/2043
2574
+ */
2575
+ envExpansion?: boolean;
2576
+ /**
2577
+ * Enable experimental WebSocket support
2578
+ *
2579
+ * @see https://nitro.build/guide/websocket
2580
+ */
2581
+ websocket?: boolean;
2582
+ /**
2583
+ * Enable experimental Database support
2584
+ *
2585
+ * @see https://nitro.build/guide/database
2586
+ */
2587
+ database?: boolean;
2588
+ /**
2589
+ * Enable experimental Tasks support
2590
+ *
2591
+ * @see https://nitro.build/guide/tasks
2592
+ */
2593
+ tasks?: boolean;
2594
+ };
2595
+ future: {
2596
+ nativeSWR: boolean;
2597
+ };
2598
+ serverAssets: ServerAssetDir[];
2599
+ publicAssets: PublicAssetDir[];
2600
+ imports: UnimportPluginOptions | false;
2601
+ modules?: NitroModuleInput[];
2602
+ plugins: string[];
2603
+ tasks: {
2604
+ [name: string]: {
2605
+ handler: string;
2606
+ description: string;
2607
+ };
2608
+ };
2609
+ scheduledTasks: {
2610
+ [cron: string]: string | string[];
2611
+ };
2612
+ virtual: Record<string, string | (() => string | Promise<string>)>;
2613
+ compressPublicAssets: boolean | CompressOptions;
2614
+ ignore: string[];
2615
+ dev: boolean;
2616
+ devServer: NitroDevServerOptions;
2617
+ watchOptions: ChokidarOptions;
2618
+ devProxy: Record<string, string | ProxyServerOptions>;
2619
+ logging: {
2620
+ compressedSizes: boolean;
2621
+ buildSuccess: boolean;
2622
+ };
2623
+ baseURL: string;
2624
+ apiBaseURL: string;
2625
+ serverEntry: string;
2626
+ handlers: NitroEventHandler[];
2627
+ routeRules: {
2628
+ [path: string]: NitroRouteRules;
2629
+ };
2630
+ devHandlers: NitroDevEventHandler[];
2631
+ errorHandler: string | string[];
2632
+ devErrorHandler: NitroErrorHandler;
2633
+ prerender: {
2634
+ /**
2635
+ * Prerender HTML routes within subfolders (`/test` would produce `/test/index.html`)
2636
+ */
2637
+ autoSubfolderIndex: boolean;
2638
+ concurrency: number;
2639
+ interval: number;
2640
+ crawlLinks: boolean;
2641
+ failOnError: boolean;
2642
+ ignore: Array<string | RegExp | ((path: string) => undefined | null | boolean)>;
2643
+ ignoreUnprefixedPublicAssets: boolean;
2644
+ routes: string[];
2645
+ /**
2646
+ * Amount of retries. Pass Infinity to retry indefinitely.
2647
+ * @default 3
2648
+ */
2649
+ retry: number;
2650
+ /**
2651
+ * Delay between each retry in ms.
2652
+ * @default 500
2653
+ */
2654
+ retryDelay: number;
2655
+ };
2656
+ builder?: "rollup" | "rolldown" | "vite";
2657
+ rollupConfig?: RollupConfig;
2658
+ entry: string;
2659
+ unenv: Preset$1[];
2660
+ alias: Record<string, string>;
2661
+ minify: boolean;
2662
+ inlineDynamicImports: boolean;
2663
+ sourceMap: boolean | "inline" | "hidden";
2664
+ node: boolean;
2665
+ moduleSideEffects: string[];
2666
+ esbuild?: {
2667
+ options?: Partial<EsbuildOptions>;
2668
+ };
2669
+ noExternals: boolean;
2670
+ externals: ExternalsPluginOptions;
2671
+ replace: Record<string, string | ((id: string) => string)>;
2672
+ commonJS?: RollupCommonJSOptions;
2673
+ exportConditions?: string[];
2674
+ typescript: {
2675
+ strict?: boolean;
2676
+ internalPaths?: boolean;
2677
+ generateRuntimeConfigTypes?: boolean;
2678
+ generateTsConfig?: boolean;
2679
+ /** the path of the generated `tsconfig.json`, relative to buildDir */
2680
+ tsconfigPath: string;
2681
+ tsConfig?: Partial<TSConfig>;
2682
+ };
2683
+ hooks: NestedHooks<NitroHooks>;
2684
+ nodeModulesDirs: string[];
2685
+ commands: {
2686
+ preview: string;
2687
+ deploy: string;
2688
+ };
2689
+ framework: NitroFrameworkInfo;
2690
+ iis?: {
2691
+ mergeConfig?: boolean;
2692
+ overrideConfig?: boolean;
2693
+ };
2694
+ }
2695
+ /**
2696
+ * Nitro input config (nitro.config)
2697
+ */
2698
+ interface NitroConfig extends DeepPartial<Omit<NitroOptions, "routeRules" | "rollupConfig" | "preset" | "compatibilityDate" | "unenv" | "_config" | "_c12">>, C12InputConfig<NitroConfig> {
2699
+ preset?: PresetNameInput;
2700
+ extends?: string | string[] | NitroPreset;
2701
+ routeRules?: {
2702
+ [path: string]: NitroRouteConfig;
2703
+ };
2704
+ rollupConfig?: Partial<RollupConfig>;
2705
+ compatibilityDate?: CompatibilityDateSpec;
2706
+ unenv?: Preset$1 | Preset$1[];
2707
+ }
2708
+ interface LoadConfigOptions {
2709
+ watch?: boolean;
2710
+ c12?: WatchConfigOptions;
2711
+ compatibilityDate?: CompatibilityDateSpec;
2712
+ dotenv?: boolean | DotenvOptions;
2713
+ }
2714
+ interface PublicAssetDir {
2715
+ baseURL?: string;
2716
+ fallthrough?: boolean;
2717
+ maxAge: number;
2718
+ dir: string;
2719
+ }
2720
+ interface CompressOptions {
2721
+ gzip?: boolean;
2722
+ brotli?: boolean;
2723
+ }
2724
+ interface ServerAssetDir {
2725
+ baseName: string;
2726
+ pattern?: string;
2727
+ dir: string;
2728
+ ignore?: string[];
2729
+ }
2730
+ type CustomDriverName = string & {
2731
+ _custom?: any;
203
2732
  };
2733
+ interface StorageMounts {
2734
+ [path: string]: {
2735
+ driver: BuiltinDriverName | CustomDriverName;
2736
+ [option: string]: any;
2737
+ };
2738
+ }
2739
+ type DatabaseConnectionName = "default" | (string & {});
2740
+ type DatabaseConnectionConfig = {
2741
+ connector: ConnectorName;
2742
+ options?: {
2743
+ [key: string]: any;
2744
+ };
2745
+ };
2746
+ type DatabaseConnectionConfigs = Record<DatabaseConnectionName, DatabaseConnectionConfig>;
2747
+ interface NitroRuntimeConfigApp {
2748
+ baseURL: string;
2749
+ [key: string]: any;
2750
+ }
2751
+ interface NitroRuntimeConfig {
2752
+ app: NitroRuntimeConfigApp;
2753
+ nitro: {
2754
+ envPrefix?: string;
2755
+ envExpansion?: boolean;
2756
+ routeRules?: {
2757
+ [path: string]: NitroRouteConfig;
2758
+ };
2759
+ openAPI?: NitroOpenAPIConfig;
2760
+ };
2761
+ [key: string]: any;
2762
+ }
204
2763
 
205
2764
  interface NitroStaticBuildFlags {
206
2765
  _asyncContext?: boolean;
@@ -209,6 +2768,7 @@ interface NitroStaticBuildFlags {
209
2768
  dev?: boolean;
210
2769
  client?: boolean;
211
2770
  nitro?: boolean;
2771
+ baseURL?: string;
212
2772
  prerender?: boolean;
213
2773
  preset?: NitroOptions["preset"];
214
2774
  server?: boolean;
@@ -225,36 +2785,26 @@ declare global {
225
2785
  }
226
2786
  }
227
2787
  declare global {
228
- const defineNitroConfig: (config: NitroConfig) => NitroConfig;
2788
+ const defineNitroConfig: (config: Omit<NitroConfig, "rootDir">) => Omit<NitroConfig, "rootDir">;
229
2789
  const defineNitroModule: (definition: NitroModule) => NitroModule;
230
2790
  }
231
2791
 
232
2792
  type H3EventFetch = (request: NitroFetchRequest, init?: RequestInit) => Promise<Response>;
233
- type H3Event$Fetch = $Fetch<unknown, NitroFetchRequest>;
234
- declare module "h3" {
235
- interface H3Event {
236
- /** @experimental Calls fetch with same context and request headers */
237
- fetch: H3EventFetch;
238
- /** @experimental Calls fetch with same context and request headers */
239
- $fetch: H3Event$Fetch;
240
- /** @experimental See https://github.com/unjs/nitro/issues/1420 */
241
- waitUntil: (promise: Promise<unknown>) => void;
242
- /** @experimental */
243
- captureError: CaptureError$1;
244
- }
245
- interface H3Context {
246
- nitro: {
247
- _waitUntilPromises?: Promise<unknown>[];
248
- /** @experimental */
249
- errors: {
2793
+ type H3Event$Fetch = Base$Fetch<unknown, NitroFetchRequest>;
2794
+ declare module "srvx" {
2795
+ interface ServerRequestContext {
2796
+ routeRules?: MatchedRouteRules;
2797
+ nitro?: {
2798
+ runtimeConfig?: NitroRuntimeConfig;
2799
+ errors?: {
250
2800
  error?: Error;
251
- context: CapturedErrorContext$1;
2801
+ context: CapturedErrorContext;
252
2802
  }[];
253
2803
  };
254
- cache: {
255
- options: CacheOptions;
2804
+ cache?: {
2805
+ options?: CacheOptions;
256
2806
  };
257
2807
  }
258
2808
  }
259
2809
 
260
- export { type $Fetch, type AssetMeta, type AvailableRouterMethod, type CaptureError, type CapturedErrorContext, type ExtractedRouteMethod, type H3Event$Fetch, type H3EventFetch, type InternalApi, type MatchedRoutes, type MiddlewareOf, type NitroApp, type NitroAppPlugin, type NitroAsyncContext, NitroConfig, type NitroFetchOptions, type NitroFetchRequest, NitroModule, NitroOptions, type NitroRuntimeHooks, type NitroStaticBuildFlags, type PublicAsset, type RenderHandler, type RenderResponse, type Serialize, type SerializeObject, type SerializeTuple, type Simplify, type Task, type TaskContext, type TaskEvent, type TaskMeta, type TaskPayload, type TaskResult, type TaskRunnerOptions, type TypedInternalResponse };
2810
+ export type { $Fetch, AssetMeta, AvailableRouterMethod, Base$Fetch, CacheEntry, CacheOptions, CachedEventHandlerOptions, CaptureError, CapturedErrorContext, CompressOptions, DatabaseConnectionConfig, DatabaseConnectionConfigs, DatabaseConnectionName, DevMessageListener, DevRPCHooks, DevWorker, EsbuildOptions, ExtractedRouteMethod, FetchHandler, H3Event$Fetch, H3EventFetch, HTTPstatus, InternalApi, LoadConfigOptions, MatchedRouteRule, MatchedRouteRules, MatchedRoutes, MiddlewareOf, Nitro, NitroApp, NitroAppPlugin, NitroAsyncContext, NitroBuildInfo, NitroConfig, NitroDevEventHandler, NitroDevServerOptions, NitroDynamicConfig, NitroErrorHandler, NitroEventHandler, NitroFetchOptions, NitroFetchRequest, NitroFrameworkInfo, NitroHooks, NitroModule, NitroModuleInput, NitroOpenAPIConfig, NitroOptions, NitroPreset, NitroPresetMeta, NitroRouteConfig, NitroRouteMeta, NitroRouteRules, NitroRuntimeConfig, NitroRuntimeConfigApp, NitroRuntimeHooks, NitroStaticBuildFlags, NitroTypes, PrerenderGenerateRoute, PrerenderRoute, PublicAsset, PublicAssetDir, RawOptions, RenderContext, RenderHandler, RenderResponse, ResponseCacheEntry, RollupConfig, RollupVirtualOptions, Serialize, SerializeObject, SerializeTuple, ServerAssetDir, ServerAssetOptions, Simplify, StorageMounts, Task, TaskContext, TaskEvent, TaskMeta, TaskPayload, TaskResult, TaskRunnerOptions, TypedInternalResponse, UpgradeHandler, VirtualModule, WorkerAddress, WorkerHooks };