This repository was archived by the owner on Aug 4, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,8 +35,15 @@ function createBabelPluginFactory(customCallback = returnObject) {
3535 return pluginOptions => {
3636 let customOptions = null ;
3737
38- if ( overrides . customOptions ) {
39- ( { custom : customOptions = null , plugin : pluginOptions } = overrides . customOptions ( pluginOptions ) ) ;
38+ if ( overrides . options ) {
39+ const overridden = overrides . options ( pluginOptions ) ;
40+
41+ if ( typeof overridden . then === 'function' ) {
42+ throw new Error (
43+ ".options hook can't be asynchronous. It should return `{ customOptions, pluginsOptions }` synchronously." ,
44+ ) ;
45+ }
46+ ( { customOptions = null , pluginOptions } = overridden ) ;
4047 }
4148
4249 const {
Original file line number Diff line number Diff line change @@ -291,9 +291,9 @@ describe('rollup-plugin-babel', function() {
291291 it ( 'supports overriding the plugin options in custom loader' , ( ) => {
292292 const customBabelPlugin = babelPlugin . custom ( ( ) => {
293293 return {
294- customOptions ( options ) {
294+ options ( options ) {
295295 // Ignore the js extension to test overriding the options
296- return { plugin : Object . assign ( { } , options , { extensions : [ '.x' ] } ) } ;
296+ return { pluginOptions : Object . assign ( { } , options , { extensions : [ '.x' ] } ) } ;
297297 } ,
298298 config ( cfg ) {
299299 return Object . assign ( { } , cfg . options , {
You can’t perform that action at this time.
0 commit comments