olovastart 0.0.1

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/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # vite-plugin-olova
2
+
3
+ A Vite plugin for building SSR/SSG applications with React and the Olova framework.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install vite-plugin-olova
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ Add the plugin to your `vite.config.ts`:
14
+
15
+ ```typescript
16
+ import { defineConfig } from "vite";
17
+ import react from "@vitejs/plugin-react";
18
+ import { olova } from "vite-plugin-olova";
19
+
20
+ export default defineConfig({
21
+ plugins: [
22
+ react(),
23
+ olova({
24
+ staticPaths: ["/about", "/contact"], // Optional: additional paths to pre-render
25
+ }),
26
+ ],
27
+ });
28
+ ```
29
+
30
+ ## How It Works
31
+
32
+ The plugin provides:
33
+
34
+ 1. **`vite-plugin-olova`** - The main Vite plugin
35
+ 2. **`vite-plugin-olova/entry-client`** - Client-side hydration entry
36
+ 3. **`vite-plugin-olova/entry-server`** - Server-side rendering entry
37
+
38
+ The entry files use `virtual:olova-app` which resolves to your app's route configuration from `@/route.tree`.
39
+
40
+ ## Features
41
+
42
+ - **SSR (Server-Side Rendering)**: Full server-side rendering support during development
43
+ - **SSG (Static Site Generation)**: Automatically generates static HTML files at build time
44
+ - **Route-based code splitting**: Lazy loading for optimal performance
45
+ - **Hydration**: Seamless client-side hydration
46
+
47
+ ## Options
48
+
49
+ | Option | Type | Description |
50
+ | ------------- | ---------- | ----------------------------------------------- |
51
+ | `staticPaths` | `string[]` | Additional paths to pre-render during SSG build |
52
+
53
+ ## Peer Dependencies
54
+
55
+ - `react` >= 18.0.0
56
+ - `react-dom` >= 18.0.0
57
+ - `vite` >= 5.0.0
58
+
59
+ ## License
60
+
61
+ MIT
@@ -0,0 +1,39 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
13
+ var __commonJS = (cb, mod) => function __require2() {
14
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
+ };
16
+ var __export = (target, all) => {
17
+ for (var name in all)
18
+ __defProp(target, name, { get: all[name], enumerable: true });
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (let key of __getOwnPropNames(from))
23
+ if (!__hasOwnProp.call(to, key) && key !== except)
24
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
+ }
26
+ return to;
27
+ };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ // If the importer is in node compatibility mode or this is not an ESM
30
+ // file that has been converted to a CommonJS file using a Babel-
31
+ // compatible transform (i.e. "__esModule" has not been set), then set
32
+ // "default" to the CommonJS "module.exports" for node compatibility.
33
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
+ mod
35
+ ));
36
+
37
+ export { __commonJS, __export, __require, __toESM };
38
+ //# sourceMappingURL=chunk-PR4QN5HX.js.map
39
+ //# sourceMappingURL=chunk-PR4QN5HX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-PR4QN5HX.js"}
@@ -0,0 +1,384 @@
1
+ import fs from 'fs/promises';
2
+ import path from 'path';
3
+ import { promisify } from 'util';
4
+ import zlib from 'zlib';
5
+ import pc from 'picocolors';
6
+
7
+ // src/performance.ts
8
+ var SYMBOLS = {
9
+ success: pc.green("\u2713"),
10
+ error: pc.red("\u2717"),
11
+ warning: pc.yellow("\u26A0"),
12
+ info: pc.blue("\u25CB"),
13
+ arrow: pc.cyan("\u2192"),
14
+ bullet: pc.dim("\u2022"),
15
+ rocket: "\u{1F680}",
16
+ sparkles: "\u2728",
17
+ package: "\u{1F4E6}",
18
+ route: pc.cyan("\u03BB"),
19
+ static: pc.green("\u25CB"),
20
+ dynamic: pc.magenta("\u0192")
21
+ };
22
+ var brand = {
23
+ name: pc.bold(pc.cyan("Olova")),
24
+ version: pc.dim("v1.0.0"),
25
+ tagline: pc.dim("Flight-powered SSG")
26
+ };
27
+ function printBanner() {
28
+ console.log("");
29
+ console.log(pc.cyan(` ${SYMBOLS.rocket} ${brand.name} ${brand.version}`));
30
+ console.log(pc.dim(` ${brand.tagline}`));
31
+ console.log("");
32
+ }
33
+ function printDevReady(url, networkUrl) {
34
+ console.log("");
35
+ console.log(` ${SYMBOLS.success} ${pc.bold("Ready")} in ${pc.cyan("~1s")}`);
36
+ console.log("");
37
+ console.log(` ${pc.dim("Local:")} ${pc.cyan(url)}`);
38
+ if (networkUrl) {
39
+ console.log(` ${pc.dim("Network:")} ${pc.cyan(networkUrl)}`);
40
+ }
41
+ console.log("");
42
+ }
43
+ function printBuildStart() {
44
+ console.log("");
45
+ console.log(` ${SYMBOLS.package} ${pc.bold("Creating optimized production build...")}`);
46
+ console.log("");
47
+ }
48
+ function printSSGStart(buildId) {
49
+ console.log("");
50
+ console.log(` ${pc.bold(pc.cyan("Static Site Generation"))}`);
51
+ console.log(` ${pc.dim("Build ID:")} ${pc.yellow(buildId)}`);
52
+ console.log("");
53
+ }
54
+ function printRoutes(routes) {
55
+ console.log(` ${pc.bold("Route")}${" ".repeat(30)}${pc.bold("Type")}`);
56
+ console.log(` ${pc.dim("\u2500".repeat(45))}`);
57
+ for (const route of routes) {
58
+ const typeIcon = route.type === "static" ? SYMBOLS.static : SYMBOLS.dynamic;
59
+ const typeLabel = route.type === "static" ? pc.green("Static") : pc.magenta("Dynamic");
60
+ const padding = " ".repeat(Math.max(2, 35 - route.path.length));
61
+ console.log(` ${typeIcon} ${route.path}${padding}${typeLabel}`);
62
+ }
63
+ console.log("");
64
+ }
65
+ function printPageGenerated(path2, hasFlightData = true) {
66
+ const flightBadge = hasFlightData ? pc.dim(" [Flight]") : "";
67
+ console.log(` ${SYMBOLS.success} ${pc.dim("Generated")} ${pc.white(path2)}${flightBadge}`);
68
+ }
69
+ function printPageError(path2, error2) {
70
+ console.log(` ${SYMBOLS.error} ${pc.red("Failed")} ${path2}`);
71
+ console.log(` ${pc.dim(error2)}`);
72
+ }
73
+ function printSSGComplete(stats) {
74
+ console.log("");
75
+ console.log(` ${pc.dim("\u2500".repeat(45))}`);
76
+ console.log("");
77
+ if (stats.failedPages > 0) {
78
+ console.log(` ${SYMBOLS.warning} ${pc.yellow("Build completed with warnings")}`);
79
+ } else {
80
+ console.log(` ${SYMBOLS.sparkles} ${pc.green("Build completed successfully!")}`);
81
+ }
82
+ console.log("");
83
+ console.log(` ${pc.dim("Pages:")} ${pc.bold(stats.successPages.toString())} generated`);
84
+ if (stats.failedPages > 0) {
85
+ console.log(` ${pc.red(stats.failedPages.toString())} failed`);
86
+ }
87
+ console.log(` ${pc.dim("Time:")} ${pc.cyan(stats.buildTime + "ms")}`);
88
+ console.log("");
89
+ }
90
+ function printFlightInfo() {
91
+ console.log(` ${SYMBOLS.info} ${pc.dim("Flight hydration enabled")}`);
92
+ console.log(` ${pc.dim("\u2022")} JSON-LD structured data`);
93
+ console.log(` ${pc.dim("\u2022")} Resource hints (preload, prefetch)`);
94
+ console.log(` ${pc.dim("\u2022")} $OLOVA global object`);
95
+ console.log("");
96
+ }
97
+ function info(message) {
98
+ console.log(` ${SYMBOLS.info} ${message}`);
99
+ }
100
+ function success(message) {
101
+ console.log(` ${SYMBOLS.success} ${pc.green(message)}`);
102
+ }
103
+ function warn(message) {
104
+ console.log(` ${SYMBOLS.warning} ${pc.yellow(message)}`);
105
+ }
106
+ function error(message) {
107
+ console.log(` ${SYMBOLS.error} ${pc.red(message)}`);
108
+ }
109
+ function printSSRRender(path2) {
110
+ console.log(` ${SYMBOLS.arrow} ${pc.dim("SSR")} ${path2}`);
111
+ }
112
+ var logger_default = {
113
+ printBanner,
114
+ printDevReady,
115
+ printBuildStart,
116
+ printSSGStart,
117
+ printRoutes,
118
+ printPageGenerated,
119
+ printPageError,
120
+ printSSGComplete,
121
+ printFlightInfo,
122
+ printSSRRender,
123
+ info,
124
+ success,
125
+ warn,
126
+ error,
127
+ SYMBOLS
128
+ };
129
+
130
+ // src/performance.ts
131
+ var gzip = promisify(zlib.gzip);
132
+ var brotliCompress = promisify(zlib.brotliCompress);
133
+ function createManualChunks() {
134
+ const seenModules = /* @__PURE__ */ new Map();
135
+ return (id, { getModuleInfo }) => {
136
+ if (id.includes("node_modules/react-dom")) {
137
+ return "vendor-react-dom";
138
+ }
139
+ if (id.includes("node_modules/react")) {
140
+ return "vendor-react";
141
+ }
142
+ if (id.includes("olova-router")) {
143
+ return "framework-router";
144
+ }
145
+ if (id.includes("node_modules")) {
146
+ const match = id.match(/node_modules[\\/]([^/\\]+)/);
147
+ if (match) {
148
+ const pkg = match[1];
149
+ if (["scheduler", "object-assign", "prop-types"].includes(pkg)) {
150
+ return "vendor-react";
151
+ }
152
+ if (["lodash", "moment", "axios", "date-fns"].includes(pkg)) {
153
+ return `vendor-${pkg}`;
154
+ }
155
+ }
156
+ return "vendor";
157
+ }
158
+ if (id.includes("/components/")) {
159
+ return "common-components";
160
+ }
161
+ if (id.includes("/utils/") || id.includes("/lib/") || id.includes("/helpers/")) {
162
+ return "common-utils";
163
+ }
164
+ if (id.endsWith(".css") || id.endsWith(".scss")) {
165
+ return void 0;
166
+ }
167
+ if (id.includes("/(auth)/") || id.includes("\\(auth)\\") || id.includes("/search/") || id.includes("\\search\\")) {
168
+ return "page-auth";
169
+ }
170
+ if (id.includes("/src/") && (id.endsWith("/index.tsx") || id.endsWith("/index.mdx"))) {
171
+ const moduleInfo = getModuleInfo(id);
172
+ if (moduleInfo) {
173
+ for (const importer of moduleInfo.importers) {
174
+ if (importer.includes("/src/") && importer.includes("/index.") && !importer.includes(id)) {
175
+ return "common-routes";
176
+ }
177
+ }
178
+ }
179
+ const routeMatch = id.match(/[\\/]src[\\/](.+?)[\\/]index\.(tsx|mdx)$/);
180
+ if (routeMatch) {
181
+ const routePath = routeMatch[1].replace(/\([^)]+\)[\\/]/g, "").replace(/\[.*?\]/g, "dynamic").replace(/[\\/]/g, "-");
182
+ const baseRoute = routePath.split("-")[0];
183
+ if (seenModules.has(baseRoute)) {
184
+ const existingChunk = seenModules.get(baseRoute);
185
+ if (existingChunk.startsWith("page-")) {
186
+ return existingChunk;
187
+ }
188
+ }
189
+ const chunkName = `page-${routePath}`;
190
+ seenModules.set(baseRoute, chunkName);
191
+ return chunkName;
192
+ }
193
+ }
194
+ return void 0;
195
+ };
196
+ }
197
+ function compressionPlugin(options = {}) {
198
+ const {
199
+ gzip: enableGzip = true,
200
+ brotli: enableBrotli = true,
201
+ threshold = 1024,
202
+ extensions = ["js", "css", "html", "json", "svg", "xml"]
203
+ } = options;
204
+ let config;
205
+ return {
206
+ name: "olova-compression",
207
+ apply: "build",
208
+ configResolved(resolvedConfig) {
209
+ config = resolvedConfig;
210
+ },
211
+ async closeBundle() {
212
+ if (config.command !== "build" || config.build.ssr) return;
213
+ const outDir = config.build.outDir;
214
+ const stats = { gzip: 0, brotli: 0, skipped: 0 };
215
+ const files = await findFilesToCompress(outDir, extensions);
216
+ for (const file of files) {
217
+ const content = await fs.readFile(file);
218
+ if (content.length < threshold) {
219
+ stats.skipped++;
220
+ continue;
221
+ }
222
+ if (enableGzip) {
223
+ try {
224
+ const compressed = await gzip(content, { level: 9 });
225
+ await fs.writeFile(`${file}.gz`, compressed);
226
+ stats.gzip++;
227
+ } catch (e) {
228
+ }
229
+ }
230
+ if (enableBrotli) {
231
+ try {
232
+ const compressed = await brotliCompress(content, {
233
+ params: {
234
+ [zlib.constants.BROTLI_PARAM_QUALITY]: 11
235
+ }
236
+ });
237
+ await fs.writeFile(`${file}.br`, compressed);
238
+ stats.brotli++;
239
+ } catch (e) {
240
+ }
241
+ }
242
+ }
243
+ if (stats.gzip > 0 || stats.brotli > 0) {
244
+ logger_default.info(`Compressed ${stats.gzip} files (gzip), ${stats.brotli} files (brotli)`);
245
+ }
246
+ }
247
+ };
248
+ }
249
+ function chunkAnalysisPlugin(options = {}) {
250
+ const {
251
+ chunkSizeWarning = true,
252
+ maxChunkSize = 250
253
+ } = options;
254
+ const chunks = [];
255
+ return {
256
+ name: "olova-chunk-analysis",
257
+ apply: "build",
258
+ generateBundle(_options, bundle) {
259
+ for (const [fileName, chunk] of Object.entries(bundle)) {
260
+ if (chunk.type === "chunk") {
261
+ const sizeKB = Buffer.byteLength(chunk.code, "utf8") / 1024;
262
+ let type = "other";
263
+ if (fileName.includes("vendor")) type = "vendor";
264
+ else if (fileName.includes("framework")) type = "framework";
265
+ else if (fileName.includes("common")) type = "common";
266
+ else if (fileName.includes("page-")) type = "route";
267
+ chunks.push({
268
+ name: fileName,
269
+ size: Math.round(sizeKB * 100) / 100,
270
+ isEntry: chunk.isEntry,
271
+ type
272
+ });
273
+ if (chunkSizeWarning && sizeKB > maxChunkSize) {
274
+ logger_default.warn(`Chunk "${fileName}" is ${sizeKB.toFixed(2)}KB (exceeds ${maxChunkSize}KB limit)`);
275
+ }
276
+ }
277
+ }
278
+ },
279
+ closeBundle() {
280
+ if (chunks.length === 0) return;
281
+ chunks.sort((a, b) => b.size - a.size);
282
+ console.log("");
283
+ logger_default.info("Bundle Analysis:");
284
+ const typeGroups = {};
285
+ let totalSize = 0;
286
+ for (const chunk of chunks) {
287
+ typeGroups[chunk.type] = (typeGroups[chunk.type] || 0) + chunk.size;
288
+ totalSize += chunk.size;
289
+ }
290
+ console.log(` Vendor: ${(typeGroups.vendor || 0).toFixed(2)} KB`);
291
+ console.log(` Framework: ${(typeGroups.framework || 0).toFixed(2)} KB`);
292
+ console.log(` Common: ${(typeGroups.common || 0).toFixed(2)} KB`);
293
+ console.log(` Routes: ${(typeGroups.route || 0).toFixed(2)} KB`);
294
+ console.log(` Other: ${(typeGroups.other || 0).toFixed(2)} KB`);
295
+ console.log(` \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`);
296
+ console.log(` Total: ${totalSize.toFixed(2)} KB`);
297
+ console.log("");
298
+ }
299
+ };
300
+ }
301
+ function generatePreloadHints(chunks, entryChunk) {
302
+ const hints = [];
303
+ hints.push({
304
+ href: `/${entryChunk}`,
305
+ as: "script",
306
+ priority: "critical"
307
+ });
308
+ for (const chunk of chunks) {
309
+ if (chunk === entryChunk) continue;
310
+ if (chunk.includes("vendor")) {
311
+ hints.push({
312
+ href: `/${chunk}`,
313
+ as: "script",
314
+ priority: "high"
315
+ });
316
+ } else if (chunk.includes("framework")) {
317
+ hints.push({
318
+ href: `/${chunk}`,
319
+ as: "script",
320
+ priority: "high"
321
+ });
322
+ } else if (chunk.includes("common")) {
323
+ hints.push({
324
+ href: `/${chunk}`,
325
+ as: "script",
326
+ priority: "high"
327
+ });
328
+ } else if (chunk.includes("page-")) {
329
+ hints.push({
330
+ href: `/${chunk}`,
331
+ as: "script",
332
+ priority: "low"
333
+ });
334
+ }
335
+ }
336
+ return hints;
337
+ }
338
+ function generatePreloadTags(hints) {
339
+ return hints.map((hint) => {
340
+ const rel = hint.priority === "low" ? "prefetch" : "modulepreload";
341
+ const crossorigin = hint.crossorigin ? " crossorigin" : "";
342
+ return `<link rel="${rel}" href="${hint.href}"${crossorigin}>`;
343
+ }).join("");
344
+ }
345
+ async function findFilesToCompress(dir, extensions) {
346
+ const files = [];
347
+ try {
348
+ const entries = await fs.readdir(dir, { withFileTypes: true });
349
+ for (const entry of entries) {
350
+ const fullPath = path.join(dir, entry.name);
351
+ if (entry.isDirectory()) {
352
+ files.push(...await findFilesToCompress(fullPath, extensions));
353
+ } else if (entry.isFile()) {
354
+ const ext = path.extname(entry.name).slice(1);
355
+ if (extensions.includes(ext)) {
356
+ files.push(fullPath);
357
+ }
358
+ }
359
+ }
360
+ } catch (e) {
361
+ }
362
+ return files;
363
+ }
364
+ async function getGzipSize(content) {
365
+ const buffer = typeof content === "string" ? Buffer.from(content) : content;
366
+ const compressed = await gzip(buffer);
367
+ return compressed.length;
368
+ }
369
+ function formatBytes(bytes) {
370
+ if (bytes < 1024) return `${bytes} B`;
371
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(2)} KB`;
372
+ return `${(bytes / (1024 * 1024)).toFixed(2)} MB`;
373
+ }
374
+ function olovaPerformance(options = {}) {
375
+ return [
376
+ chunkAnalysisPlugin(options),
377
+ compressionPlugin(options)
378
+ ];
379
+ }
380
+ var performance_default = olovaPerformance;
381
+
382
+ export { chunkAnalysisPlugin, compressionPlugin, createManualChunks, formatBytes, generatePreloadHints, generatePreloadTags, getGzipSize, logger_default, olovaPerformance, performance_default };
383
+ //# sourceMappingURL=chunk-WDVSAQST.js.map
384
+ //# sourceMappingURL=chunk-WDVSAQST.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/logger.ts","../src/performance.ts"],"names":["path","error"],"mappings":";;;;;;;AAQA,IAAM,OAAA,GAAU;AAAA,EACd,OAAA,EAAS,EAAA,CAAG,KAAA,CAAM,QAAG,CAAA;AAAA,EACrB,KAAA,EAAO,EAAA,CAAG,GAAA,CAAI,QAAG,CAAA;AAAA,EACjB,OAAA,EAAS,EAAA,CAAG,MAAA,CAAO,QAAG,CAAA;AAAA,EACtB,IAAA,EAAM,EAAA,CAAG,IAAA,CAAK,QAAG,CAAA;AAAA,EACjB,KAAA,EAAO,EAAA,CAAG,IA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AAA,MAAM,SAAS,OAAO,OAAA,KAAY,WAAW,MAAA,CAAO,IAAA,CAAK,OAAO,CAAA,GAAI,OAAA;AACpE,EAAA,MAAM,UAAA,GAAa,MAAM,IAAA,CAAK,MAAM,CAAA;AACpC,EAAA,OAAO,UAAA,CAAW,MAAA;AACpB;AAKO,SAAS,YAAY,KAAA,EAAuB;AACjD,EAAA,IAAI,KAAA,GAAQ,IAAA,EAAM,OAAO,CAAA,EAAG,KAAK,CAAA,EAAA,CAAA;AACjC,EAAA,IAAI,KAAA,GAAQ,OAAO,IAAA,EAAM,OAAO,IAAI,KAAA,GAAQ,IAAA,EAAM,OAAA,CAAQ,CAAC,CAAC,CAAA,GAAA,CAAA;AAC5D,EAAA,OAAO,IAAI,KAAA,IAAS,IAAA,GAAO,IAAA,CAAA,EAAO,OAAA,CAAQ,CAAC,CAAC,CAAA,GAAA,CAAA;AAC9C;AASO,SAAS,gBAAA,CAAiB,OAAA,GAA8B,EAAC,EAAa;AAC3E,EAAA,OAAO;AAAA,IACL,oBAAoB,OAAO,CAAA;AAAA,IAC3B,kBAAkB,OAAO;AAAA,GAC3B;AACF;AAEA,IAAO,mBAAA,GAAQ","file":"chunk-WDVSAQST.js","sourcesContent":["/**\r\n * Olova Logger - Modern, styled terminal output\r\n * Inspired by Next.js console output\r\n */\r\n\r\nimport pc from 'picocolors';\r\n\r\n// Symbols\r\nconst SYMBOLS = {\r\n success: pc.green('✓'),\r\n error: pc.red('✗'),\r\n warning: pc.yellow('⚠'),\r\n info: pc.blue('○'),\r\n arrow: pc.cyan('→'),\r\n bullet: pc.dim('•'),\r\n rocket: '🚀',\r\n sparkles: '✨',\r\n package: '📦',\r\n route: pc.cyan('λ'),\r\n static: pc.green('○'),\r\n dynamic: pc.magenta('ƒ'),\r\n};\r\n\r\n// Olova brand colors\r\nconst brand = {\r\n name: pc.bold(pc.cyan('Olova')),\r\n version: pc.dim('v1.0.0'),\r\n tagline: pc.dim('Flight-powered SSG'),\r\n};\r\n\r\n/**\r\n * Print the startup banner\r\n */\r\nexport function printBanner() {\r\n console.log('');\r\n console.log(pc.cyan(` ${SYMBOLS.rocket} ${brand.name} ${brand.version}`));\r\n console.log(pc.dim(` ${brand.tagline}`));\r\n console.log('');\r\n}\r\n\r\n/**\r\n * Print dev server ready message\r\n */\r\nexport function printDevReady(url: string, networkUrl?: string) {\r\n console.log('');\r\n console.log(` ${SYMBOLS.success} ${pc.bold('Ready')} in ${pc.cyan('~1s')}`);\r\n console.log('');\r\n console.log(` ${pc.dim('Local:')} ${pc.cyan(url)}`);\r\n if (networkUrl) {\r\n console.log(` ${pc.dim('Network:')} ${pc.cyan(networkUrl)}`);\r\n }\r\n console.log('');\r\n}\r\n\r\n/**\r\n * Print SSG build start\r\n */\r\nexport function printBuildStart() {\r\n console.log('');\r\n console.log(` ${SYMBOLS.package} ${pc.bold('Creating optimized production build...')}`);\r\n console.log('');\r\n}\r\n\r\n/**\r\n * Print SSG build header\r\n */\r\nexport function printSSGStart(buildId: string) {\r\n console.log('');\r\n console.log(` ${pc.bold(pc.cyan('Static Site Generation'))}`);\r\n console.log(` ${pc.dim('Build ID:')} ${pc.yellow(buildId)}`);\r\n console.log('');\r\n}\r\n\r\n/**\r\n * Print route list in a nice table format\r\n */\r\nexport function printRoutes(routes: { path: string; type: 'static' | 'dynamic' }[]) {\r\n console.log(` ${pc.bold('Route')}${' '.repeat(30)}${pc.bold('Type')}`);\r\n console.log(` ${pc.dim('─'.repeat(45))}`);\r\n \r\n for (const route of routes) {\r\n const typeIcon = route.type === 'static' ? SYMBOLS.static : SYMBOLS.dynamic;\r\n const typeLabel = route.type === 'static' \r\n ? pc.green('Static') \r\n : pc.magenta('Dynamic');\r\n const padding = ' '.repeat(Math.max(2, 35 - route.path.length));\r\n console.log(` ${typeIcon} ${route.path}${padding}${typeLabel}`);\r\n }\r\n console.log('');\r\n}\r\n\r\n/**\r\n * Print single page generation\r\n */\r\nexport function printPageGenerated(path: string, hasFlightData = true) {\r\n const flightBadge = hasFlightData ? pc.dim(' [Flight]') : '';\r\n console.log(` ${SYMBOLS.success} ${pc.dim('Generated')} ${pc.white(path)}${flightBadge}`);\r\n}\r\n\r\n/**\r\n * Print page generation error\r\n */\r\nexport function printPageError(path: string, error: string) {\r\n console.log(` ${SYMBOLS.error} ${pc.red('Failed')} ${path}`);\r\n console.log(` ${pc.dim(error)}`);\r\n}\r\n\r\n/**\r\n * Print SSG completion summary\r\n */\r\nexport function printSSGComplete(stats: {\r\n totalPages: number;\r\n successPages: number;\r\n failedPages: number;\r\n buildTime: number;\r\n}) {\r\n console.log('');\r\n console.log(` ${pc.dim('─'.repeat(45))}`);\r\n console.log('');\r\n \r\n if (stats.failedPages > 0) {\r\n console.log(` ${SYMBOLS.warning} ${pc.yellow('Build completed with warnings')}`);\r\n } else {\r\n console.log(` ${SYMBOLS.sparkles} ${pc.green('Build completed successfully!')}`);\r\n }\r\n \r\n console.log('');\r\n console.log(` ${pc.dim('Pages:')} ${pc.bold(stats.successPages.toString())} generated`);\r\n if (stats.failedPages > 0) {\r\n console.log(` ${pc.red(stats.failedPages.toString())} failed`);\r\n }\r\n console.log(` ${pc.dim('Time:')} ${pc.cyan(stats.buildTime + 'ms')}`);\r\n console.log('');\r\n}\r\n\r\n/**\r\n * Print Flight hydration info\r\n */\r\nexport function printFlightInfo() {\r\n console.log(` ${SYMBOLS.info} ${pc.dim('Flight hydration enabled')}`);\r\n console.log(` ${pc.dim('•')} JSON-LD structured data`);\r\n console.log(` ${pc.dim('•')} Resource hints (preload, prefetch)`);\r\n console.log(` ${pc.dim('•')} $OLOVA global object`);\r\n console.log('');\r\n}\r\n\r\n/**\r\n * Print a simple info message\r\n */\r\nexport function info(message: string) {\r\n console.log(` ${SYMBOLS.info} ${message}`);\r\n}\r\n\r\n/**\r\n * Print a success message\r\n */\r\nexport function success(message: string) {\r\n console.log(` ${SYMBOLS.success} ${pc.green(message)}`);\r\n}\r\n\r\n/**\r\n * Print a warning message\r\n */\r\nexport function warn(message: string) {\r\n console.log(` ${SYMBOLS.warning} ${pc.yellow(message)}`);\r\n}\r\n\r\n/**\r\n * Print an error message\r\n */\r\nexport function error(message: string) {\r\n console.log(` ${SYMBOLS.error} ${pc.red(message)}`);\r\n}\r\n\r\n/**\r\n * Print SSR render info (dev mode)\r\n */\r\nexport function printSSRRender(path: string) {\r\n console.log(` ${SYMBOLS.arrow} ${pc.dim('SSR')} ${path}`);\r\n}\r\n\r\nexport default {\r\n printBanner,\r\n printDevReady,\r\n printBuildStart,\r\n printSSGStart,\r\n printRoutes,\r\n printPageGenerated,\r\n printPageError,\r\n printSSGComplete,\r\n printFlightInfo,\r\n printSSRRender,\r\n info,\r\n success,\r\n warn,\r\n error,\r\n SYMBOLS,\r\n};\r\n","/**\r\n * Olova Performance Optimizations Plugin\r\n * \r\n * Provides build-time optimizations for SSG:\r\n * - Code splitting strategies\r\n * - Asset compression (gzip/brotli)\r\n * - Chunk size analysis\r\n * - Resource prioritization\r\n */\r\n\r\nimport fs from 'node:fs/promises';\r\nimport path from 'node:path';\r\nimport { promisify } from 'node:util';\r\nimport zlib from 'node:zlib';\r\nimport type { Plugin, ResolvedConfig } from 'vite';\r\nimport logger from './logger';\r\n\r\n// Promisify zlib functions\r\nconst gzip = promisify(zlib.gzip);\r\nconst brotliCompress = promisify(zlib.brotliCompress);\r\n\r\n// =============================================================================\r\n// TYPES\r\n// =============================================================================\r\n\r\nexport interface PerformanceOptions {\r\n /**\r\n * Enable gzip compression for assets\r\n * @default true\r\n */\r\n gzip?: boolean;\r\n \r\n /**\r\n * Enable brotli compression for assets\r\n * @default true\r\n */\r\n brotli?: boolean;\r\n \r\n /**\r\n * Minimum file size (in bytes) to compress\r\n * @default 1024 (1KB)\r\n */\r\n threshold?: number;\r\n \r\n /**\r\n * File extensions to compress\r\n * @default ['js', 'css', 'html', 'json', 'svg', 'xml']\r\n */\r\n extensions?: string[];\r\n \r\n /**\r\n * Enable chunk size warnings\r\n * @default true\r\n */\r\n chunkSizeWarning?: boolean;\r\n \r\n /**\r\n * Maximum chunk size before warning (in KB)\r\n * @default 250\r\n */\r\n maxChunkSize?: number;\r\n \r\n /**\r\n * Enable route-based code splitting\r\n * @default true\r\n */\r\n routeCodeSplitting?: boolean;\r\n}\r\n\r\nexport interface ChunkInfo {\r\n name: string;\r\n size: number;\r\n gzipSize?: number;\r\n brotliSize?: number;\r\n isEntry: boolean;\r\n type: 'vendor' | 'framework' | 'common' | 'route' | 'other';\r\n}\r\n\r\n// =============================================================================\r\n// MANUAL CHUNKS CONFIGURATION\r\n// =============================================================================\r\n\r\n/**\r\n * Smart manual chunks configuration for optimal code splitting\r\n * Separates vendor, framework, and route-specific code\r\n * Avoids circular dependencies by grouping related routes\r\n */\r\nexport function createManualChunks() {\r\n // Track modules to detect potential circular dependencies\r\n const seenModules = new Map<string, string>();\r\n \r\n return (id: string, { getModuleInfo }: { getModuleInfo: (id: string) => { importers: readonly string[] } | null }): string | undefined => {\r\n // React and React DOM - cached separately\r\n if (id.includes('node_modules/react-dom')) {\r\n return 'vendor-react-dom';\r\n }\r\n if (id.includes('node_modules/react')) {\r\n return 'vendor-react';\r\n }\r\n \r\n // Olova Router - framework code\r\n if (id.includes('olova-router')) {\r\n return 'framework-router';\r\n }\r\n \r\n // Other node_modules - vendor bundle\r\n if (id.includes('node_modules')) {\r\n // Extract package name for better caching\r\n const match = id.match(/node_modules[\\\\/]([^/\\\\]+)/);\r\n if (match) {\r\n const pkg = match[1];\r\n // Group small packages together\r\n if (['scheduler', 'object-assign', 'prop-types'].includes(pkg)) {\r\n return 'vendor-react';\r\n }\r\n // Keep large packages separate\r\n if (['lodash', 'moment', 'axios', 'date-fns'].includes(pkg)) {\r\n return `vendor-${pkg}`;\r\n }\r\n }\r\n return 'vendor';\r\n }\r\n \r\n // Shared components - group together to avoid circular deps\r\n if (id.includes('/components/')) {\r\n return 'common-components';\r\n }\r\n \r\n // Shared utilities\r\n if (id.includes('/utils/') || id.includes('/lib/') || id.includes('/helpers/')) {\r\n return 'common-utils';\r\n }\r\n \r\n // CSS - let Vite handle\r\n if (id.endsWith('.css') || id.endsWith('.scss')) {\r\n return undefined;\r\n }\r\n \r\n // Auth pages + search - group together to avoid circular deps\r\n // (login <-> register <-> search often share components/navigation)\r\n if (id.includes('/(auth)/') || id.includes('\\\\(auth)\\\\') || \r\n id.includes('/search/') || id.includes('\\\\search\\\\')) {\r\n return 'page-auth';\r\n }\r\n \r\n // Route components - be conservative, only split truly isolated routes\r\n // Don't split if the module has cross-route imports\r\n if (id.includes('/src/') && (id.endsWith('/index.tsx') || id.endsWith('/index.mdx'))) {\r\n // Check if this module would cause circular dependencies\r\n const moduleInfo = getModuleInfo(id);\r\n if (moduleInfo) {\r\n // If imported by another route, group with common\r\n for (const importer of moduleInfo.importers) {\r\n if (importer.includes('/src/') && importer.includes('/index.') && !importer.includes(id)) {\r\n return 'common-routes';\r\n }\r\n }\r\n }\r\n \r\n const routeMatch = id.match(/[\\\\/]src[\\\\/](.+?)[\\\\/]index\\.(tsx|mdx)$/);\r\n if (routeMatch) {\r\n const routePath = routeMatch[1]\r\n .replace(/\\([^)]+\\)[\\\\/]/g, '') // Remove route groups\r\n .replace(/\\[.*?\\]/g, 'dynamic') // Replace dynamic segments\r\n .replace(/[\\\\/]/g, '-');\r\n \r\n // Skip if we've seen a chunk with same base that would cause circular\r\n const baseRoute = routePath.split('-')[0];\r\n if (seenModules.has(baseRoute)) {\r\n const existingChunk = seenModules.get(baseRoute)!;\r\n // If related routes, group them\r\n if (existingChunk.startsWith('page-')) {\r\n return existingChunk;\r\n }\r\n }\r\n \r\n const chunkName = `page-${routePath}`;\r\n seenModules.set(baseRoute, chunkName);\r\n return chunkName;\r\n }\r\n }\r\n \r\n return undefined;\r\n };\r\n}\r\n\r\n// =============================================================================\r\n// COMPRESSION PLUGIN\r\n// =============================================================================\r\n\r\n/**\r\n * Compression plugin for generating gzip and brotli compressed assets\r\n */\r\nexport function compressionPlugin(options: PerformanceOptions = {}): Plugin {\r\n const {\r\n gzip: enableGzip = true,\r\n brotli: enableBrotli = true,\r\n threshold = 1024,\r\n extensions = ['js', 'css', 'html', 'json', 'svg', 'xml'],\r\n } = options;\r\n \r\n let config: ResolvedConfig;\r\n \r\n return {\r\n name: 'olova-compression',\r\n apply: 'build',\r\n \r\n configResolved(resolvedConfig) {\r\n config = resolvedConfig;\r\n },\r\n \r\n async closeBundle() {\r\n if (config.command !== 'build' || config.build.ssr) return;\r\n \r\n const outDir = config.build.outDir;\r\n const stats = { gzip: 0, brotli: 0, skipped: 0 };\r\n \r\n // Find all files to compress\r\n const files = await findFilesToCompress(outDir, extensions);\r\n \r\n for (const file of files) {\r\n const content = await fs.readFile(file);\r\n \r\n // Skip small files\r\n if (content.length < threshold) {\r\n stats.skipped++;\r\n continue;\r\n }\r\n \r\n // Gzip compression\r\n if (enableGzip) {\r\n try {\r\n const compressed = await gzip(content, { level: 9 });\r\n await fs.writeFile(`${file}.gz`, compressed);\r\n stats.gzip++;\r\n } catch (e) {\r\n // Silently skip compression errors\r\n }\r\n }\r\n \r\n // Brotli compression\r\n if (enableBrotli) {\r\n try {\r\n const compressed = await brotliCompress(content, {\r\n params: {\r\n [zlib.constants.BROTLI_PARAM_QUALITY]: 11,\r\n },\r\n });\r\n await fs.writeFile(`${file}.br`, compressed);\r\n stats.brotli++;\r\n } catch (e) {\r\n // Silently skip compression errors\r\n }\r\n }\r\n }\r\n \r\n // Log compression stats\r\n if (stats.gzip > 0 || stats.brotli > 0) {\r\n logger.info(`Compressed ${stats.gzip} files (gzip), ${stats.brotli} files (brotli)`);\r\n }\r\n },\r\n };\r\n}\r\n\r\n// =============================================================================\r\n// CHUNK ANALYSIS PLUGIN\r\n// =============================================================================\r\n\r\n/**\r\n * Chunk analysis plugin for monitoring bundle sizes\r\n */\r\nexport function chunkAnalysisPlugin(options: PerformanceOptions = {}): Plugin {\r\n const {\r\n chunkSizeWarning = true,\r\n maxChunkSize = 250,\r\n } = options;\r\n \r\n const chunks: ChunkInfo[] = [];\r\n \r\n return {\r\n name: 'olova-chunk-analysis',\r\n apply: 'build',\r\n \r\n generateBundle(_options, bundle) {\r\n for (const [fileName, chunk] of Object.entries(bundle)) {\r\n if (chunk.type === 'chunk') {\r\n const sizeKB = Buffer.byteLength(chunk.code, 'utf8') / 1024;\r\n \r\n // Determine chunk type\r\n let type: ChunkInfo['type'] = 'other';\r\n if (fileName.includes('vendor')) type = 'vendor';\r\n else if (fileName.includes('framework')) type = 'framework';\r\n else if (fileName.includes('common')) type = 'common';\r\n else if (fileName.includes('page-')) type = 'route';\r\n \r\n chunks.push({\r\n name: fileName,\r\n size: Math.round(sizeKB * 100) / 100,\r\n isEntry: chunk.isEntry,\r\n type,\r\n });\r\n \r\n // Warn about large chunks\r\n if (chunkSizeWarning && sizeKB > maxChunkSize) {\r\n logger.warn(`Chunk \"${fileName}\" is ${sizeKB.toFixed(2)}KB (exceeds ${maxChunkSize}KB limit)`);\r\n }\r\n }\r\n }\r\n },\r\n \r\n closeBundle() {\r\n if (chunks.length === 0) return;\r\n \r\n // Sort by size descending\r\n chunks.sort((a, b) => b.size - a.size);\r\n \r\n // Print chunk summary\r\n console.log('');\r\n logger.info('Bundle Analysis:');\r\n \r\n const typeGroups: Record<string, number> = {};\r\n let totalSize = 0;\r\n \r\n for (const chunk of chunks) {\r\n typeGroups[chunk.type] = (typeGroups[chunk.type] || 0) + chunk.size;\r\n totalSize += chunk.size;\r\n }\r\n \r\n console.log(` Vendor: ${(typeGroups.vendor || 0).toFixed(2)} KB`);\r\n console.log(` Framework: ${(typeGroups.framework || 0).toFixed(2)} KB`);\r\n console.log(` Common: ${(typeGroups.common || 0).toFixed(2)} KB`);\r\n console.log(` Routes: ${(typeGroups.route || 0).toFixed(2)} KB`);\r\n console.log(` Other: ${(typeGroups.other || 0).toFixed(2)} KB`);\r\n console.log(` ─────────────────────`);\r\n console.log(` Total: ${totalSize.toFixed(2)} KB`);\r\n console.log('');\r\n },\r\n };\r\n}\r\n\r\n// =============================================================================\r\n// PRELOAD HINTS GENERATOR\r\n// =============================================================================\r\n\r\nexport interface PreloadHint {\r\n href: string;\r\n as: 'script' | 'style' | 'font' | 'image';\r\n priority: 'critical' | 'high' | 'low';\r\n crossorigin?: boolean;\r\n}\r\n\r\n/**\r\n * Generate optimized preload hints for chunks\r\n */\r\nexport function generatePreloadHints(\r\n chunks: string[],\r\n entryChunk: string\r\n): PreloadHint[] {\r\n const hints: PreloadHint[] = [];\r\n \r\n // Entry chunk - critical priority\r\n hints.push({\r\n href: `/${entryChunk}`,\r\n as: 'script',\r\n priority: 'critical',\r\n });\r\n \r\n for (const chunk of chunks) {\r\n if (chunk === entryChunk) continue;\r\n \r\n // Vendor chunks - high priority (needed for hydration)\r\n if (chunk.includes('vendor')) {\r\n hints.push({\r\n href: `/${chunk}`,\r\n as: 'script',\r\n priority: 'high',\r\n });\r\n }\r\n // Framework chunks - high priority\r\n else if (chunk.includes('framework')) {\r\n hints.push({\r\n href: `/${chunk}`,\r\n as: 'script',\r\n priority: 'high',\r\n });\r\n }\r\n // Common chunks - high priority\r\n else if (chunk.includes('common')) {\r\n hints.push({\r\n href: `/${chunk}`,\r\n as: 'script',\r\n priority: 'high',\r\n });\r\n }\r\n // Route chunks - low priority (prefetch for navigation)\r\n else if (chunk.includes('page-')) {\r\n hints.push({\r\n href: `/${chunk}`,\r\n as: 'script',\r\n priority: 'low',\r\n });\r\n }\r\n }\r\n \r\n return hints;\r\n}\r\n\r\n/**\r\n * Generate HTML preload/prefetch tags from hints\r\n */\r\nexport function generatePreloadTags(hints: PreloadHint[]): string {\r\n return hints\r\n .map((hint) => {\r\n const rel = hint.priority === 'low' ? 'prefetch' : 'modulepreload';\r\n const crossorigin = hint.crossorigin ? ' crossorigin' : '';\r\n return `<link rel=\"${rel}\" href=\"${hint.href}\"${crossorigin}>`;\r\n })\r\n .join('');\r\n}\r\n\r\n// =============================================================================\r\n// UTILITY FUNCTIONS\r\n// =============================================================================\r\n\r\n/**\r\n * Recursively find files to compress\r\n */\r\nasync function findFilesToCompress(\r\n dir: string,\r\n extensions: string[]\r\n): Promise<string[]> {\r\n const files: string[] = [];\r\n \r\n try {\r\n const entries = await fs.readdir(dir, { withFileTypes: true });\r\n \r\n for (const entry of entries) {\r\n const fullPath = path.join(dir, entry.name);\r\n \r\n if (entry.isDirectory()) {\r\n files.push(...await findFilesToCompress(fullPath, extensions));\r\n } else if (entry.isFile()) {\r\n const ext = path.extname(entry.name).slice(1);\r\n if (extensions.includes(ext)) {\r\n files.push(fullPath);\r\n }\r\n }\r\n }\r\n } catch (e) {\r\n // Directory doesn't exist or can't be read\r\n }\r\n \r\n return files;\r\n}\r\n\r\n/**\r\n * Calculate gzip size of content\r\n */\r\nexport async function getGzipSize(content: string | Buffer): Promise<number> {\r\n const buffer = typeof content === 'string' ? Buffer.from(content) : content;\r\n const compressed = await gzip(buffer);\r\n return compressed.length;\r\n}\r\n\r\n/**\r\n * Format bytes to human readable size\r\n */\r\nexport function formatBytes(bytes: number): string {\r\n if (bytes < 1024) return `${bytes} B`;\r\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(2)} KB`;\r\n return `${(bytes / (1024 * 1024)).toFixed(2)} MB`;\r\n}\r\n\r\n// =============================================================================\r\n// COMBINED PERFORMANCE PLUGIN\r\n// =============================================================================\r\n\r\n/**\r\n * Main performance plugin that combines all optimizations\r\n */\r\nexport function olovaPerformance(options: PerformanceOptions = {}): Plugin[] {\r\n return [\r\n chunkAnalysisPlugin(options),\r\n compressionPlugin(options),\r\n ];\r\n}\r\n\r\nexport default olovaPerformance;\r\n"]}
@@ -0,0 +1,51 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+ var server = require('react-dom/server');
5
+ var virtual_olovaApp = require('virtual:olova-app');
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+
8
+ // src/entry-server.tsx
9
+ var wrappedLayouts = virtual_olovaApp.layouts.map((item) => ({
10
+ ...item,
11
+ layout: (props) => /* @__PURE__ */ jsxRuntime.jsx(item.layout, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(virtual_olovaApp.Outlet, {}) })
12
+ }));
13
+ async function render(url) {
14
+ const globalAny = globalThis;
15
+ globalAny.window = {
16
+ location: { pathname: url, search: "", hash: "" },
17
+ addEventListener: () => {
18
+ },
19
+ removeEventListener: () => {
20
+ },
21
+ history: {
22
+ pushState: () => {
23
+ },
24
+ replaceState: () => {
25
+ },
26
+ location: { pathname: url, search: "", hash: "" }
27
+ }
28
+ };
29
+ globalAny.location = globalAny.window.location;
30
+ globalAny.document = {
31
+ createElement: () => ({}),
32
+ getElementsByTagName: () => [],
33
+ getElementById: () => null,
34
+ querySelector: () => null,
35
+ title: "",
36
+ location: globalAny.window.location
37
+ };
38
+ console.log(`[SSR] Rendering path: ${url}`);
39
+ const html = server.renderToString(
40
+ /* @__PURE__ */ jsxRuntime.jsx(react.StrictMode, { children: /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(virtual_olovaApp.OlovaRouter, { routes: virtual_olovaApp.routes, layouts: wrappedLayouts, notFoundPages: virtual_olovaApp.notFoundPages }) }) })
41
+ );
42
+ return html;
43
+ }
44
+
45
+ Object.defineProperty(exports, "routes", {
46
+ enumerable: true,
47
+ get: function () { return virtual_olovaApp.routes; }
48
+ });
49
+ exports.render = render;
50
+ //# sourceMappingURL=entry-server.cjs.map
51
+ //# sourceMappingURL=entry-server.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/entry-server.tsx"],"names":["layouts","jsx","Outlet","renderToString","StrictMode","Suspense","OlovaRouter","routes","notFoundPages"],"mappings":";;;;;;;;AAMA,IAAM,cAAA,GAAiBA,wBAAA,CAAQ,GAAA,CAAI,CAAC,IAAA,MAAe;AAAA,EACjD,GAAG,IAAA;AAAA,EACH,MAAA,EAAQ,CAAC,KAAA,qBACPC,cAAA,CAAC,IAAA,CAAK,MAAA,EAAL,EAAa,GAAG,KAAA,EACf,QAAA,kBAAAA,cA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GACF;AAEA,EAAA,OAAO,IAAA;AACT","file":"entry-server.cjs","sourcesContent":["import { StrictMode, Suspense } from 'react';\r\nimport { renderToString } from 'react-dom/server';\r\n// @ts-expect-error - Virtual module resolved by vite-plugin-olova\r\nimport { layouts, notFoundPages, OlovaRouter, Outlet, routes } from 'virtual:olova-app';\r\n\r\n// Wrapper to support \"children\" prop style layouts\r\nconst wrappedLayouts = layouts.map((item: any) => ({\r\n ...item,\r\n layout: (props: any) => (\r\n <item.layout {...props}>\r\n <Outlet />\r\n </item.layout>\r\n )\r\n}));\r\n\r\nexport async function render(url: string) {\r\n // Always recreate the window mock to ensure clean state for every SSG path\r\n const globalAny = globalThis as any;\r\n globalAny.window = {\r\n location: { pathname: url, search: '', hash: '' },\r\n addEventListener: () => {},\r\n removeEventListener: () => {},\r\n history: { \r\n pushState: () => {}, \r\n replaceState: () => {}, \r\n location: { pathname: url, search: '', hash: '' } \r\n }\r\n };\r\n globalAny.location = globalAny.window.location;\r\n globalAny.document = {\r\n createElement: () => ({}),\r\n getElementsByTagName: () => [],\r\n getElementById: () => null,\r\n querySelector: () => null,\r\n title: '',\r\n location: globalAny.window.location\r\n };\r\n\r\n console.log(`[SSR] Rendering path: ${url}`);\r\n\r\n // Wrap in Suspense to handle lazy-loaded components\r\n const html = renderToString(\r\n <StrictMode>\r\n <Suspense fallback={null}>\r\n <OlovaRouter routes={routes} layouts={wrappedLayouts} notFoundPages={notFoundPages} />\r\n </Suspense>\r\n </StrictMode>\r\n );\r\n\r\n return html;\r\n}\r\n\r\nexport { routes };\r\n\r\n"]}