File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 22#include < future>
33#include < mutex>
44#include < node.h>
5+ #include < node_version.h>
56
67// Platform-specific includes for time functions
78#ifdef _WIN32
@@ -97,6 +98,7 @@ JsStackFrames GetStackFrames(Isolate *isolate) {
9798 return frames;
9899}
99100
101+ #if NODE_MAJOR_VERSION >= 22
100102static std::string ToJSONOrEmpty (Isolate *isolate, v8::Local<v8::Value> value) {
101103 auto context = isolate->GetCurrentContext ();
102104 MaybeLocal<String> maybe_json = v8::JSON::Stringify (context, value);
@@ -109,10 +111,12 @@ static std::string ToJSONOrEmpty(Isolate *isolate, v8::Local<v8::Value> value) {
109111 }
110112 return " " ;
111113}
114+ #endif
112115
113116// Function to fetch the thread state from the async context store
114117std::string GetThreadState (Isolate *isolate,
115118 v8::Global<v8::Value> async_local_storage) {
119+ #if NODE_MAJOR_VERSION >= 22
116120 // Node.js stores the async local storage in the isolate's
117121 // "ContinuationPreservedEmbedderData" map, keyed by the
118122 // AsyncLocalStorage instance.
@@ -129,6 +133,7 @@ std::string GetThreadState(Isolate *isolate,
129133 return ToJSONOrEmpty (isolate, val.ToLocalChecked ());
130134 }
131135 }
136+ #endif
132137
133138 return " " ;
134139}
You can’t perform that action at this time.
0 commit comments