@whatwg-node/server 0.1.2 → 0.2.0
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/index.d.ts +1 -1
- package/index.js +5 -0
- package/index.mjs +5 -0
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export interface ServerAdapterObject<TServerContext> extends EventListenerObject
|
|
|
43
43
|
*/
|
|
44
44
|
handle: RequestListener;
|
|
45
45
|
}
|
|
46
|
-
export declare type ServerAdapter<TServerContext, TBaseObject> = TBaseObject & RequestListener & ServerAdapterObject<TServerContext>;
|
|
46
|
+
export declare type ServerAdapter<TServerContext, TBaseObject> = TBaseObject & RequestListener & ServerAdapterObject<TServerContext>['fetch'] & ServerAdapterObject<TServerContext>;
|
|
47
47
|
export declare function createServerAdapter<TServerContext = {
|
|
48
48
|
req: NodeRequest;
|
|
49
49
|
res: ServerResponse;
|
package/index.js
CHANGED
|
@@ -193,6 +193,11 @@ function createServerAdapter({ Request: RequestCtor = fetch.Request, handleReque
|
|
|
193
193
|
handle: requestListener,
|
|
194
194
|
};
|
|
195
195
|
function genericRequestHandler(input, ctx) {
|
|
196
|
+
var _a;
|
|
197
|
+
if ('process' in globalThis && ((_a = process.versions) === null || _a === void 0 ? void 0 : _a['bun']) != null) {
|
|
198
|
+
// This is required for bun
|
|
199
|
+
input.text();
|
|
200
|
+
}
|
|
196
201
|
// If it is a Node request
|
|
197
202
|
if (isReadable(input) && ctx != null && isServerResponse(ctx)) {
|
|
198
203
|
return requestListener(input, ctx);
|
package/index.mjs
CHANGED
|
@@ -189,6 +189,11 @@ function createServerAdapter({ Request: RequestCtor = Request, handleRequest, ba
|
|
|
189
189
|
handle: requestListener,
|
|
190
190
|
};
|
|
191
191
|
function genericRequestHandler(input, ctx) {
|
|
192
|
+
var _a;
|
|
193
|
+
if ('process' in globalThis && ((_a = process.versions) === null || _a === void 0 ? void 0 : _a['bun']) != null) {
|
|
194
|
+
// This is required for bun
|
|
195
|
+
input.text();
|
|
196
|
+
}
|
|
192
197
|
// If it is a Node request
|
|
193
198
|
if (isReadable(input) && ctx != null && isServerResponse(ctx)) {
|
|
194
199
|
return requestListener(input, ctx);
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whatwg-node/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Fetch API compliant HTTP Server adapter",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"peerDependencies": {
|
|
7
7
|
"@types/node": "^18.0.6"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@whatwg-node/fetch": "^0.
|
|
10
|
+
"@whatwg-node/fetch": "^0.4.0",
|
|
11
11
|
"tslib": "^2.3.1"
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|