CodeSampleX

サンプル

react-is 19.2.8: Element

検証済みサンプル — npm react-is 19.2.8: Element. node 22 · linux debian/x64 · docker で contract を実行し、成功しました: Element is exported as a symbol identifying React…

sha256:40b550582df569c7fea1507b8aff1dfb6cbaf8c796d0205cebf50985681d0e03

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 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.Element in pkg:npm/react-is@19.2.8
パッケージ
シンボル
  • react-is.Element
環境
node 22.23.2
作成日
2026-09-06T01:46:19Z

コントラクト

  1. Element is exported as a symbol identifying React transitional element objects
  2. Element symbol matches Symbol.for('react.transitional.element') in React 19 and is distinct from Symbol.for('react.element')
  3. Element is distinct from other React type symbols like Fragment, Portal, StrictMode, and ContextConsumer
  4. typeOf returns Element for React 19 element objects created with standard HTML tag or component types
  5. isElement returns true for valid React element objects matching Element type and false for non-elements

ファイル

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.js
  • test/contract.mjs

ソースアーティファクトをダウンロード (tar.gz)

ソース

PROMPT.md
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.Element 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.Element

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.
csx.json
{"case":{"caseId":"case:sha256:56c6545d6cf9d28ff45e524faa20655a73e29db978afc2d8349152d2ed7e5f96","contract":["Element is exported as a symbol identifying React transitional element objects","Element symbol matches Symbol.for('react.transitional.element') in React 19 and is distinct from Symbol.for('react.element')","Element is distinct from other React type symbols like Fragment, Portal, StrictMode, and ContextConsumer","typeOf returns Element for React 19 element objects created with standard HTML tag or component types","isElement returns true for valid React element objects matching Element type and false for non-elements"],"goal":"verify react-is.Element in pkg:npm/react-is@19.2.8","kind":"HOW","packages":["pkg:npm/react-is@19.2.8"],"schemaVersion":1,"symbols":["react-is.Element"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","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.Element"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-react-is-element",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-react-is-element",
      "version": "1.0.0",
      "license": "MIT-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"
    }
  }
}
package.json
{
  "name": "sample-react-is-element",
  "version": "1.0.0",
  "description": "Clean-room verification of react-is Element in react-is@19.2.8",
  "type": "module",
  "private": true,
  "license": "MIT-0",
  "scripts": {
    "test": "node test/contract.mjs"
  },
  "dependencies": {
    "react-is": "19.2.8"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify react-is.Element in pkg:npm/react-is@19.2.8",
  "kind": "HOW",
  "packages": [
    "pkg:npm/react-is@19.2.8"
  ],
  "symbols": [
    "react-is.Element"
  ]
}
src/index.js
import {
  Element,
  Fragment,
  Portal,
  StrictMode,
  Profiler,
  ContextConsumer,
  ContextProvider,
  ForwardRef,
  Suspense,
  SuspenseList,
  Memo,
  Lazy,
  isElement,
  typeOf,
} from 'react-is';

/**
 * Returns the Element type symbol exported by react-is.
 *
 * @returns {symbol} React element type symbol
 */
export function getElementSymbol() {
  return Element;
}

/**
 * Checks if a value is a valid React element.
 *
 * @param {*} value - The value to inspect
 * @returns {boolean} True if the value is a React element
 */
export function checkIsElement(value) {
  return isElement(value);
}

/**
 * Determines the React type symbol of an element.
 *
 * @param {*} element - The React element to inspect
 * @returns {symbol|undefined} The element type symbol or undefined
 */
export function inspectElementType(element) {
  return typeOf(element);
}

export {
  Element,
  Fragment,
  Portal,
  StrictMode,
  Profiler,
  ContextConsumer,
  ContextProvider,
  ForwardRef,
  Suspense,
  SuspenseList,
  Memo,
  Lazy,
  isElement,
  typeOf,
};
test/contract.mjs
import assert from 'node:assert/strict';
import {
  Element,
  Fragment,
  Portal,
  StrictMode,
  Profiler,
  ContextConsumer,
  ContextProvider,
  ForwardRef,
  Suspense,
  SuspenseList,
  Memo,
  Lazy,
  isElement,
  typeOf,
  getElementSymbol,
  checkIsElement,
  inspectElementType,
} from '../src/index.js';

// 1. Element is exported as a symbol identifying React transitional element objects
assert.equal(typeof Element, 'symbol', 'Element should be exported as a symbol');
assert.equal(getElementSymbol(), Element, 'getElementSymbol() should return Element');

// 2. Element symbol matches Symbol.for('react.transitional.element') in React 19 and is distinct from Symbol.for('react.element')
assert.equal(Element, Symbol.for('react.transitional.element'), 'Element must equal Symbol.for("react.transitional.element")');
assert.notEqual(Element, Symbol.for('react.element'), 'Element must not equal legacy Symbol.for("react.element")');

// 3. Element is distinct from other React type symbols like Fragment, Portal, StrictMode, and ContextConsumer
assert.notEqual(Element, Fragment, 'Element must be distinct from Fragment');
assert.notEqual(Element, Portal, 'Element must be distinct from Portal');
assert.notEqual(Element, StrictMode, 'Element must be distinct from StrictMode');
assert.notEqual(Element, Profiler, 'Element must be distinct from Profiler');
assert.notEqual(Element, ContextConsumer, 'Element must be distinct from ContextConsumer');
assert.notEqual(Element, ContextProvider, 'Element must be distinct from ContextProvider');
assert.notEqual(Element, ForwardRef, 'Element must be distinct from ForwardRef');
assert.notEqual(Element, Suspense, 'Element must be distinct from Suspense');
assert.notEqual(Element, SuspenseList, 'Element must be distinct from SuspenseList');
assert.notEqual(Element, Memo, 'Element must be distinct from Memo');
assert.notEqual(Element, Lazy, 'Element must be distinct from Lazy');

// 4. typeOf returns Element for React 19 element objects created with standard HTML tag or component types
const standardTagElement = {
  $$typeof: Element,
  type: 'div',
  props: { id: 'test' },
  key: null,
  ref: null,
};
assert.equal(typeOf(standardTagElement), Element, 'typeOf must return Element for HTML tag element');
assert.equal(inspectElementType(standardTagElement), Element, 'inspectElementType must return Element for HTML tag element');

const componentElement = {
  $$typeof: Element,
  type: function Component() { return null; },
  props: {},
  key: null,
  ref: null,
};
assert.equal(typeOf(componentElement), Element, 'typeOf must return Element for component element');
assert.equal(inspectElementType(componentElement), Element, 'inspectElementType must return Element for component element');

// 5. isElement returns true for valid React element objects matching Element type and false for non-elements
assert.equal(isElement(standardTagElement), true, 'isElement must return true for standard tag element');
assert.equal(checkIsElement(standardTagElement), true, 'checkIsElement helper must return true for standard tag element');
assert.equal(isElement(componentElement), true, 'isElement must return true for component element');
assert.equal(checkIsElement(componentElement), true, 'checkIsElement helper must return true for component element');

const portalObject = {
  $$typeof: Portal,
  key: null,
  children: [],
  containerInfo: {},
};
assert.equal(isElement(portalObject), false, 'isElement must return false for Portal object');
assert.equal(checkIsElement(portalObject), false, 'checkIsElement must return false for Portal object');

const legacyElement = {
  $$typeof: Symbol.for('react.element'),
  type: 'span',
  props: {},
  key: null,
  ref: null,
};
assert.equal(isElement(legacyElement), false, 'isElement must return false for legacy react.element in React 19');
assert.notEqual(typeOf(legacyElement), Element, 'legacy element typeOf must not equal Element in React 19');

assert.equal(isElement(null), false, 'isElement must return false for null');
assert.equal(isElement(undefined), false, 'isElement must return false for undefined');
assert.equal(isElement({}), false, 'isElement must return false for empty object');
assert.equal(isElement('string'), false, 'isElement must return false for string primitive');
assert.equal(isElement(42), false, 'isElement must return false for number primitive');
assert.equal(typeOf({}), undefined, 'typeOf must return undefined for non-element');

console.log('All contract assertions for react-is.Element passed.');

オリジンシーダー

匿名