You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: wasm-rust-sample/README.md
+13-11Lines changed: 13 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,25 +2,28 @@
2
2
3
3
This plugin is a starting point for leveraging Rust and WebAssembly in your UXP plugins. It comes defined with most of the dependencies you need to get started. As this plugin does rely on the [Rust Programming Language](https://www.rust-lang.org/), an environment configured for Rust development will be required before this will be usable in Photoshop.
4
4
5
-
**Note:** As part of working with the current limitations of UXP the Rust/WebAssembly build process within this plugin has _many_ unconventional ways of getting things done.
6
-
7
-
If you happen to be leveraging Rust/WebAssembly in a more traditional manner, please checkout tools such as [wasm-bindgen](https://github.com/rustwasm/wasm-bindgen/) and [wasm-pack](https://github.com/rustwasm/wasm-pack) that the Rust development team are actively working on.
8
5
9
6
# Configuration
10
7
11
8
## Rust Environment
12
9
13
10
Before beginning ensure that the [Rust toolchain](https://www.rust-lang.org/tools/install) is installed and configured on your machine.
14
11
15
-
Follow the instructions and the `rustup` installation. Once completed, your machine will be able to execute `cargo` commands.
12
+
Follow the instructions and the `rustup` installation process. Once completed, your shell will have access to `cargo` commands.
13
+
14
+
> You **must** have the Rust toolchain installed in order to build the project
16
15
17
-
To test if Rust is configured properly before loading the project, run the basic tests in the project's root:
> You **must** have the Rust toolchain installed in order to build the project
22
+
### 2. Test local Rust configuration and [wasm-pack](https://github.com/rustwasm/wasm-pack) installation
23
+
24
+
```
25
+
$ yarn test # or cargo test && wasm-pack test
26
+
```
24
27
25
28
## Node.js
26
29
@@ -42,17 +45,16 @@ $ yarn build # or npm run build
42
45
43
46
This will build a production version of the plugin and place it in `dist`. It will not update every time you make a change to the source files.
44
47
45
-
**Note:** Since UXP does not have implicit access to `localhost` for leveraging a development server, this plugin uses inline WebAssembly to work properly. In `js/index.js` this file is included:
48
+
**Note:** Since UXP does not have implicit access to `localhost` for leveraging a development server, this plugin uses inline WebAssembly to work properly. As such, you'll find the following import in `js/index.js`:
46
49
47
50
```
48
-
import encodedRust from './uxp-wasm';
51
+
import encodedRust from './uxp.wasm';
49
52
```
50
53
51
54
When the build script is triggerred, this JS file with the inline WebAssembly is generated. Should you wish to generate this file yourself, execute the following commands:
52
55
53
56
```
54
-
$ yarn wasm:build # compile the Rust crate to WebAssembly
55
-
$ yarn wasm:inline # generate JS file containing the inline WebAssembly data
57
+
$ yarn inlinewasm # generate JS file containing the inline WebAssembly data
0 commit comments