Checks if a babel configuration object matches a lodash plugin with semantic-ui-react in its id option.
@param plugin A plugin config obtained from babel's state
326785
function isLodashPluginWithSemanticUiReact(plugin) {
    if (Array.isArray(plugin)) {
        // Babel 6 plugin is a tuple as an array [id, options]
        return (
            ["lodash", "babel-plugin-lodash"].includes(plugin[0].key) &&
            [].concat(plugin[1].id).includes("semantic-ui-react")
        );
    } else if (plugin != null && typeof plugin === "object") {
      // Babel 7 plugin is an object { key, options, ... }
        return (
            /[/\\]node_modules([/\\].*)?[/\\]babel-plugin-lodash([/\\].*)?$/.test(plugin.key) &&
            plugin.options &&
            plugin.options.id &&
            [].concat(plugin.options.id).includes("semantic-ui-react")
        );
    } else {
        return false;
    }
}
237831
function (id) {
                var plugin = null;
                util.each(this.get('plugins'), function (p) {
                    // user defined takes priority
                    var pluginId = p.get && p.get('pluginId') || p.pluginId;
                    if (pluginId === id) {
                        plugin = p;
                        return false;
                    }
                    return undefined;
                });
                return plugin;
            }
803812
function pluginInit(patternlab) {

  if (!patternlab) {
    console.error('patternlab object not provided to plugin-init');
    process.exit(1);
  }

  let fileTypes = require('./package.json').fileTypes;

  //write the plugin json to public/patternlab-components
  var pluginConfig = getPluginFrontendConfig();
  var pluginConfigPathName = path.resolve(patternlab.config.paths.public.root, 'patternlab-components', 'packages');
  try {
    fs.outputFileSync(pluginConfigPathName + '/' + pluginName + '.json', JSON.stringify(pluginConfig, null, 2));
  } catch (ex) {
    console.trace('plugin-node-tab: Error occurred while writing pluginFile configuration');
    console.log(ex);
  }

  //add the plugin config to the patternlab-object
  if (!patternlab.plugins) {
    patternlab.plugins = [];
  }
  patternlab.plugins.push(pluginConfig);

  //write the plugin dist folder to public/pattern-lab
  var pluginFiles = glob.sync(__dirname + '/dist/**/*');

  if (pluginFiles && pluginFiles.length > 0) {

    for (let i = 0; i < pluginFiles.length; i++) {
      try {
        var fileStat = fs.statSync(pluginFiles[i]);
        if (fileStat.isFile()) {
          var relativePath = path.relative(__dirname, pluginFiles[i]).replace('dist', ''); //dist is dropped
          var writePath = path.join(patternlab.config.paths.public.root, 'patternlab-components', 'pattern-lab', pluginName, relativePath);

          //a message to future plugin authors:
          //depending on your plugin's job - you might need to alter the dist file instead of copying.
          //if you are simply copying dist files, you can probably do the below:
          fs.copySync(pluginFiles[i], writePath);
        }
      } catch (ex) {
        console.trace('plugin-node-tab: Error occurred while copying pluginFile', pluginFiles[i]);
        console.log(ex);
      }
    }
  }

  //setup listeners if not already active
  if (patternlab.config[pluginName] !== undefined && !patternlab.config[pluginName]) {

    //register events
    registerEvents(patternlab);

    //set the plugin key to true to indicate it is installed and ready
    patternlab.config[pluginName] = true;
  }

}
698810
function applyPlugin(plugin, next) {
    self.pack.register(plugin.plugin, plugin.options || {}, function(err) {
      if(err) return next(err);
      else    return next();
    });
  }
712650
function registerPlugin(name, obj) {
    if (name && name.length && obj) {
        plugins[name] = obj;
    }
}
136454
def register(self, plugin, name=None):
        
        plugin_name = name or self.get_canonical_name(plugin)

        if plugin_name in self._name2plugin or plugin in self._plugin2hookcallers:
            if self._name2plugin.get(plugin_name, -1) is None:
                return  # blocked plugin, return None to indicate no registration
            raise ValueError(
                "Plugin already registered: %s=%s\n%s"
                % (plugin_name, plugin, self._name2plugin)
            )

        # XXX if an error happens we should make sure no state has been
        # changed at point of return
        self._name2plugin[plugin_name] = plugin

        # register matching hook implementations of the plugin
        self._plugin2hookcallers[plugin] = hookcallers = []
        for name in dir(plugin):
            hookimpl_opts = self.parse_hookimpl_opts(plugin, name)
            if hookimpl_opts is not None:
                normalize_hookimpl_opts(hookimpl_opts)
                method = getattr(plugin, name)
                hookimpl = HookImpl(plugin, plugin_name, method, hookimpl_opts)
                hook = getattr(self.hook, name, None)
                if hook is None:
                    hook = _HookCaller(name, self._hookexec)
                    setattr(self.hook, name, hook)
                elif hook.has_spec():
                    self._verify_hook(hook, hookimpl)
                    hook._maybe_apply_history(hookimpl)
                hook._add_hookimpl(hookimpl)
                hookcallers.append(hook)
        return plugin_name
615803
function checkID(expectedIdAndVersion, pinfo) {
    if (!expectedIdAndVersion) return;
    var parsedSpec = pluginSpec.parse(expectedIdAndVersion);
    if (parsedSpec.id != pinfo.id) {
        var alias = parsedSpec.scope ? null : pluginMappernto[parsedSpec.id] || pluginMapperotn[parsedSpec.id];
        if (alias !== pinfo.id) {
            throw new Error('Expected plugin to have ID "' + parsedSpec.id + '" but got "' + pinfo.id + '".');
        }
    }
    if (parsedSpec.version && !semver.satisfies(pinfo.version, parsedSpec.version)) {
        throw new Error('Expected plugin ' + pinfo.id + ' to satisfy version "' + parsedSpec.version + '" but got "' + pinfo.version + '".');
    }
}
1153578
function Plugin(configPath, options) {

  if (arguments.length == 1 && typeof configPath === 'object') {
    options = configPath;
    configPath = options.configPath;
  } else if (arguments.length == 2 && typeof options === 'boolean') {
    options = { verbose: options }; // for backward compatibility
  }

  options = options || {};
  configPath = configPath || null;

  var verbose = options.verbose || false;
  //var lint = options.lint || false; // TODO: Report about found issues in style sheets

  // Create a stream through which each file will pass
  var stream = through.obj(function(file, enc, cb) {

    if (file.isNull()) {
      // Do nothing
    } else if (file.isStream()) {
      this.emit('error', new PluginError(PLUGIN_NAME, 'Streams are not supported!'));
      return cb();
    } else if (file.isBuffer() && SUPPORTED_EXTENSIONS.indexOf(path.extname(file.path)) !== -1) {

      if (verbose) {
        gutil.log(PLUGIN_NAME, 'Processing ' + gutil.colors.magenta(file.path));
      }

      if (configPath && !fs.existsSync(configPath)) {
        this.emit('error', new PluginError(PLUGIN_NAME, 'Configuration file not found: ' + gutil.colors.magenta(configPath)));
        return cb();
      }

      configPath = Comb.getCustomConfigPath(configPath || path.join(path.dirname(file.path), '.csscomb.json'));
      var config = Comb.getCustomConfig(configPath);

      if (verbose) {
        gutil.log(PLUGIN_NAME, 'Using configuration file ' + gutil.colors.magenta(configPath));
      }

      var comb = new Comb(config || 'csscomb');
      var syntax = options.syntax || file.path.split('.').pop();

      try {
        var output = comb.processString(
          file.contents.toString('utf8'), {
            syntax: syntax,
            filename: file.path
          });
        file.contents = new Buffer(output);
      } catch (err) {
        this.emit('error', new PluginError(PLUGIN_NAME, file.path + '\n' + err));
      }
    }

    // make sure the file goes through the next gulp plugin
    this.push(file);
    // tell the stream engine that we are done with this file
    return cb();
  });

  // Return the file stream
  return stream;
}
1298940
def register_plugin(self, plugin: Plugin):
        
        if isinstance(plugin, Plugin):
            lazy = False
        elif issubclass(plugin, Plugin):
            lazy = True
        else:
            msg = 'plugin %r must be an object/class of type Plugin' % plugin
            raise DiayException(msg)

        predicate = inspect.isfunction if lazy else inspect.ismethod
        methods = inspect.getmembers(plugin, predicate=predicate)
        for _, method in methods:
            if getattr(method, '__di__', {}).get('provides'):
                if lazy:
                    self.register_lazy_provider_method(plugin, method)
                else:
                    self.register_provider(method)
536349
function plugin(suite) {
	// API
	suite.api.mock = {}; // TODO: remove this
	// Add the plugin's `root`
	suite.addRoot(path.join(__dirname, 'defaults'));

	// Instance
	var instance = {};

	// Instance's name
	instance.name = pkg.name;

	return instance;
}
532333
function(id){
        if(!id){
            return undefined;
        }
        var pluginElement = this.doc.find('./plugin/[@name="' + id + '"]');
        if (null === pluginElement) {
            var legacyFeature =  this.doc.find('./feature/param[@name="id"][@value="' + id + '"]/..');
            if(legacyFeature){
                 events.emit('log', 'Found deprecated feature entry for ' + id +' in config.xml.');
                return featureToPlugin(legacyFeature);
            }
            return undefined;
        }
        var plugin = {};

        plugin.name = pluginElement.attrib.name;
        plugin.spec = pluginElement.attrib.spec || pluginElement.attrib.src || pluginElement.attrib.version;
        plugin.variables = {};
        var variableElements = pluginElement.findall('variable');
        variableElements.forEach(function(varElement){
            var name = varElement.attrib.name;
            var value = varElement.attrib.value;
            if(name){
                plugin.variables[name] = value;
            }
        });
        return plugin;
    }
89061
def get_plugin(self, identifier, cls=None):
        
        if ((cls is None or cls == 'provider')
                and identifier in self.available_providers):
            return self.available_providers[identifier]
        elif ((cls is None or cls == 'checker')
                and identifier in self.available_checkers):
            return self.available_checkers[identifier]
        return Config.load_local_plugin(identifier)
153764
function (plugin) {
    if (Array.isArray(plugin)) {
      for (var i = 0; i < plugin.length; i++) this.use(plugin[i]);
    } else if (typeof plugin === 'function') {
      plugin(this);
    } else {
      throw new TypeError('plugin must be a Function or an Array of Functions')
    }
    return this
  }
956064
function validatePluginName(plugin, pluginList) {
    if (!plugin.name)
        throw new Error(ApiHost.ERR_PLUGIN_MISSING_NAME_PROPERTY);

    pluginList.forEach(function (collectorPlugin) {
        if (plugin.name === collectorPlugin.name) {
            var msg = util.format(ApiHost.ERR_DUPLICATE_PLUGIN_NAME, plugin.name, plugin.extends);
            throw new Error(msg);
        }
    });
}
876854
function resolveByPlugin(plugin, from, id) {
	if (plugin.exports && plugin.exports.normalize) {
		return plugin.exports.normalize(id, resolveId.bind(null, from));
	}
	return resolveId(from, id);
}
1313050
private static void validateUIProviderDef(final ProviderDef pluginDef) throws PluginException {
        if (null == pluginDef.getName() || "".equals(pluginDef.getName())) {
            throw new PluginException("UI plugin missing name");
        }
        if (null == pluginDef.getService() || "".equals(pluginDef.getService())) {
            throw new PluginException("UI plugin missing service");
        }
        if (null == pluginDef.getPluginData() || null == pluginDef.getPluginData().get("ui")) {
            throw new PluginException("UI plugin missing ui: definition");
        }

    }
562825
function Plugin(server) {
    this.server = server;
    this.config = server.config;
    //Check if we have the right config
    this.checkConfiguration();
    this.settings = this.config.githubAuth;
    //Init if not present
    if (typeof this.server.passport === "undefined")
        this.initGithubAuth();
    else
        this.passport = this.server.passport;
}