nitro-nightly 3.0.1-alpha.1 → 3.0.1-alpha.2

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 (246) hide show
  1. package/README.md +2 -0
  2. package/dist/_build/common.mjs +24924 -52
  3. package/dist/_build/rolldown.mjs +29 -63
  4. package/dist/_build/rollup.mjs +22 -110
  5. package/dist/_build/vite.build.mjs +3 -43
  6. package/dist/{_dev.mjs → _chunks/dev.mjs} +45 -43
  7. package/dist/_chunks/{B-D1JOIz.mjs → nitro.mjs} +144 -308
  8. package/dist/_chunks/nitro2.mjs +101 -0
  9. package/dist/_chunks/utils.mjs +254 -0
  10. package/dist/{_chunks/Bqks5huO.mjs → _common.mjs} +24 -10
  11. package/dist/_libs/c12+giget+readdirp+chokidar.d.mts +214 -0
  12. package/dist/_libs/citty.mjs +140 -110
  13. package/dist/_libs/{plugin-commonjs.mjs → commondir+is-reference.mjs} +59 -250
  14. package/dist/_libs/compatx.d.mts +47 -0
  15. package/dist/_libs/confbox.mjs +388 -799
  16. package/dist/_libs/esbuild.d.mts +20 -0
  17. package/dist/_libs/estree-walker.mjs +1 -144
  18. package/dist/_libs/{plugin-node-resolve.mjs → hasown+resolve+deepmerge.mjs} +497 -78
  19. package/dist/_libs/httpxy.d.mts +79 -0
  20. package/dist/_libs/httpxy.mjs +6 -1
  21. package/dist/_libs/magic-string.d.mts +220 -0
  22. package/dist/_libs/mlly.d.mts +57 -0
  23. package/dist/_libs/nypm+giget+tinyexec.mjs +3603 -0
  24. package/dist/_libs/pkg-types.d.mts +23 -0
  25. package/dist/_libs/plugin-alias.mjs +4 -2
  26. package/dist/_libs/plugin-inject.mjs +5 -5
  27. package/dist/_libs/plugin-json.mjs +2 -2
  28. package/dist/_libs/pluginutils+plugin-commonjs.d.mts +241 -0
  29. package/dist/_libs/{vite-plugin-fullstack.mjs → pluginutils.mjs} +244 -153
  30. package/dist/_libs/rc9+c12+dotenv.mjs +972 -0
  31. package/dist/_libs/{chokidar.mjs → readdirp+chokidar.mjs} +237 -187
  32. package/dist/_libs/remapping.mjs +1 -1
  33. package/dist/_libs/{gen-mapping.mjs → resolve-uri+gen-mapping.mjs} +2 -166
  34. package/dist/_libs/rou3.d.mts +43 -0
  35. package/dist/_libs/rou3.mjs +9 -6
  36. package/dist/_libs/std-env.d.mts +4 -0
  37. package/dist/_libs/tsconfck.mjs +3 -3
  38. package/dist/_libs/{unimport.mjs → unimport+unplugin.mjs} +226 -1961
  39. package/dist/_libs/unplugin+unimport.d.mts +426 -0
  40. package/dist/_libs/unwasm.d.mts +29 -0
  41. package/dist/_presets.mjs +130 -80
  42. package/dist/builder.d.mts +4 -4
  43. package/dist/builder.mjs +6 -30
  44. package/dist/cli/_chunks/build.mjs +1 -1
  45. package/dist/cli/_chunks/dev.mjs +5 -11
  46. package/dist/cli/_chunks/list.mjs +1 -1
  47. package/dist/cli/_chunks/prepare.mjs +1 -1
  48. package/dist/cli/_chunks/run.mjs +1 -1
  49. package/dist/node_modules/@poppinss/colors/build/index.js +130 -160
  50. package/dist/node_modules/@poppinss/colors/package.json +20 -18
  51. package/dist/node_modules/@poppinss/exception/build/index.js +36 -55
  52. package/dist/node_modules/@poppinss/exception/package.json +19 -16
  53. package/dist/node_modules/@sindresorhus/is/distribution/index.js +46 -5
  54. package/dist/node_modules/@sindresorhus/is/package.json +1 -1
  55. package/dist/node_modules/@speed-highlight/core/dist/index.js +1 -1
  56. package/dist/node_modules/@speed-highlight/core/dist/terminal.js +1 -1
  57. package/dist/node_modules/@speed-highlight/core/package.json +2 -2
  58. package/dist/node_modules/hookable/dist/index.mjs +5 -6
  59. package/dist/node_modules/hookable/package.json +13 -13
  60. package/dist/node_modules/ufo/dist/index.mjs +16 -9
  61. package/dist/node_modules/ufo/package.json +15 -14
  62. package/dist/node_modules/unctx/package.json +16 -16
  63. package/dist/node_modules/youch/build/{chunk-4XB2BYKC.js → chunk-7QV3D5YX.js} +2 -4
  64. package/dist/node_modules/youch/build/{chunk-PUHGL6HA.js → chunk-AUGPHE32.js} +2 -4
  65. package/dist/node_modules/youch/build/{chunk-F4I6KX4R.js → chunk-CM7DWJNZ.js} +2 -4
  66. package/dist/node_modules/youch/build/{chunk-YYEJ3AGB.js → chunk-EJH674NB.js} +2 -4
  67. package/dist/node_modules/youch/build/{chunk-EUJBVOYB.js → chunk-OIJ3WD7L.js} +2 -4
  68. package/dist/node_modules/youch/build/{chunk-HFSXRSKS.js → chunk-P36L72PL.js} +5 -3
  69. package/dist/node_modules/youch/build/{chunk-4YEN7HVQ.js → chunk-PE3GG3TN.js} +5 -1
  70. package/dist/node_modules/youch/build/{chunk-PINJDICN.js → chunk-X53OIOJH.js} +2 -4
  71. package/dist/node_modules/youch/build/index.js +8 -9
  72. package/dist/node_modules/youch/build/public/error_info/style.css +1 -0
  73. package/dist/node_modules/youch/build/public/error_metadata/style.css +3 -0
  74. package/dist/node_modules/youch/build/public/error_stack/style.css +2 -3
  75. package/dist/node_modules/youch/package.json +1 -1
  76. package/dist/presets/_nitro/runtime/nitro-dev.d.mts +1 -1
  77. package/dist/presets/_nitro/runtime/nitro-dev.mjs +5 -6
  78. package/dist/presets/_nitro/runtime/nitro-prerenderer.d.mts +1 -1
  79. package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +1 -1
  80. package/dist/presets/_nitro/runtime/service-worker.d.mts +1 -1
  81. package/dist/presets/_nitro/runtime/service-worker.mjs +2 -2
  82. package/dist/presets/aws-amplify/runtime/aws-amplify.d.mts +1 -1
  83. package/dist/presets/aws-amplify/runtime/aws-amplify.mjs +1 -1
  84. package/dist/presets/aws-lambda/runtime/_utils.d.mts +0 -5
  85. package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.d.mts +1 -1
  86. package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +9 -11
  87. package/dist/presets/aws-lambda/runtime/aws-lambda.d.mts +1 -1
  88. package/dist/presets/aws-lambda/runtime/aws-lambda.mjs +1 -1
  89. package/dist/presets/azure/runtime/azure-swa.d.mts +1 -1
  90. package/dist/presets/azure/runtime/azure-swa.mjs +1 -1
  91. package/dist/presets/bun/runtime/bun.d.mts +1 -1
  92. package/dist/presets/bun/runtime/bun.mjs +7 -8
  93. package/dist/presets/cloudflare/runtime/_module-handler.d.mts +3 -3
  94. package/dist/presets/cloudflare/runtime/_module-handler.mjs +19 -17
  95. package/dist/presets/cloudflare/runtime/cloudflare-durable.d.mts +1 -1
  96. package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +17 -16
  97. package/dist/presets/cloudflare/runtime/cloudflare-module.d.mts +1 -1
  98. package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +8 -9
  99. package/dist/presets/cloudflare/runtime/cloudflare-pages.d.mts +1 -1
  100. package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +12 -18
  101. package/dist/presets/deno/runtime/deno-deploy.d.mts +1 -1
  102. package/dist/presets/deno/runtime/deno-deploy.mjs +4 -5
  103. package/dist/presets/deno/runtime/deno-server.d.mts +1 -1
  104. package/dist/presets/deno/runtime/deno-server.mjs +5 -6
  105. package/dist/presets/netlify/runtime/netlify-edge.d.mts +1 -2
  106. package/dist/presets/netlify/runtime/netlify-edge.mjs +3 -2
  107. package/dist/presets/netlify/runtime/netlify.d.mts +3 -2
  108. package/dist/presets/netlify/runtime/netlify.mjs +3 -1
  109. package/dist/presets/node/runtime/node-cluster.d.mts +1 -1
  110. package/dist/presets/node/runtime/node-cluster.mjs +5 -6
  111. package/dist/presets/node/runtime/node-middleware.d.mts +1 -1
  112. package/dist/presets/node/runtime/node-middleware.mjs +4 -5
  113. package/dist/presets/node/runtime/node-server.d.mts +1 -1
  114. package/dist/presets/node/runtime/node-server.mjs +5 -6
  115. package/dist/presets/standard/runtime/server.d.mts +1 -1
  116. package/dist/presets/standard/runtime/server.mjs +1 -1
  117. package/dist/presets/stormkit/runtime/stormkit.d.mts +1 -1
  118. package/dist/presets/stormkit/runtime/stormkit.mjs +1 -1
  119. package/dist/presets/vercel/runtime/isr.d.mts +2 -0
  120. package/dist/presets/vercel/runtime/isr.mjs +19 -0
  121. package/dist/presets/vercel/runtime/vercel.node.d.mts +1 -1
  122. package/dist/presets/vercel/runtime/vercel.node.mjs +16 -7
  123. package/dist/presets/vercel/runtime/vercel.web.d.mts +1 -1
  124. package/dist/presets/vercel/runtime/vercel.web.mjs +18 -13
  125. package/dist/presets/winterjs/runtime/winterjs.d.mts +1 -2
  126. package/dist/presets/winterjs/runtime/winterjs.mjs +1 -1
  127. package/dist/presets/zeabur/runtime/zeabur.d.mts +1 -1
  128. package/dist/presets/zeabur/runtime/zeabur.mjs +1 -1
  129. package/dist/runtime/app.d.mts +1 -1
  130. package/dist/runtime/app.mjs +1 -1
  131. package/dist/runtime/internal/app.d.mts +7 -3
  132. package/dist/runtime/internal/app.mjs +29 -22
  133. package/dist/runtime/internal/database.mjs +1 -1
  134. package/dist/runtime/internal/error/dev.d.mts +0 -1
  135. package/dist/runtime/internal/error/dev.mjs +1 -1
  136. package/dist/runtime/internal/route-rules.d.mts +0 -4
  137. package/dist/runtime/internal/routes/dev-tasks.mjs +1 -1
  138. package/dist/runtime/internal/routes/openapi.d.mts +0 -1
  139. package/dist/runtime/internal/routes/openapi.mjs +3 -3
  140. package/dist/runtime/internal/routes/renderer-template.dev.mjs +1 -1
  141. package/dist/runtime/internal/routes/renderer-template.mjs +1 -1
  142. package/dist/runtime/internal/routes/scalar.d.mts +0 -1
  143. package/dist/runtime/internal/routes/scalar.mjs +4 -4
  144. package/dist/runtime/internal/routes/swagger.d.mts +0 -1
  145. package/dist/runtime/internal/routes/swagger.mjs +3 -3
  146. package/dist/runtime/internal/runtime-config.mjs +8 -8
  147. package/dist/runtime/internal/static.mjs +1 -1
  148. package/dist/runtime/internal/storage.mjs +1 -1
  149. package/dist/runtime/internal/task.mjs +1 -1
  150. package/dist/runtime/internal/vite/dev-entry.mjs +3 -4
  151. package/dist/runtime/internal/vite/{dev-worker.mjs → node-runner.mjs} +51 -6
  152. package/dist/runtime/meta.d.mts +1 -1
  153. package/dist/runtime/meta.mjs +1 -1
  154. package/dist/runtime/nitro.d.mts +0 -3
  155. package/dist/runtime/nitro.mjs +1 -1
  156. package/dist/runtime/virtual/_runtime_warn.d.mts +1 -0
  157. package/dist/runtime/virtual/_runtime_warn.mjs +5 -0
  158. package/dist/runtime/virtual/database.d.mts +8 -0
  159. package/dist/runtime/virtual/database.mjs +2 -0
  160. package/dist/runtime/virtual/error-handler.d.mts +6 -0
  161. package/dist/runtime/virtual/error-handler.mjs +9 -0
  162. package/dist/runtime/virtual/feature-flags.d.mts +7 -0
  163. package/dist/runtime/virtual/feature-flags.mjs +7 -0
  164. package/dist/runtime/virtual/plugins.d.mts +3 -0
  165. package/dist/runtime/virtual/plugins.mjs +2 -0
  166. package/dist/runtime/virtual/polyfills.d.mts +3 -0
  167. package/dist/runtime/virtual/polyfills.mjs +2 -0
  168. package/dist/runtime/virtual/public-assets.d.mts +9 -0
  169. package/dist/runtime/virtual/public-assets.mjs +8 -0
  170. package/dist/runtime/virtual/renderer-template.d.mts +4 -0
  171. package/dist/runtime/virtual/renderer-template.mjs +7 -0
  172. package/dist/runtime/virtual/routing-meta.d.mts +7 -0
  173. package/dist/runtime/virtual/routing-meta.mjs +2 -0
  174. package/dist/runtime/virtual/routing.d.mts +8 -0
  175. package/dist/runtime/virtual/routing.mjs +11 -0
  176. package/dist/runtime/virtual/runtime-config.d.mts +3 -0
  177. package/dist/runtime/virtual/runtime-config.mjs +5 -0
  178. package/dist/runtime/virtual/server-assets.d.mts +6 -0
  179. package/dist/runtime/virtual/server-assets.mjs +12 -0
  180. package/dist/runtime/virtual/storage.d.mts +3 -0
  181. package/dist/runtime/virtual/storage.mjs +5 -0
  182. package/dist/runtime/virtual/tasks.d.mts +10 -0
  183. package/dist/runtime/virtual/tasks.mjs +3 -0
  184. package/dist/types/index.d.mts +292 -371
  185. package/dist/types/index.mjs +10 -0
  186. package/dist/vite.d.mts +7 -12
  187. package/dist/vite.mjs +734 -41
  188. package/lib/vite.types.d.mts +26 -0
  189. package/lib/vite.types.mjs +2 -0
  190. package/package.json +82 -53
  191. package/dist/_build/common2.mjs +0 -772
  192. package/dist/_build/vite.plugin.mjs +0 -768
  193. package/dist/_chunks/ANM1K1bE.mjs +0 -304
  194. package/dist/_chunks/BX9-zVkM.mjs +0 -59
  195. package/dist/_chunks/C7CbzoI1.mjs +0 -39
  196. package/dist/_libs/acorn.mjs +0 -5034
  197. package/dist/_libs/c12.mjs +0 -2858
  198. package/dist/_libs/commondir.mjs +0 -22
  199. package/dist/_libs/deepmerge.mjs +0 -86
  200. package/dist/_libs/dot-prop.mjs +0 -138
  201. package/dist/_libs/duplexer.mjs +0 -71
  202. package/dist/_libs/etag.mjs +0 -80
  203. package/dist/_libs/fdir.mjs +0 -514
  204. package/dist/_libs/function-bind.mjs +0 -63
  205. package/dist/_libs/giget.mjs +0 -19289
  206. package/dist/_libs/gzip-size.mjs +0 -21
  207. package/dist/_libs/hasown.mjs +0 -14
  208. package/dist/_libs/is-core-module.mjs +0 -220
  209. package/dist/_libs/is-module.mjs +0 -13
  210. package/dist/_libs/is-reference.mjs +0 -32
  211. package/dist/_libs/js-tokens.mjs +0 -382
  212. package/dist/_libs/knitwork.mjs +0 -124
  213. package/dist/_libs/local-pkg.mjs +0 -1686
  214. package/dist/_libs/magic-string.mjs +0 -939
  215. package/dist/_libs/mime.mjs +0 -1391
  216. package/dist/_libs/node-fetch-native.mjs +0 -173
  217. package/dist/_libs/path-parse.mjs +0 -47
  218. package/dist/_libs/pathe.mjs +0 -41
  219. package/dist/_libs/picomatch.mjs +0 -1673
  220. package/dist/_libs/plugin-replace.mjs +0 -104
  221. package/dist/_libs/pretty-bytes.mjs +0 -116
  222. package/dist/_libs/std-env.mjs +0 -158
  223. package/dist/_libs/strip-literal.mjs +0 -51
  224. package/dist/_libs/tinyglobby.mjs +0 -292
  225. package/dist/_libs/untyped.mjs +0 -271
  226. package/dist/_libs/unwasm.mjs +0 -5836
  227. package/dist/cli/_chunks/detect-acorn.mjs +0 -12
  228. package/dist/cli/_chunks/dist.mjs +0 -3
  229. package/dist/cli/_chunks/dist2.mjs +0 -3
  230. package/dist/cli/_chunks/dist3.mjs +0 -3
  231. package/dist/cli/_chunks/dist4.mjs +0 -4
  232. package/dist/cli/_chunks/dist5.mjs +0 -4
  233. package/dist/cli/_chunks/esm.mjs +0 -3
  234. package/dist/cli/_chunks/json5.mjs +0 -4
  235. package/dist/cli/_chunks/jsonc.mjs +0 -4
  236. package/dist/cli/_chunks/multipart-parser.mjs +0 -6
  237. package/dist/cli/_chunks/toml.mjs +0 -4
  238. package/dist/cli/_chunks/yaml.mjs +0 -4
  239. package/dist/node_modules/kleur/index.js +0 -110
  240. package/dist/node_modules/youch/build/chunk-OSUFJZHZ.js +0 -6
  241. package/lib/deps/ofetch.mjs +0 -1
  242. package/lib/deps/ofetch.mts +0 -1
  243. /package/dist/runtime/{vite-runtime.d.mts → vite.d.mts} +0 -0
  244. /package/dist/runtime/{vite-runtime.mjs → vite.mjs} +0 -0
  245. /package/lib/{deps/h3.d.mts → h3.d.mts} +0 -0
  246. /package/lib/{deps/h3.mjs → h3.mjs} +0 -0
@@ -1,11 +1,12 @@
1
- import "#nitro-internal-pollyfills";
1
+ import "#nitro/virtual/polyfills";
2
2
  import { useNitroApp } from "nitro/app";
3
- import { isPublicAssetURL } from "#nitro-internal-virtual/public-assets";
3
+ import { isPublicAssetURL } from "#nitro/virtual/public-assets";
4
4
  const nitroApp = useNitroApp();
5
5
  // https://docs.netlify.com/edge-functions/api/
6
6
  export default async function netlifyEdge(netlifyReq, context) {
7
7
  // srvx compatibility
8
8
  const req = netlifyReq;
9
+ req.ip = context.ip;
9
10
  req.runtime ??= { name: "netlify-edge" };
10
11
  // @ts-expect-error (add to srvx types)
11
12
  req.runtime.netlify ??= { context };
@@ -1,3 +1,4 @@
1
- import "#nitro-internal-pollyfills";
2
- declare const handler: (req: Request) => Promise<Response>;
1
+ import "#nitro/virtual/polyfills";
2
+ import type { ServerRequest } from "srvx";
3
+ declare const handler: (req: ServerRequest) => Promise<Response>;
3
4
  export default handler;
@@ -1,8 +1,10 @@
1
- import "#nitro-internal-pollyfills";
1
+ import "#nitro/virtual/polyfills";
2
2
  import { useNitroApp } from "nitro/app";
3
3
  const nitroApp = useNitroApp();
4
4
  const ONE_YEAR_IN_SECONDS = 365 * 24 * 60 * 60;
5
5
  const handler = async (req) => {
6
+ req.runtime ??= { name: "netlify" };
7
+ req.ip = req.headers.get("x-nf-client-connection-ip") || undefined;
6
8
  const response = await nitroApp.fetch(req);
7
9
  const isr = (req.context?.routeRules || {})?.isr?.options;
8
10
  if (isr) {
@@ -1,3 +1,3 @@
1
- import "#nitro-internal-pollyfills";
1
+ import "#nitro/virtual/polyfills";
2
2
  declare const _default: {};
3
3
  export default _default;
@@ -1,12 +1,11 @@
1
- import "#nitro-internal-pollyfills";
1
+ import "#nitro/virtual/polyfills";
2
2
  import cluster from "node:cluster";
3
3
  import { NodeRequest, serve } from "srvx/node";
4
4
  import wsAdapter from "crossws/adapters/node";
5
5
  import { useNitroApp } from "nitro/app";
6
- import { startScheduleRunner } from "nitro/~internal/runtime/task";
7
- import { trapUnhandledErrors } from "nitro/~internal/runtime/error/hooks";
8
- import { resolveWebsocketHooks } from "nitro/~internal/runtime/app";
9
- import { hasWebSocket } from "#nitro-internal-virtual/feature-flags";
6
+ import { startScheduleRunner } from "#nitro/runtime/task";
7
+ import { trapUnhandledErrors } from "#nitro/runtime/error/hooks";
8
+ import { resolveWebsocketHooks } from "#nitro/runtime/app";
10
9
  const port = Number.parseInt(process.env.NITRO_PORT || process.env.PORT || "") || 3e3;
11
10
  const host = process.env.NITRO_HOST || process.env.HOST;
12
11
  const cert = process.env.NITRO_SSL_CERT;
@@ -28,7 +27,7 @@ const server = serve({
28
27
  silent: clusterId ? clusterId !== "1" : undefined,
29
28
  fetch: nitroApp.fetch
30
29
  });
31
- if (hasWebSocket) {
30
+ if (import.meta._websocket) {
32
31
  const { handleUpgrade } = wsAdapter({ resolve: resolveWebsocketHooks });
33
32
  server.node.server.on("upgrade", (req, socket, head) => {
34
33
  handleUpgrade(
@@ -1,3 +1,3 @@
1
- import "#nitro-internal-pollyfills";
1
+ import "#nitro/virtual/polyfills";
2
2
  export declare const middleware: unknown;
3
3
  export declare const handleUpgrade: unknown;
@@ -1,13 +1,12 @@
1
- import "#nitro-internal-pollyfills";
1
+ import "#nitro/virtual/polyfills";
2
2
  import { toNodeHandler } from "srvx/node";
3
3
  import wsAdapter from "crossws/adapters/node";
4
4
  import { useNitroApp } from "nitro/app";
5
- import { startScheduleRunner } from "nitro/~internal/runtime/task";
6
- import { resolveWebsocketHooks } from "nitro/~internal/runtime/app";
7
- import { hasWebSocket } from "#nitro-internal-virtual/feature-flags";
5
+ import { startScheduleRunner } from "#nitro/runtime/task";
6
+ import { resolveWebsocketHooks } from "#nitro/runtime/app";
8
7
  const nitroApp = useNitroApp();
9
8
  export const middleware = toNodeHandler(nitroApp.fetch);
10
- const ws = hasWebSocket ? wsAdapter({ resolve: resolveWebsocketHooks }) : undefined;
9
+ const ws = import.meta._websocket ? wsAdapter({ resolve: resolveWebsocketHooks }) : undefined;
11
10
  export const handleUpgrade = ws?.handleUpgrade;
12
11
  // Scheduled tasks
13
12
  if (import.meta._tasks) {
@@ -1,3 +1,3 @@
1
- import "#nitro-internal-pollyfills";
1
+ import "#nitro/virtual/polyfills";
2
2
  declare const _default: {};
3
3
  export default _default;
@@ -1,11 +1,10 @@
1
- import "#nitro-internal-pollyfills";
1
+ import "#nitro/virtual/polyfills";
2
2
  import { NodeRequest, serve } from "srvx/node";
3
3
  import wsAdapter from "crossws/adapters/node";
4
4
  import { useNitroApp } from "nitro/app";
5
- import { startScheduleRunner } from "nitro/~internal/runtime/task";
6
- import { trapUnhandledErrors } from "nitro/~internal/runtime/error/hooks";
7
- import { resolveWebsocketHooks } from "nitro/~internal/runtime/app";
8
- import { hasWebSocket } from "#nitro-internal-virtual/feature-flags";
5
+ import { startScheduleRunner } from "#nitro/runtime/task";
6
+ import { trapUnhandledErrors } from "#nitro/runtime/error/hooks";
7
+ import { resolveWebsocketHooks } from "#nitro/runtime/app";
9
8
  const port = Number.parseInt(process.env.NITRO_PORT || process.env.PORT || "") || 3e3;
10
9
  const host = process.env.NITRO_HOST || process.env.HOST;
11
10
  const cert = process.env.NITRO_SSL_CERT;
@@ -21,7 +20,7 @@ const server = serve({
21
20
  } : undefined,
22
21
  fetch: nitroApp.fetch
23
22
  });
24
- if (hasWebSocket) {
23
+ if (import.meta._websocket) {
25
24
  const { handleUpgrade } = wsAdapter({ resolve: resolveWebsocketHooks });
26
25
  server.node.server.on("upgrade", (req, socket, head) => {
27
26
  handleUpgrade(
@@ -1,3 +1,3 @@
1
- import "#nitro-internal-pollyfills";
1
+ import "#nitro/virtual/polyfills";
2
2
  declare const _default: {};
3
3
  export default _default;
@@ -1,4 +1,4 @@
1
- import "#nitro-internal-pollyfills";
1
+ import "#nitro/virtual/polyfills";
2
2
  import { useNitroApp } from "nitro/app";
3
3
  const nitroApp = useNitroApp();
4
4
  export default { fetch: nitroApp.fetch };
@@ -1,4 +1,4 @@
1
- import "#nitro-internal-pollyfills";
1
+ import "#nitro/virtual/polyfills";
2
2
  import type { Handler } from "aws-lambda";
3
3
  type StormkitEvent = {
4
4
  url: string;
@@ -1,4 +1,4 @@
1
- import "#nitro-internal-pollyfills";
1
+ import "#nitro/virtual/polyfills";
2
2
  import { useNitroApp } from "nitro/app";
3
3
  import { awsResponseBody } from "../../aws-lambda/runtime/_utils.mjs";
4
4
  const nitroApp = useNitroApp();
@@ -0,0 +1,2 @@
1
+ export declare const ISR_URL_PARAM = "__isr_route";
2
+ export declare function isrRouteRewrite(reqUrl: string, xNowRouteMatches: string | null): [pathname: string, search: string] | undefined;
@@ -0,0 +1,19 @@
1
+ export const ISR_URL_PARAM = "__isr_route";
2
+ export function isrRouteRewrite(reqUrl, xNowRouteMatches) {
3
+ if (xNowRouteMatches) {
4
+ const isrURL = new URLSearchParams(xNowRouteMatches).get(ISR_URL_PARAM);
5
+ if (isrURL) {
6
+ return [decodeURIComponent(isrURL), ""];
7
+ }
8
+ } else {
9
+ const queryIndex = reqUrl.indexOf("?");
10
+ if (queryIndex !== -1) {
11
+ const params = new URLSearchParams(reqUrl.slice(queryIndex + 1));
12
+ const isrURL = params.get(ISR_URL_PARAM);
13
+ if (isrURL) {
14
+ params.delete(ISR_URL_PARAM);
15
+ return [decodeURIComponent(isrURL), params.toString()];
16
+ }
17
+ }
18
+ }
19
+ }
@@ -1,3 +1,3 @@
1
- import "#nitro-internal-pollyfills";
1
+ import "#nitro/virtual/polyfills";
2
2
  import type { NodeServerRequest, NodeServerResponse } from "srvx";
3
3
  export default function nodeHandler(req: NodeServerRequest, res: NodeServerResponse);
@@ -1,14 +1,23 @@
1
- import "#nitro-internal-pollyfills";
1
+ import "#nitro/virtual/polyfills";
2
2
  import { toNodeHandler } from "srvx/node";
3
- import { useNitroApp } from "nitro/app";
3
+ import { useNitroApp, getRouteRules } from "nitro/app";
4
+ import { isrRouteRewrite } from "./isr.mjs";
4
5
  const nitroApp = useNitroApp();
5
6
  const handler = toNodeHandler(nitroApp.fetch);
6
7
  export default function nodeHandler(req, res) {
7
- const query = req.headers["x-now-route-matches"];
8
- if (query) {
9
- const url = new URLSearchParams(query).get("url");
10
- if (url) {
11
- req.url = decodeURIComponent(url);
8
+ // https://vercel.com/docs/headers/request-headers#x-forwarded-for
9
+ // srvx node adapter uses req.socket.remoteAddress for req.ip
10
+ let ip;
11
+ Object.defineProperty(req.socket, "remoteAddress", { get() {
12
+ const h = req.headers["x-forwarded-for"];
13
+ return ip ??= h?.split?.(",").shift()?.trim();
14
+ } });
15
+ // ISR route rewrite
16
+ const isrURL = isrRouteRewrite(req.url, req.headers["x-now-route-matches"]);
17
+ if (isrURL) {
18
+ const { routeRules } = getRouteRules("", isrURL[0]);
19
+ if (routeRules?.isr) {
20
+ req.url = isrURL[0] + (isrURL[1] ? `?${isrURL[1]}` : "");
12
21
  }
13
22
  }
14
23
  return handler(req, res);
@@ -1,4 +1,4 @@
1
- import "#nitro-internal-pollyfills";
1
+ import "#nitro/virtual/polyfills";
2
2
  import type { ServerRequest } from "srvx";
3
3
  declare const _default: {
4
4
  fetch(req: ServerRequest, context: {
@@ -1,20 +1,25 @@
1
- import "#nitro-internal-pollyfills";
2
- import { useNitroApp } from "nitro/app";
1
+ import "#nitro/virtual/polyfills";
2
+ import { useNitroApp, getRouteRules } from "nitro/app";
3
+ import { isrRouteRewrite } from "./isr.mjs";
3
4
  const nitroApp = useNitroApp();
4
5
  export default { fetch(req, context) {
5
- // Check for ISR request
6
- const query = req.headers.get("x-now-route-matches");
7
- if (query) {
8
- const urlParam = new URLSearchParams(query).get("url");
9
- if (urlParam) {
10
- const url = new URL(decodeURIComponent(urlParam), req.url).href;
11
- req = new Request(url, req);
6
+ // ISR route rewrite
7
+ const isrURL = isrRouteRewrite(req.url, req.headers.get("x-now-route-matches"));
8
+ if (isrURL) {
9
+ const { routeRules } = getRouteRules("", isrURL[0]);
10
+ if (routeRules?.isr) {
11
+ req = new Request(new URL(isrURL[0] + (isrURL[1] ? `?${isrURL[1]}` : ""), req.url).href, req);
12
12
  }
13
13
  }
14
- // srvx compatibility
15
- req.runtime ??= { name: "vercel" };
16
- // @ts-expect-error (add to srvx types)
17
- req.runtime.vercel = { context };
14
+ req.runtime = {
15
+ name: "vercel",
16
+ vercel: { context }
17
+ };
18
+ let ip;
19
+ Object.defineProperty(req, "ip", { get() {
20
+ const h = req.headers.get("x-forwarded-for");
21
+ return ip ??= h?.split(",").shift()?.trim();
22
+ } });
18
23
  req.waitUntil = context?.waitUntil;
19
24
  return nitroApp.fetch(req);
20
25
  } };
@@ -1,3 +1,2 @@
1
- // @ts-nocheck TODO: Remove after removing polyfills
2
- import "#nitro-internal-pollyfills";
1
+ import "#nitro/virtual/polyfills";
3
2
  export {};
@@ -1,5 +1,5 @@
1
1
  // @ts-nocheck TODO: Remove after removing polyfills
2
- import "#nitro-internal-pollyfills";
2
+ import "#nitro/virtual/polyfills";
3
3
  import { useNitroApp } from "nitro/app";
4
4
  import { hasProtocol, joinURL } from "ufo";
5
5
  const nitroApp = useNitroApp();
@@ -1,3 +1,3 @@
1
- import "#nitro-internal-pollyfills";
1
+ import "#nitro/virtual/polyfills";
2
2
  declare const _default;
3
3
  export default _default;
@@ -1,4 +1,4 @@
1
- import "#nitro-internal-pollyfills";
1
+ import "#nitro/virtual/polyfills";
2
2
  import { toNodeHandler } from "srvx/node";
3
3
  import { useNitroApp } from "nitro/app";
4
4
  export default toNodeHandler(useNitroApp().fetch);
@@ -1 +1 @@
1
- export { useNitroApp, useNitroHooks, serverFetch, fetch } from "./internal/app.mjs";
1
+ export { useNitroApp, useNitroHooks, serverFetch, getRouteRules, fetch } from "./internal/app.mjs";
@@ -1 +1 @@
1
- export { useNitroApp, useNitroHooks, serverFetch, fetch } from "./internal/app.mjs";
1
+ export { useNitroApp, useNitroHooks, serverFetch, getRouteRules, fetch } from "./internal/app.mjs";
@@ -1,12 +1,16 @@
1
- import type { NitroApp, NitroRuntimeHooks } from "nitro/types";
1
+ import type { MatchedRouteRules, NitroApp, NitroRuntimeHooks } from "nitro/types";
2
2
  import type { ServerRequest, ServerRequestContext } from "srvx";
3
- import type { H3EventContext, WebSocketHooks } from "h3";
3
+ import type { H3EventContext, Middleware, WebSocketHooks } from "h3";
4
4
  import { HookableCore } from "hookable";
5
5
  declare global {
6
- var __nitro__: NitroApp | undefined;
6
+ var __nitro__: Partial<Record<"default" | "prerender" | (string & {}), NitroApp | undefined>> | undefined;
7
7
  }
8
8
  export declare function useNitroApp(): NitroApp;
9
9
  export declare function useNitroHooks(): HookableCore<NitroRuntimeHooks>;
10
10
  export declare function serverFetch(resource: string | URL | Request, init?: RequestInit, context?: ServerRequestContext | H3EventContext): Promise<Response>;
11
11
  export declare function resolveWebsocketHooks(req: ServerRequest): Promise<Partial<WebSocketHooks>>;
12
12
  export declare function fetch(resource: string | URL | Request, init?: RequestInit, context?: ServerRequestContext | H3EventContext): Promise<Response>;
13
+ export declare function getRouteRules(method: string, pathname: string): {
14
+ routeRules?: MatchedRouteRules;
15
+ routeRuleMiddleware: Middleware[];
16
+ };
@@ -2,12 +2,23 @@ import { H3Core, toRequest } from "h3";
2
2
  import { HookableCore } from "hookable";
3
3
  import { nitroAsyncContext } from "./context.mjs";
4
4
  // IMPORTANT: virtual imports and user code should be imported last to avoid initialization order issues
5
- import errorHandler from "#nitro-internal-virtual/error-handler";
6
- import { plugins } from "#nitro-internal-virtual/plugins";
7
- import { findRoute, findRouteRules, globalMiddleware, findRoutedMiddleware } from "#nitro-internal-virtual/routing";
8
- import { hasRouteRules, hasRoutedMiddleware, hasGlobalMiddleware, hasRoutes, hasHooks, hasPlugins } from "#nitro-internal-virtual/feature-flags";
5
+ import errorHandler from "#nitro/virtual/error-handler";
6
+ import { plugins } from "#nitro/virtual/plugins";
7
+ import { findRoute, findRouteRules, globalMiddleware, findRoutedMiddleware } from "#nitro/virtual/routing";
8
+ import { hasRouteRules, hasRoutedMiddleware, hasGlobalMiddleware, hasRoutes, hasHooks, hasPlugins } from "#nitro/virtual/feature-flags";
9
+ const APP_ID = import.meta.prerender ? "prerender" : "default";
9
10
  export function useNitroApp() {
10
- return useNitroApp.__instance__ ??= initNitroApp();
11
+ let instance = useNitroApp._instance;
12
+ if (instance) {
13
+ return instance;
14
+ }
15
+ instance = useNitroApp._instance = createNitroApp();
16
+ globalThis.__nitro__ = globalThis.__nitro__ || {};
17
+ globalThis.__nitro__[APP_ID] = instance;
18
+ if (hasPlugins) {
19
+ initNitroPlugins(instance);
20
+ }
21
+ return instance;
11
22
  }
12
23
  export function useNitroHooks() {
13
24
  const nitroApp = useNitroApp();
@@ -42,21 +53,6 @@ export function fetch(resource, init, context) {
42
53
  resource = resource._request || resource;
43
54
  return fetch(resource, init);
44
55
  }
45
- function initNitroApp() {
46
- const nitroApp = createNitroApp();
47
- if (hasPlugins) {
48
- for (const plugin of plugins) {
49
- try {
50
- plugin(nitroApp);
51
- } catch (error) {
52
- nitroApp.captureError?.(error, { tags: ["plugin"] });
53
- throw error;
54
- }
55
- }
56
- }
57
- globalThis.__nitro__ = nitroApp;
58
- return nitroApp;
59
- }
60
56
  function createNitroApp() {
61
57
  const hooks = hasHooks ? new HookableCore() : undefined;
62
58
  const captureError = (error, errorCtx) => {
@@ -71,7 +67,7 @@ function createNitroApp() {
71
67
  context: errorCtx
72
68
  });
73
69
  }
74
- if (hasHooks && typeof errorCtx.event.req.waitUntil === "function") {
70
+ if (hasHooks && promise && typeof errorCtx.event.req.waitUntil === "function") {
75
71
  errorCtx.event.req.waitUntil(promise);
76
72
  }
77
73
  }
@@ -119,6 +115,17 @@ function createNitroApp() {
119
115
  };
120
116
  return app;
121
117
  }
118
+ function initNitroPlugins(app) {
119
+ for (const plugin of plugins) {
120
+ try {
121
+ plugin(app);
122
+ } catch (error) {
123
+ app.captureError?.(error, { tags: ["plugin"] });
124
+ throw error;
125
+ }
126
+ }
127
+ return app;
128
+ }
122
129
  function createH3App(config) {
123
130
  // Create H3 app
124
131
  const h3App = new H3Core(config);
@@ -148,7 +155,7 @@ function createH3App(config) {
148
155
  }
149
156
  return h3App;
150
157
  }
151
- function getRouteRules(method, pathname) {
158
+ export function getRouteRules(method, pathname) {
152
159
  const m = findRouteRules(method, pathname);
153
160
  if (!m?.length) {
154
161
  return { routeRuleMiddleware: [] };
@@ -1,5 +1,5 @@
1
1
  import { createDatabase } from "db0";
2
- import { connectionConfigs } from "#nitro-internal-virtual/database";
2
+ import { connectionConfigs } from "#nitro/virtual/database";
3
3
  const instances = Object.create(null);
4
4
  export function useDatabase(name = "default") {
5
5
  if (instances[name]) {
@@ -6,5 +6,4 @@ export declare function defaultHandler(error: HTTPError, event: HTTPEvent, opts?
6
6
  silent?: boolean;
7
7
  json?: boolean;
8
8
  }): Promise<InternalHandlerResponse>;
9
- // ---- Source Map support ----
10
9
  export declare function loadStackTrace(error: any);
@@ -44,7 +44,7 @@ export async function defaultHandler(error, event, opts) {
44
44
  consola.error(`[request error] ${tags} [${event.req.method}] ${url}\n\n`, ansiError);
45
45
  }
46
46
  // Use HTML response only when user-agent expects it (browsers)
47
- const useJSON = opts?.json || !event.req.headers.get("accept")?.includes("text/html");
47
+ const useJSON = opts?.json ?? !event.req.headers.get("accept")?.includes("text/html");
48
48
  // Prepare headers
49
49
  const headers = {
50
50
  "content-type": useJSON ? "application/json" : "text/html",
@@ -1,8 +1,4 @@
1
- // Headers route rule
2
1
  export declare const headers: unknown;
3
- // Redirect route rule
4
2
  export declare const redirect: unknown;
5
- // Proxy route rule
6
3
  export declare const proxy: unknown;
7
- // Cache route rule
8
4
  export declare const cache: unknown;
@@ -1,6 +1,6 @@
1
1
  import { H3 } from "h3";
2
2
  import { runTask } from "../task.mjs";
3
- import { scheduledTasks, tasks } from "#nitro-internal-virtual/tasks";
3
+ import { scheduledTasks, tasks } from "#nitro/virtual/tasks";
4
4
  export default new H3().get("/_nitro/tasks", async () => {
5
5
  const _tasks = await Promise.all(Object.entries(tasks).map(async ([name, task]) => {
6
6
  const _task = await task.resolve?.();
@@ -1,4 +1,3 @@
1
1
  import type { EventHandler } from "h3";
2
- // Served as /_openapi.json
3
2
  declare const _default: EventHandler;
4
3
  export default _default;
@@ -1,7 +1,7 @@
1
1
  import { defineHandler, getRequestURL } from "h3";
2
2
  import { joinURL } from "ufo";
3
3
  import { defu } from "defu";
4
- import { handlersMeta } from "#nitro-internal-virtual/routing-meta";
4
+ import { handlersMeta } from "#nitro/virtual/routing-meta";
5
5
  import { useRuntimeConfig } from "../runtime-config.mjs";
6
6
  // Served as /_openapi.json
7
7
  export default defineHandler((event) => {
@@ -12,7 +12,7 @@ export default defineHandler((event) => {
12
12
  title: "Nitro Server Routes",
13
13
  ...runtimeConfig.nitro?.openAPI?.meta
14
14
  };
15
- const { paths, globals: { components,...globalsRest } } = getHandlersMeta();
15
+ const { paths, globals: { components, ...globalsRest } } = getHandlersMeta();
16
16
  const extensible = Object.fromEntries(Object.entries(globalsRest).filter(([key]) => key.startsWith("x-")));
17
17
  return {
18
18
  openapi: "3.1.0",
@@ -38,7 +38,7 @@ function getHandlersMeta() {
38
38
  const { route, parameters } = normalizeRoute(h.route || "");
39
39
  const tags = defaultTags(h.route || "");
40
40
  const method = (h.method || "get").toLowerCase();
41
- const { $global,...openAPI } = h.meta?.openAPI || {};
41
+ const { $global, ...openAPI } = h.meta?.openAPI || {};
42
42
  const item = { [method]: {
43
43
  tags,
44
44
  parameters,
@@ -1,5 +1,5 @@
1
1
  import { serverFetch } from "../app.mjs";
2
- import { rendererTemplate, rendererTemplateFile, isStaticTemplate } from "#nitro-internal-virtual/renderer-template";
2
+ import { rendererTemplate, rendererTemplateFile, isStaticTemplate } from "#nitro/virtual/renderer-template";
3
3
  import { HTTPResponse } from "h3";
4
4
  import { hasTemplateSyntax, renderToResponse, compileTemplate } from "rendu";
5
5
  export default async function renderIndexHTML(event) {
@@ -1,4 +1,4 @@
1
- import { rendererTemplate } from "#nitro-internal-virtual/renderer-template";
1
+ import { rendererTemplate } from "#nitro/virtual/renderer-template";
2
2
  export default function renderIndexHTML(event) {
3
3
  return rendererTemplate(event.req);
4
4
  }
@@ -1,4 +1,3 @@
1
1
  import { type EventHandler } from "h3";
2
- // Served as /_scalar
3
2
  declare const _default: EventHandler;
4
3
  export default _default;
@@ -3,11 +3,11 @@ import { useRuntimeConfig } from "../runtime-config.mjs";
3
3
  // Served as /_scalar
4
4
  export default defineHandler((event) => {
5
5
  const runtimeConfig = useRuntimeConfig();
6
- const title = runtimeConfig.nitro.openAPI?.meta?.title || "API Reference";
7
- const description = runtimeConfig.nitro.openAPI?.meta?.description || "";
8
- const openAPIEndpoint = runtimeConfig.nitro.openAPI?.route || "./_openapi.json";
6
+ const title = runtimeConfig.nitro?.openAPI?.meta?.title || "API Reference";
7
+ const description = runtimeConfig.nitro?.openAPI?.meta?.description || "";
8
+ const openAPIEndpoint = runtimeConfig.nitro?.openAPI?.route || "./_openapi.json";
9
9
  // https://github.com/scalar/scalar
10
- const _config = runtimeConfig.nitro.openAPI?.ui?.scalar;
10
+ const _config = runtimeConfig.nitro?.openAPI?.ui?.scalar;
11
11
  const scalarConfig = {
12
12
  ..._config,
13
13
  url: openAPIEndpoint,
@@ -1,4 +1,3 @@
1
1
  import type { EventHandler } from "h3";
2
- // https://github.com/swagger-api/swagger-ui
3
2
  declare const _default: EventHandler;
4
3
  export default _default;
@@ -3,9 +3,9 @@ import { useRuntimeConfig } from "../runtime-config.mjs";
3
3
  // https://github.com/swagger-api/swagger-ui
4
4
  export default defineHandler((event) => {
5
5
  const runtimeConfig = useRuntimeConfig();
6
- const title = runtimeConfig.nitro.openAPI?.meta?.title || "API Reference";
7
- const description = runtimeConfig.nitro.openAPI?.meta?.description || "";
8
- const openAPIEndpoint = runtimeConfig.nitro.openAPI?.route || "./_openapi.json";
6
+ const title = runtimeConfig.nitro?.openAPI?.meta?.title || "API Reference";
7
+ const description = runtimeConfig.nitro?.openAPI?.meta?.description || "";
8
+ const openAPIEndpoint = runtimeConfig.nitro?.openAPI?.route || "./_openapi.json";
9
9
  const CDN_BASE = "https://cdn.jsdelivr.net/npm/swagger-ui-dist@^5";
10
10
  event.res.headers.set("Content-Type", "text/html");
11
11
  return `<!doctype html>
@@ -1,5 +1,5 @@
1
- import { runtimeConfig } from "#nitro-internal-virtual/runtime-config";
2
1
  import { snakeCase } from "scule";
2
+ import { runtimeConfig } from "#nitro/virtual/runtime-config";
3
3
  export function useRuntimeConfig() {
4
4
  return useRuntimeConfig._cached ||= getRuntimeConfig();
5
5
  }
@@ -12,13 +12,6 @@ function getRuntimeConfig() {
12
12
  });
13
13
  return runtimeConfig;
14
14
  }
15
- function getEnv(key, opts) {
16
- const envKey = snakeCase(key).toUpperCase();
17
- return process.env[opts.prefix + envKey] ?? process.env[opts.altPrefix + envKey];
18
- }
19
- function _isObject(input) {
20
- return typeof input === "object" && !Array.isArray(input);
21
- }
22
15
  export function applyEnv(obj, opts, parentKey = "") {
23
16
  for (const key in obj) {
24
17
  const subKey = parentKey ? `${parentKey}_${key}` : key;
@@ -52,3 +45,10 @@ function _expandFromEnv(value) {
52
45
  return process.env[key] || match;
53
46
  });
54
47
  }
48
+ function getEnv(key, opts) {
49
+ const envKey = snakeCase(key).toUpperCase();
50
+ return process.env[opts.prefix + envKey] ?? process.env[opts.altPrefix + envKey];
51
+ }
52
+ function _isObject(input) {
53
+ return input !== null && typeof input === "object" && !Array.isArray(input);
54
+ }
@@ -1,6 +1,6 @@
1
1
  import { HTTPError, defineHandler } from "h3";
2
2
  import { decodePath, joinURL, withLeadingSlash, withoutTrailingSlash } from "ufo";
3
- import { getAsset, isPublicAssetURL, readAsset } from "#nitro-internal-virtual/public-assets";
3
+ import { getAsset, isPublicAssetURL, readAsset } from "#nitro/virtual/public-assets";
4
4
  const METHODS = new Set(["HEAD", "GET"]);
5
5
  const EncodingMap = {
6
6
  gzip: ".gz",
@@ -1,5 +1,5 @@
1
1
  import { prefixStorage } from "unstorage";
2
- import { initStorage } from "#nitro-internal-virtual/storage";
2
+ import { initStorage } from "#nitro/virtual/storage";
3
3
  export function useStorage(base = "") {
4
4
  const storage = useStorage._storage ??= initStorage();
5
5
  return base ? prefixStorage(storage, base) : storage;
@@ -1,6 +1,6 @@
1
1
  import { Cron } from "croner";
2
2
  import { HTTPError } from "h3";
3
- import { scheduledTasks, tasks } from "#nitro-internal-virtual/tasks";
3
+ import { scheduledTasks, tasks } from "#nitro/virtual/tasks";
4
4
  /** @experimental */
5
5
  export function defineTask(def) {
6
6
  if (typeof def.run !== "function") {
@@ -1,15 +1,14 @@
1
- import "#nitro-internal-pollyfills";
1
+ import "#nitro/virtual/polyfills";
2
2
  import wsAdapter from "crossws/adapters/node";
3
3
 
4
4
  import { useNitroApp } from "nitro/app";
5
- import { resolveWebsocketHooks } from "nitro/~internal/runtime/app";
6
- import { hasWebSocket } from "#nitro-internal-virtual/feature-flags";
5
+ import { resolveWebsocketHooks } from "#nitro/runtime/app";
7
6
 
8
7
  const nitroApp = useNitroApp();
9
8
 
10
9
  export const fetch = nitroApp.fetch;
11
10
 
12
- const ws = hasWebSocket
11
+ const ws = import.meta._websocket
13
12
  ? wsAdapter({ resolve: resolveWebsocketHooks })
14
13
  : undefined;
15
14