···1+MIT License
2+3+Copyright (c) 2025 Dan Abramov
4+5+Permission is hereby granted, free of charge, to any person obtaining a copy
6+of this software and associated documentation files (the "Software"), to deal
7+in the Software without restriction, including without limitation the rights
8+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+copies of the Software, and to permit persons to whom the Software is
10+furnished to do so, subject to the following conditions:
11+12+The above copyright notice and this permission notice shall be included in all
13+copies or substantial portions of the Software.
14+15+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+SOFTWARE.
···1+# RSC Explorer
2+3+A tool for educators and thinkerers curious about the React Server Components (RSC) protocol.
4+5+[RSC Explorer](https://rscexplorer.dev/) runs both the Server and the Client parts of RSC in the browser.
6+7+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.
8+9+
10+11+This is a hobby project and is not affiliated with or endorsed by any person, living or dead.
12+13+## Examples
14+15+* [Hello World](https://rscexplorer.dev/?s=hello)
16+* [Async Component](https://rscexplorer.dev/?s=async)
17+* [Counter](https://rscexplorer.dev/?s=counter)
18+* [Form Action](https://rscexplorer.dev/?s=form)
19+* [Pagination](https://rscexplorer.dev/?s=pagination)
20+* [Router Refresh](https://rscexplorer.dev/?s=refresh)
21+* [Error Handling](https://rscexplorer.dev/?s=errors)
22+* [Client Reference](https://rscexplorer.dev/?s=clientref)
23+* [Bound Actions](https://rscexplorer.dev/?s=bound)
24+* [Kitchen Sink](https://rscexplorer.dev/?s=kitchensink)
25+* [CVE-2025-55182](https://rscexplorer.dev/?s=cve)
26+27+## Embedding
28+29+You can embed RSC Explorer onto a page. Press the `< >` button in the top bar for the embed code.
30+31+## Development
32+33+Key design decisions to keep in mind:
34+35+- The Server part runs in a worker.
36+- We try to approximate a real RSC environment as much as we can (while staying in browser).
37+- No dependencies on React internals. We use `react-server-dom-webpack` and shim the Webpack runtime.
38+- No dependencies on the protocol format. We display it, but treat it as an implementation detail of React.
39+- Only end-to-end tests.
40+41+This is fully vibecoded but heavily steered so individual pieces may be weird or suboptimal.
42+43+Improvements welcome.
44+45+## License
46+47+MIT
···1+// Safari doesn't implement ReadableByteStreamController.
2+// The standard web-streams-polyfill only polyfills ReadableStream, not byte streams.
3+// This adds the missing byte stream support.
4+5+import {
6+ ReadableStream as PolyfillReadableStream,
7+ ReadableByteStreamController as PolyfillReadableByteStreamController,
8+} from 'web-streams-polyfill';
9+10+if (typeof globalThis.ReadableByteStreamController === 'undefined') {
11+ // Safari doesn't have byte stream support - use the polyfill's ReadableStream
12+ // which includes full byte stream support
13+ globalThis.ReadableStream = PolyfillReadableStream;
14+ globalThis.ReadableByteStreamController = PolyfillReadableByteStreamController;
15+}