-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
esm: --experimental-wasm-modules integration support
- Loading branch information
1 parent
545b59e
commit acbf59a
Showing
12 changed files
with
147 additions
and
34 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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Flags: --experimental-modules --experimental-wasm-modules | ||
import '../common/index.mjs'; | ||
import { add, addImported } from '../fixtures/es-modules/simple.wasm'; | ||
import { state } from '../fixtures/es-modules/wasm-dep.mjs'; | ||
import { strictEqual } from 'assert'; | ||
|
||
strictEqual(state, 'WASM Start Executed'); | ||
|
||
strictEqual(add(10, 20), 30); | ||
|
||
strictEqual(addImported(0), 42); | ||
|
||
strictEqual(state, 'WASM JS Function Executed'); | ||
|
||
strictEqual(addImported(1), 43); |
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
;; Compiled using the WebAssembly Tootkit (https://github.com/WebAssembly/wabt) | ||
;; $ wat2wasm simple.wat -o simple.wasm | ||
|
||
(module | ||
(import "./wasm-dep.mjs" "jsFn" (func $jsFn (result i32))) | ||
(import "./wasm-dep.mjs" "jsInitFn" (func $jsInitFn)) | ||
(export "add" (func $add)) | ||
(export "addImported" (func $addImported)) | ||
(start $startFn) | ||
(func $startFn | ||
call $jsInitFn | ||
) | ||
(func $add (param $a i32) (param $b i32) (result i32) | ||
local.get $a | ||
local.get $b | ||
i32.add | ||
) | ||
(func $addImported (param $a i32) (result i32) | ||
local.get $a | ||
call $jsFn | ||
i32.add | ||
) | ||
) |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { strictEqual } from 'assert'; | ||
|
||
export function jsFn () { | ||
state = 'WASM JS Function Executed'; | ||
return 42; | ||
} | ||
|
||
export let state = 'JS Function Executed'; | ||
|
||
export function jsInitFn () { | ||
strictEqual(state, 'JS Function Executed'); | ||
state = 'WASM Start Executed'; | ||
} |