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
package/dist/server.d.cts DELETED
@@ -1,148 +0,0 @@
1
- import React from 'react';
2
- import { Writable } from 'stream';
3
- import { e as FlightSEO, f as FlightMeta, F as FlightPayload, H as HydrationHint, h as FlightContext } from './serialization-xKcOESDh.cjs';
4
- export { b as FlightChunk, a as FlightNode, i as generateFlightScript } from './serialization-xKcOESDh.cjs';
5
-
6
- /**
7
- * For SSR/SSG - extract head elements to string
8
- */
9
- declare function renderHeadToString(children: React.ReactNode): {
10
- title: string;
11
- metas: string;
12
- };
13
-
14
- /**
15
- * Serialize data for injection into HTML
16
- */
17
- declare function serializePageData(data: any): string;
18
-
19
- /**
20
- * Reset node ID counter
21
- */
22
- declare function resetFlightContext(): void;
23
- /**
24
- * Create an empty Flight payload
25
- */
26
- declare function createFlightPayload(route: string, options?: {
27
- seo?: FlightSEO;
28
- meta?: FlightMeta;
29
- buildId?: string;
30
- }): FlightPayload;
31
- /**
32
- * Add a node to the Flight payload
33
- */
34
- declare function addFlightNode(payload: FlightPayload, type: string, props: Record<string, any>, options?: {
35
- hydrate?: boolean;
36
- suspense?: boolean;
37
- children?: string[];
38
- }): string;
39
- /**
40
- * Add component data to payload
41
- */
42
- declare function addFlightData(payload: FlightPayload, key: string, data: any): void;
43
- /**
44
- * Add a streaming chunk
45
- */
46
- declare function addFlightChunk(payload: FlightPayload, id: string, html: string, data?: any): void;
47
- /**
48
- * Add hydration hint
49
- */
50
- declare function addHydrationHint(payload: FlightPayload, hint: HydrationHint): void;
51
-
52
- /**
53
- * Set current Flight context (server-side)
54
- */
55
- declare function setFlightContext(context: FlightContext): void;
56
- /**
57
- * Clear Flight context
58
- */
59
- declare function clearFlightContext(): void;
60
-
61
- interface StreamingOptions {
62
- bootstrapScripts?: string[];
63
- bootstrapModules?: string[];
64
- onShellReady?: () => void;
65
- onShellError?: (error: Error) => void;
66
- onAllReady?: () => void;
67
- onError?: (error: Error) => void;
68
- signal?: AbortSignal;
69
- timeout?: number;
70
- progressiveHydration?: boolean;
71
- }
72
- interface StreamingResult {
73
- pipe: (destination: Writable) => Writable;
74
- abort: () => void;
75
- payload: FlightPayload;
76
- }
77
- interface RenderToStringResult {
78
- html: string;
79
- payload: FlightPayload;
80
- }
81
- /**
82
- * Render React tree to a streaming response
83
- */
84
- declare function renderToStream(element: React.ReactElement, route: string, options?: StreamingOptions): StreamingResult;
85
- /**
86
- * Render to string with Flight payload
87
- */
88
- declare function renderToStringWithFlight(element: React.ReactElement, route: string): RenderToStringResult;
89
-
90
- interface HtmlShellOptions {
91
- title?: string;
92
- description?: string;
93
- head?: string;
94
- /** Array of stylesheet URLs to include */
95
- styles?: string[];
96
- /** Critical CSS to inline in the head for above-the-fold content */
97
- criticalCss?: string;
98
- /** Global CSS file URLs (injected before other styles) */
99
- globalCss?: string[];
100
- /** CSS Module file URLs */
101
- cssModules?: string[];
102
- scripts?: string[];
103
- flightPayload?: FlightPayload;
104
- pageData?: any;
105
- lang?: string;
106
- bodyClass?: string;
107
- }
108
- /**
109
- * Generate HTML shell
110
- */
111
- declare function generateHtmlShell(options?: HtmlShellOptions): {
112
- head: string;
113
- tail: string;
114
- };
115
- /**
116
- * Generate complete HTML with content
117
- */
118
- declare function generateCompleteHtml(content: string, options?: HtmlShellOptions): string;
119
-
120
- interface StreamingResponseOptions extends StreamingOptions {
121
- status?: number;
122
- headers?: Record<string, string>;
123
- }
124
- /**
125
- * Create a Transform stream that injects Flight chunks
126
- */
127
- declare function createFlightInjector(payload: FlightPayload): {
128
- addChunk(id: string, html: string, data?: any): void;
129
- flush(): string;
130
- };
131
- /**
132
- * Create a Suspense fallback placeholder
133
- */
134
- declare function createSuspensePlaceholder(id: string): string;
135
- /**
136
- * Create resolved Suspense content
137
- */
138
- declare function createSuspenseResolved(id: string, html: string): string;
139
- /**
140
- * Check if we're in a streaming context
141
- */
142
- declare function isStreaming(): boolean;
143
- /**
144
- * Create headers for streaming response
145
- */
146
- declare function createStreamingHeaders(options?: StreamingResponseOptions): Record<string, string>;
147
-
148
- export { FlightContext, FlightPayload, type HtmlShellOptions, HydrationHint, type StreamingOptions, type StreamingResult, addFlightChunk, addFlightData, addFlightNode, addHydrationHint, clearFlightContext, createFlightInjector, createFlightPayload, createStreamingHeaders, createSuspensePlaceholder, createSuspenseResolved, generateCompleteHtml, generateHtmlShell, isStreaming, renderHeadToString, renderToStream, renderToStringWithFlight, resetFlightContext, serializePageData, setFlightContext };
package/dist/server.d.ts DELETED
@@ -1,148 +0,0 @@
1
- import React from 'react';
2
- import { Writable } from 'stream';
3
- import { e as FlightSEO, f as FlightMeta, F as FlightPayload, H as HydrationHint, h as FlightContext } from './serialization-xKcOESDh.js';
4
- export { b as FlightChunk, a as FlightNode, i as generateFlightScript } from './serialization-xKcOESDh.js';
5
-
6
- /**
7
- * For SSR/SSG - extract head elements to string
8
- */
9
- declare function renderHeadToString(children: React.ReactNode): {
10
- title: string;
11
- metas: string;
12
- };
13
-
14
- /**
15
- * Serialize data for injection into HTML
16
- */
17
- declare function serializePageData(data: any): string;
18
-
19
- /**
20
- * Reset node ID counter
21
- */
22
- declare function resetFlightContext(): void;
23
- /**
24
- * Create an empty Flight payload
25
- */
26
- declare function createFlightPayload(route: string, options?: {
27
- seo?: FlightSEO;
28
- meta?: FlightMeta;
29
- buildId?: string;
30
- }): FlightPayload;
31
- /**
32
- * Add a node to the Flight payload
33
- */
34
- declare function addFlightNode(payload: FlightPayload, type: string, props: Record<string, any>, options?: {
35
- hydrate?: boolean;
36
- suspense?: boolean;
37
- children?: string[];
38
- }): string;
39
- /**
40
- * Add component data to payload
41
- */
42
- declare function addFlightData(payload: FlightPayload, key: string, data: any): void;
43
- /**
44
- * Add a streaming chunk
45
- */
46
- declare function addFlightChunk(payload: FlightPayload, id: string, html: string, data?: any): void;
47
- /**
48
- * Add hydration hint
49
- */
50
- declare function addHydrationHint(payload: FlightPayload, hint: HydrationHint): void;
51
-
52
- /**
53
- * Set current Flight context (server-side)
54
- */
55
- declare function setFlightContext(context: FlightContext): void;
56
- /**
57
- * Clear Flight context
58
- */
59
- declare function clearFlightContext(): void;
60
-
61
- interface StreamingOptions {
62
- bootstrapScripts?: string[];
63
- bootstrapModules?: string[];
64
- onShellReady?: () => void;
65
- onShellError?: (error: Error) => void;
66
- onAllReady?: () => void;
67
- onError?: (error: Error) => void;
68
- signal?: AbortSignal;
69
- timeout?: number;
70
- progressiveHydration?: boolean;
71
- }
72
- interface StreamingResult {
73
- pipe: (destination: Writable) => Writable;
74
- abort: () => void;
75
- payload: FlightPayload;
76
- }
77
- interface RenderToStringResult {
78
- html: string;
79
- payload: FlightPayload;
80
- }
81
- /**
82
- * Render React tree to a streaming response
83
- */
84
- declare function renderToStream(element: React.ReactElement, route: string, options?: StreamingOptions): StreamingResult;
85
- /**
86
- * Render to string with Flight payload
87
- */
88
- declare function renderToStringWithFlight(element: React.ReactElement, route: string): RenderToStringResult;
89
-
90
- interface HtmlShellOptions {
91
- title?: string;
92
- description?: string;
93
- head?: string;
94
- /** Array of stylesheet URLs to include */
95
- styles?: string[];
96
- /** Critical CSS to inline in the head for above-the-fold content */
97
- criticalCss?: string;
98
- /** Global CSS file URLs (injected before other styles) */
99
- globalCss?: string[];
100
- /** CSS Module file URLs */
101
- cssModules?: string[];
102
- scripts?: string[];
103
- flightPayload?: FlightPayload;
104
- pageData?: any;
105
- lang?: string;
106
- bodyClass?: string;
107
- }
108
- /**
109
- * Generate HTML shell
110
- */
111
- declare function generateHtmlShell(options?: HtmlShellOptions): {
112
- head: string;
113
- tail: string;
114
- };
115
- /**
116
- * Generate complete HTML with content
117
- */
118
- declare function generateCompleteHtml(content: string, options?: HtmlShellOptions): string;
119
-
120
- interface StreamingResponseOptions extends StreamingOptions {
121
- status?: number;
122
- headers?: Record<string, string>;
123
- }
124
- /**
125
- * Create a Transform stream that injects Flight chunks
126
- */
127
- declare function createFlightInjector(payload: FlightPayload): {
128
- addChunk(id: string, html: string, data?: any): void;
129
- flush(): string;
130
- };
131
- /**
132
- * Create a Suspense fallback placeholder
133
- */
134
- declare function createSuspensePlaceholder(id: string): string;
135
- /**
136
- * Create resolved Suspense content
137
- */
138
- declare function createSuspenseResolved(id: string, html: string): string;
139
- /**
140
- * Check if we're in a streaming context
141
- */
142
- declare function isStreaming(): boolean;
143
- /**
144
- * Create headers for streaming response
145
- */
146
- declare function createStreamingHeaders(options?: StreamingResponseOptions): Record<string, string>;
147
-
148
- export { FlightContext, FlightPayload, type HtmlShellOptions, HydrationHint, type StreamingOptions, type StreamingResult, addFlightChunk, addFlightData, addFlightNode, addHydrationHint, clearFlightContext, createFlightInjector, createFlightPayload, createStreamingHeaders, createSuspensePlaceholder, createSuspenseResolved, generateCompleteHtml, generateHtmlShell, isStreaming, renderHeadToString, renderToStream, renderToStringWithFlight, resetFlightContext, serializePageData, setFlightContext };