From ee2db10d774dc7e7d7cd42a66f56774582e22231 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 5 Jun 2026 17:39:27 +0200 Subject: [PATCH 1/2] src: officially deprecate `node::ObjectWrap` This interface has long been unmaintained and doesn't match current best practices for C++ object management. It's also simply not a good idea to have this header be part of Node.js core; since it is an inline header, user code will depend on the Node.js version it was compiled with, and there is no way to adopt changes to this header independently of changing the target Node.js version. Better userland alternatives exist and have long been more popular, notably, `node-addon-api` and, for use cases where direct V8 API access is required, `nan`. Signed-off-by: Anna Henningsen --- src/node_object_wrap.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/node_object_wrap.h b/src/node_object_wrap.h index 03c986689fd294..f2a619b6fade51 100644 --- a/src/node_object_wrap.h +++ b/src/node_object_wrap.h @@ -27,7 +27,10 @@ namespace node { -class ObjectWrap { +// Legacy interface for tying C++ objects to JavaScript objects. +// This is not intended to be used by new code, and userland alternatives +// should be preferred. +class NODE_DEPRECATED("Use userland alternatives such as node-addon-api or nan instead", ObjectWrap) { public: ObjectWrap() { refs_ = 0; From f19268ae483d3e63503a93b7a5d86a066778f981 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 5 Jun 2026 17:50:54 +0200 Subject: [PATCH 2/2] fixup! src: officially deprecate `node::ObjectWrap` --- src/node_object_wrap.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/node_object_wrap.h b/src/node_object_wrap.h index f2a619b6fade51..0002c25e054261 100644 --- a/src/node_object_wrap.h +++ b/src/node_object_wrap.h @@ -30,7 +30,9 @@ namespace node { // Legacy interface for tying C++ objects to JavaScript objects. // This is not intended to be used by new code, and userland alternatives // should be preferred. -class NODE_DEPRECATED("Use userland alternatives such as node-addon-api or nan instead", ObjectWrap) { +class NODE_DEPRECATED( + "Use userland alternatives such as node-addon-api or nan instead", + ObjectWrap) { public: ObjectWrap() { refs_ = 0;