reroute-js 0.6.0 → 0.7.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 (114) hide show
  1. package/README.md +1 -0
  2. package/_/basic/package.json +4 -4
  3. package/_/basic/src/client/index.html +1 -1
  4. package/_/basic/src/index.ts +1 -3
  5. package/_/blog/package.json +4 -4
  6. package/_/blog/src/client/App.tsx +1 -0
  7. package/_/blog/src/client/index.html +1 -1
  8. package/_/blog/src/client/routes/blog/content/1-hello-world.tsx +1 -1
  9. package/_/blog/src/client/routes/blog/content/3-markdown-with-syntax-highlighting.mdx +213 -0
  10. package/_/blog/src/client/routes/blog/content/4-content-in-markdown.md +143 -0
  11. package/_/blog/src/client/routes/blog/content/5-mdx-with-components.mdx +267 -0
  12. package/_/blog/src/client/routes/blog/index.tsx +59 -0
  13. package/_/blog/src/client/routes/client.tsx +564 -0
  14. package/_/blog/src/client/routes/docs.tsx +670 -0
  15. package/_/blog/src/client/routes/index.tsx +37 -0
  16. package/_/blog/src/client/routes/markdown-demo.md +169 -0
  17. package/_/blog/src/client/routes/markdown.tsx +160 -0
  18. package/_/blog/src/index.ts +5 -2
  19. package/_/store/package.json +4 -4
  20. package/_/store/src/client/index.html +1 -1
  21. package/_/store/src/index.ts +1 -1
  22. package/cli/bin.d.ts +1 -1
  23. package/cli/bin.js +806 -14
  24. package/cli/bin.js.map +11 -7
  25. package/cli/index.d.ts +1 -1
  26. package/cli/index.js +52 -3
  27. package/cli/index.js.map +4 -3
  28. package/cli/src/cli.d.ts +1 -1
  29. package/cli/src/commands/boot.d.ts +1 -1
  30. package/cli/src/commands/build.d.ts +19 -0
  31. package/cli/src/commands/build.d.ts.map +1 -0
  32. package/cli/src/commands/dev.d.ts +18 -0
  33. package/cli/src/commands/dev.d.ts.map +1 -0
  34. package/cli/src/commands/gen.d.ts +1 -1
  35. package/cli/src/commands/init.d.ts +1 -1
  36. package/cli/src/commands/start.d.ts +19 -0
  37. package/cli/src/commands/start.d.ts.map +1 -0
  38. package/cli/src/libs/index.d.ts +2 -1
  39. package/cli/src/libs/index.d.ts.map +1 -1
  40. package/cli/src/libs/log.d.ts +46 -0
  41. package/cli/src/libs/log.d.ts.map +1 -0
  42. package/cli/src/libs/markdown-processor.d.ts +1 -1
  43. package/cli/src/libs/markdown.d.ts +1 -1
  44. package/cli/src/libs/tailwind.d.ts +1 -1
  45. package/cli/src/libs/version.d.ts +1 -1
  46. package/core/index.d.ts +1 -1
  47. package/core/index.js +5 -5
  48. package/core/index.js.map +3 -3
  49. package/core/src/bundler/hash.d.ts +1 -1
  50. package/core/src/bundler/index.d.ts +1 -1
  51. package/core/src/bundler/transpile.d.ts +1 -1
  52. package/core/src/content/discovery.d.ts +1 -1
  53. package/core/src/content/index.d.ts +1 -1
  54. package/core/src/content/metadata.d.ts +1 -1
  55. package/core/src/content/registry.d.ts +1 -1
  56. package/core/src/index.d.ts +1 -1
  57. package/core/src/ssr/data.d.ts +1 -1
  58. package/core/src/ssr/index.d.ts +1 -1
  59. package/core/src/ssr/modules.d.ts +1 -1
  60. package/core/src/ssr/render.d.ts +1 -1
  61. package/core/src/ssr/seed.d.ts +1 -1
  62. package/core/src/template/html.d.ts +1 -1
  63. package/core/src/template/index.d.ts +1 -1
  64. package/core/src/types.d.ts +1 -1
  65. package/core/src/utils/cache.d.ts +1 -1
  66. package/core/src/utils/compression.d.ts +1 -1
  67. package/core/src/utils/index.d.ts +1 -1
  68. package/core/src/utils/mime.d.ts +1 -1
  69. package/core/src/utils/path.d.ts +1 -1
  70. package/elysia/index.d.ts +1 -1
  71. package/elysia/index.js +5 -5
  72. package/elysia/index.js.map +3 -3
  73. package/elysia/src/index.d.ts +1 -1
  74. package/elysia/src/libs/http.d.ts +1 -1
  75. package/elysia/src/libs/image.d.ts +1 -1
  76. package/elysia/src/plugin.d.ts +1 -1
  77. package/elysia/src/routes/artifacts.d.ts +1 -1
  78. package/elysia/src/routes/content.d.ts +1 -1
  79. package/elysia/src/routes/dev.d.ts +1 -1
  80. package/elysia/src/routes/image.d.ts +1 -1
  81. package/elysia/src/routes/ssr.d.ts +1 -1
  82. package/elysia/src/routes/static.d.ts +1 -1
  83. package/elysia/src/types.d.ts +1 -1
  84. package/package.json +6 -1
  85. package/react/index.d.ts +1 -1
  86. package/react/index.js +50 -24
  87. package/react/index.js.map +3 -3
  88. package/react/src/components/ClientOnly.d.ts +1 -1
  89. package/react/src/components/ContentRoute.d.ts +1 -1
  90. package/react/src/components/Image.d.ts +1 -1
  91. package/react/src/components/Link.d.ts +1 -1
  92. package/react/src/components/Markdown.d.ts +1 -1
  93. package/react/src/components/Outlet.d.ts +1 -1
  94. package/react/src/components/index.d.ts +1 -1
  95. package/react/src/hooks/index.d.ts +1 -1
  96. package/react/src/hooks/useContent.d.ts +1 -1
  97. package/react/src/hooks/useData.d.ts +1 -1
  98. package/react/src/hooks/useNavigate.d.ts +1 -1
  99. package/react/src/hooks/useParams.d.ts +1 -1
  100. package/react/src/hooks/useRouter.d.ts +1 -1
  101. package/react/src/hooks/useSearchParams.d.ts +1 -1
  102. package/react/src/index.d.ts +1 -1
  103. package/react/src/providers/ContentProvider.d.ts +1 -1
  104. package/react/src/providers/RerouteProvider.d.ts +1 -1
  105. package/react/src/providers/RouterProvider.d.ts +1 -1
  106. package/react/src/providers/RouterProvider.d.ts.map +1 -1
  107. package/react/src/providers/index.d.ts +1 -1
  108. package/react/src/types/any.d.ts +1 -1
  109. package/react/src/types/index.d.ts +1 -1
  110. package/react/src/types/router.d.ts +1 -1
  111. package/react/src/utils/content.d.ts +1 -1
  112. package/react/src/utils/head.d.ts +1 -1
  113. package/react/src/utils/index.d.ts +1 -1
  114. package/_/blog/src/client/components/Counter.tsx +0 -14
@@ -0,0 +1,169 @@
1
+ ---
2
+ title: Markdown Routes Demo
3
+ description: This page is rendered directly from a markdown file in the routes directory
4
+ date: 2025-01-15
5
+ slug: markdown-demo
6
+ excerpt: Learn how Reroute natively supports markdown files as routes with frontmatter
7
+ ---
8
+
9
+ # Native Markdown Routes
10
+
11
+ Welcome to a page that's **entirely written in markdown**! This file lives in `src/client/routes/markdown-demo.md` and is automatically converted to a route by Reroute.
12
+
13
+ ## How It Works
14
+
15
+ 1. Drop a `.md` or `.mdx` file in your routes directory
16
+ 2. Add frontmatter at the top for metadata
17
+ 3. Reroute automatically converts it to a React component
18
+ 4. The route is available at the filename path
19
+
20
+ ## Frontmatter Support
21
+
22
+ The metadata at the top of this file (between `---` delimiters) becomes the page's meta tags:
23
+
24
+ ```yaml
25
+ ---
26
+ title: Markdown Routes Demo
27
+ description: This page is rendered directly from a markdown file
28
+ date: 2025-01-15
29
+ slug: markdown-demo
30
+ ---
31
+ ```
32
+
33
+ This data is used for:
34
+ - `<title>` tags
35
+ - `<meta name="description">` tags
36
+ - Open Graph and Twitter cards
37
+ - Content collections
38
+
39
+ ## Syntax Highlighting
40
+
41
+ Code blocks automatically get syntax highlighting with Shiki:
42
+
43
+ ### TypeScript
44
+
45
+ ```typescript
46
+ interface BlogPost {
47
+ title: string;
48
+ slug: string;
49
+ date: string;
50
+ content: string;
51
+ }
52
+
53
+ async function getPost(slug: string): Promise<BlogPost> {
54
+ const response = await fetch(`/api/posts/${slug}`);
55
+ return response.json();
56
+ }
57
+ ```
58
+
59
+ ### JavaScript
60
+
61
+ ```javascript
62
+ const fibonacci = (n) => {
63
+ if (n <= 1) return n;
64
+ return fibonacci(n - 1) + fibonacci(n - 2);
65
+ };
66
+
67
+ console.log(fibonacci(10));
68
+ ```
69
+
70
+ ### Bash
71
+
72
+ ```bash
73
+ # Install Reroute
74
+ bunx reroute-js init my-blog --template blog
75
+
76
+ # Navigate and start
77
+ cd my-blog
78
+ bun dev
79
+ ```
80
+
81
+ ## Rich Formatting
82
+
83
+ You can use all standard markdown features:
84
+
85
+ ### Lists
86
+
87
+ **Unordered:**
88
+ - First item
89
+ - Second item with **bold text**
90
+ - Third item with *italic text*
91
+ - Fourth item with `inline code`
92
+
93
+ **Ordered:**
94
+ 1. Step one
95
+ 2. Step two
96
+ 3. Step three
97
+
98
+ ### Task Lists
99
+
100
+ - [x] Create markdown processor
101
+ - [x] Add frontmatter support
102
+ - [x] Integrate with routing system
103
+ - [ ] Add more examples
104
+
105
+ ### Blockquotes
106
+
107
+ > "The best way to predict the future is to invent it."
108
+ > — Alan Kay
109
+
110
+ ### Tables
111
+
112
+ | Feature | Status | Package |
113
+ |---------|--------|---------|
114
+ | Markdown Routes | ✅ | Built-in |
115
+ | Frontmatter | ✅ | Built-in |
116
+ | Syntax Highlighting | ✅ | shiki |
117
+ | GFM Support | ✅ | remark-gfm |
118
+
119
+ ### Text Styling
120
+
121
+ You can use **bold**, *italic*, ***bold and italic***, ~~strikethrough~~, and `inline code`.
122
+
123
+ ### Links
124
+
125
+ Check out the [Reroute repository](https://github.com/stewones/reroute) on GitHub!
126
+
127
+ ## Horizontal Rule
128
+
129
+ ---
130
+
131
+ ## Why Markdown Routes?
132
+
133
+ Markdown routes are perfect for:
134
+
135
+ - 📝 **Blog posts** - Write content without JSX boilerplate
136
+ - 📚 **Documentation** - Focus on content, not components
137
+ - 📄 **Static pages** - About, terms, privacy policy, etc.
138
+ - ⚡ **Fast authoring** - Use any markdown editor
139
+
140
+ ## Under the Hood
141
+
142
+ When you run `reroute gen`:
143
+
144
+ 1. The CLI scans for `.md` and `.mdx` files
145
+ 2. Parses frontmatter using a built-in parser
146
+ 3. Generates a React component wrapper
147
+ 4. Saves it to `.reroute/markdown/`
148
+ 5. Routes system imports it like any other route
149
+
150
+ The generated component uses the `<Markdown>` component with optional Shiki highlighting and GFM support!
151
+
152
+ ## Next Steps
153
+
154
+ Try creating your own markdown routes:
155
+
156
+ ```bash
157
+ # Create a new markdown file
158
+ touch src/client/routes/my-page.md
159
+
160
+ # Add some frontmatter and content
161
+ # Run the generator
162
+ bun dev
163
+ ```
164
+
165
+ Your page will be available at `/my-page`!
166
+
167
+ ---
168
+
169
+ *This entire page was written in plain markdown* ✨
@@ -0,0 +1,160 @@
1
+ import { Link, Markdown } from 'reroute-js/react';
2
+
3
+ export default function MarkdownDemo() {
4
+ const exampleContent = `
5
+ # Markdown Demo Page
6
+
7
+ Welcome to the **Markdown demo**! This page demonstrates Reroute's native markdown support with syntax highlighting.
8
+
9
+ ## Quick Start
10
+
11
+ Simply import the \`Markdown\` component and pass your content:
12
+
13
+ \`\`\`tsx
14
+ import { Markdown } from 'reroute-js/react';
15
+
16
+ <Markdown>
17
+ # Your content here
18
+ </Markdown>
19
+ \`\`\`
20
+
21
+ ## Code Examples
22
+
23
+ ### JavaScript
24
+
25
+ \`\`\`javascript
26
+ const greet = (name) => {
27
+ console.log(\`Hello, \${name}!\`);
28
+ };
29
+
30
+ greet('Reroute');
31
+ \`\`\`
32
+
33
+ ### TypeScript
34
+
35
+ \`\`\`typescript
36
+ interface Route {
37
+ path: string;
38
+ component: React.ComponentType;
39
+ }
40
+
41
+ const routes: Route[] = [
42
+ { path: '/', component: HomePage },
43
+ { path: '/blog', component: BlogPage },
44
+ ];
45
+ \`\`\`
46
+
47
+ ### JSON
48
+
49
+ \`\`\`json
50
+ {
51
+ "name": "reroute-app",
52
+ "version": "1.0.0",
53
+ "dependencies": {
54
+ "react-markdown": "^10.1.0",
55
+ "shiki": "^3.14.0"
56
+ }
57
+ }
58
+ \`\`\`
59
+
60
+ ## Lists and Formatting
61
+
62
+ ### Unordered List
63
+ - Item one
64
+ - Item two with **bold text**
65
+ - Item three with *italic text*
66
+ - Item four with \`inline code\`
67
+
68
+ ### Ordered List
69
+ 1. First step
70
+ 2. Second step
71
+ 3. Third step
72
+
73
+ ### Task List
74
+ - [x] Add markdown support
75
+ - [x] Integrate Shiki
76
+ - [x] Create examples
77
+ - [ ] Add more themes
78
+
79
+ ## Blockquotes
80
+
81
+ > "Markdown makes writing for the web easy and enjoyable."
82
+ > — Someone who loves markdown
83
+
84
+ ## Tables
85
+
86
+ | Package | Purpose | Required |
87
+ |---------|---------|----------|
88
+ | react-markdown | Markdown renderer | ✅ Yes |
89
+ | remark-gfm | GitHub features | 🔶 Optional |
90
+ | shiki | Syntax highlighting | 🔶 Optional |
91
+
92
+ ## Links and Emphasis
93
+
94
+ Check out the [Reroute documentation](https://github.com/stewones/reroute) for more info!
95
+
96
+ You can use **bold**, *italic*, ***bold and italic***, ~~strikethrough~~, and \`inline code\`.
97
+
98
+ ## Horizontal Rule
99
+
100
+ ---
101
+
102
+ That's all for this demo! 🚀
103
+ `;
104
+
105
+ return (
106
+ <main style={{ padding: '2rem', maxWidth: '900px', margin: '0 auto' }}>
107
+ <nav style={{ marginBottom: '2rem' }}>
108
+ <Link
109
+ to='/'
110
+ style={{
111
+ padding: '0.5rem 1rem',
112
+ background: '#0066cc',
113
+ color: '#fff',
114
+ textDecoration: 'none',
115
+ borderRadius: '4px',
116
+ display: 'inline-block',
117
+ }}
118
+ >
119
+ ← Back to Home
120
+ </Link>
121
+ </nav>
122
+
123
+ <div
124
+ style={{
125
+ background: '#1e1e1e',
126
+ padding: '2rem',
127
+ borderRadius: '8px',
128
+ color: '#d4d4d4',
129
+ }}
130
+ >
131
+ <Markdown theme='github-dark' gfm={true} highlight={true}>
132
+ {exampleContent}
133
+ </Markdown>
134
+ </div>
135
+
136
+ <section
137
+ style={{
138
+ marginTop: '2rem',
139
+ padding: '1rem',
140
+ background: '#f0f9ff',
141
+ borderRadius: '8px',
142
+ border: '1px solid #bfdbfe',
143
+ }}
144
+ >
145
+ <h3 style={{ marginTop: 0, color: '#1e40af' }}>💡 Pro Tips</h3>
146
+ <ul style={{ color: '#1e3a8a' }}>
147
+ <li>
148
+ The Markdown component only bundles dependencies you actually use
149
+ </li>
150
+ <li>Shiki provides VS Code-quality syntax highlighting</li>
151
+ <li>
152
+ GitHub Flavored Markdown adds tables, task lists, and more (with
153
+ remark-gfm)
154
+ </li>
155
+ <li>Customize themes and components for your design system</li>
156
+ </ul>
157
+ </section>
158
+ </main>
159
+ );
160
+ }
@@ -12,9 +12,12 @@ const app = new Elysia()
12
12
  minify: IS_PRODUCTION,
13
13
  }),
14
14
  )
15
- .get('/message', () => ({ message: 'Hello from server' }))
15
+ .get('/message', () => {
16
+ console.log('[api] log from my api');
17
+ return { message: 'Hello from server' };
18
+ })
16
19
  .listen(Number(Bun.env.PORT || '3000'));
17
20
 
18
21
  console.log(
19
- `🦊 Elysia Reroute is running at ${app.server?.hostname}:${app.server?.port} on ${Bun.env.NODE_ENV || 'development'}`,
22
+ `[reroute] Blog running at ${app.server?.hostname}:${app.server?.port} on ${Bun.env.NODE_ENV || 'development'}`,
20
23
  );
@@ -4,10 +4,10 @@
4
4
  "description": "A Reroute store application with Tailwind CSS v4",
5
5
  "private": true,
6
6
  "scripts": {
7
- "postinstall": "reroute boot",
8
- "start": "reroute gen && bun src/index.ts",
9
- "dev": "reroute gen --watch & bun --watch src/index.ts",
10
- "build": "reroute gen && bun build src/index.ts --target bun --compile --outfile ./dist/app"
7
+ "types": "tsc --noEmit",
8
+ "start": "reroute start",
9
+ "dev": "reroute dev",
10
+ "build": "reroute build"
11
11
  },
12
12
  "dependencies": {
13
13
  "reroute-js": "latest",
@@ -2,7 +2,7 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
- <title>{{PROJECT_NAME}}</title>
5
+ <title>Reroute Store - E-commerce Demo</title>
6
6
 
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
8
  <meta
@@ -16,5 +16,5 @@ const app = new Elysia()
16
16
  .listen(Number(Bun.env.PORT || '3001'));
17
17
 
18
18
  console.log(
19
- `🛒 Reroute Store is running at ${app.server?.hostname}:${app.server?.port} on ${Bun.env.NODE_ENV || 'development'}`,
19
+ `[reroute] Store running at ${app.server?.hostname}:${app.server?.port} on ${Bun.env.NODE_ENV || 'development'}`,
20
20
  );
package/cli/bin.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * reroute-js v0.6.0
2
+ * reroute-js v0.7.0
3
3
  *
4
4
  * @license MIT
5
5
  * @copyright 2025 stewones <hi@stewan.io>