@diffenderfer-games/hub 0.0.0-stage → 2.0.0-next.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/CHANGELOG.md +9 -0
- package/LICENSE +21 -0
- package/README.md +191 -3
- package/dist/auto.d.ts +36 -0
- package/dist/auto.d.ts.map +1 -0
- package/dist/auto.js +27 -0
- package/dist/auto.js.map +1 -0
- package/dist/daily.d.ts +2 -0
- package/dist/daily.js +1 -0
- package/dist/doctor/cli.mjs +268 -0
- package/dist/doctor/cli.mjs.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +6 -0
- package/dist/input.d.ts +2 -0
- package/dist/input.js +3 -0
- package/dist/mp.d.ts +4 -0
- package/dist/mp.js +1 -0
- package/dist/race.d.ts +4 -0
- package/dist/race.js +1 -0
- package/dist/rooms.d.ts +4 -0
- package/dist/rooms.js +1 -0
- package/dist/shared/bridge.js +209 -0
- package/dist/shared/bridge.js.map +1 -0
- package/dist/shared/client-version.gen.js +7 -0
- package/dist/shared/client-version.gen.js.map +1 -0
- package/dist/shared/daily.d.ts +123 -0
- package/dist/shared/daily.d.ts.map +1 -0
- package/dist/shared/daily.js +191 -0
- package/dist/shared/daily.js.map +1 -0
- package/dist/shared/dom.js +48 -0
- package/dist/shared/dom.js.map +1 -0
- package/dist/shared/globals.js +102 -0
- package/dist/shared/globals.js.map +1 -0
- package/dist/shared/index.d.ts +706 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/input.d.ts +730 -0
- package/dist/shared/input.d.ts.map +1 -0
- package/dist/shared/input.js +2718 -0
- package/dist/shared/input.js.map +1 -0
- package/dist/shared/latest-state.js +17 -0
- package/dist/shared/latest-state.js.map +1 -0
- package/dist/shared/mp.d.ts +9 -0
- package/dist/shared/mp.d.ts.map +1 -0
- package/dist/shared/mp.js +30 -0
- package/dist/shared/mp.js.map +1 -0
- package/dist/shared/multiplayer-types.d.ts +47 -0
- package/dist/shared/multiplayer-types.d.ts.map +1 -0
- package/dist/shared/page-stack.js +207 -0
- package/dist/shared/page-stack.js.map +1 -0
- package/dist/shared/race-types.d.ts +126 -0
- package/dist/shared/race-types.d.ts.map +1 -0
- package/dist/shared/race.d.ts +9 -0
- package/dist/shared/race.d.ts.map +1 -0
- package/dist/shared/race.js +53 -0
- package/dist/shared/race.js.map +1 -0
- package/dist/shared/room-types.d.ts +125 -0
- package/dist/shared/room-types.d.ts.map +1 -0
- package/dist/shared/rooms.d.ts +9 -0
- package/dist/shared/rooms.d.ts.map +1 -0
- package/dist/shared/rooms.js +62 -0
- package/dist/shared/rooms.js.map +1 -0
- package/dist/shared/runtime-opener.js +84 -0
- package/dist/shared/runtime-opener.js.map +1 -0
- package/dist/shared/social.d.ts +148 -0
- package/dist/shared/social.d.ts.map +1 -0
- package/dist/shared/social.js +73 -0
- package/dist/shared/social.js.map +1 -0
- package/dist/shared/src.js +2164 -0
- package/dist/shared/src.js.map +1 -0
- package/dist/shared/wire-types.d.ts +51 -0
- package/dist/shared/wire-types.d.ts.map +1 -0
- package/dist/social.d.ts +6 -0
- package/dist/social.js +3 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js +0 -0
- package/package.json +89 -6
- package/src/auto.ts +39 -0
- package/src/core/connection.ts +299 -0
- package/src/core/errors.ts +147 -0
- package/src/core/game-data.ts +38 -0
- package/src/core/hub-economy.ts +179 -0
- package/src/core/hub-progress.ts +205 -0
- package/src/core/hub.ts +131 -0
- package/src/core/menu-control.ts +61 -0
- package/src/core/offline/events.ts +50 -0
- package/src/core/offline/favorites.ts +21 -0
- package/src/core/offline/local-store.ts +261 -0
- package/src/core/offline/queue.ts +171 -0
- package/src/core/page.ts +74 -0
- package/src/core/rest/endpoint-types.ts +22 -0
- package/src/core/rest/rest-client.ts +152 -0
- package/src/core/rest/routes.gen.ts +90 -0
- package/src/core/storage/json-guards.ts +74 -0
- package/src/core/storage/key-value.ts +66 -0
- package/src/core/ticket.ts +43 -0
- package/src/core/types.ts +134 -0
- package/src/core/version/client-version.gen.ts +3 -0
- package/src/core/version/hub-version.ts +62 -0
- package/src/core/version/semver.ts +97 -0
- package/src/daily/daily-system.ts +161 -0
- package/src/daily/page-daily.ts +36 -0
- package/src/daily/types.ts +67 -0
- package/src/daily.ts +10 -0
- package/src/doctor/checks.ts +78 -0
- package/src/doctor/cli.ts +98 -0
- package/src/doctor/hub-version-fetch.ts +43 -0
- package/src/doctor/tsconfig.json +12 -0
- package/src/globals.ts +115 -0
- package/src/index.ts +50 -0
- package/src/input/device-state.ts +146 -0
- package/src/input/edges.ts +55 -0
- package/src/input/gamepad.ts +61 -0
- package/src/input/input-events.ts +32 -0
- package/src/input/input-registry.ts +164 -0
- package/src/input/input-system.ts +393 -0
- package/src/input/legacy-controls.ts +64 -0
- package/src/input/nav-state.ts +191 -0
- package/src/input/navigator.ts +171 -0
- package/src/input/on-screen-controls.ts +101 -0
- package/src/input/page-control.ts +43 -0
- package/src/input/page-input.ts +193 -0
- package/src/input/player-remaps.ts +77 -0
- package/src/input/source-values.ts +116 -0
- package/src/input/spatial.ts +47 -0
- package/src/input/types.ts +331 -0
- package/src/input/zero-config.ts +177 -0
- package/src/input.ts +22 -0
- package/src/mp.ts +10 -0
- package/src/overlay/controls-panel.ts +163 -0
- package/src/overlay/dom.ts +46 -0
- package/src/overlay/layout-clusters.ts +162 -0
- package/src/overlay/layout-geometry.ts +136 -0
- package/src/overlay/layout.ts +203 -0
- package/src/overlay/listener-scope.ts +23 -0
- package/src/overlay/on-screen-keyboard.ts +137 -0
- package/src/overlay/overlay.ts +208 -0
- package/src/overlay/styles.ts +54 -0
- package/src/overlay/virtual-controls.ts +262 -0
- package/src/race.ts +10 -0
- package/src/realtime/bridge.ts +121 -0
- package/src/realtime/cross-bundle.ts +29 -0
- package/src/realtime/fallback-notice.ts +48 -0
- package/src/realtime/hub-link.ts +65 -0
- package/src/realtime/latest-state.ts +33 -0
- package/src/realtime/multiplayer-forwarder.ts +28 -0
- package/src/realtime/multiplayer-types.ts +52 -0
- package/src/realtime/page-runtime.ts +60 -0
- package/src/realtime/race-forwarder.ts +59 -0
- package/src/realtime/race-types.ts +132 -0
- package/src/realtime/room-types.ts +125 -0
- package/src/realtime/rooms-forwarder.ts +79 -0
- package/src/realtime/runtime-api.ts +49 -0
- package/src/realtime/runtime-opener.ts +61 -0
- package/src/realtime/social-forwarder.ts +72 -0
- package/src/realtime/social-types.ts +78 -0
- package/src/realtime/types.ts +53 -0
- package/src/realtime/wire-types.ts +72 -0
- package/src/rooms.ts +10 -0
- package/src/social.ts +18 -0
- package/src/types.ts +13 -0
- package/src/uistack/page-stack.ts +45 -0
- package/src/uistack/play-suspension.ts +82 -0
- package/src/uistack/types.ts +76 -0
- package/src/uistack/ui-stack.ts +144 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# @diffenderfer-games/hub
|
|
2
|
+
|
|
3
|
+
## 2.0.0-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Follow-ups from the Bubble Pop pilot. `hub-doctor` gives up after `--timeout` ms (default 10 s) and fails with `hub unreachable at <url>` instead of hanging. A v1 vendored singleton adopted on the page is now recorded in `window.__DG__` as `{ version: 'v1' }`. The README covers exact pins for prereleases, sharing the page with the host's `/_hub/hub.js`, and testing against the hub.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @diffenderfer-games/hub-contract@2.0.0-next.1
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Philip Diffenderfer
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,191 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# @diffenderfer-games/hub
|
|
2
|
+
|
|
3
|
+
The client library for games on [diffenderfer.games](https://diffenderfer.games):
|
|
4
|
+
accounts, saves, stats, leaderboards, inventory and trades, daily challenges,
|
|
5
|
+
the input system (keyboard, touch and gamepad), and the social, multiplayer,
|
|
6
|
+
rooms and race namespaces. It is typed from the hub's wire contract
|
|
7
|
+
(`@diffenderfer-games/hub-contract`), ships ES modules with `.d.ts` files, and
|
|
8
|
+
carries no zod at runtime.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install @diffenderfer-games/hub
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**Prereleases: pin the exact version.** While the package is on `2.0.0-next.N`,
|
|
17
|
+
a caret range does not move between prereleases the way you might expect, so
|
|
18
|
+
install with `--save-exact` and bump on purpose:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npm install --save-exact @diffenderfer-games/hub@2.0.0-next.1
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The `next` dist-tag always names the newest prerelease. `latest` points at the
|
|
25
|
+
same prerelease for now. It moves to `2.0.0` with the first stable release,
|
|
26
|
+
after which ordinary `^2.0.0` ranges are fine.
|
|
27
|
+
|
|
28
|
+
ESM only, for browsers (ES2020: Safari 14+, current Chrome, Edge and Firefox).
|
|
29
|
+
Node 20+ for the `hub-doctor` command.
|
|
30
|
+
|
|
31
|
+
## Use
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { hub } from '@diffenderfer-games/hub';
|
|
35
|
+
|
|
36
|
+
const { user } = await hub.me();
|
|
37
|
+
await hub.ensureGuest(); // a guest account, so progress saves without a sign-in
|
|
38
|
+
await hub.putSave('auto', { level: 7, gold: 120 });
|
|
39
|
+
await hub.submitScore('highscore', 9001, { title: 'High Score' });
|
|
40
|
+
hub.recordPlay();
|
|
41
|
+
|
|
42
|
+
hub.input.define({ groups: { play: { inputs: { jump: { keys: [' '], gamepad: { button: 0 } } } } } });
|
|
43
|
+
hub.input.enable('play');
|
|
44
|
+
hub.daily.define({ play: (challenge) => startLevel(challenge.seed) });
|
|
45
|
+
hub.overlay.autoPause({ pause, resume });
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
In a game the host serves, the slug and the API base are read from the page.
|
|
49
|
+
For anything else, create a client yourself:
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import { createHub } from '@diffenderfer-games/hub';
|
|
53
|
+
|
|
54
|
+
const demo = createHub({ slug: 'my-game', apiBase: '/_api', offline: 'auto' });
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
A game's own JSON is typed by the game: `hub.getSave<MySave>('auto')`,
|
|
58
|
+
`hub.putSave<MySave>('auto', save)`, `hub.getProfile<MyProfile>()`.
|
|
59
|
+
|
|
60
|
+
## Entry points
|
|
61
|
+
|
|
62
|
+
| Import | What it has |
|
|
63
|
+
|---|---|
|
|
64
|
+
| `@diffenderfer-games/hub` | `hub`, `createHub`, `Hub`, the errors, every client type, and the input and daily exports |
|
|
65
|
+
| `@diffenderfer-games/hub/input` | `getInput`, `InputSystem`, the on-screen control layout, `getUiStack` |
|
|
66
|
+
| `@diffenderfer-games/hub/daily` | `getDaily`, `DailySystem` |
|
|
67
|
+
| `@diffenderfer-games/hub/race`, `/social`, `/mp`, `/rooms` | one namespace each (`race`, `social` with `presence` and `notify`, `mp`, `rooms`) |
|
|
68
|
+
| `@diffenderfer-games/hub/types` | type-only: every contract type (requests, replies, entities, error codes, socket ops and events, the `game.*` manifest) |
|
|
69
|
+
| `@diffenderfer-games/hub/auto` | everything above, and it sets `window.HubSDK` (what `/_hub/hub.js` is built from) |
|
|
70
|
+
|
|
71
|
+
The namespaces also hang off `hub` (`hub.input`, `hub.daily`, `hub.race`,
|
|
72
|
+
`hub.social`, `hub.presence`, `hub.notify`, `hub.mp`, `hub.rooms`,
|
|
73
|
+
`hub.overlay`, `hub.menu`), created on first use.
|
|
74
|
+
|
|
75
|
+
## Errors
|
|
76
|
+
|
|
77
|
+
Every call rejects with a `HubError` when it fails. `status` is the HTTP
|
|
78
|
+
status, or `undefined` when the hub could not be reached (`isOffline`).
|
|
79
|
+
`code`, `reason`, `hint` and `retryAfterMs` come from the hub's error body.
|
|
80
|
+
|
|
81
|
+
- `ContentRejectedError`: the safety filter refused some text (HTTP 422).
|
|
82
|
+
Keep the player's draft and show `hint`.
|
|
83
|
+
- `OfflineError`: an action that needs the hub was tried offline.
|
|
84
|
+
- `code: 'unsupported_by_hub'`: the hub does not have this call yet (the game
|
|
85
|
+
uses a newer client than the deployed hub). Deploy the hub first.
|
|
86
|
+
|
|
87
|
+
The analytics calls (`recordPlay`, `heartbeat`, `event`) never throw.
|
|
88
|
+
|
|
89
|
+
## Offline
|
|
90
|
+
|
|
91
|
+
With `offline: 'auto'` (the default), reads fall back to a cache in
|
|
92
|
+
`localStorage` when the hub can't be reached, and writes (saves, stats,
|
|
93
|
+
scores, profile) apply to the cache at once and are queued. The queue replays
|
|
94
|
+
in order when the connection returns; `hub.sync()` replays it on demand,
|
|
95
|
+
`hub.pending()` counts what waits, and `hub.onStatus(listener)` reports
|
|
96
|
+
changes. `hub.prefetchAll()` warms the cache for every game in one request.
|
|
97
|
+
`offline: 'always'` never touches the network (develop without a hub);
|
|
98
|
+
`offline: 'never'` always throws instead.
|
|
99
|
+
|
|
100
|
+
The cache and queue use the same `localStorage` keys as the old vendored
|
|
101
|
+
client, so a game that switches to this package keeps its players' queued
|
|
102
|
+
progress.
|
|
103
|
+
|
|
104
|
+
## Games without a build step
|
|
105
|
+
|
|
106
|
+
Keep `import('/_hub/hub.js')` or `window.HubSDK.hub`: the host serves a
|
|
107
|
+
bundle of this package's `./auto` entry, at the version the host was built
|
|
108
|
+
with. Install the package as a dev dependency only if you want editor types:
|
|
109
|
+
|
|
110
|
+
```js
|
|
111
|
+
/** @type {import('@diffenderfer-games/hub').Hub} */
|
|
112
|
+
const hub = window.HubSDK.hub;
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Sharing the page with the host's `/_hub/hub.js`
|
|
116
|
+
|
|
117
|
+
Every game page also gets the host's menu and social runtime, which use the
|
|
118
|
+
host's own copy of this client (`/_hub/hub.js`, built from the version the host
|
|
119
|
+
was deployed with). Your bundled copy and the host's cooperate. The page-wide
|
|
120
|
+
pieces (the input system, daily challenges, the realtime API) are registered
|
|
121
|
+
once on `window.__DG__`, each with the version that created it:
|
|
122
|
+
|
|
123
|
+
- **Same shape** (the usual case): the first one wins and both copies share
|
|
124
|
+
it, so an older patch version on either side is harmless.
|
|
125
|
+
- **A different shape** (a major change): your game's copy owns input and
|
|
126
|
+
daily; the host's runtime owns realtime. The mismatch is logged once in the
|
|
127
|
+
console with the fix: `npm update @diffenderfer-games/hub`.
|
|
128
|
+
- **A v1 vendored copy** already on the page is shared too, and recorded as
|
|
129
|
+
`{ version: 'v1' }`.
|
|
130
|
+
|
|
131
|
+
The v1 globals (`window.__HUB_INPUT__`, `__HUB_DAILY__`, `__HUB_RT__`) stay as
|
|
132
|
+
aliases. Don't create your own singletons; `hub.input`, `hub.daily` and the
|
|
133
|
+
forwarders always return the shared ones.
|
|
134
|
+
|
|
135
|
+
## Versions
|
|
136
|
+
|
|
137
|
+
The client sends its version as `x-hub-client`. `hub.hubVersion()` reads the
|
|
138
|
+
hub's `GET /_api/version` (`{ server, contract, supported, deprecated }`) once
|
|
139
|
+
per page, and `hub.clientSupport()` says whether this client is `supported`,
|
|
140
|
+
`deprecated` or `unsupported` (`unknown` on a hub from before versioning).
|
|
141
|
+
|
|
142
|
+
The hub supports the current major and the previous one. Update with
|
|
143
|
+
`npm update @diffenderfer-games/hub`.
|
|
144
|
+
|
|
145
|
+
## hub-doctor
|
|
146
|
+
|
|
147
|
+
Run it in a game's folder, in CI and before pushing:
|
|
148
|
+
|
|
149
|
+
```sh
|
|
150
|
+
npx hub-doctor # checks against https://diffenderfer.games
|
|
151
|
+
npx hub-doctor --offline # skip the version check
|
|
152
|
+
npx hub-doctor --timeout 5000 # wait at most 5 s for the hub (default 10 s)
|
|
153
|
+
npx hub-doctor --hub http://localhost:8080 --dir ../my-game --json
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
An unreachable or slow hub is an error (`hub unreachable at <url> (...)`) and
|
|
157
|
+
exits non-zero, so CI notices. Use `--offline` where CI has no network.
|
|
158
|
+
|
|
159
|
+
It fails when the installed client is outside the hub's `supported` range or
|
|
160
|
+
the `package.json` `game.*` block does not match the manifest schema, and it
|
|
161
|
+
warns when the client is deprecated or a vendored `src/hub/` copy (or
|
|
162
|
+
`scripts/sync-hub.mjs`) is still around.
|
|
163
|
+
|
|
164
|
+
## Testing your game against the hub
|
|
165
|
+
|
|
166
|
+
The hub's test kit lives in the host repo (`test/helpers/`). Point your
|
|
167
|
+
game's tests at a checkout of it with `DG_HOST`; the default is
|
|
168
|
+
`../diffenderfer-games`. It boots a real hub on a free port for each test
|
|
169
|
+
file:
|
|
170
|
+
|
|
171
|
+
```sh
|
|
172
|
+
DG_HOST=../diffenderfer-games HUB_IMPL=next npm run test:hub
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
`HUB_IMPL=next` runs the TypeScript hub and host that production runs. Without
|
|
176
|
+
it, the kit boots the old hub (`src/index.js`), which is kept only as a
|
|
177
|
+
rollback path until it is deleted; test against `next`. The checkout needs
|
|
178
|
+
`npm ci` at its root and in `next/`.
|
|
179
|
+
|
|
180
|
+
## Moving from the vendored copy
|
|
181
|
+
|
|
182
|
+
1. `npm install @diffenderfer-games/hub`.
|
|
183
|
+
2. Change `from './hub/hub'` (or `'./hub'`) to `from '@diffenderfer-games/hub'`.
|
|
184
|
+
3. Delete `src/hub/` and `scripts/sync-hub.mjs`.
|
|
185
|
+
4. Add `npx hub-doctor` to the game's CI.
|
|
186
|
+
|
|
187
|
+
Every method name is unchanged.
|
|
188
|
+
|
|
189
|
+
## License
|
|
190
|
+
|
|
191
|
+
MIT
|
package/dist/auto.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { a as RaceResultPlayer, c as RoomChatLine, d as RoomStateChange, f as SchemaOutput, i as RaceRecordPlayer, l as RoomMessage, m as Snapshot, n as Notice, o as RaceStatusEvent, p as ServerEvents, r as RaceHistory, s as RealtimeErrorShape, t as InviteCreated, u as RoomSeat } from "./shared/wire-types.js";
|
|
2
|
+
import { _ as DailyStatus, a as isDailySystem, c as DailyAll, d as DailyCompletionMeta, f as DailyDefinition, g as DailyStartResponse, h as DailyHost, i as getDaily, l as DailyChallenge, m as DailyGameStatus, n as DailyCompletions, o as DAILY_START_EVENT, p as DailyEventDetail, r as DAILY_SINGLETON_API, s as DailySystem, t as DailyCompletion, u as DailyCompleteResponse } from "./shared/daily.js";
|
|
3
|
+
import { $ as VirtualControlType, A as AxisSide, B as InputReading, C as parseInputOverrides, D as isPageInputControl, E as PageInputControl, F as InputConfig, G as NavElement, H as MenuBridge, I as InputDef, J as NavTarget, K as NavElementKind, L as InputEvents, M as EdgeOffsets, N as GamepadMapping, O as Anchor, P as GroupDef, Q as Vector, R as InputHost, S as isInputSystem, T as InputSystemOptions, U as MouseMapping, V as InputSource, W as NavBlurEvent, X as Rect, Y as NavigableDef, Z as TouchMapping, _ as boxesTouch, a as OverlayEdge, b as InputOptions, c as OverlayReason, d as LayoutOptions, et as VirtualDef, f as layoutControls, g as LayoutItem, h as LayoutBox, i as AutoPauseOptions, j as DraggedSpot, k as AxisDef, l as UiStack, m as Insets, n as getUiStack, nt as VirtualOverride, o as OverlayEvent, p as Overlay, q as NavFocusEvent, r as isUiStack, s as OverlayListener, t as UI_STACK_VERSION, tt as VirtualInputs, u as UiStackHandoff, v as controlSize, w as InputSystem, x as getInput, y as INPUT_SINGLETON_API, z as InputOverrides } from "./shared/input.js";
|
|
4
|
+
import { a as JoinInfoEvent, i as InviteResult, n as HubMpApi, r as InviteOptions, t as BusyOptions } from "./shared/multiplayer-types.js";
|
|
5
|
+
import { o as multiplayerForwarder } from "./shared/mp.js";
|
|
6
|
+
import { a as RoomEvents, c as RoomSendOptions, i as RoomCreateOptions, l as RoomState, n as HubRoomsApi, o as RoomListOptions, r as JoinOptions, s as RoomSelf, t as HubRoom, u as RoomStateOptions } from "./shared/room-types.js";
|
|
7
|
+
import { a as RaceHistoryQuery, c as RaceRuntimeApi, i as RaceEvents, l as RaceStart, n as RaceCreateOptions, o as RaceHistoryViewOptions, r as RaceDefinition, s as RaceHudPlace, t as HubRaceApi } from "./shared/race-types.js";
|
|
8
|
+
import { f as raceForwarder } from "./shared/race.js";
|
|
9
|
+
import { n as roomsForwarder } from "./shared/rooms.js";
|
|
10
|
+
import { $ as HubNotifyApi, A as RacerState, B as SuggestionStatus, C as RaceRecord, D as RaceStats, E as RaceState, F as ReportReason, G as REALTIME_READY_EVENT, H as isRealtimeApi, I as RoomInfo, J as RealtimeHubLink, K as REALTIME_SINGLETON_API, L as SocialConfig, M as Relation, N as ReportInput, O as Racer, P as ReportKind, Q as socialForwarder, R as SocialMe, S as RaceParams, T as RaceStatValue, U as REALTIME_FAILED_EVENT, V as findRealtimeApi, W as REALTIME_FEATURE_VERSION, X as notifyForwarder, Y as linkRealtimeToHub, Z as presenceForwarder, _ as PlayerLite, a as ErrorBody, at as SocialEvents, b as PresenceKind, c as JoinInfo, d as Message, et as HubPresenceApi, f as MessagesPage, g as PlayerCard, h as Party, i as Counts, it as SocialCounts, j as RecentPlayer, k as RacerResult, l as Launch, m as NotifyPrefs, n as ChatMode, nt as OpenInviteOptions, o as FriendEntry, p as NotifyChange, q as RealtimeApi, r as Conversation, rt as PlayerRef, s as Invite, t as Audience, tt as HubSocialApi, u as LaunchTicket, v as Presence, w as RaceResult, x as RaceOutcome, y as PresenceInput, z as Suggestion } from "./shared/social.js";
|
|
11
|
+
import { $ as SubmitScoreResult, A as BoardWithTop, B as Json, C as CLIENT_VERSION_HEADER, D as QueuedScoreOptions, E as QueueOpInput, F as GlobalAnalytics, G as Profile, H as LeaderboardResult, I as HubOptions, J as SaveMeta, K as ProfileSummary, L as HubStatus, M as GameInfo, N as GameLeaderboards, O as BufferedEvent, P as GameRecords, Q as SubmitScoreOptions, R as Inventory, S as SyncResult, T as QueueOp, U as MeResponse, V as LeaderboardEntry, W as Metrics, X as SortDir, Y as SnapshotResponse, Z as Stats, _ as TradeNoteOptions, a as HubErrorDetails, b as StatResult, c as Hub, d as ClientSupport, et as User, f as HubMenuControl, g as TradeListOptions, h as TradeId, i as HubErrorCode, it as GamePayload, j as GameAnalytics, k as Board, l as createHub, m as TradeBundle, n as ContentRejectedError, nt as EndpointName, o as OfflineError, p as GrantBundle, q as Save, r as HubError, rt as EndpointReply, s as UNSUPPORTED_BY_HUB, t as HUB_CLIENT_VERSION, tt as EndpointFields, u as hub, v as AuthResponse, w as ProfilePatch, x as SyncConflict, y as ProfileUpdate, z as InventorySnapshot } from "./shared/index.js";
|
|
12
|
+
//#region src/auto.d.ts
|
|
13
|
+
/** What `window.HubSDK` holds. */
|
|
14
|
+
export interface HubSdkGlobal {
|
|
15
|
+
/** The page's client. */
|
|
16
|
+
readonly hub: Hub;
|
|
17
|
+
/** Create another client. */
|
|
18
|
+
readonly createHub: typeof createHub;
|
|
19
|
+
/** The client class. */
|
|
20
|
+
readonly Hub: typeof Hub;
|
|
21
|
+
/** The base error class. */
|
|
22
|
+
readonly HubError: typeof HubError;
|
|
23
|
+
/** The offline error class. */
|
|
24
|
+
readonly OfflineError: typeof OfflineError;
|
|
25
|
+
/** The content-rejected error class. */
|
|
26
|
+
readonly ContentRejectedError: typeof ContentRejectedError;
|
|
27
|
+
}
|
|
28
|
+
declare global {
|
|
29
|
+
interface Window {
|
|
30
|
+
/** The hub client for games without a build step (installed by `@diffenderfer-games/hub/auto`). */
|
|
31
|
+
HubSDK?: HubSdkGlobal;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { type Anchor, type Audience, type AuthResponse, type AutoPauseOptions, type AxisDef, type AxisSide, type Board, type BoardWithTop, type BufferedEvent, type BusyOptions, CLIENT_VERSION_HEADER, type ChatMode, type ClientSupport, ContentRejectedError, type Conversation, type Counts, DAILY_SINGLETON_API, DAILY_START_EVENT, type DailyAll, type DailyChallenge, type DailyCompleteResponse, type DailyCompletion, type DailyCompletionMeta, type DailyCompletions, type DailyDefinition, type DailyEventDetail, type DailyGameStatus, type DailyHost, type DailyStartResponse, type DailyStatus, DailySystem, type DraggedSpot, type EdgeOffsets, type EndpointFields, type EndpointName, type EndpointReply, type ErrorBody, type FriendEntry, type GameAnalytics, type GameInfo, type GameLeaderboards, type GamePayload, type GameRecords, type GamepadMapping, type GlobalAnalytics, type GrantBundle, type GroupDef, HUB_CLIENT_VERSION, Hub, HubError, type HubErrorCode, type HubErrorDetails, type HubMenuControl, type HubMpApi, type HubNotifyApi, type HubOptions, type HubPresenceApi, type HubRaceApi, type HubRoom, type HubRoomsApi, type HubSocialApi, type HubStatus, INPUT_SINGLETON_API, type InputConfig, type InputDef, type InputEvents, type InputHost, type InputOptions, type InputOverrides, type InputReading, type InputSource, InputSystem, type InputSystemOptions, type Insets, type Inventory, type InventorySnapshot, type Invite, type InviteCreated, type InviteOptions, type InviteResult, type JoinInfo, type JoinInfoEvent, type JoinOptions, type Json, type Launch, type LaunchTicket, type LayoutBox, type LayoutItem, type LayoutOptions, type LeaderboardEntry, type LeaderboardResult, type MeResponse, type MenuBridge, type Message, type MessagesPage, type Metrics, type MouseMapping, type NavBlurEvent, type NavElement, type NavElementKind, type NavFocusEvent, type NavTarget, type NavigableDef, type Notice, type NotifyChange, type NotifyPrefs, OfflineError, type OpenInviteOptions, Overlay, type OverlayEdge, type OverlayEvent, type OverlayListener, type OverlayReason, type PageInputControl, type Party, type PlayerCard, type PlayerLite, type PlayerRef, type Presence, type PresenceInput, type PresenceKind, type Profile, type ProfilePatch, type ProfileSummary, type ProfileUpdate, type QueueOp, type QueueOpInput, type QueuedScoreOptions, type REALTIME_FAILED_EVENT, type REALTIME_FEATURE_VERSION, type REALTIME_READY_EVENT, type REALTIME_SINGLETON_API, type RaceCreateOptions, type RaceDefinition, type RaceEvents, type RaceHistory, type RaceHistoryQuery, type RaceHistoryViewOptions, type RaceHudPlace, type RaceOutcome, type RaceParams, type RaceRecord, type RaceRecordPlayer, type RaceResult, type RaceResultPlayer, type RaceRuntimeApi, type RaceStart, type RaceStatValue, type RaceState, type RaceStats, type RaceStatusEvent, type Racer, type RacerResult, type RacerState, type RealtimeApi, type RealtimeErrorShape, type RealtimeHubLink, type RecentPlayer, type Rect, type Relation, type ReportInput, type ReportKind, type ReportReason, type RoomChatLine, type RoomCreateOptions, type RoomEvents, type RoomInfo, type RoomListOptions, type RoomMessage, type RoomSeat, type RoomSelf, type RoomSendOptions, type RoomState, type RoomStateChange, type RoomStateOptions, type Save, type SaveMeta, type SchemaOutput, type ServerEvents, type Snapshot, type SnapshotResponse, type SocialConfig, type SocialCounts, type SocialEvents, type SocialMe, type SortDir, type StatResult, type Stats, type SubmitScoreOptions, type SubmitScoreResult, type Suggestion, type SuggestionStatus, type SyncConflict, type SyncResult, type TouchMapping, type TradeBundle, type TradeId, type TradeListOptions, type TradeNoteOptions, UI_STACK_VERSION, UNSUPPORTED_BY_HUB, type UiStack, type UiStackHandoff, type User, type Vector, type VirtualControlType, type VirtualDef, type VirtualInputs, type VirtualOverride, boxesTouch, controlSize, createHub, type findRealtimeApi, getDaily, getInput, getUiStack, hub, isDailySystem, isInputSystem, isPageInputControl, type isRealtimeApi, isUiStack, layoutControls, type linkRealtimeToHub, type multiplayerForwarder as mp, type notifyForwarder as notify, parseInputOverrides, type presenceForwarder as presence, type raceForwarder as race, type roomsForwarder as rooms, type socialForwarder as social };
|
|
36
|
+
//# sourceMappingURL=auto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto.d.ts","names":[],"sources":["../src/auto.ts"],"mappings":";;;;;;;;;;;;;iBAciB;;WAEN,KAAK;;WAEL,kBAAkB;;WAElB,YAAY;;WAEZ,iBAAiB;;WAEjB,qBAAqB;;WAErB,6BAA6B;;QAGhC;YACI;;IAER,SAAS"}
|
package/dist/auto.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { a as DailySystem, i as DAILY_START_EVENT, n as getDaily, r as isDailySystem, t as DAILY_SINGLETON_API } from "./shared/daily.js";
|
|
2
|
+
import { t as HUB_CLIENT_VERSION } from "./shared/client-version.gen.js";
|
|
3
|
+
import { a as isPageInputControl, c as layoutControls, i as parseInputOverrides, l as boxesTouch, n as getInput, o as InputSystem, r as isInputSystem, s as Overlay, t as INPUT_SINGLETON_API, u as controlSize } from "./shared/input.js";
|
|
4
|
+
import { n as isUiStack, r as UI_STACK_VERSION, t as getUiStack } from "./shared/page-stack.js";
|
|
5
|
+
import { a as ContentRejectedError, c as UNSUPPORTED_BY_HUB, i as CLIENT_VERSION_HEADER, n as createHub, o as HubError, r as hub, s as OfflineError, t as Hub } from "./shared/src.js";
|
|
6
|
+
//#region src/auto.ts
|
|
7
|
+
/**
|
|
8
|
+
* `@diffenderfer-games/hub/auto`: everything the main entry exports, plus a
|
|
9
|
+
* side effect: it installs `window.HubSDK` (`{ hub, createHub, Hub, HubError,
|
|
10
|
+
* OfflineError, ContentRejectedError }`), exactly as the v1 `/_hub/hub.js`
|
|
11
|
+
* did. The host builds `/_hub/hub.js` from this entry, for games without a
|
|
12
|
+
* build step (`import('/_hub/hub.js')` or `window.HubSDK.hub`).
|
|
13
|
+
*
|
|
14
|
+
* @packageDocumentation
|
|
15
|
+
*/
|
|
16
|
+
if (typeof window !== "undefined") window.HubSDK = {
|
|
17
|
+
hub,
|
|
18
|
+
createHub,
|
|
19
|
+
Hub,
|
|
20
|
+
HubError,
|
|
21
|
+
OfflineError,
|
|
22
|
+
ContentRejectedError
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { CLIENT_VERSION_HEADER, ContentRejectedError, DAILY_SINGLETON_API, DAILY_START_EVENT, DailySystem, HUB_CLIENT_VERSION, Hub, HubError, INPUT_SINGLETON_API, InputSystem, OfflineError, Overlay, UI_STACK_VERSION, UNSUPPORTED_BY_HUB, boxesTouch, controlSize, createHub, getDaily, getInput, getUiStack, hub, isDailySystem, isInputSystem, isPageInputControl, isUiStack, layoutControls, parseInputOverrides };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=auto.js.map
|
package/dist/auto.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto.js","names":[],"sources":["../src/auto.ts"],"mappings":";;;;;;;;;;;;;;;AAoCA,IAAI,OAAO,WAAW,aACpB,OAAO,SAAS;CAAE;CAAK;CAAW;CAAK;CAAU;CAAc;AAAqB"}
|
package/dist/daily.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { _ as DailyStatus, a as isDailySystem, c as DailyAll, d as DailyCompletionMeta, f as DailyDefinition, g as DailyStartResponse, h as DailyHost, i as getDaily, l as DailyChallenge, m as DailyGameStatus, n as DailyCompletions, o as DAILY_START_EVENT, p as DailyEventDetail, r as DAILY_SINGLETON_API, s as DailySystem, t as DailyCompletion, u as DailyCompleteResponse } from "./shared/daily.js";
|
|
2
|
+
export { DAILY_SINGLETON_API, DAILY_START_EVENT, type DailyAll, type DailyChallenge, type DailyCompleteResponse, type DailyCompletion, type DailyCompletionMeta, type DailyCompletions, type DailyDefinition, type DailyEventDetail, type DailyGameStatus, type DailyHost, type DailyStartResponse, type DailyStatus, DailySystem, getDaily, isDailySystem };
|
package/dist/daily.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as DAILY_SINGLETON_API, i as DAILY_START_EVENT, a as DailySystem, n as getDaily, r as isDailySystem } from "./shared/daily.js";
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
4
|
+
import { parseArgs } from "node:util";
|
|
5
|
+
import { GamePackageJson, HubVersion } from "@diffenderfer-games/hub-contract";
|
|
6
|
+
//#region src/core/version/client-version.gen.ts
|
|
7
|
+
/** This client's package version, sent as `x-hub-client` on REST calls and `client` in `hello`. */
|
|
8
|
+
const HUB_CLIENT_VERSION = "2.0.0-next.1";
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/core/version/semver.ts
|
|
11
|
+
const VERSION_PATTERN = /^v?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
12
|
+
/** Parse a version (`2`, `2.1`, `2.1.0`, `2.1.0-next.3`); `undefined` when it is not one. */
|
|
13
|
+
function parseVersion(text) {
|
|
14
|
+
const match = VERSION_PATTERN.exec(text.trim());
|
|
15
|
+
if (match === null) return;
|
|
16
|
+
const [, major = "0", minor = "0", patch = "0", prerelease] = match;
|
|
17
|
+
return {
|
|
18
|
+
release: [
|
|
19
|
+
Number(major),
|
|
20
|
+
Number(minor),
|
|
21
|
+
Number(patch)
|
|
22
|
+
],
|
|
23
|
+
prerelease: prerelease === void 0 ? [] : prerelease.split(".")
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** Compare two prerelease identifiers: numbers by value and before words, words as text. */
|
|
27
|
+
function compareIdentifiers(first, second) {
|
|
28
|
+
const isFirstNumeric = /^\d+$/.test(first);
|
|
29
|
+
const isSecondNumeric = /^\d+$/.test(second);
|
|
30
|
+
if (isFirstNumeric && isSecondNumeric) return Number(first) - Number(second);
|
|
31
|
+
if (isFirstNumeric !== isSecondNumeric) return isFirstNumeric ? -1 : 1;
|
|
32
|
+
return first < second ? -1 : first > second ? 1 : 0;
|
|
33
|
+
}
|
|
34
|
+
/** Negative when `first` is older, positive when newer, 0 when equal. */
|
|
35
|
+
function compareVersions(first, second) {
|
|
36
|
+
for (let i = 0; i < 3; i += 1) {
|
|
37
|
+
const difference = (first.release[i] ?? 0) - (second.release[i] ?? 0);
|
|
38
|
+
if (difference !== 0) return difference;
|
|
39
|
+
}
|
|
40
|
+
if (first.prerelease.length === 0 || second.prerelease.length === 0) return second.prerelease.length - first.prerelease.length;
|
|
41
|
+
const length = Math.max(first.prerelease.length, second.prerelease.length);
|
|
42
|
+
for (let i = 0; i < length; i += 1) {
|
|
43
|
+
const firstIdentifier = first.prerelease[i];
|
|
44
|
+
const secondIdentifier = second.prerelease[i];
|
|
45
|
+
if (firstIdentifier === void 0 || secondIdentifier === void 0) return firstIdentifier === void 0 ? -1 : 1;
|
|
46
|
+
const difference = compareIdentifiers(firstIdentifier, secondIdentifier);
|
|
47
|
+
if (difference !== 0) return difference;
|
|
48
|
+
}
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
const COMPARATOR_PATTERN = /^(>=|<=|>|<|=)?\s*(.+)$/;
|
|
52
|
+
/** Whether `version` meets one comparator (`>=2.0.0`); a malformed comparator never holds. */
|
|
53
|
+
function meetsComparator(version, comparator) {
|
|
54
|
+
const match = COMPARATOR_PATTERN.exec(comparator);
|
|
55
|
+
const bound = match?.[2] === void 0 ? void 0 : parseVersion(match[2]);
|
|
56
|
+
if (match === null || bound === void 0) return false;
|
|
57
|
+
const order = compareVersions(version, bound);
|
|
58
|
+
switch (match[1]) {
|
|
59
|
+
case ">=": return order >= 0;
|
|
60
|
+
case "<=": return order <= 0;
|
|
61
|
+
case ">": return order > 0;
|
|
62
|
+
case "<": return order < 0;
|
|
63
|
+
default: return order === 0;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** Whether `versionText` is in `range`; a malformed version or empty range never is. */
|
|
67
|
+
function satisfiesRange(versionText, range) {
|
|
68
|
+
const version = parseVersion(versionText);
|
|
69
|
+
if (version === void 0) return false;
|
|
70
|
+
return range.split("||").some((alternative) => {
|
|
71
|
+
const comparators = alternative.trim().split(/\s+/).filter((comparator) => comparator !== "");
|
|
72
|
+
return comparators.length > 0 && comparators.every((comparator) => meetsComparator(version, comparator));
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/core/version/hub-version.ts
|
|
77
|
+
/** How `version` fares against a hub's answer (`null`: a hub from before versioning). */
|
|
78
|
+
function clientSupport(hubVersion, version = HUB_CLIENT_VERSION) {
|
|
79
|
+
if (hubVersion === null) return "unknown";
|
|
80
|
+
if (!satisfiesRange(version, hubVersion.supported)) return "unsupported";
|
|
81
|
+
return satisfiesRange(version, hubVersion.deprecated) ? "deprecated" : "supported";
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/doctor/hub-version-fetch.ts
|
|
85
|
+
/**
|
|
86
|
+
* Reading the hub's `GET /_api/version` for `hub-doctor`, with a timeout so a
|
|
87
|
+
* hung or unreachable hub fails a game's CI quickly instead of stalling it.
|
|
88
|
+
*/
|
|
89
|
+
/** How long the doctor waits for the hub by default, ms. */
|
|
90
|
+
const DEFAULT_HUB_TIMEOUT_MS = 1e4;
|
|
91
|
+
/** Whether a version lookup failed. */
|
|
92
|
+
function isHubUnreachable(lookup) {
|
|
93
|
+
return lookup !== null && "unreachableUrl" in lookup;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* The hub's version: `null` for a hub from before versioning (404), a
|
|
97
|
+
* {@link HubUnreachable} when it can't be read within `timeoutMs`.
|
|
98
|
+
*/
|
|
99
|
+
async function fetchHubVersion(hubUrl, timeoutMs = DEFAULT_HUB_TIMEOUT_MS) {
|
|
100
|
+
const url = new URL("/_api/version", hubUrl).toString();
|
|
101
|
+
try {
|
|
102
|
+
const response = await fetch(url, { signal: AbortSignal.timeout(timeoutMs) });
|
|
103
|
+
if (response.status === 404) return null;
|
|
104
|
+
if (!response.ok) return {
|
|
105
|
+
unreachableUrl: url,
|
|
106
|
+
reason: `HTTP ${String(response.status)}`
|
|
107
|
+
};
|
|
108
|
+
return HubVersion.parse(await response.json());
|
|
109
|
+
} catch (failure) {
|
|
110
|
+
return {
|
|
111
|
+
unreachableUrl: url,
|
|
112
|
+
reason: failure instanceof Error && (failure.name === "TimeoutError" || failure.name === "AbortError") ? `timed out after ${String(timeoutMs)} ms` : failure instanceof Error ? failure.message : String(failure)
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/doctor/checks.ts
|
|
118
|
+
/**
|
|
119
|
+
* The checks `hub-doctor` runs on a game (plan §4.3.7). Each returns
|
|
120
|
+
* findings; an `error` finding fails the run (and the game's CI).
|
|
121
|
+
*/
|
|
122
|
+
/** The fix for an old or unsupported client. */
|
|
123
|
+
const UPDATE_FIX = "run `npm update @diffenderfer-games/hub`";
|
|
124
|
+
/**
|
|
125
|
+
* The installed client against the hub's `/_api/version`: outside
|
|
126
|
+
* `supported` is an error, `deprecated` a warning, `null` (a hub from before
|
|
127
|
+
* versioning) is only reported. An unreachable or slow hub is an error, so a
|
|
128
|
+
* game's CI notices (`--offline` skips the check).
|
|
129
|
+
*/
|
|
130
|
+
function checkClientVersion(installedVersion, hubVersion) {
|
|
131
|
+
if (isHubUnreachable(hubVersion)) return [{
|
|
132
|
+
level: "error",
|
|
133
|
+
check: "version",
|
|
134
|
+
message: `hub unreachable at ${hubVersion.unreachableUrl} (${hubVersion.reason}); check --hub, or pass --offline to skip the version check`
|
|
135
|
+
}];
|
|
136
|
+
switch (clientSupport(hubVersion, installedVersion)) {
|
|
137
|
+
case "unsupported": return [{
|
|
138
|
+
level: "error",
|
|
139
|
+
check: "version",
|
|
140
|
+
message: `@diffenderfer-games/hub ${installedVersion} is not supported by the hub (supported: ${hubVersion?.supported ?? "?"}): ${UPDATE_FIX}`
|
|
141
|
+
}];
|
|
142
|
+
case "deprecated": return [{
|
|
143
|
+
level: "warning",
|
|
144
|
+
check: "version",
|
|
145
|
+
message: `@diffenderfer-games/hub ${installedVersion} is deprecated (deprecated: ${hubVersion?.deprecated ?? "?"}): ${UPDATE_FIX}`
|
|
146
|
+
}];
|
|
147
|
+
case "unknown": return [{
|
|
148
|
+
level: "info",
|
|
149
|
+
check: "version",
|
|
150
|
+
message: "the hub predates versioning (no /_api/version); the client version was not checked"
|
|
151
|
+
}];
|
|
152
|
+
case "supported": return [{
|
|
153
|
+
level: "info",
|
|
154
|
+
check: "version",
|
|
155
|
+
message: `@diffenderfer-games/hub ${installedVersion} is supported (hub ${hubVersion?.server ?? "?"})`
|
|
156
|
+
}];
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/** Leftovers of the v1 vendored client, relative to the game's folder. */
|
|
160
|
+
const VENDORED_LEFTOVERS = [
|
|
161
|
+
"src/hub/hub.ts",
|
|
162
|
+
"src/hub/input.ts",
|
|
163
|
+
"client/src/hub/hub.ts",
|
|
164
|
+
"scripts/sync-hub.mjs"
|
|
165
|
+
];
|
|
166
|
+
/** A stale vendored `src/hub/` copy or its sync script (the package replaces both). */
|
|
167
|
+
function checkVendoredCopies(gameDir) {
|
|
168
|
+
return VENDORED_LEFTOVERS.filter((leftover) => existsSync(join(gameDir, leftover))).map((leftover) => ({
|
|
169
|
+
level: "warning",
|
|
170
|
+
check: "vendored",
|
|
171
|
+
message: `${leftover} is a vendored copy of the v1 client: import from '@diffenderfer-games/hub' instead and delete it`
|
|
172
|
+
}));
|
|
173
|
+
}
|
|
174
|
+
/** The `package.json` `game.*` block against the contract's manifest schema. */
|
|
175
|
+
function checkManifest(packageJson) {
|
|
176
|
+
const parsed = GamePackageJson.safeParse(packageJson);
|
|
177
|
+
if (parsed.success) return [{
|
|
178
|
+
level: "info",
|
|
179
|
+
check: "manifest",
|
|
180
|
+
message: `the game.* block is valid (${parsed.data.game.type})`
|
|
181
|
+
}];
|
|
182
|
+
return parsed.error.issues.map((issue) => ({
|
|
183
|
+
level: "error",
|
|
184
|
+
check: "manifest",
|
|
185
|
+
message: `${issue.path.length === 0 ? "(package.json)" : issue.path.join(".")}: ${issue.message}`
|
|
186
|
+
}));
|
|
187
|
+
}
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/doctor/cli.ts
|
|
190
|
+
/**
|
|
191
|
+
* `hub-doctor`: checks a game against the hub (plan §4.3.7). Run it in a
|
|
192
|
+
* game's folder, in CI and before pushing:
|
|
193
|
+
*
|
|
194
|
+
* ```sh
|
|
195
|
+
* npx hub-doctor [--dir <game folder>] [--hub <url>] [--timeout <ms>] [--offline] [--json]
|
|
196
|
+
* ```
|
|
197
|
+
*
|
|
198
|
+
* - the installed `@diffenderfer-games/hub` against the hub's
|
|
199
|
+
* `/_api/version` (`--hub`, default `https://diffenderfer.games`): outside
|
|
200
|
+
* `supported` fails, `deprecated` warns (`--offline` skips this check);
|
|
201
|
+
* - a stale vendored `src/hub/` copy or `scripts/sync-hub.mjs` warns;
|
|
202
|
+
* - the `package.json` `game.*` block must match the contract's schema.
|
|
203
|
+
*
|
|
204
|
+
* Exits 1 when any check fails.
|
|
205
|
+
*/
|
|
206
|
+
const DEFAULT_HUB_URL = "https://diffenderfer.games";
|
|
207
|
+
function readOptions() {
|
|
208
|
+
const { values } = parseArgs({ options: {
|
|
209
|
+
dir: { type: "string" },
|
|
210
|
+
hub: { type: "string" },
|
|
211
|
+
timeout: { type: "string" },
|
|
212
|
+
offline: {
|
|
213
|
+
type: "boolean",
|
|
214
|
+
default: false
|
|
215
|
+
},
|
|
216
|
+
json: {
|
|
217
|
+
type: "boolean",
|
|
218
|
+
default: false
|
|
219
|
+
}
|
|
220
|
+
} });
|
|
221
|
+
const timeoutMs = values.timeout === void 0 ? DEFAULT_HUB_TIMEOUT_MS : Number(values.timeout);
|
|
222
|
+
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
|
|
223
|
+
process.stderr.write("hub-doctor: --timeout must be a positive number of milliseconds\n");
|
|
224
|
+
process.exit(2);
|
|
225
|
+
}
|
|
226
|
+
return {
|
|
227
|
+
gameDir: resolve(values.dir ?? "."),
|
|
228
|
+
hubUrl: values.hub ?? DEFAULT_HUB_URL,
|
|
229
|
+
timeoutMs,
|
|
230
|
+
isOffline: values.offline,
|
|
231
|
+
isJson: values.json
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
function readJsonFile(path) {
|
|
235
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
236
|
+
}
|
|
237
|
+
/** The client version the game has installed (its `node_modules` copy), else this doctor's own. */
|
|
238
|
+
function installedClientVersion(gameDir) {
|
|
239
|
+
try {
|
|
240
|
+
const installed = readJsonFile(join(gameDir, "node_modules", "@diffenderfer-games", "hub", "package.json"));
|
|
241
|
+
if (typeof installed === "object" && installed !== null && "version" in installed && typeof installed.version === "string") return installed.version;
|
|
242
|
+
} catch {}
|
|
243
|
+
return HUB_CLIENT_VERSION;
|
|
244
|
+
}
|
|
245
|
+
async function runDoctor(options) {
|
|
246
|
+
const findings = [];
|
|
247
|
+
if (!options.isOffline) findings.push(...checkClientVersion(installedClientVersion(options.gameDir), await fetchHubVersion(options.hubUrl, options.timeoutMs)));
|
|
248
|
+
findings.push(...checkVendoredCopies(options.gameDir));
|
|
249
|
+
try {
|
|
250
|
+
findings.push(...checkManifest(readJsonFile(join(options.gameDir, "package.json"))));
|
|
251
|
+
} catch (failure) {
|
|
252
|
+
findings.push({
|
|
253
|
+
level: "error",
|
|
254
|
+
check: "manifest",
|
|
255
|
+
message: `could not read package.json: ${failure instanceof Error ? failure.message : String(failure)}`
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
return findings;
|
|
259
|
+
}
|
|
260
|
+
const options = readOptions();
|
|
261
|
+
const findings = await runDoctor(options);
|
|
262
|
+
if (options.isJson) process.stdout.write(`${JSON.stringify({ findings }, null, 2)}\n`);
|
|
263
|
+
else for (const finding of findings) process.stdout.write(`${finding.level.padEnd(7)} ${finding.check}: ${finding.message}\n`);
|
|
264
|
+
process.exitCode = findings.some((finding) => finding.level === "error") ? 1 : 0;
|
|
265
|
+
//#endregion
|
|
266
|
+
export {};
|
|
267
|
+
|
|
268
|
+
//# sourceMappingURL=cli.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.mjs","names":[],"sources":["../../src/core/version/client-version.gen.ts","../../src/core/version/semver.ts","../../src/core/version/hub-version.ts","../../src/doctor/hub-version-fetch.ts","../../src/doctor/checks.ts","../../src/doctor/cli.ts"],"mappings":";;;;;;;AAEA,MAAa,qBAAqB;;;ACclC,MAAM,kBAAkB;;AAGxB,SAAgB,aAAa,MAAyC;CACpE,MAAM,QAAQ,gBAAgB,KAAK,KAAK,KAAK,CAAC;CAC9C,IAAI,UAAU,MACZ;CAEF,MAAM,GAAG,QAAQ,KAAK,QAAQ,KAAK,QAAQ,KAAK,cAAc;CAC9D,OAAO;EAAE,SAAS;GAAC,OAAO,KAAK;GAAG,OAAO,KAAK;GAAG,OAAO,KAAK;EAAC;EAAG,YAAY,eAAe,KAAA,IAAY,CAAC,IAAI,WAAW,MAAM,GAAG;CAAE;AACrI;;AAGA,SAAS,mBAAmB,OAAe,QAAwB;CACjE,MAAM,iBAAiB,QAA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AAO,GAAG,MAAM,gBAAgB,QAAQ,QAAQ,QAAQ,SAAS,CAAC,CAAC;CAExI,SAAS,KAAK,GAAG,oBAAoB,QAAQ,OAAO,CAAC;CACrD,IAAI;EACF,SAAS,KAAK,GAAG,cAAc,aAAa,KAAK,QAAQ,SAAS,cAAc,CAAC,CAAC,CAAC;CACrF,SAAS,SAAS;EAChB,SAAS,KAAK;GAAE,OAAO;GAAS,OAAO;GAAY,SAAS,gCAAgC,mBAAmB,QAAQ,QAAQ,UAAU,OAAO,OAAO;EAAI,CAAC;CAC9J;CACA,OAAO;AACT;AAEA,MAAM,UAAU,YAAY;AAC5B,MAAM,WAAW,MAAM,UAAU,OAAO;AACxC,IAAI,QAAQ,QACV,QAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,EAAE,SAAS,GAAG,MAAM,CAAC,EAAE,GAAG;KAEjE,KAAK,MAAM,WAAW,UACpB,QAAQ,OAAO,MAAM,GAAG,QAAQ,MAAM,OAAO,CAAC,EAAE,GAAG,QAAQ,MAAM,IAAI,QAAQ,QAAQ,GAAG;AAG5F,QAAQ,WAAW,SAAS,MAAM,YAAY,QAAQ,UAAU,OAAO,IAAI,IAAI"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { a as RaceResultPlayer, c as RoomChatLine, d as RoomStateChange, f as SchemaOutput, i as RaceRecordPlayer, l as RoomMessage, m as Snapshot, n as Notice, o as RaceStatusEvent, p as ServerEvents, r as RaceHistory, s as RealtimeErrorShape, t as InviteCreated, u as RoomSeat } from "./shared/wire-types.js";
|
|
2
|
+
import { _ as DailyStatus, a as isDailySystem, c as DailyAll, d as DailyCompletionMeta, f as DailyDefinition, g as DailyStartResponse, h as DailyHost, i as getDaily, l as DailyChallenge, m as DailyGameStatus, n as DailyCompletions, o as DAILY_START_EVENT, p as DailyEventDetail, r as DAILY_SINGLETON_API, s as DailySystem, t as DailyCompletion, u as DailyCompleteResponse } from "./shared/daily.js";
|
|
3
|
+
import { $ as VirtualControlType, A as AxisSide, B as InputReading, C as parseInputOverrides, D as isPageInputControl, E as PageInputControl, F as InputConfig, G as NavElement, H as MenuBridge, I as InputDef, J as NavTarget, K as NavElementKind, L as InputEvents, M as EdgeOffsets, N as GamepadMapping, O as Anchor, P as GroupDef, Q as Vector, R as InputHost, S as isInputSystem, T as InputSystemOptions, U as MouseMapping, V as InputSource, W as NavBlurEvent, X as Rect, Y as NavigableDef, Z as TouchMapping, _ as boxesTouch, a as OverlayEdge, b as InputOptions, c as OverlayReason, d as LayoutOptions, et as VirtualDef, f as layoutControls, g as LayoutItem, h as LayoutBox, i as AutoPauseOptions, j as DraggedSpot, k as AxisDef, l as UiStack, m as Insets, n as getUiStack, nt as VirtualOverride, o as OverlayEvent, p as Overlay, q as NavFocusEvent, r as isUiStack, s as OverlayListener, t as UI_STACK_VERSION, tt as VirtualInputs, u as UiStackHandoff, v as controlSize, w as InputSystem, x as getInput, y as INPUT_SINGLETON_API, z as InputOverrides } from "./shared/input.js";
|
|
4
|
+
import { a as JoinInfoEvent, i as InviteResult, n as HubMpApi, r as InviteOptions, t as BusyOptions } from "./shared/multiplayer-types.js";
|
|
5
|
+
import { o as multiplayerForwarder } from "./shared/mp.js";
|
|
6
|
+
import { a as RoomEvents, c as RoomSendOptions, i as RoomCreateOptions, l as RoomState, n as HubRoomsApi, o as RoomListOptions, r as JoinOptions, s as RoomSelf, t as HubRoom, u as RoomStateOptions } from "./shared/room-types.js";
|
|
7
|
+
import { a as RaceHistoryQuery, c as RaceRuntimeApi, i as RaceEvents, l as RaceStart, n as RaceCreateOptions, o as RaceHistoryViewOptions, r as RaceDefinition, s as RaceHudPlace, t as HubRaceApi } from "./shared/race-types.js";
|
|
8
|
+
import { f as raceForwarder } from "./shared/race.js";
|
|
9
|
+
import { n as roomsForwarder } from "./shared/rooms.js";
|
|
10
|
+
import { $ as HubNotifyApi, A as RacerState, B as SuggestionStatus, C as RaceRecord, D as RaceStats, E as RaceState, F as ReportReason, G as REALTIME_READY_EVENT, H as isRealtimeApi, I as RoomInfo, J as RealtimeHubLink, K as REALTIME_SINGLETON_API, L as SocialConfig, M as Relation, N as ReportInput, O as Racer, P as ReportKind, Q as socialForwarder, R as SocialMe, S as RaceParams, T as RaceStatValue, U as REALTIME_FAILED_EVENT, V as findRealtimeApi, W as REALTIME_FEATURE_VERSION, X as notifyForwarder, Y as linkRealtimeToHub, Z as presenceForwarder, _ as PlayerLite, a as ErrorBody, at as SocialEvents, b as PresenceKind, c as JoinInfo, d as Message, et as HubPresenceApi, f as MessagesPage, g as PlayerCard, h as Party, i as Counts, it as SocialCounts, j as RecentPlayer, k as RacerResult, l as Launch, m as NotifyPrefs, n as ChatMode, nt as OpenInviteOptions, o as FriendEntry, p as NotifyChange, q as RealtimeApi, r as Conversation, rt as PlayerRef, s as Invite, t as Audience, tt as HubSocialApi, u as LaunchTicket, v as Presence, w as RaceResult, x as RaceOutcome, y as PresenceInput, z as Suggestion } from "./shared/social.js";
|
|
11
|
+
import { $ as SubmitScoreResult, A as BoardWithTop, B as Json, C as CLIENT_VERSION_HEADER, D as QueuedScoreOptions, E as QueueOpInput, F as GlobalAnalytics, G as Profile, H as LeaderboardResult, I as HubOptions, J as SaveMeta, K as ProfileSummary, L as HubStatus, M as GameInfo, N as GameLeaderboards, O as BufferedEvent, P as GameRecords, Q as SubmitScoreOptions, R as Inventory, S as SyncResult, T as QueueOp, U as MeResponse, V as LeaderboardEntry, W as Metrics, X as SortDir, Y as SnapshotResponse, Z as Stats, _ as TradeNoteOptions, a as HubErrorDetails, b as StatResult, c as Hub, d as ClientSupport, et as User, f as HubMenuControl, g as TradeListOptions, h as TradeId, i as HubErrorCode, it as GamePayload, j as GameAnalytics, k as Board, l as createHub, m as TradeBundle, n as ContentRejectedError, nt as EndpointName, o as OfflineError, p as GrantBundle, q as Save, r as HubError, rt as EndpointReply, s as UNSUPPORTED_BY_HUB, t as HUB_CLIENT_VERSION, tt as EndpointFields, u as hub, v as AuthResponse, w as ProfilePatch, x as SyncConflict, y as ProfileUpdate, z as InventorySnapshot } from "./shared/index.js";
|
|
12
|
+
export { type Anchor, type Audience, type AuthResponse, type AutoPauseOptions, type AxisDef, type AxisSide, type Board, type BoardWithTop, type BufferedEvent, type BusyOptions, CLIENT_VERSION_HEADER, type ChatMode, type ClientSupport, ContentRejectedError, type Conversation, type Counts, DAILY_SINGLETON_API, DAILY_START_EVENT, type DailyAll, type DailyChallenge, type DailyCompleteResponse, type DailyCompletion, type DailyCompletionMeta, type DailyCompletions, type DailyDefinition, type DailyEventDetail, type DailyGameStatus, type DailyHost, type DailyStartResponse, type DailyStatus, DailySystem, type DraggedSpot, type EdgeOffsets, type EndpointFields, type EndpointName, type EndpointReply, type ErrorBody, type FriendEntry, type GameAnalytics, type GameInfo, type GameLeaderboards, type GamePayload, type GameRecords, type GamepadMapping, type GlobalAnalytics, type GrantBundle, type GroupDef, HUB_CLIENT_VERSION, Hub, HubError, type HubErrorCode, type HubErrorDetails, type HubMenuControl, type HubMpApi, type HubNotifyApi, type HubOptions, type HubPresenceApi, type HubRaceApi, type HubRoom, type HubRoomsApi, type HubSocialApi, type HubStatus, INPUT_SINGLETON_API, type InputConfig, type InputDef, type InputEvents, type InputHost, type InputOptions, type InputOverrides, type InputReading, type InputSource, InputSystem, type InputSystemOptions, type Insets, type Inventory, type InventorySnapshot, type Invite, type InviteCreated, type InviteOptions, type InviteResult, type JoinInfo, type JoinInfoEvent, type JoinOptions, type Json, type Launch, type LaunchTicket, type LayoutBox, type LayoutItem, type LayoutOptions, type LeaderboardEntry, type LeaderboardResult, type MeResponse, type MenuBridge, type Message, type MessagesPage, type Metrics, type MouseMapping, type NavBlurEvent, type NavElement, type NavElementKind, type NavFocusEvent, type NavTarget, type NavigableDef, type Notice, type NotifyChange, type NotifyPrefs, OfflineError, type OpenInviteOptions, Overlay, type OverlayEdge, type OverlayEvent, type OverlayListener, type OverlayReason, type PageInputControl, type Party, type PlayerCard, type PlayerLite, type PlayerRef, type Presence, type PresenceInput, type PresenceKind, type Profile, type ProfilePatch, type ProfileSummary, type ProfileUpdate, type QueueOp, type QueueOpInput, type QueuedScoreOptions, type REALTIME_FAILED_EVENT, type REALTIME_FEATURE_VERSION, type REALTIME_READY_EVENT, type REALTIME_SINGLETON_API, type RaceCreateOptions, type RaceDefinition, type RaceEvents, type RaceHistory, type RaceHistoryQuery, type RaceHistoryViewOptions, type RaceHudPlace, type RaceOutcome, type RaceParams, type RaceRecord, type RaceRecordPlayer, type RaceResult, type RaceResultPlayer, type RaceRuntimeApi, type RaceStart, type RaceStatValue, type RaceState, type RaceStats, type RaceStatusEvent, type Racer, type RacerResult, type RacerState, type RealtimeApi, type RealtimeErrorShape, type RealtimeHubLink, type RecentPlayer, type Rect, type Relation, type ReportInput, type ReportKind, type ReportReason, type RoomChatLine, type RoomCreateOptions, type RoomEvents, type RoomInfo, type RoomListOptions, type RoomMessage, type RoomSeat, type RoomSelf, type RoomSendOptions, type RoomState, type RoomStateChange, type RoomStateOptions, type Save, type SaveMeta, type SchemaOutput, type ServerEvents, type Snapshot, type SnapshotResponse, type SocialConfig, type SocialCounts, type SocialEvents, type SocialMe, type SortDir, type StatResult, type Stats, type SubmitScoreOptions, type SubmitScoreResult, type Suggestion, type SuggestionStatus, type SyncConflict, type SyncResult, type TouchMapping, type TradeBundle, type TradeId, type TradeListOptions, type TradeNoteOptions, UI_STACK_VERSION, UNSUPPORTED_BY_HUB, type UiStack, type UiStackHandoff, type User, type Vector, type VirtualControlType, type VirtualDef, type VirtualInputs, type VirtualOverride, boxesTouch, controlSize, createHub, type findRealtimeApi, getDaily, getInput, getUiStack, hub, isDailySystem, isInputSystem, isPageInputControl, type isRealtimeApi, isUiStack, layoutControls, type linkRealtimeToHub, type multiplayerForwarder as mp, type notifyForwarder as notify, parseInputOverrides, type presenceForwarder as presence, type raceForwarder as race, type roomsForwarder as rooms, type socialForwarder as social };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { a as DailySystem, i as DAILY_START_EVENT, n as getDaily, r as isDailySystem, t as DAILY_SINGLETON_API } from "./shared/daily.js";
|
|
2
|
+
import { t as HUB_CLIENT_VERSION } from "./shared/client-version.gen.js";
|
|
3
|
+
import { a as isPageInputControl, c as layoutControls, i as parseInputOverrides, l as boxesTouch, n as getInput, o as InputSystem, r as isInputSystem, s as Overlay, t as INPUT_SINGLETON_API, u as controlSize } from "./shared/input.js";
|
|
4
|
+
import { n as isUiStack, r as UI_STACK_VERSION, t as getUiStack } from "./shared/page-stack.js";
|
|
5
|
+
import { a as ContentRejectedError, c as UNSUPPORTED_BY_HUB, i as CLIENT_VERSION_HEADER, n as createHub, o as HubError, r as hub, s as OfflineError, t as Hub } from "./shared/src.js";
|
|
6
|
+
export { CLIENT_VERSION_HEADER, ContentRejectedError, DAILY_SINGLETON_API, DAILY_START_EVENT, DailySystem, HUB_CLIENT_VERSION, Hub, HubError, INPUT_SINGLETON_API, InputSystem, OfflineError, Overlay, UI_STACK_VERSION, UNSUPPORTED_BY_HUB, boxesTouch, controlSize, createHub, getDaily, getInput, getUiStack, hub, isDailySystem, isInputSystem, isPageInputControl, isUiStack, layoutControls, parseInputOverrides };
|
package/dist/input.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { $ as VirtualControlType, A as AxisSide, B as InputReading, C as parseInputOverrides, D as isPageInputControl, E as PageInputControl, F as InputConfig, G as NavElement, H as MenuBridge, I as InputDef, J as NavTarget, K as NavElementKind, L as InputEvents, M as EdgeOffsets, N as GamepadMapping, O as Anchor, P as GroupDef, Q as Vector, R as InputHost, S as isInputSystem, T as InputSystemOptions, U as MouseMapping, V as InputSource, W as NavBlurEvent, X as Rect, Y as NavigableDef, Z as TouchMapping, _ as boxesTouch, a as OverlayEdge, b as InputOptions, c as OverlayReason, d as LayoutOptions, et as VirtualDef, f as layoutControls, g as LayoutItem, h as LayoutBox, i as AutoPauseOptions, j as DraggedSpot, k as AxisDef, l as UiStack, m as Insets, n as getUiStack, nt as VirtualOverride, o as OverlayEvent, p as Overlay, q as NavFocusEvent, r as isUiStack, s as OverlayListener, t as UI_STACK_VERSION, tt as VirtualInputs, u as UiStackHandoff, v as controlSize, w as InputSystem, x as getInput, y as INPUT_SINGLETON_API, z as InputOverrides } from "./shared/input.js";
|
|
2
|
+
export { type Anchor, type AutoPauseOptions, type AxisDef, type AxisSide, type DraggedSpot, type EdgeOffsets, type GamepadMapping, type GroupDef, INPUT_SINGLETON_API, type InputConfig, type InputDef, type InputEvents, type InputHost, type InputOptions, type InputOverrides, type InputReading, type InputSource, InputSystem, type InputSystemOptions, type Insets, type LayoutBox, type LayoutItem, type LayoutOptions, type MenuBridge, type MouseMapping, type NavBlurEvent, type NavElement, type NavElementKind, type NavFocusEvent, type NavTarget, type NavigableDef, Overlay, type OverlayEdge, type OverlayEvent, type OverlayListener, type OverlayReason, type PageInputControl, type Rect, type TouchMapping, UI_STACK_VERSION, type UiStack, type UiStackHandoff, type Vector, type VirtualControlType, type VirtualDef, type VirtualInputs, type VirtualOverride, boxesTouch, controlSize, getInput, getUiStack, isInputSystem, isPageInputControl, isUiStack, layoutControls, parseInputOverrides };
|