샘플
bare-events 2.9.1: prototype
검증된 샘플 — npm bare-events 2.9.1: prototype. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: EventEmitter.prototype defines core event emitter…
sha256:19099568ae57f8d07e3307c6d632a9bb7956794cfe15927734b750b836d14ed5
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 2
- 빌드한 서명 키
- 1
선언된 환경
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| 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 |
| 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 |
케이스
HOW- 목표
- verify bare-events.prototype in pkg:npm/bare-events@2.9.1
- 심벌
-
- bare-events.prototype
- 환경
- node 22.23.2
- 생성일
- 2026-08-26T11:37:56Z
컨트랙트
- EventEmitter.prototype defines core event emitter methods and instance prototype chain
- Subclasses extending EventEmitter inherit prototype methods and manage events
- Prototypal objects inheriting EventEmitter.prototype auto-initialize lazy event state
- Listener registration and removal prototype methods return the instance for method chaining
- listeners returns listener descriptor tuples while rawListeners returns unwrapped handler functions
- newListener and removeListener lifecycle events are emitted during prototype mutation methods
- removeAllListeners clears specified event or all events emitting removeListener hooks
- getMaxListeners and setMaxListeners interact with instance and default settings
- emit triggers registered error listeners synchronously with error payload
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.cjs
소스
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-events.prototype in pkg:npm/bare-events@2.9.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/bare-events@2.9.1
Demonstrate these symbols/APIs:
- bare-events.prototype
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.2
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:13eda6278d0bb72f2be20af067462acef7961aa6e1bd8c3e48fe23d73b52b10b","constraints":{"executionContext":"node"},"contract":["EventEmitter.prototype defines core event emitter methods and instance prototype chain","Subclasses extending EventEmitter inherit prototype methods and manage events","Prototypal objects inheriting EventEmitter.prototype auto-initialize lazy event state","Listener registration and removal prototype methods return the instance for method chaining","listeners returns listener descriptor tuples while rawListeners returns unwrapped handler functions","newListener and removeListener lifecycle events are emitted during prototype mutation methods","removeAllListeners clears specified event or all events emitting removeListener hooks","getMaxListeners and setMaxListeners interact with instance and default settings","emit triggers registered error listeners synchronously with error payload"],"goal":"verify bare-events.prototype in pkg:npm/bare-events@2.9.1","kind":"HOW","packages":["pkg:npm/bare-events@2.9.1"],"schemaVersion":1,"symbols":["bare-events.prototype"]},"contractCommand":["node","test/contract.cjs"],"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/bare-events@2.9.1"],"schemaVersion":1,"subject":"pkg:npm/bare-events@2.9.1","symbols":["bare-events.prototype"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-bare-events-prototype",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-bare-events-prototype",
"version": "1.0.0",
"dependencies": {
"bare-events": "2.9.1"
}
},
"node_modules/bare-events": {
"version": "2.9.1",
"resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.9.1.tgz",
"integrity": "sha512-Z0oHEHAFDZkffN8Qc39zNZjQlMDkPJRyyyZieU1VH7u8c5S+qHZ2S8ixdKIAxEjfHO7FJxXmJWgteOghVanIsg==",
"license": "Apache-2.0",
"peerDependencies": {
"bare-abort-controller": "*"
},
"peerDependenciesMeta": {
"bare-abort-controller": {
"optional": true
}
}
}
}
}
{
"name": "sample-bare-events-prototype",
"version": "1.0.0",
"private": true,
"dependencies": {
"bare-events": "2.9.1"
}
}
{
"schemaVersion": 1,
"goal": "verify bare-events.prototype in pkg:npm/bare-events@2.9.1",
"kind": "HOW",
"packages": [
"pkg:npm/bare-events@2.9.1"
],
"symbols": [
"bare-events.prototype"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const assert = require('node:assert/strict');
const EventEmitter = require('bare-events');
// 1. EventEmitter.prototype defines core event emitter methods and instance prototype chain
{
assert.equal(typeof EventEmitter.prototype, 'object');
assert.equal(typeof EventEmitter.prototype.on, 'function');
assert.equal(typeof EventEmitter.prototype.once, 'function');
assert.equal(typeof EventEmitter.prototype.off, 'function');
assert.equal(typeof EventEmitter.prototype.emit, 'function');
assert.equal(typeof EventEmitter.prototype.addListener, 'function');
assert.equal(typeof EventEmitter.prototype.addOnceListener, 'function');
assert.equal(typeof EventEmitter.prototype.prependListener, 'function');
assert.equal(typeof EventEmitter.prototype.prependOnceListener, 'function');
assert.equal(typeof EventEmitter.prototype.removeListener, 'function');
assert.equal(typeof EventEmitter.prototype.removeAllListeners, 'function');
assert.equal(typeof EventEmitter.prototype.listeners, 'function');
assert.equal(typeof EventEmitter.prototype.rawListeners, 'function');
assert.equal(typeof EventEmitter.prototype.listenerCount, 'function');
assert.equal(typeof EventEmitter.prototype.eventNames, 'function');
assert.equal(typeof EventEmitter.prototype.getMaxListeners, 'function');
assert.equal(typeof EventEmitter.prototype.setMaxListeners, 'function');
const ee = new EventEmitter();
assert.ok(ee instanceof EventEmitter);
assert.equal(Object.getPrototypeOf(ee), EventEmitter.prototype);
}
// 2. Subclasses extending EventEmitter inherit prototype methods and manage events
{
class CustomBus extends EventEmitter {
constructor(prefix) {
super();
this.prefix = prefix;
}
publish(topic, msg) {
return this.emit(topic, `${this.prefix}:${msg}`);
}
}
const bus = new CustomBus('app');
assert.ok(bus instanceof EventEmitter);
assert.ok(bus instanceof CustomBus);
let captured = null;
bus.on('message', (val) => {
captured = val;
});
const emitted = bus.publish('message', 'hello');
assert.equal(emitted, true);
assert.equal(captured, 'app:hello');
}
// 3. Prototypal objects inheriting EventEmitter.prototype auto-initialize lazy event state
{
const protoObj = Object.create(EventEmitter.prototype);
assert.ok(protoObj instanceof EventEmitter);
let called = false;
protoObj.on('init', () => {
called = true;
});
protoObj.emit('init');
assert.equal(called, true);
assert.ok(protoObj._events !== undefined);
}
// 4. Listener registration and removal prototype methods return the instance for method chaining
{
const ee = new EventEmitter();
const noop = () => {};
const r1 = ee.on('ev1', noop);
assert.equal(r1, ee);
const r2 = ee.addListener('ev2', noop);
assert.equal(r2, ee);
const r3 = ee.addOnceListener('ev3', noop);
assert.equal(r3, ee);
const r4 = ee.prependListener('ev4', noop);
assert.equal(r4, ee);
const r5 = ee.prependOnceListener('ev5', noop);
assert.equal(r5, ee);
const r6 = ee.off('ev1', noop);
assert.equal(r6, ee);
const r7 = ee.removeListener('ev2', noop);
assert.equal(r7, ee);
const r8 = ee.removeAllListeners('ev4');
assert.equal(r8, ee);
const r9 = ee.removeAllListeners();
assert.equal(r9, ee);
}
// 5. listeners returns listener descriptor tuples while rawListeners returns unwrapped handler functions
{
const ee = new EventEmitter();
const fn1 = () => 'fn1';
const fn2 = () => 'fn2';
ee.on('ping', fn1);
ee.once('ping', fn2);
const list = ee.listeners('ping');
const raw = ee.rawListeners('ping');
assert.equal(list.length, 2);
assert.equal(raw.length, 2);
assert.deepEqual(list[0], [fn1, false]);
assert.deepEqual(list[1], [fn2, true]);
assert.equal(raw[0], fn1);
assert.equal(raw[1], fn2);
list.pop();
assert.equal(ee.listenerCount('ping'), 2);
}
// 6. newListener and removeListener lifecycle events are emitted during prototype mutation methods
{
const ee = new EventEmitter();
const events = [];
ee.on('newListener', (event, listener) => {
events.push({ type: 'new', event, isFn: typeof listener === 'function' });
});
ee.on('removeListener', (event, listener) => {
events.push({ type: 'remove', event, isFn: typeof listener === 'function' });
});
const handler = () => {};
ee.on('status', handler);
ee.off('status', handler);
assert.deepEqual(events, [
{ type: 'new', event: 'removeListener', isFn: true },
{ type: 'new', event: 'status', isFn: true },
{ type: 'remove', event: 'status', isFn: true }
]);
}
// 7. removeAllListeners clears specified event or all events emitting removeListener hooks
{
const ee = new EventEmitter();
const removed = [];
ee.on('removeListener', (name) => {
removed.push(name);
});
const h1 = () => {};
const h2 = () => {};
const h3 = () => {};
ee.on('alpha', h1);
ee.on('alpha', h2);
ee.on('beta', h3);
ee.removeAllListeners('alpha');
assert.equal(ee.listenerCount('alpha'), 0);
assert.equal(ee.listenerCount('beta'), 1);
assert.deepEqual(removed, ['alpha', 'alpha']);
ee.removeAllListeners();
assert.equal(ee.listenerCount('beta'), 0);
assert.deepEqual(ee.eventNames(), []);
}
// 8. getMaxListeners and setMaxListeners interact with instance and default settings
{
const ee = new EventEmitter();
assert.equal(ee.getMaxListeners(), 10);
assert.equal(typeof ee.setMaxListeners, 'function');
ee.setMaxListeners(20);
assert.equal(ee.getMaxListeners(), 10);
}
// 9. emit triggers registered error listeners synchronously with error payload
{
const ee = new EventEmitter();
let caughtError = null;
ee.on('error', (err) => {
caughtError = err;
});
const err = new Error('test-failure');
const handled = ee.emit('error', err);
assert.equal(handled, true);
assert.equal(caughtError, err);
}
오리진 시더
익명