feat(types): export every type a public signature uses
Public declarations named types the entry points did not export, so a caller could invoke the API but could not name its parameters or results. The affected types were ModuleOptions, Ctor, BusLike, ArgSource, GraphNodeView, GraphRouteView, StandardIssue, StandardResult, the experimental mesh types, and the adapter option types: DenoServeOptions, BunServeOptions and EdgeCtx. Export them all. The changes are additive only, and no beta.2 name moves. Bun's private BunServeShortOptions becomes the exported BunServeOptions, and the ambient Bun.serve shape is renamed so the two cannot collide. channel() had started returning TappableChannel, which leaked the internal tap symbol into its public return type. Restore the beta.2 return type, Channel<T>. ws-core still finds the tap through the symbol, not through the signature. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
7 files changed
+39
-18
No files matched your search
+5
-2
@@ -118,13 +118,15 @@ function newSub<T>(onReturn: () => void): Sub<T> {
|
||||
* Creates a fan-out {@link Channel}. Values pushed are delivered to every active subscriber.
|
||||
* @param opts.buffer Per-subscriber queue cap; drops oldest when exceeded (default: unbounded).
|
||||
*/
|
||||
export function channel<T>(opts: { buffer?: number } = {}): TappableChannel<T> {
|
||||
export function channel<T>(opts: { buffer?: number } = {}): Channel<T> {
|
||||
const cap = opts.buffer ?? Infinity;
|
||||
const subs = new Set<Omit<Sub<T>, 'iterator'>>();
|
||||
let done = false;
|
||||
let closedFlag = false;
|
||||
|
||||
return {
|
||||
// Public type stays `Channel<T>` (as in beta.2): the tap is internal plumbing, found by `ws-core`
|
||||
// through the symbol rather than through this signature.
|
||||
const ch: TappableChannel<T> = {
|
||||
get closed() {
|
||||
return closedFlag;
|
||||
},
|
||||
@@ -161,4 +163,5 @@ export function channel<T>(opts: { buffer?: number } = {}): TappableChannel<T> {
|
||||
return () => subs.delete(sink);
|
||||
},
|
||||
};
|
||||
return ch;
|
||||
}
|
||||
Reference in new issue
Block a user