packages/okam-build/lib/processor/helper/builtin.js
function initProcessorInfo(name, info, existedProcessors) {
    let processor = info.processor;
    if (!processor) {
        return info;
    }

    if (typeof processor === 'string') {
        // if the processor refer to the existed processor, merge the existed
        // processor info with current processor
        let old = existedProcessors[processor];
        if (old) {
            info.processor = undefined;
            // remove undefined attributes
            info = removeUndefinedAttributes(info);

            let deps = info.deps;
            deps && !Array.isArray(deps) && (deps = [deps]);

            let oldDeps = old.deps;
            oldDeps && !Array.isArray(oldDeps) && (oldDeps = [oldDeps]);

            info = Object.assign({}, old, info);
            info.deps = merge(deps || [], oldDeps || []);

            return Object.assign({refer: processor}, old, info);
        }
    }

    try {
        info.processor = resolveProcessor(processor);
    }
    catch (ex) {
        let msg = `processor \`${name}\` handler \`${processor}\` not `
            + `found: ${ex.message || ex.toString()}`;
        throw new Error(msg);
    }
    return info;
}
function initProcessorInfo(name, info, existedProcessors) {
    let processor = info.processor;
    if (!processor) {
        return info;
    }

    if (typeof processor === 'string') {
        // if the processor refer to the existed processor, merge the existed
        // processor info with current processor
        let old = existedProcessors[processor];
        if (old) {
            info.processor = undefined;
            // remove undefined attributes
            info = removeUndefinedAttributes(info);

            let deps = info.deps;
            deps && !Array.isArray(deps) && (deps = [deps]);

            let oldDeps = old.deps;
            oldDeps && !Array.isArray(oldDeps) && (oldDeps = [oldDeps]);

            info = Object.assign({}, old, info);
            info.deps = merge(deps || [], oldDeps || []);

            return Object.assign({refer: processor}, old, info);
        }
    }

    try {
        info.processor = resolveProcessor(processor);
    }
    catch (ex) {
        let msg = `processor \`${name}\` handler \`${processor}\` not `
            + `found: ${ex.message || ex.toString()}`;
        throw new Error(msg);
    }
    return info;
}
function initProcessorInfo ( name , info , existedProcessors ) { let processor = info . processor ; if ( ! processor ) { return info ; } if ( typeof processor === 'string' ) { // if the processor refer to the existed processor, merge the existed // processor info with current processor let old = existedProcessors [ processor ] ; if ( old ) { info . processor = undefined ; // remove undefined attributes info = removeUndefinedAttributes ( info ) ; let deps = info . deps ; deps && ! Array . isArray ( deps ) && ( deps = [ deps ] ) ; let oldDeps = old . deps ; oldDeps && ! Array . isArray ( oldDeps ) && ( oldDeps = [ oldDeps ] ) ; info = Object . assign ( { } , old , info ) ; info . deps = merge ( deps || [ ] , oldDeps || [ ] ) ; return Object . assign ( { refer : processor } , old , info ) ; } } try { info . processor = resolveProcessor ( processor ) ; } catch ( ex ) { let msg = ` \` ${ name } \` \` ${ processor } \` ` + ` ${ ex . message || ex . toString ( ) } ` ; throw new Error ( msg ) ; } return info ; }
Initialize processor information

@inner
@param {string} name the processor name
@param {Object} info the processor info
@param {Object} existedProcessors the existed processors
@return {Object}
Initialize processor information