Beispiel
react-is 18.3.1: isPortal
Verifiziertes Beispiel für npm react-is 18.3.1: isPortal. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand.
sha256:4b95dcafd96f5b68601e3543046be2acd58355b848208302d7c93ffe2aa8977e
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
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
linux 24 · ubuntu · glibc 2.39 x64 npm
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-30 |
Fall
HOW- Ziel
- verify react-is.isPortal in pkg:npm/react-is@18.3.1
- Pakete
- Symbole
-
- react-is.isPortal
- Erstellt
- 2026-08-30T09:59:25Z
Contract
- isPortal identifies React portal objects with react.portal symbol type
- isPortal returns false for non-portal elements, plain objects, null, undefined, and primitives
- Portal symbol matches typeOf on valid React portal objects
Dateien
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.mjs
Quelltext
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.isPortal in pkg:npm/react-is@18.3.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/react-is@18.3.1
Demonstrate these symbols/APIs:
- react-is.isPortal
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:c87bd1ac326d4a0e3f784529faf8edb13362a3d28a2647a8bcb634c979f6996b","contract":["isPortal identifies React portal objects with react.portal symbol type","isPortal returns false for non-portal elements, plain objects, null, undefined, and primitives","Portal symbol matches typeOf on valid React portal objects"],"goal":"verify react-is.isPortal in pkg:npm/react-is@18.3.1","kind":"HOW","packages":["pkg:npm/react-is@18.3.1"],"schemaVersion":1,"symbols":["react-is.isPortal"]},"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@18.3.1"],"schemaVersion":1,"subject":"pkg:npm/react-is@18.3.1","symbols":["react-is.isPortal"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-react-is-portal",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-react-is-portal",
"version": "1.0.0",
"dependencies": {
"react-is": "18.3.1"
}
},
"node_modules/react-is": {
"version": "18.3.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz",
"integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==",
"license": "MIT"
}
}
}
{
"name": "sample-react-is-portal",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of react-is isPortal API",
"type": "module",
"main": "src/index.js",
"dependencies": {
"react-is": "18.3.1"
}
}
{
"schemaVersion": 1,
"goal": "verify react-is.isPortal in pkg:npm/react-is@18.3.1",
"kind": "HOW",
"packages": [
"pkg:npm/react-is@18.3.1"
],
"symbols": [
"react-is.isPortal"
]
}
import { isPortal, Portal, typeOf } from 'react-is';
/**
* Check if the given value is a valid React portal object.
*
* @param {*} value - The value to check.
* @returns {boolean} True if the value is a React portal.
*/
export function checkIsPortal(value) {
return isPortal(value);
}
/**
* Create a mock React portal object.
*
* @param {*} children - Portal children.
* @param {*} containerInfo - DOM container or target info.
* @param {string|null} key - Optional key.
* @returns {object} A React portal element structure.
*/
export function createMockPortal(children = null, containerInfo = {}, key = null) {
return {
$$typeof: Symbol.for('react.portal'),
key,
children,
containerInfo,
implementation: null,
};
}
export { isPortal, Portal, typeOf };
import assert from 'node:assert/strict';
import {
checkIsPortal,
createMockPortal,
isPortal,
Portal,
typeOf,
} from '../src/index.js';
// 1. Export types and symbols verification
assert.equal(typeof isPortal, 'function', 'isPortal should be an exported function');
assert.equal(typeof checkIsPortal, 'function', 'checkIsPortal helper should be a function');
assert.equal(typeof createMockPortal, 'function', 'createMockPortal helper should be a function');
assert.equal(typeof Portal, 'symbol', 'Portal should be an exported symbol');
// 2. isPortal identifies React portal objects with react.portal symbol type
const portalObject = createMockPortal('hello portal', { nodeType: 1 }, 'portal-key');
assert.equal(isPortal(portalObject), true, 'isPortal should return true for a valid React portal object');
assert.equal(checkIsPortal(portalObject), true, 'checkIsPortal helper should return true for a valid React portal object');
const directPortal = {
$$typeof: Symbol.for('react.portal'),
key: null,
children: null,
containerInfo: {},
implementation: null,
};
assert.equal(isPortal(directPortal), true, 'isPortal should return true for direct portal representation');
// 3. isPortal returns false for non-portal elements, plain objects, null, undefined, and primitives
const plainElement = {
$$typeof: Symbol.for('react.element'),
type: 'div',
props: {},
key: null,
ref: null,
};
assert.equal(isPortal(plainElement), false, 'isPortal should return false for standard React elements');
assert.equal(isPortal({}), false, 'isPortal should return false for empty plain objects');
assert.equal(isPortal(null), false, 'isPortal should return false for null');
assert.equal(isPortal(undefined), false, 'isPortal should return false for undefined');
assert.equal(isPortal('portal'), false, 'isPortal should return false for string primitives');
assert.equal(isPortal(12345), false, 'isPortal should return false for number primitives');
assert.equal(isPortal(true), false, 'isPortal should return false for boolean primitives');
assert.equal(isPortal([]), false, 'isPortal should return false for arrays');
// 4. Portal symbol matches typeOf on valid React portal objects
assert.equal(typeOf(portalObject), Portal, 'typeOf(portalObject) must equal Portal');
assert.equal(typeOf(directPortal), Portal, 'typeOf(directPortal) must equal Portal');
assert.notEqual(typeOf(plainElement), Portal, 'typeOf(plainElement) must not equal Portal');
console.log('All contract tests for react-is.isPortal in react-is@18.3.1 passed.');
Ursprungs-Seeder
anonym