Move base plugins to their respective packages

Move BaseControllerPlugin to controller/src/BaseControllerPlugin.ts
Move BaseInstancePlugin to host/src/BaseInstancePlugin.ts
Move BaseControlPlugin to ctl/src/BaseCtlPlugin.ts
Move BaseWebPlugin to web_ui/src/BaseWebPlugin.ts

This solves the circular package dependency problem of the base plugins
needing types that are available only in the dependencies to lib.
This commit is contained in:
Hornwitser committed 2023-11-25 18:41:43 +01:00
1 parent 63dc370ea0
commit 808eda0513
51 files changed
+1073 -1060

No files matched your search

@@ -3,6 +3,7 @@ import React, { useContext } from "react";
import * as lib from "@clusterio/lib";
import ControlContext from "./ControlContext";
import BaseWebPlugin from "../BaseWebPlugin";
import { RawUserState } from "../model/user";
import { HostState } from "../model/host";
import { InstanceState } from "../model/instance";
@@ -22,7 +23,7 @@ export default function PluginExtra(props: PluginExtraProps) {
let components = [];
for (let [name, plugin] of control.plugins) {
if (Object.prototype.hasOwnProperty.call(plugin.componentExtra, props.component)) {
type ComponentExtra = {[key: string]: React.ComponentType<PluginExtraProps & {plugin:lib.BaseWebPlugin}>};
type ComponentExtra = {[key: string]: React.ComponentType<PluginExtraProps & {plugin:BaseWebPlugin}>};
let ComponentExtra = (plugin.componentExtra as ComponentExtra)[props.component];
components.push(<ComponentExtra key={name} plugin={plugin} {...props}/>);
}