CodeSampleX

Beispiel

node-abi 4.33.0: allTargets

Verifiziertes Beispiel für npm node-abi 4.33.0: allTargets. Der Vertrag lief auf node 22 · linux debian/x64 · docker und bestand.

sha256:67b90e593dd6a4d4869199a4b42b009ec07701d5528b6b5dc87baa770e4b8546

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-04

Fall

HOW
Ziel
verify node-abi.allTargets in pkg:npm/node-abi@4.33.0
Pakete
Symbole
  • node-abi.allTargets
Umgebung
node 22.23.2
Erstellt
2026-09-04T12:30:34Z

Contract

  1. node-abi.allTargets is an array of target specification objects
  2. each target object in node-abi.allTargets defines runtime, target, abi, and lts properties
  3. node-abi.allTargets contains target objects for node, electron, and node-webkit runtimes
  4. node-abi.allTargets target property specifies the version string and abi specifies the corresponding ABI string
  5. node-abi.allTargets lts property indicates long-term support status as a boolean
  6. node-abi.allTargets aggregates targets across supported, deprecated, future, and additional target sets

Dateien

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.js
  • 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 node-abi.allTargets in pkg:npm/node-abi@4.33.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/node-abi@4.33.0
Demonstrate these symbols/APIs:
  - node-abi.allTargets

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:604dd34b6a4933012e6345769a691aa7ca03ae72874a52f34bc32c0b6a07cdaf","constraints":{"executionContext":"node"},"contract":["node-abi.allTargets is an array of target specification objects","each target object in node-abi.allTargets defines runtime, target, abi, and lts properties","node-abi.allTargets contains target objects for node, electron, and node-webkit runtimes","node-abi.allTargets target property specifies the version string and abi specifies the corresponding ABI string","node-abi.allTargets lts property indicates long-term support status as a boolean","node-abi.allTargets aggregates targets across supported, deprecated, future, and additional target sets"],"goal":"verify node-abi.allTargets in pkg:npm/node-abi@4.33.0","kind":"HOW","packages":["pkg:npm/node-abi@4.33.0"],"schemaVersion":1,"symbols":["node-abi.allTargets"]},"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/node-abi@4.33.0"],"schemaVersion":1,"subject":"pkg:npm/node-abi@4.33.0","symbols":["node-abi.allTargets"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-node-abi-alltargets",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-node-abi-alltargets",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "node-abi": "4.33.0"
      }
    },
    "node_modules/node-abi": {
      "version": "4.33.0",
      "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-4.33.0.tgz",
      "integrity": "sha512-vLBWCKb+7LWsX+TbfzWOkw0W81m377tyx3hOweBTjO43CXZnRGS1/JPWs20fr0PgZyDXk6ROYrylsEycK8raDA==",
      "license": "MIT",
      "dependencies": {
        "semver": "^7.6.3"
      },
      "engines": {
        "node": ">=22.12.0"
      }
    },
    "node_modules/semver": {
      "version": "7.8.5",
      "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
      "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
      "license": "ISC",
      "bin": {
        "semver": "bin/semver.js"
      },
      "engines": {
        "node": ">=10"
      }
    }
  }
}
package.json
{
  "name": "sample-node-abi-alltargets",
  "version": "1.0.0",
  "private": true,
  "description": "verify node-abi.allTargets in pkg:npm/node-abi@4.33.0",
  "main": "src/index.js",
  "license": "MIT-0",
  "dependencies": {
    "node-abi": "4.33.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify node-abi.allTargets in pkg:npm/node-abi@4.33.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/node-abi@4.33.0"
  ],
  "symbols": [
    "node-abi.allTargets"
  ]
}
src/index.js
const nodeAbi = require('node-abi');

/**
 * Returns all targets exported by node-abi.
 * @returns {Array<{runtime: string, target: string, abi: string, lts: boolean}>}
 */
function getAllTargets() {
  return nodeAbi.allTargets;
}

/**
 * Filters targets by runtime name (e.g. 'node', 'electron', 'node-webkit').
 * @param {string} runtime
 * @returns {Array<{runtime: string, target: string, abi: string, lts: boolean}>}
 */
function getTargetsByRuntime(runtime) {
  return nodeAbi.allTargets.filter((t) => t.runtime === runtime);
}

/**
 * Finds a target by runtime and version target string.
 * @param {string} runtime
 * @param {string} target
 * @returns {{runtime: string, target: string, abi: string, lts: boolean} | undefined}
 */
function findTarget(runtime, target) {
  return nodeAbi.allTargets.find((t) => t.runtime === runtime && t.target === target);
}

/**
 * Finds targets by ABI version.
 * @param {string} abi
 * @returns {Array<{runtime: string, target: string, abi: string, lts: boolean}>}
 */
function getTargetsByAbi(abi) {
  return nodeAbi.allTargets.filter((t) => t.abi === abi);
}

module.exports = {
  allTargets: nodeAbi.allTargets,
  getAllTargets,
  getTargetsByRuntime,
  findTarget,
  getTargetsByAbi,
};
test/contract.mjs
import assert from 'node:assert';
import { createRequire } from 'node:module';

const require = createRequire(import.meta.url);
const nodeAbi = require('node-abi');
const {
  allTargets,
  getAllTargets,
  getTargetsByRuntime,
  findTarget,
  getTargetsByAbi,
} = require('../src/index.js');

// 1. node-abi.allTargets is an array of target specification objects
assert.strictEqual(Array.isArray(nodeAbi.allTargets), true, 'node-abi.allTargets must be an array');
assert.strictEqual(Array.isArray(allTargets), true, 'allTargets export must be an array');
assert.strictEqual(getAllTargets(), nodeAbi.allTargets, 'getAllTargets() must return nodeAbi.allTargets');
assert.ok(nodeAbi.allTargets.length > 0, 'node-abi.allTargets must not be empty');

// 2. Each target object defines runtime, target, abi, and lts properties
for (const target of nodeAbi.allTargets) {
  assert.strictEqual(typeof target.runtime, 'string', 'target.runtime must be a string');
  assert.ok(target.runtime.length > 0, 'target.runtime must not be empty');

  assert.strictEqual(typeof target.target, 'string', 'target.target must be a string');
  assert.ok(target.target.length > 0, 'target.target must not be empty');

  assert.strictEqual(typeof target.abi, 'string', 'target.abi must be a string');
  assert.ok(target.abi.length > 0, 'target.abi must not be empty');

  assert.strictEqual(typeof target.lts, 'boolean', 'target.lts must be a boolean');
}

// 3. node-abi.allTargets contains target objects for node, electron, and node-webkit runtimes
const runtimes = new Set(nodeAbi.allTargets.map((t) => t.runtime));
assert.ok(runtimes.has('node'), 'allTargets must contain node targets');
assert.ok(runtimes.has('electron'), 'allTargets must contain electron targets');
assert.ok(runtimes.has('node-webkit'), 'allTargets must contain node-webkit targets');

const nodeTargets = getTargetsByRuntime('node');
assert.ok(nodeTargets.length > 0, 'must have node targets');
assert.ok(nodeTargets.every((t) => t.runtime === 'node'), 'all returned targets must have runtime node');

const electronTargets = getTargetsByRuntime('electron');
assert.ok(electronTargets.length > 0, 'must have electron targets');
assert.ok(electronTargets.every((t) => t.runtime === 'electron'), 'all returned targets must have runtime electron');

// 4. node-abi.allTargets target property specifies the version string and abi specifies the corresponding ABI string
const knownNodeTarget = findTarget('node', '0.2.0');
assert.ok(knownNodeTarget, 'must find node target 0.2.0');
assert.strictEqual(knownNodeTarget.abi, '1', 'node target 0.2.0 ABI must be 1');

const knownElectronTarget = findTarget('electron', '44.0.0-alpha.1');
assert.ok(knownElectronTarget, 'must find electron target 44.0.0-alpha.1');
assert.strictEqual(knownElectronTarget.abi, '149', 'electron target 44.0.0-alpha.1 ABI must be 149');

const abi1Targets = getTargetsByAbi('1');
assert.ok(abi1Targets.length > 0, 'must find targets with ABI 1');
assert.ok(abi1Targets.some((t) => t.runtime === 'node' && t.target === '0.2.0'), 'ABI 1 targets must include node 0.2.0');

// 5. node-abi.allTargets lts property indicates long-term support status as a boolean
const ltsTargets = nodeAbi.allTargets.filter((t) => t.lts === true);
assert.ok(ltsTargets.length > 0, 'there must be at least one target marked as LTS');
assert.ok(ltsTargets.every((t) => t.runtime === 'node'), 'all LTS targets must belong to node runtime');

// 6. node-abi.allTargets aggregates targets across supported, deprecated, future, and additional target sets
const totalConstituents =
  nodeAbi.supportedTargets.length +
  nodeAbi.deprecatedTargets.length +
  nodeAbi.futureTargets.length +
  nodeAbi.additionalTargets.length;
assert.strictEqual(
  nodeAbi.allTargets.length,
  totalConstituents,
  'allTargets length must equal sum of supported, deprecated, future, and additional targets'
);

console.log('All contract tests passed.');

Ursprungs-Seeder

anonym