@voltx/server 0.4.4 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +11 -9
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +11 -9
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -313,26 +313,26 @@ function createViteDevConfig(options = {}) {
|
|
|
313
313
|
// src/vite-plugin.ts
|
|
314
314
|
function voltxRouter(options = {}) {
|
|
315
315
|
const pagesDir = options.pagesDir ?? "src/pages";
|
|
316
|
-
const
|
|
317
|
-
const
|
|
316
|
+
const PUBLIC_ID = "voltx/router";
|
|
317
|
+
const LEGACY_ID = "virtual:voltx-routes";
|
|
318
|
+
const RESOLVED_ID = "\0voltx/router";
|
|
318
319
|
return {
|
|
319
320
|
name: "voltx-router",
|
|
320
321
|
enforce: "pre",
|
|
321
322
|
config() {
|
|
322
323
|
return {
|
|
323
324
|
ssr: {
|
|
324
|
-
// react-router ships CJS — force Vite to bundle its .mjs for SSR
|
|
325
325
|
noExternal: ["react-router"]
|
|
326
326
|
}
|
|
327
327
|
};
|
|
328
328
|
},
|
|
329
329
|
resolveId(id) {
|
|
330
|
-
if (id ===
|
|
331
|
-
return
|
|
330
|
+
if (id === PUBLIC_ID || id === LEGACY_ID) {
|
|
331
|
+
return RESOLVED_ID;
|
|
332
332
|
}
|
|
333
333
|
},
|
|
334
334
|
load(id) {
|
|
335
|
-
if (id ===
|
|
335
|
+
if (id === RESOLVED_ID) {
|
|
336
336
|
return `
|
|
337
337
|
import { createElement } from "react";
|
|
338
338
|
import { Routes, Route } from "react-router";
|
|
@@ -374,13 +374,15 @@ export function VoltxRoutes() {
|
|
|
374
374
|
}
|
|
375
375
|
|
|
376
376
|
export { routes };
|
|
377
|
+
|
|
378
|
+
// Navigation primitives \u2014 single import source
|
|
379
|
+
export { Link, NavLink, useNavigate, useParams, useLocation, useSearchParams } from "react-router";
|
|
377
380
|
`;
|
|
378
381
|
}
|
|
379
382
|
},
|
|
380
|
-
// HMR: when a file in src/pages/ is added/removed, invalidate the virtual module
|
|
381
383
|
handleHotUpdate({ file, server }) {
|
|
382
384
|
if (file.includes(pagesDir.replace(/\//g, "/"))) {
|
|
383
|
-
const mod = server.moduleGraph.getModuleById(
|
|
385
|
+
const mod = server.moduleGraph.getModuleById(RESOLVED_ID);
|
|
384
386
|
if (mod) {
|
|
385
387
|
server.moduleGraph.invalidateModule(mod);
|
|
386
388
|
server.ws.send({ type: "full-reload" });
|
|
@@ -530,7 +532,7 @@ ${cssLinks}
|
|
|
530
532
|
}
|
|
531
533
|
|
|
532
534
|
// src/index.ts
|
|
533
|
-
var VERSION = "0.4.
|
|
535
|
+
var VERSION = "0.4.5";
|
|
534
536
|
// Annotate the CommonJS export names for ESM import in node:
|
|
535
537
|
0 && (module.exports = {
|
|
536
538
|
Hono,
|
package/dist/index.d.cts
CHANGED
|
@@ -187,6 +187,9 @@ interface VoltxRouterOptions {
|
|
|
187
187
|
* Scans `src/pages/` and generates a virtual module that maps
|
|
188
188
|
* file paths to routes — just like Next.js.
|
|
189
189
|
*
|
|
190
|
+
* Usage:
|
|
191
|
+
* import { Link, VoltxRoutes, useNavigate } from "voltx/router";
|
|
192
|
+
*
|
|
190
193
|
* Convention:
|
|
191
194
|
* src/pages/index.tsx → /
|
|
192
195
|
* src/pages/about.tsx → /about
|
|
@@ -242,6 +245,6 @@ interface ViteDevServer {
|
|
|
242
245
|
*/
|
|
243
246
|
declare function registerSSR(app: Hono, vite: ViteDevServer | null, options?: SSROptions): void;
|
|
244
247
|
|
|
245
|
-
declare const VERSION = "0.4.
|
|
248
|
+
declare const VERSION = "0.4.5";
|
|
246
249
|
|
|
247
250
|
export { type CorsConfig, type HttpMethod, type MiddlewareHandler, type RouteEntry, type RouteHandler, type RouteModule, type SSROptions, type ServerConfig, type ServerInfo, VERSION, type ViteDevOptions, type VoltxRouterOptions, type VoltxServer, createCorsMiddleware, createErrorHandler, createLoggerMiddleware, createServer, createViteDevConfig, filePathToUrlPath, registerSSR, registerStaticFiles, scanAndRegisterRoutes, voltxRouter };
|
package/dist/index.d.ts
CHANGED
|
@@ -187,6 +187,9 @@ interface VoltxRouterOptions {
|
|
|
187
187
|
* Scans `src/pages/` and generates a virtual module that maps
|
|
188
188
|
* file paths to routes — just like Next.js.
|
|
189
189
|
*
|
|
190
|
+
* Usage:
|
|
191
|
+
* import { Link, VoltxRoutes, useNavigate } from "voltx/router";
|
|
192
|
+
*
|
|
190
193
|
* Convention:
|
|
191
194
|
* src/pages/index.tsx → /
|
|
192
195
|
* src/pages/about.tsx → /about
|
|
@@ -242,6 +245,6 @@ interface ViteDevServer {
|
|
|
242
245
|
*/
|
|
243
246
|
declare function registerSSR(app: Hono, vite: ViteDevServer | null, options?: SSROptions): void;
|
|
244
247
|
|
|
245
|
-
declare const VERSION = "0.4.
|
|
248
|
+
declare const VERSION = "0.4.5";
|
|
246
249
|
|
|
247
250
|
export { type CorsConfig, type HttpMethod, type MiddlewareHandler, type RouteEntry, type RouteHandler, type RouteModule, type SSROptions, type ServerConfig, type ServerInfo, VERSION, type ViteDevOptions, type VoltxRouterOptions, type VoltxServer, createCorsMiddleware, createErrorHandler, createLoggerMiddleware, createServer, createViteDevConfig, filePathToUrlPath, registerSSR, registerStaticFiles, scanAndRegisterRoutes, voltxRouter };
|
package/dist/index.js
CHANGED
|
@@ -266,26 +266,26 @@ function createViteDevConfig(options = {}) {
|
|
|
266
266
|
// src/vite-plugin.ts
|
|
267
267
|
function voltxRouter(options = {}) {
|
|
268
268
|
const pagesDir = options.pagesDir ?? "src/pages";
|
|
269
|
-
const
|
|
270
|
-
const
|
|
269
|
+
const PUBLIC_ID = "voltx/router";
|
|
270
|
+
const LEGACY_ID = "virtual:voltx-routes";
|
|
271
|
+
const RESOLVED_ID = "\0voltx/router";
|
|
271
272
|
return {
|
|
272
273
|
name: "voltx-router",
|
|
273
274
|
enforce: "pre",
|
|
274
275
|
config() {
|
|
275
276
|
return {
|
|
276
277
|
ssr: {
|
|
277
|
-
// react-router ships CJS — force Vite to bundle its .mjs for SSR
|
|
278
278
|
noExternal: ["react-router"]
|
|
279
279
|
}
|
|
280
280
|
};
|
|
281
281
|
},
|
|
282
282
|
resolveId(id) {
|
|
283
|
-
if (id ===
|
|
284
|
-
return
|
|
283
|
+
if (id === PUBLIC_ID || id === LEGACY_ID) {
|
|
284
|
+
return RESOLVED_ID;
|
|
285
285
|
}
|
|
286
286
|
},
|
|
287
287
|
load(id) {
|
|
288
|
-
if (id ===
|
|
288
|
+
if (id === RESOLVED_ID) {
|
|
289
289
|
return `
|
|
290
290
|
import { createElement } from "react";
|
|
291
291
|
import { Routes, Route } from "react-router";
|
|
@@ -327,13 +327,15 @@ export function VoltxRoutes() {
|
|
|
327
327
|
}
|
|
328
328
|
|
|
329
329
|
export { routes };
|
|
330
|
+
|
|
331
|
+
// Navigation primitives \u2014 single import source
|
|
332
|
+
export { Link, NavLink, useNavigate, useParams, useLocation, useSearchParams } from "react-router";
|
|
330
333
|
`;
|
|
331
334
|
}
|
|
332
335
|
},
|
|
333
|
-
// HMR: when a file in src/pages/ is added/removed, invalidate the virtual module
|
|
334
336
|
handleHotUpdate({ file, server }) {
|
|
335
337
|
if (file.includes(pagesDir.replace(/\//g, "/"))) {
|
|
336
|
-
const mod = server.moduleGraph.getModuleById(
|
|
338
|
+
const mod = server.moduleGraph.getModuleById(RESOLVED_ID);
|
|
337
339
|
if (mod) {
|
|
338
340
|
server.moduleGraph.invalidateModule(mod);
|
|
339
341
|
server.ws.send({ type: "full-reload" });
|
|
@@ -483,7 +485,7 @@ ${cssLinks}
|
|
|
483
485
|
}
|
|
484
486
|
|
|
485
487
|
// src/index.ts
|
|
486
|
-
var VERSION = "0.4.
|
|
488
|
+
var VERSION = "0.4.5";
|
|
487
489
|
export {
|
|
488
490
|
Hono2 as Hono,
|
|
489
491
|
VERSION,
|
package/package.json
CHANGED