@umijs/utils 4.0.0-rc.2 → 4.0.0-rc.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled/chalk/index.js +1 -1
- package/compiled/color/index.js +1 -1
- package/compiled/debug/index.js +1 -1
- package/compiled/execa/index.js +1 -1
- package/compiled/fs-extra/index.d.ts +347 -116
- package/compiled/fs-extra/index.js +1 -1
- package/compiled/glob/LICENSE +1 -7
- package/compiled/glob/index.d.ts +3 -1
- package/compiled/glob/index.js +1 -1
- package/compiled/pkg-up/index.js +1 -1
- package/compiled/semver/index.js +1 -1
- package/compiled/semver/package.json +1 -1
- package/compiled/yargs-parser/index.js +1 -1
- package/dist/BaseGenerator/BaseGenerator.d.ts +2 -1
- package/dist/BaseGenerator/BaseGenerator.js +23 -32
- package/dist/BaseGenerator/generateFile.d.ts +2 -1
- package/dist/BaseGenerator/generateFile.js +4 -12
- package/dist/Generator/Generator.d.ts +3 -3
- package/dist/Generator/Generator.js +8 -21
- package/dist/index.d.ts +2 -1
- package/dist/index.js +8 -2
- package/dist/installDeps.js +8 -2
- package/dist/logger.d.ts +3 -0
- package/dist/logger.js +45 -1
- package/dist/npmClient.d.ts +3 -2
- package/dist/npmClient.js +20 -19
- package/dist/register.d.ts +1 -0
- package/dist/register.js +8 -9
- package/package.json +16 -14
- package/compiled/globby/@nodelib/fs.scandir/out/adapters/fs.d.ts +0 -20
- package/compiled/globby/@nodelib/fs.scandir/out/index.d.ts +0 -12
- package/compiled/globby/@nodelib/fs.scandir/out/providers/async.d.ts +0 -7
- package/compiled/globby/@nodelib/fs.scandir/out/settings.d.ts +0 -20
- package/compiled/globby/@nodelib/fs.scandir/out/types/index.d.ts +0 -20
- package/compiled/globby/@nodelib/fs.stat/out/adapters/fs.d.ts +0 -13
- package/compiled/globby/@nodelib/fs.stat/out/index.d.ts +0 -12
- package/compiled/globby/@nodelib/fs.stat/out/providers/async.d.ts +0 -4
- package/compiled/globby/@nodelib/fs.stat/out/settings.d.ts +0 -16
- package/compiled/globby/@nodelib/fs.stat/out/types/index.d.ts +0 -4
- package/compiled/globby/@nodelib/fs.walk/out/index.d.ts +0 -14
- package/compiled/globby/@nodelib/fs.walk/out/providers/async.d.ts +0 -12
- package/compiled/globby/@nodelib/fs.walk/out/readers/async.d.ts +0 -30
- package/compiled/globby/@nodelib/fs.walk/out/readers/reader.d.ts +0 -6
- package/compiled/globby/@nodelib/fs.walk/out/settings.d.ts +0 -30
- package/compiled/globby/@nodelib/fs.walk/out/types/index.d.ts +0 -8
- package/compiled/globby/LICENSE +0 -9
- package/compiled/globby/fast-glob/out/index.d.ts +0 -27
- package/compiled/globby/fast-glob/out/managers/tasks.d.ts +0 -22
- package/compiled/globby/fast-glob/out/settings.d.ts +0 -164
- package/compiled/globby/fast-glob/out/types/index.d.ts +0 -31
- package/compiled/globby/index.d.ts +0 -206
- package/compiled/globby/index.js +0 -37
- package/compiled/globby/package.json +0 -1
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { FileSystemAdapter, Pattern } from './types';
|
|
2
|
-
export declare const DEFAULT_FILE_SYSTEM_ADAPTER: FileSystemAdapter;
|
|
3
|
-
export declare type Options = {
|
|
4
|
-
/**
|
|
5
|
-
* Return the absolute path for entries.
|
|
6
|
-
*
|
|
7
|
-
* @default false
|
|
8
|
-
*/
|
|
9
|
-
absolute?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* If set to `true`, then patterns without slashes will be matched against
|
|
12
|
-
* the basename of the path if it contains slashes.
|
|
13
|
-
*
|
|
14
|
-
* @default false
|
|
15
|
-
*/
|
|
16
|
-
baseNameMatch?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Enables Bash-like brace expansion.
|
|
19
|
-
*
|
|
20
|
-
* @default true
|
|
21
|
-
*/
|
|
22
|
-
braceExpansion?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Enables a case-sensitive mode for matching files.
|
|
25
|
-
*
|
|
26
|
-
* @default true
|
|
27
|
-
*/
|
|
28
|
-
caseSensitiveMatch?: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Specifies the maximum number of concurrent requests from a reader to read
|
|
31
|
-
* directories.
|
|
32
|
-
*
|
|
33
|
-
* @default os.cpus().length
|
|
34
|
-
*/
|
|
35
|
-
concurrency?: number;
|
|
36
|
-
/**
|
|
37
|
-
* The current working directory in which to search.
|
|
38
|
-
*
|
|
39
|
-
* @default process.cwd()
|
|
40
|
-
*/
|
|
41
|
-
cwd?: string;
|
|
42
|
-
/**
|
|
43
|
-
* Specifies the maximum depth of a read directory relative to the start
|
|
44
|
-
* directory.
|
|
45
|
-
*
|
|
46
|
-
* @default Infinity
|
|
47
|
-
*/
|
|
48
|
-
deep?: number;
|
|
49
|
-
/**
|
|
50
|
-
* Allow patterns to match entries that begin with a period (`.`).
|
|
51
|
-
*
|
|
52
|
-
* @default false
|
|
53
|
-
*/
|
|
54
|
-
dot?: boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Enables Bash-like `extglob` functionality.
|
|
57
|
-
*
|
|
58
|
-
* @default true
|
|
59
|
-
*/
|
|
60
|
-
extglob?: boolean;
|
|
61
|
-
/**
|
|
62
|
-
* Indicates whether to traverse descendants of symbolic link directories.
|
|
63
|
-
*
|
|
64
|
-
* @default true
|
|
65
|
-
*/
|
|
66
|
-
followSymbolicLinks?: boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Custom implementation of methods for working with the file system.
|
|
69
|
-
*
|
|
70
|
-
* @default fs.*
|
|
71
|
-
*/
|
|
72
|
-
fs?: Partial<FileSystemAdapter>;
|
|
73
|
-
/**
|
|
74
|
-
* Enables recursively repeats a pattern containing `**`.
|
|
75
|
-
* If `false`, `**` behaves exactly like `*`.
|
|
76
|
-
*
|
|
77
|
-
* @default true
|
|
78
|
-
*/
|
|
79
|
-
globstar?: boolean;
|
|
80
|
-
/**
|
|
81
|
-
* An array of glob patterns to exclude matches.
|
|
82
|
-
* This is an alternative way to use negative patterns.
|
|
83
|
-
*
|
|
84
|
-
* @default []
|
|
85
|
-
*/
|
|
86
|
-
ignore?: Pattern[];
|
|
87
|
-
/**
|
|
88
|
-
* Mark the directory path with the final slash.
|
|
89
|
-
*
|
|
90
|
-
* @default false
|
|
91
|
-
*/
|
|
92
|
-
markDirectories?: boolean;
|
|
93
|
-
/**
|
|
94
|
-
* Returns objects (instead of strings) describing entries.
|
|
95
|
-
*
|
|
96
|
-
* @default false
|
|
97
|
-
*/
|
|
98
|
-
objectMode?: boolean;
|
|
99
|
-
/**
|
|
100
|
-
* Return only directories.
|
|
101
|
-
*
|
|
102
|
-
* @default false
|
|
103
|
-
*/
|
|
104
|
-
onlyDirectories?: boolean;
|
|
105
|
-
/**
|
|
106
|
-
* Return only files.
|
|
107
|
-
*
|
|
108
|
-
* @default true
|
|
109
|
-
*/
|
|
110
|
-
onlyFiles?: boolean;
|
|
111
|
-
/**
|
|
112
|
-
* Enables an object mode (`objectMode`) with an additional `stats` field.
|
|
113
|
-
*
|
|
114
|
-
* @default false
|
|
115
|
-
*/
|
|
116
|
-
stats?: boolean;
|
|
117
|
-
/**
|
|
118
|
-
* By default this package suppress only `ENOENT` errors.
|
|
119
|
-
* Set to `true` to suppress any error.
|
|
120
|
-
*
|
|
121
|
-
* @default false
|
|
122
|
-
*/
|
|
123
|
-
suppressErrors?: boolean;
|
|
124
|
-
/**
|
|
125
|
-
* Throw an error when symbolic link is broken if `true` or safely
|
|
126
|
-
* return `lstat` call if `false`.
|
|
127
|
-
*
|
|
128
|
-
* @default false
|
|
129
|
-
*/
|
|
130
|
-
throwErrorOnBrokenSymbolicLink?: boolean;
|
|
131
|
-
/**
|
|
132
|
-
* Ensures that the returned entries are unique.
|
|
133
|
-
*
|
|
134
|
-
* @default true
|
|
135
|
-
*/
|
|
136
|
-
unique?: boolean;
|
|
137
|
-
};
|
|
138
|
-
export default class Settings {
|
|
139
|
-
private readonly _options;
|
|
140
|
-
readonly absolute: boolean;
|
|
141
|
-
readonly baseNameMatch: boolean;
|
|
142
|
-
readonly braceExpansion: boolean;
|
|
143
|
-
readonly caseSensitiveMatch: boolean;
|
|
144
|
-
readonly concurrency: number;
|
|
145
|
-
readonly cwd: string;
|
|
146
|
-
readonly deep: number;
|
|
147
|
-
readonly dot: boolean;
|
|
148
|
-
readonly extglob: boolean;
|
|
149
|
-
readonly followSymbolicLinks: boolean;
|
|
150
|
-
readonly fs: FileSystemAdapter;
|
|
151
|
-
readonly globstar: boolean;
|
|
152
|
-
readonly ignore: Pattern[];
|
|
153
|
-
readonly markDirectories: boolean;
|
|
154
|
-
readonly objectMode: boolean;
|
|
155
|
-
readonly onlyDirectories: boolean;
|
|
156
|
-
readonly onlyFiles: boolean;
|
|
157
|
-
readonly stats: boolean;
|
|
158
|
-
readonly suppressErrors: boolean;
|
|
159
|
-
readonly throwErrorOnBrokenSymbolicLink: boolean;
|
|
160
|
-
readonly unique: boolean;
|
|
161
|
-
constructor(_options?: Options);
|
|
162
|
-
private _getValue;
|
|
163
|
-
private _getFileSystemMethods;
|
|
164
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import * as fsWalk from '../../../@nodelib/fs.walk';
|
|
3
|
-
export declare type ErrnoException = NodeJS.ErrnoException;
|
|
4
|
-
export declare type Entry = fsWalk.Entry;
|
|
5
|
-
export declare type EntryItem = string | Entry;
|
|
6
|
-
export declare type Pattern = string;
|
|
7
|
-
export declare type PatternRe = RegExp;
|
|
8
|
-
export declare type PatternsGroup = Record<string, Pattern[]>;
|
|
9
|
-
export declare type ReaderOptions = fsWalk.Options & {
|
|
10
|
-
transform(entry: Entry): EntryItem;
|
|
11
|
-
deepFilter: DeepFilterFunction;
|
|
12
|
-
entryFilter: EntryFilterFunction;
|
|
13
|
-
errorFilter: ErrorFilterFunction;
|
|
14
|
-
fs: FileSystemAdapter;
|
|
15
|
-
stats: boolean;
|
|
16
|
-
};
|
|
17
|
-
export declare type ErrorFilterFunction = fsWalk.ErrorFilterFunction;
|
|
18
|
-
export declare type EntryFilterFunction = fsWalk.EntryFilterFunction;
|
|
19
|
-
export declare type DeepFilterFunction = fsWalk.DeepFilterFunction;
|
|
20
|
-
export declare type EntryTransformerFunction = (entry: Entry) => EntryItem;
|
|
21
|
-
export declare type MicromatchOptions = {
|
|
22
|
-
dot?: boolean;
|
|
23
|
-
matchBase?: boolean;
|
|
24
|
-
nobrace?: boolean;
|
|
25
|
-
nocase?: boolean;
|
|
26
|
-
noext?: boolean;
|
|
27
|
-
noglobstar?: boolean;
|
|
28
|
-
posix?: boolean;
|
|
29
|
-
strictSlashes?: boolean;
|
|
30
|
-
};
|
|
31
|
-
export declare type FileSystemAdapter = fsWalk.FileSystemAdapter;
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import {URL} from 'node:url'; // TODO: Remove this when https://github.com/DefinitelyTyped/DefinitelyTyped/issues/34960 is fixed.
|
|
2
|
-
import {Options as FastGlobOptions, Entry} from './fast-glob';
|
|
3
|
-
|
|
4
|
-
export type GlobEntry = Entry;
|
|
5
|
-
|
|
6
|
-
export interface GlobTask {
|
|
7
|
-
readonly patterns: string[];
|
|
8
|
-
readonly options: Options;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export type ExpandDirectoriesOption =
|
|
12
|
-
| boolean
|
|
13
|
-
| readonly string[]
|
|
14
|
-
| {files?: readonly string[]; extensions?: readonly string[]};
|
|
15
|
-
|
|
16
|
-
type FastGlobOptionsWithoutCwd = Omit<FastGlobOptions, 'cwd'>;
|
|
17
|
-
|
|
18
|
-
export interface Options extends FastGlobOptionsWithoutCwd {
|
|
19
|
-
/**
|
|
20
|
-
If set to `true`, `globby` will automatically glob directories for you. If you define an `Array` it will only glob files that matches the patterns inside the `Array`. You can also define an `Object` with `files` and `extensions` like in the example below.
|
|
21
|
-
|
|
22
|
-
Note that if you set this option to `false`, you won't get back matched directories unless you set `onlyFiles: false`.
|
|
23
|
-
|
|
24
|
-
@default true
|
|
25
|
-
|
|
26
|
-
@example
|
|
27
|
-
```
|
|
28
|
-
import {globby} from '../globby';
|
|
29
|
-
|
|
30
|
-
const paths = await globby('images', {
|
|
31
|
-
expandDirectories: {
|
|
32
|
-
files: ['cat', 'unicorn', '*.jpg'],
|
|
33
|
-
extensions: ['png']
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
console.log(paths);
|
|
38
|
-
//=> ['cat.png', 'unicorn.png', 'cow.jpg', 'rainbow.jpg']
|
|
39
|
-
```
|
|
40
|
-
*/
|
|
41
|
-
readonly expandDirectories?: ExpandDirectoriesOption;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
Respect ignore patterns in `.gitignore` files that apply to the globbed files.
|
|
45
|
-
|
|
46
|
-
@default false
|
|
47
|
-
*/
|
|
48
|
-
readonly gitignore?: boolean;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
Glob patterns to look for ignore files, which are then used to ignore globbed files.
|
|
52
|
-
|
|
53
|
-
This is a more generic form of the `gitignore` option, allowing you to find ignore files with a [compatible syntax](http://git-scm.com/docs/gitignore). For instance, this works with Babel's `.babelignore`, Prettier's `.prettierignore`, or ESLint's `.eslintignore` files.
|
|
54
|
-
|
|
55
|
-
@default undefined
|
|
56
|
-
*/
|
|
57
|
-
readonly ignoreFiles?: string | string[];
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
The current working directory in which to search.
|
|
61
|
-
|
|
62
|
-
@default process.cwd()
|
|
63
|
-
*/
|
|
64
|
-
readonly cwd?: URL | string;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export interface GitignoreOptions {
|
|
68
|
-
readonly cwd?: URL | string;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export type GlobbyFilterFunction = (path: URL | string) => boolean;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
Find files and directories using glob patterns.
|
|
75
|
-
|
|
76
|
-
Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`.
|
|
77
|
-
|
|
78
|
-
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
|
|
79
|
-
@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.
|
|
80
|
-
@returns The matching paths.
|
|
81
|
-
|
|
82
|
-
@example
|
|
83
|
-
```
|
|
84
|
-
import {globby} from '../globby';
|
|
85
|
-
|
|
86
|
-
const paths = await globby(['*', '!cake']);
|
|
87
|
-
|
|
88
|
-
console.log(paths);
|
|
89
|
-
//=> ['unicorn', 'rainbow']
|
|
90
|
-
```
|
|
91
|
-
*/
|
|
92
|
-
export function globby(
|
|
93
|
-
patterns: string | readonly string[],
|
|
94
|
-
options: Options & {objectMode: true}
|
|
95
|
-
): Promise<GlobEntry[]>;
|
|
96
|
-
export function globby(
|
|
97
|
-
patterns: string | readonly string[],
|
|
98
|
-
options?: Options
|
|
99
|
-
): Promise<string[]>;
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
Find files and directories using glob patterns.
|
|
103
|
-
|
|
104
|
-
Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`.
|
|
105
|
-
|
|
106
|
-
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
|
|
107
|
-
@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.
|
|
108
|
-
@returns The matching paths.
|
|
109
|
-
*/
|
|
110
|
-
export function globbySync(
|
|
111
|
-
patterns: string | readonly string[],
|
|
112
|
-
options: Options & {objectMode: true}
|
|
113
|
-
): GlobEntry[];
|
|
114
|
-
export function globbySync(
|
|
115
|
-
patterns: string | readonly string[],
|
|
116
|
-
options?: Options
|
|
117
|
-
): string[];
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
Find files and directories using glob patterns.
|
|
121
|
-
|
|
122
|
-
Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`.
|
|
123
|
-
|
|
124
|
-
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
|
|
125
|
-
@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.
|
|
126
|
-
@returns The stream of matching paths.
|
|
127
|
-
|
|
128
|
-
@example
|
|
129
|
-
```
|
|
130
|
-
import {globbyStream} from '../globby';
|
|
131
|
-
|
|
132
|
-
for await (const path of globbyStream('*.tmp')) {
|
|
133
|
-
console.log(path);
|
|
134
|
-
}
|
|
135
|
-
```
|
|
136
|
-
*/
|
|
137
|
-
export function globbyStream(
|
|
138
|
-
patterns: string | readonly string[],
|
|
139
|
-
options?: Options
|
|
140
|
-
): NodeJS.ReadableStream;
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
Note that you should avoid running the same tasks multiple times as they contain a file system cache. Instead, run this method each time to ensure file system changes are taken into consideration.
|
|
144
|
-
|
|
145
|
-
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
|
|
146
|
-
@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.
|
|
147
|
-
@returns An object in the format `{pattern: string, options: object}`, which can be passed as arguments to [`fast-glob`](https://github.com/mrmlnc/fast-glob). This is useful for other globbing-related packages.
|
|
148
|
-
*/
|
|
149
|
-
export function generateGlobTasks(
|
|
150
|
-
patterns: string | readonly string[],
|
|
151
|
-
options?: Options
|
|
152
|
-
): Promise<GlobTask[]>;
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
@see generateGlobTasks
|
|
156
|
-
|
|
157
|
-
@returns An object in the format `{pattern: string, options: object}`, which can be passed as arguments to [`fast-glob`](https://github.com/mrmlnc/fast-glob). This is useful for other globbing-related packages.
|
|
158
|
-
*/
|
|
159
|
-
export function generateGlobTasksSync(
|
|
160
|
-
patterns: string | readonly string[],
|
|
161
|
-
options?: Options
|
|
162
|
-
): GlobTask[];
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
Note that the options affect the results.
|
|
166
|
-
|
|
167
|
-
This function is backed by [`fast-glob`](https://github.com/mrmlnc/fast-glob#isdynamicpatternpattern-options).
|
|
168
|
-
|
|
169
|
-
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
|
|
170
|
-
@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3).
|
|
171
|
-
@returns Whether there are any special glob characters in the `patterns`.
|
|
172
|
-
*/
|
|
173
|
-
export function isDynamicPattern(
|
|
174
|
-
patterns: string | readonly string[],
|
|
175
|
-
options?: FastGlobOptionsWithoutCwd & {
|
|
176
|
-
/**
|
|
177
|
-
The current working directory in which to search.
|
|
178
|
-
|
|
179
|
-
@default process.cwd()
|
|
180
|
-
*/
|
|
181
|
-
readonly cwd?: URL | string;
|
|
182
|
-
}
|
|
183
|
-
): boolean;
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
`.gitignore` files matched by the ignore config are not used for the resulting filter function.
|
|
187
|
-
|
|
188
|
-
@returns A filter function indicating whether a given path is ignored via a `.gitignore` file.
|
|
189
|
-
|
|
190
|
-
@example
|
|
191
|
-
```
|
|
192
|
-
import {isGitIgnored} from '../globby';
|
|
193
|
-
|
|
194
|
-
const isIgnored = await isGitIgnored();
|
|
195
|
-
|
|
196
|
-
console.log(isIgnored('some/file'));
|
|
197
|
-
```
|
|
198
|
-
*/
|
|
199
|
-
export function isGitIgnored(options?: GitignoreOptions): Promise<GlobbyFilterFunction>;
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
@see isGitIgnored
|
|
203
|
-
|
|
204
|
-
@returns A filter function indicating whether a given path is ignored via a `.gitignore` file.
|
|
205
|
-
*/
|
|
206
|
-
export function isGitIgnoredSync(options?: GitignoreOptions): GlobbyFilterFunction;
|