import { SpawnOptions } from "node:child_process"; //#region src/types.d.ts /** * Key value pair consisting of NSIS command as key and its description as value. */ type CommandHelpOptions = { [key: string]: string; }; /** * Object storing the output file, and whether the compilation had warnings and the lines where they occurred. */ type CompilerData = { line: string; outFile: string | null; hasWarning: boolean; }; /** * Compiler options for all exposed NSIS methods. */ type CompilerOptions = { define?: DefineOptions; env?: boolean; inputCharset?: string; json?: boolean; noCD?: boolean; noConfig?: boolean; outputCharset?: string; onData?: (data: CompilerData) => void; onError?: (line: string) => void; onClose?: (data: CompilerOutput) => void; pause?: boolean; postExecute?: string | string[]; preExecute?: string | string[]; priority?: 0 | 1 | 2 | 3 | 4 | 5; ppo?: boolean; rawArguments?: string; safePPO?: boolean; strict?: boolean; verbose?: 0 | 1 | 2 | 3 | 4; wine?: boolean; pathToMakensis?: string; pathToWine?: string; }; /** * Standard output of all MakeNSIS commands. Contains the name of the output file, status code, standard output, standard error, and number of warnings. */ type CompilerOutput = { outFile?: string; status: number; stdout: T; stderr: string | null; warnings: number; }; /** * Key value pair consisting of NSIS definitions as key and their value. */ type DefineOptions = { [key: string]: string; }; /** * Key value pair consisting of environment variables as key and their value. */ type EnvironmentVariables = { [key: string]: string | undefined; }; /** * Header information returned by the `-HDRINFO` command. */ type HeaderInfo = { sizes: HeaderInfoSizes; defined_symbols: HeaderInfoSymbols; }; /** * Key value pair consisting of header information sizes as key and their value. */ type HeaderInfoSizes = { [key: string]: string; }; type HeaderInfoSymbols = { [key: string]: boolean | number | string; }; /** * Key value pair consisting of NSIS command as key and its description as value. */ type HelpObject = { [key: string]: string; }; /** * An array containing the command, arguments, and options passed to MakeNSIS. */ type MapArguments = [string, string[], MapArgumentOptions]; /** * Options for mapping arguments to MakeNSIS commands. */ type MapArgumentOptions = { json?: boolean; wine?: boolean; onData?: (data: CompilerData) => void; onError?: (line: string) => void; onClose?: (data: CompilerOutput) => void; }; type StreamOptions = { stdout: string; stderr: string; }; type StreamOptionsFormatted = { stdout: string | HeaderInfo | HelpObject | OutputObject; stderr: string; }; type OutputObject = { [key: string]: boolean | number | string | undefined; }; //#endregion //#region src/commands.d.ts /** * Returns usage information for a command, or list all commands * @param command - an NSIS command * @param compilerOptions - compiler options * @returns command help for the specified command, or all commands */ declare function commandHelp(command: string, compilerOptions: CompilerOptions & { json: true; }, spawnOptions?: SpawnOptions): Promise>; declare function commandHelp(command?: string, compilerOptions?: CompilerOptions, spawnOptions?: SpawnOptions): Promise>; /** * Compile specified script with MakeNSIS * @param script - path to NSIS script * @param compilerOptions - compiler options */ declare function compile(script: string | null, compilerOptions?: CompilerOptions, spawnOptions?: SpawnOptions): Promise; /** * Returns information about which options were used to compile MakeNSIS * @param compilerOptions - compiler options * @returns header information used for MakeNSIS compilation */ declare function headerInfo(compilerOptions: CompilerOptions & { json: true; }, spawnOptions?: SpawnOptions): Promise>; declare function headerInfo(compilerOptions?: CompilerOptions, spawnOptions?: SpawnOptions): Promise>; /** * Returns MakeNSIS software license * @param compilerOptions - compiler options * @returns MakeNSIS license text */ declare function license(compilerOptions: CompilerOptions & { json: true; }, spawnOptions?: SpawnOptions): Promise>; declare function license(compilerOptions?: CompilerOptions, spawnOptions?: SpawnOptions): Promise>; /** * Returns directory where NSIS is installed to * @param compilerOptions - compiler options * @returns NSIS directory path or object with `nsisdir` property */ declare function nsisDir(compilerOptions: CompilerOptions & { json: true; }, spawnOptions?: SpawnOptions): Promise<{ nsisdir: string; } | null>; declare function nsisDir(compilerOptions?: CompilerOptions, spawnOptions?: SpawnOptions): Promise; /** * Returns version of MakeNSIS * @param compilerOptions - compiler options * @returns NSIS version string or object with `version` property */ declare function version(compilerOptions: CompilerOptions & { json: true; }, spawnOptions?: SpawnOptions): Promise>; declare function version(compilerOptions?: CompilerOptions, spawnOptions?: SpawnOptions): Promise>; //#endregion export { CommandHelpOptions, CompilerData, CompilerOptions, CompilerOutput, DefineOptions, EnvironmentVariables, HeaderInfo, HeaderInfoSizes, HeaderInfoSymbols, HelpObject, MapArgumentOptions, MapArguments, OutputObject, StreamOptions, StreamOptionsFormatted, commandHelp, compile, headerInfo, license, nsisDir, version };