@useavalon/avalon 0.1.11 → 0.1.13

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 (141) hide show
  1. package/README.md +54 -54
  2. package/mod.ts +302 -302
  3. package/package.json +49 -26
  4. package/src/build/integration-bundler-plugin.ts +116 -116
  5. package/src/build/integration-config.ts +168 -168
  6. package/src/build/integration-detection-plugin.ts +117 -117
  7. package/src/build/integration-resolver-plugin.ts +90 -90
  8. package/src/build/island-manifest.ts +269 -269
  9. package/src/build/island-types-generator.ts +476 -476
  10. package/src/build/mdx-island-transform.ts +464 -464
  11. package/src/build/mdx-plugin.ts +98 -98
  12. package/src/build/page-island-transform.ts +598 -598
  13. package/src/build/prop-extractors/index.ts +21 -21
  14. package/src/build/prop-extractors/lit.ts +140 -140
  15. package/src/build/prop-extractors/qwik.ts +16 -16
  16. package/src/build/prop-extractors/solid.ts +125 -125
  17. package/src/build/prop-extractors/svelte.ts +194 -194
  18. package/src/build/prop-extractors/vue.ts +111 -111
  19. package/src/build/sidecar-file-manager.ts +104 -104
  20. package/src/build/sidecar-renderer.ts +30 -30
  21. package/src/client/adapters/index.ts +21 -13
  22. package/src/client/components.ts +35 -35
  23. package/src/client/css-hmr-handler.ts +344 -344
  24. package/src/client/framework-adapter.ts +462 -462
  25. package/src/client/hmr-coordinator.ts +396 -396
  26. package/src/client/hmr-error-overlay.js +533 -533
  27. package/src/client/main.js +824 -816
  28. package/src/client/types/framework-runtime.d.ts +68 -68
  29. package/src/client/types/vite-hmr.d.ts +46 -46
  30. package/src/client/types/vite-virtual-modules.d.ts +70 -60
  31. package/src/components/Image.tsx +123 -123
  32. package/src/components/IslandErrorBoundary.tsx +145 -145
  33. package/src/components/LayoutDataErrorBoundary.tsx +141 -141
  34. package/src/components/LayoutErrorBoundary.tsx +127 -127
  35. package/src/components/PersistentIsland.tsx +52 -52
  36. package/src/components/StreamingErrorBoundary.tsx +233 -233
  37. package/src/components/StreamingLayout.tsx +538 -538
  38. package/src/core/components/component-analyzer.ts +192 -192
  39. package/src/core/components/component-detection.ts +508 -508
  40. package/src/core/components/enhanced-framework-detector.ts +500 -500
  41. package/src/core/components/framework-registry.ts +563 -563
  42. package/src/core/content/mdx-processor.ts +46 -46
  43. package/src/core/integrations/index.ts +19 -19
  44. package/src/core/integrations/loader.ts +125 -125
  45. package/src/core/integrations/registry.ts +175 -175
  46. package/src/core/islands/island-persistence.ts +325 -325
  47. package/src/core/islands/island-state-serializer.ts +258 -258
  48. package/src/core/islands/persistent-island-context.tsx +80 -80
  49. package/src/core/islands/use-persistent-state.ts +68 -68
  50. package/src/core/layout/enhanced-layout-resolver.ts +322 -322
  51. package/src/core/layout/layout-cache-manager.ts +485 -485
  52. package/src/core/layout/layout-composer.ts +357 -357
  53. package/src/core/layout/layout-data-loader.ts +516 -516
  54. package/src/core/layout/layout-discovery.ts +243 -243
  55. package/src/core/layout/layout-matcher.ts +299 -299
  56. package/src/core/layout/layout-types.ts +110 -110
  57. package/src/core/modules/framework-module-resolver.ts +273 -273
  58. package/src/islands/component-analysis.ts +213 -213
  59. package/src/islands/css-utils.ts +565 -565
  60. package/src/islands/discovery/index.ts +80 -80
  61. package/src/islands/discovery/registry.ts +340 -340
  62. package/src/islands/discovery/resolver.ts +477 -477
  63. package/src/islands/discovery/scanner.ts +386 -386
  64. package/src/islands/discovery/types.ts +117 -117
  65. package/src/islands/discovery/validator.ts +544 -544
  66. package/src/islands/discovery/watcher.ts +368 -368
  67. package/src/islands/framework-detection.ts +428 -428
  68. package/src/islands/integration-loader.ts +490 -490
  69. package/src/islands/island.tsx +565 -565
  70. package/src/islands/render-cache.ts +550 -550
  71. package/src/islands/types.ts +80 -80
  72. package/src/islands/universal-css-collector.ts +157 -157
  73. package/src/islands/universal-head-collector.ts +137 -137
  74. package/src/layout-system.d.ts +592 -592
  75. package/src/layout-system.ts +218 -218
  76. package/src/middleware/discovery.ts +268 -268
  77. package/src/middleware/executor.ts +315 -315
  78. package/src/middleware/index.ts +76 -76
  79. package/src/middleware/types.ts +99 -99
  80. package/src/nitro/build-config.ts +575 -575
  81. package/src/nitro/config.ts +483 -483
  82. package/src/nitro/error-handler.ts +636 -636
  83. package/src/nitro/index.ts +173 -173
  84. package/src/nitro/island-manifest.ts +584 -584
  85. package/src/nitro/middleware-adapter.ts +260 -260
  86. package/src/nitro/renderer.ts +1471 -1471
  87. package/src/nitro/route-discovery.ts +439 -439
  88. package/src/nitro/types.ts +321 -321
  89. package/src/render/collect-css.ts +198 -198
  90. package/src/render/error-pages.ts +79 -79
  91. package/src/render/isolated-ssr-renderer.ts +654 -654
  92. package/src/render/ssr.ts +1030 -1030
  93. package/src/schemas/api.ts +30 -30
  94. package/src/schemas/core.ts +64 -64
  95. package/src/schemas/index.ts +212 -212
  96. package/src/schemas/layout.ts +279 -279
  97. package/src/schemas/routing/index.ts +38 -38
  98. package/src/schemas/routing.ts +376 -376
  99. package/src/types/as-island.ts +20 -20
  100. package/src/types/image.d.ts +106 -106
  101. package/src/types/index.d.ts +22 -22
  102. package/src/types/island-jsx.d.ts +33 -33
  103. package/src/types/island-prop.d.ts +20 -20
  104. package/src/types/layout.ts +285 -285
  105. package/src/types/mdx.d.ts +6 -6
  106. package/src/types/routing.ts +555 -555
  107. package/src/types/types.ts +5 -5
  108. package/src/types/urlpattern.d.ts +49 -49
  109. package/src/types/vite-env.d.ts +11 -11
  110. package/src/utils/dev-logger.ts +299 -299
  111. package/src/utils/fs.ts +151 -151
  112. package/src/vite-plugin/auto-discover.ts +551 -551
  113. package/src/vite-plugin/config.ts +266 -266
  114. package/src/vite-plugin/errors.ts +127 -127
  115. package/src/vite-plugin/image-optimization.ts +156 -156
  116. package/src/vite-plugin/integration-activator.ts +126 -126
  117. package/src/vite-plugin/island-sidecar-plugin.ts +176 -176
  118. package/src/vite-plugin/module-discovery.ts +189 -189
  119. package/src/vite-plugin/nitro-integration.ts +1354 -1354
  120. package/src/vite-plugin/plugin.ts +403 -409
  121. package/src/vite-plugin/types.ts +327 -327
  122. package/src/vite-plugin/validation.ts +228 -228
  123. package/src/client/adapters/index.js +0 -12
  124. package/src/client/adapters/lit-adapter.js +0 -467
  125. package/src/client/adapters/lit-adapter.ts +0 -654
  126. package/src/client/adapters/preact-adapter.js +0 -223
  127. package/src/client/adapters/preact-adapter.ts +0 -331
  128. package/src/client/adapters/qwik-adapter.js +0 -259
  129. package/src/client/adapters/qwik-adapter.ts +0 -345
  130. package/src/client/adapters/react-adapter.js +0 -220
  131. package/src/client/adapters/react-adapter.ts +0 -353
  132. package/src/client/adapters/solid-adapter.js +0 -295
  133. package/src/client/adapters/solid-adapter.ts +0 -451
  134. package/src/client/adapters/svelte-adapter.js +0 -368
  135. package/src/client/adapters/svelte-adapter.ts +0 -524
  136. package/src/client/adapters/vue-adapter.js +0 -278
  137. package/src/client/adapters/vue-adapter.ts +0 -467
  138. package/src/client/components.js +0 -23
  139. package/src/client/css-hmr-handler.js +0 -263
  140. package/src/client/framework-adapter.js +0 -283
  141. package/src/client/hmr-coordinator.js +0 -274
package/mod.ts CHANGED
@@ -1,302 +1,302 @@
1
- // === Core Avalon + Vite Architecture ===
2
-
3
- // Vite Plugin - unified configuration API
4
- export {
5
- avalon,
6
- getResolvedConfig,
7
- getPagesDir,
8
- getLayoutsDir,
9
- getNitroConfig,
10
- isNitroEnabled,
11
- } from './src/vite-plugin/plugin.ts';
12
- export type {
13
- AvalonPluginConfig,
14
- IntegrationName,
15
- ResolvedAvalonConfig,
16
- MDXConfig,
17
- ResolvedMDXConfig,
18
- AvalonNitroConfig,
19
- CacheOptions,
20
- RouteRule,
21
- NitroConfigOutput,
22
- AvalonRuntimeConfig,
23
- } from './src/vite-plugin/types.ts';
24
-
25
- // Nitro Integration - virtual modules and coordination
26
- export {
27
- createNitroIntegration,
28
- createNitroCoordinationPlugin,
29
- createVirtualModulesPlugin,
30
- getViteDevServer,
31
- getAvalonConfig,
32
- isDevelopmentMode,
33
- VIRTUAL_MODULE_IDS,
34
- RESOLVED_VIRTUAL_IDS,
35
- } from './src/vite-plugin/nitro-integration.ts';
36
- export type { NitroIntegrationResult, NitroCoordinationPluginOptions } from './src/vite-plugin/nitro-integration.ts';
37
-
38
- // Main exports
39
- export { renderToHtml } from './src/render/ssr.ts';
40
-
41
- // Universal Island component (single function auto-detects framework)
42
- export { default as Island, renderIsland, type IslandProps } from './src/islands/island.tsx';
43
-
44
- // Island utilities
45
- export {
46
- addSvelteSSRCSS,
47
- getSvelteSSRCSS,
48
- getSvelteSSRCSSForHead,
49
- getSvelteSSRCSSStats,
50
- getSvelteComponentCSS,
51
- clearSvelteComponentCSS,
52
- generateComponentScopeId,
53
- } from './src/islands/css-utils.ts';
54
- export { detectFramework, detectFrameworkFromSrc, resolveIslandPath } from './src/islands/framework-detection.ts';
55
- export { analyzeComponentFile, renderComponentSSROnly } from './src/islands/component-analysis.ts';
56
- export type { Framework, RenderParams, SvelteSSRCSSEntry } from './src/islands/types.ts';
57
-
58
- // Island render cache utilities
59
- export {
60
- clearCache,
61
- clearIslandCache,
62
- invalidateCacheForPath,
63
- invalidateCacheForFile,
64
- getCacheStats,
65
- logCacheStats,
66
- configureCache,
67
- getCacheConfig,
68
- } from './src/islands/render-cache.ts';
69
- export type { CacheConfig as IslandCacheConfig, CacheStats as IslandCacheStats } from './src/islands/render-cache.ts';
70
-
71
- // Island Discovery Utilities (optional - for advanced use cases)
72
- // Note: Islands are detected by usage (island prop), not by directory.
73
- // These utilities are provided for tooling that needs to scan component files.
74
- export {
75
- // Scanner functions
76
- discoverIslandDirectories,
77
- discoverIslandsInDirectory,
78
- discoverAllIslands,
79
- isIslandsDirectory,
80
- getDefaultIslandsPath,
81
- hasDefaultIslandsDirectory,
82
- getQualifiedIslandName,
83
- parseQualifiedIslandName,
84
- // Registry
85
- IslandRegistry,
86
- createIslandRegistry,
87
- // Resolver
88
- IslandResolver,
89
- createIslandResolver,
90
- // Validator
91
- IslandValidator,
92
- createIslandValidator,
93
- validateAllIslands,
94
- formatValidationError,
95
- formatValidationWarning,
96
- formatCircularDependency,
97
- formatValidationResult,
98
- // Watcher
99
- IslandWatcher,
100
- createIslandWatcher,
101
- // Type utilities
102
- ISLAND_FILE_EXTENSIONS,
103
- DEFAULT_DISCOVERY_CONFIG,
104
- isSupportedIslandExtension,
105
- } from './src/islands/discovery/index.ts';
106
-
107
- // Island Discovery Types
108
- export type {
109
- IslandDirectory,
110
- DiscoveredIsland,
111
- IslandCollision,
112
- IslandChangeEvent,
113
- IslandFileExtension,
114
- IslandDiscoveryConfig,
115
- ResolutionResult,
116
- ImportPathOptions,
117
- ValidationResult,
118
- ValidationError,
119
- ValidationWarning,
120
- CircularDependency,
121
- IslandChangeCallback,
122
- IslandWatcherOptions,
123
- } from './src/islands/discovery/index.ts';
124
-
125
- // Integration system
126
- export {
127
- loadIntegration,
128
- detectAndLoadIntegration,
129
- preloadIntegrations,
130
- detectFrameworksFromPageContent,
131
- DEFAULT_PRELOAD_FRAMEWORKS,
132
- } from './src/islands/integration-loader.ts';
133
- export type { PreloadIntegrationsOptions } from './src/islands/integration-loader.ts';
134
- export { registry as integrationRegistry } from './src/core/integrations/registry.ts';
135
- export type {
136
- Integration,
137
- RenderParams as IntegrationRenderParams,
138
- RenderResult,
139
- IntegrationConfig,
140
- } from '@useavalon/core';
141
-
142
- // Build utilities
143
- export { generateIslandManifest, loadIslandManifest, getIslandBundlePath } from './src/build/island-manifest.ts';
144
- export type {
145
- IslandManifest,
146
- IslandEntry,
147
- ExtendedIslandManifest,
148
- ExtendedIslandEntry,
149
- } from './src/build/island-manifest.ts';
150
-
151
- // MDX island transform (auto-wraps island imports in MDX with Island() calls)
152
- export { mdxIslandTransform } from './src/build/mdx-island-transform.ts';
153
- export type { MDXIslandTransformOptions } from './src/build/mdx-island-transform.ts';
154
-
155
- // Page island transform (auto-wraps island imports in TSX pages when using `island` prop)
156
- export { pageIslandTransform } from './src/build/page-island-transform.ts';
157
- export type { PageIslandTransformOptions } from './src/build/page-island-transform.ts';
158
-
159
- // Island directive type for the `island` prop
160
- export type { IslandDirective } from './src/types/island-prop.d.ts';
161
- export { asIsland } from './src/types/as-island.ts';
162
-
163
- // Island type generation
164
- export { generateIslandTypes, watchAndGenerateTypes } from './src/build/island-types-generator.ts';
165
- export type { IslandTypeGeneratorOptions, TypeGenerationResult } from './src/build/island-types-generator.ts';
166
-
167
- // Build command
168
- // Note: The build function is only available in the monorepo development environment.
169
- // End users should use the CLI or Vite build commands directly.
170
- export async function build(_options?: Record<string, unknown>) {
171
- throw new Error(
172
- 'avalon build() is not available in the published package. Use `vite build` or the Avalon CLI instead.',
173
- );
174
- }
175
-
176
- // Middleware system (Nitro-aligned)
177
- // Note: defineMiddleware removed — use defineHandler from 'nitro/h3' directly.
178
- // Scoped middleware discovery/execution is Avalon's value-add over Nitro.
179
- export {
180
- discoverScopedMiddleware,
181
- executeScopedMiddleware,
182
- clearMiddlewareCache,
183
- invalidateMiddleware,
184
- getMatchingMiddleware,
185
- clearDiscoveryCache,
186
- hasContextValue,
187
- getContextValue,
188
- setContextValue,
189
- getMiddlewareCacheSize,
190
- } from './src/middleware/index.ts';
191
-
192
- export type {
193
- MiddlewareHandler,
194
- MiddlewareFileExport,
195
- MiddlewareRoute,
196
- MiddlewareDiscoveryOptions,
197
- MiddlewareExecutorOptions,
198
- } from './src/middleware/types.ts';
199
-
200
- // Layout system - comprehensive export (all layout functionality)
201
- export * from './src/layout-system.ts';
202
-
203
- // Core types
204
- export type { RenderOptions, MetaTag, ScriptConfig } from './src/schemas/core.ts';
205
- export type { ApiRoute, ApiMethod } from './src/schemas/api.ts';
206
- export type { MiddlewareContext } from './src/nitro/middleware-adapter.ts';
207
-
208
- // Layout data loading types
209
- export type { LayoutDataLoadingResult, LayoutDataLoadingOptions } from './src/core/layout/layout-data-loader.ts';
210
-
211
- // Enhanced layout resolver types
212
- export type { EnhancedLayoutResolverOptions } from './src/core/layout/enhanced-layout-resolver.ts';
213
-
214
- // Layout cache types (essential only)
215
- export type { CacheEntry, CacheStats, CacheConfig } from './src/core/layout/layout-cache-manager.ts';
216
-
217
- // Layout system types - comprehensive export
218
- export type {
219
- // Core layout types (from hand-written interfaces — proper types, no Zod inference)
220
- LayoutProps,
221
- LayoutContext,
222
- LayoutData,
223
- LayoutRoute,
224
- LayoutHandler,
225
- LayoutDiscoveryOptions,
226
- LayoutConfig,
227
- RouteInfo,
228
- LayoutRule,
229
- LayoutLoader,
230
- ResolvedLayout,
231
- LayoutCache,
232
- LayoutErrorInfo
233
- } from './src/core/layout/layout-types.ts';
234
-
235
- export type {
236
- // Zod-inferred types for schemas that don't have hand-written equivalents
237
- EnhancedLayoutContext,
238
-
239
- // Persistent islands types
240
- IslandState,
241
- PersistentIslandProps,
242
- PersistentIslandContext,
243
- IslandStateSaver,
244
- IslandStateLoader,
245
- IslandStateClearer,
246
-
247
- // Error boundary types
248
- LayoutErrorBoundaryProps,
249
- ErrorRecoveryStrategy,
250
- LayoutErrorHandler,
251
- LayoutRetryFunction,
252
- LayoutFallbackRenderer,
253
-
254
- // Streaming types
255
- StreamingLayoutProps,
256
- StreamingComponent,
257
- StreamingReadyCheck,
258
-
259
- // Function types
260
- LayoutMatcherFunction,
261
- } from './src/schemas/layout.ts';
262
-
263
- // Persistent islands system
264
- export { IslandPersistence, defaultIslandPersistence } from './src/core/islands/island-persistence.ts';
265
- export { IslandStateSerializer } from './src/core/islands/island-state-serializer.ts';
266
- export {
267
- createPersistentIslandContext,
268
- usePersistentIslandContext,
269
- PersistentIslandProvider,
270
- } from './src/core/islands/persistent-island-context.tsx';
271
- export { PersistentIsland } from './src/components/PersistentIsland.tsx';
272
- export { usePersistentState } from './src/core/islands/use-persistent-state.ts';
273
-
274
- // Error boundary system
275
- export { LayoutErrorBoundary } from './src/components/LayoutErrorBoundary.tsx';
276
- export { LayoutDataErrorBoundary } from './src/components/LayoutDataErrorBoundary.tsx';
277
- export { IslandErrorBoundary, withIslandErrorBoundary } from './src/components/IslandErrorBoundary.tsx';
278
- export { StreamingErrorBoundary, withStreamingErrorBoundary } from './src/components/StreamingErrorBoundary.tsx';
279
-
280
- // Layout system interfaces
281
- export type {
282
- ILayoutDiscovery,
283
- ILayoutMatcher,
284
- ILayoutComposer,
285
- IIslandPersistence,
286
- ILayoutErrorRecovery,
287
- ILayoutStreaming,
288
- IEnhancedLayoutResolver,
289
- ILayoutComponent,
290
- IPersistentIslandComponent,
291
- ILayoutErrorBoundaryComponent,
292
- IStreamingLayoutComponent,
293
- LayoutModule,
294
- PageModule,
295
- LayoutResolutionContext,
296
- LayoutPerformanceMetrics,
297
- LayoutDebugInfo,
298
- LayoutEventType,
299
- LayoutEventData,
300
- LayoutEventHandler,
301
- ILayoutEventEmitter,
302
- } from './src/types/layout.ts';
1
+ // === Core Avalon + Vite Architecture ===
2
+
3
+ // Vite Plugin - unified configuration API
4
+ export {
5
+ avalon,
6
+ getResolvedConfig,
7
+ getPagesDir,
8
+ getLayoutsDir,
9
+ getNitroConfig,
10
+ isNitroEnabled,
11
+ } from './src/vite-plugin/plugin.ts';
12
+ export type {
13
+ AvalonPluginConfig,
14
+ IntegrationName,
15
+ ResolvedAvalonConfig,
16
+ MDXConfig,
17
+ ResolvedMDXConfig,
18
+ AvalonNitroConfig,
19
+ CacheOptions,
20
+ RouteRule,
21
+ NitroConfigOutput,
22
+ AvalonRuntimeConfig,
23
+ } from './src/vite-plugin/types.ts';
24
+
25
+ // Nitro Integration - virtual modules and coordination
26
+ export {
27
+ createNitroIntegration,
28
+ createNitroCoordinationPlugin,
29
+ createVirtualModulesPlugin,
30
+ getViteDevServer,
31
+ getAvalonConfig,
32
+ isDevelopmentMode,
33
+ VIRTUAL_MODULE_IDS,
34
+ RESOLVED_VIRTUAL_IDS,
35
+ } from './src/vite-plugin/nitro-integration.ts';
36
+ export type { NitroIntegrationResult, NitroCoordinationPluginOptions } from './src/vite-plugin/nitro-integration.ts';
37
+
38
+ // Main exports
39
+ export { renderToHtml } from './src/render/ssr.ts';
40
+
41
+ // Universal Island component (single function auto-detects framework)
42
+ export { default as Island, renderIsland, type IslandProps } from './src/islands/island.tsx';
43
+
44
+ // Island utilities
45
+ export {
46
+ addSvelteSSRCSS,
47
+ getSvelteSSRCSS,
48
+ getSvelteSSRCSSForHead,
49
+ getSvelteSSRCSSStats,
50
+ getSvelteComponentCSS,
51
+ clearSvelteComponentCSS,
52
+ generateComponentScopeId,
53
+ } from './src/islands/css-utils.ts';
54
+ export { detectFramework, detectFrameworkFromSrc, resolveIslandPath } from './src/islands/framework-detection.ts';
55
+ export { analyzeComponentFile, renderComponentSSROnly } from './src/islands/component-analysis.ts';
56
+ export type { Framework, RenderParams, SvelteSSRCSSEntry } from './src/islands/types.ts';
57
+
58
+ // Island render cache utilities
59
+ export {
60
+ clearCache,
61
+ clearIslandCache,
62
+ invalidateCacheForPath,
63
+ invalidateCacheForFile,
64
+ getCacheStats,
65
+ logCacheStats,
66
+ configureCache,
67
+ getCacheConfig,
68
+ } from './src/islands/render-cache.ts';
69
+ export type { CacheConfig as IslandCacheConfig, CacheStats as IslandCacheStats } from './src/islands/render-cache.ts';
70
+
71
+ // Island Discovery Utilities (optional - for advanced use cases)
72
+ // Note: Islands are detected by usage (island prop), not by directory.
73
+ // These utilities are provided for tooling that needs to scan component files.
74
+ export {
75
+ // Scanner functions
76
+ discoverIslandDirectories,
77
+ discoverIslandsInDirectory,
78
+ discoverAllIslands,
79
+ isIslandsDirectory,
80
+ getDefaultIslandsPath,
81
+ hasDefaultIslandsDirectory,
82
+ getQualifiedIslandName,
83
+ parseQualifiedIslandName,
84
+ // Registry
85
+ IslandRegistry,
86
+ createIslandRegistry,
87
+ // Resolver
88
+ IslandResolver,
89
+ createIslandResolver,
90
+ // Validator
91
+ IslandValidator,
92
+ createIslandValidator,
93
+ validateAllIslands,
94
+ formatValidationError,
95
+ formatValidationWarning,
96
+ formatCircularDependency,
97
+ formatValidationResult,
98
+ // Watcher
99
+ IslandWatcher,
100
+ createIslandWatcher,
101
+ // Type utilities
102
+ ISLAND_FILE_EXTENSIONS,
103
+ DEFAULT_DISCOVERY_CONFIG,
104
+ isSupportedIslandExtension,
105
+ } from './src/islands/discovery/index.ts';
106
+
107
+ // Island Discovery Types
108
+ export type {
109
+ IslandDirectory,
110
+ DiscoveredIsland,
111
+ IslandCollision,
112
+ IslandChangeEvent,
113
+ IslandFileExtension,
114
+ IslandDiscoveryConfig,
115
+ ResolutionResult,
116
+ ImportPathOptions,
117
+ ValidationResult,
118
+ ValidationError,
119
+ ValidationWarning,
120
+ CircularDependency,
121
+ IslandChangeCallback,
122
+ IslandWatcherOptions,
123
+ } from './src/islands/discovery/index.ts';
124
+
125
+ // Integration system
126
+ export {
127
+ loadIntegration,
128
+ detectAndLoadIntegration,
129
+ preloadIntegrations,
130
+ detectFrameworksFromPageContent,
131
+ DEFAULT_PRELOAD_FRAMEWORKS,
132
+ } from './src/islands/integration-loader.ts';
133
+ export type { PreloadIntegrationsOptions } from './src/islands/integration-loader.ts';
134
+ export { registry as integrationRegistry } from './src/core/integrations/registry.ts';
135
+ export type {
136
+ Integration,
137
+ RenderParams as IntegrationRenderParams,
138
+ RenderResult,
139
+ IntegrationConfig,
140
+ } from '@useavalon/core';
141
+
142
+ // Build utilities
143
+ export { generateIslandManifest, loadIslandManifest, getIslandBundlePath } from './src/build/island-manifest.ts';
144
+ export type {
145
+ IslandManifest,
146
+ IslandEntry,
147
+ ExtendedIslandManifest,
148
+ ExtendedIslandEntry,
149
+ } from './src/build/island-manifest.ts';
150
+
151
+ // MDX island transform (auto-wraps island imports in MDX with Island() calls)
152
+ export { mdxIslandTransform } from './src/build/mdx-island-transform.ts';
153
+ export type { MDXIslandTransformOptions } from './src/build/mdx-island-transform.ts';
154
+
155
+ // Page island transform (auto-wraps island imports in TSX pages when using `island` prop)
156
+ export { pageIslandTransform } from './src/build/page-island-transform.ts';
157
+ export type { PageIslandTransformOptions } from './src/build/page-island-transform.ts';
158
+
159
+ // Island directive type for the `island` prop
160
+ export type { IslandDirective } from './src/types/island-prop.d.ts';
161
+ export { asIsland } from './src/types/as-island.ts';
162
+
163
+ // Island type generation
164
+ export { generateIslandTypes, watchAndGenerateTypes } from './src/build/island-types-generator.ts';
165
+ export type { IslandTypeGeneratorOptions, TypeGenerationResult } from './src/build/island-types-generator.ts';
166
+
167
+ // Build command
168
+ // Note: The build function is only available in the monorepo development environment.
169
+ // End users should use the CLI or Vite build commands directly.
170
+ export async function build(_options?: Record<string, unknown>) {
171
+ throw new Error(
172
+ 'avalon build() is not available in the published package. Use `vite build` or the Avalon CLI instead.',
173
+ );
174
+ }
175
+
176
+ // Middleware system (Nitro-aligned)
177
+ // Note: defineMiddleware removed — use defineHandler from 'nitro/h3' directly.
178
+ // Scoped middleware discovery/execution is Avalon's value-add over Nitro.
179
+ export {
180
+ discoverScopedMiddleware,
181
+ executeScopedMiddleware,
182
+ clearMiddlewareCache,
183
+ invalidateMiddleware,
184
+ getMatchingMiddleware,
185
+ clearDiscoveryCache,
186
+ hasContextValue,
187
+ getContextValue,
188
+ setContextValue,
189
+ getMiddlewareCacheSize,
190
+ } from './src/middleware/index.ts';
191
+
192
+ export type {
193
+ MiddlewareHandler,
194
+ MiddlewareFileExport,
195
+ MiddlewareRoute,
196
+ MiddlewareDiscoveryOptions,
197
+ MiddlewareExecutorOptions,
198
+ } from './src/middleware/types.ts';
199
+
200
+ // Layout system - comprehensive export (all layout functionality)
201
+ export * from './src/layout-system.ts';
202
+
203
+ // Core types
204
+ export type { RenderOptions, MetaTag, ScriptConfig } from './src/schemas/core.ts';
205
+ export type { ApiRoute, ApiMethod } from './src/schemas/api.ts';
206
+ export type { MiddlewareContext } from './src/nitro/middleware-adapter.ts';
207
+
208
+ // Layout data loading types
209
+ export type { LayoutDataLoadingResult, LayoutDataLoadingOptions } from './src/core/layout/layout-data-loader.ts';
210
+
211
+ // Enhanced layout resolver types
212
+ export type { EnhancedLayoutResolverOptions } from './src/core/layout/enhanced-layout-resolver.ts';
213
+
214
+ // Layout cache types (essential only)
215
+ export type { CacheEntry, CacheStats, CacheConfig } from './src/core/layout/layout-cache-manager.ts';
216
+
217
+ // Layout system types - comprehensive export
218
+ export type {
219
+ // Core layout types (from hand-written interfaces — proper types, no Zod inference)
220
+ LayoutProps,
221
+ LayoutContext,
222
+ LayoutData,
223
+ LayoutRoute,
224
+ LayoutHandler,
225
+ LayoutDiscoveryOptions,
226
+ LayoutConfig,
227
+ RouteInfo,
228
+ LayoutRule,
229
+ LayoutLoader,
230
+ ResolvedLayout,
231
+ LayoutCache,
232
+ LayoutErrorInfo
233
+ } from './src/core/layout/layout-types.ts';
234
+
235
+ export type {
236
+ // Zod-inferred types for schemas that don't have hand-written equivalents
237
+ EnhancedLayoutContext,
238
+
239
+ // Persistent islands types
240
+ IslandState,
241
+ PersistentIslandProps,
242
+ PersistentIslandContext,
243
+ IslandStateSaver,
244
+ IslandStateLoader,
245
+ IslandStateClearer,
246
+
247
+ // Error boundary types
248
+ LayoutErrorBoundaryProps,
249
+ ErrorRecoveryStrategy,
250
+ LayoutErrorHandler,
251
+ LayoutRetryFunction,
252
+ LayoutFallbackRenderer,
253
+
254
+ // Streaming types
255
+ StreamingLayoutProps,
256
+ StreamingComponent,
257
+ StreamingReadyCheck,
258
+
259
+ // Function types
260
+ LayoutMatcherFunction,
261
+ } from './src/schemas/layout.ts';
262
+
263
+ // Persistent islands system
264
+ export { IslandPersistence, defaultIslandPersistence } from './src/core/islands/island-persistence.ts';
265
+ export { IslandStateSerializer } from './src/core/islands/island-state-serializer.ts';
266
+ export {
267
+ createPersistentIslandContext,
268
+ usePersistentIslandContext,
269
+ PersistentIslandProvider,
270
+ } from './src/core/islands/persistent-island-context.tsx';
271
+ export { PersistentIsland } from './src/components/PersistentIsland.tsx';
272
+ export { usePersistentState } from './src/core/islands/use-persistent-state.ts';
273
+
274
+ // Error boundary system
275
+ export { LayoutErrorBoundary } from './src/components/LayoutErrorBoundary.tsx';
276
+ export { LayoutDataErrorBoundary } from './src/components/LayoutDataErrorBoundary.tsx';
277
+ export { IslandErrorBoundary, withIslandErrorBoundary } from './src/components/IslandErrorBoundary.tsx';
278
+ export { StreamingErrorBoundary, withStreamingErrorBoundary } from './src/components/StreamingErrorBoundary.tsx';
279
+
280
+ // Layout system interfaces
281
+ export type {
282
+ ILayoutDiscovery,
283
+ ILayoutMatcher,
284
+ ILayoutComposer,
285
+ IIslandPersistence,
286
+ ILayoutErrorRecovery,
287
+ ILayoutStreaming,
288
+ IEnhancedLayoutResolver,
289
+ ILayoutComponent,
290
+ IPersistentIslandComponent,
291
+ ILayoutErrorBoundaryComponent,
292
+ IStreamingLayoutComponent,
293
+ LayoutModule,
294
+ PageModule,
295
+ LayoutResolutionContext,
296
+ LayoutPerformanceMetrics,
297
+ LayoutDebugInfo,
298
+ LayoutEventType,
299
+ LayoutEventData,
300
+ LayoutEventHandler,
301
+ ILayoutEventEmitter,
302
+ } from './src/types/layout.ts';