UNPKG

677 BJavaScriptView Raw
1'use strict';
2
3var buble$1 = require('buble');
4var rollupPluginutils = require('rollup-pluginutils');
5
6function buble(options = {}) {
7 const filter = rollupPluginutils.createFilter(options.include, options.exclude);
8 const transformOptions = { ...options, transforms: { ...options.transforms, modules: false } };
9
10 return {
11 name: 'buble',
12
13 transform(code, id) {
14 if (!filter(id)) return null;
15
16 try {
17 return buble$1.transform(code, transformOptions);
18 } catch (e) {
19 e.plugin = 'buble';
20 if (!e.loc) e.loc = {};
21 e.loc.file = id;
22 e.frame = e.snippet;
23 throw e;
24 }
25 }
26 };
27}
28
29module.exports = buble;