サンプル
react-is 17.0.2: Portal
検証済みサンプル — npm react-is 17.0.2: Portal. node 22 · linux debian/x64 · docker で contract を実行し、成功しました: Portal is exported as a symbol matching…
sha256:6b83b8ef9c6a3c10d2c28f4abf701d06c6c7668ac6c6acf559c02ead1046ea5a
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 1
- ビルドした署名鍵
- 1
宣言された環境
linux 24 · ubuntu · glibc 2.39 x64 npm
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| 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 |
ケース
HOW- ゴール
- verify react-is.Portal in pkg:npm/react-is@17.0.2
- パッケージ
- シンボル
-
- react-is.Portal
- 作成日
- 2026-09-06T09:31:36Z
コントラクト
- Portal is exported as a symbol matching Symbol.for('react.portal')
- Portal represents the $$typeof identifier used for React portal objects
- isPortal returns true for objects with $$typeof equal to Portal
- typeOf returns Portal for React portal objects and distinguishes them from non-portals or other React types
ファイル
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.mjs
ソース
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.Portal in 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.Portal
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:905fa0dcff18155c975e9cd28fde18385439b479c9ce7ca67d85ca09a5df8de5","contract":["Portal is exported as a symbol matching Symbol.for('react.portal')","Portal represents the $$typeof identifier used for React portal objects","isPortal returns true for objects with $$typeof equal to Portal","typeOf returns Portal for React portal objects and distinguishes them from non-portals or other React types"],"goal":"verify react-is.Portal in pkg:npm/react-is@17.0.2","kind":"HOW","packages":["pkg:npm/react-is@17.0.2"],"schemaVersion":1,"symbols":["react-is.Portal"]},"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.Portal"],"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": "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-portal",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of react-is.Portal in react-is 17.0.2",
"type": "module",
"main": "src/index.js",
"dependencies": {
"react-is": "17.0.2"
}
}
{
"schemaVersion": 1,
"goal": "verify react-is.Portal in pkg:npm/react-is@17.0.2",
"kind": "HOW",
"packages": [
"pkg:npm/react-is@17.0.2"
],
"symbols": [
"react-is.Portal"
]
}
import { Portal, isPortal, typeOf } from 'react-is';
/**
* Return the Portal symbol exported by react-is.
*
* @returns {symbol} The React portal identifier symbol.
*/
export function getPortalSymbol() {
return Portal;
}
/**
* Check if the provided symbol matches react-is Portal.
*
* @param {*} sym - Symbol or value to compare.
* @returns {boolean} True if matching react-is Portal.
*/
export function isMatchingPortalSymbol(sym) {
return sym === Portal;
}
/**
* Create a mock React portal object tagged with the Portal symbol.
*
* @param {*} children - Portal child elements.
* @param {*} containerInfo - Target DOM node or container representation.
* @param {string|null} key - Optional key for the portal.
* @returns {object} Object with $$typeof set to Portal.
*/
export function createPortalDescriptor(children = [], containerInfo = {}, key = null) {
return {
$$typeof: Portal,
key: key == null ? null : String(key),
children,
containerInfo,
implementation: null,
};
}
/**
* Verify whether an object is recognized as a React portal.
*
* @param {*} value - The value to inspect.
* @returns {boolean} True if the value is a React portal.
*/
export function checkIsPortal(value) {
return isPortal(value);
}
/**
* Identify whether the typeOf helper resolves the value to the Portal symbol.
*
* @param {*} value - The value to inspect.
* @returns {boolean} True if typeOf(value) === Portal.
*/
export function isPortalTypeOf(value) {
return typeOf(value) === Portal;
}
export { Portal, isPortal, typeOf };
import assert from 'node:assert/strict';
import {
Portal,
isPortal,
typeOf,
getPortalSymbol,
isMatchingPortalSymbol,
createPortalDescriptor,
checkIsPortal,
isPortalTypeOf,
} from '../src/index.js';
// 1. Portal export assertion
assert.equal(typeof Portal, 'symbol', 'Portal must be exported as a symbol');
assert.equal(Portal, Symbol.for('react.portal'), 'Portal must equal Symbol.for("react.portal")');
assert.equal(getPortalSymbol(), Portal, 'getPortalSymbol helper must return Portal');
assert.equal(isMatchingPortalSymbol(Portal), true, 'isMatchingPortalSymbol must return true for Portal');
assert.equal(isMatchingPortalSymbol(Symbol.for('react.portal')), true, 'isMatchingPortalSymbol must return true for Symbol.for("react.portal")');
assert.equal(isMatchingPortalSymbol(Symbol.for('react.fragment')), false, 'isMatchingPortalSymbol must return false for other symbols');
// 2. Portal detection with isPortal
const portalObj = createPortalDescriptor([], {}, null);
assert.equal(portalObj.$$typeof, Portal, 'Created descriptor must have $$typeof equal to Portal');
assert.equal(isPortal(portalObj), true, 'isPortal must return true for object with $$typeof Portal');
assert.equal(checkIsPortal(portalObj), true, 'checkIsPortal helper must return true');
const nonPortalObj = { type: 'div', props: {} };
assert.equal(isPortal(nonPortalObj), false, 'Plain object must not be recognized as portal');
assert.equal(checkIsPortal(null), false, 'null must not be recognized as portal');
assert.equal(checkIsPortal(undefined), false, 'undefined must not be recognized as portal');
// 3. typeOf identification matching Portal
assert.equal(typeOf(portalObj), Portal, 'typeOf must return Portal for object with $$typeof Portal');
assert.equal(isPortalTypeOf(portalObj), true, 'isPortalTypeOf helper must return true for portal object');
assert.equal(typeOf(nonPortalObj), undefined, 'typeOf must return undefined for plain object without $$typeof');
assert.equal(isPortalTypeOf(nonPortalObj), false, 'isPortalTypeOf helper must return false for non-portal');
// 4. Distinction from other React symbols
const elementObj = {
$$typeof: Symbol.for('react.element'),
type: 'div',
props: {},
key: null,
ref: null,
};
assert.notEqual(typeOf(elementObj), Portal, 'typeOf for standard element must not equal Portal');
assert.equal(isPortal(elementObj), false, 'isPortal must return false for standard React element');
assert.equal(isPortalTypeOf(elementObj), false, 'isPortalTypeOf helper must return false for standard React element');
console.log('Contract passed: react-is.Portal verified successfully.');
オリジンシーダー
匿名