Skip to content

Commit

Permalink
Implement js bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
Emil Sjölander committed Apr 28, 2019
1 parent f3206bf commit a33184b
Show file tree
Hide file tree
Showing 6 changed files with 783 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
paths:
- ~/.cargo
- ./target

ios:
macos:
xcode: "10.0.0"
Expand All @@ -32,10 +33,36 @@ jobs:
- checkout
- run: cd bindings/swift && xcodebuild test -workspace Example/StretchKit.xcworkspace -scheme StretchKit -destination 'platform=iOS Simulator,name=iPhone XR,OS=12.0'

js:
docker:
- image: rust:1

steps:
- checkout

- restore_cache:
key: target-cache

- run: rustc --version; cargo --version; rustup --version
- run: rustup component add rustfmt
- run: rustup component add clippy
- run: cargo install wasm-pack
- run: cargo fmt -- --check
- run: wasm-pack test --node
- run: cargo clippy
- run: cargo bench

- save_cache:
key: target-cache
paths:
- ~/.cargo
- ./target

workflows:
version: 2
test_all:
jobs:
- core
- ios
- js

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/scripts/gentest/target
/bindings/kotlin/stretch/src/main/rust/target
/bindings/swift/StretchCore/target
/bindings/js/target

**/*.rs.bk
Cargo.lock
Expand Down
38 changes: 38 additions & 0 deletions bindings/js/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[package]
name = "stretch-js"
version = "0.2.2"
authors = ["Visly Inc. <[email protected]>"]
edition = "2018"

[lib]
crate-type = ["cdylib", "rlib"]

[features]
default = ["console_error_panic_hook"]

[dependencies]
wasm-bindgen = "0.2"
js-sys = "0.3"
stretch = "0.2.2"

# The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
# code size when deploying.
console_error_panic_hook = { version = "0.1.1", optional = true }

# `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size
# compared to the default allocator's ~10K. It is slower than the default
# allocator, however.
#
# Unfortunately, `wee_alloc` requires nightly Rust when targeting wasm for now.
wee_alloc = { version = "0.4.2", optional = true }

[dev-dependencies]
wasm-bindgen-test = "0.2"

[profile.release]
opt-level = "s"

[workspace]
members = []
Loading

0 comments on commit a33184b

Please sign in to comment.