Skip to content

Commit a33184b

Browse files
author
Emil Sjölander
committed
Implement js bindings
1 parent f3206bf commit a33184b

File tree

6 files changed

+783
-0
lines changed

6 files changed

+783
-0
lines changed

.circleci/config.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
paths:
2525
- ~/.cargo
2626
- ./target
27+
2728
ios:
2829
macos:
2930
xcode: "10.0.0"
@@ -32,10 +33,36 @@ jobs:
3233
- checkout
3334
- run: cd bindings/swift && xcodebuild test -workspace Example/StretchKit.xcworkspace -scheme StretchKit -destination 'platform=iOS Simulator,name=iPhone XR,OS=12.0'
3435

36+
js:
37+
docker:
38+
- image: rust:1
39+
40+
steps:
41+
- checkout
42+
43+
- restore_cache:
44+
key: target-cache
45+
46+
- run: rustc --version; cargo --version; rustup --version
47+
- run: rustup component add rustfmt
48+
- run: rustup component add clippy
49+
- run: cargo install wasm-pack
50+
- run: cargo fmt -- --check
51+
- run: wasm-pack test --node
52+
- run: cargo clippy
53+
- run: cargo bench
54+
55+
- save_cache:
56+
key: target-cache
57+
paths:
58+
- ~/.cargo
59+
- ./target
3560

3661
workflows:
3762
version: 2
3863
test_all:
3964
jobs:
4065
- core
4166
- ios
67+
- js
68+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/scripts/gentest/target
33
/bindings/kotlin/stretch/src/main/rust/target
44
/bindings/swift/StretchCore/target
5+
/bindings/js/target
56

67
**/*.rs.bk
78
Cargo.lock

bindings/js/Cargo.toml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[package]
2+
name = "stretch-js"
3+
version = "0.2.2"
4+
authors = ["Visly Inc. <[email protected]>"]
5+
edition = "2018"
6+
7+
[lib]
8+
crate-type = ["cdylib", "rlib"]
9+
10+
[features]
11+
default = ["console_error_panic_hook"]
12+
13+
[dependencies]
14+
wasm-bindgen = "0.2"
15+
js-sys = "0.3"
16+
stretch = "0.2.2"
17+
18+
# The `console_error_panic_hook` crate provides better debugging of panics by
19+
# logging them with `console.error`. This is great for development, but requires
20+
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
21+
# code size when deploying.
22+
console_error_panic_hook = { version = "0.1.1", optional = true }
23+
24+
# `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size
25+
# compared to the default allocator's ~10K. It is slower than the default
26+
# allocator, however.
27+
#
28+
# Unfortunately, `wee_alloc` requires nightly Rust when targeting wasm for now.
29+
wee_alloc = { version = "0.4.2", optional = true }
30+
31+
[dev-dependencies]
32+
wasm-bindgen-test = "0.2"
33+
34+
[profile.release]
35+
opt-level = "s"
36+
37+
[workspace]
38+
members = []

0 commit comments

Comments
 (0)