@umijs/utils 3.5.18 → 4.0.0-beta.2
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 +113 -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 +142 -0
- package/compiled/color/index.js +1 -0
- package/compiled/color/package.json +4 -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 +19 -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 +867 -0
- package/compiled/prettier/index.js +475 -0
- package/compiled/prettier/package.json +5 -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 +47 -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 +96 -12
- 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,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The main types of Cheerio objects.
|
|
3
|
+
*
|
|
4
|
+
* @category Cheerio
|
|
5
|
+
*/
|
|
6
|
+
export type { Cheerio } from './cheerio';
|
|
7
|
+
/**
|
|
8
|
+
* Types used in signatures of Cheerio methods.
|
|
9
|
+
*
|
|
10
|
+
* @category Cheerio
|
|
11
|
+
*/
|
|
12
|
+
export * from './types';
|
|
13
|
+
export type { CheerioOptions, HTMLParser2Options, Parse5Options, } from './options';
|
|
14
|
+
/**
|
|
15
|
+
* Re-exporting all of the node types.
|
|
16
|
+
*
|
|
17
|
+
* @category DOM Node
|
|
18
|
+
*/
|
|
19
|
+
export type { Node, NodeWithChildren, Element, Document } from 'domhandler';
|
|
20
|
+
export * from './load';
|
|
21
|
+
declare const _default: import('./load').CheerioAPI;
|
|
22
|
+
/**
|
|
23
|
+
* The default cheerio instance.
|
|
24
|
+
*
|
|
25
|
+
* @deprecated Use the function returned by `load` instead.
|
|
26
|
+
*/
|
|
27
|
+
export default _default;
|
|
28
|
+
import * as staticMethods from './static';
|
|
29
|
+
/**
|
|
30
|
+
* In order to promote consistency with the jQuery library, users are encouraged
|
|
31
|
+
* to instead use the static method of the same name.
|
|
32
|
+
*
|
|
33
|
+
* @deprecated
|
|
34
|
+
* @example
|
|
35
|
+
*
|
|
36
|
+
* ```js
|
|
37
|
+
* const $ = cheerio.load('<div><p></p></div>');
|
|
38
|
+
*
|
|
39
|
+
* $.contains($('div').get(0), $('p').get(0));
|
|
40
|
+
* //=> true
|
|
41
|
+
*
|
|
42
|
+
* $.contains($('p').get(0), $('div').get(0));
|
|
43
|
+
* //=> false
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @returns {boolean}
|
|
47
|
+
*/
|
|
48
|
+
export declare const contains: typeof staticMethods.contains;
|
|
49
|
+
/**
|
|
50
|
+
* In order to promote consistency with the jQuery library, users are encouraged
|
|
51
|
+
* to instead use the static method of the same name.
|
|
52
|
+
*
|
|
53
|
+
* @deprecated
|
|
54
|
+
* @example
|
|
55
|
+
*
|
|
56
|
+
* ```js
|
|
57
|
+
* const $ = cheerio.load('');
|
|
58
|
+
*
|
|
59
|
+
* $.merge([1, 2], [3, 4]);
|
|
60
|
+
* //=> [1, 2, 3, 4]
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare const merge: typeof staticMethods.merge;
|
|
64
|
+
/**
|
|
65
|
+
* In order to promote consistency with the jQuery library, users are encouraged
|
|
66
|
+
* to instead use the static method of the same name as it is defined on the
|
|
67
|
+
* "loaded" Cheerio factory function.
|
|
68
|
+
*
|
|
69
|
+
* @deprecated See {@link static/parseHTML}.
|
|
70
|
+
* @example
|
|
71
|
+
*
|
|
72
|
+
* ```js
|
|
73
|
+
* const $ = cheerio.load('');
|
|
74
|
+
* $.parseHTML('<b>markup</b>');
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export declare const parseHTML: typeof staticMethods.parseHTML;
|
|
78
|
+
/**
|
|
79
|
+
* Users seeking to access the top-level element of a parsed document should
|
|
80
|
+
* instead use the `root` static method of a "loaded" Cheerio function.
|
|
81
|
+
*
|
|
82
|
+
* @deprecated
|
|
83
|
+
* @example
|
|
84
|
+
*
|
|
85
|
+
* ```js
|
|
86
|
+
* const $ = cheerio.load('');
|
|
87
|
+
* $.root();
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
export declare const root: typeof staticMethods.root;
|
|
91
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { CheerioOptions, InternalOptions } from './options';
|
|
3
|
+
import * as staticMethods from './static';
|
|
4
|
+
import { Cheerio } from './cheerio';
|
|
5
|
+
import type { Node, Document, Element } from '../domhandler';
|
|
6
|
+
import type * as Load from './load';
|
|
7
|
+
import { SelectorType, BasicAcceptedElems } from './types';
|
|
8
|
+
declare type StaticType = typeof staticMethods;
|
|
9
|
+
declare type LoadType = typeof Load;
|
|
10
|
+
/**
|
|
11
|
+
* A querying function, bound to a document created from the provided markup.
|
|
12
|
+
*
|
|
13
|
+
* Also provides several helper methods for dealing with the document as a whole.
|
|
14
|
+
*/
|
|
15
|
+
export interface CheerioAPI extends StaticType, LoadType {
|
|
16
|
+
/**
|
|
17
|
+
* This selector method is the starting point for traversing and manipulating
|
|
18
|
+
* the document. Like jQuery, it's the primary method for selecting elements
|
|
19
|
+
* in the document.
|
|
20
|
+
*
|
|
21
|
+
* `selector` searches within the `context` scope which searches within the
|
|
22
|
+
* `root` scope.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
*
|
|
26
|
+
* ```js
|
|
27
|
+
* $('.apple', '#fruits').text();
|
|
28
|
+
* //=> Apple
|
|
29
|
+
*
|
|
30
|
+
* $('ul .pear').attr('class');
|
|
31
|
+
* //=> pear
|
|
32
|
+
*
|
|
33
|
+
* $('li[class=orange]').html();
|
|
34
|
+
* //=> Orange
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @param selector - Either a selector to look for within the document, or the
|
|
38
|
+
* contents of a new Cheerio instance.
|
|
39
|
+
* @param context - Either a selector to look for within the root, or the
|
|
40
|
+
* contents of the document to query.
|
|
41
|
+
* @param root - Optional HTML document string.
|
|
42
|
+
*/
|
|
43
|
+
<T extends Node, S extends string>(selector?: S | BasicAcceptedElems<T>, context?: BasicAcceptedElems<Node> | null, root?: BasicAcceptedElems<Document>, options?: CheerioOptions): Cheerio<S extends SelectorType ? Element : T>;
|
|
44
|
+
/**
|
|
45
|
+
* The root the document was originally loaded with.
|
|
46
|
+
*
|
|
47
|
+
* @private
|
|
48
|
+
*/
|
|
49
|
+
_root: Document;
|
|
50
|
+
/**
|
|
51
|
+
* The options the document was originally loaded with.
|
|
52
|
+
*
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
_options: InternalOptions;
|
|
56
|
+
/** Mimic jQuery's prototype alias for plugin authors. */
|
|
57
|
+
fn: typeof Cheerio.prototype;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Create a querying function, bound to a document created from the provided
|
|
61
|
+
* markup. Note that similar to web browser contexts, this operation may
|
|
62
|
+
* introduce `<html>`, `<head>`, and `<body>` elements; set `isDocument` to
|
|
63
|
+
* `false` to switch to fragment mode and disable this.
|
|
64
|
+
*
|
|
65
|
+
* @param content - Markup to be loaded.
|
|
66
|
+
* @param options - Options for the created instance.
|
|
67
|
+
* @param isDocument - Allows parser to be switched to fragment mode.
|
|
68
|
+
* @returns The loaded document.
|
|
69
|
+
* @see {@link https://cheerio.js.org#loading} for additional usage information.
|
|
70
|
+
*/
|
|
71
|
+
export declare function load(content: string | Node | Node[] | Buffer, options?: CheerioOptions | null, isDocument?: boolean): CheerioAPI;
|
|
72
|
+
export {};
|
|
73
|
+
//# sourceMappingURL=load.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { DomHandlerOptions } from '../domhandler';
|
|
2
|
+
import type { ParserOptions } from '../htmlparser2';
|
|
3
|
+
/** Options accepted by htmlparser2, the default parser for XML. */
|
|
4
|
+
export interface HTMLParser2Options extends DomHandlerOptions, ParserOptions {
|
|
5
|
+
}
|
|
6
|
+
/** Options for parse5, the default parser for HTML. */
|
|
7
|
+
export interface Parse5Options {
|
|
8
|
+
/** Disable scripting in parse5, so noscript tags would be parsed. */
|
|
9
|
+
scriptingEnabled?: boolean;
|
|
10
|
+
/** Enable location support for parse5. */
|
|
11
|
+
sourceCodeLocationInfo?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** Internal options for Cheerio. */
|
|
14
|
+
export interface InternalOptions extends HTMLParser2Options, Parse5Options {
|
|
15
|
+
_useHtmlParser2?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Options accepted by Cheerio.
|
|
19
|
+
*
|
|
20
|
+
* Please note that parser-specific options are *only recognized* if the
|
|
21
|
+
* relevant parser is used.
|
|
22
|
+
*/
|
|
23
|
+
export interface CheerioOptions extends HTMLParser2Options, Parse5Options {
|
|
24
|
+
/** Suggested way of configuring htmlparser2 when wanting to parse XML. */
|
|
25
|
+
xml?: HTMLParser2Options | boolean;
|
|
26
|
+
}
|
|
27
|
+
declare const defaultOpts: CheerioOptions;
|
|
28
|
+
/** Cheerio default options. */
|
|
29
|
+
export default defaultOpts;
|
|
30
|
+
export declare function flatten(options?: CheerioOptions | null): InternalOptions | undefined;
|
|
31
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { CheerioAPI, Cheerio } from '.';
|
|
2
|
+
import { Node, Document } from '../domhandler';
|
|
3
|
+
import { CheerioOptions } from './options';
|
|
4
|
+
/**
|
|
5
|
+
* Renders the document.
|
|
6
|
+
*
|
|
7
|
+
* @param options - Options for the renderer.
|
|
8
|
+
* @returns The rendered document.
|
|
9
|
+
*/
|
|
10
|
+
export declare function html(this: CheerioAPI | void, options?: CheerioOptions): string;
|
|
11
|
+
/**
|
|
12
|
+
* Renders the document.
|
|
13
|
+
*
|
|
14
|
+
* @param dom - Element to render.
|
|
15
|
+
* @param options - Options for the renderer.
|
|
16
|
+
* @returns The rendered document.
|
|
17
|
+
*/
|
|
18
|
+
export declare function html(this: CheerioAPI | void, dom?: string | ArrayLike<Node> | Node, options?: CheerioOptions): string;
|
|
19
|
+
/**
|
|
20
|
+
* Render the document as XML.
|
|
21
|
+
*
|
|
22
|
+
* @param dom - Element to render.
|
|
23
|
+
* @returns THe rendered document.
|
|
24
|
+
*/
|
|
25
|
+
export declare function xml(this: CheerioAPI, dom?: string | ArrayLike<Node> | Node): string;
|
|
26
|
+
/**
|
|
27
|
+
* Render the document as text.
|
|
28
|
+
*
|
|
29
|
+
* @param elements - Elements to render.
|
|
30
|
+
* @returns The rendered document.
|
|
31
|
+
*/
|
|
32
|
+
export declare function text(this: CheerioAPI | void, elements?: ArrayLike<Node>): string;
|
|
33
|
+
/**
|
|
34
|
+
* Parses a string into an array of DOM nodes. The `context` argument has no
|
|
35
|
+
* meaning for Cheerio, but it is maintained for API compatibility with jQuery.
|
|
36
|
+
*
|
|
37
|
+
* @param data - Markup that will be parsed.
|
|
38
|
+
* @param context - Will be ignored. If it is a boolean it will be used as the
|
|
39
|
+
* value of `keepScripts`.
|
|
40
|
+
* @param keepScripts - If false all scripts will be removed.
|
|
41
|
+
* @returns The parsed DOM.
|
|
42
|
+
* @alias Cheerio.parseHTML
|
|
43
|
+
* @see {@link https://api.jquery.com/jQuery.parseHTML/}
|
|
44
|
+
*/
|
|
45
|
+
export declare function parseHTML(this: CheerioAPI, data: string, context?: unknown | boolean, keepScripts?: boolean): Node[];
|
|
46
|
+
export declare function parseHTML(this: CheerioAPI, data?: '' | null): null;
|
|
47
|
+
/**
|
|
48
|
+
* Sometimes you need to work with the top-level root element. To query it, you
|
|
49
|
+
* can use `$.root()`.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
*
|
|
53
|
+
* ```js
|
|
54
|
+
* $.root().append('<ul id="vegetables"></ul>').html();
|
|
55
|
+
* //=> <ul id="fruits">...</ul><ul id="vegetables"></ul>
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @returns Cheerio instance wrapping the root node.
|
|
59
|
+
* @alias Cheerio.root
|
|
60
|
+
*/
|
|
61
|
+
export declare function root(this: CheerioAPI): Cheerio<Document>;
|
|
62
|
+
/**
|
|
63
|
+
* Checks to see if the `contained` DOM element is a descendant of the
|
|
64
|
+
* `container` DOM element.
|
|
65
|
+
*
|
|
66
|
+
* @param container - Potential parent node.
|
|
67
|
+
* @param contained - Potential child node.
|
|
68
|
+
* @returns Indicates if the nodes contain one another.
|
|
69
|
+
* @alias Cheerio.contains
|
|
70
|
+
* @see {@link https://api.jquery.com/jQuery.contains/}
|
|
71
|
+
*/
|
|
72
|
+
export declare function contains(container: Node, contained: Node): boolean;
|
|
73
|
+
interface WritableArrayLike<T> extends ArrayLike<T> {
|
|
74
|
+
length: number;
|
|
75
|
+
[n: number]: T;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* $.merge().
|
|
79
|
+
*
|
|
80
|
+
* @param arr1 - First array.
|
|
81
|
+
* @param arr2 - Second array.
|
|
82
|
+
* @returns `arr1`, with elements of `arr2` inserted.
|
|
83
|
+
* @alias Cheerio.merge
|
|
84
|
+
* @see {@link https://api.jquery.com/jQuery.merge/}
|
|
85
|
+
*/
|
|
86
|
+
export declare function merge<T>(arr1: WritableArrayLike<T>, arr2: ArrayLike<T>): ArrayLike<T> | undefined;
|
|
87
|
+
export {};
|
|
88
|
+
//# sourceMappingURL=static.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare type LowercaseLetters = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z';
|
|
2
|
+
declare type AlphaNumeric = LowercaseLetters | Uppercase<LowercaseLetters> | `${number}`;
|
|
3
|
+
declare type SelectorSpecial = '.' | '#' | ':' | '|' | '>' | '+' | '~' | '[';
|
|
4
|
+
/**
|
|
5
|
+
* Type for identifying selectors. Allows us to "upgrade" queries using
|
|
6
|
+
* selectors to return `Element`s.
|
|
7
|
+
*/
|
|
8
|
+
export declare type SelectorType = `${SelectorSpecial}${AlphaNumeric}${string}` | `${AlphaNumeric}${string}`;
|
|
9
|
+
import type { Cheerio } from './cheerio';
|
|
10
|
+
import type { Node } from '../domhandler';
|
|
11
|
+
/** Elements that can be passed to manipulation methods. */
|
|
12
|
+
export declare type BasicAcceptedElems<T extends Node> = Cheerio<T> | T[] | T | string;
|
|
13
|
+
/** Elements that can be passed to manipulation methods, including functions. */
|
|
14
|
+
export declare type AcceptedElems<T extends Node> = BasicAcceptedElems<T> | ((this: T, i: number, el: T) => BasicAcceptedElems<T>);
|
|
15
|
+
/** Function signature, for traversal methods. */
|
|
16
|
+
export declare type FilterFunction<T> = (this: T, i: number, el: T) => boolean;
|
|
17
|
+
/** Supported filter types, for traversal methods. */
|
|
18
|
+
export declare type AcceptedFilters<T> = string | FilterFunction<T> | T | Cheerio<T>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"cheerio","author":"Matt Mueller <mattmuelle@gmail.com>","license":"MIT","types":"lib/index.d.ts"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Copyright (c) 2012 Heather Arthur
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
21
|
+
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import colors = require('../color-name');
|
|
2
|
+
|
|
3
|
+
export type RGB = [number, number, number];
|
|
4
|
+
export type HSL = [number, number, number];
|
|
5
|
+
export type HSV = [number, number, number];
|
|
6
|
+
export type HWB = [number, number, number];
|
|
7
|
+
export type CMYK = [number, number, number, number];
|
|
8
|
+
export type XYZ = [number, number, number];
|
|
9
|
+
export type LAB = [number, number, number];
|
|
10
|
+
export type LCH = [number, number, number];
|
|
11
|
+
export type HEX = string;
|
|
12
|
+
export type KEYWORD = keyof typeof colors;
|
|
13
|
+
export type ANSI16 = number;
|
|
14
|
+
export type ANSI256 = number;
|
|
15
|
+
export type HCG = [number, number, number];
|
|
16
|
+
export type APPLE = [number, number, number];
|
|
17
|
+
export type GRAY = [number];
|
|
18
|
+
|
|
19
|
+
export namespace rgb {
|
|
20
|
+
const channels: 3;
|
|
21
|
+
const labels: 'rgb';
|
|
22
|
+
function hsl(rgb: RGB): HSL;
|
|
23
|
+
function hsl(...rgb: RGB): HSL;
|
|
24
|
+
function hsv(rgb: RGB): HSV;
|
|
25
|
+
function hsv(...rgb: RGB): HSV;
|
|
26
|
+
function hwb(rgb: RGB): HWB;
|
|
27
|
+
function hwb(...rgb: RGB): HWB;
|
|
28
|
+
function cmyk(rgb: RGB): CMYK;
|
|
29
|
+
function cmyk(...rgb: RGB): CMYK;
|
|
30
|
+
function keyword(rgb: RGB): KEYWORD;
|
|
31
|
+
function keyword(...rgb: RGB): KEYWORD;
|
|
32
|
+
function xyz(rgb: RGB): XYZ;
|
|
33
|
+
function xyz(...rgb: RGB): XYZ;
|
|
34
|
+
function lab(rgb: RGB): LAB;
|
|
35
|
+
function lab(...rgb: RGB): LAB;
|
|
36
|
+
function ansi16(rgb: RGB): ANSI16;
|
|
37
|
+
function ansi16(...rgb: RGB): ANSI16;
|
|
38
|
+
function ansi256(rgb: RGB): ANSI256;
|
|
39
|
+
function ansi256(...rgb: RGB): ANSI256;
|
|
40
|
+
function hex(rgb: RGB): HEX;
|
|
41
|
+
function hex(...rgb: RGB): HEX;
|
|
42
|
+
function hcg(rgb: RGB): HCG;
|
|
43
|
+
function hcg(...rgb: RGB): HCG;
|
|
44
|
+
function apple(rgb: RGB): APPLE;
|
|
45
|
+
function apple(...rgb: RGB): APPLE;
|
|
46
|
+
function gray(rgb: RGB): GRAY;
|
|
47
|
+
function gray(...rgb: RGB): GRAY;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export namespace hsl {
|
|
51
|
+
const channels: 3;
|
|
52
|
+
const labels: 'hsl';
|
|
53
|
+
function rgb(hsl: HSL): RGB;
|
|
54
|
+
function hsv(hsl: HSL): HSV;
|
|
55
|
+
function hcg(hsl: HSL): HCG;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export namespace hsv {
|
|
59
|
+
const channels: 3;
|
|
60
|
+
const labels: 'hsv';
|
|
61
|
+
function rgb(hsv: HSV): RGB;
|
|
62
|
+
function hsl(hsv: HSV): HSL;
|
|
63
|
+
function ansi16(hsv: HSV): ANSI16;
|
|
64
|
+
function hcg(hsv: HSV): HCG;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export namespace hwb {
|
|
68
|
+
const channels: 3;
|
|
69
|
+
const labels: 'hwb';
|
|
70
|
+
function rgb(hwb: HWB): RGB;
|
|
71
|
+
function hcg(hwb: HWB): HCG;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export namespace cmyk {
|
|
75
|
+
const channels: 4;
|
|
76
|
+
const labels: 'cmyk';
|
|
77
|
+
function rgb(cmyk: CMYK): RGB;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export namespace xyz {
|
|
81
|
+
const channels: 3;
|
|
82
|
+
const labels: 'xyz';
|
|
83
|
+
function rgb(xyz: XYZ): RGB;
|
|
84
|
+
function lab(xyz: XYZ): LAB;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export namespace lab {
|
|
88
|
+
const channels: 3;
|
|
89
|
+
const labels: 'lab';
|
|
90
|
+
function xyz(lab: LAB): XYZ;
|
|
91
|
+
function lch(lab: LAB): LCH;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export namespace lch {
|
|
95
|
+
const channels: 3;
|
|
96
|
+
const labels: 'lch';
|
|
97
|
+
function lab(lch: LCH): LAB;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export namespace hex {
|
|
101
|
+
const channels: 1;
|
|
102
|
+
const labels: ['hex'];
|
|
103
|
+
function rgb(hex: HEX): RGB;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export namespace keyword {
|
|
107
|
+
const channels: 1;
|
|
108
|
+
const labels: ['keyword'];
|
|
109
|
+
function rgb(keyword: KEYWORD): RGB;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export namespace ansi16 {
|
|
113
|
+
const channels: 1;
|
|
114
|
+
const labels: ['ansi16'];
|
|
115
|
+
function rgb(ansi16: ANSI16): RGB;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export namespace ansi256 {
|
|
119
|
+
const channels: 1;
|
|
120
|
+
const labels: ['ansi256'];
|
|
121
|
+
function rgb(ansi256: ANSI256): RGB;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export namespace hcg {
|
|
125
|
+
const channels: 3;
|
|
126
|
+
const labels: ['h', 'c', 'g'];
|
|
127
|
+
function rgb(hcg: HCG): RGB;
|
|
128
|
+
function hsv(hcg: HCG): HSV;
|
|
129
|
+
function hsl(hcg: HCG): HSL;
|
|
130
|
+
function hwb(hcg: HCG): HWB;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export namespace apple {
|
|
134
|
+
const channels: 3;
|
|
135
|
+
const labels: ['r16', 'g16', 'b16'];
|
|
136
|
+
function rgb(apple: APPLE): RGB;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export namespace gray {
|
|
140
|
+
const channels: 1;
|
|
141
|
+
const labels: ['gray'];
|
|
142
|
+
function rgb(gray: GRAY): RGB;
|
|
143
|
+
function hsl(gray: GRAY): HSL;
|
|
144
|
+
function hsv(gray: GRAY): HSV;
|
|
145
|
+
function hwb(gray: GRAY): HWB;
|
|
146
|
+
function cmyk(gray: GRAY): CMYK;
|
|
147
|
+
function lab(gray: GRAY): LAB;
|
|
148
|
+
function hex(gray: GRAY): HEX;
|
|
149
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// Type definitions for color-convert 2.0
|
|
2
|
+
// Project: https://github.com/qix-/color-convert#readme
|
|
3
|
+
// Definitions by: Junyoung Clare Jang <https://github.com/Airlun>
|
|
4
|
+
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
|
|
5
|
+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
6
|
+
|
|
7
|
+
import conversions = require('./conversions');
|
|
8
|
+
import route = require('./route');
|
|
9
|
+
|
|
10
|
+
export const rgb: typeof conversions.rgb &
|
|
11
|
+
route.rgb & {
|
|
12
|
+
[F in keyof route.rgb]: {
|
|
13
|
+
raw: route.rgb[F];
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const hsl: typeof conversions.hsl &
|
|
18
|
+
route.hsl & {
|
|
19
|
+
[F in keyof route.hsl]: {
|
|
20
|
+
raw: route.hsl[F];
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const hsv: typeof conversions.hsv &
|
|
25
|
+
route.hsv & {
|
|
26
|
+
[F in keyof route.hsv]: {
|
|
27
|
+
raw: route.hsv[F];
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const hwb: typeof conversions.hwb &
|
|
32
|
+
route.hwb & {
|
|
33
|
+
[F in keyof route.hwb]: {
|
|
34
|
+
raw: route.hwb[F];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const cmyk: typeof conversions.cmyk &
|
|
39
|
+
route.cmyk & {
|
|
40
|
+
[F in keyof route.cmyk]: {
|
|
41
|
+
raw: route.cmyk[F];
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const xyz: typeof conversions.xyz &
|
|
46
|
+
route.xyz & {
|
|
47
|
+
[F in keyof route.xyz]: {
|
|
48
|
+
raw: route.xyz[F];
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const lab: typeof conversions.lab &
|
|
53
|
+
route.lab & {
|
|
54
|
+
[F in keyof route.lab]: {
|
|
55
|
+
raw: route.lab[F];
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const lch: typeof conversions.lch &
|
|
60
|
+
route.lch & {
|
|
61
|
+
[F in keyof route.lch]: {
|
|
62
|
+
raw: route.lch[F];
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const hex: typeof conversions.hex &
|
|
67
|
+
route.hex & {
|
|
68
|
+
[F in keyof route.hex]: {
|
|
69
|
+
raw: route.hex[F];
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const keyword: typeof conversions.keyword &
|
|
74
|
+
route.keyword & {
|
|
75
|
+
[F in keyof route.keyword]: {
|
|
76
|
+
raw: route.keyword[F];
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const ansi16: typeof conversions.ansi16 &
|
|
81
|
+
route.ansi16 & {
|
|
82
|
+
[F in keyof route.ansi16]: {
|
|
83
|
+
raw: route.ansi16[F];
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const ansi256: typeof conversions.ansi256 &
|
|
88
|
+
route.ansi256 & {
|
|
89
|
+
[F in keyof route.ansi256]: {
|
|
90
|
+
raw: route.ansi256[F];
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const hcg: typeof conversions.hcg &
|
|
95
|
+
route.hcg & {
|
|
96
|
+
[F in keyof route.hcg]: {
|
|
97
|
+
raw: route.hcg[F];
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export const apple: typeof conversions.apple &
|
|
102
|
+
route.apple & {
|
|
103
|
+
[F in keyof route.apple]: {
|
|
104
|
+
raw: route.apple[F];
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const gray: typeof conversions.gray &
|
|
109
|
+
route.gray & {
|
|
110
|
+
[F in keyof route.gray]: {
|
|
111
|
+
raw: route.gray[F];
|
|
112
|
+
};
|
|
113
|
+
};
|