File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,8 @@ function ensureExecutable(filePath) {
7777 */
7878function startPlugin ( plugin , rootDir ) {
7979 if ( ! plugin . active ) {
80- console . log ( `[pluginManager] 插件 ${ plugin . name } 未激活,跳过` ) ;
80+ // 这个检查主要用于直接调用startPlugin函数的情况
81+ // 正常情况下startAllPlugins已经在调用前检查了激活状态
8182 return null ;
8283 }
8384
@@ -152,9 +153,18 @@ function getProcessKey(plugin, index) {
152153export function startAllPlugins ( rootDir = process . cwd ( ) ) {
153154 console . log ( "[pluginManager] 准备启动所有插件..." ) ;
154155 const processes = { } ;
156+ const inactivePlugins = [ ] ;
157+
155158 plugins . forEach ( ( plugin , index ) => {
156- const proc = startPlugin ( plugin , rootDir ) ;
157159 const key = getProcessKey ( plugin , index ) ;
160+
161+ // 先检查插件是否激活,未激活的插件收集到数组中
162+ if ( ! plugin . active ) {
163+ inactivePlugins . push ( plugin . name ) ;
164+ return ;
165+ }
166+
167+ const proc = startPlugin ( plugin , rootDir ) ;
158168
159169 if ( proc ) {
160170 processes [ key ] = proc ;
@@ -163,6 +173,12 @@ export function startAllPlugins(rootDir = process.cwd()) {
163173 console . error ( `[pluginManager] 插件 ${ key } 启动失败,未加入到 processes` ) ;
164174 }
165175 } ) ;
176+
177+ // 如果有未激活的插件,在一行中显示
178+ if ( inactivePlugins . length > 0 ) {
179+ console . log ( `[pluginManager] 跳过未激活的插件: [${ inactivePlugins . map ( name => `'${ name } '` ) . join ( ',' ) } ]` ) ;
180+ }
181+
166182 return processes ;
167183}
168184
You can’t perform that action at this time.
0 commit comments