forked from engine262/engine262
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
54 lines (50 loc) · 1.12 KB
/
rollup.config.js
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
'use strict';
const fs = require('fs');
const { execSync } = require('child_process');
const babel = require('rollup-plugin-babel');
const commonjs = require('rollup-plugin-commonjs');
const nodeResolve = require('rollup-plugin-node-resolve');
const { name, version } = require('./package.json');
const hash = execSync('git rev-parse HEAD', { encoding: 'utf8' }).trim();
const banner = `/*
* engine262 ${version} ${hash}
*
* ${fs.readFileSync('./LICENSE', 'utf8').trim().split('\n').join('\n * ')}
*/
`;
module.exports = () => ({
input: './src/api.mjs',
plugins: [
commonjs(),
nodeResolve(),
babel({
exclude: 'node_modules/**',
plugins: [
'@babel/plugin-syntax-bigint',
'./scripts/transform.js',
],
}),
],
output: [
{
file: 'dist/engine262.js',
format: 'umd',
sourcemap: true,
name,
banner,
},
{
file: 'dist/engine262.mjs',
format: 'es',
sourcemap: true,
banner,
},
],
onwarn(warning, warn) {
if (warning.code === 'CIRCULAR_DEPENDENCY') {
// Squelch.
return;
}
warn(warning);
},
});