srvx 0.9.4 → 0.9.6
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/_color-Kmne9cay.mjs +18 -0
- package/dist/_chunks/{_inherit-B9eAGP_O.mjs → _inherit-D99WuBbX.mjs} +1 -1
- package/dist/_chunks/{_plugins-DBERsPAu.mjs → _plugins-ZJvYKoy9.mjs} +10 -12
- package/dist/_chunks/{_url-Dd8UPFqt.d.mts → _url-C-JHG430.d.mts} +1 -1
- package/dist/_chunks/{_url-DF-_pEPn.mjs → _url-COjYRiX5.mjs} +4 -6
- package/dist/_chunks/{_utils-CjeNH3UU.mjs → _utils-CIBojyNO.mjs} +5 -5
- package/dist/_chunks/{call-BUTAdRs1.mjs → call-BLKVUMn3.mjs} +2 -2
- package/dist/_chunks/call-BlEaeO5P.mjs +4 -0
- package/dist/_chunks/{types-sQhe-gMy.d.mts → types-CpzLEZLT.d.mts} +1 -11
- package/dist/adapters/bun.d.mts +2 -3
- package/dist/adapters/bun.mjs +5 -5
- package/dist/adapters/cloudflare.d.mts +1 -1
- package/dist/adapters/cloudflare.mjs +2 -2
- package/dist/adapters/deno.d.mts +2 -3
- package/dist/adapters/deno.mjs +5 -5
- package/dist/adapters/generic.d.mts +1 -1
- package/dist/adapters/generic.mjs +3 -3
- package/dist/adapters/node.d.mts +3 -7
- package/dist/adapters/node.mjs +13 -19
- package/dist/adapters/service-worker.d.mts +1 -1
- package/dist/adapters/service-worker.mjs +2 -2
- package/dist/cli.mjs +48 -51
- package/dist/log.d.mts +1 -2
- package/dist/log.mjs +6 -6
- package/dist/static.d.mts +1 -1
- package/dist/static.mjs +3 -4
- package/dist/types.d.mts +1 -1
- package/package.json +15 -15
- package/dist/_chunks/_utils.cli-B2YzwlOv.mjs +0 -31
- package/dist/_chunks/call-DdhHMGpi.mjs +0 -4
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/_color.ts
|
|
2
|
+
const noColor = /* @__PURE__ */ (() => {
|
|
3
|
+
const env = globalThis.process?.env ?? {};
|
|
4
|
+
return env.NO_COLOR === "1" || env.TERM === "dumb";
|
|
5
|
+
})();
|
|
6
|
+
const _c = (c, r = 39) => (t) => noColor ? t : `\u001B[${c}m${t}\u001B[${r}m`;
|
|
7
|
+
const bold = /* @__PURE__ */ _c(1, 22);
|
|
8
|
+
const red = /* @__PURE__ */ _c(31);
|
|
9
|
+
const green = /* @__PURE__ */ _c(32);
|
|
10
|
+
const yellow = /* @__PURE__ */ _c(33);
|
|
11
|
+
const blue = /* @__PURE__ */ _c(34);
|
|
12
|
+
const magenta = /* @__PURE__ */ _c(35);
|
|
13
|
+
const cyan = /* @__PURE__ */ _c(36);
|
|
14
|
+
const gray = /* @__PURE__ */ _c(90);
|
|
15
|
+
const url = (title, url$1) => noColor ? `[${title}](${url$1})` : `\u001B]8;;${url$1}\u001B\\${title}\u001B]8;;\u001B\\`;
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { green as a, url as c, gray as i, yellow as l, bold as n, magenta as o, cyan as r, red as s, blue as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as gray, s as red } from "./_color-Kmne9cay.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/_middleware.ts
|
|
4
4
|
function wrapFetch(server) {
|
|
@@ -34,23 +34,21 @@ const gracefulShutdownPlugin = (server) => {
|
|
|
34
34
|
const shutdown = async () => {
|
|
35
35
|
if (isShuttingDown) return;
|
|
36
36
|
isShuttingDown = true;
|
|
37
|
-
|
|
37
|
+
const w = process.stderr.write.bind(process.stderr);
|
|
38
|
+
w(gray(`\nShutting down server in ${gracefulShutdown}s...`));
|
|
38
39
|
let timeout;
|
|
39
40
|
await Promise.race([server.close().finally(() => {
|
|
40
41
|
clearTimeout(timeout);
|
|
41
|
-
|
|
42
|
+
w(gray(" Server closed.\n"));
|
|
42
43
|
}), new Promise((resolve) => {
|
|
43
44
|
timeout = setTimeout(() => {
|
|
44
|
-
|
|
45
|
+
w(gray(`\nForce closing connections in ${forceShutdown}s...`));
|
|
45
46
|
timeout = setTimeout(() => {
|
|
46
|
-
|
|
47
|
+
w(red("\nCould not close connections in time, force exiting."));
|
|
47
48
|
resolve();
|
|
48
|
-
}, 1e3);
|
|
49
|
-
return server.close(true)
|
|
50
|
-
|
|
51
|
-
resolve();
|
|
52
|
-
});
|
|
53
|
-
}, 1e3);
|
|
49
|
+
}, forceShutdown * 1e3);
|
|
50
|
+
return server.close(true);
|
|
51
|
+
}, gracefulShutdown * 1e3);
|
|
54
52
|
})]);
|
|
55
53
|
globalThis.process.exit(0);
|
|
56
54
|
};
|
|
@@ -58,4 +56,4 @@ const gracefulShutdownPlugin = (server) => {
|
|
|
58
56
|
};
|
|
59
57
|
|
|
60
58
|
//#endregion
|
|
61
|
-
export {
|
|
59
|
+
export { gracefulShutdownPlugin as n, wrapFetch as r, errorPlugin as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { lazyInherit } from "./_inherit-
|
|
1
|
+
import { t as lazyInherit } from "./_inherit-D99WuBbX.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/_url.ts
|
|
4
4
|
/**
|
|
@@ -60,11 +60,10 @@ const FastURL = /* @__PURE__ */ (() => {
|
|
|
60
60
|
const url = this.href;
|
|
61
61
|
const protoIndex = url.indexOf("://");
|
|
62
62
|
const pathnameIndex = protoIndex === -1 ? -1 : url.indexOf("/", protoIndex + 4);
|
|
63
|
-
const qIndex = pathnameIndex === -1 ? -1 : url.indexOf("?", pathnameIndex);
|
|
64
63
|
this.#pos = [
|
|
65
64
|
protoIndex,
|
|
66
65
|
pathnameIndex,
|
|
67
|
-
|
|
66
|
+
pathnameIndex === -1 ? -1 : url.indexOf("?", pathnameIndex)
|
|
68
67
|
];
|
|
69
68
|
}
|
|
70
69
|
return this.#pos;
|
|
@@ -98,8 +97,7 @@ const FastURL = /* @__PURE__ */ (() => {
|
|
|
98
97
|
if (this.#protocol === void 0) {
|
|
99
98
|
const [protocolIndex] = this.#getPos();
|
|
100
99
|
if (protocolIndex === -1) return this._url.protocol;
|
|
101
|
-
|
|
102
|
-
this.#protocol = url.slice(0, protocolIndex + 1);
|
|
100
|
+
this.#protocol = this.href.slice(0, protocolIndex + 1);
|
|
103
101
|
}
|
|
104
102
|
return this.#protocol;
|
|
105
103
|
}
|
|
@@ -117,4 +115,4 @@ const FastURL = /* @__PURE__ */ (() => {
|
|
|
117
115
|
})();
|
|
118
116
|
|
|
119
117
|
//#endregion
|
|
120
|
-
export { FastURL as
|
|
118
|
+
export { FastURL as t };
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
function resolvePortAndHost(opts) {
|
|
3
3
|
const _port = opts.port ?? globalThis.process?.env.PORT ?? 3e3;
|
|
4
4
|
const port = typeof _port === "number" ? _port : Number.parseInt(_port, 10);
|
|
5
|
-
|
|
5
|
+
if (port < 0 || port > 65535) throw new RangeError(`Port must be between 0 and 65535 (got "${port}").`);
|
|
6
6
|
return {
|
|
7
7
|
port,
|
|
8
|
-
hostname
|
|
8
|
+
hostname: opts.hostname ?? globalThis.process?.env.HOST
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
function fmtURL(host, port, secure) {
|
|
12
|
-
if (!host || !port) return
|
|
12
|
+
if (!host || !port) return;
|
|
13
13
|
if (host.includes(":")) host = `[${host}]`;
|
|
14
14
|
return `http${secure ? "s" : ""}://${host}:${port}/`;
|
|
15
15
|
}
|
|
@@ -53,7 +53,7 @@ function resolveCertOrKey(value) {
|
|
|
53
53
|
return readFileSync(value, "utf8");
|
|
54
54
|
}
|
|
55
55
|
function createWaitUntil() {
|
|
56
|
-
const promises = new Set();
|
|
56
|
+
const promises = /* @__PURE__ */ new Set();
|
|
57
57
|
return {
|
|
58
58
|
waitUntil: (promise) => {
|
|
59
59
|
if (typeof promise?.then !== "function") return;
|
|
@@ -68,4 +68,4 @@ function createWaitUntil() {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
//#endregion
|
|
71
|
-
export {
|
|
71
|
+
export { resolveTLSOptions as a, resolvePortAndHost as i, fmtURL as n, printListening as r, createWaitUntil as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { lazyInherit } from "./_inherit-
|
|
1
|
+
import { t as lazyInherit } from "./_inherit-D99WuBbX.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/adapters/_node/response.ts
|
|
4
4
|
/**
|
|
@@ -154,4 +154,4 @@ function callNodeHandler(handler, req) {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
//#endregion
|
|
157
|
-
export { NodeResponse, callNodeHandler };
|
|
157
|
+
export { NodeResponse as n, callNodeHandler as t };
|
|
@@ -7,13 +7,9 @@ import * as Bun from "bun";
|
|
|
7
7
|
import * as CF from "@cloudflare/workers-types";
|
|
8
8
|
|
|
9
9
|
//#region src/types.d.ts
|
|
10
|
-
// Utils
|
|
11
10
|
type MaybePromise<T> = T | Promise<T>;
|
|
12
11
|
type IsAny<T> = Equal<T, any> extends true ? true : false;
|
|
13
12
|
type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
|
|
14
|
-
// ----------------------------------------------------------------------------
|
|
15
|
-
// srvx API
|
|
16
|
-
// ----------------------------------------------------------------------------
|
|
17
13
|
/**
|
|
18
14
|
* Faster URL constructor with lazy access to pathname and search params (For Node, Deno, and Bun).
|
|
19
15
|
*/
|
|
@@ -210,9 +206,6 @@ interface Server<Handler = ServerHandler> {
|
|
|
210
206
|
*/
|
|
211
207
|
close(closeActiveConnections?: boolean): Promise<void>;
|
|
212
208
|
}
|
|
213
|
-
// ----------------------------------------------------------------------------
|
|
214
|
-
// Request with runtime addons.
|
|
215
|
-
// ----------------------------------------------------------------------------
|
|
216
209
|
interface ServerRuntimeContext {
|
|
217
210
|
name: "node" | "deno" | "bun" | "cloudflare" | (string & {});
|
|
218
211
|
/**
|
|
@@ -267,9 +260,6 @@ interface ServerRequest extends Request {
|
|
|
267
260
|
*/
|
|
268
261
|
waitUntil?: (promise: Promise<unknown>) => void | Promise<void>;
|
|
269
262
|
}
|
|
270
|
-
// ----------------------------------------------------------------------------
|
|
271
|
-
// Different handler types
|
|
272
|
-
// ----------------------------------------------------------------------------
|
|
273
263
|
type FetchHandler = (request: Request) => Response | Promise<Response>;
|
|
274
264
|
type ErrorHandler = (error: unknown) => Response | Promise<Response>;
|
|
275
265
|
type BunFetchHandler = (request: Request, server?: Bun.Server<any>) => Response | Promise<Response>;
|
|
@@ -280,4 +270,4 @@ type NodeHttpHandler = (req: NodeServerRequest, res: NodeServerResponse) => void
|
|
|
280
270
|
type NodeHTTPMiddleware = (req: NodeServerRequest, res: NodeServerResponse, next: (error?: Error) => void) => unknown | Promise<unknown>;
|
|
281
271
|
type CloudflareFetchHandler = CF.ExportedHandlerFetchHandler;
|
|
282
272
|
//#endregion
|
|
283
|
-
export {
|
|
273
|
+
export { ServerRequest as _, FastResponse as a, serve as b, NodeHTTPMiddleware as c, NodeServerResponse as d, Server as f, ServerPlugin as g, ServerOptions as h, ErrorHandler as i, NodeHttpHandler as l, ServerMiddleware as m, CloudflareFetchHandler as n, FastURL as o, ServerHandler as p, DenoFetchHandler as r, FetchHandler as s, BunFetchHandler as t, NodeServerRequest as u, ServerRequestContext as v, ServerRuntimeContext as y };
|
package/dist/adapters/bun.d.mts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { f as Server, h as ServerOptions, t as BunFetchHandler } from "../_chunks/types-CpzLEZLT.mjs";
|
|
2
|
+
import { t as FastURL } from "../_chunks/_url-C-JHG430.mjs";
|
|
3
3
|
import * as bun from "bun";
|
|
4
4
|
|
|
5
5
|
//#region src/adapters/bun.d.ts
|
|
6
6
|
declare const FastResponse: typeof globalThis.Response;
|
|
7
7
|
declare function serve(options: ServerOptions): BunServer;
|
|
8
|
-
// https://bun.sh/docs/api/http
|
|
9
8
|
declare class BunServer implements Server<BunFetchHandler> {
|
|
10
9
|
#private;
|
|
11
10
|
readonly runtime = "bun";
|
package/dist/adapters/bun.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "../_chunks/
|
|
2
|
-
import "../_chunks/_inherit-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { gracefulShutdownPlugin, wrapFetch } from "../_chunks/_plugins-
|
|
1
|
+
import "../_chunks/_color-Kmne9cay.mjs";
|
|
2
|
+
import "../_chunks/_inherit-D99WuBbX.mjs";
|
|
3
|
+
import { t as FastURL } from "../_chunks/_url-COjYRiX5.mjs";
|
|
4
|
+
import { a as resolveTLSOptions, i as resolvePortAndHost, n as fmtURL, r as printListening, t as createWaitUntil } from "../_chunks/_utils-CIBojyNO.mjs";
|
|
5
|
+
import { n as gracefulShutdownPlugin, r as wrapFetch } from "../_chunks/_plugins-ZJvYKoy9.mjs";
|
|
6
6
|
|
|
7
7
|
//#region src/adapters/bun.ts
|
|
8
8
|
const FastResponse = Response;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../_chunks/
|
|
2
|
-
import {
|
|
1
|
+
import "../_chunks/_color-Kmne9cay.mjs";
|
|
2
|
+
import { r as wrapFetch, t as errorPlugin } from "../_chunks/_plugins-ZJvYKoy9.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/adapters/cloudflare.ts
|
|
5
5
|
const FastURL = URL;
|
package/dist/adapters/deno.d.mts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { f as Server, h as ServerOptions, r as DenoFetchHandler } from "../_chunks/types-CpzLEZLT.mjs";
|
|
2
|
+
import { t as FastURL } from "../_chunks/_url-C-JHG430.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/adapters/deno.d.ts
|
|
5
5
|
declare const FastResponse: typeof globalThis.Response;
|
|
6
6
|
declare function serve(options: ServerOptions): DenoServer;
|
|
7
|
-
// https://docs.deno.com/api/deno/~/Deno.serve
|
|
8
7
|
declare class DenoServer implements Server<DenoFetchHandler> {
|
|
9
8
|
#private;
|
|
10
9
|
readonly runtime = "deno";
|
package/dist/adapters/deno.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "../_chunks/
|
|
2
|
-
import "../_chunks/_inherit-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { gracefulShutdownPlugin, wrapFetch } from "../_chunks/_plugins-
|
|
1
|
+
import "../_chunks/_color-Kmne9cay.mjs";
|
|
2
|
+
import "../_chunks/_inherit-D99WuBbX.mjs";
|
|
3
|
+
import { t as FastURL } from "../_chunks/_url-COjYRiX5.mjs";
|
|
4
|
+
import { a as resolveTLSOptions, i as resolvePortAndHost, n as fmtURL, r as printListening, t as createWaitUntil } from "../_chunks/_utils-CIBojyNO.mjs";
|
|
5
|
+
import { n as gracefulShutdownPlugin, r as wrapFetch } from "../_chunks/_plugins-ZJvYKoy9.mjs";
|
|
6
6
|
|
|
7
7
|
//#region src/adapters/deno.ts
|
|
8
8
|
const FastResponse = Response;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../_chunks/
|
|
2
|
-
import { createWaitUntil } from "../_chunks/_utils-
|
|
3
|
-
import {
|
|
1
|
+
import "../_chunks/_color-Kmne9cay.mjs";
|
|
2
|
+
import { t as createWaitUntil } from "../_chunks/_utils-CIBojyNO.mjs";
|
|
3
|
+
import { r as wrapFetch, t as errorPlugin } from "../_chunks/_plugins-ZJvYKoy9.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 {
|
|
2
|
-
import {
|
|
1
|
+
import { _ as ServerRequest, d as NodeServerResponse, f as Server, h as ServerOptions, l as NodeHttpHandler, s as FetchHandler, u as NodeServerRequest } from "../_chunks/types-CpzLEZLT.mjs";
|
|
2
|
+
import { t as FastURL } from "../_chunks/_url-C-JHG430.mjs";
|
|
3
3
|
import { Readable } from "node:stream";
|
|
4
4
|
|
|
5
5
|
//#region src/adapters/_node/request.d.ts
|
|
@@ -12,7 +12,6 @@ declare const NodeRequest: {
|
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/adapters/_node/response.d.ts
|
|
15
|
-
// prettier-ignore
|
|
16
15
|
type PreparedNodeResponseBody = string | Buffer | Uint8Array | DataView | ReadableStream | Readable | undefined | null;
|
|
17
16
|
interface PreparedNodeResponse {
|
|
18
17
|
status: number;
|
|
@@ -36,9 +35,6 @@ type NodeResponse = InstanceType<typeof NodeResponse>;
|
|
|
36
35
|
declare function sendNodeResponse(nodeRes: NodeServerResponse, webRes: Response | NodeResponse): Promise<void>;
|
|
37
36
|
//#endregion
|
|
38
37
|
//#region src/adapters/_node/web/fetch.d.ts
|
|
39
|
-
// https://github.com/nodejs/node/blob/main/lib/_http_incoming.js
|
|
40
|
-
// https://github.com/nodejs/node/blob/main/lib/_http_outgoing.js
|
|
41
|
-
// https://github.com/nodejs/node/blob/main/lib/_http_server.js
|
|
42
38
|
/**
|
|
43
39
|
* Calls a Node.js HTTP Request handler with a Fetch API Request object and returns a Response object.
|
|
44
40
|
*
|
|
@@ -71,4 +67,4 @@ declare function toFetchHandler(handler: NodeHttpHandler & AdapterMeta): FetchHa
|
|
|
71
67
|
//#region src/adapters/node.d.ts
|
|
72
68
|
declare function serve(options: ServerOptions): Server;
|
|
73
69
|
//#endregion
|
|
74
|
-
export { NodeResponse as FastResponse, FastURL, NodeRequest,
|
|
70
|
+
export { NodeResponse as FastResponse, NodeResponse, FastURL, NodeRequest, fetchNodeHandler, sendNodeResponse, serve, toFetchHandler, toNodeHandler };
|
package/dist/adapters/node.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "../_chunks/
|
|
2
|
-
import { lazyInherit } from "../_chunks/_inherit-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { NodeResponse, callNodeHandler } from "../_chunks/call-
|
|
1
|
+
import "../_chunks/_color-Kmne9cay.mjs";
|
|
2
|
+
import { t as lazyInherit } from "../_chunks/_inherit-D99WuBbX.mjs";
|
|
3
|
+
import { t as FastURL } from "../_chunks/_url-COjYRiX5.mjs";
|
|
4
|
+
import { a as resolveTLSOptions, i as resolvePortAndHost, n as fmtURL, r as printListening, t as createWaitUntil } from "../_chunks/_utils-CIBojyNO.mjs";
|
|
5
|
+
import { n as gracefulShutdownPlugin, r as wrapFetch, t as errorPlugin } from "../_chunks/_plugins-ZJvYKoy9.mjs";
|
|
6
|
+
import { n as NodeResponse, t as callNodeHandler } from "../_chunks/call-BLKVUMn3.mjs";
|
|
7
7
|
import nodeHTTP, { IncomingMessage, ServerResponse } from "node:http";
|
|
8
8
|
import { Duplex, Readable } from "node:stream";
|
|
9
9
|
import nodeHTTPS from "node:https";
|
|
@@ -165,7 +165,7 @@ const NodeRequestHeaders = /* @__PURE__ */ (() => {
|
|
|
165
165
|
//#endregion
|
|
166
166
|
//#region src/adapters/_node/request.ts
|
|
167
167
|
const NodeRequest = /* @__PURE__ */ (() => {
|
|
168
|
-
const NativeRequest = globalThis.
|
|
168
|
+
const NativeRequest = globalThis[Symbol.for("srvx.nativeRequest")] ??= globalThis.Request;
|
|
169
169
|
const PatchedRequest = class Request$1 extends NativeRequest {
|
|
170
170
|
static _srvx = true;
|
|
171
171
|
static [Symbol.hasInstance](instance) {
|
|
@@ -236,8 +236,7 @@ const NodeRequest = /* @__PURE__ */ (() => {
|
|
|
236
236
|
if (this.#request) return this.#request.body;
|
|
237
237
|
if (this.#bodyStream === void 0) {
|
|
238
238
|
const method = this.method;
|
|
239
|
-
|
|
240
|
-
this.#bodyStream = hasBody ? Readable.toWeb(this.#req) : null;
|
|
239
|
+
this.#bodyStream = !(method === "GET" || method === "HEAD") ? Readable.toWeb(this.#req) : null;
|
|
241
240
|
}
|
|
242
241
|
return this.#bodyStream;
|
|
243
242
|
}
|
|
@@ -486,10 +485,7 @@ var WebServerResponse = class extends ServerResponse {
|
|
|
486
485
|
*/
|
|
487
486
|
async function fetchNodeHandler(handler, req) {
|
|
488
487
|
const nodeRuntime = req.runtime?.node;
|
|
489
|
-
if (nodeRuntime && nodeRuntime.req && nodeRuntime.res)
|
|
490
|
-
const webRes = await callNodeHandler(handler, req);
|
|
491
|
-
return webRes;
|
|
492
|
-
}
|
|
488
|
+
if (nodeRuntime && nodeRuntime.req && nodeRuntime.res) return await callNodeHandler(handler, req);
|
|
493
489
|
const socket = new WebRequestSocket(req);
|
|
494
490
|
const nodeReq = new WebIncomingMessage(req, socket);
|
|
495
491
|
const nodeRes = new WebServerResponse(nodeReq, socket);
|
|
@@ -516,11 +512,10 @@ async function fetchNodeHandler(handler, req) {
|
|
|
516
512
|
function toNodeHandler(handler) {
|
|
517
513
|
if (handler.__nodeHandler) return handler.__nodeHandler;
|
|
518
514
|
function convertedNodeHandler(nodeReq, nodeRes) {
|
|
519
|
-
const
|
|
515
|
+
const res = handler(new NodeRequest({
|
|
520
516
|
req: nodeReq,
|
|
521
517
|
res: nodeRes
|
|
522
|
-
});
|
|
523
|
-
const res = handler(request);
|
|
518
|
+
}));
|
|
524
519
|
return res instanceof Promise ? res.then((resolvedRes) => sendNodeResponse(nodeRes, resolvedRes)) : sendNodeResponse(nodeRes, res);
|
|
525
520
|
}
|
|
526
521
|
convertedNodeHandler.__fetchHandler = handler;
|
|
@@ -595,8 +590,7 @@ var NodeServer = class {
|
|
|
595
590
|
};
|
|
596
591
|
let server;
|
|
597
592
|
this.#isSecure = !!this.serveOptions.cert && this.options.protocol !== "http";
|
|
598
|
-
|
|
599
|
-
if (isHttp2) if (this.#isSecure) server = nodeHTTP2.createSecureServer({
|
|
593
|
+
if (this.options.node?.http2 ?? this.#isSecure) if (this.#isSecure) server = nodeHTTP2.createSecureServer({
|
|
600
594
|
allowHTTP1: true,
|
|
601
595
|
...this.serveOptions
|
|
602
596
|
}, handler);
|
|
@@ -637,4 +631,4 @@ var NodeServer = class {
|
|
|
637
631
|
};
|
|
638
632
|
|
|
639
633
|
//#endregion
|
|
640
|
-
export { NodeResponse as FastResponse, FastURL, NodeRequest,
|
|
634
|
+
export { NodeResponse as FastResponse, NodeResponse, FastURL, NodeRequest, fetchNodeHandler, sendNodeResponse, serve, toFetchHandler, toNodeHandler };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Server, ServerOptions
|
|
1
|
+
import { _ as ServerRequest, f as Server, h as ServerOptions } from "../_chunks/types-CpzLEZLT.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/adapters/service-worker.d.ts
|
|
4
4
|
declare const FastURL: typeof globalThis.URL;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../_chunks/
|
|
2
|
-
import {
|
|
1
|
+
import "../_chunks/_color-Kmne9cay.mjs";
|
|
2
|
+
import { r as wrapFetch, t as errorPlugin } from "../_chunks/_plugins-ZJvYKoy9.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/adapters/service-worker.ts
|
|
5
5
|
const FastURL = URL;
|
package/dist/cli.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as green, c as url, i as gray, l as yellow, n as bold, o as magenta, r as cyan, s as red } from "./_chunks/_color-Kmne9cay.mjs";
|
|
2
2
|
import { parseArgs } from "node:util";
|
|
3
3
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
4
|
import * as nodeHTTP$1 from "node:http";
|
|
@@ -81,8 +81,7 @@ async function serve() {
|
|
|
81
81
|
try {
|
|
82
82
|
if (!process.env.NODE_ENV) process.env.NODE_ENV = options._prod ? "production" : "development";
|
|
83
83
|
const entry = await loadEntry(options);
|
|
84
|
-
const
|
|
85
|
-
const { serve: srvxServe } = forceUseNode ? await import("srvx/node") : await import("srvx");
|
|
84
|
+
const { serve: srvxServe } = entry._legacyNode ? await import("srvx/node") : await import("srvx");
|
|
86
85
|
const { serveStatic } = await import("srvx/static");
|
|
87
86
|
const { log } = await import("srvx/log");
|
|
88
87
|
const staticDir = resolve(options._dir, options._static);
|
|
@@ -136,7 +135,7 @@ async function loadEntry(opts) {
|
|
|
136
135
|
const nodeHandler = listenHandler || (typeof mod.default === "function" ? mod.default : void 0);
|
|
137
136
|
if (nodeHandler) {
|
|
138
137
|
_legacyNode = true;
|
|
139
|
-
const { callNodeHandler } = await import("./_chunks/call-
|
|
138
|
+
const { callNodeHandler } = await import("./_chunks/call-BlEaeO5P.mjs");
|
|
140
139
|
fetchHandler = (webReq) => callNodeHandler(nodeHandler, webReq);
|
|
141
140
|
}
|
|
142
141
|
}
|
|
@@ -156,8 +155,8 @@ async function loadEntry(opts) {
|
|
|
156
155
|
} catch (error) {
|
|
157
156
|
if (error?.code === "ERR_UNKNOWN_FILE_EXTENSION") {
|
|
158
157
|
const message = String(error);
|
|
159
|
-
if (/"\.(m|c)?ts"/g.test(message)) console.error(
|
|
160
|
-
else if (/"\.(m|c)?tsx"/g.test(message)) console.error(
|
|
158
|
+
if (/"\.(m|c)?ts"/g.test(message)) console.error(red(`\nMake sure you're using Node.js v22.18+ or v24+ for TypeScript support (current version: ${process.versions.node})\n\n`));
|
|
159
|
+
else if (/"\.(m|c)?tsx"/g.test(message)) console.error(red(`\nYou need a compatible loader for JSX support (Deno, Bun or srvx --register jiti/register)\n\n`));
|
|
161
160
|
}
|
|
162
161
|
if (error instanceof Error) Error.captureStackTrace?.(error, serve);
|
|
163
162
|
throw error;
|
|
@@ -183,14 +182,14 @@ function renderError(error, status = 500, title = "Server Error") {
|
|
|
183
182
|
}
|
|
184
183
|
function printInfo(entry) {
|
|
185
184
|
let entryInfo;
|
|
186
|
-
if (options._entry) entryInfo =
|
|
187
|
-
else entryInfo =
|
|
188
|
-
console.log(
|
|
189
|
-
if (options._entry && entry._error) console.error(
|
|
185
|
+
if (options._entry) entryInfo = cyan("./" + relative(".", options._entry));
|
|
186
|
+
else entryInfo = gray(`(create ${bold(`server.ts`)} to enable)`);
|
|
187
|
+
console.log(gray(`${bold(gray("λ"))} Server handler: ${entryInfo}`));
|
|
188
|
+
if (options._entry && entry._error) console.error(red(` ${entry._error}`));
|
|
190
189
|
let staticInfo;
|
|
191
|
-
if (options._static) staticInfo =
|
|
192
|
-
else staticInfo =
|
|
193
|
-
console.log(
|
|
190
|
+
if (options._static) staticInfo = cyan("./" + relative(".", options._static) + "/");
|
|
191
|
+
else staticInfo = gray(`(add ${bold("public/")} dir to enable)`);
|
|
192
|
+
console.log(gray(`${bold(gray("∘"))} Static files: ${staticInfo}`));
|
|
194
193
|
}
|
|
195
194
|
async function interceptListen(cb) {
|
|
196
195
|
const originalListen = nodeHTTP$1.Server.prototype.listen;
|
|
@@ -203,8 +202,7 @@ async function interceptListen(cb) {
|
|
|
203
202
|
nodeHTTP$1.Server.prototype.listen = originalListen;
|
|
204
203
|
globalThis.__srvx_listen_cb__ = [arg1, arg2].find((arg) => typeof arg === "function");
|
|
205
204
|
return new Proxy({}, { get(_, prop) {
|
|
206
|
-
|
|
207
|
-
return server?.node?.server?.[prop];
|
|
205
|
+
return globalThis.__srvx__?.node?.server?.[prop];
|
|
208
206
|
} });
|
|
209
207
|
};
|
|
210
208
|
res = await cb();
|
|
@@ -217,8 +215,7 @@ async function interceptListen(cb) {
|
|
|
217
215
|
};
|
|
218
216
|
}
|
|
219
217
|
async function version() {
|
|
220
|
-
|
|
221
|
-
return `srvx ${version$1}\n${runtime()}`;
|
|
218
|
+
return `srvx ${globalThis.__srvx_version__ || "unknown"}\n${runtime()}`;
|
|
222
219
|
}
|
|
223
220
|
function runtime() {
|
|
224
221
|
if (process.versions.bun) return `bun ${process.versions.bun}`;
|
|
@@ -266,7 +263,7 @@ function parseArgs$1(args$1) {
|
|
|
266
263
|
dir = dirname(entry);
|
|
267
264
|
}
|
|
268
265
|
if (!existsSync(dir)) {
|
|
269
|
-
console.error(
|
|
266
|
+
console.error(red(`Directory "${dir}" does not exist.\n`));
|
|
270
267
|
process.exit(1);
|
|
271
268
|
}
|
|
272
269
|
return {
|
|
@@ -287,55 +284,55 @@ function parseArgs$1(args$1) {
|
|
|
287
284
|
}
|
|
288
285
|
function example() {
|
|
289
286
|
const useTs = !options._entry || options._entry.endsWith(".ts");
|
|
290
|
-
return `${
|
|
291
|
-
${
|
|
292
|
-
${
|
|
293
|
-
${
|
|
287
|
+
return `${bold(gray("// server.ts"))}
|
|
288
|
+
${magenta("export default")} {
|
|
289
|
+
${cyan("fetch")}(req${useTs ? ": Request" : ""}) {
|
|
290
|
+
${magenta("return")} new Response(${green("\"Hello, World!\"")});
|
|
294
291
|
}
|
|
295
292
|
}`;
|
|
296
293
|
}
|
|
297
294
|
function usage(mainOpts) {
|
|
298
295
|
const command = mainOpts.command;
|
|
299
296
|
return `
|
|
300
|
-
${
|
|
297
|
+
${cyan(command)} - Start an HTTP server with the specified entry path.
|
|
301
298
|
|
|
302
|
-
${
|
|
299
|
+
${bold("USAGE")}
|
|
303
300
|
${existsSync(options._entry) ? "" : `\n${example()}\n`}
|
|
304
|
-
${
|
|
305
|
-
${
|
|
306
|
-
${
|
|
307
|
-
${
|
|
308
|
-
${
|
|
309
|
-
${
|
|
310
|
-
${
|
|
301
|
+
${gray("# srvx [options] [entry]")}
|
|
302
|
+
${gray("$")} ${cyan(command)} ${gray("./server.ts")} ${gray("# Start development server")}
|
|
303
|
+
${gray("$")} ${cyan(command)} --prod ${gray("# Start production server")}
|
|
304
|
+
${gray("$")} ${cyan(command)} --port=8080 ${gray("# Listen on port 8080")}
|
|
305
|
+
${gray("$")} ${cyan(command)} --host=localhost ${gray("# Bind to localhost only")}
|
|
306
|
+
${gray("$")} ${cyan(command)} --import=jiti/register ${gray(`# Enable ${url("jiti", "https://github.com/unjs/jiti")} loader`)}
|
|
307
|
+
${gray("$")} ${cyan(command)} --tls --cert=cert.pem --key=key.pem ${gray("# Enable TLS (HTTPS/HTTP2)")}
|
|
311
308
|
|
|
312
309
|
|
|
313
|
-
${
|
|
310
|
+
${bold("ARGUMENTS")}
|
|
314
311
|
|
|
315
|
-
${
|
|
316
|
-
Default: ${defaultEntries.map((e) =>
|
|
312
|
+
${yellow("<entry>")} Server entry path to serve.
|
|
313
|
+
Default: ${defaultEntries.map((e) => cyan(e)).join(", ")} ${gray(`(${defaultExts.join(",")})`)}
|
|
317
314
|
|
|
318
|
-
${
|
|
315
|
+
${bold("OPTIONS")}
|
|
319
316
|
|
|
320
|
-
${
|
|
321
|
-
${
|
|
322
|
-
${
|
|
323
|
-
${
|
|
324
|
-
${
|
|
325
|
-
${
|
|
326
|
-
${
|
|
327
|
-
${
|
|
328
|
-
${
|
|
329
|
-
${
|
|
317
|
+
${green("-p, --port")} ${yellow("<port>")} Port to listen on (default: ${yellow("3000")})
|
|
318
|
+
${green("--host")} ${yellow("<host>")} Host to bind to (default: all interfaces)
|
|
319
|
+
${green("-s, --static")} ${yellow("<dir>")} Serve static files from the specified directory (default: ${yellow("public")})
|
|
320
|
+
${green("--prod")} Run in production mode (no watch, no debug)
|
|
321
|
+
${green("--import")} ${yellow("<loader>")} ES module to preload
|
|
322
|
+
${green("--tls")} Enable TLS (HTTPS/HTTP2)
|
|
323
|
+
${green("--cert")} ${yellow("<file>")} TLS certificate file
|
|
324
|
+
${green("--key")} ${yellow("<file>")} TLS private key file
|
|
325
|
+
${green("-h, --help")} Show this help message
|
|
326
|
+
${green("-v, --version")} Show server and runtime versions
|
|
330
327
|
|
|
331
|
-
${
|
|
328
|
+
${bold("ENVIRONMENT")}
|
|
332
329
|
|
|
333
|
-
${
|
|
334
|
-
${
|
|
335
|
-
${
|
|
330
|
+
${green("PORT")} Override port
|
|
331
|
+
${green("HOST")} Override host
|
|
332
|
+
${green("NODE_ENV")} Set to ${yellow("production")} for production mode.
|
|
336
333
|
|
|
337
|
-
➤ ${
|
|
338
|
-
➤ ${
|
|
334
|
+
➤ ${url("Documentation", mainOpts.docs || "https://srvx.h3.dev")}
|
|
335
|
+
➤ ${url("Report issues", mainOpts.issues || "https://github.com/h3js/srvx/issues")}
|
|
339
336
|
`.trim();
|
|
340
337
|
}
|
|
341
338
|
function setupProcessErrorHandlers() {
|
package/dist/log.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { ServerMiddleware } from "./_chunks/types-
|
|
1
|
+
import { m as ServerMiddleware } from "./_chunks/types-CpzLEZLT.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/log.d.ts
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
5
4
|
interface LogOptions {}
|
|
6
5
|
declare const log: (_options?: LogOptions) => ServerMiddleware;
|
|
7
6
|
//#endregion
|
package/dist/log.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as green, i as gray, l as yellow, n as bold, s as red, t as blue } from "./_chunks/_color-Kmne9cay.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/log.ts
|
|
4
4
|
const statusColors = {
|
|
5
|
-
1:
|
|
6
|
-
2:
|
|
7
|
-
3:
|
|
5
|
+
1: blue,
|
|
6
|
+
2: green,
|
|
7
|
+
3: yellow
|
|
8
8
|
};
|
|
9
9
|
const log = (_options = {}) => {
|
|
10
10
|
return async (req, next) => {
|
|
11
11
|
const start = performance.now();
|
|
12
12
|
const res = await next();
|
|
13
13
|
const duration = performance.now() - start;
|
|
14
|
-
const statusColor = statusColors[Math.floor(res.status / 100)] ||
|
|
15
|
-
console.log(`${
|
|
14
|
+
const statusColor = statusColors[Math.floor(res.status / 100)] || red;
|
|
15
|
+
console.log(`${gray(`[${(/* @__PURE__ */ new Date()).toLocaleTimeString()}]`)} ${bold(req.method)} ${blue(req.url)} [${statusColor(res.status + "")}] ${gray(`(${duration.toFixed(2)}ms)`)}`);
|
|
16
16
|
return res;
|
|
17
17
|
};
|
|
18
18
|
};
|
package/dist/static.d.mts
CHANGED
package/dist/static.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./_chunks/_inherit-
|
|
2
|
-
import {
|
|
1
|
+
import "./_chunks/_inherit-D99WuBbX.mjs";
|
|
2
|
+
import { t as FastURL } from "./_chunks/_url-COjYRiX5.mjs";
|
|
3
3
|
import { extname, join, resolve } from "node:path";
|
|
4
4
|
import { createReadStream } from "node:fs";
|
|
5
5
|
import { readFile, stat } from "node:fs/promises";
|
|
@@ -35,8 +35,7 @@ const serveStatic = (options) => {
|
|
|
35
35
|
const methods = new Set((options.methods || ["GET", "HEAD"]).map((m) => m.toUpperCase()));
|
|
36
36
|
return async (req, next) => {
|
|
37
37
|
if (!methods.has(req.method)) return next();
|
|
38
|
-
const
|
|
39
|
-
const path = url.pathname.slice(1).replace(/\/$/, "");
|
|
38
|
+
const path = (req._url ??= new FastURL(req.url)).pathname.slice(1).replace(/\/$/, "");
|
|
40
39
|
let paths;
|
|
41
40
|
if (path === "") paths = ["index.html"];
|
|
42
41
|
else if (extname(path) === "") paths = [`${path}.html`, `${path}/index.html`];
|
package/dist/types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as ServerRequest, a as FastResponse, b as serve, c as NodeHTTPMiddleware, d as NodeServerResponse, f as Server, g as ServerPlugin, h as ServerOptions, i as ErrorHandler, l as NodeHttpHandler, m as ServerMiddleware, n as CloudflareFetchHandler, o as FastURL, p as ServerHandler, r as DenoFetchHandler, s as FetchHandler, t as BunFetchHandler, u as NodeServerRequest, v as ServerRequestContext, y as ServerRuntimeContext } from "./_chunks/types-CpzLEZLT.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.9.
|
|
3
|
+
"version": "0.9.6",
|
|
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",
|
|
@@ -58,38 +58,38 @@
|
|
|
58
58
|
"srvx": "link:."
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@cloudflare/workers-types": "^4.
|
|
62
|
-
"@hono/node-server": "^1.19.
|
|
61
|
+
"@cloudflare/workers-types": "^4.20251111.0",
|
|
62
|
+
"@hono/node-server": "^1.19.6",
|
|
63
63
|
"@mitata/counters": "^0.0.8",
|
|
64
64
|
"@mjackson/node-fetch-server": "^0.7.0",
|
|
65
|
-
"@types/bun": "^1.3.
|
|
65
|
+
"@types/bun": "^1.3.2",
|
|
66
66
|
"@types/deno": "^2.5.0",
|
|
67
|
-
"@types/express": "^5.0.
|
|
68
|
-
"@types/node": "^24.
|
|
67
|
+
"@types/express": "^5.0.5",
|
|
68
|
+
"@types/node": "^24.10.0",
|
|
69
69
|
"@types/node-forge": "^1.3.14",
|
|
70
|
-
"@types/serviceworker": "^0.0.
|
|
71
|
-
"@vitest/coverage-v8": "^
|
|
72
|
-
"@whatwg-node/server": "^0.10.
|
|
70
|
+
"@types/serviceworker": "^0.0.167",
|
|
71
|
+
"@vitest/coverage-v8": "^4.0.8",
|
|
72
|
+
"@whatwg-node/server": "^0.10.17",
|
|
73
73
|
"automd": "^0.4.2",
|
|
74
74
|
"changelogen": "^0.6.2",
|
|
75
|
-
"eslint": "^9.
|
|
75
|
+
"eslint": "^9.39.1",
|
|
76
76
|
"eslint-config-unjs": "^0.5.0",
|
|
77
77
|
"execa": "^9.6.0",
|
|
78
78
|
"express": "^5.1.0",
|
|
79
|
-
"fastify": "^5.6.
|
|
79
|
+
"fastify": "^5.6.2",
|
|
80
80
|
"get-port-please": "^3.2.0",
|
|
81
81
|
"mdbox": "^0.1.1",
|
|
82
82
|
"mitata": "^1.0.34",
|
|
83
83
|
"node-forge": "^1.3.1",
|
|
84
|
-
"obuild": "^0.
|
|
84
|
+
"obuild": "^0.4.1",
|
|
85
85
|
"prettier": "^3.6.2",
|
|
86
|
-
"srvx-release": "npm:srvx@0.
|
|
86
|
+
"srvx-release": "npm:srvx@0.9.5",
|
|
87
87
|
"tslib": "^2.8.1",
|
|
88
88
|
"typescript": "^5.9.3",
|
|
89
89
|
"undici": "^7.16.0",
|
|
90
|
-
"vitest": "^
|
|
90
|
+
"vitest": "^4.0.8"
|
|
91
91
|
},
|
|
92
|
-
"packageManager": "pnpm@10.
|
|
92
|
+
"packageManager": "pnpm@10.21.0",
|
|
93
93
|
"engines": {
|
|
94
94
|
"node": ">=20.16.0"
|
|
95
95
|
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
//#region src/_utils.cli.ts
|
|
2
|
-
const noColor = globalThis.process?.env?.NO_COLOR === "1" || globalThis.process?.env?.TERM === "dumb";
|
|
3
|
-
const resets = {
|
|
4
|
-
1: 22,
|
|
5
|
-
31: 39,
|
|
6
|
-
32: 39,
|
|
7
|
-
33: 39,
|
|
8
|
-
34: 39,
|
|
9
|
-
35: 39,
|
|
10
|
-
36: 39,
|
|
11
|
-
90: 39
|
|
12
|
-
};
|
|
13
|
-
const _c = (c) => (text) => {
|
|
14
|
-
if (noColor) return text;
|
|
15
|
-
const off = resets[c] ?? 0;
|
|
16
|
-
return `\u001B[${c}m${text}\u001B[${off}m`;
|
|
17
|
-
};
|
|
18
|
-
const Colors = {
|
|
19
|
-
bold: _c(1),
|
|
20
|
-
red: _c(31),
|
|
21
|
-
green: _c(32),
|
|
22
|
-
yellow: _c(33),
|
|
23
|
-
blue: _c(34),
|
|
24
|
-
magenta: _c(35),
|
|
25
|
-
cyan: _c(36),
|
|
26
|
-
gray: _c(90),
|
|
27
|
-
url: (title, url) => noColor ? `[${title}](${url})` : `\u001B]8;;${url}\u001B\\${title}\u001B]8;;\u001B\\`
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
//#endregion
|
|
31
|
-
export { Colors };
|