UNPKG

js-slang

Version:

Javascript-based implementations of Source, written in Typescript

29 lines (28 loc) 993 B
import type { FileGetter } from '../moduleTypes'; /** * Options for resolving modules given a path */ export type ImportResolutionOptions = { /** * If `null`, the resolver will only match exact files * Otherwise, the resolver will first try to match an exact path, * then paths ending with the given extensions * * For the given path: `./a`, `null` will only match `./a` * Otherwise, providing an array like :`['js', 'ts']` will try * match `./a`, `./a.js` and then `./a.ts` */ extensions: string[] | null; }; export declare const defaultResolutionOptions: ImportResolutionOptions; export type ResolverResult = { type: 'source'; } | { type: 'local'; absPath: string; contents: string; }; /** * Resolve a relative module path to an absolute path. */ export default function resolveFile(fromPath: string, toPath: string, fileGetter: FileGetter, options?: Partial<ImportResolutionOptions>): Promise<ResolverResult | undefined>;