packages/okam-build/lib/processor/helper/component.js
function getCompFilesInfoByAppType(filePathNoExtname, options) {
    let {appType, wx2swan, componentExtname} = options;

    // sfc
    let filePath = `${filePathNoExtname}.${componentExtname}`;
    if (isCompFileExists(filePath, options.compileContext)) {
        return {
            missingMustFileExtnames: [],
            fileExtnameMap: {
                [componentExtname]: filePath
            }
        };
    }

    let result = getCompOriginFileInfoByType(appType, filePathNoExtname, options);

    if (!result.missingMustFileExtnames.length) {
        return result;
    }

    if (appType === 'swan' && wx2swan) {
        result = getCompOriginFileInfoByType('wx2swan', filePathNoExtname, options);

        if (!result.missingMustFileExtnames.length) {
            return result;
        }
    }

    result.missingMustFileExtnames = [componentExtname];
    return result;
}
function getCompFilesInfoByAppType(filePathNoExtname, options) {
    let {appType, wx2swan, componentExtname} = options;

    // sfc
    let filePath = `${filePathNoExtname}.${componentExtname}`;
    if (isCompFileExists(filePath, options.compileContext)) {
        return {
            missingMustFileExtnames: [],
            fileExtnameMap: {
                [componentExtname]: filePath
            }
        };
    }

    let result = getCompOriginFileInfoByType(appType, filePathNoExtname, options);

    if (!result.missingMustFileExtnames.length) {
        return result;
    }

    if (appType === 'swan' && wx2swan) {
        result = getCompOriginFileInfoByType('wx2swan', filePathNoExtname, options);

        if (!result.missingMustFileExtnames.length) {
            return result;
        }
    }

    result.missingMustFileExtnames = [componentExtname];
    return result;
}
function getCompFilesInfoByAppType ( filePathNoExtname , options ) { let { appType , wx2swan , componentExtname } = options ; // sfc let filePath = ` ${ filePathNoExtname } ${ componentExtname } ` ; if ( isCompFileExists ( filePath , options . compileContext ) ) { return { missingMustFileExtnames : [ ] , fileExtnameMap : { [ componentExtname ] : filePath } } ; } let result = getCompOriginFileInfoByType ( appType , filePathNoExtname , options ) ; if ( ! result . missingMustFileExtnames . length ) { return result ; } if ( appType === 'swan' && wx2swan ) { result = getCompOriginFileInfoByType ( 'wx2swan' , filePathNoExtname , options ) ; if ( ! result . missingMustFileExtnames . length ) { return result ; } } result . missingMustFileExtnames = [ componentExtname ] ; return result ; }
根据 appType 获取对应的组件信息

@param {string} filePathNoExtname 无后缀名的文件路径
@param {Object} options options
@return {Object}
{
component 类型
componentType,
// 对应原生缺失的必要文件的后缀名
missingMustFileExtnames,
// 后缀名: 文件完整路径 {extname: fullPath}
fileExtnameMap
}
根据 appType 获取对应的组件信息