@whatwg-node/server 0.4.3 → 0.4.4
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.
- package/README.md +2 -3
- package/index.js +5 -4
- package/index.mjs +5 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -203,9 +203,8 @@ import myServerAdapter from './myServerAdapter'
|
|
|
203
203
|
Bun.serve(myServerAdapter)
|
|
204
204
|
|
|
205
205
|
const server = Bun.serve(yoga)
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
)
|
|
206
|
+
|
|
207
|
+
console.info(`Server is running on ${server.hostname}`)
|
|
209
208
|
```
|
|
210
209
|
|
|
211
210
|
## File Uploads / Multipart Requests
|
package/index.js
CHANGED
|
@@ -203,7 +203,7 @@ RequestCtor = fetch.Request) {
|
|
|
203
203
|
const response$ = handleRequest(event.request, event);
|
|
204
204
|
event.respondWith(response$);
|
|
205
205
|
}
|
|
206
|
-
function handleRequestWithWaitUntil(request, ctx, ...rest) {
|
|
206
|
+
function handleRequestWithWaitUntil(request, ctx = {}, ...rest) {
|
|
207
207
|
var _a;
|
|
208
208
|
if ('process' in globalThis && ((_a = process.versions) === null || _a === void 0 ? void 0 : _a['bun']) != null) {
|
|
209
209
|
// This is required for bun
|
|
@@ -226,10 +226,11 @@ RequestCtor = fetch.Request) {
|
|
|
226
226
|
if (waitUntilPromises.length > 0) {
|
|
227
227
|
return handleWaitUntils(waitUntilPromises).then(() => response$);
|
|
228
228
|
}
|
|
229
|
+
return response$;
|
|
229
230
|
}
|
|
230
231
|
return handleRequest(request, ctx);
|
|
231
232
|
}
|
|
232
|
-
function genericRequestHandler(input, ctx
|
|
233
|
+
function genericRequestHandler(input, ctx, ...rest) {
|
|
233
234
|
// If it is a Node request
|
|
234
235
|
if (isReadable(input) && ctx != null && isServerResponse(ctx)) {
|
|
235
236
|
return requestListener(input, ctx);
|
|
@@ -249,9 +250,9 @@ RequestCtor = fetch.Request) {
|
|
|
249
250
|
}
|
|
250
251
|
function fetchFn(input, init, ...ctx) {
|
|
251
252
|
if (typeof input === 'string' || input instanceof URL) {
|
|
252
|
-
return handleRequestWithWaitUntil(new RequestCtor(input, init),
|
|
253
|
+
return handleRequestWithWaitUntil(new RequestCtor(input, init), ...ctx);
|
|
253
254
|
}
|
|
254
|
-
return handleRequestWithWaitUntil(input,
|
|
255
|
+
return handleRequestWithWaitUntil(input, init, ...ctx);
|
|
255
256
|
}
|
|
256
257
|
const adapterObj = {
|
|
257
258
|
handleRequest,
|
package/index.mjs
CHANGED
|
@@ -199,7 +199,7 @@ RequestCtor = Request) {
|
|
|
199
199
|
const response$ = handleRequest(event.request, event);
|
|
200
200
|
event.respondWith(response$);
|
|
201
201
|
}
|
|
202
|
-
function handleRequestWithWaitUntil(request, ctx, ...rest) {
|
|
202
|
+
function handleRequestWithWaitUntil(request, ctx = {}, ...rest) {
|
|
203
203
|
var _a;
|
|
204
204
|
if ('process' in globalThis && ((_a = process.versions) === null || _a === void 0 ? void 0 : _a['bun']) != null) {
|
|
205
205
|
// This is required for bun
|
|
@@ -222,10 +222,11 @@ RequestCtor = Request) {
|
|
|
222
222
|
if (waitUntilPromises.length > 0) {
|
|
223
223
|
return handleWaitUntils(waitUntilPromises).then(() => response$);
|
|
224
224
|
}
|
|
225
|
+
return response$;
|
|
225
226
|
}
|
|
226
227
|
return handleRequest(request, ctx);
|
|
227
228
|
}
|
|
228
|
-
function genericRequestHandler(input, ctx
|
|
229
|
+
function genericRequestHandler(input, ctx, ...rest) {
|
|
229
230
|
// If it is a Node request
|
|
230
231
|
if (isReadable(input) && ctx != null && isServerResponse(ctx)) {
|
|
231
232
|
return requestListener(input, ctx);
|
|
@@ -245,9 +246,9 @@ RequestCtor = Request) {
|
|
|
245
246
|
}
|
|
246
247
|
function fetchFn(input, init, ...ctx) {
|
|
247
248
|
if (typeof input === 'string' || input instanceof URL) {
|
|
248
|
-
return handleRequestWithWaitUntil(new RequestCtor(input, init),
|
|
249
|
+
return handleRequestWithWaitUntil(new RequestCtor(input, init), ...ctx);
|
|
249
250
|
}
|
|
250
|
-
return handleRequestWithWaitUntil(input,
|
|
251
|
+
return handleRequestWithWaitUntil(input, init, ...ctx);
|
|
251
252
|
}
|
|
252
253
|
const adapterObj = {
|
|
253
254
|
handleRequest,
|