サンプル
@webassemblyjs/ast 1.14.1: objectInstruction
検証済みサンプル — npm @webassemblyjs/ast 1.14.1: objectInstruction. node 22 · linux debian/x64 · docker で contract を実行し、成功しました: @webassemblyjs/ast exports…
sha256:781fc359b9b65989c5057466037c95a29819fb4521e5325444ac0e93a89ab76c
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 1
- ビルドした署名鍵
- 1
宣言された環境
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| 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 |
ケース
HOW- ゴール
- verify objectInstruction in pkg:npm/%40webassemblyjs/ast@1.14.1
- シンボル
-
- objectInstruction
- 環境
- node 22.23.2
- 作成日
- 2026-09-01T19:56:55Z
コントラクト
- @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
ファイル
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
ソース
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.');
オリジンシーダー
匿名