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:
Hornwitser authored and GitHub committed 2024-01-18 20:31:52 +01:00
1 parent 8884116ee9
commit b0f6c95fca
33 files changed
+71 -62

No files matched your search

@@ -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;
};
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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");
+1 -1
View File
@@ -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",
},