rollup-plugin-visualizer
Advanced tools
Comparing version 2.2.0 to 2.2.1
@@ -1075,15 +1075,32 @@ (function () { | ||
class Id { | ||
constructor(id) { | ||
this._id = id; | ||
this._href = createUrl({ hash: id }).href; | ||
} | ||
get id() { | ||
return this._id; | ||
} | ||
get href() { | ||
return this._href; | ||
} | ||
toString() { | ||
return `url(${this.href})`; | ||
} | ||
} | ||
function uid(name) { | ||
return new Id("O-" + (name == null ? "" : name + "-") + ++count); | ||
count += 1; | ||
const id = ["O", name, count].filter(Boolean).join("-"); | ||
return new Id(id); | ||
} | ||
function Id(id) { | ||
this.id = id; | ||
this.href = window.location.href + "#" + id; | ||
function createUrl(options = {}) { | ||
const url = new URL(window.location); | ||
return Object.assign(url, options); | ||
} | ||
Id.prototype.toString = function() { | ||
return "url(" + this.href + ")"; | ||
}; | ||
function getAncestors(node) { | ||
@@ -1742,3 +1759,3 @@ const parents = []; | ||
//https://www.d3-graph-gallery.com/graph/interactivity_tooltip.html#template | ||
// https://www.d3-graph-gallery.com/graph/interactivity_tooltip.html#template | ||
@@ -1756,3 +1773,3 @@ const createTooltip = node => | ||
const createMouseover = (tooltipNode, container) => d => tooltipNode.style("opacity", 1); | ||
const createMouseover = (tooltipNode) => () => tooltipNode.style("opacity", 1); | ||
@@ -1777,3 +1794,3 @@ const createMousemove = (tooltipNode, container, totalSize) => d => { | ||
const createMouseleave = (tooltipNode, container) => d => tooltipNode.style("opacity", 0); | ||
const createMouseleave = (tooltipNode) => () => tooltipNode.style("opacity", 0); | ||
@@ -1780,0 +1797,0 @@ const WIDTH = 1000; |
@@ -1075,15 +1075,32 @@ (function () { | ||
class Id { | ||
constructor(id) { | ||
this._id = id; | ||
this._href = createUrl({ hash: id }).href; | ||
} | ||
get id() { | ||
return this._id; | ||
} | ||
get href() { | ||
return this._href; | ||
} | ||
toString() { | ||
return `url(${this.href})`; | ||
} | ||
} | ||
function uid(name) { | ||
return new Id("O-" + (name == null ? "" : name + "-") + ++count); | ||
count += 1; | ||
const id = ["O", name, count].filter(Boolean).join("-"); | ||
return new Id(id); | ||
} | ||
function Id(id) { | ||
this.id = id; | ||
this.href = window.location.href + "#" + id; | ||
function createUrl(options = {}) { | ||
const url = new URL(window.location); | ||
return Object.assign(url, options); | ||
} | ||
Id.prototype.toString = function() { | ||
return "url(" + this.href + ")"; | ||
}; | ||
function getAncestors(node) { | ||
@@ -1603,3 +1620,3 @@ const parents = []; | ||
//https://www.d3-graph-gallery.com/graph/interactivity_tooltip.html#template | ||
// https://www.d3-graph-gallery.com/graph/interactivity_tooltip.html#template | ||
@@ -1617,3 +1634,3 @@ const createTooltip = node => | ||
const createMouseover = (tooltipNode, container) => d => tooltipNode.style("opacity", 1); | ||
const createMouseover = (tooltipNode) => () => tooltipNode.style("opacity", 1); | ||
@@ -1638,3 +1655,3 @@ const createMousemove = (tooltipNode, container, totalSize) => d => { | ||
const createMouseleave = (tooltipNode, container) => d => tooltipNode.style("opacity", 0); | ||
const createMouseleave = (tooltipNode) => () => tooltipNode.style("opacity", 0); | ||
@@ -1641,0 +1658,0 @@ const WIDTH = 1000; |
{ | ||
"name": "rollup-plugin-visualizer", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"main": "plugin.js", | ||
@@ -9,4 +9,5 @@ "author": "Denis Bardadym <bardadymchik@gmail.com>", | ||
"lib/*", | ||
"build-html.js", | ||
"plugin.js" | ||
"plugin.js", | ||
"build-stats.js", | ||
"stats.template" | ||
], | ||
@@ -17,15 +18,17 @@ "repository": { | ||
}, | ||
"homepage": "https://github.com/btd/rollup-plugin-visualizer", | ||
"bugs": { | ||
"url": "https://github.com/btd/rollup-plugin-visualizer/issues" | ||
}, | ||
"scripts": { | ||
"lint": "eslint .", | ||
"build": "cp ./src/*.css ./lib/ && rollup -c rollup.config.js -i ./src/script-sunburst.js -o ./lib/main-sunburst.js && rollup -c rollup.config.js -i ./src/script-treemap.js -o ./lib/main-treemap.js && rollup -c rollup.config.js -i ./src/script-circlepacking.js -o ./lib/main-circlepacking.js", | ||
"build:dev": "cp ./src/*.css ./lib/ && rollup -c rollup.config-dev.js -i ./src/script-sunburst.js -o ./lib/main-sunburst.js && rollup -c rollup.config-dev.js -i ./src/script-treemap.js -o ./lib/main-treemap.js && rollup -c rollup.config-dev.js -i ./src/script-circlepacking.js -o ./lib/main-circlepacking.js", | ||
"prepare": "yarn run build", | ||
"test": "echo \"Error: no test specified\" && exit 0" | ||
"build": "rollup -c rollup.config.js", | ||
"build:dev": "rollup -c rollup.config-dev.js", | ||
"clean": "del-cli lib", | ||
"prepare": "yarn run build" | ||
}, | ||
"dependencies": { | ||
"d3-collection": "^1.0.7", | ||
"mkdirp": "^0.5.1", | ||
"open": "^6.3.0", | ||
"source-map": "^0.7.3", | ||
"typeface-oswald": "0.0.54" | ||
"pupa": "^2.0.0", | ||
"source-map": "^0.7.3" | ||
}, | ||
@@ -37,2 +40,3 @@ "peerDependencies": { | ||
"bytes": "^3.1.0", | ||
"d3-collection": "^1.0.7", | ||
"d3-hierarchy": "^1.1.8", | ||
@@ -42,8 +46,13 @@ "d3-scale": "^3.0.0", | ||
"d3-shape": "^1.3.4", | ||
"del-cli": "^2.0.0", | ||
"eslint": "^5.14.1", | ||
"postcss-url": "^8.0.0", | ||
"prettier": "^1.16.4", | ||
"rollup": "^1.14.0", | ||
"rollup": "^1.15.6", | ||
"rollup-plugin-commonjs": "^10.0.0", | ||
"rollup-plugin-node-resolve": "^5.0.1", | ||
"rollup-plugin-uglify": "^6.0.2" | ||
"rollup-plugin-node-resolve": "^5.0.3", | ||
"rollup-plugin-postcss": "^2.0.3", | ||
"rollup-plugin-uglify": "^6.0.2", | ||
"sass": "^1.21.0", | ||
"typeface-oswald": "0.0.54" | ||
}, | ||
@@ -50,0 +59,0 @@ "engines": { |
"use strict"; | ||
const fs = require("fs").promises; | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const opn = require("open"); | ||
const { promisify } = require("util"); | ||
const { SourceMapConsumer } = require("source-map"); | ||
const buildHtml = require("./build-html"); | ||
const buildStats = require("./build-stats"); | ||
const mkdir = promisify(fs.mkdir); | ||
const writeFile = promisify(fs.writeFile); | ||
@@ -20,3 +23,3 @@ const PLUGIN_PREFIX = "\u0000"; | ||
const template = opts.template || "sunburst"; //'sunburst' | ||
const template = opts.template || "sunburst"; | ||
@@ -28,3 +31,2 @@ return { | ||
for (const [id, bundle] of Object.entries(outputBundle)) { | ||
//console.log(id, bundle); | ||
if (bundle.isAsset) continue; //only chunks | ||
@@ -40,3 +42,4 @@ | ||
} | ||
const html = await buildHtml(title, roots, template); | ||
const html = await buildStats(title, roots, template); | ||
await mkdir(path.dirname(filename), { recursive: true }); | ||
await writeFile(filename, html); | ||
@@ -56,7 +59,7 @@ if (open) { | ||
for (const [id, module] of Object.entries(bundle.modules)) { | ||
for (const [id, mod] of Object.entries(bundle.modules)) { | ||
const name = id; | ||
const m = { | ||
size: useSourceMap ? module.minifiedSize || 0 : module.renderedLength, | ||
originalSize: module.originalLength | ||
size: useSourceMap ? mod.minifiedSize || 0 : mod.renderedLength, | ||
originalSize: mod.originalLength | ||
}; | ||
@@ -73,7 +76,2 @@ | ||
async function writeFile(filename, contents) { | ||
await fs.mkdir(path.dirname(filename), { recursive: true }); | ||
return await fs.writeFile(filename, contents); | ||
} | ||
function getDeepMoreThenOneChild(tree) { | ||
@@ -80,0 +78,0 @@ if (tree.children && tree.children.length === 1) { |
@@ -49,5 +49,11 @@ # Rollup Plugin Visualizer | ||
## Build plugin | ||
For development if you need to build plugin, just exec: | ||
```js | ||
yarn run build | ||
``` | ||
## Acknowledgements | ||
Initially this plugin was based on [webpack-visualizer](http://chrisbateman.github.io/webpack-visualizer/), but in the end used only styles and layout. Thanks to the tons of people around internet for great examples of d3 usage. Also i would like to thank you Mike Bostock for awesome D3, and tons of examples. | ||
Initially this plugin was based on `webpack-visualizer`, but in the end used only styles and layout. Thanks to the tons of people around internet for great examples of d3 usage. Also i would like to thank you Mike Bostock for awesome D3, and tons of examples. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
375066
4
13
7602
0
0
59
17
+ Addedpupa@^2.0.0
+ Addedescape-goat@2.1.1(transitive)
+ Addedpupa@2.1.1(transitive)
- Removedd3-collection@^1.0.7
- Removedmkdirp@^0.5.1
- Removedtypeface-oswald@0.0.54
- Removedd3-collection@1.0.7(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedtypeface-oswald@0.0.54(transitive)