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 CHANGED
@@ -1,65 +1,76 @@
1
- # Motely browser WASM (`motely-wasm` / `motely-wasm-mt`)
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, the output folder (`Motely.BrowserWasm/motely-wasm/` or `motely-wasm-mt/`) is a **real** package you can `npm pack`, depend on with `"file:…"`, or publish to the registry.
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, **`Motely` = named export**
11
+ ### JavaScript: default export = boot API, flat named exports for the generated API
12
12
 
13
- Bootsharp’s `index.mjs` ends with something like `export { Event, Motely, as default }`. Use it like this:
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 dotnet, { Motely } from "motely-wasm";
16
+ import bootsharp, {
17
+ MotelyProgram,
18
+ SearchEvents,
19
+ MotelyDeck,
20
+ MotelyStake,
21
+ } from "motely-wasm";
17
22
 
18
- await dotnet.boot(); // or dotnet.boot({ root: "/path/to/motely-wasm-mt/bin" } for threaded)
23
+ await bootsharp.boot();
19
24
 
20
- const Program = Motely.BrowserWasm.MotelyProgram;
21
- const ver = Program.getVersion();
25
+ const ver = MotelyProgram.getVersion();
22
26
  ```
23
27
 
24
- Types are under `motely-wasm/types/`; `Motely` holds enums (`MotelyDeck`, `MotelyStake`) and namespaces (`Motely.BrowserWasm.MotelyProgram`, `Motely.BrowserWasm.SearchEvents`).
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
- ### Single-thread package (default)
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
- ### Multi-thread (pthread) package
42
+ ### Parallelism: Web Workers (not pthread WASM)
39
43
 
40
- Some LLVM/SDK combos fail to link threaded WASM — only ship after a **successful** local publish.
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 combinationso we do not bet the browser story on it.
41
45
 
42
- ```powershell
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
- Threaded WASM in the browser needs **cross-origin isolation** (`COOP: same-origin`, `COEP: require-corp` or similar). The default single-thread package does **not** require these.
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** (requires Node on that machine, or run in CI):
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, **`./publish.ps1`** regenerates schema + language tooling, runs `dotnet publish`, then runs `npm pack` / `npm publish`.
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
- ## SeedSearcherWebsite
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
- Static QA: **`build-website.sh`** / **`Build-Website.ps1`** copy `motely-wasm/`, `motely-wasm-mt/`, and the HTML/JS harness into `dist/` (no bundler). Deploy `dist/` with Vercel or any host that serves `*.wasm` with the right `Content-Type` and COOP/COEP where needed.
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).