@flowscripter/template-bun-wasm-rust-library 1.0.5 → 1.0.6

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/src/lib.ts +5 -1
package/README.md CHANGED
@@ -41,7 +41,7 @@ Install dependencies:
41
41
  Build (remove generated `.gitignore` to allow npm publish from root of
42
42
  repository):
43
43
 
44
- `wasm-pack build --target web --no-pack && rm pkg/.gitignore`
44
+ `wasm-pack build --target web --release --no-pack && rm pkg/.gitignore`
45
45
 
46
46
  Test:
47
47
 
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  ],
18
18
  "module": "index.ts",
19
19
  "type": "module",
20
- "version": "1.0.5",
20
+ "version": "1.0.6",
21
21
  "files": [
22
22
  "src/**/*",
23
23
  "pkg/**/*",
package/src/lib.ts CHANGED
@@ -1,13 +1,17 @@
1
1
  import init, {
2
2
  add,
3
3
  } from "../pkg/flowscripter_template_bun_wasm_rust_library.js";
4
+ import wasm from "../pkg/flowscripter_template_bun_wasm_rust_library_bg.wasm";
5
+ const wasmBuffer = typeof Bun !== "undefined"
6
+ ? await Bun.file(wasm).arrayBuffer()
7
+ : await fetch(wasm).then((response) => response.arrayBuffer());
4
8
 
5
9
  /**
6
10
  * Adds 3 and 3 and logs the result as "World 6"
7
11
  */
8
12
  export async function world(): Promise<void> {
9
13
  // init WASM module
10
- await init();
14
+ await init({ module_or_path: wasmBuffer });
11
15
 
12
16
  console.info(`World ${add(3, 3)}`);
13
17
  }