Exemple
react-is 19.2.8: isStrictMode
Échantillon vérifié pour npm react-is 19.2.8: isStrictMode. Le contrat s'est exécuté sur node 22 · linux debian/x64 · docker et a réussi.
sha256:b876e042dafe268f239b85cb083039a446ab80a9db67f1662cf205db4c9f3124
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| 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 |
Cas
HOW- Objectif
- verify react-is.isStrictMode in pkg:npm/react-is@19.2.8
- Paquets
- Symboles
-
- react-is.isStrictMode
- Environnement
- node 22.23.2
- Créé
- 2026-09-06T20:01:56Z
Contrat
- isStrictMode correctly identifies React StrictMode elements created with StrictMode type and Element transitional marker
- isStrictMode rejects non-StrictMode React elements such as standard DOM elements and fragments
- isStrictMode rejects non-element objects and objects missing transitional Element marker
- isStrictMode returns false for primitives and falsy values including null, undefined, strings, numbers, and booleans
- isValidElementType confirms StrictMode symbol is a valid React element type
Fichiers
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.mjs
Code source
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.isStrictMode 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.isStrictMode
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:f5631b1238f52f3cc87cd6eafa4eccfe0ce7d41fce0dc95d2ec0135ee4a96146","constraints":{"executionContext":"node"},"contract":["isStrictMode correctly identifies React StrictMode elements created with StrictMode type and Element transitional marker","isStrictMode rejects non-StrictMode React elements such as standard DOM elements and fragments","isStrictMode rejects non-element objects and objects missing transitional Element marker","isStrictMode returns false for primitives and falsy values including null, undefined, strings, numbers, and booleans","isValidElementType confirms StrictMode symbol is a valid React element type"],"goal":"verify react-is.isStrictMode in pkg:npm/react-is@19.2.8","kind":"HOW","packages":["pkg:npm/react-is@19.2.8"],"schemaVersion":1,"symbols":["react-is.isStrictMode"]},"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.isStrictMode"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-react-is-strictmode",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-react-is-strictmode",
"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-strictmode",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of react-is isStrictMode API in react-is 19.2.8",
"main": "src/index.js",
"dependencies": {
"react-is": "19.2.8"
}
}
{
"schemaVersion": 1,
"goal": "verify react-is.isStrictMode in pkg:npm/react-is@19.2.8",
"kind": "HOW",
"packages": [
"pkg:npm/react-is@19.2.8"
],
"symbols": [
"react-is.isStrictMode"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const {
isStrictMode,
StrictMode,
Element,
Fragment,
isElement,
isValidElementType,
typeOf,
} = require('react-is');
/**
* Creates a simulated React StrictMode element for React 19.
*
* In React 19, React elements use the transitional element marker
* (Symbol.for('react.transitional.element') / Element) as $$typeof,
* and StrictMode elements use Symbol.for('react.strict_mode') / StrictMode as type.
*
* @param {Object} [props={}] - Element props.
* @param {Array|*} [children=[]] - Element children.
* @returns {Object} A valid React 19 StrictMode element object.
*/
function createStrictModeElement(props = {}, children = []) {
return {
$$typeof: Element,
type: StrictMode,
props: { ...props, children },
key: null,
ref: null,
};
}
/**
* Creates a simulated standard React DOM element.
*
* @param {string} tag - The DOM tag name.
* @param {Object} [props={}] - Element props.
* @returns {Object} A valid React 19 element object.
*/
function createStandardElement(tag = 'div', props = {}) {
return {
$$typeof: Element,
type: tag,
props,
key: null,
ref: null,
};
}
/**
* Check if a given object is a React StrictMode element.
*
* @param {*} value - The value to inspect.
* @returns {boolean} True if the value is a React StrictMode element, false otherwise.
*/
function checkIsStrictMode(value) {
return isStrictMode(value);
}
/**
* Check if the StrictMode component symbol is considered a valid element type.
*
* @returns {boolean} True if StrictMode is a valid element type.
*/
function checkIsValidStrictModeType() {
return isValidElementType(StrictMode);
}
module.exports = {
createStrictModeElement,
createStandardElement,
checkIsStrictMode,
checkIsValidStrictModeType,
isStrictMode,
StrictMode,
Element,
Fragment,
isElement,
isValidElementType,
typeOf,
};
import assert from 'node:assert/strict';
import indexPkg from '../src/index.js';
const {
createStrictModeElement,
createStandardElement,
checkIsStrictMode,
checkIsValidStrictModeType,
isStrictMode,
StrictMode,
Element,
Fragment,
isElement,
isValidElementType,
typeOf,
} = indexPkg;
// 1. Function and symbol export verification
assert.equal(typeof isStrictMode, 'function', 'isStrictMode must be a function');
assert.equal(typeof checkIsStrictMode, 'function', 'checkIsStrictMode helper must be a function');
assert.equal(typeof isValidElementType, 'function', 'isValidElementType must be a function');
assert.equal(typeof checkIsValidStrictModeType, 'function', 'checkIsValidStrictModeType helper must be a function');
assert.equal(typeof StrictMode, 'symbol', 'StrictMode must be a symbol');
assert.equal(StrictMode, Symbol.for('react.strict_mode'), 'StrictMode must match Symbol.for("react.strict_mode")');
assert.equal(Element, Symbol.for('react.transitional.element'), 'Element must match React 19 transitional element symbol');
// 2. StrictMode element detection
const strictModeEl = createStrictModeElement({ id: 'app-strict' }, []);
assert.equal(isElement(strictModeEl), true, 'strictModeEl must be recognized as a valid React element');
assert.equal(isStrictMode(strictModeEl), true, 'isStrictMode must return true for StrictMode elements');
assert.equal(checkIsStrictMode(strictModeEl), true, 'checkIsStrictMode helper must return true for StrictMode elements');
assert.equal(typeOf(strictModeEl), StrictMode, 'typeOf(strictModeEl) must return StrictMode symbol');
// 3. Rejection of standard non-StrictMode elements
const standardEl = createStandardElement('section', { className: 'main' });
assert.equal(isElement(standardEl), true, 'standardEl must be recognized as a valid React element');
assert.equal(isStrictMode(standardEl), false, 'isStrictMode must return false for standard DOM elements');
assert.equal(checkIsStrictMode(standardEl), false, 'checkIsStrictMode must return false for standard DOM elements');
const fragmentEl = {
$$typeof: Element,
type: Fragment,
props: { children: [] },
key: null,
ref: null,
};
assert.equal(isElement(fragmentEl), true, 'fragmentEl must be recognized as a valid React element');
assert.equal(isStrictMode(fragmentEl), false, 'isStrictMode must return false for fragment elements');
// 4. Rejection of objects without transitional Element marker or invalid element structures
assert.equal(isStrictMode({ type: StrictMode }), false, 'Plain object with type StrictMode must not be recognized');
assert.equal(isStrictMode({ $$typeof: Symbol.for('react.element'), type: StrictMode }), false, 'Legacy React 17 element marker must not be recognized in React 19');
assert.equal(isStrictMode({}), false, 'Empty object must return false');
assert.equal(isStrictMode(StrictMode), false, 'Raw StrictMode symbol must return false');
// 5. Rejection of primitives and falsy values
assert.equal(isStrictMode(null), false, 'null must return false');
assert.equal(isStrictMode(undefined), false, 'undefined must return false');
assert.equal(isStrictMode('react.strict_mode'), false, 'String must return false');
assert.equal(isStrictMode(123), false, 'Number must return false');
assert.equal(isStrictMode(true), false, 'Boolean must return false');
assert.equal(isStrictMode(false), false, 'Boolean must return false');
// 6. Element type validity for StrictMode
assert.equal(isValidElementType(StrictMode), true, 'StrictMode symbol must be a valid element type');
assert.equal(checkIsValidStrictModeType(), true, 'checkIsValidStrictModeType helper must return true');
console.log('Contract tests passed: react-is.isStrictMode verified for pkg:npm/react-is@19.2.8');
Seeder d'origine
anonyme