Generates entry object by scanning directories
for *.pack.scss, *.pack.sass, and *.pack.js files

@param {array} dirs
@return {Object} entry object
351735
function _entry(dirs) {
  return Utils.reduce(dirs, (memo, dir) => {
    const packs = glob.sync(resolve(dir, '**/*.pack.+(s[ac]ss|js)'));
    packs.forEach((pack) => {
      const key = relative(dir, pack).replace(/\.pack\.[^/.]+$/, '');
      /* eslint-disable-next-line no-param-reassign */
      memo[key] = [pack];
    });

    return memo;
  }, {});
}
124880
function buildDocsEntry() {
  const output = join('docs/src/docs-entry.js');
  const getName = fullPath => fullPath.replace(/\/(en|zh)/, '.$1').split('/').pop().replace('.md', '');
  const docs = glob
    .sync([
      join('docs/**/*.md'),
      join('packages/**/*.md'),
      '!**/node_modules/**'
    ])
    .map(fullPath => {
      const name = getName(fullPath);
      return `'${name}': () => import('${path.relative(join('docs/src'), fullPath).replace(/\\/g, '/')}')`;
    });

  const content = `${tips}
export default {
  ${docs.join(',\n  ')}
};
`;
  fs.writeFileSync(output, content);
}
408773
function getFiles(dir) {
    var files = [];

    var traverse = function (dir) {
        var dirList = dir.listFiles();
        dirList.forEach(function (file) {
            if (/\.css$/.test(file)) {
                files.push(file);
            } else if (file.isDirectory()) {
                traverse(file);
            }
        });
    };

    traverse(dir);

    return files;
}
1056653
function getFilesInDirectory(entry, reader, accumEntries, existingPromise) {
        var promise = existingPromise || new qq.Promise(),
            dirReader = reader || entry.createReader();

        dirReader.readEntries(
            function readSuccess(entries) {
                var newEntries = accumEntries ? accumEntries.concat(entries) : entries;

                if (entries.length) {
                    setTimeout(function() { // prevent stack overflow, however unlikely
                        getFilesInDirectory(entry, dirReader, newEntries, promise);
                    }, 0);
                }
                else {
                    promise.success(newEntries);
                }
            },

            promise.failure
        );

        return promise;
    }
734032
public function dirs(array $dirs)
    {
        foreach ($dirs as $k => $v) {
            if (is_numeric($v)) {
                $this->dir($k, $v);
                continue;
            }
            $this->dir($v);
        }

        return $this;
    }
924286
function getLocalNodeFiles(dir) {
    dir = path.resolve(dir);

    var result = [];
    var files = [];
    var icons = [];
    try {
        files = fs.readdirSync(dir);
    } catch(err) {
        return {files: [], icons: []};
    }
    files.sort();
    files.forEach(function(fn) {
        var stats = fs.statSync(path.join(dir,fn));
        if (stats.isFile()) {
            if (/\.js$/.test(fn)) {
                var info = getLocalFile(path.join(dir,fn));
                if (info) {
                    result.push(info);
                }
            }
        } else if (stats.isDirectory()) {
            // Ignore /.dirs/, /lib/ /node_modules/
            if (!/^(\..*|lib|icons|node_modules|test|locales)$/.test(fn)) {
                var subDirResults = getLocalNodeFiles(path.join(dir,fn));
                result = result.concat(subDirResults.files);
                icons = icons.concat(subDirResults.icons);
            } else if (fn === "icons") {
                var iconList = scanIconDir(path.join(dir,fn));
                icons.push({path:path.join(dir,fn),icons:iconList});
            }
        }
    });
    return {files: result, icons: icons};
}
184637
function getEntryImports(dir, content, arr = []) {
	$C(content.split(eol)).forEach((line) => {
		if (!hasImport.test(line)) {
			return;
		}

		const
			url = RegExp.$2,
			nodeModule = isNodeModule(url);

		if (nodeModule && entriesDir.test(url) || insideEntry.test(url)) {
			const
				d = nodeModule ? lib : dir;

			let
				f = path.join(d, `${url}.js`);

			if (!fs.existsSync(f)) {
				f = path.join(d, url, 'index.js');
			}

			getEntryImports(path.dirname(f), fs.readFileSync(f, 'utf-8'), arr);

		} else {
			arr.push(nodeModule ? url : path.join(dir, url));
		}
	});

	return arr;
}
603151
function readDirAbs(dir, cb) {
  fs.readdir(dir, function(err, entries) {
    if (err || !entries) {
      return cb(err, null);
    }
    var items = [];
    entries.forEach(function(entry) {
      items.push(path.join(dir, entry));
    });
    return cb(null, items);
  });
}
771535
function ( files ) {
        files = files || [ ];

        var me = this;
        var nEntries = files.map( function ( file ) {
          return me.getFileDescriptor( file );
        } );

        //normalizeEntries = nEntries;
        return nEntries;
      }
159023
function writeDirectories(result) {
  var deferred = q.defer();
  util.mkdir(result.root)
    .then(function() {return util.mkdir(result.template);})
    .then(function() {return util.mkdir(result.data);})
    .then(function() {return util.mkdir(result.output);})
    .then(function() {return util.mkdir(result.js);})
    .then(function() {return util.mkdir(result.css);})
    .fail(function(err) {
      deferred.reject(new Error(err));
    })
    .done(function(result) {
      deferred.resolve();
    });
  return deferred.promise;
}
108942
async function scriptsFromDirectory(dirpath) {
  const dir = (await readdir(dirpath))
    .map(name => toFullPath(name, dirpath))
    .filter(await filters.onlyFiles)
    .filter(filters.onlyWithExtension('.js'));
  const result = {};
  for (const filepath of dir) {
    const name = path.basename(filepath, '.js');
    const script = await readFile(filepath, 'utf8');
    result[name] = script;
  }
  return result;
}
609412
function generateCodeEntryJs (config) {

	// Read the entry point script
	var entry_js = null;
	try {
		// Read from current script
		entry_js = fs.readFileSync(ENTRY_POINT_FILENAME).toString();
	} catch (e) {
		// Read from template script
		entry_js = fs.readFileSync(__dirname + '/../templates/' + ENTRY_POINT_FILENAME + '.tmpl').toString() + '\n';
	}

	return entry_js;

}
209850
function (dir, search, excludedDirs) {
        excludedDirs = excludedDirs || [];

        var result = [];
        var files = fs.readdirSync(dir);
        for (var i = 0; i < files.length; i++) {
            var fullpath = path.join(dir, files[i]);
            var stat = fs.statSync(fullpath);
            if (stat.isDirectory() && (!excludedDirs.contains(fullpath))) {
                result = result.concat(utilities.recursiveFindFiles(fullpath, search));
            }
            else if (!search || (fullpath.indexOf(search) >= 0)) {
                result.push(fullpath);
            }
        }
        return result;
    }
304729
function getEntries(config, env) {
  let entries = {
    main: []
  };

  //default entry point
  entries.main.push(path.resolve(config.sourceDir, 'index'));

  //svg-sprite
  if (utils.isFileExists(config.svgSpriteDir)) {
    entries.main.unshift(path.resolve(__dirname, './entries/svg-sprite.js'));
  }

  //extend default entries
  if (config.extendEntries && typeof config.extendEntries == 'object') {
    entries = merge(entries, config.extendEntries);
  }

  if (env === 'development') {
    let entryKeys = Object.keys(entries);
    entryKeys.forEach(function (e) {
      if (typeof entries[e] === 'string') {
        entries[e] = [entries[e]]
      }
      entries[e].unshift('webpack-hot-middleware/client?reload=true');
    });
  }

  return entries;
}
1077193
def expand_dirs_to_files(*dirs)
      extensions = %w[rb erb rake rhtml haml slim builder rxml rabl]

      dirs.flatten.map do |entry|
        next unless File.exist? entry

        if File.directory? entry
          Dir[File.join(entry, '**', "*.{#{extensions.join(',')}}")]
        else
          entry
        end
      end.flatten
    end
1333107
public function addResources($dirs)
    {
        $finder = Finder::create()
            ->files()
            ->filter(function (\SplFileInfo $file) {
                return 2 === substr_count($file->getBasename(), '.') && preg_match('/\.\w+$/', $file->getBasename());
            })
            ->in($dirs)
        ;

        foreach ($finder as $file) {
            list($translationDomain, $locale, $extension) = $foo = explode('.', $file->getBasename(), 3);

            $this->handler->addResource($extension, $file->getPathname(), $locale, $translationDomain);
        }
    }
723246
function createFileTree (filePaths)
{
  var path = require ('path')
    , root = {
    files:      [],
    subfolders: new Map
  };

  filePaths.forEach (function (filename)
  {
    var dir = path.dirname (filename)
      , folderPtr = root;
    if (dir)
      dir.split (path.sep).forEach (function (segment)
      {
        if (!folderPtr.subfolders.has (segment))
          folderPtr.subfolders.set (segment, {
            files:      [],
            subfolders: new Map
          });
        folderPtr = folderPtr.subfolders.get (segment);
      });
    folderPtr.files.push (filename);
  });
  return root;
}