UNPKG

es-node-runner

Version:

Node runner that transpiles typescript or es modules using blazing fast ⚡ esbuild and restarts the process automatically on change. Suitable for node development server.

63 lines (62 loc) 2 kB
interface BuildOptions { /** Entry point for bundling * @default 'src/index.ts' */ entry: string; /** Sets the output directory for build operation. * @default 'node_modules/.cache/es-node-runner' */ outdir: string; /** Sets the file name for bundled output. This is applicable only if bundle is true. * @default 'bundle.js' */ outfile: string; /** Sets the target for generated code * @see https://esbuild.github.io/api/#target * @default 'node14' */ target: string; format: 'iife' | 'cjs' | 'esm'; /** Generates sourcemap * @default true */ sourcemap: boolean; } interface WatchOptions { /** Path or list of paths to be watched for changes. * @example watch: 'src' or ['src', 'lib'] * @default 'src' */ watch: string | string[]; /** Ignore list of files / paths from watching for changes. * @example ignore: ['**\/*.{test,spec}.ts'] */ ignore?: string[]; } interface SpawnOptions { /** Rebuild will be delayed by specified time (in millisecond). * @default delay: 1000 */ delay: number; /** Restart sub process manually with terminal cmd * @example restartCmd: 'rst' * @default 'rs' */ restartCmd: string; /** Clear the terminal output before restart * @default false */ clearTerminal: boolean; /** To restart manually with cmd, set this to false. This is helpful * if we want to restart only when necessary. * @default true */ autoRestart: boolean; /** Enable or disable logging * @default true */ logging: boolean; /** Pass cli options to node executable * @default [] */ args: string[]; } type OverridableConfig = { /** Specifies options for building and rebuilding project */ buildOptions: BuildOptions; /** Specifies options for configuring watcher */ watchOptions: WatchOptions; /** Specifies options to be used while spawning a process */ spawnOptions: SpawnOptions; }; export type Config = { [K in keyof OverridableConfig]?: Partial<OverridableConfig[K]>; }; export {};