Skip to content

Drop the freezes from the entities and derive their lists uniformly - #142

Merged
yurkimus merged 3 commits into
mainfrom
entities-unfreeze
Sep 7, 2026
Merged

yurkimus merged 3 commits into
mainfrom
entities-unfreeze

Conversation

@yurkimus

@yurkimus yurkimus commented Sep 7, 2026

Copy link
Copy Markdown
Member

Object.freeze carried a runtime cost for a guarantee the definitions never needed, and it is dropped in favour of the const type assertion alone. The derived lists now come from Object.values of their map, the shape game-status.js already used, so the map is the single source and the reduce-based constructions are gone.

Verified: the 139 exports of the package compare equal before and after, none added or removed; the codegen output regenerates byte-identical from the new segment.js and routes.js; typecheck reports no error inside source/entities.

Object.freeze carried a runtime cost for a guarantee the definitions never needed, and it is dropped in favour of the const type assertion alone. The derived lists now come from Object.values of their map, the shape game-status.js already used, so the map is the single source and the reduce-based constructions are gone. The 139 exports of the package compare equal before and after, and the codegen output regenerates unchanged.
Only route.js and tag.js reach source/index.js; the other six were reachable solely through the ./helpers/* subpath and belong to the consumers that use them rather than to the domain definitions. Consumers pin exact versions, so the removal lands with their next bump — url still imports getOwn from helpers/object across its route modules and its codegen, and has to carry those functions itself before it takes this release.
A route without parameters had to be given an empty array anyway, so the array now defaults to one and the type check in front of it is gone. The default covers an explicitly passed undefined as well, which is what url() forwards when its own caller omits the argument.
@yurkimus
yurkimus merged commit be9371e into main Sep 7, 2026
3 checks passed
@yurkimus
yurkimus deleted the entities-unfreeze branch September 7, 2026 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant