forked from engine262/engine262
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.js
More file actions
58 lines (54 loc) · 1.27 KB
/
rollup.config.js
File metadata and controls
58 lines (54 loc) · 1.27 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
'use strict';
const fs = require('fs');
const { execSync } = require('child_process');
const { babel } = require('@rollup/plugin-babel');
const commonjs = require('@rollup/plugin-commonjs');
const json = require('@rollup/plugin-json');
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: [
json({ compact: true }),
commonjs(),
nodeResolve(),
babel({
babelHelpers: 'bundled',
exclude: 'node_modules/**',
plugins: [
'@babel/plugin-proposal-optional-chaining',
'./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;
}
process.exitCode = 1;
warn(warning);
},
});