UNPKG

histoire

Version:

A fast story book powered by Vite

41 lines • 2.19 kB
import type { Plugin as VitePlugin } from 'vite'; /** * Query flag carried by every module of a workbench plugin client graph. * * Plugin client modules run inside the prebuilt workbench, which uses the vendored * `@histoire/vendors/vue` copy, while story code uses the project's own `vue` (or none * at all in React and Svelte projects). Marking the plugin graph gives each of its * modules a distinct id, so the same file reached from story code keeps the project's * resolution: two module instances, each wired to its own Vue. */ export declare const WORKBENCH_MODULE_MARKER = "histoire-workbench"; /** * Whether a module id belongs to a workbench plugin client graph. * @param id Resolved module id, possibly with a query. */ export declare function hasWorkbenchMarker(id: string): boolean; /** * Adds the marker right after `?`: Vite and framework plugins match suffixes such as * `lang.ts` or `.css` at the end of ids, so the marker must never be last. * @param id Resolved module id. */ export declare function addWorkbenchMarker(id: string): string; /** * Creates the `resolveId` hook routing Vue in workbench plugin client graphs to the * workbench's vendored copy (see {@link WORKBENCH_MODULE_MARKER}). * * Inside a marked graph: * - `vue` and its stateful runtime packages resolve exactly as the prebuilt workbench * resolves `@histoire/vendors/vue`, so the browser loads one URL and one instance. * Other `vue/*` subpaths are rejected: the vendored build is runtime-only. * - `@histoire/controls/vue` resolves to the controls copy bundled into the workbench. * - Relative and absolute script imports stay marked. * - Packages declaring a `vue` dependency (and `@histoire/plugin-kit/vue*`) resolve * without the dependency optimizer and stay marked: a prebundle would embed the * project's Vue, or fail in projects without one. * - Other packages (React, utilities) resolve normally and are shared with stories. * * Workbench and vendor packages are never marked: they already use the vendored Vue. */ export declare function createWorkbenchVueResolver(): NonNullable<VitePlugin['resolveId']>; //# sourceMappingURL=workbench-vue.d.ts.map