@mauroandre/velojs 0.0.56 → 0.0.57

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/dist/channels.js CHANGED
@@ -1,110 +1,156 @@
1
- import { DEFAULT_HEARTBEAT_MS as L } from "./events.js";
2
- const O = "snapshot", R = "slice", U = "error", B = "close", k = 50, q = 3e5;
3
- let m = {}, C = k, b = q, j = L, x = !0;
4
- function ie(e, t) {
5
- m = e ? { ...e } : {}, C = t?.coalesceMs ?? k, b = t?.idleMs ?? q, j = t?.heartbeatMs ?? L, x = t?.logEmits ?? !0, V();
1
+ import { DEFAULT_HEARTBEAT_MS as J } from "./events.js";
2
+ const U = "snapshot", V = "slice", ne = "error", oe = "close", H = 50, W = 3e5;
3
+ let d = {}, O = H, M = W, N = J, F = !0;
4
+ function ye(e, t) {
5
+ d = e ? { ...e } : {}, O = t?.coalesceMs ?? H, M = t?.idleMs ?? W, N = t?.heartbeatMs ?? J, F = t?.logEmits ?? !0, Q(), E.clear();
6
6
  }
7
- function se() {
8
- return m;
7
+ function we() {
8
+ return d;
9
9
  }
10
- function ae() {
11
- return Object.keys(m);
10
+ function ge() {
11
+ return Object.keys(d);
12
12
  }
13
- const d = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map();
14
- function K(e, t) {
15
- return `${e}\0${t}`;
16
- }
17
- function Q(e, t) {
18
- const n = K(e, t);
19
- if (v.has(n)) return;
20
- const o = setTimeout(() => {
21
- v.delete(n), G(e, t);
22
- }, C), r = o.unref;
23
- typeof r == "function" && r.call(o), v.set(n, { timer: o, channel: e, partition: t });
13
+ const f = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map(), $ = /* @__PURE__ */ new Map();
14
+ function se(e, t) {
15
+ const r = P(e, t);
16
+ if ($.has(r)) return;
17
+ const n = setTimeout(() => {
18
+ $.delete(r), Y(e, t);
19
+ }, O), o = n.unref;
20
+ typeof o == "function" && o.call(n), $.set(r, { timer: n, channel: e, partition: t });
24
21
  }
25
- function V() {
26
- for (const e of v.values()) clearTimeout(e.timer);
27
- v.clear();
22
+ function Q() {
23
+ for (const e of $.values()) clearTimeout(e.timer);
24
+ $.clear();
28
25
  }
29
- function le() {
26
+ function ve() {
30
27
  const e = [];
31
28
  let t = 0;
32
- for (const [o, r] of d) {
33
- const l = [];
34
- for (const [f, u] of r) {
35
- const a = /* @__PURE__ */ new Map();
36
- for (const c of u) {
37
- const s = a.get(c.moduleId) ?? { count: 0, last: void 0 };
38
- s.count += 1, c.lastDeliveryAt !== void 0 && (s.last === void 0 || c.lastDeliveryAt > s.last) && (s.last = c.lastDeliveryAt), a.set(c.moduleId, s);
29
+ for (const [n, o] of f) {
30
+ const s = [];
31
+ for (const [l, c] of o) {
32
+ const p = /* @__PURE__ */ new Map();
33
+ for (const a of c) {
34
+ const u = p.get(a.moduleId) ?? { count: 0, last: void 0 };
35
+ u.count += 1, a.lastDeliveryAt !== void 0 && (u.last === void 0 || a.lastDeliveryAt > u.last) && (u.last = a.lastDeliveryAt), p.set(a.moduleId, u);
39
36
  }
40
- for (const [c, s] of a)
41
- l.push({
42
- moduleId: c,
43
- partition: f,
44
- connections: s.count,
45
- lastDeliveryAt: s.last === void 0 ? null : new Date(s.last).toISOString()
37
+ for (const [a, u] of p)
38
+ s.push({
39
+ moduleId: a,
40
+ partition: l,
41
+ connections: u.count,
42
+ lastDeliveryAt: u.last === void 0 ? null : new Date(u.last).toISOString()
46
43
  });
47
44
  }
48
45
  e.push({
49
- channel: o,
50
- groups: l,
51
- connections: z(r)
52
- }), t += z(r);
46
+ channel: n,
47
+ groups: s,
48
+ connections: q(o)
49
+ }), t += q(o);
53
50
  }
54
- const n = [];
55
- for (const o of v.values())
56
- n.push({ channel: o.channel, partition: o.partition });
57
- return { channels: e, openCoalesceWindows: n, totalConnections: t };
51
+ const r = [];
52
+ for (const n of $.values())
53
+ r.push({ channel: n.channel, partition: n.partition });
54
+ return { channels: e, openCoalesceWindows: r, totalConnections: t };
58
55
  }
59
- function z(e) {
56
+ function q(e) {
60
57
  let t = 0;
61
- for (const n of e.values()) t += n.size;
58
+ for (const r of e.values()) t += r.size;
62
59
  return t;
63
60
  }
64
- function X(e) {
65
- let t = d.get(e.channel);
66
- t || (t = /* @__PURE__ */ new Map(), d.set(e.channel, t));
67
- let n = t.get(e.partition);
68
- n || (n = /* @__PURE__ */ new Set(), t.set(e.partition, n)), n.add(e);
61
+ function P(e, t) {
62
+ return `${e}\0${t}`;
63
+ }
64
+ function ie(e) {
65
+ let t = f.get(e.channel);
66
+ t || (t = /* @__PURE__ */ new Map(), f.set(e.channel, t));
67
+ let r = t.get(e.partition);
68
+ r || (r = /* @__PURE__ */ new Set(), t.set(e.partition, r));
69
+ const n = r.size === 0;
70
+ return r.add(e), n;
71
+ }
72
+ function x(e) {
73
+ const t = f.get(e.channel), r = t?.get(e.partition);
74
+ if (!t || !r) return !1;
75
+ r.delete(e);
76
+ const n = r.size === 0;
77
+ return n && t.delete(e.partition), t.size === 0 && f.delete(e.channel), n;
69
78
  }
70
- function Y(e) {
71
- const t = d.get(e.channel), n = t?.get(e.partition);
72
- !t || !n || (n.delete(e), n.size === 0 && t.delete(e.partition), t.size === 0 && d.delete(e.channel));
79
+ function B(e, t, r) {
80
+ const n = P(e, t), o = d[e]?.onGroupOpen, s = (async () => {
81
+ if (typeof o == "function")
82
+ try {
83
+ await o({ partition: t, params: r });
84
+ } catch (l) {
85
+ console.error(
86
+ `[velojs] channel "${e}" onGroupOpen failed for partition "${t}":`,
87
+ l
88
+ );
89
+ }
90
+ })();
91
+ return E.set(n, s), s.then(() => {
92
+ E.get(n) === s && E.delete(n);
93
+ }), s;
94
+ }
95
+ async function ae(e) {
96
+ const t = P(e.channel, e.partition), r = E.get(t);
97
+ r && await r;
98
+ const n = f.get(e.channel)?.get(e.partition);
99
+ if (!n || !n.has(e) || n.size > 1) {
100
+ x(e);
101
+ return;
102
+ }
103
+ const o = d[e.channel]?.onGroupClose;
104
+ if (typeof o == "function")
105
+ try {
106
+ await o({ partition: e.partition });
107
+ } catch (c) {
108
+ console.error(
109
+ `[velojs] channel "${e.channel}" onGroupClose failed for partition "${e.partition}":`,
110
+ c
111
+ );
112
+ }
113
+ x(e);
114
+ const s = f.get(e.channel)?.get(e.partition), l = s ? [...s][0] : void 0;
115
+ l && await B(e.channel, e.partition, l.params);
73
116
  }
74
- function ue() {
75
- d.clear(), V();
117
+ function Ee() {
118
+ f.clear(), E.clear(), Q();
76
119
  }
77
- async function $(e, t) {
78
- const n = e.scope;
79
- return typeof n != "function" ? "all" : await n(t);
120
+ async function T(e, t) {
121
+ const r = e.scope;
122
+ return typeof r != "function" ? "all" : await r(t);
80
123
  }
81
- function Z(e, t) {
124
+ function le(e, t) {
82
125
  return e.get(t);
83
126
  }
84
- async function H(e, t) {
85
- const n = d.get(e)?.get(t);
86
- if (!n || n.size === 0) return null;
87
- const o = m[e], r = [];
88
- for (const l of [...n]) {
89
- let f;
127
+ async function K(e, t) {
128
+ const r = f.get(e)?.get(t);
129
+ if (!r || r.size === 0) return null;
130
+ const n = d[e], o = [];
131
+ for (const s of [...r]) {
132
+ let l;
90
133
  try {
91
- f = await $(o, l.principal);
92
- } catch (u) {
93
- console.error(`[velojs] channel "${e}" scope threw on emit:`, u), f = null;
134
+ l = await T(n, {
135
+ user: s.principal,
136
+ params: s.params
137
+ });
138
+ } catch (c) {
139
+ console.error(`[velojs] channel "${e}" scope threw on emit:`, c), l = null;
94
140
  }
95
- if (f == null || f !== t) {
96
- await l.terminate();
141
+ if (l == null || l !== t) {
142
+ await s.terminate();
97
143
  continue;
98
144
  }
99
- r.push(l);
145
+ o.push(s);
100
146
  }
101
- return r.length > 0 ? r : null;
147
+ return o.length > 0 ? o : null;
102
148
  }
103
- async function G(e, t) {
104
- const n = await H(e, t);
105
- n && await Promise.all(n.map((o) => J(o)));
149
+ async function Y(e, t) {
150
+ const r = await K(e, t);
151
+ r && await Promise.all(r.map((n) => X(n)));
106
152
  }
107
- async function J(e) {
153
+ async function X(e) {
108
154
  let t;
109
155
  try {
110
156
  t = await e.loader({
@@ -112,172 +158,219 @@ async function J(e) {
112
158
  query: e.query,
113
159
  c: e.c
114
160
  });
115
- } catch (n) {
161
+ } catch (r) {
116
162
  await e.send(
117
- U,
163
+ ne,
118
164
  JSON.stringify({
119
- message: n instanceof Error ? n.message : String(n)
165
+ message: r instanceof Error ? r.message : String(r)
120
166
  })
121
167
  );
122
168
  return;
123
169
  }
124
- t instanceof Response || await e.send(O, JSON.stringify(t ?? null));
170
+ t instanceof Response || await e.send(U, JSON.stringify(t ?? null));
125
171
  }
126
- function ce(e, t, n, o) {
127
- return typeof e == "string" ? ee(e, t) : te(e, t, n, o);
172
+ function $e(e, t, r, n) {
173
+ return typeof e == "string" ? ue(e, t ?? {}) : ce(e, t, r, n);
128
174
  }
129
- async function ee(e, t) {
130
- const n = m[e];
131
- if (!n)
175
+ async function ue(e, t) {
176
+ const r = d[e];
177
+ if (!r)
132
178
  throw new Error(
133
179
  `[velojs] emit("${e}"): this channel has no entry in app/channels.ts. Add one — a typo or a renamed channel would otherwise be a silent no-op.`
134
180
  );
135
- const o = await $(n, t), r = o == null ? 0 : d.get(e)?.get(o)?.size ?? 0;
136
- if (W(e, o, "invalidate", r), o != null && r !== 0) {
137
- if (C <= 0) {
138
- await G(e, o);
181
+ const n = await T(r, t), o = n == null ? 0 : f.get(e)?.get(n)?.size ?? 0;
182
+ if (Z(e, n, "invalidate", o), n != null && o !== 0) {
183
+ if (O <= 0) {
184
+ await Y(e, n);
139
185
  return;
140
186
  }
141
- Q(e, o);
187
+ se(e, n);
142
188
  }
143
189
  }
144
- async function te(e, t, n, o) {
145
- const r = e?.metadata?.moduleId;
146
- if (!r)
190
+ async function ce(e, t, r, n) {
191
+ const o = e?.metadata?.moduleId;
192
+ if (!o)
147
193
  throw new Error(
148
194
  `[velojs] emit(module, "${t}", …): the module has no metadata.moduleId — pass the imported route module (the Vite plugin injects its metadata), the same object the route tree uses.`
149
195
  );
150
- const l = e.channels;
151
- if (!Array.isArray(l) || !l.includes(t))
196
+ const s = e.channels;
197
+ if (!Array.isArray(s) || !s.includes(t))
152
198
  throw new Error(
153
- `[velojs] emit(module, "${t}", …): module "${r}" does not declare channel "${t}" — add it to the module's \`channels\` export, or use emit("${t}", ctx) for the invalidation mode.`
199
+ `[velojs] emit(module, "${t}", …): module "${o}" does not declare channel "${t}" — add it to the module's \`channels\` export, or use emit("${t}", ctx) for the invalidation mode.`
154
200
  );
155
201
  if (typeof e.loader != "function")
156
202
  throw new Error(
157
- `[velojs] emit(module, "${t}", …): module "${r}" has no \`loader\` — there is no data shape to slice.`
203
+ `[velojs] emit(module, "${t}", …): module "${o}" has no \`loader\` — there is no data shape to slice.`
158
204
  );
159
- const f = m[t];
160
- if (!f)
205
+ const l = d[t];
206
+ if (!l)
161
207
  throw new Error(
162
208
  `[velojs] emit(module, "${t}", …): this channel has no entry in app/channels.ts. Add one — a typo or a renamed channel would otherwise be a silent no-op.`
163
209
  );
164
- if (o === null || typeof o != "object" || Array.isArray(o))
210
+ if (n === null || typeof n != "object" || Array.isArray(n))
165
211
  throw new Error(
166
- `[velojs] emit(module, "${t}", …): the slice must be the object of changed keys — got ${o === null ? "null" : Array.isArray(o) ? "an array" : typeof o}.`
212
+ `[velojs] emit(module, "${t}", …): the slice must be the object of changed keys — got ${n === null ? "null" : Array.isArray(n) ? "an array" : typeof n}.`
167
213
  );
168
- const u = await $(f, n), a = u == null ? void 0 : d.get(t)?.get(u), c = a?.size ?? 0;
169
- if (W(t, u, "slice", c), u == null || !a || c === 0) return;
170
- const s = await H(t, u);
171
- if (!s) return;
172
- const y = s.filter((p) => p.moduleId === r);
173
- if (y.length === 0) return;
174
- const A = JSON.stringify(o);
175
- await Promise.all(y.map((p) => p.send(R, A)));
214
+ const c = await T(l, r), p = c == null ? void 0 : f.get(t)?.get(c), a = p?.size ?? 0;
215
+ if (Z(t, c, "slice", a), c == null || !p || a === 0) return;
216
+ const u = await K(t, c);
217
+ if (!u) return;
218
+ const w = u.filter((g) => g.moduleId === o);
219
+ if (w.length === 0) return;
220
+ const S = JSON.stringify(n);
221
+ await Promise.all(w.map((g) => g.send(V, S)));
176
222
  }
177
- function W(e, t, n, o) {
178
- if (!x) return;
179
- const r = typeof t == "string" ? `"${t}"` : "null";
223
+ function Z(e, t, r, n) {
224
+ if (!F) return;
225
+ const o = typeof t == "string" ? `"${t}"` : "null";
180
226
  console.log(
181
- `[velojs] emit kind=${n} channel="${e}" partition=${r} connections=${o} at=${(/* @__PURE__ */ new Date()).toISOString()}`
227
+ `[velojs] emit kind=${r} channel="${e}" partition=${o} connections=${n} at=${(/* @__PURE__ */ new Date()).toISOString()}`
182
228
  );
183
229
  }
184
- function ne(e, t) {
185
- let n = Promise.resolve();
186
- return (o) => (n = n.then(() => t(o)).then(() => {
187
- }).catch((r) => {
230
+ function fe(e, t) {
231
+ let r = Promise.resolve();
232
+ return (n) => (r = r.then(() => t(n)).then(() => {
233
+ }).catch((o) => {
188
234
  console.warn(
189
235
  `[velojs] channel "${e}": SSE write failed — the snapshot did not reach the client:`,
190
- r
236
+ o
191
237
  );
192
- }), n);
238
+ }), r);
239
+ }
240
+ const C = "_route";
241
+ function de(e) {
242
+ return e ? e.split("/").filter((t) => t.startsWith(":")).map((t) => t.slice(1)) : [];
243
+ }
244
+ function pe(e, t) {
245
+ if (e == null || e === "")
246
+ return { params: {}, error: null };
247
+ let r;
248
+ try {
249
+ r = JSON.parse(e);
250
+ } catch {
251
+ return { params: {}, error: `the ?${C}= payload is not valid JSON` };
252
+ }
253
+ if (r === null || typeof r != "object" || Array.isArray(r))
254
+ return {
255
+ params: {},
256
+ error: `the ?${C}= payload must be an object of route params`
257
+ };
258
+ const n = {};
259
+ for (const [o, s] of Object.entries(r)) {
260
+ if (!t.includes(o)) {
261
+ const l = t.length > 0 ? t.join(", ") : "none";
262
+ return {
263
+ params: {},
264
+ error: `route param "${o}" is not declared by the module's path (declared: ${l})`
265
+ };
266
+ }
267
+ if (typeof s != "string")
268
+ return { params: {}, error: `route param "${o}" must be a URL string` };
269
+ n[o] = s;
270
+ }
271
+ return { params: n, error: null };
193
272
  }
194
- function fe(e, t, n, o, r, l) {
195
- if (typeof o.loader != "function")
273
+ function Se(e, t, r, n, o, s) {
274
+ if (typeof n.loader != "function")
196
275
  throw new Error(
197
- `[velojs] module "${r}" declares \`channels\` without a \`loader\` — there is nothing to synchronize. Add a loader or remove the export.`
276
+ `[velojs] module "${o}" declares \`channels\` without a \`loader\` — there is nothing to synchronize. Add a loader or remove the export.`
198
277
  );
199
- if (!m[n])
278
+ if (!d[r])
200
279
  throw new Error(
201
- `[velojs] module "${r}" declares channel "${n}" with no entry in app/channels.ts — add the partition resolver for "${n}".`
280
+ `[velojs] module "${o}" declares channel "${r}" with no entry in app/channels.ts — add the partition resolver for "${r}".`
281
+ );
282
+ const l = n.loader, c = de(n.metadata?.fullPath), p = async (a) => {
283
+ const u = d[r], w = pe(
284
+ a.req.query(C),
285
+ c
202
286
  );
203
- const f = o.loader, u = async (a) => {
204
- const c = m[n], s = Z(a, "user");
205
- let y;
287
+ if (w.error)
288
+ return console.error(`[velojs] channel "${r}": rejecting subscription — ${w.error}`), a.json({ error: "invalid-route-params", message: w.error }, 400);
289
+ const S = w.params, g = le(a, "user");
290
+ let b;
206
291
  try {
207
- y = await $(c, s);
208
- } catch (E) {
209
- return console.error(`[velojs] channel "${n}" scope threw:`, E), a.json({ error: "internal" }, 500);
292
+ b = await T(u, { user: g, params: S });
293
+ } catch (h) {
294
+ return console.error(`[velojs] channel "${r}" scope threw:`, h), a.json({ error: "forbidden" }, 403);
210
295
  }
211
- if (y == null)
296
+ if (b == null)
212
297
  return a.json({ error: "forbidden" }, 403);
213
- const { streamSSE: A } = await import("hono/streaming"), p = await A(a, async (E) => {
214
- let w = !1, I = () => {
298
+ const { streamSSE: ee } = await import("hono/streaming"), D = {};
299
+ for (const [h, m] of Object.entries(a.req.query()))
300
+ h !== C && (D[h] = m);
301
+ const A = await ee(a, async (h) => {
302
+ let m = !1, R = () => {
215
303
  };
216
- const F = new Promise((i) => {
217
- I = i;
218
- }), T = ne(
219
- n,
220
- (i) => typeof i == "string" ? E.write(i) : E.writeSSE(i)
221
- ), S = {
222
- channel: n,
223
- partition: y,
224
- moduleId: r,
225
- principal: s,
226
- loader: f,
304
+ const te = new Promise((i) => {
305
+ R = i;
306
+ }), _ = fe(
307
+ r,
308
+ (i) => typeof i == "string" ? h.write(i) : h.writeSSE(i)
309
+ ), j = {
310
+ channel: r,
311
+ partition: b,
312
+ moduleId: o,
313
+ principal: g,
314
+ loader: l,
227
315
  c: a,
228
- params: a.req.param(),
229
- query: a.req.query(),
230
- send: (i, P) => w ? Promise.resolve() : i === O || i === R ? T({ event: i, data: P }).then(() => {
231
- w || (S.lastDeliveryAt = Date.now(), _());
232
- }) : T({ event: i, data: P }),
233
- terminate: (i) => N(i)
234
- }, M = () => {
235
- w || (w = !0, h !== null && clearTimeout(h), g !== null && clearInterval(g), Y(S), I());
236
- }, N = async (i = "partition") => {
237
- w || (await S.send(B, JSON.stringify({ reason: i })), M());
316
+ params: S,
317
+ query: D,
318
+ send: (i, G) => m ? Promise.resolve() : i === U || i === V ? _({ event: i, data: G }).then(() => {
319
+ m || (j.lastDeliveryAt = Date.now(), L());
320
+ }) : _({ event: i, data: G }),
321
+ terminate: (i) => z(i)
322
+ }, k = () => {
323
+ m || (m = !0, y !== null && clearTimeout(y), v !== null && clearInterval(v), R(), ae(j));
324
+ }, z = async (i = "partition") => {
325
+ m || (await j.send(oe, JSON.stringify({ reason: i })), k());
238
326
  };
239
- let h = null;
240
- const _ = () => {
241
- if (b <= 0 || w) return;
242
- h !== null && clearTimeout(h), h = setTimeout(() => {
243
- h = null, N("idle");
244
- }, b);
245
- const i = h.unref;
246
- typeof i == "function" && i.call(h);
327
+ let y = null;
328
+ const L = () => {
329
+ if (M <= 0 || m) return;
330
+ y !== null && clearTimeout(y), y = setTimeout(() => {
331
+ y = null, z("idle");
332
+ }, M);
333
+ const i = y.unref;
334
+ typeof i == "function" && i.call(y);
247
335
  };
248
- let g = null;
249
- if (j > 0 && (g = setInterval(() => {
250
- w || T(`: ping
336
+ let v = null;
337
+ N > 0 && (v = setInterval(() => {
338
+ m || _(`: ping
251
339
 
252
340
  `);
253
- }, j)), X(S), E.onAbort(M), _(), g !== null) {
254
- const i = g.unref;
255
- typeof i == "function" && i.call(g);
341
+ }, N));
342
+ const re = ie(j);
343
+ if (h.onAbort(k), L(), v !== null) {
344
+ const i = v.unref;
345
+ typeof i == "function" && i.call(v);
256
346
  }
257
- await J(S), await F;
258
- }), D = new Headers(p.headers);
259
- return D.set("Cache-Control", "no-store"), new Response(p.body, {
260
- status: p.status,
261
- statusText: p.statusText,
262
- headers: D
347
+ re && await B(r, b, S), await X(j), await te;
348
+ }), I = new Headers(A.headers);
349
+ return I.set("Cache-Control", "no-store"), new Response(A.body, {
350
+ status: A.status,
351
+ statusText: A.statusText,
352
+ headers: I
263
353
  });
264
354
  };
265
- l.length > 0 ? e.on(["GET"], [t], ...l, u) : e.on(["GET"], [t], u);
355
+ s.length > 0 ? e.on(["GET"], [t], ...s, p) : e.on(["GET"], [t], p);
266
356
  }
267
357
  export {
268
- B as CHANNEL_CLOSE_EVENT,
269
- U as CHANNEL_ERROR_EVENT,
270
- k as DEFAULT_COALESCE_MS,
271
- q as DEFAULT_IDLE_MS,
272
- R as SLICE_EVENT,
273
- O as SNAPSHOT_EVENT,
274
- ue as __resetChannels,
275
- ae as channelNames,
276
- ne as createChannelWriteChain,
277
- ce as emit,
278
- se as getChannelMap,
279
- le as inspectChannels,
280
- J as pushSnapshot,
281
- fe as registerChannelRoute,
282
- ie as registerChannels
358
+ oe as CHANNEL_CLOSE_EVENT,
359
+ ne as CHANNEL_ERROR_EVENT,
360
+ H as DEFAULT_COALESCE_MS,
361
+ W as DEFAULT_IDLE_MS,
362
+ C as ROUTE_PARAMS_QUERY,
363
+ V as SLICE_EVENT,
364
+ U as SNAPSHOT_EVENT,
365
+ Ee as __resetChannels,
366
+ ge as channelNames,
367
+ fe as createChannelWriteChain,
368
+ de as declaredRouteParams,
369
+ $e as emit,
370
+ we as getChannelMap,
371
+ ve as inspectChannels,
372
+ pe as parseRouteParamsQuery,
373
+ X as pushSnapshot,
374
+ Se as registerChannelRoute,
375
+ ye as registerChannels
283
376
  };
package/dist/client.js CHANGED
@@ -33,15 +33,15 @@ const l = (t, n, e) => n ? e && n === "/" ? t || "/" : n.startsWith("/") ? t + n
33
33
  }
34
34
  }
35
35
  return null;
36
- }, R = (t, n) => n ? [...t, /* @__PURE__ */ r(f, { children: /* @__PURE__ */ r(n, {}) }, "__notfound")] : t, a = (t, n, e, c) => {
36
+ }, R = (t, n) => n ? [...t, /* @__PURE__ */ r(f, { children: /* @__PURE__ */ r(n, {}) }, "__notfound")] : t, h = (t, n, e, c) => {
37
37
  const i = [];
38
- for (let h = 0; h < t.length; h++) {
39
- const o = t[h], s = `${c}${h}`;
38
+ for (let a = 0; a < t.length; a++) {
39
+ const o = t[a], s = `${c}${a}`;
40
40
  if (o.path === "*") continue;
41
41
  if (!o.module) {
42
42
  if (o.children) {
43
43
  const u = l(n, o.path, !1);
44
- i.push(...a(o.children, u, e, `${s}-`));
44
+ i.push(...h(o.children, u, e, `${s}-`));
45
45
  }
46
46
  continue;
47
47
  }
@@ -50,6 +50,7 @@ const l = (t, n, e) => n ? e && n === "/" ? t || "/" : n.startsWith("/") ? t + n
50
50
  {
51
51
  moduleId: o.module?.metadata?.moduleId,
52
52
  channels: o.module?.channels,
53
+ fullPath: o.module?.metadata?.fullPath,
53
54
  children: u
54
55
  }
55
56
  );
@@ -63,7 +64,7 @@ const l = (t, n, e) => n ? e && n === "/" ? t || "/" : n.startsWith("/") ? t + n
63
64
  if (o.isRoot) {
64
65
  i.push(
65
66
  /* @__PURE__ */ r(y, { children: R(
66
- a(o.children, "", e, `${s}-`),
67
+ h(o.children, "", e, `${s}-`),
67
68
  e
68
69
  ) }, s)
69
70
  );
@@ -73,7 +74,7 @@ const l = (t, n, e) => n ? e && n === "/" ? t || "/" : n.startsWith("/") ? t + n
73
74
  i.push(
74
75
  /* @__PURE__ */ r(f, { path: j, children: m(
75
76
  /* @__PURE__ */ r(p, { children: /* @__PURE__ */ r(y, { children: R(
76
- a(o.children, $, e, `${s}-`),
77
+ h(o.children, $, e, `${s}-`),
77
78
  e
78
79
  ) }) })
79
80
  ) }, s)
@@ -87,7 +88,7 @@ const l = (t, n, e) => n ? e && n === "/" ? t || "/" : n.startsWith("/") ? t + n
87
88
  }, [t]), null;
88
89
  }, k = ({ routes: t }) => {
89
90
  L(t);
90
- const n = C(t), e = a(t, "", n, "");
91
+ const n = C(t), e = h(t, "", n, "");
91
92
  return /* @__PURE__ */ w(S, { children: [
92
93
  /* @__PURE__ */ r(g, {}),
93
94
  e