- Condition parse cache: each unique string parsed once (Map<string, ParsedCondition>)
- executeAction: throw on missing type/malformed action/missing action; warn-only on
destroyed entity (legitimate mid-flight case)
- World.query() overloads for 2 and 3 component types: query(A, B) → [Entity, A, B]
- World.once()/off() consistency: #onceWrappers map lets off(event, original) correctly
remove handlers registered via once()
- World.cloneEntity(source, newId?): deep-clones all components via structuredClone,
onAdd() fires normally on the new entity
- isEntityContext() type guard alongside isEvalContext()
- Inventory.getVariables() cache: invalidated on add()/remove()
- QuestLog.getVariables() cache: invalidated on any status transition or _advance()
- QuestLog.entries() explicit Generator return type
- Variables JSDoc: clarifies when to use Variables vs typed Component<TState>
- @component({ name?, version? }) object overload in registry
- registerMigration(name, from, to, fn): chained migrations run automatically on
deserialize when saved version < current version
- Serialization wire format: ComponentData carries version, WorldData carries
schemaVersion; mismatched schemaVersion throws a descriptive error
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
||
|---|---|---|
| backend | ||
| build | ||
| src | ||
| test/common | ||
| .clang-format | ||
| .clangd | ||
| .gitignore | ||
| AGENTS.md | ||
| README.md | ||
| bun.lock | ||
| compile_flags.txt | ||
| package.json | ||
| tsconfig.json | ||
README.md
TS-Games
Custom framework/build system for simple single-file TypeScript games.
Installing dependencies
- Install bun (https://bun.sh/)
bun install
Make a game
- Create your game folder in
src/games - Create
src/games/<yourgame>/index.tswith default exported function.
Running:
bun start
Navigate to http://localhost:3000 to see the list of your games.
Game rebuilds on each reload.
Building
bun run build <project>
Will create <project>.html in dist folder.
Or to select project from list:
bun run build
Features
-
Bun ♥
-
TypeScript
-
Building into single
.htmlfile without any dependencies, all assets are inlined as data-urls.src/games/<yourgame>/assets/favicon.icois used as page icon if present.
-
TSX supported with Preact, because it's lightweight.
-
Import images as
HTMLImageElement- PNG & JPG
import spritesheet from './assets/spritesheet.png'; console.log(spritesheet); // <img src="data:..." />
- PNG & JPG
-
Import audio as
HTMLAudioElement- WAV, MP3 & OGG
import heal from './assets/heal.ogg'; console.log(heal); // <audio src="data:..." /> heal.play()
- WAV, MP3 & OGG
-
Import CSS
-
Regular CSS
import "./assets/styles.css"; -
CSS modules is supported
import styles from './assets/styles.module.css'; console.log(styles.awoo); // G7sddg_awoo export default <div className={styles.root}></div>; -
Modern CSS features are transpiled
- Nested CSS
.root { display: flex; .row { display: flex; flex-direction: row; } } - Vendor prefixed if needed
- Nested CSS
-
Import fonts (see example in
src/common/assets/vga.font.css)import "./assets/lcd.font.css";
-
Publishing
-
Make sure you have
scpinstalled (it most certainly is) -
Make
.envfilePUBLISH_LOCATION=ssh.example.com:/var/www/games/ PUBLISH_URL=https://example.com/ -
Run build & publish
bun run build <project>Or to select project from list:
bun run build