@sourceregistry/node-webserver 1.6.6 → 1.7.1
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/README.md +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +20 -14
- package/dist/index.es.js.map +1 -1
- package/dist/types/router.d.ts +7 -0
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -49,7 +49,7 @@ var E = class {
|
|
|
49
49
|
this.cleanupInterval = setInterval(() => {
|
|
50
50
|
let e = Date.now();
|
|
51
51
|
for (let [t, { reset: n }] of this.data) e >= n && this.data.delete(t);
|
|
52
|
-
}, Math.min(this.windowMs, 3e5));
|
|
52
|
+
}, Math.min(this.windowMs, 3e5)), this.cleanupInterval?.unref();
|
|
53
53
|
}
|
|
54
54
|
stop() {
|
|
55
55
|
this.cleanupInterval && clearInterval(this.cleanupInterval);
|
|
@@ -77,7 +77,7 @@ var E = class {
|
|
|
77
77
|
let r = e - this.windowMs, i = n.filter((e) => e > r);
|
|
78
78
|
i.length === 0 ? this.data.delete(t) : this.data.set(t, i);
|
|
79
79
|
}
|
|
80
|
-
}, Math.min(this.windowMs, 3e5));
|
|
80
|
+
}, Math.min(this.windowMs, 3e5)), this.cleanupInterval.unref();
|
|
81
81
|
}
|
|
82
82
|
stop() {
|
|
83
83
|
this.cleanupInterval && clearInterval(this.cleanupInterval);
|
|
@@ -351,7 +351,7 @@ var H = [
|
|
|
351
351
|
static set(e, t) {
|
|
352
352
|
this.cache.set(e, t);
|
|
353
353
|
}
|
|
354
|
-
}, W = class {
|
|
354
|
+
}, W = class e {
|
|
355
355
|
constructor() {
|
|
356
356
|
this._routes = [], this._wsRoutes = [], this._nestedRouters = [], this._middlewares = [], this._preHandlers = [], this._postHandlers = [], this.routesSorted = !1, this.wsRoutesSorted = !1;
|
|
357
357
|
}
|
|
@@ -395,23 +395,29 @@ var H = [
|
|
|
395
395
|
}
|
|
396
396
|
}, n);
|
|
397
397
|
}
|
|
398
|
-
use(
|
|
399
|
-
let
|
|
400
|
-
Array.isArray(
|
|
401
|
-
|
|
398
|
+
use(t, n, ...r) {
|
|
399
|
+
let i = "/", a, o = r;
|
|
400
|
+
if (Array.isArray(t)) {
|
|
401
|
+
let [n, r, ...s] = t;
|
|
402
|
+
n instanceof e ? (a = n, o = s) : (i = n, a = r, o = s);
|
|
403
|
+
} else t instanceof e ? (a = t, o = n ? [n, ...r] : r) : (i = t, a = n);
|
|
404
|
+
let s = this.normalizePrefix(i), { regex: c, paramNames: l, isCatchAll: u, priority: d } = this.createPrefixRegex(s);
|
|
402
405
|
return this._nestedRouters.push({
|
|
403
|
-
prefix:
|
|
404
|
-
router:
|
|
405
|
-
regex:
|
|
406
|
-
paramNames:
|
|
407
|
-
isCatchAll:
|
|
408
|
-
priority:
|
|
409
|
-
middlewares:
|
|
406
|
+
prefix: s,
|
|
407
|
+
router: a,
|
|
408
|
+
regex: c,
|
|
409
|
+
paramNames: l,
|
|
410
|
+
isCatchAll: u,
|
|
411
|
+
priority: d,
|
|
412
|
+
middlewares: o
|
|
410
413
|
}), this;
|
|
411
414
|
}
|
|
412
415
|
useMiddleware(...e) {
|
|
413
416
|
return this._middlewares.push(...e), this;
|
|
414
417
|
}
|
|
418
|
+
middleware(...e) {
|
|
419
|
+
return this._middlewares.push(...e), this;
|
|
420
|
+
}
|
|
415
421
|
pre(...e) {
|
|
416
422
|
return this._preHandlers.push(...e), this;
|
|
417
423
|
}
|