Closed amcasey closed 2 years ago
@Ikaer, the diff isn't a lot of fun, but I'd appreciate your feedback on the output.
Hi @amcasey !
I've tried to make it work, but no luck. I've got the following error
PS E:\analyze-typescript> node.exe "E:\analyze-typescript\typescript-analyze-trace-Json\dist\analyze-trace-dir.js" traceDir --json
{
"errors": [
{
"project": {
"tracePath": "traceDir\\trace.json",
"typesPath": "traceDir\\types.json"
},
"exitCode": 2,
"message": "Internal Error: Cannot read property 'path' of undefined\nTypeError: Cannot read property 'path' of undefined\n at getNormalizedPositions (E:\\analyze-typescript\\typescript-analyze-trace-Json\\dist\\analyze-trace-utilities.js:46:37)\n at getHotSpots (E:\\analyze-typescript\\typescript-analyze-trace-Json\\dist\\print-trace-analysis-json.js:47:84)\n at async reportHighlights (E:\\analyze-typescript\\typescript-analyze-trace-Json\\dist\\print-trace-analysis-json.js:18:22)"
}
],
"results": []
}
I've tried with --no-json argument but same problem
PS E:\analyze-typescript> node.exe "E:\analyze-typescript\typescript-analyze-trace-Json\dist\analyze-trace-dir.js" traceDir --no-json
Error analyzing trace.json
Internal Error: Cannot read property 'path' of undefined
TypeError: Cannot read property 'path' of undefined
at getNormalizedPositions (E:\analyze-typescript\typescript-analyze-trace-Json\dist\analyze-trace-utilities.js:46:37)
at printHotStacks (E:\analyze-typescript\typescript-analyze-trace-Json\dist\print-trace-analysis-text.js:58:84)
at async reportHighlights (E:\analyze-typescript\typescript-analyze-trace-Json\dist\print-trace-analysis-text.js:26:25)
I've also tried with the main branch to see if it could be a problem with my trace files, but it works as expected.
PS E:\analyze-typescript> node.exe "E:\analyze-typescript\typescript-analyze-trace-main\dist\analyze-trace-dir.js" traceDir
Hot Spots
├─ Check file d:\workspaces\xlefebvre\customer\royal\middleoffice\sparkowstudio\src\js\frontstudiotabs\frontstudio.ts (1631ms)
├─ Check file d:\workspaces\xlefebvre\customer\royal\middleoffice\sparkowstudio\src\js\components\modules\treeview.ts (1387ms)
├─ Check file d:\workspaces\xlefebvre\customer\royal\middleoffice\sparkowstudio\src\js\commons\navigation\menu\mainsection.ts (1364ms)
[...]
I've joined my trace files if you want to give a try on your side, maybe I've done something wrong while trying to get your specific changeset.
@Ikaer Nah, I'm pretty sure it's just a bug in my change. I had to rearrange a lot of stuff and I probably missed a null check. I'll get things working with your trace and post an update. Thanks!
@Ikaer Should be fixed. Sorry about that!
Fixes #21
TODO: If I were doing this from scratch, I would probably implement JSON as the default output and then have a wrapper that pretty-prints the output as text. As things stand, there are two distinct implementations that share a lot of helper functions. The biggest difference between the two is that JSON nodes use explicit
children
properties (i.e. follow a schema), whereas text output nodes follow treeify's structure (i.e. children are dynamically generated properties on parent node).NB: While JSON is obviously intended for programmatic consumption, please don't take a dependency on the output format yet. Until a non-trivial consumer flushes out the bugs, it can't really be considered stable.