Somewhat bizarrely I ended up doing exactly that as a uni project. Writing a parser for the Mapsforge format in TypeScript was a bit of a weird experience. The funkiest bit was trying to get the range request stuff to work properly offline via service workers.
My only regret is not putting more effort into getting WebGL working, I just used the plain canvas and it was a bit of a bottleneck.
PMTiles looks excellent, I think the range request idea will go far.
Just wanted to let you know that the "Live Example Page" link on the page seems to 404.
This is pretty much the idea behind sqlc, with some extra steps of course. You write your SQL queries in file, and it generates type safe bolierplate for you.
Presumably they are using some KDF (Key derivation function) that is designed to be algorithmically slow in some way that you can't trivially sidestep.
My only regret is not putting more effort into getting WebGL working, I just used the plain canvas and it was a bit of a bottleneck.
demo: https://files.george.honeywood.org.uk/final-deliverable/#16/...
blog: https://george.honeywood.org.uk/blog/map-from-the-ground-up/