navilo 1.2.1 → 1.2.2

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 +30 -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
 
@@ -38,8 +31,13 @@ Navilo automatically generates a route tree from your `src/app` (or custom) dire
38
31
  ## Quick Start
39
32
 
40
33
  ### Vite Config
34
+ 1. Install react router dom since its our peer dependency
35
+ ```bash
36
+ npm install react-router-dom@6.16.0
41
37
 
42
38
  ```ts
39
+ 2.Add the navilo to plugin in vite config
40
+
43
41
  // vite.config.ts
44
42
  import {defineConfig} from 'vite';
45
43
  import react from '@vitejs/plugin-react';
@@ -55,6 +53,30 @@ export default defineConfig({
55
53
  });
56
54
  ```
57
55
 
56
+ 3. Add this vite-env.d.ts
57
+
58
+ ```ts
59
+ /// <reference types="vite/client" />
60
+ declare module 'virtual:navilo-routes' {
61
+ export const router;
62
+ }
63
+ ```
64
+
65
+ 4. Now import the router from virtual module
66
+
67
+ ```tsx
68
+ import {RouterProvider} from "react-router-dom";
69
+ import {router} from 'virtual:preluder-routes';
70
+
71
+ export function App() {
72
+ return (
73
+ <RouterProvider router={router}/>
74
+ );
75
+ }
76
+ ```
77
+
78
+ 5. 🎉 Volla now you can now use it like next js
79
+
58
80
  ### Directory Structure Example
59
81
 
60
82
  ```
@@ -170,19 +192,5 @@ const routeTree = routeTreeBuilder.build(routes, {
170
192
  | `error` | Error page for nested layouts |
171
193
  | `not-found` | 404 page |
172
194
 
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
195
 
188
196
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "navilo",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "File-based routing plugin for Vite + React applications",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",