Merge upstream/master and address review

Resolves the ESM conflicts in patch.ts, Instance.ts and host.ts. The
module gathering in Instance now goes through patch.loadModules with
the instance's loadedPlugins, and imports use explicit extensions.

Review changes: the existing-output check only treats ENOENT as
"does not exist" and rethrows anything else, a --zip option keeps the
output as a zip file for transfer (extracting stays the default), the
--scenario option describes that it takes a path and what the default
is, and the docs note that IPC is not available outside Clusterio.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Fable 5.1 committed 2026-09-12 22:21:46 +00:00
commit 187138bec5
297 files changed
+4980 -3274

No files matched your search

+9 -8
View File
@@ -15,7 +15,7 @@
import fs from "node:fs/promises";
import path from "path";
import yargs from "yargs";
import { version } from "./package.json";
import packageConfig from "./package.json" with { type: "json" };
import winston from "winston";
import "winston-daily-rotate-file";
@@ -23,8 +23,8 @@ import "winston-daily-rotate-file";
import * as lib from "@clusterio/lib";
import { ConsoleTransport, levels, logger } from "@clusterio/lib";
import Host from "./src/Host";
import { createScenarioCommand, handleCreateScenarioCommand } from "./src/create_scenario";
import Host from "./src/Host.js";
import { createScenarioCommand, handleCreateScenarioCommand } from "./src/create_scenario.js";
let host: Host | undefined;
@@ -70,7 +70,7 @@ export class HostConnector extends lib.WebSocketClientConnector {
new lib.MessageRegisterHost(
new lib.RegisterHostData(
this.hostConfig.get("host.controller_token"),
version,
packageConfig.version,
this.hostConfig.get("host.id"),
plugins,
)
@@ -83,7 +83,7 @@ export class HostConnector extends lib.WebSocketClientConnector {
async function startHost() {
// argument parsing
// eslint-disable-next-line node/no-sync
const args = yargs
const args = yargs(process.argv.slice(2))
.scriptName("host")
.usage("$0 <command> [options]")
.option("log-level", {
@@ -151,7 +151,7 @@ async function startHost() {
let command = args._[0];
if (command === "run") {
logger.info(`Starting Clusterio host ${version}`);
logger.info(`Starting Clusterio host ${packageConfig.version}`);
if (args.recovery) {
logger.warn("Host recovery mode enabled. Some features will be disabled.");
}
@@ -169,6 +169,7 @@ async function startHost() {
logger.info("Loading Plugin info");
let pluginInfos = await lib.loadPluginInfos(pluginList);
lib.registerPluginMessages(pluginInfos);
lib.registerPluginPermissions(pluginInfos);
lib.addPluginConfigFields(pluginInfos);
const hostConfigPath = args.config;
@@ -193,7 +194,7 @@ async function startHost() {
}
}
hostConfig.set("host.version", version); // Allows tracking last loaded version
hostConfig.set("host.version", packageConfig.version); // Allows tracking last loaded version
if (command === "config") {
await lib.handleConfigCommand(args, hostConfig, hostConfigLock);
@@ -319,6 +320,6 @@ ${err.stack}`
});
}
if (module === require.main) {
if (import.meta.main) {
bootstrap();
}