@quake2ts/server 0.0.1 → 0.0.740

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 (38) hide show
  1. package/dist/{index.cjs → cjs/index.cjs} +175 -224
  2. package/dist/cjs/index.cjs.map +1 -0
  3. package/dist/{index.js → esm/index.js} +44 -82
  4. package/dist/esm/index.js.map +1 -0
  5. package/dist/tsconfig.tsbuildinfo +1 -0
  6. package/dist/{client.d.ts → types/client.d.ts} +1 -0
  7. package/dist/types/client.d.ts.map +1 -0
  8. package/dist/{dedicated.d.ts → types/dedicated.d.ts} +1 -0
  9. package/dist/types/dedicated.d.ts.map +1 -0
  10. package/dist/{index.d.ts → types/index.d.ts} +1 -0
  11. package/dist/types/index.d.ts.map +1 -0
  12. package/dist/{net → types/net}/nodeWsDriver.d.ts +1 -0
  13. package/dist/types/net/nodeWsDriver.d.ts.map +1 -0
  14. package/dist/{protocol → types/protocol}/player.d.ts +1 -0
  15. package/dist/types/protocol/player.d.ts.map +1 -0
  16. package/dist/{protocol → types/protocol}/write.d.ts +1 -0
  17. package/dist/types/protocol/write.d.ts.map +1 -0
  18. package/dist/{protocol.d.ts → types/protocol.d.ts} +1 -0
  19. package/dist/types/protocol.d.ts.map +1 -0
  20. package/dist/{server.d.ts → types/server.d.ts} +1 -0
  21. package/dist/types/server.d.ts.map +1 -0
  22. package/dist/{transport.d.ts → types/transport.d.ts} +1 -0
  23. package/dist/types/transport.d.ts.map +1 -0
  24. package/dist/{transports → types/transports}/websocket.d.ts +1 -0
  25. package/dist/types/transports/websocket.d.ts.map +1 -0
  26. package/package.json +26 -14
  27. package/tsconfig.json +11 -5
  28. package/tsup.config.ts +10 -0
  29. package/dist/client.js +0 -100
  30. package/dist/dedicated.js +0 -1104
  31. package/dist/net/nodeWsDriver.js +0 -122
  32. package/dist/protocol/player.js +0 -1
  33. package/dist/protocol/write.js +0 -167
  34. package/dist/protocol.js +0 -71
  35. package/dist/server.js +0 -12
  36. package/dist/transport.js +0 -1
  37. package/dist/transports/websocket.js +0 -38
  38. package/tsconfig.tsbuildinfo +0 -1
@@ -5,3 +5,4 @@ import { BinaryWriter, ServerCommand } from '@quake2ts/shared';
5
5
  * into the specific binary format expected by the protocol.
6
6
  */
7
7
  export declare function writeServerCommand(writer: BinaryWriter, event: ServerCommand, ...args: any[]): void;
8
+ //# sourceMappingURL=write.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../../src/protocol/write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAoB,MAAM,kBAAkB,CAAC;AAGjF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAmFnG"}
@@ -15,3 +15,4 @@ export declare class ClientMessageParser {
15
15
  private parseUserInfo;
16
16
  private parseStringCmd;
17
17
  }
18
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAiB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE5E,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IACxE,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,KAAK,IAAI,IAAI,CAAC;IACd,KAAK,IAAI,IAAI,CAAC;CACf;AAED,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,OAAO,CAAuB;gBAE1B,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,oBAAoB;IAKxD,YAAY,IAAI,IAAI;IA0B3B,OAAO,CAAC,SAAS;IAoCjB,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,cAAc;CAIvB"}
@@ -48,3 +48,4 @@ export interface Server {
48
48
  baselines: (EntityState | null)[];
49
49
  multicastBuf: Uint8Array;
50
50
  }
51
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAiD,MAAM,kBAAkB,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;GAEG;AACH,oBAAY,WAAW;IACnB,IAAI,IAAA,CAAY,gBAAgB;IAChC,OAAO,IAAA,CAAS,wBAAwB;IACxC,IAAI,IAAA,CAAY,mBAAmB;IACnC,SAAS,IAAA;IACT,IAAI,IAAA;IACJ,GAAG,IAAA;CACN;AAED,MAAM,WAAW,SAAS;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IAEjB,MAAM,EAAE,MAAM,CAAC;IAEf,UAAU,EAAE,MAAM,CAAC;IAEnB,OAAO,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IAQ3B,aAAa,EAAE,MAAM,CAAC;IAEtB,UAAU,EAAE,SAAS,EAAE,CAAC;IAGxB,QAAQ,CAAC,EAAE,GAAG,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,MAAM;IACnB,KAAK,EAAE,WAAW,CAAC;IAEnB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAElB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IAEd,IAAI,EAAE,MAAM,CAAC;IAIb,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IAEtC,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,EAAE,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC;IAGlC,YAAY,EAAE,UAAU,CAAC;CAC5B"}
@@ -5,3 +5,4 @@ export interface NetworkTransport {
5
5
  onConnection(callback: (driver: NetDriver, info?: any) => void): void;
6
6
  onError(callback: (error: Error) => void): void;
7
7
  }
8
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,MAAM,WAAW,gBAAgB;IAC7B,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,KAAK,IAAI,IAAI,CAAC;IACd,YAAY,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAAC;IACtE,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI,CAAC;CACnD"}
@@ -9,3 +9,4 @@ export declare class WebSocketTransport implements NetworkTransport {
9
9
  onConnection(callback: (driver: NetDriver, info?: any) => void): void;
10
10
  onError(callback: (error: Error) => void): void;
11
11
  }
12
+ //# sourceMappingURL=websocket.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"websocket.d.ts","sourceRoot":"","sources":["../../../src/transports/websocket.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBAAa,kBAAmB,YAAW,gBAAgB;IACvD,OAAO,CAAC,GAAG,CAAgC;IAC3C,OAAO,CAAC,kBAAkB,CAA0D;IACpF,OAAO,CAAC,aAAa,CAAyC;IAExD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBzC,KAAK;IAOL,YAAY,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,IAAI;IAI9D,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI;CAG3C"}
package/package.json CHANGED
@@ -1,33 +1,45 @@
1
1
  {
2
2
  "name": "@quake2ts/server",
3
- "version": "0.0.1",
3
+ "version": "0.0.740",
4
4
  "type": "module",
5
- "main": "./dist/index.cjs",
6
- "module": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
5
+ "main": "./dist/cjs/index.cjs",
6
+ "module": "./dist/esm/index.js",
7
+ "types": "./dist/types/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js",
12
- "require": "./dist/index.cjs"
10
+ "types": "./dist/types/index.d.ts",
11
+ "import": "./dist/esm/index.js",
12
+ "require": "./dist/cjs/index.cjs"
13
13
  }
14
14
  },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/jburnhams/quake2.git",
18
+ "directory": "quake2ts/packages/server"
19
+ },
20
+ "peerDependencies": {
21
+ "@quake2ts/engine": "0.0.740",
22
+ "@quake2ts/game": "0.0.740",
23
+ "@quake2ts/shared": "0.0.740"
24
+ },
15
25
  "dependencies": {
16
- "ws": "^8.18.0",
17
- "@quake2ts/engine": "0.0.1",
18
- "@quake2ts/game": "0.0.1",
19
- "@quake2ts/shared": "0.0.1"
26
+ "ws": "^8.18.0"
20
27
  },
21
28
  "devDependencies": {
22
29
  "@types/ws": "^8.5.12",
23
30
  "tsup": "^8.0.2",
24
31
  "typescript": "^5.4.5",
25
32
  "vitest": "^1.6.0",
26
- "@quake2ts/test-utils": "0.0.1"
33
+ "@quake2ts/engine": "0.0.740",
34
+ "@quake2ts/game": "0.0.740",
35
+ "@quake2ts/test-utils": "0.0.740",
36
+ "@quake2ts/shared": "0.0.740"
27
37
  },
28
38
  "scripts": {
29
- "build": "tsup src/index.ts --format esm,cjs && tsc --emitDeclarationOnly",
30
- "dev": "tsup src/index.ts --format esm,cjs --watch --dts",
39
+ "build": "pnpm run build:types && pnpm run build:bundles",
40
+ "build:types": "tsc -b",
41
+ "build:bundles": "tsup",
42
+ "dev": "tsup --watch",
31
43
  "test": "pnpm run test:unit",
32
44
  "test:unit": "TEST_TYPE=unit vitest run",
33
45
  "test:integration": "TEST_TYPE=integration vitest run"
package/tsconfig.json CHANGED
@@ -1,9 +1,15 @@
1
1
  {
2
2
  "extends": "../../tsconfig.base.json",
3
- "include": ["src/**/*"],
4
3
  "compilerOptions": {
5
- "outDir": "dist",
6
- "composite": true,
7
- "rootDir": "src"
8
- }
4
+ "outDir": "dist/types",
5
+ "rootDir": "src",
6
+ "emitDeclarationOnly": true,
7
+ "declarationMap": true
8
+ },
9
+ "include": ["src/**/*"],
10
+ "references": [
11
+ { "path": "../shared" },
12
+ { "path": "../engine" },
13
+ { "path": "../game" }
14
+ ]
9
15
  }
package/tsup.config.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { defineConfig } from 'tsup';
2
+ import { createLibraryConfig } from '../../build-config/tsup.factory';
3
+
4
+ export default defineConfig(
5
+ createLibraryConfig({
6
+ globalName: 'Quake2Server',
7
+ browserBundle: false, // Server package doesn't need browser bundle
8
+ external: [/@quake2ts\/.*/, 'gl-matrix', 'ws'],
9
+ })
10
+ );
package/dist/client.js DELETED
@@ -1,100 +0,0 @@
1
- import { UPDATE_BACKUP, NetChan } from '@quake2ts/shared';
2
- export var ClientState;
3
- (function (ClientState) {
4
- ClientState[ClientState["Free"] = 0] = "Free";
5
- ClientState[ClientState["Zombie"] = 1] = "Zombie";
6
- ClientState[ClientState["Connected"] = 2] = "Connected";
7
- ClientState[ClientState["Spawned"] = 3] = "Spawned";
8
- ClientState[ClientState["Active"] = 4] = "Active"; // In game (added to match existing code usage)
9
- })(ClientState || (ClientState = {}));
10
- export function createClient(index, net) {
11
- // Initialize frames array
12
- const frames = [];
13
- for (let i = 0; i < UPDATE_BACKUP; i++) {
14
- frames.push({
15
- areaBytes: 0,
16
- areaBits: new Uint8Array(0), // Size depends on map areas
17
- playerState: createEmptyPlayerState(),
18
- numEntities: 0,
19
- firstEntity: 0,
20
- sentTime: 0,
21
- entities: [],
22
- packetCRC: 0
23
- });
24
- }
25
- const netchan = new NetChan();
26
- // Initialize qport - normally we would get this from userinfo or handshake
27
- netchan.setup(Math.floor(Math.random() * 65536));
28
- return {
29
- index,
30
- state: ClientState.Connected,
31
- net,
32
- netchan,
33
- userInfo: '',
34
- lastFrame: 0,
35
- lastCmd: createEmptyUserCommand(),
36
- commandMsec: 0,
37
- frameLatency: [],
38
- ping: 0,
39
- messageSize: [],
40
- rate: 25000, // Default rate
41
- suppressCount: 0,
42
- edict: null,
43
- name: `Player ${index}`,
44
- messageLevel: 0,
45
- datagram: new Uint8Array(0),
46
- frames,
47
- downloadSize: 0,
48
- downloadCount: 0,
49
- lastMessage: 0,
50
- lastConnect: Date.now(),
51
- challenge: 0,
52
- messageQueue: [],
53
- lastPacketEntities: [],
54
- commandQueue: [],
55
- lastCommandTime: 0,
56
- commandCount: 0
57
- };
58
- }
59
- function createEmptyUserCommand() {
60
- return {
61
- msec: 0,
62
- buttons: 0,
63
- angles: { x: 0, y: 0, z: 0 },
64
- forwardmove: 0,
65
- sidemove: 0,
66
- upmove: 0,
67
- sequence: 0,
68
- lightlevel: 0,
69
- impulse: 0
70
- };
71
- }
72
- function createEmptyPlayerState() {
73
- return {
74
- origin: { x: 0, y: 0, z: 0 },
75
- velocity: { x: 0, y: 0, z: 0 },
76
- viewAngles: { x: 0, y: 0, z: 0 },
77
- onGround: false,
78
- waterLevel: 0,
79
- watertype: 0,
80
- mins: { x: -16, y: -16, z: -24 },
81
- maxs: { x: 16, y: 16, z: 32 },
82
- damageAlpha: 0,
83
- damageIndicators: [],
84
- blend: [0, 0, 0, 0],
85
- // Stubs for new fields
86
- stats: [],
87
- kick_angles: { x: 0, y: 0, z: 0 },
88
- kick_origin: { x: 0, y: 0, z: 0 },
89
- gunoffset: { x: 0, y: 0, z: 0 },
90
- gunangles: { x: 0, y: 0, z: 0 },
91
- gunindex: 0,
92
- pm_type: 0,
93
- pm_time: 0,
94
- pm_flags: 0,
95
- gun_frame: 0,
96
- rdflags: 0,
97
- fov: 90,
98
- renderfx: 0
99
- };
100
- }