test schmest

This commit is contained in:
2025-03-24 14:38:12 +01:00
parent 277f5a313e
commit d43bf30a08
3 changed files with 12 additions and 16 deletions

2
dist/index.d.ts vendored
View File

@ -7,7 +7,7 @@ export default class Flummpress {
private middleware;
router: Router;
constructor();
use<T>(nameOrRouter: string | Router, factory?: () => T): this;
use<T>(plugin: string | Router | Handler, factory?: () => T): this;
resolve<T>(name: string): T;
private processPipeline;
listen(...args: any[]): this;

12
dist/index.js vendored
View File

@ -20,11 +20,13 @@ export default class Flummpress {
this.router = new Router();
this.middleware = [];
}
use(nameOrRouter, factory) {
if (typeof nameOrRouter === "string" && factory)
this.container.register(nameOrRouter, factory);
else if (nameOrRouter instanceof Router)
this.router.use(nameOrRouter);
use(plugin, factory) {
if (typeof plugin === "string" && factory)
this.container.register(plugin, factory);
else if (plugin instanceof Router)
this.router.use(plugin);
else if (typeof plugin === "function")
this.middleware.push(plugin);
else
throw new TypeError("Invalid arguments provided to use()");
return this;