fix: push back some deprecations, remove deprecated stuff scheduled for v1.18.0

This commit is contained in:
Julian Lam
2021-09-03 12:04:16 -04:00
parent 1f91a31327
commit dd4e66e22c
5 changed files with 4 additions and 38 deletions

View File

@@ -25,23 +25,6 @@ require('./usage')(Plugins);
Plugins.data = require('./data');
Plugins.hooks = require('./hooks');
// Backwards compatibility for hooks, remove in v1.18.0
const _deprecate = async function (...args) {
const oldMethod = args.shift();
const newMethod = args.shift();
const method = args.shift();
const stack = new Error().stack.toString().split(os.EOL);
const context = stack[stack.findIndex(line => line.startsWith(' at Object.wrapperCallback')) + 1];
winston.warn(`[plugins/hooks] ${oldMethod} has been deprecated, call ${newMethod} instead.`);
winston.warn(`[plugins/hooks] ${context}`);
return method.apply(Plugins.hooks, args);
};
Plugins.registerHook = _deprecate.bind(null, 'Plugins.registerHook', 'Plugins.hooks.register', Plugins.hooks.register);
Plugins.unregisterHook = _deprecate.bind(null, 'Plugins.unregisterHook', 'Plugins.hooks.unregister', Plugins.hooks.unregister);
Plugins.fireHook = _deprecate.bind(null, 'Plugins.fireHook', 'Plugins.hooks.fire', Plugins.hooks.fire);
Plugins.hasListeners = _deprecate.bind(null, 'Plugins.hasListeners', 'Plugins.hooks.hasListeners', Plugins.hooks.hasListeners);
// end
Plugins.getPluginPaths = Plugins.data.getPluginPaths;
Plugins.loadPluginInfo = Plugins.data.loadPluginInfo;