Add ref plugin

@inner
@param {string} pluginName the builtin plugin name to add
@param {string} appType the app type to transform
@param {Array.<Object>} plugins the existed plugins
@param {boolean=} insertAtTop whether insert the added plugin at the first position
function addBuiltinPlugin(pluginName, appType, plugins, insertAtTop) {
    let pluginInfo = BUILTIN_PLUGINS[pluginName];
    if (typeof pluginInfo === 'object') {
        pluginInfo = pluginInfo[appType] || pluginInfo.default;
    }
    pluginInfo = normalizeViewPlugins([pluginInfo], appType)[0];

    let plugin = Array.isArray(pluginInfo) ? pluginInfo[0] : pluginInfo;
    let hasBuiltinPlugin = plugins.some(
        item => (plugin === (Array.isArray(item) ? item[0] : item))
    );
    if (!hasBuiltinPlugin) {
        plugins[insertAtTop ? 'unshift' : 'push'](pluginInfo);
    }
}