elysia-react-router
Advanced tools
Comparing version
@@ -6,1 +6,3 @@ export { reactRouter } from './react-router.js'; | ||
import 'react-router'; | ||
import './utils-WsggFj7T.js'; | ||
import 'node:fs'; |
import { join } from 'node:path'; | ||
import { join as join$1 } from 'node:path/posix'; | ||
import { Elysia } from 'elysia'; | ||
import { Elysia, file } from 'elysia'; | ||
import { createRequestHandler } from 'react-router'; | ||
import { u as universalGlob } from './utils-WsggFj7T.js'; | ||
import 'node:fs'; | ||
@@ -43,8 +45,8 @@ async function reactRouter(options) { | ||
const clientDirectory = join(buildDirectory, "client"); | ||
const glob = new Bun.Glob(`${clientDirectory}/**`); | ||
for (const path of glob.scanSync()) { | ||
const glob = universalGlob(`${clientDirectory}/**`); | ||
for (const path of glob) { | ||
elysia.get( | ||
// TODO: find more nice way | ||
join$1(path.substring(clientDirectory.length)).replaceAll("\\", "/"), | ||
() => new Response(Bun.file(path)) | ||
() => file(path) | ||
); | ||
@@ -51,0 +53,0 @@ } |
import { join } from 'node:path'; | ||
import { join as join$1 } from 'node:path/posix'; | ||
import { createRequestHandler } from '@remix-run/node'; | ||
import { Elysia } from 'elysia'; | ||
import { Elysia, file } from 'elysia'; | ||
import { u as universalGlob } from './utils-WsggFj7T.js'; | ||
import 'node:fs'; | ||
@@ -43,8 +45,8 @@ async function remix(options) { | ||
const clientDirectory = join(buildDirectory, "client"); | ||
const glob = new Bun.Glob(`${clientDirectory}/**`); | ||
for (const path of glob.scanSync()) { | ||
const glob = universalGlob(`${clientDirectory}/**`); | ||
for (const path of glob) { | ||
elysia.get( | ||
// TODO: find more nice way | ||
join$1(path.substring(clientDirectory.length)).replaceAll("\\", "/"), | ||
() => new Response(Bun.file(path)) | ||
() => file(path) | ||
); | ||
@@ -51,0 +53,0 @@ } |
{ | ||
"name": "elysia-react-router", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"module": "./dist/index.js", | ||
@@ -13,3 +13,3 @@ "types": "./dist/index.d.ts", | ||
"type": "git", | ||
"url": "git+https://github.com/kravetsone/elysia-react-router" | ||
"url": "git+https://github.com/kravetsone/elysia-react-router.git" | ||
}, | ||
@@ -41,2 +41,3 @@ "homepage": "https://github.com/kravetsone/elysia-react-router", | ||
"@types/bun": "latest", | ||
"@types/node": "^22.14.0", | ||
"elysia-connect-middleware": "^0.0.3", | ||
@@ -43,0 +44,0 @@ "pkgroll": "^2.5.1", |
# Elysia React Router and Remix | ||
Use [React Router v7](https://reactrouter.com/home) or [Remix](https://remix.run/) with [Elysia](https://elysiajs.com/) with `HMR` support! Closes a long-standing elysia plugin request https://github.com/elysiajs/elysia/issues/12 | ||
Use [React Router v7](https://reactrouter.com/home) or [Remix](https://remix.run/) with [Elysia](https://elysiajs.com/) with `HMR` support and `Node` adapter support! Closes a long-standing elysia plugin request https://github.com/elysiajs/elysia/issues/12 | ||
@@ -5,0 +5,0 @@ > [!IMPORTANT] |
16192
2.79%11
10%256
5.79%6
20%