Sample
bare-signals 5.0.0: Emitter
Verified sample for npm bare-signals 5.0.0: Emitter. The contract ran on node 22 · linux debian/x64 · docker and passed: package manifest specifies Bare…
sha256:7037341c7695fa6284a9f28844e2b8310200c13d614a2e700be793b5583ed739
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux 24 · ubuntu · glibc 2.39 x64 npm
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| 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-07 |
Case
HOW- Goal
- verify bare-signals.Emitter in pkg:npm/bare-signals@5.0.0
- Packages
- Symbols
-
- bare-signals.Emitter
- Created
- 2026-09-07T01:09:31Z
Contract
- package manifest specifies Bare native addon configuration, exports for ./emitter and ./errors, and bare-events dependency
- declares SignalEmitter interface extending EventEmitter with ref and unref, and exports as Signal.Emitter in index.d.ts
- implements SignalEmitter in lib/emitter.js with signal lifecycle tracking, ref/unref management, and dynamic Signal binding
- implements pure JavaScript SignalError class with UNKNOWN_SIGNAL and SIGNAL_CLOSED error factories in lib/errors.js
- implements native Bare module binding bare_signals in binding.c with CMakeLists.txt build definition and prebuilt .bare addon binaries across linux, darwin, win32, android, and ios
Files
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Source
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 bare-signals.Emitter in pkg:npm/bare-signals@5.0.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/bare-signals@5.0.0
Demonstrate these symbols/APIs:
- bare-signals.Emitter
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:aacea6cbcb2d8d71643a4f85fd8a7030c61a3c83c0ba19416734d3555c8dfad9","contract":["package manifest specifies Bare native addon configuration, exports for ./emitter and ./errors, and bare-events dependency","declares SignalEmitter interface extending EventEmitter with ref and unref, and exports as Signal.Emitter in index.d.ts","implements SignalEmitter in lib/emitter.js with signal lifecycle tracking, ref/unref management, and dynamic Signal binding","implements pure JavaScript SignalError class with UNKNOWN_SIGNAL and SIGNAL_CLOSED error factories in lib/errors.js","implements native Bare module binding bare_signals in binding.c with CMakeLists.txt build definition and prebuilt .bare addon binaries across linux, darwin, win32, android, and ios"],"goal":"verify bare-signals.Emitter in pkg:npm/bare-signals@5.0.0","kind":"HOW","packages":["pkg:npm/bare-signals@5.0.0"],"schemaVersion":1,"symbols":["bare-signals.Emitter"]},"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-signals@5.0.0"],"schemaVersion":1,"subject":"pkg:npm/bare-signals@5.0.0","symbols":["bare-signals.Emitter"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-bare-signals-emitter",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-bare-signals-emitter",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"bare-signals": "5.0.0"
}
},
"node_modules/bare-events": {
"version": "2.9.2",
"resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.9.2.tgz",
"integrity": "sha512-AIPKioV7/Y/8KfZ3AAhjPJxLLbY49S64Ym5DakZlUg75qQiTgUq9hEJoEwa4eUezPUlXRy/i5NpsKvo9jgKmoA==",
"license": "Apache-2.0",
"peerDependencies": {
"bare-abort-controller": "*"
},
"peerDependenciesMeta": {
"bare-abort-controller": {
"optional": true
}
}
},
"node_modules/bare-signals": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/bare-signals/-/bare-signals-5.0.0.tgz",
"integrity": "sha512-8Gn8bBFUh2AUCJ9wWWFjSGWIo1HIUSIQnXRJGSm/f7GCDMqsuJhRmR1dT+HtDaDBkeu2l8Koxt2JLurfJ5yHVw==",
"license": "Apache-2.0",
"dependencies": {
"bare-events": "^2.5.3"
},
"engines": {
"bare": ">=1.7.0"
}
}
}
}
{
"name": "sample-bare-signals-emitter",
"version": "1.0.0",
"type": "module",
"private": true,
"license": "MIT-0",
"dependencies": {
"bare-signals": "5.0.0"
}
}
{
"schemaVersion": 1,
"goal": "verify bare-signals.Emitter in pkg:npm/bare-signals@5.0.0",
"kind": "HOW",
"packages": [
"pkg:npm/bare-signals@5.0.0"
],
"symbols": [
"bare-signals.Emitter"
]
}
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-signals package manifest and verify exports and metadata
const pkgPath = require.resolve('bare-signals/package');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
assert.equal(pkg.name, 'bare-signals', 'Package name must be bare-signals');
assert.equal(pkg.version, '5.0.0', 'Package version must be 5.0.0');
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.equal(pkg.exports['./errors'], './lib/errors.js', 'Errors export must point to ./lib/errors.js');
assert.equal(pkg.exports['./emitter'], './lib/emitter.js', 'Emitter export must point to ./lib/emitter.js');
assert.ok(pkg.dependencies && pkg.dependencies['bare-events'], 'Must declare dependency on bare-events');
assert.deepEqual(
pkg.files,
['index.js', 'index.d.ts', 'binding.c', 'binding.js', 'CMakeLists.txt', 'lib', 'prebuilds'],
'Package files array must contain expected source and build files'
);
const pkgDir = path.dirname(pkgPath);
// 2. Verify TypeScript declarations (index.d.ts) for bare-signals.Emitter
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("import EventEmitter from 'bare-events'"), 'index.d.ts must import EventEmitter from bare-events');
assert.ok(indexDts.includes('interface SignalEmitter extends EventEmitter'), 'index.d.ts must declare SignalEmitter extending EventEmitter');
assert.ok(indexDts.includes('ref(): this'), 'SignalEmitter must declare ref(): this');
assert.ok(indexDts.includes('unref(): this'), 'SignalEmitter must declare unref(): this');
assert.ok(indexDts.includes('export { SignalEmitter as Emitter, SignalError as errors }'), 'index.d.ts must export SignalEmitter as Emitter');
assert.ok(indexDts.includes('export const constants: Record<string, number>'), 'index.d.ts must declare constants');
assert.ok(indexDts.includes('export = Signal'), 'index.d.ts must export Signal');
// 3. Verify JavaScript module files (lib/emitter.js, index.js, and binding.js)
const emitterJsPath = path.join(pkgDir, 'lib', 'emitter.js');
assert.ok(fs.existsSync(emitterJsPath), 'lib/emitter.js must exist');
const emitterJs = fs.readFileSync(emitterJsPath, 'utf8');
assert.ok(emitterJs.includes("require('bare-events')"), 'lib/emitter.js must require bare-events');
assert.ok(emitterJs.includes("require('..')"), 'lib/emitter.js must require root Signal class');
assert.ok(emitterJs.includes('class SignalEmitter extends EventEmitter'), 'lib/emitter.js must define SignalEmitter class extending EventEmitter');
assert.ok(emitterJs.includes('ref()'), 'lib/emitter.js must implement ref() method');
assert.ok(emitterJs.includes('unref()'), 'lib/emitter.js must implement unref() method');
assert.ok(emitterJs.includes('_onnewlistener(name)'), 'lib/emitter.js must implement _onnewlistener handler');
assert.ok(emitterJs.includes('_onremovelistener(name)'), 'lib/emitter.js must implement _onremovelistener handler');
assert.ok(emitterJs.includes('_onsignal(name)'), 'lib/emitter.js must implement _onsignal handler');
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("exports.Emitter = require('./lib/emitter')"), 'index.js must re-export Emitter from lib/emitter');
assert.ok(indexJs.includes("require('./binding')"), 'index.js must require binding');
assert.ok(indexJs.includes("require('./lib/errors')"), 'index.js must require errors');
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 pure JavaScript errors submodule (lib/errors.js)
const SignalError = require('bare-signals/errors');
assert.equal(typeof SignalError, 'function', 'bare-signals/errors must export SignalError class');
assert.ok(SignalError.prototype instanceof Error, 'SignalError must extend Error');
const unknownErr = SignalError.UNKNOWN_SIGNAL('test unknown');
assert.ok(unknownErr instanceof SignalError, 'UNKNOWN_SIGNAL must return SignalError instance');
assert.equal(unknownErr.name, 'SignalError', 'Error name must be SignalError');
assert.equal(unknownErr.code, 'UNKNOWN_SIGNAL', 'Error code must be UNKNOWN_SIGNAL');
assert.equal(unknownErr.message, 'UNKNOWN_SIGNAL: test unknown');
const closedErr = SignalError.SIGNAL_CLOSED('test closed');
assert.ok(closedErr instanceof SignalError, 'SIGNAL_CLOSED must return SignalError instance');
assert.equal(closedErr.name, 'SignalError', 'Error name must be SignalError');
assert.equal(closedErr.code, 'SIGNAL_CLOSED', 'Error code must be SIGNAL_CLOSED');
assert.equal(closedErr.message, 'SIGNAL_CLOSED: test closed');
// 5. 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('BARE_MODULE(bare_signals, bare_signals_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_signals C)'), 'CMakeLists.txt must define project bare_signals');
assert.ok(cmake.includes('add_bare_module(bare_signals)'), 'CMakeLists.txt must declare bare module');
// 6. 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-signals.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-signals.bare'));
assert.ok(linuxX64Binary.length > 1000, 'linux-x64 prebuild binary size must exceed 1000 bytes');
console.log('Contract tests passed successfully.');
Origin Seeder
anonymous