Compile File

@param {Object} file the file to compile
@param {BuildManager} buildManager the build manager
function compile(file, buildManager) {
    let {logger, rules} = buildManager;
    let processors = findMatchProcessor(file, rules, buildManager);
    logger.debug('compile file:', file.path, processors.length);

    file.allowRelease = true; // add allow release flag

    for (let i = 0, len = processors.length; i < len; i++) {
        processFile(file, processors[i], buildManager);
    }

    if (file.isEntryScript) {
        processEntryScript(file, buildManager);
    }
    else if (file.isPageScript || file.isComponentScript) {
        processComponentScript(buildManager, file);
    }

    buildManager.emit('buildFileDone', file);
}