profiler-md 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "profiler-md",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "author": {
5
5
  "name": "Tomer Aberbach",
6
6
  "email": "tomer@aberba.ch",
package/readme.md CHANGED
@@ -73,18 +73,21 @@ $ profiler-md --help
73
73
  ```js
74
74
  import { readFile } from 'node:fs/promises'
75
75
  import {
76
- defaultIncludeCallFrame,
76
+ defaultIncludeRow,
77
77
  defaultIsThirdPartyURL,
78
78
  v8CpuProfileToMd,
79
79
  v8HeapProfileToMd,
80
+ v8HeapSnapshotToMd,
80
81
  } from 'profiler-md'
81
82
 
82
- const cpuText = await readFile(`profile.cpuprofile`)
83
- const heapText = await readFile(`profile.heapprofile`)
83
+ const cpuProfileData = await readFile(`example.cpuprofile`)
84
+ const heapProfileData = await readFile(`example.heapprofile`)
85
+ const heapSnapshotData = await readFile(`example.heapsnapshot`)
84
86
 
85
87
  // Basic usage
86
- console.log(v8CpuProfileToMd(cpuText))
87
- console.log(v8HeapProfileToMd(heapText))
88
+ console.log(v8CpuProfileToMd(cpuProfileData))
89
+ console.log(v8HeapProfileToMd(heapProfileData))
90
+ console.log(v8HeapSnapshotToMd(heapSnapshotData))
88
91
 
89
92
  // Complex usage
90
93
  const options = {
@@ -96,13 +99,14 @@ const options = {
96
99
  defaultIsThirdPartyURL(url) ||
97
100
  // Treat an additional vendor directory as third-party.
98
101
  url.pathname.includes(`/vendor/`),
99
- includeCallFrame: callFrame =>
100
- defaultIncludeCallFrame(callFrame) &&
101
- // Exclude frames from a specific file.
102
- callFrame.url?.pathname !== `/path/to/project/src/noisy.js`,
102
+ includeRow: row =>
103
+ defaultIncludeRow(row) &&
104
+ // Exclude rows from a specific file.
105
+ !row.location?.includes(`/path/to/project/src/noisy.js`),
103
106
  }
104
- console.log(v8CpuProfileToMd(cpuText, options))
105
- console.log(v8HeapProfileToMd(heapText, options))
107
+ console.log(v8CpuProfileToMd(cpuProfileData, options))
108
+ console.log(v8HeapProfileToMd(heapProfileData, options))
109
+ console.log(v8HeapSnapshotToMd(heapSnapshotData, options))
106
110
  ```
107
111
 
108
112
  ## Contributing