import ts from '@typescript/typescript6'; export interface CanonicalRuntimeImportShape { defaultBinding?: string; namedBindings?: ReadonlySet; } /** * Check whether a generated sync helper statement is inert until main() runs. * Runtime imports are limited to the modules used by that helper; all other * imports must be erased by TypeScript. */ export declare function isAllowedSyncHelperTopLevelStatement(statement: ts.Statement, allowedRuntimeImportModules: ReadonlySet, isAllowedVariableStatement?: (statement: ts.VariableStatement) => boolean): boolean; /** Require runtime imports to match the generated helper's load-time API. */ export declare function hasCanonicalRuntimeImports(sourceFile: ts.SourceFile, expectedImports: ReadonlyMap): boolean; /** Find a control-flow completion without crossing a nested function boundary. */ export declare function containsCompletion(node: ts.Node, isTerminal: (candidate: ts.Node) => boolean): boolean; /** Unwrap supported static TypeScript wrappers to reach the underlying expression. */ export declare function unwrapStaticExpression(expression: ts.Expression): ts.Expression; /** Validate the generated main().catch() failure boundary. */ export declare function isCanonicalSyncMainCatchHandler(rawHandler: ts.Expression): boolean; /** Return a side-effect-free `new Error(message)` expression when present. */ export declare function getSafeErrorConstruction(rawExpression: ts.Expression): ts.NewExpression | null; /** Validate a side-effect-free `new Error(message)` expression. */ export declare function isSafeErrorConstruction(rawExpression: ts.Expression): boolean; /** Require the generated parser's terminal unknown-flag failure. */ export declare function hasCanonicalUnknownFlagThrow(body: ts.Statement, argumentBinding: string): boolean; /** * Reject executable parser work beyond the generated option assignments. * Parser bodies are inspected rather than executed by doctor, so accepting an * unrelated call or mutation here would let the real sync command diverge from * the replayed options. */ export declare function hasOnlyCanonicalParserEffects(node: ts.Node, optionsBinding: string, indexBinding?: string | null): boolean; /** Count continues that target the generated parser's outer argument loop. */ export declare function countOuterParserContinues(node: ts.Node): number; /** Detect a static process.exit() call, regardless of its exit code. */ export declare function isProcessExitCompletion(node: ts.Node): boolean; /** Check whether a prior statement can terminate the current function. */ export declare function hasEarlierAbruptCompletion(statements: readonly ts.Statement[], statementIndex: number): boolean;