
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
metalsmith-uglify
Advanced tools
This is an UglifyJS plugin for Metalsmith and is a successor to the original plugin written by Keith Smith.
Install the package:
npm install metalsmith-uglify
Add the plugin to your Metalsmith build chain:
const metalsmith = require('metalsmith');
const uglify = require('metalsmith-uglify');
metalsmith(__dirname)
.source('./src')
.destination('./public')
.use(uglify());
.build(function (err) {
if (err) {
throw err;
}
console.log('Build complete');
});
The plugin function accepts a configuration object as the first argument.
{boolean} options.es
-
Set to use terser
package instead of uglify-js
.
It will set also set options.uglify.ecma = 6
by default.
{object} options.concat
-
Set to concatenate to a single bundle file.
{string} options.concat.file
-
Name of the bundle file. Default is scripts.min.js
.
{string} options.concat.root
-
Directory where the bundle file will be placed.
This option overrides options.root
.
{Array[string]} options.files
-
List of files to be processed.
If options.concat
is set, files will be passed to UglifyJS in that order.
This option is only needed for bundling badly written code (e.g. jQuery) that relies on files being processed in a certain order.
This option overrides options.filter
.
{function} options.filter
-
Function to filter the list of JavaScript files.
By default .min.js
files are excluded.
{string} options.root
-
Set to limit the plugin to a specific source directory.
{boolean} options.removeOriginal
-
Set to exclude the original (unminified) file from the output directory.
{boolean} options.sameName
-
Set to keep minified name as is without adding .min
.
This option overrides options.removeOriginal
and is ignored if options.concat
is set.
{object} options.uglify
-
UglifyJS configuration (see UglifyJS docs).
Default is { sourceMap: { includeSources: true } }
.
{boolean} options.windows
-
Set this if you are using the plugin on Windows.
If you are using any of the root
options, you will need to use \\
instead of /
in the path.
Version 2 is a rewrite of the plugin with significant breaking changes to the options object.
Please refer to the upgrade document for more information.
To build the example page run:
make example
Inspect files in example/
for more information.
Set the DEBUG
variable to see what the plugin is doing.
If you are troubleshooting the plugin itself then the following should be enough:
DEBUG=metalsmith-uglify:info:* node build.js
If you think the problem is actually related to something UglifyJS does then you can get more detail:
DEBUG=metalsmith-uglify:* node build.js
FAQs
An uglify plugin for Metalsmith.
We found that metalsmith-uglify demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.