Preferences: Fully serialize compile-time preferences (#61214)
This change resolves some notable gaps in Preferences' tracking of
compile-time dependencies:
1. Preferences tracks only preferences keyed on the active
`__toplevel__` module, despite allowing you to query preferences keyed
on any module / package.
2. Preference changes are checked for by comparing a hash, without a
full value comparison.
This hash comparison was probably something of a premature optimization,
since it is done very rarely and it is impossible to compute the hash
before asking the pkgimage what preferences it depended upon anyway. It
has also led to a few serious bugs.
Resolve this by storing a serialized (TOML) representation of the
compile-time dependencies used in any Module and de-serializing this
upon loading instead.
Fixes https://github.com/JuliaPackaging/Preferences.jl/issues/86. Fixes
https://github.com/JuliaLang/julia/issues/59344. Fixes
https://github.com/JuliaLang/julia/issues/59257.
---------
Co-authored-by: Claude <noreply@anthropic.com>