Fix an issue with asc not finding bundled library files in the browser; Minor cleanup

This commit is contained in:
dcodeIO
2018-03-21 23:27:53 +01:00
parent d4c46b036e
commit 00e6d613a9
12 changed files with 138 additions and 100 deletions

39
tests/browser-asc.js Normal file
View File

@ -0,0 +1,39 @@
const asc = require("../dist/asc.js");
const stdout = asc.createMemoryStream();
const stderr = asc.createMemoryStream();
const files = {
"/module.ts": `import "allocator/arena";`
};
asc.main([
"./module.ts",
"--textFile"
], {
stdout: stdout,
stderr: stderr,
readFile: (name) => {
console.log("readFile: " + name);
if (files.hasOwnProperty(name)) {
return files[name];
}
return null;
},
writeFile: (name, data) => {
console.log("writeFile: " + name);
},
listFiles: (dirname) => {
console.log("listFiles: " + dirname);
return [];
}
}, err => {
if (err) {
console.log(">>> THROWN >>>");
console.log(err);
}
console.log(">>> STDOUT >>>");
process.stdout.write(stdout.toString());
console.log(">>> STDERR >>>");
process.stdout.write(stderr.toString());
});