mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 15:24:52 +09:00
Flatten lib namespace
Move all functions and classes currently available through lib/name and libName to be under a single flat namespace in lib. This make reorganising the lib namespace much simpler as the location of symbols can move without breaking the consumers of lib. The multi-entrypoint design was already problematic for the web plugin system which couldn't effectively use it due to how webpack's shared module system is awkward to set up with multiple entrypoints per package.
This commit is contained in:
1 parent
bb58670597
commit
bfe119eaa3
143 files changed
+1798
-1918
No files matched your search
@@ -2,8 +2,7 @@
|
||||
const fs = require("fs-extra");
|
||||
const path = require("path");
|
||||
|
||||
const libFileOps = require("@clusterio/lib/file_ops");
|
||||
const libPlugin = require("@clusterio/lib/plugin");
|
||||
const lib = require("@clusterio/lib");
|
||||
|
||||
const {
|
||||
AcquireRequest,
|
||||
@@ -34,11 +33,11 @@ async function saveDatabase(controllerConfig, playerDatastore, logger) {
|
||||
let file = path.resolve(controllerConfig.get("controller.database_directory"), "inventories.json");
|
||||
logger.verbose(`writing ${file}`);
|
||||
let content = JSON.stringify(Array.from(playerDatastore));
|
||||
await libFileOps.safeOutputFile(file, content);
|
||||
await lib.safeOutputFile(file, content);
|
||||
}
|
||||
}
|
||||
|
||||
class ControllerPlugin extends libPlugin.BaseControllerPlugin {
|
||||
class ControllerPlugin extends lib.BaseControllerPlugin {
|
||||
async init() {
|
||||
this.acquiredPlayers = new Map();
|
||||
this.playerDatastore = await loadDatabase(this.controller.config, this.logger);
|
||||
|
||||
Reference in new issue
Block a user