FRONTIERS REMOVAL (engine + viewer). Old BGS games pin old engine
versions so replay compatibility is unaffected; no current-version
games used Frontiers.
Engine (745 tests passing, 0 lint errors):
- deleted available/ships.ts (+spec), move/ships.ts
- enums: Frontiers bitflag, ResearchField.Diplomacy, Resource Trade*/
ShipRange/UpgradeDiplomacy, Building ships/Colony/CustomsPost block
(+ships()/isShip()/isAvailableShip()/Ship), Command.MoveShip,
Phase.RoundShip, Condition.Trade, TechFrontiers1, Diplomacy tech pos
members; Expansion.All now = LostFleet
- research-tracks: Diplomacy track, frontiersEco, ship-range rewards
stripped from base Navigation track; all other Frontiers-only fields,
handlers, cases and AI dimensions removed
- wrapper.ts: frontiers expansion flag
Viewer (863 tests passing, lint clean):
- deleted logic/trade-rewards.ts, logic/buttons/ships.ts,
charts/testdata/frontiers/; zero 'frontiers' references remain
IMPORT-CYCLE + CJS FIXES surfaced by the Vite dev server (ESM strict
order), all pre-existing bugs webpack/CJS masked:
- engine/src/buildings.ts imported from ".." (package root -> compiled
dist) - now "./enums"
- engine/index.ts re-exported ~15 type-only names as values
(BrainstoneDest, MaxLeech, EventSource, EngineOptions, the
Available* block, ResourceConversion, FederationInfo, GaiaHexData,
AvailableSetupOption, PreferenceSplit*/SilentAuction* types) -
split into 'export type' (load-bearing for rolldown too)
- viewer: Rules.vue registers FactionInfoCard async, breaking the
Rules -> FactionInfoCard -> PlayerInfo -> Rules cycle
- viewer: buttonStringLabel moved from logic/buttons/utils.ts to
shortcuts.ts (re-exported), breaking utils <-> shortcuts
DEV APP ON VITE (npm run serve = vite --port 8080):
- vite.config.ts mode-aware: dev = SPA (index.html + public/ +
engine-source aliases + optimizeDeps exclusion), build = the
published IIFE lib (unchanged single-file contract, verified)
- package.json: pruned webpack-era files/unpkg entries (.map dropped
- no map uploads per owner decision); deleted
scripts/fix-package-imports.ts (referenced the vite build's
nonexistent dist/package/css)
- dev boot verified in Chromium: self-contained picker renders,
zero page errors
BASE-GAME SCORING CLIP (follow-up on 5.14.2, which shipped without
the intended fix due to a no-op string replace): ScoringBoard's
y=-25 offset removed for real; spec pins y===null; verified in the
built bundle (first final tile fully inside the canvas top).
AGENTS.md: no sourcemap upload to BGS (owner decision); bodyparser
exemption noted as deployed.
The vue-cli/webpack 4 toolchain was the root cause of three shipped
production crashes this week (iterator-spread __spreadArrays RangeError,
stale cache-loader emitting raw vue_1.default for the vue external, and
the TDZ circular-import). Replace it:
- vite.config.ts: lib build of src/wrapper.ts -> dist/package/
viewer.umd.js (IIFE, esnext, minified) + viewer.css + map. vue and
bootstrap-vue stay external (window.Vue / window.BootstrapVue) via
plain global reads - no .default interop possible. process.env is
baked to ({}) via define, matching vue-cli's old defaults.
- vitest.config.ts: jsdom env, single fork, chai-compatible specs run
unchanged. 879 tests pass (was 809 - the json-driven chart/resource
suites now register their dynamic tests properly under vitest).
- import type correctness across the codebase: rolldown rejects
value-imports of type-only exports, so type-only imports are now
written as import type (and mixed imports split). Also fixes
self-contained-state.ts's reassignment of a destructured const.
- Commands.spec.ts: split a two-render test into two its - two
@testing-library renders of Commands in one test interfere under
vitest.
- scripts: package/build -> vite build, test -> vitest run.
- devDeps: +vite +@vitejs/plugin-vue2 +vitest +jsdom +esbuild +events
(browser polyfill for the engine's node 'events' import).
Verified in Chromium against the built bundle: loads with CDN Vue 2 +
BootstrapVue, Rotate sectors completes with and without rotations, zero
pageerrors; the bundle contains no __spreadArrays helpers.
The admin endpoints take the file as the raw request body with query
parameters - not multipart. The map upload must use
application/octet-stream because koa-bodyparser's 1MB jsonLimit
intercepts application/json bodies before the route's raw reader and
413s anything larger. Also note the GET-before-PUT rule (the engine
upload mutates the doc; a PUT from a stale GET reverts it).
- Replace all iterator spreads ([...map.values()] etc) with Array.from() across
engine and viewer: under the TS->babel downlevel chain they compiled to
__spreadArrays, which reads .length on an iterator and produced
'RangeError: invalid array length' on 'Sector rotations finished' (the
reported boardgamers.space crash), plus several latent same-class sites.
- Break the research-tracks.ts -> ../index barrel import cycle (imports
Event/Expansion from leaf modules now): the cycle left Engine in TDZ and
the whole bundle failed with 'Cannot access engine_Engine before
initialization' at module eval under the rebuilt module order.
- Fix stale cache-loader output producing raw vue_1.default accesses for the
vue webpack external (window.Vue has no .default): 'Cannot read properties
of undefined (reading extend)' at load. Clean rebuild emits babel interop
wrappers correctly. vue-global-shim.js added as belt-and-braces doc for the
external's shape.
- Add autoprefixer as an explicit viewer devDependency (pnpm 11 no longer
hoists it; the lib build failed on postCSS plugin load).
- Update stale spec type signatures surfaced by the import change (tile
position as EventSource, loadFaction arity, ChargeRequest literal cast,
AvailableCommand data narrowing, FederationInfo new fields).
Verified: engine 750 passing / 4 pending; viewer 809 passing; lint + prettier
clean; rebuilt UMD has zero iterator-spread call sites and loads + completes
sector rotation (with and without rotations) in Chromium against the real
bundle with CDN-provided Vue 2.