vercel 25.1.1-canary.7 → 25.2.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.
- package/dist/index.js +305 -186
- package/package.json +13 -13
package/dist/index.js
CHANGED
@@ -28433,116 +28433,6 @@ function tryAutoDetect(){
|
|
28433
28433
|
}
|
28434
28434
|
|
28435
28435
|
|
28436
|
-
/***/ }),
|
28437
|
-
|
28438
|
-
/***/ 52056:
|
28439
|
-
/***/ ((module, exports, __webpack_require__) => {
|
28440
|
-
|
28441
|
-
"use strict";
|
28442
|
-
|
28443
|
-
|
28444
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
28445
|
-
|
28446
|
-
const picomatch = __webpack_require__(9138);
|
28447
|
-
const normalizePath = __webpack_require__(34458);
|
28448
|
-
|
28449
|
-
/**
|
28450
|
-
* @typedef {(testString: string) => boolean} AnymatchFn
|
28451
|
-
* @typedef {string|RegExp|AnymatchFn} AnymatchPattern
|
28452
|
-
* @typedef {AnymatchPattern|AnymatchPattern[]} AnymatchMatcher
|
28453
|
-
*/
|
28454
|
-
const BANG = '!';
|
28455
|
-
const DEFAULT_OPTIONS = {returnIndex: false};
|
28456
|
-
const arrify = (item) => Array.isArray(item) ? item : [item];
|
28457
|
-
|
28458
|
-
/**
|
28459
|
-
* @param {AnymatchPattern} matcher
|
28460
|
-
* @param {object} options
|
28461
|
-
* @returns {AnymatchFn}
|
28462
|
-
*/
|
28463
|
-
const createPattern = (matcher, options) => {
|
28464
|
-
if (typeof matcher === 'function') {
|
28465
|
-
return matcher;
|
28466
|
-
}
|
28467
|
-
if (typeof matcher === 'string') {
|
28468
|
-
const glob = picomatch(matcher, options);
|
28469
|
-
return (string) => matcher === string || glob(string);
|
28470
|
-
}
|
28471
|
-
if (matcher instanceof RegExp) {
|
28472
|
-
return (string) => matcher.test(string);
|
28473
|
-
}
|
28474
|
-
return (string) => false;
|
28475
|
-
};
|
28476
|
-
|
28477
|
-
/**
|
28478
|
-
* @param {Array<Function>} patterns
|
28479
|
-
* @param {Array<Function>} negPatterns
|
28480
|
-
* @param {String|Array} args
|
28481
|
-
* @param {Boolean} returnIndex
|
28482
|
-
* @returns {boolean|number}
|
28483
|
-
*/
|
28484
|
-
const matchPatterns = (patterns, negPatterns, args, returnIndex) => {
|
28485
|
-
const isList = Array.isArray(args);
|
28486
|
-
const _path = isList ? args[0] : args;
|
28487
|
-
if (!isList && typeof _path !== 'string') {
|
28488
|
-
throw new TypeError('anymatch: second argument must be a string: got ' +
|
28489
|
-
Object.prototype.toString.call(_path))
|
28490
|
-
}
|
28491
|
-
const path = normalizePath(_path);
|
28492
|
-
|
28493
|
-
for (let index = 0; index < negPatterns.length; index++) {
|
28494
|
-
const nglob = negPatterns[index];
|
28495
|
-
if (nglob(path)) {
|
28496
|
-
return returnIndex ? -1 : false;
|
28497
|
-
}
|
28498
|
-
}
|
28499
|
-
|
28500
|
-
const applied = isList && [path].concat(args.slice(1));
|
28501
|
-
for (let index = 0; index < patterns.length; index++) {
|
28502
|
-
const pattern = patterns[index];
|
28503
|
-
if (isList ? pattern(...applied) : pattern(path)) {
|
28504
|
-
return returnIndex ? index : true;
|
28505
|
-
}
|
28506
|
-
}
|
28507
|
-
|
28508
|
-
return returnIndex ? -1 : false;
|
28509
|
-
};
|
28510
|
-
|
28511
|
-
/**
|
28512
|
-
* @param {AnymatchMatcher} matchers
|
28513
|
-
* @param {Array|string} testString
|
28514
|
-
* @param {object} options
|
28515
|
-
* @returns {boolean|number|Function}
|
28516
|
-
*/
|
28517
|
-
const anymatch = (matchers, testString, options = DEFAULT_OPTIONS) => {
|
28518
|
-
if (matchers == null) {
|
28519
|
-
throw new TypeError('anymatch: specify first argument');
|
28520
|
-
}
|
28521
|
-
const opts = typeof options === 'boolean' ? {returnIndex: options} : options;
|
28522
|
-
const returnIndex = opts.returnIndex || false;
|
28523
|
-
|
28524
|
-
// Early cache for matchers.
|
28525
|
-
const mtchers = arrify(matchers);
|
28526
|
-
const negatedGlobs = mtchers
|
28527
|
-
.filter(item => typeof item === 'string' && item.charAt(0) === BANG)
|
28528
|
-
.map(item => item.slice(1))
|
28529
|
-
.map(item => picomatch(item, opts));
|
28530
|
-
const patterns = mtchers.map(matcher => createPattern(matcher, opts));
|
28531
|
-
|
28532
|
-
if (testString == null) {
|
28533
|
-
return (testString, ri = false) => {
|
28534
|
-
const returnIndex = typeof ri === 'boolean' ? ri : false;
|
28535
|
-
return matchPatterns(patterns, negatedGlobs, testString, returnIndex);
|
28536
|
-
}
|
28537
|
-
}
|
28538
|
-
|
28539
|
-
return matchPatterns(patterns, negatedGlobs, testString, returnIndex);
|
28540
|
-
};
|
28541
|
-
|
28542
|
-
anymatch.default = anymatch;
|
28543
|
-
module.exports = anymatch;
|
28544
|
-
|
28545
|
-
|
28546
28436
|
/***/ }),
|
28547
28437
|
|
28548
28438
|
/***/ 57193:
|
@@ -41608,7 +41498,7 @@ const fs = __webpack_require__(35747);
|
|
41608
41498
|
const sysPath = __webpack_require__(85622);
|
41609
41499
|
const { promisify } = __webpack_require__(31669);
|
41610
41500
|
const readdirp = __webpack_require__(85316);
|
41611
|
-
const anymatch = __webpack_require__(
|
41501
|
+
const anymatch = __webpack_require__(3140).default;
|
41612
41502
|
const globParent = __webpack_require__(97507);
|
41613
41503
|
const isGlob = __webpack_require__(24042);
|
41614
41504
|
const braces = __webpack_require__(40538);
|
@@ -43776,6 +43666,116 @@ async _addToNodeFs(path, initialAdd, priorWh, depth, target) {
|
|
43776
43666
|
module.exports = NodeFsHandler;
|
43777
43667
|
|
43778
43668
|
|
43669
|
+
/***/ }),
|
43670
|
+
|
43671
|
+
/***/ 3140:
|
43672
|
+
/***/ ((module, exports, __webpack_require__) => {
|
43673
|
+
|
43674
|
+
"use strict";
|
43675
|
+
|
43676
|
+
|
43677
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
43678
|
+
|
43679
|
+
const picomatch = __webpack_require__(9138);
|
43680
|
+
const normalizePath = __webpack_require__(34458);
|
43681
|
+
|
43682
|
+
/**
|
43683
|
+
* @typedef {(testString: string) => boolean} AnymatchFn
|
43684
|
+
* @typedef {string|RegExp|AnymatchFn} AnymatchPattern
|
43685
|
+
* @typedef {AnymatchPattern|AnymatchPattern[]} AnymatchMatcher
|
43686
|
+
*/
|
43687
|
+
const BANG = '!';
|
43688
|
+
const DEFAULT_OPTIONS = {returnIndex: false};
|
43689
|
+
const arrify = (item) => Array.isArray(item) ? item : [item];
|
43690
|
+
|
43691
|
+
/**
|
43692
|
+
* @param {AnymatchPattern} matcher
|
43693
|
+
* @param {object} options
|
43694
|
+
* @returns {AnymatchFn}
|
43695
|
+
*/
|
43696
|
+
const createPattern = (matcher, options) => {
|
43697
|
+
if (typeof matcher === 'function') {
|
43698
|
+
return matcher;
|
43699
|
+
}
|
43700
|
+
if (typeof matcher === 'string') {
|
43701
|
+
const glob = picomatch(matcher, options);
|
43702
|
+
return (string) => matcher === string || glob(string);
|
43703
|
+
}
|
43704
|
+
if (matcher instanceof RegExp) {
|
43705
|
+
return (string) => matcher.test(string);
|
43706
|
+
}
|
43707
|
+
return (string) => false;
|
43708
|
+
};
|
43709
|
+
|
43710
|
+
/**
|
43711
|
+
* @param {Array<Function>} patterns
|
43712
|
+
* @param {Array<Function>} negPatterns
|
43713
|
+
* @param {String|Array} args
|
43714
|
+
* @param {Boolean} returnIndex
|
43715
|
+
* @returns {boolean|number}
|
43716
|
+
*/
|
43717
|
+
const matchPatterns = (patterns, negPatterns, args, returnIndex) => {
|
43718
|
+
const isList = Array.isArray(args);
|
43719
|
+
const _path = isList ? args[0] : args;
|
43720
|
+
if (!isList && typeof _path !== 'string') {
|
43721
|
+
throw new TypeError('anymatch: second argument must be a string: got ' +
|
43722
|
+
Object.prototype.toString.call(_path))
|
43723
|
+
}
|
43724
|
+
const path = normalizePath(_path);
|
43725
|
+
|
43726
|
+
for (let index = 0; index < negPatterns.length; index++) {
|
43727
|
+
const nglob = negPatterns[index];
|
43728
|
+
if (nglob(path)) {
|
43729
|
+
return returnIndex ? -1 : false;
|
43730
|
+
}
|
43731
|
+
}
|
43732
|
+
|
43733
|
+
const applied = isList && [path].concat(args.slice(1));
|
43734
|
+
for (let index = 0; index < patterns.length; index++) {
|
43735
|
+
const pattern = patterns[index];
|
43736
|
+
if (isList ? pattern(...applied) : pattern(path)) {
|
43737
|
+
return returnIndex ? index : true;
|
43738
|
+
}
|
43739
|
+
}
|
43740
|
+
|
43741
|
+
return returnIndex ? -1 : false;
|
43742
|
+
};
|
43743
|
+
|
43744
|
+
/**
|
43745
|
+
* @param {AnymatchMatcher} matchers
|
43746
|
+
* @param {Array|string} testString
|
43747
|
+
* @param {object} options
|
43748
|
+
* @returns {boolean|number|Function}
|
43749
|
+
*/
|
43750
|
+
const anymatch = (matchers, testString, options = DEFAULT_OPTIONS) => {
|
43751
|
+
if (matchers == null) {
|
43752
|
+
throw new TypeError('anymatch: specify first argument');
|
43753
|
+
}
|
43754
|
+
const opts = typeof options === 'boolean' ? {returnIndex: options} : options;
|
43755
|
+
const returnIndex = opts.returnIndex || false;
|
43756
|
+
|
43757
|
+
// Early cache for matchers.
|
43758
|
+
const mtchers = arrify(matchers);
|
43759
|
+
const negatedGlobs = mtchers
|
43760
|
+
.filter(item => typeof item === 'string' && item.charAt(0) === BANG)
|
43761
|
+
.map(item => item.slice(1))
|
43762
|
+
.map(item => picomatch(item, opts));
|
43763
|
+
const patterns = mtchers.map(matcher => createPattern(matcher, opts));
|
43764
|
+
|
43765
|
+
if (testString == null) {
|
43766
|
+
return (testString, ri = false) => {
|
43767
|
+
const returnIndex = typeof ri === 'boolean' ? ri : false;
|
43768
|
+
return matchPatterns(patterns, negatedGlobs, testString, returnIndex);
|
43769
|
+
}
|
43770
|
+
}
|
43771
|
+
|
43772
|
+
return matchPatterns(patterns, negatedGlobs, testString, returnIndex);
|
43773
|
+
};
|
43774
|
+
|
43775
|
+
anymatch.default = anymatch;
|
43776
|
+
module.exports = anymatch;
|
43777
|
+
|
43778
|
+
|
43779
43779
|
/***/ }),
|
43780
43780
|
|
43781
43781
|
/***/ 5952:
|
@@ -230788,6 +230788,7 @@ const link_1 = __importDefault(__webpack_require__(98472));
|
|
230788
230788
|
const logo_1 = __importDefault(__webpack_require__(9829));
|
230789
230789
|
const get_args_1 = __importDefault(__webpack_require__(87612));
|
230790
230790
|
const pkg_name_1 = __webpack_require__(98106);
|
230791
|
+
const normalize_url_1 = __webpack_require__(37771);
|
230791
230792
|
const pkgName = pkg_name_1.getPkgName();
|
230792
230793
|
const help = () => {
|
230793
230794
|
console.log(`
|
@@ -230846,9 +230847,7 @@ async function main(client) {
|
|
230846
230847
|
if (run) {
|
230847
230848
|
run = path_1.resolve(run);
|
230848
230849
|
}
|
230849
|
-
|
230850
|
-
bad = `https://${bad}`;
|
230851
|
-
}
|
230850
|
+
bad = normalize_url_1.normalizeURL(bad);
|
230852
230851
|
let parsed = url_1.parse(bad);
|
230853
230852
|
if (!parsed.hostname) {
|
230854
230853
|
output.error('Invalid input: no hostname provided');
|
@@ -230864,9 +230863,7 @@ async function main(client) {
|
|
230864
230863
|
}
|
230865
230864
|
}
|
230866
230865
|
const badDeploymentPromise = getDeployment(client, bad).catch(err => err);
|
230867
|
-
|
230868
|
-
good = `https://${good}`;
|
230869
|
-
}
|
230866
|
+
good = normalize_url_1.normalizeURL(good);
|
230870
230867
|
parsed = url_1.parse(good);
|
230871
230868
|
if (!parsed.hostname) {
|
230872
230869
|
output.error('Invalid input: no hostname provided');
|
@@ -232929,9 +232926,11 @@ async function dev(client, opts, args) {
|
|
232929
232926
|
// v3 Build Output because it will incorrectly be detected by
|
232930
232927
|
// @vercel/static-build in BuildOutputV3.getBuildOutputDirectory()
|
232931
232928
|
if (!devCommand) {
|
232932
|
-
output.log(`Removing ${write_build_result_1.OUTPUT_DIR}`);
|
232933
232929
|
const outputDir = path_1.join(cwd, write_build_result_1.OUTPUT_DIR);
|
232934
|
-
await fs_extra_1.default.
|
232930
|
+
if (await fs_extra_1.default.pathExists(outputDir)) {
|
232931
|
+
output.log(`Removing ${write_build_result_1.OUTPUT_DIR}`);
|
232932
|
+
await fs_extra_1.default.remove(outputDir);
|
232933
|
+
}
|
232935
232934
|
}
|
232936
232935
|
const devServer = new server_1.default(cwd, {
|
232937
232936
|
output,
|
@@ -238695,6 +238694,24 @@ const ARG_COMMON = {
|
|
238695
238694
|
exports.default = () => ARG_COMMON;
|
238696
238695
|
|
238697
238696
|
|
238697
|
+
/***/ }),
|
238698
|
+
|
238699
|
+
/***/ 37771:
|
238700
|
+
/***/ ((__unused_webpack_module, exports) => {
|
238701
|
+
|
238702
|
+
"use strict";
|
238703
|
+
|
238704
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
238705
|
+
exports.normalizeURL = void 0;
|
238706
|
+
function hasScheme(url) {
|
238707
|
+
return url.startsWith('http://') || url.startsWith('https://');
|
238708
|
+
}
|
238709
|
+
function normalizeURL(url) {
|
238710
|
+
return hasScheme(url) ? url : `https://${url}`;
|
238711
|
+
}
|
238712
|
+
exports.normalizeURL = normalizeURL;
|
238713
|
+
|
238714
|
+
|
238698
238715
|
/***/ }),
|
238699
238716
|
|
238700
238717
|
/***/ 90850:
|
@@ -241864,9 +241881,6 @@ async function getBuildMatches(vercelConfig, cwd, output, devServer, fileList) {
|
|
241864
241881
|
mapToEntrypoint.set(extensionless, src);
|
241865
241882
|
src = extensionless;
|
241866
241883
|
}
|
241867
|
-
// We need to escape brackets since `glob` will
|
241868
|
-
// try to find a group otherwise
|
241869
|
-
src = src.replace(/(\[|\])/g, '[$1]');
|
241870
241884
|
const files = fileList
|
241871
241885
|
.filter(name => name === src || minimatch_1.default(name, src, { dot: true }))
|
241872
241886
|
.map(name => path_1.join(cwd, name));
|
@@ -242044,6 +242058,33 @@ function exposeSystemEnvs(projectEnvs, systemEnvValues, autoExposeSystemEnvs, ve
|
|
242044
242058
|
exports.default = exposeSystemEnvs;
|
242045
242059
|
|
242046
242060
|
|
242061
|
+
/***/ }),
|
242062
|
+
|
242063
|
+
/***/ 17929:
|
242064
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
242065
|
+
|
242066
|
+
"use strict";
|
242067
|
+
|
242068
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
242069
|
+
exports.nodeHeadersToFetchHeaders = void 0;
|
242070
|
+
const node_fetch_1 = __webpack_require__(82197);
|
242071
|
+
function nodeHeadersToFetchHeaders(nodeHeaders) {
|
242072
|
+
const headers = new node_fetch_1.Headers();
|
242073
|
+
for (const [name, value] of Object.entries(nodeHeaders)) {
|
242074
|
+
if (Array.isArray(value)) {
|
242075
|
+
for (const val of value) {
|
242076
|
+
headers.append(name, val);
|
242077
|
+
}
|
242078
|
+
}
|
242079
|
+
else if (typeof value !== 'undefined') {
|
242080
|
+
headers.set(name, String(value));
|
242081
|
+
}
|
242082
|
+
}
|
242083
|
+
return headers;
|
242084
|
+
}
|
242085
|
+
exports.nodeHeadersToFetchHeaders = nodeHeadersToFetchHeaders;
|
242086
|
+
|
242087
|
+
|
242047
242088
|
/***/ }),
|
242048
242089
|
|
242049
242090
|
/***/ 4567:
|
@@ -242350,15 +242391,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
242350
242391
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
242351
242392
|
};
|
242352
242393
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
242394
|
+
const ms_1 = __importDefault(__webpack_require__(80040));
|
242353
242395
|
const url_1 = __importStar(__webpack_require__(78835));
|
242354
242396
|
const http_1 = __importDefault(__webpack_require__(98605));
|
242355
242397
|
const fs_extra_1 = __importDefault(__webpack_require__(45392));
|
242356
242398
|
const chalk_1 = __importDefault(__webpack_require__(961));
|
242399
|
+
const node_fetch_1 = __importDefault(__webpack_require__(82197));
|
242357
242400
|
const pluralize_1 = __importDefault(__webpack_require__(31974));
|
242358
242401
|
const raw_body_1 = __importDefault(__webpack_require__(26542));
|
242359
242402
|
const async_listen_1 = __importDefault(__webpack_require__(15353));
|
242360
242403
|
const minimatch_1 = __importDefault(__webpack_require__(99566));
|
242361
|
-
const ms_1 = __importDefault(__webpack_require__(80040));
|
242362
242404
|
const http_proxy_1 = __importDefault(__webpack_require__(91288));
|
242363
242405
|
const crypto_1 = __webpack_require__(76417);
|
242364
242406
|
const serve_handler_1 = __importDefault(__webpack_require__(73666));
|
@@ -242400,6 +242442,7 @@ const error_502_1 = __importDefault(__webpack_require__(73862));
|
|
242400
242442
|
const redirect_1 = __importDefault(__webpack_require__(14050));
|
242401
242443
|
const expose_system_envs_1 = __importDefault(__webpack_require__(40313));
|
242402
242444
|
const tree_kill_1 = __webpack_require__(21780);
|
242445
|
+
const headers_1 = __webpack_require__(17929);
|
242403
242446
|
const frontendRuntimeSet = new Set(frameworks_1.default.map(f => f.useRuntime?.use || '@vercel/static-build'));
|
242404
242447
|
function sortBuilders(buildA, buildB) {
|
242405
242448
|
if (buildA && buildA.use && build_utils_1.isOfficialRuntime('static-build', buildA.use)) {
|
@@ -242469,31 +242512,6 @@ class DevServer {
|
|
242469
242512
|
}
|
242470
242513
|
return false;
|
242471
242514
|
};
|
242472
|
-
/*
|
242473
|
-
runDevMiddleware = async (
|
242474
|
-
req: http.IncomingMessage,
|
242475
|
-
res: http.ServerResponse
|
242476
|
-
) => {
|
242477
|
-
const { devMiddlewarePlugins } = await loadCliPlugins(
|
242478
|
-
this.cwd,
|
242479
|
-
this.output
|
242480
|
-
);
|
242481
|
-
try {
|
242482
|
-
for (let plugin of devMiddlewarePlugins) {
|
242483
|
-
const result = await plugin.plugin.runDevMiddleware(req, res, this.cwd);
|
242484
|
-
if (result.finished) {
|
242485
|
-
return result;
|
242486
|
-
}
|
242487
|
-
}
|
242488
|
-
return { finished: false };
|
242489
|
-
} catch (e) {
|
242490
|
-
return {
|
242491
|
-
finished: true,
|
242492
|
-
error: e,
|
242493
|
-
};
|
242494
|
-
}
|
242495
|
-
};
|
242496
|
-
*/
|
242497
242515
|
/**
|
242498
242516
|
* Serve project directory as a v2 deployment.
|
242499
242517
|
*/
|
@@ -242545,37 +242563,128 @@ class DevServer {
|
|
242545
242563
|
let statusCode;
|
242546
242564
|
let prevUrl = req.url;
|
242547
242565
|
let prevHeaders = {};
|
242548
|
-
|
242549
|
-
|
242550
|
-
|
242551
|
-
|
242552
|
-
|
242553
|
-
|
242554
|
-
|
242555
|
-
|
242556
|
-
|
242557
|
-
|
242558
|
-
|
242559
|
-
|
242560
|
-
|
242561
|
-
|
242562
|
-
|
242563
|
-
|
242564
|
-
|
242565
|
-
|
242566
|
-
|
242567
|
-
|
242568
|
-
|
242569
|
-
|
242570
|
-
|
242571
|
-
|
242572
|
-
|
242573
|
-
|
242574
|
-
|
242575
|
-
|
242576
|
-
|
242566
|
+
let middlewarePid;
|
242567
|
+
// Run the middleware file, if present, and apply any
|
242568
|
+
// mutations to the incoming request based on the
|
242569
|
+
// result of the middleware invocation.
|
242570
|
+
const middleware = [...this.buildMatches.values()].find(m => m.config?.middleware === true);
|
242571
|
+
if (middleware) {
|
242572
|
+
let startMiddlewareResult;
|
242573
|
+
// TODO: can we add some caching to prevent (re-)starting
|
242574
|
+
// the middleware server for every HTTP request?
|
242575
|
+
const { envConfigs, files, devCacheDir, cwd: workPath } = this;
|
242576
|
+
try {
|
242577
|
+
startMiddlewareResult =
|
242578
|
+
await middleware.builderWithPkg.builder.startDevServer?.({
|
242579
|
+
files,
|
242580
|
+
entrypoint: middleware.entrypoint,
|
242581
|
+
workPath,
|
242582
|
+
repoRootPath: this.cwd,
|
242583
|
+
config: middleware.config || {},
|
242584
|
+
meta: {
|
242585
|
+
isDev: true,
|
242586
|
+
devCacheDir,
|
242587
|
+
requestUrl: req.url,
|
242588
|
+
env: { ...envConfigs.runEnv },
|
242589
|
+
buildEnv: { ...envConfigs.buildEnv },
|
242590
|
+
},
|
242591
|
+
});
|
242592
|
+
if (startMiddlewareResult) {
|
242593
|
+
const { port, pid } = startMiddlewareResult;
|
242594
|
+
middlewarePid = pid;
|
242595
|
+
this.devServerPids.add(pid);
|
242596
|
+
const middlewareReqHeaders = headers_1.nodeHeadersToFetchHeaders(req.headers);
|
242597
|
+
// Add the Vercel platform proxy request headers
|
242598
|
+
const proxyHeaders = this.getProxyHeaders(req, requestId, true);
|
242599
|
+
for (const [name, value] of headers_1.nodeHeadersToFetchHeaders(proxyHeaders)) {
|
242600
|
+
middlewareReqHeaders.set(name, value);
|
242601
|
+
}
|
242602
|
+
const middlewareRes = await node_fetch_1.default(`http://127.0.0.1:${port}${parsed.path}`, {
|
242603
|
+
headers: middlewareReqHeaders,
|
242604
|
+
method: req.method,
|
242605
|
+
redirect: 'manual',
|
242606
|
+
});
|
242607
|
+
if (middlewareRes.status === 500) {
|
242608
|
+
await this.sendError(req, res, requestId, 'EDGE_FUNCTION_INVOCATION_FAILED', 500);
|
242609
|
+
return;
|
242610
|
+
}
|
242611
|
+
// Apply status code from middleware invocation,
|
242612
|
+
// for i.e. redirects or a custom 404 page
|
242613
|
+
res.statusCode = middlewareRes.status;
|
242614
|
+
let rewritePath = '';
|
242615
|
+
let contentType = '';
|
242616
|
+
let shouldContinue = false;
|
242617
|
+
const skipMiddlewareHeaders = new Set([
|
242618
|
+
'date',
|
242619
|
+
'connection',
|
242620
|
+
'content-length',
|
242621
|
+
'transfer-encoding',
|
242622
|
+
]);
|
242623
|
+
for (const [name, value] of middlewareRes.headers) {
|
242624
|
+
if (name === 'x-middleware-next') {
|
242625
|
+
shouldContinue = value === '1';
|
242626
|
+
}
|
242627
|
+
else if (name === 'x-middleware-rewrite') {
|
242628
|
+
rewritePath = value;
|
242629
|
+
shouldContinue = true;
|
242630
|
+
}
|
242631
|
+
else if (name === 'content-type') {
|
242632
|
+
contentType = value;
|
242633
|
+
}
|
242634
|
+
else if (!skipMiddlewareHeaders.has(name)) {
|
242635
|
+
// Any other kind of response header should be included
|
242636
|
+
// on both the incoming HTTP request (for when proxying
|
242637
|
+
// to another function) and the outgoing HTTP response.
|
242638
|
+
res.setHeader(name, value);
|
242639
|
+
req.headers[name] = value;
|
242640
|
+
}
|
242641
|
+
}
|
242642
|
+
if (!shouldContinue) {
|
242643
|
+
const middlewareBody = await middlewareRes.buffer();
|
242644
|
+
this.setResponseHeaders(res, requestId);
|
242645
|
+
if (middlewareBody.length > 0) {
|
242646
|
+
res.setHeader('content-length', middlewareBody.length);
|
242647
|
+
if (contentType) {
|
242648
|
+
res.setHeader('content-type', contentType);
|
242649
|
+
}
|
242650
|
+
res.end(middlewareBody);
|
242651
|
+
}
|
242652
|
+
else {
|
242653
|
+
res.end();
|
242654
|
+
}
|
242655
|
+
return;
|
242656
|
+
}
|
242657
|
+
if (rewritePath) {
|
242658
|
+
// TODO: add validation?
|
242659
|
+
debug(`Detected rewrite path from middleware: "${rewritePath}"`);
|
242660
|
+
prevUrl = rewritePath;
|
242661
|
+
// Retain orginal pathname, but override query parameters from the rewrite
|
242662
|
+
const beforeRewriteUrl = req.url || '/';
|
242663
|
+
const rewriteUrlParsed = url_1.default.parse(beforeRewriteUrl, true);
|
242664
|
+
delete rewriteUrlParsed.search;
|
242665
|
+
rewriteUrlParsed.query = url_1.default.parse(rewritePath, true).query;
|
242666
|
+
req.url = url_1.default.format(rewriteUrlParsed);
|
242667
|
+
debug(`Rewrote incoming HTTP URL from "${beforeRewriteUrl}" to "${req.url}"`);
|
242668
|
+
}
|
242669
|
+
}
|
242670
|
+
}
|
242671
|
+
catch (err) {
|
242672
|
+
// `startDevServer()` threw an error. Most likely this means the dev
|
242673
|
+
// server process exited before sending the port information message
|
242674
|
+
// (missing dependency at runtime, for example).
|
242675
|
+
if (err.code === 'ENOENT') {
|
242676
|
+
err.message = `Command not found: ${chalk_1.default.cyan(err.path, ...err.spawnargs)}\nPlease ensure that ${cmd_1.default(err.path)} is properly installed`;
|
242677
|
+
err.link = 'https://vercel.link/command-not-found';
|
242678
|
+
}
|
242679
|
+
await this.sendError(req, res, requestId, 'EDGE_FUNCTION_INVOCATION_FAILED', 500);
|
242680
|
+
return;
|
242681
|
+
}
|
242682
|
+
finally {
|
242683
|
+
if (middlewarePid) {
|
242684
|
+
this.killBuilderDevServer(middlewarePid);
|
242685
|
+
}
|
242686
|
+
}
|
242577
242687
|
}
|
242578
|
-
*/
|
242579
242688
|
for (const phase of phases) {
|
242580
242689
|
statusCode = undefined;
|
242581
242690
|
const phaseRoutes = handleMap.get(phase) || [];
|
@@ -242729,7 +242838,10 @@ class DevServer {
|
|
242729
242838
|
isDev: true,
|
242730
242839
|
requestPath,
|
242731
242840
|
devCacheDir,
|
242732
|
-
env: {
|
242841
|
+
env: {
|
242842
|
+
...envConfigs.runEnv,
|
242843
|
+
VERCEL_BUILDER_DEBUG: this.output.debugEnabled ? '1' : undefined,
|
242844
|
+
},
|
242733
242845
|
buildEnv: { ...envConfigs.buildEnv },
|
242734
242846
|
},
|
242735
242847
|
});
|
@@ -243208,7 +243320,7 @@ class DevServer {
|
|
243208
243320
|
this.output.error(errors[0].message);
|
243209
243321
|
await this.exit();
|
243210
243322
|
}
|
243211
|
-
if (warnings
|
243323
|
+
if (warnings?.length > 0) {
|
243212
243324
|
warnings.forEach(warning => this.output.warn(warning.message, null, warning.link, warning.action));
|
243213
243325
|
}
|
243214
243326
|
if (builders) {
|
@@ -243615,6 +243727,7 @@ class DevServer {
|
|
243615
243727
|
view = error_1.default({
|
243616
243728
|
http_status_code: statusCode,
|
243617
243729
|
http_status_description,
|
243730
|
+
error_code,
|
243618
243731
|
request_id: requestId,
|
243619
243732
|
});
|
243620
243733
|
}
|
@@ -243894,7 +244007,7 @@ function proxyPass(req, res, dest, devServer, requestId, ignorePath = true) {
|
|
243894
244007
|
return devServer.proxy.web(req, res, { target: dest, ignorePath }, (error) => {
|
243895
244008
|
devServer.output.error(`Failed to complete request to ${req.url}: ${error}`);
|
243896
244009
|
if (!res.headersSent) {
|
243897
|
-
devServer.sendError(req, res, requestId, '
|
244010
|
+
devServer.sendError(req, res, requestId, 'FUNCTION_INVOCATION_FAILED');
|
243898
244011
|
}
|
243899
244012
|
});
|
243900
244013
|
}
|
@@ -243946,11 +244059,12 @@ async function findBuildMatch(matches, files, requestPath, devServer, vercelConf
|
|
243946
244059
|
return match;
|
243947
244060
|
}
|
243948
244061
|
else {
|
243949
|
-
//
|
243950
|
-
|
244062
|
+
// If isIndex === true and ends in `.html`, we're done.
|
244063
|
+
// Otherwise, keep searching.
|
243951
244064
|
if (path_1.extname(match.src) === '.html') {
|
243952
|
-
return
|
244065
|
+
return match;
|
243953
244066
|
}
|
244067
|
+
bestIndexMatch = match;
|
243954
244068
|
}
|
243955
244069
|
}
|
243956
244070
|
}
|
@@ -243959,6 +244073,11 @@ async function findBuildMatch(matches, files, requestPath, devServer, vercelConf
|
|
243959
244073
|
}
|
243960
244074
|
async function shouldServe(match, files, requestPath, devServer, vercelConfig, isFilesystem = false) {
|
243961
244075
|
const { src, config, builderWithPkg: { builder }, } = match;
|
244076
|
+
// "middleware" file is not served as a regular asset,
|
244077
|
+
// instead it gets invoked as part of the routing logic.
|
244078
|
+
if (config?.middleware === true) {
|
244079
|
+
return false;
|
244080
|
+
}
|
243962
244081
|
const cleanSrc = src.endsWith('.html') ? src.slice(0, -5) : src;
|
243963
244082
|
const trimmedPath = requestPath.endsWith('/')
|
243964
244083
|
? requestPath.slice(0, -1)
|
@@ -252426,7 +252545,7 @@ module.exports = JSON.parse("{\"application/1d-interleaved-parityfec\":{\"source
|
|
252426
252545
|
/***/ ((module) => {
|
252427
252546
|
|
252428
252547
|
"use strict";
|
252429
|
-
module.exports = JSON.parse("{\"name\":\"vercel\",\"version\":\"25.
|
252548
|
+
module.exports = JSON.parse("{\"name\":\"vercel\",\"version\":\"25.2.0\",\"preferGlobal\":true,\"license\":\"Apache-2.0\",\"description\":\"The command-line interface for Vercel\",\"homepage\":\"https://vercel.com\",\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/vercel/vercel.git\",\"directory\":\"packages/cli\"},\"scripts\":{\"preinstall\":\"node ./scripts/preinstall.js\",\"test\":\"jest --env node --verbose --runInBand --bail --forceExit\",\"test-unit\":\"yarn test test/unit/\",\"test-integration-cli\":\"rimraf test/fixtures/integration && ava test/integration.js --serial --fail-fast --verbose\",\"test-integration-dev\":\"yarn test test/dev/\",\"prepublishOnly\":\"yarn build\",\"coverage\":\"codecov\",\"build\":\"node -r ts-eager/register ./scripts/build.ts\",\"build-dev\":\"node -r ts-eager/register ./scripts/build.ts --dev\"},\"bin\":{\"vc\":\"./dist/index.js\",\"vercel\":\"./dist/index.js\"},\"files\":[\"dist\",\"scripts/preinstall.js\"],\"ava\":{\"extensions\":[\"ts\"],\"require\":[\"ts-node/register/transpile-only\",\"esm\"]},\"engines\":{\"node\":\">= 14\"},\"dependencies\":{\"@vercel/build-utils\":\"4.2.0\",\"@vercel/go\":\"2.0.2\",\"@vercel/next\":\"3.1.0\",\"@vercel/node\":\"2.3.0\",\"@vercel/python\":\"3.0.2\",\"@vercel/redwood\":\"1.0.2\",\"@vercel/remix\":\"1.0.2\",\"@vercel/ruby\":\"1.3.10\",\"@vercel/static-build\":\"1.0.2\",\"update-notifier\":\"5.1.0\"},\"devDependencies\":{\"@alex_neo/jest-expect-message\":\"1.0.5\",\"@next/env\":\"11.1.2\",\"@sentry/node\":\"5.5.0\",\"@sindresorhus/slugify\":\"0.11.0\",\"@tootallnate/once\":\"1.1.2\",\"@types/ansi-escapes\":\"3.0.0\",\"@types/ansi-regex\":\"4.0.0\",\"@types/async-retry\":\"1.2.1\",\"@types/bytes\":\"3.0.0\",\"@types/chance\":\"1.1.3\",\"@types/debug\":\"0.0.31\",\"@types/dotenv\":\"6.1.1\",\"@types/escape-html\":\"0.0.20\",\"@types/express\":\"4.17.13\",\"@types/fs-extra\":\"9.0.13\",\"@types/glob\":\"7.1.1\",\"@types/http-proxy\":\"1.16.2\",\"@types/ini\":\"1.3.31\",\"@types/inquirer\":\"7.3.1\",\"@types/jest\":\"27.4.1\",\"@types/jest-expect-message\":\"1.0.3\",\"@types/load-json-file\":\"2.0.7\",\"@types/mime-types\":\"2.1.0\",\"@types/minimatch\":\"3.0.3\",\"@types/mri\":\"1.1.0\",\"@types/ms\":\"0.7.30\",\"@types/node\":\"11.11.0\",\"@types/node-fetch\":\"2.5.10\",\"@types/npm-package-arg\":\"6.1.0\",\"@types/pluralize\":\"0.0.29\",\"@types/progress\":\"2.0.3\",\"@types/psl\":\"1.1.0\",\"@types/semver\":\"6.0.1\",\"@types/tar-fs\":\"1.16.1\",\"@types/text-table\":\"0.2.0\",\"@types/title\":\"3.4.1\",\"@types/universal-analytics\":\"0.4.2\",\"@types/update-notifier\":\"5.1.0\",\"@types/which\":\"1.3.2\",\"@types/write-json-file\":\"2.2.1\",\"@types/yauzl-promise\":\"2.1.0\",\"@vercel/client\":\"12.0.2\",\"@vercel/frameworks\":\"1.0.2\",\"@vercel/ncc\":\"0.24.0\",\"@zeit/fun\":\"0.11.2\",\"@zeit/source-map-support\":\"0.6.2\",\"ajv\":\"6.12.2\",\"alpha-sort\":\"2.0.1\",\"ansi-escapes\":\"3.0.0\",\"ansi-regex\":\"3.0.0\",\"arg\":\"5.0.0\",\"async-listen\":\"1.2.0\",\"async-retry\":\"1.1.3\",\"async-sema\":\"2.1.4\",\"ava\":\"2.2.0\",\"bytes\":\"3.0.0\",\"chalk\":\"4.1.0\",\"chance\":\"1.1.7\",\"chokidar\":\"3.3.1\",\"clipboardy\":\"2.1.0\",\"codecov\":\"3.8.2\",\"cpy\":\"7.2.0\",\"credit-card\":\"3.0.1\",\"date-fns\":\"1.29.0\",\"debug\":\"3.1.0\",\"dot\":\"1.1.3\",\"dotenv\":\"4.0.0\",\"email-prompt\":\"0.3.2\",\"email-validator\":\"1.1.1\",\"epipebomb\":\"1.0.0\",\"escape-html\":\"1.0.3\",\"esm\":\"3.1.4\",\"execa\":\"3.2.0\",\"express\":\"4.17.1\",\"fast-deep-equal\":\"3.1.3\",\"fs-extra\":\"10.0.0\",\"get-port\":\"5.1.1\",\"git-last-commit\":\"1.0.1\",\"glob\":\"7.1.2\",\"http-proxy\":\"1.18.1\",\"ini\":\"3.0.0\",\"inquirer\":\"7.0.4\",\"is-docker\":\"2.2.1\",\"is-port-reachable\":\"3.1.0\",\"is-url\":\"1.2.2\",\"jaro-winkler\":\"0.2.8\",\"jsonlines\":\"0.1.1\",\"load-json-file\":\"3.0.0\",\"mime-types\":\"2.1.24\",\"minimatch\":\"3.0.4\",\"mri\":\"1.1.5\",\"ms\":\"2.1.2\",\"node-fetch\":\"2.6.1\",\"npm-package-arg\":\"6.1.0\",\"open\":\"8.4.0\",\"ora\":\"3.4.0\",\"pcre-to-regexp\":\"1.0.0\",\"pluralize\":\"7.0.0\",\"progress\":\"2.0.3\",\"promisepipe\":\"3.0.0\",\"psl\":\"1.1.31\",\"qr-image\":\"3.2.0\",\"raw-body\":\"2.4.1\",\"rimraf\":\"3.0.2\",\"semver\":\"5.5.0\",\"serve-handler\":\"6.1.1\",\"strip-ansi\":\"5.2.0\",\"stripe\":\"5.1.0\",\"tar-fs\":\"1.16.3\",\"test-listen\":\"1.1.0\",\"text-table\":\"0.2.0\",\"title\":\"3.4.1\",\"tmp-promise\":\"1.0.3\",\"tree-kill\":\"1.2.2\",\"ts-node\":\"8.3.0\",\"typescript\":\"4.3.4\",\"universal-analytics\":\"0.4.20\",\"utility-types\":\"2.1.0\",\"which\":\"2.0.2\",\"write-json-file\":\"2.2.0\",\"xdg-app-paths\":\"5.1.0\",\"yauzl-promise\":\"2.1.3\"},\"jest\":{\"preset\":\"ts-jest\",\"globals\":{\"ts-jest\":{\"diagnostics\":false,\"isolatedModules\":true}},\"setupFilesAfterEnv\":[\"@alex_neo/jest-expect-message\"],\"verbose\":false,\"testEnvironment\":\"node\",\"testMatch\":[\"<rootDir>/test/**/*.test.ts\"]},\"gitHead\":\"eed39913e1394477b224c38efe29429b17eeada6\"}");
|
252430
252549
|
|
252431
252550
|
/***/ }),
|
252432
252551
|
|
@@ -252442,7 +252561,7 @@ module.exports = JSON.parse("{\"VISA\":\"Visa\",\"MASTERCARD\":\"MasterCard\",\"
|
|
252442
252561
|
/***/ ((module) => {
|
252443
252562
|
|
252444
252563
|
"use strict";
|
252445
|
-
module.exports = JSON.parse("{\"name\":\"@vercel/client\",\"version\":\"12.0.2
|
252564
|
+
module.exports = JSON.parse("{\"name\":\"@vercel/client\",\"version\":\"12.0.2\",\"main\":\"dist/index.js\",\"typings\":\"dist/index.d.ts\",\"homepage\":\"https://vercel.com\",\"license\":\"MIT\",\"files\":[\"dist\"],\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/vercel/vercel.git\",\"directory\":\"packages/client\"},\"scripts\":{\"build\":\"tsc\",\"test-integration-once\":\"yarn test tests/create-deployment.test.ts tests/create-legacy-deployment.test.ts tests/paths.test.ts\",\"test\":\"jest --env node --verbose --runInBand --bail\",\"test-unit\":\"yarn test tests/unit.*test.*\"},\"engines\":{\"node\":\">= 14\"},\"devDependencies\":{\"@types/async-retry\":\"1.4.1\",\"@types/fs-extra\":\"7.0.0\",\"@types/jest\":\"27.4.1\",\"@types/minimatch\":\"3.0.5\",\"@types/ms\":\"0.7.30\",\"@types/node\":\"12.0.4\",\"@types/node-fetch\":\"2.5.4\",\"@types/recursive-readdir\":\"2.2.0\",\"typescript\":\"4.3.4\"},\"jest\":{\"preset\":\"ts-jest\",\"testEnvironment\":\"node\",\"verbose\":false,\"setupFilesAfterEnv\":[\"<rootDir>/tests/setup/index.ts\"]},\"dependencies\":{\"@vercel/build-utils\":\"4.2.0\",\"@zeit/fetch\":\"5.2.0\",\"async-retry\":\"1.2.3\",\"async-sema\":\"3.0.0\",\"fs-extra\":\"8.0.1\",\"ignore\":\"4.0.6\",\"minimatch\":\"5.0.1\",\"ms\":\"2.1.2\",\"node-fetch\":\"2.6.1\",\"querystring\":\"^0.2.0\",\"sleep-promise\":\"8.0.1\"},\"gitHead\":\"eed39913e1394477b224c38efe29429b17eeada6\"}");
|
252446
252565
|
|
252447
252566
|
/***/ }),
|
252448
252567
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "vercel",
|
3
|
-
"version": "25.
|
3
|
+
"version": "25.2.0",
|
4
4
|
"preferGlobal": true,
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"description": "The command-line interface for Vercel",
|
@@ -42,15 +42,15 @@
|
|
42
42
|
"node": ">= 14"
|
43
43
|
},
|
44
44
|
"dependencies": {
|
45
|
-
"@vercel/build-utils": "4.
|
46
|
-
"@vercel/go": "2.0.2
|
47
|
-
"@vercel/next": "3.0
|
48
|
-
"@vercel/node": "2.
|
49
|
-
"@vercel/python": "3.0.2
|
50
|
-
"@vercel/redwood": "1.0.2
|
51
|
-
"@vercel/remix": "1.0.2
|
52
|
-
"@vercel/ruby": "1.3.10
|
53
|
-
"@vercel/static-build": "1.0.2
|
45
|
+
"@vercel/build-utils": "4.2.0",
|
46
|
+
"@vercel/go": "2.0.2",
|
47
|
+
"@vercel/next": "3.1.0",
|
48
|
+
"@vercel/node": "2.3.0",
|
49
|
+
"@vercel/python": "3.0.2",
|
50
|
+
"@vercel/redwood": "1.0.2",
|
51
|
+
"@vercel/remix": "1.0.2",
|
52
|
+
"@vercel/ruby": "1.3.10",
|
53
|
+
"@vercel/static-build": "1.0.2",
|
54
54
|
"update-notifier": "5.1.0"
|
55
55
|
},
|
56
56
|
"devDependencies": {
|
@@ -95,8 +95,8 @@
|
|
95
95
|
"@types/which": "1.3.2",
|
96
96
|
"@types/write-json-file": "2.2.1",
|
97
97
|
"@types/yauzl-promise": "2.1.0",
|
98
|
-
"@vercel/client": "12.0.2
|
99
|
-
"@vercel/frameworks": "1.0.2
|
98
|
+
"@vercel/client": "12.0.2",
|
99
|
+
"@vercel/frameworks": "1.0.2",
|
100
100
|
"@vercel/ncc": "0.24.0",
|
101
101
|
"@zeit/fun": "0.11.2",
|
102
102
|
"@zeit/source-map-support": "0.6.2",
|
@@ -194,5 +194,5 @@
|
|
194
194
|
"<rootDir>/test/**/*.test.ts"
|
195
195
|
]
|
196
196
|
},
|
197
|
-
"gitHead": "
|
197
|
+
"gitHead": "eed39913e1394477b224c38efe29429b17eeada6"
|
198
198
|
}
|