code: function resolvePlugin(name: string, dirname: string): Object {
  
    // Resolve with prefix first, then without if needed
    const pluginLoc = resolve(`${NAME_PREFIX}${name}`, dirname)
      || resolve(name, dirname);
  
    if (!pluginLoc) {
      throw new PooshError(
        `Unable to resolve plugin "${name}" within "${dirname}".`
      );
    }
  
    // eslint-disable-next-line global-require, import/no-dynamic-require
    const initFunction = require(pluginLoc).init;
    if (typeof initFunction !== "function") {
      throw new PooshError(
        `Plugin "${name}" is invalid: It doesn't have an init function.`
      );
    }
  
    const plugin = initFunction();
    if (!plugin) {
      throw new PooshError(
        `Plugin "${name}" is invalid: Initialization has returned nothing.`
      );
    }
  
    const error = Joi.validate(plugin, PLUGIN_SCHEMA, JOI_OPTIONS).error;
    if (error) {
      throw new PooshError(
        `Plugin "${name}" is invalid: Init method has returned an invalid object ${error}`
      );
    }
  
    return plugin;
  }
docs: Resole vand validate plugin.
  
  @param name Plugin name (can be specified with or without prefix).
  @param dirname The directory where to resolve the plugin from.
  @returns The plugin object.
  @static
  @private