@funforge/game-sdk 0.0.0-stage → 0.1.0-alpha.2
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 +12 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/multiplayer/index.d.ts +76 -0
- package/dist/multiplayer/index.js +300 -0
- package/package.json +41 -4
package/README.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @funforge/game-sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Multiplayer SDK for FunForge games. Import `@funforge/game-sdk/multiplayer` for
|
|
4
|
+
the WebRTC transport with room tickets and host-authoritative state.
|
|
5
|
+
|
|
6
|
+
- `MultiplayerTransport`: join via a platform-minted room ticket, send inputs,
|
|
7
|
+
receive host state, diagnostics for RTT and the selected ICE path. The host can
|
|
8
|
+
send a bounded checkpoint via `syncSnapshot` for recovery after host migration.
|
|
9
|
+
- Games run unchanged in the workbench (the platform bridges the transport via
|
|
10
|
+
MessagePort) and on standalone static pages (the SDK connects directly).
|
|
11
|
+
|
|
12
|
+
See the repository plan `docs/superpowers/plans/2026-11-29-funforge-multiplayer.md`
|
|
13
|
+
for the protocol and phases. Pre-release; the API may change before 1.0.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './multiplayer/index.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './multiplayer/index.js';
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core multiplayer transport for the FunForge game SDK: room signaling over
|
|
3
|
+
* WebSocket, WebRTC data channels for game traffic, host-authoritative state.
|
|
4
|
+
* The workbench bridge runs this in the trusted parent context; standalone
|
|
5
|
+
* game pages run it directly (Phase 108).
|
|
6
|
+
*/
|
|
7
|
+
export type MultiplayerRole = 'host' | 'guest';
|
|
8
|
+
export type MultiplayerEvents = {
|
|
9
|
+
onRole?: (role: MultiplayerRole) => void;
|
|
10
|
+
onReady?: () => void;
|
|
11
|
+
onPeerLeft?: (leftRole?: 'host' | 'guest') => void;
|
|
12
|
+
/** Our own connection is gone after exhausting reconnect attempts. */
|
|
13
|
+
onDisconnected?: () => void;
|
|
14
|
+
onInput?: (input: Record<string, unknown>) => void;
|
|
15
|
+
onState?: (state: Record<string, unknown>) => void;
|
|
16
|
+
/** The host seat migrated to this member with the recovered snapshot. */
|
|
17
|
+
onMigrated?: (info: {
|
|
18
|
+
epoch: number;
|
|
19
|
+
snapshot?: unknown;
|
|
20
|
+
}) => void;
|
|
21
|
+
onError?: (message: string) => void;
|
|
22
|
+
};
|
|
23
|
+
export type MultiplayerJoinOptions = {
|
|
24
|
+
/** Absolute or same-origin path of the signaling endpoint. */
|
|
25
|
+
signalUrl: string;
|
|
26
|
+
/** Short-lived room ticket minted by the platform; kept in memory only. */
|
|
27
|
+
ticket: string;
|
|
28
|
+
events: MultiplayerEvents;
|
|
29
|
+
iceServers?: RTCIceServer[];
|
|
30
|
+
};
|
|
31
|
+
/** Host-authoritative transport for one room seat. */
|
|
32
|
+
export declare class MultiplayerTransport {
|
|
33
|
+
/** Handlers are mutable so hosts of the transport can attach them after construction. */
|
|
34
|
+
readonly events: MultiplayerEvents;
|
|
35
|
+
private socket;
|
|
36
|
+
private pc;
|
|
37
|
+
private readonly channels;
|
|
38
|
+
private negotiation;
|
|
39
|
+
private queuedCandidates;
|
|
40
|
+
private role;
|
|
41
|
+
private inputSeq;
|
|
42
|
+
/** Dedup streams: own inputs use the local counter, relayed ones use the game's player sequence. */
|
|
43
|
+
private memberId;
|
|
44
|
+
private epoch;
|
|
45
|
+
private seenInputs;
|
|
46
|
+
private closedByUs;
|
|
47
|
+
private reconnectsLeft;
|
|
48
|
+
private reconnectTimer?;
|
|
49
|
+
constructor(options: MultiplayerJoinOptions);
|
|
50
|
+
private options;
|
|
51
|
+
private dial;
|
|
52
|
+
private resetPeer;
|
|
53
|
+
private closePeer;
|
|
54
|
+
/** Leaves the room and stops reconnect attempts. */
|
|
55
|
+
leave(): void;
|
|
56
|
+
get currentRole(): MultiplayerRole | undefined;
|
|
57
|
+
/** Marks a relayed input as seen; returns false for replays and stale duplicates. */
|
|
58
|
+
private claimInput;
|
|
59
|
+
private handleSignal;
|
|
60
|
+
private attach;
|
|
61
|
+
/**
|
|
62
|
+
* Sends one discrete input. Per the protocol the game owns the player
|
|
63
|
+
* sequence: resending the same input is deduplicated by the host. The host's
|
|
64
|
+
* own inputs echo back through onInput with the local stream's sequence.
|
|
65
|
+
*/
|
|
66
|
+
sendInput(input: Record<string, unknown>): boolean;
|
|
67
|
+
/** Publishes authoritative state stamped with the current epoch; guests cannot publish. */
|
|
68
|
+
publishState(state: Record<string, unknown>): boolean;
|
|
69
|
+
/** Host checkpoint for host-migration recovery; sent over signaling, size-capped. */
|
|
70
|
+
syncSnapshot(state: Record<string, unknown>): boolean;
|
|
71
|
+
get currentEpoch(): number;
|
|
72
|
+
/** Reports the current round-trip time in milliseconds when available. */
|
|
73
|
+
rttMs(): Promise<number | undefined>;
|
|
74
|
+
/** Reports the selected candidate type for diagnostics (host | relay | …). */
|
|
75
|
+
selectedCandidateType(): Promise<string | undefined>;
|
|
76
|
+
}
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core multiplayer transport for the FunForge game SDK: room signaling over
|
|
3
|
+
* WebSocket, WebRTC data channels for game traffic, host-authoritative state.
|
|
4
|
+
* The workbench bridge runs this in the trusted parent context; standalone
|
|
5
|
+
* game pages run it directly (Phase 108).
|
|
6
|
+
*/
|
|
7
|
+
const INPUT_CHANNEL = 'input';
|
|
8
|
+
const CONTROL_CHANNEL = 'control';
|
|
9
|
+
const MAX_SIGNAL_FRAME_BYTES = 16 * 1024;
|
|
10
|
+
const MAX_SNAPSHOT_BYTES = 15 * 1024;
|
|
11
|
+
/** Host-authoritative transport for one room seat. */
|
|
12
|
+
export class MultiplayerTransport {
|
|
13
|
+
constructor(options) {
|
|
14
|
+
this.channels = new Map();
|
|
15
|
+
this.negotiation = Promise.resolve();
|
|
16
|
+
this.queuedCandidates = [];
|
|
17
|
+
this.inputSeq = 0;
|
|
18
|
+
this.epoch = 0;
|
|
19
|
+
this.seenInputs = new Set();
|
|
20
|
+
this.closedByUs = false;
|
|
21
|
+
this.reconnectsLeft = 10;
|
|
22
|
+
this.events = options.events;
|
|
23
|
+
// Relative endpoints resolve against the current origin, then switch to ws(s)://.
|
|
24
|
+
this.options = options;
|
|
25
|
+
this.dial();
|
|
26
|
+
}
|
|
27
|
+
dial() {
|
|
28
|
+
if (this.closedByUs)
|
|
29
|
+
return;
|
|
30
|
+
const options = this.options;
|
|
31
|
+
const resolved = new URL(options.signalUrl, window.location.origin);
|
|
32
|
+
const socket = new WebSocket(resolved.toString().replace(/^http/, 'ws'));
|
|
33
|
+
this.socket = socket;
|
|
34
|
+
this.negotiation = Promise.resolve();
|
|
35
|
+
this.resetPeer();
|
|
36
|
+
socket.onopen = () => {
|
|
37
|
+
if (!this.closedByUs && this.socket === socket)
|
|
38
|
+
socket.send(JSON.stringify({ type: 'auth', candidate: options.ticket }));
|
|
39
|
+
};
|
|
40
|
+
socket.onmessage = ({ data }) => {
|
|
41
|
+
if (this.closedByUs || this.socket !== socket)
|
|
42
|
+
return;
|
|
43
|
+
try {
|
|
44
|
+
this.handleSignal(JSON.parse(String(data)), socket);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
this.events.onError?.(error instanceof Error ? error.message : 'Signaling failed');
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
socket.onclose = () => {
|
|
51
|
+
if (this.closedByUs || this.socket !== socket)
|
|
52
|
+
return;
|
|
53
|
+
this.closePeer();
|
|
54
|
+
if (this.reconnectsLeft > 0) {
|
|
55
|
+
this.reconnectsLeft -= 1;
|
|
56
|
+
this.reconnectTimer = setTimeout(() => {
|
|
57
|
+
this.reconnectTimer = undefined;
|
|
58
|
+
this.dial();
|
|
59
|
+
}, 2000);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
this.events.onDisconnected?.();
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
resetPeer() {
|
|
66
|
+
this.closePeer();
|
|
67
|
+
const pc = new RTCPeerConnection({ iceServers: this.options.iceServers ?? [] });
|
|
68
|
+
const socket = this.socket;
|
|
69
|
+
this.pc = pc;
|
|
70
|
+
pc.onicecandidate = ({ candidate }) => {
|
|
71
|
+
if (candidate && !this.closedByUs && this.pc === pc && socket.readyState === WebSocket.OPEN) {
|
|
72
|
+
socket.send(JSON.stringify({ type: 'ice', candidate }));
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
pc.ondatachannel = ({ channel }) => {
|
|
76
|
+
if (!this.closedByUs && this.pc === pc)
|
|
77
|
+
this.attach(channel);
|
|
78
|
+
else
|
|
79
|
+
channel.close();
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
closePeer() {
|
|
83
|
+
const channels = [...this.channels.values()];
|
|
84
|
+
this.channels.clear();
|
|
85
|
+
for (const channel of channels)
|
|
86
|
+
channel.close();
|
|
87
|
+
this.queuedCandidates = [];
|
|
88
|
+
this.pc?.close();
|
|
89
|
+
}
|
|
90
|
+
/** Leaves the room and stops reconnect attempts. */
|
|
91
|
+
leave() {
|
|
92
|
+
if (this.closedByUs)
|
|
93
|
+
return;
|
|
94
|
+
this.closedByUs = true;
|
|
95
|
+
if (this.reconnectTimer !== undefined)
|
|
96
|
+
clearTimeout(this.reconnectTimer);
|
|
97
|
+
this.reconnectTimer = undefined;
|
|
98
|
+
this.closePeer();
|
|
99
|
+
this.socket.close();
|
|
100
|
+
}
|
|
101
|
+
get currentRole() {
|
|
102
|
+
return this.role;
|
|
103
|
+
}
|
|
104
|
+
/** Marks a relayed input as seen; returns false for replays and stale duplicates. */
|
|
105
|
+
claimInput(message) {
|
|
106
|
+
const key = `${String(message.from ?? 'remote')}:${String(message.seq)}`;
|
|
107
|
+
if (this.seenInputs.has(key))
|
|
108
|
+
return false;
|
|
109
|
+
this.seenInputs.add(key);
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
handleSignal(message, socket) {
|
|
113
|
+
this.negotiation = this.negotiation.then(async () => {
|
|
114
|
+
if (this.closedByUs || this.socket !== socket)
|
|
115
|
+
return;
|
|
116
|
+
if (message.type === 'role') {
|
|
117
|
+
this.role = message.host === true ? 'host' : 'guest';
|
|
118
|
+
this.memberId = typeof message.memberId === 'string' ? message.memberId : undefined;
|
|
119
|
+
if (typeof message.epoch === 'number')
|
|
120
|
+
this.epoch = Math.max(this.epoch, message.epoch);
|
|
121
|
+
this.reconnectsLeft = 10;
|
|
122
|
+
this.events.onRole?.(this.role);
|
|
123
|
+
}
|
|
124
|
+
if (message.type === 'ready')
|
|
125
|
+
this.events.onReady?.();
|
|
126
|
+
if (message.type === 'peer-left') {
|
|
127
|
+
const leftRole = typeof message.role === 'string' && message.role !== '' ? message.role : undefined;
|
|
128
|
+
this.resetPeer();
|
|
129
|
+
this.events.onPeerLeft?.(leftRole);
|
|
130
|
+
}
|
|
131
|
+
if (message.type === 'host-migrated') {
|
|
132
|
+
// The departed host's seat is gone: this member now owns the authority at the new epoch.
|
|
133
|
+
this.role = 'host';
|
|
134
|
+
this.epoch = typeof message.epoch === 'number' ? message.epoch : this.epoch + 1;
|
|
135
|
+
this.memberId = typeof message.memberId === 'string' ? message.memberId : this.memberId;
|
|
136
|
+
const snapshot = decodeSnapshot(message.snapshot);
|
|
137
|
+
this.events.onRole?.('host');
|
|
138
|
+
if (snapshot)
|
|
139
|
+
this.events.onState?.({ ...snapshot, epoch: this.epoch });
|
|
140
|
+
this.events.onMigrated?.({ epoch: this.epoch, snapshot });
|
|
141
|
+
}
|
|
142
|
+
if (message.type === 'state-sync') {
|
|
143
|
+
const snapshot = decodeSnapshot(message.snapshot);
|
|
144
|
+
if (snapshot)
|
|
145
|
+
this.events.onState?.({ ...snapshot, epoch: this.epoch });
|
|
146
|
+
}
|
|
147
|
+
const pc = this.pc;
|
|
148
|
+
const reply = (data) => {
|
|
149
|
+
if (!this.closedByUs && this.socket === socket && this.pc === pc && socket.readyState === WebSocket.OPEN) {
|
|
150
|
+
socket.send(JSON.stringify(data));
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
if (message.type === 'offer-needed') {
|
|
154
|
+
this.attach(pc.createDataChannel(CONTROL_CHANNEL));
|
|
155
|
+
this.attach(pc.createDataChannel(INPUT_CHANNEL, { ordered: false, maxRetransmits: 0 }));
|
|
156
|
+
await pc.setLocalDescription(await pc.createOffer());
|
|
157
|
+
reply({ type: 'description', description: pc.localDescription });
|
|
158
|
+
}
|
|
159
|
+
if (message.type === 'ice' && typeof message.candidate === 'object' && message.candidate !== null) {
|
|
160
|
+
const candidate = message.candidate;
|
|
161
|
+
if (pc.remoteDescription)
|
|
162
|
+
await pc.addIceCandidate(candidate);
|
|
163
|
+
else
|
|
164
|
+
this.queuedCandidates.push(candidate);
|
|
165
|
+
}
|
|
166
|
+
if (message.type === 'description' && typeof message.description === 'object' && message.description !== null) {
|
|
167
|
+
await pc.setRemoteDescription(message.description);
|
|
168
|
+
for (const candidate of this.queuedCandidates.splice(0))
|
|
169
|
+
await pc.addIceCandidate(candidate);
|
|
170
|
+
if (message.description.type === 'offer') {
|
|
171
|
+
await pc.setLocalDescription(await pc.createAnswer());
|
|
172
|
+
reply({ type: 'description', description: pc.localDescription });
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}).catch((error) => {
|
|
176
|
+
if (!this.closedByUs && this.socket === socket)
|
|
177
|
+
this.events.onError?.(error instanceof Error ? error.message : 'Negotiation failed');
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
attach(channel) {
|
|
181
|
+
this.channels.set(channel.label, channel);
|
|
182
|
+
channel.onopen = () => {
|
|
183
|
+
if (this.closedByUs || this.channels.get(channel.label) !== channel)
|
|
184
|
+
return;
|
|
185
|
+
if (this.channels.get(CONTROL_CHANNEL)?.readyState === 'open' && this.channels.get(INPUT_CHANNEL)?.readyState === 'open') {
|
|
186
|
+
this.events.onReady?.();
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
channel.onmessage = ({ data }) => {
|
|
190
|
+
if (this.closedByUs || this.channels.get(channel.label) !== channel)
|
|
191
|
+
return;
|
|
192
|
+
let message;
|
|
193
|
+
try {
|
|
194
|
+
message = JSON.parse(String(data));
|
|
195
|
+
}
|
|
196
|
+
catch {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (message.type === 'state') {
|
|
200
|
+
// The signaling service establishes the epoch. A data packet never changes it.
|
|
201
|
+
if (this.role === 'host')
|
|
202
|
+
return;
|
|
203
|
+
const epoch = typeof message.epoch === 'number' ? message.epoch : 0;
|
|
204
|
+
if (epoch !== this.epoch)
|
|
205
|
+
return;
|
|
206
|
+
this.events.onState?.(message);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
if (message.type === 'input' && typeof message.seq === 'number') {
|
|
210
|
+
// The host executes relayed inputs idempotently: replays and stale duplicates
|
|
211
|
+
// are dropped per sender before the game ever sees them.
|
|
212
|
+
if (this.role === 'host' && !this.claimInput(message))
|
|
213
|
+
return;
|
|
214
|
+
this.events.onInput?.(message);
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Sends one discrete input. Per the protocol the game owns the player
|
|
220
|
+
* sequence: resending the same input is deduplicated by the host. The host's
|
|
221
|
+
* own inputs echo back through onInput with the local stream's sequence.
|
|
222
|
+
*/
|
|
223
|
+
sendInput(input) {
|
|
224
|
+
const channel = this.channels.get(INPUT_CHANNEL);
|
|
225
|
+
if (!channel || channel.readyState !== 'open')
|
|
226
|
+
return false;
|
|
227
|
+
const message = { type: 'input', seq: ++this.inputSeq, ...input };
|
|
228
|
+
if (typeof input.seq === 'number')
|
|
229
|
+
message.seq = input.seq;
|
|
230
|
+
message.from = this.memberId;
|
|
231
|
+
message.epoch = this.epoch;
|
|
232
|
+
channel.send(JSON.stringify(message));
|
|
233
|
+
// The authoritative side applies its own inputs through the same deduplicated path.
|
|
234
|
+
if (this.role === 'host' && this.claimInput(message))
|
|
235
|
+
this.events.onInput?.(message);
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
/** Publishes authoritative state stamped with the current epoch; guests cannot publish. */
|
|
239
|
+
publishState(state) {
|
|
240
|
+
const channel = this.channels.get(CONTROL_CHANNEL);
|
|
241
|
+
if (this.role !== 'host' || !channel || channel.readyState !== 'open')
|
|
242
|
+
return false;
|
|
243
|
+
channel.send(JSON.stringify({ ...state, type: 'state', epoch: this.epoch }));
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
246
|
+
/** Host checkpoint for host-migration recovery; sent over signaling, size-capped. */
|
|
247
|
+
syncSnapshot(state) {
|
|
248
|
+
if (this.role !== 'host' || this.socket.readyState !== WebSocket.OPEN)
|
|
249
|
+
return false;
|
|
250
|
+
let frame;
|
|
251
|
+
try {
|
|
252
|
+
const snapshot = JSON.stringify({ ...state, epoch: this.epoch });
|
|
253
|
+
const encoder = new TextEncoder();
|
|
254
|
+
if (encoder.encode(snapshot).length > MAX_SNAPSHOT_BYTES)
|
|
255
|
+
return false;
|
|
256
|
+
frame = JSON.stringify({ type: 'state-sync', snapshot });
|
|
257
|
+
if (encoder.encode(frame).length > MAX_SIGNAL_FRAME_BYTES)
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
catch {
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
this.socket.send(frame);
|
|
264
|
+
return true;
|
|
265
|
+
}
|
|
266
|
+
get currentEpoch() {
|
|
267
|
+
return this.epoch;
|
|
268
|
+
}
|
|
269
|
+
/** Reports the current round-trip time in milliseconds when available. */
|
|
270
|
+
async rttMs() {
|
|
271
|
+
const report = await this.pc.getStats();
|
|
272
|
+
const stats = report;
|
|
273
|
+
for (const entry of stats.values()) {
|
|
274
|
+
if (entry.type === 'candidate-pair' && typeof entry.currentRoundTripTime === 'number') {
|
|
275
|
+
return entry.currentRoundTripTime * 1000;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return undefined;
|
|
279
|
+
}
|
|
280
|
+
/** Reports the selected candidate type for diagnostics (host | relay | …). */
|
|
281
|
+
async selectedCandidateType() {
|
|
282
|
+
const report = await this.pc.getStats();
|
|
283
|
+
// RTCStatsReport indexing is not declared in every DOM lib revision.
|
|
284
|
+
const stats = report;
|
|
285
|
+
const transport = [...stats.values()].find((entry) => entry.type === 'transport' && typeof entry.selectedCandidatePairId === 'string');
|
|
286
|
+
const pair = transport ? stats.get(transport.selectedCandidatePairId) : undefined;
|
|
287
|
+
const localId = pair ? pair.localCandidateId : undefined;
|
|
288
|
+
const local = typeof localId === 'string' ? stats.get(localId) : undefined;
|
|
289
|
+
return local && typeof local.candidateType === 'string' ? local.candidateType : undefined;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
function decodeSnapshot(value) {
|
|
293
|
+
try {
|
|
294
|
+
const parsed = typeof value === 'string' ? JSON.parse(value) : value;
|
|
295
|
+
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed))
|
|
296
|
+
return parsed;
|
|
297
|
+
}
|
|
298
|
+
catch { /* ignore malformed checkpoints */ }
|
|
299
|
+
return undefined;
|
|
300
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funforge/game-sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0-alpha.2",
|
|
4
|
+
"description": "FunForge multiplayer SDK for browser games: room tickets, WebRTC transport, host-authoritative state.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./multiplayer": {
|
|
15
|
+
"types": "./dist/multiplayer/index.d.ts",
|
|
16
|
+
"import": "./dist/multiplayer/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"main": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./multiplayer": {
|
|
28
|
+
"types": "./dist/multiplayer/index.d.ts",
|
|
29
|
+
"import": "./dist/multiplayer/index.js"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist",
|
|
35
|
+
"README.md"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsc -p tsconfig.json",
|
|
39
|
+
"prepack": "npm run build",
|
|
40
|
+
"test": "npm run build && node --test test/*.test.mjs"
|
|
41
|
+
},
|
|
42
|
+
"sideEffects": false
|
|
43
|
+
}
|