UNPKG

histoire

Version:

A fast story book powered by Vite

45 lines • 2.44 kB
import type { ConfigMode, FinalSupportPlugin, HistoireConfig, PluginCommand, ServerMarkdownFile, ServerStoryFile } from '@histoire/shared'; import type { ResolvedConfig } from 'vite'; import type { ConfigurationObserver } from './config/dependencies.js'; import type { PublicPluginMetadata } from './config/plugin-metadata.js'; import type { PluginInventoryRow, PluginToggleInventory } from './config/plugin-toggle-inventory.js'; import type { ResolvedWorkbenchPlugin } from './config/workbench-plugins.js'; export { closeContext } from './runtime/registry.js'; export interface Context { root: string; /** Explicit configuration location reused by isolated library operations. */ configFile?: string; config: HistoireConfig; /** * Vite's resolved config, with the Histoire overrides merged on top — the * merge produces a plain config object, not another `ResolvedConfig`, so only * the fields both shapes share (`root`, `base`, `publicDir`…) are readable. */ resolvedViteConfig: Pick<ResolvedConfig, 'root' | 'base' | 'publicDir'>; mode: ConfigMode; storyFiles: ServerStoryFile[]; supportPlugins: FinalSupportPlugin[]; markdownFiles: ServerMarkdownFile[]; registeredCommands?: PluginCommand[]; /** Validated `Plugin.workbench` descriptors with resolved entries, in config order. */ workbenchPlugins?: ResolvedWorkbenchPlugin[]; /** Browser-safe plugin details, indexed in resolved configuration order. */ pluginMetadata?: PublicPluginMetadata[]; /** Browser-safe inventory and server-owned config edit evidence. */ pluginInventory?: PluginInventoryRow[]; /** Private source and revision data for plugin management. */ pluginToggle?: PluginToggleInventory; /** Resolved `clientSetupFile` of each registered command that has one. */ commandClientSetupFiles?: Map<PluginCommand, string>; } export interface CreateContextOptions { /** Parent-owned CLI config watches can subscribe before plugin startup finishes. */ onConfigurationInputs?: ConfigurationObserver; /** Explicit project root; legacy CLI callers default to launch cwd. */ root?: string; mode: Context['mode']; configFile?: string; } /** Resolves a private project capture without changing process cwd or environment. */ export declare function createContext(options: CreateContextOptions): Promise<Context>; //# sourceMappingURL=context.d.ts.map