
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Wrapper for gulp projects to provide a lot of syntactic sugar and re-use
npm install --save-dev devour
Devour
provides a thin wrapper for gulp, enabling the use of tasks and pipes defined in separate files.
All of the files will be loaded when devour
is activated, then you specify which tasks should be build and whether or not to watch for changes.
As devour
is designed to incorporate gulp
, you simply include it in your (existing) gulpfile.js
, it will not get in the way of your current tasks (as long as there are no task-name collisions, of course).
Devour installs two cli commands; devour
and gulp
. Both of these will start Devour (although the gulp
command will inform you it was devoured).
As with gulp itself, you can specify which tasks to run by providing them on the command line, for example:
devour myTask myOtherTask mySpecialTask
Will try to start (in order) myTask
, myOtherTask
, mySpecialTask
. Whichever ones are found to be actual tasks are executed, feedback is provided on which tasks are running and which were not found.
The provided tasks will only run once, and once all are done, Devour will exit.
NOTE: when running specific tasks, the verbosity is set to false
in order to reduce the output.
gulpfile.js
As devour
is based on the concept of moving tasks into separate files, you (should) end up with a very clean gulpfile.js
.
devour
Considering this example based on a normal (rather simple) gulpfile.js
var gulp = require('gulp'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
minifycss = require('gulp-minify-css'),
rename = require('gulp-rename');
gulp.task('combine_script', function() {
gulp.src('./src/**/*.js')
.pipe(concat())
.pipe(rename(function(file) {
file.basename = 'combine';
}))
.pipe(gulp.dest('./dist'))
.pipe(uglify())
.pipe(rename(function(file) {
file.basename += '.min';
}))
.pipe(gulp.dest('./dist'))
;
});
gulp.task('combine_style', function() {
gulp.src('./src/**/*.css')
.pipe(concat())
.pipe(rename(function(file) {
file.basename = 'combine';
}))
.pipe(gulp.dest('./dist'))
.pipe(minifycss())
.pipe(rename(function(file) {
file.basename += '.min';
}))
.pipe(gulp.dest('./dist'))
;
});
gulp.task('watch', function() {
gulp.watch('./src/**/*.js', ['combine_script']);
gulp.watch('./src/**/*.css', ['combine_style']);
});
gulp.task('default', ['combine_script', 'combine_style', 'watch']);
devour
Now, let's move those parts around into a bunch of separate files
First, create a named "pipe", which is basically a plugin within your project
// file: gulp/pipe/combine.js
// concatenate the input stream into a single file and name it combine.<extension>
// this works the same for both javascript and stylesheets
module.exports = function(stream, devour) {
return stream
.pipe(devour.plugin('concat'))
.pipe(devour.plugin('rename', function(file) {
file.basename = 'combine';
}))
// write the minified sources to the predefined destination
.pipe(devour.write())
;
};
Now create the tasks, one for javascripts (gulp/task/script.js
) and one for stylesheets (gulp/task/style.js
).
// file: gulp/task/script.js
// concatenate scripts into a single file and uglify it
module.exports = function(stream, devour) {
return stream
// call the named pipe 'combine'
.pipe(devour.pipe('combine'))
// add some gulp plugins to do their magic
.pipe(devour.plugin('uglify'))
.pipe(devour.plugin('rename', devour.min))
// finally, write the minified sources to the predefined destination
.pipe(devour.write())
;
};
The task for stylesheets is similar, except it does not uglify
but uses minify-css
// file: gulp/task/script.js
// concatenate stylesheets into a single file and minify it
module.exports = function(stream, devour) {
return stream
// call the named pipe 'combine'
.pipe(devour.pipe('combine'))
// add some gulp plugins to do their magic
.pipe(devour.plugin('minify-css'))
.pipe(devour.plugin('rename', devour.min))
// finally, write the minified sources to the predefined destination
.pipe(devour.write())
;
};
So, ready for the grande finale? Ok, here comes the gulpfile:
// file: gulpfile.js
var Devour = require('devour'),
devour = new Devour(); // using all the default settings by not providing any of our own
devour
.task('script', ['./src/**/*.js'])
.task('style', ['./src/**/*.css'])
.start()
;
Your project structure now looks somewhat like this:
/gulp
/pipe
combine.js
/task
script.js
style.js
gulpfile.js
What did we just do exactly? We have moved everything into separate files, these files all have a single job, be it a task or a re-usable pipe.
You may also have noticed that there are no requires for the gulp-<plugins>
, this is because devour
will take care of loading any plugin for you. You still needs to add plugins to your project yourself!.
GPLv2 © Konfirm
FAQs
Wrapper for gulp projects to provide a lot of syntactic sugar and re-use
The npm package devour receives a total of 14 weekly downloads. As such, devour popularity was classified as not popular.
We found that devour 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.