next-vite-router 1.0.2 → 1.0.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 (2) hide show
  1. package/README.md +16 -20
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -59,6 +59,21 @@ Notes:
59
59
  - The plugin default `pagesDir` is `src/app`. You can change it via options.
60
60
  - The virtual module is `virtual:next-vite-router` (the plugin resolves it internally).
61
61
 
62
+ TypeScript note:
63
+
64
+ If you're using TypeScript in a consuming project, add a declaration file so the virtual module is recognized by the compiler. Create a file such as `src/virtual.d.ts` (or any `*.d.ts` included by your `tsconfig.json`) with the following content:
65
+
66
+ ```ts
67
+ declare module 'virtual:next-vite-router' {
68
+ import type { RouteObject } from 'react-router-dom';
69
+
70
+ export const generateRoutes: () => RouteObject[];
71
+ export { useRoutes } from 'react-router-dom';
72
+ }
73
+ ```
74
+
75
+ This ensures TypeScript knows the shape of the virtual module provided by the Vite plugin and avoids `Cannot find module 'virtual:next-vite-router'` errors in editors and builds.
76
+
62
77
  ## Programmatic route generation
63
78
 
64
79
  If you prefer to generate routes manually (for custom setups), the package exports helpers you can use with `import.meta.glob`.
@@ -153,25 +168,6 @@ The plugin takes an options object. Defaults are:
153
168
 
154
169
  Pass a custom `pagesDir` if your project uses `src/pages` or another convention.
155
170
 
156
- ## Examples & Demos
157
-
158
- If you want, I can add a small demo app showing:
159
-
160
- - A minimal `src/pages` layout with nested layouts
161
- - How `generateRoutes()` maps files to React Router routes
162
- - A Vite dev server example showing HMR for page/layout changes
163
-
164
- Tell me which example you'd prefer and I will scaffold it.
165
-
166
- ## Contributing
167
-
168
- Contributions welcome. Suggested workflow:
169
-
170
- 1. Fork the repo
171
- 2. Create a branch
172
- 3. Run `pnpm install` and `pnpm run dev` to test locally
173
- 4. Open a PR with description and tests/examples if applicable
174
-
175
171
  ## License
176
172
 
177
- MIT
173
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-vite-router",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Next.js-like file-based routing for React + Vite",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",