mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 23:53:13 +09:00
Merge branch 'master' into feature/plugin-install
This commit is contained in:
277 files changed
+2557
-2079
No files matched your search
@@ -6,12 +6,13 @@ import fs from "fs/promises";
|
||||
import path from "path";
|
||||
import { spawn } from "child_process";
|
||||
|
||||
import * as libConfig from "./config";
|
||||
import * as libFileOps from "./file_ops";
|
||||
import { logger } from "./logging";
|
||||
import * as libHelpers from "./helpers";
|
||||
import { LockFile } from "./LockFile";
|
||||
import { loadPluginList } from "./load_plugin_list";
|
||||
import { loadPluginList } from "./load_plugin_list.js";
|
||||
import * as libConfig from "./config/index.js";
|
||||
import * as libFileOps from "./file_ops.js";
|
||||
import { logger } from "./logging.js";
|
||||
import * as libHelpers from "./helpers.js";
|
||||
import { LockFile } from "./LockFile.js";
|
||||
import { pathToFileURL } from "url";
|
||||
|
||||
|
||||
function print(...content: any[]) {
|
||||
@@ -171,8 +172,13 @@ export async function handlePluginCommand(
|
||||
|
||||
let pluginInfo: { name: string };
|
||||
try {
|
||||
|
||||
pluginInfo = require(pluginPath).plugin;
|
||||
const pluginPackage = (await import(
|
||||
pathToFileURL(path.posix.join(pluginPath, "package.json")).href,
|
||||
{ with: { type: "json" }},
|
||||
)).default;
|
||||
pluginInfo = (await import(
|
||||
pathToFileURL(path.posix.join(pluginPath, pluginPackage.main ?? "index.js")).href
|
||||
)).plugin;
|
||||
} catch (err: any) {
|
||||
logger.error(`Unable to import plugin info from ${args.path}:\n${err.stack}`);
|
||||
process.exitCode = 1;
|
||||
|
||||
Reference in new issue
Block a user