-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrollup.config.js
More file actions
57 lines (49 loc) · 1.42 KB
/
rollup.config.js
File metadata and controls
57 lines (49 loc) · 1.42 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
import {createRequire} from 'module';
import helpers from '@smotaal.io/tools/rollup/helpers.cjs';
const project = {};
project.root = new helpers.Locator(/(?:\/packages)?\/(markout)(?:\/.*|)$/[Symbol.replace](import.meta.url, '/$1/'));
project.package = new helpers.Locator('./package.json', project.root);
project.manifest = new helpers.Locator('./rollup.config.json', project.root);
project.logging = 0;
project.configuation = (typeof require === 'function' ? require : createRequire(import.meta.url))(
project.manifest.filename,
);
export default (project => {
let {
root,
configuation,
logging = configuation.logging || 0,
configuation: {bundles, defaults: {plugins = [], ...defaults} = {}, scopes, fallbacks},
} = project;
let resolver = new helpers.Resolver({
root: root.filename,
scopes,
fallbacks,
logging,
});
let builds = [];
plugins = [
{
resolveId() {
return resolver.resolveId(this, ...arguments);
},
load(){
return resolver.load(this, ...arguments);
}
},
...plugins,
];
if (bundles && bundles.length > 0) {
for (const {input, output, chunks, watch, ...build} of bundles) {
builds.push(
Object.assign(build, defaults, {
input,
output: {...defaults.output, ...output},
watch: {...defaults.watch, ...watch},
plugins,
}),
);
}
}
return builds;
})(project);