-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e9a2763
commit aab0857
Showing
8 changed files
with
257 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
cli/compilers/wasm_wrap.js | ||
cli/tests/error_syntax.js | ||
std/deno.d.ts | ||
std/prettier/vendor | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,19 @@ | ||
function base64ToUint8Array(data) {{ | ||
const importObject = Object.create(null); | ||
//IMPORTS | ||
|
||
function base64ToUint8Array(data) { | ||
const binString = window.atob(data); | ||
const size = binString.length; | ||
const bytes = new Uint8Array(size); | ||
for (let i = 0; i < size; i++) {{ | ||
for (let i = 0; i < size; i++) { | ||
bytes[i] = binString.charCodeAt(i); | ||
}} | ||
} | ||
return bytes; | ||
}} | ||
} | ||
|
||
const buffer = base64ToUint8Array("{}"); | ||
const buffer = base64ToUint8Array("BASE64_DATA"); | ||
const compiled = await WebAssembly.compile(buffer); | ||
|
||
const imports = new Set( | ||
WebAssembly.Module.imports(compiled).map(m => m.module) | ||
); | ||
|
||
const importObject = Object.create(null); | ||
for (const module of imports) {{ | ||
importObject[module] = await import(module); | ||
}} | ||
|
||
const instance = new WebAssembly.Instance(compiled, importObject); | ||
|
||
export default instance.exports; | ||
//EXPORTS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.