
Research
/Security News
Shai Hulud Strikes Again (v2)
Another wave of Shai-Hulud campaign has hit npm with more than 500 packages and 700+ versions affected.
jbe-broccoli-funnel-patched
Advanced tools
Patched version for windows 10 builds until a proper fix comes.
Given an input node, the Broccoli Funnel plugin returns a new node with only a subset of the files from the input node. The files can be moved to different paths. You can use regular expressions to select which files to include or exclude.
new Funnel(inputNode, options)inputNode {Single node}
A Broccoli node (formerly: "tree"). A node in Broccoli can be either a string that references a directory in your project or a node object returned from running another Broccoli plugin.
If your project has the following file structure:
.
βββ Brocfile.js
βββ src/
βββ css/
βΒ Β βββ reset.css
βΒ Β βββ todos.css
βββ icons/
βΒ Β βββ check-mark.png
βΒ Β βββ logo.jpg
βββ javascript/
βββ app.js
βββ todo.js
You can select a subsection of the tree via Funnel:
var Funnel = require('broccoli-funnel');
var cssFiles = new Funnel('src/css');
/*
cssFiles contains the following files:
βββ reset.css
βββ todos.css
*/
// export the node for Broccoli to begin processing
module.exports = cssFiles;
srcDir {String}
A string representing the portion of the input node to start the funneling
from. This will be the base path for any include/exclude regexps.
Default: '.', the root path of the input node.
If your project has the following file structure:
.
βββ Brocfile.js
βββ src/
βββ css/
βΒ Β βββ reset.css
βΒ Β βββ todos.css
βββ icons/
βΒ Β βββ check-mark.png
βΒ Β βββ logo.jpg
βββ javascript/
βββ app.js
βββ todo.js
You can select a subsection of the node via Funnel:
var Funnel = require('broccoli-funnel');
var MergeTrees = require('broccoli-merge-trees');
// root of our source files
var projectFiles = 'src';
/* get a new node of only files in the 'src/css' directory
cssFiles contains the following files:
βββ reset.css
βββ todos.css
*/
var cssFiles = new Funnel(projectFiles, {
srcDir: 'css'
});
/* get a new node of only files in the 'src/icons' directory
imageFiles contains the following files:
βββ check-mark.png
βββ logo.jpg
*/
var imageFiles = new Funnel(projectFiles, {
srcDir: 'icons'
});
module.exports = new MergeTrees([cssFiles, imageFiles]);
destDir {String}
A string representing the destination path that filtered files will be copied to.
Default: '.', the root path of input node.
If your project has the following file structure:
.
βββ Brocfile.js
βββ src/
βββ css/
βΒ Β βββ reset.css
βΒ Β βββ todos.css
βββ icons/
βΒ Β βββ check-mark.png
βΒ Β βββ logo.jpg
βββ javascript/
βββ app.js
βββ todo.js
You can select a subsection of the directory structure via Funnel and copy it to a new location:
var Funnel = require('broccoli-funnel');
var cssFiles = new Funnel('src/css', {
destDir: 'build'
});
/*
cssFiles contains the following files:
build/
βββ reset.css
βββ todos.css
*/
module.exports = cssFiles;
allowEmpty {Boolean}
When using srcDir/destDir options only (aka no filtering via include/exclude options), if the srcDir were missing an error would be thrown.
Setting allowEmpty to true, will prevent that error by creating an empty directory at the destination path.
include {Array of GlobStrings|RegExps|Functions}
One or more matcher expression (regular expression, glob string, or function). Files within the node whose names match this
expression will be copied (with the location inside their parent directories
preserved) to the destDir.
Default: [].
If your project has the following file structure
.
βββ Brocfile.js
βββ src/
βββ css/
βΒ Β βββ reset.css
βΒ Β βββ todos.css
βββ icons/
βΒ Β βββ check-mark.png
βΒ Β βββ logo.jpg
βββ javascript/
βββ app.js
βββ todo.js
You can select files that match a glob expression and copy those subdirectories to a new location, preserving their location within parent directories:
var Funnel = require('broccoli-funnel');
// finds all files that match /todo/ and moves them
// the destDir
var todoRelatedFiles = new Funnel('src', {
include: ['todo/**/*']
});
/*
todoRelatedFiles contains the following files:
.
βββ css
βΒ Β βββ todos.css
βββ javascript
βββ todo.js
*/
module.exports = todoRelatedFiles;
exclude {Array of Glob Strings|Glob Strings|Functions}
One or more matcher expression (regular expression, glob string, or function). Files within the node whose names match this
expression will not be copied to the destDir if they otherwise would have
been.
Note, in the case when a file matches both an include and exclude pattern, the exclude pattern wins
Default: [].
If your project has the following file structure:
.
βββ Brocfile.js
βββ src/
βββ css/
βΒ Β βββ reset.css
βΒ Β βββ todos.css
βββ icons/
βΒ Β βββ check-mark.png
βΒ Β βββ logo.jpg
βββ javascript/
βββ app.js
βββ todo.js
You can select files that match a glob expression and exclude them from copying:
var Funnel = require('broccoli-funnel');
// finds all files in 'src' EXCEPT those that match /todo/
// and adds them to a node.
var nobodyLikesTodosAnyway = new Funnel('src', {
exclude: ['todo/**/*']
});
/*
nobodyLikesTodosAnyway contains the following files:
.
βββ css
βΒ Β βββ reset.css
βββ icons
βΒ Β βββ check-mark.png
βΒ Β βββ logo.jpg
βββ javascript
βββ app.js
*/
module.exports = nobodyLikesTodosAnyway;
files {Array of Strings}
One or more relative file paths. Files within the node whose relative paths match
will be copied (with the location inside their parent directories
preserved) to the destDir.
Default: [].
If your project has the following file structure
.
βββ Brocfile.js
βββ src/
βββ css/
βΒ Β βββ reset.css
βΒ Β βββ todos.css
βββ icons/
βΒ Β βββ check-mark.png
βΒ Β βββ logo.jpg
βββ javascript/
βββ app.js
βββ todo.js
You can select a specific list of files copy those subdirectories to a new location, preserving their location within parent directories:
var Funnel = require('broccoli-funnel');
// finds these specific files and moves them to the destDir
var someFiles = new Funnel('src', {
files: ['css/reset.css', 'icons/check-mark.png']
});
/*
someFiles contains the following files:
.
βββ css
βΒ Β βββ reset.css
βββ icons
βββ check-mark.png
*/
module.exports = someFiles;
getDestinationPath {Function}
This method will get called for each file, receiving the currently processing
relativePath as its first argument. The value returned from
getDestinationPath will be used as the destination for the new node. This is
a very simple way to move files from one path to another (replacing the need
for broccoli-file-mover for example).
The return value of this method is cached for each input file. This means that
getDestinationPath will only be called once per relativePath.
In the following example, getDestinationPath is used to move main.js to
ember-metal.js:
var node = new Funnel('packages/ember-metal/lib', {
destDir: 'ember-metal',
getDestinationPath: function(relativePath) {
if (relativePath === 'lib/main.js') {
return 'ember-metal.js';
}
return relativePath;
}
});
I know, right?
Running the tests:
npm install
npm test
This project is distributed under the MIT license.
FAQs
Patched version for windows 10 builds until a proper fix comes.
We found that jbe-broccoli-funnel-patched demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Another wave of Shai-Hulud campaign has hit npm with more than 500 packages and 700+ versions affected.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.