-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.js
More file actions
42 lines (37 loc) · 1.01 KB
/
rollup.config.js
File metadata and controls
42 lines (37 loc) · 1.01 KB
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
import terser from '@rollup/plugin-terser'
import pkg from './package.json' with { type: 'json' }
const EXTERNAL = [] // external modules
const GLOBALS = {} // https://rollupjs.org/guide/en/#outputglobals
const OUTPUT_DIR = 'dist'
// Why rollup although there is only one file as of current?
// We might want to switch the regular expression engine to https://github.com/le0pard/re2js in the future,
// which can effectively safeguard smolyaml from ReDoS attacks.
const makeConfig = () => {
const banner = `/*!
* ${pkg.name}
* ${pkg.description}
*
* @version v${pkg.version}
* @author ${pkg.author}
* @homepage ${pkg.homepage}
* @repository ${pkg.repository}
* @license ${pkg.license}
*/`
return [{
input: 'src/smolyaml.js',
external: EXTERNAL,
output: [
{
banner,
file: `${OUTPUT_DIR}/smolyaml.js`,
format: 'es',
exports: 'auto',
globals: GLOBALS,
sourcemap: true
}
],
plugins: [terser()]
},
]
}
export default () => makeConfig()