{"_id":"htmlparser2-svelte","_rev":"2-45d3c627ce514a1a5ad3b34fbe64468e","name":"htmlparser2-svelte","dist-tags":{"latest":"4.1.1"},"versions":{"4.1.0":{"name":"htmlparser2-svelte","description":"Fast & forgiving HTML/Svelte/XML/RSS parser","version":"4.1.0","author":{"name":"Alexey Mulyukin","email":"alexprey@yandex.ru"},"contributors":[{"name":"Felix Boehm","email":"me@feedic.com"}],"sideEffects":false,"keywords":["html","parser","streams","xml","dom","rss","feed","atom","svelte"],"repository":{"type":"git","url":"git+https://github.com/alexprey/htmlparser2.git"},"directories":{"lib":"lib/"},"main":"lib/index.js","types":"lib/index.d.ts","browser":{"./lib/WritableStream.js":false},"scripts":{"test":"jest --coverage -u && npm run lint","coverage":"cat coverage/lcov.info | coveralls","lint":"eslint --ext=js,ts src","format":"prettier --write '**/*.{ts,md,json}'","build":"tsc","prepare":"npm run build"},"dependencies":{"domelementtype":"^2.0.1","domhandler":"^3.0.0","domutils":"^2.0.0","entities":"^2.0.0"},"devDependencies":{"@types/jest":"^26.0.0","@types/node":"^14.0.5","@typescript-eslint/eslint-plugin":"^2.31.0","@typescript-eslint/parser":"^2.31.0","coveralls":"^3.0.1","eslint":"^7.0.0","eslint-config-prettier":"^6.0.0","jest":"^26.0.1","prettier":"^2.0.5","ts-jest":"^26.0.0","typescript":"^3.5.3"},"jest":{"preset":"ts-jest","testEnvironment":"node"},"license":"MIT","prettier":{"tabWidth":4},"gitHead":"9255358ffc40b554315986e12f9d1ef7d24e493b","bugs":{"url":"https://github.com/alexprey/htmlparser2/issues"},"homepage":"https://github.com/alexprey/htmlparser2#readme","_id":"htmlparser2-svelte@4.1.0","_nodeVersion":"12.12.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-+4f4RBFz7Rj2Hp0ZbFbXC+Kzbd6S9PgjiuFtdT76VMNgKogrEZy0pG2UrPycPbrZzVEIM5lAT3lAdkSTCHLPjg==","shasum":"3f8421a2896e58d1c430fe2a82033c8f6377cc64","tarball":"https://registry.npmjs.org/htmlparser2-svelte/-/htmlparser2-svelte-4.1.0.tgz","fileCount":24,"unpackedSize":107857,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfQ+5oCRA9TVsSAnZWagAAkYgP/06NSCV8FntprOlCVcH5\nUnMi2GwtE0wx93kKPeWtQKJdKIEd60m5MpIdGJJrCstQqUL43bQsE6vWRXbq\nFI78QNT/7YSDnVaM2eG5pvGRLzJGllLSJSOMO9AR3XFKk1LWcspbydkfxN7q\nnb7dhyr5WmrP5SNVlCU4be9JhbxmMnYXy83peN0O0oMpoUGXWPiNaIY3oJ64\nRWuUWUxI/pIUHIlzgkYIUhyprey1ZejYyhlMzdioBEiulfUT0cbSeNxLH/DE\nfgT7RIDs4ai0N6yLeNnLc/btuJ+/C24Myv8hzrDAtb1++EinExzj0CCqjOva\n7L/j0bfK8Wma2Ytp7I1EC6CpWrI080ak0ZCAA8IuR30fntyfJAtMafs8X/fj\nceCsC+FgQMUUj4+kDtQXdXtHyjfe59R0DLql7U5KPrnhQ5Y8LMNpC/cR+Ryn\nSNMBfhX6QaS0VRkPg0cHR1zXmPT5FGYoK5hg7AXdXOmqf3zGh1kIsI1IXOE/\nkb1s12TIL31BAWVRNlQsbPlDt25BGDgpAf0pWG0CEerzAKpF6KQXHuzYUqS8\nPtMpfZ8QbVWL/lvqrkyBoKtSzhtIUDwR8yhQUSD4BX+5QWh5j05q/nx9UPTW\nFAdwVsQidTe2M5KnfrPrsgl71qhDlpv0qcJhR/pae0ITBi5adfIPwKYHwOdi\nQoa8\r\n=2eSn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC1ep/wp7x+ZxLOA0UUDDGLWhdhlB7z3bvf3wRYvh9CSQIgdxf0BENZN2C1n2sw6AezOTFD7Wc+dM0FnPltHLLacEo="}]},"maintainers":[{"name":"alexprey","email":"alexprey@yandex.ru"}],"_npmUser":{"name":"alexprey","email":"alexprey@yandex.ru"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/htmlparser2-svelte_4.1.0_1598287464205_0.8548176183806699"},"_hasShrinkwrap":false},"4.1.1":{"name":"htmlparser2-svelte","description":"Fast & forgiving HTML/Svelte/XML/RSS parser","version":"4.1.1","author":{"name":"Alexey Mulyukin","email":"alexprey@yandex.ru"},"contributors":[{"name":"Felix Boehm","email":"me@feedic.com"}],"sideEffects":false,"keywords":["html","parser","streams","xml","dom","rss","feed","atom","svelte"],"repository":{"type":"git","url":"git+https://github.com/alexprey/htmlparser2.git"},"directories":{"lib":"lib/"},"main":"lib/index.js","types":"lib/index.d.ts","browser":{"./lib/WritableStream.js":false},"scripts":{"test":"jest --coverage -u && npm run lint","coverage":"cat coverage/lcov.info | coveralls","lint":"eslint --ext=js,ts src","format":"prettier --write '**/*.{ts,md,json}'","build":"tsc","prepare":"npm run build"},"dependencies":{"domelementtype":"^2.0.1","domhandler":"^3.0.0","domutils":"^2.0.0","entities":"^2.0.0"},"devDependencies":{"@types/jest":"^26.0.0","@types/node":"^14.0.5","@typescript-eslint/eslint-plugin":"^2.31.0","@typescript-eslint/parser":"^2.31.0","coveralls":"^3.0.1","eslint":"^7.0.0","eslint-config-prettier":"^6.0.0","jest":"^26.0.1","prettier":"^2.0.5","ts-jest":"^26.0.0","typescript":"^3.5.3"},"jest":{"preset":"ts-jest","testEnvironment":"node"},"license":"MIT","prettier":{"tabWidth":4},"gitHead":"360d508b9dfccdcc718ea1fdae56824f1f034c31","bugs":{"url":"https://github.com/alexprey/htmlparser2/issues"},"homepage":"https://github.com/alexprey/htmlparser2#readme","_id":"htmlparser2-svelte@4.1.1","_nodeVersion":"12.12.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-HAXPZR2MHuHLCsvHZVFxO4ewGLWVhJRlARL+6eeANEyK6N1GNqtl1rTNuqXG7+CK3+7oii4TejvKiz110EkEHA==","shasum":"6dfc86fbec5fa0b441e371dce5d466f4caa7ce3a","tarball":"https://registry.npmjs.org/htmlparser2-svelte/-/htmlparser2-svelte-4.1.1.tgz","fileCount":24,"unpackedSize":108183,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfROVKCRA9TVsSAnZWagAAr5IP/1ttpzn/9St4+gMpDleS\nj1PEgmjANveNajztxLkgpvu8qh/9A7vLaW2M7SYZhkJs31BLP1PSiuUnbHhN\nwSDPKdj+EeWRJiKiYsrfeGMeFNTpWaZC91mpACKDRNQpRJuVBr5y4IkmeI8V\nJ/9blOJ1AIz7eX9wzdSL5dvBzGse5YPv9/LGBTSz6lncZyBpKQ+23vk3VONS\nC/RQNyc61C5f0twpGEyvL6tu+oysw7MIkBio0BwlzGqRP11Ks4xxoRWHYI5E\nxSRdg3MDAfmzQo20FIg0dZ/1QMTlvGwauaUjTst0YDjDi+BNG7Z60oS2VFqy\ntXUYsEBSGxjW+L2Y4+vkk4yJhszTnPwpK/yzl9k8dGznW+eTCMwz0Y4DmgO7\ntN9ewEyAiEZQoOxEZi1fhbsobxAOGaMqWy5X+eHRk+xjYMFIRDMV1/x/6Eu3\nOR7Gg4ydLiWaf9veD6UWfUfw5xtj1DHNOha8j8BzwPaTJ1xIQtN7cWn5ZykT\n5E0mYaCQ3e/tA3T/vzKUhcPgzRmrthNrofgUCyQ1lpTQL7jBvq++OI+o5z5i\n1jgJb60icfFi6B5s0EVc2kVa4c1CXs989SAcQeE/c3LNBAykTWQXWHZSVnLj\nKBGXh9C868ZDedQfd3jJ6tswDNhYPZsOXS3JIIS+BI+De6cMjsWZqeRIc22D\niw3s\r\n=e+lm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDzUmP4rI9asx5CPyyLEH643/MhhQgCX9xDlNNRfZFklAiEAuhPF3SsFtJqX1TenubRXfbSo9lWGyzlKiMvzl17VZQg="}]},"maintainers":[{"name":"alexprey","email":"alexprey@yandex.ru"}],"_npmUser":{"name":"alexprey","email":"alexprey@yandex.ru"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/htmlparser2-svelte_4.1.1_1598350665824_0.9716130168480779"},"_hasShrinkwrap":false}},"time":{"created":"2020-08-24T16:44:24.205Z","4.1.0":"2020-08-24T16:44:24.490Z","modified":"2022-05-05T07:43:30.427Z","4.1.1":"2020-08-25T10:17:45.953Z"},"maintainers":[{"name":"alexprey","email":"alexprey@yandex.ru"}],"description":"Fast & forgiving HTML/Svelte/XML/RSS parser","homepage":"https://github.com/alexprey/htmlparser2#readme","keywords":["html","parser","streams","xml","dom","rss","feed","atom","svelte"],"repository":{"type":"git","url":"git+https://github.com/alexprey/htmlparser2.git"},"contributors":[{"name":"Felix Boehm","email":"me@feedic.com"}],"author":{"name":"Alexey Mulyukin","email":"alexprey@yandex.ru"},"bugs":{"url":"https://github.com/alexprey/htmlparser2/issues"},"license":"MIT","readme":"# htmlparser2\n\n[![NPM version](http://img.shields.io/npm/v/htmlparser2-svelte.svg?style=flat)](https://npmjs.org/package/htmlparser2-svelte)\n![Build Status](https://github.com/alexprey/htmlparser2/workflows/Node.js%20CI/badge.svg)\n\nA forgiving HTML/Svelte/XML/RSS parser.\nThe parser can handle streams and provides a callback interface.\n\nExtended version of [htmlparser2](https://github.com/fb55/htmlparser2) with Svelte syntax feature supporting, enabled by new options.\n\n## Additional features\n\n- Support of JS expressions in tag attributes\n```html\n<button type=\"button\" on:click={() => handleButtonClick()}>\n    Click to say hello\n</button>\n```\n\n## Installation\n\n    npm install htmlparser2-svelte\n\n## Usage\n\n```javascript\nconst htmlparser2 = require(\"htmlparser2-svelte\");\nconst parser = new htmlparser2.Parser(\n    {\n        onopentag(name, attribs) {\n            if (name === \"script\" && attribs.type === \"text/javascript\") {\n                console.log(\"JS! Hooray!\");\n            }\n        },\n        ontext(text) {\n            console.log(\"-->\", text);\n        },\n        onclosetag(tagname) {\n            if (tagname === \"script\") {\n                console.log(\"That's it?!\");\n            }\n        },\n    },\n    { decodeEntities: true }\n);\nparser.write(\n    \"Xyz <script type='text/javascript'>var foo = '<<bar>>';</ script>\"\n);\nparser.end();\n```\n\nOutput (simplified):\n\n```\n--> Xyz\nJS! Hooray!\n--> var foo = '<<bar>>';\nThat's it?!\n```\n\n### Usage with streams\n\nWhile the `Parser` interface closely resembles Node.js streams, it's not a 100% match. Use the `WritableStream` interface to process a streaming input:\n\n```javascript\nconst htmlparser2 = require(\"htmlparser2-svelte\");\nconst parserStream = new htmlparser2.WritableStream(\n    {\n        ontext(text) {\n            console.log(\"Streaming:\", text);\n        },\n    },\n    { decodeEntities: true }\n);\n\nconst htmlStream = getHtmlStreamFromSomewhere();\nhtmlStream.pipe(parserStream).on(\"finish\", () => console.log(\"done\"));\n```\n\n## Documentation\n\nRead more about the parser and its options in the [wiki](https://github.com/fb55/htmlparser2/wiki/Parser-options).\n\n## Get a DOM\n\nThe `DomHandler` (known as `DefaultHandler` in the original `htmlparser` module) produces a DOM (document object model) that can be manipulated using the [`DomUtils`](https://github.com/fb55/DomUtils) helper.\n\nThe `DomHandler`, while still bundled with this module, was moved to its [own module](https://github.com/fb55/domhandler). Have a look at it for further information.\n\n## Parsing RSS/RDF/Atom Feeds\n\n```javascript\nconst feed = htmlparser2.parseFeed(content, options);\n```\n\nNote: While the provided feed handler works for most feeds, you might want to use [danmactough/node-feedparser](https://github.com/danmactough/node-feedparser), which is much better tested and actively maintained.\n\n## Parsing Svelte HTML\n\n```javascript\nconst htmlparser2 = require(\"htmlparser2-svelte\");\nconst parserStream = new htmlparser2.WritableStream(\n    {\n        ontext(text) {\n            console.log(\"Streaming:\", text);\n        },\n    },\n    { \n        decodeEntities: true,\n        curlyBracesInAttributes: true,\n    }\n);\n\nconst htmlStream = getHtmlStreamFromSomewhere();\nhtmlStream.pipe(parserStream).on(\"finish\", () => console.log(\"done\"));\n```\n\n## Performance\n\nAfter having some artificial benchmarks for some time, **@AndreasMadsen** published his [`htmlparser-benchmark`](https://github.com/AndreasMadsen/htmlparser-benchmark), which benchmarks HTML parses based on real-world websites.\n\nAt the time of writing, the latest versions of all supported parsers show the following performance characteristics on [Travis CI](https://travis-ci.org/AndreasMadsen/htmlparser-benchmark/builds/10805007) (please note that Travis doesn't guarantee equal conditions for all tests):\n\n```\ngumbo-parser   : 34.9208 ms/file ± 21.4238\nhtml-parser    : 24.8224 ms/file ± 15.8703\nhtml5          : 419.597 ms/file ± 264.265\nhtmlparser     : 60.0722 ms/file ± 384.844\nhtmlparser2-dom: 12.0749 ms/file ± 6.49474\nhtmlparser2    : 7.49130 ms/file ± 5.74368\nhubbub         : 30.4980 ms/file ± 16.4682\nlibxmljs       : 14.1338 ms/file ± 18.6541\nparse5         : 22.0439 ms/file ± 15.3743\nsax            : 49.6513 ms/file ± 26.6032\n```\n\n## How does this module differ from [node-htmlparser](https://github.com/tautologistics/node-htmlparser)?\n\nThis module started as a fork of the `htmlparser` module.\nThe main difference is that `htmlparser2` is intended to be used only with node (it runs on other platforms using [browserify](https://github.com/substack/node-browserify)).\n`htmlparser2` was rewritten multiple times and, while it maintains an API that's compatible with `htmlparser` in most cases, the projects don't share any code anymore.\n\nThe parser now provides a callback interface inspired by [sax.js](https://github.com/isaacs/sax-js) (originally targeted at [readabilitySAX](https://github.com/fb55/readabilitysax)).\nAs a result, old handlers won't work anymore.\n\nThe `DefaultHandler` and the `RssHandler` were renamed to clarify their purpose (to `DomHandler` and `FeedHandler`). The old names are still available when requiring `htmlparser2`, your code should work as expected.\n\n## Security contact information\n\nTo report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).\nTidelift will coordinate the fix and disclosure.\n\n## `htmlparser2` for enterprise\n\nAvailable as part of the Tidelift Subscription\n\nThe maintainers of `htmlparser2` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-htmlparser2?utm_source=npm-htmlparser2&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)\n","readmeFilename":"README.md"}