UNPKG

@factorialco/shadowdog

Version:

<img src="https://raw.githubusercontent.com/factorialco/shadowdog/refs/heads/main/logo.png" alt="drawing" width="100"/>

121 lines (120 loc) 3.59 kB
import { z } from 'zod'; import { CommandConfig, PluginsConfig } from '../config'; import { Task } from '../generate'; import { pluginOptionsSchema } from '../pluginTypes'; import { ShadowdogEventEmitter } from '../events'; export type Listener<Options = unknown> = (shadowdogEventListener: ShadowdogEventEmitter, options: Options) => void; export type Command = (activeWatchers: Task) => Task; export type Middleware<Options = unknown> = (control: { files: string[]; environment: string[]; config: CommandConfig; options: Options; next: () => Promise<unknown>; abort: () => void; changedFilePath?: string; eventEmitter: ShadowdogEventEmitter; }) => Promise<unknown>; type PluginsMap = { 'shadowdog-rake': { command: Command; }; 'shadowdog-local-cache': { middleware: Middleware<Extract<z.infer<typeof pluginOptionsSchema>, { name: 'shadowdog-local-cache'; }>['options']>; }; 'shadowdog-remote-aws-s3-cache': { middleware: Middleware<Extract<z.infer<typeof pluginOptionsSchema>, { name: 'shadowdog-remote-aws-s3-cache'; }>['options']>; }; 'shadowdog-tag': { command: Command; }; 'shadowdog-tree': { command: Command; }; 'shadowdog-socket': { listener: Listener<Extract<z.infer<typeof pluginOptionsSchema>, { name: 'shadowdog-socket'; }>['options']>; }; 'shadowdog-git': { middleware: Middleware; }; 'shadowdog-lock': { listener: Listener<Extract<z.infer<typeof pluginOptionsSchema>, { name: 'shadowdog-lock'; }>['options']>; }; 'shadowdog-mcp': { listener: Listener<Extract<z.infer<typeof pluginOptionsSchema>, { name: 'shadowdog-mcp'; }>['options']>; }; }; declare const PLUGINS_MAP: { readonly 'shadowdog-rake': { command: Command; }; readonly 'shadowdog-local-cache': { middleware: Middleware<{ path: string; read: boolean; write: boolean; }>; }; readonly 'shadowdog-remote-aws-s3-cache': { middleware: Middleware<{ path: string; read: boolean; write: boolean; bucketName: string; }>; }; readonly 'shadowdog-tag': { command: Command; }; readonly 'shadowdog-tree': { command: Command; }; readonly 'shadowdog-socket': { listener: Listener<{ path: string; }>; }; readonly 'shadowdog-git': { middleware: Middleware; }; readonly 'shadowdog-lock': { listener: Listener<{ path: string; }>; }; readonly 'shadowdog-mcp': { listener: Listener<{}>; }; }; export declare const filterMiddlewarePlugins: (config: PluginsConfig) => { name: keyof PluginsMap; fn: Extract<PluginsMap[keyof PluginsMap], { middleware: Middleware<unknown>; }>; options: z.infer<typeof pluginOptionsSchema>["options"]; }[]; export declare const filterCommandPlugins: (pluginsConfig: PluginsConfig) => { name: keyof PluginsMap; fn: { command: Command; }; options: z.infer<typeof pluginOptionsSchema>["options"]; }[]; export declare const filterEventListenerPlugins: (pluginsConfig: PluginsConfig) => { name: keyof PluginsMap; fn: { listener: Listener<z.infer<typeof pluginOptionsSchema>["options"]>; }; options: z.infer<typeof pluginOptionsSchema>["options"]; }[]; export default PLUGINS_MAP;