fulmine.js 5.19.2 → 5.19.4
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/package.json +2 -1
- package/src/adopt.js +20 -26
- package/src/application.js +63 -73
- package/src/cli.js +48 -48
- package/src/cluster.js +18 -27
- package/src/compression.js +141 -112
- package/src/declarative.js +611 -540
- package/src/hot-settings.js +80 -0
- package/src/index.js +11 -17
- package/src/lazy-readable.js +131 -0
- package/src/lazy-writable.js +97 -0
- package/src/middlewares.js +153 -130
- package/src/nest.js +22 -36
- package/src/node-shim.js +19 -16
- package/src/optimizer.js +600 -0
- package/src/options.d.ts +9 -4
- package/src/parse-query.js +3 -3
- package/src/request-utils.js +307 -0
- package/src/request.js +147 -548
- package/src/response-utils.js +88 -0
- package/src/response.js +228 -535
- package/src/route.js +7 -8
- package/src/router-utils.js +998 -0
- package/src/router.js +166 -2170
- package/src/server-shape.js +40 -51
- package/src/server-timing.js +32 -33
- package/src/socket.js +208 -0
- package/src/testing.js +43 -45
- package/src/usage.js +25 -25
- package/src/utils.js +165 -78
- package/src/verify.js +22 -31
- package/src/view.js +6 -8
- package/src/walk.js +581 -0
- package/src/websocket.js +34 -26
- package/src/work.js +22 -28
package/src/route.js
CHANGED
|
@@ -25,9 +25,8 @@ const SYNC_LIMIT = 100;
|
|
|
25
25
|
/**
|
|
26
26
|
* The handlers registered for one path, and the walk over them.
|
|
27
27
|
*
|
|
28
|
-
* Express exports this, and code that builds a route by hand
|
|
29
|
-
*
|
|
30
|
-
* caller having decided the route is the right one; all it knows is which verb a handler answers.
|
|
28
|
+
* Express exports this, and code that builds a route by hand uses it: `new Route(path)`, a handler
|
|
29
|
+
* per verb, then `dispatch(req, res, done)`. It does no matching, only which verb a handler answers.
|
|
31
30
|
*/
|
|
32
31
|
class Route {
|
|
33
32
|
/**
|
|
@@ -69,9 +68,9 @@ class Route {
|
|
|
69
68
|
/**
|
|
70
69
|
* Runs the handlers this request's verb reaches, one after another through next().
|
|
71
70
|
*
|
|
72
|
-
* @param {any} req
|
|
73
|
-
* @param {any} res
|
|
74
|
-
* @param {(err?:
|
|
71
|
+
* @param {any} req a Request, or whatever a caller that built this Route by hand is serving
|
|
72
|
+
* @param {any} res the matching response
|
|
73
|
+
* @param {(err?: unknown) => void} done called when the route is finished with the request, with
|
|
75
74
|
* whatever error it ended on
|
|
76
75
|
*/
|
|
77
76
|
dispatch(req, res, done) {
|
|
@@ -114,7 +113,7 @@ class Route {
|
|
|
114
113
|
return done(err);
|
|
115
114
|
}
|
|
116
115
|
|
|
117
|
-
const handle = /** @type {
|
|
116
|
+
const handle = /** @type {{handle: Function}} */ (layer).handle;
|
|
118
117
|
// an error only reaches the four-argument handlers, and everything else only runs
|
|
119
118
|
// while there is no error, which is the same rule ordinary dispatch follows
|
|
120
119
|
if (err) {
|
|
@@ -147,7 +146,7 @@ class Route {
|
|
|
147
146
|
* Refuses a handler that could never be called, worded as express words it.
|
|
148
147
|
*
|
|
149
148
|
* @param {string} method the verb this was registered for, for the message
|
|
150
|
-
* @param {
|
|
149
|
+
* @param {unknown[]} handlers
|
|
151
150
|
*/
|
|
152
151
|
function checkRouteHandlers(method, handlers) {
|
|
153
152
|
for (const handle of handlers) {
|