@vielzeug/herald 1.0.2
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.
- package/README.md +92 -0
- package/dist/_delegate.cjs +2 -0
- package/dist/_delegate.cjs.map +1 -0
- package/dist/_delegate.d.ts +2 -0
- package/dist/_delegate.d.ts.map +1 -0
- package/dist/_delegate.js +30 -0
- package/dist/_delegate.js.map +1 -0
- package/dist/_dev.cjs +2 -0
- package/dist/_dev.cjs.map +1 -0
- package/dist/_dev.d.ts +2 -0
- package/dist/_dev.d.ts.map +1 -0
- package/dist/_dev.js +9 -0
- package/dist/_dev.js.map +1 -0
- package/dist/_prototype.cjs +2 -0
- package/dist/_prototype.cjs.map +1 -0
- package/dist/_prototype.d.ts +2 -0
- package/dist/_prototype.d.ts.map +1 -0
- package/dist/_prototype.js +13 -0
- package/dist/_prototype.js.map +1 -0
- package/dist/_safe.cjs +2 -0
- package/dist/_safe.cjs.map +1 -0
- package/dist/_safe.d.ts +2 -0
- package/dist/_safe.d.ts.map +1 -0
- package/dist/_safe.js +15 -0
- package/dist/_safe.js.map +1 -0
- package/dist/behavior-bus.cjs +2 -0
- package/dist/behavior-bus.cjs.map +1 -0
- package/dist/behavior-bus.d.ts +19 -0
- package/dist/behavior-bus.d.ts.map +1 -0
- package/dist/behavior-bus.js +57 -0
- package/dist/behavior-bus.js.map +1 -0
- package/dist/bus.cjs +2 -0
- package/dist/bus.cjs.map +1 -0
- package/dist/bus.d.ts +17 -0
- package/dist/bus.d.ts.map +1 -0
- package/dist/bus.js +231 -0
- package/dist/bus.js.map +1 -0
- package/dist/devtools.cjs +2 -0
- package/dist/devtools.cjs.map +1 -0
- package/dist/devtools.d.ts +55 -0
- package/dist/devtools.d.ts.map +1 -0
- package/dist/devtools.js +27 -0
- package/dist/devtools.js.map +1 -0
- package/dist/errors.cjs +2 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.ts +14 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +21 -0
- package/dist/errors.js.map +1 -0
- package/dist/herald.cjs +2 -0
- package/dist/herald.cjs.map +1 -0
- package/dist/herald.iife.js +2 -0
- package/dist/herald.iife.js.map +1 -0
- package/dist/herald.js +2 -0
- package/dist/herald.js.map +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/pipe.cjs +2 -0
- package/dist/pipe.cjs.map +1 -0
- package/dist/pipe.d.ts +24 -0
- package/dist/pipe.d.ts.map +1 -0
- package/dist/pipe.js +19 -0
- package/dist/pipe.js.map +1 -0
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/testing.cjs +2 -0
- package/dist/testing/testing.cjs.map +1 -0
- package/dist/testing/testing.d.ts +18 -0
- package/dist/testing/testing.d.ts.map +1 -0
- package/dist/testing/testing.js +44 -0
- package/dist/testing/testing.js.map +1 -0
- package/dist/testing.cjs +1 -0
- package/dist/testing.js +2 -0
- package/dist/types.d.ts +277 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +53 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
export type EventMap = Record<string, unknown>;
|
|
2
|
+
export type EventKey<T extends EventMap> = keyof T & string;
|
|
3
|
+
export type Listener<T> = (payload: T) => void;
|
|
4
|
+
export type Unsubscribe = () => void;
|
|
5
|
+
/**
|
|
6
|
+
* Options for a single-event subscription. Passed as the third argument to `bus.on()`.
|
|
7
|
+
* Both fields are optional and can be combined freely.
|
|
8
|
+
*/
|
|
9
|
+
export type SubscribeOptions = {
|
|
10
|
+
/** Auto-remove the listener after its first invocation. Equivalent to calling `bus.once()`. */
|
|
11
|
+
once?: boolean;
|
|
12
|
+
/** Auto-remove the listener when this signal aborts. */
|
|
13
|
+
signal?: AbortSignal;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Context object passed to `BusOptions.onError` when a listener throws.
|
|
17
|
+
* Provides structured access to the error, the triggering event, and a timestamp.
|
|
18
|
+
*/
|
|
19
|
+
export type EmissionErrorContext<T extends EventMap = EventMap> = {
|
|
20
|
+
/** The thrown error value. */
|
|
21
|
+
err: unknown;
|
|
22
|
+
/** The event key that triggered the failing listener. */
|
|
23
|
+
event: EventKey<T>;
|
|
24
|
+
/** The payload that was passed to the failing listener. */
|
|
25
|
+
payload: unknown;
|
|
26
|
+
/** Timestamp (ms since epoch) captured at the moment `emit()` was called. */
|
|
27
|
+
timestamp: number;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* A middleware function called in sequence during `emit()`, before any listeners run.
|
|
31
|
+
* Call `next()` to continue the chain. Omitting `next()` prevents all listeners from running.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* const rateLimit: Middleware<Events> = (event, payload, next) => {
|
|
35
|
+
* if (shouldAllow(event)) next();
|
|
36
|
+
* };
|
|
37
|
+
*/
|
|
38
|
+
export type Middleware<T extends EventMap = EventMap> = (event: EventKey<T>, payload: unknown, next: () => void) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Custom logger injected via `BusOptions.logger`.
|
|
41
|
+
* Both methods are optional — omit one to silence that level.
|
|
42
|
+
*/
|
|
43
|
+
export type BusLogger = {
|
|
44
|
+
debug?: (msg: string) => void;
|
|
45
|
+
warn?: (msg: string) => void;
|
|
46
|
+
};
|
|
47
|
+
export type BusOptions<T extends EventMap = EventMap> = {
|
|
48
|
+
/**
|
|
49
|
+
* Custom logger for `debug` and `warn` output.
|
|
50
|
+
* Provide `logger.debug` to enable subscription/emission/disposal logging with `[herald:*]` prefixes.
|
|
51
|
+
* Omit to disable all debug output. Pass `{}` to silence warnings too.
|
|
52
|
+
*
|
|
53
|
+
* Prefer `debugBus()` from `@vielzeug/herald/devtools` over wiring this manually — it passes
|
|
54
|
+
* `console.debug` for you and is tree-shaken from production bundles.
|
|
55
|
+
*
|
|
56
|
+
* **Note:** Event key strings appear in log messages — do not encode sensitive data in event names.
|
|
57
|
+
*/
|
|
58
|
+
logger?: BusLogger;
|
|
59
|
+
/**
|
|
60
|
+
* Warn when a single event's active listener count exceeds this threshold.
|
|
61
|
+
* Output goes to `logger.warn` (default: `console.warn`).
|
|
62
|
+
* Useful for detecting listener leaks during development. Default: no check.
|
|
63
|
+
*/
|
|
64
|
+
maxListeners?: number;
|
|
65
|
+
/**
|
|
66
|
+
* Middleware functions run in order on every `emit()`, before listeners run.
|
|
67
|
+
* Each receives `(event, payload, next)` — call `next()` to proceed, or omit to block dispatch.
|
|
68
|
+
*/
|
|
69
|
+
middleware?: readonly Middleware<T>[];
|
|
70
|
+
/**
|
|
71
|
+
* Optional display name for this bus instance.
|
|
72
|
+
* Appears in debug log prefixes and in `BusDisposedError` messages.
|
|
73
|
+
* Useful when running multiple buses concurrently to identify which bus produced a log or error.
|
|
74
|
+
*
|
|
75
|
+
* **Note:** The name is embedded in `BusDisposedError` messages and debug logs — avoid using
|
|
76
|
+
* sensitive or user-derived values that could leak via error trackers or log aggregators.
|
|
77
|
+
*/
|
|
78
|
+
name?: string;
|
|
79
|
+
/**
|
|
80
|
+
* If provided, listener errors are forwarded here instead of re-thrown.
|
|
81
|
+
* Receives a structured `EmissionErrorContext` with the error, event key, payload, and timestamp.
|
|
82
|
+
*
|
|
83
|
+
* **Note:** every registered listener (specific and wildcard) for an emission always runs,
|
|
84
|
+
* regardless of `onError` — a throwing listener never prevents the rest from being called.
|
|
85
|
+
*/
|
|
86
|
+
onError?: (context: EmissionErrorContext<T>) => void;
|
|
87
|
+
/**
|
|
88
|
+
* Called on every emit before middleware and listeners. Throw to reject the payload.
|
|
89
|
+
* On throw with `onError` configured, the error is forwarded and `emit()` returns 0.
|
|
90
|
+
* On throw without `onError`, the error propagates to the `emit()` caller.
|
|
91
|
+
* Receives the typed payload — use it to perform runtime validation with full type information.
|
|
92
|
+
*/
|
|
93
|
+
validatePayload?: <K extends EventKey<T>>(event: K, payload: T[K]) => void;
|
|
94
|
+
};
|
|
95
|
+
/** Discriminated-union result type for `waitAny`. */
|
|
96
|
+
export type WaitAnyResult<T extends EventMap, K extends readonly EventKey<T>[]> = {
|
|
97
|
+
[I in keyof K]: K[I] extends EventKey<T> ? {
|
|
98
|
+
event: K[I];
|
|
99
|
+
payload: T[K[I]];
|
|
100
|
+
} : never;
|
|
101
|
+
}[number];
|
|
102
|
+
/**
|
|
103
|
+
* Keys present in both `S` and `T` where `S[K]` is assignable to `T[K]`.
|
|
104
|
+
* These keys can be forwarded from a source bus to a target bus without a type cast.
|
|
105
|
+
*/
|
|
106
|
+
export type PipeableKey<S extends EventMap, T extends EventMap> = {
|
|
107
|
+
[K in EventKey<S> & EventKey<T>]: S[K] extends T[K] ? K : never;
|
|
108
|
+
}[EventKey<S> & EventKey<T>];
|
|
109
|
+
/**
|
|
110
|
+
* A single pipe entry passed to `pipeEvents`:
|
|
111
|
+
* - A `PipeableKey` string — forward the event under the same name.
|
|
112
|
+
* - A `{ from, to }` object — forward the event under a different name on the target bus.
|
|
113
|
+
*/
|
|
114
|
+
export type PipeEntry<S extends EventMap, T extends EventMap> = PipeableKey<S, T> | {
|
|
115
|
+
from: EventKey<S>;
|
|
116
|
+
to: EventKey<T>;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* An `AsyncGenerator` extended with `AsyncDisposable`. Returned by `bus.events()`.
|
|
120
|
+
*
|
|
121
|
+
* Use `await using` for guaranteed cleanup, or call `[Symbol.asyncDispose]()` explicitly.
|
|
122
|
+
* Compose with standard async-generator utilities (e.g. `for await` + `break`) or
|
|
123
|
+
* user-space operators as needed.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* await using stream = bus.events('count');
|
|
127
|
+
* for await (const n of stream) { ... } // subscription cleaned up automatically
|
|
128
|
+
*/
|
|
129
|
+
export type EventStream<T> = AsyncGenerator<T> & AsyncDisposable;
|
|
130
|
+
export type Bus<T extends EventMap> = {
|
|
131
|
+
/** Alias for dispose() — enables the `using` keyword for automatic cleanup. */
|
|
132
|
+
[Symbol.dispose](): void;
|
|
133
|
+
/**
|
|
134
|
+
* Signal that fires when the bus is disposed.
|
|
135
|
+
* Use to tie other lifecycles (subscriptions, pipes, timers) to this bus's lifetime.
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* // Stop piping when the target bus is disposed
|
|
139
|
+
* source.on('event', handler, { signal: target.disposalSignal });
|
|
140
|
+
*/
|
|
141
|
+
readonly disposalSignal: AbortSignal;
|
|
142
|
+
/** Permanently dispose the bus — clears all listeners; pending waits are rejected. Idempotent. */
|
|
143
|
+
dispose(): void;
|
|
144
|
+
/** Whether the bus has been permanently disposed. */
|
|
145
|
+
readonly disposed: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Emit an event, calling all registered listeners synchronously.
|
|
148
|
+
* Returns the total number of listeners that were invoked (specific + wildcard).
|
|
149
|
+
* Returns `0` if the bus is disposed, if a middleware blocked dispatch, or if `validatePayload` rejected.
|
|
150
|
+
*
|
|
151
|
+
* @remarks **Listener throws:** every listener still runs even if an earlier one throws. Without
|
|
152
|
+
* `onError` configured, the first thrown error is rethrown once every listener has been called —
|
|
153
|
+
* it never short-circuits the rest of the broadcast. With `onError` configured, errors are
|
|
154
|
+
* forwarded per-listener and `emit()` never throws for a listener failure.
|
|
155
|
+
*/
|
|
156
|
+
emit<K extends EventKey<T>>(event: K, ...args: T[K] extends void ? [] : [payload: T[K]]): number;
|
|
157
|
+
/** Returns the list of event names that currently have at least one active listener. */
|
|
158
|
+
eventNames(): EventKey<T>[];
|
|
159
|
+
/**
|
|
160
|
+
* Async-iterate over all future emits of an event. Terminates when the bus is disposed or signal aborts.
|
|
161
|
+
*
|
|
162
|
+
* @remarks **Eager subscription:** The subscription starts when `events()` is called, not when the
|
|
163
|
+
* first iteration begins. Events emitted before the first `await` are buffered and will be yielded.
|
|
164
|
+
*
|
|
165
|
+
* @remarks **Buffer:** Internal buffer is unbounded by default. Pass `maxBuffer` to cap it — oldest
|
|
166
|
+
* values are dropped when the buffer is full. Validation is synchronous: `maxBuffer ≤ 0` throws
|
|
167
|
+
* `RangeError` at call time, before any iteration.
|
|
168
|
+
*
|
|
169
|
+
* @remarks **Cleanup:** Returns an `EventStream` — use `await using` for guaranteed cleanup:
|
|
170
|
+
* ```ts
|
|
171
|
+
* await using stream = bus.events('event');
|
|
172
|
+
* for await (const val of stream) { ... }
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
events<K extends EventKey<T>>(event: K, options?: {
|
|
176
|
+
maxBuffer?: number;
|
|
177
|
+
signal?: AbortSignal;
|
|
178
|
+
}): EventStream<T[K]>;
|
|
179
|
+
/**
|
|
180
|
+
* Number of active specific-event listeners for a given event key.
|
|
181
|
+
* Does not include wildcard (`onAny`) listeners — use `wildcardCount()` for those.
|
|
182
|
+
* When called without an argument, returns the total across all specific-event listeners.
|
|
183
|
+
*/
|
|
184
|
+
listenerCount(event?: EventKey<T>): number;
|
|
185
|
+
/**
|
|
186
|
+
* Subscribe to an event. Returns an unsubscribe function.
|
|
187
|
+
*
|
|
188
|
+
* - `opts.signal` — auto-unsubscribe when the signal aborts.
|
|
189
|
+
* - `opts.once` — auto-unsubscribe after the first invocation (equivalent to `bus.once()`).
|
|
190
|
+
*
|
|
191
|
+
* The same listener function can be registered multiple times — each registration is independent
|
|
192
|
+
* and receives its own unsubscribe handle.
|
|
193
|
+
*/
|
|
194
|
+
on<K extends EventKey<T>>(event: K, listener: Listener<T[K]>, opts?: SubscribeOptions): Unsubscribe;
|
|
195
|
+
/**
|
|
196
|
+
* Subscribe to **all** events. The listener is called after event-specific listeners on every emit,
|
|
197
|
+
* receiving the event name and payload. Returns an unsubscribe function.
|
|
198
|
+
*
|
|
199
|
+
* - `opts.signal` — auto-unsubscribe when the signal aborts.
|
|
200
|
+
* - `opts.once` — auto-unsubscribe after the first invocation.
|
|
201
|
+
*
|
|
202
|
+
* Useful for cross-cutting concerns like logging, analytics, and tracing.
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* bus.onAny((event, payload) => logger.debug('dispatched', { event, payload }));
|
|
206
|
+
*/
|
|
207
|
+
onAny(listener: (event: EventKey<T>, payload: unknown) => void, opts?: SubscribeOptions): Unsubscribe;
|
|
208
|
+
/**
|
|
209
|
+
* Subscribe once — auto-unsubscribes after the first emit. Stops early when the signal aborts.
|
|
210
|
+
* Convenience wrapper around `bus.on(event, listener, { once: true, signal: opts?.signal })`.
|
|
211
|
+
*/
|
|
212
|
+
once<K extends EventKey<T>>(event: K, listener: Listener<T[K]>, opts?: {
|
|
213
|
+
signal?: AbortSignal;
|
|
214
|
+
}): Unsubscribe;
|
|
215
|
+
/**
|
|
216
|
+
* Resolve on the next emit of the given event.
|
|
217
|
+
* Rejects with `BusDisposedError` if the bus is disposed before the event fires,
|
|
218
|
+
* or with the signal's reason if the signal aborts.
|
|
219
|
+
*/
|
|
220
|
+
wait<K extends EventKey<T>>(event: K, opts?: {
|
|
221
|
+
signal?: AbortSignal;
|
|
222
|
+
}): Promise<T[K]>;
|
|
223
|
+
/**
|
|
224
|
+
* Resolve when any of the listed events (minimum 2) fires first.
|
|
225
|
+
* Returns a typed `{ event, payload }` discriminated union — the winning event name is narrowed to a literal.
|
|
226
|
+
* Rejects with `BusDisposedError` if the bus is disposed, or with the signal's reason if the signal aborts.
|
|
227
|
+
*/
|
|
228
|
+
waitAny<const K extends readonly [EventKey<T>, EventKey<T>, ...EventKey<T>[]]>(events: K, opts?: {
|
|
229
|
+
signal?: AbortSignal;
|
|
230
|
+
}): Promise<WaitAnyResult<T, K>>;
|
|
231
|
+
/**
|
|
232
|
+
* Number of active wildcard (`onAny`) listeners.
|
|
233
|
+
* These fire on every emission regardless of event key.
|
|
234
|
+
*/
|
|
235
|
+
wildcardCount(): number;
|
|
236
|
+
};
|
|
237
|
+
/** Map of event names to their initial values for `createBehaviorBus`. */
|
|
238
|
+
export type BehaviorInitial<T extends EventMap> = {
|
|
239
|
+
[K in EventKey<T>]?: T[K];
|
|
240
|
+
};
|
|
241
|
+
/** Options for `createBehaviorBus` — extends standard `BusOptions`. */
|
|
242
|
+
export type BehaviorBusOptions<T extends EventMap = EventMap> = BusOptions<T>;
|
|
243
|
+
/**
|
|
244
|
+
* A bus that remembers the last emitted value for each event.
|
|
245
|
+
* New subscribers immediately receive the current value via `on()` and `once()`.
|
|
246
|
+
*/
|
|
247
|
+
export type BehaviorBus<T extends EventMap> = Bus<T> & {
|
|
248
|
+
/**
|
|
249
|
+
* Returns the most recently emitted value for the given event, or `undefined` if no value has
|
|
250
|
+
* been emitted yet (and no initial value was provided).
|
|
251
|
+
*/
|
|
252
|
+
current<K extends EventKey<T>>(event: K): T[K] | undefined;
|
|
253
|
+
/**
|
|
254
|
+
* Clear the current value for a specific event, or for all events when called without arguments.
|
|
255
|
+
* After reset, new subscribers will not receive a replayed value until the next emit.
|
|
256
|
+
* Does not affect active subscriptions or the disposed state of the bus.
|
|
257
|
+
*
|
|
258
|
+
* @example
|
|
259
|
+
* bus.reset('count'); // clear only 'count'
|
|
260
|
+
* bus.reset(); // clear all buffers
|
|
261
|
+
*/
|
|
262
|
+
reset(event?: EventKey<T>): void;
|
|
263
|
+
/**
|
|
264
|
+
* Returns a plain object snapshot of the most recently emitted value for every currently
|
|
265
|
+
* buffered event. Events with no value in the buffer are omitted from the result.
|
|
266
|
+
*
|
|
267
|
+
* Useful for serialization, hydration, and debugging multiple channels at once.
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* const bus = createBehaviorBus<{ theme: string; zoom: number }>({ theme: 'light', zoom: 1 });
|
|
271
|
+
* bus.snapshot(); // { theme: 'light', zoom: 1 }
|
|
272
|
+
* bus.emit('theme', 'dark');
|
|
273
|
+
* bus.snapshot(); // { theme: 'dark', zoom: 1 }
|
|
274
|
+
*/
|
|
275
|
+
snapshot(): Partial<T>;
|
|
276
|
+
};
|
|
277
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 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E;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GAC9B,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAChC;;;OAGG;IACH,aAAa,IAAI,MAAM,CAAC;CACzB,CAAC;AAEF,0EAA0E;AAC1E,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,QAAQ,IAAI;KAC/C,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CAC1B,CAAC;AAEF,uEAAuE;AACvE,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;AAE9E;;;GAGG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,QAAQ,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG;IACrD;;;OAGG;IACH,OAAO,CAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAC3D;;;;;;;;OAQG;IACH,KAAK,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IACjC;;;;;;;;;;;OAWG;IACH,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;CACxB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vielzeug/herald",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "Typed event bus — pub/sub with namespaces, wildcards, and once-listeners",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"main": "./dist/index.cjs",
|
|
10
|
+
"module": "./dist/index.js",
|
|
11
|
+
"types": "dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"source": "./src/index.ts",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"require": "./dist/index.cjs"
|
|
18
|
+
},
|
|
19
|
+
"./devtools": {
|
|
20
|
+
"source": "./src/devtools.ts",
|
|
21
|
+
"types": "./dist/devtools.d.ts",
|
|
22
|
+
"import": "./dist/devtools.js",
|
|
23
|
+
"require": "./dist/devtools.cjs"
|
|
24
|
+
},
|
|
25
|
+
"./testing": {
|
|
26
|
+
"source": "./src/testing/index.ts",
|
|
27
|
+
"types": "./dist/testing.d.ts",
|
|
28
|
+
"import": "./dist/testing.js",
|
|
29
|
+
"require": "./dist/testing.cjs"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"bench": "vitest bench",
|
|
34
|
+
"build": "vite build && pnpm run build:bundle && pnpm run build:types",
|
|
35
|
+
"build:types": "tsc -p tsconfig.declarations.json",
|
|
36
|
+
"fix": "eslint --fix src",
|
|
37
|
+
"lint": "eslint src",
|
|
38
|
+
"prepublishOnly": "pnpm run build",
|
|
39
|
+
"preview": "vite preview",
|
|
40
|
+
"test": "vitest",
|
|
41
|
+
"build:bundle": "vite build --config vite.bundle.config.ts"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public",
|
|
45
|
+
"registry": "https://registry.npmjs.org/"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^26.1.0",
|
|
49
|
+
"typescript": "~6.0.3",
|
|
50
|
+
"vite": "^8.1.3",
|
|
51
|
+
"vitest": "^4.1.9"
|
|
52
|
+
}
|
|
53
|
+
}
|