Skip to content

Commit 6ccaf6a

Browse files
authored
fix(core)!: unified .wasm import (close #209, #221) (#222)
1 parent cd0e6a9 commit 6ccaf6a

40 files changed

+969
-1933
lines changed

.github/workflows/pull-request.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
with:
1818
path: |
1919
prep/crypto-wasm
20-
key: ${{ runner.os }}-${{ hashFiles('crypto-wasm/*') }}
20+
key: ${{ runner.os }}-${{ hashFiles('crypto-wasm/*', 'etc/task-prep-crypto-wasm.ts') }}
2121
- uses: actions-rust-lang/setup-rust-toolchain@v1
2222
if: steps.prep-cache.outputs.cache-hit != 'true'
2323
with:
@@ -78,7 +78,7 @@ jobs:
7878
- uses: actions/cache/restore@v4
7979
with:
8080
fail-on-cache-miss: true
81-
key: ${{ runner.os }}-${{ hashFiles('crypto-wasm/*') }}
81+
key: ${{ runner.os }}-${{ hashFiles('crypto-wasm/*', 'etc/task-prep-crypto-wasm.ts') }}
8282
path: |
8383
prep/crypto-wasm
8484
- uses: denoland/setup-deno@v2
@@ -122,7 +122,7 @@ jobs:
122122
- uses: actions/cache/restore@v4
123123
with:
124124
fail-on-cache-miss: true
125-
key: ${{ runner.os }}-${{ hashFiles('crypto-wasm/*') }}
125+
key: ${{ runner.os }}-${{ hashFiles('crypto-wasm/*', 'etc/task-prep-crypto-wasm.ts') }}
126126
path: |
127127
prep/crypto-wasm
128128
- uses: denoland/setup-deno@v2

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ v8-compile-cache-0
1111

1212
/prep
1313
/.iroha
14-
/packages/crypto-target-*/wasm-target
15-
/packages/core/crypto/wasm-target
14+
/packages/core/crypto/wasm/
1615
**/*_generated_.ts
1716
/packages/core/data-model/schema/schema.json
1817

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# Iroha JavaScript
22

3-
The JavaScript (TypeScript) SDK of [Iroha 2](https://github.com/hyperledger-iroha/iroha).
4-
5-
Works in Deno, Node.js, and the Browser. (TODO: check in Bun and Cloudflare Workers).
3+
The JavaScript (TypeScript) SDK of [Iroha 2](https://github.com/hyperledger-iroha/iroha) for Node.js, Deno, Bun and the
4+
browser\*.
65

76
Packages and documentation are available on JSR: https://jsr.io/@iroha
87

@@ -24,7 +23,6 @@ bunx jsr add @iroha/core
2423
### Quick Example
2524

2625
```ts
27-
import '@iroha/crypto-target-node/install'
2826
import { Client } from '@iroha/client'
2927
import * as types from '@iroha/core/data-model'
3028

crypto-wasm/Cargo.lock

Lines changed: 21 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crypto-wasm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ iroha_crypto = { git = "https://github.com/0x009922/iroha.git", branch = "5302-e
1616

1717
getrandom = { version = "0.2", features = ["js"] }
1818

19-
wasm-bindgen = "0.2.91"
19+
wasm-bindgen = "0.2.100"
2020
serde = { version = "1", default-features = false, features = ["derive"] }
2121
serde-wasm-bindgen = "0.6"
2222
hex = { version = "0.4", default-features = false, features = ["alloc"] }

crypto-wasm/README.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
# Iroha Crypto WASM (Rust sources)
1+
# WebAssembly port of Iroha Crypto
22

3-
This Cargo project is a port of [`iroha_crypto` crate](https://github.com/hyperledger/iroha/tree/iroha2-lts/crypto) with
4-
`wasm_bindgen`s.
5-
6-
## Rebuild WASMs
7-
8-
To re-create `./wasm-pkg-*`, run in the monorepo root:
9-
10-
```bash
11-
pnpm jake crypto-wasm:rebuild
12-
```
3+
This Cargo project is a port of [`iroha_crypto` crate](https://github.com/hyperledger/iroha/) with `wasm_bindgen`s.
4+
Building is done with `deno task prep:crypto-wasm`.
135

146
## Be aware of moves
157

deno.jsonc

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
"exclude": ["**/docs"],
55
"workspace": [
66
"./packages/core",
7-
"./packages/crypto-target-node",
8-
"./packages/crypto-target-web",
97
"./packages/client",
108
"./packages/client-web-socket-node",
119

@@ -25,8 +23,14 @@
2523
"description": "Build Iroha artifacts and produce `/prep/iroha` directory",
2624
"command": "deno task prep:iroha --build"
2725
},
28-
"prep:crypto-wasm": "deno run --allow-read --allow-env --allow-run --allow-write ./etc/task-prep-crypto-wasm.ts",
29-
"prep:crypto-wasm:copy": "deno task prep:crypto-wasm --onlyCopy",
26+
"prep:crypto-wasm": {
27+
"description": "Prepare crypto wasm and put into `@iroha/core`",
28+
"command": "deno run -A ./etc/task-prep-crypto-wasm.ts"
29+
},
30+
"prep:crypto-wasm:copy": {
31+
"description": "Only copy already built crypto wasm into `@iroha/core`",
32+
"command": "deno task prep:crypto-wasm --copy"
33+
},
3034
"prep:codegen": {
3135
"command": "deno run --allow-write --allow-read ./etc/task-codegen.ts",
3236
"dependencies": ["prep:iroha:check"]
@@ -70,7 +74,7 @@
7074
},
7175
"fmt": {
7276
"include": ["."],
73-
"exclude": ["**/*_generated_.ts"],
77+
"exclude": ["**/*_generated_.ts", "**/pnpm-lock.yaml"],
7478
"semiColons": false,
7579
"lineWidth": 120,
7680
"singleQuote": true
@@ -105,8 +109,7 @@
105109
"publish": {
106110
"exclude": [
107111
"!**/*_generated_.ts",
108-
"!packages/crypto-target-*/wasm-target",
109-
"!packages/core/crypto/wasm-target",
112+
"!packages/core/crypto/wasm/",
110113
"!packages/core/data-model/schema/schema.json"
111114
]
112115
},

deno.lock

Lines changed: 38 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)