New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rollup-plugin-uglify

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-uglify - npm Package Compare versions

Comparing version 0.2.0 to 0.3.1

5

dist/index.js
'use strict';
function _interopDefault (ex) { return 'default' in ex ? ex['default'] : ex; }
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }

@@ -9,2 +9,3 @@ var uglify = _interopDefault(require('uglify-js'));

var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var minifier = arguments.length <= 1 || arguments[1] === undefined ? uglify.minify : arguments[1];

@@ -22,3 +23,3 @@ return {

var result = uglify.minify(code, options);
var result = minifier(code, options);

@@ -25,0 +26,0 @@ // Strip sourcemaps comment and extra \n

13

package.json
{
"name": "rollup-plugin-uglify",
"version": "0.2.0",
"version": "0.3.1",
"description": "Rollup plugin to minify generated bundle",

@@ -11,6 +11,5 @@ "main": "dist/index.js",

"scripts": {
"build": "rollup -c -f cjs -o dist/index.js",
"lint": "eslint src test/*.js",
"pretest": "npm run lint && npm run build",
"pretest": "rollup -c",
"test": "ava",
"posttest": "eslint src test/*.js",
"prepublish": "npm test"

@@ -43,7 +42,7 @@ },

"babel-preset-es2015-rollup": "^1.1.1",
"eslint": "^1.10.3",
"eslint-config-postcss": "^1.0.0",
"rollup": "^0.25.2",
"eslint": "^2.0.0",
"eslint-config-postcss": "^2.0.0",
"rollup": "^0.25.3",
"rollup-plugin-babel": "^2.3.9"
}
}

@@ -28,4 +28,20 @@ # rollup-plugin-uglify [![Travis Build Status][travis-img]][travis]

## Warning
[UglifyJS](https://github.com/mishoo/UglifyJS2), which this plugin is based on, does not support the ES2015 module syntax. Thus using this plugin with Rollup's default bundle format (`'es6'`) will not work and error out.
To work around this you can tell `rollup-plugin-uglify` to use the UglifyJS [harmony branch](https://github.com/mishoo/UglifyJS2/tree/harmony) by passing its `minify` function to minify your code.
```js
import { rollup } from 'rollup';
import uglify from 'rollup-plugin-uglify';
import { minify } from 'uglify-js';
rollup({
entry: 'main.js',
plugins: [
uglify({}, minify)
]
});
```
# License
MIT © [Bogdan Chadkin](mailto:trysound@yandex.ru)
import uglify from 'uglify-js';
export default function (options = {}) {
export default function (options = {}, minifier = uglify.minify) {
return {

@@ -15,3 +15,3 @@ transformBundle(code) {

const result = uglify.minify(code, options);
const result = minifier(code, options);

@@ -18,0 +18,0 @@ // Strip sourcemaps comment and extra \n

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