Should texture parsers be public API?
Currently, we have the following classes exposed in the API reference:
-
TextureParser -
BasisParser -
DdsParser -
HdrParser -
ImgParser -
KtxParser -
Ktx2Parser
Instances of these classes are created in the TextureHandler constructor and saved to TextureHandler#parsers:
https://github.com/playcanvas/engine/blob/62c1c7fab8df8ab03ab6a42a54ce04fdde77fda4/src/framework/handlers/texture.js#L141-L147
But this object is not public API. So the question is:
- Should we expose
TextureHandler#parsersas public API? - Or should we hide the various parsers from the public API?
There is some benefit of exposing it, and allowing this to be configured. As number of parsers are likely to only grow. It will allow some code stripping.
At the moment, AppBase initialization allows you to register the component systems and resource handlers you use to facilitate treeshaking. Allowing treeshaking that is essentially one extra level down seems like a real microoptimization, IMHO. Personally, I'd prefer a leaner, meaner public API.