@useavalon/avalon 0.1.17 → 0.1.19

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 CHANGED
@@ -1,54 +1,54 @@
1
- # @useavalon/avalon
2
-
3
- Core framework package for [Avalon](https://useavalon.dev) — a multi-framework islands architecture for the modern web.
4
-
5
- ## Features
6
-
7
- - Islands architecture with zero JavaScript by default
8
- - Multi-framework support (React, Preact, Vue, Svelte, Solid, Lit, Qwik)
9
- - Selective hydration (`on:client`, `on:visible`, `on:idle`, `on:interaction`)
10
- - File-system routing with nested layouts
11
- - API routes and middleware
12
- - MDX support with rehype/remark plugins
13
- - SSR with streaming support
14
- - Edge deployment via Nitro (Node, Deno, Bun, Cloudflare, Vercel, etc.)
15
- - Vite 8 powered with HMR
16
-
17
- ## Quick start
18
-
19
- ```bash
20
- npm create avalon@latest
21
- # or
22
- bun create avalon
23
- ```
24
-
25
- Or install manually:
26
-
27
- ```bash
28
- bun add @useavalon/avalon
29
- ```
30
-
31
- ## Usage
32
-
33
- ```tsx
34
- // pages/index.tsx
35
- import Counter from '../components/Counter.tsx';
36
-
37
- export default function Home() {
38
- return (
39
- <div>
40
- <h1>Hello Avalon</h1>
41
- <Counter island={{ condition: 'on:visible' }} />
42
- </div>
43
- );
44
- }
45
- ```
46
-
47
- ## Links
48
-
49
- - [Documentation](https://useavalon.dev/docs/introduction)
50
- - [GitHub](https://github.com/useAvalon/Avalon)
51
-
52
- ## License
53
-
54
- MIT
1
+ # @useavalon/avalon
2
+
3
+ Core framework package for [Avalon](https://useavalon.dev) — a multi-framework islands architecture for the modern web.
4
+
5
+ ## Features
6
+
7
+ - Islands architecture with zero JavaScript by default
8
+ - Multi-framework support (React, Preact, Vue, Svelte, Solid, Lit, Qwik)
9
+ - Selective hydration (`on:client`, `on:visible`, `on:idle`, `on:interaction`)
10
+ - File-system routing with nested layouts
11
+ - API routes and middleware
12
+ - MDX support with rehype/remark plugins
13
+ - SSR with streaming support
14
+ - Edge deployment via Nitro (Node, Deno, Bun, Cloudflare, Vercel, etc.)
15
+ - Vite 8 powered with HMR
16
+
17
+ ## Quick start
18
+
19
+ ```bash
20
+ npm create avalon@latest
21
+ # or
22
+ bun create avalon
23
+ ```
24
+
25
+ Or install manually:
26
+
27
+ ```bash
28
+ bun add @useavalon/avalon
29
+ ```
30
+
31
+ ## Usage
32
+
33
+ ```tsx
34
+ // pages/index.tsx
35
+ import Counter from '../components/Counter.tsx';
36
+
37
+ export default function Home() {
38
+ return (
39
+ <div>
40
+ <h1>Hello Avalon</h1>
41
+ <Counter island={{ condition: 'on:visible' }} />
42
+ </div>
43
+ );
44
+ }
45
+ ```
46
+
47
+ ## Links
48
+
49
+ - [Documentation](https://useavalon.dev/docs/introduction)
50
+ - [GitHub](https://github.com/useAvalon/Avalon)
51
+
52
+ ## License
53
+
54
+ MIT
@@ -1 +1 @@
1
- export{PersistentIsland}from"../components/PersistentIsland.tsx";export{usePersistentIslandContext,PersistentIslandProvider,createPersistentIslandContext}from"../core/islands/persistent-island-context.tsx";export{usePersistentState}from"../core/islands/use-persistent-state.js";export{IslandPersistence,defaultIslandPersistence}from"../core/islands/island-persistence.js";export{IslandStateSerializer}from"../core/islands/island-state-serializer.js";export{IslandErrorBoundary,withIslandErrorBoundary}from"../components/IslandErrorBoundary.tsx";export{LayoutErrorBoundary}from"../components/LayoutErrorBoundary.tsx";export{LayoutDataErrorBoundary}from"../components/LayoutDataErrorBoundary.tsx";export{StreamingErrorBoundary,withStreamingErrorBoundary}from"../components/StreamingErrorBoundary.tsx";export{StreamingLayout,StreamingSuspense,withStreaming,useStreamingState}from"../components/StreamingLayout.tsx";export{Image}from"../components/Image.tsx";
1
+ export{PersistentIsland}from"../components/PersistentIsland.js";export{usePersistentIslandContext,PersistentIslandProvider,createPersistentIslandContext}from"../core/islands/persistent-island-context.js";export{usePersistentState}from"../core/islands/use-persistent-state.js";export{IslandPersistence,defaultIslandPersistence}from"../core/islands/island-persistence.js";export{IslandStateSerializer}from"../core/islands/island-state-serializer.js";export{IslandErrorBoundary,withIslandErrorBoundary}from"../components/IslandErrorBoundary.js";export{LayoutErrorBoundary}from"../components/LayoutErrorBoundary.js";export{LayoutDataErrorBoundary}from"../components/LayoutDataErrorBoundary.js";export{StreamingErrorBoundary,withStreamingErrorBoundary}from"../components/StreamingErrorBoundary.js";export{StreamingLayout,StreamingSuspense,withStreaming,useStreamingState}from"../components/StreamingLayout.js";export{Image}from"../components/Image.js";
@@ -1,4 +1,4 @@
1
- document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,e):e();function e(){let e=document.querySelectorAll(`[data-framework]`);e.length!==0&&e.forEach(e=>{try{let o=e.dataset.framework,s=e.dataset.condition||`on:client`;if(e.dataset.renderStrategy===`ssr-only`||!t(e,s))return;s===`on:client`?c(e,o):s===`on:visible`?n(e,o):s===`on:interaction`?r(e,o):s===`on:idle`?i(e,o):s.startsWith(`media:`)?a(e,o,s.slice(6)):c(e,o)}catch(t){console.error(`Error processing island:`,t),l(e,e.dataset.framework||`unknown`,e.dataset.src||`unknown`,t)}})}function t(e,t){if(!t||t===`on:client`)return!0;if(t.startsWith(`media:`)){let e=t.slice(6);try{return globalThis.matchMedia(e).matches}catch(t){return console.error(`Invalid media query:`,e,t),!0}}return t===`on:visible`||t===`on:interaction`||t===`on:idle`||console.warn(`Unknown hydration condition:`,t),!0}function n(e,t){try{let n=new IntersectionObserver(r=>{r[0].isIntersecting&&(c(e,t),n.disconnect())},{rootMargin:`50px`,threshold:0});n.observe(e)}catch(n){console.error(`Failed to setup intersection observer:`,n),c(e,t)}}function r(e,t){let n=[`click`,`touchstart`,`mouseenter`,`focusin`],r=!1,i=()=>{r||(r=!0,n.forEach(t=>{e.removeEventListener(t,i)}),c(e,t))};try{n.forEach(t=>{e.addEventListener(t,i,{once:!0,passive:!0})})}catch(n){console.error(`Failed to setup interaction observer:`,n),c(e,t)}}function i(e,t){try{`requestIdleCallback`in globalThis?globalThis.requestIdleCallback(()=>{c(e,t)},{timeout:5e3}):document.readyState===`complete`?setTimeout(()=>{c(e,t)},200):globalThis.addEventListener(`load`,()=>{setTimeout(()=>{c(e,t)},200)},{once:!0})}catch(n){console.error(`Failed to setup idle callback:`,n),c(e,t)}}function a(e,t,n){try{let r=globalThis.matchMedia(n);if(r.matches){c(e,t);return}let i=n=>{n.matches&&(c(e,t),r.removeEventListener(`change`,i))};r.addEventListener(`change`,i)}catch(r){console.error(`Failed to setup media query:`,n,r),c(e,t)}}async function o(e){if(![`preact`,`react`,`vue`,`svelte`,`solid`,`lit`,`qwik`].includes(e))throw Error(`Unknown framework: ${e}`);return import(`/@useavalon/${e}/client`)}function s(e,t){let n=e.default;if(!n){let t=Object.keys(e).filter(e=>e!==`default`);for(let r of t){let t=e[r];if(typeof t==`function`&&t.prototype){n=t;break}}n||=e}if(!n)throw Error(`Component ${t} has no default export`);return n}async function c(e,t){if(e.dataset.hydrated)return;let n=e.dataset.src,r=e.dataset.props;if(!n){console.warn(`Island missing data-src attribute`);return}try{let i=r?JSON.parse(r):{};t===`lit`&&await import(`/@useavalon/lit/client`);let a=s(await import(n),n);try{let n=await o(t);if(!n.hydrate||typeof n.hydrate!=`function`)throw Error(`Integration ${t} does not export a hydrate function`);n.hydrate(e,a,i),e.dataset.hydrated=`true`}catch(r){import.meta.env?.DEV&&console.error(`Integration hydration failed for ${t}: ${n}`,r),e.dataset.hydrationStatus=`failed`,e.dataset.hydrationError=r.message,e.dispatchEvent(new CustomEvent(`hydration-error`,{detail:{framework:t,src:n,error:r.message,timestamp:Date.now(),hydrationType:`integration-level`},bubbles:!0}))}}catch(r){console.error(`❌ Critical error hydrating ${t} island ${n}:`,r),l(e,t,n,r)}}function l(e,t,n,r){console.error(`Hydration error for ${t} island:`,{src:n,error:r.message,stack:r.stack}),e.dataset.hydrationStatus=`failed`,e.dataset.renderStrategy=`ssr-only`,e.classList.add(`hydration-failed`),e.dispatchEvent(new CustomEvent(`hydration-error`,{detail:{framework:t,src:n,error:r.message,timestamp:Date.now()},bubbles:!0})),d()&&u(e,t,n,r)}function u(e,t,n,r){let i=document.createElement(`div`);i.className=`hydration-error-indicator`,i.style.cssText=`
1
+ document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,e):e();function e(){let e=document.querySelectorAll(`[data-framework]`);e.length!==0&&e.forEach(e=>{try{let o=e.dataset.framework,s=e.dataset.condition||`on:client`;if(e.dataset.renderStrategy===`ssr-only`||!t(e,s))return;s===`on:client`?c(e,o):s===`on:visible`?n(e,o):s===`on:interaction`?r(e,o):s===`on:idle`?i(e,o):s.startsWith(`media:`)?a(e,o,s.slice(6)):c(e,o)}catch(t){console.error(`Error processing island:`,t),l(e,e.dataset.framework||`unknown`,e.dataset.src||`unknown`,t)}})}function t(e,t){if(!t||t===`on:client`)return!0;if(t.startsWith(`media:`)){let e=t.slice(6);try{return globalThis.matchMedia(e).matches}catch(t){return console.error(`Invalid media query:`,e,t),!0}}return t===`on:visible`||t===`on:interaction`||t===`on:idle`||console.warn(`Unknown hydration condition:`,t),!0}function n(e,t){try{let n=new IntersectionObserver(r=>{r[0].isIntersecting&&(c(e,t),n.disconnect())},{rootMargin:`50px`,threshold:0});n.observe(e)}catch(n){console.error(`Failed to setup intersection observer:`,n),c(e,t)}}function r(e,t){let n=[`click`,`touchstart`,`mouseenter`,`focusin`],r=!1,i=()=>{r||(r=!0,n.forEach(t=>{e.removeEventListener(t,i)}),c(e,t))};try{n.forEach(t=>{e.addEventListener(t,i,{once:!0,passive:!0})})}catch(n){console.error(`Failed to setup interaction observer:`,n),c(e,t)}}function i(e,t){try{`requestIdleCallback`in globalThis?globalThis.requestIdleCallback(()=>{c(e,t)},{timeout:5e3}):document.readyState===`complete`?setTimeout(()=>{c(e,t)},200):globalThis.addEventListener(`load`,()=>{setTimeout(()=>{c(e,t)},200)},{once:!0})}catch(n){console.error(`Failed to setup idle callback:`,n),c(e,t)}}function a(e,t,n){try{let r=globalThis.matchMedia(n);if(r.matches){c(e,t);return}let i=n=>{n.matches&&(c(e,t),r.removeEventListener(`change`,i))};r.addEventListener(`change`,i)}catch(r){console.error(`Failed to setup media query:`,n,r),c(e,t)}}async function o(e){if(![`preact`,`react`,`vue`,`svelte`,`solid`,`lit`,`qwik`].includes(e))throw Error(`Unknown framework: ${e}`);return import(`/@useavalon/${e}/client`)}function s(e,t){let n=e.default;if(!n){let t=Object.keys(e).filter(e=>e!==`default`);for(let r of t){let t=e[r];if(typeof t==`function`&&t.prototype){n=t;break}}n||=e}if(!n)throw Error(`Component ${t} has no default export`);return n}async function c(e,t){if(e.dataset.hydrated)return;let n=e.dataset.src,r=e.dataset.props;if(!n){console.warn(`Island missing data-src attribute`);return}try{let i=r?JSON.parse(r):{};t===`lit`&&await import(`/@useavalon/${t}/client`);let a=s(await import(n),n);try{let n=await o(t);if(!n.hydrate||typeof n.hydrate!=`function`)throw Error(`Integration ${t} does not export a hydrate function`);n.hydrate(e,a,i),e.dataset.hydrated=`true`}catch(r){import.meta.env?.DEV&&console.error(`Integration hydration failed for ${t}: ${n}`,r),e.dataset.hydrationStatus=`failed`,e.dataset.hydrationError=r.message,e.dispatchEvent(new CustomEvent(`hydration-error`,{detail:{framework:t,src:n,error:r.message,timestamp:Date.now(),hydrationType:`integration-level`},bubbles:!0}))}}catch(r){console.error(`❌ Critical error hydrating ${t} island ${n}:`,r),l(e,t,n,r)}}function l(e,t,n,r){console.error(`Hydration error for ${t} island:`,{src:n,error:r.message,stack:r.stack}),e.dataset.hydrationStatus=`failed`,e.dataset.renderStrategy=`ssr-only`,e.classList.add(`hydration-failed`),e.dispatchEvent(new CustomEvent(`hydration-error`,{detail:{framework:t,src:n,error:r.message,timestamp:Date.now()},bubbles:!0})),d()&&u(e,t,n,r)}function u(e,t,n,r){let i=document.createElement(`div`);i.className=`hydration-error-indicator`,i.style.cssText=`
2
2
  position: absolute;
3
3
  top: 0;
4
4
  right: 0;
@@ -11,7 +11,7 @@ document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,e):
11
11
  z-index: 9999;
12
12
  cursor: pointer;
13
13
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
14
- `,i.textContent=`❌ ${t}`,i.title=`Hydration failed: ${n}\n${r.message}\nClick for details`,i.addEventListener(`click`,()=>{alert(`Hydration Error\n\nFramework: ${t}\nComponent: ${n}\n\nError: ${r.message}\n\nStack:\n${r.stack}`)}),globalThis.getComputedStyle(e).position===`static`&&(e.style.position=`relative`),e.appendChild(i)}function d(){return import.meta.env?.DEV||import.meta.env?.MODE===`development`||globalThis.location?.hostname===`localhost`||globalThis.location?.hostname===`127.0.0.1`}function f(e){let t=e.dataset.framework,n=e.dataset.src;if(!n)return null;let r={framework:t,src:n,props:e.dataset.props,scrollPosition:{x:globalThis.scrollX,y:globalThis.scrollY},focusedElement:document.activeElement?.id||null};try{t===`vue`&&e.__vue__?r.vueData=structuredClone(e.__vue__.$data||{}):t===`svelte`&&e.__svelte__?r.svelteState=e.__svelte__:t===`lit`&&e.tagName?.includes(`-`)&&(e.querySelector(`[data-lit-element]`)||e)._$litElement$&&(r.litProperties={})}catch(e){console.warn(`Failed to preserve island state:`,e)}return r}function p(e,t){if(t)try{if(t.scrollPosition&&globalThis.scrollTo(t.scrollPosition.x,t.scrollPosition.y),t.focusedElement){let e=document.getElementById(t.focusedElement);e&&e.focus()}e.dataset.framework===`vue`&&t.vueData&&e.__vue__&&Object.assign(e.__vue__.$data,t.vueData)}catch(e){console.warn(`Failed to restore island state:`,e)}}async function m(e,t,n,r){let i=e.dataset.props,a=i?JSON.parse(i):{};t===`lit`&&await import(`/@useavalon/lit/client`);let c=s(await import(n),r),l=await o(t);if(!l.hydrate||typeof l.hydrate!=`function`)throw Error(`Integration ${t} does not export a hydrate function`);l.hydrate(e,c,a),e.dataset.hydrated=`true`}function h(e,t,n,r){let i=e.querySelector(`.hmr-error-indicator`);i&&i.remove();let a=document.createElement(`div`);a.className=`hmr-error-indicator`,a.style.cssText=`
14
+ `,i.textContent=`❌ ${t}`,i.title=`Hydration failed: ${n}\n${r.message}\nClick for details`,i.addEventListener(`click`,()=>{alert(`Hydration Error\n\nFramework: ${t}\nComponent: ${n}\n\nError: ${r.message}\n\nStack:\n${r.stack}`)}),globalThis.getComputedStyle(e).position===`static`&&(e.style.position=`relative`),e.appendChild(i)}function d(){return import.meta.env?.DEV||import.meta.env?.MODE===`development`||globalThis.location?.hostname===`localhost`||globalThis.location?.hostname===`127.0.0.1`}function f(e){let t=e.dataset.framework,n=e.dataset.src;if(!n)return null;let r={framework:t,src:n,props:e.dataset.props,scrollPosition:{x:globalThis.scrollX,y:globalThis.scrollY},focusedElement:document.activeElement?.id||null};try{t===`vue`&&e.__vue__?r.vueData=structuredClone(e.__vue__.$data||{}):t===`svelte`&&e.__svelte__?r.svelteState=e.__svelte__:t===`lit`&&e.tagName?.includes(`-`)&&(e.querySelector(`[data-lit-element]`)||e)._$litElement$&&(r.litProperties={})}catch(e){console.warn(`Failed to preserve island state:`,e)}return r}function p(e,t){if(t)try{if(t.scrollPosition&&globalThis.scrollTo(t.scrollPosition.x,t.scrollPosition.y),t.focusedElement){let e=document.getElementById(t.focusedElement);e&&e.focus()}e.dataset.framework===`vue`&&t.vueData&&e.__vue__&&Object.assign(e.__vue__.$data,t.vueData)}catch(e){console.warn(`Failed to restore island state:`,e)}}async function m(e,t,n,r){let i=e.dataset.props,a=i?JSON.parse(i):{};t===`lit`&&await import(`/@useavalon/${t}/client`);let c=s(await import(n),r),l=await o(t);if(!l.hydrate||typeof l.hydrate!=`function`)throw Error(`Integration ${t} does not export a hydrate function`);l.hydrate(e,c,a),e.dataset.hydrated=`true`}function h(e,t,n,r){let i=e.querySelector(`.hmr-error-indicator`);i&&i.remove();let a=document.createElement(`div`);a.className=`hmr-error-indicator`,a.style.cssText=`
15
15
  position: absolute;
16
16
  top: 0;
17
17
  left: 0;
@@ -1,68 +1,68 @@
1
- /**
2
- * Type declarations for framework runtime imports
3
- *
4
- * These are dynamic imports that are resolved by Vite at runtime in the browser.
5
- * The actual packages are provided by the user's project dependencies.
6
- */
7
-
8
- declare module 'react' {
9
- export function createElement<P = Record<string, unknown>>(
10
- component: unknown,
11
- props: P | null,
12
- ...children: unknown[]
13
- ): unknown;
14
- export const version: string;
15
- }
16
-
17
- declare module 'react-dom/client' {
18
- export interface Root {
19
- render(element: unknown): void;
20
- unmount(): void;
21
- }
22
-
23
- export function hydrateRoot(
24
- container: HTMLElement,
25
- element: unknown,
26
- options?: {
27
- onRecoverableError?: (error: Error) => void;
28
- }
29
- ): Root;
30
-
31
- export function createRoot(container: HTMLElement): Root;
32
- }
33
-
34
- declare module 'vue' {
35
- export interface App {
36
- mount(rootContainer: HTMLElement | string, isHydrate?: boolean): unknown;
37
- unmount(): void;
38
- use(plugin: unknown, ...options: unknown[]): App;
39
- component(name: string, component: unknown): App;
40
- directive(name: string, directive: unknown): App;
41
- provide(key: string | symbol, value: unknown): App;
42
- config: {
43
- errorHandler?: (err: Error, instance: unknown, info: string) => void;
44
- warnHandler?: (msg: string, instance: unknown, trace: string) => void;
45
- };
46
- }
47
-
48
- export function createApp(rootComponent: unknown, rootProps?: Record<string, unknown>): App;
49
- export const version: string;
50
- }
51
-
52
-
53
- declare module 'svelte' {
54
- export interface SvelteComponent {
55
- new (options: {
56
- target: HTMLElement;
57
- props?: Record<string, unknown>;
58
- hydrate?: boolean;
59
- intro?: boolean;
60
- anchor?: Element | null;
61
- context?: Map<unknown, unknown>;
62
- }): {
63
- $set(props: Record<string, unknown>): void;
64
- $destroy(): void;
65
- $on?(event: string, handler: (...args: unknown[]) => void): () => void;
66
- };
67
- }
68
- }
1
+ /**
2
+ * Type declarations for framework runtime imports
3
+ *
4
+ * These are dynamic imports that are resolved by Vite at runtime in the browser.
5
+ * The actual packages are provided by the user's project dependencies.
6
+ */
7
+
8
+ declare module 'react' {
9
+ export function createElement<P = Record<string, unknown>>(
10
+ component: unknown,
11
+ props: P | null,
12
+ ...children: unknown[]
13
+ ): unknown;
14
+ export const version: string;
15
+ }
16
+
17
+ declare module 'react-dom/client' {
18
+ export interface Root {
19
+ render(element: unknown): void;
20
+ unmount(): void;
21
+ }
22
+
23
+ export function hydrateRoot(
24
+ container: HTMLElement,
25
+ element: unknown,
26
+ options?: {
27
+ onRecoverableError?: (error: Error) => void;
28
+ }
29
+ ): Root;
30
+
31
+ export function createRoot(container: HTMLElement): Root;
32
+ }
33
+
34
+ declare module 'vue' {
35
+ export interface App {
36
+ mount(rootContainer: HTMLElement | string, isHydrate?: boolean): unknown;
37
+ unmount(): void;
38
+ use(plugin: unknown, ...options: unknown[]): App;
39
+ component(name: string, component: unknown): App;
40
+ directive(name: string, directive: unknown): App;
41
+ provide(key: string | symbol, value: unknown): App;
42
+ config: {
43
+ errorHandler?: (err: Error, instance: unknown, info: string) => void;
44
+ warnHandler?: (msg: string, instance: unknown, trace: string) => void;
45
+ };
46
+ }
47
+
48
+ export function createApp(rootComponent: unknown, rootProps?: Record<string, unknown>): App;
49
+ export const version: string;
50
+ }
51
+
52
+
53
+ declare module 'svelte' {
54
+ export interface SvelteComponent {
55
+ new (options: {
56
+ target: HTMLElement;
57
+ props?: Record<string, unknown>;
58
+ hydrate?: boolean;
59
+ intro?: boolean;
60
+ anchor?: Element | null;
61
+ context?: Map<unknown, unknown>;
62
+ }): {
63
+ $set(props: Record<string, unknown>): void;
64
+ $destroy(): void;
65
+ $on?(event: string, handler: (...args: unknown[]) => void): () => void;
66
+ };
67
+ }
68
+ }
@@ -1,46 +1,46 @@
1
- /**
2
- * Type definitions for Vite HMR API
3
- */
4
-
5
- declare module 'vite/types/hmrPayload' {
6
- export interface HMRPayload {
7
- type: 'update' | 'full-reload' | 'prune' | 'error' | 'connected' | 'custom';
8
- updates?: Update[];
9
- timestamp?: number;
10
- path?: string;
11
- err?: Error;
12
- data?: unknown;
13
- event?: string;
14
- }
15
-
16
- export interface Update {
17
- type: 'js-update' | 'css-update';
18
- path: string;
19
- acceptedPath: string;
20
- timestamp: number;
21
- explicitImportRequired?: boolean;
22
- }
23
- }
24
-
25
- declare global {
26
- interface ImportMeta {
27
- hot?: {
28
- accept(): void;
29
- accept(cb: (mod: unknown) => void): void;
30
- accept(dep: string, cb: (mod: unknown) => void): void;
31
- accept(deps: readonly string[], cb: (mods: unknown[]) => void): void;
32
-
33
- dispose(cb: (data: unknown) => void): void;
34
- decline(): void;
35
- invalidate(): void;
36
-
37
- on(event: string, cb: (payload: unknown) => void): void;
38
- off(event: string, cb: (payload: unknown) => void): void;
39
- send(event: string, data?: unknown): void;
40
-
41
- data: unknown;
42
- };
43
- }
44
- }
45
-
46
- export {};
1
+ /**
2
+ * Type definitions for Vite HMR API
3
+ */
4
+
5
+ declare module 'vite/types/hmrPayload' {
6
+ export interface HMRPayload {
7
+ type: 'update' | 'full-reload' | 'prune' | 'error' | 'connected' | 'custom';
8
+ updates?: Update[];
9
+ timestamp?: number;
10
+ path?: string;
11
+ err?: Error;
12
+ data?: unknown;
13
+ event?: string;
14
+ }
15
+
16
+ export interface Update {
17
+ type: 'js-update' | 'css-update';
18
+ path: string;
19
+ acceptedPath: string;
20
+ timestamp: number;
21
+ explicitImportRequired?: boolean;
22
+ }
23
+ }
24
+
25
+ declare global {
26
+ interface ImportMeta {
27
+ hot?: {
28
+ accept(): void;
29
+ accept(cb: (mod: unknown) => void): void;
30
+ accept(dep: string, cb: (mod: unknown) => void): void;
31
+ accept(deps: readonly string[], cb: (mods: unknown[]) => void): void;
32
+
33
+ dispose(cb: (data: unknown) => void): void;
34
+ decline(): void;
35
+ invalidate(): void;
36
+
37
+ on(event: string, cb: (payload: unknown) => void): void;
38
+ off(event: string, cb: (payload: unknown) => void): void;
39
+ send(event: string, data?: unknown): void;
40
+
41
+ data: unknown;
42
+ };
43
+ }
44
+ }
45
+
46
+ export {};
@@ -1,70 +1,70 @@
1
- /**
2
- * Type declarations for Vite virtual modules
3
- *
4
- * These modules are resolved by Vite at runtime in the browser.
5
- * They don't exist as actual files but are provided by Vite's plugin system.
6
- */
7
-
8
- declare module '/@useavalon/preact/client' {
9
- export function hydrate(container: Element, component: unknown, props?: Record<string, unknown>): void;
10
- export function getHydrationScript(): string;
11
- }
12
-
13
- declare module '/@useavalon/react/client' {
14
- export function hydrate(container: Element, component: unknown, props?: Record<string, unknown>): void;
15
- export function getHydrationScript(): string;
16
- }
17
-
18
- declare module '/@useavalon/vue/client' {
19
- export function hydrate(container: Element, component: unknown, props?: Record<string, unknown>): void;
20
- export function getHydrationScript(): string;
21
- }
22
-
23
- declare module '/@useavalon/svelte/client' {
24
- export function hydrate(container: Element, component: unknown, props?: Record<string, unknown>): void;
25
- export function getHydrationScript(): string;
26
- }
27
-
28
- declare module '/@useavalon/solid/client' {
29
- export function hydrate(container: Element, component: unknown, props?: Record<string, unknown>): void;
30
- export function getHydrationScript(): string;
31
- }
32
-
33
- declare module '/@useavalon/lit/client' {
34
- export function hydrate(container: Element, component: unknown, props?: Record<string, unknown>): void;
35
- export function getHydrationScript(): string;
36
- }
37
-
38
- declare module '/@useavalon/qwik/client' {
39
- export function hydrate(container: Element, component: unknown, props?: Record<string, unknown>): void;
40
- export function getHydrationScript(): string;
41
- }
42
-
43
- // HMR adapter virtual modules
44
- declare module '/@useavalon/react/client/hmr' {
45
- export { reactAdapter } from '@useavalon/react/client/hmr';
46
- }
47
-
48
- declare module '/@useavalon/preact/client/hmr' {
49
- export { preactAdapter } from '@useavalon/preact/client/hmr';
50
- }
51
-
52
- declare module '/@useavalon/vue/client/hmr' {
53
- export { vueAdapter } from '@useavalon/vue/client/hmr';
54
- }
55
-
56
- declare module '/@useavalon/svelte/client/hmr' {
57
- export { svelteAdapter } from '@useavalon/svelte/client/hmr';
58
- }
59
-
60
- declare module '/@useavalon/solid/client/hmr' {
61
- export { solidAdapter } from '@useavalon/solid/client/hmr';
62
- }
63
-
64
- declare module '/@useavalon/lit/client/hmr' {
65
- export { litAdapter } from '@useavalon/lit/client/hmr';
66
- }
67
-
68
- declare module '/@useavalon/qwik/client/hmr' {
69
- export { qwikAdapter } from '@useavalon/qwik/client/hmr';
70
- }
1
+ /**
2
+ * Type declarations for Vite virtual modules
3
+ *
4
+ * These modules are resolved by Vite at runtime in the browser.
5
+ * They don't exist as actual files but are provided by Vite's plugin system.
6
+ */
7
+
8
+ declare module '/@useavalon/preact/client' {
9
+ export function hydrate(container: Element, component: unknown, props?: Record<string, unknown>): void;
10
+ export function getHydrationScript(): string;
11
+ }
12
+
13
+ declare module '/@useavalon/react/client' {
14
+ export function hydrate(container: Element, component: unknown, props?: Record<string, unknown>): void;
15
+ export function getHydrationScript(): string;
16
+ }
17
+
18
+ declare module '/@useavalon/vue/client' {
19
+ export function hydrate(container: Element, component: unknown, props?: Record<string, unknown>): void;
20
+ export function getHydrationScript(): string;
21
+ }
22
+
23
+ declare module '/@useavalon/svelte/client' {
24
+ export function hydrate(container: Element, component: unknown, props?: Record<string, unknown>): void;
25
+ export function getHydrationScript(): string;
26
+ }
27
+
28
+ declare module '/@useavalon/solid/client' {
29
+ export function hydrate(container: Element, component: unknown, props?: Record<string, unknown>): void;
30
+ export function getHydrationScript(): string;
31
+ }
32
+
33
+ declare module '/@useavalon/lit/client' {
34
+ export function hydrate(container: Element, component: unknown, props?: Record<string, unknown>): void;
35
+ export function getHydrationScript(): string;
36
+ }
37
+
38
+ declare module '/@useavalon/qwik/client' {
39
+ export function hydrate(container: Element, component: unknown, props?: Record<string, unknown>): void;
40
+ export function getHydrationScript(): string;
41
+ }
42
+
43
+ // HMR adapter virtual modules
44
+ declare module '/@useavalon/react/client/hmr' {
45
+ export { reactAdapter } from '@useavalon/react/client/hmr';
46
+ }
47
+
48
+ declare module '/@useavalon/preact/client/hmr' {
49
+ export { preactAdapter } from '@useavalon/preact/client/hmr';
50
+ }
51
+
52
+ declare module '/@useavalon/vue/client/hmr' {
53
+ export { vueAdapter } from '@useavalon/vue/client/hmr';
54
+ }
55
+
56
+ declare module '/@useavalon/svelte/client/hmr' {
57
+ export { svelteAdapter } from '@useavalon/svelte/client/hmr';
58
+ }
59
+
60
+ declare module '/@useavalon/solid/client/hmr' {
61
+ export { solidAdapter } from '@useavalon/solid/client/hmr';
62
+ }
63
+
64
+ declare module '/@useavalon/lit/client/hmr' {
65
+ export { litAdapter } from '@useavalon/lit/client/hmr';
66
+ }
67
+
68
+ declare module '/@useavalon/qwik/client/hmr' {
69
+ export { qwikAdapter } from '@useavalon/qwik/client/hmr';
70
+ }