@revijs/core 0.1.3 → 0.1.5

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.
package/LICENSE CHANGED
@@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
+
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # ⚡ ReviJs 🧙‍♂️
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/revijs?style=flat-square&color=blueviolet)](https://www.npmjs.com/package/@revijs/core)
4
- [![npm downloads](https://img.shields.io/npm/dm/revijs?style=flat-square&color=brightgreen)](https://www.npmjs.com/package/@revijs/core)
3
+ [![npm version](https://img.shields.io/npm/v/@revijs/core?style=flat-square&color=blueviolet)](https://www.npmjs.com/package/@revijs/core)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@revijs/core?style=flat-square&color=brightgreen)](https://www.npmjs.com/package/@revijs/core)
5
5
  [![MIT License](https://img.shields.io/badge/license-MIT-green?style=flat-square)](LICENSE)
6
6
  [![Made by AlphaBotz](https://img.shields.io/badge/🤖%20Made%20by-AlphaBotz-blueviolet?style=flat-square)](https://github.com/TeamAlphabotz)
7
7
  [![Node.js](https://img.shields.io/badge/Node.js-18+-brightgreen?style=flat-square&logo=node.js)](https://nodejs.org/)
@@ -11,11 +11,24 @@
11
11
 
12
12
  ---
13
13
 
14
+ ## 🔗 Quick Links
15
+
16
+ - 📖 [Full Documentation](https://teamalphabotz.github.io/Revijs/)
17
+ - 🚀 [Getting Started](https://teamalphabotz.github.io/Revijs/#start)
18
+ - ⚙️ [Configuration](https://teamalphabotz.github.io/Revijs/#config)
19
+ - 🔌 [API Reference](https://teamalphabotz.github.io/Revijs/#api)
20
+ - 🧩 [Middleware](https://teamalphabotz.github.io/Revijs/#middleware)
21
+ - 💡 [Examples](https://teamalphabotz.github.io/Revijs/#examples)
22
+ - 🐙 [GitHub Repository](https://github.com/TeamAlphabotz/Revijs)
23
+ - 📦 [npm Package](https://www.npmjs.com/package/@revijs/core)
24
+
25
+ ---
26
+
14
27
  ## 🎯 What's ReviJs?
15
28
 
16
29
  Tired of your fancy React/Vite app being invisible to Google? 😱 ReviJs is here to save the day!
17
30
 
18
- ReviJs **spins up a headless browser**, visits every route in your app, waits for data to load, and captures the fully-rendered HTML. Then it serves that pre-baked HTML to search engines while your users still get the smooth SPA experience.
31
+ ReviJs **spins up a headless browser**, visits every route in your app, waits for data to load, and captures the fully-rendered HTML. Then it serves that pre-baked HTML to search engines while your users still get the smooth SPA experience.
19
32
 
20
33
  It's like having your cake and eating it too. 🍰
21
34
 
@@ -23,41 +36,26 @@ It's like having your cake and eating it too. 🍰
23
36
 
24
37
  ## ⚙️ Requirements
25
38
 
26
- Before you summon the ReviJs wizard, make sure you have these installed:
27
-
28
- ### System Requirements
29
- - **Node.js**: `>=18.0.0` (LTS recommended)
30
- - **npm**: `>=9.0.0` or **yarn** / **pnpm**
31
- - **Operating System**: macOS, Linux, Windows
32
-
33
- ### Project Requirements
34
- - A **React** or **Vite** project
35
- - Built output in a `dist/` folder (or customizable)
36
- - Node-like environment for running the CLI
37
-
38
- ### Package Dependencies
39
-
40
- The `@revijs/core` package automatically installs its dependencies:
41
- - **puppeteer** (headless browser automation)
42
- - **express** (local server)
43
- - **fast-glob** (route discovery)
44
- - **dotenv** (env config)
39
+ - **Node.js**: `>=18.0.0`
40
+ - **npm**: `>=9.0.0` or yarn / pnpm
41
+ - **OS**: macOS, Linux, Windows
42
+ - A built React / Vite / Vue / Svelte app
45
43
 
46
44
  ---
47
45
 
48
46
  ## 🚀 Quick Start (30 seconds!)
49
47
 
50
48
  ```bash
51
- # 1️⃣ Install the magic
52
- npm install revijs
49
+ # 1️⃣ Install
50
+ npm install @revijs/core
53
51
 
54
- # 2️⃣ Initialize config (interactive)
52
+ # 2️⃣ Initialize config
55
53
  npx revijs init
56
54
 
57
- # 3️⃣ Build your app normally
55
+ # 3️⃣ Build your app
58
56
  npm run build
59
57
 
60
- # 4️⃣ Let the prerendering begin! 🎆
58
+ # 4️⃣ Prerender!
61
59
  npx revijs
62
60
  ```
63
61
 
@@ -67,289 +65,55 @@ npx revijs
67
65
 
68
66
  ## 🛠️ Configuration (`revi.config.js`)
69
67
 
70
- Customize your prerendering experience:
71
-
72
68
  ```js
73
69
  export default {
74
- // 🌍 Routes to prerender
75
- routes: ['/', '/about', '/blog/post-1', '/products'],
76
-
77
- // 🎮 Rendering engine
70
+ routes: ['/', '/about', '/blog/post-1'],
78
71
  engine: 'browser', // 'browser' | 'advanced' | 'ssr'
79
-
80
- // 📁 Output settings
81
72
  outputDir: 'dist-prerendered',
82
73
  distDir: 'dist',
83
-
84
- // ⏱️ Wait for data (adjust if routes are slow)
85
- waitFor: 1200, // milliseconds after network idle
86
-
87
- // 🕵️ Browser settings
74
+ waitFor: 1200, // ms after network idle
88
75
  headless: true,
89
76
  port: 4173,
90
-
91
- // 🎯 Optional: exclude routes
92
- exclude: ['/admin', '/dashboard'],
93
-
94
- // 📸 Optional: capture screenshots
95
- screenshots: false,
96
77
  };
97
78
  ```
98
79
 
99
- ### Config Options Explained
100
- | Option | Type | Default | What It Does |
101
- |--------|------|---------|--------------|
102
- | `routes` | Array | `[]` | Routes to prerender (required!) |
103
- | `engine` | String | `'browser'` | How to render (browser is safest) |
104
- | `outputDir` | String | `'dist-prerendered'` | Where to save static HTML |
105
- | `distDir` | String | `'dist'` | Your built app location |
106
- | `waitFor` | Number | `1200` | ms to wait after network idle |
107
- | `headless` | Boolean | `true` | Run browser hidden? |
108
- | `port` | Number | `4173` | Local server port |
109
-
110
80
  ---
111
81
 
112
- ## 🎪 How the Magic Works (Under the Hood)
113
-
114
- ```
115
- ┌─────────────────────────────────────────────────────┐
116
- │ You run: npm run build │
117
- │ Then: npx revijs │
118
- └─────────────────┬───────────────────────────────────┘
119
-
120
- ┌─────────▼──────────┐
121
- │ Start Local Server │
122
- └���────────┬──────────┘
123
-
124
- ┌─────────▼──────────────────┐
125
- │ Launch Headless Browser 🤖 │
126
- └─────────┬──────────────────┘
127
-
128
- ┌─────────▼────────────────────────┐
129
- │ Visit Each Route in Your App │
130
- │ (/, /about, /blog/post-1, etc) │
131
- └─────────┬────────────────────────┘
132
-
133
- ┌─────────▼──────────────────────┐
134
- │ Wait for All Data to Load ⏳ │
135
- │ (Network Idle + waitFor ms) │
136
- └─────────┬──────────────────────┘
137
-
138
- ┌─────────▼──────────────────────┐
139
- │ Capture Full Rendered HTML 📸 │
140
- └─────────┬──────────────────────┘
141
-
142
- ┌─────────▼──────────────────────┐
143
- │ Write Static Files to Disk 💾 │
144
- │ (dist-prerendered/) │
145
- └─────────┬──────────────────────┘
146
-
147
- ┌─────────▼──────────────────────┐
148
- │ 🎉 Done! Static HTML Ready │
149
- └──────────────────────────────────┘
150
- ```
151
-
152
- ---
153
-
154
- ## 🧩 Middleware Magic (Serve Bots vs Humans)
155
-
156
- Automatically detect bots and serve them pre-rendered HTML:
82
+ ## 🧩 Middleware
157
83
 
158
84
  ```js
159
85
  import express from 'express';
160
- import { createMiddleware } from 'revijs';
86
+ import { createMiddleware } from '@revijs/core';
161
87
 
162
88
  const app = express();
163
-
164
- // 🤖 ReviJs middleware intercepts bot requests
165
- app.use(createMiddleware({
166
- prerenderedDir: 'dist-prerendered',
167
- botDetection: true, // Auto-detect crawlers
168
- }));
169
-
170
- // Serve your SPA normally
89
+ app.use(createMiddleware({ prerenderedDir: 'dist-prerendered' }));
171
90
  app.use(express.static('dist'));
172
-
173
- app.listen(4173, () => {
174
- console.log('🚀 Server running with ReviJs magic!');
175
- });
91
+ app.listen(3000);
176
92
  ```
177
93
 
178
- **What happens:**
179
- - 🤖 **Bot visits** → Serves prerendered static HTML (instant SEO)
180
- - 👤 **User visits** → Serves your React app (smooth SPA experience)
181
- - 🎯 **Win-win!**
182
-
183
94
  ---
184
95
 
185
- ## 🤖 Programmatic API (For Advanced Wizards)
186
-
187
- Use ReviJs in your own scripts:
96
+ ## 🤖 Programmatic API
188
97
 
189
98
  ```js
190
- import { prerender } from 'revijs';
99
+ import { prerender } from '@revijs/core';
191
100
 
192
- // Programmatically prerender
193
- const result = await prerender({
194
- routes: ['/', '/about', '/contact'],
101
+ await prerender({
102
+ routes: ['/', '/about'],
195
103
  outputDir: 'dist-prerendered',
196
- distDir: 'dist',
197
- engine: 'browser',
198
- headless: true,
199
- waitFor: 1500,
200
- onProgress: (route) => console.log(`✅ Prerendered: ${route}`),
201
- onError: (route, error) => console.error(`❌ Error on ${route}:`, error),
202
104
  });
203
-
204
- console.log(`✨ Prerendered ${result.count} routes!`);
205
105
  ```
206
106
 
207
107
  ---
208
108
 
209
- ## 🔥 Real-World Examples
210
-
211
- ### Example 1: Blog Site
212
- ```js
213
- export default {
214
- routes: ['/', '/blog', '/blog/post-1', '/blog/post-2', '/about'],
215
- engine: 'browser',
216
- waitFor: 2000, // Wait longer for blog content
217
- };
218
- ```
219
-
220
- ### Example 2: E-Commerce
221
- ```js
222
- export default {
223
- routes: ['/', '/products', '/products/item-1', '/cart', '/checkout'],
224
- engine: 'browser',
225
- waitFor: 1500,
226
- exclude: ['/admin', '/dashboard'],
227
- };
228
- ```
229
-
230
- ### Example 3: SaaS App
231
- ```js
232
- export default {
233
- routes: ['/'],
234
- engine: 'browser',
235
- waitFor: 1200,
236
- exclude: ['/app/*', '/dashboard/*'],
237
- };
238
- ```
239
-
240
- ---
241
-
242
- ## 💡 Pro Tips & Tricks
243
-
244
- ### 🎯 Tip 1: Optimize Your Routes
245
- ```js
246
- // ❌ Too slow: Pre-rendering every possible page
247
- routes: ['/blog/post-' + Array.from({length: 10000}, (_, i) => i)],
248
-
249
- // ✅ Better: Pre-render the important ones
250
- routes: ['/', '/blog', '/blog/popular-posts', '/about', '/contact'],
251
- ```
252
-
253
- ### ⏱️ Tip 2: Adjust `waitFor` for Your App
254
- ```js
255
- // If your data loads fast:
256
- waitFor: 800,
257
-
258
- // If you fetch from slow APIs:
259
- waitFor: 3000,
260
-
261
- // Pro: Add a loading flag to your app
262
- if (document.body.dataset.loaded === 'true') {
263
- // Tell ReviJs we're ready
264
- }
265
- ```
266
-
267
- ### 🔄 Tip 3: Combine with Build Scripts
268
- ```json
269
- {
270
- "scripts": {
271
- "build": "vite build",
272
- "prerender": "npm run build && revijs",
273
- "deploy": "npm run prerender && netlify deploy"
274
- }
275
- }
276
- ```
277
-
278
- ---
279
-
280
- ## 🚨 Troubleshooting
281
-
282
- | Problem | Solution |
283
- |---------|----------|
284
- | ⏳ Routes timing out | Increase `waitFor` value (try 2000) |
285
- | 🚫 Routes not found | Check `routes` array in config |
286
- | 💾 No output files | Ensure `distDir` exists and is built |
287
- | 🤖 Browser won't start | Update Puppeteer: `npm install puppeteer@latest` |
288
- | 🔴 Port already in use | Change `port` in config or kill process |
289
-
290
- ---
291
-
292
- ## 🎬 Features Roadmap
293
-
294
- - ✅ Browser rendering
295
- - ✅ Express middleware
296
- - ✅ Programmatic API
297
- - 🚀 Advanced rendering mode
298
- - 🚀 SSR engine support
299
- - 🚀 Incremental prerendering
300
- - 🚀 Cache layer
301
-
302
- ---
303
-
304
- ## 👨‍💻 Meet the Team
305
-
306
- This project is made with ❤️ by the AlphaBotz crew:
109
+ ## 👨‍💻 Team
307
110
 
308
111
  | Name | Role | Link |
309
112
  |------|------|------|
310
113
  | **Utkarsh Dubey** 🧑‍💻 | Core Developer | [@utkarshdubey2008](https://github.com/utkarshdubey2008) |
311
114
  | **Adarsh** 🚀 | Core Developer | [@TeamAlphabotz](https://github.com/teamalphabotz) |
312
115
 
313
- ### 🤝 Join the Community!
314
-
315
- - 📢 **Main Channel**: [@thealphabotz](https://t.me/thealphabotz)
316
- - 💬 **Chat Group**: [@alphabotzchat](https://t.me/alphabotzchat)
317
- - 👤 **Alter**: [@alter69x](https://t.me/alter69x)
318
- - 🎨 **Akane**: [@akanesakuramori](https://t.me/akanesakuramori)
319
-
320
- **We're always hanging out on Telegram!** Come for the bots, stay for the vibes. 🎉
321
-
322
- ---
323
-
324
- ## 📊 Stats & Performance
325
-
326
- | Metric | Benefit |
327
- |--------|---------|
328
- | **SEO Score** | 📈 100/100 (with prerendering) |
329
- | **Initial Load** | ⚡ Instant (static HTML) |
330
- | **User Experience** | 🎯 Smooth SPA after load |
331
- | **Cloud Cost** | 💰 Zero (local-first) |
332
- | **Setup Time** | ⏱️ 30 seconds |
333
-
334
- ---
335
-
336
- ## 📚 More Resources
337
-
338
- - 🐙 [GitHub Repository](https://github.com/TeamAlphabotz/Revijs)
339
- - 📦 [npm Package](https://www.npmjs.com/package/@revijs/core)
340
- - 💬 [Discord Community](#) *(coming soon)*
341
- - 📖 [Full Documentation](#) *(coming soon)*
342
-
343
- ---
344
-
345
- ## 🎁 Why You'll Love ReviJs
346
-
347
- ✨ **Easy Setup** — 30 seconds to get started
348
- 🚀 **No Cloud** — Everything runs locally
349
- ⚡ **Lightning Fast** — Pre-built static HTML
350
- 🎯 **SEO Friendly** — Search engines see full HTML
351
- 🔧 **Flexible** — Works with React, Vue, Svelte, etc.
352
- 💚 **Free & Open** — MIT License, community-driven
116
+ 💬 **Telegram**: [@thealphabotz](https://t.me/thealphabotz) · [@alphabotzchat](https://t.me/alphabotzchat)
353
117
 
354
118
  ---
355
119
 
@@ -359,12 +123,6 @@ This project is made with ❤️ by the AlphaBotz crew:
359
123
 
360
124
  ---
361
125
 
362
- ## 🌟 If You Like It...
363
-
364
- Please give us a ⭐ on [GitHub](https://github.com/TeamAlphabotz/Revijs)!
365
-
366
- ---
367
-
368
126
  <div align="center">
369
127
 
370
128
  ### Made with 💜 by AlphaBotz
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revijs/core",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Local-first SPA prerender CLI — convert React/Vite apps into SEO-friendly static HTML",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/cli.js CHANGED
@@ -1,3 +1,8 @@
1
+ // Copyright (c) 2026 AlphaBotz & Adarsh
2
+ // GitHub: https://github.com/TeamAlphabotz
3
+ // GitHub: https://github.com/utkarshdubey2008
4
+ // Telegram: @alter69x, @akanesakuramori
5
+
1
6
  import { Command } from 'commander';
2
7
  import pc from 'picocolors';
3
8
  import { loadConfig } from './config.js';
package/src/config.js CHANGED
@@ -1,3 +1,8 @@
1
+ // Copyright (c) 2026 AlphaBotz & Adarsh
2
+ // GitHub: https://github.com/TeamAlphabotz
3
+ // GitHub: https://github.com/utkarshdubey2008
4
+ // Telegram: @alter69x, @akanesakuramori
5
+
1
6
  import path from 'path';
2
7
  import fs from 'fs/promises';
3
8
  import { pathToFileURL } from 'url';
@@ -1,3 +1,8 @@
1
+ // Copyright (c) 2026 AlphaBotz & Adarsh
2
+ // GitHub: https://github.com/TeamAlphabotz
3
+ // GitHub: https://github.com/utkarshdubey2008
4
+ // Telegram: @alter69x, @akanesakuramori
5
+
1
6
  /**
2
7
  * AdvancedEngine
3
8
  *
@@ -1,3 +1,8 @@
1
+ // Copyright (c) 2026 AlphaBotz & Adarsh
2
+ // GitHub: https://github.com/TeamAlphabotz
3
+ // GitHub: https://github.com/utkarshdubey2008
4
+ // Telegram: @alter69x, @akanesakuramori
5
+
1
6
  /**
2
7
  * BrowserEngine
3
8
  *
@@ -1,3 +1,8 @@
1
+ // Copyright (c) 2026 AlphaBotz & Adarsh
2
+ // GitHub: https://github.com/TeamAlphabotz
3
+ // GitHub: https://github.com/utkarshdubey2008
4
+ // Telegram: @alter69x, @akanesakuramori
5
+
1
6
  /**
2
7
  * Engine registry.
3
8
  *
@@ -1,3 +1,8 @@
1
+ // Copyright (c) 2026 AlphaBotz & Adarsh
2
+ // GitHub: https://github.com/TeamAlphabotz
3
+ // GitHub: https://github.com/utkarshdubey2008
4
+ // Telegram: alter69x, akanesakuramori
5
+
1
6
  /**
2
7
  * SSREngine
3
8
  *
package/src/index.js CHANGED
@@ -1,3 +1,8 @@
1
+ // Copyright (c) 2026 AlphaBotz & Adarsh
2
+ // GitHub: https://github.com/TeamAlphabotz
3
+ // GitHub: https://github.com/utkarshdubey2008
4
+ // Telegram: @alter69x, @akanesakuramori
5
+
1
6
  /**
2
7
  * ReviJs — Public Library API
3
8
  *
package/src/middleware.js CHANGED
@@ -1,3 +1,8 @@
1
+ // Copyright (c) 2026 AlphaBotz & Adarsh
2
+ // GitHub: https://github.com/TeamAlphabotz
3
+ // GitHub: https://github.com/utkarshdubey2008
4
+ // Telegram: @alter69x, @akanesakuramori
5
+
1
6
  import path from 'path';
2
7
  import fs from 'fs/promises';
3
8
  import { isBot, detectBot } from './utils/bot-detector.js';
package/src/prerender.js CHANGED
@@ -1,3 +1,8 @@
1
+ // Copyright (c) 2026 AlphaBotz & Adarsh
2
+ // GitHub: https://github.com/TeamAlphabotz
3
+ // GitHub: https://github.com/utkarshdubey2008
4
+ // Telegram: @alter69x, @akanesakuramori
5
+
1
6
  import path from 'path';
2
7
  import fs from 'fs/promises';
3
8
  import pc from 'picocolors';
package/src/setup.js CHANGED
@@ -1,3 +1,14 @@
1
+ // setup.js
2
+ // ──────────────────────────────────────────────────────────────
3
+ // ReviJs Browser Engine Setup Script
4
+ // Copyright (c) 2026 AlphaBotz & Adarsh
5
+ // GitHub: https://github.com/TeamAlphabotz
6
+ // GitHub: https://github.com/utkarshdubey2008
7
+ // Telegram: @alter69x, @akanesakuramori
8
+ // This script ensures your system has the required browser engine
9
+ // for ReviJs prerendering
10
+ // ──────────────────────────────────────────────────────────────
11
+
1
12
  import { execSync } from 'child_process';
2
13
  import pc from 'picocolors';
3
14
 
@@ -1,3 +1,8 @@
1
+ // Copyright (c) 2026 AlphaBotz & Adarsh
2
+ // GitHub: https://github.com/TeamAlphabotz
3
+ // GitHub: https://github.com/utkarshdubey2008
4
+ // Telegram: @alter69x, @akanesakuramori
5
+
1
6
  /**
2
7
  * Bot detector utility.
3
8
  *
@@ -1,3 +1,8 @@
1
+ // Copyright (c) 2026 AlphaBotz & Adarsh
2
+ // GitHub: https://github.com/TeamAlphabotz
3
+ // GitHub: https://github.com/utkarshdubey2008
4
+ // Telegram: @alter69x, @akanesakuramori
5
+
1
6
  /**
2
7
  * Route expander.
3
8
  *
@@ -1,3 +1,8 @@
1
+ // Copyright (c) 2026 AlphaBotz & Adarsh
2
+ // GitHub: https://github.com/TeamAlphabotz
3
+ // GitHub: https://github.com/utkarshdubey2008
4
+ // Telegram: @alter69x, @akanesakuramori
5
+
1
6
  import http from 'http';
2
7
  import path from 'path';
3
8
  import fs from 'fs';