From 51a8b422a023efdf665ad239ff0bb4f26b041720 Mon Sep 17 00:00:00 2001 From: Natalie Date: Fri, 17 Apr 2026 15:14:29 -0700 Subject: [PATCH] =?UTF-8?q?feat(@projects/@magic-civilization):=20?= =?UTF-8?q?=E2=9C=A8=20update=20physics=20engine=20metadata=20and=20stub?= =?UTF-8?q?=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- .../games/age-of-dwarves/data/objectives.json | 6 ++--- src/game/engine/src/autoloads/data_loader.gd | 1 + src/simulator/package.json | 6 +++-- src/simulator/runner-stub.mjs | 22 +++++++++++++++++++ 4 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 src/simulator/runner-stub.mjs diff --git a/public/games/age-of-dwarves/data/objectives.json b/public/games/age-of-dwarves/data/objectives.json index b141c324..1c17f4eb 100644 --- a/public/games/age-of-dwarves/data/objectives.json +++ b/public/games/age-of-dwarves/data/objectives.json @@ -1,11 +1,11 @@ { - "generated_at": "2026-04-17T22:06:32Z", + "generated_at": "2026-04-17T22:13:53Z", "totals": { - "stub": 6, "done": 35, - "missing": 10, "partial": 17, + "stub": 6, "oos": 9, + "missing": 10, "total": 77 }, "objectives": [ diff --git a/src/game/engine/src/autoloads/data_loader.gd b/src/game/engine/src/autoloads/data_loader.gd index 1b92f8a5..48da4909 100644 --- a/src/game/engine/src/autoloads/data_loader.gd +++ b/src/game/engine/src/autoloads/data_loader.gd @@ -24,6 +24,7 @@ const _RESOURCES_DIR_MAP: Dictionary = { "throne_room": "throne_rooms", "homeworlds": "worlds", "resources": "deposits", + "techs": "techs", "world_biomes": "ecology/biomes", "world_flora": "ecology/flora", "world_fauna": "ecology/fauna", diff --git a/src/simulator/package.json b/src/simulator/package.json index 8741b8bd..c22c2bef 100644 --- a/src/simulator/package.json +++ b/src/simulator/package.json @@ -1,10 +1,12 @@ { "name": "@magic-civ/physics-rs", "version": "0.1.0", - "description": "Rust physics engine — compiled to WASM for web, GDExtension for Godot. Build output lives at repo-root .local/build/wasm/ (gitignored, per-host). Consumers resolve via Vite/Vitest alias — this package has no `main`/`types` because Node's resolver can't follow `../../` out of the package root cleanly through pnpm symlinks, and the artifact's true location is outside this package tree.", + "description": "Rust physics engine — compiled to WASM for web, GDExtension for Godot. Build output lives at repo-root .local/build/wasm/ (gitignored, per-host; see .claude/instructions/build-output-locations.md). Browser / Vite / Vitest consumers resolve via the explicit alias in vite.config.ts pointing directly at .local/build/wasm/. Node-side consumers (simCachePlugin workers, build-time sim-cache baker) go through runner-stub.mjs which re-exports from the same path — needed because Node's ESM resolver can't follow `../../` out of a package root through pnpm symlinks.", + "type": "module", + "main": "./runner-stub.mjs", "scripts": { "build": "bash build-wasm.sh", "build:gdext": "bash build-gdext.sh" }, - "files": [] + "files": ["runner-stub.mjs"] } diff --git a/src/simulator/runner-stub.mjs b/src/simulator/runner-stub.mjs new file mode 100644 index 00000000..7e7c317f --- /dev/null +++ b/src/simulator/runner-stub.mjs @@ -0,0 +1,22 @@ +// Runtime resolver for @magic-civ/physics-rs — delegates to the repo-local +// wasm-pack output at .local/build/wasm/magic_civ_physics.js. +// +// Why this file exists: the canonical WASM artifact lives outside the +// @magic-civ/physics-rs package root (at repo-root .local/build/wasm/ per +// the "build output never under src/" rule in +// .claude/instructions/build-output-locations.md). Node's ESM resolver +// cannot follow a package.json `main` whose path segments escape the +// package root via `../` — tsx in particular collapses `..` segments +// incorrectly through pnpm symlinks and tries to resolve the path under +// node_modules/. A stub file inside the package tree that re-exports from +// the absolute build-output path sidesteps the issue cleanly. +// +// This module is only consulted by Node-side tooling (tsx workers spawned +// by simCachePlugin, the build-time sim-cache baker, etc.). Browser / +// Vite / Vitest consumers bypass it entirely via the explicit +// `@magic-civ/physics-rs` alias in vite.config.ts + vitest.config.ts, +// which points directly at .local/build/wasm/magic_civ_physics.js. +// +// Related objectives: p2-20 (this fix) and p2-21 (static-bake consumer). + +export * from '../../.local/build/wasm/magic_civ_physics.js'