| import { a as green, i as gray, n as bold, s as red } from "./_utils.mjs"; | ||
| //#region src/_middleware.ts | ||
| function wrapFetch(server) { | ||
@@ -11,2 +12,4 @@ const fetchHandler = server.options.fetch; | ||
| } | ||
| //#endregion | ||
| //#region src/_plugins.ts | ||
| const errorPlugin = (server) => { | ||
@@ -57,2 +60,3 @@ const errorHandler = server.options.error; | ||
| }; | ||
| //#endregion | ||
| export { gracefulShutdownPlugin as n, wrapFetch as r, errorPlugin as t }; |
@@ -0,1 +1,2 @@ | ||
| //#region src/_inherit.ts | ||
| function lazyInherit(target, source, sourceKey) { | ||
@@ -28,2 +29,5 @@ for (const key of [...Object.getOwnPropertyNames(source), ...Object.getOwnPropertySymbols(source)]) { | ||
| } | ||
| //#endregion | ||
| //#region src/_url.ts | ||
| const _needsNormRE = /(?:(?:^|\/)(?:\.|\.\.|%2e|%2e\.|\.%2e|%2e%2e)(?:\/|$))|[\\^\x80-\uffff]/i; | ||
| /** | ||
@@ -56,2 +60,3 @@ * URL wrapper with fast paths to access to the following props: | ||
| if (typeof url === "string") this.#href = url; | ||
| else if (_needsNormRE.test(url.pathname)) this.#url = new NativeURL(`${url.protocol || "http:"}//${url.host || "localhost"}${url.pathname}${url.search || ""}`); | ||
| else { | ||
@@ -142,2 +147,3 @@ this.#protocol = url.protocol; | ||
| })(); | ||
| //#endregion | ||
| export { lazyInherit as n, FastURL as t }; |
@@ -0,1 +1,2 @@ | ||
| //#region src/cli/_utils.ts | ||
| const noColor = /* @__PURE__ */ (() => { | ||
@@ -15,2 +16,3 @@ const env = globalThis.process?.env ?? {}; | ||
| const url = (title, url) => noColor ? `[${title}](${url})` : `\u001B]8;;${url}\u001B\\${title}\u001B]8;;\u001B\\`; | ||
| //#endregion | ||
| 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 }; |
@@ -0,1 +1,2 @@ | ||
| //#region src/_utils.ts | ||
| function resolvePortAndHost(opts) { | ||
@@ -70,2 +71,3 @@ const _port = opts.port ?? globalThis.process?.env.PORT ?? 3e3; | ||
| } | ||
| //#endregion | ||
| export { resolveTLSOptions as a, resolvePortAndHost as i, fmtURL as n, printListening as r, createWaitUntil as t }; |
| import "../_chunks/_utils.mjs"; | ||
| import { r as wrapFetch, t as errorPlugin } from "../_chunks/_plugins.mjs"; | ||
| //#region src/adapters/_aws/utils.ts | ||
| function awsRequest(event, context) { | ||
@@ -253,2 +254,4 @@ const req = new Request(awsEventURL(event), { | ||
| } | ||
| //#endregion | ||
| //#region src/adapters/aws-lambda.ts | ||
| function toLambdaHandler(options) { | ||
@@ -294,2 +297,3 @@ const server = new AWSLambdaServer(options); | ||
| }; | ||
| //#endregion | ||
| export { handleLambdaEvent, handleLambdaEventWithStream, invokeLambdaHandler, toLambdaHandler }; |
@@ -5,2 +5,3 @@ import "../_chunks/_utils.mjs"; | ||
| import { n as gracefulShutdownPlugin, r as wrapFetch } from "../_chunks/_plugins.mjs"; | ||
| //#region src/adapters/bun.ts | ||
| const FastResponse = Response; | ||
@@ -88,2 +89,3 @@ function serve(options) { | ||
| }; | ||
| //#endregion | ||
| export { FastResponse, FastURL, serve }; |
| import "../_chunks/_utils.mjs"; | ||
| import { r as wrapFetch, t as errorPlugin } from "../_chunks/_plugins.mjs"; | ||
| //#region src/adapters/bunny.ts | ||
| const FastURL = URL; | ||
@@ -55,2 +56,3 @@ const FastResponse = Response; | ||
| }; | ||
| //#endregion | ||
| export { FastResponse, FastURL, serve }; |
| import "../_chunks/_utils.mjs"; | ||
| import { r as wrapFetch, t as errorPlugin } from "../_chunks/_plugins.mjs"; | ||
| //#region src/adapters/cloudflare.ts | ||
| const FastURL = URL; | ||
@@ -58,2 +59,3 @@ const FastResponse = Response; | ||
| }; | ||
| //#endregion | ||
| export { FastResponse, FastURL, serve }; |
@@ -5,2 +5,3 @@ import "../_chunks/_utils.mjs"; | ||
| import { n as gracefulShutdownPlugin, r as wrapFetch } from "../_chunks/_plugins.mjs"; | ||
| //#region src/adapters/deno.ts | ||
| const FastResponse = Response; | ||
@@ -97,2 +98,3 @@ function serve(options) { | ||
| }; | ||
| //#endregion | ||
| export { FastResponse, FastURL, serve }; |
| import "../_chunks/_utils.mjs"; | ||
| import { t as createWaitUntil } from "../_chunks/_utils2.mjs"; | ||
| import { r as wrapFetch, t as errorPlugin } from "../_chunks/_plugins.mjs"; | ||
| //#region src/adapters/generic.ts | ||
| const FastURL = URL; | ||
@@ -38,2 +39,3 @@ const FastResponse = Response; | ||
| }; | ||
| //#endregion | ||
| export { FastResponse, FastURL, serve }; |
@@ -9,2 +9,3 @@ import "../_chunks/_utils.mjs"; | ||
| import nodeHTTP2 from "node:http2"; | ||
| //#region src/adapters/_node/send.ts | ||
| async function sendNodeResponse(nodeRes, webRes) { | ||
@@ -67,2 +68,4 @@ if (!webRes) { | ||
| } | ||
| //#endregion | ||
| //#region src/adapters/_node/url.ts | ||
| /** | ||
@@ -104,2 +107,4 @@ * Validates an HTTP Host header value (domain, IPv4, or bracketed IPv6) with optional port. | ||
| }; | ||
| //#endregion | ||
| //#region src/adapters/_node/headers.ts | ||
| const NodeRequestHeaders = /* @__PURE__ */ (() => { | ||
@@ -166,2 +171,4 @@ const NativeHeaders = globalThis.Headers; | ||
| })(); | ||
| //#endregion | ||
| //#region src/adapters/_node/request.ts | ||
| const NodeRequest = /* @__PURE__ */ (() => { | ||
@@ -306,2 +313,4 @@ const NativeRequest = globalThis.Request; | ||
| } | ||
| //#endregion | ||
| //#region src/adapters/_node/response.ts | ||
| /** | ||
@@ -420,2 +429,4 @@ * Fast Response for Node.js runtime | ||
| })(); | ||
| //#endregion | ||
| //#region src/adapters/_node/web/socket.ts | ||
| /** | ||
@@ -541,2 +552,4 @@ * Events: | ||
| }; | ||
| //#endregion | ||
| //#region src/adapters/_node/web/incoming.ts | ||
| var WebIncomingMessage = class extends IncomingMessage { | ||
@@ -560,2 +573,4 @@ constructor(req, socket) { | ||
| }; | ||
| //#endregion | ||
| //#region src/adapters/_node/call.ts | ||
| function callNodeHandler(handler, req) { | ||
@@ -604,2 +619,4 @@ const isMiddleware = handler.length > 2; | ||
| } | ||
| //#endregion | ||
| //#region src/adapters/_node/web/response.ts | ||
| var WebServerResponse = class extends ServerResponse { | ||
@@ -643,2 +660,4 @@ #socket; | ||
| }; | ||
| //#endregion | ||
| //#region src/adapters/_node/web/fetch.ts | ||
| /** | ||
@@ -675,2 +694,4 @@ * Calls a Node.js HTTP Request handler with a Fetch API Request object and returns a Response object. | ||
| } | ||
| //#endregion | ||
| //#region src/adapters/_node/adapter.ts | ||
| /** | ||
@@ -711,2 +732,4 @@ * Converts a Fetch API handler to a Node.js HTTP handler. | ||
| } | ||
| //#endregion | ||
| //#region src/adapters/node.ts | ||
| function serve(options) { | ||
@@ -805,2 +828,3 @@ return new NodeServer(options); | ||
| }; | ||
| //#endregion | ||
| export { NodeResponse as FastResponse, NodeResponse, FastURL, NodeRequest, fetchNodeHandler, patchGlobalRequest, sendNodeResponse, serve, toFetchHandler, toNodeHandler }; |
| import "../_chunks/_utils.mjs"; | ||
| import { r as wrapFetch, t as errorPlugin } from "../_chunks/_plugins.mjs"; | ||
| //#region src/adapters/service-worker.ts | ||
| const FastURL = URL; | ||
@@ -77,2 +78,3 @@ const FastResponse = Response; | ||
| }; | ||
| //#endregion | ||
| export { FastResponse, FastURL, serve }; |
+11
-1
@@ -9,2 +9,3 @@ 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/_utils.mjs"; | ||
| import { Readable } from "node:stream"; | ||
| //#region src/cli/serve.ts | ||
| const NO_ENTRY_ERROR = "No server entry or public directory found"; | ||
@@ -92,2 +93,4 @@ async function cliServe(cliOpts) { | ||
| } | ||
| //#endregion | ||
| //#region src/cli/fetch.ts | ||
| async function cliFetch(cliOpts) { | ||
@@ -182,7 +185,11 @@ const stdin = cliOpts.stdin || process.stdin; | ||
| } | ||
| //#endregion | ||
| //#region src/cli/_meta.ts | ||
| const srvxMeta = { | ||
| name: "srvx", | ||
| version: "0.11.8", | ||
| version: "0.11.9", | ||
| description: "Universal Server." | ||
| }; | ||
| //#endregion | ||
| //#region src/cli/usage.ts | ||
| function usage(mainOpts) { | ||
@@ -253,2 +260,4 @@ const command = mainOpts.usage?.command || "srvx"; | ||
| } | ||
| //#endregion | ||
| //#region src/cli/main.ts | ||
| async function main(mainOpts) { | ||
@@ -430,2 +439,3 @@ const args = process.argv.slice(2); | ||
| } | ||
| //#endregion | ||
| export { cliFetch, main }; |
+2
-0
@@ -6,2 +6,3 @@ import { pathToFileURL } from "node:url"; | ||
| import { EventEmitter } from "node:events"; | ||
| //#region src/loader.ts | ||
| const defaultExts = [ | ||
@@ -139,2 +140,3 @@ ".mjs", | ||
| }; | ||
| //#endregion | ||
| export { defaultEntries, defaultExts, loadServerEntry }; |
+2
-0
| import { a as green, i as gray, l as yellow, n as bold, s as red, t as blue } from "./_chunks/_utils.mjs"; | ||
| //#region src/log.ts | ||
| const statusColors = { | ||
@@ -17,2 +18,3 @@ 1: blue, | ||
| }; | ||
| //#endregion | ||
| export { log }; |
+4
-2
| import { t as FastURL } from "./_chunks/_url.mjs"; | ||
| import { createReadStream } from "node:fs"; | ||
| import { extname, join, resolve } from "node:path"; | ||
| import { extname, join, resolve, sep } from "node:path"; | ||
| import { readFile, stat } from "node:fs/promises"; | ||
| import { FastResponse } from "srvx"; | ||
| import { createBrotliCompress, createGzip } from "node:zlib"; | ||
| //#region src/static.ts | ||
| const COMMON_MIME_TYPES = { | ||
@@ -31,3 +32,3 @@ ".html": "text/html", | ||
| const serveStatic = (options) => { | ||
| const dir = resolve(options.dir) + "/"; | ||
| const dir = resolve(options.dir) + sep; | ||
| const methods = new Set((options.methods || ["GET", "HEAD"]).map((m) => m.toUpperCase())); | ||
@@ -75,2 +76,3 @@ return async (req, next) => { | ||
| }; | ||
| //#endregion | ||
| export { serveStatic }; |
+2
-0
@@ -0,1 +1,2 @@ | ||
| //#region src/tracing.ts | ||
| /** | ||
@@ -55,2 +56,3 @@ * | ||
| } | ||
| //#endregion | ||
| export { tracingPlugin }; |
+13
-13
| { | ||
| "name": "srvx", | ||
| "version": "0.11.8", | ||
| "version": "0.11.9", | ||
| "description": "Universal Server.", | ||
@@ -62,14 +62,14 @@ "homepage": "https://srvx.h3.dev", | ||
| "devDependencies": { | ||
| "@cloudflare/workers-types": "^4.20260304.0", | ||
| "@hono/node-server": "^1.19.9", | ||
| "@cloudflare/workers-types": "^4.20260307.1", | ||
| "@hono/node-server": "^1.19.11", | ||
| "@mitata/counters": "^0.0.8", | ||
| "@mjackson/node-fetch-server": "^0.7.0", | ||
| "@types/aws-lambda": "^8.10.160", | ||
| "@types/bun": "^1.3.9", | ||
| "@types/aws-lambda": "^8.10.161", | ||
| "@types/bun": "^1.3.10", | ||
| "@types/deno": "^2.5.0", | ||
| "@types/express": "^5.0.6", | ||
| "@types/node": "^25.3.0", | ||
| "@types/node": "^25.3.5", | ||
| "@types/node-forge": "^1.3.14", | ||
| "@types/serviceworker": "^0.0.192", | ||
| "@typescript/native-preview": "^7.0.0-dev.20260225.1", | ||
| "@types/serviceworker": "^0.0.193", | ||
| "@typescript/native-preview": "7.0.0-dev.20260309.1", | ||
| "@vitest/coverage-v8": "^4.0.18", | ||
@@ -82,3 +82,3 @@ "@whatwg-node/server": "^0.10.18", | ||
| "express": "^5.2.1", | ||
| "fastify": "^5.7.4", | ||
| "fastify": "^5.8.2", | ||
| "get-port-please": "^3.2.0", | ||
@@ -88,6 +88,6 @@ "mdbox": "^0.1.1", | ||
| "node-forge": "^1.3.3", | ||
| "obuild": "^0.4.31", | ||
| "oxfmt": "^0.35.0", | ||
| "oxlint": "^1.50.0", | ||
| "srvx-release": "npm:srvx@^0.11.7", | ||
| "obuild": "^0.4.32", | ||
| "oxfmt": "^0.36.0", | ||
| "oxlint": "^1.51.0", | ||
| "srvx-release": "npm:srvx@^0.11.8", | ||
| "tslib": "^2.8.1", | ||
@@ -94,0 +94,0 @@ "typescript": "^5.9.3", |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
115682
1.64%2558
2.9%89
2.3%