샘플
node-abi 4.33.0: supportedTargets
검증된 샘플 — npm node-abi 4.33.0: supportedTargets. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: supportedTargets is exported as an array from…
sha256:0995083e3478743bd310f533765717359b88b42e6ccea6ecaf38a15f71d1a99a
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
linux 24 · ubuntu · glibc 2.39 x64 npm
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| 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.supportedTargets in pkg:npm/node-abi@4.33.0
- 패키지
- 심벌
-
- node-abi.supportedTargets
- 생성일
- 2026-09-04T12:51:50Z
컨트랙트
- supportedTargets is exported as an array from node-abi
- supportedTargets contains target objects each having string properties runtime, target, abi, and boolean lts
- supportedTargets contains targets for both node and electron runtimes
- supportedTargets includes major Node.js releases such as 22.0.0 with ABI 127 and 20.0.0 with ABI 115
- supportedTargets includes Electron release targets such as 30.0.0-alpha.1 with ABI 123
- supportedTargets contains LTS targets marked with lts boolean true
- all targets in supportedTargets are consistent with getAbi mapping
- isTargetSupported correctly detects supported and unsupported versions for node and electron runtimes
파일
- 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.supportedTargets 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.supportedTargets
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:31b7941fddc921f6805143bee74d59b6d43d0d3d7100bc280e69332fa6f3b490","contract":["supportedTargets is exported as an array from node-abi","supportedTargets contains target objects each having string properties runtime, target, abi, and boolean lts","supportedTargets contains targets for both node and electron runtimes","supportedTargets includes major Node.js releases such as 22.0.0 with ABI 127 and 20.0.0 with ABI 115","supportedTargets includes Electron release targets such as 30.0.0-alpha.1 with ABI 123","supportedTargets contains LTS targets marked with lts boolean true","all targets in supportedTargets are consistent with getAbi mapping","isTargetSupported correctly detects supported and unsupported versions for node and electron runtimes"],"goal":"verify node-abi.supportedTargets in pkg:npm/node-abi@4.33.0","kind":"HOW","packages":["pkg:npm/node-abi@4.33.0"],"schemaVersion":1,"symbols":["node-abi.supportedTargets"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","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.supportedTargets"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-node-abi",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-node-abi",
"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",
"version": "1.0.0",
"private": true,
"description": "Clean-room code sample for node-abi supportedTargets in node-abi@4.33.0",
"main": "src/index.js",
"license": "MIT-0",
"dependencies": {
"node-abi": "4.33.0"
}
}
{
"schemaVersion": 1,
"goal": "verify node-abi.supportedTargets in pkg:npm/node-abi@4.33.0",
"kind": "HOW",
"packages": [
"pkg:npm/node-abi@4.33.0"
],
"symbols": [
"node-abi.supportedTargets"
]
}
const nodeAbi = require('node-abi');
/**
* Returns the array of supported target descriptors.
*
* @returns {Array<object>} Supported targets array.
*/
function getSupportedTargets() {
return nodeAbi.supportedTargets;
}
/**
* Filters supported targets by runtime ('node' or 'electron').
*
* @param {string} runtime - Target runtime name ('node' or 'electron').
* @returns {Array<object>} Filtered supported target descriptors.
*/
function getSupportedTargetsByRuntime(runtime) {
return nodeAbi.supportedTargets.filter((target) => target.runtime === runtime);
}
/**
* Checks if a specific target version is present in supportedTargets for a given runtime.
*
* @param {string} targetVersion - Runtime target version string (e.g. '22.0.0').
* @param {string} [runtime='node'] - Target runtime ('node' or 'electron').
* @returns {boolean} True if target is in supportedTargets.
*/
function isTargetSupported(targetVersion, runtime = 'node') {
return nodeAbi.supportedTargets.some(
(t) => t.runtime === runtime && t.target === targetVersion
);
}
/**
* Finds target descriptor in supportedTargets for a given target version and runtime.
*
* @param {string} targetVersion - Runtime target version string.
* @param {string} [runtime='node'] - Target runtime ('node' or 'electron').
* @returns {object|undefined} The target object if found.
*/
function findSupportedTarget(targetVersion, runtime = 'node') {
return nodeAbi.supportedTargets.find(
(t) => t.runtime === runtime && t.target === targetVersion
);
}
module.exports = {
nodeAbi,
supportedTargets: nodeAbi.supportedTargets,
getSupportedTargets,
getSupportedTargetsByRuntime,
isTargetSupported,
findSupportedTarget
};
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
nodeAbi,
supportedTargets,
getSupportedTargets,
getSupportedTargetsByRuntime,
isTargetSupported,
findSupportedTarget
} = require('../src/index.js');
async function runTests() {
// 1. supportedTargets is exported as an array from node-abi
assert(Array.isArray(nodeAbi.supportedTargets), 'nodeAbi.supportedTargets must be an array');
assert(Array.isArray(supportedTargets), 'supportedTargets must be an array');
assert.equal(getSupportedTargets(), supportedTargets, 'getSupportedTargets should return supportedTargets');
assert(supportedTargets.length > 0, 'supportedTargets must not be empty');
// 2. supportedTargets contains target objects each having string properties runtime, target, abi, and boolean lts
for (const t of supportedTargets) {
assert.equal(typeof t.runtime, 'string', 'target.runtime must be a string');
assert.equal(typeof t.target, 'string', 'target.target must be a string');
assert.equal(typeof t.abi, 'string', 'target.abi must be a string');
assert.equal(typeof t.lts, 'boolean', 'target.lts must be a boolean');
}
// 3. supportedTargets contains targets for both node and electron runtimes
const runtimes = new Set(supportedTargets.map((t) => t.runtime));
assert(runtimes.has('node'), 'supportedTargets must contain node runtime targets');
assert(runtimes.has('electron'), 'supportedTargets must contain electron runtime targets');
const nodeTargets = getSupportedTargetsByRuntime('node');
const electronTargets = getSupportedTargetsByRuntime('electron');
assert(nodeTargets.length > 0, 'nodeTargets must not be empty');
assert(electronTargets.length > 0, 'electronTargets must not be empty');
assert.equal(nodeTargets.length + electronTargets.length, supportedTargets.length);
// 4. supportedTargets includes major Node.js releases such as 22.0.0 with ABI 127 and 20.0.0 with ABI 115
const node22 = findSupportedTarget('22.0.0', 'node');
assert(node22, 'node 22.0.0 must be present in supportedTargets');
assert.equal(node22.abi, '127', 'node 22.0.0 ABI should be 127');
const node20 = findSupportedTarget('20.0.0', 'node');
assert(node20, 'node 20.0.0 must be present in supportedTargets');
assert.equal(node20.abi, '115', 'node 20.0.0 ABI should be 115');
// 5. supportedTargets includes Electron release targets such as 30.0.0-alpha.1 with ABI 123
const electron30 = findSupportedTarget('30.0.0-alpha.1', 'electron');
assert(electron30, 'electron 30.0.0-alpha.1 must be present in supportedTargets');
assert.equal(electron30.abi, '123', 'electron 30.0.0-alpha.1 ABI should be 123');
// 6. supportedTargets contains LTS targets marked with lts boolean true
const ltsTargets = supportedTargets.filter((t) => t.lts === true);
assert(ltsTargets.length > 0, 'supportedTargets must have at least one LTS target');
for (const t of ltsTargets) {
assert.equal(t.runtime, 'node', 'LTS target runtime must be node');
}
// 7. all targets in supportedTargets are consistent with getAbi mapping
for (const t of supportedTargets) {
const resolvedAbi = nodeAbi.getAbi(t.target, t.runtime);
assert.equal(
resolvedAbi,
t.abi,
`getAbi(${t.target}, ${t.runtime}) should match target.abi ${t.abi}`
);
}
// 8. isTargetSupported correctly detects supported and unsupported versions for node and electron runtimes
assert.equal(isTargetSupported('22.0.0', 'node'), true);
assert.equal(isTargetSupported('999.0.0', 'node'), false);
assert.equal(isTargetSupported('30.0.0-alpha.1', 'electron'), true);
assert.equal(isTargetSupported('999.0.0', 'electron'), false);
console.log('All contract assertions for node-abi.supportedTargets passed successfully.');
}
runTests().catch((err) => {
console.error('Contract test failed:', err);
process.exit(1);
});
오리진 시더
익명