UNPKG

641 BJavaScriptView Raw
1import { transform } from 'buble';
2import { createFilter } from 'rollup-pluginutils';
3
4function buble$1 ( 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 e.loc = { file: id, line: e.loc.line, column: e.loc.column };
22 e.frame = e.snippet;
23 throw e;
24 }
25 }
26 };
27}
28
29export default buble$1;