packages/okam-build/lib/processor/helper/init-view.js
function initViewTransformOptions(file, processOpts, buildManager, isNativeView) {
    let plugins = processOpts.plugins;
    let {appType, componentConf, buildConf} = buildManager;
    if (isNativeView) {
        return Object.assign({}, processOpts, {
            plugins: normalizeViewPlugins(plugins, appType)
        });
    }

    let templateConf = (componentConf && componentConf.template) || {};
    if (!plugins || !plugins.length) {
        plugins = ['syntax'];

        if (templateConf.transformTags) {
            plugins.push('tagTransform');
        }

        // vuePrefix  需要在第一位，v- directives 处理成 directives 再处理
        if (templateConf.useVuePrefix) {
            plugins.unshift('vuePrefix');
        }
    }

    plugins = normalizeViewPlugins(plugins, appType);
    let isSupportRef = buildManager.isEnableRefSupport();
    isSupportRef && addBuiltinPlugin('ref', appType, plugins);

    let isSupportVHtml = buildManager.isEnableVHtmlSupport();
    isSupportVHtml && addBuiltinPlugin('vhtml', appType, plugins);

    addBuiltinPlugin('resource', appType, plugins, true);

    processOpts.plugins = plugins;

    let filterOptions = buildManager.getFilterTransformOptions();
    if (filterOptions) {
        filterOptions = Object.assign({
            onFilter: handleOnFilter.bind(null, file)
        }, filterOptions);
    }

    return Object.assign(
        {},
        processOpts,
        {
            framework: buildConf.framework || [],
            plugins,
            filter: filterOptions,
            template: templateConf,
            onTag: handleOnTag.bind(null, file)
        }
    );
}
function initViewTransformOptions(file, processOpts, buildManager, isNativeView) {
    let plugins = processOpts.plugins;
    let {appType, componentConf, buildConf} = buildManager;
    if (isNativeView) {
        return Object.assign({}, processOpts, {
            plugins: normalizeViewPlugins(plugins, appType)
        });
    }

    let templateConf = (componentConf && componentConf.template) || {};
    if (!plugins || !plugins.length) {
        plugins = ['syntax'];

        if (templateConf.transformTags) {
            plugins.push('tagTransform');
        }

        // vuePrefix  需要在第一位，v- directives 处理成 directives 再处理
        if (templateConf.useVuePrefix) {
            plugins.unshift('vuePrefix');
        }
    }

    plugins = normalizeViewPlugins(plugins, appType);
    let isSupportRef = buildManager.isEnableRefSupport();
    isSupportRef && addBuiltinPlugin('ref', appType, plugins);

    let isSupportVHtml = buildManager.isEnableVHtmlSupport();
    isSupportVHtml && addBuiltinPlugin('vhtml', appType, plugins);

    addBuiltinPlugin('resource', appType, plugins, true);

    processOpts.plugins = plugins;

    let filterOptions = buildManager.getFilterTransformOptions();
    if (filterOptions) {
        filterOptions = Object.assign({
            onFilter: handleOnFilter.bind(null, file)
        }, filterOptions);
    }

    return Object.assign(
        {},
        processOpts,
        {
            framework: buildConf.framework || [],
            plugins,
            filter: filterOptions,
            template: templateConf,
            onTag: handleOnTag.bind(null, file)
        }
    );
}
function initViewTransformOptions ( file , processOpts , buildManager , isNativeView ) { let plugins = processOpts . plugins ; let { appType , componentConf , buildConf } = buildManager ; if ( isNativeView ) { return Object . assign ( { } , processOpts , { plugins : normalizeViewPlugins ( plugins , appType ) } ) ; } let templateConf = ( componentConf && componentConf . template ) || { } ; if ( ! plugins || ! plugins . length ) { plugins = [ 'syntax' ] ; if ( templateConf . transformTags ) { plugins . push ( 'tagTransform' ) ; } // vuePrefix  需要在第一位，v- directives 处理成 directives 再处理 if ( templateConf . useVuePrefix ) { plugins . unshift ( 'vuePrefix' ) ; } } plugins = normalizeViewPlugins ( plugins , appType ) ; let isSupportRef = buildManager . isEnableRefSupport ( ) ; isSupportRef && addBuiltinPlugin ( 'ref' , appType , plugins ) ; let isSupportVHtml = buildManager . isEnableVHtmlSupport ( ) ; isSupportVHtml && addBuiltinPlugin ( 'vhtml' , appType , plugins ) ; addBuiltinPlugin ( 'resource' , appType , plugins , true ) ; processOpts . plugins = plugins ; let filterOptions = buildManager . getFilterTransformOptions ( ) ; if ( filterOptions ) { filterOptions = Object . assign ( { onFilter : handleOnFilter . bind ( null , file ) } , filterOptions ) ; } return Object . assign ( { } , processOpts , { framework : buildConf . framework || [ ] , plugins , filter : filterOptions , template : templateConf , onTag : handleOnTag . bind ( null , file ) } ) ; }
Initialize component view template transform options.

@param {Object} file the file to process
@param {Object} processOpts the process options
@param {Array.<string|Object>} processOpts.plugins the view processor plugins,
the builtin plugins:
`syntax`: transform okam template syntax to mini program template syntax
`tagTransform`: transform tags A to tag B
`ref`: provide view `ref` attribute support like Vue
You can also pass your custom plugin:
{
tag() {} // refer to the ref plugin implementation
}
@param {BuildManager} buildManager the build manager
@param {boolean=} isNativeView whether is native view transformation
@return {Object}
Initialize component view template transform options .