Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(compat): Expose stream render from preact-render-to-string #4395

Merged
merged 2 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading