srvx 0.8.14 → 0.8.16
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/{_inherit-DLZfB57K.mjs → _inherit-aIijG5gM.mjs} +1 -0
- package/dist/_chunks/{_url-Q_-LB8LX.mjs → _url-6S_VTq5O.mjs} +1 -1
- package/dist/_chunks/{call-DTWzxxQv.mjs → call-_ai4zW1A.mjs} +3 -2
- package/dist/_chunks/dist-BRKJ6i_Z.mjs +45 -0
- package/dist/_chunks/{response-CsTwgR_V.mjs → response-DKBPm3qF.mjs} +2 -2
- package/dist/adapters/bun.d.mts +2 -2
- package/dist/adapters/bun.mjs +4 -4
- package/dist/adapters/cloudflare.d.mts +1 -1
- package/dist/adapters/cloudflare.mjs +2 -2
- package/dist/adapters/deno.d.mts +2 -2
- package/dist/adapters/deno.mjs +4 -4
- package/dist/adapters/generic.d.mts +1 -1
- package/dist/adapters/generic.mjs +3 -3
- package/dist/adapters/node.d.mts +2 -2
- package/dist/adapters/node.mjs +15 -12
- package/dist/adapters/service-worker.d.mts +1 -1
- package/dist/adapters/service-worker.mjs +2 -2
- package/dist/cli.mjs +4 -4
- package/dist/cookie.d.mts +2 -0
- package/dist/cookie.mjs +3 -0
- package/dist/log.d.mts +1 -1
- package/dist/static.d.mts +1 -1
- package/dist/types.d.mts +1 -1
- package/package.json +3 -4
- /package/dist/_chunks/{_middleware-BvRR7B4M.mjs → _middleware-z4fpJ-o6.mjs} +0 -0
- /package/dist/_chunks/{_plugins-DmMfurBQ.mjs → _plugins-BuL6RXOq.mjs} +0 -0
- /package/dist/_chunks/{_url-D-jAQyRZ.d.mts → _url-AwIHDSW0.d.mts} +0 -0
- /package/dist/_chunks/{_utils-DRF_4b_y.mjs → _utils-DEm1vdc3.mjs} +0 -0
- /package/dist/_chunks/{types-hx5EhU1U.d.mts → types-vBo0F7mW.d.mts} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
//#region src/_inherit.ts
|
|
2
2
|
function lazyInherit(target, source, sourceKey) {
|
|
3
3
|
for (const key of Object.getOwnPropertyNames(source)) {
|
|
4
|
+
if (key === "constructor") continue;
|
|
4
5
|
const targetDesc = Object.getOwnPropertyDescriptor(target, key);
|
|
5
6
|
const desc = Object.getOwnPropertyDescriptor(source, key);
|
|
6
7
|
let modified = false;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import
|
|
1
|
+
import "./dist-BRKJ6i_Z.mjs";
|
|
2
|
+
import "./_inherit-aIijG5gM.mjs";
|
|
3
|
+
import { NodeResponse, NodeResponseHeaders } from "./response-DKBPm3qF.mjs";
|
|
3
4
|
|
|
4
5
|
//#region src/adapters/_node/call.ts
|
|
5
6
|
function callNodeHandler(handler, req) {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//#region node_modules/.pnpm/cookie-es@2.0.0/node_modules/cookie-es/dist/index.mjs
|
|
2
|
+
function splitSetCookieString(cookiesString) {
|
|
3
|
+
if (Array.isArray(cookiesString)) return cookiesString.flatMap((c) => splitSetCookieString(c));
|
|
4
|
+
if (typeof cookiesString !== "string") return [];
|
|
5
|
+
const cookiesStrings = [];
|
|
6
|
+
let pos = 0;
|
|
7
|
+
let start;
|
|
8
|
+
let ch;
|
|
9
|
+
let lastComma;
|
|
10
|
+
let nextStart;
|
|
11
|
+
let cookiesSeparatorFound;
|
|
12
|
+
const skipWhitespace = () => {
|
|
13
|
+
while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) pos += 1;
|
|
14
|
+
return pos < cookiesString.length;
|
|
15
|
+
};
|
|
16
|
+
const notSpecialChar = () => {
|
|
17
|
+
ch = cookiesString.charAt(pos);
|
|
18
|
+
return ch !== "=" && ch !== ";" && ch !== ",";
|
|
19
|
+
};
|
|
20
|
+
while (pos < cookiesString.length) {
|
|
21
|
+
start = pos;
|
|
22
|
+
cookiesSeparatorFound = false;
|
|
23
|
+
while (skipWhitespace()) {
|
|
24
|
+
ch = cookiesString.charAt(pos);
|
|
25
|
+
if (ch === ",") {
|
|
26
|
+
lastComma = pos;
|
|
27
|
+
pos += 1;
|
|
28
|
+
skipWhitespace();
|
|
29
|
+
nextStart = pos;
|
|
30
|
+
while (pos < cookiesString.length && notSpecialChar()) pos += 1;
|
|
31
|
+
if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
|
|
32
|
+
cookiesSeparatorFound = true;
|
|
33
|
+
pos = nextStart;
|
|
34
|
+
cookiesStrings.push(cookiesString.slice(start, lastComma));
|
|
35
|
+
start = pos;
|
|
36
|
+
} else pos = lastComma + 1;
|
|
37
|
+
} else pos += 1;
|
|
38
|
+
}
|
|
39
|
+
if (!cookiesSeparatorFound || pos >= cookiesString.length) cookiesStrings.push(cookiesString.slice(start));
|
|
40
|
+
}
|
|
41
|
+
return cookiesStrings;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
export { splitSetCookieString };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { splitSetCookieString } from "./dist-BRKJ6i_Z.mjs";
|
|
2
|
+
import { lazyInherit } from "./_inherit-aIijG5gM.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/adapters/_node/_common.ts
|
|
5
5
|
const kNodeInspect = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
package/dist/adapters/bun.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BunFetchHandler, Server, ServerOptions } from "../_chunks/types-
|
|
2
|
-
import { FastURL$2 as FastURL } from "../_chunks/_url-
|
|
1
|
+
import { BunFetchHandler, Server, ServerOptions } from "../_chunks/types-vBo0F7mW.mjs";
|
|
2
|
+
import { FastURL$2 as FastURL } from "../_chunks/_url-AwIHDSW0.mjs";
|
|
3
3
|
import * as bun from "bun";
|
|
4
4
|
|
|
5
5
|
//#region src/adapters/bun.d.ts
|
package/dist/adapters/bun.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createWaitUntil, fmtURL, printListening, resolvePortAndHost, resolveTLSOptions } from "../_chunks/_utils-
|
|
2
|
-
import { wrapFetch } from "../_chunks/_middleware-
|
|
3
|
-
import "../_chunks/_inherit-
|
|
4
|
-
import { FastURL$1 as FastURL } from "../_chunks/_url-
|
|
1
|
+
import { createWaitUntil, fmtURL, printListening, resolvePortAndHost, resolveTLSOptions } from "../_chunks/_utils-DEm1vdc3.mjs";
|
|
2
|
+
import { wrapFetch } from "../_chunks/_middleware-z4fpJ-o6.mjs";
|
|
3
|
+
import "../_chunks/_inherit-aIijG5gM.mjs";
|
|
4
|
+
import { FastURL$1 as FastURL } from "../_chunks/_url-6S_VTq5O.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/adapters/bun.ts
|
|
7
7
|
const FastResponse = Response;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { wrapFetch } from "../_chunks/_middleware-
|
|
2
|
-
import { errorPlugin } from "../_chunks/_plugins-
|
|
1
|
+
import { wrapFetch } from "../_chunks/_middleware-z4fpJ-o6.mjs";
|
|
2
|
+
import { errorPlugin } from "../_chunks/_plugins-BuL6RXOq.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/adapters/cloudflare.ts
|
|
5
5
|
const FastURL = URL;
|
package/dist/adapters/deno.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DenoFetchHandler, Server, ServerOptions } from "../_chunks/types-
|
|
2
|
-
import { FastURL$2 as FastURL } from "../_chunks/_url-
|
|
1
|
+
import { DenoFetchHandler, Server, ServerOptions } from "../_chunks/types-vBo0F7mW.mjs";
|
|
2
|
+
import { FastURL$2 as FastURL } from "../_chunks/_url-AwIHDSW0.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/adapters/deno.d.ts
|
|
5
5
|
declare const FastResponse: typeof globalThis.Response;
|
package/dist/adapters/deno.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createWaitUntil, fmtURL, printListening, resolvePortAndHost, resolveTLSOptions } from "../_chunks/_utils-
|
|
2
|
-
import { wrapFetch } from "../_chunks/_middleware-
|
|
3
|
-
import "../_chunks/_inherit-
|
|
4
|
-
import { FastURL$1 as FastURL } from "../_chunks/_url-
|
|
1
|
+
import { createWaitUntil, fmtURL, printListening, resolvePortAndHost, resolveTLSOptions } from "../_chunks/_utils-DEm1vdc3.mjs";
|
|
2
|
+
import { wrapFetch } from "../_chunks/_middleware-z4fpJ-o6.mjs";
|
|
3
|
+
import "../_chunks/_inherit-aIijG5gM.mjs";
|
|
4
|
+
import { FastURL$1 as FastURL } from "../_chunks/_url-6S_VTq5O.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/adapters/deno.ts
|
|
7
7
|
const FastResponse = Response;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createWaitUntil } from "../_chunks/_utils-
|
|
2
|
-
import { wrapFetch } from "../_chunks/_middleware-
|
|
3
|
-
import { errorPlugin } from "../_chunks/_plugins-
|
|
1
|
+
import { createWaitUntil } from "../_chunks/_utils-DEm1vdc3.mjs";
|
|
2
|
+
import { wrapFetch } from "../_chunks/_middleware-z4fpJ-o6.mjs";
|
|
3
|
+
import { errorPlugin } from "../_chunks/_plugins-BuL6RXOq.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/adapters/generic.ts
|
|
6
6
|
const FastURL = URL;
|
package/dist/adapters/node.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FetchHandler, NodeHttpHandler, NodeServerRequest, NodeServerResponse, Server, ServerOptions, ServerRequest } from "../_chunks/types-
|
|
2
|
-
import { FastURL$2 as FastURL } from "../_chunks/_url-
|
|
1
|
+
import { FetchHandler, NodeHttpHandler, NodeServerRequest, NodeServerResponse, Server, ServerOptions, ServerRequest } from "../_chunks/types-vBo0F7mW.mjs";
|
|
2
|
+
import { FastURL$2 as FastURL } from "../_chunks/_url-AwIHDSW0.mjs";
|
|
3
3
|
import NodeHttp from "node:http";
|
|
4
4
|
import { Readable } from "node:stream";
|
|
5
5
|
|
package/dist/adapters/node.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { splitSetCookieString } from "../_chunks/dist-BRKJ6i_Z.mjs";
|
|
2
|
+
import { createWaitUntil, fmtURL, printListening, resolvePortAndHost, resolveTLSOptions } from "../_chunks/_utils-DEm1vdc3.mjs";
|
|
3
|
+
import { wrapFetch } from "../_chunks/_middleware-z4fpJ-o6.mjs";
|
|
4
|
+
import { lazyInherit } from "../_chunks/_inherit-aIijG5gM.mjs";
|
|
5
|
+
import { FastURL$1 as FastURL } from "../_chunks/_url-6S_VTq5O.mjs";
|
|
6
|
+
import { NodeRequestHeaders, NodeResponse, NodeResponseHeaders } from "../_chunks/response-DKBPm3qF.mjs";
|
|
7
|
+
import { errorPlugin } from "../_chunks/_plugins-BuL6RXOq.mjs";
|
|
8
8
|
|
|
9
9
|
//#region src/adapters/_node/send.ts
|
|
10
10
|
async function sendNodeResponse(nodeRes, webRes) {
|
|
@@ -101,8 +101,11 @@ var NodeRequestURL = class extends FastURL {
|
|
|
101
101
|
const NodeRequest = /* @__PURE__ */ (() => {
|
|
102
102
|
let Readable;
|
|
103
103
|
const NativeRequest = globalThis._Request ??= globalThis.Request;
|
|
104
|
-
const PatchedRequest = class Request extends NativeRequest {
|
|
104
|
+
const PatchedRequest = class Request$1 extends NativeRequest {
|
|
105
105
|
static _srvx = true;
|
|
106
|
+
static [Symbol.hasInstance](instance) {
|
|
107
|
+
return instance instanceof NativeRequest;
|
|
108
|
+
}
|
|
106
109
|
constructor(input, options) {
|
|
107
110
|
if (typeof input === "object" && "_request" in input) input = input._request;
|
|
108
111
|
if ((options?.body)?.getReader !== void 0) options.duplex ??= "half";
|
|
@@ -110,7 +113,7 @@ const NodeRequest = /* @__PURE__ */ (() => {
|
|
|
110
113
|
}
|
|
111
114
|
};
|
|
112
115
|
if (!globalThis.Request._srvx) globalThis.Request = PatchedRequest;
|
|
113
|
-
class
|
|
116
|
+
class Request {
|
|
114
117
|
_node;
|
|
115
118
|
_url;
|
|
116
119
|
runtime;
|
|
@@ -161,9 +164,9 @@ const NodeRequest = /* @__PURE__ */ (() => {
|
|
|
161
164
|
return this.#request;
|
|
162
165
|
}
|
|
163
166
|
}
|
|
164
|
-
lazyInherit(
|
|
165
|
-
Object.setPrototypeOf(
|
|
166
|
-
return
|
|
167
|
+
lazyInherit(Request.prototype, NativeRequest.prototype, "_request");
|
|
168
|
+
Object.setPrototypeOf(Request.prototype, NativeRequest.prototype);
|
|
169
|
+
return Request;
|
|
167
170
|
})();
|
|
168
171
|
|
|
169
172
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { wrapFetch } from "../_chunks/_middleware-
|
|
2
|
-
import { errorPlugin } from "../_chunks/_plugins-
|
|
1
|
+
import { wrapFetch } from "../_chunks/_middleware-z4fpJ-o6.mjs";
|
|
2
|
+
import { errorPlugin } from "../_chunks/_plugins-BuL6RXOq.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/adapters/service-worker.ts
|
|
5
5
|
const FastURL = URL;
|
package/dist/cli.mjs
CHANGED
|
@@ -91,12 +91,12 @@ async function serve() {
|
|
|
91
91
|
console.error(error);
|
|
92
92
|
return renderError(error);
|
|
93
93
|
},
|
|
94
|
+
...entry,
|
|
94
95
|
middleware: [
|
|
95
96
|
log(),
|
|
96
97
|
options._static ? serveStatic({ dir: options._static }) : void 0,
|
|
97
98
|
...entry.middleware || []
|
|
98
|
-
].filter(Boolean)
|
|
99
|
-
...entry
|
|
99
|
+
].filter(Boolean)
|
|
100
100
|
});
|
|
101
101
|
globalThis.__srvx__ = server;
|
|
102
102
|
await server.ready();
|
|
@@ -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-_ai4zW1A.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.16";
|
|
237
237
|
return `srvx ${version$1}\n${runtime()}`;
|
|
238
238
|
}
|
|
239
239
|
function runtime() {
|
package/dist/cookie.mjs
ADDED
package/dist/log.d.mts
CHANGED
package/dist/static.d.mts
CHANGED
package/dist/types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BunFetchHandler, CloudflareFetchHandler, DenoFetchHandler, ErrorHandler, FastResponse, FastURL, FetchHandler, NodeHTTPMiddleware, NodeHttpHandler, NodeServerRequest, NodeServerResponse, Server, ServerHandler, ServerMiddleware, ServerOptions, ServerPlugin, ServerRequest, ServerRequestContext, ServerRuntimeContext, serve } from "./_chunks/types-
|
|
1
|
+
import { BunFetchHandler, CloudflareFetchHandler, DenoFetchHandler, ErrorHandler, FastResponse, FastURL, FetchHandler, NodeHTTPMiddleware, NodeHttpHandler, NodeServerRequest, NodeServerResponse, Server, ServerHandler, ServerMiddleware, ServerOptions, ServerPlugin, ServerRequest, ServerRequestContext, ServerRuntimeContext, serve } from "./_chunks/types-vBo0F7mW.mjs";
|
|
2
2
|
export { BunFetchHandler, CloudflareFetchHandler, DenoFetchHandler, ErrorHandler, FastResponse, FastURL, FetchHandler, NodeHTTPMiddleware, NodeHttpHandler, NodeServerRequest, NodeServerResponse, Server, ServerHandler, ServerMiddleware, ServerOptions, ServerPlugin, ServerRequest, ServerRequestContext, ServerRuntimeContext, serve };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "srvx",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.16",
|
|
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",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"./cli": "./dist/cli.mjs",
|
|
18
18
|
"./static": "./dist/static.mjs",
|
|
19
19
|
"./log": "./dist/log.mjs",
|
|
20
|
+
"./cookie": "./dist/cookie.mjs",
|
|
20
21
|
".": {
|
|
21
22
|
"types": "./dist/types.d.mts",
|
|
22
23
|
"deno": "./dist/adapters/deno.mjs",
|
|
@@ -54,9 +55,6 @@
|
|
|
54
55
|
"resolutions": {
|
|
55
56
|
"srvx": "link:."
|
|
56
57
|
},
|
|
57
|
-
"dependencies": {
|
|
58
|
-
"cookie-es": "^2.0.0"
|
|
59
|
-
},
|
|
60
58
|
"devDependencies": {
|
|
61
59
|
"@cloudflare/workers-types": "^4.20251004.0",
|
|
62
60
|
"@hono/node-server": "^1.19.5",
|
|
@@ -71,6 +69,7 @@
|
|
|
71
69
|
"@whatwg-node/server": "^0.10.12",
|
|
72
70
|
"automd": "^0.4.2",
|
|
73
71
|
"changelogen": "^0.6.2",
|
|
72
|
+
"cookie-es": "^2.0.0",
|
|
74
73
|
"eslint": "^9.37.0",
|
|
75
74
|
"eslint-config-unjs": "^0.5.0",
|
|
76
75
|
"execa": "^9.6.0",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|