@open-wa/hyperemitter 5.1.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +19 -18
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,27 +1,28 @@
1
- # HyperEmitter (planning scaffold)
1
+ # @open-wa/hyperemitter
2
2
 
3
- This package is a placeholder for the HyperEmitter benchmarks and developer tools. The emitter code will arrive later. This package records competitor performance and defines build and CI expectations.
3
+ `@open-wa/hyperemitter` is a typed event emitter used by Open-WA packages. It supports exact event names, `+` and `#` wildcard subscriptions, one-time listeners, catch-all listeners, and listener cleanup with an `AbortSignal`.
4
4
 
5
- ## Baseline benchmarks
5
+ ## Use
6
6
 
7
- Run competitor baselines (Node EventEmitter, eventemitter2/3, emittery, mitt, tseep):
7
+ ```typescript
8
+ import { HyperEmitter } from '@open-wa/hyperemitter';
8
9
 
9
- ```bash
10
- pnpm --filter @open-wa/hyperemitter bench:baseline
11
- ```
10
+ type Events = {
11
+ 'message.received': { id: string; body: string };
12
+ 'session.state.changed': { state: string };
13
+ };
14
+
15
+ const events = new HyperEmitter<Events>();
12
16
 
13
- Options:
14
- - `--iterations <n>` to adjust emit count (default: 500000)
15
- - `--output <file>` to override output path
16
- - `--ci` to suppress console tables
17
+ events.on('message.received', (message) => {
18
+ console.log(message.id, message.body);
19
+ });
17
20
 
18
- Outputs JSON to `packages/hyperemitter/benchmarks/baseline/results/baseline-node-<version>.json`.
21
+ events.emit('message.received', { id: 'message-id', body: 'Hello' });
22
+ ```
19
23
 
20
- > If some competitors are not installed, the runner will skip them and record the reason. Install this package’s devDeps to populate all baselines.
24
+ The repository also contains a benchmark runner for comparing other emitter libraries. Its results are measurements from that runner, not a performance guarantee.
21
25
 
22
- ## Build/interop contract (snapshot)
26
+ ## License
23
27
 
24
- - Dual ESM/CJS outputs with typed entrypoints.
25
- - Adapters for `EventTarget`, Node `EventEmitter`, and worker threads.
26
- - Optional plugins (TTL/maxListeners/tracing) kept out of the hot path.
27
- - CI will enforce performance budgets after HyperEmitter arrives. The targets are a 5% tseep envelope for exact events and 10x EE2 for wildcards.
28
+ Apache-2.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-wa/hyperemitter",
3
- "version": "5.1.0",
3
+ "version": "5.3.0",
4
4
  "description": "HyperEmitter: high-performance, schema-driven event emitter for the open-wa v5 stack.",
5
5
  "main": "dist/index.cjs",
6
6
  "types": "dist/index.d.cts",
@@ -24,7 +24,7 @@
24
24
  "access": "public"
25
25
  },
26
26
  "dependencies": {
27
- "@open-wa/logger": "5.1.0"
27
+ "@open-wa/logger": "5.3.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "emittery": "^2.1.0",