nitro-nightly 3.0.1-20251215-192435-f38fe7a0 → 3.0.1-20251215-195947-2e108f51

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.
@@ -5,8 +5,8 @@ import { HookableCore } from "hookable";
5
5
  declare global {
6
6
  var __nitro__: Partial<Record<"default" | "prerender" | (string & {}), NitroApp | undefined>> | undefined;
7
7
  }
8
- export declare function useNitroApp(_id?): NitroApp;
9
- export declare function useNitroHooks(_id?): HookableCore<NitroRuntimeHooks>;
8
+ export declare function useNitroApp(): NitroApp;
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>;
@@ -7,20 +7,21 @@ import { plugins } from "#nitro/virtual/plugins";
7
7
  import { findRoute, findRouteRules, globalMiddleware, findRoutedMiddleware } from "#nitro/virtual/routing";
8
8
  import { hasRouteRules, hasRoutedMiddleware, hasGlobalMiddleware, hasRoutes, hasHooks, hasPlugins } from "#nitro/virtual/feature-flags";
9
9
  const APP_ID = import.meta.prerender ? "prerender" : "default";
10
- export function useNitroApp(_id = APP_ID) {
11
- let instance = globalThis.__nitro__?.[_id];
10
+ export function useNitroApp() {
11
+ let instance = useNitroApp._instance;
12
12
  if (instance) {
13
13
  return instance;
14
14
  }
15
- globalThis.__nitro__ ??= {};
16
- instance = globalThis.__nitro__[_id] = createNitroApp();
15
+ instance = useNitroApp._instance = createNitroApp();
16
+ globalThis.__nitro__ = globalThis.__nitro__ || {};
17
+ globalThis.__nitro__[APP_ID] = instance;
17
18
  if (hasPlugins) {
18
19
  initNitroPlugins(instance);
19
20
  }
20
21
  return instance;
21
22
  }
22
- export function useNitroHooks(_id = APP_ID) {
23
- const nitroApp = useNitroApp(_id);
23
+ export function useNitroHooks() {
24
+ const nitroApp = useNitroApp();
24
25
  const hooks = nitroApp.hooks;
25
26
  if (hooks) {
26
27
  return hooks;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitro-nightly",
3
- "version": "3.0.1-20251215-192435-f38fe7a0",
3
+ "version": "3.0.1-20251215-195947-2e108f51",
4
4
  "description": "Build and Deploy Universal JavaScript Servers",
5
5
  "homepage": "https://nitro.build",
6
6
  "repository": "nitrojs/nitro",