-
Notifications
You must be signed in to change notification settings - Fork 353
/
rollup.config.mjs
56 lines (52 loc) · 1.17 KB
/
rollup.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import babel from "@rollup/plugin-babel";
import terser from "@rollup/plugin-terser";
import { readFile } from "node:fs/promises";
async function getBanner() {
const filePath = new URL("./package.json", import.meta.url);
const contents = await readFile(filePath, { encoding: "utf8" });
const packageVersion = JSON.parse(contents).version;
return `/*!
Viz.js ${packageVersion}
Copyright (c) 2023 Michael Daines
This distribution contains other software in object code form:
Graphviz https://www.graphviz.org
Expat https://libexpat.github.io
*/`;
}
export default [
{
input: "src/standalone.mjs",
output: {
name: "Viz",
file: "lib/viz-standalone.js",
format: "umd",
banner: getBanner,
plugins: [
terser()
]
},
plugins: [
babel({
babelHelpers: "bundled",
ignore: ["./lib/encoded.mjs"]
})
]
},
{
input: "src/standalone.mjs",
output: {
file: "lib/viz-standalone.mjs",
format: "es",
banner: getBanner,
plugins: [
terser()
]
},
plugins: [
babel({
babelHelpers: "bundled",
ignore: ["./lib/encoded.mjs"]
})
]
}
];