packages/okam-build/lib/build/swan/init-wx2swan-processor.js
function initJsProcessor(opts, defaultBabelProcessorName) {
    let plugins = (opts && opts.plugins) || [jsPlugin];
    registerProcessor({
        name: (opts && opts.processor) || defaultBabelProcessorName, // override existed processor
        hook: {
            before(file, options) {
                if (file.isWxCompScript) {
                    options.plugins || (options.plugins = []);
                    options.plugins.push.apply(options.plugins, plugins);
                }
            }
        }
    });
}
function initJsProcessor(opts, defaultBabelProcessorName) {
    let plugins = (opts && opts.plugins) || [jsPlugin];
    registerProcessor({
        name: (opts && opts.processor) || defaultBabelProcessorName, // override existed processor
        hook: {
            before(file, options) {
                if (file.isWxCompScript) {
                    options.plugins || (options.plugins = []);
                    options.plugins.push.apply(options.plugins, plugins);
                }
            }
        }
    });
}
function initJsProcessor ( opts , defaultBabelProcessorName ) { let plugins = ( opts && opts . plugins ) || [ jsPlugin ] ; registerProcessor ( { name : ( opts && opts . processor ) || defaultBabelProcessorName , // override existed processor hook : { before ( file , options ) { if ( file . isWxCompScript ) { options . plugins || ( options . plugins = [ ] ) ; options . plugins . push . apply ( options . plugins , plugins ) ; } } } } ) ; }
Initialize wx component js processor

@inner
@param {Object=} opts the options to init
@param {string=} opts.processor the builtin processor name, by default `babel`
@param {Array=} opts.plugins the processor plugins
@param {string} defaultBabelProcessorName default babel processor name
Initialize wx component js processor