Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

esmall

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esmall - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

69

bin/esmall.js

@@ -32,3 +32,3 @@ #!/usr/bin/env node

var Esmall = require('../lib');
var esmall = new Esmall();
var {success, error} = require('./logger');

@@ -52,46 +52,41 @@

function minifyText(err, data) {
if (err) {
error('Something has gone wrong', err);
process.exit(1);
}
esmall.minify(data.toString(), handleMinified);
}
var input;
var output;
var esmall = new Esmall();
function handleMinified(err, minified) {
if (!argv.o) {
process.stdout.write(minified);
process.exit(0);
}
fs.writeFile(resolve(argv.o), minified, cleanup);
}
esmall.on('error', (err) => {
error('Minification failed', err);
process.exit(1);
})
function cleanup(err) {
if (err) {
error('Writing to file failed', err);
process.exit(1);
}
success('It worked 🎉');
process.exit(0);
}
if (process.stdin.isTTY) {
fs.open(resolve(argv._[0]), 'r', function(err, fd) {
if (err) {
if (err.code === 'ENOENT') {
error(`${argv._[0]} does not exist`);
process.exit(1);
} else {
throw err;
}
}
fs.readFile(fd, minifyText);
input = fs.createReadStream(resolve(argv._[0]));
input.on('error', (err) => {
error('Error reading file', err);
});
}
else {
input = process.stdin;
}
if (argv.o) {
output = fs.createWriteStream(resolve(argv.o));
output.on('error', (err) => {
error('Error writing file', err);
process.exit(1)
})
}
else {
process.stdin.pipe(concat((data) => {
minifyText(null, data);
}));
output = process.stdout;
}
input
.pipe(esmall)
.pipe(output)
.on('end', _ => {
success('It worked 🎉');
})
.on('error', (err) => {
error('It did not work', err);
process.exit(1);
});
{
"name": "esmall",
"version": "3.1.0",
"version": "3.2.0",
"description": "Pretty Naive",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc