@vercel/node 5.1.1 → 5.1.3
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.
- package/dist/dev-server.mjs +2 -821
- package/dist/index.js +52 -826
- package/package.json +4 -3
package/dist/index.js
CHANGED
@@ -33,826 +33,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
33
33
|
));
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
35
35
|
|
36
|
-
// ../../node_modules/.pnpm/path-to-regexp@6.1.0/node_modules/path-to-regexp/dist/index.js
|
37
|
-
var require_dist = __commonJS({
|
38
|
-
"../../node_modules/.pnpm/path-to-regexp@6.1.0/node_modules/path-to-regexp/dist/index.js"(exports) {
|
39
|
-
"use strict";
|
40
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
41
|
-
function lexer(str) {
|
42
|
-
var tokens = [];
|
43
|
-
var i = 0;
|
44
|
-
while (i < str.length) {
|
45
|
-
var char = str[i];
|
46
|
-
if (char === "*" || char === "+" || char === "?") {
|
47
|
-
tokens.push({ type: "MODIFIER", index: i, value: str[i++] });
|
48
|
-
continue;
|
49
|
-
}
|
50
|
-
if (char === "\\") {
|
51
|
-
tokens.push({ type: "ESCAPED_CHAR", index: i++, value: str[i++] });
|
52
|
-
continue;
|
53
|
-
}
|
54
|
-
if (char === "{") {
|
55
|
-
tokens.push({ type: "OPEN", index: i, value: str[i++] });
|
56
|
-
continue;
|
57
|
-
}
|
58
|
-
if (char === "}") {
|
59
|
-
tokens.push({ type: "CLOSE", index: i, value: str[i++] });
|
60
|
-
continue;
|
61
|
-
}
|
62
|
-
if (char === ":") {
|
63
|
-
var name = "";
|
64
|
-
var j = i + 1;
|
65
|
-
while (j < str.length) {
|
66
|
-
var code = str.charCodeAt(j);
|
67
|
-
if (
|
68
|
-
// `0-9`
|
69
|
-
code >= 48 && code <= 57 || // `A-Z`
|
70
|
-
code >= 65 && code <= 90 || // `a-z`
|
71
|
-
code >= 97 && code <= 122 || // `_`
|
72
|
-
code === 95
|
73
|
-
) {
|
74
|
-
name += str[j++];
|
75
|
-
continue;
|
76
|
-
}
|
77
|
-
break;
|
78
|
-
}
|
79
|
-
if (!name)
|
80
|
-
throw new TypeError("Missing parameter name at " + i);
|
81
|
-
tokens.push({ type: "NAME", index: i, value: name });
|
82
|
-
i = j;
|
83
|
-
continue;
|
84
|
-
}
|
85
|
-
if (char === "(") {
|
86
|
-
var count = 1;
|
87
|
-
var pattern = "";
|
88
|
-
var j = i + 1;
|
89
|
-
if (str[j] === "?") {
|
90
|
-
throw new TypeError('Pattern cannot start with "?" at ' + j);
|
91
|
-
}
|
92
|
-
while (j < str.length) {
|
93
|
-
if (str[j] === "\\") {
|
94
|
-
pattern += str[j++] + str[j++];
|
95
|
-
continue;
|
96
|
-
}
|
97
|
-
if (str[j] === ")") {
|
98
|
-
count--;
|
99
|
-
if (count === 0) {
|
100
|
-
j++;
|
101
|
-
break;
|
102
|
-
}
|
103
|
-
} else if (str[j] === "(") {
|
104
|
-
count++;
|
105
|
-
if (str[j + 1] !== "?") {
|
106
|
-
throw new TypeError("Capturing groups are not allowed at " + j);
|
107
|
-
}
|
108
|
-
}
|
109
|
-
pattern += str[j++];
|
110
|
-
}
|
111
|
-
if (count)
|
112
|
-
throw new TypeError("Unbalanced pattern at " + i);
|
113
|
-
if (!pattern)
|
114
|
-
throw new TypeError("Missing pattern at " + i);
|
115
|
-
tokens.push({ type: "PATTERN", index: i, value: pattern });
|
116
|
-
i = j;
|
117
|
-
continue;
|
118
|
-
}
|
119
|
-
tokens.push({ type: "CHAR", index: i, value: str[i++] });
|
120
|
-
}
|
121
|
-
tokens.push({ type: "END", index: i, value: "" });
|
122
|
-
return tokens;
|
123
|
-
}
|
124
|
-
function parse(str, options) {
|
125
|
-
if (options === void 0) {
|
126
|
-
options = {};
|
127
|
-
}
|
128
|
-
var tokens = lexer(str);
|
129
|
-
var _a = options.prefixes, prefixes = _a === void 0 ? "./" : _a;
|
130
|
-
var defaultPattern = "[^" + escapeString(options.delimiter || "/#?") + "]+?";
|
131
|
-
var result = [];
|
132
|
-
var key = 0;
|
133
|
-
var i = 0;
|
134
|
-
var path = "";
|
135
|
-
var tryConsume = function(type) {
|
136
|
-
if (i < tokens.length && tokens[i].type === type)
|
137
|
-
return tokens[i++].value;
|
138
|
-
};
|
139
|
-
var mustConsume = function(type) {
|
140
|
-
var value3 = tryConsume(type);
|
141
|
-
if (value3 !== void 0)
|
142
|
-
return value3;
|
143
|
-
var _a2 = tokens[i], nextType = _a2.type, index = _a2.index;
|
144
|
-
throw new TypeError("Unexpected " + nextType + " at " + index + ", expected " + type);
|
145
|
-
};
|
146
|
-
var consumeText = function() {
|
147
|
-
var result2 = "";
|
148
|
-
var value3;
|
149
|
-
while (value3 = tryConsume("CHAR") || tryConsume("ESCAPED_CHAR")) {
|
150
|
-
result2 += value3;
|
151
|
-
}
|
152
|
-
return result2;
|
153
|
-
};
|
154
|
-
while (i < tokens.length) {
|
155
|
-
var char = tryConsume("CHAR");
|
156
|
-
var name = tryConsume("NAME");
|
157
|
-
var pattern = tryConsume("PATTERN");
|
158
|
-
if (name || pattern) {
|
159
|
-
var prefix = char || "";
|
160
|
-
if (prefixes.indexOf(prefix) === -1) {
|
161
|
-
path += prefix;
|
162
|
-
prefix = "";
|
163
|
-
}
|
164
|
-
if (path) {
|
165
|
-
result.push(path);
|
166
|
-
path = "";
|
167
|
-
}
|
168
|
-
result.push({
|
169
|
-
name: name || key++,
|
170
|
-
prefix,
|
171
|
-
suffix: "",
|
172
|
-
pattern: pattern || defaultPattern,
|
173
|
-
modifier: tryConsume("MODIFIER") || ""
|
174
|
-
});
|
175
|
-
continue;
|
176
|
-
}
|
177
|
-
var value2 = char || tryConsume("ESCAPED_CHAR");
|
178
|
-
if (value2) {
|
179
|
-
path += value2;
|
180
|
-
continue;
|
181
|
-
}
|
182
|
-
if (path) {
|
183
|
-
result.push(path);
|
184
|
-
path = "";
|
185
|
-
}
|
186
|
-
var open = tryConsume("OPEN");
|
187
|
-
if (open) {
|
188
|
-
var prefix = consumeText();
|
189
|
-
var name_1 = tryConsume("NAME") || "";
|
190
|
-
var pattern_1 = tryConsume("PATTERN") || "";
|
191
|
-
var suffix = consumeText();
|
192
|
-
mustConsume("CLOSE");
|
193
|
-
result.push({
|
194
|
-
name: name_1 || (pattern_1 ? key++ : ""),
|
195
|
-
pattern: name_1 && !pattern_1 ? defaultPattern : pattern_1,
|
196
|
-
prefix,
|
197
|
-
suffix,
|
198
|
-
modifier: tryConsume("MODIFIER") || ""
|
199
|
-
});
|
200
|
-
continue;
|
201
|
-
}
|
202
|
-
mustConsume("END");
|
203
|
-
}
|
204
|
-
return result;
|
205
|
-
}
|
206
|
-
exports.parse = parse;
|
207
|
-
function compile3(str, options) {
|
208
|
-
return tokensToFunction(parse(str, options), options);
|
209
|
-
}
|
210
|
-
exports.compile = compile3;
|
211
|
-
function tokensToFunction(tokens, options) {
|
212
|
-
if (options === void 0) {
|
213
|
-
options = {};
|
214
|
-
}
|
215
|
-
var reFlags = flags(options);
|
216
|
-
var _a = options.encode, encode = _a === void 0 ? function(x) {
|
217
|
-
return x;
|
218
|
-
} : _a, _b = options.validate, validate = _b === void 0 ? true : _b;
|
219
|
-
var matches = tokens.map(function(token) {
|
220
|
-
if (typeof token === "object") {
|
221
|
-
return new RegExp("^(?:" + token.pattern + ")$", reFlags);
|
222
|
-
}
|
223
|
-
});
|
224
|
-
return function(data) {
|
225
|
-
var path = "";
|
226
|
-
for (var i = 0; i < tokens.length; i++) {
|
227
|
-
var token = tokens[i];
|
228
|
-
if (typeof token === "string") {
|
229
|
-
path += token;
|
230
|
-
continue;
|
231
|
-
}
|
232
|
-
var value2 = data ? data[token.name] : void 0;
|
233
|
-
var optional = token.modifier === "?" || token.modifier === "*";
|
234
|
-
var repeat = token.modifier === "*" || token.modifier === "+";
|
235
|
-
if (Array.isArray(value2)) {
|
236
|
-
if (!repeat) {
|
237
|
-
throw new TypeError('Expected "' + token.name + '" to not repeat, but got an array');
|
238
|
-
}
|
239
|
-
if (value2.length === 0) {
|
240
|
-
if (optional)
|
241
|
-
continue;
|
242
|
-
throw new TypeError('Expected "' + token.name + '" to not be empty');
|
243
|
-
}
|
244
|
-
for (var j = 0; j < value2.length; j++) {
|
245
|
-
var segment = encode(value2[j], token);
|
246
|
-
if (validate && !matches[i].test(segment)) {
|
247
|
-
throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but got "' + segment + '"');
|
248
|
-
}
|
249
|
-
path += token.prefix + segment + token.suffix;
|
250
|
-
}
|
251
|
-
continue;
|
252
|
-
}
|
253
|
-
if (typeof value2 === "string" || typeof value2 === "number") {
|
254
|
-
var segment = encode(String(value2), token);
|
255
|
-
if (validate && !matches[i].test(segment)) {
|
256
|
-
throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but got "' + segment + '"');
|
257
|
-
}
|
258
|
-
path += token.prefix + segment + token.suffix;
|
259
|
-
continue;
|
260
|
-
}
|
261
|
-
if (optional)
|
262
|
-
continue;
|
263
|
-
var typeOfMessage = repeat ? "an array" : "a string";
|
264
|
-
throw new TypeError('Expected "' + token.name + '" to be ' + typeOfMessage);
|
265
|
-
}
|
266
|
-
return path;
|
267
|
-
};
|
268
|
-
}
|
269
|
-
exports.tokensToFunction = tokensToFunction;
|
270
|
-
function match(str, options) {
|
271
|
-
var keys = [];
|
272
|
-
var re = pathToRegexp2(str, keys, options);
|
273
|
-
return regexpToFunction(re, keys, options);
|
274
|
-
}
|
275
|
-
exports.match = match;
|
276
|
-
function regexpToFunction(re, keys, options) {
|
277
|
-
if (options === void 0) {
|
278
|
-
options = {};
|
279
|
-
}
|
280
|
-
var _a = options.decode, decode = _a === void 0 ? function(x) {
|
281
|
-
return x;
|
282
|
-
} : _a;
|
283
|
-
return function(pathname) {
|
284
|
-
var m = re.exec(pathname);
|
285
|
-
if (!m)
|
286
|
-
return false;
|
287
|
-
var path = m[0], index = m.index;
|
288
|
-
var params = /* @__PURE__ */ Object.create(null);
|
289
|
-
var _loop_1 = function(i2) {
|
290
|
-
if (m[i2] === void 0)
|
291
|
-
return "continue";
|
292
|
-
var key = keys[i2 - 1];
|
293
|
-
if (key.modifier === "*" || key.modifier === "+") {
|
294
|
-
params[key.name] = m[i2].split(key.prefix + key.suffix).map(function(value2) {
|
295
|
-
return decode(value2, key);
|
296
|
-
});
|
297
|
-
} else {
|
298
|
-
params[key.name] = decode(m[i2], key);
|
299
|
-
}
|
300
|
-
};
|
301
|
-
for (var i = 1; i < m.length; i++) {
|
302
|
-
_loop_1(i);
|
303
|
-
}
|
304
|
-
return { path, index, params };
|
305
|
-
};
|
306
|
-
}
|
307
|
-
exports.regexpToFunction = regexpToFunction;
|
308
|
-
function escapeString(str) {
|
309
|
-
return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
|
310
|
-
}
|
311
|
-
function flags(options) {
|
312
|
-
return options && options.sensitive ? "" : "i";
|
313
|
-
}
|
314
|
-
function regexpToRegexp(path, keys) {
|
315
|
-
if (!keys)
|
316
|
-
return path;
|
317
|
-
var groups = path.source.match(/\((?!\?)/g);
|
318
|
-
if (groups) {
|
319
|
-
for (var i = 0; i < groups.length; i++) {
|
320
|
-
keys.push({
|
321
|
-
name: i,
|
322
|
-
prefix: "",
|
323
|
-
suffix: "",
|
324
|
-
modifier: "",
|
325
|
-
pattern: ""
|
326
|
-
});
|
327
|
-
}
|
328
|
-
}
|
329
|
-
return path;
|
330
|
-
}
|
331
|
-
function arrayToRegexp(paths, keys, options) {
|
332
|
-
var parts = paths.map(function(path) {
|
333
|
-
return pathToRegexp2(path, keys, options).source;
|
334
|
-
});
|
335
|
-
return new RegExp("(?:" + parts.join("|") + ")", flags(options));
|
336
|
-
}
|
337
|
-
function stringToRegexp(path, keys, options) {
|
338
|
-
return tokensToRegexp(parse(path, options), keys, options);
|
339
|
-
}
|
340
|
-
function tokensToRegexp(tokens, keys, options) {
|
341
|
-
if (options === void 0) {
|
342
|
-
options = {};
|
343
|
-
}
|
344
|
-
var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function(x) {
|
345
|
-
return x;
|
346
|
-
} : _d;
|
347
|
-
var endsWith = "[" + escapeString(options.endsWith || "") + "]|$";
|
348
|
-
var delimiter = "[" + escapeString(options.delimiter || "/#?") + "]";
|
349
|
-
var route = start ? "^" : "";
|
350
|
-
for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {
|
351
|
-
var token = tokens_1[_i];
|
352
|
-
if (typeof token === "string") {
|
353
|
-
route += escapeString(encode(token));
|
354
|
-
} else {
|
355
|
-
var prefix = escapeString(encode(token.prefix));
|
356
|
-
var suffix = escapeString(encode(token.suffix));
|
357
|
-
if (token.pattern) {
|
358
|
-
if (keys)
|
359
|
-
keys.push(token);
|
360
|
-
if (prefix || suffix) {
|
361
|
-
if (token.modifier === "+" || token.modifier === "*") {
|
362
|
-
var mod = token.modifier === "*" ? "?" : "";
|
363
|
-
route += "(?:" + prefix + "((?:" + token.pattern + ")(?:" + suffix + prefix + "(?:" + token.pattern + "))*)" + suffix + ")" + mod;
|
364
|
-
} else {
|
365
|
-
route += "(?:" + prefix + "(" + token.pattern + ")" + suffix + ")" + token.modifier;
|
366
|
-
}
|
367
|
-
} else {
|
368
|
-
route += "(" + token.pattern + ")" + token.modifier;
|
369
|
-
}
|
370
|
-
} else {
|
371
|
-
route += "(?:" + prefix + suffix + ")" + token.modifier;
|
372
|
-
}
|
373
|
-
}
|
374
|
-
}
|
375
|
-
if (end) {
|
376
|
-
if (!strict)
|
377
|
-
route += delimiter + "?";
|
378
|
-
route += !options.endsWith ? "$" : "(?=" + endsWith + ")";
|
379
|
-
} else {
|
380
|
-
var endToken = tokens[tokens.length - 1];
|
381
|
-
var isEndDelimited = typeof endToken === "string" ? delimiter.indexOf(endToken[endToken.length - 1]) > -1 : (
|
382
|
-
// tslint:disable-next-line
|
383
|
-
endToken === void 0
|
384
|
-
);
|
385
|
-
if (!strict) {
|
386
|
-
route += "(?:" + delimiter + "(?=" + endsWith + "))?";
|
387
|
-
}
|
388
|
-
if (!isEndDelimited) {
|
389
|
-
route += "(?=" + delimiter + "|" + endsWith + ")";
|
390
|
-
}
|
391
|
-
}
|
392
|
-
return new RegExp(route, flags(options));
|
393
|
-
}
|
394
|
-
exports.tokensToRegexp = tokensToRegexp;
|
395
|
-
function pathToRegexp2(path, keys, options) {
|
396
|
-
if (path instanceof RegExp)
|
397
|
-
return regexpToRegexp(path, keys);
|
398
|
-
if (Array.isArray(path))
|
399
|
-
return arrayToRegexp(path, keys, options);
|
400
|
-
return stringToRegexp(path, keys, options);
|
401
|
-
}
|
402
|
-
exports.pathToRegexp = pathToRegexp2;
|
403
|
-
}
|
404
|
-
});
|
405
|
-
|
406
|
-
// ../../node_modules/.pnpm/path-to-regexp@6.3.0/node_modules/path-to-regexp/dist/index.js
|
407
|
-
var require_dist2 = __commonJS({
|
408
|
-
"../../node_modules/.pnpm/path-to-regexp@6.3.0/node_modules/path-to-regexp/dist/index.js"(exports) {
|
409
|
-
"use strict";
|
410
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
411
|
-
exports.pathToRegexp = exports.tokensToRegexp = exports.regexpToFunction = exports.match = exports.tokensToFunction = exports.compile = exports.parse = void 0;
|
412
|
-
function lexer(str) {
|
413
|
-
var tokens = [];
|
414
|
-
var i = 0;
|
415
|
-
while (i < str.length) {
|
416
|
-
var char = str[i];
|
417
|
-
if (char === "*" || char === "+" || char === "?") {
|
418
|
-
tokens.push({ type: "MODIFIER", index: i, value: str[i++] });
|
419
|
-
continue;
|
420
|
-
}
|
421
|
-
if (char === "\\") {
|
422
|
-
tokens.push({ type: "ESCAPED_CHAR", index: i++, value: str[i++] });
|
423
|
-
continue;
|
424
|
-
}
|
425
|
-
if (char === "{") {
|
426
|
-
tokens.push({ type: "OPEN", index: i, value: str[i++] });
|
427
|
-
continue;
|
428
|
-
}
|
429
|
-
if (char === "}") {
|
430
|
-
tokens.push({ type: "CLOSE", index: i, value: str[i++] });
|
431
|
-
continue;
|
432
|
-
}
|
433
|
-
if (char === ":") {
|
434
|
-
var name = "";
|
435
|
-
var j = i + 1;
|
436
|
-
while (j < str.length) {
|
437
|
-
var code = str.charCodeAt(j);
|
438
|
-
if (
|
439
|
-
// `0-9`
|
440
|
-
code >= 48 && code <= 57 || // `A-Z`
|
441
|
-
code >= 65 && code <= 90 || // `a-z`
|
442
|
-
code >= 97 && code <= 122 || // `_`
|
443
|
-
code === 95
|
444
|
-
) {
|
445
|
-
name += str[j++];
|
446
|
-
continue;
|
447
|
-
}
|
448
|
-
break;
|
449
|
-
}
|
450
|
-
if (!name)
|
451
|
-
throw new TypeError("Missing parameter name at ".concat(i));
|
452
|
-
tokens.push({ type: "NAME", index: i, value: name });
|
453
|
-
i = j;
|
454
|
-
continue;
|
455
|
-
}
|
456
|
-
if (char === "(") {
|
457
|
-
var count = 1;
|
458
|
-
var pattern = "";
|
459
|
-
var j = i + 1;
|
460
|
-
if (str[j] === "?") {
|
461
|
-
throw new TypeError('Pattern cannot start with "?" at '.concat(j));
|
462
|
-
}
|
463
|
-
while (j < str.length) {
|
464
|
-
if (str[j] === "\\") {
|
465
|
-
pattern += str[j++] + str[j++];
|
466
|
-
continue;
|
467
|
-
}
|
468
|
-
if (str[j] === ")") {
|
469
|
-
count--;
|
470
|
-
if (count === 0) {
|
471
|
-
j++;
|
472
|
-
break;
|
473
|
-
}
|
474
|
-
} else if (str[j] === "(") {
|
475
|
-
count++;
|
476
|
-
if (str[j + 1] !== "?") {
|
477
|
-
throw new TypeError("Capturing groups are not allowed at ".concat(j));
|
478
|
-
}
|
479
|
-
}
|
480
|
-
pattern += str[j++];
|
481
|
-
}
|
482
|
-
if (count)
|
483
|
-
throw new TypeError("Unbalanced pattern at ".concat(i));
|
484
|
-
if (!pattern)
|
485
|
-
throw new TypeError("Missing pattern at ".concat(i));
|
486
|
-
tokens.push({ type: "PATTERN", index: i, value: pattern });
|
487
|
-
i = j;
|
488
|
-
continue;
|
489
|
-
}
|
490
|
-
tokens.push({ type: "CHAR", index: i, value: str[i++] });
|
491
|
-
}
|
492
|
-
tokens.push({ type: "END", index: i, value: "" });
|
493
|
-
return tokens;
|
494
|
-
}
|
495
|
-
function parse(str, options) {
|
496
|
-
if (options === void 0) {
|
497
|
-
options = {};
|
498
|
-
}
|
499
|
-
var tokens = lexer(str);
|
500
|
-
var _a = options.prefixes, prefixes = _a === void 0 ? "./" : _a, _b = options.delimiter, delimiter = _b === void 0 ? "/#?" : _b;
|
501
|
-
var result = [];
|
502
|
-
var key = 0;
|
503
|
-
var i = 0;
|
504
|
-
var path = "";
|
505
|
-
var tryConsume = function(type) {
|
506
|
-
if (i < tokens.length && tokens[i].type === type)
|
507
|
-
return tokens[i++].value;
|
508
|
-
};
|
509
|
-
var mustConsume = function(type) {
|
510
|
-
var value3 = tryConsume(type);
|
511
|
-
if (value3 !== void 0)
|
512
|
-
return value3;
|
513
|
-
var _a2 = tokens[i], nextType = _a2.type, index = _a2.index;
|
514
|
-
throw new TypeError("Unexpected ".concat(nextType, " at ").concat(index, ", expected ").concat(type));
|
515
|
-
};
|
516
|
-
var consumeText = function() {
|
517
|
-
var result2 = "";
|
518
|
-
var value3;
|
519
|
-
while (value3 = tryConsume("CHAR") || tryConsume("ESCAPED_CHAR")) {
|
520
|
-
result2 += value3;
|
521
|
-
}
|
522
|
-
return result2;
|
523
|
-
};
|
524
|
-
var isSafe = function(value3) {
|
525
|
-
for (var _i = 0, delimiter_1 = delimiter; _i < delimiter_1.length; _i++) {
|
526
|
-
var char2 = delimiter_1[_i];
|
527
|
-
if (value3.indexOf(char2) > -1)
|
528
|
-
return true;
|
529
|
-
}
|
530
|
-
return false;
|
531
|
-
};
|
532
|
-
var safePattern = function(prefix2) {
|
533
|
-
var prev = result[result.length - 1];
|
534
|
-
var prevText = prefix2 || (prev && typeof prev === "string" ? prev : "");
|
535
|
-
if (prev && !prevText) {
|
536
|
-
throw new TypeError('Must have text between two parameters, missing text after "'.concat(prev.name, '"'));
|
537
|
-
}
|
538
|
-
if (!prevText || isSafe(prevText))
|
539
|
-
return "[^".concat(escapeString(delimiter), "]+?");
|
540
|
-
return "(?:(?!".concat(escapeString(prevText), ")[^").concat(escapeString(delimiter), "])+?");
|
541
|
-
};
|
542
|
-
while (i < tokens.length) {
|
543
|
-
var char = tryConsume("CHAR");
|
544
|
-
var name = tryConsume("NAME");
|
545
|
-
var pattern = tryConsume("PATTERN");
|
546
|
-
if (name || pattern) {
|
547
|
-
var prefix = char || "";
|
548
|
-
if (prefixes.indexOf(prefix) === -1) {
|
549
|
-
path += prefix;
|
550
|
-
prefix = "";
|
551
|
-
}
|
552
|
-
if (path) {
|
553
|
-
result.push(path);
|
554
|
-
path = "";
|
555
|
-
}
|
556
|
-
result.push({
|
557
|
-
name: name || key++,
|
558
|
-
prefix,
|
559
|
-
suffix: "",
|
560
|
-
pattern: pattern || safePattern(prefix),
|
561
|
-
modifier: tryConsume("MODIFIER") || ""
|
562
|
-
});
|
563
|
-
continue;
|
564
|
-
}
|
565
|
-
var value2 = char || tryConsume("ESCAPED_CHAR");
|
566
|
-
if (value2) {
|
567
|
-
path += value2;
|
568
|
-
continue;
|
569
|
-
}
|
570
|
-
if (path) {
|
571
|
-
result.push(path);
|
572
|
-
path = "";
|
573
|
-
}
|
574
|
-
var open = tryConsume("OPEN");
|
575
|
-
if (open) {
|
576
|
-
var prefix = consumeText();
|
577
|
-
var name_1 = tryConsume("NAME") || "";
|
578
|
-
var pattern_1 = tryConsume("PATTERN") || "";
|
579
|
-
var suffix = consumeText();
|
580
|
-
mustConsume("CLOSE");
|
581
|
-
result.push({
|
582
|
-
name: name_1 || (pattern_1 ? key++ : ""),
|
583
|
-
pattern: name_1 && !pattern_1 ? safePattern(prefix) : pattern_1,
|
584
|
-
prefix,
|
585
|
-
suffix,
|
586
|
-
modifier: tryConsume("MODIFIER") || ""
|
587
|
-
});
|
588
|
-
continue;
|
589
|
-
}
|
590
|
-
mustConsume("END");
|
591
|
-
}
|
592
|
-
return result;
|
593
|
-
}
|
594
|
-
exports.parse = parse;
|
595
|
-
function compile3(str, options) {
|
596
|
-
return tokensToFunction(parse(str, options), options);
|
597
|
-
}
|
598
|
-
exports.compile = compile3;
|
599
|
-
function tokensToFunction(tokens, options) {
|
600
|
-
if (options === void 0) {
|
601
|
-
options = {};
|
602
|
-
}
|
603
|
-
var reFlags = flags(options);
|
604
|
-
var _a = options.encode, encode = _a === void 0 ? function(x) {
|
605
|
-
return x;
|
606
|
-
} : _a, _b = options.validate, validate = _b === void 0 ? true : _b;
|
607
|
-
var matches = tokens.map(function(token) {
|
608
|
-
if (typeof token === "object") {
|
609
|
-
return new RegExp("^(?:".concat(token.pattern, ")$"), reFlags);
|
610
|
-
}
|
611
|
-
});
|
612
|
-
return function(data) {
|
613
|
-
var path = "";
|
614
|
-
for (var i = 0; i < tokens.length; i++) {
|
615
|
-
var token = tokens[i];
|
616
|
-
if (typeof token === "string") {
|
617
|
-
path += token;
|
618
|
-
continue;
|
619
|
-
}
|
620
|
-
var value2 = data ? data[token.name] : void 0;
|
621
|
-
var optional = token.modifier === "?" || token.modifier === "*";
|
622
|
-
var repeat = token.modifier === "*" || token.modifier === "+";
|
623
|
-
if (Array.isArray(value2)) {
|
624
|
-
if (!repeat) {
|
625
|
-
throw new TypeError('Expected "'.concat(token.name, '" to not repeat, but got an array'));
|
626
|
-
}
|
627
|
-
if (value2.length === 0) {
|
628
|
-
if (optional)
|
629
|
-
continue;
|
630
|
-
throw new TypeError('Expected "'.concat(token.name, '" to not be empty'));
|
631
|
-
}
|
632
|
-
for (var j = 0; j < value2.length; j++) {
|
633
|
-
var segment = encode(value2[j], token);
|
634
|
-
if (validate && !matches[i].test(segment)) {
|
635
|
-
throw new TypeError('Expected all "'.concat(token.name, '" to match "').concat(token.pattern, '", but got "').concat(segment, '"'));
|
636
|
-
}
|
637
|
-
path += token.prefix + segment + token.suffix;
|
638
|
-
}
|
639
|
-
continue;
|
640
|
-
}
|
641
|
-
if (typeof value2 === "string" || typeof value2 === "number") {
|
642
|
-
var segment = encode(String(value2), token);
|
643
|
-
if (validate && !matches[i].test(segment)) {
|
644
|
-
throw new TypeError('Expected "'.concat(token.name, '" to match "').concat(token.pattern, '", but got "').concat(segment, '"'));
|
645
|
-
}
|
646
|
-
path += token.prefix + segment + token.suffix;
|
647
|
-
continue;
|
648
|
-
}
|
649
|
-
if (optional)
|
650
|
-
continue;
|
651
|
-
var typeOfMessage = repeat ? "an array" : "a string";
|
652
|
-
throw new TypeError('Expected "'.concat(token.name, '" to be ').concat(typeOfMessage));
|
653
|
-
}
|
654
|
-
return path;
|
655
|
-
};
|
656
|
-
}
|
657
|
-
exports.tokensToFunction = tokensToFunction;
|
658
|
-
function match(str, options) {
|
659
|
-
var keys = [];
|
660
|
-
var re = pathToRegexp2(str, keys, options);
|
661
|
-
return regexpToFunction(re, keys, options);
|
662
|
-
}
|
663
|
-
exports.match = match;
|
664
|
-
function regexpToFunction(re, keys, options) {
|
665
|
-
if (options === void 0) {
|
666
|
-
options = {};
|
667
|
-
}
|
668
|
-
var _a = options.decode, decode = _a === void 0 ? function(x) {
|
669
|
-
return x;
|
670
|
-
} : _a;
|
671
|
-
return function(pathname) {
|
672
|
-
var m = re.exec(pathname);
|
673
|
-
if (!m)
|
674
|
-
return false;
|
675
|
-
var path = m[0], index = m.index;
|
676
|
-
var params = /* @__PURE__ */ Object.create(null);
|
677
|
-
var _loop_1 = function(i2) {
|
678
|
-
if (m[i2] === void 0)
|
679
|
-
return "continue";
|
680
|
-
var key = keys[i2 - 1];
|
681
|
-
if (key.modifier === "*" || key.modifier === "+") {
|
682
|
-
params[key.name] = m[i2].split(key.prefix + key.suffix).map(function(value2) {
|
683
|
-
return decode(value2, key);
|
684
|
-
});
|
685
|
-
} else {
|
686
|
-
params[key.name] = decode(m[i2], key);
|
687
|
-
}
|
688
|
-
};
|
689
|
-
for (var i = 1; i < m.length; i++) {
|
690
|
-
_loop_1(i);
|
691
|
-
}
|
692
|
-
return { path, index, params };
|
693
|
-
};
|
694
|
-
}
|
695
|
-
exports.regexpToFunction = regexpToFunction;
|
696
|
-
function escapeString(str) {
|
697
|
-
return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
|
698
|
-
}
|
699
|
-
function flags(options) {
|
700
|
-
return options && options.sensitive ? "" : "i";
|
701
|
-
}
|
702
|
-
function regexpToRegexp(path, keys) {
|
703
|
-
if (!keys)
|
704
|
-
return path;
|
705
|
-
var groupsRegex = /\((?:\?<(.*?)>)?(?!\?)/g;
|
706
|
-
var index = 0;
|
707
|
-
var execResult = groupsRegex.exec(path.source);
|
708
|
-
while (execResult) {
|
709
|
-
keys.push({
|
710
|
-
// Use parenthesized substring match if available, index otherwise
|
711
|
-
name: execResult[1] || index++,
|
712
|
-
prefix: "",
|
713
|
-
suffix: "",
|
714
|
-
modifier: "",
|
715
|
-
pattern: ""
|
716
|
-
});
|
717
|
-
execResult = groupsRegex.exec(path.source);
|
718
|
-
}
|
719
|
-
return path;
|
720
|
-
}
|
721
|
-
function arrayToRegexp(paths, keys, options) {
|
722
|
-
var parts = paths.map(function(path) {
|
723
|
-
return pathToRegexp2(path, keys, options).source;
|
724
|
-
});
|
725
|
-
return new RegExp("(?:".concat(parts.join("|"), ")"), flags(options));
|
726
|
-
}
|
727
|
-
function stringToRegexp(path, keys, options) {
|
728
|
-
return tokensToRegexp(parse(path, options), keys, options);
|
729
|
-
}
|
730
|
-
function tokensToRegexp(tokens, keys, options) {
|
731
|
-
if (options === void 0) {
|
732
|
-
options = {};
|
733
|
-
}
|
734
|
-
var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function(x) {
|
735
|
-
return x;
|
736
|
-
} : _d, _e = options.delimiter, delimiter = _e === void 0 ? "/#?" : _e, _f = options.endsWith, endsWith = _f === void 0 ? "" : _f;
|
737
|
-
var endsWithRe = "[".concat(escapeString(endsWith), "]|$");
|
738
|
-
var delimiterRe = "[".concat(escapeString(delimiter), "]");
|
739
|
-
var route = start ? "^" : "";
|
740
|
-
for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {
|
741
|
-
var token = tokens_1[_i];
|
742
|
-
if (typeof token === "string") {
|
743
|
-
route += escapeString(encode(token));
|
744
|
-
} else {
|
745
|
-
var prefix = escapeString(encode(token.prefix));
|
746
|
-
var suffix = escapeString(encode(token.suffix));
|
747
|
-
if (token.pattern) {
|
748
|
-
if (keys)
|
749
|
-
keys.push(token);
|
750
|
-
if (prefix || suffix) {
|
751
|
-
if (token.modifier === "+" || token.modifier === "*") {
|
752
|
-
var mod = token.modifier === "*" ? "?" : "";
|
753
|
-
route += "(?:".concat(prefix, "((?:").concat(token.pattern, ")(?:").concat(suffix).concat(prefix, "(?:").concat(token.pattern, "))*)").concat(suffix, ")").concat(mod);
|
754
|
-
} else {
|
755
|
-
route += "(?:".concat(prefix, "(").concat(token.pattern, ")").concat(suffix, ")").concat(token.modifier);
|
756
|
-
}
|
757
|
-
} else {
|
758
|
-
if (token.modifier === "+" || token.modifier === "*") {
|
759
|
-
throw new TypeError('Can not repeat "'.concat(token.name, '" without a prefix and suffix'));
|
760
|
-
}
|
761
|
-
route += "(".concat(token.pattern, ")").concat(token.modifier);
|
762
|
-
}
|
763
|
-
} else {
|
764
|
-
route += "(?:".concat(prefix).concat(suffix, ")").concat(token.modifier);
|
765
|
-
}
|
766
|
-
}
|
767
|
-
}
|
768
|
-
if (end) {
|
769
|
-
if (!strict)
|
770
|
-
route += "".concat(delimiterRe, "?");
|
771
|
-
route += !options.endsWith ? "$" : "(?=".concat(endsWithRe, ")");
|
772
|
-
} else {
|
773
|
-
var endToken = tokens[tokens.length - 1];
|
774
|
-
var isEndDelimited = typeof endToken === "string" ? delimiterRe.indexOf(endToken[endToken.length - 1]) > -1 : endToken === void 0;
|
775
|
-
if (!strict) {
|
776
|
-
route += "(?:".concat(delimiterRe, "(?=").concat(endsWithRe, "))?");
|
777
|
-
}
|
778
|
-
if (!isEndDelimited) {
|
779
|
-
route += "(?=".concat(delimiterRe, "|").concat(endsWithRe, ")");
|
780
|
-
}
|
781
|
-
}
|
782
|
-
return new RegExp(route, flags(options));
|
783
|
-
}
|
784
|
-
exports.tokensToRegexp = tokensToRegexp;
|
785
|
-
function pathToRegexp2(path, keys, options) {
|
786
|
-
if (path instanceof RegExp)
|
787
|
-
return regexpToRegexp(path, keys);
|
788
|
-
if (Array.isArray(path))
|
789
|
-
return arrayToRegexp(path, keys, options);
|
790
|
-
return stringToRegexp(path, keys, options);
|
791
|
-
}
|
792
|
-
exports.pathToRegexp = pathToRegexp2;
|
793
|
-
}
|
794
|
-
});
|
795
|
-
|
796
|
-
// ../../internals/path-to-regexp/dist/index.js
|
797
|
-
var require_dist3 = __commonJS({
|
798
|
-
"../../internals/path-to-regexp/dist/index.js"(exports) {
|
799
|
-
"use strict";
|
800
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
801
|
-
exports.compile = exports.pathToRegexp = void 0;
|
802
|
-
var path_to_regexp_1 = require_dist();
|
803
|
-
Object.defineProperty(exports, "compile", { enumerable: true, get: function() {
|
804
|
-
return path_to_regexp_1.compile;
|
805
|
-
} });
|
806
|
-
var path_to_regexp_updated_1 = require_dist2();
|
807
|
-
function cloneKeys(keys) {
|
808
|
-
if (typeof keys === "undefined") {
|
809
|
-
return void 0;
|
810
|
-
}
|
811
|
-
return keys.slice(0);
|
812
|
-
}
|
813
|
-
function compareKeys(left, right) {
|
814
|
-
const leftSerialized = typeof left === "undefined" ? "undefined" : left.toString();
|
815
|
-
const rightSerialized = typeof right === "undefined" ? "undefined" : right.toString();
|
816
|
-
return leftSerialized === rightSerialized;
|
817
|
-
}
|
818
|
-
function pathToRegexp2(callerId, path, keys, options) {
|
819
|
-
const newKeys = cloneKeys(keys);
|
820
|
-
const currentRegExp = (0, path_to_regexp_1.pathToRegexp)(path, keys, options);
|
821
|
-
try {
|
822
|
-
const currentKeys = keys;
|
823
|
-
const newRegExp = (0, path_to_regexp_updated_1.pathToRegexp)(path, newKeys, options);
|
824
|
-
const isDiffRegExp = currentRegExp.toString() !== newRegExp.toString();
|
825
|
-
if (process.env.FORCE_PATH_TO_REGEXP_LOG || isDiffRegExp) {
|
826
|
-
const message = JSON.stringify({
|
827
|
-
path,
|
828
|
-
currentRegExp: currentRegExp.toString(),
|
829
|
-
newRegExp: newRegExp.toString()
|
830
|
-
});
|
831
|
-
console.error(`[vc] PATH TO REGEXP PATH DIFF @ #${callerId}: ${message}`);
|
832
|
-
}
|
833
|
-
const isDiffKeys = !compareKeys(keys, newKeys);
|
834
|
-
if (process.env.FORCE_PATH_TO_REGEXP_LOG || isDiffKeys) {
|
835
|
-
const message = JSON.stringify({
|
836
|
-
isDiffKeys,
|
837
|
-
currentKeys,
|
838
|
-
newKeys
|
839
|
-
});
|
840
|
-
console.error(`[vc] PATH TO REGEXP KEYS DIFF @ #${callerId}: ${message}`);
|
841
|
-
}
|
842
|
-
} catch (err) {
|
843
|
-
const error = err;
|
844
|
-
const message = JSON.stringify({
|
845
|
-
path,
|
846
|
-
error: error.message
|
847
|
-
});
|
848
|
-
console.error(`[vc] PATH TO REGEXP ERROR @ #${callerId}: ${message}`);
|
849
|
-
}
|
850
|
-
return currentRegExp;
|
851
|
-
}
|
852
|
-
exports.pathToRegexp = pathToRegexp2;
|
853
|
-
}
|
854
|
-
});
|
855
|
-
|
856
36
|
// ../../node_modules/.pnpm/@babel+types@7.26.3/node_modules/@babel/types/lib/utils/shallowEqual.js
|
857
37
|
var require_shallowEqual = __commonJS({
|
858
38
|
"../../node_modules/.pnpm/@babel+types@7.26.3/node_modules/@babel/types/lib/utils/shallowEqual.js"(exports) {
|
@@ -70371,7 +69551,7 @@ var init_babel = __esm({
|
|
70371
69551
|
});
|
70372
69552
|
|
70373
69553
|
// ../../node_modules/.pnpm/@tootallnate+once@1.1.2/node_modules/@tootallnate/once/dist/index.js
|
70374
|
-
var
|
69554
|
+
var require_dist = __commonJS({
|
70375
69555
|
"../../node_modules/.pnpm/@tootallnate+once@1.1.2/node_modules/@tootallnate/once/dist/index.js"(exports, module2) {
|
70376
69556
|
"use strict";
|
70377
69557
|
function noop() {
|
@@ -70856,8 +70036,54 @@ function filterDiagnostics(diagnostics, ignore) {
|
|
70856
70036
|
|
70857
70037
|
// src/utils.ts
|
70858
70038
|
var import_build_utils2 = require("@vercel/build-utils");
|
70859
|
-
var import_path_to_regexp = __toESM(require_dist3());
|
70860
70039
|
var import_path2 = require("path");
|
70040
|
+
var import_path_to_regexp = require("path-to-regexp");
|
70041
|
+
var import_path_to_regexp_updated = require("path-to-regexp-updated");
|
70042
|
+
function cloneKeys(keys) {
|
70043
|
+
if (typeof keys === "undefined") {
|
70044
|
+
return void 0;
|
70045
|
+
}
|
70046
|
+
return keys.slice(0);
|
70047
|
+
}
|
70048
|
+
function compareKeys(left, right) {
|
70049
|
+
const leftSerialized = typeof left === "undefined" ? "undefined" : left.toString();
|
70050
|
+
const rightSerialized = typeof right === "undefined" ? "undefined" : right.toString();
|
70051
|
+
return leftSerialized === rightSerialized;
|
70052
|
+
}
|
70053
|
+
function pathToRegexp(callerId, path, keys, options) {
|
70054
|
+
const newKeys = cloneKeys(keys);
|
70055
|
+
const currentRegExp = (0, import_path_to_regexp.pathToRegexp)(path, keys, options);
|
70056
|
+
try {
|
70057
|
+
const currentKeys = keys;
|
70058
|
+
const newRegExp = (0, import_path_to_regexp_updated.pathToRegexp)(path, newKeys, options);
|
70059
|
+
const isDiffRegExp = currentRegExp.toString() !== newRegExp.toString();
|
70060
|
+
if (process.env.FORCE_PATH_TO_REGEXP_LOG || isDiffRegExp) {
|
70061
|
+
const message = JSON.stringify({
|
70062
|
+
path,
|
70063
|
+
currentRegExp: currentRegExp.toString(),
|
70064
|
+
newRegExp: newRegExp.toString()
|
70065
|
+
});
|
70066
|
+
console.error(`[vc] PATH TO REGEXP PATH DIFF @ #${callerId}: ${message}`);
|
70067
|
+
}
|
70068
|
+
const isDiffKeys = !compareKeys(keys, newKeys);
|
70069
|
+
if (process.env.FORCE_PATH_TO_REGEXP_LOG || isDiffKeys) {
|
70070
|
+
const message = JSON.stringify({
|
70071
|
+
isDiffKeys,
|
70072
|
+
currentKeys,
|
70073
|
+
newKeys
|
70074
|
+
});
|
70075
|
+
console.error(`[vc] PATH TO REGEXP KEYS DIFF @ #${callerId}: ${message}`);
|
70076
|
+
}
|
70077
|
+
} catch (err) {
|
70078
|
+
const error = err;
|
70079
|
+
const message = JSON.stringify({
|
70080
|
+
path,
|
70081
|
+
error: error.message
|
70082
|
+
});
|
70083
|
+
console.error(`[vc] PATH TO REGEXP ERROR @ #${callerId}: ${message}`);
|
70084
|
+
}
|
70085
|
+
return currentRegExp;
|
70086
|
+
}
|
70861
70087
|
var WAIT_UNTIL_TIMEOUT_MS = 10 * 1e3;
|
70862
70088
|
function getRegExpFromMatchers(matcherOrMatchers) {
|
70863
70089
|
if (!matcherOrMatchers) {
|
@@ -70878,9 +70104,9 @@ function getRegExpFromMatcher(matcher, index, allMatchers) {
|
|
70878
70104
|
`Middleware's \`config.matcher\` values must start with "/". Received: ${matcher}`
|
70879
70105
|
);
|
70880
70106
|
}
|
70881
|
-
const regExps = [
|
70107
|
+
const regExps = [pathToRegexp("316", matcher).source];
|
70882
70108
|
if (matcher === "/" && !allMatchers.includes("/index")) {
|
70883
|
-
regExps.push(
|
70109
|
+
regExps.push(pathToRegexp("491", "/index").source);
|
70884
70110
|
}
|
70885
70111
|
return regExps;
|
70886
70112
|
}
|
@@ -71257,7 +70483,7 @@ var prepareCache = ({ repoRootPath, workPath }) => {
|
|
71257
70483
|
};
|
71258
70484
|
|
71259
70485
|
// src/start-dev-server.ts
|
71260
|
-
var import_once2 = __toESM(
|
70486
|
+
var import_once2 = __toESM(require_dist());
|
71261
70487
|
var import_url2 = __toESM(require("url"));
|
71262
70488
|
var import_module3 = require("module");
|
71263
70489
|
var import_fs2 = require("fs");
|
@@ -71271,7 +70497,7 @@ var import_static_config2 = require("@vercel/static-config");
|
|
71271
70497
|
var import_ts_morph2 = require("ts-morph");
|
71272
70498
|
|
71273
70499
|
// src/fork-dev-server.ts
|
71274
|
-
var import_once = __toESM(
|
70500
|
+
var import_once = __toESM(require_dist());
|
71275
70501
|
var import_build_utils5 = require("@vercel/build-utils");
|
71276
70502
|
var import_child_process = require("child_process");
|
71277
70503
|
var import_url = require("url");
|