-
Notifications
You must be signed in to change notification settings - Fork 627
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
185 additions
and
200 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import alias from '@rollup/plugin-alias'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import json from '@rollup/plugin-json'; | ||
import nodeResolve from '@rollup/plugin-node-resolve'; | ||
import terser from '@rollup/plugin-terser'; | ||
import typescript from '@rollup/plugin-typescript'; | ||
import bundleSize from 'rollup-plugin-bundle-size'; | ||
|
||
import pkg from './package.json' with {type: 'json'}; | ||
|
||
const extensions = ['.js', '.ts']; | ||
|
||
export function disallowedImports() { | ||
return { | ||
resolveId: module => { | ||
if (['vega', 'util', 'd3'].includes(module)) { | ||
throw new Error('Cannot import from Vega, Node Util, or D3 in Vega-Lite.'); | ||
} | ||
return null; | ||
} | ||
}; | ||
} | ||
|
||
export function debugImports() { | ||
return { | ||
resolveId: module => { | ||
if (module === 'pako') { | ||
throw new Error('Do not import pako in builds. Did you forget to remove drawDataflow?'); | ||
} | ||
return null; | ||
} | ||
}; | ||
} | ||
|
||
const outputs = [ | ||
{ | ||
input: 'src/index.ts', | ||
output: { | ||
file: pkg.exports.default, | ||
format: 'esm', | ||
sourcemap: true | ||
}, | ||
plugins: [ | ||
nodeResolve({browser: true, extensions}), | ||
commonjs(), | ||
json(), | ||
typescript({ | ||
tsconfig: './tsconfig.build.json' | ||
}), | ||
bundleSize() | ||
], | ||
external: [...Object.keys(pkg.dependencies), ...Object.keys(pkg.peerDependencies)] | ||
}, | ||
{ | ||
input: 'src/index.ts', | ||
output: { | ||
file: pkg.unpkg, | ||
format: 'umd', | ||
name: 'vegaLite', | ||
sourcemap: true, | ||
globals: { | ||
vega: 'vega' | ||
} | ||
}, | ||
plugins: [ | ||
disallowedImports(), | ||
debugImports(), | ||
alias({ | ||
entries: { | ||
'vega-event-selector': 'vega', | ||
'vega-expression': 'vega', | ||
'vega-util': 'vega' | ||
} | ||
}), | ||
nodeResolve({browser: true, extensions}), | ||
commonjs(), | ||
json(), | ||
typescript({ | ||
tsconfig: './tsconfig.build.json' | ||
}), | ||
terser(), | ||
bundleSize() | ||
], | ||
external: ['vega'] | ||
} | ||
]; | ||
|
||
export default outputs; |
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
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.