샘플
react-is 19.2.8: Portal
검증된 샘플 — npm react-is 19.2.8: Portal. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: Portal is exported as a symbol matching…
sha256:e5c60879aa3cfd6414532ab317b6ab2191aeb9d820307cef03414c866b06d128
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| 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@19.2.8
- 패키지
- 심벌
-
- react-is.Portal
- 환경
- node 22.23.2
- 생성일
- 2026-09-06T05:46:14Z
컨트랙트
- Portal is exported as a symbol matching Symbol.for('react.portal')
- Portal is distinct from other React 19 symbols including Element, Fragment, and StrictMode
- isValidElementType returns false for Portal symbol
- isPortal identifies valid React portal objects created with Portal symbol
- typeOf returns Portal symbol for valid React portal objects and undefined for non-element objects
- isPortal returns false for standard React elements, Portal symbol itself, plain objects, null, undefined, and primitives
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.js
소스
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@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.Portal
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:d0ab530cfe1cbd00c36eee7fca752fd5846ac96713aeaffd00a49f76201f8868","constraints":{"executionContext":"node"},"contract":["Portal is exported as a symbol matching Symbol.for('react.portal')","Portal is distinct from other React 19 symbols including Element, Fragment, and StrictMode","isValidElementType returns false for Portal symbol","isPortal identifies valid React portal objects created with Portal symbol","typeOf returns Portal symbol for valid React portal objects and undefined for non-element objects","isPortal returns false for standard React elements, Portal symbol itself, plain objects, null, undefined, and primitives"],"goal":"verify react-is.Portal in pkg:npm/react-is@19.2.8","kind":"HOW","packages":["pkg:npm/react-is@19.2.8"],"schemaVersion":1,"symbols":["react-is.Portal"]},"contractCommand":["node","test/contract.js"],"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.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": "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-portal",
"version": "1.0.0",
"description": "verify react-is.Portal in pkg:npm/react-is@19.2.8",
"main": "src/index.js",
"dependencies": {
"react-is": "19.2.8"
}
}
{
"schemaVersion": 1,
"goal": "verify react-is.Portal in pkg:npm/react-is@19.2.8",
"kind": "HOW",
"packages": [
"pkg:npm/react-is@19.2.8"
],
"symbols": [
"react-is.Portal"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const {
Portal,
Element,
Fragment,
StrictMode,
Profiler,
ContextConsumer,
ContextProvider,
ForwardRef,
Suspense,
SuspenseList,
Memo,
Lazy,
isPortal,
isElement,
isValidElementType,
typeOf,
} = require('react-is');
/**
* Creates a representation of a React portal object.
*
* @param {*} children - Portal children content.
* @param {object} [containerInfo={}] - Target container information.
* @param {string|null} [key=null] - Key for the portal.
* @returns {object} React portal representation object.
*/
function createPortalObject(children = null, containerInfo = {}, key = null) {
return {
$$typeof: Portal,
key,
children,
containerInfo,
implementation: null,
};
}
/**
* Checks whether a given value is a React portal object.
*
* @param {*} value - The value to test.
* @returns {boolean} True if the value is a portal.
*/
function checkIsPortal(value) {
return isPortal(value);
}
/**
* Inspects a value and returns its React element type symbol.
*
* @param {*} value - The value to inspect.
* @returns {symbol|undefined} The element type symbol or undefined.
*/
function inspectTypeOf(value) {
return typeOf(value);
}
/**
* Checks whether a given type is a valid React element type.
*
* @param {*} type - The type to test.
* @returns {boolean} True if the type is a valid element type.
*/
function checkIsValidElementType(type) {
return isValidElementType(type);
}
module.exports = {
Portal,
Element,
Fragment,
StrictMode,
Profiler,
ContextConsumer,
ContextProvider,
ForwardRef,
Suspense,
SuspenseList,
Memo,
Lazy,
isPortal,
isElement,
isValidElementType,
typeOf,
createPortalObject,
checkIsPortal,
inspectTypeOf,
checkIsValidElementType,
};
const assert = require('node:assert/strict');
const reactIs = require('react-is');
const {
Portal,
Element,
Fragment,
StrictMode,
Profiler,
ContextConsumer,
ContextProvider,
ForwardRef,
Suspense,
SuspenseList,
Memo,
Lazy,
isPortal,
isElement,
isValidElementType,
typeOf,
createPortalObject,
checkIsPortal,
inspectTypeOf,
checkIsValidElementType,
} = require('../src/index.js');
// Contract 1: Portal is exported as a symbol matching Symbol.for('react.portal')
assert.equal(typeof Portal, 'symbol', 'Portal must be a symbol');
assert.equal(Portal, Symbol.for('react.portal'), 'Portal must match Symbol.for("react.portal")');
assert.equal(reactIs.Portal, Portal, 'reactIs.Portal must equal named import Portal');
// Contract 2: Portal is distinct from other React 19 symbols including Element, Fragment, and StrictMode
assert.notEqual(Portal, Element, 'Portal must be distinct from Element');
assert.notEqual(Portal, Fragment, 'Portal must be distinct from Fragment');
assert.notEqual(Portal, StrictMode, 'Portal must be distinct from StrictMode');
assert.notEqual(Portal, Profiler, 'Portal must be distinct from Profiler');
assert.notEqual(Portal, ContextConsumer, 'Portal must be distinct from ContextConsumer');
assert.notEqual(Portal, ContextProvider, 'Portal must be distinct from ContextProvider');
assert.notEqual(Portal, ForwardRef, 'Portal must be distinct from ForwardRef');
assert.notEqual(Portal, Suspense, 'Portal must be distinct from Suspense');
assert.notEqual(Portal, SuspenseList, 'Portal must be distinct from SuspenseList');
assert.notEqual(Portal, Memo, 'Portal must be distinct from Memo');
assert.notEqual(Portal, Lazy, 'Portal must be distinct from Lazy');
// Contract 3: isValidElementType returns false for Portal symbol
assert.equal(checkIsValidElementType(Portal), false, 'Portal cannot be used as an element type');
assert.equal(isValidElementType(Portal), false, 'isValidElementType(Portal) must be false');
assert.equal(reactIs.isValidElementType(Portal), false, 'reactIs.isValidElementType(Portal) must be false');
assert.equal(checkIsValidElementType('div'), true, 'HTML tags must be valid element types');
assert.equal(checkIsValidElementType(Fragment), true, 'Fragment must be a valid element type');
// Contract 4: isPortal identifies valid React portal objects created with Portal symbol
const portalWithContent = createPortalObject('portal content', { id: 'modal-root' }, 'portal-key');
assert.equal(checkIsPortal(portalWithContent), true, 'Portal object must be identified by checkIsPortal');
assert.equal(isPortal(portalWithContent), true, 'Portal object must be identified by isPortal');
assert.equal(reactIs.isPortal(portalWithContent), true, 'Portal object must be identified by reactIs.isPortal');
assert.equal(isElement(portalWithContent), false, 'Portal object must not be identified as a standard element');
const emptyPortal = createPortalObject();
assert.equal(isPortal(emptyPortal), true, 'Empty portal object must be identified by isPortal');
const directPortal = {
$$typeof: Symbol.for('react.portal'),
key: null,
children: null,
containerInfo: {},
implementation: null,
};
assert.equal(isPortal(directPortal), true, 'Direct portal structure must be identified by isPortal');
// Contract 5: typeOf returns Portal symbol for valid React portal objects and undefined for non-element objects
assert.equal(inspectTypeOf(portalWithContent), Portal, 'inspectTypeOf must return Portal symbol for portal object');
assert.equal(typeOf(portalWithContent), Portal, 'typeOf must return Portal symbol for portal object');
assert.equal(reactIs.typeOf(portalWithContent), Portal, 'reactIs.typeOf must return Portal symbol for portal object');
assert.equal(typeOf(emptyPortal), Portal, 'typeOf must return Portal symbol for empty portal');
assert.equal(typeOf(directPortal), Portal, 'typeOf must return Portal symbol for direct portal');
assert.equal(inspectTypeOf({}), undefined, 'inspectTypeOf on plain object must return undefined');
assert.equal(typeOf({}), undefined, 'typeOf on plain object must return undefined');
assert.equal(typeOf(null), undefined, 'typeOf on null must return undefined');
assert.equal(typeOf(undefined), undefined, 'typeOf on undefined must return undefined');
assert.equal(typeOf('portal'), undefined, 'typeOf on string must return undefined');
assert.equal(typeOf(12345), undefined, 'typeOf on number must return undefined');
// Contract 6: isPortal returns false for standard React elements, Portal symbol itself, plain objects, null, undefined, and primitives
const standardElement = {
$$typeof: Element,
type: 'div',
props: { id: 'root' },
key: null,
ref: null,
};
assert.equal(checkIsPortal(standardElement), false, 'Standard React element must not be a portal');
assert.equal(isPortal(standardElement), false, 'Standard React element must not be a portal');
assert.equal(isPortal(Portal), false, 'Portal symbol itself must not be a portal instance');
assert.equal(isPortal({}), false, 'Empty object must return false');
assert.equal(isPortal(null), false, 'null must return false');
assert.equal(isPortal(undefined), false, 'undefined must return false');
assert.equal(isPortal('react.portal'), false, 'String must return false');
assert.equal(isPortal(12345), false, 'Number must return false');
assert.equal(isPortal(true), false, 'Boolean must return false');
assert.equal(isPortal([]), false, 'Array must return false');
console.log('All react-is.Portal contract tests passed.');
오리진 시더
익명