packages/okam-build/lib/processor/helper/component.js
function initDirFiles(dir, cache) {
    let cacheDirFiles = {};
    cache.setDirFileListInfo(dir, cacheDirFiles);

    let files = fs.readdirSync(dir);
    for (let i = 0, len = files.length; i < len; i++) {
        let file = files[i];
        let fullPath = path.resolve(dir, file);

        let stat = getFileState(fullPath);
        if (!stat || stat.isDirectory()) {
            continue;
        }

        let fileName = getFileName(fullPath);
        let fileList = cacheDirFiles[fileName];
        if (!fileList) {
            fileList = cacheDirFiles[fileName] = [];
        }
        fileList.push(fullPath);
    }

    return cacheDirFiles;
}
function initDirFiles(dir, cache) {
    let cacheDirFiles = {};
    cache.setDirFileListInfo(dir, cacheDirFiles);

    let files = fs.readdirSync(dir);
    for (let i = 0, len = files.length; i < len; i++) {
        let file = files[i];
        let fullPath = path.resolve(dir, file);

        let stat = getFileState(fullPath);
        if (!stat || stat.isDirectory()) {
            continue;
        }

        let fileName = getFileName(fullPath);
        let fileList = cacheDirFiles[fileName];
        if (!fileList) {
            fileList = cacheDirFiles[fileName] = [];
        }
        fileList.push(fullPath);
    }

    return cacheDirFiles;
}
function initDirFiles ( dir , cache ) { let cacheDirFiles = { } ; cache . setDirFileListInfo ( dir , cacheDirFiles ) ; let files = fs . readdirSync ( dir ) ; for ( let i = 0 , len = files . length ; i < len ; i ++ ) { let file = files [ i ] ; let fullPath = path . resolve ( dir , file ) ; let stat = getFileState ( fullPath ) ; if ( ! stat || stat . isDirectory ( ) ) { continue ; } let fileName = getFileName ( fullPath ) ; let fileList = cacheDirFiles [ fileName ] ; if ( ! fileList ) { fileList = cacheDirFiles [ fileName ] = [ ] ; } fileList . push ( fullPath ) ; } return cacheDirFiles ; }
Initialize the file list information in the given directory.
Return the file info structure:
{
'fileName1': ['fullPath11', 'fullPath12'],
'fileName2': ['fullPath21', 'fullPath22']'
}

e.g., the dir `/test/src` has files: `/test/src/a.js`, `/test/src/a.css`
then response:
{
'a': ['/test/src/a.js', '/test/src/a.css']
}

@inner
@param {string} dir the directory to init
@param {CacheManager} cache the cache manager
@return {Object}
Initialize the file list information in the given directory . Return the file info structure : { fileName1 : [ fullPath11 fullPath12 ] fileName2 : [ fullPath21 fullPath22 ] }