Exemple
espree 10.4.0
Échantillon vérifié pour npm espree 10.4.0. Le contrat s'est exécuté sur node 22 · linux alpine/x64 · docker et a réussi : validates espree package version…
sha256:00c39e4aac9d04e880b28b6bb0656aacae0173816d9b991c4a76d822b2097b54
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 alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-26 |
Cas
HOW- Objectif
- verify pkg:npm/espree@10.4.0
- Paquets
- Environnement
- node 22.23.2
- Créé
- 2026-08-26T08:31:55Z
Contrat
- validates espree package version is 10.4.0, supported ECMAScript versions include 17, and Syntax/VisitorKeys metadata
- parses modern ECMAScript module AST with tokens, comments, location, and range
- parses JSX syntax when enabled in ecmaFeatures
- tokenizes JavaScript code with location and range metadata
- throws SyntaxError with line and column numbers on invalid syntax
- throws SyntaxError when parsing JSX without jsx feature enabled
Fichiers
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.js
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 pkg:npm/espree@10.4.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/espree@10.4.0
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:bac1890ed9d79c0bd831492cef6e717f20b49fcb8a6eff3bba86715d89cbb9b3","constraints":{"executionContext":"node"},"contract":["validates espree package version is 10.4.0, supported ECMAScript versions include 17, and Syntax/VisitorKeys metadata","parses modern ECMAScript module AST with tokens, comments, location, and range","parses JSX syntax when enabled in ecmaFeatures","tokenizes JavaScript code with location and range metadata","throws SyntaxError with line and column numbers on invalid syntax","throws SyntaxError when parsing JSX without jsx feature enabled"],"goal":"verify pkg:npm/espree@10.4.0","kind":"HOW","packages":["pkg:npm/espree@10.4.0"],"schemaVersion":1},"contractCommand":["node","test/contract.js"],"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/espree@10.4.0"],"schemaVersion":1,"subject":"pkg:npm/espree@10.4.0","verifierAdapter":"node-typescript@1"}
{
"name": "sample-espree",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-espree",
"version": "1.0.0",
"dependencies": {
"espree": "10.4.0"
}
},
"node_modules/acorn": {
"version": "8.18.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.18.0.tgz",
"integrity": "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ==",
"license": "MIT",
"bin": {
"acorn": "bin/acorn"
},
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/acorn-jsx": {
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
"integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
"license": "MIT",
"peerDependencies": {
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
}
},
"node_modules/eslint-visitor-keys": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz",
"integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==",
"license": "Apache-2.0",
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"url": "https://opencollective.com/eslint"
}
},
"node_modules/espree": {
"version": "10.4.0",
"resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz",
"integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==",
"license": "BSD-2-Clause",
"dependencies": {
"acorn": "^8.15.0",
"acorn-jsx": "^5.3.2",
"eslint-visitor-keys": "^4.2.1"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"url": "https://opencollective.com/eslint"
}
}
}
}
{
"name": "sample-espree",
"version": "1.0.0",
"description": "Clean-room verification sample for espree",
"main": "test/contract.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"espree": "10.4.0"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/espree@10.4.0",
"kind": "HOW",
"packages": [
"pkg:npm/espree@10.4.0"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const assert = require("assert");
const espree = require("espree");
// 1. Version and metadata assertions
assert.strictEqual(typeof espree.version, "string");
assert.strictEqual(espree.version, "10.4.0");
assert(Array.isArray(espree.supportedEcmaVersions));
assert(espree.supportedEcmaVersions.includes(17));
assert.strictEqual(espree.Syntax.Program, "Program");
assert.strictEqual(espree.Syntax.JSXElement, "JSXElement");
assert.strictEqual(espree.Syntax.ClassDeclaration, "ClassDeclaration");
assert(Array.isArray(espree.VisitorKeys.Program));
assert(Array.isArray(espree.VisitorKeys.ClassDeclaration));
// 2. Parse modern ECMAScript with tokens, comments, location, and range
const modernCode = `
// calculate answer
export async function getResult(val) {
const data = { x: val, y: 20 };
const combined = { ...data, z: 30 };
const fallback = combined?.extra ?? "default_value";
return fallback;
}
`;
const ast = espree.parse(modernCode, {
ecmaVersion: "latest",
sourceType: "module",
loc: true,
range: true,
tokens: true,
comment: true
});
assert.strictEqual(ast.type, "Program");
assert.strictEqual(ast.sourceType, "module");
assert(Array.isArray(ast.body));
assert.strictEqual(ast.body.length, 1);
assert.strictEqual(ast.body[0].type, "ExportNamedDeclaration");
assert.strictEqual(ast.body[0].declaration.type, "FunctionDeclaration");
assert.strictEqual(ast.body[0].declaration.id.name, "getResult");
assert.strictEqual(ast.body[0].declaration.async, true);
assert(Array.isArray(ast.tokens));
assert(ast.tokens.length > 0);
assert(Array.isArray(ast.comments));
assert.strictEqual(ast.comments.length, 1);
assert.strictEqual(ast.comments[0].value.trim(), "calculate answer");
// 3. Parse JSX syntax when enabled in ecmaFeatures
const jsxCode = `<div className="container"><Header title="test" /><span>hello</span></div>`;
const jsxAst = espree.parse(jsxCode, {
ecmaVersion: "latest",
sourceType: "module",
ecmaFeatures: {
jsx: true
}
});
assert.strictEqual(jsxAst.type, "Program");
assert.strictEqual(jsxAst.body.length, 1);
assert.strictEqual(jsxAst.body[0].type, "ExpressionStatement");
assert.strictEqual(jsxAst.body[0].expression.type, "JSXElement");
assert.strictEqual(jsxAst.body[0].expression.openingElement.name.name, "div");
assert.strictEqual(jsxAst.body[0].expression.children.length, 2);
// 4. Tokenize JavaScript code with token locations
const tokens = espree.tokenize("const total = 100;", {
ecmaVersion: "latest",
loc: true,
range: true
});
assert(Array.isArray(tokens));
assert.strictEqual(tokens.length, 5);
assert.strictEqual(tokens[0].type, "Keyword");
assert.strictEqual(tokens[0].value, "const");
assert.strictEqual(tokens[1].type, "Identifier");
assert.strictEqual(tokens[1].value, "total");
assert.strictEqual(tokens[2].type, "Punctuator");
assert.strictEqual(tokens[2].value, "=");
assert.strictEqual(tokens[3].type, "Numeric");
assert.strictEqual(tokens[3].value, "100");
assert.strictEqual(tokens[4].type, "Punctuator");
assert.strictEqual(tokens[4].value, ";");
assert.strictEqual(tokens[0].loc.start.line, 1);
assert.strictEqual(tokens[0].loc.start.column, 0);
// 5. Throws SyntaxError on invalid JavaScript syntax
assert.throws(() => {
espree.parse("const 123invalid = ;", { ecmaVersion: "latest" });
}, (err) => {
return err.name === "SyntaxError" && typeof err.lineNumber === "number" && typeof err.column === "number";
});
// 6. Throws SyntaxError when parsing JSX without jsx feature enabled
assert.throws(() => {
espree.parse("const el = <div />;", { ecmaVersion: "latest" });
}, (err) => {
return err.name === "SyntaxError";
});
console.log("espree contract passed");
Seeder d'origine
anonyme