@use-everywhere/core 0.6.0 → 0.7.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,20 @@
1
+ /**
2
+ * Which mechanism a transport actually uses. Worth surfacing, because they are
3
+ * not equivalent: `storage` is a fallback with lower fidelity than
4
+ * `broadcast-channel`, and `none` means nothing is being shared at all.
5
+ */
6
+ type TransportKind = 'broadcast-channel' | 'storage' | 'memory' | 'none' | (string & {});
7
+ /**
8
+ * Minimal message bus. Implementations: BroadcastChannelTransport (same-origin),
9
+ * StorageTransport (fallback), NoopTransport (SSR / local-only), MemoryTransport
10
+ * (tests). A transport never echoes a client's own posts back to it.
11
+ */
12
+ interface Transport {
13
+ /** What this transport is. Optional so a custom transport need not declare one. */
14
+ readonly kind?: TransportKind;
15
+ post(data: unknown): void;
16
+ subscribe(listener: (data: unknown) => void): () => void;
17
+ close(): void;
18
+ }
19
+
20
+ export type { Transport as T, TransportKind as a };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@use-everywhere/core",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Cross-tab shared state, events, presence, and cross-origin window channels",
5
5
  "license": "MIT",
6
6
  "author": "Jonatan Kruszewski <jonakrusze@gmail.com>",
@@ -58,43 +58,43 @@
58
58
  "name": "everything (import *)",
59
59
  "path": "dist/index.js",
60
60
  "import": "*",
61
- "limit": "5 kB"
61
+ "limit": "7.2 kB"
62
62
  },
63
63
  {
64
64
  "name": "createLeader",
65
65
  "path": "dist/index.js",
66
66
  "import": "{ createLeader }",
67
- "limit": "1.6 kB"
67
+ "limit": "3.33 kB"
68
68
  },
69
69
  {
70
70
  "name": "createSharedStore",
71
71
  "path": "dist/index.js",
72
72
  "import": "{ createSharedStore }",
73
- "limit": "2.25 kB"
73
+ "limit": "3.3 kB"
74
74
  },
75
75
  {
76
76
  "name": "createChannel",
77
77
  "path": "dist/index.js",
78
78
  "import": "{ createChannel }",
79
- "limit": "1.25 kB"
79
+ "limit": "2.1 kB"
80
80
  },
81
81
  {
82
82
  "name": "createPresence",
83
83
  "path": "dist/index.js",
84
84
  "import": "{ createPresence }",
85
- "limit": "1.35 kB"
85
+ "limit": "2.28 kB"
86
86
  },
87
87
  {
88
88
  "name": "openWindow (opener side)",
89
89
  "path": "dist/index.js",
90
90
  "import": "{ openWindow }",
91
- "limit": "1.3 kB"
91
+ "limit": "1.49 kB"
92
92
  },
93
93
  {
94
94
  "name": "connectToOpener (child side)",
95
95
  "path": "dist/index.js",
96
96
  "import": "{ connectToOpener }",
97
- "limit": "1.15 kB"
97
+ "limit": "1.32 kB"
98
98
  },
99
99
  {
100
100
  "name": "observeBus + enableDebug",
@@ -119,6 +119,7 @@
119
119
  "@arethetypeswrong/cli": "^0.18.5",
120
120
  "@size-limit/preset-small-lib": "^13.0.1",
121
121
  "@vitest/coverage-v8": "^4.1.10",
122
+ "fast-check": "^4.9.0",
122
123
  "happy-dom": "^20.11.1",
123
124
  "publint": "^0.3.21",
124
125
  "size-limit": "^13.0.1",
@@ -1,12 +0,0 @@
1
- /**
2
- * Minimal message bus. Implementations: BroadcastChannelTransport (same-origin),
3
- * NoopTransport (SSR / local-only), MemoryTransport (tests). A transport never
4
- * echoes a client's own posts back to it.
5
- */
6
- interface Transport {
7
- post(data: unknown): void;
8
- subscribe(listener: (data: unknown) => void): () => void;
9
- close(): void;
10
- }
11
-
12
- export type { Transport as T };
@@ -1,12 +0,0 @@
1
- /**
2
- * Minimal message bus. Implementations: BroadcastChannelTransport (same-origin),
3
- * NoopTransport (SSR / local-only), MemoryTransport (tests). A transport never
4
- * echoes a client's own posts back to it.
5
- */
6
- interface Transport {
7
- post(data: unknown): void;
8
- subscribe(listener: (data: unknown) => void): () => void;
9
- close(): void;
10
- }
11
-
12
- export type { Transport as T };