.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / fast-glob / package / out / adapters / fs-stream.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 stream = require("stream");\r
17 var fsStat = require("@nodelib/fs.stat");\r
18 var fs_1 = require("./fs");\r
19 var FileSystemStream = /** @class */ (function (_super) {\r
20     __extends(FileSystemStream, _super);\r
21     function FileSystemStream() {\r
22         return _super !== null && _super.apply(this, arguments) || this;\r
23     }\r
24     /**\r
25      * Use stream API to read entries for Task.\r
26      */\r
27     FileSystemStream.prototype.read = function (patterns, filter) {\r
28         var _this = this;\r
29         var filepaths = patterns.map(this.getFullEntryPath, this);\r
30         var transform = new stream.Transform({ objectMode: true });\r
31         transform._transform = function (index, _enc, done) {\r
32             return _this.getEntry(filepaths[index], patterns[index]).then(function (entry) {\r
33                 if (entry !== null && filter(entry)) {\r
34                     transform.push(entry);\r
35                 }\r
36                 if (index === filepaths.length - 1) {\r
37                     transform.end();\r
38                 }\r
39                 done();\r
40             });\r
41         };\r
42         for (var i = 0; i < filepaths.length; i++) {\r
43             transform.write(i);\r
44         }\r
45         return transform;\r
46     };\r
47     /**\r
48      * Return entry for the provided path.\r
49      */\r
50     FileSystemStream.prototype.getEntry = function (filepath, pattern) {\r
51         var _this = this;\r
52         return this.getStat(filepath)\r
53             .then(function (stat) { return _this.makeEntry(stat, pattern); })\r
54             .catch(function () { return null; });\r
55     };\r
56     /**\r
57      * Return fs.Stats for the provided path.\r
58      */\r
59     FileSystemStream.prototype.getStat = function (filepath) {\r
60         return fsStat.stat(filepath, { throwErrorOnBrokenSymlinks: false });\r
61     };\r
62     return FileSystemStream;\r
63 }(fs_1.default));\r
64 exports.default = FileSystemStream;\r