@useavalon/avalon 0.1.12 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/mod.ts +302 -0
  2. package/package.json +9 -17
  3. package/src/build/integration-bundler-plugin.ts +116 -0
  4. package/src/build/integration-config.ts +168 -0
  5. package/src/build/integration-detection-plugin.ts +117 -0
  6. package/src/build/integration-resolver-plugin.ts +90 -0
  7. package/src/build/island-manifest.ts +269 -0
  8. package/src/build/island-types-generator.ts +476 -0
  9. package/src/build/mdx-island-transform.ts +464 -0
  10. package/src/build/mdx-plugin.ts +98 -0
  11. package/src/build/page-island-transform.ts +598 -0
  12. package/src/build/prop-extractors/index.ts +21 -0
  13. package/src/build/prop-extractors/lit.ts +140 -0
  14. package/src/build/prop-extractors/qwik.ts +16 -0
  15. package/src/build/prop-extractors/solid.ts +125 -0
  16. package/src/build/prop-extractors/svelte.ts +194 -0
  17. package/src/build/prop-extractors/vue.ts +111 -0
  18. package/src/build/sidecar-file-manager.ts +104 -0
  19. package/src/build/sidecar-renderer.ts +30 -0
  20. package/src/client/adapters/index.ts +21 -0
  21. package/src/client/components.ts +35 -0
  22. package/src/client/css-hmr-handler.ts +344 -0
  23. package/src/client/framework-adapter.ts +462 -0
  24. package/src/client/hmr-coordinator.ts +396 -0
  25. package/src/client/hmr-error-overlay.js +533 -0
  26. package/src/client/main.js +824 -0
  27. package/src/components/Image.tsx +123 -0
  28. package/src/components/IslandErrorBoundary.tsx +145 -0
  29. package/src/components/LayoutDataErrorBoundary.tsx +141 -0
  30. package/src/components/LayoutErrorBoundary.tsx +127 -0
  31. package/src/components/PersistentIsland.tsx +52 -0
  32. package/src/components/StreamingErrorBoundary.tsx +233 -0
  33. package/src/components/StreamingLayout.tsx +538 -0
  34. package/src/core/components/component-analyzer.ts +192 -0
  35. package/src/core/components/component-detection.ts +508 -0
  36. package/src/core/components/enhanced-framework-detector.ts +500 -0
  37. package/src/core/components/framework-registry.ts +563 -0
  38. package/src/core/content/mdx-processor.ts +46 -0
  39. package/src/core/integrations/index.ts +19 -0
  40. package/src/core/integrations/loader.ts +125 -0
  41. package/src/core/integrations/registry.ts +175 -0
  42. package/src/core/islands/island-persistence.ts +325 -0
  43. package/src/core/islands/island-state-serializer.ts +258 -0
  44. package/src/core/islands/persistent-island-context.tsx +80 -0
  45. package/src/core/islands/use-persistent-state.ts +68 -0
  46. package/src/core/layout/enhanced-layout-resolver.ts +322 -0
  47. package/src/core/layout/layout-cache-manager.ts +485 -0
  48. package/src/core/layout/layout-composer.ts +357 -0
  49. package/src/core/layout/layout-data-loader.ts +516 -0
  50. package/src/core/layout/layout-discovery.ts +243 -0
  51. package/src/core/layout/layout-matcher.ts +299 -0
  52. package/src/core/layout/layout-types.ts +110 -0
  53. package/src/core/modules/framework-module-resolver.ts +273 -0
  54. package/src/islands/component-analysis.ts +213 -0
  55. package/src/islands/css-utils.ts +565 -0
  56. package/src/islands/discovery/index.ts +80 -0
  57. package/src/islands/discovery/registry.ts +340 -0
  58. package/src/islands/discovery/resolver.ts +477 -0
  59. package/src/islands/discovery/scanner.ts +386 -0
  60. package/src/islands/discovery/types.ts +117 -0
  61. package/src/islands/discovery/validator.ts +544 -0
  62. package/src/islands/discovery/watcher.ts +368 -0
  63. package/src/islands/framework-detection.ts +428 -0
  64. package/src/islands/integration-loader.ts +490 -0
  65. package/src/islands/island.tsx +565 -0
  66. package/src/islands/render-cache.ts +550 -0
  67. package/src/islands/types.ts +80 -0
  68. package/src/islands/universal-css-collector.ts +157 -0
  69. package/src/islands/universal-head-collector.ts +137 -0
  70. package/src/layout-system.ts +218 -0
  71. package/src/middleware/discovery.ts +268 -0
  72. package/src/middleware/executor.ts +315 -0
  73. package/src/middleware/index.ts +76 -0
  74. package/src/middleware/types.ts +99 -0
  75. package/src/nitro/build-config.ts +576 -0
  76. package/src/nitro/config.ts +483 -0
  77. package/src/nitro/error-handler.ts +636 -0
  78. package/src/nitro/index.ts +173 -0
  79. package/src/nitro/island-manifest.ts +584 -0
  80. package/src/nitro/middleware-adapter.ts +260 -0
  81. package/src/nitro/renderer.ts +1471 -0
  82. package/src/nitro/route-discovery.ts +439 -0
  83. package/src/nitro/types.ts +321 -0
  84. package/src/render/collect-css.ts +198 -0
  85. package/src/render/error-pages.ts +79 -0
  86. package/src/render/isolated-ssr-renderer.ts +654 -0
  87. package/src/render/ssr.ts +1030 -0
  88. package/src/schemas/api.ts +30 -0
  89. package/src/schemas/core.ts +64 -0
  90. package/src/schemas/index.ts +212 -0
  91. package/src/schemas/layout.ts +279 -0
  92. package/src/schemas/routing/index.ts +38 -0
  93. package/src/schemas/routing.ts +376 -0
  94. package/src/types/as-island.ts +20 -0
  95. package/src/types/layout.ts +285 -0
  96. package/src/types/routing.ts +555 -0
  97. package/src/types/types.ts +5 -0
  98. package/src/utils/dev-logger.ts +299 -0
  99. package/src/utils/fs.ts +151 -0
  100. package/src/vite-plugin/auto-discover.ts +551 -0
  101. package/src/vite-plugin/config.ts +266 -0
  102. package/src/vite-plugin/errors.ts +127 -0
  103. package/src/vite-plugin/image-optimization.ts +156 -0
  104. package/src/vite-plugin/integration-activator.ts +126 -0
  105. package/src/vite-plugin/island-sidecar-plugin.ts +176 -0
  106. package/src/vite-plugin/module-discovery.ts +189 -0
  107. package/src/vite-plugin/nitro-integration.ts +1354 -0
  108. package/src/vite-plugin/plugin.ts +403 -0
  109. package/src/vite-plugin/types.ts +327 -0
  110. package/src/vite-plugin/validation.ts +228 -0
  111. package/dist/mod.js +0 -1
  112. package/dist/src/build/integration-bundler-plugin.js +0 -1
  113. package/dist/src/build/integration-config.js +0 -1
  114. package/dist/src/build/integration-detection-plugin.js +0 -1
  115. package/dist/src/build/integration-resolver-plugin.js +0 -1
  116. package/dist/src/build/island-manifest.js +0 -1
  117. package/dist/src/build/island-types-generator.js +0 -5
  118. package/dist/src/build/mdx-island-transform.js +0 -2
  119. package/dist/src/build/mdx-plugin.js +0 -1
  120. package/dist/src/build/page-island-transform.js +0 -3
  121. package/dist/src/build/prop-extractors/index.js +0 -1
  122. package/dist/src/build/prop-extractors/lit.js +0 -1
  123. package/dist/src/build/prop-extractors/qwik.js +0 -1
  124. package/dist/src/build/prop-extractors/solid.js +0 -1
  125. package/dist/src/build/prop-extractors/svelte.js +0 -1
  126. package/dist/src/build/prop-extractors/vue.js +0 -1
  127. package/dist/src/build/sidecar-file-manager.js +0 -1
  128. package/dist/src/build/sidecar-renderer.js +0 -6
  129. package/dist/src/client/adapters/index.js +0 -1
  130. package/dist/src/client/components.js +0 -1
  131. package/dist/src/client/css-hmr-handler.js +0 -1
  132. package/dist/src/client/framework-adapter.js +0 -13
  133. package/dist/src/client/hmr-coordinator.js +0 -1
  134. package/dist/src/client/hmr-error-overlay.js +0 -214
  135. package/dist/src/client/main.js +0 -39
  136. package/dist/src/components/Image.js +0 -1
  137. package/dist/src/components/IslandErrorBoundary.js +0 -1
  138. package/dist/src/components/LayoutDataErrorBoundary.js +0 -1
  139. package/dist/src/components/LayoutErrorBoundary.js +0 -1
  140. package/dist/src/components/PersistentIsland.js +0 -1
  141. package/dist/src/components/StreamingErrorBoundary.js +0 -1
  142. package/dist/src/components/StreamingLayout.js +0 -29
  143. package/dist/src/core/components/component-analyzer.js +0 -1
  144. package/dist/src/core/components/component-detection.js +0 -5
  145. package/dist/src/core/components/enhanced-framework-detector.js +0 -1
  146. package/dist/src/core/components/framework-registry.js +0 -1
  147. package/dist/src/core/content/mdx-processor.js +0 -1
  148. package/dist/src/core/integrations/index.js +0 -1
  149. package/dist/src/core/integrations/loader.js +0 -1
  150. package/dist/src/core/integrations/registry.js +0 -1
  151. package/dist/src/core/islands/island-persistence.js +0 -1
  152. package/dist/src/core/islands/island-state-serializer.js +0 -1
  153. package/dist/src/core/islands/persistent-island-context.js +0 -1
  154. package/dist/src/core/islands/use-persistent-state.js +0 -1
  155. package/dist/src/core/layout/enhanced-layout-resolver.js +0 -1
  156. package/dist/src/core/layout/layout-cache-manager.js +0 -1
  157. package/dist/src/core/layout/layout-composer.js +0 -1
  158. package/dist/src/core/layout/layout-data-loader.js +0 -1
  159. package/dist/src/core/layout/layout-discovery.js +0 -1
  160. package/dist/src/core/layout/layout-matcher.js +0 -1
  161. package/dist/src/core/layout/layout-types.js +0 -1
  162. package/dist/src/core/modules/framework-module-resolver.js +0 -1
  163. package/dist/src/islands/component-analysis.js +0 -1
  164. package/dist/src/islands/css-utils.js +0 -17
  165. package/dist/src/islands/discovery/index.js +0 -1
  166. package/dist/src/islands/discovery/registry.js +0 -1
  167. package/dist/src/islands/discovery/resolver.js +0 -2
  168. package/dist/src/islands/discovery/scanner.js +0 -1
  169. package/dist/src/islands/discovery/types.js +0 -1
  170. package/dist/src/islands/discovery/validator.js +0 -18
  171. package/dist/src/islands/discovery/watcher.js +0 -1
  172. package/dist/src/islands/framework-detection.js +0 -1
  173. package/dist/src/islands/integration-loader.js +0 -1
  174. package/dist/src/islands/island.js +0 -1
  175. package/dist/src/islands/render-cache.js +0 -1
  176. package/dist/src/islands/types.js +0 -1
  177. package/dist/src/islands/universal-css-collector.js +0 -5
  178. package/dist/src/islands/universal-head-collector.js +0 -2
  179. package/dist/src/layout-system.js +0 -1
  180. package/dist/src/middleware/discovery.js +0 -1
  181. package/dist/src/middleware/executor.js +0 -1
  182. package/dist/src/middleware/index.js +0 -1
  183. package/dist/src/middleware/types.js +0 -1
  184. package/dist/src/nitro/build-config.js +0 -1
  185. package/dist/src/nitro/config.js +0 -1
  186. package/dist/src/nitro/error-handler.js +0 -198
  187. package/dist/src/nitro/index.js +0 -1
  188. package/dist/src/nitro/island-manifest.js +0 -2
  189. package/dist/src/nitro/middleware-adapter.js +0 -1
  190. package/dist/src/nitro/renderer.js +0 -183
  191. package/dist/src/nitro/route-discovery.js +0 -1
  192. package/dist/src/nitro/types.js +0 -1
  193. package/dist/src/render/collect-css.js +0 -3
  194. package/dist/src/render/error-pages.js +0 -48
  195. package/dist/src/render/isolated-ssr-renderer.js +0 -1
  196. package/dist/src/render/ssr.js +0 -90
  197. package/dist/src/schemas/api.js +0 -1
  198. package/dist/src/schemas/core.js +0 -1
  199. package/dist/src/schemas/index.js +0 -1
  200. package/dist/src/schemas/layout.js +0 -1
  201. package/dist/src/schemas/routing/index.js +0 -1
  202. package/dist/src/schemas/routing.js +0 -1
  203. package/dist/src/types/as-island.js +0 -1
  204. package/dist/src/types/layout.js +0 -1
  205. package/dist/src/types/routing.js +0 -1
  206. package/dist/src/types/types.js +0 -1
  207. package/dist/src/utils/dev-logger.js +0 -12
  208. package/dist/src/utils/fs.js +0 -1
  209. package/dist/src/vite-plugin/auto-discover.js +0 -1
  210. package/dist/src/vite-plugin/config.js +0 -1
  211. package/dist/src/vite-plugin/errors.js +0 -1
  212. package/dist/src/vite-plugin/image-optimization.js +0 -45
  213. package/dist/src/vite-plugin/integration-activator.js +0 -1
  214. package/dist/src/vite-plugin/island-sidecar-plugin.js +0 -1
  215. package/dist/src/vite-plugin/module-discovery.js +0 -1
  216. package/dist/src/vite-plugin/nitro-integration.js +0 -42
  217. package/dist/src/vite-plugin/plugin.js +0 -1
  218. package/dist/src/vite-plugin/types.js +0 -1
  219. package/dist/src/vite-plugin/validation.js +0 -2
  220. /package/{dist/src → src}/client/types/framework-runtime.d.ts +0 -0
  221. /package/{dist/src → src}/client/types/vite-hmr.d.ts +0 -0
  222. /package/{dist/src → src}/client/types/vite-virtual-modules.d.ts +0 -0
  223. /package/{dist/src → src}/layout-system.d.ts +0 -0
  224. /package/{dist/src → src}/types/image.d.ts +0 -0
  225. /package/{dist/src → src}/types/index.d.ts +0 -0
  226. /package/{dist/src → src}/types/island-jsx.d.ts +0 -0
  227. /package/{dist/src → src}/types/island-prop.d.ts +0 -0
  228. /package/{dist/src → src}/types/mdx.d.ts +0 -0
  229. /package/{dist/src → src}/types/urlpattern.d.ts +0 -0
  230. /package/{dist/src → src}/types/vite-env.d.ts +0 -0
@@ -0,0 +1,327 @@
1
+ /**
2
+ * Vite Plugin Types for Avalon
3
+ *
4
+ * CONFIG PATH: Vite plugin runtime
5
+ * These types define the inline configuration passed to `avalon()` in
6
+ * `vite.config.ts`. The `resolveConfig()` function in `vite-plugin/config.ts`
7
+ * merges user options against `DEFAULT_CONFIG` to produce a `ResolvedAvalonConfig`.
8
+ *
9
+ * This path uses `IntegrationName[]` (simple string array) for integrations.
10
+ *
11
+ * There is a separate CLI config path (`schemas/integration-config.ts` →
12
+ * `config-loader.ts` → `startup.ts` → `cli.ts`) that reads `avalon.config.ts`
13
+ * from disk and uses `IntegrationConfigEntry[]` (objects with name/enabled/options).
14
+ * That path is NOT used during Vite plugin startup.
15
+ */
16
+
17
+ import type { AvalonNitroConfig } from "../nitro/config.ts";
18
+
19
+ /**
20
+ * Image optimization configuration
21
+ */
22
+ export interface ImageConfig {
23
+ /**
24
+ * Enable image optimization via vite-imagetools
25
+ * @default true
26
+ */
27
+ enabled?: boolean;
28
+
29
+ /**
30
+ * Default image format for optimized images
31
+ * @default "webp"
32
+ */
33
+ defaultFormat?: "webp" | "avif" | "jpg" | "png";
34
+
35
+ /**
36
+ * Default image quality (1-100)
37
+ * @default 80
38
+ */
39
+ quality?: number;
40
+
41
+ /**
42
+ * Breakpoint widths for srcset generation
43
+ * @default [200, 400, 600, 800, 1200]
44
+ */
45
+ widths?: number[];
46
+
47
+ /**
48
+ * Whether to strip EXIF and other metadata from images
49
+ * @default true
50
+ */
51
+ removeMetadata?: boolean;
52
+
53
+ /**
54
+ * File patterns to include for image processing
55
+ * @default /^[^?]+\.(heif|avif|jpeg|jpg|png|tiff|webp|gif)(\?.*)?$/
56
+ */
57
+ include?: string | RegExp | (string | RegExp)[];
58
+
59
+ /**
60
+ * File patterns to exclude from image processing
61
+ * @default "public/**\/*"
62
+ */
63
+ exclude?: string | RegExp | (string | RegExp)[];
64
+ }
65
+
66
+ /**
67
+ * Resolved image optimization configuration
68
+ */
69
+ export interface ResolvedImageConfig {
70
+ enabled: boolean;
71
+ defaultFormat: "webp" | "avif" | "jpg" | "png";
72
+ quality: number;
73
+ widths: number[];
74
+ removeMetadata: boolean;
75
+ include: string | RegExp | (string | RegExp)[];
76
+ exclude: string | RegExp | (string | RegExp)[];
77
+ }
78
+
79
+ /**
80
+ * Supported integration names
81
+ * These correspond to the @useavalon/* packages
82
+ */
83
+ export type IntegrationName =
84
+ | "react"
85
+ | "preact"
86
+ | "vue"
87
+ | "svelte"
88
+ | "solid"
89
+ | "lit"
90
+ | "qwik";
91
+
92
+ /**
93
+ * MDX configuration options
94
+ */
95
+ export interface MDXConfig {
96
+ /**
97
+ * JSX import source for MDX files
98
+ * @default "preact"
99
+ */
100
+ jsxImportSource?: string;
101
+
102
+ /**
103
+ * Enable syntax highlighting for code blocks
104
+ * @default true
105
+ */
106
+ syntaxHighlighting?: boolean;
107
+
108
+ /**
109
+ * Custom remark plugins
110
+ */
111
+ remarkPlugins?: unknown[];
112
+
113
+ /**
114
+ * Custom rehype plugins
115
+ */
116
+ rehypePlugins?: unknown[];
117
+ }
118
+
119
+ /**
120
+ * Modular architecture configuration
121
+ * Enables co-located pages/layouts within feature modules
122
+ */
123
+ export interface ModulesConfig {
124
+ /**
125
+ * Directory containing feature modules
126
+ * @example "app/modules"
127
+ */
128
+ dir: string;
129
+
130
+ /**
131
+ * Name of the pages directory within each module
132
+ * @default "pages"
133
+ */
134
+ pagesDirName?: string;
135
+
136
+ /**
137
+ * Name of the layouts directory within each module
138
+ * @default "layouts"
139
+ */
140
+ layoutsDirName?: string;
141
+ }
142
+
143
+ /**
144
+ * Configuration options for the Avalon Vite plugin
145
+ */
146
+ export interface AvalonPluginConfig {
147
+ /**
148
+ * Directory containing page components for file-system routing
149
+ * @default "src/pages"
150
+ */
151
+ pagesDir?: string;
152
+
153
+ /**
154
+ * Directory containing layout components
155
+ * @default "src/layouts"
156
+ */
157
+ layoutsDir?: string;
158
+
159
+ /**
160
+ * Modular architecture configuration
161
+ * When set, discovers pages and layouts within feature modules
162
+ * Can be a string (just the dir) or full config object
163
+ *
164
+ * @example
165
+ * ```ts
166
+ * // Simple - uses default 'pages' and 'layouts' folder names
167
+ * modules: 'app/modules'
168
+ *
169
+ * // Full config - customize folder names
170
+ * modules: {
171
+ * dir: 'app/modules',
172
+ * pagesDirName: 'views',
173
+ * layoutsDirName: 'layouts',
174
+ * }
175
+ * ```
176
+ */
177
+ modules?: string | ModulesConfig;
178
+
179
+ /**
180
+ * Framework integrations to activate
181
+ * Simply list the framework names - the integration packages handle the rest
182
+ * @example ["react", "svelte", "lit"]
183
+ */
184
+ integrations?: IntegrationName[];
185
+
186
+ /**
187
+ * MDX processing configuration
188
+ */
189
+ mdx?: MDXConfig;
190
+
191
+ /**
192
+ * Image optimization configuration
193
+ * When enabled, Avalon auto-injects vite-imagetools with sensible defaults.
194
+ * Set to `false` to disable, or pass an object to customize.
195
+ *
196
+ * @default { enabled: true }
197
+ *
198
+ * @example
199
+ * ```ts
200
+ * // Use defaults (webp, quality 80, standard breakpoints)
201
+ * image: true
202
+ *
203
+ * // Customize
204
+ * image: {
205
+ * defaultFormat: 'avif',
206
+ * quality: 90,
207
+ * widths: [320, 640, 1024, 1920],
208
+ * }
209
+ *
210
+ * // Disable
211
+ * image: false
212
+ * ```
213
+ */
214
+ image?: boolean | ImageConfig;
215
+
216
+ /**
217
+ * Nitro server runtime configuration
218
+ * When provided, enables Nitro integration for universal deployment
219
+ *
220
+ * @example
221
+ * ```ts
222
+ * nitro: {
223
+ * preset: 'vercel',
224
+ * streaming: true,
225
+ * routeRules: {
226
+ * '/api/**': { cors: true },
227
+ * '/static/**': { cache: { maxAge: 86400 } },
228
+ * },
229
+ * }
230
+ * ```
231
+ */
232
+ nitro?: AvalonNitroConfig;
233
+
234
+ /**
235
+ * Enable verbose logging during development
236
+ * @default false
237
+ */
238
+ verbose?: boolean;
239
+
240
+ /**
241
+ * Auto-discover integrations based on component file extensions
242
+ * When true, Avalon will automatically activate integrations
243
+ * based on the components you use, even if not listed in integrations
244
+ * @default true
245
+ */
246
+ autoDiscoverIntegrations?: boolean;
247
+
248
+ /**
249
+ * Validate integrations on startup
250
+ * When true, Avalon will check that all integrations
251
+ * implement the required interface correctly
252
+ * @default true
253
+ */
254
+ validateIntegrations?: boolean;
255
+
256
+ /**
257
+ * Show warnings for integration issues
258
+ * When true, Avalon will log warnings for non-critical
259
+ * integration problems
260
+ * @default true
261
+ */
262
+ showWarnings?: boolean;
263
+
264
+ /**
265
+ * Enable lazy loading of integration Vite plugins
266
+ * When true (default), Avalon will only load Vite plugins for integrations
267
+ * that are actually used in your project, significantly improving cold start time.
268
+ *
269
+ * The lazy loading works by:
270
+ * 1. Scanning the islands directory to discover which frameworks are used
271
+ * 2. Only loading Vite plugins for those frameworks at startup
272
+ * 3. Loading additional plugins on-demand if new frameworks are encountered
273
+ *
274
+ * Set to false to load all configured integrations at startup (slower but predictable).
275
+ * @default true
276
+ */
277
+ lazyIntegrations?: boolean;
278
+ }
279
+
280
+ /**
281
+ * Fully resolved MDX configuration with defaults applied
282
+ */
283
+ export interface ResolvedMDXConfig {
284
+ jsxImportSource: string;
285
+ syntaxHighlighting: boolean;
286
+ remarkPlugins: unknown[];
287
+ rehypePlugins: unknown[];
288
+ }
289
+
290
+ /**
291
+ * Resolved modular architecture configuration
292
+ */
293
+ export interface ResolvedModulesConfig {
294
+ dir: string;
295
+ pagesDirName: string;
296
+ layoutsDirName: string;
297
+ }
298
+
299
+ /**
300
+ * Fully resolved configuration with defaults applied
301
+ */
302
+ export interface ResolvedAvalonConfig {
303
+ pagesDir: string;
304
+ layoutsDir: string;
305
+ modules: ResolvedModulesConfig | null;
306
+ integrations: IntegrationName[];
307
+ mdx: ResolvedMDXConfig;
308
+ image: ResolvedImageConfig;
309
+ verbose: boolean;
310
+ autoDiscoverIntegrations: boolean;
311
+ validateIntegrations: boolean;
312
+ showWarnings: boolean;
313
+ lazyIntegrations: boolean;
314
+ isDev: boolean;
315
+ }
316
+
317
+ /**
318
+ * Re-export Nitro configuration types for convenience
319
+ */
320
+ export type { AvalonNitroConfig } from "../nitro/config.ts";
321
+ export type {
322
+ CacheOptions,
323
+ RouteRule,
324
+ NitroConfigOutput,
325
+ AvalonRuntimeConfig,
326
+ StaticAssetsConfig,
327
+ } from "../nitro/config.ts";
@@ -0,0 +1,228 @@
1
+ /**
2
+ * Integration Validation for Avalon Vite Plugin
3
+ *
4
+ * This module provides validation functions to ensure that framework integrations
5
+ * implement the required interface correctly. Validation can be enabled via the
6
+ * `validateIntegrations` configuration option.
7
+ */
8
+
9
+ import type { IntegrationName } from "./types.ts";
10
+ import { registry } from "../core/integrations/registry.ts";
11
+
12
+ /**
13
+ * Result of validating a single integration
14
+ */
15
+ export interface ValidationResult {
16
+ /** The integration name that was validated */
17
+ integration: IntegrationName;
18
+ /** Whether the integration passed all required checks */
19
+ valid: boolean;
20
+ /** Critical errors that prevent the integration from working */
21
+ errors: string[];
22
+ /** Non-critical warnings about the integration */
23
+ warnings: string[];
24
+ }
25
+
26
+ /**
27
+ * Result of validating all active integrations
28
+ */
29
+ export interface ValidationSummary {
30
+ /** Whether all integrations passed validation */
31
+ allValid: boolean;
32
+ /** Individual validation results for each integration */
33
+ results: ValidationResult[];
34
+ /** Total number of errors across all integrations */
35
+ totalErrors: number;
36
+ /** Total number of warnings across all integrations */
37
+ totalWarnings: number;
38
+ }
39
+
40
+ /**
41
+ * Validate that an integration implements the required interface
42
+ *
43
+ * Checks for the following required properties:
44
+ * - name: string - Unique name of the integration
45
+ * - version: string - Version of the integration package
46
+ * - render: function - Server-side rendering function
47
+ * - getHydrationScript: function - Returns hydration script for client
48
+ * - config: function - Returns integration configuration
49
+ *
50
+ * Also checks optional properties if present:
51
+ * - vitePlugin: function (if provided)
52
+ *
53
+ * @param integration - The integration object to validate
54
+ * @returns ValidationResult with errors and warnings
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * const result = validateIntegration(myIntegration);
59
+ * if (!result.valid) {
60
+ * console.error('Integration validation failed:', result.errors);
61
+ * }
62
+ * ```
63
+ */
64
+ export function validateIntegration(integration: unknown): ValidationResult {
65
+ if (integration === null || integration === undefined) {
66
+ return { integration: "unknown" as IntegrationName, valid: false, errors: ["Integration is null or undefined"], warnings: [] };
67
+ }
68
+ if (typeof integration !== "object") {
69
+ return { integration: "unknown" as IntegrationName, valid: false, errors: [`Integration must be an object, got ${typeof integration}`], warnings: [] };
70
+ }
71
+
72
+ const obj = integration as Record<string, unknown>;
73
+ const errors: string[] = [];
74
+ const warnings: string[] = [];
75
+
76
+ checkStringProp(obj, "name", errors);
77
+ checkStringProp(obj, "version", errors);
78
+ checkFunctionProp(obj, "render", errors);
79
+ checkFunctionProp(obj, "getHydrationScript", errors);
80
+ checkFunctionProp(obj, "config", errors);
81
+
82
+ if (obj.vitePlugin !== undefined && typeof obj.vitePlugin !== "function") {
83
+ warnings.push(`'vitePlugin' should be a function if provided, got ${typeof obj.vitePlugin}`);
84
+ }
85
+
86
+ const integrationName = typeof obj.name === "string"
87
+ ? (obj.name as IntegrationName)
88
+ : ("unknown" as IntegrationName);
89
+
90
+ return { integration: integrationName, valid: errors.length === 0, errors, warnings };
91
+ }
92
+
93
+ function checkStringProp(obj: Record<string, unknown>, key: string, errors: string[]): void {
94
+ const val = obj[key];
95
+ if (typeof val !== "string") {
96
+ errors.push(val === undefined
97
+ ? `Missing required '${key}' property`
98
+ : `Invalid '${key}' property: expected string, got ${typeof val}`);
99
+ } else if (val.trim() === "") {
100
+ errors.push(`'${key}' property cannot be empty`);
101
+ }
102
+ }
103
+
104
+ function checkFunctionProp(obj: Record<string, unknown>, key: string, errors: string[]): void {
105
+ if (typeof obj[key] !== "function") {
106
+ errors.push(obj[key] === undefined
107
+ ? `Missing required '${key}' method`
108
+ : `Invalid '${key}' method: expected function, got ${typeof obj[key]}`);
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Validate all active integrations in the registry
114
+ *
115
+ * Iterates through all integrations that have been activated and validates
116
+ * each one against the required interface.
117
+ *
118
+ * @param activeIntegrations - Set of integration names that have been activated
119
+ * @param showWarnings - Whether to include warnings in the results
120
+ * @returns ValidationSummary with results for all integrations
121
+ *
122
+ * @example
123
+ * ```ts
124
+ * const activeIntegrations = new Set<IntegrationName>(['react', 'vue']);
125
+ * const summary = validateActiveIntegrations(activeIntegrations, true);
126
+ * if (!summary.allValid) {
127
+ * console.error(`${summary.totalErrors} validation errors found`);
128
+ * }
129
+ * ```
130
+ */
131
+ export function validateActiveIntegrations(
132
+ activeIntegrations: Set<IntegrationName>,
133
+ showWarnings: boolean = true
134
+ ): ValidationSummary {
135
+ const results: ValidationResult[] = [];
136
+ let totalErrors = 0;
137
+ let totalWarnings = 0;
138
+
139
+ for (const name of activeIntegrations) {
140
+ const integration = registry.get(name);
141
+
142
+ if (!integration) {
143
+ // Integration was marked as active but not found in registry
144
+ results.push({
145
+ integration: name,
146
+ valid: false,
147
+ errors: [`Integration '${name}' is marked as active but not found in registry`],
148
+ warnings: [],
149
+ });
150
+ totalErrors++;
151
+ continue;
152
+ }
153
+
154
+ const result = validateIntegration(integration);
155
+ results.push(result);
156
+ totalErrors += result.errors.length;
157
+ if (showWarnings) {
158
+ totalWarnings += result.warnings.length;
159
+ }
160
+ }
161
+
162
+ return {
163
+ allValid: totalErrors === 0,
164
+ results,
165
+ totalErrors,
166
+ totalWarnings: showWarnings ? totalWarnings : 0,
167
+ };
168
+ }
169
+
170
+ /**
171
+ * Format validation results for console output
172
+ *
173
+ * @param summary - The validation summary to format
174
+ * @returns Formatted string for console output
175
+ */
176
+ export function formatValidationResults(summary: ValidationSummary): string {
177
+ if (summary.allValid && summary.totalWarnings === 0) {
178
+ return `✅ All ${summary.results.length} integration(s) passed validation`;
179
+ }
180
+
181
+ const lines: string[] = [];
182
+
183
+ if (!summary.allValid) {
184
+ lines.push(`❌ Integration validation failed with ${summary.totalErrors} error(s)`);
185
+ }
186
+
187
+ if (summary.totalWarnings > 0) {
188
+ lines.push(`⚠️ ${summary.totalWarnings} warning(s) found`);
189
+ }
190
+
191
+ lines.push("");
192
+
193
+ for (const result of summary.results) {
194
+ if (result.errors.length > 0 || result.warnings.length > 0) {
195
+ lines.push(`Integration: ${result.integration}`);
196
+
197
+ for (const error of result.errors) {
198
+ lines.push(` ❌ ${error}`);
199
+ }
200
+
201
+ for (const warning of result.warnings) {
202
+ lines.push(` ⚠️ ${warning}`);
203
+ }
204
+
205
+ lines.push("");
206
+ }
207
+ }
208
+
209
+ return lines.join("\n");
210
+ }
211
+
212
+ /**
213
+ * Validate a single integration by name from the registry
214
+ *
215
+ * @param name - The integration name to validate
216
+ * @returns ValidationResult or null if integration not found
217
+ */
218
+ export function validateIntegrationByName(
219
+ name: IntegrationName
220
+ ): ValidationResult | null {
221
+ const integration = registry.get(name);
222
+
223
+ if (!integration) {
224
+ return null;
225
+ }
226
+
227
+ return validateIntegration(integration);
228
+ }
package/dist/mod.js DELETED
@@ -1 +0,0 @@
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{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{IslandPersistence,defaultIslandPersistence}from"./src/core/islands/island-persistence.js";export{IslandStateSerializer}from"./src/core/islands/island-state-serializer.js";export{createPersistentIslandContext,usePersistentIslandContext,PersistentIslandProvider}from"./src/core/islands/persistent-island-context.js";export{PersistentIsland}from"./src/components/PersistentIsland.js";export{usePersistentState}from"./src/core/islands/use-persistent-state.js";export{LayoutErrorBoundary}from"./src/components/LayoutErrorBoundary.js";export{LayoutDataErrorBoundary}from"./src/components/LayoutDataErrorBoundary.js";export{IslandErrorBoundary,withIslandErrorBoundary}from"./src/components/IslandErrorBoundary.js";export{StreamingErrorBoundary,withStreamingErrorBoundary}from"./src/components/StreamingErrorBoundary.js";
@@ -1 +0,0 @@
1
- import{resolve as e}from"node:path";import{getOptimizeDepsForIntegrations as t,getSSRNoExternalForIntegrations as n}from"./integration-config.js";export function integrationBundlerPlugin(t){let{integrations:n,ssr:r=!1}=t,i=process.cwd();return{name:`avalon:integration-bundler`,enforce:`post`,config(t){let a={};for(let t of n)r?a[`integrations/${t}/server`]=e(i,`packages/integrations/${t}/server/renderer.ts`):a[`integrations/${t}/client`]=e(i,`packages/integrations/${t}/client/index.ts`);let o=t.build?.rolldownOptions?.input||{};return{build:{rolldownOptions:{input:typeof o==`string`?{main:o,...a}:{...o,...a}}}}}}}export function getIntegrationExternals(e,t){let n=[];switch(e){case`preact`:if(!t)return[];n.push(`preact`,`preact/hooks`,`preact-render-to-string`);break;case`vue`:t&&n.push(`vue`,`vue/server-renderer`,`@vue/server-renderer`,`@vue/shared`);break;case`solid`:t&&n.push(`solid-js`,`solid-js/web`);break;case`svelte`:t&&n.push(`svelte`,`svelte/server`,`svelte/compiler`,`svelte/internal`);break}return n}export function getIntegrationOptimizeDeps(e){return t(e)}export function getIntegrationSSRNoExternal(e){return n(e)}
@@ -1 +0,0 @@
1
- export const INTEGRATION_BUILD_CONFIGS={preact:{name:`preact`,extensions:[`.tsx`,`.jsx`],optimizeDeps:[`preact`,`preact/hooks`,`preact/jsx-runtime`,`preact/jsx-dev-runtime`],ssrExternal:[],ssrNoExternal:[`preact`,`preact-render-to-string`],requiresPlugin:!1},vue:{name:`vue`,extensions:[`.vue`],optimizeDeps:[`vue`],ssrExternal:[],ssrNoExternal:[`vue`,`@vue/server-renderer`,`@vue/shared`],requiresPlugin:!0,pluginPackage:`@vitejs/plugin-vue`},solid:{name:`solid`,extensions:[`.tsx`,`.jsx`],optimizeDeps:[`solid-js`,`solid-js/web`,`solid-js/store`],ssrExternal:[],ssrNoExternal:[`solid-js`,`solid-js/web`,`solid-js/store`],requiresPlugin:!0,pluginPackage:`vite-plugin-solid`},svelte:{name:`svelte`,extensions:[`.svelte`],optimizeDeps:[`svelte`,`svelte/internal`,`svelte/store`,`svelte/animate`,`svelte/easing`,`svelte/motion`,`svelte/transition`],ssrExternal:[],ssrNoExternal:[`svelte`,`svelte/server`,`svelte/internal`,`svelte/store`],requiresPlugin:!0,pluginPackage:`@sveltejs/vite-plugin-svelte`},react:{name:`react`,extensions:[`.jsx`,`.tsx`],optimizeDeps:[`react`,`react/jsx-runtime`,`react/jsx-dev-runtime`,`react-dom`,`react-dom/client`],ssrExternal:[],ssrNoExternal:[`react`,`react-dom`,`react-dom/server`],requiresPlugin:!0,pluginPackage:`@vitejs/plugin-react`},lit:{name:`lit`,extensions:[`.ts`,`.js`],optimizeDeps:[`lit`,`lit/decorators.js`,`lit/directives/class-map.js`,`lit/directives/style-map.js`,`@lit/reactive-element`],ssrExternal:[],ssrNoExternal:[`lit`,`@lit-labs/ssr`,`@lit/reactive-element`,`lit-html`],requiresPlugin:!1}};export function getIntegrationBuildConfig(t){return INTEGRATION_BUILD_CONFIGS[t]}export function getOptimizeDepsForIntegrations(t){let n=new Set;for(let r of t){let t=INTEGRATION_BUILD_CONFIGS[r];t&&t.optimizeDeps.forEach(e=>n.add(e))}return Array.from(n)}export function getSSRNoExternalForIntegrations(t){let n=new Set;for(let r of t){let t=INTEGRATION_BUILD_CONFIGS[r];t&&t.ssrNoExternal.forEach(e=>n.add(e))}return Array.from(n)}export function integrationRequiresPlugin(t){return INTEGRATION_BUILD_CONFIGS[t]?.requiresPlugin??!1}export function getIntegrationPluginPackage(t){return INTEGRATION_BUILD_CONFIGS[t]?.pluginPackage}
@@ -1 +0,0 @@
1
- import{resolve as e}from"node:path";import{readdir as t,readFile as n}from"node:fs/promises";export function integrationDetectionPlugin(){let t=null;return{name:`avalon:integration-detection`,enforce:`pre`,async buildStart(){t=await detectUsedIntegrations()},resolveId(n){if(n.startsWith(`@useavalon/integration-`)){let r=n.replace(`@useavalon/integration-`,``).split(`/`)[0];return t&&!t[r]&&console.warn(`⚠️ Integration ${r} is imported but not detected in project files`),e(process.cwd(),`packages/integrations/${r}/mod.ts`)}return null},transform(e,t){return t.includes(`/islands/`)||t.includes(`/components/`),null}}}export async function detectUsedIntegrations(){let r={preact:!1,vue:!1,solid:!1,svelte:!1},i=[`islands`,`components`,`src/islands`,`src/components`],a=process.cwd();for(let o of i)try{let i=e(a,o),s=await t(i,{withFileTypes:!0});for(let t of s)t.isFile()&&(t.name.endsWith(`.vue`)?r.vue=!0:t.name.endsWith(`.svelte`)?r.svelte=!0:(t.name.endsWith(`.tsx`)||t.name.endsWith(`.jsx`))&&((await n(e(i,t.name),`utf-8`)).includes(`solid-js`)?r.solid=!0:r.preact=!0))}catch{}return r}export function getRequiredIntegrations(e){let t=[];return e.preact&&t.push(`preact`),e.vue&&t.push(`vue`),e.solid&&t.push(`solid`),e.svelte&&t.push(`svelte`),t}
@@ -1 +0,0 @@
1
- import{resolve as e}from"node:path";export function integrationResolverPlugin(){let t=process.cwd();return{name:`avalon:integration-resolver`,enforce:`pre`,resolveId(n,r){if(n.startsWith(`@useavalon/integration-`)){let r=n.split(`/`),i=r[1].replace(`integration-`,``),a=r.slice(2).join(`/`);if(!a||a===``)return e(t,`packages/integrations/${i}/mod.ts`);if(a===`server`)return e(t,`packages/integrations/${i}/server/renderer.ts`);if(a===`client`)return e(t,`packages/integrations/${i}/client/index.ts`);if(a===`types`)return e(t,`packages/integrations/${i}/types.ts`)}return n===`@useavalon/shared`||n===`@useavalon/shared/types`?e(t,`packages/integrations/shared/types.ts`):r&&r.includes(`/integrations/`)&&n.startsWith(`../shared/`)?e(t,`packages/integrations/shared/${n.replace(`../shared/`,``)}`):null},load(e){return null}}}export function createIntegrationAliases(){let t=process.cwd();return{"@useavalon/integration-preact":e(t,`packages/integrations/preact/mod.ts`),"@useavalon/integration-preact/server":e(t,`packages/integrations/preact/server/renderer.ts`),"@useavalon/integration-preact/client":e(t,`packages/integrations/preact/client/index.ts`),"@useavalon/integration-vue":e(t,`packages/integrations/vue/mod.ts`),"@useavalon/integration-vue/server":e(t,`packages/integrations/vue/server/renderer.ts`),"@useavalon/integration-vue/client":e(t,`packages/integrations/vue/client/index.ts`),"@useavalon/integration-solid":e(t,`packages/integrations/solid/mod.ts`),"@useavalon/integration-solid/server":e(t,`packages/integrations/solid/server/renderer.ts`),"@useavalon/integration-solid/client":e(t,`packages/integrations/solid/client/index.ts`),"@useavalon/integration-svelte":e(t,`packages/integrations/svelte/mod.ts`),"@useavalon/integration-svelte/server":e(t,`packages/integrations/svelte/server/renderer.ts`),"@useavalon/integration-svelte/client":e(t,`packages/integrations/svelte/client/index.ts`),"@useavalon/integration-react":e(t,`packages/integrations/react/mod.ts`),"@useavalon/integration-react/server":e(t,`packages/integrations/react/server/renderer.ts`),"@useavalon/integration-react/client":e(t,`packages/integrations/react/client/index.ts`),"@useavalon/integration-react/types":e(t,`packages/integrations/react/types.ts`),"@useavalon/integration-lit":e(t,`packages/integrations/lit/mod.ts`),"@useavalon/integration-lit/server":e(t,`packages/integrations/lit/server/renderer.ts`),"@useavalon/integration-lit/client":e(t,`packages/integrations/lit/client/index.ts`),"@useavalon/integration-lit/types":e(t,`packages/integrations/lit/types.ts`),"@useavalon/shared":e(t,`packages/integrations/shared/types.ts`)}}
@@ -1 +0,0 @@
1
- import{readFile as e}from"node:fs/promises";import{getQualifiedIslandName as t,createIslandRegistry as n}from"../islands/discovery/index.js";export async function generateIslandManifest(){let r={},s=process.cwd();try{let c=await n(s),l=c.getAllIslands(),u=c.directories,d=c.collisions;for(let n of l){let s=t(n),c=`/${n.relativePath}`,l=await e(n.filePath,`utf-8`),u=i(n.framework),d=a(l),f=await o(l);r[s]={src:c,bundle:n.namespace===``?`/dist/islands/${n.name}.${f}.js`:`/dist/islands/${s}.${f}.js`,hash:f,framework:u,deps:d,namespace:n.namespace,qualifiedName:s,sourceDirectory:n.directory.relativePath}}return{islands:r,directories:u,collisions:d,version:`1.0.0`,buildTime:Date.now()}}catch(e){return console.warn(`Failed to generate island manifest:`,e),{islands:{},directories:[],collisions:[],version:`1.0.0`,buildTime:Date.now()}}}function i(e){switch(e){case`preact`:return`preact`;case`react`:return`react`;case`solid`:return`solid`;case`vue`:return`vue`;case`svelte`:return`svelte`;case`lit`:return`lit`;default:return`vanilla`}}function a(e){let t=[],n=/import\s+.*?\s+from\s+['"]([^'"]+)['"]/g,r;for(;(r=n.exec(e))!==null;){let e=r[1];!e.startsWith(`.`)&&!e.startsWith(`/`)&&t.push(e)}return[...new Set(t)]}async function o(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,t);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,`0`)).join(``).slice(0,8)}export async function loadIslandManifest(){try{let t=await e(`dist/island-manifest.json`,`utf-8`);return JSON.parse(t)}catch(e){return console.warn(`Failed to load island manifest:`,e),null}}export function getIslandBundlePath(e,t){let n=process.env.NODE_ENV!==`production`;if(t){let n=l(e),r=t;if(r.islands[n])return r.islands[n].bundle;let i=e.replace(/^\/islands\//,``).replace(/\.(tsx?|jsx?|vue|svelte)$/,``),a=t.islands[i];if(a)return a.bundle}return n?e.startsWith(`/islands/`)?e.replaceAll(`/islands/`,`/src/islands/`):e.startsWith(`/src/`)||e.startsWith(`/app/`)||e.startsWith(`/`)?e:`/src/${e}`:`/dist/islands/${l(e)}.js`}function l(e){let t=e.replace(/^\//,``);t=t.replace(/\.(tsx?|jsx?|vue|svelte)$/,``),t=t.replace(/\.(solid|react|lit|preact)$/,``);let n=new RegExp(/^src\/(.+)\/islands\/([^/]+)$/).exec(t);if(n){let[,e,t]=n;return`${e}/${t}`}let r=new RegExp(/^(?:src\/)?islands\/([^/]+)$/).exec(t);return r?r[1]:t}export function getIslandEntry(e,t){if(t.islands[e])return t.islands[e];if(t.directories){for(let[n,r]of Object.entries(t.islands))if(n.split(`/`).pop()===e)return r}return null}
@@ -1,5 +0,0 @@
1
- import{resolve as e,dirname as t,relative as n}from"node:path";import{writeFile as r,mkdir as i}from"node:fs/promises";import{createIslandRegistry as a,getQualifiedIslandName as o}from"../islands/discovery/index.js";const s={outputDir:`src/types`,mode:`single`,moduleName:`avalon-islands`,includeJsDoc:!0};export async function generateIslandTypes(n,i={}){let o={...s,...i},c={success:!0,files:[],islandCount:0,errors:[]};try{let i=await a(n),s=i.getAllIslands(),d=i.directories,f=i.collisions;if(c.islandCount=s.length,s.length===0)return c;if(o.mode===`single`){let i=l(s,d,f,o),a=e(n,o.outputDir,`islands.d.ts`);await v(t(a)),await r(a,i),c.files.push(a)}else{let e=await u(s,d,n,o);c.files.push(...e)}}catch(e){c.success=!1,c.errors.push(e instanceof Error?e.message:String(e))}return c}function l(e,t,n,r){let i=[];i.push(`/**`),i.push(` * Auto-generated TypeScript declarations for Avalon islands.`),i.push(` * Do not edit this file manually - it will be overwritten.`),i.push(` * Generated at: ${new Date().toISOString()}`),i.push(` */`),i.push(``),i.push(`declare module "${r.moduleName}" {`),i.push(``),r.includeJsDoc&&(i.push(` /**`),i.push(` * Discovered island directories`),i.push(` */`)),i.push(` export const islandDirectories: readonly string[];`),i.push(``);let a=g(e);for(let[e,t]of a){if(e===``){i.push(` // Default islands (src/islands/)`);for(let e of t)i.push(...p(e,r,` `))}else{let n=e.split(`/`).map(e=>_(e)).join(``);i.push(` // Islands from ${e}/islands/`),i.push(` export namespace ${n} {`);for(let e of t)i.push(...p(e,r,` `));i.push(` }`)}i.push(``)}i.push(` /**`),i.push(` * Map of all island qualified names to their component types`),i.push(` */`),i.push(` export interface IslandMap {`);for(let t of e){let e=o(t);i.push(` "${e}": typeof ${m(t)};`)}if(i.push(` }`),i.push(``),n.length>0){i.push(` /**`),i.push(` * Warning: The following island names have collisions.`),i.push(` * Use qualified names (namespace/name) to disambiguate.`),i.push(` */`),i.push(` export type CollidingIslandNames =`);let e=n.map(e=>` | "${e.name}"`);i.push(e.join(`
2
- `)+`;`),i.push(``)}i.push(` /**`),i.push(` * Get the component type for an island by name or qualified name`),i.push(` */`),i.push(` export type GetIsland<K extends keyof IslandMap> = IslandMap[K];`),i.push(``),i.push(`}`),i.push(``),i.push(`// Augment the Island component props with discovered islands`),i.push(`declare global {`),i.push(` namespace Avalon {`),i.push(` interface DiscoveredIslands {`);for(let t of e){let e=o(t);i.push(` "${e}": true;`)}return i.push(` }`),i.push(` }`),i.push(`}`),i.push(``),i.join(`
3
- `)}async function u(n,i,a,o){let s=[],c=new Map;for(let e of n){let t=e.directory.path,n=c.get(t)||[];n.push(e),c.set(t,n)}for(let n of i){let i=c.get(n.path)||[];if(i.length===0)continue;let l=d(n,i,o),u=e(a,n.path,`islands.d.ts`);await v(t(u)),await r(u,l),s.push(u)}let l=f(i,a,o),u=e(a,o.outputDir,`islands.d.ts`);return await v(t(u)),await r(u,l),s.push(u),s}function d(e,t,n){let r=[];r.push(`/**`),r.push(` * Auto-generated TypeScript declarations for islands in ${e.relativePath}`),r.push(` * Do not edit this file manually - it will be overwritten.`),r.push(` */`),r.push(``);for(let e of t)r.push(...p(e,n,``));return r.join(`
4
- `)}function f(t,r,i){let a=[];a.push(`/**`),a.push(` * Auto-generated index for all island type declarations.`),a.push(` * Do not edit this file manually - it will be overwritten.`),a.push(` */`),a.push(``);for(let o of t){let t=n(e(r,i.outputDir),e(r,o.path,`islands.d.ts`)).replace(/\\/g,`/`).replace(/\.d\.ts$/,``);a.push(`export * from "${t}";`)}return a.join(`
5
- `)}function p(e,t,n){let r=[],i=m(e);t.includeJsDoc&&(r.push(`${n}/**`),r.push(`${n} * Island component: ${e.name}`),r.push(`${n} * Framework: ${e.framework}`),r.push(`${n} * Source: ${e.relativePath}`),e.namespace&&r.push(`${n} * Namespace: ${e.namespace}`),r.push(`${n} */`));let a=h(e.framework);return r.push(`${n}export const ${i}: ${a};`),r}function m(e){return e.name}function h(e){switch(e){case`preact`:return`import('preact').FunctionComponent<any>`;case`react`:return`import('react').FC<any>`;case`vue`:return`import('vue').DefineComponent<any, any, any>`;case`svelte`:return`import('svelte').SvelteComponent`;case`solid`:return`import('solid-js').Component<any>`;case`lit`:return`typeof import('lit').LitElement`;default:return`unknown`}}function g(e){let t=new Map;for(let n of e){let e=t.get(n.namespace)||[];e.push(n),t.set(n.namespace,e)}let n=new Map,r=Array.from(t.keys()).sort((e,t)=>e===``?-1:t===``?1:e.localeCompare(t));for(let e of r)n.set(e,t.get(e));return n}function _(e){return e.split(/[-_\s]+/).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(``)}async function v(e){try{await i(e,{recursive:!0})}catch(e){if(!(e instanceof Error)||e.code!==`EEXIST`)throw e}}export async function watchAndGenerateTypes(e,t={}){let{createIslandWatcher:n,createIslandRegistry:r}=await import(`../islands/discovery/index.js`),i=await r(e),a=n(e,i);await generateIslandTypes(e,t);let o=await a.watch(async n=>{await i.rebuild();let r=await generateIslandTypes(e,t);r.success||console.error(`❌ Failed to regenerate types:`,r.errors)});return()=>{o(),a.stop()}}
@@ -1,2 +0,0 @@
1
- import{dirname as e}from"node:path";const t=[/['"]\.\.\/islands\//,/['"]\.\/islands\//,/['"]\.\.\/\.\.\/islands\//,/['"]\$islands\//,/['"]@\/islands\//,/['"]\/src\/islands\//];function n(e){let t=new Map,n=/import\s+([A-Z]\w*)\s+from\s+(['"][^'"]+['"])/g,r;for(;(r=n.exec(e))!==null;){let e=r[1],n=r[2].slice(1,-1);t.set(e,n)}return t}function r(e){let t=new Set,n=/<([A-Z]\w*)\s+[^>]*\bisland\s*[={]/g,r;for(;(r=n.exec(e))!==null;)t.add(r[1]);let i=/(?:_?jsxs?(?:DEV)?)\s*\(\s*([A-Z]\w*)\s*,\s*\{[^}]*\bisland\s*:/g;for(;(r=i.exec(e))!==null;)t.add(r[1]);return t}function i(e,t){let i=[],a=n(e),o=r(e);for(let[e,n]of a){let r=`"${n}"`,a=t.some(e=>e.test(r)),s=o.has(e);(a||s)&&i.push({localName:e,importPath:n,islandPropUsage:s})}return i}function a(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 t.includes(`/islands/`)?`/src/islands/`+t.split(`/`).at(-1):`/src/`+t.split(`/`).pop()}function o(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.endsWith(`.tsx`)||e.endsWith(`.jsx`))return`preact`}function s(e,t){let n=t+1,r=1;for(;n<e.length&&r>0;){let t=e[n];t===`{`?(r++,n++):t===`}`?(r--,r>0&&n++):t===`'`||t===`"`||t==="`"?n=c(e,n):n++}return n<e.length?n+1:n}function c(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 l(e,t){let n=t,r=0;for(;n<e.length&&e[n]!==`(`;)n++;if(n>=e.length)return t;for(;n<e.length;){let t=e[n];if(t===`(`)r++,n++;else if(t===`)`){if(r--,n++,r===0)return n}else t===`{`?n=s(e,n):t===`'`||t===`"`||t==="`"?n=c(e,n):n++}return n}function u(e){let t=e.match(/\bisland\s*:\s*/);if(!t)return null;let n=t.index+t[0].length,r;if(e[n]===`{`)r=s(e,n);else{let t=n,i=0;for(;t<e.length;){let n=e[t];if(n===`{`||n===`[`||n===`(`)i++,t++;else if(n===`}`||n===`]`||n===`)`){if(i===0)break;i--,t++}else if(n===`,`&&i===0)break;else t++}r=t}let i=e.slice(n,r).trim(),a=e.slice(0,t.index).trim(),o=e.slice(r).trim(),c=a;return o.startsWith(`,`)?c+=o.slice(1):c+=o,c=c.replace(/,\s*}$/,`}`).replace(/{\s*,/,`{`),{islandValue:i,otherProps:c}}function d(e,t,n,r){let i=RegExp(`(_?jsxs?(?:DEV)?)\\s*\\(\\s*`+t+`\\s*,`,`g`),a=``,o=0,c;for(;(c=i.exec(e))!==null;){let t=c.index;c[1];let i=l(e,t),d=e.slice(t,i);if(!d.includes(`island`)){a+=e.slice(o,i),o=i;continue}let f=d.indexOf(`{`);if(f===-1){a+=e.slice(o,i),o=i;continue}let p=s(d,f),m=u(d.slice(f,p));if(!m){a+=e.slice(o,i),o=i;continue}let{islandValue:h,otherProps:g}=m,_=`(await __AvalonRenderIsland({ src: "${n}", ${r?`framework: "${r}",`:``} ...(${h}), ${g.trim()!==`{}`&&g.trim()!==``?`props: ${g},`:``} ssr: (${h}).ssr !== undefined ? (${h}).ssr : true }))`;a+=e.slice(o,t)+_,o=i}return a+=e.slice(o),a}export function mdxIslandTransform(e={}){let{islandPathPatterns:n=t,verbose:r=!1}=e;return{name:`avalon:mdx-island-transform`,enforce:`post`,transform(e,t){if(!t.endsWith(`.mdx`)&&!t.includes(`.mdx?`))return null;let s=i(e,n);if(s.length===0)return null;if(r){console.log(`[mdx-island-transform] Found `+s.length+` island import(s) in `+t);for(let e of s)console.log(` - `+e.localName+` from `+e.importPath+(e.islandPropUsage?` (island prop)`:` (islands dir)`))}let c=e;if(!(c.includes(`from "@useavalon/avalon"`)||c.includes(`from '@useavalon/avalon'`))){let e=/^(import\s.+?from\s+.+?\n)/m.exec(c);if(e){let t=c.indexOf(e[0])+e[0].length;c=c.slice(0,t)+`import { renderIsland as __AvalonRenderIsland } from "@useavalon/avalon";
2
- `+c.slice(t)}}for(let e of s){let n=a(e.importPath,t),r=o(n);c=d(c,e.localName,n,r)}for(let e of s){let t=RegExp(`import\\s+${e.localName}\\s+from\\s+(['"][^'"]+['"])`,`g`);c=c.replace(t,`import $1; // [mdx-island-transform] kept for CSS: ${e.localName}`)}return c=c.replace(/function\s+_createMdxContent\s*\(/g,`async function _createMdxContent(`),c=c.replace(/export\s+default\s+function\s+MDXContent\s*\(/g,`export default async function MDXContent(`),r&&console.log(`[mdx-island-transform] Transformed `+t),{code:c,map:null}}}}
@@ -1 +0,0 @@
1
- export async function createMDXPlugin(e={}){let{remarkPlugins:t=[],rehypePlugins:n=[],development:r=!1,jsxImportSource:i=`preact`,syntaxHighlighting:a=!0}=e;try{let{default:e}=await import(`@mdx-js/rollup`),{default:o}=await import(`remark-frontmatter`),{default:s}=await import(`remark-mdx-frontmatter`),{default:c}=await import(`remark-gfm`),l=[];if(a)try{let{default:e}=await import(`rehype-highlight`);l.push(e)}catch{console.warn(`[avalon:mdx] rehype-highlight not available, syntax highlighting disabled`)}return l.push(...n),[e({remarkPlugins:[o,s,c,...t],rehypePlugins:l,jsxImportSource:i,development:r,format:`mdx`})]}catch(e){let t=e instanceof Error?e.message:String(e);return console.error(`❌ Failed to configure MDX plugin:`,t),console.warn(`💡 Install missing dependencies or check import map`),console.warn(`⚠️ MDX plugin disabled - .mdx files will not be processed`),[]}}
@@ -1,3 +0,0 @@
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){let i=n?`, framework: "`+n+`"`:``,a=e.otherProps.length>0?`, props: { `+e.otherProps.join(`, `)+` }`:``;if(r)return`{await __pageRenderIsland({ src: "`+t+`"`+i+a+`, ssr: true, ssrOnly: true })}`;let o=e.islandProp,s=n===`qwik`?`, ssrOnly: true`:``;return`{await __pageRenderIsland({ src: "`+t+`"`+i+`, ...(`+o+`)`+a+s+`, ssr: (`+o+`).ssr !== undefined ? (`+o+`).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),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);for(let e of f)p.has(e.localName)&&(m=d?m.replace(e.fullMatch,`import '`+e.importPath+`'; // [page-island-transform] kept for CSS graph: `+e.localName):m.replace(e.fullMatch,`// [page-island-transform] removed: `+e.localName));return{code:m,map:null}}}}
@@ -1 +0,0 @@
1
- export{FALLBACK_PROPS,extractVueProps}from"./vue.js";export{extractSvelteProps}from"./svelte.js";export{extractLitProps}from"./lit.js";export{extractSolidProps}from"./solid.js";export{extractQwikProps}from"./qwik.js";import{extractVueProps as e}from"./vue.js";import{extractSvelteProps as t}from"./svelte.js";import{extractLitProps as n}from"./lit.js";import{extractSolidProps as r}from"./solid.js";import{extractQwikProps as i}from"./qwik.js";export const EXTRACTOR_MAP={vue:e,svelte:t,lit:n,solid:r,qwik:i};
@@ -1 +0,0 @@
1
- import{FALLBACK_PROPS as e}from"./vue.js";const t={String:`string`,Number:`number`,Boolean:`boolean`,Array:`unknown[]`,Object:`Record<string, unknown>`};export function extractLitProps(t){try{let n=r(t);if(n===null)return{propsType:e,fallback:!0};let a=i(n);return a.length===0?{propsType:e,fallback:!0}:{propsType:`{ `+a.map(e=>e.name+`?: `+e.tsType).join(`; `)+` }`,fallback:!1}}catch{return console.warn(`[avalon] Failed to extract Lit props — falling back to Record<string, unknown>`),{propsType:e,fallback:!0}}}function r(e){let t=/static\s+properties\s*=\s*\{/.exec(e);if(!t)return null;let n=t.index+t[0].length-1,r=1,i=n+1;for(;i<e.length&&r>0;)e[i]===`{`?r++:e[i]===`}`&&r--,i++;return r===0?e.slice(n+1,i-1):null}function i(e){let n=[],r=/(\w+)\s*:\s*\{/g,i;for(;(i=r.exec(e))!==null;){let o=i[1],s=i.index+i[0].length-1,c=a(e,s);if(c===null||/\bstate\s*:\s*true\b/.test(c))continue;let l=new RegExp(/\btype\s*:\s*(\w+)/).exec(c),u=l?l[1]:null,d=u&&u in t?t[u]:`unknown`;n.push({name:o,tsType:d}),r.lastIndex=s+c.length}return n}function a(e,t){if(e[t]!==`{`)return null;let n=0,r=t;for(;r<e.length;){if(e[r]===`{`?n++:e[r]===`}`&&n--,n===0)return e.slice(t+1,r);r++}return null}
@@ -1 +0,0 @@
1
- import{FALLBACK_PROPS as e}from"./vue.js";export function extractQwikProps(t){return{propsType:e,fallback:!1}}
@@ -1 +0,0 @@
1
- import{FALLBACK_PROPS as e}from"./vue.js";export function extractSolidProps(t){try{let i=n(t);if(i!==null)return{propsType:i,fallback:!1};let a=r(t);return a===null?{propsType:e,fallback:!0}:{propsType:a,fallback:!1}}catch{return console.warn(`[avalon] Failed to extract Solid props — falling back to Record<string, unknown>`),{propsType:e,fallback:!0}}}function n(e){let t=/export\s+default\s+function\s+\w+\s*\(\s*props\s*:\s*/.exec(e);return t?i(e,t.index+t[0].length):null}function r(e){let t=/export\s+default\s+\(\s*props\s*:\s*/.exec(e);return t?i(e,t.index+t[0].length):null}function i(e,t){let n=t;for(;n<e.length&&/\s/.test(e[n]);)n++;if(n>=e.length)return null;if(e[n]===`{`)return a(e,n);let r=e.slice(n),i=new RegExp(/^([A-Za-z_$][\w$]*(?:<[^>]*>)?)/).exec(r);return i?i[1].trim():null}function a(e,t){if(e[t]!==`{`)return null;let n=0,r=t;for(;r<e.length;){if(e[r]===`{`)n++;else if(e[r]===`}`&&(n--,n===0))return e.slice(t,r+1).trim();r++}return null}