Skip to content

Commit

Permalink
Merge pull request #4395 from Austaras/main
Browse files Browse the repository at this point in the history
chore(compat): Expose stream render from `preact-render-to-string`
  • Loading branch information
rschristian authored May 22, 2024
2 parents b7c43d9 + 8315512 commit 77d941c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
13 changes: 12 additions & 1 deletion compat/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,18 @@ try {
);
}

var renderToPipeableStream;
try {
const mod = require('preact-render-to-string/stream-node');
renderToPipeableStream = mod.default || mod.renderToPipeableStream || mod;
} catch (e) {
throw Error(
'renderToPipeableStream() error: update "preact-render-to-string" dependency to at least 6.5.0.'
);
}

module.exports = {
renderToString: renderToString,
renderToStaticMarkup: renderToString
renderToStaticMarkup: renderToString,
renderToPipeableStream: renderToPipeableStream
};
5 changes: 4 additions & 1 deletion compat/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ export {
renderToString as renderToStaticMarkup
} from 'preact-render-to-string';

export { renderToPipeableStream } from 'preact-render-to-string/stream-node'

export default {
renderToString,
renderToStaticMarkup: renderToString
renderToStaticMarkup: renderToString,
renderToPipeableStream
};
15 changes: 8 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@
"npm-merge-driver-install": "^1.1.1",
"npm-run-all": "^4.0.0",
"oxlint": "^0.3.4",
"preact-render-to-string": "^5.2.5",
"preact-render-to-string": "^6.5.0",
"prop-types": "^15.7.2",
"sade": "^1.7.4",
"sinon": "^9.2.3",
Expand Down

0 comments on commit 77d941c

Please sign in to comment.