src/config/config-initialiser.js
function resolvePluginClass (plugin, type) {
  // alias require to trick nexe from bundling it
  const req = require
  let requirePath
  let pluginConstructor
  if (plugin.path != null) {
    requirePath = fileUtils.lookupLibRequirePath(plugin.path)
    pluginConstructor = req(requirePath)
  } else if (plugin.name != null && type) {
    requirePath = `deepstream.io-${type}-${plugin.name}`
    requirePath = fileUtils.lookupLibRequirePath(requirePath)
    pluginConstructor = req(requirePath)
  } else if (plugin.name != null) {
    requirePath = fileUtils.lookupLibRequirePath(plugin.name)
    pluginConstructor = req(requirePath)
  } else {
    throw new Error(`Neither name nor path property found for ${type}`)
  }
  return pluginConstructor
}
function resolvePluginClass (plugin, type) {
  // alias require to trick nexe from bundling it
  const req = require
  let requirePath
  let pluginConstructor
  if (plugin.path != null) {
    requirePath = fileUtils.lookupLibRequirePath(plugin.path)
    pluginConstructor = req(requirePath)
  } else if (plugin.name != null && type) {
    requirePath = `deepstream.io-${type}-${plugin.name}`
    requirePath = fileUtils.lookupLibRequirePath(requirePath)
    pluginConstructor = req(requirePath)
  } else if (plugin.name != null) {
    requirePath = fileUtils.lookupLibRequirePath(plugin.name)
    pluginConstructor = req(requirePath)
  } else {
    throw new Error(`Neither name nor path property found for ${type}`)
  }
  return pluginConstructor
}
function resolvePluginClass ( plugin , type ) { // alias require to trick nexe from bundling it const req = require let requirePath let pluginConstructor if ( plugin . path != null ) { requirePath = fileUtils . lookupLibRequirePath ( plugin . path ) pluginConstructor = req ( requirePath ) } else if ( plugin . name != null && type ) { requirePath = ` ${ type } ${ plugin . name } ` requirePath = fileUtils . lookupLibRequirePath ( requirePath ) pluginConstructor = req ( requirePath ) } else if ( plugin . name != null ) { requirePath = fileUtils . lookupLibRequirePath ( plugin . name ) pluginConstructor = req ( requirePath ) } else { throw new Error ( ` ${ type } ` ) } return pluginConstructor }
Instantiate the given plugin, which either needs a path property or a name
property which fits to the npm module name convention. Options will be passed
to the constructor.

CLI arguments will be considered.

@param {Object} config deepstream configuration object

@private
@returns {Function} Instance return be the plugin constructor
Instantiate the given plugin which either needs a path property or a name property which fits to the npm module name convention . Options will be passed to the constructor .