Skip to content

Commit

Permalink
Merge pull request #45 from atom-ide-community/visualizer
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya authored Oct 16, 2020
2 parents 0fa780c + 6ad1f0f commit 9a887da
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@ createPlugins(
which `inputPlugins` is among these:

```
js (considered by default)
ts
babel
coffee
json
css
wasm
(js is considered by default)
visualizer
```

You can pass an input plugin with their supported option:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"rollup-plugin-execute": "^1.1.1",
"csso-cli": "^3.0.0",
"array-includes-any": "^2.7.3",
"rollup-plugin-sourcemaps": "^0.6.3"
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-visualizer": "^4.1.1"
},
"peerDependencies": {
"rollup": "2.31.0",
Expand Down
13 changes: 13 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,19 @@ export function createPlugins(
}
}

// visualizer
const visualizerIndex = includesAny(inputPluginsNames, ["visualizer", "plot"])
if (visualizerIndex !== null) {
const visualizer = require("rollup-plugin-visualizer")
if (typeof inputPluginsNames[visualizerIndex] === "string") {
// plugin name only
plugins.push(visualizer({sourcemap: true, open: true}))
} else {
// plugin with options
plugins.push(visualizer(inputPluginsNames[visualizerIndex][1]))
}
}

// extra plugins
if (typeof extraPlugins !== "boolean" && extraPlugins !== undefined) {
try {
Expand Down

0 comments on commit 9a887da

Please sign in to comment.