CodeSampleX

Ejemplo

@types/react-dom 19.2.4

Muestra verificada para npm @types/react-dom 19.2.4. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó: @types/react-dom package.json…

sha256:5a92fdbb03f0475daa474f879c12afd8897daa4aa9b0d1d27e4b5c0989c6ee04

Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido. Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas. MIT-0

Evidencia de ejecución

El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.

Base de evidencia
Contrato firmado aprobado
Recibos de verificación
2
Claves de firma que lo compilaron
1
Entorno declarado linux 24 · ubuntu · glibc 2.39 x64 npm

Entornos de las ejecuciones de verificación

Entorno Contrato Etapas Ejecución
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-23
node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2…
2026-09-07

Caso

HOW
Objetivo
verify pkg:npm/%40types/react-dom@19.2.4
Paquetes
Creado
2026-08-23T15:07:15Z

Contrato

  1. @types/react-dom package.json declares type definitions entry point index.d.ts, version 19.2.4, and subpath exports for client, server, and static entrypoints
  2. index.d.ts declaration file declares core React DOM 19 APIs including createPortal, flushSync, useFormStatus, and useFormState
  3. index.d.ts declares resource preloading and preinitialization APIs including preload, prefetchDNS, preconnect, and preinit
  4. client.d.ts declaration file declares createRoot, hydrateRoot, and client root management interfaces
  5. server.d.ts declaration file declares streaming and static rendering functions including renderToPipeableStream and renderToReadableStream
  6. static.d.ts declaration file declares React 19 static prerendering functions including prerender and prerenderToNodeStream
  7. Helper inspection module loads and verifies all React DOM 19 type declaration files and exported signature structures

Archivos

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.mjs
  • test/contract.mjs

Descargar el artefacto de código fuente (tar.gz)

Código fuente

PROMPT.md
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 pkg:npm/%40types/react-dom@19.2.4
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40types/react-dom@19.2.4

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.
csx.json
{"case":{"caseId":"case:sha256:a96a04435447a02091f3884dc18b7deeb030dd29371772bf9f6fc6135ed592b7","contract":["@types/react-dom package.json declares type definitions entry point index.d.ts, version 19.2.4, and subpath exports for client, server, and static entrypoints","index.d.ts declaration file declares core React DOM 19 APIs including createPortal, flushSync, useFormStatus, and useFormState","index.d.ts declares resource preloading and preinitialization APIs including preload, prefetchDNS, preconnect, and preinit","client.d.ts declaration file declares createRoot, hydrateRoot, and client root management interfaces","server.d.ts declaration file declares streaming and static rendering functions including renderToPipeableStream and renderToReadableStream","static.d.ts declaration file declares React 19 static prerendering functions including prerender and prerenderToNodeStream","Helper inspection module loads and verifies all React DOM 19 type declaration files and exported signature structures"],"goal":"verify pkg:npm/%40types/react-dom@19.2.4","kind":"HOW","packages":["pkg:npm/%40types/react-dom@19.2.4"],"schemaVersion":1},"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/%40types/react-dom@19.2.4"],"schemaVersion":1,"subject":"pkg:npm/%40types/react-dom@19.2.4","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-react-dom-types",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-react-dom-types",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "@types/react-dom": "19.2.4"
      }
    },
    "node_modules/@types/react": {
      "version": "19.2.18",
      "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.18.tgz",
      "integrity": "sha512-AnzbBERsrLKtk2XSfTbYRLjQPdy116Sty4q+T+Bp3IC4l6jNBvreVPAHmpq9qhXQM7CXZPjLVmGMw9sy+hxQ3w==",
      "license": "MIT",
      "peer": true,
      "dependencies": {
        "csstype": "^3.2.2"
      }
    },
    "node_modules/@types/react-dom": {
      "version": "19.2.4",
      "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.4.tgz",
      "integrity": "sha512-Bsc+QHgp+P/F02XDzNCY9jnZNCUuLki36KT7VKrTXXLdHf+vHMNZnW1rVu5DNW/rCK+fya3DATySbLM4yhtKUw==",
      "license": "MIT",
      "peerDependencies": {
        "@types/react": "^19.2.0"
      }
    },
    "node_modules/csstype": {
      "version": "3.2.3",
      "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
      "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
      "license": "MIT",
      "peer": true
    }
  }
}
package.json
{
  "name": "sample-react-dom-types",
  "version": "1.0.0",
  "private": true,
  "license": "MIT-0",
  "dependencies": {
    "@types/react-dom": "19.2.4"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40types/react-dom@19.2.4",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40types/react-dom@19.2.4"
  ]
}
src/index.mjs
import fs from 'node:fs';
import path from 'node:path';
import { createRequire } from 'node:module';

const require = createRequire(import.meta.url);

/**
 * Returns the absolute directory path of the installed @types/react-dom package.
 * @returns {string} Directory path
 */
export function getReactDomTypesDir() {
  const pkgPath = require.resolve('@types/react-dom/package.json');
  return path.dirname(pkgPath);
}

/**
 * Resolves the path to a declaration or resource file in @types/react-dom.
 * @param {string} [subPath='index.d.ts'] - Relative declaration file path
 * @returns {string} Absolute path to declaration file
 */
export function getDeclarationPath(subPath = 'index.d.ts') {
  return path.join(getReactDomTypesDir(), subPath);
}

/**
 * Loads the text content of a declaration file in @types/react-dom.
 * @param {string} [subPath='index.d.ts'] - Relative declaration file path
 * @returns {string} Text content of the declaration file
 */
export function loadDeclarationContent(subPath = 'index.d.ts') {
  const declPath = getDeclarationPath(subPath);
  return fs.readFileSync(declPath, 'utf8');
}

/**
 * Inspects core React DOM TypeScript declaration signatures across entry points.
 * @returns {object} Summary of discovered type definitions
 */
export function inspectTypeDefinitions() {
  const indexContent = loadDeclarationContent('index.d.ts');
  const clientContent = loadDeclarationContent('client.d.ts');
  const serverContent = loadDeclarationContent('server.d.ts');
  const staticContent = loadDeclarationContent('static.d.ts');

  return {
    index: {
      hasCreatePortal: indexContent.includes('function createPortal('),
      hasFlushSync: indexContent.includes('function flushSync<R>('),
      hasUnstableBatchedUpdates: indexContent.includes('function unstable_batchedUpdates<'),
      hasUseFormStatus: indexContent.includes('function useFormStatus(): FormStatus;'),
      hasUseFormState: indexContent.includes('function useFormState<State>('),
      hasPrefetchDNS: indexContent.includes('function prefetchDNS('),
      hasPreconnect: indexContent.includes('function preconnect('),
      hasPreload: indexContent.includes('function preload('),
      hasPreloadModule: indexContent.includes('function preloadModule('),
      hasPreinit: indexContent.includes('function preinit('),
      hasPreinitModule: indexContent.includes('function preinitModule('),
      hasRequestFormReset: indexContent.includes('function requestFormReset('),
      hasVersionConst: indexContent.includes('const version: string;')
    },
    client: {
      hasCreateRoot: clientContent.includes('function createRoot('),
      hasHydrateRoot: clientContent.includes('function hydrateRoot('),
      hasRootInterface: clientContent.includes('interface Root {'),
      hasRootOptionsInterface: clientContent.includes('interface RootOptions {'),
      hasHydrationOptionsInterface: clientContent.includes('interface HydrationOptions {')
    },
    server: {
      hasRenderToString: serverContent.includes('function renderToString('),
      hasRenderToStaticMarkup: serverContent.includes('function renderToStaticMarkup('),
      hasRenderToPipeableStream: serverContent.includes('function renderToPipeableStream('),
      hasRenderToReadableStream: serverContent.includes('function renderToReadableStream(')
    },
    static: {
      hasPrerenderToNodeStream: staticContent.includes('function prerenderToNodeStream('),
      hasPrerender: staticContent.includes('function prerender(')
    }
  };
}
test/contract.mjs
import assert from 'node:assert/strict';
import fs from 'node:fs';
import { createRequire } from 'node:module';
import {
  getReactDomTypesDir,
  getDeclarationPath,
  loadDeclarationContent,
  inspectTypeDefinitions
} from '../src/index.mjs';

const require = createRequire(import.meta.url);

// Contract 1: @types/react-dom package.json declares type definitions entry point index.d.ts, version 19.2.4, and subpath exports for client, server, and static entrypoints
{
  const pkgJson = require('@types/react-dom/package.json');
  assert.equal(pkgJson.name, '@types/react-dom');
  assert.equal(pkgJson.version, '19.2.4');
  assert.equal(pkgJson.types, 'index.d.ts');
  assert.ok(pkgJson.exports['.']);
  assert.ok(pkgJson.exports['./client']);
  assert.ok(pkgJson.exports['./server']);
  assert.ok(pkgJson.exports['./static']);
  assert.ok(pkgJson.peerDependencies['@types/react']);
}

// Contract 2: index.d.ts declaration file declares core React DOM 19 APIs including createPortal, flushSync, useFormStatus, and useFormState
{
  const indexContent = loadDeclarationContent('index.d.ts');
  assert.ok(indexContent.includes('function createPortal('));
  assert.ok(indexContent.includes('function flushSync<R>('));
  assert.ok(indexContent.includes('function useFormStatus(): FormStatus;'));
  assert.ok(indexContent.includes('function useFormState<State>('));
  assert.ok(indexContent.includes('interface FormStatusPending'));
  assert.ok(indexContent.includes('interface FormStatusNotPending'));
}

// Contract 3: index.d.ts declares resource preloading and preinitialization APIs including preload, prefetchDNS, preconnect, and preinit
{
  const indexContent = loadDeclarationContent('index.d.ts');
  assert.ok(indexContent.includes('function prefetchDNS('));
  assert.ok(indexContent.includes('function preconnect('));
  assert.ok(indexContent.includes('function preload('));
  assert.ok(indexContent.includes('function preloadModule('));
  assert.ok(indexContent.includes('function preinit('));
  assert.ok(indexContent.includes('function preinitModule('));
  assert.ok(indexContent.includes('function requestFormReset('));
}

// Contract 4: client.d.ts declaration file declares createRoot, hydrateRoot, and client root management interfaces
{
  const clientPath = getDeclarationPath('client.d.ts');
  assert.ok(fs.existsSync(clientPath));
  const clientContent = loadDeclarationContent('client.d.ts');
  assert.ok(clientContent.includes('function createRoot('));
  assert.ok(clientContent.includes('function hydrateRoot('));
  assert.ok(clientContent.includes('interface Root {'));
  assert.ok(clientContent.includes('interface RootOptions {'));
  assert.ok(clientContent.includes('interface HydrationOptions {'));
}

// Contract 5: server.d.ts declaration file declares streaming and static rendering functions including renderToPipeableStream and renderToReadableStream
{
  const serverPath = getDeclarationPath('server.d.ts');
  assert.ok(fs.existsSync(serverPath));
  const serverContent = loadDeclarationContent('server.d.ts');
  assert.ok(serverContent.includes('function renderToString('));
  assert.ok(serverContent.includes('function renderToStaticMarkup('));
  assert.ok(serverContent.includes('function renderToPipeableStream('));
  assert.ok(serverContent.includes('function renderToReadableStream('));
}

// Contract 6: static.d.ts declaration file declares React 19 static prerendering functions including prerender and prerenderToNodeStream
{
  const staticPath = getDeclarationPath('static.d.ts');
  assert.ok(fs.existsSync(staticPath));
  const staticContent = loadDeclarationContent('static.d.ts');
  assert.ok(staticContent.includes('function prerenderToNodeStream('));
  assert.ok(staticContent.includes('function prerender('));
}

// Contract 7: Helper inspection module loads and verifies all React DOM 19 type declaration files and exported signature structures
{
  const inspection = inspectTypeDefinitions();
  assert.equal(inspection.index.hasCreatePortal, true);
  assert.equal(inspection.index.hasFlushSync, true);
  assert.equal(inspection.index.hasUseFormStatus, true);
  assert.equal(inspection.index.hasUseFormState, true);
  assert.equal(inspection.index.hasPrefetchDNS, true);
  assert.equal(inspection.index.hasPreconnect, true);
  assert.equal(inspection.index.hasPreload, true);
  assert.equal(inspection.index.hasPreloadModule, true);
  assert.equal(inspection.index.hasPreinit, true);
  assert.equal(inspection.index.hasPreinitModule, true);
  assert.equal(inspection.index.hasRequestFormReset, true);
  assert.equal(inspection.client.hasCreateRoot, true);
  assert.equal(inspection.client.hasHydrateRoot, true);
  assert.equal(inspection.client.hasRootInterface, true);
  assert.equal(inspection.server.hasRenderToString, true);
  assert.equal(inspection.server.hasRenderToStaticMarkup, true);
  assert.equal(inspection.server.hasRenderToPipeableStream, true);
  assert.equal(inspection.server.hasRenderToReadableStream, true);
  assert.equal(inspection.static.hasPrerenderToNodeStream, true);
  assert.equal(inspection.static.hasPrerender, true);
}

console.log('All @types/react-dom contract tests passed successfully.');

Seeder de origen

anónimo