Ejemplo
@webassemblyjs/ast 1.14.1: objectInstruction
Muestra verificada para npm @webassemblyjs/ast 1.14.1: objectInstruction. El contrato se ejecutó en node 22 · linux debian/x64 · docker y pasó.
sha256:781fc359b9b65989c5057466037c95a29819fb4521e5325444ac0e93a89ab76c
Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido.
Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas.
MIT-0
Evidencia de ejecución
El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.
- Base de evidencia
- Contrato firmado aprobado
- Recibos de verificación
- 1
- Claves de firma que lo compilaron
- 1
Entorno declarado
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| 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-01 |
Caso
HOW- Objetivo
- verify objectInstruction in pkg:npm/%40webassemblyjs/ast@1.14.1
- Paquetes
- Símbolos
-
- objectInstruction
- Entorno
- node 22.23.2
- Creado
- 2026-09-01T19:56:55Z
Contrato
- @webassemblyjs/ast exports objectInstruction builder function
- objectInstruction creates an Instr node with id and object properties and default empty args
- objectInstruction accepts custom instruction args and sets them on the Instr node
- objectInstruction accepts namedArgs options and sets them on the Instr node
- isInstr recognizes nodes created by objectInstruction as valid Instr nodes
- traverse visits Instr nodes created by objectInstruction
Archivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Código fuente
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 objectInstruction in pkg:npm/%40webassemblyjs/ast@1.14.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40webassemblyjs/ast@1.14.1
Demonstrate these symbols/APIs:
- objectInstruction
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:8c63d1b09e652455e54cfb470a59ad736fae08fbc98f07f463fe8974bd591ad7","constraints":{"executionContext":"node"},"contract":["@webassemblyjs/ast exports objectInstruction builder function","objectInstruction creates an Instr node with id and object properties and default empty args","objectInstruction accepts custom instruction args and sets them on the Instr node","objectInstruction accepts namedArgs options and sets them on the Instr node","isInstr recognizes nodes created by objectInstruction as valid Instr nodes","traverse visits Instr nodes created by objectInstruction"],"goal":"verify objectInstruction in pkg:npm/%40webassemblyjs/ast@1.14.1","kind":"HOW","packages":["pkg:npm/%40webassemblyjs/ast@1.14.1"],"schemaVersion":1,"symbols":["objectInstruction"]},"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/%40webassemblyjs/ast@1.14.1"],"schemaVersion":1,"subject":"pkg:npm/%40webassemblyjs/ast@1.14.1","symbols":["objectInstruction"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-webassemblyjs-ast-object-instruction",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-webassemblyjs-ast-object-instruction",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@webassemblyjs/ast": "1.14.1"
}
},
"node_modules/@webassemblyjs/ast": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.14.1.tgz",
"integrity": "sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==",
"license": "MIT",
"dependencies": {
"@webassemblyjs/helper-numbers": "1.13.2",
"@webassemblyjs/helper-wasm-bytecode": "1.13.2"
}
},
"node_modules/@webassemblyjs/floating-point-hex-parser": {
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.13.2.tgz",
"integrity": "sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==",
"license": "MIT"
},
"node_modules/@webassemblyjs/helper-api-error": {
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.13.2.tgz",
"integrity": "sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==",
"license": "MIT"
},
"node_modules/@webassemblyjs/helper-numbers": {
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.13.2.tgz",
"integrity": "sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==",
"license": "MIT",
"dependencies": {
"@webassemblyjs/floating-point-hex-parser": "1.13.2",
"@webassemblyjs/helper-api-error": "1.13.2",
"@xtuc/long": "4.2.2"
}
},
"node_modules/@webassemblyjs/helper-wasm-bytecode": {
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.13.2.tgz",
"integrity": "sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==",
"license": "MIT"
},
"node_modules/@xtuc/long": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz",
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==",
"license": "Apache-2.0"
}
}
}
{
"name": "sample-webassemblyjs-ast-object-instruction",
"version": "1.0.0",
"type": "module",
"private": true,
"license": "MIT-0",
"dependencies": {
"@webassemblyjs/ast": "1.14.1"
}
}
{
"schemaVersion": 1,
"goal": "verify objectInstruction in pkg:npm/%40webassemblyjs/ast@1.14.1",
"kind": "HOW",
"packages": [
"pkg:npm/%40webassemblyjs/ast@1.14.1"
],
"symbols": [
"objectInstruction"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import assert from 'node:assert/strict';
import {
objectInstruction,
isInstr,
traverse,
identifier,
numberLiteralFromRaw,
} from '@webassemblyjs/ast';
// 1. @webassemblyjs/ast exports objectInstruction builder function
assert.equal(typeof objectInstruction, 'function');
// 2. objectInstruction creates an Instr node with id and object properties and default empty args
const nopNode = objectInstruction('nop', 'test');
assert.equal(nopNode.type, 'Instr');
assert.equal(nopNode.id, 'nop');
assert.equal(nopNode.object, 'test');
assert.deepEqual(nopNode.args, []);
// 3. objectInstruction accepts custom instruction args and sets them on the Instr node
const constNode = objectInstruction('const', 'i32', [numberLiteralFromRaw(42)]);
assert.equal(constNode.type, 'Instr');
assert.equal(constNode.id, 'const');
assert.equal(constNode.object, 'i32');
assert.equal(constNode.args.length, 1);
assert.equal(constNode.args[0].type, 'NumberLiteral');
assert.equal(constNode.args[0].value, 42);
// 4. objectInstruction accepts namedArgs options and sets them on the Instr node
const offsetArg = numberLiteralFromRaw(4);
const loadNode = objectInstruction('load', 'i32', [numberLiteralFromRaw(0)], { offset: offsetArg });
assert.equal(loadNode.type, 'Instr');
assert.equal(loadNode.id, 'load');
assert.equal(loadNode.object, 'i32');
assert.ok(loadNode.namedArgs);
assert.equal(loadNode.namedArgs.offset, offsetArg);
// 5. isInstr recognizes nodes created by objectInstruction as valid Instr nodes
assert.equal(isInstr(nopNode), true);
assert.equal(isInstr(constNode), true);
assert.equal(isInstr(loadNode), true);
// 6. traverse visits Instr nodes created by objectInstruction
let visited = false;
traverse(constNode, {
Instr(path) {
if (path.node.id === 'const' && path.node.object === 'i32') {
visited = true;
}
},
});
assert.equal(visited, true);
console.log('All contract tests passed.');
Seeder de origen
anónimo