@auto_js/napi_exports 0.0.7 → 0.0.9

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
@@ -5,10 +5,11 @@ target_compile_features(nodejs PUBLIC cxx_std_23)
5
5
  if(NOT DEFINED NAPI_VERSION)
6
6
  message(FATAL_ERROR "Missing 'NAPI_VERSION' cmake variable.")
7
7
  elseif(NAPI_VERSION STREQUAL EXPERIMENTAL)
8
- target_compile_definitions(nodejs PUBLIC NAPI_EXPERIMENTAL)
8
+ target_compile_definitions(nodejs PUBLIC NODE_API_EXPERIMENTAL_NO_WARNING NAPI_EXPERIMENTAL)
9
9
  else()
10
10
  target_compile_definitions(nodejs PUBLIC NAPI_VERSION=${NAPI_VERSION})
11
11
  endif()
12
+ target_compile_options(nodejs PRIVATE "-Wno-#warnings")
12
13
 
13
14
  # Architecture, for window linkage
14
15
  string(TOLOWER ${CMAKE_HOST_SYSTEM_PROCESSOR} NODE_ARCH)
@@ -52,6 +53,7 @@ endif()
52
53
  message(STATUS "Using Node.js headers from '${NODE_DIST_DIR}'")
53
54
 
54
55
  # Configuration
56
+ target_include_directories(nodejs SYSTEM PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
55
57
  target_include_directories(nodejs SYSTEM PUBLIC "${NODE_DIST_DIR}/include/node")
56
58
  if(WIN32)
57
59
  if(EXISTS "${NODE_DIST_DIR}/win-${NODE_ARCH}/node.lib")
package/js_native_api.cc CHANGED
@@ -1,9 +1,14 @@
1
1
  module;
2
+ #include "napi_js/extern.h"
2
3
  // https://nodejs.org/api/n-api.html
3
4
  #include <js_native_api.h>
4
5
  export module nodejs:js_native_api;
6
+ import std;
5
7
  // NOLINTBEGIN(misc-unused-using-decls)
6
8
 
9
+ template <class Result, class... Params>
10
+ constexpr auto unimplemented = [](Params...) -> Result { std::terminate(); };
11
+
7
12
  export using ::napi_add_finalizer;
8
13
  export using ::napi_call_function;
9
14
  export using ::napi_check_object_type_tag;
@@ -92,12 +97,22 @@ export using ::napi_type_tag_object;
92
97
  export using ::napi_typeof;
93
98
  export using ::napi_unwrap;
94
99
  export using ::napi_wrap;
100
+ #ifdef NODE_API_EXPERIMENTAL_HAS_CREATE_EXTERNAL_SHAREDARRAYBUFFER
95
101
  export using ::node_api_create_external_sharedarraybuffer;
102
+ #endif
96
103
  export using ::node_api_create_property_key_latin1;
97
104
  export using ::node_api_create_property_key_utf16;
98
105
  export using ::node_api_create_property_key_utf8;
99
106
  export using ::node_api_create_syntax_error;
107
+ #ifdef NODE_API_EXPERIMENTAL_HAS_SHAREDARRAYBUFFER
108
+ export constexpr auto node_api_has_sharedarraybuffer = true;
100
109
  export using ::node_api_is_sharedarraybuffer;
110
+ #else
111
+ export constexpr auto node_api_has_sharedarraybuffer = false;
112
+ export auto node_api_is_sharedarraybuffer(napi_env, napi_value, bool*) -> napi_status {
113
+ std::terminate();
114
+ };
115
+ #endif
101
116
  export using ::node_api_throw_syntax_error;
102
117
 
103
118
  // NOLINTEND(misc-unused-using-decls)
@@ -1,5 +1,5 @@
1
1
  module;
2
- #include "version.h"
2
+ #include "napi_js/version.h"
3
3
  #include <js_native_api_types.h>
4
4
  export module nodejs:js_native_api_types;
5
5
  // NOLINTBEGIN(misc-unused-using-decls)
@@ -0,0 +1,10 @@
1
+ #if __linux__
2
+ #define NAPI_EXTERN __attribute__((weak))
3
+ #elif __APPLE__
4
+ #define NAPI_EXTERN __attribute__((weak))
5
+ #elif _WIN64
6
+ #define NAPI_EXTERN __declspec(dllimport) __attribute__((weak))
7
+ #else
8
+ #define NAPI_EXTERN
9
+ #endif
10
+ #define UV_EXTERN NAPI_EXTERN
package/node_api.cc CHANGED
@@ -1,4 +1,5 @@
1
1
  module;
2
+ #include "napi_js/extern.h"
2
3
  #include <node_api.h>
3
4
  export module nodejs:node_api;
4
5
  // NOLINTBEGIN(misc-unused-using-decls)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auto_js/napi_exports",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
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/uv.cc CHANGED
@@ -1,5 +1,5 @@
1
1
  module;
2
- #include "version.h"
2
+ #include "napi_js/version.h"
3
3
  #include <uv.h>
4
4
  export module nodejs:uv;
5
5
 
File without changes