mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 15:04:52 +09:00
Rename PluginWebpackEnvInfo to PluginWebEnvInfo
The old name is kept as a deprecated alias. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a4db2dc460
commit
f40113e01c
10 files changed
+25
-19
No files matched your search
@@ -57,3 +57,6 @@ Import `react-dom/client` and `react/jsx-runtime` by those names, other subpaths
|
||||
Imports of `assert`, `buffer`, `events`, `os`, `path`, `process`, `stream`, `util` and `zlib` resolve to the same browser packages as before, provided by `@clusterio/web_ui`.
|
||||
|
||||
The `container` property of `WebPluginContext` is now the plugin's ES module namespace, `await container.get("./web")` returns the module instead of a factory function.
|
||||
|
||||
`lib.PluginWebpackEnvInfo` is renamed to `lib.PluginWebEnvInfo`.
|
||||
The old name still works but is deprecated and will be removed.
|
||||
@@ -1,7 +1,7 @@
|
||||
// Core definitions for the configuration system
|
||||
import * as classes from "./classes.js";
|
||||
import * as validators from "./validators.js";
|
||||
import type { PluginNodeEnvInfo, PluginWebpackEnvInfo } from "../plugin.js";
|
||||
import type { PluginNodeEnvInfo, PluginWebEnvInfo } from "../plugin.js";
|
||||
import { Static } from "@sinclair/typebox";
|
||||
import { isTargetVersion } from "../data/version.js";
|
||||
import { SyncHook } from "../SyncHook.js";
|
||||
@@ -786,7 +786,7 @@ function validateFieldNames(
|
||||
* Add the config fields defined by the by a specific plugin infos
|
||||
*/
|
||||
export function addPluginFieldDefinitions(
|
||||
pluginInfo: PluginNodeEnvInfo | PluginWebpackEnvInfo,
|
||||
pluginInfo: PluginNodeEnvInfo | PluginWebEnvInfo,
|
||||
kind: "controllerConfigFields" | "hostConfigFields" | "instanceConfigFields",
|
||||
Config: typeof classes.Config<any>
|
||||
) {
|
||||
@@ -858,7 +858,7 @@ export function addPluginFieldDefinitions(
|
||||
*
|
||||
* @param {Array<Object>} pluginInfos - Array of plugin info objects.
|
||||
*/
|
||||
export function addPluginConfigFields(pluginInfos: PluginNodeEnvInfo[] | PluginWebpackEnvInfo[]) {
|
||||
export function addPluginConfigFields(pluginInfos: PluginNodeEnvInfo[] | PluginWebEnvInfo[]) {
|
||||
for (let pluginInfo of pluginInfos) {
|
||||
addPluginFieldDefinitions(pluginInfo, "controllerConfigFields", ControllerConfig);
|
||||
if (pluginInfo.hostEntrypoint || pluginInfo.instanceEntrypoint) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import * as libSchema from "../schema.js";
|
||||
import { dataClasses, errorClasses } from "./messages.js";
|
||||
import { BaseConnector, WebSocketBaseConnector } from "./connectors.js";
|
||||
import { strict as assert } from "assert";
|
||||
import type { PluginNodeEnvInfo, PluginWebpackEnvInfo } from "../plugin.js";
|
||||
import type { PluginNodeEnvInfo, PluginWebEnvInfo } from "../plugin.js";
|
||||
import type {
|
||||
AddressType, JSONDeserialisable, MessageRoutable, MessageRequest, MessageEvent, IUser,
|
||||
} from "../data/index.js";
|
||||
@@ -895,7 +895,7 @@ for (let Class of errorClasses) {
|
||||
Link.registerError(Class);
|
||||
}
|
||||
|
||||
export function registerPluginMessages(pluginInfos: PluginNodeEnvInfo[]|PluginWebpackEnvInfo[]) {
|
||||
export function registerPluginMessages(pluginInfos: PluginNodeEnvInfo[]|PluginWebEnvInfo[]) {
|
||||
for (let pluginInfo of pluginInfos) {
|
||||
for (let Class of pluginInfo.messages || []) {
|
||||
if (Class.plugin !== pluginInfo.name) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* @author Hornwitser
|
||||
* @module lib/users
|
||||
*/
|
||||
import type { PluginNodeEnvInfo, PluginWebpackEnvInfo } from "./plugin.js";
|
||||
import type { PluginNodeEnvInfo, PluginWebEnvInfo } from "./plugin.js";
|
||||
import { Permission } from "./data/index.js";
|
||||
|
||||
export const permissions = new Map<string, Permission>();
|
||||
@@ -88,7 +88,7 @@ export function definePermission({
|
||||
*
|
||||
* @param pluginInfos - Array of plugin info objects.
|
||||
*/
|
||||
export function registerPluginPermissions(pluginInfos: PluginNodeEnvInfo[] | PluginWebpackEnvInfo[]) {
|
||||
export function registerPluginPermissions(pluginInfos: PluginNodeEnvInfo[] | PluginWebEnvInfo[]) {
|
||||
for (const pluginInfo of pluginInfos) {
|
||||
for (const permission of pluginInfo.permissions ?? []) {
|
||||
if (typeof permission.name !== "string" || !permission.name.startsWith(`${pluginInfo.name}.`)) {
|
||||
|
||||
@@ -91,13 +91,16 @@ export type PluginNodeEnvInfo = PluginDeclaration & {
|
||||
skippedNpmPackage?: string;
|
||||
};
|
||||
|
||||
export type PluginWebpackEnvInfo = PluginDeclaration & {
|
||||
export type PluginWebEnvInfo = PluginDeclaration & {
|
||||
container?: any;
|
||||
package?: any;
|
||||
enabled?: boolean;
|
||||
error?: string;
|
||||
};
|
||||
|
||||
/** @deprecated Use PluginWebEnvInfo */
|
||||
export type PluginWebpackEnvInfo = PluginWebEnvInfo;
|
||||
|
||||
/**
|
||||
* Information about the event.
|
||||
*/
|
||||
|
||||
@@ -144,7 +144,7 @@ export type WebPluginContext = lib.PluginLoadContext<{
|
||||
control: Control;
|
||||
container: any;
|
||||
package: any;
|
||||
}, lib.PluginWebpackEnvInfo>;
|
||||
}, lib.PluginWebEnvInfo>;
|
||||
|
||||
/**
|
||||
* Collection of web plugin hooks
|
||||
@@ -258,7 +258,7 @@ export class BaseWebPlugin {
|
||||
constructor(
|
||||
public container: any,
|
||||
packageData: any,
|
||||
public info: lib.PluginWebpackEnvInfo,
|
||||
public info: lib.PluginWebEnvInfo,
|
||||
public control: Control,
|
||||
public logger: lib.Logger,
|
||||
) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import { pages } from "./pages";
|
||||
|
||||
const { ConsoleTransport, WebConsoleFormat, logger } = lib;
|
||||
|
||||
async function loadPluginInfos(): Promise<[lib.PluginWebpackEnvInfo[], string]> {
|
||||
async function loadPluginInfos(): Promise<[lib.PluginWebEnvInfo[], string]> {
|
||||
let response = await fetch(`${webRoot}api/plugins`);
|
||||
let pluginList: lib.PluginWebApi[];
|
||||
if (response.ok) {
|
||||
@@ -28,7 +28,7 @@ async function loadPluginInfos(): Promise<[lib.PluginWebpackEnvInfo[], string]>
|
||||
}
|
||||
let pluginSetKey = loadedPluginSetKey(pluginList);
|
||||
|
||||
let pluginInfos: lib.PluginWebpackEnvInfo[] = [];
|
||||
let pluginInfos: lib.PluginWebEnvInfo[] = [];
|
||||
for (let meta of pluginList) {
|
||||
if (meta.web.error) {
|
||||
logger.error(`Failed to load plugin ${meta.name}: ${meta.web.error}`);
|
||||
@@ -65,7 +65,7 @@ async function loadPluginInfos(): Promise<[lib.PluginWebpackEnvInfo[], string]>
|
||||
}
|
||||
|
||||
async function loadPlugins(
|
||||
pluginInfos: lib.PluginWebpackEnvInfo[],
|
||||
pluginInfos: lib.PluginWebEnvInfo[],
|
||||
control: Control
|
||||
) {
|
||||
const plugins = new Map<string, WebPlugin.BaseWebPlugin>();
|
||||
|
||||
@@ -47,8 +47,8 @@ function PluginMachines(props: PluginMachinesProps) {
|
||||
|
||||
type ControllerPluginProps = {
|
||||
pluginMeta: PluginWebApi,
|
||||
pluginInfo?: lib.PluginWebpackEnvInfo,
|
||||
loadedPlugin?: lib.PluginWebpackEnvInfo,
|
||||
pluginInfo?: lib.PluginWebEnvInfo,
|
||||
loadedPlugin?: lib.PluginWebEnvInfo,
|
||||
title: string,
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Space, Table, Typography } from "antd";
|
||||
import CloseCircleFilled from "@ant-design/icons/CloseCircleFilled";
|
||||
import InfoCircleFilled from "@ant-design/icons/InfoCircleFilled";
|
||||
|
||||
import type { PluginWebApi, PluginWebpackEnvInfo } from "@clusterio/lib";
|
||||
import type { PluginWebApi, PluginWebEnvInfo } from "@clusterio/lib";
|
||||
|
||||
import notify from "../util/notify";
|
||||
import { useAccount } from "../model/account";
|
||||
@@ -28,7 +28,7 @@ type PluginRow = {
|
||||
title: string;
|
||||
/** Not present for plugins the controller hasn't loaded */
|
||||
meta?: PluginWebApi;
|
||||
info?: PluginWebpackEnvInfo;
|
||||
info?: PluginWebEnvInfo;
|
||||
package?: any;
|
||||
status?: PluginStatus;
|
||||
};
|
||||
|
||||
@@ -54,7 +54,7 @@ export class Control extends lib.Link {
|
||||
public hooks = new WebPlugin.WebHooks(logger);
|
||||
/** @deprecated Only holds plugins using the class export, use loadedPlugins and hooks instead */
|
||||
public plugins = new Map<string, WebPlugin.BaseWebPlugin>();
|
||||
public loadedPlugins = new Map<string, lib.PluginWebpackEnvInfo>();
|
||||
public loadedPlugins = new Map<string, lib.PluginWebEnvInfo>();
|
||||
public inputComponents = new Map<string, WebPlugin.InputComponent>();
|
||||
public extensionComponents: Partial<WebPlugin.ExtensionComponents> = {};
|
||||
public loginForms: WebPlugin.PluginLoginForm[] = [];
|
||||
@@ -85,7 +85,7 @@ export class Control extends lib.Link {
|
||||
|
||||
constructor(
|
||||
connector: ControlConnector,
|
||||
public pluginInfos = new Map<string, lib.PluginWebpackEnvInfo>(),
|
||||
public pluginInfos = new Map<string, lib.PluginWebEnvInfo>(),
|
||||
/** Key of the plugin set this interface was loaded against */
|
||||
public pluginSetKey = "",
|
||||
) {
|
||||
|
||||
Reference in new issue
Block a user