From 4d74e63dd36d6df0f978aea78af50b2190320dcc Mon Sep 17 00:00:00 2001 From: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com> Date: Fri, 10 May 2024 00:23:22 -0500 Subject: [PATCH] fix absPath gen --- src/core/modules.ts | 4 ++-- src/sern.ts | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/core/modules.ts b/src/core/modules.ts index a37936f..c374ac9 100644 --- a/src/core/modules.ts +++ b/src/core/modules.ts @@ -17,7 +17,7 @@ import * as Id from './id' */ export function commandModule(mod: InputCommand): _Module { const [onEvent, plugins] = partitionPlugins(mod.plugins); - const initCallsite = callsites()[1].getFileName(); + const initCallsite = callsites().at(-2)?.getFileName(); if(!initCallsite) throw Error("initCallsite is null"); const { name, absPath } = Files.parseCallsite(initCallsite); @@ -41,7 +41,7 @@ export function commandModule(mod: InputCommand): _Module { */ export function eventModule(mod: InputEvent): _Module { const [onEvent, plugins] = partitionPlugins(mod.plugins); - const initCallsite = callsites()[1].getFileName(); + const initCallsite = callsites().at(-2)?.getFileName(); if(!initCallsite) throw Error("initCallsite is null"); const { name, absPath } = Files.parseCallsite(initCallsite); mod.name ??= name; diff --git a/src/sern.ts b/src/sern.ts index 3c62096..4045caf 100644 --- a/src/sern.ts +++ b/src/sern.ts @@ -11,9 +11,10 @@ interface Wrapper { const __start = (entryPoint: string, wrapper: { defaultPrefix?: string }, dependencies: DependencyList) => { + //@ts-ignore sern handler generates handler.js import(entryPoint) - .then(({ __commands, __events=new Map() }) => { - console.log(__commands, __events) + .then(({ commands=new Map(), events=new Map() }) => { + console.log(commands, events) }) .catch(err => dependencies[2]?.error({ message: err })); }