@mauroandre/velojs 0.0.50 → 0.0.52
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/agent/skills/velojs-boot-state/SKILL.md +82 -0
- package/agent/skills/velojs-production-deploy/SKILL.md +39 -0
- package/dist/components.d.ts +39 -0
- package/dist/components.js +44 -33
- package/dist/config.d.ts +6 -0
- package/dist/hooks.d.ts +24 -0
- package/dist/hooks.js +49 -45
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -8
- package/dist/server.d.ts +6 -0
- package/dist/server.js +137 -128
- package/dist/vite.js +57 -55
- package/package.json +1 -1
package/dist/vite.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import d from "node:path";
|
|
2
2
|
import g from "node:fs";
|
|
3
3
|
import R from "@preact/preset-vite";
|
|
4
|
-
import $, { defaultOptions as
|
|
5
|
-
import { parse as
|
|
4
|
+
import $, { defaultOptions as J } from "@hono/vite-dev-server";
|
|
5
|
+
import { parse as _ } from "@babel/parser";
|
|
6
6
|
import j from "@babel/traverse";
|
|
7
7
|
import L from "@babel/generator";
|
|
8
8
|
import * as e from "@babel/types";
|
|
9
|
-
import { buildGraph as
|
|
10
|
-
const m = typeof j == "function" ? j : j.default,
|
|
11
|
-
function
|
|
12
|
-
const l =
|
|
9
|
+
import { buildGraph as U } from "./graph.js";
|
|
10
|
+
const m = typeof j == "function" ? j : j.default, h = typeof L == "function" ? L : L.default;
|
|
11
|
+
function W(u, o, n, i) {
|
|
12
|
+
const l = _(u, {
|
|
13
13
|
sourceType: "module",
|
|
14
14
|
plugins: ["typescript", "jsx"]
|
|
15
15
|
});
|
|
@@ -22,7 +22,7 @@ function J(u, o, n, i) {
|
|
|
22
22
|
const r = c.declarations[0];
|
|
23
23
|
if (r && e.isIdentifier(r.id, { name: "metadata" }) && e.isObjectExpression(r.init)) {
|
|
24
24
|
t = !0;
|
|
25
|
-
const f = r.init.properties.filter((
|
|
25
|
+
const f = r.init.properties.filter((v) => e.isObjectProperty(v) && e.isIdentifier(v.key) ? v.key.name !== "moduleId" && v.key.name !== "fullPath" && v.key.name !== "path" : !0), y = [
|
|
26
26
|
e.objectProperty(
|
|
27
27
|
e.identifier("moduleId"),
|
|
28
28
|
e.stringLiteral(o)
|
|
@@ -70,10 +70,10 @@ function J(u, o, n, i) {
|
|
|
70
70
|
);
|
|
71
71
|
l.program.body.unshift(c);
|
|
72
72
|
}
|
|
73
|
-
return
|
|
73
|
+
return h(l, { retainLines: !0 }).code;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
76
|
-
const n =
|
|
75
|
+
function M(u, o) {
|
|
76
|
+
const n = _(u, {
|
|
77
77
|
sourceType: "module",
|
|
78
78
|
plugins: ["typescript", "jsx"]
|
|
79
79
|
});
|
|
@@ -84,10 +84,10 @@ function B(u, o) {
|
|
|
84
84
|
const c = l.node.arguments, r = e.stringLiteral(o), p = c[0];
|
|
85
85
|
e.isStringLiteral(p) && p.value.includes("/") || (l.node.arguments = [r, ...c]);
|
|
86
86
|
}
|
|
87
|
-
}),
|
|
87
|
+
}), h(n, { retainLines: !0 }).code;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
90
|
-
const n =
|
|
89
|
+
function B(u, o) {
|
|
90
|
+
const n = _(u, {
|
|
91
91
|
sourceType: "module",
|
|
92
92
|
plugins: ["typescript", "jsx"]
|
|
93
93
|
});
|
|
@@ -104,7 +104,7 @@ function M(u, o) {
|
|
|
104
104
|
const p = r.params, f = H(o, c, p);
|
|
105
105
|
r.body = e.blockStatement([e.returnStatement(f)]), G(r, p);
|
|
106
106
|
}
|
|
107
|
-
}),
|
|
107
|
+
}), h(n, { retainLines: !0 }).code;
|
|
108
108
|
}
|
|
109
109
|
function H(u, o, n) {
|
|
110
110
|
const i = `/_action/${u}/${o}`;
|
|
@@ -203,7 +203,7 @@ function G(u, o) {
|
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
function z(u, o) {
|
|
206
|
-
const n =
|
|
206
|
+
const n = _(u, {
|
|
207
207
|
sourceType: "module",
|
|
208
208
|
plugins: ["typescript", "jsx"]
|
|
209
209
|
});
|
|
@@ -227,10 +227,10 @@ function z(u, o) {
|
|
|
227
227
|
)
|
|
228
228
|
]), a.id.typeAnnotation = null;
|
|
229
229
|
}
|
|
230
|
-
}),
|
|
230
|
+
}), h(n, { retainLines: !0 }).code;
|
|
231
231
|
}
|
|
232
232
|
function Y(u, o) {
|
|
233
|
-
const n =
|
|
233
|
+
const n = _(u, {
|
|
234
234
|
sourceType: "module",
|
|
235
235
|
plugins: ["typescript", "jsx"]
|
|
236
236
|
});
|
|
@@ -254,10 +254,10 @@ function Y(u, o) {
|
|
|
254
254
|
)
|
|
255
255
|
]), a.id.typeAnnotation = null;
|
|
256
256
|
}
|
|
257
|
-
}),
|
|
257
|
+
}), h(n, { retainLines: !0 }).code;
|
|
258
258
|
}
|
|
259
259
|
function X(u) {
|
|
260
|
-
const o =
|
|
260
|
+
const o = _(u, {
|
|
261
261
|
sourceType: "module",
|
|
262
262
|
plugins: ["typescript", "jsx"]
|
|
263
263
|
});
|
|
@@ -268,14 +268,14 @@ function X(u) {
|
|
|
268
268
|
const t = l.declarations[0];
|
|
269
269
|
!t || !e.isIdentifier(t.id) || t.id.name === "loader" && i.remove();
|
|
270
270
|
}
|
|
271
|
-
}),
|
|
271
|
+
}), h(o, { retainLines: !0 }).code;
|
|
272
272
|
}
|
|
273
273
|
function q(u) {
|
|
274
|
-
const o =
|
|
274
|
+
const o = _(u, {
|
|
275
275
|
sourceType: "module",
|
|
276
276
|
plugins: ["typescript", "jsx"]
|
|
277
277
|
}), n = /* @__PURE__ */ new Set();
|
|
278
|
-
|
|
278
|
+
x(o.program, n);
|
|
279
279
|
let i = !1;
|
|
280
280
|
return m(o, {
|
|
281
281
|
ImportDeclaration(t) {
|
|
@@ -284,10 +284,10 @@ function q(u) {
|
|
|
284
284
|
const s = a.filter((c) => n.has(c.local.name));
|
|
285
285
|
s.length !== a.length && (i = !0, s.length === 0 ? t.remove() : t.node.specifiers = s);
|
|
286
286
|
}
|
|
287
|
-
}), i ?
|
|
287
|
+
}), i ? h(o, { retainLines: !0 }).code : u;
|
|
288
288
|
}
|
|
289
289
|
function K(u) {
|
|
290
|
-
const o =
|
|
290
|
+
const o = _(u, {
|
|
291
291
|
sourceType: "module",
|
|
292
292
|
plugins: ["typescript", "jsx"]
|
|
293
293
|
}), n = [];
|
|
@@ -298,9 +298,9 @@ function K(u) {
|
|
|
298
298
|
}), n.length === 0) return u;
|
|
299
299
|
const i = /* @__PURE__ */ new Set();
|
|
300
300
|
for (const s of n)
|
|
301
|
-
|
|
301
|
+
x(s, i);
|
|
302
302
|
const l = /* @__PURE__ */ new Set();
|
|
303
|
-
|
|
303
|
+
x(o.program, l);
|
|
304
304
|
const t = /* @__PURE__ */ new Set();
|
|
305
305
|
for (const s of i)
|
|
306
306
|
l.has(s) || t.add(s);
|
|
@@ -309,9 +309,9 @@ function K(u) {
|
|
|
309
309
|
const c = s.node.specifiers, r = c.filter((p) => !t.has(p.local.name));
|
|
310
310
|
r.length === 0 ? s.remove() : r.length !== c.length && (s.node.specifiers = r);
|
|
311
311
|
}
|
|
312
|
-
}),
|
|
312
|
+
}), h(o, { retainLines: !0 }).code;
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function x(u, o) {
|
|
315
315
|
const n = (i) => {
|
|
316
316
|
if (!(!i || typeof i != "object")) {
|
|
317
317
|
if (Array.isArray(i)) {
|
|
@@ -354,7 +354,7 @@ function Z(u) {
|
|
|
354
354
|
return null;
|
|
355
355
|
}
|
|
356
356
|
function ee(u) {
|
|
357
|
-
const o =
|
|
357
|
+
const o = _(u, {
|
|
358
358
|
sourceType: "module",
|
|
359
359
|
plugins: ["typescript", "jsx"]
|
|
360
360
|
}), n = [], i = (c) => {
|
|
@@ -378,9 +378,9 @@ function ee(u) {
|
|
|
378
378
|
}), n.length === 0) return u;
|
|
379
379
|
const l = /* @__PURE__ */ new Set();
|
|
380
380
|
for (const c of n)
|
|
381
|
-
|
|
381
|
+
x(c, l);
|
|
382
382
|
const t = /* @__PURE__ */ new Set();
|
|
383
|
-
|
|
383
|
+
x(o.program, t);
|
|
384
384
|
const a = /* @__PURE__ */ new Set();
|
|
385
385
|
for (const c of l)
|
|
386
386
|
t.has(c) || a.add(c);
|
|
@@ -389,10 +389,10 @@ function ee(u) {
|
|
|
389
389
|
const r = c.node.specifiers, p = r.filter((f) => !a.has(f.local.name));
|
|
390
390
|
p.length === 0 ? c.remove() : p.length !== r.length && (c.node.specifiers = p);
|
|
391
391
|
}
|
|
392
|
-
}),
|
|
392
|
+
}), h(o, { retainLines: !0 }).code;
|
|
393
393
|
}
|
|
394
394
|
function A(u) {
|
|
395
|
-
const o =
|
|
395
|
+
const o = _(u, {
|
|
396
396
|
sourceType: "module",
|
|
397
397
|
plugins: ["typescript", "jsx"]
|
|
398
398
|
}), n = /* @__PURE__ */ new Map();
|
|
@@ -408,7 +408,7 @@ function A(u) {
|
|
|
408
408
|
ExportDefaultDeclaration(t) {
|
|
409
409
|
const a = t.node.declaration;
|
|
410
410
|
let s = null;
|
|
411
|
-
e.isArrayExpression(a) ? s = a : (e.isTSSatisfiesExpression(a) || e.isTSAsExpression(a)) && e.isArrayExpression(a.expression) && (s = a.expression), s &&
|
|
411
|
+
e.isArrayExpression(a) ? s = a : (e.isTSSatisfiesExpression(a) || e.isTSAsExpression(a)) && e.isArrayExpression(a.expression) && (s = a.expression), s && C(s.elements, "", i);
|
|
412
412
|
}
|
|
413
413
|
});
|
|
414
414
|
const l = /* @__PURE__ */ new Map();
|
|
@@ -421,7 +421,7 @@ function A(u) {
|
|
|
421
421
|
}
|
|
422
422
|
return l;
|
|
423
423
|
}
|
|
424
|
-
function
|
|
424
|
+
function C(u, o, n) {
|
|
425
425
|
for (const i of u) {
|
|
426
426
|
if (!e.isObjectExpression(i)) continue;
|
|
427
427
|
let l = "", t = o, a = null, s = null;
|
|
@@ -437,10 +437,10 @@ function D(u, o, n) {
|
|
|
437
437
|
path: l
|
|
438
438
|
});
|
|
439
439
|
}
|
|
440
|
-
s &&
|
|
440
|
+
s && C(s.elements, t, n);
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
|
-
const E = "virtual:velo/server-entry", b = "virtual:velo/client-entry",
|
|
443
|
+
const E = "virtual:velo/server-entry", b = "virtual:velo/client-entry", N = "\0" + E, P = "\0" + b;
|
|
444
444
|
function te(u, o) {
|
|
445
445
|
let n = d.resolve(process.cwd(), o);
|
|
446
446
|
const i = u.routesFile ?? "routes.tsx", l = /* @__PURE__ */ new Map();
|
|
@@ -470,11 +470,11 @@ function te(u, o) {
|
|
|
470
470
|
}
|
|
471
471
|
},
|
|
472
472
|
resolveId(t) {
|
|
473
|
-
return t === E || t.endsWith(E) ?
|
|
473
|
+
return t === E || t.endsWith(E) ? N : t === b || t.endsWith(b) || t === "/__velo_client.js" ? P : null;
|
|
474
474
|
},
|
|
475
475
|
load(t) {
|
|
476
476
|
const a = u.routesFile ?? "routes.tsx", s = u.serverInit ?? "server.tsx", c = u.clientInit ?? "client.tsx", r = d.join(n, a).replace(/\.tsx?$/, ".js"), p = d.join(n, s).replace(/\.tsx?$/, ".js"), f = d.join(n, c).replace(/\.tsx?$/, ".js");
|
|
477
|
-
return t ===
|
|
477
|
+
return t === N ? `
|
|
478
478
|
globalThis.__veloBuildHash = __VELO_BUILD_HASH__;
|
|
479
479
|
globalThis.__veloClientJs = __VELO_CLIENT_JS__;
|
|
480
480
|
globalThis.__veloClientCss = __VELO_CLIENT_CSS__;
|
|
@@ -483,8 +483,8 @@ import routes from "${r}";
|
|
|
483
483
|
import { startServer } from "@mauroandre/velojs/server";
|
|
484
484
|
|
|
485
485
|
export { routes };
|
|
486
|
-
export default await startServer({ routes, port: __VELO_CONFIG_PORT__ });
|
|
487
|
-
` : t ===
|
|
486
|
+
export default await startServer({ routes, port: __VELO_CONFIG_PORT__, hostname: __VELO_CONFIG_HOSTNAME__ });
|
|
487
|
+
` : t === P ? `
|
|
488
488
|
import "${f}";
|
|
489
489
|
import routes from "${r}";
|
|
490
490
|
import { startClient } from "@mauroandre/velojs/client";
|
|
@@ -498,18 +498,18 @@ startClient({ routes });
|
|
|
498
498
|
let r = t, p = !1;
|
|
499
499
|
const f = /middlewares:\s*\[/.test(t), y = /export\s+(const|function)\s+Component/.test(
|
|
500
500
|
t
|
|
501
|
-
),
|
|
502
|
-
if (!c && f && (r = K(r), p = !0), !c &&
|
|
503
|
-
const
|
|
504
|
-
r =
|
|
501
|
+
), v = /export\s+(const|function)\s+loader/.test(t), D = /export\s+const\s+action_\w+/.test(t), I = /export\s+const\s+stream_\w+/.test(t), T = /export\s+const\s+socket_\w+/.test(t), w = /\bLoader\s*</.test(t) || /\bLoader\s*\(/.test(t), F = /\buseLoader\s*</.test(t) || /\buseLoader\s*\(/.test(t), k = /\bhandler\s*:/.test(t), V = d.join(n, i);
|
|
502
|
+
if (!c && f && (r = K(r), p = !0), !c && k && a === V && (r = ee(r), p = !0), y || v || D || I || T || w || F) {
|
|
503
|
+
const S = d.relative(n, a).replace(/\.(tsx?|jsx?)$/, "").replace(/\\/g, "/"), O = l.get(S);
|
|
504
|
+
r = W(r, S, O?.fullPath, O?.path), r = M(r, S), c || (r = B(
|
|
505
505
|
r,
|
|
506
|
-
|
|
506
|
+
S
|
|
507
507
|
)), !c && I && (r = z(
|
|
508
508
|
r,
|
|
509
|
-
|
|
509
|
+
S
|
|
510
510
|
)), !c && T && (r = Y(
|
|
511
511
|
r,
|
|
512
|
-
|
|
512
|
+
S
|
|
513
513
|
)), c || (r = X(r)), c || (r = q(r)), p = !0;
|
|
514
514
|
}
|
|
515
515
|
return p ? {
|
|
@@ -541,7 +541,9 @@ function re(u) {
|
|
|
541
541
|
__VELO_CLIENT_CSS__: JSON.stringify(c),
|
|
542
542
|
// Baked into the server bundle as startServer's port fallback.
|
|
543
543
|
// null when unset → startServer falls back to PORT env / 3000.
|
|
544
|
-
__VELO_CONFIG_PORT__: JSON.stringify(u.port ?? null)
|
|
544
|
+
__VELO_CONFIG_PORT__: JSON.stringify(u.port ?? null),
|
|
545
|
+
// Same for the bind interface: null → HOST env / Node default.
|
|
546
|
+
__VELO_CONFIG_HOSTNAME__: JSON.stringify(u.hostname ?? null)
|
|
545
547
|
},
|
|
546
548
|
resolve: {
|
|
547
549
|
alias: {
|
|
@@ -599,7 +601,7 @@ function ie(u, o) {
|
|
|
599
601
|
if (!n) return;
|
|
600
602
|
const s = d.resolve(n, o);
|
|
601
603
|
if (!g.existsSync(s)) return;
|
|
602
|
-
const c =
|
|
604
|
+
const c = U(s), r = d.join(n, ".velojs");
|
|
603
605
|
g.mkdirSync(r, { recursive: !0 }), g.writeFileSync(
|
|
604
606
|
d.join(r, "graph.json"),
|
|
605
607
|
JSON.stringify(c)
|
|
@@ -624,7 +626,7 @@ function ie(u, o) {
|
|
|
624
626
|
}
|
|
625
627
|
function se(u) {
|
|
626
628
|
return [
|
|
627
|
-
...
|
|
629
|
+
...J.exclude,
|
|
628
630
|
/.*\.mjs$/,
|
|
629
631
|
...u.devServerExclude ?? []
|
|
630
632
|
];
|
|
@@ -654,15 +656,15 @@ function oe() {
|
|
|
654
656
|
}
|
|
655
657
|
export {
|
|
656
658
|
A as buildFullPathMap,
|
|
657
|
-
|
|
659
|
+
C as collectFullPaths,
|
|
658
660
|
se as devServerExcludeFor,
|
|
659
|
-
|
|
661
|
+
W as injectMetadata,
|
|
660
662
|
q as pruneClientOnlyImports,
|
|
661
663
|
ee as removeEndpointRoutes,
|
|
662
664
|
X as removeLoaders,
|
|
663
665
|
K as removeMiddlewares,
|
|
664
|
-
|
|
665
|
-
|
|
666
|
+
B as transformActionsForClient,
|
|
667
|
+
M as transformLoaderFunctions,
|
|
666
668
|
Y as transformSocketsForClient,
|
|
667
669
|
z as transformStreamsForClient,
|
|
668
670
|
ye as veloPlugin
|