vite-plugin-shopify-theme-islands
Version:
Vite plugin for island architecture in Shopify themes
36 lines (35 loc) • 1.28 kB
TypeScript
import type { IslandLoader } from "./contract.js";
import type { GatePlan } from "./directive-spine.js";
import { type DirectiveWaiters } from "./directive-waiters.js";
import type { RuntimeLogger, RuntimeSurface } from "./runtime-surface.js";
export interface IslandElementOwnership {
isObserved(el: Element): boolean;
settleSuccess(tag: string): number;
settleFailure(tag: string, retry: () => void): {
willRetry: boolean;
attempt: number;
};
evict(tag: string): void;
watchCancellable(el: Element, cancel: () => void): () => void;
walk(root: HTMLElement): void;
}
export interface IslandElementPlatform {
now(): number;
console: Pick<Console, "error" | "warn">;
}
export interface IslandElementActivationDeps {
tagName: string;
element: HTMLElement;
loader: IslandLoader;
plan: GatePlan;
directiveTimeout: number;
waiters?: DirectiveWaiters;
ownership: IslandElementOwnership;
surface: {
dispatchLoad: RuntimeSurface["dispatchLoad"];
dispatchError: RuntimeSurface["dispatchError"];
createLogger(tagName: string): RuntimeLogger;
};
platform: IslandElementPlatform;
}
export declare function activateIslandElement(deps: IslandElementActivationDeps): Promise<void>;