.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / fast-glob / out / providers / reader-sync.js
1 "use strict";\r
2 var __extends = (this && this.__extends) || (function () {\r
3     var extendStatics = function (d, b) {\r
4         extendStatics = Object.setPrototypeOf ||\r
5             ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r
6             function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r
7         return extendStatics(d, b);\r
8     };\r
9     return function (d, b) {\r
10         extendStatics(d, b);\r
11         function __() { this.constructor = d; }\r
12         d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r
13     };\r
14 })();\r
15 Object.defineProperty(exports, "__esModule", { value: true });\r
16 var readdir = require("@mrmlnc/readdir-enhanced");\r
17 var reader_1 = require("./reader");\r
18 var fs_sync_1 = require("../adapters/fs-sync");\r
19 var ReaderSync = /** @class */ (function (_super) {\r
20     __extends(ReaderSync, _super);\r
21     function ReaderSync() {\r
22         return _super !== null && _super.apply(this, arguments) || this;\r
23     }\r
24     Object.defineProperty(ReaderSync.prototype, "fsAdapter", {\r
25         /**\r
26          * Returns FileSystem adapter.\r
27          */\r
28         get: function () {\r
29             return new fs_sync_1.default(this.options);\r
30         },\r
31         enumerable: true,\r
32         configurable: true\r
33     });\r
34     /**\r
35      * Use sync API to read entries for Task.\r
36      */\r
37     ReaderSync.prototype.read = function (task) {\r
38         var root = this.getRootDirectory(task);\r
39         var options = this.getReaderOptions(task);\r
40         try {\r
41             var entries = this.api(root, task, options);\r
42             return entries.map(this.transform, this);\r
43         }\r
44         catch (err) {\r
45             if (this.isEnoentCodeError(err)) {\r
46                 return [];\r
47             }\r
48             throw err;\r
49         }\r
50     };\r
51     /**\r
52      * Returns founded paths.\r
53      */\r
54     ReaderSync.prototype.api = function (root, task, options) {\r
55         if (task.dynamic) {\r
56             return this.dynamicApi(root, options);\r
57         }\r
58         return this.staticApi(task, options);\r
59     };\r
60     /**\r
61      * Api for dynamic tasks.\r
62      */\r
63     ReaderSync.prototype.dynamicApi = function (root, options) {\r
64         return readdir.readdirSyncStat(root, options);\r
65     };\r
66     /**\r
67      * Api for static tasks.\r
68      */\r
69     ReaderSync.prototype.staticApi = function (task, options) {\r
70         return this.fsAdapter.read(task.patterns, options.filter);\r
71     };\r
72     return ReaderSync;\r
73 }(reader_1.default));\r
74 exports.default = ReaderSync;\r