-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
rollup.config.prod.js
executable file
·102 lines (92 loc) · 2.82 KB
/
rollup.config.prod.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
const path = require('path');
const { nodeResolve } = require('@rollup/plugin-node-resolve');
const terser = require ('@rollup/plugin-terser');
const license = `/*
Wombat.js client-side rewriting engine for web archive replay
Copyright (C) 2014-${new Date().getFullYear()} Webrecorder Software, Rhizome, and Contributors. Released under the GNU Affero General Public License.
This file is part of wombat.js, see https://github.com/webrecorder/wombat.js for the full source
Wombat.js is part of the Webrecorder project (https://github.com/webrecorder)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/`
const outputDir = process.env.OUTPUT_DIR || path.join(__dirname, 'dist');
const addLicenceNoStrict = {
renderChunk(code) {
return `${license}\n${code.replace("'use strict';", '')}`;
}
};
const minificationOpts = {
booleans: false,
builtIns: false,
comments: false,
deadcode: false,
flipComparisons: false,
infinity: false,
keepClassName: true,
keepFnName: true,
mangle: false,
removeUndefined: false,
simplifyComparisons: false,
sourceMap: false,
typeConstructors: false,
undefinedToVoid: false
};
module.exports = [
{
input: 'src/wbWombat.js',
plugins: [nodeResolve({ browser: true }), terser(), addLicenceNoStrict],
output: {
name: 'wombat',
file: path.join(outputDir, 'wombat.js'),
format: 'iife'
}
},
{
input: 'src/wbWombatProxyMode.js',
plugins: [terser(), addLicenceNoStrict],
output: {
name: 'wombatProxyMode',
file: path.join(outputDir, 'wombatProxyMode.js'),
format: 'iife'
}
},
{
input: 'src/wombatWorkers.js',
plugins: [terser(), addLicenceNoStrict],
output: {
name: 'wombatWorkers',
file: path.join(outputDir, 'wombatWorkers.js'),
format: 'es',
sourcemap: false,
exports: 'none'
}
},
{
input: 'src/autoFetchWorker.js',
plugins: [
{
renderChunk(code) {
if (!code.startsWith("'use strict';")) {
return "'use strict';\n" + code;
}
return code;
}
}
],
output: {
name: 'autoFetchWorker',
file: path.join(outputDir, 'autoFetchWorker.js'),
format: 'es',
sourcemap: false,
exports: 'none'
}
}
];