histoire
Version:
A fast story book powered by Vite
60 lines • 2.81 kB
TypeScript
import type { BuildEndCallback, ChangeViteConfigCallback, HistoireConfig, ModuleLoader, Plugin, PluginApiBase, PluginApiBuild, PluginApiDev, PluginApiDevEvent, PreviewStoryCallback, ServerStory } from '@histoire/shared';
import type { Context } from './context.js';
import fs from 'fs-extra';
import path from 'pathe';
export declare class BasePluginApi implements PluginApiBase {
protected ctx: Context;
protected plugin: Plugin;
moduleLoader: ModuleLoader;
colors: import("picocolors/types.js").Colors & {
createColors: (enabled?: boolean) => import("picocolors/types.js").Colors;
};
path: typeof path;
fs: typeof fs;
constructor(ctx: Context, plugin: Plugin, moduleLoader: ModuleLoader);
/** Resolved project root, independent from the caller's process cwd. */
get root(): string;
/** Trusted configuration/resource ownership for the captured generation. */
getContext(): import("@histoire/shared").PluginConfigContext;
/** Isolated mutable plugin output, unique across operation captures. */
get pluginTempDir(): string;
log(...msg: any[]): void;
warn(...msg: any[]): void;
error(...msg: any[]): void;
addStoryFile(file: string): void;
/** Removes one owned story without touching another plugin's inventory. */
removeStoryFile(file: string): void;
/** Captured cleanup and execution ownership jointly fence publication. */
isActive(): boolean;
getStories(): ServerStory[];
getConfig(): HistoireConfig;
}
export declare class DevPluginApi extends BasePluginApi implements PluginApiDev {
watcher: {
watch: typeof import("chokidar").watch;
FSWatcher: typeof import("chokidar").FSWatcher;
};
}
export declare class BuildPluginApi extends BasePluginApi implements PluginApiBuild {
/** Directory receiving the static book. */
outputDir: string;
changeViteConfigCallbacks: ChangeViteConfigCallback[];
/**
* @param ctx Histoire context.
* @param plugin Plugin owning this API.
* @param moduleLoader Loader bound to the build collection server.
* @param outputDir Static book directory; defaults to the configured `outDir`.
*/
constructor(ctx: Context, plugin: Plugin, moduleLoader: ModuleLoader, outputDir?: string);
buildEndCallbacks: BuildEndCallback[];
previewStoryCallbacks: PreviewStoryCallback[];
changeViteConfig(cb: ChangeViteConfigCallback): void;
onBuildEnd(cb: BuildEndCallback): void;
onPreviewStory(cb: PreviewStoryCallback): void;
}
export declare class DevEventPluginApi extends BasePluginApi implements PluginApiDevEvent {
event: string;
payload: any;
constructor(ctx: Context, plugin: Plugin, moduleLoader: ModuleLoader, event: string, payload: any);
}
//# sourceMappingURL=plugin.d.ts.map