reroute-js 0.4.4 → 0.6.0

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 (92) hide show
  1. package/README.md +141 -0
  2. package/cli/bin.d.ts +1 -1
  3. package/cli/bin.js +513 -66
  4. package/cli/bin.js.map +6 -4
  5. package/cli/index.d.ts +1 -1
  6. package/cli/index.js +378 -16
  7. package/cli/index.js.map +5 -3
  8. package/cli/src/cli.d.ts +1 -1
  9. package/cli/src/commands/boot.d.ts +1 -1
  10. package/cli/src/commands/gen.d.ts +1 -1
  11. package/cli/src/commands/gen.d.ts.map +1 -1
  12. package/cli/src/commands/init.d.ts +1 -1
  13. package/cli/src/libs/index.d.ts +3 -1
  14. package/cli/src/libs/index.d.ts.map +1 -1
  15. package/cli/src/libs/markdown-processor.d.ts +59 -0
  16. package/cli/src/libs/markdown-processor.d.ts.map +1 -0
  17. package/cli/src/libs/markdown.d.ts +33 -0
  18. package/cli/src/libs/markdown.d.ts.map +1 -0
  19. package/cli/src/libs/tailwind.d.ts +1 -1
  20. package/cli/src/libs/version.d.ts +1 -1
  21. package/core/index.d.ts +1 -1
  22. package/core/index.js +3 -3
  23. package/core/index.js.map +2 -2
  24. package/core/src/bundler/hash.d.ts +1 -1
  25. package/core/src/bundler/index.d.ts +1 -1
  26. package/core/src/bundler/transpile.d.ts +1 -1
  27. package/core/src/content/discovery.d.ts +1 -1
  28. package/core/src/content/index.d.ts +1 -1
  29. package/core/src/content/metadata.d.ts +1 -1
  30. package/core/src/content/registry.d.ts +1 -1
  31. package/core/src/index.d.ts +1 -1
  32. package/core/src/ssr/data.d.ts +1 -1
  33. package/core/src/ssr/index.d.ts +1 -1
  34. package/core/src/ssr/modules.d.ts +1 -1
  35. package/core/src/ssr/render.d.ts +1 -1
  36. package/core/src/ssr/seed.d.ts +1 -1
  37. package/core/src/template/html.d.ts +1 -1
  38. package/core/src/template/index.d.ts +1 -1
  39. package/core/src/types.d.ts +1 -1
  40. package/core/src/utils/cache.d.ts +1 -1
  41. package/core/src/utils/compression.d.ts +1 -1
  42. package/core/src/utils/index.d.ts +1 -1
  43. package/core/src/utils/mime.d.ts +1 -1
  44. package/core/src/utils/path.d.ts +1 -1
  45. package/elysia/index.d.ts +1 -1
  46. package/elysia/index.js +3 -3
  47. package/elysia/index.js.map +2 -2
  48. package/elysia/src/index.d.ts +1 -1
  49. package/elysia/src/libs/http.d.ts +1 -1
  50. package/elysia/src/libs/image.d.ts +1 -1
  51. package/elysia/src/plugin.d.ts +1 -1
  52. package/elysia/src/routes/artifacts.d.ts +1 -1
  53. package/elysia/src/routes/content.d.ts +1 -1
  54. package/elysia/src/routes/dev.d.ts +1 -1
  55. package/elysia/src/routes/image.d.ts +1 -1
  56. package/elysia/src/routes/ssr.d.ts +1 -1
  57. package/elysia/src/routes/static.d.ts +1 -1
  58. package/elysia/src/types.d.ts +1 -1
  59. package/package.json +17 -9
  60. package/react/index.d.ts +1 -1
  61. package/react/index.js +163 -66
  62. package/react/index.js.map +7 -5
  63. package/react/src/components/ClientOnly.d.ts +31 -0
  64. package/react/src/components/ClientOnly.d.ts.map +1 -0
  65. package/react/src/components/ContentRoute.d.ts +1 -1
  66. package/react/src/components/ContentRoute.d.ts.map +1 -1
  67. package/react/src/components/Image.d.ts +1 -1
  68. package/react/src/components/Link.d.ts +1 -1
  69. package/react/src/components/Link.d.ts.map +1 -1
  70. package/react/src/components/Markdown.d.ts +89 -0
  71. package/react/src/components/Markdown.d.ts.map +1 -0
  72. package/react/src/components/Outlet.d.ts +1 -1
  73. package/react/src/components/index.d.ts +3 -1
  74. package/react/src/components/index.d.ts.map +1 -1
  75. package/react/src/hooks/index.d.ts +1 -1
  76. package/react/src/hooks/useContent.d.ts +1 -1
  77. package/react/src/hooks/useData.d.ts +1 -1
  78. package/react/src/hooks/useNavigate.d.ts +1 -1
  79. package/react/src/hooks/useParams.d.ts +1 -1
  80. package/react/src/hooks/useRouter.d.ts +1 -1
  81. package/react/src/hooks/useSearchParams.d.ts +1 -1
  82. package/react/src/index.d.ts +1 -1
  83. package/react/src/providers/ContentProvider.d.ts +1 -1
  84. package/react/src/providers/RerouteProvider.d.ts +1 -1
  85. package/react/src/providers/RouterProvider.d.ts +1 -1
  86. package/react/src/providers/index.d.ts +1 -1
  87. package/react/src/types/any.d.ts +1 -1
  88. package/react/src/types/index.d.ts +1 -1
  89. package/react/src/types/router.d.ts +1 -1
  90. package/react/src/utils/content.d.ts +1 -1
  91. package/react/src/utils/head.d.ts +1 -1
  92. package/react/src/utils/index.d.ts +1 -1
package/README.md CHANGED
@@ -23,6 +23,17 @@ Reroute is a dead-simple file-based routing framework for building full-stack Re
23
23
  - 🎯 **Dynamic Imports** - Code-split content chunks for optimal loading
24
24
  - 📦 **Collection Chunking** - Individual module bundles per content item
25
25
 
26
+ ### 📝 Markdown & MDX Support
27
+ - 📄 **Native Markdown Routes** - Drop `.md` or `.mdx` files directly in your routes directory
28
+ - 🎨 **Syntax Highlighting** - Beautiful code blocks powered by Shiki with VS Code themes
29
+ - 📋 **Frontmatter Support** - YAML frontmatter for page metadata (title, description, date, etc.)
30
+ - ⚛️ **True MDX Support** - Import and use React components inside markdown with `@mdx-js/mdx`
31
+ - 🧩 **Component Composition** - Mix JSX components with markdown content seamlessly
32
+ - 🔧 **Zero Config** - Automatic detection and processing when react-markdown is installed
33
+ - 🎯 **GitHub Flavored Markdown** - Tables, task lists, strikethrough with remark-gfm
34
+ - ⚡ **Optional Dependencies** - Only bundle what you use (markdown, GFM, Shiki, MDX)
35
+ - 🧩 **Markdown Component** - Programmatic markdown rendering with `<Markdown>` component
36
+
26
37
  ### ⚛️ React Integration
27
38
  - ⚡ **React 19** - Built with the latest React version for optimal performance
28
39
  - 🪝 **Router Hooks**:
@@ -158,6 +169,136 @@ Notes:
158
169
  - Data is injected as `window.__REROUTE_DATA__` and read during hydration
159
170
  - Use with existing content features (useContent); both can be seeded in the same page
160
171
 
172
+ ## 📝 Markdown Routes
173
+
174
+ Reroute supports native markdown and MDX files as routes with frontmatter support and syntax highlighting.
175
+
176
+ ### Installation
177
+
178
+ ```bash
179
+ # Required for markdown support
180
+ bun add react-markdown
181
+
182
+ # Optional: GitHub Flavored Markdown (tables, task lists, etc.)
183
+ bun add remark-gfm
184
+
185
+ # Optional: Syntax highlighting with Shiki
186
+ bun add -d @shikijs/rehype
187
+
188
+ # Optional: MDX support (use React components in markdown)
189
+ bun add @mdx-js/mdx
190
+ ```
191
+
192
+ ### Creating Markdown Routes
193
+
194
+ Simply create `.md` files in your routes directory:
195
+
196
+ ```markdown
197
+ <!-- src/client/routes/about.md -->
198
+ ---
199
+ title: About Us
200
+ description: Learn more about our company
201
+ date: 2025-01-15
202
+ ---
203
+
204
+ # About Us
205
+
206
+ Welcome to our **amazing** company! We build great things.
207
+
208
+ ## Our Mission
209
+
210
+ We strive to create the best developer experience possible.
211
+
212
+ ```typescript
213
+ // Example code block with syntax highlighting
214
+ const greeting = "Hello, World!";
215
+ console.log(greeting);
216
+ ```
217
+
218
+ Check out our [documentation](/docs) for more info!
219
+ ```
220
+
221
+ The route will be automatically available at `/about` with:
222
+ - Automatic `<title>` and `<meta>` tag generation from frontmatter
223
+ - Syntax highlighting for code blocks (if Shiki is installed)
224
+ - GitHub Flavored Markdown support (if remark-gfm is installed)
225
+
226
+ ### Creating MDX Routes with Components
227
+
228
+ For interactive content with React components, use `.mdx` files:
229
+
230
+ ```mdx
231
+ <!-- src/client/routes/interactive.mdx -->
232
+ ---
233
+ title: Interactive Demo
234
+ description: MDX with React components
235
+ date: 2025-01-17
236
+ ---
237
+
238
+ import { Link } from 'reroute-js/react';
239
+ import { useState } from 'react';
240
+
241
+ # Interactive Content
242
+
243
+ This page uses React components!
244
+
245
+ export function Counter() {
246
+ const [count, setCount] = useState(0);
247
+ return (
248
+ <div>
249
+ <p>Count: {count}</p>
250
+ <button onClick={() => setCount(count + 1)}>
251
+ Increment
252
+ </button>
253
+ </div>
254
+ );
255
+ }
256
+
257
+ <Counter />
258
+
259
+ You can also use imported components:
260
+
261
+ <Link to="/">Go Home</Link>
262
+ ```
263
+
264
+ **MDX Support requires:**
265
+ - `@mdx-js/mdx` package installed
266
+ - `.mdx` file extension
267
+ - React components imported at the top
268
+
269
+ ### Programmatic Markdown Rendering
270
+
271
+ Use the `<Markdown>` component to render markdown content dynamically:
272
+
273
+ ```tsx
274
+ import { Markdown } from 'reroute-js/react';
275
+
276
+ export default function MyPage() {
277
+ const content = `# Hello\nThis is **markdown** content.`;
278
+
279
+ return (
280
+ <Markdown
281
+ theme="github-dark"
282
+ gfm={true}
283
+ highlight={true}
284
+ >
285
+ {content}
286
+ </Markdown>
287
+ );
288
+ }
289
+ ```
290
+
291
+ ### Features
292
+
293
+ - **Frontmatter**: YAML metadata for SEO and content organization
294
+ - **Syntax Highlighting**: Powered by Shiki via @shikijs/rehype with VS Code themes
295
+ - **GFM Support**: Tables, task lists, strikethrough, autolinks
296
+ - **MDX Support**: Import and use React components in `.mdx` files
297
+ - **Component Composition**: Mix markdown with JSX seamlessly
298
+ - **Type Safety**: Full TypeScript support
299
+ - **Zero Config**: Automatic detection when packages are installed
300
+ - **Optional**: Only bundle dependencies you actually use
301
+
161
302
 
162
303
  ## 📖 Learn More
163
304
 
package/cli/bin.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v0.4.4
2
+ * reroute-js v0.6.0
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2025 stewones <hi@stewan.io>