aaex-file-router 1.1.0 → 1.2.1
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 +91 -56
- package/dist/core/FileScanner.d.ts.map +1 -1
- package/dist/core/FileScanner.js +1 -0
- package/dist/core/FileScanner.js.map +1 -1
- package/dist/core/RouteGenerator.d.ts +0 -1
- package/dist/core/RouteGenerator.d.ts.map +1 -1
- package/dist/core/RouteGenerator.js +102 -113
- package/dist/core/RouteGenerator.js.map +1 -1
- package/dist/pages/test/ba/moo.d.ts +2 -0
- package/dist/pages/test/ba/moo.d.ts.map +1 -0
- package/dist/pages/test/ba/moo.js +5 -0
- package/dist/pages/test/ba/moo.js.map +1 -0
- package/dist/pages/users/[id].d.ts +1 -0
- package/dist/pages/users/[id].d.ts.map +1 -0
- package/dist/pages/users/[id].js +2 -0
- package/dist/pages/users/[id].js.map +1 -0
- package/dist/pages/users/layout.d.ts +2 -0
- package/dist/pages/users/layout.d.ts.map +1 -0
- package/dist/pages/users/layout.js +5 -0
- package/dist/pages/users/layout.js.map +1 -0
- package/dist/test/index.js +5 -5
- package/dist/test/index.js.map +1 -1
- package/package.json +48 -48
package/README.md
CHANGED
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
A file-based routing system for React projects that automatically generates routes from your file structure. Similar to Next.js App Router or Remix file conventions.
|
|
4
4
|
|
|
5
|
-
## V. 1.1
|
|
6
|
-
|
|
5
|
+
## V. 1.2.1
|
|
6
|
+
|
|
7
|
+
**Hotfix**: fixed all layouts importing as TestLayout now the layout for `pages/users/layout.tsx` gets imported as UsersLayout
|
|
7
8
|
|
|
8
9
|
## Features
|
|
9
10
|
|
|
10
11
|
- **Automatic Route Generation**: Routes are generated based on your file and folder structure
|
|
11
12
|
- **Layout Support**: Create `layout.tsx` files to wrap nested routes
|
|
13
|
+
- **Slug Support**: Creates dynamic routes for [slug] files
|
|
12
14
|
- **Static & Lazy Loading**: Top-level routes use static imports, nested routes use lazy loading
|
|
13
15
|
- **Hot Reload**: Vite plugin watches for file changes and regenerates routes automatically
|
|
14
16
|
- **TypeScript Support**: Full TypeScript support with generated route types
|
|
@@ -31,23 +33,24 @@ src/pages/
|
|
|
31
33
|
└── test/
|
|
32
34
|
├── layout.tsx # Layout wrapper for /test/* routes
|
|
33
35
|
├── index.tsx # Route "/test"
|
|
34
|
-
|
|
36
|
+
├── hello.tsx # Route "/test/hello"
|
|
37
|
+
└── [slug].tsx # Route "/test/:slug"
|
|
35
38
|
```
|
|
36
39
|
|
|
37
40
|
### 2. Configure Vite
|
|
38
41
|
|
|
39
42
|
```typescript
|
|
40
43
|
// vite.config.ts
|
|
41
|
-
import { defineConfig } from
|
|
42
|
-
import react from
|
|
43
|
-
import { aaexFileRouter } from
|
|
44
|
+
import { defineConfig } from "vite";
|
|
45
|
+
import react from "@vitejs/plugin-react";
|
|
46
|
+
import { aaexFileRouter } from "aaex-file-router";
|
|
44
47
|
|
|
45
48
|
export default defineConfig({
|
|
46
49
|
plugins: [
|
|
47
50
|
react(),
|
|
48
51
|
aaexFileRouter({
|
|
49
|
-
pagesDir:
|
|
50
|
-
outputFile:
|
|
52
|
+
pagesDir: "./src/pages", //page files location(optional: default ./src/pages)
|
|
53
|
+
outputFile: "./src/routes.ts", //generated routes (default: ./src/routes.ts)
|
|
51
54
|
}),
|
|
52
55
|
],
|
|
53
56
|
});
|
|
@@ -57,14 +60,14 @@ export default defineConfig({
|
|
|
57
60
|
|
|
58
61
|
```typescript
|
|
59
62
|
// src/main.tsx
|
|
60
|
-
import React from
|
|
61
|
-
import ReactDOM from
|
|
62
|
-
import { RouterProvider, createBrowserRouter } from
|
|
63
|
-
import routes from
|
|
63
|
+
import React from "react";
|
|
64
|
+
import ReactDOM from "react-dom/client";
|
|
65
|
+
import { RouterProvider, createBrowserRouter } from "react-router-dom";
|
|
66
|
+
import routes from "./routes";
|
|
64
67
|
|
|
65
68
|
const router = createBrowserRouter(routes);
|
|
66
69
|
|
|
67
|
-
ReactDOM.createRoot(document.getElementById(
|
|
70
|
+
ReactDOM.createRoot(document.getElementById("root")!).render(
|
|
68
71
|
<React.StrictMode>
|
|
69
72
|
<RouterProvider router={router} />
|
|
70
73
|
</React.StrictMode>
|
|
@@ -74,17 +77,21 @@ ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
|
74
77
|
## File Conventions
|
|
75
78
|
|
|
76
79
|
### `index.tsx`
|
|
80
|
+
|
|
77
81
|
Renders at the parent route path.
|
|
82
|
+
|
|
78
83
|
```
|
|
79
84
|
pages/index.tsx → "/"
|
|
80
85
|
pages/about/index.tsx → "/about"
|
|
81
86
|
```
|
|
82
87
|
|
|
83
88
|
### `layout.tsx`
|
|
89
|
+
|
|
84
90
|
Wraps all sibling and nested routes. Children are rendered in an `<Outlet />`.
|
|
91
|
+
|
|
85
92
|
```typescript
|
|
86
93
|
// pages/admin/layout.tsx
|
|
87
|
-
import { Outlet } from
|
|
94
|
+
import { Outlet } from "react-router-dom";
|
|
88
95
|
|
|
89
96
|
export default function AdminLayout() {
|
|
90
97
|
return (
|
|
@@ -96,8 +103,31 @@ export default function AdminLayout() {
|
|
|
96
103
|
}
|
|
97
104
|
```
|
|
98
105
|
|
|
106
|
+
### Slug files
|
|
107
|
+
|
|
108
|
+
Filenames wrapper in hardbrackets `[filename]` will resolve to a dynamic route
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
pages/test/[<filename>].tsx → "/test/:<filename>"
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
//pages/test/[slug].tsx
|
|
116
|
+
|
|
117
|
+
import { useParams } from "react-router-dom";
|
|
118
|
+
|
|
119
|
+
export default function TestWithSlug() {
|
|
120
|
+
// replace slug with what the file is called
|
|
121
|
+
const { slug } = useParams();
|
|
122
|
+
|
|
123
|
+
return <div>{slug}</div>;
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
99
127
|
### Named files
|
|
128
|
+
|
|
100
129
|
Any other `.tsx` file becomes a route based on its filename.
|
|
130
|
+
|
|
101
131
|
```
|
|
102
132
|
pages/about.tsx → "/about"
|
|
103
133
|
pages/blog/post.tsx → "/blog/post"
|
|
@@ -110,18 +140,18 @@ The plugin generates a `routes.ts` file with all your routes:
|
|
|
110
140
|
```typescript
|
|
111
141
|
// src/routes.ts
|
|
112
142
|
// AUTO GENERATED: DO NOT EDIT
|
|
113
|
-
import React from
|
|
114
|
-
import Index from
|
|
115
|
-
import AdminLayout from
|
|
116
|
-
import type { RouteObject } from
|
|
143
|
+
import React from "react";
|
|
144
|
+
import Index from "./pages/index.tsx";
|
|
145
|
+
import AdminLayout from "./pages/admin/layout.tsx";
|
|
146
|
+
import type { RouteObject } from "react-router-dom";
|
|
117
147
|
|
|
118
148
|
const routes: RouteObject[] = [
|
|
119
149
|
{
|
|
120
|
-
path:
|
|
150
|
+
path: "/",
|
|
121
151
|
element: React.createElement(Index),
|
|
122
152
|
},
|
|
123
153
|
{
|
|
124
|
-
path:
|
|
154
|
+
path: "admin",
|
|
125
155
|
element: React.createElement(AdminLayout),
|
|
126
156
|
children: [
|
|
127
157
|
// nested routes...
|
|
@@ -134,12 +164,12 @@ export default routes;
|
|
|
134
164
|
|
|
135
165
|
## Route Resolution Examples
|
|
136
166
|
|
|
137
|
-
| File Structure
|
|
138
|
-
|
|
139
|
-
| `pages/index.tsx`
|
|
140
|
-
| `pages/about.tsx`
|
|
141
|
-
| `pages/blog/index.tsx`
|
|
142
|
-
| `pages/blog/post.tsx`
|
|
167
|
+
| File Structure | Route Path |
|
|
168
|
+
| ----------------------------------- | -------------------- |
|
|
169
|
+
| `pages/index.tsx` | `/` |
|
|
170
|
+
| `pages/about.tsx` | `/about` |
|
|
171
|
+
| `pages/blog/index.tsx` | `/blog` |
|
|
172
|
+
| `pages/blog/post.tsx` | `/blog/post` |
|
|
143
173
|
| `pages/admin/layout.tsx` + children | `/admin/*` (grouped) |
|
|
144
174
|
|
|
145
175
|
## Layouts
|
|
@@ -148,7 +178,7 @@ Layouts wrap their child routes and provide shared UI:
|
|
|
148
178
|
|
|
149
179
|
```typescript
|
|
150
180
|
// pages/dashboard/layout.tsx
|
|
151
|
-
import { Outlet } from
|
|
181
|
+
import { Outlet } from "react-router-dom";
|
|
152
182
|
|
|
153
183
|
export default function DashboardLayout() {
|
|
154
184
|
return (
|
|
@@ -164,80 +194,79 @@ export default function DashboardLayout() {
|
|
|
164
194
|
|
|
165
195
|
All routes in `pages/dashboard/*` will render inside this layout.
|
|
166
196
|
|
|
167
|
-
|
|
168
197
|
## FileLink component
|
|
169
198
|
|
|
170
199
|
The FileLink component is a type safe wrapper for the Link component in react router that uses an autogenerated type to check which routes are available.
|
|
171
200
|
|
|
172
|
-
## Notice!
|
|
173
|
-
At the moment it can only do the basic routing where the "to" prop is a string.
|
|
174
|
-
React routers normal Link still works in cases where the advanced functionality is more important than type safe routing.
|
|
201
|
+
## Notice!
|
|
175
202
|
|
|
203
|
+
At the moment it can only do the basic routing where the "to" prop is a string.
|
|
204
|
+
React Router's normal Link still works in cases where type safety is less important.
|
|
176
205
|
|
|
177
206
|
## Usage
|
|
178
207
|
|
|
179
|
-
|
|
180
208
|
```ts
|
|
181
209
|
// src/routeTypes.ts
|
|
182
210
|
// * AUTO GENERATED: DO NOT EDIT
|
|
183
211
|
|
|
184
212
|
//this file is auto generated along with the route definition file
|
|
185
213
|
export type FileRoutes = "/" | "test";
|
|
186
|
-
|
|
187
|
-
```
|
|
214
|
+
```
|
|
188
215
|
|
|
189
|
-
```tsx
|
|
216
|
+
```tsx
|
|
190
217
|
//src/pages/index.tsx
|
|
191
|
-
import {FileLink} from "aaex-file-router"
|
|
192
|
-
import type { FileRoutes } from "../routeTypes"
|
|
193
|
-
|
|
194
|
-
export default function Home(){
|
|
195
|
-
return <>
|
|
196
|
-
Hello Home!
|
|
197
|
-
{/* FileRoutes is optional and not required it will work fine with any string if not passed */}
|
|
218
|
+
import { FileLink } from "aaex-file-router";
|
|
219
|
+
import type { FileRoutes } from "../routeTypes";
|
|
198
220
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
221
|
+
export default function Home() {
|
|
222
|
+
return (
|
|
223
|
+
<>
|
|
224
|
+
Hello Home!
|
|
225
|
+
{/* FileRoutes is optional and not required it will work fine with any string if not passed */}
|
|
226
|
+
<FileLink<FileRoutes> to="test">Test safe</FileLink>
|
|
227
|
+
//or //no type safety
|
|
228
|
+
<FileLink to="some-route">Non safe</FileLink>
|
|
229
|
+
</>
|
|
230
|
+
);
|
|
231
|
+
}
|
|
205
232
|
```
|
|
206
233
|
|
|
207
|
-
|
|
208
234
|
## API Reference
|
|
209
235
|
|
|
210
236
|
### FileScanner
|
|
237
|
+
|
|
211
238
|
Scans the file system and converts files into a structured format.
|
|
212
239
|
|
|
213
240
|
```typescript
|
|
214
|
-
import { FileScanner } from
|
|
241
|
+
import { FileScanner } from "aaex-file-router/core";
|
|
215
242
|
|
|
216
|
-
const scanner = new FileScanner(
|
|
243
|
+
const scanner = new FileScanner("./src/pages");
|
|
217
244
|
const fileData = await scanner.get_file_data();
|
|
218
245
|
```
|
|
219
246
|
|
|
220
247
|
### RouteGenerator
|
|
248
|
+
|
|
221
249
|
Converts file structure into React Router route configuration.
|
|
222
250
|
|
|
223
251
|
```typescript
|
|
224
|
-
import { RouteGenerator } from
|
|
252
|
+
import { RouteGenerator } from "aaex-file-router/core";
|
|
225
253
|
|
|
226
254
|
const generator = new RouteGenerator();
|
|
227
255
|
const routesCode = await generator.generateComponentsMap(fileData);
|
|
228
256
|
```
|
|
229
257
|
|
|
230
258
|
### aaexFileRouter (Vite Plugin)
|
|
259
|
+
|
|
231
260
|
Automatically watches for file changes and regenerates routes.
|
|
232
261
|
|
|
233
262
|
```typescript
|
|
234
|
-
import { aaexFileRouter } from
|
|
263
|
+
import { aaexFileRouter } from "aaex-file-router/core";
|
|
235
264
|
|
|
236
265
|
export default defineConfig({
|
|
237
266
|
plugins: [
|
|
238
267
|
aaexFileRouter({
|
|
239
|
-
pagesDir:
|
|
240
|
-
outputFile:
|
|
268
|
+
pagesDir: "./src/pages",
|
|
269
|
+
outputFile: "./src/routes.ts",
|
|
241
270
|
}),
|
|
242
271
|
],
|
|
243
272
|
});
|
|
@@ -247,7 +276,7 @@ export default defineConfig({
|
|
|
247
276
|
|
|
248
277
|
1. **File Scanning**: Recursively scans your pages directory and builds a file tree
|
|
249
278
|
2. **Route Generation**: Converts the file structure into React Router `RouteObject` format
|
|
250
|
-
3. **Smart Importing**:
|
|
279
|
+
3. **Smart Importing**:
|
|
251
280
|
- Top-level files use static imports for faster initial load
|
|
252
281
|
- Nested/grouped routes use lazy loading for code splitting
|
|
253
282
|
- Layout files are statically imported as route wrappers
|
|
@@ -262,6 +291,7 @@ export default defineConfig({
|
|
|
262
291
|
## Common Patterns
|
|
263
292
|
|
|
264
293
|
### Shared Layout
|
|
294
|
+
|
|
265
295
|
```sh
|
|
266
296
|
pages/
|
|
267
297
|
├── layout.tsx # Wraps entire app
|
|
@@ -270,6 +300,7 @@ pages/
|
|
|
270
300
|
```
|
|
271
301
|
|
|
272
302
|
### Nested Layouts
|
|
303
|
+
|
|
273
304
|
```sh
|
|
274
305
|
pages/
|
|
275
306
|
├── layout.tsx # Root layout
|
|
@@ -280,6 +311,7 @@ pages/
|
|
|
280
311
|
```
|
|
281
312
|
|
|
282
313
|
### Route Groups Without Layout
|
|
314
|
+
|
|
283
315
|
```sh
|
|
284
316
|
pages/
|
|
285
317
|
├── blog/
|
|
@@ -290,14 +322,17 @@ pages/
|
|
|
290
322
|
## Troubleshooting
|
|
291
323
|
|
|
292
324
|
### Routes not updating on file change
|
|
325
|
+
|
|
293
326
|
- Ensure Vite dev server is running (`npm run dev`)
|
|
294
327
|
- Check that `pagesDir` in vite config matches your actual pages directory
|
|
295
328
|
|
|
296
329
|
### Duplicate imports in generated file
|
|
330
|
+
|
|
297
331
|
- This shouldn't happen, but if it does, try restarting the dev server
|
|
298
332
|
- Check for files with the same name in different directories
|
|
299
333
|
|
|
300
334
|
### Unexpected route paths
|
|
335
|
+
|
|
301
336
|
- Remember: `index.tsx` files inherit their parent's path
|
|
302
337
|
- Directories without `layout.tsx` flatten their children into absolute routes
|
|
303
338
|
- File names are converted to lowercase for routes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileScanner.d.ts","sourceRoot":"","sources":["../../src/core/FileScanner.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED,qBAAa,WAAW;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,EAAE,CAAM;gBAEnB,SAAS,EAAE,MAAM;IAI7B;;;OAGG;YACW,UAAU;IAmBxB;;;OAGG;YACW,eAAe;IA+C7B;;;OAGG;IACU,aAAa,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"FileScanner.d.ts","sourceRoot":"","sources":["../../src/core/FileScanner.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED,qBAAa,WAAW;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,EAAE,CAAM;gBAEnB,SAAS,EAAE,MAAM;IAI7B;;;OAGG;YACW,UAAU;IAmBxB;;;OAGG;YACW,eAAe;IA+C7B;;;OAGG;IACU,aAAa,IAAI,OAAO,CAAC,QAAQ,EAAE,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C,GAAG,GAAG;gBAC9B,aAAa,EAAE,QAAQ;gBACvB,WAAW,EAAE,KAAK;aACnB,CAAC,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,aAAa;QACxB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC3E,OAAO,CAAC,GAAG,CAAC,KAAK,EAAC,GAAG,CAAC,CAAC;QAEvB,MAAM,MAAM,GAAe,MAAM,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;QAC3D,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -3,7 +3,6 @@ export declare class RouteGenerator {
|
|
|
3
3
|
private topLevelImports;
|
|
4
4
|
private importSet;
|
|
5
5
|
private processedFiles;
|
|
6
|
-
private clearImports;
|
|
7
6
|
/**
|
|
8
7
|
* Recursively converts FileData tree into React Router RouteConfig array
|
|
9
8
|
* Handles layout files, index files, and nested routes with proper pathing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteGenerator.d.ts","sourceRoot":"","sources":["../../src/core/RouteGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AASzC,qBAAa,cAAc;IACzB,OAAO,CAAC,eAAe,CAAgB;IACvC,OAAO,CAAC,SAAS,CAA0B;IAC3C,OAAO,CAAC,cAAc,CAA0B;IAEhD
|
|
1
|
+
{"version":3,"file":"RouteGenerator.d.ts","sourceRoot":"","sources":["../../src/core/RouteGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AASzC,qBAAa,cAAc;IACzB,OAAO,CAAC,eAAe,CAAgB;IACvC,OAAO,CAAC,SAAS,CAA0B;IAC3C,OAAO,CAAC,cAAc,CAA0B;IAEhD;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAmLxB;;;;;OAKG;IACU,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IA8BzE;;;;OAIG;IACU,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;CAuC1E"}
|
|
@@ -2,9 +2,6 @@ export class RouteGenerator {
|
|
|
2
2
|
topLevelImports = [];
|
|
3
3
|
importSet = new Set();
|
|
4
4
|
processedFiles = new Set();
|
|
5
|
-
clearImports() {
|
|
6
|
-
this.topLevelImports = [];
|
|
7
|
-
}
|
|
8
5
|
/**
|
|
9
6
|
* Recursively converts FileData tree into React Router RouteConfig array
|
|
10
7
|
* Handles layout files, index files, and nested routes with proper pathing
|
|
@@ -14,6 +11,8 @@ export class RouteGenerator {
|
|
|
14
11
|
fileDataToRoutes(fileData, parentPath = "", flattenPrefix = "", inGroup = false) {
|
|
15
12
|
const routes = [];
|
|
16
13
|
const processedIndexes = new Set();
|
|
14
|
+
/** Converts `[slug]` → `:slug` */
|
|
15
|
+
const normalizeDynamicSegment = (name) => name.replace(/\[([^\]]+)\]/g, ":$1");
|
|
17
16
|
/**
|
|
18
17
|
* Utility function to safely join path segments
|
|
19
18
|
* - Filters out empty/falsy parts to avoid "///" in paths
|
|
@@ -23,119 +22,104 @@ export class RouteGenerator {
|
|
|
23
22
|
* Example: posixJoin("pages\\test", "hello") -> "pages/test/hello"
|
|
24
23
|
*/
|
|
25
24
|
const posixJoin = (...parts) => parts.filter(Boolean).join("/").replace(/\\/g, "/");
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
25
|
+
/** Converts "user", "[id]" → "User", "Id" */
|
|
26
|
+
const toPascal = (str) => str
|
|
27
|
+
.replace(/\[|\]/g, "")
|
|
28
|
+
.replace(/(^\w|[-_]\w)/g, (m) => m.replace(/[-_]/, "").toUpperCase());
|
|
29
|
+
/** Build import name from parent folder + file */
|
|
30
|
+
const getImportName = (file) => {
|
|
31
|
+
const segments = file.relative_path.replace(/^src[\/\\]/, "").split("/");
|
|
32
|
+
const parentFolder = segments.length > 1 ? segments[segments.length - 2] : "";
|
|
33
|
+
const parentName = parentFolder ? toPascal(parentFolder) : "";
|
|
34
|
+
const nameWithoutExt = file.name.replace(/\.[jt]sx?$/, "");
|
|
35
|
+
const fileNamePart = nameWithoutExt.toLowerCase() === "index"
|
|
36
|
+
? ""
|
|
37
|
+
: toPascal(nameWithoutExt);
|
|
38
|
+
return `${parentName}${fileNamePart}`;
|
|
39
|
+
};
|
|
40
|
+
/** Create route object (handles lazy vs top-level import) */
|
|
41
|
+
const createRoute = (file, path, importName, lazy = false) => {
|
|
42
|
+
const filePath = file.relative_path.replace(/^src[\/\\]/, "./");
|
|
43
|
+
const element = lazy
|
|
44
|
+
? `React.createElement(React.lazy(() => import('${filePath}')))`
|
|
45
|
+
: `React.createElement(${importName})`;
|
|
46
|
+
return { path: normalizeDynamicSegment(path), element };
|
|
47
|
+
};
|
|
48
|
+
/** Recursive processing */
|
|
49
|
+
const processFile = (file, currentParentPath, currentFlatten, group) => {
|
|
50
|
+
//Already proccesed
|
|
51
|
+
if (!file.isDirectory && this.processedFiles.has(file.relative_path))
|
|
52
|
+
return;
|
|
53
|
+
if (file.isDirectory && file.children?.length) {
|
|
54
|
+
const layoutFile = file.children.find((c) => !c.isDirectory && /^layout\.(tsx|jsx|ts|js)$/i.test(c.name));
|
|
55
|
+
if (!layoutFile) {
|
|
56
|
+
const newFlatten = posixJoin(currentFlatten, file.name.toLowerCase());
|
|
57
|
+
routes.push(...this.fileDataToRoutes(file.children, currentParentPath, newFlatten, false));
|
|
58
|
+
return;
|
|
38
59
|
}
|
|
39
|
-
|
|
40
|
-
const layoutPath =
|
|
41
|
-
const layoutImportName = `TestLayout`;
|
|
60
|
+
const layoutImportName = file.name.charAt(0).toUpperCase() + file.name.slice(1) + "Layout";
|
|
61
|
+
const layoutPath = layoutFile.relative_path.replace(/^src[\/\\]/, "./");
|
|
42
62
|
this.topLevelImports.push(`import ${layoutImportName} from '${layoutPath}';`);
|
|
43
|
-
this.processedFiles.add(
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
const nonLayoutChildren = file.children.filter((c) => !/^layout\.(tsx|jsx|ts|js)$/i.test(c.name));
|
|
47
|
-
for (const child of nonLayoutChildren) {
|
|
63
|
+
this.processedFiles.add(layoutFile.relative_path);
|
|
64
|
+
const childRoutes = [];
|
|
65
|
+
for (const child of file.children.filter((c) => !/^layout\.(tsx|jsx|ts|js)$/i.test(c.name))) {
|
|
48
66
|
if (child.isDirectory) {
|
|
49
|
-
|
|
50
|
-
childrenRoutes.push(...this.fileDataToRoutes([child], posixJoin(parentPath, file.name), "", true));
|
|
67
|
+
processFile(child, posixJoin(currentParentPath, file.name), "", true);
|
|
51
68
|
}
|
|
52
69
|
else {
|
|
53
70
|
const childNameWithoutExt = child.name.replace(/\.[jt]sx?$/, "");
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
path: "",
|
|
59
|
-
element: `React.createElement(React.lazy(() => import('${childPath}')))`,
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
childrenRoutes.push({
|
|
64
|
-
path: childNameWithoutExt.toLowerCase(),
|
|
65
|
-
element: `React.createElement(React.lazy(() => import('${childPath}')))`,
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
// Mark child as processed so it doesn't get added as top-level
|
|
71
|
+
const path = childNameWithoutExt.toLowerCase() === "index"
|
|
72
|
+
? ""
|
|
73
|
+
: normalizeDynamicSegment(childNameWithoutExt.toLowerCase());
|
|
74
|
+
childRoutes.push(createRoute(child, path, undefined, true));
|
|
69
75
|
this.processedFiles.add(child.relative_path);
|
|
70
76
|
}
|
|
71
77
|
}
|
|
72
78
|
routes.push({
|
|
73
|
-
path: file.name.toLowerCase(),
|
|
79
|
+
path: normalizeDynamicSegment(file.name.toLowerCase()),
|
|
74
80
|
element: `React.createElement(${layoutImportName})`,
|
|
75
|
-
children:
|
|
81
|
+
children: childRoutes.length ? childRoutes : undefined,
|
|
76
82
|
});
|
|
83
|
+
return;
|
|
77
84
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const siblingDirExists = fileData.some((f) => f.isDirectory &&
|
|
87
|
-
f.name.toLowerCase() === nameWithoutExt.toLowerCase());
|
|
88
|
-
if (siblingDirExists) {
|
|
89
|
-
this.processedFiles.add(file.relative_path);
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
// Skip layout files
|
|
93
|
-
if (/^layout\.(tsx|jsx|ts|js)$/i.test(file.name)) {
|
|
94
|
-
this.processedFiles.add(file.relative_path);
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
// Determine path
|
|
98
|
-
const fileSegment = isIndexFile ? "" : nameWithoutExt.toLowerCase();
|
|
99
|
-
let fullPath;
|
|
100
|
-
if (flattenPrefix) {
|
|
101
|
-
fullPath = posixJoin(flattenPrefix, fileSegment);
|
|
102
|
-
}
|
|
103
|
-
else if (inGroup) {
|
|
104
|
-
fullPath = fileSegment;
|
|
105
|
-
}
|
|
106
|
-
else if (parentPath) {
|
|
107
|
-
fullPath = posixJoin(parentPath, fileSegment);
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
fullPath = isIndexFile ? "/" : fileSegment;
|
|
111
|
-
}
|
|
112
|
-
// Create import & avoid duplicates
|
|
113
|
-
const importNameBase = nameWithoutExt.replace(/[^a-zA-Z0-9]/g, "_");
|
|
114
|
-
const capitalized = importNameBase.charAt(0).toUpperCase() + importNameBase.slice(1);
|
|
115
|
-
const filePath = file.relative_path.replace(/^src[\/\\]/, "./");
|
|
116
|
-
if (inGroup) {
|
|
117
|
-
// Lazy-load child component inside group
|
|
118
|
-
routes.push({
|
|
119
|
-
path: fullPath === "/" ? "" : fullPath.replace(/^\/+/, ""),
|
|
120
|
-
element: `React.createElement(React.lazy(() => import('${filePath}')))`,
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
// Top-level files use static imports
|
|
125
|
-
if (!this.importSet.has(filePath)) {
|
|
126
|
-
this.topLevelImports.push(`import ${capitalized} from '${filePath}';`);
|
|
127
|
-
this.importSet.add(filePath);
|
|
128
|
-
}
|
|
129
|
-
routes.push({
|
|
130
|
-
path: fullPath === "/" ? "/" : fullPath.replace(/^\/+/, ""),
|
|
131
|
-
element: `React.createElement(${capitalized})`,
|
|
132
|
-
});
|
|
133
|
-
}
|
|
85
|
+
// ---------------- FILES ----------------
|
|
86
|
+
const nameWithoutExt = file.name.replace(/\.[jt]sx?$/, "");
|
|
87
|
+
const isIndex = nameWithoutExt.toLowerCase() === "index";
|
|
88
|
+
if (isIndex && processedIndexes.has(file.relative_path))
|
|
89
|
+
return;
|
|
90
|
+
if (fileData.some((f) => f.isDirectory &&
|
|
91
|
+
f.name.toLowerCase() === nameWithoutExt.toLowerCase()) ||
|
|
92
|
+
/^layout\.(tsx|jsx|ts|js)$/i.test(file.name)) {
|
|
134
93
|
this.processedFiles.add(file.relative_path);
|
|
135
|
-
|
|
136
|
-
processedIndexes.add(file.relative_path);
|
|
94
|
+
return;
|
|
137
95
|
}
|
|
138
|
-
|
|
96
|
+
const rawSegment = isIndex ? "" : nameWithoutExt.toLowerCase();
|
|
97
|
+
const fileSegment = normalizeDynamicSegment(rawSegment);
|
|
98
|
+
let fullPath;
|
|
99
|
+
if (currentFlatten)
|
|
100
|
+
fullPath = posixJoin(currentFlatten, fileSegment);
|
|
101
|
+
else if (group)
|
|
102
|
+
fullPath = fileSegment;
|
|
103
|
+
else if (currentParentPath)
|
|
104
|
+
fullPath = posixJoin(currentParentPath, fileSegment);
|
|
105
|
+
else
|
|
106
|
+
fullPath = isIndex ? "/" : fileSegment;
|
|
107
|
+
const importName = getImportName(file);
|
|
108
|
+
if (group)
|
|
109
|
+
routes.push(createRoute(file, fullPath, undefined, true));
|
|
110
|
+
else {
|
|
111
|
+
if (!this.importSet.has(file.relative_path)) {
|
|
112
|
+
this.topLevelImports.push(`import ${importName} from './${file.relative_path.replace(/^src[\/\\]/, "")}';`);
|
|
113
|
+
this.importSet.add(file.relative_path);
|
|
114
|
+
}
|
|
115
|
+
routes.push(createRoute(file, fullPath, importName));
|
|
116
|
+
}
|
|
117
|
+
this.processedFiles.add(file.relative_path);
|
|
118
|
+
if (isIndex)
|
|
119
|
+
processedIndexes.add(file.relative_path);
|
|
120
|
+
};
|
|
121
|
+
for (const file of fileData)
|
|
122
|
+
processFile(file, parentPath, flattenPrefix, inGroup);
|
|
139
123
|
return routes;
|
|
140
124
|
}
|
|
141
125
|
/**
|
|
@@ -178,23 +162,28 @@ export default routes;
|
|
|
178
162
|
this.processedFiles = new Set();
|
|
179
163
|
const routes = this.fileDataToRoutes(fileData);
|
|
180
164
|
const routePaths = [];
|
|
181
|
-
|
|
182
|
-
|
|
165
|
+
const addRoute = (route, parentPath = "") => {
|
|
166
|
+
const fullPath = parentPath
|
|
167
|
+
? `${parentPath}/${route.path}`.replace(/\/+/g, "/")
|
|
168
|
+
: route.path;
|
|
169
|
+
// Replace ":param" with ${string} for TypeScript type
|
|
170
|
+
const tsPath = fullPath
|
|
171
|
+
.split("/")
|
|
172
|
+
.map((seg) => (seg.startsWith(":") ? "${string}" : seg))
|
|
173
|
+
.join("/");
|
|
174
|
+
routePaths.push(tsPath);
|
|
183
175
|
if (route.children?.length) {
|
|
184
|
-
route.children.
|
|
185
|
-
if (child.path != "") {
|
|
186
|
-
routePaths.push(`${route.path}/${child.path}`);
|
|
187
|
-
}
|
|
188
|
-
});
|
|
176
|
+
route.children.forEach((child) => addRoute(child, fullPath));
|
|
189
177
|
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
178
|
+
};
|
|
179
|
+
routes.forEach((route) => addRoute(route));
|
|
180
|
+
const uniquePaths = Array.from(new Set(routePaths))
|
|
181
|
+
.map((p) => `\`${p}\``) // wrap in backticks for template literal types
|
|
193
182
|
.join(" | ");
|
|
194
183
|
return `// * AUTO GENERATED: DO NOT EDIT
|
|
195
184
|
|
|
196
|
-
|
|
197
|
-
|
|
185
|
+
export type FileRoutes = ${uniquePaths};
|
|
186
|
+
`;
|
|
198
187
|
}
|
|
199
188
|
}
|
|
200
189
|
//# sourceMappingURL=RouteGenerator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteGenerator.js","sourceRoot":"","sources":["../../src/core/RouteGenerator.ts"],"names":[],"mappings":"AASA,MAAM,OAAO,cAAc;IACjB,eAAe,GAAa,EAAE,CAAC;IAC/B,SAAS,GAAgB,IAAI,GAAG,EAAE,CAAC;IACnC,cAAc,GAAgB,IAAI,GAAG,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"RouteGenerator.js","sourceRoot":"","sources":["../../src/core/RouteGenerator.ts"],"names":[],"mappings":"AASA,MAAM,OAAO,cAAc;IACjB,eAAe,GAAa,EAAE,CAAC;IAC/B,SAAS,GAAgB,IAAI,GAAG,EAAE,CAAC;IACnC,cAAc,GAAgB,IAAI,GAAG,EAAE,CAAC;IAEhD;;;;;OAKG;IACK,gBAAgB,CACtB,QAAoB,EACpB,UAAU,GAAG,EAAE,EACf,aAAa,GAAG,EAAE,EAClB,OAAO,GAAG,KAAK;QAEf,MAAM,MAAM,GAAkB,EAAE,CAAC;QACjC,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;QAE3C,kCAAkC;QAClC,MAAM,uBAAuB,GAAG,CAAC,IAAY,EAAE,EAAE,CAC/C,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,K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AC,CAAC,CAAC,GAAG,CAAC,CAAC;iBACvD,IAAI,CAAC,GAAG,CAAC,CAAC;YAEb,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAExB,IAAI,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;gBAC3B,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;YAC/D,CAAC;QACH,CAAC,CAAC;QAEF,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QAE3C,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;aAChD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,+CAA+C;aACtE,IAAI,CAAC,KAAK,CAAC,CAAC;QAEf,OAAO;;2BAEgB,WAAW;CACrC,CAAC;IACA,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moo.d.ts","sourceRoot":"","sources":["../../../../src/pages/test/ba/moo.tsx"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,GAAG,4CAE1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moo.js","sourceRoot":"","sources":["../../../../src/pages/test/ba/moo.tsx"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,UAAU,GAAG;IACvB,OAAO,oCAAQ,CAAA;AACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=%5Bid%5D.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"[id].d.ts","sourceRoot":"","sources":["../../../src/pages/users/[id].tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"[id].js","sourceRoot":"","sources":["../../../src/pages/users/[id].tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/pages/users/layout.tsx"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,MAAM,4CAE7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../src/pages/users/layout.tsx"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,UAAU,MAAM;IAC1B,OAAO,mCAAO,CAAA;AAClB,CAAC"}
|
package/dist/test/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { fileURLToPath } from "url";
|
|
2
2
|
import { FileScanner } from "../core/FileScanner.js";
|
|
3
3
|
import { RouteGenerator } from "../core/RouteGenerator.js";
|
|
4
|
-
import path from "path";
|
|
5
4
|
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = path.dirname(__filename);
|
|
7
5
|
const pagesDir = "/src/pages";
|
|
8
6
|
async function generateRoutes() {
|
|
9
7
|
try {
|
|
10
8
|
const scanner = new FileScanner(pagesDir);
|
|
11
9
|
const fileData = await scanner.get_file_data();
|
|
10
|
+
console.log(fileData);
|
|
11
|
+
// console.log(fileData);
|
|
12
12
|
const generator = new RouteGenerator();
|
|
13
13
|
const routeMap = await generator.generateComponentsMap(fileData);
|
|
14
|
-
console.log("Route map: ", routeMap)
|
|
15
|
-
const routType = generator.generateRoutesTypeDef(fileData);
|
|
16
|
-
console.log(
|
|
14
|
+
// console.log("Route map: ", routeMap)
|
|
15
|
+
const routType = await generator.generateRoutesTypeDef(fileData);
|
|
16
|
+
console.log(routeMap);
|
|
17
17
|
}
|
|
18
18
|
catch (error) {
|
|
19
19
|
console.error("Error generating routes:", error);
|
package/dist/test/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,QAAQ,GAAG,YAAY,CAAC;AAE9B,KAAK,UAAU,cAAc;IAC3B,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC1C,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,aAAa,EAAE,CAAC;QAE/C,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAEtB,yBAAyB;QAEzB,MAAM,SAAS,GAAG,IAAI,cAAc,EAAE,CAAC;QACvC,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QAEjE,uCAAuC;QAEvC,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QAEjE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACxB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;IACnD,CAAC;AACH,CAAC;AAED,cAAc,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "aaex-file-router",
|
|
3
|
-
"version": "1.1
|
|
4
|
-
"description": "A file-based routing system for React projects that automatically generates routes from your file structure. Similar to Next.js App Router or Remix file conventions.",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "
|
|
8
|
-
"build": "npx tsc",
|
|
9
|
-
"dev": "npx tsc --watch"
|
|
10
|
-
},
|
|
11
|
-
"keywords": [
|
|
12
|
-
"react",
|
|
13
|
-
"router",
|
|
14
|
-
"vite-plugin"
|
|
15
|
-
],
|
|
16
|
-
|
|
17
|
-
"exports":{
|
|
18
|
-
".": "./dist/index.js",
|
|
19
|
-
"./core": "./dist/core/index.js"
|
|
20
|
-
},
|
|
21
|
-
"author": "TmRAaEx",
|
|
22
|
-
"license": "MIT",
|
|
23
|
-
"type": "module",
|
|
24
|
-
"files": [
|
|
25
|
-
"dist",
|
|
26
|
-
"README.md",
|
|
27
|
-
"LICENCE"
|
|
28
|
-
],
|
|
29
|
-
"types": "dist/index.d.ts",
|
|
30
|
-
"devDependencies": {
|
|
31
|
-
"@types/node": "^24.10.1",
|
|
32
|
-
"@types/react": "^19.2.7",
|
|
33
|
-
"@types/react-dom": "^19.2.3",
|
|
34
|
-
"react": "^19.2.0",
|
|
35
|
-
"react-dom": "^19.2.0",
|
|
36
|
-
"react-router-dom": "^7.9.6",
|
|
37
|
-
"typescript": "^5.9.3",
|
|
38
|
-
"vite": "^7.2.4",
|
|
39
|
-
"vite-plugin-dts": "^4.5.4"
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
"peerDependencies": {
|
|
43
|
-
"react": "^19.2.0",
|
|
44
|
-
"react-dom": "^19.2.0",
|
|
45
|
-
"react-router-dom": "^7.9.6",
|
|
46
|
-
"vite": "^7.2.4"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "aaex-file-router",
|
|
3
|
+
"version": "1.2.1",
|
|
4
|
+
"description": "A file-based routing system for React projects that automatically generates routes from your file structure. Similar to Next.js App Router or Remix file conventions.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "node ./dist/test/index.js",
|
|
8
|
+
"build": "npx tsc",
|
|
9
|
+
"dev": "npx tsc --watch"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"react",
|
|
13
|
+
"router",
|
|
14
|
+
"vite-plugin"
|
|
15
|
+
],
|
|
16
|
+
|
|
17
|
+
"exports":{
|
|
18
|
+
".": "./dist/index.js",
|
|
19
|
+
"./core": "./dist/core/index.js"
|
|
20
|
+
},
|
|
21
|
+
"author": "TmRAaEx",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"type": "module",
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENCE"
|
|
28
|
+
],
|
|
29
|
+
"types": "dist/index.d.ts",
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^24.10.1",
|
|
32
|
+
"@types/react": "^19.2.7",
|
|
33
|
+
"@types/react-dom": "^19.2.3",
|
|
34
|
+
"react": "^19.2.0",
|
|
35
|
+
"react-dom": "^19.2.0",
|
|
36
|
+
"react-router-dom": "^7.9.6",
|
|
37
|
+
"typescript": "^5.9.3",
|
|
38
|
+
"vite": "^7.2.4",
|
|
39
|
+
"vite-plugin-dts": "^4.5.4"
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"react": "^19.2.0",
|
|
44
|
+
"react-dom": "^19.2.0",
|
|
45
|
+
"react-router-dom": "^7.9.6",
|
|
46
|
+
"vite": "^7.2.4"
|
|
47
|
+
}
|
|
48
|
+
}
|