@useavalon/avalon 0.1.10 → 0.1.12

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 (250) hide show
  1. package/README.md +54 -54
  2. package/dist/mod.js +1 -0
  3. package/dist/src/build/integration-bundler-plugin.js +1 -0
  4. package/dist/src/build/integration-config.js +1 -0
  5. package/dist/src/build/integration-detection-plugin.js +1 -0
  6. package/dist/src/build/integration-resolver-plugin.js +1 -0
  7. package/dist/src/build/island-manifest.js +1 -0
  8. package/dist/src/build/island-types-generator.js +5 -0
  9. package/dist/src/build/mdx-island-transform.js +2 -0
  10. package/dist/src/build/mdx-plugin.js +1 -0
  11. package/dist/src/build/page-island-transform.js +3 -0
  12. package/dist/src/build/prop-extractors/index.js +1 -0
  13. package/dist/src/build/prop-extractors/lit.js +1 -0
  14. package/dist/src/build/prop-extractors/qwik.js +1 -0
  15. package/dist/src/build/prop-extractors/solid.js +1 -0
  16. package/dist/src/build/prop-extractors/svelte.js +1 -0
  17. package/dist/src/build/prop-extractors/vue.js +1 -0
  18. package/dist/src/build/sidecar-file-manager.js +1 -0
  19. package/dist/src/build/sidecar-renderer.js +6 -0
  20. package/dist/src/client/adapters/index.js +1 -0
  21. package/dist/src/client/components.js +1 -0
  22. package/dist/src/client/css-hmr-handler.js +1 -0
  23. package/dist/src/client/framework-adapter.js +13 -0
  24. package/dist/src/client/hmr-coordinator.js +1 -0
  25. package/dist/src/client/hmr-error-overlay.js +214 -0
  26. package/dist/src/client/main.js +39 -0
  27. package/{src → dist/src}/client/types/framework-runtime.d.ts +68 -68
  28. package/{src → dist/src}/client/types/vite-hmr.d.ts +46 -46
  29. package/dist/src/client/types/vite-virtual-modules.d.ts +70 -0
  30. package/dist/src/components/Image.js +1 -0
  31. package/dist/src/components/IslandErrorBoundary.js +1 -0
  32. package/dist/src/components/LayoutDataErrorBoundary.js +1 -0
  33. package/dist/src/components/LayoutErrorBoundary.js +1 -0
  34. package/dist/src/components/PersistentIsland.js +1 -0
  35. package/dist/src/components/StreamingErrorBoundary.js +1 -0
  36. package/dist/src/components/StreamingLayout.js +29 -0
  37. package/dist/src/core/components/component-analyzer.js +1 -0
  38. package/dist/src/core/components/component-detection.js +5 -0
  39. package/dist/src/core/components/enhanced-framework-detector.js +1 -0
  40. package/dist/src/core/components/framework-registry.js +1 -0
  41. package/dist/src/core/content/mdx-processor.js +1 -0
  42. package/dist/src/core/integrations/index.js +1 -0
  43. package/dist/src/core/integrations/loader.js +1 -0
  44. package/dist/src/core/integrations/registry.js +1 -0
  45. package/dist/src/core/islands/island-persistence.js +1 -0
  46. package/dist/src/core/islands/island-state-serializer.js +1 -0
  47. package/dist/src/core/islands/persistent-island-context.js +1 -0
  48. package/dist/src/core/islands/use-persistent-state.js +1 -0
  49. package/dist/src/core/layout/enhanced-layout-resolver.js +1 -0
  50. package/dist/src/core/layout/layout-cache-manager.js +1 -0
  51. package/dist/src/core/layout/layout-composer.js +1 -0
  52. package/dist/src/core/layout/layout-data-loader.js +1 -0
  53. package/dist/src/core/layout/layout-discovery.js +1 -0
  54. package/dist/src/core/layout/layout-matcher.js +1 -0
  55. package/dist/src/core/layout/layout-types.js +1 -0
  56. package/dist/src/core/modules/framework-module-resolver.js +1 -0
  57. package/dist/src/islands/component-analysis.js +1 -0
  58. package/dist/src/islands/css-utils.js +17 -0
  59. package/dist/src/islands/discovery/index.js +1 -0
  60. package/dist/src/islands/discovery/registry.js +1 -0
  61. package/dist/src/islands/discovery/resolver.js +2 -0
  62. package/dist/src/islands/discovery/scanner.js +1 -0
  63. package/dist/src/islands/discovery/types.js +1 -0
  64. package/dist/src/islands/discovery/validator.js +18 -0
  65. package/dist/src/islands/discovery/watcher.js +1 -0
  66. package/dist/src/islands/framework-detection.js +1 -0
  67. package/dist/src/islands/integration-loader.js +1 -0
  68. package/dist/src/islands/island.js +1 -0
  69. package/dist/src/islands/render-cache.js +1 -0
  70. package/dist/src/islands/types.js +1 -0
  71. package/dist/src/islands/universal-css-collector.js +5 -0
  72. package/dist/src/islands/universal-head-collector.js +2 -0
  73. package/{src → dist/src}/layout-system.d.ts +592 -592
  74. package/dist/src/layout-system.js +1 -0
  75. package/dist/src/middleware/discovery.js +1 -0
  76. package/dist/src/middleware/executor.js +1 -0
  77. package/dist/src/middleware/index.js +1 -0
  78. package/dist/src/middleware/types.js +1 -0
  79. package/dist/src/nitro/build-config.js +1 -0
  80. package/dist/src/nitro/config.js +1 -0
  81. package/dist/src/nitro/error-handler.js +198 -0
  82. package/dist/src/nitro/index.js +1 -0
  83. package/dist/src/nitro/island-manifest.js +2 -0
  84. package/dist/src/nitro/middleware-adapter.js +1 -0
  85. package/dist/src/nitro/renderer.js +183 -0
  86. package/dist/src/nitro/route-discovery.js +1 -0
  87. package/dist/src/nitro/types.js +1 -0
  88. package/dist/src/render/collect-css.js +3 -0
  89. package/{src/render/error-pages.ts → dist/src/render/error-pages.js} +7 -38
  90. package/dist/src/render/isolated-ssr-renderer.js +1 -0
  91. package/dist/src/render/ssr.js +90 -0
  92. package/dist/src/schemas/api.js +1 -0
  93. package/dist/src/schemas/core.js +1 -0
  94. package/dist/src/schemas/index.js +1 -0
  95. package/dist/src/schemas/layout.js +1 -0
  96. package/dist/src/schemas/routing/index.js +1 -0
  97. package/dist/src/schemas/routing.js +1 -0
  98. package/dist/src/types/as-island.js +1 -0
  99. package/{src → dist/src}/types/image.d.ts +106 -106
  100. package/{src → dist/src}/types/index.d.ts +22 -22
  101. package/{src → dist/src}/types/island-jsx.d.ts +33 -33
  102. package/{src → dist/src}/types/island-prop.d.ts +20 -20
  103. package/dist/src/types/layout.js +1 -0
  104. package/{src → dist/src}/types/mdx.d.ts +6 -6
  105. package/dist/src/types/routing.js +1 -0
  106. package/dist/src/types/types.js +1 -0
  107. package/{src → dist/src}/types/urlpattern.d.ts +49 -49
  108. package/{src → dist/src}/types/vite-env.d.ts +11 -11
  109. package/dist/src/utils/dev-logger.js +12 -0
  110. package/dist/src/utils/fs.js +1 -0
  111. package/dist/src/vite-plugin/auto-discover.js +1 -0
  112. package/dist/src/vite-plugin/config.js +1 -0
  113. package/dist/src/vite-plugin/errors.js +1 -0
  114. package/dist/src/vite-plugin/image-optimization.js +45 -0
  115. package/dist/src/vite-plugin/integration-activator.js +1 -0
  116. package/dist/src/vite-plugin/island-sidecar-plugin.js +1 -0
  117. package/dist/src/vite-plugin/module-discovery.js +1 -0
  118. package/dist/src/vite-plugin/nitro-integration.js +42 -0
  119. package/dist/src/vite-plugin/plugin.js +1 -0
  120. package/dist/src/vite-plugin/types.js +1 -0
  121. package/dist/src/vite-plugin/validation.js +2 -0
  122. package/package.json +57 -26
  123. package/mod.ts +0 -302
  124. package/src/build/integration-bundler-plugin.ts +0 -116
  125. package/src/build/integration-config.ts +0 -168
  126. package/src/build/integration-detection-plugin.ts +0 -117
  127. package/src/build/integration-resolver-plugin.ts +0 -90
  128. package/src/build/island-manifest.ts +0 -269
  129. package/src/build/island-types-generator.ts +0 -476
  130. package/src/build/mdx-island-transform.ts +0 -464
  131. package/src/build/mdx-plugin.ts +0 -98
  132. package/src/build/page-island-transform.ts +0 -598
  133. package/src/build/prop-extractors/index.ts +0 -21
  134. package/src/build/prop-extractors/lit.ts +0 -140
  135. package/src/build/prop-extractors/qwik.ts +0 -16
  136. package/src/build/prop-extractors/solid.ts +0 -125
  137. package/src/build/prop-extractors/svelte.ts +0 -194
  138. package/src/build/prop-extractors/vue.ts +0 -111
  139. package/src/build/sidecar-file-manager.ts +0 -104
  140. package/src/build/sidecar-renderer.ts +0 -30
  141. package/src/client/adapters/index.js +0 -12
  142. package/src/client/adapters/index.ts +0 -13
  143. package/src/client/adapters/lit-adapter.js +0 -467
  144. package/src/client/adapters/lit-adapter.ts +0 -654
  145. package/src/client/adapters/preact-adapter.js +0 -223
  146. package/src/client/adapters/preact-adapter.ts +0 -331
  147. package/src/client/adapters/qwik-adapter.js +0 -259
  148. package/src/client/adapters/qwik-adapter.ts +0 -345
  149. package/src/client/adapters/react-adapter.js +0 -220
  150. package/src/client/adapters/react-adapter.ts +0 -353
  151. package/src/client/adapters/solid-adapter.js +0 -295
  152. package/src/client/adapters/solid-adapter.ts +0 -451
  153. package/src/client/adapters/svelte-adapter.js +0 -368
  154. package/src/client/adapters/svelte-adapter.ts +0 -524
  155. package/src/client/adapters/vue-adapter.js +0 -278
  156. package/src/client/adapters/vue-adapter.ts +0 -467
  157. package/src/client/components.js +0 -23
  158. package/src/client/components.ts +0 -35
  159. package/src/client/css-hmr-handler.js +0 -263
  160. package/src/client/css-hmr-handler.ts +0 -344
  161. package/src/client/framework-adapter.js +0 -283
  162. package/src/client/framework-adapter.ts +0 -462
  163. package/src/client/hmr-coordinator.js +0 -274
  164. package/src/client/hmr-coordinator.ts +0 -396
  165. package/src/client/hmr-error-overlay.js +0 -533
  166. package/src/client/main.js +0 -816
  167. package/src/client/types/vite-virtual-modules.d.ts +0 -60
  168. package/src/components/Image.tsx +0 -123
  169. package/src/components/IslandErrorBoundary.tsx +0 -145
  170. package/src/components/LayoutDataErrorBoundary.tsx +0 -141
  171. package/src/components/LayoutErrorBoundary.tsx +0 -127
  172. package/src/components/PersistentIsland.tsx +0 -52
  173. package/src/components/StreamingErrorBoundary.tsx +0 -233
  174. package/src/components/StreamingLayout.tsx +0 -538
  175. package/src/core/components/component-analyzer.ts +0 -192
  176. package/src/core/components/component-detection.ts +0 -508
  177. package/src/core/components/enhanced-framework-detector.ts +0 -500
  178. package/src/core/components/framework-registry.ts +0 -563
  179. package/src/core/content/mdx-processor.ts +0 -46
  180. package/src/core/integrations/index.ts +0 -19
  181. package/src/core/integrations/loader.ts +0 -125
  182. package/src/core/integrations/registry.ts +0 -175
  183. package/src/core/islands/island-persistence.ts +0 -325
  184. package/src/core/islands/island-state-serializer.ts +0 -258
  185. package/src/core/islands/persistent-island-context.tsx +0 -80
  186. package/src/core/islands/use-persistent-state.ts +0 -68
  187. package/src/core/layout/enhanced-layout-resolver.ts +0 -322
  188. package/src/core/layout/layout-cache-manager.ts +0 -485
  189. package/src/core/layout/layout-composer.ts +0 -357
  190. package/src/core/layout/layout-data-loader.ts +0 -516
  191. package/src/core/layout/layout-discovery.ts +0 -243
  192. package/src/core/layout/layout-matcher.ts +0 -299
  193. package/src/core/layout/layout-types.ts +0 -110
  194. package/src/core/modules/framework-module-resolver.ts +0 -273
  195. package/src/islands/component-analysis.ts +0 -213
  196. package/src/islands/css-utils.ts +0 -565
  197. package/src/islands/discovery/index.ts +0 -80
  198. package/src/islands/discovery/registry.ts +0 -340
  199. package/src/islands/discovery/resolver.ts +0 -477
  200. package/src/islands/discovery/scanner.ts +0 -386
  201. package/src/islands/discovery/types.ts +0 -117
  202. package/src/islands/discovery/validator.ts +0 -544
  203. package/src/islands/discovery/watcher.ts +0 -368
  204. package/src/islands/framework-detection.ts +0 -428
  205. package/src/islands/integration-loader.ts +0 -490
  206. package/src/islands/island.tsx +0 -565
  207. package/src/islands/render-cache.ts +0 -550
  208. package/src/islands/types.ts +0 -80
  209. package/src/islands/universal-css-collector.ts +0 -157
  210. package/src/islands/universal-head-collector.ts +0 -137
  211. package/src/layout-system.ts +0 -218
  212. package/src/middleware/discovery.ts +0 -268
  213. package/src/middleware/executor.ts +0 -315
  214. package/src/middleware/index.ts +0 -76
  215. package/src/middleware/types.ts +0 -99
  216. package/src/nitro/build-config.ts +0 -576
  217. package/src/nitro/config.ts +0 -483
  218. package/src/nitro/error-handler.ts +0 -636
  219. package/src/nitro/index.ts +0 -173
  220. package/src/nitro/island-manifest.ts +0 -584
  221. package/src/nitro/middleware-adapter.ts +0 -260
  222. package/src/nitro/renderer.ts +0 -1471
  223. package/src/nitro/route-discovery.ts +0 -439
  224. package/src/nitro/types.ts +0 -321
  225. package/src/render/collect-css.ts +0 -198
  226. package/src/render/isolated-ssr-renderer.ts +0 -654
  227. package/src/render/ssr.ts +0 -1030
  228. package/src/schemas/api.ts +0 -30
  229. package/src/schemas/core.ts +0 -64
  230. package/src/schemas/index.ts +0 -212
  231. package/src/schemas/layout.ts +0 -279
  232. package/src/schemas/routing/index.ts +0 -38
  233. package/src/schemas/routing.ts +0 -376
  234. package/src/types/as-island.ts +0 -20
  235. package/src/types/layout.ts +0 -285
  236. package/src/types/routing.ts +0 -555
  237. package/src/types/types.ts +0 -5
  238. package/src/utils/dev-logger.ts +0 -299
  239. package/src/utils/fs.ts +0 -151
  240. package/src/vite-plugin/auto-discover.ts +0 -551
  241. package/src/vite-plugin/config.ts +0 -266
  242. package/src/vite-plugin/errors.ts +0 -127
  243. package/src/vite-plugin/image-optimization.ts +0 -156
  244. package/src/vite-plugin/integration-activator.ts +0 -126
  245. package/src/vite-plugin/island-sidecar-plugin.ts +0 -176
  246. package/src/vite-plugin/module-discovery.ts +0 -189
  247. package/src/vite-plugin/nitro-integration.ts +0 -1354
  248. package/src/vite-plugin/plugin.ts +0 -401
  249. package/src/vite-plugin/types.ts +0 -327
  250. package/src/vite-plugin/validation.ts +0 -228
@@ -1,563 +0,0 @@
1
- /**
2
- * Framework Registry and Configuration System
3
- *
4
- * This module provides a centralized registry for framework configurations,
5
- * validation utilities, and management of framework-specific detection patterns.
6
- */
7
-
8
- import type { FrameworkConfig } from './enhanced-framework-detector.ts';
9
-
10
- export interface FrameworkRegistryConfig {
11
- enableValidation: boolean;
12
- allowCustomFrameworks: boolean;
13
- defaultFramework: string;
14
- }
15
-
16
- export interface FrameworkValidationResult {
17
- isValid: boolean;
18
- errors: string[];
19
- warnings: string[];
20
- }
21
-
22
- /**
23
- * Centralized framework registry with validation and management
24
- */
25
- export class FrameworkRegistry {
26
- private readonly frameworks: Map<string, FrameworkConfig>;
27
- private readonly config: FrameworkRegistryConfig;
28
-
29
- constructor(config: Partial<FrameworkRegistryConfig> = {}) {
30
- this.frameworks = new Map();
31
- this.config = {
32
- enableValidation: true,
33
- allowCustomFrameworks: true,
34
- defaultFramework: 'unknown',
35
- ...config,
36
- };
37
-
38
- // Initialize with default frameworks
39
- this.initializeDefaultFrameworks();
40
- }
41
-
42
- /**
43
- * Registers a new framework configuration
44
- */
45
- registerFramework(name: string, config: FrameworkConfig): FrameworkValidationResult {
46
- const validation = this.validateFrameworkConfig(config);
47
-
48
- if (this.config.enableValidation && !validation.isValid) {
49
- return validation;
50
- }
51
-
52
- if (!this.config.allowCustomFrameworks && !this.isDefaultFramework(name)) {
53
- return {
54
- isValid: false,
55
- errors: [`Custom framework '${name}' not allowed`],
56
- warnings: [],
57
- };
58
- }
59
-
60
- this.frameworks.set(name, { ...config });
61
-
62
- return {
63
- isValid: true,
64
- errors: [],
65
- warnings: validation.warnings,
66
- };
67
- }
68
-
69
- /**
70
- * Gets a framework configuration by name
71
- */
72
- getFramework(name: string): FrameworkConfig | undefined {
73
- return this.frameworks.get(name);
74
- }
75
-
76
- /**
77
- * Gets all registered frameworks
78
- */
79
- getAllFrameworks(): Map<string, FrameworkConfig> {
80
- return new Map(this.frameworks);
81
- }
82
-
83
- /**
84
- * Gets framework names that support a specific file extension
85
- */
86
- getFrameworksByExtension(extension: string): string[] {
87
- const frameworks: string[] = [];
88
-
89
- for (const [name, config] of this.frameworks) {
90
- if (config.fileExtensions.includes(extension)) {
91
- frameworks.push(name);
92
- }
93
- }
94
-
95
- return frameworks;
96
- }
97
-
98
- /**
99
- * Gets frameworks that use a specific JSX import source
100
- */
101
- getFrameworksByJSXImportSource(importSource: string): string[] {
102
- const frameworks: string[] = [];
103
-
104
- for (const [name, config] of this.frameworks) {
105
- if (config.jsxImportSources.includes(importSource)) {
106
- frameworks.push(name);
107
- }
108
- }
109
-
110
- return frameworks;
111
- }
112
-
113
- /**
114
- * Removes a framework from the registry
115
- */
116
- unregisterFramework(name: string): boolean {
117
- if (this.isDefaultFramework(name)) {
118
- return false; // Cannot remove default frameworks
119
- }
120
-
121
- return this.frameworks.delete(name);
122
- }
123
-
124
- /**
125
- * Updates an existing framework configuration
126
- */
127
- updateFramework(name: string, updates: Partial<FrameworkConfig>): FrameworkValidationResult {
128
- const existing = this.frameworks.get(name);
129
- if (!existing) {
130
- return {
131
- isValid: false,
132
- errors: [`Framework '${name}' not found`],
133
- warnings: [],
134
- };
135
- }
136
-
137
- const updated = { ...existing, ...updates };
138
- const validation = this.validateFrameworkConfig(updated);
139
-
140
- if (this.config.enableValidation && !validation.isValid) {
141
- return validation;
142
- }
143
-
144
- this.frameworks.set(name, updated);
145
-
146
- return {
147
- isValid: true,
148
- errors: [],
149
- warnings: validation.warnings,
150
- };
151
- }
152
-
153
- /**
154
- * Validates a framework configuration
155
- */
156
- validateFrameworkConfig(config: FrameworkConfig): FrameworkValidationResult {
157
- const errors: string[] = [];
158
- const warnings: string[] = [];
159
-
160
- this.validateRequiredFields(config, errors, warnings);
161
- this.validateDetectionPatterns(config, errors, warnings);
162
- this.validateCrossFrameworkConflicts(config, warnings);
163
-
164
- return { isValid: errors.length === 0, errors, warnings };
165
- }
166
-
167
- /** Validate required top-level fields on a framework config */
168
- private validateRequiredFields(config: FrameworkConfig, errors: string[], warnings: string[]): void {
169
- if (!config.name || config.name.trim() === '') {
170
- errors.push('Framework name is required and cannot be empty');
171
- }
172
-
173
- if (!config.fileExtensions || config.fileExtensions.length === 0) {
174
- errors.push('At least one file extension is required');
175
- } else {
176
- for (const ext of config.fileExtensions) {
177
- if (!ext.startsWith('.')) {
178
- errors.push(`File extension '${ext}' must start with a dot`);
179
- }
180
- }
181
- }
182
-
183
- if (!config.jsxImportSources || config.jsxImportSources.length === 0) {
184
- warnings.push('No JSX import sources defined - detection may be less accurate');
185
- }
186
-
187
- if (!config.ssrModules || config.ssrModules.length === 0) {
188
- errors.push('At least one SSR module is required');
189
- }
190
-
191
- if (!config.hydrationModules || config.hydrationModules.length === 0) {
192
- errors.push('At least one hydration module is required');
193
- }
194
- }
195
-
196
- /** Validate the detectionPatterns sub-object */
197
- private validateDetectionPatterns(config: FrameworkConfig, errors: string[], warnings: string[]): void {
198
- if (!config.detectionPatterns) {
199
- errors.push('Detection patterns are required');
200
- return;
201
- }
202
-
203
- if (!config.detectionPatterns.imports || config.detectionPatterns.imports.length === 0) {
204
- errors.push('At least one import pattern is required for detection');
205
- }
206
- if (!config.detectionPatterns.content || config.detectionPatterns.content.length === 0) {
207
- warnings.push('No content patterns defined - detection may be less accurate');
208
- }
209
- if (!config.detectionPatterns.jsxPragmas || config.detectionPatterns.jsxPragmas.length === 0) {
210
- warnings.push('No JSX pragmas defined - detection may be less accurate');
211
- }
212
- }
213
-
214
- /**
215
- * Checks for potential conflicts with other registered frameworks
216
- */
217
- private validateCrossFrameworkConflicts(config: FrameworkConfig, warnings: string[]): void {
218
- // Skip validation if config is incomplete
219
- if (!config.fileExtensions || !config.jsxImportSources) {
220
- return;
221
- }
222
-
223
- for (const [existingName, existingConfig] of this.frameworks) {
224
- if (existingName === config.name) continue;
225
-
226
- // Check for overlapping file extensions
227
- if (existingConfig.fileExtensions) {
228
- const overlappingExtensions = config.fileExtensions.filter(ext => existingConfig.fileExtensions.includes(ext));
229
-
230
- if (overlappingExtensions.length > 0) {
231
- warnings.push(`File extensions ${overlappingExtensions.join(', ')} overlap with framework '${existingName}'`);
232
- }
233
- }
234
-
235
- // Check for overlapping JSX import sources
236
- if (existingConfig.jsxImportSources) {
237
- const overlappingImportSources = config.jsxImportSources.filter(source =>
238
- existingConfig.jsxImportSources.includes(source)
239
- );
240
-
241
- if (overlappingImportSources.length > 0) {
242
- warnings.push(
243
- `JSX import sources ${overlappingImportSources.join(', ')} overlap with framework '${existingName}'`
244
- );
245
- }
246
- }
247
- }
248
- }
249
-
250
- /**
251
- * Checks if a framework is a default framework
252
- */
253
- private isDefaultFramework(name: string): boolean {
254
- return ['preact', 'solid', 'vue', 'svelte', 'react', 'lit', 'qwik'].includes(name);
255
- }
256
-
257
- /**
258
- * Initializes the registry with default framework configurations
259
- */
260
- private initializeDefaultFrameworks(): void {
261
- const defaultFrameworks = this.getDefaultFrameworkConfigs();
262
-
263
- for (const [name, config] of Object.entries(defaultFrameworks)) {
264
- this.frameworks.set(name, config);
265
- }
266
- }
267
-
268
- /**
269
- * Gets default framework configurations
270
- */
271
- private getDefaultFrameworkConfigs(): Record<string, FrameworkConfig> {
272
- return {
273
- preact: {
274
- name: 'preact',
275
- fileExtensions: ['.tsx', '.jsx'],
276
- jsxImportSources: ['preact'],
277
- ssrModules: ['preact-render-to-string'],
278
- hydrationModules: ['preact'],
279
- detectionPatterns: {
280
- imports: [/^preact$/, /^preact\//, /preact-render-to-string/],
281
- content: [
282
- /\buseState\b/,
283
- /\buseEffect\b/,
284
- /\buseCallback\b/,
285
- /\buseMemo\b/,
286
- /\buseRef\b/,
287
- /\buseContext\b/,
288
- /\buseReducer\b/,
289
- /from\s+['"]preact['"]/,
290
- /import\s+.*\s+from\s+['"]preact['"]/,
291
- ],
292
- jsxPragmas: ['@jsxImportSource preact'],
293
- },
294
- },
295
- solid: {
296
- name: 'solid',
297
- fileExtensions: ['.tsx', '.jsx'],
298
- jsxImportSources: ['solid-js'],
299
- ssrModules: ['solid-js/web'],
300
- hydrationModules: ['solid-js/web'],
301
- detectionPatterns: {
302
- imports: [/^solid-js$/, /^solid-js\//, /solid-js\/web/, /solid-js\/store/],
303
- content: [
304
- /\bcreateSignal\b/,
305
- /\bcreateEffect\b/,
306
- /\bcreateMemo\b/,
307
- /\bcreateResource\b/,
308
- /\bcreateStore\b/,
309
- /\bonMount\b/,
310
- /\bonCleanup\b/,
311
- /\bShow\b/,
312
- /\bFor\b/,
313
- /from\s+['"]solid-js['"]/,
314
- /import\s+.*\s+from\s+['"]solid-js['"]/,
315
- ],
316
- jsxPragmas: ['@jsxImportSource solid-js'],
317
- },
318
- },
319
- vue: {
320
- name: 'vue',
321
- fileExtensions: ['.vue'],
322
- jsxImportSources: ['vue'],
323
- ssrModules: ['vue/server-renderer'],
324
- hydrationModules: ['vue'],
325
- detectionPatterns: {
326
- imports: [/^vue$/, /^@vue\//, /vue\/server-renderer/, /vue\/composition-api/],
327
- content: [
328
- /<template>/,
329
- /<script>/,
330
- /<style>/,
331
- /\bref\b/,
332
- /\breactive\b/,
333
- /\bcomputed\b/,
334
- /\bwatchEffect\b/,
335
- /\bwatch\b/,
336
- /\bonMounted\b/,
337
- /\bonUnmounted\b/,
338
- /from\s+['"]vue['"]/,
339
- /import\s+.*\s+from\s+['"]vue['"]/,
340
- ],
341
- jsxPragmas: ['@jsxImportSource vue'],
342
- },
343
- },
344
- svelte: {
345
- name: 'svelte',
346
- fileExtensions: ['.svelte'],
347
- jsxImportSources: ['svelte'],
348
- ssrModules: ['svelte/server'],
349
- hydrationModules: ['svelte'],
350
- detectionPatterns: {
351
- imports: [/^svelte$/, /^svelte\//, /svelte\/store/, /svelte\/motion/, /svelte\/transition/],
352
- content: [
353
- /<script>/,
354
- /<style>/,
355
- /\$:/,
356
- /\bonMount\b/,
357
- /\bafterUpdate\b/,
358
- /\bbeforeUpdate\b/,
359
- /\bonDestroy\b/,
360
- /\btick\b/,
361
- /from\s+['"]svelte['"]/,
362
- /import\s+.*\s+from\s+['"]svelte['"]/,
363
- ],
364
- jsxPragmas: ['@jsxImportSource svelte'],
365
- },
366
- },
367
- react: {
368
- name: 'react',
369
- fileExtensions: ['.jsx', '.tsx'],
370
- jsxImportSources: ['react'],
371
- ssrModules: ['react-dom/server'],
372
- hydrationModules: ['react-dom/client'],
373
- detectionPatterns: {
374
- imports: [
375
- /^react$/,
376
- /^react\//,
377
- /^react-dom$/,
378
- /^react-dom\//,
379
- /from\s+['"]react['"]/,
380
- /from\s+['"]react\/[^'"]+['"]/,
381
- /from\s+['"]react-dom['"]/,
382
- ],
383
- content: [
384
- /\buseState\b/,
385
- /\buseEffect\b/,
386
- /\buseContext\b/,
387
- /\buseReducer\b/,
388
- /\buseCallback\b/,
389
- /\buseMemo\b/,
390
- /\buseRef\b/,
391
- /\buseTransition\b/,
392
- /\buseDeferredValue\b/,
393
- /\buseId\b/,
394
- /\buseImperativeHandle\b/,
395
- /\buseLayoutEffect\b/,
396
- /["']use client["']/,
397
- /["']use server["']/,
398
- /from\s+['"]react['"]/,
399
- /import\s+.*\s+from\s+['"]react['"]/,
400
- ],
401
- jsxPragmas: ['@jsxImportSource react'],
402
- },
403
- },
404
- lit: {
405
- name: 'lit',
406
- fileExtensions: ['.ts', '.js'],
407
- jsxImportSources: ['lit'],
408
- ssrModules: ['@lit-labs/ssr'],
409
- hydrationModules: ['lit'],
410
- detectionPatterns: {
411
- imports: [
412
- /^lit$/,
413
- /^lit\//,
414
- /^@lit\//,
415
- /^@lit-labs\/ssr/,
416
- /from\s+['"]lit['"]/,
417
- /from\s+['"]lit\/[^'"]+['"]/,
418
- /from\s+['"]@lit\/[^'"]+['"]/,
419
- ],
420
- content: [
421
- /\bLitElement\b/,
422
- /\bcustomElement\b/,
423
- /@customElement/,
424
- /@property/,
425
- /@state/,
426
- /@query/,
427
- /@queryAll/,
428
- /\bhtml`/,
429
- /\bcss`/,
430
- /extends\s+LitElement/,
431
- /from\s+['"]lit['"]/,
432
- /import\s+.*\s+from\s+['"]lit['"]/,
433
- ],
434
- jsxPragmas: ['@jsxImportSource lit'],
435
- },
436
- },
437
- qwik: {
438
- name: 'qwik',
439
- fileExtensions: ['.tsx', '.jsx'],
440
- jsxImportSources: ['@builder.io/qwik'],
441
- ssrModules: ['@builder.io/qwik/server'],
442
- hydrationModules: ['@builder.io/qwik'],
443
- detectionPatterns: {
444
- imports: [
445
- /^@builder\.io\/qwik$/,
446
- /^@builder\.io\/qwik\//,
447
- /from\s+['"]@builder\.io\/qwik['"]/,
448
- /from\s+['"]@builder\.io\/qwik\/[^'"]+['"]/,
449
- ],
450
- content: [
451
- /\bcomponent\$/,
452
- /\buseSignal\b/,
453
- /\buseStore\b/,
454
- /\buseTask\$/,
455
- /\buseVisibleTask\$/,
456
- /\buseResource\$/,
457
- /\buseContext\b/,
458
- /\$\(\s*\(/,
459
- /from\s+['"]@builder\.io\/qwik['"]/,
460
- /import\s+.*\s+from\s+['"]@builder\.io\/qwik['"]/,
461
- ],
462
- jsxPragmas: ['@jsxImportSource @builder.io/qwik'],
463
- },
464
- },
465
- };
466
- }
467
-
468
- /**
469
- * Exports the current registry configuration
470
- */
471
- exportConfig(): Record<string, FrameworkConfig> {
472
- const config: Record<string, FrameworkConfig> = {};
473
-
474
- for (const [name, frameworkConfig] of this.frameworks) {
475
- config[name] = { ...frameworkConfig };
476
- }
477
-
478
- return config;
479
- }
480
-
481
- /**
482
- * Imports a registry configuration
483
- */
484
- importConfig(config: Record<string, FrameworkConfig>): FrameworkValidationResult[] {
485
- const results: FrameworkValidationResult[] = [];
486
-
487
- for (const [name, frameworkConfig] of Object.entries(config)) {
488
- const result = this.registerFramework(name, frameworkConfig);
489
- results.push(result);
490
- }
491
-
492
- return results;
493
- }
494
-
495
- /**
496
- * Resets the registry to default frameworks only
497
- */
498
- reset(): void {
499
- this.frameworks.clear();
500
- this.initializeDefaultFrameworks();
501
- }
502
-
503
- /**
504
- * Gets registry statistics
505
- */
506
- getStats(): {
507
- totalFrameworks: number;
508
- defaultFrameworks: number;
509
- customFrameworks: number;
510
- supportedExtensions: string[];
511
- } {
512
- const defaultFrameworkNames = new Set(['preact', 'solid', 'vue', 'svelte', 'react', 'lit', 'qwik']);
513
- const defaultCount = Array.from(this.frameworks.keys()).filter(name => defaultFrameworkNames.has(name)).length;
514
-
515
- const allExtensions = new Set<string>();
516
- for (const config of this.frameworks.values()) {
517
- config.fileExtensions.forEach(ext => allExtensions.add(ext));
518
- }
519
-
520
- return {
521
- totalFrameworks: this.frameworks.size,
522
- defaultFrameworks: defaultCount,
523
- customFrameworks: this.frameworks.size - defaultCount,
524
- supportedExtensions: Array.from(allExtensions).sort((a, b) => a.localeCompare(b)),
525
- };
526
- }
527
- }
528
-
529
- /**
530
- * Default framework registry instance
531
- */
532
- export const defaultFrameworkRegistry = new FrameworkRegistry();
533
-
534
- /**
535
- * Utility function to create a framework configuration
536
- */
537
- export function createFrameworkConfig(
538
- name: string,
539
- options: {
540
- fileExtensions: string[];
541
- jsxImportSources?: string[];
542
- ssrModules: string[];
543
- hydrationModules: string[];
544
- importPatterns: (string | RegExp)[];
545
- contentPatterns?: (string | RegExp)[];
546
- jsxPragmas?: string[];
547
- }
548
- ): FrameworkConfig {
549
- return {
550
- name,
551
- fileExtensions: options.fileExtensions,
552
- jsxImportSources: options.jsxImportSources || [],
553
- ssrModules: options.ssrModules,
554
- hydrationModules: options.hydrationModules,
555
- detectionPatterns: {
556
- imports: options.importPatterns.map(pattern => (typeof pattern === 'string' ? new RegExp(pattern) : pattern)),
557
- content: (options.contentPatterns || []).map(pattern =>
558
- typeof pattern === 'string' ? new RegExp(pattern) : pattern
559
- ),
560
- jsxPragmas: options.jsxPragmas || [],
561
- },
562
- };
563
- }
@@ -1,46 +0,0 @@
1
- import { extname } from 'node:path';
2
- import { readFile } from 'node:fs/promises';
3
- import { h } from 'preact';
4
- import { marked } from 'marked';
5
- import type { RoutePageModule } from '../../schemas/routing.ts';
6
-
7
- /**
8
- * Server-side MDX processor for handling MDX files in the routing system
9
- */
10
- export class MDXProcessor {
11
- /**
12
- * Process an MDX file and return a valid page module
13
- */
14
- async processMDXFile(filePath: string): Promise<RoutePageModule> {
15
- try {
16
- // Read the MDX file content
17
- const content = await readFile(filePath, 'utf-8');
18
-
19
- // Process markdown content using marked library
20
- const component = () => {
21
- const htmlContent = marked(content);
22
- return h('div', {
23
- dangerouslySetInnerHTML: { __html: htmlContent },
24
- });
25
- };
26
-
27
- // Return a module-like object that matches RoutePageModule interface
28
- return {
29
- default: component,
30
- // Add any other required exports
31
- };
32
- } catch (error) {
33
- throw new Error(
34
- `Failed to process MDX file ${filePath}: ${error instanceof Error ? error.message : String(error)}`
35
- );
36
- }
37
- }
38
-
39
- /**
40
- * Check if a file is an MDX file
41
- */
42
- static isMDXFile(filePath: string): boolean {
43
- const ext = extname(filePath);
44
- return ext === '.mdx' || ext === '.md';
45
- }
46
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * Integration system exports
3
- * Central export point for all integration-related functionality
4
- */
5
-
6
- // Registry
7
- export { IntegrationRegistry, registry } from "./registry.ts";
8
-
9
- // Loader
10
- export {
11
- loadIntegration,
12
- detectAndLoadIntegration,
13
- detectFrameworkFromPath,
14
- detectFrameworkFromContent,
15
- preloadIntegrations,
16
- getLoadedIntegrations,
17
- clearIntegrationCache,
18
- isIntegrationLoaded,
19
- } from "./loader.ts";