@vercel/node
Advanced tools
+28
-23
@@ -254,2 +254,3 @@ var __create = Object.create; | ||
| import { buildToNodeHandler } from "@edge-runtime/node-utils"; | ||
| import Edge from "@edge-runtime/primitives"; | ||
| function getWebExportsHandler(listener, methods) { | ||
@@ -265,7 +266,7 @@ const handlerByMethod = {}; | ||
| } | ||
| function addDuplexToInit(init) { | ||
| if (typeof init === "undefined" || typeof init === "object") { | ||
| return { duplex: "half", ...init }; | ||
| function addDuplexToInit(init2) { | ||
| if (typeof init2 === "undefined" || typeof init2 === "object") { | ||
| return { duplex: "half", ...init2 }; | ||
| } | ||
| return init; | ||
| return init2; | ||
| } | ||
@@ -276,19 +277,6 @@ function defaultHttpHandler(_, res) { | ||
| } | ||
| var FetchEvent, webHandlerToNodeHandler; | ||
| var webHandlerToNodeHandler; | ||
| var init_helpers_web = __esm({ | ||
| "src/serverless-functions/helpers-web.ts"() { | ||
| "use strict"; | ||
| FetchEvent = class { | ||
| constructor(request) { | ||
| this.request = request; | ||
| this.response = null; | ||
| this.awaiting = /* @__PURE__ */ new Set(); | ||
| } | ||
| respondWith(response) { | ||
| this.response = response; | ||
| } | ||
| waitUntil() { | ||
| throw new Error("waitUntil is not implemented yet for Node.js"); | ||
| } | ||
| }; | ||
| webHandlerToNodeHandler = buildToNodeHandler( | ||
@@ -300,8 +288,8 @@ { | ||
| Request: class extends Request { | ||
| constructor(input, init) { | ||
| super(input, addDuplexToInit(init)); | ||
| constructor(input, init2) { | ||
| super(input, addDuplexToInit(init2)); | ||
| } | ||
| }, | ||
| Uint8Array, | ||
| FetchEvent | ||
| FetchEvent: Edge.FetchEvent | ||
| }, | ||
@@ -749,4 +737,5 @@ { defaultOrigin: "https://vercel.com" } | ||
| const body = await serializeBody(request); | ||
| if (body !== void 0) | ||
| if (body !== void 0 && body.length) { | ||
| request.headers["content-length"] = String(body.length); | ||
| } | ||
| const url = new URL(request.url ?? "/", server.url); | ||
@@ -1081,5 +1070,8 @@ const response = await undiciRequest(url, { | ||
| // src/dev-server.mts | ||
| import { init, parse as parseEsm } from "es-module-lexer"; | ||
| import { parse as parseCjs } from "cjs-module-lexer"; | ||
| import { getConfig } from "@vercel/static-config"; | ||
| import { Project } from "ts-morph"; | ||
| import { listen as listen2 } from "async-listen"; | ||
| import { readFile } from "fs/promises"; | ||
| var entrypoint = process.env.VERCEL_DEV_ENTRYPOINT; | ||
@@ -1104,7 +1096,20 @@ delete process.env.VERCEL_DEV_ENTRYPOINT; | ||
| } | ||
| const content = await readFile(entrypointPath, "utf8"); | ||
| const isStreaming = staticConfig?.supportsResponseStreaming || await hasWebHandlers(async () => parseCjs(content).exports) || await hasWebHandlers( | ||
| async () => init.then(() => parseEsm(content)[1].map((specifier) => specifier.n)) | ||
| ); | ||
| return createServerlessEventHandler(entrypointPath, { | ||
| mode: staticConfig?.supportsResponseStreaming ? "streaming" : "buffer", | ||
| mode: isStreaming ? "streaming" : "buffer", | ||
| shouldAddHelpers: options.shouldAddHelpers | ||
| }); | ||
| } | ||
| async function hasWebHandlers(getExports) { | ||
| const exports = await getExports().catch(() => []); | ||
| for (const name of exports) { | ||
| if (HTTP_METHODS.includes(name)) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
| var handleEvent; | ||
@@ -1111,0 +1116,0 @@ var handlerEventError; |
+8
-6
| { | ||
| "name": "@vercel/node", | ||
| "version": "3.0.18", | ||
| "version": "3.0.19", | ||
| "license": "Apache-2.0", | ||
@@ -16,7 +16,7 @@ "main": "./dist/index", | ||
| "dependencies": { | ||
| "@edge-runtime/node-utils": "2.2.1", | ||
| "@edge-runtime/primitives": "4.0.5", | ||
| "@edge-runtime/vm": "3.1.7", | ||
| "@edge-runtime/node-utils": "2.3.0", | ||
| "@edge-runtime/primitives": "4.1.0", | ||
| "@edge-runtime/vm": "3.2.0", | ||
| "@types/node": "14.18.33", | ||
| "@vercel/build-utils": "7.6.0", | ||
| "@vercel/build-utils": "7.7.0", | ||
| "@vercel/error-utils": "2.0.2", | ||
@@ -26,3 +26,5 @@ "@vercel/nft": "0.26.3", | ||
| "async-listen": "3.0.0", | ||
| "edge-runtime": "2.5.7", | ||
| "cjs-module-lexer": "1.2.3", | ||
| "edge-runtime": "2.5.9", | ||
| "es-module-lexer": "1.4.1", | ||
| "esbuild": "0.14.47", | ||
@@ -29,0 +31,0 @@ "etag": "1.8.1", |
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 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
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance 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
3811410
0.01%106558
020
11.11%20
5.26%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated