mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-12 14:31:28 +00:00
Fix an issue with asc not finding bundled library files in the browser; Minor cleanup
This commit is contained in:
39
tests/browser-asc.js
Normal file
39
tests/browser-asc.js
Normal 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());
|
||||
});
|
Reference in New Issue
Block a user