Statoscope extension to store custom reports in stats
npm install @statoscope/stats-extension-custom-reports

Statoscope extension to store custom reports in stats.
A custom report is:
``ts`
export type Report
id: string; // report id
name?: string; // report title
compilation?: string | null; // if specified then a report will be shown only in specific compilation
data?: TData | (() => Promise
view: string | ViewConfig
};
Sometimes we need to make a report with more complex view (e.g. with event handling).
JSON can't handle functions, but you can pass any script source into view-property instead of JSON.
This source will be evaled on client and should return any DiscoveryJS view.
my-custom-report-view.js:
`js`
(() => [
{
view: 'button',
data: {
text: 'Click me',
},
onClick() {
alert('It works!');
},
},
])();
Report config:
`js``
({
id: 'foo',
view: fs.readFileSync('./my-custom-report-view.js', 'utf8')
})