code: function buildRegExps(basePath, dirPaths) {
    return dirPaths.map(folderPath =>
      // Babel `only` option works with forward slashes in the RegExp so replace
      // backslashes for Windows.
      new RegExp(`^${escapeRegExp(path.resolve(basePath, folderPath).replace(/\\/g, '/'))}`)
    );
  }
docs: We use absolute paths for matching only the top-level folders reliably. For
  example, we would not want to match some deeply nested forder that happens to
  have the same name as one of `BABEL_ENABLED_PATHS`.