srvx 0.8.11 → 0.8.12

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.
@@ -1,5 +1,5 @@
1
1
  import "./_inherit-DLZfB57K.mjs";
2
- import { NodeResponse, NodeResponseHeaders } from "./response-iYyldB4J.mjs";
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;
@@ -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-iYyldB4J.mjs";
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
 
@@ -90,7 +90,7 @@ var NodeRequestURL = class extends FastURL {
90
90
  //#endregion
91
91
  //#region src/adapters/_node/request.ts
92
92
  const NodeRequest = /* @__PURE__ */ (() => {
93
- const { Readable } = process.getBuiltinModule("node:stream");
93
+ let Readable;
94
94
  const NativeRequest = globalThis._Request ??= globalThis.Request;
95
95
  const PatchedRequest = class Request extends NativeRequest {
96
96
  static _srvx = true;
@@ -141,6 +141,7 @@ const NodeRequest = /* @__PURE__ */ (() => {
141
141
  if (!this.#request) {
142
142
  const method = this.method;
143
143
  const hasBody = !(method === "GET" || method === "HEAD");
144
+ if (hasBody && !Readable) Readable = globalThis.process.getBuiltinModule("node:stream").Readable;
144
145
  this.#request = new PatchedRequest(this.url, {
145
146
  method,
146
147
  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-DYf04jcm.mjs");
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.11";
236
+ const version$1 = "0.8.12";
237
237
  return `srvx ${version$1}\n${runtime()}`;
238
238
  }
239
239
  function runtime() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "srvx",
3
- "version": "0.8.11",
3
+ "version": "0.8.12",
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",