Skip to content

Commit 307e067

Browse files
committed
Fix
1 parent e80f073 commit 307e067

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
override: true
3131
- name: Install moonbit
3232
run: |
33-
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
33+
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash -s -- 0.6.19
3434
echo "$HOME/.moon/bin" >> $GITHUB_PATH
3535
- name: Bundle core MoonBit library
3636
run: moon bundle --target wasm
@@ -60,7 +60,7 @@ jobs:
6060
override: true
6161
- name: Install moonbit
6262
run: |
63-
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
63+
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash -s -- 0.6.19
6464
echo "$HOME/.moon/bin" >> $GITHUB_PATH
6565
- name: Bundle core MoonBit library
6666
run: moon bundle --target wasm
@@ -90,7 +90,7 @@ jobs:
9090
override: true
9191
- name: Install moonbit
9292
run: |
93-
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
93+
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash -s -- 0.6.19
9494
echo "$HOME/.moon/bin" >> $GITHUB_PATH
9595
- name: Bundle core MoonBit library
9696
run: moon bundle --target wasm

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ Some example use cases are exposed by crate features:
1616
The crate implements the general machinery for generating WASM components from MoonBit source, and it also exports a few example use cases:
1717

1818
### "Get Script" component
19-
The simplest example generates a WASM component that exports a single function `get-script` which returns a string.
20-
This can be used to attach dynamic content to a statically compiled WASM component via composition,
21-
for example providing user-defined JavaScript code to a precompiled WASM JavaScript engine.
19+
The simplest example generates a WASM component that exports a single function `get-script` which returns a string.
20+
This can be used to attach dynamic content to a statically compiled WASM component via composition,
21+
for example providing user-defined JavaScript code to a precompiled WASM JavaScript engine.
2222

2323
To use this generator, just provide the script contents and the target WASM path:
2424

@@ -72,7 +72,10 @@ fn main() {
7272

7373
To update and build the MoonBit core library:
7474

75+
**NOTE**: requires the 0.6.19 version of MoonBit currently
76+
7577
```
78+
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash -s -- 0.6.19
7679
git submodule update --recursive
7780
moon bundle --target wasm
7881
```

src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use anyhow::anyhow;
1+
use anyhow::{Context, anyhow};
22
use camino::{Utf8Path, Utf8PathBuf};
33
use camino_tempfile::Utf8TempDir;
44
use heck::{ToLowerCamelCase, ToSnakeCase};
@@ -608,7 +608,9 @@ impl MoonBitComponent {
608608
let resolve = self.resolve.as_ref().unwrap();
609609
let world = &self.world_id.unwrap();
610610

611-
let mut wasm = std::fs::read(self.module_wasm())?;
611+
let module_wasm = self.module_wasm();
612+
let mut wasm = std::fs::read(&module_wasm)
613+
.context(format!("Failed to read module WASM from {module_wasm}"))?;
612614

613615
wit_component::embed_component_metadata(&mut wasm, resolve, *world, StringEncoding::UTF16)?;
614616

0 commit comments

Comments
 (0)