Exemple
@babel/runtime 7.29.15: mark
Échantillon vérifié pour npm @babel/runtime 7.29.15: mark. Le contrat s'est exécuté sur node 22 · linux debian/x64 · docker et a réussi.
sha256:9839300e0c51a63ce177b0ea6f859e25af90e31b6a6c5bf0a8aa194b13d1ca80
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-11-21 |
Cas
HOW- Objectif
- verify @babel/runtime.mark in pkg:npm/%40babel/runtime@7.29.15
- Paquets
- Symboles
-
- @babel/runtime.mark
- Environnement
- node 22.23.2
- Créé
- 2026-11-21T23:06:56Z
Contrat
- require('@babel/runtime') throws ERR_PACKAGE_PATH_NOT_EXPORTED; mark is exposed via @babel/runtime/regenerator and @babel/runtime/helpers/regeneratorRuntime
- regeneratorRuntime.mark is identical to require('@babel/runtime/helpers/regeneratorRuntime')().mark
- regeneratorRuntime.mark(fn) returns fn in place, makes regeneratorRuntime.isGeneratorFunction(fn) true, sets Object.prototype.toString.call(fn) to '[object GeneratorFunction]', and installs Generator prototype methods on fn.prototype
- calling a marked generator returns an iterable Generator instance (instanceof marked, Symbol.iterator returns self, toString is '[object Generator]')
- generator instances support next() with sent values, Array.from/for..of iteration, early return(value), and throw(err) termination
- regeneratorRuntime.mark(null) throws TypeError
Fichiers
- PROMPT.md
- csx.json
- index.js
- 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 @babel/runtime.mark in pkg:npm/%40babel/runtime@7.29.15
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40babel/runtime@7.29.15
Demonstrate these symbols/APIs:
- @babel/runtime.mark
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:d60f763eceadb963a9ccd27a7b4e1c4d7b5f2cf91fbd435467f9fda17cd522d2","constraints":{"executionContext":"node"},"contract":["require('@babel/runtime') throws ERR_PACKAGE_PATH_NOT_EXPORTED; mark is exposed via @babel/runtime/regenerator and @babel/runtime/helpers/regeneratorRuntime","regeneratorRuntime.mark is identical to require('@babel/runtime/helpers/regeneratorRuntime')().mark","regeneratorRuntime.mark(fn) returns fn in place, makes regeneratorRuntime.isGeneratorFunction(fn) true, sets Object.prototype.toString.call(fn) to '[object GeneratorFunction]', and installs Generator prototype methods on fn.prototype","calling a marked generator returns an iterable Generator instance (instanceof marked, Symbol.iterator returns self, toString is '[object Generator]')","generator instances support next() with sent values, Array.from/for..of iteration, early return(value), and throw(err) termination","regeneratorRuntime.mark(null) throws TypeError"],"goal":"verify @babel/runtime.mark in pkg:npm/%40babel/runtime@7.29.15","kind":"HOW","packages":["pkg:npm/%40babel/runtime@7.29.15"],"schemaVersion":1,"symbols":["@babel/runtime.mark"]},"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/%40babel/runtime@7.29.15"],"schemaVersion":1,"subject":"pkg:npm/%40babel/runtime@7.29.15","symbols":["@babel/runtime.mark"],"verifierAdapter":"node-typescript@1"}
"use strict";
const regeneratorRuntime = require("@babel/runtime/regenerator");
const getRegeneratorRuntime = require("@babel/runtime/helpers/regeneratorRuntime");
function createCounterGeneratorFactory() {
const marked = regeneratorRuntime.mark(function counter(start, end) {
let current;
let step;
return regeneratorRuntime.wrap(function counter$(ctx) {
while (true) {
switch ((ctx.prev = ctx.next)) {
case 0:
current = start;
case 1:
if (!(current <= end)) {
ctx.next = 7;
break;
}
ctx.next = 4;
return current;
case 4:
step = ctx.sent;
current += typeof step === "number" ? step : 1;
ctx.next = 1;
break;
case 7:
return ctx.abrupt("return", current);
case 8:
case "end":
return ctx.stop();
}
}
}, marked);
});
return marked;
}
module.exports = {
regeneratorRuntime,
getRegeneratorRuntime,
createCounterGeneratorFactory,
};
{
"name": "babel-runtime-mark-sample",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "babel-runtime-mark-sample",
"version": "1.0.0",
"dependencies": {
"@babel/runtime": "7.29.15"
}
},
"node_modules/@babel/runtime": {
"version": "7.29.15",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.15.tgz",
"integrity": "sha512-304gsbbGVmQc+cNGHzwHBlqepYdWLKj3VXCQBGt/EGcV7PUPfKI7kAUNW1FZEOCwlQiLvQjg1JEaAlRQ616h+Q==",
"license": "MIT",
"engines": {
"node": ">=6.9.0"
}
}
}
}
{
"name": "babel-runtime-mark-sample",
"version": "1.0.0",
"private": true,
"description": "Minimal verification of @babel/runtime.mark via @babel/runtime/regenerator",
"main": "index.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"@babel/runtime": "7.29.15"
}
}
{
"schemaVersion": 1,
"goal": "verify @babel/runtime.mark in pkg:npm/%40babel/runtime@7.29.15",
"kind": "HOW",
"packages": [
"pkg:npm/%40babel/runtime@7.29.15"
],
"symbols": [
"@babel/runtime.mark"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
"use strict";
const assert = require("node:assert/strict");
const {
regeneratorRuntime,
getRegeneratorRuntime,
createCounterGeneratorFactory,
} = require("../index.js");
// 1. Root import is not exported; mark must be accessed via subpath exports.
assert.throws(
() => require("@babel/runtime"),
(err) => err && err.code === "ERR_PACKAGE_PATH_NOT_EXPORTED"
);
// 2. Subpath exports expose the same mark function.
const helperRuntime = getRegeneratorRuntime();
assert.equal(typeof regeneratorRuntime.mark, "function");
assert.equal(regeneratorRuntime.mark, helperRuntime.mark);
// 3. mark() mutates and returns the target function with GeneratorFunction prototype and Generator.prototype.
function plainFn() {}
assert.equal(regeneratorRuntime.isGeneratorFunction(plainFn), false);
function rawFn() {
return regeneratorRuntime.wrap(function rawFn$(ctx) {
switch ((ctx.prev = ctx.next)) {
case 0:
return ctx.stop();
}
}, rawFn);
}
const markedRaw = regeneratorRuntime.mark(rawFn);
assert.equal(markedRaw, rawFn);
assert.equal(regeneratorRuntime.isGeneratorFunction(markedRaw), true);
assert.equal(
Object.prototype.toString.call(markedRaw),
"[object GeneratorFunction]"
);
assert.equal(typeof markedRaw.prototype.next, "function");
assert.equal(typeof markedRaw.prototype.throw, "function");
assert.equal(typeof markedRaw.prototype.return, "function");
// 4. Calling a marked generator produces a Generator instance inheriting from marked.prototype.
const counterGen = createCounterGeneratorFactory();
assert.equal(regeneratorRuntime.isGeneratorFunction(counterGen), true);
const iter = counterGen(1, 5);
assert.equal(iter instanceof counterGen, true);
assert.equal(Object.getPrototypeOf(iter), counterGen.prototype);
assert.equal(Object.prototype.toString.call(iter), "[object Generator]");
assert.equal(iter[Symbol.iterator](), iter);
// 5. Stepping with next() yields values, receives sent values, and completes with the return value.
assert.deepEqual(iter.next(), { value: 1, done: false });
assert.deepEqual(iter.next(2), { value: 3, done: false });
assert.deepEqual(iter.next(2), { value: 5, done: false });
assert.deepEqual(iter.next(1), { value: 6, done: true });
assert.deepEqual(iter.next(), { value: undefined, done: true });
// 6. Standard for..of iteration works over the marked generator.
assert.deepEqual(Array.from(counterGen(2, 4)), [2, 3, 4]);
// 7. Early return() terminates the generator and returns the provided completion value.
const earlyReturnIter = counterGen(10, 20);
assert.deepEqual(earlyReturnIter.next(), { value: 10, done: false });
assert.deepEqual(earlyReturnIter.return("stopped"), {
value: "stopped",
done: true,
});
assert.deepEqual(earlyReturnIter.next(), { value: undefined, done: true });
// 8. throw() propagates the error and closes the generator.
const throwingIter = counterGen(1, 3);
assert.deepEqual(throwingIter.next(), { value: 1, done: false });
assert.throws(
() => throwingIter.throw(new Error("injected failure")),
/injected failure/
);
assert.deepEqual(throwingIter.next(), { value: undefined, done: true });
// 9. Passing a non-object (such as null) to mark() throws a TypeError.
assert.throws(() => regeneratorRuntime.mark(null), TypeError);
Seeder d'origine
anonyme