Skip to content

Commit 3aa2845

Browse files
committed
feat: Refactor to use rollupBuild.write()
This change improves compatibility. Allows plugins that use write hooks to work. Also, support conventional exports in https://broccoli.build/plugins.html#example-plugin Export types declarations.
1 parent dcb733d commit 3aa2845

24 files changed

+856
-599
lines changed

.nycrc.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
{
22
"all": true,
3+
"check-coverage": true,
4+
"lines": 95,
5+
"statements": 95,
6+
"functions": 95,
7+
"branches": 85,
38
"per-file": false,
4-
"include": ["dist/**", "lib/**"],
5-
"exclude": ["dist/tests/**"],
9+
"include": ["dist/**", "src/**"],
10+
"exclude": ["tests/**"],
611
"extension": ["js", "ts"]
712
}

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,8 @@ node_js:
66
cache: yarn
77
script:
88
- yarn test
9+
branches:
10+
only:
11+
- master
12+
# npm version tags
13+
- /^v\d+\.\d+\.\d+/

appveyor.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ build: off
2222

2323
# Set build version format here instead of in the admin panel.
2424
version: '{build}'
25+
26+
branches:
27+
only:
28+
- master

index.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export {
2+
default,
3+
BroccoliRollup,
4+
BroccoliRollupOptions,
5+
InputOptions,
6+
OutputOptions,
7+
RollupOptions,
8+
} from './dist';

index.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
const rollup = require('./dist');
2+
3+
// old API just module.exports = class BroccoliRollup
4+
// this proxies export to it, but catches default and BroccoliRollup keys
5+
// and also, call redirects to default().
6+
module.exports = new Proxy(rollup.BroccoliRollup, {
7+
// support default interop with require
8+
apply(_, thisArg, args) {
9+
return Reflect.apply(rollup.default, thisArg, args);
10+
},
11+
get(target, prop) {
12+
switch (prop) {
13+
case 'default':
14+
case 'BroccoliRollup':
15+
return rollup[prop];
16+
default:
17+
return target[prop];
18+
}
19+
},
20+
has(target, prop) {
21+
switch (prop) {
22+
case 'default':
23+
case 'BroccoliRollup':
24+
return true;
25+
default:
26+
return prop in target;
27+
}
28+
},
29+
ownKeys(target) {
30+
return ['default', 'BroccoliRollup'].concat(Reflect.ownKeys(target));
31+
},
32+
getOwnPropertyDescriptor(target, prop) {
33+
switch (prop) {
34+
case 'default':
35+
case 'BroccoliRollup':
36+
return Reflect.getOwnPropertyDescriptor(rollup, prop);
37+
default:
38+
return Reflect.getOwnPropertyDescriptor(target, prop);
39+
}
40+
},
41+
});

index.ts

Lines changed: 0 additions & 289 deletions
This file was deleted.

lib/heimdall.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)