const babel = require ( '@babel/core' ) ; const pluginTransformModulesCommonJs = require ( '@babel/plugin-transform-modules-commonjs' ) ; export function compile ( filename , source ) { return babel . transform ( source , { filename , configFile : false , babelrc : false , highlightCode : false , compact : false , sourceType : 'module' , sourceMaps : true , parserOpts : { plugins : [ 'asyncGenerators' , 'classProperties' , 'classPrivateProperties' , 'classPrivateMethods' , 'optionalCatchBinding' , 'objectRestSpread' , 'numericSeparator' , 'dynamicImport' , 'importMeta' , ] , } , plugins : [ pluginTransformModulesCommonJs ] , } ) ; }