Register the custom processor

@param {Object} existedProcessors the existed processors, the key is processor name,
the value is the processor config information.
@param {Object} extnameProcessorMap the file extname associated processors map
@param {Object} opts the processor config
function registerProcessor(existedProcessors, extnameProcessorMap, opts) {
    let {name, processor, deps, rext, extnames, options, order, hook} = opts;
    if (!name) {
        throw new Error('missing processor name to register');
    }

    if (existedProcessors.hasOwnProperty(name)) {
        // override existed processor definition
        overrideProcessor(
            existedProcessors[name], extnameProcessorMap, opts
        );
    }
    else {
        existedProcessors[name] = initProcessorInfo(name, {
            processor,
            deps,
            rext,
            extnames,
            options,
            order,
            hook
        }, existedProcessors);
        addFileExtnameAssociatedProcessor(extnames, name, extnameProcessorMap);
    }

    // resort the file extname associated processors execution order
    if (extnames && !Array.isArray(extnames)) {
        extnames = [extnames];
    }
    extnames && extnames.forEach(
        k => sortDefaultProcessors(extnameProcessorMap[k], existedProcessors)
    );
}