revert: feat of allow constructable modules (#138)

Revert "feat: allow constructable modules (#133)"

This reverts commit 03936eb2ea.
This commit is contained in:
xxDeveloper
2022-09-13 22:36:15 +03:00
committed by GitHub
parent 03936eb2ea
commit 82bbddac8d
3 changed files with 2 additions and 7 deletions

View File

@@ -87,7 +87,7 @@ export default class ReadyHandler extends EventsHandler<{
type: PluginType.Command;
}[];
}) {
if ((mod.plugins || []).length === 0) {
if (mod.plugins.length === 0) {
return of({ mod, pluginRes: [] });
}
// modules with no event plugins are ignored in the previous

View File

@@ -25,7 +25,7 @@ export function processCommandPlugins<T extends DefinedCommandModule>(
wrapper: Wrapper,
payload: { mod: T; absPath: string },
) {
return (payload.mod.plugins || []).map(plug => ({
return payload.mod.plugins.map(plug => ({
...plug,
name: plug?.name ?? 'Unnamed Plugin',
description: plug?.description ?? '...',

View File

@@ -73,11 +73,6 @@ export function buildData<T>(commandDir: string): Observable<
} catch {
mod = (await import(`file:///` + absPath)).default;
}
try {
mod = new (mod as unknown as new (...args: unknown[]) => T)();
} catch {}
if (mod !== undefined) {
return Ok({ mod, absPath });
} else return Err(SernError.UndefinedModule);