├── .gitattributes ├── .github └── workflows │ └── ci.yml ├── .gitignore ├── .npmrc ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── bench ├── _run.js ├── cnnlite.html ├── hstream.js ├── hyperstream.js └── npmjs.html ├── eslint.config.js ├── index.js ├── package.json ├── selector.js └── test ├── attrs.js ├── doctype.html ├── fun-times.js ├── html.js ├── index.js ├── selectors.js ├── self-closing.js └── streams.js /.gitattributes: -------------------------------------------------------------------------------- 1 | bench/*.html linguist-vendored 2 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | test: 7 | name: Run tests 8 | strategy: 9 | matrix: 10 | node-version: 11 | - '8.x' 12 | - '10.x' 13 | - '12.x' 14 | - '14.x' 15 | - '15.x' 16 | - '16.x' 17 | - '17.x' 18 | - '18.x' 19 | - '19.x' 20 | - '20.x' 21 | - '21.x' 22 | - '22.x' 23 | runs-on: ubuntu-latest 24 | steps: 25 | - name: Checkout sources 26 | uses: actions/checkout@v4 27 | - name: Install Node.js ${{matrix.node-version}} 28 | uses: actions/setup-node@v4 29 | with: 30 | node-version: ${{matrix.node-version}} 31 | - name: Install dependencies 32 | run: npm install 33 | - name: Run tests 34 | run: npm test 35 | 36 | lint: 37 | name: Standard Style 38 | runs-on: ubuntu-latest 39 | steps: 40 | - name: Checkout sources 41 | uses: actions/checkout@v4 42 | - name: Install Node.js 43 | uses: actions/setup-node@v4 44 | with: 45 | node-version: 'lts/*' 46 | - name: Install dependencies 47 | run: npm install 48 | - name: Check style 49 | run: npm run lint 50 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git 27 | node_modules 28 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # hstream change log 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | This project adheres to [Semantic Versioning](http://semver.org/). 6 | 7 | ## 3.1.1 8 | 9 | * Update `css-what`, resolving denial of service warning 10 | 11 | ## 3.1.0 12 | 13 | * Add support for partial class matching, e.g. `.foo` -> `
` 14 | * Fix complex attribute selectors, e.g. `[class^="hello"]` 15 | * Fix crash on attributes with newline characters 16 | 17 | ## 3.0.0 18 | 19 | * Update dependencies. This major version bump is out of caution in case the parsing for the underlying HTML or CSS selector libraries changed. 20 | 21 | ## 2.0.0 22 | 23 | * Update dependencies. hstream now requires Node.js 8 or up. 24 | 25 | ## 1.2.0 26 | 27 | * Add ability to append or prepend to attributes (https://github.com/stackhtml/hstream/commit/e9b71c39d5a08d27b2ee09ae3043abcecd57b3db) 28 | 29 | ```js 30 | hstream({ 31 | '#app': { 32 | class: { prepend: 'beep ', append: ' boop' } 33 | } 34 | }) 35 | ``` 36 | 37 | * Remove attributes by setting `attrName: null` (https://github.com/stackhtml/hstream/commit/32480ba33327b1f32b16a91dc6752b4ecb5b8cec) 38 | * Edit attributes by passing a function (https://github.com/stackhtml/hstream/commit/32480ba33327b1f32b16a91dc6752b4ecb5b8cec) 39 | 40 | ```js 41 | hstream({ 42 | '#app': { 43 | title: function (prev) { return prev.toUpperCase() } 44 | } 45 | }) 46 | ``` 47 | 48 | * Edit html contents by passing a function (https://github.com/stackhtml/hstream/commit/b562c5ff1a644893093dda1c99558dded71fb422) 49 | 50 | ```js 51 | hstream({ 52 | 'code': { 53 | _html: function (source) { 54 | return highlightHTML(source) 55 | } 56 | } 57 | }) 58 | ``` 59 | 60 | ## 1.1.0 61 | 62 | * Add `_replaceHtml` option that replaces the outer html of an element 63 | 64 | ## 1.0.1 65 | 66 | * Pass through DOCTYPE and HTML comments untouched. 67 | 68 | ## 1.0.0 69 | 70 | * Initial release. 71 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # [Apache License 2.0](https://spdx.org/licenses/Apache-2.0) 2 | 3 | Copyright 2018 Renée Kooi© 2017 Cable News Network. Turner Broadcasting System, Inc. All Rights Reserved.
whatever
19 | abcdefghijklmnopqrstuvwxyz 20 |