Skip to content

Commit dcb3c34

Browse files
committed
Address code review feedback
1 parent a5022d4 commit dcb3c34

10 files changed

Lines changed: 144 additions & 144 deletions

File tree

.github/workflows/docs.yml

Lines changed: 19 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,64 +9,49 @@ on:
99

1010
jobs:
1111
changes:
12-
runs-on: ubuntu-22.04
12+
runs-on: ubuntu-latest
1313
timeout-minutes: 10
1414
outputs:
15-
dirs: ${{ steps.filter.outputs.changes }}
15+
docs-changed: ${{ steps.filter.outputs.docs == 'true' }}
1616
steps:
17-
- uses: actions/checkout@v4
18-
- uses: dorny/paths-filter@v3
17+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 #v3.0.2
1919
id: filter
2020
with:
2121
filters: |
2222
docs: docs/**
2323
2424
deploy:
2525
needs: [changes]
26-
if: ${{ !contains(needs.changes.outputs.dirs, '[]') }}
27-
runs-on: ubuntu-22.04
26+
if: ${{ !contains(needs.changes.outputs.docs-changed, '[]') }}
27+
runs-on: ubuntu-latest
2828
timeout-minutes: 10
2929
concurrency:
3030
group: ${{ github.workflow }}-${{ github.ref }}
3131

3232
steps:
33-
- uses: actions/checkout@v4
33+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
34+
35+
- uses: taiki-e/cache-cargo-install-action@4d586f211d9b0bca9e7b59e57e2a0febf36c0929 # v2.1.1
36+
with:
37+
tool: "mdbook@0.4.48"
38+
39+
- uses: taiki-e/cache-cargo-install-action@4d586f211d9b0bca9e7b59e57e2a0febf36c0929 # v2.1.1
40+
with:
41+
tool: "mdbook-alerts@0.7.0"
3442

35-
- name: Install latest mdbook
36-
run: |
37-
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
38-
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
39-
mkdir mdbook
40-
curl -sSL $url | tar -xz --directory=./mdbook
41-
echo `pwd`/mdbook >> $GITHUB_PATH
43+
- uses: taiki-e/cache-cargo-install-action@4d586f211d9b0bca9e7b59e57e2a0febf36c0929 # v2.1.1
44+
with:
45+
tool: "mdbook-linkcheck@0.7.7"
4246

4347
- name: Build mdbook
4448
working-directory: ./docs
4549
run: mdbook build
4650

4751
- name: Deploy
4852
uses: peaceiris/actions-gh-pages@v4
49-
if: ${{ github.ref == 'refs/heads/main' }}
53+
# if: ${{ github.ref == 'refs/heads/main' }}
5054
with:
5155
github_token: ${{ secrets.GITHUB_TOKEN }}
5256
publish_dir: ./docs/book
5357
keep_files: true
54-
55-
link_check:
56-
name: verify-doc-links
57-
needs: [deploy]
58-
if: ${{ github.ref == 'refs/heads/main' }}
59-
permissions:
60-
contents: read
61-
issues: write
62-
timeout-minutes: 15
63-
runs-on: ubuntu-latest
64-
steps:
65-
- uses: actions/checkout@v4
66-
67-
- name: Link Checker
68-
id: lychee
69-
uses: lycheeverse/lychee-action@v2
70-
with:
71-
args: ./docs --exclude-all-private --verbose
72-
fail: false

README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -50,60 +50,60 @@ With sufficiently new versions of `cmake` and `rustup` installed, the build proc
5050

5151
1. Clone the repo
5252

53-
```bash
54-
$ git clone https://github.com/bytecodealliance/StarlingMonkey
55-
$ cd StarlingMonkey
53+
```console
54+
git clone https://github.com/bytecodealliance/StarlingMonkey
55+
cd StarlingMonkey
5656
```
5757

5858
2. Run the configuration script
5959

6060
For a release configuration, run
6161

62-
```bash
63-
$ cmake -S . -B cmake-build-release -DCMAKE_BUILD_TYPE=Release
62+
```console
63+
cmake -S . -B cmake-build-release -DCMAKE_BUILD_TYPE=Release
6464
```
6565

6666
For a debug configuration, run
6767

68-
```bash
69-
$ cmake -S . -B cmake-build-debug -DCMAKE_BUILD_TYPE=Debug
68+
```console
69+
cmake -S . -B cmake-build-debug -DCMAKE_BUILD_TYPE=Debug
7070
```
7171

7272
3. Build the runtime
7373

7474
Building the runtime is done in two phases: first, cmake is used to build a raw version as a
7575
WebAssembly core module. Then, that module is turned into a [WebAssembly Component][wasm-component]
76-
using the `componentize.sh` script.
76+
using the `componentize.sh` script generated by the build.
7777

7878
The following command will build the `starling-raw.wasm` runtime module in the `cmake-build-release`
7979
directory:
8080

81-
```bash
81+
```console
8282
# Use cmake-build-debug for the debug build
8383
# Change the value for `--parallel` to match the number of CPU cores in your system
84-
$ cmake --build cmake-build-release --parallel 8
84+
cmake --build cmake-build-release --parallel 8
8585
```
8686

8787
Then, the `starling-raw.wasm` module can be turned into a component with the following command:
8888

89-
```bash
90-
$ cd cmake-build-release
91-
$ ./componentize.sh -o starling.wasm
89+
```console
90+
cd cmake-build-release
91+
./componentize.sh -o starling.wasm
9292
```
9393

9494
The resulting runtime can be used to load and evaluate JS code dynamically:
9595

96-
```bash
97-
$ wasmtime -S http starling.wasm -e "console.log('hello world')"
96+
```console
97+
wasmtime -S http starling.wasm -e "console.log('hello world')"
9898
# or, to load a file:
99-
$ wasmtime -S http --dir . starling.wasm index.js
99+
wasmtime -S http --dir . starling.wasm index.js
100100
```
101101

102102
Alternatively, a JS file can be provided during componentization:
103103

104-
```bash
105-
$ cd cmake-build-release
106-
$ ./componentize.sh index.js -o starling.wasm
104+
```console
105+
cd cmake-build-release
106+
./componentize.sh index.js -o starling.wasm
107107
```
108108

109109
This way, the JS file will be loaded during componentization, and the top-level code will be

docs/book.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ src = "src"
66
title = "StarlingMonkey Developer Documentation"
77
description = "Documentation for StarlingMonkey"
88

9-
[preprocessor]
9+
[preprocessor.alerts]
10+
renderers = ["html", "linkcheck"]
1011

11-
[output]
12+
[output.linkcheck]
13+
traverse-parent-directories = true
1214

1315
[output.html]
1416
git-repository-url = "https://github.com/bytecodealliance/StarlingMonkey"
@@ -17,7 +19,7 @@ default-theme = "light"
1719
preferred-dark-theme = "navy"
1820
copy-fonts = true
1921
no-section-label = false
20-
curly-quotes = true
22+
smart-punctuation = true
2123

2224
[output.html.fold]
2325
enable = true

docs/src/developer/builtins-cpp.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ convenience, here is a brief recap of the main rooting rules from the referenced
5656
The `builtin` API provided by StarlingMonkey is built on top of SpiderMonkey's
5757
[`jsapi`][spidermonkey-jsapi], Mozilla's C++ interface for embedding JavaScript. It simplifies the
5858
creation and management of native JavaScript classes and objects by abstracting common patterns and
59-
boilerplate code required by the underlying SpiderMonkey engine. This allows developers to
60-
efficiently implement native functionality while leveraging SpiderMonkey's robust JavaScript runtime
61-
environment.
59+
boilerplate code required by the underlying SpiderMonkey engine.
6260
6361
See also SpiderMonkey documentation on [Custom Objects][spidermonkey-objects].
6462
@@ -297,16 +295,14 @@ void initialize_builtins(api::Engine *engine) {
297295
298296
## Providing a custom host API implementation
299297
300-
The [host-apis][host-api] directory can contain implementations of the host API for different
298+
The `host-apis` directory can contain implementations of the host API for different
301299
versions of WASI—or in theory any other host interface. Those can be selected by setting the
302300
`HOST_API` environment variable to the name of one of the directories. Currently, only an
303-
implementation in terms of [wasi-0.2.0][wasi-api] is provided, and used by default.
301+
implementation in terms of `host-apis/wasi-0.2.0` is provided, and used by default.
304302
305303
To provide a custom host API implementation, you can set `HOST_API` to the (absolute) path of a
306304
directory containing that implementation.
307305
308-
[host-api]: ../../../../host-apis
309-
[wasi-api]: ../../../../host-apis/wasi-0.2.0
310306
[spidermonkey-rooting]:
311307
https://github.com/mozilla-spidermonkey/spidermonkey-embedding-examples/blob/next/docs/GC%20Rooting%20Guide.md
312308
[spidermonkey-jsapi]:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Devoloping Builtins in Rust
22

3-
[TODO]
3+
[TODO]: https://github.com/bytecodealliance/StarlingMonkey/pull/103

docs/src/developer/just.md

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,37 @@ refer to the official [installation instructions][just-install] for your specifi
99
Once installed, navigate to the project directory and run `just` commands as needed. For instance,
1010
the following commands will configure a default `cmake-build-debug` directory and build the project.
1111

12-
```shell
13-
$ just build
12+
```console
13+
just build
1414
```
1515

1616
To load a JS script during componentization and serve its output using `Wasmtime`, run:
1717

18-
```shell
19-
$ just serve <filename>.js
18+
```console
19+
just serve <filename>.js
2020
```
2121

2222
To build and run integration tests run:
2323

24-
```shell
25-
$ just test
24+
```console
25+
just test
2626
```
2727

2828
To build and run Web Platform Tests run:
2929

30-
```shell
31-
$ just wpt-setup # prepare WPT hosts
32-
$ just wpt-test # run all tests
33-
$ just wpt-test console/console-log-symbol.any.js # run specific test
30+
```console
31+
just wpt-setup # prepare WPT hosts
32+
just wpt-test # run all tests
33+
just wpt-test console/console-log-symbol.any.js # run specific test
3434
```
3535

3636
To view a complete list of available recipes, run:
3737

38-
```shell
39-
$ just --list
40-
38+
```console
39+
just --list
4140
```
4241

43-
> **Note**
44-
>
42+
> [!NOTE]
4543
> By default, the CMake configuration step is skipped if the build directory already exists.
4644
> However, this can sometimes cause issues if the existing build directory was configured for a
4745
> different target. For instance:
@@ -53,7 +51,7 @@ $ just --list
5351
> To resolve this, you can force cmake to reconfigure the build directory by adding the
5452
> `reconfigure=true` parameter. For example:
5553
>
56-
> ```shell
54+
> ```console
5755
> just reconfigure=true wpt-build
5856
> ```
5957
@@ -63,17 +61,17 @@ The default build mode is debug, which automatically configures the build direct
6361
`cmake-build-debug`. You can switch to a different build mode, such as release, by specifying the
6462
mode parameter. For example:
6563
66-
```shell
67-
$ just mode=release build
64+
```console
65+
just mode=release build
6866
```
6967
7068
This command will set the build mode to release, and the build directory will automatically change
7169
to `cmake-build-release`.
7270

7371
If you want to override the default build directory, you can use the `builddir` parameter.
7472

75-
```shell
76-
$ just builddir=mybuilddir mode=release build
73+
```console
74+
just builddir=mybuilddir mode=release build
7775
```
7876

7977
This command configures CMake to use `mybuilddir` as the build directory and sets the build mode to
@@ -83,15 +81,15 @@ This command configures CMake to use `mybuilddir` as the build directory and set
8381

8482
You can also start a Web Platform Tests (WPT) server with:
8583

86-
```shell
87-
$ just wpt-server
84+
```console
85+
just wpt-server
8886
```
8987

9088
After starting the server, individual tests can be run by sending a request with the test name to
9189
the server instance. For example:
9290

93-
```shell
94-
$ curl http://127.0.0.1:7676/console/console-log-symbol.any.js
91+
```console
92+
curl http://127.0.0.1:7676/console/console-log-symbol.any.js
9593

9694
```
9795

docs/src/developer/spidermonkey.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
StarlingMonkey uses SpiderMonkey as its underlying JS engine, and by default, downloads build
44
artifacts from [a wrapper repository][wasi-embedding] around [our local SpiderMonkey
5-
tree][geck-dev]. That wrapper repository contains a SpiderMonkey commit-hash in a file, and its CI
5+
tree][gecko-dev]. That wrapper repository contains a SpiderMonkey commit-hash in a file, and its CI
66
jobs build the artifacts that StarlingMonkey downloads during its build.
77

88
This flow is optimized for ease of development of StarlingMonkey, and avoiding the need to build
@@ -13,38 +13,38 @@ make fixes or optimize performance.
1313
In order to do so, first clone the above two repositories, with `gecko-dev` (SpiderMonkey itself) as
1414
a subdirectory to `spidermonkey-wasi-embedding`:
1515

16-
```shell
17-
$ git clone https://github.com/bytecodealliance/spidermonkey-wasi-embedding
18-
$ cd spidermonkey-wasi-embedding/
19-
$ git clone https://github.com/bytecodealliance/gecko-dev
16+
```console
17+
git clone https://github.com/bytecodealliance/spidermonkey-wasi-embedding
18+
cd spidermonkey-wasi-embedding/
19+
git clone https://github.com/bytecodealliance/gecko-dev
2020
```
2121

2222
and switch to the commit that we are currently using:
2323

24-
```shell
25-
$ git checkout `cat ../gecko-revision`
24+
```console
25+
git checkout `cat ../gecko-revision`
2626
# now edit the source
2727
```
2828

2929
Then make changes as necessary, eventually rebuilding from the `spidermonkey-wasi-embedding` root:
3030

31-
```shell
31+
```console
3232
cd ../ # back to spidermonkey-wasi-embedding
33-
$ ./rebuild.sh release
33+
./rebuild.sh release
3434
```
3535

3636
This will produce a `release/` directory with artifacts of the same form normally downloaded by
3737
StarlingMonkey. So, finally, from within StarlingMonkey, set an environment variable
3838
`SPIDERMONKEY_BINARIES`:
3939

40-
```shell
41-
$ export SPIDERMONKEY_BINARIES=/path/to/spidermonkey-wasi-embedding/release
42-
$ cmake -S . -B cmake-build-release -DCMAKE_BUILD_TYPE=Release
43-
$ cmake --build cmake-build-release --parallel 8
40+
```console
41+
export SPIDERMONKEY_BINARIES=/path/to/spidermonkey-wasi-embedding/release
42+
cmake -S . -B cmake-build-release -DCMAKE_BUILD_TYPE=Release
43+
cmake --build cmake-build-release --parallel 8
4444
```
4545

4646
and use/test as described in [testing][testing] section.
4747

48-
[testing]: ../getting/started/tesing.md
48+
[testing]: ../getting-started/testing.md
4949
[wasi-embedding]: https://github.com/bytecodealliance/spidermonkey-wasi-embedding
50-
[geck-dev]: https://github.com/bytecodealliance/gecko-dev
50+
[gecko-dev]: https://github.com/bytecodealliance/gecko-dev

0 commit comments

Comments
 (0)