@vercel/node 3.2.29 → 4.0.0

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.
Files changed (2) hide show
  1. package/dist/dev-server.mjs +92 -28
  2. package/package.json +4 -4
@@ -135,78 +135,114 @@ var require_content_type = __commonJS({
135
135
  }
136
136
  });
137
137
 
138
- // ../../node_modules/.pnpm/cookie@0.4.0/node_modules/cookie/index.js
138
+ // ../../node_modules/.pnpm/cookie@0.7.0/node_modules/cookie/index.js
139
139
  var require_cookie = __commonJS({
140
- "../../node_modules/.pnpm/cookie@0.4.0/node_modules/cookie/index.js"(exports) {
140
+ "../../node_modules/.pnpm/cookie@0.7.0/node_modules/cookie/index.js"(exports) {
141
141
  "use strict";
142
142
  exports.parse = parse;
143
143
  exports.serialize = serialize;
144
- var decode = decodeURIComponent;
145
- var encode = encodeURIComponent;
146
- var pairSplitRegExp = /; */;
147
- var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
144
+ var __toString = Object.prototype.toString;
145
+ var cookieNameRegExp = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
146
+ var cookieValueRegExp = /^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/;
147
+ var domainValueRegExp = /^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
148
+ var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
148
149
  function parse(str, options) {
149
150
  if (typeof str !== "string") {
150
151
  throw new TypeError("argument str must be a string");
151
152
  }
152
153
  var obj = {};
153
- var opt = options || {};
154
- var pairs = str.split(pairSplitRegExp);
155
- var dec = opt.decode || decode;
156
- for (var i = 0; i < pairs.length; i++) {
157
- var pair = pairs[i];
158
- var eq_idx = pair.indexOf("=");
159
- if (eq_idx < 0) {
160
- continue;
154
+ var len = str.length;
155
+ var max = len - 2;
156
+ if (max < 0)
157
+ return obj;
158
+ var dec = options && options.decode || decode;
159
+ var index = 0;
160
+ var eqIdx = 0;
161
+ var endIdx = 0;
162
+ do {
163
+ eqIdx = str.indexOf("=", index);
164
+ if (eqIdx === -1) {
165
+ break;
161
166
  }
162
- var key = pair.substr(0, eq_idx).trim();
163
- var val = pair.substr(++eq_idx, pair.length).trim();
164
- if ('"' == val[0]) {
165
- val = val.slice(1, -1);
167
+ endIdx = str.indexOf(";", index);
168
+ if (endIdx === -1) {
169
+ endIdx = len;
170
+ } else if (eqIdx > endIdx) {
171
+ index = str.lastIndexOf(";", eqIdx - 1) + 1;
172
+ continue;
166
173
  }
167
- if (void 0 == obj[key]) {
174
+ var keyStartIdx = startIndex(str, index, eqIdx);
175
+ var keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
176
+ var key = str.slice(keyStartIdx, keyEndIdx);
177
+ if (void 0 === obj[key]) {
178
+ var valStartIdx = startIndex(str, eqIdx + 1, endIdx);
179
+ var valEndIdx = endIndex(str, endIdx, valStartIdx);
180
+ if (str.charCodeAt(valStartIdx) === 34 && str.charCodeAt(valEndIdx - 1) === 34) {
181
+ valStartIdx++;
182
+ valEndIdx--;
183
+ }
184
+ var val = str.slice(valStartIdx, valEndIdx);
168
185
  obj[key] = tryDecode(val, dec);
169
186
  }
170
- }
187
+ index = endIdx + 1;
188
+ } while (index < max);
171
189
  return obj;
172
190
  }
191
+ function startIndex(str, index, max) {
192
+ do {
193
+ var code = str.charCodeAt(index);
194
+ if (code !== 32 && code !== 9)
195
+ return index;
196
+ } while (++index < max);
197
+ return max;
198
+ }
199
+ function endIndex(str, index, min) {
200
+ while (index > min) {
201
+ var code = str.charCodeAt(--index);
202
+ if (code !== 32 && code !== 9)
203
+ return index + 1;
204
+ }
205
+ return min;
206
+ }
173
207
  function serialize(name, val, options) {
174
208
  var opt = options || {};
175
209
  var enc = opt.encode || encode;
176
210
  if (typeof enc !== "function") {
177
211
  throw new TypeError("option encode is invalid");
178
212
  }
179
- if (!fieldContentRegExp.test(name)) {
213
+ if (!cookieNameRegExp.test(name)) {
180
214
  throw new TypeError("argument name is invalid");
181
215
  }
182
216
  var value = enc(val);
183
- if (value && !fieldContentRegExp.test(value)) {
217
+ if (value && !cookieValueRegExp.test(value)) {
184
218
  throw new TypeError("argument val is invalid");
185
219
  }
186
220
  var str = name + "=" + value;
187
221
  if (null != opt.maxAge) {
188
222
  var maxAge = opt.maxAge - 0;
189
- if (isNaN(maxAge))
190
- throw new Error("maxAge should be a Number");
223
+ if (!isFinite(maxAge)) {
224
+ throw new TypeError("option maxAge is invalid");
225
+ }
191
226
  str += "; Max-Age=" + Math.floor(maxAge);
192
227
  }
193
228
  if (opt.domain) {
194
- if (!fieldContentRegExp.test(opt.domain)) {
229
+ if (!domainValueRegExp.test(opt.domain)) {
195
230
  throw new TypeError("option domain is invalid");
196
231
  }
197
232
  str += "; Domain=" + opt.domain;
198
233
  }
199
234
  if (opt.path) {
200
- if (!fieldContentRegExp.test(opt.path)) {
235
+ if (!pathValueRegExp.test(opt.path)) {
201
236
  throw new TypeError("option path is invalid");
202
237
  }
203
238
  str += "; Path=" + opt.path;
204
239
  }
205
240
  if (opt.expires) {
206
- if (typeof opt.expires.toUTCString !== "function") {
241
+ var expires = opt.expires;
242
+ if (!isDate(expires) || isNaN(expires.valueOf())) {
207
243
  throw new TypeError("option expires is invalid");
208
244
  }
209
- str += "; Expires=" + opt.expires.toUTCString();
245
+ str += "; Expires=" + expires.toUTCString();
210
246
  }
211
247
  if (opt.httpOnly) {
212
248
  str += "; HttpOnly";
@@ -214,6 +250,25 @@ var require_cookie = __commonJS({
214
250
  if (opt.secure) {
215
251
  str += "; Secure";
216
252
  }
253
+ if (opt.partitioned) {
254
+ str += "; Partitioned";
255
+ }
256
+ if (opt.priority) {
257
+ var priority = typeof opt.priority === "string" ? opt.priority.toLowerCase() : opt.priority;
258
+ switch (priority) {
259
+ case "low":
260
+ str += "; Priority=Low";
261
+ break;
262
+ case "medium":
263
+ str += "; Priority=Medium";
264
+ break;
265
+ case "high":
266
+ str += "; Priority=High";
267
+ break;
268
+ default:
269
+ throw new TypeError("option priority is invalid");
270
+ }
271
+ }
217
272
  if (opt.sameSite) {
218
273
  var sameSite = typeof opt.sameSite === "string" ? opt.sameSite.toLowerCase() : opt.sameSite;
219
274
  switch (sameSite) {
@@ -235,6 +290,15 @@ var require_cookie = __commonJS({
235
290
  }
236
291
  return str;
237
292
  }
293
+ function decode(str) {
294
+ return str.indexOf("%") !== -1 ? decodeURIComponent(str) : str;
295
+ }
296
+ function encode(val) {
297
+ return encodeURIComponent(val);
298
+ }
299
+ function isDate(val) {
300
+ return __toString.call(val) === "[object Date]" || val instanceof Date;
301
+ }
238
302
  function tryDecode(str, decode2) {
239
303
  try {
240
304
  return decode2(str);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/node",
3
- "version": "3.2.29",
3
+ "version": "4.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
@@ -17,7 +17,7 @@
17
17
  "@edge-runtime/primitives": "4.1.0",
18
18
  "@edge-runtime/vm": "3.2.0",
19
19
  "@types/node": "16.18.11",
20
- "@vercel/build-utils": "8.7.0",
20
+ "@vercel/build-utils": "8.8.0",
21
21
  "@vercel/error-utils": "2.0.3",
22
22
  "@vercel/nft": "0.27.3",
23
23
  "@vercel/static-config": "3.0.0",
@@ -28,7 +28,7 @@
28
28
  "esbuild": "0.14.47",
29
29
  "etag": "1.8.1",
30
30
  "node-fetch": "2.6.9",
31
- "path-to-regexp": "6.2.1",
31
+ "path-to-regexp": "6.3.0",
32
32
  "ts-morph": "12.0.0",
33
33
  "ts-node": "10.9.1",
34
34
  "typescript": "4.9.5",
@@ -45,7 +45,7 @@
45
45
  "@types/jest": "29.5.0",
46
46
  "@vitest/expect": "1.4.0",
47
47
  "content-type": "1.0.5",
48
- "cookie": "0.4.0",
48
+ "cookie": "0.7.0",
49
49
  "cross-env": "7.0.3",
50
50
  "execa": "3.2.0",
51
51
  "fs-extra": "11.1.0",