-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #936 from vega/next
- Loading branch information
Showing
10 changed files
with
1,819 additions
and
1,737 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import commonjs from "@rollup/plugin-commonjs"; | ||
import json from "@rollup/plugin-json"; | ||
import resolve from "@rollup/plugin-node-resolve"; | ||
import ts from "rollup-plugin-ts"; | ||
import bundleSize from "rollup-plugin-bundle-size"; | ||
import { terser } from "rollup-plugin-terser"; | ||
|
||
import pkg from "./package.json" assert { type: "json" }; | ||
|
||
const plugins = (browserslist, declaration) => [ | ||
resolve(), | ||
commonjs(), | ||
json(), | ||
ts({ | ||
tsconfig: (resolvedConfig) => ({ | ||
...resolvedConfig, | ||
declaration, | ||
declarationMap: declaration, | ||
}), | ||
transpiler: "babel", | ||
babelConfig: { presets: ["@babel/preset-env"] }, | ||
browserslist, | ||
}), | ||
bundleSize(), | ||
]; | ||
|
||
const outputs = [ | ||
{ | ||
input: "src/embed.ts", | ||
output: { | ||
file: "build/vega-embed.module.js", | ||
format: "esm", | ||
sourcemap: true, | ||
}, | ||
plugins: plugins(undefined, true), | ||
external: [...Object.keys(pkg.dependencies), ...Object.keys(pkg.peerDependencies)], | ||
}, | ||
]; | ||
|
||
for (const build of ["es5", "es6"]) { | ||
const buildFolder = build === "es5" ? "build-es5" : "build"; | ||
outputs.push({ | ||
input: "src/index.ts", | ||
output: [ | ||
{ | ||
file: `${buildFolder}/vega-embed.js`, | ||
format: "umd", | ||
sourcemap: true, | ||
name: "vegaEmbed", | ||
globals: { | ||
vega: "vega", | ||
"vega-lite": "vegaLite", | ||
}, | ||
}, | ||
{ | ||
file: `${buildFolder}/vega-embed.min.js`, | ||
format: "umd", // cannot do iife because rollup generates code that expects Vega-Lite to be present | ||
sourcemap: true, | ||
name: "vegaEmbed", | ||
globals: { | ||
vega: "vega", | ||
"vega-lite": "vegaLite", | ||
}, | ||
plugins: [terser()], | ||
}, | ||
], | ||
plugins: plugins(build === "es5" ? "defaults" : "defaults and not IE 11", false), | ||
external: ["vega", "vega-lite"], | ||
}); | ||
} | ||
|
||
export default outputs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.