@mauroandre/velojs 0.0.57 → 0.0.59

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/server.js CHANGED
@@ -1,310 +1,357 @@
1
- import { jsx as w } from "preact/jsx-runtime";
2
- import { Hono as C } from "hono";
3
- import { logger as E } from "hono/logger";
4
- import { trimTrailingSlash as T } from "hono/trailing-slash";
5
- import { render as A } from "preact-render-to-string";
6
- import { Router as $ } from "wouter-preact";
7
- import { AsyncLocalStorage as k } from "node:async_hooks";
1
+ import { jsx as y } from "preact/jsx-runtime";
2
+ import { Hono as I } from "hono";
3
+ import { logger as O } from "hono/logger";
4
+ import { trimTrailingSlash as H } from "hono/trailing-slash";
5
+ import { render as V } from "preact-render-to-string";
6
+ import { Router as x } from "wouter-preact";
7
+ import { AsyncLocalStorage as G } from "node:async_hooks";
8
8
  import { getAppContext as _ } from "./app-context.js";
9
- import { flushPendingStreamRoutes as D, registerStreamHandler as I } from "./events.js";
10
- import { registerSocketRoutes as N, injectWebSocketServer as S } from "./sockets.js";
11
- import { inspectChannels as O, registerChannelRoute as H } from "./channels.js";
12
- import { emit as le, registerChannels as de } from "./channels.js";
13
- const P = new k();
14
- globalThis.__veloServerData = P;
15
- let g = null;
16
- function re(e) {
17
- if (g) {
18
- e(g);
9
+ import { flushPendingStreamRoutes as L, registerStreamHandler as B } from "./events.js";
10
+ import { registerSocketRoutes as M, injectWebSocketServer as E } from "./sockets.js";
11
+ import { inspectChannels as W, registerChannelRoute as K } from "./channels.js";
12
+ import { emit as Se, registerChannels as Pe } from "./channels.js";
13
+ import { trace as P, jsonBytes as C, responseBytes as R, byteLength as F } from "./telemetry.js";
14
+ import { initNodeTelemetry as U } from "./telemetry-node.js";
15
+ const j = new G();
16
+ globalThis.__veloServerData = j;
17
+ let w = null;
18
+ function ve(e) {
19
+ if (w) {
20
+ e(w);
19
21
  return;
20
22
  }
21
23
  _().serverCallbacks.push(e);
22
24
  }
23
- function b(e) {
24
- g = e;
25
+ function k(e) {
26
+ w = e;
25
27
  const t = _();
26
- for (const a of t.serverCallbacks) a(e);
28
+ for (const i of t.serverCallbacks) i(e);
27
29
  t.serverCallbacks.length = 0;
28
30
  }
29
- function x(e) {
30
- g === e && (g = null);
31
+ function J(e) {
32
+ w === e && (w = null);
31
33
  }
32
- function se(e) {
34
+ function we(e) {
33
35
  _().pendingRoutes.push(e);
34
36
  }
35
- const G = (e) => JSON.stringify(e).replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029"), V = (e, t, a, r) => {
36
- if (r && r !== 200 && e.status(r), e.req.query("_data") === "1") {
37
- const c = globalThis.__veloBuildHash || void 0, i = a ? { ...a, __buildHash: c } : { __buildHash: c };
38
- return e.json(i);
37
+ const z = (e) => JSON.stringify(e).replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029"), Q = (e, t, i, s, o) => {
38
+ if (s && s !== 200 && e.status(s), e.req.query("_data") === "1") {
39
+ const r = globalThis.__veloBuildHash || void 0, a = i ? { ...i, __buildHash: r } : { __buildHash: r };
40
+ return { response: e.json(a), bytes: o.enabled ? C(a) : void 0 };
39
41
  }
40
- const o = e.req.path, n = P.run(
41
- a ?? {},
42
- () => A(/* @__PURE__ */ w($, { ssrPath: o, children: t }))
43
- );
44
- if (e.header("Cache-Control", "no-cache"), !a)
45
- return e.html(n);
46
- const s = `<script>window.__PAGE_DATA__=${G(a)}<\/script>`;
47
- return e.html(n.replace("</head>", () => `${s}</head>`));
48
- }, M = async (e, t) => {
49
- const a = t.req.param(), r = t.req.query(), o = { params: a, query: r, c: t }, n = await Promise.all(
50
- e.map(async (i) => {
51
- if (!i.loader) return null;
52
- const f = await i.loader(o), l = i.metadata?.moduleId;
53
- return l ? { moduleId: l, loaderData: f } : null;
42
+ const n = o.span("render");
43
+ try {
44
+ const r = e.req.path;
45
+ let a = j.run(
46
+ i ?? {},
47
+ () => V(/* @__PURE__ */ y(x, { ssrPath: r, children: t }))
48
+ );
49
+ if (e.header("Cache-Control", "no-cache"), i) {
50
+ const l = `<script>window.__PAGE_DATA__=${z(i)}<\/script>`;
51
+ a = a.replace("</head>", () => `${l}</head>`);
52
+ }
53
+ return n.end("ok"), { response: e.html(a), bytes: o.enabled ? F(a) : void 0 };
54
+ } catch (r) {
55
+ throw n.end("error"), r;
56
+ }
57
+ }, X = async (e, t, i) => {
58
+ const s = t.req.param(), o = t.req.query(), n = { params: s, query: o, c: t }, r = await Promise.all(
59
+ e.map(async (c) => {
60
+ if (!c.loader) return null;
61
+ const h = c.metadata?.moduleId, u = i.span(`loader:${h ?? "anonymous"}`);
62
+ try {
63
+ const d = await c.loader(n);
64
+ return u.end("ok"), h ? { moduleId: h, loaderData: d } : null;
65
+ } catch (d) {
66
+ throw u.end("error"), d;
67
+ }
54
68
  })
55
69
  );
56
- let s;
57
- for (const i of n)
58
- if (i && i.loaderData instanceof Response) {
59
- s = i.loaderData;
70
+ let a;
71
+ for (const c of r)
72
+ if (c && c.loaderData instanceof Response) {
73
+ a = c.loaderData;
60
74
  break;
61
75
  }
62
- const c = {
63
- __params: a,
64
- __query: r,
76
+ const l = {
77
+ __params: s,
78
+ __query: o,
65
79
  __pathname: t.req.path
66
80
  };
67
- for (const i of n)
68
- i && !(i.loaderData instanceof Response) && (c[i.moduleId] = i.loaderData);
81
+ for (const c of r)
82
+ c && !(c.loaderData instanceof Response) && (l[c.moduleId] = c.loaderData);
69
83
  return {
70
- components: e.map((i) => i.Component),
71
- data: c,
72
- shortCircuit: s
84
+ components: e.map((c) => c.Component),
85
+ data: l,
86
+ shortCircuit: a
73
87
  };
74
- }, W = (e) => {
88
+ }, Y = (e) => {
75
89
  if (e.length === 0) return null;
76
90
  const t = e.filter(Boolean);
77
91
  if (t.length === 0) return null;
78
92
  if (t.length === 1) {
79
93
  const o = t[0];
80
- return /* @__PURE__ */ w(o, {});
94
+ return /* @__PURE__ */ y(o, {});
81
95
  }
82
- const a = t[t.length - 1];
83
- return t.slice(0, -1).reduceRight((o, n) => /* @__PURE__ */ w(n, { children: o }), /* @__PURE__ */ w(a, {}));
84
- }, y = (e, t, a = [], r = []) => {
96
+ const i = t[t.length - 1];
97
+ return t.slice(0, -1).reduceRight((o, n) => /* @__PURE__ */ y(n, { children: o }), /* @__PURE__ */ y(i, {}));
98
+ }, S = (e, t, i = [], s = []) => {
85
99
  for (const o of t) {
86
100
  if (o.handler && !o.module) {
87
- o.children && y(
101
+ o.children && S(
88
102
  e,
89
103
  o.children,
90
- a,
91
- [...r, ...o.middlewares || []]
104
+ i,
105
+ [...s, ...o.middlewares || []]
92
106
  );
93
107
  continue;
94
108
  }
95
- const n = o.module ? [...a, o.module] : a, s = [
96
- ...r,
109
+ const n = o.module ? [...i, o.module] : i, r = [
110
+ ...s,
97
111
  ...o.middlewares || []
98
112
  ];
99
113
  if (o.children)
100
- y(
114
+ S(
101
115
  e,
102
116
  o.children,
103
117
  n,
104
- s
118
+ r
105
119
  );
106
120
  else if (o.module) {
107
- const c = o.path === "*", i = o.statusCode ?? (c ? 404 : void 0), f = o.module.metadata?.fullPath;
108
- if (!f && !c) {
121
+ const a = o.path === "*", l = o.statusCode ?? (a ? 404 : void 0), c = o.module.metadata?.fullPath;
122
+ if (!c && !a) {
109
123
  console.warn(
110
124
  `Module ${o.module.metadata?.moduleId} has no fullPath`
111
125
  );
112
126
  continue;
113
127
  }
114
- const l = async (d) => {
115
- const { components: u, data: h, shortCircuit: m } = await M(n, d);
116
- if (m) {
117
- const v = m.headers.get("Location");
118
- return d.req.query("_data") === "1" && v && m.status >= 300 && m.status < 400 ? d.json({ __redirect: v }) : m;
128
+ const h = async (u) => {
129
+ const d = u.req.query("_data") === "1", f = n[n.length - 1], m = P(d ? "data" : "page", {
130
+ route: c ?? f?.metadata?.fullPath,
131
+ module: f?.metadata?.moduleId
132
+ });
133
+ try {
134
+ const { components: v, data: p, shortCircuit: g } = await X(n, u, m);
135
+ if (g) {
136
+ const b = g.headers.get("Location");
137
+ return d && b && g.status >= 300 && g.status < 400 ? (m.end({
138
+ status: "ok",
139
+ bytes: m.enabled ? C({ __redirect: b }) : void 0
140
+ }), u.json({ __redirect: b })) : (m.end({
141
+ status: "ok",
142
+ bytes: m.enabled ? await R(g) : void 0
143
+ }), g);
144
+ }
145
+ const $ = Y(v), { response: D, bytes: N } = Q(u, $, p, l, m);
146
+ return m.end({ status: "ok", bytes: N }), D;
147
+ } catch (v) {
148
+ throw m.end({ status: "error" }), v;
119
149
  }
120
- const p = W(u);
121
- return V(d, p, h, i);
122
150
  };
123
- c ? e.notFound(l) : s.length > 0 ? e.on(["GET"], [f], ...s, l) : e.on(["GET"], [f], l);
151
+ a ? e.notFound(h) : r.length > 0 ? e.on(["GET"], [c], ...r, h) : e.on(["GET"], [c], h);
124
152
  } else
125
153
  continue;
126
154
  }
127
- }, R = (e, t, a = []) => {
128
- for (const r of t) {
129
- const o = r.module?.metadata?.moduleId, n = [
130
- ...a,
131
- ...r.middlewares || []
155
+ }, T = (e, t, i = []) => {
156
+ for (const s of t) {
157
+ const o = s.module?.metadata?.moduleId, n = [
158
+ ...i,
159
+ ...s.middlewares || []
132
160
  ];
133
- if (r.module && o) {
134
- const s = Object.keys(r.module).filter(
135
- (c) => c.startsWith("action_")
161
+ if (s.module && o) {
162
+ const r = Object.keys(s.module).filter(
163
+ (a) => a.startsWith("action_")
136
164
  );
137
- for (const c of s) {
138
- const i = c.replace("action_", ""), f = r.module[c];
139
- if (typeof f == "function") {
140
- const l = `/_action/${o}/${i}`, d = async (u) => {
141
- let h = {};
165
+ for (const a of r) {
166
+ const l = a.replace("action_", ""), c = s.module[a];
167
+ if (typeof c == "function") {
168
+ const h = `/_action/${o}/${l}`, u = async (d) => {
169
+ const f = P("action", {
170
+ route: s.module?.metadata?.fullPath,
171
+ module: o,
172
+ name: l
173
+ });
174
+ let m = {};
142
175
  try {
143
- h = await u.req.json();
176
+ m = await d.req.json();
144
177
  } catch {
145
178
  }
146
- const m = {
147
- body: h,
148
- params: u.req.param(),
149
- query: u.req.query(),
150
- c: u
179
+ const v = {
180
+ body: m,
181
+ params: d.req.param(),
182
+ query: d.req.query(),
183
+ c: d
151
184
  };
152
185
  try {
153
- const p = await f(m);
154
- return u.json(p ?? { ok: !0 });
186
+ const g = await c(v) ?? { ok: !0 };
187
+ return f.end({ status: "ok", bytes: f.enabled ? C(g) : void 0 }), d.json(g);
155
188
  } catch (p) {
156
- const v = p instanceof Error ? p.message : "Action failed";
157
- return u.json({ error: v }, 500);
189
+ const g = p instanceof Error ? p.message : "Action failed";
190
+ return f.end({ status: "error" }), d.json({ error: g }, 500);
158
191
  }
159
192
  };
160
193
  n.length > 0 ? e.on(
161
194
  ["POST"],
162
- [l],
195
+ [h],
163
196
  ...n,
164
- d
165
- ) : e.on(["POST"], [l], d);
197
+ u
198
+ ) : e.on(["POST"], [h], u);
166
199
  }
167
200
  }
168
201
  }
169
- r.children && R(e, r.children, n);
202
+ s.children && T(e, s.children, n);
170
203
  }
171
- }, K = async (e, t, a = []) => {
172
- const r = (o, n) => {
173
- for (const s of o) {
174
- const c = s.module?.metadata?.moduleId, i = [
204
+ }, Z = async (e, t, i = []) => {
205
+ const s = (o, n) => {
206
+ for (const r of o) {
207
+ const a = r.module?.metadata?.moduleId, l = [
175
208
  ...n,
176
- ...s.middlewares || []
209
+ ...r.middlewares || []
177
210
  ];
178
- if (s.module && c) {
179
- const f = Object.keys(s.module).filter(
180
- (l) => l.startsWith("stream_")
211
+ if (r.module && a) {
212
+ const c = Object.keys(r.module).filter(
213
+ (h) => h.startsWith("stream_")
181
214
  );
182
- for (const l of f) {
183
- const d = l.replace("stream_", ""), u = s.module[l];
184
- if (u?.__isVeloEventStream) {
185
- const h = `/_event/${c}/${d}`;
186
- u.__path = h, I(
215
+ for (const h of c) {
216
+ const u = h.replace("stream_", ""), d = r.module[h];
217
+ if (d?.__isVeloEventStream) {
218
+ const f = `/_event/${a}/${u}`;
219
+ d.__path = f, B(
187
220
  e,
188
- h,
189
- u,
190
- i
221
+ f,
222
+ d,
223
+ l,
224
+ { moduleId: a, name: u }
191
225
  );
192
226
  }
193
227
  }
194
228
  }
195
- s.children && r(s.children, i);
229
+ r.children && s(r.children, l);
196
230
  }
197
231
  };
198
- r(t, a);
199
- }, j = (e, t, a = []) => {
200
- for (const r of t) {
201
- const o = r.module?.metadata?.moduleId, n = [
202
- ...a,
203
- ...r.middlewares || []
232
+ s(t, i);
233
+ }, q = (e, t, i = []) => {
234
+ for (const s of t) {
235
+ const o = s.module?.metadata?.moduleId, n = [
236
+ ...i,
237
+ ...s.middlewares || []
204
238
  ];
205
- if (r.module && o) {
206
- const s = r.module.channels;
207
- if (Array.isArray(s))
208
- for (const c of s)
209
- H(
239
+ if (s.module && o) {
240
+ const r = s.module.channels;
241
+ if (Array.isArray(r))
242
+ for (const a of r)
243
+ K(
210
244
  e,
211
- `/_channel/${o}/${c}`,
212
- c,
213
- r.module,
245
+ `/_channel/${o}/${a}`,
246
+ a,
247
+ s.module,
214
248
  o,
215
249
  n
216
250
  );
217
251
  }
218
- r.children && j(e, r.children, n);
252
+ s.children && q(e, s.children, n);
219
253
  }
220
- }, L = (e, t) => t ? t.startsWith("/") ? e + t : e ? e + "/" + t : "/" + t : e || "", B = (e) => {
221
- const t = /* @__PURE__ */ new Set(), a = (r) => {
222
- for (const o of r) {
254
+ }, ee = (e, t) => t ? t.startsWith("/") ? e + t : e ? e + "/" + t : "/" + t : e || "", te = (e) => {
255
+ const t = /* @__PURE__ */ new Set(), i = (s) => {
256
+ for (const o of s) {
223
257
  if (o.module && !o.children) {
224
258
  const n = o.module.metadata?.fullPath;
225
259
  n && t.add(n);
226
260
  }
227
- o.children && a(o.children);
261
+ o.children && i(o.children);
228
262
  }
229
263
  };
230
- return a(e), t;
231
- }, q = (e, t, a, r = "", o = []) => {
264
+ return i(e), t;
265
+ }, A = (e, t, i, s = "", o = []) => {
232
266
  for (const n of t) {
233
- const s = L(r, n.path), c = [
267
+ const r = ee(s, n.path), a = [
234
268
  ...o,
235
269
  ...n.middlewares || []
236
- ], i = !!n.handler, f = !!n.method;
237
- if (i && !f ? console.warn(
238
- `[velojs] invalid route at "${s || "/"}" — "handler" set without "method"; endpoint skipped`
239
- ) : f && !i ? console.warn(
240
- `[velojs] invalid route at "${s || "/"}" — "method" set without "handler"; endpoint skipped`
241
- ) : i && n.module ? console.warn(
242
- `[velojs] ambiguous route at "${s || "/"}" — both "module" and "handler" set; endpoint ignored, page kept`
243
- ) : i && n.isRoot && console.warn(
244
- `[velojs] "isRoot" has no effect on endpoint at "${s || "/"}"; ignored`
245
- ), i && f && !n.module) {
246
- const d = n.method;
247
- d === "GET" && a.has(s) && console.warn(
248
- `[velojs] path "${s}" has both a page GET and an endpoint GET; the page wins and the endpoint is unreachable. Consider renaming one.`
270
+ ], l = !!n.handler, c = !!n.method;
271
+ if (l && !c ? console.warn(
272
+ `[velojs] invalid route at "${r || "/"}" — "handler" set without "method"; endpoint skipped`
273
+ ) : c && !l ? console.warn(
274
+ `[velojs] invalid route at "${r || "/"}" — "method" set without "handler"; endpoint skipped`
275
+ ) : l && n.module ? console.warn(
276
+ `[velojs] ambiguous route at "${r || "/"}" — both "module" and "handler" set; endpoint ignored, page kept`
277
+ ) : l && n.isRoot && console.warn(
278
+ `[velojs] "isRoot" has no effect on endpoint at "${r || "/"}"; ignored`
279
+ ), l && c && !n.module) {
280
+ const u = n.method;
281
+ u === "GET" && i.has(r) && console.warn(
282
+ `[velojs] path "${r}" has both a page GET and an endpoint GET; the page wins and the endpoint is unreachable. Consider renaming one.`
249
283
  );
250
- const u = n.handler, h = async (m) => await u({
251
- c: m,
252
- params: m.req.param(),
253
- query: m.req.query()
254
- });
255
- c.length > 0 ? e.on([d], [s], ...c, h) : e.on([d], [s], h);
284
+ const d = n.handler, f = async (m) => {
285
+ const v = P("endpoint", { route: r, method: u });
286
+ try {
287
+ const p = await d({
288
+ c: m,
289
+ params: m.req.param(),
290
+ query: m.req.query()
291
+ });
292
+ return v.end({
293
+ status: "ok",
294
+ bytes: v.enabled && p instanceof Response ? await R(p) : void 0
295
+ }), p;
296
+ } catch (p) {
297
+ throw v.end({ status: "error" }), p;
298
+ }
299
+ };
300
+ a.length > 0 ? e.on([u], [r], ...a, f) : e.on([u], [r], f);
256
301
  }
257
- n.children && q(
302
+ n.children && A(
258
303
  e,
259
304
  n.children,
260
- a,
261
- s,
262
- c
305
+ i,
306
+ r,
307
+ a
263
308
  );
264
309
  }
265
- }, F = async (e) => {
266
- const t = new C();
267
- t.use(T()), process.env.NODE_ENV !== "production" && t.use("*", E());
268
- const r = _().pendingRoutes.splice(0);
269
- for (const n of r)
310
+ }, oe = async (e) => {
311
+ if (process.env.NODE_ENV !== "production" || process.env.VELO_STATIC || (process.env.STATIC_BASE_URL || "").startsWith("http")) return;
312
+ const { serveStatic: i } = await import("@hono/node-server/serve-static"), { join: s } = await import("node:path");
313
+ e.use("/*", i({ root: s(process.cwd(), "dist/client") }));
314
+ }, ne = async (e) => {
315
+ const t = new I();
316
+ await U(), t.use(H()), process.env.NODE_ENV !== "production" && t.use("*", O()), await oe(t);
317
+ const s = _().pendingRoutes.splice(0);
318
+ for (const n of s)
270
319
  await n(t);
271
- y(t, e), R(t, e), await K(t, e), j(t, e), process.env.NODE_ENV !== "production" && t.get("/_channel-inspect", (n) => n.json(O()));
272
- const o = B(e);
273
- if (q(t, e, o), await N(t, e), D(t), process.env.NODE_ENV !== "production" && !g) {
320
+ S(t, e), T(t, e), await Z(t, e), q(t, e), process.env.NODE_ENV !== "production" && t.get("/_channel-inspect", (n) => n.json(W()));
321
+ const o = te(e);
322
+ if (A(t, e, o), await M(t, e), L(t), process.env.NODE_ENV !== "production" && !w) {
274
323
  const n = globalThis.__veloDevServer;
275
- n && (b(n), await S(t, n));
324
+ n && (k(n), await E(t, n));
276
325
  }
277
326
  return t;
278
- }, ae = async (e) => {
279
- const { routes: t } = e, a = Number(process.env.PORT) || e.port || 3e3, r = process.env.HOST || e.hostname || void 0, o = await F(t);
327
+ }, ye = async (e) => {
328
+ const { routes: t } = e, i = Number(process.env.PORT) || e.port || 3e3, s = process.env.HOST || e.hostname || void 0, o = await ne(t);
280
329
  if (process.env.NODE_ENV === "production" && !process.env.VELO_STATIC) {
281
- const { serve: n } = await import("@hono/node-server"), { serveStatic: s } = await import("@hono/node-server/serve-static"), { join: c } = await import("node:path"), i = c(process.cwd(), "dist/client");
282
- (process.env.STATIC_BASE_URL || "").startsWith("http") || o.use("/*", s({ root: i }));
283
- const l = n({ fetch: o.fetch, port: a, ...r ? { hostname: r } : {} });
284
- l.listening || await new Promise((u) => l.once("listening", u));
285
- const d = l.address();
286
- if (d && typeof d == "object") {
287
- const h = d.address === "::" || d.address === "0.0.0.0" ? "0.0.0.0 (all interfaces)" : d.address;
288
- console.log(`Server running on ${h}:${d.port}`);
330
+ const { serve: n } = await import("@hono/node-server"), r = n({ fetch: o.fetch, port: i, ...s ? { hostname: s } : {} });
331
+ r.listening || await new Promise((l) => r.once("listening", l));
332
+ const a = r.address();
333
+ if (a && typeof a == "object") {
334
+ const c = a.address === "::" || a.address === "0.0.0.0" ? "0.0.0.0 (all interfaces)" : a.address;
335
+ console.log(`Server running on ${c}:${a.port}`);
289
336
  } else
290
- console.log(`Server running on port ${a}`);
291
- await S(o, l), b(l), l.once("close", () => {
292
- x(l);
337
+ console.log(`Server running on port ${i}`);
338
+ await E(o, r), k(r), r.once("close", () => {
339
+ J(r);
293
340
  });
294
341
  }
295
342
  return o;
296
343
  };
297
344
  export {
298
- se as addRoutes,
299
- x as clearActiveServer,
300
- F as createApp,
301
- F as default,
302
- le as emit,
303
- b as flushServerCallbacks,
304
- O as inspectChannels,
305
- G as jsonForScript,
306
- re as onServer,
307
- de as registerChannels,
308
- P as serverDataStorage,
309
- ae as startServer
345
+ we as addRoutes,
346
+ J as clearActiveServer,
347
+ ne as createApp,
348
+ ne as default,
349
+ Se as emit,
350
+ k as flushServerCallbacks,
351
+ W as inspectChannels,
352
+ z as jsonForScript,
353
+ ve as onServer,
354
+ Pe as registerChannels,
355
+ j as serverDataStorage,
356
+ ye as startServer
310
357
  };
package/dist/sockets.d.ts CHANGED
@@ -89,7 +89,10 @@ export declare function trackSocketSession(app: Hono, ctrl: AbortController): ()
89
89
  export declare function abortAllSocketSessions(app: Hono): void;
90
90
  /** @internal Returns registered sockets for `app` (used by the testing toolkit). */
91
91
  export declare function getAppSockets(app: Hono): ReadonlyMap<string, RegisteredSocket>;
92
- export declare function registerSocketHandler(app: Hono, path: string, handler: SocketHandler, middlewares?: MiddlewareHandler[]): Promise<void>;
92
+ export declare function registerSocketHandler(app: Hono, path: string, handler: SocketHandler, middlewares?: MiddlewareHandler[], info?: {
93
+ moduleId?: string | undefined;
94
+ name?: string | undefined;
95
+ }): Promise<void>;
93
96
  /** Walks the route tree and registers every `socket_*` export. */
94
97
  export declare function registerSocketRoutes(app: Hono, nodes: RouteNode[], parentMiddlewares?: MiddlewareHandler[]): Promise<void>;
95
98
  /**