rollup-plugin-visualizer
Advanced tools
Comparing version 4.1.1 to 4.1.2
# Changelog | ||
## 4.1.2 | ||
* Updat deps, drop pupa because it has not stated breaking change | ||
## 4.1.1 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "rollup-plugin-visualizer", | ||
"version": "4.1.1", | ||
"version": "4.1.2", | ||
"main": "plugin/index.js", | ||
@@ -31,5 +31,4 @@ "author": "Denis Bardadym <bardadymchik@gmail.com>", | ||
"open": "^7.0.3", | ||
"pupa": "^2.0.0", | ||
"source-map": "^0.7.3", | ||
"yargs": "^15.0.0" | ||
"yargs": "^16.0.3" | ||
}, | ||
@@ -40,9 +39,9 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^15.0.0", | ||
"@rollup/plugin-commonjs": "^15.1.0", | ||
"@rollup/plugin-node-resolve": "^9.0.0", | ||
"bytes": "^3.1.0", | ||
"d3-array": "^2.2.0", | ||
"d3-array": "^2.8.0", | ||
"d3-color": "^2.0.0", | ||
"d3-hierarchy": "^2.0.0", | ||
"d3-scale": "^3.0.0", | ||
"d3-scale": "^3.2.3", | ||
"d3-shape": "^2.0.0", | ||
@@ -53,8 +52,8 @@ "del-cli": "^3.0.0", | ||
"postcss-url": "^8.0.0", | ||
"preact": "^10.3.3", | ||
"preact": "^10.5.3", | ||
"prettier": "^2.0.1", | ||
"rollup": "^2.0.6", | ||
"rollup-plugin-postcss": "^3.1.1", | ||
"rollup-plugin-terser": "^7.0.0", | ||
"sass": "^1.22.7", | ||
"rollup-plugin-postcss": "^3.1.8", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"sass": "^1.22.11", | ||
"webcola": "^3.4.0" | ||
@@ -61,0 +60,0 @@ }, |
@@ -5,7 +5,51 @@ "use strict"; | ||
const path = require("path"); | ||
const pupa = require("pupa"); | ||
const htmlEscape = (string) => | ||
string | ||
.replace(/&/g, "&") | ||
.replace(/"/g, """) | ||
.replace(/'/g, "'") | ||
.replace(/</g, "<") | ||
.replace(/>/g, ">"); | ||
const buildHtmlTemplate = ({ title, script, nodesData, style }) => | ||
` | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> | ||
<title>${htmlEscape(title)}</title> | ||
<style> | ||
${style} | ||
</style> | ||
</head> | ||
<body> | ||
<main></main> | ||
<script> | ||
/*<!--*/ | ||
${script} | ||
/*-->*/ | ||
</script> | ||
<script> | ||
/*<!--*/ | ||
const data = ${nodesData}; | ||
document.addEventListener('DOMContentLoaded', () => { | ||
const width = window.innerWidth; | ||
const height = window.innerHeight; | ||
const chartNode = document.querySelector("main"); | ||
drawChart(chartNode, data, width, height); | ||
}); | ||
/*-->*/ | ||
</script> | ||
</body> | ||
</html> | ||
`; | ||
module.exports = async function buildHtml({ title, data, template }) { | ||
const [templateString, script, style] = await Promise.all([ | ||
fs.readFile(path.join(__dirname, "stats.template"), "utf-8"), | ||
const [script, style] = await Promise.all([ | ||
fs.readFile(path.join(__dirname, "..", "lib", `${template}.js`), "utf8"), | ||
@@ -15,3 +59,3 @@ fs.readFile(path.join(__dirname, "..", "lib", `${template}.css`), "utf8"), | ||
return pupa(templateString, { | ||
return buildHtmlTemplate({ | ||
title, | ||
@@ -18,0 +62,0 @@ style, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
436832
5
11332
20
+ Addedcliui@7.0.4(transitive)
+ Addedescalade@3.1.2(transitive)
+ Addedwrap-ansi@7.0.0(transitive)
+ Addedy18n@5.0.8(transitive)
+ Addedyargs@16.2.0(transitive)
+ Addedyargs-parser@20.2.9(transitive)
- Removedpupa@^2.0.0
- Removedcamelcase@5.3.1(transitive)
- Removedcliui@6.0.0(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removedescape-goat@2.1.1(transitive)
- Removedfind-up@4.1.0(transitive)
- Removedlocate-path@5.0.0(transitive)
- Removedp-limit@2.3.0(transitive)
- Removedp-locate@4.1.0(transitive)
- Removedp-try@2.2.0(transitive)
- Removedpath-exists@4.0.0(transitive)
- Removedpupa@2.1.1(transitive)
- Removedrequire-main-filename@2.0.0(transitive)
- Removedset-blocking@2.0.0(transitive)
- Removedwhich-module@2.0.1(transitive)
- Removedwrap-ansi@6.2.0(transitive)
- Removedy18n@4.0.3(transitive)
- Removedyargs@15.4.1(transitive)
- Removedyargs-parser@18.1.3(transitive)
Updatedyargs@^16.0.3