Skip to content

Commit

Permalink
[add] Stream Rendering method (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
TechQuery authored Jul 25, 2024
1 parent 818b3c3 commit 2f1d289
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 126 deletions.
18 changes: 18 additions & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,24 @@ const newVNode = new DOMRenderer().render(
console.log(newVNode);
```

### Node.js & Bun

```jsx
import { Readable } from 'stream';
import { createServer } from 'http';
import { DOMRenderer } from 'dom-renderer';

const renderer = new DOMRenderer();

const Hello = () => <h1>Hello, JSX SSR!</h1>;

createServer((request, response) => {
const stream = renderer.renderToReadableStream(<Hello />);

Readable.fromWeb(stream).pipe(response);
}).listen(8080);
```

## Framework

### Web components
Expand Down
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dom-renderer",
"version": "2.2.0",
"version": "2.3.0",
"license": "LGPL-3.0-or-later",
"author": "shiy2008@gmail.com",
"description": "A light-weight DOM Renderer supports Web components standard & TypeScript language",
Expand All @@ -24,23 +24,24 @@
"types": "dist/index.d.ts",
"main": "dist/index.js",
"dependencies": {
"declarative-shadow-dom-polyfill": "^0.4.0",
"tslib": "^2.6.3",
"web-streams-polyfill": "^4.0.0",
"web-utility": "^4.4.0"
},
"devDependencies": {
"@happy-dom/jest-environment": "^14.12.3",
"@types/jest": "^29.5.12",
"@types/node": "^18.19.39",
"declarative-shadow-dom-polyfill": "^0.3.2",
"husky": "^9.0.11",
"@types/node": "^18.19.42",
"husky": "^9.1.2",
"jest": "^29.7.0",
"lint-staged": "^15.2.7",
"open-cli": "^8.0.0",
"prettier": "^3.3.2",
"ts-jest": "^29.2.2",
"typedoc": "^0.26.4",
"typedoc-plugin-mdn-links": "^3.2.3",
"typescript": "~5.5.3"
"prettier": "^3.3.3",
"ts-jest": "^29.2.3",
"typedoc": "^0.26.5",
"typedoc-plugin-mdn-links": "^3.2.5",
"typescript": "~5.5.4"
},
"prettier": {
"singleQuote": true,
Expand Down
Loading

0 comments on commit 2f1d289

Please sign in to comment.