class NodeModulesExcluder

Excludes node_modules files from stage directories.

@internal This is an internal part of Package Manager and may be changed or removed at any time without warning. External code should not interact with this class.

Hierarchy

  • class \Drupal\package_manager\PathExcluder\NodeModulesExcluder implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of NodeModulesExcluder

File

core/modules/package_manager/src/PathExcluder/NodeModulesExcluder.php, line 18

Namespace

Drupal\package_manager\PathExcluder
View source
class NodeModulesExcluder implements EventSubscriberInterface {
    
    /**
     * Excludes node_modules directories from stage operations.
     *
     * @param \Drupal\package_manager\Event\CollectPathsToExcludeEvent $event
     *   The event object.
     */
    public function excludeNodeModulesFiles(CollectPathsToExcludeEvent $event) : void {
        $event->addPathsRelativeToProjectRoot($event->scanForDirectoriesByName('node_modules'));
    }
    
    /**
     * {@inheritdoc}
     */
    public static function getSubscribedEvents() : array {
        return [
            CollectPathsToExcludeEvent::class => 'excludeNodeModulesFiles',
        ];
    }

}

Members

Title Sort descending Modifiers Object type Summary
NodeModulesExcluder::excludeNodeModulesFiles public function Excludes node_modules directories from stage operations.
NodeModulesExcluder::getSubscribedEvents public static function

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.