CodeSampleX

Exemplo

bare-abort 2.0.13: abort

Amostra verificada para npm bare-abort 2.0.13: abort. O contrato rodou em node 22 · linux alpine/x64 · docker e passou: verifies package manifest declares…

sha256:376b99353a2df66985e2f0c8361c79bd4004ea2799234c03a0a519cc8928905e

Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu. Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas. MIT-0

Evidência de execução

O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.

Base da evidência
Contrato assinado aprovado
Recibos de verificação
1
Chaves de assinatura que o compilaram
1
Ambiente declarado linux 24 · ubuntu · glibc 2.39 x64 npm

Ambientes das execuções de verificação

Ambiente Contrato Etapas Execução
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-27

Caso

HOW
Objetivo
verify pkg:npm/bare-abort@2.0.13
Pacotes
Símbolos
  • abort
Criado
2026-08-27T13:14:37Z

Contrato

  1. verifies package manifest declares bare-abort version 2.0.13 with Apache-2.0 license and addon flag
  2. verifies package exports map root to index.d.ts types and index.js default, and ./package to package.json
  3. verifies TypeScript definitions declare abort function returning never
  4. verifies binding.js loads native addon via Bare runtime require.addon loader
  5. verifies native C binding implements bare_abort calling stdlib abort and exports via BARE_MODULE
  6. verifies CMakeLists.txt configures bare_abort C project and bare module with binding.c
  7. verifies multi-platform precompiled .bare binaries exist for linux, darwin, win32, android, and ios architectures
  8. verifies loading in standard Node.js identifies Bare runtime dependency requirement

Arquivos

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

Baixar o artefato de código-fonte (tar.gz)

Código-fonte

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:366ec023a4bbc72a1353e59cd13a607121b90687e5bf08675fc0080bfc380a67","contract":["verifies package manifest declares bare-abort version 2.0.13 with Apache-2.0 license and addon flag","verifies package exports map root to index.d.ts types and index.js default, and ./package to package.json","verifies TypeScript definitions declare abort function returning never","verifies binding.js loads native addon via Bare runtime require.addon loader","verifies native C binding implements bare_abort calling stdlib abort and exports via BARE_MODULE","verifies CMakeLists.txt configures bare_abort C project and bare module with binding.c","verifies multi-platform precompiled .bare binaries exist for linux, darwin, win32, android, and ios architectures","verifies loading in standard Node.js identifies Bare runtime dependency requirement"],"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. Verify package manifest and exports
const pkgPath = require.resolve('bare-abort/package');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));

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

assert.ok(pkg.exports);
assert.equal(pkg.exports['.'].types, './index.d.ts');
assert.equal(pkg.exports['.'].default, './index.js');
assert.equal(pkg.exports['./package'], './package.json');

const pkgDir = path.dirname(pkgPath);

// 2. Verify TypeScript declaration
const dts = fs.readFileSync(path.join(pkgDir, 'index.d.ts'), 'utf8');
assert.match(dts, /declare\s+function\s+abort\(\)\s*:\s*never/);
assert.match(dts, /export\s*=\s*abort/);

// 3. Verify module loader and binding wrapper
const indexJs = fs.readFileSync(path.join(pkgDir, 'index.js'), 'utf8');
assert.match(indexJs, /require\(['"]\.\/binding['"]\)/);
assert.match(indexJs, /module\.exports\s*=\s*binding\.abort/);

const bindingJs = fs.readFileSync(path.join(pkgDir, 'binding.js'), 'utf8');
assert.match(bindingJs, /require\.addon\(\)/);

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

const cmake = fs.readFileSync(path.join(pkgDir, 'CMakeLists.txt'), 'utf8');
assert.ok(cmake.includes('project(bare_abort C)'));
assert.ok(cmake.includes('add_bare_module(bare_abort)'));
assert.ok(cmake.includes('binding.c'));

// 5. Verify multi-platform prebuilds
const prebuildsDir = path.join(pkgDir, 'prebuilds');
const architectures = [
  'linux-x64',
  'linux-arm64',
  'darwin-x64',
  'darwin-arm64',
  'win32-x64',
  'win32-arm64',
  'android-x64',
  'android-arm64',
  'android-arm',
  'android-ia32',
  'ios-arm64',
  'ios-arm64-simulator',
  'ios-x64-simulator'
];

for (const arch of architectures) {
  const binaryFile = path.join(prebuildsDir, arch, 'bare-abort.bare');
  assert.ok(fs.existsSync(binaryFile), `Missing prebuild binary for ${arch}`);
  const stats = fs.statSync(binaryFile);
  assert.ok(stats.size > 0, `Prebuild binary for ${arch} is empty`);
}

// 6. Verify runtime requirement in Node.js environment
assert.throws(
  () => {
    require('bare-abort');
  },
  (err) => {
    return err instanceof TypeError && /require\.addon/.test(err.message);
  },
  'Should fail in Node.js because require.addon is a Bare runtime extension'
);

console.log('All bare-abort contract verifications passed.');

Seeder de origem

anônimo