@server/next 0.34.0 → 0.34.1
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 +3 -1
- package/index.js +17 -16
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as http from 'http';
|
|
2
|
+
|
|
1
3
|
type LimitOptions = {
|
|
2
4
|
maxSize?: number | string;
|
|
3
5
|
minSize?: number | string;
|
|
@@ -343,7 +345,7 @@ declare class Server<O extends ServerConfig = {}> extends Router<O> {
|
|
|
343
345
|
port?: number;
|
|
344
346
|
constructor(options?: Options);
|
|
345
347
|
self(): this;
|
|
346
|
-
node(): Promise<
|
|
348
|
+
node(): Promise<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>>;
|
|
347
349
|
fetch(request: Request, env?: BunEnv): Promise<Response>;
|
|
348
350
|
callback(request: Request, context: unknown): Promise<Response>;
|
|
349
351
|
test(): {
|
package/index.js
CHANGED
|
@@ -2525,25 +2525,26 @@ var Winter = async (app, request, env2) => {
|
|
|
2525
2525
|
};
|
|
2526
2526
|
var Node = async (app) => {
|
|
2527
2527
|
const http = await import("http");
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2528
|
+
const { attachWebsocket } = await import("./wsNode-GEJUCJQ7.js");
|
|
2529
|
+
const server2 = http.createServer(
|
|
2530
|
+
async (request, response) => {
|
|
2531
|
+
const ctx = await createNode(request, app);
|
|
2532
|
+
if ("error" in ctx) throw ctx.error;
|
|
2533
|
+
const out = await handleRequest(app, ctx);
|
|
2534
|
+
response.writeHead(out.status || 200, parseHeaders_default(out.headers));
|
|
2535
|
+
if (out.body instanceof ReadableStream) {
|
|
2536
|
+
await iterate(out.body, (chunk) => response.write(chunk));
|
|
2537
|
+
} else {
|
|
2538
|
+
response.write(out.body || "");
|
|
2539
|
+
}
|
|
2540
|
+
response.end();
|
|
2537
2541
|
}
|
|
2538
|
-
|
|
2539
|
-
|
|
2542
|
+
);
|
|
2543
|
+
attachWebsocket(server2, app);
|
|
2544
|
+
server2.listen(app.settings.port, () => {
|
|
2540
2545
|
app.settings.log.start(`http://localhost:${app.settings.port}/`);
|
|
2541
|
-
if (app.handlers.socket.length) {
|
|
2542
|
-
console.warn(
|
|
2543
|
-
"[server] WebSockets (.socket()) are only supported on Bun, not Node"
|
|
2544
|
-
);
|
|
2545
|
-
}
|
|
2546
2546
|
});
|
|
2547
|
+
return server2;
|
|
2547
2548
|
};
|
|
2548
2549
|
var Netlify = async (app, request, context) => {
|
|
2549
2550
|
request.context = context;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@server/next",
|
|
3
|
-
"version": "0.34.
|
|
3
|
+
"version": "0.34.1",
|
|
4
4
|
"description": "A fully-fledged web server with routing, file uploads, sessions, static files, schema validation, websockets, testing, etc.",
|
|
5
5
|
"homepage": "https://server-js.com/",
|
|
6
6
|
"repository": "github:franciscop/server-next",
|