
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
broccoli-concat
Advanced tools
The broccoli-concat npm package is a Broccoli plugin used to concatenate multiple files into a single file. It is commonly used in build processes to combine JavaScript, CSS, or other types of files to reduce the number of HTTP requests and improve load times.
Concatenate JavaScript files
This feature allows you to concatenate all JavaScript files in the 'src/js' directory into a single file named 'app.js' in the 'assets' directory. Source maps are also enabled for easier debugging.
const concat = require('broccoli-concat');
const jsTree = concat('src/js', {
outputFile: '/assets/app.js',
inputFiles: ['**/*.js'],
sourceMapConfig: { enabled: true }
});
Concatenate CSS files
This feature allows you to concatenate all CSS files in the 'src/css' directory into a single file named 'styles.css' in the 'assets' directory. Source maps are also enabled for easier debugging.
const concat = require('broccoli-concat');
const cssTree = concat('src/css', {
outputFile: '/assets/styles.css',
inputFiles: ['**/*.css'],
sourceMapConfig: { enabled: true }
});
Custom file ordering
This feature allows you to specify a custom order for the files to be concatenated. In this example, 'jquery.js' and 'underscore.js' are concatenated first, followed by all other JavaScript files in the 'src/js' directory.
const concat = require('broccoli-concat');
const orderedJsTree = concat('src/js', {
outputFile: '/assets/app.js',
inputFiles: ['vendor/jquery.js', 'vendor/underscore.js', '**/*.js'],
sourceMapConfig: { enabled: true }
});
gulp-concat is a Gulp plugin that concatenates files. It is similar to broccoli-concat but is used within the Gulp build system. It offers similar functionality but is more commonly used in Gulp-based workflows.
webpack-concat-plugin is a Webpack plugin that concatenates files. It is similar to broccoli-concat but is used within the Webpack build system. It offers additional features like dependency resolution and is more commonly used in Webpack-based workflows.
grunt-contrib-concat is a Grunt plugin that concatenates files. It is similar to broccoli-concat but is used within the Grunt build system. It offers similar functionality but is more commonly used in Grunt-based workflows.
This filter is designed to be fast & good enough. It can generates source maps substantially faster than you'll get via mozilla/source-map, because it's special-cased for straight line-to-line contenation.
It discovers input sourcemaps in relative URLs, including data URIs.
const node = concat(node);
const node = concat(node, {
outputFile: '/output.js',
header: ";(function() {",
headerFiles: ['loader.js'],
inputFiles: ['**/*'],
footerFiles: ['auto-start.js'],
footer: "}());",
sourceMapConfig: { enabled: true },
allowNone: false | true // defaults to false, and will error if trying to concat but no files are found.
});
The structure of output.js
will be as follows:
// - header
// - ordered content of the files in headerFiles
// - un-ordered content of files matched by inputFiles, but not in headerFiles or footerFiles
// - ordered content of the files in footerFiles
// - footer
note: this is intended for debugging purposes only, and will most likely negatively affect your build performace is left enabled
Setting the environment variable CONCAT_STATS=true
will result a summary of
each concatention being output to process.cwd() + 'concat-stats-for/*.json'
Each file within that directory represents a different contenation, and will contain:
Want more details? like uglified or compressed sizes? (or have more ideas) go checkout: https://github.com/stefanpenner/broccoli-concat-analyser
concat-stats-for/-file.json
{
"outputFile": "path/to/output/File",
"sizes": {
"a.js": 5,
"b.js": 10,
}
}
other files:
v4.2.5 (2021-04-14)
_content
on rebuild if necessary (@brendenpalmer)FAQs
Fast, good-enough concatenation with source maps.
The npm package broccoli-concat receives a total of 130,031 weekly downloads. As such, broccoli-concat popularity was classified as popular.
We found that broccoli-concat demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.