サンプル
react-is 17.0.2: Profiler
検証済みサンプル — npm react-is 17.0.2: Profiler. node 22 · linux debian/x64 · docker で contract を実行し、成功しました: Profiler export is a distinct Symbol representing the…
sha256:fb396146aa6fb450455a3bf5f11597d1289a7a33799537936851dcecec73dcdc
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。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.Profiler in pkg:npm/react-is@17.0.2
- パッケージ
- シンボル
-
- react-is.Profiler
- 環境
- node 22.23.2
- 作成日
- 2026-09-06T09:56:03Z
コントラクト
- Profiler export is a distinct Symbol representing the React Profiler component type
- isValidElementType evaluates to true for the Profiler symbol
- isProfiler returns true for React elements configured with type Profiler
- typeOf returns the Profiler symbol for React elements configured with type Profiler
- isProfiler rejects plain objects, non-profiler React elements, primitives, null, and undefined
- typeOf returns undefined or different symbols for non-profiler values and plain objects
- Profiler is a component type symbol rather than a React element instance
ファイル
- 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.Profiler 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.Profiler
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:e33a60a46d90bf8f48033791a47951c5f459ebfa09388ad37e1a750daf665b50","constraints":{"executionContext":"node"},"contract":["Profiler export is a distinct Symbol representing the React Profiler component type","isValidElementType evaluates to true for the Profiler symbol","isProfiler returns true for React elements configured with type Profiler","typeOf returns the Profiler symbol for React elements configured with type Profiler","isProfiler rejects plain objects, non-profiler React elements, primitives, null, and undefined","typeOf returns undefined or different symbols for non-profiler values and plain objects","Profiler is a component type symbol rather than a React element instance"],"goal":"verify react-is.Profiler in pkg:npm/react-is@17.0.2","kind":"HOW","packages":["pkg:npm/react-is@17.0.2"],"schemaVersion":1,"symbols":["react-is.Profiler"]},"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@17.0.2"],"schemaVersion":1,"subject":"pkg:npm/react-is@17.0.2","symbols":["react-is.Profiler"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-react-is-profiler",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-react-is-profiler",
"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-profiler",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of react-is.Profiler in react-is 17.0.2",
"main": "src/index.js",
"dependencies": {
"react-is": "17.0.2"
}
}
{
"schemaVersion": 1,
"goal": "verify react-is.Profiler in pkg:npm/react-is@17.0.2",
"kind": "HOW",
"packages": [
"pkg:npm/react-is@17.0.2"
],
"symbols": [
"react-is.Profiler"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const {
Profiler,
isProfiler,
isElement,
isValidElementType,
typeOf,
} = require('react-is');
/**
* Creates a mock React Profiler element object.
*
* @param {string} [id='test-profiler'] - Unique Profiler identifier.
* @param {Function} [onRender=() => {}] - Profiler render callback.
* @returns {object} React element with type Profiler.
*/
function createProfilerElement(id = 'test-profiler', onRender = () => {}) {
return {
$$typeof: Symbol.for('react.element'),
type: Profiler,
props: { id, onRender, children: null },
key: null,
ref: null,
};
}
/**
* Validates whether the given value is a React Profiler element.
*
* @param {*} value - The value to inspect.
* @returns {boolean} True if the value is a Profiler element.
*/
function checkIsProfiler(value) {
return isProfiler(value);
}
/**
* Validates whether the Profiler export is a valid React element type.
*
* @returns {boolean} True if Profiler is a valid element type.
*/
function checkIsValidProfilerType() {
return isValidElementType(Profiler);
}
/**
* Identifies the element type of the given object using typeOf.
*
* @param {*} value - The object to inspect.
* @returns {symbol|undefined} The matched element symbol or undefined.
*/
function identifyTypeOf(value) {
return typeOf(value);
}
module.exports = {
Profiler,
isProfiler,
isElement,
isValidElementType,
typeOf,
createProfilerElement,
checkIsProfiler,
checkIsValidProfilerType,
identifyTypeOf,
};
import assert from 'node:assert/strict';
import { Profiler, isProfiler, isElement, isValidElementType, typeOf } from 'react-is';
import sample from '../src/index.js';
const {
createProfilerElement,
checkIsProfiler,
checkIsValidProfilerType,
identifyTypeOf,
} = sample;
// 1. Profiler export is a distinct Symbol representing the React Profiler component type
assert.equal(typeof Profiler, 'symbol', 'Profiler must be a symbol');
assert.equal(Profiler, Symbol.for('react.profiler'), 'Profiler must equal Symbol.for("react.profiler")');
assert.equal(sample.Profiler, Profiler, 'Re-exported Profiler must match react-is Profiler');
// 2. isValidElementType evaluates to true for the Profiler symbol
assert.equal(isValidElementType(Profiler), true, 'isValidElementType(Profiler) must return true');
assert.equal(checkIsValidProfilerType(), true, 'checkIsValidProfilerType helper must return true');
// 3. isProfiler returns true for React elements configured with type Profiler
const profilerElement = createProfilerElement('metrics-profiler', () => {});
assert.equal(isProfiler(profilerElement), true, 'isProfiler must return true for Profiler element');
assert.equal(checkIsProfiler(profilerElement), true, 'checkIsProfiler helper must return true');
// 4. typeOf returns the Profiler symbol for React elements configured with type Profiler
assert.equal(typeOf(profilerElement), Profiler, 'typeOf(profilerElement) must return Profiler symbol');
assert.equal(identifyTypeOf(profilerElement), Profiler, 'identifyTypeOf helper must return Profiler symbol');
// 5. isProfiler rejects plain objects, non-profiler React elements, primitives, null, and undefined
const divElement = {
$$typeof: Symbol.for('react.element'),
type: 'div',
props: {},
key: null,
ref: null,
};
assert.equal(isProfiler(divElement), false, 'div element must not be identified as Profiler');
assert.equal(checkIsProfiler(divElement), false, 'checkIsProfiler helper must return false for div element');
assert.equal(isProfiler({}), false, 'empty object is not a Profiler');
assert.equal(isProfiler(null), false, 'null is not a Profiler');
assert.equal(isProfiler(undefined), false, 'undefined is not a Profiler');
assert.equal(isProfiler('Profiler'), false, 'string is not a Profiler');
assert.equal(isProfiler(123), false, 'number is not a Profiler');
// 6. typeOf returns undefined or different symbols for non-profiler values and plain objects
assert.notEqual(typeOf(divElement), Profiler, 'typeOf(divElement) must not equal Profiler');
assert.equal(typeOf({}), undefined, 'typeOf({}) must return undefined');
assert.equal(typeOf(null), undefined, 'typeOf(null) must return undefined');
assert.equal(typeOf(undefined), undefined, 'typeOf(undefined) must return undefined');
// 7. Profiler is a component type symbol rather than a React element instance
assert.equal(isElement(Profiler), false, 'Profiler symbol itself must not be an element');
assert.equal(isElement(profilerElement), true, 'profilerElement must be a valid element');
console.log('Contract tests for react-is.Profiler passed successfully.');
オリジンシーダー
匿名