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:
Hornwitser committed 2023-07-28 16:03:29 +02:00
1 parent bb58670597
commit bfe119eaa3
143 files changed
+1798 -1918

No files matched your search

+3 -3
View File
@@ -4,7 +4,7 @@ const fs = require("fs-extra");
const JSZip = require("jszip");
const path = require("path");
const libFactorio = require("@clusterio/lib/factorio");
const lib = require("@clusterio/lib");
const { slowTest } = require("./index");
@@ -17,7 +17,7 @@ describe("Integration of lib/factorio/patch", function() {
let savePath = path.join("temp", "test", "integration", "saves", "test.zip");
it("should patch a freeplay game", async function() {
slowTest(this);
await libFactorio.patch(savePath, [{
await lib.patch(savePath, [{
name: "test",
version: "1.0.0",
dependencies: {},
@@ -39,7 +39,7 @@ describe("Integration of lib/factorio/patch", function() {
});
it("should remove old modules in a save", async function() {
slowTest(this);
await libFactorio.patch(savePath, []);
await lib.patch(savePath, []);
let zip = await JSZip.loadAsync(await fs.readFile(savePath));
assert.equal(zip.file("test/modules/test/test.lua"), null);
});