mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-16 15:30:41 +09:00
Move export for plugin declaration (#555)
Change the expected exported name of plugin declarations to be "plugin" at the main entrypoint instead of the default export. This makes the plugin's code organisation more flexible especially when using CommonJS JavaScript modules as they can export additional symbols from the plugin declaration file.
This commit is contained in:
1 parent
8884116ee9
commit
b0f6c95fca
33 files changed
+71
-62
No files matched your search
@@ -2,7 +2,7 @@ import type * as lib from "@clusterio/lib";
|
||||
|
||||
import { ChatEvent } from "./messages";
|
||||
|
||||
export default {
|
||||
export const plugin: lib.PluginDeclaration = {
|
||||
name: "global_chat",
|
||||
title: "Global Chat",
|
||||
description: "Forwards chat between instances.",
|
||||
@@ -12,4 +12,4 @@ export default {
|
||||
messages: [
|
||||
ChatEvent,
|
||||
],
|
||||
} satisfies lib.PluginDeclaration;
|
||||
};
|
||||
@@ -6,7 +6,7 @@
|
||||
"homepage": "https://github.com/clusterio/clusterio#readme",
|
||||
"license": "MIT",
|
||||
"repository": "clusterio/clusterio",
|
||||
"main": "dist/plugin/info.js",
|
||||
"main": "dist/plugin/index.js",
|
||||
"scripts": {
|
||||
"prepare": "tsc --build && webpack-cli --env production",
|
||||
"test": "echo \"Error: run tests from root\" && exit 1"
|
||||
|
||||
@@ -5,7 +5,7 @@ const lib = require("@clusterio/lib");
|
||||
const mock = require("../../../test/mock");
|
||||
const lines = require("../../../test/lib/factorio/lines");
|
||||
const instance = require("../dist/plugin/instance");
|
||||
const info = require("../dist/plugin/info").default;
|
||||
const info = require("../dist/plugin/index").plugin;
|
||||
const { ChatEvent } = require("../dist/plugin/messages");
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ module.exports = (env = {}) => merge(common(env), {
|
||||
name: "global_chat",
|
||||
library: { type: "var", name: "plugin_global_chat" },
|
||||
exposes: {
|
||||
"./info": "./info.ts",
|
||||
"./": "./index.ts",
|
||||
"./package.json": "./package.json",
|
||||
},
|
||||
shared: {
|
||||
|
||||
@@ -17,7 +17,7 @@ lib.definePermission({
|
||||
grantByDefault: true,
|
||||
});
|
||||
|
||||
export default {
|
||||
export const plugin: lib.PluginDeclaration = {
|
||||
name: "inventory_sync",
|
||||
title: "Inventory sync",
|
||||
description: "Synchronizes players inventories between instances",
|
||||
@@ -54,4 +54,4 @@ export default {
|
||||
],
|
||||
webEntrypoint: "./web",
|
||||
routes: ["/inventory"],
|
||||
} satisfies lib.PluginDeclaration;
|
||||
};
|
||||
@@ -6,7 +6,7 @@
|
||||
"homepage": "https://github.com/clusterio/factorioClusterio#readme",
|
||||
"license": "MIT",
|
||||
"repository": "clusterio/factorioClusterio",
|
||||
"main": "dist/plugin/info.js",
|
||||
"main": "dist/plugin/index.js",
|
||||
"scripts": {
|
||||
"prepare": "tsc --build && webpack-cli --env production",
|
||||
"test": "echo \"Error: run tests from root\" && exit 1"
|
||||
|
||||
@@ -16,7 +16,7 @@ module.exports = (env = {}) => merge(common(env), {
|
||||
name: "inventory_sync",
|
||||
library: { type: "var", name: "plugin_inventory_sync" },
|
||||
exposes: {
|
||||
"./info": "./info.ts",
|
||||
"./": "./index.ts",
|
||||
"./package.json": "./package.json",
|
||||
"./web": "./web/index.tsx",
|
||||
},
|
||||
|
||||
@@ -11,7 +11,7 @@ declare module "@clusterio/lib" {
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
export const plugin: lib.PluginDeclaration = {
|
||||
name: "player_auth",
|
||||
title: "Player Auth",
|
||||
description: "Provides authentication to the cluster via logging into a Factorio server.",
|
||||
@@ -37,4 +37,4 @@ export default {
|
||||
messages.FetchPlayerCodeRequest,
|
||||
messages.SetVerifyCodeRequest,
|
||||
],
|
||||
} satisfies lib.PluginDeclaration;
|
||||
};
|
||||
@@ -6,7 +6,7 @@
|
||||
"homepage": "https://github.com/clusterio/clusterio#readme",
|
||||
"license": "MIT",
|
||||
"repository": "clusterio/clusterio",
|
||||
"main": "dist/plugin/info.js",
|
||||
"main": "dist/plugin/index.js",
|
||||
"scripts": {
|
||||
"prepare": "tsc --build && webpack-cli --env production",
|
||||
"test": "echo \"Error: run tests from root\" && exit 1"
|
||||
|
||||
@@ -7,7 +7,7 @@ const mock = require("../../../test/mock");
|
||||
|
||||
const controller = require("../dist/plugin/controller");
|
||||
const instance = require("../dist/plugin/instance");
|
||||
const info = require("../dist/plugin/info").default;
|
||||
const info = require("../dist/plugin/index").plugin;
|
||||
const { FetchPlayerCodeRequest, SetVerifyCodeRequest } = require("../dist/plugin/messages");
|
||||
const lib = require("@clusterio/lib");
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ module.exports = (env = {}) => merge(common(env), {
|
||||
name: "player_auth",
|
||||
library: { type: "var", name: "plugin_player_auth" },
|
||||
exposes: {
|
||||
"./info": "./info.ts",
|
||||
"./": "./index.ts",
|
||||
"./package.json": "./package.json",
|
||||
"./web": "./web/index.tsx",
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@ import type * as lib from "@clusterio/lib";
|
||||
|
||||
import * as messages from "./messages";
|
||||
|
||||
export default {
|
||||
export const plugin: lib.PluginDeclaration = {
|
||||
name: "research_sync",
|
||||
title: "Research Sync",
|
||||
description: "Synchronises technology research progress between instances.",
|
||||
@@ -15,4 +15,4 @@ export default {
|
||||
messages.FinishedEvent,
|
||||
messages.SyncTechnologiesRequest,
|
||||
],
|
||||
} satisfies lib.PluginDeclaration;
|
||||
};
|
||||
@@ -6,7 +6,7 @@
|
||||
"homepage": "https://github.com/clusterio/clusterio#readme",
|
||||
"license": "MIT",
|
||||
"repository": "clusterio/clusterio",
|
||||
"main": "dist/plugin/info.js",
|
||||
"main": "dist/plugin/index.js",
|
||||
"scripts": {
|
||||
"prepare": "tsc --build && webpack-cli --env production",
|
||||
"test": "echo \"Error: run tests from root\" && exit 1"
|
||||
|
||||
@@ -16,7 +16,7 @@ module.exports = (env = {}) => merge(common(env), {
|
||||
name: "research_sync",
|
||||
library: { type: "var", name: "plugin_research_sync" },
|
||||
exposes: {
|
||||
"./info": "./info.ts",
|
||||
"./": "./index.ts",
|
||||
"./package.json": "./package.json",
|
||||
},
|
||||
shared: {
|
||||
|
||||
@@ -6,7 +6,7 @@ declare module "@clusterio/lib" {
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
export const plugin: lib.PluginDeclaration = {
|
||||
name: "statistics_exporter",
|
||||
title: "Statistics Exporter",
|
||||
description:
|
||||
@@ -22,4 +22,4 @@ export default {
|
||||
initialValue: 1,
|
||||
},
|
||||
},
|
||||
} satisfies lib.PluginDeclaration;
|
||||
};
|
||||
@@ -6,7 +6,7 @@
|
||||
"homepage": "https://github.com/clusterio/clusterio#readme",
|
||||
"license": "MIT",
|
||||
"repository": "clusterio/clusterio",
|
||||
"main": "dist/plugin/info.js",
|
||||
"main": "dist/plugin/index.js",
|
||||
"scripts": {
|
||||
"prepare": "tsc --build && webpack-cli --env production",
|
||||
"test": "echo \"Error: run tests from root\" && exit 1"
|
||||
|
||||
@@ -3,7 +3,7 @@ const assert = require("assert").strict;
|
||||
|
||||
const mock = require("../../../test/mock");
|
||||
const instance = require("../dist/plugin/instance");
|
||||
const info = require("../dist/plugin/info").default;
|
||||
const info = require("../dist/plugin/index").plugin;
|
||||
|
||||
|
||||
describe("statistics_exporter plugin", function() {
|
||||
|
||||
@@ -16,7 +16,7 @@ module.exports = (env = {}) => merge(common(env), {
|
||||
name: "statistics_exporter",
|
||||
library: { type: "var", name: "plugin_statistics_exporter" },
|
||||
exposes: {
|
||||
"./info": "./info.ts",
|
||||
"./": "./index.ts",
|
||||
"./package.json": "./package.json",
|
||||
},
|
||||
shared: {
|
||||
|
||||
@@ -18,7 +18,7 @@ lib.definePermission({
|
||||
grantByDefault: true,
|
||||
});
|
||||
|
||||
export default {
|
||||
export const plugin: lib.PluginDeclaration = {
|
||||
name: "subspace_storage",
|
||||
title: "Subspace Storage",
|
||||
description: "Provides shared storage across instances for the Subspace Storage mod",
|
||||
@@ -58,4 +58,4 @@ export default {
|
||||
],
|
||||
webEntrypoint: "./web",
|
||||
routes: ["/storage"],
|
||||
} satisfies lib.PluginDeclaration;
|
||||
};
|
||||
@@ -6,7 +6,7 @@
|
||||
"homepage": "https://github.com/clusterio/clusterio#readme",
|
||||
"license": "MIT",
|
||||
"repository": "clusterio/clusterio",
|
||||
"main": "dist/plugin/info.js",
|
||||
"main": "dist/plugin/index.js",
|
||||
"scripts": {
|
||||
"prepare": "tsc --build && webpack-cli --env production",
|
||||
"test": "echo \"Error: run tests from root\" && exit 1"
|
||||
|
||||
@@ -16,7 +16,7 @@ module.exports = (env = {}) => merge(common(env), {
|
||||
name: "subspace_storage",
|
||||
library: { type: "var", name: "plugin_subspace_storage" },
|
||||
exposes: {
|
||||
"./info": "./info.ts",
|
||||
"./": "./index.ts",
|
||||
"./package.json": "./package.json",
|
||||
"./web": "./web/index.tsx",
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user