Skip to content

Commit 7750ebc

Browse files
authored
feat: dump plugin info when it implicit enable by dependents plugin (#248)
1 parent 74930ad commit 7750ebc

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

lib/loader/mixin/plugin.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,15 @@ module.exports = {
311311
if (!allPlugins[name].enable) {
312312
implicitEnabledPlugins.push(name);
313313
allPlugins[name].enable = true;
314+
allPlugins[name].implicitEnable = true;
314315
}
315316
});
316317

318+
for (const [ name, dependents ] of Object.entries(requireMap)) {
319+
// note:`dependents` will not includes `optionalDependencies`
320+
allPlugins[name].dependents = dependents;
321+
}
322+
317323
// Following plugins will be enabled implicitly.
318324
// - configclient required by [hsfclient]
319325
// - eagleeye required by [hsfclient]

test/loader/mixin/load_plugin.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,10 @@ describe('test/load_plugin.test.js', function() {
641641
'tracelog',
642642
'gateway',
643643
]);
644+
645+
assert(loader.allPlugins.zoneclient.enable === true);
646+
assert(loader.allPlugins.zoneclient.implicitEnable === true);
647+
assert.deepEqual(loader.allPlugins.zoneclient.dependents, [ 'ldc' ]);
644648
});
645649

646650
it('should load plugin from scope', () => {

0 commit comments

Comments
 (0)