@flowscripter/template-bun-wasm-rust-library 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,12 @@
1
+ name: check-bun-wasm-rust-dependencies
2
+ on:
3
+ workflow_dispatch:
4
+ schedule:
5
+ - cron: "0 0 * * *"
6
+ permissions:
7
+ contents: read
8
+ pull-requests: write
9
+ jobs:
10
+ call-check-bun-dependencies:
11
+ uses: flowscripter/.github/.github/workflows/check-bun-wasm-rust-dependencies.yml@v1
12
+ secrets: inherit
@@ -0,0 +1,12 @@
1
+ name: check-rust-dependencies
2
+ on:
3
+ workflow_dispatch:
4
+ schedule:
5
+ - cron: "0 1 * * *"
6
+ permissions:
7
+ contents: read
8
+ pull-requests: write
9
+ jobs:
10
+ call-check-deno-dependencies:
11
+ uses: flowscripter/.github/.github/workflows/check-rust-dependencies.yml@v1
12
+ secrets: inherit
@@ -0,0 +1,13 @@
1
+ name: lint-pr-message
2
+ on:
3
+ pull_request_target:
4
+ types:
5
+ - opened
6
+ - edited
7
+ - synchronize
8
+ permissions:
9
+ contents: read
10
+ jobs:
11
+ call-lint-pr-message:
12
+ uses: flowscripter/.github/.github/workflows/lint-pr-message.yml@v1
13
+ secrets: inherit
@@ -0,0 +1,14 @@
1
+ name: release-bun-wasm-rust-library
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ permissions:
6
+ contents: write
7
+ issues: write
8
+ pull-requests: write
9
+ id-token: write
10
+ pages: write
11
+ jobs:
12
+ call-release-bun-rust-library:
13
+ uses: flowscripter/.github/.github/workflows/release-bun-wasm-rust-library.yml@v1
14
+ secrets: inherit
@@ -0,0 +1,10 @@
1
+ name: validate-bun-wasm-rust-library-pr
2
+ on:
3
+ pull_request:
4
+ branches: [main]
5
+ permissions:
6
+ contents: read
7
+ jobs:
8
+ call-validate-bun-wasm-rust-library-pr:
9
+ uses: flowscripter/.github/.github/workflows/validate-bun-wasm-rust-library-pr.yml@v1
10
+ secrets: inherit
package/.releaserc ADDED
@@ -0,0 +1,19 @@
1
+ ---
2
+ branches:
3
+ - main
4
+ plugins:
5
+ - - "@semantic-release/commit-analyzer"
6
+ - preset: conventionalcommits
7
+ - - "@semantic-release/release-notes-generator"
8
+ - preset: conventionalcommits
9
+ - - "@semantic-release/exec"
10
+ - verifyConditionsCmd: "wasm-pack build --target web --release --no-pack"
11
+ publishCmd: "echo tag=v${nextRelease.version} >> /home/runner/work/_temp/_runner_file_commands/set_output_dbd9f024-48a9-49c8-be2e-28fb136ffe68"
12
+ - - "@semantic-release/github"
13
+ - - "@semantic-release/npm"
14
+ - - "@semantic-release/git"
15
+ - assets:
16
+ - Cargo.toml
17
+ - Cargo.lock
18
+ - package.json
19
+ - bun.lock
package/Cargo.lock ADDED
@@ -0,0 +1,324 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "bumpalo"
7
+ version = "3.17.0"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf"
10
+
11
+ [[package]]
12
+ name = "cc"
13
+ version = "1.2.19"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "8e3a13707ac958681c13b39b458c073d0d9bc8a22cb1b2f4c8e55eb72c13f362"
16
+ dependencies = [
17
+ "shlex",
18
+ ]
19
+
20
+ [[package]]
21
+ name = "cfg-if"
22
+ version = "1.0.0"
23
+ source = "registry+https://github.com/rust-lang/crates.io-index"
24
+ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
25
+
26
+ [[package]]
27
+ name = "flowscripter_template_bun_wasm_rust_library"
28
+ version = "1.0.26"
29
+ dependencies = [
30
+ "flowscripter_template_rust_library",
31
+ "wasm-bindgen",
32
+ "wasm-bindgen-test",
33
+ ]
34
+
35
+ [[package]]
36
+ name = "flowscripter_template_rust_library"
37
+ version = "1.1.11"
38
+ source = "registry+https://github.com/rust-lang/crates.io-index"
39
+ checksum = "67301d51efb94dca9a4cfa7bd6bc9c7265b241d4560615cbb61460d6f106234c"
40
+
41
+ [[package]]
42
+ name = "js-sys"
43
+ version = "0.3.77"
44
+ source = "registry+https://github.com/rust-lang/crates.io-index"
45
+ checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f"
46
+ dependencies = [
47
+ "once_cell",
48
+ "wasm-bindgen",
49
+ ]
50
+
51
+ [[package]]
52
+ name = "log"
53
+ version = "0.4.27"
54
+ source = "registry+https://github.com/rust-lang/crates.io-index"
55
+ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
56
+
57
+ [[package]]
58
+ name = "minicov"
59
+ version = "0.3.7"
60
+ source = "registry+https://github.com/rust-lang/crates.io-index"
61
+ checksum = "f27fe9f1cc3c22e1687f9446c2083c4c5fc7f0bcf1c7a86bdbded14985895b4b"
62
+ dependencies = [
63
+ "cc",
64
+ "walkdir",
65
+ ]
66
+
67
+ [[package]]
68
+ name = "once_cell"
69
+ version = "1.21.3"
70
+ source = "registry+https://github.com/rust-lang/crates.io-index"
71
+ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
72
+
73
+ [[package]]
74
+ name = "proc-macro2"
75
+ version = "1.0.95"
76
+ source = "registry+https://github.com/rust-lang/crates.io-index"
77
+ checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
78
+ dependencies = [
79
+ "unicode-ident",
80
+ ]
81
+
82
+ [[package]]
83
+ name = "quote"
84
+ version = "1.0.40"
85
+ source = "registry+https://github.com/rust-lang/crates.io-index"
86
+ checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
87
+ dependencies = [
88
+ "proc-macro2",
89
+ ]
90
+
91
+ [[package]]
92
+ name = "rustversion"
93
+ version = "1.0.20"
94
+ source = "registry+https://github.com/rust-lang/crates.io-index"
95
+ checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2"
96
+
97
+ [[package]]
98
+ name = "same-file"
99
+ version = "1.0.6"
100
+ source = "registry+https://github.com/rust-lang/crates.io-index"
101
+ checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
102
+ dependencies = [
103
+ "winapi-util",
104
+ ]
105
+
106
+ [[package]]
107
+ name = "shlex"
108
+ version = "1.3.0"
109
+ source = "registry+https://github.com/rust-lang/crates.io-index"
110
+ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
111
+
112
+ [[package]]
113
+ name = "syn"
114
+ version = "2.0.100"
115
+ source = "registry+https://github.com/rust-lang/crates.io-index"
116
+ checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0"
117
+ dependencies = [
118
+ "proc-macro2",
119
+ "quote",
120
+ "unicode-ident",
121
+ ]
122
+
123
+ [[package]]
124
+ name = "unicode-ident"
125
+ version = "1.0.18"
126
+ source = "registry+https://github.com/rust-lang/crates.io-index"
127
+ checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
128
+
129
+ [[package]]
130
+ name = "walkdir"
131
+ version = "2.5.0"
132
+ source = "registry+https://github.com/rust-lang/crates.io-index"
133
+ checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
134
+ dependencies = [
135
+ "same-file",
136
+ "winapi-util",
137
+ ]
138
+
139
+ [[package]]
140
+ name = "wasm-bindgen"
141
+ version = "0.2.100"
142
+ source = "registry+https://github.com/rust-lang/crates.io-index"
143
+ checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
144
+ dependencies = [
145
+ "cfg-if",
146
+ "once_cell",
147
+ "rustversion",
148
+ "wasm-bindgen-macro",
149
+ ]
150
+
151
+ [[package]]
152
+ name = "wasm-bindgen-backend"
153
+ version = "0.2.100"
154
+ source = "registry+https://github.com/rust-lang/crates.io-index"
155
+ checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6"
156
+ dependencies = [
157
+ "bumpalo",
158
+ "log",
159
+ "proc-macro2",
160
+ "quote",
161
+ "syn",
162
+ "wasm-bindgen-shared",
163
+ ]
164
+
165
+ [[package]]
166
+ name = "wasm-bindgen-futures"
167
+ version = "0.4.50"
168
+ source = "registry+https://github.com/rust-lang/crates.io-index"
169
+ checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61"
170
+ dependencies = [
171
+ "cfg-if",
172
+ "js-sys",
173
+ "once_cell",
174
+ "wasm-bindgen",
175
+ "web-sys",
176
+ ]
177
+
178
+ [[package]]
179
+ name = "wasm-bindgen-macro"
180
+ version = "0.2.100"
181
+ source = "registry+https://github.com/rust-lang/crates.io-index"
182
+ checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407"
183
+ dependencies = [
184
+ "quote",
185
+ "wasm-bindgen-macro-support",
186
+ ]
187
+
188
+ [[package]]
189
+ name = "wasm-bindgen-macro-support"
190
+ version = "0.2.100"
191
+ source = "registry+https://github.com/rust-lang/crates.io-index"
192
+ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
193
+ dependencies = [
194
+ "proc-macro2",
195
+ "quote",
196
+ "syn",
197
+ "wasm-bindgen-backend",
198
+ "wasm-bindgen-shared",
199
+ ]
200
+
201
+ [[package]]
202
+ name = "wasm-bindgen-shared"
203
+ version = "0.2.100"
204
+ source = "registry+https://github.com/rust-lang/crates.io-index"
205
+ checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d"
206
+ dependencies = [
207
+ "unicode-ident",
208
+ ]
209
+
210
+ [[package]]
211
+ name = "wasm-bindgen-test"
212
+ version = "0.3.50"
213
+ source = "registry+https://github.com/rust-lang/crates.io-index"
214
+ checksum = "66c8d5e33ca3b6d9fa3b4676d774c5778031d27a578c2b007f905acf816152c3"
215
+ dependencies = [
216
+ "js-sys",
217
+ "minicov",
218
+ "wasm-bindgen",
219
+ "wasm-bindgen-futures",
220
+ "wasm-bindgen-test-macro",
221
+ ]
222
+
223
+ [[package]]
224
+ name = "wasm-bindgen-test-macro"
225
+ version = "0.3.50"
226
+ source = "registry+https://github.com/rust-lang/crates.io-index"
227
+ checksum = "17d5042cc5fa009658f9a7333ef24291b1291a25b6382dd68862a7f3b969f69b"
228
+ dependencies = [
229
+ "proc-macro2",
230
+ "quote",
231
+ "syn",
232
+ ]
233
+
234
+ [[package]]
235
+ name = "web-sys"
236
+ version = "0.3.77"
237
+ source = "registry+https://github.com/rust-lang/crates.io-index"
238
+ checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2"
239
+ dependencies = [
240
+ "js-sys",
241
+ "wasm-bindgen",
242
+ ]
243
+
244
+ [[package]]
245
+ name = "winapi-util"
246
+ version = "0.1.9"
247
+ source = "registry+https://github.com/rust-lang/crates.io-index"
248
+ checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
249
+ dependencies = [
250
+ "windows-sys",
251
+ ]
252
+
253
+ [[package]]
254
+ name = "windows-sys"
255
+ version = "0.59.0"
256
+ source = "registry+https://github.com/rust-lang/crates.io-index"
257
+ checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
258
+ dependencies = [
259
+ "windows-targets",
260
+ ]
261
+
262
+ [[package]]
263
+ name = "windows-targets"
264
+ version = "0.52.6"
265
+ source = "registry+https://github.com/rust-lang/crates.io-index"
266
+ checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
267
+ dependencies = [
268
+ "windows_aarch64_gnullvm",
269
+ "windows_aarch64_msvc",
270
+ "windows_i686_gnu",
271
+ "windows_i686_gnullvm",
272
+ "windows_i686_msvc",
273
+ "windows_x86_64_gnu",
274
+ "windows_x86_64_gnullvm",
275
+ "windows_x86_64_msvc",
276
+ ]
277
+
278
+ [[package]]
279
+ name = "windows_aarch64_gnullvm"
280
+ version = "0.52.6"
281
+ source = "registry+https://github.com/rust-lang/crates.io-index"
282
+ checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
283
+
284
+ [[package]]
285
+ name = "windows_aarch64_msvc"
286
+ version = "0.52.6"
287
+ source = "registry+https://github.com/rust-lang/crates.io-index"
288
+ checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
289
+
290
+ [[package]]
291
+ name = "windows_i686_gnu"
292
+ version = "0.52.6"
293
+ source = "registry+https://github.com/rust-lang/crates.io-index"
294
+ checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
295
+
296
+ [[package]]
297
+ name = "windows_i686_gnullvm"
298
+ version = "0.52.6"
299
+ source = "registry+https://github.com/rust-lang/crates.io-index"
300
+ checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
301
+
302
+ [[package]]
303
+ name = "windows_i686_msvc"
304
+ version = "0.52.6"
305
+ source = "registry+https://github.com/rust-lang/crates.io-index"
306
+ checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
307
+
308
+ [[package]]
309
+ name = "windows_x86_64_gnu"
310
+ version = "0.52.6"
311
+ source = "registry+https://github.com/rust-lang/crates.io-index"
312
+ checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
313
+
314
+ [[package]]
315
+ name = "windows_x86_64_gnullvm"
316
+ version = "0.52.6"
317
+ source = "registry+https://github.com/rust-lang/crates.io-index"
318
+ checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
319
+
320
+ [[package]]
321
+ name = "windows_x86_64_msvc"
322
+ version = "0.52.6"
323
+ source = "registry+https://github.com/rust-lang/crates.io-index"
324
+ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
package/Cargo.toml ADDED
@@ -0,0 +1,19 @@
1
+ [package]
2
+ name = "flowscripter_template_bun_wasm_rust_library"
3
+ version ="1.0.26"
4
+ edition = "2021"
5
+ description = "Project template for a Rust library compiled to WASM exposed as a Bun module."
6
+ homepage = "https://github.com/flowscripter"
7
+ license = "MIT"
8
+ repository = "https://github.com/flowscripter/template-bun-wasm-rust-library"
9
+ exclude = [".github/"]
10
+
11
+ [lib]
12
+ crate-type = ["cdylib","lib"]
13
+
14
+ [dependencies]
15
+ wasm-bindgen = "0.2.100"
16
+ flowscripter_template_rust_library = "1.1.11"
17
+
18
+ [dev-dependencies]
19
+ wasm-bindgen-test = "0.3.50"
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Flowscripter
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # template-bun-wasm-rust-library
2
+
3
+ [![version](https://img.shields.io/github/v/release/flowscripter/template-bun-wasm-rust-library?sort=semver)](https://github.com/flowscripter/template-bun-wasm-rust-library/releases)
4
+ [![build](https://img.shields.io/github/actions/workflow/status/flowscripter/template-bun-wasm-rust-library/release-bun-wasm-rust-library.yml)](https://github.com/flowscripter/template-bun-wasm-rust-library/actions/workflows/release-bun-wasm-rust-library.yml)
5
+ [![coverage](https://codecov.io/gh/flowscripter/template-bun-wasm-rust-library/graph/badge.svg?token=uWK0oWsBjr)](https://codecov.io/gh/flowscripter/template-bun-wasm-rust-library)
6
+ [![docs](https://img.shields.io/badge/docs-API-blue)](https://flowscripter.github.io/template-bun-wasm-rust-library/index.html)
7
+ [![license: MIT](https://img.shields.io/github/license/flowscripter/template-bun-wasm-rust-library)](https://github.com/flowscripter/template-bun-wasm-rust-library/blob/main/LICENSE)
8
+
9
+ > Project template for a Rust library compiled to WASM exposed as a Bun module.
10
+
11
+ ## Template Usage
12
+
13
+ Create a new Bun project using this as a template:
14
+
15
+ `bun create @flowscripter/template-bun-wasm-rust-library`
16
+
17
+ ## Bun Module Usage
18
+
19
+ Add the module:
20
+
21
+ `bun add @flowscripter/template-bun-wasm-rust-library`
22
+
23
+ Use the module:
24
+
25
+ ```typescript
26
+ import { world } from "@flowscripter/template-bun-wasm-rust-library";
27
+
28
+ world();
29
+ ```
30
+
31
+ ## Development
32
+
33
+ Install [wasm-pack](https://rustwasm.github.io/wasm-pack/):
34
+
35
+ `cargo install wasm-pack`
36
+
37
+ Install dependencies:
38
+
39
+ `bun install`
40
+
41
+ Build:
42
+
43
+ `wasm-pack build --target web --no-pack`
44
+
45
+ Test:
46
+
47
+ `cargo test && bun test`
48
+
49
+ **NOTE**: The following tasks use Deno as it excels at these and Bun does not
50
+ currently provide such functionality:
51
+
52
+ Format:
53
+
54
+ `deno fmt`
55
+
56
+ Lint:
57
+
58
+ `cargo fmt && deno lint index.ts src/ tests/`
59
+
60
+ Generate HTML API Documentation:
61
+
62
+ `deno doc --html --name=template-bun-wasm-rust-library index.ts`
63
+
64
+ ## Documentation
65
+
66
+ ### Overview
67
+
68
+ Sample mermaid diagram to test rendering in markdown:
69
+
70
+ ```mermaid
71
+ classDiagram
72
+ Foo <|-- Bar
73
+ ```
74
+
75
+ ### API
76
+
77
+ Link to auto-generated API docs:
78
+
79
+ [API Documentation](https://flowscripter.github.io/template-bun-wasm-rust-library/index.html)
80
+
81
+ ## License
82
+
83
+ MIT © Flowscripter
package/bun.lock ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "lockfileVersion": 1,
3
+ "workspaces": {
4
+ "": {
5
+ "name": "template-bun-wasm-rust-library",
6
+ "devDependencies": {
7
+ "@types/bun": "^1.2.10",
8
+ },
9
+ "peerDependencies": {
10
+ "typescript": "^5.8.3",
11
+ },
12
+ },
13
+ },
14
+ "packages": {
15
+ "@types/bun": ["@types/bun@1.2.10", "", { "dependencies": { "bun-types": "1.2.10" } }, "sha512-eilv6WFM3M0c9ztJt7/g80BDusK98z/FrFwseZgT4bXCq2vPhXD4z8R3oddmAn+R/Nmz9vBn4kweJKmGTZj+lg=="],
16
+
17
+ "@types/node": ["@types/node@22.14.1", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw=="],
18
+
19
+ "bun-types": ["bun-types@1.2.10", "", { "dependencies": { "@types/node": "*" } }, "sha512-b5ITZMnVdf3m1gMvJHG+gIfeJHiQPJak0f7925Hxu6ZN5VKA8AGy4GZ4lM+Xkn6jtWxg5S3ldWvfmXdvnkp3GQ=="],
20
+
21
+ "typescript": ["typescript@5.8.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="],
22
+
23
+ "undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
24
+ }
25
+ }
package/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./src/lib.ts";
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@flowscripter/template-bun-wasm-rust-library",
3
+ "description": "Project template for a Rust library compiled to WASM exposed as a Bun module",
4
+ "homepage": "https://github.com/flowscripter/template-bun-wasm-rust-library#readme",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/flowscripter/template-bun-wasm-rust-library.git"
8
+ },
9
+ "license": "MIT",
10
+ "keywords": [
11
+ "bun",
12
+ "rust",
13
+ "wasm",
14
+ "example",
15
+ "template",
16
+ "library"
17
+ ],
18
+ "module": "index.ts",
19
+ "type": "module",
20
+ "version": "1.0.2",
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "devDependencies": {
25
+ "@types/bun": "^1.2.10"
26
+ },
27
+ "peerDependencies": {
28
+ "typescript": "^5.8.3"
29
+ }
30
+ }
package/src/lib.rs ADDED
@@ -0,0 +1,32 @@
1
+ //! # Template Bun WASM Rust Library
2
+ //!
3
+ //! `flowscripter_template_bun_wasm_rust_library` provides a sample function to be called from JavaScript.
4
+
5
+ use flowscripter_template_rust_library::adder;
6
+ use wasm_bindgen::prelude::*;
7
+
8
+ /// Adds two numbers together.
9
+ ///
10
+ ///
11
+ /// # Examples
12
+ /// ```
13
+ /// let arg1 = 3;
14
+ /// let arg2 = 3;
15
+ /// let answer = flowscripter_template_bun_wasm_rust_library::add(arg1, arg2);
16
+ ///
17
+ /// assert_eq!(6, answer);
18
+ /// ```
19
+ #[wasm_bindgen]
20
+ pub fn add(a: i32, b: i32) -> i32 {
21
+ adder(a, b)
22
+ }
23
+
24
+ #[cfg(test)]
25
+ mod tests {
26
+ use super::*;
27
+
28
+ #[test]
29
+ fn adder_works() {
30
+ assert_eq!(6, add(3, 3));
31
+ }
32
+ }
package/src/lib.ts ADDED
@@ -0,0 +1,13 @@
1
+ import init, {
2
+ add,
3
+ } from "../pkg/flowscripter_template_bun_wasm_rust_library.js";
4
+
5
+ /**
6
+ * Adds 3 and 3 and logs the result as "World 6"
7
+ */
8
+ export async function world(): Promise<void> {
9
+ // init WASM module
10
+ await init();
11
+
12
+ console.info(`World ${add(3, 3)}`);
13
+ }
@@ -0,0 +1,6 @@
1
+ use flowscripter_template_bun_wasm_rust_library;
2
+
3
+ #[test]
4
+ fn world_works() {
5
+ assert_eq!(6, flowscripter_template_bun_wasm_rust_library::add(3, 3));
6
+ }
@@ -0,0 +1,9 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import { world } from "../src/lib.ts";
3
+
4
+ describe("World Tests", () => {
5
+ test("Simple Test", () => {
6
+ world();
7
+ expect(true);
8
+ });
9
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "compilerOptions": {
3
+ // Environment setup & latest features
4
+ "lib": ["ESNext"],
5
+ "target": "ESNext",
6
+ "module": "ESNext",
7
+ "moduleDetection": "force",
8
+ "jsx": "react-jsx",
9
+ "allowJs": true,
10
+
11
+ // Bundler mode
12
+ "moduleResolution": "bundler",
13
+ "allowImportingTsExtensions": true,
14
+ "verbatimModuleSyntax": true,
15
+ "noEmit": true,
16
+
17
+ // Best practices
18
+ "strict": true,
19
+ "skipLibCheck": true,
20
+ "noFallthroughCasesInSwitch": true,
21
+ "noUncheckedIndexedAccess": true,
22
+
23
+ // Some stricter flags (disabled by default)
24
+ "noUnusedLocals": false,
25
+ "noUnusedParameters": false,
26
+ "noPropertyAccessFromIndexSignature": false
27
+ }
28
+ }