From 3c51c3be85bb0d1bdb87ea0d6632f1c256912f27 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sun, 6 Oct 2019 21:37:45 +0200 Subject: build: Add some required modules for node --- node_modules/fast-glob/LICENSE | 21 ++ node_modules/fast-glob/README.md | 389 +++++++++++++++++++++ node_modules/fast-glob/index.d.ts | 24 ++ node_modules/fast-glob/index.js | 10 + node_modules/fast-glob/out/adapters/fs-stream.d.ts | 20 ++ node_modules/fast-glob/out/adapters/fs-stream.js | 64 ++++ node_modules/fast-glob/out/adapters/fs-sync.d.ts | 20 ++ node_modules/fast-glob/out/adapters/fs-sync.js | 59 ++++ node_modules/fast-glob/out/adapters/fs.d.ts | 22 ++ node_modules/fast-glob/out/adapters/fs.js | 25 ++ node_modules/fast-glob/out/index.d.ts | 21 ++ node_modules/fast-glob/out/index.js | 71 ++++ node_modules/fast-glob/out/managers/options.d.ts | 94 +++++ node_modules/fast-glob/out/managers/options.js | 42 +++ node_modules/fast-glob/out/managers/tasks.d.ts | 37 ++ node_modules/fast-glob/out/managers/tasks.js | 86 +++++ .../fast-glob/out/providers/filters/deep.d.ts | 45 +++ .../fast-glob/out/providers/filters/deep.js | 83 +++++ .../fast-glob/out/providers/filters/entry.d.ts | 45 +++ .../fast-glob/out/providers/filters/entry.js | 85 +++++ .../fast-glob/out/providers/reader-async.d.ts | 28 ++ .../fast-glob/out/providers/reader-async.js | 75 ++++ .../fast-glob/out/providers/reader-stream.d.ts | 27 ++ .../fast-glob/out/providers/reader-stream.js | 83 +++++ .../fast-glob/out/providers/reader-sync.d.ts | 27 ++ .../fast-glob/out/providers/reader-sync.js | 74 ++++ node_modules/fast-glob/out/providers/reader.d.ts | 39 +++ node_modules/fast-glob/out/providers/reader.js | 68 ++++ node_modules/fast-glob/out/types/entries.d.ts | 8 + node_modules/fast-glob/out/types/entries.js | 2 + node_modules/fast-glob/out/types/patterns.d.ts | 3 + node_modules/fast-glob/out/types/patterns.js | 2 + node_modules/fast-glob/out/utils/array.d.ts | 4 + node_modules/fast-glob/out/utils/array.js | 9 + node_modules/fast-glob/out/utils/path.d.ts | 12 + node_modules/fast-glob/out/utils/path.js | 28 ++ node_modules/fast-glob/out/utils/pattern.d.ts | 74 ++++ node_modules/fast-glob/out/utils/pattern.js | 148 ++++++++ node_modules/fast-glob/out/utils/stream.d.ts | 5 + node_modules/fast-glob/out/utils/stream.js | 14 + node_modules/fast-glob/package.json | 120 +++++++ 41 files changed, 2113 insertions(+) create mode 100644 node_modules/fast-glob/LICENSE create mode 100644 node_modules/fast-glob/README.md create mode 100644 node_modules/fast-glob/index.d.ts create mode 100644 node_modules/fast-glob/index.js create mode 100644 node_modules/fast-glob/out/adapters/fs-stream.d.ts create mode 100644 node_modules/fast-glob/out/adapters/fs-stream.js create mode 100644 node_modules/fast-glob/out/adapters/fs-sync.d.ts create mode 100644 node_modules/fast-glob/out/adapters/fs-sync.js create mode 100644 node_modules/fast-glob/out/adapters/fs.d.ts create mode 100644 node_modules/fast-glob/out/adapters/fs.js create mode 100644 node_modules/fast-glob/out/index.d.ts create mode 100644 node_modules/fast-glob/out/index.js create mode 100644 node_modules/fast-glob/out/managers/options.d.ts create mode 100644 node_modules/fast-glob/out/managers/options.js create mode 100644 node_modules/fast-glob/out/managers/tasks.d.ts create mode 100644 node_modules/fast-glob/out/managers/tasks.js create mode 100644 node_modules/fast-glob/out/providers/filters/deep.d.ts create mode 100644 node_modules/fast-glob/out/providers/filters/deep.js create mode 100644 node_modules/fast-glob/out/providers/filters/entry.d.ts create mode 100644 node_modules/fast-glob/out/providers/filters/entry.js create mode 100644 node_modules/fast-glob/out/providers/reader-async.d.ts create mode 100644 node_modules/fast-glob/out/providers/reader-async.js create mode 100644 node_modules/fast-glob/out/providers/reader-stream.d.ts create mode 100644 node_modules/fast-glob/out/providers/reader-stream.js create mode 100644 node_modules/fast-glob/out/providers/reader-sync.d.ts create mode 100644 node_modules/fast-glob/out/providers/reader-sync.js create mode 100644 node_modules/fast-glob/out/providers/reader.d.ts create mode 100644 node_modules/fast-glob/out/providers/reader.js create mode 100644 node_modules/fast-glob/out/types/entries.d.ts create mode 100644 node_modules/fast-glob/out/types/entries.js create mode 100644 node_modules/fast-glob/out/types/patterns.d.ts create mode 100644 node_modules/fast-glob/out/types/patterns.js create mode 100644 node_modules/fast-glob/out/utils/array.d.ts create mode 100644 node_modules/fast-glob/out/utils/array.js create mode 100644 node_modules/fast-glob/out/utils/path.d.ts create mode 100644 node_modules/fast-glob/out/utils/path.js create mode 100644 node_modules/fast-glob/out/utils/pattern.d.ts create mode 100644 node_modules/fast-glob/out/utils/pattern.js create mode 100644 node_modules/fast-glob/out/utils/stream.d.ts create mode 100644 node_modules/fast-glob/out/utils/stream.js create mode 100644 node_modules/fast-glob/package.json (limited to 'node_modules/fast-glob') diff --git a/node_modules/fast-glob/LICENSE b/node_modules/fast-glob/LICENSE new file mode 100644 index 0000000..65a9994 --- /dev/null +++ b/node_modules/fast-glob/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Denis Malinochkin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/fast-glob/README.md b/node_modules/fast-glob/README.md new file mode 100644 index 0000000..480c808 --- /dev/null +++ b/node_modules/fast-glob/README.md @@ -0,0 +1,389 @@ +# :rocket: fast-glob + +> Is a faster [`node-glob`](https://github.com/isaacs/node-glob) alternative. + +## :bulb: Highlights + + * :rocket: Fast by using Streams and Promises. Used [readdir-enhanced](https://github.com/BigstickCarpet/readdir-enhanced) and [micromatch](https://github.com/jonschlinkert/micromatch). + * :beginner: User-friendly, since it supports multiple and negated patterns (`['*', '!*.md']`). + * :vertical_traffic_light: Rational, because it doesn't read excluded directories (`!**/node_modules/**`). + * :gear: Universal, because it supports Synchronous, Promise and Stream API. + * :money_with_wings: Economy, because it provides `fs.Stats` for matched path if you wanted. + +## Donate + +If you want to thank me, or promote your Issue. + +[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/mrmlnc) + +> Sorry, but I have work and support for packages requires some time after work. I will be glad of your support and PR's. + +## Install + +``` +$ npm install --save fast-glob +``` + +## Usage + +#### Asynchronous + +```js +const fg = require('fast-glob'); + +fg(['src/**/*.js', '!src/**/*.spec.js']).then((entries) => console.log(entries)); +fg.async(['src/**/*.js', '!src/**/*.spec.js']).then((entries) => console.log(entries)); +``` + +#### Synchronous + +```js +const fg = require('fast-glob'); + +const entries = fg.sync(['src/**/*.js', '!src/**/*.spec.js']); +console.log(entries); +``` + +#### Stream + +```js +const fg = require('fast-glob'); + +const stream = fg.stream(['src/**/*.js', '!src/**/*.spec.js']); + +const entries = []; + +stream.on('data', (entry) => entries.push(entry)); +stream.once('error', console.log); +stream.once('end', () => console.log(entries)); +``` + +## API + +### fg(patterns, [options]) +### fg.async(patterns, [options]) + +Returns a `Promise` of matching entries. + +#### patterns + + * Type: `string|string[]` + +This package does not respect the order of patterns. First, all the negative patterns are applied, and only then the positive patterns. + +#### options + + * Type: `Object` + +See [options](#options-1) section for more detailed information. + +### fg.sync(patterns, [options]) + +Returns a `Array` of matching entries. + +### fg.stream(patterns, [options]) + +Returns a [`ReadableStream`](https://nodejs.org/api/stream.html#stream_readable_streams). + +### fg.generateTasks(patterns, [options]) + +Return a set of tasks based on provided patterns. All tasks satisfy the `Task` interface: + +```ts +interface Task { + /** + * Parent directory for all patterns inside this task. + */ + base: string; + /** + * Dynamic or static patterns are in this task. + */ + dynamic: boolean; + /** + * All patterns. + */ + patterns: string[]; + /** + * Only positive patterns. + */ + positive: string[]; + /** + * Only negative patterns without ! symbol. + */ + negative: string[]; +} +``` + +## Options + +#### cwd + + * Type: `string` + * Default: `process.cwd()` + +The current working directory in which to search. + +#### deep + + * Type: `number|boolean` + * Default: `true` + +The deep option can be set to `true` to traverse the entire directory structure, or it can be set to a *number* to only traverse that many levels deep. + +For example, you have the following tree: + +``` +test +└── one + └── two + └── index.js +``` + +> :book: If you specify a pattern with some base directory, this directory will not participate in the calculation of the depth of the found directories. Think of it as a `cwd` option. + +```js +fg('test/**', { onlyFiles: false, deep: 0 }); +// -> ['test/one'] +fg('test/**', { onlyFiles: false, deep: 1 }); +// -> ['test/one', 'test/one/two'] + +fg('**', { onlyFiles: false, cwd: 'test', deep: 0 }); +// -> ['one'] +fg('**', { onlyFiles: false, cwd: 'test', deep: 1 }); +// -> ['one', 'one/two'] +``` + +#### ignore + + * Type: `string[]` + * Default: `[]` + +An array of glob patterns to exclude matches. + +#### dot + + * Type: `boolean` + * Default: `false` + +Allow patterns to match filenames starting with a period (files & directories), even if the pattern does not explicitly have a period in that spot. + +#### stats + + * Type: `number|boolean` + * Default: `false` + +Return `fs.Stats` with `path` property instead of file path. + +#### onlyFiles + + * Type: `boolean` + * Default: `true` + +Return only files. + +#### onlyDirectories + + * Type: `boolean` + * Default: `false` + +Return only directories. + +#### followSymlinkedDirectories + + * Type: `boolean` + * Default: `true` + +Follow symlinked directories when expanding `**` patterns. + +#### unique + + * Type: `boolean` + * Default: `true` + +Prevent duplicate results. + +#### markDirectories + + * Type: `boolean` + * Default: `false` + +Add a `/` character to directory entries. + +#### absolute + + * Type: `boolean` + * Default: `false` + +Return absolute paths for matched entries. + +> :book: Note that you need to use this option if you want to use absolute negative patterns like `${__dirname}/*.md`. + +#### nobrace + + * Type: `boolean` + * Default: `false` + +Disable expansion of brace patterns (`{a,b}`, `{1..3}`). + +#### brace + + * Type: `boolean` + * Default: `true` + +The [`nobrace`](#nobrace) option without double-negation. This option has a higher priority then `nobrace`. + +#### noglobstar + + * Type: `boolean` + * Default: `false` + +Disable matching with globstars (`**`). + +#### globstar + + * Type: `boolean` + * Default: `true` + +The [`noglobstar`](#noglobstar) option without double-negation. This option has a higher priority then `noglobstar`. + +#### noext + + * Type: `boolean` + * Default: `false` + +Disable extglob support (patterns like `+(a|b)`), so that extglobs are regarded as literal characters. + +#### extension + + * Type: `boolean` + * Default: `true` + +The [`noext`](#noext) option without double-negation. This option has a higher priority then `noext`. + +#### nocase + + * Type: `boolean` + * Default: `false` + +Disable a case-insensitive regex for matching files. + +#### case + + * Type: `boolean` + * Default: `true` + +The [`nocase`](#nocase) option without double-negation. This option has a higher priority then `nocase`. + +#### matchBase + + * Type: `boolean` + * Default: `false` + +Allow glob patterns without slashes to match a file path based on its basename. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. + +#### transform + + * Type: `Function` + * Default: `null` + +Allows you to transform a path or `fs.Stats` object before sending to the array. + +```js +const fg = require('fast-glob'); + +const entries1 = fg.sync(['**/*.scss']); +const entries2 = fg.sync(['**/*.scss'], { transform: (entry) => '_' + entry }); + +console.log(entries1); // ['a.scss', 'b.scss'] +console.log(entries2); // ['_a.scss', '_b.scss'] +``` + +If you are using **TypeScript**, you probably want to specify your own type of the returned array. + +```ts +import * as fg from 'fast-glob'; + +interface IMyOwnEntry { + path: string; +} + +const entries: IMyOwnEntry[] = fg.sync(['*.md'], { + transform: (entry) => typeof entry === 'string' ? { path: entry } : { path: entry.path } + // Will throw compilation error for non-IMyOwnEntry types (boolean, for example) +}); +``` + +## How to exclude directory from reading? + +You can use a negative pattern like this: `!**/node_modules` or `!**/node_modules/**`. Also you can use `ignore` option. Just look at the example below. + +``` +first/ +├── file.md +└── second + └── file.txt +``` + +If you don't want to read the `second` directory, you must write the following pattern: `!**/second` or `!**/second/**`. + +```js +fg.sync(['**/*.md', '!**/second']); // ['first/file.txt'] +fg.sync(['**/*.md'], { ignore: '**/second/**' }); // ['first/file.txt'] +``` + +> :warning: When you write `!**/second/**/*` it means that the directory will be **read**, but all the entries will not be included in the results. + +You have to understand that if you write the pattern to exclude directories, then the directory will not be read under any circumstances. + +## Compatible with `node-glob`? + +Not fully, because `fast-glob` does not implement all options of `node-glob`. See table below. + +| node-glob | fast-glob | +| :----------: | :-------: | +| `cwd` | [`cwd`](#cwd) | +| `root` | – | +| `dot` | [`dot`](#dot) | +| `nomount` | – | +| `mark` | [`markDirectories`](#markdirectories) | +| `nosort` | – | +| `nounique` | [`unique`](#unique) | +| `nobrace` | [`nobrace`](#nobrace) or [`brace`](#brace) | +| `noglobstar` | [`noglobstar`](#noglobstar) or [`globstar`](#globstar) | +| `noext` | [`noext`](#noext) or [`extension`](#extension) | +| `nocase` | [`nocase`](#nocase) or [`case`](#case) | +| `matchBase` | [`matchbase`](#matchbase) | +| `nodir` | [`onlyFiles`](#onlyfiles) | +| `ignore` | [`ignore`](#ignore) | +| `follow` | [`followSymlinkedDirectories`](#followsymlinkeddirectories) | +| `realpath` | – | +| `absolute` | [`absolute`](#absolute) | + +## Benchmarks + +**Tech specs:** + +Server: [Vultr Bare Metal](https://www.vultr.com/pricing/baremetal) + + * Processor: E3-1270v6 (8 CPU) + * RAM: 32GB + * Disk: SSD + +You can see results [here](https://gist.github.com/mrmlnc/f06246b197f53c356895fa35355a367c) for latest release. + +## Related + + * [readdir-enhanced](https://github.com/BigstickCarpet/readdir-enhanced) – Fast functional replacement for `fs.readdir()`. + * [globby](https://github.com/sindresorhus/globby) – User-friendly glob matching. + * [node-glob](https://github.com/isaacs/node-glob) – «Standard» glob functionality for Node.js + * [bash-glob](https://github.com/micromatch/bash-glob) – Bash-powered globbing for node.js. + * [glob-stream](https://github.com/gulpjs/glob-stream) – A Readable Stream interface over node-glob that used in the [gulpjs](https://github.com/gulpjs/gulp). + * [tiny-glob](https://github.com/terkelg/tiny-glob) – Tiny and extremely fast library to match files and folders using glob patterns. + +## Changelog + +See the [Releases section of our GitHub project](https://github.com/mrmlnc/fast-glob/releases) for changelogs for each release version. + +## License + +This software is released under the terms of the MIT license. diff --git a/node_modules/fast-glob/index.d.ts b/node_modules/fast-glob/index.d.ts new file mode 100644 index 0000000..e08a6c3 --- /dev/null +++ b/node_modules/fast-glob/index.d.ts @@ -0,0 +1,24 @@ +import { TransformFunction as Transform, IPartialOptions } from './out/managers/options'; +import { ITask } from './out/managers/tasks'; +import { Entry, EntryItem } from './out/types/entries'; +import { Pattern } from './out/types/patterns'; + +declare namespace FastGlob { + type Options = IPartialOptions; + type TransformFunction = Transform; + type Task = ITask; + + interface IApi { + (patterns: Pattern | Pattern[], options?: IPartialOptions): Promise; + + async(patterns: Pattern | Pattern[], options?: IPartialOptions): Promise; + sync(patterns: Pattern | Pattern[], options?: IPartialOptions): T[]; + stream(patterns: Pattern | Pattern[], options?: IPartialOptions): NodeJS.ReadableStream; + generateTasks(patterns: Pattern | Pattern[], options?: IPartialOptions): Task[]; + } +} + +declare const FastGlob: FastGlob.IApi; + +export = FastGlob; +export as namespace FastGlob; diff --git a/node_modules/fast-glob/index.js b/node_modules/fast-glob/index.js new file mode 100644 index 0000000..7c1ecff --- /dev/null +++ b/node_modules/fast-glob/index.js @@ -0,0 +1,10 @@ +const pkg = require('./out/index'); + +module.exports = pkg.async; +module.exports.default = pkg.async; + +module.exports.async = pkg.async; +module.exports.sync = pkg.sync; +module.exports.stream = pkg.stream; + +module.exports.generateTasks = pkg.generateTasks; 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 @@ +/// +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 { + /** + * 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; + /** + * Return fs.Stats for the provided path. + */ + getStat(filepath: string): Promise; +} 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 @@ +/// +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 { + /** + * 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 @@ +/// +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 { + 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; diff --git a/node_modules/fast-glob/out/index.d.ts b/node_modules/fast-glob/out/index.d.ts new file mode 100644 index 0000000..5072dc8 --- /dev/null +++ b/node_modules/fast-glob/out/index.d.ts @@ -0,0 +1,21 @@ +/// +import { IPartialOptions } from './managers/options'; +import { ITask } from './managers/tasks'; +import { EntryItem } from './types/entries'; +import { Pattern } from './types/patterns'; +/** + * Synchronous API. + */ +export declare function sync(source: Pattern | Pattern[], opts?: IPartialOptions): EntryItem[]; +/** + * Asynchronous API. + */ +export declare function async(source: Pattern | Pattern[], opts?: IPartialOptions): Promise; +/** + * Stream API. + */ +export declare function stream(source: Pattern | Pattern[], opts?: IPartialOptions): NodeJS.ReadableStream; +/** + * Return a set of tasks based on provided patterns. + */ +export declare function generateTasks(source: Pattern | Pattern[], opts?: IPartialOptions): ITask[]; diff --git a/node_modules/fast-glob/out/index.js b/node_modules/fast-glob/out/index.js new file mode 100644 index 0000000..ce70421 --- /dev/null +++ b/node_modules/fast-glob/out/index.js @@ -0,0 +1,71 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var optionsManager = require("./managers/options"); +var taskManager = require("./managers/tasks"); +var reader_async_1 = require("./providers/reader-async"); +var reader_stream_1 = require("./providers/reader-stream"); +var reader_sync_1 = require("./providers/reader-sync"); +var arrayUtils = require("./utils/array"); +var streamUtils = require("./utils/stream"); +/** + * Synchronous API. + */ +function sync(source, opts) { + assertPatternsInput(source); + var works = getWorks(source, reader_sync_1.default, opts); + return arrayUtils.flatten(works); +} +exports.sync = sync; +/** + * Asynchronous API. + */ +function async(source, opts) { + try { + assertPatternsInput(source); + } + catch (error) { + return Promise.reject(error); + } + var works = getWorks(source, reader_async_1.default, opts); + return Promise.all(works).then(arrayUtils.flatten); +} +exports.async = async; +/** + * Stream API. + */ +function stream(source, opts) { + assertPatternsInput(source); + var works = getWorks(source, reader_stream_1.default, opts); + return streamUtils.merge(works); +} +exports.stream = stream; +/** + * Return a set of tasks based on provided patterns. + */ +function generateTasks(source, opts) { + assertPatternsInput(source); + var patterns = [].concat(source); + var options = optionsManager.prepare(opts); + return taskManager.generate(patterns, options); +} +exports.generateTasks = generateTasks; +/** + * Returns a set of works based on provided tasks and class of the reader. + */ +function getWorks(source, _Reader, opts) { + var patterns = [].concat(source); + var options = optionsManager.prepare(opts); + var tasks = taskManager.generate(patterns, options); + var reader = new _Reader(options); + return tasks.map(reader.read, reader); +} +function assertPatternsInput(source) { + if ([].concat(source).every(isString)) { + return; + } + throw new TypeError('Patterns must be a string or an array of strings'); +} +function isString(source) { + /* tslint:disable-next-line strict-type-predicates */ + return typeof source === 'string'; +} diff --git a/node_modules/fast-glob/out/managers/options.d.ts b/node_modules/fast-glob/out/managers/options.d.ts new file mode 100644 index 0000000..b9c6d5c --- /dev/null +++ b/node_modules/fast-glob/out/managers/options.d.ts @@ -0,0 +1,94 @@ +import { EntryItem } from '../types/entries'; +import { Pattern } from '../types/patterns'; +export declare type TransformFunction = (entry: EntryItem) => T; +export interface IOptions { + /** + * The current working directory in which to search. + */ + cwd: string; + /** + * The deep option can be set to true to traverse the entire directory structure, + * or it can be set to a number to only traverse that many levels deep. + */ + deep: number | boolean; + /** + * Add an array of glob patterns to exclude matches. + */ + ignore: Pattern[]; + /** + * Allow patterns to match filenames starting with a period (files & directories), + * even if the pattern does not explicitly have a period in that spot. + */ + dot: boolean; + /** + * Return `fs.Stats` with `path` property instead of file path. + */ + stats: boolean; + /** + * Return only files. + */ + onlyFiles: boolean; + /** + * Return only directories. + */ + onlyDirectories: boolean; + /** + * Follow symlinked directories when expanding `**` patterns. + */ + followSymlinkedDirectories: boolean; + /** + * Prevent duplicate results. + */ + unique: boolean; + /** + * Add a `/` character to directory entries. + */ + markDirectories: boolean; + /** + * Return absolute paths for matched entries. + */ + absolute: boolean; + /** + * Disable expansion of brace patterns. + */ + nobrace: boolean; + /** + * Enable expansion of brace patterns. + */ + brace: boolean; + /** + * Disable matching with globstars (`**`). + */ + noglobstar: boolean; + /** + * Enable matching with globstars (`**`). + */ + globstar: boolean; + /** + * Disable extglob support, so that extglobs are regarded as literal characters. + */ + noext: boolean; + /** + * Enable extglob support, so that extglobs are regarded as literal characters. + */ + extension: boolean; + /** + * Disable a case-insensitive regex for matching files. + */ + nocase: boolean; + /** + * Enable a case-insensitive regex for matching files. + */ + case: boolean; + /** + * Allow glob patterns without slashes to match a file path based on its basename. + * For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. + */ + matchBase: boolean; + /** + * Allows you to transform a path or `fs.Stats` object before sending to the array. + */ + transform: TransformFunction | null; +} +export declare type IPartialOptions = Partial>; +export declare function prepare(options?: IPartialOptions): IOptions; diff --git a/node_modules/fast-glob/out/managers/options.js b/node_modules/fast-glob/out/managers/options.js new file mode 100644 index 0000000..d719562 --- /dev/null +++ b/node_modules/fast-glob/out/managers/options.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +function prepare(options) { + var opts = Object.assign({ + cwd: process.cwd(), + deep: true, + ignore: [], + dot: false, + stats: false, + onlyFiles: true, + onlyDirectories: false, + followSymlinkedDirectories: true, + unique: true, + markDirectories: false, + absolute: false, + nobrace: false, + brace: true, + noglobstar: false, + globstar: true, + noext: false, + extension: true, + nocase: false, + case: true, + matchBase: false, + transform: null + }, options); + if (opts.onlyDirectories) { + opts.onlyFiles = false; + } + opts.brace = !opts.nobrace; + opts.globstar = !opts.noglobstar; + opts.extension = !opts.noext; + opts.case = !opts.nocase; + if (options) { + opts.brace = ('brace' in options ? options.brace : opts.brace); + opts.globstar = ('globstar' in options ? options.globstar : opts.globstar); + opts.extension = ('extension' in options ? options.extension : opts.extension); + opts.case = ('case' in options ? options.case : opts.case); + } + return opts; +} +exports.prepare = prepare; diff --git a/node_modules/fast-glob/out/managers/tasks.d.ts b/node_modules/fast-glob/out/managers/tasks.d.ts new file mode 100644 index 0000000..e2cc1a9 --- /dev/null +++ b/node_modules/fast-glob/out/managers/tasks.d.ts @@ -0,0 +1,37 @@ +import { Pattern, PatternsGroup } from '../types/patterns'; +import { IOptions } from './options'; +export interface ITask { + base: string; + dynamic: boolean; + patterns: Pattern[]; + positive: Pattern[]; + negative: Pattern[]; +} +/** + * Generate tasks based on parent directory of each pattern. + */ +export declare function generate(patterns: Pattern[], options: IOptions): ITask[]; +/** + * Convert patterns to tasks based on parent directory of each pattern. + */ +export declare function convertPatternsToTasks(positive: Pattern[], negative: Pattern[], dynamic: boolean): ITask[]; +/** + * Return only positive patterns. + */ +export declare function getPositivePatterns(patterns: Pattern[]): Pattern[]; +/** + * Return only negative patterns. + */ +export declare function getNegativePatternsAsPositive(patterns: Pattern[], ignore: Pattern[]): Pattern[]; +/** + * Group patterns by base directory of each pattern. + */ +export declare function groupPatternsByBaseDirectory(patterns: Pattern[]): PatternsGroup; +/** + * Convert group of patterns to tasks. + */ +export declare function convertPatternGroupsToTasks(positive: PatternsGroup, negative: Pattern[], dynamic: boolean): ITask[]; +/** + * Create a task for positive and negative patterns. + */ +export declare function convertPatternGroupToTask(base: string, positive: Pattern[], negative: Pattern[], dynamic: boolean): ITask; diff --git a/node_modules/fast-glob/out/managers/tasks.js b/node_modules/fast-glob/out/managers/tasks.js new file mode 100644 index 0000000..1c5192d --- /dev/null +++ b/node_modules/fast-glob/out/managers/tasks.js @@ -0,0 +1,86 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var patternUtils = require("../utils/pattern"); +/** + * Generate tasks based on parent directory of each pattern. + */ +function generate(patterns, options) { + var unixPatterns = patterns.map(patternUtils.unixifyPattern); + var unixIgnore = options.ignore.map(patternUtils.unixifyPattern); + var positivePatterns = getPositivePatterns(unixPatterns); + var negativePatterns = getNegativePatternsAsPositive(unixPatterns, unixIgnore); + var staticPatterns = positivePatterns.filter(patternUtils.isStaticPattern); + var dynamicPatterns = positivePatterns.filter(patternUtils.isDynamicPattern); + var staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false); + var dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true); + return staticTasks.concat(dynamicTasks); +} +exports.generate = generate; +/** + * Convert patterns to tasks based on parent directory of each pattern. + */ +function convertPatternsToTasks(positive, negative, dynamic) { + var positivePatternsGroup = groupPatternsByBaseDirectory(positive); + // When we have a global group – there is no reason to divide the patterns into independent tasks. + // In this case, the global task covers the rest. + if ('.' in positivePatternsGroup) { + var task = convertPatternGroupToTask('.', positive, negative, dynamic); + return [task]; + } + return convertPatternGroupsToTasks(positivePatternsGroup, negative, dynamic); +} +exports.convertPatternsToTasks = convertPatternsToTasks; +/** + * Return only positive patterns. + */ +function getPositivePatterns(patterns) { + return patternUtils.getPositivePatterns(patterns); +} +exports.getPositivePatterns = getPositivePatterns; +/** + * Return only negative patterns. + */ +function getNegativePatternsAsPositive(patterns, ignore) { + var negative = patternUtils.getNegativePatterns(patterns).concat(ignore); + var positive = negative.map(patternUtils.convertToPositivePattern); + return positive; +} +exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive; +/** + * Group patterns by base directory of each pattern. + */ +function groupPatternsByBaseDirectory(patterns) { + return patterns.reduce(function (collection, pattern) { + var base = patternUtils.getBaseDirectory(pattern); + if (base in collection) { + collection[base].push(pattern); + } + else { + collection[base] = [pattern]; + } + return collection; + }, {}); +} +exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory; +/** + * Convert group of patterns to tasks. + */ +function convertPatternGroupsToTasks(positive, negative, dynamic) { + return Object.keys(positive).map(function (base) { + return convertPatternGroupToTask(base, positive[base], negative, dynamic); + }); +} +exports.convertPatternGroupsToTasks = convertPatternGroupsToTasks; +/** + * Create a task for positive and negative patterns. + */ +function convertPatternGroupToTask(base, positive, negative, dynamic) { + return { + base: base, + dynamic: dynamic, + patterns: [].concat(positive, negative.map(patternUtils.convertToNegativePattern)), + positive: positive, + negative: negative + }; +} +exports.convertPatternGroupToTask = convertPatternGroupToTask; diff --git a/node_modules/fast-glob/out/providers/filters/deep.d.ts b/node_modules/fast-glob/out/providers/filters/deep.d.ts new file mode 100644 index 0000000..2cd02b6 --- /dev/null +++ b/node_modules/fast-glob/out/providers/filters/deep.d.ts @@ -0,0 +1,45 @@ +import micromatch = require('micromatch'); +import { IOptions } from '../../managers/options'; +import { FilterFunction } from '@mrmlnc/readdir-enhanced'; +import { Pattern } from '../../types/patterns'; +export default class DeepFilter { + private readonly options; + private readonly micromatchOptions; + constructor(options: IOptions, micromatchOptions: micromatch.Options); + /** + * Returns filter for directories. + */ + getFilter(positive: Pattern[], negative: Pattern[]): FilterFunction; + /** + * Returns max depth of the provided patterns. + */ + private getMaxPatternDepth; + /** + * Returns RegExp's for patterns that can affect the depth of reading. + */ + private getNegativePatternsRe; + /** + * Returns «true» for directory that should be read. + */ + private filter; + /** + * Returns «true» when the «deep» option is disabled or number and depth of the entry is greater that the option value. + */ + private isSkippedByDeepOption; + /** + * Returns «true» when depth parameter is not an Infinity and entry depth greater that the parameter value. + */ + private isSkippedByMaxPatternDepth; + /** + * Returns «true» for symlinked directory if the «followSymlinkedDirectories» option is disabled. + */ + private isSkippedSymlinkedDirectory; + /** + * Returns «true» for a directory whose name starts with a period if «dot» option is disabled. + */ + private isSkippedDotDirectory; + /** + * Returns «true» for a directory whose path math to any negative pattern. + */ + private isSkippedByNegativePatterns; +} diff --git a/node_modules/fast-glob/out/providers/filters/deep.js b/node_modules/fast-glob/out/providers/filters/deep.js new file mode 100644 index 0000000..19732e8 --- /dev/null +++ b/node_modules/fast-glob/out/providers/filters/deep.js @@ -0,0 +1,83 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var pathUtils = require("../../utils/path"); +var patternUtils = require("../../utils/pattern"); +var DeepFilter = /** @class */ (function () { + function DeepFilter(options, micromatchOptions) { + this.options = options; + this.micromatchOptions = micromatchOptions; + } + /** + * Returns filter for directories. + */ + DeepFilter.prototype.getFilter = function (positive, negative) { + var _this = this; + var maxPatternDepth = this.getMaxPatternDepth(positive); + var negativeRe = this.getNegativePatternsRe(negative); + return function (entry) { return _this.filter(entry, negativeRe, maxPatternDepth); }; + }; + /** + * Returns max depth of the provided patterns. + */ + DeepFilter.prototype.getMaxPatternDepth = function (patterns) { + var globstar = patterns.some(patternUtils.hasGlobStar); + return globstar ? Infinity : patternUtils.getMaxNaivePatternsDepth(patterns); + }; + /** + * Returns RegExp's for patterns that can affect the depth of reading. + */ + DeepFilter.prototype.getNegativePatternsRe = function (patterns) { + var affectDepthOfReadingPatterns = patterns.filter(patternUtils.isAffectDepthOfReadingPattern); + return patternUtils.convertPatternsToRe(affectDepthOfReadingPatterns, this.micromatchOptions); + }; + /** + * Returns «true» for directory that should be read. + */ + DeepFilter.prototype.filter = function (entry, negativeRe, maxPatternDepth) { + if (this.isSkippedByDeepOption(entry.depth)) { + return false; + } + if (this.isSkippedByMaxPatternDepth(entry.depth, maxPatternDepth)) { + return false; + } + if (this.isSkippedSymlinkedDirectory(entry)) { + return false; + } + if (this.isSkippedDotDirectory(entry)) { + return false; + } + return this.isSkippedByNegativePatterns(entry, negativeRe); + }; + /** + * Returns «true» when the «deep» option is disabled or number and depth of the entry is greater that the option value. + */ + DeepFilter.prototype.isSkippedByDeepOption = function (entryDepth) { + return !this.options.deep || (typeof this.options.deep === 'number' && entryDepth >= this.options.deep); + }; + /** + * Returns «true» when depth parameter is not an Infinity and entry depth greater that the parameter value. + */ + DeepFilter.prototype.isSkippedByMaxPatternDepth = function (entryDepth, maxPatternDepth) { + return maxPatternDepth !== Infinity && entryDepth >= maxPatternDepth; + }; + /** + * Returns «true» for symlinked directory if the «followSymlinkedDirectories» option is disabled. + */ + DeepFilter.prototype.isSkippedSymlinkedDirectory = function (entry) { + return !this.options.followSymlinkedDirectories && entry.isSymbolicLink(); + }; + /** + * Returns «true» for a directory whose name starts with a period if «dot» option is disabled. + */ + DeepFilter.prototype.isSkippedDotDirectory = function (entry) { + return !this.options.dot && pathUtils.isDotDirectory(entry.path); + }; + /** + * Returns «true» for a directory whose path math to any negative pattern. + */ + DeepFilter.prototype.isSkippedByNegativePatterns = function (entry, negativeRe) { + return !patternUtils.matchAny(entry.path, negativeRe); + }; + return DeepFilter; +}()); +exports.default = DeepFilter; diff --git a/node_modules/fast-glob/out/providers/filters/entry.d.ts b/node_modules/fast-glob/out/providers/filters/entry.d.ts new file mode 100644 index 0000000..88806af --- /dev/null +++ b/node_modules/fast-glob/out/providers/filters/entry.d.ts @@ -0,0 +1,45 @@ +import micromatch = require('micromatch'); +import { IOptions } from '../../managers/options'; +import { FilterFunction } from '@mrmlnc/readdir-enhanced'; +import { Pattern } from '../../types/patterns'; +export default class DeepFilter { + private readonly options; + private readonly micromatchOptions; + readonly index: Map; + constructor(options: IOptions, micromatchOptions: micromatch.Options); + /** + * Returns filter for directories. + */ + getFilter(positive: Pattern[], negative: Pattern[]): FilterFunction; + /** + * Returns true if entry must be added to result. + */ + private filter; + /** + * Return true if the entry already has in the cross reader index. + */ + private isDuplicateEntry; + /** + * Create record in the cross reader index. + */ + private createIndexRecord; + /** + * Returns true for non-files if the «onlyFiles» option is enabled. + */ + private onlyFileFilter; + /** + * Returns true for non-directories if the «onlyDirectories» option is enabled. + */ + private onlyDirectoryFilter; + /** + * Return true when `absolute` option is enabled and matched to the negative patterns. + */ + private isSkippedByAbsoluteNegativePatterns; + /** + * Return true when entry match to provided patterns. + * + * First, just trying to apply patterns to the path. + * Second, trying to apply patterns to the path with final slash (need to micromatch to support «directory/**» patterns). + */ + private isMatchToPatterns; +} diff --git a/node_modules/fast-glob/out/providers/filters/entry.js b/node_modules/fast-glob/out/providers/filters/entry.js new file mode 100644 index 0000000..aa68541 --- /dev/null +++ b/node_modules/fast-glob/out/providers/filters/entry.js @@ -0,0 +1,85 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var pathUtils = require("../../utils/path"); +var patternUtils = require("../../utils/pattern"); +var DeepFilter = /** @class */ (function () { + function DeepFilter(options, micromatchOptions) { + this.options = options; + this.micromatchOptions = micromatchOptions; + this.index = new Map(); + } + /** + * Returns filter for directories. + */ + DeepFilter.prototype.getFilter = function (positive, negative) { + var _this = this; + var positiveRe = patternUtils.convertPatternsToRe(positive, this.micromatchOptions); + var negativeRe = patternUtils.convertPatternsToRe(negative, this.micromatchOptions); + return function (entry) { return _this.filter(entry, positiveRe, negativeRe); }; + }; + /** + * Returns true if entry must be added to result. + */ + DeepFilter.prototype.filter = function (entry, positiveRe, negativeRe) { + // Exclude duplicate results + if (this.options.unique) { + if (this.isDuplicateEntry(entry)) { + return false; + } + this.createIndexRecord(entry); + } + // Filter files and directories by options + if (this.onlyFileFilter(entry) || this.onlyDirectoryFilter(entry)) { + return false; + } + if (this.isSkippedByAbsoluteNegativePatterns(entry, negativeRe)) { + return false; + } + return this.isMatchToPatterns(entry.path, positiveRe) && !this.isMatchToPatterns(entry.path, negativeRe); + }; + /** + * Return true if the entry already has in the cross reader index. + */ + DeepFilter.prototype.isDuplicateEntry = function (entry) { + return this.index.has(entry.path); + }; + /** + * Create record in the cross reader index. + */ + DeepFilter.prototype.createIndexRecord = function (entry) { + this.index.set(entry.path, undefined); + }; + /** + * Returns true for non-files if the «onlyFiles» option is enabled. + */ + DeepFilter.prototype.onlyFileFilter = function (entry) { + return this.options.onlyFiles && !entry.isFile(); + }; + /** + * Returns true for non-directories if the «onlyDirectories» option is enabled. + */ + DeepFilter.prototype.onlyDirectoryFilter = function (entry) { + return this.options.onlyDirectories && !entry.isDirectory(); + }; + /** + * Return true when `absolute` option is enabled and matched to the negative patterns. + */ + DeepFilter.prototype.isSkippedByAbsoluteNegativePatterns = function (entry, negativeRe) { + if (!this.options.absolute) { + return false; + } + var fullpath = pathUtils.makeAbsolute(this.options.cwd, entry.path); + return this.isMatchToPatterns(fullpath, negativeRe); + }; + /** + * Return true when entry match to provided patterns. + * + * First, just trying to apply patterns to the path. + * Second, trying to apply patterns to the path with final slash (need to micromatch to support «directory/**» patterns). + */ + DeepFilter.prototype.isMatchToPatterns = function (filepath, patternsRe) { + return patternUtils.matchAny(filepath, patternsRe) || patternUtils.matchAny(filepath + '/', patternsRe); + }; + return DeepFilter; +}()); +exports.default = DeepFilter; diff --git a/node_modules/fast-glob/out/providers/reader-async.d.ts b/node_modules/fast-glob/out/providers/reader-async.d.ts new file mode 100644 index 0000000..eacdee3 --- /dev/null +++ b/node_modules/fast-glob/out/providers/reader-async.d.ts @@ -0,0 +1,28 @@ +/// +import * as readdir from '@mrmlnc/readdir-enhanced'; +import Reader from './reader'; +import FileSystemStream from '../adapters/fs-stream'; +import { ITask } from '../managers/tasks'; +import { EntryItem } from '../types/entries'; +export default class ReaderAsync extends Reader> { + /** + * Returns FileSystem adapter. + */ + readonly fsAdapter: FileSystemStream; + /** + * Use async API to read entries for Task. + */ + read(task: ITask): Promise; + /** + * Returns founded paths. + */ + api(root: string, task: ITask, options: readdir.Options): NodeJS.ReadableStream; + /** + * Api for dynamic tasks. + */ + dynamicApi(root: string, options: readdir.Options): NodeJS.ReadableStream; + /** + * Api for static tasks. + */ + staticApi(task: ITask, options: readdir.Options): NodeJS.ReadableStream; +} diff --git a/node_modules/fast-glob/out/providers/reader-async.js b/node_modules/fast-glob/out/providers/reader-async.js new file mode 100644 index 0000000..cdd6099 --- /dev/null +++ b/node_modules/fast-glob/out/providers/reader-async.js @@ -0,0 +1,75 @@ +"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 readdir = require("@mrmlnc/readdir-enhanced"); +var reader_1 = require("./reader"); +var fs_stream_1 = require("../adapters/fs-stream"); +var ReaderAsync = /** @class */ (function (_super) { + __extends(ReaderAsync, _super); + function ReaderAsync() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(ReaderAsync.prototype, "fsAdapter", { + /** + * Returns FileSystem adapter. + */ + get: function () { + return new fs_stream_1.default(this.options); + }, + enumerable: true, + configurable: true + }); + /** + * Use async API to read entries for Task. + */ + ReaderAsync.prototype.read = function (task) { + var _this = this; + var root = this.getRootDirectory(task); + var options = this.getReaderOptions(task); + var entries = []; + return new Promise(function (resolve, reject) { + var stream = _this.api(root, task, options); + stream.on('error', function (err) { + _this.isEnoentCodeError(err) ? resolve([]) : reject(err); + stream.pause(); + }); + stream.on('data', function (entry) { return entries.push(_this.transform(entry)); }); + stream.on('end', function () { return resolve(entries); }); + }); + }; + /** + * Returns founded paths. + */ + ReaderAsync.prototype.api = function (root, task, options) { + if (task.dynamic) { + return this.dynamicApi(root, options); + } + return this.staticApi(task, options); + }; + /** + * Api for dynamic tasks. + */ + ReaderAsync.prototype.dynamicApi = function (root, options) { + return readdir.readdirStreamStat(root, options); + }; + /** + * Api for static tasks. + */ + ReaderAsync.prototype.staticApi = function (task, options) { + return this.fsAdapter.read(task.patterns, options.filter); + }; + return ReaderAsync; +}(reader_1.default)); +exports.default = ReaderAsync; diff --git a/node_modules/fast-glob/out/providers/reader-stream.d.ts b/node_modules/fast-glob/out/providers/reader-stream.d.ts new file mode 100644 index 0000000..ebe0d5b --- /dev/null +++ b/node_modules/fast-glob/out/providers/reader-stream.d.ts @@ -0,0 +1,27 @@ +/// +import * as readdir from '@mrmlnc/readdir-enhanced'; +import Reader from './reader'; +import FileSystemStream from '../adapters/fs-stream'; +import { ITask } from '../managers/tasks'; +export default class ReaderStream extends Reader { + /** + * Returns FileSystem adapter. + */ + readonly fsAdapter: FileSystemStream; + /** + * Use stream API to read entries for Task. + */ + read(task: ITask): NodeJS.ReadableStream; + /** + * Returns founded paths. + */ + api(root: string, task: ITask, options: readdir.Options): NodeJS.ReadableStream; + /** + * Api for dynamic tasks. + */ + dynamicApi(root: string, options: readdir.Options): NodeJS.ReadableStream; + /** + * Api for static tasks. + */ + staticApi(task: ITask, options: readdir.Options): NodeJS.ReadableStream; +} diff --git a/node_modules/fast-glob/out/providers/reader-stream.js b/node_modules/fast-glob/out/providers/reader-stream.js new file mode 100644 index 0000000..fd4493d --- /dev/null +++ b/node_modules/fast-glob/out/providers/reader-stream.js @@ -0,0 +1,83 @@ +"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 readdir = require("@mrmlnc/readdir-enhanced"); +var reader_1 = require("./reader"); +var fs_stream_1 = require("../adapters/fs-stream"); +var TransformStream = /** @class */ (function (_super) { + __extends(TransformStream, _super); + function TransformStream(reader) { + var _this = _super.call(this, { objectMode: true }) || this; + _this.reader = reader; + return _this; + } + TransformStream.prototype._transform = function (entry, _encoding, callback) { + callback(null, this.reader.transform(entry)); + }; + return TransformStream; +}(stream.Transform)); +var ReaderStream = /** @class */ (function (_super) { + __extends(ReaderStream, _super); + function ReaderStream() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(ReaderStream.prototype, "fsAdapter", { + /** + * Returns FileSystem adapter. + */ + get: function () { + return new fs_stream_1.default(this.options); + }, + enumerable: true, + configurable: true + }); + /** + * Use stream API to read entries for Task. + */ + ReaderStream.prototype.read = function (task) { + var _this = this; + var root = this.getRootDirectory(task); + var options = this.getReaderOptions(task); + var transform = new TransformStream(this); + var readable = this.api(root, task, options); + return readable + .on('error', function (err) { return _this.isEnoentCodeError(err) ? null : transform.emit('error', err); }) + .pipe(transform); + }; + /** + * Returns founded paths. + */ + ReaderStream.prototype.api = function (root, task, options) { + if (task.dynamic) { + return this.dynamicApi(root, options); + } + return this.staticApi(task, options); + }; + /** + * Api for dynamic tasks. + */ + ReaderStream.prototype.dynamicApi = function (root, options) { + return readdir.readdirStreamStat(root, options); + }; + /** + * Api for static tasks. + */ + ReaderStream.prototype.staticApi = function (task, options) { + return this.fsAdapter.read(task.patterns, options.filter); + }; + return ReaderStream; +}(reader_1.default)); +exports.default = ReaderStream; diff --git a/node_modules/fast-glob/out/providers/reader-sync.d.ts b/node_modules/fast-glob/out/providers/reader-sync.d.ts new file mode 100644 index 0000000..07e16ea --- /dev/null +++ b/node_modules/fast-glob/out/providers/reader-sync.d.ts @@ -0,0 +1,27 @@ +import * as readdir from '@mrmlnc/readdir-enhanced'; +import Reader from './reader'; +import FileSystemSync from '../adapters/fs-sync'; +import { ITask } from '../managers/tasks'; +import { Entry, EntryItem } from '../types/entries'; +export default class ReaderSync extends Reader { + /** + * Returns FileSystem adapter. + */ + readonly fsAdapter: FileSystemSync; + /** + * Use sync API to read entries for Task. + */ + read(task: ITask): EntryItem[]; + /** + * Returns founded paths. + */ + api(root: string, task: ITask, options: readdir.Options): Entry[]; + /** + * Api for dynamic tasks. + */ + dynamicApi(root: string, options: readdir.Options): Entry[]; + /** + * Api for static tasks. + */ + staticApi(task: ITask, options: readdir.Options): Entry[]; +} diff --git a/node_modules/fast-glob/out/providers/reader-sync.js b/node_modules/fast-glob/out/providers/reader-sync.js new file mode 100644 index 0000000..74b5e76 --- /dev/null +++ b/node_modules/fast-glob/out/providers/reader-sync.js @@ -0,0 +1,74 @@ +"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 readdir = require("@mrmlnc/readdir-enhanced"); +var reader_1 = require("./reader"); +var fs_sync_1 = require("../adapters/fs-sync"); +var ReaderSync = /** @class */ (function (_super) { + __extends(ReaderSync, _super); + function ReaderSync() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(ReaderSync.prototype, "fsAdapter", { + /** + * Returns FileSystem adapter. + */ + get: function () { + return new fs_sync_1.default(this.options); + }, + enumerable: true, + configurable: true + }); + /** + * Use sync API to read entries for Task. + */ + ReaderSync.prototype.read = function (task) { + var root = this.getRootDirectory(task); + var options = this.getReaderOptions(task); + try { + var entries = this.api(root, task, options); + return entries.map(this.transform, this); + } + catch (err) { + if (this.isEnoentCodeError(err)) { + return []; + } + throw err; + } + }; + /** + * Returns founded paths. + */ + ReaderSync.prototype.api = function (root, task, options) { + if (task.dynamic) { + return this.dynamicApi(root, options); + } + return this.staticApi(task, options); + }; + /** + * Api for dynamic tasks. + */ + ReaderSync.prototype.dynamicApi = function (root, options) { + return readdir.readdirSyncStat(root, options); + }; + /** + * Api for static tasks. + */ + ReaderSync.prototype.staticApi = function (task, options) { + return this.fsAdapter.read(task.patterns, options.filter); + }; + return ReaderSync; +}(reader_1.default)); +exports.default = ReaderSync; diff --git a/node_modules/fast-glob/out/providers/reader.d.ts b/node_modules/fast-glob/out/providers/reader.d.ts new file mode 100644 index 0000000..ce6ba61 --- /dev/null +++ b/node_modules/fast-glob/out/providers/reader.d.ts @@ -0,0 +1,39 @@ +/// +import micromatch = require('micromatch'); +import DeepFilter from './filters/deep'; +import EntryFilter from './filters/entry'; +import { IOptions } from '../managers/options'; +import { ITask } from '../managers/tasks'; +import { Options as IReaddirOptions } from '@mrmlnc/readdir-enhanced'; +import { Entry, EntryItem } from '../types/entries'; +export default abstract class Reader { + readonly options: IOptions; + readonly entryFilter: EntryFilter; + readonly deepFilter: DeepFilter; + private readonly micromatchOptions; + constructor(options: IOptions); + /** + * The main logic of reading the directories that must be implemented by each providers. + */ + abstract read(_task: ITask): T; + /** + * Returns root path to scanner. + */ + getRootDirectory(task: ITask): string; + /** + * Returns options for reader. + */ + getReaderOptions(task: ITask): IReaddirOptions; + /** + * Returns options for micromatch. + */ + getMicromatchOptions(): micromatch.Options; + /** + * Returns transformed entry. + */ + transform(entry: Entry): EntryItem; + /** + * Returns true if error has ENOENT code. + */ + isEnoentCodeError(err: NodeJS.ErrnoException): boolean; +} diff --git a/node_modules/fast-glob/out/providers/reader.js b/node_modules/fast-glob/out/providers/reader.js new file mode 100644 index 0000000..8e187dd --- /dev/null +++ b/node_modules/fast-glob/out/providers/reader.js @@ -0,0 +1,68 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var path = require("path"); +var deep_1 = require("./filters/deep"); +var entry_1 = require("./filters/entry"); +var pathUtil = require("../utils/path"); +var Reader = /** @class */ (function () { + function Reader(options) { + this.options = options; + this.micromatchOptions = this.getMicromatchOptions(); + this.entryFilter = new entry_1.default(options, this.micromatchOptions); + this.deepFilter = new deep_1.default(options, this.micromatchOptions); + } + /** + * Returns root path to scanner. + */ + Reader.prototype.getRootDirectory = function (task) { + return path.resolve(this.options.cwd, task.base); + }; + /** + * Returns options for reader. + */ + Reader.prototype.getReaderOptions = function (task) { + return { + basePath: task.base === '.' ? '' : task.base, + filter: this.entryFilter.getFilter(task.positive, task.negative), + deep: this.deepFilter.getFilter(task.positive, task.negative), + sep: '/' + }; + }; + /** + * Returns options for micromatch. + */ + Reader.prototype.getMicromatchOptions = function () { + return { + dot: this.options.dot, + nobrace: !this.options.brace, + noglobstar: !this.options.globstar, + noext: !this.options.extension, + nocase: !this.options.case, + matchBase: this.options.matchBase + }; + }; + /** + * Returns transformed entry. + */ + Reader.prototype.transform = function (entry) { + if (this.options.absolute && !path.isAbsolute(entry.path)) { + entry.path = pathUtil.makeAbsolute(this.options.cwd, entry.path); + } + if (this.options.markDirectories && entry.isDirectory()) { + entry.path += '/'; + } + var item = this.options.stats ? entry : entry.path; + if (this.options.transform === null) { + return item; + } + return this.options.transform(item); + }; + /** + * Returns true if error has ENOENT code. + */ + Reader.prototype.isEnoentCodeError = function (err) { + return err.code === 'ENOENT'; + }; + return Reader; +}()); +exports.default = Reader; diff --git a/node_modules/fast-glob/out/types/entries.d.ts b/node_modules/fast-glob/out/types/entries.d.ts new file mode 100644 index 0000000..57a17dd --- /dev/null +++ b/node_modules/fast-glob/out/types/entries.d.ts @@ -0,0 +1,8 @@ +/// +import * as fs from 'fs'; +export interface IEntry extends fs.Stats { + path: string; + depth: number; +} +export declare type EntryItem = string | IEntry; +export declare type Entry = IEntry; diff --git a/node_modules/fast-glob/out/types/entries.js b/node_modules/fast-glob/out/types/entries.js new file mode 100644 index 0000000..c8ad2e5 --- /dev/null +++ b/node_modules/fast-glob/out/types/entries.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/node_modules/fast-glob/out/types/patterns.d.ts b/node_modules/fast-glob/out/types/patterns.d.ts new file mode 100644 index 0000000..96869fd --- /dev/null +++ b/node_modules/fast-glob/out/types/patterns.d.ts @@ -0,0 +1,3 @@ +export declare type Pattern = string; +export declare type PatternRe = RegExp; +export declare type PatternsGroup = Record; diff --git a/node_modules/fast-glob/out/types/patterns.js b/node_modules/fast-glob/out/types/patterns.js new file mode 100644 index 0000000..c8ad2e5 --- /dev/null +++ b/node_modules/fast-glob/out/types/patterns.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/node_modules/fast-glob/out/utils/array.d.ts b/node_modules/fast-glob/out/utils/array.d.ts new file mode 100644 index 0000000..60c9086 --- /dev/null +++ b/node_modules/fast-glob/out/utils/array.d.ts @@ -0,0 +1,4 @@ +/** + * Flatten nested arrays (max depth is 2) into a non-nested array of non-array items. + */ +export declare function flatten(items: T[][]): T[]; diff --git a/node_modules/fast-glob/out/utils/array.js b/node_modules/fast-glob/out/utils/array.js new file mode 100644 index 0000000..54c7f1b --- /dev/null +++ b/node_modules/fast-glob/out/utils/array.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * Flatten nested arrays (max depth is 2) into a non-nested array of non-array items. + */ +function flatten(items) { + return items.reduce(function (collection, item) { return [].concat(collection, item); }, []); +} +exports.flatten = flatten; diff --git a/node_modules/fast-glob/out/utils/path.d.ts b/node_modules/fast-glob/out/utils/path.d.ts new file mode 100644 index 0000000..87dfe19 --- /dev/null +++ b/node_modules/fast-glob/out/utils/path.d.ts @@ -0,0 +1,12 @@ +/** + * Returns «true» if the last partial of the path starting with a period. + */ +export declare function isDotDirectory(filepath: string): boolean; +/** + * Convert a windows-like path to a unix-style path. + */ +export declare function normalize(filepath: string): string; +/** + * Returns normalized absolute path of provided filepath. + */ +export declare function makeAbsolute(cwd: string, filepath: string): string; diff --git a/node_modules/fast-glob/out/utils/path.js b/node_modules/fast-glob/out/utils/path.js new file mode 100644 index 0000000..cf4baea --- /dev/null +++ b/node_modules/fast-glob/out/utils/path.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var path = require("path"); +/** + * Returns «true» if the last partial of the path starting with a period. + */ +function isDotDirectory(filepath) { + return path.basename(filepath).startsWith('.'); +} +exports.isDotDirectory = isDotDirectory; +/** + * Convert a windows-like path to a unix-style path. + */ +function normalize(filepath) { + return filepath.replace(/\\/g, '/'); +} +exports.normalize = normalize; +/** + * Returns normalized absolute path of provided filepath. + */ +function makeAbsolute(cwd, filepath) { + if (path.isAbsolute(filepath)) { + return normalize(filepath); + } + var fullpath = path.resolve(cwd, filepath); + return normalize(fullpath); +} +exports.makeAbsolute = makeAbsolute; diff --git a/node_modules/fast-glob/out/utils/pattern.d.ts b/node_modules/fast-glob/out/utils/pattern.d.ts new file mode 100644 index 0000000..567aefd --- /dev/null +++ b/node_modules/fast-glob/out/utils/pattern.d.ts @@ -0,0 +1,74 @@ +import micromatch = require('micromatch'); +import { Pattern, PatternRe } from '../types/patterns'; +/** + * Return true for static pattern. + */ +export declare function isStaticPattern(pattern: Pattern): boolean; +/** + * Return true for pattern that looks like glob. + */ +export declare function isDynamicPattern(pattern: Pattern): boolean; +/** + * Convert a windows «path» to a unix-style «path». + */ +export declare function unixifyPattern(pattern: Pattern): Pattern; +/** + * Returns negative pattern as positive pattern. + */ +export declare function convertToPositivePattern(pattern: Pattern): Pattern; +/** + * Returns positive pattern as negative pattern. + */ +export declare function convertToNegativePattern(pattern: Pattern): Pattern; +/** + * Return true if provided pattern is negative pattern. + */ +export declare function isNegativePattern(pattern: Pattern): boolean; +/** + * Return true if provided pattern is positive pattern. + */ +export declare function isPositivePattern(pattern: Pattern): boolean; +/** + * Extracts negative patterns from array of patterns. + */ +export declare function getNegativePatterns(patterns: Pattern[]): Pattern[]; +/** + * Extracts positive patterns from array of patterns. + */ +export declare function getPositivePatterns(patterns: Pattern[]): Pattern[]; +/** + * Extract base directory from provided pattern. + */ +export declare function getBaseDirectory(pattern: Pattern): string; +/** + * Return true if provided pattern has globstar. + */ +export declare function hasGlobStar(pattern: Pattern): boolean; +/** + * Return true if provided pattern ends with slash and globstar. + */ +export declare function endsWithSlashGlobStar(pattern: Pattern): boolean; +/** + * Returns «true» when pattern ends with a slash and globstar or the last partial of the pattern is static pattern. + */ +export declare function isAffectDepthOfReadingPattern(pattern: Pattern): boolean; +/** + * Return naive depth of provided pattern without depth of the base directory. + */ +export declare function getNaiveDepth(pattern: Pattern): number; +/** + * Return max naive depth of provided patterns without depth of the base directory. + */ +export declare function getMaxNaivePatternsDepth(patterns: Pattern[]): number; +/** + * Make RegExp for provided pattern. + */ +export declare function makeRe(pattern: Pattern, options: micromatch.Options): PatternRe; +/** + * Convert patterns to regexps. + */ +export declare function convertPatternsToRe(patterns: Pattern[], options: micromatch.Options): PatternRe[]; +/** + * Returns true if the entry match any of the given RegExp's. + */ +export declare function matchAny(entry: string, patternsRe: PatternRe[]): boolean; diff --git a/node_modules/fast-glob/out/utils/pattern.js b/node_modules/fast-glob/out/utils/pattern.js new file mode 100644 index 0000000..ee70908 --- /dev/null +++ b/node_modules/fast-glob/out/utils/pattern.js @@ -0,0 +1,148 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var path = require("path"); +var globParent = require("glob-parent"); +var isGlob = require("is-glob"); +var micromatch = require("micromatch"); +var GLOBSTAR = '**'; +/** + * Return true for static pattern. + */ +function isStaticPattern(pattern) { + return !isDynamicPattern(pattern); +} +exports.isStaticPattern = isStaticPattern; +/** + * Return true for pattern that looks like glob. + */ +function isDynamicPattern(pattern) { + return isGlob(pattern); +} +exports.isDynamicPattern = isDynamicPattern; +/** + * Convert a windows «path» to a unix-style «path». + */ +function unixifyPattern(pattern) { + return pattern.replace(/\\/g, '/'); +} +exports.unixifyPattern = unixifyPattern; +/** + * Returns negative pattern as positive pattern. + */ +function convertToPositivePattern(pattern) { + return isNegativePattern(pattern) ? pattern.slice(1) : pattern; +} +exports.convertToPositivePattern = convertToPositivePattern; +/** + * Returns positive pattern as negative pattern. + */ +function convertToNegativePattern(pattern) { + return '!' + pattern; +} +exports.convertToNegativePattern = convertToNegativePattern; +/** + * Return true if provided pattern is negative pattern. + */ +function isNegativePattern(pattern) { + return pattern.startsWith('!') && pattern[1] !== '('; +} +exports.isNegativePattern = isNegativePattern; +/** + * Return true if provided pattern is positive pattern. + */ +function isPositivePattern(pattern) { + return !isNegativePattern(pattern); +} +exports.isPositivePattern = isPositivePattern; +/** + * Extracts negative patterns from array of patterns. + */ +function getNegativePatterns(patterns) { + return patterns.filter(isNegativePattern); +} +exports.getNegativePatterns = getNegativePatterns; +/** + * Extracts positive patterns from array of patterns. + */ +function getPositivePatterns(patterns) { + return patterns.filter(isPositivePattern); +} +exports.getPositivePatterns = getPositivePatterns; +/** + * Extract base directory from provided pattern. + */ +function getBaseDirectory(pattern) { + return globParent(pattern); +} +exports.getBaseDirectory = getBaseDirectory; +/** + * Return true if provided pattern has globstar. + */ +function hasGlobStar(pattern) { + return pattern.indexOf(GLOBSTAR) !== -1; +} +exports.hasGlobStar = hasGlobStar; +/** + * Return true if provided pattern ends with slash and globstar. + */ +function endsWithSlashGlobStar(pattern) { + return pattern.endsWith('/' + GLOBSTAR); +} +exports.endsWithSlashGlobStar = endsWithSlashGlobStar; +/** + * Returns «true» when pattern ends with a slash and globstar or the last partial of the pattern is static pattern. + */ +function isAffectDepthOfReadingPattern(pattern) { + var basename = path.basename(pattern); + return endsWithSlashGlobStar(pattern) || isStaticPattern(basename); +} +exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern; +/** + * Return naive depth of provided pattern without depth of the base directory. + */ +function getNaiveDepth(pattern) { + var base = getBaseDirectory(pattern); + var patternDepth = pattern.split('/').length; + var patternBaseDepth = base.split('/').length; + /** + * This is a hack for pattern that has no base directory. + * + * This is related to the `*\something\*` pattern. + */ + if (base === '.') { + return patternDepth - patternBaseDepth; + } + return patternDepth - patternBaseDepth - 1; +} +exports.getNaiveDepth = getNaiveDepth; +/** + * Return max naive depth of provided patterns without depth of the base directory. + */ +function getMaxNaivePatternsDepth(patterns) { + return patterns.reduce(function (max, pattern) { + var depth = getNaiveDepth(pattern); + return depth > max ? depth : max; + }, 0); +} +exports.getMaxNaivePatternsDepth = getMaxNaivePatternsDepth; +/** + * Make RegExp for provided pattern. + */ +function makeRe(pattern, options) { + return micromatch.makeRe(pattern, options); +} +exports.makeRe = makeRe; +/** + * Convert patterns to regexps. + */ +function convertPatternsToRe(patterns, options) { + return patterns.map(function (pattern) { return makeRe(pattern, options); }); +} +exports.convertPatternsToRe = convertPatternsToRe; +/** + * Returns true if the entry match any of the given RegExp's. + */ +function matchAny(entry, patternsRe) { + return patternsRe.some(function (patternRe) { return patternRe.test(entry); }); +} +exports.matchAny = matchAny; diff --git a/node_modules/fast-glob/out/utils/stream.d.ts b/node_modules/fast-glob/out/utils/stream.d.ts new file mode 100644 index 0000000..af67264 --- /dev/null +++ b/node_modules/fast-glob/out/utils/stream.d.ts @@ -0,0 +1,5 @@ +/// +/** + * Merge multiple streams and propagate their errors into one stream in parallel. + */ +export declare function merge(streams: NodeJS.ReadableStream[]): NodeJS.ReadableStream; diff --git a/node_modules/fast-glob/out/utils/stream.js b/node_modules/fast-glob/out/utils/stream.js new file mode 100644 index 0000000..03134e9 --- /dev/null +++ b/node_modules/fast-glob/out/utils/stream.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var merge2 = require("merge2"); +/** + * Merge multiple streams and propagate their errors into one stream in parallel. + */ +function merge(streams) { + var mergedStream = merge2(streams); + streams.forEach(function (stream) { + stream.on('error', function (err) { return mergedStream.emit('error', err); }); + }); + return mergedStream; +} +exports.merge = merge; diff --git a/node_modules/fast-glob/package.json b/node_modules/fast-glob/package.json new file mode 100644 index 0000000..97f872f --- /dev/null +++ b/node_modules/fast-glob/package.json @@ -0,0 +1,120 @@ +{ + "_args": [ + [ + "fast-glob@2.2.6", + "/home/dstaesse/git/website" + ] + ], + "_development": true, + "_from": "fast-glob@2.2.6", + "_id": "fast-glob@2.2.6", + "_inBundle": false, + "_integrity": "sha512-0BvMaZc1k9F+MeWWMe8pL6YltFzZYcJsYU7D4JyDA6PAczaXvxqQQ/z+mDF7/4Mw01DeUc+i3CTKajnkANkV4w==", + "_location": "/fast-glob", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "fast-glob@2.2.6", + "name": "fast-glob", + "escapedName": "fast-glob", + "rawSpec": "2.2.6", + "saveSpec": null, + "fetchSpec": "2.2.6" + }, + "_requiredBy": [ + "/globby" + ], + "_resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.6.tgz", + "_spec": "2.2.6", + "_where": "/home/dstaesse/git/website", + "author": { + "name": "Denis Malinochkin", + "url": "canonium.com" + }, + "bugs": { + "url": "https://github.com/mrmlnc/fast-glob/issues" + }, + "dependencies": { + "@mrmlnc/readdir-enhanced": "^2.2.1", + "@nodelib/fs.stat": "^1.1.2", + "glob-parent": "^3.1.0", + "is-glob": "^4.0.0", + "merge2": "^1.2.3", + "micromatch": "^3.1.10" + }, + "description": "Is a faster `node-glob` alternative", + "devDependencies": { + "@types/bash-glob": "^2.0.0", + "@types/compute-stdev": "^1.0.0", + "@types/easy-table": "^0.0.32", + "@types/execa": "^0.9.0", + "@types/glob": "^7.1.1", + "@types/glob-parent": "^3.1.0", + "@types/glob-stream": "^6.1.0", + "@types/globby": "^8.0.0", + "@types/is-glob": "^4.0.0", + "@types/merge2": "^1.1.4", + "@types/micromatch": "^3.1.0", + "@types/minimist": "^1.2.0", + "@types/mocha": "^5.2.5", + "@types/node": "^10.12.0", + "@types/rimraf": "^2.0.2", + "bash-glob": "^2.0.0", + "compute-stdev": "^1.0.0", + "easy-table": "^1.1.1", + "execa": "^0.9.0", + "fast-glob": "^2.2.0", + "glob": "^7.1.2", + "glob-stream": "^6.1.0", + "globby": "^8.0.1", + "minimist": "^1.2.0", + "mocha": "^5.2.0", + "rimraf": "^2.6.2", + "tiny-glob": "^0.2.3", + "tslint": "^5.11.0", + "tslint-config-mrmlnc": "^1.0.0", + "typescript": "^3.1.3" + }, + "engines": { + "node": ">=4.0.0" + }, + "homepage": "https://github.com/mrmlnc/fast-glob#readme", + "keywords": [ + "glob", + "patterns", + "fast", + "implementation" + ], + "license": "MIT", + "main": "index.js", + "name": "fast-glob", + "repository": { + "type": "git", + "url": "git+https://github.com/mrmlnc/fast-glob.git" + }, + "scripts": { + "bench": "npm run build && npm run bench-async && npm run bench-sync", + "bench-async": "npm run bench-async-1 && npm run bench-async-5 && npm run bench-async-10 && npm run bench-async-50 && npm run bench-async-100", + "bench-async-1": "node ./out/benchmark --depth 1", + "bench-async-10": "node ./out/benchmark --depth 10", + "bench-async-100": "node ./out/benchmark --depth 100", + "bench-async-5": "node ./out/benchmark --depth 5", + "bench-async-50": "node ./out/benchmark --depth 50", + "bench-sync": "npm run bench-sync-1 && npm run bench-sync-5 && npm run bench-sync-10 && npm run bench-sync-50 && npm run bench-sync-100", + "bench-sync-1": "node ./out/benchmark --depth 1 --type sync", + "bench-sync-10": "node ./out/benchmark --depth 10 --type sync", + "bench-sync-100": "node ./out/benchmark --depth 100 --type sync", + "bench-sync-5": "node ./out/benchmark --depth 5 --type sync", + "bench-sync-50": "node ./out/benchmark --depth 50 --type sync", + "build": "npm run clean && npm run lint && npm run compile && npm test", + "clean": "rimraf out", + "compile": "tsc", + "lint": "tslint \"src/**/*.ts\" -p . -t stylish", + "smoke": "mocha \"out/**/*.smoke.js\" -s 0", + "test": "mocha \"out/**/*.spec.js\" -s 0", + "watch": "npm run clean && npm run lint & npm run compile -- --sourceMap --watch" + }, + "typings": "index.d.ts", + "version": "2.2.6" +} -- cgit v1.2.3