<commit_before>process.env.DEBUG = '*';

const PluginLoader = require('../..');
const EventEmitter = require('events');

var app = new EventEmitter();
app.name = 'App';
app.on('plugins.ready', function(){
    app.logger.info('Application plugins loaded');
    app.debug('here we are!!');
});

const manager = new PluginLoader({
    context: app,
    basepath: __dirname,
    afterMount: function(context){
        context.emit('plugins.ready');
    }
});

manager.find('./plugins').then((plugins) => {
    plugins.push({
        'debug': function(plugin, context, options){
        context.debug = plugin('in-load');
    }});
    
    return manager.load(plugins);
})
.then((plugins)=>{
    return manager.mount(plugins)
})
.catch(console.error);<commit_msg>load: cleanup<commit_after>process.env.DEBUG = '*';

const PluginLoader = require('../..');
const EventEmitter = require('events');

var app = new EventEmitter();
app.name = 'App';
app.on('plugins.ready', function(){
    app.logger.info('Application plugins loaded');
    app.debug('here we are!!');
});

const manager = new PluginLoader({
    context: app,
    basepath: __dirname,
    afterMount: (context) => context.emit('plugins.ready')
});

manager.find('./plugins').then((plugins) => {
    plugins.push({
        'debug': function(plugin, context, options){
        context.debug = plugin('in-load');
    }});

    return manager.load(plugins);
})
.then((plugins)=>{
    return manager.mount(plugins)
})
.catch(console.error);
{'fraction_non_alphanumeric': 0.19450033534540576, 'fraction_numerical': 0.0, 'mean_word_length': 3.844155844155844, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5683102', 'n_tokens_mistral': 453, 'n_tokens_neox': 449, 'n_words': 92}