-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrollup.config.mjs
More file actions
132 lines (126 loc) · 3.43 KB
/
rollup.config.mjs
File metadata and controls
132 lines (126 loc) · 3.43 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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// SPDX-FileCopyrightText: 2023 XWiki CryptPad Team <contact@cryptpad.org> and contributors
//
// SPDX-License-Identifier: AGPL-3.0-or-later
import commonjs from '@rollup/plugin-commonjs';
import typescript from '@rollup/plugin-typescript';
import terser from '@rollup/plugin-terser';
import json from '@rollup/plugin-json';
//import {nodeResolve} from "@rollup/plugin-node-resolve";
import nodeExternals from 'rollup-plugin-node-externals';
const type = process.env.TYPE;
const getTerser = () => {
return terser({
format: {
comments: 'some',
beautify: true,
ecma: '2015',
},
compress: false,
mangle: false,
module: true,
});
};
const getPlugins = () => {
return [
json(),
typescript(),
/*nodeResolve({
}),*/
nodeExternals(),
commonjs({
ignoreDynamicRequires: true,
dynamicRequireTargets: ['../plugins/*.js'],
ignore:['config/*.js', 'sodium-native', 'crypto', 'node:http', 'node:https'] // required by tweetnacl for node
}),
];
};
const list = [];
if (!type || type === "front") {
list.push({
input: "./front/front.ts",
output: [{
name: 'cryptpad-server-front',
file: "./build/front.js",
format: "cjs",
plugins: [ getTerser() ]
}],
plugins: getPlugins()
});
}
if (!type || type === "core") {
list.push({
input: "./core/core.ts",
output: [{
name: 'cryptpad-server-core',
file: "./build/core.js",
format: "cjs",
plugins: [ getTerser() ]
}],
plugins: getPlugins()
});
list.push({
input: "./core/worker.js",
output: [{
name: 'cryptpad-server-core-worker',
file: "./build/core.worker.js",
format: "cjs",
plugins: [ getTerser() ]
}],
plugins: getPlugins()
});
}
if (!type || type === "storage") {
list.push({
input: "./storage/storage.ts",
output: [{
name: 'cryptpad-server-storage',
file: "./build/storage.js",
format: "cjs",
plugins: [ getTerser() ]
}],
plugins: getPlugins()
});
list.push({
input: "./storage/worker.js",
output: [{
name: 'cryptpad-server-storage-worker',
file: "./build/storage.worker.js",
format: "cjs",
plugins: [ getTerser() ]
}],
plugins: getPlugins()
});
list.push({
input: "./storage/cluster.js",
output: [{
name: 'cryptpad-server-storage-cluster',
file: "./build/storage.cluster.js",
format: "cjs",
plugins: [ getTerser() ]
}],
plugins: getPlugins()
});
}
if (!type || type === "http") {
list.push({
input: "./http-server/http-server.ts",
output: [{
name: 'cryptpad-http-server',
file: "./build/http.js",
format: "cjs",
plugins: [ getTerser() ]
}],
plugins: getPlugins()
});
list.push({
input: "./http-server/worker.js",
output: [{
name: 'cryptpad-http-server-worker',
file: "./build/http.worker.js",
format: "cjs",
plugins: [ getTerser() ]
}],
plugins: getPlugins()
});
}
export default list;