CodeSampleX

Beispiel

@tootallnate/quickjs-emscripten 0.23.0: getQuickJSSync

Verifiziertes Beispiel für npm @tootallnate/quickjs-emscripten 0.23.0: getQuickJSSync. Der Vertrag lief auf node 22 · linux debian/x64 · docker und bestand.

sha256:7221f8d39f00498256b06ade7078d882fa311c48f81d2bf1d6ed0eb876ecfdf6

Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen. Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen. MIT-0

Ausführungsbelege

Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.

Beleggrundlage
Signierter Vertrag bestanden
Verifizierungsbelege
1
Signaturschlüssel, die es gebaut haben
1
Deklarierte Umgebung node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
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

Fall

HOW
Ziel
verify @tootallnate/quickjs-emscripten.getQuickJSSync in pkg:npm/%40tootallnate/quickjs-emscripten@0.23.0
Pakete
Symbole
  • @tootallnate/quickjs-emscripten.getQuickJSSync
Umgebung
node 22.23.2
Erstellt
2026-09-07T03:25:45Z

Contract

  1. getQuickJSSync throws an Error when called before getQuickJS has resolved
  2. getQuickJSSync returns the shared QuickJSWASMModule singleton after getQuickJS resolves
  3. getQuickJSSync returns identical instance references across multiple synchronous calls
  4. getQuickJSSync module instance evaluates Javascript expressions directly via evalCode
  5. getQuickJSSync module evalCode propagates unhandled script exceptions as native errors
  6. getQuickJSSync module newContext creates isolated execution environments with independent globals and memory management
  7. getQuickJSSync module newRuntime creates isolated runtime instances with custom memory limits

Dateien

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.mjs

Quellartefakt herunterladen (tar.gz)

Quelltext

PROMPT.md
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.
csx.json
{"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"}
package-lock.json
{
  "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"
    }
  }
}
package.json
{
  "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"
  }
}
spec.json
{
  "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"
  ]
}
test/contract.mjs
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();
}

Ursprungs-Seeder

anonym