Files
factorio-clusterio/packages/lib/src/import_plugin.node.ts
T
bbassieandClaude Opus 5.5 47c84fc289 Add checkEnabled and rename plugin loading files
plugins.checkEnabled(name) tells if a plugin is in the load list.
#plugin_module is renamed to #import_plugin. loadPluginMigrations moves
into PluginLoader.ts, leaving plugin_loader.ts with plugin discovery and
details, so it is renamed to plugin_info.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 22:17:12 +00:00

11 lines
437 B
TypeScript

import path from "node:path";
import { pathToFileURL } from "node:url";
import type { PluginDeclaration, PluginNodeEnvInfo } from "./plugin.js";
export default async function importPlugin(
pluginInfo: PluginDeclaration, entrypoint: string
): Promise<Record<string, any>> {
const packagePath = (pluginInfo as PluginNodeEnvInfo).packagePath;
return await import(pathToFileURL(path.join(path.dirname(packagePath), entrypoint)).href);
}