refactor(src): split oversized modules
This commit is contained in:
18
src/imessage/monitor/runtime.ts
Normal file
18
src/imessage/monitor/runtime.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import type { RuntimeEnv } from "../../runtime.js";
|
||||
import type { MonitorIMessageOpts } from "./types.js";
|
||||
|
||||
export function resolveRuntime(opts: MonitorIMessageOpts): RuntimeEnv {
|
||||
return (
|
||||
opts.runtime ?? {
|
||||
log: console.log,
|
||||
error: console.error,
|
||||
exit: (code: number): never => {
|
||||
throw new Error(`exit ${code}`);
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function normalizeAllowList(list?: Array<string | number>) {
|
||||
return (list ?? []).map((entry) => String(entry).trim()).filter(Boolean);
|
||||
}
|
||||
Reference in New Issue
Block a user