@mauroandre/velojs 0.0.49 → 0.0.50

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.
@@ -7,17 +7,36 @@ description: "The `veloPlugin` build pipeline: the 9 AST transforms that inject
7
7
 
8
8
  The `veloPlugin()` is the core of VeloJS. It's a single function that returns 6 Vite plugins working together to handle routing, SSR, code transforms, and more.
9
9
 
10
- ## The 6 plugins
10
+ ## The 7 plugins
11
11
 
12
12
  | Plugin | What it does |
13
13
  |--------|-------------|
14
14
  | `velo:config` | Sets up build config for client/server modes, Preact aliases, and environment defines |
15
15
  | `velo:transform` | Performs AST transforms on your code (the most important plugin) |
16
16
  | `velo:static-url` | Rewrites CSS `url(/path)` to use `STATIC_BASE_URL` in production builds |
17
+ | `velo:graph` | Generates `.velojs/graph.json` (route tree + dependency graph) on build and dev |
17
18
  | `@preact/preset-vite` | Adds Preact JSX support |
18
19
  | `@hono/vite-dev-server` | Runs the SSR dev server |
19
20
  | `velo:ws-bridge` | Exposes Vite's HTTP server for WebSocket handlers during development |
20
21
 
22
+ ## Dev server: what is served × intercepted
23
+
24
+ During `velojs dev`, every request that is **not** excluded falls through to the SSR app — if no route matches, it gets the app's 404/fallback HTML. Excluded (delegated to Vite, which serves and transforms them as modules): `.js`, `.mjs`, `.ts`, `.tsx`, `.jsx`, `.css`, `.md`, `.svelte`, `.vue`, `/@vite/*`, `/node_modules/*`, `/static/*`, and `?t=` cache-busted requests.
25
+
26
+ Project `.mjs` files are covered — relevant for build-time generators (Panda CSS, vanilla-extract) that emit ESM artifacts such as `styled-system/`.
27
+
28
+ Need more patterns? Declare them in the plugin config — they are **composed with** the defaults, not a replacement:
29
+
30
+ ```typescript
31
+ export default defineConfig({
32
+ plugins: [
33
+ veloPlugin({
34
+ devServerExclude: ["/generated/**"],
35
+ }),
36
+ ],
37
+ });
38
+ ```
39
+
21
40
  ## AST Transformations
22
41
 
23
42
  The `velo:transform` plugin uses Babel to modify your code at build time. It applies 9 transformations to `.ts`/`.tsx` files inside your `appDirectory` (a file elsewhere, or a `.js`/`.jsx` one, is not transformed at all):
package/dist/config.d.ts CHANGED
@@ -25,5 +25,12 @@ export interface VeloConfig {
25
25
  * @default 3000
26
26
  */
27
27
  port?: number;
28
+ /**
29
+ * Padrões adicionais de URL que o dev server deve delegar ao Vite em vez
30
+ * de interceptar como página (ex.: artefatos de geradores build-time como
31
+ * Panda CSS — "/styled-system/**"). Compostos com os defaults do
32
+ * @hono/vite-dev-server, não os substituem.
33
+ */
34
+ devServerExclude?: (string | RegExp)[];
28
35
  }
29
36
  export declare function defineConfig(config: VeloConfig): VeloConfig;
package/dist/vite.d.ts CHANGED
@@ -66,4 +66,14 @@ export declare function buildFullPathMap(code: string): Map<string, PathInfo>;
66
66
  * Percorre recursivamente a árvore de rotas e coleta moduleName → { fullPath, path }
67
67
  */
68
68
  export declare function collectFullPaths(elements: (t.Expression | t.SpreadElement | null)[], parentPath: string, result: Map<string, PathInfo>): void;
69
+ /**
70
+ * @hono/vite-dev-server treats `exclude` as all-or-nothing: passing one
71
+ * replaces the defaults entirely. We compose instead — the upstream defaults
72
+ * (imported, so they track the installed version) plus `.mjs`, which upstream
73
+ * misses: build-time generators (Panda CSS, vanilla-extract) emit ESM
74
+ * artifacts inside the project, and a project `.mjs` that falls through to
75
+ * the SSR app comes back as fallback HTML/404 — the browser's ESM import
76
+ * dies silently.
77
+ */
78
+ export declare function devServerExcludeFor(veloConfig: VeloConfig): (string | RegExp)[];
69
79
  export declare function veloPlugin(config?: VeloConfig): PluginOption[];
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 $ from "@hono/vite-dev-server";
4
+ import $, { defaultOptions as U } from "@hono/vite-dev-server";
5
5
  import { parse as h } 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 U } from "./graph.js";
10
- const m = typeof j == "function" ? j : j.default, _ = typeof L == "function" ? L : L.default;
11
- function W(p, o, n, i) {
12
- const l = h(p, {
9
+ import { buildGraph as W } from "./graph.js";
10
+ const m = typeof j == "function" ? j : j.default, v = typeof L == "function" ? L : L.default;
11
+ function J(u, o, n, i) {
12
+ const l = h(u, {
13
13
  sourceType: "module",
14
14
  plugins: ["typescript", "jsx"]
15
15
  });
@@ -22,7 +22,7 @@ function W(p, 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((v) => e.isObjectProperty(v) && e.isIdentifier(v.key) ? v.key.name !== "moduleId" && v.key.name !== "fullPath" && v.key.name !== "path" : !0), y = [
25
+ const f = r.init.properties.filter((_) => e.isObjectProperty(_) && e.isIdentifier(_.key) ? _.key.name !== "moduleId" && _.key.name !== "fullPath" && _.key.name !== "path" : !0), y = [
26
26
  e.objectProperty(
27
27
  e.identifier("moduleId"),
28
28
  e.stringLiteral(o)
@@ -70,10 +70,10 @@ function W(p, o, n, i) {
70
70
  );
71
71
  l.program.body.unshift(c);
72
72
  }
73
- return _(l, { retainLines: !0 }).code;
73
+ return v(l, { retainLines: !0 }).code;
74
74
  }
75
- function J(p, o) {
76
- const n = h(p, {
75
+ function B(u, o) {
76
+ const n = h(u, {
77
77
  sourceType: "module",
78
78
  plugins: ["typescript", "jsx"]
79
79
  });
@@ -81,13 +81,13 @@ function J(p, o) {
81
81
  CallExpression(l) {
82
82
  const t = l.node.callee, a = e.isIdentifier(t, { name: "Loader" }) || e.isTSInstantiationExpression(t) && e.isIdentifier(t.expression, { name: "Loader" }), s = e.isIdentifier(t, { name: "useLoader" }) || e.isTSInstantiationExpression(t) && e.isIdentifier(t.expression, { name: "useLoader" });
83
83
  if (!a && !s) return;
84
- const c = l.node.arguments, r = e.stringLiteral(o), u = c[0];
85
- e.isStringLiteral(u) && u.value.includes("/") || (l.node.arguments = [r, ...c]);
84
+ const c = l.node.arguments, r = e.stringLiteral(o), p = c[0];
85
+ e.isStringLiteral(p) && p.value.includes("/") || (l.node.arguments = [r, ...c]);
86
86
  }
87
- }), _(n, { retainLines: !0 }).code;
87
+ }), v(n, { retainLines: !0 }).code;
88
88
  }
89
- function B(p, o) {
90
- const n = h(p, {
89
+ function M(u, o) {
90
+ const n = h(u, {
91
91
  sourceType: "module",
92
92
  plugins: ["typescript", "jsx"]
93
93
  });
@@ -101,13 +101,13 @@ function B(p, o) {
101
101
  if (!s.startsWith("action_")) return;
102
102
  const c = s.replace("action_", ""), r = a.init;
103
103
  if (!e.isArrowFunctionExpression(r) || !r.async) return;
104
- const u = r.params, f = M(o, c, u);
105
- r.body = e.blockStatement([e.returnStatement(f)]), H(r, u);
104
+ const p = r.params, f = H(o, c, p);
105
+ r.body = e.blockStatement([e.returnStatement(f)]), G(r, p);
106
106
  }
107
- }), _(n, { retainLines: !0 }).code;
107
+ }), v(n, { retainLines: !0 }).code;
108
108
  }
109
- function M(p, o, n) {
110
- const i = `/_action/${p}/${o}`;
109
+ function H(u, o, n) {
110
+ const i = `/_action/${u}/${o}`;
111
111
  return n.length === 0 ? e.callExpression(
112
112
  e.memberExpression(
113
113
  e.callExpression(e.identifier("fetch"), [
@@ -176,7 +176,7 @@ function M(p, o, n) {
176
176
  ]
177
177
  );
178
178
  }
179
- function H(p, o) {
179
+ function G(u, o) {
180
180
  if (o.length === 0) return;
181
181
  const n = o[0];
182
182
  if (e.isObjectPattern(n)) {
@@ -199,11 +199,11 @@ function H(p, o) {
199
199
  e.tsTypeAnnotation(i)
200
200
  )
201
201
  ])
202
- )), p.params = [t];
202
+ )), u.params = [t];
203
203
  }
204
204
  }
205
- function G(p, o) {
206
- const n = h(p, {
205
+ function z(u, o) {
206
+ const n = h(u, {
207
207
  sourceType: "module",
208
208
  plugins: ["typescript", "jsx"]
209
209
  });
@@ -227,10 +227,10 @@ function G(p, o) {
227
227
  )
228
228
  ]), a.id.typeAnnotation = null;
229
229
  }
230
- }), _(n, { retainLines: !0 }).code;
230
+ }), v(n, { retainLines: !0 }).code;
231
231
  }
232
- function z(p, o) {
233
- const n = h(p, {
232
+ function Y(u, o) {
233
+ const n = h(u, {
234
234
  sourceType: "module",
235
235
  plugins: ["typescript", "jsx"]
236
236
  });
@@ -254,10 +254,10 @@ function z(p, o) {
254
254
  )
255
255
  ]), a.id.typeAnnotation = null;
256
256
  }
257
- }), _(n, { retainLines: !0 }).code;
257
+ }), v(n, { retainLines: !0 }).code;
258
258
  }
259
- function Y(p) {
260
- const o = h(p, {
259
+ function X(u) {
260
+ const o = h(u, {
261
261
  sourceType: "module",
262
262
  plugins: ["typescript", "jsx"]
263
263
  });
@@ -268,14 +268,14 @@ function Y(p) {
268
268
  const t = l.declarations[0];
269
269
  !t || !e.isIdentifier(t.id) || t.id.name === "loader" && i.remove();
270
270
  }
271
- }), _(o, { retainLines: !0 }).code;
271
+ }), v(o, { retainLines: !0 }).code;
272
272
  }
273
- function X(p) {
274
- const o = h(p, {
273
+ function q(u) {
274
+ const o = h(u, {
275
275
  sourceType: "module",
276
276
  plugins: ["typescript", "jsx"]
277
277
  }), n = /* @__PURE__ */ new Set();
278
- x(o.program, n);
278
+ S(o.program, n);
279
279
  let i = !1;
280
280
  return m(o, {
281
281
  ImportDeclaration(t) {
@@ -284,10 +284,10 @@ function X(p) {
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 ? _(o, { retainLines: !0 }).code : p;
287
+ }), i ? v(o, { retainLines: !0 }).code : u;
288
288
  }
289
- function q(p) {
290
- const o = h(p, {
289
+ function K(u) {
290
+ const o = h(u, {
291
291
  sourceType: "module",
292
292
  plugins: ["typescript", "jsx"]
293
293
  }), n = [];
@@ -295,23 +295,23 @@ function q(p) {
295
295
  ObjectProperty(s) {
296
296
  e.isIdentifier(s.node.key, { name: "middlewares" }) && (n.push(s.node.value), s.remove());
297
297
  }
298
- }), n.length === 0) return p;
298
+ }), n.length === 0) return u;
299
299
  const i = /* @__PURE__ */ new Set();
300
300
  for (const s of n)
301
- x(s, i);
301
+ S(s, i);
302
302
  const l = /* @__PURE__ */ new Set();
303
- x(o.program, l);
303
+ S(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);
307
307
  return t.size > 0 && m(o, {
308
308
  ImportDeclaration(s) {
309
- const c = s.node.specifiers, r = c.filter((u) => !t.has(u.local.name));
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
- }), _(o, { retainLines: !0 }).code;
312
+ }), v(o, { retainLines: !0 }).code;
313
313
  }
314
- function x(p, o) {
314
+ function S(u, o) {
315
315
  const n = (i) => {
316
316
  if (!(!i || typeof i != "object")) {
317
317
  if (Array.isArray(i)) {
@@ -339,60 +339,60 @@ function x(p, o) {
339
339
  l === "loc" || l === "start" || l === "end" || l === "leadingComments" || l === "trailingComments" || l === "innerComments" || n(i[l]);
340
340
  }
341
341
  };
342
- n(p);
342
+ n(u);
343
343
  }
344
- function K(p) {
345
- for (const o of p.properties)
344
+ function Q(u) {
345
+ for (const o of u.properties)
346
346
  if (e.isObjectProperty(o) && e.isIdentifier(o.key) && o.key.name === "handler")
347
347
  return !0;
348
348
  return !1;
349
349
  }
350
- function Q(p) {
351
- for (const o of p.properties)
350
+ function Z(u) {
351
+ for (const o of u.properties)
352
352
  if (e.isObjectProperty(o) && e.isIdentifier(o.key) && o.key.name === "children" && e.isArrayExpression(o.value))
353
353
  return o.value;
354
354
  return null;
355
355
  }
356
- function Z(p) {
357
- const o = h(p, {
356
+ function ee(u) {
357
+ const o = h(u, {
358
358
  sourceType: "module",
359
359
  plugins: ["typescript", "jsx"]
360
360
  }), n = [], i = (c) => {
361
361
  for (let r = c.elements.length - 1; r >= 0; r--) {
362
- const u = c.elements[r];
363
- if (!e.isObjectExpression(u)) continue;
364
- if (K(u)) {
365
- n.push(u), c.elements.splice(r, 1);
362
+ const p = c.elements[r];
363
+ if (!e.isObjectExpression(p)) continue;
364
+ if (Q(p)) {
365
+ n.push(p), c.elements.splice(r, 1);
366
366
  continue;
367
367
  }
368
- const f = Q(u);
368
+ const f = Z(p);
369
369
  f && i(f);
370
370
  }
371
371
  };
372
372
  if (m(o, {
373
373
  ExportDefaultDeclaration(c) {
374
374
  const r = c.node.declaration;
375
- let u = null;
376
- e.isArrayExpression(r) ? u = r : (e.isTSSatisfiesExpression(r) && e.isArrayExpression(r.expression) || e.isTSAsExpression(r) && e.isArrayExpression(r.expression)) && (u = r.expression), u && i(u);
375
+ let p = null;
376
+ e.isArrayExpression(r) ? p = r : (e.isTSSatisfiesExpression(r) && e.isArrayExpression(r.expression) || e.isTSAsExpression(r) && e.isArrayExpression(r.expression)) && (p = r.expression), p && i(p);
377
377
  }
378
- }), n.length === 0) return p;
378
+ }), n.length === 0) return u;
379
379
  const l = /* @__PURE__ */ new Set();
380
380
  for (const c of n)
381
- x(c, l);
381
+ S(c, l);
382
382
  const t = /* @__PURE__ */ new Set();
383
- x(o.program, t);
383
+ S(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);
387
387
  return a.size > 0 && m(o, {
388
388
  ImportDeclaration(c) {
389
- const r = c.node.specifiers, u = r.filter((f) => !a.has(f.local.name));
390
- u.length === 0 ? c.remove() : u.length !== r.length && (c.node.specifiers = u);
389
+ const r = c.node.specifiers, p = r.filter((f) => !a.has(f.local.name));
390
+ p.length === 0 ? c.remove() : p.length !== r.length && (c.node.specifiers = p);
391
391
  }
392
- }), _(o, { retainLines: !0 }).code;
392
+ }), v(o, { retainLines: !0 }).code;
393
393
  }
394
- function A(p) {
395
- const o = h(p, {
394
+ function A(u) {
395
+ const o = h(u, {
396
396
  sourceType: "module",
397
397
  plugins: ["typescript", "jsx"]
398
398
  }), n = /* @__PURE__ */ new Map();
@@ -421,14 +421,14 @@ function A(p) {
421
421
  }
422
422
  return l;
423
423
  }
424
- function D(p, o, n) {
425
- for (const i of p) {
424
+ function D(u, o, n) {
425
+ for (const i of u) {
426
426
  if (!e.isObjectExpression(i)) continue;
427
427
  let l = "", t = o, a = null, s = null;
428
428
  for (const c of i.properties) {
429
429
  if (!e.isObjectProperty(c)) continue;
430
- const r = c.key, u = e.isIdentifier(r) ? r.name : null;
431
- u === "path" && e.isStringLiteral(c.value) && (l = c.value.value, l && !l.startsWith("/") ? t = o + "/" + l : t = o + l), u === "module" && e.isIdentifier(c.value) && (a = c.value.name), u === "children" && e.isArrayExpression(c.value) && (s = c.value);
430
+ const r = c.key, p = e.isIdentifier(r) ? r.name : null;
431
+ p === "path" && e.isStringLiteral(c.value) && (l = c.value.value, l && !l.startsWith("/") ? t = o + "/" + l : t = o + l), p === "module" && e.isIdentifier(c.value) && (a = c.value.name), p === "children" && e.isArrayExpression(c.value) && (s = c.value);
432
432
  }
433
433
  if (a) {
434
434
  const r = !s && l === "/" ? o || "/" : t;
@@ -440,10 +440,10 @@ function D(p, o, n) {
440
440
  s && D(s.elements, t, n);
441
441
  }
442
442
  }
443
- const b = "virtual:velo/server-entry", E = "virtual:velo/client-entry", P = "\0" + b, N = "\0" + E;
444
- function ee(p, o) {
443
+ const E = "virtual:velo/server-entry", b = "virtual:velo/client-entry", P = "\0" + E, N = "\0" + b;
444
+ function te(u, o) {
445
445
  let n = d.resolve(process.cwd(), o);
446
- const i = p.routesFile ?? "routes.tsx", l = /* @__PURE__ */ new Map();
446
+ const i = u.routesFile ?? "routes.tsx", l = /* @__PURE__ */ new Map();
447
447
  return {
448
448
  name: "velo:transform",
449
449
  enforce: "pre",
@@ -464,21 +464,21 @@ function ee(p, o) {
464
464
  if (t === s) {
465
465
  const c = g.readFileSync(s, "utf-8"), r = A(c);
466
466
  l.clear();
467
- for (const [u, f] of r)
468
- l.set(u, f);
467
+ for (const [p, f] of r)
468
+ l.set(p, f);
469
469
  return a.ws.send({ type: "full-reload" }), [];
470
470
  }
471
471
  },
472
472
  resolveId(t) {
473
- return t === b || t.endsWith(b) ? P : t === E || t.endsWith(E) || t === "/__velo_client.js" ? N : null;
473
+ return t === E || t.endsWith(E) ? P : t === b || t.endsWith(b) || t === "/__velo_client.js" ? N : null;
474
474
  },
475
475
  load(t) {
476
- const a = p.routesFile ?? "routes.tsx", s = p.serverInit ?? "server.tsx", c = p.clientInit ?? "client.tsx", r = d.join(n, a).replace(/\.tsx?$/, ".js"), u = d.join(n, s).replace(/\.tsx?$/, ".js"), f = d.join(n, c).replace(/\.tsx?$/, ".js");
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
477
  return t === P ? `
478
478
  globalThis.__veloBuildHash = __VELO_BUILD_HASH__;
479
479
  globalThis.__veloClientJs = __VELO_CLIENT_JS__;
480
480
  globalThis.__veloClientCss = __VELO_CLIENT_CSS__;
481
- import "${u}";
481
+ import "${p}";
482
482
  import routes from "${r}";
483
483
  import { startServer } from "@mauroandre/velojs/server";
484
484
 
@@ -495,39 +495,39 @@ startClient({ routes });
495
495
  transform(t, a, s) {
496
496
  const c = s?.ssr === !0;
497
497
  if (a.startsWith("\0") || a.includes("/.velojs/") || !a.endsWith(".tsx") && !a.endsWith(".ts") || !a.startsWith(n)) return null;
498
- let r = t, u = !1;
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
- ), v = /export\s+(const|function)\s+loader/.test(t), C = /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), k = /\buseLoader\s*</.test(t) || /\buseLoader\s*\(/.test(t), F = /\bhandler\s*:/.test(t), V = d.join(n, i);
502
- if (!c && f && (r = q(r), u = !0), !c && F && a === V && (r = Z(r), u = !0), y || v || C || I || T || w || k) {
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 = J(r, S), c || (r = B(
501
+ ), _ = /export\s+(const|function)\s+loader/.test(t), C = /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), k = /\buseLoader\s*</.test(t) || /\buseLoader\s*\(/.test(t), F = /\bhandler\s*:/.test(t), V = d.join(n, i);
502
+ if (!c && f && (r = K(r), p = !0), !c && F && a === V && (r = ee(r), p = !0), y || _ || C || I || T || w || k) {
503
+ const x = d.relative(n, a).replace(/\.(tsx?|jsx?)$/, "").replace(/\\/g, "/"), O = l.get(x);
504
+ r = J(r, x, O?.fullPath, O?.path), r = B(r, x), c || (r = M(
505
505
  r,
506
- S
507
- )), !c && I && (r = G(
506
+ x
507
+ )), !c && I && (r = z(
508
508
  r,
509
- S
510
- )), !c && T && (r = z(
509
+ x
510
+ )), !c && T && (r = Y(
511
511
  r,
512
- S
513
- )), c || (r = Y(r)), c || (r = X(r)), u = !0;
512
+ x
513
+ )), c || (r = X(r)), c || (r = q(r)), p = !0;
514
514
  }
515
- return u ? {
515
+ return p ? {
516
516
  code: r,
517
517
  map: null
518
518
  } : null;
519
519
  }
520
520
  };
521
521
  }
522
- function te(p) {
522
+ function re(u) {
523
523
  return {
524
524
  name: "velo:config",
525
525
  config(o, { mode: n }) {
526
- const i = n === "server", l = n === "development", t = !!process.env.VELO_STATIC, a = o.server?.port ?? (Number(process.env.PORT) || p.port || 3e3);
526
+ const i = n === "server", l = n === "development", t = !!process.env.VELO_STATIC, a = o.server?.port ?? (Number(process.env.PORT) || u.port || 3e3);
527
527
  let s = "client.js", c = "client.css";
528
528
  if (i)
529
529
  try {
530
- const u = d.resolve(process.cwd(), "dist/client/.vite/manifest.json"), y = JSON.parse(g.readFileSync(u, "utf-8"))[E];
530
+ const p = d.resolve(process.cwd(), "dist/client/.vite/manifest.json"), y = JSON.parse(g.readFileSync(p, "utf-8"))[b];
531
531
  y && (s = y.file || s, y.css?.[0] && (c = y.css[0]));
532
532
  } catch {
533
533
  }
@@ -541,7 +541,7 @@ function te(p) {
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(p.port ?? null)
544
+ __VELO_CONFIG_PORT__: JSON.stringify(u.port ?? null)
545
545
  },
546
546
  resolve: {
547
547
  alias: {
@@ -554,7 +554,7 @@ function te(p) {
554
554
  }
555
555
  };
556
556
  return i ? r.build = {
557
- ssr: b,
557
+ ssr: E,
558
558
  outDir: "dist",
559
559
  emptyOutDir: !1,
560
560
  copyPublicDir: !1,
@@ -567,22 +567,22 @@ function te(p) {
567
567
  manifest: !0,
568
568
  outDir: "dist/client",
569
569
  rollupOptions: {
570
- input: E,
570
+ input: b,
571
571
  output: {
572
572
  entryFileNames: "client.[hash].js",
573
- assetFileNames: (u) => u.names?.[0]?.endsWith(".css") ? "client.[hash].css" : "[name].[hash][extname]"
573
+ assetFileNames: (p) => p.names?.[0]?.endsWith(".css") ? "client.[hash].css" : "[name].[hash][extname]"
574
574
  }
575
575
  }
576
576
  }), r;
577
577
  }
578
578
  };
579
579
  }
580
- function re() {
580
+ function ne() {
581
581
  return {
582
582
  name: "velo:static-url",
583
583
  apply: "build",
584
584
  enforce: "post",
585
- generateBundle(p, o) {
585
+ generateBundle(u, o) {
586
586
  const n = process.env.STATIC_BASE_URL || "";
587
587
  if (n)
588
588
  for (const i of Object.values(o))
@@ -593,13 +593,13 @@ function re() {
593
593
  }
594
594
  };
595
595
  }
596
- function ne(p, o) {
596
+ function ie(u, o) {
597
597
  let n = "", i = "", l = !1, t = null;
598
598
  function a() {
599
599
  if (!n) return;
600
600
  const s = d.resolve(n, o);
601
601
  if (!g.existsSync(s)) return;
602
- const c = U(s), r = d.join(n, ".velojs");
602
+ const c = W(s), r = d.join(n, ".velojs");
603
603
  g.mkdirSync(r, { recursive: !0 }), g.writeFileSync(
604
604
  d.join(r, "graph.json"),
605
605
  JSON.stringify(c)
@@ -616,45 +616,54 @@ function ne(p, o) {
616
616
  configureServer(s) {
617
617
  a(), l = !0;
618
618
  const c = d.resolve(n, o);
619
- s.watcher.on("all", (r, u) => {
620
- l && u.startsWith(c) && (t && clearTimeout(t), t = setTimeout(() => a(), 500));
619
+ s.watcher.on("all", (r, p) => {
620
+ l && p.startsWith(c) && (t && clearTimeout(t), t = setTimeout(() => a(), 500));
621
621
  });
622
622
  }
623
623
  };
624
624
  }
625
- function de(p) {
626
- const o = p ?? {}, n = o.appDirectory ?? "./app";
625
+ function se(u) {
627
626
  return [
628
- te(o),
629
- ee(o, n),
630
- re(),
631
- ne(o, n),
627
+ ...U.exclude,
628
+ /.*\.mjs$/,
629
+ ...u.devServerExclude ?? []
630
+ ];
631
+ }
632
+ function ye(u) {
633
+ const o = u ?? {}, n = o.appDirectory ?? "./app";
634
+ return [
635
+ re(o),
636
+ te(o, n),
637
+ ne(),
638
+ ie(o, n),
632
639
  R(),
633
640
  $({
634
- entry: b
641
+ entry: E,
642
+ exclude: se(o)
635
643
  }),
636
- ie()
644
+ oe()
637
645
  ];
638
646
  }
639
- function ie() {
647
+ function oe() {
640
648
  return {
641
649
  name: "velo:ws-bridge",
642
- configureServer(p) {
643
- globalThis.__veloDevServer = p.httpServer;
650
+ configureServer(u) {
651
+ globalThis.__veloDevServer = u.httpServer;
644
652
  }
645
653
  };
646
654
  }
647
655
  export {
648
656
  A as buildFullPathMap,
649
657
  D as collectFullPaths,
650
- W as injectMetadata,
651
- X as pruneClientOnlyImports,
652
- Z as removeEndpointRoutes,
653
- Y as removeLoaders,
654
- q as removeMiddlewares,
655
- B as transformActionsForClient,
656
- J as transformLoaderFunctions,
657
- z as transformSocketsForClient,
658
- G as transformStreamsForClient,
659
- de as veloPlugin
658
+ se as devServerExcludeFor,
659
+ J as injectMetadata,
660
+ q as pruneClientOnlyImports,
661
+ ee as removeEndpointRoutes,
662
+ X as removeLoaders,
663
+ K as removeMiddlewares,
664
+ M as transformActionsForClient,
665
+ B as transformLoaderFunctions,
666
+ Y as transformSocketsForClient,
667
+ z as transformStreamsForClient,
668
+ ye as veloPlugin
660
669
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mauroandre/velojs",
3
- "version": "0.0.49",
3
+ "version": "0.0.50",
4
4
  "type": "module",
5
5
  "description": "Fullstack web framework built on Hono + Preact with Vite-powered AST transforms",
6
6
  "keywords": [