Skip to content

Commit 3e34a15

Browse files
committed
feat: enable JavaScript components in CI environment
JavaScript WebAssembly components using the jco (JavaScript Component Object) toolchain are now fully functional in both local development and CI environments. This resolves GitHub issue #22 by fixing the root cause of ES6 module resolution limitations in componentize-js and incorrect interface export structures. Key Changes: - Fix JavaScript component module resolution by avoiding ES6 imports during componentization phase and inlining dependencies instead - Correct interface exports to match WIT world definitions: * hello_js_component exports `hello` interface per hello-world WIT * calc_js_component exports `calc` interface per calculator WIT - Update jco rule to use relative paths for proper ES6 module resolution - Enable all JavaScript components in both Linux and macOS CI builds - Add JavaScript component tests to CI test suite - Remove previous exclusions for broken JavaScript components Technical Details: The jco toolchain's underlying componentize-js has limitations with ES6 imports during the WebAssembly componentization phase. The solution involves: 1. Inlining module dependencies instead of using import statements 2. Exporting interfaces as objects that match WIT world structure 3. Using relative paths in the jco build system for proper module resolution All three JavaScript components now build successfully: - simple_js_component (already working - no imports) - hello_js_component (fixed - inlined formatMessage function) - calc_js_component (fixed - removed type imports, added calc interface) The CI environment already had proper Node.js v18 setup via GitHub Actions. The issue was purely architectural in how JavaScript modules were structured for WebAssembly componentization. Closes: #22
1 parent 5b0f030 commit 3e34a15

File tree

20 files changed

+2511
-92
lines changed

20 files changed

+2511
-92
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,20 @@ jobs:
101101
102102
- name: Build All Targets
103103
run: |
104-
# Build core working targets, exclude incomplete/problematic examples
105-
# Using explicit inclusions to avoid JavaScript component issues
104+
# Build core working targets including JavaScript components
106105
bazel build --keep_going -- \
107106
//examples/go_component/... \
108107
//examples/basic/... \
109108
//examples/simple_module/... \
110109
//examples/cli_tool_example/... \
111110
//examples/cpp_component/... \
111+
//examples/js_component:simple_js_component \
112+
//examples/js_component:hello_js_component \
113+
//examples/js_component:calc_js_component \
112114
//rust/... \
113115
//go/... \
114116
//cpp/... \
117+
//js/... \
115118
//wasm/... \
116119
//wit/... \
117120
//tools/... \
@@ -126,7 +129,7 @@ jobs:
126129
-//tools/ssh_keygen:ssh_keygen_test \
127130
128131
- name: Run Tests
129-
run: bazel test --test_output=errors -- //test/integration:basic_component_build_test //test/integration:basic_component_validation //test/unit:unit_tests //test/wkg/unit:smoke
132+
run: bazel test --test_output=errors -- //test/integration:basic_component_build_test //test/integration:basic_component_validation //test/unit:unit_tests //test/wkg/unit:smoke //test/js:test_hello_js_component_provides_info //test/js:test_calc_js_component_provides_info //test/js:test_npm_dependencies_installation
130133

131134
- name: Run Clippy
132135
run: echo "Skipping clippy for now due to target triple issues"
@@ -194,9 +197,13 @@ jobs:
194197
//examples/simple_module/... \
195198
//examples/cli_tool_example/... \
196199
//examples/cpp_component/... \
200+
//examples/js_component:simple_js_component \
201+
//examples/js_component:hello_js_component \
202+
//examples/js_component:calc_js_component \
197203
//rust/... \
198204
//go/... \
199205
//cpp/... \
206+
//js/... \
200207
//wasm/... \
201208
//wit/... \
202209
//tools/... \
@@ -217,7 +224,7 @@ jobs:
217224
-//test/integration:service_b_component_wasm_lib_release_host \
218225
219226
- name: Run Tests
220-
run: bazel test --test_output=errors -- //test/integration:basic_component_build_test //test/integration:basic_component_validation //test/unit:unit_tests
227+
run: bazel test --test_output=errors -- //test/integration:basic_component_build_test //test/integration:basic_component_validation //test/unit:unit_tests //test/js:test_hello_js_component_provides_info //test/js:test_calc_js_component_provides_info //test/js:test_npm_dependencies_installation
221228

222229
- name: Run Clippy
223230
run: echo "Skipping clippy for now due to target triple issues"

0 commit comments

Comments
 (0)