packages/okam-build/lib/processor/js/transform/visitor.js
function getCodeTraverseVisitors(t, initConfig, opts) {
    let {isPage, isComponent, isBehavior, enableMixinSupport, filterOptions} = opts;
    let hasComponents = isPage || isComponent;
    return {
        ObjectProperty(path) {
            let prop = path.node;
            let key = prop.key;
            let keyName = key && key.name;
            if (!isBehavior && keyName === 'config') {
                // extract the app/component/page config definition
                let config = getPlainObjectNodeValue(prop.value, path, t);
                initConfig.config = config;
                removeNode(t, path, {tail: true});

                // skip children traverse
                path.skip();
            }
            else if (enableMixinSupport && keyName === 'mixins') {
                // extract the mixins information for page/component
                let mixins = componentTransformer.getUsedMixinModulePaths(
                    prop.value, path, t, opts
                );
                initConfig.mixins = mixins;

                path.skip();
            }
            else if (!isBehavior && hasComponents && keyName === 'components') {
                // extract the using components information for page/component
                let config = componentTransformer.getUsedComponentInfo(
                    prop.value, path, t
                );
                initConfig.components = config;
                removeNode(t, path, {tail: true});

                path.skip();
            }
            else if (filterOptions && !isBehavior && keyName === 'filters') {
                const {getExportFilterNames, generateCode} = require('./filter');
                let filterNames = getExportFilterNames(prop.value, t);

                if (filterOptions.keepFiltersProp) {
                    initConfig.filters = {
                        filterNames
                    };
                }
                else {
                    let code = generateCode(prop.value, t, filterOptions);
                    initConfig.filters = {
                        code,
                        filterNames
                    };
                    removeNode(t, path, {tail: true});
                }

                path.skip();
            }
            else {
                path.skip();
            }
        }
    };
}
function getCodeTraverseVisitors(t, initConfig, opts) {
    let {isPage, isComponent, isBehavior, enableMixinSupport, filterOptions} = opts;
    let hasComponents = isPage || isComponent;
    return {
        ObjectProperty(path) {
            let prop = path.node;
            let key = prop.key;
            let keyName = key && key.name;
            if (!isBehavior && keyName === 'config') {
                // extract the app/component/page config definition
                let config = getPlainObjectNodeValue(prop.value, path, t);
                initConfig.config = config;
                removeNode(t, path, {tail: true});

                // skip children traverse
                path.skip();
            }
            else if (enableMixinSupport && keyName === 'mixins') {
                // extract the mixins information for page/component
                let mixins = componentTransformer.getUsedMixinModulePaths(
                    prop.value, path, t, opts
                );
                initConfig.mixins = mixins;

                path.skip();
            }
            else if (!isBehavior && hasComponents && keyName === 'components') {
                // extract the using components information for page/component
                let config = componentTransformer.getUsedComponentInfo(
                    prop.value, path, t
                );
                initConfig.components = config;
                removeNode(t, path, {tail: true});

                path.skip();
            }
            else if (filterOptions && !isBehavior && keyName === 'filters') {
                const {getExportFilterNames, generateCode} = require('./filter');
                let filterNames = getExportFilterNames(prop.value, t);

                if (filterOptions.keepFiltersProp) {
                    initConfig.filters = {
                        filterNames
                    };
                }
                else {
                    let code = generateCode(prop.value, t, filterOptions);
                    initConfig.filters = {
                        code,
                        filterNames
                    };
                    removeNode(t, path, {tail: true});
                }

                path.skip();
            }
            else {
                path.skip();
            }
        }
    };
}
function getCodeTraverseVisitors ( t , initConfig , opts ) { let { isPage , isComponent , isBehavior , enableMixinSupport , filterOptions } = opts ; let hasComponents = isPage || isComponent ; return { ObjectProperty ( path ) { let prop = path . node ; let key = prop . key ; let keyName = key && key . name ; if ( ! isBehavior && keyName === 'config' ) { // extract the app/component/page config definition let config = getPlainObjectNodeValue ( prop . value , path , t ) ; initConfig . config = config ; removeNode ( t , path , { tail : true } ) ; // skip children traverse path . skip ( ) ; } else if ( enableMixinSupport && keyName === 'mixins' ) { // extract the mixins information for page/component let mixins = componentTransformer . getUsedMixinModulePaths ( prop . value , path , t , opts ) ; initConfig . mixins = mixins ; path . skip ( ) ; } else if ( ! isBehavior && hasComponents && keyName === 'components' ) { // extract the using components information for page/component let config = componentTransformer . getUsedComponentInfo ( prop . value , path , t ) ; initConfig . components = config ; removeNode ( t , path , { tail : true } ) ; path . skip ( ) ; } else if ( filterOptions && ! isBehavior && keyName === 'filters' ) { const { getExportFilterNames , generateCode } = require ( './filter' ) ; let filterNames = getExportFilterNames ( prop . value , t ) ; if ( filterOptions . keepFiltersProp ) { initConfig . filters = { filterNames } ; } else { let code = generateCode ( prop . value , t , filterOptions ) ; initConfig . filters = { code , filterNames } ; removeNode ( t , path , { tail : true } ) ; } path . skip ( ) ; } else { path . skip ( ) ; } } } ; }
Traverse the module definition information and extract the `config` information
for the app/page/component or mixins/components for page/component.

@inner
@param {Object} t the babel type definition
@param {Object} initConfig the config used to cache the extracted information
@param {Object} opts the transformation options
@return {Object}
Traverse the module definition information and extract the config information for the app / page / component or mixins / components for page / component .