UNPKG

vite-plugin-shopify-theme-islands

Version:
47 lines (46 loc) 2.13 kB
/** Matches .ts or .js extension. Exported for plugin transform/watch filters. */ export declare const TS_JS_RE: RegExp; /** Matches the island mixin import. Exported for plugin transform/watch detection. */ export declare const ISLAND_IMPORT_RE: RegExp; export interface AliasLike { find: string | RegExp; replacement: string; } export interface IslandInventoryConfig { root: string; aliases: readonly AliasLike[]; } export interface IslandInventorySnapshot { resolvedDirectories: string[]; islandFiles: string[]; directoryFiles: string[]; directoryTagNames: string[]; } export interface IslandInventoryChange { type: "detected" | "removed"; file: string; } export interface IslandInventoryState { root: string; directories: string[]; directoryFiles: Set<string>; islandFiles: Set<string>; } /** True if file is under any of the given absolute directory paths. */ export declare function inDirectory(file: string, absDirs: string[]): boolean; /** Paths for load() virtual module: "/relative/to/root" form, forward slashes. */ export declare function getIslandPathsForLoad(islandFiles: Set<string>, root: string): string[]; /** True when file content declares Island membership and the file is not inside a managed directory. */ export declare function isIslandMember(code: string, absolutePath: string, absDirs: string[]): boolean; /** Scan from root for files containing the island import; returns paths (not in absDirs). */ export declare function discoverIslandFiles(root: string, absDirs: string[]): Set<string>; /** Tag names (filename without extension) for TS/JS files in a directory. Used for debug logging. */ export declare function collectTagNames(dir: string): string[]; export declare function createIslandInventory(rawDirectories: string[]): { configure(config: IslandInventoryConfig): void; scan(): IslandInventorySnapshot | null; applyTransform(id: string, code: string): IslandInventoryChange | null; applyWatchChange(id: string, event: string): IslandInventoryChange | null; state(): IslandInventoryState; getRoot(): string; };