@useavalon/avalon 0.1.23 → 0.1.24

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 (114) hide show
  1. package/dist/mod.d.ts +50 -0
  2. package/dist/src/build/integration-bundler-plugin.d.ts +25 -0
  3. package/dist/src/build/integration-config.d.ts +44 -0
  4. package/dist/src/build/integration-detection-plugin.d.ts +20 -0
  5. package/dist/src/build/integration-resolver-plugin.d.ts +10 -0
  6. package/dist/src/build/island-manifest.d.ts +57 -0
  7. package/dist/src/build/island-types-generator.d.ts +49 -0
  8. package/dist/src/build/mdx-island-transform.d.ts +23 -0
  9. package/dist/src/build/mdx-plugin.d.ts +36 -0
  10. package/dist/src/build/page-island-transform.d.ts +41 -0
  11. package/dist/src/build/prop-extractors/index.d.ts +8 -0
  12. package/dist/src/build/prop-extractors/lit.d.ts +11 -0
  13. package/dist/src/build/prop-extractors/qwik.d.ts +9 -0
  14. package/dist/src/build/prop-extractors/solid.d.ts +12 -0
  15. package/dist/src/build/prop-extractors/svelte.d.ts +13 -0
  16. package/dist/src/build/prop-extractors/vue.d.ts +19 -0
  17. package/dist/src/build/sidecar-file-manager.d.ts +23 -0
  18. package/dist/src/build/sidecar-renderer.d.ts +22 -0
  19. package/dist/src/client/adapters/index.d.ts +15 -0
  20. package/dist/src/client/components.d.ts +21 -0
  21. package/dist/src/client/css-hmr-handler.d.ts +94 -0
  22. package/dist/src/client/framework-adapter.d.ts +225 -0
  23. package/dist/src/client/hmr-coordinator.d.ts +88 -0
  24. package/dist/src/components/Image.d.ts +61 -0
  25. package/dist/src/components/IslandErrorBoundary.d.ts +37 -0
  26. package/dist/src/components/IslandErrorBoundary.js +1 -1
  27. package/dist/src/components/LayoutDataErrorBoundary.d.ts +34 -0
  28. package/dist/src/components/LayoutDataErrorBoundary.js +1 -1
  29. package/dist/src/components/LayoutErrorBoundary.d.ts +25 -0
  30. package/dist/src/components/LayoutErrorBoundary.js +1 -1
  31. package/dist/src/components/PersistentIsland.d.ts +36 -0
  32. package/dist/src/components/StreamingErrorBoundary.d.ts +42 -0
  33. package/dist/src/components/StreamingErrorBoundary.js +1 -1
  34. package/dist/src/components/StreamingLayout.d.ts +83 -0
  35. package/dist/src/components/StreamingLayout.js +1 -1
  36. package/dist/src/core/components/component-analyzer.d.ts +48 -0
  37. package/dist/src/core/components/component-detection.d.ts +72 -0
  38. package/dist/src/core/components/enhanced-framework-detector.d.ts +78 -0
  39. package/dist/src/core/components/framework-registry.d.ts +114 -0
  40. package/dist/src/core/content/mdx-processor.d.ts +14 -0
  41. package/dist/src/core/integrations/index.d.ts +6 -0
  42. package/dist/src/core/integrations/loader.d.ts +35 -0
  43. package/dist/src/core/integrations/registry.d.ts +51 -0
  44. package/dist/src/core/islands/island-persistence.d.ts +74 -0
  45. package/dist/src/core/islands/island-state-serializer.d.ts +53 -0
  46. package/dist/src/core/islands/persistent-island-context.d.ts +36 -0
  47. package/dist/src/core/islands/use-persistent-state.d.ts +17 -0
  48. package/dist/src/core/layout/enhanced-layout-resolver.d.ts +73 -0
  49. package/dist/src/core/layout/layout-cache-manager.d.ts +66 -0
  50. package/dist/src/core/layout/layout-composer.d.ts +63 -0
  51. package/dist/src/core/layout/layout-data-loader.d.ts +146 -0
  52. package/dist/src/core/layout/layout-discovery.d.ts +51 -0
  53. package/dist/src/core/layout/layout-matcher.d.ts +77 -0
  54. package/dist/src/core/layout/layout-types.d.ts +94 -0
  55. package/dist/src/core/modules/framework-module-resolver.d.ts +85 -0
  56. package/dist/src/islands/component-analysis.d.ts +38 -0
  57. package/dist/src/islands/css-utils.d.ts +81 -0
  58. package/dist/src/islands/discovery/index.d.ts +16 -0
  59. package/dist/src/islands/discovery/registry.d.ts +141 -0
  60. package/dist/src/islands/discovery/resolver.d.ts +190 -0
  61. package/dist/src/islands/discovery/scanner.d.ts +55 -0
  62. package/dist/src/islands/discovery/types.d.ts +92 -0
  63. package/dist/src/islands/discovery/validator.d.ts +89 -0
  64. package/dist/src/islands/discovery/watcher.d.ts +95 -0
  65. package/dist/src/islands/framework-detection.d.ts +53 -0
  66. package/dist/src/islands/integration-loader.d.ts +139 -0
  67. package/dist/src/islands/island.d.ts +55 -0
  68. package/dist/src/islands/render-cache.d.ts +203 -0
  69. package/dist/src/islands/types.d.ts +63 -0
  70. package/dist/src/islands/universal-css-collector.d.ts +41 -0
  71. package/dist/src/islands/universal-head-collector.d.ts +42 -0
  72. package/dist/src/layout-system.d.ts +92 -592
  73. package/dist/src/middleware/discovery.d.ts +70 -0
  74. package/dist/src/middleware/executor.d.ts +52 -0
  75. package/dist/src/middleware/index.d.ts +43 -0
  76. package/dist/src/middleware/types.d.ts +89 -0
  77. package/dist/src/nitro/build-config.d.ts +163 -0
  78. package/dist/src/nitro/config.d.ts +268 -0
  79. package/dist/src/nitro/error-handler.d.ts +151 -0
  80. package/dist/src/nitro/index.d.ts +15 -0
  81. package/dist/src/nitro/island-manifest.d.ts +191 -0
  82. package/dist/src/nitro/middleware-adapter.d.ts +151 -0
  83. package/dist/src/nitro/renderer.d.ts +342 -0
  84. package/dist/src/nitro/route-discovery.d.ts +142 -0
  85. package/dist/src/nitro/types.d.ts +278 -0
  86. package/dist/src/render/collect-css.d.ts +28 -0
  87. package/dist/src/render/error-pages.d.ts +14 -0
  88. package/dist/src/render/isolated-ssr-renderer.d.ts +127 -0
  89. package/dist/src/render/ssr.d.ts +56 -0
  90. package/dist/src/schemas/api.d.ts +27 -0
  91. package/dist/src/schemas/core.d.ts +75 -0
  92. package/dist/src/schemas/index.d.ts +79 -0
  93. package/dist/src/schemas/index.js +1 -1
  94. package/dist/src/schemas/layout.d.ts +282 -0
  95. package/dist/src/schemas/routing/index.d.ts +181 -0
  96. package/dist/src/schemas/routing.d.ts +388 -0
  97. package/dist/src/types/as-island.d.ts +17 -0
  98. package/dist/src/types/layout.d.ts +177 -0
  99. package/dist/src/types/routing.d.ts +297 -0
  100. package/dist/src/types/types.d.ts +6 -0
  101. package/dist/src/utils/dev-logger.d.ts +84 -0
  102. package/dist/src/utils/fs.d.ts +41 -0
  103. package/dist/src/vite-plugin/auto-discover.d.ts +72 -0
  104. package/dist/src/vite-plugin/config.d.ts +82 -0
  105. package/dist/src/vite-plugin/errors.d.ts +62 -0
  106. package/dist/src/vite-plugin/image-optimization.d.ts +36 -0
  107. package/dist/src/vite-plugin/integration-activator.d.ts +48 -0
  108. package/dist/src/vite-plugin/island-sidecar-plugin.d.ts +17 -0
  109. package/dist/src/vite-plugin/module-discovery.d.ts +66 -0
  110. package/dist/src/vite-plugin/nitro-integration.d.ts +56 -0
  111. package/dist/src/vite-plugin/plugin.d.ts +51 -0
  112. package/dist/src/vite-plugin/types.d.ts +281 -0
  113. package/dist/src/vite-plugin/validation.d.ts +93 -0
  114. package/package.json +33 -9
package/dist/mod.d.ts ADDED
@@ -0,0 +1,50 @@
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 { clearCache, clearIslandCache, invalidateCacheForPath, invalidateCacheForFile, getCacheStats, logCacheStats, configureCache, getCacheConfig, } from './src/islands/render-cache.ts';
12
+ export type { CacheConfig as IslandCacheConfig, CacheStats as IslandCacheStats } from './src/islands/render-cache.ts';
13
+ 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';
14
+ export type { IslandDirectory, DiscoveredIsland, IslandCollision, IslandChangeEvent, IslandFileExtension, IslandDiscoveryConfig, ResolutionResult, ImportPathOptions, ValidationResult, ValidationError, ValidationWarning, CircularDependency, IslandChangeCallback, IslandWatcherOptions, } from './src/islands/discovery/index.ts';
15
+ export { loadIntegration, detectAndLoadIntegration, preloadIntegrations, detectFrameworksFromPageContent, DEFAULT_PRELOAD_FRAMEWORKS, } from './src/islands/integration-loader.ts';
16
+ export type { PreloadIntegrationsOptions } from './src/islands/integration-loader.ts';
17
+ export { registry as integrationRegistry } from './src/core/integrations/registry.ts';
18
+ export type { Integration, RenderParams as IntegrationRenderParams, RenderResult, IntegrationConfig, } from '@useavalon/core';
19
+ export { generateIslandManifest, loadIslandManifest, getIslandBundlePath } from './src/build/island-manifest.ts';
20
+ export type { IslandManifest, IslandEntry, ExtendedIslandManifest, ExtendedIslandEntry, } from './src/build/island-manifest.ts';
21
+ export { mdxIslandTransform } from './src/build/mdx-island-transform.ts';
22
+ export type { MDXIslandTransformOptions } from './src/build/mdx-island-transform.ts';
23
+ export { pageIslandTransform } from './src/build/page-island-transform.ts';
24
+ export type { PageIslandTransformOptions } from './src/build/page-island-transform.ts';
25
+ export type { IslandDirective } from './src/types/island-prop.d.ts';
26
+ export { asIsland } from './src/types/as-island.ts';
27
+ export { generateIslandTypes, watchAndGenerateTypes } from './src/build/island-types-generator.ts';
28
+ export type { IslandTypeGeneratorOptions, TypeGenerationResult } from './src/build/island-types-generator.ts';
29
+ export declare function build(_options?: Record<string, unknown>): Promise<void>;
30
+ export { discoverScopedMiddleware, executeScopedMiddleware, clearMiddlewareCache, invalidateMiddleware, getMatchingMiddleware, clearDiscoveryCache, hasContextValue, getContextValue, setContextValue, getMiddlewareCacheSize, } from './src/middleware/index.ts';
31
+ export type { MiddlewareHandler, MiddlewareFileExport, MiddlewareRoute, MiddlewareDiscoveryOptions, MiddlewareExecutorOptions, } from './src/middleware/types.ts';
32
+ export * from './src/layout-system.ts';
33
+ export type { RenderOptions, MetaTag, ScriptConfig } from './src/schemas/core.ts';
34
+ export type { ApiRoute, ApiMethod } from './src/schemas/api.ts';
35
+ export type { MiddlewareContext } from './src/nitro/middleware-adapter.ts';
36
+ export type { LayoutDataLoadingResult, LayoutDataLoadingOptions } from './src/core/layout/layout-data-loader.ts';
37
+ export type { EnhancedLayoutResolverOptions } from './src/core/layout/enhanced-layout-resolver.ts';
38
+ export type { CacheEntry, CacheStats, CacheConfig } from './src/core/layout/layout-cache-manager.ts';
39
+ export type { LayoutProps, LayoutContext, LayoutData, LayoutRoute, LayoutHandler, LayoutDiscoveryOptions, LayoutConfig, RouteInfo, LayoutRule, LayoutLoader, ResolvedLayout, LayoutCache, LayoutErrorInfo } from './src/core/layout/layout-types.ts';
40
+ export type { EnhancedLayoutContext, IslandState, PersistentIslandProps, PersistentIslandContext, IslandStateSaver, IslandStateLoader, IslandStateClearer, LayoutErrorBoundaryProps, ErrorRecoveryStrategy, LayoutErrorHandler, LayoutRetryFunction, LayoutFallbackRenderer, StreamingLayoutProps, StreamingComponent, StreamingReadyCheck, LayoutMatcherFunction, } from './src/schemas/layout.ts';
41
+ export { IslandPersistence, defaultIslandPersistence } from './src/core/islands/island-persistence.ts';
42
+ export { IslandStateSerializer } from './src/core/islands/island-state-serializer.ts';
43
+ export { createPersistentIslandContext, usePersistentIslandContext, PersistentIslandProvider, } from './src/core/islands/persistent-island-context.tsx';
44
+ export { PersistentIsland } from './src/components/PersistentIsland.tsx';
45
+ export { usePersistentState } from './src/core/islands/use-persistent-state.ts';
46
+ export { LayoutErrorBoundary } from './src/components/LayoutErrorBoundary.tsx';
47
+ export { LayoutDataErrorBoundary } from './src/components/LayoutDataErrorBoundary.tsx';
48
+ export { IslandErrorBoundary, withIslandErrorBoundary } from './src/components/IslandErrorBoundary.tsx';
49
+ export { StreamingErrorBoundary, withStreamingErrorBoundary } from './src/components/StreamingErrorBoundary.tsx';
50
+ 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';
@@ -0,0 +1,25 @@
1
+ import type { Plugin } from 'vite';
2
+ export interface IntegrationBundlerOptions {
3
+ /** Integrations to include in the build */
4
+ integrations: string[];
5
+ /** Whether to bundle for SSR */
6
+ ssr?: boolean;
7
+ }
8
+ /**
9
+ * Vite plugin to bundle integration packages
10
+ * Ensures integration server and client code is properly bundled
11
+ */
12
+ export declare function integrationBundlerPlugin(options: IntegrationBundlerOptions): Plugin;
13
+ /**
14
+ * Get external dependencies for integration bundling
15
+ * These should not be bundled but loaded from node_modules
16
+ */
17
+ export declare function getIntegrationExternals(framework: string, ssr: boolean): string[];
18
+ /**
19
+ * Configure optimization for integration dependencies
20
+ */
21
+ export declare function getIntegrationOptimizeDeps(integrations: string[]): string[];
22
+ /**
23
+ * Get SSR noExternal packages for integrations
24
+ */
25
+ export declare function getIntegrationSSRNoExternal(integrations: string[]): string[];
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Integration configuration for build system
3
+ * Defines how each integration should be bundled and optimized
4
+ */
5
+ export interface IntegrationBuildConfig {
6
+ /** Framework name */
7
+ name: string;
8
+ /** File extensions this integration handles */
9
+ extensions: string[];
10
+ /** NPM packages that should be optimized for this integration */
11
+ optimizeDeps: string[];
12
+ /** NPM packages that should be external in SSR builds */
13
+ ssrExternal: string[];
14
+ /** NPM packages that should NOT be external in SSR builds */
15
+ ssrNoExternal: string[];
16
+ /** Whether this integration requires a Vite plugin */
17
+ requiresPlugin: boolean;
18
+ /** Plugin package name (if requiresPlugin is true) */
19
+ pluginPackage?: string;
20
+ }
21
+ /**
22
+ * Build configuration for all supported integrations
23
+ */
24
+ export declare const INTEGRATION_BUILD_CONFIGS: Record<string, IntegrationBuildConfig>;
25
+ /**
26
+ * Get build configuration for a specific integration
27
+ */
28
+ export declare function getIntegrationBuildConfig(framework: string): IntegrationBuildConfig;
29
+ /**
30
+ * Get all optimize deps for given integrations
31
+ */
32
+ export declare function getOptimizeDepsForIntegrations(integrations: string[]): string[];
33
+ /**
34
+ * Get SSR noExternal packages for given integrations
35
+ */
36
+ export declare function getSSRNoExternalForIntegrations(integrations: string[]): string[];
37
+ /**
38
+ * Check if an integration requires a Vite plugin
39
+ */
40
+ export declare function integrationRequiresPlugin(framework: string): boolean;
41
+ /**
42
+ * Get plugin package name for an integration
43
+ */
44
+ export declare function getIntegrationPluginPackage(framework: string): string;
@@ -0,0 +1,20 @@
1
+ import type { Plugin } from 'vite';
2
+ export interface IntegrationDetectionResult {
3
+ preact: boolean;
4
+ vue: boolean;
5
+ solid: boolean;
6
+ svelte: boolean;
7
+ }
8
+ /**
9
+ * Vite plugin to detect which framework integrations are used in the project
10
+ * This enables tree-shaking of unused integrations
11
+ */
12
+ export declare function integrationDetectionPlugin(): Plugin;
13
+ /**
14
+ * Detect which framework integrations are actually used in the project
15
+ */
16
+ export declare function detectUsedIntegrations(): Promise<IntegrationDetectionResult>;
17
+ /**
18
+ * Get list of integration packages that should be included in the build
19
+ */
20
+ export declare function getRequiredIntegrations(detected: IntegrationDetectionResult): string[];
@@ -0,0 +1,10 @@
1
+ import type { Plugin } from 'vite';
2
+ /**
3
+ * Vite plugin to resolve integration package imports
4
+ * Handles both @useavalon/integration-* imports and relative imports within integrations
5
+ */
6
+ export declare function integrationResolverPlugin(): Plugin;
7
+ /**
8
+ * Create alias configuration for integration imports
9
+ */
10
+ export declare function createIntegrationAliases(): Record<string, string>;
@@ -0,0 +1,57 @@
1
+ import { type IslandDirectory, type IslandCollision } from '../islands/discovery/index.ts';
2
+ export interface IslandManifest {
3
+ islands: Record<string, IslandEntry>;
4
+ version: string;
5
+ buildTime: number;
6
+ }
7
+ /**
8
+ * Extended island manifest with nested islands support
9
+ */
10
+ export interface ExtendedIslandManifest extends IslandManifest {
11
+ /** All discovered island directories */
12
+ directories: IslandDirectory[];
13
+ /** Detected naming collisions */
14
+ collisions: IslandCollision[];
15
+ }
16
+ export interface IslandEntry {
17
+ /** Original source path */
18
+ src: string;
19
+ /** Built bundle path */
20
+ bundle: string;
21
+ /** Bundle hash for cache busting */
22
+ hash: string;
23
+ /** Framework type (preact, solid, vue, svelte, vanilla, lit, react) */
24
+ framework: 'preact' | 'solid' | 'vue' | 'svelte' | 'vanilla' | 'lit' | 'react' | 'unknown';
25
+ /** Import dependencies */
26
+ deps: string[];
27
+ }
28
+ /**
29
+ * Extended island entry with namespace support
30
+ */
31
+ export interface ExtendedIslandEntry extends IslandEntry {
32
+ /** Namespace for the island (empty string for default directory) */
33
+ namespace: string;
34
+ /** Qualified name including namespace (e.g., "modules/auth/Counter") */
35
+ qualifiedName: string;
36
+ /** Original directory path */
37
+ sourceDirectory: string;
38
+ }
39
+ /**
40
+ * Generate island manifest during build using the nested islands discovery service.
41
+ * Discovers all islands across all directories and generates manifest entries
42
+ * with namespace and qualified name support.
43
+ */
44
+ export declare function generateIslandManifest(): Promise<ExtendedIslandManifest>;
45
+ /**
46
+ * Load island manifest (for production)
47
+ */
48
+ export declare function loadIslandManifest(): Promise<ExtendedIslandManifest | null>;
49
+ /**
50
+ * Get bundle path for an island (development vs production)
51
+ * Supports both simple names and qualified names (namespace/name)
52
+ */
53
+ export declare function getIslandBundlePath(src: string, manifest?: ExtendedIslandManifest | IslandManifest | null): string;
54
+ /**
55
+ * Get island entry by qualified name or simple name
56
+ */
57
+ export declare function getIslandEntry(nameOrQualified: string, manifest: ExtendedIslandManifest | IslandManifest): ExtendedIslandEntry | IslandEntry | null;
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Island Types Generator
3
+ *
4
+ * Generates TypeScript declaration files (.d.ts) for discovered islands.
5
+ * Provides type information including namespace and qualified names for
6
+ * better IDE support and type safety when referencing islands.
7
+ */
8
+ /**
9
+ * Options for type generation
10
+ */
11
+ export interface IslandTypeGeneratorOptions {
12
+ /** Output directory for generated types (default: "src/types") */
13
+ outputDir?: string;
14
+ /** Whether to generate a single file or per-directory files (default: "single") */
15
+ mode?: "single" | "per-directory";
16
+ /** Module name for the generated types (default: "avalon-islands") */
17
+ moduleName?: string;
18
+ /** Whether to include JSDoc comments (default: true) */
19
+ includeJsDoc?: boolean;
20
+ }
21
+ /**
22
+ * Result of type generation
23
+ */
24
+ export interface TypeGenerationResult {
25
+ /** Whether generation was successful */
26
+ success: boolean;
27
+ /** Generated file paths */
28
+ files: string[];
29
+ /** Number of islands typed */
30
+ islandCount: number;
31
+ /** Any errors that occurred */
32
+ errors: string[];
33
+ }
34
+ /**
35
+ * Generate TypeScript declaration files for all discovered islands.
36
+ *
37
+ * @param projectRoot - The root directory of the project
38
+ * @param options - Options for type generation
39
+ * @returns Result of the type generation
40
+ */
41
+ export declare function generateIslandTypes(projectRoot: string, options?: IslandTypeGeneratorOptions): Promise<TypeGenerationResult>;
42
+ /**
43
+ * Watch for island changes and regenerate types.
44
+ *
45
+ * @param projectRoot - The root directory of the project
46
+ * @param options - Options for type generation
47
+ * @returns Cleanup function to stop watching
48
+ */
49
+ export declare function watchAndGenerateTypes(projectRoot: string, options?: IslandTypeGeneratorOptions): Promise<() => void>;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * MDX Island Transform Plugin
3
+ *
4
+ * Transforms island component usage in MDX files into renderIsland() calls.
5
+ *
6
+ * Supports two patterns:
7
+ * 1. Imports from islands/ directories (legacy pattern)
8
+ * 2. Components used with the `island` prop (preferred pattern)
9
+ *
10
+ * Problem: MDX files import island components directly and render them as raw JSX.
11
+ * After MDX compilation, these become jsxDEV(ComponentName, ...) calls. Preact's
12
+ * renderToString doesn't support async components, so we can't use async wrappers.
13
+ *
14
+ * Solution: Replaces the compiled JSX calls (_jsxDEV(Component, { island: ... }))
15
+ * with await expressions that call renderIsland() directly. This allows proper
16
+ * async SSR rendering of islands in MDX files.
17
+ */
18
+ import type { Plugin } from 'vite';
19
+ export interface MDXIslandTransformOptions {
20
+ islandPathPatterns?: RegExp[];
21
+ verbose?: boolean;
22
+ }
23
+ export declare function mdxIslandTransform(options?: MDXIslandTransformOptions): Plugin;
@@ -0,0 +1,36 @@
1
+ import type { Plugin } from 'vite';
2
+ import type { Pluggable } from 'unified';
3
+ export interface MDXPluginOptions {
4
+ remarkPlugins?: Pluggable[];
5
+ rehypePlugins?: Pluggable[];
6
+ development?: boolean;
7
+ jsxImportSource?: string;
8
+ /** Enable syntax highlighting via rehype-highlight (default: true) */
9
+ syntaxHighlighting?: boolean;
10
+ }
11
+ /**
12
+ * Creates and configures the MDX Vite plugin
13
+ *
14
+ * This function sets up the MDX plugin with:
15
+ * - Frontmatter processing (remark-frontmatter, remark-mdx-frontmatter)
16
+ * - GitHub Flavored Markdown support (remark-gfm)
17
+ * - Syntax highlighting (rehype-highlight) - enabled by default
18
+ * - Custom remark/rehype plugins
19
+ * - JSX runtime configuration
20
+ *
21
+ * @param options - MDX plugin configuration options
22
+ * @returns Array of Vite plugins (empty if MDX dependencies are not available)
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * // Basic usage with defaults
27
+ * const plugins = await createMDXPlugin();
28
+ *
29
+ * // With React JSX runtime
30
+ * const plugins = await createMDXPlugin({ jsxImportSource: 'react' });
31
+ *
32
+ * // Disable syntax highlighting
33
+ * const plugins = await createMDXPlugin({ syntaxHighlighting: false });
34
+ * ```
35
+ */
36
+ export declare function createMDXPlugin(options?: MDXPluginOptions): Promise<Plugin[]>;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Page Island Transform Plugin
3
+ *
4
+ * Transforms components with an `island` prop in TSX/JSX page files so that developers
5
+ * can use any component as an island by simply adding the `island` prop.
6
+ *
7
+ * Before (manual):
8
+ * import { renderIsland } from '@useavalon/avalon';
9
+ * {await renderIsland({ src: '/src/components/Counter.tsx', condition: 'on:interaction', framework: 'preact' })}
10
+ *
11
+ * After (auto-wrapped):
12
+ * import Counter from '../components/Counter.tsx';
13
+ * <Counter island={{ condition: 'on:interaction' }} someProp={42} />
14
+ *
15
+ * How it works:
16
+ * The plugin rewrites each `<Component island={opts} ...props />` JSX usage
17
+ * into an `{await renderIsland({...})}` expression inline in the JSX.
18
+ * Any component can be an island - no special directory required.
19
+ *
20
+ * Preact's renderToString does NOT support async child components in the JSX
21
+ * tree, so we cannot use async wrapper functions. Instead we directly replace
22
+ * the JSX element with an await expression.
23
+ *
24
+ * Only applies to files inside the configured pages or layouts directories.
25
+ */
26
+ import type { Plugin } from 'vite';
27
+ export interface PageIslandTransformOptions {
28
+ /** Directory containing page files (default: src/pages/) */
29
+ pagesDir?: string;
30
+ /** Directory containing layout files (default: src/layouts/) */
31
+ layoutsDir?: string;
32
+ /** Modules configuration for modular architecture */
33
+ modules?: {
34
+ dir: string;
35
+ pagesDirName: string;
36
+ layoutsDirName: string;
37
+ } | null;
38
+ /** Whether to enable verbose logging */
39
+ verbose?: boolean;
40
+ }
41
+ export declare function pageIslandTransform(options?: PageIslandTransformOptions): Plugin;
@@ -0,0 +1,8 @@
1
+ export { type PropExtractionResult, FALLBACK_PROPS, extractVueProps } from "./vue.ts";
2
+ export { extractSvelteProps } from "./svelte.ts";
3
+ export { extractLitProps } from "./lit.ts";
4
+ export { extractSolidProps } from "./solid.ts";
5
+ export { extractQwikProps } from "./qwik.ts";
6
+ import type { PropExtractionResult } from "./vue.ts";
7
+ /** Maps framework name to its prop extractor function */
8
+ export declare const EXTRACTOR_MAP: Record<string, (source: string) => PropExtractionResult>;
@@ -0,0 +1,11 @@
1
+ import { type PropExtractionResult } from "./vue.ts";
2
+ /**
3
+ * Extract props from a Lit element source string.
4
+ *
5
+ * Parses `static properties = { ... }` blocks and maps Lit type
6
+ * constructors to TypeScript types. Properties with `state: true`
7
+ * are excluded (internal state, not public props).
8
+ *
9
+ * Never throws — returns fallback on any failure.
10
+ */
11
+ export declare function extractLitProps(source: string): PropExtractionResult;
@@ -0,0 +1,9 @@
1
+ import type { PropExtractionResult } from "./vue.ts";
2
+ /**
3
+ * Extract props type from a Qwik component file.
4
+ * Qwik components use component$(() => ...) — props are typed via the
5
+ * generic parameter or a Props interface. For now we fall back to
6
+ * Record<string, unknown> since Qwik's JSX types aren't Preact-compatible
7
+ * and the sidecar just needs to expose the island prop.
8
+ */
9
+ export declare function extractQwikProps(_source: string): PropExtractionResult;
@@ -0,0 +1,12 @@
1
+ import { type PropExtractionResult } from "./vue.ts";
2
+ /**
3
+ * Extract props from a Solid component source string.
4
+ *
5
+ * Supports two patterns:
6
+ * 1. `export default function Name(props: { ... })` — named function export
7
+ * 2. `export default (props: { ... }) =>` — arrow function export
8
+ *
9
+ * Uses brace-counting to handle nested types in the props parameter.
10
+ * Never throws — returns fallback on any failure.
11
+ */
12
+ export declare function extractSolidProps(source: string): PropExtractionResult;
@@ -0,0 +1,13 @@
1
+ import { type PropExtractionResult } from "./vue.ts";
2
+ /**
3
+ * Extract props from a Svelte component source string.
4
+ *
5
+ * Supports three patterns:
6
+ * 1. `let { ... }: { ... } = $props()` — inline type literal
7
+ * 2. `let { ... }: TypeName = $props()` or `let name: TypeName = $props()`
8
+ * — named type resolved from an interface/type declaration in the script block
9
+ * 3. `export let name: type` — Svelte 4 style, collected into a type literal
10
+ *
11
+ * Never throws — returns fallback on any failure.
12
+ */
13
+ export declare function extractSvelteProps(source: string): PropExtractionResult;
@@ -0,0 +1,19 @@
1
+ /** Result of prop extraction */
2
+ export interface PropExtractionResult {
3
+ /** The TypeScript type literal for props, e.g. "{ count?: number }" */
4
+ propsType: string;
5
+ /** Whether extraction succeeded or fell back */
6
+ fallback: boolean;
7
+ }
8
+ /** Fallback props type used when extraction fails or no props are found */
9
+ export declare const FALLBACK_PROPS = "Record<string, unknown>";
10
+ /**
11
+ * Extract props from a Vue SFC source string.
12
+ *
13
+ * Looks for `defineProps<{...}>()` inside a `<script setup>` or
14
+ * `<script setup lang="ts">` block. Uses brace-counting to handle
15
+ * nested types within the angle brackets.
16
+ *
17
+ * Never throws — returns fallback on any failure.
18
+ */
19
+ export declare function extractVueProps(source: string): PropExtractionResult;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Compute the sidecar declaration file path for a given island file path.
3
+ *
4
+ * For simple extensions like `.vue`, the sidecar is `Name.d.vue.ts`.
5
+ * For compound extensions like `.lit.ts`, the sidecar is `Name.d.lit.ts`.
6
+ * For `.solid.tsx`, the sidecar is `Name.d.solid.tsx.ts`.
7
+ */
8
+ export declare function getSidecarPath(islandFilePath: string): string;
9
+ /**
10
+ * Check if a sidecar file is up-to-date by comparing mtimes.
11
+ * Returns `true` if the sidecar exists and is newer than the source file.
12
+ */
13
+ export declare function isSidecarFresh(sourcePath: string, sidecarPath: string): Promise<boolean>;
14
+ /**
15
+ * Write sidecar content only if it differs from the existing file.
16
+ * Returns `true` if a write was performed, `false` if content was already up-to-date.
17
+ */
18
+ export declare function writeSidecarIfChanged(sidecarPath: string, content: string): Promise<boolean>;
19
+ /**
20
+ * Delete a sidecar file if it exists.
21
+ * Returns `true` if a file was deleted, `false` if it didn't exist.
22
+ */
23
+ export declare function deleteSidecar(sidecarPath: string): Promise<boolean>;
@@ -0,0 +1,22 @@
1
+ /** Header comment placed at the top of every generated sidecar file. */
2
+ export declare const SIDECAR_HEADER = "// Auto-generated by avalon \u2014 do not edit";
3
+ /**
4
+ * Render the full content of a sidecar declaration file.
5
+ *
6
+ * Pure function: takes a props type string (e.g. `"{ count: number }"` or
7
+ * `"Record<string, unknown>"`) and returns the complete file content.
8
+ *
9
+ * The `island` prop is always included so the component can be used with
10
+ * `<Component island={{ condition: 'on:interaction' }} />` in page files.
11
+ * The Vite page-island-transform strips it at build time.
12
+ *
13
+ * The output follows this exact template:
14
+ * ```
15
+ * // Auto-generated by avalon — do not edit
16
+ * import type { ComponentType } from 'preact';
17
+ * import type { IslandDirective } from '@useavalon/avalon';
18
+ * declare const component: ComponentType<PROPS & { island?: IslandDirective }>;
19
+ * export default component;
20
+ * ```
21
+ */
22
+ export declare function renderSidecarContent(propsType: string): string;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Framework HMR Adapters
3
+ *
4
+ * HMR adapters have been moved to their respective integration packages:
5
+ * - @useavalon/react/client/hmr
6
+ * - @useavalon/preact/client/hmr
7
+ * - @useavalon/vue/client/hmr
8
+ * - @useavalon/svelte/client/hmr
9
+ * - @useavalon/solid/client/hmr
10
+ * - @useavalon/lit/client/hmr
11
+ * - @useavalon/qwik/client/hmr
12
+ *
13
+ * This barrel re-exports from the base framework adapter for backward compatibility.
14
+ */
15
+ export { BaseFrameworkAdapter, AdapterRegistry, type FrameworkHMRAdapter, type StateSnapshot, } from '../framework-adapter.ts';
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Client-safe component exports for use in island components.
3
+ *
4
+ * Import from '@useavalon/avalon/client' instead of '@useavalon/avalon' when
5
+ * you need framework components inside islands. The main entry point
6
+ * re-exports server-only code (nitro, h3, vite plugins) that can't
7
+ * be bundled for the browser.
8
+ */
9
+ export { PersistentIsland } from '../components/PersistentIsland.tsx';
10
+ export { usePersistentIslandContext, PersistentIslandProvider, createPersistentIslandContext, } from '../core/islands/persistent-island-context.tsx';
11
+ export { usePersistentState } from '../core/islands/use-persistent-state.ts';
12
+ export { IslandPersistence, defaultIslandPersistence } from '../core/islands/island-persistence.ts';
13
+ export { IslandStateSerializer } from '../core/islands/island-state-serializer.ts';
14
+ export { IslandErrorBoundary, withIslandErrorBoundary } from '../components/IslandErrorBoundary.tsx';
15
+ export { LayoutErrorBoundary } from '../components/LayoutErrorBoundary.tsx';
16
+ export { LayoutDataErrorBoundary } from '../components/LayoutDataErrorBoundary.tsx';
17
+ export { StreamingErrorBoundary, withStreamingErrorBoundary } from '../components/StreamingErrorBoundary.tsx';
18
+ export { StreamingLayout, StreamingSuspense, withStreaming, useStreamingState } from '../components/StreamingLayout.tsx';
19
+ export { Image } from '../components/Image.tsx';
20
+ export type { ImageProps } from '../components/Image.tsx';
21
+ export type { IslandState } from '../schemas/layout.ts';
@@ -0,0 +1,94 @@
1
+ /**
2
+ * CSS HMR Handler
3
+ *
4
+ * Handles Hot Module Replacement for CSS files including:
5
+ * - Global CSS files
6
+ * - CSS modules
7
+ * - Component-scoped styles (Svelte, Vue)
8
+ */
9
+ import type { Update } from './hmr-coordinator.ts';
10
+ /**
11
+ * CSS update types
12
+ */
13
+ export type CSSUpdateType = 'global' | 'module' | 'scoped';
14
+ /**
15
+ * CSS update information
16
+ */
17
+ export interface CSSUpdateInfo {
18
+ type: CSSUpdateType;
19
+ path: string;
20
+ timestamp: number;
21
+ affectedComponents?: string[];
22
+ }
23
+ /**
24
+ * CSS HMR Handler class
25
+ * Manages CSS hot updates without page reload
26
+ */
27
+ export declare class CSSHMRHandler {
28
+ private cssModuleMap;
29
+ private styleElementMap;
30
+ /**
31
+ * Handle CSS update from Vite HMR
32
+ */
33
+ handleCSSUpdate(update: Update): void;
34
+ /**
35
+ * Classify the type of CSS update
36
+ */
37
+ private classifyCSSUpdate;
38
+ /**
39
+ * Handle global CSS file update
40
+ * Injects updated styles without page reload
41
+ */
42
+ private handleGlobalCSSUpdate;
43
+ /**
44
+ * Handle CSS module update
45
+ * Re-renders components using the updated CSS module
46
+ */
47
+ private handleCSSModuleUpdate;
48
+ /**
49
+ * Handle scoped CSS update (Svelte/Vue)
50
+ * Updates only the affected component's styles
51
+ */
52
+ private handleScopedCSSUpdate;
53
+ /**
54
+ * Find islands that use a specific CSS module
55
+ */
56
+ private findIslandsUsingCSSModule;
57
+ /**
58
+ * Find islands using a specific component file
59
+ */
60
+ private findIslandsUsingComponent;
61
+ /**
62
+ * Trigger re-render of an island to apply new CSS module classes
63
+ */
64
+ private triggerIslandRerender;
65
+ /**
66
+ * Dispatch CSS update event for feedback
67
+ */
68
+ private dispatchCSSUpdateEvent;
69
+ /**
70
+ * Normalize a file path for comparison
71
+ */
72
+ private normalizePath;
73
+ /**
74
+ * Get directory from a file path
75
+ */
76
+ private getDirectory;
77
+ /**
78
+ * Get file ID from path (for Vite's data-vite-dev-id)
79
+ */
80
+ private getFileId;
81
+ /**
82
+ * Clear cached mappings
83
+ */
84
+ clearCache(): void;
85
+ /**
86
+ * Register an island as using a CSS module
87
+ * Useful for explicit tracking
88
+ */
89
+ registerCSSModuleUsage(cssPath: string, island: HTMLElement): void;
90
+ }
91
+ /**
92
+ * Get or create the global CSS HMR handler instance
93
+ */
94
+ export declare function getCSSHMRHandler(): CSSHMRHandler;