From be044ccbd2952ba14efae3b238a8e4d2c0130146 Mon Sep 17 00:00:00 2001 From: Library Map Bot Date: Sat, 3 Sep 2022 07:12:22 +0000 Subject: [PATCH] merge csv data to topo --- node_modules/boolbase/package.json | 57 +- node_modules/cheerio-select/lib/helpers.d.ts | 4 +- .../cheerio-select/lib/helpers.d.ts.map | 2 +- node_modules/cheerio-select/lib/helpers.js | 5 +- node_modules/cheerio-select/lib/index.d.ts | 10 +- .../cheerio-select/lib/index.d.ts.map | 2 +- node_modules/cheerio-select/lib/index.js | 144 +- .../cheerio-select/lib/positionals.d.ts | 2 +- .../cheerio-select/lib/positionals.d.ts.map | 2 +- .../cheerio-select/lib/positionals.js | 16 +- node_modules/cheerio-select/package.json | 165 +- node_modules/cheerio/LICENSE | 4 +- node_modules/cheerio/Readme.md | 80 +- node_modules/cheerio/lib/api/attributes.d.ts | 71 +- .../cheerio/lib/api/attributes.d.ts.map | 2 +- node_modules/cheerio/lib/api/attributes.js | 145 +- node_modules/cheerio/lib/api/css.d.ts | 17 +- node_modules/cheerio/lib/api/css.d.ts.map | 2 +- node_modules/cheerio/lib/api/css.js | 51 +- node_modules/cheerio/lib/api/forms.d.ts | 15 +- node_modules/cheerio/lib/api/forms.d.ts.map | 2 +- node_modules/cheerio/lib/api/forms.js | 14 +- .../cheerio/lib/api/manipulation.d.ts | 94 +- .../cheerio/lib/api/manipulation.d.ts.map | 2 +- node_modules/cheerio/lib/api/manipulation.js | 141 +- node_modules/cheerio/lib/api/traversing.d.ts | 60 +- .../cheerio/lib/api/traversing.d.ts.map | 2 +- node_modules/cheerio/lib/api/traversing.js | 127 +- node_modules/cheerio/lib/cheerio.d.ts | 52 +- node_modules/cheerio/lib/cheerio.d.ts.map | 2 +- node_modules/cheerio/lib/cheerio.js | 121 +- node_modules/cheerio/lib/index.d.ts | 30 +- node_modules/cheerio/lib/index.d.ts.map | 2 +- node_modules/cheerio/lib/index.js | 74 +- node_modules/cheerio/lib/load.d.ts | 31 +- node_modules/cheerio/lib/load.d.ts.map | 2 +- node_modules/cheerio/lib/load.js | 224 +- node_modules/cheerio/lib/options.d.ts | 73 +- node_modules/cheerio/lib/options.d.ts.map | 2 +- node_modules/cheerio/lib/options.js | 23 +- node_modules/cheerio/lib/parse.d.ts | 14 +- node_modules/cheerio/lib/parse.d.ts.map | 2 +- node_modules/cheerio/lib/parse.js | 65 +- .../lib/parsers/htmlparser2-adapter.d.ts | 3 - .../lib/parsers/htmlparser2-adapter.d.ts.map | 1 - .../lib/parsers/htmlparser2-adapter.js | 10 - .../cheerio/lib/parsers/parse5-adapter.d.ts | 27 +- .../lib/parsers/parse5-adapter.d.ts.map | 2 +- .../cheerio/lib/parsers/parse5-adapter.js | 60 +- node_modules/cheerio/lib/static.d.ts | 21 +- node_modules/cheerio/lib/static.d.ts.map | 2 +- node_modules/cheerio/lib/static.js | 89 +- node_modules/cheerio/lib/types.d.ts | 8 +- node_modules/cheerio/lib/types.d.ts.map | 2 +- node_modules/cheerio/lib/types.js | 1 + node_modules/cheerio/lib/utils.d.ts | 26 +- node_modules/cheerio/lib/utils.d.ts.map | 2 +- node_modules/cheerio/lib/utils.js | 49 +- node_modules/cheerio/package.json | 234 +- node_modules/css-select/README.md | 89 +- node_modules/css-select/lib/attributes.d.ts | 2 +- .../css-select/lib/attributes.d.ts.map | 2 +- node_modules/css-select/lib/attributes.js | 119 +- node_modules/css-select/lib/compile.d.ts | 3 +- node_modules/css-select/lib/compile.d.ts.map | 2 +- node_modules/css-select/lib/compile.js | 90 +- node_modules/css-select/lib/general.d.ts | 2 +- node_modules/css-select/lib/general.d.ts.map | 2 +- node_modules/css-select/lib/general.js | 88 +- node_modules/css-select/lib/index.d.ts | 15 +- node_modules/css-select/lib/index.d.ts.map | 2 +- node_modules/css-select/lib/index.js | 44 +- node_modules/css-select/lib/procedure.d.ts | 5 - .../css-select/lib/procedure.d.ts.map | 1 - node_modules/css-select/lib/procedure.js | 20 - .../lib/pseudo-selectors/aliases.d.ts.map | 2 +- .../lib/pseudo-selectors/aliases.js | 1 + .../lib/pseudo-selectors/filters.d.ts | 2 +- .../lib/pseudo-selectors/filters.d.ts.map | 2 +- .../lib/pseudo-selectors/filters.js | 39 +- .../lib/pseudo-selectors/index.d.ts | 8 +- .../lib/pseudo-selectors/index.d.ts.map | 2 +- .../css-select/lib/pseudo-selectors/index.js | 68 +- .../lib/pseudo-selectors/pseudos.d.ts | 8 +- .../lib/pseudo-selectors/pseudos.d.ts.map | 2 +- .../lib/pseudo-selectors/pseudos.js | 14 +- .../lib/pseudo-selectors/subselects.d.ts | 3 +- .../lib/pseudo-selectors/subselects.d.ts.map | 2 +- .../lib/pseudo-selectors/subselects.js | 113 +- node_modules/css-select/lib/sort.d.ts | 4 +- node_modules/css-select/lib/sort.d.ts.map | 2 +- node_modules/css-select/lib/sort.js | 66 +- node_modules/css-select/lib/types.d.ts | 51 +- node_modules/css-select/lib/types.d.ts.map | 2 +- node_modules/css-select/lib/types.js | 1 + node_modules/css-select/package.json | 178 +- node_modules/css-what/lib/index.d.ts | 4 - node_modules/css-what/lib/index.d.ts.map | 1 - node_modules/css-what/lib/index.js | 21 - node_modules/css-what/lib/parse.d.ts | 71 - node_modules/css-what/lib/parse.d.ts.map | 1 - node_modules/css-what/lib/parse.js | 432 --- node_modules/css-what/lib/stringify.d.ts | 8 - node_modules/css-what/lib/stringify.d.ts.map | 1 - node_modules/css-what/lib/stringify.js | 105 - node_modules/css-what/package.json | 142 +- node_modules/css-what/readme.md | 53 +- node_modules/dom-serializer/README.md | 14 +- .../dom-serializer/lib/foreignNames.d.ts.map | 2 +- .../dom-serializer/lib/foreignNames.js | 196 +- node_modules/dom-serializer/lib/index.d.ts | 15 +- .../dom-serializer/lib/index.d.ts.map | 2 +- node_modules/dom-serializer/lib/index.js | 50 +- node_modules/dom-serializer/package.json | 131 +- node_modules/domelementtype/package.json | 127 +- node_modules/domhandler/lib/index.d.ts | 21 +- node_modules/domhandler/lib/index.d.ts.map | 2 +- node_modules/domhandler/lib/index.js | 39 +- node_modules/domhandler/lib/node.d.ts | 142 +- node_modules/domhandler/lib/node.d.ts.map | 2 +- node_modules/domhandler/lib/node.js | 152 +- node_modules/domhandler/package.json | 162 +- node_modules/domhandler/readme.md | 71 - node_modules/domutils/lib/feeds.d.ts | 30 +- node_modules/domutils/lib/feeds.d.ts.map | 2 +- node_modules/domutils/lib/feeds.js | 31 +- node_modules/domutils/lib/helpers.d.ts | 23 +- node_modules/domutils/lib/helpers.d.ts.map | 2 +- node_modules/domutils/lib/helpers.js | 40 +- node_modules/domutils/lib/index.d.ts | 14 +- node_modules/domutils/lib/index.d.ts.map | 2 +- node_modules/domutils/lib/index.js | 21 +- node_modules/domutils/lib/legacy.d.ts | 29 +- node_modules/domutils/lib/legacy.d.ts.map | 2 +- node_modules/domutils/lib/legacy.js | 27 +- node_modules/domutils/lib/manipulation.d.ts | 20 +- .../domutils/lib/manipulation.d.ts.map | 2 +- node_modules/domutils/lib/manipulation.js | 8 + node_modules/domutils/lib/querying.d.ts | 27 +- node_modules/domutils/lib/querying.d.ts.map | 2 +- node_modules/domutils/lib/querying.js | 16 +- node_modules/domutils/lib/stringify.d.ts | 21 +- node_modules/domutils/lib/stringify.d.ts.map | 2 +- node_modules/domutils/lib/stringify.js | 10 +- node_modules/domutils/lib/traversal.d.ts | 26 +- node_modules/domutils/lib/traversal.d.ts.map | 2 +- node_modules/domutils/lib/traversal.js | 19 +- node_modules/domutils/package.json | 169 +- node_modules/entities/lib/decode.d.ts | 36 +- node_modules/entities/lib/decode.d.ts.map | 2 +- node_modules/entities/lib/decode.js | 214 +- .../entities/lib/decode_codepoint.d.ts | 2 + .../entities/lib/decode_codepoint.d.ts.map | 2 +- node_modules/entities/lib/decode_codepoint.js | 78 +- node_modules/entities/lib/encode.d.ts | 53 +- node_modules/entities/lib/encode.d.ts.map | 2 +- node_modules/entities/lib/encode.js | 177 +- node_modules/entities/lib/index.d.ts | 97 +- node_modules/entities/lib/index.d.ts.map | 2 +- node_modules/entities/lib/index.js | 144 +- node_modules/entities/lib/maps/decode.json | 1 - node_modules/entities/lib/maps/entities.json | 1 - node_modules/entities/lib/maps/legacy.json | 1 - node_modules/entities/lib/maps/xml.json | 1 - node_modules/entities/package.json | 181 +- node_modules/entities/readme.md | 89 +- node_modules/htmlparser2/README.md | 34 +- .../htmlparser2/lib/CollectingHandler.d.ts | 10 - .../lib/CollectingHandler.d.ts.map | 1 - .../htmlparser2/lib/CollectingHandler.js | 60 - node_modules/htmlparser2/lib/FeedHandler.d.ts | 67 - .../htmlparser2/lib/FeedHandler.d.ts.map | 1 - node_modules/htmlparser2/lib/FeedHandler.js | 235 -- .../htmlparser2/lib/MultiplexHandler.d.ts | 28 - .../htmlparser2/lib/MultiplexHandler.d.ts.map | 1 - .../htmlparser2/lib/MultiplexHandler.js | 57 - node_modules/htmlparser2/lib/Parser.d.ts | 73 +- node_modules/htmlparser2/lib/Parser.d.ts.map | 2 +- node_modules/htmlparser2/lib/Parser.js | 421 ++- node_modules/htmlparser2/lib/Tokenizer.d.ts | 189 +- .../htmlparser2/lib/Tokenizer.d.ts.map | 2 +- node_modules/htmlparser2/lib/Tokenizer.js | 1325 ++++---- .../htmlparser2/lib/WritableStream.d.ts | 2 +- .../htmlparser2/lib/WritableStream.d.ts.map | 2 +- .../htmlparser2/lib/WritableStream.js | 5 +- node_modules/htmlparser2/lib/index.d.ts | 25 +- node_modules/htmlparser2/lib/index.d.ts.map | 2 +- node_modules/htmlparser2/lib/index.js | 44 +- node_modules/htmlparser2/package.json | 190 +- node_modules/nth-check/README.md | 58 +- node_modules/nth-check/lib/compile.d.ts | 36 + node_modules/nth-check/lib/compile.d.ts.map | 2 +- node_modules/nth-check/lib/compile.js | 74 +- node_modules/nth-check/lib/index.d.ts | 39 +- node_modules/nth-check/lib/index.d.ts.map | 2 +- node_modules/nth-check/lib/index.js | 50 +- node_modules/nth-check/lib/parse.d.ts.map | 2 +- node_modules/nth-check/lib/parse.js | 3 +- node_modules/nth-check/package.json | 167 +- .../parse5-htmlparser2-tree-adapter/README.md | 4 +- .../lib/index.js | 348 -- .../package.json | 92 +- node_modules/parse5/README.md | 4 +- node_modules/parse5/lib/common/doctype.js | 162 - node_modules/parse5/lib/common/error-codes.js | 65 - .../parse5/lib/common/foreign-content.js | 265 -- node_modules/parse5/lib/common/html.js | 272 -- node_modules/parse5/lib/common/unicode.js | 109 - .../extensions/error-reporting/mixin-base.js | 43 - .../error-reporting/parser-mixin.js | 52 - .../error-reporting/preprocessor-mixin.js | 24 - .../error-reporting/tokenizer-mixin.js | 17 - .../location-info/open-element-stack-mixin.js | 35 - .../extensions/location-info/parser-mixin.js | 223 -- .../location-info/tokenizer-mixin.js | 146 - .../position-tracking/preprocessor-mixin.js | 64 - node_modules/parse5/lib/index.js | 29 - .../lib/parser/formatting-element-list.js | 181 - node_modules/parse5/lib/parser/index.js | 2956 ----------------- .../parse5/lib/parser/open-element-stack.js | 482 --- node_modules/parse5/lib/serializer/index.js | 176 - node_modules/parse5/lib/tokenizer/index.js | 2196 ------------ .../parse5/lib/tokenizer/named-entity-data.js | 5 - .../parse5/lib/tokenizer/preprocessor.js | 159 - .../parse5/lib/tree-adapters/default.js | 221 -- .../parse5/lib/utils/merge-options.js | 13 - node_modules/parse5/lib/utils/mixin.js | 39 - node_modules/parse5/package.json | 112 +- node_modules/tslib/CopyrightNotice.txt | 15 - node_modules/tslib/LICENSE.txt | 12 - node_modules/tslib/README.md | 164 - node_modules/tslib/modules/index.js | 53 - node_modules/tslib/modules/package.json | 3 - node_modules/tslib/package.json | 64 - node_modules/tslib/tslib.d.ts | 130 - node_modules/tslib/tslib.es6.html | 1 - node_modules/tslib/tslib.es6.js | 239 -- node_modules/tslib/tslib.html | 1 - node_modules/tslib/tslib.js | 306 -- package-lock.json | 305 +- website/data/boundaries.topo.json | 2 +- 241 files changed, 5568 insertions(+), 14575 deletions(-) delete mode 100644 node_modules/cheerio/lib/parsers/htmlparser2-adapter.d.ts delete mode 100644 node_modules/cheerio/lib/parsers/htmlparser2-adapter.d.ts.map delete mode 100644 node_modules/cheerio/lib/parsers/htmlparser2-adapter.js delete mode 100644 node_modules/css-select/lib/procedure.d.ts delete mode 100644 node_modules/css-select/lib/procedure.d.ts.map delete mode 100644 node_modules/css-select/lib/procedure.js delete mode 100644 node_modules/css-what/lib/index.d.ts delete mode 100644 node_modules/css-what/lib/index.d.ts.map delete mode 100644 node_modules/css-what/lib/index.js delete mode 100644 node_modules/css-what/lib/parse.d.ts delete mode 100644 node_modules/css-what/lib/parse.d.ts.map delete mode 100644 node_modules/css-what/lib/parse.js delete mode 100644 node_modules/css-what/lib/stringify.d.ts delete mode 100644 node_modules/css-what/lib/stringify.d.ts.map delete mode 100644 node_modules/css-what/lib/stringify.js delete mode 100644 node_modules/entities/lib/maps/decode.json delete mode 100644 node_modules/entities/lib/maps/entities.json delete mode 100644 node_modules/entities/lib/maps/legacy.json delete mode 100644 node_modules/entities/lib/maps/xml.json delete mode 100644 node_modules/htmlparser2/lib/CollectingHandler.d.ts delete mode 100644 node_modules/htmlparser2/lib/CollectingHandler.d.ts.map delete mode 100644 node_modules/htmlparser2/lib/CollectingHandler.js delete mode 100644 node_modules/htmlparser2/lib/FeedHandler.d.ts delete mode 100644 node_modules/htmlparser2/lib/FeedHandler.d.ts.map delete mode 100644 node_modules/htmlparser2/lib/FeedHandler.js delete mode 100644 node_modules/htmlparser2/lib/MultiplexHandler.d.ts delete mode 100644 node_modules/htmlparser2/lib/MultiplexHandler.d.ts.map delete mode 100644 node_modules/htmlparser2/lib/MultiplexHandler.js delete mode 100644 node_modules/parse5-htmlparser2-tree-adapter/lib/index.js delete mode 100644 node_modules/parse5/lib/common/doctype.js delete mode 100644 node_modules/parse5/lib/common/error-codes.js delete mode 100644 node_modules/parse5/lib/common/foreign-content.js delete mode 100644 node_modules/parse5/lib/common/html.js delete mode 100644 node_modules/parse5/lib/common/unicode.js delete mode 100644 node_modules/parse5/lib/extensions/error-reporting/mixin-base.js delete mode 100644 node_modules/parse5/lib/extensions/error-reporting/parser-mixin.js delete mode 100644 node_modules/parse5/lib/extensions/error-reporting/preprocessor-mixin.js delete mode 100644 node_modules/parse5/lib/extensions/error-reporting/tokenizer-mixin.js delete mode 100644 node_modules/parse5/lib/extensions/location-info/open-element-stack-mixin.js delete mode 100644 node_modules/parse5/lib/extensions/location-info/parser-mixin.js delete mode 100644 node_modules/parse5/lib/extensions/location-info/tokenizer-mixin.js delete mode 100644 node_modules/parse5/lib/extensions/position-tracking/preprocessor-mixin.js delete mode 100644 node_modules/parse5/lib/index.js delete mode 100644 node_modules/parse5/lib/parser/formatting-element-list.js delete mode 100644 node_modules/parse5/lib/parser/index.js delete mode 100644 node_modules/parse5/lib/parser/open-element-stack.js delete mode 100644 node_modules/parse5/lib/serializer/index.js delete mode 100644 node_modules/parse5/lib/tokenizer/index.js delete mode 100644 node_modules/parse5/lib/tokenizer/named-entity-data.js delete mode 100644 node_modules/parse5/lib/tokenizer/preprocessor.js delete mode 100644 node_modules/parse5/lib/tree-adapters/default.js delete mode 100644 node_modules/parse5/lib/utils/merge-options.js delete mode 100644 node_modules/parse5/lib/utils/mixin.js delete mode 100644 node_modules/tslib/CopyrightNotice.txt delete mode 100644 node_modules/tslib/LICENSE.txt delete mode 100644 node_modules/tslib/README.md delete mode 100644 node_modules/tslib/modules/index.js delete mode 100644 node_modules/tslib/modules/package.json delete mode 100644 node_modules/tslib/package.json delete mode 100644 node_modules/tslib/tslib.d.ts delete mode 100644 node_modules/tslib/tslib.es6.html delete mode 100644 node_modules/tslib/tslib.es6.js delete mode 100644 node_modules/tslib/tslib.html delete mode 100644 node_modules/tslib/tslib.js diff --git a/node_modules/boolbase/package.json b/node_modules/boolbase/package.json index 350b673..78330a8 100644 --- a/node_modules/boolbase/package.json +++ b/node_modules/boolbase/package.json @@ -1,52 +1,23 @@ { - "_from": "boolbase@^1.0.0", - "_id": "boolbase@1.0.0", - "_inBundle": false, - "_integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", - "_location": "/boolbase", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "boolbase@^1.0.0", - "name": "boolbase", - "escapedName": "boolbase", - "rawSpec": "^1.0.0", - "saveSpec": null, - "fetchSpec": "^1.0.0" - }, - "_requiredBy": [ - "/css-select", - "/nth-check" - ], - "_resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", - "_shasum": "68dff5fbe60c51eb37725ea9e3ed310dcc1e776e", - "_spec": "boolbase@^1.0.0", - "_where": "/home/runner/work/public_library_map/public_library_map/node_modules/css-select", - "author": { - "name": "Felix Boehm", - "email": "me@feedic.com" - }, - "bugs": { - "url": "https://github.com/fb55/boolbase/issues" - }, - "bundleDependencies": false, - "deprecated": false, + "name": "boolbase", + "version": "1.0.0", "description": "two functions: One that returns true, one that returns false", - "homepage": "https://github.com/fb55/boolbase", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/fb55/boolbase" + }, "keywords": [ "boolean", "function" ], + "author": "Felix Boehm ", "license": "ISC", - "main": "index.js", - "name": "boolbase", - "repository": { - "type": "git", - "url": "git+https://github.com/fb55/boolbase.git" + "bugs": { + "url": "https://github.com/fb55/boolbase/issues" }, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "version": "1.0.0" + "homepage": "https://github.com/fb55/boolbase" } diff --git a/node_modules/cheerio-select/lib/helpers.d.ts b/node_modules/cheerio-select/lib/helpers.d.ts index 4e9a298..13dba26 100644 --- a/node_modules/cheerio-select/lib/helpers.d.ts +++ b/node_modules/cheerio-select/lib/helpers.d.ts @@ -1,5 +1,5 @@ -import type { Node } from "domhandler"; +import type { AnyNode } from "domhandler"; import type { Selector } from "css-what"; -export declare function getDocumentRoot(node: Node): Node; +export declare function getDocumentRoot(node: AnyNode): AnyNode; export declare function groupSelectors(selectors: Selector[][]): [plain: Selector[][], filtered: Selector[][]]; //# sourceMappingURL=helpers.d.ts.map \ No newline at end of file diff --git a/node_modules/cheerio-select/lib/helpers.d.ts.map b/node_modules/cheerio-select/lib/helpers.d.ts.map index 43d0e80..689bf8d 100644 --- a/node_modules/cheerio-select/lib/helpers.d.ts.map +++ b/node_modules/cheerio-select/lib/helpers.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGzC,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAGhD;AAED,wBAAgB,cAAc,CAC1B,SAAS,EAAE,QAAQ,EAAE,EAAE,GACxB,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,CAAC,CAa/C"} \ No newline at end of file +{"version":3,"file":"helpers.d.ts","sourceRoot":"https://raw.githubusercontent.com/cheeriojs/cheerio-select/ef063a6ca4c3f0d02d2fc3505e750b6fb81c448d/src/","sources":["helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGzC,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAGtD;AAED,wBAAgB,cAAc,CAC1B,SAAS,EAAE,QAAQ,EAAE,EAAE,GACxB,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,CAAC,CAa/C"} \ No newline at end of file diff --git a/node_modules/cheerio-select/lib/helpers.js b/node_modules/cheerio-select/lib/helpers.js index 1954691..f996a6c 100644 --- a/node_modules/cheerio-select/lib/helpers.js +++ b/node_modules/cheerio-select/lib/helpers.js @@ -1,7 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.groupSelectors = exports.getDocumentRoot = void 0; -var positionals_1 = require("./positionals"); +var positionals_js_1 = require("./positionals.js"); function getDocumentRoot(node) { while (node.parent) node = node.parent; @@ -13,7 +13,7 @@ function groupSelectors(selectors) { var plainSelectors = []; for (var _i = 0, selectors_1 = selectors; _i < selectors_1.length; _i++) { var selector = selectors_1[_i]; - if (selector.some(positionals_1.isFilter)) { + if (selector.some(positionals_js_1.isFilter)) { filteredSelectors.push(selector); } else { @@ -23,3 +23,4 @@ function groupSelectors(selectors) { return [plainSelectors, filteredSelectors]; } exports.groupSelectors = groupSelectors; +//# sourceMappingURL=helpers.js.map \ No newline at end of file diff --git a/node_modules/cheerio-select/lib/index.d.ts b/node_modules/cheerio-select/lib/index.d.ts index 4ecf774..9b6baff 100644 --- a/node_modules/cheerio-select/lib/index.d.ts +++ b/node_modules/cheerio-select/lib/index.d.ts @@ -1,12 +1,12 @@ -import { Options as CSSSelectOptions } from "css-select"; -import type { Element, Node, Document } from "domhandler"; +import { type Options as CSSSelectOptions } from "css-select"; +import type { Element, AnyNode, Document } from "domhandler"; export { filters, pseudos, aliases } from "css-select"; -export interface Options extends CSSSelectOptions { +export interface Options extends CSSSelectOptions { /** Optional reference to the root of the document. If not set, this will be computed when needed. */ root?: Document; } export declare function is(element: Element, selector: string | ((el: Element) => boolean), options?: Options): boolean; export declare function some(elements: Element[], selector: string | ((el: Element) => boolean), options?: Options): boolean; -export declare function filter(selector: string, elements: Node[], options?: Options): Element[]; -export declare function select(selector: string | ((el: Element) => boolean), root: Node | Node[], options?: Options): Element[]; +export declare function filter(selector: string, elements: AnyNode[], options?: Options): Element[]; +export declare function select(selector: string | ((el: Element) => boolean), root: AnyNode | AnyNode[], options?: Options, limit?: number): Element[]; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/cheerio-select/lib/index.d.ts.map b/node_modules/cheerio-select/lib/index.d.ts.map index c53a9da..4127f83 100644 --- a/node_modules/cheerio-select/lib/index.d.ts.map +++ b/node_modules/cheerio-select/lib/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEH,OAAO,IAAI,gBAAgB,EAE9B,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAK1D,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAYvD,MAAM,WAAW,OAAQ,SAAQ,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC;IAC5D,qGAAqG;IACrG,IAAI,CAAC,EAAE,QAAQ,CAAC;CACnB;AAED,wBAAgB,EAAE,CACd,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,OAAO,KAAK,OAAO,CAAC,EAC7C,OAAO,GAAE,OAAY,GACtB,OAAO,CAET;AAED,wBAAgB,IAAI,CAChB,QAAQ,EAAE,OAAO,EAAE,EACnB,QAAQ,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,OAAO,KAAK,OAAO,CAAC,EAC7C,OAAO,GAAE,OAAY,GACtB,OAAO,CAWT;AAsCD,wBAAgB,MAAM,CAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,IAAI,EAAE,EAChB,OAAO,GAAE,OAAY,GACtB,OAAO,EAAE,CAEX;AA6FD,wBAAgB,MAAM,CAClB,QAAQ,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,OAAO,KAAK,OAAO,CAAC,EAC7C,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,EACnB,OAAO,GAAE,OAAY,GACtB,OAAO,EAAE,CAuBX"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"https://raw.githubusercontent.com/cheeriojs/cheerio-select/ef063a6ca4c3f0d02d2fc3505e750b6fb81c448d/src/","sources":["index.ts"],"names":[],"mappings":"AACA,OAAO,EAEH,KAAK,OAAO,IAAI,gBAAgB,EAEnC,MAAM,YAAY,CAAC;AAGpB,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAU7D,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAYvD,MAAM,WAAW,OAAQ,SAAQ,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC;IAC/D,qGAAqG;IACrG,IAAI,CAAC,EAAE,QAAQ,CAAC;CACnB;AAED,wBAAgB,EAAE,CACd,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,OAAO,KAAK,OAAO,CAAC,EAC7C,OAAO,GAAE,OAAY,GACtB,OAAO,CAET;AAED,wBAAgB,IAAI,CAChB,QAAQ,EAAE,OAAO,EAAE,EACnB,QAAQ,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,OAAO,KAAK,OAAO,CAAC,EAC7C,OAAO,GAAE,OAAY,GACtB,OAAO,CAWT;AAsCD,wBAAgB,MAAM,CAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,OAAO,EAAE,EACnB,OAAO,GAAE,OAAY,GACtB,OAAO,EAAE,CAEX;AAoGD,wBAAgB,MAAM,CAClB,QAAQ,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,OAAO,KAAK,OAAO,CAAC,EAC7C,IAAI,EAAE,OAAO,GAAG,OAAO,EAAE,EACzB,OAAO,GAAE,OAAY,EACrB,KAAK,SAAW,GACjB,OAAO,EAAE,CA2BX"} \ No newline at end of file diff --git a/node_modules/cheerio-select/lib/index.js b/node_modules/cheerio-select/lib/index.js index facd2ba..9366d71 100644 --- a/node_modules/cheerio-select/lib/index.js +++ b/node_modules/cheerio-select/lib/index.js @@ -12,7 +12,11 @@ var __assign = (this && this.__assign) || function () { }; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; @@ -29,32 +33,37 @@ var __importStar = (this && this.__importStar) || function (mod) { __setModuleDefault(result, mod); return result; }; -var __spreadArray = (this && this.__spreadArray) || function (to, from) { - for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) - to[j] = from[i]; - return to; +var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.select = exports.filter = exports.some = exports.is = exports.aliases = exports.pseudos = exports.filters = void 0; var css_what_1 = require("css-what"); var css_select_1 = require("css-select"); var DomUtils = __importStar(require("domutils")); -var helpers_1 = require("./helpers"); -var positionals_1 = require("./positionals"); +var boolbase = __importStar(require("boolbase")); +var helpers_js_1 = require("./helpers.js"); +var positionals_js_1 = require("./positionals.js"); // Re-export pseudo extension points var css_select_2 = require("css-select"); Object.defineProperty(exports, "filters", { enumerable: true, get: function () { return css_select_2.filters; } }); Object.defineProperty(exports, "pseudos", { enumerable: true, get: function () { return css_select_2.pseudos; } }); Object.defineProperty(exports, "aliases", { enumerable: true, get: function () { return css_select_2.aliases; } }); -/** Used to indicate a scope should be filtered. Might be ignored when filtering. */ +var UNIVERSAL_SELECTOR = { + type: css_what_1.SelectorType.Universal, + namespace: null, +}; var SCOPE_PSEUDO = { - type: "pseudo", + type: css_what_1.SelectorType.Pseudo, name: "scope", data: null, }; -/** Used for actually filtering for scope. */ -var CUSTOM_SCOPE_PSEUDO = __assign({}, SCOPE_PSEUDO); -var UNIVERSAL_SELECTOR = { type: "universal", namespace: null }; function is(element, selector, options) { if (options === void 0) { options = {}; } return some([element], selector, options); @@ -64,8 +73,8 @@ function some(elements, selector, options) { if (options === void 0) { options = {}; } if (typeof selector === "function") return elements.some(selector); - var _a = helpers_1.groupSelectors(css_what_1.parse(selector, options)), plain = _a[0], filtered = _a[1]; - return ((plain.length > 0 && elements.some(css_select_1._compileToken(plain, options))) || + var _a = (0, helpers_js_1.groupSelectors)((0, css_what_1.parse)(selector)), plain = _a[0], filtered = _a[1]; + return ((plain.length > 0 && elements.some((0, css_select_1._compileToken)(plain, options))) || filtered.some(function (sel) { return filterBySelector(sel, elements, options).length > 0; })); } exports.some = some; @@ -97,7 +106,7 @@ function filterByPosition(filter, elems, data, options) { } function filter(selector, elements, options) { if (options === void 0) { options = {}; } - return filterParsed(css_what_1.parse(selector, options), elements, options); + return filterParsed((0, css_what_1.parse)(selector), elements, options); } exports.filter = filter; /** @@ -112,7 +121,7 @@ exports.filter = filter; function filterParsed(selector, elements, options) { if (elements.length === 0) return []; - var _a = helpers_1.groupSelectors(selector), plainSelectors = _a[0], filteredSelectors = _a[1]; + var _a = (0, helpers_js_1.groupSelectors)(selector), plainSelectors = _a[0], filteredSelectors = _a[1]; var found; if (plainSelectors.length) { var filtered = filterElements(elements, plainSelectors, options); @@ -165,78 +174,70 @@ function filterBySelector(selector, elements, options) { * Get root node, run selector with the scope * set to all of our nodes. */ - var root = (_a = options.root) !== null && _a !== void 0 ? _a : helpers_1.getDocumentRoot(elements[0]); - var sel = __spreadArray(__spreadArray([], selector), [CUSTOM_SCOPE_PSEUDO]); - return findFilterElements(root, sel, options, true, elements); + var root = (_a = options.root) !== null && _a !== void 0 ? _a : (0, helpers_js_1.getDocumentRoot)(elements[0]); + var opts = __assign(__assign({}, options), { context: elements, relativeSelector: false }); + selector.push(SCOPE_PSEUDO); + return findFilterElements(root, selector, opts, true, elements.length); } // Performance optimization: If we don't have to traverse, just filter set. - return findFilterElements(elements, selector, options, false); + return findFilterElements(elements, selector, options, false, elements.length); } -function select(selector, root, options) { +function select(selector, root, options, limit) { if (options === void 0) { options = {}; } + if (limit === void 0) { limit = Infinity; } if (typeof selector === "function") { return find(root, selector); } - var _a = helpers_1.groupSelectors(css_what_1.parse(selector, options)), plain = _a[0], filtered = _a[1]; + var _a = (0, helpers_js_1.groupSelectors)((0, css_what_1.parse)(selector)), plain = _a[0], filtered = _a[1]; var results = filtered.map(function (sel) { - return findFilterElements(root, sel, options, true); + return findFilterElements(root, sel, options, true, limit); }); // Plain selectors can be queried in a single go if (plain.length) { - results.push(findElements(root, plain, options, Infinity)); + results.push(findElements(root, plain, options, limit)); + } + if (results.length === 0) { + return []; } // If there was only a single selector, just return the result if (results.length === 1) { return results[0]; } // Sort results, filtering for duplicates - return DomUtils.uniqueSort(results.reduce(function (a, b) { return __spreadArray(__spreadArray([], a), b); })); + return DomUtils.uniqueSort(results.reduce(function (a, b) { return __spreadArray(__spreadArray([], a, true), b, true); })); } exports.select = select; -// Traversals that are treated differently in css-select. -var specialTraversal = new Set(["descendant", "adjacent"]); -function includesScopePseudo(t) { - return (t !== SCOPE_PSEUDO && - t.type === "pseudo" && - (t.name === "scope" || - (Array.isArray(t.data) && - t.data.some(function (data) { return data.some(includesScopePseudo); })))); -} -function addContextIfScope(selector, options, scopeContext) { - return scopeContext && selector.some(includesScopePseudo) - ? __assign(__assign({}, options), { context: scopeContext }) : options; -} /** * * @param root Element(s) to search from. * @param selector Selector to look for. * @param options Options for querying. * @param queryForSelector Query multiple levels deep for the initial selector, even if it doesn't contain a traversal. - * @param scopeContext Optional context for a :scope. */ -function findFilterElements(root, selector, options, queryForSelector, scopeContext) { - var filterIndex = selector.findIndex(positionals_1.isFilter); +function findFilterElements(root, selector, options, queryForSelector, totalLimit) { + var filterIndex = selector.findIndex(positionals_js_1.isFilter); var sub = selector.slice(0, filterIndex); var filter = selector[filterIndex]; + // If we are at the end of the selector, we can limit the number of elements to retrieve. + var partLimit = selector.length - 1 === filterIndex ? totalLimit : Infinity; /* * Set the number of elements to retrieve. * Eg. for :first, we only have to get a single element. */ - var limit = positionals_1.getLimit(filter.name, filter.data); + var limit = (0, positionals_js_1.getLimit)(filter.name, filter.data, partLimit); if (limit === 0) return []; - var subOpts = addContextIfScope(sub, options, scopeContext); /* * Skip `findElements` call if our selector starts with a positional * pseudo. */ var elemsNoLimit = sub.length === 0 && !Array.isArray(root) ? DomUtils.getChildren(root).filter(DomUtils.isTag) - : sub.length === 0 || (sub.length === 1 && sub[0] === SCOPE_PSEUDO) + : sub.length === 0 ? (Array.isArray(root) ? root : [root]).filter(DomUtils.isTag) : queryForSelector || sub.some(css_what_1.isTraversal) - ? findElements(root, [sub], subOpts, limit) - : filterElements(root, [sub], subOpts); + ? findElements(root, [sub], options, limit) + : filterElements(root, [sub], options); var elems = elemsNoLimit.slice(0, limit); var result = filterByPosition(filter.name, elems, filter.data, options); if (result.length === 0 || selector.length === filterIndex + 1) { @@ -244,22 +245,28 @@ function findFilterElements(root, selector, options, queryForSelector, scopeCont } var remainingSelector = selector.slice(filterIndex + 1); var remainingHasTraversal = remainingSelector.some(css_what_1.isTraversal); - var remainingOpts = addContextIfScope(remainingSelector, options, scopeContext); if (remainingHasTraversal) { - /* - * Some types of traversals have special logic when they start a selector - * in css-select. If this is the case, add a universal selector in front of - * the selector to avoid this behavior. - */ - if (specialTraversal.has(remainingSelector[0].type)) { + if ((0, css_what_1.isTraversal)(remainingSelector[0])) { + var type = remainingSelector[0].type; + if (type === css_what_1.SelectorType.Sibling || + type === css_what_1.SelectorType.Adjacent) { + // If we have a sibling traversal, we need to also look at the siblings. + result = (0, css_select_1.prepareContext)(result, DomUtils, true); + } + // Avoid a traversal-first selector error. remainingSelector.unshift(UNIVERSAL_SELECTOR); } - /* - * Add a scope token in front of the remaining selector, - * to make sure traversals don't match elements that aren't a - * part of the considered tree. - */ - remainingSelector.unshift(SCOPE_PSEUDO); + options = __assign(__assign({}, options), { + // Avoid absolutizing the selector + relativeSelector: false, + /* + * Add a custom root func, to make sure traversals don't match elements + * that aren't a part of the considered tree. + */ + rootFunc: function (el) { return result.includes(el); } }); + } + else if (options.rootFunc && options.rootFunc !== boolbase.trueFunc) { + options = __assign(__assign({}, options), { rootFunc: boolbase.trueFunc }); } /* * If we have another filter, recursively call `findFilterElements`, @@ -268,29 +275,28 @@ function findFilterElements(root, selector, options, queryForSelector, scopeCont * * Otherwise, */ - return remainingSelector.some(positionals_1.isFilter) - ? findFilterElements(result, remainingSelector, options, false, scopeContext) + return remainingSelector.some(positionals_js_1.isFilter) + ? findFilterElements(result, remainingSelector, options, false, totalLimit) : remainingHasTraversal ? // Query existing elements to resolve traversal. - findElements(result, [remainingSelector], remainingOpts, Infinity) + findElements(result, [remainingSelector], options, totalLimit) : // If we don't have any more traversals, simply filter elements. - filterElements(result, [remainingSelector], remainingOpts); + filterElements(result, [remainingSelector], options); } function findElements(root, sel, options, limit) { - if (limit === 0) - return []; - var query = css_select_1._compileToken(sel, options, root); + var query = (0, css_select_1._compileToken)(sel, options, root); return find(root, query, limit); } function find(root, query, limit) { if (limit === void 0) { limit = Infinity; } - var elems = css_select_1.prepareContext(root, DomUtils, query.shouldTestNextSiblings); + var elems = (0, css_select_1.prepareContext)(root, DomUtils, query.shouldTestNextSiblings); return DomUtils.find(function (node) { return DomUtils.isTag(node) && query(node); }, elems, true, limit); } function filterElements(elements, sel, options) { var els = (Array.isArray(elements) ? elements : [elements]).filter(DomUtils.isTag); if (els.length === 0) return els; - var query = css_select_1._compileToken(sel, options); - return els.filter(query); + var query = (0, css_select_1._compileToken)(sel, options); + return query === boolbase.trueFunc ? els : els.filter(query); } +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/cheerio-select/lib/positionals.d.ts b/node_modules/cheerio-select/lib/positionals.d.ts index 9e581d3..5315dd3 100644 --- a/node_modules/cheerio-select/lib/positionals.d.ts +++ b/node_modules/cheerio-select/lib/positionals.d.ts @@ -6,5 +6,5 @@ export interface CheerioSelector extends PseudoSelector { data: string | null; } export declare function isFilter(s: Selector): s is CheerioSelector; -export declare function getLimit(filter: Filter, data: string | null): number; +export declare function getLimit(filter: Filter, data: string | null, partLimit: number): number; //# sourceMappingURL=positionals.d.ts.map \ No newline at end of file diff --git a/node_modules/cheerio-select/lib/positionals.d.ts.map b/node_modules/cheerio-select/lib/positionals.d.ts.map index 0d755cc..0e0db37 100644 --- a/node_modules/cheerio-select/lib/positionals.d.ts.map +++ b/node_modules/cheerio-select/lib/positionals.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"positionals.d.ts","sourceRoot":"","sources":["../src/positionals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEzD,oBAAY,MAAM,GACZ,OAAO,GACP,MAAM,GACN,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,IAAI,GACJ,MAAM,GACN,KAAK,GACL,KAAK,CAAC;AACZ,eAAO,MAAM,WAAW,EAAE,GAAG,CAAC,MAAM,CASlC,CAAC;AAEH,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,QAAQ,GAAG,CAAC,IAAI,eAAe,CAS1D;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAgBpE"} \ No newline at end of file +{"version":3,"file":"positionals.d.ts","sourceRoot":"https://raw.githubusercontent.com/cheeriojs/cheerio-select/ef063a6ca4c3f0d02d2fc3505e750b6fb81c448d/src/","sources":["positionals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEzD,oBAAY,MAAM,GACZ,OAAO,GACP,MAAM,GACN,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,IAAI,GACJ,MAAM,GACN,KAAK,GACL,KAAK,CAAC;AACZ,eAAO,MAAM,WAAW,EAAE,GAAG,CAAC,MAAM,CASlC,CAAC;AAEH,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,QAAQ,GAAG,CAAC,IAAI,eAAe,CAS1D;AAED,wBAAgB,QAAQ,CACpB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,SAAS,EAAE,MAAM,GAClB,MAAM,CAyBR"} \ No newline at end of file diff --git a/node_modules/cheerio-select/lib/positionals.js b/node_modules/cheerio-select/lib/positionals.js index a2ccaa7..754bb25 100644 --- a/node_modules/cheerio-select/lib/positionals.js +++ b/node_modules/cheerio-select/lib/positionals.js @@ -23,7 +23,7 @@ function isFilter(s) { return false; } exports.isFilter = isFilter; -function getLimit(filter, data) { +function getLimit(filter, data, partLimit) { var num = data != null ? parseInt(data, 10) : NaN; switch (filter) { case "first": @@ -32,11 +32,21 @@ function getLimit(filter, data) { case "eq": return isFinite(num) ? (num >= 0 ? num + 1 : Infinity) : 0; case "lt": - return isFinite(num) ? (num >= 0 ? num : Infinity) : 0; + return isFinite(num) + ? num >= 0 + ? Math.min(num, partLimit) + : Infinity + : 0; case "gt": return isFinite(num) ? Infinity : 0; - default: + case "odd": + return 2 * partLimit; + case "even": + return 2 * partLimit - 1; + case "last": + case "not": return Infinity; } } exports.getLimit = getLimit; +//# sourceMappingURL=positionals.js.map \ No newline at end of file diff --git a/node_modules/cheerio-select/package.json b/node_modules/cheerio-select/package.json index b3ebdfa..96b34cb 100644 --- a/node_modules/cheerio-select/package.json +++ b/node_modules/cheerio-select/package.json @@ -1,95 +1,76 @@ { - "_from": "cheerio-select@^1.5.0", - "_id": "cheerio-select@1.5.0", - "_inBundle": false, - "_integrity": "sha512-qocaHPv5ypefh6YNxvnbABM07KMxExbtbfuJoIie3iZXX1ERwYmJcIiRrr9H05ucQP1k28dav8rpdDgjQd8drg==", - "_location": "/cheerio-select", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "cheerio-select@^1.5.0", "name": "cheerio-select", - "escapedName": "cheerio-select", - "rawSpec": "^1.5.0", - "saveSpec": null, - "fetchSpec": "^1.5.0" - }, - "_requiredBy": [ - "/cheerio" - ], - "_resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-1.5.0.tgz", - "_shasum": "faf3daeb31b17c5e1a9dabcee288aaf8aafa5823", - "_spec": "cheerio-select@^1.5.0", - "_where": "/home/runner/work/public_library_map/public_library_map/node_modules/cheerio", - "author": { - "name": "Felix Boehm", - "email": "me@feedic.com" - }, - "bugs": { - "url": "https://github.com/cheeriojs/cheerio-select/issues" - }, - "bundleDependencies": false, - "dependencies": { - "css-select": "^4.1.3", - "css-what": "^5.0.1", - "domelementtype": "^2.2.0", - "domhandler": "^4.2.0", - "domutils": "^2.7.0" - }, - "deprecated": false, - "description": "CSS selector engine supporting jQuery selectors", - "devDependencies": { - "@types/jest": "^26.0.23", - "@typescript-eslint/eslint-plugin": "^4.26.0", - "@typescript-eslint/parser": "^4.26.0", - "coveralls": "^3.1.0", - "eslint": "^7.28.0", - "eslint-config-prettier": "^8.3.0", - "htmlparser2": "^6.1.0", - "jest": "^27.0.4", - "prettier": "^2.3.1", - "ts-jest": "^27.0.3", - "typescript": "^4.3.2" - }, - "directories": { - "lib": "lib/" - }, - "files": [ - "lib/**/*" - ], - "funding": { - "url": "https://github.com/sponsors/fb55" - }, - "homepage": "https://github.com/cheeriojs/cheerio-select#readme", - "jest": { - "preset": "ts-jest", - "testEnvironment": "node" - }, - "license": "BSD-2-Clause", - "main": "lib/index.js", - "name": "cheerio-select", - "prettier": { - "tabWidth": 4 - }, - "repository": { - "type": "git", - "url": "git://github.com/cheeriojs/cheerio-select.git" - }, - "scripts": { - "build": "tsc", - "coverage": "cat coverage/lcov.info | coveralls", - "format": "npm run format:es && npm run format:prettier", - "format:es": "npm run lint:es -- --fix", - "format:prettier": "npm run format:prettier:raw -- --write", - "format:prettier:raw": "prettier '**/*.{ts,md,json,yml}'", - "lint": "npm run lint:es && npm run lint:prettier", - "lint:es": "eslint src", - "lint:prettier": "npm run format:prettier:raw -- --check", - "prepare": "npm run build", - "test": "jest --coverage && npm run lint" - }, - "sideEffects": false, - "types": "lib/index.d.ts", - "version": "1.5.0" + "description": "CSS selector engine supporting jQuery selectors", + "version": "2.1.0", + "author": "Felix Boehm ", + "funding": { + "url": "https://github.com/sponsors/fb55" + }, + "license": "BSD-2-Clause", + "sideEffects": false, + "repository": { + "type": "git", + "url": "git://github.com/cheeriojs/cheerio-select.git" + }, + "directories": { + "lib": "lib/" + }, + "main": "lib/index.js", + "types": "lib/index.d.ts", + "module": "lib/esm/index.js", + "exports": { + "require": "./lib/index.js", + "import": "./lib/esm/index.js" + }, + "files": [ + "lib/**/*" + ], + "scripts": { + "test": "npm run test:jest && npm run lint", + "test:jest": "jest", + "lint": "npm run lint:es && npm run lint:prettier", + "lint:es": "eslint src", + "lint:prettier": "npm run format:prettier:raw -- --check", + "format": "npm run format:es && npm run format:prettier", + "format:es": "npm run lint:es -- --fix", + "format:prettier": "npm run format:prettier:raw -- --write", + "format:prettier:raw": "prettier '**/*.{ts,md,json,yml}'", + "build": "npm run build:cjs && npm run build:esm", + "build:cjs": "tsc --sourceRoot https://raw.githubusercontent.com/cheeriojs/cheerio-select/$(git rev-parse HEAD)/src/", + "build:esm": "npm run build:cjs -- --module esnext --target es2019 --outDir lib/esm && echo '{\"type\":\"module\"}' > lib/esm/package.json", + "prepare": "npm run build" + }, + "dependencies": { + "boolbase": "^1.0.0", + "css-select": "^5.1.0", + "css-what": "^6.1.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3", + "domutils": "^3.0.1" + }, + "devDependencies": { + "@types/boolbase": "^1.0.1", + "@types/jest": "^27.5.0", + "@types/node": "^17.0.33", + "@typescript-eslint/eslint-plugin": "^5.23.0", + "@typescript-eslint/parser": "^5.23.0", + "eslint": "^8.15.0", + "eslint-config-prettier": "^8.5.0", + "htmlparser2": "^8.0.1", + "jest": "^27.5.1", + "prettier": "^2.6.2", + "ts-jest": "^27.1.4", + "typescript": "^4.6.4" + }, + "jest": { + "preset": "ts-jest", + "testEnvironment": "node", + "coverageProvider": "v8", + "moduleNameMapper": { + "^(.*)\\.js$": "$1" + } + }, + "prettier": { + "tabWidth": 4 + } } diff --git a/node_modules/cheerio/LICENSE b/node_modules/cheerio/LICENSE index 40b9100..b0c8b19 100644 --- a/node_modules/cheerio/LICENSE +++ b/node_modules/cheerio/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2016 Matt Mueller +Copyright (c) 2022 The Cheerio contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE. diff --git a/node_modules/cheerio/Readme.md b/node_modules/cheerio/Readme.md index 449d371..2fba04f 100644 --- a/node_modules/cheerio/Readme.md +++ b/node_modules/cheerio/Readme.md @@ -53,7 +53,7 @@ Cheerio wraps around [parse5](https://github.com/inikulin/parse5) parser and can ## Cheerio is not a web browser -Cheerio parses markup and provides an API for traversing/manipulating the resulting data structure. It does not interpret the result as a web browser does. Specifically, it does _not_ produce a visual rendering, apply CSS, load external resources, or execute JavaScript. This makes Cheerio **much, much faster than other solutions**. If your use case requires any of this functionality, you should consider projects like [Puppeteer](https://github.com/puppeteer/puppeteer) or [JSDom](https://github.com/jsdom/jsdom). +Cheerio parses markup and provides an API for traversing/manipulating the resulting data structure. It does not interpret the result as a web browser does. Specifically, it does _not_ produce a visual rendering, apply CSS, load external resources, or execute JavaScript which is common for a SPA (single page application). This makes Cheerio **much, much faster than other solutions**. If your use case requires any of this functionality, you should consider browser automation software like [Puppeteer](https://github.com/puppeteer/puppeteer) and [Playwright](https://github.com/microsoft/playwright) or DOM emulation projects like [JSDom](https://github.com/jsdom/jsdom). ## API @@ -134,6 +134,11 @@ The options in the `xml` object are taken directly from [htmlparser2](https://gi For a full list of options and their effects, see [domhandler](https://github.com/fb55/DomHandler) and [htmlparser2's options](https://github.com/fb55/htmlparser2/wiki/Parser-options). +#### Using `htmlparser2` + +Cheerio ships with two parsers, `parse5` and `htmlparser2`. The +former is the default for HTML, the latter the default for XML. + Some users may wish to parse markup with the `htmlparser2` library, and traverse/manipulate the resulting structure with Cheerio. This may be the case for those upgrading from pre-1.0 releases of Cheerio (which relied on @@ -156,6 +161,13 @@ const dom = htmlparser2.parseDocument(document, options); const $ = cheerio.load(dom); ``` +If you want to save some bytes, you can use Cheerio's _slim_ export, which +always uses `htmlparser2`: + +```js +const cheerio = require('cheerio/lib/slim'); +``` + ### Selectors Cheerio's selector implementation is nearly identical to jQuery's, so the API is very similar. @@ -210,21 +222,6 @@ cheerio.html($('.pear')); //=>
  • Pear
  • ``` -By default, `html` will leave some tags open. Sometimes you may instead want to render a valid XML document. For example, you might parse the following XML snippet: - -```js -const $ = cheerio.load( - '' -); -``` - -... and later want to render to XML. To do this, you can use the 'xml' utility function: - -```js -$.xml(); -//=> -``` - You may also render the text content of a Cheerio object using the `text` static method: ```js @@ -246,7 +243,7 @@ $.prototype.logHtml = function () { $('body').logHtml(); // logs "Hello, world!" to the console ``` -If you're using TypeScript, you should also add a type definition for your new method: +If you're using TypeScript, you should add a type definition for your new method: ```ts declare module 'cheerio' { @@ -285,8 +282,30 @@ Does your company use Cheerio in production? Please consider [sponsoring this pr -![Substack](https://avatars.githubusercontent.com/u/53023767?v=4&s=128) -![Airbnb](https://images.opencollective.com/airbnb/d327d66/logo.png) + + GitHub + + + CryptoCasinos + + + Casinoonlineaams.com + + + Casinofiables.com + + + Apify + + + Free Bets + + + Casino utan svensk licens + + + Casino utan svensk licens + @@ -296,8 +315,27 @@ Does your company use Cheerio in production? Please consider [sponsoring this pr -![Espen Klem](https://images.opencollective.com/espenklem/6075b19/avatar.png) -![Nishant Singh](https://avatars.githubusercontent.com/u/10304344?u=9cd1389a1a8211b64979ca3693f96d90f5bf0be9&v=4&s=128) + + Airbnb + + + Vasy Kafidoff + + + Espen Klem + + + Jarrod Davis + + + Nishant Singh + + + Gautham Chandra + + + Charles Severance + diff --git a/node_modules/cheerio/lib/api/attributes.d.ts b/node_modules/cheerio/lib/api/attributes.d.ts index 208b0c7..a310693 100644 --- a/node_modules/cheerio/lib/api/attributes.d.ts +++ b/node_modules/cheerio/lib/api/attributes.d.ts @@ -3,8 +3,8 @@ * * @module cheerio/attributes */ -import type { Node, Element } from 'domhandler'; -import type { Cheerio } from '../cheerio'; +import type { AnyNode, Element } from 'domhandler'; +import type { Cheerio } from '../cheerio.js'; /** * Method for getting attributes. Gets the attribute value for only the first * element in the matched set. @@ -21,7 +21,7 @@ import type { Cheerio } from '../cheerio'; * @returns The attribute's value. * @see {@link https://api.jquery.com/attr/} */ -export declare function attr(this: Cheerio, name: string): string | undefined; +export declare function attr(this: Cheerio, name: string): string | undefined; /** * Method for getting all attributes and their values of the first element in * the matched set. @@ -37,7 +37,7 @@ export declare function attr(this: Cheerio, name: string): st * @returns The attribute's values. * @see {@link https://api.jquery.com/attr/} */ -export declare function attr(this: Cheerio): Record; +export declare function attr(this: Cheerio): Record | undefined; /** * Method for setting attributes. Sets the attribute value for only the first * element in the matched set. If you set an attribute's value to `null`, you @@ -56,7 +56,7 @@ export declare function attr(this: Cheerio): Record(this: Cheerio, name: string, value?: string | null | ((this: Element, i: number, attrib: string) => string | null)): Cheerio; +export declare function attr(this: Cheerio, name: string, value?: string | null | ((this: Element, i: number, attrib: string) => string | null)): Cheerio; /** * Method for setting multiple attributes at once. Sets the attribute value for * only the first element in the matched set. If you set an attribute's value to @@ -74,7 +74,7 @@ export declare function attr(this: Cheerio, name: string, val * @returns The instance itself. * @see {@link https://api.jquery.com/attr/} */ -export declare function attr(this: Cheerio, values: Record): Cheerio; +export declare function attr(this: Cheerio, values: Record): Cheerio; interface StyleProp { length: number; [key: string]: string | number; @@ -100,14 +100,29 @@ interface StyleProp { * @returns If `value` is specified the instance itself, otherwise the prop's value. * @see {@link https://api.jquery.com/prop/} */ -export declare function prop(this: Cheerio, name: 'tagName' | 'nodeName'): T extends Element ? string : undefined; -export declare function prop(this: Cheerio, name: 'innerHTML' | 'outerHTML'): string | null; -export declare function prop(this: Cheerio, name: 'style'): StyleProp; -export declare function prop(this: Cheerio, name: K): Element[K]; -export declare function prop(this: Cheerio, name: K, value: Element[K] | ((this: Element, i: number, prop: K) => Element[keyof Element])): Cheerio; -export declare function prop(this: Cheerio, name: Record): Cheerio; -export declare function prop(this: Cheerio, name: string, value: string | boolean | null | ((this: Element, i: number, prop: string) => string | boolean)): Cheerio; -export declare function prop(this: Cheerio, name: string): string; +export declare function prop(this: Cheerio, name: 'tagName' | 'nodeName'): T extends Element ? string : undefined; +export declare function prop(this: Cheerio, name: 'innerHTML' | 'outerHTML' | 'innerText' | 'textContent'): string | null; +/** Get a parsed CSS style object. */ +export declare function prop(this: Cheerio, name: 'style'): StyleProp | undefined; +/** + * Resolve `href` or `src` of supported elements. Requires the `baseURI` option + * to be set, and a global `URL` object to be part of the environment. + * + * @example With `baseURI` set to `'https://example.com'`: + * + * ```js + * $('').prop('src'); + * //=> 'https://example.com/image.png' + * ``` + */ +export declare function prop(this: Cheerio, name: 'href' | 'src'): string | undefined; +/** Get a property of an element. */ +export declare function prop(this: Cheerio, name: K): Element[K]; +/** Set a property of an element. */ +export declare function prop(this: Cheerio, name: K, value: Element[K] | ((this: Element, i: number, prop: K) => Element[keyof Element])): Cheerio; +export declare function prop(this: Cheerio, name: Record): Cheerio; +export declare function prop(this: Cheerio, name: string, value: string | boolean | null | ((this: Element, i: number, prop: string) => string | boolean)): Cheerio; +export declare function prop(this: Cheerio, name: string): string; /** * Method for getting data attributes, for only the first element in the matched set. * @@ -120,10 +135,10 @@ export declare function prop(this: Cheerio, name: string): st * ``` * * @param name - Name of the data attribute. - * @returns The data attribute's value. + * @returns The data attribute's value, or `undefined` if the attribute does not exist. * @see {@link https://api.jquery.com/data/} */ -export declare function data(this: Cheerio, name: string): unknown | undefined; +export declare function data(this: Cheerio, name: string): unknown | undefined; /** * Method for getting all of an element's data attributes, for only the first * element in the matched set. @@ -136,10 +151,10 @@ export declare function data(this: Cheerio, name: string): un * //=> { appleColor: 'red' } * ``` * - * @returns The data attribute's values. + * @returns A map with all of the data attributes. * @see {@link https://api.jquery.com/data/} */ -export declare function data(this: Cheerio): Record; +export declare function data(this: Cheerio): Record; /** * Method for setting data attributes, for only the first element in the matched set. * @@ -158,7 +173,7 @@ export declare function data(this: Cheerio): Record(this: Cheerio, name: string, value: unknown): Cheerio; +export declare function data(this: Cheerio, name: string, value: unknown): Cheerio; /** * Method for setting multiple data attributes at once, for only the first * element in the matched set. @@ -177,7 +192,7 @@ export declare function data(this: Cheerio, name: string, val * @returns The instance itself. * @see {@link https://api.jquery.com/data/} */ -export declare function data(this: Cheerio, values: Record): Cheerio; +export declare function data(this: Cheerio, values: Record): Cheerio; /** * Method for getting the value of input, select, and textarea. Note: Support * for `map`, and `function` has not been added yet. @@ -193,7 +208,7 @@ export declare function data(this: Cheerio, values: Record(this: Cheerio): string | undefined | string[]; +export declare function val(this: Cheerio): string | undefined | string[]; /** * Method for setting the value of input, select, and textarea. Note: Support * for `map`, and `function` has not been added yet. @@ -210,7 +225,7 @@ export declare function val(this: Cheerio): string | undefine * @returns The instance itself. * @see {@link https://api.jquery.com/val/} */ -export declare function val(this: Cheerio, value: string | string[]): Cheerio; +export declare function val(this: Cheerio, value: string | string[]): Cheerio; /** * Method for removing attributes by `name`. * @@ -230,9 +245,9 @@ export declare function val(this: Cheerio, value: string | st * @returns The instance itself. * @see {@link https://api.jquery.com/removeAttr/} */ -export declare function removeAttr(this: Cheerio, name: string): Cheerio; +export declare function removeAttr(this: Cheerio, name: string): Cheerio; /** - * Check to see if *any* of the matched elements have the given `className`. + * Check to see if _any_ of the matched elements have the given `className`. * * @category Attributes * @example @@ -252,7 +267,7 @@ export declare function removeAttr(this: Cheerio, name: strin * @returns Indicates if an element has the given `className`. * @see {@link https://api.jquery.com/hasClass/} */ -export declare function hasClass(this: Cheerio, className: string): boolean; +export declare function hasClass(this: Cheerio, className: string): boolean; /** * Adds class(es) to all of the matched elements. Also accepts a `function`. * @@ -271,7 +286,7 @@ export declare function hasClass(this: Cheerio, className: st * @returns The instance itself. * @see {@link https://api.jquery.com/addClass/} */ -export declare function addClass>(this: R, value?: string | ((this: Element, i: number, className: string) => string | undefined)): R; +export declare function addClass>(this: R, value?: string | ((this: Element, i: number, className: string) => string | undefined)): R; /** * Removes one or more space-separated classes from the selected elements. If no * `className` is defined, all classes will be removed. Also accepts a `function`. @@ -291,7 +306,7 @@ export declare function addClass>(this: R * @returns The instance itself. * @see {@link https://api.jquery.com/removeClass/} */ -export declare function removeClass>(this: R, name?: string | ((this: Element, i: number, className: string) => string | undefined)): R; +export declare function removeClass>(this: R, name?: string | ((this: Element, i: number, className: string) => string | undefined)): R; /** * Add or remove class(es) from the matched elements, depending on either the * class's presence or the value of the switch argument. Also accepts a `function`. @@ -312,6 +327,6 @@ export declare function removeClass>(this * @returns The instance itself. * @see {@link https://api.jquery.com/toggleClass/} */ -export declare function toggleClass>(this: R, value?: string | ((this: Element, i: number, className: string, stateVal?: boolean) => string), stateVal?: boolean): R; +export declare function toggleClass>(this: R, value?: string | ((this: Element, i: number, className: string, stateVal?: boolean) => string), stateVal?: boolean): R; export {}; //# sourceMappingURL=attributes.d.ts.map \ No newline at end of file diff --git a/node_modules/cheerio/lib/api/attributes.d.ts.map b/node_modules/cheerio/lib/api/attributes.d.ts.map index c0b4fee..d333c5d 100644 --- a/node_modules/cheerio/lib/api/attributes.d.ts.map +++ b/node_modules/cheerio/lib/api/attributes.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../src/api/attributes.ts"],"names":[],"mappings":"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"} \ No newline at end of file +{"version":3,"file":"attributes.d.ts","sourceRoot":"https://raw.githubusercontent.com/cheeriojs/cheerio/d1cbc66d53392ce8bf6cd0068f675836372d2bf3/src/","sources":["api/attributes.ts"],"names":[],"mappings":"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"} \ No newline at end of file diff --git a/node_modules/cheerio/lib/api/attributes.js b/node_modules/cheerio/lib/api/attributes.js index d67d310..ab93c6d 100644 --- a/node_modules/cheerio/lib/api/attributes.js +++ b/node_modules/cheerio/lib/api/attributes.js @@ -6,8 +6,9 @@ */ Object.defineProperty(exports, "__esModule", { value: true }); exports.toggleClass = exports.removeClass = exports.addClass = exports.hasClass = exports.removeAttr = exports.val = exports.data = exports.prop = exports.attr = void 0; -var static_1 = require("../static"); -var utils_1 = require("../utils"); +var static_js_1 = require("../static.js"); +var utils_js_1 = require("../utils.js"); +var domutils_1 = require("domutils"); var hasOwn = Object.prototype.hasOwnProperty; var rspace = /\s+/; var dataAttrPrefix = 'data-'; @@ -26,7 +27,7 @@ var rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hid var rbrace = /^{[^]*}$|^\[[^]*]$/; function getAttr(elem, name, xmlMode) { var _a; - if (!elem || !utils_1.isTag(elem)) + if (!elem || !(0, utils_js_1.isTag)(elem)) return undefined; (_a = elem.attribs) !== null && _a !== void 0 ? _a : (elem.attribs = {}); // Return the entire attribs object if no attribute specified @@ -39,11 +40,11 @@ function getAttr(elem, name, xmlMode) { } // Mimic the DOM and return text content as value for `option's` if (elem.name === 'option' && name === 'value') { - return static_1.text(elem.children); + return (0, static_js_1.text)(elem.children); } // Mimic DOM with default value for radios/checkboxes if (elem.name === 'input' && - (elem.attribs.type === 'radio' || elem.attribs.type === 'checkbox') && + (elem.attribs['type'] === 'radio' || elem.attribs['type'] === 'checkbox') && name === 'value') { return 'on'; } @@ -62,7 +63,7 @@ function setAttr(el, name, value) { removeAttribute(el, name); } else { - el.attribs[name] = "" + value; + el.attribs[name] = "".concat(value); } } function attr(name, value) { @@ -74,13 +75,13 @@ function attr(name, value) { throw new Error('Bad combination of arguments.'); } } - return utils_1.domEach(this, function (el, i) { - if (utils_1.isTag(el)) + return (0, utils_js_1.domEach)(this, function (el, i) { + if ((0, utils_js_1.isTag)(el)) setAttr(el, name, value.call(el, i, el.attribs[name])); }); } - return utils_1.domEach(this, function (el) { - if (!utils_1.isTag(el)) + return (0, utils_js_1.domEach)(this, function (el) { + if (!(0, utils_js_1.isTag)(el)) return; if (typeof name === 'object') { Object.keys(name).forEach(function (objName) { @@ -103,13 +104,11 @@ exports.attr = attr; * * @private * @category Attributes - * @param el - Elenent to get the prop of. + * @param el - Element to get the prop of. * @param name - Name of the prop. * @returns The prop's value. */ function getProp(el, name, xmlMode) { - if (!el || !utils_1.isTag(el)) - return; return name in el ? // @ts-expect-error TS doesn't like us accessing the value directly here. el[name] @@ -131,12 +130,16 @@ function setProp(el, name, value, xmlMode) { el[name] = value; } else { - setAttr(el, name, !xmlMode && rboolean.test(name) ? (value ? '' : null) : "" + value); + setAttr(el, name, !xmlMode && rboolean.test(name) ? (value ? '' : null) : "".concat(value)); } } function prop(name, value) { var _this = this; + var _a; if (typeof name === 'string' && value === undefined) { + var el = this[0]; + if (!el || !(0, utils_js_1.isTag)(el)) + return undefined; switch (name) { case 'style': { var property_1 = this.css(); @@ -149,15 +152,39 @@ function prop(name, value) { } case 'tagName': case 'nodeName': { - var el = this[0]; - return utils_1.isTag(el) ? el.name.toUpperCase() : undefined; + return el.name.toUpperCase(); + } + case 'href': + case 'src': { + var prop_1 = (_a = el.attribs) === null || _a === void 0 ? void 0 : _a[name]; + /* eslint-disable node/no-unsupported-features/node-builtins */ + if (typeof URL !== 'undefined' && + ((name === 'href' && (el.tagName === 'a' || el.name === 'link')) || + (name === 'src' && + (el.tagName === 'img' || + el.tagName === 'iframe' || + el.tagName === 'audio' || + el.tagName === 'video' || + el.tagName === 'source'))) && + prop_1 !== undefined && + this.options.baseURI) { + return new URL(prop_1, this.options.baseURI).href; + } + /* eslint-enable node/no-unsupported-features/node-builtins */ + return prop_1; + } + case 'innerText': { + return (0, domutils_1.innerText)(el); + } + case 'textContent': { + return (0, domutils_1.textContent)(el); } case 'outerHTML': return this.clone().wrap('').parent().html(); case 'innerHTML': return this.html(); default: - return getProp(this[0], name, this.options.xmlMode); + return getProp(el, name, this.options.xmlMode); } } if (typeof name === 'object' || value !== undefined) { @@ -165,13 +192,14 @@ function prop(name, value) { if (typeof name === 'object') { throw new Error('Bad combination of arguments.'); } - return utils_1.domEach(this, function (el, i) { - if (utils_1.isTag(el)) + return (0, utils_js_1.domEach)(this, function (el, i) { + if ((0, utils_js_1.isTag)(el)) { setProp(el, name, value.call(el, i, getProp(el, name, _this.options.xmlMode)), _this.options.xmlMode); + } }); } - return utils_1.domEach(this, function (el) { - if (!utils_1.isTag(el)) + return (0, utils_js_1.domEach)(this, function (el) { + if (!(0, utils_js_1.isTag)(el)) return; if (typeof name === 'object') { Object.keys(name).forEach(function (key) { @@ -208,13 +236,13 @@ function setData(el, name, value) { /** * Read the specified attribute from the equivalent HTML5 `data-*` attribute, * and (if present) cache the value in the node's internal data store. If no - * attribute name is specified, read *all* HTML5 `data-*` attributes in this manner. + * attribute name is specified, read _all_ HTML5 `data-*` attributes in this manner. * * @private * @category Attributes - * @param el - Elenent to get the data attribute of. + * @param el - Element to get the data attribute of. * @param name - Name of the data attribute. - * @returns The data attribute's value, or a map with all of the data attribute. + * @returns The data attribute's value, or a map with all of the data attributes. */ function readData(el, name) { var domNames; @@ -225,11 +253,11 @@ function readData(el, name) { return attrName.startsWith(dataAttrPrefix); }); jsNames = domNames.map(function (domName) { - return utils_1.camelCase(domName.slice(dataAttrPrefix.length)); + return (0, utils_js_1.camelCase)(domName.slice(dataAttrPrefix.length)); }); } else { - domNames = [dataAttrPrefix + utils_1.cssCase(name)]; + domNames = [dataAttrPrefix + (0, utils_js_1.cssCase)(name)]; jsNames = [name]; } for (var idx = 0; idx < domNames.length; ++idx) { @@ -260,7 +288,7 @@ function readData(el, name) { function data(name, value) { var _a; var elem = this[0]; - if (!elem || !utils_1.isTag(elem)) + if (!elem || !(0, utils_js_1.isTag)(elem)) return; var dataEl = elem; (_a = dataEl.data) !== null && _a !== void 0 ? _a : (dataEl.data = {}); @@ -270,12 +298,13 @@ function data(name, value) { } // Set the value (with attr map support) if (typeof name === 'object' || value !== undefined) { - utils_1.domEach(this, function (el) { - if (utils_1.isTag(el)) + (0, utils_js_1.domEach)(this, function (el) { + if ((0, utils_js_1.isTag)(el)) { if (typeof name === 'object') setData(el, name); else setData(el, name, value); + } }); return this; } @@ -288,7 +317,7 @@ exports.data = data; function val(value) { var querying = arguments.length === 0; var element = this[0]; - if (!element || !utils_1.isTag(element)) + if (!element || !(0, utils_js_1.isTag)(element)) return querying ? undefined : this; switch (element.name) { case 'textarea': @@ -302,12 +331,12 @@ function val(value) { this.find('option').removeAttr('selected'); var values = typeof value !== 'object' ? [value] : value; for (var i = 0; i < values.length; i++) { - this.find("option[value=\"" + values[i] + "\"]").attr('selected', ''); + this.find("option[value=\"".concat(values[i], "\"]")).attr('selected', ''); } return this; } return this.attr('multiple') - ? option.toArray().map(function (el) { return static_1.text(el.children); }) + ? option.toArray().map(function (el) { return (0, static_js_1.text)(el.children); }) : option.attr('value'); } case 'input': @@ -363,8 +392,8 @@ function splitNames(names) { function removeAttr(name) { var attrNames = splitNames(name); var _loop_1 = function (i) { - utils_1.domEach(this_1, function (elem) { - if (utils_1.isTag(elem)) + (0, utils_js_1.domEach)(this_1, function (elem) { + if ((0, utils_js_1.isTag)(elem)) removeAttribute(elem, attrNames[i]); }); }; @@ -376,7 +405,7 @@ function removeAttr(name) { } exports.removeAttr = removeAttr; /** - * Check to see if *any* of the matched elements have the given `className`. + * Check to see if _any_ of the matched elements have the given `className`. * * @category Attributes * @example @@ -398,7 +427,7 @@ exports.removeAttr = removeAttr; */ function hasClass(className) { return this.toArray().some(function (elem) { - var clazz = utils_1.isTag(elem) && elem.attribs.class; + var clazz = (0, utils_js_1.isTag)(elem) && elem.attribs['class']; var idx = -1; if (clazz && className.length) { while ((idx = clazz.indexOf(className, idx + 1)) > -1) { @@ -434,9 +463,9 @@ exports.hasClass = hasClass; function addClass(value) { // Support functions if (typeof value === 'function') { - return utils_1.domEach(this, function (el, i) { - if (utils_1.isTag(el)) { - var className = el.attribs.class || ''; + return (0, utils_js_1.domEach)(this, function (el, i) { + if ((0, utils_js_1.isTag)(el)) { + var className = el.attribs['class'] || ''; addClass.call([el], value.call(el, i, className)); } }); @@ -449,7 +478,7 @@ function addClass(value) { for (var i = 0; i < numElements; i++) { var el = this[i]; // If selected element isn't a tag, move on - if (!utils_1.isTag(el)) + if (!(0, utils_js_1.isTag)(el)) continue; // If we don't already have classes — always set xmlMode to false here, as it doesn't matter for classes var className = getAttr(el, 'class', false); @@ -457,11 +486,11 @@ function addClass(value) { setAttr(el, 'class', classNames.join(' ').trim()); } else { - var setClass = " " + className + " "; + var setClass = " ".concat(className, " "); // Check if class already exists for (var j = 0; j < classNames.length; j++) { - var appendClass = classNames[j] + " "; - if (!setClass.includes(" " + appendClass)) + var appendClass = "".concat(classNames[j], " "); + if (!setClass.includes(" ".concat(appendClass))) setClass += appendClass; } setAttr(el, 'class', setClass.trim()); @@ -492,23 +521,24 @@ exports.addClass = addClass; function removeClass(name) { // Handle if value is a function if (typeof name === 'function') { - return utils_1.domEach(this, function (el, i) { - if (utils_1.isTag(el)) - removeClass.call([el], name.call(el, i, el.attribs.class || '')); + return (0, utils_js_1.domEach)(this, function (el, i) { + if ((0, utils_js_1.isTag)(el)) { + removeClass.call([el], name.call(el, i, el.attribs['class'] || '')); + } }); } var classes = splitNames(name); var numClasses = classes.length; var removeAll = arguments.length === 0; - return utils_1.domEach(this, function (el) { - if (!utils_1.isTag(el)) + return (0, utils_js_1.domEach)(this, function (el) { + if (!(0, utils_js_1.isTag)(el)) return; if (removeAll) { // Short circuit the remove all case as this is the nice one - el.attribs.class = ''; + el.attribs['class'] = ''; } else { - var elClasses = splitNames(el.attribs.class); + var elClasses = splitNames(el.attribs['class']); var changed = false; for (var j = 0; j < numClasses; j++) { var index = elClasses.indexOf(classes[j]); @@ -523,7 +553,7 @@ function removeClass(name) { } } if (changed) { - el.attribs.class = elClasses.join(' '); + el.attribs['class'] = elClasses.join(' '); } } }); @@ -552,9 +582,9 @@ exports.removeClass = removeClass; function toggleClass(value, stateVal) { // Support functions if (typeof value === 'function') { - return utils_1.domEach(this, function (el, i) { - if (utils_1.isTag(el)) { - toggleClass.call([el], value.call(el, i, el.attribs.class || '', stateVal), stateVal); + return (0, utils_js_1.domEach)(this, function (el, i) { + if ((0, utils_js_1.isTag)(el)) { + toggleClass.call([el], value.call(el, i, el.attribs['class'] || '', stateVal), stateVal); } }); } @@ -568,9 +598,9 @@ function toggleClass(value, stateVal) { for (var i = 0; i < numElements; i++) { var el = this[i]; // If selected element isn't a tag, move on - if (!utils_1.isTag(el)) + if (!(0, utils_js_1.isTag)(el)) continue; - var elementClasses = splitNames(el.attribs.class); + var elementClasses = splitNames(el.attribs['class']); // Check if class already exists for (var j = 0; j < numClasses; j++) { // Check if the class name is currently defined @@ -584,8 +614,9 @@ function toggleClass(value, stateVal) { elementClasses.splice(index, 1); } } - el.attribs.class = elementClasses.join(' '); + el.attribs['class'] = elementClasses.join(' '); } return this; } exports.toggleClass = toggleClass; +//# sourceMappingURL=attributes.js.map \ No newline at end of file diff --git a/node_modules/cheerio/lib/api/css.d.ts b/node_modules/cheerio/lib/api/css.d.ts index f63d3b4..4ff2510 100644 --- a/node_modules/cheerio/lib/api/css.d.ts +++ b/node_modules/cheerio/lib/api/css.d.ts @@ -1,14 +1,14 @@ -import type { Element, Node } from 'domhandler'; -import type { Cheerio } from '../cheerio'; +import type { Element, AnyNode } from 'domhandler'; +import type { Cheerio } from '../cheerio.js'; /** * Get the value of a style property for the first element in the set of matched elements. * * @category CSS - * @param names - Optionally the names of the property of interest. + * @param names - Optionally the names of the properties of interest. * @returns A map of all of the style properties. * @see {@link https://api.jquery.com/css/} */ -export declare function css(this: Cheerio, names?: string[]): Record; +export declare function css(this: Cheerio, names?: string[]): Record | undefined; /** * Get the value of a style property for the first element in the set of matched elements. * @@ -17,7 +17,7 @@ export declare function css(this: Cheerio, names?: string[]): * @returns The property value for the given name. * @see {@link https://api.jquery.com/css/} */ -export declare function css(this: Cheerio, name: string): string | undefined; +export declare function css(this: Cheerio, name: string): string | undefined; /** * Set one CSS property for every matched element. * @@ -27,15 +27,14 @@ export declare function css(this: Cheerio, name: string): str * @returns The instance itself. * @see {@link https://api.jquery.com/css/} */ -export declare function css(this: Cheerio, prop: string, val: string | ((this: Element, i: number, style: string) => string | undefined)): Cheerio; +export declare function css(this: Cheerio, prop: string, val: string | ((this: Element, i: number, style: string) => string | undefined)): Cheerio; /** * Set multiple CSS properties for every matched element. * * @category CSS - * @param prop - The name of the property. - * @param val - The new value. + * @param map - A map of property names and values. * @returns The instance itself. * @see {@link https://api.jquery.com/css/} */ -export declare function css(this: Cheerio, prop: Record): Cheerio; +export declare function css(this: Cheerio, map: Record): Cheerio; //# sourceMappingURL=css.d.ts.map \ No newline at end of file diff --git a/node_modules/cheerio/lib/api/css.d.ts.map b/node_modules/cheerio/lib/api/css.d.ts.map index 8d2e7d4..f10b6c8 100644 --- a/node_modules/cheerio/lib/api/css.d.ts.map +++ b/node_modules/cheerio/lib/api/css.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../src/api/css.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C;;;;;;;GAOG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,IAAI,EAChC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAChB,KAAK,CAAC,EAAE,MAAM,EAAE,GACf,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC1B;;;;;;;GAOG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,IAAI,EAChC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAChB,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,SAAS,CAAC;AACtB;;;;;;;;GAQG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,IAAI,EAChC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAChB,IAAI,EAAE,MAAM,EACZ,GAAG,EACC,MAAM,GACN,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC,GACpE,OAAO,CAAC,CAAC,CAAC,CAAC;AACd;;;;;;;;GAQG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,IAAI,EAChC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC3B,OAAO,CAAC,CAAC,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"css.d.ts","sourceRoot":"https://raw.githubusercontent.com/cheeriojs/cheerio/d1cbc66d53392ce8bf6cd0068f675836372d2bf3/src/","sources":["api/css.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C;;;;;;;GAOG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,OAAO,EACnC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAChB,KAAK,CAAC,EAAE,MAAM,EAAE,GACf,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;AACtC;;;;;;;GAOG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,OAAO,EACnC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAChB,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,SAAS,CAAC;AACtB;;;;;;;;GAQG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,OAAO,EACnC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAChB,IAAI,EAAE,MAAM,EACZ,GAAG,EACC,MAAM,GACN,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC,GACpE,OAAO,CAAC,CAAC,CAAC,CAAC;AACd;;;;;;;GAOG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,OAAO,EACnC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAChB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC1B,OAAO,CAAC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/cheerio/lib/api/css.js b/node_modules/cheerio/lib/api/css.js index aa7ad09..9389c29 100644 --- a/node_modules/cheerio/lib/api/css.js +++ b/node_modules/cheerio/lib/api/css.js @@ -1,18 +1,30 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.css = void 0; -var utils_1 = require("../utils"); +var utils_js_1 = require("../utils.js"); +/** + * Set multiple CSS properties for every matched element. + * + * @category CSS + * @param prop - The names of the properties. + * @param val - The new values. + * @returns The instance itself. + * @see {@link https://api.jquery.com/css/} + */ function css(prop, val) { if ((prop != null && val != null) || // When `prop` is a "plain" object (typeof prop === 'object' && !Array.isArray(prop))) { - return utils_1.domEach(this, function (el, i) { - if (utils_1.isTag(el)) { + return (0, utils_js_1.domEach)(this, function (el, i) { + if ((0, utils_js_1.isTag)(el)) { // `prop` can't be an array here anymore. setCss(el, prop, val, i); } }); } + if (this.length === 0) { + return undefined; + } return getCss(this[0], prop); } exports.css = css; @@ -35,7 +47,7 @@ function setCss(el, prop, value, idx) { else if (val != null) { styles[prop] = val; } - el.attribs.style = stringify(styles); + el.attribs['style'] = stringify(styles); } else if (typeof prop === 'object') { Object.keys(prop).forEach(function (k, i) { @@ -44,9 +56,9 @@ function setCss(el, prop, value, idx) { } } function getCss(el, prop) { - if (!el || !utils_1.isTag(el)) + if (!el || !(0, utils_js_1.isTag)(el)) return; - var styles = parse(el.attribs.style); + var styles = parse(el.attribs['style']); if (typeof prop === 'string') { return styles[prop]; } @@ -70,7 +82,7 @@ function getCss(el, prop) { * @returns The serialized styles. */ function stringify(obj) { - return Object.keys(obj).reduce(function (str, prop) { return "" + str + (str ? ' ' : '') + prop + ": " + obj[prop] + ";"; }, ''); + return Object.keys(obj).reduce(function (str, prop) { return "".concat(str).concat(str ? ' ' : '').concat(prop, ": ").concat(obj[prop], ";"); }, ''); } /** * Parse `styles`. @@ -84,12 +96,23 @@ function parse(styles) { styles = (styles || '').trim(); if (!styles) return {}; - return styles.split(';').reduce(function (obj, str) { + var obj = {}; + var key; + for (var _i = 0, _a = styles.split(';'); _i < _a.length; _i++) { + var str = _a[_i]; var n = str.indexOf(':'); - // Skip if there is no :, or if it is the first/last character - if (n < 1 || n === str.length - 1) - return obj; - obj[str.slice(0, n).trim()] = str.slice(n + 1).trim(); - return obj; - }, {}); + // If there is no :, or if it is the first/last character, add to the previous item's value + if (n < 1 || n === str.length - 1) { + var trimmed = str.trimEnd(); + if (trimmed.length > 0 && key !== undefined) { + obj[key] += ";".concat(trimmed); + } + } + else { + key = str.slice(0, n).trim(); + obj[key] = str.slice(n + 1).trim(); + } + } + return obj; } +//# sourceMappingURL=css.js.map \ No newline at end of file diff --git a/node_modules/cheerio/lib/api/forms.d.ts b/node_modules/cheerio/lib/api/forms.d.ts index 32f8739..3b11493 100644 --- a/node_modules/cheerio/lib/api/forms.d.ts +++ b/node_modules/cheerio/lib/api/forms.d.ts @@ -1,13 +1,20 @@ -import type { Node } from 'domhandler'; -import type { Cheerio } from '../cheerio'; +import type { AnyNode } from 'domhandler'; +import type { Cheerio } from '../cheerio.js'; /** * Encode a set of form elements as a string for submission. * * @category Forms + * @example + * + * ```js + * $('
    ').serialize(); + * //=> 'foo=bar' + * ``` + * * @returns The serialized form. * @see {@link https://api.jquery.com/serialize/} */ -export declare function serialize(this: Cheerio): string; +export declare function serialize(this: Cheerio): string; interface SerializedField { name: string; value: string; @@ -26,6 +33,6 @@ interface SerializedField { * @returns The serialized form. * @see {@link https://api.jquery.com/serializeArray/} */ -export declare function serializeArray(this: Cheerio): SerializedField[]; +export declare function serializeArray(this: Cheerio): SerializedField[]; export {}; //# sourceMappingURL=forms.d.ts.map \ No newline at end of file diff --git a/node_modules/cheerio/lib/api/forms.d.ts.map b/node_modules/cheerio/lib/api/forms.d.ts.map index ee25744..d27b568 100644 --- a/node_modules/cheerio/lib/api/forms.d.ts.map +++ b/node_modules/cheerio/lib/api/forms.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"forms.d.ts","sourceRoot":"","sources":["../../src/api/forms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAW1C;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM,CAYlE;AAED,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,IAAI,EAC3C,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,GACf,eAAe,EAAE,CAsCnB"} \ No newline at end of file +{"version":3,"file":"forms.d.ts","sourceRoot":"https://raw.githubusercontent.com/cheeriojs/cheerio/d1cbc66d53392ce8bf6cd0068f675836372d2bf3/src/","sources":["api/forms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAW7C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM,CAYrE;AAED,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,OAAO,EAC9C,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,GACf,eAAe,EAAE,CAsCnB"} \ No newline at end of file diff --git a/node_modules/cheerio/lib/api/forms.js b/node_modules/cheerio/lib/api/forms.js index 2e881c5..a9f84a7 100644 --- a/node_modules/cheerio/lib/api/forms.js +++ b/node_modules/cheerio/lib/api/forms.js @@ -1,7 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.serializeArray = exports.serialize = void 0; -var utils_1 = require("../utils"); +var utils_js_1 = require("../utils.js"); /* * https://github.com/jquery/jquery/blob/2.1.3/src/manipulation/var/rcheckableType.js * https://github.com/jquery/jquery/blob/2.1.3/src/serialize.js @@ -13,6 +13,13 @@ var rCRLF = /\r?\n/g; * Encode a set of form elements as a string for submission. * * @category Forms + * @example + * + * ```js + * $('
    ').serialize(); + * //=> 'foo=bar' + * ``` + * * @returns The serialized form. * @see {@link https://api.jquery.com/serialize/} */ @@ -21,7 +28,7 @@ function serialize() { var arr = this.serializeArray(); // Serialize each element into a key/value string var retArr = arr.map(function (data) { - return encodeURIComponent(data.name) + "=" + encodeURIComponent(data.value); + return "".concat(encodeURIComponent(data.name), "=").concat(encodeURIComponent(data.value)); }); // Return the resulting serialization return retArr.join('&').replace(r20, '+'); @@ -46,7 +53,7 @@ function serializeArray() { // Resolve all form elements from either forms or collections of form elements return this.map(function (_, elem) { var $elem = _this._make(elem); - if (utils_1.isTag(elem) && elem.name === 'form') { + if ((0, utils_js_1.isTag)(elem) && elem.name === 'form') { return $elem.find(submittableSelector).toArray(); } return $elem.filter(submittableSelector).toArray(); @@ -82,3 +89,4 @@ function serializeArray() { .toArray(); } exports.serializeArray = serializeArray; +//# sourceMappingURL=forms.js.map \ No newline at end of file diff --git a/node_modules/cheerio/lib/api/manipulation.d.ts b/node_modules/cheerio/lib/api/manipulation.d.ts index 1d2ec9b..05f80d7 100644 --- a/node_modules/cheerio/lib/api/manipulation.d.ts +++ b/node_modules/cheerio/lib/api/manipulation.d.ts @@ -3,9 +3,9 @@ * * @module cheerio/manipulation */ -import { Node } from 'domhandler'; -import type { Cheerio } from '../cheerio'; -import type { BasicAcceptedElems, AcceptedElems } from '../types'; +import { AnyNode } from 'domhandler'; +import type { Cheerio } from '../cheerio.js'; +import type { BasicAcceptedElems, AcceptedElems } from '../types.js'; /** * Create an array of nodes, recursing into arrays and parsing strings if necessary. * @@ -15,7 +15,7 @@ import type { BasicAcceptedElems, AcceptedElems } from '../types'; * @param clone - Optionally clone nodes. * @returns The array of nodes. */ -export declare function _makeDomArray(this: Cheerio, elem?: BasicAcceptedElems, clone?: boolean): Node[]; +export declare function _makeDomArray(this: Cheerio, elem?: BasicAcceptedElems, clone?: boolean): AnyNode[]; /** * Insert every element in the set of matched elements to the end of the target. * @@ -37,7 +37,7 @@ export declare function _makeDomArray(this: Cheerio, elem?: B * @returns The instance itself. * @see {@link https://api.jquery.com/appendTo/} */ -export declare function appendTo(this: Cheerio, target: BasicAcceptedElems): Cheerio; +export declare function appendTo(this: Cheerio, target: BasicAcceptedElems): Cheerio; /** * Insert every element in the set of matched elements to the beginning of the target. * @@ -59,9 +59,9 @@ export declare function appendTo(this: Cheerio, target: Basic * @returns The instance itself. * @see {@link https://api.jquery.com/prependTo/} */ -export declare function prependTo(this: Cheerio, target: BasicAcceptedElems): Cheerio; +export declare function prependTo(this: Cheerio, target: BasicAcceptedElems): Cheerio; /** - * Inserts content as the *last* child of each of the selected elements. + * Inserts content as the _last_ child of each of the selected elements. * * @category Manipulation * @example @@ -79,9 +79,9 @@ export declare function prependTo(this: Cheerio, target: Basi * * @see {@link https://api.jquery.com/append/} */ -export declare const append: (this: Cheerio, ...elems: [(this: Node, i: number, html: string) => BasicAcceptedElems] | BasicAcceptedElems[]) => Cheerio; +export declare const append: (this: Cheerio, ...elems: [(this: AnyNode, i: number, html: string) => BasicAcceptedElems] | BasicAcceptedElems[]) => Cheerio; /** - * Inserts content as the *first* child of each of the selected elements. + * Inserts content as the _first_ child of each of the selected elements. * * @category Manipulation * @example @@ -99,7 +99,7 @@ export declare const append: (this: Cheerio, ...elems: [(this * * @see {@link https://api.jquery.com/prepend/} */ -export declare const prepend: (this: Cheerio, ...elems: [(this: Node, i: number, html: string) => BasicAcceptedElems] | BasicAcceptedElems[]) => Cheerio; +export declare const prepend: (this: Cheerio, ...elems: [(this: AnyNode, i: number, html: string) => BasicAcceptedElems] | BasicAcceptedElems[]) => Cheerio; /** * The .wrap() function can take any string or object that could be passed to * the $() factory function to specify a DOM structure. This structure may be @@ -142,7 +142,7 @@ export declare const prepend: (this: Cheerio, ...elems: [(thi * @param wrapper - The DOM structure to wrap around each element in the selection. * @see {@link https://api.jquery.com/wrap/} */ -export declare const wrap: (this: Cheerio, wrapper: AcceptedElems) => Cheerio; +export declare const wrap: (this: Cheerio, wrapper: AcceptedElems) => Cheerio; /** * The .wrapInner() function can take any string or object that could be passed * to the $() factory function to specify a DOM structure. This structure may be @@ -186,7 +186,7 @@ export declare const wrap: (this: Cheerio, wrapper: AcceptedE * @returns The instance itself, for chaining. * @see {@link https://api.jquery.com/wrapInner/} */ -export declare const wrapInner: (this: Cheerio, wrapper: AcceptedElems) => Cheerio; +export declare const wrapInner: (this: Cheerio, wrapper: AcceptedElems) => Cheerio; /** * The .unwrap() function, removes the parents of the set of matched elements * from the DOM, leaving the matched elements in their place. @@ -225,7 +225,7 @@ export declare const wrapInner: (this: Cheerio, wrapper: Acce * @returns The instance itself, for chaining. * @see {@link https://api.jquery.com/unwrap/} */ -export declare function unwrap(this: Cheerio, selector?: string): Cheerio; +export declare function unwrap(this: Cheerio, selector?: string): Cheerio; /** * The .wrapAll() function can take any string or object that could be passed to * the $() function to specify a DOM structure. This structure may be nested @@ -277,7 +277,7 @@ export declare function unwrap(this: Cheerio, selector?: stri * @returns The instance itself. * @see {@link https://api.jquery.com/wrapAll/} */ -export declare function wrapAll(this: Cheerio, wrapper: AcceptedElems): Cheerio; +export declare function wrapAll(this: Cheerio, wrapper: AcceptedElems): Cheerio; /** * Insert content next to each element in the set of matched elements. * @@ -300,7 +300,7 @@ export declare function wrapAll(this: Cheerio, wrapper: Accep * @returns The instance itself. * @see {@link https://api.jquery.com/after/} */ -export declare function after(this: Cheerio, ...elems: [(this: Node, i: number, html: string) => BasicAcceptedElems] | BasicAcceptedElems[]): Cheerio; +export declare function after(this: Cheerio, ...elems: [(this: AnyNode, i: number, html: string) => BasicAcceptedElems] | BasicAcceptedElems[]): Cheerio; /** * Insert every element in the set of matched elements after the target. * @@ -322,7 +322,7 @@ export declare function after(this: Cheerio, ...elems: [(this * @returns The set of newly inserted elements. * @see {@link https://api.jquery.com/insertAfter/} */ -export declare function insertAfter(this: Cheerio, target: BasicAcceptedElems): Cheerio; +export declare function insertAfter(this: Cheerio, target: BasicAcceptedElems): Cheerio; /** * Insert content previous to each element in the set of matched elements. * @@ -345,7 +345,7 @@ export declare function insertAfter(this: Cheerio, target: Ba * @returns The instance itself. * @see {@link https://api.jquery.com/before/} */ -export declare function before(this: Cheerio, ...elems: [(this: Node, i: number, html: string) => BasicAcceptedElems] | BasicAcceptedElems[]): Cheerio; +export declare function before(this: Cheerio, ...elems: [(this: AnyNode, i: number, html: string) => BasicAcceptedElems] | BasicAcceptedElems[]): Cheerio; /** * Insert every element in the set of matched elements before the target. * @@ -367,7 +367,7 @@ export declare function before(this: Cheerio, ...elems: [(thi * @returns The set of newly inserted elements. * @see {@link https://api.jquery.com/insertBefore/} */ -export declare function insertBefore(this: Cheerio, target: BasicAcceptedElems): Cheerio; +export declare function insertBefore(this: Cheerio, target: BasicAcceptedElems): Cheerio; /** * Removes the set of matched elements from the DOM and all their children. * `selector` filters the set of matched elements to be removed. @@ -388,7 +388,7 @@ export declare function insertBefore(this: Cheerio, target: B * @returns The instance itself. * @see {@link https://api.jquery.com/remove/} */ -export declare function remove(this: Cheerio, selector?: string): Cheerio; +export declare function remove(this: Cheerio, selector?: string): Cheerio; /** * Replaces matched elements with `content`. * @@ -410,7 +410,7 @@ export declare function remove(this: Cheerio, selector?: stri * @returns The instance itself. * @see {@link https://api.jquery.com/replaceWith/} */ -export declare function replaceWith(this: Cheerio, content: AcceptedElems): Cheerio; +export declare function replaceWith(this: Cheerio, content: AcceptedElems): Cheerio; /** * Empties an element, removing all its children. * @@ -426,10 +426,9 @@ export declare function replaceWith(this: Cheerio, content: A * @returns The instance itself. * @see {@link https://api.jquery.com/empty/} */ -export declare function empty(this: Cheerio): Cheerio; +export declare function empty(this: Cheerio): Cheerio; /** - * Gets an HTML content string from the first selected element. If `htmlString` - * is specified, each selected element's content is replaced by the new content. + * Gets an HTML content string from the first selected element. * * @category Manipulation * @example @@ -442,23 +441,36 @@ export declare function empty(this: Cheerio): Cheerio; * //=>
  • Mango
  • * ``` * - * @param str - If specified used to replace selection's contents. + * @returns The HTML content string. + * @see {@link https://api.jquery.com/html/} + */ +export declare function html(this: Cheerio): string | null; +/** + * Replaces each selected element's content with the specified content. + * + * @category Manipulation + * @example + * + * ```js + * $('.orange').html('
  • Mango
  • ').html(); + * //=>
  • Mango
  • + * ``` + * + * @param str - The content to replace selection's contents with. * @returns The instance itself. * @see {@link https://api.jquery.com/html/} */ -export declare function html(this: Cheerio): string | null; -export declare function html(this: Cheerio, str: string | Cheerio): Cheerio; +export declare function html(this: Cheerio, str: string | Cheerio): Cheerio; /** * Turns the collection to a string. Alias for `.html()`. * * @category Manipulation * @returns The rendered document. */ -export declare function toString(this: Cheerio): string; +export declare function toString(this: Cheerio): string; /** * Get the combined text contents of each element in the set of matched - * elements, including their descendants. If `textString` is specified, each - * selected element's content is replaced by the new text content. + * elements, including their descendants. * * @category Manipulation * @example @@ -473,12 +485,26 @@ export declare function toString(this: Cheerio): string; * // Pear * ``` * - * @param str - If specified replacement for the selected element's contents. - * @returns The instance itself when setting text, otherwise the rendered document. + * @returns The text contents of the collection. * @see {@link https://api.jquery.com/text/} */ -export declare function text(this: Cheerio): string; -export declare function text(this: Cheerio, str: string | ((this: Node, i: number, text: string) => string)): Cheerio; +export declare function text(this: Cheerio): string; +/** + * Set the content of each element in the set of matched elements to the specified text. + * + * @category Manipulation + * @example + * + * ```js + * $('.orange').text('Orange'); + * //=>
    Orange
    + * ``` + * + * @param str - The text to set as the content of each matched element. + * @returns The instance itself. + * @see {@link https://api.jquery.com/text/} + */ +export declare function text(this: Cheerio, str: string | ((this: AnyNode, i: number, text: string) => string)): Cheerio; /** * Clone the cheerio object. * @@ -492,5 +518,5 @@ export declare function text(this: Cheerio, str: string | ((t * @returns The cloned object. * @see {@link https://api.jquery.com/clone/} */ -export declare function clone(this: Cheerio): Cheerio; +export declare function clone(this: Cheerio): Cheerio; //# sourceMappingURL=manipulation.d.ts.map \ No newline at end of file diff --git a/node_modules/cheerio/lib/api/manipulation.d.ts.map b/node_modules/cheerio/lib/api/manipulation.d.ts.map index 9d68655..90557c8 100644 --- a/node_modules/cheerio/lib/api/manipulation.d.ts.map +++ b/node_modules/cheerio/lib/api/manipulation.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"manipulation.d.ts","sourceRoot":"","sources":["../../src/api/manipulation.ts"],"names":[],"mappings":"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"} \ No newline at end of file +{"version":3,"file":"manipulation.d.ts","sourceRoot":"https://raw.githubusercontent.com/cheeriojs/cheerio/d1cbc66d53392ce8bf6cd0068f675836372d2bf3/src/","sources":["api/manipulation.ts"],"names":[],"mappings":"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"} \ No newline at end of file diff --git a/node_modules/cheerio/lib/api/manipulation.js b/node_modules/cheerio/lib/api/manipulation.js index d84808d..f96c008 100644 --- a/node_modules/cheerio/lib/api/manipulation.js +++ b/node_modules/cheerio/lib/api/manipulation.js @@ -1,18 +1,25 @@ "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.clone = exports.text = exports.toString = exports.html = exports.empty = exports.replaceWith = exports.remove = exports.insertBefore = exports.before = exports.insertAfter = exports.after = exports.wrapAll = exports.unwrap = exports.wrapInner = exports.wrap = exports.prepend = exports.append = exports.prependTo = exports.appendTo = exports._makeDomArray = void 0; -var tslib_1 = require("tslib"); -var domhandler_1 = require("domhandler"); /** * Methods for modifying the DOM structure. * * @module cheerio/manipulation */ -var domhandler_2 = require("domhandler"); -var parse_1 = tslib_1.__importStar(require("../parse")); -var static_1 = require("../static"); -var utils_1 = require("../utils"); -var htmlparser2_1 = require("htmlparser2"); +var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.clone = exports.text = exports.toString = exports.html = exports.empty = exports.replaceWith = exports.remove = exports.insertBefore = exports.before = exports.insertAfter = exports.after = exports.wrapAll = exports.unwrap = exports.wrapInner = exports.wrap = exports.prepend = exports.append = exports.prependTo = exports.appendTo = exports._makeDomArray = void 0; +var domhandler_1 = require("domhandler"); +var parse_js_1 = require("../parse.js"); +var static_js_1 = require("../static.js"); +var utils_js_1 = require("../utils.js"); +var domutils_1 = require("domutils"); /** * Create an array of nodes, recursing into arrays and parsing strings if necessary. * @@ -27,16 +34,16 @@ function _makeDomArray(elem, clone) { if (elem == null) { return []; } - if (utils_1.isCheerio(elem)) { - return clone ? utils_1.cloneDom(elem.get()) : elem.get(); + if ((0, utils_js_1.isCheerio)(elem)) { + return clone ? (0, utils_js_1.cloneDom)(elem.get()) : elem.get(); } if (Array.isArray(elem)) { return elem.reduce(function (newElems, el) { return newElems.concat(_this._makeDomArray(el, clone)); }, []); } if (typeof elem === 'string') { - return parse_1.default(elem, this.options, false).children; + return this._parse(elem, this.options, false, null).children; } - return clone ? utils_1.cloneDom([elem]) : [elem]; + return clone ? (0, utils_js_1.cloneDom)([elem]) : [elem]; } exports._makeDomArray = _makeDomArray; function _insert(concatenator) { @@ -47,11 +54,11 @@ function _insert(concatenator) { elems[_i] = arguments[_i]; } var lastIdx = this.length - 1; - return utils_1.domEach(this, function (el, i) { - if (!domhandler_1.hasChildren(el)) + return (0, utils_js_1.domEach)(this, function (el, i) { + if (!(0, domhandler_1.hasChildren)(el)) return; var domSrc = typeof elems[0] === 'function' - ? elems[0].call(el, i, static_1.html(el.children)) + ? elems[0].call(el, i, _this._render(el.children)) : elems; var dom = _this._makeDomArray(domSrc, i < lastIdx); concatenator(dom, el.children, el); @@ -73,12 +80,14 @@ function _insert(concatenator) { */ function uniqueSplice(array, spliceIdx, spliceCount, newElems, parent) { var _a, _b; - var spliceArgs = tslib_1.__spreadArray([ + var spliceArgs = __spreadArray([ spliceIdx, spliceCount - ], newElems); - var prev = array[spliceIdx - 1] || null; - var next = array[spliceIdx + spliceCount] || null; + ], newElems, true); + var prev = spliceIdx === 0 ? null : array[spliceIdx - 1]; + var next = spliceIdx + spliceCount >= array.length + ? null + : array[spliceIdx + spliceCount]; /* * Before splicing in new elements, ensure they do not already appear in the * current array. @@ -87,7 +96,8 @@ function uniqueSplice(array, spliceIdx, spliceCount, newElems, parent) { var node = newElems[idx]; var oldParent = node.parent; if (oldParent) { - var prevIdx = oldParent.children.indexOf(newElems[idx]); + var oldSiblings = oldParent.children; + var prevIdx = oldSiblings.indexOf(node); if (prevIdx > -1) { oldParent.children.splice(prevIdx, 1); if (parent === oldParent && spliceIdx > prevIdx) { @@ -102,8 +112,8 @@ function uniqueSplice(array, spliceIdx, spliceCount, newElems, parent) { if (node.next) { node.next.prev = (_b = node.prev) !== null && _b !== void 0 ? _b : null; } - node.prev = newElems[idx - 1] || prev; - node.next = newElems[idx + 1] || next; + node.prev = idx === 0 ? prev : newElems[idx - 1]; + node.next = idx === newElems.length - 1 ? next : newElems[idx + 1]; } if (prev) { prev.next = newElems[0]; @@ -135,7 +145,7 @@ function uniqueSplice(array, spliceIdx, spliceCount, newElems, parent) { * @see {@link https://api.jquery.com/appendTo/} */ function appendTo(target) { - var appendTarget = utils_1.isCheerio(target) ? target : this._make(target); + var appendTarget = (0, utils_js_1.isCheerio)(target) ? target : this._make(target); appendTarget.append(this); return this; } @@ -162,13 +172,13 @@ exports.appendTo = appendTo; * @see {@link https://api.jquery.com/prependTo/} */ function prependTo(target) { - var prependTarget = utils_1.isCheerio(target) ? target : this._make(target); + var prependTarget = (0, utils_js_1.isCheerio)(target) ? target : this._make(target); prependTarget.prepend(this); return this; } exports.prependTo = prependTo; /** - * Inserts content as the *last* child of each of the selected elements. + * Inserts content as the _last_ child of each of the selected elements. * * @category Manipulation * @example @@ -190,7 +200,7 @@ exports.append = _insert(function (dom, children, parent) { uniqueSplice(children, children.length, 0, dom, parent); }); /** - * Inserts content as the *first* child of each of the selected elements. + * Inserts content as the _first_ child of each of the selected elements. * * @category Manipulation * @example @@ -219,11 +229,11 @@ function _wrap(insert) { var el = this[i]; var wrap_1 = typeof wrapper === 'function' ? wrapper.call(el, i, el) - : typeof wrapper === 'string' && !utils_1.isHtml(wrapper) + : typeof wrapper === 'string' && !(0, utils_js_1.isHtml)(wrapper) ? lastParent.find(wrapper).clone() : wrapper; var wrapperDom = this._makeDomArray(wrap_1, i < lastIdx)[0]; - if (!wrapperDom || !htmlparser2_1.DomUtils.hasChildren(wrapperDom)) + if (!wrapperDom || !(0, domhandler_1.hasChildren)(wrapperDom)) continue; var elInsertLocation = wrapperDom; /* @@ -233,7 +243,7 @@ function _wrap(insert) { var j = 0; while (j < elInsertLocation.children.length) { var child = elInsertLocation.children[j]; - if (utils_1.isTag(child)) { + if ((0, utils_js_1.isTag)(child)) { elInsertLocation = child; j = 0; } @@ -294,7 +304,7 @@ exports.wrap = _wrap(function (el, elInsertLocation, wrapperDom) { return; var siblings = parent.children; var index = siblings.indexOf(el); - parse_1.update([el], elInsertLocation); + (0, parse_js_1.update)([el], elInsertLocation); /* * The previous operation removed the current element from the `siblings` * array, so the `dom` array can be inserted without removing any @@ -346,10 +356,10 @@ exports.wrap = _wrap(function (el, elInsertLocation, wrapperDom) { * @see {@link https://api.jquery.com/wrapInner/} */ exports.wrapInner = _wrap(function (el, elInsertLocation, wrapperDom) { - if (!domhandler_1.hasChildren(el)) + if (!(0, domhandler_1.hasChildren)(el)) return; - parse_1.update(el.children, elInsertLocation); - parse_1.update(wrapperDom, el); + (0, parse_js_1.update)(el.children, elInsertLocation); + (0, parse_js_1.update)(wrapperDom, el); }); /** * The .unwrap() function, removes the parents of the set of matched elements @@ -511,9 +521,9 @@ function after() { elems[_i] = arguments[_i]; } var lastIdx = this.length - 1; - return utils_1.domEach(this, function (el, i) { + return (0, utils_js_1.domEach)(this, function (el, i) { var parent = el.parent; - if (!htmlparser2_1.DomUtils.hasChildren(el) || !parent) { + if (!(0, domhandler_1.hasChildren)(el) || !parent) { return; } var siblings = parent.children; @@ -523,7 +533,7 @@ function after() { if (index < 0) return; var domSrc = typeof elems[0] === 'function' - ? elems[0].call(el, i, static_1.html(el.children)) + ? elems[0].call(el, i, _this._render(el.children)) : elems; var dom = _this._makeDomArray(domSrc, i < lastIdx); // Add element after `this` element @@ -609,9 +619,9 @@ function before() { elems[_i] = arguments[_i]; } var lastIdx = this.length - 1; - return utils_1.domEach(this, function (el, i) { + return (0, utils_js_1.domEach)(this, function (el, i) { var parent = el.parent; - if (!htmlparser2_1.DomUtils.hasChildren(el) || !parent) { + if (!(0, domhandler_1.hasChildren)(el) || !parent) { return; } var siblings = parent.children; @@ -621,7 +631,7 @@ function before() { if (index < 0) return; var domSrc = typeof elems[0] === 'function' - ? elems[0].call(el, i, static_1.html(el.children)) + ? elems[0].call(el, i, _this._render(el.children)) : elems; var dom = _this._makeDomArray(domSrc, i < lastIdx); // Add element before `el` element @@ -656,7 +666,7 @@ function insertBefore(target) { var targetArr = this._make(target); this.remove(); var clones = []; - utils_1.domEach(targetArr, function (el) { + (0, utils_js_1.domEach)(targetArr, function (el) { var clonedSelf = _this.clone().toArray(); var parent = el.parent; if (!parent) { @@ -698,8 +708,8 @@ exports.insertBefore = insertBefore; function remove(selector) { // Filter if we have selector var elems = selector ? this.filter(selector) : this; - utils_1.domEach(elems, function (el) { - htmlparser2_1.DomUtils.removeElement(el); + (0, utils_js_1.domEach)(elems, function (el) { + (0, domutils_1.removeElement)(el); el.prev = el.next = el.parent = null; }); return this; @@ -728,7 +738,7 @@ exports.remove = remove; */ function replaceWith(content) { var _this = this; - return utils_1.domEach(this, function (el, i) { + return (0, utils_js_1.domEach)(this, function (el, i) { var parent = el.parent; if (!parent) { return; @@ -740,7 +750,7 @@ function replaceWith(content) { * In the case that `dom` contains nodes that already exist in other * structures, ensure those nodes are properly removed. */ - parse_1.update(dom, null); + (0, parse_js_1.update)(dom, null); var index = siblings.indexOf(el); // Completely remove old element uniqueSplice(siblings, index, 1, dom, parent); @@ -766,8 +776,8 @@ exports.replaceWith = replaceWith; * @see {@link https://api.jquery.com/empty/} */ function empty() { - return utils_1.domEach(this, function (el) { - if (!htmlparser2_1.DomUtils.hasChildren(el)) + return (0, utils_js_1.domEach)(this, function (el) { + if (!(0, domhandler_1.hasChildren)(el)) return; el.children.forEach(function (child) { child.next = child.prev = child.parent = null; @@ -777,25 +787,23 @@ function empty() { } exports.empty = empty; function html(str) { + var _this = this; if (str === undefined) { var el = this[0]; - if (!el || !htmlparser2_1.DomUtils.hasChildren(el)) + if (!el || !(0, domhandler_1.hasChildren)(el)) return null; - return static_1.html(el.children, this.options); + return this._render(el.children); } - // Keep main options unchanged - var opts = tslib_1.__assign(tslib_1.__assign({}, this.options), { context: null }); - return utils_1.domEach(this, function (el) { - if (!htmlparser2_1.DomUtils.hasChildren(el)) + return (0, utils_js_1.domEach)(this, function (el) { + if (!(0, domhandler_1.hasChildren)(el)) return; el.children.forEach(function (child) { child.next = child.prev = child.parent = null; }); - opts.context = el; - var content = utils_1.isCheerio(str) + var content = (0, utils_js_1.isCheerio)(str) ? str.toArray() - : parse_1.default("" + str, opts, false).children; - parse_1.update(content, el); + : _this._parse("".concat(str), _this.options, false, el).children; + (0, parse_js_1.update)(content, el); }); } exports.html = html; @@ -806,30 +814,30 @@ exports.html = html; * @returns The rendered document. */ function toString() { - return static_1.html(this, this.options); + return this._render(this); } exports.toString = toString; function text(str) { var _this = this; // If `str` is undefined, act as a "getter" if (str === undefined) { - return static_1.text(this); + return (0, static_js_1.text)(this); } if (typeof str === 'function') { // Function support - return utils_1.domEach(this, function (el, i) { - text.call(_this._make(el), str.call(el, i, static_1.text([el]))); + return (0, utils_js_1.domEach)(this, function (el, i) { + return _this._make(el).text(str.call(el, i, (0, static_js_1.text)([el]))); }); } // Append text node to each selected elements - return utils_1.domEach(this, function (el) { - if (!htmlparser2_1.DomUtils.hasChildren(el)) + return (0, utils_js_1.domEach)(this, function (el) { + if (!(0, domhandler_1.hasChildren)(el)) return; el.children.forEach(function (child) { child.next = child.prev = child.parent = null; }); - var textNode = new domhandler_2.Text(str); - parse_1.update(textNode, el); + var textNode = new domhandler_1.Text("".concat(str)); + (0, parse_js_1.update)(textNode, el); }); } exports.text = text; @@ -847,6 +855,7 @@ exports.text = text; * @see {@link https://api.jquery.com/clone/} */ function clone() { - return this._make(utils_1.cloneDom(this.get())); + return this._make((0, utils_js_1.cloneDom)(this.get())); } exports.clone = clone; +//# sourceMappingURL=manipulation.js.map \ No newline at end of file diff --git a/node_modules/cheerio/lib/api/traversing.d.ts b/node_modules/cheerio/lib/api/traversing.d.ts index 7cee2ee..614c0ae 100644 --- a/node_modules/cheerio/lib/api/traversing.d.ts +++ b/node_modules/cheerio/lib/api/traversing.d.ts @@ -3,9 +3,9 @@ * * @module cheerio/traversing */ -import { Node, Element, Document } from 'domhandler'; -import type { Cheerio } from '../cheerio'; -import type { AcceptedFilters } from '../types'; +import { AnyNode, Element, Document } from 'domhandler'; +import type { Cheerio } from '../cheerio.js'; +import type { AcceptedFilters } from '../types.js'; /** * Get the descendants of each element in the current set of matched elements, * filtered by a selector, jQuery object, or element. @@ -24,7 +24,7 @@ import type { AcceptedFilters } from '../types'; * @returns The found elements. * @see {@link https://api.jquery.com/find/} */ -export declare function find(this: Cheerio, selectorOrHaystack?: string | Cheerio | Element): Cheerio; +export declare function find(this: Cheerio, selectorOrHaystack?: string | Cheerio | Element): Cheerio; /** * Get the parent of each element in the current set of matched elements, * optionally filtered by a selector. @@ -41,7 +41,7 @@ export declare function find(this: Cheerio, selectorOrHaystac * @returns The parents. * @see {@link https://api.jquery.com/parent/} */ -export declare const parent: (this: Cheerio, selector?: AcceptedFilters | undefined) => Cheerio; +export declare const parent: (this: Cheerio, selector?: AcceptedFilters) => Cheerio; /** * Get a set of parents filtered by `selector` of each element in the current * set of match elements. @@ -60,7 +60,7 @@ export declare const parent: (this: Cheerio, selector?: Accep * @returns The parents. * @see {@link https://api.jquery.com/parents/} */ -export declare const parents: (this: Cheerio, selector?: AcceptedFilters | undefined) => Cheerio; +export declare const parents: (this: Cheerio, selector?: AcceptedFilters) => Cheerio; /** * Get the ancestors of each element in the current set of matched elements, up * to but not including the element matched by the selector, DOM node, or cheerio object. @@ -78,7 +78,7 @@ export declare const parents: (this: Cheerio, selector?: Acce * @returns The parents. * @see {@link https://api.jquery.com/parentsUntil/} */ -export declare const parentsUntil: (this: Cheerio, selector?: AcceptedFilters | null | undefined, filterSelector?: AcceptedFilters | undefined) => Cheerio; +export declare const parentsUntil: (this: Cheerio, selector?: AcceptedFilters | null, filterSelector?: AcceptedFilters) => Cheerio; /** * For each element in the set, get the first element that matches the selector * by testing the element itself and traversing up through its ancestors in the DOM tree. @@ -104,7 +104,7 @@ export declare const parentsUntil: (this: Cheerio, selector?: * @returns The closest nodes. * @see {@link https://api.jquery.com/closest/} */ -export declare function closest(this: Cheerio, selector?: AcceptedFilters): Cheerio; +export declare function closest(this: Cheerio, selector?: AcceptedFilters): Cheerio; /** * Gets the next sibling of the first selected element, optionally filtered by a selector. * @@ -120,7 +120,7 @@ export declare function closest(this: Cheerio, selector?: Acc * @returns The next nodes. * @see {@link https://api.jquery.com/next/} */ -export declare const next: (this: Cheerio, selector?: AcceptedFilters | undefined) => Cheerio; +export declare const next: (this: Cheerio, selector?: AcceptedFilters) => Cheerio; /** * Gets all the following siblings of the first selected element, optionally * filtered by a selector. @@ -139,7 +139,7 @@ export declare const next: (this: Cheerio, selector?: Accepte * @returns The next nodes. * @see {@link https://api.jquery.com/nextAll/} */ -export declare const nextAll: (this: Cheerio, selector?: AcceptedFilters | undefined) => Cheerio; +export declare const nextAll: (this: Cheerio, selector?: AcceptedFilters) => Cheerio; /** * Gets all the following siblings up to but not including the element matched * by the selector, optionally filtered by another selector. @@ -157,7 +157,7 @@ export declare const nextAll: (this: Cheerio, selector?: Acce * @returns The next nodes. * @see {@link https://api.jquery.com/nextUntil/} */ -export declare const nextUntil: (this: Cheerio, selector?: AcceptedFilters | null | undefined, filterSelector?: AcceptedFilters | undefined) => Cheerio; +export declare const nextUntil: (this: Cheerio, selector?: AcceptedFilters | null, filterSelector?: AcceptedFilters) => Cheerio; /** * Gets the previous sibling of the first selected element optionally filtered * by a selector. @@ -174,7 +174,7 @@ export declare const nextUntil: (this: Cheerio, selector?: Ac * @returns The previous nodes. * @see {@link https://api.jquery.com/prev/} */ -export declare const prev: (this: Cheerio, selector?: AcceptedFilters | undefined) => Cheerio; +export declare const prev: (this: Cheerio, selector?: AcceptedFilters) => Cheerio; /** * Gets all the preceding siblings of the first selected element, optionally * filtered by a selector. @@ -194,7 +194,7 @@ export declare const prev: (this: Cheerio, selector?: Accepte * @returns The previous nodes. * @see {@link https://api.jquery.com/prevAll/} */ -export declare const prevAll: (this: Cheerio, selector?: AcceptedFilters | undefined) => Cheerio; +export declare const prevAll: (this: Cheerio, selector?: AcceptedFilters) => Cheerio; /** * Gets all the preceding siblings up to but not including the element matched * by the selector, optionally filtered by another selector. @@ -212,7 +212,7 @@ export declare const prevAll: (this: Cheerio, selector?: Acce * @returns The previous nodes. * @see {@link https://api.jquery.com/prevUntil/} */ -export declare const prevUntil: (this: Cheerio, selector?: AcceptedFilters | null | undefined, filterSelector?: AcceptedFilters | undefined) => Cheerio; +export declare const prevUntil: (this: Cheerio, selector?: AcceptedFilters | null, filterSelector?: AcceptedFilters) => Cheerio; /** * Get the siblings of each element (excluding the element) in the set of * matched elements, optionally filtered by a selector. @@ -232,9 +232,9 @@ export declare const prevUntil: (this: Cheerio, selector?: Ac * @returns The siblings. * @see {@link https://api.jquery.com/siblings/} */ -export declare const siblings: (this: Cheerio, selector?: AcceptedFilters | undefined) => Cheerio; +export declare const siblings: (this: Cheerio, selector?: AcceptedFilters) => Cheerio; /** - * Gets the children of the first selected element. + * Gets the element children of each element in the set of matched elements. * * @category Traversing * @example @@ -251,7 +251,7 @@ export declare const siblings: (this: Cheerio, selector?: Acc * @returns The children. * @see {@link https://api.jquery.com/children/} */ -export declare const children: (this: Cheerio, selector?: AcceptedFilters | undefined) => Cheerio; +export declare const children: (this: Cheerio, selector?: AcceptedFilters) => Cheerio; /** * Gets the children of each element in the set of matched elements, including * text and comment nodes. @@ -267,7 +267,7 @@ export declare const children: (this: Cheerio, selector?: Acc * @returns The children. * @see {@link https://api.jquery.com/contents/} */ -export declare function contents(this: Cheerio): Cheerio; +export declare function contents(this: Cheerio): Cheerio; /** * Iterates over a cheerio object, executing a function for each matched * element. When the callback is fired, the function is fired in the context of @@ -384,9 +384,9 @@ export declare function filter(this: Cheerio, match: (this: T export declare function filter>(this: Cheerio, match: S): Cheerio; export declare function filterArray(nodes: T[], match: AcceptedFilters, xmlMode?: boolean, root?: Document): Element[] | T[]; /** - * Checks the current list of elements and returns `true` if *any* of the + * Checks the current list of elements and returns `true` if _any_ of the * elements match the selector. If using an element or Cheerio selection, - * returns `true` if *any* of the elements match. If using a predicate function, + * returns `true` if _any_ of the elements match. If using a predicate function, * the function is executed in the context of the selected element, so `this` * refers to the current element. * @@ -429,7 +429,7 @@ export declare function is(this: Cheerio, selector?: AcceptedFilters): * @returns The filtered collection. * @see {@link https://api.jquery.com/not/} */ -export declare function not(this: Cheerio, match: AcceptedFilters): Cheerio; +export declare function not(this: Cheerio, match: AcceptedFilters): Cheerio; /** * Filters the set of matched elements to only those which have the given DOM * element as a descendant or which have a descendant that matches the given @@ -454,7 +454,7 @@ export declare function not(this: Cheerio, match: AcceptedFil * @returns The filtered collection. * @see {@link https://api.jquery.com/has/} */ -export declare function has(this: Cheerio, selectorOrHaystack: string | Cheerio | Element): Cheerio; +export declare function has(this: Cheerio, selectorOrHaystack: string | Cheerio | Element): Cheerio; /** * Will select the first element of a cheerio object. * @@ -469,7 +469,7 @@ export declare function has(this: Cheerio, selectorOrHaystack: s * @returns The first element. * @see {@link https://api.jquery.com/first/} */ -export declare function first(this: Cheerio): Cheerio; +export declare function first(this: Cheerio): Cheerio; /** * Will select the last element of a cheerio object. * @@ -520,7 +520,7 @@ export declare function eq(this: Cheerio, i: number): Cheerio; * @returns The element at the `i`th position. * @see {@link https://api.jquery.com/get/} */ -export declare function get(this: Cheerio, i: number): T; +export declare function get(this: Cheerio, i: number): T | undefined; /** * Retrieve all elements matched by the Cheerio object, as an array. * @@ -567,7 +567,7 @@ export declare function toArray(this: Cheerio): T[]; * @returns The index of the element. * @see {@link https://api.jquery.com/index/} */ -export declare function index(this: Cheerio, selectorOrNeedle?: string | Cheerio | Node): number; +export declare function index(this: Cheerio, selectorOrNeedle?: string | Cheerio | AnyNode): number; /** * Gets the elements matching the specified range (0-based position). * @@ -582,9 +582,9 @@ export declare function index(this: Cheerio, selectorOrNeedle * //=> 1 * ``` * - * @param start - An position at which the elements begin to be selected. If + * @param start - A position at which the elements begin to be selected. If * negative, it indicates an offset from the end of the set. - * @param end - An position at which the elements stop being selected. If + * @param end - A position at which the elements stop being selected. If * negative, it indicates an offset from the end of the set. If omitted, the * range continues until the end of the set. * @returns The elements matching the specified range. @@ -606,7 +606,7 @@ export declare function slice(this: Cheerio, start?: number, end?: number) * @returns The previous state of the set of matched elements. * @see {@link https://api.jquery.com/end/} */ -export declare function end(this: Cheerio): Cheerio; +export declare function end(this: Cheerio): Cheerio; /** * Add elements to the set of matched elements. * @@ -623,7 +623,7 @@ export declare function end(this: Cheerio): Cheerio; * @returns The combined set. * @see {@link https://api.jquery.com/add/} */ -export declare function add(this: Cheerio, other: string | Cheerio | S | S[], context?: Cheerio | string): Cheerio; +export declare function add(this: Cheerio, other: string | Cheerio | S | S[], context?: Cheerio | string): Cheerio; /** * Add the previous set of elements on the stack to the current set, optionally * filtered by a selector. @@ -640,5 +640,5 @@ export declare function add(this: Cheerio, ot * @returns The combined set. * @see {@link https://api.jquery.com/addBack/} */ -export declare function addBack(this: Cheerio, selector?: string): Cheerio; +export declare function addBack(this: Cheerio, selector?: string): Cheerio; //# sourceMappingURL=traversing.d.ts.map \ No newline at end of file diff --git a/node_modules/cheerio/lib/api/traversing.d.ts.map b/node_modules/cheerio/lib/api/traversing.d.ts.map index ec73e8f..5902b0e 100644 --- a/node_modules/cheerio/lib/api/traversing.d.ts.map +++ b/node_modules/cheerio/lib/api/traversing.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"traversing.d.ts","sourceRoot":"","sources":["../../src/api/traversing.ts"],"names":[],"mappings":"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"} \ No newline at end of file +{"version":3,"file":"traversing.d.ts","sourceRoot":"https://raw.githubusercontent.com/cheeriojs/cheerio/d1cbc66d53392ce8bf6cd0068f675836372d2bf3/src/","sources":["api/traversing.ts"],"names":[],"mappings":"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"} \ No newline at end of file diff --git a/node_modules/cheerio/lib/api/traversing.js b/node_modules/cheerio/lib/api/traversing.js index 3d9ea8f..1a43a58 100644 --- a/node_modules/cheerio/lib/api/traversing.js +++ b/node_modules/cheerio/lib/api/traversing.js @@ -4,15 +4,45 @@ * * @module cheerio/traversing */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.addBack = exports.add = exports.end = exports.slice = exports.index = exports.toArray = exports.get = exports.eq = exports.last = exports.first = exports.has = exports.not = exports.is = exports.filterArray = exports.filter = exports.map = exports.each = exports.contents = exports.children = exports.siblings = exports.prevUntil = exports.prevAll = exports.prev = exports.nextUntil = exports.nextAll = exports.next = exports.closest = exports.parentsUntil = exports.parents = exports.parent = exports.find = void 0; -var tslib_1 = require("tslib"); var domhandler_1 = require("domhandler"); -var select = tslib_1.__importStar(require("cheerio-select")); -var utils_1 = require("../utils"); -var static_1 = require("../static"); -var htmlparser2_1 = require("htmlparser2"); -var uniqueSort = htmlparser2_1.DomUtils.uniqueSort; +var select = __importStar(require("cheerio-select")); +var utils_js_1 = require("../utils.js"); +var static_js_1 = require("../static.js"); +var domutils_1 = require("domutils"); var reSiblingSelector = /^\s*[~+]/; /** * Get the descendants of each element in the current set of matched elements, @@ -39,10 +69,10 @@ function find(selectorOrHaystack) { } var context = this.toArray(); if (typeof selectorOrHaystack !== 'string') { - var haystack = utils_1.isCheerio(selectorOrHaystack) + var haystack = (0, utils_js_1.isCheerio)(selectorOrHaystack) ? selectorOrHaystack.toArray() : [selectorOrHaystack]; - return this._make(haystack.filter(function (elem) { return context.some(function (node) { return static_1.contains(node, elem); }); })); + return this._make(haystack.filter(function (elem) { return context.some(function (node) { return (0, static_js_1.contains)(node, elem); }); })); } var elems = reSiblingSelector.test(selectorOrHaystack) ? context @@ -50,7 +80,12 @@ function find(selectorOrHaystack) { var options = { context: context, root: (_a = this._root) === null || _a === void 0 ? void 0 : _a[0], + // Pass options that are recognized by `cheerio-select` xmlMode: this.options.xmlMode, + lowerCaseTags: this.options.lowerCaseTags, + lowerCaseAttributeNames: this.options.lowerCaseAttributeNames, + pseudos: this.options.pseudos, + quirksMode: this.options.quirksMode, }; return this._make(select.select(selectorOrHaystack, elems, options)); } @@ -118,7 +153,7 @@ function _matchUntil(nextElem) { var matches = null; var innerMatcher = _getMatcher(function (nextElem, elems) { var matched = []; - utils_1.domEach(elems, function (elem) { + (0, utils_js_1.domEach)(elems, function (elem) { for (var next_1; (next_1 = nextElem(elem)); elem = next_1) { // FIXME: `matched` might contain duplicates here and the index is too large. if (matches === null || matches === void 0 ? void 0 : matches(next_1, matched.length)) @@ -127,7 +162,7 @@ function _matchUntil(nextElem) { } }); return matched; - }).apply(void 0, tslib_1.__spreadArray([nextElem], postFns)); + }).apply(void 0, __spreadArray([nextElem], postFns, false)); return function (selector, filterSelector) { var _this = this; // Override `matches` variable with the new target. @@ -164,7 +199,7 @@ function _removeDuplicates(elems) { */ exports.parent = _singleMatcher(function (_a) { var parent = _a.parent; - return (parent && !domhandler_1.isDocument(parent) ? parent : null); + return (parent && !(0, domhandler_1.isDocument)(parent) ? parent : null); }, _removeDuplicates); /** * Get a set of parents filtered by `selector` of each element in the current @@ -186,12 +221,12 @@ exports.parent = _singleMatcher(function (_a) { */ exports.parents = _matcher(function (elem) { var matched = []; - while (elem.parent && !domhandler_1.isDocument(elem.parent)) { + while (elem.parent && !(0, domhandler_1.isDocument)(elem.parent)) { matched.push(elem.parent); elem = elem.parent; } return matched; -}, uniqueSort, function (elems) { return elems.reverse(); }); +}, domutils_1.uniqueSort, function (elems) { return elems.reverse(); }); /** * Get the ancestors of each element in the current set of matched elements, up * to but not including the element matched by the selector, DOM node, or cheerio object. @@ -211,8 +246,8 @@ exports.parents = _matcher(function (elem) { */ exports.parentsUntil = _matchUntil(function (_a) { var parent = _a.parent; - return (parent && !domhandler_1.isDocument(parent) ? parent : null); -}, uniqueSort, function (elems) { return elems.reverse(); }); + return (parent && !(0, domhandler_1.isDocument)(parent) ? parent : null); +}, domutils_1.uniqueSort, function (elems) { return elems.reverse(); }); /** * For each element in the set, get the first element that matches the selector * by testing the element itself and traversing up through its ancestors in the DOM tree. @@ -239,19 +274,23 @@ exports.parentsUntil = _matchUntil(function (_a) { * @see {@link https://api.jquery.com/closest/} */ function closest(selector) { - var _this = this; + var _a; var set = []; if (!selector) { return this._make(set); } - utils_1.domEach(this, function (elem) { - var _a; - while (elem && elem.type !== 'root') { - if (!selector || - filterArray([elem], selector, _this.options.xmlMode, (_a = _this._root) === null || _a === void 0 ? void 0 : _a[0]) - .length) { + var selectOpts = { + xmlMode: this.options.xmlMode, + root: (_a = this._root) === null || _a === void 0 ? void 0 : _a[0], + }; + var selectFn = typeof selector === 'string' + ? function (elem) { return select.is(elem, selector, selectOpts); } + : getFilterFn(selector); + (0, utils_js_1.domEach)(this, function (elem) { + while (elem && (0, utils_js_1.isTag)(elem)) { + if (selectFn(elem, 0)) { // Do not add duplicate elements to the set - if (elem && !set.includes(elem)) { + if (!set.includes(elem)) { set.push(elem); } break; @@ -277,7 +316,7 @@ exports.closest = closest; * @returns The next nodes. * @see {@link https://api.jquery.com/next/} */ -exports.next = _singleMatcher(function (elem) { return htmlparser2_1.DomUtils.nextElementSibling(elem); }); +exports.next = _singleMatcher(function (elem) { return (0, domutils_1.nextElementSibling)(elem); }); /** * Gets all the following siblings of the first selected element, optionally * filtered by a selector. @@ -300,7 +339,7 @@ exports.nextAll = _matcher(function (elem) { var matched = []; while (elem.next) { elem = elem.next; - if (utils_1.isTag(elem)) + if ((0, utils_js_1.isTag)(elem)) matched.push(elem); } return matched; @@ -322,7 +361,7 @@ exports.nextAll = _matcher(function (elem) { * @returns The next nodes. * @see {@link https://api.jquery.com/nextUntil/} */ -exports.nextUntil = _matchUntil(function (el) { return htmlparser2_1.DomUtils.nextElementSibling(el); }, _removeDuplicates); +exports.nextUntil = _matchUntil(function (el) { return (0, domutils_1.nextElementSibling)(el); }, _removeDuplicates); /** * Gets the previous sibling of the first selected element optionally filtered * by a selector. @@ -339,7 +378,7 @@ exports.nextUntil = _matchUntil(function (el) { return htmlparser2_1.DomUtils.ne * @returns The previous nodes. * @see {@link https://api.jquery.com/prev/} */ -exports.prev = _singleMatcher(function (elem) { return htmlparser2_1.DomUtils.prevElementSibling(elem); }); +exports.prev = _singleMatcher(function (elem) { return (0, domutils_1.prevElementSibling)(elem); }); /** * Gets all the preceding siblings of the first selected element, optionally * filtered by a selector. @@ -363,7 +402,7 @@ exports.prevAll = _matcher(function (elem) { var matched = []; while (elem.prev) { elem = elem.prev; - if (utils_1.isTag(elem)) + if ((0, utils_js_1.isTag)(elem)) matched.push(elem); } return matched; @@ -385,7 +424,7 @@ exports.prevAll = _matcher(function (elem) { * @returns The previous nodes. * @see {@link https://api.jquery.com/prevUntil/} */ -exports.prevUntil = _matchUntil(function (el) { return htmlparser2_1.DomUtils.prevElementSibling(el); }, _removeDuplicates); +exports.prevUntil = _matchUntil(function (el) { return (0, domutils_1.prevElementSibling)(el); }, _removeDuplicates); /** * Get the siblings of each element (excluding the element) in the set of * matched elements, optionally filtered by a selector. @@ -406,10 +445,10 @@ exports.prevUntil = _matchUntil(function (el) { return htmlparser2_1.DomUtils.pr * @see {@link https://api.jquery.com/siblings/} */ exports.siblings = _matcher(function (elem) { - return htmlparser2_1.DomUtils.getSiblings(elem).filter(function (el) { return utils_1.isTag(el) && el !== elem; }); -}, uniqueSort); + return (0, domutils_1.getSiblings)(elem).filter(function (el) { return (0, utils_js_1.isTag)(el) && el !== elem; }); +}, domutils_1.uniqueSort); /** - * Gets the children of the first selected element. + * Gets the element children of each element in the set of matched elements. * * @category Traversing * @example @@ -426,7 +465,7 @@ exports.siblings = _matcher(function (elem) { * @returns The children. * @see {@link https://api.jquery.com/children/} */ -exports.children = _matcher(function (elem) { return htmlparser2_1.DomUtils.getChildren(elem).filter(utils_1.isTag); }, _removeDuplicates); +exports.children = _matcher(function (elem) { return (0, domutils_1.getChildren)(elem).filter(utils_js_1.isTag); }, _removeDuplicates); /** * Gets the children of each element in the set of matched elements, including * text and comment nodes. @@ -444,7 +483,7 @@ exports.children = _matcher(function (elem) { return htmlparser2_1.DomUtils.getC */ function contents() { var elems = this.toArray().reduce(function (newElems, elem) { - return domhandler_1.hasChildren(elem) ? newElems.concat(elem.children) : newElems; + return (0, domhandler_1.hasChildren)(elem) ? newElems.concat(elem.children) : newElems; }, []); return this._make(elems); } @@ -530,7 +569,7 @@ function getFilterFn(match) { if (typeof match === 'function') { return function (el, i) { return match.call(el, i, el); }; } - if (utils_1.isCheerio(match)) { + if ((0, utils_js_1.isCheerio)(match)) { return function (el) { return Array.prototype.includes.call(match, el); }; } return function (el) { @@ -549,9 +588,9 @@ function filterArray(nodes, match, xmlMode, root) { } exports.filterArray = filterArray; /** - * Checks the current list of elements and returns `true` if *any* of the + * Checks the current list of elements and returns `true` if _any_ of the * elements match the selector. If using an element or Cheerio selection, - * returns `true` if *any* of the elements match. If using a predicate function, + * returns `true` if _any_ of the elements match. If using a predicate function, * the function is executed in the context of the selected element, so `this` * refers to the current element. * @@ -563,7 +602,7 @@ exports.filterArray = filterArray; function is(selector) { var nodes = this.toArray(); return typeof selector === 'string' - ? select.some(nodes.filter(utils_1.isTag), selector, this.options) + ? select.some(nodes.filter(utils_js_1.isTag), selector, this.options) : selector ? nodes.some(getFilterFn(selector)) : false; @@ -643,7 +682,7 @@ function has(selectorOrHaystack) { var _this = this; return this.filter(typeof selectorOrHaystack === 'string' ? // Using the `:has` selector here short-circuits searches. - ":has(" + selectorOrHaystack + ")" + ":has(".concat(selectorOrHaystack, ")") : function (_, el) { return _this._make(el).find(selectorOrHaystack).length > 0; }); } exports.has = has; @@ -766,8 +805,9 @@ function index(selectorOrNeedle) { needle = this[0]; } else { + // eslint-disable-next-line @typescript-eslint/no-this-alias $haystack = this; - needle = utils_1.isCheerio(selectorOrNeedle) + needle = (0, utils_js_1.isCheerio)(selectorOrNeedle) ? selectorOrNeedle[0] : selectorOrNeedle; } @@ -788,9 +828,9 @@ exports.index = index; * //=> 1 * ``` * - * @param start - An position at which the elements begin to be selected. If + * @param start - A position at which the elements begin to be selected. If * negative, it indicates an offset from the end of the set. - * @param end - An position at which the elements stop being selected. If + * @param end - A position at which the elements stop being selected. If * negative, it indicates an offset from the end of the set. If omitted, the * range continues until the end of the set. * @returns The elements matching the specified range. @@ -838,7 +878,7 @@ exports.end = end; */ function add(other, context) { var selection = this._make(other, context); - var contents = uniqueSort(tslib_1.__spreadArray(tslib_1.__spreadArray([], this.get()), selection.get())); + var contents = (0, domutils_1.uniqueSort)(__spreadArray(__spreadArray([], this.get(), true), selection.get(), true)); return this._make(contents); } exports.add = add; @@ -864,3 +904,4 @@ function addBack(selector) { : this; } exports.addBack = addBack; +//# sourceMappingURL=traversing.js.map \ No newline at end of file diff --git a/node_modules/cheerio/lib/cheerio.d.ts b/node_modules/cheerio/lib/cheerio.d.ts index 0564193..349d786 100644 --- a/node_modules/cheerio/lib/cheerio.d.ts +++ b/node_modules/cheerio/lib/cheerio.d.ts @@ -1,17 +1,18 @@ -import { InternalOptions } from './options'; -import type { Node, Document } from 'domhandler'; -import { BasicAcceptedElems } from './types'; -import * as Attributes from './api/attributes'; -import * as Traversing from './api/traversing'; -import * as Manipulation from './api/manipulation'; -import * as Css from './api/css'; -import * as Forms from './api/forms'; +/// +import type { InternalOptions } from './options.js'; +import type { AnyNode, Document, ParentNode } from 'domhandler'; +import type { BasicAcceptedElems } from './types.js'; +import * as Attributes from './api/attributes.js'; +import * as Traversing from './api/traversing.js'; +import * as Manipulation from './api/manipulation.js'; +import * as Css from './api/css.js'; +import * as Forms from './api/forms.js'; declare type AttributesType = typeof Attributes; declare type TraversingType = typeof Traversing; declare type ManipulationType = typeof Manipulation; declare type CssType = typeof Css; declare type FormsType = typeof Forms; -export declare class Cheerio implements ArrayLike { +export declare abstract class Cheerio implements ArrayLike { length: number; [index: number]: T; options: InternalOptions; @@ -20,21 +21,18 @@ export declare class Cheerio implements ArrayLike { * * @private */ - _root: Cheerio | undefined; - /** @function */ - find: typeof Traversing.find; + _root: Cheerio | null; /** * Instance of cheerio. Methods are specified in the modules. Usage of this - * constructor is not recommended. Please use $.load instead. + * constructor is not recommended. Please use `$.load` instead. * * @private - * @param selector - The new selection. - * @param context - Context of the selection. + * @param elements - The new selection. * @param root - Sets the root node. * @param options - Options for the instance. */ - constructor(selector?: T extends Node ? BasicAcceptedElems : Cheerio | T[], context?: BasicAcceptedElems | null, root?: BasicAcceptedElems | null, options?: InternalOptions); - prevObject: Cheerio | undefined; + constructor(elements: ArrayLike | undefined, root: Cheerio | null, options: InternalOptions); + prevObject: Cheerio | undefined; /** * Make a cheerio object. * @@ -43,7 +41,25 @@ export declare class Cheerio implements ArrayLike { * @param context - The context of the new object. * @returns The new cheerio object. */ - _make(dom: Cheerio | T[] | T | string, context?: BasicAcceptedElems): Cheerio; + abstract _make(dom: ArrayLike | T | string, context?: BasicAcceptedElems): Cheerio; + /** + * Parses some content. + * + * @private + * @param content - Content to parse. + * @param options - Options for parsing. + * @param isDocument - Allows parser to be switched to fragment mode. + * @returns A document containing the `content`. + */ + abstract _parse(content: string | Document | AnyNode | AnyNode[] | Buffer, options: InternalOptions, isDocument: boolean, context: ParentNode | null): Document; + /** + * Render an element or a set of elements. + * + * @private + * @param dom - DOM to render. + * @returns The rendered DOM. + */ + abstract _render(dom: AnyNode | ArrayLike): string; } export interface Cheerio extends AttributesType, TraversingType, ManipulationType, CssType, FormsType, Iterable { cheerio: '[cheerio object]'; diff --git a/node_modules/cheerio/lib/cheerio.d.ts.map b/node_modules/cheerio/lib/cheerio.d.ts.map index 16c32c3..13805da 100644 --- a/node_modules/cheerio/lib/cheerio.d.ts.map +++ b/node_modules/cheerio/lib/cheerio.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"cheerio.d.ts","sourceRoot":"","sources":["../src/cheerio.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAA6B,MAAM,WAAW,CAAC;AAEvE,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,KAAK,MAAM,aAAa,CAAC;AAErC,aAAK,cAAc,GAAG,OAAO,UAAU,CAAC;AACxC,aAAK,cAAc,GAAG,OAAO,UAAU,CAAC;AACxC,aAAK,gBAAgB,GAAG,OAAO,YAAY,CAAC;AAC5C,aAAK,OAAO,GAAG,OAAO,GAAG,CAAC;AAC1B,aAAK,SAAS,GAAG,OAAO,KAAK,CAAC;AAE9B,qBAAa,OAAO,CAAC,CAAC,CAAE,YAAW,SAAS,CAAC,CAAC,CAAC;IAC7C,MAAM,SAAK;IACX,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC;IAEnB,OAAO,EAAE,eAAe,CAAC;IACzB;;;;OAIG;IACH,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IACrC,gBAAgB;IAChB,IAAI,EAAG,OAAO,UAAU,CAAC,IAAI,CAAC;IAE9B;;;;;;;;;OASG;gBAED,QAAQ,CAAC,EAAE,CAAC,SAAS,IAAI,GAAG,kBAAkB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EACpE,OAAO,CAAC,EAAE,kBAAkB,CAAC,IAAI,CAAC,GAAG,IAAI,EACzC,IAAI,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GAAG,IAAI,EAC1C,OAAO,GAAE,eAAgC;IAsE3C,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;IACtC;;;;;;;OAOG;IACH,KAAK,CAAC,CAAC,EACL,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,MAAM,EAClC,OAAO,CAAC,EAAE,kBAAkB,CAAC,IAAI,CAAC,GACjC,OAAO,CAAC,CAAC,CAAC;CAWd;AAED,MAAM,WAAW,OAAO,CAAC,CAAC,CACxB,SAAQ,cAAc,EACpB,cAAc,EACd,gBAAgB,EAChB,OAAO,EACP,SAAS,EACT,QAAQ,CAAC,CAAC,CAAC;IACb,OAAO,EAAE,kBAAkB,CAAC;IAE5B,MAAM,EAAE,OAAO,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC;CACtC"} \ No newline at end of file +{"version":3,"file":"cheerio.d.ts","sourceRoot":"https://raw.githubusercontent.com/cheeriojs/cheerio/d1cbc66d53392ce8bf6cd0068f675836372d2bf3/src/","sources":["cheerio.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,YAAY,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAExC,aAAK,cAAc,GAAG,OAAO,UAAU,CAAC;AACxC,aAAK,cAAc,GAAG,OAAO,UAAU,CAAC;AACxC,aAAK,gBAAgB,GAAG,OAAO,YAAY,CAAC;AAC5C,aAAK,OAAO,GAAG,OAAO,GAAG,CAAC;AAC1B,aAAK,SAAS,GAAG,OAAO,KAAK,CAAC;AAE9B,8BAAsB,OAAO,CAAC,CAAC,CAAE,YAAW,SAAS,CAAC,CAAC,CAAC;IACtD,MAAM,SAAK;IACX,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC;IAEnB,OAAO,EAAE,eAAe,CAAC;IACzB;;;;OAIG;IACH,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;IAEhC;;;;;;;;OAQG;gBAED,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,EAClC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,EAC9B,OAAO,EAAE,eAAe;IAa1B,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IACrC;;;;;;;OAOG;IACH,QAAQ,CAAC,KAAK,CAAC,CAAC,EACd,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,EAC9B,OAAO,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,GACpC,OAAO,CAAC,CAAC,CAAC;IAEb;;;;;;;;OAQG;IACH,QAAQ,CAAC,MAAM,CACb,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,EAAE,GAAG,MAAM,EACzD,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,OAAO,EACnB,OAAO,EAAE,UAAU,GAAG,IAAI,GACzB,QAAQ;IAEX;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,MAAM;CAC5D;AAED,MAAM,WAAW,OAAO,CAAC,CAAC,CACxB,SAAQ,cAAc,EACpB,cAAc,EACd,gBAAgB,EAChB,OAAO,EACP,SAAS,EACT,QAAQ,CAAC,CAAC,CAAC;IACb,OAAO,EAAE,kBAAkB,CAAC;IAE5B,MAAM,EAAE,OAAO,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC;CACtC"} \ No newline at end of file diff --git a/node_modules/cheerio/lib/cheerio.js b/node_modules/cheerio/lib/cheerio.js index d14143e..0b1d053 100644 --- a/node_modules/cheerio/lib/cheerio.js +++ b/node_modules/cheerio/lib/cheerio.js @@ -1,99 +1,55 @@ "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.Cheerio = void 0; -var tslib_1 = require("tslib"); -var parse_1 = tslib_1.__importDefault(require("./parse")); -var options_1 = tslib_1.__importDefault(require("./options")); -var utils_1 = require("./utils"); -var Attributes = tslib_1.__importStar(require("./api/attributes")); -var Traversing = tslib_1.__importStar(require("./api/traversing")); -var Manipulation = tslib_1.__importStar(require("./api/manipulation")); -var Css = tslib_1.__importStar(require("./api/css")); -var Forms = tslib_1.__importStar(require("./api/forms")); +var Attributes = __importStar(require("./api/attributes.js")); +var Traversing = __importStar(require("./api/traversing.js")); +var Manipulation = __importStar(require("./api/manipulation.js")); +var Css = __importStar(require("./api/css.js")); +var Forms = __importStar(require("./api/forms.js")); var Cheerio = /** @class */ (function () { /** * Instance of cheerio. Methods are specified in the modules. Usage of this - * constructor is not recommended. Please use $.load instead. + * constructor is not recommended. Please use `$.load` instead. * * @private - * @param selector - The new selection. - * @param context - Context of the selection. + * @param elements - The new selection. * @param root - Sets the root node. * @param options - Options for the instance. */ - function Cheerio(selector, context, root, options) { - var _this = this; - if (options === void 0) { options = options_1.default; } + function Cheerio(elements, root, options) { this.length = 0; this.options = options; - // $(), $(null), $(undefined), $(false) - if (!selector) - return this; - if (root) { - if (typeof root === 'string') - root = parse_1.default(root, this.options, false); - this._root = new this.constructor(root, null, null, this.options); - // Add a cyclic reference, so that calling methods on `_root` never fails. - this._root._root = this._root; - } - // $($) - if (utils_1.isCheerio(selector)) - return selector; - var elements = typeof selector === 'string' && utils_1.isHtml(selector) - ? // $() - parse_1.default(selector, this.options, false).children - : isNode(selector) - ? // $(dom) - [selector] - : Array.isArray(selector) - ? // $([dom]) - selector - : null; + this._root = root; if (elements) { - elements.forEach(function (elem, idx) { - _this[idx] = elem; - }); + for (var idx = 0; idx < elements.length; idx++) { + this[idx] = elements[idx]; + } this.length = elements.length; - return this; } - // We know that our selector is a string now. - var search = selector; - var searchContext = !context - ? // If we don't have a context, maybe we have a root, from loading - this._root - : typeof context === 'string' - ? utils_1.isHtml(context) - ? // $('li', '
      ...
    ') - this._make(parse_1.default(context, this.options, false)) - : // $('li', 'ul') - ((search = context + " " + search), this._root) - : utils_1.isCheerio(context) - ? // $('li', $) - context - : // $('li', node), $('li', [nodes]) - this._make(context); - // If we still don't have a context, return - if (!searchContext) - return this; - /* - * #id, .class, tag - */ - // @ts-expect-error No good way to type this — we will always return `Cheerio` here. - return searchContext.find(search); } - /** - * Make a cheerio object. - * - * @private - * @param dom - The contents of the new object. - * @param context - The context of the new object. - * @returns The new cheerio object. - */ - Cheerio.prototype._make = function (dom, context) { - var cheerio = new this.constructor(dom, context, this._root, this.options); - cheerio.prevObject = this; - return cheerio; - }; return Cheerio; }()); exports.Cheerio = Cheerio; @@ -107,9 +63,4 @@ Cheerio.prototype.splice = Array.prototype.splice; Cheerio.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator]; // Plug in the API Object.assign(Cheerio.prototype, Attributes, Traversing, Manipulation, Css, Forms); -function isNode(obj) { - return (!!obj.name || - obj.type === 'root' || - obj.type === 'text' || - obj.type === 'comment'); -} +//# sourceMappingURL=cheerio.js.map \ No newline at end of file diff --git a/node_modules/cheerio/lib/index.d.ts b/node_modules/cheerio/lib/index.d.ts index e651f38..26b9f6f 100644 --- a/node_modules/cheerio/lib/index.d.ts +++ b/node_modules/cheerio/lib/index.d.ts @@ -1,31 +1,47 @@ +/// /** * The main types of Cheerio objects. * * @category Cheerio */ -export type { Cheerio } from './cheerio'; +export type { Cheerio } from './cheerio.js'; /** * Types used in signatures of Cheerio methods. * * @category Cheerio */ -export * from './types'; -export type { CheerioOptions, HTMLParser2Options, Parse5Options, } from './options'; +export * from './types.js'; +export type { CheerioOptions, HTMLParser2Options, Parse5Options, } from './options.js'; /** * Re-exporting all of the node types. * * @category DOM Node */ -export type { Node, NodeWithChildren, Element, Document } from 'domhandler'; -export * from './load'; -declare const _default: import("./load").CheerioAPI; +export type { Node, AnyNode, ParentNode, Element, Document } from 'domhandler'; +export type { CheerioAPI } from './load.js'; +/** + * Create a querying function, bound to a document created from the provided markup. + * + * Note that similar to web browser contexts, this operation may introduce + * ``, ``, and `` elements; set `isDocument` to `false` to + * switch to fragment mode and disable this. + * + * @param content - Markup to be loaded. + * @param options - Options for the created instance. + * @param isDocument - Allows parser to be switched to fragment mode. + * @returns The loaded document. + * @see {@link https://cheerio.js.org#loading} for additional usage information. + */ +export declare const load: (content: string | import("domhandler").AnyNode | import("domhandler").AnyNode[] | Buffer, options?: import("./options.js").CheerioOptions | null | undefined, isDocument?: boolean) => import("./load.js").CheerioAPI; /** * The default cheerio instance. * * @deprecated Use the function returned by `load` instead. */ +declare const _default: import("./load.js").CheerioAPI; export default _default; -import * as staticMethods from './static'; +export { html, xml, text } from './static.js'; +import * as staticMethods from './static.js'; /** * In order to promote consistency with the jQuery library, users are encouraged * to instead use the static method of the same name. diff --git a/node_modules/cheerio/lib/index.d.ts.map b/node_modules/cheerio/lib/index.d.ts.map index 6213cd7..ddc367f 100644 --- a/node_modules/cheerio/lib/index.d.ts.map +++ b/node_modules/cheerio/lib/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC;;;;GAIG;AACH,cAAc,SAAS,CAAC;AACxB,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,aAAa,GACd,MAAM,WAAW,CAAC;AACnB;;;;GAIG;AACH,YAAY,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE5E,cAAc,QAAQ,CAAC;;AAGvB;;;;GAIG;AACH,wBAAwB;AAExB,OAAO,KAAK,aAAa,MAAM,UAAU,CAAC;AAE1C;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAQ,QAAQ,+BAAkB,CAAC;AAE1C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAQ,KAAK,4BAAkB,CAAC;AAEvC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAQ,SAAS,gCAAkB,CAAC;AAE3C;;;;;;;;;;;GAWG;AACH,eAAO,MAAQ,IAAI,2BAAkB,CAAC"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"https://raw.githubusercontent.com/cheeriojs/cheerio/d1cbc66d53392ce8bf6cd0068f675836372d2bf3/src/","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;AACH,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;GAIG;AACH,cAAc,YAAY,CAAC;AAC3B,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,aAAa,GACd,MAAM,cAAc,CAAC;AACtB;;;;GAIG;AACH,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE/E,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAc5C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,IAAI,wNAIhB,CAAC;AAEF;;;;GAIG;;AACH,wBAAwB;AAExB,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,KAAK,aAAa,MAAM,aAAa,CAAC;AAE7C;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAQ,QAAQ,+BAAkB,CAAC;AAE1C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAQ,KAAK,4BAAkB,CAAC;AAEvC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAQ,SAAS,gCAAkB,CAAC;AAE3C;;;;;;;;;;;GAWG;AACH,eAAO,MAAQ,IAAI,2BAAkB,CAAC"} \ No newline at end of file diff --git a/node_modules/cheerio/lib/index.js b/node_modules/cheerio/lib/index.js index 98095d8..781f589 100644 --- a/node_modules/cheerio/lib/index.js +++ b/node_modules/cheerio/lib/index.js @@ -1,22 +1,81 @@ "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); -exports.root = exports.parseHTML = exports.merge = exports.contains = void 0; -var tslib_1 = require("tslib"); +exports.root = exports.parseHTML = exports.merge = exports.contains = exports.text = exports.xml = exports.html = exports.load = void 0; /** * Types used in signatures of Cheerio methods. * * @category Cheerio */ -tslib_1.__exportStar(require("./types"), exports); -tslib_1.__exportStar(require("./load"), exports); -var load_1 = require("./load"); +__exportStar(require("./types.js"), exports); +var load_js_1 = require("./load.js"); +var parse_js_1 = require("./parse.js"); +var parse5_adapter_js_1 = require("./parsers/parse5-adapter.js"); +var dom_serializer_1 = __importDefault(require("dom-serializer")); +var htmlparser2_1 = require("htmlparser2"); +var parse = (0, parse_js_1.getParse)(function (content, options, isDocument, context) { + return options.xmlMode || options._useHtmlParser2 + ? (0, htmlparser2_1.parseDocument)(content, options) + : (0, parse5_adapter_js_1.parseWithParse5)(content, options, isDocument, context); +}); +// Duplicate docs due to https://github.com/TypeStrong/typedoc/issues/1616 +/** + * Create a querying function, bound to a document created from the provided markup. + * + * Note that similar to web browser contexts, this operation may introduce + * ``, ``, and `` elements; set `isDocument` to `false` to + * switch to fragment mode and disable this. + * + * @param content - Markup to be loaded. + * @param options - Options for the created instance. + * @param isDocument - Allows parser to be switched to fragment mode. + * @returns The loaded document. + * @see {@link https://cheerio.js.org#loading} for additional usage information. + */ +exports.load = (0, load_js_1.getLoad)(parse, function (dom, options) { + return options.xmlMode || options._useHtmlParser2 + ? (0, dom_serializer_1.default)(dom, options) + : (0, parse5_adapter_js_1.renderWithParse5)(dom); +}); /** * The default cheerio instance. * * @deprecated Use the function returned by `load` instead. */ -exports.default = load_1.load([]); -var staticMethods = tslib_1.__importStar(require("./static")); +exports.default = (0, exports.load)([]); +var static_js_1 = require("./static.js"); +Object.defineProperty(exports, "html", { enumerable: true, get: function () { return static_js_1.html; } }); +Object.defineProperty(exports, "xml", { enumerable: true, get: function () { return static_js_1.xml; } }); +Object.defineProperty(exports, "text", { enumerable: true, get: function () { return static_js_1.text; } }); +var staticMethods = __importStar(require("./static.js")); /** * In order to promote consistency with the jQuery library, users are encouraged * to instead use the static method of the same name. @@ -79,3 +138,4 @@ exports.parseHTML = staticMethods.parseHTML; * ``` */ exports.root = staticMethods.root; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/cheerio/lib/load.d.ts b/node_modules/cheerio/lib/load.d.ts index 0dbc24f..49d1c84 100644 --- a/node_modules/cheerio/lib/load.d.ts +++ b/node_modules/cheerio/lib/load.d.ts @@ -1,18 +1,16 @@ /// -import { CheerioOptions, InternalOptions } from './options'; -import * as staticMethods from './static'; -import { Cheerio } from './cheerio'; -import type { Node, Document, Element } from 'domhandler'; -import type * as Load from './load'; -import { SelectorType, BasicAcceptedElems } from './types'; +import { CheerioOptions, InternalOptions } from './options.js'; +import * as staticMethods from './static.js'; +import { Cheerio } from './cheerio.js'; +import type { AnyNode, Document, Element } from 'domhandler'; +import type { SelectorType, BasicAcceptedElems } from './types.js'; declare type StaticType = typeof staticMethods; -declare type LoadType = typeof Load; /** * A querying function, bound to a document created from the provided markup. * * Also provides several helper methods for dealing with the document as a whole. */ -export interface CheerioAPI extends StaticType, LoadType { +export interface CheerioAPI extends StaticType { /** * This selector method is the starting point for traversing and manipulating * the document. Like jQuery, it's the primary method for selecting elements @@ -40,7 +38,7 @@ export interface CheerioAPI extends StaticType, LoadType { * contents of the document to query. * @param root - Optional HTML document string. */ - (selector?: S | BasicAcceptedElems, context?: BasicAcceptedElems | null, root?: BasicAcceptedElems, options?: CheerioOptions): Cheerio; + (selector?: S | BasicAcceptedElems, context?: BasicAcceptedElems | null, root?: BasicAcceptedElems, options?: CheerioOptions): Cheerio; /** * The root the document was originally loaded with. * @@ -55,19 +53,8 @@ export interface CheerioAPI extends StaticType, LoadType { _options: InternalOptions; /** Mimic jQuery's prototype alias for plugin authors. */ fn: typeof Cheerio.prototype; + load: ReturnType; } -/** - * Create a querying function, bound to a document created from the provided - * markup. Note that similar to web browser contexts, this operation may - * introduce ``, ``, and `` elements; set `isDocument` to - * `false` to switch to fragment mode and disable this. - * - * @param content - Markup to be loaded. - * @param options - Options for the created instance. - * @param isDocument - Allows parser to be switched to fragment mode. - * @returns The loaded document. - * @see {@link https://cheerio.js.org#loading} for additional usage information. - */ -export declare function load(content: string | Node | Node[] | Buffer, options?: CheerioOptions | null, isDocument?: boolean): CheerioAPI; +export declare function getLoad(parse: typeof Cheerio.prototype._parse, render: (dom: AnyNode | ArrayLike, options: InternalOptions) => string): (content: string | AnyNode | AnyNode[] | Buffer, options?: CheerioOptions | null, isDocument?: boolean) => CheerioAPI; export {}; //# sourceMappingURL=load.d.ts.map \ No newline at end of file diff --git a/node_modules/cheerio/lib/load.d.ts.map b/node_modules/cheerio/lib/load.d.ts.map index 37da605..8032114 100644 --- a/node_modules/cheerio/lib/load.d.ts.map +++ b/node_modules/cheerio/lib/load.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,cAAc,EACd,eAAe,EAGhB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,aAAa,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,KAAK,IAAI,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE3D,aAAK,UAAU,GAAG,OAAO,aAAa,CAAC;AACvC,aAAK,QAAQ,GAAG,OAAO,IAAI,CAAC;AAE5B;;;;GAIG;AACH,MAAM,WAAW,UAAW,SAAQ,UAAU,EAAE,QAAQ;IACtD;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,SAAS,MAAM,EAC/B,QAAQ,CAAC,EAAE,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,EACpC,OAAO,CAAC,EAAE,kBAAkB,CAAC,IAAI,CAAC,GAAG,IAAI,EACzC,IAAI,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,EACnC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,CAAC,SAAS,YAAY,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC;IAEjD;;;;OAIG;IACH,KAAK,EAAE,QAAQ,CAAC;IAEhB;;;;OAIG;IACH,QAAQ,EAAE,eAAe,CAAC;IAE1B,yDAAyD;IACzD,EAAE,EAAE,OAAO,OAAO,CAAC,SAAS,CAAC;CAC9B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,IAAI,CAClB,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,EAAE,GAAG,MAAM,EACxC,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI,EAC/B,UAAU,UAAO,GAChB,UAAU,CAsCZ"} \ No newline at end of file +{"version":3,"file":"load.d.ts","sourceRoot":"https://raw.githubusercontent.com/cheeriojs/cheerio/d1cbc66d53392ce8bf6cd0068f675836372d2bf3/src/","sources":["load.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,cAAc,EACd,eAAe,EAGhB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,aAAa,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAc,MAAM,YAAY,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEnE,aAAK,UAAU,GAAG,OAAO,aAAa,CAAC;AAEvC;;;;GAIG;AACH,MAAM,WAAW,UAAW,SAAQ,UAAU;IAC5C;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,SAAS,MAAM,EAClC,QAAQ,CAAC,EAAE,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,EACpC,OAAO,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,GAAG,IAAI,EAC5C,IAAI,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,EACnC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,CAAC,SAAS,YAAY,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC;IAEjD;;;;OAIG;IACH,KAAK,EAAE,QAAQ,CAAC;IAEhB;;;;OAIG;IACH,QAAQ,EAAE,eAAe,CAAC;IAE1B,yDAAyD;IACzD,EAAE,EAAE,OAAO,OAAO,CAAC,SAAS,CAAC;IAE7B,IAAI,EAAE,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;CAClC;AAED,wBAAgB,OAAO,CACrB,KAAK,EAAE,OAAO,OAAO,CAAC,SAAS,CAAC,MAAM,EACtC,MAAM,EAAE,CACN,GAAG,EAAE,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,EACjC,OAAO,EAAE,eAAe,KACrB,MAAM,aAgBA,MAAM,GAAG,OAAO,GAAG,OAAO,EAAE,GAAG,MAAM,YACpC,cAAc,GAAG,IAAI,2BAE9B,UAAU,CAyId"} \ No newline at end of file diff --git a/node_modules/cheerio/lib/load.js b/node_modules/cheerio/lib/load.js index 2603cea..ae9aa98 100644 --- a/node_modules/cheerio/lib/load.js +++ b/node_modules/cheerio/lib/load.js @@ -1,53 +1,179 @@ "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.load = void 0; -var tslib_1 = require("tslib"); -var options_1 = tslib_1.__importStar(require("./options")); -var staticMethods = tslib_1.__importStar(require("./static")); -var cheerio_1 = require("./cheerio"); -var parse_1 = tslib_1.__importDefault(require("./parse")); -/** - * Create a querying function, bound to a document created from the provided - * markup. Note that similar to web browser contexts, this operation may - * introduce ``, ``, and `` elements; set `isDocument` to - * `false` to switch to fragment mode and disable this. - * - * @param content - Markup to be loaded. - * @param options - Options for the created instance. - * @param isDocument - Allows parser to be switched to fragment mode. - * @returns The loaded document. - * @see {@link https://cheerio.js.org#loading} for additional usage information. - */ -function load(content, options, isDocument) { - if (isDocument === void 0) { isDocument = true; } - if (content == null) { - throw new Error('cheerio.load() expects a string'); - } - var internalOpts = tslib_1.__assign(tslib_1.__assign({}, options_1.default), options_1.flatten(options)); - var root = parse_1.default(content, internalOpts, isDocument); - /** Create an extended class here, so that extensions only live on one instance. */ - var LoadedCheerio = /** @class */ (function (_super) { - tslib_1.__extends(LoadedCheerio, _super); - function LoadedCheerio() { - return _super !== null && _super.apply(this, arguments) || this; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; } - return LoadedCheerio; - }(cheerio_1.Cheerio)); - function initialize(selector, context, r, opts) { - if (r === void 0) { r = root; } - return new LoadedCheerio(selector, context, r, tslib_1.__assign(tslib_1.__assign({}, internalOpts), options_1.flatten(opts))); + return t; + }; + return __assign.apply(this, arguments); +}; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; } - // Add in static methods & properties - Object.assign(initialize, staticMethods, { - load: load, - // `_root` and `_options` are used in static methods. - _root: root, - _options: internalOpts, - // Add `fn` for plugins - fn: LoadedCheerio.prototype, - // Add the prototype here to maintain `instanceof` behavior. - prototype: LoadedCheerio.prototype, - }); - return initialize; + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getLoad = void 0; +var options_js_1 = __importStar(require("./options.js")); +var staticMethods = __importStar(require("./static.js")); +var cheerio_js_1 = require("./cheerio.js"); +var utils_js_1 = require("./utils.js"); +function getLoad(parse, render) { + /** + * Create a querying function, bound to a document created from the provided markup. + * + * Note that similar to web browser contexts, this operation may introduce + * ``, ``, and `` elements; set `isDocument` to `false` to + * switch to fragment mode and disable this. + * + * @param content - Markup to be loaded. + * @param options - Options for the created instance. + * @param isDocument - Allows parser to be switched to fragment mode. + * @returns The loaded document. + * @see {@link https://cheerio.js.org#loading} for additional usage information. + */ + return function load(content, options, isDocument) { + if (isDocument === void 0) { isDocument = true; } + if (content == null) { + throw new Error('cheerio.load() expects a string'); + } + var internalOpts = __assign(__assign({}, options_js_1.default), (0, options_js_1.flatten)(options)); + var initialRoot = parse(content, internalOpts, isDocument, null); + /** Create an extended class here, so that extensions only live on one instance. */ + var LoadedCheerio = /** @class */ (function (_super) { + __extends(LoadedCheerio, _super); + function LoadedCheerio() { + return _super !== null && _super.apply(this, arguments) || this; + } + LoadedCheerio.prototype._make = function (selector, context) { + var cheerio = initialize(selector, context); + cheerio.prevObject = this; + return cheerio; + }; + LoadedCheerio.prototype._parse = function (content, options, isDocument, context) { + return parse(content, options, isDocument, context); + }; + LoadedCheerio.prototype._render = function (dom) { + return render(dom, this.options); + }; + return LoadedCheerio; + }(cheerio_js_1.Cheerio)); + function initialize(selector, context, root, opts) { + if (root === void 0) { root = initialRoot; } + // $($) + if (selector && (0, utils_js_1.isCheerio)(selector)) + return selector; + var options = __assign(__assign({}, internalOpts), (0, options_js_1.flatten)(opts)); + var r = typeof root === 'string' + ? [parse(root, options, false, null)] + : 'length' in root + ? root + : [root]; + var rootInstance = (0, utils_js_1.isCheerio)(r) + ? r + : new LoadedCheerio(r, null, options); + // Add a cyclic reference, so that calling methods on `_root` never fails. + rootInstance._root = rootInstance; + // $(), $(null), $(undefined), $(false) + if (!selector) { + return new LoadedCheerio(undefined, rootInstance, options); + } + var elements = typeof selector === 'string' && (0, utils_js_1.isHtml)(selector) + ? // $() + parse(selector, options, false, null).children + : isNode(selector) + ? // $(dom) + [selector] + : Array.isArray(selector) + ? // $([dom]) + selector + : undefined; + var instance = new LoadedCheerio(elements, rootInstance, options); + if (elements) { + return instance; + } + if (typeof selector !== 'string') { + throw new Error('Unexpected type of selector'); + } + // We know that our selector is a string now. + var search = selector; + var searchContext = !context + ? // If we don't have a context, maybe we have a root, from loading + rootInstance + : typeof context === 'string' + ? (0, utils_js_1.isHtml)(context) + ? // $('li', '
      ...
    ') + new LoadedCheerio([parse(context, options, false, null)], rootInstance, options) + : // $('li', 'ul') + ((search = "".concat(context, " ").concat(search)), rootInstance) + : (0, utils_js_1.isCheerio)(context) + ? // $('li', $) + context + : // $('li', node), $('li', [nodes]) + new LoadedCheerio(Array.isArray(context) ? context : [context], rootInstance, options); + // If we still don't have a context, return + if (!searchContext) + return instance; + /* + * #id, .class, tag + */ + return searchContext.find(search); + } + // Add in static methods & properties + Object.assign(initialize, staticMethods, { + load: load, + // `_root` and `_options` are used in static methods. + _root: initialRoot, + _options: internalOpts, + // Add `fn` for plugins + fn: LoadedCheerio.prototype, + // Add the prototype here to maintain `instanceof` behavior. + prototype: LoadedCheerio.prototype, + }); + return initialize; + }; } -exports.load = load; +exports.getLoad = getLoad; +function isNode(obj) { + return (!!obj.name || + obj.type === 'root' || + obj.type === 'text' || + obj.type === 'comment'); +} +//# sourceMappingURL=load.js.map \ No newline at end of file diff --git a/node_modules/cheerio/lib/options.d.ts b/node_modules/cheerio/lib/options.d.ts index d1c8df3..1e619b0 100644 --- a/node_modules/cheerio/lib/options.d.ts +++ b/node_modules/cheerio/lib/options.d.ts @@ -1,6 +1,12 @@ +/// import type { DomHandlerOptions } from 'domhandler'; import type { ParserOptions } from 'htmlparser2'; -/** Options accepted by htmlparser2, the default parser for XML. */ +import type { Options as SelectOptions } from 'cheerio-select'; +/** + * Options accepted by htmlparser2, the default parser for XML. + * + * @see https://github.com/fb55/htmlparser2/wiki/Parser-options + */ export interface HTMLParser2Options extends DomHandlerOptions, ParserOptions { } /** Options for parse5, the default parser for HTML. */ @@ -10,22 +16,75 @@ export interface Parse5Options { /** Enable location support for parse5. */ sourceCodeLocationInfo?: boolean; } -/** Internal options for Cheerio. */ -export interface InternalOptions extends HTMLParser2Options, Parse5Options { - _useHtmlParser2?: boolean; -} /** * Options accepted by Cheerio. * - * Please note that parser-specific options are *only recognized* if the + * Please note that parser-specific options are _only recognized_ if the * relevant parser is used. */ export interface CheerioOptions extends HTMLParser2Options, Parse5Options { - /** Suggested way of configuring htmlparser2 when wanting to parse XML. */ + /** Recommended way of configuring htmlparser2 when wanting to parse XML. */ xml?: HTMLParser2Options | boolean; + /** The base URI for the document. Used for the `href` and `src` props. */ + baseURI?: string | URL; + /** + * Is the document in quirks mode? + * + * This will lead to `.className` and `#id` being case-insensitive. + * + * @default false + */ + quirksMode?: SelectOptions['quirksMode']; + /** + * Extension point for pseudo-classes. + * + * Maps from names to either strings of functions. + * + * - A string value is a selector that the element must match to be selected. + * - A function is called with the element as its first argument, and optional + * parameters second. If it returns true, the element is selected. + * + * @example + * + * ```js + * const $ = cheerio.load( + * '
    ', + * { + * pseudos: { + * // `:foo` is an alias for `div.foo` + * foo: 'div.foo', + * // `:bar(val)` is equivalent to `[data-bar=val s]` + * bar: (el, val) => el.attribs['data-bar'] === val, + * }, + * } + * ); + * + * $(':foo').length; // 1 + * $('div:bar(boo)').length; // 1 + * $('div:bar(baz)').length; // 0 + * ``` + */ + pseudos?: SelectOptions['pseudos']; +} +/** Internal options for Cheerio. */ +export interface InternalOptions extends Omit { + /** + * Whether to use htmlparser2. + * + * This is set to true if `xml` is set to true. + */ + _useHtmlParser2?: boolean; } declare const defaultOpts: CheerioOptions; /** Cheerio default options. */ export default defaultOpts; +/** + * Flatten the options for Cheerio. + * + * This will set `_useHtmlParser2` to true if `xml` is set to true. + * + * @param options - The options to flatten. + * @returns The flattened options. + */ export declare function flatten(options?: CheerioOptions | null): InternalOptions | undefined; //# sourceMappingURL=options.d.ts.map \ No newline at end of file diff --git a/node_modules/cheerio/lib/options.d.ts.map b/node_modules/cheerio/lib/options.d.ts.map index 8b6d57f..80deafd 100644 --- a/node_modules/cheerio/lib/options.d.ts.map +++ b/node_modules/cheerio/lib/options.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,mEAAmE;AACnE,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB,EAAE,aAAa;CAAG;AAC/E,uDAAuD;AACvD,MAAM,WAAW,aAAa;IAC5B,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,0CAA0C;IAC1C,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,oCAAoC;AACpC,MAAM,WAAW,eAAgB,SAAQ,kBAAkB,EAAE,aAAa;IACxE,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAe,SAAQ,kBAAkB,EAAE,aAAa;IACvE,0EAA0E;IAC1E,GAAG,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC;CACpC;AAED,QAAA,MAAM,WAAW,EAAE,cAGlB,CAAC;AAEF,+BAA+B;AAC/B,eAAe,WAAW,CAAC;AAO3B,wBAAgB,OAAO,CACrB,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI,GAC9B,eAAe,GAAG,SAAS,CAM7B"} \ No newline at end of file +{"version":3,"file":"options.d.ts","sourceRoot":"https://raw.githubusercontent.com/cheeriojs/cheerio/d1cbc66d53392ce8bf6cd0068f675836372d2bf3/src/","sources":["options.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/D;;;;GAIG;AACH,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB,EAAE,aAAa;CAAG;AAC/E,uDAAuD;AACvD,MAAM,WAAW,aAAa;IAC5B,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,0CAA0C;IAC1C,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAe,SAAQ,kBAAkB,EAAE,aAAa;IACvE,4EAA4E;IAC5E,GAAG,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC;IAEnC,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAEvB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CACpC;AAED,oCAAoC;AACpC,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,cAAc,EAAE,KAAK,CAAC;IAClE;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,QAAA,MAAM,WAAW,EAAE,cAGlB,CAAC;AAEF,+BAA+B;AAC/B,eAAe,WAAW,CAAC;AAO3B;;;;;;;GAOG;AACH,wBAAgB,OAAO,CACrB,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI,GAC9B,eAAe,GAAG,SAAS,CAM7B"} \ No newline at end of file diff --git a/node_modules/cheerio/lib/options.js b/node_modules/cheerio/lib/options.js index cddb475..51890c2 100644 --- a/node_modules/cheerio/lib/options.js +++ b/node_modules/cheerio/lib/options.js @@ -1,7 +1,17 @@ "use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.flatten = void 0; -var tslib_1 = require("tslib"); var defaultOpts = { xml: false, decodeEntities: true, @@ -12,11 +22,20 @@ var xmlModeDefault = { _useHtmlParser2: true, xmlMode: true, }; +/** + * Flatten the options for Cheerio. + * + * This will set `_useHtmlParser2` to true if `xml` is set to true. + * + * @param options - The options to flatten. + * @returns The flattened options. + */ function flatten(options) { return (options === null || options === void 0 ? void 0 : options.xml) ? typeof options.xml === 'boolean' ? xmlModeDefault - : tslib_1.__assign(tslib_1.__assign({}, xmlModeDefault), options.xml) + : __assign(__assign({}, xmlModeDefault), options.xml) : options !== null && options !== void 0 ? options : undefined; } exports.flatten = flatten; +//# sourceMappingURL=options.js.map \ No newline at end of file diff --git a/node_modules/cheerio/lib/parse.d.ts b/node_modules/cheerio/lib/parse.d.ts index 87adbe1..ff5c9c6 100644 --- a/node_modules/cheerio/lib/parse.d.ts +++ b/node_modules/cheerio/lib/parse.d.ts @@ -1,7 +1,13 @@ /// -import { Node, Document, NodeWithChildren } from 'domhandler'; -import type { InternalOptions } from './options'; -export default function parse(content: string | Document | Node | Node[] | Buffer, options: InternalOptions, isDocument: boolean): Document; +import { AnyNode, Document, ParentNode } from 'domhandler'; +import type { InternalOptions } from './options.js'; +/** + * Get the parse function with options. + * + * @param parser - The parser function. + * @returns The parse function with options. + */ +export declare function getParse(parser: (content: string, options: InternalOptions, isDocument: boolean, context: ParentNode | null) => Document): (content: string | Document | AnyNode | AnyNode[] | Buffer, options: InternalOptions, isDocument: boolean, context: ParentNode | null) => Document; /** * Update the dom structure, for one changed layer. * @@ -9,5 +15,5 @@ export default function parse(content: string | Document | Node | Node[] | Buffe * @param parent - The new parent. * @returns The parent node. */ -export declare function update(newChilds: Node[] | Node, parent: NodeWithChildren | null): Node | null; +export declare function update(newChilds: AnyNode[] | AnyNode, parent: ParentNode | null): ParentNode | null; //# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/node_modules/cheerio/lib/parse.d.ts.map b/node_modules/cheerio/lib/parse.d.ts.map index 8b429ec..6452f0a 100644 --- a/node_modules/cheerio/lib/parse.d.ts.map +++ b/node_modules/cheerio/lib/parse.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":";AAGA,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,gBAAgB,EAEjB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAKjD,MAAM,CAAC,OAAO,UAAU,KAAK,CAC3B,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,GAAG,IAAI,EAAE,GAAG,MAAM,EACnD,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,OAAO,GAClB,QAAQ,CAyBV;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CACpB,SAAS,EAAE,IAAI,EAAE,GAAG,IAAI,EACxB,MAAM,EAAE,gBAAgB,GAAG,IAAI,GAC9B,IAAI,GAAG,IAAI,CA+Bb"} \ No newline at end of file +{"version":3,"file":"parse.d.ts","sourceRoot":"https://raw.githubusercontent.com/cheeriojs/cheerio/d1cbc66d53392ce8bf6cd0068f675836372d2bf3/src/","sources":["parse.ts"],"names":[],"mappings":";AACA,OAAO,EACL,OAAO,EACP,QAAQ,EACR,UAAU,EAEX,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD;;;;;GAKG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,CACN,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,OAAO,EACnB,OAAO,EAAE,UAAU,GAAG,IAAI,KACvB,QAAQ,aAYF,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,EAAE,GAAG,MAAM,WAChD,eAAe,cACZ,OAAO,WACV,UAAU,GAAG,IAAI,KACzB,QAAQ,CAwBZ;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CACpB,SAAS,EAAE,OAAO,EAAE,GAAG,OAAO,EAC9B,MAAM,EAAE,UAAU,GAAG,IAAI,GACxB,UAAU,GAAG,IAAI,CA+BnB"} \ No newline at end of file diff --git a/node_modules/cheerio/lib/parse.js b/node_modules/cheerio/lib/parse.js index cd92fc9..f4c4707 100644 --- a/node_modules/cheerio/lib/parse.js +++ b/node_modules/cheerio/lib/parse.js @@ -1,34 +1,44 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.update = void 0; -var htmlparser2_1 = require("htmlparser2"); -var htmlparser2_adapter_1 = require("./parsers/htmlparser2-adapter"); -var parse5_adapter_1 = require("./parsers/parse5-adapter"); +exports.update = exports.getParse = void 0; +var domutils_1 = require("domutils"); var domhandler_1 = require("domhandler"); -/* - * Parser +/** + * Get the parse function with options. + * + * @param parser - The parser function. + * @returns The parse function with options. */ -function parse(content, options, isDocument) { - if (typeof Buffer !== 'undefined' && Buffer.isBuffer(content)) { - content = content.toString(); - } - if (typeof content === 'string') { - return options.xmlMode || options._useHtmlParser2 - ? htmlparser2_adapter_1.parse(content, options) - : parse5_adapter_1.parse(content, options, isDocument); - } - var doc = content; - if (!Array.isArray(doc) && domhandler_1.isDocument(doc)) { - // If `doc` is already a root, just return it - return doc; - } - // Add conent to new root element - var root = new domhandler_1.Document([]); - // Update the DOM using the root - update(doc, root); - return root; +function getParse(parser) { + /** + * Parse a HTML string or a node. + * + * @param content - The HTML string or node. + * @param options - The parser options. + * @param isDocument - If `content` is a document. + * @param context - The context node in the DOM tree. + * @returns The parsed document node. + */ + return function parse(content, options, isDocument, context) { + if (typeof Buffer !== 'undefined' && Buffer.isBuffer(content)) { + content = content.toString(); + } + if (typeof content === 'string') { + return parser(content, options, isDocument, context); + } + var doc = content; + if (!Array.isArray(doc) && (0, domhandler_1.isDocument)(doc)) { + // If `doc` is already a root, just return it + return doc; + } + // Add conent to new root element + var root = new domhandler_1.Document([]); + // Update the DOM using the root + update(doc, root); + return root; + }; } -exports.default = parse; +exports.getParse = getParse; /** * Update the dom structure, for one changed layer. * @@ -51,7 +61,7 @@ function update(newChilds, parent) { var node = arr[i]; // Cleanly remove existing nodes from their previous structures. if (node.parent && node.parent.children !== arr) { - htmlparser2_1.DomUtils.removeElement(node); + (0, domutils_1.removeElement)(node); } if (parent) { node.prev = arr[i - 1] || null; @@ -65,3 +75,4 @@ function update(newChilds, parent) { return parent; } exports.update = update; +//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/node_modules/cheerio/lib/parsers/htmlparser2-adapter.d.ts b/node_modules/cheerio/lib/parsers/htmlparser2-adapter.d.ts deleted file mode 100644 index 7437310..0000000 --- a/node_modules/cheerio/lib/parsers/htmlparser2-adapter.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { parseDocument as parse } from 'htmlparser2'; -export { default as render } from 'dom-serializer'; -//# sourceMappingURL=htmlparser2-adapter.d.ts.map \ No newline at end of file diff --git a/node_modules/cheerio/lib/parsers/htmlparser2-adapter.d.ts.map b/node_modules/cheerio/lib/parsers/htmlparser2-adapter.d.ts.map deleted file mode 100644 index eaf18b9..0000000 --- a/node_modules/cheerio/lib/parsers/htmlparser2-adapter.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"htmlparser2-adapter.d.ts","sourceRoot":"","sources":["../../src/parsers/htmlparser2-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,KAAK,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/node_modules/cheerio/lib/parsers/htmlparser2-adapter.js b/node_modules/cheerio/lib/parsers/htmlparser2-adapter.js deleted file mode 100644 index a05f08d..0000000 --- a/node_modules/cheerio/lib/parsers/htmlparser2-adapter.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.render = exports.parse = void 0; -var htmlparser2_1 = require("htmlparser2"); -Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return htmlparser2_1.parseDocument; } }); -var dom_serializer_1 = require("dom-serializer"); -Object.defineProperty(exports, "render", { enumerable: true, get: function () { return __importDefault(dom_serializer_1).default; } }); diff --git a/node_modules/cheerio/lib/parsers/parse5-adapter.d.ts b/node_modules/cheerio/lib/parsers/parse5-adapter.d.ts index c262aec..986a117 100644 --- a/node_modules/cheerio/lib/parsers/parse5-adapter.d.ts +++ b/node_modules/cheerio/lib/parsers/parse5-adapter.d.ts @@ -1,9 +1,20 @@ -import { Node, Document } from 'domhandler'; -import type { InternalOptions } from '../options'; -interface Parse5Options extends InternalOptions { - context?: Node; -} -export declare function parse(content: string, options: Parse5Options, isDocument?: boolean): Document; -export declare function render(dom: Node | ArrayLike): string; -export {}; +import { AnyNode, Document, ParentNode } from 'domhandler'; +import type { InternalOptions } from '../options.js'; +/** + * Parse the content with `parse5` in the context of the given `ParentNode`. + * + * @param content - The content to parse. + * @param options - A set of options to use to parse. + * @param isDocument - Whether to parse the content as a full HTML document. + * @param context - The context in which to parse the content. + * @returns The parsed content. + */ +export declare function parseWithParse5(content: string, options: InternalOptions, isDocument: boolean, context: ParentNode | null): Document; +/** + * Renders the given DOM tree with `parse5` and returns the result as a string. + * + * @param dom - The DOM tree to render. + * @returns The rendered document. + */ +export declare function renderWithParse5(dom: AnyNode | ArrayLike): string; //# sourceMappingURL=parse5-adapter.d.ts.map \ No newline at end of file diff --git a/node_modules/cheerio/lib/parsers/parse5-adapter.d.ts.map b/node_modules/cheerio/lib/parsers/parse5-adapter.d.ts.map index 0f3fa87..75ae2e2 100644 --- a/node_modules/cheerio/lib/parsers/parse5-adapter.d.ts.map +++ b/node_modules/cheerio/lib/parsers/parse5-adapter.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"parse5-adapter.d.ts","sourceRoot":"","sources":["../../src/parsers/parse5-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAc,MAAM,YAAY,CAAC;AAGxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,UAAU,aAAc,SAAQ,eAAe;IAC7C,OAAO,CAAC,EAAE,IAAI,CAAC;CAChB;AAED,wBAAgB,KAAK,CACnB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,aAAa,EACtB,UAAU,CAAC,EAAE,OAAO,GACnB,QAAQ,CAiBV;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,CAgB1D"} \ No newline at end of file +{"version":3,"file":"parse5-adapter.d.ts","sourceRoot":"https://raw.githubusercontent.com/cheeriojs/cheerio/d1cbc66d53392ce8bf6cd0068f675836372d2bf3/src/","sources":["parsers/parse5-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAc,UAAU,EAAE,MAAM,YAAY,CAAC;AAGvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,OAAO,EACnB,OAAO,EAAE,UAAU,GAAG,IAAI,GACzB,QAAQ,CAaV;AAID;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,MAAM,CAqB1E"} \ No newline at end of file diff --git a/node_modules/cheerio/lib/parsers/parse5-adapter.js b/node_modules/cheerio/lib/parsers/parse5-adapter.js index 4b480b1..5851587 100644 --- a/node_modules/cheerio/lib/parsers/parse5-adapter.js +++ b/node_modules/cheerio/lib/parsers/parse5-adapter.js @@ -1,27 +1,48 @@ "use strict"; +var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +}; Object.defineProperty(exports, "__esModule", { value: true }); -exports.render = exports.parse = void 0; -var tslib_1 = require("tslib"); +exports.renderWithParse5 = exports.parseWithParse5 = void 0; var domhandler_1 = require("domhandler"); var parse5_1 = require("parse5"); -var parse5_htmlparser2_tree_adapter_1 = tslib_1.__importDefault(require("parse5-htmlparser2-tree-adapter")); -function parse(content, options, isDocument) { +var parse5_htmlparser2_tree_adapter_1 = require("parse5-htmlparser2-tree-adapter"); +/** + * Parse the content with `parse5` in the context of the given `ParentNode`. + * + * @param content - The content to parse. + * @param options - A set of options to use to parse. + * @param isDocument - Whether to parse the content as a full HTML document. + * @param context - The context in which to parse the content. + * @returns The parsed content. + */ +function parseWithParse5(content, options, isDocument, context) { var opts = { scriptingEnabled: typeof options.scriptingEnabled === 'boolean' ? options.scriptingEnabled : true, - treeAdapter: parse5_htmlparser2_tree_adapter_1.default, + treeAdapter: parse5_htmlparser2_tree_adapter_1.adapter, sourceCodeLocationInfo: options.sourceCodeLocationInfo, }; - var context = options.context; - // @ts-expect-error The tree adapter unfortunately doesn't return the exact types. return isDocument - ? parse5_1.parse(content, opts) - : // @ts-expect-error Same issue again. - parse5_1.parseFragment(context, content, opts); + ? (0, parse5_1.parse)(content, opts) + : (0, parse5_1.parseFragment)(context, content, opts); } -exports.parse = parse; -function render(dom) { +exports.parseWithParse5 = parseWithParse5; +var renderOpts = { treeAdapter: parse5_htmlparser2_tree_adapter_1.adapter }; +/** + * Renders the given DOM tree with `parse5` and returns the result as a string. + * + * @param dom - The DOM tree to render. + * @returns The rendered document. + */ +function renderWithParse5(dom) { var _a; /* * `dom-serializer` passes over the special "root" node and renders the @@ -31,11 +52,16 @@ function render(dom) { var nodes = 'length' in dom ? dom : [dom]; for (var index = 0; index < nodes.length; index += 1) { var node = nodes[index]; - if (domhandler_1.isDocument(node)) { - (_a = Array.prototype.splice).call.apply(_a, tslib_1.__spreadArray([nodes, index, 1], node.children)); + if ((0, domhandler_1.isDocument)(node)) { + (_a = Array.prototype.splice).call.apply(_a, __spreadArray([nodes, index, 1], node.children, false)); } } - // @ts-expect-error Types don't align here either. - return parse5_1.serialize({ children: nodes }, { treeAdapter: parse5_htmlparser2_tree_adapter_1.default }); + var result = ''; + for (var index = 0; index < nodes.length; index += 1) { + var node = nodes[index]; + result += (0, parse5_1.serializeOuter)(node, renderOpts); + } + return result; } -exports.render = render; +exports.renderWithParse5 = renderWithParse5; +//# sourceMappingURL=parse5-adapter.js.map \ No newline at end of file diff --git a/node_modules/cheerio/lib/static.d.ts b/node_modules/cheerio/lib/static.d.ts index 666c243..8c71d6b 100644 --- a/node_modules/cheerio/lib/static.d.ts +++ b/node_modules/cheerio/lib/static.d.ts @@ -1,13 +1,14 @@ +import type { BasicAcceptedElems } from './types.js'; import type { CheerioAPI, Cheerio } from '.'; -import { Node, Document } from 'domhandler'; -import { CheerioOptions } from './options'; +import type { AnyNode, Document } from 'domhandler'; +import { CheerioOptions } from './options.js'; /** * Renders the document. * * @param options - Options for the renderer. * @returns The rendered document. */ -export declare function html(this: CheerioAPI | void, options?: CheerioOptions): string; +export declare function html(this: CheerioAPI, options?: CheerioOptions): string; /** * Renders the document. * @@ -15,21 +16,25 @@ export declare function html(this: CheerioAPI | void, options?: CheerioOptions): * @param options - Options for the renderer. * @returns The rendered document. */ -export declare function html(this: CheerioAPI | void, dom?: string | ArrayLike | Node, options?: CheerioOptions): string; +export declare function html(this: CheerioAPI, dom?: BasicAcceptedElems, options?: CheerioOptions): string; /** * Render the document as XML. * * @param dom - Element to render. * @returns THe rendered document. */ -export declare function xml(this: CheerioAPI, dom?: string | ArrayLike | Node): string; +export declare function xml(this: CheerioAPI, dom?: BasicAcceptedElems): string; /** * Render the document as text. * + * This returns the `textContent` of the passed elements. The result will + * include the contents of `script` and `stype` elements. To avoid this, use + * `.prop('innerText')` instead. + * * @param elements - Elements to render. * @returns The rendered document. */ -export declare function text(this: CheerioAPI | void, elements?: ArrayLike): string; +export declare function text(this: CheerioAPI | void, elements?: ArrayLike): string; /** * Parses a string into an array of DOM nodes. The `context` argument has no * meaning for Cheerio, but it is maintained for API compatibility with jQuery. @@ -42,7 +47,7 @@ export declare function text(this: CheerioAPI | void, elements?: ArrayLike * @alias Cheerio.parseHTML * @see {@link https://api.jquery.com/jQuery.parseHTML/} */ -export declare function parseHTML(this: CheerioAPI, data: string, context?: unknown | boolean, keepScripts?: boolean): Node[]; +export declare function parseHTML(this: CheerioAPI, data: string, context?: unknown | boolean, keepScripts?: boolean): AnyNode[]; export declare function parseHTML(this: CheerioAPI, data?: '' | null): null; /** * Sometimes you need to work with the top-level root element. To query it, you @@ -69,7 +74,7 @@ export declare function root(this: CheerioAPI): Cheerio; * @alias Cheerio.contains * @see {@link https://api.jquery.com/jQuery.contains/} */ -export declare function contains(container: Node, contained: Node): boolean; +export declare function contains(container: AnyNode, contained: AnyNode): boolean; interface WritableArrayLike extends ArrayLike { length: number; [n: number]: T; diff --git a/node_modules/cheerio/lib/static.d.ts.map b/node_modules/cheerio/lib/static.d.ts.map index 1c99261..18828f2 100644 --- a/node_modules/cheerio/lib/static.d.ts.map +++ b/node_modules/cheerio/lib/static.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"static.d.ts","sourceRoot":"","sources":["../src/static.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAEL,cAAc,EAGf,MAAM,WAAW,CAAC;AAiDnB;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC;AAChF;;;;;;GAMG;AACH,wBAAgB,IAAI,CAClB,IAAI,EAAE,UAAU,GAAG,IAAI,EACvB,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,EACrC,OAAO,CAAC,EAAE,cAAc,GACvB,MAAM,CAAC;AAkCV;;;;;GAKG;AACH,wBAAgB,GAAG,CACjB,IAAI,EAAE,UAAU,EAChB,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,GACpC,MAAM,CAIR;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAClB,IAAI,EAAE,UAAU,GAAG,IAAI,EACvB,QAAQ,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,GACzB,MAAM,CAmBR;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,EAC3B,WAAW,CAAC,EAAE,OAAO,GACpB,IAAI,EAAE,CAAC;AACV,wBAAgB,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AA8BpE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,CAExD;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,GAAG,OAAO,CAmBlE;AAED,UAAU,iBAAiB,CAAC,CAAC,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CAAC,CAAC,EACrB,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAC1B,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,GACjB,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAY1B"} \ No newline at end of file +{"version":3,"file":"static.d.ts","sourceRoot":"https://raw.githubusercontent.com/cheeriojs/cheerio/d1cbc66d53392ce8bf6cd0068f675836372d2bf3/src/","sources":["static.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEpD,OAAO,EAEL,cAAc,EAGf,MAAM,cAAc,CAAC;AAuCtB;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC;AACzE;;;;;;GAMG;AACH,wBAAgB,IAAI,CAClB,IAAI,EAAE,UAAU,EAChB,GAAG,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,EACjC,OAAO,CAAC,EAAE,cAAc,GACvB,MAAM,CAAC;AA2BV;;;;;GAKG;AACH,wBAAgB,GAAG,CACjB,IAAI,EAAE,UAAU,EAChB,GAAG,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,GAChC,MAAM,CAIR;AAED;;;;;;;;;GASG;AACH,wBAAgB,IAAI,CAClB,IAAI,EAAE,UAAU,GAAG,IAAI,EACvB,QAAQ,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,GAC5B,MAAM,CAUR;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,EAC3B,WAAW,CAAC,EAAE,OAAO,GACpB,OAAO,EAAE,CAAC;AACb,wBAAgB,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AA8BpE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,CAExD;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAmBxE;AAED,UAAU,iBAAiB,CAAC,CAAC,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CAAC,CAAC,EACrB,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAC1B,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,GACjB,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAY1B"} \ No newline at end of file diff --git a/node_modules/cheerio/lib/static.js b/node_modules/cheerio/lib/static.js index 7e9fbb3..59b407d 100644 --- a/node_modules/cheerio/lib/static.js +++ b/node_modules/cheerio/lib/static.js @@ -1,12 +1,42 @@ "use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.merge = exports.contains = exports.root = exports.parseHTML = exports.text = exports.xml = exports.html = void 0; -var tslib_1 = require("tslib"); -var options_1 = tslib_1.__importStar(require("./options")); -var cheerio_select_1 = require("cheerio-select"); -var htmlparser2_1 = require("htmlparser2"); -var parse5_adapter_1 = require("./parsers/parse5-adapter"); -var htmlparser2_adapter_1 = require("./parsers/htmlparser2-adapter"); +var domutils_1 = require("domutils"); +var options_js_1 = __importStar(require("./options.js")); /** * Helper function to render a DOM. * @@ -16,17 +46,9 @@ var htmlparser2_adapter_1 = require("./parsers/htmlparser2-adapter"); * @returns The rendered document. */ function render(that, dom, options) { - var _a; - var toRender = dom - ? typeof dom === 'string' - ? cheerio_select_1.select(dom, (_a = that === null || that === void 0 ? void 0 : that._root) !== null && _a !== void 0 ? _a : [], options) - : dom - : that === null || that === void 0 ? void 0 : that._root.children; - if (!toRender) + if (!that) return ''; - return options.xmlMode || options._useHtmlParser2 - ? htmlparser2_adapter_1.render(toRender, options) - : parse5_adapter_1.render(toRender); + return that(dom !== null && dom !== void 0 ? dom : that._root.children, null, undefined, options).toString(); } /** * Checks if a passed object is an options object. @@ -34,8 +56,9 @@ function render(that, dom, options) { * @param dom - Object to check if it is an options object. * @returns Whether the object is an options object. */ -function isOptions(dom) { - return (typeof dom === 'object' && +function isOptions(dom, options) { + return (!options && + typeof dom === 'object' && dom != null && !('length' in dom) && !('type' in dom)); @@ -47,16 +70,13 @@ function html(dom, options) { * check dom argument for dom element specific properties * assume there is no 'length' or 'type' properties in the options object */ - if (!options && isOptions(dom)) { - options = dom; - dom = undefined; - } + var toRender = isOptions(dom) ? ((options = dom), undefined) : dom; /* * Sometimes `$.html()` is used without preloading html, * so fallback non-existing options to the default ones. */ - var opts = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, options_1.default), (this ? this._options : {})), options_1.flatten(options !== null && options !== void 0 ? options : {})); - return render(this || undefined, dom, opts); + var opts = __assign(__assign(__assign({}, options_js_1.default), this === null || this === void 0 ? void 0 : this._options), (0, options_js_1.flatten)(options !== null && options !== void 0 ? options : {})); + return render(this, toRender, opts); } exports.html = html; /** @@ -66,13 +86,17 @@ exports.html = html; * @returns THe rendered document. */ function xml(dom) { - var options = tslib_1.__assign(tslib_1.__assign({}, this._options), { xmlMode: true }); + var options = __assign(__assign({}, this._options), { xmlMode: true }); return render(this, dom, options); } exports.xml = xml; /** * Render the document as text. * + * This returns the `textContent` of the passed elements. The result will + * include the contents of `script` and `stype` elements. To avoid this, use + * `.prop('innerText')` instead. + * * @param elements - Elements to render. * @returns The rendered document. */ @@ -80,15 +104,7 @@ function text(elements) { var elems = elements ? elements : this ? this.root() : []; var ret = ''; for (var i = 0; i < elems.length; i++) { - var elem = elems[i]; - if (htmlparser2_1.DomUtils.isText(elem)) - ret += elem.data; - else if (htmlparser2_1.DomUtils.hasChildren(elem) && - elem.type !== htmlparser2_1.ElementType.Comment && - elem.type !== htmlparser2_1.ElementType.Script && - elem.type !== htmlparser2_1.ElementType.Style) { - ret += text(elem.children); - } + ret += (0, domutils_1.textContent)(elems[i]); } return ret; } @@ -101,7 +117,7 @@ function parseHTML(data, context, keepScripts) { if (typeof context === 'boolean') { keepScripts = context; } - var parsed = this.load(data, options_1.default, false); + var parsed = this.load(data, options_js_1.default, false); if (!keepScripts) { parsed('script').remove(); } @@ -185,6 +201,8 @@ function merge(arr1, arr2) { } exports.merge = merge; /** + * Checks if an object is array-like. + * * @param item - Item to check. * @returns Indicates if the item is array-like. */ @@ -205,3 +223,4 @@ function isArrayLike(item) { } return true; } +//# sourceMappingURL=static.js.map \ No newline at end of file diff --git a/node_modules/cheerio/lib/types.d.ts b/node_modules/cheerio/lib/types.d.ts index d590e7c..6fa33e9 100644 --- a/node_modules/cheerio/lib/types.d.ts +++ b/node_modules/cheerio/lib/types.d.ts @@ -6,12 +6,12 @@ declare type SelectorSpecial = '.' | '#' | ':' | '|' | '>' | '+' | '~' | '['; * selectors to return `Element`s. */ export declare type SelectorType = `${SelectorSpecial}${AlphaNumeric}${string}` | `${AlphaNumeric}${string}`; -import type { Cheerio } from './cheerio'; -import type { Node } from 'domhandler'; +import type { Cheerio } from './cheerio.js'; +import type { AnyNode } from 'domhandler'; /** Elements that can be passed to manipulation methods. */ -export declare type BasicAcceptedElems = Cheerio | T[] | T | string; +export declare type BasicAcceptedElems = Cheerio | T[] | T | string; /** Elements that can be passed to manipulation methods, including functions. */ -export declare type AcceptedElems = BasicAcceptedElems | ((this: T, i: number, el: T) => BasicAcceptedElems); +export declare type AcceptedElems = BasicAcceptedElems | ((this: T, i: number, el: T) => BasicAcceptedElems); /** Function signature, for traversal methods. */ export declare type FilterFunction = (this: T, i: number, el: T) => boolean; /** Supported filter types, for traversal methods. */ diff --git a/node_modules/cheerio/lib/types.d.ts.map b/node_modules/cheerio/lib/types.d.ts.map index 39e3f4d..d0ae306 100644 --- a/node_modules/cheerio/lib/types.d.ts.map +++ b/node_modules/cheerio/lib/types.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,aAAK,gBAAgB,GACjB,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,CAAC;AAER,aAAK,YAAY,GACb,gBAAgB,GAChB,SAAS,CAAC,gBAAgB,CAAC,GAC3B,GAAG,MAAM,EAAE,CAAC;AAEhB,aAAK,eAAe,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AACrE;;;GAGG;AACH,oBAAY,YAAY,GACpB,GAAG,eAAe,GAAG,YAAY,GAAG,MAAM,EAAE,GAC5C,GAAG,YAAY,GAAG,MAAM,EAAE,CAAC;AAE/B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,2DAA2D;AAC3D,oBAAY,kBAAkB,CAAC,CAAC,SAAS,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC;AAC/E,gFAAgF;AAChF,oBAAY,aAAa,CAAC,CAAC,SAAS,IAAI,IACpC,kBAAkB,CAAC,CAAC,CAAC,GACrB,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,KAAK,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;AAE3D,iDAAiD;AACjD,oBAAY,cAAc,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,KAAK,OAAO,CAAC;AACvE,qDAAqD;AACrD,oBAAY,eAAe,CAAC,CAAC,IAAI,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"types.d.ts","sourceRoot":"https://raw.githubusercontent.com/cheeriojs/cheerio/d1cbc66d53392ce8bf6cd0068f675836372d2bf3/src/","sources":["types.ts"],"names":[],"mappings":"AAAA,aAAK,gBAAgB,GACjB,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,CAAC;AAER,aAAK,YAAY,GACb,gBAAgB,GAChB,SAAS,CAAC,gBAAgB,CAAC,GAC3B,GAAG,MAAM,EAAE,CAAC;AAEhB,aAAK,eAAe,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AACrE;;;GAGG;AACH,oBAAY,YAAY,GACpB,GAAG,eAAe,GAAG,YAAY,GAAG,MAAM,EAAE,GAC5C,GAAG,YAAY,GAAG,MAAM,EAAE,CAAC;AAE/B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,2DAA2D;AAC3D,oBAAY,kBAAkB,CAAC,CAAC,SAAS,OAAO,IAC5C,OAAO,CAAC,CAAC,CAAC,GACV,CAAC,EAAE,GACH,CAAC,GACD,MAAM,CAAC;AACX,gFAAgF;AAChF,oBAAY,aAAa,CAAC,CAAC,SAAS,OAAO,IACvC,kBAAkB,CAAC,CAAC,CAAC,GACrB,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,KAAK,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;AAE3D,iDAAiD;AACjD,oBAAY,cAAc,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,KAAK,OAAO,CAAC;AACvE,qDAAqD;AACrD,oBAAY,eAAe,CAAC,CAAC,IAAI,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/cheerio/lib/types.js b/node_modules/cheerio/lib/types.js index c8ad2e5..11e638d 100644 --- a/node_modules/cheerio/lib/types.js +++ b/node_modules/cheerio/lib/types.js @@ -1,2 +1,3 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/cheerio/lib/utils.d.ts b/node_modules/cheerio/lib/utils.d.ts index 1e5e0c1..8ed2c59 100644 --- a/node_modules/cheerio/lib/utils.d.ts +++ b/node_modules/cheerio/lib/utils.d.ts @@ -1,6 +1,5 @@ -import { DomUtils } from 'htmlparser2'; -import { Node } from 'domhandler'; -import type { Cheerio } from './cheerio'; +import { type AnyNode } from 'domhandler'; +import type { Cheerio } from './cheerio.js'; /** * Check if the DOM element is a tag. * @@ -8,10 +7,10 @@ import type { Cheerio } from './cheerio'; * * @private * @category Utils - * @param type - DOM node to check. + * @param type - The DOM node to check. * @returns Whether the node is a tag. */ -export declare const isTag: typeof DomUtils.isTag; +export { isTag } from 'domhandler'; /** * Checks if an object is a Cheerio instance. * @@ -25,7 +24,7 @@ export declare function isCheerio(maybeCheerio: any): maybeCheerio is Cheerio * * @private * @category Utils - * @param str - String to be converted. + * @param str - The string to be converted. * @returns String in camel case notation. */ export declare function camelCase(str: string): string; @@ -35,7 +34,7 @@ export declare function camelCase(str: string): string; * * @private * @category Utils - * @param str - String to be converted. + * @param str - The string to be converted. * @returns String in "CSS case". */ export declare function cssCase(str: string): string; @@ -46,27 +45,30 @@ export declare function cssCase(str: string): string; * pressure introduced by _make. * * @category Utils - * @param array - Array to iterate over. + * @param array - The array to iterate over. * @param fn - Function to call. * @returns The original instance. */ -export declare function domEach = Cheerio>(array: Arr, fn: (elem: T, index: number) => void): Arr; +export declare function domEach = Cheerio>(array: Arr, fn: (elem: T, index: number) => void): Arr; /** * Create a deep copy of the given DOM structure. Sets the parents of the copies * of the passed nodes to `null`. * * @private * @category Utils - * @param dom - The htmlparser2-compliant DOM structure. + * @param dom - The domhandler-compliant DOM structure. * @returns - The cloned DOM. */ -export declare function cloneDom(dom: T | T[]): T[]; +export declare function cloneDom(dom: T | T[]): T[]; /** * Check if string is HTML. * + * Tests for a `<` within a string, immediate followed by a letter and + * eventually followed by a `>`. + * * @private * @category Utils - * @param str - String to check. + * @param str - The string to check. * @returns Indicates if `str` is HTML. */ export declare function isHtml(str: string): boolean; diff --git a/node_modules/cheerio/lib/utils.d.ts.map b/node_modules/cheerio/lib/utils.d.ts.map index 20ca00a..e6bc715 100644 --- a/node_modules/cheerio/lib/utils.d.ts.map +++ b/node_modules/cheerio/lib/utils.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,IAAI,EAAuB,MAAM,YAAY,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;;;;;;GASG;AACH,eAAO,MAAQ,KAAK,uBAAa,CAAC;AAElC;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,YAAY,EAAE,GAAG,GAAG,YAAY,IAAI,OAAO,CAAC,CAAC,CAAC,CAE1E;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,IAAI,EAAE,GAAG,SAAS,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAC3E,KAAK,EAAE,GAAG,EACV,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,GACnC,GAAG,CAIL;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,IAAI,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,CAa1D;AAUD;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAG3C"} \ No newline at end of file +{"version":3,"file":"utils.d.ts","sourceRoot":"https://raw.githubusercontent.com/cheeriojs/cheerio/d1cbc66d53392ce8bf6cd0068f675836372d2bf3/src/","sources":["utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAuB,MAAM,YAAY,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;;;;;;GASG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,YAAY,EAAE,GAAG,GAAG,YAAY,IAAI,OAAO,CAAC,CAAC,CAAC,CAE1E;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CACrB,CAAC,SAAS,OAAO,EACjB,GAAG,SAAS,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EACrC,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,GAAG,CAIvD;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,CAa7D;AAUD;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAa3C"} \ No newline at end of file diff --git a/node_modules/cheerio/lib/utils.js b/node_modules/cheerio/lib/utils.js index 2133d64..b10f17f 100644 --- a/node_modules/cheerio/lib/utils.js +++ b/node_modules/cheerio/lib/utils.js @@ -1,7 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isHtml = exports.cloneDom = exports.domEach = exports.cssCase = exports.camelCase = exports.isCheerio = exports.isTag = void 0; -var htmlparser2_1 = require("htmlparser2"); var domhandler_1 = require("domhandler"); /** * Check if the DOM element is a tag. @@ -10,10 +9,11 @@ var domhandler_1 = require("domhandler"); * * @private * @category Utils - * @param type - DOM node to check. + * @param type - The DOM node to check. * @returns Whether the node is a tag. */ -exports.isTag = htmlparser2_1.DomUtils.isTag; +var domhandler_2 = require("domhandler"); +Object.defineProperty(exports, "isTag", { enumerable: true, get: function () { return domhandler_2.isTag; } }); /** * Checks if an object is a Cheerio instance. * @@ -30,7 +30,7 @@ exports.isCheerio = isCheerio; * * @private * @category Utils - * @param str - String to be converted. + * @param str - The string to be converted. * @returns String in camel case notation. */ function camelCase(str) { @@ -43,7 +43,7 @@ exports.camelCase = camelCase; * * @private * @category Utils - * @param str - String to be converted. + * @param str - The string to be converted. * @returns String in "CSS case". */ function cssCase(str) { @@ -57,7 +57,7 @@ exports.cssCase = cssCase; * pressure introduced by _make. * * @category Utils - * @param array - Array to iterate over. + * @param array - The array to iterate over. * @param fn - Function to call. * @returns The original instance. */ @@ -74,13 +74,13 @@ exports.domEach = domEach; * * @private * @category Utils - * @param dom - The htmlparser2-compliant DOM structure. + * @param dom - The domhandler-compliant DOM structure. * @returns - The cloned DOM. */ function cloneDom(dom) { var clone = 'length' in dom - ? Array.prototype.map.call(dom, function (el) { return domhandler_1.cloneNode(el, true); }) - : [domhandler_1.cloneNode(dom, true)]; + ? Array.prototype.map.call(dom, function (el) { return (0, domhandler_1.cloneNode)(el, true); }) + : [(0, domhandler_1.cloneNode)(dom, true)]; // Add a root node around the cloned nodes var root = new domhandler_1.Document(clone); clone.forEach(function (node) { @@ -89,23 +89,34 @@ function cloneDom(dom) { return clone; } exports.cloneDom = cloneDom; -/** - * A simple way to check for HTML strings. Tests for a `<` within a string, - * immediate followed by a letter and eventually followed by a `>`. - * - * @private - */ -var quickExpr = /<[a-zA-Z][^]*>/; +var CharacterCodes; +(function (CharacterCodes) { + CharacterCodes[CharacterCodes["LowerA"] = 97] = "LowerA"; + CharacterCodes[CharacterCodes["LowerZ"] = 122] = "LowerZ"; + CharacterCodes[CharacterCodes["UpperA"] = 65] = "UpperA"; + CharacterCodes[CharacterCodes["UpperZ"] = 90] = "UpperZ"; + CharacterCodes[CharacterCodes["Exclamation"] = 33] = "Exclamation"; +})(CharacterCodes || (CharacterCodes = {})); /** * Check if string is HTML. * + * Tests for a `<` within a string, immediate followed by a letter and + * eventually followed by a `>`. + * * @private * @category Utils - * @param str - String to check. + * @param str - The string to check. * @returns Indicates if `str` is HTML. */ function isHtml(str) { - // Run the regex - return quickExpr.test(str); + var tagStart = str.indexOf('<'); + if (tagStart < 0 || tagStart > str.length - 3) + return false; + var tagChar = str.charCodeAt(tagStart + 1); + return (((tagChar >= CharacterCodes.LowerA && tagChar <= CharacterCodes.LowerZ) || + (tagChar >= CharacterCodes.UpperA && tagChar <= CharacterCodes.UpperZ) || + tagChar === CharacterCodes.Exclamation) && + str.includes('>', tagStart + 2)); } exports.isHtml = isHtml; +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/cheerio/package.json b/node_modules/cheerio/package.json index 1954c62..7736f03 100644 --- a/node_modules/cheerio/package.json +++ b/node_modules/cheerio/package.json @@ -1,92 +1,13 @@ { - "_from": "cheerio", - "_id": "cheerio@1.0.0-rc.10", - "_inBundle": false, - "_integrity": "sha512-g0J0q/O6mW8z5zxQ3A8E8J1hUgp4SMOvEoW/x84OwyHKe/Zccz83PVT4y5Crcr530FV6NgmKI1qvGTKVl9XXVw==", - "_location": "/cheerio", - "_phantomChildren": {}, - "_requested": { - "type": "tag", - "registry": true, - "raw": "cheerio", - "name": "cheerio", - "escapedName": "cheerio", - "rawSpec": "", - "saveSpec": null, - "fetchSpec": "latest" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.10.tgz", - "_shasum": "2ba3dcdfcc26e7956fc1f440e61d51c643379f3e", - "_spec": "cheerio", - "_where": "/home/runner/work/public_library_map/public_library_map", - "author": { - "name": "Matt Mueller", - "email": "mattmuelle@gmail.com" - }, - "bugs": { - "url": "https://github.com/cheeriojs/cheerio/issues" - }, - "bundleDependencies": false, - "dependencies": { - "cheerio-select": "^1.5.0", - "dom-serializer": "^1.3.2", - "domhandler": "^4.2.0", - "htmlparser2": "^6.1.0", - "parse5": "^6.0.1", - "parse5-htmlparser2-tree-adapter": "^6.0.1", - "tslib": "^2.2.0" - }, - "deprecated": false, + "name": "cheerio", + "version": "1.0.0-rc.12", "description": "Tiny, fast, and elegant implementation of core jQuery designed specifically for the server", - "devDependencies": { - "@octokit/graphql": "^4.6.2", - "@types/benchmark": "^2.1.0", - "@types/jest": "^26.0.23", - "@types/jsdom": "^16.2.10", - "@types/node": "^15.12.1", - "@types/node-fetch": "^2.5.10", - "@types/parse5": "^6.0.0", - "@types/parse5-htmlparser2-tree-adapter": "^6.0.0", - "@typescript-eslint/eslint-plugin": "^4.26.0", - "@typescript-eslint/parser": "^4.26.0", - "benchmark": "^2.1.4", - "eslint": "^7.28.0", - "eslint-config-prettier": "^8.3.0", - "eslint-plugin-jest": "^24.3.6", - "eslint-plugin-jsdoc": "^35.1.3", - "eslint-plugin-node": "^11.1.0", - "husky": "^4.3.8", - "jest": "^27.0.4", - "jquery": "^3.6.0", - "jsdom": "^16.6.0", - "lint-staged": "^11.0.0", - "node-fetch": "^2.6.1", - "prettier": "^2.3.1", - "prettier-plugin-jsdoc": "0.3.22", - "ts-jest": "^27.0.3", - "ts-node": "^10.0.0", - "typedoc": "^0.20.36", - "typescript": "^4.2.4" - }, - "engines": { - "node": ">= 6" - }, - "files": [ - "lib" + "author": "Matt Mueller ", + "maintainers": [ + "Felix Boehm " ], "funding": "https://github.com/cheeriojs/cheerio?sponsor=1", - "homepage": "https://cheerio.js.org/", - "jest": { - "preset": "ts-jest", - "testEnvironment": "node", - "testPathIgnorePatterns": [ - "/__fixtures__/" - ] - }, + "license": "MIT", "keywords": [ "htmlparser", "jquery", @@ -95,7 +16,98 @@ "parser", "html" ], - "license": "MIT", + "repository": { + "type": "git", + "url": "git://github.com/cheeriojs/cheerio.git" + }, + "bugs": { + "url": "https://github.com/cheeriojs/cheerio/issues" + }, + "homepage": "https://cheerio.js.org/", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "module": "lib/esm/index.js", + "exports": { + ".": { + "require": "./lib/index.js", + "import": "./lib/esm/index.js" + }, + "./lib/slim": { + "require": "./lib/slim.js", + "import": "./lib/esm/slim.js" + }, + "./lib/utils": { + "require": "./lib/utils.js", + "import": "./lib/esm/utils.js" + } + }, + "files": [ + "lib" + ], + "engines": { + "node": ">= 6" + }, + "dependencies": { + "cheerio-select": "^2.1.0", + "dom-serializer": "^2.0.0", + "domhandler": "^5.0.3", + "domutils": "^3.0.1", + "htmlparser2": "^8.0.1", + "parse5": "^7.0.0", + "parse5-htmlparser2-tree-adapter": "^7.0.0" + }, + "devDependencies": { + "@octokit/graphql": "^4.8.0", + "@types/benchmark": "^2.1.1", + "@types/jest": "^28.1.3", + "@types/node": "^18.0.0", + "@typescript-eslint/eslint-plugin": "^5.29.0", + "@typescript-eslint/parser": "^5.29.0", + "benchmark": "^2.1.4", + "eslint": "^8.18.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-jest": "^26.5.3", + "eslint-plugin-jsdoc": "^39.3.3", + "eslint-plugin-node": "^11.1.0", + "husky": "^8.0.1", + "jest": "^28.1.1", + "jquery": "^3.6.0", + "jsdom": "^20.0.0", + "lint-staged": "^13.0.2", + "prettier": "^2.7.1", + "prettier-plugin-jsdoc": "0.3.38", + "ts-jest": "^28.0.5", + "ts-node": "^10.8.1", + "typedoc": "^0.22.17", + "typescript": "^4.7.4", + "undici": "^5.5.1" + }, + "scripts": { + "test": "npm run lint && npm run test:jest", + "test:jest": "jest", + "test:jest:cov": "npm run test:jest -- --coverage", + "lint": "npm run lint:es && npm run lint:prettier", + "lint:es": "eslint --ignore-path .gitignore .", + "lint:prettier": "npm run format:prettier:raw -- --check", + "format": "npm run format:es && npm run format:prettier", + "format:es": "npm run lint:es -- --fix", + "format:prettier": "npm run format:prettier:raw -- --write", + "format:prettier:raw": "prettier \"**/*.{{m,c,}js,ts,md,json,yml}\" --ignore-path .gitignore", + "build:docs": "typedoc --hideGenerator src/index.ts", + "benchmark": "npm run build:cjs && ts-node benchmark/benchmark.ts --regex \"^(?!.*highmem)\"", + "update-sponsors": "ts-node scripts/fetch-sponsors.ts", + "bench": "npm run benchmark", + "build": "npm run build:cjs && npm run build:esm", + "build:cjs": "tsc --sourceRoot https://raw.githubusercontent.com/cheeriojs/cheerio/$(git rev-parse HEAD)/src/", + "build:esm": "npm run build:cjs -- --module esnext --target es2019 --outDir lib/esm && echo '{\"type\":\"module\"}' > lib/esm/package.json", + "prepublishOnly": "npm run build", + "prepare": "husky install" + }, + "prettier": { + "singleQuote": true, + "tabWidth": 2, + "tsdoc": true + }, "lint-staged": { "*.js": [ "prettier --write", @@ -105,42 +117,18 @@ "prettier --write" ] }, - "main": "lib/index.js", - "maintainers": [ - { - "name": "Felix Boehm", - "email": "me@feedic.com" + "jest": { + "preset": "ts-jest", + "testEnvironment": "node", + "testPathIgnorePatterns": [ + "/__fixtures__/" + ], + "coverageProvider": "v8", + "moduleNameMapper": { + "^(.*)\\.js$": [ + "$1.js", + "$1" + ] } - ], - "name": "cheerio", - "prettier": { - "singleQuote": true, - "tabWidth": 2, - "tsdoc": true - }, - "repository": { - "type": "git", - "url": "git://github.com/cheeriojs/cheerio.git" - }, - "scripts": { - "bench": "npm run benchmark", - "benchmark": "ts-node benchmark/benchmark.ts --regex \"^(?!.*highmem)\"", - "build": "tsc", - "build:docs": "typedoc --hideGenerator src/index.ts", - "format": "npm run format:es && npm run format:prettier", - "format:es": "npm run lint:es -- --fix", - "format:prettier": "npm run format:prettier:raw -- --write", - "format:prettier:raw": "prettier \"**/*.{js,ts,md,json,yml}\" --ignore-path .gitignore", - "lint": "npm run lint:es && npm run lint:prettier", - "lint:es": "eslint --ignore-path .gitignore .", - "lint:prettier": "npm run format:prettier:raw -- --check", - "pre-commit": "lint-staged", - "prepublishOnly": "npm run build", - "test": "npm run lint && npm run test:jest", - "test:jest": "jest", - "test:jest:cov": "npm run test:jest -- --coverage", - "update-sponsors": "ts-node scripts/fetch-sponsors.ts" - }, - "types": "lib/index.d.ts", - "version": "1.0.0-rc.10" + } } diff --git a/node_modules/css-select/README.md b/node_modules/css-select/README.md index 63b9c2b..2cde38c 100644 --- a/node_modules/css-select/README.md +++ b/node_modules/css-select/README.md @@ -1,35 +1,42 @@ # css-select [![NPM version](http://img.shields.io/npm/v/css-select.svg)](https://npmjs.org/package/css-select) [![Build Status](https://travis-ci.com/fb55/css-select.svg?branch=master)](http://travis-ci.com/fb55/css-select) [![Downloads](https://img.shields.io/npm/dm/css-select.svg)](https://npmjs.org/package/css-select) [![Coverage](https://coveralls.io/repos/fb55/css-select/badge.svg?branch=master)](https://coveralls.io/r/fb55/css-select) -a CSS selector compiler/engine +A CSS selector compiler and engine ## What? -css-select turns CSS selectors into functions that tests if elements match them. -When searching for elements, testing is executed "from the top", similar to how -browsers execute CSS selectors. +As a **compiler**, css-select turns CSS selectors into functions that tests if +elements match them. + +As an **engine**, css-select looks through a DOM tree, searching for elements. +Elements are tested "from the top", similar to how browsers execute CSS +selectors. In its default configuration, css-select queries the DOM structure of the [`domhandler`](https://github.com/fb55/domhandler) module (also known as -htmlparser2 DOM). It uses [`domutils`](https://github.com/fb55/domutils) as its -default adapter over the DOM structure. See Options below for details on -querying alternative DOM structures. +htmlparser2 DOM). To query alternative DOM structures, see [`Options`](#options) +below. **Features:** -- Full implementation of CSS3 selectors -- Partial implementation of jQuery/Sizzle extensions -- Very high test coverage -- Pretty good performance +- 🔬 Full implementation of CSS3 selectors, as well as most CSS4 selectors +- 🧪 Partial implementation of jQuery/Sizzle extensions (see + [cheerio-select](https://github.com/cheeriojs/cheerio-select) for the + remaining selectors) +- 🧑‍🔬 High test coverage, including the full test suites from + [`Sizzle`](https://github.com/jquery/sizzle), + [`Qwery`](https://github.com/ded/qwery) and + [`NWMatcher`](https://github.com/dperini/nwmatcher/) and . +- 🥼 Reliably great performance ## Why? -The traditional approach of executing CSS selectors, named left-to-right -execution, is to execute every component of the selector in order, from left to -right _(duh)_. The execution of the selector `a b` for example will first query -for `a` elements, then search these for `b` elements. (That's the approach of -eg. [`Sizzle`](https://github.com/jquery/sizzle), -[`nwmatcher`](https://github.com/dperini/nwmatcher/) and -[`qwery`](https://github.com/ded/qwery).) +Most CSS engines written in JavaScript execute selectors left-to-right. That +means thet execute every component of the selector in order, from left to right. +As an example: For the selector `a b`, these engines will first query for `a` +elements, then search these for `b` elements. (That's the approach of eg. +[`Sizzle`](https://github.com/jquery/sizzle), +[`Qwery`](https://github.com/ded/qwery) and +[`NWMatcher`](https://github.com/dperini/nwmatcher/).) While this works, it has some downsides: Children of `a`s will be checked multiple times; first, to check if they are also `a`s, then, for every superior @@ -50,10 +57,9 @@ By building a stack of functions. _Wait, what?_ -Okay, so let's suppose we want to compile the selector `a b` again, for -right-to-left execution. We start by _parsing_ the selector, which means we turn -the selector into an array of the building-blocks of the selector, so we can -distinguish them easily. That's what the +Okay, so let's suppose we want to compile the selector `a b`, for right-to-left +execution. We start by _parsing_ the selector. This turns the selector into an +array of the building blocks. That's what the [`css-what`](https://github.com/fb55/css-what) module is for, if you want to have a look. @@ -67,24 +73,27 @@ Anyway, after parsing, we end up with an array like this one: ]; ``` -Actually, this array is wrapped in another array, but that's another story -(involving commas in selectors). +(Actually, this array is wrapped in another array, but that's another story, +involving commas in selectors.) Now that we know the meaning of every part of the selector, we can compile it. -That's where it becomes interesting. +That is where things become interesting. The basic idea is to turn every part of the selector into a function, which takes an element as its only argument. The function checks whether a passed element matches its part of the selector: If it does, the element is passed to -the next turned-into-a-function part of the selector, which does the same. If an -element is accepted by all parts of the selector, it _matches_ the selector and -double rainbow ALL THE WAY. +the next function representing the next part of the selector. That function does +the same. If an element is accepted by all parts of the selector, it _matches_ +the selector and double rainbow ALL THE WAY. As said before, we want to do right-to-left execution with all the big O -improvements nonsense, so elements are passed from the rightmost part of the +improvements. That means elements are passed from the rightmost part of the selector (`b` in our example) to the leftmost (~~which would be `c`~~ of course `a`). +For traversals, such as the _descendant_ operating the space between `a` and +`b`, we walk up the DOM tree, starting from the element passed as argument. + _//TODO: More in-depth description. Implementation details. Build a spaceship._ ## API @@ -93,10 +102,9 @@ _//TODO: More in-depth description. Implementation details. Build a spaceship._ const CSSselect = require("css-select"); ``` -**Note:** css-select throws errors when invalid selectors are passed to it, -contrary to the behavior in browsers, which swallow them. This is done to aid -with writing css selectors, but can be unexpected when processing arbitrary -strings. +**Note:** css-select throws errors when invalid selectors are passed to it. This +is done to aid with writing css selectors, but can be unexpected when processing +arbitrary strings. #### `CSSselect.selectAll(query, elems, options)` @@ -133,11 +141,18 @@ All options are optional. - `adapter`: The adapter to use when interacting with the backing DOM structure. By default it uses the `domutils` module. - `context`: The context of the current query. Used to limit the scope of - searches. Can be matched directly using the `:scope` pseudo-selector. + searches. Can be matched directly using the `:scope` pseudo-class. +- `relativeSelector`: By default, selectors are relative to the `context`, + which means that no parent elements of the context will be matched. (Eg. + `a b c` with context `b` will never give any results.) If `relativeSelector` + is set to `false`, selectors won't be + [absolutized](http://www.w3.org/TR/selectors4/#absolutizing) and selectors + can test for parent elements outside of the `context`. - `cacheResults`: Allow css-select to cache results for some selectors, sometimes greatly improving querying performance. Disable this if your document can change in between queries with the same compiled selector. Default: `true`. +- `pseudos`: A map of pseudo-class names to functions or strings. #### Custom Adapters @@ -178,8 +193,10 @@ _As defined by CSS 4 and / or jQuery._ - `^=` - `$=` - `!=` - - Also, `i` can be added after the comparison to make the comparison - case-insensitive (eg. `[attr=foo i]`) + - `i` and `s` can be added after the comparison to make the comparison + case-insensitive or case-sensitive (eg. `[attr=foo i]`). If neither is + supplied, css-select will follow the HTML spec's + [case-sensitivity rules](https://html.spec.whatwg.org/multipage/semantics-other.html#case-sensitivity-of-selectors). - Pseudos: - [`:not`](https://developer.mozilla.org/en-US/docs/Web/CSS/:not) - [`:contains`](https://api.jquery.com/contains-selector) diff --git a/node_modules/css-select/lib/attributes.d.ts b/node_modules/css-select/lib/attributes.d.ts index bcbc396..27b60a5 100644 --- a/node_modules/css-select/lib/attributes.d.ts +++ b/node_modules/css-select/lib/attributes.d.ts @@ -1,4 +1,4 @@ -import { CompiledQuery, InternalOptions } from "./types"; +import type { CompiledQuery, InternalOptions } from "./types.js"; import type { AttributeSelector, AttributeAction } from "css-what"; /** * Attribute selectors diff --git a/node_modules/css-select/lib/attributes.d.ts.map b/node_modules/css-select/lib/attributes.d.ts.map index ac431da..aafba15 100644 --- a/node_modules/css-select/lib/attributes.d.ts.map +++ b/node_modules/css-select/lib/attributes.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../src/attributes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAanE;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAC/B,eAAe,EACf,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EAC3B,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,EAChC,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,KAC1C,aAAa,CAAC,WAAW,CAAC,CA8KlC,CAAC"} \ No newline at end of file +{"version":3,"file":"attributes.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/css-select/0f0725a9dfeddd2fdb54eda9656cdbab5bbf6be6/src/","sources":["attributes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AA+EnE;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAC/B,eAAe,EACf,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EAC3B,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,EAChC,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,KAC1C,aAAa,CAAC,WAAW,CAAC,CAsLlC,CAAC"} \ No newline at end of file diff --git a/node_modules/css-select/lib/attributes.js b/node_modules/css-select/lib/attributes.js index 8a78bde..3c6867f 100644 --- a/node_modules/css-select/lib/attributes.js +++ b/node_modules/css-select/lib/attributes.js @@ -1,7 +1,10 @@ "use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.attributeRules = void 0; -var boolbase_1 = require("boolbase"); +var boolbase_1 = __importDefault(require("boolbase")); /** * All reserved characters in a regex, used for escaping. * @@ -12,15 +15,76 @@ var reChars = /[-[\]{}()*+?.,\\^$|#\s]/g; function escapeRegex(value) { return value.replace(reChars, "\\$&"); } +/** + * Attributes that are case-insensitive in HTML. + * + * @private + * @see https://html.spec.whatwg.org/multipage/semantics-other.html#case-sensitivity-of-selectors + */ +var caseInsensitiveAttributes = new Set([ + "accept", + "accept-charset", + "align", + "alink", + "axis", + "bgcolor", + "charset", + "checked", + "clear", + "codetype", + "color", + "compact", + "declare", + "defer", + "dir", + "direction", + "disabled", + "enctype", + "face", + "frame", + "hreflang", + "http-equiv", + "lang", + "language", + "link", + "media", + "method", + "multiple", + "nohref", + "noresize", + "noshade", + "nowrap", + "readonly", + "rel", + "rev", + "rules", + "scope", + "scrolling", + "selected", + "shape", + "target", + "text", + "type", + "valign", + "valuetype", + "vlink", +]); +function shouldIgnoreCase(selector, options) { + return typeof selector.ignoreCase === "boolean" + ? selector.ignoreCase + : selector.ignoreCase === "quirks" + ? !!options.quirksMode + : !options.xmlMode && caseInsensitiveAttributes.has(selector.name); +} /** * Attribute selectors */ exports.attributeRules = { - equals: function (next, data, _a) { - var adapter = _a.adapter; + equals: function (next, data, options) { + var adapter = options.adapter; var name = data.name; var value = data.value; - if (data.ignoreCase) { + if (shouldIgnoreCase(data, options)) { value = value.toLowerCase(); return function (elem) { var attr = adapter.getAttributeValue(elem, name); @@ -34,12 +98,12 @@ exports.attributeRules = { return adapter.getAttributeValue(elem, name) === value && next(elem); }; }, - hyphen: function (next, data, _a) { - var adapter = _a.adapter; + hyphen: function (next, data, options) { + var adapter = options.adapter; var name = data.name; var value = data.value; var len = value.length; - if (data.ignoreCase) { + if (shouldIgnoreCase(data, options)) { value = value.toLowerCase(); return function hyphenIC(elem) { var attr = adapter.getAttributeValue(elem, name); @@ -57,13 +121,13 @@ exports.attributeRules = { next(elem)); }; }, - element: function (next, _a, _b) { - var name = _a.name, value = _a.value, ignoreCase = _a.ignoreCase; - var adapter = _b.adapter; + element: function (next, data, options) { + var adapter = options.adapter; + var name = data.name, value = data.value; if (/\s/.test(value)) { - return boolbase_1.falseFunc; + return boolbase_1.default.falseFunc; } - var regex = new RegExp("(?:^|\\s)" + escapeRegex(value) + "(?:$|\\s)", ignoreCase ? "i" : ""); + var regex = new RegExp("(?:^|\\s)".concat(escapeRegex(value), "(?:$|\\s)"), shouldIgnoreCase(data, options) ? "i" : ""); return function element(elem) { var attr = adapter.getAttributeValue(elem, name); return (attr != null && @@ -77,15 +141,15 @@ exports.attributeRules = { var adapter = _b.adapter; return function (elem) { return adapter.hasAttrib(elem, name) && next(elem); }; }, - start: function (next, data, _a) { - var adapter = _a.adapter; + start: function (next, data, options) { + var adapter = options.adapter; var name = data.name; var value = data.value; var len = value.length; if (len === 0) { - return boolbase_1.falseFunc; + return boolbase_1.default.falseFunc; } - if (data.ignoreCase) { + if (shouldIgnoreCase(data, options)) { value = value.toLowerCase(); return function (elem) { var attr = adapter.getAttributeValue(elem, name); @@ -101,15 +165,15 @@ exports.attributeRules = { next(elem); }; }, - end: function (next, data, _a) { - var adapter = _a.adapter; + end: function (next, data, options) { + var adapter = options.adapter; var name = data.name; var value = data.value; var len = -value.length; if (len === 0) { - return boolbase_1.falseFunc; + return boolbase_1.default.falseFunc; } - if (data.ignoreCase) { + if (shouldIgnoreCase(data, options)) { value = value.toLowerCase(); return function (elem) { var _a; @@ -123,13 +187,13 @@ exports.attributeRules = { next(elem); }; }, - any: function (next, data, _a) { - var adapter = _a.adapter; + any: function (next, data, options) { + var adapter = options.adapter; var name = data.name, value = data.value; if (value === "") { - return boolbase_1.falseFunc; + return boolbase_1.default.falseFunc; } - if (data.ignoreCase) { + if (shouldIgnoreCase(data, options)) { var regex_1 = new RegExp(escapeRegex(value), "i"); return function anyIC(elem) { var attr = adapter.getAttributeValue(elem, name); @@ -145,8 +209,8 @@ exports.attributeRules = { next(elem); }; }, - not: function (next, data, _a) { - var adapter = _a.adapter; + not: function (next, data, options) { + var adapter = options.adapter; var name = data.name; var value = data.value; if (value === "") { @@ -154,7 +218,7 @@ exports.attributeRules = { return !!adapter.getAttributeValue(elem, name) && next(elem); }; } - else if (data.ignoreCase) { + else if (shouldIgnoreCase(data, options)) { value = value.toLowerCase(); return function (elem) { var attr = adapter.getAttributeValue(elem, name); @@ -169,3 +233,4 @@ exports.attributeRules = { }; }, }; +//# sourceMappingURL=attributes.js.map \ No newline at end of file diff --git a/node_modules/css-select/lib/compile.d.ts b/node_modules/css-select/lib/compile.d.ts index 7184c95..f67b508 100644 --- a/node_modules/css-select/lib/compile.d.ts +++ b/node_modules/css-select/lib/compile.d.ts @@ -1,6 +1,5 @@ -import { InternalSelector } from "./types"; import { Selector } from "css-what"; -import type { CompiledQuery, InternalOptions } from "./types"; +import type { CompiledQuery, InternalOptions, InternalSelector } from "./types.js"; /** * Compiles a selector to an executable function. * diff --git a/node_modules/css-select/lib/compile.d.ts.map b/node_modules/css-select/lib/compile.d.ts.map index 9187dcf..59231bc 100644 --- a/node_modules/css-select/lib/compile.d.ts.map +++ b/node_modules/css-select/lib/compile.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAS,QAAQ,EAAE,MAAM,UAAU,CAAC;AAS3C,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE9D;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EAClD,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE,EAAE,EAC/B,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,GACxB,aAAa,CAAC,IAAI,CAAC,CAGrB;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EACxD,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE,EAAE,EAC/B,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,GACxB,aAAa,CAAC,WAAW,CAAC,CAI5B;AA6CD,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EACvD,KAAK,EAAE,gBAAgB,EAAE,EAAE,EAC3B,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,GACxB,aAAa,CAAC,WAAW,CAAC,CA2C5B"} \ No newline at end of file +{"version":3,"file":"compile.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/css-select/0f0725a9dfeddd2fdb54eda9656cdbab5bbf6be6/src/","sources":["compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,QAAQ,EAAgB,MAAM,UAAU,CAAC;AAQzD,OAAO,KAAK,EACR,aAAa,EACb,eAAe,EACf,gBAAgB,EACnB,MAAM,YAAY,CAAC;AAEpB;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EAClD,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE,EAAE,EAC/B,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,GACxB,aAAa,CAAC,IAAI,CAAC,CAGrB;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EACxD,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE,EAAE,EAC/B,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,GACxB,aAAa,CAAC,WAAW,CAAC,CAG5B;AAqDD,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EACvD,KAAK,EAAE,gBAAgB,EAAE,EAAE,EAC3B,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,GACxB,aAAa,CAAC,WAAW,CAAC,CAsD5B"} \ No newline at end of file diff --git a/node_modules/css-select/lib/compile.js b/node_modules/css-select/lib/compile.js index 4f3e29a..cf0507c 100644 --- a/node_modules/css-select/lib/compile.js +++ b/node_modules/css-select/lib/compile.js @@ -1,15 +1,37 @@ "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.compileToken = exports.compileUnsafe = exports.compile = void 0; var css_what_1 = require("css-what"); -var boolbase_1 = require("boolbase"); -var sort_1 = __importDefault(require("./sort")); -var procedure_1 = require("./procedure"); -var general_1 = require("./general"); -var subselects_1 = require("./pseudo-selectors/subselects"); +var boolbase_1 = __importDefault(require("boolbase")); +var sort_js_1 = __importStar(require("./sort.js")); +var general_js_1 = require("./general.js"); +var subselects_js_1 = require("./pseudo-selectors/subselects.js"); /** * Compiles a selector to an executable function. * @@ -19,27 +41,31 @@ var subselects_1 = require("./pseudo-selectors/subselects"); */ function compile(selector, options, context) { var next = compileUnsafe(selector, options, context); - return subselects_1.ensureIsTag(next, options.adapter); + return (0, subselects_js_1.ensureIsTag)(next, options.adapter); } exports.compile = compile; function compileUnsafe(selector, options, context) { - var token = typeof selector === "string" ? css_what_1.parse(selector, options) : selector; + var token = typeof selector === "string" ? (0, css_what_1.parse)(selector) : selector; return compileToken(token, options, context); } exports.compileUnsafe = compileUnsafe; function includesScopePseudo(t) { - return (t.type === "pseudo" && + return (t.type === css_what_1.SelectorType.Pseudo && (t.name === "scope" || (Array.isArray(t.data) && t.data.some(function (data) { return data.some(includesScopePseudo); })))); } -var DESCENDANT_TOKEN = { type: "descendant" }; +var DESCENDANT_TOKEN = { type: css_what_1.SelectorType.Descendant }; var FLEXIBLE_DESCENDANT_TOKEN = { type: "_flexibleDescendant", }; -var SCOPE_TOKEN = { type: "pseudo", name: "scope", data: null }; +var SCOPE_TOKEN = { + type: css_what_1.SelectorType.Pseudo, + name: "scope", + data: null, +}; /* - * CSS 4 Spec (Draft): 3.3.1. Absolutizing a Scope-relative Selector + * CSS 4 Spec (Draft): 3.4.1. Absolutizing a Relative Selector * http://www.w3.org/TR/selectors4/#absolutizing */ function absolutize(token, _a, context) { @@ -47,11 +73,13 @@ function absolutize(token, _a, context) { // TODO Use better check if the context is a document var hasContext = !!(context === null || context === void 0 ? void 0 : context.every(function (e) { var parent = adapter.isTag(e) && adapter.getParent(e); - return e === subselects_1.PLACEHOLDER_ELEMENT || (parent && adapter.isTag(parent)); + return e === subselects_js_1.PLACEHOLDER_ELEMENT || (parent && adapter.isTag(parent)); })); for (var _i = 0, token_1 = token; _i < token_1.length; _i++) { var t = token_1[_i]; - if (t.length > 0 && procedure_1.isTraversal(t[0]) && t[0].type !== "descendant") { + if (t.length > 0 && + (0, sort_js_1.isTraversal)(t[0]) && + t[0].type !== css_what_1.SelectorType.Descendant) { // Don't continue in else branch } else if (hasContext && !t.some(includesScopePseudo)) { @@ -65,31 +93,38 @@ function absolutize(token, _a, context) { } function compileToken(token, options, context) { var _a; - token = token.filter(function (t) { return t.length > 0; }); - token.forEach(sort_1.default); + token.forEach(sort_js_1.default); context = (_a = options.context) !== null && _a !== void 0 ? _a : context; var isArrayContext = Array.isArray(context); var finalContext = context && (Array.isArray(context) ? context : [context]); - absolutize(token, options, finalContext); + // Check if the selector is relative + if (options.relativeSelector !== false) { + absolutize(token, options, finalContext); + } + else if (token.some(function (t) { return t.length > 0 && (0, sort_js_1.isTraversal)(t[0]); })) { + throw new Error("Relative selectors are not allowed when the `relativeSelector` option is disabled"); + } var shouldTestNextSiblings = false; var query = token .map(function (rules) { if (rules.length >= 2) { var first = rules[0], second = rules[1]; - if (first.type !== "pseudo" || first.name !== "scope") { + if (first.type !== css_what_1.SelectorType.Pseudo || + first.name !== "scope") { // Ignore } - else if (isArrayContext && second.type === "descendant") { + else if (isArrayContext && + second.type === css_what_1.SelectorType.Descendant) { rules[1] = FLEXIBLE_DESCENDANT_TOKEN; } - else if (second.type === "adjacent" || - second.type === "sibling") { + else if (second.type === css_what_1.SelectorType.Adjacent || + second.type === css_what_1.SelectorType.Sibling) { shouldTestNextSiblings = true; } } return compileRules(rules, options, finalContext); }) - .reduce(reduceRules, boolbase_1.falseFunc); + .reduce(reduceRules, boolbase_1.default.falseFunc); query.shouldTestNextSiblings = shouldTestNextSiblings; return query; } @@ -97,19 +132,20 @@ exports.compileToken = compileToken; function compileRules(rules, options, context) { var _a; return rules.reduce(function (previous, rule) { - return previous === boolbase_1.falseFunc - ? boolbase_1.falseFunc - : general_1.compileGeneralSelector(previous, rule, options, context, compileToken); - }, (_a = options.rootFunc) !== null && _a !== void 0 ? _a : boolbase_1.trueFunc); + return previous === boolbase_1.default.falseFunc + ? boolbase_1.default.falseFunc + : (0, general_js_1.compileGeneralSelector)(previous, rule, options, context, compileToken); + }, (_a = options.rootFunc) !== null && _a !== void 0 ? _a : boolbase_1.default.trueFunc); } function reduceRules(a, b) { - if (b === boolbase_1.falseFunc || a === boolbase_1.trueFunc) { + if (b === boolbase_1.default.falseFunc || a === boolbase_1.default.trueFunc) { return a; } - if (a === boolbase_1.falseFunc || b === boolbase_1.trueFunc) { + if (a === boolbase_1.default.falseFunc || b === boolbase_1.default.trueFunc) { return b; } return function combine(elem) { return a(elem) || b(elem); }; } +//# sourceMappingURL=compile.js.map \ No newline at end of file diff --git a/node_modules/css-select/lib/general.d.ts b/node_modules/css-select/lib/general.d.ts index de69fee..2baa1f3 100644 --- a/node_modules/css-select/lib/general.d.ts +++ b/node_modules/css-select/lib/general.d.ts @@ -1,3 +1,3 @@ -import type { CompiledQuery, InternalOptions, InternalSelector, CompileToken } from "./types"; +import type { CompiledQuery, InternalOptions, InternalSelector, CompileToken } from "./types.js"; export declare function compileGeneralSelector(next: CompiledQuery, selector: InternalSelector, options: InternalOptions, context: Node[] | undefined, compileToken: CompileToken): CompiledQuery; //# sourceMappingURL=general.d.ts.map \ No newline at end of file diff --git a/node_modules/css-select/lib/general.d.ts.map b/node_modules/css-select/lib/general.d.ts.map index ef605f7..82c8d6d 100644 --- a/node_modules/css-select/lib/general.d.ts.map +++ b/node_modules/css-select/lib/general.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../src/general.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,YAAY,EACf,MAAM,SAAS,CAAC;AAMjB,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EACjE,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,EAChC,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,OAAO,EAAE,IAAI,EAAE,GAAG,SAAS,EAC3B,YAAY,EAAE,YAAY,CAAC,IAAI,EAAE,WAAW,CAAC,GAC9C,aAAa,CAAC,WAAW,CAAC,CAwH5B"} \ No newline at end of file +{"version":3,"file":"general.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/css-select/0f0725a9dfeddd2fdb54eda9656cdbab5bbf6be6/src/","sources":["general.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAER,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,YAAY,EACf,MAAM,YAAY,CAAC;AAkBpB,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EACjE,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,EAChC,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,OAAO,EAAE,IAAI,EAAE,GAAG,SAAS,EAC3B,YAAY,EAAE,YAAY,CAAC,IAAI,EAAE,WAAW,CAAC,GAC9C,aAAa,CAAC,WAAW,CAAC,CAiK5B"} \ No newline at end of file diff --git a/node_modules/css-select/lib/general.js b/node_modules/css-select/lib/general.js index 56a405c..5c06800 100644 --- a/node_modules/css-select/lib/general.js +++ b/node_modules/css-select/lib/general.js @@ -1,33 +1,61 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.compileGeneralSelector = void 0; -var attributes_1 = require("./attributes"); -var pseudo_selectors_1 = require("./pseudo-selectors"); +var attributes_js_1 = require("./attributes.js"); +var index_js_1 = require("./pseudo-selectors/index.js"); +var css_what_1 = require("css-what"); +function getElementParent(node, adapter) { + var parent = adapter.getParent(node); + if (parent && adapter.isTag(parent)) { + return parent; + } + return null; +} /* * All available rules */ function compileGeneralSelector(next, selector, options, context, compileToken) { var adapter = options.adapter, equals = options.equals; switch (selector.type) { - case "pseudo-element": + case css_what_1.SelectorType.PseudoElement: { throw new Error("Pseudo-elements are not supported by css-select"); - case "attribute": - return attributes_1.attributeRules[selector.action](next, selector, options); - case "pseudo": - return pseudo_selectors_1.compilePseudoSelector(next, selector, options, context, compileToken); + } + case css_what_1.SelectorType.ColumnCombinator: { + throw new Error("Column combinators are not yet supported by css-select"); + } + case css_what_1.SelectorType.Attribute: { + if (selector.namespace != null) { + throw new Error("Namespaced attributes are not yet supported by css-select"); + } + if (!options.xmlMode || options.lowerCaseAttributeNames) { + selector.name = selector.name.toLowerCase(); + } + return attributes_js_1.attributeRules[selector.action](next, selector, options); + } + case css_what_1.SelectorType.Pseudo: { + return (0, index_js_1.compilePseudoSelector)(next, selector, options, context, compileToken); + } // Tags - case "tag": + case css_what_1.SelectorType.Tag: { + if (selector.namespace != null) { + throw new Error("Namespaced tag names are not yet supported by css-select"); + } + var name_1 = selector.name; + if (!options.xmlMode || options.lowerCaseTags) { + name_1 = name_1.toLowerCase(); + } return function tag(elem) { - return adapter.getName(elem) === selector.name && next(elem); + return adapter.getName(elem) === name_1 && next(elem); }; + } // Traversal - case "descendant": + case css_what_1.SelectorType.Descendant: { if (options.cacheResults === false || typeof WeakSet === "undefined") { return function descendant(elem) { var current = elem; - while ((current = adapter.getParent(current))) { - if (adapter.isTag(current) && next(current)) { + while ((current = getElementParent(current, adapter))) { + if (next(current)) { return true; } } @@ -35,11 +63,10 @@ function compileGeneralSelector(next, selector, options, context, compileToken) }; } // @ts-expect-error `ElementNode` is not extending object - // eslint-disable-next-line no-case-declarations var isFalseCache_1 = new WeakSet(); return function cachedDescendant(elem) { var current = elem; - while ((current = adapter.getParent(current))) { + while ((current = getElementParent(current, adapter))) { if (!isFalseCache_1.has(current)) { if (adapter.isTag(current) && next(current)) { return true; @@ -49,28 +76,32 @@ function compileGeneralSelector(next, selector, options, context, compileToken) } return false; }; - case "_flexibleDescendant": + } + case "_flexibleDescendant": { // Include element itself, only used while querying an array return function flexibleDescendant(elem) { var current = elem; do { - if (adapter.isTag(current) && next(current)) + if (next(current)) return true; - } while ((current = adapter.getParent(current))); + } while ((current = getElementParent(current, adapter))); return false; }; - case "parent": + } + case css_what_1.SelectorType.Parent: { return function parent(elem) { return adapter .getChildren(elem) .some(function (elem) { return adapter.isTag(elem) && next(elem); }); }; - case "child": + } + case css_what_1.SelectorType.Child: { return function child(elem) { var parent = adapter.getParent(elem); return parent != null && adapter.isTag(parent) && next(parent); }; - case "sibling": + } + case css_what_1.SelectorType.Sibling: { return function sibling(elem) { var siblings = adapter.getSiblings(elem); for (var i = 0; i < siblings.length; i++) { @@ -83,7 +114,14 @@ function compileGeneralSelector(next, selector, options, context, compileToken) } return false; }; - case "adjacent": + } + case css_what_1.SelectorType.Adjacent: { + if (adapter.prevElementSibling) { + return function adjacent(elem) { + var previous = adapter.prevElementSibling(elem); + return previous != null && next(previous); + }; + } return function adjacent(elem) { var siblings = adapter.getSiblings(elem); var lastElement; @@ -97,8 +135,14 @@ function compileGeneralSelector(next, selector, options, context, compileToken) } return !!lastElement && next(lastElement); }; - case "universal": + } + case css_what_1.SelectorType.Universal: { + if (selector.namespace != null && selector.namespace !== "*") { + throw new Error("Namespaced universal selectors are not yet supported by css-select"); + } return next; + } } } exports.compileGeneralSelector = compileGeneralSelector; +//# sourceMappingURL=general.js.map \ No newline at end of file diff --git a/node_modules/css-select/lib/index.d.ts b/node_modules/css-select/lib/index.d.ts index 4d9f644..0911372 100644 --- a/node_modules/css-select/lib/index.d.ts +++ b/node_modules/css-select/lib/index.d.ts @@ -1,11 +1,11 @@ -import type { CompiledQuery, Options, Query, Adapter } from "./types"; +import type { CompiledQuery, Options, Query, Adapter } from "./types.js"; export type { Options }; /** * Compiles the query, returns a function. */ -export declare const compile: (selector: string | import("css-what").Selector[][], options?: Options | undefined, context?: Node_1 | Node_1[] | undefined) => CompiledQuery; -export declare const _compileUnsafe: (selector: string | import("css-what").Selector[][], options?: Options | undefined, context?: Node_1 | Node_1[] | undefined) => CompiledQuery; -export declare const _compileToken: (selector: import("./types").InternalSelector[][], options?: Options | undefined, context?: Node_1 | Node_1[] | undefined) => CompiledQuery; +export declare const compile: (selector: string | import("css-what").Selector[][], options?: Options | undefined, context?: Node | Node[] | undefined) => CompiledQuery; +export declare const _compileUnsafe: (selector: string | import("css-what").Selector[][], options?: Options | undefined, context?: Node | Node[] | undefined) => CompiledQuery; +export declare const _compileToken: (selector: import("./types.js").InternalSelector[][], options?: Options | undefined, context?: Node | Node[] | undefined) => CompiledQuery; export declare function prepareContext(elems: Node | Node[], adapter: Adapter, shouldTestNextSiblings?: boolean): Node[]; /** * @template Node The generic Node type for the DOM adapter being used. @@ -17,7 +17,7 @@ export declare function prepareContext(elems: No * @returns All matching elements. * */ -export declare const selectAll: (query: Query, elements: Node_1 | Node_1[], options?: Options | undefined) => ElementNode[]; +export declare const selectAll: (query: Query, elements: Node | Node[], options?: Options | undefined) => ElementNode[]; /** * @template Node The generic Node type for the DOM adapter being used. * @template ElementNode The Node type for elements for the DOM adapter being used. @@ -27,7 +27,7 @@ export declare const selectAll: (query: Quer * @see compile for supported selector queries. * @returns the first match, or null if there was no match. */ -export declare const selectOne: (query: Query, elements: Node_1 | Node_1[], options?: Options | undefined) => ElementNode | null; +export declare const selectOne: (query: Query, elements: Node | Node[], options?: Options | undefined) => ElementNode | null; /** * Tests whether or not an element is matched by query. * @@ -45,5 +45,6 @@ export declare function is(elem: ElementNode, qu * @see [compile] for supported selector queries. */ export default selectAll; -export { filters, pseudos, aliases } from "./pseudo-selectors"; +/** @deprecated Use the `pseudos` option instead. */ +export { filters, pseudos, aliases } from "./pseudo-selectors/index.js"; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/css-select/lib/index.d.ts.map b/node_modules/css-select/lib/index.d.ts.map index 4ff9e84..120c4fe 100644 --- a/node_modules/css-select/lib/index.d.ts.map +++ b/node_modules/css-select/lib/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACR,aAAa,EACb,OAAO,EAEP,KAAK,EACL,OAAO,EAEV,MAAM,SAAS,CAAC;AAGjB,YAAY,EAAE,OAAO,EAAE,CAAC;AA0CxB;;GAEG;AACH,eAAO,MAAM,OAAO,gNAA0B,CAAC;AAC/C,eAAO,MAAM,cAAc,qNAA6B,CAAC;AACzD,eAAO,MAAM,aAAa,mNAA4B,CAAC;AA6BvD,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EACzD,KAAK,EAAE,IAAI,GAAG,IAAI,EAAE,EACpB,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,EACnC,sBAAsB,UAAQ,GAC/B,IAAI,EAAE,CAYR;AAgBD;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,mKASrB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,wKASrB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,EAAE,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EAC7C,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,EACzB,OAAO,CAAC,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,GACrC,OAAO,CAKT;AAED;;;GAGG;AACH,eAAe,SAAS,CAAC;AAGzB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/css-select/0f0725a9dfeddd2fdb54eda9656cdbab5bbf6be6/src/","sources":["index.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACR,aAAa,EACb,OAAO,EAEP,KAAK,EACL,OAAO,EAEV,MAAM,YAAY,CAAC;AAGpB,YAAY,EAAE,OAAO,EAAE,CAAC;AA0CxB;;GAEG;AACH,eAAO,MAAM,OAAO,oMAA0B,CAAC;AAC/C,eAAO,MAAM,cAAc,2MAA6B,CAAC;AACzD,eAAO,MAAM,aAAa,4MAA4B,CAAC;AA6BvD,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EACzD,KAAK,EAAE,IAAI,GAAG,IAAI,EAAE,EACpB,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,EACnC,sBAAsB,UAAQ,GAC/B,IAAI,EAAE,CAYR;AAiBD;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,yJASrB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,8JASrB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,EAAE,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EAC7C,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,EACzB,OAAO,CAAC,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,GACrC,OAAO,CAKT;AAED;;;GAGG;AACH,eAAe,SAAS,CAAC;AAGzB,oDAAoD;AACpD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC"} \ No newline at end of file diff --git a/node_modules/css-select/lib/index.js b/node_modules/css-select/lib/index.js index 17422ba..0dc6da0 100644 --- a/node_modules/css-select/lib/index.js +++ b/node_modules/css-select/lib/index.js @@ -1,7 +1,11 @@ "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; @@ -18,12 +22,15 @@ var __importStar = (this && this.__importStar) || function (mod) { __setModuleDefault(result, mod); return result; }; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.aliases = exports.pseudos = exports.filters = exports.is = exports.selectOne = exports.selectAll = exports.prepareContext = exports._compileToken = exports._compileUnsafe = exports.compile = void 0; var DomUtils = __importStar(require("domutils")); -var boolbase_1 = require("boolbase"); -var compile_1 = require("./compile"); -var subselects_1 = require("./pseudo-selectors/subselects"); +var boolbase_1 = __importDefault(require("boolbase")); +var compile_js_1 = require("./compile.js"); +var subselects_js_1 = require("./pseudo-selectors/subselects.js"); var defaultEquals = function (a, b) { return a === b; }; var defaultOptions = { adapter: DomUtils, @@ -51,14 +58,14 @@ function wrapCompile(func) { /** * Compiles the query, returns a function. */ -exports.compile = wrapCompile(compile_1.compile); -exports._compileUnsafe = wrapCompile(compile_1.compileUnsafe); -exports._compileToken = wrapCompile(compile_1.compileToken); +exports.compile = wrapCompile(compile_js_1.compile); +exports._compileUnsafe = wrapCompile(compile_js_1.compileUnsafe); +exports._compileToken = wrapCompile(compile_js_1.compileToken); function getSelectorFunc(searchFunc) { return function select(query, elements, options) { var opts = convertOptionFormats(options); if (typeof query !== "function") { - query = compile_1.compileUnsafe(query, opts, elements); + query = (0, compile_js_1.compileUnsafe)(query, opts, elements); } var filteredElements = prepareContext(elements, opts.adapter, query.shouldTestNextSiblings); return searchFunc(query, filteredElements, opts); @@ -81,8 +88,9 @@ exports.prepareContext = prepareContext; function appendNextSiblings(elem, adapter) { // Order matters because jQuery seems to check the children before the siblings var elems = Array.isArray(elem) ? elem.slice(0) : [elem]; - for (var i = 0; i < elems.length; i++) { - var nextSiblings = subselects_1.getNextSiblings(elems[i], adapter); + var elemsLength = elems.length; + for (var i = 0; i < elemsLength; i++) { + var nextSiblings = (0, subselects_js_1.getNextSiblings)(elems[i], adapter); elems.push.apply(elems, nextSiblings); } return elems; @@ -98,7 +106,7 @@ function appendNextSiblings(elem, adapter) { * */ exports.selectAll = getSelectorFunc(function (query, elems, options) { - return query === boolbase_1.falseFunc || !elems || elems.length === 0 + return query === boolbase_1.default.falseFunc || !elems || elems.length === 0 ? [] : options.adapter.findAll(query, elems); }); @@ -112,7 +120,7 @@ exports.selectAll = getSelectorFunc(function (query, elems, options) { * @returns the first match, or null if there was no match. */ exports.selectOne = getSelectorFunc(function (query, elems, options) { - return query === boolbase_1.falseFunc || !elems || elems.length === 0 + return query === boolbase_1.default.falseFunc || !elems || elems.length === 0 ? null : options.adapter.findOne(query, elems); }); @@ -129,7 +137,7 @@ exports.selectOne = getSelectorFunc(function (query, elems, options) { */ function is(elem, query, options) { var opts = convertOptionFormats(options); - return (typeof query === "function" ? query : compile_1.compile(query, opts))(elem); + return (typeof query === "function" ? query : (0, compile_js_1.compile)(query, opts))(elem); } exports.is = is; /** @@ -138,7 +146,9 @@ exports.is = is; */ exports.default = exports.selectAll; // Export filters, pseudos and aliases to allow users to supply their own. -var pseudo_selectors_1 = require("./pseudo-selectors"); -Object.defineProperty(exports, "filters", { enumerable: true, get: function () { return pseudo_selectors_1.filters; } }); -Object.defineProperty(exports, "pseudos", { enumerable: true, get: function () { return pseudo_selectors_1.pseudos; } }); -Object.defineProperty(exports, "aliases", { enumerable: true, get: function () { return pseudo_selectors_1.aliases; } }); +/** @deprecated Use the `pseudos` option instead. */ +var index_js_1 = require("./pseudo-selectors/index.js"); +Object.defineProperty(exports, "filters", { enumerable: true, get: function () { return index_js_1.filters; } }); +Object.defineProperty(exports, "pseudos", { enumerable: true, get: function () { return index_js_1.pseudos; } }); +Object.defineProperty(exports, "aliases", { enumerable: true, get: function () { return index_js_1.aliases; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/css-select/lib/procedure.d.ts b/node_modules/css-select/lib/procedure.d.ts deleted file mode 100644 index a911623..0000000 --- a/node_modules/css-select/lib/procedure.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { Traversal } from "css-what"; -import type { InternalSelector } from "./types"; -export declare const procedure: Record; -export declare function isTraversal(t: InternalSelector): t is Traversal; -//# sourceMappingURL=procedure.d.ts.map \ No newline at end of file diff --git a/node_modules/css-select/lib/procedure.d.ts.map b/node_modules/css-select/lib/procedure.d.ts.map deleted file mode 100644 index fb47658..0000000 --- a/node_modules/css-select/lib/procedure.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"procedure.d.ts","sourceRoot":"","sources":["../src/procedure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,CAY9D,CAAC;AAEF,wBAAgB,WAAW,CAAC,CAAC,EAAE,gBAAgB,GAAG,CAAC,IAAI,SAAS,CAE/D"} \ No newline at end of file diff --git a/node_modules/css-select/lib/procedure.js b/node_modules/css-select/lib/procedure.js deleted file mode 100644 index d28f368..0000000 --- a/node_modules/css-select/lib/procedure.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isTraversal = exports.procedure = void 0; -exports.procedure = { - universal: 50, - tag: 30, - attribute: 1, - pseudo: 0, - "pseudo-element": 0, - descendant: -1, - child: -1, - parent: -1, - sibling: -1, - adjacent: -1, - _flexibleDescendant: -1, -}; -function isTraversal(t) { - return exports.procedure[t.type] < 0; -} -exports.isTraversal = isTraversal; diff --git a/node_modules/css-select/lib/pseudo-selectors/aliases.d.ts.map b/node_modules/css-select/lib/pseudo-selectors/aliases.d.ts.map index 5734659..37c9e8c 100644 --- a/node_modules/css-select/lib/pseudo-selectors/aliases.d.ts.map +++ b/node_modules/css-select/lib/pseudo-selectors/aliases.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"aliases.d.ts","sourceRoot":"","sources":["../../src/pseudo-selectors/aliases.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAwC1C,CAAC"} \ No newline at end of file +{"version":3,"file":"aliases.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/css-select/0f0725a9dfeddd2fdb54eda9656cdbab5bbf6be6/src/","sources":["pseudo-selectors/aliases.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAwC1C,CAAC"} \ No newline at end of file diff --git a/node_modules/css-select/lib/pseudo-selectors/aliases.js b/node_modules/css-select/lib/pseudo-selectors/aliases.js index f9a03da..c259889 100644 --- a/node_modules/css-select/lib/pseudo-selectors/aliases.js +++ b/node_modules/css-select/lib/pseudo-selectors/aliases.js @@ -31,3 +31,4 @@ exports.aliases = { input: ":is(input, textarea, select, button)", text: "input:is(:not([type!='']), [type=text])", }; +//# sourceMappingURL=aliases.js.map \ No newline at end of file diff --git a/node_modules/css-select/lib/pseudo-selectors/filters.d.ts b/node_modules/css-select/lib/pseudo-selectors/filters.d.ts index 90634f7..a75d063 100644 --- a/node_modules/css-select/lib/pseudo-selectors/filters.d.ts +++ b/node_modules/css-select/lib/pseudo-selectors/filters.d.ts @@ -1,4 +1,4 @@ -import type { CompiledQuery, InternalOptions } from "../types"; +import type { CompiledQuery, InternalOptions } from "../types.js"; export declare type Filter = (next: CompiledQuery, text: string, options: InternalOptions, context?: Node[]) => CompiledQuery; export declare const filters: Record; //# sourceMappingURL=filters.d.ts.map \ No newline at end of file diff --git a/node_modules/css-select/lib/pseudo-selectors/filters.d.ts.map b/node_modules/css-select/lib/pseudo-selectors/filters.d.ts.map index c2caa25..86f1cef 100644 --- a/node_modules/css-select/lib/pseudo-selectors/filters.d.ts.map +++ b/node_modules/css-select/lib/pseudo-selectors/filters.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../src/pseudo-selectors/filters.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAW,MAAM,UAAU,CAAC;AAExE,oBAAY,MAAM,GAAG,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EAChD,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,EAChC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,OAAO,CAAC,EAAE,IAAI,EAAE,KACf,aAAa,CAAC,WAAW,CAAC,CAAC;AAYhC,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA2I1C,CAAC"} \ No newline at end of file +{"version":3,"file":"filters.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/css-select/0f0725a9dfeddd2fdb54eda9656cdbab5bbf6be6/src/","sources":["pseudo-selectors/filters.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAW,MAAM,aAAa,CAAC;AAE3E,oBAAY,MAAM,GAAG,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EAChD,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,EAChC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,OAAO,CAAC,EAAE,IAAI,EAAE,KACf,aAAa,CAAC,WAAW,CAAC,CAAC;AAYhC,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA2I1C,CAAC"} \ No newline at end of file diff --git a/node_modules/css-select/lib/pseudo-selectors/filters.js b/node_modules/css-select/lib/pseudo-selectors/filters.js index cdb8d02..981ec2f 100644 --- a/node_modules/css-select/lib/pseudo-selectors/filters.js +++ b/node_modules/css-select/lib/pseudo-selectors/filters.js @@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); exports.filters = void 0; var nth_check_1 = __importDefault(require("nth-check")); -var boolbase_1 = require("boolbase"); +var boolbase_1 = __importDefault(require("boolbase")); function getChildFunc(next, adapter) { return function (elem) { var parent = adapter.getParent(elem); @@ -30,10 +30,10 @@ exports.filters = { // Location specific methods "nth-child": function (next, rule, _a) { var adapter = _a.adapter, equals = _a.equals; - var func = nth_check_1.default(rule); - if (func === boolbase_1.falseFunc) - return boolbase_1.falseFunc; - if (func === boolbase_1.trueFunc) + var func = (0, nth_check_1.default)(rule); + if (func === boolbase_1.default.falseFunc) + return boolbase_1.default.falseFunc; + if (func === boolbase_1.default.trueFunc) return getChildFunc(next, adapter); return function nthChild(elem) { var siblings = adapter.getSiblings(elem); @@ -50,10 +50,10 @@ exports.filters = { }, "nth-last-child": function (next, rule, _a) { var adapter = _a.adapter, equals = _a.equals; - var func = nth_check_1.default(rule); - if (func === boolbase_1.falseFunc) - return boolbase_1.falseFunc; - if (func === boolbase_1.trueFunc) + var func = (0, nth_check_1.default)(rule); + if (func === boolbase_1.default.falseFunc) + return boolbase_1.default.falseFunc; + if (func === boolbase_1.default.trueFunc) return getChildFunc(next, adapter); return function nthLastChild(elem) { var siblings = adapter.getSiblings(elem); @@ -70,10 +70,10 @@ exports.filters = { }, "nth-of-type": function (next, rule, _a) { var adapter = _a.adapter, equals = _a.equals; - var func = nth_check_1.default(rule); - if (func === boolbase_1.falseFunc) - return boolbase_1.falseFunc; - if (func === boolbase_1.trueFunc) + var func = (0, nth_check_1.default)(rule); + if (func === boolbase_1.default.falseFunc) + return boolbase_1.default.falseFunc; + if (func === boolbase_1.default.trueFunc) return getChildFunc(next, adapter); return function nthOfType(elem) { var siblings = adapter.getSiblings(elem); @@ -92,10 +92,10 @@ exports.filters = { }, "nth-last-of-type": function (next, rule, _a) { var adapter = _a.adapter, equals = _a.equals; - var func = nth_check_1.default(rule); - if (func === boolbase_1.falseFunc) - return boolbase_1.falseFunc; - if (func === boolbase_1.trueFunc) + var func = (0, nth_check_1.default)(rule); + if (func === boolbase_1.default.falseFunc) + return boolbase_1.default.falseFunc; + if (func === boolbase_1.default.trueFunc) return getChildFunc(next, adapter); return function nthLastOfType(elem) { var siblings = adapter.getSiblings(elem); @@ -124,7 +124,7 @@ exports.filters = { var equals = options.equals; if (!context || context.length === 0) { // Equivalent to :root - return exports.filters.root(next, rule, options); + return exports.filters["root"](next, rule, options); } if (context.length === 1) { // NOTE: can't be unpacked, as :has uses this for side-effects @@ -147,10 +147,11 @@ function dynamicStatePseudo(name) { var adapter = _a.adapter; var func = adapter[name]; if (typeof func !== "function") { - return boolbase_1.falseFunc; + return boolbase_1.default.falseFunc; } return function active(elem) { return func(elem) && next(elem); }; }; } +//# sourceMappingURL=filters.js.map \ No newline at end of file diff --git a/node_modules/css-select/lib/pseudo-selectors/index.d.ts b/node_modules/css-select/lib/pseudo-selectors/index.d.ts index 70f467d..2c41913 100644 --- a/node_modules/css-select/lib/pseudo-selectors/index.d.ts +++ b/node_modules/css-select/lib/pseudo-selectors/index.d.ts @@ -1,8 +1,8 @@ -import type { CompiledQuery, InternalOptions, CompileToken } from "../types"; +import type { CompiledQuery, InternalOptions, CompileToken } from "../types.js"; import { PseudoSelector } from "css-what"; -import { filters } from "./filters"; -import { pseudos } from "./pseudos"; -import { aliases } from "./aliases"; +import { filters } from "./filters.js"; +import { pseudos } from "./pseudos.js"; +import { aliases } from "./aliases.js"; export { filters, pseudos, aliases }; export declare function compilePseudoSelector(next: CompiledQuery, selector: PseudoSelector, options: InternalOptions, context: Node[] | undefined, compileToken: CompileToken): CompiledQuery; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/css-select/lib/pseudo-selectors/index.d.ts.map b/node_modules/css-select/lib/pseudo-selectors/index.d.ts.map index abe85a6..ba14097 100644 --- a/node_modules/css-select/lib/pseudo-selectors/index.d.ts.map +++ b/node_modules/css-select/lib/pseudo-selectors/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pseudo-selectors/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7E,OAAO,EAAS,cAAc,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAoB,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAErC,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EAChE,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,EAChC,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,OAAO,EAAE,IAAI,EAAE,GAAG,SAAS,EAC3B,YAAY,EAAE,YAAY,CAAC,IAAI,EAAE,WAAW,CAAC,GAC9C,aAAa,CAAC,WAAW,CAAC,CA6B5B"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/css-select/0f0725a9dfeddd2fdb54eda9656cdbab5bbf6be6/src/","sources":["pseudo-selectors/index.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAS,cAAc,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAoB,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAErC,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EAChE,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,EAChC,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,OAAO,EAAE,IAAI,EAAE,GAAG,SAAS,EAC3B,YAAY,EAAE,YAAY,CAAC,IAAI,EAAE,WAAW,CAAC,GAC9C,aAAa,CAAC,WAAW,CAAC,CA4C5B"} \ No newline at end of file diff --git a/node_modules/css-select/lib/pseudo-selectors/index.js b/node_modules/css-select/lib/pseudo-selectors/index.js index 849b893..2536786 100644 --- a/node_modules/css-select/lib/pseudo-selectors/index.js +++ b/node_modules/css-select/lib/pseudo-selectors/index.js @@ -1,54 +1,46 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.compilePseudoSelector = exports.aliases = exports.pseudos = exports.filters = void 0; -/* - * Pseudo selectors - * - * Pseudo selectors are available in three forms: - * - * 1. Filters are called when the selector is compiled and return a function - * that has to return either false, or the results of `next()`. - * 2. Pseudos are called on execution. They have to return a boolean. - * 3. Subselects work like filters, but have an embedded selector that will be run separately. - * - * Filters are great if you want to do some pre-processing, or change the call order - * of `next()` and your code. - * Pseudos should be used to implement simple checks. - */ -var boolbase_1 = require("boolbase"); var css_what_1 = require("css-what"); -var filters_1 = require("./filters"); -Object.defineProperty(exports, "filters", { enumerable: true, get: function () { return filters_1.filters; } }); -var pseudos_1 = require("./pseudos"); -Object.defineProperty(exports, "pseudos", { enumerable: true, get: function () { return pseudos_1.pseudos; } }); -var aliases_1 = require("./aliases"); -Object.defineProperty(exports, "aliases", { enumerable: true, get: function () { return aliases_1.aliases; } }); -var subselects_1 = require("./subselects"); +var filters_js_1 = require("./filters.js"); +Object.defineProperty(exports, "filters", { enumerable: true, get: function () { return filters_js_1.filters; } }); +var pseudos_js_1 = require("./pseudos.js"); +Object.defineProperty(exports, "pseudos", { enumerable: true, get: function () { return pseudos_js_1.pseudos; } }); +var aliases_js_1 = require("./aliases.js"); +Object.defineProperty(exports, "aliases", { enumerable: true, get: function () { return aliases_js_1.aliases; } }); +var subselects_js_1 = require("./subselects.js"); function compilePseudoSelector(next, selector, options, context, compileToken) { + var _a; var name = selector.name, data = selector.data; if (Array.isArray(data)) { - return subselects_1.subselects[name](next, data, options, context, compileToken); + if (!(name in subselects_js_1.subselects)) { + throw new Error("Unknown pseudo-class :".concat(name, "(").concat(data, ")")); + } + return subselects_js_1.subselects[name](next, data, options, context, compileToken); } - if (name in aliases_1.aliases) { + var userPseudo = (_a = options.pseudos) === null || _a === void 0 ? void 0 : _a[name]; + var stringPseudo = typeof userPseudo === "string" ? userPseudo : aliases_js_1.aliases[name]; + if (typeof stringPseudo === "string") { if (data != null) { - throw new Error("Pseudo " + name + " doesn't have any arguments"); + throw new Error("Pseudo ".concat(name, " doesn't have any arguments")); } // The alias has to be parsed here, to make sure options are respected. - var alias = css_what_1.parse(aliases_1.aliases[name], options); - return subselects_1.subselects.is(next, alias, options, context, compileToken); + var alias = (0, css_what_1.parse)(stringPseudo); + return subselects_js_1.subselects["is"](next, alias, options, context, compileToken); } - if (name in filters_1.filters) { - return filters_1.filters[name](next, data, options, context); + if (typeof userPseudo === "function") { + (0, pseudos_js_1.verifyPseudoArgs)(userPseudo, name, data, 1); + return function (elem) { return userPseudo(elem, data) && next(elem); }; } - if (name in pseudos_1.pseudos) { - var pseudo_1 = pseudos_1.pseudos[name]; - pseudos_1.verifyPseudoArgs(pseudo_1, name, data); - return pseudo_1 === boolbase_1.falseFunc - ? boolbase_1.falseFunc - : next === boolbase_1.trueFunc - ? function (elem) { return pseudo_1(elem, options, data); } - : function (elem) { return pseudo_1(elem, options, data) && next(elem); }; + if (name in filters_js_1.filters) { + return filters_js_1.filters[name](next, data, options, context); } - throw new Error("unmatched pseudo-class :" + name); + if (name in pseudos_js_1.pseudos) { + var pseudo_1 = pseudos_js_1.pseudos[name]; + (0, pseudos_js_1.verifyPseudoArgs)(pseudo_1, name, data, 2); + return function (elem) { return pseudo_1(elem, options, data) && next(elem); }; + } + throw new Error("Unknown pseudo-class :".concat(name)); } exports.compilePseudoSelector = compilePseudoSelector; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/css-select/lib/pseudo-selectors/pseudos.d.ts b/node_modules/css-select/lib/pseudo-selectors/pseudos.d.ts index afd483f..cfcf8d6 100644 --- a/node_modules/css-select/lib/pseudo-selectors/pseudos.d.ts +++ b/node_modules/css-select/lib/pseudo-selectors/pseudos.d.ts @@ -1,6 +1,6 @@ -import { PseudoSelector } from "css-what"; -import type { InternalOptions } from "../types"; -export declare type Pseudo = (elem: ElementNode, options: InternalOptions, subselect?: ElementNode | string | null) => boolean; +import type { PseudoSelector } from "css-what"; +import type { InternalOptions } from "../types.js"; +export declare type Pseudo = (elem: ElementNode, options: InternalOptions, subselect?: string | null) => boolean; export declare const pseudos: Record; -export declare function verifyPseudoArgs(func: Pseudo, name: string, subselect: PseudoSelector["data"]): void; +export declare function verifyPseudoArgs>(func: (...args: T) => boolean, name: string, subselect: PseudoSelector["data"], argIndex: number): void; //# sourceMappingURL=pseudos.d.ts.map \ No newline at end of file diff --git a/node_modules/css-select/lib/pseudo-selectors/pseudos.d.ts.map b/node_modules/css-select/lib/pseudo-selectors/pseudos.d.ts.map index daa0f45..b2d1137 100644 --- a/node_modules/css-select/lib/pseudo-selectors/pseudos.d.ts.map +++ b/node_modules/css-select/lib/pseudo-selectors/pseudos.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"pseudos.d.ts","sourceRoot":"","sources":["../../src/pseudo-selectors/pseudos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,oBAAY,MAAM,GAAG,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EAChD,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,SAAS,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,KACtC,OAAO,CAAC;AAGb,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA8E1C,CAAC;AAEF,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,cAAc,CAAC,MAAM,CAAC,GAClC,IAAI,CAQN"} \ No newline at end of file +{"version":3,"file":"pseudos.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/css-select/0f0725a9dfeddd2fdb54eda9656cdbab5bbf6be6/src/","sources":["pseudo-selectors/pseudos.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,oBAAY,MAAM,GAAG,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EAChD,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,KACxB,OAAO,CAAC;AAGb,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAkF1C,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,KAAK,CAAC,OAAO,CAAC,EACrD,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,OAAO,EAC7B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,cAAc,CAAC,MAAM,CAAC,EACjC,QAAQ,EAAE,MAAM,GACjB,IAAI,CAQN"} \ No newline at end of file diff --git a/node_modules/css-select/lib/pseudo-selectors/pseudos.js b/node_modules/css-select/lib/pseudo-selectors/pseudos.js index 8b51343..050ac7f 100644 --- a/node_modules/css-select/lib/pseudo-selectors/pseudos.js +++ b/node_modules/css-select/lib/pseudo-selectors/pseudos.js @@ -12,6 +12,9 @@ exports.pseudos = { }, "first-child": function (elem, _a) { var adapter = _a.adapter, equals = _a.equals; + if (adapter.prevElementSibling) { + return adapter.prevElementSibling(elem) == null; + } var firstChild = adapter .getSiblings(elem) .find(function (elem) { return adapter.isTag(elem); }); @@ -76,14 +79,15 @@ exports.pseudos = { .every(function (sibling) { return equals(elem, sibling) || !adapter.isTag(sibling); }); }, }; -function verifyPseudoArgs(func, name, subselect) { +function verifyPseudoArgs(func, name, subselect, argIndex) { if (subselect === null) { - if (func.length > 2) { - throw new Error("pseudo-selector :" + name + " requires an argument"); + if (func.length > argIndex) { + throw new Error("Pseudo-class :".concat(name, " requires an argument")); } } - else if (func.length === 2) { - throw new Error("pseudo-selector :" + name + " doesn't have any arguments"); + else if (func.length === argIndex) { + throw new Error("Pseudo-class :".concat(name, " doesn't have any arguments")); } } exports.verifyPseudoArgs = verifyPseudoArgs; +//# sourceMappingURL=pseudos.js.map \ No newline at end of file diff --git a/node_modules/css-select/lib/pseudo-selectors/subselects.d.ts b/node_modules/css-select/lib/pseudo-selectors/subselects.d.ts index 192d880..6555ef2 100644 --- a/node_modules/css-select/lib/pseudo-selectors/subselects.d.ts +++ b/node_modules/css-select/lib/pseudo-selectors/subselects.d.ts @@ -1,6 +1,5 @@ -import { CompileToken } from "./../types"; import type { Selector } from "css-what"; -import type { CompiledQuery, InternalOptions, Adapter } from "../types"; +import type { CompiledQuery, InternalOptions, CompileToken, Adapter } from "../types.js"; /** Used as a placeholder for :has. Will be replaced with the actual element. */ export declare const PLACEHOLDER_ELEMENT: {}; export declare function ensureIsTag(next: CompiledQuery, adapter: Adapter): CompiledQuery; diff --git a/node_modules/css-select/lib/pseudo-selectors/subselects.d.ts.map b/node_modules/css-select/lib/pseudo-selectors/subselects.d.ts.map index 97186f3..9950c0c 100644 --- a/node_modules/css-select/lib/pseudo-selectors/subselects.d.ts.map +++ b/node_modules/css-select/lib/pseudo-selectors/subselects.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"subselects.d.ts","sourceRoot":"","sources":["../../src/pseudo-selectors/subselects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGxE,gFAAgF;AAChF,eAAO,MAAM,mBAAmB,IAAK,CAAC;AAEtC,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EACtD,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,EAChC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,GACpC,aAAa,CAAC,IAAI,CAAC,CAGrB;AAED,oBAAY,SAAS,GAAG,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EACnD,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,EAChC,SAAS,EAAE,QAAQ,EAAE,EAAE,EACvB,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,OAAO,EAAE,IAAI,EAAE,GAAG,SAAS,EAC3B,YAAY,EAAE,YAAY,CAAC,IAAI,EAAE,WAAW,CAAC,KAC5C,aAAa,CAAC,WAAW,CAAC,CAAC;AAEhC,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EAC1D,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,GACpC,WAAW,EAAE,CAMf;AAkBD,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CA4EhD,CAAC"} \ No newline at end of file +{"version":3,"file":"subselects.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/css-select/0f0725a9dfeddd2fdb54eda9656cdbab5bbf6be6/src/","sources":["pseudo-selectors/subselects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,KAAK,EACR,aAAa,EACb,eAAe,EACf,YAAY,EACZ,OAAO,EACV,MAAM,aAAa,CAAC;AAGrB,gFAAgF;AAChF,eAAO,MAAM,mBAAmB,IAAK,CAAC;AAEtC,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EACtD,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,EAChC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,GACpC,aAAa,CAAC,IAAI,CAAC,CAGrB;AAED,oBAAY,SAAS,GAAG,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EACnD,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,EAChC,SAAS,EAAE,QAAQ,EAAE,EAAE,EACvB,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EAC3C,OAAO,EAAE,IAAI,EAAE,GAAG,SAAS,EAC3B,YAAY,EAAE,YAAY,CAAC,IAAI,EAAE,WAAW,CAAC,KAC5C,aAAa,CAAC,WAAW,CAAC,CAAC;AAEhC,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,SAAS,IAAI,EAC1D,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,GACpC,WAAW,EAAE,CAMf;AAiCD,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAgEhD,CAAC"} \ No newline at end of file diff --git a/node_modules/css-select/lib/pseudo-selectors/subselects.js b/node_modules/css-select/lib/pseudo-selectors/subselects.js index 01c7cf8..d2f3b1c 100644 --- a/node_modules/css-select/lib/pseudo-selectors/subselects.js +++ b/node_modules/css-select/lib/pseudo-selectors/subselects.js @@ -1,18 +1,25 @@ "use strict"; -var __spreadArray = (this && this.__spreadArray) || function (to, from) { - for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) - to[j] = from[i]; - return to; +var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.subselects = exports.getNextSiblings = exports.ensureIsTag = exports.PLACEHOLDER_ELEMENT = void 0; -var boolbase_1 = require("boolbase"); -var procedure_1 = require("../procedure"); +var boolbase_1 = __importDefault(require("boolbase")); +var sort_js_1 = require("../sort.js"); /** Used as a placeholder for :has. Will be replaced with the actual element. */ exports.PLACEHOLDER_ELEMENT = {}; function ensureIsTag(next, adapter) { - if (next === boolbase_1.falseFunc) - return boolbase_1.falseFunc; + if (next === boolbase_1.default.falseFunc) + return boolbase_1.default.falseFunc; return function (elem) { return adapter.isTag(elem) && next(elem); }; } exports.ensureIsTag = ensureIsTag; @@ -26,75 +33,74 @@ function getNextSiblings(elem, adapter) { return siblings.slice(elemIndex + 1).filter(adapter.isTag); } exports.getNextSiblings = getNextSiblings; -var is = function (next, token, options, context, compileToken) { - var opts = { +function copyOptions(options) { + // Not copied: context, rootFunc + return { xmlMode: !!options.xmlMode, + lowerCaseAttributeNames: !!options.lowerCaseAttributeNames, + lowerCaseTags: !!options.lowerCaseTags, + quirksMode: !!options.quirksMode, + cacheResults: !!options.cacheResults, + pseudos: options.pseudos, adapter: options.adapter, equals: options.equals, }; - var func = compileToken(token, opts, context); - return function (elem) { return func(elem) && next(elem); }; +} +var is = function (next, token, options, context, compileToken) { + var func = compileToken(token, copyOptions(options), context); + return func === boolbase_1.default.trueFunc + ? next + : func === boolbase_1.default.falseFunc + ? boolbase_1.default.falseFunc + : function (elem) { return func(elem) && next(elem); }; }; /* - * :not, :has, :is and :matches have to compile selectors + * :not, :has, :is, :matches and :where have to compile selectors * doing this in src/pseudos.ts would lead to circular dependencies, * so we add them here */ exports.subselects = { is: is, /** - * `:matches` is an alias for `:is`. + * `:matches` and `:where` are aliases for `:is`. */ matches: is, + where: is, not: function (next, token, options, context, compileToken) { - var opts = { - xmlMode: !!options.xmlMode, - adapter: options.adapter, - equals: options.equals, - }; - var func = compileToken(token, opts, context); - if (func === boolbase_1.falseFunc) - return next; - if (func === boolbase_1.trueFunc) - return boolbase_1.falseFunc; - return function not(elem) { - return !func(elem) && next(elem); - }; + var func = compileToken(token, copyOptions(options), context); + return func === boolbase_1.default.falseFunc + ? next + : func === boolbase_1.default.trueFunc + ? boolbase_1.default.falseFunc + : function (elem) { return !func(elem) && next(elem); }; }, has: function (next, subselect, options, _context, compileToken) { var adapter = options.adapter; - var opts = { - xmlMode: !!options.xmlMode, - adapter: adapter, - equals: options.equals, - }; - // @ts-expect-error Uses an array as a pointer to the current element (side effects) - var context = subselect.some(function (s) { - return s.some(procedure_1.isTraversal); - }) - ? [exports.PLACEHOLDER_ELEMENT] + var opts = copyOptions(options); + opts.relativeSelector = true; + var context = subselect.some(function (s) { return s.some(sort_js_1.isTraversal); }) + ? // Used as a placeholder. Will be replaced with the actual element. + [exports.PLACEHOLDER_ELEMENT] : undefined; var compiled = compileToken(subselect, opts, context); - if (compiled === boolbase_1.falseFunc) - return boolbase_1.falseFunc; - if (compiled === boolbase_1.trueFunc) { - return function (elem) { - return adapter.getChildren(elem).some(adapter.isTag) && next(elem); - }; - } + if (compiled === boolbase_1.default.falseFunc) + return boolbase_1.default.falseFunc; var hasElement = ensureIsTag(compiled, adapter); - var _a = compiled.shouldTestNextSiblings, shouldTestNextSiblings = _a === void 0 ? false : _a; - /* - * `shouldTestNextSiblings` will only be true if the query starts with - * a traversal (sibling or adjacent). That means we will always have a context. - */ - if (context) { + // If `compiled` is `trueFunc`, we can skip this. + if (context && compiled !== boolbase_1.default.trueFunc) { + /* + * `shouldTestNextSiblings` will only be true if the query starts with + * a traversal (sibling or adjacent). That means we will always have a context. + */ + var _a = compiled.shouldTestNextSiblings, shouldTestNextSiblings_1 = _a === void 0 ? false : _a; return function (elem) { + if (!next(elem)) + return false; context[0] = elem; var childs = adapter.getChildren(elem); - var nextElements = shouldTestNextSiblings - ? __spreadArray(__spreadArray([], childs), getNextSiblings(elem, adapter)) : childs; - return (next(elem) && adapter.existsOne(hasElement, nextElements)); + var nextElements = shouldTestNextSiblings_1 + ? __spreadArray(__spreadArray([], childs, true), getNextSiblings(elem, adapter), true) : childs; + return adapter.existsOne(hasElement, nextElements); }; } return function (elem) { @@ -103,3 +109,4 @@ exports.subselects = { }; }, }; +//# sourceMappingURL=subselects.js.map \ No newline at end of file diff --git a/node_modules/css-select/lib/sort.d.ts b/node_modules/css-select/lib/sort.d.ts index d5b9c6e..93c996c 100644 --- a/node_modules/css-select/lib/sort.d.ts +++ b/node_modules/css-select/lib/sort.d.ts @@ -1,4 +1,6 @@ -import type { InternalSelector } from "./types"; +import type { InternalSelector } from "./types.js"; +import { type Traversal } from "css-what"; +export declare function isTraversal(token: InternalSelector): token is Traversal; /** * Sort the parts of the passed selector, * as there is potential for optimization diff --git a/node_modules/css-select/lib/sort.d.ts.map b/node_modules/css-select/lib/sort.d.ts.map index f55e27b..8e996f4 100644 --- a/node_modules/css-select/lib/sort.d.ts.map +++ b/node_modules/css-select/lib/sort.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../src/sort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAehD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,GAAG,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAerE"} \ No newline at end of file +{"version":3,"file":"sort.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/css-select/0f0725a9dfeddd2fdb54eda9656cdbab5bbf6be6/src/","sources":["sort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAiC,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AASzE,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,KAAK,IAAI,SAAS,CAEvE;AAWD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,GAAG,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAerE"} \ No newline at end of file diff --git a/node_modules/css-select/lib/sort.js b/node_modules/css-select/lib/sort.js index ae01830..d597e82 100644 --- a/node_modules/css-select/lib/sort.js +++ b/node_modules/css-select/lib/sort.js @@ -1,16 +1,25 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var procedure_1 = require("./procedure"); -var attributes = { - exists: 10, - equals: 8, - not: 7, - start: 6, - end: 6, - any: 5, - hyphen: 4, - element: 4, -}; +exports.isTraversal = void 0; +var css_what_1 = require("css-what"); +var procedure = new Map([ + [css_what_1.SelectorType.Universal, 50], + [css_what_1.SelectorType.Tag, 30], + [css_what_1.SelectorType.Attribute, 1], + [css_what_1.SelectorType.Pseudo, 0], +]); +function isTraversal(token) { + return !procedure.has(token.type); +} +exports.isTraversal = isTraversal; +var attributes = new Map([ + [css_what_1.AttributeAction.Exists, 10], + [css_what_1.AttributeAction.Equals, 8], + [css_what_1.AttributeAction.Not, 7], + [css_what_1.AttributeAction.Start, 6], + [css_what_1.AttributeAction.End, 6], + [css_what_1.AttributeAction.Any, 5], +]); /** * Sort the parts of the passed selector, * as there is potential for optimization @@ -35,10 +44,11 @@ function sortByProcedure(arr) { } exports.default = sortByProcedure; function getProcedure(token) { - var proc = procedure_1.procedure[token.type]; - if (token.type === "attribute") { - proc = attributes[token.action]; - if (proc === attributes.equals && token.name === "id") { + var _a, _b; + var proc = (_a = procedure.get(token.type)) !== null && _a !== void 0 ? _a : -1; + if (token.type === css_what_1.SelectorType.Attribute) { + proc = (_b = attributes.get(token.action)) !== null && _b !== void 0 ? _b : 4; + if (token.action === css_what_1.AttributeAction.Equals && token.name === "id") { // Prefer ID selectors (eg. #ID) proc = 9; } @@ -50,7 +60,7 @@ function getProcedure(token) { proc >>= 1; } } - else if (token.type === "pseudo") { + else if (token.type === css_what_1.SelectorType.Pseudo) { if (!token.data) { proc = 3; } @@ -58,27 +68,17 @@ function getProcedure(token) { proc = 0; // Expensive in any case } else if (Array.isArray(token.data)) { - // "matches" and "not" - proc = 0; - for (var i = 0; i < token.data.length; i++) { - // TODO better handling of complex selectors - if (token.data[i].length !== 1) - continue; - var cur = getProcedure(token.data[i][0]); - // Avoid executing :has or :contains - if (cur === 0) { - proc = 0; - break; - } - if (cur > proc) - proc = cur; + // Eg. :matches, :not + proc = Math.min.apply(Math, token.data.map(function (d) { return Math.min.apply(Math, d.map(getProcedure)); })); + // If we have traversals, try to avoid executing this selector + if (proc < 0) { + proc = 0; } - if (token.data.length > 1 && proc > 0) - proc -= 1; } else { - proc = 1; + proc = 2; } } return proc; } +//# sourceMappingURL=sort.js.map \ No newline at end of file diff --git a/node_modules/css-select/lib/types.d.ts b/node_modules/css-select/lib/types.d.ts index 814f288..7a0cd8a 100644 --- a/node_modules/css-select/lib/types.d.ts +++ b/node_modules/css-select/lib/types.d.ts @@ -27,12 +27,16 @@ export interface Adapter { /** * Get the parent of the node */ - getParent: (node: ElementNode) => ElementNode | null; + getParent: (node: ElementNode) => Node | null; /** * Get the siblings of the node. Note that unlike jQuery's `siblings` method, * this is expected to include the current node as well */ getSiblings: (node: Node) => Node[]; + /** + * Returns the previous element sibling of a node. + */ + prevElementSibling?: (node: Node) => ElementNode | null; /** * Get the text content of the node, and its children if it has any. */ @@ -83,6 +87,35 @@ export interface Options { * @default false */ xmlMode?: boolean; + /** + * Lower-case attribute names. + * + * @default !xmlMode + */ + lowerCaseAttributeNames?: boolean; + /** + * Lower-case tag names. + * + * @default !xmlMode + */ + lowerCaseTags?: boolean; + /** + * Is the document in quirks mode? + * + * This will lead to .className and #id being case-insensitive. + * + * @default false + */ + quirksMode?: boolean; + /** + * Pseudo-classes that override the default ones. + * + * Maps from names to either strings of functions. + * - A string value is a selector that the element must match to be selected. + * - A function is called with the element as its first argument, and optional + * parameters second. If it returns true, the element is selected. + */ + pseudos?: Record boolean)> | undefined; /** * The last function in the stack, will be called with the last element * that's looked at. @@ -95,9 +128,23 @@ export interface Options { adapter?: Adapter; /** * The context of the current query. Used to limit the scope of searches. - * Can be matched directly using the `:scope` pseudo-selector. + * Can be matched directly using the `:scope` pseudo-class. */ context?: Node | Node[]; + /** + * Indicates whether to consider the selector as a relative selector. + * + * Relative selectors that don't include a `:scope` pseudo-class behave + * as if they have a `:scope ` prefix (a `:scope` pseudo-class, followed by + * a descendant selector). + * + * If relative selectors are disabled, selectors starting with a traversal + * will lead to an error. + * + * @default true + * @see {@link https://www.w3.org/TR/selectors-4/#relative} + */ + relativeSelector?: boolean; /** * Allow css-select to cache results for some selectors, sometimes greatly * improving querying performance. Disable this if your document can diff --git a/node_modules/css-select/lib/types.d.ts.map b/node_modules/css-select/lib/types.d.ts.map index 882f659..d14b18f 100644 --- a/node_modules/css-select/lib/types.d.ts.map +++ b/node_modules/css-select/lib/types.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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"} \ No newline at end of file +{"version":3,"file":"types.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/css-select/0f0725a9dfeddd2fdb54eda9656cdbab5bbf6be6/src/","sources":["types.ts"],"names":[],"mappings":"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"} \ No newline at end of file diff --git a/node_modules/css-select/lib/types.js b/node_modules/css-select/lib/types.js index c8ad2e5..11e638d 100644 --- a/node_modules/css-select/lib/types.js +++ b/node_modules/css-select/lib/types.js @@ -1,2 +1,3 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/css-select/package.json b/node_modules/css-select/package.json index 2b7a968..6289eee 100644 --- a/node_modules/css-select/package.json +++ b/node_modules/css-select/package.json @@ -1,103 +1,81 @@ { - "_from": "css-select@^4.1.3", - "_id": "css-select@4.1.3", - "_inBundle": false, - "_integrity": "sha512-gT3wBNd9Nj49rAbmtFHj1cljIAOLYSX1nZ8CB7TBO3INYckygm5B7LISU/szY//YmdiSLbJvDLOx9VnMVpMBxA==", - "_location": "/css-select", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "css-select@^4.1.3", "name": "css-select", - "escapedName": "css-select", - "rawSpec": "^4.1.3", - "saveSpec": null, - "fetchSpec": "^4.1.3" - }, - "_requiredBy": [ - "/cheerio-select" - ], - "_resolved": "https://registry.npmjs.org/css-select/-/css-select-4.1.3.tgz", - "_shasum": "a70440f70317f2669118ad74ff105e65849c7067", - "_spec": "css-select@^4.1.3", - "_where": "/home/runner/work/public_library_map/public_library_map/node_modules/cheerio-select", - "author": { - "name": "Felix Boehm", - "email": "me@feedic.com" - }, - "bugs": { - "url": "https://github.com/fb55/css-select/issues" - }, - "bundleDependencies": false, - "dependencies": { - "boolbase": "^1.0.0", - "css-what": "^5.0.0", - "domhandler": "^4.2.0", - "domutils": "^2.6.0", - "nth-check": "^2.0.0" - }, - "deprecated": false, - "description": "a CSS selector compiler/engine", - "devDependencies": { - "@types/boolbase": "^1.0.0", - "@types/jest": "^26.0.14", - "@types/node": "^15.0.2", - "@typescript-eslint/eslint-plugin": "^4.1.0", - "@typescript-eslint/parser": "^4.1.0", - "cheerio-soupselect": "^0.1.1", - "coveralls": "^3.0.2", - "eslint": "^7.9.0", - "eslint-config-prettier": "^8.1.0", - "htmlparser2": "^6.0.0", - "jest": "^27.0.3", - "prettier": "^2.1.2", - "ts-jest": "^27.0.1", - "typescript": "^4.0.2" - }, - "files": [ - "lib" - ], - "funding": { - "url": "https://github.com/sponsors/fb55" - }, - "homepage": "https://github.com/fb55/css-select#readme", - "jest": { - "preset": "ts-jest", - "testEnvironment": "node", - "testMatch": [ - "/test/*.ts" - ] - }, - "keywords": [ - "css", - "selector", - "sizzle" - ], - "license": "BSD-2-Clause", - "main": "lib/index.js", - "name": "css-select", - "prettier": { - "tabWidth": 4, - "proseWrap": "always" - }, - "repository": { - "type": "git", - "url": "git://github.com/fb55/css-select.git" - }, - "scripts": { - "build": "tsc", - "coverage": "cat coverage/lcov.info | coveralls", - "format": "npm run format:es && npm run format:prettier", - "format:es": "npm run lint:es -- --fix", - "format:prettier": "npm run prettier -- --write", - "lint": "npm run lint:es && npm run lint:prettier", - "lint:es": "eslint src", - "lint:prettier": "npm run prettier -- --check", - "prepare": "npm run build", - "prettier": "prettier '**/*.{ts,md,json,yml}'", - "test": "jest --coverage && npm run lint" - }, - "types": "lib/index.d.ts", - "version": "4.1.3" + "version": "5.1.0", + "description": "a CSS selector compiler/engine", + "author": "Felix Boehm ", + "funding": { + "url": "https://github.com/sponsors/fb55" + }, + "keywords": [ + "css", + "selector", + "sizzle" + ], + "repository": { + "type": "git", + "url": "git://github.com/fb55/css-select.git" + }, + "main": "lib/index.js", + "types": "lib/index.d.ts", + "module": "lib/esm/index.js", + "exports": { + "require": "./lib/index.js", + "import": "./lib/esm/index.js" + }, + "files": [ + "lib" + ], + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^6.1.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", + "nth-check": "^2.0.1" + }, + "devDependencies": { + "@types/boolbase": "^1.0.1", + "@types/jest": "^27.4.1", + "@types/node": "^17.0.29", + "@typescript-eslint/eslint-plugin": "^5.21.0", + "@typescript-eslint/parser": "^5.21.0", + "cheerio-soupselect": "^0.1.1", + "eslint": "^8.14.0", + "eslint-config-prettier": "^8.5.0", + "htmlparser2": "^8.0.0", + "jest": "^27.5.1", + "prettier": "^2.6.2", + "ts-jest": "^27.1.4", + "typescript": "^4.6.3" + }, + "scripts": { + "test": "npm run test:jest && npm run lint", + "test:jest": "jest", + "lint": "npm run lint:es && npm run lint:prettier", + "lint:es": "eslint src", + "lint:prettier": "npm run prettier -- --check", + "format": "npm run format:es && npm run format:prettier", + "format:es": "npm run lint:es -- --fix", + "format:prettier": "npm run prettier -- --write", + "prettier": "prettier '**/*.{ts,md,json,yml}'", + "build": "npm run build:cjs && npm run build:esm", + "build:cjs": "tsc --sourceRoot https://raw.githubusercontent.com/fb55/css-select/$(git rev-parse HEAD)/src/", + "build:esm": "npm run build:cjs -- --module esnext --target es2019 --outDir lib/esm && echo '{\"type\":\"module\"}' > lib/esm/package.json", + "prepare": "npm run build" + }, + "license": "BSD-2-Clause", + "prettier": { + "tabWidth": 4, + "proseWrap": "always" + }, + "jest": { + "preset": "ts-jest", + "testEnvironment": "node", + "coverageProvider": "v8", + "moduleNameMapper": { + "^(.*)\\.js$": "$1" + }, + "testMatch": [ + "/test/*.ts" + ] + } } diff --git a/node_modules/css-what/lib/index.d.ts b/node_modules/css-what/lib/index.d.ts deleted file mode 100644 index d474fa1..0000000 --- a/node_modules/css-what/lib/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from "./parse"; -export { default as parse } from "./parse"; -export { default as stringify } from "./stringify"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/css-what/lib/index.d.ts.map b/node_modules/css-what/lib/index.d.ts.map deleted file mode 100644 index 4191999..0000000 --- a/node_modules/css-what/lib/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC"} \ No newline at end of file diff --git a/node_modules/css-what/lib/index.js b/node_modules/css-what/lib/index.js deleted file mode 100644 index 5095250..0000000 --- a/node_modules/css-what/lib/index.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.stringify = exports.parse = void 0; -__exportStar(require("./parse"), exports); -var parse_1 = require("./parse"); -Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return __importDefault(parse_1).default; } }); -var stringify_1 = require("./stringify"); -Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return __importDefault(stringify_1).default; } }); diff --git a/node_modules/css-what/lib/parse.d.ts b/node_modules/css-what/lib/parse.d.ts deleted file mode 100644 index 59e81e3..0000000 --- a/node_modules/css-what/lib/parse.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -export interface Options { - /** - * When false, tag names will not be lowercased. - * @default true - */ - lowerCaseAttributeNames?: boolean; - /** - * When false, attribute names will not be lowercased. - * @default true - */ - lowerCaseTags?: boolean; - /** - * When `true`, `xmlMode` implies both `lowerCaseTags` and `lowerCaseAttributeNames` are set to `false`. - * Also, `ignoreCase` on attributes will not be inferred based on HTML rules anymore. - * @default false - */ - xmlMode?: boolean; -} -export declare type Selector = PseudoSelector | PseudoElement | AttributeSelector | TagSelector | UniversalSelector | Traversal; -export interface AttributeSelector { - type: "attribute"; - name: string; - action: AttributeAction; - value: string; - ignoreCase: boolean | null; - namespace: string | null; -} -declare type DataType = Selector[][] | null | string; -export interface PseudoSelector { - type: "pseudo"; - name: string; - data: DataType; -} -export interface PseudoElement { - type: "pseudo-element"; - name: string; -} -export interface TagSelector { - type: "tag"; - name: string; - namespace: string | null; -} -export interface UniversalSelector { - type: "universal"; - namespace: string | null; -} -export interface Traversal { - type: TraversalType; -} -export declare type AttributeAction = "any" | "element" | "end" | "equals" | "exists" | "hyphen" | "not" | "start"; -export declare type TraversalType = "adjacent" | "child" | "descendant" | "parent" | "sibling"; -/** - * Checks whether a specific selector is a traversal. - * This is useful eg. in swapping the order of elements that - * are not traversals. - * - * @param selector Selector to check. - */ -export declare function isTraversal(selector: Selector): selector is Traversal; -/** - * Parses `selector`, optionally with the passed `options`. - * - * @param selector Selector to parse. - * @param options Options for parsing. - * @returns Returns a two-dimensional array. - * The first dimension represents selectors separated by commas (eg. `sub1, sub2`), - * the second contains the relevant tokens for that selector. - */ -export default function parse(selector: string, options?: Options): Selector[][]; -export {}; -//# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/node_modules/css-what/lib/parse.d.ts.map b/node_modules/css-what/lib/parse.d.ts.map deleted file mode 100644 index df5d1a3..0000000 --- a/node_modules/css-what/lib/parse.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACpB;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,oBAAY,QAAQ,GACd,cAAc,GACd,aAAa,GACb,iBAAiB,GACjB,WAAW,GACX,iBAAiB,GACjB,SAAS,CAAC;AAEhB,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,aAAK,QAAQ,GAAG,QAAQ,EAAE,EAAE,GAAG,IAAI,GAAG,MAAM,CAAC;AAE7C,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,KAAK,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,SAAS;IACtB,IAAI,EAAE,aAAa,CAAC;CACvB;AAED,oBAAY,eAAe,GACrB,KAAK,GACL,SAAS,GACT,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,KAAK,GACL,OAAO,CAAC;AAEd,oBAAY,aAAa,GACnB,UAAU,GACV,OAAO,GACP,YAAY,GACZ,QAAQ,GACR,SAAS,CAAC;AAiGhB;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,IAAI,SAAS,CAErE;AA4BD;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,OAAO,GAClB,QAAQ,EAAE,EAAE,CAUd"} \ No newline at end of file diff --git a/node_modules/css-what/lib/parse.js b/node_modules/css-what/lib/parse.js deleted file mode 100644 index 786b13e..0000000 --- a/node_modules/css-what/lib/parse.js +++ /dev/null @@ -1,432 +0,0 @@ -"use strict"; -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isTraversal = void 0; -var reName = /^[^\\#]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\-\u00b0-\uFFFF])+/; -var reEscape = /\\([\da-f]{1,6}\s?|(\s)|.)/gi; -var actionTypes = new Map([ - ["~", "element"], - ["^", "start"], - ["$", "end"], - ["*", "any"], - ["!", "not"], - ["|", "hyphen"], -]); -var Traversals = { - ">": "child", - "<": "parent", - "~": "sibling", - "+": "adjacent", -}; -var attribSelectors = { - "#": ["id", "equals"], - ".": ["class", "element"], -}; -// Pseudos, whose data property is parsed as well. -var unpackPseudos = new Set([ - "has", - "not", - "matches", - "is", - "where", - "host", - "host-context", -]); -var traversalNames = new Set(__spreadArray([ - "descendant" -], Object.keys(Traversals).map(function (k) { return Traversals[k]; }), true)); -/** - * Attributes that are case-insensitive in HTML. - * - * @private - * @see https://html.spec.whatwg.org/multipage/semantics-other.html#case-sensitivity-of-selectors - */ -var caseInsensitiveAttributes = new Set([ - "accept", - "accept-charset", - "align", - "alink", - "axis", - "bgcolor", - "charset", - "checked", - "clear", - "codetype", - "color", - "compact", - "declare", - "defer", - "dir", - "direction", - "disabled", - "enctype", - "face", - "frame", - "hreflang", - "http-equiv", - "lang", - "language", - "link", - "media", - "method", - "multiple", - "nohref", - "noresize", - "noshade", - "nowrap", - "readonly", - "rel", - "rev", - "rules", - "scope", - "scrolling", - "selected", - "shape", - "target", - "text", - "type", - "valign", - "valuetype", - "vlink", -]); -/** - * Checks whether a specific selector is a traversal. - * This is useful eg. in swapping the order of elements that - * are not traversals. - * - * @param selector Selector to check. - */ -function isTraversal(selector) { - return traversalNames.has(selector.type); -} -exports.isTraversal = isTraversal; -var stripQuotesFromPseudos = new Set(["contains", "icontains"]); -var quotes = new Set(['"', "'"]); -// Unescape function taken from https://github.com/jquery/sizzle/blob/master/src/sizzle.js#L152 -function funescape(_, escaped, escapedWhitespace) { - var high = parseInt(escaped, 16) - 0x10000; - // NaN means non-codepoint - return high !== high || escapedWhitespace - ? escaped - : high < 0 - ? // BMP codepoint - String.fromCharCode(high + 0x10000) - : // Supplemental Plane codepoint (surrogate pair) - String.fromCharCode((high >> 10) | 0xd800, (high & 0x3ff) | 0xdc00); -} -function unescapeCSS(str) { - return str.replace(reEscape, funescape); -} -function isWhitespace(c) { - return c === " " || c === "\n" || c === "\t" || c === "\f" || c === "\r"; -} -/** - * Parses `selector`, optionally with the passed `options`. - * - * @param selector Selector to parse. - * @param options Options for parsing. - * @returns Returns a two-dimensional array. - * The first dimension represents selectors separated by commas (eg. `sub1, sub2`), - * the second contains the relevant tokens for that selector. - */ -function parse(selector, options) { - var subselects = []; - var endIndex = parseSelector(subselects, "" + selector, options, 0); - if (endIndex < selector.length) { - throw new Error("Unmatched selector: " + selector.slice(endIndex)); - } - return subselects; -} -exports.default = parse; -function parseSelector(subselects, selector, options, selectorIndex) { - var _a, _b; - if (options === void 0) { options = {}; } - var tokens = []; - var sawWS = false; - function getName(offset) { - var match = selector.slice(selectorIndex + offset).match(reName); - if (!match) { - throw new Error("Expected name, found " + selector.slice(selectorIndex)); - } - var name = match[0]; - selectorIndex += offset + name.length; - return unescapeCSS(name); - } - function stripWhitespace(offset) { - while (isWhitespace(selector.charAt(selectorIndex + offset))) - offset++; - selectorIndex += offset; - } - function isEscaped(pos) { - var slashCount = 0; - while (selector.charAt(--pos) === "\\") - slashCount++; - return (slashCount & 1) === 1; - } - function ensureNotTraversal() { - if (tokens.length > 0 && isTraversal(tokens[tokens.length - 1])) { - throw new Error("Did not expect successive traversals."); - } - } - stripWhitespace(0); - while (selector !== "") { - var firstChar = selector.charAt(selectorIndex); - if (isWhitespace(firstChar)) { - sawWS = true; - stripWhitespace(1); - } - else if (firstChar in Traversals) { - ensureNotTraversal(); - tokens.push({ type: Traversals[firstChar] }); - sawWS = false; - stripWhitespace(1); - } - else if (firstChar === ",") { - if (tokens.length === 0) { - throw new Error("Empty sub-selector"); - } - subselects.push(tokens); - tokens = []; - sawWS = false; - stripWhitespace(1); - } - else if (selector.startsWith("/*", selectorIndex)) { - var endIndex = selector.indexOf("*/", selectorIndex + 2); - if (endIndex < 0) { - throw new Error("Comment was not terminated"); - } - selectorIndex = endIndex + 2; - } - else { - if (sawWS) { - ensureNotTraversal(); - tokens.push({ type: "descendant" }); - sawWS = false; - } - if (firstChar in attribSelectors) { - var _c = attribSelectors[firstChar], name_1 = _c[0], action = _c[1]; - tokens.push({ - type: "attribute", - name: name_1, - action: action, - value: getName(1), - namespace: null, - // TODO: Add quirksMode option, which makes `ignoreCase` `true` for HTML. - ignoreCase: options.xmlMode ? null : false, - }); - } - else if (firstChar === "[") { - stripWhitespace(1); - // Determine attribute name and namespace - var namespace = null; - if (selector.charAt(selectorIndex) === "|") { - namespace = ""; - selectorIndex += 1; - } - if (selector.startsWith("*|", selectorIndex)) { - namespace = "*"; - selectorIndex += 2; - } - var name_2 = getName(0); - if (namespace === null && - selector.charAt(selectorIndex) === "|" && - selector.charAt(selectorIndex + 1) !== "=") { - namespace = name_2; - name_2 = getName(1); - } - if ((_a = options.lowerCaseAttributeNames) !== null && _a !== void 0 ? _a : !options.xmlMode) { - name_2 = name_2.toLowerCase(); - } - stripWhitespace(0); - // Determine comparison operation - var action = "exists"; - var possibleAction = actionTypes.get(selector.charAt(selectorIndex)); - if (possibleAction) { - action = possibleAction; - if (selector.charAt(selectorIndex + 1) !== "=") { - throw new Error("Expected `=`"); - } - stripWhitespace(2); - } - else if (selector.charAt(selectorIndex) === "=") { - action = "equals"; - stripWhitespace(1); - } - // Determine value - var value = ""; - var ignoreCase = null; - if (action !== "exists") { - if (quotes.has(selector.charAt(selectorIndex))) { - var quote = selector.charAt(selectorIndex); - var sectionEnd = selectorIndex + 1; - while (sectionEnd < selector.length && - (selector.charAt(sectionEnd) !== quote || - isEscaped(sectionEnd))) { - sectionEnd += 1; - } - if (selector.charAt(sectionEnd) !== quote) { - throw new Error("Attribute value didn't end"); - } - value = unescapeCSS(selector.slice(selectorIndex + 1, sectionEnd)); - selectorIndex = sectionEnd + 1; - } - else { - var valueStart = selectorIndex; - while (selectorIndex < selector.length && - ((!isWhitespace(selector.charAt(selectorIndex)) && - selector.charAt(selectorIndex) !== "]") || - isEscaped(selectorIndex))) { - selectorIndex += 1; - } - value = unescapeCSS(selector.slice(valueStart, selectorIndex)); - } - stripWhitespace(0); - // See if we have a force ignore flag - var forceIgnore = selector.charAt(selectorIndex); - // If the forceIgnore flag is set (either `i` or `s`), use that value - if (forceIgnore === "s" || forceIgnore === "S") { - ignoreCase = false; - stripWhitespace(1); - } - else if (forceIgnore === "i" || forceIgnore === "I") { - ignoreCase = true; - stripWhitespace(1); - } - } - // If `xmlMode` is set, there are no rules; otherwise, use the `caseInsensitiveAttributes` list. - if (!options.xmlMode) { - // TODO: Skip this for `exists`, as there is no value to compare to. - ignoreCase !== null && ignoreCase !== void 0 ? ignoreCase : (ignoreCase = caseInsensitiveAttributes.has(name_2)); - } - if (selector.charAt(selectorIndex) !== "]") { - throw new Error("Attribute selector didn't terminate"); - } - selectorIndex += 1; - var attributeSelector = { - type: "attribute", - name: name_2, - action: action, - value: value, - namespace: namespace, - ignoreCase: ignoreCase, - }; - tokens.push(attributeSelector); - } - else if (firstChar === ":") { - if (selector.charAt(selectorIndex + 1) === ":") { - tokens.push({ - type: "pseudo-element", - name: getName(2).toLowerCase(), - }); - continue; - } - var name_3 = getName(1).toLowerCase(); - var data = null; - if (selector.charAt(selectorIndex) === "(") { - if (unpackPseudos.has(name_3)) { - if (quotes.has(selector.charAt(selectorIndex + 1))) { - throw new Error("Pseudo-selector " + name_3 + " cannot be quoted"); - } - data = []; - selectorIndex = parseSelector(data, selector, options, selectorIndex + 1); - if (selector.charAt(selectorIndex) !== ")") { - throw new Error("Missing closing parenthesis in :" + name_3 + " (" + selector + ")"); - } - selectorIndex += 1; - } - else { - selectorIndex += 1; - var start = selectorIndex; - var counter = 1; - for (; counter > 0 && selectorIndex < selector.length; selectorIndex++) { - if (selector.charAt(selectorIndex) === "(" && - !isEscaped(selectorIndex)) { - counter++; - } - else if (selector.charAt(selectorIndex) === ")" && - !isEscaped(selectorIndex)) { - counter--; - } - } - if (counter) { - throw new Error("Parenthesis not matched"); - } - data = selector.slice(start, selectorIndex - 1); - if (stripQuotesFromPseudos.has(name_3)) { - var quot = data.charAt(0); - if (quot === data.slice(-1) && quotes.has(quot)) { - data = data.slice(1, -1); - } - data = unescapeCSS(data); - } - } - } - tokens.push({ type: "pseudo", name: name_3, data: data }); - } - else { - var namespace = null; - var name_4 = void 0; - if (firstChar === "*") { - selectorIndex += 1; - name_4 = "*"; - } - else if (reName.test(selector.slice(selectorIndex))) { - if (selector.charAt(selectorIndex) === "|") { - namespace = ""; - selectorIndex += 1; - } - name_4 = getName(0); - } - else { - /* - * We have finished parsing the selector. - * Remove descendant tokens at the end if they exist, - * and return the last index, so that parsing can be - * picked up from here. - */ - if (tokens.length && - tokens[tokens.length - 1].type === "descendant") { - tokens.pop(); - } - addToken(subselects, tokens); - return selectorIndex; - } - if (selector.charAt(selectorIndex) === "|") { - namespace = name_4; - if (selector.charAt(selectorIndex + 1) === "*") { - name_4 = "*"; - selectorIndex += 2; - } - else { - name_4 = getName(1); - } - } - if (name_4 === "*") { - tokens.push({ type: "universal", namespace: namespace }); - } - else { - if ((_b = options.lowerCaseTags) !== null && _b !== void 0 ? _b : !options.xmlMode) { - name_4 = name_4.toLowerCase(); - } - tokens.push({ type: "tag", name: name_4, namespace: namespace }); - } - } - } - } - addToken(subselects, tokens); - return selectorIndex; -} -function addToken(subselects, tokens) { - if (subselects.length > 0 && tokens.length === 0) { - throw new Error("Empty sub-selector"); - } - subselects.push(tokens); -} diff --git a/node_modules/css-what/lib/stringify.d.ts b/node_modules/css-what/lib/stringify.d.ts deleted file mode 100644 index 407050e..0000000 --- a/node_modules/css-what/lib/stringify.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Selector } from "./parse"; -/** - * Turns `selector` back into a string. - * - * @param selector Selector to stringify. - */ -export default function stringify(selector: Selector[][]): string; -//# sourceMappingURL=stringify.d.ts.map \ No newline at end of file diff --git a/node_modules/css-what/lib/stringify.d.ts.map b/node_modules/css-what/lib/stringify.d.ts.map deleted file mode 100644 index 06eb2f0..0000000 --- a/node_modules/css-what/lib/stringify.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"stringify.d.ts","sourceRoot":"","sources":["../src/stringify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AA0BnC;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,GAAG,MAAM,CAEhE"} \ No newline at end of file diff --git a/node_modules/css-what/lib/stringify.js b/node_modules/css-what/lib/stringify.js deleted file mode 100644 index ccd3d6c..0000000 --- a/node_modules/css-what/lib/stringify.js +++ /dev/null @@ -1,105 +0,0 @@ -"use strict"; -var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var actionTypes = { - equals: "", - element: "~", - start: "^", - end: "$", - any: "*", - not: "!", - hyphen: "|", -}; -var charsToEscape = new Set(__spreadArray(__spreadArray([], Object.keys(actionTypes) - .map(function (typeKey) { return actionTypes[typeKey]; }) - .filter(Boolean), true), [ - ":", - "[", - "]", - " ", - "\\", - "(", - ")", - "'", -], false)); -/** - * Turns `selector` back into a string. - * - * @param selector Selector to stringify. - */ -function stringify(selector) { - return selector.map(stringifySubselector).join(", "); -} -exports.default = stringify; -function stringifySubselector(token) { - return token.map(stringifyToken).join(""); -} -function stringifyToken(token) { - switch (token.type) { - // Simple types - case "child": - return " > "; - case "parent": - return " < "; - case "sibling": - return " ~ "; - case "adjacent": - return " + "; - case "descendant": - return " "; - case "universal": - return getNamespace(token.namespace) + "*"; - case "tag": - return getNamespacedName(token); - case "pseudo-element": - return "::" + escapeName(token.name); - case "pseudo": - if (token.data === null) - return ":" + escapeName(token.name); - if (typeof token.data === "string") { - return ":" + escapeName(token.name) + "(" + escapeName(token.data) + ")"; - } - return ":" + escapeName(token.name) + "(" + stringify(token.data) + ")"; - case "attribute": { - if (token.name === "id" && - token.action === "equals" && - !token.ignoreCase && - !token.namespace) { - return "#" + escapeName(token.value); - } - if (token.name === "class" && - token.action === "element" && - !token.ignoreCase && - !token.namespace) { - return "." + escapeName(token.value); - } - var name_1 = getNamespacedName(token); - if (token.action === "exists") { - return "[" + name_1 + "]"; - } - return "[" + name_1 + actionTypes[token.action] + "='" + escapeName(token.value) + "'" + (token.ignoreCase ? "i" : token.ignoreCase === false ? "s" : "") + "]"; - } - } -} -function getNamespacedName(token) { - return "" + getNamespace(token.namespace) + escapeName(token.name); -} -function getNamespace(namespace) { - return namespace !== null - ? (namespace === "*" ? "*" : escapeName(namespace)) + "|" - : ""; -} -function escapeName(str) { - return str - .split("") - .map(function (c) { return (charsToEscape.has(c) ? "\\" + c : c); }) - .join(""); -} diff --git a/node_modules/css-what/package.json b/node_modules/css-what/package.json index c3f02b0..8aa2c44 100644 --- a/node_modules/css-what/package.json +++ b/node_modules/css-what/package.json @@ -1,89 +1,59 @@ { - "_from": "css-what@^5.0.1", - "_id": "css-what@5.1.0", - "_inBundle": false, - "_integrity": "sha512-arSMRWIIFY0hV8pIxZMEfmMI47Wj3R/aWpZDDxWYCPEiOMv6tfOrnpDtgxBYPEQD4V0Y/958+1TdC3iWTFcUPw==", - "_location": "/css-what", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "css-what@^5.0.1", + "author": "Felix Böhm (http://feedic.com)", "name": "css-what", - "escapedName": "css-what", - "rawSpec": "^5.0.1", - "saveSpec": null, - "fetchSpec": "^5.0.1" - }, - "_requiredBy": [ - "/cheerio-select", - "/css-select" - ], - "_resolved": "https://registry.npmjs.org/css-what/-/css-what-5.1.0.tgz", - "_shasum": "3f7b707aadf633baf62c2ceb8579b545bb40f7fe", - "_spec": "css-what@^5.0.1", - "_where": "/home/runner/work/public_library_map/public_library_map/node_modules/cheerio-select", - "author": { - "name": "Felix Böhm", - "email": "me@feedic.com", - "url": "http://feedic.com" - }, - "bugs": { - "url": "https://github.com/fb55/css-what/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "a CSS selector parser", - "devDependencies": { - "@types/jest": "^27.0.2", - "@types/node": "^16.10.3", - "@typescript-eslint/eslint-plugin": "^4.33.0", - "@typescript-eslint/parser": "^4.33.0", - "eslint": "^7.32.0", - "eslint-config-prettier": "^8.1.0", - "eslint-plugin-node": "^11.1.0", - "jest": "^27.2.4", - "prettier": "^2.4.1", - "ts-jest": "^27.0.5", - "typescript": "^4.4.3" - }, - "engines": { - "node": ">= 6" - }, - "files": [ - "lib/**/*" - ], - "funding": { - "url": "https://github.com/sponsors/fb55" - }, - "homepage": "https://github.com/fb55/css-what#readme", - "jest": { - "preset": "ts-jest" - }, - "license": "BSD-2-Clause", - "main": "lib/index.js", - "name": "css-what", - "optionalDependencies": {}, - "prettier": { - "tabWidth": 4 - }, - "repository": { - "url": "git+https://github.com/fb55/css-what.git" - }, - "scripts": { - "build": "tsc", - "format": "npm run format:es && npm run format:prettier", - "format:es": "npm run lint:es -- --fix", - "format:prettier": "npm run prettier -- --write", - "lint": "npm run lint:es && npm run lint:prettier", - "lint:es": "eslint src", - "lint:prettier": "npm run prettier -- --check", - "prepare": "npm run build", - "prettier": "prettier '**/*.{ts,md,json,yml}'", - "test": "npm run test:jest && npm run lint", - "test:jest": "jest" - }, - "types": "lib/index.d.ts", - "version": "5.1.0" + "description": "a CSS selector parser", + "version": "6.1.0", + "funding": { + "url": "https://github.com/sponsors/fb55" + }, + "repository": { + "type": "git", + "url": "https://github.com/fb55/css-what" + }, + "main": "lib/commonjs/index.js", + "module": "lib/es/index.js", + "types": "lib/es/index.d.ts", + "sideEffects": false, + "files": [ + "lib/**/*" + ], + "scripts": { + "test": "npm run test:jest && npm run lint", + "test:jest": "jest", + "lint": "npm run lint:es && npm run lint:prettier", + "lint:es": "eslint src", + "lint:prettier": "npm run prettier -- --check", + "format": "npm run format:es && npm run format:prettier", + "format:es": "npm run lint:es -- --fix", + "format:prettier": "npm run prettier -- --write", + "prettier": "prettier '**/*.{ts,md,json,yml}'", + "build": "tsc && tsc -p tsconfig.es.json", + "prepare": "npm run build" + }, + "devDependencies": { + "@types/jest": "^27.4.1", + "@types/node": "^17.0.23", + "@typescript-eslint/eslint-plugin": "^5.17.0", + "@typescript-eslint/parser": "^5.17.0", + "eslint": "^8.12.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-node": "^11.1.0", + "jest": "^27.5.1", + "prettier": "^2.6.1", + "ts-jest": "^27.1.4", + "typescript": "^4.6.3" + }, + "engines": { + "node": ">= 6" + }, + "license": "BSD-2-Clause", + "jest": { + "preset": "ts-jest", + "roots": [ + "src" + ] + }, + "prettier": { + "tabWidth": 4 + } } diff --git a/node_modules/css-what/readme.md b/node_modules/css-what/readme.md index e9c3e9b..0c4a198 100644 --- a/node_modules/css-what/readme.md +++ b/node_modules/css-what/readme.md @@ -1,11 +1,15 @@ -# css-what [![Build Status](https://secure.travis-ci.org/fb55/css-what.svg?branch=master)](http://travis-ci.org/fb55/css-what) +# css-what -a CSS selector parser +[![Build Status](https://img.shields.io/github/workflow/status/fb55/css-what/Node.js%20CI/master)](https://github.com/fb55/css-what/actions/workflows/nodejs-test.yml) +[![Coverage](https://img.shields.io/coveralls/github/fb55/css-what/master)](https://coveralls.io/github/fb55/css-what?branch=master) + +A CSS selector parser. ## Example ```js -const CSSwhat = require("css-what") +import * as CSSwhat from "css-what"; + CSSwhat.parse("foo[bar]:baz") ~> [ @@ -16,7 +20,7 @@ CSSwhat.parse("foo[bar]:baz") name: "bar", action: "exists", value: "", - ignoreCase: false + ignoreCase: null }, { type: "pseudo", name: "baz", data: null } ] @@ -25,32 +29,27 @@ CSSwhat.parse("foo[bar]:baz") ## API -**`CSSwhat.parse(selector, options)` - Parses `selector`, optionally with the passed `options`.** +**`CSSwhat.parse(selector)` - Parses `selector`.** The function returns a two-dimensional array. The first array represents selectors separated by commas (eg. `sub1, sub2`), the second contains the relevant tokens for that selector. Possible token types are: -| name | properties | example | output | -| ---------------- | --------------------------------------- | ------------- | ---------------------------------------------------------------------------------------- | -| `tag` | `name` | `div` | `{ type: 'tag', name: 'div' }` | -| `universal` | - | `*` | `{ type: 'universal' }` | -| `pseudo` | `name`, `data` | `:name(data)` | `{ type: 'pseudo', name: 'name', data: 'data' }` | -| `pseudo` | `name`, `data` | `:name` | `{ type: 'pseudo', name: 'name', data: null }` | -| `pseudo-element` | `name` | `::name` | `{ type: 'pseudo-element', name: 'name' }` | -| `attribute` | `name`, `action`, `value`, `ignoreCase` | `[attr]` | `{ type: 'attribute', name: 'attr', action: 'exists', value: '', ignoreCase: false }` | -| `attribute` | `name`, `action`, `value`, `ignoreCase` | `[attr=val]` | `{ type: 'attribute', name: 'attr', action: 'equals', value: 'val', ignoreCase: false }` | -| `attribute` | `name`, `action`, `value`, `ignoreCase` | `[attr^=val]` | `{ type: 'attribute', name: 'attr', action: 'start', value: 'val', ignoreCase: false }` | -| `attribute` | `name`, `action`, `value`, `ignoreCase` | `[attr$=val]` | `{ type: 'attribute', name: 'attr', action: 'end', value: 'val', ignoreCase: false }` | -| `child` | - | `>` | `{ type: 'child' }` | -| `parent` | - | `<` | `{ type: 'parent' }` | -| `sibling` | - | `~` | `{ type: 'sibling' }` | -| `adjacent` | - | `+` | `{ type: 'adjacent' }` | -| `descendant` | - | | `{ type: 'descendant' }` | - -**Options:** - -- `lowerCaseTags`: When false, tag names will not be lowercased. Defaults to `true`. -- `lowerCaseAttributeNames`: When false, attribute names will not be lowercased. Defaults to `true`. -- `xmlMode`: When `true`, `xmlMode` implies both `lowerCaseTags` and `lowerCaseAttributeNames` are set to `false`. +| name | properties | example | output | +| ------------------- | --------------------------------------- | ------------- | ---------------------------------------------------------------------------------------- | +| `tag` | `name` | `div` | `{ type: 'tag', name: 'div' }` | +| `universal` | - | `*` | `{ type: 'universal' }` | +| `pseudo` | `name`, `data` | `:name(data)` | `{ type: 'pseudo', name: 'name', data: 'data' }` | +| `pseudo` | `name`, `data` | `:name` | `{ type: 'pseudo', name: 'name', data: null }` | +| `pseudo-element` | `name` | `::name` | `{ type: 'pseudo-element', name: 'name' }` | +| `attribute` | `name`, `action`, `value`, `ignoreCase` | `[attr]` | `{ type: 'attribute', name: 'attr', action: 'exists', value: '', ignoreCase: false }` | +| `attribute` | `name`, `action`, `value`, `ignoreCase` | `[attr=val]` | `{ type: 'attribute', name: 'attr', action: 'equals', value: 'val', ignoreCase: false }` | +| `attribute` | `name`, `action`, `value`, `ignoreCase` | `[attr^=val]` | `{ type: 'attribute', name: 'attr', action: 'start', value: 'val', ignoreCase: false }` | +| `attribute` | `name`, `action`, `value`, `ignoreCase` | `[attr$=val]` | `{ type: 'attribute', name: 'attr', action: 'end', value: 'val', ignoreCase: false }` | +| `child` | - | `>` | `{ type: 'child' }` | +| `parent` | - | `<` | `{ type: 'parent' }` | +| `sibling` | - | `~` | `{ type: 'sibling' }` | +| `adjacent` | - | `+` | `{ type: 'adjacent' }` | +| `descendant` | - | | `{ type: 'descendant' }` | +| `column-combinator` | - | `\|\|` | `{ type: 'column-combinator' }` | **`CSSwhat.stringify(selector)` - Turns `selector` back into a string.** diff --git a/node_modules/dom-serializer/README.md b/node_modules/dom-serializer/README.md index 9ef0eec..0a301ab 100644 --- a/node_modules/dom-serializer/README.md +++ b/node_modules/dom-serializer/README.md @@ -31,11 +31,23 @@ Can be thought of as the equivalent of the `outerHTML` of the passed node(s). ## Options +### `encodeEntities` + +• `Optional` **decodeEntities**: _boolean | "utf8"_ + +Encode characters that are either reserved in HTML or XML. + +If `xmlMode` is `true` or the value not `'utf8'`, characters outside of the utf8 range will be encoded as well. + +**`default`** `decodeEntities` + +--- + ### `decodeEntities` • `Optional` **decodeEntities**: _boolean_ -Encode characters that are either reserved in HTML or XML, or are outside of the ASCII range. +Option inherited from parsing; will be used as the default value for `encodeEntities`. **`default`** true diff --git a/node_modules/dom-serializer/lib/foreignNames.d.ts.map b/node_modules/dom-serializer/lib/foreignNames.d.ts.map index 50e4f26..bc1d2d0 100644 --- a/node_modules/dom-serializer/lib/foreignNames.d.ts.map +++ b/node_modules/dom-serializer/lib/foreignNames.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"foreignNames.d.ts","sourceRoot":"","sources":["../src/foreignNames.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,qBAsCvB,CAAC;AACH,eAAO,MAAM,cAAc,qBA4DzB,CAAC"} \ No newline at end of file +{"version":3,"file":"foreignNames.d.ts","sourceRoot":"","sources":["../src/foreignNames.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,qBAwCxB,CAAC;AACF,eAAO,MAAM,cAAc,qBA8D1B,CAAC"} \ No newline at end of file diff --git a/node_modules/dom-serializer/lib/foreignNames.js b/node_modules/dom-serializer/lib/foreignNames.js index 966253e..3b24b75 100644 --- a/node_modules/dom-serializer/lib/foreignNames.js +++ b/node_modules/dom-serializer/lib/foreignNames.js @@ -2,102 +2,102 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.attributeNames = exports.elementNames = void 0; exports.elementNames = new Map([ - ["altglyph", "altGlyph"], - ["altglyphdef", "altGlyphDef"], - ["altglyphitem", "altGlyphItem"], - ["animatecolor", "animateColor"], - ["animatemotion", "animateMotion"], - ["animatetransform", "animateTransform"], - ["clippath", "clipPath"], - ["feblend", "feBlend"], - ["fecolormatrix", "feColorMatrix"], - ["fecomponenttransfer", "feComponentTransfer"], - ["fecomposite", "feComposite"], - ["feconvolvematrix", "feConvolveMatrix"], - ["fediffuselighting", "feDiffuseLighting"], - ["fedisplacementmap", "feDisplacementMap"], - ["fedistantlight", "feDistantLight"], - ["fedropshadow", "feDropShadow"], - ["feflood", "feFlood"], - ["fefunca", "feFuncA"], - ["fefuncb", "feFuncB"], - ["fefuncg", "feFuncG"], - ["fefuncr", "feFuncR"], - ["fegaussianblur", "feGaussianBlur"], - ["feimage", "feImage"], - ["femerge", "feMerge"], - ["femergenode", "feMergeNode"], - ["femorphology", "feMorphology"], - ["feoffset", "feOffset"], - ["fepointlight", "fePointLight"], - ["fespecularlighting", "feSpecularLighting"], - ["fespotlight", "feSpotLight"], - ["fetile", "feTile"], - ["feturbulence", "feTurbulence"], - ["foreignobject", "foreignObject"], - ["glyphref", "glyphRef"], - ["lineargradient", "linearGradient"], - ["radialgradient", "radialGradient"], - ["textpath", "textPath"], -]); + "altGlyph", + "altGlyphDef", + "altGlyphItem", + "animateColor", + "animateMotion", + "animateTransform", + "clipPath", + "feBlend", + "feColorMatrix", + "feComponentTransfer", + "feComposite", + "feConvolveMatrix", + "feDiffuseLighting", + "feDisplacementMap", + "feDistantLight", + "feDropShadow", + "feFlood", + "feFuncA", + "feFuncB", + "feFuncG", + "feFuncR", + "feGaussianBlur", + "feImage", + "feMerge", + "feMergeNode", + "feMorphology", + "feOffset", + "fePointLight", + "feSpecularLighting", + "feSpotLight", + "feTile", + "feTurbulence", + "foreignObject", + "glyphRef", + "linearGradient", + "radialGradient", + "textPath", +].map(function (val) { return [val.toLowerCase(), val]; })); exports.attributeNames = new Map([ - ["definitionurl", "definitionURL"], - ["attributename", "attributeName"], - ["attributetype", "attributeType"], - ["basefrequency", "baseFrequency"], - ["baseprofile", "baseProfile"], - ["calcmode", "calcMode"], - ["clippathunits", "clipPathUnits"], - ["diffuseconstant", "diffuseConstant"], - ["edgemode", "edgeMode"], - ["filterunits", "filterUnits"], - ["glyphref", "glyphRef"], - ["gradienttransform", "gradientTransform"], - ["gradientunits", "gradientUnits"], - ["kernelmatrix", "kernelMatrix"], - ["kernelunitlength", "kernelUnitLength"], - ["keypoints", "keyPoints"], - ["keysplines", "keySplines"], - ["keytimes", "keyTimes"], - ["lengthadjust", "lengthAdjust"], - ["limitingconeangle", "limitingConeAngle"], - ["markerheight", "markerHeight"], - ["markerunits", "markerUnits"], - ["markerwidth", "markerWidth"], - ["maskcontentunits", "maskContentUnits"], - ["maskunits", "maskUnits"], - ["numoctaves", "numOctaves"], - ["pathlength", "pathLength"], - ["patterncontentunits", "patternContentUnits"], - ["patterntransform", "patternTransform"], - ["patternunits", "patternUnits"], - ["pointsatx", "pointsAtX"], - ["pointsaty", "pointsAtY"], - ["pointsatz", "pointsAtZ"], - ["preservealpha", "preserveAlpha"], - ["preserveaspectratio", "preserveAspectRatio"], - ["primitiveunits", "primitiveUnits"], - ["refx", "refX"], - ["refy", "refY"], - ["repeatcount", "repeatCount"], - ["repeatdur", "repeatDur"], - ["requiredextensions", "requiredExtensions"], - ["requiredfeatures", "requiredFeatures"], - ["specularconstant", "specularConstant"], - ["specularexponent", "specularExponent"], - ["spreadmethod", "spreadMethod"], - ["startoffset", "startOffset"], - ["stddeviation", "stdDeviation"], - ["stitchtiles", "stitchTiles"], - ["surfacescale", "surfaceScale"], - ["systemlanguage", "systemLanguage"], - ["tablevalues", "tableValues"], - ["targetx", "targetX"], - ["targety", "targetY"], - ["textlength", "textLength"], - ["viewbox", "viewBox"], - ["viewtarget", "viewTarget"], - ["xchannelselector", "xChannelSelector"], - ["ychannelselector", "yChannelSelector"], - ["zoomandpan", "zoomAndPan"], -]); + "definitionURL", + "attributeName", + "attributeType", + "baseFrequency", + "baseProfile", + "calcMode", + "clipPathUnits", + "diffuseConstant", + "edgeMode", + "filterUnits", + "glyphRef", + "gradientTransform", + "gradientUnits", + "kernelMatrix", + "kernelUnitLength", + "keyPoints", + "keySplines", + "keyTimes", + "lengthAdjust", + "limitingConeAngle", + "markerHeight", + "markerUnits", + "markerWidth", + "maskContentUnits", + "maskUnits", + "numOctaves", + "pathLength", + "patternContentUnits", + "patternTransform", + "patternUnits", + "pointsAtX", + "pointsAtY", + "pointsAtZ", + "preserveAlpha", + "preserveAspectRatio", + "primitiveUnits", + "refX", + "refY", + "repeatCount", + "repeatDur", + "requiredExtensions", + "requiredFeatures", + "specularConstant", + "specularExponent", + "spreadMethod", + "startOffset", + "stdDeviation", + "stitchTiles", + "surfaceScale", + "systemLanguage", + "tableValues", + "targetX", + "targetY", + "textLength", + "viewBox", + "viewTarget", + "xChannelSelector", + "yChannelSelector", + "zoomAndPan", +].map(function (val) { return [val.toLowerCase(), val]; })); diff --git a/node_modules/dom-serializer/lib/index.d.ts b/node_modules/dom-serializer/lib/index.d.ts index 84f6d16..cdf04f0 100644 --- a/node_modules/dom-serializer/lib/index.d.ts +++ b/node_modules/dom-serializer/lib/index.d.ts @@ -1,4 +1,4 @@ -import type { Node } from "domhandler"; +import type { AnyNode } from "domhandler"; export interface DomSerializerOptions { /** * Print an empty attribute's value. @@ -25,7 +25,15 @@ export interface DomSerializerOptions { */ xmlMode?: boolean | "foreign"; /** - * Encode characters that are either reserved in HTML or XML, or are outside of the ASCII range. + * Encode characters that are either reserved in HTML or XML. + * + * If `xmlMode` is `true` or the value not `'utf8'`, characters outside of the utf8 range will be encoded as well. + * + * @default `decodeEntities` + */ + encodeEntities?: boolean | "utf8"; + /** + * Option inherited from parsing; will be used as the default value for `encodeEntities`. * * @default true */ @@ -39,5 +47,6 @@ export interface DomSerializerOptions { * @param node Node to be rendered. * @param options Changes serialization behavior */ -export default function render(node: Node | ArrayLike, options?: DomSerializerOptions): string; +export declare function render(node: AnyNode | ArrayLike, options?: DomSerializerOptions): string; +export default render; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/dom-serializer/lib/index.d.ts.map b/node_modules/dom-serializer/lib/index.d.ts.map index c04bdd4..6d9d0b6 100644 --- a/node_modules/dom-serializer/lib/index.d.ts.map +++ b/node_modules/dom-serializer/lib/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAuC,MAAM,YAAY,CAAC;AAW5E,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAqED;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAC5B,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,EAC5B,OAAO,GAAE,oBAAyB,GACjC,MAAM,CAUR"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,OAAO,EAMR,MAAM,YAAY,CAAC;AAWpB,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAClC;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AA4ED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,EAClC,OAAO,GAAE,oBAAyB,GACjC,MAAM,CAUR;AAED,eAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/node_modules/dom-serializer/lib/index.js b/node_modules/dom-serializer/lib/index.js index a5e1f93..af996ff 100644 --- a/node_modules/dom-serializer/lib/index.js +++ b/node_modules/dom-serializer/lib/index.js @@ -12,7 +12,11 @@ var __assign = (this && this.__assign) || function () { }; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; @@ -30,6 +34,7 @@ var __importStar = (this && this.__importStar) || function (mod) { return result; }; Object.defineProperty(exports, "__esModule", { value: true }); +exports.render = void 0; /* * Module dependencies */ @@ -41,7 +46,7 @@ var entities_1 = require("entities"); * * @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inforeign */ -var foreignNames_1 = require("./foreignNames"); +var foreignNames_js_1 = require("./foreignNames.js"); var unencodedElements = new Set([ "style", "script", @@ -52,26 +57,33 @@ var unencodedElements = new Set([ "plaintext", "noscript", ]); +function replaceQuotes(value) { + return value.replace(/"/g, """); +} /** * Format attributes */ function formatAttributes(attributes, opts) { + var _a; if (!attributes) return; + var encode = ((_a = opts.encodeEntities) !== null && _a !== void 0 ? _a : opts.decodeEntities) === false + ? replaceQuotes + : opts.xmlMode || opts.encodeEntities !== "utf8" + ? entities_1.encodeXML + : entities_1.escapeAttribute; return Object.keys(attributes) .map(function (key) { var _a, _b; var value = (_a = attributes[key]) !== null && _a !== void 0 ? _a : ""; if (opts.xmlMode === "foreign") { /* Fix up mixed-case attribute names */ - key = (_b = foreignNames_1.attributeNames.get(key)) !== null && _b !== void 0 ? _b : key; + key = (_b = foreignNames_js_1.attributeNames.get(key)) !== null && _b !== void 0 ? _b : key; } if (!opts.emptyAttrs && !opts.xmlMode && value === "") { return key; } - return key + "=\"" + (opts.decodeEntities !== false - ? entities_1.encodeXML(value) - : value.replace(/"/g, """)) + "\""; + return "".concat(key, "=\"").concat(encode(value), "\""); }) .join(" "); } @@ -116,13 +128,15 @@ function render(node, options) { } return output; } +exports.render = render; exports.default = render; function renderNode(node, options) { switch (node.type) { case ElementType.Root: return render(node.children, options); - case ElementType.Directive: + // @ts-expect-error We don't use `Doctype` yet case ElementType.Doctype: + case ElementType.Directive: return renderDirective(node); case ElementType.Comment: return renderComment(node); @@ -153,7 +167,7 @@ function renderTag(elem, opts) { // Handle SVG / MathML in HTML if (opts.xmlMode === "foreign") { /* Fix up mixed-case element names */ - elem.name = (_a = foreignNames_1.elementNames.get(elem.name)) !== null && _a !== void 0 ? _a : elem.name; + elem.name = (_a = foreignNames_js_1.elementNames.get(elem.name)) !== null && _a !== void 0 ? _a : elem.name; /* Exit foreign mode at integration points */ if (elem.parent && foreignModeIntegrationPoints.has(elem.parent.name)) { @@ -163,10 +177,10 @@ function renderTag(elem, opts) { if (!opts.xmlMode && foreignElements.has(elem.name)) { opts = __assign(__assign({}, opts), { xmlMode: "foreign" }); } - var tag = "<" + elem.name; + var tag = "<".concat(elem.name); var attribs = formatAttributes(elem.attribs, opts); if (attribs) { - tag += " " + attribs; + tag += " ".concat(attribs); } if (elem.children.length === 0 && (opts.xmlMode @@ -184,28 +198,32 @@ function renderTag(elem, opts) { tag += render(elem.children, opts); } if (opts.xmlMode || !singleTag.has(elem.name)) { - tag += ""; + tag += ""); } } return tag; } function renderDirective(elem) { - return "<" + elem.data + ">"; + return "<".concat(elem.data, ">"); } function renderText(elem, opts) { + var _a; var data = elem.data || ""; // If entities weren't decoded, no need to encode them back - if (opts.decodeEntities !== false && + if (((_a = opts.encodeEntities) !== null && _a !== void 0 ? _a : opts.decodeEntities) !== false && !(!opts.xmlMode && elem.parent && unencodedElements.has(elem.parent.name))) { - data = entities_1.encodeXML(data); + data = + opts.xmlMode || opts.encodeEntities !== "utf8" + ? (0, entities_1.encodeXML)(data) + : (0, entities_1.escapeText)(data); } return data; } function renderCdata(elem) { - return ""; + return ""); } function renderComment(elem) { - return ""; + return ""); } diff --git a/node_modules/dom-serializer/package.json b/node_modules/dom-serializer/package.json index 80b882c..002681c 100644 --- a/node_modules/dom-serializer/package.json +++ b/node_modules/dom-serializer/package.json @@ -1,88 +1,69 @@ { - "_from": "dom-serializer@^1.3.2", - "_id": "dom-serializer@1.3.2", - "_inBundle": false, - "_integrity": "sha512-5c54Bk5Dw4qAxNOI1pFEizPSjVsx5+bpJKmL2kPn8JhBUq2q09tTCa3mjijun2NfK78NMouDYNMBkOrPZiS+ig==", - "_location": "/dom-serializer", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "dom-serializer@^1.3.2", - "name": "dom-serializer", - "escapedName": "dom-serializer", - "rawSpec": "^1.3.2", - "saveSpec": null, - "fetchSpec": "^1.3.2" - }, - "_requiredBy": [ - "/cheerio", - "/domutils" - ], - "_resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz", - "_shasum": "6206437d32ceefaec7161803230c7a20bc1b4d91", - "_spec": "dom-serializer@^1.3.2", - "_where": "/home/runner/work/public_library_map/public_library_map/node_modules/cheerio", - "author": { - "name": "Felix Boehm", - "email": "me@feedic.com" - }, - "bugs": { - "url": "https://github.com/cheeriojs/dom-renderer/issues" - }, - "bundleDependencies": false, - "dependencies": { - "domelementtype": "^2.0.1", - "domhandler": "^4.2.0", - "entities": "^2.0.0" - }, - "deprecated": false, + "name": "dom-serializer", + "version": "2.0.0", "description": "render domhandler DOM nodes to a string", - "devDependencies": { - "@types/jest": "^26.0.23", - "@types/node": "^15.3.0", - "@typescript-eslint/eslint-plugin": "^4.23.0", - "@typescript-eslint/parser": "^4.23.0", - "cheerio": "^1.0.0-rc.9", - "coveralls": "^3.0.5", - "eslint": "^7.26.0", - "eslint-config-prettier": "^8.3.0", - "htmlparser2": "^6.1.0", - "jest": "^26.0.1", - "prettier": "^2.3.0", - "ts-jest": "^26.5.6", - "typescript": "^4.0.2" - }, - "files": [ - "lib/**/*" - ], - "funding": "https://github.com/cheeriojs/dom-serializer?sponsor=1", - "homepage": "https://github.com/cheeriojs/dom-renderer#readme", - "jest": { - "preset": "ts-jest", - "testEnvironment": "node" - }, + "author": "Felix Boehm ", + "sideEffects": false, "keywords": [ "html", "xml", "render" ], - "license": "MIT", - "main": "lib/index.js", - "name": "dom-serializer", "repository": { "type": "git", - "url": "git://github.com/cheeriojs/dom-renderer.git" + "url": "git://github.com/cheeriojs/dom-serializer.git" + }, + "main": "lib/index.js", + "types": "lib/index.d.ts", + "module": "lib/esm/index.js", + "exports": { + "require": "./lib/index.js", + "import": "./lib/esm/index.js" + }, + "files": [ + "lib/**/*" + ], + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" + }, + "devDependencies": { + "@types/jest": "^27.4.1", + "@types/node": "^17.0.23", + "@typescript-eslint/eslint-plugin": "^5.18.0", + "@typescript-eslint/parser": "^5.18.0", + "cheerio": "^1.0.0-rc.9", + "eslint": "^8.12.0", + "eslint-config-prettier": "^8.5.0", + "htmlparser2": "^7.2.0", + "jest": "^27.5.1", + "prettier": "^2.6.2", + "ts-jest": "^27.1.4", + "typescript": "^4.6.3" }, "scripts": { - "build": "tsc", - "coverage": "cat coverage/lcov.info | coveralls", - "format": "prettier --write '**/*.{ts,md,json}'", - "lint": "eslint src", - "prepare": "npm run build", - "test": "jest --coverage && npm run lint" + "test": "npm run test:jest && npm run lint", + "test:jest": "jest", + "lint": "npm run lint:es && npm run lint:prettier", + "lint:es": "eslint --ignore-path .gitignore .", + "lint:prettier": "npm run prettier -- --check", + "format": "npm run format:es && npm run format:prettier", + "format:es": "npm run lint:es -- --fix", + "format:prettier": "npm run prettier -- --write", + "prettier": "prettier \"**/*.{ts,md,json,yml}\" --ignore-path .gitignore", + "build": "npm run build:cjs && npm run build:esm", + "build:cjs": "tsc", + "build:esm": "tsc --module esnext --target es2019 --outDir lib/esm && echo '{\"type\":\"module\"}' > lib/esm/package.json", + "prepare": "npm run build" }, - "sideEffects": false, - "types": "lib/index.d.ts", - "version": "1.3.2" + "jest": { + "preset": "ts-jest", + "testEnvironment": "node", + "moduleNameMapper": { + "^(.*)\\.js$": "$1" + } + }, + "funding": "https://github.com/cheeriojs/dom-serializer?sponsor=1", + "license": "MIT" } diff --git a/node_modules/domelementtype/package.json b/node_modules/domelementtype/package.json index cdc46b3..f23933a 100644 --- a/node_modules/domelementtype/package.json +++ b/node_modules/domelementtype/package.json @@ -1,81 +1,54 @@ { - "_from": "domelementtype@^2.2.0", - "_id": "domelementtype@2.2.0", - "_inBundle": false, - "_integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==", - "_location": "/domelementtype", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "domelementtype@^2.2.0", "name": "domelementtype", - "escapedName": "domelementtype", - "rawSpec": "^2.2.0", - "saveSpec": null, - "fetchSpec": "^2.2.0" - }, - "_requiredBy": [ - "/cheerio-select", - "/dom-serializer", - "/domhandler", - "/domutils", - "/htmlparser2" - ], - "_resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz", - "_shasum": "9a0b6c2782ed6a1c7323d42267183df9bd8b1d57", - "_spec": "domelementtype@^2.2.0", - "_where": "/home/runner/work/public_library_map/public_library_map/node_modules/cheerio-select", - "author": { - "name": "Felix Boehm", - "email": "me@feedic.com" - }, - "bugs": { - "url": "https://github.com/fb55/domelementtype/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "all the types of nodes in htmlparser2's dom", - "devDependencies": { - "@typescript-eslint/eslint-plugin": "^4.1.0", - "@typescript-eslint/parser": "^4.1.0", - "eslint": "^7.9.0", - "eslint-config-prettier": "^6.0.0", - "prettier": "^2.1.1", - "typescript": "^4.0.2" - }, - "files": [ - "lib/**/*" - ], - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fb55" + "version": "2.3.0", + "description": "all the types of nodes in htmlparser2's dom", + "author": "Felix Boehm ", + "license": "BSD-2-Clause", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "sideEffects": false, + "main": "lib/index.js", + "types": "lib/index.d.ts", + "module": "lib/esm/index.js", + "exports": { + "require": "./lib/index.js", + "import": "./lib/esm/index.js" + }, + "files": [ + "lib/**/*" + ], + "repository": { + "type": "git", + "url": "git://github.com/fb55/domelementtype.git" + }, + "keywords": [ + "dom", + "element", + "types", + "htmlparser2" + ], + "scripts": { + "test": "npm run lint && prettier --check **/*.{ts,json,md}", + "lint": "eslint src", + "format": "prettier --write **/*.{ts,json,md}", + "build": "npm run build:cjs && npm run build:esm", + "build:cjs": "tsc", + "build:esm": "tsc --module esnext --target es2019 --outDir lib/esm && echo '{\"type\":\"module\"}' > lib/esm/package.json", + "prepare": "npm run build" + }, + "prettier": { + "tabWidth": 4 + }, + "devDependencies": { + "@typescript-eslint/eslint-plugin": "^5.18.0", + "@typescript-eslint/parser": "^5.18.0", + "eslint": "^8.12.0", + "eslint-config-prettier": "^8.5.0", + "prettier": "^2.6.2", + "typescript": "^4.6.3" } - ], - "homepage": "https://github.com/fb55/domelementtype#readme", - "keywords": [ - "dom", - "htmlparser2" - ], - "license": "BSD-2-Clause", - "main": "lib/index.js", - "name": "domelementtype", - "prettier": { - "tabWidth": 4 - }, - "repository": { - "type": "git", - "url": "git://github.com/fb55/domelementtype.git" - }, - "scripts": { - "build": "tsc", - "format": "prettier --write **/*.{ts,json,md}", - "lint": "eslint src", - "prepare": "npm run build", - "test": "npm run lint && prettier --check **/*.{ts,json,md}" - }, - "sideEffects": false, - "types": "lib/index.d.ts", - "version": "2.2.0" } diff --git a/node_modules/domhandler/lib/index.d.ts b/node_modules/domhandler/lib/index.d.ts index befc7d8..5d322c1 100644 --- a/node_modules/domhandler/lib/index.d.ts +++ b/node_modules/domhandler/lib/index.d.ts @@ -1,5 +1,5 @@ -import { Node, Element, DataNode, NodeWithChildren, Document } from "./node"; -export * from "./node"; +import { ChildNode, Element, DataNode, Document, ParentNode } from "./node.js"; +export * from "./node.js"; export interface DomHandlerOptions { /** * Add a `startIndex` property to nodes. @@ -17,15 +17,6 @@ export interface DomHandlerOptions { * @default false */ withEndIndices?: boolean; - /** - * Replace all whitespace with single spaces. - * - * **Note:** Enabling this might break your markup. - * - * @default false - * @deprecated - */ - normalizeWhitespace?: boolean; /** * Treat the markup as XML. * @@ -37,11 +28,11 @@ interface ParserInterface { startIndex: number | null; endIndex: number | null; } -declare type Callback = (error: Error | null, dom: Node[]) => void; +declare type Callback = (error: Error | null, dom: ChildNode[]) => void; declare type ElementCallback = (element: Element) => void; export declare class DomHandler { /** The elements of the DOM */ - dom: Node[]; + dom: ChildNode[]; /** The root element for the DOM */ root: Document; /** Called once parsing has completed. */ @@ -53,7 +44,7 @@ export declare class DomHandler { /** Indicated whether parsing has been completed. */ private done; /** Stack of open tags. */ - protected tagStack: NodeWithChildren[]; + protected tagStack: ParentNode[]; /** A data node that is still being written to. */ protected lastNode: DataNode | null; /** Reference to the parser instance. Used for location information. */ @@ -79,7 +70,7 @@ export declare class DomHandler { oncdataend(): void; onprocessinginstruction(name: string, data: string): void; protected handleCallback(error: Error | null): void; - protected addNode(node: Node): void; + protected addNode(node: ChildNode): void; } export default DomHandler; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/domhandler/lib/index.d.ts.map b/node_modules/domhandler/lib/index.d.ts.map index c5fe113..90dbc4b 100644 --- a/node_modules/domhandler/lib/index.d.ts.map +++ b/node_modules/domhandler/lib/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACH,IAAI,EACJ,OAAO,EACP,QAAQ,EAGR,gBAAgB,EAChB,QAAQ,EAEX,MAAM,QAAQ,CAAC;AAEhB,cAAc,QAAQ,CAAC;AAIvB,MAAM,WAAW,iBAAiB;IAC9B;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAUD,UAAU,eAAe;IACrB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,aAAK,QAAQ,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;AAC3D,aAAK,eAAe,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;AAElD,qBAAa,UAAU;IACnB,8BAA8B;IACvB,GAAG,EAAE,IAAI,EAAE,CAAM;IAExB,mCAAmC;IAC5B,IAAI,WAA0B;IAErC,yCAAyC;IACzC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkB;IAE3C,gCAAgC;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;IAE5C,yCAAyC;IACzC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyB;IAEnD,oDAAoD;IACpD,OAAO,CAAC,IAAI,CAAS;IAErB,0BAA0B;IAC1B,SAAS,CAAC,QAAQ,EAAE,gBAAgB,EAAE,CAAe;IAErD,kDAAkD;IAClD,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAQ;IAE3C,uEAAuE;IACvE,OAAO,CAAC,MAAM,CAAgC;IAE9C;;;;OAIG;gBAEC,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,EAC1B,OAAO,CAAC,EAAE,iBAAiB,GAAG,IAAI,EAClC,SAAS,CAAC,EAAE,eAAe;IAiBxB,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;IAK3C,OAAO,IAAI,IAAI;IAUf,KAAK,IAAI,IAAI;IAOb,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAI3B,UAAU,IAAI,IAAI;IAYlB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,IAAI;IAOjE,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IA2B1B,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAW7B,YAAY,IAAI,IAAI;IAIpB,YAAY,IAAI,IAAI;IAUpB,UAAU,IAAI,IAAI;IAIlB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAKhE,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI;IAQnD,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;CAwBtC;AAED,eAAe,UAAU,CAAC"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACH,SAAS,EACT,OAAO,EACP,QAAQ,EAIR,QAAQ,EAER,UAAU,EACb,MAAM,WAAW,CAAC;AAEnB,cAAc,WAAW,CAAC;AAE1B,MAAM,WAAW,iBAAiB;IAC9B;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AASD,UAAU,eAAe;IACrB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,aAAK,QAAQ,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;AAChE,aAAK,eAAe,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;AAElD,qBAAa,UAAU;IACnB,8BAA8B;IACvB,GAAG,EAAE,SAAS,EAAE,CAAM;IAE7B,mCAAmC;IAC5B,IAAI,WAA0B;IAErC,yCAAyC;IACzC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkB;IAE3C,gCAAgC;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;IAE5C,yCAAyC;IACzC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyB;IAEnD,oDAAoD;IACpD,OAAO,CAAC,IAAI,CAAS;IAErB,0BAA0B;IAC1B,SAAS,CAAC,QAAQ,EAAE,UAAU,EAAE,CAAe;IAE/C,kDAAkD;IAClD,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAQ;IAE3C,uEAAuE;IACvE,OAAO,CAAC,MAAM,CAAgC;IAE9C;;;;OAIG;gBAEC,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,EAC1B,OAAO,CAAC,EAAE,iBAAiB,GAAG,IAAI,EAClC,SAAS,CAAC,EAAE,eAAe;IAiBxB,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;IAK3C,OAAO,IAAI,IAAI;IAUf,KAAK,IAAI,IAAI;IAOb,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAI3B,UAAU,IAAI,IAAI;IAYlB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,IAAI;IAOjE,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAe1B,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAW7B,YAAY,IAAI,IAAI;IAIpB,YAAY,IAAI,IAAI;IAUpB,UAAU,IAAI,IAAI;IAIlB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAKhE,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI;IAQnD,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;CAwB3C;AAED,eAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/node_modules/domhandler/lib/index.js b/node_modules/domhandler/lib/index.js index 5f5bb03..9c4ea0e 100644 --- a/node_modules/domhandler/lib/index.js +++ b/node_modules/domhandler/lib/index.js @@ -1,7 +1,11 @@ "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; @@ -12,12 +16,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.DomHandler = void 0; var domelementtype_1 = require("domelementtype"); -var node_1 = require("./node"); -__exportStar(require("./node"), exports); -var reWhitespace = /\s+/g; +var node_js_1 = require("./node.js"); +__exportStar(require("./node.js"), exports); // Default options var defaultOpts = { - normalizeWhitespace: false, withStartIndices: false, withEndIndices: false, xmlMode: false, @@ -32,7 +34,7 @@ var DomHandler = /** @class */ (function () { /** The elements of the DOM */ this.dom = []; /** The root element for the DOM */ - this.root = new node_1.Document(this.dom); + this.root = new node_js_1.Document(this.dom); /** Indicated whether parsing has been completed. */ this.done = false; /** Stack of open tags. */ @@ -60,7 +62,7 @@ var DomHandler = /** @class */ (function () { // Resets the handler back to starting state DomHandler.prototype.onreset = function () { this.dom = []; - this.root = new node_1.Document(this.dom); + this.root = new node_js_1.Document(this.dom); this.done = false; this.tagStack = [this.root]; this.lastNode = null; @@ -88,29 +90,20 @@ var DomHandler = /** @class */ (function () { }; DomHandler.prototype.onopentag = function (name, attribs) { var type = this.options.xmlMode ? domelementtype_1.ElementType.Tag : undefined; - var element = new node_1.Element(name, attribs, undefined, type); + var element = new node_js_1.Element(name, attribs, undefined, type); this.addNode(element); this.tagStack.push(element); }; DomHandler.prototype.ontext = function (data) { - var normalizeWhitespace = this.options.normalizeWhitespace; var lastNode = this.lastNode; if (lastNode && lastNode.type === domelementtype_1.ElementType.Text) { - if (normalizeWhitespace) { - lastNode.data = (lastNode.data + data).replace(reWhitespace, " "); - } - else { - lastNode.data += data; - } + lastNode.data += data; if (this.options.withEndIndices) { lastNode.endIndex = this.parser.endIndex; } } else { - if (normalizeWhitespace) { - data = data.replace(reWhitespace, " "); - } - var node = new node_1.Text(data); + var node = new node_js_1.Text(data); this.addNode(node); this.lastNode = node; } @@ -120,7 +113,7 @@ var DomHandler = /** @class */ (function () { this.lastNode.data += data; return; } - var node = new node_1.Comment(data); + var node = new node_js_1.Comment(data); this.addNode(node); this.lastNode = node; }; @@ -128,8 +121,8 @@ var DomHandler = /** @class */ (function () { this.lastNode = null; }; DomHandler.prototype.oncdatastart = function () { - var text = new node_1.Text(""); - var node = new node_1.NodeWithChildren(domelementtype_1.ElementType.CDATA, [text]); + var text = new node_js_1.Text(""); + var node = new node_js_1.CDATA([text]); this.addNode(node); text.parent = node; this.lastNode = text; @@ -138,7 +131,7 @@ var DomHandler = /** @class */ (function () { this.lastNode = null; }; DomHandler.prototype.onprocessinginstruction = function (name, data) { - var node = new node_1.ProcessingInstruction(name, data); + var node = new node_js_1.ProcessingInstruction(name, data); this.addNode(node); }; DomHandler.prototype.handleCallback = function (error) { diff --git a/node_modules/domhandler/lib/node.d.ts b/node_modules/domhandler/lib/node.d.ts index 1f4b7bb..b71c88a 100644 --- a/node_modules/domhandler/lib/node.d.ts +++ b/node_modules/domhandler/lib/node.d.ts @@ -1,32 +1,71 @@ import { ElementType } from "domelementtype"; +interface SourceCodeLocation { + /** One-based line index of the first character. */ + startLine: number; + /** One-based column index of the first character. */ + startCol: number; + /** Zero-based first character index. */ + startOffset: number; + /** One-based line index of the last character. */ + endLine: number; + /** One-based column index of the last character. Points directly *after* the last character. */ + endCol: number; + /** Zero-based last character index. Points directly *after* the last character. */ + endOffset: number; +} +interface TagSourceCodeLocation extends SourceCodeLocation { + startTag?: SourceCodeLocation; + endTag?: SourceCodeLocation; +} +export declare type ParentNode = Document | Element | CDATA; +export declare type ChildNode = Text | Comment | ProcessingInstruction | Element | CDATA | Document; +export declare type AnyNode = ParentNode | ChildNode; /** * This object will be used as the prototype for Nodes when creating a * DOM-Level-1-compliant structure. */ -export declare class Node { - type: ElementType; +export declare abstract class Node { + /** The type of the node. */ + abstract readonly type: ElementType; /** Parent of the node */ - parent: NodeWithChildren | null; + parent: ParentNode | null; /** Previous sibling */ - prev: Node | null; + prev: ChildNode | null; /** Next sibling */ - next: Node | null; + next: ChildNode | null; /** The start index of the node. Requires `withStartIndices` on the handler to be `true. */ startIndex: number | null; /** The end index of the node. Requires `withEndIndices` on the handler to be `true. */ endIndex: number | null; /** + * `parse5` source code location info. * - * @param type The type of the node. + * Available if parsing with parse5 and location info is enabled. */ - constructor(type: ElementType); - get nodeType(): number; - get parentNode(): NodeWithChildren | null; - set parentNode(parent: NodeWithChildren | null); - get previousSibling(): Node | null; - set previousSibling(prev: Node | null); - get nextSibling(): Node | null; - set nextSibling(next: Node | null); + sourceCodeLocation?: SourceCodeLocation | null; + /** + * [DOM spec](https://dom.spec.whatwg.org/#dom-node-nodetype)-compatible + * node {@link type}. + */ + abstract readonly nodeType: number; + /** + * Same as {@link parent}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ + get parentNode(): ParentNode | null; + set parentNode(parent: ParentNode | null); + /** + * Same as {@link prev}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ + get previousSibling(): ChildNode | null; + set previousSibling(prev: ChildNode | null); + /** + * Same as {@link next}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ + get nextSibling(): ChildNode | null; + set nextSibling(next: ChildNode | null); /** * Clone this node, and optionally its children. * @@ -38,13 +77,16 @@ export declare class Node { /** * A node that contains some data. */ -export declare class DataNode extends Node { +export declare abstract class DataNode extends Node { data: string; /** - * @param type The type of the node * @param data The content of the data node */ - constructor(type: ElementType.Comment | ElementType.Text | ElementType.Directive, data: string); + constructor(data: string); + /** + * Same as {@link data}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ get nodeValue(): string; set nodeValue(data: string); } @@ -52,44 +94,62 @@ export declare class DataNode extends Node { * Text within the document. */ export declare class Text extends DataNode { - constructor(data: string); + type: ElementType.Text; + get nodeType(): 3; } /** * Comments within the document. */ export declare class Comment extends DataNode { - constructor(data: string); + type: ElementType.Comment; + get nodeType(): 8; } /** * Processing instructions, including doc types. */ export declare class ProcessingInstruction extends DataNode { name: string; + type: ElementType.Directive; constructor(name: string, data: string); + get nodeType(): 1; + /** If this is a doctype, the document type name (parse5 only). */ "x-name"?: string; + /** If this is a doctype, the document type public identifier (parse5 only). */ "x-publicId"?: string; + /** If this is a doctype, the document type system identifier (parse5 only). */ "x-systemId"?: string; } /** * A `Node` that can have children. */ -export declare class NodeWithChildren extends Node { - children: Node[]; +export declare abstract class NodeWithChildren extends Node { + children: ChildNode[]; /** - * @param type Type of the node. * @param children Children of the node. Only certain node types can have children. */ - constructor(type: ElementType.Root | ElementType.CDATA | ElementType.Script | ElementType.Style | ElementType.Tag, children: Node[]); - get firstChild(): Node | null; - get lastChild(): Node | null; - get childNodes(): Node[]; - set childNodes(children: Node[]); + constructor(children: ChildNode[]); + /** First child of the node. */ + get firstChild(): ChildNode | null; + /** Last child of the node. */ + get lastChild(): ChildNode | null; + /** + * Same as {@link children}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ + get childNodes(): ChildNode[]; + set childNodes(children: ChildNode[]); +} +export declare class CDATA extends NodeWithChildren { + type: ElementType.CDATA; + get nodeType(): 4; } /** * The root node of the document. */ export declare class Document extends NodeWithChildren { - constructor(children: Node[]); + type: ElementType.Root; + get nodeType(): 9; + /** [Document mode](https://dom.spec.whatwg.org/#concept-document-limited-quirks) (parse5 only). */ "x-mode"?: "no-quirks" | "quirks" | "limited-quirks"; } /** @@ -109,6 +169,7 @@ export declare class Element extends NodeWithChildren { attribs: { [name: string]: string; }; + type: ElementType.Tag | ElementType.Script | ElementType.Style; /** * @param name Name of the tag, eg. `div`, `span`. * @param attribs Object mapping attribute names to attribute values. @@ -116,11 +177,26 @@ export declare class Element extends NodeWithChildren { */ constructor(name: string, attribs: { [name: string]: string; - }, children?: Node[], type?: ElementType.Tag | ElementType.Script | ElementType.Style); + }, children?: ChildNode[], type?: ElementType.Tag | ElementType.Script | ElementType.Style); + get nodeType(): 1; + /** + * `parse5` source code location info, with start & end tags. + * + * Available if parsing with parse5 and location info is enabled. + */ + sourceCodeLocation?: TagSourceCodeLocation | null; + /** + * Same as {@link name}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ get tagName(): string; set tagName(name: string); get attributes(): Attribute[]; + /** Element namespace (parse5 only). */ + namespace?: string; + /** Element attribute namespaces (parse5 only). */ "x-attribsNamespace"?: Record; + /** Element attribute namespace-related prefixes (parse5 only). */ "x-attribsPrefix"?: Record; } /** @@ -132,7 +208,7 @@ export declare function isTag(node: Node): node is Element; * @param node Node to check. * @returns `true` if the node has the type `CDATA`, `false` otherwise. */ -export declare function isCDATA(node: Node): node is NodeWithChildren; +export declare function isCDATA(node: Node): node is CDATA; /** * @param node Node to check. * @returns `true` if the node has the type `Text`, `false` otherwise. @@ -142,7 +218,7 @@ export declare function isText(node: Node): node is Text; * @param node Node to check. * @returns `true` if the node has the type `Comment`, `false` otherwise. */ -export declare function isComment(node: Node): node is DataNode; +export declare function isComment(node: Node): node is Comment; /** * @param node Node to check. * @returns `true` if the node has the type `ProcessingInstruction`, `false` otherwise. @@ -155,9 +231,9 @@ export declare function isDirective(node: Node): node is ProcessingInstruction; export declare function isDocument(node: Node): node is Document; /** * @param node Node to check. - * @returns `true` if the node is a `NodeWithChildren` (has children), `false` otherwise. + * @returns `true` if the node has children, `false` otherwise. */ -export declare function hasChildren(node: Node): node is NodeWithChildren; +export declare function hasChildren(node: Node): node is ParentNode; /** * Clone a node, and optionally its children. * diff --git a/node_modules/domhandler/lib/node.d.ts.map b/node_modules/domhandler/lib/node.d.ts.map index 593d718..40fa82e 100644 --- a/node_modules/domhandler/lib/node.d.ts.map +++ b/node_modules/domhandler/lib/node.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"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"} \ No newline at end of file +{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"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"} \ No newline at end of file diff --git a/node_modules/domhandler/lib/node.js b/node_modules/domhandler/lib/node.js index bc21d11..df08e5b 100644 --- a/node_modules/domhandler/lib/node.js +++ b/node_modules/domhandler/lib/node.js @@ -26,29 +26,14 @@ var __assign = (this && this.__assign) || function () { return __assign.apply(this, arguments); }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.cloneNode = exports.hasChildren = exports.isDocument = exports.isDirective = exports.isComment = exports.isText = exports.isCDATA = exports.isTag = exports.Element = exports.Document = exports.NodeWithChildren = exports.ProcessingInstruction = exports.Comment = exports.Text = exports.DataNode = exports.Node = void 0; +exports.cloneNode = exports.hasChildren = exports.isDocument = exports.isDirective = exports.isComment = exports.isText = exports.isCDATA = exports.isTag = exports.Element = exports.Document = exports.CDATA = exports.NodeWithChildren = exports.ProcessingInstruction = exports.Comment = exports.Text = exports.DataNode = exports.Node = void 0; var domelementtype_1 = require("domelementtype"); -var nodeTypes = new Map([ - [domelementtype_1.ElementType.Tag, 1], - [domelementtype_1.ElementType.Script, 1], - [domelementtype_1.ElementType.Style, 1], - [domelementtype_1.ElementType.Directive, 1], - [domelementtype_1.ElementType.Text, 3], - [domelementtype_1.ElementType.CDATA, 4], - [domelementtype_1.ElementType.Comment, 8], - [domelementtype_1.ElementType.Root, 9], -]); /** * This object will be used as the prototype for Nodes when creating a * DOM-Level-1-compliant structure. */ var Node = /** @class */ (function () { - /** - * - * @param type The type of the node. - */ - function Node(type) { - this.type = type; + function Node() { /** Parent of the node */ this.parent = null; /** Previous sibling */ @@ -60,17 +45,12 @@ var Node = /** @class */ (function () { /** The end index of the node. Requires `withEndIndices` on the handler to be `true. */ this.endIndex = null; } - Object.defineProperty(Node.prototype, "nodeType", { - // Read-only aliases - get: function () { - var _a; - return (_a = nodeTypes.get(this.type)) !== null && _a !== void 0 ? _a : 1; - }, - enumerable: false, - configurable: true - }); Object.defineProperty(Node.prototype, "parentNode", { // Read-write aliases for properties + /** + * Same as {@link parent}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ get: function () { return this.parent; }, @@ -81,6 +61,10 @@ var Node = /** @class */ (function () { configurable: true }); Object.defineProperty(Node.prototype, "previousSibling", { + /** + * Same as {@link prev}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ get: function () { return this.prev; }, @@ -91,6 +75,10 @@ var Node = /** @class */ (function () { configurable: true }); Object.defineProperty(Node.prototype, "nextSibling", { + /** + * Same as {@link next}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ get: function () { return this.next; }, @@ -119,15 +107,18 @@ exports.Node = Node; var DataNode = /** @class */ (function (_super) { __extends(DataNode, _super); /** - * @param type The type of the node * @param data The content of the data node */ - function DataNode(type, data) { - var _this = _super.call(this, type) || this; + function DataNode(data) { + var _this = _super.call(this) || this; _this.data = data; return _this; } Object.defineProperty(DataNode.prototype, "nodeValue", { + /** + * Same as {@link data}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ get: function () { return this.data; }, @@ -145,9 +136,18 @@ exports.DataNode = DataNode; */ var Text = /** @class */ (function (_super) { __extends(Text, _super); - function Text(data) { - return _super.call(this, domelementtype_1.ElementType.Text, data) || this; + function Text() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.type = domelementtype_1.ElementType.Text; + return _this; } + Object.defineProperty(Text.prototype, "nodeType", { + get: function () { + return 3; + }, + enumerable: false, + configurable: true + }); return Text; }(DataNode)); exports.Text = Text; @@ -156,9 +156,18 @@ exports.Text = Text; */ var Comment = /** @class */ (function (_super) { __extends(Comment, _super); - function Comment(data) { - return _super.call(this, domelementtype_1.ElementType.Comment, data) || this; + function Comment() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.type = domelementtype_1.ElementType.Comment; + return _this; } + Object.defineProperty(Comment.prototype, "nodeType", { + get: function () { + return 8; + }, + enumerable: false, + configurable: true + }); return Comment; }(DataNode)); exports.Comment = Comment; @@ -168,10 +177,18 @@ exports.Comment = Comment; var ProcessingInstruction = /** @class */ (function (_super) { __extends(ProcessingInstruction, _super); function ProcessingInstruction(name, data) { - var _this = _super.call(this, domelementtype_1.ElementType.Directive, data) || this; + var _this = _super.call(this, data) || this; _this.name = name; + _this.type = domelementtype_1.ElementType.Directive; return _this; } + Object.defineProperty(ProcessingInstruction.prototype, "nodeType", { + get: function () { + return 1; + }, + enumerable: false, + configurable: true + }); return ProcessingInstruction; }(DataNode)); exports.ProcessingInstruction = ProcessingInstruction; @@ -181,16 +198,16 @@ exports.ProcessingInstruction = ProcessingInstruction; var NodeWithChildren = /** @class */ (function (_super) { __extends(NodeWithChildren, _super); /** - * @param type Type of the node. * @param children Children of the node. Only certain node types can have children. */ - function NodeWithChildren(type, children) { - var _this = _super.call(this, type) || this; + function NodeWithChildren(children) { + var _this = _super.call(this) || this; _this.children = children; return _this; } Object.defineProperty(NodeWithChildren.prototype, "firstChild", { // Aliases + /** First child of the node. */ get: function () { var _a; return (_a = this.children[0]) !== null && _a !== void 0 ? _a : null; @@ -199,6 +216,7 @@ var NodeWithChildren = /** @class */ (function (_super) { configurable: true }); Object.defineProperty(NodeWithChildren.prototype, "lastChild", { + /** Last child of the node. */ get: function () { return this.children.length > 0 ? this.children[this.children.length - 1] @@ -208,6 +226,10 @@ var NodeWithChildren = /** @class */ (function (_super) { configurable: true }); Object.defineProperty(NodeWithChildren.prototype, "childNodes", { + /** + * Same as {@link children}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ get: function () { return this.children; }, @@ -220,14 +242,40 @@ var NodeWithChildren = /** @class */ (function (_super) { return NodeWithChildren; }(Node)); exports.NodeWithChildren = NodeWithChildren; +var CDATA = /** @class */ (function (_super) { + __extends(CDATA, _super); + function CDATA() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.type = domelementtype_1.ElementType.CDATA; + return _this; + } + Object.defineProperty(CDATA.prototype, "nodeType", { + get: function () { + return 4; + }, + enumerable: false, + configurable: true + }); + return CDATA; +}(NodeWithChildren)); +exports.CDATA = CDATA; /** * The root node of the document. */ var Document = /** @class */ (function (_super) { __extends(Document, _super); - function Document(children) { - return _super.call(this, domelementtype_1.ElementType.Root, children) || this; + function Document() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.type = domelementtype_1.ElementType.Root; + return _this; } + Object.defineProperty(Document.prototype, "nodeType", { + get: function () { + return 9; + }, + enumerable: false, + configurable: true + }); return Document; }(NodeWithChildren)); exports.Document = Document; @@ -248,13 +296,25 @@ var Element = /** @class */ (function (_super) { : name === "style" ? domelementtype_1.ElementType.Style : domelementtype_1.ElementType.Tag; } - var _this = _super.call(this, type, children) || this; + var _this = _super.call(this, children) || this; _this.name = name; _this.attribs = attribs; + _this.type = type; return _this; } + Object.defineProperty(Element.prototype, "nodeType", { + get: function () { + return 1; + }, + enumerable: false, + configurable: true + }); Object.defineProperty(Element.prototype, "tagName", { // DOM Level 1 aliases + /** + * Same as {@link name}. + * [DOM spec](https://dom.spec.whatwg.org)-compatible alias. + */ get: function () { return this.name; }, @@ -333,7 +393,7 @@ function isDocument(node) { exports.isDocument = isDocument; /** * @param node Node to check. - * @returns `true` if the node is a `NodeWithChildren` (has children), `false` otherwise. + * @returns `true` if the node has children, `false` otherwise. */ function hasChildren(node) { return Object.prototype.hasOwnProperty.call(node, "children"); @@ -358,6 +418,9 @@ function cloneNode(node, recursive) { var children = recursive ? cloneChildren(node.children) : []; var clone_1 = new Element(node.name, __assign({}, node.attribs), children); children.forEach(function (child) { return (child.parent = clone_1); }); + if (node.namespace != null) { + clone_1.namespace = node.namespace; + } if (node["x-attribsNamespace"]) { clone_1["x-attribsNamespace"] = __assign({}, node["x-attribsNamespace"]); } @@ -368,7 +431,7 @@ function cloneNode(node, recursive) { } else if (isCDATA(node)) { var children = recursive ? cloneChildren(node.children) : []; - var clone_2 = new NodeWithChildren(domelementtype_1.ElementType.CDATA, children); + var clone_2 = new CDATA(children); children.forEach(function (child) { return (child.parent = clone_2); }); result = clone_2; } @@ -391,10 +454,13 @@ function cloneNode(node, recursive) { result = instruction; } else { - throw new Error("Not implemented yet: " + node.type); + throw new Error("Not implemented yet: ".concat(node.type)); } result.startIndex = node.startIndex; result.endIndex = node.endIndex; + if (node.sourceCodeLocation != null) { + result.sourceCodeLocation = node.sourceCodeLocation; + } return result; } exports.cloneNode = cloneNode; diff --git a/node_modules/domhandler/package.json b/node_modules/domhandler/package.json index 1cdbdf9..f80da8e 100644 --- a/node_modules/domhandler/package.json +++ b/node_modules/domhandler/package.json @@ -1,95 +1,73 @@ { - "_from": "domhandler@^4.2.0", - "_id": "domhandler@4.2.2", - "_inBundle": false, - "_integrity": "sha512-PzE9aBMsdZO8TK4BnuJwH0QT41wgMbRzuZrHUcpYncEjmQazq8QEaBWgLG7ZyC/DAZKEgglpIA6j4Qn/HmxS3w==", - "_location": "/domhandler", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "domhandler@^4.2.0", "name": "domhandler", - "escapedName": "domhandler", - "rawSpec": "^4.2.0", - "saveSpec": null, - "fetchSpec": "^4.2.0" - }, - "_requiredBy": [ - "/cheerio", - "/cheerio-select", - "/css-select", - "/dom-serializer", - "/domutils", - "/htmlparser2" - ], - "_resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.2.2.tgz", - "_shasum": "e825d721d19a86b8c201a35264e226c678ee755f", - "_spec": "domhandler@^4.2.0", - "_where": "/home/runner/work/public_library_map/public_library_map/node_modules/cheerio", - "author": { - "name": "Felix Boehm", - "email": "me@feedic.com" - }, - "bugs": { - "url": "https://github.com/fb55/domhandler/issues" - }, - "bundleDependencies": false, - "dependencies": { - "domelementtype": "^2.2.0" - }, - "deprecated": false, - "description": "Handler for htmlparser2 that turns pages into a dom", - "devDependencies": { - "@types/jest": "^27.0.1", - "@types/node": "^16.7.2", - "@typescript-eslint/eslint-plugin": "^4.29.3", - "@typescript-eslint/parser": "^4.29.3", - "eslint": "^7.32.0", - "eslint-config-prettier": "^8.1.0", - "htmlparser2": "^7.1.1", - "jest": "^27.1.0", - "prettier": "^2.0.5", - "ts-jest": "^27.0.5", - "typescript": "^4.4.2" - }, - "engines": { - "node": ">= 4" - }, - "files": [ - "lib" - ], - "funding": { - "url": "https://github.com/fb55/domhandler?sponsor=1" - }, - "homepage": "https://github.com/fb55/domhandler#readme", - "jest": { - "preset": "ts-jest", - "testEnvironment": "node" - }, - "keywords": [ - "dom", - "htmlparser2" - ], - "license": "BSD-2-Clause", - "main": "lib/index.js", - "name": "domhandler", - "prettier": { - "tabWidth": 4 - }, - "repository": { - "type": "git", - "url": "git://github.com/fb55/domhandler.git" - }, - "scripts": { - "build": "tsc", - "format": "prettier --write '**/*.{ts,md,json}'", - "lint": "eslint src", - "prepare": "npm run build", - "test": "npm run test:jest && npm run lint", - "test:jest": "jest" - }, - "sideEffects": false, - "types": "lib/index.d.ts", - "version": "4.2.2" + "version": "5.0.3", + "description": "Handler for htmlparser2 that turns pages into a dom", + "author": "Felix Boehm ", + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + }, + "license": "BSD-2-Clause", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "module": "lib/esm/index.js", + "exports": { + "require": "./lib/index.js", + "import": "./lib/esm/index.js" + }, + "sideEffects": false, + "files": [ + "lib" + ], + "scripts": { + "test": "npm run test:jest && npm run lint", + "test:jest": "jest", + "lint": "npm run lint:es && npm run lint:prettier", + "lint:es": "eslint --ignore-path .gitignore .", + "lint:prettier": "npm run prettier -- --check", + "format": "npm run format:es && npm run format:prettier", + "format:es": "npm run lint:es -- --fix", + "format:prettier": "npm run prettier -- --write", + "prettier": "prettier \"**/*.{ts,md,json,yml}\" --ignore-path .gitignore", + "build": "npm run build:cjs && npm run build:esm", + "build:cjs": "tsc", + "build:esm": "tsc --module esnext --target es2019 --outDir lib/esm && echo '{\"type\":\"module\"}' > lib/esm/package.json", + "prepare": "npm run build" + }, + "repository": { + "type": "git", + "url": "git://github.com/fb55/domhandler.git" + }, + "keywords": [ + "dom", + "htmlparser2" + ], + "engines": { + "node": ">= 4" + }, + "dependencies": { + "domelementtype": "^2.3.0" + }, + "devDependencies": { + "@types/jest": "^27.4.1", + "@types/node": "^17.0.30", + "@typescript-eslint/eslint-plugin": "^5.21.0", + "@typescript-eslint/parser": "^5.21.0", + "eslint": "^8.14.0", + "eslint-config-prettier": "^8.5.0", + "htmlparser2": "^8.0.0", + "jest": "^27.5.1", + "prettier": "^2.6.2", + "ts-jest": "^27.1.4", + "typescript": "^4.6.4" + }, + "jest": { + "preset": "ts-jest", + "testEnvironment": "node", + "moduleNameMapper": { + "^(.*)\\.js$": "$1" + } + }, + "prettier": { + "tabWidth": 4 + } } diff --git a/node_modules/domhandler/readme.md b/node_modules/domhandler/readme.md index 781eb38..82f6496 100644 --- a/node_modules/domhandler/readme.md +++ b/node_modules/domhandler/readme.md @@ -76,77 +76,6 @@ When the parser is used in a non-streaming fashion, `endIndex` is an integer indicating the position of the end of the node in the document. The default value is `false`. -## Option: `normalizeWhitespace` _(deprecated)_ - -Replace all whitespace with single spaces. -The default value is `false`. - -**Note:** Enabling this might break your markup. - -For the following examples, this HTML will be used: - -```html -
    this is the text
    -``` - -### Example: `normalizeWhitespace: true` - -```javascript -[ - { - type: "tag", - name: "font", - children: [ - { - data: " ", - type: "text", - }, - { - type: "tag", - name: "br", - }, - { - data: "this is the text ", - type: "text", - }, - { - type: "tag", - name: "font", - }, - ], - }, -]; -``` - -### Example: `normalizeWhitespace: false` - -```javascript -[ - { - type: "tag", - name: "font", - children: [ - { - data: "\n\t", - type: "text", - }, - { - type: "tag", - name: "br", - }, - { - data: "this is the text\n", - type: "text", - }, - { - type: "tag", - name: "font", - }, - ], - }, -]; -``` - --- License: BSD-2-Clause diff --git a/node_modules/domutils/lib/feeds.d.ts b/node_modules/domutils/lib/feeds.d.ts index bc71c10..5ba60c7 100644 --- a/node_modules/domutils/lib/feeds.d.ts +++ b/node_modules/domutils/lib/feeds.d.ts @@ -1,6 +1,21 @@ -import type { Node } from "domhandler"; +import type { AnyNode } from "domhandler"; +/** + * The type of a media item. + * + * @category Feeds + */ export declare type FeedItemMediaMedium = "image" | "audio" | "video" | "document" | "executable"; +/** + * The type of a media item. + * + * @category Feeds + */ export declare type FeedItemMediaExpression = "sample" | "full" | "nonstop"; +/** + * A media item of a feed entry. + * + * @category Feeds + */ export interface FeedItemMedia { medium: FeedItemMediaMedium | undefined; isDefault: boolean; @@ -17,6 +32,11 @@ export interface FeedItemMedia { width?: number; lang?: string; } +/** + * An entry of a feed. + * + * @category Feeds + */ export interface FeedItem { id?: string; title?: string; @@ -25,6 +45,11 @@ export interface FeedItem { pubDate?: Date; media: FeedItemMedia[]; } +/** + * The root of a feed. + * + * @category Feeds + */ export interface Feed { type: string; id?: string; @@ -38,8 +63,9 @@ export interface Feed { /** * Get the feed object from the root of a DOM tree. * + * @category Feeds * @param doc - The DOM to to extract the feed from. * @returns The feed. */ -export declare function getFeed(doc: Node[]): Feed | null; +export declare function getFeed(doc: AnyNode[]): Feed | null; //# sourceMappingURL=feeds.d.ts.map \ No newline at end of file diff --git a/node_modules/domutils/lib/feeds.d.ts.map b/node_modules/domutils/lib/feeds.d.ts.map index a3e1d1f..7228bc1 100644 --- a/node_modules/domutils/lib/feeds.d.ts.map +++ b/node_modules/domutils/lib/feeds.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"feeds.d.ts","sourceRoot":"","sources":["../src/feeds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,YAAY,CAAC;AAIhD,oBAAY,mBAAmB,GACzB,OAAO,GACP,OAAO,GACP,OAAO,GACP,UAAU,GACV,YAAY,CAAC;AAEnB,oBAAY,uBAAuB,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAEpE,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,mBAAmB,GAAG,SAAS,CAAC;IACxC,SAAS,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,uBAAuB,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,KAAK,EAAE,aAAa,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,IAAI;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,QAAQ,EAAE,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,GAAG,IAAI,CAQhD"} \ No newline at end of file +{"version":3,"file":"feeds.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706/src/","sources":["feeds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAW,MAAM,YAAY,CAAC;AAInD;;;;GAIG;AACH,oBAAY,mBAAmB,GACzB,OAAO,GACP,OAAO,GACP,OAAO,GACP,UAAU,GACV,YAAY,CAAC;AAEnB;;;;GAIG;AACH,oBAAY,uBAAuB,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAEpE;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,mBAAmB,GAAG,SAAS,CAAC;IACxC,SAAS,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,uBAAuB,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,KAAK,EAAE,aAAa,EAAE,CAAC;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,IAAI;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,QAAQ,EAAE,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI,GAAG,IAAI,CAQnD"} \ No newline at end of file diff --git a/node_modules/domutils/lib/feeds.js b/node_modules/domutils/lib/feeds.js index 7e5775a..b68d5b4 100644 --- a/node_modules/domutils/lib/feeds.js +++ b/node_modules/domutils/lib/feeds.js @@ -1,11 +1,12 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getFeed = void 0; -var stringify_1 = require("./stringify"); -var legacy_1 = require("./legacy"); +var stringify_js_1 = require("./stringify.js"); +var legacy_js_1 = require("./legacy.js"); /** * Get the feed object from the root of a DOM tree. * + * @category Feeds * @param doc - The DOM to to extract the feed from. * @returns The feed. */ @@ -29,13 +30,13 @@ function getAtomFeed(feedRoot) { var childs = feedRoot.children; var feed = { type: "atom", - items: (0, legacy_1.getElementsByTagName)("entry", childs).map(function (item) { + items: (0, legacy_js_1.getElementsByTagName)("entry", childs).map(function (item) { var _a; var children = item.children; var entry = { media: getMediaElements(children) }; addConditionally(entry, "id", "id", children); addConditionally(entry, "title", "title", children); - var href = (_a = getOneElement("link", children)) === null || _a === void 0 ? void 0 : _a.attribs.href; + var href = (_a = getOneElement("link", children)) === null || _a === void 0 ? void 0 : _a.attribs["href"]; if (href) { entry.link = href; } @@ -52,7 +53,7 @@ function getAtomFeed(feedRoot) { }; addConditionally(feed, "id", "id", childs); addConditionally(feed, "title", "title", childs); - var href = (_a = getOneElement("link", childs)) === null || _a === void 0 ? void 0 : _a.attribs.href; + var href = (_a = getOneElement("link", childs)) === null || _a === void 0 ? void 0 : _a.attribs["href"]; if (href) { feed.link = href; } @@ -76,7 +77,7 @@ function getRssFeed(feedRoot) { var feed = { type: feedRoot.name.substr(0, 3), id: "", - items: (0, legacy_1.getElementsByTagName)("item", feedRoot.children).map(function (item) { + items: (0, legacy_js_1.getElementsByTagName)("item", feedRoot.children).map(function (item) { var children = item.children; var entry = { media: getMediaElements(children) }; addConditionally(entry, "id", "guid", children); @@ -117,11 +118,11 @@ var MEDIA_KEYS_INT = [ * @returns Media elements. */ function getMediaElements(where) { - return (0, legacy_1.getElementsByTagName)("media:content", where).map(function (elem) { + return (0, legacy_js_1.getElementsByTagName)("media:content", where).map(function (elem) { var attribs = elem.attribs; var media = { - medium: attribs.medium, - isDefault: !!attribs.isDefault, + medium: attribs["medium"], + isDefault: !!attribs["isDefault"], }; for (var _i = 0, MEDIA_KEYS_STRING_1 = MEDIA_KEYS_STRING; _i < MEDIA_KEYS_STRING_1.length; _i++) { var attrib = MEDIA_KEYS_STRING_1[_i]; @@ -135,9 +136,8 @@ function getMediaElements(where) { media[attrib] = parseInt(attribs[attrib], 10); } } - if (attribs.expression) { - media.expression = - attribs.expression; + if (attribs["expression"]) { + media.expression = attribs["expression"]; } return media; }); @@ -150,19 +150,19 @@ function getMediaElements(where) { * @returns The element or null */ function getOneElement(tagName, node) { - return (0, legacy_1.getElementsByTagName)(tagName, node, true, 1)[0]; + return (0, legacy_js_1.getElementsByTagName)(tagName, node, true, 1)[0]; } /** * Get the text content of an element with a certain tag name. * * @param tagName Tag name to look for. - * @param where Node to search in. + * @param where Node to search in. * @param recurse Whether to recurse into child nodes. * @returns The text content of the element. */ function fetch(tagName, where, recurse) { if (recurse === void 0) { recurse = false; } - return (0, stringify_1.textContent)((0, legacy_1.getElementsByTagName)(tagName, where, recurse, 1)).trim(); + return (0, stringify_js_1.textContent)((0, legacy_js_1.getElementsByTagName)(tagName, where, recurse, 1)).trim(); } /** * Adds a property to an object if it has a value. @@ -188,3 +188,4 @@ function addConditionally(obj, prop, tagName, where, recurse) { function isValidFeed(value) { return value === "rss" || value === "feed" || value === "rdf:RDF"; } +//# sourceMappingURL=feeds.js.map \ No newline at end of file diff --git a/node_modules/domutils/lib/helpers.d.ts b/node_modules/domutils/lib/helpers.d.ts index 61b282f..bf40d6b 100644 --- a/node_modules/domutils/lib/helpers.d.ts +++ b/node_modules/domutils/lib/helpers.d.ts @@ -1,11 +1,16 @@ -import { Node } from "domhandler"; +import { AnyNode } from "domhandler"; /** * Given an array of nodes, remove any member that is contained by another. * + * @category Helpers * @param nodes Nodes to filter. * @returns Remaining nodes that aren't subtrees of each other. */ -export declare function removeSubsets(nodes: Node[]): Node[]; +export declare function removeSubsets(nodes: AnyNode[]): AnyNode[]; +/** + * @category Helpers + * @see {@link http://dom.spec.whatwg.org/#dom-node-comparedocumentposition} + */ export declare const enum DocumentPosition { DISCONNECTED = 1, PRECEDING = 2, @@ -15,7 +20,7 @@ export declare const enum DocumentPosition { } /** * Compare the position of one node against another node in any other document. - * The return value is a bitmask with the following values: + * The return value is a bitmask with the values from {@link DocumentPosition}. * * Document order: * > There is an ordering, document order, defined on all the nodes in the @@ -26,11 +31,12 @@ export declare const enum DocumentPosition { * > Thus, document order orders element nodes in order of the occurrence of * > their start-tag in the XML (after expansion of entities). The attribute * > nodes of an element occur after the element and before its children. The - * > relative order of attribute nodes is implementation-dependent./ + * > relative order of attribute nodes is implementation-dependent. * * Source: * http://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-document-order * + * @category Helpers * @param nodeA The first node to use in the comparison * @param nodeB The second node to use in the comparison * @returns A bitmask describing the input nodes' relative position. @@ -38,14 +44,15 @@ export declare const enum DocumentPosition { * See http://dom.spec.whatwg.org/#dom-node-comparedocumentposition for * a description of these values. */ -export declare function compareDocumentPosition(nodeA: Node, nodeB: Node): number; +export declare function compareDocumentPosition(nodeA: AnyNode, nodeB: AnyNode): number; /** * Sort an array of nodes based on their relative position in the document and - * remove any duplicate nodes. If the array contains nodes that do not belong - * to the same document, sort order is unspecified. + * remove any duplicate nodes. If the array contains nodes that do not belong to + * the same document, sort order is unspecified. * + * @category Helpers * @param nodes Array of DOM nodes. * @returns Collection of unique nodes, sorted in document order. */ -export declare function uniqueSort(nodes: T[]): T[]; +export declare function uniqueSort(nodes: T[]): T[]; //# sourceMappingURL=helpers.d.ts.map \ No newline at end of file diff --git a/node_modules/domutils/lib/helpers.d.ts.map b/node_modules/domutils/lib/helpers.d.ts.map index 3c0b410..4e0be2d 100644 --- a/node_modules/domutils/lib/helpers.d.ts.map +++ b/node_modules/domutils/lib/helpers.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,CA6BnD;AAGD,0BAAkB,gBAAgB;IAC9B,YAAY,IAAI;IAChB,SAAS,IAAI;IACb,SAAS,IAAI;IACb,QAAQ,IAAI;IACZ,YAAY,KAAK;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,MAAM,CA4CxE;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAc1D"} \ No newline at end of file +{"version":3,"file":"helpers.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706/src/","sources":["helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,OAAO,EAAc,MAAM,YAAY,CAAC;AAE9D;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CA6BzD;AACD;;;GAGG;AACH,0BAAkB,gBAAgB;IAC9B,YAAY,IAAI;IAChB,SAAS,IAAI;IACb,SAAS,IAAI;IACb,QAAQ,IAAI;IACZ,YAAY,KAAK;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,uBAAuB,CACnC,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,OAAO,GACf,MAAM,CA4CR;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAc7D"} \ No newline at end of file diff --git a/node_modules/domutils/lib/helpers.js b/node_modules/domutils/lib/helpers.js index e823a92..31bd4ac 100644 --- a/node_modules/domutils/lib/helpers.js +++ b/node_modules/domutils/lib/helpers.js @@ -1,10 +1,11 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.uniqueSort = exports.compareDocumentPosition = exports.removeSubsets = void 0; +exports.uniqueSort = exports.compareDocumentPosition = exports.DocumentPosition = exports.removeSubsets = void 0; var domhandler_1 = require("domhandler"); /** * Given an array of nodes, remove any member that is contained by another. * + * @category Helpers * @param nodes Nodes to filter. * @returns Remaining nodes that aren't subtrees of each other. */ @@ -35,9 +36,21 @@ function removeSubsets(nodes) { return nodes; } exports.removeSubsets = removeSubsets; +/** + * @category Helpers + * @see {@link http://dom.spec.whatwg.org/#dom-node-comparedocumentposition} + */ +var DocumentPosition; +(function (DocumentPosition) { + DocumentPosition[DocumentPosition["DISCONNECTED"] = 1] = "DISCONNECTED"; + DocumentPosition[DocumentPosition["PRECEDING"] = 2] = "PRECEDING"; + DocumentPosition[DocumentPosition["FOLLOWING"] = 4] = "FOLLOWING"; + DocumentPosition[DocumentPosition["CONTAINS"] = 8] = "CONTAINS"; + DocumentPosition[DocumentPosition["CONTAINED_BY"] = 16] = "CONTAINED_BY"; +})(DocumentPosition = exports.DocumentPosition || (exports.DocumentPosition = {})); /** * Compare the position of one node against another node in any other document. - * The return value is a bitmask with the following values: + * The return value is a bitmask with the values from {@link DocumentPosition}. * * Document order: * > There is an ordering, document order, defined on all the nodes in the @@ -48,11 +61,12 @@ exports.removeSubsets = removeSubsets; * > Thus, document order orders element nodes in order of the occurrence of * > their start-tag in the XML (after expansion of entities). The attribute * > nodes of an element occur after the element and before its children. The - * > relative order of attribute nodes is implementation-dependent./ + * > relative order of attribute nodes is implementation-dependent. * * Source: * http://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-document-order * + * @category Helpers * @param nodeA The first node to use in the comparison * @param nodeB The second node to use in the comparison * @returns A bitmask describing the input nodes' relative position. @@ -82,7 +96,7 @@ function compareDocumentPosition(nodeA, nodeB) { idx++; } if (idx === 0) { - return 1 /* DISCONNECTED */; + return DocumentPosition.DISCONNECTED; } var sharedParent = aParents[idx - 1]; var siblings = sharedParent.children; @@ -90,21 +104,22 @@ function compareDocumentPosition(nodeA, nodeB) { var bSibling = bParents[idx]; if (siblings.indexOf(aSibling) > siblings.indexOf(bSibling)) { if (sharedParent === nodeB) { - return 4 /* FOLLOWING */ | 16 /* CONTAINED_BY */; + return DocumentPosition.FOLLOWING | DocumentPosition.CONTAINED_BY; } - return 4 /* FOLLOWING */; + return DocumentPosition.FOLLOWING; } if (sharedParent === nodeA) { - return 2 /* PRECEDING */ | 8 /* CONTAINS */; + return DocumentPosition.PRECEDING | DocumentPosition.CONTAINS; } - return 2 /* PRECEDING */; + return DocumentPosition.PRECEDING; } exports.compareDocumentPosition = compareDocumentPosition; /** * Sort an array of nodes based on their relative position in the document and - * remove any duplicate nodes. If the array contains nodes that do not belong - * to the same document, sort order is unspecified. + * remove any duplicate nodes. If the array contains nodes that do not belong to + * the same document, sort order is unspecified. * + * @category Helpers * @param nodes Array of DOM nodes. * @returns Collection of unique nodes, sorted in document order. */ @@ -112,10 +127,10 @@ function uniqueSort(nodes) { nodes = nodes.filter(function (node, i, arr) { return !arr.includes(node, i + 1); }); nodes.sort(function (a, b) { var relative = compareDocumentPosition(a, b); - if (relative & 2 /* PRECEDING */) { + if (relative & DocumentPosition.PRECEDING) { return -1; } - else if (relative & 4 /* FOLLOWING */) { + else if (relative & DocumentPosition.FOLLOWING) { return 1; } return 0; @@ -123,3 +138,4 @@ function uniqueSort(nodes) { return nodes; } exports.uniqueSort = uniqueSort; +//# sourceMappingURL=helpers.js.map \ No newline at end of file diff --git a/node_modules/domutils/lib/index.d.ts b/node_modules/domutils/lib/index.d.ts index 33b282d..41ab6e8 100644 --- a/node_modules/domutils/lib/index.d.ts +++ b/node_modules/domutils/lib/index.d.ts @@ -1,10 +1,10 @@ -export * from "./stringify"; -export * from "./traversal"; -export * from "./manipulation"; -export * from "./querying"; -export * from "./legacy"; -export * from "./helpers"; -export * from "./feeds"; +export * from "./stringify.js"; +export * from "./traversal.js"; +export * from "./manipulation.js"; +export * from "./querying.js"; +export * from "./legacy.js"; +export * from "./helpers.js"; +export * from "./feeds.js"; /** @deprecated Use these methods from `domhandler` directly. */ export { isTag, isCDATA, isText, isComment, isDocument, hasChildren, } from "domhandler"; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/domutils/lib/index.d.ts.map b/node_modules/domutils/lib/index.d.ts.map index 4c113d1..1397a26 100644 --- a/node_modules/domutils/lib/index.d.ts.map +++ b/node_modules/domutils/lib/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,gEAAgE;AAChE,OAAO,EACH,KAAK,EACL,OAAO,EACP,MAAM,EACN,SAAS,EACT,UAAU,EACV,WAAW,GACd,MAAM,YAAY,CAAC"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706/src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,gEAAgE;AAChE,OAAO,EACH,KAAK,EACL,OAAO,EACP,MAAM,EACN,SAAS,EACT,UAAU,EACV,WAAW,GACd,MAAM,YAAY,CAAC"} \ No newline at end of file diff --git a/node_modules/domutils/lib/index.js b/node_modules/domutils/lib/index.js index 029aa09..1eb8e26 100644 --- a/node_modules/domutils/lib/index.js +++ b/node_modules/domutils/lib/index.js @@ -1,7 +1,11 @@ "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; @@ -11,13 +15,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) { }; Object.defineProperty(exports, "__esModule", { value: true }); exports.hasChildren = exports.isDocument = exports.isComment = exports.isText = exports.isCDATA = exports.isTag = void 0; -__exportStar(require("./stringify"), exports); -__exportStar(require("./traversal"), exports); -__exportStar(require("./manipulation"), exports); -__exportStar(require("./querying"), exports); -__exportStar(require("./legacy"), exports); -__exportStar(require("./helpers"), exports); -__exportStar(require("./feeds"), exports); +__exportStar(require("./stringify.js"), exports); +__exportStar(require("./traversal.js"), exports); +__exportStar(require("./manipulation.js"), exports); +__exportStar(require("./querying.js"), exports); +__exportStar(require("./legacy.js"), exports); +__exportStar(require("./helpers.js"), exports); +__exportStar(require("./feeds.js"), exports); /** @deprecated Use these methods from `domhandler` directly. */ var domhandler_1 = require("domhandler"); Object.defineProperty(exports, "isTag", { enumerable: true, get: function () { return domhandler_1.isTag; } }); @@ -26,3 +30,4 @@ Object.defineProperty(exports, "isText", { enumerable: true, get: function () { Object.defineProperty(exports, "isComment", { enumerable: true, get: function () { return domhandler_1.isComment; } }); Object.defineProperty(exports, "isDocument", { enumerable: true, get: function () { return domhandler_1.isDocument; } }); Object.defineProperty(exports, "hasChildren", { enumerable: true, get: function () { return domhandler_1.hasChildren; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/domutils/lib/legacy.d.ts b/node_modules/domutils/lib/legacy.d.ts index 7190d7c..e79592b 100644 --- a/node_modules/domutils/lib/legacy.d.ts +++ b/node_modules/domutils/lib/legacy.d.ts @@ -1,47 +1,58 @@ -import { Node, Element } from "domhandler"; -import { ElementType } from "domelementtype"; -interface TestElementOpts { +import { AnyNode, Element } from "domhandler"; +import type { ElementType } from "domelementtype"; +/** + * An object with keys to check elements against. If a key is `tag_name`, + * `tag_type` or `tag_contains`, it will check the value against that specific + * value. Otherwise, it will check an attribute with the key's name. + * + * @category Legacy Query Functions + */ +export interface TestElementOpts { tag_name?: string | ((name: string) => boolean); tag_type?: string | ((name: string) => boolean); tag_contains?: string | ((data?: string) => boolean); [attributeName: string]: undefined | string | ((attributeValue: string) => boolean); } /** + * @category Legacy Query Functions * @param options An object describing nodes to look for. * @param node The element to test. * @returns Whether the element matches the description in `options`. */ -export declare function testElement(options: TestElementOpts, node: Node): boolean; +export declare function testElement(options: TestElementOpts, node: AnyNode): boolean; /** + * @category Legacy Query Functions * @param options An object describing nodes to look for. * @param nodes Nodes to search through. * @param recurse Also consider child nodes. * @param limit Maximum number of nodes to return. * @returns All nodes that match `options`. */ -export declare function getElements(options: TestElementOpts, nodes: Node | Node[], recurse: boolean, limit?: number): Node[]; +export declare function getElements(options: TestElementOpts, nodes: AnyNode | AnyNode[], recurse: boolean, limit?: number): AnyNode[]; /** + * @category Legacy Query Functions * @param id The unique ID attribute value to look for. * @param nodes Nodes to search through. * @param recurse Also consider child nodes. * @returns The node with the supplied ID. */ -export declare function getElementById(id: string | ((id: string) => boolean), nodes: Node | Node[], recurse?: boolean): Element | null; +export declare function getElementById(id: string | ((id: string) => boolean), nodes: AnyNode | AnyNode[], recurse?: boolean): Element | null; /** + * @category Legacy Query Functions * @param tagName Tag name to search for. * @param nodes Nodes to search through. * @param recurse Also consider child nodes. * @param limit Maximum number of nodes to return. * @returns All nodes with the supplied `tagName`. */ -export declare function getElementsByTagName(tagName: string | ((name: string) => boolean), nodes: Node | Node[], recurse?: boolean, limit?: number): Element[]; +export declare function getElementsByTagName(tagName: string | ((name: string) => boolean), nodes: AnyNode | AnyNode[], recurse?: boolean, limit?: number): Element[]; /** + * @category Legacy Query Functions * @param type Element type to look for. * @param nodes Nodes to search through. * @param recurse Also consider child nodes. * @param limit Maximum number of nodes to return. * @returns All nodes with the supplied `type`. */ -export declare function getElementsByTagType(type: ElementType | ((type: ElementType) => boolean), nodes: Node | Node[], recurse?: boolean, limit?: number): Node[]; -export {}; +export declare function getElementsByTagType(type: ElementType | ((type: ElementType) => boolean), nodes: AnyNode | AnyNode[], recurse?: boolean, limit?: number): AnyNode[]; //# sourceMappingURL=legacy.d.ts.map \ No newline at end of file diff --git a/node_modules/domutils/lib/legacy.d.ts.map b/node_modules/domutils/lib/legacy.d.ts.map index f6f7217..1c17c8b 100644 --- a/node_modules/domutils/lib/legacy.d.ts.map +++ b/node_modules/domutils/lib/legacy.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"legacy.d.ts","sourceRoot":"","sources":["../src/legacy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,IAAI,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAK7C,UAAU,eAAe;IACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;IAChD,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;IAChD,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;IACrD,CAAC,aAAa,EAAE,MAAM,GAChB,SAAS,GACT,MAAM,GACN,CAAC,CAAC,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;CAC/C;AAqED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAGzE;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACvB,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,IAAI,GAAG,IAAI,EAAE,EACpB,OAAO,EAAE,OAAO,EAChB,KAAK,SAAW,GACjB,IAAI,EAAE,CAGR;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC1B,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,EACtC,KAAK,EAAE,IAAI,GAAG,IAAI,EAAE,EACpB,OAAO,UAAO,GACf,OAAO,GAAG,IAAI,CAGhB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAChC,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,EAC7C,KAAK,EAAE,IAAI,GAAG,IAAI,EAAE,EACpB,OAAO,UAAO,EACd,KAAK,SAAW,GACjB,OAAO,EAAE,CAEX;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAChC,IAAI,EAAE,WAAW,GAAG,CAAC,CAAC,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,EACpD,KAAK,EAAE,IAAI,GAAG,IAAI,EAAE,EACpB,OAAO,UAAO,EACd,KAAK,SAAW,GACjB,IAAI,EAAE,CAER"} \ No newline at end of file +{"version":3,"file":"legacy.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706/src/","sources":["legacy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAKlD;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC5B,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;IAChD,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;IAChD,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;IACrD,CAAC,aAAa,EAAE,MAAM,GAChB,SAAS,GACT,MAAM,GACN,CAAC,CAAC,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;CAC/C;AAsED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAG5E;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACvB,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,OAAO,GAAG,OAAO,EAAE,EAC1B,OAAO,EAAE,OAAO,EAChB,KAAK,SAAW,GACjB,OAAO,EAAE,CAGX;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC1B,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,EACtC,KAAK,EAAE,OAAO,GAAG,OAAO,EAAE,EAC1B,OAAO,UAAO,GACf,OAAO,GAAG,IAAI,CAGhB;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAChC,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,EAC7C,KAAK,EAAE,OAAO,GAAG,OAAO,EAAE,EAC1B,OAAO,UAAO,EACd,KAAK,SAAW,GACjB,OAAO,EAAE,CAOX;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAChC,IAAI,EAAE,WAAW,GAAG,CAAC,CAAC,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,EACpD,KAAK,EAAE,OAAO,GAAG,OAAO,EAAE,EAC1B,OAAO,UAAO,EACd,KAAK,SAAW,GACjB,OAAO,EAAE,CAEX"} \ No newline at end of file diff --git a/node_modules/domutils/lib/legacy.js b/node_modules/domutils/lib/legacy.js index 478564c..fe482c1 100644 --- a/node_modules/domutils/lib/legacy.js +++ b/node_modules/domutils/lib/legacy.js @@ -2,7 +2,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.getElementsByTagType = exports.getElementsByTagName = exports.getElementById = exports.getElements = exports.testElement = void 0; var domhandler_1 = require("domhandler"); -var querying_1 = require("./querying"); +var querying_js_1 = require("./querying.js"); var Checks = { tag_name: function (name) { if (typeof name === "function") { @@ -29,7 +29,8 @@ var Checks = { /** * @param attrib Attribute to check. * @param value Attribute value to look for. - * @returns A function to check whether the a node has an attribute with a particular value. + * @returns A function to check whether the a node has an attribute with a + * particular value. */ function getAttribCheck(attrib, value) { if (typeof value === "function") { @@ -40,16 +41,16 @@ function getAttribCheck(attrib, value) { /** * @param a First function to combine. * @param b Second function to combine. - * @returns A function taking a node and returning `true` if either - * of the input functions returns `true` for the node. + * @returns A function taking a node and returning `true` if either of the input + * functions returns `true` for the node. */ function combineFuncs(a, b) { return function (elem) { return a(elem) || b(elem); }; } /** * @param options An object describing nodes to look for. - * @returns A function executing all checks in `options` and returning `true` - * if any of them match a node. + * @returns A function executing all checks in `options` and returning `true` if + * any of them match a node. */ function compileTest(options) { var funcs = Object.keys(options).map(function (key) { @@ -61,6 +62,7 @@ function compileTest(options) { return funcs.length === 0 ? null : funcs.reduce(combineFuncs); } /** + * @category Legacy Query Functions * @param options An object describing nodes to look for. * @param node The element to test. * @returns Whether the element matches the description in `options`. @@ -71,6 +73,7 @@ function testElement(options, node) { } exports.testElement = testElement; /** + * @category Legacy Query Functions * @param options An object describing nodes to look for. * @param nodes Nodes to search through. * @param recurse Also consider child nodes. @@ -80,10 +83,11 @@ exports.testElement = testElement; function getElements(options, nodes, recurse, limit) { if (limit === void 0) { limit = Infinity; } var test = compileTest(options); - return test ? (0, querying_1.filter)(test, nodes, recurse, limit) : []; + return test ? (0, querying_js_1.filter)(test, nodes, recurse, limit) : []; } exports.getElements = getElements; /** + * @category Legacy Query Functions * @param id The unique ID attribute value to look for. * @param nodes Nodes to search through. * @param recurse Also consider child nodes. @@ -93,10 +97,11 @@ function getElementById(id, nodes, recurse) { if (recurse === void 0) { recurse = true; } if (!Array.isArray(nodes)) nodes = [nodes]; - return (0, querying_1.findOne)(getAttribCheck("id", id), nodes, recurse); + return (0, querying_js_1.findOne)(getAttribCheck("id", id), nodes, recurse); } exports.getElementById = getElementById; /** + * @category Legacy Query Functions * @param tagName Tag name to search for. * @param nodes Nodes to search through. * @param recurse Also consider child nodes. @@ -106,10 +111,11 @@ exports.getElementById = getElementById; function getElementsByTagName(tagName, nodes, recurse, limit) { if (recurse === void 0) { recurse = true; } if (limit === void 0) { limit = Infinity; } - return (0, querying_1.filter)(Checks.tag_name(tagName), nodes, recurse, limit); + return (0, querying_js_1.filter)(Checks["tag_name"](tagName), nodes, recurse, limit); } exports.getElementsByTagName = getElementsByTagName; /** + * @category Legacy Query Functions * @param type Element type to look for. * @param nodes Nodes to search through. * @param recurse Also consider child nodes. @@ -119,6 +125,7 @@ exports.getElementsByTagName = getElementsByTagName; function getElementsByTagType(type, nodes, recurse, limit) { if (recurse === void 0) { recurse = true; } if (limit === void 0) { limit = Infinity; } - return (0, querying_1.filter)(Checks.tag_type(type), nodes, recurse, limit); + return (0, querying_js_1.filter)(Checks["tag_type"](type), nodes, recurse, limit); } exports.getElementsByTagType = getElementsByTagType; +//# sourceMappingURL=legacy.js.map \ No newline at end of file diff --git a/node_modules/domutils/lib/manipulation.d.ts b/node_modules/domutils/lib/manipulation.d.ts index 0950619..89763f1 100644 --- a/node_modules/domutils/lib/manipulation.d.ts +++ b/node_modules/domutils/lib/manipulation.d.ts @@ -1,43 +1,49 @@ -import type { Node, Element } from "domhandler"; +import type { ChildNode, Element } from "domhandler"; /** * Remove an element from the dom * + * @category Manipulation * @param elem The element to be removed */ -export declare function removeElement(elem: Node): void; +export declare function removeElement(elem: ChildNode): void; /** * Replace an element in the dom * + * @category Manipulation * @param elem The element to be replaced * @param replacement The element to be added */ -export declare function replaceElement(elem: Node, replacement: Node): void; +export declare function replaceElement(elem: ChildNode, replacement: ChildNode): void; /** * Append a child to an element. * + * @category Manipulation * @param elem The element to append to. * @param child The element to be added as a child. */ -export declare function appendChild(elem: Element, child: Node): void; +export declare function appendChild(elem: Element, child: ChildNode): void; /** * Append an element after another. * + * @category Manipulation * @param elem The element to append after. * @param next The element be added. */ -export declare function append(elem: Node, next: Node): void; +export declare function append(elem: ChildNode, next: ChildNode): void; /** * Prepend a child to an element. * + * @category Manipulation * @param elem The element to prepend before. * @param child The element to be added as a child. */ -export declare function prependChild(elem: Element, child: Node): void; +export declare function prependChild(elem: Element, child: ChildNode): void; /** * Prepend an element before another. * + * @category Manipulation * @param elem The element to prepend before. * @param prev The element be added. */ -export declare function prepend(elem: Node, prev: Node): void; +export declare function prepend(elem: ChildNode, prev: ChildNode): void; //# sourceMappingURL=manipulation.d.ts.map \ No newline at end of file diff --git a/node_modules/domutils/lib/manipulation.d.ts.map b/node_modules/domutils/lib/manipulation.d.ts.map index a302120..dcb4848 100644 --- a/node_modules/domutils/lib/manipulation.d.ts.map +++ b/node_modules/domutils/lib/manipulation.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"manipulation.d.ts","sourceRoot":"","sources":["../src/manipulation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAQ9C;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,GAAG,IAAI,CAgBlE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,GAAG,IAAI,CAa5D;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAoBnD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,GAAG,IAAI,CAa7D;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAiBpD"} \ No newline at end of file +{"version":3,"file":"manipulation.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706/src/","sources":["manipulation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAQnD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,GAAG,IAAI,CAiB5E;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,CAajE;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,CAoB7D;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,CAalE;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,CAiB9D"} \ No newline at end of file diff --git a/node_modules/domutils/lib/manipulation.js b/node_modules/domutils/lib/manipulation.js index f7c77ef..31c5cc0 100644 --- a/node_modules/domutils/lib/manipulation.js +++ b/node_modules/domutils/lib/manipulation.js @@ -4,6 +4,7 @@ exports.prepend = exports.prependChild = exports.append = exports.appendChild = /** * Remove an element from the dom * + * @category Manipulation * @param elem The element to be removed */ function removeElement(elem) { @@ -20,6 +21,7 @@ exports.removeElement = removeElement; /** * Replace an element in the dom * + * @category Manipulation * @param elem The element to be replaced * @param replacement The element to be added */ @@ -36,12 +38,14 @@ function replaceElement(elem, replacement) { if (parent) { var childs = parent.children; childs[childs.lastIndexOf(elem)] = replacement; + elem.parent = null; } } exports.replaceElement = replaceElement; /** * Append a child to an element. * + * @category Manipulation * @param elem The element to append to. * @param child The element to be added as a child. */ @@ -62,6 +66,7 @@ exports.appendChild = appendChild; /** * Append an element after another. * + * @category Manipulation * @param elem The element to append after. * @param next The element be added. */ @@ -88,6 +93,7 @@ exports.append = append; /** * Prepend a child to an element. * + * @category Manipulation * @param elem The element to prepend before. * @param child The element to be added as a child. */ @@ -108,6 +114,7 @@ exports.prependChild = prependChild; /** * Prepend an element before another. * + * @category Manipulation * @param elem The element to prepend before. * @param prev The element be added. */ @@ -127,3 +134,4 @@ function prepend(elem, prev) { elem.prev = prev; } exports.prepend = prepend; +//# sourceMappingURL=manipulation.js.map \ No newline at end of file diff --git a/node_modules/domutils/lib/querying.d.ts b/node_modules/domutils/lib/querying.d.ts index e3dc7aa..3e2296a 100644 --- a/node_modules/domutils/lib/querying.d.ts +++ b/node_modules/domutils/lib/querying.d.ts @@ -1,55 +1,62 @@ -import { Node, Element } from "domhandler"; +import { Element, AnyNode } from "domhandler"; /** * Search a node and its children for nodes passing a test function. * + * @category Querying * @param test Function to test nodes on. * @param node Node to search. Will be included in the result set if it matches. * @param recurse Also consider child nodes. * @param limit Maximum number of nodes to return. * @returns All nodes passing `test`. */ -export declare function filter(test: (elem: Node) => boolean, node: Node | Node[], recurse?: boolean, limit?: number): Node[]; +export declare function filter(test: (elem: AnyNode) => boolean, node: AnyNode | AnyNode[], recurse?: boolean, limit?: number): AnyNode[]; /** * Search an array of node and its children for nodes passing a test function. * + * @category Querying * @param test Function to test nodes on. * @param nodes Array of nodes to search. * @param recurse Also consider child nodes. * @param limit Maximum number of nodes to return. * @returns All nodes passing `test`. */ -export declare function find(test: (elem: Node) => boolean, nodes: Node[], recurse: boolean, limit: number): Node[]; +export declare function find(test: (elem: AnyNode) => boolean, nodes: AnyNode[], recurse: boolean, limit: number): AnyNode[]; /** * Finds the first element inside of an array that matches a test function. * + * @category Querying * @param test Function to test nodes on. * @param nodes Array of nodes to search. * @returns The first node in the array that passes `test`. + * @deprecated Use `Array.prototype.find` directly. */ -export declare function findOneChild(test: (elem: Node) => boolean, nodes: Node[]): Node | undefined; +export declare function findOneChild(test: (elem: T) => boolean, nodes: T[]): T | undefined; /** * Finds one element in a tree that passes a test. * + * @category Querying * @param test Function to test nodes on. * @param nodes Array of nodes to search. * @param recurse Also consider child nodes. * @returns The first child node that passes `test`. */ -export declare function findOne(test: (elem: Element) => boolean, nodes: Node[], recurse?: boolean): Element | null; +export declare function findOne(test: (elem: Element) => boolean, nodes: AnyNode[], recurse?: boolean): Element | null; /** + * @category Querying * @param test Function to test nodes on. * @param nodes Array of nodes to search. - * @returns Whether a tree of nodes contains at least one node passing a test. + * @returns Whether a tree of nodes contains at least one node passing the test. */ -export declare function existsOne(test: (elem: Element) => boolean, nodes: Node[]): boolean; +export declare function existsOne(test: (elem: Element) => boolean, nodes: AnyNode[]): boolean; /** - * Search and array of nodes and its children for nodes passing a test function. + * Search and array of nodes and its children for elements passing a test function. * - * Same as `find`, only with less options, leading to reduced complexity. + * Same as `find`, but limited to elements and with less options, leading to reduced complexity. * + * @category Querying * @param test Function to test nodes on. * @param nodes Array of nodes to search. * @returns All nodes passing `test`. */ -export declare function findAll(test: (elem: Element) => boolean, nodes: Node[]): Element[]; +export declare function findAll(test: (elem: Element) => boolean, nodes: AnyNode[]): Element[]; //# sourceMappingURL=querying.d.ts.map \ No newline at end of file diff --git a/node_modules/domutils/lib/querying.d.ts.map b/node_modules/domutils/lib/querying.d.ts.map index 983fd51..8b9da87 100644 --- a/node_modules/domutils/lib/querying.d.ts.map +++ b/node_modules/domutils/lib/querying.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"querying.d.ts","sourceRoot":"","sources":["../src/querying.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,IAAI,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE/D;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAClB,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,EAC7B,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,EACnB,OAAO,UAAO,EACd,KAAK,SAAW,GACjB,IAAI,EAAE,CAGR;AAED;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAChB,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,EAC7B,KAAK,EAAE,IAAI,EAAE,EACb,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,GACd,IAAI,EAAE,CAkBR;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CACxB,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,EAC7B,KAAK,EAAE,IAAI,EAAE,GACd,IAAI,GAAG,SAAS,CAElB;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CACnB,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,EAChC,KAAK,EAAE,IAAI,EAAE,EACb,OAAO,UAAO,GACf,OAAO,GAAG,IAAI,CAehB;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CACrB,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,EAChC,KAAK,EAAE,IAAI,EAAE,GACd,OAAO,CAQT;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CACnB,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,EAChC,KAAK,EAAE,IAAI,EAAE,GACd,OAAO,EAAE,CAYX"} \ No newline at end of file +{"version":3,"file":"querying.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706/src/","sources":["querying.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAElE;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAClB,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,EAChC,IAAI,EAAE,OAAO,GAAG,OAAO,EAAE,EACzB,OAAO,UAAO,EACd,KAAK,SAAW,GACjB,OAAO,EAAE,CAGX;AAED;;;;;;;;;GASG;AACH,wBAAgB,IAAI,CAChB,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,EAChC,KAAK,EAAE,OAAO,EAAE,EAChB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,GACd,OAAO,EAAE,CAkBX;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC1B,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,EAC1B,KAAK,EAAE,CAAC,EAAE,GACX,CAAC,GAAG,SAAS,CAEf;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CACnB,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,EAChC,KAAK,EAAE,OAAO,EAAE,EAChB,OAAO,UAAO,GACf,OAAO,GAAG,IAAI,CAehB;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CACrB,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,EAChC,KAAK,EAAE,OAAO,EAAE,GACjB,OAAO,CAQT;AAED;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CACnB,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,EAChC,KAAK,EAAE,OAAO,EAAE,GACjB,OAAO,EAAE,CAYX"} \ No newline at end of file diff --git a/node_modules/domutils/lib/querying.js b/node_modules/domutils/lib/querying.js index 1eb20e9..3e2c1ec 100644 --- a/node_modules/domutils/lib/querying.js +++ b/node_modules/domutils/lib/querying.js @@ -5,6 +5,7 @@ var domhandler_1 = require("domhandler"); /** * Search a node and its children for nodes passing a test function. * + * @category Querying * @param test Function to test nodes on. * @param node Node to search. Will be included in the result set if it matches. * @param recurse Also consider child nodes. @@ -22,6 +23,7 @@ exports.filter = filter; /** * Search an array of node and its children for nodes passing a test function. * + * @category Querying * @param test Function to test nodes on. * @param nodes Array of nodes to search. * @param recurse Also consider child nodes. @@ -51,9 +53,11 @@ exports.find = find; /** * Finds the first element inside of an array that matches a test function. * + * @category Querying * @param test Function to test nodes on. * @param nodes Array of nodes to search. * @returns The first node in the array that passes `test`. + * @deprecated Use `Array.prototype.find` directly. */ function findOneChild(test, nodes) { return nodes.find(test); @@ -62,6 +66,7 @@ exports.findOneChild = findOneChild; /** * Finds one element in a tree that passes a test. * + * @category Querying * @param test Function to test nodes on. * @param nodes Array of nodes to search. * @param recurse Also consider child nodes. @@ -79,16 +84,17 @@ function findOne(test, nodes, recurse) { elem = checked; } else if (recurse && checked.children.length > 0) { - elem = findOne(test, checked.children); + elem = findOne(test, checked.children, true); } } return elem; } exports.findOne = findOne; /** + * @category Querying * @param test Function to test nodes on. * @param nodes Array of nodes to search. - * @returns Whether a tree of nodes contains at least one node passing a test. + * @returns Whether a tree of nodes contains at least one node passing the test. */ function existsOne(test, nodes) { return nodes.some(function (checked) { @@ -100,10 +106,11 @@ function existsOne(test, nodes) { } exports.existsOne = existsOne; /** - * Search and array of nodes and its children for nodes passing a test function. + * Search and array of nodes and its children for elements passing a test function. * - * Same as `find`, only with less options, leading to reduced complexity. + * Same as `find`, but limited to elements and with less options, leading to reduced complexity. * + * @category Querying * @param test Function to test nodes on. * @param nodes Array of nodes to search. * @returns All nodes passing `test`. @@ -124,3 +131,4 @@ function findAll(test, nodes) { return result; } exports.findAll = findAll; +//# sourceMappingURL=querying.js.map \ No newline at end of file diff --git a/node_modules/domutils/lib/stringify.d.ts b/node_modules/domutils/lib/stringify.d.ts index b5019d0..a643f70 100644 --- a/node_modules/domutils/lib/stringify.d.ts +++ b/node_modules/domutils/lib/stringify.d.ts @@ -1,41 +1,46 @@ -import { Node } from "domhandler"; +import { AnyNode } from "domhandler"; import { DomSerializerOptions } from "dom-serializer"; /** + * @category Stringify + * @deprecated Use the `dom-serializer` module directly. * @param node Node to get the outer HTML of. * @param options Options for serialization. - * @deprecated Use the `dom-serializer` module directly. * @returns `node`'s outer HTML. */ -export declare function getOuterHTML(node: Node | Node[], options?: DomSerializerOptions): string; +export declare function getOuterHTML(node: AnyNode | ArrayLike, options?: DomSerializerOptions): string; /** + * @category Stringify + * @deprecated Use the `dom-serializer` module directly. * @param node Node to get the inner HTML of. * @param options Options for serialization. - * @deprecated Use the `dom-serializer` module directly. * @returns `node`'s inner HTML. */ -export declare function getInnerHTML(node: Node, options?: DomSerializerOptions): string; +export declare function getInnerHTML(node: AnyNode, options?: DomSerializerOptions): string; /** * Get a node's inner text. Same as `textContent`, but inserts newlines for `
    ` tags. * + * @category Stringify * @deprecated Use `textContent` instead. * @param node Node to get the inner text of. * @returns `node`'s inner text. */ -export declare function getText(node: Node | Node[]): string; +export declare function getText(node: AnyNode | AnyNode[]): string; /** * Get a node's text content. * + * @category Stringify * @param node Node to get the text content of. * @returns `node`'s text content. * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent} */ -export declare function textContent(node: Node | Node[]): string; +export declare function textContent(node: AnyNode | AnyNode[]): string; /** * Get a node's inner text. * + * @category Stringify * @param node Node to get the inner text of. * @returns `node`'s inner text. * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/innerText} */ -export declare function innerText(node: Node | Node[]): string; +export declare function innerText(node: AnyNode | AnyNode[]): string; //# sourceMappingURL=stringify.d.ts.map \ No newline at end of file diff --git a/node_modules/domutils/lib/stringify.d.ts.map b/node_modules/domutils/lib/stringify.d.ts.map index 777fec6..8da073b 100644 --- a/node_modules/domutils/lib/stringify.d.ts.map +++ b/node_modules/domutils/lib/stringify.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"stringify.d.ts","sourceRoot":"","sources":["../src/stringify.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,IAAI,EAEP,MAAM,YAAY,CAAC;AACpB,OAAmB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAGlE;;;;;GAKG;AACH,wBAAgB,YAAY,CACxB,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,EACnB,OAAO,CAAC,EAAE,oBAAoB,GAC/B,MAAM,CAER;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CACxB,IAAI,EAAE,IAAI,EACV,OAAO,CAAC,EAAE,oBAAoB,GAC/B,MAAM,CAIR;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,MAAM,CAMnD;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,MAAM,CAOvD;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,MAAM,CAOrD"} \ No newline at end of file +{"version":3,"file":"stringify.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706/src/","sources":["stringify.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,OAAO,EAEV,MAAM,YAAY,CAAC;AACpB,OAAmB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAGlE;;;;;;GAMG;AACH,wBAAgB,YAAY,CACxB,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,EAClC,OAAO,CAAC,EAAE,oBAAoB,GAC/B,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CACxB,IAAI,EAAE,OAAO,EACb,OAAO,CAAC,EAAE,oBAAoB,GAC/B,MAAM,CAIR;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,EAAE,GAAG,MAAM,CAMzD;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,EAAE,GAAG,MAAM,CAO7D;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,EAAE,GAAG,MAAM,CAO3D"} \ No newline at end of file diff --git a/node_modules/domutils/lib/stringify.js b/node_modules/domutils/lib/stringify.js index db74747..006d61b 100644 --- a/node_modules/domutils/lib/stringify.js +++ b/node_modules/domutils/lib/stringify.js @@ -8,9 +8,10 @@ var domhandler_1 = require("domhandler"); var dom_serializer_1 = __importDefault(require("dom-serializer")); var domelementtype_1 = require("domelementtype"); /** + * @category Stringify + * @deprecated Use the `dom-serializer` module directly. * @param node Node to get the outer HTML of. * @param options Options for serialization. - * @deprecated Use the `dom-serializer` module directly. * @returns `node`'s outer HTML. */ function getOuterHTML(node, options) { @@ -18,9 +19,10 @@ function getOuterHTML(node, options) { } exports.getOuterHTML = getOuterHTML; /** + * @category Stringify + * @deprecated Use the `dom-serializer` module directly. * @param node Node to get the inner HTML of. * @param options Options for serialization. - * @deprecated Use the `dom-serializer` module directly. * @returns `node`'s inner HTML. */ function getInnerHTML(node, options) { @@ -32,6 +34,7 @@ exports.getInnerHTML = getInnerHTML; /** * Get a node's inner text. Same as `textContent`, but inserts newlines for `
    ` tags. * + * @category Stringify * @deprecated Use `textContent` instead. * @param node Node to get the inner text of. * @returns `node`'s inner text. @@ -51,6 +54,7 @@ exports.getText = getText; /** * Get a node's text content. * + * @category Stringify * @param node Node to get the text content of. * @returns `node`'s text content. * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent} @@ -69,6 +73,7 @@ exports.textContent = textContent; /** * Get a node's inner text. * + * @category Stringify * @param node Node to get the inner text of. * @returns `node`'s inner text. * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/innerText} @@ -84,3 +89,4 @@ function innerText(node) { return ""; } exports.innerText = innerText; +//# sourceMappingURL=stringify.js.map \ No newline at end of file diff --git a/node_modules/domutils/lib/traversal.d.ts b/node_modules/domutils/lib/traversal.d.ts index 0e2f44a..213e6a9 100644 --- a/node_modules/domutils/lib/traversal.d.ts +++ b/node_modules/domutils/lib/traversal.d.ts @@ -1,27 +1,29 @@ -import { Node, Element, NodeWithChildren } from "domhandler"; +import { AnyNode, ChildNode, Element, ParentNode } from "domhandler"; /** * Get a node's children. * + * @category Traversal * @param elem Node to get the children of. * @returns `elem`'s children, or an empty array. */ -export declare function getChildren(elem: Node): Node[]; -export declare function getParent(elem: Element): Element | null; -export declare function getParent(elem: Node): NodeWithChildren | null; +export declare function getChildren(elem: AnyNode): ChildNode[]; +export declare function getParent(elem: AnyNode): ParentNode | null; /** * Gets an elements siblings, including the element itself. * - * Attempts to get the children through the element's parent first. - * If we don't have a parent (the element is a root node), - * we walk the element's `prev` & `next` to get all remaining nodes. + * Attempts to get the children through the element's parent first. If we don't + * have a parent (the element is a root node), we walk the element's `prev` & + * `next` to get all remaining nodes. * + * @category Traversal * @param elem Element to get the siblings of. * @returns `elem`'s siblings. */ -export declare function getSiblings(elem: Node): Node[]; +export declare function getSiblings(elem: AnyNode): AnyNode[]; /** * Gets an attribute from an element. * + * @category Traversal * @param elem Element to check. * @param name Attribute name to retrieve. * @returns The element's attribute value, or `undefined`. @@ -30,6 +32,7 @@ export declare function getAttributeValue(elem: Element, name: string): string | /** * Checks whether an element has an attribute. * + * @category Traversal * @param elem Element to check. * @param name Attribute name to look for. * @returns Returns whether `elem` has the attribute `name`. @@ -38,6 +41,7 @@ export declare function hasAttrib(elem: Element, name: string): boolean; /** * Get the tag name of an element. * + * @category Traversal * @param elem The element to get the name for. * @returns The tag name of `elem`. */ @@ -45,15 +49,17 @@ export declare function getName(elem: Element): string; /** * Returns the next element sibling of a node. * + * @category Traversal * @param elem The element to get the next sibling of. * @returns `elem`'s next sibling that is a tag. */ -export declare function nextElementSibling(elem: Node): Element | null; +export declare function nextElementSibling(elem: AnyNode): Element | null; /** * Returns the previous element sibling of a node. * + * @category Traversal * @param elem The element to get the previous sibling of. * @returns `elem`'s previous sibling that is a tag. */ -export declare function prevElementSibling(elem: Node): Element | null; +export declare function prevElementSibling(elem: AnyNode): Element | null; //# sourceMappingURL=traversal.d.ts.map \ No newline at end of file diff --git a/node_modules/domutils/lib/traversal.d.ts.map b/node_modules/domutils/lib/traversal.d.ts.map index 0309d33..cdf1710 100644 --- a/node_modules/domutils/lib/traversal.d.ts.map +++ b/node_modules/domutils/lib/traversal.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"traversal.d.ts","sourceRoot":"","sources":["../src/traversal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,IAAI,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGpE;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,CAE9C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAAC;AACzD,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,gBAAgB,GAAG,IAAI,CAAC;AAW/D;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,CAe9C;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC7B,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,MAAM,GACb,MAAM,GAAG,SAAS,CAEpB;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAM9D;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAE7C;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,GAAG,IAAI,CAI7D;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,GAAG,IAAI,CAI7D"} \ No newline at end of file +{"version":3,"file":"traversal.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/f7e357b5c210b6731c2a60e0b7b3cfaa1f96b706/src/","sources":["traversal.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,OAAO,EACP,SAAS,EACT,OAAO,EACP,UAAU,EAEb,MAAM,YAAY,CAAC;AAEpB;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,EAAE,CAEtD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAAC;AAY5D;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,EAAE,CAepD;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC7B,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,MAAM,GACb,MAAM,GAAG,SAAS,CAEpB;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAM9D;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAE7C;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAIhE;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAIhE"} \ No newline at end of file diff --git a/node_modules/domutils/lib/traversal.js b/node_modules/domutils/lib/traversal.js index 3a7ff72..5def453 100644 --- a/node_modules/domutils/lib/traversal.js +++ b/node_modules/domutils/lib/traversal.js @@ -2,21 +2,21 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.prevElementSibling = exports.nextElementSibling = exports.getName = exports.hasAttrib = exports.getAttributeValue = exports.getSiblings = exports.getParent = exports.getChildren = void 0; var domhandler_1 = require("domhandler"); -var emptyArray = []; /** * Get a node's children. * + * @category Traversal * @param elem Node to get the children of. * @returns `elem`'s children, or an empty array. */ function getChildren(elem) { - var _a; - return (_a = elem.children) !== null && _a !== void 0 ? _a : emptyArray; + return (0, domhandler_1.hasChildren)(elem) ? elem.children : []; } exports.getChildren = getChildren; /** * Get a node's parent. * + * @category Traversal * @param elem Node to get the parent of. * @returns `elem`'s parent node. */ @@ -27,10 +27,11 @@ exports.getParent = getParent; /** * Gets an elements siblings, including the element itself. * - * Attempts to get the children through the element's parent first. - * If we don't have a parent (the element is a root node), - * we walk the element's `prev` & `next` to get all remaining nodes. + * Attempts to get the children through the element's parent first. If we don't + * have a parent (the element is a root node), we walk the element's `prev` & + * `next` to get all remaining nodes. * + * @category Traversal * @param elem Element to get the siblings of. * @returns `elem`'s siblings. */ @@ -55,6 +56,7 @@ exports.getSiblings = getSiblings; /** * Gets an attribute from an element. * + * @category Traversal * @param elem Element to check. * @param name Attribute name to retrieve. * @returns The element's attribute value, or `undefined`. @@ -67,6 +69,7 @@ exports.getAttributeValue = getAttributeValue; /** * Checks whether an element has an attribute. * + * @category Traversal * @param elem Element to check. * @param name Attribute name to look for. * @returns Returns whether `elem` has the attribute `name`. @@ -80,6 +83,7 @@ exports.hasAttrib = hasAttrib; /** * Get the tag name of an element. * + * @category Traversal * @param elem The element to get the name for. * @returns The tag name of `elem`. */ @@ -90,6 +94,7 @@ exports.getName = getName; /** * Returns the next element sibling of a node. * + * @category Traversal * @param elem The element to get the next sibling of. * @returns `elem`'s next sibling that is a tag. */ @@ -104,6 +109,7 @@ exports.nextElementSibling = nextElementSibling; /** * Returns the previous element sibling of a node. * + * @category Traversal * @param elem The element to get the previous sibling of. * @returns `elem`'s previous sibling that is a tag. */ @@ -115,3 +121,4 @@ function prevElementSibling(elem) { return prev; } exports.prevElementSibling = prevElementSibling; +//# sourceMappingURL=traversal.js.map \ No newline at end of file diff --git a/node_modules/domutils/package.json b/node_modules/domutils/package.json index 2a7a616..7955573 100644 --- a/node_modules/domutils/package.json +++ b/node_modules/domutils/package.json @@ -1,99 +1,76 @@ { - "_from": "domutils@^2.7.0", - "_id": "domutils@2.8.0", - "_inBundle": false, - "_integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==", - "_location": "/domutils", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "domutils@^2.7.0", "name": "domutils", - "escapedName": "domutils", - "rawSpec": "^2.7.0", - "saveSpec": null, - "fetchSpec": "^2.7.0" - }, - "_requiredBy": [ - "/cheerio-select", - "/css-select", - "/htmlparser2" - ], - "_resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", - "_shasum": "4437def5db6e2d1f5d6ee859bd95ca7d02048135", - "_spec": "domutils@^2.7.0", - "_where": "/home/runner/work/public_library_map/public_library_map/node_modules/cheerio-select", - "author": { - "name": "Felix Boehm", - "email": "me@feedic.com" - }, - "bugs": { - "url": "https://github.com/fb55/domutils/issues" - }, - "bundleDependencies": false, - "dependencies": { - "dom-serializer": "^1.0.1", - "domelementtype": "^2.2.0", - "domhandler": "^4.2.0" - }, - "deprecated": false, - "description": "Utilities for working with htmlparser2's dom", - "devDependencies": { - "@types/jest": "^27.0.1", - "@types/node": "^16.7.2", - "@typescript-eslint/eslint-plugin": "^4.29.3", - "@typescript-eslint/parser": "^4.29.3", - "eslint": "^7.32.0", - "eslint-config-prettier": "^8.1.0", - "eslint-plugin-jsdoc": "^36.0.8", - "htmlparser2": "~7.0.0", - "jest": "^27.1.0", - "prettier": "^2.0.5", - "ts-jest": "^27.0.5", - "typedoc": "^0.21.6", - "typescript": "^4.4.2" - }, - "files": [ - "lib/**/*" - ], - "funding": { - "url": "https://github.com/fb55/domutils?sponsor=1" - }, - "homepage": "https://github.com/fb55/domutils#readme", - "jest": { - "preset": "ts-jest", - "testEnvironment": "node" - }, - "keywords": [ - "dom", - "htmlparser2" - ], - "license": "BSD-2-Clause", - "main": "lib/index.js", - "name": "domutils", - "prettier": { - "tabWidth": 4 - }, - "repository": { - "type": "git", - "url": "git://github.com/fb55/domutils.git" - }, - "scripts": { - "build": "tsc", - "build:docs": "typedoc --hideGenerator --exclude \"**/*+(index|.spec).ts\" src", - "format": "npm run format:es && npm run format:prettier", - "format:es": "npm run lint:es -- --fix", - "format:prettier": "npm run prettier -- --write", - "lint": "npm run lint:es && npm run lint:prettier", - "lint:es": "eslint --ignore-path .gitignore .", - "lint:prettier": "npm run prettier -- --check", - "prepare": "npm run build", - "prettier": "prettier \"**/*.{ts,md,json,yml}\" --ignore-path .gitignore", - "test": "npm run test:jest && npm run lint", - "test:jest": "jest" - }, - "sideEffects": false, - "types": "lib/index.d.ts", - "version": "2.8.0" + "version": "3.0.1", + "description": "Utilities for working with htmlparser2's dom", + "author": "Felix Boehm ", + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + }, + "license": "BSD-2-Clause", + "sideEffects": false, + "main": "lib/index.js", + "types": "lib/index.d.ts", + "module": "lib/esm/index.js", + "exports": { + "require": "./lib/index.js", + "import": "./lib/esm/index.js" + }, + "files": [ + "lib/**/*" + ], + "scripts": { + "test": "npm run test:jest && npm run lint", + "test:jest": "jest", + "lint": "npm run lint:es && npm run lint:prettier", + "lint:es": "eslint --ignore-path .gitignore .", + "lint:prettier": "npm run prettier -- --check", + "format": "npm run format:es && npm run format:prettier", + "format:es": "npm run lint:es -- --fix", + "format:prettier": "npm run prettier -- --write", + "prettier": "prettier \"**/*.{ts,md,json,yml}\" --ignore-path .gitignore", + "build": "npm run build:cjs && npm run build:esm", + "build:cjs": "tsc --sourceRoot https://raw.githubusercontent.com/fb55/domutils/$(git rev-parse HEAD)/src/", + "build:esm": "npm run build:cjs -- --module esnext --target es2019 --outDir lib/esm && echo '{\"type\":\"module\"}' > lib/esm/package.json", + "build:docs": "typedoc --hideGenerator --exclude \"**/*+(index|.spec).ts\" --categorizeByGroup false --sort enum-value-ascending --sort alphabetical src", + "prepare": "npm run build" + }, + "repository": { + "type": "git", + "url": "git://github.com/fb55/domutils.git" + }, + "keywords": [ + "dom", + "htmlparser2" + ], + "dependencies": { + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.1" + }, + "devDependencies": { + "@types/jest": "^27.4.1", + "@types/node": "^17.0.25", + "@typescript-eslint/eslint-plugin": "^5.20.0", + "@typescript-eslint/parser": "^5.20.0", + "eslint": "^8.13.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-jsdoc": "^39.2.7", + "htmlparser2": "~7.2.0", + "jest": "^27.5.1", + "prettier": "^2.6.2", + "ts-jest": "^27.1.4", + "typedoc": "^0.22.15", + "typescript": "^4.6.3" + }, + "jest": { + "preset": "ts-jest", + "testEnvironment": "node", + "coverageProvider": "v8", + "moduleNameMapper": { + "^(.*)\\.js$": "$1" + } + }, + "prettier": { + "tabWidth": 4 + } } diff --git a/node_modules/entities/lib/decode.d.ts b/node_modules/entities/lib/decode.d.ts index 4d3df42..3ff9b55 100644 --- a/node_modules/entities/lib/decode.d.ts +++ b/node_modules/entities/lib/decode.d.ts @@ -1,5 +1,33 @@ -export declare const decodeXML: (str: string) => string; -export declare const decodeHTMLStrict: (str: string) => string; -export declare type MapType = Record; -export declare const decodeHTML: (str: string) => string; +import htmlDecodeTree from "./generated/decode-data-html.js"; +import xmlDecodeTree from "./generated/decode-data-xml.js"; +import decodeCodePoint from "./decode_codepoint.js"; +export { htmlDecodeTree, xmlDecodeTree, decodeCodePoint }; +export { replaceCodePoint, fromCodePoint } from "./decode_codepoint.js"; +export declare enum BinTrieFlags { + VALUE_LENGTH = 49152, + BRANCH_LENGTH = 16256, + JUMP_TABLE = 127 +} +export declare function determineBranch(decodeTree: Uint16Array, current: number, nodeIdx: number, char: number): number; +/** + * Decodes an HTML string, allowing for entities not terminated by a semi-colon. + * + * @param str The string to decode. + * @returns The decoded string. + */ +export declare function decodeHTML(str: string): string; +/** + * Decodes an HTML string, requiring all entities to be terminated by a semi-colon. + * + * @param str The string to decode. + * @returns The decoded string. + */ +export declare function decodeHTMLStrict(str: string): string; +/** + * Decodes an XML string, requiring all entities to be terminated by a semi-colon. + * + * @param str The string to decode. + * @returns The decoded string. + */ +export declare function decodeXML(str: string): string; //# sourceMappingURL=decode.d.ts.map \ No newline at end of file diff --git a/node_modules/entities/lib/decode.d.ts.map b/node_modules/entities/lib/decode.d.ts.map index ebcf133..447e80d 100644 --- a/node_modules/entities/lib/decode.d.ts.map +++ b/node_modules/entities/lib/decode.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../src/decode.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,SAAS,QAOL,MAAM,WAP0B,CAAC;AAClD,eAAO,MAAM,gBAAgB,QAMZ,MAAM,WANoC,CAAC;AAE5D,oBAAY,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAS7C,eAAO,MAAM,UAAU,QAyBN,MAAM,WACnB,CAAC"} \ No newline at end of file +{"version":3,"file":"decode.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/entities/867ac709ba482a56a98b7c35f49ca833c74dc193/src/","sources":["decode.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,iCAAiC,CAAC;AAC7D,OAAO,aAAa,MAAM,gCAAgC,CAAC;AAC3D,OAAO,eAAe,MAAM,uBAAuB,CAAC;AAGpD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAcxE,oBAAY,YAAY;IACpB,YAAY,QAAwB;IACpC,aAAa,QAAwB;IACrC,UAAU,MAAwB;CACrC;AA8GD,wBAAgB,eAAe,CAC3B,UAAU,EAAE,WAAW,EACvB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,GACb,MAAM,CAsCR;AAKD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C"} \ No newline at end of file diff --git a/node_modules/entities/lib/decode.js b/node_modules/entities/lib/decode.js index 5f9c1f2..c55e543 100644 --- a/node_modules/entities/lib/decode.js +++ b/node_modules/entities/lib/decode.js @@ -3,51 +3,177 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.decodeHTML = exports.decodeHTMLStrict = exports.decodeXML = void 0; -var entities_json_1 = __importDefault(require("./maps/entities.json")); -var legacy_json_1 = __importDefault(require("./maps/legacy.json")); -var xml_json_1 = __importDefault(require("./maps/xml.json")); -var decode_codepoint_1 = __importDefault(require("./decode_codepoint")); -var strictEntityRe = /&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g; -exports.decodeXML = getStrictDecoder(xml_json_1.default); -exports.decodeHTMLStrict = getStrictDecoder(entities_json_1.default); -function getStrictDecoder(map) { - var replace = getReplacer(map); - return function (str) { return String(str).replace(strictEntityRe, replace); }; -} -var sorter = function (a, b) { return (a < b ? 1 : -1); }; -exports.decodeHTML = (function () { - var legacy = Object.keys(legacy_json_1.default).sort(sorter); - var keys = Object.keys(entities_json_1.default).sort(sorter); - for (var i = 0, j = 0; i < keys.length; i++) { - if (legacy[j] === keys[i]) { - keys[i] += ";?"; - j++; - } - else { - keys[i] += ";"; - } - } - var re = new RegExp("&(?:" + keys.join("|") + "|#[xX][\\da-fA-F]+;?|#\\d+;?)", "g"); - var replace = getReplacer(entities_json_1.default); - function replacer(str) { - if (str.substr(-1) !== ";") - str += ";"; - return replace(str); - } - // TODO consider creating a merged map - return function (str) { return String(str).replace(re, replacer); }; -})(); -function getReplacer(map) { - return function replace(str) { - if (str.charAt(1) === "#") { - var secondChar = str.charAt(2); - if (secondChar === "X" || secondChar === "x") { - return decode_codepoint_1.default(parseInt(str.substr(3), 16)); +exports.decodeXML = exports.decodeHTMLStrict = exports.decodeHTML = exports.determineBranch = exports.BinTrieFlags = exports.fromCodePoint = exports.replaceCodePoint = exports.decodeCodePoint = exports.xmlDecodeTree = exports.htmlDecodeTree = void 0; +var decode_data_html_js_1 = __importDefault(require("./generated/decode-data-html.js")); +exports.htmlDecodeTree = decode_data_html_js_1.default; +var decode_data_xml_js_1 = __importDefault(require("./generated/decode-data-xml.js")); +exports.xmlDecodeTree = decode_data_xml_js_1.default; +var decode_codepoint_js_1 = __importDefault(require("./decode_codepoint.js")); +exports.decodeCodePoint = decode_codepoint_js_1.default; +var decode_codepoint_js_2 = require("./decode_codepoint.js"); +Object.defineProperty(exports, "replaceCodePoint", { enumerable: true, get: function () { return decode_codepoint_js_2.replaceCodePoint; } }); +Object.defineProperty(exports, "fromCodePoint", { enumerable: true, get: function () { return decode_codepoint_js_2.fromCodePoint; } }); +var CharCodes; +(function (CharCodes) { + CharCodes[CharCodes["NUM"] = 35] = "NUM"; + CharCodes[CharCodes["SEMI"] = 59] = "SEMI"; + CharCodes[CharCodes["ZERO"] = 48] = "ZERO"; + CharCodes[CharCodes["NINE"] = 57] = "NINE"; + CharCodes[CharCodes["LOWER_A"] = 97] = "LOWER_A"; + CharCodes[CharCodes["LOWER_F"] = 102] = "LOWER_F"; + CharCodes[CharCodes["LOWER_X"] = 120] = "LOWER_X"; + /** Bit that needs to be set to convert an upper case ASCII character to lower case */ + CharCodes[CharCodes["To_LOWER_BIT"] = 32] = "To_LOWER_BIT"; +})(CharCodes || (CharCodes = {})); +var BinTrieFlags; +(function (BinTrieFlags) { + BinTrieFlags[BinTrieFlags["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH"; + BinTrieFlags[BinTrieFlags["BRANCH_LENGTH"] = 16256] = "BRANCH_LENGTH"; + BinTrieFlags[BinTrieFlags["JUMP_TABLE"] = 127] = "JUMP_TABLE"; +})(BinTrieFlags = exports.BinTrieFlags || (exports.BinTrieFlags = {})); +function getDecoder(decodeTree) { + return function decodeHTMLBinary(str, strict) { + var ret = ""; + var lastIdx = 0; + var strIdx = 0; + while ((strIdx = str.indexOf("&", strIdx)) >= 0) { + ret += str.slice(lastIdx, strIdx); + lastIdx = strIdx; + // Skip the "&" + strIdx += 1; + // If we have a numeric entity, handle this separately. + if (str.charCodeAt(strIdx) === CharCodes.NUM) { + // Skip the leading "&#". For hex entities, also skip the leading "x". + var start = strIdx + 1; + var base = 10; + var cp = str.charCodeAt(start); + if ((cp | CharCodes.To_LOWER_BIT) === CharCodes.LOWER_X) { + base = 16; + strIdx += 1; + start += 1; + } + do + cp = str.charCodeAt(++strIdx); + while ((cp >= CharCodes.ZERO && cp <= CharCodes.NINE) || + (base === 16 && + (cp | CharCodes.To_LOWER_BIT) >= CharCodes.LOWER_A && + (cp | CharCodes.To_LOWER_BIT) <= CharCodes.LOWER_F)); + if (start !== strIdx) { + var entity = str.substring(start, strIdx); + var parsed = parseInt(entity, base); + if (str.charCodeAt(strIdx) === CharCodes.SEMI) { + strIdx += 1; + } + else if (strict) { + continue; + } + ret += (0, decode_codepoint_js_1.default)(parsed); + lastIdx = strIdx; + } + continue; + } + var resultIdx = 0; + var excess = 1; + var treeIdx = 0; + var current = decodeTree[treeIdx]; + for (; strIdx < str.length; strIdx++, excess++) { + treeIdx = determineBranch(decodeTree, current, treeIdx + 1, str.charCodeAt(strIdx)); + if (treeIdx < 0) + break; + current = decodeTree[treeIdx]; + var masked = current & BinTrieFlags.VALUE_LENGTH; + // If the branch is a value, store it and continue + if (masked) { + // If we have a legacy entity while parsing strictly, just skip the number of bytes + if (!strict || str.charCodeAt(strIdx) === CharCodes.SEMI) { + resultIdx = treeIdx; + excess = 0; + } + // The mask is the number of bytes of the value, including the current byte. + var valueLength = (masked >> 14) - 1; + if (valueLength === 0) + break; + treeIdx += valueLength; + } + } + if (resultIdx !== 0) { + var valueLength = (decodeTree[resultIdx] & BinTrieFlags.VALUE_LENGTH) >> 14; + ret += + valueLength === 1 + ? String.fromCharCode(decodeTree[resultIdx] & ~BinTrieFlags.VALUE_LENGTH) + : valueLength === 2 + ? String.fromCharCode(decodeTree[resultIdx + 1]) + : String.fromCharCode(decodeTree[resultIdx + 1], decodeTree[resultIdx + 2]); + lastIdx = strIdx - excess + 1; } - return decode_codepoint_1.default(parseInt(str.substr(2), 10)); } - // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - return map[str.slice(1, -1)] || str; + return ret + str.slice(lastIdx); }; } +function determineBranch(decodeTree, current, nodeIdx, char) { + var branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7; + var jumpOffset = current & BinTrieFlags.JUMP_TABLE; + // Case 1: Single branch encoded in jump offset + if (branchCount === 0) { + return jumpOffset !== 0 && char === jumpOffset ? nodeIdx : -1; + } + // Case 2: Multiple branches encoded in jump table + if (jumpOffset) { + var value = char - jumpOffset; + return value < 0 || value >= branchCount + ? -1 + : decodeTree[nodeIdx + value] - 1; + } + // Case 3: Multiple branches encoded in dictionary + // Binary search for the character. + var lo = nodeIdx; + var hi = lo + branchCount - 1; + while (lo <= hi) { + var mid = (lo + hi) >>> 1; + var midVal = decodeTree[mid]; + if (midVal < char) { + lo = mid + 1; + } + else if (midVal > char) { + hi = mid - 1; + } + else { + return decodeTree[mid + branchCount]; + } + } + return -1; +} +exports.determineBranch = determineBranch; +var htmlDecoder = getDecoder(decode_data_html_js_1.default); +var xmlDecoder = getDecoder(decode_data_xml_js_1.default); +/** + * Decodes an HTML string, allowing for entities not terminated by a semi-colon. + * + * @param str The string to decode. + * @returns The decoded string. + */ +function decodeHTML(str) { + return htmlDecoder(str, false); +} +exports.decodeHTML = decodeHTML; +/** + * Decodes an HTML string, requiring all entities to be terminated by a semi-colon. + * + * @param str The string to decode. + * @returns The decoded string. + */ +function decodeHTMLStrict(str) { + return htmlDecoder(str, true); +} +exports.decodeHTMLStrict = decodeHTMLStrict; +/** + * Decodes an XML string, requiring all entities to be terminated by a semi-colon. + * + * @param str The string to decode. + * @returns The decoded string. + */ +function decodeXML(str) { + return xmlDecoder(str, true); +} +exports.decodeXML = decodeXML; +//# sourceMappingURL=decode.js.map \ No newline at end of file diff --git a/node_modules/entities/lib/decode_codepoint.d.ts b/node_modules/entities/lib/decode_codepoint.d.ts index 6b72eaa..59015ec 100644 --- a/node_modules/entities/lib/decode_codepoint.d.ts +++ b/node_modules/entities/lib/decode_codepoint.d.ts @@ -1,2 +1,4 @@ +export declare const fromCodePoint: (...codePoints: number[]) => string; +export declare function replaceCodePoint(codePoint: number): number; export default function decodeCodePoint(codePoint: number): string; //# sourceMappingURL=decode_codepoint.d.ts.map \ No newline at end of file diff --git a/node_modules/entities/lib/decode_codepoint.d.ts.map b/node_modules/entities/lib/decode_codepoint.d.ts.map index b765ae0..8547934 100644 --- a/node_modules/entities/lib/decode_codepoint.d.ts.map +++ b/node_modules/entities/lib/decode_codepoint.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"decode_codepoint.d.ts","sourceRoot":"","sources":["../src/decode_codepoint.ts"],"names":[],"mappings":"AAsBA,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAUjE"} \ No newline at end of file +{"version":3,"file":"decode_codepoint.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/entities/867ac709ba482a56a98b7c35f49ca833c74dc193/src/","sources":["decode_codepoint.ts"],"names":[],"mappings":"AAiCA,eAAO,MAAM,aAAa,qCAgBrB,CAAC;AAEN,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,UAMjD;AAED,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEjE"} \ No newline at end of file diff --git a/node_modules/entities/lib/decode_codepoint.js b/node_modules/entities/lib/decode_codepoint.js index 63efe19..cd1aaa2 100644 --- a/node_modules/entities/lib/decode_codepoint.js +++ b/node_modules/entities/lib/decode_codepoint.js @@ -1,30 +1,60 @@ "use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; +// Adapted from https://github.com/mathiasbynens/he/blob/36afe179392226cf1b6ccdb16ebbb7a5a844d93a/src/he.js#L106-L134 +var _a; Object.defineProperty(exports, "__esModule", { value: true }); -var decode_json_1 = __importDefault(require("./maps/decode.json")); -// Adapted from https://github.com/mathiasbynens/he/blob/master/src/he.js#L94-L119 -var fromCodePoint = -// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -String.fromCodePoint || - function (codePoint) { - var output = ""; - if (codePoint > 0xffff) { - codePoint -= 0x10000; - output += String.fromCharCode(((codePoint >>> 10) & 0x3ff) | 0xd800); - codePoint = 0xdc00 | (codePoint & 0x3ff); - } - output += String.fromCharCode(codePoint); - return output; - }; -function decodeCodePoint(codePoint) { +exports.replaceCodePoint = exports.fromCodePoint = void 0; +var decodeMap = new Map([ + [0, 65533], + [128, 8364], + [130, 8218], + [131, 402], + [132, 8222], + [133, 8230], + [134, 8224], + [135, 8225], + [136, 710], + [137, 8240], + [138, 352], + [139, 8249], + [140, 338], + [142, 381], + [145, 8216], + [146, 8217], + [147, 8220], + [148, 8221], + [149, 8226], + [150, 8211], + [151, 8212], + [152, 732], + [153, 8482], + [154, 353], + [155, 8250], + [156, 339], + [158, 382], + [159, 376], +]); +exports.fromCodePoint = +// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, node/no-unsupported-features/es-builtins +(_a = String.fromCodePoint) !== null && _a !== void 0 ? _a : function (codePoint) { + var output = ""; + if (codePoint > 0xffff) { + codePoint -= 0x10000; + output += String.fromCharCode(((codePoint >>> 10) & 0x3ff) | 0xd800); + codePoint = 0xdc00 | (codePoint & 0x3ff); + } + output += String.fromCharCode(codePoint); + return output; +}; +function replaceCodePoint(codePoint) { + var _a; if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) { - return "\uFFFD"; + return 0xfffd; } - if (codePoint in decode_json_1.default) { - codePoint = decode_json_1.default[codePoint]; - } - return fromCodePoint(codePoint); + return (_a = decodeMap.get(codePoint)) !== null && _a !== void 0 ? _a : codePoint; +} +exports.replaceCodePoint = replaceCodePoint; +function decodeCodePoint(codePoint) { + return (0, exports.fromCodePoint)(replaceCodePoint(codePoint)); } exports.default = decodeCodePoint; +//# sourceMappingURL=decode_codepoint.js.map \ No newline at end of file diff --git a/node_modules/entities/lib/encode.d.ts b/node_modules/entities/lib/encode.d.ts index 8e346d8..f09c4ee 100644 --- a/node_modules/entities/lib/encode.d.ts +++ b/node_modules/entities/lib/encode.d.ts @@ -1,47 +1,22 @@ /** - * Encodes all non-ASCII characters, as well as characters not valid in XML - * documents using XML entities. + * Encodes all characters in the input using HTML entities. This includes + * characters that are valid ASCII characters in HTML documents, such as `#`. * - * If a character has no equivalent entity, a - * numeric hexadecimal reference (eg. `ü`) will be used. + * To get a more compact output, consider using the `encodeNonAsciiHTML` + * function, which will only encode characters that are not valid in HTML + * documents, as well as non-ASCII characters. + * + * If a character has no equivalent entity, a numeric hexadecimal reference + * (eg. `ü`) will be used. */ -export declare const encodeXML: (data: string) => string; -/** - * Encodes all entities and non-ASCII characters in the input. - * - * This includes characters that are valid ASCII characters in HTML documents. - * For example `#` will be encoded as `#`. To get a more compact output, - * consider using the `encodeNonAsciiHTML` function. - * - * If a character has no equivalent entity, a - * numeric hexadecimal reference (eg. `ü`) will be used. - */ -export declare const encodeHTML: (data: string) => string; +export declare function encodeHTML(data: string): string; /** * Encodes all non-ASCII characters, as well as characters not valid in HTML - * documents using HTML entities. + * documents using HTML entities. This function will not encode characters that + * are valid in HTML documents, such as `#`. * - * If a character has no equivalent entity, a - * numeric hexadecimal reference (eg. `ü`) will be used. + * If a character has no equivalent entity, a numeric hexadecimal reference + * (eg. `ü`) will be used. */ -export declare const encodeNonAsciiHTML: (data: string) => string; -/** - * Encodes all non-ASCII characters, as well as characters not valid in XML - * documents using numeric hexadecimal reference (eg. `ü`). - * - * Have a look at `escapeUTF8` if you want a more concise output at the expense - * of reduced transportability. - * - * @param data String to escape. - */ -export declare function escape(data: string): string; -/** - * Encodes all characters not valid in XML documents using numeric hexadecimal - * reference (eg. `ü`). - * - * Note that the output will be character-set dependent. - * - * @param data String to escape. - */ -export declare function escapeUTF8(data: string): string; +export declare function encodeNonAsciiHTML(data: string): string; //# sourceMappingURL=encode.d.ts.map \ No newline at end of file diff --git a/node_modules/entities/lib/encode.d.ts.map b/node_modules/entities/lib/encode.d.ts.map index 0b075fd..74a9124 100644 --- a/node_modules/entities/lib/encode.d.ts.map +++ b/node_modules/entities/lib/encode.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../src/encode.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,SAwIJ,MAAM,WAxI4B,CAAC;AAOrD;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,SAkFL,MAAM,WAlFuC,CAAC;AAChE;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,SA+Gb,MAAM,WA/GsC,CAAC;AAqF/D;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C"} \ No newline at end of file +{"version":3,"file":"encode.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/entities/867ac709ba482a56a98b7c35f49ca833c74dc193/src/","sources":["encode.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AACD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD"} \ No newline at end of file diff --git a/node_modules/entities/lib/encode.js b/node_modules/entities/lib/encode.js index d11b238..5f83d4a 100644 --- a/node_modules/entities/lib/encode.js +++ b/node_modules/entities/lib/encode.js @@ -3,134 +3,75 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.escapeUTF8 = exports.escape = exports.encodeNonAsciiHTML = exports.encodeHTML = exports.encodeXML = void 0; -var xml_json_1 = __importDefault(require("./maps/xml.json")); -var inverseXML = getInverseObj(xml_json_1.default); -var xmlReplacer = getInverseReplacer(inverseXML); +exports.encodeNonAsciiHTML = exports.encodeHTML = void 0; +var encode_html_js_1 = __importDefault(require("./generated/encode-html.js")); +var escape_js_1 = require("./escape.js"); +var htmlReplacer = /[\t\n!-,./:-@[-`\f{-}$\x80-\uFFFF]/g; /** - * Encodes all non-ASCII characters, as well as characters not valid in XML - * documents using XML entities. + * Encodes all characters in the input using HTML entities. This includes + * characters that are valid ASCII characters in HTML documents, such as `#`. * - * If a character has no equivalent entity, a - * numeric hexadecimal reference (eg. `ü`) will be used. + * To get a more compact output, consider using the `encodeNonAsciiHTML` + * function, which will only encode characters that are not valid in HTML + * documents, as well as non-ASCII characters. + * + * If a character has no equivalent entity, a numeric hexadecimal reference + * (eg. `ü`) will be used. */ -exports.encodeXML = getASCIIEncoder(inverseXML); -var entities_json_1 = __importDefault(require("./maps/entities.json")); -var inverseHTML = getInverseObj(entities_json_1.default); -var htmlReplacer = getInverseReplacer(inverseHTML); -/** - * Encodes all entities and non-ASCII characters in the input. - * - * This includes characters that are valid ASCII characters in HTML documents. - * For example `#` will be encoded as `#`. To get a more compact output, - * consider using the `encodeNonAsciiHTML` function. - * - * If a character has no equivalent entity, a - * numeric hexadecimal reference (eg. `ü`) will be used. - */ -exports.encodeHTML = getInverse(inverseHTML, htmlReplacer); +function encodeHTML(data) { + return encodeHTMLTrieRe(htmlReplacer, data); +} +exports.encodeHTML = encodeHTML; /** * Encodes all non-ASCII characters, as well as characters not valid in HTML - * documents using HTML entities. + * documents using HTML entities. This function will not encode characters that + * are valid in HTML documents, such as `#`. * - * If a character has no equivalent entity, a - * numeric hexadecimal reference (eg. `ü`) will be used. + * If a character has no equivalent entity, a numeric hexadecimal reference + * (eg. `ü`) will be used. */ -exports.encodeNonAsciiHTML = getASCIIEncoder(inverseHTML); -function getInverseObj(obj) { - return Object.keys(obj) - .sort() - .reduce(function (inverse, name) { - inverse[obj[name]] = "&" + name + ";"; - return inverse; - }, {}); +function encodeNonAsciiHTML(data) { + return encodeHTMLTrieRe(escape_js_1.xmlReplacer, data); } -function getInverseReplacer(inverse) { - var single = []; - var multiple = []; - for (var _i = 0, _a = Object.keys(inverse); _i < _a.length; _i++) { - var k = _a[_i]; - if (k.length === 1) { - // Add value to single array - single.push("\\" + k); +exports.encodeNonAsciiHTML = encodeNonAsciiHTML; +function encodeHTMLTrieRe(regExp, str) { + var ret = ""; + var lastIdx = 0; + var match; + while ((match = regExp.exec(str)) !== null) { + var i = match.index; + ret += str.substring(lastIdx, i); + var char = str.charCodeAt(i); + var next = encode_html_js_1.default.get(char); + if (typeof next === "object") { + // We are in a branch. Try to match the next char. + if (i + 1 < str.length) { + var nextChar = str.charCodeAt(i + 1); + var value = typeof next.n === "number" + ? next.n === nextChar + ? next.o + : undefined + : next.n.get(nextChar); + if (value !== undefined) { + ret += value; + lastIdx = regExp.lastIndex += 1; + continue; + } + } + next = next.v; + } + // We might have a tree node without a value; skip and use a numeric entitiy. + if (next !== undefined) { + ret += next; + lastIdx = i + 1; } else { - // Add value to multiple array - multiple.push(k); + var cp = (0, escape_js_1.getCodePoint)(str, i); + ret += "&#x".concat(cp.toString(16), ";"); + // Increase by 1 if we have a surrogate pair + lastIdx = regExp.lastIndex += Number(cp !== char); } } - // Add ranges to single characters. - single.sort(); - for (var start = 0; start < single.length - 1; start++) { - // Find the end of a run of characters - var end = start; - while (end < single.length - 1 && - single[end].charCodeAt(1) + 1 === single[end + 1].charCodeAt(1)) { - end += 1; - } - var count = 1 + end - start; - // We want to replace at least three characters - if (count < 3) - continue; - single.splice(start, count, single[start] + "-" + single[end]); - } - multiple.unshift("[" + single.join("") + "]"); - return new RegExp(multiple.join("|"), "g"); -} -// /[^\0-\x7F]/gu -var reNonASCII = /(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g; -var getCodePoint = -// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -String.prototype.codePointAt != null - ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - function (str) { return str.codePointAt(0); } - : // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae - function (c) { - return (c.charCodeAt(0) - 0xd800) * 0x400 + - c.charCodeAt(1) - - 0xdc00 + - 0x10000; - }; -function singleCharReplacer(c) { - return "&#x" + (c.length > 1 ? getCodePoint(c) : c.charCodeAt(0)) - .toString(16) - .toUpperCase() + ";"; -} -function getInverse(inverse, re) { - return function (data) { - return data - .replace(re, function (name) { return inverse[name]; }) - .replace(reNonASCII, singleCharReplacer); - }; -} -var reEscapeChars = new RegExp(xmlReplacer.source + "|" + reNonASCII.source, "g"); -/** - * Encodes all non-ASCII characters, as well as characters not valid in XML - * documents using numeric hexadecimal reference (eg. `ü`). - * - * Have a look at `escapeUTF8` if you want a more concise output at the expense - * of reduced transportability. - * - * @param data String to escape. - */ -function escape(data) { - return data.replace(reEscapeChars, singleCharReplacer); -} -exports.escape = escape; -/** - * Encodes all characters not valid in XML documents using numeric hexadecimal - * reference (eg. `ü`). - * - * Note that the output will be character-set dependent. - * - * @param data String to escape. - */ -function escapeUTF8(data) { - return data.replace(xmlReplacer, singleCharReplacer); -} -exports.escapeUTF8 = escapeUTF8; -function getASCIIEncoder(obj) { - return function (data) { - return data.replace(reEscapeChars, function (c) { return obj[c] || singleCharReplacer(c); }); - }; + return ret + str.substr(lastIdx); } +//# sourceMappingURL=encode.js.map \ No newline at end of file diff --git a/node_modules/entities/lib/index.d.ts b/node_modules/entities/lib/index.d.ts index 68c8cd5..f3315b3 100644 --- a/node_modules/entities/lib/index.d.ts +++ b/node_modules/entities/lib/index.d.ts @@ -1,27 +1,102 @@ +/** The level of entities to support. */ +export declare enum EntityLevel { + /** Support only XML entities. */ + XML = 0, + /** Support HTML entities, which are a superset of XML entities. */ + HTML = 1 +} +/** Determines whether some entities are allowed to be written without a trailing `;`. */ +export declare enum DecodingMode { + /** Support legacy HTML entities. */ + Legacy = 0, + /** Do not support legacy HTML entities. */ + Strict = 1 +} +export declare enum EncodingMode { + /** + * The output is UTF-8 encoded. Only characters that need escaping within + * XML will be escaped. + */ + UTF8 = 0, + /** + * The output consists only of ASCII characters. Characters that need + * escaping within HTML, and characters that aren't ASCII characters will + * be escaped. + */ + ASCII = 1, + /** + * Encode all characters that have an equivalent entity, as well as all + * characters that are not ASCII characters. + */ + Extensive = 2, + /** + * Encode all characters that have to be escaped in HTML attributes, + * following {@link https://html.spec.whatwg.org/multipage/parsing.html#escapingString}. + */ + Attribute = 3, + /** + * Encode all characters that have to be escaped in HTML text, + * following {@link https://html.spec.whatwg.org/multipage/parsing.html#escapingString}. + */ + Text = 4 +} +export interface DecodingOptions { + /** + * The level of entities to support. + * @default {@link EntityLevel.XML} + */ + level?: EntityLevel; + /** + * Decoding mode. If `Legacy`, will support legacy entities not terminated + * with a semicolon (`;`). + * + * Always `Strict` for XML. For HTML, set this to `true` if you are parsing + * an attribute value. + * + * The deprecated `decodeStrict` function defaults this to `Strict`. + * + * @default {@link DecodingMode.Legacy} + */ + mode?: DecodingMode; +} /** * Decodes a string with entities. * * @param data String to decode. - * @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0. - * @deprecated Use `decodeXML` or `decodeHTML` directly. + * @param options Decoding options. */ -export declare function decode(data: string, level?: number): string; +export declare function decode(data: string, options?: DecodingOptions | EntityLevel): string; /** * Decodes a string with entities. Does not allow missing trailing semicolons for entities. * * @param data String to decode. - * @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0. - * @deprecated Use `decodeHTMLStrict` or `decodeXML` directly. + * @param options Decoding options. + * @deprecated Use `decode` with the `mode` set to `Strict`. */ -export declare function decodeStrict(data: string, level?: number): string; +export declare function decodeStrict(data: string, options?: DecodingOptions | EntityLevel): string; +/** + * Options for `encode`. + */ +export interface EncodingOptions { + /** + * The level of entities to support. + * @default {@link EntityLevel.XML} + */ + level?: EntityLevel; + /** + * Output format. + * @default {@link EncodingMode.Extensive} + */ + mode?: EncodingMode; +} /** * Encodes a string with entities. * * @param data String to encode. - * @param level Optional level to encode at. 0 = XML, 1 = HTML. Default is 0. - * @deprecated Use `encodeHTML`, `encodeXML` or `encodeNonAsciiHTML` directly. + * @param options Encoding options. */ -export declare function encode(data: string, level?: number): string; -export { encodeXML, encodeHTML, encodeNonAsciiHTML, escape, escapeUTF8, encodeHTML as encodeHTML4, encodeHTML as encodeHTML5, } from "./encode"; -export { decodeXML, decodeHTML, decodeHTMLStrict, decodeHTML as decodeHTML4, decodeHTML as decodeHTML5, decodeHTMLStrict as decodeHTML4Strict, decodeHTMLStrict as decodeHTML5Strict, decodeXML as decodeXMLStrict, } from "./decode"; +export declare function encode(data: string, options?: EncodingOptions | EntityLevel): string; +export { encodeXML, escape, escapeUTF8, escapeAttribute, escapeText, } from "./escape.js"; +export { encodeHTML, encodeNonAsciiHTML, encodeHTML as encodeHTML4, encodeHTML as encodeHTML5, } from "./encode.js"; +export { decodeXML, decodeHTML, decodeHTMLStrict, decodeHTML as decodeHTML4, decodeHTML as decodeHTML5, decodeHTMLStrict as decodeHTML4Strict, decodeHTMLStrict as decodeHTML5Strict, decodeXML as decodeXMLStrict, } from "./decode.js"; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/entities/lib/index.d.ts.map b/node_modules/entities/lib/index.d.ts.map index 24b32ca..5e0e81d 100644 --- a/node_modules/entities/lib/index.d.ts.map +++ b/node_modules/entities/lib/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,OAAO,EACH,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,MAAM,EACN,UAAU,EAEV,UAAU,IAAI,WAAW,EACzB,UAAU,IAAI,WAAW,GAC5B,MAAM,UAAU,CAAC;AAElB,OAAO,EACH,SAAS,EACT,UAAU,EACV,gBAAgB,EAEhB,UAAU,IAAI,WAAW,EACzB,UAAU,IAAI,WAAW,EACzB,gBAAgB,IAAI,iBAAiB,EACrC,gBAAgB,IAAI,iBAAiB,EACrC,SAAS,IAAI,eAAe,GAC/B,MAAM,UAAU,CAAC"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/entities/867ac709ba482a56a98b7c35f49ca833c74dc193/src/","sources":["index.ts"],"names":[],"mappings":"AASA,wCAAwC;AACxC,oBAAY,WAAW;IACnB,iCAAiC;IACjC,GAAG,IAAI;IACP,mEAAmE;IACnE,IAAI,IAAI;CACX;AAED,yFAAyF;AACzF,oBAAY,YAAY;IACpB,oCAAoC;IACpC,MAAM,IAAI;IACV,2CAA2C;IAC3C,MAAM,IAAI;CACb;AAED,oBAAY,YAAY;IACpB;;;OAGG;IACH,IAAI,IAAA;IACJ;;;;OAIG;IACH,KAAK,IAAA;IACL;;;OAGG;IACH,SAAS,IAAA;IACT;;;OAGG;IACH,SAAS,IAAA;IACT;;;OAGG;IACH,IAAI,IAAA;CACP;AAED,MAAM,WAAW,eAAe;IAC5B;;;OAGG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAClB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,eAAe,GAAG,WAA6B,GACzD,MAAM,CAWR;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CACxB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,eAAe,GAAG,WAA6B,GACzD,MAAM,CAWR;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B;;;OAGG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAClB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,eAAe,GAAG,WAA6B,GACzD,MAAM,CAkBR;AAED,OAAO,EACH,SAAS,EACT,MAAM,EACN,UAAU,EACV,eAAe,EACf,UAAU,GACb,MAAM,aAAa,CAAC;AAErB,OAAO,EACH,UAAU,EACV,kBAAkB,EAElB,UAAU,IAAI,WAAW,EACzB,UAAU,IAAI,WAAW,GAC5B,MAAM,aAAa,CAAC;AAErB,OAAO,EACH,SAAS,EACT,UAAU,EACV,gBAAgB,EAEhB,UAAU,IAAI,WAAW,EACzB,UAAU,IAAI,WAAW,EACzB,gBAAgB,IAAI,iBAAiB,EACrC,gBAAgB,IAAI,iBAAiB,EACrC,SAAS,IAAI,eAAe,GAC/B,MAAM,aAAa,CAAC"} \ No newline at end of file diff --git a/node_modules/entities/lib/index.js b/node_modules/entities/lib/index.js index 1b8c3da..3ba8b92 100644 --- a/node_modules/entities/lib/index.js +++ b/node_modules/entities/lib/index.js @@ -1,57 +1,137 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.decodeXMLStrict = exports.decodeHTML5Strict = exports.decodeHTML4Strict = exports.decodeHTML5 = exports.decodeHTML4 = exports.decodeHTMLStrict = exports.decodeHTML = exports.decodeXML = exports.encodeHTML5 = exports.encodeHTML4 = exports.escapeUTF8 = exports.escape = exports.encodeNonAsciiHTML = exports.encodeHTML = exports.encodeXML = exports.encode = exports.decodeStrict = exports.decode = void 0; -var decode_1 = require("./decode"); -var encode_1 = require("./encode"); +exports.decodeXMLStrict = exports.decodeHTML5Strict = exports.decodeHTML4Strict = exports.decodeHTML5 = exports.decodeHTML4 = exports.decodeHTMLStrict = exports.decodeHTML = exports.decodeXML = exports.encodeHTML5 = exports.encodeHTML4 = exports.encodeNonAsciiHTML = exports.encodeHTML = exports.escapeText = exports.escapeAttribute = exports.escapeUTF8 = exports.escape = exports.encodeXML = exports.encode = exports.decodeStrict = exports.decode = exports.EncodingMode = exports.DecodingMode = exports.EntityLevel = void 0; +var decode_js_1 = require("./decode.js"); +var encode_js_1 = require("./encode.js"); +var escape_js_1 = require("./escape.js"); +/** The level of entities to support. */ +var EntityLevel; +(function (EntityLevel) { + /** Support only XML entities. */ + EntityLevel[EntityLevel["XML"] = 0] = "XML"; + /** Support HTML entities, which are a superset of XML entities. */ + EntityLevel[EntityLevel["HTML"] = 1] = "HTML"; +})(EntityLevel = exports.EntityLevel || (exports.EntityLevel = {})); +/** Determines whether some entities are allowed to be written without a trailing `;`. */ +var DecodingMode; +(function (DecodingMode) { + /** Support legacy HTML entities. */ + DecodingMode[DecodingMode["Legacy"] = 0] = "Legacy"; + /** Do not support legacy HTML entities. */ + DecodingMode[DecodingMode["Strict"] = 1] = "Strict"; +})(DecodingMode = exports.DecodingMode || (exports.DecodingMode = {})); +var EncodingMode; +(function (EncodingMode) { + /** + * The output is UTF-8 encoded. Only characters that need escaping within + * XML will be escaped. + */ + EncodingMode[EncodingMode["UTF8"] = 0] = "UTF8"; + /** + * The output consists only of ASCII characters. Characters that need + * escaping within HTML, and characters that aren't ASCII characters will + * be escaped. + */ + EncodingMode[EncodingMode["ASCII"] = 1] = "ASCII"; + /** + * Encode all characters that have an equivalent entity, as well as all + * characters that are not ASCII characters. + */ + EncodingMode[EncodingMode["Extensive"] = 2] = "Extensive"; + /** + * Encode all characters that have to be escaped in HTML attributes, + * following {@link https://html.spec.whatwg.org/multipage/parsing.html#escapingString}. + */ + EncodingMode[EncodingMode["Attribute"] = 3] = "Attribute"; + /** + * Encode all characters that have to be escaped in HTML text, + * following {@link https://html.spec.whatwg.org/multipage/parsing.html#escapingString}. + */ + EncodingMode[EncodingMode["Text"] = 4] = "Text"; +})(EncodingMode = exports.EncodingMode || (exports.EncodingMode = {})); /** * Decodes a string with entities. * * @param data String to decode. - * @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0. - * @deprecated Use `decodeXML` or `decodeHTML` directly. + * @param options Decoding options. */ -function decode(data, level) { - return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTML)(data); +function decode(data, options) { + if (options === void 0) { options = EntityLevel.XML; } + var opts = typeof options === "number" ? { level: options } : options; + if (opts.level === EntityLevel.HTML) { + if (opts.mode === DecodingMode.Strict) { + return (0, decode_js_1.decodeHTMLStrict)(data); + } + return (0, decode_js_1.decodeHTML)(data); + } + return (0, decode_js_1.decodeXML)(data); } exports.decode = decode; /** * Decodes a string with entities. Does not allow missing trailing semicolons for entities. * * @param data String to decode. - * @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0. - * @deprecated Use `decodeHTMLStrict` or `decodeXML` directly. + * @param options Decoding options. + * @deprecated Use `decode` with the `mode` set to `Strict`. */ -function decodeStrict(data, level) { - return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTMLStrict)(data); +function decodeStrict(data, options) { + if (options === void 0) { options = EntityLevel.XML; } + var opts = typeof options === "number" ? { level: options } : options; + if (opts.level === EntityLevel.HTML) { + if (opts.mode === DecodingMode.Legacy) { + return (0, decode_js_1.decodeHTML)(data); + } + return (0, decode_js_1.decodeHTMLStrict)(data); + } + return (0, decode_js_1.decodeXML)(data); } exports.decodeStrict = decodeStrict; /** * Encodes a string with entities. * * @param data String to encode. - * @param level Optional level to encode at. 0 = XML, 1 = HTML. Default is 0. - * @deprecated Use `encodeHTML`, `encodeXML` or `encodeNonAsciiHTML` directly. + * @param options Encoding options. */ -function encode(data, level) { - return (!level || level <= 0 ? encode_1.encodeXML : encode_1.encodeHTML)(data); +function encode(data, options) { + if (options === void 0) { options = EntityLevel.XML; } + var opts = typeof options === "number" ? { level: options } : options; + // Mode `UTF8` just escapes XML entities + if (opts.mode === EncodingMode.UTF8) + return (0, escape_js_1.escapeUTF8)(data); + if (opts.mode === EncodingMode.Attribute) + return (0, escape_js_1.escapeAttribute)(data); + if (opts.mode === EncodingMode.Text) + return (0, escape_js_1.escapeText)(data); + if (opts.level === EntityLevel.HTML) { + if (opts.mode === EncodingMode.ASCII) { + return (0, encode_js_1.encodeNonAsciiHTML)(data); + } + return (0, encode_js_1.encodeHTML)(data); + } + // ASCII and Extensive are equivalent + return (0, escape_js_1.encodeXML)(data); } exports.encode = encode; -var encode_2 = require("./encode"); -Object.defineProperty(exports, "encodeXML", { enumerable: true, get: function () { return encode_2.encodeXML; } }); -Object.defineProperty(exports, "encodeHTML", { enumerable: true, get: function () { return encode_2.encodeHTML; } }); -Object.defineProperty(exports, "encodeNonAsciiHTML", { enumerable: true, get: function () { return encode_2.encodeNonAsciiHTML; } }); -Object.defineProperty(exports, "escape", { enumerable: true, get: function () { return encode_2.escape; } }); -Object.defineProperty(exports, "escapeUTF8", { enumerable: true, get: function () { return encode_2.escapeUTF8; } }); +var escape_js_2 = require("./escape.js"); +Object.defineProperty(exports, "encodeXML", { enumerable: true, get: function () { return escape_js_2.encodeXML; } }); +Object.defineProperty(exports, "escape", { enumerable: true, get: function () { return escape_js_2.escape; } }); +Object.defineProperty(exports, "escapeUTF8", { enumerable: true, get: function () { return escape_js_2.escapeUTF8; } }); +Object.defineProperty(exports, "escapeAttribute", { enumerable: true, get: function () { return escape_js_2.escapeAttribute; } }); +Object.defineProperty(exports, "escapeText", { enumerable: true, get: function () { return escape_js_2.escapeText; } }); +var encode_js_2 = require("./encode.js"); +Object.defineProperty(exports, "encodeHTML", { enumerable: true, get: function () { return encode_js_2.encodeHTML; } }); +Object.defineProperty(exports, "encodeNonAsciiHTML", { enumerable: true, get: function () { return encode_js_2.encodeNonAsciiHTML; } }); // Legacy aliases (deprecated) -Object.defineProperty(exports, "encodeHTML4", { enumerable: true, get: function () { return encode_2.encodeHTML; } }); -Object.defineProperty(exports, "encodeHTML5", { enumerable: true, get: function () { return encode_2.encodeHTML; } }); -var decode_2 = require("./decode"); -Object.defineProperty(exports, "decodeXML", { enumerable: true, get: function () { return decode_2.decodeXML; } }); -Object.defineProperty(exports, "decodeHTML", { enumerable: true, get: function () { return decode_2.decodeHTML; } }); -Object.defineProperty(exports, "decodeHTMLStrict", { enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } }); +Object.defineProperty(exports, "encodeHTML4", { enumerable: true, get: function () { return encode_js_2.encodeHTML; } }); +Object.defineProperty(exports, "encodeHTML5", { enumerable: true, get: function () { return encode_js_2.encodeHTML; } }); +var decode_js_2 = require("./decode.js"); +Object.defineProperty(exports, "decodeXML", { enumerable: true, get: function () { return decode_js_2.decodeXML; } }); +Object.defineProperty(exports, "decodeHTML", { enumerable: true, get: function () { return decode_js_2.decodeHTML; } }); +Object.defineProperty(exports, "decodeHTMLStrict", { enumerable: true, get: function () { return decode_js_2.decodeHTMLStrict; } }); // Legacy aliases (deprecated) -Object.defineProperty(exports, "decodeHTML4", { enumerable: true, get: function () { return decode_2.decodeHTML; } }); -Object.defineProperty(exports, "decodeHTML5", { enumerable: true, get: function () { return decode_2.decodeHTML; } }); -Object.defineProperty(exports, "decodeHTML4Strict", { enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } }); -Object.defineProperty(exports, "decodeHTML5Strict", { enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } }); -Object.defineProperty(exports, "decodeXMLStrict", { enumerable: true, get: function () { return decode_2.decodeXML; } }); +Object.defineProperty(exports, "decodeHTML4", { enumerable: true, get: function () { return decode_js_2.decodeHTML; } }); +Object.defineProperty(exports, "decodeHTML5", { enumerable: true, get: function () { return decode_js_2.decodeHTML; } }); +Object.defineProperty(exports, "decodeHTML4Strict", { enumerable: true, get: function () { return decode_js_2.decodeHTMLStrict; } }); +Object.defineProperty(exports, "decodeHTML5Strict", { enumerable: true, get: function () { return decode_js_2.decodeHTMLStrict; } }); +Object.defineProperty(exports, "decodeXMLStrict", { enumerable: true, get: function () { return decode_js_2.decodeXML; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/entities/lib/maps/decode.json b/node_modules/entities/lib/maps/decode.json deleted file mode 100644 index 80ef449..0000000 --- a/node_modules/entities/lib/maps/decode.json +++ /dev/null @@ -1 +0,0 @@ -{"0":65533,"128":8364,"130":8218,"131":402,"132":8222,"133":8230,"134":8224,"135":8225,"136":710,"137":8240,"138":352,"139":8249,"140":338,"142":381,"145":8216,"146":8217,"147":8220,"148":8221,"149":8226,"150":8211,"151":8212,"152":732,"153":8482,"154":353,"155":8250,"156":339,"158":382,"159":376} diff --git a/node_modules/entities/lib/maps/entities.json b/node_modules/entities/lib/maps/entities.json deleted file mode 100644 index c5b1c4e..0000000 --- a/node_modules/entities/lib/maps/entities.json +++ /dev/null @@ -1 +0,0 @@ -{"Aacute":"Á","aacute":"á","Abreve":"Ă","abreve":"ă","ac":"∾","acd":"∿","acE":"∾̳","Acirc":"Â","acirc":"â","acute":"´","Acy":"А","acy":"а","AElig":"Æ","aelig":"æ","af":"⁡","Afr":"𝔄","afr":"𝔞","Agrave":"À","agrave":"à","alefsym":"ℵ","aleph":"ℵ","Alpha":"Α","alpha":"α","Amacr":"Ā","amacr":"ā","amalg":"⨿","amp":"&","AMP":"&","andand":"⩕","And":"⩓","and":"∧","andd":"⩜","andslope":"⩘","andv":"⩚","ang":"∠","ange":"⦤","angle":"∠","angmsdaa":"⦨","angmsdab":"⦩","angmsdac":"⦪","angmsdad":"⦫","angmsdae":"⦬","angmsdaf":"⦭","angmsdag":"⦮","angmsdah":"⦯","angmsd":"∡","angrt":"∟","angrtvb":"⊾","angrtvbd":"⦝","angsph":"∢","angst":"Å","angzarr":"⍼","Aogon":"Ą","aogon":"ą","Aopf":"𝔸","aopf":"𝕒","apacir":"⩯","ap":"≈","apE":"⩰","ape":"≊","apid":"≋","apos":"'","ApplyFunction":"⁡","approx":"≈","approxeq":"≊","Aring":"Å","aring":"å","Ascr":"𝒜","ascr":"𝒶","Assign":"≔","ast":"*","asymp":"≈","asympeq":"≍","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","awconint":"∳","awint":"⨑","backcong":"≌","backepsilon":"϶","backprime":"‵","backsim":"∽","backsimeq":"⋍","Backslash":"∖","Barv":"⫧","barvee":"⊽","barwed":"⌅","Barwed":"⌆","barwedge":"⌅","bbrk":"⎵","bbrktbrk":"⎶","bcong":"≌","Bcy":"Б","bcy":"б","bdquo":"„","becaus":"∵","because":"∵","Because":"∵","bemptyv":"⦰","bepsi":"϶","bernou":"ℬ","Bernoullis":"ℬ","Beta":"Β","beta":"β","beth":"ℶ","between":"≬","Bfr":"𝔅","bfr":"𝔟","bigcap":"⋂","bigcirc":"◯","bigcup":"⋃","bigodot":"⨀","bigoplus":"⨁","bigotimes":"⨂","bigsqcup":"⨆","bigstar":"★","bigtriangledown":"▽","bigtriangleup":"△","biguplus":"⨄","bigvee":"⋁","bigwedge":"⋀","bkarow":"⤍","blacklozenge":"⧫","blacksquare":"▪","blacktriangle":"▴","blacktriangledown":"▾","blacktriangleleft":"◂","blacktriangleright":"▸","blank":"␣","blk12":"▒","blk14":"░","blk34":"▓","block":"█","bne":"=⃥","bnequiv":"≡⃥","bNot":"⫭","bnot":"⌐","Bopf":"𝔹","bopf":"𝕓","bot":"⊥","bottom":"⊥","bowtie":"⋈","boxbox":"⧉","boxdl":"┐","boxdL":"╕","boxDl":"╖","boxDL":"╗","boxdr":"┌","boxdR":"╒","boxDr":"╓","boxDR":"╔","boxh":"─","boxH":"═","boxhd":"┬","boxHd":"╤","boxhD":"╥","boxHD":"╦","boxhu":"┴","boxHu":"╧","boxhU":"╨","boxHU":"╩","boxminus":"⊟","boxplus":"⊞","boxtimes":"⊠","boxul":"┘","boxuL":"╛","boxUl":"╜","boxUL":"╝","boxur":"└","boxuR":"╘","boxUr":"╙","boxUR":"╚","boxv":"│","boxV":"║","boxvh":"┼","boxvH":"╪","boxVh":"╫","boxVH":"╬","boxvl":"┤","boxvL":"╡","boxVl":"╢","boxVL":"╣","boxvr":"├","boxvR":"╞","boxVr":"╟","boxVR":"╠","bprime":"‵","breve":"˘","Breve":"˘","brvbar":"¦","bscr":"𝒷","Bscr":"ℬ","bsemi":"⁏","bsim":"∽","bsime":"⋍","bsolb":"⧅","bsol":"\\","bsolhsub":"⟈","bull":"•","bullet":"•","bump":"≎","bumpE":"⪮","bumpe":"≏","Bumpeq":"≎","bumpeq":"≏","Cacute":"Ć","cacute":"ć","capand":"⩄","capbrcup":"⩉","capcap":"⩋","cap":"∩","Cap":"⋒","capcup":"⩇","capdot":"⩀","CapitalDifferentialD":"ⅅ","caps":"∩︀","caret":"⁁","caron":"ˇ","Cayleys":"ℭ","ccaps":"⩍","Ccaron":"Č","ccaron":"č","Ccedil":"Ç","ccedil":"ç","Ccirc":"Ĉ","ccirc":"ĉ","Cconint":"∰","ccups":"⩌","ccupssm":"⩐","Cdot":"Ċ","cdot":"ċ","cedil":"¸","Cedilla":"¸","cemptyv":"⦲","cent":"¢","centerdot":"·","CenterDot":"·","cfr":"𝔠","Cfr":"ℭ","CHcy":"Ч","chcy":"ч","check":"✓","checkmark":"✓","Chi":"Χ","chi":"χ","circ":"ˆ","circeq":"≗","circlearrowleft":"↺","circlearrowright":"↻","circledast":"⊛","circledcirc":"⊚","circleddash":"⊝","CircleDot":"⊙","circledR":"®","circledS":"Ⓢ","CircleMinus":"⊖","CirclePlus":"⊕","CircleTimes":"⊗","cir":"○","cirE":"⧃","cire":"≗","cirfnint":"⨐","cirmid":"⫯","cirscir":"⧂","ClockwiseContourIntegral":"∲","CloseCurlyDoubleQuote":"”","CloseCurlyQuote":"’","clubs":"♣","clubsuit":"♣","colon":":","Colon":"∷","Colone":"⩴","colone":"≔","coloneq":"≔","comma":",","commat":"@","comp":"∁","compfn":"∘","complement":"∁","complexes":"ℂ","cong":"≅","congdot":"⩭","Congruent":"≡","conint":"∮","Conint":"∯","ContourIntegral":"∮","copf":"𝕔","Copf":"ℂ","coprod":"∐","Coproduct":"∐","copy":"©","COPY":"©","copysr":"℗","CounterClockwiseContourIntegral":"∳","crarr":"↵","cross":"✗","Cross":"⨯","Cscr":"𝒞","cscr":"𝒸","csub":"⫏","csube":"⫑","csup":"⫐","csupe":"⫒","ctdot":"⋯","cudarrl":"⤸","cudarrr":"⤵","cuepr":"⋞","cuesc":"⋟","cularr":"↶","cularrp":"⤽","cupbrcap":"⩈","cupcap":"⩆","CupCap":"≍","cup":"∪","Cup":"⋓","cupcup":"⩊","cupdot":"⊍","cupor":"⩅","cups":"∪︀","curarr":"↷","curarrm":"⤼","curlyeqprec":"⋞","curlyeqsucc":"⋟","curlyvee":"⋎","curlywedge":"⋏","curren":"¤","curvearrowleft":"↶","curvearrowright":"↷","cuvee":"⋎","cuwed":"⋏","cwconint":"∲","cwint":"∱","cylcty":"⌭","dagger":"†","Dagger":"‡","daleth":"ℸ","darr":"↓","Darr":"↡","dArr":"⇓","dash":"‐","Dashv":"⫤","dashv":"⊣","dbkarow":"⤏","dblac":"˝","Dcaron":"Ď","dcaron":"ď","Dcy":"Д","dcy":"д","ddagger":"‡","ddarr":"⇊","DD":"ⅅ","dd":"ⅆ","DDotrahd":"⤑","ddotseq":"⩷","deg":"°","Del":"∇","Delta":"Δ","delta":"δ","demptyv":"⦱","dfisht":"⥿","Dfr":"𝔇","dfr":"𝔡","dHar":"⥥","dharl":"⇃","dharr":"⇂","DiacriticalAcute":"´","DiacriticalDot":"˙","DiacriticalDoubleAcute":"˝","DiacriticalGrave":"`","DiacriticalTilde":"˜","diam":"⋄","diamond":"⋄","Diamond":"⋄","diamondsuit":"♦","diams":"♦","die":"¨","DifferentialD":"ⅆ","digamma":"ϝ","disin":"⋲","div":"÷","divide":"÷","divideontimes":"⋇","divonx":"⋇","DJcy":"Ђ","djcy":"ђ","dlcorn":"⌞","dlcrop":"⌍","dollar":"$","Dopf":"𝔻","dopf":"𝕕","Dot":"¨","dot":"˙","DotDot":"⃜","doteq":"≐","doteqdot":"≑","DotEqual":"≐","dotminus":"∸","dotplus":"∔","dotsquare":"⊡","doublebarwedge":"⌆","DoubleContourIntegral":"∯","DoubleDot":"¨","DoubleDownArrow":"⇓","DoubleLeftArrow":"⇐","DoubleLeftRightArrow":"⇔","DoubleLeftTee":"⫤","DoubleLongLeftArrow":"⟸","DoubleLongLeftRightArrow":"⟺","DoubleLongRightArrow":"⟹","DoubleRightArrow":"⇒","DoubleRightTee":"⊨","DoubleUpArrow":"⇑","DoubleUpDownArrow":"⇕","DoubleVerticalBar":"∥","DownArrowBar":"⤓","downarrow":"↓","DownArrow":"↓","Downarrow":"⇓","DownArrowUpArrow":"⇵","DownBreve":"̑","downdownarrows":"⇊","downharpoonleft":"⇃","downharpoonright":"⇂","DownLeftRightVector":"⥐","DownLeftTeeVector":"⥞","DownLeftVectorBar":"⥖","DownLeftVector":"↽","DownRightTeeVector":"⥟","DownRightVectorBar":"⥗","DownRightVector":"⇁","DownTeeArrow":"↧","DownTee":"⊤","drbkarow":"⤐","drcorn":"⌟","drcrop":"⌌","Dscr":"𝒟","dscr":"𝒹","DScy":"Ѕ","dscy":"ѕ","dsol":"⧶","Dstrok":"Đ","dstrok":"đ","dtdot":"⋱","dtri":"▿","dtrif":"▾","duarr":"⇵","duhar":"⥯","dwangle":"⦦","DZcy":"Џ","dzcy":"џ","dzigrarr":"⟿","Eacute":"É","eacute":"é","easter":"⩮","Ecaron":"Ě","ecaron":"ě","Ecirc":"Ê","ecirc":"ê","ecir":"≖","ecolon":"≕","Ecy":"Э","ecy":"э","eDDot":"⩷","Edot":"Ė","edot":"ė","eDot":"≑","ee":"ⅇ","efDot":"≒","Efr":"𝔈","efr":"𝔢","eg":"⪚","Egrave":"È","egrave":"è","egs":"⪖","egsdot":"⪘","el":"⪙","Element":"∈","elinters":"⏧","ell":"ℓ","els":"⪕","elsdot":"⪗","Emacr":"Ē","emacr":"ē","empty":"∅","emptyset":"∅","EmptySmallSquare":"◻","emptyv":"∅","EmptyVerySmallSquare":"▫","emsp13":" ","emsp14":" ","emsp":" ","ENG":"Ŋ","eng":"ŋ","ensp":" ","Eogon":"Ę","eogon":"ę","Eopf":"𝔼","eopf":"𝕖","epar":"⋕","eparsl":"⧣","eplus":"⩱","epsi":"ε","Epsilon":"Ε","epsilon":"ε","epsiv":"ϵ","eqcirc":"≖","eqcolon":"≕","eqsim":"≂","eqslantgtr":"⪖","eqslantless":"⪕","Equal":"⩵","equals":"=","EqualTilde":"≂","equest":"≟","Equilibrium":"⇌","equiv":"≡","equivDD":"⩸","eqvparsl":"⧥","erarr":"⥱","erDot":"≓","escr":"ℯ","Escr":"ℰ","esdot":"≐","Esim":"⩳","esim":"≂","Eta":"Η","eta":"η","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","euro":"€","excl":"!","exist":"∃","Exists":"∃","expectation":"ℰ","exponentiale":"ⅇ","ExponentialE":"ⅇ","fallingdotseq":"≒","Fcy":"Ф","fcy":"ф","female":"♀","ffilig":"ffi","fflig":"ff","ffllig":"ffl","Ffr":"𝔉","ffr":"𝔣","filig":"fi","FilledSmallSquare":"◼","FilledVerySmallSquare":"▪","fjlig":"fj","flat":"♭","fllig":"fl","fltns":"▱","fnof":"ƒ","Fopf":"𝔽","fopf":"𝕗","forall":"∀","ForAll":"∀","fork":"⋔","forkv":"⫙","Fouriertrf":"ℱ","fpartint":"⨍","frac12":"½","frac13":"⅓","frac14":"¼","frac15":"⅕","frac16":"⅙","frac18":"⅛","frac23":"⅔","frac25":"⅖","frac34":"¾","frac35":"⅗","frac38":"⅜","frac45":"⅘","frac56":"⅚","frac58":"⅝","frac78":"⅞","frasl":"⁄","frown":"⌢","fscr":"𝒻","Fscr":"ℱ","gacute":"ǵ","Gamma":"Γ","gamma":"γ","Gammad":"Ϝ","gammad":"ϝ","gap":"⪆","Gbreve":"Ğ","gbreve":"ğ","Gcedil":"Ģ","Gcirc":"Ĝ","gcirc":"ĝ","Gcy":"Г","gcy":"г","Gdot":"Ġ","gdot":"ġ","ge":"≥","gE":"≧","gEl":"⪌","gel":"⋛","geq":"≥","geqq":"≧","geqslant":"⩾","gescc":"⪩","ges":"⩾","gesdot":"⪀","gesdoto":"⪂","gesdotol":"⪄","gesl":"⋛︀","gesles":"⪔","Gfr":"𝔊","gfr":"𝔤","gg":"≫","Gg":"⋙","ggg":"⋙","gimel":"ℷ","GJcy":"Ѓ","gjcy":"ѓ","gla":"⪥","gl":"≷","glE":"⪒","glj":"⪤","gnap":"⪊","gnapprox":"⪊","gne":"⪈","gnE":"≩","gneq":"⪈","gneqq":"≩","gnsim":"⋧","Gopf":"𝔾","gopf":"𝕘","grave":"`","GreaterEqual":"≥","GreaterEqualLess":"⋛","GreaterFullEqual":"≧","GreaterGreater":"⪢","GreaterLess":"≷","GreaterSlantEqual":"⩾","GreaterTilde":"≳","Gscr":"𝒢","gscr":"ℊ","gsim":"≳","gsime":"⪎","gsiml":"⪐","gtcc":"⪧","gtcir":"⩺","gt":">","GT":">","Gt":"≫","gtdot":"⋗","gtlPar":"⦕","gtquest":"⩼","gtrapprox":"⪆","gtrarr":"⥸","gtrdot":"⋗","gtreqless":"⋛","gtreqqless":"⪌","gtrless":"≷","gtrsim":"≳","gvertneqq":"≩︀","gvnE":"≩︀","Hacek":"ˇ","hairsp":" ","half":"½","hamilt":"ℋ","HARDcy":"Ъ","hardcy":"ъ","harrcir":"⥈","harr":"↔","hArr":"⇔","harrw":"↭","Hat":"^","hbar":"ℏ","Hcirc":"Ĥ","hcirc":"ĥ","hearts":"♥","heartsuit":"♥","hellip":"…","hercon":"⊹","hfr":"𝔥","Hfr":"ℌ","HilbertSpace":"ℋ","hksearow":"⤥","hkswarow":"⤦","hoarr":"⇿","homtht":"∻","hookleftarrow":"↩","hookrightarrow":"↪","hopf":"𝕙","Hopf":"ℍ","horbar":"―","HorizontalLine":"─","hscr":"𝒽","Hscr":"ℋ","hslash":"ℏ","Hstrok":"Ħ","hstrok":"ħ","HumpDownHump":"≎","HumpEqual":"≏","hybull":"⁃","hyphen":"‐","Iacute":"Í","iacute":"í","ic":"⁣","Icirc":"Î","icirc":"î","Icy":"И","icy":"и","Idot":"İ","IEcy":"Е","iecy":"е","iexcl":"¡","iff":"⇔","ifr":"𝔦","Ifr":"ℑ","Igrave":"Ì","igrave":"ì","ii":"ⅈ","iiiint":"⨌","iiint":"∭","iinfin":"⧜","iiota":"℩","IJlig":"IJ","ijlig":"ij","Imacr":"Ī","imacr":"ī","image":"ℑ","ImaginaryI":"ⅈ","imagline":"ℐ","imagpart":"ℑ","imath":"ı","Im":"ℑ","imof":"⊷","imped":"Ƶ","Implies":"⇒","incare":"℅","in":"∈","infin":"∞","infintie":"⧝","inodot":"ı","intcal":"⊺","int":"∫","Int":"∬","integers":"ℤ","Integral":"∫","intercal":"⊺","Intersection":"⋂","intlarhk":"⨗","intprod":"⨼","InvisibleComma":"⁣","InvisibleTimes":"⁢","IOcy":"Ё","iocy":"ё","Iogon":"Į","iogon":"į","Iopf":"𝕀","iopf":"𝕚","Iota":"Ι","iota":"ι","iprod":"⨼","iquest":"¿","iscr":"𝒾","Iscr":"ℐ","isin":"∈","isindot":"⋵","isinE":"⋹","isins":"⋴","isinsv":"⋳","isinv":"∈","it":"⁢","Itilde":"Ĩ","itilde":"ĩ","Iukcy":"І","iukcy":"і","Iuml":"Ï","iuml":"ï","Jcirc":"Ĵ","jcirc":"ĵ","Jcy":"Й","jcy":"й","Jfr":"𝔍","jfr":"𝔧","jmath":"ȷ","Jopf":"𝕁","jopf":"𝕛","Jscr":"𝒥","jscr":"𝒿","Jsercy":"Ј","jsercy":"ј","Jukcy":"Є","jukcy":"є","Kappa":"Κ","kappa":"κ","kappav":"ϰ","Kcedil":"Ķ","kcedil":"ķ","Kcy":"К","kcy":"к","Kfr":"𝔎","kfr":"𝔨","kgreen":"ĸ","KHcy":"Х","khcy":"х","KJcy":"Ќ","kjcy":"ќ","Kopf":"𝕂","kopf":"𝕜","Kscr":"𝒦","kscr":"𝓀","lAarr":"⇚","Lacute":"Ĺ","lacute":"ĺ","laemptyv":"⦴","lagran":"ℒ","Lambda":"Λ","lambda":"λ","lang":"⟨","Lang":"⟪","langd":"⦑","langle":"⟨","lap":"⪅","Laplacetrf":"ℒ","laquo":"«","larrb":"⇤","larrbfs":"⤟","larr":"←","Larr":"↞","lArr":"⇐","larrfs":"⤝","larrhk":"↩","larrlp":"↫","larrpl":"⤹","larrsim":"⥳","larrtl":"↢","latail":"⤙","lAtail":"⤛","lat":"⪫","late":"⪭","lates":"⪭︀","lbarr":"⤌","lBarr":"⤎","lbbrk":"❲","lbrace":"{","lbrack":"[","lbrke":"⦋","lbrksld":"⦏","lbrkslu":"⦍","Lcaron":"Ľ","lcaron":"ľ","Lcedil":"Ļ","lcedil":"ļ","lceil":"⌈","lcub":"{","Lcy":"Л","lcy":"л","ldca":"⤶","ldquo":"“","ldquor":"„","ldrdhar":"⥧","ldrushar":"⥋","ldsh":"↲","le":"≤","lE":"≦","LeftAngleBracket":"⟨","LeftArrowBar":"⇤","leftarrow":"←","LeftArrow":"←","Leftarrow":"⇐","LeftArrowRightArrow":"⇆","leftarrowtail":"↢","LeftCeiling":"⌈","LeftDoubleBracket":"⟦","LeftDownTeeVector":"⥡","LeftDownVectorBar":"⥙","LeftDownVector":"⇃","LeftFloor":"⌊","leftharpoondown":"↽","leftharpoonup":"↼","leftleftarrows":"⇇","leftrightarrow":"↔","LeftRightArrow":"↔","Leftrightarrow":"⇔","leftrightarrows":"⇆","leftrightharpoons":"⇋","leftrightsquigarrow":"↭","LeftRightVector":"⥎","LeftTeeArrow":"↤","LeftTee":"⊣","LeftTeeVector":"⥚","leftthreetimes":"⋋","LeftTriangleBar":"⧏","LeftTriangle":"⊲","LeftTriangleEqual":"⊴","LeftUpDownVector":"⥑","LeftUpTeeVector":"⥠","LeftUpVectorBar":"⥘","LeftUpVector":"↿","LeftVectorBar":"⥒","LeftVector":"↼","lEg":"⪋","leg":"⋚","leq":"≤","leqq":"≦","leqslant":"⩽","lescc":"⪨","les":"⩽","lesdot":"⩿","lesdoto":"⪁","lesdotor":"⪃","lesg":"⋚︀","lesges":"⪓","lessapprox":"⪅","lessdot":"⋖","lesseqgtr":"⋚","lesseqqgtr":"⪋","LessEqualGreater":"⋚","LessFullEqual":"≦","LessGreater":"≶","lessgtr":"≶","LessLess":"⪡","lesssim":"≲","LessSlantEqual":"⩽","LessTilde":"≲","lfisht":"⥼","lfloor":"⌊","Lfr":"𝔏","lfr":"𝔩","lg":"≶","lgE":"⪑","lHar":"⥢","lhard":"↽","lharu":"↼","lharul":"⥪","lhblk":"▄","LJcy":"Љ","ljcy":"љ","llarr":"⇇","ll":"≪","Ll":"⋘","llcorner":"⌞","Lleftarrow":"⇚","llhard":"⥫","lltri":"◺","Lmidot":"Ŀ","lmidot":"ŀ","lmoustache":"⎰","lmoust":"⎰","lnap":"⪉","lnapprox":"⪉","lne":"⪇","lnE":"≨","lneq":"⪇","lneqq":"≨","lnsim":"⋦","loang":"⟬","loarr":"⇽","lobrk":"⟦","longleftarrow":"⟵","LongLeftArrow":"⟵","Longleftarrow":"⟸","longleftrightarrow":"⟷","LongLeftRightArrow":"⟷","Longleftrightarrow":"⟺","longmapsto":"⟼","longrightarrow":"⟶","LongRightArrow":"⟶","Longrightarrow":"⟹","looparrowleft":"↫","looparrowright":"↬","lopar":"⦅","Lopf":"𝕃","lopf":"𝕝","loplus":"⨭","lotimes":"⨴","lowast":"∗","lowbar":"_","LowerLeftArrow":"↙","LowerRightArrow":"↘","loz":"◊","lozenge":"◊","lozf":"⧫","lpar":"(","lparlt":"⦓","lrarr":"⇆","lrcorner":"⌟","lrhar":"⇋","lrhard":"⥭","lrm":"‎","lrtri":"⊿","lsaquo":"‹","lscr":"𝓁","Lscr":"ℒ","lsh":"↰","Lsh":"↰","lsim":"≲","lsime":"⪍","lsimg":"⪏","lsqb":"[","lsquo":"‘","lsquor":"‚","Lstrok":"Ł","lstrok":"ł","ltcc":"⪦","ltcir":"⩹","lt":"<","LT":"<","Lt":"≪","ltdot":"⋖","lthree":"⋋","ltimes":"⋉","ltlarr":"⥶","ltquest":"⩻","ltri":"◃","ltrie":"⊴","ltrif":"◂","ltrPar":"⦖","lurdshar":"⥊","luruhar":"⥦","lvertneqq":"≨︀","lvnE":"≨︀","macr":"¯","male":"♂","malt":"✠","maltese":"✠","Map":"⤅","map":"↦","mapsto":"↦","mapstodown":"↧","mapstoleft":"↤","mapstoup":"↥","marker":"▮","mcomma":"⨩","Mcy":"М","mcy":"м","mdash":"—","mDDot":"∺","measuredangle":"∡","MediumSpace":" ","Mellintrf":"ℳ","Mfr":"𝔐","mfr":"𝔪","mho":"℧","micro":"µ","midast":"*","midcir":"⫰","mid":"∣","middot":"·","minusb":"⊟","minus":"−","minusd":"∸","minusdu":"⨪","MinusPlus":"∓","mlcp":"⫛","mldr":"…","mnplus":"∓","models":"⊧","Mopf":"𝕄","mopf":"𝕞","mp":"∓","mscr":"𝓂","Mscr":"ℳ","mstpos":"∾","Mu":"Μ","mu":"μ","multimap":"⊸","mumap":"⊸","nabla":"∇","Nacute":"Ń","nacute":"ń","nang":"∠⃒","nap":"≉","napE":"⩰̸","napid":"≋̸","napos":"ʼn","napprox":"≉","natural":"♮","naturals":"ℕ","natur":"♮","nbsp":" ","nbump":"≎̸","nbumpe":"≏̸","ncap":"⩃","Ncaron":"Ň","ncaron":"ň","Ncedil":"Ņ","ncedil":"ņ","ncong":"≇","ncongdot":"⩭̸","ncup":"⩂","Ncy":"Н","ncy":"н","ndash":"–","nearhk":"⤤","nearr":"↗","neArr":"⇗","nearrow":"↗","ne":"≠","nedot":"≐̸","NegativeMediumSpace":"​","NegativeThickSpace":"​","NegativeThinSpace":"​","NegativeVeryThinSpace":"​","nequiv":"≢","nesear":"⤨","nesim":"≂̸","NestedGreaterGreater":"≫","NestedLessLess":"≪","NewLine":"\n","nexist":"∄","nexists":"∄","Nfr":"𝔑","nfr":"𝔫","ngE":"≧̸","nge":"≱","ngeq":"≱","ngeqq":"≧̸","ngeqslant":"⩾̸","nges":"⩾̸","nGg":"⋙̸","ngsim":"≵","nGt":"≫⃒","ngt":"≯","ngtr":"≯","nGtv":"≫̸","nharr":"↮","nhArr":"⇎","nhpar":"⫲","ni":"∋","nis":"⋼","nisd":"⋺","niv":"∋","NJcy":"Њ","njcy":"њ","nlarr":"↚","nlArr":"⇍","nldr":"‥","nlE":"≦̸","nle":"≰","nleftarrow":"↚","nLeftarrow":"⇍","nleftrightarrow":"↮","nLeftrightarrow":"⇎","nleq":"≰","nleqq":"≦̸","nleqslant":"⩽̸","nles":"⩽̸","nless":"≮","nLl":"⋘̸","nlsim":"≴","nLt":"≪⃒","nlt":"≮","nltri":"⋪","nltrie":"⋬","nLtv":"≪̸","nmid":"∤","NoBreak":"⁠","NonBreakingSpace":" ","nopf":"𝕟","Nopf":"ℕ","Not":"⫬","not":"¬","NotCongruent":"≢","NotCupCap":"≭","NotDoubleVerticalBar":"∦","NotElement":"∉","NotEqual":"≠","NotEqualTilde":"≂̸","NotExists":"∄","NotGreater":"≯","NotGreaterEqual":"≱","NotGreaterFullEqual":"≧̸","NotGreaterGreater":"≫̸","NotGreaterLess":"≹","NotGreaterSlantEqual":"⩾̸","NotGreaterTilde":"≵","NotHumpDownHump":"≎̸","NotHumpEqual":"≏̸","notin":"∉","notindot":"⋵̸","notinE":"⋹̸","notinva":"∉","notinvb":"⋷","notinvc":"⋶","NotLeftTriangleBar":"⧏̸","NotLeftTriangle":"⋪","NotLeftTriangleEqual":"⋬","NotLess":"≮","NotLessEqual":"≰","NotLessGreater":"≸","NotLessLess":"≪̸","NotLessSlantEqual":"⩽̸","NotLessTilde":"≴","NotNestedGreaterGreater":"⪢̸","NotNestedLessLess":"⪡̸","notni":"∌","notniva":"∌","notnivb":"⋾","notnivc":"⋽","NotPrecedes":"⊀","NotPrecedesEqual":"⪯̸","NotPrecedesSlantEqual":"⋠","NotReverseElement":"∌","NotRightTriangleBar":"⧐̸","NotRightTriangle":"⋫","NotRightTriangleEqual":"⋭","NotSquareSubset":"⊏̸","NotSquareSubsetEqual":"⋢","NotSquareSuperset":"⊐̸","NotSquareSupersetEqual":"⋣","NotSubset":"⊂⃒","NotSubsetEqual":"⊈","NotSucceeds":"⊁","NotSucceedsEqual":"⪰̸","NotSucceedsSlantEqual":"⋡","NotSucceedsTilde":"≿̸","NotSuperset":"⊃⃒","NotSupersetEqual":"⊉","NotTilde":"≁","NotTildeEqual":"≄","NotTildeFullEqual":"≇","NotTildeTilde":"≉","NotVerticalBar":"∤","nparallel":"∦","npar":"∦","nparsl":"⫽⃥","npart":"∂̸","npolint":"⨔","npr":"⊀","nprcue":"⋠","nprec":"⊀","npreceq":"⪯̸","npre":"⪯̸","nrarrc":"⤳̸","nrarr":"↛","nrArr":"⇏","nrarrw":"↝̸","nrightarrow":"↛","nRightarrow":"⇏","nrtri":"⋫","nrtrie":"⋭","nsc":"⊁","nsccue":"⋡","nsce":"⪰̸","Nscr":"𝒩","nscr":"𝓃","nshortmid":"∤","nshortparallel":"∦","nsim":"≁","nsime":"≄","nsimeq":"≄","nsmid":"∤","nspar":"∦","nsqsube":"⋢","nsqsupe":"⋣","nsub":"⊄","nsubE":"⫅̸","nsube":"⊈","nsubset":"⊂⃒","nsubseteq":"⊈","nsubseteqq":"⫅̸","nsucc":"⊁","nsucceq":"⪰̸","nsup":"⊅","nsupE":"⫆̸","nsupe":"⊉","nsupset":"⊃⃒","nsupseteq":"⊉","nsupseteqq":"⫆̸","ntgl":"≹","Ntilde":"Ñ","ntilde":"ñ","ntlg":"≸","ntriangleleft":"⋪","ntrianglelefteq":"⋬","ntriangleright":"⋫","ntrianglerighteq":"⋭","Nu":"Ν","nu":"ν","num":"#","numero":"№","numsp":" ","nvap":"≍⃒","nvdash":"⊬","nvDash":"⊭","nVdash":"⊮","nVDash":"⊯","nvge":"≥⃒","nvgt":">⃒","nvHarr":"⤄","nvinfin":"⧞","nvlArr":"⤂","nvle":"≤⃒","nvlt":"<⃒","nvltrie":"⊴⃒","nvrArr":"⤃","nvrtrie":"⊵⃒","nvsim":"∼⃒","nwarhk":"⤣","nwarr":"↖","nwArr":"⇖","nwarrow":"↖","nwnear":"⤧","Oacute":"Ó","oacute":"ó","oast":"⊛","Ocirc":"Ô","ocirc":"ô","ocir":"⊚","Ocy":"О","ocy":"о","odash":"⊝","Odblac":"Ő","odblac":"ő","odiv":"⨸","odot":"⊙","odsold":"⦼","OElig":"Œ","oelig":"œ","ofcir":"⦿","Ofr":"𝔒","ofr":"𝔬","ogon":"˛","Ograve":"Ò","ograve":"ò","ogt":"⧁","ohbar":"⦵","ohm":"Ω","oint":"∮","olarr":"↺","olcir":"⦾","olcross":"⦻","oline":"‾","olt":"⧀","Omacr":"Ō","omacr":"ō","Omega":"Ω","omega":"ω","Omicron":"Ο","omicron":"ο","omid":"⦶","ominus":"⊖","Oopf":"𝕆","oopf":"𝕠","opar":"⦷","OpenCurlyDoubleQuote":"“","OpenCurlyQuote":"‘","operp":"⦹","oplus":"⊕","orarr":"↻","Or":"⩔","or":"∨","ord":"⩝","order":"ℴ","orderof":"ℴ","ordf":"ª","ordm":"º","origof":"⊶","oror":"⩖","orslope":"⩗","orv":"⩛","oS":"Ⓢ","Oscr":"𝒪","oscr":"ℴ","Oslash":"Ø","oslash":"ø","osol":"⊘","Otilde":"Õ","otilde":"õ","otimesas":"⨶","Otimes":"⨷","otimes":"⊗","Ouml":"Ö","ouml":"ö","ovbar":"⌽","OverBar":"‾","OverBrace":"⏞","OverBracket":"⎴","OverParenthesis":"⏜","para":"¶","parallel":"∥","par":"∥","parsim":"⫳","parsl":"⫽","part":"∂","PartialD":"∂","Pcy":"П","pcy":"п","percnt":"%","period":".","permil":"‰","perp":"⊥","pertenk":"‱","Pfr":"𝔓","pfr":"𝔭","Phi":"Φ","phi":"φ","phiv":"ϕ","phmmat":"ℳ","phone":"☎","Pi":"Π","pi":"π","pitchfork":"⋔","piv":"ϖ","planck":"ℏ","planckh":"ℎ","plankv":"ℏ","plusacir":"⨣","plusb":"⊞","pluscir":"⨢","plus":"+","plusdo":"∔","plusdu":"⨥","pluse":"⩲","PlusMinus":"±","plusmn":"±","plussim":"⨦","plustwo":"⨧","pm":"±","Poincareplane":"ℌ","pointint":"⨕","popf":"𝕡","Popf":"ℙ","pound":"£","prap":"⪷","Pr":"⪻","pr":"≺","prcue":"≼","precapprox":"⪷","prec":"≺","preccurlyeq":"≼","Precedes":"≺","PrecedesEqual":"⪯","PrecedesSlantEqual":"≼","PrecedesTilde":"≾","preceq":"⪯","precnapprox":"⪹","precneqq":"⪵","precnsim":"⋨","pre":"⪯","prE":"⪳","precsim":"≾","prime":"′","Prime":"″","primes":"ℙ","prnap":"⪹","prnE":"⪵","prnsim":"⋨","prod":"∏","Product":"∏","profalar":"⌮","profline":"⌒","profsurf":"⌓","prop":"∝","Proportional":"∝","Proportion":"∷","propto":"∝","prsim":"≾","prurel":"⊰","Pscr":"𝒫","pscr":"𝓅","Psi":"Ψ","psi":"ψ","puncsp":" ","Qfr":"𝔔","qfr":"𝔮","qint":"⨌","qopf":"𝕢","Qopf":"ℚ","qprime":"⁗","Qscr":"𝒬","qscr":"𝓆","quaternions":"ℍ","quatint":"⨖","quest":"?","questeq":"≟","quot":"\"","QUOT":"\"","rAarr":"⇛","race":"∽̱","Racute":"Ŕ","racute":"ŕ","radic":"√","raemptyv":"⦳","rang":"⟩","Rang":"⟫","rangd":"⦒","range":"⦥","rangle":"⟩","raquo":"»","rarrap":"⥵","rarrb":"⇥","rarrbfs":"⤠","rarrc":"⤳","rarr":"→","Rarr":"↠","rArr":"⇒","rarrfs":"⤞","rarrhk":"↪","rarrlp":"↬","rarrpl":"⥅","rarrsim":"⥴","Rarrtl":"⤖","rarrtl":"↣","rarrw":"↝","ratail":"⤚","rAtail":"⤜","ratio":"∶","rationals":"ℚ","rbarr":"⤍","rBarr":"⤏","RBarr":"⤐","rbbrk":"❳","rbrace":"}","rbrack":"]","rbrke":"⦌","rbrksld":"⦎","rbrkslu":"⦐","Rcaron":"Ř","rcaron":"ř","Rcedil":"Ŗ","rcedil":"ŗ","rceil":"⌉","rcub":"}","Rcy":"Р","rcy":"р","rdca":"⤷","rdldhar":"⥩","rdquo":"”","rdquor":"”","rdsh":"↳","real":"ℜ","realine":"ℛ","realpart":"ℜ","reals":"ℝ","Re":"ℜ","rect":"▭","reg":"®","REG":"®","ReverseElement":"∋","ReverseEquilibrium":"⇋","ReverseUpEquilibrium":"⥯","rfisht":"⥽","rfloor":"⌋","rfr":"𝔯","Rfr":"ℜ","rHar":"⥤","rhard":"⇁","rharu":"⇀","rharul":"⥬","Rho":"Ρ","rho":"ρ","rhov":"ϱ","RightAngleBracket":"⟩","RightArrowBar":"⇥","rightarrow":"→","RightArrow":"→","Rightarrow":"⇒","RightArrowLeftArrow":"⇄","rightarrowtail":"↣","RightCeiling":"⌉","RightDoubleBracket":"⟧","RightDownTeeVector":"⥝","RightDownVectorBar":"⥕","RightDownVector":"⇂","RightFloor":"⌋","rightharpoondown":"⇁","rightharpoonup":"⇀","rightleftarrows":"⇄","rightleftharpoons":"⇌","rightrightarrows":"⇉","rightsquigarrow":"↝","RightTeeArrow":"↦","RightTee":"⊢","RightTeeVector":"⥛","rightthreetimes":"⋌","RightTriangleBar":"⧐","RightTriangle":"⊳","RightTriangleEqual":"⊵","RightUpDownVector":"⥏","RightUpTeeVector":"⥜","RightUpVectorBar":"⥔","RightUpVector":"↾","RightVectorBar":"⥓","RightVector":"⇀","ring":"˚","risingdotseq":"≓","rlarr":"⇄","rlhar":"⇌","rlm":"‏","rmoustache":"⎱","rmoust":"⎱","rnmid":"⫮","roang":"⟭","roarr":"⇾","robrk":"⟧","ropar":"⦆","ropf":"𝕣","Ropf":"ℝ","roplus":"⨮","rotimes":"⨵","RoundImplies":"⥰","rpar":")","rpargt":"⦔","rppolint":"⨒","rrarr":"⇉","Rrightarrow":"⇛","rsaquo":"›","rscr":"𝓇","Rscr":"ℛ","rsh":"↱","Rsh":"↱","rsqb":"]","rsquo":"’","rsquor":"’","rthree":"⋌","rtimes":"⋊","rtri":"▹","rtrie":"⊵","rtrif":"▸","rtriltri":"⧎","RuleDelayed":"⧴","ruluhar":"⥨","rx":"℞","Sacute":"Ś","sacute":"ś","sbquo":"‚","scap":"⪸","Scaron":"Š","scaron":"š","Sc":"⪼","sc":"≻","sccue":"≽","sce":"⪰","scE":"⪴","Scedil":"Ş","scedil":"ş","Scirc":"Ŝ","scirc":"ŝ","scnap":"⪺","scnE":"⪶","scnsim":"⋩","scpolint":"⨓","scsim":"≿","Scy":"С","scy":"с","sdotb":"⊡","sdot":"⋅","sdote":"⩦","searhk":"⤥","searr":"↘","seArr":"⇘","searrow":"↘","sect":"§","semi":";","seswar":"⤩","setminus":"∖","setmn":"∖","sext":"✶","Sfr":"𝔖","sfr":"𝔰","sfrown":"⌢","sharp":"♯","SHCHcy":"Щ","shchcy":"щ","SHcy":"Ш","shcy":"ш","ShortDownArrow":"↓","ShortLeftArrow":"←","shortmid":"∣","shortparallel":"∥","ShortRightArrow":"→","ShortUpArrow":"↑","shy":"­","Sigma":"Σ","sigma":"σ","sigmaf":"ς","sigmav":"ς","sim":"∼","simdot":"⩪","sime":"≃","simeq":"≃","simg":"⪞","simgE":"⪠","siml":"⪝","simlE":"⪟","simne":"≆","simplus":"⨤","simrarr":"⥲","slarr":"←","SmallCircle":"∘","smallsetminus":"∖","smashp":"⨳","smeparsl":"⧤","smid":"∣","smile":"⌣","smt":"⪪","smte":"⪬","smtes":"⪬︀","SOFTcy":"Ь","softcy":"ь","solbar":"⌿","solb":"⧄","sol":"/","Sopf":"𝕊","sopf":"𝕤","spades":"♠","spadesuit":"♠","spar":"∥","sqcap":"⊓","sqcaps":"⊓︀","sqcup":"⊔","sqcups":"⊔︀","Sqrt":"√","sqsub":"⊏","sqsube":"⊑","sqsubset":"⊏","sqsubseteq":"⊑","sqsup":"⊐","sqsupe":"⊒","sqsupset":"⊐","sqsupseteq":"⊒","square":"□","Square":"□","SquareIntersection":"⊓","SquareSubset":"⊏","SquareSubsetEqual":"⊑","SquareSuperset":"⊐","SquareSupersetEqual":"⊒","SquareUnion":"⊔","squarf":"▪","squ":"□","squf":"▪","srarr":"→","Sscr":"𝒮","sscr":"𝓈","ssetmn":"∖","ssmile":"⌣","sstarf":"⋆","Star":"⋆","star":"☆","starf":"★","straightepsilon":"ϵ","straightphi":"ϕ","strns":"¯","sub":"⊂","Sub":"⋐","subdot":"⪽","subE":"⫅","sube":"⊆","subedot":"⫃","submult":"⫁","subnE":"⫋","subne":"⊊","subplus":"⪿","subrarr":"⥹","subset":"⊂","Subset":"⋐","subseteq":"⊆","subseteqq":"⫅","SubsetEqual":"⊆","subsetneq":"⊊","subsetneqq":"⫋","subsim":"⫇","subsub":"⫕","subsup":"⫓","succapprox":"⪸","succ":"≻","succcurlyeq":"≽","Succeeds":"≻","SucceedsEqual":"⪰","SucceedsSlantEqual":"≽","SucceedsTilde":"≿","succeq":"⪰","succnapprox":"⪺","succneqq":"⪶","succnsim":"⋩","succsim":"≿","SuchThat":"∋","sum":"∑","Sum":"∑","sung":"♪","sup1":"¹","sup2":"²","sup3":"³","sup":"⊃","Sup":"⋑","supdot":"⪾","supdsub":"⫘","supE":"⫆","supe":"⊇","supedot":"⫄","Superset":"⊃","SupersetEqual":"⊇","suphsol":"⟉","suphsub":"⫗","suplarr":"⥻","supmult":"⫂","supnE":"⫌","supne":"⊋","supplus":"⫀","supset":"⊃","Supset":"⋑","supseteq":"⊇","supseteqq":"⫆","supsetneq":"⊋","supsetneqq":"⫌","supsim":"⫈","supsub":"⫔","supsup":"⫖","swarhk":"⤦","swarr":"↙","swArr":"⇙","swarrow":"↙","swnwar":"⤪","szlig":"ß","Tab":"\t","target":"⌖","Tau":"Τ","tau":"τ","tbrk":"⎴","Tcaron":"Ť","tcaron":"ť","Tcedil":"Ţ","tcedil":"ţ","Tcy":"Т","tcy":"т","tdot":"⃛","telrec":"⌕","Tfr":"𝔗","tfr":"𝔱","there4":"∴","therefore":"∴","Therefore":"∴","Theta":"Θ","theta":"θ","thetasym":"ϑ","thetav":"ϑ","thickapprox":"≈","thicksim":"∼","ThickSpace":"  ","ThinSpace":" ","thinsp":" ","thkap":"≈","thksim":"∼","THORN":"Þ","thorn":"þ","tilde":"˜","Tilde":"∼","TildeEqual":"≃","TildeFullEqual":"≅","TildeTilde":"≈","timesbar":"⨱","timesb":"⊠","times":"×","timesd":"⨰","tint":"∭","toea":"⤨","topbot":"⌶","topcir":"⫱","top":"⊤","Topf":"𝕋","topf":"𝕥","topfork":"⫚","tosa":"⤩","tprime":"‴","trade":"™","TRADE":"™","triangle":"▵","triangledown":"▿","triangleleft":"◃","trianglelefteq":"⊴","triangleq":"≜","triangleright":"▹","trianglerighteq":"⊵","tridot":"◬","trie":"≜","triminus":"⨺","TripleDot":"⃛","triplus":"⨹","trisb":"⧍","tritime":"⨻","trpezium":"⏢","Tscr":"𝒯","tscr":"𝓉","TScy":"Ц","tscy":"ц","TSHcy":"Ћ","tshcy":"ћ","Tstrok":"Ŧ","tstrok":"ŧ","twixt":"≬","twoheadleftarrow":"↞","twoheadrightarrow":"↠","Uacute":"Ú","uacute":"ú","uarr":"↑","Uarr":"↟","uArr":"⇑","Uarrocir":"⥉","Ubrcy":"Ў","ubrcy":"ў","Ubreve":"Ŭ","ubreve":"ŭ","Ucirc":"Û","ucirc":"û","Ucy":"У","ucy":"у","udarr":"⇅","Udblac":"Ű","udblac":"ű","udhar":"⥮","ufisht":"⥾","Ufr":"𝔘","ufr":"𝔲","Ugrave":"Ù","ugrave":"ù","uHar":"⥣","uharl":"↿","uharr":"↾","uhblk":"▀","ulcorn":"⌜","ulcorner":"⌜","ulcrop":"⌏","ultri":"◸","Umacr":"Ū","umacr":"ū","uml":"¨","UnderBar":"_","UnderBrace":"⏟","UnderBracket":"⎵","UnderParenthesis":"⏝","Union":"⋃","UnionPlus":"⊎","Uogon":"Ų","uogon":"ų","Uopf":"𝕌","uopf":"𝕦","UpArrowBar":"⤒","uparrow":"↑","UpArrow":"↑","Uparrow":"⇑","UpArrowDownArrow":"⇅","updownarrow":"↕","UpDownArrow":"↕","Updownarrow":"⇕","UpEquilibrium":"⥮","upharpoonleft":"↿","upharpoonright":"↾","uplus":"⊎","UpperLeftArrow":"↖","UpperRightArrow":"↗","upsi":"υ","Upsi":"ϒ","upsih":"ϒ","Upsilon":"Υ","upsilon":"υ","UpTeeArrow":"↥","UpTee":"⊥","upuparrows":"⇈","urcorn":"⌝","urcorner":"⌝","urcrop":"⌎","Uring":"Ů","uring":"ů","urtri":"◹","Uscr":"𝒰","uscr":"𝓊","utdot":"⋰","Utilde":"Ũ","utilde":"ũ","utri":"▵","utrif":"▴","uuarr":"⇈","Uuml":"Ü","uuml":"ü","uwangle":"⦧","vangrt":"⦜","varepsilon":"ϵ","varkappa":"ϰ","varnothing":"∅","varphi":"ϕ","varpi":"ϖ","varpropto":"∝","varr":"↕","vArr":"⇕","varrho":"ϱ","varsigma":"ς","varsubsetneq":"⊊︀","varsubsetneqq":"⫋︀","varsupsetneq":"⊋︀","varsupsetneqq":"⫌︀","vartheta":"ϑ","vartriangleleft":"⊲","vartriangleright":"⊳","vBar":"⫨","Vbar":"⫫","vBarv":"⫩","Vcy":"В","vcy":"в","vdash":"⊢","vDash":"⊨","Vdash":"⊩","VDash":"⊫","Vdashl":"⫦","veebar":"⊻","vee":"∨","Vee":"⋁","veeeq":"≚","vellip":"⋮","verbar":"|","Verbar":"‖","vert":"|","Vert":"‖","VerticalBar":"∣","VerticalLine":"|","VerticalSeparator":"❘","VerticalTilde":"≀","VeryThinSpace":" ","Vfr":"𝔙","vfr":"𝔳","vltri":"⊲","vnsub":"⊂⃒","vnsup":"⊃⃒","Vopf":"𝕍","vopf":"𝕧","vprop":"∝","vrtri":"⊳","Vscr":"𝒱","vscr":"𝓋","vsubnE":"⫋︀","vsubne":"⊊︀","vsupnE":"⫌︀","vsupne":"⊋︀","Vvdash":"⊪","vzigzag":"⦚","Wcirc":"Ŵ","wcirc":"ŵ","wedbar":"⩟","wedge":"∧","Wedge":"⋀","wedgeq":"≙","weierp":"℘","Wfr":"𝔚","wfr":"𝔴","Wopf":"𝕎","wopf":"𝕨","wp":"℘","wr":"≀","wreath":"≀","Wscr":"𝒲","wscr":"𝓌","xcap":"⋂","xcirc":"◯","xcup":"⋃","xdtri":"▽","Xfr":"𝔛","xfr":"𝔵","xharr":"⟷","xhArr":"⟺","Xi":"Ξ","xi":"ξ","xlarr":"⟵","xlArr":"⟸","xmap":"⟼","xnis":"⋻","xodot":"⨀","Xopf":"𝕏","xopf":"𝕩","xoplus":"⨁","xotime":"⨂","xrarr":"⟶","xrArr":"⟹","Xscr":"𝒳","xscr":"𝓍","xsqcup":"⨆","xuplus":"⨄","xutri":"△","xvee":"⋁","xwedge":"⋀","Yacute":"Ý","yacute":"ý","YAcy":"Я","yacy":"я","Ycirc":"Ŷ","ycirc":"ŷ","Ycy":"Ы","ycy":"ы","yen":"¥","Yfr":"𝔜","yfr":"𝔶","YIcy":"Ї","yicy":"ї","Yopf":"𝕐","yopf":"𝕪","Yscr":"𝒴","yscr":"𝓎","YUcy":"Ю","yucy":"ю","yuml":"ÿ","Yuml":"Ÿ","Zacute":"Ź","zacute":"ź","Zcaron":"Ž","zcaron":"ž","Zcy":"З","zcy":"з","Zdot":"Ż","zdot":"ż","zeetrf":"ℨ","ZeroWidthSpace":"​","Zeta":"Ζ","zeta":"ζ","zfr":"𝔷","Zfr":"ℨ","ZHcy":"Ж","zhcy":"ж","zigrarr":"⇝","zopf":"𝕫","Zopf":"ℤ","Zscr":"𝒵","zscr":"𝓏","zwj":"‍","zwnj":"‌"} diff --git a/node_modules/entities/lib/maps/legacy.json b/node_modules/entities/lib/maps/legacy.json deleted file mode 100644 index 43dbea6..0000000 --- a/node_modules/entities/lib/maps/legacy.json +++ /dev/null @@ -1 +0,0 @@ -{"Aacute":"Á","aacute":"á","Acirc":"Â","acirc":"â","acute":"´","AElig":"Æ","aelig":"æ","Agrave":"À","agrave":"à","amp":"&","AMP":"&","Aring":"Å","aring":"å","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","brvbar":"¦","Ccedil":"Ç","ccedil":"ç","cedil":"¸","cent":"¢","copy":"©","COPY":"©","curren":"¤","deg":"°","divide":"÷","Eacute":"É","eacute":"é","Ecirc":"Ê","ecirc":"ê","Egrave":"È","egrave":"è","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","frac12":"½","frac14":"¼","frac34":"¾","gt":">","GT":">","Iacute":"Í","iacute":"í","Icirc":"Î","icirc":"î","iexcl":"¡","Igrave":"Ì","igrave":"ì","iquest":"¿","Iuml":"Ï","iuml":"ï","laquo":"«","lt":"<","LT":"<","macr":"¯","micro":"µ","middot":"·","nbsp":" ","not":"¬","Ntilde":"Ñ","ntilde":"ñ","Oacute":"Ó","oacute":"ó","Ocirc":"Ô","ocirc":"ô","Ograve":"Ò","ograve":"ò","ordf":"ª","ordm":"º","Oslash":"Ø","oslash":"ø","Otilde":"Õ","otilde":"õ","Ouml":"Ö","ouml":"ö","para":"¶","plusmn":"±","pound":"£","quot":"\"","QUOT":"\"","raquo":"»","reg":"®","REG":"®","sect":"§","shy":"­","sup1":"¹","sup2":"²","sup3":"³","szlig":"ß","THORN":"Þ","thorn":"þ","times":"×","Uacute":"Ú","uacute":"ú","Ucirc":"Û","ucirc":"û","Ugrave":"Ù","ugrave":"ù","uml":"¨","Uuml":"Ü","uuml":"ü","Yacute":"Ý","yacute":"ý","yen":"¥","yuml":"ÿ"} diff --git a/node_modules/entities/lib/maps/xml.json b/node_modules/entities/lib/maps/xml.json deleted file mode 100644 index de8db10..0000000 --- a/node_modules/entities/lib/maps/xml.json +++ /dev/null @@ -1 +0,0 @@ -{"amp":"&","apos":"'","gt":">","lt":"<","quot":"\""} diff --git a/node_modules/entities/package.json b/node_modules/entities/package.json index cc586a3..ef6be90 100644 --- a/node_modules/entities/package.json +++ b/node_modules/entities/package.json @@ -1,97 +1,90 @@ { - "_from": "entities@^2.0.0", - "_id": "entities@2.2.0", - "_inBundle": false, - "_integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", - "_location": "/entities", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "entities@^2.0.0", "name": "entities", - "escapedName": "entities", - "rawSpec": "^2.0.0", - "saveSpec": null, - "fetchSpec": "^2.0.0" - }, - "_requiredBy": [ - "/dom-serializer", - "/htmlparser2" - ], - "_resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", - "_shasum": "098dc90ebb83d8dffa089d55256b351d34c4da55", - "_spec": "entities@^2.0.0", - "_where": "/home/runner/work/public_library_map/public_library_map/node_modules/dom-serializer", - "author": { - "name": "Felix Boehm", - "email": "me@feedic.com" - }, - "bugs": { - "url": "https://github.com/fb55/entities/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Encode & decode XML and HTML entities with ease", - "devDependencies": { - "@types/jest": "^26.0.0", - "@types/node": "^14.11.8", - "@typescript-eslint/eslint-plugin": "^4.4.1", - "@typescript-eslint/parser": "^4.4.1", - "coveralls": "*", - "eslint": "^7.11.0", - "eslint-config-prettier": "^7.0.0", - "eslint-plugin-node": "^11.1.0", - "jest": "^26.5.3", - "prettier": "^2.0.5", - "ts-jest": "^26.1.0", - "typescript": "^4.0.2" - }, - "directories": { - "lib": "lib/" - }, - "files": [ - "lib/**/*" - ], - "funding": "https://github.com/fb55/entities?sponsor=1", - "homepage": "https://github.com/fb55/entities#readme", - "jest": { - "preset": "ts-jest", - "testEnvironment": "node" - }, - "keywords": [ - "entity", - "decoding", - "encoding", - "html", - "xml", - "html entities" - ], - "license": "BSD-2-Clause", - "main": "lib/index.js", - "name": "entities", - "prettier": { - "tabWidth": 4, - "proseWrap": "always" - }, - "repository": { - "type": "git", - "url": "git://github.com/fb55/entities.git" - }, - "scripts": { - "build": "tsc && cp -r src/maps lib", - "coverage": "cat coverage/lcov.info | coveralls", - "format": "npm run format:es && npm run format:prettier", - "format:es": "npm run lint:es -- --fix", - "format:prettier": "npm run prettier -- --write", - "lint": "npm run lint:es && npm run lint:prettier", - "lint:es": "eslint .", - "lint:prettier": "npm run prettier -- --check", - "prepare": "npm run build", - "prettier": "prettier '**/*.{ts,md,json,yml}'", - "test": "jest --coverage && npm run lint" - }, - "sideEffects": false, - "types": "lib/index.d.ts", - "version": "2.2.0" + "version": "4.4.0", + "description": "Encode & decode XML and HTML entities with ease & speed", + "author": "Felix Boehm ", + "funding": "https://github.com/fb55/entities?sponsor=1", + "sideEffects": false, + "keywords": [ + "entity", + "decoding", + "encoding", + "html", + "xml", + "html entities" + ], + "directories": { + "lib": "lib/" + }, + "main": "lib/index.js", + "types": "lib/index.d.ts", + "module": "lib/esm/index.js", + "exports": { + ".": { + "require": "./lib/index.js", + "import": "./lib/esm/index.js" + }, + "./lib/decode.js": { + "require": "./lib/decode.js", + "import": "./lib/esm/decode.js" + }, + "./lib/escape.js": { + "require": "./lib/escape.js", + "import": "./lib/esm/escape.js" + } + }, + "files": [ + "lib/**/*" + ], + "engines": { + "node": ">=0.12" + }, + "devDependencies": { + "@types/jest": "^28.1.8", + "@types/node": "^18.7.14", + "@typescript-eslint/eslint-plugin": "^5.36.1", + "@typescript-eslint/parser": "^5.36.1", + "eslint": "^8.23.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-node": "^11.1.0", + "jest": "^28.1.3", + "prettier": "^2.7.1", + "ts-jest": "^28.0.8", + "typedoc": "^0.23.12", + "typescript": "^4.8.2" + }, + "scripts": { + "test": "npm run test:jest && npm run lint", + "test:jest": "jest", + "lint": "npm run lint:es && npm run lint:prettier", + "lint:es": "eslint .", + "lint:prettier": "npm run prettier -- --check", + "format": "npm run format:es && npm run format:prettier", + "format:es": "npm run lint:es -- --fix", + "format:prettier": "npm run prettier -- --write", + "prettier": "prettier '**/*.{ts,md,json,yml}'", + "build": "npm run build:cjs && npm run build:esm", + "build:cjs": "tsc --sourceRoot https://raw.githubusercontent.com/fb55/entities/$(git rev-parse HEAD)/src/", + "build:esm": "npm run build:cjs -- --module esnext --target es2019 --outDir lib/esm && echo '{\"type\":\"module\"}' > lib/esm/package.json", + "build:docs": "typedoc --hideGenerator src/index.ts", + "build:trie": "ts-node scripts/write-decode-map.ts", + "build:encode-trie": "ts-node scripts/write-encode-map.ts", + "prepare": "npm run build" + }, + "repository": { + "type": "git", + "url": "git://github.com/fb55/entities.git" + }, + "license": "BSD-2-Clause", + "jest": { + "preset": "ts-jest", + "coverageProvider": "v8", + "moduleNameMapper": { + "^(.*)\\.js$": "$1" + } + }, + "prettier": { + "tabWidth": 4, + "proseWrap": "always" + } } diff --git a/node_modules/entities/readme.md b/node_modules/entities/readme.md index f69264a..86b10ab 100644 --- a/node_modules/entities/readme.md +++ b/node_modules/entities/readme.md @@ -2,6 +2,19 @@ Encode & decode HTML & XML entities with ease & speed. +## Features + +- 😇 Tried and true: `entities` is used by many popular libraries; eg. + [`htmlparser2`](https://github.com/fb55/htmlparser2), the official + [AWS SDK](https://github.com/aws/aws-sdk-js-v3) and + [`commonmark`](https://github.com/commonmark/commonmark.js) use it to + process HTML entities. +- ⚡️ Fast: `entities` is the fastes library for decoding HTML entities (as of + April 2022); see [performance](#performance). +- 🎛 Configurable: Get an output tailored for your needs. You are fine with + UTF8? That'll safe you some bytes. Prefer to only have ASCII characters? We + can do that as well! + ## How to… ### …install `entities` @@ -13,12 +26,12 @@ Encode & decode HTML & XML entities with ease & speed. ```javascript const entities = require("entities"); -//encoding -entities.escape("&"); // "&#38;" -entities.encodeXML("&"); // "&#38;" -entities.encodeHTML("&"); // "&#38;" +// Encoding +entities.escapeUTF8("& ü"); // "&#38; ü" +entities.encodeXML("& ü"); // "&#38; ü" +entities.encodeHTML("& ü"); // "&#38; ü" -//decoding +// Decoding entities.decodeXML("asdf & ÿ ü '"); // "asdf & ÿ ü '" entities.decodeHTML("asdf & ÿ ü '"); // "asdf & ÿ ü '" ``` @@ -26,14 +39,66 @@ entities.decodeHTML("asdf & ÿ ü '"); // "asdf & ÿ ü '" ## Performance This is how `entities` compares to other libraries on a very basic benchmark -(see `scripts/benchmark.ts`, for 10,000,000 iterations): +(see `scripts/benchmark.ts`, for 10,000,000 iterations; **lower is better**): -| Library | `decode` performance | `encode` performance | Bundle size | -| -------------- | -------------------- | -------------------- | -------------------------------------------------------------------------- | -| entities | 10.809s | 17.683s | ![npm bundle size](https://img.shields.io/bundlephobia/min/entities) | -| html-entities | 14.029s | 22.670s | ![npm bundle size](https://img.shields.io/bundlephobia/min/html-entities) | -| he | 16.163s | 44.010s | ![npm bundle size](https://img.shields.io/bundlephobia/min/he) | -| parse-entities | 28.507s | N/A | ![npm bundle size](https://img.shields.io/bundlephobia/min/parse-entities) | +| Library | Version | `decode` perf | `encode` perf | `escape` perf | +| -------------- | ------- | ------------- | ------------- | ------------- | +| entities | `3.0.1` | 1.418s | 6.786s | 2.196s | +| html-entities | `2.3.2` | 2.530s | 6.829s | 2.415s | +| he | `1.2.0` | 5.800s | 24.237s | 3.624s | +| parse-entities | `3.0.0` | 9.660s | N/A | N/A | + +--- + +## FAQ + +> What methods should I actually use to encode my documents? + +If your target supports UTF-8, the `escapeUTF8` method is going to be your best +choice. Otherwise, use either `encodeHTML` or `encodeXML` based on whether +you're dealing with an HTML or an XML document. + +You can have a look at the options for the `encode` and `decode` methods to see +everything you can configure. + +> When should I use strict decoding? + +When strict decoding, entities not terminated with a semicolon will be ignored. +This is helpful for decoding entities in legacy environments. + +> Why should I use `entities` instead of alternative modules? + +As of April 2022, `entities` is a bit faster than other modules. Still, this is +not a very differentiated space and other modules can catch up. + +**More importantly**, you might already have `entities` in your dependency graph +(as a dependency of eg. `cheerio`, or `htmlparser2`), and including it directly +might not even increase your bundle size. The same is true for other entity +libraries, so have a look through your `node_modules` directory! + +> Does `entities` support tree shaking? + +Yes! `entities` ships as both a CommonJS and a ES module. Note that for best +results, you should not use the `encode` and `decode` functions, as they wrap +around a number of other functions, all of which will remain in the bundle. +Instead, use the functions that you need directly. + +--- + +## Acknowledgements + +This libary wouldn't be possible without the work of these individuals. Thanks +to + +- [@mathiasbynens](https://github.com/mathiasbynens) for his explanations + about character encodings, and his library `he`, which was one of the + inspirations for `entities` +- [@inikulin](https://github.com/inikulin) for his work on optimized tries for + decoding HTML entities for the `parse5` project +- [@mdevils](https://github.com/mdevils) for taking on the challenge of + producing a quick entity library with his `html-entities` library. + `entities` would be quite a bit slower if there wasn't any competition. + Right now `entities` is on top, but we'll see how long that lasts! --- diff --git a/node_modules/htmlparser2/README.md b/node_modules/htmlparser2/README.md index 5ec9095..8565fb6 100644 --- a/node_modules/htmlparser2/README.md +++ b/node_modules/htmlparser2/README.md @@ -7,6 +7,8 @@ The fast & forgiving HTML/XML parser. +_htmlparser2 is [the fastest HTML parser](#performance), and takes some shortcuts to get there. If you need strict HTML spec compliance, have a look at [parse5](https://github.com/inikulin/parse5)._ + ## Installation npm install htmlparser2 @@ -107,7 +109,7 @@ The `DomHandler` produces a DOM (document object model) that can be manipulated ```js const htmlparser2 = require("htmlparser2"); -const dom = htmlparser2.parseDocument(); +const dom = htmlparser2.parseDocument(htmlString); ``` The `DomHandler`, while still bundled with this module, was moved to its [own module](https://github.com/fb55/domhandler). @@ -126,26 +128,28 @@ you might want to use [danmactough/node-feedparser](https://github.com/danmactou After having some artificial benchmarks for some time, **@AndreasMadsen** published his [`htmlparser-benchmark`](https://github.com/AndreasMadsen/htmlparser-benchmark), which benchmarks HTML parses based on real-world websites. -At the time of writing, the latest versions of all supported parsers show the following performance characteristics on [Travis CI](https://travis-ci.org/AndreasMadsen/htmlparser-benchmark/builds/10805007) (please note that Travis doesn't guarantee equal conditions for all tests): +At the time of writing, the latest versions of all supported parsers show the following performance characteristics on GitHub Actions (sourced from [here](https://github.com/AndreasMadsen/htmlparser-benchmark/blob/e78cd8fc6c2adac08deedd4f274c33537451186b/stats.txt)): ``` -gumbo-parser : 34.9208 ms/file ± 21.4238 -html-parser : 24.8224 ms/file ± 15.8703 -html5 : 419.597 ms/file ± 264.265 -htmlparser : 60.0722 ms/file ± 384.844 -htmlparser2-dom: 12.0749 ms/file ± 6.49474 -htmlparser2 : 7.49130 ms/file ± 5.74368 -hubbub : 30.4980 ms/file ± 16.4682 -libxmljs : 14.1338 ms/file ± 18.6541 -parse5 : 22.0439 ms/file ± 15.3743 -sax : 49.6513 ms/file ± 26.6032 +htmlparser2 : 2.17215 ms/file ± 3.81587 +node-html-parser : 2.35983 ms/file ± 1.54487 +html5parser : 2.43468 ms/file ± 2.81501 +neutron-html5parser: 2.61356 ms/file ± 1.70324 +htmlparser2-dom : 3.09034 ms/file ± 4.77033 +html-dom-parser : 3.56804 ms/file ± 5.15621 +libxmljs : 4.07490 ms/file ± 2.99869 +htmljs-parser : 6.15812 ms/file ± 7.52497 +parse5 : 9.70406 ms/file ± 6.74872 +htmlparser : 15.0596 ms/file ± 89.0826 +html-parser : 28.6282 ms/file ± 22.6652 +saxes : 45.7921 ms/file ± 128.691 +html5 : 120.844 ms/file ± 153.944 ``` ## How does this module differ from [node-htmlparser](https://github.com/tautologistics/node-htmlparser)? -This module started as a fork of the `htmlparser` module. -The main difference is that `htmlparser2` is intended to be used only with node (it runs on other platforms using [browserify](https://github.com/substack/node-browserify)). -`htmlparser2` was rewritten multiple times and, while it maintains an API that's compatible with `htmlparser` in most cases, the projects don't share any code anymore. +In 2011, this module started as a fork of the `htmlparser` module. +`htmlparser2` was rewritten multiple times and, while it maintains an API that's mostly compatible with `htmlparser` in most cases, the projects don't share any code anymore. The parser now provides a callback interface inspired by [sax.js](https://github.com/isaacs/sax-js) (originally targeted at [readabilitySAX](https://github.com/fb55/readabilitysax)). As a result, old handlers won't work anymore. diff --git a/node_modules/htmlparser2/lib/CollectingHandler.d.ts b/node_modules/htmlparser2/lib/CollectingHandler.d.ts deleted file mode 100644 index 603a06e..0000000 --- a/node_modules/htmlparser2/lib/CollectingHandler.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import MultiplexHandler from "./MultiplexHandler"; -import { Handler } from "./Parser"; -export declare class CollectingHandler extends MultiplexHandler { - private readonly cbs; - events: [keyof Handler, ...unknown[]][]; - constructor(cbs?: Partial); - onreset(): void; - restart(): void; -} -//# sourceMappingURL=CollectingHandler.d.ts.map \ No newline at end of file diff --git a/node_modules/htmlparser2/lib/CollectingHandler.d.ts.map b/node_modules/htmlparser2/lib/CollectingHandler.d.ts.map deleted file mode 100644 index d4356d1..0000000 --- a/node_modules/htmlparser2/lib/CollectingHandler.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"CollectingHandler.d.ts","sourceRoot":"","sources":["../src/CollectingHandler.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAInC,qBAAa,iBAAkB,SAAQ,gBAAgB;IAGvC,OAAO,CAAC,QAAQ,CAAC,GAAG;IAFzB,MAAM,EAAE,CAAC,MAAM,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC,EAAE,CAAM;gBAEvB,GAAG,GAAE,OAAO,CAAC,OAAO,CAAM;IAOvD,OAAO,IAAI,IAAI;IAKf,OAAO,IAAI,IAAI;CAOlB"} \ No newline at end of file diff --git a/node_modules/htmlparser2/lib/CollectingHandler.js b/node_modules/htmlparser2/lib/CollectingHandler.js deleted file mode 100644 index 03bdf4f..0000000 --- a/node_modules/htmlparser2/lib/CollectingHandler.js +++ /dev/null @@ -1,60 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __spreadArray = (this && this.__spreadArray) || function (to, from) { - for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) - to[j] = from[i]; - return to; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CollectingHandler = void 0; -var MultiplexHandler_1 = __importDefault(require("./MultiplexHandler")); -var CollectingHandler = /** @class */ (function (_super) { - __extends(CollectingHandler, _super); - function CollectingHandler(cbs) { - if (cbs === void 0) { cbs = {}; } - var _this = _super.call(this, function (name) { - var _a; - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - _this.events.push(__spreadArray([name], args)); - (_a = _this.cbs[name]) === null || _a === void 0 ? void 0 : _a.apply(void 0, args); - }) || this; - _this.cbs = cbs; - _this.events = []; - return _this; - } - CollectingHandler.prototype.onreset = function () { - var _a, _b; - this.events = []; - (_b = (_a = this.cbs).onreset) === null || _b === void 0 ? void 0 : _b.call(_a); - }; - CollectingHandler.prototype.restart = function () { - var _a, _b, _c; - (_b = (_a = this.cbs).onreset) === null || _b === void 0 ? void 0 : _b.call(_a); - for (var _i = 0, _d = this.events; _i < _d.length; _i++) { - var _e = _d[_i], name_1 = _e[0], args = _e.slice(1); - (_c = this.cbs[name_1]) === null || _c === void 0 ? void 0 : _c.apply(void 0, args); - } - }; - return CollectingHandler; -}(MultiplexHandler_1.default)); -exports.CollectingHandler = CollectingHandler; diff --git a/node_modules/htmlparser2/lib/FeedHandler.d.ts b/node_modules/htmlparser2/lib/FeedHandler.d.ts deleted file mode 100644 index 61a314f..0000000 --- a/node_modules/htmlparser2/lib/FeedHandler.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -import DomHandler, { DomHandlerOptions } from "domhandler"; -import { ParserOptions } from "./Parser"; -declare enum FeedItemMediaMedium { - image = 0, - audio = 1, - video = 2, - document = 3, - executable = 4 -} -declare enum FeedItemMediaExpression { - sample = 0, - full = 1, - nonstop = 2 -} -interface FeedItemMedia { - url?: string; - fileSize?: number; - type?: string; - medium: FeedItemMediaMedium | undefined; - isDefault: boolean; - expression?: FeedItemMediaExpression; - bitrate?: number; - framerate?: number; - samplingrate?: number; - channels?: number; - duration?: number; - height?: number; - width?: number; - lang?: string; -} -interface FeedItem { - id?: string; - title?: string; - link?: string; - description?: string; - pubDate?: Date; - media?: FeedItemMedia[]; -} -interface Feed { - type?: string; - id?: string; - title?: string; - link?: string; - description?: string; - updated?: Date; - author?: string; - items?: FeedItem[]; -} -export declare class FeedHandler extends DomHandler { - feed?: Feed; - /** - * - * @param callback - * @param options - */ - constructor(callback?: ((error: Error | null) => void) | DomHandlerOptions, options?: DomHandlerOptions); - onend(): void; -} -/** - * Parse a feed. - * - * @param feed The feed that should be parsed, as a string. - * @param options Optionally, options for parsing. When using this option, you should set `xmlMode` to `true`. - */ -export declare function parseFeed(feed: string, options?: ParserOptions & DomHandlerOptions): Feed | undefined; -export {}; -//# sourceMappingURL=FeedHandler.d.ts.map \ No newline at end of file diff --git a/node_modules/htmlparser2/lib/FeedHandler.d.ts.map b/node_modules/htmlparser2/lib/FeedHandler.d.ts.map deleted file mode 100644 index 90b9b3a..0000000 --- a/node_modules/htmlparser2/lib/FeedHandler.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"FeedHandler.d.ts","sourceRoot":"","sources":["../src/FeedHandler.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAE,iBAAiB,EAAiB,MAAM,YAAY,CAAC;AAE1E,OAAO,EAAU,aAAa,EAAE,MAAM,UAAU,CAAC;AAEjD,aAAK,mBAAmB;IACpB,KAAK,IAAA;IACL,KAAK,IAAA;IACL,KAAK,IAAA;IACL,QAAQ,IAAA;IACR,UAAU,IAAA;CACb;AAED,aAAK,uBAAuB;IACxB,MAAM,IAAA;IACN,IAAI,IAAA;IACJ,OAAO,IAAA;CACV;AAED,UAAU,aAAa;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,mBAAmB,GAAG,SAAS,CAAC;IACxC,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,uBAAuB,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,QAAQ;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,KAAK,CAAC,EAAE,aAAa,EAAE,CAAC;CAC3B;AAED,UAAU,IAAI;IACV,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;CACtB;AAGD,qBAAa,WAAY,SAAQ,UAAU;IACvC,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ;;;;OAIG;gBAEC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,CAAC,GAAG,iBAAiB,EAC9D,OAAO,CAAC,EAAE,iBAAiB;IAS/B,KAAK,IAAI,IAAI;CAkGhB;AA4FD;;;;;GAKG;AACH,wBAAgB,SAAS,CACrB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,aAAa,GAAG,iBAAqC,GAC/D,IAAI,GAAG,SAAS,CAIlB"} \ No newline at end of file diff --git a/node_modules/htmlparser2/lib/FeedHandler.js b/node_modules/htmlparser2/lib/FeedHandler.js deleted file mode 100644 index e8e2642..0000000 --- a/node_modules/htmlparser2/lib/FeedHandler.js +++ /dev/null @@ -1,235 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.parseFeed = exports.FeedHandler = void 0; -var domhandler_1 = __importDefault(require("domhandler")); -var DomUtils = __importStar(require("domutils")); -var Parser_1 = require("./Parser"); -var FeedItemMediaMedium; -(function (FeedItemMediaMedium) { - FeedItemMediaMedium[FeedItemMediaMedium["image"] = 0] = "image"; - FeedItemMediaMedium[FeedItemMediaMedium["audio"] = 1] = "audio"; - FeedItemMediaMedium[FeedItemMediaMedium["video"] = 2] = "video"; - FeedItemMediaMedium[FeedItemMediaMedium["document"] = 3] = "document"; - FeedItemMediaMedium[FeedItemMediaMedium["executable"] = 4] = "executable"; -})(FeedItemMediaMedium || (FeedItemMediaMedium = {})); -var FeedItemMediaExpression; -(function (FeedItemMediaExpression) { - FeedItemMediaExpression[FeedItemMediaExpression["sample"] = 0] = "sample"; - FeedItemMediaExpression[FeedItemMediaExpression["full"] = 1] = "full"; - FeedItemMediaExpression[FeedItemMediaExpression["nonstop"] = 2] = "nonstop"; -})(FeedItemMediaExpression || (FeedItemMediaExpression = {})); -// TODO: Consume data as it is coming in -var FeedHandler = /** @class */ (function (_super) { - __extends(FeedHandler, _super); - /** - * - * @param callback - * @param options - */ - function FeedHandler(callback, options) { - var _this = this; - if (typeof callback === "object") { - callback = undefined; - options = callback; - } - _this = _super.call(this, callback, options) || this; - return _this; - } - FeedHandler.prototype.onend = function () { - var _a, _b; - var feedRoot = getOneElement(isValidFeed, this.dom); - if (!feedRoot) { - this.handleCallback(new Error("couldn't find root of feed")); - return; - } - var feed = {}; - if (feedRoot.name === "feed") { - var childs = feedRoot.children; - feed.type = "atom"; - addConditionally(feed, "id", "id", childs); - addConditionally(feed, "title", "title", childs); - var href = getAttribute("href", getOneElement("link", childs)); - if (href) { - feed.link = href; - } - addConditionally(feed, "description", "subtitle", childs); - var updated = fetch("updated", childs); - if (updated) { - feed.updated = new Date(updated); - } - addConditionally(feed, "author", "email", childs, true); - feed.items = getElements("entry", childs).map(function (item) { - var entry = {}; - var children = item.children; - addConditionally(entry, "id", "id", children); - addConditionally(entry, "title", "title", children); - var href = getAttribute("href", getOneElement("link", children)); - if (href) { - entry.link = href; - } - var description = fetch("summary", children) || fetch("content", children); - if (description) { - entry.description = description; - } - var pubDate = fetch("updated", children); - if (pubDate) { - entry.pubDate = new Date(pubDate); - } - entry.media = getMediaElements(children); - return entry; - }); - } - else { - var childs = (_b = (_a = getOneElement("channel", feedRoot.children)) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : []; - feed.type = feedRoot.name.substr(0, 3); - feed.id = ""; - addConditionally(feed, "title", "title", childs); - addConditionally(feed, "link", "link", childs); - addConditionally(feed, "description", "description", childs); - var updated = fetch("lastBuildDate", childs); - if (updated) { - feed.updated = new Date(updated); - } - addConditionally(feed, "author", "managingEditor", childs, true); - feed.items = getElements("item", feedRoot.children).map(function (item) { - var entry = {}; - var children = item.children; - addConditionally(entry, "id", "guid", children); - addConditionally(entry, "title", "title", children); - addConditionally(entry, "link", "link", children); - addConditionally(entry, "description", "description", children); - var pubDate = fetch("pubDate", children); - if (pubDate) - entry.pubDate = new Date(pubDate); - entry.media = getMediaElements(children); - return entry; - }); - } - this.feed = feed; - this.handleCallback(null); - }; - return FeedHandler; -}(domhandler_1.default)); -exports.FeedHandler = FeedHandler; -function getMediaElements(where) { - return getElements("media:content", where).map(function (elem) { - var media = { - medium: elem.attribs.medium, - isDefault: !!elem.attribs.isDefault, - }; - if (elem.attribs.url) { - media.url = elem.attribs.url; - } - if (elem.attribs.fileSize) { - media.fileSize = parseInt(elem.attribs.fileSize, 10); - } - if (elem.attribs.type) { - media.type = elem.attribs.type; - } - if (elem.attribs.expression) { - media.expression = elem.attribs - .expression; - } - if (elem.attribs.bitrate) { - media.bitrate = parseInt(elem.attribs.bitrate, 10); - } - if (elem.attribs.framerate) { - media.framerate = parseInt(elem.attribs.framerate, 10); - } - if (elem.attribs.samplingrate) { - media.samplingrate = parseInt(elem.attribs.samplingrate, 10); - } - if (elem.attribs.channels) { - media.channels = parseInt(elem.attribs.channels, 10); - } - if (elem.attribs.duration) { - media.duration = parseInt(elem.attribs.duration, 10); - } - if (elem.attribs.height) { - media.height = parseInt(elem.attribs.height, 10); - } - if (elem.attribs.width) { - media.width = parseInt(elem.attribs.width, 10); - } - if (elem.attribs.lang) { - media.lang = elem.attribs.lang; - } - return media; - }); -} -function getElements(tagName, where) { - return DomUtils.getElementsByTagName(tagName, where, true); -} -function getOneElement(tagName, node) { - return DomUtils.getElementsByTagName(tagName, node, true, 1)[0]; -} -function fetch(tagName, where, recurse) { - if (recurse === void 0) { recurse = false; } - return DomUtils.getText(DomUtils.getElementsByTagName(tagName, where, recurse, 1)).trim(); -} -function getAttribute(name, elem) { - if (!elem) { - return null; - } - var attribs = elem.attribs; - return attribs[name]; -} -function addConditionally(obj, prop, what, where, recurse) { - if (recurse === void 0) { recurse = false; } - var tmp = fetch(what, where, recurse); - if (tmp) - obj[prop] = tmp; -} -function isValidFeed(value) { - return value === "rss" || value === "feed" || value === "rdf:RDF"; -} -/** - * Parse a feed. - * - * @param feed The feed that should be parsed, as a string. - * @param options Optionally, options for parsing. When using this option, you should set `xmlMode` to `true`. - */ -function parseFeed(feed, options) { - if (options === void 0) { options = { xmlMode: true }; } - var handler = new FeedHandler(options); - new Parser_1.Parser(handler, options).end(feed); - return handler.feed; -} -exports.parseFeed = parseFeed; diff --git a/node_modules/htmlparser2/lib/MultiplexHandler.d.ts b/node_modules/htmlparser2/lib/MultiplexHandler.d.ts deleted file mode 100644 index 67cb4d1..0000000 --- a/node_modules/htmlparser2/lib/MultiplexHandler.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { Parser, Handler } from "./Parser"; -/** - * Calls a specific handler function for all events that are encountered. - */ -export default class MultiplexHandler implements Handler { - private readonly func; - /** - * @param func The function to multiplex all events to. - */ - constructor(func: (event: keyof Handler, ...args: unknown[]) => void); - onattribute(name: string, value: string, quote: string | null | undefined): void; - oncdatastart(): void; - oncdataend(): void; - ontext(text: string): void; - onprocessinginstruction(name: string, value: string): void; - oncomment(comment: string): void; - oncommentend(): void; - onclosetag(name: string): void; - onopentag(name: string, attribs: { - [key: string]: string; - }): void; - onopentagname(name: string): void; - onerror(error: Error): void; - onend(): void; - onparserinit(parser: Parser): void; - onreset(): void; -} -//# sourceMappingURL=MultiplexHandler.d.ts.map \ No newline at end of file diff --git a/node_modules/htmlparser2/lib/MultiplexHandler.d.ts.map b/node_modules/htmlparser2/lib/MultiplexHandler.d.ts.map deleted file mode 100644 index 031ab5f..0000000 --- a/node_modules/htmlparser2/lib/MultiplexHandler.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"MultiplexHandler.d.ts","sourceRoot":"","sources":["../src/MultiplexHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAiB,YAAW,OAAO;IAKhD,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJzB;;OAEG;gBAEkB,IAAI,EAAE,CACnB,KAAK,EAAE,MAAM,OAAO,EACpB,GAAG,IAAI,EAAE,OAAO,EAAE,KACjB,IAAI;IAGb,WAAW,CACP,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACjC,IAAI;IAGP,YAAY,IAAI,IAAI;IAGpB,UAAU,IAAI,IAAI;IAGlB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAG1B,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAG1D,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAGhC,YAAY,IAAI,IAAI;IAGpB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAG9B,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,IAAI;IAGjE,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAGjC,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAG3B,KAAK,IAAI,IAAI;IAGb,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAGlC,OAAO,IAAI,IAAI;CAGlB"} \ No newline at end of file diff --git a/node_modules/htmlparser2/lib/MultiplexHandler.js b/node_modules/htmlparser2/lib/MultiplexHandler.js deleted file mode 100644 index fcb1aab..0000000 --- a/node_modules/htmlparser2/lib/MultiplexHandler.js +++ /dev/null @@ -1,57 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * Calls a specific handler function for all events that are encountered. - */ -var MultiplexHandler = /** @class */ (function () { - /** - * @param func The function to multiplex all events to. - */ - function MultiplexHandler(func) { - this.func = func; - } - MultiplexHandler.prototype.onattribute = function (name, value, quote) { - this.func("onattribute", name, value, quote); - }; - MultiplexHandler.prototype.oncdatastart = function () { - this.func("oncdatastart"); - }; - MultiplexHandler.prototype.oncdataend = function () { - this.func("oncdataend"); - }; - MultiplexHandler.prototype.ontext = function (text) { - this.func("ontext", text); - }; - MultiplexHandler.prototype.onprocessinginstruction = function (name, value) { - this.func("onprocessinginstruction", name, value); - }; - MultiplexHandler.prototype.oncomment = function (comment) { - this.func("oncomment", comment); - }; - MultiplexHandler.prototype.oncommentend = function () { - this.func("oncommentend"); - }; - MultiplexHandler.prototype.onclosetag = function (name) { - this.func("onclosetag", name); - }; - MultiplexHandler.prototype.onopentag = function (name, attribs) { - this.func("onopentag", name, attribs); - }; - MultiplexHandler.prototype.onopentagname = function (name) { - this.func("onopentagname", name); - }; - MultiplexHandler.prototype.onerror = function (error) { - this.func("onerror", error); - }; - MultiplexHandler.prototype.onend = function () { - this.func("onend"); - }; - MultiplexHandler.prototype.onparserinit = function (parser) { - this.func("onparserinit", parser); - }; - MultiplexHandler.prototype.onreset = function () { - this.func("onreset"); - }; - return MultiplexHandler; -}()); -exports.default = MultiplexHandler; diff --git a/node_modules/htmlparser2/lib/Parser.d.ts b/node_modules/htmlparser2/lib/Parser.d.ts index e5a7c49..8b37ad4 100644 --- a/node_modules/htmlparser2/lib/Parser.d.ts +++ b/node_modules/htmlparser2/lib/Parser.d.ts @@ -1,4 +1,4 @@ -import Tokenizer from "./Tokenizer"; +import Tokenizer, { Callbacks, QuoteType } from "./Tokenizer.js"; export interface ParserOptions { /** * Indicates whether special tags (``. + this.sequenceIndex = Number(c === CharCodes.Lt); + } + }; + Tokenizer.prototype.stateCDATASequence = function (c) { + if (c === Sequences.Cdata[this.sequenceIndex]) { + if (++this.sequenceIndex === Sequences.Cdata.length) { + this.state = State.InCommentLike; + this.currentSequence = Sequences.CdataEnd; + this.sequenceIndex = 0; + this.sectionStart = this.index + 1; + } + } + else { + this.sequenceIndex = 0; + this.state = State.InDeclaration; + this.stateInDeclaration(c); // Reconsume the character + } + }; + /** + * When we wait for one specific character, we can speed things up + * by skipping through the buffer until we find it. + * + * @returns Whether the character was found. + */ + Tokenizer.prototype.fastForwardTo = function (c) { + while (++this.index < this.buffer.length + this.offset) { + if (this.buffer.charCodeAt(this.index - this.offset) === c) { + return true; + } + } + /* + * We increment the index at the end of the `parse` loop, + * so set it to `buffer.length - 1` here. + * + * TODO: Refactor `parse` to increment index before calling states. + */ + this.index = this.buffer.length + this.offset - 1; + return false; + }; + /** + * Comments and CDATA end with `-->` and `]]>`. + * + * Their common qualities are: + * - Their end sequences have a distinct character they start with. + * - That character is then repeated, so we have to check multiple repeats. + * - All characters but the start character of the sequence can be skipped. + */ + Tokenizer.prototype.stateInCommentLike = function (c) { + if (c === this.currentSequence[this.sequenceIndex]) { + if (++this.sequenceIndex === this.currentSequence.length) { + if (this.currentSequence === Sequences.CdataEnd) { + this.cbs.oncdata(this.sectionStart, this.index, 2); + } + else { + this.cbs.oncomment(this.sectionStart, this.index, 2); + } + this.sequenceIndex = 0; + this.sectionStart = this.index + 1; + this.state = State.Text; + } + } + else if (this.sequenceIndex === 0) { + // Fast-forward to the first character of the sequence + if (this.fastForwardTo(this.currentSequence[0])) { + this.sequenceIndex = 1; + } + } + else if (c !== this.currentSequence[this.sequenceIndex - 1]) { + // Allow long sequences, eg. --->, ]]]> + this.sequenceIndex = 0; } }; /** @@ -175,735 +328,577 @@ var Tokenizer = /** @class */ (function () { * We allow anything that wouldn't end the tag. */ Tokenizer.prototype.isTagStartChar = function (c) { - return (isASCIIAlpha(c) || - (this.xmlMode && !whitespace(c) && c !== "/" && c !== ">")); + return this.xmlMode ? !isEndOfTagSection(c) : isASCIIAlpha(c); + }; + Tokenizer.prototype.startSpecial = function (sequence, offset) { + this.isSpecial = true; + this.currentSequence = sequence; + this.sequenceIndex = offset; + this.state = State.SpecialStartSequence; }; Tokenizer.prototype.stateBeforeTagName = function (c) { - if (c === "/") { - this._state = 5 /* BeforeClosingTagName */; + if (c === CharCodes.ExclamationMark) { + this.state = State.BeforeDeclaration; + this.sectionStart = this.index + 1; } - else if (c === "<") { - this.cbs.ontext(this.getSection()); - this.sectionStart = this._index; + else if (c === CharCodes.Questionmark) { + this.state = State.InProcessingInstruction; + this.sectionStart = this.index + 1; } - else if (c === ">" || - this.special !== 1 /* None */ || - whitespace(c)) { - this._state = 1 /* Text */; + else if (this.isTagStartChar(c)) { + var lower = c | 0x20; + this.sectionStart = this.index; + if (!this.xmlMode && lower === Sequences.TitleEnd[2]) { + this.startSpecial(Sequences.TitleEnd, 3); + } + else { + this.state = + !this.xmlMode && lower === Sequences.ScriptEnd[2] + ? State.BeforeSpecialS + : State.InTagName; + } } - else if (c === "!") { - this._state = 15 /* BeforeDeclaration */; - this.sectionStart = this._index + 1; - } - else if (c === "?") { - this._state = 17 /* InProcessingInstruction */; - this.sectionStart = this._index + 1; - } - else if (!this.isTagStartChar(c)) { - this._state = 1 /* Text */; + else if (c === CharCodes.Slash) { + this.state = State.BeforeClosingTagName; } else { - this._state = - !this.xmlMode && (c === "s" || c === "S") - ? 32 /* BeforeSpecialS */ - : !this.xmlMode && (c === "t" || c === "T") - ? 52 /* BeforeSpecialT */ - : 3 /* InTagName */; - this.sectionStart = this._index; + this.state = State.Text; + this.stateText(c); } }; Tokenizer.prototype.stateInTagName = function (c) { - if (c === "/" || c === ">" || whitespace(c)) { - this.emitToken("onopentagname"); - this._state = 8 /* BeforeAttributeName */; - this._index--; + if (isEndOfTagSection(c)) { + this.cbs.onopentagname(this.sectionStart, this.index); + this.sectionStart = -1; + this.state = State.BeforeAttributeName; + this.stateBeforeAttributeName(c); } }; Tokenizer.prototype.stateBeforeClosingTagName = function (c) { - if (whitespace(c)) { + if (isWhitespace(c)) { // Ignore } - else if (c === ">") { - this._state = 1 /* Text */; - } - else if (this.special !== 1 /* None */) { - if (this.special !== 4 /* Title */ && (c === "s" || c === "S")) { - this._state = 33 /* BeforeSpecialSEnd */; - } - else if (this.special === 4 /* Title */ && - (c === "t" || c === "T")) { - this._state = 53 /* BeforeSpecialTEnd */; - } - else { - this._state = 1 /* Text */; - this._index--; - } - } - else if (!this.isTagStartChar(c)) { - this._state = 20 /* InSpecialComment */; - this.sectionStart = this._index; + else if (c === CharCodes.Gt) { + this.state = State.Text; } else { - this._state = 6 /* InClosingTagName */; - this.sectionStart = this._index; + this.state = this.isTagStartChar(c) + ? State.InClosingTagName + : State.InSpecialComment; + this.sectionStart = this.index; } }; Tokenizer.prototype.stateInClosingTagName = function (c) { - if (c === ">" || whitespace(c)) { - this.emitToken("onclosetag"); - this._state = 7 /* AfterClosingTagName */; - this._index--; + if (c === CharCodes.Gt || isWhitespace(c)) { + this.cbs.onclosetag(this.sectionStart, this.index); + this.sectionStart = -1; + this.state = State.AfterClosingTagName; + this.stateAfterClosingTagName(c); } }; Tokenizer.prototype.stateAfterClosingTagName = function (c) { // Skip everything until ">" - if (c === ">") { - this._state = 1 /* Text */; - this.sectionStart = this._index + 1; + if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) { + this.state = State.Text; + this.sectionStart = this.index + 1; } }; Tokenizer.prototype.stateBeforeAttributeName = function (c) { - if (c === ">") { - this.cbs.onopentagend(); - this._state = 1 /* Text */; - this.sectionStart = this._index + 1; + if (c === CharCodes.Gt) { + this.cbs.onopentagend(this.index); + if (this.isSpecial) { + this.state = State.InSpecialTag; + this.sequenceIndex = 0; + } + else { + this.state = State.Text; + } + this.baseState = this.state; + this.sectionStart = this.index + 1; } - else if (c === "/") { - this._state = 4 /* InSelfClosingTag */; + else if (c === CharCodes.Slash) { + this.state = State.InSelfClosingTag; } - else if (!whitespace(c)) { - this._state = 9 /* InAttributeName */; - this.sectionStart = this._index; + else if (!isWhitespace(c)) { + this.state = State.InAttributeName; + this.sectionStart = this.index; } }; Tokenizer.prototype.stateInSelfClosingTag = function (c) { - if (c === ">") { - this.cbs.onselfclosingtag(); - this._state = 1 /* Text */; - this.sectionStart = this._index + 1; - this.special = 1 /* None */; // Reset special state, in case of self-closing special tags + if (c === CharCodes.Gt) { + this.cbs.onselfclosingtag(this.index); + this.state = State.Text; + this.baseState = State.Text; + this.sectionStart = this.index + 1; + this.isSpecial = false; // Reset special state, in case of self-closing special tags } - else if (!whitespace(c)) { - this._state = 8 /* BeforeAttributeName */; - this._index--; + else if (!isWhitespace(c)) { + this.state = State.BeforeAttributeName; + this.stateBeforeAttributeName(c); } }; Tokenizer.prototype.stateInAttributeName = function (c) { - if (c === "=" || c === "/" || c === ">" || whitespace(c)) { - this.cbs.onattribname(this.getSection()); + if (c === CharCodes.Eq || isEndOfTagSection(c)) { + this.cbs.onattribname(this.sectionStart, this.index); this.sectionStart = -1; - this._state = 10 /* AfterAttributeName */; - this._index--; + this.state = State.AfterAttributeName; + this.stateAfterAttributeName(c); } }; Tokenizer.prototype.stateAfterAttributeName = function (c) { - if (c === "=") { - this._state = 11 /* BeforeAttributeValue */; + if (c === CharCodes.Eq) { + this.state = State.BeforeAttributeValue; } - else if (c === "/" || c === ">") { - this.cbs.onattribend(undefined); - this._state = 8 /* BeforeAttributeName */; - this._index--; + else if (c === CharCodes.Slash || c === CharCodes.Gt) { + this.cbs.onattribend(QuoteType.NoValue, this.index); + this.state = State.BeforeAttributeName; + this.stateBeforeAttributeName(c); } - else if (!whitespace(c)) { - this.cbs.onattribend(undefined); - this._state = 9 /* InAttributeName */; - this.sectionStart = this._index; + else if (!isWhitespace(c)) { + this.cbs.onattribend(QuoteType.NoValue, this.index); + this.state = State.InAttributeName; + this.sectionStart = this.index; } }; Tokenizer.prototype.stateBeforeAttributeValue = function (c) { - if (c === '"') { - this._state = 12 /* InAttributeValueDq */; - this.sectionStart = this._index + 1; + if (c === CharCodes.DoubleQuote) { + this.state = State.InAttributeValueDq; + this.sectionStart = this.index + 1; } - else if (c === "'") { - this._state = 13 /* InAttributeValueSq */; - this.sectionStart = this._index + 1; + else if (c === CharCodes.SingleQuote) { + this.state = State.InAttributeValueSq; + this.sectionStart = this.index + 1; } - else if (!whitespace(c)) { - this._state = 14 /* InAttributeValueNq */; - this.sectionStart = this._index; - this._index--; // Reconsume token + else if (!isWhitespace(c)) { + this.sectionStart = this.index; + this.state = State.InAttributeValueNq; + this.stateInAttributeValueNoQuotes(c); // Reconsume token } }; Tokenizer.prototype.handleInAttributeValue = function (c, quote) { - if (c === quote) { - this.emitToken("onattribdata"); - this.cbs.onattribend(quote); - this._state = 8 /* BeforeAttributeName */; + if (c === quote || + (!this.decodeEntities && this.fastForwardTo(quote))) { + this.cbs.onattribdata(this.sectionStart, this.index); + this.sectionStart = -1; + this.cbs.onattribend(quote === CharCodes.DoubleQuote + ? QuoteType.Double + : QuoteType.Single, this.index); + this.state = State.BeforeAttributeName; } - else if (this.decodeEntities && c === "&") { - this.emitToken("onattribdata"); - this.baseState = this._state; - this._state = 62 /* BeforeEntity */; - this.sectionStart = this._index; + else if (this.decodeEntities && c === CharCodes.Amp) { + this.baseState = this.state; + this.state = State.BeforeEntity; } }; Tokenizer.prototype.stateInAttributeValueDoubleQuotes = function (c) { - this.handleInAttributeValue(c, '"'); + this.handleInAttributeValue(c, CharCodes.DoubleQuote); }; Tokenizer.prototype.stateInAttributeValueSingleQuotes = function (c) { - this.handleInAttributeValue(c, "'"); + this.handleInAttributeValue(c, CharCodes.SingleQuote); }; Tokenizer.prototype.stateInAttributeValueNoQuotes = function (c) { - if (whitespace(c) || c === ">") { - this.emitToken("onattribdata"); - this.cbs.onattribend(null); - this._state = 8 /* BeforeAttributeName */; - this._index--; + if (isWhitespace(c) || c === CharCodes.Gt) { + this.cbs.onattribdata(this.sectionStart, this.index); + this.sectionStart = -1; + this.cbs.onattribend(QuoteType.Unquoted, this.index); + this.state = State.BeforeAttributeName; + this.stateBeforeAttributeName(c); } - else if (this.decodeEntities && c === "&") { - this.emitToken("onattribdata"); - this.baseState = this._state; - this._state = 62 /* BeforeEntity */; - this.sectionStart = this._index; + else if (this.decodeEntities && c === CharCodes.Amp) { + this.baseState = this.state; + this.state = State.BeforeEntity; } }; Tokenizer.prototype.stateBeforeDeclaration = function (c) { - this._state = - c === "[" - ? 23 /* BeforeCdata1 */ - : c === "-" - ? 18 /* BeforeComment */ - : 16 /* InDeclaration */; + if (c === CharCodes.OpeningSquareBracket) { + this.state = State.CDATASequence; + this.sequenceIndex = 0; + } + else { + this.state = + c === CharCodes.Dash + ? State.BeforeComment + : State.InDeclaration; + } }; Tokenizer.prototype.stateInDeclaration = function (c) { - if (c === ">") { - this.cbs.ondeclaration(this.getSection()); - this._state = 1 /* Text */; - this.sectionStart = this._index + 1; + if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) { + this.cbs.ondeclaration(this.sectionStart, this.index); + this.state = State.Text; + this.sectionStart = this.index + 1; } }; Tokenizer.prototype.stateInProcessingInstruction = function (c) { - if (c === ">") { - this.cbs.onprocessinginstruction(this.getSection()); - this._state = 1 /* Text */; - this.sectionStart = this._index + 1; + if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) { + this.cbs.onprocessinginstruction(this.sectionStart, this.index); + this.state = State.Text; + this.sectionStart = this.index + 1; } }; Tokenizer.prototype.stateBeforeComment = function (c) { - if (c === "-") { - this._state = 19 /* InComment */; - this.sectionStart = this._index + 1; + if (c === CharCodes.Dash) { + this.state = State.InCommentLike; + this.currentSequence = Sequences.CommentEnd; + // Allow short comments (eg. ) + this.sequenceIndex = 2; + this.sectionStart = this.index + 1; } else { - this._state = 16 /* InDeclaration */; + this.state = State.InDeclaration; } }; - Tokenizer.prototype.stateInComment = function (c) { - if (c === "-") - this._state = 21 /* AfterComment1 */; - }; Tokenizer.prototype.stateInSpecialComment = function (c) { - if (c === ">") { - this.cbs.oncomment(this.buffer.substring(this.sectionStart, this._index)); - this._state = 1 /* Text */; - this.sectionStart = this._index + 1; + if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) { + this.cbs.oncomment(this.sectionStart, this.index, 0); + this.state = State.Text; + this.sectionStart = this.index + 1; } }; - Tokenizer.prototype.stateAfterComment1 = function (c) { - if (c === "-") { - this._state = 22 /* AfterComment2 */; - } - else { - this._state = 19 /* InComment */; - } - }; - Tokenizer.prototype.stateAfterComment2 = function (c) { - if (c === ">") { - // Remove 2 trailing chars - this.cbs.oncomment(this.buffer.substring(this.sectionStart, this._index - 2)); - this._state = 1 /* Text */; - this.sectionStart = this._index + 1; - } - else if (c !== "-") { - this._state = 19 /* InComment */; - } - // Else: stay in AFTER_COMMENT_2 (`--->`) - }; - Tokenizer.prototype.stateBeforeCdata6 = function (c) { - if (c === "[") { - this._state = 29 /* InCdata */; - this.sectionStart = this._index + 1; - } - else { - this._state = 16 /* InDeclaration */; - this._index--; - } - }; - Tokenizer.prototype.stateInCdata = function (c) { - if (c === "]") - this._state = 30 /* AfterCdata1 */; - }; - Tokenizer.prototype.stateAfterCdata1 = function (c) { - if (c === "]") - this._state = 31 /* AfterCdata2 */; - else - this._state = 29 /* InCdata */; - }; - Tokenizer.prototype.stateAfterCdata2 = function (c) { - if (c === ">") { - // Remove 2 trailing chars - this.cbs.oncdata(this.buffer.substring(this.sectionStart, this._index - 2)); - this._state = 1 /* Text */; - this.sectionStart = this._index + 1; - } - else if (c !== "]") { - this._state = 29 /* InCdata */; - } - // Else: stay in AFTER_CDATA_2 (`]]]>`) - }; Tokenizer.prototype.stateBeforeSpecialS = function (c) { - if (c === "c" || c === "C") { - this._state = 34 /* BeforeScript1 */; + var lower = c | 0x20; + if (lower === Sequences.ScriptEnd[3]) { + this.startSpecial(Sequences.ScriptEnd, 4); } - else if (c === "t" || c === "T") { - this._state = 44 /* BeforeStyle1 */; + else if (lower === Sequences.StyleEnd[3]) { + this.startSpecial(Sequences.StyleEnd, 4); } else { - this._state = 3 /* InTagName */; - this._index--; // Consume the token again + this.state = State.InTagName; + this.stateInTagName(c); // Consume the token again } }; - Tokenizer.prototype.stateBeforeSpecialSEnd = function (c) { - if (this.special === 2 /* Script */ && (c === "c" || c === "C")) { - this._state = 39 /* AfterScript1 */; + Tokenizer.prototype.stateBeforeEntity = function (c) { + // Start excess with 1 to include the '&' + this.entityExcess = 1; + this.entityResult = 0; + if (c === CharCodes.Num) { + this.state = State.BeforeNumericEntity; } - else if (this.special === 3 /* Style */ && (c === "t" || c === "T")) { - this._state = 48 /* AfterStyle1 */; + else if (c === CharCodes.Amp) { + // We have two `&` characters in a row. Stay in the current state. } - else - this._state = 1 /* Text */; - }; - Tokenizer.prototype.stateBeforeSpecialLast = function (c, special) { - if (c === "/" || c === ">" || whitespace(c)) { - this.special = special; - } - this._state = 3 /* InTagName */; - this._index--; // Consume the token again - }; - Tokenizer.prototype.stateAfterSpecialLast = function (c, sectionStartOffset) { - if (c === ">" || whitespace(c)) { - this.special = 1 /* None */; - this._state = 6 /* InClosingTagName */; - this.sectionStart = this._index - sectionStartOffset; - this._index--; // Reconsume the token - } - else - this._state = 1 /* Text */; - }; - // For entities terminated with a semicolon - Tokenizer.prototype.parseFixedEntity = function (map) { - if (map === void 0) { map = this.xmlMode ? xml_json_1.default : entities_json_1.default; } - // Offset = 1 - if (this.sectionStart + 1 < this._index) { - var entity = this.buffer.substring(this.sectionStart + 1, this._index); - if (Object.prototype.hasOwnProperty.call(map, entity)) { - this.emitPartial(map[entity]); - this.sectionStart = this._index + 1; - } - } - }; - // Parses legacy entities (without trailing semicolon) - Tokenizer.prototype.parseLegacyEntity = function () { - var start = this.sectionStart + 1; - // The max length of legacy entities is 6 - var limit = Math.min(this._index - start, 6); - while (limit >= 2) { - // The min length of legacy entities is 2 - var entity = this.buffer.substr(start, limit); - if (Object.prototype.hasOwnProperty.call(legacy_json_1.default, entity)) { - this.emitPartial(legacy_json_1.default[entity]); - this.sectionStart += limit + 1; - return; - } - limit--; + else { + this.trieIndex = 0; + this.trieCurrent = this.entityTrie[0]; + this.state = State.InNamedEntity; + this.stateInNamedEntity(c); } }; Tokenizer.prototype.stateInNamedEntity = function (c) { - if (c === ";") { - this.parseFixedEntity(); - // Retry as legacy entity if entity wasn't parsed - if (this.baseState === 1 /* Text */ && - this.sectionStart + 1 < this._index && - !this.xmlMode) { - this.parseLegacyEntity(); - } - this._state = this.baseState; + this.entityExcess += 1; + this.trieIndex = (0, decode_js_1.determineBranch)(this.entityTrie, this.trieCurrent, this.trieIndex + 1, c); + if (this.trieIndex < 0) { + this.emitNamedEntity(); + this.index--; + return; } - else if ((c < "0" || c > "9") && !isASCIIAlpha(c)) { - if (this.xmlMode || this.sectionStart + 1 === this._index) { - // Ignore + this.trieCurrent = this.entityTrie[this.trieIndex]; + var masked = this.trieCurrent & decode_js_1.BinTrieFlags.VALUE_LENGTH; + // If the branch is a value, store it and continue + if (masked) { + // The mask is the number of bytes of the value, including the current byte. + var valueLength = (masked >> 14) - 1; + // If we have a legacy entity while parsing strictly, just skip the number of bytes + if (!this.allowLegacyEntity() && c !== CharCodes.Semi) { + this.trieIndex += valueLength; } - else if (this.baseState !== 1 /* Text */) { - if (c !== "=") { - // Parse as legacy entity, without allowing additional characters. - this.parseFixedEntity(legacy_json_1.default); + else { + // Add 1 as we have already incremented the excess + var entityStart = this.index - this.entityExcess + 1; + if (entityStart > this.sectionStart) { + this.emitPartial(this.sectionStart, entityStart); + } + // If this is a surrogate pair, consume the next two bytes + this.entityResult = this.trieIndex; + this.trieIndex += valueLength; + this.entityExcess = 0; + this.sectionStart = this.index + 1; + if (valueLength === 0) { + this.emitNamedEntity(); } } - else { - this.parseLegacyEntity(); - } - this._state = this.baseState; - this._index--; } }; - Tokenizer.prototype.decodeNumericEntity = function (offset, base, strict) { - var sectionStart = this.sectionStart + offset; - if (sectionStart !== this._index) { - // Parse entity - var entity = this.buffer.substring(sectionStart, this._index); - var parsed = parseInt(entity, base); - this.emitPartial(decode_codepoint_1.default(parsed)); - this.sectionStart = strict ? this._index + 1 : this._index; + Tokenizer.prototype.emitNamedEntity = function () { + this.state = this.baseState; + if (this.entityResult === 0) { + return; } - this._state = this.baseState; + var valueLength = (this.entityTrie[this.entityResult] & decode_js_1.BinTrieFlags.VALUE_LENGTH) >> + 14; + switch (valueLength) { + case 1: + this.emitCodePoint(this.entityTrie[this.entityResult] & + ~decode_js_1.BinTrieFlags.VALUE_LENGTH); + break; + case 2: + this.emitCodePoint(this.entityTrie[this.entityResult + 1]); + break; + case 3: { + this.emitCodePoint(this.entityTrie[this.entityResult + 1]); + this.emitCodePoint(this.entityTrie[this.entityResult + 2]); + } + } + }; + Tokenizer.prototype.stateBeforeNumericEntity = function (c) { + if ((c | 0x20) === CharCodes.LowerX) { + this.entityExcess++; + this.state = State.InHexEntity; + } + else { + this.state = State.InNumericEntity; + this.stateInNumericEntity(c); + } + }; + Tokenizer.prototype.emitNumericEntity = function (strict) { + var entityStart = this.index - this.entityExcess - 1; + var numberStart = entityStart + 2 + Number(this.state === State.InHexEntity); + if (numberStart !== this.index) { + // Emit leading data if any + if (entityStart > this.sectionStart) { + this.emitPartial(this.sectionStart, entityStart); + } + this.sectionStart = this.index + Number(strict); + this.emitCodePoint((0, decode_js_1.replaceCodePoint)(this.entityResult)); + } + this.state = this.baseState; }; Tokenizer.prototype.stateInNumericEntity = function (c) { - if (c === ";") { - this.decodeNumericEntity(2, 10, true); + if (c === CharCodes.Semi) { + this.emitNumericEntity(true); } - else if (c < "0" || c > "9") { - if (!this.xmlMode) { - this.decodeNumericEntity(2, 10, false); + else if (isNumber(c)) { + this.entityResult = this.entityResult * 10 + (c - CharCodes.Zero); + this.entityExcess++; + } + else { + if (this.allowLegacyEntity()) { + this.emitNumericEntity(false); } else { - this._state = this.baseState; + this.state = this.baseState; } - this._index--; + this.index--; } }; Tokenizer.prototype.stateInHexEntity = function (c) { - if (c === ";") { - this.decodeNumericEntity(3, 16, true); + if (c === CharCodes.Semi) { + this.emitNumericEntity(true); } - else if ((c < "a" || c > "f") && - (c < "A" || c > "F") && - (c < "0" || c > "9")) { - if (!this.xmlMode) { - this.decodeNumericEntity(3, 16, false); + else if (isNumber(c)) { + this.entityResult = this.entityResult * 16 + (c - CharCodes.Zero); + this.entityExcess++; + } + else if (isHexDigit(c)) { + this.entityResult = + this.entityResult * 16 + ((c | 0x20) - CharCodes.LowerA + 10); + this.entityExcess++; + } + else { + if (this.allowLegacyEntity()) { + this.emitNumericEntity(false); } else { - this._state = this.baseState; + this.state = this.baseState; } - this._index--; + this.index--; } }; + Tokenizer.prototype.allowLegacyEntity = function () { + return (!this.xmlMode && + (this.baseState === State.Text || + this.baseState === State.InSpecialTag)); + }; + /** + * Remove data that has already been consumed from the buffer. + */ Tokenizer.prototype.cleanup = function () { - if (this.sectionStart < 0) { - this.buffer = ""; - this.bufferOffset += this._index; - this._index = 0; - } - else if (this.running) { - if (this._state === 1 /* Text */) { - if (this.sectionStart !== this._index) { - this.cbs.ontext(this.buffer.substr(this.sectionStart)); - } - this.buffer = ""; - this.bufferOffset += this._index; - this._index = 0; - } - else if (this.sectionStart === this._index) { - // The section just started - this.buffer = ""; - this.bufferOffset += this._index; - this._index = 0; - } - else { - // Remove everything unnecessary - this.buffer = this.buffer.substr(this.sectionStart); - this._index -= this.sectionStart; - this.bufferOffset += this.sectionStart; - } - this.sectionStart = 0; + // If we are inside of text or attributes, emit what we already have. + if (this.running && this.sectionStart !== this.index) { + if (this.state === State.Text || + (this.state === State.InSpecialTag && this.sequenceIndex === 0)) { + this.cbs.ontext(this.sectionStart, this.index); + this.sectionStart = this.index; + } + else if (this.state === State.InAttributeValueDq || + this.state === State.InAttributeValueSq || + this.state === State.InAttributeValueNq) { + this.cbs.onattribdata(this.sectionStart, this.index); + this.sectionStart = this.index; + } } }; + Tokenizer.prototype.shouldContinue = function () { + return this.index < this.buffer.length + this.offset && this.running; + }; /** * Iterates through the buffer, calling the function corresponding to the current state. * * States that are more likely to be hit are higher up, as a performance improvement. */ Tokenizer.prototype.parse = function () { - while (this._index < this.buffer.length && this.running) { - var c = this.buffer.charAt(this._index); - if (this._state === 1 /* Text */) { + while (this.shouldContinue()) { + var c = this.buffer.charCodeAt(this.index - this.offset); + if (this.state === State.Text) { this.stateText(c); } - else if (this._state === 12 /* InAttributeValueDq */) { + else if (this.state === State.SpecialStartSequence) { + this.stateSpecialStartSequence(c); + } + else if (this.state === State.InSpecialTag) { + this.stateInSpecialTag(c); + } + else if (this.state === State.CDATASequence) { + this.stateCDATASequence(c); + } + else if (this.state === State.InAttributeValueDq) { this.stateInAttributeValueDoubleQuotes(c); } - else if (this._state === 9 /* InAttributeName */) { + else if (this.state === State.InAttributeName) { this.stateInAttributeName(c); } - else if (this._state === 19 /* InComment */) { - this.stateInComment(c); + else if (this.state === State.InCommentLike) { + this.stateInCommentLike(c); } - else if (this._state === 20 /* InSpecialComment */) { + else if (this.state === State.InSpecialComment) { this.stateInSpecialComment(c); } - else if (this._state === 8 /* BeforeAttributeName */) { + else if (this.state === State.BeforeAttributeName) { this.stateBeforeAttributeName(c); } - else if (this._state === 3 /* InTagName */) { + else if (this.state === State.InTagName) { this.stateInTagName(c); } - else if (this._state === 6 /* InClosingTagName */) { + else if (this.state === State.InClosingTagName) { this.stateInClosingTagName(c); } - else if (this._state === 2 /* BeforeTagName */) { + else if (this.state === State.BeforeTagName) { this.stateBeforeTagName(c); } - else if (this._state === 10 /* AfterAttributeName */) { + else if (this.state === State.AfterAttributeName) { this.stateAfterAttributeName(c); } - else if (this._state === 13 /* InAttributeValueSq */) { + else if (this.state === State.InAttributeValueSq) { this.stateInAttributeValueSingleQuotes(c); } - else if (this._state === 11 /* BeforeAttributeValue */) { + else if (this.state === State.BeforeAttributeValue) { this.stateBeforeAttributeValue(c); } - else if (this._state === 5 /* BeforeClosingTagName */) { + else if (this.state === State.BeforeClosingTagName) { this.stateBeforeClosingTagName(c); } - else if (this._state === 7 /* AfterClosingTagName */) { + else if (this.state === State.AfterClosingTagName) { this.stateAfterClosingTagName(c); } - else if (this._state === 32 /* BeforeSpecialS */) { + else if (this.state === State.BeforeSpecialS) { this.stateBeforeSpecialS(c); } - else if (this._state === 21 /* AfterComment1 */) { - this.stateAfterComment1(c); - } - else if (this._state === 14 /* InAttributeValueNq */) { + else if (this.state === State.InAttributeValueNq) { this.stateInAttributeValueNoQuotes(c); } - else if (this._state === 4 /* InSelfClosingTag */) { + else if (this.state === State.InSelfClosingTag) { this.stateInSelfClosingTag(c); } - else if (this._state === 16 /* InDeclaration */) { + else if (this.state === State.InDeclaration) { this.stateInDeclaration(c); } - else if (this._state === 15 /* BeforeDeclaration */) { + else if (this.state === State.BeforeDeclaration) { this.stateBeforeDeclaration(c); } - else if (this._state === 22 /* AfterComment2 */) { - this.stateAfterComment2(c); - } - else if (this._state === 18 /* BeforeComment */) { + else if (this.state === State.BeforeComment) { this.stateBeforeComment(c); } - else if (this._state === 33 /* BeforeSpecialSEnd */) { - this.stateBeforeSpecialSEnd(c); - } - else if (this._state === 53 /* BeforeSpecialTEnd */) { - stateAfterSpecialTEnd(this, c); - } - else if (this._state === 39 /* AfterScript1 */) { - stateAfterScript1(this, c); - } - else if (this._state === 40 /* AfterScript2 */) { - stateAfterScript2(this, c); - } - else if (this._state === 41 /* AfterScript3 */) { - stateAfterScript3(this, c); - } - else if (this._state === 34 /* BeforeScript1 */) { - stateBeforeScript1(this, c); - } - else if (this._state === 35 /* BeforeScript2 */) { - stateBeforeScript2(this, c); - } - else if (this._state === 36 /* BeforeScript3 */) { - stateBeforeScript3(this, c); - } - else if (this._state === 37 /* BeforeScript4 */) { - stateBeforeScript4(this, c); - } - else if (this._state === 38 /* BeforeScript5 */) { - this.stateBeforeSpecialLast(c, 2 /* Script */); - } - else if (this._state === 42 /* AfterScript4 */) { - stateAfterScript4(this, c); - } - else if (this._state === 43 /* AfterScript5 */) { - this.stateAfterSpecialLast(c, 6); - } - else if (this._state === 44 /* BeforeStyle1 */) { - stateBeforeStyle1(this, c); - } - else if (this._state === 29 /* InCdata */) { - this.stateInCdata(c); - } - else if (this._state === 45 /* BeforeStyle2 */) { - stateBeforeStyle2(this, c); - } - else if (this._state === 46 /* BeforeStyle3 */) { - stateBeforeStyle3(this, c); - } - else if (this._state === 47 /* BeforeStyle4 */) { - this.stateBeforeSpecialLast(c, 3 /* Style */); - } - else if (this._state === 48 /* AfterStyle1 */) { - stateAfterStyle1(this, c); - } - else if (this._state === 49 /* AfterStyle2 */) { - stateAfterStyle2(this, c); - } - else if (this._state === 50 /* AfterStyle3 */) { - stateAfterStyle3(this, c); - } - else if (this._state === 51 /* AfterStyle4 */) { - this.stateAfterSpecialLast(c, 5); - } - else if (this._state === 52 /* BeforeSpecialT */) { - stateBeforeSpecialT(this, c); - } - else if (this._state === 54 /* BeforeTitle1 */) { - stateBeforeTitle1(this, c); - } - else if (this._state === 55 /* BeforeTitle2 */) { - stateBeforeTitle2(this, c); - } - else if (this._state === 56 /* BeforeTitle3 */) { - stateBeforeTitle3(this, c); - } - else if (this._state === 57 /* BeforeTitle4 */) { - this.stateBeforeSpecialLast(c, 4 /* Title */); - } - else if (this._state === 58 /* AfterTitle1 */) { - stateAfterTitle1(this, c); - } - else if (this._state === 59 /* AfterTitle2 */) { - stateAfterTitle2(this, c); - } - else if (this._state === 60 /* AfterTitle3 */) { - stateAfterTitle3(this, c); - } - else if (this._state === 61 /* AfterTitle4 */) { - this.stateAfterSpecialLast(c, 5); - } - else if (this._state === 17 /* InProcessingInstruction */) { + else if (this.state === State.InProcessingInstruction) { this.stateInProcessingInstruction(c); } - else if (this._state === 64 /* InNamedEntity */) { + else if (this.state === State.InNamedEntity) { this.stateInNamedEntity(c); } - else if (this._state === 23 /* BeforeCdata1 */) { - stateBeforeCdata1(this, c); + else if (this.state === State.BeforeEntity) { + this.stateBeforeEntity(c); } - else if (this._state === 62 /* BeforeEntity */) { - stateBeforeEntity(this, c); - } - else if (this._state === 24 /* BeforeCdata2 */) { - stateBeforeCdata2(this, c); - } - else if (this._state === 25 /* BeforeCdata3 */) { - stateBeforeCdata3(this, c); - } - else if (this._state === 30 /* AfterCdata1 */) { - this.stateAfterCdata1(c); - } - else if (this._state === 31 /* AfterCdata2 */) { - this.stateAfterCdata2(c); - } - else if (this._state === 26 /* BeforeCdata4 */) { - stateBeforeCdata4(this, c); - } - else if (this._state === 27 /* BeforeCdata5 */) { - stateBeforeCdata5(this, c); - } - else if (this._state === 28 /* BeforeCdata6 */) { - this.stateBeforeCdata6(c); - } - else if (this._state === 66 /* InHexEntity */) { + else if (this.state === State.InHexEntity) { this.stateInHexEntity(c); } - else if (this._state === 65 /* InNumericEntity */) { + else if (this.state === State.InNumericEntity) { this.stateInNumericEntity(c); - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - } - else if (this._state === 63 /* BeforeNumericEntity */) { - stateBeforeNumericEntity(this, c); } else { - this.cbs.onerror(Error("unknown _state"), this._state); + // `this._state === State.BeforeNumericEntity` + this.stateBeforeNumericEntity(c); } - this._index++; + this.index++; } this.cleanup(); }; Tokenizer.prototype.finish = function () { + if (this.state === State.InNamedEntity) { + this.emitNamedEntity(); + } // If there is remaining data, emit it in a reasonable way - if (this.sectionStart < this._index) { + if (this.sectionStart < this.index) { this.handleTrailingData(); } this.cbs.onend(); }; + /** Handle any trailing data. */ Tokenizer.prototype.handleTrailingData = function () { - var data = this.buffer.substr(this.sectionStart); - if (this._state === 29 /* InCdata */ || - this._state === 30 /* AfterCdata1 */ || - this._state === 31 /* AfterCdata2 */) { - this.cbs.oncdata(data); - } - else if (this._state === 19 /* InComment */ || - this._state === 21 /* AfterComment1 */ || - this._state === 22 /* AfterComment2 */) { - this.cbs.oncomment(data); - } - else if (this._state === 64 /* InNamedEntity */ && !this.xmlMode) { - this.parseLegacyEntity(); - if (this.sectionStart < this._index) { - this._state = this.baseState; - this.handleTrailingData(); + var endIndex = this.buffer.length + this.offset; + if (this.state === State.InCommentLike) { + if (this.currentSequence === Sequences.CdataEnd) { + this.cbs.oncdata(this.sectionStart, endIndex, 0); + } + else { + this.cbs.oncomment(this.sectionStart, endIndex, 0); } } - else if (this._state === 65 /* InNumericEntity */ && !this.xmlMode) { - this.decodeNumericEntity(2, 10, false); - if (this.sectionStart < this._index) { - this._state = this.baseState; - this.handleTrailingData(); - } + else if (this.state === State.InNumericEntity && + this.allowLegacyEntity()) { + this.emitNumericEntity(false); + // All trailing data will have been consumed } - else if (this._state === 66 /* InHexEntity */ && !this.xmlMode) { - this.decodeNumericEntity(3, 16, false); - if (this.sectionStart < this._index) { - this._state = this.baseState; - this.handleTrailingData(); - } + else if (this.state === State.InHexEntity && + this.allowLegacyEntity()) { + this.emitNumericEntity(false); + // All trailing data will have been consumed } - else if (this._state !== 3 /* InTagName */ && - this._state !== 8 /* BeforeAttributeName */ && - this._state !== 11 /* BeforeAttributeValue */ && - this._state !== 10 /* AfterAttributeName */ && - this._state !== 9 /* InAttributeName */ && - this._state !== 13 /* InAttributeValueSq */ && - this._state !== 12 /* InAttributeValueDq */ && - this._state !== 14 /* InAttributeValueNq */ && - this._state !== 6 /* InClosingTagName */) { - this.cbs.ontext(data); - } - /* - * Else, ignore remaining data - * TODO add a way to remove current tag - */ - }; - Tokenizer.prototype.getSection = function () { - return this.buffer.substring(this.sectionStart, this._index); - }; - Tokenizer.prototype.emitToken = function (name) { - this.cbs[name](this.getSection()); - this.sectionStart = -1; - }; - Tokenizer.prototype.emitPartial = function (value) { - if (this.baseState !== 1 /* Text */) { - this.cbs.onattribdata(value); // TODO implement the new event + else if (this.state === State.InTagName || + this.state === State.BeforeAttributeName || + this.state === State.BeforeAttributeValue || + this.state === State.AfterAttributeName || + this.state === State.InAttributeName || + this.state === State.InAttributeValueSq || + this.state === State.InAttributeValueDq || + this.state === State.InAttributeValueNq || + this.state === State.InClosingTagName) { + /* + * If we are currently in an opening or closing tag, us not calling the + * respective callback signals that the tag should be ignored. + */ } else { - this.cbs.ontext(value); + this.cbs.ontext(this.sectionStart, endIndex); + } + }; + Tokenizer.prototype.emitPartial = function (start, endIndex) { + if (this.baseState !== State.Text && + this.baseState !== State.InSpecialTag) { + this.cbs.onattribdata(start, endIndex); + } + else { + this.cbs.ontext(start, endIndex); + } + }; + Tokenizer.prototype.emitCodePoint = function (cp) { + if (this.baseState !== State.Text && + this.baseState !== State.InSpecialTag) { + this.cbs.onattribentity(cp); + } + else { + this.cbs.ontextentity(cp); } }; return Tokenizer; }()); exports.default = Tokenizer; +//# sourceMappingURL=Tokenizer.js.map \ No newline at end of file diff --git a/node_modules/htmlparser2/lib/WritableStream.d.ts b/node_modules/htmlparser2/lib/WritableStream.d.ts index 0755f99..a27dfe9 100644 --- a/node_modules/htmlparser2/lib/WritableStream.d.ts +++ b/node_modules/htmlparser2/lib/WritableStream.d.ts @@ -1,5 +1,5 @@ /// -import { Handler, ParserOptions } from "./Parser"; +import { Handler, ParserOptions } from "./Parser.js"; import { Writable } from "stream"; /** * WritableStream makes the `Parser` interface available as a NodeJS stream. diff --git a/node_modules/htmlparser2/lib/WritableStream.d.ts.map b/node_modules/htmlparser2/lib/WritableStream.d.ts.map index 31295a2..7b75253 100644 --- a/node_modules/htmlparser2/lib/WritableStream.d.ts.map +++ b/node_modules/htmlparser2/lib/WritableStream.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"WritableStream.d.ts","sourceRoot":"","sources":["../src/WritableStream.ts"],"names":[],"mappings":";AAAA,OAAO,EAAU,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAK1D,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAQlC;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IACxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAuB;gBAEpC,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,aAAa;IAK1D,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI;IAOtE,MAAM,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI;CAI/B"} \ No newline at end of file +{"version":3,"file":"WritableStream.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/htmlparser2/4763205746cd80120b5d2b69041197a394d24ba9/src/","sources":["WritableStream.ts"],"names":[],"mappings":";AAAA,OAAO,EAAU,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAK7D,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAQlC;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IACxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAuB;gBAEpC,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,aAAa;IAKjD,MAAM,CACX,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,MAAM,IAAI,GACf,IAAI;IAOE,MAAM,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI;CAIxC"} \ No newline at end of file diff --git a/node_modules/htmlparser2/lib/WritableStream.js b/node_modules/htmlparser2/lib/WritableStream.js index ff87995..2712385 100644 --- a/node_modules/htmlparser2/lib/WritableStream.js +++ b/node_modules/htmlparser2/lib/WritableStream.js @@ -16,7 +16,7 @@ var __extends = (this && this.__extends) || (function () { })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.WritableStream = void 0; -var Parser_1 = require("./Parser"); +var Parser_js_1 = require("./Parser.js"); /* * NOTE: If either of these two imports produces a type error, * please update your @types/node dependency! @@ -37,7 +37,7 @@ var WritableStream = /** @class */ (function (_super) { function WritableStream(cbs, options) { var _this = _super.call(this, { decodeStrings: false }) || this; _this._decoder = new string_decoder_1.StringDecoder(); - _this._parser = new Parser_1.Parser(cbs, options); + _this._parser = new Parser_js_1.Parser(cbs, options); return _this; } WritableStream.prototype._write = function (chunk, encoding, cb) { @@ -51,3 +51,4 @@ var WritableStream = /** @class */ (function (_super) { return WritableStream; }(stream_1.Writable)); exports.WritableStream = WritableStream; +//# sourceMappingURL=WritableStream.js.map \ No newline at end of file diff --git a/node_modules/htmlparser2/lib/index.d.ts b/node_modules/htmlparser2/lib/index.d.ts index 997c6d9..e318b1e 100644 --- a/node_modules/htmlparser2/lib/index.d.ts +++ b/node_modules/htmlparser2/lib/index.d.ts @@ -1,7 +1,7 @@ -import { Parser, ParserOptions } from "./Parser"; -export { Parser, ParserOptions }; -import { DomHandler, DomHandlerOptions, Node, Element, Document } from "domhandler"; -export { DomHandler, DomHandlerOptions }; +import { Parser, ParserOptions } from "./Parser.js"; +export { Parser, type ParserOptions }; +import { DomHandler, DomHandlerOptions, ChildNode, Element, Document } from "domhandler"; +export { DomHandler, type DomHandlerOptions }; declare type Options = ParserOptions & DomHandlerOptions; /** * Parses the data, returns the resulting document. @@ -20,7 +20,7 @@ export declare function parseDocument(data: string, options?: Options): Document * @param options Optional options for the parser and DOM builder. * @deprecated Use `parseDocument` instead. */ -export declare function parseDOM(data: string, options?: Options): Node[]; +export declare function parseDOM(data: string, options?: Options): ChildNode[]; /** * Creates a parser instance, with an attached DOM handler. * @@ -28,12 +28,19 @@ export declare function parseDOM(data: string, options?: Options): Node[]; * @param options Optional options for the parser and DOM builder. * @param elementCb An optional callback that will be called every time a tag has been completed inside of the DOM. */ -export declare function createDomStream(cb: (error: Error | null, dom: Node[]) => void, options?: Options, elementCb?: (element: Element) => void): Parser; -export { default as Tokenizer, Callbacks as TokenizerCallbacks, } from "./Tokenizer"; +export declare function createDomStream(cb: (error: Error | null, dom: ChildNode[]) => void, options?: Options, elementCb?: (element: Element) => void): Parser; +export { default as Tokenizer, type Callbacks as TokenizerCallbacks, } from "./Tokenizer.js"; import * as ElementType from "domelementtype"; export { ElementType }; -export * from "./FeedHandler"; +import { getFeed, Feed } from "domutils"; +export { getFeed }; +/** + * Parse a feed. + * + * @param feed The feed that should be parsed, as a string. + * @param options Optionally, options for parsing. When using this, you should set `xmlMode` to `true`. + */ +export declare function parseFeed(feed: string, options?: ParserOptions & DomHandlerOptions): Feed | null; export * as DomUtils from "domutils"; export { DomHandler as DefaultHandler }; -export { FeedHandler as RssHandler } from "./FeedHandler"; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/htmlparser2/lib/index.d.ts.map b/node_modules/htmlparser2/lib/index.d.ts.map index 058fcba..4edcea9 100644 --- a/node_modules/htmlparser2/lib/index.d.ts.map +++ b/node_modules/htmlparser2/lib/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;AAEjC,OAAO,EACH,UAAU,EACV,iBAAiB,EACjB,IAAI,EACJ,OAAO,EACP,QAAQ,EACX,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,CAAC;AAEzC,aAAK,OAAO,GAAG,aAAa,GAAG,iBAAiB,CAAC;AAIjD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,CAIvE;AACD;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,EAAE,CAEhE;AACD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC3B,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,IAAI,EAC9C,OAAO,CAAC,EAAE,OAAO,EACjB,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GACvC,MAAM,CAGR;AAED,OAAO,EACH,OAAO,IAAI,SAAS,EACpB,SAAS,IAAI,kBAAkB,GAClC,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,CAAC;AAOvB,cAAc,eAAe,CAAC;AAC9B,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAGrC,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,CAAC;AACxC,OAAO,EAAE,WAAW,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/htmlparser2/4763205746cd80120b5d2b69041197a394d24ba9/src/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,CAAC;AAEtC,OAAO,EACH,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,OAAO,EACP,QAAQ,EACX,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,CAAC;AAE9C,aAAK,OAAO,GAAG,aAAa,GAAG,iBAAiB,CAAC;AAIjD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,CAIvE;AACD;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,EAAE,CAErE;AACD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC3B,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,IAAI,EACnD,OAAO,CAAC,EAAE,OAAO,EACjB,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GACvC,MAAM,CAGR;AAED,OAAO,EACH,OAAO,IAAI,SAAS,EACpB,KAAK,SAAS,IAAI,kBAAkB,GACvC,MAAM,gBAAgB,CAAC;AAMxB,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB;;;;;GAKG;AACH,wBAAgB,SAAS,CACrB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,aAAa,GAAG,iBAAqC,GAC/D,IAAI,GAAG,IAAI,CAEb;AAED,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAGrC,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/htmlparser2/lib/index.js b/node_modules/htmlparser2/lib/index.js index 3e461fa..745020c 100644 --- a/node_modules/htmlparser2/lib/index.js +++ b/node_modules/htmlparser2/lib/index.js @@ -1,7 +1,11 @@ "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; @@ -18,16 +22,13 @@ var __importStar = (this && this.__importStar) || function (mod) { __setModuleDefault(result, mod); return result; }; -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.RssHandler = exports.DefaultHandler = exports.DomUtils = exports.ElementType = exports.Tokenizer = exports.createDomStream = exports.parseDOM = exports.parseDocument = exports.DomHandler = exports.Parser = void 0; -var Parser_1 = require("./Parser"); -Object.defineProperty(exports, "Parser", { enumerable: true, get: function () { return Parser_1.Parser; } }); +exports.DefaultHandler = exports.DomUtils = exports.parseFeed = exports.getFeed = exports.ElementType = exports.Tokenizer = exports.createDomStream = exports.parseDOM = exports.parseDocument = exports.DomHandler = exports.Parser = void 0; +var Parser_js_1 = require("./Parser.js"); +Object.defineProperty(exports, "Parser", { enumerable: true, get: function () { return Parser_js_1.Parser; } }); var domhandler_1 = require("domhandler"); Object.defineProperty(exports, "DomHandler", { enumerable: true, get: function () { return domhandler_1.DomHandler; } }); Object.defineProperty(exports, "DefaultHandler", { enumerable: true, get: function () { return domhandler_1.DomHandler; } }); @@ -40,7 +41,7 @@ Object.defineProperty(exports, "DefaultHandler", { enumerable: true, get: functi */ function parseDocument(data, options) { var handler = new domhandler_1.DomHandler(undefined, options); - new Parser_1.Parser(handler, options).end(data); + new Parser_js_1.Parser(handler, options).end(data); return handler.root; } exports.parseDocument = parseDocument; @@ -67,18 +68,29 @@ exports.parseDOM = parseDOM; */ function createDomStream(cb, options, elementCb) { var handler = new domhandler_1.DomHandler(cb, options, elementCb); - return new Parser_1.Parser(handler, options); + return new Parser_js_1.Parser(handler, options); } exports.createDomStream = createDomStream; -var Tokenizer_1 = require("./Tokenizer"); -Object.defineProperty(exports, "Tokenizer", { enumerable: true, get: function () { return __importDefault(Tokenizer_1).default; } }); -var ElementType = __importStar(require("domelementtype")); -exports.ElementType = ElementType; +var Tokenizer_js_1 = require("./Tokenizer.js"); +Object.defineProperty(exports, "Tokenizer", { enumerable: true, get: function () { return __importDefault(Tokenizer_js_1).default; } }); /* * All of the following exports exist for backwards-compatibility. * They should probably be removed eventually. */ -__exportStar(require("./FeedHandler"), exports); +var ElementType = __importStar(require("domelementtype")); +exports.ElementType = ElementType; +var domutils_1 = require("domutils"); +Object.defineProperty(exports, "getFeed", { enumerable: true, get: function () { return domutils_1.getFeed; } }); +/** + * Parse a feed. + * + * @param feed The feed that should be parsed, as a string. + * @param options Optionally, options for parsing. When using this, you should set `xmlMode` to `true`. + */ +function parseFeed(feed, options) { + if (options === void 0) { options = { xmlMode: true }; } + return (0, domutils_1.getFeed)(parseDOM(feed, options)); +} +exports.parseFeed = parseFeed; exports.DomUtils = __importStar(require("domutils")); -var FeedHandler_1 = require("./FeedHandler"); -Object.defineProperty(exports, "RssHandler", { enumerable: true, get: function () { return FeedHandler_1.FeedHandler; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/htmlparser2/package.json b/node_modules/htmlparser2/package.json index b67f563..944b4b5 100644 --- a/node_modules/htmlparser2/package.json +++ b/node_modules/htmlparser2/package.json @@ -1,106 +1,92 @@ { - "_from": "htmlparser2@^6.1.0", - "_id": "htmlparser2@6.1.0", - "_inBundle": false, - "_integrity": "sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==", - "_location": "/htmlparser2", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "htmlparser2@^6.1.0", "name": "htmlparser2", - "escapedName": "htmlparser2", - "rawSpec": "^6.1.0", - "saveSpec": null, - "fetchSpec": "^6.1.0" - }, - "_requiredBy": [ - "/cheerio" - ], - "_resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz", - "_shasum": "c4d762b6c3371a05dbe65e94ae43a9f845fb8fb7", - "_spec": "htmlparser2@^6.1.0", - "_where": "/home/runner/work/public_library_map/public_library_map/node_modules/cheerio", - "author": { - "name": "Felix Boehm", - "email": "me@feedic.com" - }, - "bugs": { - "url": "https://github.com/fb55/htmlparser2/issues" - }, - "bundleDependencies": false, - "dependencies": { - "domelementtype": "^2.0.1", - "domhandler": "^4.0.0", - "domutils": "^2.5.2", - "entities": "^2.0.0" - }, - "deprecated": false, - "description": "Fast & forgiving HTML/XML parser", - "devDependencies": { - "@types/jest": "^26.0.0", - "@types/node": "^14.0.5", - "@typescript-eslint/eslint-plugin": "^4.9.1", - "@typescript-eslint/parser": "^4.9.1", - "eslint": "^7.15.0", - "eslint-config-prettier": "^8.1.0", - "jest": "^26.0.1", - "prettier": "^2.1.1", - "ts-jest": "^26.0.0", - "typescript": "^4.0.2" - }, - "directories": { - "lib": "lib/" - }, - "files": [ - "lib/**/*" - ], - "funding": [ - "https://github.com/fb55/htmlparser2?sponsor=1", - { - "type": "github", - "url": "https://github.com/sponsors/fb55" + "description": "Fast & forgiving HTML/XML parser", + "version": "8.0.1", + "author": "Felix Boehm ", + "funding": [ + "https://github.com/fb55/htmlparser2?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "MIT", + "sideEffects": false, + "keywords": [ + "html", + "parser", + "streams", + "xml", + "dom", + "rss", + "feed", + "atom" + ], + "repository": { + "type": "git", + "url": "git://github.com/fb55/htmlparser2.git" + }, + "directories": { + "lib": "lib/" + }, + "main": "lib/index.js", + "types": "lib/index.d.ts", + "module": "lib/esm/index.js", + "exports": { + ".": { + "require": "./lib/index.js", + "import": "./lib/esm/index.js" + }, + "./lib/WritableStream": { + "require": "./lib/WritableStream.js", + "import": "./lib/esm/WritableStream.js" + } + }, + "files": [ + "lib/**/*" + ], + "scripts": { + "test": "npm run test:jest && npm run lint", + "test:jest": "jest", + "lint": "npm run lint:es && npm run lint:prettier", + "lint:es": "eslint src", + "lint:prettier": "npm run format:prettier:raw -- --check", + "format": "npm run format:es && npm run format:prettier", + "format:es": "npm run lint:es -- --fix", + "format:prettier": "npm run format:prettier:raw -- --write", + "format:prettier:raw": "prettier '**/*.{ts,md,json,yml}'", + "build": "npm run build:cjs && npm run build:esm", + "build:cjs": "tsc --sourceRoot https://raw.githubusercontent.com/fb55/htmlparser2/$(git rev-parse HEAD)/src/", + "build:esm": "npm run build:cjs -- --module esnext --target es2019 --outDir lib/esm && echo '{\"type\":\"module\"}' > lib/esm/package.json", + "prepare": "npm run build" + }, + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", + "entities": "^4.3.0" + }, + "devDependencies": { + "@types/jest": "^27.4.1", + "@types/node": "^17.0.30", + "@typescript-eslint/eslint-plugin": "^5.21.0", + "@typescript-eslint/parser": "^5.21.0", + "eslint": "^8.14.0", + "eslint-config-prettier": "^8.5.0", + "jest": "^27.5.1", + "prettier": "^2.6.2", + "ts-jest": "^27.1.4", + "typescript": "^4.6.4" + }, + "jest": { + "preset": "ts-jest", + "testEnvironment": "node", + "coverageProvider": "v8", + "moduleNameMapper": { + "^(.*)\\.js$": "$1" + } + }, + "prettier": { + "tabWidth": 4 } - ], - "homepage": "https://github.com/fb55/htmlparser2#readme", - "jest": { - "preset": "ts-jest", - "testEnvironment": "node" - }, - "keywords": [ - "html", - "parser", - "streams", - "xml", - "dom", - "rss", - "feed", - "atom" - ], - "license": "MIT", - "main": "lib/index.js", - "name": "htmlparser2", - "prettier": { - "tabWidth": 4 - }, - "repository": { - "type": "git", - "url": "git://github.com/fb55/htmlparser2.git" - }, - "scripts": { - "build": "tsc", - "format": "npm run format:es && npm run format:prettier", - "format:es": "npm run lint:es -- --fix", - "format:prettier": "npm run format:prettier:raw -- --write", - "format:prettier:raw": "prettier '**/*.{ts,md,json,yml}'", - "lint": "npm run lint:es && npm run lint:prettier", - "lint:es": "eslint src", - "lint:prettier": "npm run format:prettier:raw -- --check", - "prepare": "npm run build", - "test": "jest --coverage" - }, - "sideEffects": false, - "types": "lib/index.d.ts", - "version": "6.1.0" } diff --git a/node_modules/nth-check/README.md b/node_modules/nth-check/README.md index d9d1acb..7a19d64 100644 --- a/node_modules/nth-check/README.md +++ b/node_modules/nth-check/README.md @@ -4,7 +4,7 @@ Parses and compiles CSS nth-checks to highly optimized functions. ### About -This module can be used to parse & compile nth-checks, as they are found in CSS 3's `nth-child()` and `nth-last-of-type()`. +This module can be used to parse & compile nth-checks, as they are found in CSS 3's `nth-child()` and `nth-last-of-type()`. It can be used to check if a given index matches a given nth-rule, or to generate a sequence of indices matching a given nth-rule. `nth-check` focusses on speed, providing optimized functions for different kinds of nth-child formulas, while still following the [spec](http://www.w3.org/TR/css3-selectors/#nth-child-pseudo). @@ -64,6 +64,62 @@ check(5); // `false` check(6); // `true` ``` +##### `generate([a, b])` + +Returns a function that produces a monotonously increasing sequence of indices. + +If the sequence has an end, the returned function will return `null` after the last index in the sequence. + +**Example:** An always increasing sequence + +```js +const gen = nthCheck.generate([2, 3]); + +gen(); // `1` +gen(); // `3` +gen(); // `5` +gen(); // `8` +gen(); // `11` +``` + +**Example:** With an end value + +```js +const gen = nthCheck.generate([-2, 5]); + +gen(); // 0 +gen(); // 2 +gen(); // 4 +gen(); // null +``` + +##### `sequence(formula)` + +Parses and compiles a formula to a generator that produces a sequence of indices. Combination of `parse` and `generate`. + +**Example:** An always increasing sequence + +```js +const gen = nthCheck.sequence("2n+3"); + +gen(); // `1` +gen(); // `3` +gen(); // `5` +gen(); // `8` +gen(); // `11` +``` + +**Example:** With an end value + +```js +const gen = nthCheck.sequence("-2n+5"); + +gen(); // 0 +gen(); // 2 +gen(); // 4 +gen(); // null +``` + --- License: BSD-2-Clause diff --git a/node_modules/nth-check/lib/compile.d.ts b/node_modules/nth-check/lib/compile.d.ts index 03a0be3..63e9be5 100644 --- a/node_modules/nth-check/lib/compile.d.ts +++ b/node_modules/nth-check/lib/compile.d.ts @@ -5,6 +5,8 @@ * @param parsed A tuple [a, b], as returned by `parse`. * @returns A highly optimized function that returns whether an index matches the nth-check. * @example + * + * ```js * const check = nthCheck.compile([2, 3]); * * check(0); // `false` @@ -14,6 +16,40 @@ * check(4); // `true` * check(5); // `false` * check(6); // `true` + * ``` */ export declare function compile(parsed: [a: number, b: number]): (index: number) => boolean; +/** + * Returns a function that produces a monotonously increasing sequence of indices. + * + * If the sequence has an end, the returned function will return `null` after + * the last index in the sequence. + * + * @param parsed A tuple [a, b], as returned by `parse`. + * @returns A function that produces a sequence of indices. + * @example Always increasing (2n+3) + * + * ```js + * const gen = nthCheck.generate([2, 3]) + * + * gen() // `1` + * gen() // `3` + * gen() // `5` + * gen() // `8` + * gen() // `11` + * ``` + * + * @example With end value (-2n+10) + * + * ```js + * + * const gen = nthCheck.generate([-2, 5]); + * + * gen() // 0 + * gen() // 2 + * gen() // 4 + * gen() // null + * ``` + */ +export declare function generate(parsed: [a: number, b: number]): () => number | null; //# sourceMappingURL=compile.d.ts.map \ No newline at end of file diff --git a/node_modules/nth-check/lib/compile.d.ts.map b/node_modules/nth-check/lib/compile.d.ts.map index d8645d6..bb64f76 100644 --- a/node_modules/nth-check/lib/compile.d.ts.map +++ b/node_modules/nth-check/lib/compile.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,OAAO,CACnB,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,GAC/B,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAgC5B"} \ No newline at end of file +{"version":3,"file":"compile.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/nth-check/639fd2a4000b69f82350aad8c34cb43f77e483ba/src/","sources":["compile.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,OAAO,CACnB,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,GAC/B,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAgC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,GAAG,MAAM,MAAM,GAAG,IAAI,CA+B5E"} \ No newline at end of file diff --git a/node_modules/nth-check/lib/compile.js b/node_modules/nth-check/lib/compile.js index 1cf3b09..cef1af4 100644 --- a/node_modules/nth-check/lib/compile.js +++ b/node_modules/nth-check/lib/compile.js @@ -1,7 +1,10 @@ "use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); -exports.compile = void 0; -var boolbase_1 = require("boolbase"); +exports.generate = exports.compile = void 0; +var boolbase_1 = __importDefault(require("boolbase")); /** * Returns a function that checks if an elements index matches the given rule * highly optimized to return the fastest solution. @@ -9,6 +12,8 @@ var boolbase_1 = require("boolbase"); * @param parsed A tuple [a, b], as returned by `parse`. * @returns A highly optimized function that returns whether an index matches the nth-check. * @example + * + * ```js * const check = nthCheck.compile([2, 3]); * * check(0); // `false` @@ -18,6 +23,7 @@ var boolbase_1 = require("boolbase"); * check(4); // `true` * check(5); // `false` * check(6); // `true` + * ``` */ function compile(parsed) { var a = parsed[0]; @@ -31,7 +37,7 @@ function compile(parsed) { * `b < 0` here as we subtracted 1 from `b` above. */ if (b < 0 && a <= 0) - return boolbase_1.falseFunc; + return boolbase_1.default.falseFunc; // When `a` is in the range -1..1, it matches any element (so only `b` is checked). if (a === -1) return function (index) { return index <= b; }; @@ -39,7 +45,7 @@ function compile(parsed) { return function (index) { return index === b; }; // When `b <= 0` and `a === 1`, they match any element. if (a === 1) - return b < 0 ? boolbase_1.trueFunc : function (index) { return index >= b; }; + return b < 0 ? boolbase_1.default.trueFunc : function (index) { return index >= b; }; /* * Otherwise, modulo can be used to check if there is a match. * @@ -53,3 +59,63 @@ function compile(parsed) { : function (index) { return index <= b && index % absA === bMod; }; } exports.compile = compile; +/** + * Returns a function that produces a monotonously increasing sequence of indices. + * + * If the sequence has an end, the returned function will return `null` after + * the last index in the sequence. + * + * @param parsed A tuple [a, b], as returned by `parse`. + * @returns A function that produces a sequence of indices. + * @example Always increasing (2n+3) + * + * ```js + * const gen = nthCheck.generate([2, 3]) + * + * gen() // `1` + * gen() // `3` + * gen() // `5` + * gen() // `8` + * gen() // `11` + * ``` + * + * @example With end value (-2n+10) + * + * ```js + * + * const gen = nthCheck.generate([-2, 5]); + * + * gen() // 0 + * gen() // 2 + * gen() // 4 + * gen() // null + * ``` + */ +function generate(parsed) { + var a = parsed[0]; + // Subtract 1 from `b`, to convert from one- to zero-indexed. + var b = parsed[1] - 1; + var n = 0; + // Make sure to always return an increasing sequence + if (a < 0) { + var aPos_1 = -a; + // Get `b mod a` + var minValue_1 = ((b % aPos_1) + aPos_1) % aPos_1; + return function () { + var val = minValue_1 + aPos_1 * n++; + return val > b ? null : val; + }; + } + if (a === 0) + return b < 0 + ? // There are no result — always return `null` + function () { return null; } + : // Return `b` exactly once + function () { return (n++ === 0 ? b : null); }; + if (b < 0) { + b += a * Math.ceil(-b / a); + } + return function () { return a * n++ + b; }; +} +exports.generate = generate; +//# sourceMappingURL=compile.js.map \ No newline at end of file diff --git a/node_modules/nth-check/lib/index.d.ts b/node_modules/nth-check/lib/index.d.ts index dc12691..2cddd39 100644 --- a/node_modules/nth-check/lib/index.d.ts +++ b/node_modules/nth-check/lib/index.d.ts @@ -1,9 +1,9 @@ -import { parse } from "./parse"; -import { compile } from "./compile"; -export { parse, compile }; +import { parse } from "./parse.js"; +import { compile, generate } from "./compile.js"; +export { parse, compile, generate }; /** * Parses and compiles a formula to a highly optimized function. - * Combination of `parse` and `compile`. + * Combination of {@link parse} and {@link compile}. * * If the formula doesn't match any elements, * it returns [`boolbase`](https://github.com/fb55/boolbase)'s `falseFunc`. @@ -25,4 +25,35 @@ export { parse, compile }; * check(6); // `true` */ export default function nthCheck(formula: string): (index: number) => boolean; +/** + * Parses and compiles a formula to a generator that produces a sequence of indices. + * Combination of {@link parse} and {@link generate}. + * + * @param formula The formula to compile. + * @returns A function that produces a sequence of indices. + * @example Always increasing + * + * ```js + * const gen = nthCheck.sequence('2n+3') + * + * gen() // `1` + * gen() // `3` + * gen() // `5` + * gen() // `8` + * gen() // `11` + * ``` + * + * @example With end value + * + * ```js + * + * const gen = nthCheck.sequence('-2n+5'); + * + * gen() // 0 + * gen() // 2 + * gen() // 4 + * gen() // null + * ``` + */ +export declare function sequence(formula: string): () => number | null; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/nth-check/lib/index.d.ts.map b/node_modules/nth-check/lib/index.d.ts.map index eabcd19..17f9cdb 100644 --- a/node_modules/nth-check/lib/index.d.ts.map +++ b/node_modules/nth-check/lib/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAE1B;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAE5E"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/nth-check/639fd2a4000b69f82350aad8c34cb43f77e483ba/src/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAE5E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,MAAM,GAAG,IAAI,CAE7D"} \ No newline at end of file diff --git a/node_modules/nth-check/lib/index.js b/node_modules/nth-check/lib/index.js index afa219d..30a7e29 100644 --- a/node_modules/nth-check/lib/index.js +++ b/node_modules/nth-check/lib/index.js @@ -1,13 +1,14 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.compile = exports.parse = void 0; -var parse_1 = require("./parse"); -Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return parse_1.parse; } }); -var compile_1 = require("./compile"); -Object.defineProperty(exports, "compile", { enumerable: true, get: function () { return compile_1.compile; } }); +exports.sequence = exports.generate = exports.compile = exports.parse = void 0; +var parse_js_1 = require("./parse.js"); +Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return parse_js_1.parse; } }); +var compile_js_1 = require("./compile.js"); +Object.defineProperty(exports, "compile", { enumerable: true, get: function () { return compile_js_1.compile; } }); +Object.defineProperty(exports, "generate", { enumerable: true, get: function () { return compile_js_1.generate; } }); /** * Parses and compiles a formula to a highly optimized function. - * Combination of `parse` and `compile`. + * Combination of {@link parse} and {@link compile}. * * If the formula doesn't match any elements, * it returns [`boolbase`](https://github.com/fb55/boolbase)'s `falseFunc`. @@ -29,6 +30,41 @@ Object.defineProperty(exports, "compile", { enumerable: true, get: function () { * check(6); // `true` */ function nthCheck(formula) { - return (0, compile_1.compile)((0, parse_1.parse)(formula)); + return (0, compile_js_1.compile)((0, parse_js_1.parse)(formula)); } exports.default = nthCheck; +/** + * Parses and compiles a formula to a generator that produces a sequence of indices. + * Combination of {@link parse} and {@link generate}. + * + * @param formula The formula to compile. + * @returns A function that produces a sequence of indices. + * @example Always increasing + * + * ```js + * const gen = nthCheck.sequence('2n+3') + * + * gen() // `1` + * gen() // `3` + * gen() // `5` + * gen() // `8` + * gen() // `11` + * ``` + * + * @example With end value + * + * ```js + * + * const gen = nthCheck.sequence('-2n+5'); + * + * gen() // 0 + * gen() // 2 + * gen() // 4 + * gen() // null + * ``` + */ +function sequence(formula) { + return (0, compile_js_1.generate)((0, parse_js_1.parse)(formula)); +} +exports.sequence = sequence; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/nth-check/lib/parse.d.ts.map b/node_modules/nth-check/lib/parse.d.ts.map index b697621..8cd4788 100644 --- a/node_modules/nth-check/lib/parse.d.ts.map +++ b/node_modules/nth-check/lib/parse.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CA6E7D"} \ No newline at end of file +{"version":3,"file":"parse.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/nth-check/639fd2a4000b69f82350aad8c34cb43f77e483ba/src/","sources":["parse.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CA6E7D"} \ No newline at end of file diff --git a/node_modules/nth-check/lib/parse.js b/node_modules/nth-check/lib/parse.js index eaea29b..904244c 100644 --- a/node_modules/nth-check/lib/parse.js +++ b/node_modules/nth-check/lib/parse.js @@ -41,7 +41,7 @@ function parse(formula) { } // Throw if there is anything else if (number === null || idx < formula.length) { - throw new Error("n-th rule couldn't be parsed ('" + formula + "')"); + throw new Error("n-th rule couldn't be parsed ('".concat(formula, "')")); } return [a, sign * number]; function readSign() { @@ -74,3 +74,4 @@ function parse(formula) { } } exports.parse = parse; +//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/node_modules/nth-check/package.json b/node_modules/nth-check/package.json index 94be205..45ebe83 100644 --- a/node_modules/nth-check/package.json +++ b/node_modules/nth-check/package.json @@ -1,95 +1,78 @@ { - "_from": "nth-check@^2.0.0", - "_id": "nth-check@2.0.1", - "_inBundle": false, - "_integrity": "sha512-it1vE95zF6dTT9lBsYbxvqh0Soy4SPowchj0UBGj/V6cTPnXXtQOPUbhZ6CmGzAD/rW22LQK6E96pcdJXk4A4w==", - "_location": "/nth-check", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "nth-check@^2.0.0", "name": "nth-check", - "escapedName": "nth-check", - "rawSpec": "^2.0.0", - "saveSpec": null, - "fetchSpec": "^2.0.0" - }, - "_requiredBy": [ - "/css-select" - ], - "_resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.1.tgz", - "_shasum": "2efe162f5c3da06a28959fbd3db75dbeea9f0fc2", - "_spec": "nth-check@^2.0.0", - "_where": "/home/runner/work/public_library_map/public_library_map/node_modules/css-select", - "author": { - "name": "Felix Boehm", - "email": "me@feedic.com" - }, - "bugs": { - "url": "https://github.com/fb55/nth-check/issues" - }, - "bundleDependencies": false, - "dependencies": { - "boolbase": "^1.0.0" - }, - "deprecated": false, - "description": "Parses and compiles CSS nth-checks to highly optimized functions.", - "devDependencies": { - "@types/jest": "^27.0.1", - "@types/node": "^16.9.1", - "@typescript-eslint/eslint-plugin": "^4.31.1", - "@typescript-eslint/parser": "^4.31.1", - "eslint": "^7.32.0", - "eslint-config-prettier": "^8.3.0", - "jest": "^27.2.0", - "prettier": "^2.4.1", - "ts-jest": "^27.0.5", - "typescript": "^4.4.3" - }, - "directories": { - "lib": "lib/" - }, - "files": [ - "lib/**/*" - ], - "funding": { - "url": "https://github.com/fb55/nth-check?sponsor=1" - }, - "homepage": "https://github.com/fb55/nth-check", - "jest": { - "preset": "ts-jest", - "testEnvironment": "node" - }, - "keywords": [ - "nth-child", - "nth", - "css" - ], - "license": "BSD-2-Clause", - "main": "lib/index.js", - "name": "nth-check", - "prettier": { - "tabWidth": 4 - }, - "repository": { - "type": "git", - "url": "git+https://github.com/fb55/nth-check.git" - }, - "scripts": { - "build": "tsc", - "format": "npm run format:es && npm run format:prettier", - "format:es": "npm run lint:es -- --fix", - "format:prettier": "npm run prettier -- --write", - "lint": "npm run lint:es && npm run lint:prettier", - "lint:es": "eslint .", - "lint:prettier": "npm run prettier -- --check", - "prepare": "npm run build", - "prettier": "prettier '**/*.{ts,md,json,yml}'", - "test": "npm run test:jest && npm run lint", - "test:jest": "jest" - }, - "sideEffects": false, - "types": "lib/index.d.ts", - "version": "2.0.1" + "version": "2.1.1", + "description": "Parses and compiles CSS nth-checks to highly optimized functions.", + "author": "Felix Boehm ", + "license": "BSD-2-Clause", + "sideEffects": false, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + }, + "directories": { + "lib": "lib/" + }, + "main": "lib/index.js", + "types": "lib/index.d.ts", + "module": "lib/esm/index.js", + "exports": { + "require": "./lib/index.js", + "import": "./lib/esm/index.js" + }, + "files": [ + "lib/**/*" + ], + "scripts": { + "test": "npm run test:jest && npm run lint", + "test:jest": "jest", + "lint": "npm run lint:es && npm run lint:prettier", + "lint:es": "eslint .", + "lint:prettier": "npm run prettier -- --check", + "format": "npm run format:es && npm run format:prettier", + "format:es": "npm run lint:es -- --fix", + "format:prettier": "npm run prettier -- --write", + "prettier": "prettier '**/*.{ts,md,json,yml}'", + "build": "npm run build:cjs && npm run build:esm", + "build:cjs": "tsc --sourceRoot https://raw.githubusercontent.com/fb55/nth-check/$(git rev-parse HEAD)/src/", + "build:esm": "npm run build:cjs -- --module esnext --target es2019 --outDir lib/esm && echo '{\"type\":\"module\"}' > lib/esm/package.json", + "prepare": "npm run build" + }, + "repository": { + "type": "git", + "url": "https://github.com/fb55/nth-check" + }, + "keywords": [ + "nth-child", + "nth", + "css" + ], + "bugs": { + "url": "https://github.com/fb55/nth-check/issues" + }, + "homepage": "https://github.com/fb55/nth-check", + "dependencies": { + "boolbase": "^1.0.0" + }, + "devDependencies": { + "@types/boolbase": "^1.0.1", + "@types/jest": "^27.5.0", + "@types/node": "^17.0.35", + "@typescript-eslint/eslint-plugin": "^5.25.0", + "@typescript-eslint/parser": "^5.25.0", + "eslint": "^8.15.0", + "eslint-config-prettier": "^8.5.0", + "jest": "^27.5.1", + "prettier": "^2.6.2", + "ts-jest": "^27.1.4", + "typescript": "^4.6.4" + }, + "jest": { + "preset": "ts-jest", + "testEnvironment": "node", + "moduleNameMapper": { + "^(.*)\\.js$": "$1" + } + }, + "prettier": { + "tabWidth": 4 + } } diff --git a/node_modules/parse5-htmlparser2-tree-adapter/README.md b/node_modules/parse5-htmlparser2-tree-adapter/README.md index 8b61e65..a2d272f 100644 --- a/node_modules/parse5-htmlparser2-tree-adapter/README.md +++ b/node_modules/parse5-htmlparser2-tree-adapter/README.md @@ -16,7 +16,7 @@

    - 📖 Documentation 📖 + 📖 Documentation 📖

    --- @@ -30,5 +30,5 @@

    - Version history + Changelog

    diff --git a/node_modules/parse5-htmlparser2-tree-adapter/lib/index.js b/node_modules/parse5-htmlparser2-tree-adapter/lib/index.js deleted file mode 100644 index 58464d7..0000000 --- a/node_modules/parse5-htmlparser2-tree-adapter/lib/index.js +++ /dev/null @@ -1,348 +0,0 @@ -'use strict'; - -const doctype = require('parse5/lib/common/doctype'); -const { DOCUMENT_MODE } = require('parse5/lib/common/html'); - -//Conversion tables for DOM Level1 structure emulation -const nodeTypes = { - element: 1, - text: 3, - cdata: 4, - comment: 8 -}; - -const nodePropertyShorthands = { - tagName: 'name', - childNodes: 'children', - parentNode: 'parent', - previousSibling: 'prev', - nextSibling: 'next', - nodeValue: 'data' -}; - -//Node -class Node { - constructor(props) { - for (const key of Object.keys(props)) { - this[key] = props[key]; - } - } - - get firstChild() { - const children = this.children; - - return (children && children[0]) || null; - } - - get lastChild() { - const children = this.children; - - return (children && children[children.length - 1]) || null; - } - - get nodeType() { - return nodeTypes[this.type] || nodeTypes.element; - } -} - -Object.keys(nodePropertyShorthands).forEach(key => { - const shorthand = nodePropertyShorthands[key]; - - Object.defineProperty(Node.prototype, key, { - get: function() { - return this[shorthand] || null; - }, - set: function(val) { - this[shorthand] = val; - return val; - } - }); -}); - -//Node construction -exports.createDocument = function() { - return new Node({ - type: 'root', - name: 'root', - parent: null, - prev: null, - next: null, - children: [], - 'x-mode': DOCUMENT_MODE.NO_QUIRKS - }); -}; - -exports.createDocumentFragment = function() { - return new Node({ - type: 'root', - name: 'root', - parent: null, - prev: null, - next: null, - children: [] - }); -}; - -exports.createElement = function(tagName, namespaceURI, attrs) { - const attribs = Object.create(null); - const attribsNamespace = Object.create(null); - const attribsPrefix = Object.create(null); - - for (let i = 0; i < attrs.length; i++) { - const attrName = attrs[i].name; - - attribs[attrName] = attrs[i].value; - attribsNamespace[attrName] = attrs[i].namespace; - attribsPrefix[attrName] = attrs[i].prefix; - } - - return new Node({ - type: tagName === 'script' || tagName === 'style' ? tagName : 'tag', - name: tagName, - namespace: namespaceURI, - attribs: attribs, - 'x-attribsNamespace': attribsNamespace, - 'x-attribsPrefix': attribsPrefix, - children: [], - parent: null, - prev: null, - next: null - }); -}; - -exports.createCommentNode = function(data) { - return new Node({ - type: 'comment', - data: data, - parent: null, - prev: null, - next: null - }); -}; - -const createTextNode = function(value) { - return new Node({ - type: 'text', - data: value, - parent: null, - prev: null, - next: null - }); -}; - -//Tree mutation -const appendChild = (exports.appendChild = function(parentNode, newNode) { - const prev = parentNode.children[parentNode.children.length - 1]; - - if (prev) { - prev.next = newNode; - newNode.prev = prev; - } - - parentNode.children.push(newNode); - newNode.parent = parentNode; -}); - -const insertBefore = (exports.insertBefore = function(parentNode, newNode, referenceNode) { - const insertionIdx = parentNode.children.indexOf(referenceNode); - const prev = referenceNode.prev; - - if (prev) { - prev.next = newNode; - newNode.prev = prev; - } - - referenceNode.prev = newNode; - newNode.next = referenceNode; - - parentNode.children.splice(insertionIdx, 0, newNode); - newNode.parent = parentNode; -}); - -exports.setTemplateContent = function(templateElement, contentElement) { - appendChild(templateElement, contentElement); -}; - -exports.getTemplateContent = function(templateElement) { - return templateElement.children[0]; -}; - -exports.setDocumentType = function(document, name, publicId, systemId) { - const data = doctype.serializeContent(name, publicId, systemId); - let doctypeNode = null; - - for (let i = 0; i < document.children.length; i++) { - if (document.children[i].type === 'directive' && document.children[i].name === '!doctype') { - doctypeNode = document.children[i]; - break; - } - } - - if (doctypeNode) { - doctypeNode.data = data; - doctypeNode['x-name'] = name; - doctypeNode['x-publicId'] = publicId; - doctypeNode['x-systemId'] = systemId; - } else { - appendChild( - document, - new Node({ - type: 'directive', - name: '!doctype', - data: data, - 'x-name': name, - 'x-publicId': publicId, - 'x-systemId': systemId - }) - ); - } -}; - -exports.setDocumentMode = function(document, mode) { - document['x-mode'] = mode; -}; - -exports.getDocumentMode = function(document) { - return document['x-mode']; -}; - -exports.detachNode = function(node) { - if (node.parent) { - const idx = node.parent.children.indexOf(node); - const prev = node.prev; - const next = node.next; - - node.prev = null; - node.next = null; - - if (prev) { - prev.next = next; - } - - if (next) { - next.prev = prev; - } - - node.parent.children.splice(idx, 1); - node.parent = null; - } -}; - -exports.insertText = function(parentNode, text) { - const lastChild = parentNode.children[parentNode.children.length - 1]; - - if (lastChild && lastChild.type === 'text') { - lastChild.data += text; - } else { - appendChild(parentNode, createTextNode(text)); - } -}; - -exports.insertTextBefore = function(parentNode, text, referenceNode) { - const prevNode = parentNode.children[parentNode.children.indexOf(referenceNode) - 1]; - - if (prevNode && prevNode.type === 'text') { - prevNode.data += text; - } else { - insertBefore(parentNode, createTextNode(text), referenceNode); - } -}; - -exports.adoptAttributes = function(recipient, attrs) { - for (let i = 0; i < attrs.length; i++) { - const attrName = attrs[i].name; - - if (typeof recipient.attribs[attrName] === 'undefined') { - recipient.attribs[attrName] = attrs[i].value; - recipient['x-attribsNamespace'][attrName] = attrs[i].namespace; - recipient['x-attribsPrefix'][attrName] = attrs[i].prefix; - } - } -}; - -//Tree traversing -exports.getFirstChild = function(node) { - return node.children[0]; -}; - -exports.getChildNodes = function(node) { - return node.children; -}; - -exports.getParentNode = function(node) { - return node.parent; -}; - -exports.getAttrList = function(element) { - const attrList = []; - - for (const name in element.attribs) { - attrList.push({ - name: name, - value: element.attribs[name], - namespace: element['x-attribsNamespace'][name], - prefix: element['x-attribsPrefix'][name] - }); - } - - return attrList; -}; - -//Node data -exports.getTagName = function(element) { - return element.name; -}; - -exports.getNamespaceURI = function(element) { - return element.namespace; -}; - -exports.getTextNodeContent = function(textNode) { - return textNode.data; -}; - -exports.getCommentNodeContent = function(commentNode) { - return commentNode.data; -}; - -exports.getDocumentTypeNodeName = function(doctypeNode) { - return doctypeNode['x-name']; -}; - -exports.getDocumentTypeNodePublicId = function(doctypeNode) { - return doctypeNode['x-publicId']; -}; - -exports.getDocumentTypeNodeSystemId = function(doctypeNode) { - return doctypeNode['x-systemId']; -}; - -//Node types -exports.isTextNode = function(node) { - return node.type === 'text'; -}; - -exports.isCommentNode = function(node) { - return node.type === 'comment'; -}; - -exports.isDocumentTypeNode = function(node) { - return node.type === 'directive' && node.name === '!doctype'; -}; - -exports.isElementNode = function(node) { - return !!node.attribs; -}; - -// Source code location -exports.setNodeSourceCodeLocation = function(node, location) { - node.sourceCodeLocation = location; -}; - -exports.getNodeSourceCodeLocation = function(node) { - return node.sourceCodeLocation; -}; - -exports.updateNodeSourceCodeLocation = function(node, endLocation) { - node.sourceCodeLocation = Object.assign(node.sourceCodeLocation, endLocation); -}; diff --git a/node_modules/parse5-htmlparser2-tree-adapter/package.json b/node_modules/parse5-htmlparser2-tree-adapter/package.json index 3f802d5..6c2bd8e 100644 --- a/node_modules/parse5-htmlparser2-tree-adapter/package.json +++ b/node_modules/parse5-htmlparser2-tree-adapter/package.json @@ -1,59 +1,39 @@ { - "_from": "parse5-htmlparser2-tree-adapter@^6.0.1", - "_id": "parse5-htmlparser2-tree-adapter@6.0.1", - "_inBundle": false, - "_integrity": "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==", - "_location": "/parse5-htmlparser2-tree-adapter", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "parse5-htmlparser2-tree-adapter@^6.0.1", "name": "parse5-htmlparser2-tree-adapter", - "escapedName": "parse5-htmlparser2-tree-adapter", - "rawSpec": "^6.0.1", - "saveSpec": null, - "fetchSpec": "^6.0.1" - }, - "_requiredBy": [ - "/cheerio" - ], - "_resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz", - "_shasum": "2cdf9ad823321140370d4dbf5d3e92c7c8ddc6e6", - "_spec": "parse5-htmlparser2-tree-adapter@^6.0.1", - "_where": "/home/runner/work/public_library_map/public_library_map/node_modules/cheerio", - "author": { - "name": "Ivan Nikulin", - "email": "ifaaan@gmail.com", - "url": "https://github.com/inikulin" - }, - "bugs": { - "url": "https://github.com/inikulin/parse5/issues" - }, - "bundleDependencies": false, - "contributors": "https://github.com/inikulin/parse5/graphs/contributors", - "dependencies": { - "parse5": "^6.0.1" - }, - "deprecated": false, - "description": "htmlparser2 tree adapter for parse5.", - "files": [ - "lib" - ], - "gitHead": "37227a3429584903cbd1799dade995266fc2dbe6", - "homepage": "https://github.com/inikulin/parse5", - "keywords": [ - "parse5", - "parser", - "tree adapter", - "htmlparser2" - ], - "license": "MIT", - "main": "./lib/index.js", - "name": "parse5-htmlparser2-tree-adapter", - "repository": { - "type": "git", - "url": "git://github.com/inikulin/parse5.git" - }, - "version": "6.0.1" + "type": "module", + "description": "htmlparser2 tree adapter for parse5.", + "version": "7.0.0", + "author": "Ivan Nikulin (https://github.com/inikulin)", + "contributors": "https://github.com/inikulin/parse5/graphs/contributors", + "homepage": "https://github.com/inikulin/parse5", + "funding": "https://github.com/inikulin/parse5?sponsor=1", + "keywords": [ + "parse5", + "parser", + "tree adapter", + "htmlparser2" + ], + "license": "MIT", + "main": "dist/cjs/index.js", + "module": "dist/index.js", + "types": "dist/index.d.ts", + "exports": { + "import": "./dist/index.js", + "require": "./dist/cjs/index.js" + }, + "dependencies": { + "domhandler": "^5.0.2", + "parse5": "^7.0.0" + }, + "scripts": { + "build:cjs": "tsc --module CommonJS --target ES6 --outDir dist/cjs && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json" + }, + "repository": { + "type": "git", + "url": "git://github.com/inikulin/parse5.git" + }, + "files": [ + "dist", + "!*.map" + ] } diff --git a/node_modules/parse5/README.md b/node_modules/parse5/README.md index 32b53be..139f8c6 100644 --- a/node_modules/parse5/README.md +++ b/node_modules/parse5/README.md @@ -16,7 +16,7 @@

    - 📖 Documentation 📖 + 📖 Documentation 📖

    --- @@ -34,5 +34,5 @@

    - Version history + Changelog

    diff --git a/node_modules/parse5/lib/common/doctype.js b/node_modules/parse5/lib/common/doctype.js deleted file mode 100644 index e9dfb67..0000000 --- a/node_modules/parse5/lib/common/doctype.js +++ /dev/null @@ -1,162 +0,0 @@ -'use strict'; - -const { DOCUMENT_MODE } = require('./html'); - -//Const -const VALID_DOCTYPE_NAME = 'html'; -const VALID_SYSTEM_ID = 'about:legacy-compat'; -const QUIRKS_MODE_SYSTEM_ID = 'http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd'; - -const QUIRKS_MODE_PUBLIC_ID_PREFIXES = [ - '+//silmaril//dtd html pro v0r11 19970101//', - '-//as//dtd html 3.0 aswedit + extensions//', - '-//advasoft ltd//dtd html 3.0 aswedit + extensions//', - '-//ietf//dtd html 2.0 level 1//', - '-//ietf//dtd html 2.0 level 2//', - '-//ietf//dtd html 2.0 strict level 1//', - '-//ietf//dtd html 2.0 strict level 2//', - '-//ietf//dtd html 2.0 strict//', - '-//ietf//dtd html 2.0//', - '-//ietf//dtd html 2.1e//', - '-//ietf//dtd html 3.0//', - '-//ietf//dtd html 3.2 final//', - '-//ietf//dtd html 3.2//', - '-//ietf//dtd html 3//', - '-//ietf//dtd html level 0//', - '-//ietf//dtd html level 1//', - '-//ietf//dtd html level 2//', - '-//ietf//dtd html level 3//', - '-//ietf//dtd html strict level 0//', - '-//ietf//dtd html strict level 1//', - '-//ietf//dtd html strict level 2//', - '-//ietf//dtd html strict level 3//', - '-//ietf//dtd html strict//', - '-//ietf//dtd html//', - '-//metrius//dtd metrius presentational//', - '-//microsoft//dtd internet explorer 2.0 html strict//', - '-//microsoft//dtd internet explorer 2.0 html//', - '-//microsoft//dtd internet explorer 2.0 tables//', - '-//microsoft//dtd internet explorer 3.0 html strict//', - '-//microsoft//dtd internet explorer 3.0 html//', - '-//microsoft//dtd internet explorer 3.0 tables//', - '-//netscape comm. corp.//dtd html//', - '-//netscape comm. corp.//dtd strict html//', - "-//o'reilly and associates//dtd html 2.0//", - "-//o'reilly and associates//dtd html extended 1.0//", - "-//o'reilly and associates//dtd html extended relaxed 1.0//", - '-//sq//dtd html 2.0 hotmetal + extensions//', - '-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//', - '-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//', - '-//spyglass//dtd html 2.0 extended//', - '-//sun microsystems corp.//dtd hotjava html//', - '-//sun microsystems corp.//dtd hotjava strict html//', - '-//w3c//dtd html 3 1995-03-24//', - '-//w3c//dtd html 3.2 draft//', - '-//w3c//dtd html 3.2 final//', - '-//w3c//dtd html 3.2//', - '-//w3c//dtd html 3.2s draft//', - '-//w3c//dtd html 4.0 frameset//', - '-//w3c//dtd html 4.0 transitional//', - '-//w3c//dtd html experimental 19960712//', - '-//w3c//dtd html experimental 970421//', - '-//w3c//dtd w3 html//', - '-//w3o//dtd w3 html 3.0//', - '-//webtechs//dtd mozilla html 2.0//', - '-//webtechs//dtd mozilla html//' -]; - -const QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES = QUIRKS_MODE_PUBLIC_ID_PREFIXES.concat([ - '-//w3c//dtd html 4.01 frameset//', - '-//w3c//dtd html 4.01 transitional//' -]); - -const QUIRKS_MODE_PUBLIC_IDS = ['-//w3o//dtd w3 html strict 3.0//en//', '-/w3c/dtd html 4.0 transitional/en', 'html']; -const LIMITED_QUIRKS_PUBLIC_ID_PREFIXES = ['-//w3c//dtd xhtml 1.0 frameset//', '-//w3c//dtd xhtml 1.0 transitional//']; - -const LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES = LIMITED_QUIRKS_PUBLIC_ID_PREFIXES.concat([ - '-//w3c//dtd html 4.01 frameset//', - '-//w3c//dtd html 4.01 transitional//' -]); - -//Utils -function enquoteDoctypeId(id) { - const quote = id.indexOf('"') !== -1 ? "'" : '"'; - - return quote + id + quote; -} - -function hasPrefix(publicId, prefixes) { - for (let i = 0; i < prefixes.length; i++) { - if (publicId.indexOf(prefixes[i]) === 0) { - return true; - } - } - - return false; -} - -//API -exports.isConforming = function(token) { - return ( - token.name === VALID_DOCTYPE_NAME && - token.publicId === null && - (token.systemId === null || token.systemId === VALID_SYSTEM_ID) - ); -}; - -exports.getDocumentMode = function(token) { - if (token.name !== VALID_DOCTYPE_NAME) { - return DOCUMENT_MODE.QUIRKS; - } - - const systemId = token.systemId; - - if (systemId && systemId.toLowerCase() === QUIRKS_MODE_SYSTEM_ID) { - return DOCUMENT_MODE.QUIRKS; - } - - let publicId = token.publicId; - - if (publicId !== null) { - publicId = publicId.toLowerCase(); - - if (QUIRKS_MODE_PUBLIC_IDS.indexOf(publicId) > -1) { - return DOCUMENT_MODE.QUIRKS; - } - - let prefixes = systemId === null ? QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES : QUIRKS_MODE_PUBLIC_ID_PREFIXES; - - if (hasPrefix(publicId, prefixes)) { - return DOCUMENT_MODE.QUIRKS; - } - - prefixes = - systemId === null ? LIMITED_QUIRKS_PUBLIC_ID_PREFIXES : LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES; - - if (hasPrefix(publicId, prefixes)) { - return DOCUMENT_MODE.LIMITED_QUIRKS; - } - } - - return DOCUMENT_MODE.NO_QUIRKS; -}; - -exports.serializeContent = function(name, publicId, systemId) { - let str = '!DOCTYPE '; - - if (name) { - str += name; - } - - if (publicId) { - str += ' PUBLIC ' + enquoteDoctypeId(publicId); - } else if (systemId) { - str += ' SYSTEM'; - } - - if (systemId !== null) { - str += ' ' + enquoteDoctypeId(systemId); - } - - return str; -}; diff --git a/node_modules/parse5/lib/common/error-codes.js b/node_modules/parse5/lib/common/error-codes.js deleted file mode 100644 index 25f3cfd..0000000 --- a/node_modules/parse5/lib/common/error-codes.js +++ /dev/null @@ -1,65 +0,0 @@ -'use strict'; - -module.exports = { - controlCharacterInInputStream: 'control-character-in-input-stream', - noncharacterInInputStream: 'noncharacter-in-input-stream', - surrogateInInputStream: 'surrogate-in-input-stream', - nonVoidHtmlElementStartTagWithTrailingSolidus: 'non-void-html-element-start-tag-with-trailing-solidus', - endTagWithAttributes: 'end-tag-with-attributes', - endTagWithTrailingSolidus: 'end-tag-with-trailing-solidus', - unexpectedSolidusInTag: 'unexpected-solidus-in-tag', - unexpectedNullCharacter: 'unexpected-null-character', - unexpectedQuestionMarkInsteadOfTagName: 'unexpected-question-mark-instead-of-tag-name', - invalidFirstCharacterOfTagName: 'invalid-first-character-of-tag-name', - unexpectedEqualsSignBeforeAttributeName: 'unexpected-equals-sign-before-attribute-name', - missingEndTagName: 'missing-end-tag-name', - unexpectedCharacterInAttributeName: 'unexpected-character-in-attribute-name', - unknownNamedCharacterReference: 'unknown-named-character-reference', - missingSemicolonAfterCharacterReference: 'missing-semicolon-after-character-reference', - unexpectedCharacterAfterDoctypeSystemIdentifier: 'unexpected-character-after-doctype-system-identifier', - unexpectedCharacterInUnquotedAttributeValue: 'unexpected-character-in-unquoted-attribute-value', - eofBeforeTagName: 'eof-before-tag-name', - eofInTag: 'eof-in-tag', - missingAttributeValue: 'missing-attribute-value', - missingWhitespaceBetweenAttributes: 'missing-whitespace-between-attributes', - missingWhitespaceAfterDoctypePublicKeyword: 'missing-whitespace-after-doctype-public-keyword', - missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers: - 'missing-whitespace-between-doctype-public-and-system-identifiers', - missingWhitespaceAfterDoctypeSystemKeyword: 'missing-whitespace-after-doctype-system-keyword', - missingQuoteBeforeDoctypePublicIdentifier: 'missing-quote-before-doctype-public-identifier', - missingQuoteBeforeDoctypeSystemIdentifier: 'missing-quote-before-doctype-system-identifier', - missingDoctypePublicIdentifier: 'missing-doctype-public-identifier', - missingDoctypeSystemIdentifier: 'missing-doctype-system-identifier', - abruptDoctypePublicIdentifier: 'abrupt-doctype-public-identifier', - abruptDoctypeSystemIdentifier: 'abrupt-doctype-system-identifier', - cdataInHtmlContent: 'cdata-in-html-content', - incorrectlyOpenedComment: 'incorrectly-opened-comment', - eofInScriptHtmlCommentLikeText: 'eof-in-script-html-comment-like-text', - eofInDoctype: 'eof-in-doctype', - nestedComment: 'nested-comment', - abruptClosingOfEmptyComment: 'abrupt-closing-of-empty-comment', - eofInComment: 'eof-in-comment', - incorrectlyClosedComment: 'incorrectly-closed-comment', - eofInCdata: 'eof-in-cdata', - absenceOfDigitsInNumericCharacterReference: 'absence-of-digits-in-numeric-character-reference', - nullCharacterReference: 'null-character-reference', - surrogateCharacterReference: 'surrogate-character-reference', - characterReferenceOutsideUnicodeRange: 'character-reference-outside-unicode-range', - controlCharacterReference: 'control-character-reference', - noncharacterCharacterReference: 'noncharacter-character-reference', - missingWhitespaceBeforeDoctypeName: 'missing-whitespace-before-doctype-name', - missingDoctypeName: 'missing-doctype-name', - invalidCharacterSequenceAfterDoctypeName: 'invalid-character-sequence-after-doctype-name', - duplicateAttribute: 'duplicate-attribute', - nonConformingDoctype: 'non-conforming-doctype', - missingDoctype: 'missing-doctype', - misplacedDoctype: 'misplaced-doctype', - endTagWithoutMatchingOpenElement: 'end-tag-without-matching-open-element', - closingOfElementWithOpenChildElements: 'closing-of-element-with-open-child-elements', - disallowedContentInNoscriptInHead: 'disallowed-content-in-noscript-in-head', - openElementsLeftAfterEof: 'open-elements-left-after-eof', - abandonedHeadElementChild: 'abandoned-head-element-child', - misplacedStartTagForHeadElement: 'misplaced-start-tag-for-head-element', - nestedNoscriptInHead: 'nested-noscript-in-head', - eofInElementThatCanContainOnlyText: 'eof-in-element-that-can-contain-only-text' -}; diff --git a/node_modules/parse5/lib/common/foreign-content.js b/node_modules/parse5/lib/common/foreign-content.js deleted file mode 100644 index 10f008b..0000000 --- a/node_modules/parse5/lib/common/foreign-content.js +++ /dev/null @@ -1,265 +0,0 @@ -'use strict'; - -const Tokenizer = require('../tokenizer'); -const HTML = require('./html'); - -//Aliases -const $ = HTML.TAG_NAMES; -const NS = HTML.NAMESPACES; -const ATTRS = HTML.ATTRS; - -//MIME types -const MIME_TYPES = { - TEXT_HTML: 'text/html', - APPLICATION_XML: 'application/xhtml+xml' -}; - -//Attributes -const DEFINITION_URL_ATTR = 'definitionurl'; -const ADJUSTED_DEFINITION_URL_ATTR = 'definitionURL'; -const SVG_ATTRS_ADJUSTMENT_MAP = { - attributename: 'attributeName', - attributetype: 'attributeType', - basefrequency: 'baseFrequency', - baseprofile: 'baseProfile', - calcmode: 'calcMode', - clippathunits: 'clipPathUnits', - diffuseconstant: 'diffuseConstant', - edgemode: 'edgeMode', - filterunits: 'filterUnits', - glyphref: 'glyphRef', - gradienttransform: 'gradientTransform', - gradientunits: 'gradientUnits', - kernelmatrix: 'kernelMatrix', - kernelunitlength: 'kernelUnitLength', - keypoints: 'keyPoints', - keysplines: 'keySplines', - keytimes: 'keyTimes', - lengthadjust: 'lengthAdjust', - limitingconeangle: 'limitingConeAngle', - markerheight: 'markerHeight', - markerunits: 'markerUnits', - markerwidth: 'markerWidth', - maskcontentunits: 'maskContentUnits', - maskunits: 'maskUnits', - numoctaves: 'numOctaves', - pathlength: 'pathLength', - patterncontentunits: 'patternContentUnits', - patterntransform: 'patternTransform', - patternunits: 'patternUnits', - pointsatx: 'pointsAtX', - pointsaty: 'pointsAtY', - pointsatz: 'pointsAtZ', - preservealpha: 'preserveAlpha', - preserveaspectratio: 'preserveAspectRatio', - primitiveunits: 'primitiveUnits', - refx: 'refX', - refy: 'refY', - repeatcount: 'repeatCount', - repeatdur: 'repeatDur', - requiredextensions: 'requiredExtensions', - requiredfeatures: 'requiredFeatures', - specularconstant: 'specularConstant', - specularexponent: 'specularExponent', - spreadmethod: 'spreadMethod', - startoffset: 'startOffset', - stddeviation: 'stdDeviation', - stitchtiles: 'stitchTiles', - surfacescale: 'surfaceScale', - systemlanguage: 'systemLanguage', - tablevalues: 'tableValues', - targetx: 'targetX', - targety: 'targetY', - textlength: 'textLength', - viewbox: 'viewBox', - viewtarget: 'viewTarget', - xchannelselector: 'xChannelSelector', - ychannelselector: 'yChannelSelector', - zoomandpan: 'zoomAndPan' -}; - -const XML_ATTRS_ADJUSTMENT_MAP = { - 'xlink:actuate': { prefix: 'xlink', name: 'actuate', namespace: NS.XLINK }, - 'xlink:arcrole': { prefix: 'xlink', name: 'arcrole', namespace: NS.XLINK }, - 'xlink:href': { prefix: 'xlink', name: 'href', namespace: NS.XLINK }, - 'xlink:role': { prefix: 'xlink', name: 'role', namespace: NS.XLINK }, - 'xlink:show': { prefix: 'xlink', name: 'show', namespace: NS.XLINK }, - 'xlink:title': { prefix: 'xlink', name: 'title', namespace: NS.XLINK }, - 'xlink:type': { prefix: 'xlink', name: 'type', namespace: NS.XLINK }, - 'xml:base': { prefix: 'xml', name: 'base', namespace: NS.XML }, - 'xml:lang': { prefix: 'xml', name: 'lang', namespace: NS.XML }, - 'xml:space': { prefix: 'xml', name: 'space', namespace: NS.XML }, - xmlns: { prefix: '', name: 'xmlns', namespace: NS.XMLNS }, - 'xmlns:xlink': { prefix: 'xmlns', name: 'xlink', namespace: NS.XMLNS } -}; - -//SVG tag names adjustment map -const SVG_TAG_NAMES_ADJUSTMENT_MAP = (exports.SVG_TAG_NAMES_ADJUSTMENT_MAP = { - altglyph: 'altGlyph', - altglyphdef: 'altGlyphDef', - altglyphitem: 'altGlyphItem', - animatecolor: 'animateColor', - animatemotion: 'animateMotion', - animatetransform: 'animateTransform', - clippath: 'clipPath', - feblend: 'feBlend', - fecolormatrix: 'feColorMatrix', - fecomponenttransfer: 'feComponentTransfer', - fecomposite: 'feComposite', - feconvolvematrix: 'feConvolveMatrix', - fediffuselighting: 'feDiffuseLighting', - fedisplacementmap: 'feDisplacementMap', - fedistantlight: 'feDistantLight', - feflood: 'feFlood', - fefunca: 'feFuncA', - fefuncb: 'feFuncB', - fefuncg: 'feFuncG', - fefuncr: 'feFuncR', - fegaussianblur: 'feGaussianBlur', - feimage: 'feImage', - femerge: 'feMerge', - femergenode: 'feMergeNode', - femorphology: 'feMorphology', - feoffset: 'feOffset', - fepointlight: 'fePointLight', - fespecularlighting: 'feSpecularLighting', - fespotlight: 'feSpotLight', - fetile: 'feTile', - feturbulence: 'feTurbulence', - foreignobject: 'foreignObject', - glyphref: 'glyphRef', - lineargradient: 'linearGradient', - radialgradient: 'radialGradient', - textpath: 'textPath' -}); - -//Tags that causes exit from foreign content -const EXITS_FOREIGN_CONTENT = { - [$.B]: true, - [$.BIG]: true, - [$.BLOCKQUOTE]: true, - [$.BODY]: true, - [$.BR]: true, - [$.CENTER]: true, - [$.CODE]: true, - [$.DD]: true, - [$.DIV]: true, - [$.DL]: true, - [$.DT]: true, - [$.EM]: true, - [$.EMBED]: true, - [$.H1]: true, - [$.H2]: true, - [$.H3]: true, - [$.H4]: true, - [$.H5]: true, - [$.H6]: true, - [$.HEAD]: true, - [$.HR]: true, - [$.I]: true, - [$.IMG]: true, - [$.LI]: true, - [$.LISTING]: true, - [$.MENU]: true, - [$.META]: true, - [$.NOBR]: true, - [$.OL]: true, - [$.P]: true, - [$.PRE]: true, - [$.RUBY]: true, - [$.S]: true, - [$.SMALL]: true, - [$.SPAN]: true, - [$.STRONG]: true, - [$.STRIKE]: true, - [$.SUB]: true, - [$.SUP]: true, - [$.TABLE]: true, - [$.TT]: true, - [$.U]: true, - [$.UL]: true, - [$.VAR]: true -}; - -//Check exit from foreign content -exports.causesExit = function(startTagToken) { - const tn = startTagToken.tagName; - const isFontWithAttrs = - tn === $.FONT && - (Tokenizer.getTokenAttr(startTagToken, ATTRS.COLOR) !== null || - Tokenizer.getTokenAttr(startTagToken, ATTRS.SIZE) !== null || - Tokenizer.getTokenAttr(startTagToken, ATTRS.FACE) !== null); - - return isFontWithAttrs ? true : EXITS_FOREIGN_CONTENT[tn]; -}; - -//Token adjustments -exports.adjustTokenMathMLAttrs = function(token) { - for (let i = 0; i < token.attrs.length; i++) { - if (token.attrs[i].name === DEFINITION_URL_ATTR) { - token.attrs[i].name = ADJUSTED_DEFINITION_URL_ATTR; - break; - } - } -}; - -exports.adjustTokenSVGAttrs = function(token) { - for (let i = 0; i < token.attrs.length; i++) { - const adjustedAttrName = SVG_ATTRS_ADJUSTMENT_MAP[token.attrs[i].name]; - - if (adjustedAttrName) { - token.attrs[i].name = adjustedAttrName; - } - } -}; - -exports.adjustTokenXMLAttrs = function(token) { - for (let i = 0; i < token.attrs.length; i++) { - const adjustedAttrEntry = XML_ATTRS_ADJUSTMENT_MAP[token.attrs[i].name]; - - if (adjustedAttrEntry) { - token.attrs[i].prefix = adjustedAttrEntry.prefix; - token.attrs[i].name = adjustedAttrEntry.name; - token.attrs[i].namespace = adjustedAttrEntry.namespace; - } - } -}; - -exports.adjustTokenSVGTagName = function(token) { - const adjustedTagName = SVG_TAG_NAMES_ADJUSTMENT_MAP[token.tagName]; - - if (adjustedTagName) { - token.tagName = adjustedTagName; - } -}; - -//Integration points -function isMathMLTextIntegrationPoint(tn, ns) { - return ns === NS.MATHML && (tn === $.MI || tn === $.MO || tn === $.MN || tn === $.MS || tn === $.MTEXT); -} - -function isHtmlIntegrationPoint(tn, ns, attrs) { - if (ns === NS.MATHML && tn === $.ANNOTATION_XML) { - for (let i = 0; i < attrs.length; i++) { - if (attrs[i].name === ATTRS.ENCODING) { - const value = attrs[i].value.toLowerCase(); - - return value === MIME_TYPES.TEXT_HTML || value === MIME_TYPES.APPLICATION_XML; - } - } - } - - return ns === NS.SVG && (tn === $.FOREIGN_OBJECT || tn === $.DESC || tn === $.TITLE); -} - -exports.isIntegrationPoint = function(tn, ns, attrs, foreignNS) { - if ((!foreignNS || foreignNS === NS.HTML) && isHtmlIntegrationPoint(tn, ns, attrs)) { - return true; - } - - if ((!foreignNS || foreignNS === NS.MATHML) && isMathMLTextIntegrationPoint(tn, ns)) { - return true; - } - - return false; -}; diff --git a/node_modules/parse5/lib/common/html.js b/node_modules/parse5/lib/common/html.js deleted file mode 100644 index f33646f..0000000 --- a/node_modules/parse5/lib/common/html.js +++ /dev/null @@ -1,272 +0,0 @@ -'use strict'; - -const NS = (exports.NAMESPACES = { - HTML: 'http://www.w3.org/1999/xhtml', - MATHML: 'http://www.w3.org/1998/Math/MathML', - SVG: 'http://www.w3.org/2000/svg', - XLINK: 'http://www.w3.org/1999/xlink', - XML: 'http://www.w3.org/XML/1998/namespace', - XMLNS: 'http://www.w3.org/2000/xmlns/' -}); - -exports.ATTRS = { - TYPE: 'type', - ACTION: 'action', - ENCODING: 'encoding', - PROMPT: 'prompt', - NAME: 'name', - COLOR: 'color', - FACE: 'face', - SIZE: 'size' -}; - -exports.DOCUMENT_MODE = { - NO_QUIRKS: 'no-quirks', - QUIRKS: 'quirks', - LIMITED_QUIRKS: 'limited-quirks' -}; - -const $ = (exports.TAG_NAMES = { - A: 'a', - ADDRESS: 'address', - ANNOTATION_XML: 'annotation-xml', - APPLET: 'applet', - AREA: 'area', - ARTICLE: 'article', - ASIDE: 'aside', - - B: 'b', - BASE: 'base', - BASEFONT: 'basefont', - BGSOUND: 'bgsound', - BIG: 'big', - BLOCKQUOTE: 'blockquote', - BODY: 'body', - BR: 'br', - BUTTON: 'button', - - CAPTION: 'caption', - CENTER: 'center', - CODE: 'code', - COL: 'col', - COLGROUP: 'colgroup', - - DD: 'dd', - DESC: 'desc', - DETAILS: 'details', - DIALOG: 'dialog', - DIR: 'dir', - DIV: 'div', - DL: 'dl', - DT: 'dt', - - EM: 'em', - EMBED: 'embed', - - FIELDSET: 'fieldset', - FIGCAPTION: 'figcaption', - FIGURE: 'figure', - FONT: 'font', - FOOTER: 'footer', - FOREIGN_OBJECT: 'foreignObject', - FORM: 'form', - FRAME: 'frame', - FRAMESET: 'frameset', - - H1: 'h1', - H2: 'h2', - H3: 'h3', - H4: 'h4', - H5: 'h5', - H6: 'h6', - HEAD: 'head', - HEADER: 'header', - HGROUP: 'hgroup', - HR: 'hr', - HTML: 'html', - - I: 'i', - IMG: 'img', - IMAGE: 'image', - INPUT: 'input', - IFRAME: 'iframe', - - KEYGEN: 'keygen', - - LABEL: 'label', - LI: 'li', - LINK: 'link', - LISTING: 'listing', - - MAIN: 'main', - MALIGNMARK: 'malignmark', - MARQUEE: 'marquee', - MATH: 'math', - MENU: 'menu', - META: 'meta', - MGLYPH: 'mglyph', - MI: 'mi', - MO: 'mo', - MN: 'mn', - MS: 'ms', - MTEXT: 'mtext', - - NAV: 'nav', - NOBR: 'nobr', - NOFRAMES: 'noframes', - NOEMBED: 'noembed', - NOSCRIPT: 'noscript', - - OBJECT: 'object', - OL: 'ol', - OPTGROUP: 'optgroup', - OPTION: 'option', - - P: 'p', - PARAM: 'param', - PLAINTEXT: 'plaintext', - PRE: 'pre', - - RB: 'rb', - RP: 'rp', - RT: 'rt', - RTC: 'rtc', - RUBY: 'ruby', - - S: 's', - SCRIPT: 'script', - SECTION: 'section', - SELECT: 'select', - SOURCE: 'source', - SMALL: 'small', - SPAN: 'span', - STRIKE: 'strike', - STRONG: 'strong', - STYLE: 'style', - SUB: 'sub', - SUMMARY: 'summary', - SUP: 'sup', - - TABLE: 'table', - TBODY: 'tbody', - TEMPLATE: 'template', - TEXTAREA: 'textarea', - TFOOT: 'tfoot', - TD: 'td', - TH: 'th', - THEAD: 'thead', - TITLE: 'title', - TR: 'tr', - TRACK: 'track', - TT: 'tt', - - U: 'u', - UL: 'ul', - - SVG: 'svg', - - VAR: 'var', - - WBR: 'wbr', - - XMP: 'xmp' -}); - -exports.SPECIAL_ELEMENTS = { - [NS.HTML]: { - [$.ADDRESS]: true, - [$.APPLET]: true, - [$.AREA]: true, - [$.ARTICLE]: true, - [$.ASIDE]: true, - [$.BASE]: true, - [$.BASEFONT]: true, - [$.BGSOUND]: true, - [$.BLOCKQUOTE]: true, - [$.BODY]: true, - [$.BR]: true, - [$.BUTTON]: true, - [$.CAPTION]: true, - [$.CENTER]: true, - [$.COL]: true, - [$.COLGROUP]: true, - [$.DD]: true, - [$.DETAILS]: true, - [$.DIR]: true, - [$.DIV]: true, - [$.DL]: true, - [$.DT]: true, - [$.EMBED]: true, - [$.FIELDSET]: true, - [$.FIGCAPTION]: true, - [$.FIGURE]: true, - [$.FOOTER]: true, - [$.FORM]: true, - [$.FRAME]: true, - [$.FRAMESET]: true, - [$.H1]: true, - [$.H2]: true, - [$.H3]: true, - [$.H4]: true, - [$.H5]: true, - [$.H6]: true, - [$.HEAD]: true, - [$.HEADER]: true, - [$.HGROUP]: true, - [$.HR]: true, - [$.HTML]: true, - [$.IFRAME]: true, - [$.IMG]: true, - [$.INPUT]: true, - [$.LI]: true, - [$.LINK]: true, - [$.LISTING]: true, - [$.MAIN]: true, - [$.MARQUEE]: true, - [$.MENU]: true, - [$.META]: true, - [$.NAV]: true, - [$.NOEMBED]: true, - [$.NOFRAMES]: true, - [$.NOSCRIPT]: true, - [$.OBJECT]: true, - [$.OL]: true, - [$.P]: true, - [$.PARAM]: true, - [$.PLAINTEXT]: true, - [$.PRE]: true, - [$.SCRIPT]: true, - [$.SECTION]: true, - [$.SELECT]: true, - [$.SOURCE]: true, - [$.STYLE]: true, - [$.SUMMARY]: true, - [$.TABLE]: true, - [$.TBODY]: true, - [$.TD]: true, - [$.TEMPLATE]: true, - [$.TEXTAREA]: true, - [$.TFOOT]: true, - [$.TH]: true, - [$.THEAD]: true, - [$.TITLE]: true, - [$.TR]: true, - [$.TRACK]: true, - [$.UL]: true, - [$.WBR]: true, - [$.XMP]: true - }, - [NS.MATHML]: { - [$.MI]: true, - [$.MO]: true, - [$.MN]: true, - [$.MS]: true, - [$.MTEXT]: true, - [$.ANNOTATION_XML]: true - }, - [NS.SVG]: { - [$.TITLE]: true, - [$.FOREIGN_OBJECT]: true, - [$.DESC]: true - } -}; diff --git a/node_modules/parse5/lib/common/unicode.js b/node_modules/parse5/lib/common/unicode.js deleted file mode 100644 index 8d8234f..0000000 --- a/node_modules/parse5/lib/common/unicode.js +++ /dev/null @@ -1,109 +0,0 @@ -'use strict'; - -const UNDEFINED_CODE_POINTS = [ - 0xfffe, - 0xffff, - 0x1fffe, - 0x1ffff, - 0x2fffe, - 0x2ffff, - 0x3fffe, - 0x3ffff, - 0x4fffe, - 0x4ffff, - 0x5fffe, - 0x5ffff, - 0x6fffe, - 0x6ffff, - 0x7fffe, - 0x7ffff, - 0x8fffe, - 0x8ffff, - 0x9fffe, - 0x9ffff, - 0xafffe, - 0xaffff, - 0xbfffe, - 0xbffff, - 0xcfffe, - 0xcffff, - 0xdfffe, - 0xdffff, - 0xefffe, - 0xeffff, - 0xffffe, - 0xfffff, - 0x10fffe, - 0x10ffff -]; - -exports.REPLACEMENT_CHARACTER = '\uFFFD'; - -exports.CODE_POINTS = { - EOF: -1, - NULL: 0x00, - TABULATION: 0x09, - CARRIAGE_RETURN: 0x0d, - LINE_FEED: 0x0a, - FORM_FEED: 0x0c, - SPACE: 0x20, - EXCLAMATION_MARK: 0x21, - QUOTATION_MARK: 0x22, - NUMBER_SIGN: 0x23, - AMPERSAND: 0x26, - APOSTROPHE: 0x27, - HYPHEN_MINUS: 0x2d, - SOLIDUS: 0x2f, - DIGIT_0: 0x30, - DIGIT_9: 0x39, - SEMICOLON: 0x3b, - LESS_THAN_SIGN: 0x3c, - EQUALS_SIGN: 0x3d, - GREATER_THAN_SIGN: 0x3e, - QUESTION_MARK: 0x3f, - LATIN_CAPITAL_A: 0x41, - LATIN_CAPITAL_F: 0x46, - LATIN_CAPITAL_X: 0x58, - LATIN_CAPITAL_Z: 0x5a, - RIGHT_SQUARE_BRACKET: 0x5d, - GRAVE_ACCENT: 0x60, - LATIN_SMALL_A: 0x61, - LATIN_SMALL_F: 0x66, - LATIN_SMALL_X: 0x78, - LATIN_SMALL_Z: 0x7a, - REPLACEMENT_CHARACTER: 0xfffd -}; - -exports.CODE_POINT_SEQUENCES = { - DASH_DASH_STRING: [0x2d, 0x2d], //-- - DOCTYPE_STRING: [0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45], //DOCTYPE - CDATA_START_STRING: [0x5b, 0x43, 0x44, 0x41, 0x54, 0x41, 0x5b], //[CDATA[ - SCRIPT_STRING: [0x73, 0x63, 0x72, 0x69, 0x70, 0x74], //script - PUBLIC_STRING: [0x50, 0x55, 0x42, 0x4c, 0x49, 0x43], //PUBLIC - SYSTEM_STRING: [0x53, 0x59, 0x53, 0x54, 0x45, 0x4d] //SYSTEM -}; - -//Surrogates -exports.isSurrogate = function(cp) { - return cp >= 0xd800 && cp <= 0xdfff; -}; - -exports.isSurrogatePair = function(cp) { - return cp >= 0xdc00 && cp <= 0xdfff; -}; - -exports.getSurrogatePairCodePoint = function(cp1, cp2) { - return (cp1 - 0xd800) * 0x400 + 0x2400 + cp2; -}; - -//NOTE: excluding NULL and ASCII whitespace -exports.isControlCodePoint = function(cp) { - return ( - (cp !== 0x20 && cp !== 0x0a && cp !== 0x0d && cp !== 0x09 && cp !== 0x0c && cp >= 0x01 && cp <= 0x1f) || - (cp >= 0x7f && cp <= 0x9f) - ); -}; - -exports.isUndefinedCodePoint = function(cp) { - return (cp >= 0xfdd0 && cp <= 0xfdef) || UNDEFINED_CODE_POINTS.indexOf(cp) > -1; -}; diff --git a/node_modules/parse5/lib/extensions/error-reporting/mixin-base.js b/node_modules/parse5/lib/extensions/error-reporting/mixin-base.js deleted file mode 100644 index 1e30cfc..0000000 --- a/node_modules/parse5/lib/extensions/error-reporting/mixin-base.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict'; - -const Mixin = require('../../utils/mixin'); - -class ErrorReportingMixinBase extends Mixin { - constructor(host, opts) { - super(host); - - this.posTracker = null; - this.onParseError = opts.onParseError; - } - - _setErrorLocation(err) { - err.startLine = err.endLine = this.posTracker.line; - err.startCol = err.endCol = this.posTracker.col; - err.startOffset = err.endOffset = this.posTracker.offset; - } - - _reportError(code) { - const err = { - code: code, - startLine: -1, - startCol: -1, - startOffset: -1, - endLine: -1, - endCol: -1, - endOffset: -1 - }; - - this._setErrorLocation(err); - this.onParseError(err); - } - - _getOverriddenMethods(mxn) { - return { - _err(code) { - mxn._reportError(code); - } - }; - } -} - -module.exports = ErrorReportingMixinBase; diff --git a/node_modules/parse5/lib/extensions/error-reporting/parser-mixin.js b/node_modules/parse5/lib/extensions/error-reporting/parser-mixin.js deleted file mode 100644 index 107ec5a..0000000 --- a/node_modules/parse5/lib/extensions/error-reporting/parser-mixin.js +++ /dev/null @@ -1,52 +0,0 @@ -'use strict'; - -const ErrorReportingMixinBase = require('./mixin-base'); -const ErrorReportingTokenizerMixin = require('./tokenizer-mixin'); -const LocationInfoTokenizerMixin = require('../location-info/tokenizer-mixin'); -const Mixin = require('../../utils/mixin'); - -class ErrorReportingParserMixin extends ErrorReportingMixinBase { - constructor(parser, opts) { - super(parser, opts); - - this.opts = opts; - this.ctLoc = null; - this.locBeforeToken = false; - } - - _setErrorLocation(err) { - if (this.ctLoc) { - err.startLine = this.ctLoc.startLine; - err.startCol = this.ctLoc.startCol; - err.startOffset = this.ctLoc.startOffset; - - err.endLine = this.locBeforeToken ? this.ctLoc.startLine : this.ctLoc.endLine; - err.endCol = this.locBeforeToken ? this.ctLoc.startCol : this.ctLoc.endCol; - err.endOffset = this.locBeforeToken ? this.ctLoc.startOffset : this.ctLoc.endOffset; - } - } - - _getOverriddenMethods(mxn, orig) { - return { - _bootstrap(document, fragmentContext) { - orig._bootstrap.call(this, document, fragmentContext); - - Mixin.install(this.tokenizer, ErrorReportingTokenizerMixin, mxn.opts); - Mixin.install(this.tokenizer, LocationInfoTokenizerMixin); - }, - - _processInputToken(token) { - mxn.ctLoc = token.location; - - orig._processInputToken.call(this, token); - }, - - _err(code, options) { - mxn.locBeforeToken = options && options.beforeToken; - mxn._reportError(code); - } - }; - } -} - -module.exports = ErrorReportingParserMixin; diff --git a/node_modules/parse5/lib/extensions/error-reporting/preprocessor-mixin.js b/node_modules/parse5/lib/extensions/error-reporting/preprocessor-mixin.js deleted file mode 100644 index 398c966..0000000 --- a/node_modules/parse5/lib/extensions/error-reporting/preprocessor-mixin.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; - -const ErrorReportingMixinBase = require('./mixin-base'); -const PositionTrackingPreprocessorMixin = require('../position-tracking/preprocessor-mixin'); -const Mixin = require('../../utils/mixin'); - -class ErrorReportingPreprocessorMixin extends ErrorReportingMixinBase { - constructor(preprocessor, opts) { - super(preprocessor, opts); - - this.posTracker = Mixin.install(preprocessor, PositionTrackingPreprocessorMixin); - this.lastErrOffset = -1; - } - - _reportError(code) { - //NOTE: avoid reporting error twice on advance/retreat - if (this.lastErrOffset !== this.posTracker.offset) { - this.lastErrOffset = this.posTracker.offset; - super._reportError(code); - } - } -} - -module.exports = ErrorReportingPreprocessorMixin; diff --git a/node_modules/parse5/lib/extensions/error-reporting/tokenizer-mixin.js b/node_modules/parse5/lib/extensions/error-reporting/tokenizer-mixin.js deleted file mode 100644 index 219fcab..0000000 --- a/node_modules/parse5/lib/extensions/error-reporting/tokenizer-mixin.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; - -const ErrorReportingMixinBase = require('./mixin-base'); -const ErrorReportingPreprocessorMixin = require('./preprocessor-mixin'); -const Mixin = require('../../utils/mixin'); - -class ErrorReportingTokenizerMixin extends ErrorReportingMixinBase { - constructor(tokenizer, opts) { - super(tokenizer, opts); - - const preprocessorMixin = Mixin.install(tokenizer.preprocessor, ErrorReportingPreprocessorMixin, opts); - - this.posTracker = preprocessorMixin.posTracker; - } -} - -module.exports = ErrorReportingTokenizerMixin; diff --git a/node_modules/parse5/lib/extensions/location-info/open-element-stack-mixin.js b/node_modules/parse5/lib/extensions/location-info/open-element-stack-mixin.js deleted file mode 100644 index 765fe77..0000000 --- a/node_modules/parse5/lib/extensions/location-info/open-element-stack-mixin.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict'; - -const Mixin = require('../../utils/mixin'); - -class LocationInfoOpenElementStackMixin extends Mixin { - constructor(stack, opts) { - super(stack); - - this.onItemPop = opts.onItemPop; - } - - _getOverriddenMethods(mxn, orig) { - return { - pop() { - mxn.onItemPop(this.current); - orig.pop.call(this); - }, - - popAllUpToHtmlElement() { - for (let i = this.stackTop; i > 0; i--) { - mxn.onItemPop(this.items[i]); - } - - orig.popAllUpToHtmlElement.call(this); - }, - - remove(element) { - mxn.onItemPop(this.current); - orig.remove.call(this, element); - } - }; - } -} - -module.exports = LocationInfoOpenElementStackMixin; diff --git a/node_modules/parse5/lib/extensions/location-info/parser-mixin.js b/node_modules/parse5/lib/extensions/location-info/parser-mixin.js deleted file mode 100644 index e7d3e2d..0000000 --- a/node_modules/parse5/lib/extensions/location-info/parser-mixin.js +++ /dev/null @@ -1,223 +0,0 @@ -'use strict'; - -const Mixin = require('../../utils/mixin'); -const Tokenizer = require('../../tokenizer'); -const LocationInfoTokenizerMixin = require('./tokenizer-mixin'); -const LocationInfoOpenElementStackMixin = require('./open-element-stack-mixin'); -const HTML = require('../../common/html'); - -//Aliases -const $ = HTML.TAG_NAMES; - -class LocationInfoParserMixin extends Mixin { - constructor(parser) { - super(parser); - - this.parser = parser; - this.treeAdapter = this.parser.treeAdapter; - this.posTracker = null; - this.lastStartTagToken = null; - this.lastFosterParentingLocation = null; - this.currentToken = null; - } - - _setStartLocation(element) { - let loc = null; - - if (this.lastStartTagToken) { - loc = Object.assign({}, this.lastStartTagToken.location); - loc.startTag = this.lastStartTagToken.location; - } - - this.treeAdapter.setNodeSourceCodeLocation(element, loc); - } - - _setEndLocation(element, closingToken) { - const loc = this.treeAdapter.getNodeSourceCodeLocation(element); - - if (loc) { - if (closingToken.location) { - const ctLoc = closingToken.location; - const tn = this.treeAdapter.getTagName(element); - - // NOTE: For cases like

    - First 'p' closes without a closing - // tag and for cases like

    - 'p' closes without a closing tag. - const isClosingEndTag = closingToken.type === Tokenizer.END_TAG_TOKEN && tn === closingToken.tagName; - const endLoc = {}; - if (isClosingEndTag) { - endLoc.endTag = Object.assign({}, ctLoc); - endLoc.endLine = ctLoc.endLine; - endLoc.endCol = ctLoc.endCol; - endLoc.endOffset = ctLoc.endOffset; - } else { - endLoc.endLine = ctLoc.startLine; - endLoc.endCol = ctLoc.startCol; - endLoc.endOffset = ctLoc.startOffset; - } - - this.treeAdapter.updateNodeSourceCodeLocation(element, endLoc); - } - } - } - - _getOverriddenMethods(mxn, orig) { - return { - _bootstrap(document, fragmentContext) { - orig._bootstrap.call(this, document, fragmentContext); - - mxn.lastStartTagToken = null; - mxn.lastFosterParentingLocation = null; - mxn.currentToken = null; - - const tokenizerMixin = Mixin.install(this.tokenizer, LocationInfoTokenizerMixin); - - mxn.posTracker = tokenizerMixin.posTracker; - - Mixin.install(this.openElements, LocationInfoOpenElementStackMixin, { - onItemPop: function(element) { - mxn._setEndLocation(element, mxn.currentToken); - } - }); - }, - - _runParsingLoop(scriptHandler) { - orig._runParsingLoop.call(this, scriptHandler); - - // NOTE: generate location info for elements - // that remains on open element stack - for (let i = this.openElements.stackTop; i >= 0; i--) { - mxn._setEndLocation(this.openElements.items[i], mxn.currentToken); - } - }, - - //Token processing - _processTokenInForeignContent(token) { - mxn.currentToken = token; - orig._processTokenInForeignContent.call(this, token); - }, - - _processToken(token) { - mxn.currentToken = token; - orig._processToken.call(this, token); - - //NOTE: and are never popped from the stack, so we need to updated - //their end location explicitly. - const requireExplicitUpdate = - token.type === Tokenizer.END_TAG_TOKEN && - (token.tagName === $.HTML || (token.tagName === $.BODY && this.openElements.hasInScope($.BODY))); - - if (requireExplicitUpdate) { - for (let i = this.openElements.stackTop; i >= 0; i--) { - const element = this.openElements.items[i]; - - if (this.treeAdapter.getTagName(element) === token.tagName) { - mxn._setEndLocation(element, token); - break; - } - } - } - }, - - //Doctype - _setDocumentType(token) { - orig._setDocumentType.call(this, token); - - const documentChildren = this.treeAdapter.getChildNodes(this.document); - const cnLength = documentChildren.length; - - for (let i = 0; i < cnLength; i++) { - const node = documentChildren[i]; - - if (this.treeAdapter.isDocumentTypeNode(node)) { - this.treeAdapter.setNodeSourceCodeLocation(node, token.location); - break; - } - } - }, - - //Elements - _attachElementToTree(element) { - //NOTE: _attachElementToTree is called from _appendElement, _insertElement and _insertTemplate methods. - //So we will use token location stored in this methods for the element. - mxn._setStartLocation(element); - mxn.lastStartTagToken = null; - orig._attachElementToTree.call(this, element); - }, - - _appendElement(token, namespaceURI) { - mxn.lastStartTagToken = token; - orig._appendElement.call(this, token, namespaceURI); - }, - - _insertElement(token, namespaceURI) { - mxn.lastStartTagToken = token; - orig._insertElement.call(this, token, namespaceURI); - }, - - _insertTemplate(token) { - mxn.lastStartTagToken = token; - orig._insertTemplate.call(this, token); - - const tmplContent = this.treeAdapter.getTemplateContent(this.openElements.current); - - this.treeAdapter.setNodeSourceCodeLocation(tmplContent, null); - }, - - _insertFakeRootElement() { - orig._insertFakeRootElement.call(this); - this.treeAdapter.setNodeSourceCodeLocation(this.openElements.current, null); - }, - - //Comments - _appendCommentNode(token, parent) { - orig._appendCommentNode.call(this, token, parent); - - const children = this.treeAdapter.getChildNodes(parent); - const commentNode = children[children.length - 1]; - - this.treeAdapter.setNodeSourceCodeLocation(commentNode, token.location); - }, - - //Text - _findFosterParentingLocation() { - //NOTE: store last foster parenting location, so we will be able to find inserted text - //in case of foster parenting - mxn.lastFosterParentingLocation = orig._findFosterParentingLocation.call(this); - - return mxn.lastFosterParentingLocation; - }, - - _insertCharacters(token) { - orig._insertCharacters.call(this, token); - - const hasFosterParent = this._shouldFosterParentOnInsertion(); - - const parent = - (hasFosterParent && mxn.lastFosterParentingLocation.parent) || - this.openElements.currentTmplContent || - this.openElements.current; - - const siblings = this.treeAdapter.getChildNodes(parent); - - const textNodeIdx = - hasFosterParent && mxn.lastFosterParentingLocation.beforeElement - ? siblings.indexOf(mxn.lastFosterParentingLocation.beforeElement) - 1 - : siblings.length - 1; - - const textNode = siblings[textNodeIdx]; - - //NOTE: if we have location assigned by another token, then just update end position - const tnLoc = this.treeAdapter.getNodeSourceCodeLocation(textNode); - - if (tnLoc) { - const { endLine, endCol, endOffset } = token.location; - this.treeAdapter.updateNodeSourceCodeLocation(textNode, { endLine, endCol, endOffset }); - } else { - this.treeAdapter.setNodeSourceCodeLocation(textNode, token.location); - } - } - }; - } -} - -module.exports = LocationInfoParserMixin; diff --git a/node_modules/parse5/lib/extensions/location-info/tokenizer-mixin.js b/node_modules/parse5/lib/extensions/location-info/tokenizer-mixin.js deleted file mode 100644 index 3c1ef5f..0000000 --- a/node_modules/parse5/lib/extensions/location-info/tokenizer-mixin.js +++ /dev/null @@ -1,146 +0,0 @@ -'use strict'; - -const Mixin = require('../../utils/mixin'); -const Tokenizer = require('../../tokenizer'); -const PositionTrackingPreprocessorMixin = require('../position-tracking/preprocessor-mixin'); - -class LocationInfoTokenizerMixin extends Mixin { - constructor(tokenizer) { - super(tokenizer); - - this.tokenizer = tokenizer; - this.posTracker = Mixin.install(tokenizer.preprocessor, PositionTrackingPreprocessorMixin); - this.currentAttrLocation = null; - this.ctLoc = null; - } - - _getCurrentLocation() { - return { - startLine: this.posTracker.line, - startCol: this.posTracker.col, - startOffset: this.posTracker.offset, - endLine: -1, - endCol: -1, - endOffset: -1 - }; - } - - _attachCurrentAttrLocationInfo() { - this.currentAttrLocation.endLine = this.posTracker.line; - this.currentAttrLocation.endCol = this.posTracker.col; - this.currentAttrLocation.endOffset = this.posTracker.offset; - - const currentToken = this.tokenizer.currentToken; - const currentAttr = this.tokenizer.currentAttr; - - if (!currentToken.location.attrs) { - currentToken.location.attrs = Object.create(null); - } - - currentToken.location.attrs[currentAttr.name] = this.currentAttrLocation; - } - - _getOverriddenMethods(mxn, orig) { - const methods = { - _createStartTagToken() { - orig._createStartTagToken.call(this); - this.currentToken.location = mxn.ctLoc; - }, - - _createEndTagToken() { - orig._createEndTagToken.call(this); - this.currentToken.location = mxn.ctLoc; - }, - - _createCommentToken() { - orig._createCommentToken.call(this); - this.currentToken.location = mxn.ctLoc; - }, - - _createDoctypeToken(initialName) { - orig._createDoctypeToken.call(this, initialName); - this.currentToken.location = mxn.ctLoc; - }, - - _createCharacterToken(type, ch) { - orig._createCharacterToken.call(this, type, ch); - this.currentCharacterToken.location = mxn.ctLoc; - }, - - _createEOFToken() { - orig._createEOFToken.call(this); - this.currentToken.location = mxn._getCurrentLocation(); - }, - - _createAttr(attrNameFirstCh) { - orig._createAttr.call(this, attrNameFirstCh); - mxn.currentAttrLocation = mxn._getCurrentLocation(); - }, - - _leaveAttrName(toState) { - orig._leaveAttrName.call(this, toState); - mxn._attachCurrentAttrLocationInfo(); - }, - - _leaveAttrValue(toState) { - orig._leaveAttrValue.call(this, toState); - mxn._attachCurrentAttrLocationInfo(); - }, - - _emitCurrentToken() { - const ctLoc = this.currentToken.location; - - //NOTE: if we have pending character token make it's end location equal to the - //current token's start location. - if (this.currentCharacterToken) { - this.currentCharacterToken.location.endLine = ctLoc.startLine; - this.currentCharacterToken.location.endCol = ctLoc.startCol; - this.currentCharacterToken.location.endOffset = ctLoc.startOffset; - } - - if (this.currentToken.type === Tokenizer.EOF_TOKEN) { - ctLoc.endLine = ctLoc.startLine; - ctLoc.endCol = ctLoc.startCol; - ctLoc.endOffset = ctLoc.startOffset; - } else { - ctLoc.endLine = mxn.posTracker.line; - ctLoc.endCol = mxn.posTracker.col + 1; - ctLoc.endOffset = mxn.posTracker.offset + 1; - } - - orig._emitCurrentToken.call(this); - }, - - _emitCurrentCharacterToken() { - const ctLoc = this.currentCharacterToken && this.currentCharacterToken.location; - - //NOTE: if we have character token and it's location wasn't set in the _emitCurrentToken(), - //then set it's location at the current preprocessor position. - //We don't need to increment preprocessor position, since character token - //emission is always forced by the start of the next character token here. - //So, we already have advanced position. - if (ctLoc && ctLoc.endOffset === -1) { - ctLoc.endLine = mxn.posTracker.line; - ctLoc.endCol = mxn.posTracker.col; - ctLoc.endOffset = mxn.posTracker.offset; - } - - orig._emitCurrentCharacterToken.call(this); - } - }; - - //NOTE: patch initial states for each mode to obtain token start position - Object.keys(Tokenizer.MODE).forEach(modeName => { - const state = Tokenizer.MODE[modeName]; - - methods[state] = function(cp) { - mxn.ctLoc = mxn._getCurrentLocation(); - orig[state].call(this, cp); - }; - }); - - return methods; - } -} - -module.exports = LocationInfoTokenizerMixin; diff --git a/node_modules/parse5/lib/extensions/position-tracking/preprocessor-mixin.js b/node_modules/parse5/lib/extensions/position-tracking/preprocessor-mixin.js deleted file mode 100644 index 3a07d78..0000000 --- a/node_modules/parse5/lib/extensions/position-tracking/preprocessor-mixin.js +++ /dev/null @@ -1,64 +0,0 @@ -'use strict'; - -const Mixin = require('../../utils/mixin'); - -class PositionTrackingPreprocessorMixin extends Mixin { - constructor(preprocessor) { - super(preprocessor); - - this.preprocessor = preprocessor; - this.isEol = false; - this.lineStartPos = 0; - this.droppedBufferSize = 0; - - this.offset = 0; - this.col = 0; - this.line = 1; - } - - _getOverriddenMethods(mxn, orig) { - return { - advance() { - const pos = this.pos + 1; - const ch = this.html[pos]; - - //NOTE: LF should be in the last column of the line - if (mxn.isEol) { - mxn.isEol = false; - mxn.line++; - mxn.lineStartPos = pos; - } - - if (ch === '\n' || (ch === '\r' && this.html[pos + 1] !== '\n')) { - mxn.isEol = true; - } - - mxn.col = pos - mxn.lineStartPos + 1; - mxn.offset = mxn.droppedBufferSize + pos; - - return orig.advance.call(this); - }, - - retreat() { - orig.retreat.call(this); - - mxn.isEol = false; - mxn.col = this.pos - mxn.lineStartPos + 1; - }, - - dropParsedChunk() { - const prevPos = this.pos; - - orig.dropParsedChunk.call(this); - - const reduction = prevPos - this.pos; - - mxn.lineStartPos -= reduction; - mxn.droppedBufferSize += reduction; - mxn.offset = mxn.droppedBufferSize + this.pos; - } - }; - } -} - -module.exports = PositionTrackingPreprocessorMixin; diff --git a/node_modules/parse5/lib/index.js b/node_modules/parse5/lib/index.js deleted file mode 100644 index 09c8e33..0000000 --- a/node_modules/parse5/lib/index.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -const Parser = require('./parser'); -const Serializer = require('./serializer'); - -// Shorthands -exports.parse = function parse(html, options) { - const parser = new Parser(options); - - return parser.parse(html); -}; - -exports.parseFragment = function parseFragment(fragmentContext, html, options) { - if (typeof fragmentContext === 'string') { - options = html; - html = fragmentContext; - fragmentContext = null; - } - - const parser = new Parser(options); - - return parser.parseFragment(html, fragmentContext); -}; - -exports.serialize = function(node, options) { - const serializer = new Serializer(node, options); - - return serializer.serialize(); -}; diff --git a/node_modules/parse5/lib/parser/formatting-element-list.js b/node_modules/parse5/lib/parser/formatting-element-list.js deleted file mode 100644 index 0e241db..0000000 --- a/node_modules/parse5/lib/parser/formatting-element-list.js +++ /dev/null @@ -1,181 +0,0 @@ -'use strict'; - -//Const -const NOAH_ARK_CAPACITY = 3; - -//List of formatting elements -class FormattingElementList { - constructor(treeAdapter) { - this.length = 0; - this.entries = []; - this.treeAdapter = treeAdapter; - this.bookmark = null; - } - - //Noah Ark's condition - //OPTIMIZATION: at first we try to find possible candidates for exclusion using - //lightweight heuristics without thorough attributes check. - _getNoahArkConditionCandidates(newElement) { - const candidates = []; - - if (this.length >= NOAH_ARK_CAPACITY) { - const neAttrsLength = this.treeAdapter.getAttrList(newElement).length; - const neTagName = this.treeAdapter.getTagName(newElement); - const neNamespaceURI = this.treeAdapter.getNamespaceURI(newElement); - - for (let i = this.length - 1; i >= 0; i--) { - const entry = this.entries[i]; - - if (entry.type === FormattingElementList.MARKER_ENTRY) { - break; - } - - const element = entry.element; - const elementAttrs = this.treeAdapter.getAttrList(element); - - const isCandidate = - this.treeAdapter.getTagName(element) === neTagName && - this.treeAdapter.getNamespaceURI(element) === neNamespaceURI && - elementAttrs.length === neAttrsLength; - - if (isCandidate) { - candidates.push({ idx: i, attrs: elementAttrs }); - } - } - } - - return candidates.length < NOAH_ARK_CAPACITY ? [] : candidates; - } - - _ensureNoahArkCondition(newElement) { - const candidates = this._getNoahArkConditionCandidates(newElement); - let cLength = candidates.length; - - if (cLength) { - const neAttrs = this.treeAdapter.getAttrList(newElement); - const neAttrsLength = neAttrs.length; - const neAttrsMap = Object.create(null); - - //NOTE: build attrs map for the new element so we can perform fast lookups - for (let i = 0; i < neAttrsLength; i++) { - const neAttr = neAttrs[i]; - - neAttrsMap[neAttr.name] = neAttr.value; - } - - for (let i = 0; i < neAttrsLength; i++) { - for (let j = 0; j < cLength; j++) { - const cAttr = candidates[j].attrs[i]; - - if (neAttrsMap[cAttr.name] !== cAttr.value) { - candidates.splice(j, 1); - cLength--; - } - - if (candidates.length < NOAH_ARK_CAPACITY) { - return; - } - } - } - - //NOTE: remove bottommost candidates until Noah's Ark condition will not be met - for (let i = cLength - 1; i >= NOAH_ARK_CAPACITY - 1; i--) { - this.entries.splice(candidates[i].idx, 1); - this.length--; - } - } - } - - //Mutations - insertMarker() { - this.entries.push({ type: FormattingElementList.MARKER_ENTRY }); - this.length++; - } - - pushElement(element, token) { - this._ensureNoahArkCondition(element); - - this.entries.push({ - type: FormattingElementList.ELEMENT_ENTRY, - element: element, - token: token - }); - - this.length++; - } - - insertElementAfterBookmark(element, token) { - let bookmarkIdx = this.length - 1; - - for (; bookmarkIdx >= 0; bookmarkIdx--) { - if (this.entries[bookmarkIdx] === this.bookmark) { - break; - } - } - - this.entries.splice(bookmarkIdx + 1, 0, { - type: FormattingElementList.ELEMENT_ENTRY, - element: element, - token: token - }); - - this.length++; - } - - removeEntry(entry) { - for (let i = this.length - 1; i >= 0; i--) { - if (this.entries[i] === entry) { - this.entries.splice(i, 1); - this.length--; - break; - } - } - } - - clearToLastMarker() { - while (this.length) { - const entry = this.entries.pop(); - - this.length--; - - if (entry.type === FormattingElementList.MARKER_ENTRY) { - break; - } - } - } - - //Search - getElementEntryInScopeWithTagName(tagName) { - for (let i = this.length - 1; i >= 0; i--) { - const entry = this.entries[i]; - - if (entry.type === FormattingElementList.MARKER_ENTRY) { - return null; - } - - if (this.treeAdapter.getTagName(entry.element) === tagName) { - return entry; - } - } - - return null; - } - - getElementEntry(element) { - for (let i = this.length - 1; i >= 0; i--) { - const entry = this.entries[i]; - - if (entry.type === FormattingElementList.ELEMENT_ENTRY && entry.element === element) { - return entry; - } - } - - return null; - } -} - -//Entry types -FormattingElementList.MARKER_ENTRY = 'MARKER_ENTRY'; -FormattingElementList.ELEMENT_ENTRY = 'ELEMENT_ENTRY'; - -module.exports = FormattingElementList; diff --git a/node_modules/parse5/lib/parser/index.js b/node_modules/parse5/lib/parser/index.js deleted file mode 100644 index 45d3e83..0000000 --- a/node_modules/parse5/lib/parser/index.js +++ /dev/null @@ -1,2956 +0,0 @@ -'use strict'; - -const Tokenizer = require('../tokenizer'); -const OpenElementStack = require('./open-element-stack'); -const FormattingElementList = require('./formatting-element-list'); -const LocationInfoParserMixin = require('../extensions/location-info/parser-mixin'); -const ErrorReportingParserMixin = require('../extensions/error-reporting/parser-mixin'); -const Mixin = require('../utils/mixin'); -const defaultTreeAdapter = require('../tree-adapters/default'); -const mergeOptions = require('../utils/merge-options'); -const doctype = require('../common/doctype'); -const foreignContent = require('../common/foreign-content'); -const ERR = require('../common/error-codes'); -const unicode = require('../common/unicode'); -const HTML = require('../common/html'); - -//Aliases -const $ = HTML.TAG_NAMES; -const NS = HTML.NAMESPACES; -const ATTRS = HTML.ATTRS; - -const DEFAULT_OPTIONS = { - scriptingEnabled: true, - sourceCodeLocationInfo: false, - onParseError: null, - treeAdapter: defaultTreeAdapter -}; - -//Misc constants -const HIDDEN_INPUT_TYPE = 'hidden'; - -//Adoption agency loops iteration count -const AA_OUTER_LOOP_ITER = 8; -const AA_INNER_LOOP_ITER = 3; - -//Insertion modes -const INITIAL_MODE = 'INITIAL_MODE'; -const BEFORE_HTML_MODE = 'BEFORE_HTML_MODE'; -const BEFORE_HEAD_MODE = 'BEFORE_HEAD_MODE'; -const IN_HEAD_MODE = 'IN_HEAD_MODE'; -const IN_HEAD_NO_SCRIPT_MODE = 'IN_HEAD_NO_SCRIPT_MODE'; -const AFTER_HEAD_MODE = 'AFTER_HEAD_MODE'; -const IN_BODY_MODE = 'IN_BODY_MODE'; -const TEXT_MODE = 'TEXT_MODE'; -const IN_TABLE_MODE = 'IN_TABLE_MODE'; -const IN_TABLE_TEXT_MODE = 'IN_TABLE_TEXT_MODE'; -const IN_CAPTION_MODE = 'IN_CAPTION_MODE'; -const IN_COLUMN_GROUP_MODE = 'IN_COLUMN_GROUP_MODE'; -const IN_TABLE_BODY_MODE = 'IN_TABLE_BODY_MODE'; -const IN_ROW_MODE = 'IN_ROW_MODE'; -const IN_CELL_MODE = 'IN_CELL_MODE'; -const IN_SELECT_MODE = 'IN_SELECT_MODE'; -const IN_SELECT_IN_TABLE_MODE = 'IN_SELECT_IN_TABLE_MODE'; -const IN_TEMPLATE_MODE = 'IN_TEMPLATE_MODE'; -const AFTER_BODY_MODE = 'AFTER_BODY_MODE'; -const IN_FRAMESET_MODE = 'IN_FRAMESET_MODE'; -const AFTER_FRAMESET_MODE = 'AFTER_FRAMESET_MODE'; -const AFTER_AFTER_BODY_MODE = 'AFTER_AFTER_BODY_MODE'; -const AFTER_AFTER_FRAMESET_MODE = 'AFTER_AFTER_FRAMESET_MODE'; - -//Insertion mode reset map -const INSERTION_MODE_RESET_MAP = { - [$.TR]: IN_ROW_MODE, - [$.TBODY]: IN_TABLE_BODY_MODE, - [$.THEAD]: IN_TABLE_BODY_MODE, - [$.TFOOT]: IN_TABLE_BODY_MODE, - [$.CAPTION]: IN_CAPTION_MODE, - [$.COLGROUP]: IN_COLUMN_GROUP_MODE, - [$.TABLE]: IN_TABLE_MODE, - [$.BODY]: IN_BODY_MODE, - [$.FRAMESET]: IN_FRAMESET_MODE -}; - -//Template insertion mode switch map -const TEMPLATE_INSERTION_MODE_SWITCH_MAP = { - [$.CAPTION]: IN_TABLE_MODE, - [$.COLGROUP]: IN_TABLE_MODE, - [$.TBODY]: IN_TABLE_MODE, - [$.TFOOT]: IN_TABLE_MODE, - [$.THEAD]: IN_TABLE_MODE, - [$.COL]: IN_COLUMN_GROUP_MODE, - [$.TR]: IN_TABLE_BODY_MODE, - [$.TD]: IN_ROW_MODE, - [$.TH]: IN_ROW_MODE -}; - -//Token handlers map for insertion modes -const TOKEN_HANDLERS = { - [INITIAL_MODE]: { - [Tokenizer.CHARACTER_TOKEN]: tokenInInitialMode, - [Tokenizer.NULL_CHARACTER_TOKEN]: tokenInInitialMode, - [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: ignoreToken, - [Tokenizer.COMMENT_TOKEN]: appendComment, - [Tokenizer.DOCTYPE_TOKEN]: doctypeInInitialMode, - [Tokenizer.START_TAG_TOKEN]: tokenInInitialMode, - [Tokenizer.END_TAG_TOKEN]: tokenInInitialMode, - [Tokenizer.EOF_TOKEN]: tokenInInitialMode - }, - [BEFORE_HTML_MODE]: { - [Tokenizer.CHARACTER_TOKEN]: tokenBeforeHtml, - [Tokenizer.NULL_CHARACTER_TOKEN]: tokenBeforeHtml, - [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: ignoreToken, - [Tokenizer.COMMENT_TOKEN]: appendComment, - [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, - [Tokenizer.START_TAG_TOKEN]: startTagBeforeHtml, - [Tokenizer.END_TAG_TOKEN]: endTagBeforeHtml, - [Tokenizer.EOF_TOKEN]: tokenBeforeHtml - }, - [BEFORE_HEAD_MODE]: { - [Tokenizer.CHARACTER_TOKEN]: tokenBeforeHead, - [Tokenizer.NULL_CHARACTER_TOKEN]: tokenBeforeHead, - [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: ignoreToken, - [Tokenizer.COMMENT_TOKEN]: appendComment, - [Tokenizer.DOCTYPE_TOKEN]: misplacedDoctype, - [Tokenizer.START_TAG_TOKEN]: startTagBeforeHead, - [Tokenizer.END_TAG_TOKEN]: endTagBeforeHead, - [Tokenizer.EOF_TOKEN]: tokenBeforeHead - }, - [IN_HEAD_MODE]: { - [Tokenizer.CHARACTER_TOKEN]: tokenInHead, - [Tokenizer.NULL_CHARACTER_TOKEN]: tokenInHead, - [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, - [Tokenizer.COMMENT_TOKEN]: appendComment, - [Tokenizer.DOCTYPE_TOKEN]: misplacedDoctype, - [Tokenizer.START_TAG_TOKEN]: startTagInHead, - [Tokenizer.END_TAG_TOKEN]: endTagInHead, - [Tokenizer.EOF_TOKEN]: tokenInHead - }, - [IN_HEAD_NO_SCRIPT_MODE]: { - [Tokenizer.CHARACTER_TOKEN]: tokenInHeadNoScript, - [Tokenizer.NULL_CHARACTER_TOKEN]: tokenInHeadNoScript, - [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, - [Tokenizer.COMMENT_TOKEN]: appendComment, - [Tokenizer.DOCTYPE_TOKEN]: misplacedDoctype, - [Tokenizer.START_TAG_TOKEN]: startTagInHeadNoScript, - [Tokenizer.END_TAG_TOKEN]: endTagInHeadNoScript, - [Tokenizer.EOF_TOKEN]: tokenInHeadNoScript - }, - [AFTER_HEAD_MODE]: { - [Tokenizer.CHARACTER_TOKEN]: tokenAfterHead, - [Tokenizer.NULL_CHARACTER_TOKEN]: tokenAfterHead, - [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, - [Tokenizer.COMMENT_TOKEN]: appendComment, - [Tokenizer.DOCTYPE_TOKEN]: misplacedDoctype, - [Tokenizer.START_TAG_TOKEN]: startTagAfterHead, - [Tokenizer.END_TAG_TOKEN]: endTagAfterHead, - [Tokenizer.EOF_TOKEN]: tokenAfterHead - }, - [IN_BODY_MODE]: { - [Tokenizer.CHARACTER_TOKEN]: characterInBody, - [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, - [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody, - [Tokenizer.COMMENT_TOKEN]: appendComment, - [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, - [Tokenizer.START_TAG_TOKEN]: startTagInBody, - [Tokenizer.END_TAG_TOKEN]: endTagInBody, - [Tokenizer.EOF_TOKEN]: eofInBody - }, - [TEXT_MODE]: { - [Tokenizer.CHARACTER_TOKEN]: insertCharacters, - [Tokenizer.NULL_CHARACTER_TOKEN]: insertCharacters, - [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, - [Tokenizer.COMMENT_TOKEN]: ignoreToken, - [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, - [Tokenizer.START_TAG_TOKEN]: ignoreToken, - [Tokenizer.END_TAG_TOKEN]: endTagInText, - [Tokenizer.EOF_TOKEN]: eofInText - }, - [IN_TABLE_MODE]: { - [Tokenizer.CHARACTER_TOKEN]: characterInTable, - [Tokenizer.NULL_CHARACTER_TOKEN]: characterInTable, - [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: characterInTable, - [Tokenizer.COMMENT_TOKEN]: appendComment, - [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, - [Tokenizer.START_TAG_TOKEN]: startTagInTable, - [Tokenizer.END_TAG_TOKEN]: endTagInTable, - [Tokenizer.EOF_TOKEN]: eofInBody - }, - [IN_TABLE_TEXT_MODE]: { - [Tokenizer.CHARACTER_TOKEN]: characterInTableText, - [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, - [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInTableText, - [Tokenizer.COMMENT_TOKEN]: tokenInTableText, - [Tokenizer.DOCTYPE_TOKEN]: tokenInTableText, - [Tokenizer.START_TAG_TOKEN]: tokenInTableText, - [Tokenizer.END_TAG_TOKEN]: tokenInTableText, - [Tokenizer.EOF_TOKEN]: tokenInTableText - }, - [IN_CAPTION_MODE]: { - [Tokenizer.CHARACTER_TOKEN]: characterInBody, - [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, - [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody, - [Tokenizer.COMMENT_TOKEN]: appendComment, - [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, - [Tokenizer.START_TAG_TOKEN]: startTagInCaption, - [Tokenizer.END_TAG_TOKEN]: endTagInCaption, - [Tokenizer.EOF_TOKEN]: eofInBody - }, - [IN_COLUMN_GROUP_MODE]: { - [Tokenizer.CHARACTER_TOKEN]: tokenInColumnGroup, - [Tokenizer.NULL_CHARACTER_TOKEN]: tokenInColumnGroup, - [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, - [Tokenizer.COMMENT_TOKEN]: appendComment, - [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, - [Tokenizer.START_TAG_TOKEN]: startTagInColumnGroup, - [Tokenizer.END_TAG_TOKEN]: endTagInColumnGroup, - [Tokenizer.EOF_TOKEN]: eofInBody - }, - [IN_TABLE_BODY_MODE]: { - [Tokenizer.CHARACTER_TOKEN]: characterInTable, - [Tokenizer.NULL_CHARACTER_TOKEN]: characterInTable, - [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: characterInTable, - [Tokenizer.COMMENT_TOKEN]: appendComment, - [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, - [Tokenizer.START_TAG_TOKEN]: startTagInTableBody, - [Tokenizer.END_TAG_TOKEN]: endTagInTableBody, - [Tokenizer.EOF_TOKEN]: eofInBody - }, - [IN_ROW_MODE]: { - [Tokenizer.CHARACTER_TOKEN]: characterInTable, - [Tokenizer.NULL_CHARACTER_TOKEN]: characterInTable, - [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: characterInTable, - [Tokenizer.COMMENT_TOKEN]: appendComment, - [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, - [Tokenizer.START_TAG_TOKEN]: startTagInRow, - [Tokenizer.END_TAG_TOKEN]: endTagInRow, - [Tokenizer.EOF_TOKEN]: eofInBody - }, - [IN_CELL_MODE]: { - [Tokenizer.CHARACTER_TOKEN]: characterInBody, - [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, - [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody, - [Tokenizer.COMMENT_TOKEN]: appendComment, - [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, - [Tokenizer.START_TAG_TOKEN]: startTagInCell, - [Tokenizer.END_TAG_TOKEN]: endTagInCell, - [Tokenizer.EOF_TOKEN]: eofInBody - }, - [IN_SELECT_MODE]: { - [Tokenizer.CHARACTER_TOKEN]: insertCharacters, - [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, - [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, - [Tokenizer.COMMENT_TOKEN]: appendComment, - [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, - [Tokenizer.START_TAG_TOKEN]: startTagInSelect, - [Tokenizer.END_TAG_TOKEN]: endTagInSelect, - [Tokenizer.EOF_TOKEN]: eofInBody - }, - [IN_SELECT_IN_TABLE_MODE]: { - [Tokenizer.CHARACTER_TOKEN]: insertCharacters, - [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, - [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, - [Tokenizer.COMMENT_TOKEN]: appendComment, - [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, - [Tokenizer.START_TAG_TOKEN]: startTagInSelectInTable, - [Tokenizer.END_TAG_TOKEN]: endTagInSelectInTable, - [Tokenizer.EOF_TOKEN]: eofInBody - }, - [IN_TEMPLATE_MODE]: { - [Tokenizer.CHARACTER_TOKEN]: characterInBody, - [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, - [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody, - [Tokenizer.COMMENT_TOKEN]: appendComment, - [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, - [Tokenizer.START_TAG_TOKEN]: startTagInTemplate, - [Tokenizer.END_TAG_TOKEN]: endTagInTemplate, - [Tokenizer.EOF_TOKEN]: eofInTemplate - }, - [AFTER_BODY_MODE]: { - [Tokenizer.CHARACTER_TOKEN]: tokenAfterBody, - [Tokenizer.NULL_CHARACTER_TOKEN]: tokenAfterBody, - [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody, - [Tokenizer.COMMENT_TOKEN]: appendCommentToRootHtmlElement, - [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, - [Tokenizer.START_TAG_TOKEN]: startTagAfterBody, - [Tokenizer.END_TAG_TOKEN]: endTagAfterBody, - [Tokenizer.EOF_TOKEN]: stopParsing - }, - [IN_FRAMESET_MODE]: { - [Tokenizer.CHARACTER_TOKEN]: ignoreToken, - [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, - [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, - [Tokenizer.COMMENT_TOKEN]: appendComment, - [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, - [Tokenizer.START_TAG_TOKEN]: startTagInFrameset, - [Tokenizer.END_TAG_TOKEN]: endTagInFrameset, - [Tokenizer.EOF_TOKEN]: stopParsing - }, - [AFTER_FRAMESET_MODE]: { - [Tokenizer.CHARACTER_TOKEN]: ignoreToken, - [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, - [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, - [Tokenizer.COMMENT_TOKEN]: appendComment, - [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, - [Tokenizer.START_TAG_TOKEN]: startTagAfterFrameset, - [Tokenizer.END_TAG_TOKEN]: endTagAfterFrameset, - [Tokenizer.EOF_TOKEN]: stopParsing - }, - [AFTER_AFTER_BODY_MODE]: { - [Tokenizer.CHARACTER_TOKEN]: tokenAfterAfterBody, - [Tokenizer.NULL_CHARACTER_TOKEN]: tokenAfterAfterBody, - [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody, - [Tokenizer.COMMENT_TOKEN]: appendCommentToDocument, - [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, - [Tokenizer.START_TAG_TOKEN]: startTagAfterAfterBody, - [Tokenizer.END_TAG_TOKEN]: tokenAfterAfterBody, - [Tokenizer.EOF_TOKEN]: stopParsing - }, - [AFTER_AFTER_FRAMESET_MODE]: { - [Tokenizer.CHARACTER_TOKEN]: ignoreToken, - [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, - [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody, - [Tokenizer.COMMENT_TOKEN]: appendCommentToDocument, - [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, - [Tokenizer.START_TAG_TOKEN]: startTagAfterAfterFrameset, - [Tokenizer.END_TAG_TOKEN]: ignoreToken, - [Tokenizer.EOF_TOKEN]: stopParsing - } -}; - -//Parser -class Parser { - constructor(options) { - this.options = mergeOptions(DEFAULT_OPTIONS, options); - - this.treeAdapter = this.options.treeAdapter; - this.pendingScript = null; - - if (this.options.sourceCodeLocationInfo) { - Mixin.install(this, LocationInfoParserMixin); - } - - if (this.options.onParseError) { - Mixin.install(this, ErrorReportingParserMixin, { onParseError: this.options.onParseError }); - } - } - - // API - parse(html) { - const document = this.treeAdapter.createDocument(); - - this._bootstrap(document, null); - this.tokenizer.write(html, true); - this._runParsingLoop(null); - - return document; - } - - parseFragment(html, fragmentContext) { - //NOTE: use