histoire
Version:
A fast story book powered by Vite
52 lines • 2.55 kB
TypeScript
import type { Context } from '../context.js';
/**
* Runtime entry of `@histoire/shared`, aliased into every Histoire Vite config
* so the app and the browser runtimes share a single instance of it.
*/
export declare const histoireSharedPath: string;
export { tryResolveDependency, withPackageDirs } from '../util/resolve-package.js';
/**
* Lists the directories of the support plugins (and of their `client`/`collect`
* entries) so the dev server is allowed to serve files from them.
* @param ctx The histoire context.
*/
export declare function resolveSupportPluginAllowPaths(ctx: Context): string[];
/**
* Lists the package directories of resolved workbench and frame plugin entries, so the
* dev server may serve them (and their sibling modules) from outside the project root.
* @param ctx The histoire context.
*/
export declare function resolveWorkbenchPluginAllowPaths(ctx: Context): string[];
/**
* Module paths the browser runtimes need, resolved from the user project.
*/
export interface BrowserRuntimePaths {
/** Directories added to `server.fs.allow` for the browser runtime packages. */
allowPaths: string[];
/** Resolved `msw/browser` entry, aliased so stories and the runtime share one instance. */
mswBrowser: string | null;
/** Resolved `msw/core/http` entry, aliased for the same reason. */
mswCoreHttp: string | null;
/** MSW 2 entry used when Vitest 5's mocker asks for the MSW 3 subpath. */
mswHttpFallback?: string | null;
/** Directories of the resolved msw entries, added to `server.fs.allow`. */
mswAllowPaths: string[];
/** Resolved `@vitest/expect`, used by the story `vitest` shim. */
vitestExpect: string | null;
/** Vitest 5 supplies assertions and spies from its own entry point. */
vitestHasBundledExpect?: boolean;
/** Resolved `@vitest/mocker/browser`, used by the story `vitest` shim. */
vitestMockerBrowser: string | null;
/** Resolved `@vitest/spy`, used by the story `vitest` shim. */
vitestSpy: string | null;
}
/**
* Resolves everything the browser-side runtimes need from the user project.
*
* All lookups are skipped when the project has no Vitest: the shim and the msw
* aliases only exist to make story-level test/mocking code run in the browser.
* @param ctx The histoire context.
* @param projectHasVitest Whether Vitest is available in the user project.
*/
export declare function resolveBrowserRuntimePaths(ctx: Context, projectHasVitest: boolean): BrowserRuntimePaths;
//# sourceMappingURL=resolve-paths.d.ts.map