@flightdev/ui 2.0.0 → 4.0.0
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.
- package/README.md +285 -70
- package/dist/{chunk-XTDK7ME5.js → chunk-S4DTUQII.js} +246 -19
- package/dist/chunk-S4DTUQII.js.map +1 -0
- package/dist/core/index.d.ts +423 -3
- package/dist/core/index.js +23 -2
- package/dist/core/index.js.map +1 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.js +29 -5
- package/dist/index.js.map +1 -0
- package/package.json +11 -181
- package/.turbo/turbo-build.log +0 -81
- package/.turbo/turbo-lint.log +0 -40
- package/.turbo/turbo-typecheck.log +0 -4
- package/TESTING.md +0 -124
- package/dist/adapter-MMD-iHNx.d.ts +0 -424
- package/dist/adapters/tier-1/angular.d.ts +0 -60
- package/dist/adapters/tier-1/angular.js +0 -2
- package/dist/adapters/tier-1/index.d.ts +0 -7
- package/dist/adapters/tier-1/index.js +0 -7
- package/dist/adapters/tier-1/qwik.d.ts +0 -55
- package/dist/adapters/tier-1/qwik.js +0 -2
- package/dist/adapters/tier-1/react.d.ts +0 -67
- package/dist/adapters/tier-1/react.js +0 -2
- package/dist/adapters/tier-1/solid.d.ts +0 -45
- package/dist/adapters/tier-1/solid.js +0 -2
- package/dist/adapters/tier-1/svelte.d.ts +0 -48
- package/dist/adapters/tier-1/svelte.js +0 -2
- package/dist/adapters/tier-1/vue.d.ts +0 -47
- package/dist/adapters/tier-1/vue.js +0 -2
- package/dist/adapters/tier-2/index.d.ts +0 -7
- package/dist/adapters/tier-2/index.js +0 -7
- package/dist/adapters/tier-2/inferno.d.ts +0 -31
- package/dist/adapters/tier-2/inferno.js +0 -2
- package/dist/adapters/tier-2/lit.d.ts +0 -34
- package/dist/adapters/tier-2/lit.js +0 -2
- package/dist/adapters/tier-2/marko.d.ts +0 -59
- package/dist/adapters/tier-2/marko.js +0 -2
- package/dist/adapters/tier-2/mithril.d.ts +0 -31
- package/dist/adapters/tier-2/mithril.js +0 -2
- package/dist/adapters/tier-2/preact.d.ts +0 -33
- package/dist/adapters/tier-2/preact.js +0 -2
- package/dist/adapters/tier-2/stencil.d.ts +0 -52
- package/dist/adapters/tier-2/stencil.js +0 -2
- package/dist/adapters/tier-3/alpine.d.ts +0 -73
- package/dist/adapters/tier-3/alpine.js +0 -2
- package/dist/adapters/tier-3/hotwire.d.ts +0 -71
- package/dist/adapters/tier-3/hotwire.js +0 -2
- package/dist/adapters/tier-3/htmx.d.ts +0 -88
- package/dist/adapters/tier-3/htmx.js +0 -2
- package/dist/adapters/tier-3/index.d.ts +0 -7
- package/dist/adapters/tier-3/index.js +0 -7
- package/dist/adapters/tier-3/petite-vue.d.ts +0 -56
- package/dist/adapters/tier-3/petite-vue.js +0 -2
- package/dist/adapters/tier-3/stimulus.d.ts +0 -63
- package/dist/adapters/tier-3/stimulus.js +0 -2
- package/dist/adapters/tier-3/vanilla.d.ts +0 -63
- package/dist/adapters/tier-3/vanilla.js +0 -2
- package/dist/chunk-2SNQ6PTM.js +0 -217
- package/dist/chunk-3D4XMIZI.js +0 -136
- package/dist/chunk-3HU6GSQ4.js +0 -125
- package/dist/chunk-4PZDNFL7.js +0 -148
- package/dist/chunk-5IBLFTYL.js +0 -114
- package/dist/chunk-64JZJ7OK.js +0 -142
- package/dist/chunk-7ZJI3QU2.js +0 -132
- package/dist/chunk-CE4FJHQJ.js +0 -133
- package/dist/chunk-DTCAUBH5.js +0 -87
- package/dist/chunk-NTASPOHG.js +0 -106
- package/dist/chunk-OI2AMQLG.js +0 -152
- package/dist/chunk-Q7HUE44H.js +0 -106
- package/dist/chunk-QH3LOWXU.js +0 -155
- package/dist/chunk-QIVAK6BH.js +0 -103
- package/dist/chunk-V34XPVGK.js +0 -103
- package/dist/chunk-VK7ZPMO7.js +0 -221
- package/dist/chunk-X6CNUW6T.js +0 -136
- package/dist/chunk-YFGSHW5S.js +0 -121
- package/dist/chunk-ZAJVSE7J.js +0 -90
- package/docs/ADAPTERS.md +0 -946
- package/docs/PATTERNS.md +0 -836
- package/src/adapters/tier-1/angular.ts +0 -223
- package/src/adapters/tier-1/index.ts +0 -12
- package/src/adapters/tier-1/qwik.ts +0 -177
- package/src/adapters/tier-1/react.ts +0 -330
- package/src/adapters/tier-1/solid.ts +0 -222
- package/src/adapters/tier-1/svelte.ts +0 -211
- package/src/adapters/tier-1/vue.ts +0 -234
- package/src/adapters/tier-2/index.ts +0 -12
- package/src/adapters/tier-2/inferno.ts +0 -149
- package/src/adapters/tier-2/lit.ts +0 -191
- package/src/adapters/tier-2/marko.ts +0 -199
- package/src/adapters/tier-2/mithril.ts +0 -152
- package/src/adapters/tier-2/preact.ts +0 -133
- package/src/adapters/tier-2/stencil.ts +0 -214
- package/src/adapters/tier-3/alpine.ts +0 -218
- package/src/adapters/tier-3/hotwire.ts +0 -254
- package/src/adapters/tier-3/htmx.ts +0 -263
- package/src/adapters/tier-3/index.ts +0 -12
- package/src/adapters/tier-3/petite-vue.ts +0 -163
- package/src/adapters/tier-3/stimulus.ts +0 -233
- package/src/adapters/tier-3/vanilla.ts +0 -252
- package/src/ambient.d.ts +0 -310
- package/src/core/adapter.ts +0 -366
- package/src/core/index.ts +0 -56
- package/src/core/registry.ts +0 -518
- package/src/core/types.ts +0 -461
- package/src/htmx.ts +0 -134
- package/src/index.ts +0 -263
- package/test/__mocks__/stencil-core.ts +0 -19
- package/test/__mocks__/stencil-hydrate.ts +0 -15
- package/test/adapters/tier-1.test.ts +0 -206
- package/test/adapters/tier-2.test.ts +0 -175
- package/test/adapters/tier-3.test.ts +0 -284
- package/test/contracts/adapter.contract.ts +0 -293
- package/test/core/core.test.ts +0 -310
- package/test/errors/error-handling.test.ts +0 -454
- package/test/integration/htmx.integration.test.ts +0 -246
- package/test/integration/react.integration.test.ts +0 -271
- package/test/integration/registry.integration.test.ts +0 -308
- package/tsconfig.json +0 -22
- package/tsup.config.ts +0 -93
- package/vitest.config.ts +0 -101
package/src/index.ts
DELETED
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @flightdev/ui - Universal UI Framework Layer
|
|
3
|
-
*
|
|
4
|
-
* Universal SSR and hydration for 18+ UI frameworks.
|
|
5
|
-
* From React to Angular, Vue to HTMX, Svelte to Web Components.
|
|
6
|
-
*
|
|
7
|
-
* @module @flightdev/ui
|
|
8
|
-
* @version 2.0.0
|
|
9
|
-
*
|
|
10
|
-
* @example Basic Usage
|
|
11
|
-
* ```typescript
|
|
12
|
-
* import { defineUI } from '@flightdev/ui';
|
|
13
|
-
* import { react } from '@flightdev/ui/react';
|
|
14
|
-
*
|
|
15
|
-
* export default defineUI(react());
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* @example With Streaming SSR
|
|
19
|
-
* ```typescript
|
|
20
|
-
* import { defineUI } from '@flightdev/ui';
|
|
21
|
-
* import { react } from '@flightdev/ui/react';
|
|
22
|
-
*
|
|
23
|
-
* export default defineUI(react(), {
|
|
24
|
-
* streaming: true,
|
|
25
|
-
* hydration: 'progressive',
|
|
26
|
-
* });
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @example Using Adapter Registry
|
|
30
|
-
* ```typescript
|
|
31
|
-
* import { adapterRegistry } from '@flightdev/ui';
|
|
32
|
-
*
|
|
33
|
-
* // Get adapter dynamically
|
|
34
|
-
* const adapter = await adapterRegistry.get('vue');
|
|
35
|
-
*
|
|
36
|
-
* // List all by tier
|
|
37
|
-
* const tier1 = adapterRegistry.listByTier('tier-1');
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
// ============================================================================
|
|
42
|
-
// Core Types & Utilities
|
|
43
|
-
// ============================================================================
|
|
44
|
-
|
|
45
|
-
export type {
|
|
46
|
-
// Capability System
|
|
47
|
-
AdapterCapabilities,
|
|
48
|
-
AdapterTier,
|
|
49
|
-
TierInfo,
|
|
50
|
-
|
|
51
|
-
// Component & Rendering
|
|
52
|
-
Component,
|
|
53
|
-
ComponentProps,
|
|
54
|
-
RenderContext,
|
|
55
|
-
RenderResult,
|
|
56
|
-
RenderTiming,
|
|
57
|
-
|
|
58
|
-
// Streaming
|
|
59
|
-
StreamingOptions,
|
|
60
|
-
StreamingRenderResult,
|
|
61
|
-
|
|
62
|
-
// Islands Architecture
|
|
63
|
-
IslandHydrationStrategy,
|
|
64
|
-
IslandOptions,
|
|
65
|
-
Island,
|
|
66
|
-
|
|
67
|
-
// Adapter Interfaces
|
|
68
|
-
UIAdapterV2,
|
|
69
|
-
UIAdapterV1,
|
|
70
|
-
UIAdapter,
|
|
71
|
-
UIConfig,
|
|
72
|
-
|
|
73
|
-
// Utility Types
|
|
74
|
-
HasCapability,
|
|
75
|
-
} from './core/types.js';
|
|
76
|
-
|
|
77
|
-
export {
|
|
78
|
-
DEFAULT_CAPABILITIES,
|
|
79
|
-
TIER_INFO,
|
|
80
|
-
} from './core/types.js';
|
|
81
|
-
|
|
82
|
-
// Base Adapter & Utilities
|
|
83
|
-
export {
|
|
84
|
-
BaseUIAdapter,
|
|
85
|
-
wrapV1Adapter,
|
|
86
|
-
isV2Adapter,
|
|
87
|
-
hasCapability,
|
|
88
|
-
getCapabilities,
|
|
89
|
-
} from './core/adapter.js';
|
|
90
|
-
|
|
91
|
-
// Registry
|
|
92
|
-
export type {
|
|
93
|
-
AdapterLoader,
|
|
94
|
-
AdapterMetadata,
|
|
95
|
-
RegistryQueryOptions,
|
|
96
|
-
} from './core/registry.js';
|
|
97
|
-
|
|
98
|
-
export {
|
|
99
|
-
adapterRegistry,
|
|
100
|
-
registerBuiltinAdapters,
|
|
101
|
-
} from './core/registry.js';
|
|
102
|
-
|
|
103
|
-
// ============================================================================
|
|
104
|
-
// Factory Function
|
|
105
|
-
// ============================================================================
|
|
106
|
-
|
|
107
|
-
import type { UIAdapterV2, UIAdapterV1, UIConfig, IslandHydrationStrategy } from './core/types.js';
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Define UI configuration for Flight.
|
|
111
|
-
*
|
|
112
|
-
* @example
|
|
113
|
-
* ```typescript
|
|
114
|
-
* import { defineUI } from '@flightdev/ui';
|
|
115
|
-
* import { react } from '@flightdev/ui/react';
|
|
116
|
-
*
|
|
117
|
-
* export const ui = defineUI(react(), {
|
|
118
|
-
* streaming: true,
|
|
119
|
-
* hydration: 'progressive',
|
|
120
|
-
* });
|
|
121
|
-
* ```
|
|
122
|
-
*/
|
|
123
|
-
export function defineUI(
|
|
124
|
-
adapter: UIAdapterV2 | UIAdapterV1,
|
|
125
|
-
options: {
|
|
126
|
-
streaming?: boolean;
|
|
127
|
-
hydration?: 'full' | 'partial' | 'progressive' | 'none';
|
|
128
|
-
islands?: boolean;
|
|
129
|
-
defaultIslandStrategy?: IslandHydrationStrategy;
|
|
130
|
-
} = {}
|
|
131
|
-
): UIConfig {
|
|
132
|
-
return {
|
|
133
|
-
adapter,
|
|
134
|
-
streaming: options.streaming ?? false,
|
|
135
|
-
hydration: options.hydration ?? 'full',
|
|
136
|
-
islands: options.islands ?? false,
|
|
137
|
-
defaultIslandStrategy: options.defaultIslandStrategy ?? 'idle',
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// ============================================================================
|
|
142
|
-
// Render Utilities
|
|
143
|
-
// ============================================================================
|
|
144
|
-
|
|
145
|
-
import type { Component, RenderResult, RenderContext } from './core/types.js';
|
|
146
|
-
import { isV2Adapter } from './core/adapter.js';
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Render a page with the configured UI adapter.
|
|
150
|
-
*/
|
|
151
|
-
export async function renderPage(
|
|
152
|
-
config: UIConfig,
|
|
153
|
-
component: Component,
|
|
154
|
-
context?: RenderContext
|
|
155
|
-
): Promise<RenderResult> {
|
|
156
|
-
const result = await config.adapter.renderToString(component, context);
|
|
157
|
-
|
|
158
|
-
// Add hydration script if needed
|
|
159
|
-
if (config.hydration !== 'none') {
|
|
160
|
-
const hydrationScript = config.adapter.getHydrationScript(result);
|
|
161
|
-
result.scripts = [...(result.scripts ?? []), hydrationScript];
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
return result;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Render a page as a stream (if adapter supports streaming).
|
|
169
|
-
*/
|
|
170
|
-
export function renderPageStream(
|
|
171
|
-
config: UIConfig,
|
|
172
|
-
component: Component,
|
|
173
|
-
context?: RenderContext
|
|
174
|
-
): ReadableStream<Uint8Array> | null {
|
|
175
|
-
if (!isV2Adapter(config.adapter) || !config.adapter.capabilities.streaming) {
|
|
176
|
-
return null;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
const streamResult = config.adapter.renderToStream?.(component, context);
|
|
180
|
-
return streamResult?.stream ?? null;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Generate full HTML document from render result.
|
|
185
|
-
*/
|
|
186
|
-
export function toHTML(
|
|
187
|
-
result: RenderResult,
|
|
188
|
-
options: {
|
|
189
|
-
lang?: string;
|
|
190
|
-
title?: string;
|
|
191
|
-
meta?: Record<string, string>;
|
|
192
|
-
charset?: string;
|
|
193
|
-
viewport?: string;
|
|
194
|
-
} = {}
|
|
195
|
-
): string {
|
|
196
|
-
const {
|
|
197
|
-
lang = 'en',
|
|
198
|
-
title = 'Flight App',
|
|
199
|
-
meta = {},
|
|
200
|
-
charset = 'UTF-8',
|
|
201
|
-
viewport = 'width=device-width, initial-scale=1.0',
|
|
202
|
-
} = options;
|
|
203
|
-
|
|
204
|
-
const metaTags = Object.entries(meta)
|
|
205
|
-
.map(([name, content]) => `<meta name="${name}" content="${content}">`)
|
|
206
|
-
.join('\n ');
|
|
207
|
-
|
|
208
|
-
const scripts = result.scripts
|
|
209
|
-
?.map((s) => (s.startsWith('<script') ? s : `<script>${s}</script>`))
|
|
210
|
-
.join('\n ') ?? '';
|
|
211
|
-
|
|
212
|
-
return `<!DOCTYPE html>
|
|
213
|
-
<html lang="${lang}">
|
|
214
|
-
<head>
|
|
215
|
-
<meta charset="${charset}">
|
|
216
|
-
<meta name="viewport" content="${viewport}">
|
|
217
|
-
<title>${title}</title>
|
|
218
|
-
${metaTags}
|
|
219
|
-
${result.head ?? ''}
|
|
220
|
-
${result.css ? `<style>${result.css}</style>` : ''}
|
|
221
|
-
</head>
|
|
222
|
-
<body>
|
|
223
|
-
<div id="app">${result.html}</div>
|
|
224
|
-
${scripts}
|
|
225
|
-
</body>
|
|
226
|
-
</html>`;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// ============================================================================
|
|
230
|
-
// Convenience Re-exports (Backward Compatibility)
|
|
231
|
-
// ============================================================================
|
|
232
|
-
|
|
233
|
-
// These maintain backward compatibility with v1 imports
|
|
234
|
-
// e.g., import { react } from '@flightdev/ui'
|
|
235
|
-
|
|
236
|
-
// Note: For tree-shaking, prefer deep imports:
|
|
237
|
-
// import { react } from '@flightdev/ui/react'
|
|
238
|
-
|
|
239
|
-
// ============================================================================
|
|
240
|
-
// Version & Info
|
|
241
|
-
// ============================================================================
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Package version
|
|
245
|
-
*/
|
|
246
|
-
export const VERSION = '2.0.0';
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* Get information about the UI package
|
|
250
|
-
*/
|
|
251
|
-
export function getPackageInfo() {
|
|
252
|
-
return {
|
|
253
|
-
name: '@flightdev/ui',
|
|
254
|
-
version: VERSION,
|
|
255
|
-
description: 'Universal UI Framework Layer - SSR/hydration for 18+ frameworks',
|
|
256
|
-
tiers: {
|
|
257
|
-
'tier-1': ['react', 'vue', 'angular', 'svelte', 'solid', 'qwik'],
|
|
258
|
-
'tier-2': ['preact', 'lit', 'marko', 'stencil', 'mithril', 'inferno'],
|
|
259
|
-
'tier-3': ['htmx', 'alpine', 'hotwire', 'stimulus', 'petite-vue', 'vanilla'],
|
|
260
|
-
},
|
|
261
|
-
totalAdapters: 18,
|
|
262
|
-
};
|
|
263
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mock for @stencil/core
|
|
3
|
-
* Provides minimal stubs for Stencil components to allow tests to run
|
|
4
|
-
* without the actual @stencil/core package installed.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export const Component = () => (target: unknown) => target;
|
|
8
|
-
export const Prop = () => (target: unknown, key: string) => { };
|
|
9
|
-
export const h = (tag: string, props?: unknown, ...children: unknown[]) => ({
|
|
10
|
-
tag,
|
|
11
|
-
props,
|
|
12
|
-
children,
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export default {
|
|
16
|
-
Component,
|
|
17
|
-
Prop,
|
|
18
|
-
h,
|
|
19
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mock for @stencil/core/hydrate
|
|
3
|
-
* Used during tests when the actual package is not available
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export async function renderToString(
|
|
7
|
-
_html: string,
|
|
8
|
-
_options?: {
|
|
9
|
-
fullDocument?: boolean;
|
|
10
|
-
prettyHtml?: boolean;
|
|
11
|
-
serializeShadowRoot?: string;
|
|
12
|
-
}
|
|
13
|
-
): Promise<{ html: string }> {
|
|
14
|
-
return { html: '<mock-stencil>Mocked Stencil Output</mock-stencil>' };
|
|
15
|
-
}
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @flightdev/ui - Tier 1 Adapter Tests
|
|
3
|
-
*
|
|
4
|
-
* Tests for full-support adapters: React, Vue, Angular, Svelte, Solid, Qwik.
|
|
5
|
-
* These adapters have the most complete feature sets.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
9
|
-
import { runAdapterContractTests } from '../contracts/adapter.contract.js';
|
|
10
|
-
|
|
11
|
-
// ============================================================================
|
|
12
|
-
// Tier 1 Adapter Imports
|
|
13
|
-
// ============================================================================
|
|
14
|
-
|
|
15
|
-
import { react, ReactAdapter } from '../../src/adapters/tier-1/react.js';
|
|
16
|
-
import { vue, VueAdapter } from '../../src/adapters/tier-1/vue.js';
|
|
17
|
-
import { angular, AngularAdapter } from '../../src/adapters/tier-1/angular.js';
|
|
18
|
-
import { svelte, SvelteAdapter } from '../../src/adapters/tier-1/svelte.js';
|
|
19
|
-
import { solid, SolidAdapter } from '../../src/adapters/tier-1/solid.js';
|
|
20
|
-
import { qwik, QwikAdapter } from '../../src/adapters/tier-1/qwik.js';
|
|
21
|
-
|
|
22
|
-
// ============================================================================
|
|
23
|
-
// Contract Tests
|
|
24
|
-
// ============================================================================
|
|
25
|
-
|
|
26
|
-
// Note: We skip render tests for Tier 1 adapters because they require
|
|
27
|
-
// actual framework installations. Contract tests verify the interface.
|
|
28
|
-
|
|
29
|
-
describe('Tier 1 Adapters', () => {
|
|
30
|
-
runAdapterContractTests(() => react(), 'React', { skipRenderTest: true });
|
|
31
|
-
runAdapterContractTests(() => vue(), 'Vue', { skipRenderTest: true });
|
|
32
|
-
runAdapterContractTests(() => angular(), 'Angular', { skipRenderTest: true });
|
|
33
|
-
runAdapterContractTests(() => svelte(), 'Svelte', { skipRenderTest: true });
|
|
34
|
-
runAdapterContractTests(() => solid(), 'Solid', { skipRenderTest: true });
|
|
35
|
-
runAdapterContractTests(() => qwik(), 'Qwik', { skipRenderTest: true });
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
// ============================================================================
|
|
39
|
-
// React Specific Tests
|
|
40
|
-
// ============================================================================
|
|
41
|
-
|
|
42
|
-
describe('React Adapter - Specific', () => {
|
|
43
|
-
it('creates adapter with default options', () => {
|
|
44
|
-
const adapter = react();
|
|
45
|
-
expect(adapter).toBeInstanceOf(ReactAdapter);
|
|
46
|
-
expect(adapter.id).toBe('react');
|
|
47
|
-
expect(adapter.tier).toBe('tier-1');
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('supports streaming capability', () => {
|
|
51
|
-
const adapter = react();
|
|
52
|
-
expect(adapter.capabilities.streaming).toBe(true);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('supports server components capability', () => {
|
|
56
|
-
const adapter = react();
|
|
57
|
-
expect(adapter.capabilities.serverComponents).toBe(true);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('accepts streaming option', () => {
|
|
61
|
-
const adapter = react({ streaming: true });
|
|
62
|
-
expect(adapter).toBeDefined();
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('accepts serverComponents option', () => {
|
|
66
|
-
const adapter = react({ serverComponents: true });
|
|
67
|
-
expect(adapter).toBeDefined();
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('getHydrationScript includes react-dom/client import', () => {
|
|
71
|
-
const adapter = react();
|
|
72
|
-
const script = adapter.getHydrationScript({ html: '', hydrationData: {} });
|
|
73
|
-
expect(script).toContain('react-dom/client');
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
// ============================================================================
|
|
78
|
-
// Vue Specific Tests
|
|
79
|
-
// ============================================================================
|
|
80
|
-
|
|
81
|
-
describe('Vue Adapter - Specific', () => {
|
|
82
|
-
it('creates adapter with default options', () => {
|
|
83
|
-
const adapter = vue();
|
|
84
|
-
expect(adapter).toBeInstanceOf(VueAdapter);
|
|
85
|
-
expect(adapter.id).toBe('vue');
|
|
86
|
-
expect(adapter.tier).toBe('tier-1');
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('supports streaming capability', () => {
|
|
90
|
-
const adapter = vue();
|
|
91
|
-
expect(adapter.capabilities.streaming).toBe(true);
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it('does not support server components', () => {
|
|
95
|
-
const adapter = vue();
|
|
96
|
-
expect(adapter.capabilities.serverComponents).toBe(false);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('getHydrationScript includes vue import', () => {
|
|
100
|
-
const adapter = vue();
|
|
101
|
-
const script = adapter.getHydrationScript({ html: '', hydrationData: {} });
|
|
102
|
-
expect(script).toContain('vue');
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
// ============================================================================
|
|
107
|
-
// Angular Specific Tests
|
|
108
|
-
// ============================================================================
|
|
109
|
-
|
|
110
|
-
describe('Angular Adapter - Specific', () => {
|
|
111
|
-
it('creates adapter with default options', () => {
|
|
112
|
-
const adapter = angular();
|
|
113
|
-
expect(adapter).toBeInstanceOf(AngularAdapter);
|
|
114
|
-
expect(adapter.id).toBe('angular');
|
|
115
|
-
expect(adapter.tier).toBe('tier-1');
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
it('supports streaming capability', () => {
|
|
119
|
-
const adapter = angular();
|
|
120
|
-
expect(adapter.capabilities.streaming).toBe(true);
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it('accepts incrementalHydration option', () => {
|
|
124
|
-
const adapter = angular({ incrementalHydration: true });
|
|
125
|
-
expect(adapter).toBeDefined();
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it('accepts eventReplay option', () => {
|
|
129
|
-
const adapter = angular({ eventReplay: true });
|
|
130
|
-
expect(adapter).toBeDefined();
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
// ============================================================================
|
|
135
|
-
// Svelte Specific Tests
|
|
136
|
-
// ============================================================================
|
|
137
|
-
|
|
138
|
-
describe('Svelte Adapter - Specific', () => {
|
|
139
|
-
it('creates adapter with default options', () => {
|
|
140
|
-
const adapter = svelte();
|
|
141
|
-
expect(adapter).toBeInstanceOf(SvelteAdapter);
|
|
142
|
-
expect(adapter.id).toBe('svelte');
|
|
143
|
-
expect(adapter.tier).toBe('tier-1');
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
it('does not support streaming (Svelte 5 limitation)', () => {
|
|
147
|
-
const adapter = svelte();
|
|
148
|
-
expect(adapter.capabilities.streaming).toBe(false);
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
it('supports islands architecture', () => {
|
|
152
|
-
const adapter = svelte();
|
|
153
|
-
expect(adapter.capabilities.islands).toBe(true);
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
// ============================================================================
|
|
158
|
-
// Solid Specific Tests
|
|
159
|
-
// ============================================================================
|
|
160
|
-
|
|
161
|
-
describe('Solid Adapter - Specific', () => {
|
|
162
|
-
it('creates adapter with default options', () => {
|
|
163
|
-
const adapter = solid();
|
|
164
|
-
expect(adapter).toBeInstanceOf(SolidAdapter);
|
|
165
|
-
expect(adapter.id).toBe('solid');
|
|
166
|
-
expect(adapter.tier).toBe('tier-1');
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
it('supports streaming capability', () => {
|
|
170
|
-
const adapter = solid();
|
|
171
|
-
expect(adapter.capabilities.streaming).toBe(true);
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
it('supports islands architecture', () => {
|
|
175
|
-
const adapter = solid();
|
|
176
|
-
expect(adapter.capabilities.islands).toBe(true);
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
// ============================================================================
|
|
181
|
-
// Qwik Specific Tests
|
|
182
|
-
// ============================================================================
|
|
183
|
-
|
|
184
|
-
describe('Qwik Adapter - Specific', () => {
|
|
185
|
-
it('creates adapter with default options', () => {
|
|
186
|
-
const adapter = qwik();
|
|
187
|
-
expect(adapter).toBeInstanceOf(QwikAdapter);
|
|
188
|
-
expect(adapter.id).toBe('qwik');
|
|
189
|
-
expect(adapter.tier).toBe('tier-1');
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
it('supports resumable hydration (unique to Qwik)', () => {
|
|
193
|
-
const adapter = qwik();
|
|
194
|
-
expect(adapter.capabilities.resumable).toBe(true);
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
it('supports streaming capability', () => {
|
|
198
|
-
const adapter = qwik();
|
|
199
|
-
expect(adapter.capabilities.streaming).toBe(true);
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
it('accepts prefetchStrategy option', () => {
|
|
203
|
-
const adapter = qwik({ prefetchStrategy: 'idle' });
|
|
204
|
-
expect(adapter).toBeDefined();
|
|
205
|
-
});
|
|
206
|
-
});
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @flightdev/ui - Tier 2 Adapter Tests
|
|
3
|
-
*
|
|
4
|
-
* Tests for standard-support adapters: Preact, Lit, Marko, Stencil, Mithril, Inferno.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { describe, it, expect } from 'vitest';
|
|
8
|
-
import { runAdapterContractTests } from '../contracts/adapter.contract.js';
|
|
9
|
-
|
|
10
|
-
// ============================================================================
|
|
11
|
-
// Tier 2 Adapter Imports
|
|
12
|
-
// ============================================================================
|
|
13
|
-
|
|
14
|
-
import { preact, PreactAdapter } from '../../src/adapters/tier-2/preact.js';
|
|
15
|
-
import { lit, LitAdapter } from '../../src/adapters/tier-2/lit.js';
|
|
16
|
-
import { marko, MarkoAdapter } from '../../src/adapters/tier-2/marko.js';
|
|
17
|
-
// Stencil requires @stencil/core which may not be available in CI
|
|
18
|
-
// import { stencil, StencilAdapter } from '../../src/adapters/tier-2/stencil.js';
|
|
19
|
-
import { mithril, MithrilAdapter } from '../../src/adapters/tier-2/mithril.js';
|
|
20
|
-
import { inferno, InfernoAdapter } from '../../src/adapters/tier-2/inferno.js';
|
|
21
|
-
|
|
22
|
-
// ============================================================================
|
|
23
|
-
// Contract Tests
|
|
24
|
-
// ============================================================================
|
|
25
|
-
|
|
26
|
-
describe('Tier 2 Adapters', () => {
|
|
27
|
-
runAdapterContractTests(() => preact(), 'Preact', { skipRenderTest: true });
|
|
28
|
-
runAdapterContractTests(() => lit(), 'Lit', { skipRenderTest: true });
|
|
29
|
-
runAdapterContractTests(() => marko(), 'Marko', { skipRenderTest: true });
|
|
30
|
-
runAdapterContractTests(() => mithril(), 'Mithril', { skipRenderTest: true });
|
|
31
|
-
runAdapterContractTests(() => inferno(), 'Inferno', { skipRenderTest: true });
|
|
32
|
-
// Stencil skipped - requires @stencil/core peer dependency
|
|
33
|
-
// runAdapterContractTests(() => stencil(), 'Stencil', { skipRenderTest: true });
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// ============================================================================
|
|
37
|
-
// Preact Specific Tests
|
|
38
|
-
// ============================================================================
|
|
39
|
-
|
|
40
|
-
describe('Preact Adapter - Specific', () => {
|
|
41
|
-
it('creates adapter with default options', () => {
|
|
42
|
-
const adapter = preact();
|
|
43
|
-
expect(adapter).toBeInstanceOf(PreactAdapter);
|
|
44
|
-
expect(adapter.id).toBe('preact');
|
|
45
|
-
expect(adapter.tier).toBe('tier-2');
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('is classified as tier-2', () => {
|
|
49
|
-
const adapter = preact();
|
|
50
|
-
expect(adapter.tier).toBe('tier-2');
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('supports islands architecture', () => {
|
|
54
|
-
const adapter = preact();
|
|
55
|
-
expect(adapter.capabilities.islands).toBe(true);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('does not support streaming', () => {
|
|
59
|
-
const adapter = preact();
|
|
60
|
-
expect(adapter.capabilities.streaming).toBe(false);
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
// ============================================================================
|
|
65
|
-
// Lit Specific Tests
|
|
66
|
-
// ============================================================================
|
|
67
|
-
|
|
68
|
-
describe('Lit Adapter - Specific', () => {
|
|
69
|
-
it('creates adapter with default options', () => {
|
|
70
|
-
const adapter = lit();
|
|
71
|
-
expect(adapter).toBeInstanceOf(LitAdapter);
|
|
72
|
-
expect(adapter.id).toBe('lit');
|
|
73
|
-
expect(adapter.tier).toBe('tier-2');
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it('supports islands (Web Components are natural islands)', () => {
|
|
77
|
-
const adapter = lit();
|
|
78
|
-
expect(adapter.capabilities.islands).toBe(true);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('accepts declarativeShadowDom option', () => {
|
|
82
|
-
const adapter = lit({ declarativeShadowDom: true });
|
|
83
|
-
expect(adapter).toBeDefined();
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it('supports createIsland method', () => {
|
|
87
|
-
const adapter = lit();
|
|
88
|
-
expect(typeof adapter.createIsland).toBe('function');
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
// ============================================================================
|
|
93
|
-
// Marko Specific Tests
|
|
94
|
-
// ============================================================================
|
|
95
|
-
|
|
96
|
-
describe('Marko Adapter - Specific', () => {
|
|
97
|
-
it('creates adapter with default options', () => {
|
|
98
|
-
const adapter = marko();
|
|
99
|
-
expect(adapter).toBeInstanceOf(MarkoAdapter);
|
|
100
|
-
expect(adapter.id).toBe('marko');
|
|
101
|
-
expect(adapter.tier).toBe('tier-2');
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it('supports streaming SSR (Marko pioneered this)', () => {
|
|
105
|
-
const adapter = marko();
|
|
106
|
-
expect(adapter.capabilities.streaming).toBe(true);
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it('supports islands architecture', () => {
|
|
110
|
-
const adapter = marko();
|
|
111
|
-
expect(adapter.capabilities.islands).toBe(true);
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
// ============================================================================
|
|
116
|
-
// Stencil Specific Tests - Skipped (requires @stencil/core peer dependency)
|
|
117
|
-
// ============================================================================
|
|
118
|
-
|
|
119
|
-
describe.skip('Stencil Adapter - Specific', () => {
|
|
120
|
-
it('creates adapter with default options', () => {
|
|
121
|
-
// Skipped - @stencil/core not available in CI
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
// ============================================================================
|
|
126
|
-
// Mithril Specific Tests
|
|
127
|
-
// ============================================================================
|
|
128
|
-
|
|
129
|
-
describe('Mithril Adapter - Specific', () => {
|
|
130
|
-
it('creates adapter with default options', () => {
|
|
131
|
-
const adapter = mithril();
|
|
132
|
-
expect(adapter).toBeInstanceOf(MithrilAdapter);
|
|
133
|
-
expect(adapter.id).toBe('mithril');
|
|
134
|
-
expect(adapter.tier).toBe('tier-2');
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it('does not support streaming', () => {
|
|
138
|
-
const adapter = mithril();
|
|
139
|
-
expect(adapter.capabilities.streaming).toBe(false);
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
it('does not support islands', () => {
|
|
143
|
-
const adapter = mithril();
|
|
144
|
-
expect(adapter.capabilities.islands).toBe(false);
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
it('supports SSG', () => {
|
|
148
|
-
const adapter = mithril();
|
|
149
|
-
expect(adapter.capabilities.ssg).toBe(true);
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
// ============================================================================
|
|
154
|
-
// Inferno Specific Tests
|
|
155
|
-
// ============================================================================
|
|
156
|
-
|
|
157
|
-
describe('Inferno Adapter - Specific', () => {
|
|
158
|
-
it('creates adapter with default options', () => {
|
|
159
|
-
const adapter = inferno();
|
|
160
|
-
expect(adapter).toBeInstanceOf(InfernoAdapter);
|
|
161
|
-
expect(adapter.id).toBe('inferno');
|
|
162
|
-
expect(adapter.tier).toBe('tier-2');
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it('does not support streaming', () => {
|
|
166
|
-
const adapter = inferno();
|
|
167
|
-
expect(adapter.capabilities.streaming).toBe(false);
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
it('supports SSG and CSR', () => {
|
|
171
|
-
const adapter = inferno();
|
|
172
|
-
expect(adapter.capabilities.ssg).toBe(true);
|
|
173
|
-
expect(adapter.capabilities.csr).toBe(true);
|
|
174
|
-
});
|
|
175
|
-
});
|