@datadog/pprof 6.0.0-pre-fdd7f20 → 6.0.0-pre-90fbe2b

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.
Files changed (146) hide show
  1. package/README.md +2 -6
  2. package/out/src/async-context-frame.d.ts +48 -0
  3. package/out/src/async-context-frame.js +106 -0
  4. package/out/src/async-context-frame.js.map +1 -0
  5. package/out/src/heap-profiler-bindings.d.ts +4 -3
  6. package/out/src/heap-profiler-bindings.js +8 -4
  7. package/out/src/heap-profiler-bindings.js.map +1 -1
  8. package/out/src/heap-profiler.d.ts +48 -21
  9. package/out/src/heap-profiler.js +103 -31
  10. package/out/src/heap-profiler.js.map +1 -1
  11. package/out/src/index.d.ts +10 -0
  12. package/out/src/index.js +14 -1
  13. package/out/src/index.js.map +1 -1
  14. package/out/src/otel-thread-ctx.d.ts +109 -0
  15. package/out/src/otel-thread-ctx.js +166 -0
  16. package/out/src/otel-thread-ctx.js.map +1 -0
  17. package/out/src/profile-serializer.d.ts +26 -3
  18. package/out/src/profile-serializer.js +110 -26
  19. package/out/src/profile-serializer.js.map +1 -1
  20. package/out/src/sourcemapper/sourcemapper.d.ts +38 -7
  21. package/out/src/sourcemapper/sourcemapper.js +265 -75
  22. package/out/src/sourcemapper/sourcemapper.js.map +1 -1
  23. package/out/src/time-profiler.d.ts +21 -3
  24. package/out/src/time-profiler.js +63 -20
  25. package/out/src/time-profiler.js.map +1 -1
  26. package/out/src/v8-types.d.ts +12 -0
  27. package/package.json +44 -23
  28. package/prebuilds/darwin-arm64/dd_pprof.node.abi108.node +0 -0
  29. package/prebuilds/darwin-arm64/dd_pprof.node.abi111.node +0 -0
  30. package/prebuilds/darwin-arm64/dd_pprof.node.abi115.node +0 -0
  31. package/prebuilds/darwin-arm64/dd_pprof.node.abi120.node +0 -0
  32. package/prebuilds/darwin-arm64/dd_pprof.node.abi127.node +0 -0
  33. package/prebuilds/darwin-arm64/dd_pprof.node.abi131.node +0 -0
  34. package/prebuilds/darwin-arm64/dd_pprof.node.abi137.node +0 -0
  35. package/prebuilds/darwin-arm64/dd_pprof.node.abi141.node +0 -0
  36. package/prebuilds/darwin-arm64/dd_pprof.node.abi147.node +0 -0
  37. package/prebuilds/darwin-x64/dd_pprof.node.abi108.node +0 -0
  38. package/prebuilds/darwin-x64/dd_pprof.node.abi111.node +0 -0
  39. package/prebuilds/darwin-x64/dd_pprof.node.abi115.node +0 -0
  40. package/prebuilds/darwin-x64/dd_pprof.node.abi120.node +0 -0
  41. package/prebuilds/darwin-x64/dd_pprof.node.abi127.node +0 -0
  42. package/prebuilds/darwin-x64/dd_pprof.node.abi131.node +0 -0
  43. package/prebuilds/darwin-x64/dd_pprof.node.abi137.node +0 -0
  44. package/prebuilds/darwin-x64/dd_pprof.node.abi141.node +0 -0
  45. package/prebuilds/darwin-x64/dd_pprof.node.abi147.node +0 -0
  46. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi108.node +0 -0
  47. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi111.node +0 -0
  48. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi115.node +0 -0
  49. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi120.node +0 -0
  50. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi127.node +0 -0
  51. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi131.node +0 -0
  52. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi137.node +0 -0
  53. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi141.node +0 -0
  54. package/prebuilds/linux-arm64/dd_pprof.musl.node.abi147.node +0 -0
  55. package/prebuilds/linux-arm64/dd_pprof.node.abi108.node +0 -0
  56. package/prebuilds/linux-arm64/dd_pprof.node.abi111.node +0 -0
  57. package/prebuilds/linux-arm64/dd_pprof.node.abi115.node +0 -0
  58. package/prebuilds/linux-arm64/dd_pprof.node.abi120.node +0 -0
  59. package/prebuilds/linux-arm64/dd_pprof.node.abi127.node +0 -0
  60. package/prebuilds/linux-arm64/dd_pprof.node.abi131.node +0 -0
  61. package/prebuilds/linux-arm64/dd_pprof.node.abi137.node +0 -0
  62. package/prebuilds/linux-arm64/dd_pprof.node.abi141.node +0 -0
  63. package/prebuilds/linux-arm64/dd_pprof.node.abi147.node +0 -0
  64. package/prebuilds/linux-x64/dd_pprof.musl.node.abi108.node +0 -0
  65. package/prebuilds/linux-x64/dd_pprof.musl.node.abi111.node +0 -0
  66. package/prebuilds/linux-x64/dd_pprof.musl.node.abi115.node +0 -0
  67. package/prebuilds/linux-x64/dd_pprof.musl.node.abi120.node +0 -0
  68. package/prebuilds/linux-x64/dd_pprof.musl.node.abi127.node +0 -0
  69. package/prebuilds/linux-x64/dd_pprof.musl.node.abi131.node +0 -0
  70. package/prebuilds/linux-x64/dd_pprof.musl.node.abi137.node +0 -0
  71. package/prebuilds/linux-x64/dd_pprof.musl.node.abi141.node +0 -0
  72. package/prebuilds/linux-x64/dd_pprof.musl.node.abi147.node +0 -0
  73. package/prebuilds/linux-x64/dd_pprof.node.abi108.node +0 -0
  74. package/prebuilds/linux-x64/dd_pprof.node.abi111.node +0 -0
  75. package/prebuilds/linux-x64/dd_pprof.node.abi115.node +0 -0
  76. package/prebuilds/linux-x64/dd_pprof.node.abi120.node +0 -0
  77. package/prebuilds/linux-x64/dd_pprof.node.abi127.node +0 -0
  78. package/prebuilds/linux-x64/dd_pprof.node.abi131.node +0 -0
  79. package/prebuilds/linux-x64/dd_pprof.node.abi137.node +0 -0
  80. package/prebuilds/linux-x64/dd_pprof.node.abi141.node +0 -0
  81. package/prebuilds/linux-x64/dd_pprof.node.abi147.node +0 -0
  82. package/prebuilds/win32-x64/dd_pprof.node.abi108.node +0 -0
  83. package/prebuilds/win32-x64/dd_pprof.node.abi111.node +0 -0
  84. package/prebuilds/win32-x64/dd_pprof.node.abi115.node +0 -0
  85. package/prebuilds/win32-x64/dd_pprof.node.abi120.node +0 -0
  86. package/prebuilds/win32-x64/dd_pprof.node.abi127.node +0 -0
  87. package/prebuilds/win32-x64/dd_pprof.node.abi131.node +0 -0
  88. package/prebuilds/win32-x64/dd_pprof.node.abi137.node +0 -0
  89. package/prebuilds/win32-x64/dd_pprof.node.abi141.node +0 -0
  90. package/prebuilds/win32-x64/dd_pprof.node.abi147.node +0 -0
  91. package/prebuilds/darwin-arm64/node-108.node +0 -0
  92. package/prebuilds/darwin-arm64/node-111.node +0 -0
  93. package/prebuilds/darwin-arm64/node-115.node +0 -0
  94. package/prebuilds/darwin-arm64/node-120.node +0 -0
  95. package/prebuilds/darwin-arm64/node-127.node +0 -0
  96. package/prebuilds/darwin-arm64/node-131.node +0 -0
  97. package/prebuilds/darwin-arm64/node-137.node +0 -0
  98. package/prebuilds/darwin-arm64/node-141.node +0 -0
  99. package/prebuilds/darwin-x64/node-108.node +0 -0
  100. package/prebuilds/darwin-x64/node-111.node +0 -0
  101. package/prebuilds/darwin-x64/node-115.node +0 -0
  102. package/prebuilds/darwin-x64/node-120.node +0 -0
  103. package/prebuilds/darwin-x64/node-127.node +0 -0
  104. package/prebuilds/darwin-x64/node-131.node +0 -0
  105. package/prebuilds/darwin-x64/node-137.node +0 -0
  106. package/prebuilds/darwin-x64/node-141.node +0 -0
  107. package/prebuilds/linuxglibc-arm64/node-108.node +0 -0
  108. package/prebuilds/linuxglibc-arm64/node-111.node +0 -0
  109. package/prebuilds/linuxglibc-arm64/node-115.node +0 -0
  110. package/prebuilds/linuxglibc-arm64/node-120.node +0 -0
  111. package/prebuilds/linuxglibc-arm64/node-127.node +0 -0
  112. package/prebuilds/linuxglibc-arm64/node-131.node +0 -0
  113. package/prebuilds/linuxglibc-arm64/node-137.node +0 -0
  114. package/prebuilds/linuxglibc-arm64/node-141.node +0 -0
  115. package/prebuilds/linuxglibc-x64/node-108.node +0 -0
  116. package/prebuilds/linuxglibc-x64/node-111.node +0 -0
  117. package/prebuilds/linuxglibc-x64/node-115.node +0 -0
  118. package/prebuilds/linuxglibc-x64/node-120.node +0 -0
  119. package/prebuilds/linuxglibc-x64/node-127.node +0 -0
  120. package/prebuilds/linuxglibc-x64/node-131.node +0 -0
  121. package/prebuilds/linuxglibc-x64/node-137.node +0 -0
  122. package/prebuilds/linuxglibc-x64/node-141.node +0 -0
  123. package/prebuilds/linuxmusl-arm64/node-108.node +0 -0
  124. package/prebuilds/linuxmusl-arm64/node-111.node +0 -0
  125. package/prebuilds/linuxmusl-arm64/node-115.node +0 -0
  126. package/prebuilds/linuxmusl-arm64/node-120.node +0 -0
  127. package/prebuilds/linuxmusl-arm64/node-127.node +0 -0
  128. package/prebuilds/linuxmusl-arm64/node-131.node +0 -0
  129. package/prebuilds/linuxmusl-arm64/node-137.node +0 -0
  130. package/prebuilds/linuxmusl-arm64/node-141.node +0 -0
  131. package/prebuilds/linuxmusl-x64/node-108.node +0 -0
  132. package/prebuilds/linuxmusl-x64/node-111.node +0 -0
  133. package/prebuilds/linuxmusl-x64/node-115.node +0 -0
  134. package/prebuilds/linuxmusl-x64/node-120.node +0 -0
  135. package/prebuilds/linuxmusl-x64/node-127.node +0 -0
  136. package/prebuilds/linuxmusl-x64/node-131.node +0 -0
  137. package/prebuilds/linuxmusl-x64/node-137.node +0 -0
  138. package/prebuilds/linuxmusl-x64/node-141.node +0 -0
  139. package/prebuilds/win32-x64/node-108.node +0 -0
  140. package/prebuilds/win32-x64/node-111.node +0 -0
  141. package/prebuilds/win32-x64/node-115.node +0 -0
  142. package/prebuilds/win32-x64/node-120.node +0 -0
  143. package/prebuilds/win32-x64/node-127.node +0 -0
  144. package/prebuilds/win32-x64/node-131.node +0 -0
  145. package/prebuilds/win32-x64/node-137.node +0 -0
  146. package/prebuilds/win32-x64/node-141.node +0 -0
@@ -17,8 +17,10 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.getNativeThreadId = exports.constants = void 0;
19
19
  exports.profile = profile;
20
+ exports.profileV2 = profileV2;
20
21
  exports.start = start;
21
22
  exports.stop = stop;
23
+ exports.stopV2 = stopV2;
22
24
  exports.getState = getState;
23
25
  exports.setContext = setContext;
24
26
  exports.runWithContext = runWithContext;
@@ -39,7 +41,32 @@ let gProfiler;
39
41
  let gStore;
40
42
  let gSourceMapper;
41
43
  let gIntervalMicros;
44
+ let gColumnNumbers = profile_serializer_1.DEFAULT_COLUMN_NUMBERS;
42
45
  let gV8ProfilerStuckEventLoopDetected = 0;
46
+ function handleStopRestart() {
47
+ if (!gProfiler) {
48
+ return;
49
+ }
50
+ gV8ProfilerStuckEventLoopDetected =
51
+ gProfiler.v8ProfilerStuckEventLoopDetected();
52
+ // Workaround for v8 bug, where profiler event processor thread is stuck in
53
+ // a loop eating 100% CPU, leading to empty profiles.
54
+ // Fully stop and restart the profiler to reset the profile to a valid state.
55
+ if (gV8ProfilerStuckEventLoopDetected > 0) {
56
+ gProfiler.stop(false);
57
+ gProfiler.start();
58
+ }
59
+ }
60
+ function handleStopNoRestart() {
61
+ gV8ProfilerStuckEventLoopDetected = 0;
62
+ gProfiler?.dispose();
63
+ gProfiler = undefined;
64
+ gSourceMapper = undefined;
65
+ if (gStore !== undefined) {
66
+ gStore.disable();
67
+ gStore = undefined;
68
+ }
69
+ }
43
70
  /** Make sure to stop profiler before node shuts down, otherwise profiling
44
71
  * signal might cause a crash if it occurs during shutdown */
45
72
  process.once('exit', () => {
@@ -55,6 +82,7 @@ const DEFAULT_OPTIONS = {
55
82
  collectCpuTime: false,
56
83
  collectAsyncId: false,
57
84
  useCPED: false,
85
+ columnNumbers: profile_serializer_1.DEFAULT_COLUMN_NUMBERS,
58
86
  };
59
87
  async function profile(options = {}) {
60
88
  options = { ...DEFAULT_OPTIONS, ...options };
@@ -62,6 +90,12 @@ async function profile(options = {}) {
62
90
  await (0, promises_1.setTimeout)(options.durationMillis);
63
91
  return stop();
64
92
  }
93
+ async function profileV2(options = {}) {
94
+ options = { ...DEFAULT_OPTIONS, ...options };
95
+ start(options);
96
+ await (0, promises_1.setTimeout)(options.durationMillis);
97
+ return stopV2();
98
+ }
65
99
  // Temporarily retained for backwards compatibility with older tracer
66
100
  function start(options = {}) {
67
101
  options = { ...DEFAULT_OPTIONS, ...options };
@@ -72,6 +106,7 @@ function start(options = {}) {
72
106
  gProfiler = new time_profiler_bindings_1.TimeProfiler({ ...options, CPEDKey: store, isMainThread: worker_threads_1.isMainThread });
73
107
  gSourceMapper = options.sourceMapper;
74
108
  gIntervalMicros = options.intervalMicros;
109
+ gColumnNumbers = options.columnNumbers ?? profile_serializer_1.DEFAULT_COLUMN_NUMBERS;
75
110
  gV8ProfilerStuckEventLoopDetected = 0;
76
111
  gProfiler.start();
77
112
  gStore = store;
@@ -86,28 +121,36 @@ function stop(restart = false, generateLabels, lowCardinalityLabels) {
86
121
  }
87
122
  const profile = gProfiler.stop(restart);
88
123
  if (restart) {
89
- gV8ProfilerStuckEventLoopDetected =
90
- gProfiler.v8ProfilerStuckEventLoopDetected();
91
- // Workaround for v8 bug, where profiler event processor thread is stuck in
92
- // a loop eating 100% CPU, leading to empty profiles.
93
- // Fully stop and restart the profiler to reset the profile to a valid state.
94
- if (gV8ProfilerStuckEventLoopDetected > 0) {
95
- gProfiler.stop(false);
96
- gProfiler.start();
97
- }
98
- }
99
- else {
100
- gV8ProfilerStuckEventLoopDetected = 0;
124
+ // Restart the profiler *before* serializing so the cost of serialization is
125
+ // captured in the next profile. handleStopRestart() does not dispose of the
126
+ // source mapper, so the source-map resolution below is unaffected.
127
+ handleStopRestart();
101
128
  }
102
- const serializedProfile = (0, profile_serializer_1.serializeTimeProfile)(profile, gIntervalMicros, gSourceMapper, true, generateLabels, lowCardinalityLabels);
129
+ const serializedProfile = (0, profile_serializer_1.serializeTimeProfile)(profile, gIntervalMicros, gSourceMapper, true, generateLabels, lowCardinalityLabels, gColumnNumbers);
103
130
  if (!restart) {
104
- gProfiler.dispose();
105
- gProfiler = undefined;
106
- gSourceMapper = undefined;
107
- if (gStore !== undefined) {
108
- gStore.disable();
109
- gStore = undefined;
110
- }
131
+ // Tear down *after* serializing: handleStopNoRestart() clears gSourceMapper
132
+ // (and disposes gProfiler), so serializing afterwards would drop source-map
133
+ // resolution and leave transpiled frames pointing at the generated files
134
+ // instead of the original sources.
135
+ handleStopNoRestart();
136
+ }
137
+ return serializedProfile;
138
+ }
139
+ /**
140
+ * Same as stop() but uses the lazy callback path: serialization happens inside
141
+ * a native callback while the V8 profile is still alive.
142
+ * This reduces memory overhead.
143
+ */
144
+ function stopV2(restart = false, generateLabels, lowCardinalityLabels) {
145
+ if (!gProfiler) {
146
+ throw new Error('Wall profiler is not started');
147
+ }
148
+ const serializedProfile = gProfiler.stopAndCollect(restart, (profile) => (0, profile_serializer_1.serializeTimeProfile)(profile, gIntervalMicros, gSourceMapper, true, generateLabels, lowCardinalityLabels, gColumnNumbers));
149
+ if (restart) {
150
+ handleStopRestart();
151
+ }
152
+ else {
153
+ handleStopNoRestart();
111
154
  }
112
155
  return serializedProfile;
113
156
  }
@@ -1 +1 @@
1
- {"version":3,"file":"time-profiler.js","sourceRoot":"","sources":["../../ts/src/time-profiler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAsEH,0BAKC;AAGD,sBAmBC;AAED,oBA0CC;AAED,4BAKC;AAED,gCAKC;AAED,wCAWC;AAED,gCAKC;AAED,gCAKC;AAED,8BAEC;AAGD,4EAEC;AA7LD,8CAA2C;AAE3C,6DAI8B;AAE9B,qEAIkC;AAwL1B,kGA1LN,0CAAiB,OA0LM;AAtLzB,mDAA4C;AAC5C,6CAA8C;AAC9C,MAAM,EAAC,YAAY,EAAC,GAAG,kCAAiB,CAAC;AAEzC,MAAM,uBAAuB,GAAiB,IAAI,CAAC;AACnD,MAAM,uBAAuB,GAAiB,KAAK,CAAC;AAKpD,IAAI,SAAwD,CAAC;AAC7D,IAAI,MAA0C,CAAC;AAC/C,IAAI,aAAuC,CAAC;AAC5C,IAAI,eAA6B,CAAC;AAClC,IAAI,iCAAiC,GAAG,CAAC,CAAC;AAE1C;6DAC6D;AAC7D,OAAO,CAAC,IAAI,CAAC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AC,EAAE,GAAG,IAAI,CAAC,CAAC;AACxE,CAAC;AAED,SAAgB,UAAU;IACxB,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,SAAS,CAAC,OAAO,CAAC;AAC3B,CAAC;AAED,SAAgB,UAAU;IACxB,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,SAAS,CAAC,OAA8B,CAAC;AAClD,CAAC;AAED,SAAgB,SAAS;IACvB,OAAO,CAAC,CAAC,SAAS,CAAC;AACrB,CAAC;AAED,sFAAsF;AACtF,SAAgB,gCAAgC;IAC9C,OAAO,iCAAiC,CAAC;AAC3C,CAAC;AAEY,QAAA,SAAS,GAAG;IACvB,YAAY;IACZ,gCAAgC,EAAhC,qDAAgC;IAChC,4BAA4B,EAA5B,iDAA4B;CAC7B,CAAC"}
@@ -22,6 +22,8 @@ export interface TimeProfile {
22
22
  hasCpuTime?: boolean;
23
23
  /** CPU time of non-JS threads, only reported for the main worker thread */
24
24
  nonJSThreadsCpuTime?: number;
25
+ /** Computed in C++ to avoid a full JS tree traversal. */
26
+ totalHitCount?: number;
25
27
  }
26
28
  export interface ProfileNode {
27
29
  name?: string;
@@ -49,6 +51,16 @@ export interface Allocation {
49
51
  sizeBytes: number;
50
52
  count: number;
51
53
  }
54
+ export interface AllocationWithStats {
55
+ inuseObjects: number;
56
+ inuseSpaceBytes: number;
57
+ allocObjects: number;
58
+ allocSpaceBytes: number;
59
+ }
60
+ export interface AllocationProfileNodeWithStats extends ProfileNode {
61
+ allocations: AllocationWithStats[];
62
+ children: AllocationProfileNodeWithStats[];
63
+ }
52
64
  export interface LabelSet {
53
65
  [key: string]: string | number;
54
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datadog/pprof",
3
- "version": "6.0.0-pre-fdd7f20",
3
+ "version": "6.0.0-pre-90fbe2b",
4
4
  "description": "pprof support for Node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,6 +8,7 @@
8
8
  },
9
9
  "main": "out/src/index.js",
10
10
  "types": "out/src/index.d.ts",
11
+ "gypfile": false,
11
12
  "scripts": {
12
13
  "build:asan": "node-gyp configure build --jobs=max --address_sanitizer",
13
14
  "build:tsan": "node-gyp configure build --jobs=max --thread_sanitizer",
@@ -16,7 +17,6 @@
16
17
  "compile": "tsc -p .",
17
18
  "fix": "gts fix",
18
19
  "format": "clang-format --style file -i --glob='bindings/**/*.{h,hh,cpp,cc}'",
19
- "install": "exit 0",
20
20
  "lint": "jsgl --local . && gts check && clang-format --style file -n -Werror --glob='bindings/**/*.{h,hh,cpp,cc}'",
21
21
  "prepare": "npm run compile && npm run rebuild",
22
22
  "pretest:js-asan": "npm run compile && npm run build:asan",
@@ -29,41 +29,38 @@
29
29
  "test:js-tsan": "LD_PRELOAD=`gcc -print-file-name=libtsan.so` mocha out/test/test-*.js",
30
30
  "test:js-valgrind": "valgrind --leak-check=full mocha out/test/test-*.js",
31
31
  "test:js": "nyc mocha -r source-map-support/register out/test/test-*.js",
32
- "test": "npm run test:js"
32
+ "test": "npm run test:js",
33
+ "test:docker": "./scripts/docker/run-in-docker.sh"
33
34
  },
34
35
  "author": {
35
36
  "name": "Google Inc."
36
37
  },
37
38
  "license": "Apache-2.0",
38
39
  "dependencies": {
39
- "node-gyp-build": "<4.0",
40
- "p-limit": "^3.1.0",
41
- "pprof-format": "^2.2.1",
42
- "source-map": "^0.7.4"
40
+ "node-gyp-build": "^4.8.4",
41
+ "pprof-format": "^2.3.1",
42
+ "source-map": "^0.8.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/mocha": "^10.0.1",
46
- "@types/node": "24.3.3",
47
- "@types/sinon": "^21.0.0",
46
+ "@types/node": "26.2.0",
47
+ "@types/semver": "^7.8.0",
48
+ "@types/sinon": "^22.0.0",
48
49
  "@types/tmp": "^0.2.3",
49
- "@typescript-eslint/eslint-plugin": "^5.60.1",
50
50
  "clang-format": "^1.8.0",
51
51
  "codecov": "^3.8.3",
52
52
  "deep-copy": "^1.4.2",
53
- "eslint-config-standard": "^17.1.0",
54
- "eslint-plugin-import": "^2.26.0",
55
- "eslint-plugin-n": "^16.0.1",
56
- "eslint-plugin-promise": "^6.1.1",
57
- "gts": "^4.0.1",
53
+ "eslint-plugin-n": "^18.3.0",
54
+ "gts": "^7.0.0",
58
55
  "js-green-licenses": "^4.0.0",
59
- "mocha": "^11.7.5",
60
- "nan": "^2.23.1",
61
- "nyc": "^15.1.0",
62
- "semver": "^7.7.4",
63
- "sinon": "^21.0.1",
56
+ "mocha": "^11.8.0",
57
+ "nan": "^2.28.0",
58
+ "nyc": "^18.0.0",
59
+ "semver": "^7.8.5",
60
+ "sinon": "^22.1.0",
64
61
  "source-map-support": "^0.5.21",
65
- "tmp": "0.2.5",
66
- "typescript": "^5.9.3"
62
+ "tmp": "0.2.7",
63
+ "typescript": "^6.0.3"
67
64
  },
68
65
  "files": [
69
66
  "out/src",
@@ -88,5 +85,29 @@
88
85
  "node": ">=16"
89
86
  },
90
87
  "//": "Temporary fix to make nan@2.22.2 work with Node 24",
91
- "postinstall": "sed -i '' 's/^.* Holder() const.*//' ./node_modules/nan/nan_callbacks_12_inl.h"
88
+ "postinstall": "sed -i '' 's/^.* Holder() const.*//' ./node_modules/nan/nan_callbacks_12_inl.h",
89
+ "overrides": {
90
+ "nyc": {
91
+ "brace-expansion": "^5.0.6",
92
+ "js-yaml": "^3.14.2"
93
+ },
94
+ "@typescript-eslint/typescript-estree": {
95
+ "brace-expansion": "^5.0.6"
96
+ },
97
+ "istanbul-lib-processinfo": {
98
+ "brace-expansion": "^5.0.6"
99
+ },
100
+ "spawn-wrap": {
101
+ "brace-expansion": "^5.0.6"
102
+ },
103
+ "test-exclude": {
104
+ "brace-expansion": "^5.0.6"
105
+ },
106
+ "codecov": {
107
+ "js-yaml": "^3.14.2"
108
+ },
109
+ "mocha": {
110
+ "minimatch": "^9.0.9"
111
+ }
112
+ }
92
113
  }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file