Sample
react-dom 19.2.8: prerender
Verified sample for npm react-dom 19.2.8: prerender. The contract ran on node 22 · linux alpine/x64 · docker and passed: assert prerender is exported from…
sha256:07d0a8acbd5711fdca6ba75d3e633843d5588c828cda7d21fe0efa2bbaa6f595
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux 24 · ubuntu · glibc 2.39 x64 npm
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-26 |
Case
HOW- Goal
- verify prerender in pkg:npm/react-dom@19.2.8
- Packages
- Symbols
-
- prerender
- Created
- 2026-08-26T11:25:39Z
Contract
- assert prerender is exported from react-dom/static and react-dom/static.node as an async function
- assert prerender renders React elements into a ReadableStream prelude and returns null postponed state
- assert prerender resolves React Suspense boundaries containing synchronous children in the prelude stream
- assert prerender supports bootstrapScriptContent option and injects the script into prelude output
- assert prerender accepts an AbortSignal option for aborting or controlling the render lifecycle
Files
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Source
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify prerender in pkg:npm/react-dom@19.2.8
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/react-dom@19.2.8
Demonstrate these symbols/APIs:
- prerender
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:451441ff85b2ee22c2550fdc33955eaa798f798e2d1483c8b035de1da8784ce3","contract":["assert prerender is exported from react-dom/static and react-dom/static.node as an async function","assert prerender renders React elements into a ReadableStream prelude and returns null postponed state","assert prerender resolves React Suspense boundaries containing synchronous children in the prelude stream","assert prerender supports bootstrapScriptContent option and injects the script into prelude output","assert prerender accepts an AbortSignal option for aborting or controlling the render lifecycle"],"goal":"verify prerender in pkg:npm/react-dom@19.2.8","kind":"HOW","packages":["pkg:npm/react-dom@19.2.8"],"schemaVersion":1,"symbols":["prerender"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/react-dom@19.2.8"],"schemaVersion":1,"subject":"pkg:npm/react-dom@19.2.8","symbols":["prerender"],"verifierAdapter":"node-typescript@1"}
import { prerender } from 'react-dom/static';
/**
* Reads a Web ReadableStream into a UTF-8 string.
*
* @param {ReadableStream} stream
* @returns {Promise<string>}
*/
export async function streamToString(stream) {
const reader = stream.getReader();
const decoder = new TextDecoder();
let result = '';
while (true) {
const { done, value } = await reader.read();
if (done) break;
result += decoder.decode(value, { stream: true });
}
return result;
}
/**
* Prerenders a React node and returns the resolved HTML string and postponed state.
*
* @param {import('react').ReactNode} element - The React node to render.
* @param {Object} [options] - Prerender options (e.g. signal, bootstrapScriptContent, etc.).
* @returns {Promise<{ html: string, postponed: object | null }>}
*/
export async function prerenderToHtml(element, options) {
const result = await prerender(element, options);
const html = await streamToString(result.prelude);
return {
html,
postponed: result.postponed,
};
}
export { prerender };
{
"name": "sample-react-dom-prerender",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-react-dom-prerender",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"react": "19.2.8",
"react-dom": "19.2.8"
}
},
"node_modules/react": {
"version": "19.2.8",
"resolved": "https://registry.npmjs.org/react/-/react-19.2.8.tgz",
"integrity": "sha512-PWaYA1L/q9u2u7xYQi+Y3L3Yfnie7XyLeaJICV1MGD6LprsBxcAqGjYyr0eY3p+QdsA+x/Irkt4Qif8D63+Sbw==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/react-dom": {
"version": "19.2.8",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.8.tgz",
"integrity": "sha512-rVprimfGBG3DR+Tq0IQG2DT5PxKth1WIGDmj5yPmlzr4YBe7uyE+Du4oVqTDXZSHGGGXRtTJEGSSePyQCMBglQ==",
"license": "MIT",
"dependencies": {
"scheduler": "^0.27.0"
},
"peerDependencies": {
"react": "^19.2.8"
}
},
"node_modules/scheduler": {
"version": "0.27.0",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz",
"integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==",
"license": "MIT"
}
}
}
{
"name": "sample-react-dom-prerender",
"version": "1.0.0",
"description": "Clean-room sample verifying react-dom prerender",
"main": "index.js",
"type": "module",
"license": "MIT-0",
"dependencies": {
"react": "19.2.8",
"react-dom": "19.2.8"
}
}
{
"schemaVersion": 1,
"goal": "verify prerender in pkg:npm/react-dom@19.2.8",
"kind": "HOW",
"packages": [
"pkg:npm/react-dom@19.2.8"
],
"symbols": [
"prerender"
]
}
import assert from 'node:assert/strict';
import React from 'react';
import { prerender } from 'react-dom/static';
import { prerender as prerenderNode } from 'react-dom/static.node';
import { prerenderToHtml, streamToString } from '../index.js';
// 1. assert prerender is exported from react-dom/static and react-dom/static.node as an async function
assert.equal(typeof prerender, 'function', 'prerender must be exported from react-dom/static');
assert.equal(typeof prerenderNode, 'function', 'prerender must be exported from react-dom/static.node');
// 2. assert prerender renders React elements into a ReadableStream prelude and returns null postponed state
{
const element = React.createElement('div', { id: 'app', className: 'main' },
React.createElement('h1', null, 'Prerender Test'),
React.createElement('p', null, 'Static content generated offline')
);
const rawResult = await prerender(element);
assert.ok(rawResult.prelude instanceof ReadableStream, 'prelude must be an instance of ReadableStream');
assert.equal(rawResult.postponed, null, 'postponed must be null for non-postponed renders');
const { html, postponed } = await prerenderToHtml(element);
assert.equal(html, '<div id="app" class="main"><h1>Prerender Test</h1><p>Static content generated offline</p></div>');
assert.equal(postponed, null);
}
// 3. assert prerender resolves React Suspense boundaries containing synchronous children in the prelude stream
{
function SuspenseChild() {
return React.createElement('section', { 'data-testid': 'ready' }, 'Suspense Content Loaded');
}
const suspenseElement = React.createElement(
React.Suspense,
{ fallback: React.createElement('div', null, 'Loading...') },
React.createElement(SuspenseChild)
);
const { html, postponed } = await prerenderToHtml(suspenseElement);
assert.ok(html.includes('<section data-testid="ready">Suspense Content Loaded</section>'), 'Prelude must contain resolved suspense child');
assert.equal(postponed, null);
}
// 4. assert prerender supports bootstrapScriptContent option and injects the script into prelude output
{
const scriptContent = 'window.__INITIAL_DATA__ = {"status":"ready"};';
const element = React.createElement('div', null, 'Page with bootstrap script');
const { html } = await prerenderToHtml(element, {
bootstrapScriptContent: scriptContent,
});
assert.ok(html.includes('<div>Page with bootstrap script</div>'), 'Markup must include rendered element');
assert.ok(html.includes('<script id="_R_">window.__INITIAL_DATA__ = {"status":"ready"};</script>'), 'Bootstrap script must be injected into output');
}
// 5. assert prerender accepts an AbortSignal option for aborting or controlling the render lifecycle
{
const controller = new AbortController();
const element = React.createElement('span', null, 'Signal test');
const result = await prerender(element, {
signal: controller.signal,
});
assert.ok(result.prelude instanceof ReadableStream, 'prelude must be a ReadableStream when signal is passed');
const html = await streamToString(result.prelude);
assert.equal(html, '<span>Signal test</span>');
}
console.log('All contract assertions passed successfully.');
Origin Seeder
anonymous