rollup-plugin-visualizer
Advanced tools
Comparing version 0.6.0 to 0.7.0
{ | ||
"name": "rollup-plugin-visualizer", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"main": "plugin.js", | ||
@@ -22,7 +22,7 @@ "author": "Denis Bardadym <bardadymchik@gmail.com>", | ||
"mkdirp": "^0.5.1", | ||
"source-map": "^0.7.2" | ||
"source-map": "^0.7.3" | ||
}, | ||
"devDependencies": { | ||
"bytes": "^3.0.0", | ||
"d3-hierarchy": "^1.0.2", | ||
"d3-hierarchy": "^1.1.6", | ||
"d3-scale": "^2.0.0", | ||
@@ -32,7 +32,7 @@ "d3-selection": "^1.3.0", | ||
"eslint": "^4.19.1", | ||
"prettier": "^1.11.1", | ||
"rollup": "^0.57.1", | ||
"rollup-plugin-commonjs": "^9.1.0", | ||
"prettier": "^1.13.4", | ||
"rollup": "^0.60.1", | ||
"rollup-plugin-commonjs": "^9.1.3", | ||
"rollup-plugin-node-resolve": "^3.3.0", | ||
"rollup-plugin-uglify": "^3.0.0" | ||
"rollup-plugin-uglify": "^4.0.0" | ||
}, | ||
@@ -39,0 +39,0 @@ "engines": { |
@@ -12,10 +12,4 @@ "use strict"; | ||
const cssString = fs.readFileSync( | ||
path.join(__dirname, "lib", "./style.css"), | ||
"utf8" | ||
); | ||
const jsString = fs.readFileSync( | ||
path.join(__dirname, "lib", "./pluginmain.js"), | ||
"utf8" | ||
); | ||
const cssString = fs.readFileSync(path.join(__dirname, "lib", "./style.css"), "utf8"); | ||
const jsString = fs.readFileSync(path.join(__dirname, "lib", "./pluginmain.js"), "utf8"); | ||
@@ -31,18 +25,19 @@ const PLUGIN_PREFIX = "\u0000"; | ||
return { | ||
ongenerate(args, rendered) { | ||
const bundle = args.bundle; | ||
generateBundle(outputOptions, outputBundle) { | ||
//XXX fix how multi entry files rendered | ||
//XXX not sure what is a best UI | ||
//XXX maybe multiple circles? | ||
Object.keys(outputBundle).forEach(id => { | ||
const bundle = outputBundle[id]; | ||
return Promise.resolve() | ||
.then(() => { | ||
if (useSourceMap) { | ||
return addMinifiedSizesToModules(bundle, rendered); | ||
} | ||
}) | ||
.then(() => { | ||
const root = buildTree(bundle, useSourceMap); | ||
flattenTree(root); | ||
if (useSourceMap) { | ||
return addMinifiedSizesToModules(bundle); | ||
} | ||
const html = buildHtml(title, root, filename); | ||
return writeFile(filename, html); | ||
}); | ||
const root = buildTree(bundle, useSourceMap); | ||
flattenTree(root); | ||
const html = buildHtml(title, root, filename); | ||
return writeFile(filename, html); | ||
}); | ||
} | ||
@@ -57,10 +52,8 @@ }; | ||
}; | ||
bundle.modules.forEach(module => { | ||
const name = module.id; | ||
Object.keys(bundle.modules).forEach(id => { | ||
const module = bundle.modules[id]; | ||
const name = id; | ||
const m = { | ||
//dependencies: module.dependencies, | ||
size: useSourceMap | ||
? module.minifiedSize || 0 | ||
: Buffer.byteLength(module.code, "utf8"), | ||
originalSize: Buffer.byteLength(module.originalCode, "utf8") | ||
size: useSourceMap ? module.minifiedSize || 0 : module.renderedLength, | ||
originalSize: module.originalLength | ||
}; | ||
@@ -104,5 +97,3 @@ | ||
function writeFile(filename, contents) { | ||
return mkdirpAsync(path.dirname(filename)).then(() => | ||
writeFileAsync(filename, contents) | ||
); | ||
return mkdirpAsync(path.dirname(filename)).then(() => writeFileAsync(filename, contents)); | ||
} | ||
@@ -189,3 +180,3 @@ | ||
// Matching is done by removing the file extensions and comparing path segments | ||
function addMinifiedSizesToModules(bundle, rendered) { | ||
function addMinifiedSizesToModules(bundle) { | ||
const findBestMatchingModule = filename => { | ||
@@ -197,4 +188,4 @@ const filenameSegments = segments(filename); | ||
const matches = bundle.modules.filter(module => { | ||
const moduleSegments = segments(module.id); | ||
const matches = Object.keys(bundle.modules).filter(id => { | ||
const moduleSegments = segments(id); | ||
const rightVals = moduleSegments.slice(0, i); | ||
@@ -215,4 +206,4 @@ if (rightVals.length !== leftVals.length) { | ||
return SourceMapConsumer.with(rendered.map, null, map => { | ||
const fileSizes = getBytesPerFileUsingSourceMap(rendered.code, map); | ||
return SourceMapConsumer.with(bundle.map, null, map => { | ||
const fileSizes = getBytesPerFileUsingSourceMap(bundle.code, map); | ||
fileSizes.forEach(tuple => { | ||
@@ -219,0 +210,0 @@ const module = findBestMatchingModule(tuple.file); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
141809
3941
1
Updatedsource-map@^0.7.3