@datamoc/mw_games 0.33.0 → 0.35.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/CHANGELOG.md CHANGED
@@ -7,6 +7,39 @@ the public API may still change between minor versions.
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.35.0] - 2026-10-11
11
+
12
+ A Lua integration host for games that need synchronous API results and resumable dialogue, an offline Lua to JavaScript translator, and the Lua dependency moves to `@datamoc/fengari` 0.5.2.
13
+
14
+ ### Added
15
+
16
+ - `createFengariRuntime` on the optional `mwl/fengari` subpath: synchronous host functions with results, live indexed table bindings, owned Lua callback/table references, embedded `require`/`dofile`, and host-driven coroutines with request values and scene answers. `luaToJs` translates Lua source to readable JavaScript offline (fengari 0.5.0's `lua2js`), flagging untranslatable constructs, for a game leaving Lua scripting. The existing JSON-only `ScriptHost` stays unchanged. Calls, module compilation and coroutine resumes share bounded execution, with a fresh budget for each top-level operation.
17
+
18
+ ### Changed
19
+
20
+ - The optional Lua dependency moves to `@datamoc/fengari` `^0.5.2`, whose shipped TypeScript declarations replace the old `@ts-expect-error` import and the hand-written `luaToJs` types, and whose `vm.protect` and `vm.throwLuaError` replace the host-side protected-call code. The host reuses `FengariVm`'s execution guard while retaining text-only compilation, JSON-shaped tables and seeded randomness.
21
+
22
+ ### Fixed
23
+
24
+ - Lua instruction limits now interrupt native table moves and string searches, and cannot be swallowed by `pcall`, `xpcall` message handlers or coroutine resumes. Parsing and execution still share the per-call string/buffer allocation budget. The `ScriptHost` sandbox also drops `string.dump` and fengari's internal `__random`, which scripts could still reach.
25
+
26
+ ## [0.34.0] - 2026-10-10
27
+
28
+ Hex grids for the cave, dungeon and overworld generators, and the Lua host moves to the `@datamoc/fengari` 0.3.0 fork (`<const>`, `<close>`, `coroutine.close`).
29
+
30
+ ### Added
31
+
32
+ - `shape: 'hex'` on `generateDungeon`/`generateDungeonGraph`, `generateCave` and `generateOverworld`: the generators lay their output out on a hex grid (odd-q offsets, as `Level` does) instead of squares. The dungeon and cave `Level` carry the hex shape; a dungeon corridor leg runs as a hex line and `furthestRoom` counts hex steps on a hex level; a cave grows chambers by hex distance and walks passages by true on-screen distance, so a chamber is round rather than a skewed diamond; the overworld samples its value noise where each hex is drawn and steps rivers and roads across the six edges, with settlement spacing and the near-water test in hex steps. Square output is unchanged byte for byte.
33
+ - `generateCave` accepts `random`, a `RandomSource`, in place of `seed`: the cave draws from that stream and advances it, and the ambient `Random` stack is left alone. Passing neither is refused by name.
34
+
35
+ ### Changed
36
+
37
+ - `@datamoc/fengari` moves to `^0.3.0`. Lua scripts in `mwl/fengari` and `ai/lua` now accept `<const>` and `<close>` variables and `coroutine.close`; a limit error (instructions or memory) unwinds through pending `__close` handlers, and a handler cannot buy extra instructions after the limit fired.
38
+
39
+ ### Fixed
40
+
41
+ - `mwg_emit(name, payload)` called from inside a coroutine read its payload from the main thread's stack, so it returned garbage or failed; it now reads from the calling coroutine.
42
+
10
43
  ## [0.33.0] - 2026-10-10
11
44
 
12
45
  Seven roadmap items in one release: the Wesnoth port's proposal file is now fully answered
package/api-surface.json CHANGED
@@ -8963,18 +8963,78 @@
8963
8963
  "subpath": "./mwl",
8964
8964
  "declaringModule": "mwl/schema.d.ts"
8965
8965
  },
8966
+ {
8967
+ "name": "createFengariRuntime",
8968
+ "kind": "function",
8969
+ "subpath": "./mwl/fengari",
8970
+ "declaringModule": "mwl/fengari-runtime.d.ts"
8971
+ },
8966
8972
  {
8967
8973
  "name": "createFengariScriptHost",
8968
8974
  "kind": "function",
8969
8975
  "subpath": "./mwl/fengari",
8970
8976
  "declaringModule": "mwl/fengari.d.ts"
8971
8977
  },
8978
+ {
8979
+ "name": "FengariCoroutine",
8980
+ "kind": "interface",
8981
+ "subpath": "./mwl/fengari",
8982
+ "declaringModule": "mwl/fengari-runtime.d.ts"
8983
+ },
8984
+ {
8985
+ "name": "FengariReference",
8986
+ "kind": "interface",
8987
+ "subpath": "./mwl/fengari",
8988
+ "declaringModule": "mwl/fengari-runtime.d.ts"
8989
+ },
8990
+ {
8991
+ "name": "FengariRuntime",
8992
+ "kind": "interface",
8993
+ "subpath": "./mwl/fengari",
8994
+ "declaringModule": "mwl/fengari-runtime.d.ts"
8995
+ },
8996
+ {
8997
+ "name": "FengariRuntimeOptions",
8998
+ "kind": "interface",
8999
+ "subpath": "./mwl/fengari",
9000
+ "declaringModule": "mwl/fengari-runtime.d.ts"
9001
+ },
8972
9002
  {
8973
9003
  "name": "FengariScriptHostOptions",
8974
9004
  "kind": "interface",
8975
9005
  "subpath": "./mwl/fengari",
8976
9006
  "declaringModule": "mwl/fengari.d.ts"
8977
9007
  },
9008
+ {
9009
+ "name": "FengariTableBinding",
9010
+ "kind": "interface",
9011
+ "subpath": "./mwl/fengari",
9012
+ "declaringModule": "mwl/fengari-runtime.d.ts"
9013
+ },
9014
+ {
9015
+ "name": "FengariValue",
9016
+ "kind": "type",
9017
+ "subpath": "./mwl/fengari",
9018
+ "declaringModule": "mwl/fengari-runtime.d.ts"
9019
+ },
9020
+ {
9021
+ "name": "luaToJs",
9022
+ "kind": "function",
9023
+ "subpath": "./mwl/fengari",
9024
+ "declaringModule": "mwl/fengari.d.ts"
9025
+ },
9026
+ {
9027
+ "name": "LuaToJsOptions",
9028
+ "kind": "type",
9029
+ "subpath": "./mwl/fengari",
9030
+ "declaringModule": "mwl/fengari.d.ts"
9031
+ },
9032
+ {
9033
+ "name": "LuaToJsResult",
9034
+ "kind": "type",
9035
+ "subpath": "./mwl/fengari",
9036
+ "declaringModule": "mwl/fengari.d.ts"
9037
+ },
8978
9038
  {
8979
9039
  "name": "AbilityCycle",
8980
9040
  "kind": "class",