Exemplo
@webassemblyjs/wast-parser 1.14.1
Amostra verificada para npm @webassemblyjs/wast-parser 1.14.1. O contrato rodou em node 22 · linux debian/x64 · docker e passou.
sha256:5f63e853ca4569b33b69763ab951f2d9a18d8a83682cf44d4a0100b4bfe9fb4f
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| 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-04 |
Caso
HOW- Objetivo
- verify pkg:npm/%40webassemblyjs/wast-parser@1.14.1
- Ambiente
- node 22.23.2
- Criado
- 2026-09-04T00:44:47Z
Contrato
- parse converts WebAssembly text format into an AST Program node containing Module definitions
- parse parses function declarations with parameters, return signatures, and instructions into AST nodes
- parse parses memory declarations and module exports with associated limit and type metadata
- parse parses global variable definitions with type and mutability settings
- parse throws an Error when encountering unexpected characters in invalid WebAssembly text
Arquivos
- .npmrc
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- test/contract.mjs
Código-fonte
audit=false
fund=false
update-notifier=false
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/%40webassemblyjs/wast-parser@1.14.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40webassemblyjs/wast-parser@1.14.1
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:82666b4be3c77ba59e5885d08478b61e30b149f6201ec46da7bf01dcf64c4d53","constraints":{"executionContext":"node"},"contract":["parse converts WebAssembly text format into an AST Program node containing Module definitions","parse parses function declarations with parameters, return signatures, and instructions into AST nodes","parse parses memory declarations and module exports with associated limit and type metadata","parse parses global variable definitions with type and mutability settings","parse throws an Error when encountering unexpected characters in invalid WebAssembly text"],"goal":"verify pkg:npm/%40webassemblyjs/wast-parser@1.14.1","kind":"HOW","packages":["pkg:npm/%40webassemblyjs/wast-parser@1.14.1"],"schemaVersion":1},"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/wast-parser@1.14.1"],"schemaVersion":1,"subject":"pkg:npm/%40webassemblyjs/wast-parser@1.14.1","verifierAdapter":"node-typescript@1"}
{
"name": "sample-wast-parser",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-wast-parser",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@webassemblyjs/wast-parser": "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-code-frame": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.14.1.tgz",
"integrity": "sha512-ZwPmnx/YswXJSgsNODu1V8//QDsbGXHq+YKtgACIJktSEVIHJ2rGr/TWCAhGStbWoufwOdTmuKBF5RU+wdMeEg==",
"license": "MIT",
"dependencies": {
"@webassemblyjs/wast-printer": "1.14.1"
}
},
"node_modules/@webassemblyjs/helper-fsm": {
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-fsm/-/helper-fsm-1.13.2.tgz",
"integrity": "sha512-vtjQm5RN9GaL1MfWbY9U/L7a+uJ0rTqG0uHBz/PRH5K2FIFcYdcaUv0Kjfn3GTJPnXuq7sakINnIEZFho0xbfA==",
"license": "ISC"
},
"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/@webassemblyjs/wast-parser": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/@webassemblyjs/wast-parser/-/wast-parser-1.14.1.tgz",
"integrity": "sha512-XLBrfinR+Nw83hSFkgmAtQxQlC00lU92zJSBpMcpKfXalLWCHRpU7lPgSqelA/09BUgArEPCm8TiiUllZQjMnw==",
"license": "MIT",
"dependencies": {
"@webassemblyjs/ast": "1.14.1",
"@webassemblyjs/floating-point-hex-parser": "1.13.2",
"@webassemblyjs/helper-api-error": "1.13.2",
"@webassemblyjs/helper-code-frame": "1.14.1",
"@webassemblyjs/helper-fsm": "1.13.2",
"@xtuc/long": "4.2.2"
}
},
"node_modules/@webassemblyjs/wast-printer": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.14.1.tgz",
"integrity": "sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==",
"license": "MIT",
"dependencies": {
"@webassemblyjs/ast": "1.14.1",
"@xtuc/long": "4.2.2"
}
},
"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-wast-parser",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"@webassemblyjs/wast-parser": "1.14.1"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/%40webassemblyjs/wast-parser@1.14.1",
"kind": "HOW",
"packages": [
"pkg:npm/%40webassemblyjs/wast-parser@1.14.1"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import { parse } from "@webassemblyjs/wast-parser";
export function parseWat(watSource) {
return parse(watSource);
}
import assert from "node:assert/strict";
import { parse } from "@webassemblyjs/wast-parser";
import { parseWat } from "../src/index.mjs";
// Test 1: parse converts WebAssembly text format into an AST Program node containing Module definitions
{
const emptyAst = parse("(module)");
assert.equal(emptyAst.type, "Program");
assert.equal(emptyAst.body.length, 1);
assert.equal(emptyAst.body[0].type, "Module");
assert.equal(emptyAst.body[0].id, null);
assert.deepEqual(emptyAst.body[0].fields, []);
const namedAst = parseWat("(module $math_module)");
assert.equal(namedAst.type, "Program");
assert.equal(namedAst.body[0].id, "math_module");
}
// Test 2: parse parses function declarations with parameters, return signatures, and instructions into AST nodes
{
const wat = "(module (func $add (param $a i32) (param $b i32) (result i32) (i32.add (get_local $a) (get_local $b))))";
const ast = parse(wat);
const fn = ast.body[0].fields[0];
assert.equal(fn.type, "Func");
assert.equal(fn.name.value, "add");
assert.equal(fn.signature.params.length, 2);
assert.equal(fn.signature.params[0].id, "a");
assert.equal(fn.signature.params[0].valtype, "i32");
assert.equal(fn.signature.results[0], "i32");
assert.equal(fn.body[0].id, "add");
assert.equal(fn.body[0].object, "i32");
}
// Test 3: parse parses memory declarations and module exports with associated limit and type metadata
{
const wat = "(module (memory $mem 1 2) (export \"memory\" (memory $mem)))";
const ast = parse(wat);
const mem = ast.body[0].fields[0];
assert.equal(mem.type, "Memory");
assert.equal(mem.limits.min, 1);
assert.equal(mem.limits.max, 2);
const exp = ast.body[0].fields[1];
assert.equal(exp.type, "ModuleExport");
assert.equal(exp.name, "memory");
assert.equal(exp.descr.exportType, "Memory");
}
// Test 4: parse parses global variable definitions with type and mutability settings
{
const wat = "(module (global $counter (mut i32) (i32.const 0)))";
const ast = parse(wat);
const glob = ast.body[0].fields[0];
assert.equal(glob.type, "Global");
assert.equal(glob.name.value, "counter");
assert.equal(glob.globalType.valtype, "i32");
assert.equal(glob.globalType.mutability, "var");
}
// Test 5: parse throws an Error when encountering unexpected characters in invalid WebAssembly text
{
assert.throws(
() => parse("(module @@@)"),
{
name: "Error",
message: /Unexpected character "@"/
}
);
}
console.log("All contract tests passed successfully.");
Seeder de origem
anônimo