CodeSampleX

샘플

node-abi 4.35.0: allTargets

검증된 샘플 — npm node-abi 4.35.0: allTargets. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: node-abi.allTargets is a non-empty array of target…

sha256:0a703c91479f687592e408acad90b31b53224b9ea29409b23b5f850bdfdb134b

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. 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-11-08

케이스

HOW
목표
verify node-abi.allTargets in pkg:npm/node-abi@4.35.0
패키지
심벌
  • node-abi.allTargets
환경
node 22.23.2
생성일
2026-11-08T00:24:02Z

컨트랙트

  1. node-abi.allTargets is a non-empty array of target descriptor objects
  2. each descriptor in node-abi.allTargets contains string runtime, target, and abi properties and a boolean lts property
  3. node-abi.allTargets includes target descriptors for node, electron, and node-webkit runtimes
  4. target descriptors in node-abi.allTargets map runtime version strings to their corresponding ABI strings
  5. node-abi.allTargets equals the concatenation of deprecatedTargets, supportedTargets, additionalTargets, and futureTargets

파일

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

소스 아티팩트 내려받기 (tar.gz)

소스

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.35.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/node-abi@4.35.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:495de32cfc734eee51b54431569ad304acf1ba8e4caf36758ca408079ec7e575","constraints":{"executionContext":"node"},"contract":["node-abi.allTargets is a non-empty array of target descriptor objects","each descriptor in node-abi.allTargets contains string runtime, target, and abi properties and a boolean lts property","node-abi.allTargets includes target descriptors for node, electron, and node-webkit runtimes","target descriptors in node-abi.allTargets map runtime version strings to their corresponding ABI strings","node-abi.allTargets equals the concatenation of deprecatedTargets, supportedTargets, additionalTargets, and futureTargets"],"goal":"verify node-abi.allTargets in pkg:npm/node-abi@4.35.0","kind":"HOW","packages":["pkg:npm/node-abi@4.35.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.35.0"],"schemaVersion":1,"subject":"pkg:npm/node-abi@4.35.0","symbols":["node-abi.allTargets"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "verify-node-abi-alltargets",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "verify-node-abi-alltargets",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "node-abi": "4.35.0"
      }
    },
    "node_modules/node-abi": {
      "version": "4.35.0",
      "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-4.35.0.tgz",
      "integrity": "sha512-ymk4aIzxdPopw2giv8Fs1Ec6vybGkjmyxUwVqhkI4MCy2tVfXdkOGGWieWVjL0THgH+7a8lRdevyupoYj3Js/Q==",
      "license": "MIT",
      "dependencies": {
        "semver": "^7.6.3"
      },
      "engines": {
        "node": ">=22.12.0"
      }
    },
    "node_modules/semver": {
      "version": "7.8.6",
      "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.6.tgz",
      "integrity": "sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw==",
      "license": "ISC",
      "bin": {
        "semver": "bin/semver.js"
      },
      "engines": {
        "node": ">=10"
      }
    }
  }
}
package.json
{
  "name": "verify-node-abi-alltargets",
  "version": "1.0.0",
  "private": true,
  "license": "MIT-0",
  "main": "src/index.js",
  "scripts": {
    "test": "node test/contract.mjs"
  },
  "dependencies": {
    "node-abi": "4.35.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify node-abi.allTargets in pkg:npm/node-abi@4.35.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/node-abi@4.35.0"
  ],
  "symbols": [
    "node-abi.allTargets"
  ]
}
src/index.js
const nodeAbi = require('node-abi');

function listAllTargets() {
  return nodeAbi.allTargets;
}

function filterByRuntime(runtime) {
  return nodeAbi.allTargets.filter((entry) => entry.runtime === runtime);
}

function lookupTargetEntry(runtime, targetVersion) {
  return nodeAbi.allTargets.find(
    (entry) => entry.runtime === runtime && entry.target === targetVersion,
  );
}

module.exports = {
  allTargets: nodeAbi.allTargets,
  listAllTargets,
  filterByRuntime,
  lookupTargetEntry,
};
test/contract.mjs
import assert from 'node:assert';
import { createRequire } from 'node:module';

const require = createRequire(import.meta.url);
const {
  allTargets,
  deprecatedTargets,
  supportedTargets,
  additionalTargets,
  futureTargets,
} = require('node-abi');
const {
  listAllTargets,
  filterByRuntime,
  lookupTargetEntry,
} = require('../src/index.js');

// 1. node-abi.allTargets is a non-empty array of target descriptor objects
assert.strictEqual(Array.isArray(allTargets), true);
assert.strictEqual(listAllTargets(), allTargets);
assert.ok(allTargets.length > 0);

// 2. Every descriptor in node-abi.allTargets contains string runtime, target, abi fields and boolean lts field
for (const entry of allTargets) {
  assert.strictEqual(typeof entry.runtime, 'string');
  assert.ok(entry.runtime.length > 0);
  assert.strictEqual(typeof entry.target, 'string');
  assert.ok(entry.target.length > 0);
  assert.strictEqual(typeof entry.abi, 'string');
  assert.ok(entry.abi.length > 0);
  assert.strictEqual(typeof entry.lts, 'boolean');
}

// 3. node-abi.allTargets includes entries for node, electron, and node-webkit runtimes
const runtimes = new Set(allTargets.map((entry) => entry.runtime));
assert.strictEqual(runtimes.has('node'), true);
assert.strictEqual(runtimes.has('electron'), true);
assert.strictEqual(runtimes.has('node-webkit'), true);

assert.ok(filterByRuntime('node').length > 0);
assert.ok(filterByRuntime('electron').length > 0);
assert.ok(filterByRuntime('node-webkit').length > 0);

// 4. Known target descriptors in node-abi.allTargets map target versions to expected ABI strings
const nodeV10 = lookupTargetEntry('node', '10.0.0');
assert.ok(nodeV10);
assert.strictEqual(nodeV10.abi, '64');

const electronV4 = lookupTargetEntry('electron', '4.0.4');
assert.ok(electronV4);
assert.strictEqual(electronV4.abi, '69');

// 5. node-abi.allTargets concatenates deprecatedTargets, supportedTargets, additionalTargets, and futureTargets in order
const expectedCombined = [
  ...deprecatedTargets,
  ...supportedTargets,
  ...additionalTargets,
  ...futureTargets,
];
assert.strictEqual(allTargets.length, expectedCombined.length);
assert.deepStrictEqual(allTargets, expectedCombined);

오리진 시더

익명