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