Resolve Vue SFCs, return a Map

@param dirs
@returns {*}
774729
function resolveSFCs (dirs) {
  return dirs.map(
    layoutDir => readdirSync(layoutDir)
      .filter(filename => filename.endsWith('.vue'))
      .map(filename => {
        const componentName = getComponentName(filename)
        return {
          filename,
          componentName,
          isInternal: isInternal(componentName),
          path: resolve(layoutDir, filename)
        }
      })
  ).reduce((arr, next) => {
    arr.push(...next)
    return arr
  }, []).reduce((map, component) => {
    map[component.componentName] = component
    return map
  }, {})
}
313296
function ls (args, cb) {
  args = args.join("/").split("@").join("/")
  if (args.substr(-1) === "/") args = args.substr(0, args.length - 1)
  ls_(args, function(er, files) {
    files = files || []
    output.write(npm.config.get("outfd"), files.join("\n"), cb_)
    function cb_ () { cb(null, files) }
  })
}
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;
}
851993
function resolveEntry(options) {
  const cwd = options.cwd;
  const pkg = options.pkg;
  let entries = [];
  if (is.array(options.entry)) entries = options.entry;
  if (is.string(options.entry)) entries.push(options.entry);

  const result = new Set();

  try {
    // set the entry that module exports
    result.add(require.resolve(cwd));
  } catch (_) {
    // ignore
  }

  for (let entry of entries) {
    const dir = path.join(cwd, entry);
    // if entry is directory, find all js in the directory
    if (fs.existsSync(dir) && fs.statSync(dir).isDirectory()) {
      entry = path.join(entry, '**/*.js');
    }
    const files = glob.sync(entry, { cwd });
    for (const file of files) {
      result.add(path.join(cwd, file));
    }
  }

  if (pkg.bin) {
    const keys = Object.keys(pkg.bin);
    for (const key of keys) {
      result.add(path.join(cwd, pkg.bin[key]));
    }
  }

  const dts = path.join(cwd, 'index.d.ts');
  if (fs.existsSync(dts)) {
    result.add(dts);
  }

  return Array.from(result);
}
912132
private Path[] getMapFiles(FileSystem fs, boolean isLocal)
  throws IOException {
    List<Path> fileList = new ArrayList<Path>();
    if (isLocal) {
      // for local jobs
      for(int i = 0; i < numMaps; ++i) {
        fileList.add(mapOutputFile.getInputFile(i, getTaskID()));
      }
    } else {
      // for non local jobs
      for (FileStatus filestatus : mapOutputFilesOnDisk) {
        fileList.add(filestatus.getPath());
      }
    }
    return fileList.toArray(new Path[0]);
  }
987054
function getDirectoryTree(dir) {
    const items = [];
    return new Promise(function(resolve) {
        fs.walk(dir)
        .on('data', function (item) {
            items.push(item.path);
        })
        .on('end', function () {
            resolve(items);
        });
    });
}
589075
function resolve(files, opts) {
  var fn = opts.filter || function(fp) {
    return true;
  };

  if (opts.realpath === true) {
    return files.filter(fn);
  }

  var len = files.length;
  var idx = -1;
  var res = [];

  while (++idx < len) {
    var fp = path.resolve(opts.cwd, files[idx]);
    if (!fn(fp) || ~res.indexOf(fp)) continue;
    res.push(fp);
  }
  return res;
}
938371
function resolveImages(currentFile, $) {
    var currentDirectory = path.dirname(currentFile);

    return editHTMLElement($, 'img', function($img) {
        var src = $img.attr('src');

        if (LocationUtils.isExternal(src) || LocationUtils.isDataURI(src)) {
            return;
        }

        // Calcul absolute path for this
        src = LocationUtils.toAbsolute(src, currentDirectory, '.');

        // Convert back to relative
        src = LocationUtils.relative(currentDirectory, src);

        $img.attr('src', src);
    });
}
1206840
function mapFiles(files, relative, required) {
  if (!files) {
    return []
  }

  if (Array.isArray(files) === false) {
    files = [files]
  }

  return files.map(f => ({
    file: resolvePath(relative, f),
    required: required
  }))
}
788509
function getDirectories(source) {
  const isDirectory = sourcePath => lstatSync(sourcePath).isDirectory()
  return readdirSync(source)
    .map(name => join(source, name))
    .filter(isDirectory)
}
1316082
function resolveSlots (
  children,
  context
) {
  var slots = {};
  if (!children) {
    return slots
  }
  for (var i = 0, l = children.length; i < l; i++) {
    var child = children[i];
    var data = child.data;
    // remove slot attribute if the node is resolved as a Vue slot node
    if (data && data.attrs && data.attrs.slot) {
      delete data.attrs.slot;
    }
    // named slots should only be respected if the vnode was rendered in the
    // same context.
    if ((child.context === context || child.fnContext === context) &&
      data && data.slot != null
    ) {
      var name = data.slot;
      var slot = (slots[name] || (slots[name] = []));
      if (child.tag === 'template') {
        slot.push.apply(slot, child.children || []);
      } else {
        slot.push(child);
      }
    } else {
      (slots.default || (slots.default = [])).push(child);
    }
  }
  // ignore slots that contains only whitespace
  for (var name$1 in slots) {
    if (slots[name$1].every(isWhitespace)) {
      delete slots[name$1];
    }
  }
  return slots
}
1141930
function filesInRepository(dir) {
        var ignoreDirs = cog.getOption('ignore_dirs');
        // TODO: Allow an array and move to config.
        var ignoreFiles = /~$/;
        var files = glob.sync(dir ? dir + '/*' : '*');
        var ret = [];
        for (var i = 0; i < files.length; i++) {
            if (fs.lstatSync(files[i]).isDirectory()) {
                // Ignore standard directories of uninterest.
                if (!dir && ignoreDirs.indexOf(files[i]) >= 0) {
                    continue;
                }
                ret = filesInRepository(files[i]).concat(ret);
            } else {
                if (!ignoreFiles.test(files[i])) {
                    ret.push(files[i]);
                }
            }
        }
        return ret;
    }
452885
function resolve (specs, opts) {
  const err = validate(specs)
  if (err) {
    return Promise.reject(err)
  }
  const options = opts || {}
  const dir = options.dir || '.'
  const dest = options.dest || 'public'
  return Promise.all(normalize(specs))
    .map((spec) => {
      return Promise.resolve(globby(spec.files, { cwd: dir, nodir: true }))
        .map(filename => createFileUsingSpec(filename, spec, dest))
    }).then(flatten)
}
1009570
function getFolders(dir) {
  try {
    return fs.readdirSync(dir)
      .filter(function (file) {
        return exports.isDirectory(path.join(dir, file));
      });
  } catch (ex) {
    return [];
  }
}
1311050
async function getFiles(dir) {
  const subdirs = await readdir(dir);
  const files = await Promise.all(
    subdirs.map(async subdir => {
      const res = resolve(dir, subdir);
      return (await stat(res)).isDirectory() ? getFiles(res) : res;
    }),
  );
  return files.reduce((a, f) => a.concat(f), []);
}
357592
private List<String> getSchemaStringsFromDir(File dir) {
    List<String> schemaStrings = new ArrayList<String>();
    Collection<File> schemaFiles = FileUtils.listFiles(dir,
        new SuffixFileFilter(".avsc"), TrueFileFilter.INSTANCE);
    for (File schemaFile : schemaFiles) {
      schemaStrings.add(getSchemaStringFromFile(schemaFile));
    }
    return schemaStrings;
  }
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;
    }