srvx 0.8.11 → 0.8.13
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/dist/_chunks/{_url-BQeTFJZ1.d.mts → _url-D-jAQyRZ.d.mts} +3 -1
- package/dist/_chunks/{call-DYf04jcm.mjs → call-DTWzxxQv.mjs} +1 -1
- package/dist/_chunks/{response-iYyldB4J.mjs → response-CsTwgR_V.mjs} +1 -1
- package/dist/adapters/bun.d.mts +1 -1
- package/dist/adapters/deno.d.mts +1 -1
- package/dist/adapters/node.d.mts +1 -1
- package/dist/adapters/node.mjs +12 -2
- package/dist/cli.mjs +2 -2
- package/package.json +1 -1
|
@@ -20,7 +20,9 @@ type URLInit = {
|
|
|
20
20
|
* - Changes to `searchParams` will be discarded as we don't track them.
|
|
21
21
|
*/
|
|
22
22
|
declare const FastURL: {
|
|
23
|
-
new (url: string | URLInit): URL
|
|
23
|
+
new (url: string | URLInit): URL & {
|
|
24
|
+
_url: URL;
|
|
25
|
+
};
|
|
24
26
|
};
|
|
25
27
|
//#endregion
|
|
26
28
|
export { FastURL as FastURL$2 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./_inherit-DLZfB57K.mjs";
|
|
2
|
-
import { NodeResponse, NodeResponseHeaders } from "./response-
|
|
2
|
+
import { NodeResponse, NodeResponseHeaders } from "./response-CsTwgR_V.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/adapters/_node/call.ts
|
|
5
5
|
function callNodeHandler(handler, req) {
|
|
@@ -172,7 +172,7 @@ function validateHeader(name) {
|
|
|
172
172
|
*/
|
|
173
173
|
const NodeResponse = /* @__PURE__ */ (() => {
|
|
174
174
|
const NativeResponse = globalThis.Response;
|
|
175
|
-
const STATUS_CODES = globalThis.process?.getBuiltinModule("node:http")?.STATUS_CODES || {};
|
|
175
|
+
const STATUS_CODES = globalThis.process?.getBuiltinModule?.("node:http")?.STATUS_CODES || {};
|
|
176
176
|
class NodeResponse$1 {
|
|
177
177
|
#body;
|
|
178
178
|
#init;
|
package/dist/adapters/bun.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BunFetchHandler, Server, ServerOptions } from "../_chunks/types-hx5EhU1U.mjs";
|
|
2
|
-
import { FastURL$2 as FastURL } from "../_chunks/_url-
|
|
2
|
+
import { FastURL$2 as FastURL } from "../_chunks/_url-D-jAQyRZ.mjs";
|
|
3
3
|
import * as bun from "bun";
|
|
4
4
|
|
|
5
5
|
//#region src/adapters/bun.d.ts
|
package/dist/adapters/deno.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DenoFetchHandler, Server, ServerOptions } from "../_chunks/types-hx5EhU1U.mjs";
|
|
2
|
-
import { FastURL$2 as FastURL } from "../_chunks/_url-
|
|
2
|
+
import { FastURL$2 as FastURL } from "../_chunks/_url-D-jAQyRZ.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/adapters/deno.d.ts
|
|
5
5
|
declare const FastResponse: typeof globalThis.Response;
|
package/dist/adapters/node.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FetchHandler, NodeHttpHandler, NodeServerRequest, NodeServerResponse, Server, ServerOptions, ServerRequest } from "../_chunks/types-hx5EhU1U.mjs";
|
|
2
|
-
import { FastURL$2 as FastURL } from "../_chunks/_url-
|
|
2
|
+
import { FastURL$2 as FastURL } from "../_chunks/_url-D-jAQyRZ.mjs";
|
|
3
3
|
import NodeHttp from "node:http";
|
|
4
4
|
import { Readable } from "node:stream";
|
|
5
5
|
|
package/dist/adapters/node.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { createWaitUntil, fmtURL, printListening, resolvePortAndHost, resolveTLS
|
|
|
2
2
|
import { wrapFetch } from "../_chunks/_middleware-BvRR7B4M.mjs";
|
|
3
3
|
import { lazyInherit } from "../_chunks/_inherit-DLZfB57K.mjs";
|
|
4
4
|
import { FastURL$1 as FastURL } from "../_chunks/_url-Q_-LB8LX.mjs";
|
|
5
|
-
import { NodeRequestHeaders, NodeResponse, NodeResponseHeaders } from "../_chunks/response-
|
|
5
|
+
import { NodeRequestHeaders, NodeResponse, NodeResponseHeaders } from "../_chunks/response-CsTwgR_V.mjs";
|
|
6
6
|
import { errorPlugin } from "../_chunks/_plugins-DmMfurBQ.mjs";
|
|
7
7
|
import { splitSetCookieString } from "cookie-es";
|
|
8
8
|
|
|
@@ -69,6 +69,7 @@ function streamBody(stream, nodeRes) {
|
|
|
69
69
|
//#endregion
|
|
70
70
|
//#region src/adapters/_node/url.ts
|
|
71
71
|
var NodeRequestURL = class extends FastURL {
|
|
72
|
+
#req;
|
|
72
73
|
constructor({ req }) {
|
|
73
74
|
const path = req.url || "/";
|
|
74
75
|
if (path[0] === "/") {
|
|
@@ -84,13 +85,21 @@ var NodeRequestURL = class extends FastURL {
|
|
|
84
85
|
search
|
|
85
86
|
});
|
|
86
87
|
} else super(path);
|
|
88
|
+
this.#req = req;
|
|
89
|
+
}
|
|
90
|
+
get pathname() {
|
|
91
|
+
return super.pathname;
|
|
92
|
+
}
|
|
93
|
+
set pathname(value) {
|
|
94
|
+
this._url.pathname = value;
|
|
95
|
+
this.#req.url = this._url.pathname + this._url.search;
|
|
87
96
|
}
|
|
88
97
|
};
|
|
89
98
|
|
|
90
99
|
//#endregion
|
|
91
100
|
//#region src/adapters/_node/request.ts
|
|
92
101
|
const NodeRequest = /* @__PURE__ */ (() => {
|
|
93
|
-
|
|
102
|
+
let Readable;
|
|
94
103
|
const NativeRequest = globalThis._Request ??= globalThis.Request;
|
|
95
104
|
const PatchedRequest = class Request extends NativeRequest {
|
|
96
105
|
static _srvx = true;
|
|
@@ -141,6 +150,7 @@ const NodeRequest = /* @__PURE__ */ (() => {
|
|
|
141
150
|
if (!this.#request) {
|
|
142
151
|
const method = this.method;
|
|
143
152
|
const hasBody = !(method === "GET" || method === "HEAD");
|
|
153
|
+
if (hasBody && !Readable) Readable = globalThis.process.getBuiltinModule("node:stream").Readable;
|
|
144
154
|
this.#request = new PatchedRequest(this.url, {
|
|
145
155
|
method,
|
|
146
156
|
headers: this.headers,
|
package/dist/cli.mjs
CHANGED
|
@@ -147,7 +147,7 @@ async function loadEntry(opts) {
|
|
|
147
147
|
const nodeHandler = listenHandler || (typeof mod.default === "function" ? mod.default : void 0);
|
|
148
148
|
if (nodeHandler) {
|
|
149
149
|
_legacyNode = true;
|
|
150
|
-
const { callNodeHandler } = await import("./_chunks/call-
|
|
150
|
+
const { callNodeHandler } = await import("./_chunks/call-DTWzxxQv.mjs");
|
|
151
151
|
fetchHandler = (webReq) => callNodeHandler(nodeHandler, webReq);
|
|
152
152
|
}
|
|
153
153
|
}
|
|
@@ -233,7 +233,7 @@ async function interceptListen(cb) {
|
|
|
233
233
|
};
|
|
234
234
|
}
|
|
235
235
|
async function version() {
|
|
236
|
-
const version$1 = "0.8.
|
|
236
|
+
const version$1 = "0.8.13";
|
|
237
237
|
return `srvx ${version$1}\n${runtime()}`;
|
|
238
238
|
}
|
|
239
239
|
function runtime() {
|
package/package.json
CHANGED