CodeSampleX

Beispiel

@types/react-dom 19.2.4: types

Verifiziertes Beispiel für npm @types/react-dom 19.2.4: types. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand.

sha256:20407b89528e5a49b984b147008a9bfeae4081eb938c5fb3eda01e6945795d14

Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen. Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen. MIT-0

Ausführungsbelege

Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.

Beleggrundlage
Signierter Vertrag bestanden
Verifizierungsbelege
2
Signaturschlüssel, die es gebaut haben
1
Deklarierte Umgebung node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
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
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

Fall

HOW
Ziel
verify @types/react-dom.types in pkg:npm/%40types/react-dom@19.2.4
Pakete
Symbole
  • @types/react-dom.types
Umgebung
node 22.23.2
Erstellt
2026-08-26T12:42:09Z

Contract

  1. @types/react-dom package.json defines types field pointing to index.d.ts and version 19.2.4
  2. @types/react-dom package exports declare TypeScript definition subpaths for client, server, static, canary, and experimental modules
  3. index.d.ts declares core DOM functions and hook state types including createPortal, flushSync, useFormStatus, and useFormState
  4. client.d.ts declares client rendering root functions createRoot and hydrateRoot along with Root and HydrationOptions interfaces
  5. server.d.ts and static.d.ts declare server streaming and prerendering APIs including renderToPipeableStream, renderToReadableStream, and prerender
  6. Inspection helpers correctly verify type declaration files existence and symbol content integrity

Dateien

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

Quellartefakt herunterladen (tar.gz)

Quelltext

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 @types/react-dom.types in 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
Demonstrate these symbols/APIs:
  - @types/react-dom.types
Constraints:
  - executionContext: node
Required runtime conditions:
  - ecosystem: npm
  - language: javascript
  - moduleSystem: cjs
  - packageManager: npm@10.9.8
  - runtime: node@22.23.2

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:d91e0f278ac4c353c254629ddc469fc77eeb4eae8d2a4f1e8141280169a209fc","constraints":{"executionContext":"node"},"contract":["@types/react-dom package.json defines types field pointing to index.d.ts and version 19.2.4","@types/react-dom package exports declare TypeScript definition subpaths for client, server, static, canary, and experimental modules","index.d.ts declares core DOM functions and hook state types including createPortal, flushSync, useFormStatus, and useFormState","client.d.ts declares client rendering root functions createRoot and hydrateRoot along with Root and HydrationOptions interfaces","server.d.ts and static.d.ts declare server streaming and prerendering APIs including renderToPipeableStream, renderToReadableStream, and prerender","Inspection helpers correctly verify type declaration files existence and symbol content integrity"],"goal":"verify @types/react-dom.types in pkg:npm/%40types/react-dom@19.2.4","kind":"HOW","packages":["pkg:npm/%40types/react-dom@19.2.4"],"schemaVersion":1,"symbols":["@types/react-dom.types"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","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","symbols":["@types/react-dom.types"],"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 @types/react-dom.types in pkg:npm/%40types/react-dom@19.2.4",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40types/react-dom@19.2.4"
  ],
  "symbols": [
    "@types/react-dom.types"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
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 package directory for @types/react-dom.
 * @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 file in @types/react-dom.
 * @param {string} [subPath='index.d.ts'] - Declaration relative file path
 * @returns {string} Absolute path to declaration file
 */
export function getDeclarationPath(subPath = 'index.d.ts') {
  return path.join(getReactDomTypesDir(), subPath);
}

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

/**
 * Validates package.json type definition metadata for @types/react-dom.
 * @returns {object} Manifest types metadata summary
 */
export function inspectPackageTypesMetadata() {
  const pkgJson = require('@types/react-dom/package.json');
  return {
    name: pkgJson.name,
    version: pkgJson.version,
    types: pkgJson.types,
    hasMainTypes: pkgJson.types === 'index.d.ts',
    exports: pkgJson.exports,
    hasClientExport: Boolean(pkgJson.exports && pkgJson.exports['./client']),
    hasServerExport: Boolean(pkgJson.exports && pkgJson.exports['./server']),
    hasStaticExport: Boolean(pkgJson.exports && pkgJson.exports['./static']),
    hasCanaryExport: Boolean(pkgJson.exports && pkgJson.exports['./canary']),
    hasExperimentalExport: Boolean(pkgJson.exports && pkgJson.exports['./experimental']),
    hasTestUtilsExport: Boolean(pkgJson.exports && pkgJson.exports['./test-utils'])
  };
}

/**
 * Inspects all core TypeScript declaration files for expected symbol declarations.
 * @returns {object} Declared symbol inspection results
 */
export function inspectDeclaredSymbols() {
  const indexContent = readDeclarationContent('index.d.ts');
  const clientContent = readDeclarationContent('client.d.ts');
  const serverContent = readDeclarationContent('server.d.ts');
  const staticContent = readDeclarationContent('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>('),
      hasPreload: indexContent.includes('function preload('),
      hasPreinit: indexContent.includes('function preinit('),
      hasVersion: 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 {
  getReactDomTypesDir,
  getDeclarationPath,
  readDeclarationContent,
  inspectPackageTypesMetadata,
  inspectDeclaredSymbols
} from '../src/index.mjs';

// Contract 1: @types/react-dom package.json defines types field pointing to index.d.ts and version 19.2.4
{
  const metadata = inspectPackageTypesMetadata();
  assert.equal(metadata.name, '@types/react-dom');
  assert.equal(metadata.version, '19.2.4');
  assert.equal(metadata.types, 'index.d.ts');
  assert.equal(metadata.hasMainTypes, true);
}

// Contract 2: @types/react-dom package exports declare TypeScript definition subpaths for client, server, static, canary, and experimental modules
{
  const metadata = inspectPackageTypesMetadata();
  assert.equal(metadata.hasClientExport, true);
  assert.equal(metadata.hasServerExport, true);
  assert.equal(metadata.hasStaticExport, true);
  assert.equal(metadata.hasCanaryExport, true);
  assert.equal(metadata.hasExperimentalExport, true);
  assert.equal(metadata.hasTestUtilsExport, true);
}

// Contract 3: index.d.ts declares core DOM functions and hook state types including createPortal, flushSync, useFormStatus, and useFormState
{
  const indexPath = getDeclarationPath('index.d.ts');
  assert.ok(fs.existsSync(indexPath));
  const content = readDeclarationContent('index.d.ts');
  assert.ok(content.includes('function createPortal('));
  assert.ok(content.includes('function flushSync<R>('));
  assert.ok(content.includes('function useFormStatus(): FormStatus;'));
  assert.ok(content.includes('function useFormState<State>('));
}

// Contract 4: client.d.ts declares client rendering root functions createRoot and hydrateRoot along with Root and HydrationOptions interfaces
{
  const clientPath = getDeclarationPath('client.d.ts');
  assert.ok(fs.existsSync(clientPath));
  const content = readDeclarationContent('client.d.ts');
  assert.ok(content.includes('function createRoot('));
  assert.ok(content.includes('function hydrateRoot('));
  assert.ok(content.includes('interface Root {'));
  assert.ok(content.includes('interface RootOptions {'));
  assert.ok(content.includes('interface HydrationOptions {'));
}

// Contract 5: server.d.ts and static.d.ts declare server streaming and prerendering APIs including renderToPipeableStream, renderToReadableStream, and prerender
{
  const serverPath = getDeclarationPath('server.d.ts');
  const staticPath = getDeclarationPath('static.d.ts');
  assert.ok(fs.existsSync(serverPath));
  assert.ok(fs.existsSync(staticPath));

  const serverContent = readDeclarationContent('server.d.ts');
  assert.ok(serverContent.includes('function renderToString('));
  assert.ok(serverContent.includes('function renderToPipeableStream('));
  assert.ok(serverContent.includes('function renderToReadableStream('));

  const staticContent = readDeclarationContent('static.d.ts');
  assert.ok(staticContent.includes('function prerender('));
  assert.ok(staticContent.includes('function prerenderToNodeStream('));
}

// Contract 6: Inspection helpers correctly verify type declaration files existence and symbol content integrity
{
  const dir = getReactDomTypesDir();
  assert.ok(fs.existsSync(dir));
  const symbols = inspectDeclaredSymbols();
  assert.equal(symbols.index.hasCreatePortal, true);
  assert.equal(symbols.index.hasFlushSync, true);
  assert.equal(symbols.index.hasUseFormStatus, true);
  assert.equal(symbols.index.hasUseFormState, true);
  assert.equal(symbols.client.hasCreateRoot, true);
  assert.equal(symbols.client.hasHydrateRoot, true);
  assert.equal(symbols.server.hasRenderToPipeableStream, true);
  assert.equal(symbols.server.hasRenderToReadableStream, true);
  assert.equal(symbols.static.hasPrerender, true);
  assert.equal(symbols.static.hasPrerenderToNodeStream, true);
}

console.log('Contract tests passed.');

Ursprungs-Seeder

anonym