refactor: prepare custom runtimes
Refactors internal runtime APIs. Preparation for making runtime APIs public for custom runtimes, e.g. Vitest browser mode runtime.
Codebase of piscina is really complex. 😢
excited for this one, it means tinypool browser support soon?
This (and the next PR that actually opens custom runtime API) does expand Tinypool's usage to such use cases. But for Vitest browser mode, @sheremet-va has a bit different idea. Tinypool would be used as orchestrator, and Vitest itself would provide the runtime layer that would use web sockets to communicate with browser entrypoint.
These changes also make it possible to add generic browser support into Tinypool. Pool itself has to run on Node though.