--- /dev/null
+"use strict";\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+var path = require("path");\r
+var deep_1 = require("./filters/deep");\r
+var entry_1 = require("./filters/entry");\r
+var pathUtil = require("../utils/path");\r
+var Reader = /** @class */ (function () {\r
+ function Reader(options) {\r
+ this.options = options;\r
+ this.micromatchOptions = this.getMicromatchOptions();\r
+ this.entryFilter = new entry_1.default(options, this.micromatchOptions);\r
+ this.deepFilter = new deep_1.default(options, this.micromatchOptions);\r
+ }\r
+ /**\r
+ * Returns root path to scanner.\r
+ */\r
+ Reader.prototype.getRootDirectory = function (task) {\r
+ return path.resolve(this.options.cwd, task.base);\r
+ };\r
+ /**\r
+ * Returns options for reader.\r
+ */\r
+ Reader.prototype.getReaderOptions = function (task) {\r
+ return {\r
+ basePath: task.base === '.' ? '' : task.base,\r
+ filter: this.entryFilter.getFilter(task.positive, task.negative),\r
+ deep: this.deepFilter.getFilter(task.positive, task.negative),\r
+ sep: '/'\r
+ };\r
+ };\r
+ /**\r
+ * Returns options for micromatch.\r
+ */\r
+ Reader.prototype.getMicromatchOptions = function () {\r
+ return {\r
+ dot: this.options.dot,\r
+ nobrace: !this.options.brace,\r
+ noglobstar: !this.options.globstar,\r
+ noext: !this.options.extension,\r
+ nocase: !this.options.case,\r
+ matchBase: this.options.matchBase\r
+ };\r
+ };\r
+ /**\r
+ * Returns transformed entry.\r
+ */\r
+ Reader.prototype.transform = function (entry) {\r
+ if (this.options.absolute) {\r
+ entry.path = pathUtil.makeAbsolute(this.options.cwd, entry.path);\r
+ }\r
+ if (this.options.markDirectories && entry.isDirectory()) {\r
+ entry.path += '/';\r
+ }\r
+ var item = this.options.stats ? entry : entry.path;\r
+ if (this.options.transform === null) {\r
+ return item;\r
+ }\r
+ return this.options.transform(item);\r
+ };\r
+ /**\r
+ * Returns true if error has ENOENT code.\r
+ */\r
+ Reader.prototype.isEnoentCodeError = function (err) {\r
+ return err.code === 'ENOENT';\r
+ };\r
+ return Reader;\r
+}());\r
+exports.default = Reader;\r