@vercel/node 2.15.0 → 2.15.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.
@@ -91,15 +91,12 @@ async function createEdgeRuntimeServer(params) {
91
91
  }
92
92
  const wasmBindings = await params.wasmAssets.getContext();
93
93
  const nodeCompatBindings = params.nodeCompatBindings.getContext();
94
- // @ts-ignore
95
- const WebSocket = (await import('ws')).WebSocket;
96
94
  const runtime = new EdgeRuntime({
97
95
  initialCode: params.userCode,
98
96
  extend: context => {
99
97
  Object.assign(context, {
100
98
  // This is required for esbuild wrapping logic to resolve
101
99
  module: {},
102
- WebSocket,
103
100
  // This is required for environment variable access.
104
101
  // In production, env var access is provided by static analysis
105
102
  // so that only the used values are available.
@@ -1,18 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addHelpers = void 0;
3
+ exports.addHelpers = exports.getBodyParser = void 0;
4
4
  const utils_1 = require("../utils");
5
5
  const stream_1 = require("stream");
6
+ const content_type_1 = require("content-type");
7
+ const querystring_1 = require("querystring");
6
8
  class ApiError extends Error {
7
9
  constructor(statusCode, message) {
8
10
  super(message);
9
11
  this.statusCode = statusCode;
10
12
  }
11
13
  }
14
+ function normalizeContentType(contentType) {
15
+ if (!contentType) {
16
+ return 'text/plain';
17
+ }
18
+ const { type } = (0, content_type_1.parse)(contentType);
19
+ return type;
20
+ }
12
21
  function getBodyParser(body, contentType) {
13
22
  return function parseBody() {
14
- const { parse: parseContentType } = require('content-type');
15
- const { type } = parseContentType(contentType);
23
+ const type = normalizeContentType(contentType);
16
24
  if (type === 'application/json') {
17
25
  try {
18
26
  const str = body.toString();
@@ -25,16 +33,16 @@ function getBodyParser(body, contentType) {
25
33
  if (type === 'application/octet-stream')
26
34
  return body;
27
35
  if (type === 'application/x-www-form-urlencoded') {
28
- const { parse: parseQS } = require('querystring');
29
36
  // note: querystring.parse does not produce an iterable object
30
37
  // https://nodejs.org/api/querystring.html#querystring_querystring_parse_str_sep_eq_options
31
- return parseQS(body.toString());
38
+ return (0, querystring_1.parse)(body.toString());
32
39
  }
33
40
  if (type === 'text/plain')
34
41
  return body.toString();
35
42
  return undefined;
36
43
  };
37
44
  }
45
+ exports.getBodyParser = getBodyParser;
38
46
  function getQueryParser({ url = '/' }) {
39
47
  return function parseQuery() {
40
48
  const { parse: parseURL } = require('url');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/node",
3
- "version": "2.15.0",
3
+ "version": "2.15.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
@@ -15,22 +15,21 @@
15
15
  "dependencies": {
16
16
  "@edge-runtime/node-utils": "2.0.3",
17
17
  "@edge-runtime/primitives": "2.1.2",
18
- "@edge-runtime/vm": "2.0.0",
18
+ "@edge-runtime/vm": "3.0.1",
19
19
  "@types/node": "14.18.33",
20
20
  "@types/node-fetch": "2.6.3",
21
21
  "@vercel/build-utils": "6.7.5",
22
22
  "@vercel/error-utils": "1.0.10",
23
23
  "@vercel/static-config": "2.0.17",
24
24
  "async-listen": "3.0.0",
25
- "edge-runtime": "2.1.4",
25
+ "edge-runtime": "2.4.3",
26
26
  "esbuild": "0.14.47",
27
27
  "exit-hook": "2.2.1",
28
28
  "node-fetch": "2.6.9",
29
29
  "path-to-regexp": "6.2.1",
30
30
  "ts-morph": "12.0.0",
31
31
  "ts-node": "10.9.1",
32
- "typescript": "4.9.5",
33
- "ws": "8.13.0"
32
+ "typescript": "4.9.5"
34
33
  },
35
34
  "devDependencies": {
36
35
  "@babel/core": "7.5.0",