* @param {object} [options] * @param {bool} [options.cacheDirectory] Use cache directory. Defaults to true. * @param {string[]} [options.plugins] Babel plugins to use. * @param {string[]} [options.presets] Babel presets to use. *
(options = {})
| 14 | * @return {Function} |
| 15 | */ |
| 16 | function babel(options = {}) { |
| 17 | options = Object.assign( |
| 18 | { |
| 19 | cacheDirectory: true |
| 20 | }, |
| 21 | options |
| 22 | ) |
| 23 | |
| 24 | const setter = context => prevConfig => { |
| 25 | context.babel = context.babel || {} |
| 26 | |
| 27 | // Merge babel config into the one stored in context |
| 28 | context.babel = Object.assign( |
| 29 | {}, |
| 30 | context.babel, |
| 31 | options, |
| 32 | options.plugins ? { plugins: (context.babel.plugins || []).concat(options.plugins) } : {}, |
| 33 | options.presets ? { presets: (context.babel.presets || []).concat(options.presets) } : {} |
| 34 | ) |
| 35 | return prevConfig |
| 36 | } |
| 37 | |
| 38 | return Object.assign(setter, { post: postConfig }) |
| 39 | } |
| 40 | |
| 41 | function postConfig(context, util) { |
| 42 | const ruleConfig = Object.assign( |
no outgoing calls
no test coverage detected
searching dependent graphs…