샘플
react-refresh 0.18.0: performReactRefresh
검증된 샘플 — npm react-refresh 0.18.0: performReactRefresh. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: react-refresh exports performReactRefresh…
sha256:f79f7dd9fbc3ae1d74a6036514ca8ab7262ee002a4ae188fd425c3e9b8648c50
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
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-refresh.performReactRefresh in pkg:npm/react-refresh@0.18.0
- 심벌
-
- react-refresh.performReactRefresh
- 환경
- node 22.23.2
- 생성일
- 2026-09-06T15:36:27Z
컨트랙트
- react-refresh exports performReactRefresh as a function
- performReactRefresh returns null when there are no pending component updates
- performReactRefresh processes registered component updates and returns updatedFamilies set containing the updated component family
- performReactRefresh sets updated component family current reference to newly registered component type
- performReactRefresh classifies component families with changed hook signatures into staleFamilies set
파일
- 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.performReactRefresh in pkg:npm/react-refresh@0.18.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/react-refresh@0.18.0
Demonstrate these symbols/APIs:
- react-refresh.performReactRefresh
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:834e555f3e7071e37b57f7c07a373db5055987d7e95f4ac9d57f679693d173bb","constraints":{"executionContext":"node"},"contract":["react-refresh exports performReactRefresh as a function","performReactRefresh returns null when there are no pending component updates","performReactRefresh processes registered component updates and returns updatedFamilies set containing the updated component family","performReactRefresh sets updated component family current reference to newly registered component type","performReactRefresh classifies component families with changed hook signatures into staleFamilies set"],"goal":"verify react-refresh.performReactRefresh in pkg:npm/react-refresh@0.18.0","kind":"HOW","packages":["pkg:npm/react-refresh@0.18.0"],"schemaVersion":1,"symbols":["react-refresh.performReactRefresh"]},"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-refresh@0.18.0"],"schemaVersion":1,"subject":"pkg:npm/react-refresh@0.18.0","symbols":["react-refresh.performReactRefresh"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-react-refresh-perform",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-react-refresh-perform",
"version": "1.0.0",
"dependencies": {
"react-refresh": "0.18.0"
}
},
"node_modules/react-refresh": {
"version": "0.18.0",
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.18.0.tgz",
"integrity": "sha512-QgT5//D3jfjJb6Gsjxv0Slpj23ip+HtOpnNgnb2S5zU3CB26G/IDPGoy4RJB42wzFE46DRsstbW6tKHoKbhAxw==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
}
}
}
{
"name": "sample-react-refresh-perform",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of react-refresh performReactRefresh",
"main": "src/index.js",
"dependencies": {
"react-refresh": "0.18.0"
}
}
{
"schemaVersion": 1,
"goal": "verify react-refresh.performReactRefresh in pkg:npm/react-refresh@0.18.0",
"kind": "HOW",
"packages": [
"pkg:npm/react-refresh@0.18.0"
],
"symbols": [
"react-refresh.performReactRefresh"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const RefreshRuntime = require('react-refresh');
/**
* Performs a React Refresh update cycle.
* @returns {object|null} The refresh update object containing updatedFamilies and staleFamilies, or null if no updates pending.
*/
function triggerRefresh() {
return RefreshRuntime.performReactRefresh();
}
/**
* Registers a component type with a specific identifier family.
* @param {Function|object} type - Component type.
* @param {string} id - Component identifier.
*/
function registerComponent(type, id) {
RefreshRuntime.register(type, id);
}
/**
* Sets the hook signature for a component type.
* @param {Function|object} type - Component type.
* @param {string} key - Signature key.
* @param {boolean} [forceReset=false] - Whether to force a full reset.
*/
function setComponentSignature(type, key, forceReset) {
RefreshRuntime.setSignature(type, key, forceReset);
}
module.exports = {
triggerRefresh,
registerComponent,
setComponentSignature,
RefreshRuntime
};
import assert from 'node:assert';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
triggerRefresh,
registerComponent,
setComponentSignature,
RefreshRuntime
} = require('../src/index.js');
// 1. Export verification
assert.strictEqual(
typeof RefreshRuntime.performReactRefresh,
'function',
'react-refresh exports performReactRefresh as a function'
);
// 2. Returns null when no updates are pending
const initialResult = triggerRefresh();
assert.strictEqual(
initialResult,
null,
'performReactRefresh returns null when there are no pending component updates'
);
// 3. Registering component updates and processing them via performReactRefresh
function HeaderV1() {
return 'Header version 1';
}
registerComponent(HeaderV1, 'HeaderComponentId');
// Before an update is registered to the same ID, performReactRefresh still returns null
assert.strictEqual(
triggerRefresh(),
null,
'performReactRefresh returns null before an updated version is registered'
);
function HeaderV2() {
return 'Header version 2';
}
registerComponent(HeaderV2, 'HeaderComponentId');
// Now performReactRefresh processes the pending update
const updateResult = triggerRefresh();
assert.ok(
updateResult !== null && typeof updateResult === 'object',
'performReactRefresh returns an update object when pending updates exist'
);
assert.ok(
updateResult.updatedFamilies instanceof Set,
'performReactRefresh update object contains updatedFamilies Set'
);
assert.ok(
updateResult.staleFamilies instanceof Set,
'performReactRefresh update object contains staleFamilies Set'
);
assert.strictEqual(
updateResult.updatedFamilies.size,
1,
'updatedFamilies contains exactly 1 updated family'
);
assert.strictEqual(
updateResult.staleFamilies.size,
0,
'staleFamilies is empty for simple compatible updates'
);
// 4. Component family current reference is updated to new type
const updatedFamily = [...updateResult.updatedFamilies][0];
assert.strictEqual(
updatedFamily.current,
HeaderV2,
'performReactRefresh sets updated component family current reference to newly registered component type'
);
// Subsequent call returns null because pending updates were flushed
assert.strictEqual(
triggerRefresh(),
null,
'performReactRefresh returns null immediately after pending updates are flushed'
);
// 5. Signature changes cause family to be classified into staleFamilies
function NavV1() {
return 'Nav version 1';
}
registerComponent(NavV1, 'NavComponentId');
setComponentSignature(NavV1, 'sig-v1');
function NavV2() {
return 'Nav version 2';
}
registerComponent(NavV2, 'NavComponentId');
setComponentSignature(NavV2, 'sig-v2');
const staleUpdateResult = triggerRefresh();
assert.ok(
staleUpdateResult !== null,
'performReactRefresh returns update object for signature update'
);
assert.strictEqual(
staleUpdateResult.staleFamilies.size,
1,
'performReactRefresh classifies component families with changed hook signatures into staleFamilies set'
);
assert.strictEqual(
staleUpdateResult.updatedFamilies.size,
0,
'updatedFamilies is empty when component signature changed'
);
console.log('Contract assertions for react-refresh.performReactRefresh passed.');
오리진 시더
익명