@mavogel/cdk-vscode-server 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +4351 -0
- package/API.md +367 -0
- package/CONTRIBUTING.md +59 -0
- package/LICENSE +202 -0
- package/README.md +183 -0
- package/assets/installer/installer.lambda/index.js +112 -0
- package/assets/secret-retriever/secret-retriever.lambda/index.js +57 -0
- package/docs/img/vscode-server-ui-login-min.png +0 -0
- package/docs/img/vscode-server-ui-min.png +0 -0
- package/docs/img/vscode-server.drawio +108 -0
- package/docs/img/vscode-server.drawio-min.png +0 -0
- package/integ-tests/code-server login.html +48 -0
- package/integ-tests/functions/login-handler.ts +63 -0
- package/integ-tests/integ.al2023.ts +69 -0
- package/integ-tests/integ.al2023.ts.snapshot/IntegSetupVSCodeOnAl2023DefaultTestDeployAssert74D8F645.assets.json +32 -0
- package/integ-tests/integ.al2023.ts.snapshot/IntegSetupVSCodeOnAl2023DefaultTestDeployAssert74D8F645.template.json +337 -0
- package/integ-tests/integ.al2023.ts.snapshot/IntegTestStackAl2023.assets.json +110 -0
- package/integ-tests/integ.al2023.ts.snapshot/IntegTestStackAl2023.template.json +2459 -0
- package/integ-tests/integ.al2023.ts.snapshot/asset.23732f3d1982f7fb0da3bd6638a8107337bb767fea165b45eae12000a1dd67ce/index.js +6169 -0
- package/integ-tests/integ.al2023.ts.snapshot/asset.2819175352ad1ce0dae768e83fc328fb70fb5f10b4a8ff0ccbcb791f02b0716d/index.js +1 -0
- package/integ-tests/integ.al2023.ts.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/cfn-response.js +1 -0
- package/integ-tests/integ.al2023.ts.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/consts.js +1 -0
- package/integ-tests/integ.al2023.ts.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/framework.js +3 -0
- package/integ-tests/integ.al2023.ts.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/outbound.js +1 -0
- package/integ-tests/integ.al2023.ts.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/util.js +1 -0
- package/integ-tests/integ.al2023.ts.snapshot/asset.512cf155ada4793b37a885c1aa6d9bb8f534e88bac6f63c69672d4d73df2decf.lambda/index.js +112 -0
- package/integ-tests/integ.al2023.ts.snapshot/asset.781ab0ab74634cdaf61539ab208ab777829ef07097ac21f95b9e15a3b1eedc1b.lambda/index.js +57 -0
- package/integ-tests/integ.al2023.ts.snapshot/asset.c504585dae89ce8e394d7744ccae054318e7d1aff14afb545438d173d51dc97d.bundle/index.js +30572 -0
- package/integ-tests/integ.al2023.ts.snapshot/asset.ce2f3595a340d6c519a65888ef97e3b9b64f053f83608e32cc28162e22d7d99a/index.js +1 -0
- package/integ-tests/integ.al2023.ts.snapshot/asset.ee7de53d64cc9d6248fa6aa550f92358f6c907b5efd6f3298aeab1b5e7ea358a/__entrypoint__.js +1 -0
- package/integ-tests/integ.al2023.ts.snapshot/asset.ee7de53d64cc9d6248fa6aa550f92358f6c907b5efd6f3298aeab1b5e7ea358a/index.js +1 -0
- package/integ-tests/integ.al2023.ts.snapshot/cdk.out +1 -0
- package/integ-tests/integ.al2023.ts.snapshot/integ.json +22 -0
- package/integ-tests/integ.al2023.ts.snapshot/manifest.json +510 -0
- package/integ-tests/integ.al2023.ts.snapshot/tree.json +2944 -0
- package/integ-tests/integ.ubuntu.ts +66 -0
- package/integ-tests/integ.ubuntu.ts.snapshot/IntegSetupVSCodeOnUbuntuDefaultTestDeployAssertFF8DF2C5.assets.json +32 -0
- package/integ-tests/integ.ubuntu.ts.snapshot/IntegSetupVSCodeOnUbuntuDefaultTestDeployAssertFF8DF2C5.template.json +337 -0
- package/integ-tests/integ.ubuntu.ts.snapshot/IntegTestStackUbuntu22.assets.json +110 -0
- package/integ-tests/integ.ubuntu.ts.snapshot/IntegTestStackUbuntu22.template.json +2477 -0
- package/integ-tests/integ.ubuntu.ts.snapshot/asset.23732f3d1982f7fb0da3bd6638a8107337bb767fea165b45eae12000a1dd67ce/index.js +6169 -0
- package/integ-tests/integ.ubuntu.ts.snapshot/asset.2819175352ad1ce0dae768e83fc328fb70fb5f10b4a8ff0ccbcb791f02b0716d/index.js +1 -0
- package/integ-tests/integ.ubuntu.ts.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/cfn-response.js +1 -0
- package/integ-tests/integ.ubuntu.ts.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/consts.js +1 -0
- package/integ-tests/integ.ubuntu.ts.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/framework.js +3 -0
- package/integ-tests/integ.ubuntu.ts.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/outbound.js +1 -0
- package/integ-tests/integ.ubuntu.ts.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/util.js +1 -0
- package/integ-tests/integ.ubuntu.ts.snapshot/asset.512cf155ada4793b37a885c1aa6d9bb8f534e88bac6f63c69672d4d73df2decf.lambda/index.js +112 -0
- package/integ-tests/integ.ubuntu.ts.snapshot/asset.781ab0ab74634cdaf61539ab208ab777829ef07097ac21f95b9e15a3b1eedc1b.lambda/index.js +57 -0
- package/integ-tests/integ.ubuntu.ts.snapshot/asset.c504585dae89ce8e394d7744ccae054318e7d1aff14afb545438d173d51dc97d.bundle/index.js +30572 -0
- package/integ-tests/integ.ubuntu.ts.snapshot/asset.ce2f3595a340d6c519a65888ef97e3b9b64f053f83608e32cc28162e22d7d99a/index.js +1 -0
- package/integ-tests/integ.ubuntu.ts.snapshot/asset.ee7de53d64cc9d6248fa6aa550f92358f6c907b5efd6f3298aeab1b5e7ea358a/__entrypoint__.js +1 -0
- package/integ-tests/integ.ubuntu.ts.snapshot/asset.ee7de53d64cc9d6248fa6aa550f92358f6c907b5efd6f3298aeab1b5e7ea358a/index.js +1 -0
- package/integ-tests/integ.ubuntu.ts.snapshot/cdk.out +1 -0
- package/integ-tests/integ.ubuntu.ts.snapshot/integ.json +22 -0
- package/integ-tests/integ.ubuntu.ts.snapshot/manifest.json +510 -0
- package/integ-tests/integ.ubuntu.ts.snapshot/tree.json +2962 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +18 -0
- package/lib/installer/installer-function.d.ts +13 -0
- package/lib/installer/installer-function.js +23 -0
- package/lib/installer/installer.d.ts +64 -0
- package/lib/installer/installer.js +707 -0
- package/lib/installer/installer.lambda.d.ts +3 -0
- package/lib/installer/installer.lambda.js +94 -0
- package/lib/mappings.d.ts +2 -0
- package/lib/mappings.js +25 -0
- package/lib/prefixlist-retriever/prefixlist-retriever.d.ts +16 -0
- package/lib/prefixlist-retriever/prefixlist-retriever.js +56 -0
- package/lib/secret-retriever/secret-retriever-function.d.ts +13 -0
- package/lib/secret-retriever/secret-retriever-function.js +23 -0
- package/lib/secret-retriever/secret-retriever.d.ts +33 -0
- package/lib/secret-retriever/secret-retriever.js +72 -0
- package/lib/secret-retriever/secret-retriever.lambda.d.ts +2 -0
- package/lib/secret-retriever/secret-retriever.lambda.js +36 -0
- package/lib/vscode-server.d.ts +97 -0
- package/lib/vscode-server.js +417 -0
- package/node_modules/boolbase/README.md +10 -0
- package/node_modules/boolbase/index.js +8 -0
- package/node_modules/boolbase/package.json +23 -0
- package/node_modules/css-select/LICENSE +11 -0
- package/node_modules/css-select/README.md +264 -0
- package/node_modules/css-select/lib/attributes.d.ts +7 -0
- package/node_modules/css-select/lib/attributes.d.ts.map +1 -0
- package/node_modules/css-select/lib/attributes.js +236 -0
- package/node_modules/css-select/lib/attributes.js.map +1 -0
- package/node_modules/css-select/lib/compile.d.ts +13 -0
- package/node_modules/css-select/lib/compile.d.ts.map +1 -0
- package/node_modules/css-select/lib/compile.js +151 -0
- package/node_modules/css-select/lib/compile.js.map +1 -0
- package/node_modules/css-select/lib/esm/attributes.d.ts +7 -0
- package/node_modules/css-select/lib/esm/attributes.d.ts.map +1 -0
- package/node_modules/css-select/lib/esm/attributes.js +222 -0
- package/node_modules/css-select/lib/esm/attributes.js.map +1 -0
- package/node_modules/css-select/lib/esm/compile.d.ts +13 -0
- package/node_modules/css-select/lib/esm/compile.d.ts.map +1 -0
- package/node_modules/css-select/lib/esm/compile.js +115 -0
- package/node_modules/css-select/lib/esm/compile.js.map +1 -0
- package/node_modules/css-select/lib/esm/general.d.ts +3 -0
- package/node_modules/css-select/lib/esm/general.d.ts.map +1 -0
- package/node_modules/css-select/lib/esm/general.js +144 -0
- package/node_modules/css-select/lib/esm/general.js.map +1 -0
- package/node_modules/css-select/lib/esm/index.d.ts +50 -0
- package/node_modules/css-select/lib/esm/index.d.ts.map +1 -0
- package/node_modules/css-select/lib/esm/index.js +115 -0
- package/node_modules/css-select/lib/esm/index.js.map +1 -0
- package/node_modules/css-select/lib/esm/package.json +1 -0
- package/node_modules/css-select/lib/esm/pseudo-selectors/aliases.d.ts +5 -0
- package/node_modules/css-select/lib/esm/pseudo-selectors/aliases.d.ts.map +1 -0
- package/node_modules/css-select/lib/esm/pseudo-selectors/aliases.js +35 -0
- package/node_modules/css-select/lib/esm/pseudo-selectors/aliases.js.map +1 -0
- package/node_modules/css-select/lib/esm/pseudo-selectors/filters.d.ts +4 -0
- package/node_modules/css-select/lib/esm/pseudo-selectors/filters.d.ts.map +1 -0
- package/node_modules/css-select/lib/esm/pseudo-selectors/filters.js +143 -0
- package/node_modules/css-select/lib/esm/pseudo-selectors/filters.js.map +1 -0
- package/node_modules/css-select/lib/esm/pseudo-selectors/index.d.ts +8 -0
- package/node_modules/css-select/lib/esm/pseudo-selectors/index.d.ts.map +1 -0
- package/node_modules/css-select/lib/esm/pseudo-selectors/index.js +40 -0
- package/node_modules/css-select/lib/esm/pseudo-selectors/index.js.map +1 -0
- package/node_modules/css-select/lib/esm/pseudo-selectors/pseudos.d.ts +6 -0
- package/node_modules/css-select/lib/esm/pseudo-selectors/pseudos.d.ts.map +1 -0
- package/node_modules/css-select/lib/esm/pseudo-selectors/pseudos.js +79 -0
- package/node_modules/css-select/lib/esm/pseudo-selectors/pseudos.js.map +1 -0
- package/node_modules/css-select/lib/esm/pseudo-selectors/subselects.d.ts +9 -0
- package/node_modules/css-select/lib/esm/pseudo-selectors/subselects.d.ts.map +1 -0
- package/node_modules/css-select/lib/esm/pseudo-selectors/subselects.js +94 -0
- package/node_modules/css-select/lib/esm/pseudo-selectors/subselects.js.map +1 -0
- package/node_modules/css-select/lib/esm/sort.d.ts +12 -0
- package/node_modules/css-select/lib/esm/sort.d.ts.map +1 -0
- package/node_modules/css-select/lib/esm/sort.js +79 -0
- package/node_modules/css-select/lib/esm/sort.js.map +1 -0
- package/node_modules/css-select/lib/esm/types.d.ts +167 -0
- package/node_modules/css-select/lib/esm/types.d.ts.map +1 -0
- package/node_modules/css-select/lib/esm/types.js +2 -0
- package/node_modules/css-select/lib/esm/types.js.map +1 -0
- package/node_modules/css-select/lib/general.d.ts +3 -0
- package/node_modules/css-select/lib/general.d.ts.map +1 -0
- package/node_modules/css-select/lib/general.js +148 -0
- package/node_modules/css-select/lib/general.js.map +1 -0
- package/node_modules/css-select/lib/index.d.ts +50 -0
- package/node_modules/css-select/lib/index.d.ts.map +1 -0
- package/node_modules/css-select/lib/index.js +154 -0
- package/node_modules/css-select/lib/index.js.map +1 -0
- package/node_modules/css-select/lib/pseudo-selectors/aliases.d.ts +5 -0
- package/node_modules/css-select/lib/pseudo-selectors/aliases.d.ts.map +1 -0
- package/node_modules/css-select/lib/pseudo-selectors/aliases.js +34 -0
- package/node_modules/css-select/lib/pseudo-selectors/aliases.js.map +1 -0
- package/node_modules/css-select/lib/pseudo-selectors/filters.d.ts +4 -0
- package/node_modules/css-select/lib/pseudo-selectors/filters.d.ts.map +1 -0
- package/node_modules/css-select/lib/pseudo-selectors/filters.js +157 -0
- package/node_modules/css-select/lib/pseudo-selectors/filters.js.map +1 -0
- package/node_modules/css-select/lib/pseudo-selectors/index.d.ts +8 -0
- package/node_modules/css-select/lib/pseudo-selectors/index.d.ts.map +1 -0
- package/node_modules/css-select/lib/pseudo-selectors/index.js +46 -0
- package/node_modules/css-select/lib/pseudo-selectors/index.js.map +1 -0
- package/node_modules/css-select/lib/pseudo-selectors/pseudos.d.ts +6 -0
- package/node_modules/css-select/lib/pseudo-selectors/pseudos.d.ts.map +1 -0
- package/node_modules/css-select/lib/pseudo-selectors/pseudos.js +93 -0
- package/node_modules/css-select/lib/pseudo-selectors/pseudos.js.map +1 -0
- package/node_modules/css-select/lib/pseudo-selectors/subselects.d.ts +9 -0
- package/node_modules/css-select/lib/pseudo-selectors/subselects.d.ts.map +1 -0
- package/node_modules/css-select/lib/pseudo-selectors/subselects.js +112 -0
- package/node_modules/css-select/lib/pseudo-selectors/subselects.js.map +1 -0
- package/node_modules/css-select/lib/sort.d.ts +12 -0
- package/node_modules/css-select/lib/sort.d.ts.map +1 -0
- package/node_modules/css-select/lib/sort.js +84 -0
- package/node_modules/css-select/lib/sort.js.map +1 -0
- package/node_modules/css-select/lib/types.d.ts +167 -0
- package/node_modules/css-select/lib/types.d.ts.map +1 -0
- package/node_modules/css-select/lib/types.js +3 -0
- package/node_modules/css-select/lib/types.js.map +1 -0
- package/node_modules/css-select/package.json +81 -0
- package/node_modules/css-what/LICENSE +11 -0
- package/node_modules/css-what/lib/commonjs/index.d.ts +4 -0
- package/node_modules/css-what/lib/commonjs/index.d.ts.map +1 -0
- package/node_modules/css-what/lib/commonjs/index.js +23 -0
- package/node_modules/css-what/lib/commonjs/parse.d.ts +20 -0
- package/node_modules/css-what/lib/commonjs/parse.d.ts.map +1 -0
- package/node_modules/css-what/lib/commonjs/parse.js +425 -0
- package/node_modules/css-what/lib/commonjs/stringify.d.ts +8 -0
- package/node_modules/css-what/lib/commonjs/stringify.d.ts.map +1 -0
- package/node_modules/css-what/lib/commonjs/stringify.js +138 -0
- package/node_modules/css-what/lib/commonjs/types.d.ts +70 -0
- package/node_modules/css-what/lib/commonjs/types.d.ts.map +1 -0
- package/node_modules/css-what/lib/commonjs/types.js +42 -0
- package/node_modules/css-what/lib/es/index.d.ts +4 -0
- package/node_modules/css-what/lib/es/index.d.ts.map +1 -0
- package/node_modules/css-what/lib/es/index.js +3 -0
- package/node_modules/css-what/lib/es/parse.d.ts +20 -0
- package/node_modules/css-what/lib/es/parse.d.ts.map +1 -0
- package/node_modules/css-what/lib/es/parse.js +420 -0
- package/node_modules/css-what/lib/es/stringify.d.ts +8 -0
- package/node_modules/css-what/lib/es/stringify.d.ts.map +1 -0
- package/node_modules/css-what/lib/es/stringify.js +126 -0
- package/node_modules/css-what/lib/es/types.d.ts +70 -0
- package/node_modules/css-what/lib/es/types.d.ts.map +1 -0
- package/node_modules/css-what/lib/es/types.js +39 -0
- package/node_modules/css-what/package.json +59 -0
- package/node_modules/css-what/readme.md +69 -0
- package/node_modules/dom-serializer/LICENSE +11 -0
- package/node_modules/dom-serializer/README.md +109 -0
- package/node_modules/dom-serializer/lib/esm/foreignNames.d.ts +3 -0
- package/node_modules/dom-serializer/lib/esm/foreignNames.d.ts.map +1 -0
- package/node_modules/dom-serializer/lib/esm/foreignNames.js +100 -0
- package/node_modules/dom-serializer/lib/esm/index.d.ts +52 -0
- package/node_modules/dom-serializer/lib/esm/index.d.ts.map +1 -0
- package/node_modules/dom-serializer/lib/esm/index.js +190 -0
- package/node_modules/dom-serializer/lib/esm/package.json +1 -0
- package/node_modules/dom-serializer/lib/foreignNames.d.ts +3 -0
- package/node_modules/dom-serializer/lib/foreignNames.d.ts.map +1 -0
- package/node_modules/dom-serializer/lib/foreignNames.js +103 -0
- package/node_modules/dom-serializer/lib/index.d.ts +52 -0
- package/node_modules/dom-serializer/lib/index.d.ts.map +1 -0
- package/node_modules/dom-serializer/lib/index.js +229 -0
- package/node_modules/dom-serializer/package.json +69 -0
- package/node_modules/domelementtype/LICENSE +11 -0
- package/node_modules/domelementtype/lib/esm/index.d.ts +48 -0
- package/node_modules/domelementtype/lib/esm/index.d.ts.map +1 -0
- package/node_modules/domelementtype/lib/esm/index.js +51 -0
- package/node_modules/domelementtype/lib/esm/package.json +1 -0
- package/node_modules/domelementtype/lib/index.d.ts +48 -0
- package/node_modules/domelementtype/lib/index.d.ts.map +1 -0
- package/node_modules/domelementtype/lib/index.js +55 -0
- package/node_modules/domelementtype/package.json +54 -0
- package/node_modules/domelementtype/readme.md +1 -0
- package/node_modules/domhandler/LICENSE +11 -0
- package/node_modules/domhandler/lib/esm/index.d.ts +76 -0
- package/node_modules/domhandler/lib/esm/index.d.ts.map +1 -0
- package/node_modules/domhandler/lib/esm/index.js +146 -0
- package/node_modules/domhandler/lib/esm/node.d.ts +245 -0
- package/node_modules/domhandler/lib/esm/node.d.ts.map +1 -0
- package/node_modules/domhandler/lib/esm/node.js +338 -0
- package/node_modules/domhandler/lib/esm/package.json +1 -0
- package/node_modules/domhandler/lib/index.d.ts +76 -0
- package/node_modules/domhandler/lib/index.d.ts.map +1 -0
- package/node_modules/domhandler/lib/index.js +165 -0
- package/node_modules/domhandler/lib/node.d.ts +245 -0
- package/node_modules/domhandler/lib/node.d.ts.map +1 -0
- package/node_modules/domhandler/lib/node.js +474 -0
- package/node_modules/domhandler/package.json +73 -0
- package/node_modules/domhandler/readme.md +92 -0
- package/node_modules/domutils/LICENSE +11 -0
- package/node_modules/domutils/lib/esm/feeds.d.ts +71 -0
- package/node_modules/domutils/lib/esm/feeds.d.ts.map +1 -0
- package/node_modules/domutils/lib/esm/feeds.js +183 -0
- package/node_modules/domutils/lib/esm/feeds.js.map +1 -0
- package/node_modules/domutils/lib/esm/helpers.d.ts +59 -0
- package/node_modules/domutils/lib/esm/helpers.d.ts.map +1 -0
- package/node_modules/domutils/lib/esm/helpers.js +136 -0
- package/node_modules/domutils/lib/esm/helpers.js.map +1 -0
- package/node_modules/domutils/lib/esm/index.d.ts +10 -0
- package/node_modules/domutils/lib/esm/index.d.ts.map +1 -0
- package/node_modules/domutils/lib/esm/index.js +10 -0
- package/node_modules/domutils/lib/esm/index.js.map +1 -0
- package/node_modules/domutils/lib/esm/legacy.d.ts +79 -0
- package/node_modules/domutils/lib/esm/legacy.d.ts.map +1 -0
- package/node_modules/domutils/lib/esm/legacy.js +152 -0
- package/node_modules/domutils/lib/esm/legacy.js.map +1 -0
- package/node_modules/domutils/lib/esm/manipulation.d.ts +49 -0
- package/node_modules/domutils/lib/esm/manipulation.d.ts.map +1 -0
- package/node_modules/domutils/lib/esm/manipulation.js +134 -0
- package/node_modules/domutils/lib/esm/manipulation.js.map +1 -0
- package/node_modules/domutils/lib/esm/package.json +1 -0
- package/node_modules/domutils/lib/esm/querying.d.ts +64 -0
- package/node_modules/domutils/lib/esm/querying.d.ts.map +1 -0
- package/node_modules/domutils/lib/esm/querying.js +142 -0
- package/node_modules/domutils/lib/esm/querying.js.map +1 -0
- package/node_modules/domutils/lib/esm/stringify.d.ts +46 -0
- package/node_modules/domutils/lib/esm/stringify.d.ts.map +1 -0
- package/node_modules/domutils/lib/esm/stringify.js +81 -0
- package/node_modules/domutils/lib/esm/stringify.js.map +1 -0
- package/node_modules/domutils/lib/esm/traversal.d.ts +67 -0
- package/node_modules/domutils/lib/esm/traversal.d.ts.map +1 -0
- package/node_modules/domutils/lib/esm/traversal.js +112 -0
- package/node_modules/domutils/lib/esm/traversal.js.map +1 -0
- package/node_modules/domutils/lib/feeds.d.ts +71 -0
- package/node_modules/domutils/lib/feeds.d.ts.map +1 -0
- package/node_modules/domutils/lib/feeds.js +190 -0
- package/node_modules/domutils/lib/feeds.js.map +1 -0
- package/node_modules/domutils/lib/helpers.d.ts +59 -0
- package/node_modules/domutils/lib/helpers.d.ts.map +1 -0
- package/node_modules/domutils/lib/helpers.js +142 -0
- package/node_modules/domutils/lib/helpers.js.map +1 -0
- package/node_modules/domutils/lib/index.d.ts +10 -0
- package/node_modules/domutils/lib/index.d.ts.map +1 -0
- package/node_modules/domutils/lib/index.js +33 -0
- package/node_modules/domutils/lib/index.js.map +1 -0
- package/node_modules/domutils/lib/legacy.d.ts +79 -0
- package/node_modules/domutils/lib/legacy.d.ts.map +1 -0
- package/node_modules/domutils/lib/legacy.js +168 -0
- package/node_modules/domutils/lib/legacy.js.map +1 -0
- package/node_modules/domutils/lib/manipulation.d.ts +49 -0
- package/node_modules/domutils/lib/manipulation.d.ts.map +1 -0
- package/node_modules/domutils/lib/manipulation.js +142 -0
- package/node_modules/domutils/lib/manipulation.js.map +1 -0
- package/node_modules/domutils/lib/querying.d.ts +64 -0
- package/node_modules/domutils/lib/querying.d.ts.map +1 -0
- package/node_modules/domutils/lib/querying.js +155 -0
- package/node_modules/domutils/lib/querying.js.map +1 -0
- package/node_modules/domutils/lib/stringify.d.ts +46 -0
- package/node_modules/domutils/lib/stringify.d.ts.map +1 -0
- package/node_modules/domutils/lib/stringify.js +91 -0
- package/node_modules/domutils/lib/stringify.js.map +1 -0
- package/node_modules/domutils/lib/traversal.d.ts +67 -0
- package/node_modules/domutils/lib/traversal.d.ts.map +1 -0
- package/node_modules/domutils/lib/traversal.js +125 -0
- package/node_modules/domutils/lib/traversal.js.map +1 -0
- package/node_modules/domutils/package.json +79 -0
- package/node_modules/domutils/readme.md +31 -0
- package/node_modules/entities/LICENSE +11 -0
- package/node_modules/entities/lib/decode.d.ts +211 -0
- package/node_modules/entities/lib/decode.d.ts.map +1 -0
- package/node_modules/entities/lib/decode.js +536 -0
- package/node_modules/entities/lib/decode.js.map +1 -0
- package/node_modules/entities/lib/decode_codepoint.d.ts +19 -0
- package/node_modules/entities/lib/decode_codepoint.d.ts.map +1 -0
- package/node_modules/entities/lib/decode_codepoint.js +76 -0
- package/node_modules/entities/lib/decode_codepoint.js.map +1 -0
- package/node_modules/entities/lib/encode.d.ts +22 -0
- package/node_modules/entities/lib/encode.d.ts.map +1 -0
- package/node_modules/entities/lib/encode.js +77 -0
- package/node_modules/entities/lib/encode.js.map +1 -0
- package/node_modules/entities/lib/escape.d.ts +43 -0
- package/node_modules/entities/lib/escape.d.ts.map +1 -0
- package/node_modules/entities/lib/escape.js +122 -0
- package/node_modules/entities/lib/escape.js.map +1 -0
- package/node_modules/entities/lib/esm/decode.d.ts +211 -0
- package/node_modules/entities/lib/esm/decode.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/decode.js +496 -0
- package/node_modules/entities/lib/esm/decode.js.map +1 -0
- package/node_modules/entities/lib/esm/decode_codepoint.d.ts +19 -0
- package/node_modules/entities/lib/esm/decode_codepoint.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/decode_codepoint.js +71 -0
- package/node_modules/entities/lib/esm/decode_codepoint.js.map +1 -0
- package/node_modules/entities/lib/esm/encode.d.ts +22 -0
- package/node_modules/entities/lib/esm/encode.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/encode.js +69 -0
- package/node_modules/entities/lib/esm/encode.js.map +1 -0
- package/node_modules/entities/lib/esm/escape.d.ts +43 -0
- package/node_modules/entities/lib/esm/escape.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/escape.js +116 -0
- package/node_modules/entities/lib/esm/escape.js.map +1 -0
- package/node_modules/entities/lib/esm/generated/decode-data-html.d.ts +3 -0
- package/node_modules/entities/lib/esm/generated/decode-data-html.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/generated/decode-data-html.js +7 -0
- package/node_modules/entities/lib/esm/generated/decode-data-html.js.map +1 -0
- package/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts +3 -0
- package/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/generated/decode-data-xml.js +7 -0
- package/node_modules/entities/lib/esm/generated/decode-data-xml.js.map +1 -0
- package/node_modules/entities/lib/esm/generated/encode-html.d.ts +8 -0
- package/node_modules/entities/lib/esm/generated/encode-html.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/generated/encode-html.js +10 -0
- package/node_modules/entities/lib/esm/generated/encode-html.js.map +1 -0
- package/node_modules/entities/lib/esm/index.d.ts +96 -0
- package/node_modules/entities/lib/esm/index.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/index.js +99 -0
- package/node_modules/entities/lib/esm/index.js.map +1 -0
- package/node_modules/entities/lib/esm/package.json +1 -0
- package/node_modules/entities/lib/generated/decode-data-html.d.ts +3 -0
- package/node_modules/entities/lib/generated/decode-data-html.d.ts.map +1 -0
- package/node_modules/entities/lib/generated/decode-data-html.js +9 -0
- package/node_modules/entities/lib/generated/decode-data-html.js.map +1 -0
- package/node_modules/entities/lib/generated/decode-data-xml.d.ts +3 -0
- package/node_modules/entities/lib/generated/decode-data-xml.d.ts.map +1 -0
- package/node_modules/entities/lib/generated/decode-data-xml.js +9 -0
- package/node_modules/entities/lib/generated/decode-data-xml.js.map +1 -0
- package/node_modules/entities/lib/generated/encode-html.d.ts +8 -0
- package/node_modules/entities/lib/generated/encode-html.d.ts.map +1 -0
- package/node_modules/entities/lib/generated/encode-html.js +12 -0
- package/node_modules/entities/lib/generated/encode-html.js.map +1 -0
- package/node_modules/entities/lib/index.d.ts +96 -0
- package/node_modules/entities/lib/index.d.ts.map +1 -0
- package/node_modules/entities/lib/index.js +126 -0
- package/node_modules/entities/lib/index.js.map +1 -0
- package/node_modules/entities/package.json +90 -0
- package/node_modules/entities/readme.md +122 -0
- package/node_modules/he/LICENSE-MIT.txt +20 -0
- package/node_modules/he/README.md +379 -0
- package/node_modules/he/bin/he +148 -0
- package/node_modules/he/he.js +345 -0
- package/node_modules/he/man/he.1 +78 -0
- package/node_modules/he/package.json +58 -0
- package/node_modules/node-html-parser/CHANGELOG.md +137 -0
- package/node_modules/node-html-parser/LICENSE +7 -0
- package/node_modules/node-html-parser/README.md +365 -0
- package/node_modules/node-html-parser/dist/back.d.ts +1 -0
- package/node_modules/node-html-parser/dist/back.js +6 -0
- package/node_modules/node-html-parser/dist/index.d.ts +20 -0
- package/node_modules/node-html-parser/dist/index.js +32 -0
- package/node_modules/node-html-parser/dist/main.js +1646 -0
- package/node_modules/node-html-parser/dist/matcher.d.ts +6 -0
- package/node_modules/node-html-parser/dist/matcher.js +106 -0
- package/node_modules/node-html-parser/dist/nodes/comment.d.ts +20 -0
- package/node_modules/node-html-parser/dist/nodes/comment.js +57 -0
- package/node_modules/node-html-parser/dist/nodes/html.d.ts +240 -0
- package/node_modules/node-html-parser/dist/nodes/html.js +1218 -0
- package/node_modules/node-html-parser/dist/nodes/node.d.ts +24 -0
- package/node_modules/node-html-parser/dist/nodes/node.js +52 -0
- package/node_modules/node-html-parser/dist/nodes/text.d.ts +44 -0
- package/node_modules/node-html-parser/dist/nodes/text.js +144 -0
- package/node_modules/node-html-parser/dist/nodes/type.d.ts +6 -0
- package/node_modules/node-html-parser/dist/nodes/type.js +9 -0
- package/node_modules/node-html-parser/dist/parse.d.ts +1 -0
- package/node_modules/node-html-parser/dist/parse.js +5 -0
- package/node_modules/node-html-parser/dist/valid.d.ts +6 -0
- package/node_modules/node-html-parser/dist/valid.js +13 -0
- package/node_modules/node-html-parser/dist/void-tag.d.ts +7 -0
- package/node_modules/node-html-parser/dist/void-tag.js +29 -0
- package/node_modules/node-html-parser/package.json +114 -0
- package/node_modules/nth-check/LICENSE +11 -0
- package/node_modules/nth-check/README.md +136 -0
- package/node_modules/nth-check/lib/compile.d.ts +55 -0
- package/node_modules/nth-check/lib/compile.d.ts.map +1 -0
- package/node_modules/nth-check/lib/compile.js +121 -0
- package/node_modules/nth-check/lib/compile.js.map +1 -0
- package/node_modules/nth-check/lib/esm/compile.d.ts +55 -0
- package/node_modules/nth-check/lib/esm/compile.d.ts.map +1 -0
- package/node_modules/nth-check/lib/esm/compile.js +113 -0
- package/node_modules/nth-check/lib/esm/compile.js.map +1 -0
- package/node_modules/nth-check/lib/esm/index.d.ts +59 -0
- package/node_modules/nth-check/lib/esm/index.d.ts.map +1 -0
- package/node_modules/nth-check/lib/esm/index.js +63 -0
- package/node_modules/nth-check/lib/esm/index.js.map +1 -0
- package/node_modules/nth-check/lib/esm/package.json +1 -0
- package/node_modules/nth-check/lib/esm/parse.d.ts +9 -0
- package/node_modules/nth-check/lib/esm/parse.d.ts.map +1 -0
- package/node_modules/nth-check/lib/esm/parse.js +73 -0
- package/node_modules/nth-check/lib/esm/parse.js.map +1 -0
- package/node_modules/nth-check/lib/index.d.ts +59 -0
- package/node_modules/nth-check/lib/index.d.ts.map +1 -0
- package/node_modules/nth-check/lib/index.js +70 -0
- package/node_modules/nth-check/lib/index.js.map +1 -0
- package/node_modules/nth-check/lib/parse.d.ts +9 -0
- package/node_modules/nth-check/lib/parse.d.ts.map +1 -0
- package/node_modules/nth-check/lib/parse.js +77 -0
- package/node_modules/nth-check/lib/parse.js.map +1 -0
- package/node_modules/nth-check/package.json +78 -0
- package/package.json +154 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { AnyNode } from "domhandler";
|
|
2
|
+
/**
|
|
3
|
+
* The medium of a media item.
|
|
4
|
+
*
|
|
5
|
+
* @category Feeds
|
|
6
|
+
*/
|
|
7
|
+
export type FeedItemMediaMedium = "image" | "audio" | "video" | "document" | "executable";
|
|
8
|
+
/**
|
|
9
|
+
* The type of a media item.
|
|
10
|
+
*
|
|
11
|
+
* @category Feeds
|
|
12
|
+
*/
|
|
13
|
+
export type FeedItemMediaExpression = "sample" | "full" | "nonstop";
|
|
14
|
+
/**
|
|
15
|
+
* A media item of a feed entry.
|
|
16
|
+
*
|
|
17
|
+
* @category Feeds
|
|
18
|
+
*/
|
|
19
|
+
export interface FeedItemMedia {
|
|
20
|
+
medium: FeedItemMediaMedium | undefined;
|
|
21
|
+
isDefault: boolean;
|
|
22
|
+
url?: string;
|
|
23
|
+
fileSize?: number;
|
|
24
|
+
type?: string;
|
|
25
|
+
expression?: FeedItemMediaExpression;
|
|
26
|
+
bitrate?: number;
|
|
27
|
+
framerate?: number;
|
|
28
|
+
samplingrate?: number;
|
|
29
|
+
channels?: number;
|
|
30
|
+
duration?: number;
|
|
31
|
+
height?: number;
|
|
32
|
+
width?: number;
|
|
33
|
+
lang?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* An entry of a feed.
|
|
37
|
+
*
|
|
38
|
+
* @category Feeds
|
|
39
|
+
*/
|
|
40
|
+
export interface FeedItem {
|
|
41
|
+
id?: string;
|
|
42
|
+
title?: string;
|
|
43
|
+
link?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
pubDate?: Date;
|
|
46
|
+
media: FeedItemMedia[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The root of a feed.
|
|
50
|
+
*
|
|
51
|
+
* @category Feeds
|
|
52
|
+
*/
|
|
53
|
+
export interface Feed {
|
|
54
|
+
type: string;
|
|
55
|
+
id?: string;
|
|
56
|
+
title?: string;
|
|
57
|
+
link?: string;
|
|
58
|
+
description?: string;
|
|
59
|
+
updated?: Date;
|
|
60
|
+
author?: string;
|
|
61
|
+
items: FeedItem[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get the feed object from the root of a DOM tree.
|
|
65
|
+
*
|
|
66
|
+
* @category Feeds
|
|
67
|
+
* @param doc - The DOM to to extract the feed from.
|
|
68
|
+
* @returns The feed.
|
|
69
|
+
*/
|
|
70
|
+
export declare function getFeed(doc: AnyNode[]): Feed | null;
|
|
71
|
+
//# sourceMappingURL=feeds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feeds.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/0ab8bcf1ecfc70dfc93291a4cb2496578ac25e9c/src/","sources":["feeds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAW,MAAM,YAAY,CAAC;AAInD;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GACzB,OAAO,GACP,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AAK,EAAE,QAAQ,EAAE,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI,GAAG,IAAI,CAQnD"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { textContent } from "./stringify.js";
|
|
2
|
+
import { getElementsByTagName } from "./legacy.js";
|
|
3
|
+
/**
|
|
4
|
+
* Get the feed object from the root of a DOM tree.
|
|
5
|
+
*
|
|
6
|
+
* @category Feeds
|
|
7
|
+
* @param doc - The DOM to to extract the feed from.
|
|
8
|
+
* @returns The feed.
|
|
9
|
+
*/
|
|
10
|
+
export function getFeed(doc) {
|
|
11
|
+
const feedRoot = getOneElement(isValidFeed, doc);
|
|
12
|
+
return !feedRoot
|
|
13
|
+
? null
|
|
14
|
+
: feedRoot.name === "feed"
|
|
15
|
+
? getAtomFeed(feedRoot)
|
|
16
|
+
: getRssFeed(feedRoot);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Parse an Atom feed.
|
|
20
|
+
*
|
|
21
|
+
* @param feedRoot The root of the feed.
|
|
22
|
+
* @returns The parsed feed.
|
|
23
|
+
*/
|
|
24
|
+
function getAtomFeed(feedRoot) {
|
|
25
|
+
var _a;
|
|
26
|
+
const childs = feedRoot.children;
|
|
27
|
+
const feed = {
|
|
28
|
+
type: "atom",
|
|
29
|
+
items: getElementsByTagName("entry", childs).map((item) => {
|
|
30
|
+
var _a;
|
|
31
|
+
const { children } = item;
|
|
32
|
+
const entry = { media: getMediaElements(children) };
|
|
33
|
+
addConditionally(entry, "id", "id", children);
|
|
34
|
+
addConditionally(entry, "title", "title", children);
|
|
35
|
+
const href = (_a = getOneElement("link", children)) === null || _a === void 0 ? void 0 : _a.attribs["href"];
|
|
36
|
+
if (href) {
|
|
37
|
+
entry.link = href;
|
|
38
|
+
}
|
|
39
|
+
const description = fetch("summary", children) || fetch("content", children);
|
|
40
|
+
if (description) {
|
|
41
|
+
entry.description = description;
|
|
42
|
+
}
|
|
43
|
+
const pubDate = fetch("updated", children);
|
|
44
|
+
if (pubDate) {
|
|
45
|
+
entry.pubDate = new Date(pubDate);
|
|
46
|
+
}
|
|
47
|
+
return entry;
|
|
48
|
+
}),
|
|
49
|
+
};
|
|
50
|
+
addConditionally(feed, "id", "id", childs);
|
|
51
|
+
addConditionally(feed, "title", "title", childs);
|
|
52
|
+
const href = (_a = getOneElement("link", childs)) === null || _a === void 0 ? void 0 : _a.attribs["href"];
|
|
53
|
+
if (href) {
|
|
54
|
+
feed.link = href;
|
|
55
|
+
}
|
|
56
|
+
addConditionally(feed, "description", "subtitle", childs);
|
|
57
|
+
const updated = fetch("updated", childs);
|
|
58
|
+
if (updated) {
|
|
59
|
+
feed.updated = new Date(updated);
|
|
60
|
+
}
|
|
61
|
+
addConditionally(feed, "author", "email", childs, true);
|
|
62
|
+
return feed;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Parse a RSS feed.
|
|
66
|
+
*
|
|
67
|
+
* @param feedRoot The root of the feed.
|
|
68
|
+
* @returns The parsed feed.
|
|
69
|
+
*/
|
|
70
|
+
function getRssFeed(feedRoot) {
|
|
71
|
+
var _a, _b;
|
|
72
|
+
const childs = (_b = (_a = getOneElement("channel", feedRoot.children)) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : [];
|
|
73
|
+
const feed = {
|
|
74
|
+
type: feedRoot.name.substr(0, 3),
|
|
75
|
+
id: "",
|
|
76
|
+
items: getElementsByTagName("item", feedRoot.children).map((item) => {
|
|
77
|
+
const { children } = item;
|
|
78
|
+
const entry = { media: getMediaElements(children) };
|
|
79
|
+
addConditionally(entry, "id", "guid", children);
|
|
80
|
+
addConditionally(entry, "title", "title", children);
|
|
81
|
+
addConditionally(entry, "link", "link", children);
|
|
82
|
+
addConditionally(entry, "description", "description", children);
|
|
83
|
+
const pubDate = fetch("pubDate", children) || fetch("dc:date", children);
|
|
84
|
+
if (pubDate)
|
|
85
|
+
entry.pubDate = new Date(pubDate);
|
|
86
|
+
return entry;
|
|
87
|
+
}),
|
|
88
|
+
};
|
|
89
|
+
addConditionally(feed, "title", "title", childs);
|
|
90
|
+
addConditionally(feed, "link", "link", childs);
|
|
91
|
+
addConditionally(feed, "description", "description", childs);
|
|
92
|
+
const updated = fetch("lastBuildDate", childs);
|
|
93
|
+
if (updated) {
|
|
94
|
+
feed.updated = new Date(updated);
|
|
95
|
+
}
|
|
96
|
+
addConditionally(feed, "author", "managingEditor", childs, true);
|
|
97
|
+
return feed;
|
|
98
|
+
}
|
|
99
|
+
const MEDIA_KEYS_STRING = ["url", "type", "lang"];
|
|
100
|
+
const MEDIA_KEYS_INT = [
|
|
101
|
+
"fileSize",
|
|
102
|
+
"bitrate",
|
|
103
|
+
"framerate",
|
|
104
|
+
"samplingrate",
|
|
105
|
+
"channels",
|
|
106
|
+
"duration",
|
|
107
|
+
"height",
|
|
108
|
+
"width",
|
|
109
|
+
];
|
|
110
|
+
/**
|
|
111
|
+
* Get all media elements of a feed item.
|
|
112
|
+
*
|
|
113
|
+
* @param where Nodes to search in.
|
|
114
|
+
* @returns Media elements.
|
|
115
|
+
*/
|
|
116
|
+
function getMediaElements(where) {
|
|
117
|
+
return getElementsByTagName("media:content", where).map((elem) => {
|
|
118
|
+
const { attribs } = elem;
|
|
119
|
+
const media = {
|
|
120
|
+
medium: attribs["medium"],
|
|
121
|
+
isDefault: !!attribs["isDefault"],
|
|
122
|
+
};
|
|
123
|
+
for (const attrib of MEDIA_KEYS_STRING) {
|
|
124
|
+
if (attribs[attrib]) {
|
|
125
|
+
media[attrib] = attribs[attrib];
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
for (const attrib of MEDIA_KEYS_INT) {
|
|
129
|
+
if (attribs[attrib]) {
|
|
130
|
+
media[attrib] = parseInt(attribs[attrib], 10);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (attribs["expression"]) {
|
|
134
|
+
media.expression = attribs["expression"];
|
|
135
|
+
}
|
|
136
|
+
return media;
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Get one element by tag name.
|
|
141
|
+
*
|
|
142
|
+
* @param tagName Tag name to look for
|
|
143
|
+
* @param node Node to search in
|
|
144
|
+
* @returns The element or null
|
|
145
|
+
*/
|
|
146
|
+
function getOneElement(tagName, node) {
|
|
147
|
+
return getElementsByTagName(tagName, node, true, 1)[0];
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Get the text content of an element with a certain tag name.
|
|
151
|
+
*
|
|
152
|
+
* @param tagName Tag name to look for.
|
|
153
|
+
* @param where Node to search in.
|
|
154
|
+
* @param recurse Whether to recurse into child nodes.
|
|
155
|
+
* @returns The text content of the element.
|
|
156
|
+
*/
|
|
157
|
+
function fetch(tagName, where, recurse = false) {
|
|
158
|
+
return textContent(getElementsByTagName(tagName, where, recurse, 1)).trim();
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Adds a property to an object if it has a value.
|
|
162
|
+
*
|
|
163
|
+
* @param obj Object to be extended
|
|
164
|
+
* @param prop Property name
|
|
165
|
+
* @param tagName Tag name that contains the conditionally added property
|
|
166
|
+
* @param where Element to search for the property
|
|
167
|
+
* @param recurse Whether to recurse into child nodes.
|
|
168
|
+
*/
|
|
169
|
+
function addConditionally(obj, prop, tagName, where, recurse = false) {
|
|
170
|
+
const val = fetch(tagName, where, recurse);
|
|
171
|
+
if (val)
|
|
172
|
+
obj[prop] = val;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Checks if an element is a feed root node.
|
|
176
|
+
*
|
|
177
|
+
* @param value The name of the element to check.
|
|
178
|
+
* @returns Whether an element is a feed root node.
|
|
179
|
+
*/
|
|
180
|
+
function isValidFeed(value) {
|
|
181
|
+
return value === "rss" || value === "feed" || value === "rdf:RDF";
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=feeds.js.map
|
|
@@ -0,0 +1 @@
|
|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E,CAAC,CAAC;YAClD,CAAC;QACL,CAAC;QAED,IAAI,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;YACxB,KAAK,CAAC,UAAU,GAAG,OAAO,CACtB,YAAY,CACuB,CAAC;QAC5C,CAAC;QAED,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;;;GAMG;AACH,SAAS,aAAa,CAClB,OAA6C,EAC7C,IAAe;IAEf,OAAO,oBAAoB,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,KAAK,CACV,OAAe,EACf,KAA0B,EAC1B,OAAO,GAAG,KAAK;IAEf,OAAO,WAAW,CAAC,oBAAoB,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAChF,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,gBAAgB,CACrB,GAAM,EACN,IAAa,EACb,OAAe,EACf,KAAgB,EAChB,OAAO,GAAG,KAAK;IAEf,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC3C,IAAI,GAAG;QAAE,GAAG,CAAC,IAAI,CAAC,GAAG,GAA4B,CAAC;AACtD,CAAC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAAC,KAAa;IAC9B,OAAO,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,SAAS,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { AnyNode } from "domhandler";
|
|
2
|
+
/**
|
|
3
|
+
* Given an array of nodes, remove any member that is contained by another
|
|
4
|
+
* member.
|
|
5
|
+
*
|
|
6
|
+
* @category Helpers
|
|
7
|
+
* @param nodes Nodes to filter.
|
|
8
|
+
* @returns Remaining nodes that aren't contained by other nodes.
|
|
9
|
+
*/
|
|
10
|
+
export declare function removeSubsets(nodes: AnyNode[]): AnyNode[];
|
|
11
|
+
/**
|
|
12
|
+
* @category Helpers
|
|
13
|
+
* @see {@link http://dom.spec.whatwg.org/#dom-node-comparedocumentposition}
|
|
14
|
+
*/
|
|
15
|
+
export declare const enum DocumentPosition {
|
|
16
|
+
DISCONNECTED = 1,
|
|
17
|
+
PRECEDING = 2,
|
|
18
|
+
FOLLOWING = 4,
|
|
19
|
+
CONTAINS = 8,
|
|
20
|
+
CONTAINED_BY = 16
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Compare the position of one node against another node in any other document,
|
|
24
|
+
* returning a bitmask with the values from {@link DocumentPosition}.
|
|
25
|
+
*
|
|
26
|
+
* Document order:
|
|
27
|
+
* > There is an ordering, document order, defined on all the nodes in the
|
|
28
|
+
* > document corresponding to the order in which the first character of the
|
|
29
|
+
* > XML representation of each node occurs in the XML representation of the
|
|
30
|
+
* > document after expansion of general entities. Thus, the document element
|
|
31
|
+
* > node will be the first node. Element nodes occur before their children.
|
|
32
|
+
* > Thus, document order orders element nodes in order of the occurrence of
|
|
33
|
+
* > their start-tag in the XML (after expansion of entities). The attribute
|
|
34
|
+
* > nodes of an element occur after the element and before its children. The
|
|
35
|
+
* > relative order of attribute nodes is implementation-dependent.
|
|
36
|
+
*
|
|
37
|
+
* Source:
|
|
38
|
+
* http://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-document-order
|
|
39
|
+
*
|
|
40
|
+
* @category Helpers
|
|
41
|
+
* @param nodeA The first node to use in the comparison
|
|
42
|
+
* @param nodeB The second node to use in the comparison
|
|
43
|
+
* @returns A bitmask describing the input nodes' relative position.
|
|
44
|
+
*
|
|
45
|
+
* See http://dom.spec.whatwg.org/#dom-node-comparedocumentposition for
|
|
46
|
+
* a description of these values.
|
|
47
|
+
*/
|
|
48
|
+
export declare function compareDocumentPosition(nodeA: AnyNode, nodeB: AnyNode): number;
|
|
49
|
+
/**
|
|
50
|
+
* Sort an array of nodes based on their relative position in the document,
|
|
51
|
+
* removing any duplicate nodes. If the array contains nodes that do not belong
|
|
52
|
+
* to the same document, sort order is unspecified.
|
|
53
|
+
*
|
|
54
|
+
* @category Helpers
|
|
55
|
+
* @param nodes Array of DOM nodes.
|
|
56
|
+
* @returns Collection of unique nodes, sorted in document order.
|
|
57
|
+
*/
|
|
58
|
+
export declare function uniqueSort<T extends AnyNode>(nodes: T[]): T[];
|
|
59
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/0ab8bcf1ecfc70dfc93291a4cb2496578ac25e9c/src/","sources":["helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,OAAO,EAAc,MAAM,YAAY,CAAC;AAE9D;;;;;;;GAOG;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"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { hasChildren } from "domhandler";
|
|
2
|
+
/**
|
|
3
|
+
* Given an array of nodes, remove any member that is contained by another
|
|
4
|
+
* member.
|
|
5
|
+
*
|
|
6
|
+
* @category Helpers
|
|
7
|
+
* @param nodes Nodes to filter.
|
|
8
|
+
* @returns Remaining nodes that aren't contained by other nodes.
|
|
9
|
+
*/
|
|
10
|
+
export function removeSubsets(nodes) {
|
|
11
|
+
let idx = nodes.length;
|
|
12
|
+
/*
|
|
13
|
+
* Check if each node (or one of its ancestors) is already contained in the
|
|
14
|
+
* array.
|
|
15
|
+
*/
|
|
16
|
+
while (--idx >= 0) {
|
|
17
|
+
const node = nodes[idx];
|
|
18
|
+
/*
|
|
19
|
+
* Remove the node if it is not unique.
|
|
20
|
+
* We are going through the array from the end, so we only
|
|
21
|
+
* have to check nodes that preceed the node under consideration in the array.
|
|
22
|
+
*/
|
|
23
|
+
if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) {
|
|
24
|
+
nodes.splice(idx, 1);
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
for (let ancestor = node.parent; ancestor; ancestor = ancestor.parent) {
|
|
28
|
+
if (nodes.includes(ancestor)) {
|
|
29
|
+
nodes.splice(idx, 1);
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return nodes;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @category Helpers
|
|
38
|
+
* @see {@link http://dom.spec.whatwg.org/#dom-node-comparedocumentposition}
|
|
39
|
+
*/
|
|
40
|
+
export var DocumentPosition;
|
|
41
|
+
(function (DocumentPosition) {
|
|
42
|
+
DocumentPosition[DocumentPosition["DISCONNECTED"] = 1] = "DISCONNECTED";
|
|
43
|
+
DocumentPosition[DocumentPosition["PRECEDING"] = 2] = "PRECEDING";
|
|
44
|
+
DocumentPosition[DocumentPosition["FOLLOWING"] = 4] = "FOLLOWING";
|
|
45
|
+
DocumentPosition[DocumentPosition["CONTAINS"] = 8] = "CONTAINS";
|
|
46
|
+
DocumentPosition[DocumentPosition["CONTAINED_BY"] = 16] = "CONTAINED_BY";
|
|
47
|
+
})(DocumentPosition || (DocumentPosition = {}));
|
|
48
|
+
/**
|
|
49
|
+
* Compare the position of one node against another node in any other document,
|
|
50
|
+
* returning a bitmask with the values from {@link DocumentPosition}.
|
|
51
|
+
*
|
|
52
|
+
* Document order:
|
|
53
|
+
* > There is an ordering, document order, defined on all the nodes in the
|
|
54
|
+
* > document corresponding to the order in which the first character of the
|
|
55
|
+
* > XML representation of each node occurs in the XML representation of the
|
|
56
|
+
* > document after expansion of general entities. Thus, the document element
|
|
57
|
+
* > node will be the first node. Element nodes occur before their children.
|
|
58
|
+
* > Thus, document order orders element nodes in order of the occurrence of
|
|
59
|
+
* > their start-tag in the XML (after expansion of entities). The attribute
|
|
60
|
+
* > nodes of an element occur after the element and before its children. The
|
|
61
|
+
* > relative order of attribute nodes is implementation-dependent.
|
|
62
|
+
*
|
|
63
|
+
* Source:
|
|
64
|
+
* http://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-document-order
|
|
65
|
+
*
|
|
66
|
+
* @category Helpers
|
|
67
|
+
* @param nodeA The first node to use in the comparison
|
|
68
|
+
* @param nodeB The second node to use in the comparison
|
|
69
|
+
* @returns A bitmask describing the input nodes' relative position.
|
|
70
|
+
*
|
|
71
|
+
* See http://dom.spec.whatwg.org/#dom-node-comparedocumentposition for
|
|
72
|
+
* a description of these values.
|
|
73
|
+
*/
|
|
74
|
+
export function compareDocumentPosition(nodeA, nodeB) {
|
|
75
|
+
const aParents = [];
|
|
76
|
+
const bParents = [];
|
|
77
|
+
if (nodeA === nodeB) {
|
|
78
|
+
return 0;
|
|
79
|
+
}
|
|
80
|
+
let current = hasChildren(nodeA) ? nodeA : nodeA.parent;
|
|
81
|
+
while (current) {
|
|
82
|
+
aParents.unshift(current);
|
|
83
|
+
current = current.parent;
|
|
84
|
+
}
|
|
85
|
+
current = hasChildren(nodeB) ? nodeB : nodeB.parent;
|
|
86
|
+
while (current) {
|
|
87
|
+
bParents.unshift(current);
|
|
88
|
+
current = current.parent;
|
|
89
|
+
}
|
|
90
|
+
const maxIdx = Math.min(aParents.length, bParents.length);
|
|
91
|
+
let idx = 0;
|
|
92
|
+
while (idx < maxIdx && aParents[idx] === bParents[idx]) {
|
|
93
|
+
idx++;
|
|
94
|
+
}
|
|
95
|
+
if (idx === 0) {
|
|
96
|
+
return DocumentPosition.DISCONNECTED;
|
|
97
|
+
}
|
|
98
|
+
const sharedParent = aParents[idx - 1];
|
|
99
|
+
const siblings = sharedParent.children;
|
|
100
|
+
const aSibling = aParents[idx];
|
|
101
|
+
const bSibling = bParents[idx];
|
|
102
|
+
if (siblings.indexOf(aSibling) > siblings.indexOf(bSibling)) {
|
|
103
|
+
if (sharedParent === nodeB) {
|
|
104
|
+
return DocumentPosition.FOLLOWING | DocumentPosition.CONTAINED_BY;
|
|
105
|
+
}
|
|
106
|
+
return DocumentPosition.FOLLOWING;
|
|
107
|
+
}
|
|
108
|
+
if (sharedParent === nodeA) {
|
|
109
|
+
return DocumentPosition.PRECEDING | DocumentPosition.CONTAINS;
|
|
110
|
+
}
|
|
111
|
+
return DocumentPosition.PRECEDING;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Sort an array of nodes based on their relative position in the document,
|
|
115
|
+
* removing any duplicate nodes. If the array contains nodes that do not belong
|
|
116
|
+
* to the same document, sort order is unspecified.
|
|
117
|
+
*
|
|
118
|
+
* @category Helpers
|
|
119
|
+
* @param nodes Array of DOM nodes.
|
|
120
|
+
* @returns Collection of unique nodes, sorted in document order.
|
|
121
|
+
*/
|
|
122
|
+
export function uniqueSort(nodes) {
|
|
123
|
+
nodes = nodes.filter((node, i, arr) => !arr.includes(node, i + 1));
|
|
124
|
+
nodes.sort((a, b) => {
|
|
125
|
+
const relative = compareDocumentPosition(a, b);
|
|
126
|
+
if (relative & DocumentPosition.PRECEDING) {
|
|
127
|
+
return -1;
|
|
128
|
+
}
|
|
129
|
+
else if (relative & DocumentPosition.FOLLOWING) {
|
|
130
|
+
return 1;
|
|
131
|
+
}
|
|
132
|
+
return 0;
|
|
133
|
+
});
|
|
134
|
+
return nodes;
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/0ab8bcf1ecfc70dfc93291a4cb2496578ac25e9c/src/","sources":["helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAuB,MAAM,YAAY,CAAC;AAE9D;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,KAAgB;IAC1C,IAAI,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC;IAEvB;;;OAGG;IACH,OAAO,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QAChB,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QAExB;;;;WAIG;QACH,IAAI,GAAG,GAAG,CAAC,IAAI,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;YACnD,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YACrB,SAAS;QACb,CAAC;QAED,KAAK,IAAI,QAAQ,GAAG,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;YACpE,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC3B,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;gBACrB,MAAM;YACV,CAAC;QACL,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AACD;;;GAGG;AACH,MAAM,CAAN,IAAkB,gBAMjB;AAND,WAAkB,gBAAgB;IAC9B,uEAAgB,CAAA;IAChB,iEAAa,CAAA;IACb,iEAAa,CAAA;IACb,+DAAY,CAAA;IACZ,wEAAiB,CAAA;AACrB,CAAC,EANiB,gBAAgB,KAAhB,gBAAgB,QAMjC;AAED;;;;;;;;;;;;;;;;;;;;;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export * from "./traversal.js";
|
|
3
|
+
export * from "./manipulation.js";
|
|
4
|
+
export * from "./querying.js";
|
|
5
|
+
export * from "./legacy.js";
|
|
6
|
+
export * from "./helpers.js";
|
|
7
|
+
export * from "./feeds.js";
|
|
8
|
+
/** @deprecated Use these methods from `domhandler` directly. */
|
|
9
|
+
export { isTag, isCDATA, isText, isComment, isDocument, hasChildren, } from "domhandler";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/0ab8bcf1ecfc70dfc93291a4cb2496578ac25e9c/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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./stringify.js";
|
|
2
|
+
export * from "./traversal.js";
|
|
3
|
+
export * from "./manipulation.js";
|
|
4
|
+
export * from "./querying.js";
|
|
5
|
+
export * from "./legacy.js";
|
|
6
|
+
export * from "./helpers.js";
|
|
7
|
+
export * from "./feeds.js";
|
|
8
|
+
/** @deprecated Use these methods from `domhandler` directly. */
|
|
9
|
+
export { isTag, isCDATA, isText, isComment, isDocument, hasChildren, } from "domhandler";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/0ab8bcf1ecfc70dfc93291a4cb2496578ac25e9c/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"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { AnyNode, Element } from "domhandler";
|
|
2
|
+
import type { ElementType } from "domelementtype";
|
|
3
|
+
/**
|
|
4
|
+
* An object with keys to check elements against. If a key is `tag_name`,
|
|
5
|
+
* `tag_type` or `tag_contains`, it will check the value against that specific
|
|
6
|
+
* value. Otherwise, it will check an attribute with the key's name.
|
|
7
|
+
*
|
|
8
|
+
* @category Legacy Query Functions
|
|
9
|
+
*/
|
|
10
|
+
export interface TestElementOpts {
|
|
11
|
+
tag_name?: string | ((name: string) => boolean);
|
|
12
|
+
tag_type?: string | ((name: string) => boolean);
|
|
13
|
+
tag_contains?: string | ((data?: string) => boolean);
|
|
14
|
+
[attributeName: string]: undefined | string | ((attributeValue: string) => boolean);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Checks whether a node matches the description in `options`.
|
|
18
|
+
*
|
|
19
|
+
* @category Legacy Query Functions
|
|
20
|
+
* @param options An object describing nodes to look for.
|
|
21
|
+
* @param node The element to test.
|
|
22
|
+
* @returns Whether the element matches the description in `options`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function testElement(options: TestElementOpts, node: AnyNode): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Returns all nodes that match `options`.
|
|
27
|
+
*
|
|
28
|
+
* @category Legacy Query Functions
|
|
29
|
+
* @param options An object describing nodes to look for.
|
|
30
|
+
* @param nodes Nodes to search through.
|
|
31
|
+
* @param recurse Also consider child nodes.
|
|
32
|
+
* @param limit Maximum number of nodes to return.
|
|
33
|
+
* @returns All nodes that match `options`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function getElements(options: TestElementOpts, nodes: AnyNode | AnyNode[], recurse: boolean, limit?: number): AnyNode[];
|
|
36
|
+
/**
|
|
37
|
+
* Returns the node with the supplied ID.
|
|
38
|
+
*
|
|
39
|
+
* @category Legacy Query Functions
|
|
40
|
+
* @param id The unique ID attribute value to look for.
|
|
41
|
+
* @param nodes Nodes to search through.
|
|
42
|
+
* @param recurse Also consider child nodes.
|
|
43
|
+
* @returns The node with the supplied ID.
|
|
44
|
+
*/
|
|
45
|
+
export declare function getElementById(id: string | ((id: string) => boolean), nodes: AnyNode | AnyNode[], recurse?: boolean): Element | null;
|
|
46
|
+
/**
|
|
47
|
+
* Returns all nodes with the supplied `tagName`.
|
|
48
|
+
*
|
|
49
|
+
* @category Legacy Query Functions
|
|
50
|
+
* @param tagName Tag name to search for.
|
|
51
|
+
* @param nodes Nodes to search through.
|
|
52
|
+
* @param recurse Also consider child nodes.
|
|
53
|
+
* @param limit Maximum number of nodes to return.
|
|
54
|
+
* @returns All nodes with the supplied `tagName`.
|
|
55
|
+
*/
|
|
56
|
+
export declare function getElementsByTagName(tagName: string | ((name: string) => boolean), nodes: AnyNode | AnyNode[], recurse?: boolean, limit?: number): Element[];
|
|
57
|
+
/**
|
|
58
|
+
* Returns all nodes with the supplied `className`.
|
|
59
|
+
*
|
|
60
|
+
* @category Legacy Query Functions
|
|
61
|
+
* @param className Class name to search for.
|
|
62
|
+
* @param nodes Nodes to search through.
|
|
63
|
+
* @param recurse Also consider child nodes.
|
|
64
|
+
* @param limit Maximum number of nodes to return.
|
|
65
|
+
* @returns All nodes with the supplied `className`.
|
|
66
|
+
*/
|
|
67
|
+
export declare function getElementsByClassName(className: string | ((name: string) => boolean), nodes: AnyNode | AnyNode[], recurse?: boolean, limit?: number): Element[];
|
|
68
|
+
/**
|
|
69
|
+
* Returns all nodes with the supplied `type`.
|
|
70
|
+
*
|
|
71
|
+
* @category Legacy Query Functions
|
|
72
|
+
* @param type Element type to look for.
|
|
73
|
+
* @param nodes Nodes to search through.
|
|
74
|
+
* @param recurse Also consider child nodes.
|
|
75
|
+
* @param limit Maximum number of nodes to return.
|
|
76
|
+
* @returns All nodes with the supplied `type`.
|
|
77
|
+
*/
|
|
78
|
+
export declare function getElementsByTagType(type: ElementType | ((type: ElementType) => boolean), nodes: AnyNode | AnyNode[], recurse?: boolean, limit?: number): AnyNode[];
|
|
79
|
+
//# sourceMappingURL=legacy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/0ab8bcf1ecfc70dfc93291a4cb2496578ac25e9c/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;AAkFD;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAG5E;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CACvB,OAA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