1
mirror of https://github.com/thepeacockproject/Peacock synced 2024-11-22 22:12:45 +01:00

Fixes to the express patch

Signed-off-by: Reece Dunham <me@rdil.rocks>
This commit is contained in:
Reece Dunham 2022-12-15 20:40:49 -05:00
parent 819ee16876
commit 9e6e5dd4ed
No known key found for this signature in database
GPG Key ID: 0D7E929D2089E040
7 changed files with 448 additions and 765 deletions

View File

@ -1,33 +1,25 @@
diff --git a/lib/application.js b/lib/application.js diff --git a/lib/application.js b/lib/application.js
index ebb30b51b3d6e84d33288251d11ab92d8462c181..cdc9b97c7b625e03673aba29bf12131410ee8382 100644 index ebb30b51b3d6e84d33288251d11ab92d8462c181..082dc2b8ea4a92429cb6948adf56d269a853cc15 100644
--- a/lib/application.js --- a/lib/application.js
+++ b/lib/application.js +++ b/lib/application.js
@@ -18,24 +18,8 @@ var Router = require('./router'); @@ -19,16 +19,10 @@ var methods = require('methods');
var methods = require('methods');
var middleware = require('./middleware/init'); var middleware = require('./middleware/init');
var query = require('./middleware/query'); var query = require('./middleware/query');
-var debug = require('debug')('express:application'); var debug = require('debug')('express:application');
-var View = require('./view'); -var View = require('./view');
-var http = require('http'); var http = require('http');
var compileETag = require('./utils').compileETag; var compileETag = require('./utils').compileETag;
-var compileQueryParser = require('./utils').compileQueryParser; var compileQueryParser = require('./utils').compileQueryParser;
-var compileTrust = require('./utils').compileTrust; -var compileTrust = require('./utils').compileTrust;
-var deprecate = require('depd')('express'); -var deprecate = require('depd')('express');
var flatten = require('array-flatten'); var flatten = require('array-flatten');
-var merge = require('utils-merge'); -var merge = require('utils-merge');
-var resolve = require('path').resolve; -var resolve = require('path').resolve;
-var setPrototypeOf = require('setprototypeof') -var setPrototypeOf = require('setprototypeof')
-
-/**
- * Module variables.
- * @private
- */
-
-var hasOwnProperty = Object.prototype.hasOwnProperty
var slice = Array.prototype.slice;
/** /**
@@ -44,13 +28,6 @@ var slice = Array.prototype.slice; * Module variables.
@@ -44,13 +38,6 @@ var slice = Array.prototype.slice;
var app = exports = module.exports = {}; var app = exports = module.exports = {};
@ -41,27 +33,15 @@ index ebb30b51b3d6e84d33288251d11ab92d8462c181..cdc9b97c7b625e03673aba29bf121314
/** /**
* Initialize the server. * Initialize the server.
* *
@@ -62,8 +39,6 @@ var trustProxyDefaultSymbol = '@@symbol:trust_proxy_default'; @@ -78,34 +65,17 @@ app.defaultConfiguration = function defaultConfiguration() {
*/ var env = process.env.NODE_ENV || 'development';
app.init = function init() {
- this.cache = {};
- this.engines = {};
this.settings = {};
this.defaultConfiguration();
@@ -75,62 +50,17 @@ app.init = function init() {
*/
app.defaultConfiguration = function defaultConfiguration() {
- var env = process.env.NODE_ENV || 'development';
-
// default settings // default settings
- this.enable('x-powered-by'); - this.enable('x-powered-by');
this.set('etag', 'weak'); this.set('etag', 'weak');
- this.set('env', env); this.set('env', env);
- this.set('query parser', 'extended'); - this.set('query parser', 'extended');
- this.set('subdomain offset', 2); this.set('subdomain offset', 2);
- this.set('trust proxy', false); - this.set('trust proxy', false);
- -
- // trust proxy inherit back-compat - // trust proxy inherit back-compat
@ -69,8 +49,8 @@ index ebb30b51b3d6e84d33288251d11ab92d8462c181..cdc9b97c7b625e03673aba29bf121314
- configurable: true, - configurable: true,
- value: true - value: true
- }); - });
-
- debug('booting in %s mode', env); debug('booting in %s mode', env);
this.on('mount', function onmount(parent) { this.on('mount', function onmount(parent) {
- // inherit trust proxy - // inherit trust proxy
@ -87,16 +67,14 @@ index ebb30b51b3d6e84d33288251d11ab92d8462c181..cdc9b97c7b625e03673aba29bf121314
- setPrototypeOf(this.settings, parent.settings) - setPrototypeOf(this.settings, parent.settings)
+ Object.setPrototypeOf(this.request, parent.request) + Object.setPrototypeOf(this.request, parent.request)
+ Object.setPrototypeOf(this.response, parent.response) + Object.setPrototypeOf(this.response, parent.response)
+ Object.setPrototypeOf(this.settings, parent.settings)
}); });
- // setup locals // setup locals
- this.locals = Object.create(null); @@ -116,21 +86,6 @@ app.defaultConfiguration = function defaultConfiguration() {
-
// top-most app is mounted at / // default locals
this.mountpath = '/'; this.locals.settings = this.settings;
-
- // default locals
- this.locals.settings = this.settings;
- -
- // default configuration - // default configuration
- this.set('view', View); - this.set('view', View);
@ -115,43 +93,7 @@ index ebb30b51b3d6e84d33288251d11ab92d8462c181..cdc9b97c7b625e03673aba29bf121314
}; };
/** /**
@@ -148,7 +78,7 @@ app.lazyrouter = function lazyrouter() { @@ -263,56 +218,6 @@ app.route = function route(path) {
strict: this.enabled('strict routing')
});
- this._router.use(query(this.get('query parser fn')));
+ this._router.use(query());
this._router.use(middleware.init(this));
}
};
@@ -173,7 +103,6 @@ app.handle = function handle(req, res, callback) {
// no routes
if (!router) {
- debug('no routes defined on app');
done();
return;
}
@@ -227,7 +156,6 @@ app.use = function use(fn) {
return router.use(path, fn);
}
- debug('.use app under %s', path);
fn.mountpath = path;
fn.parent = this;
@@ -235,8 +163,8 @@ app.use = function use(fn) {
router.use(path, function mounted_app(req, res, next) {
var orig = req.app;
fn.handle(req, res, function (err) {
- setPrototypeOf(req, orig.request)
- setPrototypeOf(res, orig.response)
+ Object.setPrototypeOf(req, orig.request)
+ Object.setPrototypeOf(res, orig.response)
next(err);
});
});
@@ -263,84 +191,6 @@ app.route = function route(path) {
return this._router.route(path); return this._router.route(path);
}; };
@ -204,69 +146,14 @@ index ebb30b51b3d6e84d33288251d11ab92d8462c181..cdc9b97c7b625e03673aba29bf121314
- -
- return this; - return this;
-}; -};
-
-/**
- * Proxy to `Router#param()` with one added api feature. The _name_ parameter
- * can be an array of names.
- *
- * See the Router#param() docs for more details.
- *
- * @param {String|Array} name
- * @param {Function} fn
- * @return {app} for chaining
- * @public
- */
-
-app.param = function param(name, fn) {
- this.lazyrouter();
-
- if (Array.isArray(name)) {
- for (var i = 0; i < name.length; i++) {
- this.param(name[i], fn);
- }
-
- return this;
- }
-
- this._router.param(name, fn);
-
- return this;
-};
- -
/** /**
* Assign `setting` to `val`, or return `setting`'s value. * Proxy to `Router#param()` with one added api feature. The _name_ parameter
* * can be an array of names.
@@ -359,67 +209,20 @@ app.param = function param(name, fn) { @@ -384,16 +289,6 @@ app.set = function set(setting, val) {
app.set = function set(setting, val) { break;
if (arguments.length === 1) { case 'query parser':
// app.get(setting) this.set('query parser fn', compileQueryParser(val));
- var settings = this.settings
-
- while (settings && settings !== Object.prototype) {
- if (hasOwnProperty.call(settings, setting)) {
- return settings[setting]
- }
-
- settings = Object.getPrototypeOf(settings)
- }
-
- return undefined
+ return this.settings[setting];
}
- debug('set "%s" to %o', setting, val);
-
// set value
this.settings[setting] = val;
// trigger matched settings
- switch (setting) {
- case 'etag':
+ if (setting === 'etag') {
this.set('etag fn', compileETag(val));
- break;
- case 'query parser':
- this.set('query parser fn', compileQueryParser(val));
- break; - break;
- case 'trust proxy': - case 'trust proxy':
- this.set('trust proxy fn', compileTrust(val)); - this.set('trust proxy fn', compileTrust(val));
@ -277,67 +164,10 @@ index ebb30b51b3d6e84d33288251d11ab92d8462c181..cdc9b97c7b625e03673aba29bf121314
- value: false - value: false
- }); - });
- -
- break; break;
} }
return this; @@ -524,91 +419,6 @@ app.all = function all(path) {
};
-/**
- * Return the app's absolute pathname
- * based on the parent(s) that have
- * mounted it.
- *
- * For example if the application was
- * mounted as "/admin", which itself
- * was mounted as "/blog" then the
- * return value would be "/blog/admin".
- *
- * @return {String}
- * @private
- */
-
-app.path = function path() {
- return this.parent
- ? this.parent.path() + this.mountpath
- : '';
-};
-
/**
* Check if `setting` is enabled (truthy).
*
@@ -458,30 +261,6 @@ app.disabled = function disabled(setting) {
return !this.set(setting);
};
-/**
- * Enable `setting`.
- *
- * @param {String} setting
- * @return {app} for chaining
- * @public
- */
-
-app.enable = function enable(setting) {
- return this.set(setting, true);
-};
-
-/**
- * Disable `setting`.
- *
- * @param {String} setting
- * @return {app} for chaining
- * @public
- */
-
-app.disable = function disable(setting) {
- return this.set(setting, false);
-};
-
/**
* Delegate `.VERB(...)` calls to `router.VERB(...)`.
*/
@@ -524,117 +303,6 @@ app.all = function all(path) {
return this; return this;
}; };
@ -425,43 +255,14 @@ index ebb30b51b3d6e84d33288251d11ab92d8462c181..cdc9b97c7b625e03673aba29bf121314
- // render - // render
- tryRender(view, renderOptions, done); - tryRender(view, renderOptions, done);
-}; -};
-
-/**
- * Listen for connections.
- *
- * A node `http.Server` is returned, with this
- * application (which is a `Function`) as its
- * callback. If you wish to create both an HTTP
- * and HTTPS server you may do so with the "http"
- * and "https" modules as shown here:
- *
- * var http = require('http')
- * , https = require('https')
- * , express = require('express')
- * , app = express();
- *
- * http.createServer(app).listen(80);
- * https.createServer({ ... }, app).listen(443);
- *
- * @return {http.Server}
- * @public
- */
-
-app.listen = function listen() {
- var server = http.createServer(this);
- return server.listen.apply(server, arguments);
-};
- -
/** /**
* Log error using console.error. * Listen for connections.
* *
@@ -643,19 +311,5 @@ app.listen = function listen() { @@ -646,16 +456,3 @@ function logerror(err) {
*/ /* istanbul ignore next */
if (this.get('env') !== 'test') console.error(err.stack || err.toString());
function logerror(err) { }
- /* istanbul ignore next */
- if (this.get('env') !== 'test') console.error(err.stack || err.toString());
-}
- -
-/** -/**
- * Try rendering a view. - * Try rendering a view.
@ -474,8 +275,7 @@ index ebb30b51b3d6e84d33288251d11ab92d8462c181..cdc9b97c7b625e03673aba29bf121314
- } catch (err) { - } catch (err) {
- callback(err); - callback(err);
- } - }
+ console.error(err.stack || err.toString()); -}
}
diff --git a/lib/express.js b/lib/express.js diff --git a/lib/express.js b/lib/express.js
index d188a16db70387967e0f913c2ee7c0bf9f7ffb09..eb07f8ca0fffa306fb507ad63e7123a4930dbec4 100644 index d188a16db70387967e0f913c2ee7c0bf9f7ffb09..eb07f8ca0fffa306fb507ad63e7123a4930dbec4 100644
--- a/lib/express.js --- a/lib/express.js
@ -1009,14 +809,13 @@ index 3f1eeca6c1ac502dfb12ae0144a3a5cced4f34a3..fb889be9bee5f61dab4a362a65c423e8
* Helper function for creating a getter on an object. * Helper function for creating a getter on an object.
* *
diff --git a/lib/response.js b/lib/response.js diff --git a/lib/response.js b/lib/response.js
index fede486c06d8c96f8d565b3c1d70c2585033a69c..c0fef51dd0b755e33ae452c4be841b2b91e8d233 100644 index fede486c06d8c96f8d565b3c1d70c2585033a69c..2c0298a966a2221dc4b81c78288fc06869b1b3fb 100644
--- a/lib/response.js --- a/lib/response.js
+++ b/lib/response.js +++ b/lib/response.js
@@ -12,28 +12,10 @@ @@ -13,27 +13,11 @@
* @private
*/ */
-var Buffer = require('safe-buffer').Buffer var Buffer = require('safe-buffer').Buffer
-var contentDisposition = require('content-disposition'); -var contentDisposition = require('content-disposition');
-var createError = require('http-errors') -var createError = require('http-errors')
-var deprecate = require('depd')('express'); -var deprecate = require('depd')('express');
@ -1033,16 +832,15 @@ index fede486c06d8c96f8d565b3c1d70c2585033a69c..c0fef51dd0b755e33ae452c4be841b2b
-var normalizeTypes = require('./utils').normalizeTypes; -var normalizeTypes = require('./utils').normalizeTypes;
var setCharset = require('./utils').setCharset; var setCharset = require('./utils').setCharset;
-var cookie = require('cookie'); -var cookie = require('cookie');
-var send = require('send'); var send = require('send');
-var extname = path.extname; -var extname = path.extname;
-var mime = send.mime; var mime = send.mime;
-var resolve = path.resolve; -var resolve = path.resolve;
-var vary = require('vary'); -var vary = require('vary');
+var mime = require("mime");
/** /**
* Response prototype. * Response prototype.
@@ -65,36 +47,10 @@ var charsetRegExp = /;\s*charset\s*=/; @@ -65,36 +49,10 @@ var charsetRegExp = /;\s*charset\s*=/;
*/ */
res.status = function status(code) { res.status = function status(code) {
@ -1079,7 +877,7 @@ index fede486c06d8c96f8d565b3c1d70c2585033a69c..c0fef51dd0b755e33ae452c4be841b2b
/** /**
* Send a response. * Send a response.
* *
@@ -121,10 +77,8 @@ res.send = function send(body) { @@ -121,10 +79,8 @@ res.send = function send(body) {
if (arguments.length === 2) { if (arguments.length === 2) {
// res.send(body, status) backwards compat // res.send(body, status) backwards compat
if (typeof arguments[0] !== 'number' && typeof arguments[1] === 'number') { if (typeof arguments[0] !== 'number' && typeof arguments[1] === 'number') {
@ -1090,7 +888,7 @@ index fede486c06d8c96f8d565b3c1d70c2585033a69c..c0fef51dd0b755e33ae452c4be841b2b
this.statusCode = arguments[0]; this.statusCode = arguments[0];
chunk = arguments[1]; chunk = arguments[1];
} }
@@ -137,7 +91,6 @@ res.send = function send(body) { @@ -137,7 +93,6 @@ res.send = function send(body) {
this.type('txt'); this.type('txt');
} }
@ -1098,22 +896,10 @@ index fede486c06d8c96f8d565b3c1d70c2585033a69c..c0fef51dd0b755e33ae452c4be841b2b
this.statusCode = chunk; this.statusCode = chunk;
chunk = statuses.message[chunk] chunk = statuses.message[chunk]
} }
@@ -206,9 +159,6 @@ res.send = function send(body) { @@ -252,58 +207,7 @@ res.json = function json(obj) {
}
}
- // freshness // allow status / body
- if (req.fresh) this.statusCode = 304; if (arguments.length === 2) {
-
// strip irrelevant headers
if (204 === this.statusCode || 304 === this.statusCode) {
this.removeHeader('Content-Type');
@@ -250,25 +200,8 @@ res.send = function send(body) {
res.json = function json(obj) {
var val = obj;
- // allow status / body
- if (arguments.length === 2) {
- // res.json(body, status) backwards compat - // res.json(body, status) backwards compat
- if (typeof arguments[1] === 'number') { - if (typeof arguments[1] === 'number') {
- deprecate('res.json(obj, status): Use res.status(status).json(obj) instead'); - deprecate('res.json(obj, status): Use res.status(status).json(obj) instead');
@ -1125,20 +911,21 @@ index fede486c06d8c96f8d565b3c1d70c2585033a69c..c0fef51dd0b755e33ae452c4be841b2b
- } - }
- } - }
- -
// settings - // settings
- var app = this.app; - var app = this.app;
- var escape = app.get('json escape') - var escape = app.get('json escape')
- var replacer = app.get('json replacer'); - var replacer = app.get('json replacer');
- var spaces = app.get('json spaces'); - var spaces = app.get('json spaces');
- var body = stringify(val, replacer, spaces, escape) - var body = stringify(val, replacer, spaces, escape)
+ var body = JSON.stringify(val) -
- // content-type
// content-type - if (!this.get('Content-Type')) {
if (!this.get('Content-Type')) { - this.set('Content-Type', 'application/json');
@@ -278,79 +211,6 @@ res.json = function json(obj) { - }
return this.send(body); -
}; - return this.send(body);
-};
-
-/** -/**
- * Send JSON response with JSONP callback support. - * Send JSON response with JSONP callback support.
- * - *
@ -1165,22 +952,22 @@ index fede486c06d8c96f8d565b3c1d70c2585033a69c..c0fef51dd0b755e33ae452c4be841b2b
- this.statusCode = arguments[0]; - this.statusCode = arguments[0];
- val = arguments[1]; - val = arguments[1];
- } - }
- } + throw new Error("status not supported")
- }
- // settings
- var app = this.app; // settings
- var escape = app.get('json escape') @@ -312,42 +216,12 @@ res.jsonp = function jsonp(obj) {
- var replacer = app.get('json replacer'); var replacer = app.get('json replacer');
- var spaces = app.get('json spaces'); var spaces = app.get('json spaces');
- var body = stringify(val, replacer, spaces, escape) var body = stringify(val, replacer, spaces, escape)
- var callback = this.req.query[app.get('jsonp callback name')]; - var callback = this.req.query[app.get('jsonp callback name')];
-
- // content-type // content-type
- if (!this.get('Content-Type')) { if (!this.get('Content-Type')) {
- this.set('X-Content-Type-Options', 'nosniff'); - this.set('X-Content-Type-Options', 'nosniff');
- this.set('Content-Type', 'application/json'); this.set('Content-Type', 'application/json');
- } }
-
- // fixup callback - // fixup callback
- if (Array.isArray(callback)) { - if (Array.isArray(callback)) {
- callback = callback[0]; - callback = callback[0];
@ -1209,13 +996,10 @@ index fede486c06d8c96f8d565b3c1d70c2585033a69c..c0fef51dd0b755e33ae452c4be841b2b
- body = '/**/ typeof ' + callback + ' === \'function\' && ' + callback + '(' + body + ');'; - body = '/**/ typeof ' + callback + ' === \'function\' && ' + callback + '(' + body + ');';
- } - }
- -
- return this.send(body); return this.send(body);
-}; };
-
/** @@ -375,229 +249,6 @@ res.sendStatus = function sendStatus(statusCode) {
* Send given HTTP status code.
*
@@ -375,229 +235,6 @@ res.sendStatus = function sendStatus(statusCode) {
return this.send(body); return this.send(body);
}; };
@ -1445,7 +1229,7 @@ index fede486c06d8c96f8d565b3c1d70c2585033a69c..c0fef51dd0b755e33ae452c4be841b2b
/** /**
* Set _Content-Type_ response header with `type` through `mime.lookup()` * Set _Content-Type_ response header with `type` through `mime.lookup()`
* when it does not contain "/", or set the Content-Type to `type` otherwise. * when it does not contain "/", or set the Content-Type to `type` otherwise.
@@ -624,137 +261,6 @@ res.type = function contentType(type) { @@ -624,137 +275,6 @@ res.type = function contentType(type) {
return this.set('Content-Type', ct); return this.set('Content-Type', ct);
}; };
@ -1583,11 +1367,10 @@ index fede486c06d8c96f8d565b3c1d70c2585033a69c..c0fef51dd0b755e33ae452c4be841b2b
/** /**
* Set header `field` to `val`, or pass * Set header `field` to `val`, or pass
* an object of header fields. * an object of header fields.
@@ -811,359 +317,3 @@ res.header = function header(field, val) { @@ -812,324 +332,6 @@ res.get = function(field){
res.get = function(field){
return this.getHeader(field); return this.getHeader(field);
}; };
-
-/** -/**
- * Clear cookie `name`. - * Clear cookie `name`.
- * - *
@ -1906,52 +1689,17 @@ index fede486c06d8c96f8d565b3c1d70c2585033a69c..c0fef51dd0b755e33ae452c4be841b2b
- file.pipe(res); - file.pipe(res);
-} -}
- -
-/** /**
- * Stringify JSON, like JSON.stringify, but v8 optimized, with the * Stringify JSON, like JSON.stringify, but v8 optimized, with the
- * ability to escape characters that can trigger HTML sniffing. * ability to escape characters that can trigger HTML sniffing.
- *
- * @param {*} value
- * @param {function} replacer
- * @param {number} spaces
- * @param {boolean} escape
- * @returns {string}
- * @private
- */
-
-function stringify (value, replacer, spaces, escape) {
- // v8 checks arguments.length for optimizing simple call
- // https://bugs.chromium.org/p/v8/issues/detail?id=4730
- var json = replacer || spaces
- ? JSON.stringify(value, replacer, spaces)
- : JSON.stringify(value);
-
- if (escape && typeof json === 'string') {
- json = json.replace(/[<>&]/g, function (c) {
- switch (c.charCodeAt(0)) {
- case 0x3c:
- return '\\u003c'
- case 0x3e:
- return '\\u003e'
- case 0x26:
- return '\\u0026'
- /* istanbul ignore next: unreachable default */
- default:
- return c
- }
- })
- }
-
- return json
-}
diff --git a/lib/router/index.js b/lib/router/index.js diff --git a/lib/router/index.js b/lib/router/index.js
index 5174c34f455a1553c6065fee4425f153d37d84b2..220e0ed0bcc656619dc745c9cd9f6c2a09692f77 100644 index 5174c34f455a1553c6065fee4425f153d37d84b2..799beaa4127c9c8bef75dffb1e5beac4573e46e8 100644
--- a/lib/router/index.js --- a/lib/router/index.js
+++ b/lib/router/index.js +++ b/lib/router/index.js
@@ -17,11 +17,8 @@ var Route = require('./route'); @@ -18,10 +18,8 @@ var Layer = require('./layer');
var Layer = require('./layer');
var methods = require('methods'); var methods = require('methods');
var mixin = require('utils-merge'); var mixin = require('utils-merge');
-var debug = require('debug')('express:router'); var debug = require('debug')('express:router');
-var deprecate = require('depd')('express'); -var deprecate = require('depd')('express');
var flatten = require('array-flatten'); var flatten = require('array-flatten');
var parseUrl = require('parseurl'); var parseUrl = require('parseurl');
@ -1959,7 +1707,7 @@ index 5174c34f455a1553c6065fee4425f153d37d84b2..220e0ed0bcc656619dc745c9cd9f6c2a
/** /**
* Module variables. * Module variables.
@@ -48,7 +45,7 @@ var proto = module.exports = function(options) { @@ -48,7 +46,7 @@ var proto = module.exports = function(options) {
} }
// mixin Router class functions // mixin Router class functions
@ -1968,108 +1716,27 @@ index 5174c34f455a1553c6065fee4425f153d37d84b2..220e0ed0bcc656619dc745c9cd9f6c2a
router.params = {}; router.params = {};
router._params = []; router._params = [];
@@ -97,7 +94,6 @@ var proto = module.exports = function(options) { @@ -97,9 +95,7 @@ var proto = module.exports = function(options) {
proto.param = function param(name, fn) { proto.param = function param(name, fn) {
// param logic // param logic
if (typeof name === 'function') { if (typeof name === 'function') {
- deprecate('router.param(fn): Refactor to use path params'); - deprecate('router.param(fn): Refactor to use path params');
this._params.push(name); - this._params.push(name);
return; - return;
+ throw new Error('router.param(fn): Refactor to use path params');
} }
@@ -108,7 +104,6 @@ proto.param = function param(name, fn) {
// apply param functions
@@ -108,8 +104,7 @@ proto.param = function param(name, fn) {
var ret; var ret;
if (name[0] === ':') { if (name[0] === ':') {
- deprecate('router.param(' + JSON.stringify(name) + ', fn): Use router.param(' + JSON.stringify(name.slice(1)) + ', fn) instead') - deprecate('router.param(' + JSON.stringify(name) + ', fn): Use router.param(' + JSON.stringify(name.slice(1)) + ', fn) instead')
name = name.slice(1) - name = name.slice(1)
+ throw new Error('router.param(' + JSON.stringify(name) + ', fn): Use router.param(' + JSON.stringify(name.slice(1)) + ', fn) instead')
} }
@@ -136,8 +131,6 @@ proto.param = function param(name, fn) { for (var i = 0; i < len; ++i) {
proto.handle = function handle(req, res, out) {
var self = this;
- debug('dispatching %s %s', req.method, req.url);
-
var idx = 0;
var protohost = getProtohost(req.url) || ''
var removed = '';
@@ -304,7 +297,6 @@ proto.handle = function handle(req, res, out) {
// Trim off the part of the url that matches the route
// middleware (.use stuff) needs to have the path stripped
- debug('trim prefix (%s) from url %s', layerPath, req.url);
removed = layerPath;
req.url = protohost + req.url.slice(protohost.length + removed.length)
@@ -320,8 +312,6 @@ proto.handle = function handle(req, res, out) {
: removed);
}
- debug('%s %s : %s', layer.name, layerPath, req.originalUrl);
-
if (layerError) {
layer.handle_error(layerError, req, res, next);
} else {
@@ -469,9 +459,6 @@ proto.use = function use(fn) {
throw new TypeError('Router.use() requires a middleware function but got a ' + gettype(fn))
}
- // add the middleware
- debug('use %o %s', path, fn.name || '<anonymous>')
-
var layer = new Layer(path, {
sensitive: this.caseSensitive,
strict: false,
diff --git a/lib/router/layer.js b/lib/router/layer.js
index 4dc8e86d4f7fac6a5849ec236359e2300b4e3654..ec0b4d09e20ecf8b648a1b19178e1442e9d31acc 100644
--- a/lib/router/layer.js
+++ b/lib/router/layer.js
@@ -14,7 +14,6 @@
*/
var pathRegexp = require('path-to-regexp');
-var debug = require('debug')('express:router:layer');
/**
* Module variables.
@@ -35,7 +34,6 @@ function Layer(path, options, fn) {
return new Layer(path, options, fn);
}
- debug('new %o', path)
var opts = options || {};
this.handle = fn;
diff --git a/lib/router/route.js b/lib/router/route.js
index 5adaa125e27ac1caf94d675133e8dc556143022d..6b8d12852c10d5008a3ae9af2a1e9e0005f67168 100644
--- a/lib/router/route.js
+++ b/lib/router/route.js
@@ -13,7 +13,6 @@
* @private
*/
-var debug = require('debug')('express:router:route');
var flatten = require('array-flatten');
var Layer = require('./layer');
var methods = require('methods');
@@ -44,8 +43,6 @@ function Route(path) {
this.path = path;
this.stack = [];
- debug('new %o', path)
-
// route handlers for various http methods
this.methods = {};
}
@@ -211,8 +208,6 @@ methods.forEach(function(method){
throw new Error(msg);
}
- debug('%s %o', method, this.path)
-
var layer = Layer('/', {}, handle);
layer.method = method;
diff --git a/lib/utils.js b/lib/utils.js diff --git a/lib/utils.js b/lib/utils.js
index 799a6a2b4ee4672c7662a2951b5cdcc1b2413a28..309224d69fea3daeeeeaa9a718b5bcbdc70e7327 100644 index 799a6a2b4ee4672c7662a2951b5cdcc1b2413a28..309224d69fea3daeeeeaa9a718b5bcbdc70e7327 100644
--- a/lib/utils.js --- a/lib/utils.js

548
.yarn/releases/yarn-4.0.0-rc.31.cjs → .yarn/releases/yarn-4.0.0-rc.33.cjs generated vendored Normal file → Executable file

File diff suppressed because one or more lines are too long

View File

@ -12,4 +12,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-outdated.cjs - path: .yarn/plugins/@yarnpkg/plugin-outdated.cjs
spec: "https://mskelton.dev/yarn-outdated/v2" spec: "https://mskelton.dev/yarn-outdated/v2"
yarnPath: .yarn/releases/yarn-4.0.0-rc.31.cjs yarnPath: .yarn/releases/yarn-4.0.0-rc.33.cjs

View File

@ -129,7 +129,7 @@ app.get("/", (req: Request, res) => {
if (PEACOCK_DEV) { if (PEACOCK_DEV) {
res.contentType("text/html") res.contentType("text/html")
res.send( res.send(
'<html> PEACOCK_DEV active, please run "yarn webui start" to start the web UI on port 3000 and access it there. </html>', '<html lang="en">PEACOCK_DEV active, please run "yarn webui start" to start the web UI on port 3000 and access it there.</html>',
) )
} else { } else {
const data = readFileSync("webui/dist/index.html").toString() const data = readFileSync("webui/dist/index.html").toString()

View File

@ -43,7 +43,7 @@
"clipanion": "^3.2.0-rc.14", "clipanion": "^3.2.0-rc.14",
"commander": "^9.4.1", "commander": "^9.4.1",
"esbuild-wasm": "^0.16.7", "esbuild-wasm": "^0.16.7",
"express": "patch:express@npm%3A4.18.2#~/.yarn/patches/express-npm-4.18.1-842e583ae1.patch", "express": "patch:express@npm%3A4.18.2#~/.yarn/patches/express-npm-4.18.2-bb15ff679a.patch",
"jest-diff": "^29.2.1", "jest-diff": "^29.2.1",
"js-ini": "^1.5.1", "js-ini": "^1.5.1",
"json5": "^2.2.1", "json5": "^2.2.1",
@ -85,8 +85,8 @@
"ms": "^2.1.3", "ms": "^2.1.3",
"prettier": "^2.8.1", "prettier": "^2.8.1",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"terser": "^5.15.0", "terser": "^5.16.1",
"typescript": "4.9.3" "typescript": "4.9.4"
}, },
"engines": { "engines": {
"node": "18.x", "node": "18.x",
@ -96,5 +96,5 @@
"webui", "webui",
"packaging/typedefs" "packaging/typedefs"
], ],
"packageManager": "yarn@4.0.0-rc.31" "packageManager": "yarn@4.0.0-rc.33"
} }

View File

@ -24,7 +24,7 @@
"@types/react-dom": "^18.0.6", "@types/react-dom": "^18.0.6",
"@types/url-parse": "^1.4.8", "@types/url-parse": "^1.4.8",
"rollup-plugin-license": "^3.0.1", "rollup-plugin-license": "^3.0.1",
"typescript": "4.9.3", "typescript": "4.9.4",
"vite": "^4.0.1" "vite": "^4.0.1"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -434,7 +434,7 @@ __metadata:
eslint-plugin-prettier: "npm:^4.2.1" eslint-plugin-prettier: "npm:^4.2.1"
eslint-plugin-promise: "npm:^6.1.1" eslint-plugin-promise: "npm:^6.1.1"
eslint-plugin-react-hooks: "npm:^4.6.0" eslint-plugin-react-hooks: "npm:^4.6.0"
express: "patch:express@npm%3A4.18.2#~/.yarn/patches/express-npm-4.18.1-842e583ae1.patch" express: "patch:express@npm%3A4.18.2#~/.yarn/patches/express-npm-4.18.2-bb15ff679a.patch"
glob: "npm:^8.0.3" glob: "npm:^8.0.3"
jest-diff: "npm:^29.2.1" jest-diff: "npm:^29.2.1"
js-ini: "npm:^1.5.1" js-ini: "npm:^1.5.1"
@ -454,8 +454,8 @@ __metadata:
rimraf: "npm:^3.0.2" rimraf: "npm:^3.0.2"
send: "npm:0.18.0" send: "npm:0.18.0"
serve-static: "npm:^1.15.0" serve-static: "npm:^1.15.0"
terser: "npm:^5.15.0" terser: "npm:^5.16.1"
typescript: "npm:4.9.3" typescript: "npm:4.9.4"
languageName: unknown languageName: unknown
linkType: soft linkType: soft
@ -482,7 +482,7 @@ __metadata:
react-dom: "npm:^18.2.0" react-dom: "npm:^18.2.0"
rollup-plugin-license: "npm:^3.0.1" rollup-plugin-license: "npm:^3.0.1"
swr: "npm:^1.3.0" swr: "npm:^1.3.0"
typescript: "npm:4.9.3" typescript: "npm:4.9.4"
vite: "npm:^4.0.1" vite: "npm:^4.0.1"
peerDependencies: peerDependencies:
rollup: "*" rollup: "*"
@ -1935,9 +1935,9 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"express@patch:express@npm%3A4.18.2#~/.yarn/patches/express-npm-4.18.1-842e583ae1.patch": "express@patch:express@npm%3A4.18.2#~/.yarn/patches/express-npm-4.18.2-bb15ff679a.patch":
version: 4.18.2 version: 4.18.2
resolution: "express@patch:express@npm%3A4.18.2#~/.yarn/patches/express-npm-4.18.1-842e583ae1.patch::version=4.18.2&hash=6b0b4b" resolution: "express@patch:express@npm%3A4.18.2#~/.yarn/patches/express-npm-4.18.2-bb15ff679a.patch::version=4.18.2&hash=b48ff2"
dependencies: dependencies:
accepts: "npm:~1.3.8" accepts: "npm:~1.3.8"
array-flatten: "npm:1.1.1" array-flatten: "npm:1.1.1"
@ -1970,7 +1970,7 @@ __metadata:
type-is: "npm:~1.6.18" type-is: "npm:~1.6.18"
utils-merge: "npm:1.0.1" utils-merge: "npm:1.0.1"
vary: "npm:~1.1.2" vary: "npm:~1.1.2"
checksum: e58d82dc3a6daa31a9fa77b18d5fb5ce37059b8c4a3c122564d397e40f90b56a4bd1f9aebd64d4bc75758c5dc8fd7deff82605c78355eab9db606cbdac6d4eef checksum: 68a0d558b43b6e5a68e623a482a51ede73bd1602572990791dc4e49b1fd93428848fbc2e51cce4a5098cf3eca07d3ab8b7e409422186c203d945954353531589
languageName: node languageName: node
linkType: hard linkType: hard
@ -4227,9 +4227,9 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"terser@npm:^5.15.0": "terser@npm:^5.16.1":
version: 5.15.1 version: 5.16.1
resolution: "terser@npm:5.15.1" resolution: "terser@npm:5.16.1"
dependencies: dependencies:
"@jridgewell/source-map": "npm:^0.3.2" "@jridgewell/source-map": "npm:^0.3.2"
acorn: "npm:^8.5.0" acorn: "npm:^8.5.0"
@ -4237,7 +4237,7 @@ __metadata:
source-map-support: "npm:~0.5.20" source-map-support: "npm:~0.5.20"
bin: bin:
terser: bin/terser terser: bin/terser
checksum: 4d0c2a858eb2857fd8b58b2e2382865e3ecad30a8573b20d325cb6789d670f4057f3f84ac6e7437556033ec0c6fff9e913e5bbc05b67cdeac1a35b3da173c295 checksum: c18036a7958b1435147a94e4b0e36f10252466b811f4dedfa3016c90721ff973b5479108491de9ef8c6238a37b0b5359a3350fb3fc4c5ce3cb00fbef6f8e1113
languageName: node languageName: node
linkType: hard linkType: hard
@ -4359,23 +4359,23 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"typescript@npm:4.9.3": "typescript@npm:4.9.4":
version: 4.9.3 version: 4.9.4
resolution: "typescript@npm:4.9.3" resolution: "typescript@npm:4.9.4"
bin: bin:
tsc: bin/tsc tsc: bin/tsc
tsserver: bin/tsserver tsserver: bin/tsserver
checksum: b0aafee5d6427b67fc557c46a6e9c093586444db463fde7a19ffc4eecc31889246210ff679f8384769dc99fca975bba5ac17411816855bb2d8a549e4fe442cc7 checksum: b142d5e50785d0e5055771e4d9e712b01be58985ff29be3d3acc64f0fddd5fd8ade8b28583ba502f2565783c23bd5b509c5abcc1a93a2d7d4f05b8e4ee731fc9
languageName: node languageName: node
linkType: hard linkType: hard
"typescript@patch:typescript@npm%3A4.9.3#optional!builtin<compat/typescript>": "typescript@patch:typescript@npm%3A4.9.4#optional!builtin<compat/typescript>":
version: 4.9.3 version: 4.9.4
resolution: "typescript@patch:typescript@npm%3A4.9.3#optional!builtin<compat/typescript>::version=4.9.3&hash=d73830" resolution: "typescript@patch:typescript@npm%3A4.9.4#optional!builtin<compat/typescript>::version=4.9.4&hash=ad5954"
bin: bin:
tsc: bin/tsc tsc: bin/tsc
tsserver: bin/tsserver tsserver: bin/tsserver
checksum: 06fd518bc55d054127b39aa7ad11551fd132bb7a8395913ed84fd5caf715455393d622e884ccb4fcf962d4eb5182600009c096b82ec516e8fadd09bf2150bb93 checksum: e7321aeb1e2c0e3c19599808707208e2b730de8d17a5624f0a7297b9a1ffa39974edd4a819108b3b635bc00171476ddfa339e04d928a03ce8d8c6944cb8ec008
languageName: node languageName: node
linkType: hard linkType: hard