Use baseDir as another parameter to readDir etc. to simplify compatibility between asc running under node and in the browser, see #354

This commit is contained in:
dcodeIO
2018-12-03 19:29:49 +01:00
parent aedc821c09
commit ced01216f8
6 changed files with 38 additions and 45 deletions

6
cli/asc.d.ts vendored
View File

@ -55,11 +55,11 @@ interface CompilerOptions {
/** Standard error stream to use. */
stderr?: OutputStream;
/** Reads a file from disk (or memory). */
readFile?: (name: string) => string | null;
readFile?: (filename: string, baseDir: string) => string | null;
/** Writes a file to disk (or memory). */
writeFile?: (name: string, contents: Uint8Array) => void;
writeFile?: (filename: string, contents: Uint8Array, baseDir: string) => void;
/** Lists all files within a directory. */
listFiles?: (dir: string) => string[] | null;
listFiles?: (dirname: string, baseDir: string) => string[] | null;
}
/** Convenience function that parses and compiles source strings directly. */