You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.1 KiB

2 years ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const path = require("path");
  4. const fsStat = require("@nodelib/fs.stat");
  5. const utils = require("../utils");
  6. class Reader {
  7. constructor(_settings) {
  8. this._settings = _settings;
  9. this._fsStatSettings = new fsStat.Settings({
  10. followSymbolicLink: this._settings.followSymbolicLinks,
  11. fs: this._settings.fs,
  12. throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks
  13. });
  14. }
  15. _getFullEntryPath(filepath) {
  16. return path.resolve(this._settings.cwd, filepath);
  17. }
  18. _makeEntry(stats, pattern) {
  19. const entry = {
  20. name: pattern,
  21. path: pattern,
  22. dirent: utils.fs.createDirentFromStats(pattern, stats)
  23. };
  24. if (this._settings.stats) {
  25. entry.stats = stats;
  26. }
  27. return entry;
  28. }
  29. _isFatalError(error) {
  30. return !utils.errno.isEnoentCodeError(error) && !this._settings.suppressErrors;
  31. }
  32. }
  33. exports.default = Reader;