2025-11-27 20:42:46 +08:00
|
|
|
/**
|
|
|
|
|
* Plugin Config Plugin
|
|
|
|
|
* 插件配置插件
|
|
|
|
|
*/
|
|
|
|
|
|
2025-12-08 21:23:37 +08:00
|
|
|
import type { ServiceContainer } from '@esengine/esengine';
|
|
|
|
|
import { createLogger } from '@esengine/esengine';
|
2025-12-03 22:15:22 +08:00
|
|
|
import type { IPlugin, IEditorModuleLoader, ModuleManifest } from '@esengine/editor-core';
|
2025-11-27 20:42:46 +08:00
|
|
|
import { SettingsRegistry } from '@esengine/editor-core';
|
|
|
|
|
|
|
|
|
|
const logger = createLogger('PluginConfigPlugin');
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Plugin Config 编辑器模块
|
|
|
|
|
*/
|
|
|
|
|
class PluginConfigEditorModule implements IEditorModuleLoader {
|
|
|
|
|
async install(services: ServiceContainer): Promise<void> {
|
|
|
|
|
const settingsRegistry = services.resolve(SettingsRegistry);
|
|
|
|
|
|
|
|
|
|
settingsRegistry.registerCategory({
|
|
|
|
|
id: 'plugins',
|
|
|
|
|
title: '插件',
|
|
|
|
|
description: '管理项目使用的插件',
|
|
|
|
|
sections: [
|
|
|
|
|
{
|
|
|
|
|
id: 'engine-plugins',
|
|
|
|
|
title: '插件管理',
|
|
|
|
|
description: '启用或禁用项目需要的插件。禁用不需要的插件可以减少打包体积。',
|
|
|
|
|
settings: [
|
|
|
|
|
{
|
|
|
|
|
key: 'project.enabledPlugins',
|
|
|
|
|
label: '',
|
|
|
|
|
type: 'pluginList',
|
|
|
|
|
defaultValue: [],
|
|
|
|
|
description: ''
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
logger.info('Installed');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async uninstall(): Promise<void> {
|
|
|
|
|
logger.info('Uninstalled');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async onEditorReady(): Promise<void> {
|
|
|
|
|
logger.info('Editor is ready');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-03 22:15:22 +08:00
|
|
|
const manifest: ModuleManifest = {
|
2025-11-27 20:42:46 +08:00
|
|
|
id: '@esengine/plugin-config',
|
2025-12-03 22:15:22 +08:00
|
|
|
name: '@esengine/plugin-config',
|
|
|
|
|
displayName: 'Plugin Config',
|
2025-11-27 20:42:46 +08:00
|
|
|
version: '1.0.0',
|
|
|
|
|
description: 'Configure engine plugins',
|
2025-12-03 22:15:22 +08:00
|
|
|
category: 'Other',
|
2025-11-27 20:42:46 +08:00
|
|
|
icon: 'Package',
|
|
|
|
|
isCore: true,
|
2025-12-03 22:15:22 +08:00
|
|
|
defaultEnabled: true,
|
|
|
|
|
isEngineModule: true,
|
|
|
|
|
canContainContent: false,
|
|
|
|
|
dependencies: [],
|
|
|
|
|
exports: {}
|
2025-11-27 20:42:46 +08:00
|
|
|
};
|
|
|
|
|
|
2025-12-01 22:28:51 +08:00
|
|
|
export const PluginConfigPlugin: IPlugin = {
|
2025-12-03 22:15:22 +08:00
|
|
|
manifest,
|
2025-11-27 20:42:46 +08:00
|
|
|
editorModule: new PluginConfigEditorModule()
|
|
|
|
|
};
|