riteshjs 0.0.0-stage → 0.1.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.
@@ -0,0 +1,51 @@
1
+ /*! ritesh | MIT | Copyright (c) 2026 Jarrod Baumann | bundles xterm.js (MIT, see THIRD_PARTY_NOTICES) */
2
+ import { G as RemoteHandle } from "./contracts-C55jYvFz.js";
3
+ /** The part of a WebSocket the client uses. The DOM WebSocket satisfies it. */
4
+ interface SocketLike {
5
+ readonly protocol: string;
6
+ readonly bufferedAmount: number;
7
+ send(data: string): void;
8
+ close(code?: number, reason?: string): void;
9
+ addEventListener(type: "open", listener: () => void): void;
10
+ addEventListener(type: "message", listener: (event: {
11
+ data: unknown;
12
+ }) => void): void;
13
+ addEventListener(type: "close", listener: (event: {
14
+ code: number;
15
+ }) => void): void;
16
+ }
17
+ type SocketFactory = (url: string, protocols: string[]) => SocketLike;
18
+ /** Time and timers, injected so tests never wait. */
19
+ interface Clock {
20
+ now(): number;
21
+ setTimeout(fn: () => void, ms: number): unknown;
22
+ clearTimeout(handle: unknown): void;
23
+ }
24
+ interface RemoteOptions {
25
+ /** The server's WebSocket URL (wss://...). */
26
+ url: string;
27
+ /** Where the remote filesystem is mounted. Absolute. */
28
+ at: string;
29
+ /** Where remote commands land. Defaults to `<at>/bin`. */
30
+ bin?: string;
31
+ /** Names of the variables sent with proc.start. Default: none. */
32
+ env?: string[];
33
+ /** Called on every connection attempt. */
34
+ token: () => string | Promise<string>;
35
+ /** "lazy" (default) connects on first use and disconnects when idle. "eager" connects at once and stays. */
36
+ connect?: "lazy" | "eager";
37
+ /** Command names known before the first connection. */
38
+ commands?: string[];
39
+ /** Opens the socket. Defaults to globalThis.WebSocket. */
40
+ socket?: SocketFactory;
41
+ /** Time and timers. Defaults to Date.now and the global timers. */
42
+ clock?: Clock;
43
+ /** Jitter source in [0, 1). Defaults to Math.random. */
44
+ random?: () => number;
45
+ }
46
+ /**
47
+ * A remote server as a mount and a command source for createRite. Nothing is
48
+ * sent until the first use unless `connect` is "eager".
49
+ */
50
+ export declare function remote(options: RemoteOptions): RemoteHandle;
51
+ export type { Clock, RemoteOptions, SocketFactory, SocketLike };