Fixes production errors where Socket.IO server failed with "Unexpected token 'export'"
when loading map data from @svg-maps/world and @svg-maps/usa packages.
**Changes:**
- **maps.ts**: Use dynamic `import()` for ES modules instead of JSON workaround
- Async loading via `ensureMapSourcesLoaded()` works in both browser and Node.js
- Sync Proxy exports (`WORLD_MAP`, `USA_MAP`) for client components
- Async functions (`getMapData()`, `getFilteredMapData()`) for server-side use
- Remove JSON data files (world.json, usa.json) - now load directly from npm packages
- **Client components**: Use sync map exports instead of async functions
- MapRenderer, PlayingPhase, ResultsPhase, SetupPhase, StudyPhase, MapRenderer.stories
- Import `WORLD_MAP`/`USA_MAP` or use `getFilteredMapDataSync()`
- No more Promise handling needed in React components
- **Page component**: Disable SSR to prevent build-time errors
- Use Next.js `dynamic()` import with `ssr: false`
- Prevents race condition during static generation
- **tsconfig.server.json**: Include maps.ts and related files for server compilation
**Testing:**
- ✅ Docker build succeeds
- ✅ Socket.IO server loads: "Socket server module loaded successfully"
- ✅ Zero ES module errors in production build
- ✅ Maps load correctly from @svg-maps packages via dynamic imports
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Fixes TypeScript errors introduced by registry game system:
- Allow gameName to be string | null in nav component types
- Update RecentRoom, AddPlayerButton, GameContextNav, ArcadeRoomInfo interfaces
- Convert null to undefined where needed for legacy function calls
- Fix GameTitleMenu showMenu prop
- Update JoinRoomModal to use separate useGetRoomByCode and useJoinRoom hooks
These changes allow rooms to exist without a selected game (gameName = null).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Fixes server-side session creation for Number Guesser:
- Import DEFAULT_NUMBER_GUESSER_CONFIG
- Add case for 'number-guesser' in getDefaultGameConfig()
- Add validation for number-guesser config
- Include arcade-games validators in server TypeScript build
This resolves the "Unknown game: number-guesser" error when creating sessions.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add "dist" to tsconfig.server.json exclude to prevent TypeScript from
seeing compiled .js files as input files (was causing TS5055 errors)
- Fix schema path glob: "src/db/schema.ts" -> "src/db/schema/**/*.ts"
to properly include all schema files in the directory
- Add missing PlayerOwnershipMap type import in player-ownership.ts
to fix TS2304 compilation error
These fixes resolve the dev server compilation issues and ensure clean
builds without dist/ pollution.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
**Problem:**
- player-ownership.ts imported drizzle-orm and @/db at top level
- When RoomMemoryPairsProvider imported client-safe utilities, Webpack bundled ALL imports including database code
- This caused hydration error: "The 'original' argument must be of type Function"
- Node.js util.promisify was being called in browser context
**Solution:**
1. Created player-ownership.client.ts with ONLY client-safe utilities
- No database imports
- Safe to import from 'use client' components
- Contains: buildPlayerOwnershipFromRoomData(), buildPlayerMetadata(), helper functions
2. Updated player-ownership.ts to re-export client utilities and add server-only functions
- Re-exports everything from .client.ts
- Adds buildPlayerOwnershipMap() (async, database-backed)
- Safe to import from server components/API routes
3. Updated RoomMemoryPairsProvider to import from .client.ts
**Result:**
- No more hydration errors on /arcade/room
- Client bundle doesn't include database code
- Server code can still use both client and server utilities
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
**Problem:**
- TypeScript was compiling .js files directly into src/ alongside .ts files
- This broke the app and polluted source control with build artifacts
**Solution:**
1. Moved socket-server.ts from root to src/socket-server.ts
- Updated imports to remove './src/' prefix (now './lib/...')
2. Updated tsconfig.server.json:
- Added rootDir: "./src" to ensure clean dist/ structure
- Updated include path from "socket-server.ts" to "src/socket-server.ts"
3. server.js already correctly requires from ./dist/*
**Result:**
- TypeScript now compiles to dist/ with clean structure:
- src/socket-server.ts → dist/socket-server.js ✓
- src/db/index.ts → dist/db/index.js ✓
- No dist/src/ subdirectory ✓
- No .js files created in src/ ✓
- Dev server starts successfully
- Build artifacts properly separated from source code
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
BREAKING: This fixes a critical issue where compiled .js files were
being committed directly into src/ alongside .ts files, breaking the
app and polluting source control.
Changes:
- Fix tsconfig.server.json: outDir "." → "./dist", rootDir "." → "./src"
- Remove 23 tracked .js files from src/ directory
- Update .gitignore to block src/**/*.js and /dist
- Clean working directory of all .js artifacts
This ensures TypeScript compilation outputs to dist/ folder, not src/.
Fixes player ownership implementation and all future builds.
- Add tsconfig.server.json to compile server-side TypeScript
- Install tsc-alias to resolve path aliases (@/*) in compiled JS
- Update build script to run tsc + tsc-alias before Next.js build
- Update dev script to compile server files before starting
- Remove tsx runtime dependencies from server.js
- Add compiled JS files for socket-server, db, and arcade modules
This enables production builds to run with pure Node.js without
requiring tsx or ts-node at runtime, as required for Docker deployment.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>