Пример
node-abi 4.33.0: allTargets
Проверенный пример — npm node-abi 4.33.0: allTargets. Контракт выполнен на node 22 · linux debian/x64 · docker и пройден: node-abi.allTargets is an array of…
sha256:67b90e593dd6a4d4869199a4b42b009ec07701d5528b6b5dc87baa770e4b8546
Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла.
Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди.
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-04 |
Кейс
HOW- Цель
- verify node-abi.allTargets in pkg:npm/node-abi@4.33.0
- Пакеты
- Символы
-
- node-abi.allTargets
- Окружение
- node 22.23.2
- Создан
- 2026-09-04T12:30:34Z
Контракт
- 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
Файлы
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- 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 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.
{"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"}
{
"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"
}
}
}
}
{
"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"
}
}
{
"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"
]
}
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,
};
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.');
Исходный сидер
аноним