1 | import { transform } from 'buble';
|
2 | import { createFilter } from 'rollup-pluginutils';
|
3 |
|
4 | function buble ( options ) {
|
5 | if ( !options ) options = {};
|
6 | var filter = createFilter( options.include, options.exclude );
|
7 |
|
8 | if ( !options.transforms ) options.transforms = {};
|
9 | options.transforms.modules = false;
|
10 |
|
11 | return {
|
12 | name: 'buble',
|
13 |
|
14 | transform: function ( code, id ) {
|
15 | if ( !filter( id ) ) return null;
|
16 |
|
17 | try {
|
18 | return transform( code, options );
|
19 | } catch (e) {
|
20 | e.plugin = 'buble';
|
21 | if ( !e.loc ) e.loc = {};
|
22 | e.loc.file = id;
|
23 | e.frame = e.snippet;
|
24 | throw e;
|
25 | }
|
26 | }
|
27 | };
|
28 | }
|
29 |
|
30 | export default buble;
|