srvx 0.11.13 → 0.11.15

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,4 +1,3 @@
1
- import "../_chunks/_utils.mjs";
2
1
  import { r as wrapFetch, t as errorPlugin } from "../_chunks/_plugins.mjs";
3
2
  //#region src/adapters/_aws/utils.ts
4
3
  function awsRequest(event, context) {
@@ -1,4 +1,3 @@
1
- import "../_chunks/_utils.mjs";
2
1
  import { t as FastURL } from "../_chunks/_url.mjs";
3
2
  import { a as resolveTLSOptions, i as resolvePortAndHost, n as fmtURL, r as printListening, t as createWaitUntil } from "../_chunks/_utils2.mjs";
4
3
  import { n as gracefulShutdownPlugin, r as wrapFetch } from "../_chunks/_plugins.mjs";
@@ -1,4 +1,3 @@
1
- import "../_chunks/_utils.mjs";
2
1
  import { r as wrapFetch, t as errorPlugin } from "../_chunks/_plugins.mjs";
3
2
  //#region src/adapters/bunny.ts
4
3
  const FastURL = URL;
@@ -1,4 +1,3 @@
1
- import "../_chunks/_utils.mjs";
2
1
  import { r as wrapFetch, t as errorPlugin } from "../_chunks/_plugins.mjs";
3
2
  //#region src/adapters/cloudflare.ts
4
3
  const FastURL = URL;
@@ -1,4 +1,3 @@
1
- import "../_chunks/_utils.mjs";
2
1
  import { t as FastURL } from "../_chunks/_url.mjs";
3
2
  import { a as resolveTLSOptions, i as resolvePortAndHost, n as fmtURL, r as printListening, t as createWaitUntil } from "../_chunks/_utils2.mjs";
4
3
  import { n as gracefulShutdownPlugin, r as wrapFetch } from "../_chunks/_plugins.mjs";
@@ -1,4 +1,3 @@
1
- import "../_chunks/_utils.mjs";
2
1
  import { t as createWaitUntil } from "../_chunks/_utils2.mjs";
3
2
  import { r as wrapFetch, t as errorPlugin } from "../_chunks/_plugins.mjs";
4
3
  //#region src/adapters/generic.ts
@@ -1,4 +1,3 @@
1
- import "../_chunks/_utils.mjs";
2
1
  import { n as lazyInherit, t as FastURL } from "../_chunks/_url.mjs";
3
2
  import { a as resolveTLSOptions, i as resolvePortAndHost, n as fmtURL, r as printListening, t as createWaitUntil } from "../_chunks/_utils2.mjs";
4
3
  import { n as gracefulShutdownPlugin, r as wrapFetch, t as errorPlugin } from "../_chunks/_plugins.mjs";
@@ -520,8 +519,15 @@ var WebRequestSocket = class extends Duplex {
520
519
  port: 0
521
520
  };
522
521
  }
522
+ bodyReader() {
523
+ try {
524
+ return this.#request.body?.getReader();
525
+ } catch (error) {
526
+ this.emit("error", error);
527
+ }
528
+ }
523
529
  _read(_size) {
524
- const reader = this.#reqReader ??= this.#request.body?.getReader();
530
+ const reader = this.#reqReader ??= this.bodyReader();
525
531
  if (!reader) {
526
532
  this.push(null);
527
533
  return;
@@ -756,6 +762,7 @@ var NodeServer = class {
756
762
  waitUntil;
757
763
  #isSecure;
758
764
  #listeningPromise;
765
+ #listenError;
759
766
  #wait;
760
767
  constructor(options) {
761
768
  this.options = {
@@ -809,16 +816,30 @@ var NodeServer = class {
809
816
  else if (this.#isSecure) server = nodeHTTPS.createServer(this.serveOptions, handler);
810
817
  else server = nodeHTTP.createServer(this.serveOptions, handler);
811
818
  this.node.server = server;
812
- if (!options.manual) this.serve();
819
+ if (!options.manual) this.serve().catch(() => {});
813
820
  }
814
821
  serve() {
815
- if (this.#listeningPromise) return Promise.resolve(this.#listeningPromise).then(() => this);
816
- this.#listeningPromise = new Promise((resolve) => {
817
- this.node.server.listen(this.serveOptions, () => {
822
+ if (this.#listeningPromise) return this.#listeningPromise.then(() => this);
823
+ const server = this.node?.server;
824
+ if (!server) return Promise.reject(/* @__PURE__ */ new Error("Server not initialized"));
825
+ this.#listenError = void 0;
826
+ this.#listeningPromise = new Promise((resolve, reject) => {
827
+ const onError = (error) => {
828
+ server.off("listening", onListening);
829
+ this.#listenError = error;
830
+ this.#listeningPromise = void 0;
831
+ reject(error);
832
+ };
833
+ const onListening = () => {
834
+ server.off("error", onError);
818
835
  printListening(this.options, this.url);
819
836
  resolve();
820
- });
837
+ };
838
+ server.once("error", onError);
839
+ server.once("listening", onListening);
840
+ server.listen(this.serveOptions);
821
841
  });
842
+ return this.#listeningPromise.then(() => this);
822
843
  }
823
844
  get url() {
824
845
  const addr = this.node?.server?.address();
@@ -826,6 +847,7 @@ var NodeServer = class {
826
847
  return typeof addr === "string" ? addr : fmtURL(addr.address, addr.port, this.#isSecure);
827
848
  }
828
849
  ready() {
850
+ if (this.#listenError) return Promise.reject(this.#listenError);
829
851
  return Promise.resolve(this.#listeningPromise).then(() => this);
830
852
  }
831
853
  async close(closeAll) {
@@ -1,4 +1,3 @@
1
- import "../_chunks/_utils.mjs";
2
1
  import { r as wrapFetch, t as errorPlugin } from "../_chunks/_plugins.mjs";
3
2
  //#region src/adapters/service-worker.ts
4
3
  const FastURL = URL;
package/dist/cli.mjs CHANGED
@@ -184,7 +184,7 @@ function getResponseFormat(res) {
184
184
  //#region src/cli/_meta.ts
185
185
  const srvxMeta = {
186
186
  name: "srvx",
187
- version: "0.11.13",
187
+ version: "0.11.15",
188
188
  description: "Universal Server."
189
189
  };
190
190
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "srvx",
3
- "version": "0.11.13",
3
+ "version": "0.11.15",
4
4
  "description": "Universal Server.",
5
5
  "homepage": "https://srvx.h3.dev",
6
6
  "license": "MIT",
@@ -59,8 +59,8 @@
59
59
  "vitest": "vitest"
60
60
  },
61
61
  "devDependencies": {
62
- "@cloudflare/workers-types": "^4.20260317.1",
63
- "@hono/node-server": "^2.0.0-rc.1",
62
+ "@cloudflare/workers-types": "^4.20260401.1",
63
+ "@hono/node-server": "^1.19.12",
64
64
  "@mitata/counters": "^0.0.8",
65
65
  "@mjackson/node-fetch-server": "^0.7.0",
66
66
  "@types/aws-lambda": "^8.10.161",
@@ -70,8 +70,8 @@
70
70
  "@types/node": "^25.5.0",
71
71
  "@types/node-forge": "^1.3.14",
72
72
  "@types/serviceworker": "^0.0.194",
73
- "@typescript/native-preview": "^7.0.0-dev.20260323.1",
74
- "@vitest/coverage-v8": "^4.1.1",
73
+ "@typescript/native-preview": "^7.0.0-dev.20260401.1",
74
+ "@vitest/coverage-v8": "^4.1.2",
75
75
  "@whatwg-node/server": "^0.10.18",
76
76
  "automd": "^0.4.3",
77
77
  "changelogen": "^0.6.2",
@@ -82,15 +82,15 @@
82
82
  "get-port-please": "^3.2.0",
83
83
  "mdbox": "^0.1.1",
84
84
  "mitata": "^1.0.34",
85
- "node-forge": "^1.3.3",
85
+ "node-forge": "^1.4.0",
86
86
  "obuild": "^0.4.32",
87
- "oxfmt": "^0.41.0",
88
- "oxlint": "^1.56.0",
89
- "srvx-release": "npm:srvx@^0.11.12",
87
+ "oxfmt": "^0.43.0",
88
+ "oxlint": "^1.58.0",
89
+ "srvx-release": "npm:srvx@^0.11.13",
90
90
  "tslib": "^2.8.1",
91
91
  "typescript": "^6.0.2",
92
- "undici": "^7.24.5",
93
- "vitest": "^4.1.1"
92
+ "undici": "^7.24.7",
93
+ "vitest": "^4.1.2"
94
94
  },
95
95
  "resolutions": {
96
96
  "srvx": "link:."
@@ -98,5 +98,5 @@
98
98
  "engines": {
99
99
  "node": ">=20.16.0"
100
100
  },
101
- "packageManager": "pnpm@10.32.1"
101
+ "packageManager": "pnpm@10.33.0"
102
102
  }