opusdev/vector-similarity-api
1
1import type { WatchOptions } from 'chokidar'2 3export type NodemonEventHandler =4 | 'start'5 | 'crash'6 | 'exit'7 | 'quit'8 | 'restart'9 | 'config:update'10 | 'log'11 | 'readable'12 | 'stdout'13 | 'stderr';14 15export type NodemonEventListener = {16 on(event: 'start' | 'crash' | 'readable', listener: () => void): Nodemon;17 on(event: 'log', listener: (e: NodemonEventLog) => void): Nodemon;18 on(event: 'stdout' | 'stderr', listener: (e: string) => void): Nodemon;19 on(event: 'restart', listener: (e?: NodemonEventRestart) => void): Nodemon;20 on(event: 'quit', listener: (e?: NodemonEventQuit) => void): Nodemon;21 on(event: 'exit', listener: (e?: number) => void): Nodemon;22 on(event: 'config:update', listener: (e?: NodemonEventConfig) => void): Nodemon;23};24 25export type NodemonEventLog = {26 /**27 - detail: what you get with nodemon --verbose.28 - status: subprocess starting, restarting.29 - fail: is the subprocess crashing.30 - error: is a nodemon system error.31 */32 type: 'detail' | 'log' | 'status' | 'error' | 'fail';33 /** the plain text message */34 message: string;35 /** contains the terminal escape codes to add colour, plus the "[nodemon]" prefix */36 colour: string;37};38 39export interface NodemonEventRestart {40 matched?: {41 result: string[];42 total: number;43 };44}45 46export type NodemonEventQuit = 143 | 130;47 48export type NodemonEventConfig = {49 run: boolean;50 system: {51 cwd: string;52 };53 required: boolean;54 dirs: string[];55 timeout: number;56 options: NodemonConfig;57 lastStarted: number;58 loaded: string[];59 load: (settings: NodemonSettings, ready: (config: NodemonEventConfig) => void) => void;60 reset: () => void;61};62 63export interface NodemonExecOptions {64 script: string;65 scriptPosition?: number;66 args?: string[];67 ext?: string; // "js,mjs" etc (should really support an array of strings, but I don't think it does right now)68 exec?: string; // node, python, etc69 execArgs?: string[]; // args passed to node, etc,70 nodeArgs?: string[]; // args passed to node, etc,71}72 73export interface NodemonConfig {74 /** restartable defaults to "rs" as a string the user enters */75 restartable?: false | string;76 colours?: boolean;77 execMap?: { [key: string]: string };78 ignoreRoot?: string[];79 watch?: string[];80 ignore?: string[];81 stdin?: boolean;82 runOnChangeOnly?: boolean;83 verbose?: boolean;84 signal?: string;85 stdout?: boolean;86 watchOptions?: WatchOptions;87 help?: string;88 version?: boolean;89 cwd?: string;90 dump?: boolean;91 delay?: number;92 monitor?: string[];93 spawn?: boolean;94 noUpdateNotifier?: boolean;95 legacyWatch?: boolean;96 pollingInterval?: number;97 /** @deprecated as this is "on" by default */98 js?: boolean;99 quiet?: boolean;100 configFile?: string;101 exitCrash?: boolean;102 execOptions?: NodemonExecOptions;103}104 105export interface NodemonSettings extends NodemonConfig, NodemonExecOptions {106 events?: Record<string, string>;107 env?: Record<string, string>;108}109 110export type Nodemon = {111 (settings: NodemonSettings): Nodemon;112 removeAllListeners(event: NodemonEventHandler): Nodemon;113 emit(type: NodemonEventHandler, event?: any): Nodemon;114 reset(callback: Function): Nodemon;115 restart(): Nodemon;116 config: NodemonSettings;117} & NodemonEventListener & {118 [K in keyof NodemonEventListener as "addListener"]: NodemonEventListener[K];119} & {120 [K in keyof NodemonEventListener as "once"]: NodemonEventListener[K];121};122 123declare const nodemon: Nodemon;124 125export = nodemon;126 