import { IOResult } from '../../../io/types.ts'; import type { RunResult } from '../../../runtime/types.ts'; /** * Convert one interpreter outcome into a command's output pair. * * The single RunResult-to-IOResult mapping: empty stdout becomes null * (no stream), the exit code and stderr pass through. The interpreter * handlers and the CLI script arm both convert through here so the * mapping cannot drift (Python's run_output in * commands/builtin/general/interpreter.py). */ export declare function runOutput(result: RunResult): [Uint8Array | null, IOResult]; export type SourceMode = 'payload' | 'module' | 'file' | 'stdin'; export declare const PAYLOAD_ARGV0 = "-c"; export declare const STDIN_ARGV0 = "-"; export declare const STDIN_OPERAND = "-"; /** * Drop a script's first line the way CPython's `-x` does. * * The first line is emptied rather than removed, because CPython keeps * the line numbering of the whole file: a raise on physical line 2 * still reports line 2 under `-x` (pinned on 3.12.11). A file with no * newline at all is one line, so `-x` leaves nothing. * * Args: * code: the script's text as read. */ export declare function skipFirstLine(code: string): string; /** * The program that `-m mod` runs, on any engine that is real CPython. * * runpy does the work: run_module finds the module, runs it under * __main__, and alter_sys rewrites sys.argv[0] to the module's own * file, which is what CPython puts there. Engines that are not CPython * declare runsModules false and never see this. * * The existence probe is not redundant with run_module: CPython answers * a missing module with one line and exit 1, while bare run_module * raises, which would reach the user as a runpy traceback. Probing * first also keeps an ImportError raised INSIDE the module distinct * from the module itself being absent, which a try around run_module * could not tell apart. * * Args: * name: the module to run. * label: the command name used in the not-found message. */ export declare function moduleSource(name: string, label: string): string; //# sourceMappingURL=interpreter.d.ts.map