@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,81 @@
|
|
|
1
|
+
import { isTag, isCDATA, isText, hasChildren, isComment, } from "domhandler";
|
|
2
|
+
import renderHTML from "dom-serializer";
|
|
3
|
+
import { ElementType } from "domelementtype";
|
|
4
|
+
/**
|
|
5
|
+
* @category Stringify
|
|
6
|
+
* @deprecated Use the `dom-serializer` module directly.
|
|
7
|
+
* @param node Node to get the outer HTML of.
|
|
8
|
+
* @param options Options for serialization.
|
|
9
|
+
* @returns `node`'s outer HTML.
|
|
10
|
+
*/
|
|
11
|
+
export function getOuterHTML(node, options) {
|
|
12
|
+
return renderHTML(node, options);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @category Stringify
|
|
16
|
+
* @deprecated Use the `dom-serializer` module directly.
|
|
17
|
+
* @param node Node to get the inner HTML of.
|
|
18
|
+
* @param options Options for serialization.
|
|
19
|
+
* @returns `node`'s inner HTML.
|
|
20
|
+
*/
|
|
21
|
+
export function getInnerHTML(node, options) {
|
|
22
|
+
return hasChildren(node)
|
|
23
|
+
? node.children.map((node) => getOuterHTML(node, options)).join("")
|
|
24
|
+
: "";
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get a node's inner text. Same as `textContent`, but inserts newlines for `<br>` tags. Ignores comments.
|
|
28
|
+
*
|
|
29
|
+
* @category Stringify
|
|
30
|
+
* @deprecated Use `textContent` instead.
|
|
31
|
+
* @param node Node to get the inner text of.
|
|
32
|
+
* @returns `node`'s inner text.
|
|
33
|
+
*/
|
|
34
|
+
export function getText(node) {
|
|
35
|
+
if (Array.isArray(node))
|
|
36
|
+
return node.map(getText).join("");
|
|
37
|
+
if (isTag(node))
|
|
38
|
+
return node.name === "br" ? "\n" : getText(node.children);
|
|
39
|
+
if (isCDATA(node))
|
|
40
|
+
return getText(node.children);
|
|
41
|
+
if (isText(node))
|
|
42
|
+
return node.data;
|
|
43
|
+
return "";
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Get a node's text content. Ignores comments.
|
|
47
|
+
*
|
|
48
|
+
* @category Stringify
|
|
49
|
+
* @param node Node to get the text content of.
|
|
50
|
+
* @returns `node`'s text content.
|
|
51
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent}
|
|
52
|
+
*/
|
|
53
|
+
export function textContent(node) {
|
|
54
|
+
if (Array.isArray(node))
|
|
55
|
+
return node.map(textContent).join("");
|
|
56
|
+
if (hasChildren(node) && !isComment(node)) {
|
|
57
|
+
return textContent(node.children);
|
|
58
|
+
}
|
|
59
|
+
if (isText(node))
|
|
60
|
+
return node.data;
|
|
61
|
+
return "";
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get a node's inner text, ignoring `<script>` and `<style>` tags. Ignores comments.
|
|
65
|
+
*
|
|
66
|
+
* @category Stringify
|
|
67
|
+
* @param node Node to get the inner text of.
|
|
68
|
+
* @returns `node`'s inner text.
|
|
69
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/innerText}
|
|
70
|
+
*/
|
|
71
|
+
export function innerText(node) {
|
|
72
|
+
if (Array.isArray(node))
|
|
73
|
+
return node.map(innerText).join("");
|
|
74
|
+
if (hasChildren(node) && (node.type === ElementType.Tag || isCDATA(node))) {
|
|
75
|
+
return innerText(node.children);
|
|
76
|
+
}
|
|
77
|
+
if (isText(node))
|
|
78
|
+
return node.data;
|
|
79
|
+
return "";
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=stringify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringify.js","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/0ab8bcf1ecfc70dfc93291a4cb2496578ac25e9c/src/","sources":["stringify.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,EACL,OAAO,EACP,MAAM,EACN,WAAW,EAEX,SAAS,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,UAAoC,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CACxB,IAAkC,EAClC,OAA8B;IAE9B,OAAO,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACrC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CACxB,IAAa,EACb,OAA8B;IAE9B,OAAO,WAAW,CAAC,IAAI,CAAC;QACpB,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;QACnE,CAAC,CAAC,EAAE,CAAC;AACb,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CAAC,IAAyB;IAC7C,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,EAA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AM,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,IAAI,CAAC;IACnC,OAAO,EAAE,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { AnyNode, ChildNode, Element, ParentNode } from "domhandler";
|
|
2
|
+
/**
|
|
3
|
+
* Get a node's children.
|
|
4
|
+
*
|
|
5
|
+
* @category Traversal
|
|
6
|
+
* @param elem Node to get the children of.
|
|
7
|
+
* @returns `elem`'s children, or an empty array.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getChildren(elem: AnyNode): ChildNode[];
|
|
10
|
+
export declare function getParent(elem: AnyNode): ParentNode | null;
|
|
11
|
+
/**
|
|
12
|
+
* Gets an elements siblings, including the element itself.
|
|
13
|
+
*
|
|
14
|
+
* Attempts to get the children through the element's parent first. If we don't
|
|
15
|
+
* have a parent (the element is a root node), we walk the element's `prev` &
|
|
16
|
+
* `next` to get all remaining nodes.
|
|
17
|
+
*
|
|
18
|
+
* @category Traversal
|
|
19
|
+
* @param elem Element to get the siblings of.
|
|
20
|
+
* @returns `elem`'s siblings, including `elem`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getSiblings(elem: AnyNode): AnyNode[];
|
|
23
|
+
/**
|
|
24
|
+
* Gets an attribute from an element.
|
|
25
|
+
*
|
|
26
|
+
* @category Traversal
|
|
27
|
+
* @param elem Element to check.
|
|
28
|
+
* @param name Attribute name to retrieve.
|
|
29
|
+
* @returns The element's attribute value, or `undefined`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getAttributeValue(elem: Element, name: string): string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Checks whether an element has an attribute.
|
|
34
|
+
*
|
|
35
|
+
* @category Traversal
|
|
36
|
+
* @param elem Element to check.
|
|
37
|
+
* @param name Attribute name to look for.
|
|
38
|
+
* @returns Returns whether `elem` has the attribute `name`.
|
|
39
|
+
*/
|
|
40
|
+
export declare function hasAttrib(elem: Element, name: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Get the tag name of an element.
|
|
43
|
+
*
|
|
44
|
+
* @category Traversal
|
|
45
|
+
* @param elem The element to get the name for.
|
|
46
|
+
* @returns The tag name of `elem`.
|
|
47
|
+
*/
|
|
48
|
+
export declare function getName(elem: Element): string;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the next element sibling of a node.
|
|
51
|
+
*
|
|
52
|
+
* @category Traversal
|
|
53
|
+
* @param elem The element to get the next sibling of.
|
|
54
|
+
* @returns `elem`'s next sibling that is a tag, or `null` if there is no next
|
|
55
|
+
* sibling.
|
|
56
|
+
*/
|
|
57
|
+
export declare function nextElementSibling(elem: AnyNode): Element | null;
|
|
58
|
+
/**
|
|
59
|
+
* Returns the previous element sibling of a node.
|
|
60
|
+
*
|
|
61
|
+
* @category Traversal
|
|
62
|
+
* @param elem The element to get the previous sibling of.
|
|
63
|
+
* @returns `elem`'s previous sibling that is a tag, or `null` if there is no
|
|
64
|
+
* previous sibling.
|
|
65
|
+
*/
|
|
66
|
+
export declare function prevElementSibling(elem: AnyNode): Element | null;
|
|
67
|
+
//# sourceMappingURL=traversal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traversal.d.ts","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/0ab8bcf1ecfc70dfc93291a4cb2496578ac25e9c/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;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAIhE;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAIhE"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { isTag, hasChildren, } from "domhandler";
|
|
2
|
+
/**
|
|
3
|
+
* Get a node's children.
|
|
4
|
+
*
|
|
5
|
+
* @category Traversal
|
|
6
|
+
* @param elem Node to get the children of.
|
|
7
|
+
* @returns `elem`'s children, or an empty array.
|
|
8
|
+
*/
|
|
9
|
+
export function getChildren(elem) {
|
|
10
|
+
return hasChildren(elem) ? elem.children : [];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Get a node's parent.
|
|
14
|
+
*
|
|
15
|
+
* @category Traversal
|
|
16
|
+
* @param elem Node to get the parent of.
|
|
17
|
+
* @returns `elem`'s parent node, or `null` if `elem` is a root node.
|
|
18
|
+
*/
|
|
19
|
+
export function getParent(elem) {
|
|
20
|
+
return elem.parent || null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Gets an elements siblings, including the element itself.
|
|
24
|
+
*
|
|
25
|
+
* Attempts to get the children through the element's parent first. If we don't
|
|
26
|
+
* have a parent (the element is a root node), we walk the element's `prev` &
|
|
27
|
+
* `next` to get all remaining nodes.
|
|
28
|
+
*
|
|
29
|
+
* @category Traversal
|
|
30
|
+
* @param elem Element to get the siblings of.
|
|
31
|
+
* @returns `elem`'s siblings, including `elem`.
|
|
32
|
+
*/
|
|
33
|
+
export function getSiblings(elem) {
|
|
34
|
+
const parent = getParent(elem);
|
|
35
|
+
if (parent != null)
|
|
36
|
+
return getChildren(parent);
|
|
37
|
+
const siblings = [elem];
|
|
38
|
+
let { prev, next } = elem;
|
|
39
|
+
while (prev != null) {
|
|
40
|
+
siblings.unshift(prev);
|
|
41
|
+
({ prev } = prev);
|
|
42
|
+
}
|
|
43
|
+
while (next != null) {
|
|
44
|
+
siblings.push(next);
|
|
45
|
+
({ next } = next);
|
|
46
|
+
}
|
|
47
|
+
return siblings;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Gets an attribute from an element.
|
|
51
|
+
*
|
|
52
|
+
* @category Traversal
|
|
53
|
+
* @param elem Element to check.
|
|
54
|
+
* @param name Attribute name to retrieve.
|
|
55
|
+
* @returns The element's attribute value, or `undefined`.
|
|
56
|
+
*/
|
|
57
|
+
export function getAttributeValue(elem, name) {
|
|
58
|
+
var _a;
|
|
59
|
+
return (_a = elem.attribs) === null || _a === void 0 ? void 0 : _a[name];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Checks whether an element has an attribute.
|
|
63
|
+
*
|
|
64
|
+
* @category Traversal
|
|
65
|
+
* @param elem Element to check.
|
|
66
|
+
* @param name Attribute name to look for.
|
|
67
|
+
* @returns Returns whether `elem` has the attribute `name`.
|
|
68
|
+
*/
|
|
69
|
+
export function hasAttrib(elem, name) {
|
|
70
|
+
return (elem.attribs != null &&
|
|
71
|
+
Object.prototype.hasOwnProperty.call(elem.attribs, name) &&
|
|
72
|
+
elem.attribs[name] != null);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get the tag name of an element.
|
|
76
|
+
*
|
|
77
|
+
* @category Traversal
|
|
78
|
+
* @param elem The element to get the name for.
|
|
79
|
+
* @returns The tag name of `elem`.
|
|
80
|
+
*/
|
|
81
|
+
export function getName(elem) {
|
|
82
|
+
return elem.name;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Returns the next element sibling of a node.
|
|
86
|
+
*
|
|
87
|
+
* @category Traversal
|
|
88
|
+
* @param elem The element to get the next sibling of.
|
|
89
|
+
* @returns `elem`'s next sibling that is a tag, or `null` if there is no next
|
|
90
|
+
* sibling.
|
|
91
|
+
*/
|
|
92
|
+
export function nextElementSibling(elem) {
|
|
93
|
+
let { next } = elem;
|
|
94
|
+
while (next !== null && !isTag(next))
|
|
95
|
+
({ next } = next);
|
|
96
|
+
return next;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Returns the previous element sibling of a node.
|
|
100
|
+
*
|
|
101
|
+
* @category Traversal
|
|
102
|
+
* @param elem The element to get the previous sibling of.
|
|
103
|
+
* @returns `elem`'s previous sibling that is a tag, or `null` if there is no
|
|
104
|
+
* previous sibling.
|
|
105
|
+
*/
|
|
106
|
+
export function prevElementSibling(elem) {
|
|
107
|
+
let { prev } = elem;
|
|
108
|
+
while (prev !== null && !isTag(prev))
|
|
109
|
+
({ prev } = prev);
|
|
110
|
+
return prev;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=traversal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traversal.js","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/0ab8bcf1ecfc70dfc93291a4cb2496578ac25e9c/src/","sources":["traversal.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,EAKL,WAAW,GACd,MAAM,YAAY,CAAC;AAEpB;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,IAAa;IACrC,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;AAClD,CAAC;AAGD;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,IAAa;IACnC,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC;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IAAa;IAC5C,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IACpB,OAAO,IAAI,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QAAE,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IACxD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAa;IAC5C,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IACpB,OAAO,IAAI,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QAAE,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IACxD,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -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,OAAO,GACP,OAAO,GACP,UAAU,GACV,YAAY,CAAC;AAEnB;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,MAAM,GAAG,SA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IAAI,CAQnD"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFeed = getFeed;
|
|
4
|
+
var stringify_js_1 = require("./stringify.js");
|
|
5
|
+
var legacy_js_1 = require("./legacy.js");
|
|
6
|
+
/**
|
|
7
|
+
* Get the feed object from the root of a DOM tree.
|
|
8
|
+
*
|
|
9
|
+
* @category Feeds
|
|
10
|
+
* @param doc - The DOM to to extract the feed from.
|
|
11
|
+
* @returns The feed.
|
|
12
|
+
*/
|
|
13
|
+
function getFeed(doc) {
|
|
14
|
+
var feedRoot = getOneElement(isValidFeed, doc);
|
|
15
|
+
return !feedRoot
|
|
16
|
+
? null
|
|
17
|
+
: feedRoot.name === "feed"
|
|
18
|
+
? getAtomFeed(feedRoot)
|
|
19
|
+
: getRssFeed(feedRoot);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Parse an Atom feed.
|
|
23
|
+
*
|
|
24
|
+
* @param feedRoot The root of the feed.
|
|
25
|
+
* @returns The parsed feed.
|
|
26
|
+
*/
|
|
27
|
+
function getAtomFeed(feedRoot) {
|
|
28
|
+
var _a;
|
|
29
|
+
var childs = feedRoot.children;
|
|
30
|
+
var feed = {
|
|
31
|
+
type: "atom",
|
|
32
|
+
items: (0, legacy_js_1.getElementsByTagName)("entry", childs).map(function (item) {
|
|
33
|
+
var _a;
|
|
34
|
+
var children = item.children;
|
|
35
|
+
var entry = { media: getMediaElements(children) };
|
|
36
|
+
addConditionally(entry, "id", "id", children);
|
|
37
|
+
addConditionally(entry, "title", "title", children);
|
|
38
|
+
var href = (_a = getOneElement("link", children)) === null || _a === void 0 ? void 0 : _a.attribs["href"];
|
|
39
|
+
if (href) {
|
|
40
|
+
entry.link = href;
|
|
41
|
+
}
|
|
42
|
+
var description = fetch("summary", children) || fetch("content", children);
|
|
43
|
+
if (description) {
|
|
44
|
+
entry.description = description;
|
|
45
|
+
}
|
|
46
|
+
var pubDate = fetch("updated", children);
|
|
47
|
+
if (pubDate) {
|
|
48
|
+
entry.pubDate = new Date(pubDate);
|
|
49
|
+
}
|
|
50
|
+
return entry;
|
|
51
|
+
}),
|
|
52
|
+
};
|
|
53
|
+
addConditionally(feed, "id", "id", childs);
|
|
54
|
+
addConditionally(feed, "title", "title", childs);
|
|
55
|
+
var href = (_a = getOneElement("link", childs)) === null || _a === void 0 ? void 0 : _a.attribs["href"];
|
|
56
|
+
if (href) {
|
|
57
|
+
feed.link = href;
|
|
58
|
+
}
|
|
59
|
+
addConditionally(feed, "description", "subtitle", childs);
|
|
60
|
+
var updated = fetch("updated", childs);
|
|
61
|
+
if (updated) {
|
|
62
|
+
feed.updated = new Date(updated);
|
|
63
|
+
}
|
|
64
|
+
addConditionally(feed, "author", "email", childs, true);
|
|
65
|
+
return feed;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Parse a RSS feed.
|
|
69
|
+
*
|
|
70
|
+
* @param feedRoot The root of the feed.
|
|
71
|
+
* @returns The parsed feed.
|
|
72
|
+
*/
|
|
73
|
+
function getRssFeed(feedRoot) {
|
|
74
|
+
var _a, _b;
|
|
75
|
+
var childs = (_b = (_a = getOneElement("channel", feedRoot.children)) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : [];
|
|
76
|
+
var feed = {
|
|
77
|
+
type: feedRoot.name.substr(0, 3),
|
|
78
|
+
id: "",
|
|
79
|
+
items: (0, legacy_js_1.getElementsByTagName)("item", feedRoot.children).map(function (item) {
|
|
80
|
+
var children = item.children;
|
|
81
|
+
var entry = { media: getMediaElements(children) };
|
|
82
|
+
addConditionally(entry, "id", "guid", children);
|
|
83
|
+
addConditionally(entry, "title", "title", children);
|
|
84
|
+
addConditionally(entry, "link", "link", children);
|
|
85
|
+
addConditionally(entry, "description", "description", children);
|
|
86
|
+
var pubDate = fetch("pubDate", children) || fetch("dc:date", children);
|
|
87
|
+
if (pubDate)
|
|
88
|
+
entry.pubDate = new Date(pubDate);
|
|
89
|
+
return entry;
|
|
90
|
+
}),
|
|
91
|
+
};
|
|
92
|
+
addConditionally(feed, "title", "title", childs);
|
|
93
|
+
addConditionally(feed, "link", "link", childs);
|
|
94
|
+
addConditionally(feed, "description", "description", childs);
|
|
95
|
+
var updated = fetch("lastBuildDate", childs);
|
|
96
|
+
if (updated) {
|
|
97
|
+
feed.updated = new Date(updated);
|
|
98
|
+
}
|
|
99
|
+
addConditionally(feed, "author", "managingEditor", childs, true);
|
|
100
|
+
return feed;
|
|
101
|
+
}
|
|
102
|
+
var MEDIA_KEYS_STRING = ["url", "type", "lang"];
|
|
103
|
+
var MEDIA_KEYS_INT = [
|
|
104
|
+
"fileSize",
|
|
105
|
+
"bitrate",
|
|
106
|
+
"framerate",
|
|
107
|
+
"samplingrate",
|
|
108
|
+
"channels",
|
|
109
|
+
"duration",
|
|
110
|
+
"height",
|
|
111
|
+
"width",
|
|
112
|
+
];
|
|
113
|
+
/**
|
|
114
|
+
* Get all media elements of a feed item.
|
|
115
|
+
*
|
|
116
|
+
* @param where Nodes to search in.
|
|
117
|
+
* @returns Media elements.
|
|
118
|
+
*/
|
|
119
|
+
function getMediaElements(where) {
|
|
120
|
+
return (0, legacy_js_1.getElementsByTagName)("media:content", where).map(function (elem) {
|
|
121
|
+
var attribs = elem.attribs;
|
|
122
|
+
var media = {
|
|
123
|
+
medium: attribs["medium"],
|
|
124
|
+
isDefault: !!attribs["isDefault"],
|
|
125
|
+
};
|
|
126
|
+
for (var _i = 0, MEDIA_KEYS_STRING_1 = MEDIA_KEYS_STRING; _i < MEDIA_KEYS_STRING_1.length; _i++) {
|
|
127
|
+
var attrib = MEDIA_KEYS_STRING_1[_i];
|
|
128
|
+
if (attribs[attrib]) {
|
|
129
|
+
media[attrib] = attribs[attrib];
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
for (var _a = 0, MEDIA_KEYS_INT_1 = MEDIA_KEYS_INT; _a < MEDIA_KEYS_INT_1.length; _a++) {
|
|
133
|
+
var attrib = MEDIA_KEYS_INT_1[_a];
|
|
134
|
+
if (attribs[attrib]) {
|
|
135
|
+
media[attrib] = parseInt(attribs[attrib], 10);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (attribs["expression"]) {
|
|
139
|
+
media.expression = attribs["expression"];
|
|
140
|
+
}
|
|
141
|
+
return media;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Get one element by tag name.
|
|
146
|
+
*
|
|
147
|
+
* @param tagName Tag name to look for
|
|
148
|
+
* @param node Node to search in
|
|
149
|
+
* @returns The element or null
|
|
150
|
+
*/
|
|
151
|
+
function getOneElement(tagName, node) {
|
|
152
|
+
return (0, legacy_js_1.getElementsByTagName)(tagName, node, true, 1)[0];
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Get the text content of an element with a certain tag name.
|
|
156
|
+
*
|
|
157
|
+
* @param tagName Tag name to look for.
|
|
158
|
+
* @param where Node to search in.
|
|
159
|
+
* @param recurse Whether to recurse into child nodes.
|
|
160
|
+
* @returns The text content of the element.
|
|
161
|
+
*/
|
|
162
|
+
function fetch(tagName, where, recurse) {
|
|
163
|
+
if (recurse === void 0) { recurse = false; }
|
|
164
|
+
return (0, stringify_js_1.textContent)((0, legacy_js_1.getElementsByTagName)(tagName, where, recurse, 1)).trim();
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Adds a property to an object if it has a value.
|
|
168
|
+
*
|
|
169
|
+
* @param obj Object to be extended
|
|
170
|
+
* @param prop Property name
|
|
171
|
+
* @param tagName Tag name that contains the conditionally added property
|
|
172
|
+
* @param where Element to search for the property
|
|
173
|
+
* @param recurse Whether to recurse into child nodes.
|
|
174
|
+
*/
|
|
175
|
+
function addConditionally(obj, prop, tagName, where, recurse) {
|
|
176
|
+
if (recurse === void 0) { recurse = false; }
|
|
177
|
+
var val = fetch(tagName, where, recurse);
|
|
178
|
+
if (val)
|
|
179
|
+
obj[prop] = val;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Checks if an element is a feed root node.
|
|
183
|
+
*
|
|
184
|
+
* @param value The name of the element to check.
|
|
185
|
+
* @returns Whether an element is a feed root node.
|
|
186
|
+
*/
|
|
187
|
+
function isValidFeed(value) {
|
|
188
|
+
return value === "rss" || value === "feed" || value === "rdf:RDF";
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=feeds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feeds.js","sourceRoot":"https://raw.githubusercontent.com/fb55/domutils/0ab8bcf1ecfc70dfc93291a4cb2496578ac25e9c/src/","sources":["feeds.ts"],"names":[],"mappings":";;AAkFA,0BAQC;AAzFD,+CAA6C;AAC7C,yCAAmD;AAyEnD;;;;;;GAMG;AACH,SAAgB,OAAO,CAAC,GAAc;IAClC,IAAM,QAAQ,GAAG,aAAa,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IAEjD,OAAO,CAAC,QAAQ;QACZ,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,QAAQ,CAAC,IAAI,KAAK,MAAM;YACxB,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC;YACvB,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AACjC,CAAC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAAC,QAAiB;;IAClC,IAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC;IAEjC,IAAM,IAAI,GAAS;QACf,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,IAAA,gCAAoB,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,UAAC,IAAI;;YAC1C,IAAA,QAAQ,GAAK,IAAI,SAAT,CAAU;YAC1B,IAAM,KAAK,GAAa,EAAE,KAAK,EAAE,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;YAE9D,gBAAgB,CAAC,KAAK,EAAE,IAAI,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AAC;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"}
|