olovaplugin 1.0.13 → 1.0.15

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 (62) hide show
  1. package/README.md +26 -17
  2. package/dist/auto-generate.d.ts +3 -0
  3. package/dist/auto-generate.d.ts.map +1 -0
  4. package/dist/auto-generate.js +114 -0
  5. package/dist/auto-generate.js.map +1 -0
  6. package/dist/clean-url.d.ts +3 -0
  7. package/dist/clean-url.d.ts.map +1 -0
  8. package/dist/clean-url.js +40 -0
  9. package/dist/clean-url.js.map +1 -0
  10. package/dist/config.d.ts +3 -0
  11. package/dist/config.d.ts.map +1 -0
  12. package/dist/config.js +99 -0
  13. package/dist/config.js.map +1 -0
  14. package/dist/error-overlay.d.ts +3 -0
  15. package/dist/error-overlay.d.ts.map +1 -0
  16. package/dist/error-overlay.js +59 -0
  17. package/dist/error-overlay.js.map +1 -0
  18. package/dist/framework.d.ts +3 -0
  19. package/dist/framework.d.ts.map +1 -0
  20. package/dist/framework.js +41 -0
  21. package/dist/framework.js.map +1 -0
  22. package/dist/hydration.d.ts +19 -0
  23. package/dist/hydration.d.ts.map +1 -0
  24. package/dist/hydration.js +221 -0
  25. package/dist/hydration.js.map +1 -0
  26. package/dist/index.d.ts +20 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +44 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/router.d.ts +3 -0
  31. package/dist/router.d.ts.map +1 -0
  32. package/dist/router.js +165 -0
  33. package/dist/router.js.map +1 -0
  34. package/dist/runtime/router.d.ts +81 -0
  35. package/dist/runtime/router.d.ts.map +1 -0
  36. package/dist/runtime/router.js +284 -0
  37. package/dist/runtime/router.js.map +1 -0
  38. package/dist/ssg.d.ts +3 -0
  39. package/dist/ssg.d.ts.map +1 -0
  40. package/dist/ssg.js +376 -0
  41. package/dist/ssg.js.map +1 -0
  42. package/dist/terminal.d.ts +68 -0
  43. package/dist/terminal.d.ts.map +1 -0
  44. package/dist/terminal.js +143 -0
  45. package/dist/terminal.js.map +1 -0
  46. package/dist/utils.d.ts +8 -0
  47. package/dist/utils.d.ts.map +1 -0
  48. package/dist/utils.js +68 -0
  49. package/dist/utils.js.map +1 -0
  50. package/dist/virtual-html.d.ts +3 -0
  51. package/dist/virtual-html.d.ts.map +1 -0
  52. package/dist/virtual-html.js +178 -0
  53. package/dist/virtual-html.js.map +1 -0
  54. package/package.json +33 -30
  55. package/runtime/client.tsx +119 -0
  56. package/runtime/index.ts +18 -0
  57. package/runtime/router.tsx +381 -0
  58. package/runtime/server.tsx +110 -0
  59. package/dist/olova-plugins.cjs +0 -1683
  60. package/dist/olova-plugins.d.cts +0 -123
  61. package/dist/olova-plugins.d.ts +0 -123
  62. package/dist/olova-plugins.js +0 -1622
package/README.md CHANGED
@@ -1,33 +1,42 @@
1
- # olova-plugins
1
+ # olovaplugin
2
2
 
3
- A collection of Vite plugins for the Olova framework.
3
+ Vite plugin for Olova framework - file-based routing, SSG, SSR, and hydration.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install olova-plugins
8
+ npm install olovaplugin
9
9
  ```
10
10
 
11
11
  ## Usage
12
12
 
13
- In your `vite.config.ts`:
14
-
15
- ```ts
13
+ ```typescript
14
+ // vite.config.ts
16
15
  import { defineConfig } from "vite";
17
- import { olovaPlugins } from "olova-plugins";
16
+ import react from "@vitejs/plugin-react";
17
+ import { olovaPlugins } from "olovaplugin";
18
18
 
19
19
  export default defineConfig({
20
- plugins: [olovaPlugins()],
20
+ plugins: [react(), ...olovaPlugins()],
21
21
  });
22
22
  ```
23
23
 
24
- ## Includes
24
+ ## Features
25
+
26
+ - **File-based routing** - Create routes by adding files to `src/`
27
+ - **SSG (Static Site Generation)** - Pre-render pages at build time
28
+ - **SSR (Server-Side Rendering)** - Full hydration support
29
+ - **Dynamic routes** - Use `$param` or `:param` syntax
30
+ - **Route groups** - Organize routes with `(folder)` syntax
31
+ - **HMR support** - Hot reload for route changes
32
+
33
+ ## Importing from olova
34
+
35
+ ```tsx
36
+ import { Router, Link, useParams, usePathname } from "olova";
37
+ import type { Metadata } from "olova";
38
+ ```
39
+
40
+ ## License
25
41
 
26
- - Config Plugin
27
- - Router Plugin
28
- - Framework Plugin
29
- - Virtual HTML Plugin
30
- - SSG Plugin
31
- - Clean URL Plugin
32
- - Auto Generate Plugin
33
- - Error Overlay Plugin
42
+ MIT
@@ -0,0 +1,3 @@
1
+ import { type Plugin } from "vite";
2
+ export declare function autoGeneratePlugin(): Plugin;
3
+ //# sourceMappingURL=auto-generate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auto-generate.d.ts","sourceRoot":"","sources":["../auto-generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAwDnC,wBAAgB,kBAAkB,IAAI,MAAM,CAoF3C"}
@@ -0,0 +1,114 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ // =============================================================================
4
+ // AUTO GENERATE PLUGIN - Auto-generates boilerplate code for new route files
5
+ // =============================================================================
6
+ /**
7
+ * Converts a folder name to PascalCase for component naming
8
+ */
9
+ function toPascalCase(str) {
10
+ // Remove $ prefix for dynamic routes
11
+ const cleanStr = str.replace(/^\$/, "");
12
+ return cleanStr
13
+ .split(/[-_]/)
14
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
15
+ .join("");
16
+ }
17
+ /**
18
+ * Generates the boilerplate code for a new route component
19
+ */
20
+ function generateBoilerplate(folderName, isDynamic) {
21
+ const componentName = toPascalCase(folderName);
22
+ if (isDynamic) {
23
+ // Dynamic route with useParams
24
+ const paramName = folderName.replace(/^\$/, "");
25
+ return `import { useParams } from '../../route';
26
+
27
+ export default function ${componentName}() {
28
+ const { ${paramName} } = useParams();
29
+ return (
30
+ <div>
31
+ <h1>${componentName} Page</h1>
32
+ <p>{${paramName}}</p>
33
+ </div>
34
+ );
35
+ }
36
+ `;
37
+ }
38
+ // Regular static route
39
+ return `export default function ${componentName}() {
40
+ return (
41
+ <div>
42
+ <h1>${componentName} Page</h1>
43
+ <p>Welcome to ${componentName}</p>
44
+ </div>
45
+ );
46
+ }
47
+ `;
48
+ }
49
+ export function autoGeneratePlugin() {
50
+ let srcDir;
51
+ return {
52
+ name: "olova-auto-generate",
53
+ configResolved(config) {
54
+ srcDir = path.resolve(config.root, "src");
55
+ },
56
+ configureServer(server) {
57
+ console.log("\x1b[36m[olova] Auto-generate plugin active - watching for new route files\x1b[0m");
58
+ // Watch for file creation events
59
+ server.watcher.on("add", (filePath) => {
60
+ // Normalize path for Windows compatibility
61
+ const normalizedPath = path.normalize(filePath);
62
+ const normalizedSrcDir = path.normalize(srcDir);
63
+ // Only process .tsx or .jsx files
64
+ const ext = path.extname(normalizedPath);
65
+ if (ext !== ".tsx" && ext !== ".jsx") {
66
+ return;
67
+ }
68
+ // Check if file is inside src directory
69
+ if (!normalizedPath.startsWith(normalizedSrcDir)) {
70
+ return;
71
+ }
72
+ // Get the file name without extension
73
+ const fileName = path.basename(normalizedPath, ext);
74
+ // Only auto-generate for index files
75
+ if (fileName !== "index") {
76
+ return;
77
+ }
78
+ // Get the folder name
79
+ const folderPath = path.dirname(normalizedPath);
80
+ const folderName = path.basename(folderPath);
81
+ // Skip root src folder and route groups (folders starting with parentheses)
82
+ if (folderName === "src" || folderName.startsWith("(")) {
83
+ return;
84
+ }
85
+ // Check if file is empty or very small (just created)
86
+ try {
87
+ fs.statSync(normalizedPath);
88
+ const content = fs.readFileSync(normalizedPath, "utf-8");
89
+ // Only generate if file is empty or has minimal content
90
+ if (content.trim().length > 10) {
91
+ return;
92
+ }
93
+ }
94
+ catch (err) {
95
+ // File might not exist yet or other error, skip
96
+ return;
97
+ }
98
+ // Check if it's a dynamic route (folder starts with $)
99
+ const isDynamic = folderName.startsWith("$");
100
+ // Generate the boilerplate
101
+ const boilerplate = generateBoilerplate(folderName, isDynamic);
102
+ // Write the boilerplate to the file
103
+ try {
104
+ fs.writeFileSync(normalizedPath, boilerplate, "utf-8");
105
+ console.log(`\x1b[32m✓ [olova] Auto-generated: ${folderName}/index${ext}\x1b[0m`);
106
+ }
107
+ catch (err) {
108
+ console.error(`\x1b[31m✗ [olova] Failed to write boilerplate:\x1b[0m`, err);
109
+ }
110
+ });
111
+ },
112
+ };
113
+ }
114
+ //# sourceMappingURL=auto-generate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auto-generate.js","sourceRoot":"","sources":["../auto-generate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,gFAAgF;AAChF,6EAA6E;AAC7E,gFAAgF;AAEhF;;GAEG;AACH,SAAS,YAAY,CAAC,GAAW;IAC/B,qCAAqC;IACrC,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAExC,OAAO,QAAQ;SACZ,KAAK,CAAC,MAAM,CAAC;SACb,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;SACzE,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED;;GAEG;AACH,SAAS,mBAAmB,CAAC,UAAkB,EAAE,SAAkB;IACjE,MAAM,aAAa,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;IAE/C,IAAI,SAAS,EAAE,CAAC;QACd,+BAA+B;QAC/B,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAChD,OAAO;;0BAEe,aAAa;cACzB,SAAS;;;kBAGL,aAAa;kBACb,SAAS;;;;CAI1B,CAAC;IACA,CAAC;IAED,uBAAuB;IACvB,OAAO,2BAA2B,aAAa;;;kBAG/B,aAAa;4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K,KAAK,IAAI,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;oBACvD,OAAO;gBACT,CAAC;gBAED,sDAAsD;gBACtD,IAAI,CAAC;oBACH,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;oBAC5B,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;oBAEzD,wDAAwD;oBACxD,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;wBAC/B,OAAO;oBACT,CAAC;gBACH,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,gDAAgD;oBAChD,OAAO;gBACT,CAAC;gBAED,uDAAuD;gBACvD,MAAM,SAAS,GAAG,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;gBAE7C,2BAA2B;gBAC3B,MAAM,WAAW,GAAG,mBAAmB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;gBAE/D,oCAAoC;gBACpC,IAAI,CAAC;oBACH,EAAE,CAAC,aAAa,CAAC,cAAc,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;oBACvD,OAAO,CAAC,GAAG,CACT,qCAAqC,UAAU,SAAS,GAAG,SAAS,CACrE,CAAC;gBACJ,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,OAAO,CAAC,KAAK,CACX,uDAAuD,EACvD,GAAG,CACJ,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Plugin } from 'vite';
2
+ export declare function cleanUrlPlugin(): Plugin;
3
+ //# sourceMappingURL=clean-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clean-url.d.ts","sourceRoot":"","sources":["../clean-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAOnC,wBAAgB,cAAc,IAAI,MAAM,CAoCvC"}
@@ -0,0 +1,40 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ // =============================================================================
4
+ // CLEAN URL PLUGIN - Handles clean URLs in preview mode
5
+ // =============================================================================
6
+ export function cleanUrlPlugin() {
7
+ return {
8
+ name: 'olova-clean-url',
9
+ configurePreviewServer(server) {
10
+ // Use middleware that runs BEFORE Vite's static serving
11
+ server.middlewares.use((req, res, next) => {
12
+ const urlPath = (req.url || '/').split('?')[0];
13
+ const distDir = path.resolve('.olova/dist');
14
+ // Handle root path
15
+ if (urlPath === '/') {
16
+ const indexPath = path.join(distDir, 'index.html');
17
+ if (fs.existsSync(indexPath)) {
18
+ const content = fs.readFileSync(indexPath, 'utf-8');
19
+ res.setHeader('Content-Type', 'text/html');
20
+ res.end(content);
21
+ return;
22
+ }
23
+ }
24
+ // Skip if it has a file extension (assets, scripts, etc.)
25
+ if (urlPath.includes('.'))
26
+ return next();
27
+ // Check if /route/index.html exists (clean URLs)
28
+ const indexPath = path.join(distDir, urlPath, 'index.html');
29
+ if (fs.existsSync(indexPath)) {
30
+ const content = fs.readFileSync(indexPath, 'utf-8');
31
+ res.setHeader('Content-Type', 'text/html');
32
+ res.end(content);
33
+ return;
34
+ }
35
+ next();
36
+ });
37
+ }
38
+ };
39
+ }
40
+ //# sourceMappingURL=clean-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clean-url.js","sourceRoot":"","sources":["../clean-url.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,gFAAgF;AAChF,wDAAwD;AACxD,gFAAgF;AAChF,MAAM,UAAU,cAAc;IAC5B,OAAO;QACL,IAAI,EAAE,iBAAiB;QACvB,sBAAsB,CAAC,MAAM;YAC3B,wDAAwD;YACxD,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI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plugin } from 'vite';
2
+ export declare function configPlugin(): Plugin;
3
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAiBnC,wBAAgB,YAAY,IAAI,MAAM,CAwFrC"}
package/dist/config.js ADDED
@@ -0,0 +1,99 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ // Terminal colors
4
+ const colors = {
5
+ reset: '\x1b[0m',
6
+ bold: '\x1b[1m',
7
+ dim: '\x1b[2m',
8
+ cyan: '\x1b[36m',
9
+ green: '\x1b[32m',
10
+ white: '\x1b[37m',
11
+ };
12
+ // =============================================================================
13
+ // CONFIG PLUGIN - Creates .olova folder and configures Vite settings
14
+ // =============================================================================
15
+ export function configPlugin() {
16
+ const olovaDir = path.resolve('.olova');
17
+ return {
18
+ name: 'olova-config',
19
+ config(_config, { command }) {
20
+ // Create .olova folder on startup
21
+ if (!fs.existsSync(olovaDir)) {
22
+ fs.mkdirSync(olovaDir, { recursive: true });
23
+ }
24
+ // Skip build config for SSG builds
25
+ if (process.env.IS_SSG_BUILD) {
26
+ return {
27
+ appType: 'custom',
28
+ cacheDir: './.olova/cache',
29
+ };
30
+ }
31
+ // Show startup banner for dev mode
32
+ if (command === 'serve') {
33
+ console.log('');
34
+ console.log(` ${colors.bold}${colors.cyan}▲ Olova${colors.reset} ${colors.dim}v1.0.0${colors.reset}`);
35
+ console.log('');
36
+ }
37
+ return {
38
+ appType: 'custom',
39
+ cacheDir: './.olova/cache',
40
+ build: {
41
+ outDir: './.olova/dist',
42
+ sourcemap: false,
43
+ chunkSizeWarningLimit: 500,
44
+ rollupOptions: {
45
+ onwarn(warning, warn) {
46
+ // Suppress "dynamic import will not move module" warnings
47
+ if (warning.code === 'PLUGIN_WARNING' && warning.message?.includes('dynamic import will not move')) {
48
+ return;
49
+ }
50
+ // Suppress "static" directive warnings (Olova uses this for static routes)
51
+ if (warning.message?.includes('Module level directives') && warning.message?.includes('static')) {
52
+ return;
53
+ }
54
+ // Suppress sourcemap warnings for static directive
55
+ if (warning.message?.includes('sourcemap') && warning.message?.includes("Can't resolve original location")) {
56
+ return;
57
+ }
58
+ warn(warning);
59
+ },
60
+ output: {
61
+ chunkFileNames: 'pro_olova_static/chunks/[name]-[hash].js',
62
+ entryFileNames: 'pro_olova_static/olova-[hash].js',
63
+ assetFileNames: 'pro_olova_static/[name]-[hash][extname]',
64
+ manualChunks(id) {
65
+ if (id.includes('node_modules')) {
66
+ if (id.includes('react-dom')) {
67
+ return 'vendor-react-dom';
68
+ }
69
+ if (id.includes('react')) {
70
+ return 'vendor-react';
71
+ }
72
+ return 'vendor';
73
+ }
74
+ },
75
+ },
76
+ },
77
+ },
78
+ preview: {
79
+ port: 4173,
80
+ strictPort: false,
81
+ },
82
+ };
83
+ },
84
+ configureServer(server) {
85
+ // Show ready message when server starts
86
+ server.httpServer?.once('listening', () => {
87
+ const address = server.httpServer?.address();
88
+ const port = typeof address === 'object' && address ? address.port : 5173;
89
+ setTimeout(() => {
90
+ console.log(` ${colors.green}✓${colors.reset} Ready in ${colors.dim}${Math.round(performance.now())}ms${colors.reset}`);
91
+ console.log('');
92
+ console.log(` ${colors.dim}➜${colors.reset} ${colors.bold}Local:${colors.reset} ${colors.cyan}http://localhost:${port}/${colors.reset}`);
93
+ console.log('');
94
+ }, 100);
95
+ });
96
+ },
97
+ };
98
+ }
99
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,kBAAkB;AAClB,MAAM,MAAM,GAAG;IACX,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,SAAS;IACd,IAAI,EAAE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,CAAC;gBAC7C,MAAM,IAAI,GAAG,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;gBAE1E,UAAU,CAAC,GAAG,EAAE;oBACd,OAAO,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,aAAa,MAAM,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;oBACzH,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;oBAChB,OAAO,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,KAAK,KAAK,MAAM,CAAC,IAAI,SAAS,MAAM,CAAC,KAAK,MAAM,MAAM,CAAC,IAAI,oBAAoB,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;oBAC7I,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAClB,CAAC,EAAE,GAAG,CAAC,CAAC;YACV,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Plugin } from 'vite';
2
+ export declare function proactiveErrorPlugin(): Plugin;
3
+ //# sourceMappingURL=error-overlay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-overlay.d.ts","sourceRoot":"","sources":["../error-overlay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAsB,MAAM,MAAM,CAAC;AAQvD,wBAAgB,oBAAoB,IAAI,MAAM,CA0D7C"}
@@ -0,0 +1,59 @@
1
+ import path from 'path';
2
+ // =============================================================================
3
+ // PROACTIVE ERROR CHECKER - Validates all files on save like Next.js
4
+ // This makes Vite's error overlay show instantly for ANY file with an error
5
+ // =============================================================================
6
+ export function proactiveErrorPlugin() {
7
+ return {
8
+ name: 'olova-proactive-error',
9
+ enforce: 'post',
10
+ configureServer(devServer) {
11
+ const srcDir = path.resolve(process.cwd(), 'src');
12
+ // Function to validate a file and send error to Vite's overlay
13
+ const validateFile = async (filePath) => {
14
+ if (!filePath.startsWith(srcDir))
15
+ return;
16
+ if (!/\.(tsx?|jsx?)$/.test(filePath))
17
+ return;
18
+ const relativePath = path.relative(srcDir, filePath);
19
+ console.log('\x1b[36m[olova]\x1b[0m Checking:', relativePath);
20
+ try {
21
+ // Convert file path to URL format for Vite
22
+ const url = '/' + path.relative(process.cwd(), filePath).replace(/\\/g, '/');
23
+ // Proactively transform the file
24
+ await devServer.transformRequest(url);
25
+ console.log('\x1b[32m[olova]\x1b[0m ✓', relativePath, 'OK');
26
+ }
27
+ catch (err) {
28
+ console.log('\x1b[31m[olova]\x1b[0m ✗', relativePath);
29
+ // Send error to Vite's error overlay via WebSocket
30
+ // This is the official way Vite shows errors in the overlay
31
+ devServer.ws.send({
32
+ type: 'error',
33
+ err: {
34
+ message: err.message || String(err),
35
+ stack: err.stack || '',
36
+ id: err.id || filePath,
37
+ frame: err.frame || '',
38
+ plugin: err.plugin || 'olova',
39
+ loc: err.loc || undefined,
40
+ },
41
+ });
42
+ }
43
+ };
44
+ // Watch for file changes
45
+ devServer.watcher.on('change', async (filePath) => {
46
+ // Small delay to ensure file is fully written
47
+ await new Promise(r => setTimeout(r, 50));
48
+ await validateFile(filePath);
49
+ });
50
+ // Also check new files when they're added
51
+ devServer.watcher.on('add', async (filePath) => {
52
+ // Wait for file to be fully written
53
+ await new Promise(r => setTimeout(r, 100));
54
+ await validateFile(filePath);
55
+ });
56
+ },
57
+ };
58
+ }
59
+ //# sourceMappingURL=error-overlay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-overlay.js","sourceRoot":"","sources":["../error-overlay.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,gFAAgF;AAChF,qEAAqE;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AG,CAAC;4BACnC,KAAK,EAAE,GAAG,CAAC,KAAK,IAAI,EAAE;4BACtB,EAAE,EAAE,GAAG,CAAC,EAAE,IAAI,QAAQ;4BACtB,KAAK,EAAE,GAAG,CAAC,KAAK,IAAI,EAAE;4BACtB,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,OAAO;4BAC7B,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,SAAS;yBAC1B;qBACF,CAAC,CAAC;gBACL,CAAC;YACH,CAAC,CAAC;YAEF,yBAAyB;YACzB,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAgB,EAAE,EAAE;gBACxD,8CAA8C;gBAC9C,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;gBAC1C,MAAM,YAAY,CAAC,QAAQ,CAAC,CAAC;YAC/B,CAAC,CAAC,CAAC;YAEH,0CAA0C;YAC1C,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,QAAgB,EAAE,EAAE;gBACrD,oCAAoC;gBACpC,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;gBAC3C,MAAM,YAAY,CAAC,QAAQ,CAAC,CAAC;YAC/B,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Plugin } from 'vite';
2
+ export declare function frameworkPlugin(): Plugin;
3
+ //# sourceMappingURL=framework.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework.d.ts","sourceRoot":"","sources":["../framework.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAgBnC,wBAAgB,eAAe,IAAI,MAAM,CAiCxC"}
@@ -0,0 +1,41 @@
1
+ import path from 'path';
2
+ import { fileURLToPath } from 'url';
3
+ // =============================================================================
4
+ // FRAMEWORK PLUGIN - Uses Vite aliases to serve real files (TanStack style)
5
+ // Routes virtual module is handled by routerPlugin via resolveId/load
6
+ // =============================================================================
7
+ // Get the package root directory (works both in dev and production)
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = path.dirname(__filename);
10
+ // When compiled, __dirname is dist/, so we need to go up to get to runtime/
11
+ // When in dev (source), __dirname is olovaplugin/, runtime is a child
12
+ const packageRoot = __dirname.endsWith('dist') ? path.resolve(__dirname, '..') : __dirname;
13
+ export function frameworkPlugin() {
14
+ // Runtime folder is at package root level
15
+ const runtimeDir = path.resolve(packageRoot, 'runtime');
16
+ return {
17
+ name: 'olova-framework',
18
+ enforce: 'pre',
19
+ // Use resolveId instead of config aliases to avoid catching olova/routes
20
+ resolveId(id) {
21
+ const routerPath = path.join(runtimeDir, 'router.tsx');
22
+ const clientPath = path.join(runtimeDir, 'client.tsx');
23
+ const serverPath = path.join(runtimeDir, 'server.tsx');
24
+ // Main olova package → real router.tsx file
25
+ // But NOT olova/routes - that's handled by routerPlugin
26
+ if (id === 'olova' || id === 'olova/index') {
27
+ return routerPath;
28
+ }
29
+ // Client entry → real client.tsx file
30
+ if (id === 'olova/client' || id === '/olova/client') {
31
+ return clientPath;
32
+ }
33
+ // Server entry → real server.tsx file
34
+ if (id === 'olova/server' || id === '/olova/server') {
35
+ return serverPath;
36
+ }
37
+ // Let olova/routes pass through to routerPlugin
38
+ }
39
+ };
40
+ }
41
+ //# sourceMappingURL=framework.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework.js","sourceRoot":"","sources":["../framework.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,gFAAgF;AAChF,4EAA4E;AAC5E,sEAAsE;AACtE,gFAAgF;AAEhF,oEAAoE;AACpE,MA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HydrationData {
2
+ route: string;
3
+ metadata?: Record<string, unknown>;
4
+ params?: Record<string, string>;
5
+ chunks?: string[];
6
+ isStatic?: boolean;
7
+ }
8
+ export declare function generateOlovaHydration(data: OlovaHydrationData, buildId: string): string;
9
+ /**
10
+ * Generate JSON-LD structured data script for SEO
11
+ * This is injected into <head> for search engine crawlers
12
+ */
13
+ export declare function generateJsonLd(data: OlovaHydrationData): string;
14
+ /**
15
+ * Parse flight data from the page (client-side utility)
16
+ * Use this to access hydration data in your components
17
+ */
18
+ export declare function parseFlightData(): Record<string, unknown> | null;
19
+ //# sourceMappingURL=hydration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydration.d.ts","sourceRoot":"","sources":["../hydration.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,kBAAkB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAmBD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CA+JxF;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,CA8B/D;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAiChE"}