js-slang
Version:
Javascript-based implementations of Source, written in Typescript
26 lines (25 loc) • 1.13 kB
TypeScript
import type { Context, IOptions, Result } from '..';
import type { FileGetter } from '../modules/moduleTypes';
import { type RecursivePartial } from '../types';
import { resolvedErrorPromise } from './utils';
export declare const DEFAULT_SOURCE_OPTIONS: Readonly<IOptions>;
/**
* Returns both the Result of the evaluated program, as well as
* `verboseErrors`.
*/
export declare function sourceFilesRunner(filesInput: FileGetter, entrypointFilePath: string, context: Context, options?: RecursivePartial<IOptions>): Promise<{
result: Result;
verboseErrors: boolean;
}>;
/**
* Useful for just running a single line of code with the given context
* However, if this single line of code is an import statement,
* then the FileGetter is necessary, otherwise all local imports will
* fail with ModuleNotFoundError
*/
export declare function runCodeInSource(code: string, context: Context, options?: RecursivePartial<IOptions>, defaultFilePath?: string, fileGetter?: FileGetter): Promise<{
result: Result;
verboseErrors: boolean;
}>;
export { htmlRunner } from './htmlRunner';
export { resolvedErrorPromise };