Bump dependencies

This commit is contained in:
Andras Schmelczer 2026-06-04 17:46:28 +01:00
parent 52ca1b8844
commit 913abb7642
40 changed files with 6200 additions and 19785 deletions

View file

@ -14,35 +14,27 @@
"try-build": "npm run build && cd dist && node main.js && cd -"
},
"dependencies": {
"@types/config": "0.0.36",
"cors": "^2.8.5",
"express": "^4.17.1",
"cors": "^2.8.6",
"express": "^5.2.1",
"gl-matrix": "3.3.0",
"minimist": "^1.2.5",
"socket.io": "^2.3.0",
"socket.io-msgpack-parser": "^2.0.0"
"minimist": "^1.2.8",
"socket.io": "^4.8.3",
"socket.io-msgpack-parser": "^3.0.2"
},
"devDependencies": {
"@types/cors": "^2.8.7",
"@types/express": "^4.17.8",
"@types/minimist": "^1.2.0",
"@types/node": "^14.11.2",
"@types/socket.io": "^2.1.11",
"clean-webpack-plugin": "^3.0.0",
"concurrently": "^5.3.0",
"file-loader": "^6.1.0",
"html-webpack-plugin": "^4.5.0",
"nodemon": "^2.0.4",
"raw-loader": "^4.0.1",
"resolve-url-loader": "^3.1.1",
"@types/cors": "^2.8.19",
"@types/express": "^5.0.6",
"@types/minimist": "^1.2.5",
"@types/node": "^22.0.0",
"clean-webpack-plugin": "^4.0.0",
"concurrently": "^10.0.3",
"nodemon": "^3.1.14",
"shared": "file:../shared",
"terser-webpack-plugin": "^2.3.5",
"ts-config-webpack-plugin": "^2.0.0",
"ts-loader": "^8.0.3",
"typescript": "^4.0.3",
"webpack": "^4.44.2",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0",
"webpack-node-externals": "^2.5.2"
"terser-webpack-plugin": "^5.6.1",
"ts-loader": "^9.6.0",
"typescript": "^6.0.3",
"webpack": "^5.107.2",
"webpack-cli": "^7.0.3",
"webpack-node-externals": "^3.0.0"
}
}

View file

@ -1,7 +1,10 @@
import { Command } from 'shared';
export class GeneratePointsCommand extends Command {
public constructor(public readonly decla: number, public readonly red: number) {
public constructor(
public readonly decla: number,
public readonly red: number,
) {
super();
}
}

View file

@ -1,5 +1,5 @@
import { PhysicalContainer } from './physics/containers/physical-container';
import ioserver from 'socket.io';
import { Server, Socket } from 'socket.io';
import {
TransportEvents,
deserialize,
@ -62,7 +62,10 @@ export class GameServer extends CommandReceiver {
[GeneratePointsCommand.type]: this.addPoints.bind(this),
};
constructor(private readonly io: ioserver.Server, private options: Options) {
constructor(
private readonly io: Server,
private options: Options,
) {
super();
this.serverName = options.name;
@ -70,7 +73,7 @@ export class GameServer extends CommandReceiver {
this.initialize();
io.on('connection', (socket: SocketIO.Socket) => {
io.on('connection', (socket: Socket) => {
socket.on(TransportEvents.PlayerJoining, (playerInfo: PlayerInformation) => {
try {
const player = this.players.createPlayer(playerInfo, socket);

View file

@ -1,4 +1,4 @@
import ioserver from 'socket.io';
import { Server as IoServer } from 'socket.io';
import express from 'express';
import { Server } from 'http';
import cors from 'cors';
@ -22,7 +22,13 @@ Random.seed = options.seed;
const app = express();
const server = new Server(app);
const io = ioserver(server, { parser } as any);
const io = new IoServer(server, {
parser,
cors: {
origin: true,
credentials: true,
},
} as any);
const gameServer = new GameServer(io, options);

View file

@ -88,9 +88,10 @@ export class CirclePhysical extends CommandReceiver implements Circle, DynamicPh
);
}
public stepManually(
deltaTimeInSeconds: number,
): { hitObject: GameObject | undefined; velocity: vec2 } {
public stepManually(deltaTimeInSeconds: number): {
hitObject: GameObject | undefined;
velocity: vec2;
} {
let delta = vec2.scale(vec2.create(), this.velocity, deltaTimeInSeconds);
this.radius += vec2.length(delta);

View file

@ -72,8 +72,8 @@ export class PlanetPhysical extends PlanetBase implements StaticPhysical {
return Math.abs(this.ownership - 0.5) < 0.1
? CharacterTeam.neutral
: this.ownership < 0.5
? CharacterTeam.decla
: CharacterTeam.red;
? CharacterTeam.decla
: CharacterTeam.red;
}
private timeSinceLastPointGeneration = 0;

View file

@ -5,7 +5,10 @@ import { StaticPhysical } from '../physicals/static-physical';
class Node {
public left: Node | null = null;
public right: Node | null = null;
constructor(public object: StaticPhysical, public parent: Node | null) {}
constructor(
public object: StaticPhysical,
public parent: Node | null,
) {}
}
export class BoundingBoxTree {

View file

@ -56,9 +56,8 @@ export abstract class PlayerBase extends CommandReceiver {
);
const playerBoundingBox = getBoundingBoxOfCircle(playerBoundingCircle);
const possibleIntersectors = this.objectContainer.findIntersecting(
playerBoundingBox,
);
const possibleIntersectors =
this.objectContainer.findIntersecting(playerBoundingBox);
if (!isCircleIntersecting(playerBoundingCircle, possibleIntersectors)) {
return playerPosition;
}

View file

@ -1,4 +1,5 @@
import { CharacterTeam, PlayerInformation, Random, settings, Command } from 'shared';
import { Socket } from 'socket.io';
import { PhysicalContainer } from '../physics/containers/physical-container';
import { NPC } from './npc';
import { Player } from './player';
@ -29,7 +30,7 @@ export class PlayerContainer {
}
}
public createPlayer(playerInfo: PlayerInformation, socket: SocketIO.Socket): Player {
public createPlayer(playerInfo: PlayerInformation, socket: Socket): Player {
if (this._players.length === this.playerMaxCount) {
throw new Error('Too many players');
}

View file

@ -23,6 +23,7 @@ import {
PropertyUpdatesForObject,
PrimaryActionCommand,
} from 'shared';
import { Socket } from 'socket.io';
import { BoundingBox } from '../physics/bounding-boxes/bounding-box';
import { PhysicalContainer } from '../physics/containers/physical-container';
import { CharacterPhysical } from '../objects/character-physical';
@ -51,7 +52,7 @@ export class Player extends PlayerBase {
playerContainer: PlayerContainer,
objectContainer: PhysicalContainer,
team: CharacterTeam,
private readonly socket: SocketIO.Socket,
private readonly socket: Socket,
) {
super(playerInfo, playerContainer, objectContainer, team);
this.createCharacter();

View file

@ -1,13 +1,14 @@
{
"compilerOptions": {
"outDir": "dist",
"rootDir": "src",
"skipLibCheck": true,
"target": "es6",
"esModuleInterop": true,
"strict": true,
"experimentalDecorators": true,
"downlevelIteration": true,
"moduleResolution": "node",
"ignoreDeprecations": "6.0",
"module": "commonjs",
"lib": ["dom", "es2017"],
"typeRoots": ["./types", "./node_modules/@types"]

View file

@ -32,9 +32,9 @@ module.exports = (env, argv) => ({
minimize: argv.mode !== 'development',
minimizer: [
new TerserJSPlugin({
sourceMap: false,
test: /\.js$/,
exclude: /node_modules/,
// The custom serialization protocol keys on class names, so they must
// survive minification (see shared/src/serialization).
terserOptions: {
keep_classnames: true,
},
@ -50,16 +50,6 @@ module.exports = (env, argv) => ({
],
module: {
rules: [
{
test: /\.html$/,
use: {
loader: 'file-loader',
query: {
outputPath: '/',
name: '[name].[ext]',
},
},
},
{
test: /\.ts$/,
use: {