report-toolkit
report-toolkit copied to clipboard
sorting output should be done in the CLI
Currently, sorting is done in the core API (toReportFromObject), which doesn't make a lot of sense:
- sorting must concatenate the stream to an array, which means there's a bottleneck
- internally, sorting does not matter
- sorting the output only has any bearing on the order of messages output by the inspector
- thus, sorting should be done JIT, which would be JUST BEFORE the formatter gets the data
- and this should happen in the CLI
also, IMO sorting is out-of-scope for non-CLI usage
to do this, you'd need to pull any sort-related anything out of the inspect fn in core/src/observable.js and make it part of the stream in cli/src/commands/inspect.js.
there's a sort() in common/src/observable.js helper fn that may help. if it's not used, remove it.