UNPKG

histoire

Version:

A fast story book powered by Vite

30 lines • 1.43 kB
/** * Resolves a module from the user project first, then from Histoire's own * dependency tree. * * Project-first is what keeps a single copy of a package in play: a story and * the runtime must share the very same `msw`/`vitest` instance, and Histoire's * own copy is only a fallback for projects that do not depend on it directly. * @param root The project root to resolve from first. * @param id The module id to resolve. * @param options Resolution options. * @param options.fallback Set to `false` to only accept the project's own install. * @returns The resolved path, or `null` when neither install has it. */ export declare function tryResolveDependency(root: string, id: string, options?: { fallback?: boolean; }): string | null; /** * Lists existing `node_modules/<packageName>` folders in the ancestor chain of * `root`, i.e. the lookup locations Node tries before global folders. * @param root Directory to start searching from. * @param packageName Package name, possibly scoped. */ export declare function findProjectPackageDirectories(root: string, packageName: string): string[]; /** * Expands dependency ids with their resolved install directory so Vite's * dependency optimizer picks up both the bare id and the on-disk package. * @param deps Bare dependency ids. */ export declare function withPackageDirs(deps: Iterable<string>): string[]; //# sourceMappingURL=resolve-package.d.ts.map