-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
rollup.config.js
65 lines (60 loc) · 1.44 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
const path = require('path');
const acorn = require('acorn');
function relative(id) {
if (id[0] !== '/') return id;
if (id[0] !== '\\') return id;
return './' + path.relative(process.cwd(), id);
}
const moduleECode = "console.log('e');\n";
module.exports = {
input: 'main.js',
cache: {
modules: [
{
id: './e.js',
ast: acorn.parse(moduleECode, {
ecmaVersion: 6,
sourceType: 'module'
}),
code: moduleECode,
dependencies: [],
customTransformCache: false,
originalCode: moduleECode,
originalSourcemap: null,
resolvedIds: {},
sourcemapChain: [],
transformDependencies: []
}
]
},
plugins: [
{
name: 'buggy-plugin',
resolveId(id) {
if (id.includes('\0')) return;
// this action will never resolve or reject
if (id.endsWith('c.js')) return new Promise(() => {});
return relative(id);
},
load(id) {
// this action will never resolve or reject
if (id.endsWith('b.js')) return new Promise(() => {});
},
transform(code, id) {
// this action will never resolve or reject
if (id.endsWith('a.js')) return new Promise(() => {});
},
moduleParsed({ id }) {
// this action will never resolve or reject
if (id.endsWith('d.js')) return new Promise(() => {});
},
shouldTransformCachedModule({ id }) {
// this action will never resolve or reject
if (id.endsWith('e.js')) return new Promise(() => {});
}
}
],
output: {
format: 'es'
}
};