Skip to content

Commit

Permalink
fix(okam-build): fix event arguments when event is swan native
Browse files Browse the repository at this point in the history
  • Loading branch information
xhong0 committed Jan 22, 2019
1 parent c99ed61 commit 2948a9b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
6 changes: 0 additions & 6 deletions packages/okam-build/lib/build/swan/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
'use strict';

const BuildManager = require('../BuildManager');
const initNativeSwanProcessor = require('./init-native-swan-processor');
const initWx2SwanProcessor = require('./init-wx2swan-processor');

class BuildSwanAppManager extends BuildManager {
Expand All @@ -20,11 +19,6 @@ class BuildSwanAppManager extends BuildManager {
const nativeOpts = buildConf.native;
const defaultBabelProcessorName = this.defaultBabelProcessorName;

// register native swan processor
if (nativeOpts !== false) {
initNativeSwanProcessor(nativeOpts, defaultBabelProcessorName);
}

// register wx2swan processors
let wx2swanOpts = buildConf.wx2swan;
if (wx2swanOpts) {
Expand Down
11 changes: 6 additions & 5 deletions packages/okam-build/lib/build/swan/init-wx2swan-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const {registerProcessor} = require('../../processor/type');
const wxmlPlugin = require('../../processor/template/plugins/syntax/wx2swan-syntax-plugin');
const wxssPlugin = require('../../processor/css/plugins/postcss-plugin-wx2swan');
const jsPlugin = require('../../processor/js/plugins/babel-wx2swan-plugin');
const adapterPlugin = require('../../processor/js/plugins/babel-native-swan-plugin');

/**
* Initialize wx component js processor
Expand All @@ -21,12 +20,12 @@ const adapterPlugin = require('../../processor/js/plugins/babel-native-swan-plug
* @param {string} defaultBabelProcessorName default babel processor name
*/
function initJsProcessor(opts, defaultBabelProcessorName) {
let plugins = (opts && opts.plugins) || [jsPlugin, adapterPlugin];
let plugins = (opts && opts.plugins) || [jsPlugin];
registerProcessor({
name: (opts && opts.processor) || defaultBabelProcessorName, // override existed processor
hook: {
before(file, options) {
if (file.isWxCompScript && !adapterPlugin.isAdapterModule(file.path)) {
if (file.isWxCompScript) {
options.plugins || (options.plugins = []);
options.plugins.push.apply(options.plugins, plugins);
}
Expand All @@ -45,7 +44,8 @@ function initJsProcessor(opts, defaultBabelProcessorName) {
function initTplProcessor(opts) {
registerProcessor({
name: 'wxml2swan',
processor: 'view', // using the existed view processor
// using the existed view processor
processor: 'view',
extnames: ['wxml'],
rext: 'swan',
options: opts || {
Expand All @@ -66,7 +66,8 @@ function initTplProcessor(opts) {
function initStyleProcessor(opts) {
registerProcessor({
name: 'wxss2css',
processor: 'postcss', // using the existed postcss processor
// using the existed postcss processor
processor: 'postcss',
extnames: ['wxss'],
rext: 'css',
options: opts || {
Expand Down

0 comments on commit 2948a9b

Please sign in to comment.