Ejemplo
react-is 19.2.8: Memo
Muestra verificada para npm react-is 19.2.8: Memo. El contrato se ejecutó en node 22 · linux debian/x64 · docker y pasó: Memo exports the react.memo symbol…
sha256:e3630386dc7b98f0749dc2dbf3b5565de2f7cd6ff6e4fb6847174d395c428712
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 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.Memo in pkg:npm/react-is@19.2.8
- Paquetes
- Símbolos
-
- react-is.Memo
- Creado
- 2026-09-06T05:13:50Z
Contrato
- Memo exports the react.memo symbol identifier in React 19
- isMemo returns true for React 19 transitional elements wrapping memo component types
- typeOf returns Memo symbol for valid memo elements
- isMemo returns false for React 18 legacy element symbols
- isMemo returns false for unmounted memo component definition objects
- isValidElementType recognizes memo component definitions
- isMemo returns false for standard DOM elements and primitives
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 react-is.Memo 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.Memo
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:a34b00df2c13bcdaf7b6020641adf0fa12c317ef7d9d28604382190bce59af69","contract":["Memo exports the react.memo symbol identifier in React 19","isMemo returns true for React 19 transitional elements wrapping memo component types","typeOf returns Memo symbol for valid memo elements","isMemo returns false for React 18 legacy element symbols","isMemo returns false for unmounted memo component definition objects","isValidElementType recognizes memo component definitions","isMemo returns false for standard DOM elements and primitives"],"goal":"verify react-is.Memo in pkg:npm/react-is@19.2.8","kind":"HOW","packages":["pkg:npm/react-is@19.2.8"],"schemaVersion":1,"symbols":["react-is.Memo"]},"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@19.2.8"],"schemaVersion":1,"subject":"pkg:npm/react-is@19.2.8","symbols":["react-is.Memo"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-react-is-memo",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-react-is-memo",
"version": "1.0.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-memo",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of react-is.Memo in React 19",
"type": "module",
"main": "src/index.js",
"dependencies": {
"react-is": "19.2.8"
}
}
{
"schemaVersion": 1,
"goal": "verify react-is.Memo in pkg:npm/react-is@19.2.8",
"kind": "HOW",
"packages": [
"pkg:npm/react-is@19.2.8"
],
"symbols": [
"react-is.Memo"
]
}
import { Memo, isMemo, typeOf, isValidElementType } from 'react-is';
/**
* Symbol used by React 19 for transitional elements.
*/
export const REACT_TRANSITIONAL_ELEMENT_TYPE = Symbol.for('react.transitional.element');
/**
* Legacy Symbol used by React 18 and earlier for elements.
*/
export const REACT_LEGACY_ELEMENT_TYPE = Symbol.for('react.element');
/**
* Check if the provided value is a React memo element using react-is.
*
* @param {*} value - Value to inspect.
* @returns {boolean} True if the value is a memo element.
*/
export function checkIsMemo(value) {
return isMemo(value);
}
/**
* Check if the provided value is a valid memo component definition.
*
* @param {*} value - Value to inspect.
* @returns {boolean} True if the value is a valid memo component type.
*/
export function checkIsValidMemoType(value) {
return (
typeof value === 'object' &&
value !== null &&
value.$$typeof === Memo &&
isValidElementType(value)
);
}
/**
* Create a mock React 19 transitional element wrapping a memo component.
*
* @param {Function} [renderFn] - Inner render component.
* @returns {object} Mock transitional element.
*/
export function createTransitionalMemoElement(renderFn = () => null) {
const memoType = {
$$typeof: Memo,
type: renderFn,
compare: null,
};
return {
$$typeof: REACT_TRANSITIONAL_ELEMENT_TYPE,
type: memoType,
props: {},
key: null,
ref: null,
};
}
/**
* Create a mock legacy element wrapping a memo component.
*
* @param {Function} [renderFn] - Inner render component.
* @returns {object} Mock legacy element.
*/
export function createLegacyMemoElement(renderFn = () => null) {
const memoType = {
$$typeof: Memo,
type: renderFn,
compare: null,
};
return {
$$typeof: REACT_LEGACY_ELEMENT_TYPE,
type: memoType,
props: {},
key: null,
ref: null,
};
}
export {
Memo,
isMemo,
typeOf,
isValidElementType,
};
import assert from 'node:assert/strict';
import {
Memo,
isMemo,
typeOf,
isValidElementType,
REACT_TRANSITIONAL_ELEMENT_TYPE,
REACT_LEGACY_ELEMENT_TYPE,
checkIsMemo,
checkIsValidMemoType,
createTransitionalMemoElement,
createLegacyMemoElement,
} from '../src/index.js';
// 1. Symbol and Function exports verification
assert.equal(typeof Memo, 'symbol', 'Memo should export a symbol');
assert.equal(Memo, Symbol.for('react.memo'), 'Memo must match Symbol.for("react.memo")');
assert.equal(typeof isMemo, 'function', 'isMemo should be a function');
assert.equal(typeof typeOf, 'function', 'typeOf should be a function');
assert.equal(typeof isValidElementType, 'function', 'isValidElementType should be a function');
assert.equal(typeof checkIsMemo, 'function', 'checkIsMemo helper should be a function');
assert.equal(typeof checkIsValidMemoType, 'function', 'checkIsValidMemoType helper should be a function');
// 2. React 19 Transitional Memo Element verification
const transitionalMemoElem = createTransitionalMemoElement(() => null);
assert.equal(isMemo(transitionalMemoElem), true, 'isMemo must return true for React 19 transitional memo elements');
assert.equal(checkIsMemo(transitionalMemoElem), true, 'checkIsMemo helper must return true for React 19 transitional memo elements');
assert.equal(typeOf(transitionalMemoElem), Memo, 'typeOf must return Memo symbol for valid memo elements');
// 3. React 18 / Legacy Memo Element verification
const legacyMemoElem = createLegacyMemoElement(() => null);
assert.equal(isMemo(legacyMemoElem), false, 'React 19 react-is does not match legacy react.element symbol for isMemo');
assert.notEqual(typeOf(legacyMemoElem), Memo, 'typeOf does not return Memo for legacy react.element symbols');
// 4. Raw Memo Component Type Object (unmounted definition) verification
const rawMemoComponent = {
$$typeof: Memo,
type: () => null,
compare: null,
};
assert.equal(isMemo(rawMemoComponent), false, 'isMemo must return false for raw memo component definitions without element envelope');
assert.equal(isValidElementType(rawMemoComponent), true, 'isValidElementType must recognize raw memo component definitions');
assert.equal(checkIsValidMemoType(rawMemoComponent), true, 'checkIsValidMemoType helper must return true for valid memo component types');
// 5. Negative assertions for non-memo elements and invalid values
const plainTransitionalElement = {
$$typeof: REACT_TRANSITIONAL_ELEMENT_TYPE,
type: 'div',
props: {},
key: null,
ref: null,
};
assert.equal(isMemo(plainTransitionalElement), false, 'plain transitional element is not a memo element');
assert.equal(isMemo(null), false, 'null is not a memo element');
assert.equal(isMemo(undefined), false, 'undefined is not a memo element');
assert.equal(isMemo({}), false, 'empty object is not a memo element');
assert.equal(isMemo('div'), false, 'primitive string is not a memo element');
assert.equal(isMemo(123), false, 'primitive number is not a memo element');
assert.equal(isMemo(() => null), false, 'plain function component is not a memo element');
assert.equal(isMemo(Memo), false, 'Memo symbol itself is not a memo element');
// 6. isValidElementType negative checks
assert.equal(isValidElementType(null), false, 'isValidElementType returns false for null');
assert.equal(isValidElementType(undefined), false, 'isValidElementType returns false for undefined');
assert.equal(isValidElementType(Memo), false, 'isValidElementType returns false for raw Memo symbol');
console.log('Contract tests passed successfully.');
Seeder de origen
anónimo