@useavalon/avalon 0.1.48 → 0.1.50

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 (36) hide show
  1. package/dist/mod.d.ts +48 -48
  2. package/dist/mod.js +1 -1
  3. package/dist/src/build/page-island-transform.d.ts +1 -1
  4. package/dist/src/build/page-island-transform.js +2 -3
  5. package/dist/src/client/components.d.ts +8 -8
  6. package/dist/src/client/components.js +1 -1
  7. package/dist/src/components/IslandErrorBoundary.d.ts +2 -2
  8. package/dist/src/components/IslandErrorBoundary.js +1 -1
  9. package/dist/src/components/LayoutErrorBoundary.d.ts +3 -3
  10. package/dist/src/components/LayoutErrorBoundary.js +1 -1
  11. package/dist/src/islands/integration-loader.d.ts +2 -2
  12. package/dist/src/islands/island.d.ts +7 -7
  13. package/dist/src/islands/island.js +1 -1
  14. package/dist/src/layout-system.d.ts +14 -17
  15. package/dist/src/layout-system.js +1 -1
  16. package/dist/src/nitro/config.d.ts +13 -0
  17. package/dist/src/nitro/renderer.d.ts +21 -11
  18. package/dist/src/nitro/renderer.js +20 -20
  19. package/dist/src/persistence/island-state-serializer.d.ts +9 -19
  20. package/dist/src/persistence/island-state-serializer.js +1 -1
  21. package/dist/src/persistence/use-persistent-state.d.ts +2 -2
  22. package/dist/src/persistence/use-persistent-state.js +1 -1
  23. package/dist/src/post-build/index.d.ts +57 -0
  24. package/dist/src/post-build/index.js +31 -0
  25. package/dist/src/schemas/core.d.ts +2 -2
  26. package/dist/src/schemas/layout.d.ts +4 -4
  27. package/dist/src/schemas/routing/index.d.ts +2 -2
  28. package/dist/src/schemas/routing.d.ts +4 -4
  29. package/dist/src/types/index.d.ts +8 -5
  30. package/dist/src/types/island-prop.d.ts +14 -8
  31. package/dist/src/types/layout.d.ts +11 -11
  32. package/dist/src/types/layout.js +1 -1
  33. package/dist/src/types/virtual-modules.d.ts +56 -0
  34. package/dist/src/vite-plugin/nitro-integration.d.ts +8 -0
  35. package/dist/src/vite-plugin/nitro-integration.js +15 -10
  36. package/package.json +6 -2
package/dist/mod.d.ts CHANGED
@@ -1,49 +1,49 @@
1
- export { avalon, getResolvedConfig, getPagesDir, getLayoutsDir, getNitroConfig, isNitroEnabled, } from './src/vite-plugin/plugin.ts';
2
- export type { AvalonPluginConfig, IntegrationName, ResolvedAvalonConfig, MDXConfig, ResolvedMDXConfig, AvalonNitroConfig, CacheOptions, RouteRule, NitroConfigOutput, AvalonRuntimeConfig, } from './src/vite-plugin/types.ts';
3
- export { createNitroIntegration, createNitroCoordinationPlugin, createVirtualModulesPlugin, getViteDevServer, getAvalonConfig, isDevelopmentMode, VIRTUAL_MODULE_IDS, RESOLVED_VIRTUAL_IDS, } from './src/vite-plugin/nitro-integration.ts';
4
- export type { NitroIntegrationResult, NitroCoordinationPluginOptions } from './src/vite-plugin/nitro-integration.ts';
5
- export { renderToHtml } from './src/render/ssr.ts';
6
- export { default as Island, renderIsland, type IslandProps } from './src/islands/island.tsx';
7
- export { addSvelteSSRCSS, getSvelteSSRCSS, getSvelteSSRCSSForHead, getSvelteSSRCSSStats, getSvelteComponentCSS, clearSvelteComponentCSS, generateComponentScopeId, } from './src/islands/css-utils.ts';
8
- export { detectFramework, detectFrameworkFromSrc, resolveIslandPath } from './src/islands/framework-detection.ts';
9
- export { analyzeComponentFile, renderComponentSSROnly } from './src/islands/component-analysis.ts';
10
- export type { Framework, RenderParams, SvelteSSRCSSEntry } from './src/islands/types.ts';
11
- export { registerHydrationDirective, unregisterHydrationDirective, isCustomDirective, getDirective, getRegisteredDirectives, } from './src/islands/hydration-directives.ts';
12
- export type { HydrationDirectiveFn, HydrationDirectiveDefinition, } from './src/islands/hydration-directives.ts';
13
- export { registerBuiltinDirectives } from './src/islands/builtin-directives.ts';
14
- export { clearCache, clearIslandCache, invalidateCacheForPath, invalidateCacheForFile, getCacheStats, logCacheStats, configureCache, getCacheConfig, } from './src/islands/render-cache.ts';
15
- export type { CacheConfig as IslandCacheConfig, CacheStats as IslandCacheStats } from './src/islands/render-cache.ts';
16
- export { discoverIslandDirectories, discoverIslandsInDirectory, discoverAllIslands, isIslandsDirectory, getDefaultIslandsPath, hasDefaultIslandsDirectory, getQualifiedIslandName, parseQualifiedIslandName, IslandRegistry, createIslandRegistry, IslandResolver, createIslandResolver, IslandValidator, createIslandValidator, validateAllIslands, formatValidationError, formatValidationWarning, formatCircularDependency, formatValidationResult, IslandWatcher, createIslandWatcher, ISLAND_FILE_EXTENSIONS, DEFAULT_DISCOVERY_CONFIG, isSupportedIslandExtension, } from './src/islands/discovery/index.ts';
17
- export type { IslandDirectory, DiscoveredIsland, IslandCollision, IslandChangeEvent, IslandFileExtension, IslandDiscoveryConfig, ResolutionResult, ImportPathOptions, ValidationResult, ValidationError, ValidationWarning, CircularDependency, IslandChangeCallback, IslandWatcherOptions, } from './src/islands/discovery/index.ts';
18
- export { loadIntegration, detectAndLoadIntegration, preloadIntegrations, detectFrameworksFromPageContent, DEFAULT_PRELOAD_FRAMEWORKS, } from './src/islands/integration-loader.ts';
19
- export type { PreloadIntegrationsOptions } from './src/islands/integration-loader.ts';
20
- export { registry as integrationRegistry } from './src/core/integrations/registry.ts';
21
- export type { Integration, RenderParams as IntegrationRenderParams, RenderResult, IntegrationConfig, } from '@useavalon/core';
22
- export { generateIslandManifest, loadIslandManifest, getIslandBundlePath } from './src/build/island-manifest.ts';
23
- export type { IslandManifest, IslandEntry, ExtendedIslandManifest, ExtendedIslandEntry, } from './src/build/island-manifest.ts';
24
- export { mdxIslandTransform } from './src/build/mdx-island-transform.ts';
25
- export type { MDXIslandTransformOptions } from './src/build/mdx-island-transform.ts';
26
- export { pageIslandTransform } from './src/build/page-island-transform.ts';
27
- export type { PageIslandTransformOptions } from './src/build/page-island-transform.ts';
28
- export type { IslandDirective } from './src/types/island-prop.d.ts';
29
- export { asIsland } from './src/types/as-island.ts';
30
- export { generateIslandTypes, watchAndGenerateTypes } from './src/build/island-types-generator.ts';
31
- export type { IslandTypeGeneratorOptions, TypeGenerationResult } from './src/build/island-types-generator.ts';
1
+ export type { Integration, IntegrationConfig, RenderParams as IntegrationRenderParams, RenderResult, } from "@useavalon/core";
2
+ export type { ExtendedIslandEntry, ExtendedIslandManifest, IslandEntry, IslandManifest, } from "./src/build/island-manifest.ts";
3
+ export { generateIslandManifest, getIslandBundlePath, loadIslandManifest, } from "./src/build/island-manifest.ts";
4
+ export type { IslandTypeGeneratorOptions, TypeGenerationResult, } from "./src/build/island-types-generator.ts";
5
+ export { generateIslandTypes, watchAndGenerateTypes } from "./src/build/island-types-generator.ts";
6
+ export type { MDXIslandTransformOptions } from "./src/build/mdx-island-transform.ts";
7
+ export { mdxIslandTransform } from "./src/build/mdx-island-transform.ts";
8
+ export type { PageIslandTransformOptions } from "./src/build/page-island-transform.ts";
9
+ export { pageIslandTransform } from "./src/build/page-island-transform.ts";
10
+ export { registry as integrationRegistry } from "./src/core/integrations/registry.ts";
11
+ export { registerBuiltinDirectives } from "./src/islands/builtin-directives.ts";
12
+ export { analyzeComponentFile, renderComponentSSROnly } from "./src/islands/component-analysis.ts";
13
+ export { addSvelteSSRCSS, clearSvelteComponentCSS, generateComponentScopeId, getSvelteComponentCSS, getSvelteSSRCSS, getSvelteSSRCSSForHead, getSvelteSSRCSSStats, } from "./src/islands/css-utils.ts";
14
+ export type { CircularDependency, DiscoveredIsland, ImportPathOptions, IslandChangeCallback, IslandChangeEvent, IslandCollision, IslandDirectory, IslandDiscoveryConfig, IslandFileExtension, IslandWatcherOptions, ResolutionResult, ValidationError, ValidationResult, ValidationWarning, } from "./src/islands/discovery/index.ts";
15
+ export { createIslandRegistry, createIslandResolver, createIslandValidator, createIslandWatcher, DEFAULT_DISCOVERY_CONFIG, discoverAllIslands, discoverIslandDirectories, discoverIslandsInDirectory, formatCircularDependency, formatValidationError, formatValidationResult, formatValidationWarning, getDefaultIslandsPath, getQualifiedIslandName, hasDefaultIslandsDirectory, ISLAND_FILE_EXTENSIONS, IslandRegistry, IslandResolver, IslandValidator, IslandWatcher, isIslandsDirectory, isSupportedIslandExtension, parseQualifiedIslandName, validateAllIslands, } from "./src/islands/discovery/index.ts";
16
+ export { detectFramework, detectFrameworkFromSrc, resolveIslandPath, } from "./src/islands/framework-detection.ts";
17
+ export type { HydrationDirectiveDefinition, HydrationDirectiveFn, } from "./src/islands/hydration-directives.ts";
18
+ export { getDirective, getRegisteredDirectives, isCustomDirective, registerHydrationDirective, unregisterHydrationDirective, } from "./src/islands/hydration-directives.ts";
19
+ export type { PreloadIntegrationsOptions } from "./src/islands/integration-loader.ts";
20
+ export { DEFAULT_PRELOAD_FRAMEWORKS, detectAndLoadIntegration, detectFrameworksFromPageContent, loadIntegration, preloadIntegrations, } from "./src/islands/integration-loader.ts";
21
+ export { default as Island, type IslandProps, renderIsland } from "./src/islands/island.tsx";
22
+ export type { CacheConfig as IslandCacheConfig, CacheStats as IslandCacheStats, } from "./src/islands/render-cache.ts";
23
+ export { clearCache, clearIslandCache, configureCache, getCacheConfig, getCacheStats, invalidateCacheForFile, invalidateCacheForPath, logCacheStats, } from "./src/islands/render-cache.ts";
24
+ export type { Framework, RenderParams, SvelteSSRCSSEntry } from "./src/islands/types.ts";
25
+ export { renderToHtml } from "./src/render/ssr.ts";
26
+ export { asIsland } from "./src/types/as-island.ts";
27
+ export type { IslandDirective } from "./src/types/island-prop.d.ts";
28
+ export type { NitroCoordinationPluginOptions, NitroIntegrationResult, } from "./src/vite-plugin/nitro-integration.ts";
29
+ export { createNitroCoordinationPlugin, createNitroIntegration, createVirtualModulesPlugin, getAvalonConfig, getViteDevServer, isDevelopmentMode, RESOLVED_VIRTUAL_IDS, VIRTUAL_MODULE_IDS, } from "./src/vite-plugin/nitro-integration.ts";
30
+ export { avalon, getLayoutsDir, getNitroConfig, getPagesDir, getResolvedConfig, isNitroEnabled, } from "./src/vite-plugin/plugin.ts";
31
+ export type { AvalonNitroConfig, AvalonPluginConfig, AvalonRuntimeConfig, CacheOptions, IntegrationName, MDXConfig, NitroConfigOutput, ResolvedAvalonConfig, ResolvedMDXConfig, RouteRule, } from "./src/vite-plugin/types.ts";
32
32
  export declare function build(_options?: Record<string, unknown>): Promise<void>;
33
- export { discoverScopedMiddleware, executeScopedMiddleware, clearMiddlewareCache, invalidateMiddleware, getMatchingMiddleware, clearDiscoveryCache, hasContextValue, getContextValue, setContextValue, getMiddlewareCacheSize, } from './src/middleware/index.ts';
34
- export type { MiddlewareHandler, MiddlewareFileExport, MiddlewareRoute, MiddlewareDiscoveryOptions, MiddlewareExecutorOptions, } from './src/middleware/types.ts';
35
- export * from './src/layout-system.ts';
36
- export type { RenderOptions, MetaTag, ScriptConfig } from './src/schemas/core.ts';
37
- export type { ApiRoute, ApiMethod } from './src/schemas/api.ts';
38
- export type { MiddlewareContext } from './src/nitro/middleware-adapter.ts';
39
- export type { LayoutDataLoadingResult, LayoutDataLoadingOptions } from './src/core/layout/layout-data-loader.ts';
40
- export type { EnhancedLayoutResolverOptions } from './src/core/layout/enhanced-layout-resolver.ts';
41
- export type { CacheEntry, CacheStats, CacheConfig } from './src/core/layout/layout-cache-manager.ts';
42
- export type { LayoutProps, LayoutContext, LayoutData, LayoutRoute, LayoutHandler, LayoutDiscoveryOptions, LayoutConfig, RouteInfo, LayoutRule, LayoutLoader, ResolvedLayout, LayoutCache, LayoutErrorInfo } from './src/core/layout/layout-types.ts';
43
- export type { EnhancedLayoutContext, IslandState, PersistentIslandProps, PersistentIslandContext, IslandStateSaver, IslandStateLoader, IslandStateClearer, LayoutErrorBoundaryProps, ErrorRecoveryStrategy, LayoutErrorHandler, LayoutRetryFunction, LayoutFallbackRenderer, StreamingLayoutProps, StreamingComponent, StreamingReadyCheck, LayoutMatcherFunction, } from './src/schemas/layout.ts';
44
- export type { ILayoutDiscovery, ILayoutMatcher, ILayoutComposer, IIslandPersistence, ILayoutErrorRecovery, ILayoutStreaming, IEnhancedLayoutResolver, ILayoutComponent, IPersistentIslandComponent, ILayoutErrorBoundaryComponent, IStreamingLayoutComponent, LayoutModule, PageModule, LayoutResolutionContext, LayoutPerformanceMetrics, LayoutDebugInfo, LayoutEventType, LayoutEventData, LayoutEventHandler, ILayoutEventEmitter, } from './src/types/layout.ts';
45
- export { IslandErrorBoundary, withIslandErrorBoundary } from './src/components/IslandErrorBoundary.tsx';
46
- export type { IslandErrorBoundaryProps } from './src/components/IslandErrorBoundary.tsx';
47
- export { LayoutErrorBoundary } from './src/components/LayoutErrorBoundary.tsx';
48
- export type { LayoutErrorBoundaryProps as LayoutErrorBoundaryComponentProps } from './src/components/LayoutErrorBoundary.tsx';
49
- export { usePersistentState } from './src/persistence/use-persistent-state.ts';
33
+ export type { IslandErrorBoundaryProps } from "./src/components/IslandErrorBoundary.tsx";
34
+ export { IslandErrorBoundary, withIslandErrorBoundary, } from "./src/components/IslandErrorBoundary.tsx";
35
+ export type { LayoutErrorBoundaryProps as LayoutErrorBoundaryComponentProps } from "./src/components/LayoutErrorBoundary.tsx";
36
+ export { LayoutErrorBoundary } from "./src/components/LayoutErrorBoundary.tsx";
37
+ export type { EnhancedLayoutResolverOptions } from "./src/core/layout/enhanced-layout-resolver.ts";
38
+ export type { CacheConfig, CacheEntry, CacheStats, } from "./src/core/layout/layout-cache-manager.ts";
39
+ export type { LayoutDataLoadingOptions, LayoutDataLoadingResult, } from "./src/core/layout/layout-data-loader.ts";
40
+ export type { LayoutCache, LayoutConfig, LayoutContext, LayoutData, LayoutDiscoveryOptions, LayoutErrorInfo, LayoutHandler, LayoutLoader, LayoutProps, LayoutRoute, LayoutRule, ResolvedLayout, RouteInfo, } from "./src/core/layout/layout-types.ts";
41
+ export * from "./src/layout-system.ts";
42
+ export { clearDiscoveryCache, clearMiddlewareCache, discoverScopedMiddleware, executeScopedMiddleware, getContextValue, getMatchingMiddleware, getMiddlewareCacheSize, hasContextValue, invalidateMiddleware, setContextValue, } from "./src/middleware/index.ts";
43
+ export type { MiddlewareDiscoveryOptions, MiddlewareExecutorOptions, MiddlewareFileExport, MiddlewareHandler, MiddlewareRoute, } from "./src/middleware/types.ts";
44
+ export type { MiddlewareContext } from "./src/nitro/middleware-adapter.ts";
45
+ export { usePersistentState } from "./src/persistence/use-persistent-state.ts";
46
+ export type { ApiMethod, ApiRoute } from "./src/schemas/api.ts";
47
+ export type { MetaTag, RenderOptions, ScriptConfig } from "./src/schemas/core.ts";
48
+ export type { EnhancedLayoutContext, ErrorRecoveryStrategy, IslandState, IslandStateClearer, IslandStateLoader, IslandStateSaver, LayoutErrorBoundaryProps, LayoutErrorHandler, LayoutFallbackRenderer, LayoutMatcherFunction, LayoutRetryFunction, PersistentIslandContext, PersistentIslandProps, StreamingComponent, StreamingLayoutProps, StreamingReadyCheck, } from "./src/schemas/layout.ts";
49
+ export type { IEnhancedLayoutResolver, IIslandPersistence, ILayoutComponent, ILayoutComposer, ILayoutDiscovery, ILayoutErrorBoundaryComponent, ILayoutErrorRecovery, ILayoutEventEmitter, ILayoutMatcher, ILayoutStreaming, IPersistentIslandComponent, IStreamingLayoutComponent, LayoutDebugInfo, LayoutEventData, LayoutEventHandler, LayoutEventType, LayoutModule, LayoutPerformanceMetrics, LayoutResolutionContext, PageModule, } from "./src/types/layout.ts";
package/dist/mod.js CHANGED
@@ -1 +1 @@
1
- export{avalon,getResolvedConfig,getPagesDir,getLayoutsDir,getNitroConfig,isNitroEnabled}from"./src/vite-plugin/plugin.js";export{createNitroIntegration,createNitroCoordinationPlugin,createVirtualModulesPlugin,getViteDevServer,getAvalonConfig,isDevelopmentMode,VIRTUAL_MODULE_IDS,RESOLVED_VIRTUAL_IDS}from"./src/vite-plugin/nitro-integration.js";export{renderToHtml}from"./src/render/ssr.js";export{default as Island,renderIsland}from"./src/islands/island.js";export{addSvelteSSRCSS,getSvelteSSRCSS,getSvelteSSRCSSForHead,getSvelteSSRCSSStats,getSvelteComponentCSS,clearSvelteComponentCSS,generateComponentScopeId}from"./src/islands/css-utils.js";export{detectFramework,detectFrameworkFromSrc,resolveIslandPath}from"./src/islands/framework-detection.js";export{analyzeComponentFile,renderComponentSSROnly}from"./src/islands/component-analysis.js";export{registerHydrationDirective,unregisterHydrationDirective,isCustomDirective,getDirective,getRegisteredDirectives}from"./src/islands/hydration-directives.js";export{registerBuiltinDirectives}from"./src/islands/builtin-directives.js";export{clearCache,clearIslandCache,invalidateCacheForPath,invalidateCacheForFile,getCacheStats,logCacheStats,configureCache,getCacheConfig}from"./src/islands/render-cache.js";export{discoverIslandDirectories,discoverIslandsInDirectory,discoverAllIslands,isIslandsDirectory,getDefaultIslandsPath,hasDefaultIslandsDirectory,getQualifiedIslandName,parseQualifiedIslandName,IslandRegistry,createIslandRegistry,IslandResolver,createIslandResolver,IslandValidator,createIslandValidator,validateAllIslands,formatValidationError,formatValidationWarning,formatCircularDependency,formatValidationResult,IslandWatcher,createIslandWatcher,ISLAND_FILE_EXTENSIONS,DEFAULT_DISCOVERY_CONFIG,isSupportedIslandExtension}from"./src/islands/discovery/index.js";export{loadIntegration,detectAndLoadIntegration,preloadIntegrations,detectFrameworksFromPageContent,DEFAULT_PRELOAD_FRAMEWORKS}from"./src/islands/integration-loader.js";export{registry as integrationRegistry}from"./src/core/integrations/registry.js";export{generateIslandManifest,loadIslandManifest,getIslandBundlePath}from"./src/build/island-manifest.js";export{mdxIslandTransform}from"./src/build/mdx-island-transform.js";export{pageIslandTransform}from"./src/build/page-island-transform.js";export{asIsland}from"./src/types/as-island.js";export{generateIslandTypes,watchAndGenerateTypes}from"./src/build/island-types-generator.js";export async function build(e){throw Error("avalon build() is not available in the published package. Use `vite build` or the Avalon CLI instead.")}export{discoverScopedMiddleware,executeScopedMiddleware,clearMiddlewareCache,invalidateMiddleware,getMatchingMiddleware,clearDiscoveryCache,hasContextValue,getContextValue,setContextValue,getMiddlewareCacheSize}from"./src/middleware/index.js";export*from"./src/layout-system.js";export{IslandErrorBoundary,withIslandErrorBoundary}from"./src/components/IslandErrorBoundary.js";export{LayoutErrorBoundary}from"./src/components/LayoutErrorBoundary.js";export{usePersistentState}from"./src/persistence/use-persistent-state.js";
1
+ export{generateIslandManifest,getIslandBundlePath,loadIslandManifest}from"./src/build/island-manifest.js";export{generateIslandTypes,watchAndGenerateTypes}from"./src/build/island-types-generator.js";export{mdxIslandTransform}from"./src/build/mdx-island-transform.js";export{pageIslandTransform}from"./src/build/page-island-transform.js";export{registry as integrationRegistry}from"./src/core/integrations/registry.js";export{registerBuiltinDirectives}from"./src/islands/builtin-directives.js";export{analyzeComponentFile,renderComponentSSROnly}from"./src/islands/component-analysis.js";export{addSvelteSSRCSS,clearSvelteComponentCSS,generateComponentScopeId,getSvelteComponentCSS,getSvelteSSRCSS,getSvelteSSRCSSForHead,getSvelteSSRCSSStats}from"./src/islands/css-utils.js";export{createIslandRegistry,createIslandResolver,createIslandValidator,createIslandWatcher,DEFAULT_DISCOVERY_CONFIG,discoverAllIslands,discoverIslandDirectories,discoverIslandsInDirectory,formatCircularDependency,formatValidationError,formatValidationResult,formatValidationWarning,getDefaultIslandsPath,getQualifiedIslandName,hasDefaultIslandsDirectory,ISLAND_FILE_EXTENSIONS,IslandRegistry,IslandResolver,IslandValidator,IslandWatcher,isIslandsDirectory,isSupportedIslandExtension,parseQualifiedIslandName,validateAllIslands}from"./src/islands/discovery/index.js";export{detectFramework,detectFrameworkFromSrc,resolveIslandPath}from"./src/islands/framework-detection.js";export{getDirective,getRegisteredDirectives,isCustomDirective,registerHydrationDirective,unregisterHydrationDirective}from"./src/islands/hydration-directives.js";export{DEFAULT_PRELOAD_FRAMEWORKS,detectAndLoadIntegration,detectFrameworksFromPageContent,loadIntegration,preloadIntegrations}from"./src/islands/integration-loader.js";export{default as Island,renderIsland}from"./src/islands/island.js";export{clearCache,clearIslandCache,configureCache,getCacheConfig,getCacheStats,invalidateCacheForFile,invalidateCacheForPath,logCacheStats}from"./src/islands/render-cache.js";export{renderToHtml}from"./src/render/ssr.js";export{asIsland}from"./src/types/as-island.js";export{createNitroCoordinationPlugin,createNitroIntegration,createVirtualModulesPlugin,getAvalonConfig,getViteDevServer,isDevelopmentMode,RESOLVED_VIRTUAL_IDS,VIRTUAL_MODULE_IDS}from"./src/vite-plugin/nitro-integration.js";export{avalon,getLayoutsDir,getNitroConfig,getPagesDir,getResolvedConfig,isNitroEnabled}from"./src/vite-plugin/plugin.js";export async function build(e){throw Error("avalon build() is not available in the published package. Use `vite build` or the Avalon CLI instead.")}export{IslandErrorBoundary,withIslandErrorBoundary}from"./src/components/IslandErrorBoundary.js";export{LayoutErrorBoundary}from"./src/components/LayoutErrorBoundary.js";export*from"./src/layout-system.js";export{clearDiscoveryCache,clearMiddlewareCache,discoverScopedMiddleware,executeScopedMiddleware,getContextValue,getMatchingMiddleware,getMiddlewareCacheSize,hasContextValue,invalidateMiddleware,setContextValue}from"./src/middleware/index.js";export{usePersistentState}from"./src/persistence/use-persistent-state.js";
@@ -23,7 +23,7 @@
23
23
  *
24
24
  * Only applies to files inside the configured pages or layouts directories.
25
25
  */
26
- import type { Plugin } from 'vite';
26
+ import type { Plugin } from "vite";
27
27
  export interface PageIslandTransformOptions {
28
28
  /** Directory containing page files (default: src/pages/) */
29
29
  pagesDir?: string;
@@ -1,3 +1,2 @@
1
- import{dirname as e}from"node:path";function t(e){let t=[],n=/^[ \t]*import\s+([A-Z]\w*)\s+from\s+(['"][^'"]+['"])/gm,r;for(;(r=n.exec(e))!==null;)t.push({localName:r[1],importPath:r[2].slice(1,-1),fullMatch:r[0].trimStart()});return t}function n(t,n){if(t.startsWith(`/src/`)||t.startsWith(`/app/`)||t.startsWith(`/`))return t;if(t.startsWith(`@/`))return`/app/`+t.slice(2);if(t.startsWith(`@shared/`))return`/app/shared/`+t.slice(8);if(t.startsWith(`@modules/`))return`/app/modules/`+t.slice(9);if(t.startsWith(`$components/`))return`/src/components/`+t.slice(12);if(t.startsWith(`$islands/`))return`/src/islands/`+t.slice(9);if(t.startsWith(`~/`))return`/src/`+t.slice(2);if(t.startsWith(`.`)){let r=n.replaceAll(`\\`,`/`),i=r.indexOf(`/app/`);if(i===-1&&(i=r.indexOf(`/src/`)),i!==-1){let n=e(r.slice(i)).split(`/`),a=t.split(`/`);for(let e of a)e===`..`?n.pop():e!==`.`&&n.push(e);return n.join(`/`)}}return`/src/`+t.split(`/`).pop()}function r(e){if(e.endsWith(`.vue`))return`vue`;if(e.endsWith(`.svelte`))return`svelte`;if(e.includes(`.solid.`))return`solid`;if(e.includes(`.lit.`))return`lit`;if(e.includes(`.qwik.`))return`qwik`}function i(e,t,n){let r=e.replaceAll(`\\`,`/`),i=t.replace(/^\//,``);if(r.includes(`/`+i+`/`)&&/\.(tsx|jsx)$/.test(r))return!0;if(n){let e=n.dir.replace(/^\//,``);if(RegExp(`/`+e+`/[^/]+/`+n.pagesDirName+`/`).test(r)&&/\.(tsx|jsx)$/.test(r))return!0}return!1}function a(e,t,n){let r=e.replaceAll(`\\`,`/`),i=t.replace(/^\//,``);if(r.includes(`/`+i+`/`)&&/\.(tsx|jsx)$/.test(r))return!0;if(n){let e=n.dir.replace(/^\//,``);if(RegExp(`/`+e+`/[^/]+/`+n.layoutsDirName+`/`).test(r)&&/\.(tsx|jsx)$/.test(r))return!0}return!1}const o=new Set([`qwik`]);function s(e){let t=r(e);return t!==void 0&&o.has(t)}function c(e,t){return t.some(t=>RegExp(`<`+t+String.raw`[\s][^>]*island[\s]*[={]`).test(e))}function l(e,t){return t.some(t=>s(t.importPath)?RegExp(`<`+t.localName+String.raw`[\s/>]`).test(e):!1)}function u(e,t,i){let a=new Map;for(let s of t){let t=n(s.importPath,i),c=r(t);if(RegExp(`<`+s.localName+String.raw`[\s][^>]*island[\s]*[={]`).test(e)){a.set(s.localName,{srcPath:t,framework:c,importPath:s.importPath,autoIsland:!1});continue}c&&o.has(c)&&RegExp(`<`+s.localName+String.raw`[\s/>]`).test(e)&&a.set(s.localName,{srcPath:t,framework:c,importPath:s.importPath,autoIsland:!0})}return a}function d(e,t){for(;t<e.length&&/\s/.test(e[t]);)t++;return t}function f(e,t){let n=e[t];for(t++;t<e.length&&e[t]!==n;)e[t]===`\\`&&t++,t++;return t<e.length?t+1:t}function p(e,t){for(t++;t<e.length&&e[t]!=="`";){if(e[t]===`\\`){t+=2;continue}if(e[t]===`$`&&e[t+1]===`{`){t=m(t+1,e);continue}t++}return t<e.length?t+1:t}function m(e,t){let n=e+1,r=1;for(;n<t.length&&r>0;){let e=t[n];e===`{`?(r++,n++):e===`}`?(r--,r>0&&n++):e===`'`||e===`"`||e==="`"?n=f(t,n):n++}return n<t.length?n+1:n}function h(e,t){let n=t+1,r=m(t,e);return{value:e.slice(n,r-1),endIdx:r}}function g(e,t){let n=e[t],r=t+1;for(;r<e.length&&e[r]!==n;)e[r]===`\\`&&r++,r++;return{value:`"`+e.slice(t+1,r)+`"`,endIdx:r+1}}function _(e,t){let n=t,r=t;for(;r<e.length&&/[a-zA-Z0-9_$]/.test(e[r]);)r++;let i=e.slice(n,r);if(!i)return null;if(r=d(e,r),e[r]!==`=`)return{name:i,value:null,endIdx:r};if(r=d(e,r+1),e[r]===`{`){let t=h(e,r);return{name:i,value:t.value,endIdx:t.endIdx}}if(e[r]===`"`||e[r]===`'`){let t=g(e,r);return{name:i,value:t.value,endIdx:t.endIdx}}return null}function v(e,t,n){if(e[t]===`/`&&e[t+1]===`>`)return{endIdx:t+2,selfClosing:!0};if(e[t]===`>`){let r=`</`+n+`>`,i=e.indexOf(r,t+1);return i===-1?null:{endIdx:i+r.length,selfClosing:!1}}return null}function y(e,t,n){let r=d(e,t+1+n.length),i=null,a=[];for(;r<e.length;){r=d(e,r);let t=v(e,r,n);if(t)return{endIdx:t.endIdx,islandProp:i,otherProps:a};let o=_(e,r);if(!o)return null;if(r=o.endIdx,o.name===`island`)i=o.value??`{}`;else{let e=o.value===null?o.name+`: true`:o.name+`: `+o.value;a.push(e)}}return null}function b(e,t,n,r,i){let a=n?`, framework: "`+n+`"`:``,o=e.otherProps.length>0?`, props: { `+e.otherProps.join(`, `)+` }`:``,s=`, component: `+i;if(r)return`{await __pageRenderIsland({ src: "`+t+`"`+a+s+o+`, ssr: true, ssrOnly: true })}`;let c=e.islandProp;return`{await __pageRenderIsland({ src: "`+t+`"`+a+s+`, ...(`+c+`)`+o+`, ssr: (`+c+`).ssr !== undefined ? (`+c+`).ssr : true })}`}function x(e,t,n){if(!e.startsWith(n,t))return!1;let r=t+n.length;return r>=e.length||!/[a-zA-Z0-9_$]/.test(e[r])}function S(e,t,n,r,i){let a=`<`+t,o=``,s=0;for(;s<e.length;){if(e[s]==="`"){let t=s;s=p(e,s),o+=e.slice(t,s);continue}if(e[s]===`{`&&e[s+1]===`/`&&e[s+2]===`*`){let t=e.indexOf(`*/`,s+3);if(t!==-1){let n=t+2;for(;n<e.length&&/\s/.test(e[n]);)n++;if(n<e.length&&e[n]===`}`){o+=e.slice(s,n+1),s=n+1;continue}}}if(e[s]===`/`&&e[s+1]===`/`){let t=e.indexOf(`
2
- `,s),n=t===-1?e.length:t+1;o+=e.slice(s,n),s=n;continue}if(e[s]===`/`&&e[s+1]===`*`){let t=e.indexOf(`*/`,s+2),n=t===-1?e.length:t+2;o+=e.slice(s,n),s=n;continue}if(!x(e,s,a)){o+=e[s],s++;continue}let c=y(e,s,t);if(!c||!c.islandProp&&!i){let t=c?c.endIdx:s+1;o+=e.slice(s,t),s=t;continue}o+=b(c,n,r,i&&!c.islandProp,t),s=c.endIdx}return o}export function pageIslandTransform(e={}){let{pagesDir:n=`src/pages`,layoutsDir:r=`src/layouts`,modules:o=null}=e;return{name:`avalon:page-island-transform`,enforce:`pre`,transform(e,s){let d=a(s,r,o);if(!i(s,n,o)&&!d)return null;let f=t(e);if(f.length===0||!c(e,f.map(e=>e.localName))&&!l(e,f))return null;let p=u(e,f,s);if(p.size===0)return null;let m=`import { renderIsland as __pageRenderIsland } from '@useavalon/avalon';
3
- `+e;for(let[e,t]of p)m=S(m,e,t.srcPath,t.framework,t.autoIsland);return{code:m,map:null}}}}
1
+ import{dirname as e}from"node:path";function t(e){let t=[],n=/^[ \t]*import\s+([A-Z]\w*)\s+from\s+(['"][^'"]+['"])/gm,r=null;for(r=n.exec(e);r!==null;r=n.exec(e))t.push({localName:r[1],importPath:r[2].slice(1,-1),fullMatch:r[0].trimStart()});return t}function n(t,n){if(t.startsWith(`/src/`)||t.startsWith(`/app/`)||t.startsWith(`/`))return t;if(t.startsWith(`@/`))return`/app/${t.slice(2)}`;if(t.startsWith(`@shared/`))return`/app/shared/${t.slice(8)}`;if(t.startsWith(`@modules/`))return`/app/modules/${t.slice(9)}`;if(t.startsWith(`$components/`))return`/src/components/${t.slice(12)}`;if(t.startsWith(`$islands/`))return`/src/islands/${t.slice(9)}`;if(t.startsWith(`~/`))return`/src/${t.slice(2)}`;if(t.startsWith(`.`)){let r=n.replaceAll(`\\`,`/`),i=r.indexOf(`/app/`);if(i===-1&&(i=r.indexOf(`/src/`)),i!==-1){let n=e(r.slice(i)).split(`/`),a=t.split(`/`);for(let e of a)e===`..`?n.pop():e!==`.`&&n.push(e);return n.join(`/`)}}return`/src/${t.split(`/`).pop()}`}function r(e){if(e.endsWith(`.vue`))return`vue`;if(e.endsWith(`.svelte`))return`svelte`;if(e.includes(`.solid.`))return`solid`;if(e.includes(`.lit.`))return`lit`;if(e.includes(`.qwik.`))return`qwik`;if(e.includes(`.react.`))return`react`;if(e.endsWith(`.tsx`)||e.endsWith(`.jsx`))return`preact`}function i(e,t,n){let r=e.replaceAll(`\\`,`/`),i=t.replace(/^\//,``);if(r.includes(`/${i}/`)&&/\.(tsx|jsx)$/.test(r))return!0;if(n){let e=n.dir.replace(/^\//,``);if(RegExp(`/${e}/[^/]+/${n.pagesDirName}/`).test(r)&&/\.(tsx|jsx)$/.test(r))return!0}return!1}function a(e,t,n){let r=e.replaceAll(`\\`,`/`),i=t.replace(/^\//,``);if(r.includes(`/${i}/`)&&/\.(tsx|jsx)$/.test(r))return!0;if(n){let e=n.dir.replace(/^\//,``);if(RegExp(`/${e}/[^/]+/${n.layoutsDirName}/`).test(r)&&/\.(tsx|jsx)$/.test(r))return!0}return!1}const o=new Set([`qwik`]);function s(e){let t=r(e);return t!==void 0&&o.has(t)}function c(e,t){return t.some(t=>RegExp(`<${t}${String.raw`[\s][^>]*island[\s]*[={]`}`).test(e))}function l(e,t){return t.some(t=>s(t.importPath)?RegExp(`<${t.localName}${String.raw`[\s/>]`}`).test(e):!1)}function u(e,t,i){let a=new Map;for(let s of t){let t=n(s.importPath,i),c=r(t);if(RegExp(`<${s.localName}${String.raw`[\s][^>]*island[\s]*[={]`}`).test(e)){a.set(s.localName,{srcPath:t,framework:c,importPath:s.importPath,autoIsland:!1});continue}c&&o.has(c)&&RegExp(`<${s.localName}${String.raw`[\s/>]`}`).test(e)&&a.set(s.localName,{srcPath:t,framework:c,importPath:s.importPath,autoIsland:!0})}return a}function d(e,t){for(;t<e.length&&/\s/.test(e[t]);)t++;return t}function f(e,t){let n=e[t];for(t++;t<e.length&&e[t]!==n;)e[t]===`\\`&&t++,t++;return t<e.length?t+1:t}function p(e,t){for(t++;t<e.length&&e[t]!=="`";){if(e[t]===`\\`){t+=2;continue}if(e[t]===`$`&&e[t+1]===`{`){t=m(t+1,e);continue}t++}return t<e.length?t+1:t}function m(e,t){let n=e+1,r=1;for(;n<t.length&&r>0;){let e=t[n];e===`{`?(r++,n++):e===`}`?(r--,r>0&&n++):e===`'`||e===`"`||e==="`"?n=f(t,n):n++}return n<t.length?n+1:n}function h(e,t){let n=t+1,r=m(t,e);return{value:e.slice(n,r-1),endIdx:r}}function g(e,t){let n=e[t],r=t+1;for(;r<e.length&&e[r]!==n;)e[r]===`\\`&&r++,r++;return{value:`"${e.slice(t+1,r)}"`,endIdx:r+1}}function _(e,t){let n=t,r=t;for(;r<e.length&&/[a-zA-Z0-9_$]/.test(e[r]);)r++;let i=e.slice(n,r);if(!i)return null;if(r=d(e,r),e[r]!==`=`)return{name:i,value:null,endIdx:r};if(r=d(e,r+1),e[r]===`{`){let t=h(e,r);return{name:i,value:t.value,endIdx:t.endIdx}}if(e[r]===`"`||e[r]===`'`){let t=g(e,r);return{name:i,value:t.value,endIdx:t.endIdx}}return null}function v(e,t,n){if(e[t]===`/`&&e[t+1]===`>`)return{endIdx:t+2,selfClosing:!0};if(e[t]===`>`){let r=`</${n}>`,i=e.indexOf(r,t+1);return i===-1?null:{endIdx:i+r.length,selfClosing:!1}}return null}function y(e,t,n){let r=d(e,t+1+n.length),i=null,a=[];for(;r<e.length;){r=d(e,r);let t=v(e,r,n);if(t)return{endIdx:t.endIdx,islandProp:i,otherProps:a};let o=_(e,r);if(!o)return null;if(r=o.endIdx,o.name===`island`)i=o.value??`{}`;else{let e=o.value===null?`${o.name}: true`:`${o.name}: ${o.value}`;a.push(e)}}return null}function b(e,t,n,r,i){let a=n?`, framework: "${n}"`:``,o=e.otherProps.length>0?`, props: { ${e.otherProps.join(`, `)} }`:``,s=`, component: ${i}`;if(r)return`{await __pageRenderIsland({ src: "`+t+`"`+a+s+o+`, ssr: true, ssrOnly: true })}`;let c=e.islandProp??``;return`{await __pageRenderIsland({ src: "`+t+`"`+a+s+`, ...(`+c+`)`+o+`, ssr: (`+c+`).ssr !== undefined ? (`+c+`).ssr : true })}`}function x(e,t,n){if(!e.startsWith(n,t))return!1;let r=t+n.length;return r>=e.length||!/[a-zA-Z0-9_$]/.test(e[r])}function S(e,t,n,r,i){let a=`<${t}`,o=``,s=0;for(;s<e.length;){if(e[s]==="`"){let t=s;s=p(e,s),o+=e.slice(t,s);continue}if(e[s]===`{`&&e[s+1]===`/`&&e[s+2]===`*`){let t=e.indexOf(`*/`,s+3);if(t!==-1){let n=t+2;for(;n<e.length&&/\s/.test(e[n]);)n++;if(n<e.length&&e[n]===`}`){o+=e.slice(s,n+1),s=n+1;continue}}}if(e[s]===`/`&&e[s+1]===`/`){let t=e.indexOf(`
2
+ `,s),n=t===-1?e.length:t+1;o+=e.slice(s,n),s=n;continue}if(e[s]===`/`&&e[s+1]===`*`){let t=e.indexOf(`*/`,s+2),n=t===-1?e.length:t+2;o+=e.slice(s,n),s=n;continue}if(!x(e,s,a)){o+=e[s],s++;continue}let c=y(e,s,t);if(!c||!c.islandProp&&!i){let t=c?c.endIdx:s+1;o+=e.slice(s,t),s=t;continue}o+=b(c,n,r,i&&!c.islandProp,t),s=c.endIdx}return o}export function pageIslandTransform(e={}){let{pagesDir:n=`src/pages`,layoutsDir:r=`src/layouts`,modules:o=null}=e;return{name:`avalon:page-island-transform`,enforce:`pre`,transform(e,s){let d=a(s,r,o);if(!i(s,n,o)&&!d)return null;let f=t(e);if(f.length===0||!c(e,f.map(e=>e.localName))&&!l(e,f))return null;let p=u(e,f,s);if(p.size===0)return null;let m=`import { renderIsland as __pageRenderIsland } from '@useavalon/avalon';\n${e}`;for(let[e,t]of p)m=S(m,e,t.srcPath,t.framework,t.autoIsland);return{code:m,map:null}}}}
@@ -3,11 +3,11 @@
3
3
  *
4
4
  * Image optimization, error boundaries, and persistent state for islands.
5
5
  */
6
- export { Image } from '../components/Image.tsx';
7
- export type { ImageProps } from '../components/Image.tsx';
8
- export { IslandErrorBoundary, withIslandErrorBoundary } from '../components/IslandErrorBoundary.tsx';
9
- export type { IslandErrorBoundaryProps } from '../components/IslandErrorBoundary.tsx';
10
- export { LayoutErrorBoundary } from '../components/LayoutErrorBoundary.tsx';
11
- export type { LayoutErrorBoundaryProps } from '../components/LayoutErrorBoundary.tsx';
12
- export { usePersistentState } from '../persistence/use-persistent-state.ts';
13
- export { registerClientDirective } from './custom-directives.js';
6
+ export type { ImageProps } from "../components/Image.tsx";
7
+ export { Image } from "../components/Image.tsx";
8
+ export type { IslandErrorBoundaryProps } from "../components/IslandErrorBoundary.tsx";
9
+ export { IslandErrorBoundary, withIslandErrorBoundary, } from "../components/IslandErrorBoundary.tsx";
10
+ export type { LayoutErrorBoundaryProps } from "../components/LayoutErrorBoundary.tsx";
11
+ export { LayoutErrorBoundary } from "../components/LayoutErrorBoundary.tsx";
12
+ export { usePersistentState } from "../persistence/use-persistent-state.ts";
13
+ export { registerClientDirective } from "./custom-directives.js";
@@ -1 +1 @@
1
- export{PersistentIsland}from"../components/PersistentIsland.tsx";export{usePersistentIslandContext,PersistentIslandProvider,createPersistentIslandContext}from"../core/islands/persistent-island-context.tsx";export{usePersistentState}from"../core/islands/use-persistent-state.js";export{IslandPersistence,defaultIslandPersistence}from"../core/islands/island-persistence.js";export{IslandStateSerializer}from"../core/islands/island-state-serializer.js";export{IslandErrorBoundary,withIslandErrorBoundary}from"../components/IslandErrorBoundary.tsx";export{LayoutErrorBoundary}from"../components/LayoutErrorBoundary.tsx";export{LayoutDataErrorBoundary}from"../components/LayoutDataErrorBoundary.tsx";export{StreamingErrorBoundary,withStreamingErrorBoundary}from"../components/StreamingErrorBoundary.tsx";export{StreamingLayout,StreamingSuspense,withStreaming,useStreamingState}from"../components/StreamingLayout.tsx";export{Image}from"../components/Image.tsx";export{registerClientDirective}from"./custom-directives.js";
1
+ export{Image}from"../components/Image.tsx";export{IslandErrorBoundary,withIslandErrorBoundary}from"../components/IslandErrorBoundary.tsx";export{LayoutDataErrorBoundary}from"../components/LayoutDataErrorBoundary.tsx";export{LayoutErrorBoundary}from"../components/LayoutErrorBoundary.tsx";export{PersistentIsland}from"../components/PersistentIsland.tsx";export{StreamingErrorBoundary,withStreamingErrorBoundary}from"../components/StreamingErrorBoundary.tsx";export{StreamingLayout,StreamingSuspense,useStreamingState,withStreaming}from"../components/StreamingLayout.tsx";export{defaultIslandPersistence,IslandPersistence}from"../core/islands/island-persistence.js";export{IslandStateSerializer}from"../core/islands/island-state-serializer.js";export{createPersistentIslandContext,PersistentIslandProvider,usePersistentIslandContext}from"../core/islands/persistent-island-context.tsx";export{usePersistentState}from"../core/islands/use-persistent-state.js";export{registerClientDirective}from"./custom-directives.js";
@@ -1,6 +1,6 @@
1
1
  /** @jsxImportSource preact */
2
- import { Component, type ComponentChildren, type ComponentType } from 'preact';
3
- import type { LayoutErrorInfo } from '../schemas/layout.ts';
2
+ import { Component, type ComponentChildren, type ComponentType } from "preact";
3
+ import type { LayoutErrorInfo } from "../schemas/layout.ts";
4
4
  /**
5
5
  * Props for {@link IslandErrorBoundary}.
6
6
  *
@@ -1 +1 @@
1
- import{Component as e}from"preact";import{jsx as t,jsxs as n}from"preact/jsx-runtime";export class IslandErrorBoundary extends e{constructor(e){super(e),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){let n={layoutPath:`island:${this.props.islandId}`,errorType:`island`,timestamp:Date.now(),componentStack:t.componentStack,errorBoundary:`IslandErrorBoundary`};if(this.setState({errorInfo:n}),this.props.onError?.(e,n),!this.props.isolateError)throw e}handleRemoveIsland=()=>{document.querySelector(`[data-island-id="${this.props.islandId}"]`)?.remove()};handleReloadIsland=()=>{this.setState({hasError:!1,error:null,errorInfo:null})};render(){if(!this.state.hasError)return this.props.children;let{error:e}=this.state,{fallback:r,islandId:i}=this.props;if(r&&e)return r(e,i);let a=typeof process<`u`&&process.env?.NODE_ENV===`development`;return t(`div`,{className:`island-error-boundary`,"data-island-error":i,children:n(`div`,{className:`island-error-container`,children:[n(`div`,{className:`island-error-header`,children:[t(`span`,{className:`island-error-icon`,children:`⚠️`}),t(`span`,{className:`island-error-title`,children:`Island Error`})]}),n(`p`,{className:`island-error-message`,children:[`An error occurred in island "`,i,`".`]}),n(`div`,{className:`island-error-actions`,children:[t(`button`,{onClick:this.handleReloadIsland,className:`island-reload-button`,children:`Reload Island`}),t(`button`,{onClick:this.handleRemoveIsland,className:`island-remove-button`,children:`Remove Island`})]}),a&&e&&n(`details`,{className:`island-error-details`,children:[t(`summary`,{children:`Error Details (Development)`}),n(`p`,{children:[t(`strong`,{children:`Island ID:`}),` `,i]}),n(`p`,{children:[t(`strong`,{children:`Error:`}),` `,e.message]}),t(`pre`,{className:`island-error-stack`,children:e.stack})]})]})})}}export function withIslandErrorBoundary(e,n,i){return function(a){return t(IslandErrorBoundary,{islandId:n,fallback:i?.fallback,isolateError:i?.isolateError??!0,onError:i?.onError,children:t(e,{...a})})}}
1
+ import{Component as e}from"preact";import{jsx as t,jsxs as n}from"preact/jsx-runtime";export class IslandErrorBoundary extends e{constructor(e){super(e),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){let n={layoutPath:`island:${this.props.islandId}`,errorType:`island`,timestamp:Date.now(),componentStack:t.componentStack,errorBoundary:`IslandErrorBoundary`};if(this.setState({errorInfo:n}),this.props.onError?.(e,n),!this.props.isolateError)throw e}handleRemoveIsland=()=>{document.querySelector(`[data-island-id="${this.props.islandId}"]`)?.remove()};handleReloadIsland=()=>{this.setState({hasError:!1,error:null,errorInfo:null})};render(){if(!this.state.hasError)return this.props.children;let{error:e}=this.state,{fallback:r,islandId:i}=this.props;if(r&&e)return r(e,i);let a=typeof process<`u`&&process.env?.NODE_ENV===`development`;return t(`div`,{className:`island-error-boundary`,"data-island-error":i,children:n(`div`,{className:`island-error-container`,children:[n(`div`,{className:`island-error-header`,children:[t(`span`,{className:`island-error-icon`,children:`⚠️`}),t(`span`,{className:`island-error-title`,children:`Island Error`})]}),n(`p`,{className:`island-error-message`,children:[`An error occurred in island "`,i,`".`]}),n(`div`,{className:`island-error-actions`,children:[t(`button`,{type:`button`,onClick:this.handleReloadIsland,className:`island-reload-button`,children:`Reload Island`}),t(`button`,{type:`button`,onClick:this.handleRemoveIsland,className:`island-remove-button`,children:`Remove Island`})]}),a&&e&&n(`details`,{className:`island-error-details`,children:[t(`summary`,{children:`Error Details (Development)`}),n(`p`,{children:[t(`strong`,{children:`Island ID:`}),` `,i]}),n(`p`,{children:[t(`strong`,{children:`Error:`}),` `,e.message]}),t(`pre`,{className:`island-error-stack`,children:e.stack})]})]})})}}export function withIslandErrorBoundary(e,n,i){return function(a){return t(IslandErrorBoundary,{islandId:n,fallback:i?.fallback,isolateError:i?.isolateError??!0,onError:i?.onError,children:t(e,{...a})})}}
@@ -1,6 +1,6 @@
1
1
  /** @jsxImportSource preact */
2
- import { Component, type ComponentChildren } from 'preact';
3
- import type { LayoutErrorInfo, LayoutData } from '../schemas/layout.ts';
2
+ import { Component, type ComponentChildren } from "preact";
3
+ import type { LayoutData, LayoutErrorInfo } from "../schemas/layout.ts";
4
4
  /**
5
5
  * Props for {@link LayoutErrorBoundary}.
6
6
  *
@@ -43,7 +43,7 @@ export interface LayoutErrorBoundaryProps {
43
43
  /** Called when the layout throws. */
44
44
  onError?: (error: Error, errorInfo: LayoutErrorInfo) => void;
45
45
  /** Categorises the error for structured logging. Defaults to `'component'`. */
46
- errorType?: 'component' | 'loader' | 'rendering' | 'island';
46
+ errorType?: "component" | "loader" | "rendering" | "island";
47
47
  /** Async function to re-attempt data loading. Enables the async retry button (up to 3 attempts). */
48
48
  retryLoader?: () => Promise<LayoutData>;
49
49
  /** Static data to offer as a "Use Cached Data" option when the loader fails. */
@@ -1 +1 @@
1
- import{Component as e}from"preact";import{jsx as t,jsxs as n}from"preact/jsx-runtime";export class LayoutErrorBoundary extends e{maxRetries=3;constructor(e){super(e),this.state={hasError:!1,error:null,errorInfo:null,retryCount:0,isRetrying:!1,fallbackData:e.fallbackData??null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){let n={errorType:this.props.errorType??`component`,timestamp:Date.now(),componentStack:t.componentStack,errorBoundary:`LayoutErrorBoundary`,layoutPath:void 0};this.setState({errorInfo:n}),this.props.onError?.(e,n)}handleRetry=async()=>{if(!(this.state.retryCount>=this.maxRetries))if(this.props.retryLoader){this.setState({isRetrying:!0});try{let e=await this.props.retryLoader();this.setState(t=>({hasError:!1,error:null,errorInfo:null,retryCount:t.retryCount+1,isRetrying:!1,fallbackData:e}))}catch(e){this.setState(t=>({retryCount:t.retryCount+1,isRetrying:!1,error:e instanceof Error?e:Error(String(e))}))}}else this.setState(e=>({hasError:!1,error:null,errorInfo:null,retryCount:e.retryCount+1}))};handleUseFallback=()=>{this.state.fallbackData&&this.setState({hasError:!1,error:null,errorInfo:null})};render(){if(!this.state.hasError)return this.props.children;let{error:e,retryCount:r,isRetrying:i,fallbackData:a}=this.state;if(this.props.fallback&&e)return this.props.fallback(e,this.handleRetry);let o=r<this.maxRetries,s=typeof process<`u`&&process.env?.NODE_ENV===`development`;return t(`div`,{className:`layout-error-boundary`,children:n(`div`,{className:`error-container`,children:[t(`h2`,{children:`Something went wrong`}),t(`p`,{children:`An error occurred while rendering this layout.`}),n(`div`,{className:`error-actions`,children:[o&&t(`button`,{onClick:this.handleRetry,disabled:i,className:`retry-button`,children:i?`Retrying...`:`Try Again (${this.maxRetries-r} left)`}),a!==null&&t(`button`,{onClick:this.handleUseFallback,className:`fallback-button`,children:`Use Cached Data`})]}),s&&e&&n(`details`,{className:`error-details`,children:[t(`summary`,{children:`Error Details (Development)`}),n(`p`,{children:[t(`strong`,{children:`Error:`}),` `,e.message]}),this.state.errorInfo&&n(`p`,{children:[t(`strong`,{children:`Error Type:`}),` `,this.state.errorInfo.errorType]}),t(`pre`,{className:`error-stack`,children:e.stack})]})]})})}}
1
+ import{Component as e}from"preact";import{jsx as t,jsxs as n}from"preact/jsx-runtime";export class LayoutErrorBoundary extends e{maxRetries=3;constructor(e){super(e),this.state={hasError:!1,error:null,errorInfo:null,retryCount:0,isRetrying:!1,fallbackData:e.fallbackData??null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){let n={errorType:this.props.errorType??`component`,timestamp:Date.now(),componentStack:t.componentStack,errorBoundary:`LayoutErrorBoundary`,layoutPath:void 0};this.setState({errorInfo:n}),this.props.onError?.(e,n)}handleRetry=async()=>{if(!(this.state.retryCount>=this.maxRetries))if(this.props.retryLoader){this.setState({isRetrying:!0});try{let e=await this.props.retryLoader();this.setState(t=>({hasError:!1,error:null,errorInfo:null,retryCount:t.retryCount+1,isRetrying:!1,fallbackData:e}))}catch(e){this.setState(t=>({retryCount:t.retryCount+1,isRetrying:!1,error:e instanceof Error?e:Error(String(e))}))}}else this.setState(e=>({hasError:!1,error:null,errorInfo:null,retryCount:e.retryCount+1}))};handleUseFallback=()=>{this.state.fallbackData&&this.setState({hasError:!1,error:null,errorInfo:null})};render(){if(!this.state.hasError)return this.props.children;let{error:e,retryCount:r,isRetrying:i,fallbackData:a}=this.state;if(this.props.fallback&&e)return this.props.fallback(e,this.handleRetry);let o=r<this.maxRetries,s=typeof process<`u`&&process.env?.NODE_ENV===`development`;return t(`div`,{className:`layout-error-boundary`,children:n(`div`,{className:`error-container`,children:[t(`h2`,{children:`Something went wrong`}),t(`p`,{children:`An error occurred while rendering this layout.`}),n(`div`,{className:`error-actions`,children:[o&&t(`button`,{type:`button`,onClick:this.handleRetry,disabled:i,className:`retry-button`,children:i?`Retrying...`:`Try Again (${this.maxRetries-r} left)`}),a!==null&&t(`button`,{type:`button`,onClick:this.handleUseFallback,className:`fallback-button`,children:`Use Cached Data`})]}),s&&e&&n(`details`,{className:`error-details`,children:[t(`summary`,{children:`Error Details (Development)`}),n(`p`,{children:[t(`strong`,{children:`Error:`}),` `,e.message]}),this.state.errorInfo&&n(`p`,{children:[t(`strong`,{children:`Error Type:`}),` `,this.state.errorInfo.errorType]}),t(`pre`,{className:`error-stack`,children:e.stack})]})]})})}}
@@ -23,7 +23,7 @@ export declare function detectAndLoadIntegration(src: string): Promise<Integrati
23
23
  * @param src - The source path to detect framework from
24
24
  * @returns The detected framework name
25
25
  */
26
- export declare function detectFrameworkFromPath(src: string): "react" | "preact" | "vue" | "svelte" | "solid" | "lit" | "qwik";
26
+ export declare function detectFrameworkFromPath(src: string): "vue" | "svelte" | "solid" | "preact" | "react" | "lit" | "qwik";
27
27
  /**
28
28
  * Check if a path is within any islands directory (including nested).
29
29
  *
@@ -66,7 +66,7 @@ export declare function extractNamespaceFromPath(path: string): string;
66
66
  * @param content - The file content to analyze
67
67
  * @returns The detected framework name
68
68
  */
69
- export declare function detectFrameworkFromContent(src: string, content: string): "react" | "preact" | "vue" | "svelte" | "solid" | "lit" | "qwik";
69
+ export declare function detectFrameworkFromContent(src: string, content: string): "vue" | "svelte" | "solid" | "preact" | "react" | "lit" | "qwik";
70
70
  /**
71
71
  * Get integration for a specific framework, with error handling
72
72
  */
@@ -1,14 +1,14 @@
1
- import type { JSX } from 'preact';
2
- import type { ViteDevServer } from 'vite';
3
- import type { AnalyzerOptions } from '../core/components/component-analyzer.ts';
4
- import type { Framework } from './types.ts';
1
+ import type { JSX } from "preact";
2
+ import type { ViteDevServer } from "vite";
3
+ import type { AnalyzerOptions } from "../core/components/component-analyzer.ts";
4
+ import type { Framework } from "./types.ts";
5
5
  declare global {
6
6
  var __viteDevServer: ViteDevServer | undefined;
7
7
  }
8
8
  /** Supported hydration conditions for island components */
9
- export type HydrationCondition = 'on:visible' | 'on:interaction' | 'on:idle' | 'on:client' | `media:${string}` | `on:${string}`;
9
+ export type HydrationCondition = "on:visible" | "on:interaction" | "on:idle" | "on:client" | `media:${string}` | `on:${string}`;
10
10
  /** Supported framework identifiers (without "unknown") */
11
- export type FrameworkId = Exclude<Framework, 'unknown'>;
11
+ export type FrameworkId = Exclude<Framework, "unknown">;
12
12
  export interface IslandProps {
13
13
  /** Path to the island component (e.g., "/islands/Counter.tsx") */
14
14
  src: string;
@@ -19,7 +19,7 @@ export interface IslandProps {
19
19
  /** Props to pass to the island component */
20
20
  props?: Record<string, unknown>;
21
21
  /** Children to render inside the island (for SSR) */
22
- children?: import('preact').ComponentChildren;
22
+ children?: import("preact").ComponentChildren;
23
23
  /** Whether to render server-side (default: true unless condition is 'on:client') */
24
24
  ssr?: boolean;
25
25
  /** Framework hint for client hydration */
@@ -1 +1 @@
1
- import{h as e}from"preact";import{detectFramework as t}from"./framework-detection.js";import{analyzeComponentFile as n,renderComponentSSROnly as r}from"./component-analysis.js";import{loadIntegration as i,detectFrameworkFromPath as a}from"./integration-loader.js";import{addUniversalCSS as o}from"./universal-css-collector.js";import{addUniversalHead as s}from"./universal-head-collector.js";import{getIslandBundlePath as c}from"../build/island-manifest.js";import{isDev as l,devLog as u,devWarn as d,devError as f,logRenderTiming as p}from"../utils/dev-logger.js";import{isCustomDirective as m,serializeDirectiveScript as h}from"./hydration-directives.js";function g(e){return`island-${e.replaceAll(/[^a-zA-Z0-9]/g,`-`)}`}function _(e){let t={};e.renderId&&(t[`data-solid-render-id`]=e.renderId);let n=e.metadata;return n?.tagName&&(t[`data-tag-name`]=n.tagName),t}function v(e,t,n,r,i){let a={"data-condition":t,"data-src":c(e),"data-props":JSON.stringify(n),"data-render-strategy":`hydrate`,..._(r)};if(m(t)){a[`data-custom-directive`]=t;let e=h(t);e&&(a[`data-directive-script`]=e)}return i&&(a[`data-condition-arg`]=i),a}function y(e){return e.startsWith(`<script`)?`script`:e.startsWith(`<style`)?`style`:e.startsWith(`<meta`)?`meta`:e.startsWith(`<link`)?`link`:e.includes(`window._$HY`)||e.includes(`_$HY=`)?`script`:`other`}function b(e){let t=e.match(/<style[^>]*>([\s\S]*?)<\/style>/i);return t?t[1].trim():null}function x(e,t,n,r){if(e.css&&o(e.css,t,n,e.scopeId),e.head){let i=e.head.trim(),a=y(i);if(a===`style`){let a=b(i);a&&(u(`${r} Extracting CSS from head <style> tag`),o(a,t,n,e.scopeId));return}s(e.head,t,n,a)}}function S(t){let{islandId:n,detectedFramework:r,shouldSkipHydration:i,src:a,condition:o,conditionArg:s,props:c,hydrationData:l,children:d}=t,f={id:n,"data-framework":r},p=i?{"data-render-strategy":`ssr-only`}:v(a,o,c,l,s);r===`lit`&&u(`🔍 [Island Component] ${a} - Lit hydration data:`,{hydrationDataKeys:Object.keys(l),metadata:l.metadata});let m={...f,...p};return typeof d==`string`?e(`avalon-island`,{...m,dangerouslySetInnerHTML:{__html:d}}):e(`avalon-island`,m,d)}function C(t){let{islandId:n,detectedFramework:r,shouldSkipHydration:i,src:a,condition:o,props:s,hydrationData:l,conditionArg:u}=t;if(i)return e(`avalon-island`,{id:n,"data-render-strategy":`ssr-only`,"data-framework":r});let d={id:n,"data-condition":o,"data-src":c(a),"data-props":JSON.stringify(s),"data-render-strategy":`hydrate`,"data-framework":r,..._(l)};if(m(o)){d[`data-custom-directive`]=o;let e=h(o);e&&(d[`data-directive-script`]=e)}return u&&(d[`data-condition-arg`]=u),e(`avalon-island`,d)}export default function w({src:e,condition:t=`on:client`,conditionArg:n,props:r={},children:i,ssr:o=t!==`on:client`,framework:s,ssrOnly:c=!1,renderOptions:l={},hydrationData:f={}}){let p=g(e),m=c||!!l.forceSSROnly,h=s||a(e),_=i!=null&&i!==``;return u(`🔍 [Island Component] ${e}`,{ssr:o,ssrOnly:c,hasChildren:_,framework:s,condition:t}),o&&_?S({islandId:p,detectedFramework:h,shouldSkipHydration:m,src:e,condition:t,conditionArg:n,props:r,hydrationData:f,children:i}):(o&&!_&&m&&d(`${e}: SSR-only component has no rendered content. This may indicate a rendering error.`),C({islandId:p,detectedFramework:h,shouldSkipHydration:m,src:e,condition:t,props:r,hydrationData:f,conditionArg:n}))}function T(t,n){let r=n instanceof Error?n.message:String(n);return f(`🚨 Island SSR failed for ${t}:`,n),n instanceof Error&&n.stack&&f(`Stack trace:`,n.stack),e(`avalon-island`,{id:g(t),"data-src":c(t),"data-ssr-error":r,"data-render-strategy":`client-only`})}async function E({src:e,condition:t,conditionArg:n,props:r,children:a,ssr:o,framework:s,ssrOnly:c,renderOptions:u,component:d}){let p=`🏝️ [${e}]`;if(!o||a)return w({src:e,condition:t,conditionArg:n,props:r,children:a,ssr:o,framework:s,ssrOnly:c,renderOptions:u});let m;try{m=await i(s)}catch(i){return f(`${p} Failed to load ${s} integration:`,i),w({src:e,condition:t,conditionArg:n,props:r,ssr:!1,framework:s,ssrOnly:c,renderOptions:u})}try{let i=await m.render({component:d??null,props:r,src:e,condition:t,ssrOnly:c,viteServer:globalThis.__viteDevServer,isDev:l()});return x(i,e,s,p),w({src:e,condition:t,conditionArg:n,props:r,children:i.html,ssr:!0,framework:s,ssrOnly:c,renderOptions:u,hydrationData:c?void 0:i.hydrationData})}catch(i){return f(`${p} Fast path SSR failed:`,i),w({src:e,condition:t,conditionArg:n,props:r,ssr:!1,framework:s,ssrOnly:c,renderOptions:u})}}async function D(e,t,r,i){if(t||r.detectScripts===!1)return t;try{let t=await n(e,r);if(t.decision.warnings?.length)for(let e of t.decision.warnings)d(`${i} Analysis warning: ${e}`);return!t.decision.shouldHydrate}catch(e){return d(`${i} Component analysis failed:`,e),t}}async function O(e){return e.endsWith(`.vue`)?`vue`:e.endsWith(`.svelte`)?`svelte`:e.endsWith(`.tsx`)||e.endsWith(`.jsx`)||e.endsWith(`.ts`)||e.endsWith(`.js`)?t(e):`unknown`}async function k(e,t,n,r,i,a,o){let s=await O(e),c=s,u=await(await A(s,a)).render({component:o??null,props:n,src:e,condition:t,ssrOnly:r,viteServer:globalThis.__viteDevServer,isDev:l()});return x(u,e,s,a),w({src:e,condition:t,props:n,children:u.html,ssr:!0,framework:c,ssrOnly:r,renderOptions:i,hydrationData:r?void 0:u.hydrationData})}async function A(e,t){try{u(`${t} Loading integration for framework: ${e}`);let n=await i(e);return u(`${t} ✅ Integration loaded successfully`),n}catch(n){throw f(`${t} Failed to load ${e} integration:`,n),Error(`Failed to load integration for framework '${e}'. Make sure @useavalon/${e} is installed.\nInstall it with: deno add @useavalon/${e}`,{cause:n})}}export async function renderIsland({src:e,condition:t=`on:client`,conditionArg:n,props:r={},children:i,ssr:a=t!==`on:client`,framework:o,ssrOnly:s=!1,renderOptions:c={},component:u}){let d=l()?performance.now():0,f=`🏝️ [${e}]`;try{return s&&!a&&(a=!0),o?await E({src:e,condition:t,conditionArg:n,props:r,children:i,ssr:a,framework:o,ssrOnly:s,renderOptions:c,component:u}):await j({src:e,condition:t,conditionArg:n,props:r,children:i,ssr:a,ssrOnly:s,renderOptions:c,logPrefix:f,component:u})}catch(t){return T(e,t)}finally{l()&&p(e,performance.now()-d)}}async function j(e){let{src:t,condition:n,conditionArg:r,props:i,children:a,ssr:o,ssrOnly:s,renderOptions:c,logPrefix:l,component:d}=e;if(u(`🔍 [renderIsland] ${t} - Starting render (slow path)`,{ssr:o,ssrOnly:s,hasChildren:!!a,condition:n}),await D(t,s,c,l))return M(t,n,i,a,o,c,l);if(!o||a)return w({src:t,condition:n,conditionArg:r,props:i,children:a,ssr:o,renderOptions:c});try{return await k(t,n,i,s,c,l,d)}catch(e){let a=await O(t);return f(`${l} Framework rendering failed:`,e),w({src:t,condition:n,conditionArg:r,props:i,ssr:!1,framework:a,renderOptions:c})}}function M(e,t,n,i,a,o,s){return a&&!i?r({src:e,condition:t,props:n,renderOptions:o}).catch(r=>(f(`${s} SSR failed for SSR-only component:`,r),w({src:e,condition:t,props:n,ssr:!1,ssrOnly:!0,renderOptions:o}))):w({src:e,condition:t,props:n,children:i,ssr:a,ssrOnly:!0,renderOptions:o})}
1
+ import{h as e}from"preact";import{getIslandBundlePath as t}from"../build/island-manifest.js";import{devError as n,devLog as r,devWarn as i,isDev as a,logRenderTiming as o}from"../utils/dev-logger.js";import{analyzeComponentFile as s,renderComponentSSROnly as c}from"./component-analysis.js";import{detectFramework as l}from"./framework-detection.js";import{isCustomDirective as u,serializeDirectiveScript as d}from"./hydration-directives.js";import{detectFrameworkFromPath as f,loadIntegration as p}from"./integration-loader.js";import{addUniversalCSS as m}from"./universal-css-collector.js";import{addUniversalHead as h}from"./universal-head-collector.js";function g(e){return`island-${e.replaceAll(/[^a-zA-Z0-9]/g,`-`)}`}function _(e){let t={};e.renderId&&(t[`data-solid-render-id`]=e.renderId);let n=e.metadata;return n?.tagName&&(t[`data-tag-name`]=n.tagName),t}function v(e,n,r,i,a){let o={"data-condition":n,"data-src":t(e),"data-props":JSON.stringify(r),"data-render-strategy":`hydrate`,..._(i)};if(u(n)){o[`data-custom-directive`]=n;let e=d(n);e&&(o[`data-directive-script`]=e)}return a&&(o[`data-condition-arg`]=a),o}function y(e){return e.startsWith(`<script`)?`script`:e.startsWith(`<style`)?`style`:e.startsWith(`<meta`)?`meta`:e.startsWith(`<link`)?`link`:e.includes(`window._$HY`)||e.includes(`_$HY=`)?`script`:`other`}function b(e){let t=e.match(/<style[^>]*>([\s\S]*?)<\/style>/i);return t?t[1].trim():null}function x(e,t,n,i){if(e.css&&m(e.css,t,n,e.scopeId),e.head){let a=e.head.trim(),o=y(a);if(o===`style`){let o=b(a);o&&(r(`${i} Extracting CSS from head <style> tag`),m(o,t,n,e.scopeId));return}h(e.head,t,n,o)}}function S(t){let{islandId:n,detectedFramework:i,shouldSkipHydration:a,src:o,condition:s,conditionArg:c,props:l,hydrationData:u,children:d}=t,f={id:n,"data-framework":i},p=a?{"data-render-strategy":`ssr-only`}:v(o,s,l,u,c);i===`lit`&&r(`🔍 [Island Component] ${o} - Lit hydration data:`,{hydrationDataKeys:Object.keys(u),metadata:u.metadata});let m={...f,...p};return typeof d==`string`?e(`avalon-island`,{...m,dangerouslySetInnerHTML:{__html:d}}):e(`avalon-island`,m,d)}function C(n){let{islandId:r,detectedFramework:i,shouldSkipHydration:a,src:o,condition:s,props:c,hydrationData:l,conditionArg:f}=n;if(a)return e(`avalon-island`,{id:r,"data-render-strategy":`ssr-only`,"data-framework":i});let p={id:r,"data-condition":s,"data-src":t(o),"data-props":JSON.stringify(c),"data-render-strategy":`hydrate`,"data-framework":i,..._(l)};if(u(s)){p[`data-custom-directive`]=s;let e=d(s);e&&(p[`data-directive-script`]=e)}return f&&(p[`data-condition-arg`]=f),e(`avalon-island`,p)}export default function w({src:e,condition:t=`on:client`,conditionArg:n,props:a={},children:o,ssr:s=t!==`on:client`,framework:c,ssrOnly:l=!1,renderOptions:u={},hydrationData:d={}}){let p=g(e),m=l||!!u.forceSSROnly,h=c||f(e),_=o!=null&&o!==``;return r(`🔍 [Island Component] ${e}`,{ssr:s,ssrOnly:l,hasChildren:_,framework:c,condition:t}),s&&_?S({islandId:p,detectedFramework:h,shouldSkipHydration:m,src:e,condition:t,conditionArg:n,props:a,hydrationData:d,children:o}):(s&&!_&&m&&i(`${e}: SSR-only component has no rendered content. This may indicate a rendering error.`),C({islandId:p,detectedFramework:h,shouldSkipHydration:m,src:e,condition:t,props:a,hydrationData:d,conditionArg:n}))}function T(r,i){let a=i instanceof Error?i.message:String(i);return n(`🚨 Island SSR failed for ${r}:`,i),i instanceof Error&&i.stack&&n(`Stack trace:`,i.stack),e(`avalon-island`,{id:g(r),"data-src":t(r),"data-ssr-error":a,"data-render-strategy":`client-only`})}async function E({src:e,condition:t,conditionArg:r,props:i,children:o,ssr:s,framework:c,ssrOnly:l,renderOptions:u,component:d}){let f=`🏝️ [${e}]`;if(!s||o)return w({src:e,condition:t,conditionArg:r,props:i,children:o,ssr:s,framework:c,ssrOnly:l,renderOptions:u});let m;try{m=await p(c)}catch(a){return n(`${f} Failed to load ${c} integration:`,a),w({src:e,condition:t,conditionArg:r,props:i,ssr:!1,framework:c,ssrOnly:l,renderOptions:u})}try{let n=await m.render({component:d??null,props:i,src:e,condition:t,ssrOnly:l,viteServer:globalThis.__viteDevServer,isDev:a()});return x(n,e,c,f),w({src:e,condition:t,conditionArg:r,props:i,children:n.html,ssr:!0,framework:c,ssrOnly:l,renderOptions:u,hydrationData:l?void 0:n.hydrationData})}catch(a){return n(`${f} Fast path SSR failed:`,a),w({src:e,condition:t,conditionArg:r,props:i,ssr:!1,framework:c,ssrOnly:l,renderOptions:u})}}async function D(e,t,n,r){if(t||n.detectScripts===!1)return t;try{let t=await s(e,n);if(t.decision.warnings?.length)for(let e of t.decision.warnings)i(`${r} Analysis warning: ${e}`);return!t.decision.shouldHydrate}catch(e){return i(`${r} Component analysis failed:`,e),t}}async function O(e){return e.endsWith(`.vue`)?`vue`:e.endsWith(`.svelte`)?`svelte`:e.endsWith(`.tsx`)||e.endsWith(`.jsx`)||e.endsWith(`.ts`)||e.endsWith(`.js`)?l(e):`unknown`}async function k(e,t,n,r,i,o,s){let c=await O(e),l=c,u=await(await A(c,o)).render({component:s??null,props:n,src:e,condition:t,ssrOnly:r,viteServer:globalThis.__viteDevServer,isDev:a()});return x(u,e,c,o),w({src:e,condition:t,props:n,children:u.html,ssr:!0,framework:l,ssrOnly:r,renderOptions:i,hydrationData:r?void 0:u.hydrationData})}async function A(e,t){try{r(`${t} Loading integration for framework: ${e}`);let n=await p(e);return r(`${t} ✅ Integration loaded successfully`),n}catch(r){throw n(`${t} Failed to load ${e} integration:`,r),Error(`Failed to load integration for framework '${e}'. Make sure @useavalon/${e} is installed.\nInstall it with: deno add @useavalon/${e}`,{cause:r})}}export async function renderIsland({src:e,condition:t=`on:client`,conditionArg:n,props:r={},children:i,ssr:s=t!==`on:client`,framework:c,ssrOnly:l=!1,renderOptions:u={},component:d}){let f=a()?performance.now():0,p=`🏝️ [${e}]`;try{return l&&!s&&(s=!0),c?await E({src:e,condition:t,conditionArg:n,props:r,children:i,ssr:s,framework:c,ssrOnly:l,renderOptions:u,component:d}):await j({src:e,condition:t,conditionArg:n,props:r,children:i,ssr:s,ssrOnly:l,renderOptions:u,logPrefix:p,component:d})}catch(t){return T(e,t)}finally{a()&&o(e,performance.now()-f)}}async function j(e){let{src:t,condition:i,conditionArg:a,props:o,children:s,ssr:c,ssrOnly:l,renderOptions:u,logPrefix:d,component:f}=e;if(r(`🔍 [renderIsland] ${t} - Starting render (slow path)`,{ssr:c,ssrOnly:l,hasChildren:!!s,condition:i}),await D(t,l,u,d))return M(t,i,o,s,c,u,d);if(!c||s)return w({src:t,condition:i,conditionArg:a,props:o,children:s,ssr:c,renderOptions:u});try{return await k(t,i,o,l,u,d,f)}catch(e){let r=await O(t);return n(`${d} Framework rendering failed:`,e),w({src:t,condition:i,conditionArg:a,props:o,ssr:!1,framework:r,renderOptions:u})}}function M(e,t,r,i,a,o,s){return a&&!i?c({src:e,condition:t,props:r,renderOptions:o}).catch(i=>(n(`${s} SSR failed for SSR-only component:`,i),w({src:e,condition:t,props:r,ssr:!1,ssrOnly:!0,renderOptions:o}))):w({src:e,condition:t,props:r,children:i,ssr:a,ssrOnly:!0,renderOptions:o})}
@@ -4,23 +4,20 @@
4
4
  * This file provides a comprehensive export index for the entire layout system,
5
5
  * making it easy to import all layout-related functionality from a single location.
6
6
  */
7
- export { LayoutDiscovery } from './core/layout/layout-discovery.ts';
8
- export type { LayoutDiscoveryOptions, LayoutRoute } from './schemas/layout.ts';
9
- export { LayoutDataLoader, LayoutDataLoadingError, loadSingleLayoutData, mergeLayoutData, getParentLayoutData, defaultLayoutDataLoader, } from './core/layout/layout-data-loader.ts';
10
- export type { LayoutDataLoadingResult, LayoutDataLoadingOptions } from './core/layout/layout-data-loader.ts';
11
- export { LayoutMatcher as LayoutMatcherClass, BuiltInLayoutRules } from './core/layout/layout-matcher.ts';
12
- export type { LayoutRule, RouteInfo } from './schemas/layout.ts';
13
- export { LayoutComposer } from './core/layout/layout-composer.ts';
14
- export type { LayoutConfig } from './schemas/layout.ts';
15
- export { EnhancedLayoutResolver, createEnhancedLayoutResolver, EnhancedLayoutResolverUtils, } from './core/layout/enhanced-layout-resolver.ts';
16
- export type { EnhancedLayoutResolverOptions } from './core/layout/enhanced-layout-resolver.ts';
17
- export { LayoutCacheManager } from './core/layout/layout-cache-manager.ts';
18
- export type { CacheEntry, CacheStats, CacheConfig, } from './core/layout/layout-cache-manager.ts';
19
- export type { LayoutContext, LayoutData, LayoutHandler, LayoutProps, LayoutLoader, ResolvedLayout, LayoutCache, EnhancedLayoutContext, LayoutMatcherFunction, LayoutErrorHandler, LayoutRetryFunction, LayoutFallbackRenderer, IslandStateSaver, IslandStateLoader, IslandStateClearer, StreamingReadyCheck, } from './schemas/layout.ts';
20
- export type { ILayoutDiscovery, ILayoutMatcher, ILayoutComposer, IIslandPersistence, ILayoutErrorRecovery, ILayoutStreaming, IEnhancedLayoutResolver, ILayoutComponent, IPersistentIslandComponent, ILayoutErrorBoundaryComponent, IStreamingLayoutComponent, LayoutModule, PageModule, LayoutResolutionContext, LayoutPerformanceMetrics, LayoutDebugInfo, LayoutEventType, LayoutEventData, LayoutEventHandler, ILayoutEventEmitter, } from './types/layout.ts';
21
- export { LayoutContextSchema, LayoutDataSchema, LayoutRouteSchema, LayoutHandlerSchema, LayoutPropsSchema, LayoutDiscoveryOptionsSchema, RouteInfoSchema, LayoutRuleSchema, LayoutConfigSchema, IslandStateSchema, PersistentIslandPropsSchema, PersistentIslandContextSchema, LayoutErrorInfoSchema, LayoutErrorBoundaryPropsSchema, ErrorRecoveryStrategySchema, StreamingLayoutPropsSchema, StreamingComponentSchema, ResolvedLayoutSchema, LayoutCacheSchema, EnhancedLayoutContextSchema, } from './schemas/layout.ts';
22
- export { EnhancedLayoutResolver as LayoutSystem } from './core/layout/enhanced-layout-resolver.ts';
23
- export { createEnhancedLayoutResolver as createLayoutSystem } from './core/layout/enhanced-layout-resolver.ts';
7
+ export type { EnhancedLayoutResolverOptions } from "./core/layout/enhanced-layout-resolver.ts";
8
+ export { createEnhancedLayoutResolver, EnhancedLayoutResolver, EnhancedLayoutResolverUtils, } from "./core/layout/enhanced-layout-resolver.ts";
9
+ export { LayoutComposer } from "./core/layout/layout-composer.ts";
10
+ export type { LayoutDataLoadingOptions, LayoutDataLoadingResult, } from "./core/layout/layout-data-loader.ts";
11
+ export { defaultLayoutDataLoader, getParentLayoutData, LayoutDataLoader, LayoutDataLoadingError, loadSingleLayoutData, mergeLayoutData, } from "./core/layout/layout-data-loader.ts";
12
+ export { LayoutDiscovery } from "./core/layout/layout-discovery.ts";
13
+ export { BuiltInLayoutRules, LayoutMatcher as LayoutMatcherClass, } from "./core/layout/layout-matcher.ts";
14
+ export type { LayoutConfig, LayoutDiscoveryOptions, LayoutRoute, LayoutRule, RouteInfo, } from "./schemas/layout.ts";
15
+ export type { CacheConfig, CacheEntry, CacheStats, } from "./core/layout/layout-cache-manager.ts";
16
+ export { LayoutCacheManager } from "./core/layout/layout-cache-manager.ts";
17
+ export type { EnhancedLayoutContext, IslandStateClearer, IslandStateLoader, IslandStateSaver, LayoutCache, LayoutContext, LayoutData, LayoutErrorHandler, LayoutFallbackRenderer, LayoutHandler, LayoutLoader, LayoutMatcherFunction, LayoutProps, LayoutRetryFunction, ResolvedLayout, StreamingReadyCheck, } from "./schemas/layout.ts";
18
+ export type { IEnhancedLayoutResolver, IIslandPersistence, ILayoutComponent, ILayoutComposer, ILayoutDiscovery, ILayoutErrorBoundaryComponent, ILayoutErrorRecovery, ILayoutEventEmitter, ILayoutMatcher, ILayoutStreaming, IPersistentIslandComponent, IStreamingLayoutComponent, LayoutDebugInfo, LayoutEventData, LayoutEventHandler, LayoutEventType, LayoutModule, LayoutPerformanceMetrics, LayoutResolutionContext, PageModule, } from "./types/layout.ts";
19
+ export { EnhancedLayoutContextSchema, ErrorRecoveryStrategySchema, IslandStateSchema, LayoutCacheSchema, LayoutConfigSchema, LayoutContextSchema, LayoutDataSchema, LayoutDiscoveryOptionsSchema, LayoutErrorBoundaryPropsSchema, LayoutErrorInfoSchema, LayoutHandlerSchema, LayoutPropsSchema, LayoutRouteSchema, LayoutRuleSchema, PersistentIslandContextSchema, PersistentIslandPropsSchema, ResolvedLayoutSchema, RouteInfoSchema, StreamingComponentSchema, StreamingLayoutPropsSchema, } from "./schemas/layout.ts";
20
+ export { createEnhancedLayoutResolver as createLayoutSystem, EnhancedLayoutResolver as LayoutSystem, } from "./core/layout/enhanced-layout-resolver.ts";
24
21
  /**
25
22
  * Layout System Version Information
26
23
  */
@@ -1 +1 @@
1
- export{LayoutDiscovery}from"./core/layout/layout-discovery.js";export{LayoutDataLoader,LayoutDataLoadingError,loadSingleLayoutData,mergeLayoutData,getParentLayoutData,defaultLayoutDataLoader}from"./core/layout/layout-data-loader.js";export{LayoutMatcher as LayoutMatcherClass,BuiltInLayoutRules}from"./core/layout/layout-matcher.js";export{LayoutComposer}from"./core/layout/layout-composer.js";export{EnhancedLayoutResolver,createEnhancedLayoutResolver,EnhancedLayoutResolverUtils}from"./core/layout/enhanced-layout-resolver.js";export{LayoutCacheManager}from"./core/layout/layout-cache-manager.js";export{LayoutContextSchema,LayoutDataSchema,LayoutRouteSchema,LayoutHandlerSchema,LayoutPropsSchema,LayoutDiscoveryOptionsSchema,RouteInfoSchema,LayoutRuleSchema,LayoutConfigSchema,IslandStateSchema,PersistentIslandPropsSchema,PersistentIslandContextSchema,LayoutErrorInfoSchema,LayoutErrorBoundaryPropsSchema,ErrorRecoveryStrategySchema,StreamingLayoutPropsSchema,StreamingComponentSchema,ResolvedLayoutSchema,LayoutCacheSchema,EnhancedLayoutContextSchema}from"./schemas/layout.js";export{EnhancedLayoutResolver as LayoutSystem}from"./core/layout/enhanced-layout-resolver.js";export{createEnhancedLayoutResolver as createLayoutSystem}from"./core/layout/enhanced-layout-resolver.js";export const LAYOUT_SYSTEM_VERSION=`1.0.0`;export const LAYOUT_SYSTEM_FEATURES={DISCOVERY:!0,DATA_LOADING:!0,CONDITIONAL_RENDERING:!0,COMPOSITION_CONTROL:!0,PERSISTENT_ISLANDS:!0,ERROR_BOUNDARIES:!0,STREAMING:!0,CACHING:!0,PERFORMANCE_MONITORING:!0,DEBUG_UTILITIES:!0};export const LAYOUT_SYSTEM_DEFAULTS={DISCOVERY:{baseDirectory:`src/pages`,filePattern:`_layout.tsx`,excludeDirectories:[`node_modules`,`.git`,`dist`],enableWatching:!1,developmentMode:!1},CACHING:{enabled:!0,ttl:3e5,maxSize:100,cleanupInterval:6e4},STREAMING:{enabled:!0,priority:`medium`,timeout:5e3},ERROR_BOUNDARIES:{enabled:!0,maxRetries:3,fallbackStrategy:`component`},PERFORMANCE:{monitoring:!0,thresholds:{discoveryTime:100,dataLoadingTime:500,renderingTime:200,totalTime:1e3}}};
1
+ export{createEnhancedLayoutResolver,EnhancedLayoutResolver,EnhancedLayoutResolverUtils}from"./core/layout/enhanced-layout-resolver.js";export{LayoutComposer}from"./core/layout/layout-composer.js";export{defaultLayoutDataLoader,getParentLayoutData,LayoutDataLoader,LayoutDataLoadingError,loadSingleLayoutData,mergeLayoutData}from"./core/layout/layout-data-loader.js";export{LayoutDiscovery}from"./core/layout/layout-discovery.js";export{BuiltInLayoutRules,LayoutMatcher as LayoutMatcherClass}from"./core/layout/layout-matcher.js";export{LayoutCacheManager}from"./core/layout/layout-cache-manager.js";export{EnhancedLayoutContextSchema,ErrorRecoveryStrategySchema,IslandStateSchema,LayoutCacheSchema,LayoutConfigSchema,LayoutContextSchema,LayoutDataSchema,LayoutDiscoveryOptionsSchema,LayoutErrorBoundaryPropsSchema,LayoutErrorInfoSchema,LayoutHandlerSchema,LayoutPropsSchema,LayoutRouteSchema,LayoutRuleSchema,PersistentIslandContextSchema,PersistentIslandPropsSchema,ResolvedLayoutSchema,RouteInfoSchema,StreamingComponentSchema,StreamingLayoutPropsSchema}from"./schemas/layout.js";export{createEnhancedLayoutResolver as createLayoutSystem,EnhancedLayoutResolver as LayoutSystem}from"./core/layout/enhanced-layout-resolver.js";export const LAYOUT_SYSTEM_VERSION=`1.0.0`;export const LAYOUT_SYSTEM_FEATURES={DISCOVERY:!0,DATA_LOADING:!0,CONDITIONAL_RENDERING:!0,COMPOSITION_CONTROL:!0,PERSISTENT_ISLANDS:!0,ERROR_BOUNDARIES:!0,STREAMING:!0,CACHING:!0,PERFORMANCE_MONITORING:!0,DEBUG_UTILITIES:!0};export const LAYOUT_SYSTEM_DEFAULTS={DISCOVERY:{baseDirectory:`src/pages`,filePattern:`_layout.tsx`,excludeDirectories:[`node_modules`,`.git`,`dist`],enableWatching:!1,developmentMode:!1},CACHING:{enabled:!0,ttl:3e5,maxSize:100,cleanupInterval:6e4},STREAMING:{enabled:!0,priority:`medium`,timeout:5e3},ERROR_BOUNDARIES:{enabled:!0,maxRetries:3,fallbackStrategy:`component`},PERFORMANCE:{monitoring:!0,thresholds:{discoveryTime:100,dataLoadingTime:500,renderingTime:200,totalTime:1e3}}};
@@ -177,6 +177,19 @@ export interface AvalonNitroConfig {
177
177
  /** Write `/about` as `/about/index.html` @default true */
178
178
  autoSubfolderIndex?: boolean;
179
179
  };
180
+ /**
181
+ * Path to the client entry file, relative to the project root.
182
+ * Used by the auto-generated renderer to import client assets.
183
+ * @default "app/entry-client" (or "src/entry-client")
184
+ */
185
+ clientEntry?: string;
186
+ /**
187
+ * Global CSS files to include in the client entry.
188
+ * Paths are relative to the project root.
189
+ * Layout CSS is auto-discovered — this is for additional global stylesheets.
190
+ * @example ["app/shared/styles/main.css"]
191
+ */
192
+ globalCSS?: string[];
180
193
  }
181
194
  /**
182
195
  * Nitro configuration output structure
@@ -25,8 +25,8 @@
25
25
  *
26
26
  * Requirements: 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 5.1, 5.3, 9.1, 9.2, 9.3, 9.4, 10.5
27
27
  */
28
- import type { NitroRenderContext, SSRRenderOptions, SSRRenderResult, PageModule, AvalonRuntimeConfig, HttpError } from './types.ts';
29
- import type { H3Event } from 'h3';
28
+ import type { H3Event } from "h3";
29
+ import type { AvalonRuntimeConfig, HttpError, NitroRenderContext, PageModule, SSRRenderOptions, SSRRenderResult } from "./types.ts";
30
30
  /**
31
31
  * Resolved page route information
32
32
  */
@@ -43,9 +43,9 @@ export interface ResolvedPageRoute {
43
43
  /**
44
44
  * Render handler options
45
45
  *
46
- * Simplified for Nitro's catch-all pattern - route resolution is now
47
- * handled by Nitro's file-system routing, so custom resolvers are optional
48
- * and primarily used for development/testing scenarios.
46
+ * Route resolution is handled by Nitro's file-system routing.
47
+ * Custom resolvers are optional and primarily used for
48
+ * development/testing scenarios.
49
49
  */
50
50
  export interface RenderHandlerOptions {
51
51
  /** Avalon runtime configuration */
@@ -94,6 +94,12 @@ export interface RenderHandlerOptions {
94
94
  * @returns NitroRenderContext for use in rendering
95
95
  */
96
96
  export declare function createRenderContext(event: H3Event, params?: Record<string, string>): NitroRenderContext;
97
+ /**
98
+ * Creates a render context directly from a web Request.
99
+ * Used by the `.fetch()` wrapper to avoid h3 event conversion issues
100
+ * when Nitro's SSR dispatcher passes a plain Request.
101
+ */
102
+ export declare function createRenderContextFromRequest(request: Request, params?: Record<string, string>): NitroRenderContext;
97
103
  /**
98
104
  * Gets the request URL from an H3 event
99
105
  */
@@ -105,7 +111,7 @@ export declare function toRequest(event: H3Event): Request;
105
111
  /**
106
112
  * Gets request headers from an H3 event
107
113
  */
108
- export declare function getRequestHeaders(event: H3Event): Headers;
114
+ export declare function getRequestHeaders(_event: H3Event): Headers;
109
115
  /**
110
116
  * Sets a response header on an H3 event
111
117
  */
@@ -208,7 +214,7 @@ export declare function processHydrationRequirements(html: string, isDev: boolea
208
214
  * @param options - Render options
209
215
  * @returns SSR render result
210
216
  */
211
- export declare function renderPage(pageModule: PageModule, context: NitroRenderContext, options?: SSRRenderOptions, wrapWithLayouts?: RenderHandlerOptions['wrapWithLayouts']): Promise<SSRRenderResult>;
217
+ export declare function renderPage(pageModule: PageModule, context: NitroRenderContext, options?: SSRRenderOptions, wrapWithLayouts?: RenderHandlerOptions["wrapWithLayouts"]): Promise<SSRRenderResult>;
212
218
  /**
213
219
  * Extended streaming options with additional callbacks
214
220
  */
@@ -274,7 +280,9 @@ export declare function createStreamingResponse(stream: ReadableStream<Uint8Arra
274
280
  * @param options - Render handler options
275
281
  * @returns Handler function for Nitro
276
282
  */
277
- export declare function createNitroRenderer(options: RenderHandlerOptions): (event: H3Event) => Promise<Response>;
283
+ export declare function createNitroRenderer(options: RenderHandlerOptions): ((event: H3Event) => Promise<Response>) & {
284
+ fetch(request: Request): Promise<Response>;
285
+ };
278
286
  /**
279
287
  * Options for the Nitro catch-all renderer
280
288
  */
@@ -292,7 +300,7 @@ export interface NitroCatchAllOptions {
292
300
  /** Optional layout resolver */
293
301
  resolveLayouts?: (routePath: string, config: AvalonRuntimeConfig) => Promise<string[]>;
294
302
  /** Wrap rendered page HTML with layout components (same as RenderHandlerOptions) */
295
- wrapWithLayouts?: RenderHandlerOptions['wrapWithLayouts'];
303
+ wrapWithLayouts?: RenderHandlerOptions["wrapWithLayouts"];
296
304
  /**
297
305
  * Enable custom error pages (404.tsx, 500.tsx, _error.tsx)
298
306
  * When enabled, the renderer will look for custom error pages in the pages directory
@@ -337,7 +345,9 @@ export interface NitroCatchAllOptions {
337
345
  * @param options - Catch-all renderer options
338
346
  * @returns Nitro event handler function
339
347
  */
340
- export declare function createNitroCatchAllRenderer(options: NitroCatchAllOptions): (event: H3Event) => Promise<Response>;
348
+ export declare function createNitroCatchAllRenderer(options: NitroCatchAllOptions): ((event: H3Event) => Promise<Response>) & {
349
+ fetch(request: Request): Promise<Response>;
350
+ };
341
351
  /**
342
352
  * Re-export middleware cache clearing for hot reload support
343
353
  *
@@ -352,4 +362,4 @@ export declare function createNitroCatchAllRenderer(options: NitroCatchAllOption
352
362
  * }
353
363
  * ```
354
364
  */
355
- export { clearMiddlewareCache as clearRendererMiddlewareCache } from '../middleware/index.ts';
365
+ export { clearMiddlewareCache as clearRendererMiddlewareCache } from "../middleware/index.ts";