This repository was archived by the owner on Aug 4, 2021. It is now read-only.
File tree 3 files changed +6
-6
lines changed
3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import * as babel from '@babel/core';
2
2
import { createFilter } from 'rollup-pluginutils' ;
3
3
import createPreflightCheck from './preflightCheck.js' ;
4
4
import helperPlugin from './helperPlugin.js' ;
5
- import { escapeRegExpCharacters , warnOnce } from './utils.js' ;
5
+ import { addBabelPlugin , escapeRegExpCharacters , warnOnce } from './utils.js' ;
6
6
import { RUNTIME , EXTERNAL , HELPERS } from './constants.js' ;
7
7
8
8
const unpackOptions = ( {
@@ -106,7 +106,7 @@ function createBabelPluginFactory(customCallback = returnObject) {
106
106
}
107
107
108
108
if ( helpers !== RUNTIME ) {
109
- transformOptions = { ... transformOptions , plugins : transformOptions . plugins . concat ( helperPlugin ) } ;
109
+ transformOptions = addBabelPlugin ( transformOptions , helperPlugin ) ;
110
110
}
111
111
112
112
const result = babel . transformSync ( code , transformOptions ) ;
Original file line number Diff line number Diff line change 1
1
import { transformSync } from '@babel/core' ;
2
2
import { INLINE , RUNTIME , EXTERNAL } from './constants.js' ;
3
+ import { addBabelPlugin } from './utils.js' ;
3
4
4
5
const MODULE_ERROR =
5
6
'Rollup requires that your Babel configuration keeps ES6 module syntax intact. ' +
@@ -39,10 +40,7 @@ export default function createPreflightCheck() {
39
40
let check = transformed . code ;
40
41
41
42
if ( ~ check . indexOf ( 'class ' ) ) {
42
- check = transformSync ( inputCode , {
43
- ...options ,
44
- plugins : ( options . plugins || [ ] ) . concat ( fallbackClassTransform ) ,
45
- } ) . code ;
43
+ check = transformSync ( inputCode , addBabelPlugin ( options , fallbackClassTransform ) ) . code ;
46
44
}
47
45
48
46
if (
Original file line number Diff line number Diff line change
1
+ export const addBabelPlugin = ( options , plugin ) => ( { ...options , plugins : options . plugins . concat ( plugin ) } ) ;
2
+
1
3
let warned = { } ;
2
4
export function warnOnce ( ctx , msg ) {
3
5
if ( warned [ msg ] ) return ;
You can’t perform that action at this time.
0 commit comments