@vercel/node 2.14.0 → 2.14.2

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.
@@ -10,8 +10,7 @@ import { createServerlessEventHandler } from './serverless-functions/serverless-
10
10
  import { isEdgeRuntime, logError, validateConfiguredRuntime } from './utils.js';
11
11
  import { getConfig } from '@vercel/static-config';
12
12
  import { Project } from 'ts-morph';
13
- import asyncListen from 'async-listen';
14
- const { default: listen } = asyncListen;
13
+ import { listen } from 'async-listen';
15
14
  const parseConfig = (entryPointPath) => getConfig(new Project(), entryPointPath);
16
15
  async function createEventHandler(entrypoint, config, options) {
17
16
  const entrypointPath = join(process.cwd(), entrypoint);
@@ -72,8 +71,10 @@ async function onDevRequest(req, res) {
72
71
  const { headers, body, status } = await handleEvent(req);
73
72
  res.statusCode = status;
74
73
  for (const [key, value] of headers) {
74
+ // node-fetch does not support headers.getSetCookie(), so we need to
75
+ // manually set the raw value which can be an array of strings
75
76
  if (value !== undefined) {
76
- res.setHeader(key, value);
77
+ res.setHeader(key, key === 'set-cookie' ? headers.raw()[key] : value);
77
78
  }
78
79
  }
79
80
  if (body instanceof Buffer) {
@@ -96,16 +96,8 @@ async function createEdgeRuntimeServer(params) {
96
96
  }
97
97
  const wasmBindings = await params.wasmAssets.getContext();
98
98
  const nodeCompatBindings = params.nodeCompatBindings.getContext();
99
- let WebSocket;
100
- // undici's WebSocket handling is only available in Node.js >= 18
101
- // so fallback to using ws for v16
102
- if (Number(process.version.split('.')[0].substring(1)) < 18) {
103
- // @ts-ignore
104
- WebSocket = (await import('ws')).WebSocket;
105
- }
106
- else {
107
- WebSocket = (await import('undici')).WebSocket;
108
- }
99
+ // @ts-ignore
100
+ const WebSocket = (await import('ws')).WebSocket;
109
101
  const runtime = new EdgeRuntime({
110
102
  initialCode: params.userCode,
111
103
  extend: context => {
@@ -4,10 +4,9 @@ import { serializeBody } from '../utils.js';
4
4
  import { streamToBuffer } from '@vercel/build-utils';
5
5
  import exitHook from 'exit-hook';
6
6
  import fetch from 'node-fetch';
7
- import asyncListen from 'async-listen';
7
+ import { listen } from 'async-listen';
8
8
  import { isAbsolute } from 'path';
9
9
  import { pathToFileURL } from 'url';
10
- const { default: listen } = asyncListen;
11
10
  async function createServerlessServer(userCode, options) {
12
11
  const server = createServer(async (req, res) => {
13
12
  if (options.shouldAddHelpers)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/node",
3
- "version": "2.14.0",
3
+ "version": "2.14.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
@@ -25,7 +25,7 @@
25
25
  "@vercel/build-utils": "6.7.2",
26
26
  "@vercel/error-utils": "1.0.8",
27
27
  "@vercel/static-config": "2.0.17",
28
- "async-listen": "1.2.0",
28
+ "async-listen": "3.0.0",
29
29
  "edge-runtime": "2.1.4",
30
30
  "esbuild": "0.14.47",
31
31
  "exit-hook": "2.2.1",
@@ -34,7 +34,6 @@
34
34
  "ts-morph": "12.0.0",
35
35
  "ts-node": "10.9.1",
36
36
  "typescript": "4.9.5",
37
- "undici": "5.22.0",
38
37
  "ws": "8.13.0"
39
38
  },
40
39
  "devDependencies": {
@@ -58,5 +57,5 @@
58
57
  "source-map-support": "0.5.12",
59
58
  "test-listen": "1.1.0"
60
59
  },
61
- "gitHead": "b5db13c97035d0eae04a5e075ae74e488d1298d6"
60
+ "gitHead": "d1d3e9384d139a06acca521348f8f9209bb3d214"
62
61
  }