From b9e30ccc1bdba7de1e4c225044d1487161aad77b Mon Sep 17 00:00:00 2001 From: ishabi Date: Tue, 5 May 2026 23:02:34 +0200 Subject: [PATCH] support Node.js v26 --- .github/workflows/ci.yml | 2 +- nan_callbacks_12_inl.h | 29 +++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e12a2c95..a95dd837 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [25.x, 24.x, 23.x, 22.x, 21.x, 20.x, 19.x, 18.x, 17.x, 16.x] + node-version: [26.x, 25.x, 24.x, 23.x, 22.x, 21.x, 20.x, 19.x, 18.x, 17.x, 16.x] os: [windows-latest] include: - node-version: lts/* diff --git a/nan_callbacks_12_inl.h b/nan_callbacks_12_inl.h index ff3b654d..6398b700 100644 --- a/nan_callbacks_12_inl.h +++ b/nan_callbacks_12_inl.h @@ -9,6 +9,13 @@ #ifndef NAN_CALLBACKS_12_INL_H_ #define NAN_CALLBACKS_12_INL_H_ +#if defined(V8_MAJOR_VERSION) && \ + (V8_MAJOR_VERSION > 14 || \ + (V8_MAJOR_VERSION == 14 && \ + defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 6)) +# define NAN_HAS_PROPERTY_CALLBACK_INFO_HOLDER_V2 1 +#endif + template class ReturnValue { v8::ReturnValue value_; @@ -89,6 +96,12 @@ class ReturnValue { inline void Set(S *whatever) { TYPE_CHECK(S*, v8::Primitive); } }; +#if defined(NAN_HAS_PROPERTY_CALLBACK_INFO_HOLDER_V2) +template<> +template +inline void ReturnValue::Set(const v8::Local &) {} +#endif + template class FunctionCallbackInfo { const v8::FunctionCallbackInfo &info_; @@ -159,8 +172,20 @@ class PropertyCallbackInfo { inline v8::Isolate* GetIsolate() const { return info_.GetIsolate(); } inline v8::Local Data() const { return data_; } - inline v8::Local This() const { return info_.This(); } - inline v8::Local Holder() const { return info_.Holder(); } + inline v8::Local This() const { +#if defined(NAN_HAS_PROPERTY_CALLBACK_INFO_HOLDER_V2) + return info_.HolderV2(); +#else + return info_.This(); +#endif + } + inline v8::Local Holder() const { +#if defined(NAN_HAS_PROPERTY_CALLBACK_INFO_HOLDER_V2) + return info_.HolderV2(); +#else + return info_.Holder(); +#endif + } inline ReturnValue GetReturnValue() const { return ReturnValue(info_.GetReturnValue()); }