import { defaultScheduler } from "./evaluate"; import { ExpressionStatement, Program } from "./nodeTypes"; import { ASTNode, Continuation, Environment, ErrorContinuation, EvalParam, Evaluate, EvaluateBase, EvaluateMid, EvaluationConfig, PartialErrorContinuation, Phase, Script, Source } from "./types"; export interface Context { evaluate: Evaluate; } export declare const BaseConfig: { interpreters: { values: { BlockStatement: import("./types").Interpreter; Program: import("./types").Interpreter; VariableDeclarator: import("./types").Interpreter; VariableDeclaration: import("./types").Interpreter; ObjectPattern: import("./types").Interpreter; AssignmentPattern: import("./types").Interpreter; IfStatement: import("./types").Interpreter; ExpressionStatement: import("./types").Interpreter; TryStatement: import("./types").Interpreter; ThrowStatement: import("./types").Interpreter; CatchClause: import("./types").Interpreter; ReturnStatement: import("./types").Interpreter; BreakStatement: import("./types").Interpreter; FunctionDeclaration: import("./types").Interpreter; ForInStatement: import("./types").Interpreter; ForStatement: import("./types").Interpreter; ForOfStatement: import("./types").Interpreter; WhileStatement: import("./types").Interpreter; ContinueStatement: import("./types").Interpreter; EmptyStatement: import("./types").Interpreter; ClassDeclaration: import("./types").Interpreter; ClassBody: import("./types").Interpreter; MethodDefinition: import("./types").Interpreter; DebuggerStatement: import("./types").Interpreter; SwitchStatement: import("./types").Interpreter; DoWhileStatement: import("./types").Interpreter; CallExpression: import("./types").Interpreter; MemberExpression: import("./types").Interpreter; ArrowFunctionExpression: import("./types").Interpreter; FunctionExpression: import("./types").Interpreter; AssignmentExpression: import("./types").Interpreter; ObjectExpression: import("./types").Interpreter; Property: import("./types").Interpreter; BinaryExpression: import("./types").Interpreter; ArrayExpression: import("./types").Interpreter; NullValue: import("./types").Interpreter<{ type: "NullValue"; }>; NewExpression: import("./types").Interpreter; SequenceExpression: import("./types").Interpreter; LogicalExpression: import("./types").Interpreter; UpdateExpression: import("./types").Interpreter; UnaryExpression: import("./types").Interpreter; ThisExpression: import("./types").Interpreter; ConditionalExpression: import("./types").Interpreter; TemplateLiteral: import("./types").Interpreter; TaggedTemplateExpression: import("./types").Interpreter; SpreadElement: import("./types").Interpreter; AwaitExpression: import("./types").Interpreter; ClassExpression: import("./types").Interpreter; Identifier: import("./types").Interpreter; Literal: import("./types").Interpreter; Apply: import("./types").Interpreter; GetProperty: import("./types").Interpreter; SetProperty: import("./types").Interpreter; SetValue: typeof import("./environment").SetValue; GetValue: typeof import("./environment").GetValue; }; }; schedule: typeof defaultScheduler; }; export declare const BaseModuleConfig: { interpreters: { values: { ExportNamedDeclaration: import("./types").Interpreter; ExportDefaultDeclaration: import("./types").Interpreter; ImportDeclaration: import("./types").Interpreter; Identifier: import("./types").Interpreter; }; prev: { values: { BlockStatement: import("./types").Interpreter; Program: import("./types").Interpreter; VariableDeclarator: import("./types").Interpreter; VariableDeclaration: import("./types").Interpreter; ObjectPattern: import("./types").Interpreter; AssignmentPattern: import("./types").Interpreter; IfStatement: import("./types").Interpreter; ExpressionStatement: import("./types").Interpreter; TryStatement: import("./types").Interpreter; ThrowStatement: import("./types").Interpreter; CatchClause: import("./types").Interpreter; ReturnStatement: import("./types").Interpreter; BreakStatement: import("./types").Interpreter; FunctionDeclaration: import("./types").Interpreter; ForInStatement: import("./types").Interpreter; ForStatement: import("./types").Interpreter; ForOfStatement: import("./types").Interpreter; WhileStatement: import("./types").Interpreter; ContinueStatement: import("./types").Interpreter; EmptyStatement: import("./types").Interpreter; ClassDeclaration: import("./types").Interpreter; ClassBody: import("./types").Interpreter; MethodDefinition: import("./types").Interpreter; DebuggerStatement: import("./types").Interpreter; SwitchStatement: import("./types").Interpreter; DoWhileStatement: import("./types").Interpreter; CallExpression: import("./types").Interpreter; MemberExpression: import("./types").Interpreter; ArrowFunctionExpression: import("./types").Interpreter; FunctionExpression: import("./types").Interpreter; AssignmentExpression: import("./types").Interpreter; ObjectExpression: import("./types").Interpreter; Property: import("./types").Interpreter; BinaryExpression: import("./types").Interpreter; ArrayExpression: import("./types").Interpreter; NullValue: import("./types").Interpreter<{ type: "NullValue"; }>; NewExpression: import("./types").Interpreter; SequenceExpression: import("./types").Interpreter; LogicalExpression: import("./types").Interpreter; UpdateExpression: import("./types").Interpreter; UnaryExpression: import("./types").Interpreter; ThisExpression: import("./types").Interpreter; ConditionalExpression: import("./types").Interpreter; TemplateLiteral: import("./types").Interpreter; TaggedTemplateExpression: import("./types").Interpreter; SpreadElement: import("./types").Interpreter; AwaitExpression: import("./types").Interpreter; ClassExpression: import("./types").Interpreter; Identifier: import("./types").Interpreter; Literal: import("./types").Interpreter; Apply: import("./types").Interpreter; GetProperty: import("./types").Interpreter; SetProperty: import("./types").Interpreter; SetValue: typeof import("./environment").SetValue; GetValue: typeof import("./environment").GetValue; }; }; }; schedule: typeof defaultScheduler; }; export declare function isEvaluable(input: EvalParam): input is Script | Source; export declare const metaesEval: EvaluateBase; export declare const metaesEvalModule: EvaluateBase<{ [key: string]: any; }>; export declare class MetaesContext implements Context { c?: (() => void) | ((value?: unknown) => void) | ((value: any) => void) | undefined; cerr?: ErrorContinuation | undefined; defaultConfig: Partial; cache?: { get(source: string): Program; set(source: string, value: Program): Program; } | undefined; environment: Environment; constructor(c?: (() => void) | ((value?: unknown) => void) | ((value: any) => void) | undefined, cerr?: ErrorContinuation | undefined, environment?: Environment | object, defaultConfig?: Partial, cache?: { get(source: string): Program; set(source: string, value: Program): Program; } | undefined); evaluate: EvaluateBase; } export declare const parseFunction: (fn: Function, cache?: { get(source: string): Program; set(source: string, value: Program): Program; } | undefined) => Program; export declare const createScriptFromFnBody: (source: Function, cache?: { get(source: string): Program; set(source: string, value: Program): Program; } | undefined) => { ast: ASTNode; scriptId: string; source: Function; }; export declare const evalFn: (evaluate: EvaluateMid) => EvaluateMid void; args?: T | undefined; }, false>; export declare const evalFnBody: (evaluate: EvaluateBase) => EvaluateBase; export declare const consoleLoggingMetaesContext: (environment?: Environment) => MetaesContext; export declare const callInterceptor: (phase: Phase, config: EvaluationConfig, e: ASTNode, env: Environment, value?: any) => void | undefined; /** * Converts function from continuation passing style style back to normal return/throw style. * * It may not work if provided function `fn` doesn't use `c` or `cerr` callbacks immediately. Use `uncpsp` in this case. */ export declare const uncps: (fn: (input: I, c: Continuation, cerr: PartialErrorContinuation, ...rest: R) => void, thisValue?: any) => (input?: I | undefined, ...rest: R) => O; /** * Converts function from continuation passing style style back to normal return/throw style using Promise. */ export declare const uncpsp: (fn: (input: I, c: Continuation, cerr: PartialErrorContinuation, ...rest: R) => void, thisValue?: any) => (input?: I | undefined, ...rest: R) => Promise; export declare const cpsify: (fn: (input: I, env?: Environment | undefined, config?: Partial | undefined) => O) => EvaluateMid; export declare type Upgradable = T | ((arg: T) => T); export declare const upgraded: (superArg: T, update?: Upgradable> | undefined) => T & {}; /** * Creates list of arguments waiting to be applied to a function. */ export declare const bindArgs: (...args: T) => (fn: (...args: T) => unknown) => unknown;