Open NazariiShvets opened 1 year ago
I see a downside of such a protocol. It would increase bundle size even if you do not use debug operator.
Well, if library really cares about bytes of bundle size, it can extract maping logic into separate utility, so it can be tree-shaked
debug(toDebug(query))
Well, this could be done by separate lib like "my-debuger" 😇 maybe it's excessive to introduce protocol for something that anyway have to be done by a separate lib (because of bundle size)?
Proposal
Create protocol for
debug
operator, so it would be easy to debug factory instancesProblem
Current state of
debug
allows passing flat objects with units todebug
operator But it integrates poorly with libraries likefarfetched
oratomic-router
or any other library which, as result of factory call, returns nested objects (like forms which has form-level units and field-level units) or extra non-unit fields (like meta information or__
namespace for mocking in tests)Solution
Allow libraries to expose units specificly for debuging via this protocol so users can just pass it into
debug
API
It should return object so it could be easy to add meta info for debuging It should be possible to add grouping or prefix for logs, to allow so users could differenciate logs It should be flat object with units for easy integration with
debug
So, something like that
Examples
Atomic-router
Farfetched
Filledout