navilo 1.2.1 → 1.2.3

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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -22
  3. package/package.json +1 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Zubeyr Anwar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -4,20 +4,13 @@
4
4
  ![License](https://img.shields.io/npm/l/navilo)
5
5
  ![TypeScript](https://img.shields.io/badge/TypeScript-%3E%3D5.0-blue)
6
6
 
7
- **File-based routing plugin for Vite + React applications**
7
+ **A Vite plugin that adds file-based routing to React apps by wrapping React Router (peer dependency)**
8
8
 
9
9
  ---
10
10
 
11
11
  ## Installation
12
12
 
13
13
  ```bash
14
- # Using npm
15
- npm install navilo
16
-
17
- # Using yarn
18
- yarn add navilo
19
-
20
- # Using pnpm
21
14
  pnpm add navilo
22
15
  ```
23
16
 
@@ -39,6 +32,15 @@ Navilo automatically generates a route tree from your `src/app` (or custom) dire
39
32
 
40
33
  ### Vite Config
41
34
 
35
+ 1. Install react router dom since its our peer dependency
36
+
37
+ ```bash
38
+ npm install react-router-dom@6.16.0
39
+
40
+ ```
41
+
42
+ 2.Add the navilo to plugin in vite config
43
+
42
44
  ```ts
43
45
  // vite.config.ts
44
46
  import {defineConfig} from 'vite';
@@ -55,6 +57,30 @@ export default defineConfig({
55
57
  });
56
58
  ```
57
59
 
60
+ 3. Add this vite-env.d.ts
61
+
62
+ ```ts
63
+ /// <reference types="vite/client" />
64
+ declare module 'virtual:navilo-routes' {
65
+ export const router;
66
+ }
67
+ ```
68
+
69
+ 4. Now import the router from virtual module
70
+
71
+ ```tsx
72
+ import {RouterProvider} from "react-router-dom";
73
+ import {router} from 'virtual:preluder-routes';
74
+
75
+ export function App() {
76
+ return (
77
+ <RouterProvider router={router}/>
78
+ );
79
+ }
80
+ ```
81
+
82
+ 5. 🎉 Volla now you can now use it like next js
83
+
58
84
  ### Directory Structure Example
59
85
 
60
86
  ```
@@ -170,19 +196,5 @@ const routeTree = routeTreeBuilder.build(routes, {
170
196
  | `error` | Error page for nested layouts |
171
197
  | `not-found` | 404 page |
172
198
 
173
- ---
174
-
175
- ## Example React Router Usage
176
-
177
- ```tsx
178
- import {RouterProvider} from "react-router-dom";
179
- import {router} from 'virtual:preluder-routes';
180
-
181
- export function App() {
182
- return (
183
- <RouterProvider router={router}/>
184
- );
185
- }
186
- ```
187
199
 
188
200
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "navilo",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "File-based routing plugin for Vite + React applications",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",