Ejemplo
@tootallnate/quickjs-emscripten 0.23.0: getQuickJSSync
Muestra verificada para npm @tootallnate/quickjs-emscripten 0.23.0: getQuickJSSync. El contrato se ejecutó en node 22 · linux debian/x64 · docker y pasó.
sha256:7221f8d39f00498256b06ade7078d882fa311c48f81d2bf1d6ed0eb876ecfdf6
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-07 |
Caso
HOW- Objetivo
- verify @tootallnate/quickjs-emscripten.getQuickJSSync in pkg:npm/%40tootallnate/quickjs-emscripten@0.23.0
- Símbolos
-
- @tootallnate/quickjs-emscripten.getQuickJSSync
- Entorno
- node 22.23.2
- Creado
- 2026-09-07T03:25:45Z
Contrato
- getQuickJSSync throws an Error when called before getQuickJS has resolved
- getQuickJSSync returns the shared QuickJSWASMModule singleton after getQuickJS resolves
- getQuickJSSync returns identical instance references across multiple synchronous calls
- getQuickJSSync module instance evaluates Javascript expressions directly via evalCode
- getQuickJSSync module evalCode propagates unhandled script exceptions as native errors
- getQuickJSSync module newContext creates isolated execution environments with independent globals and memory management
- getQuickJSSync module newRuntime creates isolated runtime instances with custom memory limits
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 @tootallnate/quickjs-emscripten.getQuickJSSync in pkg:npm/%40tootallnate/quickjs-emscripten@0.23.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40tootallnate/quickjs-emscripten@0.23.0
Demonstrate these symbols/APIs:
- @tootallnate/quickjs-emscripten.getQuickJSSync
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:5ce0cfa1ec86fb906b8347a75f3e1f0f1d72a9bdc941660ebe3a0268cbacd79b","constraints":{"executionContext":"node"},"contract":["getQuickJSSync throws an Error when called before getQuickJS has resolved","getQuickJSSync returns the shared QuickJSWASMModule singleton after getQuickJS resolves","getQuickJSSync returns identical instance references across multiple synchronous calls","getQuickJSSync module instance evaluates Javascript expressions directly via evalCode","getQuickJSSync module evalCode propagates unhandled script exceptions as native errors","getQuickJSSync module newContext creates isolated execution environments with independent globals and memory management","getQuickJSSync module newRuntime creates isolated runtime instances with custom memory limits"],"goal":"verify @tootallnate/quickjs-emscripten.getQuickJSSync in pkg:npm/%40tootallnate/quickjs-emscripten@0.23.0","kind":"HOW","packages":["pkg:npm/%40tootallnate/quickjs-emscripten@0.23.0"],"schemaVersion":1,"symbols":["@tootallnate/quickjs-emscripten.getQuickJSSync"]},"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/%40tootallnate/quickjs-emscripten@0.23.0"],"schemaVersion":1,"subject":"pkg:npm/%40tootallnate/quickjs-emscripten@0.23.0","symbols":["@tootallnate/quickjs-emscripten.getQuickJSSync"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-quickjs-emscripten-getquickjssync",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-quickjs-emscripten-getquickjssync",
"version": "1.0.0",
"dependencies": {
"@tootallnate/quickjs-emscripten": "0.23.0"
}
},
"node_modules/@tootallnate/quickjs-emscripten": {
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz",
"integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==",
"license": "MIT"
}
}
}
{
"name": "sample-quickjs-emscripten-getquickjssync",
"version": "1.0.0",
"private": true,
"description": "Clean-room code sample for @tootallnate/quickjs-emscripten getQuickJSSync",
"license": "MIT-0",
"dependencies": {
"@tootallnate/quickjs-emscripten": "0.23.0"
}
}
{
"schemaVersion": 1,
"goal": "verify @tootallnate/quickjs-emscripten.getQuickJSSync in pkg:npm/%40tootallnate/quickjs-emscripten@0.23.0",
"kind": "HOW",
"packages": [
"pkg:npm/%40tootallnate/quickjs-emscripten@0.23.0"
],
"symbols": [
"@tootallnate/quickjs-emscripten.getQuickJSSync"
]
}
import assert from 'node:assert/strict';
import { getQuickJS, getQuickJSSync } from '@tootallnate/quickjs-emscripten';
// 1. getQuickJSSync throws an Error when called before getQuickJS has resolved
assert.throws(
() => getQuickJSSync(),
{
name: 'Error',
message: 'QuickJS not initialized. Await getQuickJS() at least once.'
}
);
// 2. getQuickJSSync returns the shared QuickJSWASMModule singleton after getQuickJS resolves
const asyncModule = await getQuickJS();
const syncModule = getQuickJSSync();
assert.equal(syncModule, asyncModule);
// 3. getQuickJSSync returns identical instance references across multiple synchronous calls
const secondCall = getQuickJSSync();
assert.equal(secondCall, syncModule);
// 4. getQuickJSSync module instance evaluates Javascript expressions directly via evalCode
const evalResult = syncModule.evalCode('JSON.stringify({ sum: [1, 2, 3, 4].reduce((a, b) => a + b, 0) })');
assert.equal(evalResult, JSON.stringify({ sum: 10 }));
// 5. getQuickJSSync module evalCode propagates unhandled script exceptions as native errors
assert.throws(
() => {
syncModule.evalCode('throw new TypeError("invalid type in vm")');
},
(err) => err && err.name === 'TypeError' && err.message === 'invalid type in vm'
);
// 6. getQuickJSSync module newContext creates isolated execution environments with independent globals and memory management
const ctx1 = syncModule.newContext();
const ctx2 = syncModule.newContext();
try {
const h1 = ctx1.evalCode('globalThis.x = 42; globalThis.x');
const h2 = ctx2.evalCode('typeof globalThis.x');
assert.equal(ctx1.dump(h1.value), 42);
assert.equal(ctx2.dump(h2.value), 'undefined');
h1.value.dispose();
h2.value.dispose();
} finally {
ctx1.dispose();
ctx2.dispose();
}
// 7. getQuickJSSync module newRuntime creates isolated runtime instances with custom memory limits
const rt = syncModule.newRuntime({ memoryLimitBytes: 1024 * 1024 });
const ctx = rt.newContext();
try {
const result = ctx.evalCode('2 ** 10');
assert.equal(ctx.dump(result.value), 1024);
result.value.dispose();
} finally {
ctx.dispose();
rt.dispose();
}
Seeder de origen
anónimo