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.
@fang/terser
Advanced tools
Compress Javascript files using Terser.
I created this plugin to be able to compress Javascript files. Terser is the most popular and currently maintained Javascript compression tool, and I wanted fang to have an official plugin for it.
Having @fang/core installed on version 0.*
.
npm install --save-dev @fang/terser
yarn add --dev @fang/terser
This example assumes you have a example/code.js
file containing your code, and you want to output a compressed code in example/dist/js/code.js
.
// script.js
const { run } = require("@fang/core");
const save = require("@fang/save");
const terser = require("@fang/terser");
const js = {
name: "Javascript",
input: "example/code.js",
tasks: [
terser(),
save({
folder: "example/dist/js",
}),
],
};
const main = async () => await run([js]);
main();
Run your script, and you should see something like this in the console.
$ node script.js
fang: start
8 CPUs core(s)
1 tasks to run
Javascript: start
Javascript: 30.604ms
fang: 183.533ms
This examples assumes you havbe a example/code.js
file containing your code, and your want to output a compressed code in example/dist/js/code.js
.
// script.js
const { run } = require("@fang/core");
const save = require("@fang/save");
const terser = require("../lib");
const js = {
name: "Javascript",
input: "example/code.js",
tasks: [
terser({
compress: {
passes: 5,
unsafe: true,
pure_getters: true,
},
toplevel: true,
}),
save({
folder: "example/dist/js",
}),
],
};
const main = async () => await run([js]);
main();
Run node script.js
, and you should see something like this in your console.
$ node script.js
fang: start
8 CPUs core(s)
1 tasks to run
Javascript: start
Javascript: 37.211ms
fang: 168.672ms
FAQs
Compress Javascript files using Terser.
The npm package @fang/terser receives a total of 0 weekly downloads. As such, @fang/terser popularity was classified as not popular.
We found that @fang/terser 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
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.