From 091f614fe02045c95a3dc6eb4fe37c97cf700a3e Mon Sep 17 00:00:00 2001 From: Kim Wallmark Date: Sat, 8 Apr 2023 19:45:07 -0400 Subject: [PATCH] Add information about additional generated files. wasm_game_of_life_bg.js and wasm_game_of_life_bg.wasm.d.ts are now being generated by `wasm-pack build`. There is some additional information about these files in https://github.com/rustwasm/wasm-pack/issues/199 and https://github.com/rustwasm/wasm-pack/issues/1193 . --- src/game-of-life/hello-world.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/game-of-life/hello-world.md b/src/game-of-life/hello-world.md index 6f59daf1..63eb1a7f 100644 --- a/src/game-of-life/hello-world.md +++ b/src/game-of-life/hello-world.md @@ -112,7 +112,9 @@ and it should have these contents: pkg/ ├── package.json ├── README.md +├── wasm_game_of_life_bg.js ├── wasm_game_of_life_bg.wasm +├── wasm_game_of_life_bg.wasm.d.ts ├── wasm_game_of_life.d.ts └── wasm_game_of_life.js ``` @@ -147,12 +149,18 @@ export function greet() { } ``` -### `wasm-game-of-life/pkg/wasm_game_of_life.d.ts` +### `wasm-game-of-life/pkg/wasm_game_of_life_bg.js` -The `.d.ts` file contains [TypeScript][] type declarations for the JavaScript -glue. If you are using TypeScript, you can have your calls into WebAssembly -functions type checked, and your IDE can provide autocompletions and -suggestions! If you aren't using TypeScript, you can safely ignore this file. +This `_bg.js` file contains shim code that allows the `_bg.wasm` code to be +required as a module in Node.js. + +### `wasm-game-of-life/pkg/wasm_game_of_life.d.ts` and `wasm-game-of-life/pkg/wasm_game_of_life_bg.wasm.d.ts` + +These `.d.ts` files contain [TypeScript][] type declarations for the JavaScript +glue and the wasm code. If you are using TypeScript, you can have your calls +into WebAssembly functions type checked, and your IDE can provide +autocompletions and suggestions! If you aren't using TypeScript, you can safely +ignore these files. ```typescript export function greet(): void;