diff --git a/src/def.d.ts b/src/def.d.ts index ce63dd2..f499d8e 100644 --- a/src/def.d.ts +++ b/src/def.d.ts @@ -375,6 +375,7 @@ interface VendettaObject { interface VendettaPluginObject { manifest: PluginManifest; storage: Indexable; + logger: Logger; } declare global { diff --git a/src/lib/plugins.ts b/src/lib/plugins.ts index 3c0eddf..78a69e3 100644 --- a/src/lib/plugins.ts +++ b/src/lib/plugins.ts @@ -1,8 +1,11 @@ import { Indexable, PluginManifest, Plugin } from "@types"; import { awaitSyncWrapper, createMMKVBackend, createStorage, wrapSync } from "@lib/storage"; +import { findByProps } from "@metro/filters"; import safeFetch from "@utils/safeFetch"; import logger from "@lib/logger"; +const logModule = findByProps("setLogFn").default; + type EvaledPlugin = { onLoad?(): void; onUnload(): void; @@ -60,6 +63,7 @@ export async function evalPlugin(plugin: Plugin) { manifest: plugin.manifest, // Wrapping this with wrapSync is NOT an option. storage: await createStorage>(createMMKVBackend(plugin.id)), + logger: new logModule(plugin.manifest.name), } }; const pluginString = `vendetta=>{return ${plugin.js}}\n//# sourceURL=${plugin.id}`;