Compile template

@param {Object} file the file to compile
@param {Object} options compile option
@param {Object} options.config compile config
@param {Array.<Array|Object>} options.config.plugins the template transform plugins
the plugin item structure: `[transform, options]` or `transform`
@return {Object}
function compileTpl(file, options) {
    let {config} = options;
    let allowCache = !config || config.cache == null || config.cache;
    let content = file.content.toString();
    const ast = file.ast || parseDom(content);
    allowCache && (file.ast = ast);

    let plugins = mergeVisitors((config && config.plugins) || []);

    transformAst(
        ast, plugins,
        Object.assign({}, options, {file})
    );

    let {keepOriginalContent} = config || {};
    if (!keepOriginalContent) {
        // serialize by xml mode, close all elements
        content = serializeDom(ast, {xmlMode: true});
    }

    return {
        ast,
        content
    };
}