CLI code review

This commit is contained in:
Surma
2020-12-08 16:33:19 +00:00
parent 33c3fd3278
commit 5af8810e0b
10 changed files with 114 additions and 101 deletions

View File

@@ -1,13 +1,16 @@
import { fileURLToPath } from 'url';
export function pathify(path) {
if (path.startsWith("file://")) {
path = path.slice("file://".length);
if (path.startsWith('file://')) {
path = fileURLToPath(path);
}
return path;
}
export function instantiateEmscriptenWasm(factory, path) {
return factory({
locateFile() {
return pathify(path);
}
},
});
}