srvx 0.7.4 → 0.8.0

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,3 +1,4 @@
1
+ import * as cloudflare_workers0 from "cloudflare:workers";
1
2
  import * as NodeHttp$1 from "node:http";
2
3
  import * as NodeHttps from "node:https";
3
4
  import * as NodeHttp2 from "node:http2";
@@ -6,7 +7,10 @@ import * as Bun from "bun";
6
7
  import * as CF from "@cloudflare/workers-types";
7
8
 
8
9
  //#region src/types.d.ts
10
+ // Utils
9
11
  type MaybePromise<T> = T | Promise<T>;
12
+ type IsAny<T> = Equal<T, any> extends true ? true : false;
13
+ type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
10
14
  // ----------------------------------------------------------------------------
11
15
  // srvx API
12
16
  // ----------------------------------------------------------------------------
@@ -218,8 +222,8 @@ interface ServerRuntimeContext {
218
222
  * Underlying Cloudflare request context.
219
223
  */
220
224
  cloudflare?: {
221
- env: unknown;
222
225
  context: CF.ExecutionContext;
226
+ env: IsAny<typeof cloudflare_workers0> extends true ? Record<string, unknown> : typeof cloudflare_workers0.env;
223
227
  };
224
228
  }
225
229
  interface ServerRequest extends Request {
@@ -1,4 +1,4 @@
1
- import { BunFetchHandler, Server, ServerOptions } from "../_chunks/types-mRjDOdKf.mjs";
1
+ import { BunFetchHandler, Server, ServerOptions } from "../_chunks/types-IGvUeyh_.mjs";
2
2
  import { FastURL$2 as FastURL } from "../_chunks/_url-CE8HuNzA.mjs";
3
3
  import * as bun from "bun";
4
4
 
@@ -1,4 +1,4 @@
1
- import { Server, ServerOptions } from "../_chunks/types-mRjDOdKf.mjs";
1
+ import { Server, ServerOptions } from "../_chunks/types-IGvUeyh_.mjs";
2
2
  import * as CF from "@cloudflare/workers-types";
3
3
 
4
4
  //#region src/adapters/cloudflare.d.ts
@@ -1,4 +1,4 @@
1
- import { DenoFetchHandler, Server, ServerOptions } from "../_chunks/types-mRjDOdKf.mjs";
1
+ import { DenoFetchHandler, Server, ServerOptions } from "../_chunks/types-IGvUeyh_.mjs";
2
2
  import { FastURL$2 as FastURL } from "../_chunks/_url-CE8HuNzA.mjs";
3
3
 
4
4
  //#region src/adapters/deno.d.ts
@@ -1,4 +1,4 @@
1
- import { Server, ServerOptions } from "../_chunks/types-mRjDOdKf.mjs";
1
+ import { Server, ServerOptions } from "../_chunks/types-IGvUeyh_.mjs";
2
2
 
3
3
  //#region src/adapters/generic.d.ts
4
4
  declare const FastURL: typeof globalThis.URL;
@@ -1,4 +1,4 @@
1
- import { FetchHandler, NodeHttpHandler, NodeServerRequest, NodeServerResponse, Server, ServerOptions, ServerRequest } from "../_chunks/types-mRjDOdKf.mjs";
1
+ import { FetchHandler, NodeHttpHandler, NodeServerRequest, NodeServerResponse, Server, ServerOptions, ServerRequest } from "../_chunks/types-IGvUeyh_.mjs";
2
2
  import { FastURL$2 as FastURL } from "../_chunks/_url-CE8HuNzA.mjs";
3
3
  import NodeHttp from "node:http";
4
4
  import { Readable } from "node:stream";
@@ -1,4 +1,4 @@
1
- import { Server, ServerOptions, ServerRequest } from "../_chunks/types-mRjDOdKf.mjs";
1
+ import { Server, ServerOptions, ServerRequest } from "../_chunks/types-IGvUeyh_.mjs";
2
2
 
3
3
  //#region src/adapters/service-worker.d.ts
4
4
  declare const FastURL: typeof globalThis.URL;
@@ -2,8 +2,8 @@ import { wrapFetch } from "../_chunks/_middleware-Bz7WmB2e.mjs";
2
2
  import { errorPlugin } from "../_chunks/_plugins-ta8pkwXd.mjs";
3
3
 
4
4
  //#region src/adapters/service-worker.ts
5
- const FastURL = /* @__PURE__ */ (() => globalThis.URL)();
6
- const FastResponse = /* @__PURE__ */ (() => globalThis.Response)();
5
+ const FastURL = URL;
6
+ const FastResponse = Response;
7
7
  const isBrowserWindow = typeof window !== "undefined" && typeof navigator !== "undefined";
8
8
  const isServiceWorker = /* @__PURE__ */ (() => typeof self !== "undefined" && "skipWaiting" in self)();
9
9
  function serve(options) {
package/dist/types.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { BunFetchHandler, CloudflareFetchHandler, DenoFetchHandler, ErrorHandler, FastResponse, FastURL, FetchHandler, NodeHttpHandler, NodeServerRequest, NodeServerResponse, Server, ServerHandler, ServerMiddleware, ServerOptions, ServerPlugin, ServerRequest, ServerRuntimeContext, serve } from "./_chunks/types-mRjDOdKf.mjs";
1
+ import { BunFetchHandler, CloudflareFetchHandler, DenoFetchHandler, ErrorHandler, FastResponse, FastURL, FetchHandler, NodeHttpHandler, NodeServerRequest, NodeServerResponse, Server, ServerHandler, ServerMiddleware, ServerOptions, ServerPlugin, ServerRequest, ServerRuntimeContext, serve } from "./_chunks/types-IGvUeyh_.mjs";
2
2
  export { BunFetchHandler, CloudflareFetchHandler, DenoFetchHandler, ErrorHandler, FastResponse, FastURL, FetchHandler, NodeHttpHandler, NodeServerRequest, NodeServerResponse, Server, ServerHandler, ServerMiddleware, ServerOptions, ServerPlugin, ServerRequest, ServerRuntimeContext, serve };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "srvx",
3
- "version": "0.7.4",
3
+ "version": "0.8.0",
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",
@@ -8,7 +8,6 @@
8
8
  "sideEffects": false,
9
9
  "type": "module",
10
10
  "exports": {
11
- "./types": "./dist/types.d.mts",
12
11
  "./deno": "./dist/adapters/deno.mjs",
13
12
  "./bun": "./dist/adapters/bun.mjs",
14
13
  "./node": "./dist/adapters/node.mjs",
@@ -57,33 +56,33 @@
57
56
  "cookie-es": "^2.0.0"
58
57
  },
59
58
  "devDependencies": {
60
- "@cloudflare/workers-types": "^4.20250525.0",
61
- "@hono/node-server": "^1.14.3",
59
+ "@cloudflare/workers-types": "^4.20250607.0",
60
+ "@hono/node-server": "^1.14.4",
62
61
  "@mitata/counters": "^0.0.8",
63
- "@mjackson/node-fetch-server": "^0.6.1",
64
- "@types/bun": "^1.2.14",
62
+ "@mjackson/node-fetch-server": "^0.7.0",
63
+ "@types/bun": "^1.2.15",
65
64
  "@types/deno": "^2.3.0",
66
- "@types/node": "^22.15.21",
65
+ "@types/node": "^22.15.30",
67
66
  "@types/node-forge": "^1.3.11",
68
- "@types/serviceworker": "^0.0.135",
69
- "@vitest/coverage-v8": "^3.1.4",
67
+ "@types/serviceworker": "^0.0.139",
68
+ "@vitest/coverage-v8": "^3.2.2",
70
69
  "@whatwg-node/server": "^0.10.10",
71
70
  "automd": "^0.4.0",
72
71
  "changelogen": "^0.6.1",
73
- "eslint": "^9.27.0",
72
+ "eslint": "^9.28.0",
74
73
  "eslint-config-unjs": "^0.4.2",
75
74
  "execa": "^9.6.0",
76
75
  "get-port-please": "^3.1.2",
77
76
  "mitata": "^1.0.34",
78
77
  "node-forge": "^1.3.1",
79
- "obuild": "^0.2.0",
78
+ "obuild": "^0.2.1",
80
79
  "prettier": "^3.5.3",
81
80
  "tslib": "^2.8.1",
82
81
  "typescript": "^5.8.3",
83
82
  "undici": "^7.10.0",
84
- "vitest": "^3.1.4"
83
+ "vitest": "^3.2.2"
85
84
  },
86
- "packageManager": "pnpm@10.11.0",
85
+ "packageManager": "pnpm@10.12.1",
87
86
  "engines": {
88
87
  "node": ">=20.16.0"
89
88
  }