first commit
This commit is contained in:
21
node_modules/@ts-morph/common/LICENSE
generated
vendored
Normal file
21
node_modules/@ts-morph/common/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 David Sherret
|
||||
|
||||
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.
|
||||
3295
node_modules/@ts-morph/common/dist/ts-morph-common.js
generated
vendored
Normal file
3295
node_modules/@ts-morph/common/dist/ts-morph-common.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
199120
node_modules/@ts-morph/common/dist/typescript.js
generated
vendored
Normal file
199120
node_modules/@ts-morph/common/dist/typescript.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1081
node_modules/@ts-morph/common/lib/ts-morph-common.d.ts
generated
vendored
Normal file
1081
node_modules/@ts-morph/common/lib/ts-morph-common.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
11400
node_modules/@ts-morph/common/lib/typescript.d.ts
generated
vendored
Normal file
11400
node_modules/@ts-morph/common/lib/typescript.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
21
node_modules/@ts-morph/common/node_modules/fast-glob/LICENSE
generated
vendored
Normal file
21
node_modules/@ts-morph/common/node_modules/fast-glob/LICENSE
generated
vendored
Normal file
@@ -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.
|
||||
830
node_modules/@ts-morph/common/node_modules/fast-glob/README.md
generated
vendored
Normal file
830
node_modules/@ts-morph/common/node_modules/fast-glob/README.md
generated
vendored
Normal file
@@ -0,0 +1,830 @@
|
||||
# fast-glob
|
||||
|
||||
> It's a very fast and efficient [glob][glob_definition] library for [Node.js][node_js].
|
||||
|
||||
This package provides methods for traversing the file system and returning pathnames that matched a defined set of a specified pattern according to the rules used by the Unix Bash shell with some simplifications, meanwhile results are returned in **arbitrary order**. Quick, simple, effective.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
<details>
|
||||
<summary><strong>Details</strong></summary>
|
||||
|
||||
* [Highlights](#highlights)
|
||||
* [Old and modern mode](#old-and-modern-mode)
|
||||
* [Pattern syntax](#pattern-syntax)
|
||||
* [Basic syntax](#basic-syntax)
|
||||
* [Advanced syntax](#advanced-syntax)
|
||||
* [Installation](#installation)
|
||||
* [API](#api)
|
||||
* [Asynchronous](#asynchronous)
|
||||
* [Synchronous](#synchronous)
|
||||
* [Stream](#stream)
|
||||
* [patterns](#patterns)
|
||||
* [[options]](#options)
|
||||
* [Helpers](#helpers)
|
||||
* [generateTasks](#generatetaskspatterns-options)
|
||||
* [isDynamicPattern](#isdynamicpatternpattern-options)
|
||||
* [escapePath](#escapepathpath)
|
||||
* [convertPathToPattern](#convertpathtopatternpath)
|
||||
* [Options](#options-3)
|
||||
* [Common](#common)
|
||||
* [concurrency](#concurrency)
|
||||
* [cwd](#cwd)
|
||||
* [deep](#deep)
|
||||
* [followSymbolicLinks](#followsymboliclinks)
|
||||
* [fs](#fs)
|
||||
* [ignore](#ignore)
|
||||
* [suppressErrors](#suppresserrors)
|
||||
* [throwErrorOnBrokenSymbolicLink](#throwerroronbrokensymboliclink)
|
||||
* [Output control](#output-control)
|
||||
* [absolute](#absolute)
|
||||
* [markDirectories](#markdirectories)
|
||||
* [objectMode](#objectmode)
|
||||
* [onlyDirectories](#onlydirectories)
|
||||
* [onlyFiles](#onlyfiles)
|
||||
* [stats](#stats)
|
||||
* [unique](#unique)
|
||||
* [Matching control](#matching-control)
|
||||
* [braceExpansion](#braceexpansion)
|
||||
* [caseSensitiveMatch](#casesensitivematch)
|
||||
* [dot](#dot)
|
||||
* [extglob](#extglob)
|
||||
* [globstar](#globstar)
|
||||
* [baseNameMatch](#basenamematch)
|
||||
* [FAQ](#faq)
|
||||
* [What is a static or dynamic pattern?](#what-is-a-static-or-dynamic-pattern)
|
||||
* [How to write patterns on Windows?](#how-to-write-patterns-on-windows)
|
||||
* [Why are parentheses match wrong?](#why-are-parentheses-match-wrong)
|
||||
* [How to exclude directory from reading?](#how-to-exclude-directory-from-reading)
|
||||
* [How to use UNC path?](#how-to-use-unc-path)
|
||||
* [Compatible with `node-glob`?](#compatible-with-node-glob)
|
||||
* [Benchmarks](#benchmarks)
|
||||
* [Server](#server)
|
||||
* [Nettop](#nettop)
|
||||
* [Changelog](#changelog)
|
||||
* [License](#license)
|
||||
|
||||
</details>
|
||||
|
||||
## Highlights
|
||||
|
||||
* Fast. Probably the fastest.
|
||||
* Supports multiple and negative patterns.
|
||||
* Synchronous, Promise and Stream API.
|
||||
* Object mode. Can return more than just strings.
|
||||
* Error-tolerant.
|
||||
|
||||
## Old and modern mode
|
||||
|
||||
This package works in two modes, depending on the environment in which it is used.
|
||||
|
||||
* **Old mode**. Node.js below 10.10 or when the [`stats`](#stats) option is *enabled*.
|
||||
* **Modern mode**. Node.js 10.10+ and the [`stats`](#stats) option is *disabled*.
|
||||
|
||||
The modern mode is faster. Learn more about the [internal mechanism][nodelib_fs_scandir_old_and_modern_modern].
|
||||
|
||||
## Pattern syntax
|
||||
|
||||
> :warning: Always use forward-slashes in glob expressions (patterns and [`ignore`](#ignore) option). Use backslashes for escaping characters.
|
||||
|
||||
There is more than one form of syntax: basic and advanced. Below is a brief overview of the supported features. Also pay attention to our [FAQ](#faq).
|
||||
|
||||
> :book: This package uses [`micromatch`][micromatch] as a library for pattern matching.
|
||||
|
||||
### Basic syntax
|
||||
|
||||
* An asterisk (`*`) — matches everything except slashes (path separators), hidden files (names starting with `.`).
|
||||
* A double star or globstar (`**`) — matches zero or more directories.
|
||||
* Question mark (`?`) – matches any single character except slashes (path separators).
|
||||
* Sequence (`[seq]`) — matches any character in sequence.
|
||||
|
||||
> :book: A few additional words about the [basic matching behavior][picomatch_matching_behavior].
|
||||
|
||||
Some examples:
|
||||
|
||||
* `src/**/*.js` — matches all files in the `src` directory (any level of nesting) that have the `.js` extension.
|
||||
* `src/*.??` — matches all files in the `src` directory (only first level of nesting) that have a two-character extension.
|
||||
* `file-[01].js` — matches files: `file-0.js`, `file-1.js`.
|
||||
|
||||
### Advanced syntax
|
||||
|
||||
* [Escapes characters][micromatch_backslashes] (`\\`) — matching special characters (`$^*+?()[]`) as literals.
|
||||
* [POSIX character classes][picomatch_posix_brackets] (`[[:digit:]]`).
|
||||
* [Extended globs][micromatch_extglobs] (`?(pattern-list)`).
|
||||
* [Bash style brace expansions][micromatch_braces] (`{}`).
|
||||
* [Regexp character classes][micromatch_regex_character_classes] (`[1-5]`).
|
||||
* [Regex groups][regular_expressions_brackets] (`(a|b)`).
|
||||
|
||||
> :book: A few additional words about the [advanced matching behavior][micromatch_extended_globbing].
|
||||
|
||||
Some examples:
|
||||
|
||||
* `src/**/*.{css,scss}` — matches all files in the `src` directory (any level of nesting) that have the `.css` or `.scss` extension.
|
||||
* `file-[[:digit:]].js` — matches files: `file-0.js`, `file-1.js`, …, `file-9.js`.
|
||||
* `file-{1..3}.js` — matches files: `file-1.js`, `file-2.js`, `file-3.js`.
|
||||
* `file-(1|2)` — matches files: `file-1.js`, `file-2.js`.
|
||||
|
||||
## Installation
|
||||
|
||||
```console
|
||||
npm install fast-glob
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### Asynchronous
|
||||
|
||||
```js
|
||||
fg(patterns, [options])
|
||||
fg.async(patterns, [options])
|
||||
fg.glob(patterns, [options])
|
||||
```
|
||||
|
||||
Returns a `Promise` with an array of matching entries.
|
||||
|
||||
```js
|
||||
const fg = require('fast-glob');
|
||||
|
||||
const entries = await fg(['.editorconfig', '**/index.js'], { dot: true });
|
||||
|
||||
// ['.editorconfig', 'services/index.js']
|
||||
```
|
||||
|
||||
### Synchronous
|
||||
|
||||
```js
|
||||
fg.sync(patterns, [options])
|
||||
fg.globSync(patterns, [options])
|
||||
```
|
||||
|
||||
Returns an array of matching entries.
|
||||
|
||||
```js
|
||||
const fg = require('fast-glob');
|
||||
|
||||
const entries = fg.sync(['.editorconfig', '**/index.js'], { dot: true });
|
||||
|
||||
// ['.editorconfig', 'services/index.js']
|
||||
```
|
||||
|
||||
### Stream
|
||||
|
||||
```js
|
||||
fg.stream(patterns, [options])
|
||||
fg.globStream(patterns, [options])
|
||||
```
|
||||
|
||||
Returns a [`ReadableStream`][node_js_stream_readable_streams] when the `data` event will be emitted with matching entry.
|
||||
|
||||
```js
|
||||
const fg = require('fast-glob');
|
||||
|
||||
const stream = fg.stream(['.editorconfig', '**/index.js'], { dot: true });
|
||||
|
||||
for await (const entry of stream) {
|
||||
// .editorconfig
|
||||
// services/index.js
|
||||
}
|
||||
```
|
||||
|
||||
#### patterns
|
||||
|
||||
* Required: `true`
|
||||
* Type: `string | string[]`
|
||||
|
||||
Any correct pattern(s).
|
||||
|
||||
> :1234: [Pattern syntax](#pattern-syntax)
|
||||
>
|
||||
> :warning: This package does not respect the order of patterns. First, all the negative patterns are applied, and only then the positive patterns. If you want to get a certain order of records, use sorting or split calls.
|
||||
|
||||
#### [options]
|
||||
|
||||
* Required: `false`
|
||||
* Type: [`Options`](#options-3)
|
||||
|
||||
See [Options](#options-3) section.
|
||||
|
||||
### Helpers
|
||||
|
||||
#### `generateTasks(patterns, [options])`
|
||||
|
||||
Returns the internal representation of patterns ([`Task`](./src/managers/tasks.ts) is a combining patterns by base directory).
|
||||
|
||||
```js
|
||||
fg.generateTasks('*');
|
||||
|
||||
[{
|
||||
base: '.', // Parent directory for all patterns inside this task
|
||||
dynamic: true, // Dynamic or static patterns are in this task
|
||||
patterns: ['*'],
|
||||
positive: ['*'],
|
||||
negative: []
|
||||
}]
|
||||
```
|
||||
|
||||
##### patterns
|
||||
|
||||
* Required: `true`
|
||||
* Type: `string | string[]`
|
||||
|
||||
Any correct pattern(s).
|
||||
|
||||
##### [options]
|
||||
|
||||
* Required: `false`
|
||||
* Type: [`Options`](#options-3)
|
||||
|
||||
See [Options](#options-3) section.
|
||||
|
||||
#### `isDynamicPattern(pattern, [options])`
|
||||
|
||||
Returns `true` if the passed pattern is a dynamic pattern.
|
||||
|
||||
> :1234: [What is a static or dynamic pattern?](#what-is-a-static-or-dynamic-pattern)
|
||||
|
||||
```js
|
||||
fg.isDynamicPattern('*'); // true
|
||||
fg.isDynamicPattern('abc'); // false
|
||||
```
|
||||
|
||||
##### pattern
|
||||
|
||||
* Required: `true`
|
||||
* Type: `string`
|
||||
|
||||
Any correct pattern.
|
||||
|
||||
##### [options]
|
||||
|
||||
* Required: `false`
|
||||
* Type: [`Options`](#options-3)
|
||||
|
||||
See [Options](#options-3) section.
|
||||
|
||||
#### `escapePath(path)`
|
||||
|
||||
Returns the path with escaped special characters depending on the platform.
|
||||
|
||||
* Posix:
|
||||
* `*?|(){}[]`;
|
||||
* `!` at the beginning of line;
|
||||
* `@+!` before the opening parenthesis;
|
||||
* `\\` before non-special characters;
|
||||
* Windows:
|
||||
* `(){}[]`
|
||||
* `!` at the beginning of line;
|
||||
* `@+!` before the opening parenthesis;
|
||||
* Characters like `*?|` cannot be used in the path ([windows_naming_conventions][windows_naming_conventions]), so they will not be escaped;
|
||||
|
||||
```js
|
||||
fg.escapePath('!abc');
|
||||
// \\!abc
|
||||
fg.escapePath('[OpenSource] mrmlnc – fast-glob (Deluxe Edition) 2014') + '/*.flac'
|
||||
// \\[OpenSource\\] mrmlnc – fast-glob \\(Deluxe Edition\\) 2014/*.flac
|
||||
|
||||
fg.posix.escapePath('C:\\Program Files (x86)\\**\\*');
|
||||
// C:\\\\Program Files \\(x86\\)\\*\\*\\*
|
||||
fg.win32.escapePath('C:\\Program Files (x86)\\**\\*');
|
||||
// Windows: C:\\Program Files \\(x86\\)\\**\\*
|
||||
```
|
||||
|
||||
#### `convertPathToPattern(path)`
|
||||
|
||||
Converts a path to a pattern depending on the platform, including special character escaping.
|
||||
|
||||
* Posix. Works similarly to the `fg.posix.escapePath` method.
|
||||
* Windows. Works similarly to the `fg.win32.escapePath` method, additionally converting backslashes to forward slashes in cases where they are not escape characters (`!()+@{}[]`).
|
||||
|
||||
```js
|
||||
fg.convertPathToPattern('[OpenSource] mrmlnc – fast-glob (Deluxe Edition) 2014') + '/*.flac';
|
||||
// \\[OpenSource\\] mrmlnc – fast-glob \\(Deluxe Edition\\) 2014/*.flac
|
||||
|
||||
fg.convertPathToPattern('C:/Program Files (x86)/**/*');
|
||||
// Posix: C:/Program Files \\(x86\\)/\\*\\*/\\*
|
||||
// Windows: C:/Program Files \\(x86\\)/**/*
|
||||
|
||||
fg.convertPathToPattern('C:\\Program Files (x86)\\**\\*');
|
||||
// Posix: C:\\\\Program Files \\(x86\\)\\*\\*\\*
|
||||
// Windows: C:/Program Files \\(x86\\)/**/*
|
||||
|
||||
fg.posix.convertPathToPattern('\\\\?\\c:\\Program Files (x86)') + '/**/*';
|
||||
// Posix: \\\\\\?\\\\c:\\\\Program Files \\(x86\\)/**/* (broken pattern)
|
||||
fg.win32.convertPathToPattern('\\\\?\\c:\\Program Files (x86)') + '/**/*';
|
||||
// Windows: //?/c:/Program Files \\(x86\\)/**/*
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### Common options
|
||||
|
||||
#### concurrency
|
||||
|
||||
* Type: `number`
|
||||
* Default: `os.cpus().length`
|
||||
|
||||
Specifies the maximum number of concurrent requests from a reader to read directories.
|
||||
|
||||
> :book: The higher the number, the higher the performance and load on the file system. If you want to read in quiet mode, set the value to a comfortable number or `1`.
|
||||
|
||||
<details>
|
||||
|
||||
<summary>More details</summary>
|
||||
|
||||
In Node, there are [two types of threads][nodejs_thread_pool]: Event Loop (code) and a Thread Pool (fs, dns, …). The thread pool size controlled by the `UV_THREADPOOL_SIZE` environment variable. Its default size is 4 ([documentation][libuv_thread_pool]). The pool is one for all tasks within a single Node process.
|
||||
|
||||
Any code can make 4 real concurrent accesses to the file system. The rest of the FS requests will wait in the queue.
|
||||
|
||||
> :book: Each new instance of FG in the same Node process will use the same Thread pool.
|
||||
|
||||
But this package also has the `concurrency` option. This option allows you to control the number of concurrent accesses to the FS at the package level. By default, this package has a value equal to the number of cores available for the current Node process. This allows you to set a value smaller than the pool size (`concurrency: 1`) or, conversely, to prepare tasks for the pool queue more quickly (`concurrency: Number.POSITIVE_INFINITY`).
|
||||
|
||||
So, in fact, this package can **only make 4 concurrent requests to the FS**. You can increase this value by using an environment variable (`UV_THREADPOOL_SIZE`), but in practice this does not give a multiple advantage.
|
||||
|
||||
</details>
|
||||
|
||||
#### cwd
|
||||
|
||||
* Type: `string`
|
||||
* Default: `process.cwd()`
|
||||
|
||||
The current working directory in which to search.
|
||||
|
||||
#### deep
|
||||
|
||||
* Type: `number`
|
||||
* Default: `Infinity`
|
||||
|
||||
Specifies the maximum depth of a read directory relative to the start directory.
|
||||
|
||||
For example, you have the following tree:
|
||||
|
||||
```js
|
||||
dir/
|
||||
└── one/ // 1
|
||||
└── two/ // 2
|
||||
└── file.js // 3
|
||||
```
|
||||
|
||||
```js
|
||||
// With base directory
|
||||
fg.sync('dir/**', { onlyFiles: false, deep: 1 }); // ['dir/one']
|
||||
fg.sync('dir/**', { onlyFiles: false, deep: 2 }); // ['dir/one', 'dir/one/two']
|
||||
|
||||
// With cwd option
|
||||
fg.sync('**', { onlyFiles: false, cwd: 'dir', deep: 1 }); // ['one']
|
||||
fg.sync('**', { onlyFiles: false, cwd: 'dir', deep: 2 }); // ['one', 'one/two']
|
||||
```
|
||||
|
||||
> :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`](#cwd) option.
|
||||
|
||||
#### followSymbolicLinks
|
||||
|
||||
* Type: `boolean`
|
||||
* Default: `true`
|
||||
|
||||
Indicates whether to traverse descendants of symbolic link directories when expanding `**` patterns.
|
||||
|
||||
> :book: Note that this option does not affect the base directory of the pattern. For example, if `./a` is a symlink to directory `./b` and you specified `['./a**', './b/**']` patterns, then directory `./a` will still be read.
|
||||
|
||||
> :book: If the [`stats`](#stats) option is specified, the information about the symbolic link (`fs.lstat`) will be replaced with information about the entry (`fs.stat`) behind it.
|
||||
|
||||
#### fs
|
||||
|
||||
* Type: `FileSystemAdapter`
|
||||
* Default: `fs.*`
|
||||
|
||||
Custom implementation of methods for working with the file system. Supports objects with enumerable properties only.
|
||||
|
||||
```ts
|
||||
export interface FileSystemAdapter {
|
||||
lstat?: typeof fs.lstat;
|
||||
stat?: typeof fs.stat;
|
||||
lstatSync?: typeof fs.lstatSync;
|
||||
statSync?: typeof fs.statSync;
|
||||
readdir?: typeof fs.readdir;
|
||||
readdirSync?: typeof fs.readdirSync;
|
||||
}
|
||||
```
|
||||
|
||||
#### ignore
|
||||
|
||||
* Type: `string[]`
|
||||
* Default: `[]`
|
||||
|
||||
An array of glob patterns to exclude matches. This is an alternative way to use negative patterns.
|
||||
|
||||
```js
|
||||
dir/
|
||||
├── package-lock.json
|
||||
└── package.json
|
||||
```
|
||||
|
||||
```js
|
||||
fg.sync(['*.json', '!package-lock.json']); // ['package.json']
|
||||
fg.sync('*.json', { ignore: ['package-lock.json'] }); // ['package.json']
|
||||
```
|
||||
|
||||
#### suppressErrors
|
||||
|
||||
* Type: `boolean`
|
||||
* Default: `false`
|
||||
|
||||
By default this package suppress only `ENOENT` errors. Set to `true` to suppress any error.
|
||||
|
||||
> :book: Can be useful when the directory has entries with a special level of access.
|
||||
|
||||
#### throwErrorOnBrokenSymbolicLink
|
||||
|
||||
* Type: `boolean`
|
||||
* Default: `false`
|
||||
|
||||
Throw an error when symbolic link is broken if `true` or safely return `lstat` call if `false`.
|
||||
|
||||
> :book: This option has no effect on errors when reading the symbolic link directory.
|
||||
|
||||
### Output control
|
||||
|
||||
#### absolute
|
||||
|
||||
* Type: `boolean`
|
||||
* Default: `false`
|
||||
|
||||
Return the absolute path for entries.
|
||||
|
||||
```js
|
||||
fg.sync('*.js', { absolute: false }); // ['index.js']
|
||||
fg.sync('*.js', { absolute: true }); // ['/home/user/index.js']
|
||||
```
|
||||
|
||||
> :book: This option is required if you want to use negative patterns with absolute path, for example, `!${__dirname}/*.js`.
|
||||
|
||||
#### markDirectories
|
||||
|
||||
* Type: `boolean`
|
||||
* Default: `false`
|
||||
|
||||
Mark the directory path with the final slash.
|
||||
|
||||
```js
|
||||
fg.sync('*', { onlyFiles: false, markDirectories: false }); // ['index.js', 'controllers']
|
||||
fg.sync('*', { onlyFiles: false, markDirectories: true }); // ['index.js', 'controllers/']
|
||||
```
|
||||
|
||||
#### objectMode
|
||||
|
||||
* Type: `boolean`
|
||||
* Default: `false`
|
||||
|
||||
Returns objects (instead of strings) describing entries.
|
||||
|
||||
```js
|
||||
fg.sync('*', { objectMode: false }); // ['src/index.js']
|
||||
fg.sync('*', { objectMode: true }); // [{ name: 'index.js', path: 'src/index.js', dirent: <fs.Dirent> }]
|
||||
```
|
||||
|
||||
The object has the following fields:
|
||||
|
||||
* name (`string`) — the last part of the path (basename)
|
||||
* path (`string`) — full path relative to the pattern base directory
|
||||
* dirent ([`fs.Dirent`][node_js_fs_class_fs_dirent]) — instance of `fs.Dirent`
|
||||
|
||||
> :book: An object is an internal representation of entry, so getting it does not affect performance.
|
||||
|
||||
#### onlyDirectories
|
||||
|
||||
* Type: `boolean`
|
||||
* Default: `false`
|
||||
|
||||
Return only directories.
|
||||
|
||||
```js
|
||||
fg.sync('*', { onlyDirectories: false }); // ['index.js', 'src']
|
||||
fg.sync('*', { onlyDirectories: true }); // ['src']
|
||||
```
|
||||
|
||||
> :book: If `true`, the [`onlyFiles`](#onlyfiles) option is automatically `false`.
|
||||
|
||||
#### onlyFiles
|
||||
|
||||
* Type: `boolean`
|
||||
* Default: `true`
|
||||
|
||||
Return only files.
|
||||
|
||||
```js
|
||||
fg.sync('*', { onlyFiles: false }); // ['index.js', 'src']
|
||||
fg.sync('*', { onlyFiles: true }); // ['index.js']
|
||||
```
|
||||
|
||||
#### stats
|
||||
|
||||
* Type: `boolean`
|
||||
* Default: `false`
|
||||
|
||||
Enables an [object mode](#objectmode) with an additional field:
|
||||
|
||||
* stats ([`fs.Stats`][node_js_fs_class_fs_stats]) — instance of `fs.Stats`
|
||||
|
||||
```js
|
||||
fg.sync('*', { stats: false }); // ['src/index.js']
|
||||
fg.sync('*', { stats: true }); // [{ name: 'index.js', path: 'src/index.js', dirent: <fs.Dirent>, stats: <fs.Stats> }]
|
||||
```
|
||||
|
||||
> :book: Returns `fs.stat` instead of `fs.lstat` for symbolic links when the [`followSymbolicLinks`](#followsymboliclinks) option is specified.
|
||||
>
|
||||
> :warning: Unlike [object mode](#objectmode) this mode requires additional calls to the file system. On average, this mode is slower at least twice. See [old and modern mode](#old-and-modern-mode) for more details.
|
||||
|
||||
#### unique
|
||||
|
||||
* Type: `boolean`
|
||||
* Default: `true`
|
||||
|
||||
Ensures that the returned entries are unique.
|
||||
|
||||
```js
|
||||
fg.sync(['*.json', 'package.json'], { unique: false }); // ['package.json', 'package.json']
|
||||
fg.sync(['*.json', 'package.json'], { unique: true }); // ['package.json']
|
||||
```
|
||||
|
||||
If `true` and similar entries are found, the result is the first found.
|
||||
|
||||
### Matching control
|
||||
|
||||
#### braceExpansion
|
||||
|
||||
* Type: `boolean`
|
||||
* Default: `true`
|
||||
|
||||
Enables Bash-like brace expansion.
|
||||
|
||||
> :1234: [Syntax description][bash_hackers_syntax_expansion_brace] or more [detailed description][micromatch_braces].
|
||||
|
||||
```js
|
||||
dir/
|
||||
├── abd
|
||||
├── acd
|
||||
└── a{b,c}d
|
||||
```
|
||||
|
||||
```js
|
||||
fg.sync('a{b,c}d', { braceExpansion: false }); // ['a{b,c}d']
|
||||
fg.sync('a{b,c}d', { braceExpansion: true }); // ['abd', 'acd']
|
||||
```
|
||||
|
||||
#### caseSensitiveMatch
|
||||
|
||||
* Type: `boolean`
|
||||
* Default: `true`
|
||||
|
||||
Enables a [case-sensitive][wikipedia_case_sensitivity] mode for matching files.
|
||||
|
||||
```js
|
||||
dir/
|
||||
├── file.txt
|
||||
└── File.txt
|
||||
```
|
||||
|
||||
```js
|
||||
fg.sync('file.txt', { caseSensitiveMatch: false }); // ['file.txt', 'File.txt']
|
||||
fg.sync('file.txt', { caseSensitiveMatch: true }); // ['file.txt']
|
||||
```
|
||||
|
||||
#### dot
|
||||
|
||||
* Type: `boolean`
|
||||
* Default: `false`
|
||||
|
||||
Allow patterns to match entries that begin with a period (`.`).
|
||||
|
||||
> :book: Note that an explicit dot in a portion of the pattern will always match dot files.
|
||||
|
||||
```js
|
||||
dir/
|
||||
├── .editorconfig
|
||||
└── package.json
|
||||
```
|
||||
|
||||
```js
|
||||
fg.sync('*', { dot: false }); // ['package.json']
|
||||
fg.sync('*', { dot: true }); // ['.editorconfig', 'package.json']
|
||||
```
|
||||
|
||||
#### extglob
|
||||
|
||||
* Type: `boolean`
|
||||
* Default: `true`
|
||||
|
||||
Enables Bash-like `extglob` functionality.
|
||||
|
||||
> :1234: [Syntax description][micromatch_extglobs].
|
||||
|
||||
```js
|
||||
dir/
|
||||
├── README.md
|
||||
└── package.json
|
||||
```
|
||||
|
||||
```js
|
||||
fg.sync('*.+(json|md)', { extglob: false }); // []
|
||||
fg.sync('*.+(json|md)', { extglob: true }); // ['README.md', 'package.json']
|
||||
```
|
||||
|
||||
#### globstar
|
||||
|
||||
* Type: `boolean`
|
||||
* Default: `true`
|
||||
|
||||
Enables recursively repeats a pattern containing `**`. If `false`, `**` behaves exactly like `*`.
|
||||
|
||||
```js
|
||||
dir/
|
||||
└── a
|
||||
└── b
|
||||
```
|
||||
|
||||
```js
|
||||
fg.sync('**', { onlyFiles: false, globstar: false }); // ['a']
|
||||
fg.sync('**', { onlyFiles: false, globstar: true }); // ['a', 'a/b']
|
||||
```
|
||||
|
||||
#### baseNameMatch
|
||||
|
||||
* Type: `boolean`
|
||||
* Default: `false`
|
||||
|
||||
If set to `true`, then patterns without slashes will be matched against the basename of the path if it contains slashes.
|
||||
|
||||
```js
|
||||
dir/
|
||||
└── one/
|
||||
└── file.md
|
||||
```
|
||||
|
||||
```js
|
||||
fg.sync('*.md', { baseNameMatch: false }); // []
|
||||
fg.sync('*.md', { baseNameMatch: true }); // ['one/file.md']
|
||||
```
|
||||
|
||||
## FAQ
|
||||
|
||||
## What is a static or dynamic pattern?
|
||||
|
||||
All patterns can be divided into two types:
|
||||
|
||||
* **static**. A pattern is considered static if it can be used to get an entry on the file system without using matching mechanisms. For example, the `file.js` pattern is a static pattern because we can just verify that it exists on the file system.
|
||||
* **dynamic**. A pattern is considered dynamic if it cannot be used directly to find occurrences without using a matching mechanisms. For example, the `*` pattern is a dynamic pattern because we cannot use this pattern directly.
|
||||
|
||||
A pattern is considered dynamic if it contains the following characters (`…` — any characters or their absence) or options:
|
||||
|
||||
* The [`caseSensitiveMatch`](#casesensitivematch) option is disabled
|
||||
* `\\` (the escape character)
|
||||
* `*`, `?`, `!` (at the beginning of line)
|
||||
* `[…]`
|
||||
* `(…|…)`
|
||||
* `@(…)`, `!(…)`, `*(…)`, `?(…)`, `+(…)` (respects the [`extglob`](#extglob) option)
|
||||
* `{…,…}`, `{…..…}` (respects the [`braceExpansion`](#braceexpansion) option)
|
||||
|
||||
## How to write patterns on Windows?
|
||||
|
||||
Always use forward-slashes in glob expressions (patterns and [`ignore`](#ignore) option). Use backslashes for escaping characters. With the [`cwd`](#cwd) option use a convenient format.
|
||||
|
||||
**Bad**
|
||||
|
||||
```ts
|
||||
[
|
||||
'directory\\*',
|
||||
path.join(process.cwd(), '**')
|
||||
]
|
||||
```
|
||||
|
||||
**Good**
|
||||
|
||||
```ts
|
||||
[
|
||||
'directory/*',
|
||||
fg.convertPathToPattern(process.cwd()) + '/**'
|
||||
]
|
||||
```
|
||||
|
||||
> :book: Use the [`.convertPathToPattern`](#convertpathtopatternpath) package to convert Windows-style path to a Unix-style path.
|
||||
|
||||
Read more about [matching with backslashes][micromatch_backslashes].
|
||||
|
||||
## Why are parentheses match wrong?
|
||||
|
||||
```js
|
||||
dir/
|
||||
└── (special-*file).txt
|
||||
```
|
||||
|
||||
```js
|
||||
fg.sync(['(special-*file).txt']) // []
|
||||
```
|
||||
|
||||
Refers to Bash. You need to escape special characters:
|
||||
|
||||
```js
|
||||
fg.sync(['\\(special-*file\\).txt']) // ['(special-*file).txt']
|
||||
```
|
||||
|
||||
Read more about [matching special characters as literals][picomatch_matching_special_characters_as_literals]. Or use the [`.escapePath`](#escapepathpath).
|
||||
|
||||
## How to exclude directory from reading?
|
||||
|
||||
You can use a negative pattern like this: `!**/node_modules` or `!**/node_modules/**`. Also you can use [`ignore`](#ignore) option. Just look at the example below.
|
||||
|
||||
```js
|
||||
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.md']
|
||||
fg.sync(['**/*.md'], { ignore: ['**/second/**'] }); // ['first/file.md']
|
||||
```
|
||||
|
||||
> :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.
|
||||
|
||||
## How to use UNC path?
|
||||
|
||||
You cannot use [Uniform Naming Convention (UNC)][unc_path] paths as patterns (due to syntax) directly, but you can use them as [`cwd`](#cwd) directory or use the `fg.convertPathToPattern` method.
|
||||
|
||||
```ts
|
||||
// cwd
|
||||
fg.sync('*', { cwd: '\\\\?\\C:\\Python27' /* or //?/C:/Python27 */ });
|
||||
fg.sync('Python27/*', { cwd: '\\\\?\\C:\\' /* or //?/C:/ */ });
|
||||
|
||||
// .convertPathToPattern
|
||||
fg.sync(fg.convertPathToPattern('\\\\?\\c:\\Python27') + '/*');
|
||||
```
|
||||
|
||||
## Compatible with `node-glob`?
|
||||
|
||||
| node-glob | fast-glob |
|
||||
| :----------: | :-------: |
|
||||
| `cwd` | [`cwd`](#cwd) |
|
||||
| `root` | – |
|
||||
| `dot` | [`dot`](#dot) |
|
||||
| `nomount` | – |
|
||||
| `mark` | [`markDirectories`](#markdirectories) |
|
||||
| `nosort` | – |
|
||||
| `nounique` | [`unique`](#unique) |
|
||||
| `nobrace` | [`braceExpansion`](#braceexpansion) |
|
||||
| `noglobstar` | [`globstar`](#globstar) |
|
||||
| `noext` | [`extglob`](#extglob) |
|
||||
| `nocase` | [`caseSensitiveMatch`](#casesensitivematch) |
|
||||
| `matchBase` | [`baseNameMatch`](#basenamematch) |
|
||||
| `nodir` | [`onlyFiles`](#onlyfiles) |
|
||||
| `ignore` | [`ignore`](#ignore) |
|
||||
| `follow` | [`followSymbolicLinks`](#followsymboliclinks) |
|
||||
| `realpath` | – |
|
||||
| `absolute` | [`absolute`](#absolute) |
|
||||
|
||||
## Benchmarks
|
||||
|
||||
You can see results [here](https://github.com/mrmlnc/fast-glob/actions/workflows/benchmark.yml?query=branch%3Amaster) for every commit into the `main` branch.
|
||||
|
||||
* **Product benchmark** – comparison with the main competitors.
|
||||
* **Regress benchmark** – regression between the current version and the version from the npm registry.
|
||||
|
||||
## Changelog
|
||||
|
||||
See the [Releases section of our GitHub project][github_releases] for changelog for each release version.
|
||||
|
||||
## License
|
||||
|
||||
This software is released under the terms of the MIT license.
|
||||
|
||||
[bash_hackers_syntax_expansion_brace]: https://wiki.bash-hackers.org/syntax/expansion/brace
|
||||
[github_releases]: https://github.com/mrmlnc/fast-glob/releases
|
||||
[glob_definition]: https://en.wikipedia.org/wiki/Glob_(programming)
|
||||
[glob_linux_man]: http://man7.org/linux/man-pages/man3/glob.3.html
|
||||
[micromatch_backslashes]: https://github.com/micromatch/micromatch#backslashes
|
||||
[micromatch_braces]: https://github.com/micromatch/braces
|
||||
[micromatch_extended_globbing]: https://github.com/micromatch/micromatch#extended-globbing
|
||||
[micromatch_extglobs]: https://github.com/micromatch/micromatch#extglobs
|
||||
[micromatch_regex_character_classes]: https://github.com/micromatch/micromatch#regex-character-classes
|
||||
[micromatch]: https://github.com/micromatch/micromatch
|
||||
[node_js_fs_class_fs_dirent]: https://nodejs.org/api/fs.html#fs_class_fs_dirent
|
||||
[node_js_fs_class_fs_stats]: https://nodejs.org/api/fs.html#fs_class_fs_stats
|
||||
[node_js_stream_readable_streams]: https://nodejs.org/api/stream.html#stream_readable_streams
|
||||
[node_js]: https://nodejs.org/en
|
||||
[nodelib_fs_scandir_old_and_modern_modern]: https://github.com/nodelib/nodelib/blob/master/packages/fs/fs.scandir/README.md#old-and-modern-mode
|
||||
[npm_normalize_path]: https://www.npmjs.com/package/normalize-path
|
||||
[npm_unixify]: https://www.npmjs.com/package/unixify
|
||||
[picomatch_matching_behavior]: https://github.com/micromatch/picomatch#matching-behavior-vs-bash
|
||||
[picomatch_matching_special_characters_as_literals]: https://github.com/micromatch/picomatch#matching-special-characters-as-literals
|
||||
[picomatch_posix_brackets]: https://github.com/micromatch/picomatch#posix-brackets
|
||||
[regular_expressions_brackets]: https://www.regular-expressions.info/brackets.html
|
||||
[unc_path]: https://learn.microsoft.com/openspecs/windows_protocols/ms-dtyp/62e862f4-2a51-452e-8eeb-dc4ff5ee33cc
|
||||
[wikipedia_case_sensitivity]: https://en.wikipedia.org/wiki/Case_sensitivity
|
||||
[nodejs_thread_pool]: https://nodejs.org/en/docs/guides/dont-block-the-event-loop
|
||||
[libuv_thread_pool]: http://docs.libuv.org/en/v1.x/threadpool.html
|
||||
[windows_naming_conventions]: https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
|
||||
40
node_modules/@ts-morph/common/node_modules/fast-glob/out/index.d.ts
generated
vendored
Normal file
40
node_modules/@ts-morph/common/node_modules/fast-glob/out/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
/// <reference types="node" />
|
||||
import * as taskManager from './managers/tasks';
|
||||
import { Options as OptionsInternal } from './settings';
|
||||
import { Entry as EntryInternal, FileSystemAdapter as FileSystemAdapterInternal, Pattern as PatternInternal } from './types';
|
||||
type EntryObjectModePredicate = {
|
||||
[TKey in keyof Pick<OptionsInternal, 'objectMode'>]-?: true;
|
||||
};
|
||||
type EntryStatsPredicate = {
|
||||
[TKey in keyof Pick<OptionsInternal, 'stats'>]-?: true;
|
||||
};
|
||||
type EntryObjectPredicate = EntryObjectModePredicate | EntryStatsPredicate;
|
||||
declare function FastGlob(source: PatternInternal | PatternInternal[], options: OptionsInternal & EntryObjectPredicate): Promise<EntryInternal[]>;
|
||||
declare function FastGlob(source: PatternInternal | PatternInternal[], options?: OptionsInternal): Promise<string[]>;
|
||||
declare namespace FastGlob {
|
||||
type Options = OptionsInternal;
|
||||
type Entry = EntryInternal;
|
||||
type Task = taskManager.Task;
|
||||
type Pattern = PatternInternal;
|
||||
type FileSystemAdapter = FileSystemAdapterInternal;
|
||||
const glob: typeof FastGlob;
|
||||
const globSync: typeof sync;
|
||||
const globStream: typeof stream;
|
||||
const async: typeof FastGlob;
|
||||
function sync(source: PatternInternal | PatternInternal[], options: OptionsInternal & EntryObjectPredicate): EntryInternal[];
|
||||
function sync(source: PatternInternal | PatternInternal[], options?: OptionsInternal): string[];
|
||||
function stream(source: PatternInternal | PatternInternal[], options?: OptionsInternal): NodeJS.ReadableStream;
|
||||
function generateTasks(source: PatternInternal | PatternInternal[], options?: OptionsInternal): Task[];
|
||||
function isDynamicPattern(source: PatternInternal, options?: OptionsInternal): boolean;
|
||||
function escapePath(source: string): PatternInternal;
|
||||
function convertPathToPattern(source: string): PatternInternal;
|
||||
namespace posix {
|
||||
function escapePath(source: string): PatternInternal;
|
||||
function convertPathToPattern(source: string): PatternInternal;
|
||||
}
|
||||
namespace win32 {
|
||||
function escapePath(source: string): PatternInternal;
|
||||
function convertPathToPattern(source: string): PatternInternal;
|
||||
}
|
||||
}
|
||||
export = FastGlob;
|
||||
102
node_modules/@ts-morph/common/node_modules/fast-glob/out/index.js
generated
vendored
Normal file
102
node_modules/@ts-morph/common/node_modules/fast-glob/out/index.js
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
"use strict";
|
||||
const taskManager = require("./managers/tasks");
|
||||
const async_1 = require("./providers/async");
|
||||
const stream_1 = require("./providers/stream");
|
||||
const sync_1 = require("./providers/sync");
|
||||
const settings_1 = require("./settings");
|
||||
const utils = require("./utils");
|
||||
async function FastGlob(source, options) {
|
||||
assertPatternsInput(source);
|
||||
const works = getWorks(source, async_1.default, options);
|
||||
const result = await Promise.all(works);
|
||||
return utils.array.flatten(result);
|
||||
}
|
||||
// https://github.com/typescript-eslint/typescript-eslint/issues/60
|
||||
// eslint-disable-next-line no-redeclare
|
||||
(function (FastGlob) {
|
||||
FastGlob.glob = FastGlob;
|
||||
FastGlob.globSync = sync;
|
||||
FastGlob.globStream = stream;
|
||||
FastGlob.async = FastGlob;
|
||||
function sync(source, options) {
|
||||
assertPatternsInput(source);
|
||||
const works = getWorks(source, sync_1.default, options);
|
||||
return utils.array.flatten(works);
|
||||
}
|
||||
FastGlob.sync = sync;
|
||||
function stream(source, options) {
|
||||
assertPatternsInput(source);
|
||||
const works = getWorks(source, stream_1.default, options);
|
||||
/**
|
||||
* The stream returned by the provider cannot work with an asynchronous iterator.
|
||||
* To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams.
|
||||
* This affects performance (+25%). I don't see best solution right now.
|
||||
*/
|
||||
return utils.stream.merge(works);
|
||||
}
|
||||
FastGlob.stream = stream;
|
||||
function generateTasks(source, options) {
|
||||
assertPatternsInput(source);
|
||||
const patterns = [].concat(source);
|
||||
const settings = new settings_1.default(options);
|
||||
return taskManager.generate(patterns, settings);
|
||||
}
|
||||
FastGlob.generateTasks = generateTasks;
|
||||
function isDynamicPattern(source, options) {
|
||||
assertPatternsInput(source);
|
||||
const settings = new settings_1.default(options);
|
||||
return utils.pattern.isDynamicPattern(source, settings);
|
||||
}
|
||||
FastGlob.isDynamicPattern = isDynamicPattern;
|
||||
function escapePath(source) {
|
||||
assertPatternsInput(source);
|
||||
return utils.path.escape(source);
|
||||
}
|
||||
FastGlob.escapePath = escapePath;
|
||||
function convertPathToPattern(source) {
|
||||
assertPatternsInput(source);
|
||||
return utils.path.convertPathToPattern(source);
|
||||
}
|
||||
FastGlob.convertPathToPattern = convertPathToPattern;
|
||||
let posix;
|
||||
(function (posix) {
|
||||
function escapePath(source) {
|
||||
assertPatternsInput(source);
|
||||
return utils.path.escapePosixPath(source);
|
||||
}
|
||||
posix.escapePath = escapePath;
|
||||
function convertPathToPattern(source) {
|
||||
assertPatternsInput(source);
|
||||
return utils.path.convertPosixPathToPattern(source);
|
||||
}
|
||||
posix.convertPathToPattern = convertPathToPattern;
|
||||
})(posix = FastGlob.posix || (FastGlob.posix = {}));
|
||||
let win32;
|
||||
(function (win32) {
|
||||
function escapePath(source) {
|
||||
assertPatternsInput(source);
|
||||
return utils.path.escapeWindowsPath(source);
|
||||
}
|
||||
win32.escapePath = escapePath;
|
||||
function convertPathToPattern(source) {
|
||||
assertPatternsInput(source);
|
||||
return utils.path.convertWindowsPathToPattern(source);
|
||||
}
|
||||
win32.convertPathToPattern = convertPathToPattern;
|
||||
})(win32 = FastGlob.win32 || (FastGlob.win32 = {}));
|
||||
})(FastGlob || (FastGlob = {}));
|
||||
function getWorks(source, _Provider, options) {
|
||||
const patterns = [].concat(source);
|
||||
const settings = new settings_1.default(options);
|
||||
const tasks = taskManager.generate(patterns, settings);
|
||||
const provider = new _Provider(settings);
|
||||
return tasks.map(provider.read, provider);
|
||||
}
|
||||
function assertPatternsInput(input) {
|
||||
const source = [].concat(input);
|
||||
const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item));
|
||||
if (!isValidSource) {
|
||||
throw new TypeError('Patterns must be a string (non empty) or an array of strings');
|
||||
}
|
||||
}
|
||||
module.exports = FastGlob;
|
||||
22
node_modules/@ts-morph/common/node_modules/fast-glob/out/managers/tasks.d.ts
generated
vendored
Normal file
22
node_modules/@ts-morph/common/node_modules/fast-glob/out/managers/tasks.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import Settings from '../settings';
|
||||
import { Pattern, PatternsGroup } from '../types';
|
||||
export type Task = {
|
||||
base: string;
|
||||
dynamic: boolean;
|
||||
patterns: Pattern[];
|
||||
positive: Pattern[];
|
||||
negative: Pattern[];
|
||||
};
|
||||
export declare function generate(input: Pattern[], settings: Settings): Task[];
|
||||
/**
|
||||
* Returns tasks grouped by basic pattern directories.
|
||||
*
|
||||
* Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately.
|
||||
* This is necessary because directory traversal starts at the base directory and goes deeper.
|
||||
*/
|
||||
export declare function convertPatternsToTasks(positive: Pattern[], negative: Pattern[], dynamic: boolean): Task[];
|
||||
export declare function getPositivePatterns(patterns: Pattern[]): Pattern[];
|
||||
export declare function getNegativePatternsAsPositive(patterns: Pattern[], ignore: Pattern[]): Pattern[];
|
||||
export declare function groupPatternsByBaseDirectory(patterns: Pattern[]): PatternsGroup;
|
||||
export declare function convertPatternGroupsToTasks(positive: PatternsGroup, negative: Pattern[], dynamic: boolean): Task[];
|
||||
export declare function convertPatternGroupToTask(base: string, positive: Pattern[], negative: Pattern[], dynamic: boolean): Task;
|
||||
110
node_modules/@ts-morph/common/node_modules/fast-glob/out/managers/tasks.js
generated
vendored
Normal file
110
node_modules/@ts-morph/common/node_modules/fast-glob/out/managers/tasks.js
generated
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0;
|
||||
const utils = require("../utils");
|
||||
function generate(input, settings) {
|
||||
const patterns = processPatterns(input, settings);
|
||||
const ignore = processPatterns(settings.ignore, settings);
|
||||
const positivePatterns = getPositivePatterns(patterns);
|
||||
const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
|
||||
const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings));
|
||||
const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings));
|
||||
const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false);
|
||||
const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true);
|
||||
return staticTasks.concat(dynamicTasks);
|
||||
}
|
||||
exports.generate = generate;
|
||||
function processPatterns(input, settings) {
|
||||
let patterns = input;
|
||||
/**
|
||||
* The original pattern like `{,*,**,a/*}` can lead to problems checking the depth when matching entry
|
||||
* and some problems with the micromatch package (see fast-glob issues: #365, #394).
|
||||
*
|
||||
* To solve this problem, we expand all patterns containing brace expansion. This can lead to a slight slowdown
|
||||
* in matching in the case of a large set of patterns after expansion.
|
||||
*/
|
||||
if (settings.braceExpansion) {
|
||||
patterns = utils.pattern.expandPatternsWithBraceExpansion(patterns);
|
||||
}
|
||||
/**
|
||||
* If the `baseNameMatch` option is enabled, we must add globstar to patterns, so that they can be used
|
||||
* at any nesting level.
|
||||
*
|
||||
* We do this here, because otherwise we have to complicate the filtering logic. For example, we need to change
|
||||
* the pattern in the filter before creating a regular expression. There is no need to change the patterns
|
||||
* in the application. Only on the input.
|
||||
*/
|
||||
if (settings.baseNameMatch) {
|
||||
patterns = patterns.map((pattern) => pattern.includes('/') ? pattern : `**/${pattern}`);
|
||||
}
|
||||
/**
|
||||
* This method also removes duplicate slashes that may have been in the pattern or formed as a result of expansion.
|
||||
*/
|
||||
return patterns.map((pattern) => utils.pattern.removeDuplicateSlashes(pattern));
|
||||
}
|
||||
/**
|
||||
* Returns tasks grouped by basic pattern directories.
|
||||
*
|
||||
* Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately.
|
||||
* This is necessary because directory traversal starts at the base directory and goes deeper.
|
||||
*/
|
||||
function convertPatternsToTasks(positive, negative, dynamic) {
|
||||
const tasks = [];
|
||||
const patternsOutsideCurrentDirectory = utils.pattern.getPatternsOutsideCurrentDirectory(positive);
|
||||
const patternsInsideCurrentDirectory = utils.pattern.getPatternsInsideCurrentDirectory(positive);
|
||||
const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory);
|
||||
const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory);
|
||||
tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic));
|
||||
/*
|
||||
* For the sake of reducing future accesses to the file system, we merge all tasks within the current directory
|
||||
* into a global task, if at least one pattern refers to the root (`.`). In this case, the global task covers the rest.
|
||||
*/
|
||||
if ('.' in insideCurrentDirectoryGroup) {
|
||||
tasks.push(convertPatternGroupToTask('.', patternsInsideCurrentDirectory, negative, dynamic));
|
||||
}
|
||||
else {
|
||||
tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic));
|
||||
}
|
||||
return tasks;
|
||||
}
|
||||
exports.convertPatternsToTasks = convertPatternsToTasks;
|
||||
function getPositivePatterns(patterns) {
|
||||
return utils.pattern.getPositivePatterns(patterns);
|
||||
}
|
||||
exports.getPositivePatterns = getPositivePatterns;
|
||||
function getNegativePatternsAsPositive(patterns, ignore) {
|
||||
const negative = utils.pattern.getNegativePatterns(patterns).concat(ignore);
|
||||
const positive = negative.map(utils.pattern.convertToPositivePattern);
|
||||
return positive;
|
||||
}
|
||||
exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
|
||||
function groupPatternsByBaseDirectory(patterns) {
|
||||
const group = {};
|
||||
return patterns.reduce((collection, pattern) => {
|
||||
const base = utils.pattern.getBaseDirectory(pattern);
|
||||
if (base in collection) {
|
||||
collection[base].push(pattern);
|
||||
}
|
||||
else {
|
||||
collection[base] = [pattern];
|
||||
}
|
||||
return collection;
|
||||
}, group);
|
||||
}
|
||||
exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
|
||||
function convertPatternGroupsToTasks(positive, negative, dynamic) {
|
||||
return Object.keys(positive).map((base) => {
|
||||
return convertPatternGroupToTask(base, positive[base], negative, dynamic);
|
||||
});
|
||||
}
|
||||
exports.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
|
||||
function convertPatternGroupToTask(base, positive, negative, dynamic) {
|
||||
return {
|
||||
dynamic,
|
||||
positive,
|
||||
negative,
|
||||
base,
|
||||
patterns: [].concat(positive, negative.map(utils.pattern.convertToNegativePattern))
|
||||
};
|
||||
}
|
||||
exports.convertPatternGroupToTask = convertPatternGroupToTask;
|
||||
9
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/async.d.ts
generated
vendored
Normal file
9
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/async.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Task } from '../managers/tasks';
|
||||
import { Entry, EntryItem, ReaderOptions } from '../types';
|
||||
import ReaderAsync from '../readers/async';
|
||||
import Provider from './provider';
|
||||
export default class ProviderAsync extends Provider<Promise<EntryItem[]>> {
|
||||
protected _reader: ReaderAsync;
|
||||
read(task: Task): Promise<EntryItem[]>;
|
||||
api(root: string, task: Task, options: ReaderOptions): Promise<Entry[]>;
|
||||
}
|
||||
23
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/async.js
generated
vendored
Normal file
23
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/async.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const async_1 = require("../readers/async");
|
||||
const provider_1 = require("./provider");
|
||||
class ProviderAsync extends provider_1.default {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this._reader = new async_1.default(this._settings);
|
||||
}
|
||||
async read(task) {
|
||||
const root = this._getRootDirectory(task);
|
||||
const options = this._getReaderOptions(task);
|
||||
const entries = await this.api(root, task, options);
|
||||
return entries.map((entry) => options.transform(entry));
|
||||
}
|
||||
api(root, task, options) {
|
||||
if (task.dynamic) {
|
||||
return this._reader.dynamic(root, options);
|
||||
}
|
||||
return this._reader.static(task.patterns, options);
|
||||
}
|
||||
}
|
||||
exports.default = ProviderAsync;
|
||||
16
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/filters/deep.d.ts
generated
vendored
Normal file
16
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/filters/deep.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { MicromatchOptions, EntryFilterFunction, Pattern } from '../../types';
|
||||
import Settings from '../../settings';
|
||||
export default class DeepFilter {
|
||||
private readonly _settings;
|
||||
private readonly _micromatchOptions;
|
||||
constructor(_settings: Settings, _micromatchOptions: MicromatchOptions);
|
||||
getFilter(basePath: string, positive: Pattern[], negative: Pattern[]): EntryFilterFunction;
|
||||
private _getMatcher;
|
||||
private _getNegativePatternsRe;
|
||||
private _filter;
|
||||
private _isSkippedByDeep;
|
||||
private _getEntryLevel;
|
||||
private _isSkippedSymbolicLink;
|
||||
private _isSkippedByPositivePatterns;
|
||||
private _isSkippedByNegativePatterns;
|
||||
}
|
||||
62
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/filters/deep.js
generated
vendored
Normal file
62
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/filters/deep.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils = require("../../utils");
|
||||
const partial_1 = require("../matchers/partial");
|
||||
class DeepFilter {
|
||||
constructor(_settings, _micromatchOptions) {
|
||||
this._settings = _settings;
|
||||
this._micromatchOptions = _micromatchOptions;
|
||||
}
|
||||
getFilter(basePath, positive, negative) {
|
||||
const matcher = this._getMatcher(positive);
|
||||
const negativeRe = this._getNegativePatternsRe(negative);
|
||||
return (entry) => this._filter(basePath, entry, matcher, negativeRe);
|
||||
}
|
||||
_getMatcher(patterns) {
|
||||
return new partial_1.default(patterns, this._settings, this._micromatchOptions);
|
||||
}
|
||||
_getNegativePatternsRe(patterns) {
|
||||
const affectDepthOfReadingPatterns = patterns.filter(utils.pattern.isAffectDepthOfReadingPattern);
|
||||
return utils.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions);
|
||||
}
|
||||
_filter(basePath, entry, matcher, negativeRe) {
|
||||
if (this._isSkippedByDeep(basePath, entry.path)) {
|
||||
return false;
|
||||
}
|
||||
if (this._isSkippedSymbolicLink(entry)) {
|
||||
return false;
|
||||
}
|
||||
const filepath = utils.path.removeLeadingDotSegment(entry.path);
|
||||
if (this._isSkippedByPositivePatterns(filepath, matcher)) {
|
||||
return false;
|
||||
}
|
||||
return this._isSkippedByNegativePatterns(filepath, negativeRe);
|
||||
}
|
||||
_isSkippedByDeep(basePath, entryPath) {
|
||||
/**
|
||||
* Avoid unnecessary depth calculations when it doesn't matter.
|
||||
*/
|
||||
if (this._settings.deep === Infinity) {
|
||||
return false;
|
||||
}
|
||||
return this._getEntryLevel(basePath, entryPath) >= this._settings.deep;
|
||||
}
|
||||
_getEntryLevel(basePath, entryPath) {
|
||||
const entryPathDepth = entryPath.split('/').length;
|
||||
if (basePath === '') {
|
||||
return entryPathDepth;
|
||||
}
|
||||
const basePathDepth = basePath.split('/').length;
|
||||
return entryPathDepth - basePathDepth;
|
||||
}
|
||||
_isSkippedSymbolicLink(entry) {
|
||||
return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink();
|
||||
}
|
||||
_isSkippedByPositivePatterns(entryPath, matcher) {
|
||||
return !this._settings.baseNameMatch && !matcher.match(entryPath);
|
||||
}
|
||||
_isSkippedByNegativePatterns(entryPath, patternsRe) {
|
||||
return !utils.pattern.matchAny(entryPath, patternsRe);
|
||||
}
|
||||
}
|
||||
exports.default = DeepFilter;
|
||||
17
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/filters/entry.d.ts
generated
vendored
Normal file
17
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/filters/entry.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import Settings from '../../settings';
|
||||
import { EntryFilterFunction, MicromatchOptions, Pattern } from '../../types';
|
||||
export default class EntryFilter {
|
||||
private readonly _settings;
|
||||
private readonly _micromatchOptions;
|
||||
readonly index: Map<string, undefined>;
|
||||
constructor(_settings: Settings, _micromatchOptions: MicromatchOptions);
|
||||
getFilter(positive: Pattern[], negative: Pattern[]): EntryFilterFunction;
|
||||
private _filter;
|
||||
private _isDuplicateEntry;
|
||||
private _createIndexRecord;
|
||||
private _onlyFileFilter;
|
||||
private _onlyDirectoryFilter;
|
||||
private _isMatchToPatternsSet;
|
||||
private _isMatchToAbsoluteNegative;
|
||||
private _isMatchToPatterns;
|
||||
}
|
||||
85
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/filters/entry.js
generated
vendored
Normal file
85
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/filters/entry.js
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils = require("../../utils");
|
||||
class EntryFilter {
|
||||
constructor(_settings, _micromatchOptions) {
|
||||
this._settings = _settings;
|
||||
this._micromatchOptions = _micromatchOptions;
|
||||
this.index = new Map();
|
||||
}
|
||||
getFilter(positive, negative) {
|
||||
const [absoluteNegative, relativeNegative] = utils.pattern.partitionAbsoluteAndRelative(negative);
|
||||
const patterns = {
|
||||
positive: {
|
||||
all: utils.pattern.convertPatternsToRe(positive, this._micromatchOptions)
|
||||
},
|
||||
negative: {
|
||||
absolute: utils.pattern.convertPatternsToRe(absoluteNegative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true })),
|
||||
relative: utils.pattern.convertPatternsToRe(relativeNegative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true }))
|
||||
}
|
||||
};
|
||||
return (entry) => this._filter(entry, patterns);
|
||||
}
|
||||
_filter(entry, patterns) {
|
||||
const filepath = utils.path.removeLeadingDotSegment(entry.path);
|
||||
if (this._settings.unique && this._isDuplicateEntry(filepath)) {
|
||||
return false;
|
||||
}
|
||||
if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) {
|
||||
return false;
|
||||
}
|
||||
const isMatched = this._isMatchToPatternsSet(filepath, patterns, entry.dirent.isDirectory());
|
||||
if (this._settings.unique && isMatched) {
|
||||
this._createIndexRecord(filepath);
|
||||
}
|
||||
return isMatched;
|
||||
}
|
||||
_isDuplicateEntry(filepath) {
|
||||
return this.index.has(filepath);
|
||||
}
|
||||
_createIndexRecord(filepath) {
|
||||
this.index.set(filepath, undefined);
|
||||
}
|
||||
_onlyFileFilter(entry) {
|
||||
return this._settings.onlyFiles && !entry.dirent.isFile();
|
||||
}
|
||||
_onlyDirectoryFilter(entry) {
|
||||
return this._settings.onlyDirectories && !entry.dirent.isDirectory();
|
||||
}
|
||||
_isMatchToPatternsSet(filepath, patterns, isDirectory) {
|
||||
const isMatched = this._isMatchToPatterns(filepath, patterns.positive.all, isDirectory);
|
||||
if (!isMatched) {
|
||||
return false;
|
||||
}
|
||||
const isMatchedByRelativeNegative = this._isMatchToPatterns(filepath, patterns.negative.relative, isDirectory);
|
||||
if (isMatchedByRelativeNegative) {
|
||||
return false;
|
||||
}
|
||||
const isMatchedByAbsoluteNegative = this._isMatchToAbsoluteNegative(filepath, patterns.negative.absolute, isDirectory);
|
||||
if (isMatchedByAbsoluteNegative) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
_isMatchToAbsoluteNegative(filepath, patternsRe, isDirectory) {
|
||||
if (patternsRe.length === 0) {
|
||||
return false;
|
||||
}
|
||||
const fullpath = utils.path.makeAbsolute(this._settings.cwd, filepath);
|
||||
return this._isMatchToPatterns(fullpath, patternsRe, isDirectory);
|
||||
}
|
||||
_isMatchToPatterns(filepath, patternsRe, isDirectory) {
|
||||
if (patternsRe.length === 0) {
|
||||
return false;
|
||||
}
|
||||
// Trying to match files and directories by patterns.
|
||||
const isMatched = utils.pattern.matchAny(filepath, patternsRe);
|
||||
// A pattern with a trailling slash can be used for directory matching.
|
||||
// To apply such pattern, we need to add a tralling slash to the path.
|
||||
if (!isMatched && isDirectory) {
|
||||
return utils.pattern.matchAny(filepath + '/', patternsRe);
|
||||
}
|
||||
return isMatched;
|
||||
}
|
||||
}
|
||||
exports.default = EntryFilter;
|
||||
8
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/filters/error.d.ts
generated
vendored
Normal file
8
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/filters/error.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import Settings from '../../settings';
|
||||
import { ErrorFilterFunction } from '../../types';
|
||||
export default class ErrorFilter {
|
||||
private readonly _settings;
|
||||
constructor(_settings: Settings);
|
||||
getFilter(): ErrorFilterFunction;
|
||||
private _isNonFatalError;
|
||||
}
|
||||
15
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/filters/error.js
generated
vendored
Normal file
15
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/filters/error.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils = require("../../utils");
|
||||
class ErrorFilter {
|
||||
constructor(_settings) {
|
||||
this._settings = _settings;
|
||||
}
|
||||
getFilter() {
|
||||
return (error) => this._isNonFatalError(error);
|
||||
}
|
||||
_isNonFatalError(error) {
|
||||
return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
|
||||
}
|
||||
}
|
||||
exports.default = ErrorFilter;
|
||||
33
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/matchers/matcher.d.ts
generated
vendored
Normal file
33
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/matchers/matcher.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import { Pattern, MicromatchOptions, PatternRe } from '../../types';
|
||||
import Settings from '../../settings';
|
||||
export type PatternSegment = StaticPatternSegment | DynamicPatternSegment;
|
||||
type StaticPatternSegment = {
|
||||
dynamic: false;
|
||||
pattern: Pattern;
|
||||
};
|
||||
type DynamicPatternSegment = {
|
||||
dynamic: true;
|
||||
pattern: Pattern;
|
||||
patternRe: PatternRe;
|
||||
};
|
||||
export type PatternSection = PatternSegment[];
|
||||
export type PatternInfo = {
|
||||
/**
|
||||
* Indicates that the pattern has a globstar (more than a single section).
|
||||
*/
|
||||
complete: boolean;
|
||||
pattern: Pattern;
|
||||
segments: PatternSegment[];
|
||||
sections: PatternSection[];
|
||||
};
|
||||
export default abstract class Matcher {
|
||||
private readonly _patterns;
|
||||
private readonly _settings;
|
||||
private readonly _micromatchOptions;
|
||||
protected readonly _storage: PatternInfo[];
|
||||
constructor(_patterns: Pattern[], _settings: Settings, _micromatchOptions: MicromatchOptions);
|
||||
private _fillStorage;
|
||||
private _getPatternSegments;
|
||||
private _splitSegmentsIntoSections;
|
||||
}
|
||||
export {};
|
||||
45
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/matchers/matcher.js
generated
vendored
Normal file
45
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/matchers/matcher.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils = require("../../utils");
|
||||
class Matcher {
|
||||
constructor(_patterns, _settings, _micromatchOptions) {
|
||||
this._patterns = _patterns;
|
||||
this._settings = _settings;
|
||||
this._micromatchOptions = _micromatchOptions;
|
||||
this._storage = [];
|
||||
this._fillStorage();
|
||||
}
|
||||
_fillStorage() {
|
||||
for (const pattern of this._patterns) {
|
||||
const segments = this._getPatternSegments(pattern);
|
||||
const sections = this._splitSegmentsIntoSections(segments);
|
||||
this._storage.push({
|
||||
complete: sections.length <= 1,
|
||||
pattern,
|
||||
segments,
|
||||
sections
|
||||
});
|
||||
}
|
||||
}
|
||||
_getPatternSegments(pattern) {
|
||||
const parts = utils.pattern.getPatternParts(pattern, this._micromatchOptions);
|
||||
return parts.map((part) => {
|
||||
const dynamic = utils.pattern.isDynamicPattern(part, this._settings);
|
||||
if (!dynamic) {
|
||||
return {
|
||||
dynamic: false,
|
||||
pattern: part
|
||||
};
|
||||
}
|
||||
return {
|
||||
dynamic: true,
|
||||
pattern: part,
|
||||
patternRe: utils.pattern.makeRe(part, this._micromatchOptions)
|
||||
};
|
||||
});
|
||||
}
|
||||
_splitSegmentsIntoSections(segments) {
|
||||
return utils.array.splitWhen(segments, (segment) => segment.dynamic && utils.pattern.hasGlobStar(segment.pattern));
|
||||
}
|
||||
}
|
||||
exports.default = Matcher;
|
||||
4
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/matchers/partial.d.ts
generated
vendored
Normal file
4
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/matchers/partial.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import Matcher from './matcher';
|
||||
export default class PartialMatcher extends Matcher {
|
||||
match(filepath: string): boolean;
|
||||
}
|
||||
38
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/matchers/partial.js
generated
vendored
Normal file
38
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/matchers/partial.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const matcher_1 = require("./matcher");
|
||||
class PartialMatcher extends matcher_1.default {
|
||||
match(filepath) {
|
||||
const parts = filepath.split('/');
|
||||
const levels = parts.length;
|
||||
const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels);
|
||||
for (const pattern of patterns) {
|
||||
const section = pattern.sections[0];
|
||||
/**
|
||||
* In this case, the pattern has a globstar and we must read all directories unconditionally,
|
||||
* but only if the level has reached the end of the first group.
|
||||
*
|
||||
* fixtures/{a,b}/**
|
||||
* ^ true/false ^ always true
|
||||
*/
|
||||
if (!pattern.complete && levels > section.length) {
|
||||
return true;
|
||||
}
|
||||
const match = parts.every((part, index) => {
|
||||
const segment = pattern.segments[index];
|
||||
if (segment.dynamic && segment.patternRe.test(part)) {
|
||||
return true;
|
||||
}
|
||||
if (!segment.dynamic && segment.pattern === part) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if (match) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
exports.default = PartialMatcher;
|
||||
19
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/provider.d.ts
generated
vendored
Normal file
19
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/provider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Task } from '../managers/tasks';
|
||||
import Settings from '../settings';
|
||||
import { MicromatchOptions, ReaderOptions } from '../types';
|
||||
import DeepFilter from './filters/deep';
|
||||
import EntryFilter from './filters/entry';
|
||||
import ErrorFilter from './filters/error';
|
||||
import EntryTransformer from './transformers/entry';
|
||||
export default abstract class Provider<T> {
|
||||
protected readonly _settings: Settings;
|
||||
readonly errorFilter: ErrorFilter;
|
||||
readonly entryFilter: EntryFilter;
|
||||
readonly deepFilter: DeepFilter;
|
||||
readonly entryTransformer: EntryTransformer;
|
||||
constructor(_settings: Settings);
|
||||
abstract read(_task: Task): T;
|
||||
protected _getRootDirectory(task: Task): string;
|
||||
protected _getReaderOptions(task: Task): ReaderOptions;
|
||||
protected _getMicromatchOptions(): MicromatchOptions;
|
||||
}
|
||||
48
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/provider.js
generated
vendored
Normal file
48
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/provider.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path = require("path");
|
||||
const deep_1 = require("./filters/deep");
|
||||
const entry_1 = require("./filters/entry");
|
||||
const error_1 = require("./filters/error");
|
||||
const entry_2 = require("./transformers/entry");
|
||||
class Provider {
|
||||
constructor(_settings) {
|
||||
this._settings = _settings;
|
||||
this.errorFilter = new error_1.default(this._settings);
|
||||
this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions());
|
||||
this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions());
|
||||
this.entryTransformer = new entry_2.default(this._settings);
|
||||
}
|
||||
_getRootDirectory(task) {
|
||||
return path.resolve(this._settings.cwd, task.base);
|
||||
}
|
||||
_getReaderOptions(task) {
|
||||
const basePath = task.base === '.' ? '' : task.base;
|
||||
return {
|
||||
basePath,
|
||||
pathSegmentSeparator: '/',
|
||||
concurrency: this._settings.concurrency,
|
||||
deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative),
|
||||
entryFilter: this.entryFilter.getFilter(task.positive, task.negative),
|
||||
errorFilter: this.errorFilter.getFilter(),
|
||||
followSymbolicLinks: this._settings.followSymbolicLinks,
|
||||
fs: this._settings.fs,
|
||||
stats: this._settings.stats,
|
||||
throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink,
|
||||
transform: this.entryTransformer.getTransformer()
|
||||
};
|
||||
}
|
||||
_getMicromatchOptions() {
|
||||
return {
|
||||
dot: this._settings.dot,
|
||||
matchBase: this._settings.baseNameMatch,
|
||||
nobrace: !this._settings.braceExpansion,
|
||||
nocase: !this._settings.caseSensitiveMatch,
|
||||
noext: !this._settings.extglob,
|
||||
noglobstar: !this._settings.globstar,
|
||||
posix: true,
|
||||
strictSlashes: false
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.default = Provider;
|
||||
11
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/stream.d.ts
generated
vendored
Normal file
11
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/stream.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/// <reference types="node" />
|
||||
import { Readable } from 'stream';
|
||||
import { Task } from '../managers/tasks';
|
||||
import ReaderStream from '../readers/stream';
|
||||
import { ReaderOptions } from '../types';
|
||||
import Provider from './provider';
|
||||
export default class ProviderStream extends Provider<Readable> {
|
||||
protected _reader: ReaderStream;
|
||||
read(task: Task): Readable;
|
||||
api(root: string, task: Task, options: ReaderOptions): Readable;
|
||||
}
|
||||
31
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/stream.js
generated
vendored
Normal file
31
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/stream.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const stream_1 = require("stream");
|
||||
const stream_2 = require("../readers/stream");
|
||||
const provider_1 = require("./provider");
|
||||
class ProviderStream extends provider_1.default {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this._reader = new stream_2.default(this._settings);
|
||||
}
|
||||
read(task) {
|
||||
const root = this._getRootDirectory(task);
|
||||
const options = this._getReaderOptions(task);
|
||||
const source = this.api(root, task, options);
|
||||
const destination = new stream_1.Readable({ objectMode: true, read: () => { } });
|
||||
source
|
||||
.once('error', (error) => destination.emit('error', error))
|
||||
.on('data', (entry) => destination.emit('data', options.transform(entry)))
|
||||
.once('end', () => destination.emit('end'));
|
||||
destination
|
||||
.once('close', () => source.destroy());
|
||||
return destination;
|
||||
}
|
||||
api(root, task, options) {
|
||||
if (task.dynamic) {
|
||||
return this._reader.dynamic(root, options);
|
||||
}
|
||||
return this._reader.static(task.patterns, options);
|
||||
}
|
||||
}
|
||||
exports.default = ProviderStream;
|
||||
9
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/sync.d.ts
generated
vendored
Normal file
9
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/sync.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Task } from '../managers/tasks';
|
||||
import ReaderSync from '../readers/sync';
|
||||
import { Entry, EntryItem, ReaderOptions } from '../types';
|
||||
import Provider from './provider';
|
||||
export default class ProviderSync extends Provider<EntryItem[]> {
|
||||
protected _reader: ReaderSync;
|
||||
read(task: Task): EntryItem[];
|
||||
api(root: string, task: Task, options: ReaderOptions): Entry[];
|
||||
}
|
||||
23
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/sync.js
generated
vendored
Normal file
23
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/sync.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const sync_1 = require("../readers/sync");
|
||||
const provider_1 = require("./provider");
|
||||
class ProviderSync extends provider_1.default {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this._reader = new sync_1.default(this._settings);
|
||||
}
|
||||
read(task) {
|
||||
const root = this._getRootDirectory(task);
|
||||
const options = this._getReaderOptions(task);
|
||||
const entries = this.api(root, task, options);
|
||||
return entries.map(options.transform);
|
||||
}
|
||||
api(root, task, options) {
|
||||
if (task.dynamic) {
|
||||
return this._reader.dynamic(root, options);
|
||||
}
|
||||
return this._reader.static(task.patterns, options);
|
||||
}
|
||||
}
|
||||
exports.default = ProviderSync;
|
||||
8
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/transformers/entry.d.ts
generated
vendored
Normal file
8
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/transformers/entry.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import Settings from '../../settings';
|
||||
import { EntryTransformerFunction } from '../../types';
|
||||
export default class EntryTransformer {
|
||||
private readonly _settings;
|
||||
constructor(_settings: Settings);
|
||||
getTransformer(): EntryTransformerFunction;
|
||||
private _transform;
|
||||
}
|
||||
26
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/transformers/entry.js
generated
vendored
Normal file
26
node_modules/@ts-morph/common/node_modules/fast-glob/out/providers/transformers/entry.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils = require("../../utils");
|
||||
class EntryTransformer {
|
||||
constructor(_settings) {
|
||||
this._settings = _settings;
|
||||
}
|
||||
getTransformer() {
|
||||
return (entry) => this._transform(entry);
|
||||
}
|
||||
_transform(entry) {
|
||||
let filepath = entry.path;
|
||||
if (this._settings.absolute) {
|
||||
filepath = utils.path.makeAbsolute(this._settings.cwd, filepath);
|
||||
filepath = utils.path.unixify(filepath);
|
||||
}
|
||||
if (this._settings.markDirectories && entry.dirent.isDirectory()) {
|
||||
filepath += '/';
|
||||
}
|
||||
if (!this._settings.objectMode) {
|
||||
return filepath;
|
||||
}
|
||||
return Object.assign(Object.assign({}, entry), { path: filepath });
|
||||
}
|
||||
}
|
||||
exports.default = EntryTransformer;
|
||||
10
node_modules/@ts-morph/common/node_modules/fast-glob/out/readers/async.d.ts
generated
vendored
Normal file
10
node_modules/@ts-morph/common/node_modules/fast-glob/out/readers/async.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import * as fsWalk from '@nodelib/fs.walk';
|
||||
import { Entry, ReaderOptions, Pattern } from '../types';
|
||||
import Reader from './reader';
|
||||
import ReaderStream from './stream';
|
||||
export default class ReaderAsync extends Reader<Promise<Entry[]>> {
|
||||
protected _walkAsync: typeof fsWalk.walk;
|
||||
protected _readerStream: ReaderStream;
|
||||
dynamic(root: string, options: ReaderOptions): Promise<Entry[]>;
|
||||
static(patterns: Pattern[], options: ReaderOptions): Promise<Entry[]>;
|
||||
}
|
||||
35
node_modules/@ts-morph/common/node_modules/fast-glob/out/readers/async.js
generated
vendored
Normal file
35
node_modules/@ts-morph/common/node_modules/fast-glob/out/readers/async.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fsWalk = require("@nodelib/fs.walk");
|
||||
const reader_1 = require("./reader");
|
||||
const stream_1 = require("./stream");
|
||||
class ReaderAsync extends reader_1.default {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this._walkAsync = fsWalk.walk;
|
||||
this._readerStream = new stream_1.default(this._settings);
|
||||
}
|
||||
dynamic(root, options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this._walkAsync(root, options, (error, entries) => {
|
||||
if (error === null) {
|
||||
resolve(entries);
|
||||
}
|
||||
else {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
async static(patterns, options) {
|
||||
const entries = [];
|
||||
const stream = this._readerStream.static(patterns, options);
|
||||
// After #235, replace it with an asynchronous iterator.
|
||||
return new Promise((resolve, reject) => {
|
||||
stream.once('error', reject);
|
||||
stream.on('data', (entry) => entries.push(entry));
|
||||
stream.once('end', () => resolve(entries));
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.default = ReaderAsync;
|
||||
15
node_modules/@ts-morph/common/node_modules/fast-glob/out/readers/reader.d.ts
generated
vendored
Normal file
15
node_modules/@ts-morph/common/node_modules/fast-glob/out/readers/reader.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/// <reference types="node" />
|
||||
import * as fs from 'fs';
|
||||
import * as fsStat from '@nodelib/fs.stat';
|
||||
import Settings from '../settings';
|
||||
import { Entry, ErrnoException, Pattern, ReaderOptions } from '../types';
|
||||
export default abstract class Reader<T> {
|
||||
protected readonly _settings: Settings;
|
||||
protected readonly _fsStatSettings: fsStat.Settings;
|
||||
constructor(_settings: Settings);
|
||||
abstract dynamic(root: string, options: ReaderOptions): T;
|
||||
abstract static(patterns: Pattern[], options: ReaderOptions): T;
|
||||
protected _getFullEntryPath(filepath: string): string;
|
||||
protected _makeEntry(stats: fs.Stats, pattern: Pattern): Entry;
|
||||
protected _isFatalError(error: ErrnoException): boolean;
|
||||
}
|
||||
33
node_modules/@ts-morph/common/node_modules/fast-glob/out/readers/reader.js
generated
vendored
Normal file
33
node_modules/@ts-morph/common/node_modules/fast-glob/out/readers/reader.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path = require("path");
|
||||
const fsStat = require("@nodelib/fs.stat");
|
||||
const utils = require("../utils");
|
||||
class Reader {
|
||||
constructor(_settings) {
|
||||
this._settings = _settings;
|
||||
this._fsStatSettings = new fsStat.Settings({
|
||||
followSymbolicLink: this._settings.followSymbolicLinks,
|
||||
fs: this._settings.fs,
|
||||
throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks
|
||||
});
|
||||
}
|
||||
_getFullEntryPath(filepath) {
|
||||
return path.resolve(this._settings.cwd, filepath);
|
||||
}
|
||||
_makeEntry(stats, pattern) {
|
||||
const entry = {
|
||||
name: pattern,
|
||||
path: pattern,
|
||||
dirent: utils.fs.createDirentFromStats(pattern, stats)
|
||||
};
|
||||
if (this._settings.stats) {
|
||||
entry.stats = stats;
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
_isFatalError(error) {
|
||||
return !utils.errno.isEnoentCodeError(error) && !this._settings.suppressErrors;
|
||||
}
|
||||
}
|
||||
exports.default = Reader;
|
||||
14
node_modules/@ts-morph/common/node_modules/fast-glob/out/readers/stream.d.ts
generated
vendored
Normal file
14
node_modules/@ts-morph/common/node_modules/fast-glob/out/readers/stream.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/// <reference types="node" />
|
||||
import { Readable } from 'stream';
|
||||
import * as fsStat from '@nodelib/fs.stat';
|
||||
import * as fsWalk from '@nodelib/fs.walk';
|
||||
import { Pattern, ReaderOptions } from '../types';
|
||||
import Reader from './reader';
|
||||
export default class ReaderStream extends Reader<Readable> {
|
||||
protected _walkStream: typeof fsWalk.walkStream;
|
||||
protected _stat: typeof fsStat.stat;
|
||||
dynamic(root: string, options: ReaderOptions): Readable;
|
||||
static(patterns: Pattern[], options: ReaderOptions): Readable;
|
||||
private _getEntry;
|
||||
private _getStat;
|
||||
}
|
||||
55
node_modules/@ts-morph/common/node_modules/fast-glob/out/readers/stream.js
generated
vendored
Normal file
55
node_modules/@ts-morph/common/node_modules/fast-glob/out/readers/stream.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const stream_1 = require("stream");
|
||||
const fsStat = require("@nodelib/fs.stat");
|
||||
const fsWalk = require("@nodelib/fs.walk");
|
||||
const reader_1 = require("./reader");
|
||||
class ReaderStream extends reader_1.default {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this._walkStream = fsWalk.walkStream;
|
||||
this._stat = fsStat.stat;
|
||||
}
|
||||
dynamic(root, options) {
|
||||
return this._walkStream(root, options);
|
||||
}
|
||||
static(patterns, options) {
|
||||
const filepaths = patterns.map(this._getFullEntryPath, this);
|
||||
const stream = new stream_1.PassThrough({ objectMode: true });
|
||||
stream._write = (index, _enc, done) => {
|
||||
return this._getEntry(filepaths[index], patterns[index], options)
|
||||
.then((entry) => {
|
||||
if (entry !== null && options.entryFilter(entry)) {
|
||||
stream.push(entry);
|
||||
}
|
||||
if (index === filepaths.length - 1) {
|
||||
stream.end();
|
||||
}
|
||||
done();
|
||||
})
|
||||
.catch(done);
|
||||
};
|
||||
for (let i = 0; i < filepaths.length; i++) {
|
||||
stream.write(i);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
_getEntry(filepath, pattern, options) {
|
||||
return this._getStat(filepath)
|
||||
.then((stats) => this._makeEntry(stats, pattern))
|
||||
.catch((error) => {
|
||||
if (options.errorFilter(error)) {
|
||||
return null;
|
||||
}
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
_getStat(filepath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this._stat(filepath, this._fsStatSettings, (error, stats) => {
|
||||
return error === null ? resolve(stats) : reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.default = ReaderStream;
|
||||
12
node_modules/@ts-morph/common/node_modules/fast-glob/out/readers/sync.d.ts
generated
vendored
Normal file
12
node_modules/@ts-morph/common/node_modules/fast-glob/out/readers/sync.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import * as fsStat from '@nodelib/fs.stat';
|
||||
import * as fsWalk from '@nodelib/fs.walk';
|
||||
import { Entry, Pattern, ReaderOptions } from '../types';
|
||||
import Reader from './reader';
|
||||
export default class ReaderSync extends Reader<Entry[]> {
|
||||
protected _walkSync: typeof fsWalk.walkSync;
|
||||
protected _statSync: typeof fsStat.statSync;
|
||||
dynamic(root: string, options: ReaderOptions): Entry[];
|
||||
static(patterns: Pattern[], options: ReaderOptions): Entry[];
|
||||
private _getEntry;
|
||||
private _getStat;
|
||||
}
|
||||
43
node_modules/@ts-morph/common/node_modules/fast-glob/out/readers/sync.js
generated
vendored
Normal file
43
node_modules/@ts-morph/common/node_modules/fast-glob/out/readers/sync.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fsStat = require("@nodelib/fs.stat");
|
||||
const fsWalk = require("@nodelib/fs.walk");
|
||||
const reader_1 = require("./reader");
|
||||
class ReaderSync extends reader_1.default {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this._walkSync = fsWalk.walkSync;
|
||||
this._statSync = fsStat.statSync;
|
||||
}
|
||||
dynamic(root, options) {
|
||||
return this._walkSync(root, options);
|
||||
}
|
||||
static(patterns, options) {
|
||||
const entries = [];
|
||||
for (const pattern of patterns) {
|
||||
const filepath = this._getFullEntryPath(pattern);
|
||||
const entry = this._getEntry(filepath, pattern, options);
|
||||
if (entry === null || !options.entryFilter(entry)) {
|
||||
continue;
|
||||
}
|
||||
entries.push(entry);
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
_getEntry(filepath, pattern, options) {
|
||||
try {
|
||||
const stats = this._getStat(filepath);
|
||||
return this._makeEntry(stats, pattern);
|
||||
}
|
||||
catch (error) {
|
||||
if (options.errorFilter(error)) {
|
||||
return null;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
_getStat(filepath) {
|
||||
return this._statSync(filepath, this._fsStatSettings);
|
||||
}
|
||||
}
|
||||
exports.default = ReaderSync;
|
||||
164
node_modules/@ts-morph/common/node_modules/fast-glob/out/settings.d.ts
generated
vendored
Normal file
164
node_modules/@ts-morph/common/node_modules/fast-glob/out/settings.d.ts
generated
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
import { FileSystemAdapter, Pattern } from './types';
|
||||
export declare const DEFAULT_FILE_SYSTEM_ADAPTER: FileSystemAdapter;
|
||||
export type Options = {
|
||||
/**
|
||||
* Return the absolute path for entries.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
absolute?: boolean;
|
||||
/**
|
||||
* If set to `true`, then patterns without slashes will be matched against
|
||||
* the basename of the path if it contains slashes.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
baseNameMatch?: boolean;
|
||||
/**
|
||||
* Enables Bash-like brace expansion.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
braceExpansion?: boolean;
|
||||
/**
|
||||
* Enables a case-sensitive mode for matching files.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
caseSensitiveMatch?: boolean;
|
||||
/**
|
||||
* Specifies the maximum number of concurrent requests from a reader to read
|
||||
* directories.
|
||||
*
|
||||
* @default os.cpus().length
|
||||
*/
|
||||
concurrency?: number;
|
||||
/**
|
||||
* The current working directory in which to search.
|
||||
*
|
||||
* @default process.cwd()
|
||||
*/
|
||||
cwd?: string;
|
||||
/**
|
||||
* Specifies the maximum depth of a read directory relative to the start
|
||||
* directory.
|
||||
*
|
||||
* @default Infinity
|
||||
*/
|
||||
deep?: number;
|
||||
/**
|
||||
* Allow patterns to match entries that begin with a period (`.`).
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
dot?: boolean;
|
||||
/**
|
||||
* Enables Bash-like `extglob` functionality.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
extglob?: boolean;
|
||||
/**
|
||||
* Indicates whether to traverse descendants of symbolic link directories.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
followSymbolicLinks?: boolean;
|
||||
/**
|
||||
* Custom implementation of methods for working with the file system.
|
||||
*
|
||||
* @default fs.*
|
||||
*/
|
||||
fs?: Partial<FileSystemAdapter>;
|
||||
/**
|
||||
* Enables recursively repeats a pattern containing `**`.
|
||||
* If `false`, `**` behaves exactly like `*`.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
globstar?: boolean;
|
||||
/**
|
||||
* An array of glob patterns to exclude matches.
|
||||
* This is an alternative way to use negative patterns.
|
||||
*
|
||||
* @default []
|
||||
*/
|
||||
ignore?: Pattern[];
|
||||
/**
|
||||
* Mark the directory path with the final slash.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
markDirectories?: boolean;
|
||||
/**
|
||||
* Returns objects (instead of strings) describing entries.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
objectMode?: boolean;
|
||||
/**
|
||||
* Return only directories.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
onlyDirectories?: boolean;
|
||||
/**
|
||||
* Return only files.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
onlyFiles?: boolean;
|
||||
/**
|
||||
* Enables an object mode (`objectMode`) with an additional `stats` field.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
stats?: boolean;
|
||||
/**
|
||||
* By default this package suppress only `ENOENT` errors.
|
||||
* Set to `true` to suppress any error.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
suppressErrors?: boolean;
|
||||
/**
|
||||
* Throw an error when symbolic link is broken if `true` or safely
|
||||
* return `lstat` call if `false`.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
throwErrorOnBrokenSymbolicLink?: boolean;
|
||||
/**
|
||||
* Ensures that the returned entries are unique.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
unique?: boolean;
|
||||
};
|
||||
export default class Settings {
|
||||
private readonly _options;
|
||||
readonly absolute: boolean;
|
||||
readonly baseNameMatch: boolean;
|
||||
readonly braceExpansion: boolean;
|
||||
readonly caseSensitiveMatch: boolean;
|
||||
readonly concurrency: number;
|
||||
readonly cwd: string;
|
||||
readonly deep: number;
|
||||
readonly dot: boolean;
|
||||
readonly extglob: boolean;
|
||||
readonly followSymbolicLinks: boolean;
|
||||
readonly fs: FileSystemAdapter;
|
||||
readonly globstar: boolean;
|
||||
readonly ignore: Pattern[];
|
||||
readonly markDirectories: boolean;
|
||||
readonly objectMode: boolean;
|
||||
readonly onlyDirectories: boolean;
|
||||
readonly onlyFiles: boolean;
|
||||
readonly stats: boolean;
|
||||
readonly suppressErrors: boolean;
|
||||
readonly throwErrorOnBrokenSymbolicLink: boolean;
|
||||
readonly unique: boolean;
|
||||
constructor(_options?: Options);
|
||||
private _getValue;
|
||||
private _getFileSystemMethods;
|
||||
}
|
||||
59
node_modules/@ts-morph/common/node_modules/fast-glob/out/settings.js
generated
vendored
Normal file
59
node_modules/@ts-morph/common/node_modules/fast-glob/out/settings.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
||||
const fs = require("fs");
|
||||
const os = require("os");
|
||||
/**
|
||||
* The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
|
||||
* https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
|
||||
*/
|
||||
const CPU_COUNT = Math.max(os.cpus().length, 1);
|
||||
exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
||||
lstat: fs.lstat,
|
||||
lstatSync: fs.lstatSync,
|
||||
stat: fs.stat,
|
||||
statSync: fs.statSync,
|
||||
readdir: fs.readdir,
|
||||
readdirSync: fs.readdirSync
|
||||
};
|
||||
class Settings {
|
||||
constructor(_options = {}) {
|
||||
this._options = _options;
|
||||
this.absolute = this._getValue(this._options.absolute, false);
|
||||
this.baseNameMatch = this._getValue(this._options.baseNameMatch, false);
|
||||
this.braceExpansion = this._getValue(this._options.braceExpansion, true);
|
||||
this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true);
|
||||
this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT);
|
||||
this.cwd = this._getValue(this._options.cwd, process.cwd());
|
||||
this.deep = this._getValue(this._options.deep, Infinity);
|
||||
this.dot = this._getValue(this._options.dot, false);
|
||||
this.extglob = this._getValue(this._options.extglob, true);
|
||||
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true);
|
||||
this.fs = this._getFileSystemMethods(this._options.fs);
|
||||
this.globstar = this._getValue(this._options.globstar, true);
|
||||
this.ignore = this._getValue(this._options.ignore, []);
|
||||
this.markDirectories = this._getValue(this._options.markDirectories, false);
|
||||
this.objectMode = this._getValue(this._options.objectMode, false);
|
||||
this.onlyDirectories = this._getValue(this._options.onlyDirectories, false);
|
||||
this.onlyFiles = this._getValue(this._options.onlyFiles, true);
|
||||
this.stats = this._getValue(this._options.stats, false);
|
||||
this.suppressErrors = this._getValue(this._options.suppressErrors, false);
|
||||
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false);
|
||||
this.unique = this._getValue(this._options.unique, true);
|
||||
if (this.onlyDirectories) {
|
||||
this.onlyFiles = false;
|
||||
}
|
||||
if (this.stats) {
|
||||
this.objectMode = true;
|
||||
}
|
||||
// Remove the cast to the array in the next major (#404).
|
||||
this.ignore = [].concat(this.ignore);
|
||||
}
|
||||
_getValue(option, value) {
|
||||
return option === undefined ? value : option;
|
||||
}
|
||||
_getFileSystemMethods(methods = {}) {
|
||||
return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
|
||||
}
|
||||
}
|
||||
exports.default = Settings;
|
||||
31
node_modules/@ts-morph/common/node_modules/fast-glob/out/types/index.d.ts
generated
vendored
Normal file
31
node_modules/@ts-morph/common/node_modules/fast-glob/out/types/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/// <reference types="node" />
|
||||
import * as fsWalk from '@nodelib/fs.walk';
|
||||
export type ErrnoException = NodeJS.ErrnoException;
|
||||
export type Entry = fsWalk.Entry;
|
||||
export type EntryItem = string | Entry;
|
||||
export type Pattern = string;
|
||||
export type PatternRe = RegExp;
|
||||
export type PatternsGroup = Record<string, Pattern[]>;
|
||||
export type ReaderOptions = fsWalk.Options & {
|
||||
transform(entry: Entry): EntryItem;
|
||||
deepFilter: DeepFilterFunction;
|
||||
entryFilter: EntryFilterFunction;
|
||||
errorFilter: ErrorFilterFunction;
|
||||
fs: FileSystemAdapter;
|
||||
stats: boolean;
|
||||
};
|
||||
export type ErrorFilterFunction = fsWalk.ErrorFilterFunction;
|
||||
export type EntryFilterFunction = fsWalk.EntryFilterFunction;
|
||||
export type DeepFilterFunction = fsWalk.DeepFilterFunction;
|
||||
export type EntryTransformerFunction = (entry: Entry) => EntryItem;
|
||||
export type MicromatchOptions = {
|
||||
dot?: boolean;
|
||||
matchBase?: boolean;
|
||||
nobrace?: boolean;
|
||||
nocase?: boolean;
|
||||
noext?: boolean;
|
||||
noglobstar?: boolean;
|
||||
posix?: boolean;
|
||||
strictSlashes?: boolean;
|
||||
};
|
||||
export type FileSystemAdapter = fsWalk.FileSystemAdapter;
|
||||
2
node_modules/@ts-morph/common/node_modules/fast-glob/out/types/index.js
generated
vendored
Normal file
2
node_modules/@ts-morph/common/node_modules/fast-glob/out/types/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
2
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/array.d.ts
generated
vendored
Normal file
2
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/array.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare function flatten<T>(items: T[][]): T[];
|
||||
export declare function splitWhen<T>(items: T[], predicate: (item: T) => boolean): T[][];
|
||||
22
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/array.js
generated
vendored
Normal file
22
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/array.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.splitWhen = exports.flatten = void 0;
|
||||
function flatten(items) {
|
||||
return items.reduce((collection, item) => [].concat(collection, item), []);
|
||||
}
|
||||
exports.flatten = flatten;
|
||||
function splitWhen(items, predicate) {
|
||||
const result = [[]];
|
||||
let groupIndex = 0;
|
||||
for (const item of items) {
|
||||
if (predicate(item)) {
|
||||
groupIndex++;
|
||||
result[groupIndex] = [];
|
||||
}
|
||||
else {
|
||||
result[groupIndex].push(item);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
exports.splitWhen = splitWhen;
|
||||
2
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/errno.d.ts
generated
vendored
Normal file
2
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/errno.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { ErrnoException } from '../types';
|
||||
export declare function isEnoentCodeError(error: ErrnoException): boolean;
|
||||
7
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/errno.js
generated
vendored
Normal file
7
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/errno.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isEnoentCodeError = void 0;
|
||||
function isEnoentCodeError(error) {
|
||||
return error.code === 'ENOENT';
|
||||
}
|
||||
exports.isEnoentCodeError = isEnoentCodeError;
|
||||
4
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/fs.d.ts
generated
vendored
Normal file
4
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/fs.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/// <reference types="node" />
|
||||
import * as fs from 'fs';
|
||||
import { Dirent } from '@nodelib/fs.walk';
|
||||
export declare function createDirentFromStats(name: string, stats: fs.Stats): Dirent;
|
||||
19
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/fs.js
generated
vendored
Normal file
19
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/fs.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createDirentFromStats = void 0;
|
||||
class DirentFromStats {
|
||||
constructor(name, stats) {
|
||||
this.name = name;
|
||||
this.isBlockDevice = stats.isBlockDevice.bind(stats);
|
||||
this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
|
||||
this.isDirectory = stats.isDirectory.bind(stats);
|
||||
this.isFIFO = stats.isFIFO.bind(stats);
|
||||
this.isFile = stats.isFile.bind(stats);
|
||||
this.isSocket = stats.isSocket.bind(stats);
|
||||
this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
|
||||
}
|
||||
}
|
||||
function createDirentFromStats(name, stats) {
|
||||
return new DirentFromStats(name, stats);
|
||||
}
|
||||
exports.createDirentFromStats = createDirentFromStats;
|
||||
8
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/index.d.ts
generated
vendored
Normal file
8
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import * as array from './array';
|
||||
import * as errno from './errno';
|
||||
import * as fs from './fs';
|
||||
import * as path from './path';
|
||||
import * as pattern from './pattern';
|
||||
import * as stream from './stream';
|
||||
import * as string from './string';
|
||||
export { array, errno, fs, path, pattern, stream, string };
|
||||
17
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/index.js
generated
vendored
Normal file
17
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/index.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.string = exports.stream = exports.pattern = exports.path = exports.fs = exports.errno = exports.array = void 0;
|
||||
const array = require("./array");
|
||||
exports.array = array;
|
||||
const errno = require("./errno");
|
||||
exports.errno = errno;
|
||||
const fs = require("./fs");
|
||||
exports.fs = fs;
|
||||
const path = require("./path");
|
||||
exports.path = path;
|
||||
const pattern = require("./pattern");
|
||||
exports.pattern = pattern;
|
||||
const stream = require("./stream");
|
||||
exports.stream = stream;
|
||||
const string = require("./string");
|
||||
exports.string = string;
|
||||
13
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/path.d.ts
generated
vendored
Normal file
13
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/path.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Pattern } from '../types';
|
||||
/**
|
||||
* Designed to work only with simple paths: `dir\\file`.
|
||||
*/
|
||||
export declare function unixify(filepath: string): string;
|
||||
export declare function makeAbsolute(cwd: string, filepath: string): string;
|
||||
export declare function removeLeadingDotSegment(entry: string): string;
|
||||
export declare const escape: typeof escapeWindowsPath;
|
||||
export declare function escapeWindowsPath(pattern: Pattern): Pattern;
|
||||
export declare function escapePosixPath(pattern: Pattern): Pattern;
|
||||
export declare const convertPathToPattern: typeof convertWindowsPathToPattern;
|
||||
export declare function convertWindowsPathToPattern(filepath: string): Pattern;
|
||||
export declare function convertPosixPathToPattern(filepath: string): Pattern;
|
||||
68
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/path.js
generated
vendored
Normal file
68
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/path.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0;
|
||||
const os = require("os");
|
||||
const path = require("path");
|
||||
const IS_WINDOWS_PLATFORM = os.platform() === 'win32';
|
||||
const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
|
||||
/**
|
||||
* All non-escaped special characters.
|
||||
* Posix: ()*?[]{|}, !+@ before (, ! at the beginning, \\ before non-special characters.
|
||||
* Windows: (){}[], !+@ before (, ! at the beginning.
|
||||
*/
|
||||
const POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
|
||||
const WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g;
|
||||
/**
|
||||
* The device path (\\.\ or \\?\).
|
||||
* https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats#dos-device-paths
|
||||
*/
|
||||
const DOS_DEVICE_PATH_RE = /^\\\\([.?])/;
|
||||
/**
|
||||
* All backslashes except those escaping special characters.
|
||||
* Windows: !()+@{}
|
||||
* https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
|
||||
*/
|
||||
const WINDOWS_BACKSLASHES_RE = /\\(?![!()+@[\]{}])/g;
|
||||
/**
|
||||
* Designed to work only with simple paths: `dir\\file`.
|
||||
*/
|
||||
function unixify(filepath) {
|
||||
return filepath.replace(/\\/g, '/');
|
||||
}
|
||||
exports.unixify = unixify;
|
||||
function makeAbsolute(cwd, filepath) {
|
||||
return path.resolve(cwd, filepath);
|
||||
}
|
||||
exports.makeAbsolute = makeAbsolute;
|
||||
function removeLeadingDotSegment(entry) {
|
||||
// We do not use `startsWith` because this is 10x slower than current implementation for some cases.
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
|
||||
if (entry.charAt(0) === '.') {
|
||||
const secondCharactery = entry.charAt(1);
|
||||
if (secondCharactery === '/' || secondCharactery === '\\') {
|
||||
return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
|
||||
}
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
exports.removeLeadingDotSegment = removeLeadingDotSegment;
|
||||
exports.escape = IS_WINDOWS_PLATFORM ? escapeWindowsPath : escapePosixPath;
|
||||
function escapeWindowsPath(pattern) {
|
||||
return pattern.replace(WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
|
||||
}
|
||||
exports.escapeWindowsPath = escapeWindowsPath;
|
||||
function escapePosixPath(pattern) {
|
||||
return pattern.replace(POSIX_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
|
||||
}
|
||||
exports.escapePosixPath = escapePosixPath;
|
||||
exports.convertPathToPattern = IS_WINDOWS_PLATFORM ? convertWindowsPathToPattern : convertPosixPathToPattern;
|
||||
function convertWindowsPathToPattern(filepath) {
|
||||
return escapeWindowsPath(filepath)
|
||||
.replace(DOS_DEVICE_PATH_RE, '//$1')
|
||||
.replace(WINDOWS_BACKSLASHES_RE, '/');
|
||||
}
|
||||
exports.convertWindowsPathToPattern = convertWindowsPathToPattern;
|
||||
function convertPosixPathToPattern(filepath) {
|
||||
return escapePosixPath(filepath);
|
||||
}
|
||||
exports.convertPosixPathToPattern = convertPosixPathToPattern;
|
||||
49
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/pattern.d.ts
generated
vendored
Normal file
49
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/pattern.d.ts
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
import { MicromatchOptions, Pattern, PatternRe } from '../types';
|
||||
type PatternTypeOptions = {
|
||||
braceExpansion?: boolean;
|
||||
caseSensitiveMatch?: boolean;
|
||||
extglob?: boolean;
|
||||
};
|
||||
export declare function isStaticPattern(pattern: Pattern, options?: PatternTypeOptions): boolean;
|
||||
export declare function isDynamicPattern(pattern: Pattern, options?: PatternTypeOptions): boolean;
|
||||
export declare function convertToPositivePattern(pattern: Pattern): Pattern;
|
||||
export declare function convertToNegativePattern(pattern: Pattern): Pattern;
|
||||
export declare function isNegativePattern(pattern: Pattern): boolean;
|
||||
export declare function isPositivePattern(pattern: Pattern): boolean;
|
||||
export declare function getNegativePatterns(patterns: Pattern[]): Pattern[];
|
||||
export declare function getPositivePatterns(patterns: Pattern[]): Pattern[];
|
||||
/**
|
||||
* Returns patterns that can be applied inside the current directory.
|
||||
*
|
||||
* @example
|
||||
* // ['./*', '*', 'a/*']
|
||||
* getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
|
||||
*/
|
||||
export declare function getPatternsInsideCurrentDirectory(patterns: Pattern[]): Pattern[];
|
||||
/**
|
||||
* Returns patterns to be expanded relative to (outside) the current directory.
|
||||
*
|
||||
* @example
|
||||
* // ['../*', './../*']
|
||||
* getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
|
||||
*/
|
||||
export declare function getPatternsOutsideCurrentDirectory(patterns: Pattern[]): Pattern[];
|
||||
export declare function isPatternRelatedToParentDirectory(pattern: Pattern): boolean;
|
||||
export declare function getBaseDirectory(pattern: Pattern): string;
|
||||
export declare function hasGlobStar(pattern: Pattern): boolean;
|
||||
export declare function endsWithSlashGlobStar(pattern: Pattern): boolean;
|
||||
export declare function isAffectDepthOfReadingPattern(pattern: Pattern): boolean;
|
||||
export declare function expandPatternsWithBraceExpansion(patterns: Pattern[]): Pattern[];
|
||||
export declare function expandBraceExpansion(pattern: Pattern): Pattern[];
|
||||
export declare function getPatternParts(pattern: Pattern, options: MicromatchOptions): Pattern[];
|
||||
export declare function makeRe(pattern: Pattern, options: MicromatchOptions): PatternRe;
|
||||
export declare function convertPatternsToRe(patterns: Pattern[], options: MicromatchOptions): PatternRe[];
|
||||
export declare function matchAny(entry: string, patternsRe: PatternRe[]): boolean;
|
||||
/**
|
||||
* This package only works with forward slashes as a path separator.
|
||||
* Because of this, we cannot use the standard `path.normalize` method, because on Windows platform it will use of backslashes.
|
||||
*/
|
||||
export declare function removeDuplicateSlashes(pattern: string): string;
|
||||
export declare function partitionAbsoluteAndRelative(patterns: Pattern[]): Pattern[][];
|
||||
export declare function isAbsolute(pattern: string): boolean;
|
||||
export {};
|
||||
206
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/pattern.js
generated
vendored
Normal file
206
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/pattern.js
generated
vendored
Normal file
@@ -0,0 +1,206 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isAbsolute = exports.partitionAbsoluteAndRelative = exports.removeDuplicateSlashes = exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0;
|
||||
const path = require("path");
|
||||
const globParent = require("glob-parent");
|
||||
const micromatch = require("micromatch");
|
||||
const GLOBSTAR = '**';
|
||||
const ESCAPE_SYMBOL = '\\';
|
||||
const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
|
||||
const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/;
|
||||
const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/;
|
||||
const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/;
|
||||
const BRACE_EXPANSION_SEPARATORS_RE = /,|\.\./;
|
||||
/**
|
||||
* Matches a sequence of two or more consecutive slashes, excluding the first two slashes at the beginning of the string.
|
||||
* The latter is due to the presence of the device path at the beginning of the UNC path.
|
||||
*/
|
||||
const DOUBLE_SLASH_RE = /(?!^)\/{2,}/g;
|
||||
function isStaticPattern(pattern, options = {}) {
|
||||
return !isDynamicPattern(pattern, options);
|
||||
}
|
||||
exports.isStaticPattern = isStaticPattern;
|
||||
function isDynamicPattern(pattern, options = {}) {
|
||||
/**
|
||||
* A special case with an empty string is necessary for matching patterns that start with a forward slash.
|
||||
* An empty string cannot be a dynamic pattern.
|
||||
* For example, the pattern `/lib/*` will be spread into parts: '', 'lib', '*'.
|
||||
*/
|
||||
if (pattern === '') {
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check
|
||||
* filepath directly (without read directory).
|
||||
*/
|
||||
if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) {
|
||||
return true;
|
||||
}
|
||||
if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) {
|
||||
return true;
|
||||
}
|
||||
if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) {
|
||||
return true;
|
||||
}
|
||||
if (options.braceExpansion !== false && hasBraceExpansion(pattern)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
exports.isDynamicPattern = isDynamicPattern;
|
||||
function hasBraceExpansion(pattern) {
|
||||
const openingBraceIndex = pattern.indexOf('{');
|
||||
if (openingBraceIndex === -1) {
|
||||
return false;
|
||||
}
|
||||
const closingBraceIndex = pattern.indexOf('}', openingBraceIndex + 1);
|
||||
if (closingBraceIndex === -1) {
|
||||
return false;
|
||||
}
|
||||
const braceContent = pattern.slice(openingBraceIndex, closingBraceIndex);
|
||||
return BRACE_EXPANSION_SEPARATORS_RE.test(braceContent);
|
||||
}
|
||||
function convertToPositivePattern(pattern) {
|
||||
return isNegativePattern(pattern) ? pattern.slice(1) : pattern;
|
||||
}
|
||||
exports.convertToPositivePattern = convertToPositivePattern;
|
||||
function convertToNegativePattern(pattern) {
|
||||
return '!' + pattern;
|
||||
}
|
||||
exports.convertToNegativePattern = convertToNegativePattern;
|
||||
function isNegativePattern(pattern) {
|
||||
return pattern.startsWith('!') && pattern[1] !== '(';
|
||||
}
|
||||
exports.isNegativePattern = isNegativePattern;
|
||||
function isPositivePattern(pattern) {
|
||||
return !isNegativePattern(pattern);
|
||||
}
|
||||
exports.isPositivePattern = isPositivePattern;
|
||||
function getNegativePatterns(patterns) {
|
||||
return patterns.filter(isNegativePattern);
|
||||
}
|
||||
exports.getNegativePatterns = getNegativePatterns;
|
||||
function getPositivePatterns(patterns) {
|
||||
return patterns.filter(isPositivePattern);
|
||||
}
|
||||
exports.getPositivePatterns = getPositivePatterns;
|
||||
/**
|
||||
* Returns patterns that can be applied inside the current directory.
|
||||
*
|
||||
* @example
|
||||
* // ['./*', '*', 'a/*']
|
||||
* getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
|
||||
*/
|
||||
function getPatternsInsideCurrentDirectory(patterns) {
|
||||
return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern));
|
||||
}
|
||||
exports.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory;
|
||||
/**
|
||||
* Returns patterns to be expanded relative to (outside) the current directory.
|
||||
*
|
||||
* @example
|
||||
* // ['../*', './../*']
|
||||
* getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
|
||||
*/
|
||||
function getPatternsOutsideCurrentDirectory(patterns) {
|
||||
return patterns.filter(isPatternRelatedToParentDirectory);
|
||||
}
|
||||
exports.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory;
|
||||
function isPatternRelatedToParentDirectory(pattern) {
|
||||
return pattern.startsWith('..') || pattern.startsWith('./..');
|
||||
}
|
||||
exports.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory;
|
||||
function getBaseDirectory(pattern) {
|
||||
return globParent(pattern, { flipBackslashes: false });
|
||||
}
|
||||
exports.getBaseDirectory = getBaseDirectory;
|
||||
function hasGlobStar(pattern) {
|
||||
return pattern.includes(GLOBSTAR);
|
||||
}
|
||||
exports.hasGlobStar = hasGlobStar;
|
||||
function endsWithSlashGlobStar(pattern) {
|
||||
return pattern.endsWith('/' + GLOBSTAR);
|
||||
}
|
||||
exports.endsWithSlashGlobStar = endsWithSlashGlobStar;
|
||||
function isAffectDepthOfReadingPattern(pattern) {
|
||||
const basename = path.basename(pattern);
|
||||
return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
|
||||
}
|
||||
exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
|
||||
function expandPatternsWithBraceExpansion(patterns) {
|
||||
return patterns.reduce((collection, pattern) => {
|
||||
return collection.concat(expandBraceExpansion(pattern));
|
||||
}, []);
|
||||
}
|
||||
exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
|
||||
function expandBraceExpansion(pattern) {
|
||||
const patterns = micromatch.braces(pattern, { expand: true, nodupes: true, keepEscaping: true });
|
||||
/**
|
||||
* Sort the patterns by length so that the same depth patterns are processed side by side.
|
||||
* `a/{b,}/{c,}/*` – `['a///*', 'a/b//*', 'a//c/*', 'a/b/c/*']`
|
||||
*/
|
||||
patterns.sort((a, b) => a.length - b.length);
|
||||
/**
|
||||
* Micromatch can return an empty string in the case of patterns like `{a,}`.
|
||||
*/
|
||||
return patterns.filter((pattern) => pattern !== '');
|
||||
}
|
||||
exports.expandBraceExpansion = expandBraceExpansion;
|
||||
function getPatternParts(pattern, options) {
|
||||
let { parts } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true }));
|
||||
/**
|
||||
* The scan method returns an empty array in some cases.
|
||||
* See micromatch/picomatch#58 for more details.
|
||||
*/
|
||||
if (parts.length === 0) {
|
||||
parts = [pattern];
|
||||
}
|
||||
/**
|
||||
* The scan method does not return an empty part for the pattern with a forward slash.
|
||||
* This is another part of micromatch/picomatch#58.
|
||||
*/
|
||||
if (parts[0].startsWith('/')) {
|
||||
parts[0] = parts[0].slice(1);
|
||||
parts.unshift('');
|
||||
}
|
||||
return parts;
|
||||
}
|
||||
exports.getPatternParts = getPatternParts;
|
||||
function makeRe(pattern, options) {
|
||||
return micromatch.makeRe(pattern, options);
|
||||
}
|
||||
exports.makeRe = makeRe;
|
||||
function convertPatternsToRe(patterns, options) {
|
||||
return patterns.map((pattern) => makeRe(pattern, options));
|
||||
}
|
||||
exports.convertPatternsToRe = convertPatternsToRe;
|
||||
function matchAny(entry, patternsRe) {
|
||||
return patternsRe.some((patternRe) => patternRe.test(entry));
|
||||
}
|
||||
exports.matchAny = matchAny;
|
||||
/**
|
||||
* This package only works with forward slashes as a path separator.
|
||||
* Because of this, we cannot use the standard `path.normalize` method, because on Windows platform it will use of backslashes.
|
||||
*/
|
||||
function removeDuplicateSlashes(pattern) {
|
||||
return pattern.replace(DOUBLE_SLASH_RE, '/');
|
||||
}
|
||||
exports.removeDuplicateSlashes = removeDuplicateSlashes;
|
||||
function partitionAbsoluteAndRelative(patterns) {
|
||||
const absolute = [];
|
||||
const relative = [];
|
||||
for (const pattern of patterns) {
|
||||
if (isAbsolute(pattern)) {
|
||||
absolute.push(pattern);
|
||||
}
|
||||
else {
|
||||
relative.push(pattern);
|
||||
}
|
||||
}
|
||||
return [absolute, relative];
|
||||
}
|
||||
exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
|
||||
function isAbsolute(pattern) {
|
||||
return path.isAbsolute(pattern);
|
||||
}
|
||||
exports.isAbsolute = isAbsolute;
|
||||
4
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/stream.d.ts
generated
vendored
Normal file
4
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/stream.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import { Readable } from 'stream';
|
||||
export declare function merge(streams: Readable[]): NodeJS.ReadableStream;
|
||||
17
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/stream.js
generated
vendored
Normal file
17
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/stream.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.merge = void 0;
|
||||
const merge2 = require("merge2");
|
||||
function merge(streams) {
|
||||
const mergedStream = merge2(streams);
|
||||
streams.forEach((stream) => {
|
||||
stream.once('error', (error) => mergedStream.emit('error', error));
|
||||
});
|
||||
mergedStream.once('close', () => propagateCloseEventToSources(streams));
|
||||
mergedStream.once('end', () => propagateCloseEventToSources(streams));
|
||||
return mergedStream;
|
||||
}
|
||||
exports.merge = merge;
|
||||
function propagateCloseEventToSources(streams) {
|
||||
streams.forEach((stream) => stream.emit('close'));
|
||||
}
|
||||
2
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/string.d.ts
generated
vendored
Normal file
2
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/string.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare function isString(input: unknown): input is string;
|
||||
export declare function isEmpty(input: string): boolean;
|
||||
11
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/string.js
generated
vendored
Normal file
11
node_modules/@ts-morph/common/node_modules/fast-glob/out/utils/string.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isEmpty = exports.isString = void 0;
|
||||
function isString(input) {
|
||||
return typeof input === 'string';
|
||||
}
|
||||
exports.isString = isString;
|
||||
function isEmpty(input) {
|
||||
return input === '';
|
||||
}
|
||||
exports.isEmpty = isEmpty;
|
||||
81
node_modules/@ts-morph/common/node_modules/fast-glob/package.json
generated
vendored
Normal file
81
node_modules/@ts-morph/common/node_modules/fast-glob/package.json
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"name": "fast-glob",
|
||||
"version": "3.3.3",
|
||||
"description": "It's a very fast and efficient glob library for Node.js",
|
||||
"license": "MIT",
|
||||
"repository": "mrmlnc/fast-glob",
|
||||
"author": {
|
||||
"name": "Denis Malinochkin",
|
||||
"url": "https://mrmlnc.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.6.0"
|
||||
},
|
||||
"main": "out/index.js",
|
||||
"typings": "out/index.d.ts",
|
||||
"files": [
|
||||
"out",
|
||||
"!out/{benchmark,tests}",
|
||||
"!out/**/*.map",
|
||||
"!out/**/*.spec.*"
|
||||
],
|
||||
"keywords": [
|
||||
"glob",
|
||||
"patterns",
|
||||
"fast",
|
||||
"implementation"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@nodelib/fs.macchiato": "^1.0.1",
|
||||
"@types/glob-parent": "^5.1.0",
|
||||
"@types/merge2": "^1.1.4",
|
||||
"@types/micromatch": "^4.0.0",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "^14.18.53",
|
||||
"@types/picomatch": "^2.3.0",
|
||||
"@types/sinon": "^7.5.0",
|
||||
"bencho": "^0.1.1",
|
||||
"eslint": "^6.5.1",
|
||||
"eslint-config-mrmlnc": "^1.1.0",
|
||||
"execa": "^7.1.1",
|
||||
"fast-glob": "^3.0.4",
|
||||
"fdir": "6.0.1",
|
||||
"glob": "^10.0.0",
|
||||
"hereby": "^1.8.1",
|
||||
"mocha": "^6.2.1",
|
||||
"rimraf": "^5.0.0",
|
||||
"sinon": "^7.5.0",
|
||||
"snap-shot-it": "^7.9.10",
|
||||
"typescript": "^4.9.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nodelib/fs.stat": "^2.0.2",
|
||||
"@nodelib/fs.walk": "^1.2.3",
|
||||
"glob-parent": "^5.1.2",
|
||||
"merge2": "^1.3.0",
|
||||
"micromatch": "^4.0.8"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf out",
|
||||
"lint": "eslint \"src/**/*.ts\" --cache",
|
||||
"compile": "tsc",
|
||||
"test": "mocha \"out/**/*.spec.js\" -s 0",
|
||||
"test:e2e": "mocha \"out/**/*.e2e.js\" -s 0",
|
||||
"test:e2e:sync": "mocha \"out/**/*.e2e.js\" -s 0 --grep \"\\(sync\\)\"",
|
||||
"test:e2e:async": "mocha \"out/**/*.e2e.js\" -s 0 --grep \"\\(async\\)\"",
|
||||
"test:e2e:stream": "mocha \"out/**/*.e2e.js\" -s 0 --grep \"\\(stream\\)\"",
|
||||
"build": "npm run clean && npm run compile && npm run lint && npm test",
|
||||
"watch": "npm run clean && npm run compile -- -- --sourceMap --watch",
|
||||
"bench:async": "npm run bench:product:async && npm run bench:regression:async",
|
||||
"bench:stream": "npm run bench:product:stream && npm run bench:regression:stream",
|
||||
"bench:sync": "npm run bench:product:sync && npm run bench:regression:sync",
|
||||
"bench:product": "npm run bench:product:async && npm run bench:product:sync && npm run bench:product:stream",
|
||||
"bench:product:async": "hereby bench:product:async",
|
||||
"bench:product:sync": "hereby bench:product:sync",
|
||||
"bench:product:stream": "hereby bench:product:stream",
|
||||
"bench:regression": "npm run bench:regression:async && npm run bench:regression:sync && npm run bench:regression:stream",
|
||||
"bench:regression:async": "hereby bench:regression:async",
|
||||
"bench:regression:sync": "hereby bench:regression:sync",
|
||||
"bench:regression:stream": "hereby bench:regression:stream"
|
||||
}
|
||||
}
|
||||
110
node_modules/@ts-morph/common/node_modules/glob-parent/CHANGELOG.md
generated
vendored
Normal file
110
node_modules/@ts-morph/common/node_modules/glob-parent/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
### [5.1.2](https://github.com/gulpjs/glob-parent/compare/v5.1.1...v5.1.2) (2021-03-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* eliminate ReDoS ([#36](https://github.com/gulpjs/glob-parent/issues/36)) ([f923116](https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366))
|
||||
|
||||
### [5.1.1](https://github.com/gulpjs/glob-parent/compare/v5.1.0...v5.1.1) (2021-01-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* unescape exclamation mark ([#26](https://github.com/gulpjs/glob-parent/issues/26)) ([a98874f](https://github.com/gulpjs/glob-parent/commit/a98874f1a59e407f4fb1beb0db4efa8392da60bb))
|
||||
|
||||
## [5.1.0](https://github.com/gulpjs/glob-parent/compare/v5.0.0...v5.1.0) (2021-01-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add `flipBackslashes` option to disable auto conversion of slashes (closes [#24](https://github.com/gulpjs/glob-parent/issues/24)) ([#25](https://github.com/gulpjs/glob-parent/issues/25)) ([eecf91d](https://github.com/gulpjs/glob-parent/commit/eecf91d5e3834ed78aee39c4eaaae654d76b87b3))
|
||||
|
||||
## [5.0.0](https://github.com/gulpjs/glob-parent/compare/v4.0.0...v5.0.0) (2021-01-27)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* Drop support for node <6 & bump dependencies
|
||||
|
||||
### Miscellaneous Chores
|
||||
|
||||
* Drop support for node <6 & bump dependencies ([896c0c0](https://github.com/gulpjs/glob-parent/commit/896c0c00b4e7362f60b96e7fc295ae929245255a))
|
||||
|
||||
## [4.0.0](https://github.com/gulpjs/glob-parent/compare/v3.1.0...v4.0.0) (2021-01-27)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* question marks are valid path characters on Windows so avoid flagging as a glob when alone
|
||||
* Update is-glob dependency
|
||||
|
||||
### Features
|
||||
|
||||
* hoist regexps and strings for performance gains ([4a80667](https://github.com/gulpjs/glob-parent/commit/4a80667c69355c76a572a5892b0f133c8e1f457e))
|
||||
* question marks are valid path characters on Windows so avoid flagging as a glob when alone ([2a551dd](https://github.com/gulpjs/glob-parent/commit/2a551dd0dc3235e78bf3c94843d4107072d17841))
|
||||
* Update is-glob dependency ([e41fcd8](https://github.com/gulpjs/glob-parent/commit/e41fcd895d1f7bc617dba45c9d935a7949b9c281))
|
||||
|
||||
## [3.1.0](https://github.com/gulpjs/glob-parent/compare/v3.0.1...v3.1.0) (2021-01-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* allow basic win32 backslash use ([272afa5](https://github.com/gulpjs/glob-parent/commit/272afa5fd070fc0f796386a5993d4ee4a846988b))
|
||||
* handle extglobs (parentheses) containing separators ([7db1bdb](https://github.com/gulpjs/glob-parent/commit/7db1bdb0756e55fd14619e8ce31aa31b17b117fd))
|
||||
* new approach to braces/brackets handling ([8269bd8](https://github.com/gulpjs/glob-parent/commit/8269bd89290d99fac9395a354fb56fdcdb80f0be))
|
||||
* pre-process braces/brackets sections ([9ef8a87](https://github.com/gulpjs/glob-parent/commit/9ef8a87f66b1a43d0591e7a8e4fc5a18415ee388))
|
||||
* preserve escaped brace/bracket at end of string ([8cfb0ba](https://github.com/gulpjs/glob-parent/commit/8cfb0ba84202d51571340dcbaf61b79d16a26c76))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* trailing escaped square brackets ([99ec9fe](https://github.com/gulpjs/glob-parent/commit/99ec9fecc60ee488ded20a94dd4f18b4f55c4ccf))
|
||||
|
||||
### [3.0.1](https://github.com/gulpjs/glob-parent/compare/v3.0.0...v3.0.1) (2021-01-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* use path-dirname ponyfill ([cdbea5f](https://github.com/gulpjs/glob-parent/commit/cdbea5f32a58a54e001a75ddd7c0fccd4776aacc))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* unescape glob-escaped dirnames on output ([598c533](https://github.com/gulpjs/glob-parent/commit/598c533bdf49c1428bc063aa9b8db40c5a86b030))
|
||||
|
||||
## [3.0.0](https://github.com/gulpjs/glob-parent/compare/v2.0.0...v3.0.0) (2021-01-27)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* update is-glob dependency
|
||||
|
||||
### Features
|
||||
|
||||
* update is-glob dependency ([5c5f8ef](https://github.com/gulpjs/glob-parent/commit/5c5f8efcee362a8e7638cf8220666acd8784f6bd))
|
||||
|
||||
## [2.0.0](https://github.com/gulpjs/glob-parent/compare/v1.3.0...v2.0.0) (2021-01-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* move up to dirname regardless of glob characters ([f97fb83](https://github.com/gulpjs/glob-parent/commit/f97fb83be2e0a9fc8d3b760e789d2ecadd6aa0c2))
|
||||
|
||||
## [1.3.0](https://github.com/gulpjs/glob-parent/compare/v1.2.0...v1.3.0) (2021-01-27)
|
||||
|
||||
## [1.2.0](https://github.com/gulpjs/glob-parent/compare/v1.1.0...v1.2.0) (2021-01-27)
|
||||
|
||||
|
||||
### Reverts
|
||||
|
||||
* feat: make regex test strings smaller ([dc80fa9](https://github.com/gulpjs/glob-parent/commit/dc80fa9658dca20549cfeba44bbd37d5246fcce0))
|
||||
|
||||
## [1.1.0](https://github.com/gulpjs/glob-parent/compare/v1.0.0...v1.1.0) (2021-01-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* make regex test strings smaller ([cd83220](https://github.com/gulpjs/glob-parent/commit/cd832208638f45169f986d80fcf66e401f35d233))
|
||||
|
||||
## 1.0.0 (2021-01-27)
|
||||
|
||||
15
node_modules/@ts-morph/common/node_modules/glob-parent/LICENSE
generated
vendored
Normal file
15
node_modules/@ts-morph/common/node_modules/glob-parent/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) 2015, 2019 Elan Shanker
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
137
node_modules/@ts-morph/common/node_modules/glob-parent/README.md
generated
vendored
Normal file
137
node_modules/@ts-morph/common/node_modules/glob-parent/README.md
generated
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
<p align="center">
|
||||
<a href="https://gulpjs.com">
|
||||
<img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
# glob-parent
|
||||
|
||||
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Azure Pipelines Build Status][azure-pipelines-image]][azure-pipelines-url] [![Travis Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url]
|
||||
|
||||
Extract the non-magic parent path from a glob string.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var globParent = require('glob-parent');
|
||||
|
||||
globParent('path/to/*.js'); // 'path/to'
|
||||
globParent('/root/path/to/*.js'); // '/root/path/to'
|
||||
globParent('/*.js'); // '/'
|
||||
globParent('*.js'); // '.'
|
||||
globParent('**/*.js'); // '.'
|
||||
globParent('path/{to,from}'); // 'path'
|
||||
globParent('path/!(to|from)'); // 'path'
|
||||
globParent('path/?(to|from)'); // 'path'
|
||||
globParent('path/+(to|from)'); // 'path'
|
||||
globParent('path/*(to|from)'); // 'path'
|
||||
globParent('path/@(to|from)'); // 'path'
|
||||
globParent('path/**/*'); // 'path'
|
||||
|
||||
// if provided a non-glob path, returns the nearest dir
|
||||
globParent('path/foo/bar.js'); // 'path/foo'
|
||||
globParent('path/foo/'); // 'path/foo'
|
||||
globParent('path/foo'); // 'path' (see issue #3 for details)
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `globParent(maybeGlobString, [options])`
|
||||
|
||||
Takes a string and returns the part of the path before the glob begins. Be aware of Escaping rules and Limitations below.
|
||||
|
||||
#### options
|
||||
|
||||
```js
|
||||
{
|
||||
// Disables the automatic conversion of slashes for Windows
|
||||
flipBackslashes: true
|
||||
}
|
||||
```
|
||||
|
||||
## Escaping
|
||||
|
||||
The following characters have special significance in glob patterns and must be escaped if you want them to be treated as regular path characters:
|
||||
|
||||
- `?` (question mark) unless used as a path segment alone
|
||||
- `*` (asterisk)
|
||||
- `|` (pipe)
|
||||
- `(` (opening parenthesis)
|
||||
- `)` (closing parenthesis)
|
||||
- `{` (opening curly brace)
|
||||
- `}` (closing curly brace)
|
||||
- `[` (opening bracket)
|
||||
- `]` (closing bracket)
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
globParent('foo/[bar]/') // 'foo'
|
||||
globParent('foo/\\[bar]/') // 'foo/[bar]'
|
||||
```
|
||||
|
||||
## Limitations
|
||||
|
||||
### Braces & Brackets
|
||||
This library attempts a quick and imperfect method of determining which path
|
||||
parts have glob magic without fully parsing/lexing the pattern. There are some
|
||||
advanced use cases that can trip it up, such as nested braces where the outer
|
||||
pair is escaped and the inner one contains a path separator. If you find
|
||||
yourself in the unlikely circumstance of being affected by this or need to
|
||||
ensure higher-fidelity glob handling in your library, it is recommended that you
|
||||
pre-process your input with [expand-braces] and/or [expand-brackets].
|
||||
|
||||
### Windows
|
||||
Backslashes are not valid path separators for globs. If a path with backslashes
|
||||
is provided anyway, for simple cases, glob-parent will replace the path
|
||||
separator for you and return the non-glob parent path (now with
|
||||
forward-slashes, which are still valid as Windows path separators).
|
||||
|
||||
This cannot be used in conjunction with escape characters.
|
||||
|
||||
```js
|
||||
// BAD
|
||||
globParent('C:\\Program Files \\(x86\\)\\*.ext') // 'C:/Program Files /(x86/)'
|
||||
|
||||
// GOOD
|
||||
globParent('C:/Program Files\\(x86\\)/*.ext') // 'C:/Program Files (x86)'
|
||||
```
|
||||
|
||||
If you are using escape characters for a pattern without path parts (i.e.
|
||||
relative to `cwd`), prefix with `./` to avoid confusing glob-parent.
|
||||
|
||||
```js
|
||||
// BAD
|
||||
globParent('foo \\[bar]') // 'foo '
|
||||
globParent('foo \\[bar]*') // 'foo '
|
||||
|
||||
// GOOD
|
||||
globParent('./foo \\[bar]') // 'foo [bar]'
|
||||
globParent('./foo \\[bar]*') // '.'
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
ISC
|
||||
|
||||
[expand-braces]: https://github.com/jonschlinkert/expand-braces
|
||||
[expand-brackets]: https://github.com/jonschlinkert/expand-brackets
|
||||
|
||||
[downloads-image]: https://img.shields.io/npm/dm/glob-parent.svg
|
||||
[npm-url]: https://www.npmjs.com/package/glob-parent
|
||||
[npm-image]: https://img.shields.io/npm/v/glob-parent.svg
|
||||
|
||||
[azure-pipelines-url]: https://dev.azure.com/gulpjs/gulp/_build/latest?definitionId=2&branchName=master
|
||||
[azure-pipelines-image]: https://dev.azure.com/gulpjs/gulp/_apis/build/status/glob-parent?branchName=master
|
||||
|
||||
[travis-url]: https://travis-ci.org/gulpjs/glob-parent
|
||||
[travis-image]: https://img.shields.io/travis/gulpjs/glob-parent.svg?label=travis-ci
|
||||
|
||||
[appveyor-url]: https://ci.appveyor.com/project/gulpjs/glob-parent
|
||||
[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/glob-parent.svg?label=appveyor
|
||||
|
||||
[coveralls-url]: https://coveralls.io/r/gulpjs/glob-parent
|
||||
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/glob-parent/master.svg
|
||||
|
||||
[gitter-url]: https://gitter.im/gulpjs/gulp
|
||||
[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg
|
||||
42
node_modules/@ts-morph/common/node_modules/glob-parent/index.js
generated
vendored
Normal file
42
node_modules/@ts-morph/common/node_modules/glob-parent/index.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
'use strict';
|
||||
|
||||
var isGlob = require('is-glob');
|
||||
var pathPosixDirname = require('path').posix.dirname;
|
||||
var isWin32 = require('os').platform() === 'win32';
|
||||
|
||||
var slash = '/';
|
||||
var backslash = /\\/g;
|
||||
var enclosure = /[\{\[].*[\}\]]$/;
|
||||
var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
|
||||
var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
|
||||
|
||||
/**
|
||||
* @param {string} str
|
||||
* @param {Object} opts
|
||||
* @param {boolean} [opts.flipBackslashes=true]
|
||||
* @returns {string}
|
||||
*/
|
||||
module.exports = function globParent(str, opts) {
|
||||
var options = Object.assign({ flipBackslashes: true }, opts);
|
||||
|
||||
// flip windows path separators
|
||||
if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
|
||||
str = str.replace(backslash, slash);
|
||||
}
|
||||
|
||||
// special case for strings ending in enclosure containing path separator
|
||||
if (enclosure.test(str)) {
|
||||
str += slash;
|
||||
}
|
||||
|
||||
// preserves full path in case of trailing path separator
|
||||
str += 'a';
|
||||
|
||||
// remove path parts that are globby
|
||||
do {
|
||||
str = pathPosixDirname(str);
|
||||
} while (isGlob(str) || globby.test(str));
|
||||
|
||||
// remove escape chars and return result
|
||||
return str.replace(escaped, '$1');
|
||||
};
|
||||
48
node_modules/@ts-morph/common/node_modules/glob-parent/package.json
generated
vendored
Normal file
48
node_modules/@ts-morph/common/node_modules/glob-parent/package.json
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "glob-parent",
|
||||
"version": "5.1.2",
|
||||
"description": "Extract the non-magic parent path from a glob string.",
|
||||
"author": "Gulp Team <team@gulpjs.com> (https://gulpjs.com/)",
|
||||
"contributors": [
|
||||
"Elan Shanker (https://github.com/es128)",
|
||||
"Blaine Bublitz <blaine.bublitz@gmail.com>"
|
||||
],
|
||||
"repository": "gulpjs/glob-parent",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
},
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"pretest": "npm run lint",
|
||||
"test": "nyc mocha --async-only",
|
||||
"azure-pipelines": "nyc mocha --async-only --reporter xunit -O output=test.xunit",
|
||||
"coveralls": "nyc report --reporter=text-lcov | coveralls"
|
||||
},
|
||||
"dependencies": {
|
||||
"is-glob": "^4.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coveralls": "^3.0.11",
|
||||
"eslint": "^2.13.1",
|
||||
"eslint-config-gulp": "^3.0.1",
|
||||
"expect": "^1.20.2",
|
||||
"mocha": "^6.0.2",
|
||||
"nyc": "^13.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"glob",
|
||||
"parent",
|
||||
"strip",
|
||||
"path",
|
||||
"dirname",
|
||||
"directory",
|
||||
"base",
|
||||
"wildcard"
|
||||
]
|
||||
}
|
||||
15
node_modules/@ts-morph/common/node_modules/minimatch/LICENSE
generated
vendored
Normal file
15
node_modules/@ts-morph/common/node_modules/minimatch/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) 2011-2023 Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
454
node_modules/@ts-morph/common/node_modules/minimatch/README.md
generated
vendored
Normal file
454
node_modules/@ts-morph/common/node_modules/minimatch/README.md
generated
vendored
Normal file
@@ -0,0 +1,454 @@
|
||||
# minimatch
|
||||
|
||||
A minimal matching utility.
|
||||
|
||||
This is the matching library used internally by npm.
|
||||
|
||||
It works by converting glob expressions into JavaScript `RegExp`
|
||||
objects.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
// hybrid module, load with require() or import
|
||||
import { minimatch } from 'minimatch'
|
||||
// or:
|
||||
const { minimatch } = require('minimatch')
|
||||
|
||||
minimatch('bar.foo', '*.foo') // true!
|
||||
minimatch('bar.foo', '*.bar') // false!
|
||||
minimatch('bar.foo', '*.+(bar|foo)', { debug: true }) // true, and noisy!
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
Supports these glob features:
|
||||
|
||||
- Brace Expansion
|
||||
- Extended glob matching
|
||||
- "Globstar" `**` matching
|
||||
- [Posix character
|
||||
classes](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html),
|
||||
like `[[:alpha:]]`, supporting the full range of Unicode
|
||||
characters. For example, `[[:alpha:]]` will match against
|
||||
`'é'`, though `[a-zA-Z]` will not. Collating symbol and set
|
||||
matching is not supported, so `[[=e=]]` will _not_ match `'é'`
|
||||
and `[[.ch.]]` will not match `'ch'` in locales where `ch` is
|
||||
considered a single character.
|
||||
|
||||
See:
|
||||
|
||||
- `man sh`
|
||||
- `man bash` [Pattern
|
||||
Matching](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html)
|
||||
- `man 3 fnmatch`
|
||||
- `man 5 gitignore`
|
||||
|
||||
## Windows
|
||||
|
||||
**Please only use forward-slashes in glob expressions.**
|
||||
|
||||
Though windows uses either `/` or `\` as its path separator, only `/`
|
||||
characters are used by this glob implementation. You must use
|
||||
forward-slashes **only** in glob expressions. Back-slashes in patterns
|
||||
will always be interpreted as escape characters, not path separators.
|
||||
|
||||
Note that `\` or `/` _will_ be interpreted as path separators in paths on
|
||||
Windows, and will match against `/` in glob expressions.
|
||||
|
||||
So just always use `/` in patterns.
|
||||
|
||||
### UNC Paths
|
||||
|
||||
On Windows, UNC paths like `//?/c:/...` or
|
||||
`//ComputerName/Share/...` are handled specially.
|
||||
|
||||
- Patterns starting with a double-slash followed by some
|
||||
non-slash characters will preserve their double-slash. As a
|
||||
result, a pattern like `//*` will match `//x`, but not `/x`.
|
||||
- Patterns staring with `//?/<drive letter>:` will _not_ treat
|
||||
the `?` as a wildcard character. Instead, it will be treated
|
||||
as a normal string.
|
||||
- Patterns starting with `//?/<drive letter>:/...` will match
|
||||
file paths starting with `<drive letter>:/...`, and vice versa,
|
||||
as if the `//?/` was not present. This behavior only is
|
||||
present when the drive letters are a case-insensitive match to
|
||||
one another. The remaining portions of the path/pattern are
|
||||
compared case sensitively, unless `nocase:true` is set.
|
||||
|
||||
Note that specifying a UNC path using `\` characters as path
|
||||
separators is always allowed in the file path argument, but only
|
||||
allowed in the pattern argument when `windowsPathsNoEscape: true`
|
||||
is set in the options.
|
||||
|
||||
## Minimatch Class
|
||||
|
||||
Create a minimatch object by instantiating the `minimatch.Minimatch` class.
|
||||
|
||||
```javascript
|
||||
var Minimatch = require('minimatch').Minimatch
|
||||
var mm = new Minimatch(pattern, options)
|
||||
```
|
||||
|
||||
### Properties
|
||||
|
||||
- `pattern` The original pattern the minimatch object represents.
|
||||
- `options` The options supplied to the constructor.
|
||||
- `set` A 2-dimensional array of regexp or string expressions.
|
||||
Each row in the
|
||||
array corresponds to a brace-expanded pattern. Each item in the row
|
||||
corresponds to a single path-part. For example, the pattern
|
||||
`{a,b/c}/d` would expand to a set of patterns like:
|
||||
|
||||
[ [ a, d ]
|
||||
, [ b, c, d ] ]
|
||||
|
||||
If a portion of the pattern doesn't have any "magic" in it
|
||||
(that is, it's something like `"foo"` rather than `fo*o?`), then it
|
||||
will be left as a string rather than converted to a regular
|
||||
expression.
|
||||
|
||||
- `regexp` Created by the `makeRe` method. A single regular expression
|
||||
expressing the entire pattern. This is useful in cases where you wish
|
||||
to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled.
|
||||
- `negate` True if the pattern is negated.
|
||||
- `comment` True if the pattern is a comment.
|
||||
- `empty` True if the pattern is `""`.
|
||||
|
||||
### Methods
|
||||
|
||||
- `makeRe()` Generate the `regexp` member if necessary, and return it.
|
||||
Will return `false` if the pattern is invalid.
|
||||
- `match(fname)` Return true if the filename matches the pattern, or
|
||||
false otherwise.
|
||||
- `matchOne(fileArray, patternArray, partial)` Take a `/`-split
|
||||
filename, and match it against a single row in the `regExpSet`. This
|
||||
method is mainly for internal use, but is exposed so that it can be
|
||||
used by a glob-walker that needs to avoid excessive filesystem calls.
|
||||
- `hasMagic()` Returns true if the parsed pattern contains any
|
||||
magic characters. Returns false if all comparator parts are
|
||||
string literals. If the `magicalBraces` option is set on the
|
||||
constructor, then it will consider brace expansions which are
|
||||
not otherwise magical to be magic. If not set, then a pattern
|
||||
like `a{b,c}d` will return `false`, because neither `abd` nor
|
||||
`acd` contain any special glob characters.
|
||||
|
||||
This does **not** mean that the pattern string can be used as a
|
||||
literal filename, as it may contain magic glob characters that
|
||||
are escaped. For example, the pattern `\\*` or `[*]` would not
|
||||
be considered to have magic, as the matching portion parses to
|
||||
the literal string `'*'` and would match a path named `'*'`,
|
||||
not `'\\*'` or `'[*]'`. The `minimatch.unescape()` method may
|
||||
be used to remove escape characters.
|
||||
|
||||
All other methods are internal, and will be called as necessary.
|
||||
|
||||
### minimatch(path, pattern, options)
|
||||
|
||||
Main export. Tests a path against the pattern using the options.
|
||||
|
||||
```javascript
|
||||
var isJS = minimatch(file, '*.js', { matchBase: true })
|
||||
```
|
||||
|
||||
### minimatch.filter(pattern, options)
|
||||
|
||||
Returns a function that tests its
|
||||
supplied argument, suitable for use with `Array.filter`. Example:
|
||||
|
||||
```javascript
|
||||
var javascripts = fileList.filter(minimatch.filter('*.js', { matchBase: true }))
|
||||
```
|
||||
|
||||
### minimatch.escape(pattern, options = {})
|
||||
|
||||
Escape all magic characters in a glob pattern, so that it will
|
||||
only ever match literal strings
|
||||
|
||||
If the `windowsPathsNoEscape` option is used, then characters are
|
||||
escaped by wrapping in `[]`, because a magic character wrapped in
|
||||
a character class can only be satisfied by that exact character.
|
||||
|
||||
Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot
|
||||
be escaped or unescaped.
|
||||
|
||||
### minimatch.unescape(pattern, options = {})
|
||||
|
||||
Un-escape a glob string that may contain some escaped characters.
|
||||
|
||||
If the `windowsPathsNoEscape` option is used, then square-brace
|
||||
escapes are removed, but not backslash escapes. For example, it
|
||||
will turn the string `'[*]'` into `*`, but it will not turn
|
||||
`'\\*'` into `'*'`, because `\` is a path separator in
|
||||
`windowsPathsNoEscape` mode.
|
||||
|
||||
When `windowsPathsNoEscape` is not set, then both brace escapes
|
||||
and backslash escapes are removed.
|
||||
|
||||
Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot
|
||||
be escaped or unescaped.
|
||||
|
||||
### minimatch.match(list, pattern, options)
|
||||
|
||||
Match against the list of
|
||||
files, in the style of fnmatch or glob. If nothing is matched, and
|
||||
options.nonull is set, then return a list containing the pattern itself.
|
||||
|
||||
```javascript
|
||||
var javascripts = minimatch.match(fileList, '*.js', { matchBase: true })
|
||||
```
|
||||
|
||||
### minimatch.makeRe(pattern, options)
|
||||
|
||||
Make a regular expression object from the pattern.
|
||||
|
||||
## Options
|
||||
|
||||
All options are `false` by default.
|
||||
|
||||
### debug
|
||||
|
||||
Dump a ton of stuff to stderr.
|
||||
|
||||
### nobrace
|
||||
|
||||
Do not expand `{a,b}` and `{1..3}` brace sets.
|
||||
|
||||
### noglobstar
|
||||
|
||||
Disable `**` matching against multiple folder names.
|
||||
|
||||
### dot
|
||||
|
||||
Allow patterns to match filenames starting with a period, even if
|
||||
the pattern does not explicitly have a period in that spot.
|
||||
|
||||
Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot`
|
||||
is set.
|
||||
|
||||
### noext
|
||||
|
||||
Disable "extglob" style patterns like `+(a|b)`.
|
||||
|
||||
### nocase
|
||||
|
||||
Perform a case-insensitive match.
|
||||
|
||||
### nocaseMagicOnly
|
||||
|
||||
When used with `{nocase: true}`, create regular expressions that
|
||||
are case-insensitive, but leave string match portions untouched.
|
||||
Has no effect when used without `{nocase: true}`
|
||||
|
||||
Useful when some other form of case-insensitive matching is used,
|
||||
or if the original string representation is useful in some other
|
||||
way.
|
||||
|
||||
### nonull
|
||||
|
||||
When a match is not found by `minimatch.match`, return a list containing
|
||||
the pattern itself if this option is set. When not set, an empty list
|
||||
is returned if there are no matches.
|
||||
|
||||
### magicalBraces
|
||||
|
||||
This only affects the results of the `Minimatch.hasMagic` method.
|
||||
|
||||
If the pattern contains brace expansions, such as `a{b,c}d`, but
|
||||
no other magic characters, then the `Minimatch.hasMagic()` method
|
||||
will return `false` by default. When this option set, it will
|
||||
return `true` for brace expansion as well as other magic glob
|
||||
characters.
|
||||
|
||||
### matchBase
|
||||
|
||||
If set, then patterns without slashes will be matched
|
||||
against the basename of the path if it contains slashes. For example,
|
||||
`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.
|
||||
|
||||
### nocomment
|
||||
|
||||
Suppress the behavior of treating `#` at the start of a pattern as a
|
||||
comment.
|
||||
|
||||
### nonegate
|
||||
|
||||
Suppress the behavior of treating a leading `!` character as negation.
|
||||
|
||||
### flipNegate
|
||||
|
||||
Returns from negate expressions the same as if they were not negated.
|
||||
(Ie, true on a hit, false on a miss.)
|
||||
|
||||
### partial
|
||||
|
||||
Compare a partial path to a pattern. As long as the parts of the path that
|
||||
are present are not contradicted by the pattern, it will be treated as a
|
||||
match. This is useful in applications where you're walking through a
|
||||
folder structure, and don't yet have the full path, but want to ensure that
|
||||
you do not walk down paths that can never be a match.
|
||||
|
||||
For example,
|
||||
|
||||
```js
|
||||
minimatch('/a/b', '/a/*/c/d', { partial: true }) // true, might be /a/b/c/d
|
||||
minimatch('/a/b', '/**/d', { partial: true }) // true, might be /a/b/.../d
|
||||
minimatch('/x/y/z', '/a/**/z', { partial: true }) // false, because x !== a
|
||||
```
|
||||
|
||||
### windowsPathsNoEscape
|
||||
|
||||
Use `\\` as a path separator _only_, and _never_ as an escape
|
||||
character. If set, all `\\` characters are replaced with `/` in
|
||||
the pattern. Note that this makes it **impossible** to match
|
||||
against paths containing literal glob pattern characters, but
|
||||
allows matching with patterns constructed using `path.join()` and
|
||||
`path.resolve()` on Windows platforms, mimicking the (buggy!)
|
||||
behavior of earlier versions on Windows. Please use with
|
||||
caution, and be mindful of [the caveat about Windows
|
||||
paths](#windows).
|
||||
|
||||
For legacy reasons, this is also set if
|
||||
`options.allowWindowsEscape` is set to the exact value `false`.
|
||||
|
||||
### windowsNoMagicRoot
|
||||
|
||||
When a pattern starts with a UNC path or drive letter, and in
|
||||
`nocase:true` mode, do not convert the root portions of the
|
||||
pattern into a case-insensitive regular expression, and instead
|
||||
leave them as strings.
|
||||
|
||||
This is the default when the platform is `win32` and
|
||||
`nocase:true` is set.
|
||||
|
||||
### preserveMultipleSlashes
|
||||
|
||||
By default, multiple `/` characters (other than the leading `//`
|
||||
in a UNC path, see "UNC Paths" above) are treated as a single
|
||||
`/`.
|
||||
|
||||
That is, a pattern like `a///b` will match the file path `a/b`.
|
||||
|
||||
Set `preserveMultipleSlashes: true` to suppress this behavior.
|
||||
|
||||
### optimizationLevel
|
||||
|
||||
A number indicating the level of optimization that should be done
|
||||
to the pattern prior to parsing and using it for matches.
|
||||
|
||||
Globstar parts `**` are always converted to `*` when `noglobstar`
|
||||
is set, and multiple adjacent `**` parts are converted into a
|
||||
single `**` (ie, `a/**/**/b` will be treated as `a/**/b`, as this
|
||||
is equivalent in all cases).
|
||||
|
||||
- `0` - Make no further changes. In this mode, `.` and `..` are
|
||||
maintained in the pattern, meaning that they must also appear
|
||||
in the same position in the test path string. Eg, a pattern
|
||||
like `a/*/../c` will match the string `a/b/../c` but not the
|
||||
string `a/c`.
|
||||
- `1` - (default) Remove cases where a double-dot `..` follows a
|
||||
pattern portion that is not `**`, `.`, `..`, or empty `''`. For
|
||||
example, the pattern `./a/b/../*` is converted to `./a/*`, and
|
||||
so it will match the path string `./a/c`, but not the path
|
||||
string `./a/b/../c`. Dots and empty path portions in the
|
||||
pattern are preserved.
|
||||
- `2` (or higher) - Much more aggressive optimizations, suitable
|
||||
for use with file-walking cases:
|
||||
|
||||
- Remove cases where a double-dot `..` follows a pattern
|
||||
portion that is not `**`, `.`, or empty `''`. Remove empty
|
||||
and `.` portions of the pattern, where safe to do so (ie,
|
||||
anywhere other than the last position, the first position, or
|
||||
the second position in a pattern starting with `/`, as this
|
||||
may indicate a UNC path on Windows).
|
||||
- Convert patterns containing `<pre>/**/../<p>/<rest>` into the
|
||||
equivalent `<pre>/{..,**}/<p>/<rest>`, where `<p>` is a
|
||||
a pattern portion other than `.`, `..`, `**`, or empty
|
||||
`''`.
|
||||
- Dedupe patterns where a `**` portion is present in one and
|
||||
omitted in another, and it is not the final path portion, and
|
||||
they are otherwise equivalent. So `{a/**/b,a/b}` becomes
|
||||
`a/**/b`, because `**` matches against an empty path portion.
|
||||
- Dedupe patterns where a `*` portion is present in one, and a
|
||||
non-dot pattern other than `**`, `.`, `..`, or `''` is in the
|
||||
same position in the other. So `a/{*,x}/b` becomes `a/*/b`,
|
||||
because `*` can match against `x`.
|
||||
|
||||
While these optimizations improve the performance of
|
||||
file-walking use cases such as [glob](http://npm.im/glob) (ie,
|
||||
the reason this module exists), there are cases where it will
|
||||
fail to match a literal string that would have been matched in
|
||||
optimization level 1 or 0.
|
||||
|
||||
Specifically, while the `Minimatch.match()` method will
|
||||
optimize the file path string in the same ways, resulting in
|
||||
the same matches, it will fail when tested with the regular
|
||||
expression provided by `Minimatch.makeRe()`, unless the path
|
||||
string is first processed with
|
||||
`minimatch.levelTwoFileOptimize()` or similar.
|
||||
|
||||
### platform
|
||||
|
||||
When set to `win32`, this will trigger all windows-specific
|
||||
behaviors (special handling for UNC paths, and treating `\` as
|
||||
separators in file paths for comparison.)
|
||||
|
||||
Defaults to the value of `process.platform`.
|
||||
|
||||
## Comparisons to other fnmatch/glob implementations
|
||||
|
||||
While strict compliance with the existing standards is a
|
||||
worthwhile goal, some discrepancies exist between minimatch and
|
||||
other implementations. Some are intentional, and some are
|
||||
unavoidable.
|
||||
|
||||
If the pattern starts with a `!` character, then it is negated. Set the
|
||||
`nonegate` flag to suppress this behavior, and treat leading `!`
|
||||
characters normally. This is perhaps relevant if you wish to start the
|
||||
pattern with a negative extglob pattern like `!(a|B)`. Multiple `!`
|
||||
characters at the start of a pattern will negate the pattern multiple
|
||||
times.
|
||||
|
||||
If a pattern starts with `#`, then it is treated as a comment, and
|
||||
will not match anything. Use `\#` to match a literal `#` at the
|
||||
start of a line, or set the `nocomment` flag to suppress this behavior.
|
||||
|
||||
The double-star character `**` is supported by default, unless the
|
||||
`noglobstar` flag is set. This is supported in the manner of bsdglob
|
||||
and bash 4.1, where `**` only has special significance if it is the only
|
||||
thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but
|
||||
`a/**b` will not.
|
||||
|
||||
If an escaped pattern has no matches, and the `nonull` flag is set,
|
||||
then minimatch.match returns the pattern as-provided, rather than
|
||||
interpreting the character escapes. For example,
|
||||
`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than
|
||||
`"*a?"`. This is akin to setting the `nullglob` option in bash, except
|
||||
that it does not resolve escaped pattern characters.
|
||||
|
||||
If brace expansion is not disabled, then it is performed before any
|
||||
other interpretation of the glob pattern. Thus, a pattern like
|
||||
`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded
|
||||
**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are
|
||||
checked for validity. Since those two are valid, matching proceeds.
|
||||
|
||||
Negated extglob patterns are handled as closely as possible to
|
||||
Bash semantics, but there are some cases with negative extglobs
|
||||
which are exceedingly difficult to express in a JavaScript
|
||||
regular expression. In particular the negated pattern
|
||||
`<start>!(<pattern>*|)*` will in bash match anything that does
|
||||
not start with `<start><pattern>`. However,
|
||||
`<start>!(<pattern>*)*` _will_ match paths starting with
|
||||
`<start><pattern>`, because the empty string can match against
|
||||
the negated portion. In this library, `<start>!(<pattern>*|)*`
|
||||
will _not_ match any pattern starting with `<start>`, due to a
|
||||
difference in precisely which patterns are considered "greedy" in
|
||||
Regular Expressions vs bash path expansion. This may be fixable,
|
||||
but not without incurring some complexity and performance costs,
|
||||
and the trade-off seems to not be worth pursuing.
|
||||
|
||||
Note that `fnmatch(3)` in libc is an extremely naive string comparison
|
||||
matcher, which does not do anything special for slashes. This library is
|
||||
designed to be used in glob searching and file walkers, and so it does do
|
||||
special things with `/`. Thus, `foo*` will not match `foo/bar` in this
|
||||
library, even though it would in `fnmatch(3)`.
|
||||
2
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts
generated
vendored
Normal file
2
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare const assertValidPattern: (pattern: any) => void;
|
||||
//# sourceMappingURL=assert-valid-pattern.d.ts.map
|
||||
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map
generated
vendored
Normal file
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"assert-valid-pattern.d.ts","sourceRoot":"","sources":["../../src/assert-valid-pattern.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,kBAAkB,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAUlD,CAAA"}
|
||||
14
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js
generated
vendored
Normal file
14
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.assertValidPattern = void 0;
|
||||
const MAX_PATTERN_LENGTH = 1024 * 64;
|
||||
const assertValidPattern = (pattern) => {
|
||||
if (typeof pattern !== 'string') {
|
||||
throw new TypeError('invalid pattern');
|
||||
}
|
||||
if (pattern.length > MAX_PATTERN_LENGTH) {
|
||||
throw new TypeError('pattern is too long');
|
||||
}
|
||||
};
|
||||
exports.assertValidPattern = assertValidPattern;
|
||||
//# sourceMappingURL=assert-valid-pattern.js.map
|
||||
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map
generated
vendored
Normal file
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"assert-valid-pattern.js","sourceRoot":"","sources":["../../src/assert-valid-pattern.ts"],"names":[],"mappings":";;;AAAA,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAE,CAAA;AAC7B,MAAM,kBAAkB,GAA2B,CACxD,OAAY,EACe,EAAE;IAC7B,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,MAAM,IAAI,SAAS,CAAC,iBAAiB,CAAC,CAAA;IACxC,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,kBAAkB,EAAE,CAAC;QACxC,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAA;IAC5C,CAAC;AACH,CAAC,CAAA;AAVY,QAAA,kBAAkB,sBAU9B","sourcesContent":["const MAX_PATTERN_LENGTH = 1024 * 64\nexport const assertValidPattern: (pattern: any) => void = (\n pattern: any\n): asserts pattern is string => {\n if (typeof pattern !== 'string') {\n throw new TypeError('invalid pattern')\n }\n\n if (pattern.length > MAX_PATTERN_LENGTH) {\n throw new TypeError('pattern is too long')\n }\n}\n"]}
|
||||
20
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/ast.d.ts
generated
vendored
Normal file
20
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/ast.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import { MinimatchOptions, MMRegExp } from './index.js';
|
||||
export type ExtglobType = '!' | '?' | '+' | '*' | '@';
|
||||
export declare class AST {
|
||||
#private;
|
||||
type: ExtglobType | null;
|
||||
constructor(type: ExtglobType | null, parent?: AST, options?: MinimatchOptions);
|
||||
get hasMagic(): boolean | undefined;
|
||||
toString(): string;
|
||||
push(...parts: (string | AST)[]): void;
|
||||
toJSON(): any[];
|
||||
isStart(): boolean;
|
||||
isEnd(): boolean;
|
||||
copyIn(part: AST | string): void;
|
||||
clone(parent: AST): AST;
|
||||
static fromGlob(pattern: string, options?: MinimatchOptions): AST;
|
||||
toMMPattern(): MMRegExp | string;
|
||||
get options(): MinimatchOptions;
|
||||
toRegExpSource(allowDot?: boolean): [re: string, body: string, hasMagic: boolean, uflag: boolean];
|
||||
}
|
||||
//# sourceMappingURL=ast.d.ts.map
|
||||
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/ast.d.ts.map
generated
vendored
Normal file
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/ast.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/ast.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAwCvD,MAAM,MAAM,WAAW,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;AAkCrD,qBAAa,GAAG;;IACd,IAAI,EAAE,WAAW,GAAG,IAAI,CAAA;gBAiBtB,IAAI,EAAE,WAAW,GAAG,IAAI,EACxB,MAAM,CAAC,EAAE,GAAG,EACZ,OAAO,GAAE,gBAAqB;IAahC,IAAI,QAAQ,IAAI,OAAO,GAAG,SAAS,CAUlC;IAGD,QAAQ,IAAI,MAAM;IA+ClB,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,MAAM,GAAG,GAAG,CAAC,EAAE;IAY/B,MAAM;IAgBN,OAAO,IAAI,OAAO;IAgBlB,KAAK,IAAI,OAAO;IAYhB,MAAM,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM;IAKzB,KAAK,CAAC,MAAM,EAAE,GAAG;IAsIjB,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB;IAQ/D,WAAW,IAAI,QAAQ,GAAG,MAAM;IA2BhC,IAAI,OAAO,qBAEV;IAuED,cAAc,CACZ,QAAQ,CAAC,EAAE,OAAO,GACjB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC;CAiMjE"}
|
||||
592
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/ast.js
generated
vendored
Normal file
592
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/ast.js
generated
vendored
Normal file
@@ -0,0 +1,592 @@
|
||||
"use strict";
|
||||
// parse a single path portion
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AST = void 0;
|
||||
const brace_expressions_js_1 = require("./brace-expressions.js");
|
||||
const unescape_js_1 = require("./unescape.js");
|
||||
const types = new Set(['!', '?', '+', '*', '@']);
|
||||
const isExtglobType = (c) => types.has(c);
|
||||
// Patterns that get prepended to bind to the start of either the
|
||||
// entire string, or just a single path portion, to prevent dots
|
||||
// and/or traversal patterns, when needed.
|
||||
// Exts don't need the ^ or / bit, because the root binds that already.
|
||||
const startNoTraversal = '(?!(?:^|/)\\.\\.?(?:$|/))';
|
||||
const startNoDot = '(?!\\.)';
|
||||
// characters that indicate a start of pattern needs the "no dots" bit,
|
||||
// because a dot *might* be matched. ( is not in the list, because in
|
||||
// the case of a child extglob, it will handle the prevention itself.
|
||||
const addPatternStart = new Set(['[', '.']);
|
||||
// cases where traversal is A-OK, no dot prevention needed
|
||||
const justDots = new Set(['..', '.']);
|
||||
const reSpecials = new Set('().*{}+?[]^$\\!');
|
||||
const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
||||
// any single thing other than /
|
||||
const qmark = '[^/]';
|
||||
// * => any number of characters
|
||||
const star = qmark + '*?';
|
||||
// use + when we need to ensure that *something* matches, because the * is
|
||||
// the only thing in the path portion.
|
||||
const starNoEmpty = qmark + '+?';
|
||||
// remove the \ chars that we added if we end up doing a nonmagic compare
|
||||
// const deslash = (s: string) => s.replace(/\\(.)/g, '$1')
|
||||
class AST {
|
||||
type;
|
||||
#root;
|
||||
#hasMagic;
|
||||
#uflag = false;
|
||||
#parts = [];
|
||||
#parent;
|
||||
#parentIndex;
|
||||
#negs;
|
||||
#filledNegs = false;
|
||||
#options;
|
||||
#toString;
|
||||
// set to true if it's an extglob with no children
|
||||
// (which really means one child of '')
|
||||
#emptyExt = false;
|
||||
constructor(type, parent, options = {}) {
|
||||
this.type = type;
|
||||
// extglobs are inherently magical
|
||||
if (type)
|
||||
this.#hasMagic = true;
|
||||
this.#parent = parent;
|
||||
this.#root = this.#parent ? this.#parent.#root : this;
|
||||
this.#options = this.#root === this ? options : this.#root.#options;
|
||||
this.#negs = this.#root === this ? [] : this.#root.#negs;
|
||||
if (type === '!' && !this.#root.#filledNegs)
|
||||
this.#negs.push(this);
|
||||
this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0;
|
||||
}
|
||||
get hasMagic() {
|
||||
/* c8 ignore start */
|
||||
if (this.#hasMagic !== undefined)
|
||||
return this.#hasMagic;
|
||||
/* c8 ignore stop */
|
||||
for (const p of this.#parts) {
|
||||
if (typeof p === 'string')
|
||||
continue;
|
||||
if (p.type || p.hasMagic)
|
||||
return (this.#hasMagic = true);
|
||||
}
|
||||
// note: will be undefined until we generate the regexp src and find out
|
||||
return this.#hasMagic;
|
||||
}
|
||||
// reconstructs the pattern
|
||||
toString() {
|
||||
if (this.#toString !== undefined)
|
||||
return this.#toString;
|
||||
if (!this.type) {
|
||||
return (this.#toString = this.#parts.map(p => String(p)).join(''));
|
||||
}
|
||||
else {
|
||||
return (this.#toString =
|
||||
this.type + '(' + this.#parts.map(p => String(p)).join('|') + ')');
|
||||
}
|
||||
}
|
||||
#fillNegs() {
|
||||
/* c8 ignore start */
|
||||
if (this !== this.#root)
|
||||
throw new Error('should only call on root');
|
||||
if (this.#filledNegs)
|
||||
return this;
|
||||
/* c8 ignore stop */
|
||||
// call toString() once to fill this out
|
||||
this.toString();
|
||||
this.#filledNegs = true;
|
||||
let n;
|
||||
while ((n = this.#negs.pop())) {
|
||||
if (n.type !== '!')
|
||||
continue;
|
||||
// walk up the tree, appending everthing that comes AFTER parentIndex
|
||||
let p = n;
|
||||
let pp = p.#parent;
|
||||
while (pp) {
|
||||
for (let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) {
|
||||
for (const part of n.#parts) {
|
||||
/* c8 ignore start */
|
||||
if (typeof part === 'string') {
|
||||
throw new Error('string part in extglob AST??');
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
part.copyIn(pp.#parts[i]);
|
||||
}
|
||||
}
|
||||
p = pp;
|
||||
pp = p.#parent;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
push(...parts) {
|
||||
for (const p of parts) {
|
||||
if (p === '')
|
||||
continue;
|
||||
/* c8 ignore start */
|
||||
if (typeof p !== 'string' && !(p instanceof AST && p.#parent === this)) {
|
||||
throw new Error('invalid part: ' + p);
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
this.#parts.push(p);
|
||||
}
|
||||
}
|
||||
toJSON() {
|
||||
const ret = this.type === null
|
||||
? this.#parts.slice().map(p => (typeof p === 'string' ? p : p.toJSON()))
|
||||
: [this.type, ...this.#parts.map(p => p.toJSON())];
|
||||
if (this.isStart() && !this.type)
|
||||
ret.unshift([]);
|
||||
if (this.isEnd() &&
|
||||
(this === this.#root ||
|
||||
(this.#root.#filledNegs && this.#parent?.type === '!'))) {
|
||||
ret.push({});
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
isStart() {
|
||||
if (this.#root === this)
|
||||
return true;
|
||||
// if (this.type) return !!this.#parent?.isStart()
|
||||
if (!this.#parent?.isStart())
|
||||
return false;
|
||||
if (this.#parentIndex === 0)
|
||||
return true;
|
||||
// if everything AHEAD of this is a negation, then it's still the "start"
|
||||
const p = this.#parent;
|
||||
for (let i = 0; i < this.#parentIndex; i++) {
|
||||
const pp = p.#parts[i];
|
||||
if (!(pp instanceof AST && pp.type === '!')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
isEnd() {
|
||||
if (this.#root === this)
|
||||
return true;
|
||||
if (this.#parent?.type === '!')
|
||||
return true;
|
||||
if (!this.#parent?.isEnd())
|
||||
return false;
|
||||
if (!this.type)
|
||||
return this.#parent?.isEnd();
|
||||
// if not root, it'll always have a parent
|
||||
/* c8 ignore start */
|
||||
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
||||
/* c8 ignore stop */
|
||||
return this.#parentIndex === pl - 1;
|
||||
}
|
||||
copyIn(part) {
|
||||
if (typeof part === 'string')
|
||||
this.push(part);
|
||||
else
|
||||
this.push(part.clone(this));
|
||||
}
|
||||
clone(parent) {
|
||||
const c = new AST(this.type, parent);
|
||||
for (const p of this.#parts) {
|
||||
c.copyIn(p);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
static #parseAST(str, ast, pos, opt) {
|
||||
let escaping = false;
|
||||
let inBrace = false;
|
||||
let braceStart = -1;
|
||||
let braceNeg = false;
|
||||
if (ast.type === null) {
|
||||
// outside of a extglob, append until we find a start
|
||||
let i = pos;
|
||||
let acc = '';
|
||||
while (i < str.length) {
|
||||
const c = str.charAt(i++);
|
||||
// still accumulate escapes at this point, but we do ignore
|
||||
// starts that are escaped
|
||||
if (escaping || c === '\\') {
|
||||
escaping = !escaping;
|
||||
acc += c;
|
||||
continue;
|
||||
}
|
||||
if (inBrace) {
|
||||
if (i === braceStart + 1) {
|
||||
if (c === '^' || c === '!') {
|
||||
braceNeg = true;
|
||||
}
|
||||
}
|
||||
else if (c === ']' && !(i === braceStart + 2 && braceNeg)) {
|
||||
inBrace = false;
|
||||
}
|
||||
acc += c;
|
||||
continue;
|
||||
}
|
||||
else if (c === '[') {
|
||||
inBrace = true;
|
||||
braceStart = i;
|
||||
braceNeg = false;
|
||||
acc += c;
|
||||
continue;
|
||||
}
|
||||
if (!opt.noext && isExtglobType(c) && str.charAt(i) === '(') {
|
||||
ast.push(acc);
|
||||
acc = '';
|
||||
const ext = new AST(c, ast);
|
||||
i = AST.#parseAST(str, ext, i, opt);
|
||||
ast.push(ext);
|
||||
continue;
|
||||
}
|
||||
acc += c;
|
||||
}
|
||||
ast.push(acc);
|
||||
return i;
|
||||
}
|
||||
// some kind of extglob, pos is at the (
|
||||
// find the next | or )
|
||||
let i = pos + 1;
|
||||
let part = new AST(null, ast);
|
||||
const parts = [];
|
||||
let acc = '';
|
||||
while (i < str.length) {
|
||||
const c = str.charAt(i++);
|
||||
// still accumulate escapes at this point, but we do ignore
|
||||
// starts that are escaped
|
||||
if (escaping || c === '\\') {
|
||||
escaping = !escaping;
|
||||
acc += c;
|
||||
continue;
|
||||
}
|
||||
if (inBrace) {
|
||||
if (i === braceStart + 1) {
|
||||
if (c === '^' || c === '!') {
|
||||
braceNeg = true;
|
||||
}
|
||||
}
|
||||
else if (c === ']' && !(i === braceStart + 2 && braceNeg)) {
|
||||
inBrace = false;
|
||||
}
|
||||
acc += c;
|
||||
continue;
|
||||
}
|
||||
else if (c === '[') {
|
||||
inBrace = true;
|
||||
braceStart = i;
|
||||
braceNeg = false;
|
||||
acc += c;
|
||||
continue;
|
||||
}
|
||||
if (isExtglobType(c) && str.charAt(i) === '(') {
|
||||
part.push(acc);
|
||||
acc = '';
|
||||
const ext = new AST(c, part);
|
||||
part.push(ext);
|
||||
i = AST.#parseAST(str, ext, i, opt);
|
||||
continue;
|
||||
}
|
||||
if (c === '|') {
|
||||
part.push(acc);
|
||||
acc = '';
|
||||
parts.push(part);
|
||||
part = new AST(null, ast);
|
||||
continue;
|
||||
}
|
||||
if (c === ')') {
|
||||
if (acc === '' && ast.#parts.length === 0) {
|
||||
ast.#emptyExt = true;
|
||||
}
|
||||
part.push(acc);
|
||||
acc = '';
|
||||
ast.push(...parts, part);
|
||||
return i;
|
||||
}
|
||||
acc += c;
|
||||
}
|
||||
// unfinished extglob
|
||||
// if we got here, it was a malformed extglob! not an extglob, but
|
||||
// maybe something else in there.
|
||||
ast.type = null;
|
||||
ast.#hasMagic = undefined;
|
||||
ast.#parts = [str.substring(pos - 1)];
|
||||
return i;
|
||||
}
|
||||
static fromGlob(pattern, options = {}) {
|
||||
const ast = new AST(null, undefined, options);
|
||||
AST.#parseAST(pattern, ast, 0, options);
|
||||
return ast;
|
||||
}
|
||||
// returns the regular expression if there's magic, or the unescaped
|
||||
// string if not.
|
||||
toMMPattern() {
|
||||
// should only be called on root
|
||||
/* c8 ignore start */
|
||||
if (this !== this.#root)
|
||||
return this.#root.toMMPattern();
|
||||
/* c8 ignore stop */
|
||||
const glob = this.toString();
|
||||
const [re, body, hasMagic, uflag] = this.toRegExpSource();
|
||||
// if we're in nocase mode, and not nocaseMagicOnly, then we do
|
||||
// still need a regular expression if we have to case-insensitively
|
||||
// match capital/lowercase characters.
|
||||
const anyMagic = hasMagic ||
|
||||
this.#hasMagic ||
|
||||
(this.#options.nocase &&
|
||||
!this.#options.nocaseMagicOnly &&
|
||||
glob.toUpperCase() !== glob.toLowerCase());
|
||||
if (!anyMagic) {
|
||||
return body;
|
||||
}
|
||||
const flags = (this.#options.nocase ? 'i' : '') + (uflag ? 'u' : '');
|
||||
return Object.assign(new RegExp(`^${re}$`, flags), {
|
||||
_src: re,
|
||||
_glob: glob,
|
||||
});
|
||||
}
|
||||
get options() {
|
||||
return this.#options;
|
||||
}
|
||||
// returns the string match, the regexp source, whether there's magic
|
||||
// in the regexp (so a regular expression is required) and whether or
|
||||
// not the uflag is needed for the regular expression (for posix classes)
|
||||
// TODO: instead of injecting the start/end at this point, just return
|
||||
// the BODY of the regexp, along with the start/end portions suitable
|
||||
// for binding the start/end in either a joined full-path makeRe context
|
||||
// (where we bind to (^|/), or a standalone matchPart context (where
|
||||
// we bind to ^, and not /). Otherwise slashes get duped!
|
||||
//
|
||||
// In part-matching mode, the start is:
|
||||
// - if not isStart: nothing
|
||||
// - if traversal possible, but not allowed: ^(?!\.\.?$)
|
||||
// - if dots allowed or not possible: ^
|
||||
// - if dots possible and not allowed: ^(?!\.)
|
||||
// end is:
|
||||
// - if not isEnd(): nothing
|
||||
// - else: $
|
||||
//
|
||||
// In full-path matching mode, we put the slash at the START of the
|
||||
// pattern, so start is:
|
||||
// - if first pattern: same as part-matching mode
|
||||
// - if not isStart(): nothing
|
||||
// - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
|
||||
// - if dots allowed or not possible: /
|
||||
// - if dots possible and not allowed: /(?!\.)
|
||||
// end is:
|
||||
// - if last pattern, same as part-matching mode
|
||||
// - else nothing
|
||||
//
|
||||
// Always put the (?:$|/) on negated tails, though, because that has to be
|
||||
// there to bind the end of the negated pattern portion, and it's easier to
|
||||
// just stick it in now rather than try to inject it later in the middle of
|
||||
// the pattern.
|
||||
//
|
||||
// We can just always return the same end, and leave it up to the caller
|
||||
// to know whether it's going to be used joined or in parts.
|
||||
// And, if the start is adjusted slightly, can do the same there:
|
||||
// - if not isStart: nothing
|
||||
// - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
|
||||
// - if dots allowed or not possible: (?:/|^)
|
||||
// - if dots possible and not allowed: (?:/|^)(?!\.)
|
||||
//
|
||||
// But it's better to have a simpler binding without a conditional, for
|
||||
// performance, so probably better to return both start options.
|
||||
//
|
||||
// Then the caller just ignores the end if it's not the first pattern,
|
||||
// and the start always gets applied.
|
||||
//
|
||||
// But that's always going to be $ if it's the ending pattern, or nothing,
|
||||
// so the caller can just attach $ at the end of the pattern when building.
|
||||
//
|
||||
// So the todo is:
|
||||
// - better detect what kind of start is needed
|
||||
// - return both flavors of starting pattern
|
||||
// - attach $ at the end of the pattern when creating the actual RegExp
|
||||
//
|
||||
// Ah, but wait, no, that all only applies to the root when the first pattern
|
||||
// is not an extglob. If the first pattern IS an extglob, then we need all
|
||||
// that dot prevention biz to live in the extglob portions, because eg
|
||||
// +(*|.x*) can match .xy but not .yx.
|
||||
//
|
||||
// So, return the two flavors if it's #root and the first child is not an
|
||||
// AST, otherwise leave it to the child AST to handle it, and there,
|
||||
// use the (?:^|/) style of start binding.
|
||||
//
|
||||
// Even simplified further:
|
||||
// - Since the start for a join is eg /(?!\.) and the start for a part
|
||||
// is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
|
||||
// or start or whatever) and prepend ^ or / at the Regexp construction.
|
||||
toRegExpSource(allowDot) {
|
||||
const dot = allowDot ?? !!this.#options.dot;
|
||||
if (this.#root === this)
|
||||
this.#fillNegs();
|
||||
if (!this.type) {
|
||||
const noEmpty = this.isStart() && this.isEnd();
|
||||
const src = this.#parts
|
||||
.map(p => {
|
||||
const [re, _, hasMagic, uflag] = typeof p === 'string'
|
||||
? AST.#parseGlob(p, this.#hasMagic, noEmpty)
|
||||
: p.toRegExpSource(allowDot);
|
||||
this.#hasMagic = this.#hasMagic || hasMagic;
|
||||
this.#uflag = this.#uflag || uflag;
|
||||
return re;
|
||||
})
|
||||
.join('');
|
||||
let start = '';
|
||||
if (this.isStart()) {
|
||||
if (typeof this.#parts[0] === 'string') {
|
||||
// this is the string that will match the start of the pattern,
|
||||
// so we need to protect against dots and such.
|
||||
// '.' and '..' cannot match unless the pattern is that exactly,
|
||||
// even if it starts with . or dot:true is set.
|
||||
const dotTravAllowed = this.#parts.length === 1 && justDots.has(this.#parts[0]);
|
||||
if (!dotTravAllowed) {
|
||||
const aps = addPatternStart;
|
||||
// check if we have a possibility of matching . or ..,
|
||||
// and prevent that.
|
||||
const needNoTrav =
|
||||
// dots are allowed, and the pattern starts with [ or .
|
||||
(dot && aps.has(src.charAt(0))) ||
|
||||
// the pattern starts with \., and then [ or .
|
||||
(src.startsWith('\\.') && aps.has(src.charAt(2))) ||
|
||||
// the pattern starts with \.\., and then [ or .
|
||||
(src.startsWith('\\.\\.') && aps.has(src.charAt(4)));
|
||||
// no need to prevent dots if it can't match a dot, or if a
|
||||
// sub-pattern will be preventing it anyway.
|
||||
const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
|
||||
start = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : '';
|
||||
}
|
||||
}
|
||||
}
|
||||
// append the "end of path portion" pattern to negation tails
|
||||
let end = '';
|
||||
if (this.isEnd() &&
|
||||
this.#root.#filledNegs &&
|
||||
this.#parent?.type === '!') {
|
||||
end = '(?:$|\\/)';
|
||||
}
|
||||
const final = start + src + end;
|
||||
return [
|
||||
final,
|
||||
(0, unescape_js_1.unescape)(src),
|
||||
(this.#hasMagic = !!this.#hasMagic),
|
||||
this.#uflag,
|
||||
];
|
||||
}
|
||||
// We need to calculate the body *twice* if it's a repeat pattern
|
||||
// at the start, once in nodot mode, then again in dot mode, so a
|
||||
// pattern like *(?) can match 'x.y'
|
||||
const repeated = this.type === '*' || this.type === '+';
|
||||
// some kind of extglob
|
||||
const start = this.type === '!' ? '(?:(?!(?:' : '(?:';
|
||||
let body = this.#partsToRegExp(dot);
|
||||
if (this.isStart() && this.isEnd() && !body && this.type !== '!') {
|
||||
// invalid extglob, has to at least be *something* present, if it's
|
||||
// the entire path portion.
|
||||
const s = this.toString();
|
||||
this.#parts = [s];
|
||||
this.type = null;
|
||||
this.#hasMagic = undefined;
|
||||
return [s, (0, unescape_js_1.unescape)(this.toString()), false, false];
|
||||
}
|
||||
// XXX abstract out this map method
|
||||
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot
|
||||
? ''
|
||||
: this.#partsToRegExp(true);
|
||||
if (bodyDotAllowed === body) {
|
||||
bodyDotAllowed = '';
|
||||
}
|
||||
if (bodyDotAllowed) {
|
||||
body = `(?:${body})(?:${bodyDotAllowed})*?`;
|
||||
}
|
||||
// an empty !() is exactly equivalent to a starNoEmpty
|
||||
let final = '';
|
||||
if (this.type === '!' && this.#emptyExt) {
|
||||
final = (this.isStart() && !dot ? startNoDot : '') + starNoEmpty;
|
||||
}
|
||||
else {
|
||||
const close = this.type === '!'
|
||||
? // !() must match something,but !(x) can match ''
|
||||
'))' +
|
||||
(this.isStart() && !dot && !allowDot ? startNoDot : '') +
|
||||
star +
|
||||
')'
|
||||
: this.type === '@'
|
||||
? ')'
|
||||
: this.type === '?'
|
||||
? ')?'
|
||||
: this.type === '+' && bodyDotAllowed
|
||||
? ')'
|
||||
: this.type === '*' && bodyDotAllowed
|
||||
? `)?`
|
||||
: `)${this.type}`;
|
||||
final = start + body + close;
|
||||
}
|
||||
return [
|
||||
final,
|
||||
(0, unescape_js_1.unescape)(body),
|
||||
(this.#hasMagic = !!this.#hasMagic),
|
||||
this.#uflag,
|
||||
];
|
||||
}
|
||||
#partsToRegExp(dot) {
|
||||
return this.#parts
|
||||
.map(p => {
|
||||
// extglob ASTs should only contain parent ASTs
|
||||
/* c8 ignore start */
|
||||
if (typeof p === 'string') {
|
||||
throw new Error('string type in extglob ast??');
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
// can ignore hasMagic, because extglobs are already always magic
|
||||
const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot);
|
||||
this.#uflag = this.#uflag || uflag;
|
||||
return re;
|
||||
})
|
||||
.filter(p => !(this.isStart() && this.isEnd()) || !!p)
|
||||
.join('|');
|
||||
}
|
||||
static #parseGlob(glob, hasMagic, noEmpty = false) {
|
||||
let escaping = false;
|
||||
let re = '';
|
||||
let uflag = false;
|
||||
for (let i = 0; i < glob.length; i++) {
|
||||
const c = glob.charAt(i);
|
||||
if (escaping) {
|
||||
escaping = false;
|
||||
re += (reSpecials.has(c) ? '\\' : '') + c;
|
||||
continue;
|
||||
}
|
||||
if (c === '\\') {
|
||||
if (i === glob.length - 1) {
|
||||
re += '\\\\';
|
||||
}
|
||||
else {
|
||||
escaping = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (c === '[') {
|
||||
const [src, needUflag, consumed, magic] = (0, brace_expressions_js_1.parseClass)(glob, i);
|
||||
if (consumed) {
|
||||
re += src;
|
||||
uflag = uflag || needUflag;
|
||||
i += consumed - 1;
|
||||
hasMagic = hasMagic || magic;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (c === '*') {
|
||||
if (noEmpty && glob === '*')
|
||||
re += starNoEmpty;
|
||||
else
|
||||
re += star;
|
||||
hasMagic = true;
|
||||
continue;
|
||||
}
|
||||
if (c === '?') {
|
||||
re += qmark;
|
||||
hasMagic = true;
|
||||
continue;
|
||||
}
|
||||
re += regExpEscape(c);
|
||||
}
|
||||
return [re, (0, unescape_js_1.unescape)(glob), !!hasMagic, uflag];
|
||||
}
|
||||
}
|
||||
exports.AST = AST;
|
||||
//# sourceMappingURL=ast.js.map
|
||||
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/ast.js.map
generated
vendored
Normal file
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/ast.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts
generated
vendored
Normal file
8
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export type ParseClassResult = [
|
||||
src: string,
|
||||
uFlag: boolean,
|
||||
consumed: number,
|
||||
hasMagic: boolean
|
||||
];
|
||||
export declare const parseClass: (glob: string, position: number) => ParseClassResult;
|
||||
//# sourceMappingURL=brace-expressions.d.ts.map
|
||||
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map
generated
vendored
Normal file
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"brace-expressions.d.ts","sourceRoot":"","sources":["../../src/brace-expressions.ts"],"names":[],"mappings":"AA+BA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,MAAM;IACX,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,MAAM;IAChB,QAAQ,EAAE,OAAO;CAClB,CAAA;AAQD,eAAO,MAAM,UAAU,SACf,MAAM,YACF,MAAM,KACf,gBA6HF,CAAA"}
|
||||
152
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/brace-expressions.js
generated
vendored
Normal file
152
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/brace-expressions.js
generated
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
"use strict";
|
||||
// translate the various posix character classes into unicode properties
|
||||
// this works across all unicode locales
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseClass = void 0;
|
||||
// { <posix class>: [<translation>, /u flag required, negated]
|
||||
const posixClasses = {
|
||||
'[:alnum:]': ['\\p{L}\\p{Nl}\\p{Nd}', true],
|
||||
'[:alpha:]': ['\\p{L}\\p{Nl}', true],
|
||||
'[:ascii:]': ['\\x' + '00-\\x' + '7f', false],
|
||||
'[:blank:]': ['\\p{Zs}\\t', true],
|
||||
'[:cntrl:]': ['\\p{Cc}', true],
|
||||
'[:digit:]': ['\\p{Nd}', true],
|
||||
'[:graph:]': ['\\p{Z}\\p{C}', true, true],
|
||||
'[:lower:]': ['\\p{Ll}', true],
|
||||
'[:print:]': ['\\p{C}', true],
|
||||
'[:punct:]': ['\\p{P}', true],
|
||||
'[:space:]': ['\\p{Z}\\t\\r\\n\\v\\f', true],
|
||||
'[:upper:]': ['\\p{Lu}', true],
|
||||
'[:word:]': ['\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}', true],
|
||||
'[:xdigit:]': ['A-Fa-f0-9', false],
|
||||
};
|
||||
// only need to escape a few things inside of brace expressions
|
||||
// escapes: [ \ ] -
|
||||
const braceEscape = (s) => s.replace(/[[\]\\-]/g, '\\$&');
|
||||
// escape all regexp magic characters
|
||||
const regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
||||
// everything has already been escaped, we just have to join
|
||||
const rangesToString = (ranges) => ranges.join('');
|
||||
// takes a glob string at a posix brace expression, and returns
|
||||
// an equivalent regular expression source, and boolean indicating
|
||||
// whether the /u flag needs to be applied, and the number of chars
|
||||
// consumed to parse the character class.
|
||||
// This also removes out of order ranges, and returns ($.) if the
|
||||
// entire class just no good.
|
||||
const parseClass = (glob, position) => {
|
||||
const pos = position;
|
||||
/* c8 ignore start */
|
||||
if (glob.charAt(pos) !== '[') {
|
||||
throw new Error('not in a brace expression');
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
const ranges = [];
|
||||
const negs = [];
|
||||
let i = pos + 1;
|
||||
let sawStart = false;
|
||||
let uflag = false;
|
||||
let escaping = false;
|
||||
let negate = false;
|
||||
let endPos = pos;
|
||||
let rangeStart = '';
|
||||
WHILE: while (i < glob.length) {
|
||||
const c = glob.charAt(i);
|
||||
if ((c === '!' || c === '^') && i === pos + 1) {
|
||||
negate = true;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (c === ']' && sawStart && !escaping) {
|
||||
endPos = i + 1;
|
||||
break;
|
||||
}
|
||||
sawStart = true;
|
||||
if (c === '\\') {
|
||||
if (!escaping) {
|
||||
escaping = true;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
// escaped \ char, fall through and treat like normal char
|
||||
}
|
||||
if (c === '[' && !escaping) {
|
||||
// either a posix class, a collation equivalent, or just a [
|
||||
for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
|
||||
if (glob.startsWith(cls, i)) {
|
||||
// invalid, [a-[] is fine, but not [a-[:alpha]]
|
||||
if (rangeStart) {
|
||||
return ['$.', false, glob.length - pos, true];
|
||||
}
|
||||
i += cls.length;
|
||||
if (neg)
|
||||
negs.push(unip);
|
||||
else
|
||||
ranges.push(unip);
|
||||
uflag = uflag || u;
|
||||
continue WHILE;
|
||||
}
|
||||
}
|
||||
}
|
||||
// now it's just a normal character, effectively
|
||||
escaping = false;
|
||||
if (rangeStart) {
|
||||
// throw this range away if it's not valid, but others
|
||||
// can still match.
|
||||
if (c > rangeStart) {
|
||||
ranges.push(braceEscape(rangeStart) + '-' + braceEscape(c));
|
||||
}
|
||||
else if (c === rangeStart) {
|
||||
ranges.push(braceEscape(c));
|
||||
}
|
||||
rangeStart = '';
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
// now might be the start of a range.
|
||||
// can be either c-d or c-] or c<more...>] or c] at this point
|
||||
if (glob.startsWith('-]', i + 1)) {
|
||||
ranges.push(braceEscape(c + '-'));
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
if (glob.startsWith('-', i + 1)) {
|
||||
rangeStart = c;
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
// not the start of a range, just a single character
|
||||
ranges.push(braceEscape(c));
|
||||
i++;
|
||||
}
|
||||
if (endPos < i) {
|
||||
// didn't see the end of the class, not a valid class,
|
||||
// but might still be valid as a literal match.
|
||||
return ['', false, 0, false];
|
||||
}
|
||||
// if we got no ranges and no negates, then we have a range that
|
||||
// cannot possibly match anything, and that poisons the whole glob
|
||||
if (!ranges.length && !negs.length) {
|
||||
return ['$.', false, glob.length - pos, true];
|
||||
}
|
||||
// if we got one positive range, and it's a single character, then that's
|
||||
// not actually a magic pattern, it's just that one literal character.
|
||||
// we should not treat that as "magic", we should just return the literal
|
||||
// character. [_] is a perfectly valid way to escape glob magic chars.
|
||||
if (negs.length === 0 &&
|
||||
ranges.length === 1 &&
|
||||
/^\\?.$/.test(ranges[0]) &&
|
||||
!negate) {
|
||||
const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
|
||||
return [regexpEscape(r), false, endPos - pos, false];
|
||||
}
|
||||
const sranges = '[' + (negate ? '^' : '') + rangesToString(ranges) + ']';
|
||||
const snegs = '[' + (negate ? '' : '^') + rangesToString(negs) + ']';
|
||||
const comb = ranges.length && negs.length
|
||||
? '(' + sranges + '|' + snegs + ')'
|
||||
: ranges.length
|
||||
? sranges
|
||||
: snegs;
|
||||
return [comb, uflag, endPos - pos, true];
|
||||
};
|
||||
exports.parseClass = parseClass;
|
||||
//# sourceMappingURL=brace-expressions.js.map
|
||||
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/brace-expressions.js.map
generated
vendored
Normal file
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/brace-expressions.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
12
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/escape.d.ts
generated
vendored
Normal file
12
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/escape.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { MinimatchOptions } from './index.js';
|
||||
/**
|
||||
* Escape all magic characters in a glob pattern.
|
||||
*
|
||||
* If the {@link windowsPathsNoEscape | GlobOptions.windowsPathsNoEscape}
|
||||
* option is used, then characters are escaped by wrapping in `[]`, because
|
||||
* a magic character wrapped in a character class can only be satisfied by
|
||||
* that exact character. In this mode, `\` is _not_ escaped, because it is
|
||||
* not interpreted as a magic character, but instead as a path separator.
|
||||
*/
|
||||
export declare const escape: (s: string, { windowsPathsNoEscape, }?: Pick<MinimatchOptions, "windowsPathsNoEscape">) => string;
|
||||
//# sourceMappingURL=escape.d.ts.map
|
||||
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/escape.d.ts.map
generated
vendored
Normal file
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/escape.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"escape.d.ts","sourceRoot":"","sources":["../../src/escape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,MACd,MAAM,8BAGN,IAAI,CAAC,gBAAgB,EAAE,sBAAsB,CAAC,WAQlD,CAAA"}
|
||||
22
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/escape.js
generated
vendored
Normal file
22
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/escape.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.escape = void 0;
|
||||
/**
|
||||
* Escape all magic characters in a glob pattern.
|
||||
*
|
||||
* If the {@link windowsPathsNoEscape | GlobOptions.windowsPathsNoEscape}
|
||||
* option is used, then characters are escaped by wrapping in `[]`, because
|
||||
* a magic character wrapped in a character class can only be satisfied by
|
||||
* that exact character. In this mode, `\` is _not_ escaped, because it is
|
||||
* not interpreted as a magic character, but instead as a path separator.
|
||||
*/
|
||||
const escape = (s, { windowsPathsNoEscape = false, } = {}) => {
|
||||
// don't need to escape +@! because we escape the parens
|
||||
// that make those magic, and escaping ! as [!] isn't valid,
|
||||
// because [!]] is a valid glob class meaning not ']'.
|
||||
return windowsPathsNoEscape
|
||||
? s.replace(/[?*()[\]]/g, '[$&]')
|
||||
: s.replace(/[?*()[\]\\]/g, '\\$&');
|
||||
};
|
||||
exports.escape = escape;
|
||||
//# sourceMappingURL=escape.js.map
|
||||
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/escape.js.map
generated
vendored
Normal file
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/escape.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"escape.js","sourceRoot":"","sources":["../../src/escape.ts"],"names":[],"mappings":";;;AACA;;;;;;;;GAQG;AACI,MAAM,MAAM,GAAG,CACpB,CAAS,EACT,EACE,oBAAoB,GAAG,KAAK,MACsB,EAAE,EACtD,EAAE;IACF,wDAAwD;IACxD,4DAA4D;IAC5D,sDAAsD;IACtD,OAAO,oBAAoB;QACzB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC;QACjC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA;AACvC,CAAC,CAAA;AAZY,QAAA,MAAM,UAYlB","sourcesContent":["import { MinimatchOptions } from './index.js'\n/**\n * Escape all magic characters in a glob pattern.\n *\n * If the {@link windowsPathsNoEscape | GlobOptions.windowsPathsNoEscape}\n * option is used, then characters are escaped by wrapping in `[]`, because\n * a magic character wrapped in a character class can only be satisfied by\n * that exact character. In this mode, `\\` is _not_ escaped, because it is\n * not interpreted as a magic character, but instead as a path separator.\n */\nexport const escape = (\n s: string,\n {\n windowsPathsNoEscape = false,\n }: Pick<MinimatchOptions, 'windowsPathsNoEscape'> = {}\n) => {\n // don't need to escape +@! because we escape the parens\n // that make those magic, and escaping ! as [!] isn't valid,\n // because [!]] is a valid glob class meaning not ']'.\n return windowsPathsNoEscape\n ? s.replace(/[?*()[\\]]/g, '[$&]')\n : s.replace(/[?*()[\\]\\\\]/g, '\\\\$&')\n}\n"]}
|
||||
94
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/index.d.ts
generated
vendored
Normal file
94
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
import { AST } from './ast.js';
|
||||
type Platform = 'aix' | 'android' | 'darwin' | 'freebsd' | 'haiku' | 'linux' | 'openbsd' | 'sunos' | 'win32' | 'cygwin' | 'netbsd';
|
||||
export interface MinimatchOptions {
|
||||
nobrace?: boolean;
|
||||
nocomment?: boolean;
|
||||
nonegate?: boolean;
|
||||
debug?: boolean;
|
||||
noglobstar?: boolean;
|
||||
noext?: boolean;
|
||||
nonull?: boolean;
|
||||
windowsPathsNoEscape?: boolean;
|
||||
allowWindowsEscape?: boolean;
|
||||
partial?: boolean;
|
||||
dot?: boolean;
|
||||
nocase?: boolean;
|
||||
nocaseMagicOnly?: boolean;
|
||||
magicalBraces?: boolean;
|
||||
matchBase?: boolean;
|
||||
flipNegate?: boolean;
|
||||
preserveMultipleSlashes?: boolean;
|
||||
optimizationLevel?: number;
|
||||
platform?: Platform;
|
||||
windowsNoMagicRoot?: boolean;
|
||||
}
|
||||
export declare const minimatch: {
|
||||
(p: string, pattern: string, options?: MinimatchOptions): boolean;
|
||||
sep: Sep;
|
||||
GLOBSTAR: typeof GLOBSTAR;
|
||||
filter: (pattern: string, options?: MinimatchOptions) => (p: string) => boolean;
|
||||
defaults: (def: MinimatchOptions) => typeof minimatch;
|
||||
braceExpand: (pattern: string, options?: MinimatchOptions) => string[];
|
||||
makeRe: (pattern: string, options?: MinimatchOptions) => false | MMRegExp;
|
||||
match: (list: string[], pattern: string, options?: MinimatchOptions) => string[];
|
||||
AST: typeof AST;
|
||||
Minimatch: typeof Minimatch;
|
||||
escape: (s: string, { windowsPathsNoEscape, }?: Pick<MinimatchOptions, "windowsPathsNoEscape">) => string;
|
||||
unescape: (s: string, { windowsPathsNoEscape, }?: Pick<MinimatchOptions, "windowsPathsNoEscape">) => string;
|
||||
};
|
||||
type Sep = '\\' | '/';
|
||||
export declare const sep: Sep;
|
||||
export declare const GLOBSTAR: unique symbol;
|
||||
export declare const filter: (pattern: string, options?: MinimatchOptions) => (p: string) => boolean;
|
||||
export declare const defaults: (def: MinimatchOptions) => typeof minimatch;
|
||||
export declare const braceExpand: (pattern: string, options?: MinimatchOptions) => string[];
|
||||
export declare const makeRe: (pattern: string, options?: MinimatchOptions) => false | MMRegExp;
|
||||
export declare const match: (list: string[], pattern: string, options?: MinimatchOptions) => string[];
|
||||
export type MMRegExp = RegExp & {
|
||||
_src?: string;
|
||||
_glob?: string;
|
||||
};
|
||||
export type ParseReturnFiltered = string | MMRegExp | typeof GLOBSTAR;
|
||||
export type ParseReturn = ParseReturnFiltered | false;
|
||||
export declare class Minimatch {
|
||||
options: MinimatchOptions;
|
||||
set: ParseReturnFiltered[][];
|
||||
pattern: string;
|
||||
windowsPathsNoEscape: boolean;
|
||||
nonegate: boolean;
|
||||
negate: boolean;
|
||||
comment: boolean;
|
||||
empty: boolean;
|
||||
preserveMultipleSlashes: boolean;
|
||||
partial: boolean;
|
||||
globSet: string[];
|
||||
globParts: string[][];
|
||||
nocase: boolean;
|
||||
isWindows: boolean;
|
||||
platform: Platform;
|
||||
windowsNoMagicRoot: boolean;
|
||||
regexp: false | null | MMRegExp;
|
||||
constructor(pattern: string, options?: MinimatchOptions);
|
||||
hasMagic(): boolean;
|
||||
debug(..._: any[]): void;
|
||||
make(): void;
|
||||
preprocess(globParts: string[][]): string[][];
|
||||
adjascentGlobstarOptimize(globParts: string[][]): string[][];
|
||||
levelOneOptimize(globParts: string[][]): string[][];
|
||||
levelTwoFileOptimize(parts: string | string[]): string[];
|
||||
firstPhasePreProcess(globParts: string[][]): string[][];
|
||||
secondPhasePreProcess(globParts: string[][]): string[][];
|
||||
partsMatch(a: string[], b: string[], emptyGSMatch?: boolean): false | string[];
|
||||
parseNegate(): void;
|
||||
matchOne(file: string[], pattern: ParseReturn[], partial?: boolean): boolean;
|
||||
braceExpand(): string[];
|
||||
parse(pattern: string): ParseReturn;
|
||||
makeRe(): false | MMRegExp;
|
||||
slashSplit(p: string): string[];
|
||||
match(f: string, partial?: boolean): boolean;
|
||||
static defaults(def: MinimatchOptions): typeof Minimatch;
|
||||
}
|
||||
export { AST } from './ast.js';
|
||||
export { escape } from './escape.js';
|
||||
export { unescape } from './unescape.js';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAe,MAAM,UAAU,CAAA;AAI3C,KAAK,QAAQ,GACT,KAAK,GACL,SAAS,GACT,QAAQ,GACR,SAAS,GACT,OAAO,GACP,OAAO,GACP,SAAS,GACT,OAAO,GACP,OAAO,GACP,QAAQ,GACR,QAAQ,CAAA;AAEZ,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B;AAED,eAAO,MAAM,SAAS;QACjB,MAAM,WACA,MAAM,YACN,gBAAgB;;;sBAuGf,MAAM,YAAW,gBAAgB,SACvC,MAAM;oBAOkB,gBAAgB,KAAG,OAAO,SAAS;2BA6EtD,MAAM,YACN,gBAAgB;sBA2BK,MAAM,YAAW,gBAAgB;kBAKzD,MAAM,EAAE,WACL,MAAM,YACN,gBAAgB;;;;;CArN1B,CAAA;AA+DD,KAAK,GAAG,GAAG,IAAI,GAAG,GAAG,CAAA;AAOrB,eAAO,MAAM,GAAG,KAAgE,CAAA;AAGhF,eAAO,MAAM,QAAQ,eAAwB,CAAA;AAmB7C,eAAO,MAAM,MAAM,YACP,MAAM,YAAW,gBAAgB,SACvC,MAAM,YACsB,CAAA;AAMlC,eAAO,MAAM,QAAQ,QAAS,gBAAgB,KAAG,OAAO,SA+DvD,CAAA;AAaD,eAAO,MAAM,WAAW,YACb,MAAM,YACN,gBAAgB,aAY1B,CAAA;AAeD,eAAO,MAAM,MAAM,YAAa,MAAM,YAAW,gBAAgB,qBACvB,CAAA;AAG1C,eAAO,MAAM,KAAK,SACV,MAAM,EAAE,WACL,MAAM,YACN,gBAAgB,aAQ1B,CAAA;AAQD,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,QAAQ,CAAA;AACrE,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG,KAAK,CAAA;AAErD,qBAAa,SAAS;IACpB,OAAO,EAAE,gBAAgB,CAAA;IACzB,GAAG,EAAE,mBAAmB,EAAE,EAAE,CAAA;IAC5B,OAAO,EAAE,MAAM,CAAA;IAEf,oBAAoB,EAAE,OAAO,CAAA;IAC7B,QAAQ,EAAE,OAAO,CAAA;IACjB,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,OAAO,CAAA;IACd,uBAAuB,EAAE,OAAO,CAAA;IAChC,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,SAAS,EAAE,MAAM,EAAE,EAAE,CAAA;IACrB,MAAM,EAAE,OAAO,CAAA;IAEf,SAAS,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,QAAQ,CAAA;IAClB,kBAAkB,EAAE,OAAO,CAAA;IAE3B,MAAM,EAAE,KAAK,GAAG,IAAI,GAAG,QAAQ,CAAA;gBACnB,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB;IAkC3D,QAAQ,IAAI,OAAO;IAYnB,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE;IAEjB,IAAI;IA0FJ,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE;IA8BhC,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE;IAiB/C,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE;IAoBtC,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IA6D7C,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE;IA0F1C,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE;IAkBxD,UAAU,CACR,CAAC,EAAE,MAAM,EAAE,EACX,CAAC,EAAE,MAAM,EAAE,EACX,YAAY,GAAE,OAAe,GAC5B,KAAK,GAAG,MAAM,EAAE;IA+CnB,WAAW;IAqBX,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,OAAO,GAAE,OAAe;IAiNzE,WAAW;IAIX,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW;IAiDnC,MAAM;IAsFN,UAAU,CAAC,CAAC,EAAE,MAAM;IAepB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,UAAe;IAiEvC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,gBAAgB;CAGtC;AAED,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA"}
|
||||
1014
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/index.js
generated
vendored
Normal file
1014
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/index.js.map
generated
vendored
Normal file
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/package.json
generated
vendored
Normal file
3
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "commonjs"
|
||||
}
|
||||
17
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/unescape.d.ts
generated
vendored
Normal file
17
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/unescape.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import { MinimatchOptions } from './index.js';
|
||||
/**
|
||||
* Un-escape a string that has been escaped with {@link escape}.
|
||||
*
|
||||
* If the {@link windowsPathsNoEscape} option is used, then square-brace
|
||||
* escapes are removed, but not backslash escapes. For example, it will turn
|
||||
* the string `'[*]'` into `*`, but it will not turn `'\\*'` into `'*'`,
|
||||
* becuase `\` is a path separator in `windowsPathsNoEscape` mode.
|
||||
*
|
||||
* When `windowsPathsNoEscape` is not set, then both brace escapes and
|
||||
* backslash escapes are removed.
|
||||
*
|
||||
* Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped
|
||||
* or unescaped.
|
||||
*/
|
||||
export declare const unescape: (s: string, { windowsPathsNoEscape, }?: Pick<MinimatchOptions, "windowsPathsNoEscape">) => string;
|
||||
//# sourceMappingURL=unescape.d.ts.map
|
||||
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/unescape.d.ts.map
generated
vendored
Normal file
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/unescape.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"unescape.d.ts","sourceRoot":"","sources":["../../src/unescape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ,MAChB,MAAM,8BAGN,IAAI,CAAC,gBAAgB,EAAE,sBAAsB,CAAC,WAKlD,CAAA"}
|
||||
24
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/unescape.js
generated
vendored
Normal file
24
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/unescape.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.unescape = void 0;
|
||||
/**
|
||||
* Un-escape a string that has been escaped with {@link escape}.
|
||||
*
|
||||
* If the {@link windowsPathsNoEscape} option is used, then square-brace
|
||||
* escapes are removed, but not backslash escapes. For example, it will turn
|
||||
* the string `'[*]'` into `*`, but it will not turn `'\\*'` into `'*'`,
|
||||
* becuase `\` is a path separator in `windowsPathsNoEscape` mode.
|
||||
*
|
||||
* When `windowsPathsNoEscape` is not set, then both brace escapes and
|
||||
* backslash escapes are removed.
|
||||
*
|
||||
* Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped
|
||||
* or unescaped.
|
||||
*/
|
||||
const unescape = (s, { windowsPathsNoEscape = false, } = {}) => {
|
||||
return windowsPathsNoEscape
|
||||
? s.replace(/\[([^\/\\])\]/g, '$1')
|
||||
: s.replace(/((?!\\).|^)\[([^\/\\])\]/g, '$1$2').replace(/\\([^\/])/g, '$1');
|
||||
};
|
||||
exports.unescape = unescape;
|
||||
//# sourceMappingURL=unescape.js.map
|
||||
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/unescape.js.map
generated
vendored
Normal file
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/commonjs/unescape.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"unescape.js","sourceRoot":"","sources":["../../src/unescape.ts"],"names":[],"mappings":";;;AACA;;;;;;;;;;;;;GAaG;AACI,MAAM,QAAQ,GAAG,CACtB,CAAS,EACT,EACE,oBAAoB,GAAG,KAAK,MACsB,EAAE,EACtD,EAAE;IACF,OAAO,oBAAoB;QACzB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,EAAE,IAAI,CAAC;QACnC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;AAChF,CAAC,CAAA;AATY,QAAA,QAAQ,YASpB","sourcesContent":["import { MinimatchOptions } from './index.js'\n/**\n * Un-escape a string that has been escaped with {@link escape}.\n *\n * If the {@link windowsPathsNoEscape} option is used, then square-brace\n * escapes are removed, but not backslash escapes. For example, it will turn\n * the string `'[*]'` into `*`, but it will not turn `'\\\\*'` into `'*'`,\n * becuase `\\` is a path separator in `windowsPathsNoEscape` mode.\n *\n * When `windowsPathsNoEscape` is not set, then both brace escapes and\n * backslash escapes are removed.\n *\n * Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped\n * or unescaped.\n */\nexport const unescape = (\n s: string,\n {\n windowsPathsNoEscape = false,\n }: Pick<MinimatchOptions, 'windowsPathsNoEscape'> = {}\n) => {\n return windowsPathsNoEscape\n ? s.replace(/\\[([^\\/\\\\])\\]/g, '$1')\n : s.replace(/((?!\\\\).|^)\\[([^\\/\\\\])\\]/g, '$1$2').replace(/\\\\([^\\/])/g, '$1')\n}\n"]}
|
||||
2
node_modules/@ts-morph/common/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts
generated
vendored
Normal file
2
node_modules/@ts-morph/common/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare const assertValidPattern: (pattern: any) => void;
|
||||
//# sourceMappingURL=assert-valid-pattern.d.ts.map
|
||||
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map
generated
vendored
Normal file
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"assert-valid-pattern.d.ts","sourceRoot":"","sources":["../../src/assert-valid-pattern.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,kBAAkB,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAUlD,CAAA"}
|
||||
10
node_modules/@ts-morph/common/node_modules/minimatch/dist/esm/assert-valid-pattern.js
generated
vendored
Normal file
10
node_modules/@ts-morph/common/node_modules/minimatch/dist/esm/assert-valid-pattern.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
const MAX_PATTERN_LENGTH = 1024 * 64;
|
||||
export const assertValidPattern = (pattern) => {
|
||||
if (typeof pattern !== 'string') {
|
||||
throw new TypeError('invalid pattern');
|
||||
}
|
||||
if (pattern.length > MAX_PATTERN_LENGTH) {
|
||||
throw new TypeError('pattern is too long');
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=assert-valid-pattern.js.map
|
||||
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map
generated
vendored
Normal file
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"assert-valid-pattern.js","sourceRoot":"","sources":["../../src/assert-valid-pattern.ts"],"names":[],"mappings":"AAAA,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAE,CAAA;AACpC,MAAM,CAAC,MAAM,kBAAkB,GAA2B,CACxD,OAAY,EACe,EAAE;IAC7B,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,MAAM,IAAI,SAAS,CAAC,iBAAiB,CAAC,CAAA;IACxC,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,kBAAkB,EAAE,CAAC;QACxC,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAA;IAC5C,CAAC;AACH,CAAC,CAAA","sourcesContent":["const MAX_PATTERN_LENGTH = 1024 * 64\nexport const assertValidPattern: (pattern: any) => void = (\n pattern: any\n): asserts pattern is string => {\n if (typeof pattern !== 'string') {\n throw new TypeError('invalid pattern')\n }\n\n if (pattern.length > MAX_PATTERN_LENGTH) {\n throw new TypeError('pattern is too long')\n }\n}\n"]}
|
||||
20
node_modules/@ts-morph/common/node_modules/minimatch/dist/esm/ast.d.ts
generated
vendored
Normal file
20
node_modules/@ts-morph/common/node_modules/minimatch/dist/esm/ast.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import { MinimatchOptions, MMRegExp } from './index.js';
|
||||
export type ExtglobType = '!' | '?' | '+' | '*' | '@';
|
||||
export declare class AST {
|
||||
#private;
|
||||
type: ExtglobType | null;
|
||||
constructor(type: ExtglobType | null, parent?: AST, options?: MinimatchOptions);
|
||||
get hasMagic(): boolean | undefined;
|
||||
toString(): string;
|
||||
push(...parts: (string | AST)[]): void;
|
||||
toJSON(): any[];
|
||||
isStart(): boolean;
|
||||
isEnd(): boolean;
|
||||
copyIn(part: AST | string): void;
|
||||
clone(parent: AST): AST;
|
||||
static fromGlob(pattern: string, options?: MinimatchOptions): AST;
|
||||
toMMPattern(): MMRegExp | string;
|
||||
get options(): MinimatchOptions;
|
||||
toRegExpSource(allowDot?: boolean): [re: string, body: string, hasMagic: boolean, uflag: boolean];
|
||||
}
|
||||
//# sourceMappingURL=ast.d.ts.map
|
||||
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/esm/ast.d.ts.map
generated
vendored
Normal file
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/esm/ast.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/ast.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAwCvD,MAAM,MAAM,WAAW,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;AAkCrD,qBAAa,GAAG;;IACd,IAAI,EAAE,WAAW,GAAG,IAAI,CAAA;gBAiBtB,IAAI,EAAE,WAAW,GAAG,IAAI,EACxB,MAAM,CAAC,EAAE,GAAG,EACZ,OAAO,GAAE,gBAAqB;IAahC,IAAI,QAAQ,IAAI,OAAO,GAAG,SAAS,CAUlC;IAGD,QAAQ,IAAI,MAAM;IA+ClB,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,MAAM,GAAG,GAAG,CAAC,EAAE;IAY/B,MAAM;IAgBN,OAAO,IAAI,OAAO;IAgBlB,KAAK,IAAI,OAAO;IAYhB,MAAM,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM;IAKzB,KAAK,CAAC,MAAM,EAAE,GAAG;IAsIjB,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB;IAQ/D,WAAW,IAAI,QAAQ,GAAG,MAAM;IA2BhC,IAAI,OAAO,qBAEV;IAuED,cAAc,CACZ,QAAQ,CAAC,EAAE,OAAO,GACjB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC;CAiMjE"}
|
||||
588
node_modules/@ts-morph/common/node_modules/minimatch/dist/esm/ast.js
generated
vendored
Normal file
588
node_modules/@ts-morph/common/node_modules/minimatch/dist/esm/ast.js
generated
vendored
Normal file
@@ -0,0 +1,588 @@
|
||||
// parse a single path portion
|
||||
import { parseClass } from './brace-expressions.js';
|
||||
import { unescape } from './unescape.js';
|
||||
const types = new Set(['!', '?', '+', '*', '@']);
|
||||
const isExtglobType = (c) => types.has(c);
|
||||
// Patterns that get prepended to bind to the start of either the
|
||||
// entire string, or just a single path portion, to prevent dots
|
||||
// and/or traversal patterns, when needed.
|
||||
// Exts don't need the ^ or / bit, because the root binds that already.
|
||||
const startNoTraversal = '(?!(?:^|/)\\.\\.?(?:$|/))';
|
||||
const startNoDot = '(?!\\.)';
|
||||
// characters that indicate a start of pattern needs the "no dots" bit,
|
||||
// because a dot *might* be matched. ( is not in the list, because in
|
||||
// the case of a child extglob, it will handle the prevention itself.
|
||||
const addPatternStart = new Set(['[', '.']);
|
||||
// cases where traversal is A-OK, no dot prevention needed
|
||||
const justDots = new Set(['..', '.']);
|
||||
const reSpecials = new Set('().*{}+?[]^$\\!');
|
||||
const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
||||
// any single thing other than /
|
||||
const qmark = '[^/]';
|
||||
// * => any number of characters
|
||||
const star = qmark + '*?';
|
||||
// use + when we need to ensure that *something* matches, because the * is
|
||||
// the only thing in the path portion.
|
||||
const starNoEmpty = qmark + '+?';
|
||||
// remove the \ chars that we added if we end up doing a nonmagic compare
|
||||
// const deslash = (s: string) => s.replace(/\\(.)/g, '$1')
|
||||
export class AST {
|
||||
type;
|
||||
#root;
|
||||
#hasMagic;
|
||||
#uflag = false;
|
||||
#parts = [];
|
||||
#parent;
|
||||
#parentIndex;
|
||||
#negs;
|
||||
#filledNegs = false;
|
||||
#options;
|
||||
#toString;
|
||||
// set to true if it's an extglob with no children
|
||||
// (which really means one child of '')
|
||||
#emptyExt = false;
|
||||
constructor(type, parent, options = {}) {
|
||||
this.type = type;
|
||||
// extglobs are inherently magical
|
||||
if (type)
|
||||
this.#hasMagic = true;
|
||||
this.#parent = parent;
|
||||
this.#root = this.#parent ? this.#parent.#root : this;
|
||||
this.#options = this.#root === this ? options : this.#root.#options;
|
||||
this.#negs = this.#root === this ? [] : this.#root.#negs;
|
||||
if (type === '!' && !this.#root.#filledNegs)
|
||||
this.#negs.push(this);
|
||||
this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0;
|
||||
}
|
||||
get hasMagic() {
|
||||
/* c8 ignore start */
|
||||
if (this.#hasMagic !== undefined)
|
||||
return this.#hasMagic;
|
||||
/* c8 ignore stop */
|
||||
for (const p of this.#parts) {
|
||||
if (typeof p === 'string')
|
||||
continue;
|
||||
if (p.type || p.hasMagic)
|
||||
return (this.#hasMagic = true);
|
||||
}
|
||||
// note: will be undefined until we generate the regexp src and find out
|
||||
return this.#hasMagic;
|
||||
}
|
||||
// reconstructs the pattern
|
||||
toString() {
|
||||
if (this.#toString !== undefined)
|
||||
return this.#toString;
|
||||
if (!this.type) {
|
||||
return (this.#toString = this.#parts.map(p => String(p)).join(''));
|
||||
}
|
||||
else {
|
||||
return (this.#toString =
|
||||
this.type + '(' + this.#parts.map(p => String(p)).join('|') + ')');
|
||||
}
|
||||
}
|
||||
#fillNegs() {
|
||||
/* c8 ignore start */
|
||||
if (this !== this.#root)
|
||||
throw new Error('should only call on root');
|
||||
if (this.#filledNegs)
|
||||
return this;
|
||||
/* c8 ignore stop */
|
||||
// call toString() once to fill this out
|
||||
this.toString();
|
||||
this.#filledNegs = true;
|
||||
let n;
|
||||
while ((n = this.#negs.pop())) {
|
||||
if (n.type !== '!')
|
||||
continue;
|
||||
// walk up the tree, appending everthing that comes AFTER parentIndex
|
||||
let p = n;
|
||||
let pp = p.#parent;
|
||||
while (pp) {
|
||||
for (let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) {
|
||||
for (const part of n.#parts) {
|
||||
/* c8 ignore start */
|
||||
if (typeof part === 'string') {
|
||||
throw new Error('string part in extglob AST??');
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
part.copyIn(pp.#parts[i]);
|
||||
}
|
||||
}
|
||||
p = pp;
|
||||
pp = p.#parent;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
push(...parts) {
|
||||
for (const p of parts) {
|
||||
if (p === '')
|
||||
continue;
|
||||
/* c8 ignore start */
|
||||
if (typeof p !== 'string' && !(p instanceof AST && p.#parent === this)) {
|
||||
throw new Error('invalid part: ' + p);
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
this.#parts.push(p);
|
||||
}
|
||||
}
|
||||
toJSON() {
|
||||
const ret = this.type === null
|
||||
? this.#parts.slice().map(p => (typeof p === 'string' ? p : p.toJSON()))
|
||||
: [this.type, ...this.#parts.map(p => p.toJSON())];
|
||||
if (this.isStart() && !this.type)
|
||||
ret.unshift([]);
|
||||
if (this.isEnd() &&
|
||||
(this === this.#root ||
|
||||
(this.#root.#filledNegs && this.#parent?.type === '!'))) {
|
||||
ret.push({});
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
isStart() {
|
||||
if (this.#root === this)
|
||||
return true;
|
||||
// if (this.type) return !!this.#parent?.isStart()
|
||||
if (!this.#parent?.isStart())
|
||||
return false;
|
||||
if (this.#parentIndex === 0)
|
||||
return true;
|
||||
// if everything AHEAD of this is a negation, then it's still the "start"
|
||||
const p = this.#parent;
|
||||
for (let i = 0; i < this.#parentIndex; i++) {
|
||||
const pp = p.#parts[i];
|
||||
if (!(pp instanceof AST && pp.type === '!')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
isEnd() {
|
||||
if (this.#root === this)
|
||||
return true;
|
||||
if (this.#parent?.type === '!')
|
||||
return true;
|
||||
if (!this.#parent?.isEnd())
|
||||
return false;
|
||||
if (!this.type)
|
||||
return this.#parent?.isEnd();
|
||||
// if not root, it'll always have a parent
|
||||
/* c8 ignore start */
|
||||
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
||||
/* c8 ignore stop */
|
||||
return this.#parentIndex === pl - 1;
|
||||
}
|
||||
copyIn(part) {
|
||||
if (typeof part === 'string')
|
||||
this.push(part);
|
||||
else
|
||||
this.push(part.clone(this));
|
||||
}
|
||||
clone(parent) {
|
||||
const c = new AST(this.type, parent);
|
||||
for (const p of this.#parts) {
|
||||
c.copyIn(p);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
static #parseAST(str, ast, pos, opt) {
|
||||
let escaping = false;
|
||||
let inBrace = false;
|
||||
let braceStart = -1;
|
||||
let braceNeg = false;
|
||||
if (ast.type === null) {
|
||||
// outside of a extglob, append until we find a start
|
||||
let i = pos;
|
||||
let acc = '';
|
||||
while (i < str.length) {
|
||||
const c = str.charAt(i++);
|
||||
// still accumulate escapes at this point, but we do ignore
|
||||
// starts that are escaped
|
||||
if (escaping || c === '\\') {
|
||||
escaping = !escaping;
|
||||
acc += c;
|
||||
continue;
|
||||
}
|
||||
if (inBrace) {
|
||||
if (i === braceStart + 1) {
|
||||
if (c === '^' || c === '!') {
|
||||
braceNeg = true;
|
||||
}
|
||||
}
|
||||
else if (c === ']' && !(i === braceStart + 2 && braceNeg)) {
|
||||
inBrace = false;
|
||||
}
|
||||
acc += c;
|
||||
continue;
|
||||
}
|
||||
else if (c === '[') {
|
||||
inBrace = true;
|
||||
braceStart = i;
|
||||
braceNeg = false;
|
||||
acc += c;
|
||||
continue;
|
||||
}
|
||||
if (!opt.noext && isExtglobType(c) && str.charAt(i) === '(') {
|
||||
ast.push(acc);
|
||||
acc = '';
|
||||
const ext = new AST(c, ast);
|
||||
i = AST.#parseAST(str, ext, i, opt);
|
||||
ast.push(ext);
|
||||
continue;
|
||||
}
|
||||
acc += c;
|
||||
}
|
||||
ast.push(acc);
|
||||
return i;
|
||||
}
|
||||
// some kind of extglob, pos is at the (
|
||||
// find the next | or )
|
||||
let i = pos + 1;
|
||||
let part = new AST(null, ast);
|
||||
const parts = [];
|
||||
let acc = '';
|
||||
while (i < str.length) {
|
||||
const c = str.charAt(i++);
|
||||
// still accumulate escapes at this point, but we do ignore
|
||||
// starts that are escaped
|
||||
if (escaping || c === '\\') {
|
||||
escaping = !escaping;
|
||||
acc += c;
|
||||
continue;
|
||||
}
|
||||
if (inBrace) {
|
||||
if (i === braceStart + 1) {
|
||||
if (c === '^' || c === '!') {
|
||||
braceNeg = true;
|
||||
}
|
||||
}
|
||||
else if (c === ']' && !(i === braceStart + 2 && braceNeg)) {
|
||||
inBrace = false;
|
||||
}
|
||||
acc += c;
|
||||
continue;
|
||||
}
|
||||
else if (c === '[') {
|
||||
inBrace = true;
|
||||
braceStart = i;
|
||||
braceNeg = false;
|
||||
acc += c;
|
||||
continue;
|
||||
}
|
||||
if (isExtglobType(c) && str.charAt(i) === '(') {
|
||||
part.push(acc);
|
||||
acc = '';
|
||||
const ext = new AST(c, part);
|
||||
part.push(ext);
|
||||
i = AST.#parseAST(str, ext, i, opt);
|
||||
continue;
|
||||
}
|
||||
if (c === '|') {
|
||||
part.push(acc);
|
||||
acc = '';
|
||||
parts.push(part);
|
||||
part = new AST(null, ast);
|
||||
continue;
|
||||
}
|
||||
if (c === ')') {
|
||||
if (acc === '' && ast.#parts.length === 0) {
|
||||
ast.#emptyExt = true;
|
||||
}
|
||||
part.push(acc);
|
||||
acc = '';
|
||||
ast.push(...parts, part);
|
||||
return i;
|
||||
}
|
||||
acc += c;
|
||||
}
|
||||
// unfinished extglob
|
||||
// if we got here, it was a malformed extglob! not an extglob, but
|
||||
// maybe something else in there.
|
||||
ast.type = null;
|
||||
ast.#hasMagic = undefined;
|
||||
ast.#parts = [str.substring(pos - 1)];
|
||||
return i;
|
||||
}
|
||||
static fromGlob(pattern, options = {}) {
|
||||
const ast = new AST(null, undefined, options);
|
||||
AST.#parseAST(pattern, ast, 0, options);
|
||||
return ast;
|
||||
}
|
||||
// returns the regular expression if there's magic, or the unescaped
|
||||
// string if not.
|
||||
toMMPattern() {
|
||||
// should only be called on root
|
||||
/* c8 ignore start */
|
||||
if (this !== this.#root)
|
||||
return this.#root.toMMPattern();
|
||||
/* c8 ignore stop */
|
||||
const glob = this.toString();
|
||||
const [re, body, hasMagic, uflag] = this.toRegExpSource();
|
||||
// if we're in nocase mode, and not nocaseMagicOnly, then we do
|
||||
// still need a regular expression if we have to case-insensitively
|
||||
// match capital/lowercase characters.
|
||||
const anyMagic = hasMagic ||
|
||||
this.#hasMagic ||
|
||||
(this.#options.nocase &&
|
||||
!this.#options.nocaseMagicOnly &&
|
||||
glob.toUpperCase() !== glob.toLowerCase());
|
||||
if (!anyMagic) {
|
||||
return body;
|
||||
}
|
||||
const flags = (this.#options.nocase ? 'i' : '') + (uflag ? 'u' : '');
|
||||
return Object.assign(new RegExp(`^${re}$`, flags), {
|
||||
_src: re,
|
||||
_glob: glob,
|
||||
});
|
||||
}
|
||||
get options() {
|
||||
return this.#options;
|
||||
}
|
||||
// returns the string match, the regexp source, whether there's magic
|
||||
// in the regexp (so a regular expression is required) and whether or
|
||||
// not the uflag is needed for the regular expression (for posix classes)
|
||||
// TODO: instead of injecting the start/end at this point, just return
|
||||
// the BODY of the regexp, along with the start/end portions suitable
|
||||
// for binding the start/end in either a joined full-path makeRe context
|
||||
// (where we bind to (^|/), or a standalone matchPart context (where
|
||||
// we bind to ^, and not /). Otherwise slashes get duped!
|
||||
//
|
||||
// In part-matching mode, the start is:
|
||||
// - if not isStart: nothing
|
||||
// - if traversal possible, but not allowed: ^(?!\.\.?$)
|
||||
// - if dots allowed or not possible: ^
|
||||
// - if dots possible and not allowed: ^(?!\.)
|
||||
// end is:
|
||||
// - if not isEnd(): nothing
|
||||
// - else: $
|
||||
//
|
||||
// In full-path matching mode, we put the slash at the START of the
|
||||
// pattern, so start is:
|
||||
// - if first pattern: same as part-matching mode
|
||||
// - if not isStart(): nothing
|
||||
// - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
|
||||
// - if dots allowed or not possible: /
|
||||
// - if dots possible and not allowed: /(?!\.)
|
||||
// end is:
|
||||
// - if last pattern, same as part-matching mode
|
||||
// - else nothing
|
||||
//
|
||||
// Always put the (?:$|/) on negated tails, though, because that has to be
|
||||
// there to bind the end of the negated pattern portion, and it's easier to
|
||||
// just stick it in now rather than try to inject it later in the middle of
|
||||
// the pattern.
|
||||
//
|
||||
// We can just always return the same end, and leave it up to the caller
|
||||
// to know whether it's going to be used joined or in parts.
|
||||
// And, if the start is adjusted slightly, can do the same there:
|
||||
// - if not isStart: nothing
|
||||
// - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
|
||||
// - if dots allowed or not possible: (?:/|^)
|
||||
// - if dots possible and not allowed: (?:/|^)(?!\.)
|
||||
//
|
||||
// But it's better to have a simpler binding without a conditional, for
|
||||
// performance, so probably better to return both start options.
|
||||
//
|
||||
// Then the caller just ignores the end if it's not the first pattern,
|
||||
// and the start always gets applied.
|
||||
//
|
||||
// But that's always going to be $ if it's the ending pattern, or nothing,
|
||||
// so the caller can just attach $ at the end of the pattern when building.
|
||||
//
|
||||
// So the todo is:
|
||||
// - better detect what kind of start is needed
|
||||
// - return both flavors of starting pattern
|
||||
// - attach $ at the end of the pattern when creating the actual RegExp
|
||||
//
|
||||
// Ah, but wait, no, that all only applies to the root when the first pattern
|
||||
// is not an extglob. If the first pattern IS an extglob, then we need all
|
||||
// that dot prevention biz to live in the extglob portions, because eg
|
||||
// +(*|.x*) can match .xy but not .yx.
|
||||
//
|
||||
// So, return the two flavors if it's #root and the first child is not an
|
||||
// AST, otherwise leave it to the child AST to handle it, and there,
|
||||
// use the (?:^|/) style of start binding.
|
||||
//
|
||||
// Even simplified further:
|
||||
// - Since the start for a join is eg /(?!\.) and the start for a part
|
||||
// is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
|
||||
// or start or whatever) and prepend ^ or / at the Regexp construction.
|
||||
toRegExpSource(allowDot) {
|
||||
const dot = allowDot ?? !!this.#options.dot;
|
||||
if (this.#root === this)
|
||||
this.#fillNegs();
|
||||
if (!this.type) {
|
||||
const noEmpty = this.isStart() && this.isEnd();
|
||||
const src = this.#parts
|
||||
.map(p => {
|
||||
const [re, _, hasMagic, uflag] = typeof p === 'string'
|
||||
? AST.#parseGlob(p, this.#hasMagic, noEmpty)
|
||||
: p.toRegExpSource(allowDot);
|
||||
this.#hasMagic = this.#hasMagic || hasMagic;
|
||||
this.#uflag = this.#uflag || uflag;
|
||||
return re;
|
||||
})
|
||||
.join('');
|
||||
let start = '';
|
||||
if (this.isStart()) {
|
||||
if (typeof this.#parts[0] === 'string') {
|
||||
// this is the string that will match the start of the pattern,
|
||||
// so we need to protect against dots and such.
|
||||
// '.' and '..' cannot match unless the pattern is that exactly,
|
||||
// even if it starts with . or dot:true is set.
|
||||
const dotTravAllowed = this.#parts.length === 1 && justDots.has(this.#parts[0]);
|
||||
if (!dotTravAllowed) {
|
||||
const aps = addPatternStart;
|
||||
// check if we have a possibility of matching . or ..,
|
||||
// and prevent that.
|
||||
const needNoTrav =
|
||||
// dots are allowed, and the pattern starts with [ or .
|
||||
(dot && aps.has(src.charAt(0))) ||
|
||||
// the pattern starts with \., and then [ or .
|
||||
(src.startsWith('\\.') && aps.has(src.charAt(2))) ||
|
||||
// the pattern starts with \.\., and then [ or .
|
||||
(src.startsWith('\\.\\.') && aps.has(src.charAt(4)));
|
||||
// no need to prevent dots if it can't match a dot, or if a
|
||||
// sub-pattern will be preventing it anyway.
|
||||
const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
|
||||
start = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : '';
|
||||
}
|
||||
}
|
||||
}
|
||||
// append the "end of path portion" pattern to negation tails
|
||||
let end = '';
|
||||
if (this.isEnd() &&
|
||||
this.#root.#filledNegs &&
|
||||
this.#parent?.type === '!') {
|
||||
end = '(?:$|\\/)';
|
||||
}
|
||||
const final = start + src + end;
|
||||
return [
|
||||
final,
|
||||
unescape(src),
|
||||
(this.#hasMagic = !!this.#hasMagic),
|
||||
this.#uflag,
|
||||
];
|
||||
}
|
||||
// We need to calculate the body *twice* if it's a repeat pattern
|
||||
// at the start, once in nodot mode, then again in dot mode, so a
|
||||
// pattern like *(?) can match 'x.y'
|
||||
const repeated = this.type === '*' || this.type === '+';
|
||||
// some kind of extglob
|
||||
const start = this.type === '!' ? '(?:(?!(?:' : '(?:';
|
||||
let body = this.#partsToRegExp(dot);
|
||||
if (this.isStart() && this.isEnd() && !body && this.type !== '!') {
|
||||
// invalid extglob, has to at least be *something* present, if it's
|
||||
// the entire path portion.
|
||||
const s = this.toString();
|
||||
this.#parts = [s];
|
||||
this.type = null;
|
||||
this.#hasMagic = undefined;
|
||||
return [s, unescape(this.toString()), false, false];
|
||||
}
|
||||
// XXX abstract out this map method
|
||||
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot
|
||||
? ''
|
||||
: this.#partsToRegExp(true);
|
||||
if (bodyDotAllowed === body) {
|
||||
bodyDotAllowed = '';
|
||||
}
|
||||
if (bodyDotAllowed) {
|
||||
body = `(?:${body})(?:${bodyDotAllowed})*?`;
|
||||
}
|
||||
// an empty !() is exactly equivalent to a starNoEmpty
|
||||
let final = '';
|
||||
if (this.type === '!' && this.#emptyExt) {
|
||||
final = (this.isStart() && !dot ? startNoDot : '') + starNoEmpty;
|
||||
}
|
||||
else {
|
||||
const close = this.type === '!'
|
||||
? // !() must match something,but !(x) can match ''
|
||||
'))' +
|
||||
(this.isStart() && !dot && !allowDot ? startNoDot : '') +
|
||||
star +
|
||||
')'
|
||||
: this.type === '@'
|
||||
? ')'
|
||||
: this.type === '?'
|
||||
? ')?'
|
||||
: this.type === '+' && bodyDotAllowed
|
||||
? ')'
|
||||
: this.type === '*' && bodyDotAllowed
|
||||
? `)?`
|
||||
: `)${this.type}`;
|
||||
final = start + body + close;
|
||||
}
|
||||
return [
|
||||
final,
|
||||
unescape(body),
|
||||
(this.#hasMagic = !!this.#hasMagic),
|
||||
this.#uflag,
|
||||
];
|
||||
}
|
||||
#partsToRegExp(dot) {
|
||||
return this.#parts
|
||||
.map(p => {
|
||||
// extglob ASTs should only contain parent ASTs
|
||||
/* c8 ignore start */
|
||||
if (typeof p === 'string') {
|
||||
throw new Error('string type in extglob ast??');
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
// can ignore hasMagic, because extglobs are already always magic
|
||||
const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot);
|
||||
this.#uflag = this.#uflag || uflag;
|
||||
return re;
|
||||
})
|
||||
.filter(p => !(this.isStart() && this.isEnd()) || !!p)
|
||||
.join('|');
|
||||
}
|
||||
static #parseGlob(glob, hasMagic, noEmpty = false) {
|
||||
let escaping = false;
|
||||
let re = '';
|
||||
let uflag = false;
|
||||
for (let i = 0; i < glob.length; i++) {
|
||||
const c = glob.charAt(i);
|
||||
if (escaping) {
|
||||
escaping = false;
|
||||
re += (reSpecials.has(c) ? '\\' : '') + c;
|
||||
continue;
|
||||
}
|
||||
if (c === '\\') {
|
||||
if (i === glob.length - 1) {
|
||||
re += '\\\\';
|
||||
}
|
||||
else {
|
||||
escaping = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (c === '[') {
|
||||
const [src, needUflag, consumed, magic] = parseClass(glob, i);
|
||||
if (consumed) {
|
||||
re += src;
|
||||
uflag = uflag || needUflag;
|
||||
i += consumed - 1;
|
||||
hasMagic = hasMagic || magic;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (c === '*') {
|
||||
if (noEmpty && glob === '*')
|
||||
re += starNoEmpty;
|
||||
else
|
||||
re += star;
|
||||
hasMagic = true;
|
||||
continue;
|
||||
}
|
||||
if (c === '?') {
|
||||
re += qmark;
|
||||
hasMagic = true;
|
||||
continue;
|
||||
}
|
||||
re += regExpEscape(c);
|
||||
}
|
||||
return [re, unescape(glob), !!hasMagic, uflag];
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=ast.js.map
|
||||
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/esm/ast.js.map
generated
vendored
Normal file
1
node_modules/@ts-morph/common/node_modules/minimatch/dist/esm/ast.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user