(
config: ProjectConfig,
packageInfoMap: Record<string, ExtendedPluginPackageInfo> = BUILTIN_PLUGIN_PACKAGES
)
| 101 | * @returns @zh 插件加载配置列表 @en Plugin load config list |
| 102 | */ |
| 103 | export function convertToPluginLoadConfigs( |
| 104 | config: ProjectConfig, |
| 105 | packageInfoMap: Record<string, ExtendedPluginPackageInfo> = BUILTIN_PLUGIN_PACKAGES |
| 106 | ): PluginLoadConfig[] { |
| 107 | const result: PluginLoadConfig[] = []; |
| 108 | |
| 109 | for (const [packageId, pluginConfig] of Object.entries(config.plugins)) { |
| 110 | const packageInfo = packageInfoMap[packageId]; |
| 111 | if (!packageInfo) { |
| 112 | console.warn(`[ProjectConfig] No package info for ${packageId}, skipping`); |
| 113 | continue; |
| 114 | } |
| 115 | |
| 116 | result.push({ |
| 117 | packageId, |
| 118 | enabled: pluginConfig.enabled, |
| 119 | sourceType: 'npm', |
| 120 | exportName: packageInfo.pluginExport, |
| 121 | dependencies: packageInfo.dependencies, |
| 122 | options: pluginConfig.options |
| 123 | }); |
| 124 | } |
| 125 | |
| 126 | return result; |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * @zh 创建默认项目配置 |
no test coverage detected