Huge News!Announcing our $40M Series B led by Abstract Ventures.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 5.0.2 to 6.0.0

47

index.js
const { codeFrameColumns } = require("@babel/code-frame");
const Worker = require("jest-worker").default;
const serialize = require("serialize-javascript");

@@ -9,6 +10,9 @@ function uglify(userOptions = {}) {

const options = Object.assign({}, userOptions, {
sourceMap: userOptions.sourcemap !== false,
sourcemap: undefined
});
const minifierOptions = serialize(
Object.assign({}, userOptions, {
sourceMap: userOptions.sourcemap !== false,
sourcemap: undefined,
numWorkers: undefined
})
);

@@ -18,19 +22,24 @@ return {

renderStart() {
this.worker = new Worker(require.resolve("./transform.js"), {
numWorkers: userOptions.numWorkers
});
},
renderChunk(code) {
const worker = new Worker(require.resolve("./transform.js"));
return this.worker.transform(code, minifierOptions).catch(error => {
const { message, line, col: column } = error;
console.error(
codeFrameColumns(code, { start: { line, column } }, { message })
);
throw error;
});
},
return worker
.transform(code, options)
.then(result => {
worker.end();
return result;
})
.catch(error => {
worker.end();
const { message, line, col: column } = error;
console.error(
codeFrameColumns(code, { start: { line, column } }, { message })
);
throw error;
});
generateBundle() {
this.worker.end();
},
renderError() {
this.worker.end();
}

@@ -37,0 +46,0 @@ };

{
"name": "rollup-plugin-uglify",
"version": "5.0.2",
"version": "6.0.0",
"description": "Rollup plugin to minify generated bundle",

@@ -11,3 +11,3 @@ "main": "index.js",

"scripts": {
"test": "jest",
"test": "jest --runInBand",
"prepublish": "yarn test"

@@ -30,16 +30,17 @@ },

"jest-worker": "^23.2.0",
"uglify-js": "^3.4.8"
"serialize-javascript": "^1.5.0",
"uglify-js": "^3.4.9"
},
"peerDependencies": {
"rollup": ">=0.65.0 <1"
"rollup": ">=0.66.0 <1"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/core": "^7.0.1",
"@babel/preset-env": "^7.0.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.4.2",
"jest": "^23.5.0",
"babel-jest": "^23.6.0",
"jest": "^23.6.0",
"prettier": "^1.14.2",
"rollup": "^0.65.0"
"rollup": "^0.66.0"
}
}

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

`options.sourcemap` – default: `true`, type: `boolean`. The only own option which is used to generate source maps and pass them to rollup.
`options.sourcemap: boolean`
Generates source maps and passes them to rollup. Defaults to `true`.
`options.numWorkers: number`
Amount of workers to spawn. Defaults to the number of CPUs minus 1.
## Examples

@@ -43,0 +50,0 @@

const { minify } = require("uglify-js");
const transform = (code, options) => {
const transform = (code, optionsString) => {
const options = eval(`(${optionsString})`)
const result = minify(code, options);

@@ -5,0 +6,0 @@ if (result.error) {

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