···11+MIT License
22+33+Copyright (c) 2025 Dan Abramov
44+55+Permission is hereby granted, free of charge, to any person obtaining a copy
66+of this software and associated documentation files (the "Software"), to deal
77+in the Software without restriction, including without limitation the rights
88+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99+copies of the Software, and to permit persons to whom the Software is
1010+furnished to do so, subject to the following conditions:
1111+1212+The above copyright notice and this permission notice shall be included in all
1313+copies or substantial portions of the Software.
1414+1515+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121+SOFTWARE.
+47
README.md
···11+# RSC Explorer
22+33+A tool for educators and thinkerers curious about the React Server Components (RSC) protocol.
44+55+[RSC Explorer](https://rscexplorer.dev/) runs both the Server and the Client parts of RSC in the browser.
66+77+It lets you inspect the RSC stream step by step and observe the React tree that is being streamed at every step. It also hosts some examples that showcase how React Server and Client features can interplay.
88+99+
1010+1111+This is a hobby project and is not affiliated with or endorsed by any person, living or dead.
1212+1313+## Examples
1414+1515+* [Hello World](https://rscexplorer.dev/?s=hello)
1616+* [Async Component](https://rscexplorer.dev/?s=async)
1717+* [Counter](https://rscexplorer.dev/?s=counter)
1818+* [Form Action](https://rscexplorer.dev/?s=form)
1919+* [Pagination](https://rscexplorer.dev/?s=pagination)
2020+* [Router Refresh](https://rscexplorer.dev/?s=refresh)
2121+* [Error Handling](https://rscexplorer.dev/?s=errors)
2222+* [Client Reference](https://rscexplorer.dev/?s=clientref)
2323+* [Bound Actions](https://rscexplorer.dev/?s=bound)
2424+* [Kitchen Sink](https://rscexplorer.dev/?s=kitchensink)
2525+* [CVE-2025-55182](https://rscexplorer.dev/?s=cve)
2626+2727+## Embedding
2828+2929+You can embed RSC Explorer onto a page. Press the `< >` button in the top bar for the embed code.
3030+3131+## Development
3232+3333+Key design decisions to keep in mind:
3434+3535+- The Server part runs in a worker.
3636+- We try to approximate a real RSC environment as much as we can (while staying in browser).
3737+- No dependencies on React internals. We use `react-server-dom-webpack` and shim the Webpack runtime.
3838+- No dependencies on the protocol format. We display it, but treat it as an implementation detail of React.
3939+- Only end-to-end tests.
4040+4141+This is fully vibecoded but heavily steered so individual pieces may be weird or suboptimal.
4242+4343+Improvements welcome.
4444+4545+## License
4646+4747+MIT
···11+// Safari doesn't implement ReadableByteStreamController.
22+// The standard web-streams-polyfill only polyfills ReadableStream, not byte streams.
33+// This adds the missing byte stream support.
44+55+import {
66+ ReadableStream as PolyfillReadableStream,
77+ ReadableByteStreamController as PolyfillReadableByteStreamController,
88+} from 'web-streams-polyfill';
99+1010+if (typeof globalThis.ReadableByteStreamController === 'undefined') {
1111+ // Safari doesn't have byte stream support - use the polyfill's ReadableStream
1212+ // which includes full byte stream support
1313+ globalThis.ReadableStream = PolyfillReadableStream;
1414+ globalThis.ReadableByteStreamController = PolyfillReadableByteStreamController;
1515+}