@moku-labs/game 0.7.0 → 0.8.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.
Files changed (34) hide show
  1. package/README.md +5 -4
  2. package/dist/assets.d.mts +1 -1
  3. package/dist/{capture-fpd83Mi5.mjs → capture-BX5Gfoty.mjs} +1 -384
  4. package/dist/{commands-mzE9PX0H.d.mts → commands-C1kIfOG5.d.mts} +6 -4
  5. package/dist/control.d.mts +4 -3
  6. package/dist/control.mjs +2 -2
  7. package/dist/{define-BbgXv4cy.d.mts → define-BPpZcpxW.d.mts} +4 -3
  8. package/dist/headless-CvamCUcR.mjs +186 -0
  9. package/dist/headless-q98SwADR.d.mts +181 -0
  10. package/dist/index.d.mts +23 -22
  11. package/dist/index.mjs +17 -6
  12. package/dist/{input-CK4nxBO1.mjs → input-z_35Jwfn.mjs} +2 -2
  13. package/dist/inspect.d.mts +8 -6
  14. package/dist/inspect.mjs +2 -2
  15. package/dist/jsx-dev-runtime.d.mts +1 -1
  16. package/dist/jsx-runtime.d.mts +1 -1
  17. package/dist/project.d.mts +28 -28
  18. package/dist/project.mjs +7 -7
  19. package/dist/registry-DlpRCibU.mjs +384 -0
  20. package/dist/{run-Bcyg32M5.mjs → run-CUPSFM85.mjs} +4 -187
  21. package/dist/{runtime-HTlmRb81.d.mts → runtime-CvDZZg1S.d.mts} +1 -1
  22. package/dist/{sources-DVWJ8nfr.mjs → sources-BBUd15vQ.mjs} +1 -1
  23. package/dist/testing.d.mts +3 -328
  24. package/dist/testing.mjs +2 -2142
  25. package/dist/{types-BMEn0tSC.d.mts → types-BWzCSRM2.d.mts} +12 -2974
  26. package/dist/{types-CYYKjvLn.d.mts → types-CDSKa0vl.d.mts} +5 -182
  27. package/dist/{types-ClF8say0.d.mts → types-DF5kkW-C.d.mts} +5 -4
  28. package/dist/{types-BaUUcIaN.d.mts → types-DgdMLZnV.d.mts} +8 -7
  29. package/dist/{types-CXyipKhE.d.mts → types-DlgsfOmW.d.mts} +10 -9
  30. package/dist/types-ERb2Y9U5.d.mts +2967 -0
  31. package/dist/visual.d.mts +331 -0
  32. package/dist/visual.mjs +2142 -0
  33. package/llms.txt +6 -5
  34. package/package.json +7 -8
package/llms.txt CHANGED
@@ -7,7 +7,8 @@ Facts: Bun only. ESM only. `"sideEffects": false`. `pixi.js` `^8.0.0` is a peer
7
7
  ## Entry points
8
8
 
9
9
  - `@moku-labs/game`: everything a game imports.
10
- - `@moku-labs/game/testing`: headless play, repro runs, fake clock, in-memory save provider.
10
+ - `@moku-labs/game/testing`: headless play, repro runs, fake clock, in-memory save provider. No `node:` import.
11
+ - `@moku-labs/game/visual` (node and bun only): the visual tests `defineVisualTest`, `runVisualTests`, `parseVisualArgv`.
11
12
  - `@moku-labs/game/assets` (node and bun only): the asset key scanner, the production packer and the string compiler. The package bin `moku-game-assets` runs it.
12
13
  - `@moku-labs/game/inspect`: the read door of the editor, safe in a production build. See "Doors for the editor".
13
14
  - `@moku-labs/game/control`: the write door of the editor, dev builds only. See "Doors for the editor".
@@ -513,8 +514,8 @@ Two subpaths, neither on the root (V4). An editor, MCP tools and e2e scripts rea
513
514
  ```ts
514
515
  import { openProject } from "@moku-labs/game/project";
515
516
 
516
- const project = await openProject({ root: "tests/integration/merge-game" });
517
- (await project.find("node:board/merge"))[0]?.line; // 17, in "nodes/merge.ts"
517
+ const project = await openProject({ root: "tests/fixtures/mini-game" });
518
+ (await project.find("node:infoPopup/count"))[0]?.line; // 7, in "nodes/count.ts"
518
519
  const stop = project.watch((index, change) => refresh(index.revision, change.moved));
519
520
  stop();
520
521
  project.close();
@@ -556,7 +557,7 @@ The scanner keys it `ui.font-body`, which is the `text` config default `fonts.bo
556
557
 
557
558
  ## Testing entry
558
559
 
559
- Exports of `@moku-labs/game/testing`: `createHeadless`, `runRepro`, `stepFrames`, `fakeClock`, `memory`, `saveOf`, and the visual tests `defineVisualTest`, `runVisualTests`, `parseVisualArgv` (see `docs/testing.md` in the engine repository).
560
+ Exports of `@moku-labs/game/testing`: `createHeadless`, `runRepro`, `stepFrames`, `fakeClock`, `memory`, `saveOf`. The visual tests `defineVisualTest`, `runVisualTests`, `parseVisualArgv` come from `@moku-labs/game/visual`, node and bun only (see `docs/testing.md` in the engine repository).
560
561
 
561
562
  - `createHeadless(app): Promise<HeadlessGame>`. Pass an app that is not started. It sets mode `"fast"`, awaits `app.start()`, starts `flow.run()` unless the app's `onStart` already did, and resolves when the loop rests for the first time: `game.state().path` already names the first rest node. A fatal error of `run()` rejects the call.
562
563
  - `HeadlessGame`: `walk(route): Promise<FlowState>`, `answer(answer): boolean`, `state()`, `history()`, `stop()`. `walk` and `stop` throw a fatal error of the loop again when the headless runner owns `run()`.
@@ -602,4 +603,4 @@ src/
602
603
  tests/ headless scenarios with createHeadless and walk
603
604
  ```
604
605
 
605
- This is the layout of the worked example in the engine repository: `tests/integration/merge-game/` with `kit.ts`, `state.ts`, `tables.ts`, `rules/`, `nodes/`, `flows/`, `game.ts`. It is an internal test fixture written on the public API only. It is not in the npm package. Its scenario is `tests/integration/template-merge.test.ts`. A game with a screen adds `features/<name>/view.tsx` (projections and components), `features/<name>/animations.ts`, `features/<name>/strings/<locale>.json` and the `generated/` folder `bun run assets:keys` writes. Each plugin has a README: `src/plugins/<name>/README.md` for `time`, `lifecycle`, `model`, `clock`, `flow`, `world`, `renderer`, `input`, `assets`, `scenes`, `anim`, `i18n`, `text`, `ui`, `audio`, `effects`, `platform`. Moku Core specification: https://github.com/moku-labs/core/tree/main/specification
606
+ This is the layout of the worked example, the merge game in moku-labs/demos (https://github.com/moku-labs/demos): `kit.ts`, `state.ts`, `tables.ts`, `rules/`, `nodes/`, `flows/`, `game.ts`, written on the public API only, with its e2e and visual tests. The engine repository keeps a smaller fixture, `tests/fixtures/mini-game/`, which is not in the npm package. A game with a screen adds `features/<name>/view.tsx` (projections and components), `features/<name>/animations.ts`, `features/<name>/strings/<locale>.json` and the `generated/` folder `bun run assets:keys` writes. Each plugin has a README: `src/plugins/<name>/README.md` for `time`, `lifecycle`, `model`, `clock`, `flow`, `world`, `renderer`, `input`, `assets`, `scenes`, `anim`, `i18n`, `text`, `ui`, `audio`, `effects`, `platform`. Moku Core specification: https://github.com/moku-labs/core/tree/main/specification
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moku-labs/game",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "2D puzzle game engine on TypeScript and PixiJS, built on @moku-labs/core.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -15,6 +15,10 @@
15
15
  "types": "./dist/testing.d.mts",
16
16
  "default": "./dist/testing.mjs"
17
17
  },
18
+ "./visual": {
19
+ "types": "./dist/visual.d.mts",
20
+ "default": "./dist/visual.mjs"
21
+ },
18
22
  "./assets": {
19
23
  "types": "./dist/assets.d.mts",
20
24
  "default": "./dist/assets.mjs"
@@ -84,9 +88,8 @@
84
88
  "test:integration": "bun --bun vitest run --project integration",
85
89
  "test:coverage": "bun --bun vitest run --project unit --project integration --coverage",
86
90
  "build": "tsdown",
87
- "fixture:pack": "bun src/assets.ts --root tests/integration/merge-game --keys tests/integration/merge-game/generated/assets.ts --pack tests/integration/merge-game/dist/assets",
88
- "fixture:visual": "bun tests/visual/run.ts",
89
- "fixture:native": "bun tests/integration/merge-game/native.ts",
91
+ "mini:pack": "bun src/assets.ts --root tests/fixtures/mini-game --keys tests/fixtures/mini-game/generated/assets.ts --pack tests/fixtures/mini-game/dist/assets",
92
+ "mini:visual": "bun tests/visual/run.ts",
90
93
  "validate": "publint && attw --pack . --profile esm-only",
91
94
  "release:setup": "moku-release setup",
92
95
  "release:doctor": "moku-release doctor",
@@ -127,10 +130,6 @@
127
130
  "@moku-labs/ci": "1.2.6",
128
131
  "@moku-labs/common": "0.3.4",
129
132
  "@moku-labs/core": "1.7.1",
130
- "@moku-labs/native": "0.3.0",
131
- "@moku-labs/system": "0.3.0",
132
- "@tauri-apps/api": "2.12.1",
133
- "@tauri-apps/plugin-haptics": "2.4.1",
134
133
  "@types/bun": "1.3.14",
135
134
  "@vitest/coverage-istanbul": "4.0.18",
136
135
  "eslint": "9.39.3",