@mauroandre/velojs 0.0.55 → 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/README.md +423 -3
- package/agent/AGENTS.md +216 -0
- package/agent/skills/velojs-live-loader/SKILL.md +410 -0
- package/dist/channels.d.ts +370 -0
- package/dist/channels.js +376 -0
- package/dist/client.js +56 -45
- package/dist/components.js +7 -6
- package/dist/events.d.ts +6 -0
- package/dist/events.js +1 -0
- package/dist/hooks.d.ts +26 -21
- package/dist/hooks.js +117 -98
- package/dist/live-loader.d.ts +120 -0
- package/dist/live-loader.js +141 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +144 -118
- package/dist/testing/index.d.ts +5 -1
- package/dist/testing/index.js +495 -412
- package/dist/testing/subscription.d.ts +18 -2
- package/dist/testing/types.d.ts +85 -0
- package/dist/types.d.ts +9 -0
- package/dist/vite.d.ts +15 -0
- package/dist/vite.js +431 -340
- package/package.json +1 -1
package/dist/vite.js
CHANGED
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
import { loadEnv as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { loadEnv as G } from "vite";
|
|
2
|
+
import m from "node:path";
|
|
3
|
+
import x from "node:fs";
|
|
4
|
+
import z from "@preact/preset-vite";
|
|
5
|
+
import Y, { defaultOptions as X } from "@hono/vite-dev-server";
|
|
6
6
|
import { parse as v } from "@babel/parser";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import P from "@babel/traverse";
|
|
8
|
+
import D from "@babel/generator";
|
|
9
9
|
import * as e from "@babel/types";
|
|
10
|
-
import { buildGraph as
|
|
11
|
-
const
|
|
12
|
-
function
|
|
13
|
-
const
|
|
10
|
+
import { buildGraph as q } from "./graph.js";
|
|
11
|
+
const h = typeof P == "function" ? P : P.default, g = typeof D == "function" ? D : D.default;
|
|
12
|
+
function K(p, n, r, s) {
|
|
13
|
+
const c = v(p, {
|
|
14
14
|
sourceType: "module",
|
|
15
15
|
plugins: ["typescript", "jsx"]
|
|
16
16
|
});
|
|
17
|
-
let
|
|
18
|
-
if (
|
|
17
|
+
let a = !1;
|
|
18
|
+
if (h(c, {
|
|
19
19
|
// Procura: export const metadata = { ... }
|
|
20
|
-
ExportNamedDeclaration(
|
|
21
|
-
const
|
|
22
|
-
if (e.isVariableDeclaration(
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
const
|
|
20
|
+
ExportNamedDeclaration(i) {
|
|
21
|
+
const t = i.node.declaration;
|
|
22
|
+
if (e.isVariableDeclaration(t) && t.declarations.length === 1) {
|
|
23
|
+
const l = t.declarations[0];
|
|
24
|
+
if (l && e.isIdentifier(l.id, { name: "metadata" }) && e.isObjectExpression(l.init)) {
|
|
25
|
+
a = !0;
|
|
26
|
+
const d = l.init.properties.filter((y) => e.isObjectProperty(y) && e.isIdentifier(y.key) ? y.key.name !== "moduleId" && y.key.name !== "fullPath" && y.key.name !== "path" : !0), f = [
|
|
27
27
|
e.objectProperty(
|
|
28
28
|
e.identifier("moduleId"),
|
|
29
|
-
e.stringLiteral(
|
|
29
|
+
e.stringLiteral(n)
|
|
30
30
|
)
|
|
31
31
|
];
|
|
32
|
-
r !== void 0 &&
|
|
32
|
+
r !== void 0 && f.push(
|
|
33
33
|
e.objectProperty(
|
|
34
34
|
e.identifier("fullPath"),
|
|
35
35
|
e.stringLiteral(r)
|
|
36
36
|
)
|
|
37
|
-
),
|
|
37
|
+
), s !== void 0 && f.push(
|
|
38
38
|
e.objectProperty(
|
|
39
39
|
e.identifier("path"),
|
|
40
|
-
e.stringLiteral(
|
|
40
|
+
e.stringLiteral(s)
|
|
41
41
|
)
|
|
42
|
-
),
|
|
42
|
+
), l.init.properties = [...f, ...d];
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
}), !
|
|
47
|
-
const
|
|
46
|
+
}), !a) {
|
|
47
|
+
const i = [
|
|
48
48
|
e.objectProperty(
|
|
49
49
|
e.identifier("moduleId"),
|
|
50
|
-
e.stringLiteral(
|
|
50
|
+
e.stringLiteral(n)
|
|
51
51
|
)
|
|
52
52
|
];
|
|
53
|
-
r !== void 0 &&
|
|
53
|
+
r !== void 0 && i.push(
|
|
54
54
|
e.objectProperty(
|
|
55
55
|
e.identifier("fullPath"),
|
|
56
56
|
e.stringLiteral(r)
|
|
57
57
|
)
|
|
58
|
-
),
|
|
58
|
+
), s !== void 0 && i.push(
|
|
59
59
|
e.objectProperty(
|
|
60
60
|
e.identifier("path"),
|
|
61
|
-
e.stringLiteral(
|
|
61
|
+
e.stringLiteral(s)
|
|
62
62
|
)
|
|
63
63
|
);
|
|
64
|
-
const
|
|
64
|
+
const t = e.exportNamedDeclaration(
|
|
65
65
|
e.variableDeclaration("const", [
|
|
66
66
|
e.variableDeclarator(
|
|
67
67
|
e.identifier("metadata"),
|
|
68
|
-
e.objectExpression(
|
|
68
|
+
e.objectExpression(i)
|
|
69
69
|
)
|
|
70
70
|
])
|
|
71
71
|
);
|
|
72
|
-
|
|
72
|
+
c.program.body.unshift(t);
|
|
73
73
|
}
|
|
74
|
-
return
|
|
74
|
+
return g(c, { retainLines: !0 }).code;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function Q(p, n) {
|
|
77
77
|
const r = v(p, {
|
|
78
78
|
sourceType: "module",
|
|
79
79
|
plugins: ["typescript", "jsx"]
|
|
80
80
|
});
|
|
81
|
-
return
|
|
82
|
-
CallExpression(
|
|
83
|
-
const
|
|
84
|
-
if (!
|
|
85
|
-
const
|
|
86
|
-
e.isStringLiteral(u) && u.value.includes("/") || (
|
|
81
|
+
return h(r, {
|
|
82
|
+
CallExpression(c) {
|
|
83
|
+
const a = c.node.callee, o = e.isIdentifier(a, { name: "Loader" }) || e.isTSInstantiationExpression(a) && e.isIdentifier(a.expression, { name: "Loader" }), i = e.isIdentifier(a, { name: "useLoader" }) || e.isTSInstantiationExpression(a) && e.isIdentifier(a.expression, { name: "useLoader" });
|
|
84
|
+
if (!o && !i) return;
|
|
85
|
+
const t = c.node.arguments, l = e.stringLiteral(n), u = t[0];
|
|
86
|
+
e.isStringLiteral(u) && u.value.includes("/") || (c.node.arguments = [l, ...t]);
|
|
87
87
|
}
|
|
88
|
-
}),
|
|
88
|
+
}), g(r, { retainLines: !0 }).code;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function Z(p, n) {
|
|
91
91
|
const r = v(p, {
|
|
92
92
|
sourceType: "module",
|
|
93
93
|
plugins: ["typescript", "jsx"]
|
|
94
94
|
});
|
|
95
|
-
return
|
|
96
|
-
ExportNamedDeclaration(
|
|
97
|
-
const
|
|
98
|
-
if (!e.isVariableDeclaration(
|
|
99
|
-
const
|
|
100
|
-
if (!
|
|
101
|
-
const
|
|
102
|
-
if (!
|
|
103
|
-
const
|
|
104
|
-
if (!e.isArrowFunctionExpression(
|
|
105
|
-
const u =
|
|
106
|
-
|
|
95
|
+
return h(r, {
|
|
96
|
+
ExportNamedDeclaration(c) {
|
|
97
|
+
const a = c.node.declaration;
|
|
98
|
+
if (!e.isVariableDeclaration(a)) return;
|
|
99
|
+
const o = a.declarations[0];
|
|
100
|
+
if (!o || !e.isIdentifier(o.id)) return;
|
|
101
|
+
const i = o.id.name;
|
|
102
|
+
if (!i.startsWith("action_")) return;
|
|
103
|
+
const t = i.replace("action_", ""), l = o.init;
|
|
104
|
+
if (!e.isArrowFunctionExpression(l) || !l.async) return;
|
|
105
|
+
const u = l.params, d = ee(n, t, u);
|
|
106
|
+
l.body = e.blockStatement([e.returnStatement(d)]), te(l, u);
|
|
107
107
|
}
|
|
108
|
-
}),
|
|
108
|
+
}), g(r, { retainLines: !0 }).code;
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
const
|
|
110
|
+
function ee(p, n, r) {
|
|
111
|
+
const s = `/_action/${p}/${n}`;
|
|
112
112
|
return r.length === 0 ? e.callExpression(
|
|
113
113
|
e.memberExpression(
|
|
114
114
|
e.callExpression(e.identifier("fetch"), [
|
|
115
|
-
e.stringLiteral(
|
|
115
|
+
e.stringLiteral(s),
|
|
116
116
|
e.objectExpression([
|
|
117
117
|
e.objectProperty(
|
|
118
118
|
e.identifier("method"),
|
|
@@ -137,7 +137,7 @@ function G(p, s, r) {
|
|
|
137
137
|
) : e.callExpression(
|
|
138
138
|
e.memberExpression(
|
|
139
139
|
e.callExpression(e.identifier("fetch"), [
|
|
140
|
-
e.stringLiteral(
|
|
140
|
+
e.stringLiteral(s),
|
|
141
141
|
e.objectExpression([
|
|
142
142
|
e.objectProperty(
|
|
143
143
|
e.identifier("method"),
|
|
@@ -177,372 +177,461 @@ function G(p, s, r) {
|
|
|
177
177
|
]
|
|
178
178
|
);
|
|
179
179
|
}
|
|
180
|
-
function
|
|
181
|
-
if (
|
|
182
|
-
const r =
|
|
180
|
+
function te(p, n) {
|
|
181
|
+
if (n.length === 0) return;
|
|
182
|
+
const r = n[0];
|
|
183
183
|
if (e.isObjectPattern(r)) {
|
|
184
|
-
let
|
|
184
|
+
let s = null;
|
|
185
185
|
if (e.isTSTypeAnnotation(r.typeAnnotation) && e.isTSTypeReference(r.typeAnnotation.typeAnnotation)) {
|
|
186
|
-
const
|
|
187
|
-
e.isIdentifier(
|
|
186
|
+
const o = r.typeAnnotation.typeAnnotation;
|
|
187
|
+
e.isIdentifier(o.typeName, { name: "ActionArgs" }) && o.typeParameters?.params[0] && (s = o.typeParameters.params[0]);
|
|
188
188
|
}
|
|
189
|
-
const
|
|
189
|
+
const c = e.objectProperty(
|
|
190
190
|
e.identifier("body"),
|
|
191
191
|
e.identifier("body"),
|
|
192
192
|
!1,
|
|
193
193
|
!0
|
|
194
194
|
// shorthand
|
|
195
|
-
),
|
|
196
|
-
|
|
195
|
+
), a = e.objectPattern([c]);
|
|
196
|
+
s && (a.typeAnnotation = e.tsTypeAnnotation(
|
|
197
197
|
e.tsTypeLiteral([
|
|
198
198
|
e.tsPropertySignature(
|
|
199
199
|
e.identifier("body"),
|
|
200
|
-
e.tsTypeAnnotation(
|
|
200
|
+
e.tsTypeAnnotation(s)
|
|
201
201
|
)
|
|
202
202
|
])
|
|
203
|
-
)), p.params = [
|
|
203
|
+
)), p.params = [a];
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function re(p, n) {
|
|
207
207
|
const r = v(p, {
|
|
208
208
|
sourceType: "module",
|
|
209
209
|
plugins: ["typescript", "jsx"]
|
|
210
210
|
});
|
|
211
|
-
return
|
|
212
|
-
ExportNamedDeclaration(
|
|
213
|
-
const
|
|
214
|
-
if (!e.isVariableDeclaration(
|
|
215
|
-
const
|
|
216
|
-
if (!
|
|
217
|
-
const
|
|
218
|
-
if (!
|
|
219
|
-
const
|
|
220
|
-
|
|
211
|
+
return h(r, {
|
|
212
|
+
ExportNamedDeclaration(c) {
|
|
213
|
+
const a = c.node.declaration;
|
|
214
|
+
if (!e.isVariableDeclaration(a)) return;
|
|
215
|
+
const o = a.declarations[0];
|
|
216
|
+
if (!o || !e.isIdentifier(o.id)) return;
|
|
217
|
+
const i = o.id.name;
|
|
218
|
+
if (!i.startsWith("stream_")) return;
|
|
219
|
+
const t = i.replace("stream_", ""), l = `/_event/${n}/${t}`;
|
|
220
|
+
o.init = e.objectExpression([
|
|
221
221
|
e.objectProperty(
|
|
222
222
|
e.identifier("__isVeloEventStream"),
|
|
223
223
|
e.booleanLiteral(!0)
|
|
224
224
|
),
|
|
225
225
|
e.objectProperty(
|
|
226
226
|
e.identifier("__path"),
|
|
227
|
-
e.stringLiteral(
|
|
227
|
+
e.stringLiteral(l)
|
|
228
228
|
)
|
|
229
|
-
]),
|
|
229
|
+
]), o.id.typeAnnotation = null;
|
|
230
230
|
}
|
|
231
|
-
}),
|
|
231
|
+
}), g(r, { retainLines: !0 }).code;
|
|
232
232
|
}
|
|
233
|
-
function
|
|
233
|
+
function ne(p, n) {
|
|
234
234
|
const r = v(p, {
|
|
235
235
|
sourceType: "module",
|
|
236
236
|
plugins: ["typescript", "jsx"]
|
|
237
237
|
});
|
|
238
|
-
return
|
|
239
|
-
ExportNamedDeclaration(
|
|
240
|
-
const
|
|
241
|
-
if (!e.isVariableDeclaration(
|
|
242
|
-
const
|
|
243
|
-
if (!
|
|
244
|
-
const
|
|
245
|
-
if (!
|
|
246
|
-
const
|
|
247
|
-
|
|
238
|
+
return h(r, {
|
|
239
|
+
ExportNamedDeclaration(c) {
|
|
240
|
+
const a = c.node.declaration;
|
|
241
|
+
if (!e.isVariableDeclaration(a)) return;
|
|
242
|
+
const o = a.declarations[0];
|
|
243
|
+
if (!o || !e.isIdentifier(o.id)) return;
|
|
244
|
+
const i = o.id.name;
|
|
245
|
+
if (!i.startsWith("socket_")) return;
|
|
246
|
+
const t = i.replace("socket_", ""), l = `/_socket/${n}/${t}`;
|
|
247
|
+
o.init = e.objectExpression([
|
|
248
248
|
e.objectProperty(
|
|
249
249
|
e.identifier("__isVeloSocket"),
|
|
250
250
|
e.booleanLiteral(!0)
|
|
251
251
|
),
|
|
252
252
|
e.objectProperty(
|
|
253
253
|
e.identifier("__path"),
|
|
254
|
-
e.stringLiteral(
|
|
254
|
+
e.stringLiteral(l)
|
|
255
255
|
)
|
|
256
|
-
]),
|
|
256
|
+
]), o.id.typeAnnotation = null;
|
|
257
257
|
}
|
|
258
|
-
}),
|
|
258
|
+
}), g(r, { retainLines: !0 }).code;
|
|
259
259
|
}
|
|
260
|
-
function
|
|
261
|
-
const
|
|
260
|
+
function se(p) {
|
|
261
|
+
const n = v(p, {
|
|
262
262
|
sourceType: "module",
|
|
263
263
|
plugins: ["typescript", "jsx"]
|
|
264
264
|
});
|
|
265
|
-
return
|
|
266
|
-
ExportNamedDeclaration(
|
|
267
|
-
const
|
|
268
|
-
if (!e.isVariableDeclaration(
|
|
269
|
-
const
|
|
270
|
-
!
|
|
265
|
+
return h(n, {
|
|
266
|
+
ExportNamedDeclaration(s) {
|
|
267
|
+
const c = s.node.declaration;
|
|
268
|
+
if (!e.isVariableDeclaration(c)) return;
|
|
269
|
+
const a = c.declarations[0];
|
|
270
|
+
!a || !e.isIdentifier(a.id) || a.id.name === "loader" && s.remove();
|
|
271
271
|
}
|
|
272
|
-
}),
|
|
272
|
+
}), g(n, { retainLines: !0 }).code;
|
|
273
273
|
}
|
|
274
|
-
function
|
|
275
|
-
const
|
|
274
|
+
function ie(p) {
|
|
275
|
+
const n = v(p, {
|
|
276
276
|
sourceType: "module",
|
|
277
277
|
plugins: ["typescript", "jsx"]
|
|
278
278
|
}), r = /* @__PURE__ */ new Set();
|
|
279
|
-
|
|
280
|
-
let
|
|
281
|
-
return
|
|
282
|
-
ImportDeclaration(
|
|
283
|
-
const
|
|
284
|
-
if (
|
|
285
|
-
const
|
|
286
|
-
|
|
279
|
+
T(n.program, r);
|
|
280
|
+
let s = !1;
|
|
281
|
+
return h(n, {
|
|
282
|
+
ImportDeclaration(a) {
|
|
283
|
+
const o = a.node.specifiers;
|
|
284
|
+
if (o.length === 0) return;
|
|
285
|
+
const i = o.filter((t) => r.has(t.local.name));
|
|
286
|
+
i.length !== o.length && (s = !0, i.length === 0 ? a.remove() : a.node.specifiers = i);
|
|
287
287
|
}
|
|
288
|
-
}),
|
|
288
|
+
}), s ? g(n, { retainLines: !0 }).code : p;
|
|
289
289
|
}
|
|
290
|
-
function
|
|
291
|
-
const
|
|
290
|
+
function oe(p) {
|
|
291
|
+
const n = v(p, {
|
|
292
292
|
sourceType: "module",
|
|
293
293
|
plugins: ["typescript", "jsx"]
|
|
294
294
|
}), r = [];
|
|
295
|
-
if (
|
|
296
|
-
ObjectProperty(
|
|
297
|
-
e.isIdentifier(
|
|
295
|
+
if (h(n, {
|
|
296
|
+
ObjectProperty(i) {
|
|
297
|
+
e.isIdentifier(i.node.key, { name: "middlewares" }) && (r.push(i.node.value), i.remove());
|
|
298
298
|
}
|
|
299
299
|
}), r.length === 0) return p;
|
|
300
|
-
const
|
|
301
|
-
for (const
|
|
302
|
-
|
|
303
|
-
const
|
|
304
|
-
|
|
305
|
-
const
|
|
306
|
-
for (const
|
|
307
|
-
|
|
308
|
-
return
|
|
309
|
-
ImportDeclaration(
|
|
310
|
-
const
|
|
311
|
-
|
|
300
|
+
const s = /* @__PURE__ */ new Set();
|
|
301
|
+
for (const i of r)
|
|
302
|
+
T(i, s);
|
|
303
|
+
const c = /* @__PURE__ */ new Set();
|
|
304
|
+
T(n.program, c);
|
|
305
|
+
const a = /* @__PURE__ */ new Set();
|
|
306
|
+
for (const i of s)
|
|
307
|
+
c.has(i) || a.add(i);
|
|
308
|
+
return a.size > 0 && h(n, {
|
|
309
|
+
ImportDeclaration(i) {
|
|
310
|
+
const t = i.node.specifiers, l = t.filter((u) => !a.has(u.local.name));
|
|
311
|
+
l.length === 0 ? i.remove() : l.length !== t.length && (i.node.specifiers = l);
|
|
312
312
|
}
|
|
313
|
-
}),
|
|
313
|
+
}), g(n, { retainLines: !0 }).code;
|
|
314
314
|
}
|
|
315
|
-
function
|
|
316
|
-
const r = (
|
|
317
|
-
if (!(!
|
|
318
|
-
if (Array.isArray(
|
|
319
|
-
for (const
|
|
315
|
+
function T(p, n) {
|
|
316
|
+
const r = (s) => {
|
|
317
|
+
if (!(!s || typeof s != "object")) {
|
|
318
|
+
if (Array.isArray(s)) {
|
|
319
|
+
for (const c of s) r(c);
|
|
320
320
|
return;
|
|
321
321
|
}
|
|
322
|
-
if (
|
|
323
|
-
|
|
322
|
+
if (s.type === "Identifier") {
|
|
323
|
+
n.add(s.name), s.typeAnnotation && r(s.typeAnnotation);
|
|
324
324
|
return;
|
|
325
325
|
}
|
|
326
|
-
if (
|
|
327
|
-
|
|
326
|
+
if (s.type === "JSXIdentifier") {
|
|
327
|
+
n.add(s.name);
|
|
328
328
|
return;
|
|
329
329
|
}
|
|
330
|
-
if (
|
|
331
|
-
r(
|
|
330
|
+
if (s.type === "MemberExpression") {
|
|
331
|
+
r(s.object), s.computed && r(s.property);
|
|
332
332
|
return;
|
|
333
333
|
}
|
|
334
|
-
if ((
|
|
335
|
-
|
|
334
|
+
if ((s.type === "ObjectProperty" || s.type === "ObjectMethod") && !s.computed) {
|
|
335
|
+
s.type === "ObjectProperty" ? r(s.value) : r(s.body);
|
|
336
336
|
return;
|
|
337
337
|
}
|
|
338
|
-
if (!(
|
|
339
|
-
for (const
|
|
340
|
-
|
|
338
|
+
if (!(s.type === "ImportSpecifier" || s.type === "ImportDefaultSpecifier" || s.type === "ImportNamespaceSpecifier"))
|
|
339
|
+
for (const c of Object.keys(s))
|
|
340
|
+
c === "loc" || c === "start" || c === "end" || c === "leadingComments" || c === "trailingComments" || c === "innerComments" || r(s[c]);
|
|
341
341
|
}
|
|
342
342
|
};
|
|
343
343
|
r(p);
|
|
344
344
|
}
|
|
345
|
-
function
|
|
346
|
-
for (const
|
|
347
|
-
if (e.isObjectProperty(
|
|
345
|
+
function ae(p) {
|
|
346
|
+
for (const n of p.properties)
|
|
347
|
+
if (e.isObjectProperty(n) && e.isIdentifier(n.key) && n.key.name === "handler")
|
|
348
348
|
return !0;
|
|
349
349
|
return !1;
|
|
350
350
|
}
|
|
351
|
-
function
|
|
352
|
-
for (const
|
|
353
|
-
if (e.isObjectProperty(
|
|
354
|
-
return
|
|
351
|
+
function ce(p) {
|
|
352
|
+
for (const n of p.properties)
|
|
353
|
+
if (e.isObjectProperty(n) && e.isIdentifier(n.key) && n.key.name === "children" && e.isArrayExpression(n.value))
|
|
354
|
+
return n.value;
|
|
355
355
|
return null;
|
|
356
356
|
}
|
|
357
|
-
function
|
|
358
|
-
const
|
|
357
|
+
function le(p) {
|
|
358
|
+
const n = v(p, {
|
|
359
359
|
sourceType: "module",
|
|
360
360
|
plugins: ["typescript", "jsx"]
|
|
361
|
-
}), r = [],
|
|
362
|
-
for (let
|
|
363
|
-
const u =
|
|
361
|
+
}), r = [], s = (t) => {
|
|
362
|
+
for (let l = t.elements.length - 1; l >= 0; l--) {
|
|
363
|
+
const u = t.elements[l];
|
|
364
364
|
if (!e.isObjectExpression(u)) continue;
|
|
365
|
-
if (
|
|
366
|
-
r.push(u),
|
|
365
|
+
if (ae(u)) {
|
|
366
|
+
r.push(u), t.elements.splice(l, 1);
|
|
367
367
|
continue;
|
|
368
368
|
}
|
|
369
|
-
const
|
|
370
|
-
|
|
369
|
+
const d = ce(u);
|
|
370
|
+
d && s(d);
|
|
371
371
|
}
|
|
372
372
|
};
|
|
373
|
-
if (
|
|
374
|
-
ExportDefaultDeclaration(
|
|
375
|
-
const
|
|
373
|
+
if (h(n, {
|
|
374
|
+
ExportDefaultDeclaration(t) {
|
|
375
|
+
const l = t.node.declaration;
|
|
376
376
|
let u = null;
|
|
377
|
-
e.isArrayExpression(
|
|
377
|
+
e.isArrayExpression(l) ? u = l : (e.isTSSatisfiesExpression(l) && e.isArrayExpression(l.expression) || e.isTSAsExpression(l) && e.isArrayExpression(l.expression)) && (u = l.expression), u && s(u);
|
|
378
378
|
}
|
|
379
379
|
}), r.length === 0) return p;
|
|
380
|
-
const
|
|
381
|
-
for (const
|
|
382
|
-
|
|
383
|
-
const t = /* @__PURE__ */ new Set();
|
|
384
|
-
I(s.program, t);
|
|
380
|
+
const c = /* @__PURE__ */ new Set();
|
|
381
|
+
for (const t of r)
|
|
382
|
+
T(t, c);
|
|
385
383
|
const a = /* @__PURE__ */ new Set();
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
384
|
+
T(n.program, a);
|
|
385
|
+
const o = /* @__PURE__ */ new Set();
|
|
386
|
+
for (const t of c)
|
|
387
|
+
a.has(t) || o.add(t);
|
|
388
|
+
return o.size > 0 && h(n, {
|
|
389
|
+
ImportDeclaration(t) {
|
|
390
|
+
const l = t.node.specifiers, u = l.filter((d) => !o.has(d.local.name));
|
|
391
|
+
u.length === 0 ? t.remove() : u.length !== l.length && (t.node.specifiers = u);
|
|
392
392
|
}
|
|
393
|
-
}),
|
|
393
|
+
}), g(n, { retainLines: !0 }).code;
|
|
394
394
|
}
|
|
395
|
-
function
|
|
396
|
-
const
|
|
395
|
+
function F(p) {
|
|
396
|
+
const n = v(p, {
|
|
397
397
|
sourceType: "module",
|
|
398
398
|
plugins: ["typescript", "jsx"]
|
|
399
399
|
}), r = /* @__PURE__ */ new Map();
|
|
400
|
-
|
|
401
|
-
ImportDeclaration(
|
|
402
|
-
const
|
|
403
|
-
for (const
|
|
404
|
-
e.isImportNamespaceSpecifier(
|
|
400
|
+
h(n, {
|
|
401
|
+
ImportDeclaration(a) {
|
|
402
|
+
const o = a.node.source.value;
|
|
403
|
+
for (const i of a.node.specifiers)
|
|
404
|
+
e.isImportNamespaceSpecifier(i) && r.set(i.local.name, o);
|
|
405
405
|
}
|
|
406
406
|
});
|
|
407
|
-
const
|
|
408
|
-
|
|
409
|
-
ExportDefaultDeclaration(
|
|
410
|
-
const
|
|
411
|
-
let
|
|
412
|
-
e.isArrayExpression(
|
|
407
|
+
const s = /* @__PURE__ */ new Map();
|
|
408
|
+
h(n, {
|
|
409
|
+
ExportDefaultDeclaration(a) {
|
|
410
|
+
const o = a.node.declaration;
|
|
411
|
+
let i = null;
|
|
412
|
+
e.isArrayExpression(o) ? i = o : (e.isTSSatisfiesExpression(o) || e.isTSAsExpression(o)) && e.isArrayExpression(o.expression) && (i = o.expression), i && R(i.elements, "", s);
|
|
413
413
|
}
|
|
414
414
|
});
|
|
415
|
-
const
|
|
416
|
-
for (const [
|
|
417
|
-
const
|
|
418
|
-
if (
|
|
419
|
-
const
|
|
420
|
-
|
|
415
|
+
const c = /* @__PURE__ */ new Map();
|
|
416
|
+
for (const [a, o] of s) {
|
|
417
|
+
const i = r.get(a);
|
|
418
|
+
if (i) {
|
|
419
|
+
const t = i.replace(/^\.\//, "").replace(/\.(tsx?|jsx?|js)$/, "");
|
|
420
|
+
c.set(t, o);
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
|
-
return
|
|
423
|
+
return c;
|
|
424
424
|
}
|
|
425
|
-
function
|
|
426
|
-
for (const
|
|
427
|
-
if (!e.isObjectExpression(
|
|
428
|
-
let
|
|
429
|
-
for (const
|
|
430
|
-
if (!e.isObjectProperty(
|
|
431
|
-
const
|
|
432
|
-
u === "path" && e.isStringLiteral(
|
|
425
|
+
function R(p, n, r) {
|
|
426
|
+
for (const s of p) {
|
|
427
|
+
if (!e.isObjectExpression(s)) continue;
|
|
428
|
+
let c = "", a = n, o = null, i = null;
|
|
429
|
+
for (const t of s.properties) {
|
|
430
|
+
if (!e.isObjectProperty(t)) continue;
|
|
431
|
+
const l = t.key, u = e.isIdentifier(l) ? l.name : null;
|
|
432
|
+
u === "path" && e.isStringLiteral(t.value) && (c = t.value.value, c && !c.startsWith("/") ? a = n + "/" + c : a = n + c), u === "module" && e.isIdentifier(t.value) && (o = t.value.name), u === "children" && e.isArrayExpression(t.value) && (i = t.value);
|
|
433
433
|
}
|
|
434
|
-
if (
|
|
435
|
-
const
|
|
436
|
-
r.set(
|
|
437
|
-
fullPath:
|
|
438
|
-
path:
|
|
434
|
+
if (o) {
|
|
435
|
+
const l = !i && c === "/" ? n || "/" : a;
|
|
436
|
+
r.set(o, {
|
|
437
|
+
fullPath: l,
|
|
438
|
+
path: c
|
|
439
439
|
});
|
|
440
440
|
}
|
|
441
|
-
|
|
441
|
+
i && R(i.elements, a, r);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
function pe(p) {
|
|
445
|
+
const n = v(p, {
|
|
446
|
+
sourceType: "module",
|
|
447
|
+
plugins: ["typescript", "jsx"]
|
|
448
|
+
});
|
|
449
|
+
let r = null;
|
|
450
|
+
return h(n, {
|
|
451
|
+
ExportNamedDeclaration(s) {
|
|
452
|
+
if (r) return;
|
|
453
|
+
const c = s.node.declaration;
|
|
454
|
+
if (e.isVariableDeclaration(c))
|
|
455
|
+
for (const a of c.declarations) {
|
|
456
|
+
if (!e.isIdentifier(a.id, { name: "channels" })) continue;
|
|
457
|
+
let o = a.init;
|
|
458
|
+
if (o && (e.isTSSatisfiesExpression(o) || e.isTSAsExpression(o)) && (o = o.expression), !e.isArrayExpression(o)) continue;
|
|
459
|
+
const i = [];
|
|
460
|
+
for (const t of o.elements)
|
|
461
|
+
e.isStringLiteral(t) && i.push(t.value);
|
|
462
|
+
r = i;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}), r;
|
|
466
|
+
}
|
|
467
|
+
function ue(p) {
|
|
468
|
+
const n = /* @__PURE__ */ new Set();
|
|
469
|
+
if (!x.existsSync(p)) return n;
|
|
470
|
+
let r;
|
|
471
|
+
try {
|
|
472
|
+
r = v(x.readFileSync(p, "utf-8"), {
|
|
473
|
+
sourceType: "module",
|
|
474
|
+
plugins: ["typescript", "jsx"]
|
|
475
|
+
});
|
|
476
|
+
} catch {
|
|
477
|
+
return n;
|
|
442
478
|
}
|
|
479
|
+
return h(r, {
|
|
480
|
+
ExportNamedDeclaration(s) {
|
|
481
|
+
const c = s.node.declaration;
|
|
482
|
+
if (e.isVariableDeclaration(c))
|
|
483
|
+
for (const a of c.declarations) {
|
|
484
|
+
if (!e.isIdentifier(a.id, { name: "channels" })) continue;
|
|
485
|
+
let o = a.init;
|
|
486
|
+
if (o && (e.isTSSatisfiesExpression(o) || e.isTSAsExpression(o)) && (o = o.expression), !!e.isObjectExpression(o))
|
|
487
|
+
for (const i of o.properties)
|
|
488
|
+
e.isObjectProperty(i) && (e.isIdentifier(i.key) ? n.add(i.key.name) : e.isStringLiteral(i.key) && n.add(i.key.value));
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
}), n;
|
|
492
|
+
}
|
|
493
|
+
function C(p) {
|
|
494
|
+
return [m.join(p, "channels.ts"), m.join(p, "channels.tsx")];
|
|
443
495
|
}
|
|
444
|
-
const
|
|
445
|
-
function
|
|
446
|
-
let r =
|
|
447
|
-
const
|
|
496
|
+
const O = "virtual:velo/server-entry", N = "virtual:velo/client-entry", V = "\0" + O, $ = "\0" + N;
|
|
497
|
+
function fe(p, n) {
|
|
498
|
+
let r = m.resolve(process.cwd(), n);
|
|
499
|
+
const s = p.routesFile ?? "routes.tsx", c = /* @__PURE__ */ new Map();
|
|
500
|
+
let a = null;
|
|
501
|
+
const o = () => {
|
|
502
|
+
if (!a) {
|
|
503
|
+
const t = C(r).find((l) => x.existsSync(l));
|
|
504
|
+
a = t ? ue(t) : /* @__PURE__ */ new Set();
|
|
505
|
+
}
|
|
506
|
+
return a;
|
|
507
|
+
}, i = /* @__PURE__ */ new Set();
|
|
448
508
|
return {
|
|
449
509
|
name: "velo:transform",
|
|
450
510
|
enforce: "pre",
|
|
451
511
|
configResolved(t) {
|
|
452
|
-
r =
|
|
512
|
+
r = m.resolve(t.root, n), a = null;
|
|
453
513
|
},
|
|
454
514
|
buildStart() {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
l.
|
|
459
|
-
|
|
460
|
-
|
|
515
|
+
a = null;
|
|
516
|
+
const t = m.join(r, s);
|
|
517
|
+
if (x.existsSync(t)) {
|
|
518
|
+
const l = x.readFileSync(t, "utf-8"), u = F(l);
|
|
519
|
+
c.clear();
|
|
520
|
+
for (const [d, f] of u)
|
|
521
|
+
c.set(d, f);
|
|
461
522
|
}
|
|
462
523
|
},
|
|
463
|
-
handleHotUpdate({ file: t, server:
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
524
|
+
handleHotUpdate({ file: t, server: l }) {
|
|
525
|
+
if (C(r).includes(t))
|
|
526
|
+
return a = null, l.ws.send({ type: "full-reload" }), [];
|
|
527
|
+
const u = m.join(r, s);
|
|
528
|
+
if (t === u) {
|
|
529
|
+
const d = x.readFileSync(u, "utf-8"), f = F(d);
|
|
530
|
+
c.clear();
|
|
531
|
+
for (const [y, E] of f)
|
|
532
|
+
c.set(y, E);
|
|
533
|
+
return l.ws.send({ type: "full-reload" }), [];
|
|
471
534
|
}
|
|
472
535
|
},
|
|
473
536
|
resolveId(t) {
|
|
474
|
-
return t ===
|
|
537
|
+
return t === O || t.endsWith(O) ? V : t === N || t.endsWith(N) || t === "/__velo_client.js" ? $ : null;
|
|
475
538
|
},
|
|
476
539
|
load(t) {
|
|
477
|
-
const
|
|
478
|
-
|
|
540
|
+
const l = p.routesFile ?? "routes.tsx", u = p.serverInit ?? "server.tsx", d = p.clientInit ?? "client.tsx", f = m.join(r, l).replace(/\.tsx?$/, ".js"), y = m.join(r, u).replace(/\.tsx?$/, ".js"), E = m.join(r, d).replace(/\.tsx?$/, ".js");
|
|
541
|
+
if (t === V) {
|
|
542
|
+
const b = C(r).find((j) => x.existsSync(j)), _ = b ? b.replace(/\.tsx?$/, ".js") : null;
|
|
543
|
+
return `
|
|
479
544
|
globalThis.__veloBuildHash = __VELO_BUILD_HASH__;
|
|
480
545
|
globalThis.__veloClientJs = __VELO_CLIENT_JS__;
|
|
481
546
|
globalThis.__veloClientCss = __VELO_CLIENT_CSS__;
|
|
482
|
-
import "${
|
|
483
|
-
import routes from "${
|
|
484
|
-
import { startServer } from "@mauroandre/velojs/server";
|
|
547
|
+
import "${y}";
|
|
548
|
+
import routes from "${f}";
|
|
549
|
+
import { startServer${_ ? ", registerChannels" : ""} } from "@mauroandre/velojs/server";
|
|
550
|
+
${_ ? `import { channels as __veloChannelMap } from "${_}";` : ""}
|
|
551
|
+
${_ ? "registerChannels(__veloChannelMap);" : ""}
|
|
485
552
|
|
|
486
553
|
export { routes };
|
|
487
554
|
export default await startServer({ routes, port: __VELO_CONFIG_PORT__, hostname: __VELO_CONFIG_HOSTNAME__ });
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
555
|
+
`;
|
|
556
|
+
}
|
|
557
|
+
return t === $ ? `
|
|
558
|
+
import "${E}";
|
|
559
|
+
import routes from "${f}";
|
|
491
560
|
import { startClient } from "@mauroandre/velojs/client";
|
|
492
561
|
|
|
493
562
|
startClient({ routes });
|
|
494
563
|
` : null;
|
|
495
564
|
},
|
|
496
|
-
transform(t,
|
|
497
|
-
const
|
|
498
|
-
if (
|
|
499
|
-
let
|
|
500
|
-
const
|
|
565
|
+
transform(t, l, u) {
|
|
566
|
+
const d = u?.ssr === !0;
|
|
567
|
+
if (l.startsWith("\0") || l.includes("/.velojs/") || !l.endsWith(".tsx") && !l.endsWith(".ts") || !l.startsWith(r)) return null;
|
|
568
|
+
let f = t, y = !1;
|
|
569
|
+
const E = /middlewares:\s*\[/.test(t), b = /export\s+(const|function)\s+Component/.test(
|
|
501
570
|
t
|
|
502
|
-
),
|
|
503
|
-
if (
|
|
504
|
-
const
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
571
|
+
), _ = /export\s+(const|function)\s+loader/.test(t), j = /export\s+const\s+action_\w+/.test(t), A = /export\s+const\s+stream_\w+/.test(t), L = /export\s+const\s+socket_\w+/.test(t), M = /\bLoader\s*</.test(t) || /\bLoader\s*\(/.test(t), H = /\buseLoader\s*</.test(t) || /\buseLoader\s*\(/.test(t), J = /\bhandler\s*:/.test(t), U = /export\s+(const|let|var)\s+channels\b/.test(t), S = m.relative(r, l).replace(/\.(tsx?|jsx?)$/, "").replace(/\\/g, "/");
|
|
572
|
+
if (U) {
|
|
573
|
+
const I = pe(t);
|
|
574
|
+
if (I) {
|
|
575
|
+
if (!_)
|
|
576
|
+
throw new Error(
|
|
577
|
+
`[velojs] "${S}" declares \`channels\` without a \`loader\` — there is nothing to synchronize. Add a loader or remove the export.`
|
|
578
|
+
);
|
|
579
|
+
const B = o(), k = I.filter((w) => !B.has(w));
|
|
580
|
+
if (k.length > 0)
|
|
581
|
+
throw new Error(
|
|
582
|
+
`[velojs] "${S}" declares channel(s) ${k.map((w) => `"${w}"`).join(", ")} with no entry in app/channels.ts — add the partition resolver for each name (a typo or a rename would otherwise be a silent no-op).`
|
|
583
|
+
);
|
|
584
|
+
process.env.VELO_STATIC && !i.has(S) && (i.add(S), console.warn(
|
|
585
|
+
`[velojs] "${S}" declares channels (${I.join(
|
|
586
|
+
", "
|
|
587
|
+
)}) — inert in a static build: there is no SSE server, so no connection is opened and freshness stays "live".`
|
|
588
|
+
));
|
|
589
|
+
}
|
|
515
590
|
}
|
|
516
|
-
|
|
517
|
-
|
|
591
|
+
const W = m.join(r, s);
|
|
592
|
+
if (!d && E && (f = oe(f), y = !0), !d && J && l === W && (f = le(f), y = !0), b || _ || j || A || L || M || H) {
|
|
593
|
+
const I = c.get(S);
|
|
594
|
+
f = K(f, S, I?.fullPath, I?.path), f = Q(f, S), d || (f = Z(
|
|
595
|
+
f,
|
|
596
|
+
S
|
|
597
|
+
)), !d && A && (f = re(
|
|
598
|
+
f,
|
|
599
|
+
S
|
|
600
|
+
)), !d && L && (f = ne(
|
|
601
|
+
f,
|
|
602
|
+
S
|
|
603
|
+
)), d || (f = se(f)), d || (f = ie(f)), y = !0;
|
|
604
|
+
}
|
|
605
|
+
return y ? {
|
|
606
|
+
code: f,
|
|
518
607
|
map: null
|
|
519
608
|
} : null;
|
|
520
609
|
}
|
|
521
610
|
};
|
|
522
611
|
}
|
|
523
|
-
function
|
|
612
|
+
function de(p) {
|
|
524
613
|
return {
|
|
525
614
|
name: "velo:config",
|
|
526
|
-
config(
|
|
527
|
-
const
|
|
615
|
+
config(n, { mode: r }) {
|
|
616
|
+
const s = r === "server", c = r === "development", a = !!process.env.VELO_STATIC, o = n.server?.port ?? (Number(process.env.PORT) || p.port || 3e3), i = m.resolve(
|
|
528
617
|
process.cwd(),
|
|
529
|
-
|
|
530
|
-
),
|
|
531
|
-
let
|
|
532
|
-
if (
|
|
618
|
+
n.root ?? "."
|
|
619
|
+
), t = n.envDir ? m.resolve(i, n.envDir) : i, l = G(r, t, ""), u = process.env.HOST?.trim() || l.HOST?.trim() || void 0, d = n.server?.host ?? u ?? p.hostname, f = d === !0 || d === "0.0.0.0" || d === "::", y = n.server?.allowedHosts ?? (f ? !0 : void 0);
|
|
620
|
+
let E = "client.js", b = "client.css";
|
|
621
|
+
if (s)
|
|
533
622
|
try {
|
|
534
|
-
const
|
|
535
|
-
|
|
623
|
+
const j = m.resolve(process.cwd(), "dist/client/.vite/manifest.json"), L = JSON.parse(x.readFileSync(j, "utf-8"))[N];
|
|
624
|
+
L && (E = L.file || E, L.css?.[0] && (b = L.css[0]));
|
|
536
625
|
} catch {
|
|
537
626
|
}
|
|
538
|
-
const
|
|
627
|
+
const _ = {
|
|
539
628
|
define: {
|
|
540
|
-
"process.env.NODE_ENV": JSON.stringify(
|
|
541
|
-
"process.env.STATIC_BASE_URL": JSON.stringify(process.env.STATIC_BASE_URL || (
|
|
542
|
-
__VELO_STATIC__: JSON.stringify(
|
|
629
|
+
"process.env.NODE_ENV": JSON.stringify(c ? "development" : "production"),
|
|
630
|
+
"process.env.STATIC_BASE_URL": JSON.stringify(process.env.STATIC_BASE_URL || (a ? "/client" : "")),
|
|
631
|
+
__VELO_STATIC__: JSON.stringify(a),
|
|
543
632
|
__VELO_BUILD_HASH__: JSON.stringify(process.env.VELO_BUILD_HASH || Date.now().toString(36)),
|
|
544
|
-
__VELO_CLIENT_JS__: JSON.stringify(
|
|
545
|
-
__VELO_CLIENT_CSS__: JSON.stringify(
|
|
633
|
+
__VELO_CLIENT_JS__: JSON.stringify(E),
|
|
634
|
+
__VELO_CLIENT_CSS__: JSON.stringify(b),
|
|
546
635
|
// Baked into the server bundle as startServer's port fallback.
|
|
547
636
|
// null when unset → startServer falls back to PORT env / 3000.
|
|
548
637
|
__VELO_CONFIG_PORT__: JSON.stringify(p.port ?? null),
|
|
@@ -556,15 +645,15 @@ function ne(p) {
|
|
|
556
645
|
}
|
|
557
646
|
},
|
|
558
647
|
server: {
|
|
559
|
-
port:
|
|
648
|
+
port: o,
|
|
560
649
|
// Host and allowedHosts only shape the dev server; in build
|
|
561
650
|
// they are inert, so we keep them out of the build config.
|
|
562
|
-
...
|
|
563
|
-
...
|
|
651
|
+
...c && d !== void 0 ? { host: d } : {},
|
|
652
|
+
...c && y !== void 0 ? { allowedHosts: y } : {}
|
|
564
653
|
}
|
|
565
654
|
};
|
|
566
|
-
return
|
|
567
|
-
ssr:
|
|
655
|
+
return s ? _.build = {
|
|
656
|
+
ssr: O,
|
|
568
657
|
outDir: "dist",
|
|
569
658
|
emptyOutDir: !1,
|
|
570
659
|
copyPublicDir: !1,
|
|
@@ -573,88 +662,88 @@ function ne(p) {
|
|
|
573
662
|
entryFileNames: "server.js"
|
|
574
663
|
}
|
|
575
664
|
}
|
|
576
|
-
} :
|
|
665
|
+
} : c || (_.build = {
|
|
577
666
|
manifest: !0,
|
|
578
667
|
outDir: "dist/client",
|
|
579
668
|
rollupOptions: {
|
|
580
|
-
input:
|
|
669
|
+
input: N,
|
|
581
670
|
output: {
|
|
582
671
|
entryFileNames: "client.[hash].js",
|
|
583
|
-
assetFileNames: (
|
|
672
|
+
assetFileNames: (j) => j.names?.[0]?.endsWith(".css") ? "client.[hash].css" : "[name].[hash][extname]"
|
|
584
673
|
}
|
|
585
674
|
}
|
|
586
|
-
}),
|
|
675
|
+
}), _;
|
|
587
676
|
}
|
|
588
677
|
};
|
|
589
678
|
}
|
|
590
|
-
function
|
|
679
|
+
function me() {
|
|
591
680
|
return {
|
|
592
681
|
name: "velo:static-url",
|
|
593
682
|
apply: "build",
|
|
594
683
|
enforce: "post",
|
|
595
|
-
generateBundle(p,
|
|
684
|
+
generateBundle(p, n) {
|
|
596
685
|
const r = process.env.STATIC_BASE_URL || "";
|
|
597
686
|
if (r)
|
|
598
|
-
for (const
|
|
599
|
-
|
|
687
|
+
for (const s of Object.values(n))
|
|
688
|
+
s.type === "asset" && typeof s.source == "string" && s.fileName.endsWith(".css") && (s.source = s.source.replace(
|
|
600
689
|
/url\(\s*(['"]?)\/(?!\/)/g,
|
|
601
690
|
`url($1${r}/`
|
|
602
691
|
));
|
|
603
692
|
}
|
|
604
693
|
};
|
|
605
694
|
}
|
|
606
|
-
function
|
|
607
|
-
let r = "",
|
|
608
|
-
function
|
|
695
|
+
function ye(p, n) {
|
|
696
|
+
let r = "", s = "", c = !1, a = null;
|
|
697
|
+
function o() {
|
|
609
698
|
if (!r) return;
|
|
610
|
-
const
|
|
611
|
-
if (!
|
|
612
|
-
const
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
JSON.stringify(
|
|
699
|
+
const i = m.resolve(r, n);
|
|
700
|
+
if (!x.existsSync(i)) return;
|
|
701
|
+
const t = q(i), l = m.join(r, ".velojs");
|
|
702
|
+
x.mkdirSync(l, { recursive: !0 }), x.writeFileSync(
|
|
703
|
+
m.join(l, "graph.json"),
|
|
704
|
+
JSON.stringify(t)
|
|
616
705
|
);
|
|
617
706
|
}
|
|
618
707
|
return {
|
|
619
708
|
name: "velo:graph",
|
|
620
|
-
configResolved(
|
|
621
|
-
r =
|
|
709
|
+
configResolved(i) {
|
|
710
|
+
r = i.root, s = i.mode;
|
|
622
711
|
},
|
|
623
712
|
writeBundle() {
|
|
624
|
-
|
|
713
|
+
s !== "server" && o();
|
|
625
714
|
},
|
|
626
|
-
configureServer(
|
|
627
|
-
|
|
628
|
-
const
|
|
629
|
-
|
|
630
|
-
|
|
715
|
+
configureServer(i) {
|
|
716
|
+
o(), c = !0;
|
|
717
|
+
const t = m.resolve(r, n);
|
|
718
|
+
i.watcher.on("all", (l, u) => {
|
|
719
|
+
c && u.startsWith(t) && (a && clearTimeout(a), a = setTimeout(() => o(), 500));
|
|
631
720
|
});
|
|
632
721
|
}
|
|
633
722
|
};
|
|
634
723
|
}
|
|
635
|
-
function
|
|
724
|
+
function he(p) {
|
|
636
725
|
return [
|
|
637
|
-
...
|
|
726
|
+
...X.exclude,
|
|
638
727
|
/.*\.mjs$/,
|
|
639
728
|
...p.devServerExclude ?? []
|
|
640
729
|
];
|
|
641
730
|
}
|
|
642
|
-
function
|
|
643
|
-
const
|
|
731
|
+
function Te(p) {
|
|
732
|
+
const n = p ?? {}, r = n.appDirectory ?? "./app";
|
|
644
733
|
return [
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
entry:
|
|
652
|
-
exclude:
|
|
734
|
+
de(n),
|
|
735
|
+
fe(n, r),
|
|
736
|
+
me(),
|
|
737
|
+
ye(n, r),
|
|
738
|
+
z(),
|
|
739
|
+
Y({
|
|
740
|
+
entry: O,
|
|
741
|
+
exclude: he(n)
|
|
653
742
|
}),
|
|
654
|
-
|
|
743
|
+
ve()
|
|
655
744
|
];
|
|
656
745
|
}
|
|
657
|
-
function
|
|
746
|
+
function ve() {
|
|
658
747
|
return {
|
|
659
748
|
name: "velo:ws-bridge",
|
|
660
749
|
configureServer(p) {
|
|
@@ -663,17 +752,19 @@ function ae() {
|
|
|
663
752
|
};
|
|
664
753
|
}
|
|
665
754
|
export {
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
K as
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
755
|
+
F as buildFullPathMap,
|
|
756
|
+
R as collectFullPaths,
|
|
757
|
+
pe as declaredChannelNames,
|
|
758
|
+
he as devServerExcludeFor,
|
|
759
|
+
K as injectMetadata,
|
|
760
|
+
ie as pruneClientOnlyImports,
|
|
761
|
+
ue as readChannelMapNames,
|
|
762
|
+
le as removeEndpointRoutes,
|
|
763
|
+
se as removeLoaders,
|
|
764
|
+
oe as removeMiddlewares,
|
|
765
|
+
Z as transformActionsForClient,
|
|
766
|
+
Q as transformLoaderFunctions,
|
|
767
|
+
ne as transformSocketsForClient,
|
|
768
|
+
re as transformStreamsForClient,
|
|
769
|
+
Te as veloPlugin
|
|
679
770
|
};
|