srvx 0.8.8 → 0.8.9

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.
@@ -11,7 +11,6 @@ type NodeRequestContext = {
11
11
  declare const NodeRequest: {
12
12
  new (nodeCtx: NodeRequestContext): ServerRequest;
13
13
  };
14
- type NodeRequest = InstanceType<typeof NodeRequest>;
15
14
  //#endregion
16
15
  //#region src/adapters/_node/headers.d.ts
17
16
  type NodeRequestHeaders = InstanceType<typeof NodeRequestHeaders>;
@@ -223,19 +223,17 @@ function parseHost(host) {
223
223
  //#endregion
224
224
  //#region src/adapters/_node/request.ts
225
225
  const NodeRequest = /* @__PURE__ */ (() => {
226
- const NativeRequest = globalThis.Request;
227
226
  const { Readable } = process.getBuiltinModule("node:stream");
228
- if (!("_srvx" in NativeRequest)) {
229
- class Request$1 extends NativeRequest {
230
- static _srvx = true;
231
- constructor(input, options) {
232
- if (typeof input === "object" && "_request" in input) input = input._request;
233
- if ((options?.body)?.getReader !== void 0) options.duplex ??= "half";
234
- super(input, options);
235
- }
227
+ const NativeRequest = globalThis._Request ??= globalThis.Request;
228
+ const PatchedRequest = class Request extends NativeRequest {
229
+ static _srvx = true;
230
+ constructor(input, options) {
231
+ if (typeof input === "object" && "_request" in input) input = input._request;
232
+ if ((options?.body)?.getReader !== void 0) options.duplex ??= "half";
233
+ super(input, options);
236
234
  }
237
- globalThis.Request = Request$1;
238
- }
235
+ };
236
+ if (!globalThis.Request._srvx) globalThis.Request = PatchedRequest;
239
237
  class NodeRequest$1 {
240
238
  _node;
241
239
  _url;
@@ -276,7 +274,7 @@ const NodeRequest = /* @__PURE__ */ (() => {
276
274
  if (!this.#request) {
277
275
  const method = this.method;
278
276
  const hasBody = !(method === "GET" || method === "HEAD");
279
- this.#request = new Request(this.url, {
277
+ this.#request = new PatchedRequest(this.url, {
280
278
  method,
281
279
  headers: this.headers,
282
280
  signal: this.signal,
@@ -287,7 +285,7 @@ const NodeRequest = /* @__PURE__ */ (() => {
287
285
  }
288
286
  }
289
287
  inheritProps(NodeRequest$1.prototype, NativeRequest.prototype, "_request");
290
- Object.setPrototypeOf(NodeRequest$1.prototype, Request.prototype);
288
+ Object.setPrototypeOf(NodeRequest$1.prototype, PatchedRequest.prototype);
291
289
  return NodeRequest$1;
292
290
  })();
293
291
 
package/dist/cli.mjs CHANGED
@@ -216,7 +216,7 @@ async function interceptListen(cb) {
216
216
  };
217
217
  }
218
218
  async function version() {
219
- const version$1 = "0.8.8";
219
+ const version$1 = "0.8.9";
220
220
  return `srvx ${version$1}\n${runtime()}`;
221
221
  }
222
222
  function runtime() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "srvx",
3
- "version": "0.8.8",
3
+ "version": "0.8.9",
4
4
  "description": "Universal Server API based on web platform standards. Works seamlessly with Deno, Bun and Node.js.",
5
5
  "homepage": "https://srvx.h3.dev",
6
6
  "repository": "h3js/srvx",
@@ -80,7 +80,7 @@
80
80
  "node-forge": "^1.3.1",
81
81
  "obuild": "^0.2.1",
82
82
  "prettier": "^3.6.2",
83
- "srvx-release": "npm:srvx@0.8.7",
83
+ "srvx-release": "npm:srvx@0.8.8",
84
84
  "tslib": "^2.8.1",
85
85
  "typescript": "^5.9.2",
86
86
  "undici": "^7.16.0",