Ejemplo
react-is 19.2.8: isFragment
Muestra verificada para npm react-is 19.2.8: isFragment. El contrato se ejecutó en node 22 · linux debian/x64 · docker y pasó.
sha256:5e0f970f1cba079aca3eb3769a37f42daeea806771d83f79d338cb65978e16cd
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
- 1
- Claves de firma que lo compilaron
- 1
Entorno declarado
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| 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-06 |
Caso
HOW- Objetivo
- verify react-is.isFragment in pkg:npm/react-is@19.2.8
- Paquetes
- Símbolos
-
- react-is.isFragment
- Entorno
- node 22.23.2
- Creado
- 2026-09-06T15:43:59Z
Contrato
- isFragment returns true for React 19 transitional elements whose type is React Fragment
- isFragment returns false for bare React Fragment type symbol without an element wrapper
- isFragment returns false for legacy react.element tagged elements not using transitional element tag
- isFragment returns false for standard DOM elements, non-fragment elements, non-element objects, and primitives
Archivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- test/contract.mjs
Código fuente
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 react-is.isFragment in pkg:npm/react-is@19.2.8
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/react-is@19.2.8
Demonstrate these symbols/APIs:
- react-is.isFragment
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.
{"case":{"caseId":"case:sha256:65a41fde3e3dcd54442866e63eaa1cc948b05b69432b3aa373d91c59c6909173","constraints":{"executionContext":"node"},"contract":["isFragment returns true for React 19 transitional elements whose type is React Fragment","isFragment returns false for bare React Fragment type symbol without an element wrapper","isFragment returns false for legacy react.element tagged elements not using transitional element tag","isFragment returns false for standard DOM elements, non-fragment elements, non-element objects, and primitives"],"goal":"verify react-is.isFragment in pkg:npm/react-is@19.2.8","kind":"HOW","packages":["pkg:npm/react-is@19.2.8"],"schemaVersion":1,"symbols":["react-is.isFragment"]},"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/react-is@19.2.8"],"schemaVersion":1,"subject":"pkg:npm/react-is@19.2.8","symbols":["react-is.isFragment"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-react-is-fragment",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-react-is-fragment",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"react-is": "19.2.8"
}
},
"node_modules/react-is": {
"version": "19.2.8",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.8.tgz",
"integrity": "sha512-s5un28nYxKJw5gvUHyW5PCC28CvBqLu9r3cWgzHT4Vo/5fqqkFcdRYsGcKf50WMPpjjFZS5d76fn3YCo2njKwQ==",
"license": "MIT"
}
}
}
{
"name": "sample-react-is-fragment",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of react-is.isFragment for React 19",
"type": "module",
"main": "src/index.mjs",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"react-is": "19.2.8"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify react-is.isFragment in pkg:npm/react-is@19.2.8",
"kind": "HOW",
"packages": [
"pkg:npm/react-is@19.2.8"
],
"symbols": [
"react-is.isFragment"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import { isFragment, Fragment, Element, typeOf } from 'react-is';
/**
* Check if the given value is a React Fragment element.
*
* @param {*} value - The value to inspect.
* @returns {boolean} True if the value is a React Fragment element.
*/
export function checkIsFragment(value) {
return isFragment(value);
}
/**
* Create a mock React 19 element with the specified type, props, and transitional element marker.
*
* @param {*} type - The element type (e.g. Fragment, string tag, component).
* @param {object} [props={}] - Optional props object.
* @returns {object} Mock React element object.
*/
export function createMockElement(type, props = {}) {
return {
$$typeof: Element,
type,
props,
key: null,
ref: null,
};
}
/**
* Create a mock React 19 Fragment element.
*
* @param {object} [props={}] - Optional props object.
* @returns {object} Mock React Fragment element object.
*/
export function createMockFragment(props = {}) {
return createMockElement(Fragment, props);
}
export { isFragment, Fragment, Element, typeOf };
import assert from 'node:assert/strict';
import {
checkIsFragment,
createMockElement,
createMockFragment,
isFragment,
Fragment,
Element,
typeOf,
} from '../src/index.mjs';
// 1. isFragment returns true for React 19 transitional elements whose type is React Fragment
{
const fragmentElement = createMockFragment({ children: ['Hello', 'World'] });
assert.equal(
isFragment(fragmentElement),
true,
'isFragment must return true for React 19 Fragment element'
);
assert.equal(
checkIsFragment(fragmentElement),
true,
'checkIsFragment helper must return true for React 19 Fragment element'
);
const symbolForFragment = {
$$typeof: Symbol.for('react.transitional.element'),
type: Symbol.for('react.fragment'),
props: {},
key: null,
ref: null,
};
assert.equal(
isFragment(symbolForFragment),
true,
'isFragment must return true for element with global Symbol.for keys'
);
}
// 2. isFragment returns false for bare React Fragment type symbol without an element wrapper
{
assert.equal(
isFragment(Fragment),
false,
'isFragment must return false for bare Fragment symbol'
);
assert.equal(
checkIsFragment(Fragment),
false,
'checkIsFragment helper must return false for bare Fragment symbol'
);
assert.equal(
isFragment(Symbol.for('react.fragment')),
false,
'isFragment must return false for Symbol.for("react.fragment")'
);
}
// 3. isFragment returns false for legacy react.element tagged elements not using transitional element tag
{
const legacyFragment = {
$$typeof: Symbol.for('react.element'),
type: Fragment,
props: {},
key: null,
ref: null,
};
assert.equal(
isFragment(legacyFragment),
false,
'isFragment in React 19 must return false for legacy react.element tag'
);
assert.equal(
checkIsFragment(legacyFragment),
false,
'checkIsFragment helper must return false for legacy react.element tag'
);
}
// 4. isFragment returns false for standard DOM elements, non-fragment elements, non-element objects, and primitives
{
// Standard DOM element
const domElement = createMockElement('div', { className: 'container' });
assert.equal(isFragment(domElement), false, 'isFragment must return false for standard DOM element');
// React elements with other types
const suspenseElement = createMockElement(Symbol.for('react.suspense'), { fallback: null });
assert.equal(isFragment(suspenseElement), false, 'isFragment must return false for suspense element');
const plainFnElement = createMockElement(() => null);
assert.equal(isFragment(plainFnElement), false, 'isFragment must return false for function component element');
// Incomplete / non-element objects and primitives
assert.equal(isFragment({}), false, 'isFragment must return false for plain empty object');
assert.equal(isFragment({ $$typeof: Element }), false, 'isFragment must return false for element missing type');
assert.equal(isFragment(null), false, 'isFragment must return false for null');
assert.equal(isFragment(undefined), false, 'isFragment must return false for undefined');
assert.equal(isFragment('<div></div>'), false, 'isFragment must return false for string');
assert.equal(isFragment(42), false, 'isFragment must return false for number');
assert.equal(isFragment(true), false, 'isFragment must return false for boolean');
assert.equal(isFragment(Element), false, 'isFragment must return false for Element symbol');
}
console.log('Contract tests for react-is.isFragment (pkg:npm/react-is@19.2.8) passed successfully.');
Seeder de origen
anónimo