src/special/gulp-load-plugins.js
function check(content, deps, path) {
  if (
    // Pattern: import plugins from 'gulp-load-plugins', $ = plugins(), $.jshint()
    importDetector(path.node)[0] === 'gulp-load-plugins'
    && path.isImportDeclaration()
    && path.get('specifiers')[0]
    && path.get('specifiers')[0].isImportDefaultSpecifier()
    && path.get('specifiers')[0].get('local').isIdentifier()
  ) {
    const importVariableName = path.get('specifiers')[0].get('local').node.name;
    const identifierReferences = getIdentifierReferences(path, importVariableName);
    const packageNames = identifierReferences.map(r => getPackageName(content, deps, r));
    return packageNames;
  }
  if (

    // Pattern: plugins = require('gulp-load-plugins'), $ = plugins(), $.jshint()
    requireDetector(path.node)[0] === 'gulp-load-plugins'
    && path.isCallExpression()
    && path.parentPath.isVariableDeclarator()
    && path.parentPath.get('id').isIdentifier()
  ) {
    const requireVariableName = path.parentPath.get('id').node.name;
    const identifierReferences = getIdentifierReferences(path, requireVariableName);
    const packageNames = identifierReferences.map(r => getPackageName(content, deps, r));
    return packageNames;
  }
  if (

    // Pattern: $ = require('gulp-load-plugins')(), $.jshint()
    requireDetector(path.node)[0] === 'gulp-load-plugins'
    && path.isCallExpression()
    && path.parentPath.isCallExpression()
    && path.parentPath.parentPath.isVariableDeclarator()
    && path.parentPath.parentPath.get('id').isIdentifier()
  ) {
    const requireVariableName = path.parentPath.parentPath.get('id').node.name;
    const identifierReferences = getReferences(path, requireVariableName);
    const packageNames = identifierReferences.map(r => getPackageName(content, deps, r));
    return packageNames;
  }
  if (

    // Pattern: require('gulp-load-plugins')().thisPlugin()
    requireDetector(path.node)[0] === 'gulp-load-plugins'
    && path.isCallExpression()
    && path.parentPath.isCallExpression()
    && path.parentPath.parentPath.isMemberExpression()
  ) {
    const packageName = getPackageName(content, deps, path.parentPath);
    return [packageName];
  }

  return [];
}
function check(content, deps, path) {
  if (
    // Pattern: import plugins from 'gulp-load-plugins', $ = plugins(), $.jshint()
    importDetector(path.node)[0] === 'gulp-load-plugins'
    && path.isImportDeclaration()
    && path.get('specifiers')[0]
    && path.get('specifiers')[0].isImportDefaultSpecifier()
    && path.get('specifiers')[0].get('local').isIdentifier()
  ) {
    const importVariableName = path.get('specifiers')[0].get('local').node.name;
    const identifierReferences = getIdentifierReferences(path, importVariableName);
    const packageNames = identifierReferences.map(r => getPackageName(content, deps, r));
    return packageNames;
  }
  if (

    // Pattern: plugins = require('gulp-load-plugins'), $ = plugins(), $.jshint()
    requireDetector(path.node)[0] === 'gulp-load-plugins'
    && path.isCallExpression()
    && path.parentPath.isVariableDeclarator()
    && path.parentPath.get('id').isIdentifier()
  ) {
    const requireVariableName = path.parentPath.get('id').node.name;
    const identifierReferences = getIdentifierReferences(path, requireVariableName);
    const packageNames = identifierReferences.map(r => getPackageName(content, deps, r));
    return packageNames;
  }
  if (

    // Pattern: $ = require('gulp-load-plugins')(), $.jshint()
    requireDetector(path.node)[0] === 'gulp-load-plugins'
    && path.isCallExpression()
    && path.parentPath.isCallExpression()
    && path.parentPath.parentPath.isVariableDeclarator()
    && path.parentPath.parentPath.get('id').isIdentifier()
  ) {
    const requireVariableName = path.parentPath.parentPath.get('id').node.name;
    const identifierReferences = getReferences(path, requireVariableName);
    const packageNames = identifierReferences.map(r => getPackageName(content, deps, r));
    return packageNames;
  }
  if (

    // Pattern: require('gulp-load-plugins')().thisPlugin()
    requireDetector(path.node)[0] === 'gulp-load-plugins'
    && path.isCallExpression()
    && path.parentPath.isCallExpression()
    && path.parentPath.parentPath.isMemberExpression()
  ) {
    const packageName = getPackageName(content, deps, path.parentPath);
    return [packageName];
  }

  return [];
}
function check ( content , deps , path ) { if ( // Pattern: import plugins from 'gulp-load-plugins', $ = plugins(), $.jshint() importDetector ( path . node ) [ 0 ] === 'gulp-load-plugins' && path . isImportDeclaration ( ) && path . get ( 'specifiers' ) [ 0 ] && path . get ( 'specifiers' ) [ 0 ] . isImportDefaultSpecifier ( ) && path . get ( 'specifiers' ) [ 0 ] . get ( 'local' ) . isIdentifier ( ) ) { const importVariableName = path . get ( 'specifiers' ) [ 0 ] . get ( 'local' ) . node . name ; const identifierReferences = getIdentifierReferences ( path , importVariableName ) ; const packageNames = identifierReferences . map ( r => getPackageName ( content , deps , r ) ) ; return packageNames ; } if ( // Pattern: plugins = require('gulp-load-plugins'), $ = plugins(), $.jshint() requireDetector ( path . node ) [ 0 ] === 'gulp-load-plugins' && path . isCallExpression ( ) && path . parentPath . isVariableDeclarator ( ) && path . parentPath . get ( 'id' ) . isIdentifier ( ) ) { const requireVariableName = path . parentPath . get ( 'id' ) . node . name ; const identifierReferences = getIdentifierReferences ( path , requireVariableName ) ; const packageNames = identifierReferences . map ( r => getPackageName ( content , deps , r ) ) ; return packageNames ; } if ( // Pattern: $ = require('gulp-load-plugins')(), $.jshint() requireDetector ( path . node ) [ 0 ] === 'gulp-load-plugins' && path . isCallExpression ( ) && path . parentPath . isCallExpression ( ) && path . parentPath . parentPath . isVariableDeclarator ( ) && path . parentPath . parentPath . get ( 'id' ) . isIdentifier ( ) ) { const requireVariableName = path . parentPath . parentPath . get ( 'id' ) . node . name ; const identifierReferences = getReferences ( path , requireVariableName ) ; const packageNames = identifierReferences . map ( r => getPackageName ( content , deps , r ) ) ; return packageNames ; } if ( // Pattern: require('gulp-load-plugins')().thisPlugin() requireDetector ( path . node ) [ 0 ] === 'gulp-load-plugins' && path . isCallExpression ( ) && path . parentPath . isCallExpression ( ) && path . parentPath . parentPath . isMemberExpression ( ) ) { const packageName = getPackageName ( content , deps , path . parentPath ) ; return [ packageName ] ; } return [ ] ; }
Get the gulp packages found from the path. This is the entry for traverse.
Get the gulp packages found from the path . This is the entry for traverse .