Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
target = "wasm32-unknown-unknown"

[target.wasm32-unknown-unknown]
rustflags = ["-C", "target-feature=+atomics,+bulk-memory,+mutable-globals"]
rustflags = ["-C", "target-feature=+atomics"]
# Ciantic: Tested +simd128 22.7.2021, didn't work! Got some wasm-opt problems.
# 10.01.2024 - It now works, but threading works without it. So probably best to wait for it to stabilize.
# 2024-10-01 - It now works, but threading works without it. So probably best to wait for it to stabilize.
# 2025-06-12 - mutable-globals is enabled by default, and bulk-memory is enabled by default on Rust 1.87+

[unstable]
build-std = ["panic_abort", "std"]
Expand Down
29 changes: 11 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,21 @@ jobs:
name: Example
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: arduino/setup-task@v2
- uses: Pistonight/mono-dev/actions/setup@main
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: 18.x
- uses: dtolnay/rust-toolchain@nightly
with:
targets: wasm32-unknown-unknown
components: rust-src
- uses: cargo-bins/cargo-binstall@main
- run: cargo binstall --no-confirm wasm-pack
- run: npm ci
working-directory: example
- run: npm run wasm
mono-dev: true
ecma-pnpm: true
ecma-bun: true
rust: nightly
rust-wasm: true
rust-src: true
tool-cargo-binstall: txtpp
- run: task install-ci
working-directory: example
- run: npm run build
- run: task build
working-directory: example
- uses: actions/upload-artifact@v4
with:
path: example/dist
name: example
retention-days: 3
retention-days: 3
24 changes: 9 additions & 15 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,13 @@ jobs:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: arduino/setup-task@v2
- uses: Pistonight/mono-dev/actions/setup@main
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: 18.x
- uses: dtolnay/rust-toolchain@nightly
with:
targets: wasm32-unknown-unknown
components: clippy,rust-src,rustfmt
- uses: cargo-bins/cargo-binstall@main
- run: cargo-binstall --no-confirm txtpp
- run: npm ci
- run: task check
mono-dev: true
ecma-pnpm: true
ecma-bun: true
rust: nightly
rust-wasm: true
rust-src: true
tool-cargo-binstall: txtpp
- run: task check
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
/Cargo.lock
*.min.js
!/src/js/createDispatcher.min.js
/mono-dev
rust-toolchain
15 changes: 8 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "wasm-bindgen-spawn"
version = "0.0.1"
edition = "2021"
version = "0.0.2"
edition = "2024"
description = "Web Worker Multithreading library for wasm-bindgen the uses shared memory"
repository = "https://github.com/Pistonite/wasm-bindgen-spawn"
license = "MIT"
Expand All @@ -20,11 +20,12 @@ include = [
]

[dependencies]
js-sys = "0.3.70"
oneshot = { version = "0.1.8", default-features = false, features = ["std"] }
thiserror = "1.0.64"
wasm-bindgen = "0.2.93"
wasm-bindgen-futures = { version = "0.4.43", optional = true }
js-sys = "0.3.77"
oneshot = { version = "0.1.11", default-features = false, features = ["std"] }
static_assertions = "1.1.0"
thiserror = "2.0.12"
wasm-bindgen = "0.2.100"
wasm-bindgen-futures = { version = "0.4.50", optional = true }

[features]
default = ["async"]
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Pistonight
Copyright (c) 2025 Pistonight

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ Read the full article for more details on the implications of Cross-Origin Isola
2. Add the following to `.cargo/config.toml`
```toml
[target.wasm32-unknown-unknown]
rustflags = ["-C", "target-feature=+atomics,+bulk-memory,+mutable-globals"]
rustflags = ["-C", "target-feature=+atomics"]
# You also need `bulk-memory` for Rust < 1.87. For 1.87+ it's enabled by default
# rustflags = ["-C", "target-feature=+atomics,+bulk-memory"]

[unstable]
build-std = ["panic_abort", "std"]
Expand Down
37 changes: 19 additions & 18 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,37 @@ includes:
taskfile: ./example
dir: ./example

cargo:
taskfile: ./mono-dev/task/cargo.yaml
internal: true

tasks:
install-cargo-extra-tools:
aliases: [icets]
cmds:
- cargo install txtpp

install:
cmds:
- rm -rf mono-dev
- git clone https://github.com/Pistonight/mono-dev --depth 1
- echo "nightly" > example/rust-toolchain
- echo "nightly" > rust-toolchain

build:
desc: Incrementally dev build
cmds:
- txtpp src/js/createDispatcher.min.js
- cd example && npm run wasm
- cd example && pnpm run wasm

check:
desc: Check for issues
cmds:
- cargo clippy --all-features --all-targets -- -D warnings -D clippy::todo
- cargo fmt --check
- task: prettier
vars:
PRETTIER_ARGS: --check
- task: ex:check
- task: cargo:clippy-all
- task: cargo:fmt-check

fix:
desc: Fix issues
cmds:
- cargo fmt
- task: prettier
vars:
PRETTIER_ARGS: --write
- task: cargo:fmt-fix
- txtpp src -r
- task: ex:fix

prettier:
cmds:
- npx prettier "./src/js/*.js" --tab-width 4 --end-of-line auto {{.PRETTIER_ARGS}}


Loading
Loading