@umijs/utils 3.5.20 → 4.0.0-beta.12
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/README.md +2 -0
- package/compiled/address/index.js +1 -0
- package/compiled/address/lib/address.d.ts +28 -0
- package/compiled/address/package.json +1 -0
- package/compiled/axios/LICENSE +19 -0
- package/compiled/axios/index.d.ts +206 -0
- package/compiled/axios/index.js +1 -0
- package/compiled/axios/package.json +1 -0
- package/compiled/chalk/LICENSE +9 -0
- package/compiled/chalk/index.d.ts +415 -0
- package/compiled/chalk/index.js +1 -0
- package/compiled/chalk/package.json +1 -0
- package/compiled/cheerio/LICENSE +21 -0
- package/compiled/cheerio/domelementtype/lib/index.d.ts +48 -0
- package/compiled/cheerio/domhandler/lib/index.d.ts +85 -0
- package/compiled/cheerio/domhandler/lib/node.d.ts +169 -0
- package/compiled/cheerio/htmlparser2/lib/Parser.d.ts +159 -0
- package/compiled/cheerio/htmlparser2/lib/Tokenizer.d.ts +182 -0
- package/compiled/cheerio/htmlparser2/lib/index.d.ts +39 -0
- package/compiled/cheerio/index.js +16 -0
- package/compiled/cheerio/lib/api/attributes.d.ts +317 -0
- package/compiled/cheerio/lib/api/css.d.ts +41 -0
- package/compiled/cheerio/lib/api/forms.d.ts +31 -0
- package/compiled/cheerio/lib/api/manipulation.d.ts +496 -0
- package/compiled/cheerio/lib/api/traversing.d.ts +644 -0
- package/compiled/cheerio/lib/cheerio.d.ts +53 -0
- package/compiled/cheerio/lib/index.d.ts +91 -0
- package/compiled/cheerio/lib/load.d.ts +73 -0
- package/compiled/cheerio/lib/options.d.ts +31 -0
- package/compiled/cheerio/lib/static.d.ts +88 -0
- package/compiled/cheerio/lib/types.d.ts +20 -0
- package/compiled/cheerio/package.json +1 -0
- package/compiled/color/LICENSE +21 -0
- package/compiled/color/color-convert/conversions.d.ts +149 -0
- package/compiled/color/color-convert/index.d.ts +128 -0
- package/compiled/color/color-convert/route.d.ts +294 -0
- package/compiled/color/color-name/index.d.ts +161 -0
- package/compiled/color/index.d.ts +137 -0
- package/compiled/color/index.js +1 -0
- package/compiled/color/package.json +1 -0
- package/compiled/cross-spawn/LICENSE +21 -0
- package/compiled/cross-spawn/index.d.ts +36 -0
- package/compiled/cross-spawn/index.js +1 -0
- package/compiled/cross-spawn/package.json +1 -0
- package/compiled/debug/LICENSE +20 -0
- package/compiled/debug/index.d.ts +54 -0
- package/compiled/debug/index.js +1 -0
- package/compiled/debug/ms/index.d.ts +25 -0
- package/compiled/debug/package.json +1 -0
- package/compiled/deepmerge/index.d.ts +16 -0
- package/compiled/deepmerge/index.js +1 -0
- package/compiled/deepmerge/package.json +1 -0
- package/compiled/execa/LICENSE +9 -0
- package/compiled/execa/index.d.ts +564 -0
- package/compiled/execa/index.js +1 -0
- package/compiled/execa/package.json +1 -0
- package/compiled/fs-extra/LICENSE +15 -0
- package/compiled/fs-extra/index.d.ts +332 -0
- package/compiled/fs-extra/index.js +1 -0
- package/compiled/fs-extra/package.json +1 -0
- package/compiled/glob/LICENSE +21 -0
- package/compiled/glob/index.d.ts +89 -0
- package/compiled/glob/index.js +1 -0
- package/compiled/glob/minimatch/index.d.ts +204 -0
- package/compiled/glob/package.json +1 -0
- package/compiled/import-lazy/LICENSE +9 -0
- package/compiled/import-lazy/index.d.ts +26 -0
- package/compiled/import-lazy/index.js +1 -0
- package/compiled/import-lazy/package.json +1 -0
- package/compiled/lodash/LICENSE +47 -0
- package/compiled/lodash/common/array.d.ts +2126 -0
- package/compiled/lodash/common/collection.d.ts +1930 -0
- package/compiled/lodash/common/common.d.ts +280 -0
- package/compiled/lodash/common/date.d.ts +23 -0
- package/compiled/lodash/common/function.d.ts +1430 -0
- package/compiled/lodash/common/lang.d.ts +1692 -0
- package/compiled/lodash/common/math.d.ts +405 -0
- package/compiled/lodash/common/number.d.ts +131 -0
- package/compiled/lodash/common/object.d.ts +2519 -0
- package/compiled/lodash/common/seq.d.ts +210 -0
- package/compiled/lodash/common/string.d.ts +788 -0
- package/compiled/lodash/common/util.d.ts +1219 -0
- package/compiled/lodash/index.d.ts +46 -0
- package/compiled/lodash/index.js +9 -0
- package/compiled/lodash/package.json +1 -0
- package/compiled/mustache/LICENSE +11 -0
- package/compiled/mustache/index.d.ts +437 -0
- package/compiled/mustache/index.js +5 -0
- package/compiled/mustache/package.json +1 -0
- package/compiled/pkg-up/LICENSE +9 -0
- package/compiled/pkg-up/index.d.ts +48 -0
- package/compiled/pkg-up/index.js +1 -0
- package/compiled/pkg-up/package.json +1 -0
- package/compiled/portfinder/LICENSE +22 -0
- package/compiled/portfinder/index.js +1 -0
- package/compiled/portfinder/lib/portfinder.d.ts +47 -0
- package/compiled/portfinder/package.json +1 -0
- package/compiled/prettier/LICENSE +7 -0
- package/compiled/prettier/index.d.ts +756 -0
- package/compiled/prettier/index.js +263 -0
- package/compiled/prettier/package.json +1 -0
- package/compiled/prompts/LICENSE +21 -0
- package/compiled/prompts/index.d.ts +120 -0
- package/compiled/prompts/index.js +1 -0
- package/compiled/prompts/package.json +1 -0
- package/compiled/resolve/LICENSE +21 -0
- package/compiled/resolve/index.d.ts +166 -0
- package/compiled/resolve/index.js +1 -0
- package/compiled/resolve/package.json +1 -0
- package/compiled/rimraf/LICENSE +15 -0
- package/compiled/rimraf/glob/index.d.ts +89 -0
- package/compiled/rimraf/index.d.ts +49 -0
- package/compiled/rimraf/index.js +1 -0
- package/compiled/rimraf/minimatch/index.d.ts +204 -0
- package/compiled/rimraf/package.json +1 -0
- package/compiled/semver/LICENSE +15 -0
- package/compiled/semver/classes/comparator.d.ts +17 -0
- package/compiled/semver/classes/range.d.ts +21 -0
- package/compiled/semver/classes/semver.d.ts +62 -0
- package/compiled/semver/functions/clean.d.ts +8 -0
- package/compiled/semver/functions/cmp.d.ts +16 -0
- package/compiled/semver/functions/coerce.d.ts +12 -0
- package/compiled/semver/functions/compare-build.d.ts +16 -0
- package/compiled/semver/functions/compare-loose.d.ts +5 -0
- package/compiled/semver/functions/compare.d.ts +20 -0
- package/compiled/semver/functions/diff.d.ts +13 -0
- package/compiled/semver/functions/eq.d.ts +9 -0
- package/compiled/semver/functions/gt.d.ts +9 -0
- package/compiled/semver/functions/gte.d.ts +9 -0
- package/compiled/semver/functions/inc.d.ts +15 -0
- package/compiled/semver/functions/lt.d.ts +9 -0
- package/compiled/semver/functions/lte.d.ts +8 -0
- package/compiled/semver/functions/major.d.ts +9 -0
- package/compiled/semver/functions/minor.d.ts +9 -0
- package/compiled/semver/functions/neq.d.ts +9 -0
- package/compiled/semver/functions/parse.d.ts +12 -0
- package/compiled/semver/functions/patch.d.ts +9 -0
- package/compiled/semver/functions/prerelease.d.ts +12 -0
- package/compiled/semver/functions/rcompare.d.ts +15 -0
- package/compiled/semver/functions/rsort.d.ts +9 -0
- package/compiled/semver/functions/satisfies.d.ts +14 -0
- package/compiled/semver/functions/sort.d.ts +9 -0
- package/compiled/semver/functions/valid.d.ts +11 -0
- package/compiled/semver/index.d.ts +133 -0
- package/compiled/semver/index.js +1 -0
- package/compiled/semver/internals/identifiers.d.ts +13 -0
- package/compiled/semver/package.json +1 -0
- package/compiled/semver/ranges/gtr.d.ts +14 -0
- package/compiled/semver/ranges/intersects.d.ts +13 -0
- package/compiled/semver/ranges/ltr.d.ts +14 -0
- package/compiled/semver/ranges/max-satisfying.d.ts +14 -0
- package/compiled/semver/ranges/min-satisfying.d.ts +14 -0
- package/compiled/semver/ranges/min-version.d.ts +10 -0
- package/compiled/semver/ranges/outside.d.ts +15 -0
- package/compiled/semver/ranges/simplify.d.ts +14 -0
- package/compiled/semver/ranges/subset.d.ts +13 -0
- package/compiled/semver/ranges/to-comparators.d.ts +9 -0
- package/compiled/semver/ranges/valid.d.ts +12 -0
- package/compiled/strip-ansi/LICENSE +9 -0
- package/compiled/strip-ansi/index.d.ts +17 -0
- package/compiled/strip-ansi/index.js +1 -0
- package/compiled/strip-ansi/package.json +1 -0
- package/compiled/yargs-parser/index.d.ts +112 -0
- package/compiled/yargs-parser/index.js +1 -0
- package/compiled/yargs-parser/package.json +1 -0
- package/dist/BaseGenerator/BaseGenerator.d.ts +18 -0
- package/dist/BaseGenerator/BaseGenerator.js +58 -0
- package/dist/BaseGenerator/generateFile.d.ts +8 -0
- package/dist/BaseGenerator/generateFile.js +25 -0
- package/{lib → dist}/Generator/Generator.d.ts +3 -3
- package/dist/Generator/Generator.js +74 -0
- package/dist/importLazy.d.ts +6 -0
- package/dist/importLazy.js +17 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +88 -0
- package/dist/installDeps.d.ts +9 -0
- package/dist/installDeps.js +39 -0
- package/dist/logger.d.ts +14 -0
- package/dist/logger.js +39 -0
- package/dist/npmClient.d.ts +15 -0
- package/dist/npmClient.js +43 -0
- package/dist/randomColor/randomColor.d.ts +6 -0
- package/dist/randomColor/randomColor.js +19 -0
- package/dist/register.d.ts +6 -0
- package/dist/register.js +48 -0
- package/dist/updatePackageJSON.d.ts +5 -0
- package/dist/updatePackageJSON.js +21 -0
- package/dist/winPath.d.ts +1 -0
- package/dist/winPath.js +11 -0
- package/package.json +102 -18
- package/lib/BabelRegister/BabelRegister.d.ts +0 -9
- package/lib/BabelRegister/BabelRegister.js +0 -66
- package/lib/Generator/Generator.js +0 -120
- package/lib/cheerio/cheerio.d.ts +0 -2
- package/lib/cheerio/cheerio.js +0 -37
- package/lib/cleanRequireCache/cleanRequireCache.d.ts +0 -1
- package/lib/cleanRequireCache/cleanRequireCache.js +0 -40
- package/lib/compatESModuleRequire/compatESModuleRequire.d.ts +0 -7
- package/lib/compatESModuleRequire/compatESModuleRequire.js +0 -22
- package/lib/delay/delay.d.ts +0 -1
- package/lib/delay/delay.js +0 -22
- package/lib/getFile/getFile.d.ts +0 -22
- package/lib/getFile/getFile.js +0 -85
- package/lib/index.d.ts +0 -66
- package/lib/index.js +0 -619
- package/lib/isLernaPackage/isLernaPackage.d.ts +0 -1
- package/lib/isLernaPackage/isLernaPackage.js +0 -42
- package/lib/mergeConfig/mergeConfig.d.ts +0 -8
- package/lib/mergeConfig/mergeConfig.js +0 -42
- package/lib/parseRequireDeps/parseRequireDeps.d.ts +0 -1
- package/lib/parseRequireDeps/parseRequireDeps.js +0 -98
- package/lib/randomColor/randomColor.d.ts +0 -6
- package/lib/randomColor/randomColor.js +0 -42
- package/lib/routes.d.ts +0 -11
- package/lib/routes.js +0 -53
- package/lib/ssr.d.ts +0 -12
- package/lib/ssr.js +0 -41
- package/lib/types.d.ts +0 -7
- package/lib/types.js +0 -17
- package/lib/winEOL/winEOL.d.ts +0 -7
- package/lib/winEOL/winEOL.js +0 -39
- package/lib/winPath/winPath.d.ts +0 -1
- package/lib/winPath/winPath.js +0 -28
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Basic foreground colors.
|
|
3
|
+
|
|
4
|
+
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
|
5
|
+
*/
|
|
6
|
+
declare type ForegroundColor =
|
|
7
|
+
| 'black'
|
|
8
|
+
| 'red'
|
|
9
|
+
| 'green'
|
|
10
|
+
| 'yellow'
|
|
11
|
+
| 'blue'
|
|
12
|
+
| 'magenta'
|
|
13
|
+
| 'cyan'
|
|
14
|
+
| 'white'
|
|
15
|
+
| 'gray'
|
|
16
|
+
| 'grey'
|
|
17
|
+
| 'blackBright'
|
|
18
|
+
| 'redBright'
|
|
19
|
+
| 'greenBright'
|
|
20
|
+
| 'yellowBright'
|
|
21
|
+
| 'blueBright'
|
|
22
|
+
| 'magentaBright'
|
|
23
|
+
| 'cyanBright'
|
|
24
|
+
| 'whiteBright';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
Basic background colors.
|
|
28
|
+
|
|
29
|
+
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
|
30
|
+
*/
|
|
31
|
+
declare type BackgroundColor =
|
|
32
|
+
| 'bgBlack'
|
|
33
|
+
| 'bgRed'
|
|
34
|
+
| 'bgGreen'
|
|
35
|
+
| 'bgYellow'
|
|
36
|
+
| 'bgBlue'
|
|
37
|
+
| 'bgMagenta'
|
|
38
|
+
| 'bgCyan'
|
|
39
|
+
| 'bgWhite'
|
|
40
|
+
| 'bgGray'
|
|
41
|
+
| 'bgGrey'
|
|
42
|
+
| 'bgBlackBright'
|
|
43
|
+
| 'bgRedBright'
|
|
44
|
+
| 'bgGreenBright'
|
|
45
|
+
| 'bgYellowBright'
|
|
46
|
+
| 'bgBlueBright'
|
|
47
|
+
| 'bgMagentaBright'
|
|
48
|
+
| 'bgCyanBright'
|
|
49
|
+
| 'bgWhiteBright';
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
Basic colors.
|
|
53
|
+
|
|
54
|
+
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
|
|
55
|
+
*/
|
|
56
|
+
declare type Color = ForegroundColor | BackgroundColor;
|
|
57
|
+
|
|
58
|
+
declare type Modifiers =
|
|
59
|
+
| 'reset'
|
|
60
|
+
| 'bold'
|
|
61
|
+
| 'dim'
|
|
62
|
+
| 'italic'
|
|
63
|
+
| 'underline'
|
|
64
|
+
| 'inverse'
|
|
65
|
+
| 'hidden'
|
|
66
|
+
| 'strikethrough'
|
|
67
|
+
| 'visible';
|
|
68
|
+
|
|
69
|
+
declare namespace chalk {
|
|
70
|
+
/**
|
|
71
|
+
Levels:
|
|
72
|
+
- `0` - All colors disabled.
|
|
73
|
+
- `1` - Basic 16 colors support.
|
|
74
|
+
- `2` - ANSI 256 colors support.
|
|
75
|
+
- `3` - Truecolor 16 million colors support.
|
|
76
|
+
*/
|
|
77
|
+
type Level = 0 | 1 | 2 | 3;
|
|
78
|
+
|
|
79
|
+
interface Options {
|
|
80
|
+
/**
|
|
81
|
+
Specify the color support for Chalk.
|
|
82
|
+
|
|
83
|
+
By default, color support is automatically detected based on the environment.
|
|
84
|
+
|
|
85
|
+
Levels:
|
|
86
|
+
- `0` - All colors disabled.
|
|
87
|
+
- `1` - Basic 16 colors support.
|
|
88
|
+
- `2` - ANSI 256 colors support.
|
|
89
|
+
- `3` - Truecolor 16 million colors support.
|
|
90
|
+
*/
|
|
91
|
+
level?: Level;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
Return a new Chalk instance.
|
|
96
|
+
*/
|
|
97
|
+
type Instance = new (options?: Options) => Chalk;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
Detect whether the terminal supports color.
|
|
101
|
+
*/
|
|
102
|
+
interface ColorSupport {
|
|
103
|
+
/**
|
|
104
|
+
The color level used by Chalk.
|
|
105
|
+
*/
|
|
106
|
+
level: Level;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
Return whether Chalk supports basic 16 colors.
|
|
110
|
+
*/
|
|
111
|
+
hasBasic: boolean;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
Return whether Chalk supports ANSI 256 colors.
|
|
115
|
+
*/
|
|
116
|
+
has256: boolean;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
Return whether Chalk supports Truecolor 16 million colors.
|
|
120
|
+
*/
|
|
121
|
+
has16m: boolean;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
interface ChalkFunction {
|
|
125
|
+
/**
|
|
126
|
+
Use a template string.
|
|
127
|
+
|
|
128
|
+
@remarks Template literals are unsupported for nested calls (see [issue #341](https://github.com/chalk/chalk/issues/341))
|
|
129
|
+
|
|
130
|
+
@example
|
|
131
|
+
```
|
|
132
|
+
import chalk = require('../chalk');
|
|
133
|
+
|
|
134
|
+
log(chalk`
|
|
135
|
+
CPU: {red ${cpu.totalPercent}%}
|
|
136
|
+
RAM: {green ${ram.used / ram.total * 100}%}
|
|
137
|
+
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
|
|
138
|
+
`);
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
@example
|
|
142
|
+
```
|
|
143
|
+
import chalk = require('../chalk');
|
|
144
|
+
|
|
145
|
+
log(chalk.red.bgBlack`2 + 3 = {bold ${2 + 3}}`)
|
|
146
|
+
```
|
|
147
|
+
*/
|
|
148
|
+
(text: TemplateStringsArray, ...placeholders: unknown[]): string;
|
|
149
|
+
|
|
150
|
+
(...text: unknown[]): string;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
interface Chalk extends ChalkFunction {
|
|
154
|
+
/**
|
|
155
|
+
Return a new Chalk instance.
|
|
156
|
+
*/
|
|
157
|
+
Instance: Instance;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
The color support for Chalk.
|
|
161
|
+
|
|
162
|
+
By default, color support is automatically detected based on the environment.
|
|
163
|
+
|
|
164
|
+
Levels:
|
|
165
|
+
- `0` - All colors disabled.
|
|
166
|
+
- `1` - Basic 16 colors support.
|
|
167
|
+
- `2` - ANSI 256 colors support.
|
|
168
|
+
- `3` - Truecolor 16 million colors support.
|
|
169
|
+
*/
|
|
170
|
+
level: Level;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
Use HEX value to set text color.
|
|
174
|
+
|
|
175
|
+
@param color - Hexadecimal value representing the desired color.
|
|
176
|
+
|
|
177
|
+
@example
|
|
178
|
+
```
|
|
179
|
+
import chalk = require('../chalk');
|
|
180
|
+
|
|
181
|
+
chalk.hex('#DEADED');
|
|
182
|
+
```
|
|
183
|
+
*/
|
|
184
|
+
hex(color: string): Chalk;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
Use keyword color value to set text color.
|
|
188
|
+
|
|
189
|
+
@param color - Keyword value representing the desired color.
|
|
190
|
+
|
|
191
|
+
@example
|
|
192
|
+
```
|
|
193
|
+
import chalk = require('../chalk');
|
|
194
|
+
|
|
195
|
+
chalk.keyword('orange');
|
|
196
|
+
```
|
|
197
|
+
*/
|
|
198
|
+
keyword(color: string): Chalk;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
Use RGB values to set text color.
|
|
202
|
+
*/
|
|
203
|
+
rgb(red: number, green: number, blue: number): Chalk;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
Use HSL values to set text color.
|
|
207
|
+
*/
|
|
208
|
+
hsl(hue: number, saturation: number, lightness: number): Chalk;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
Use HSV values to set text color.
|
|
212
|
+
*/
|
|
213
|
+
hsv(hue: number, saturation: number, value: number): Chalk;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
Use HWB values to set text color.
|
|
217
|
+
*/
|
|
218
|
+
hwb(hue: number, whiteness: number, blackness: number): Chalk;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set text color.
|
|
222
|
+
|
|
223
|
+
30 <= code && code < 38 || 90 <= code && code < 98
|
|
224
|
+
For example, 31 for red, 91 for redBright.
|
|
225
|
+
*/
|
|
226
|
+
ansi(code: number): Chalk;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
|
|
230
|
+
*/
|
|
231
|
+
ansi256(index: number): Chalk;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
Use HEX value to set background color.
|
|
235
|
+
|
|
236
|
+
@param color - Hexadecimal value representing the desired color.
|
|
237
|
+
|
|
238
|
+
@example
|
|
239
|
+
```
|
|
240
|
+
import chalk = require('../chalk');
|
|
241
|
+
|
|
242
|
+
chalk.bgHex('#DEADED');
|
|
243
|
+
```
|
|
244
|
+
*/
|
|
245
|
+
bgHex(color: string): Chalk;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
Use keyword color value to set background color.
|
|
249
|
+
|
|
250
|
+
@param color - Keyword value representing the desired color.
|
|
251
|
+
|
|
252
|
+
@example
|
|
253
|
+
```
|
|
254
|
+
import chalk = require('../chalk');
|
|
255
|
+
|
|
256
|
+
chalk.bgKeyword('orange');
|
|
257
|
+
```
|
|
258
|
+
*/
|
|
259
|
+
bgKeyword(color: string): Chalk;
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
Use RGB values to set background color.
|
|
263
|
+
*/
|
|
264
|
+
bgRgb(red: number, green: number, blue: number): Chalk;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
Use HSL values to set background color.
|
|
268
|
+
*/
|
|
269
|
+
bgHsl(hue: number, saturation: number, lightness: number): Chalk;
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
Use HSV values to set background color.
|
|
273
|
+
*/
|
|
274
|
+
bgHsv(hue: number, saturation: number, value: number): Chalk;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
Use HWB values to set background color.
|
|
278
|
+
*/
|
|
279
|
+
bgHwb(hue: number, whiteness: number, blackness: number): Chalk;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set background color.
|
|
283
|
+
|
|
284
|
+
30 <= code && code < 38 || 90 <= code && code < 98
|
|
285
|
+
For example, 31 for red, 91 for redBright.
|
|
286
|
+
Use the foreground code, not the background code (for example, not 41, nor 101).
|
|
287
|
+
*/
|
|
288
|
+
bgAnsi(code: number): Chalk;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color.
|
|
292
|
+
*/
|
|
293
|
+
bgAnsi256(index: number): Chalk;
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
Modifier: Resets the current color chain.
|
|
297
|
+
*/
|
|
298
|
+
readonly reset: Chalk;
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
Modifier: Make text bold.
|
|
302
|
+
*/
|
|
303
|
+
readonly bold: Chalk;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
Modifier: Emitting only a small amount of light.
|
|
307
|
+
*/
|
|
308
|
+
readonly dim: Chalk;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
Modifier: Make text italic. (Not widely supported)
|
|
312
|
+
*/
|
|
313
|
+
readonly italic: Chalk;
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
Modifier: Make text underline. (Not widely supported)
|
|
317
|
+
*/
|
|
318
|
+
readonly underline: Chalk;
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
Modifier: Inverse background and foreground colors.
|
|
322
|
+
*/
|
|
323
|
+
readonly inverse: Chalk;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
Modifier: Prints the text, but makes it invisible.
|
|
327
|
+
*/
|
|
328
|
+
readonly hidden: Chalk;
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
Modifier: Puts a horizontal line through the center of the text. (Not widely supported)
|
|
332
|
+
*/
|
|
333
|
+
readonly strikethrough: Chalk;
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
Modifier: Prints the text only when Chalk has a color support level > 0.
|
|
337
|
+
Can be useful for things that are purely cosmetic.
|
|
338
|
+
*/
|
|
339
|
+
readonly visible: Chalk;
|
|
340
|
+
|
|
341
|
+
readonly black: Chalk;
|
|
342
|
+
readonly red: Chalk;
|
|
343
|
+
readonly green: Chalk;
|
|
344
|
+
readonly yellow: Chalk;
|
|
345
|
+
readonly blue: Chalk;
|
|
346
|
+
readonly magenta: Chalk;
|
|
347
|
+
readonly cyan: Chalk;
|
|
348
|
+
readonly white: Chalk;
|
|
349
|
+
|
|
350
|
+
/*
|
|
351
|
+
Alias for `blackBright`.
|
|
352
|
+
*/
|
|
353
|
+
readonly gray: Chalk;
|
|
354
|
+
|
|
355
|
+
/*
|
|
356
|
+
Alias for `blackBright`.
|
|
357
|
+
*/
|
|
358
|
+
readonly grey: Chalk;
|
|
359
|
+
|
|
360
|
+
readonly blackBright: Chalk;
|
|
361
|
+
readonly redBright: Chalk;
|
|
362
|
+
readonly greenBright: Chalk;
|
|
363
|
+
readonly yellowBright: Chalk;
|
|
364
|
+
readonly blueBright: Chalk;
|
|
365
|
+
readonly magentaBright: Chalk;
|
|
366
|
+
readonly cyanBright: Chalk;
|
|
367
|
+
readonly whiteBright: Chalk;
|
|
368
|
+
|
|
369
|
+
readonly bgBlack: Chalk;
|
|
370
|
+
readonly bgRed: Chalk;
|
|
371
|
+
readonly bgGreen: Chalk;
|
|
372
|
+
readonly bgYellow: Chalk;
|
|
373
|
+
readonly bgBlue: Chalk;
|
|
374
|
+
readonly bgMagenta: Chalk;
|
|
375
|
+
readonly bgCyan: Chalk;
|
|
376
|
+
readonly bgWhite: Chalk;
|
|
377
|
+
|
|
378
|
+
/*
|
|
379
|
+
Alias for `bgBlackBright`.
|
|
380
|
+
*/
|
|
381
|
+
readonly bgGray: Chalk;
|
|
382
|
+
|
|
383
|
+
/*
|
|
384
|
+
Alias for `bgBlackBright`.
|
|
385
|
+
*/
|
|
386
|
+
readonly bgGrey: Chalk;
|
|
387
|
+
|
|
388
|
+
readonly bgBlackBright: Chalk;
|
|
389
|
+
readonly bgRedBright: Chalk;
|
|
390
|
+
readonly bgGreenBright: Chalk;
|
|
391
|
+
readonly bgYellowBright: Chalk;
|
|
392
|
+
readonly bgBlueBright: Chalk;
|
|
393
|
+
readonly bgMagentaBright: Chalk;
|
|
394
|
+
readonly bgCyanBright: Chalk;
|
|
395
|
+
readonly bgWhiteBright: Chalk;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
Main Chalk object that allows to chain styles together.
|
|
401
|
+
Call the last one as a method with a string argument.
|
|
402
|
+
Order doesn't matter, and later styles take precedent in case of a conflict.
|
|
403
|
+
This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
|
|
404
|
+
*/
|
|
405
|
+
declare const chalk: chalk.Chalk & chalk.ChalkFunction & {
|
|
406
|
+
supportsColor: chalk.ColorSupport | false;
|
|
407
|
+
Level: chalk.Level;
|
|
408
|
+
Color: Color;
|
|
409
|
+
ForegroundColor: ForegroundColor;
|
|
410
|
+
BackgroundColor: BackgroundColor;
|
|
411
|
+
Modifiers: Modifiers;
|
|
412
|
+
stderr: chalk.Chalk & {supportsColor: chalk.ColorSupport | false};
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
export = chalk;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){var e={774:function(e,t,n){"use strict";e=n.nmd(e);const wrapAnsi16=(e,t)=>(...n)=>{const r=e(...n);return`[${r+t}m`};const wrapAnsi256=(e,t)=>(...n)=>{const r=e(...n);return`[${38+t};5;${r}m`};const wrapAnsi16m=(e,t)=>(...n)=>{const r=e(...n);return`[${38+t};2;${r[0]};${r[1]};${r[2]}m`};const ansi2ansi=e=>e;const rgb2rgb=(e,t,n)=>[e,t,n];const setLazyProperty=(e,t,n)=>{Object.defineProperty(e,t,{get:()=>{const r=n();Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true});return r},enumerable:true,configurable:true})};let r;const makeDynamicStyles=(e,t,o,s)=>{if(r===undefined){r=n(59)}const l=s?10:0;const c={};for(const[n,s]of Object.entries(r)){const r=n==="ansi16"?"ansi":n;if(n===t){c[r]=e(o,l)}else if(typeof s==="object"){c[r]=e(s[t],l)}}return c};function assembleStyles(){const e=new Map;const t={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};t.color.gray=t.color.blackBright;t.bgColor.bgGray=t.bgColor.bgBlackBright;t.color.grey=t.color.blackBright;t.bgColor.bgGrey=t.bgColor.bgBlackBright;for(const[n,r]of Object.entries(t)){for(const[n,o]of Object.entries(r)){t[n]={open:`[${o[0]}m`,close:`[${o[1]}m`};r[n]=t[n];e.set(o[0],o[1])}Object.defineProperty(t,n,{value:r,enumerable:false})}Object.defineProperty(t,"codes",{value:e,enumerable:false});t.color.close="[39m";t.bgColor.close="[49m";setLazyProperty(t.color,"ansi",(()=>makeDynamicStyles(wrapAnsi16,"ansi16",ansi2ansi,false)));setLazyProperty(t.color,"ansi256",(()=>makeDynamicStyles(wrapAnsi256,"ansi256",ansi2ansi,false)));setLazyProperty(t.color,"ansi16m",(()=>makeDynamicStyles(wrapAnsi16m,"rgb",rgb2rgb,false)));setLazyProperty(t.bgColor,"ansi",(()=>makeDynamicStyles(wrapAnsi16,"ansi16",ansi2ansi,true)));setLazyProperty(t.bgColor,"ansi256",(()=>makeDynamicStyles(wrapAnsi256,"ansi256",ansi2ansi,true)));setLazyProperty(t.bgColor,"ansi16m",(()=>makeDynamicStyles(wrapAnsi16m,"rgb",rgb2rgb,true)));return t}Object.defineProperty(e,"exports",{enumerable:true,get:assembleStyles})},536:function(e,t,n){"use strict";const r=n(774);const{stdout:o,stderr:s}=n(611);const{stringReplaceAll:l,stringEncaseCRLFWithFirstIndex:c}=n(713);const{isArray:i}=Array;const a=["ansi","ansi","ansi256","ansi16m"];const u=Object.create(null);const applyOptions=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3)){throw new Error("The `level` option should be an integer from 0 to 3")}const n=o?o.level:0;e.level=t.level===undefined?n:t.level};class ChalkClass{constructor(e){return chalkFactory(e)}}const chalkFactory=e=>{const t={};applyOptions(t,e);t.template=(...e)=>chalkTag(t.template,...e);Object.setPrototypeOf(t,Chalk.prototype);Object.setPrototypeOf(t.template,t);t.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")};t.template.Instance=ChalkClass;return t.template};function Chalk(e){return chalkFactory(e)}for(const[e,t]of Object.entries(r)){u[e]={get(){const n=createBuilder(this,createStyler(t.open,t.close,this._styler),this._isEmpty);Object.defineProperty(this,e,{value:n});return n}}}u.visible={get(){const e=createBuilder(this,this._styler,true);Object.defineProperty(this,"visible",{value:e});return e}};const f=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(const e of f){u[e]={get(){const{level:t}=this;return function(...n){const o=createStyler(r.color[a[t]][e](...n),r.color.close,this._styler);return createBuilder(this,o,this._isEmpty)}}}}for(const e of f){const t="bg"+e[0].toUpperCase()+e.slice(1);u[t]={get(){const{level:t}=this;return function(...n){const o=createStyler(r.bgColor[a[t]][e](...n),r.bgColor.close,this._styler);return createBuilder(this,o,this._isEmpty)}}}}const h=Object.defineProperties((()=>{}),{...u,level:{enumerable:true,get(){return this._generator.level},set(e){this._generator.level=e}}});const createStyler=(e,t,n)=>{let r;let o;if(n===undefined){r=e;o=t}else{r=n.openAll+e;o=t+n.closeAll}return{open:e,close:t,openAll:r,closeAll:o,parent:n}};const createBuilder=(e,t,n)=>{const builder=(...e)=>{if(i(e[0])&&i(e[0].raw)){return applyStyle(builder,chalkTag(builder,...e))}return applyStyle(builder,e.length===1?""+e[0]:e.join(" "))};Object.setPrototypeOf(builder,h);builder._generator=e;builder._styler=t;builder._isEmpty=n;return builder};const applyStyle=(e,t)=>{if(e.level<=0||!t){return e._isEmpty?"":t}let n=e._styler;if(n===undefined){return t}const{openAll:r,closeAll:o}=n;if(t.indexOf("")!==-1){while(n!==undefined){t=l(t,n.close,n.open);n=n.parent}}const s=t.indexOf("\n");if(s!==-1){t=c(t,o,r,s)}return r+t+o};let g;const chalkTag=(e,...t)=>{const[r]=t;if(!i(r)||!i(r.raw)){return t.join(" ")}const o=t.slice(1);const s=[r.raw[0]];for(let e=1;e<r.length;e++){s.push(String(o[e-1]).replace(/[{}\\]/g,"\\$&"),String(r.raw[e]))}if(g===undefined){g=n(566)}return g(e,s.join(""))};Object.defineProperties(Chalk.prototype,u);const b=Chalk();b.supportsColor=o;b.stderr=Chalk({level:s?s.level:0});b.stderr.supportsColor=s;e.exports=b},566:function(e){"use strict";const t=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;const n=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;const r=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;const o=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;const s=new Map([["n","\n"],["r","\r"],["t","\t"],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e",""],["a",""]]);function unescape(e){const t=e[0]==="u";const n=e[1]==="{";if(t&&!n&&e.length===5||e[0]==="x"&&e.length===3){return String.fromCharCode(parseInt(e.slice(1),16))}if(t&&n){return String.fromCodePoint(parseInt(e.slice(2,-1),16))}return s.get(e)||e}function parseArguments(e,t){const n=[];const s=t.trim().split(/\s*,\s*/g);let l;for(const t of s){const s=Number(t);if(!Number.isNaN(s)){n.push(s)}else if(l=t.match(r)){n.push(l[2].replace(o,((e,t,n)=>t?unescape(t):n)))}else{throw new Error(`Invalid Chalk template style argument: ${t} (in style '${e}')`)}}return n}function parseStyle(e){n.lastIndex=0;const t=[];let r;while((r=n.exec(e))!==null){const e=r[1];if(r[2]){const n=parseArguments(e,r[2]);t.push([e].concat(n))}else{t.push([e])}}return t}function buildStyle(e,t){const n={};for(const e of t){for(const t of e.styles){n[t[0]]=e.inverse?null:t.slice(1)}}let r=e;for(const[e,t]of Object.entries(n)){if(!Array.isArray(t)){continue}if(!(e in r)){throw new Error(`Unknown Chalk style: ${e}`)}r=t.length>0?r[e](...t):r[e]}return r}e.exports=(e,n)=>{const r=[];const o=[];let s=[];n.replace(t,((t,n,l,c,i,a)=>{if(n){s.push(unescape(n))}else if(c){const t=s.join("");s=[];o.push(r.length===0?t:buildStyle(e,r)(t));r.push({inverse:l,styles:parseStyle(c)})}else if(i){if(r.length===0){throw new Error("Found extraneous } in Chalk template literal")}o.push(buildStyle(e,r)(s.join("")));s=[];r.pop()}else{s.push(a)}}));o.push(s.join(""));if(r.length>0){const e=`Chalk template literal is missing ${r.length} closing bracket${r.length===1?"":"s"} (\`}\`)`;throw new Error(e)}return o.join("")}},713:function(e){"use strict";const stringReplaceAll=(e,t,n)=>{let r=e.indexOf(t);if(r===-1){return e}const o=t.length;let s=0;let l="";do{l+=e.substr(s,r-s)+t+n;s=r+o;r=e.indexOf(t,s)}while(r!==-1);l+=e.substr(s);return l};const stringEncaseCRLFWithFirstIndex=(e,t,n,r)=>{let o=0;let s="";do{const l=e[r-1]==="\r";s+=e.substr(o,(l?r-1:r)-o)+t+(l?"\r\n":"\n")+n;o=r+1;r=e.indexOf("\n",o)}while(r!==-1);s+=e.substr(o);return s};e.exports={stringReplaceAll:stringReplaceAll,stringEncaseCRLFWithFirstIndex:stringEncaseCRLFWithFirstIndex}},922:function(e,t,n){const r=n(838);const o={};for(const e of Object.keys(r)){o[r[e]]=e}const s={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};e.exports=s;for(const e of Object.keys(s)){if(!("channels"in s[e])){throw new Error("missing channels property: "+e)}if(!("labels"in s[e])){throw new Error("missing channel labels property: "+e)}if(s[e].labels.length!==s[e].channels){throw new Error("channel and label counts mismatch: "+e)}const{channels:t,labels:n}=s[e];delete s[e].channels;delete s[e].labels;Object.defineProperty(s[e],"channels",{value:t});Object.defineProperty(s[e],"labels",{value:n})}s.rgb.hsl=function(e){const t=e[0]/255;const n=e[1]/255;const r=e[2]/255;const o=Math.min(t,n,r);const s=Math.max(t,n,r);const l=s-o;let c;let i;if(s===o){c=0}else if(t===s){c=(n-r)/l}else if(n===s){c=2+(r-t)/l}else if(r===s){c=4+(t-n)/l}c=Math.min(c*60,360);if(c<0){c+=360}const a=(o+s)/2;if(s===o){i=0}else if(a<=.5){i=l/(s+o)}else{i=l/(2-s-o)}return[c,i*100,a*100]};s.rgb.hsv=function(e){let t;let n;let r;let o;let s;const l=e[0]/255;const c=e[1]/255;const i=e[2]/255;const a=Math.max(l,c,i);const u=a-Math.min(l,c,i);const diffc=function(e){return(a-e)/6/u+1/2};if(u===0){o=0;s=0}else{s=u/a;t=diffc(l);n=diffc(c);r=diffc(i);if(l===a){o=r-n}else if(c===a){o=1/3+t-r}else if(i===a){o=2/3+n-t}if(o<0){o+=1}else if(o>1){o-=1}}return[o*360,s*100,a*100]};s.rgb.hwb=function(e){const t=e[0];const n=e[1];let r=e[2];const o=s.rgb.hsl(e)[0];const l=1/255*Math.min(t,Math.min(n,r));r=1-1/255*Math.max(t,Math.max(n,r));return[o,l*100,r*100]};s.rgb.cmyk=function(e){const t=e[0]/255;const n=e[1]/255;const r=e[2]/255;const o=Math.min(1-t,1-n,1-r);const s=(1-t-o)/(1-o)||0;const l=(1-n-o)/(1-o)||0;const c=(1-r-o)/(1-o)||0;return[s*100,l*100,c*100,o*100]};function comparativeDistance(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}s.rgb.keyword=function(e){const t=o[e];if(t){return t}let n=Infinity;let s;for(const t of Object.keys(r)){const o=r[t];const l=comparativeDistance(e,o);if(l<n){n=l;s=t}}return s};s.keyword.rgb=function(e){return r[e]};s.rgb.xyz=function(e){let t=e[0]/255;let n=e[1]/255;let r=e[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92;n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;r=r>.04045?((r+.055)/1.055)**2.4:r/12.92;const o=t*.4124+n*.3576+r*.1805;const s=t*.2126+n*.7152+r*.0722;const l=t*.0193+n*.1192+r*.9505;return[o*100,s*100,l*100]};s.rgb.lab=function(e){const t=s.rgb.xyz(e);let n=t[0];let r=t[1];let o=t[2];n/=95.047;r/=100;o/=108.883;n=n>.008856?n**(1/3):7.787*n+16/116;r=r>.008856?r**(1/3):7.787*r+16/116;o=o>.008856?o**(1/3):7.787*o+16/116;const l=116*r-16;const c=500*(n-r);const i=200*(r-o);return[l,c,i]};s.hsl.rgb=function(e){const t=e[0]/360;const n=e[1]/100;const r=e[2]/100;let o;let s;let l;if(n===0){l=r*255;return[l,l,l]}if(r<.5){o=r*(1+n)}else{o=r+n-r*n}const c=2*r-o;const i=[0,0,0];for(let e=0;e<3;e++){s=t+1/3*-(e-1);if(s<0){s++}if(s>1){s--}if(6*s<1){l=c+(o-c)*6*s}else if(2*s<1){l=o}else if(3*s<2){l=c+(o-c)*(2/3-s)*6}else{l=c}i[e]=l*255}return i};s.hsl.hsv=function(e){const t=e[0];let n=e[1]/100;let r=e[2]/100;let o=n;const s=Math.max(r,.01);r*=2;n*=r<=1?r:2-r;o*=s<=1?s:2-s;const l=(r+n)/2;const c=r===0?2*o/(s+o):2*n/(r+n);return[t,c*100,l*100]};s.hsv.rgb=function(e){const t=e[0]/60;const n=e[1]/100;let r=e[2]/100;const o=Math.floor(t)%6;const s=t-Math.floor(t);const l=255*r*(1-n);const c=255*r*(1-n*s);const i=255*r*(1-n*(1-s));r*=255;switch(o){case 0:return[r,i,l];case 1:return[c,r,l];case 2:return[l,r,i];case 3:return[l,c,r];case 4:return[i,l,r];case 5:return[r,l,c]}};s.hsv.hsl=function(e){const t=e[0];const n=e[1]/100;const r=e[2]/100;const o=Math.max(r,.01);let s;let l;l=(2-n)*r;const c=(2-n)*o;s=n*o;s/=c<=1?c:2-c;s=s||0;l/=2;return[t,s*100,l*100]};s.hwb.rgb=function(e){const t=e[0]/360;let n=e[1]/100;let r=e[2]/100;const o=n+r;let s;if(o>1){n/=o;r/=o}const l=Math.floor(6*t);const c=1-r;s=6*t-l;if((l&1)!==0){s=1-s}const i=n+s*(c-n);let a;let u;let f;switch(l){default:case 6:case 0:a=c;u=i;f=n;break;case 1:a=i;u=c;f=n;break;case 2:a=n;u=c;f=i;break;case 3:a=n;u=i;f=c;break;case 4:a=i;u=n;f=c;break;case 5:a=c;u=n;f=i;break}return[a*255,u*255,f*255]};s.cmyk.rgb=function(e){const t=e[0]/100;const n=e[1]/100;const r=e[2]/100;const o=e[3]/100;const s=1-Math.min(1,t*(1-o)+o);const l=1-Math.min(1,n*(1-o)+o);const c=1-Math.min(1,r*(1-o)+o);return[s*255,l*255,c*255]};s.xyz.rgb=function(e){const t=e[0]/100;const n=e[1]/100;const r=e[2]/100;let o;let s;let l;o=t*3.2406+n*-1.5372+r*-.4986;s=t*-.9689+n*1.8758+r*.0415;l=t*.0557+n*-.204+r*1.057;o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92;s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92;l=l>.0031308?1.055*l**(1/2.4)-.055:l*12.92;o=Math.min(Math.max(0,o),1);s=Math.min(Math.max(0,s),1);l=Math.min(Math.max(0,l),1);return[o*255,s*255,l*255]};s.xyz.lab=function(e){let t=e[0];let n=e[1];let r=e[2];t/=95.047;n/=100;r/=108.883;t=t>.008856?t**(1/3):7.787*t+16/116;n=n>.008856?n**(1/3):7.787*n+16/116;r=r>.008856?r**(1/3):7.787*r+16/116;const o=116*n-16;const s=500*(t-n);const l=200*(n-r);return[o,s,l]};s.lab.xyz=function(e){const t=e[0];const n=e[1];const r=e[2];let o;let s;let l;s=(t+16)/116;o=n/500+s;l=s-r/200;const c=s**3;const i=o**3;const a=l**3;s=c>.008856?c:(s-16/116)/7.787;o=i>.008856?i:(o-16/116)/7.787;l=a>.008856?a:(l-16/116)/7.787;o*=95.047;s*=100;l*=108.883;return[o,s,l]};s.lab.lch=function(e){const t=e[0];const n=e[1];const r=e[2];let o;const s=Math.atan2(r,n);o=s*360/2/Math.PI;if(o<0){o+=360}const l=Math.sqrt(n*n+r*r);return[t,l,o]};s.lch.lab=function(e){const t=e[0];const n=e[1];const r=e[2];const o=r/360*2*Math.PI;const s=n*Math.cos(o);const l=n*Math.sin(o);return[t,s,l]};s.rgb.ansi16=function(e,t=null){const[n,r,o]=e;let l=t===null?s.rgb.hsv(e)[2]:t;l=Math.round(l/50);if(l===0){return 30}let c=30+(Math.round(o/255)<<2|Math.round(r/255)<<1|Math.round(n/255));if(l===2){c+=60}return c};s.hsv.ansi16=function(e){return s.rgb.ansi16(s.hsv.rgb(e),e[2])};s.rgb.ansi256=function(e){const t=e[0];const n=e[1];const r=e[2];if(t===n&&n===r){if(t<8){return 16}if(t>248){return 231}return Math.round((t-8)/247*24)+232}const o=16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5);return o};s.ansi16.rgb=function(e){let t=e%10;if(t===0||t===7){if(e>50){t+=3.5}t=t/10.5*255;return[t,t,t]}const n=(~~(e>50)+1)*.5;const r=(t&1)*n*255;const o=(t>>1&1)*n*255;const s=(t>>2&1)*n*255;return[r,o,s]};s.ansi256.rgb=function(e){if(e>=232){const t=(e-232)*10+8;return[t,t,t]}e-=16;let t;const n=Math.floor(e/36)/5*255;const r=Math.floor((t=e%36)/6)/5*255;const o=t%6/5*255;return[n,r,o]};s.rgb.hex=function(e){const t=((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255);const n=t.toString(16).toUpperCase();return"000000".substring(n.length)+n};s.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t){return[0,0,0]}let n=t[0];if(t[0].length===3){n=n.split("").map((e=>e+e)).join("")}const r=parseInt(n,16);const o=r>>16&255;const s=r>>8&255;const l=r&255;return[o,s,l]};s.rgb.hcg=function(e){const t=e[0]/255;const n=e[1]/255;const r=e[2]/255;const o=Math.max(Math.max(t,n),r);const s=Math.min(Math.min(t,n),r);const l=o-s;let c;let i;if(l<1){c=s/(1-l)}else{c=0}if(l<=0){i=0}else if(o===t){i=(n-r)/l%6}else if(o===n){i=2+(r-t)/l}else{i=4+(t-n)/l}i/=6;i%=1;return[i*360,l*100,c*100]};s.hsl.hcg=function(e){const t=e[1]/100;const n=e[2]/100;const r=n<.5?2*t*n:2*t*(1-n);let o=0;if(r<1){o=(n-.5*r)/(1-r)}return[e[0],r*100,o*100]};s.hsv.hcg=function(e){const t=e[1]/100;const n=e[2]/100;const r=t*n;let o=0;if(r<1){o=(n-r)/(1-r)}return[e[0],r*100,o*100]};s.hcg.rgb=function(e){const t=e[0]/360;const n=e[1]/100;const r=e[2]/100;if(n===0){return[r*255,r*255,r*255]}const o=[0,0,0];const s=t%1*6;const l=s%1;const c=1-l;let i=0;switch(Math.floor(s)){case 0:o[0]=1;o[1]=l;o[2]=0;break;case 1:o[0]=c;o[1]=1;o[2]=0;break;case 2:o[0]=0;o[1]=1;o[2]=l;break;case 3:o[0]=0;o[1]=c;o[2]=1;break;case 4:o[0]=l;o[1]=0;o[2]=1;break;default:o[0]=1;o[1]=0;o[2]=c}i=(1-n)*r;return[(n*o[0]+i)*255,(n*o[1]+i)*255,(n*o[2]+i)*255]};s.hcg.hsv=function(e){const t=e[1]/100;const n=e[2]/100;const r=t+n*(1-t);let o=0;if(r>0){o=t/r}return[e[0],o*100,r*100]};s.hcg.hsl=function(e){const t=e[1]/100;const n=e[2]/100;const r=n*(1-t)+.5*t;let o=0;if(r>0&&r<.5){o=t/(2*r)}else if(r>=.5&&r<1){o=t/(2*(1-r))}return[e[0],o*100,r*100]};s.hcg.hwb=function(e){const t=e[1]/100;const n=e[2]/100;const r=t+n*(1-t);return[e[0],(r-t)*100,(1-r)*100]};s.hwb.hcg=function(e){const t=e[1]/100;const n=e[2]/100;const r=1-n;const o=r-t;let s=0;if(o<1){s=(r-o)/(1-o)}return[e[0],o*100,s*100]};s.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};s.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};s.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};s.gray.hsl=function(e){return[0,0,e[0]]};s.gray.hsv=s.gray.hsl;s.gray.hwb=function(e){return[0,100,e[0]]};s.gray.cmyk=function(e){return[0,0,0,e[0]]};s.gray.lab=function(e){return[e[0],0,0]};s.gray.hex=function(e){const t=Math.round(e[0]/100*255)&255;const n=(t<<16)+(t<<8)+t;const r=n.toString(16).toUpperCase();return"000000".substring(r.length)+r};s.rgb.gray=function(e){const t=(e[0]+e[1]+e[2])/3;return[t/255*100]}},59:function(e,t,n){const r=n(922);const o=n(910);const s={};const l=Object.keys(r);function wrapRaw(e){const wrappedFn=function(...t){const n=t[0];if(n===undefined||n===null){return n}if(n.length>1){t=n}return e(t)};if("conversion"in e){wrappedFn.conversion=e.conversion}return wrappedFn}function wrapRounded(e){const wrappedFn=function(...t){const n=t[0];if(n===undefined||n===null){return n}if(n.length>1){t=n}const r=e(t);if(typeof r==="object"){for(let e=r.length,t=0;t<e;t++){r[t]=Math.round(r[t])}}return r};if("conversion"in e){wrappedFn.conversion=e.conversion}return wrappedFn}l.forEach((e=>{s[e]={};Object.defineProperty(s[e],"channels",{value:r[e].channels});Object.defineProperty(s[e],"labels",{value:r[e].labels});const t=o(e);const n=Object.keys(t);n.forEach((n=>{const r=t[n];s[e][n]=wrapRounded(r);s[e][n].raw=wrapRaw(r)}))}));e.exports=s},910:function(e,t,n){const r=n(922);function buildGraph(){const e={};const t=Object.keys(r);for(let n=t.length,r=0;r<n;r++){e[t[r]]={distance:-1,parent:null}}return e}function deriveBFS(e){const t=buildGraph();const n=[e];t[e].distance=0;while(n.length){const e=n.pop();const o=Object.keys(r[e]);for(let r=o.length,s=0;s<r;s++){const r=o[s];const l=t[r];if(l.distance===-1){l.distance=t[e].distance+1;l.parent=e;n.unshift(r)}}}return t}function link(e,t){return function(n){return t(e(n))}}function wrapConversion(e,t){const n=[t[e].parent,e];let o=r[t[e].parent][e];let s=t[e].parent;while(t[s].parent){n.unshift(t[s].parent);o=link(r[t[s].parent][s],o);s=t[s].parent}o.conversion=n;return o}e.exports=function(e){const t=deriveBFS(e);const n={};const r=Object.keys(t);for(let e=r.length,o=0;o<e;o++){const e=r[o];const s=t[e];if(s.parent===null){continue}n[e]=wrapConversion(e,t)}return n}},838:function(e){"use strict";e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},338:function(e){"use strict";e.exports=(e,t=process.argv)=>{const n=e.startsWith("-")?"":e.length===1?"-":"--";const r=t.indexOf(n+e);const o=t.indexOf("--");return r!==-1&&(o===-1||r<o)}},611:function(e,t,n){"use strict";const r=n(37);const o=n(224);const s=n(338);const{env:l}=process;let c;if(s("no-color")||s("no-colors")||s("color=false")||s("color=never")){c=0}else if(s("color")||s("colors")||s("color=true")||s("color=always")){c=1}if("FORCE_COLOR"in l){if(l.FORCE_COLOR==="true"){c=1}else if(l.FORCE_COLOR==="false"){c=0}else{c=l.FORCE_COLOR.length===0?1:Math.min(parseInt(l.FORCE_COLOR,10),3)}}function translateLevel(e){if(e===0){return false}return{level:e,hasBasic:true,has256:e>=2,has16m:e>=3}}function supportsColor(e,t){if(c===0){return 0}if(s("color=16m")||s("color=full")||s("color=truecolor")){return 3}if(s("color=256")){return 2}if(e&&!t&&c===undefined){return 0}const n=c||0;if(l.TERM==="dumb"){return n}if(process.platform==="win32"){const e=r.release().split(".");if(Number(e[0])>=10&&Number(e[2])>=10586){return Number(e[2])>=14931?3:2}return 1}if("CI"in l){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in l))||l.CI_NAME==="codeship"){return 1}return n}if("TEAMCITY_VERSION"in l){return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(l.TEAMCITY_VERSION)?1:0}if(l.COLORTERM==="truecolor"){return 3}if("TERM_PROGRAM"in l){const e=parseInt((l.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(l.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(l.TERM)){return 2}if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(l.TERM)){return 1}if("COLORTERM"in l){return 1}return n}function getSupportLevel(e){const t=supportsColor(e,e&&e.isTTY);return translateLevel(t)}e.exports={supportsColor:getSupportLevel,stdout:translateLevel(supportsColor(true,o.isatty(1))),stderr:translateLevel(supportsColor(true,o.isatty(2)))}},37:function(e){"use strict";e.exports=require("os")},224:function(e){"use strict";e.exports=require("tty")}};var t={};function __nccwpck_require__(n){var r=t[n];if(r!==undefined){return r.exports}var o=t[n]={id:n,loaded:false,exports:{}};var s=true;try{e[n](o,o.exports,__nccwpck_require__);s=false}finally{if(s)delete t[n]}o.loaded=true;return o.exports}!function(){__nccwpck_require__.nmd=function(e){e.paths=[];if(!e.children)e.children=[];return e}}();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var n=__nccwpck_require__(536);module.exports=n})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"chalk","license":"MIT"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 Matt Mueller
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** Types of elements found in htmlparser2's DOM */
|
|
2
|
+
export declare enum ElementType {
|
|
3
|
+
/** Type for the root element of a document */
|
|
4
|
+
Root = "root",
|
|
5
|
+
/** Type for Text */
|
|
6
|
+
Text = "text",
|
|
7
|
+
/** Type for <? ... ?> */
|
|
8
|
+
Directive = "directive",
|
|
9
|
+
/** Type for <!-- ... --> */
|
|
10
|
+
Comment = "comment",
|
|
11
|
+
/** Type for <script> tags */
|
|
12
|
+
Script = "script",
|
|
13
|
+
/** Type for <style> tags */
|
|
14
|
+
Style = "style",
|
|
15
|
+
/** Type for Any tag */
|
|
16
|
+
Tag = "tag",
|
|
17
|
+
/** Type for <![CDATA[ ... ]]> */
|
|
18
|
+
CDATA = "cdata",
|
|
19
|
+
/** Type for <!doctype ...> */
|
|
20
|
+
Doctype = "doctype"
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Tests whether an element is a tag or not.
|
|
24
|
+
*
|
|
25
|
+
* @param elem Element to test
|
|
26
|
+
*/
|
|
27
|
+
export declare function isTag(elem: {
|
|
28
|
+
type: ElementType;
|
|
29
|
+
}): boolean;
|
|
30
|
+
/** Type for the root element of a document */
|
|
31
|
+
export declare const Root = ElementType.Root;
|
|
32
|
+
/** Type for Text */
|
|
33
|
+
export declare const Text = ElementType.Text;
|
|
34
|
+
/** Type for <? ... ?> */
|
|
35
|
+
export declare const Directive = ElementType.Directive;
|
|
36
|
+
/** Type for <!-- ... --> */
|
|
37
|
+
export declare const Comment = ElementType.Comment;
|
|
38
|
+
/** Type for <script> tags */
|
|
39
|
+
export declare const Script = ElementType.Script;
|
|
40
|
+
/** Type for <style> tags */
|
|
41
|
+
export declare const Style = ElementType.Style;
|
|
42
|
+
/** Type for Any tag */
|
|
43
|
+
export declare const Tag = ElementType.Tag;
|
|
44
|
+
/** Type for <![CDATA[ ... ]]> */
|
|
45
|
+
export declare const CDATA = ElementType.CDATA;
|
|
46
|
+
/** Type for <!doctype ...> */
|
|
47
|
+
export declare const Doctype = ElementType.Doctype;
|
|
48
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Node, Element, DataNode, NodeWithChildren, Document } from './node';
|
|
2
|
+
export * from "./node";
|
|
3
|
+
export interface DomHandlerOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Add a `startIndex` property to nodes.
|
|
6
|
+
* When the parser is used in a non-streaming fashion, `startIndex` is an integer
|
|
7
|
+
* indicating the position of the start of the node in the document.
|
|
8
|
+
*
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
|
+
withStartIndices?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Add an `endIndex` property to nodes.
|
|
14
|
+
* When the parser is used in a non-streaming fashion, `endIndex` is an integer
|
|
15
|
+
* indicating the position of the end of the node in the document.
|
|
16
|
+
*
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
withEndIndices?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Replace all whitespace with single spaces.
|
|
22
|
+
*
|
|
23
|
+
* **Note:** Enabling this might break your markup.
|
|
24
|
+
*
|
|
25
|
+
* @default false
|
|
26
|
+
* @deprecated
|
|
27
|
+
*/
|
|
28
|
+
normalizeWhitespace?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Treat the markup as XML.
|
|
31
|
+
*
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
xmlMode?: boolean;
|
|
35
|
+
}
|
|
36
|
+
interface ParserInterface {
|
|
37
|
+
startIndex: number | null;
|
|
38
|
+
endIndex: number | null;
|
|
39
|
+
}
|
|
40
|
+
declare type Callback = (error: Error | null, dom: Node[]) => void;
|
|
41
|
+
declare type ElementCallback = (element: Element) => void;
|
|
42
|
+
export declare class DomHandler {
|
|
43
|
+
/** The elements of the DOM */
|
|
44
|
+
dom: Node[];
|
|
45
|
+
/** The root element for the DOM */
|
|
46
|
+
root: Document;
|
|
47
|
+
/** Called once parsing has completed. */
|
|
48
|
+
private readonly callback;
|
|
49
|
+
/** Settings for the handler. */
|
|
50
|
+
private readonly options;
|
|
51
|
+
/** Callback whenever a tag is closed. */
|
|
52
|
+
private readonly elementCB;
|
|
53
|
+
/** Indicated whether parsing has been completed. */
|
|
54
|
+
private done;
|
|
55
|
+
/** Stack of open tags. */
|
|
56
|
+
protected tagStack: NodeWithChildren[];
|
|
57
|
+
/** A data node that is still being written to. */
|
|
58
|
+
protected lastNode: DataNode | null;
|
|
59
|
+
/** Reference to the parser instance. Used for location information. */
|
|
60
|
+
private parser;
|
|
61
|
+
/**
|
|
62
|
+
* @param callback Called once parsing has completed.
|
|
63
|
+
* @param options Settings for the handler.
|
|
64
|
+
* @param elementCB Callback whenever a tag is closed.
|
|
65
|
+
*/
|
|
66
|
+
constructor(callback?: Callback | null, options?: DomHandlerOptions | null, elementCB?: ElementCallback);
|
|
67
|
+
onparserinit(parser: ParserInterface): void;
|
|
68
|
+
onreset(): void;
|
|
69
|
+
onend(): void;
|
|
70
|
+
onerror(error: Error): void;
|
|
71
|
+
onclosetag(): void;
|
|
72
|
+
onopentag(name: string, attribs: {
|
|
73
|
+
[key: string]: string;
|
|
74
|
+
}): void;
|
|
75
|
+
ontext(data: string): void;
|
|
76
|
+
oncomment(data: string): void;
|
|
77
|
+
oncommentend(): void;
|
|
78
|
+
oncdatastart(): void;
|
|
79
|
+
oncdataend(): void;
|
|
80
|
+
onprocessinginstruction(name: string, data: string): void;
|
|
81
|
+
protected handleCallback(error: Error | null): void;
|
|
82
|
+
protected addNode(node: Node): void;
|
|
83
|
+
}
|
|
84
|
+
export default DomHandler;
|
|
85
|
+
//# sourceMappingURL=index.d.ts.map
|