nitropack-nightly 2.11.0-20250205-154318.5a80d3d4 → 2.11.0-20250206-184858.0f7c3eaf

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.
@@ -1,3 +1,3 @@
1
- const version = "2.11.0-20250205-154318.5a80d3d4";
1
+ const version = "2.11.0-20250206-184858.0f7c3eaf";
2
2
 
3
3
  export { version };
@@ -1,3 +1,3 @@
1
- const version = "2.11.0-20250205-154318.5a80d3d4";
1
+ const version = "2.11.0-20250206-184858.0f7c3eaf";
2
2
 
3
3
  export { version };
@@ -1,3 +1,3 @@
1
- const version = "2.11.0-20250205-154318.5a80d3d4";
1
+ const version = "2.11.0-20250206-184858.0f7c3eaf";
2
2
 
3
3
  export { version };
@@ -11,9 +11,9 @@ import {
11
11
  import { createHooks } from "hookable";
12
12
  import { Headers, createFetch } from "ofetch";
13
13
  import {
14
- createCall,
15
- createFetch as createLocalFetch
16
- } from "unenv/runtime/fetch/index";
14
+ fetchNodeRequestHandler,
15
+ callNodeRequestHandler
16
+ } from "node-mock-http";
17
17
  import errorHandler from "#nitro-internal-virtual/error-handler";
18
18
  import { plugins } from "#nitro-internal-virtual/plugins";
19
19
  import { handlers } from "#nitro-internal-virtual/server-handlers";
@@ -64,11 +64,18 @@ function createNitroApp() {
64
64
  const router = createRouter({
65
65
  preemptive: true
66
66
  });
67
- const localCall = createCall(toNodeListener(h3App));
68
- const _localFetch = createLocalFetch(localCall, (u, i) => globalThis.fetch(u, i));
69
- const localFetch = (input, init) => _localFetch(input, init).then(
70
- (response) => normalizeFetchResponse(response)
71
- );
67
+ const nodeHandler = toNodeListener(h3App);
68
+ const localCall = (aRequest) => callNodeRequestHandler(nodeHandler, aRequest);
69
+ const localFetch = (input, init) => {
70
+ if (!input.toString().startsWith("/")) {
71
+ return globalThis.fetch(input, init);
72
+ }
73
+ return fetchNodeRequestHandler(
74
+ nodeHandler,
75
+ input,
76
+ init
77
+ ).then((response) => normalizeFetchResponse(response));
78
+ };
72
79
  const $fetch = createFetch({
73
80
  fetch: localFetch,
74
81
  Headers,
@@ -4,7 +4,7 @@ import { a as NitroConfig, N as NitroModule, b as NitroOptions } from '../shared
4
4
  export { A as AppConfig, C as CacheEntry, c as CacheOptions, d as CachedEventHandlerOptions, e as CompressOptions, g as DatabaseConnectionConfig, h as DatabaseConnectionConfigs, D as DatabaseConnectionName, l as DevServerOptions, I as EsbuildOptions, O as HTTPStatusCode, L as LoadConfigOptions, u as Nitro, y as NitroBuildInfo, q as NitroDevEventHandler, n as NitroDevServer, v as NitroDynamicConfig, r as NitroErrorHandler, p as NitroEventHandler, x as NitroFrameworkInfo, s as NitroHooks, t as NitroModuleInput, k as NitroOpenAPIConfig, E as NitroPreset, F as NitroPresetMeta, Q as NitroRouteConfig, o as NitroRouteMeta, T as NitroRouteRules, j as NitroRuntimeConfig, i as NitroRuntimeConfigApp, w as NitroTypes, m as NitroWorker, J as NodeExternalsOptions, B as PrerenderGenerateRoute, z as PrerenderRoute, P as PublicAssetDir, M as RawOptions, R as ResponseCacheEntry, G as RollupConfig, H as RollupVirtualOptions, S as ServerAssetDir, K as ServerAssetOptions, f as StorageMounts, V as VirtualModule } from '../shared/nitro.BwjZlymJ.mjs';
5
5
  import { Hookable } from 'hookable';
6
6
  import { NitroRuntimeHooks as NitroRuntimeHooks$1 } from 'nitropack';
7
- import { createCall, createFetch } from 'unenv/runtime/fetch/index';
7
+ import { AbstractRequest, AbstractResponse } from 'node-mock-http';
8
8
  import { CaptureError as CaptureError$1, CapturedErrorContext as CapturedErrorContext$1, CacheOptions } from 'nitropack/types';
9
9
  import 'consola';
10
10
  import 'nitropack/presets';
@@ -52,8 +52,8 @@ interface NitroApp {
52
52
  h3App: App;
53
53
  router: Router;
54
54
  hooks: Hookable<NitroRuntimeHooks>;
55
- localCall: ReturnType<typeof createCall>;
56
- localFetch: ReturnType<typeof createFetch>;
55
+ localCall: (aRequest: AbstractRequest) => Promise<AbstractResponse>;
56
+ localFetch: (req: string | URL | Request, init?: RequestInit & AbstractRequest) => Promise<Response>;
57
57
  captureError: CaptureError;
58
58
  }
59
59
  interface NitroAppPlugin {
@@ -4,7 +4,7 @@ import { a as NitroConfig, N as NitroModule, b as NitroOptions } from '../shared
4
4
  export { A as AppConfig, C as CacheEntry, c as CacheOptions, d as CachedEventHandlerOptions, e as CompressOptions, g as DatabaseConnectionConfig, h as DatabaseConnectionConfigs, D as DatabaseConnectionName, l as DevServerOptions, I as EsbuildOptions, O as HTTPStatusCode, L as LoadConfigOptions, u as Nitro, y as NitroBuildInfo, q as NitroDevEventHandler, n as NitroDevServer, v as NitroDynamicConfig, r as NitroErrorHandler, p as NitroEventHandler, x as NitroFrameworkInfo, s as NitroHooks, t as NitroModuleInput, k as NitroOpenAPIConfig, E as NitroPreset, F as NitroPresetMeta, Q as NitroRouteConfig, o as NitroRouteMeta, T as NitroRouteRules, j as NitroRuntimeConfig, i as NitroRuntimeConfigApp, w as NitroTypes, m as NitroWorker, J as NodeExternalsOptions, B as PrerenderGenerateRoute, z as PrerenderRoute, P as PublicAssetDir, M as RawOptions, R as ResponseCacheEntry, G as RollupConfig, H as RollupVirtualOptions, S as ServerAssetDir, K as ServerAssetOptions, f as StorageMounts, V as VirtualModule } from '../shared/nitro.BwjZlymJ.js';
5
5
  import { Hookable } from 'hookable';
6
6
  import { NitroRuntimeHooks as NitroRuntimeHooks$1 } from 'nitropack';
7
- import { createCall, createFetch } from 'unenv/runtime/fetch/index';
7
+ import { AbstractRequest, AbstractResponse } from 'node-mock-http';
8
8
  import { CaptureError as CaptureError$1, CapturedErrorContext as CapturedErrorContext$1, CacheOptions } from 'nitropack/types';
9
9
  import 'consola';
10
10
  import 'nitropack/presets';
@@ -52,8 +52,8 @@ interface NitroApp {
52
52
  h3App: App;
53
53
  router: Router;
54
54
  hooks: Hookable<NitroRuntimeHooks>;
55
- localCall: ReturnType<typeof createCall>;
56
- localFetch: ReturnType<typeof createFetch>;
55
+ localCall: (aRequest: AbstractRequest) => Promise<AbstractResponse>;
56
+ localFetch: (req: string | URL | Request, init?: RequestInit & AbstractRequest) => Promise<Response>;
57
57
  captureError: CaptureError;
58
58
  }
59
59
  interface NitroAppPlugin {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitropack-nightly",
3
- "version": "2.11.0-20250205-154318.5a80d3d4",
3
+ "version": "2.11.0-20250206-184858.0f7c3eaf",
4
4
  "description": "Build and Deploy Universal JavaScript Servers",
5
5
  "repository": "nitrojs/nitro",
6
6
  "license": "MIT",
@@ -142,6 +142,7 @@
142
142
  "mime": "^4.0.6",
143
143
  "mlly": "^1.7.4",
144
144
  "node-fetch-native": "^1.6.6",
145
+ "node-mock-http": "^1.0.0",
145
146
  "ofetch": "^1.4.1",
146
147
  "ohash": "^1.1.4",
147
148
  "openapi-typescript": "^7.6.0",