olova 2.0.54 → 2.0.56

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 (96) hide show
  1. package/README.md +34 -283
  2. package/dist/chunk-23UAGQ6N.js +2208 -0
  3. package/dist/chunk-23UAGQ6N.js.map +1 -0
  4. package/dist/chunk-D7SIC5TC.js +367 -0
  5. package/dist/chunk-D7SIC5TC.js.map +1 -0
  6. package/dist/entry-server.cjs +2341 -0
  7. package/dist/entry-server.cjs.map +1 -0
  8. package/dist/entry-server.js +114 -0
  9. package/dist/entry-server.js.map +1 -0
  10. package/dist/entry-worker.cjs +2354 -0
  11. package/dist/entry-worker.cjs.map +1 -0
  12. package/dist/entry-worker.js +126 -0
  13. package/dist/entry-worker.js.map +1 -0
  14. package/dist/main.cjs +18 -0
  15. package/dist/main.cjs.map +1 -0
  16. package/dist/main.js +16 -0
  17. package/dist/main.js.map +1 -0
  18. package/dist/olova.cjs +1684 -0
  19. package/dist/olova.cjs.map +1 -0
  20. package/dist/olova.d.cts +72 -0
  21. package/dist/olova.d.ts +72 -0
  22. package/dist/olova.js +1325 -0
  23. package/dist/olova.js.map +1 -0
  24. package/dist/performance.cjs +386 -0
  25. package/dist/performance.cjs.map +1 -0
  26. package/dist/performance.js +3 -0
  27. package/dist/performance.js.map +1 -0
  28. package/dist/router.cjs +646 -0
  29. package/dist/router.cjs.map +1 -0
  30. package/dist/router.d.cts +113 -0
  31. package/dist/router.d.ts +113 -0
  32. package/dist/router.js +632 -0
  33. package/dist/router.js.map +1 -0
  34. package/main.tsx +76 -0
  35. package/olova.ts +619 -0
  36. package/package.json +37 -55
  37. package/src/entry-server.tsx +165 -0
  38. package/src/entry-worker.tsx +201 -0
  39. package/src/generator/index.ts +409 -0
  40. package/src/hydration/flight.ts +320 -0
  41. package/src/hydration/index.ts +12 -0
  42. package/src/hydration/types.ts +225 -0
  43. package/src/logger.ts +182 -0
  44. package/src/main.tsx +24 -0
  45. package/src/performance.ts +488 -0
  46. package/src/plugin/index.ts +204 -0
  47. package/src/router/ErrorBoundary.tsx +145 -0
  48. package/src/router/Link.tsx +117 -0
  49. package/src/router/OlovaRouter.tsx +354 -0
  50. package/src/router/Outlet.tsx +8 -0
  51. package/src/router/context.ts +117 -0
  52. package/src/router/index.ts +29 -0
  53. package/src/router/matching.ts +63 -0
  54. package/src/router/router.tsx +23 -0
  55. package/src/router/search-params.ts +29 -0
  56. package/src/scanner/index.ts +116 -0
  57. package/src/types/index.ts +191 -0
  58. package/src/utils/export.ts +85 -0
  59. package/src/utils/index.ts +4 -0
  60. package/src/utils/naming.ts +54 -0
  61. package/src/utils/path.ts +45 -0
  62. package/tsup.config.ts +35 -0
  63. package/dist/client-BBLXpllK.d.ts +0 -487
  64. package/dist/client-C0av_vTZ.d.cts +0 -487
  65. package/dist/client.cjs +0 -850
  66. package/dist/client.cjs.map +0 -1
  67. package/dist/client.d.cts +0 -5
  68. package/dist/client.d.ts +0 -5
  69. package/dist/client.js +0 -816
  70. package/dist/client.js.map +0 -1
  71. package/dist/image.cjs +0 -25
  72. package/dist/image.cjs.map +0 -1
  73. package/dist/image.d.cts +0 -1
  74. package/dist/image.d.ts +0 -1
  75. package/dist/image.js +0 -3
  76. package/dist/image.js.map +0 -1
  77. package/dist/index.cjs +0 -907
  78. package/dist/index.cjs.map +0 -1
  79. package/dist/index.d.cts +0 -31
  80. package/dist/index.d.ts +0 -31
  81. package/dist/index.js +0 -868
  82. package/dist/index.js.map +0 -1
  83. package/dist/plugin/index.cjs +0 -1550
  84. package/dist/plugin/index.cjs.map +0 -1
  85. package/dist/plugin/index.d.cts +0 -131
  86. package/dist/plugin/index.d.ts +0 -131
  87. package/dist/plugin/index.js +0 -1490
  88. package/dist/plugin/index.js.map +0 -1
  89. package/dist/serialization-xKcOESDh.d.cts +0 -122
  90. package/dist/serialization-xKcOESDh.d.ts +0 -122
  91. package/dist/server.cjs +0 -547
  92. package/dist/server.cjs.map +0 -1
  93. package/dist/server.d.cts +0 -148
  94. package/dist/server.d.ts +0 -148
  95. package/dist/server.js +0 -493
  96. package/dist/server.js.map +0 -1
@@ -1,487 +0,0 @@
1
- import React$1 from 'react';
2
- import { UserConfig } from 'vite';
3
- import * as react_jsx_runtime from 'react/jsx-runtime';
4
- import { c as HydrationState, H as HydrationHint } from './serialization-xKcOESDh.cjs';
5
-
6
- interface PageMetadata {
7
- title?: string;
8
- description?: string;
9
- keywords?: string;
10
- author?: string;
11
- openGraph?: {
12
- title?: string;
13
- description?: string;
14
- type?: string;
15
- url?: string;
16
- image?: string;
17
- };
18
- twitter?: {
19
- card?: string;
20
- site?: string;
21
- title?: string;
22
- description?: string;
23
- image?: string;
24
- };
25
- robots?: string;
26
- canonical?: string;
27
- schema?: {
28
- "@type"?: string;
29
- [key: string]: any;
30
- } | Array<{
31
- "@type": string;
32
- [key: string]: any;
33
- }>;
34
- }
35
-
36
- interface Route {
37
- path: string;
38
- component: () => Promise<{
39
- default: React$1.ComponentType<any>;
40
- }>;
41
- layouts?: (() => Promise<{
42
- default: React$1.ComponentType<any>;
43
- }>)[];
44
- loading?: () => Promise<{
45
- default: React$1.ComponentType<any>;
46
- }>;
47
- error?: () => Promise<{
48
- default: React$1.ComponentType<any>;
49
- }>;
50
- notFound?: () => Promise<{
51
- default: React$1.ComponentType<any>;
52
- }>;
53
- template?: () => Promise<{
54
- default: React$1.ComponentType<any>;
55
- }>;
56
- static: boolean;
57
- dynamic?: boolean;
58
- metadata?: any;
59
- }
60
- interface OlovaOptions {
61
- pagesDir?: string;
62
- }
63
- interface Manifest {
64
- routes: Route[];
65
- }
66
- /**
67
- * Olova Framework Configuration Interface
68
- * Similar to next.config.js options in Next.js
69
- */
70
- interface OlovaConfig {
71
- /**
72
- * Output directory for the built files
73
- * @default '.olova/dist'
74
- */
75
- outDir?: string;
76
- /**
77
- * Base path for the application (like Next.js basePath)
78
- * @default '/'
79
- */
80
- basePath?: string;
81
- /**
82
- * Enable trailing slashes on routes
83
- * @default false
84
- */
85
- trailingSlash?: boolean;
86
- /**
87
- * Enable experimental features
88
- */
89
- experimental?: {
90
- /**
91
- * Enable prefetching for Link components
92
- * @default true
93
- */
94
- prefetch?: boolean;
95
- /**
96
- * Enable React Server Components (future)
97
- * @default false
98
- */
99
- serverComponents?: boolean;
100
- };
101
- /**
102
- * Configure static generation
103
- */
104
- staticGeneration?: {
105
- /**
106
- * Timeout for SSG rendering in milliseconds
107
- * @default 30000
108
- */
109
- timeout?: number;
110
- /**
111
- * Fallback behavior for dynamic routes
112
- * @default 'blocking'
113
- */
114
- fallback?: 'static' | 'blocking' | false;
115
- };
116
- /**
117
- * SSG (Static Site Generation) configuration
118
- */
119
- ssg?: {
120
- /**
121
- * Enable SSG globally
122
- * @default false
123
- */
124
- enabled?: boolean;
125
- /**
126
- * Routes to prerender at build time
127
- */
128
- prerender?: string[];
129
- };
130
- /**
131
- * Flight payload configuration for hydration and streaming
132
- */
133
- flight?: {
134
- /**
135
- * Enable streaming SSR with React 18
136
- * @default true
137
- */
138
- streaming?: boolean;
139
- /**
140
- * Enable progressive hydration based on visibility
141
- * @default true
142
- */
143
- progressive?: boolean;
144
- /**
145
- * Inline critical CSS in head
146
- * @default true
147
- */
148
- inlineStyles?: boolean;
149
- /**
150
- * Prefetch page data on hover
151
- * @default true
152
- */
153
- prefetchData?: boolean;
154
- /**
155
- * Enable selective hydration (only hydrate interactive components)
156
- * @default true
157
- */
158
- selective?: boolean;
159
- /**
160
- * Defer below-fold content hydration
161
- * @default true
162
- */
163
- deferOffscreen?: boolean;
164
- };
165
- /**
166
- * Image optimization settings
167
- */
168
- images?: {
169
- /**
170
- * Allowed image domains
171
- */
172
- domains?: string[];
173
- /**
174
- * Device sizes for responsive images
175
- */
176
- deviceSizes?: number[];
177
- };
178
- /**
179
- * Environment variables to expose to the client
180
- */
181
- env?: Record<string, string>;
182
- /**
183
- * Custom headers for routes
184
- */
185
- headers?: () => Promise<Array<{
186
- source: string;
187
- headers: Array<{
188
- key: string;
189
- value: string;
190
- }>;
191
- }>>;
192
- /**
193
- * Redirects configuration
194
- */
195
- redirects?: () => Promise<Array<{
196
- source: string;
197
- destination: string;
198
- permanent: boolean;
199
- }>>;
200
- /**
201
- * Rewrites configuration
202
- */
203
- rewrites?: () => Promise<Array<{
204
- source: string;
205
- destination: string;
206
- }>>;
207
- /**
208
- * Hydration and streaming configuration
209
- */
210
- hydration?: {
211
- /**
212
- * Enable streaming SSR with React 18
213
- * @default true
214
- */
215
- streaming?: boolean;
216
- /**
217
- * Enable progressive hydration based on visibility
218
- * @default true
219
- */
220
- progressive?: boolean;
221
- /**
222
- * Defer hydration of below-fold content
223
- * @default true
224
- */
225
- deferOffscreen?: boolean;
226
- /**
227
- * Enable Flight format for efficient hydration
228
- * @default true
229
- */
230
- flight?: boolean;
231
- };
232
- /**
233
- * CSS configuration options
234
- */
235
- css?: {
236
- /**
237
- * Global CSS files to include automatically
238
- * These will be injected into every page
239
- * Paths are relative to the src directory
240
- * @example ['index.css', 'globals.css']
241
- */
242
- global?: string[];
243
- /**
244
- * Enable CSS Modules support (*.module.css files)
245
- * @default true
246
- */
247
- modules?: boolean;
248
- /**
249
- * CSS minification options for production
250
- * @default true
251
- */
252
- minify?: boolean | {
253
- preset?: 'default' | 'advanced';
254
- removeComments?: boolean;
255
- };
256
- /**
257
- * Enable Tailwind CSS auto-detection
258
- * When enabled, the framework will look for tailwind.config.js/ts
259
- * @default true
260
- */
261
- tailwind?: boolean;
262
- /**
263
- * PostCSS configuration
264
- * Set to false to disable, or provide custom plugins
265
- * If not specified, defaults to autoprefixer
266
- */
267
- postcss?: boolean | {
268
- plugins?: any[];
269
- };
270
- /**
271
- * Extract CSS to separate files in production
272
- * @default true
273
- */
274
- extract?: boolean;
275
- /**
276
- * Enable source maps for CSS in development
277
- * @default true
278
- */
279
- devSourceMap?: boolean;
280
- };
281
- /**
282
- * The public URL of the production site (required for sitemaps, robots.txt, etc)
283
- * @example 'https://olova.dev'
284
- */
285
- siteUrl?: string;
286
- /**
287
- * SEO and Metadata configuration
288
- */
289
- seo?: {
290
- /**
291
- * Automatically generate sitemap.xml
292
- * @default true
293
- */
294
- sitemap?: boolean;
295
- /**
296
- * Automatically generate robots.txt
297
- * @default true
298
- */
299
- robots?: boolean | {
300
- /**
301
- * Custom robots.txt content or rules
302
- */
303
- rules?: string;
304
- /**
305
- * Additional sitemap URLs
306
- */
307
- sitemaps?: string[];
308
- };
309
- /**
310
- * Automatically inject canonical URLs
311
- * @default true
312
- */
313
- canonical?: boolean;
314
- /**
315
- * Default metadata to use when not specified on a page
316
- */
317
- defaultMetadata?: PageMetadata;
318
- };
319
- /**
320
- * Custom Vite config overrides
321
- */
322
- vite?: Partial<UserConfig>;
323
- }
324
-
325
- /**
326
- * Router Types
327
- * Type definitions for the Olova router system
328
- */
329
-
330
- interface RouterProps {
331
- routes: Route[];
332
- }
333
- interface NavigateOptions {
334
- scroll?: boolean;
335
- shallow?: boolean;
336
- }
337
- interface RouterContextType {
338
- pathname: string;
339
- params: Record<string, string | string[]>;
340
- query: Record<string, string | string[]>;
341
- asPath: string;
342
- push: (url: string, options?: NavigateOptions) => Promise<boolean>;
343
- replace: (url: string, options?: NavigateOptions) => Promise<boolean>;
344
- back: () => void;
345
- forward: () => void;
346
- prefetch: (url: string) => Promise<void>;
347
- reload: () => void;
348
- isReady: boolean;
349
- isNavigating: boolean;
350
- isFallback: boolean;
351
- events: RouterEvents;
352
- }
353
- interface RouterEvents {
354
- on: (event: RouterEventType, handler: RouterEventHandler) => void;
355
- off: (event: RouterEventType, handler: RouterEventHandler) => void;
356
- emit: (event: RouterEventType, ...args: any[]) => void;
357
- }
358
- type RouterEventType = 'routeChangeStart' | 'routeChangeComplete' | 'routeChangeError' | 'beforeHistoryChange' | 'hashChangeStart' | 'hashChangeComplete';
359
- type RouterEventHandler = (...args: any[]) => void;
360
- interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
361
- href: string;
362
- children: React.ReactNode;
363
- prefetch?: boolean;
364
- scroll?: boolean;
365
- replace?: boolean;
366
- shallow?: boolean;
367
- passHref?: boolean;
368
- locale?: string;
369
- legacyBehavior?: boolean;
370
- }
371
-
372
- /**
373
- * Navigation Functions
374
- * Programmatic navigation utilities
375
- */
376
-
377
- /**
378
- * Navigate to a new URL (push to history)
379
- */
380
- declare function navigate(to: string, options?: NavigateOptions): Promise<boolean>;
381
- /**
382
- * Replace current URL in history
383
- */
384
- declare function replace(to: string, options?: NavigateOptions): Promise<boolean>;
385
- /**
386
- * Programmatic redirect (client-side)
387
- */
388
- declare function redirect(url: string): never;
389
- /**
390
- * Permanent redirect (client-side)
391
- */
392
- declare function permanentRedirect(url: string): never;
393
- /**
394
- * Throw 404 error
395
- */
396
- declare function notFound(): never;
397
-
398
- /**
399
- * Router Hooks
400
- * React hooks for navigation and route information
401
- */
402
-
403
- /**
404
- * Access the router context
405
- */
406
- declare function useRouter(): RouterContextType;
407
- /**
408
- * Access route parameters
409
- */
410
- declare function useParams<T extends Record<string, string | string[]> = Record<string, string | string[]>>(): T;
411
- /**
412
- * Get the current pathname
413
- */
414
- declare function usePathname(): string;
415
- /**
416
- * Access URL search parameters
417
- */
418
- declare function useSearchParams(): URLSearchParams;
419
-
420
- declare function Link({ href, children, prefetch: shouldPrefetch, scroll, replace: shouldReplace, shallow, ...props }: LinkProps): react_jsx_runtime.JSX.Element;
421
-
422
- declare function Router({ routes }: RouterProps): react_jsx_runtime.JSX.Element | null;
423
-
424
- /**
425
- * Head component - client-side document head management
426
- */
427
- declare function Head({ children }: {
428
- children: React$1.ReactNode;
429
- }): null;
430
-
431
- interface MetaProps {
432
- name?: string;
433
- property?: string;
434
- httpEquiv?: string;
435
- content: string;
436
- }
437
- interface HeadLinkProps {
438
- rel: string;
439
- href: string;
440
- as?: string;
441
- }
442
- interface TitleProps {
443
- children: string;
444
- }
445
- interface HeadState {
446
- title?: string;
447
- metas: Map<string, MetaProps>;
448
- links: Map<string, HeadLinkProps>;
449
- }
450
- /**
451
- * Provider for Head state management
452
- */
453
- declare function HeadProvider({ children }: {
454
- children: React$1.ReactNode;
455
- }): react_jsx_runtime.JSX.Element;
456
-
457
- /**
458
- * Hook to access page data (like getStaticProps props)
459
- */
460
- declare function usePageData<T = any>(): T | null;
461
-
462
- /**
463
- * Hydration scheduler - Prioritizes component hydration
464
- */
465
- declare class HydrationScheduler {
466
- private queue;
467
- private isProcessing;
468
- private state;
469
- constructor();
470
- getState(): HydrationState;
471
- schedule(id: string, priority: HydrationHint['priority'], task: () => void): void;
472
- private processQueue;
473
- private receiveChunk;
474
- private hydrateNode;
475
- }
476
-
477
- /**
478
- * Olova Hydration Module
479
- * Implements "Flight" format for efficient client hydration
480
- */
481
-
482
- /**
483
- * Get the global hydration scheduler instance
484
- */
485
- declare function getHydrationScheduler(): any;
486
-
487
- export { Head as H, Link as L, type Manifest as M, type NavigateOptions as N, type OlovaConfig as O, type Route as R, type TitleProps as T, type OlovaOptions as a, Router as b, useParams as c, usePathname as d, useSearchParams as e, redirect as f, notFound as g, type RouterProps as h, type RouterContextType as i, type LinkProps as j, HeadProvider as k, type HeadState as l, type MetaProps as m, navigate as n, type HeadLinkProps as o, permanentRedirect as p, usePageData as q, replace as r, HydrationScheduler as s, getHydrationScheduler as t, useRouter as u };