motely-wasm 11.2.0 → 11.3.1
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 +114 -0
- package/index.mjs +9 -3
- package/package.json +30 -12
- package/types/bindings.g.d.ts +108 -95
package/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# motely-wasm
|
|
2
|
+
|
|
3
|
+
**Balatro seed searcher compiled to browser WASM**, from [`MotelyJAML`](https://github.com/OptimusPi/MotelyJAML). NativeAOT-LLVM + Bootsharp (SIMD-vectorized, AOT-trimmed, embedded binaries, single ES module).
|
|
4
|
+
|
|
5
|
+
Node 20+ / modern browsers. Single-threaded in the browser runtime.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm i motely-wasm
|
|
11
|
+
# or
|
|
12
|
+
pnpm add motely-wasm
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import bootsharp, { MotelyWasm, Motely, Filters } from "motely-wasm";
|
|
19
|
+
|
|
20
|
+
// 1. Boot the WASM runtime (one-time).
|
|
21
|
+
await bootsharp.boot();
|
|
22
|
+
|
|
23
|
+
// 2. Call the exported IMotelyWasm surface.
|
|
24
|
+
console.log(MotelyWasm.getVersion()); // "11.3.0"
|
|
25
|
+
console.log(MotelyWasm.validateJaml(jamlText)); // "valid" or error string
|
|
26
|
+
|
|
27
|
+
// 3. Run a search. JAML (YAML) comes in as a string. Parse / generate it with `yaml`.
|
|
28
|
+
const search = MotelyWasm.startRandomSearch(jamlText, 100_000);
|
|
29
|
+
const done = await search.waitForCompletion();
|
|
30
|
+
const hits = search.drainResults(1000);
|
|
31
|
+
search.dispose();
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## JAML is just YAML
|
|
35
|
+
|
|
36
|
+
JAML (Jimbo's Ante Markup Language) is **YAML, 1:1**. There is nothing exotic here — a JAML document is a YAML document. To work with it in JS:
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
|
|
40
|
+
const doc = parseYaml(jamlText); // normal JS object
|
|
41
|
+
jamlText = stringifyYaml({ ...doc, stake: "Gold" });
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Do not regex-parse JAML.** Use the `yaml` package (already a dep in most stacks) or the built-in `MotelyWasm.parseJamlContext(jaml)` for the canonical deck/stake/aesthetics extraction.
|
|
45
|
+
|
|
46
|
+
JSON Schema for JAML: https://raw.githubusercontent.com/OptimusPi/MotelyJAML/master/jaml.schema.json
|
|
47
|
+
|
|
48
|
+
## Recommended UI consumers
|
|
49
|
+
|
|
50
|
+
- **[`jaml-ui`](https://www.npmjs.com/package/jaml-ui)** — React components + shared Motely/JAML TypeScript surface over this package. Prefer `jaml-ui` display helpers / filter components over rolling your own.
|
|
51
|
+
- **[`jimbo-ui`](https://www.npmjs.com/package/jimbo-ui)** — Balatro-themed visual components (cards, sprites, aesthetics). Pair with `jaml-ui`.
|
|
52
|
+
|
|
53
|
+
If a Motely name / enum / formatted string is missing from `motely-wasm` and you'd otherwise hand-roll it in TS, **open an issue** on [MotelyJAML](https://github.com/OptimusPi/MotelyJAML/issues) asking for the export — that's the canonical way to extend `IMotelyWasm`.
|
|
54
|
+
|
|
55
|
+
## Package shape
|
|
56
|
+
|
|
57
|
+
This is a single embedded-binaries ES module ("compat" shape — everything in one bundle, no sideload):
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
motely-wasm/
|
|
61
|
+
index.mjs ~10–11 MB — single-file ESM with .NET runtime + Motely binaries embedded
|
|
62
|
+
package.json
|
|
63
|
+
types/
|
|
64
|
+
index.d.ts main entry; re-exports the useful surface
|
|
65
|
+
bindings.g.d.ts generated from C# IMotelyWasm + all DTO/enum types (MotelyBoosterPack, MotelyVoucher, MotelyBossBlind, MotelyTag, MotelyDeck, MotelyStake, …)
|
|
66
|
+
boot.d.ts boot / exit / getStatus / BootStatus / BootOptions
|
|
67
|
+
event.d.ts Event<T> (subscribe / unsubscribe)
|
|
68
|
+
modules.d.ts getMain / getNative / getRuntime
|
|
69
|
+
config.d.ts buildConfig
|
|
70
|
+
instances.d.ts interop-instance helpers
|
|
71
|
+
resources.d.ts resource / BinaryResource types
|
|
72
|
+
(…)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The `types/` split is emitted by Bootsharp and **re-exports cleanly** through `types/index.d.ts`, so consumers just do `import { Motely, Filters, MotelyWasm } from "motely-wasm"` and TypeScript resolves everything.
|
|
76
|
+
|
|
77
|
+
## Threading
|
|
78
|
+
|
|
79
|
+
All search methods internally set `threadCount = 1`. Browser WASM is single-threaded — this is not a knob. Use [`Motely.CLI`](https://github.com/OptimusPi/MotelyJAML) for configurable parallel / AVX-512 native throughput.
|
|
80
|
+
|
|
81
|
+
## CDN / script-tag mirror
|
|
82
|
+
|
|
83
|
+
In addition to npm, this package is mirrored on the MotelyJAML CDN so you can `import` straight from an HTML page (no bundler required):
|
|
84
|
+
|
|
85
|
+
```html
|
|
86
|
+
<script type="module">
|
|
87
|
+
import bootsharp, { MotelyWasm } from "https://cdn.seedfinder.app/motely-wasm/11.3.0/index.mjs";
|
|
88
|
+
await bootsharp.boot();
|
|
89
|
+
console.log(MotelyWasm.getVersion());
|
|
90
|
+
</script>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
A `latest` alias tracks the most recent release:
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
https://cdn.seedfinder.app/motely-wasm/latest/index.mjs
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
(CDN is served from the same infra as `jammy.seedfinder.app` / `mcp.seedfinder.app`. Versioned URLs are immutable; `latest` moves on each release.)
|
|
100
|
+
|
|
101
|
+
Fallbacks that "just work" without any setup:
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
https://unpkg.com/motely-wasm@11.3.0/index.mjs
|
|
105
|
+
https://cdn.jsdelivr.net/npm/motely-wasm@11.3.0/index.mjs
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Versioning
|
|
109
|
+
|
|
110
|
+
Single source of truth: `<MotelyVersion>` in [`Directory.Packages.props`](https://github.com/OptimusPi/MotelyJAML/blob/master/Directory.Packages.props). On `dotnet publish Motely.Wasm`, an MSBuild target stamps that into `motely-wasm/package.json`.
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
MIT — © pifreak & MotelyJAML contributors.
|