Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
gulp-rollup-each
Advanced tools
Gulp plugin for Rollup. Yet another gulp-rollup plugin that allows to input/output multiple files.
Gulp plugin for Rollup.
Yet another gulp-rollup plugin that allows to input/output multiple files for static site.
npm i gulp-rollup-each
const gulp = require('gulp')
const rollupEach = require('gulp-rollup-each')
function scripts () {
return gulp
.src([
'src/**/*.js',
'!src/**/_*' // exclude modules
])
.pipe(
rollupEach({
output: {
// outputOptions
format: 'iife'
}
})
)
.pipe(gulp.dest('dist'))
}
with sourcemaps and Buble
const gulp = require('gulp')
const sourcemaps = require('gulp-sourcemaps')
const rollupEach = require('gulp-rollup-each')
const buble = require('@rollup/plugin-buble')
function scripts () {
return gulp
.src([
'src/**/*.js',
'!src/**/_*' // exclude modules
])
.pipe(sourcemaps.init())
.pipe(
rollupEach(
{
// inputOptions
external: ['jquery'],
plugins: [
buble({
target: {
ie: 11
}
})
],
isCache: true // enable Rollup cache
},
{
// outputOptions
format: 'iife',
globals: {
jquery: 'jQuery'
}
}
)
)
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist'))
}
rollupEach(inputOptions [[, outputOptions], rollup])
inputOptions
The 1st argument is the same object as inputOptions
.
However, the input
option is the file specified in gulp.src()
, so it can not be specified as gulp-rollup-each option.
If you want to enable the Rollup cache
, set isCache
option to true
.
function scripts () {
return gulp
.src(['src/**/*.js'])
.pipe(
rollupEach(
{
isCache: true // enable Rollup cache
},
{
format: 'iife'
}
)
)
.pipe(gulp.dest('dist'))
}
outputOptions
The 2nd argument is the same object as outputOptions
.
If you omit the 2nd argument, output
in the 1st argument changes to outputOptions
.
function scripts () {
return gulp
.src(['src/**/*.js'])
.pipe(
rollupEach({
output: {
// outputOptions
format: 'iife'
}
})
)
.pipe(gulp.dest('dist'))
}
You can also pass a function that returns rollup options object as an argument. The function will receive vinyl file object.
const path = require('path')
const gulp = require('gulp')
const rollupEach = require('gulp-rollup-each')
function scripts () {
return gulp
.src(['src/**/*.js'])
.pipe(
rollupEach(
{
external: [/* ... */],
plugins: [/* ... */]
},
file => {
return {
format: 'umd',
name: path.basename(file.path, '.js')
}
}
)
)
.pipe(gulp.dest('dist'))
}
rollup
You can specify the 3rd argument for replacing rollup
object by your dependency. It is useful if you want to use a new version of rollup than gulp-rollup-each is using.
function scripts () {
return gulp
.src(['src/**/*.js'])
.pipe(
rollupEach(
{},
{
format: 'iife'
},
// Passing rollup object
require('rollup')
)
)
.pipe(gulp.dest('dist'))
}
MIT
FAQs
Gulp plugin for Rollup. Yet another gulp-rollup plugin that allows to input/output multiple files.
The npm package gulp-rollup-each receives a total of 466 weekly downloads. As such, gulp-rollup-each popularity was classified as not popular.
We found that gulp-rollup-each demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.