aboutsummaryrefslogtreecommitdiff
path: root/node_modules/fast-glob/out/adapters
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:38:48 +0800
committerruki <waruqi@gmail.com>2018-11-07 21:53:09 +0800
commit26105034da4fcce7ac883c899d781f016559310d (patch)
treec459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/fast-glob/out/adapters
parent2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff)
downloadxmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz
xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip
switch to vuepress
Diffstat (limited to 'node_modules/fast-glob/out/adapters')
-rw-r--r--node_modules/fast-glob/out/adapters/fs-stream.d.ts20
-rw-r--r--node_modules/fast-glob/out/adapters/fs-stream.js61
-rw-r--r--node_modules/fast-glob/out/adapters/fs-sync.d.ts20
-rw-r--r--node_modules/fast-glob/out/adapters/fs-sync.js56
-rw-r--r--node_modules/fast-glob/out/adapters/fs.d.ts22
-rw-r--r--node_modules/fast-glob/out/adapters/fs.js25
6 files changed, 204 insertions, 0 deletions
diff --git a/node_modules/fast-glob/out/adapters/fs-stream.d.ts b/node_modules/fast-glob/out/adapters/fs-stream.d.ts
new file mode 100644
index 00000000..bca4e9f4
--- /dev/null
+++ b/node_modules/fast-glob/out/adapters/fs-stream.d.ts
@@ -0,0 +1,20 @@
+/// <reference types="node" />
+import * as fs from 'fs';
+import FileSystem from './fs';
+import { FilterFunction } from '@mrmlnc/readdir-enhanced';
+import { Entry } from '../types/entries';
+import { Pattern } from '../types/patterns';
+export default class FileSystemStream extends FileSystem<NodeJS.ReadableStream> {
+ /**
+ * Use stream API to read entries for Task.
+ */
+ read(patterns: string[], filter: FilterFunction): NodeJS.ReadableStream;
+ /**
+ * Return entry for the provided path.
+ */
+ getEntry(filepath: string, pattern: Pattern): Promise<Entry | null>;
+ /**
+ * Return fs.Stats for the provided path.
+ */
+ getStat(filepath: string): Promise<fs.Stats>;
+}
diff --git a/node_modules/fast-glob/out/adapters/fs-stream.js b/node_modules/fast-glob/out/adapters/fs-stream.js
new file mode 100644
index 00000000..0326d840
--- /dev/null
+++ b/node_modules/fast-glob/out/adapters/fs-stream.js
@@ -0,0 +1,61 @@
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var stream = require("stream");
+var fsStat = require("@nodelib/fs.stat");
+var fs_1 = require("./fs");
+var FileSystemStream = /** @class */ (function (_super) {
+ __extends(FileSystemStream, _super);
+ function FileSystemStream() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /**
+ * Use stream API to read entries for Task.
+ */
+ FileSystemStream.prototype.read = function (patterns, filter) {
+ var _this = this;
+ var filepaths = patterns.map(this.getFullEntryPath, this);
+ var transform = new stream.Transform({ objectMode: true });
+ transform._transform = function (index, _enc, done) {
+ return _this.getEntry(filepaths[index], patterns[index]).then(function (entry) {
+ if (entry !== null && filter(entry)) {
+ transform.push(entry);
+ }
+ if (index === filepaths.length - 1) {
+ transform.end();
+ }
+ done();
+ });
+ };
+ for (var i = 0; i < filepaths.length; i++) {
+ transform.write(i);
+ }
+ return transform;
+ };
+ /**
+ * Return entry for the provided path.
+ */
+ FileSystemStream.prototype.getEntry = function (filepath, pattern) {
+ var _this = this;
+ return this.getStat(filepath)
+ .then(function (stat) { return _this.makeEntry(stat, pattern); })
+ .catch(function () { return null; });
+ };
+ /**
+ * Return fs.Stats for the provided path.
+ */
+ FileSystemStream.prototype.getStat = function (filepath) {
+ return fsStat.stat(filepath, { throwErrorOnBrokenSymlinks: false });
+ };
+ return FileSystemStream;
+}(fs_1.default));
+exports.default = FileSystemStream;
diff --git a/node_modules/fast-glob/out/adapters/fs-sync.d.ts b/node_modules/fast-glob/out/adapters/fs-sync.d.ts
new file mode 100644
index 00000000..6fcc736b
--- /dev/null
+++ b/node_modules/fast-glob/out/adapters/fs-sync.d.ts
@@ -0,0 +1,20 @@
+/// <reference types="node" />
+import * as fs from 'fs';
+import FileSystem from './fs';
+import { FilterFunction } from '@mrmlnc/readdir-enhanced';
+import { Entry } from '../types/entries';
+import { Pattern } from '../types/patterns';
+export default class FileSystemSync extends FileSystem<Entry[]> {
+ /**
+ * Use sync API to read entries for Task.
+ */
+ read(patterns: string[], filter: FilterFunction): Entry[];
+ /**
+ * Return entry for the provided path.
+ */
+ getEntry(filepath: string, pattern: Pattern): Entry | null;
+ /**
+ * Return fs.Stats for the provided path.
+ */
+ getStat(filepath: string): fs.Stats;
+}
diff --git a/node_modules/fast-glob/out/adapters/fs-sync.js b/node_modules/fast-glob/out/adapters/fs-sync.js
new file mode 100644
index 00000000..6f5948c4
--- /dev/null
+++ b/node_modules/fast-glob/out/adapters/fs-sync.js
@@ -0,0 +1,56 @@
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var fsStat = require("@nodelib/fs.stat");
+var fs_1 = require("./fs");
+var FileSystemSync = /** @class */ (function (_super) {
+ __extends(FileSystemSync, _super);
+ function FileSystemSync() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /**
+ * Use sync API to read entries for Task.
+ */
+ FileSystemSync.prototype.read = function (patterns, filter) {
+ var _this = this;
+ var entries = [];
+ patterns.forEach(function (pattern) {
+ var filepath = _this.getFullEntryPath(pattern);
+ var entry = _this.getEntry(filepath, pattern);
+ if (entry === null || !filter(entry)) {
+ return;
+ }
+ entries.push(entry);
+ });
+ return entries;
+ };
+ /**
+ * Return entry for the provided path.
+ */
+ FileSystemSync.prototype.getEntry = function (filepath, pattern) {
+ try {
+ var stat = this.getStat(filepath);
+ return this.makeEntry(stat, pattern);
+ }
+ catch (err) {
+ return null;
+ }
+ };
+ /**
+ * Return fs.Stats for the provided path.
+ */
+ FileSystemSync.prototype.getStat = function (filepath) {
+ return fsStat.statSync(filepath, { throwErrorOnBrokenSymlinks: false });
+ };
+ return FileSystemSync;
+}(fs_1.default));
+exports.default = FileSystemSync;
diff --git a/node_modules/fast-glob/out/adapters/fs.d.ts b/node_modules/fast-glob/out/adapters/fs.d.ts
new file mode 100644
index 00000000..abf44321
--- /dev/null
+++ b/node_modules/fast-glob/out/adapters/fs.d.ts
@@ -0,0 +1,22 @@
+/// <reference types="node" />
+import * as fs from 'fs';
+import { FilterFunction } from '@mrmlnc/readdir-enhanced';
+import { IOptions } from '../managers/options';
+import { Entry } from '../types/entries';
+import { Pattern } from '../types/patterns';
+export default abstract class FileSystem<T> {
+ private readonly options;
+ constructor(options: IOptions);
+ /**
+ * The main logic of reading the entries that must be implemented by each adapter.
+ */
+ abstract read(filepaths: string[], filter: FilterFunction): T;
+ /**
+ * Return full path to entry.
+ */
+ getFullEntryPath(filepath: string): string;
+ /**
+ * Return an implementation of the Entry interface.
+ */
+ makeEntry(stat: fs.Stats, pattern: Pattern): Entry;
+}
diff --git a/node_modules/fast-glob/out/adapters/fs.js b/node_modules/fast-glob/out/adapters/fs.js
new file mode 100644
index 00000000..9a3da963
--- /dev/null
+++ b/node_modules/fast-glob/out/adapters/fs.js
@@ -0,0 +1,25 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var path = require("path");
+var FileSystem = /** @class */ (function () {
+ function FileSystem(options) {
+ this.options = options;
+ }
+ /**
+ * Return full path to entry.
+ */
+ FileSystem.prototype.getFullEntryPath = function (filepath) {
+ return path.resolve(this.options.cwd, filepath);
+ };
+ /**
+ * Return an implementation of the Entry interface.
+ */
+ FileSystem.prototype.makeEntry = function (stat, pattern) {
+ return Object.assign(stat, {
+ path: pattern,
+ depth: pattern.split('/').length
+ });
+ };
+ return FileSystem;
+}());
+exports.default = FileSystem;