dredge
v1.1.1
Published
Import tracer
Downloads
7
Readme
dredge
Import tracer. Learn about loadtime behavior of your app.
/count Resolve and load counts.
/cycle Cycles in list form.
/cycle/dot Cycles in DOT format.
/graph Import graph in list form.
/graph/dot Import graph in DOT format.
/time Link times.
/time/run Evaluation times.
/trace Trace evaluations.
/trace/load Trace loads.
/trace/resolve Trace resolves.
Usage
Install as a dev dependency.
$ npm install --save-dev dredge
Load your app with the desired tracer.
$ node --import dredge/trace app.mjs
/count
Resolve and load counts.
$ node --import dredge/count app.mjs
1179 resolves
567 loads
/cycle
Cycles in list form.
$ node --import dredge/cycle app.mjs
..
d3-transition/src/transition/index.js
d3-transition/src/transition/merge.js
d3-transition/src/transition/index.js
d3-transition/src/transition/index.js
d3-transition/src/transition/select.js
d3-transition/src/transition/index.js
d3-transition/src/transition/index.js
d3-transition/src/transition/selectAll.js
d3-transition/src/transition/index.js
d3-transition/src/transition/index.js
d3-transition/src/transition/transition.js
d3-transition/src/transition/index.js
Found 16 cycles
Give a scope to constrain to cycles through that prefix.
$ node --import dredge/cycle/d3-interpolate app.mjs
d3-interpolate/src/array.js
d3-interpolate/src/value.js
d3-interpolate/src/array.js
d3-interpolate/src/value.js
d3-interpolate/src/object.js
d3-interpolate/src/value.js
Found 2 cycles
/cycle/dot
Cycles in DOT format.
$ node --import dredge/cycle/dot app.mjs
digraph {
"shelljs/shell.js" -> "shelljs/src/common.js"
"shelljs/shell.js" -> "shelljs/src/cat.js"
"shelljs/shell.js" -> "shelljs/src/cd.js"
"shelljs/shell.js" -> "shelljs/src/chmod.js"
"shelljs/shell.js" -> "shelljs/src/cp.js"
"shelljs/shell.js" -> "shelljs/src/dirs.js"
"shelljs/shell.js" -> "shelljs/src/echo.js"
"shelljs/shell.js" -> "shelljs/src/exec.js"
"shelljs/shell.js" -> "shelljs/src/find.js"
"shelljs/shell.js" -> "shelljs/src/grep.js"
"shelljs/shell.js" -> "shelljs/src/head.js"
..
Give a scope to constrain to cycles through that prefix.
$ node --import dredge/cycle/dot/shelljs/src/sort.js app.mjs
digraph {
"shelljs/src/common.js" -> "shelljs/shell.js"
"shelljs/shell.js" -> "shelljs/src/sort.js"
"shelljs/src/sort.js" -> "shelljs/src/common.js"
}
/graph
Import graph in list form. This duplicates a lot where a file is imported from many places.
$ node --import dredge/graph app.mjs
app.mjs
@mui/system/node/index.js
@babel/runtime/helpers/interopRequireDefault.js
@mui/utils/formatMuiErrorMessage/index.js
@babel/runtime/helpers/interopRequireDefault.js
@mui/utils/formatMuiErrorMessage/formatMuiErrorMessage.js
@mui/styled-engine/node/index.js
@babel/runtime/helpers/interopRequireDefault.js
@emotion/styled/dist/emotion-styled.cjs.js
@emotion/styled/base/dist/emotion-styled-base.cjs.js
@babel/runtime/helpers/extends.js
react/index.js
react/cjs/react.development.js
@emotion/is-prop-valid/dist/emotion-is-prop-valid.cjs.js
@emotion/is-prop-valid/dist/emotion-is-prop-valid.cjs.dev.js
@emotion/memoize/dist/emotion-memoize.cjs.js
@emotion/memoize/dist/emotion-memoize.cjs.dev.js
..
/graph/dot
Import graph in DOT format. This is a very large graph in a big app.
$ node --import dredge/graph/dot app.mjs
digraph {
"app.mjs" -> "@mui/system/node/index.js"
"@mui/system/node/index.js" -> "@babel/runtime/helpers/interopRequireDefault.js"
"@mui/system/node/index.js" -> "@mui/utils/formatMuiErrorMessage/index.js"
"@mui/system/node/index.js" -> "@mui/styled-engine/node/index.js"
"@mui/system/node/index.js" -> "@mui/system/node/GlobalStyles/index.js"
"@mui/system/node/index.js" -> "@mui/system/node/borders/index.js"
"@mui/system/node/index.js" -> "@mui/system/node/breakpoints/index.js"
"@mui/system/node/index.js" -> "@mui/system/node/cssContainerQueries/index.js"
"@mui/system/node/index.js" -> "@mui/system/node/compose/index.js"
"@mui/system/node/index.js" -> "@mui/system/node/display/index.js"
"@mui/system/node/index.js" -> "@mui/system/node/flexbox/index.js"
"@mui/system/node/index.js" -> "@mui/system/node/cssGrid/index.js"
"@mui/system/node/index.js" -> "@mui/system/node/palette/index.js"
"@mui/system/node/index.js" -> "@mui/system/node/positions/index.js"
"@mui/system/node/index.js" -> "@mui/system/node/shadows/index.js"
"@mui/system/node/index.js" -> "@mui/system/node/sizing/index.js"
"@mui/system/node/index.js" -> "@mui/system/node/spacing/index.js"
"@mui/system/node/index.js" -> "@mui/system/node/style/index.js"
"@mui/system/node/index.js" -> "@mui/system/node/typography/index.js"
..
/time
Link times in milliseconds. Measured from load of the source to evaluation. This is the amount of time each module spent waiting for its dependencies to load and evaluate. Sorted so you see the slowest modules first.
$ node --import dredge/time app.mjs
..
379.984486 d3-zoom/src/index.js
380.195349 d3-interpolate/src/index.js
380.37713900000006 d3-quadtree/src/index.js
380.428816 d3-time/src/index.js
380.504814 d3-path/src/index.js
380.626629 d3-random/src/index.js
381.09514700000005 d3-time-format/src/index.js
381.67508000000004 d3-polygon/src/index.js
381.869053 d3-scale/src/index.js
382.42282 d3-format/src/index.js
382.430884 d3-drag/src/index.js
382.51914600000003 d3-hierarchy/src/index.js
382.586312 d3-force/src/index.js
382.639768 d3-geo/src/index.js
382.682362 d3-dispatch/src/index.js
382.91214199999996 d3-ease/src/index.js
382.9883470000001 d3-fetch/src/index.js
383.78827 d3-dsv/src/index.js
383.89529799999997 d3-scale-chromatic/src/index.js
384.165281 d3-shape/src/index.js
384.759873 d3-color/src/index.js
384.791527 d3-delaunay/src/index.js
384.89366600000005 d3-axis/src/index.js
385.08829199999997 d3-array/src/index.js
385.19036900000003 d3-contour/src/index.js
385.875983 d3-chord/src/index.js
386.26347899999996 d3-brush/src/index.js
410.07432200000005 d3/src/index.js
412.545461 app.mjs
/time/run
Run times in milliseconds. Measured from start to end of evaluation of the top level scope. Sorted so you see the slowest modules first.
$ node --import dredge/time/run app.mjs
..
19.576925999999958 @mui/utils/useSlotProps/useSlotProps.js
21.377366000000052 @mui/utils/useSlotProps/index.js
24.380135999999993 @mui/system/node/cssGrid/index.js
26.263187000000016 @mui/styled-engine/node/StyledEngineProvider/StyledEngineProvider.js
28.673974999999984 @mui/styled-engine/node/StyledEngineProvider/index.js
32.631294000000025 @mui/system/node/Box/Box.js
33.670199 @emotion/react/dist/emotion-element-b1930563.cjs.js
35.816031000000066 @mui/system/node/Box/index.js
46.254796 @emotion/react/dist/emotion-react.cjs.js
57.30050699999998 @mui/system/node/spacing/spacing.js
60.13973999999996 @mui/system/node/spacing/index.js
60.511188000000004 @mui/system/node/styleFunctionSx/defaultSxConfig.js
63.831079999999986 @mui/system/node/createTheme/createSpacing.js
68.50257699999997 @mui/system/node/styleFunctionSx/styleFunctionSx.js
78.367693 @emotion/styled/base/dist/emotion-styled-base.cjs.js
87.32878 @emotion/styled/dist/emotion-styled.cjs.js
127.203732 @mui/styled-engine/node/index.js
144.540755 @mui/utils/index.js
152.862121 @mui/system/node/createTheme/createTheme.js
156.189688 @mui/system/node/createTheme/index.js
158.80933800000003 @mui/private-theming/node/ThemeProvider/ThemeProvider.js
162.40558800000008 @mui/private-theming/node/ThemeProvider/index.js
164.62663899999995 @mui/private-theming/node/index.js
168.64467100000002 @mui/system/node/useTheme/useTheme.js
172.575738 @mui/system/node/useTheme/index.js
178.717083 @mui/system/node/GlobalStyles/GlobalStyles.js
180.338483 @mui/system/node/GlobalStyles/index.js
180.91544399999998 @mui/system/node/ThemeProvider/ThemeProvider.js
183.90507000000002 @mui/system/node/ThemeProvider/index.js
750.757449 @mui/system/node/index.js
/trace
Trace evaluations. Shows the execution order of your import graph.
$ node --import dredge/trace app.mjs
..
shelljs/src/find.js
shelljs/src/ls.js
shelljs/src/grep.js
shelljs/src/head.js
shelljs/src/ln.js
shelljs/src/mkdir.js
shelljs/src/mv.js
shelljs/src/rm.js
shelljs/src/sed.js
shelljs/src/set.js
shelljs/src/sort.js
shelljs/src/tail.js
shelljs/src/test.js
shelljs/src/to.js
shelljs/src/toEnd.js
shelljs/src/touch.js
shelljs/src/uniq.js
shelljs/src/which.js
shelljs/src/error.js
app.mjs
/trace/load
Trace loads of module source.
$ node --import dredge/trace/load app.mjs
..
node:child_process
shelljs/src/find.js
shelljs/src/ls.js
shelljs/src/grep.js
shelljs/src/head.js
shelljs/src/ln.js
shelljs/src/mkdir.js
shelljs/src/mv.js
shelljs/src/rm.js
shelljs/src/sed.js
shelljs/src/set.js
shelljs/src/sort.js
shelljs/src/tail.js
shelljs/src/test.js
shelljs/src/to.js
shelljs/src/toEnd.js
shelljs/src/touch.js
shelljs/src/uniq.js
shelljs/src/which.js
shelljs/src/error.js
/trace/resolve
Trace resolves. Shows specifier and the importing file.
$ node --import dredge/trace/resolve app.mjs
..
d3-interpolate -> d3-transition/src/transition/style.js
d3-selection -> d3-transition/src/transition/style.js
./schedule.js -> d3-transition/src/transition/style.js
./tween.js -> d3-transition/src/transition/style.js
./interpolate.js -> d3-transition/src/transition/style.js
./index.js -> d3-transition/src/transition/merge.js
./schedule.js -> d3-transition/src/transition/end.js
d3-dispatch -> d3-transition/src/transition/schedule.js
d3-timer -> d3-transition/src/transition/schedule.js
./esm/orient2d.js -> robust-predicates/index.js
./esm/orient3d.js -> robust-predicates/index.js
./esm/incircle.js -> robust-predicates/index.js
./esm/insphere.js -> robust-predicates/index.js
./formatDecimal.js -> d3-format/src/formatRounded.js
d3-color -> d3-transition/src/transition/interpolate.js
d3-interpolate -> d3-transition/src/transition/interpolate.js
./util.js -> robust-predicates/esm/orient2d.js
./util.js -> robust-predicates/esm/orient3d.js
./util.js -> robust-predicates/esm/incircle.js
./util.js -> robust-predicates/esm/insphere.js