packages/okam-build/lib/processor/json/component-json.js
function compile(file, options) {
    const {resolve: resolveDep, logger} = options;

    try {
        let componentConf = JSON.parse(file.content.toString());
        let usingComponents = componentConf[USING_COMPONENT_KEY];
        if (!usingComponents || !file.component) {
            return {content: file.content};
        }

        let result = {};
        let scriptFile = file.component;
        Object.keys(usingComponents).forEach(k => {
            let value = usingComponents[k];
            if (!value) {
                return;
            }

            let resolvePath = resolveDep(
                scriptFile, value
            );
            result[toHyphen(k)] = resolvePath || value;

            let resolveModInfo = scriptFile.resolvedModIds[value];
            let componentFile = resolveModInfo && resolveModInfo.file;
            componentFile && analyseNativeComponent(componentFile, options);
        });

        // update usingComponent information
        componentConf[USING_COMPONENT_KEY] = result;

        return {
            content: JSON.stringify(componentConf, null, 4)
        };
    }
    catch (ex) {
        logger.error(
            `Parse component config ${file.path} fail`,
             ex.stack || ex.toString()
        );
    }

    return {content: file.content};
}
function compile(file, options) {
    const {resolve: resolveDep, logger} = options;

    try {
        let componentConf = JSON.parse(file.content.toString());
        let usingComponents = componentConf[USING_COMPONENT_KEY];
        if (!usingComponents || !file.component) {
            return {content: file.content};
        }

        let result = {};
        let scriptFile = file.component;
        Object.keys(usingComponents).forEach(k => {
            let value = usingComponents[k];
            if (!value) {
                return;
            }

            let resolvePath = resolveDep(
                scriptFile, value
            );
            result[toHyphen(k)] = resolvePath || value;

            let resolveModInfo = scriptFile.resolvedModIds[value];
            let componentFile = resolveModInfo && resolveModInfo.file;
            componentFile && analyseNativeComponent(componentFile, options);
        });

        // update usingComponent information
        componentConf[USING_COMPONENT_KEY] = result;

        return {
            content: JSON.stringify(componentConf, null, 4)
        };
    }
    catch (ex) {
        logger.error(
            `Parse component config ${file.path} fail`,
             ex.stack || ex.toString()
        );
    }

    return {content: file.content};
}
Process the component dependence sub components based on `usingComponent`
info defined in json.

@param {Object} file the file to process
@param {Object} options the compile options
@return {{content: string}}