@auto_js/napi_exports 0.0.6 → 0.0.7

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.
package/CMakeLists.txt CHANGED
@@ -4,8 +4,11 @@ target_compile_features(nodejs PUBLIC cxx_std_23)
4
4
  # Set `NAPI_VERSION` macro
5
5
  if(NOT DEFINED NAPI_VERSION)
6
6
  message(FATAL_ERROR "Missing 'NAPI_VERSION' cmake variable.")
7
+ elseif(NAPI_VERSION STREQUAL EXPERIMENTAL)
8
+ target_compile_definitions(nodejs PUBLIC NAPI_EXPERIMENTAL)
9
+ else()
10
+ target_compile_definitions(nodejs PUBLIC NAPI_VERSION=${NAPI_VERSION})
7
11
  endif()
8
- target_compile_definitions(nodejs PUBLIC NAPI_VERSION=${NAPI_VERSION})
9
12
 
10
13
  # Architecture, for window linkage
11
14
  string(TOLOWER ${CMAKE_HOST_SYSTEM_PROCESSOR} NODE_ARCH)
@@ -65,6 +68,7 @@ target_sources(nodejs
65
68
  PUBLIC FILE_SET CXX_MODULES FILES
66
69
  js_native_api_types.cc
67
70
  js_native_api.cc
71
+ node_api_types.cc
68
72
  node_api.cc
69
73
  nodejs.cc
70
74
  uv.cc
package/js_native_api.cc CHANGED
@@ -1,5 +1,4 @@
1
1
  module;
2
- #include "version.h"
3
2
  // https://nodejs.org/api/n-api.html
4
3
  #include <js_native_api.h>
5
4
  export module nodejs:js_native_api;
@@ -48,6 +47,7 @@ export using ::napi_get_cb_info;
48
47
  export using ::napi_get_dataview_info;
49
48
  export using ::napi_get_date_value;
50
49
  export using ::napi_get_element;
50
+ export using ::napi_get_global;
51
51
  export using ::napi_get_instance_data;
52
52
  export using ::napi_get_null;
53
53
  export using ::napi_get_property_names;
@@ -92,10 +92,12 @@ export using ::napi_type_tag_object;
92
92
  export using ::napi_typeof;
93
93
  export using ::napi_unwrap;
94
94
  export using ::napi_wrap;
95
+ export using ::node_api_create_external_sharedarraybuffer;
95
96
  export using ::node_api_create_property_key_latin1;
96
97
  export using ::node_api_create_property_key_utf16;
97
98
  export using ::node_api_create_property_key_utf8;
98
99
  export using ::node_api_create_syntax_error;
100
+ export using ::node_api_is_sharedarraybuffer;
99
101
  export using ::node_api_throw_syntax_error;
100
102
 
101
103
  // NOLINTEND(misc-unused-using-decls)
@@ -20,7 +20,6 @@ export using ::napi_finalize;
20
20
  export using ::napi_property_descriptor;
21
21
  export using ::napi_type_tag;
22
22
  export using ::node_api_basic_finalize;
23
- export using ::node_api_nogc_finalize;
24
23
 
25
24
  // napi_key_collection_mode
26
25
  export using ::napi_key_collection_mode;
package/node_api.cc CHANGED
@@ -1,13 +1,22 @@
1
1
  module;
2
- #include "version.h"
3
2
  #include <node_api.h>
4
3
  export module nodejs:node_api;
5
4
  // NOLINTBEGIN(misc-unused-using-decls)
6
5
 
6
+ // functions
7
+ export using ::napi_acquire_threadsafe_function;
7
8
  export using ::napi_add_async_cleanup_hook;
8
9
  export using ::napi_add_env_cleanup_hook;
10
+ export using ::napi_add_env_cleanup_hook;
9
11
  export using ::napi_async_cleanup_hook_handle;
12
+ export using ::napi_call_threadsafe_function;
13
+ export using ::napi_create_threadsafe_function;
14
+ export using ::napi_get_threadsafe_function_context;
10
15
  export using ::napi_get_uv_event_loop;
16
+ export using ::napi_ref_threadsafe_function;
17
+ export using ::napi_release_threadsafe_function;
11
18
  export using ::napi_remove_async_cleanup_hook;
19
+ export using ::napi_threadsafe_function_call_js;
20
+ export using ::napi_unref_threadsafe_function;
12
21
 
13
22
  // NOLINTEND(misc-unused-using-decls)
@@ -0,0 +1,20 @@
1
+ module;
2
+ #include <node_api_types.h>
3
+ export module nodejs:node_api_types;
4
+ // NOLINTBEGIN(misc-unused-using-decls)
5
+
6
+ export using ::napi_async_cleanup_hook;
7
+ export using ::napi_cleanup_hook;
8
+ export using ::napi_threadsafe_function;
9
+
10
+ // napi_threadsafe_function_release_mode
11
+ export using ::napi_threadsafe_function_release_mode;
12
+ export using ::napi_tsfn_abort;
13
+ export using ::napi_tsfn_release;
14
+
15
+ // napi_threadsafe_function_call_mode
16
+ export using ::napi_threadsafe_function_call_mode;
17
+ export using ::napi_tsfn_blocking;
18
+ export using ::napi_tsfn_nonblocking;
19
+
20
+ // NOLINTEND(misc-unused-using-decls)
package/nodejs.cc CHANGED
@@ -1,5 +1,6 @@
1
1
  export module nodejs;
2
2
  export import :js_native_api_types;
3
3
  export import :js_native_api;
4
+ export import :node_api_types;
4
5
  export import :node_api;
5
6
  export import :uv;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auto_js/napi_exports",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "C++ module exports for nodejs & n-api",
5
5
  "author": "https://github.com/laverdet/",
6
6
  "homepage": "https://github.com/laverdet/isolated-vm/tree/experimental/packages/third_party/nodejs",
package/version.h CHANGED
@@ -1,10 +1,14 @@
1
1
  #include "node_version.h"
2
+ #ifdef NAPI_VERSION
2
3
  static_assert(NAPI_VERSION <= NODE_API_SUPPORTED_VERSION_MAX, "NAPI version mismatch");
4
+ #endif
3
5
 
4
6
  // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
5
7
  #define NODE_EQ_VERSION_AT_LEAST(major, minor, patch) \
6
8
  (((major) == NODE_MAJOR_VERSION && (minor) < NODE_MINOR_VERSION) || \
7
9
  ((major) == NODE_MAJOR_VERSION && (minor) == NODE_MINOR_VERSION && (patch) <= NODE_PATCH_VERSION))
8
10
 
11
+ #ifdef NAPI_VERSION
9
12
  static_assert(NAPI_VERSION >= 10);
13
+ #endif
10
14
  static_assert(NODE_VERSION_AT_LEAST(23, 6, 0) || NODE_EQ_VERSION_AT_LEAST(22, 14, 0));