サンプル
react-refresh 0.17.0: isLikelyComponentType
検証済みサンプル — npm react-refresh 0.17.0: isLikelyComponentType. node 22 · linux debian/x64 · docker で contract を実行し、成功しました: isLikelyComponentType returns true…
sha256:3864b45b2729f5daf211e4cf1397710648b5356526408e1c507a858b5da790eb
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。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-04 |
ケース
HOW- ゴール
- verify react-refresh.isLikelyComponentType in pkg:npm/react-refresh@0.17.0
- パッケージ
- シンボル
-
- react-refresh.isLikelyComponentType
- 作成日
- 2026-09-04T18:52:58Z
コントラクト
- isLikelyComponentType returns true for PascalCase function components and arrow functions
- isLikelyComponentType returns true for components with uppercase displayName
- isLikelyComponentType returns true for class components with isReactComponent on prototype
- isLikelyComponentType returns true for React forwardRef and memo objects
- isLikelyComponentType returns false for lowercase functions and regular classes
- isLikelyComponentType returns false for plain objects, non-component elements, primitives, and nullish values
ファイル
- 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-refresh.isLikelyComponentType in pkg:npm/react-refresh@0.17.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/react-refresh@0.17.0
Demonstrate these symbols/APIs:
- react-refresh.isLikelyComponentType
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:e845f2386faaf115cd0bd9e3efef61028dbbc42c70ba68d70155c18efe9a4ede","contract":["isLikelyComponentType returns true for PascalCase function components and arrow functions","isLikelyComponentType returns true for components with uppercase displayName","isLikelyComponentType returns true for class components with isReactComponent on prototype","isLikelyComponentType returns true for React forwardRef and memo objects","isLikelyComponentType returns false for lowercase functions and regular classes","isLikelyComponentType returns false for plain objects, non-component elements, primitives, and nullish values"],"goal":"verify react-refresh.isLikelyComponentType in pkg:npm/react-refresh@0.17.0","kind":"HOW","packages":["pkg:npm/react-refresh@0.17.0"],"schemaVersion":1,"symbols":["react-refresh.isLikelyComponentType"]},"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-refresh@0.17.0"],"schemaVersion":1,"subject":"pkg:npm/react-refresh@0.17.0","symbols":["react-refresh.isLikelyComponentType"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-react-refresh-is-likely-component-type",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-react-refresh-is-likely-component-type",
"version": "1.0.0",
"dependencies": {
"react-refresh": "0.17.0"
}
},
"node_modules/react-refresh": {
"version": "0.17.0",
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz",
"integrity": "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
}
}
}
{
"name": "sample-react-refresh-is-likely-component-type",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of react-refresh isLikelyComponentType",
"type": "module",
"main": "src/index.js",
"dependencies": {
"react-refresh": "0.17.0"
}
}
{
"schemaVersion": 1,
"goal": "verify react-refresh.isLikelyComponentType in pkg:npm/react-refresh@0.17.0",
"kind": "HOW",
"packages": [
"pkg:npm/react-refresh@0.17.0"
],
"symbols": [
"react-refresh.isLikelyComponentType"
]
}
import { isLikelyComponentType } from 'react-refresh';
/**
* Check if the given value is likely a React component type.
*
* @param {*} type - The value to inspect.
* @returns {boolean} True if the value is likely a component type.
*/
export function checkIsLikelyComponentType(type) {
return isLikelyComponentType(type);
}
export { isLikelyComponentType };
import assert from 'node:assert/strict';
import {
isLikelyComponentType,
checkIsLikelyComponentType,
} from '../src/index.js';
// 1. Export verification
assert.equal(typeof isLikelyComponentType, 'function', 'isLikelyComponentType must be a function');
assert.equal(typeof checkIsLikelyComponentType, 'function', 'checkIsLikelyComponentType helper must be a function');
// 2. PascalCase function components and arrow functions
function ValidComponent() {
return null;
}
assert.equal(isLikelyComponentType(ValidComponent), true, 'PascalCase function must be recognized as component type');
assert.equal(checkIsLikelyComponentType(ValidComponent), true, 'checkIsLikelyComponentType returns true for PascalCase function');
const ArrowComponent = () => null;
assert.equal(isLikelyComponentType(ArrowComponent), true, 'Arrow function with PascalCase name must be recognized as component type');
assert.equal(checkIsLikelyComponentType(ArrowComponent), true, 'checkIsLikelyComponentType returns true for PascalCase arrow function');
// 3. Components with uppercase displayName
const anonymousFunc = (() => function() {
return null;
})();
Object.defineProperty(anonymousFunc, 'name', { value: '' });
anonymousFunc.displayName = 'NamedComponent';
assert.equal(isLikelyComponentType(anonymousFunc), true, 'Function with uppercase displayName must be recognized as component type');
assert.equal(checkIsLikelyComponentType(anonymousFunc), true, 'checkIsLikelyComponentType returns true for function with uppercase displayName');
// 4. Class components with isReactComponent on prototype
class MyClassComponent {}
MyClassComponent.prototype.isReactComponent = true;
assert.equal(isLikelyComponentType(MyClassComponent), true, 'Class component with isReactComponent must be recognized as component type');
assert.equal(checkIsLikelyComponentType(MyClassComponent), true, 'checkIsLikelyComponentType returns true for class component');
// 5. React forwardRef and memo objects
const forwardRefComponent = {
$$typeof: Symbol.for('react.forward_ref'),
render: () => null,
};
assert.equal(isLikelyComponentType(forwardRefComponent), true, 'React forwardRef object must be recognized as component type');
assert.equal(checkIsLikelyComponentType(forwardRefComponent), true, 'checkIsLikelyComponentType returns true for forwardRef');
const memoComponent = {
$$typeof: Symbol.for('react.memo'),
type: ValidComponent,
};
assert.equal(isLikelyComponentType(memoComponent), true, 'React memo object must be recognized as component type');
assert.equal(checkIsLikelyComponentType(memoComponent), true, 'checkIsLikelyComponentType returns true for memo object');
// 6. Lowercase functions and regular classes
function helperFunction() {
return false;
}
assert.equal(isLikelyComponentType(helperFunction), false, 'lowercase function must not be recognized as component type');
assert.equal(checkIsLikelyComponentType(helperFunction), false, 'checkIsLikelyComponentType returns false for lowercase function');
const lowercaseArrow = () => false;
assert.equal(isLikelyComponentType(lowercaseArrow), false, 'lowercase arrow function must not be recognized as component type');
class RegularClass {
method() {}
}
assert.equal(isLikelyComponentType(RegularClass), false, 'regular class without isReactComponent must not be recognized as component type');
// 7. Plain objects, non-component elements, primitives, and nullish values
assert.equal(isLikelyComponentType({}), false, 'plain object must not be recognized as component type');
assert.equal(isLikelyComponentType({ $$typeof: Symbol.for('react.element') }), false, 'React element object must not be recognized as component type');
assert.equal(isLikelyComponentType(null), false, 'null must not be recognized as component type');
assert.equal(isLikelyComponentType(undefined), false, 'undefined must not be recognized as component type');
assert.equal(isLikelyComponentType(42), false, 'number primitive must not be recognized as component type');
assert.equal(isLikelyComponentType('MyComponent'), false, 'string primitive must not be recognized as component type');
assert.equal(isLikelyComponentType(true), false, 'boolean primitive must not be recognized as component type');
console.log('Contract tests passed successfully.');
オリジンシーダー
匿名