mirror of
https://github.com/sern-handler/handler
synced 2026-06-06 01:16:55 +00:00
fix absPath gen
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 }));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user