Skip to content

Commit 1847e4f

Browse files
committed
Updates based on last comments.
1 parent 2a5355a commit 1847e4f

File tree

6 files changed

+238
-163
lines changed

6 files changed

+238
-163
lines changed
File renamed without changes.

include/js_native_api.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,14 @@
55
#include <stddef.h> // NOLINT(modernize-deprecated-headers)
66
#include <stdbool.h> // NOLINT(modernize-deprecated-headers)
77

8-
// Use INT_MAX, this should only be consumed by the pre-processor anyway.
9-
#define NAPI_VERSION_EXPERIMENTAL 2147483647
108
#ifndef NAPI_VERSION
11-
#ifdef NAPI_EXPERIMENTAL
12-
#define NAPI_VERSION NAPI_VERSION_EXPERIMENTAL
13-
#else
149
// The baseline version for N-API.
1510
// The NAPI_VERSION controls which version will be used by default when
1611
// compilling a native addon. If the addon developer specifically wants to use
1712
// functions available in a new version of N-API that is not yet ported in all
1813
// LTS versions, they can set NAPI_VERSION knowing that they have specifically
1914
// depended on that version.
20-
#define NAPI_VERSION 7
21-
#endif
15+
#define NAPI_VERSION 8
2216
#endif
2317

2418
#include "js_native_api_types.h"
@@ -539,7 +533,7 @@ NAPI_EXTERN napi_status napi_is_detached_arraybuffer(napi_env env,
539533
bool* result);
540534
#endif // NAPI_VERSION >= 7
541535

542-
#ifdef NAPI_EXPERIMENTAL
536+
#if NAPI_VERSION >= 8
543537
// Type tagging
544538
NAPI_EXTERN napi_status napi_type_tag_object(napi_env env,
545539
napi_value value,
@@ -554,7 +548,7 @@ NAPI_EXTERN napi_status napi_object_freeze(napi_env env,
554548
napi_value object);
555549
NAPI_EXTERN napi_status napi_object_seal(napi_env env,
556550
napi_value object);
557-
#endif // NAPI_EXPERIMENTAL
551+
#endif // NAPI_VERSION >= 8
558552

559553
EXTERN_C_END
560554

include/js_native_api_types.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ typedef enum {
3131
// from instance properties. Ignored by napi_define_properties.
3232
napi_static = 1 << 10,
3333

34-
#ifdef NAPI_EXPERIMENTAL
34+
#if NAPI_VERSION >= 8
3535
// Default for class methods.
3636
napi_default_method = napi_writable | napi_configurable,
3737

3838
// Default for object properties, like in JS obj[prop].
3939
napi_default_jsproperty = napi_writable |
4040
napi_enumerable |
4141
napi_configurable,
42-
#endif // NAPI_EXPERIMENTAL
42+
#endif // NAPI_VERSION >= 8
4343
} napi_property_attributes;
4444

4545
typedef enum {
@@ -150,11 +150,11 @@ typedef enum {
150150
} napi_key_conversion;
151151
#endif // NAPI_VERSION >= 6
152152

153-
#ifdef NAPI_EXPERIMENTAL
153+
#if NAPI_VERSION >= 8
154154
typedef struct {
155155
uint64_t lower;
156156
uint64_t upper;
157157
} napi_type_tag;
158-
#endif // NAPI_EXPERIMENTAL
158+
#endif // NAPI_VERSION >= 8
159159

160160
#endif // SRC_JS_NATIVE_API_TYPES_H_

include/node_api.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ napi_ref_threadsafe_function(napi_env env, napi_threadsafe_function func);
250250

251251
#endif // NAPI_VERSION >= 4
252252

253-
#ifdef NAPI_EXPERIMENTAL
253+
#if NAPI_VERSION >= 8
254254

255255
NAPI_EXTERN napi_status napi_add_async_cleanup_hook(
256256
napi_env env,
@@ -261,7 +261,7 @@ NAPI_EXTERN napi_status napi_add_async_cleanup_hook(
261261
NAPI_EXTERN napi_status napi_remove_async_cleanup_hook(
262262
napi_async_cleanup_hook_handle remove_handle);
263263

264-
#endif // NAPI_EXPERIMENTAL
264+
#endif // NAPI_VERSION >= 8
265265

266266
EXTERN_C_END
267267

include/node_api_types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ typedef struct {
4141
const char* release;
4242
} napi_node_version;
4343

44-
#ifdef NAPI_EXPERIMENTAL
44+
#if NAPI_VERSION >= 8
4545
typedef struct napi_async_cleanup_hook_handle__* napi_async_cleanup_hook_handle;
4646
typedef void (*napi_async_cleanup_hook)(napi_async_cleanup_hook_handle handle,
4747
void* data);
48-
#endif // NAPI_EXPERIMENTAL
48+
#endif // NAPI_VERSION >= 8
4949

5050
#endif // SRC_NODE_API_TYPES_H_

0 commit comments

Comments
 (0)