UNPKG

histoire

Version:

A fast story book powered by Vite

21 lines • 1.21 kB
/** * Module-id string helpers shared by the static (build mode) mock resolution. * * In build mode there is no Vite dev server to ask, so mocked modules can only * be matched by comparing import specifiers found in the emitted chunks. */ /** Extracts static and dynamic import specifiers from Vite-built JavaScript. */ export declare function getImportSpecifiers(source: string): Set<string>; /** Returns true for import specifiers that can be resolved in the current build. */ export declare function isRelativeOrAbsoluteSpecifier(value: string): boolean; /** Normalizes a source import id so it can be compared to a built chunk name. */ export declare function getComparableModuleBase(id: string): string; /** Normalizes a Vite build chunk file name back to its source-like base name. */ export declare function getComparableBuiltModuleBase(id: string): string; /** * Picks the candidate sharing the most trailing parent path segments with the * specifier. Returns null on a tie — a wrong pick would redirect a dynamic * import to a different module's mock. */ export declare function pickByParentSegments(specifier: string, candidates: string[]): string; //# sourceMappingURL=module-ids.d.ts.map