Пример
@tootallnate/quickjs-emscripten 0.23.0: getQuickJSSync
Проверенный пример — npm @tootallnate/quickjs-emscripten 0.23.0: getQuickJSSync. Контракт выполнен на node 22 · linux debian/x64 · docker и пройден.
sha256:7221f8d39f00498256b06ade7078d882fa311c48f81d2bf1d6ed0eb876ecfdf6
Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла.
Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди.
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-07 |
Кейс
HOW- Цель
- verify @tootallnate/quickjs-emscripten.getQuickJSSync in pkg:npm/%40tootallnate/quickjs-emscripten@0.23.0
- Символы
-
- @tootallnate/quickjs-emscripten.getQuickJSSync
- Окружение
- node 22.23.2
- Создан
- 2026-09-07T03:25:45Z
Контракт
- 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
Файлы
- 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 @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();
}
Исходный сидер
аноним