@useavalon/avalon 0.1.5 → 0.1.7

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 (39) hide show
  1. package/package.json +31 -58
  2. package/src/build/prop-extractors/index.ts +11 -11
  3. package/src/build/prop-extractors/lit.ts +1 -1
  4. package/src/build/prop-extractors/qwik.ts +2 -2
  5. package/src/build/prop-extractors/solid.ts +1 -1
  6. package/src/build/prop-extractors/svelte.ts +1 -1
  7. package/src/schemas/routing.ts +2 -2
  8. package/src/vite-plugin/nitro-integration.ts +1 -1
  9. package/src/vite-plugin/plugin.ts +20 -16
  10. package/src/build/README.md +0 -310
  11. package/src/client/tests/css-hmr-handler.test.ts +0 -360
  12. package/src/client/tests/framework-adapter.test.ts +0 -519
  13. package/src/client/tests/hmr-coordinator.test.ts +0 -176
  14. package/src/client/tests/hydration-option-parsing.test.ts +0 -107
  15. package/src/client/tests/lit-adapter.test.ts +0 -427
  16. package/src/client/tests/preact-adapter.test.ts +0 -353
  17. package/src/client/tests/qwik-adapter.test.ts +0 -343
  18. package/src/client/tests/react-adapter.test.ts +0 -317
  19. package/src/client/tests/solid-adapter.test.ts +0 -396
  20. package/src/client/tests/svelte-adapter.test.ts +0 -387
  21. package/src/client/tests/vue-adapter.test.ts +0 -407
  22. package/src/components/tests/component-analyzer.test.ts +0 -96
  23. package/src/components/tests/component-detection.test.ts +0 -347
  24. package/src/components/tests/persistent-islands.test.ts +0 -398
  25. package/src/core/components/tests/enhanced-framework-detector.test.ts +0 -577
  26. package/src/core/components/tests/framework-registry.test.ts +0 -465
  27. package/src/core/integrations/README.md +0 -282
  28. package/src/core/layout/tests/enhanced-layout-resolver.test.ts +0 -477
  29. package/src/core/layout/tests/layout-cache-optimization.test.ts +0 -149
  30. package/src/core/layout/tests/layout-composer.test.ts +0 -486
  31. package/src/core/layout/tests/layout-data-loader.test.ts +0 -443
  32. package/src/core/layout/tests/layout-discovery.test.ts +0 -253
  33. package/src/core/layout/tests/layout-matcher.test.ts +0 -480
  34. package/src/core/modules/tests/framework-module-resolver.test.ts +0 -263
  35. package/src/core/modules/tests/module-resolution-integration.test.ts +0 -117
  36. package/src/islands/discovery/tests/island-discovery.test.ts +0 -881
  37. package/src/middleware/__tests__/discovery.test.ts +0 -107
  38. package/src/types/tests/layout-types.test.ts +0 -197
  39. package/src/vite-plugin/tests/image-optimization.test.ts +0 -54
@@ -1,282 +0,0 @@
1
- # Integration System
2
-
3
- The Avalon integration system provides a modular, extensible architecture for framework integrations. Each framework (Preact, Vue, Solid, Svelte) is an independent package with its own versioning and dependencies.
4
-
5
- ## Architecture
6
-
7
- ```
8
- src/core/integrations/
9
- ├── registry.ts # Integration registry for managing loaded integrations
10
- ├── loader.ts # Dynamic integration loading with caching
11
- ├── validator.ts # Integration validation and compliance checking
12
- ├── config-loader.ts # Configuration file loading and parsing
13
- ├── startup.ts # System initialization and validation
14
- ├── cli.ts # CLI commands for managing integrations
15
- └── index.ts # Public API exports
16
- ```
17
-
18
- ## Key Components
19
-
20
- ### Registry (`registry.ts`)
21
-
22
- The `IntegrationRegistry` manages loaded framework integrations:
23
-
24
- ```typescript
25
- import { registry } from "./src/core/integrations/registry.ts";
26
-
27
- // Load an integration
28
- const integration = await registry.load("preact");
29
-
30
- // Check if loaded
31
- if (registry.has("preact")) {
32
- const preact = registry.get("preact");
33
- }
34
-
35
- // Get all loaded integrations
36
- const all = registry.getAll();
37
- ```
38
-
39
- ### Loader (`loader.ts`)
40
-
41
- Dynamic integration loading with caching:
42
-
43
- ```typescript
44
- import { loadIntegration } from "./src/core/integrations/loader.ts";
45
-
46
- // Load integration (cached)
47
- const integration = await loadIntegration("vue");
48
-
49
- // Preload multiple integrations
50
- await preloadIntegrations(["preact", "vue", "solid"]);
51
-
52
- // Check if loaded
53
- if (isIntegrationLoaded("svelte")) {
54
- // ...
55
- }
56
- ```
57
-
58
- ### Validator (`validator.ts`)
59
-
60
- Validate integrations against the required interface:
61
-
62
- ```typescript
63
- import { validateIntegration } from "./src/core/integrations/validator.ts";
64
-
65
- const result = validateIntegration(integration);
66
-
67
- if (result.valid) {
68
- console.log("Integration is valid");
69
- } else {
70
- console.error("Errors:", result.errors);
71
- console.warn("Warnings:", result.warnings);
72
- }
73
- ```
74
-
75
- ### Configuration (`config-loader.ts`)
76
-
77
- Load and parse `avalon.config.ts`:
78
-
79
- ```typescript
80
- import { loadConfig } from "./src/core/integrations/config-loader.ts";
81
-
82
- const result = await loadConfig();
83
-
84
- if (result.found) {
85
- console.log("Config:", result.config);
86
- console.log("Path:", result.configPath);
87
- }
88
- ```
89
-
90
- ### Startup (`startup.ts`)
91
-
92
- Initialize the integration system:
93
-
94
- ```typescript
95
- import { initializeIntegrations } from "./src/core/integrations/startup.ts";
96
-
97
- const result = await initializeIntegrations();
98
-
99
- if (result.success) {
100
- console.log("Loaded:", result.loadedIntegrations);
101
- } else {
102
- console.error("Errors:", result.errors);
103
- }
104
- ```
105
-
106
- ## Configuration
107
-
108
- Create an `avalon.config.ts` file in your project root:
109
-
110
- ```typescript
111
- export default {
112
- integrations: [
113
- { name: "preact", enabled: true },
114
- { name: "vue", enabled: true },
115
- { name: "solid", enabled: true },
116
- { name: "svelte", enabled: true },
117
- ],
118
- autoDiscoverIntegrations: true,
119
- validateIntegrations: true,
120
- showWarnings: true,
121
- };
122
- ```
123
-
124
- See [Integration Configuration](../../../docs/integration-configuration.md) for full documentation.
125
-
126
- ## CLI Commands
127
-
128
- ```bash
129
- # List integrations
130
- deno run --allow-read --allow-env src/core/integrations/cli.ts list
131
-
132
- # Initialize system
133
- deno run --allow-read --allow-env src/core/integrations/cli.ts init
134
-
135
- # Validate integrations
136
- deno run --allow-read --allow-env src/core/integrations/cli.ts validate
137
-
138
- # Show integration info
139
- deno run --allow-read --allow-env src/core/integrations/cli.ts info preact
140
-
141
- # Generate config file
142
- deno run --allow-read --allow-write src/core/integrations/cli.ts generate-config
143
- ```
144
-
145
- ## Error Handling
146
-
147
- The system provides helpful error messages:
148
-
149
- ### Missing Integration
150
-
151
- ```typescript
152
- try {
153
- await loadIntegration("vue");
154
- } catch (error) {
155
- // Error includes installation instructions
156
- console.error(error.message);
157
- }
158
- ```
159
-
160
- ### Validation Errors
161
-
162
- ```typescript
163
- const result = validateIntegration(integration);
164
-
165
- if (!result.valid) {
166
- // Detailed error messages
167
- result.errors.forEach(error => console.error(error));
168
- }
169
- ```
170
-
171
- ### Configuration Errors
172
-
173
- ```typescript
174
- const config = await loadConfig();
175
-
176
- if (config.errors.length > 0) {
177
- // Configuration validation errors
178
- config.errors.forEach(error => console.error(error));
179
- }
180
- ```
181
-
182
- ## Integration Discovery
183
-
184
- The system supports multiple discovery methods:
185
-
186
- ### 1. Explicit Configuration
187
-
188
- List integrations in `avalon.config.ts`:
189
-
190
- ```typescript
191
- export default {
192
- integrations: [
193
- { name: "preact", enabled: true },
194
- ],
195
- };
196
- ```
197
-
198
- ### 2. Auto-Discovery
199
-
200
- Enable auto-discovery to load integrations based on usage:
201
-
202
- ```typescript
203
- export default {
204
- autoDiscoverIntegrations: true,
205
- };
206
- ```
207
-
208
- ### 3. Manual Loading
209
-
210
- Load integrations programmatically:
211
-
212
- ```typescript
213
- import { loadIntegration } from "./src/core/integrations/loader.ts";
214
-
215
- const integration = await loadIntegration("solid");
216
- ```
217
-
218
- ## Validation
219
-
220
- Integrations are validated to ensure they implement the required interface:
221
-
222
- ```typescript
223
- interface Integration {
224
- name: string;
225
- version: string;
226
- render(params: RenderParams): Promise<RenderResult>;
227
- getHydrationScript(): string;
228
- config(): IntegrationConfig;
229
- vitePlugin?(): any | any[];
230
- }
231
- ```
232
-
233
- Validation checks:
234
- - Required properties exist and have correct types
235
- - Required methods are functions
236
- - Configuration is valid
237
- - Detection patterns are RegExp objects
238
-
239
- ## Best Practices
240
-
241
- ### Development
242
-
243
- ```typescript
244
- export default {
245
- autoDiscoverIntegrations: true, // Flexible
246
- validateIntegrations: true, // Catch issues early
247
- showWarnings: true, // See all issues
248
- };
249
- ```
250
-
251
- ### Production
252
-
253
- ```typescript
254
- export default {
255
- integrations: [
256
- // Only list what you use
257
- { name: "preact", enabled: true },
258
- ],
259
- autoDiscoverIntegrations: false, // Explicit control
260
- validateIntegrations: true, // Ensure compatibility
261
- showWarnings: false, // Clean logs
262
- };
263
- ```
264
-
265
- ## Testing
266
-
267
- Test the configuration system:
268
-
269
- ```bash
270
- deno run --allow-read --allow-env src/core/integrations/test-config.ts
271
- ```
272
-
273
- ## API Reference
274
-
275
- See [Integration Configuration](../../../docs/integration-configuration.md) for complete API documentation.
276
-
277
- ## Related Documentation
278
-
279
- - [Integration System Design](../../../.kiro/specs/framework-integrations/design.md)
280
- - [Integration Requirements](../../../.kiro/specs/framework-integrations/requirements.md)
281
- - [Integration Configuration](../../../docs/integration-configuration.md)
282
- - [Creating Custom Integrations](../../../docs/custom-integrations.md)