Skip to content

Commit 3958db1

Browse files
committed
feat: add JavaScript bindings generation and transpilation for WIT components
- Implemented `generateJsBindings` and `generateJsBindingsFromPath` for generating TypeScript bindings from WIT content. - Added `transpileJsHost` and `transpileJsHostFromPath` for transpiling WebAssembly components into JavaScript host modules. - Introduced interfaces and types for binding options and results. - Created tests for guest and host bindings generation, including complex WIT definitions and command contributions. - Ensured backward compatibility with deprecated aliases for guest and host bindings. - Implemented edge case tests for WitFormatter to ensure proper formatting of various input scenarios. - Added comprehensive tests for WitSyntaxValidator, covering error parsing and diagnostic creation. - Introduced file-based tests for WASM detection utilities to validate header reading and component identification. - Enhanced vitest configuration to include coverage reporting for better test insights. - Added a new command for running unit tests with coverage. Signed-off-by: Gordon Smith <GordonJSmith@gmail.com>
1 parent 892265a commit 3958db1

36 files changed

+4622
-1443
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
os: [ubuntu-latest, windows-latest, macos-latest]
16-
node-version: [20, 22, 24]
16+
node-version: [22, 24]
1717
runs-on: ${{ matrix.os }}
1818
permissions:
1919
contents: read
@@ -30,7 +30,7 @@ jobs:
3030
- name: Setup Rust toolchain
3131
uses: dtolnay/rust-toolchain@stable
3232
with:
33-
targets: wasm32-unknown-unknown
33+
targets: wasm32-unknown-unknown,wasm32-wasip2
3434

3535
- name: Cache Rust dependencies
3636
uses: Swatinem/rust-cache@v2

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ typings/
7272
# Typescript Output
7373
dist/
7474

75+
# Rust build artifacts
76+
samples/target/
77+
7578
# VSCode extension development
7679
.vscode-test/
7780
*.vsix
@@ -80,3 +83,6 @@ dist/
8083
types/
8184
out/
8285
tmp/
86+
87+
# Test coverage
88+
coverage/

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ dist/
1616
*.vsix
1717
wit-bindgen-wasm/pkg/
1818
wit-bindgen-wasm/target/
19+
samples/target/
1920

2021
# Test snapshots (these are auto-generated and shouldn't be manually formatted)
2122
*.snap

.vscode/launch.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"version": "0.2.0",
77
"configurations": [
88
{
9-
"name": "Extension",
9+
"name": "default",
1010
"type": "extensionHost",
1111
"request": "launch",
1212
"runtimeExecutable": "${execPath}",
@@ -15,6 +15,17 @@
1515
"--extensionDevelopmentPath=${workspaceFolder}",
1616
"${workspaceRoot}/tests/grammar"
1717
]
18+
},
19+
{
20+
"name": "samples",
21+
"type": "extensionHost",
22+
"request": "launch",
23+
"runtimeExecutable": "${execPath}",
24+
"args": [
25+
"--disable-extensions",
26+
"--extensionDevelopmentPath=${workspaceFolder}",
27+
"${workspaceRoot}/samples"
28+
]
1829
}
1930
]
2031
}

0 commit comments

Comments
 (0)