diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2019-10-06 21:37:45 +0200 |
---|---|---|
committer | Dimitri Staessens <dimitri@ouroboros.rocks> | 2019-10-06 21:37:45 +0200 |
commit | 3c51c3be85bb0d1bdb87ea0d6632f1c256912f27 (patch) | |
tree | c7ccc8279b12c4f7bdbbb4270d617e48f51722e4 /node_modules/fast-glob/out/adapters | |
parent | 412c104bebc507bea9c94fd53b5bdc4b64cbfe31 (diff) | |
download | website-3c51c3be85bb0d1bdb87ea0d6632f1c256912f27.tar.gz website-3c51c3be85bb0d1bdb87ea0d6632f1c256912f27.zip |
build: Add some required modules for node
Diffstat (limited to 'node_modules/fast-glob/out/adapters')
-rw-r--r-- | node_modules/fast-glob/out/adapters/fs-stream.d.ts | 20 | ||||
-rw-r--r-- | node_modules/fast-glob/out/adapters/fs-stream.js | 64 | ||||
-rw-r--r-- | node_modules/fast-glob/out/adapters/fs-sync.d.ts | 20 | ||||
-rw-r--r-- | node_modules/fast-glob/out/adapters/fs-sync.js | 59 | ||||
-rw-r--r-- | node_modules/fast-glob/out/adapters/fs.d.ts | 22 | ||||
-rw-r--r-- | node_modules/fast-glob/out/adapters/fs.js | 25 |
6 files changed, 210 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 0000000..bca4e9f --- /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 0000000..fcb236d --- /dev/null +++ b/node_modules/fast-glob/out/adapters/fs-stream.js @@ -0,0 +1,64 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + 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 extendStatics(d, b); + }; + 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 0000000..6fcc736 --- /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 0000000..41bcdef --- /dev/null +++ b/node_modules/fast-glob/out/adapters/fs-sync.js @@ -0,0 +1,59 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + 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 extendStatics(d, b); + }; + 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 0000000..abf4432 --- /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 0000000..9a3da96 --- /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; |