@moku-labs/game 0.14.12 → 0.14.13
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 +13 -12
- package/dist/app/page.d.mts +8 -3
- package/dist/app/page.mjs +57 -12
- package/dist/app/system.d.mts +5 -3
- package/dist/app/system.mjs +2 -0
- package/dist/app.d.mts +15 -7
- package/dist/app.mjs +131 -27
- package/dist/{assets-BrKSg1O6.mjs → assets-CEMfBogh.mjs} +471 -120
- package/dist/assets.d.mts +30 -13
- package/dist/assets.mjs +1 -1
- package/dist/cli.d.mts +105 -8
- package/dist/cli.mjs +1036 -128
- package/dist/{commands-BaCx2B9j.d.mts → commands-DAETmK86.d.mts} +43 -7
- package/dist/{config-CdARrrhU.mjs → config-B87aFTW-.mjs} +25 -4
- package/dist/control.d.mts +130 -17
- package/dist/control.mjs +4 -4
- package/dist/{define-Ce8SVEN-.d.mts → define-BASd9ZUh.d.mts} +32 -4
- package/dist/dev-DbHgx-R-.mjs +89 -0
- package/dist/{fake-MpzwZhIZ.mjs → fake-6mazmHK3.mjs} +20 -2
- package/dist/features-DowEilZm.mjs +266 -0
- package/dist/{headless-CMHNsKjW.d.mts → headless-cFveciuY.d.mts} +1 -1
- package/dist/hot.d.mts +4 -2
- package/dist/hot.mjs +7 -4
- package/dist/{index-CLQ8NOTw.d.mts → index-DedbED3T.d.mts} +317 -69
- package/dist/index.d.mts +5 -6
- package/dist/index.mjs +3 -3
- package/dist/inspect.d.mts +12 -7
- package/dist/inspect.mjs +2 -2
- package/dist/jsx-dev-runtime.d.mts +1 -1
- package/dist/jsx-runtime.d.mts +1 -1
- package/dist/lint.d.mts +8 -3
- package/dist/lint.mjs +432 -20
- package/dist/project.d.mts +15 -1
- package/dist/project.mjs +1 -1
- package/dist/{run-Bf2hKyjZ.mjs → run-BbipFRc6.mjs} +250 -51
- package/dist/{runtime-BCnKn0xf.d.mts → runtime-DoSlRx8X.d.mts} +1 -1
- package/dist/{session-DgukhR_7.mjs → session-CeKgO2hy.mjs} +30 -2
- package/dist/{sources-Duzj6lhV.mjs → sources-Cdvb0rOS.mjs} +33 -6
- package/dist/{src-CtC8w3_z.mjs → src-BEbJ_sSx.mjs} +35536 -17789
- package/dist/testing.d.mts +23 -13
- package/dist/testing.mjs +10 -6
- package/dist/{types-DOlpeuGx.d.mts → types-7GXcXxxv.d.mts} +174 -242
- package/dist/{types-BjTtGSFb.d.mts → types-BGcda5Le.d.mts} +4459 -732
- package/dist/{types-gisvSHoC.d.mts → types-C73hbmxi.d.mts} +129 -17
- package/dist/{types-CAPv9l29.d.mts → types-DngFQJro.d.mts} +43 -5
- package/dist/{types-Y_rCuXtj.d.mts → types-GHE4J5Uf.d.mts} +1025 -191
- package/dist/{visual-dMW8iqAE.mjs → visual-2m4wJL_z.mjs} +111 -7
- package/dist/visual-_XhoGeIC.d.mts +345 -0
- package/dist/visual.d.mts +1 -332
- package/dist/visual.mjs +130 -20
- package/dist/{watch-CWI_on4T.mjs → watch-BEdrp80i.mjs} +149 -30
- package/llms.txt +99 -48
- package/package.json +8 -6
- package/dist/dev-Cc50Dk7H.mjs +0 -47
- package/dist/memory-pUQ7YZWC.d.mts +0 -50
- package/dist/types-BX4Ge_j5.d.mts +0 -656
package/dist/dev-Cc50Dk7H.mjs
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
//#region src/plugins/flow/doors/dev.ts
|
|
2
|
-
/**
|
|
3
|
-
* Reads the dev flag at call time. Undefined means off: production is the default.
|
|
4
|
-
*
|
|
5
|
-
* @returns True only when `__MOKU_GAME_DEV__` is exactly `true`.
|
|
6
|
-
* @example
|
|
7
|
-
* ```ts
|
|
8
|
-
* // The dev page set the flag in .moku/dev.ts before the engine started.
|
|
9
|
-
* globalThis.__MOKU_GAME_DEV__ = true;
|
|
10
|
-
* isDev(); // true
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
function isDev() {
|
|
14
|
-
return typeof __MOKU_GAME_DEV__ !== "undefined" && __MOKU_GAME_DEV__ === true;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Builds the error a control command throws outside a dev build.
|
|
18
|
-
*
|
|
19
|
-
* @returns The error, ready to throw.
|
|
20
|
-
* @example
|
|
21
|
-
* ```ts
|
|
22
|
-
* // A production build called a /control command.
|
|
23
|
-
* controlRefused().message; // "[game] Control commands run in dev builds only.\n Define __MOKU_GAME_DEV__ as true in the dev build."
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
function controlRefused() {
|
|
27
|
-
return /* @__PURE__ */ new Error("[game] Control commands run in dev builds only.\n Define __MOKU_GAME_DEV__ as true in the dev build.");
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Builds the error a door source or command throws when the opt-in plugin it uses is not
|
|
31
|
-
* installed.
|
|
32
|
-
*
|
|
33
|
-
* @param id - The id of the source or the command.
|
|
34
|
-
* @param plugin - The export name of the plugin it uses.
|
|
35
|
-
* @param kind - What the door descriptor is. A source by default.
|
|
36
|
-
* @returns The error, ready to throw.
|
|
37
|
-
* @example
|
|
38
|
-
* ```ts
|
|
39
|
-
* notInstalled("game.sounds", "audioPlugin").message; // "[game] The source game.sounds needs audioPlugin.\n Add audioPlugin to createApp({ plugins })."
|
|
40
|
-
* notInstalled("game.mute", "audioPlugin", "command").message; // "[game] The command game.mute needs audioPlugin.\n Add audioPlugin to createApp({ plugins })."
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
function notInstalled(id, plugin, kind = "source") {
|
|
44
|
-
return /* @__PURE__ */ new Error(`[game] The ${kind} ${id} needs ${plugin}.\n Add ${plugin} to createApp({ plugins }).`);
|
|
45
|
-
}
|
|
46
|
-
//#endregion
|
|
47
|
-
export { isDev as n, notInstalled as r, controlRefused as t };
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { Zt as Json, in as SaveDoc, nn as PlayerStateProvider, rn as ProviderCall } from "./types-BjTtGSFb.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/plugins/model/store/providers/memory.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Creates an in-memory provider that keeps what it was committed and records every call.
|
|
6
|
-
* It is the default when a game configures no `playerProvider`, and the double every test uses:
|
|
7
|
-
* `provider.calls` is the whole persistence protocol of one run, in order. The document lives as
|
|
8
|
-
* long as the provider does, so a second app over the same instance reads what the first one
|
|
9
|
-
* wrote, and nothing survives the process.
|
|
10
|
-
*
|
|
11
|
-
* `load()` reads the fixture, or everything committed since; without either, the player is new.
|
|
12
|
-
* `commitDurable()` resolves at once: there is no disk behind it.
|
|
13
|
-
*
|
|
14
|
-
* @param fixture - The save `load()` starts from. Omitted: a new player.
|
|
15
|
-
* @param fixture.state - The saved document.
|
|
16
|
-
* @param fixture.version - Schema version of the saved document.
|
|
17
|
-
* @returns A provider that keeps its document and records its calls.
|
|
18
|
-
* @example
|
|
19
|
-
* ```ts
|
|
20
|
-
* // A new player is saved at once. One roll reaches the provider at the next rest node.
|
|
21
|
-
* const provider = memory();
|
|
22
|
-
* const game = await createHeadless(createGame(provider));
|
|
23
|
-
*
|
|
24
|
-
* await game.walk([{ at: "home", intent: "roll" }]);
|
|
25
|
-
* provider.calls.map(call => call.method); // ["load", "commit", "commit"]
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
declare function memory(fixture?: {
|
|
29
|
-
state: SaveDoc;
|
|
30
|
-
version: number;
|
|
31
|
-
}): PlayerStateProvider & {
|
|
32
|
-
calls: ProviderCall[];
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Builds a save document from a player tree, with no rng streams drawn yet.
|
|
36
|
-
* Short fixtures in tests read as `saveOf({ coins: 5 })` instead of spelling out the rng branch.
|
|
37
|
-
*
|
|
38
|
-
* @param player - Player tree of the save.
|
|
39
|
-
* @param seed - Rng seed of the save.
|
|
40
|
-
* @returns The save document.
|
|
41
|
-
* @example
|
|
42
|
-
* ```ts
|
|
43
|
-
* // A returning player with 5 coins. The test starts from this save, not from `initialPlayer`.
|
|
44
|
-
* saveOf({ coins: 5 }, 42); // { player: { coins: 5 }, rng: { seed: 42, streams: {} } }
|
|
45
|
-
* const provider = memory({ state: saveOf({ coins: 5 }, 42), version: 1 });
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
|
-
declare function saveOf(player: Json, seed?: number): SaveDoc;
|
|
49
|
-
//#endregion
|
|
50
|
-
export { saveOf as n, memory as t };
|