motely-wasm 6.0.1 → 6.1.0
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.
- package/README.md +34 -23
- package/index.mjs +37 -181
- package/jaml.schema.json +1 -1
- package/package.json +1 -1
- package/types/bindings.g.d.ts +2 -111
- package/bin/dotnet.js +0 -4
- package/bin/dotnet.native.js +0 -16
- package/bin/dotnet.native.wasm +0 -0
- package/bin/dotnet.runtime.js +0 -3
package/README.md
CHANGED
|
@@ -1,65 +1,76 @@
|
|
|
1
|
-
# Motely browser WASM (`motely-wasm` / `motely-wasm-
|
|
1
|
+
# Motely browser WASM (`motely-wasm` / `motely-wasm-compat`)
|
|
2
2
|
|
|
3
3
|
## What Bootsharp actually does
|
|
4
4
|
|
|
5
5
|
**`dotnet publish Motely.BrowserWasm`** is the **entire** build. [Bootsharp](https://github.com/korif/Bootsharp) emits the **complete** npm package: `index.mjs`, WASM, TypeScript typings, and the JS interop glue. You are **not** hand-assembling an npm package.
|
|
6
6
|
|
|
7
|
-
After publish,
|
|
7
|
+
After publish, you get **two** npm-ready folders: `Motely.BrowserWasm/motely-wasm/` (canonical name) and `Motely.BrowserWasm/motely-wasm-compat/` (same WASM bits and `exports`; alternate package name for consumers). Both are **real** packages you can `npm pack`, depend on with `"file:…"`, or publish to the registry.
|
|
8
8
|
|
|
9
9
|
The only extra step in this repo is **MSBuild**: it copies `Motely/package.json`, `jaml.schema.json`, README metadata, and Monaco assets **on top of** Bootsharp’s output so `name`, `description`, `exports`, and shipped files match what you want on npm. **Version** comes from `$(MotelyVersion)` in `Directory.Packages.props` via the project `Version` property — not from editing `package.json` by hand for every release.
|
|
10
10
|
|
|
11
|
-
### JavaScript: default export = boot API,
|
|
11
|
+
### JavaScript: default export = boot API, flat named exports for the generated API
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
The browser-first package is emitted as a real npm module and can be consumed from browsers, workers, Node, Bun, or Deno. Use it like this:
|
|
14
14
|
|
|
15
15
|
```js
|
|
16
|
-
import
|
|
16
|
+
import bootsharp, {
|
|
17
|
+
MotelyProgram,
|
|
18
|
+
SearchEvents,
|
|
19
|
+
MotelyDeck,
|
|
20
|
+
MotelyStake,
|
|
21
|
+
} from "motely-wasm";
|
|
17
22
|
|
|
18
|
-
await
|
|
23
|
+
await bootsharp.boot();
|
|
19
24
|
|
|
20
|
-
const
|
|
21
|
-
const ver = Program.getVersion();
|
|
25
|
+
const ver = MotelyProgram.getVersion();
|
|
22
26
|
```
|
|
23
27
|
|
|
24
|
-
Types are under `motely-wasm/types/`;
|
|
28
|
+
Types are under `motely-wasm/types/`; the generated API is exported directly as named exports such as `MotelyProgram`, `SearchEvents`, `MotelyDeck`, and `MotelyStake`.
|
|
25
29
|
|
|
26
30
|
---
|
|
27
31
|
|
|
28
32
|
## Commands (from repo root `MotelyJAML`)
|
|
29
33
|
|
|
30
|
-
###
|
|
34
|
+
### Default package
|
|
31
35
|
|
|
32
36
|
```powershell
|
|
33
37
|
dotnet publish Motely.BrowserWasm -c Release
|
|
34
38
|
```
|
|
35
39
|
|
|
36
|
-
Output: **`Motely.BrowserWasm/motely-wasm
|
|
40
|
+
Output: **`Motely.BrowserWasm/motely-wasm/`**. With embedded binaries enabled, this is the low-friction package shape for browser and bundler consumers.
|
|
37
41
|
|
|
38
|
-
###
|
|
42
|
+
### Parallelism: Web Workers (not pthread WASM)
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
This project does **not** ship or promise a pthread / multi-threaded Emscripten WASM build. Combining **.NET WASM + NativeAOT-LLVM + pthreads** is a separate, poorly documented matrix; there is no reproducible “proof script” checked in here that threaded AOT-LLVM WASM is a supported combination—so we do not bet the browser story on it.
|
|
41
45
|
|
|
42
|
-
|
|
43
|
-
dotnet publish Motely.BrowserWasm/Motely.BrowserWasm.csproj -c Release /p:MotelyWasmThreads=true
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Output: **`Motely.BrowserWasm/motely-wasm-mt/`** (includes `bin/` with `*.wasm` for the threaded loader).
|
|
46
|
+
**What we actually use:** scale in the browser by spawning **Web Workers**, importing `motely-wasm` in each worker, and calling `bootsharp.boot()` once per worker. Workers are a normal, well-defined browser API; each worker is its own isolate—no `motely-wasm-mt` package, no COOP/COEP requirement for that pattern.
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
**Proof:** after `dotnet publish`, run **`Motely.TestWebsite`** (or your app) locally and confirm behavior. Treat any WASM path as “works on my machine / CI” until you’ve verified it for your SDK and host.
|
|
49
49
|
|
|
50
50
|
### Optional: `npm pack` / `npm publish`
|
|
51
51
|
|
|
52
|
-
Tarball verification or registry publish still use the **npm CLI**
|
|
52
|
+
Tarball verification or registry publish still use the **npm CLI** on the publishing machine or in CI:
|
|
53
53
|
|
|
54
54
|
```powershell
|
|
55
55
|
cd Motely.BrowserWasm/motely-wasm
|
|
56
56
|
npm pack --dry-run
|
|
57
|
+
cd ../motely-wasm-compat
|
|
58
|
+
npm pack --dry-run
|
|
57
59
|
```
|
|
58
60
|
|
|
59
|
-
From repo root,
|
|
61
|
+
From repo root, **`Build-Release.ps1`** does the full pipeline (solution build, schema, jaml-language, `dotnet publish`, optional npm). **`publish.ps1`** is a shortcut for `Build-Release.ps1 -Npm Publish` (use `-DryRun` on `publish.ps1` for `npm pack --dry-run`).
|
|
60
62
|
|
|
61
63
|
---
|
|
62
64
|
|
|
63
|
-
##
|
|
65
|
+
## Test website (`Motely.TestWebsite`)
|
|
66
|
+
|
|
67
|
+
Vite harness that loads **`motely-wasm`** on `/` and **`motely-wasm-compat`** on `/compat.html` (separate pages so each bundle calls `bootsharp.boot()` once).
|
|
68
|
+
|
|
69
|
+
```powershell
|
|
70
|
+
dotnet publish Motely.BrowserWasm -c Release
|
|
71
|
+
cd Motely.TestWebsite
|
|
72
|
+
npm install
|
|
73
|
+
npm run dev
|
|
74
|
+
```
|
|
64
75
|
|
|
65
|
-
|
|
76
|
+
Production static output: `npm run build` → `dist/`. Deploy with any static host; ensure `*.wasm` is served with `application/wasm` (Vite preview/dev handles this for local QA).
|