Extract `loadReferenceTableData` to separate the raw file loading
logic from the primary key lookup construction. This prevents
unnecessary Map creation during reverse reference resolution.
Implement a reverse lookup cache to avoid re-filtering the entire
referenced table for every row during reverse reference resolution.
This improves performance from O(N*M) to O(N+M) where N is the number
of rows in the current table and M is the number of rows in the
referenced table.
Also update documentation to reflect the new union resolution
behavior and migration notes for version 2.0.0.
Refactor union resolution to explicitly try reference members before
non-reference members. This replaces the previous error-message-based
fallback with a deterministic, structural approach.
- Update `parseValueWithReferences` and `resolveNestedReferences` to
partition members by reference presence.
- Update documentation in `README.md`, `AGENTS.md`, and
`syntax-rework-plan.md` to reflect this behavior.
Replace the custom `ReferenceValueParser` class with the core
`parseValue` function in `reference-resolver.ts`. This simplifies
the logic for parsing reference IDs and ensures consistency with the
rest of the schema parsing engine.
generation
Extract reference resolution logic, type generation, and module
generation into dedicated modules to improve maintainability and
clean up the core loader.