CodeSampleX

샘플

bare-abort 2.0.13: abort

검증된 샘플 — npm bare-abort 2.0.13: abort. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: package manifest specifies Bare native addon configuration…

sha256:f166bc67b04568586a23edeb52aed7658f4aeb048188a921dc4248876273ccab

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

실행 증거

선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.

증거 기준
서명된 컨트랙트 통과
검증 영수증
1
빌드한 서명 키
1
선언된 환경 linux 24 · ubuntu · glibc 2.39 x64 npm

검증 실행 환경

환경 컨트랙트 단계 실행일
node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5…
2026-08-26

케이스

HOW
목표
verify pkg:npm/bare-abort@2.0.13
패키지
심벌
  • abort
생성일
2026-08-26T13:56:10Z

컨트랙트

  1. package manifest specifies Bare native addon configuration, Apache-2.0 license, and exports for root and package subpaths
  2. declares abort function with never return type in TypeScript definition index.d.ts
  3. implements binding loader via require.addon and re-exports binding.abort in index.js
  4. implements native Bare module binding bare_abort calling C abort() in binding.c with CMakeLists.txt build definition
  5. provides multi-platform precompiled .bare addon binaries including linux-x64, linux-arm64, darwin, ios, android, and win32 targets

파일

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • 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 pkg:npm/bare-abort@2.0.13
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/bare-abort@2.0.13
Demonstrate these symbols/APIs:
  - abort

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:504b3028fe09412e5bb3be4fb64de9949ca8dad187ec49b00e2318b9fdc95c54","contract":["package manifest specifies Bare native addon configuration, Apache-2.0 license, and exports for root and package subpaths","declares abort function with never return type in TypeScript definition index.d.ts","implements binding loader via require.addon and re-exports binding.abort in index.js","implements native Bare module binding bare_abort calling C abort() in binding.c with CMakeLists.txt build definition","provides multi-platform precompiled .bare addon binaries including linux-x64, linux-arm64, darwin, ios, android, and win32 targets"],"goal":"verify pkg:npm/bare-abort@2.0.13","kind":"HOW","packages":["pkg:npm/bare-abort@2.0.13"],"schemaVersion":1,"symbols":["abort"]},"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/bare-abort@2.0.13"],"schemaVersion":1,"subject":"pkg:npm/bare-abort@2.0.13","symbols":["abort"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-bare-abort",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-bare-abort",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "bare-abort": "2.0.13"
      }
    },
    "node_modules/bare-abort": {
      "version": "2.0.13",
      "resolved": "https://registry.npmjs.org/bare-abort/-/bare-abort-2.0.13.tgz",
      "integrity": "sha512-zdc8l88eB11Jsz5rDd6sCAgv2kUFXgdrZWoMlgU6JMkfAi1/uuGFC3IEHswKbIRQTk5H3T5CMuechsXYxiaHlQ==",
      "license": "Apache-2.0"
    }
  }
}
package.json
{
  "name": "sample-bare-abort",
  "version": "1.0.0",
  "private": true,
  "type": "module",
  "license": "MIT-0",
  "dependencies": {
    "bare-abort": "2.0.13"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/bare-abort@2.0.13",
  "kind": "HOW",
  "packages": [
    "pkg:npm/bare-abort@2.0.13"
  ],
  "symbols": [
    "abort"
  ]
}
test/contract.mjs
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
import fs from 'node:fs';
import path from 'node:path';

const require = createRequire(import.meta.url);

// 1. Resolve bare-abort package manifest and verify exports and metadata
const pkgPath = require.resolve('bare-abort/package');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));

assert.equal(pkg.name, 'bare-abort', 'Package name must be bare-abort');
assert.equal(pkg.version, '2.0.13', 'Package version must be 2.0.13');
assert.equal(pkg.license, 'Apache-2.0', 'Package license must be Apache-2.0');
assert.equal(pkg.addon, true, 'Package must be marked as addon');

assert.ok(pkg.exports, 'Package must define exports');
assert.equal(pkg.exports['.'].types, './index.d.ts', 'Root export must specify ./index.d.ts types');
assert.equal(pkg.exports['.'].default, './index.js', 'Root export must specify ./index.js default');
assert.equal(pkg.exports['./package'], './package.json', 'Package export must point to ./package.json');

assert.deepEqual(
  pkg.files,
  ['index.js', 'index.d.ts', 'binding.c', 'binding.js', 'CMakeLists.txt', 'prebuilds'],
  'Package files array must contain expected source and build files'
);

const pkgDir = path.dirname(pkgPath);

// 2. Verify TypeScript declarations (index.d.ts)
const indexDtsPath = path.join(pkgDir, 'index.d.ts');
assert.ok(fs.existsSync(indexDtsPath), 'index.d.ts must exist');
const indexDts = fs.readFileSync(indexDtsPath, 'utf8');
assert.ok(indexDts.includes('declare function abort(): never'), 'index.d.ts must declare abort function returning never');
assert.ok(indexDts.includes('export = abort'), 'index.d.ts must export abort function');

// 3. Verify JavaScript module files (index.js and binding.js)
const indexJsPath = path.join(pkgDir, 'index.js');
assert.ok(fs.existsSync(indexJsPath), 'index.js must exist');
const indexJs = fs.readFileSync(indexJsPath, 'utf8');
assert.ok(indexJs.includes("require('./binding')"), 'index.js must require binding');
assert.ok(indexJs.includes('module.exports = binding.abort'), 'index.js must export binding.abort');

const bindingJsPath = path.join(pkgDir, 'binding.js');
assert.ok(fs.existsSync(bindingJsPath), 'binding.js must exist');
const bindingJs = fs.readFileSync(bindingJsPath, 'utf8');
assert.ok(bindingJs.includes('require.addon()'), 'binding.js must invoke require.addon()');

// 4. Verify C native addon source and build configuration
const bindingCPath = path.join(pkgDir, 'binding.c');
assert.ok(fs.existsSync(bindingCPath), 'binding.c must exist');
const bindingC = fs.readFileSync(bindingCPath, 'utf8');
assert.ok(bindingC.includes('#include <bare.h>'), 'binding.c must include <bare.h>');
assert.ok(bindingC.includes('#include <js.h>'), 'binding.c must include <js.h>');
assert.ok(bindingC.includes('#include <stdlib.h>'), 'binding.c must include <stdlib.h>');
assert.ok(bindingC.includes('abort();'), 'binding.c must invoke standard abort()');
assert.ok(bindingC.includes('BARE_MODULE(bare_abort, bare_abort_exports)'), 'binding.c must define BARE_MODULE');

const cmakePath = path.join(pkgDir, 'CMakeLists.txt');
assert.ok(fs.existsSync(cmakePath), 'CMakeLists.txt must exist');
const cmake = fs.readFileSync(cmakePath, 'utf8');
assert.ok(cmake.includes('project(bare_abort C)'), 'CMakeLists.txt must define project bare_abort');
assert.ok(cmake.includes('add_bare_module(bare_abort)'), 'CMakeLists.txt must declare bare module');
assert.ok(cmake.includes('binding.c'), 'CMakeLists.txt must include binding.c');

// 5. Verify prebuilt native binaries across architectures
const prebuildsDir = path.join(pkgDir, 'prebuilds');
assert.ok(fs.existsSync(prebuildsDir), 'prebuilds directory must exist');

const expectedTargets = [
  'android-arm',
  'android-arm64',
  'android-ia32',
  'android-x64',
  'darwin-arm64',
  'darwin-x64',
  'ios-arm64-simulator',
  'ios-arm64',
  'ios-x64-simulator',
  'linux-arm64',
  'linux-x64',
  'win32-arm64',
  'win32-x64'
];

for (const target of expectedTargets) {
  const binaryPath = path.join(prebuildsDir, target, 'bare-abort.bare');
  assert.ok(fs.existsSync(binaryPath), `Prebuild binary must exist for target: ${target}`);
  const stat = fs.statSync(binaryPath);
  assert.ok(stat.size > 0, `Prebuild binary for ${target} must not be empty`);
}

const linuxX64Binary = fs.readFileSync(path.join(prebuildsDir, 'linux-x64', 'bare-abort.bare'));
assert.ok(linuxX64Binary.length > 1000, 'linux-x64 prebuild binary size must exceed 1000 bytes');

console.log('Contract tests passed successfully.');

오리진 시더

익명