import type { BuildOptions, BuildResult } from 'esbuild'; import { Dict } from '@giveback007/util-lib'; import chokidar from 'chokidar'; declare type CopyFromTo = { from: string; to: string; }; export declare type WatchEvent = 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir' | 'copy'; export declare type NodeTranspiler = (entryFile: string, outFile: string, opts?: { changeBuildOpts?: BuildOptions; }) => Promise; export declare type BrowserTranspiler = (entryFile: string, toDir: string, opts?: { changeBuildOpts?: BuildOptions; envVars?: Dict; }) => Promise; export declare type BuilderOpt = { projectRoot: string; fromDir: string; toDir: string; buildFct: () => Promise; copyFiles?: string[]; watchHandler?: (opts: { name: string; file: string; action: WatchEvent; }) => unknown; }; export declare class BuilderUtil { private readonly projectRoot; private readonly fromDir; private readonly toDir; private readonly buildFct; private readonly watchers; private readonly watchHandler; private readonly copyFiles; constructor(opts: BuilderOpt); addWatcher(name: string, paths: string[]): chokidar.FSWatcher; private watchersInitialized; initWatchers(): Promise; private resolver; private buildTimeoutId; buildDebounce(logTime?: boolean): Promise<"bounce" | "built">; build(opts?: { logTime?: boolean; }): Promise; /** cleans "toDir" */ cleanToDir: () => Promise; copy: () => Promise; info: () => { projectRoot: string; fromDir: string; toDir: string; copyFiles: CopyFromTo[]; }; watchCopyFiles: (afterCopy?: (() => unknown) | undefined) => void; fileCopyAction: (actions: O | O[]) => Promise; static copyFileHandler(handle: O | O[]): Promise; static cleanDir(dir: string): Promise; } export declare function timeString(t: number): string; export declare function buildLogStart(opts: { from: string; to: string; root: string; }): { end: () => void; }; export declare const transpileBrowser: BrowserTranspiler; export declare const transpileNode: NodeTranspiler; export declare function network(): string | undefined; export declare class ProcessManager { private readonly command; private readonly args?; private app; private appStartTime; constructor(command: string, args?: string[] | undefined); reload: () => Promise; kill: () => Promise; private spawnChild; } export declare function ensureStarterFiles(opts: { root: string; fromDir: string; starterFilesDir: string; overwrite?: boolean; }): Promise; export declare const onProcessEnd: (fct: (exitCode: number) => unknown) => void; export declare const genWatchPaths: (dirs: string[], exts: string[]) => string[]; export declare function waitForFSWatchersReady(watchers: (undefined | null | false | chokidar.FSWatcher)[]): Promise; export declare function filesAndDirs(files: string[]): Promise; export declare function logAndExit(txt: string, color?: 'red' | 'green' | 'blue' | 'yellow' | 'white'): never; export declare const makeJoinFct: (rootDir: string) => (toJoin: D) => D; export declare const arrEnsure: (x: T) => T extends unknown[] ? T : T[]; export declare const nodeFlags: { register: string[]; regular: string[]; }; export declare function configEnv(path: string): false | Dict; export {};