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

minifyify

Package Overview
Dependencies
Maintainers
1
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minifyify - npm Package Compare versions

Comparing version 3.0.0-beta1 to 3.0.0-beta10

14

lib/index.js

@@ -35,5 +35,2 @@ var Minifier

if(this.opts.map === false)
this.opts.minify = false;
/*

@@ -117,3 +114,3 @@ * Instance variables

if(existingMap && existingMap.sourcesContent && existingMap.sourcesContent.length) {
originalCode = existingMap.sourcesContent[0];
originalCode = convertSM.removeComments(existingMap.sourcesContent[0]);
existingMap = JSON.stringify(existingMap);

@@ -130,3 +127,3 @@ }

fromString: true
, outSourceMap: self.opts.map
, outSourceMap: self.opts.map ? self.opts.map : undefined
, inSourceMap: tempExistingMapFile

@@ -136,3 +133,6 @@ });

thisStream.queue(min.code);
self.registerMap(file, originalCode || unminCode, new SMConsumer(min.map));
if(self.opts.map) {
self.registerMap(file, originalCode || unminCode, new SMConsumer(min.map));
}
}

@@ -175,3 +175,3 @@

return concat(function(data) {
if(!self.opts.minify) {
if(!self.opts.minify || !self.opts.map) {
return cb(null, data, null);

@@ -178,0 +178,0 @@ }

@@ -21,3 +21,3 @@ {

],
"version": "3.0.0-beta1",
"version": "3.0.0-beta10",
"repository": {

@@ -30,2 +30,3 @@ "type": "git",

"through": "2.3.x",
"concat-stream": "1.4.x",
"lodash.defaults": "2.4.x",

@@ -32,0 +33,0 @@ "lodash.foreach": "2.4.x",

@@ -7,3 +7,3 @@ Minifyify

*Now with browserify 4 support*
*Now with Browserify 4 & CoffeeScript support*

@@ -16,3 +16,3 @@ Before, browserify made you choose between sane debugging and sane load times. Now, you can have both.

## Usage
## Simple Usage

@@ -22,18 +22,49 @@ ```js

, minifyify = require('minifyify')
, bundle
, options // See docs below;
, bundler = new browserify();
, minifier = new minifyify();
bundle = new browserify();
bundler.add('entry.js');
bundler.transform({global: true}, minifier.transformer);
bundler
.bundle({debug: true})
.pipe(minifier.consumer(function (err, src, map) {
// Your code here
}));
```
## Full Usage
```js
var path = require('path')
, browserify = require('browserify')
, minifyify = require('minifyify')
, bundler
, minifier
, options = {
compressPath: function (p) {
return path.relative('my-app-root', p);
}
, map: '/bundle.map.json'
};
bundler = new browserify();
minifier = new minifyify(options);
bundle('entry.js')
bundler.add('entry.js')
// Your other transforms
bundler.transform(require('coffeeify'));
bundler.transform(require('hbsfy'));
// Minifies code while tracking sourcemaps
// {global: true} lets us also minify browser shims
bundler.transform({global: true}, minifier.transformer);
bundler
// Debug must be true for minifyify to work
.bundle({debug: true})
// This transform minifies code and tracks sourcemaps
// {global: true} lets you also minify shims
.pipe({global: true}, minifier.transform)
// Consume pulls the source map out of src and transforms the mappings
.pipe(minifier.consume(function (err, src, map) {
.pipe(minifier.consumer(function (err, src, map) {
// src and map are strings

@@ -65,6 +96,14 @@ // src has a comment pointing to map

Set to `false` to disable source maps.
Set to `false` to minify, but not produce a source map or append the source map URL comment.
### [options.minify]
Set to false to disable minification and source map transforms. This essentially turns minifyify into a pass-thru stream.
## FAQ
* Why is this not a *real* transform?
At this time of writing it is not possible to acheive what minifyify does with a pure transform. Minifyify needs to transform browserify's source map, which is only appended after all transforms have run and the bundling process is complete. That is the job of the `.consumer()` function.
* Wait.. Why did the total size (souce code + map) get BIGGER??

@@ -78,3 +117,3 @@

Minifyify runs UglifyJS on each file in your bundle, and uses browserify's sourcemap to translate
Minifyify runs UglifyJS on each file in your bundle, and transforms browserify's sourcemap to map to the original files.

@@ -89,3 +128,3 @@ * Why does the sourcemap cause my debugger to behave erratically?

var myThing = myFunc('a')
, cantGetHere = myFunc('b');
, cantGetHere = myFunc('b');
```

@@ -92,0 +131,0 @@

Sorry, the diff of this file is not supported yet

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