@plugjs/plug 0.0.1
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/LICENSE.md +211 -0
- package/NOTICE.md +13 -0
- package/README.md +7 -0
- package/dist/assert.cjs +72 -0
- package/dist/assert.cjs.map +6 -0
- package/dist/assert.mjs +41 -0
- package/dist/assert.mjs.map +6 -0
- package/dist/async.cjs +58 -0
- package/dist/async.cjs.map +6 -0
- package/dist/async.mjs +30 -0
- package/dist/async.mjs.map +6 -0
- package/dist/build.cjs +136 -0
- package/dist/build.cjs.map +6 -0
- package/dist/build.mjs +110 -0
- package/dist/build.mjs.map +6 -0
- package/dist/files.cjs +113 -0
- package/dist/files.cjs.map +6 -0
- package/dist/files.mjs +88 -0
- package/dist/files.mjs.map +6 -0
- package/dist/fork.cjs +177 -0
- package/dist/fork.cjs.map +6 -0
- package/dist/fork.mjs +151 -0
- package/dist/fork.mjs.map +6 -0
- package/dist/helpers.cjs +129 -0
- package/dist/helpers.cjs.map +6 -0
- package/dist/helpers.mjs +97 -0
- package/dist/helpers.mjs.map +6 -0
- package/dist/index.cjs +25 -0
- package/dist/index.cjs.map +6 -0
- package/dist/index.mjs +7 -0
- package/dist/index.mjs.map +6 -0
- package/dist/log/colors.cjs +129 -0
- package/dist/log/colors.cjs.map +6 -0
- package/dist/log/colors.mjs +93 -0
- package/dist/log/colors.mjs.map +6 -0
- package/dist/log/emit.cjs +109 -0
- package/dist/log/emit.cjs.map +6 -0
- package/dist/log/emit.mjs +83 -0
- package/dist/log/emit.mjs.map +6 -0
- package/dist/log/levels.cjs +75 -0
- package/dist/log/levels.cjs.map +6 -0
- package/dist/log/levels.mjs +41 -0
- package/dist/log/levels.mjs.map +6 -0
- package/dist/log/logger.cjs +129 -0
- package/dist/log/logger.cjs.map +6 -0
- package/dist/log/logger.mjs +104 -0
- package/dist/log/logger.mjs.map +6 -0
- package/dist/log/options.cjs +149 -0
- package/dist/log/options.cjs.map +6 -0
- package/dist/log/options.mjs +124 -0
- package/dist/log/options.mjs.map +6 -0
- package/dist/log/report.cjs +284 -0
- package/dist/log/report.cjs.map +6 -0
- package/dist/log/report.mjs +259 -0
- package/dist/log/report.mjs.map +6 -0
- package/dist/log/spinner.cjs +83 -0
- package/dist/log/spinner.cjs.map +6 -0
- package/dist/log/spinner.mjs +57 -0
- package/dist/log/spinner.mjs.map +6 -0
- package/dist/log.cjs +71 -0
- package/dist/log.cjs.map +6 -0
- package/dist/log.mjs +45 -0
- package/dist/log.mjs.map +6 -0
- package/dist/paths.cjs +158 -0
- package/dist/paths.cjs.map +6 -0
- package/dist/paths.mjs +122 -0
- package/dist/paths.mjs.map +6 -0
- package/dist/pipe.cjs +71 -0
- package/dist/pipe.cjs.map +6 -0
- package/dist/pipe.mjs +44 -0
- package/dist/pipe.mjs.map +6 -0
- package/dist/plugs/copy.cjs +95 -0
- package/dist/plugs/copy.cjs.map +6 -0
- package/dist/plugs/copy.mjs +64 -0
- package/dist/plugs/copy.mjs.map +6 -0
- package/dist/plugs/coverage/analysis.cjs +229 -0
- package/dist/plugs/coverage/analysis.cjs.map +6 -0
- package/dist/plugs/coverage/analysis.mjs +202 -0
- package/dist/plugs/coverage/analysis.mjs.map +6 -0
- package/dist/plugs/coverage/report.cjs +215 -0
- package/dist/plugs/coverage/report.cjs.map +6 -0
- package/dist/plugs/coverage/report.mjs +200 -0
- package/dist/plugs/coverage/report.mjs.map +6 -0
- package/dist/plugs/coverage.cjs +142 -0
- package/dist/plugs/coverage.cjs.map +6 -0
- package/dist/plugs/coverage.mjs +117 -0
- package/dist/plugs/coverage.mjs.map +6 -0
- package/dist/plugs/debug.cjs +50 -0
- package/dist/plugs/debug.cjs.map +6 -0
- package/dist/plugs/debug.mjs +25 -0
- package/dist/plugs/debug.mjs.map +6 -0
- package/dist/plugs/esbuild/bundle-locals.cjs +51 -0
- package/dist/plugs/esbuild/bundle-locals.cjs.map +6 -0
- package/dist/plugs/esbuild/bundle-locals.mjs +26 -0
- package/dist/plugs/esbuild/bundle-locals.mjs.map +6 -0
- package/dist/plugs/esbuild/check-dependencies.cjs +140 -0
- package/dist/plugs/esbuild/check-dependencies.cjs.map +6 -0
- package/dist/plugs/esbuild/check-dependencies.mjs +115 -0
- package/dist/plugs/esbuild/check-dependencies.mjs.map +6 -0
- package/dist/plugs/esbuild/fix-extensions.cjs +91 -0
- package/dist/plugs/esbuild/fix-extensions.cjs.map +6 -0
- package/dist/plugs/esbuild/fix-extensions.mjs +60 -0
- package/dist/plugs/esbuild/fix-extensions.mjs.map +6 -0
- package/dist/plugs/esbuild.cjs +109 -0
- package/dist/plugs/esbuild.cjs.map +6 -0
- package/dist/plugs/esbuild.mjs +83 -0
- package/dist/plugs/esbuild.mjs.map +6 -0
- package/dist/plugs/eslint/runner.cjs +91 -0
- package/dist/plugs/eslint/runner.cjs.map +6 -0
- package/dist/plugs/eslint/runner.mjs +68 -0
- package/dist/plugs/eslint/runner.mjs.map +6 -0
- package/dist/plugs/exec.cjs +128 -0
- package/dist/plugs/exec.cjs.map +6 -0
- package/dist/plugs/exec.mjs +96 -0
- package/dist/plugs/exec.mjs.map +6 -0
- package/dist/plugs/filter.cjs +59 -0
- package/dist/plugs/filter.cjs.map +6 -0
- package/dist/plugs/filter.mjs +34 -0
- package/dist/plugs/filter.mjs.map +6 -0
- package/dist/plugs/mocha/reporter.cjs +140 -0
- package/dist/plugs/mocha/reporter.cjs.map +6 -0
- package/dist/plugs/mocha/reporter.mjs +107 -0
- package/dist/plugs/mocha/reporter.mjs.map +6 -0
- package/dist/plugs/mocha/runner.cjs +73 -0
- package/dist/plugs/mocha/runner.cjs.map +6 -0
- package/dist/plugs/mocha/runner.mjs +44 -0
- package/dist/plugs/mocha/runner.mjs.map +6 -0
- package/dist/plugs/tsc/compiler.cjs +74 -0
- package/dist/plugs/tsc/compiler.cjs.map +6 -0
- package/dist/plugs/tsc/compiler.mjs +43 -0
- package/dist/plugs/tsc/compiler.mjs.map +6 -0
- package/dist/plugs/tsc/options.cjs +82 -0
- package/dist/plugs/tsc/options.cjs.map +6 -0
- package/dist/plugs/tsc/options.mjs +51 -0
- package/dist/plugs/tsc/options.mjs.map +6 -0
- package/dist/plugs/tsc/report.cjs +90 -0
- package/dist/plugs/tsc/report.cjs.map +6 -0
- package/dist/plugs/tsc/report.mjs +59 -0
- package/dist/plugs/tsc/report.mjs.map +6 -0
- package/dist/plugs/tsc/runner.cjs +101 -0
- package/dist/plugs/tsc/runner.cjs.map +6 -0
- package/dist/plugs/tsc/runner.mjs +72 -0
- package/dist/plugs/tsc/runner.mjs.map +6 -0
- package/dist/plugs.cjs +31 -0
- package/dist/plugs.cjs.map +6 -0
- package/dist/plugs.mjs +13 -0
- package/dist/plugs.mjs.map +6 -0
- package/dist/run.cjs +95 -0
- package/dist/run.cjs.map +6 -0
- package/dist/run.mjs +70 -0
- package/dist/run.mjs.map +6 -0
- package/dist/task.cjs +39 -0
- package/dist/task.cjs.map +6 -0
- package/dist/task.mjs +14 -0
- package/dist/task.mjs.map +6 -0
- package/dist/utils/asyncfs.cjs +143 -0
- package/dist/utils/asyncfs.cjs.map +6 -0
- package/dist/utils/asyncfs.mjs +83 -0
- package/dist/utils/asyncfs.mjs.map +6 -0
- package/dist/utils/caller.cjs +59 -0
- package/dist/utils/caller.cjs.map +6 -0
- package/dist/utils/caller.mjs +34 -0
- package/dist/utils/caller.mjs.map +6 -0
- package/dist/utils/match.cjs +69 -0
- package/dist/utils/match.cjs.map +6 -0
- package/dist/utils/match.mjs +38 -0
- package/dist/utils/match.mjs.map +6 -0
- package/dist/utils/options.cjs +41 -0
- package/dist/utils/options.cjs.map +6 -0
- package/dist/utils/options.mjs +16 -0
- package/dist/utils/options.mjs.map +6 -0
- package/dist/utils/walk.cjs +104 -0
- package/dist/utils/walk.cjs.map +6 -0
- package/dist/utils/walk.mjs +79 -0
- package/dist/utils/walk.mjs.map +6 -0
- package/extra/cli.mjs +212 -0
- package/extra/ts-loader.mjs +214 -0
- package/extra/webassembly.d.ts +11 -0
- package/package.json +57 -0
- package/src/assert.ts +47 -0
- package/src/async.ts +50 -0
- package/src/files.ts +129 -0
- package/src/fork.ts +263 -0
- package/src/helpers.ts +145 -0
- package/src/index.ts +20 -0
- package/src/log/colors.ts +119 -0
- package/src/log/emit.ts +125 -0
- package/src/log/levels.ts +65 -0
- package/src/log/logger.ts +171 -0
- package/src/log/options.ts +199 -0
- package/src/log/report.ts +433 -0
- package/src/log/spinner.ts +70 -0
- package/src/log.ts +68 -0
- package/src/paths.ts +213 -0
- package/src/pipe.ts +231 -0
- package/src/plugs/copy.ts +113 -0
- package/src/plugs/coverage/analysis.ts +395 -0
- package/src/plugs/coverage/report.ts +337 -0
- package/src/plugs/coverage.ts +194 -0
- package/src/plugs/debug.ts +35 -0
- package/src/plugs/esbuild/bundle-locals.ts +33 -0
- package/src/plugs/esbuild/check-dependencies.ts +158 -0
- package/src/plugs/esbuild/fix-extensions.ts +108 -0
- package/src/plugs/esbuild.ts +128 -0
- package/src/plugs/eslint/runner.ts +112 -0
- package/src/plugs/exec.ts +215 -0
- package/src/plugs/filter.ts +56 -0
- package/src/plugs/mocha/reporter.ts +152 -0
- package/src/plugs/mocha/runner.ts +77 -0
- package/src/plugs/tsc/compiler.ts +66 -0
- package/src/plugs/tsc/options.ts +97 -0
- package/src/plugs/tsc/report.ts +74 -0
- package/src/plugs/tsc/runner.ts +100 -0
- package/src/plugs.ts +33 -0
- package/src/run.ts +160 -0
- package/src/task.ts +26 -0
- package/src/utils/asyncfs.ts +82 -0
- package/src/utils/caller.ts +45 -0
- package/src/utils/match.ts +286 -0
- package/src/utils/options.ts +22 -0
- package/src/utils/walk.ts +136 -0
- package/types/assert.d.ts +18 -0
- package/types/async.d.ts +20 -0
- package/types/build.d.ts +56 -0
- package/types/files.d.ts +44 -0
- package/types/fork.d.ts +57 -0
- package/types/helpers.d.ts +49 -0
- package/types/index.d.ts +14 -0
- package/types/log/colors.d.ts +25 -0
- package/types/log/emit.d.ts +14 -0
- package/types/log/levels.d.ts +52 -0
- package/types/log/logger.d.ts +31 -0
- package/types/log/options.d.ts +40 -0
- package/types/log/report.d.ts +64 -0
- package/types/log/spinner.d.ts +2 -0
- package/types/log.d.ts +10 -0
- package/types/paths.d.ts +76 -0
- package/types/pipe.d.ts +152 -0
- package/types/plugs/copy.d.ts +27 -0
- package/types/plugs/coverage/analysis.d.ts +104 -0
- package/types/plugs/coverage/report.d.ts +53 -0
- package/types/plugs/coverage.d.ts +46 -0
- package/types/plugs/debug.d.ts +14 -0
- package/types/plugs/esbuild/bundle-locals.d.ts +6 -0
- package/types/plugs/esbuild/check-dependencies.d.ts +12 -0
- package/types/plugs/esbuild/fix-extensions.d.ts +29 -0
- package/types/plugs/esbuild.d.ts +24 -0
- package/types/plugs/eslint/runner.d.ts +22 -0
- package/types/plugs/exec.d.ts +90 -0
- package/types/plugs/filter.d.ts +23 -0
- package/types/plugs/mocha/reporter.d.ts +8 -0
- package/types/plugs/mocha/runner.d.ts +34 -0
- package/types/plugs/tsc/compiler.d.ts +24 -0
- package/types/plugs/tsc/options.d.ts +8 -0
- package/types/plugs/tsc/report.d.ts +5 -0
- package/types/plugs/tsc/runner.d.ts +13 -0
- package/types/plugs.d.ts +16 -0
- package/types/run.d.ts +89 -0
- package/types/task.d.ts +15 -0
- package/types/utils/asyncfs.d.ts +37 -0
- package/types/utils/caller.d.ts +7 -0
- package/types/utils/match.d.ts +216 -0
- package/types/utils/options.d.ts +15 -0
- package/types/utils/walk.d.ts +28 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import picomatch from 'picomatch'
|
|
2
|
+
|
|
3
|
+
export interface MatchResult {
|
|
4
|
+
/** The glob that matched this `MatchResult` */
|
|
5
|
+
glob: string;
|
|
6
|
+
/** The regular expression that matched this `MatchResult` */
|
|
7
|
+
regex: RegExp;
|
|
8
|
+
/** The input string of this `MatchResult` */
|
|
9
|
+
input: string;
|
|
10
|
+
/** The input string of this `MatchResult` */
|
|
11
|
+
output: string;
|
|
12
|
+
/** The match result of this instance, if any */
|
|
13
|
+
match?: boolean | RegExpExecArray | null;
|
|
14
|
+
/** Whether the string matched or not */
|
|
15
|
+
isMatch: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface MatchOptions {
|
|
19
|
+
/**
|
|
20
|
+
* If set, then patterns without slashes will be matched against the basename
|
|
21
|
+
* of the path if it contains slashes.
|
|
22
|
+
*
|
|
23
|
+
* For example, `a?b` would match the path `/xyz/123/acb`, but not
|
|
24
|
+
* `/xyz/acb/123`.
|
|
25
|
+
*
|
|
26
|
+
* @defaultValue `false`
|
|
27
|
+
*/
|
|
28
|
+
basename?: boolean,
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Follow bash matching rules more strictly - disallows backslashes as escape
|
|
32
|
+
* characters, and treats single stars as globstars (`**`).
|
|
33
|
+
*
|
|
34
|
+
* @defaultValue `false`
|
|
35
|
+
*/
|
|
36
|
+
bash?: boolean,
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Return regex matches in `onIgnore(..)`, `onMatch(..)` and `onResult(..)`.
|
|
40
|
+
*
|
|
41
|
+
* @defaultValue `false`
|
|
42
|
+
*/
|
|
43
|
+
capture?: boolean,
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Allows glob to match any part of the given string(s).
|
|
47
|
+
*
|
|
48
|
+
* @defaultValue `false`
|
|
49
|
+
*/
|
|
50
|
+
contains?: boolean,
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Debug regular expressions when an error is thrown.
|
|
54
|
+
*
|
|
55
|
+
* @defaultValue `false`
|
|
56
|
+
*/
|
|
57
|
+
debug?: boolean,
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Enable dotfile matching.
|
|
61
|
+
*
|
|
62
|
+
* By default, dotfiles are ignored unless a `.` is explicitly defined in
|
|
63
|
+
* the pattern, or this option is `true`.
|
|
64
|
+
*
|
|
65
|
+
* @defaultValue `false`
|
|
66
|
+
*/
|
|
67
|
+
dot?: boolean,
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Custom function for expanding ranges in brace patterns, such as `{a..z}`.
|
|
71
|
+
*
|
|
72
|
+
* The function receives the range values as two arguments, and it must
|
|
73
|
+
* return a string to be used in the generated regex.
|
|
74
|
+
*
|
|
75
|
+
* It's recommended that returned strings be wrapped in parentheses.
|
|
76
|
+
*
|
|
77
|
+
* @defaultValue `undefined`
|
|
78
|
+
*/
|
|
79
|
+
expandRange?: (a: string, b: string) => string,
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* To speed up processing, full parsing is skipped for a handful common glob
|
|
83
|
+
* patterns.
|
|
84
|
+
*
|
|
85
|
+
* Disable this behavior by setting this option to `false`.
|
|
86
|
+
*
|
|
87
|
+
* @defaultValue `true`
|
|
88
|
+
*/
|
|
89
|
+
fastpaths?: boolean,
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Regex flags to use in the generated regex.
|
|
93
|
+
*
|
|
94
|
+
* If defined, the nocase option will be overridden.
|
|
95
|
+
*
|
|
96
|
+
* @defaultValue `undefined`
|
|
97
|
+
*/
|
|
98
|
+
flags?: string,
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* One or more glob patterns for excluding strings that should not be matched
|
|
102
|
+
* from the result.
|
|
103
|
+
*
|
|
104
|
+
* @defaultValue `undefined`
|
|
105
|
+
*/
|
|
106
|
+
ignore?: string | string[],
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Retain quotes in the generated regular expressions, since quotes may also
|
|
110
|
+
* be used as an alternative to backslashes.
|
|
111
|
+
*
|
|
112
|
+
* @defaultValue `false`
|
|
113
|
+
*/
|
|
114
|
+
keepQuotes?: boolean,
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* When `true`, brackets in the glob pattern will be escaped so that only
|
|
118
|
+
* literal brackets will be matched.
|
|
119
|
+
*
|
|
120
|
+
* @defaultValue `false`
|
|
121
|
+
*/
|
|
122
|
+
literalBrackets?: boolean,
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as
|
|
126
|
+
* literal characters.
|
|
127
|
+
*
|
|
128
|
+
* @defaultValue `false`
|
|
129
|
+
*/
|
|
130
|
+
nobrace?: boolean,
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Disable matching with regex brackets.
|
|
134
|
+
*
|
|
135
|
+
* @defaultValue `false`
|
|
136
|
+
*/
|
|
137
|
+
nobracket?: boolean,
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Make matching case-insensitive (equivalent to the regex `i` flag).
|
|
141
|
+
*
|
|
142
|
+
* Note that this option is overridden by the flags option.
|
|
143
|
+
*
|
|
144
|
+
* @defaultValue `false`
|
|
145
|
+
*/
|
|
146
|
+
nocase?: boolean,
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Disable support for matching with extglobs (like `+(a|b)`).
|
|
150
|
+
*
|
|
151
|
+
* @defaultValue `false`
|
|
152
|
+
*/
|
|
153
|
+
noextglob?: boolean,
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Disable support for matching nested directories with globstars (`**`).
|
|
157
|
+
*
|
|
158
|
+
* @defaultValue `false`
|
|
159
|
+
*/
|
|
160
|
+
noglobstar?: boolean,
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Disable support for negating with leading `!`.
|
|
164
|
+
*
|
|
165
|
+
* @defaultValue `false`
|
|
166
|
+
*/
|
|
167
|
+
nonegate?: boolean,
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Disable support for regex quantifiers (like `a{1,2}`) and treat them as
|
|
171
|
+
* brace patterns to be expanded.
|
|
172
|
+
*
|
|
173
|
+
* @defaultValue `false`
|
|
174
|
+
*/
|
|
175
|
+
noquantifiers?: boolean,
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Function to be called on ignored items.
|
|
179
|
+
*
|
|
180
|
+
* @defaultValue `undefined`
|
|
181
|
+
*/
|
|
182
|
+
onIgnore?: (result: MatchResult) => void,
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Function to be called on matched items.
|
|
186
|
+
*
|
|
187
|
+
* @defaultValue `undefined`
|
|
188
|
+
*/
|
|
189
|
+
onMatch?: (result: MatchResult) => void,
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Function to be called on all items, regardless of whether or not they
|
|
193
|
+
* are matched or ignored.
|
|
194
|
+
*
|
|
195
|
+
* @defaultValue `undefined`
|
|
196
|
+
*/
|
|
197
|
+
onResult?: (result: MatchResult) => void,
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Support POSIX character classes ("posix brackets").
|
|
201
|
+
*
|
|
202
|
+
* @defaultValue `false`
|
|
203
|
+
*/
|
|
204
|
+
posix?: boolean,
|
|
205
|
+
|
|
206
|
+
// /**
|
|
207
|
+
// * String to prepend to the generated regex used for matching.
|
|
208
|
+
// *
|
|
209
|
+
// * @defaultValue `undefined`
|
|
210
|
+
// */
|
|
211
|
+
// prepend?: string,
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Use regular expression rules for `+` (instead of matching literal `+`),
|
|
215
|
+
* and for stars that follow closing parentheses or brackets (as in `)*`
|
|
216
|
+
* and `]*`).
|
|
217
|
+
*
|
|
218
|
+
* @defaultValue `false`
|
|
219
|
+
*/
|
|
220
|
+
regex?: boolean,
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Throw an error if brackets, braces, or parens are imbalanced.
|
|
224
|
+
*
|
|
225
|
+
* @defaultValue `false`
|
|
226
|
+
*/
|
|
227
|
+
strictBrackets?: boolean,
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* When true, picomatch won't match trailing slashes with single stars.
|
|
231
|
+
*
|
|
232
|
+
* @defaultValue `false`
|
|
233
|
+
*/
|
|
234
|
+
strictSlashes?: boolean,
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Remove backslashes preceding escaped characters in the glob pattern.
|
|
238
|
+
*
|
|
239
|
+
* By default, backslashes are retained.
|
|
240
|
+
*
|
|
241
|
+
* @defaultValue `false`
|
|
242
|
+
*/
|
|
243
|
+
unescape?: boolean,
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/** A _function_ matching a string. */
|
|
247
|
+
export type Matcher = (string: string) => boolean
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Create a {@link Matcher} according to the globs and options specified.
|
|
251
|
+
*
|
|
252
|
+
* Remember that no globs here means an always-failing matcher.
|
|
253
|
+
*/
|
|
254
|
+
export function match(globs: readonly string[], options: MatchOptions = {}): Matcher {
|
|
255
|
+
return picomatch([ ...globs ], {
|
|
256
|
+
basename: false,
|
|
257
|
+
bash: false,
|
|
258
|
+
capture: false,
|
|
259
|
+
contains: false,
|
|
260
|
+
debug: false,
|
|
261
|
+
dot: false,
|
|
262
|
+
expandRange: undefined,
|
|
263
|
+
fastpaths: true,
|
|
264
|
+
flags: undefined,
|
|
265
|
+
ignore: undefined,
|
|
266
|
+
keepQuotes: false,
|
|
267
|
+
literalBrackets: false,
|
|
268
|
+
nobrace: false,
|
|
269
|
+
nobracket: false,
|
|
270
|
+
nocase: false,
|
|
271
|
+
noextglob: false,
|
|
272
|
+
noglobstar: false,
|
|
273
|
+
nonegate: false,
|
|
274
|
+
noquantifiers: false,
|
|
275
|
+
onIgnore: undefined,
|
|
276
|
+
onMatch: undefined,
|
|
277
|
+
onResult: undefined,
|
|
278
|
+
posix: false,
|
|
279
|
+
// prepend: undefined,
|
|
280
|
+
regex: false,
|
|
281
|
+
strictBrackets: false,
|
|
282
|
+
strictSlashes: false,
|
|
283
|
+
unescape: false,
|
|
284
|
+
...options,
|
|
285
|
+
})
|
|
286
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type ParsedOptions<Options> = { params: string[], options: Options }
|
|
2
|
+
export type ParsedOptionalOptions<Options> = { params: string[], options?: Options | undefined }
|
|
3
|
+
export type ParseOptions<Options> = string[] | [ ...string[], Options ] | [ Options ]
|
|
4
|
+
|
|
5
|
+
/** Parse an array of at least one string, followed by an optional `Options` argument. */
|
|
6
|
+
export function parseOptions<Options>(args: ParseOptions<Options>): ParsedOptionalOptions<Options>
|
|
7
|
+
/** Parse an array of at least one string, followed by an optional `Options` argument. */
|
|
8
|
+
export function parseOptions<Options>(args: ParseOptions<Options>, defaults?: undefined): ParsedOptionalOptions<Options>
|
|
9
|
+
/** Parse an array of at least one string, followed by an optional `Options` argument, ensuring some defaults are present. */
|
|
10
|
+
export function parseOptions<Options, Defaults extends Options>(args: ParseOptions<Options>, defaults: Defaults): ParsedOptions<Options & Defaults>
|
|
11
|
+
// overloaded implementation
|
|
12
|
+
export function parseOptions<Options, Defaults extends Options>(args: ParseOptions<Options>, defaults?: Defaults): ParsedOptions<any> {
|
|
13
|
+
const params: string[] = []
|
|
14
|
+
const options: any = { ...defaults }
|
|
15
|
+
|
|
16
|
+
for (const arg of args) {
|
|
17
|
+
if (typeof arg === 'string') params.push(arg)
|
|
18
|
+
else Object.assign(options, arg)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return { params, options }
|
|
22
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { basename, join } from 'node:path'
|
|
2
|
+
import { $p, log } from '../log.js'
|
|
3
|
+
import { AbsolutePath, resolveAbsolutePath } from '../paths.js'
|
|
4
|
+
import { readdir, stat } from './asyncfs.js'
|
|
5
|
+
import { match, MatchOptions } from './match.js'
|
|
6
|
+
|
|
7
|
+
/** Specific options for walking a directory */
|
|
8
|
+
export interface WalkOptions extends MatchOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Whether symlinks should be followed or not.
|
|
11
|
+
*
|
|
12
|
+
* @defaultValue `true`
|
|
13
|
+
*/
|
|
14
|
+
followSymlinks?: boolean,
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The maximum depth (in directory levels) to recurse into.
|
|
18
|
+
*
|
|
19
|
+
* @defaultValue `Infinity`
|
|
20
|
+
*/
|
|
21
|
+
maxDepth?: number,
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Whether to allow walking any `node_modules` directory or not.
|
|
25
|
+
*
|
|
26
|
+
* @defaultValue `false`
|
|
27
|
+
*/
|
|
28
|
+
allowNodeModules?: boolean,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Walk the specified directory, returning an asynchronous iterator over all
|
|
33
|
+
* the _relative_ files found matching the specified globs and matching options.
|
|
34
|
+
*/
|
|
35
|
+
export function walk(
|
|
36
|
+
directory: AbsolutePath,
|
|
37
|
+
globs: string[],
|
|
38
|
+
options: WalkOptions = {},
|
|
39
|
+
): AsyncGenerator<string, void, void> {
|
|
40
|
+
const {
|
|
41
|
+
maxDepth = Infinity,
|
|
42
|
+
followSymlinks = true,
|
|
43
|
+
allowNodeModules = false,
|
|
44
|
+
...opts
|
|
45
|
+
} = options
|
|
46
|
+
|
|
47
|
+
/* Make sure to also ignore node modules or dot directories if we have to */
|
|
48
|
+
const onDirectory = (dir: AbsolutePath): boolean => {
|
|
49
|
+
// if we were told to start looking into "node_modules", or in a directory
|
|
50
|
+
// starting with ".", then we ignore any whatsoever option here!
|
|
51
|
+
if (dir === directory) return true
|
|
52
|
+
const name = basename(dir)
|
|
53
|
+
if (name === 'node_modules') return !!allowNodeModules
|
|
54
|
+
if (name.startsWith('.')) return !!opts.dot
|
|
55
|
+
return true
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Create our positive matcher to match our globs */
|
|
59
|
+
const positiveMatcher = match(globs, opts)
|
|
60
|
+
|
|
61
|
+
/* Do the walk! */
|
|
62
|
+
log.debug('Walking directory', $p(directory), { globs, options })
|
|
63
|
+
return walker({
|
|
64
|
+
directory,
|
|
65
|
+
relative: '',
|
|
66
|
+
matcher: positiveMatcher,
|
|
67
|
+
onDirectory,
|
|
68
|
+
followSymlinks,
|
|
69
|
+
maxDepth,
|
|
70
|
+
depth: 0,
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* ========================================================================== *
|
|
75
|
+
* INTERNALS *
|
|
76
|
+
* ========================================================================== */
|
|
77
|
+
|
|
78
|
+
interface WalkerArguments {
|
|
79
|
+
directory: AbsolutePath,
|
|
80
|
+
relative: string,
|
|
81
|
+
matcher: (path: string) => boolean,
|
|
82
|
+
onDirectory: (directory: AbsolutePath) => boolean,
|
|
83
|
+
followSymlinks: boolean,
|
|
84
|
+
maxDepth: number,
|
|
85
|
+
depth: number,
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* Walk a directory and yield matching results until the given `maxDepth` */
|
|
89
|
+
async function* walker(args: WalkerArguments): AsyncGenerator<string, void, void> {
|
|
90
|
+
const {
|
|
91
|
+
directory,
|
|
92
|
+
relative,
|
|
93
|
+
matcher: positiveMatcher,
|
|
94
|
+
onDirectory,
|
|
95
|
+
followSymlinks,
|
|
96
|
+
maxDepth,
|
|
97
|
+
depth,
|
|
98
|
+
} = args
|
|
99
|
+
|
|
100
|
+
/* Read the directory, including file types */
|
|
101
|
+
const dir = resolveAbsolutePath(directory, relative)
|
|
102
|
+
if (! onDirectory(dir)) return
|
|
103
|
+
log.trace('Reading directory', $p(dir))
|
|
104
|
+
const dirents = await readdir(dir, { withFileTypes: true }).catch((error) => {
|
|
105
|
+
if (error.code !== 'ENOENT') throw error
|
|
106
|
+
log.warn('Directory', $p(dir), 'not found')
|
|
107
|
+
return []
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
/* For each entry we determine the full path */
|
|
111
|
+
for (const dirent of dirents) {
|
|
112
|
+
const path = join(relative, dirent.name)
|
|
113
|
+
|
|
114
|
+
/* If the entry is a file and matches, yield it */
|
|
115
|
+
if (dirent.isFile() && positiveMatcher(path)) yield path
|
|
116
|
+
|
|
117
|
+
/* If the entry is a directory within our depth, walk it recursively */
|
|
118
|
+
else if (dirent.isDirectory() && (depth < maxDepth)) {
|
|
119
|
+
const children = walker({ ...args, relative: path, depth: depth + 1 })
|
|
120
|
+
for await (const child of children) yield child
|
|
121
|
+
|
|
122
|
+
/* If this is a symlink and we're told to check them let's see what we have */
|
|
123
|
+
} else if (dirent.isSymbolicLink() && followSymlinks) {
|
|
124
|
+
const info = await stat(join(directory, path))
|
|
125
|
+
|
|
126
|
+
/* If the link is a file and matches, yield it */
|
|
127
|
+
if (info.isFile() && positiveMatcher(path)) yield path
|
|
128
|
+
|
|
129
|
+
/* If the link is a directory within our depth, walk it recursively */
|
|
130
|
+
else if (info.isDirectory() && (depth < maxDepth)) {
|
|
131
|
+
const children = walker({ ...args, relative: path, depth: depth + 1 })
|
|
132
|
+
for await (const child of children) yield child
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Check if the specified argument is a {@link BuildError} */
|
|
2
|
+
export declare function isBuildError(arg: any): arg is BuildError;
|
|
3
|
+
/** Check if the specified argument is a {@link BuildFailure} */
|
|
4
|
+
export declare function isBuildFailure(arg: any): arg is BuildFailure;
|
|
5
|
+
/** An error produced in our build, with proper inspection for logging */
|
|
6
|
+
export declare class BuildError extends Error {
|
|
7
|
+
constructor(message: string);
|
|
8
|
+
}
|
|
9
|
+
/** A {@link BuildFailure} represents an error _already logged_ in our build. */
|
|
10
|
+
export declare class BuildFailure extends Error {
|
|
11
|
+
constructor();
|
|
12
|
+
}
|
|
13
|
+
/** Asserts something as _truthy_ and fail the build if not */
|
|
14
|
+
export declare function assert(assertion: any, message: string): asserts assertion;
|
|
15
|
+
/** Throw a {@link BuildError} (an {@link Error} printed nicely) */
|
|
16
|
+
export declare function fail(message: string): never;
|
|
17
|
+
/** Return a non-logged {@link BuildFailure} */
|
|
18
|
+
export declare function failure(): BuildFailure;
|
package/types/async.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Run } from './run.js';
|
|
2
|
+
/**
|
|
3
|
+
* Run the specified `callback` associating the specified {@link Run} and task
|
|
4
|
+
* name with the current asynchronous invocation context.
|
|
5
|
+
*/
|
|
6
|
+
export declare function runAsync<T>(run: Run, task: string, callback: () => Promise<T>): Promise<T>;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the _task name_ associated with the current asynchronous invocation
|
|
9
|
+
* context or `undefined`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function currentTask(): string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the {@link Run} associated with the current asynchronous invocation
|
|
14
|
+
* context or `undefined`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function currentRun(): Run | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Return an array of all _task names_ currently running
|
|
19
|
+
*/
|
|
20
|
+
export declare function runningTasks(): string[];
|
package/types/build.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Files } from './files.js';
|
|
2
|
+
import { AbsolutePath } from './paths.js';
|
|
3
|
+
import { Pipe } from './pipe.js';
|
|
4
|
+
import { Run } from './run.js';
|
|
5
|
+
import { Task } from './task.js';
|
|
6
|
+
/**
|
|
7
|
+
* The {@link BuildContext} interface exposes the _internal_ representation of
|
|
8
|
+
* a build file, including all {@link Task | Tasks}.
|
|
9
|
+
*/
|
|
10
|
+
export declare type BuildContext = {
|
|
11
|
+
/** The absolute file name of the build */
|
|
12
|
+
readonly buildFile: AbsolutePath;
|
|
13
|
+
/** For convenience, the directory of the build file */
|
|
14
|
+
readonly buildDir: AbsolutePath;
|
|
15
|
+
/** A record of all tasks keyed by name */
|
|
16
|
+
readonly tasks: Readonly<Record<string, Task>>;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* A {@link TaskDefinition} is a _function_ defining a {@link Task}.
|
|
20
|
+
*/
|
|
21
|
+
export declare type TaskDefinition<B> = (this: ThisBuild<B>, self: ThisBuild<B>, run: Run) => Files | undefined | void | Promise<Files | undefined | void>;
|
|
22
|
+
/**
|
|
23
|
+
* A {@link TaskCall} describes a _function_ calling a {@link Task}, and
|
|
24
|
+
* it is exposed to outside users of the {@link Build}.
|
|
25
|
+
*/
|
|
26
|
+
export declare type TaskCall<T extends Files | undefined> = ((run?: Run) => Promise<Run>) & {
|
|
27
|
+
readonly task: Task<T>;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* A {@link Build} is a collection of {@link TaskCall | TaskCalls}, as produced
|
|
31
|
+
* by the {@link build} function from a {@link BuildDefinition}.
|
|
32
|
+
*/
|
|
33
|
+
export declare type Build<B> = {
|
|
34
|
+
[K in keyof B]: B[K] extends TaskCall<infer T> ? TaskCall<T> : B[K] extends () => Files | Promise<Files> ? TaskCall<Files> : B[K] extends () => undefined | void | Promise<undefined | void> ? TaskCall<undefined> : never;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* The type supplied as `this` to a {@link TaskDefinition} when invoking it.
|
|
38
|
+
*/
|
|
39
|
+
export declare type ThisBuild<B> = {
|
|
40
|
+
[K in keyof B]: B[K] extends () => Files | Promise<Files> ? () => Pipe & Promise<Files> : B[K] extends () => undefined | void | Promise<undefined | void> ? () => Promise<undefined> : never;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* A {@link BuildDefinition} is a collection of
|
|
44
|
+
* {@link TaskDefinition | TaskDefinitions} that the {@link build} function will
|
|
45
|
+
* use to create a {@link Build}.
|
|
46
|
+
*
|
|
47
|
+
* A {@link BuildDefinition} can also include other {@link TaskCall | TaskCalls},
|
|
48
|
+
* thus giving the ability to extend other {@link Build | Builds}.
|
|
49
|
+
*/
|
|
50
|
+
export declare type BuildDefinition<B> = {
|
|
51
|
+
[K in keyof B]: TaskDefinition<B> | TaskCall<Files | undefined>;
|
|
52
|
+
};
|
|
53
|
+
/** Check if the specified build is actually a {@link Build} */
|
|
54
|
+
export declare function isBuild(build: any): build is Build<any>;
|
|
55
|
+
/** Create a new {@link Build} from its {@link BuildDefinition}. */
|
|
56
|
+
export declare function build<D extends BuildDefinition<D>>(definition: D & ThisType<ThisBuild<D>>): Build<D>;
|
package/types/files.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
+
import { inspect } from 'node:util';
|
|
4
|
+
import { AbsolutePath } from './paths.js';
|
|
5
|
+
/** The {@link FilesBuilder} interface defines a builder for {@link Files}. */
|
|
6
|
+
export interface FilesBuilder {
|
|
7
|
+
/** The (resolved) directory the {@link Files} will be associated with */
|
|
8
|
+
readonly directory: AbsolutePath;
|
|
9
|
+
/** Push files into the {@link Files} instance being built */
|
|
10
|
+
add(...files: string[]): this;
|
|
11
|
+
/** Merge orther {@link Files} instance to the {@link Files} being built */
|
|
12
|
+
merge(...files: Files[]): this;
|
|
13
|
+
/** Write a file and add it to the {@link Files} instance being built */
|
|
14
|
+
write(file: string, content: string | Buffer): Promise<AbsolutePath>;
|
|
15
|
+
/** Build and return a {@link Files} instance */
|
|
16
|
+
build(): Files;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The {@link Files} class represents a collection of relative path names
|
|
20
|
+
* identifying some _files_ rooted in a given _directory_.
|
|
21
|
+
*/
|
|
22
|
+
export declare class Files {
|
|
23
|
+
readonly _directory: AbsolutePath;
|
|
24
|
+
readonly _files: string[];
|
|
25
|
+
/**
|
|
26
|
+
* Create a new {@link Files} instance rooted in the specified `directory`
|
|
27
|
+
* relative to the specified {@link Run}'s directory.
|
|
28
|
+
*/
|
|
29
|
+
constructor(directory: AbsolutePath);
|
|
30
|
+
/** Return the _directory_ where this {@link Files} is rooted */
|
|
31
|
+
get directory(): AbsolutePath;
|
|
32
|
+
/** Return the number of files tracked by this instance. */
|
|
33
|
+
get length(): number;
|
|
34
|
+
/** Return an iterator over all _relative_ files of this instance */
|
|
35
|
+
[Symbol.iterator](): Generator<string>;
|
|
36
|
+
/** Return an iterator over all _absolute_ files of this instance */
|
|
37
|
+
absolutePaths(): Generator<AbsolutePath>;
|
|
38
|
+
/** Return an iterator over all _relative_ to _absolute_ mappings */
|
|
39
|
+
pathMappings(): Generator<[relative: string, absolute: AbsolutePath]>;
|
|
40
|
+
[inspect.custom](): any;
|
|
41
|
+
/** Create a new {@link FilesBuilder} creating {@link Files} instances. */
|
|
42
|
+
static builder(files: Files): FilesBuilder;
|
|
43
|
+
static builder(directory: AbsolutePath): FilesBuilder;
|
|
44
|
+
}
|
package/types/fork.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Files } from './files.js';
|
|
2
|
+
import { LogOptions } from './log.js';
|
|
3
|
+
import { AbsolutePath } from './paths.js';
|
|
4
|
+
import { Plug, PlugName } from './pipe.js';
|
|
5
|
+
import { Run } from './run.js';
|
|
6
|
+
/** Fork data, from parent to child process */
|
|
7
|
+
export interface ForkData {
|
|
8
|
+
/** Script name for the Plug to execute */
|
|
9
|
+
scriptFile: AbsolutePath;
|
|
10
|
+
/** Plug constructor arguments */
|
|
11
|
+
constructorArgs: any[];
|
|
12
|
+
/** Task name (for logs) */
|
|
13
|
+
taskName: string;
|
|
14
|
+
/** Build file name */
|
|
15
|
+
buildFile: AbsolutePath;
|
|
16
|
+
/** Build directory */
|
|
17
|
+
buildDir: AbsolutePath;
|
|
18
|
+
/** Files directory */
|
|
19
|
+
filesDir: AbsolutePath;
|
|
20
|
+
/** All files to pipe */
|
|
21
|
+
filesList: AbsolutePath[];
|
|
22
|
+
/** Options for our logger in the child process */
|
|
23
|
+
logOpts: Partial<LogOptions>;
|
|
24
|
+
}
|
|
25
|
+
/** Fork result, from child to parent process */
|
|
26
|
+
export interface ForkResult {
|
|
27
|
+
/** If this is `true` we _might_ have `filesDir` and `filesList` */
|
|
28
|
+
failed: boolean;
|
|
29
|
+
/** Files directory of the result */
|
|
30
|
+
filesDir?: AbsolutePath | undefined;
|
|
31
|
+
/** All files returned by the plug */
|
|
32
|
+
filesList?: AbsolutePath[] | undefined;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Install a _forking_ {@link Plug} in the {@link Pipe}, in other words
|
|
36
|
+
* execute the plug in a separate process.
|
|
37
|
+
*
|
|
38
|
+
* As a contract, if the _last non-null_ parameter of the constructor is an
|
|
39
|
+
* object and contains the key `coverageDir`, the process will be forked with
|
|
40
|
+
* the approptiately resolved `NODE_V8_COVERAGE` environment variable.
|
|
41
|
+
*
|
|
42
|
+
* Also, forking plugs require some special attention:
|
|
43
|
+
*
|
|
44
|
+
* * plug functions are not supported, only classes implementing the
|
|
45
|
+
* {@link Plug} interface can be used with this.
|
|
46
|
+
*
|
|
47
|
+
* * the class itself _MUST_ be exported as the _default_ export for the
|
|
48
|
+
* `scriptFile` specified below. This is to simplify interoperability between
|
|
49
|
+
* CommonJS and ESM modules as we use dynamic `import(...)` statements.
|
|
50
|
+
*/
|
|
51
|
+
export declare function installForking(plugName: PlugName, scriptFile: AbsolutePath): void;
|
|
52
|
+
export declare abstract class ForkingPlug implements Plug<Files | undefined> {
|
|
53
|
+
private readonly _scriptFile;
|
|
54
|
+
private readonly _arguments;
|
|
55
|
+
constructor(_scriptFile: AbsolutePath, _arguments: any[]);
|
|
56
|
+
pipe(files: Files, run: Run): Promise<Files | undefined>;
|
|
57
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Files, FilesBuilder } from './files.js';
|
|
2
|
+
import { LogLevelString } from './log.js';
|
|
3
|
+
import { AbsolutePath } from './paths.js';
|
|
4
|
+
import { Pipe } from './pipe.js';
|
|
5
|
+
import { FindOptions } from './run.js';
|
|
6
|
+
import { ParseOptions } from './utils/options.js';
|
|
7
|
+
/**
|
|
8
|
+
* Recursively remove the specified directory _**(use with care)**_.
|
|
9
|
+
*/
|
|
10
|
+
export declare function rmrf(directory: string): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Set the current _log level_.
|
|
13
|
+
*
|
|
14
|
+
* The _level_ will be applied _only_ within the execution of the current task.
|
|
15
|
+
*/
|
|
16
|
+
export declare function setLogLevel(level: LogLevelString): void;
|
|
17
|
+
/**
|
|
18
|
+
* Resolve a path into an {@link AbsolutePath}.
|
|
19
|
+
*
|
|
20
|
+
* If the path starts with `@...` it is considered to be relative to the
|
|
21
|
+
* {@link process.cwd | current working directory}, otherwise it will be
|
|
22
|
+
* resolved against the build file where the task was originally defined in.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolve(...paths: string[]): AbsolutePath;
|
|
25
|
+
/**
|
|
26
|
+
* Create a new {@link Files} instance.
|
|
27
|
+
*/
|
|
28
|
+
export declare function files(files: Files): FilesBuilder;
|
|
29
|
+
export declare function files(...paths: string[]): FilesBuilder;
|
|
30
|
+
/**
|
|
31
|
+
* Merge multiple {@link Files} instance.
|
|
32
|
+
*/
|
|
33
|
+
export declare function merge(args: (Files | Promise<Files>)[]): Promise<Files> & Pipe;
|
|
34
|
+
/**
|
|
35
|
+
* Find files according to the globs and {@link FindOptions} specified.
|
|
36
|
+
*/
|
|
37
|
+
export declare function find(glob: string, ...args: ParseOptions<FindOptions>): Pipe & Promise<Files>;
|
|
38
|
+
/** Create a {@link Pipe} from a {@link Files} instance. */
|
|
39
|
+
export declare function pipe(files: Files | Promise<Files>): Pipe & Promise<Files>;
|
|
40
|
+
/** Await for the settlement of all the promises, then return their results. */
|
|
41
|
+
export declare function parallel<P extends readonly any[]>(promises: P): Promise<ParallelResult<P>>;
|
|
42
|
+
declare type ParallelResult<T extends readonly any[]> = T extends readonly [infer First, ...infer Rest] ? [
|
|
43
|
+
Awaited<First>,
|
|
44
|
+
...ParallelResult<Rest>
|
|
45
|
+
] : T extends readonly [infer Only] ? [
|
|
46
|
+
Awaited<Only>
|
|
47
|
+
] : T extends readonly [] ? [
|
|
48
|
+
] : never;
|
|
49
|
+
export {};
|