Exemple
react-refresh 0.17.0: hasUnrecoverableErrors
Échantillon vérifié pour npm react-refresh 0.17.0: hasUnrecoverableErrors. Le contrat s'est exécuté sur node 22 · linux debian/x64 · docker et a réussi.
sha256:3588ea779a92d3b285a825aabf650a6f190c82f7ce1325ffe76251126e182c9c
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| 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-05 |
Cas
HOW- Objectif
- verify react-refresh.hasUnrecoverableErrors in pkg:npm/react-refresh@0.17.0
- Paquets
- Symboles
-
- react-refresh.hasUnrecoverableErrors
- Environnement
- node 22.23.2
- Créé
- 2026-09-05T01:31:22Z
Contrat
- hasUnrecoverableErrors returns false initially when no errors have occurred
- hasUnrecoverableErrors returns false after registering component types
- hasUnrecoverableErrors returns false after performing refresh cycle with performReactRefresh
- hasUnrecoverableErrors returns false when invoked repeatedly across multiple calls
- hasUnrecoverableErrors returns false and does not throw when invoked with arbitrary arguments
Fichiers
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- test/contract.mjs
Code source
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.hasUnrecoverableErrors 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.hasUnrecoverableErrors
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:19b4bdc69ff3a63d6f6201fd33e41583ba8d0a1636bb6db2c88e12a503aa3874","constraints":{"executionContext":"node"},"contract":["hasUnrecoverableErrors returns false initially when no errors have occurred","hasUnrecoverableErrors returns false after registering component types","hasUnrecoverableErrors returns false after performing refresh cycle with performReactRefresh","hasUnrecoverableErrors returns false when invoked repeatedly across multiple calls","hasUnrecoverableErrors returns false and does not throw when invoked with arbitrary arguments"],"goal":"verify react-refresh.hasUnrecoverableErrors in pkg:npm/react-refresh@0.17.0","kind":"HOW","packages":["pkg:npm/react-refresh@0.17.0"],"schemaVersion":1,"symbols":["react-refresh.hasUnrecoverableErrors"]},"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.17.0"],"schemaVersion":1,"subject":"pkg:npm/react-refresh@0.17.0","symbols":["react-refresh.hasUnrecoverableErrors"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-react-refresh-has-unrecoverable-errors",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-react-refresh-has-unrecoverable-errors",
"version": "1.0.0",
"license": "MIT-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-has-unrecoverable-errors",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"react-refresh": "0.17.0"
}
}
{
"schemaVersion": 1,
"goal": "verify react-refresh.hasUnrecoverableErrors in pkg:npm/react-refresh@0.17.0",
"kind": "HOW",
"packages": [
"pkg:npm/react-refresh@0.17.0"
],
"symbols": [
"react-refresh.hasUnrecoverableErrors"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import refreshRuntimeModule from "react-refresh/runtime";
export const RefreshRuntime =
refreshRuntimeModule && typeof refreshRuntimeModule === "object" && "default" in refreshRuntimeModule
? refreshRuntimeModule.default
: refreshRuntimeModule;
/**
* Checks whether Fast Refresh runtime has encountered unrecoverable errors.
*
* @param {...any} args - Optional arguments passed to the check function.
* @returns {boolean} False when the runtime has no unrecoverable errors.
*/
export function hasUnrecoverableErrors(...args) {
return RefreshRuntime.hasUnrecoverableErrors(...args);
}
/**
* Registers a component type with a persistent identifier for Fast Refresh.
*
* @param {any} type - The component function or object
* @param {string} id - Persistent identifier for the component family
*/
export function register(type, id) {
RefreshRuntime.register(type, id);
}
/**
* Triggers a Fast Refresh cycle across registered components and renderers.
*
* @returns {object|null} Refresh cycle result or null if nothing was refreshed
*/
export function performReactRefresh() {
return RefreshRuntime.performReactRefresh();
}
import assert from "node:assert/strict";
import refreshRuntimeModule from "react-refresh/runtime";
import {
RefreshRuntime,
hasUnrecoverableErrors,
register,
performReactRefresh
} from "../src/index.mjs";
const rawRuntime =
refreshRuntimeModule && typeof refreshRuntimeModule === "object" && "default" in refreshRuntimeModule
? refreshRuntimeModule.default
: refreshRuntimeModule;
// Contract 1: hasUnrecoverableErrors returns false initially when no errors have occurred
{
assert.equal(typeof hasUnrecoverableErrors(), "boolean");
assert.equal(hasUnrecoverableErrors(), false);
assert.equal(typeof rawRuntime.hasUnrecoverableErrors, "function");
assert.equal(rawRuntime.hasUnrecoverableErrors(), false);
}
// Contract 2: hasUnrecoverableErrors returns false after registering component types
{
function HeaderComponent() {
return "Header";
}
register(HeaderComponent, "HeaderId");
assert.equal(hasUnrecoverableErrors(), false);
assert.equal(rawRuntime.hasUnrecoverableErrors(), false);
}
// Contract 3: hasUnrecoverableErrors returns false after performing refresh cycle with performReactRefresh
{
performReactRefresh();
assert.equal(hasUnrecoverableErrors(), false);
assert.equal(rawRuntime.hasUnrecoverableErrors(), false);
}
// Contract 4: hasUnrecoverableErrors returns false when invoked repeatedly across multiple calls
{
for (let i = 0; i < 5; i++) {
assert.equal(hasUnrecoverableErrors(), false);
assert.equal(rawRuntime.hasUnrecoverableErrors(), false);
}
}
// Contract 5: hasUnrecoverableErrors returns false and does not throw when invoked with arbitrary arguments
{
assert.equal(hasUnrecoverableErrors(null), false);
assert.equal(hasUnrecoverableErrors(undefined), false);
assert.equal(hasUnrecoverableErrors(new Error("simulated runtime error")), false);
assert.equal(hasUnrecoverableErrors("unexpected string", 123), false);
assert.equal(hasUnrecoverableErrors({ error: true }), false);
assert.equal(rawRuntime.hasUnrecoverableErrors(new Error("raw test")), false);
}
console.log("All react-refresh.hasUnrecoverableErrors contract tests passed successfully.");
Seeder d'origine
anonyme