-
Notifications
You must be signed in to change notification settings - Fork 33
/
rollup.config.js
84 lines (76 loc) · 1.66 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Copyright 2017 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @fileoverview Resolve ES6 import statements in node dependencies used by
* nassh and package them into a single, minified ES6 module.
*/
import image from '@rollup/plugin-image';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import terser from '@rollup/plugin-terser';
import yaml from '@rollup/plugin-yaml';
const plugins = [
resolve({
mainFields: ['module', 'jsnext:main'],
preferBuiltins: false
}),
terser(),
commonjs(),
image(),
yaml(),
];
// Common output settings.
const output = {
// This only disables the '__esModule' symbol hack.
esModule: false,
format: 'es',
indent: false,
preferConst: true,
};
/**
* Helper for building up deps.
*
* @param {string} name
* @return {!Object}
*/
function nassh_dep(name) {
return {
input: `js/deps_${name}.shim.js`,
output: {
...output,
file: `js/deps_${name}.rollup.js`,
},
plugins: plugins,
};
}
let targets = [
{
input: '../libdot/index.js',
output: {
...output,
file: 'dist/libdot.js',
},
plugins: plugins,
},
{
input: '../hterm/index.js',
output: {
...output,
file: 'dist/hterm.js',
},
external: [
'../../../libdot/index.js',
'../../libdot/index.js',
'../libdot/index.js',
],
plugins: plugins,
},
nassh_dep('indexeddb-fs'),
nassh_dep('lit'),
nassh_dep('pkijs'),
nassh_dep('punycode'),
nassh_dep('resources'),
nassh_dep('xterm'),
];
export default [...targets];