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 1.1.6 to 1.2.0

40

bin/esmall.js

@@ -18,7 +18,6 @@ #!/usr/bin/env node

/* eslint no-console: 0 */
var fs = require('fs');
var path = require('path');
var concat = require('concat-stream');
var argv = require('yargs')

@@ -36,3 +35,3 @@ .alias('o', 'output')

if (argv._.length === 0) {
if (process.stdin.isTTY && argv._.length === 0) {
error('You must provide an input file!');

@@ -53,5 +52,5 @@ process.exit(1);

function convertFile(err, data) {
function minifyText(err, data) {
if (err) {
error('Reading the file failed', err);
error('Something has gone wrong', err);
}

@@ -78,12 +77,23 @@ esmall(data.toString(), handleMinified);

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;
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, convertFile);
});
fs.readFile(fd, minifyText);
});
}
else {
process.stdin.pipe(concat((data) => {
minifyText(null, data);
}));
}
{
"name": "esmall",
"version": "1.1.6",
"version": "1.2.0",
"description": "Pretty Naive",

@@ -17,2 +17,3 @@ "main": "lib/index.js",

"chalk": "^1.1.3",
"concat-stream": "^1.5.2",
"yargs": "^6.5.0"

@@ -19,0 +20,0 @@ },

@@ -14,3 +14,4 @@ # esmall

$ esmall input.js // output to stdout
$ esmall input.js -o output.js.min // output to file
$ esmall input.js -o output.min.js // output to file
$ cat path/to/file.js | esmall > this-works.min.js
```

@@ -36,3 +37,2 @@

* sync interface for api
* pipe interface for cli
* embed babili

@@ -39,0 +39,0 @@

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