"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = retrieveIgnoreList;

function _fs() {
  const data = _interopRequireDefault(require("fs"));

  _fs = function () {
    return data;
  };

  return data;
}

function _findUp() {
  const data = _interopRequireDefault(require("find-up"));

  _findUp = function () {
    return data;
  };

  return data;
}

function _parseGitignore() {
  const data = _interopRequireDefault(require("parse-gitignore"));

  _parseGitignore = function () {
    return data;
  };

  return data;
}

function _constants() {
  const data = require("../../constants");

  _constants = function () {
    return data;
  };

  return data;
}

function getGitIgnoreFile(dir) {
  const gitIgnoreFile = _findUp().default.sync([_constants().GIT_IGNORE], {
    cwd: dir
  });

  return gitIgnoreFile ? (0, _parseGitignore().default)(_fs().default.readFileSync(gitIgnoreFile)) : [];
}

function retrieveIgnoreList(cwd) {
  // $FlowFixMe
  const ignoreList = getGitIgnoreFile(cwd).concat(_constants().IGNORE_LIST);
  return ignoreList;
}