Migrate mkjs to Bun-first ES6/TypeScript entrypoints and modernize multiplayer server#1
Draft
Migrate mkjs to Bun-first ES6/TypeScript entrypoints and modernize multiplayer server#1
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Description
index.htmlwith a single ES module entrycode/bootstrap.tsthat dynamically injects the legacy script files in the original order and ported the bootstrap/game-loop to TypeScript.package.json,tsconfig.json, andbun.lockwith convenient scripts (dev,serve,server,typecheck).server/server.tsandserver/modules/mkjsInstance.ts, added Bun run scripts (server/run.sh,server/run.bat), and kept small deprecation shims (server/server.js,server/modules/mkjsInstance.js) to avoid breaking existing workflows.ArrayBufferLikefor packet buffers) and preserved the existing binary relay behavior for multiplayer packets.Testing
bun installto populate dependencies andbun run typecheck(TypeScript) which passed after a small type adjustment toserver/modules/mkjsInstance.ts.bun run server --helpwhich boots and reports the listening address, indicating the WebSocket server starts correctly.bun -ethat created aMkjsInstancewith two mock clients and sent a binary kart packet, which verified the server-side binary relay path (succeeded).bun index.htmlwhich served the newindex.htmlentrypoint successfully (dev server started), but an automated Playwright attempt to capture a screenshot failed due to a Chromium crash in the execution environment (not a project failure).Codex Task