Ejemplo
react-is 17.0.2: isContextConsumer, isContextProvider, isElement
Muestra verificada para npm react-is 17.0.2: isContextConsumer, isContextProvider, isElement. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y…
sha256:15465abc987389a7f90fd756c6d92ec0a682aac2d872c24b519e661a561bfb82
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
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-27 |
Caso
HOW- Objetivo
- verify pkg:npm/react-is@17.0.2
- Paquetes
- Símbolos
-
- react-is.isContextConsumer
- react-is.isContextProvider
- react-is.isElement
- react-is.isForwardRef
- react-is.isFragment
- react-is.isLazy
- react-is.isMemo
- react-is.isPortal
- react-is.isProfiler
- react-is.isStrictMode
- react-is.isSuspense
- react-is.isValidElementType
- react-is.typeOf
- Creado
- 2026-08-27T14:58:28Z
Contrato
- isElement correctly identifies React element objects and rejects plain objects or primitives
- isValidElementType validates built-in tags, component functions, classes, and React symbols
- isFragment detects React Fragment elements with react.fragment type
- isContextConsumer detects elements created from React Context Consumer types
- isContextProvider detects elements created from React Context Provider types
- isForwardRef detects elements created from react.forward_ref component types
- isLazy detects elements created from react.lazy component types
- isMemo detects elements created from react.memo wrapped components
- isPortal detects React portal objects with react.portal type
- isProfiler detects React profiler elements with react.profiler type
- isStrictMode detects React strict mode elements with react.strict_mode type
- isSuspense detects React suspense elements with react.suspense type
- typeOf returns standard React type symbols for elements or undefined for non-elements
Archivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- 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 pkg:npm/react-is@17.0.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/react-is@17.0.2
Demonstrate these symbols/APIs:
- react-is.isContextConsumer
- react-is.isContextProvider
- react-is.isElement
- react-is.isForwardRef
- react-is.isFragment
- react-is.isLazy
- react-is.isMemo
- react-is.isPortal
- react-is.isProfiler
- react-is.isStrictMode
- react-is.isSuspense
- react-is.isValidElementType
- react-is.typeOf
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:27937eab0cb986add5ecb699b131cc0ed6ce80baef4044405cab38f05e4d30de","contract":["isElement correctly identifies React element objects and rejects plain objects or primitives","isValidElementType validates built-in tags, component functions, classes, and React symbols","isFragment detects React Fragment elements with react.fragment type","isContextConsumer detects elements created from React Context Consumer types","isContextProvider detects elements created from React Context Provider types","isForwardRef detects elements created from react.forward_ref component types","isLazy detects elements created from react.lazy component types","isMemo detects elements created from react.memo wrapped components","isPortal detects React portal objects with react.portal type","isProfiler detects React profiler elements with react.profiler type","isStrictMode detects React strict mode elements with react.strict_mode type","isSuspense detects React suspense elements with react.suspense type","typeOf returns standard React type symbols for elements or undefined for non-elements"],"goal":"verify pkg:npm/react-is@17.0.2","kind":"HOW","packages":["pkg:npm/react-is@17.0.2"],"schemaVersion":1,"symbols":["react-is.isContextConsumer","react-is.isContextProvider","react-is.isElement","react-is.isForwardRef","react-is.isFragment","react-is.isLazy","react-is.isMemo","react-is.isPortal","react-is.isProfiler","react-is.isStrictMode","react-is.isSuspense","react-is.isValidElementType","react-is.typeOf"]},"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-is@17.0.2"],"schemaVersion":1,"subject":"pkg:npm/react-is@17.0.2","symbols":["react-is.isContextConsumer","react-is.isContextProvider","react-is.isElement","react-is.isForwardRef","react-is.isFragment","react-is.isLazy","react-is.isMemo","react-is.isPortal","react-is.isProfiler","react-is.isStrictMode","react-is.isSuspense","react-is.isValidElementType","react-is.typeOf"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-react-is",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-react-is",
"version": "1.0.0",
"dependencies": {
"react-is": "17.0.2"
}
},
"node_modules/react-is": {
"version": "17.0.2",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
"license": "MIT"
}
}
}
{
"name": "sample-react-is",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of react-is 17.0.2 type identification APIs",
"type": "module",
"main": "src/index.js",
"dependencies": {
"react-is": "17.0.2"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/react-is@17.0.2",
"kind": "HOW",
"packages": [
"pkg:npm/react-is@17.0.2"
],
"symbols": [
"react-is.isContextConsumer",
"react-is.isContextProvider",
"react-is.isElement",
"react-is.isForwardRef",
"react-is.isFragment",
"react-is.isLazy",
"react-is.isMemo",
"react-is.isPortal",
"react-is.isProfiler",
"react-is.isStrictMode",
"react-is.isSuspense",
"react-is.isValidElementType",
"react-is.typeOf"
]
}
import {
isContextConsumer,
isContextProvider,
isElement,
isForwardRef,
isFragment,
isLazy,
isMemo,
isPortal,
isProfiler,
isStrictMode,
isSuspense,
isValidElementType,
typeOf,
ContextConsumer,
ContextProvider,
Element,
ForwardRef,
Fragment,
Lazy,
Memo,
Portal,
Profiler,
StrictMode,
Suspense,
} from 'react-is';
/**
* Check if the given value is a valid React element object.
*
* @param {*} value - The value to check.
* @returns {boolean} True if the value is a React element.
*/
export function checkIsElement(value) {
return isElement(value);
}
/**
* Check if the given value is a valid React element type.
*
* @param {*} value - The value to check.
* @returns {boolean} True if the value is a valid element type.
*/
export function checkIsValidElementType(value) {
return isValidElementType(value);
}
/**
* Check if the given value is a React Fragment element.
*
* @param {*} value - The value to check.
* @returns {boolean} True if the value is a Fragment element.
*/
export function checkIsFragment(value) {
return isFragment(value);
}
/**
* Check if the given value is a React Context Consumer element.
*
* @param {*} value - The value to check.
* @returns {boolean} True if the value is a Context Consumer element.
*/
export function checkIsContextConsumer(value) {
return isContextConsumer(value);
}
/**
* Check if the given value is a React Context Provider element.
*
* @param {*} value - The value to check.
* @returns {boolean} True if the value is a Context Provider element.
*/
export function checkIsContextProvider(value) {
return isContextProvider(value);
}
/**
* Check if the given value is a React ForwardRef element.
*
* @param {*} value - The value to check.
* @returns {boolean} True if the value is a ForwardRef element.
*/
export function checkIsForwardRef(value) {
return isForwardRef(value);
}
/**
* Check if the given value is a React Lazy element.
*
* @param {*} value - The value to check.
* @returns {boolean} True if the value is a Lazy element.
*/
export function checkIsLazy(value) {
return isLazy(value);
}
/**
* Check if the given value is a React Memo element.
*
* @param {*} value - The value to check.
* @returns {boolean} True if the value is a Memo element.
*/
export function checkIsMemo(value) {
return isMemo(value);
}
/**
* Check if the given value is a React Portal object.
*
* @param {*} value - The value to check.
* @returns {boolean} True if the value is a Portal object.
*/
export function checkIsPortal(value) {
return isPortal(value);
}
/**
* Check if the given value is a React Profiler element.
*
* @param {*} value - The value to check.
* @returns {boolean} True if the value is a Profiler element.
*/
export function checkIsProfiler(value) {
return isProfiler(value);
}
/**
* Check if the given value is a React StrictMode element.
*
* @param {*} value - The value to check.
* @returns {boolean} True if the value is a StrictMode element.
*/
export function checkIsStrictMode(value) {
return isStrictMode(value);
}
/**
* Check if the given value is a React Suspense element.
*
* @param {*} value - The value to check.
* @returns {boolean} True if the value is a Suspense element.
*/
export function checkIsSuspense(value) {
return isSuspense(value);
}
/**
* Identify the React element type symbol of a given object.
*
* @param {*} value - The React element to inspect.
* @returns {symbol|undefined} The matched React symbol or undefined.
*/
export function identifyTypeOf(value) {
return typeOf(value);
}
export {
isContextConsumer,
isContextProvider,
isElement,
isForwardRef,
isFragment,
isLazy,
isMemo,
isPortal,
isProfiler,
isStrictMode,
isSuspense,
isValidElementType,
typeOf,
ContextConsumer,
ContextProvider,
Element,
ForwardRef,
Fragment,
Lazy,
Memo,
Portal,
Profiler,
StrictMode,
Suspense,
};
import assert from 'node:assert/strict';
import {
checkIsContextConsumer,
checkIsContextProvider,
checkIsElement,
checkIsForwardRef,
checkIsFragment,
checkIsLazy,
checkIsMemo,
checkIsPortal,
checkIsProfiler,
checkIsStrictMode,
checkIsSuspense,
checkIsValidElementType,
identifyTypeOf,
isContextConsumer,
isContextProvider,
isElement,
isForwardRef,
isFragment,
isLazy,
isMemo,
isPortal,
isProfiler,
isStrictMode,
isSuspense,
isValidElementType,
typeOf,
ContextConsumer,
ContextProvider,
Element,
ForwardRef,
Fragment,
Lazy,
Memo,
Portal,
Profiler,
StrictMode,
Suspense,
} from '../src/index.js';
// 1. Function and constant exports verification
assert.equal(typeof isContextConsumer, 'function', 'isContextConsumer should be a function');
assert.equal(typeof isContextProvider, 'function', 'isContextProvider should be a function');
assert.equal(typeof isElement, 'function', 'isElement should be a function');
assert.equal(typeof isForwardRef, 'function', 'isForwardRef should be a function');
assert.equal(typeof isFragment, 'function', 'isFragment should be a function');
assert.equal(typeof isLazy, 'function', 'isLazy should be a function');
assert.equal(typeof isMemo, 'function', 'isMemo should be a function');
assert.equal(typeof isPortal, 'function', 'isPortal should be a function');
assert.equal(typeof isProfiler, 'function', 'isProfiler should be a function');
assert.equal(typeof isStrictMode, 'function', 'isStrictMode should be a function');
assert.equal(typeof isSuspense, 'function', 'isSuspense should be a function');
assert.equal(typeof isValidElementType, 'function', 'isValidElementType should be a function');
assert.equal(typeof typeOf, 'function', 'typeOf should be a function');
assert.equal(typeof checkIsContextConsumer, 'function', 'checkIsContextConsumer helper should be a function');
assert.equal(typeof checkIsContextProvider, 'function', 'checkIsContextProvider helper should be a function');
assert.equal(typeof checkIsElement, 'function', 'checkIsElement helper should be a function');
assert.equal(typeof checkIsForwardRef, 'function', 'checkIsForwardRef helper should be a function');
assert.equal(typeof checkIsFragment, 'function', 'checkIsFragment helper should be a function');
assert.equal(typeof checkIsLazy, 'function', 'checkIsLazy helper should be a function');
assert.equal(typeof checkIsMemo, 'function', 'checkIsMemo helper should be a function');
assert.equal(typeof checkIsPortal, 'function', 'checkIsPortal helper should be a function');
assert.equal(typeof checkIsProfiler, 'function', 'checkIsProfiler helper should be a function');
assert.equal(typeof checkIsStrictMode, 'function', 'checkIsStrictMode helper should be a function');
assert.equal(typeof checkIsSuspense, 'function', 'checkIsSuspense helper should be a function');
assert.equal(typeof checkIsValidElementType, 'function', 'checkIsValidElementType helper should be a function');
assert.equal(typeof identifyTypeOf, 'function', 'identifyTypeOf helper should be a function');
// 2. Element detection
const plainElement = {
$$typeof: Symbol.for('react.element'),
type: 'div',
props: { className: 'container' },
key: null,
ref: null,
};
assert.equal(isElement(plainElement), true, 'Valid React element must be identified by isElement');
assert.equal(checkIsElement(plainElement), true, 'checkIsElement helper must return true for valid element');
assert.equal(isElement({}), false, 'Empty object is not a React element');
assert.equal(isElement(null), false, 'null is not a React element');
assert.equal(isElement(undefined), false, 'undefined is not a React element');
assert.equal(isElement('div'), false, 'string is not a React element');
// 3. Valid element type detection
assert.equal(isValidElementType('div'), true, 'String tag names are valid element types');
assert.equal(isValidElementType('custom-element'), true, 'Custom elements are valid element types');
assert.equal(isValidElementType(() => null), true, 'Function components are valid element types');
assert.equal(isValidElementType(class {}), true, 'Class components are valid element types');
assert.equal(isValidElementType(Symbol.for('react.fragment')), true, 'Fragment symbol is a valid element type');
assert.equal(isValidElementType(123), false, 'Numbers are not valid element types');
assert.equal(isValidElementType(null), false, 'null is not a valid element type');
// 4. Fragment element detection
const fragmentElement = {
$$typeof: Symbol.for('react.element'),
type: Symbol.for('react.fragment'),
props: { children: [] },
key: null,
ref: null,
};
assert.equal(isFragment(fragmentElement), true, 'Fragment element must be identified by isFragment');
assert.equal(checkIsFragment(fragmentElement), true, 'checkIsFragment helper must return true');
assert.equal(isFragment(plainElement), false, 'div element is not a Fragment');
// 5. Context Consumer detection
const contextConsumerType = {
$$typeof: Symbol.for('react.context'),
};
const contextConsumerElement = {
$$typeof: Symbol.for('react.element'),
type: contextConsumerType,
props: {},
key: null,
ref: null,
};
assert.equal(isContextConsumer(contextConsumerElement), true, 'Context consumer element must be identified by isContextConsumer');
assert.equal(checkIsContextConsumer(contextConsumerElement), true, 'checkIsContextConsumer helper must return true');
assert.equal(isContextConsumer(plainElement), false, 'div element is not a ContextConsumer');
// 6. Context Provider detection
const contextProviderType = {
$$typeof: Symbol.for('react.provider'),
_context: {},
};
const contextProviderElement = {
$$typeof: Symbol.for('react.element'),
type: contextProviderType,
props: {},
key: null,
ref: null,
};
assert.equal(isContextProvider(contextProviderElement), true, 'Context provider element must be identified by isContextProvider');
assert.equal(checkIsContextProvider(contextProviderElement), true, 'checkIsContextProvider helper must return true');
assert.equal(isContextProvider(plainElement), false, 'div element is not a ContextProvider');
// 7. ForwardRef element detection
const forwardRefType = {
$$typeof: Symbol.for('react.forward_ref'),
render: (props, ref) => null,
};
const forwardRefElement = {
$$typeof: Symbol.for('react.element'),
type: forwardRefType,
props: {},
key: null,
ref: null,
};
assert.equal(isForwardRef(forwardRefElement), true, 'ForwardRef element must be identified by isForwardRef');
assert.equal(checkIsForwardRef(forwardRefElement), true, 'checkIsForwardRef helper must return true');
assert.equal(isForwardRef(plainElement), false, 'div element is not a ForwardRef');
// 8. Lazy element detection
const lazyType = {
$$typeof: Symbol.for('react.lazy'),
_init: () => {},
_payload: {},
};
const lazyElement = {
$$typeof: Symbol.for('react.element'),
type: lazyType,
props: {},
key: null,
ref: null,
};
assert.equal(isLazy(lazyElement), true, 'Lazy element must be identified by isLazy');
assert.equal(checkIsLazy(lazyElement), true, 'checkIsLazy helper must return true');
assert.equal(isLazy(plainElement), false, 'div element is not a Lazy element');
// 9. Memo element detection
const memoType = {
$$typeof: Symbol.for('react.memo'),
type: 'span',
compare: null,
};
const memoElement = {
$$typeof: Symbol.for('react.element'),
type: memoType,
props: {},
key: null,
ref: null,
};
assert.equal(isMemo(memoElement), true, 'Memo element must be identified by isMemo');
assert.equal(checkIsMemo(memoElement), true, 'checkIsMemo helper must return true');
assert.equal(isMemo(plainElement), false, 'div element is not a Memo');
// 10. Portal detection
const portalElement = {
$$typeof: Symbol.for('react.portal'),
key: null,
children: [],
containerInfo: {},
};
assert.equal(isPortal(portalElement), true, 'Portal object must be identified by isPortal');
assert.equal(checkIsPortal(portalElement), true, 'checkIsPortal helper must return true');
assert.equal(isPortal(plainElement), false, 'div element is not a Portal');
// 11. Profiler detection
const profilerElement = {
$$typeof: Symbol.for('react.element'),
type: Symbol.for('react.profiler'),
props: { id: 'test-profiler', onRender: () => {} },
key: null,
ref: null,
};
assert.equal(isProfiler(profilerElement), true, 'Profiler element must be identified by isProfiler');
assert.equal(checkIsProfiler(profilerElement), true, 'checkIsProfiler helper must return true');
assert.equal(isProfiler(plainElement), false, 'div element is not a Profiler');
// 12. StrictMode detection
const strictModeElement = {
$$typeof: Symbol.for('react.element'),
type: Symbol.for('react.strict_mode'),
props: { children: [] },
key: null,
ref: null,
};
assert.equal(isStrictMode(strictModeElement), true, 'StrictMode element must be identified by isStrictMode');
assert.equal(checkIsStrictMode(strictModeElement), true, 'checkIsStrictMode helper must return true');
assert.equal(isStrictMode(plainElement), false, 'div element is not a StrictMode');
// 13. Suspense detection
const suspenseElement = {
$$typeof: Symbol.for('react.element'),
type: Symbol.for('react.suspense'),
props: { fallback: null, children: [] },
key: null,
ref: null,
};
assert.equal(isSuspense(suspenseElement), true, 'Suspense element must be identified by isSuspense');
assert.equal(checkIsSuspense(suspenseElement), true, 'checkIsSuspense helper must return true');
assert.equal(isSuspense(plainElement), false, 'div element is not a Suspense');
// 14. typeOf inspection
assert.equal(typeOf(plainElement), Element, 'typeOf(plainElement) must equal Element');
assert.equal(identifyTypeOf(plainElement), Element, 'identifyTypeOf helper must return Element');
assert.equal(typeOf(fragmentElement), Fragment, 'typeOf(fragmentElement) must equal Fragment');
assert.equal(typeOf(contextConsumerElement), ContextConsumer, 'typeOf(contextConsumerElement) must equal ContextConsumer');
assert.equal(typeOf(contextProviderElement), ContextProvider, 'typeOf(contextProviderElement) must equal ContextProvider');
assert.equal(typeOf(forwardRefElement), ForwardRef, 'typeOf(forwardRefElement) must equal ForwardRef');
assert.equal(typeOf(lazyElement), Lazy, 'typeOf(lazyElement) must equal Lazy');
assert.equal(typeOf(memoElement), Memo, 'typeOf(memoElement) must equal Memo');
assert.equal(typeOf(portalElement), Portal, 'typeOf(portalElement) must equal Portal');
assert.equal(typeOf(profilerElement), Profiler, 'typeOf(profilerElement) must equal Profiler');
assert.equal(typeOf(strictModeElement), StrictMode, 'typeOf(strictModeElement) must equal StrictMode');
assert.equal(typeOf(suspenseElement), Suspense, 'typeOf(suspenseElement) must equal Suspense');
assert.equal(typeOf({}), undefined, 'typeOf on non-element must return undefined');
console.log('All contract tests for react-is@17.0.2 passed successfully.');
Seeder de origen
anónimo