@auto_js/napi_exports 0.0.1
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 +40 -0
- package/js_native_api.cc +84 -0
- package/js_native_api_types.cc +87 -0
- package/node_api.cc +8 -0
- package/nodejs.cc +5 -0
- package/package.json +12 -0
- package/uv.cc +19 -0
package/CMakeLists.txt
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
add_library(nodejs STATIC)
|
|
2
|
+
target_compile_features(nodejs PUBLIC cxx_std_23)
|
|
3
|
+
|
|
4
|
+
# Set `NAPI_VERSION` macro
|
|
5
|
+
if(NOT DEFINED NAPI_VERSION)
|
|
6
|
+
message(FATAL_ERROR "Missing 'NAPI_VERSION' cmake variable.")
|
|
7
|
+
endif()
|
|
8
|
+
target_compile_definitions(nodejs PUBLIC "NAPI_VERSION=${NAPI_VERSION}")
|
|
9
|
+
|
|
10
|
+
# Acquire or locate nodejs headers
|
|
11
|
+
if(NOT DEFINED NODE_DIST_DIR)
|
|
12
|
+
if(DEFINED ENV{NODE_DIST_DIR})
|
|
13
|
+
set(NODE_DIST_DIR "$ENV{NODE_DIST_DIR}")
|
|
14
|
+
cmake_path(ABSOLUTE_PATH NODE_DIST_DIR BASE_DIRECTORY "${CMAKE_SOURCE_DIR}")
|
|
15
|
+
set(NODE_DIST_DIR "${NODE_DIST_DIR}" CACHE STRING "")
|
|
16
|
+
endif()
|
|
17
|
+
endif()
|
|
18
|
+
if(NOT DEFINED NODE_DIST_DIR)
|
|
19
|
+
include(FetchContent)
|
|
20
|
+
FetchContent_Declare(
|
|
21
|
+
node_headers
|
|
22
|
+
URL https://nodejs.org/download/release/v24.0.0/node-v24.0.0-headers.tar.gz
|
|
23
|
+
)
|
|
24
|
+
FetchContent_MakeAvailable(node_headers)
|
|
25
|
+
set(NODE_DIST_DIR "${node_headers_SOURCE_DIR}" CACHE STRING "")
|
|
26
|
+
endif()
|
|
27
|
+
if(NOT EXISTS "${NODE_DIST_DIR}/include/node/node.h")
|
|
28
|
+
message(FATAL_ERROR "Missing ${NODE_DIST_DIR}/include/node/node.h")
|
|
29
|
+
endif()
|
|
30
|
+
message(STATUS "Using Node.js headers from '${NODE_DIST_DIR}'")
|
|
31
|
+
target_include_directories(nodejs SYSTEM PUBLIC "${NODE_DIST_DIR}/include/node")
|
|
32
|
+
|
|
33
|
+
target_sources(nodejs
|
|
34
|
+
PUBLIC FILE_SET CXX_MODULES FILES
|
|
35
|
+
js_native_api_types.cc
|
|
36
|
+
js_native_api.cc
|
|
37
|
+
node_api.cc
|
|
38
|
+
nodejs.cc
|
|
39
|
+
uv.cc
|
|
40
|
+
)
|
package/js_native_api.cc
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
module;
|
|
2
|
+
#include <js_native_api.h>
|
|
3
|
+
export module nodejs:js_native_api;
|
|
4
|
+
// NOLINTBEGIN(misc-unused-using-decls)
|
|
5
|
+
|
|
6
|
+
export using ::napi_add_finalizer;
|
|
7
|
+
export using ::napi_call_function;
|
|
8
|
+
export using ::napi_check_object_type_tag;
|
|
9
|
+
export using ::napi_close_handle_scope;
|
|
10
|
+
export using ::napi_coerce_to_bool;
|
|
11
|
+
export using ::napi_coerce_to_object;
|
|
12
|
+
export using ::napi_create_array_with_length;
|
|
13
|
+
export using ::napi_create_array;
|
|
14
|
+
export using ::napi_create_bigint_int64;
|
|
15
|
+
export using ::napi_create_bigint_uint64;
|
|
16
|
+
export using ::napi_create_bigint_words;
|
|
17
|
+
export using ::napi_create_date;
|
|
18
|
+
export using ::napi_create_double;
|
|
19
|
+
export using ::napi_create_error;
|
|
20
|
+
export using ::napi_create_external;
|
|
21
|
+
export using ::napi_create_function;
|
|
22
|
+
export using ::napi_create_int32;
|
|
23
|
+
export using ::napi_create_int64;
|
|
24
|
+
export using ::napi_create_object;
|
|
25
|
+
export using ::napi_create_promise;
|
|
26
|
+
export using ::napi_create_range_error;
|
|
27
|
+
export using ::napi_create_reference;
|
|
28
|
+
export using ::napi_create_string_latin1;
|
|
29
|
+
export using ::napi_create_string_utf16;
|
|
30
|
+
export using ::napi_create_string_utf8;
|
|
31
|
+
export using ::napi_create_type_error;
|
|
32
|
+
export using ::napi_create_uint32;
|
|
33
|
+
export using ::napi_define_class;
|
|
34
|
+
export using ::napi_define_properties;
|
|
35
|
+
export using ::napi_delete_reference;
|
|
36
|
+
export using ::napi_get_and_clear_last_exception;
|
|
37
|
+
export using ::napi_get_array_length;
|
|
38
|
+
export using ::napi_get_boolean;
|
|
39
|
+
export using ::napi_get_cb_info;
|
|
40
|
+
export using ::napi_get_date_value;
|
|
41
|
+
export using ::napi_get_element;
|
|
42
|
+
export using ::napi_get_instance_data;
|
|
43
|
+
export using ::napi_get_null;
|
|
44
|
+
export using ::napi_get_property_names;
|
|
45
|
+
export using ::napi_get_property;
|
|
46
|
+
export using ::napi_get_reference_value;
|
|
47
|
+
export using ::napi_get_undefined;
|
|
48
|
+
export using ::napi_get_value_bigint_int64;
|
|
49
|
+
export using ::napi_get_value_bigint_uint64;
|
|
50
|
+
export using ::napi_get_value_bigint_words;
|
|
51
|
+
export using ::napi_get_value_bool;
|
|
52
|
+
export using ::napi_get_value_double;
|
|
53
|
+
export using ::napi_get_value_external;
|
|
54
|
+
export using ::napi_get_value_int32;
|
|
55
|
+
export using ::napi_get_value_int64;
|
|
56
|
+
export using ::napi_get_value_string_latin1;
|
|
57
|
+
export using ::napi_get_value_string_utf16;
|
|
58
|
+
export using ::napi_get_value_string_utf8;
|
|
59
|
+
export using ::napi_get_value_uint32;
|
|
60
|
+
export using ::napi_has_own_property;
|
|
61
|
+
export using ::napi_is_array;
|
|
62
|
+
export using ::napi_is_date;
|
|
63
|
+
export using ::napi_is_promise;
|
|
64
|
+
export using ::napi_new_instance;
|
|
65
|
+
export using ::napi_open_handle_scope;
|
|
66
|
+
export using ::napi_reference_ref;
|
|
67
|
+
export using ::napi_reference_unref;
|
|
68
|
+
export using ::napi_reject_deferred;
|
|
69
|
+
export using ::napi_resolve_deferred;
|
|
70
|
+
export using ::napi_set_element;
|
|
71
|
+
export using ::napi_set_instance_data;
|
|
72
|
+
export using ::napi_set_property;
|
|
73
|
+
export using ::napi_throw_type_error;
|
|
74
|
+
export using ::napi_throw;
|
|
75
|
+
export using ::napi_type_tag_object;
|
|
76
|
+
export using ::napi_typeof;
|
|
77
|
+
export using ::napi_unwrap;
|
|
78
|
+
export using ::napi_wrap;
|
|
79
|
+
export using ::node_api_create_property_key_latin1;
|
|
80
|
+
export using ::node_api_create_property_key_utf16;
|
|
81
|
+
export using ::node_api_create_property_key_utf8;
|
|
82
|
+
export using ::node_api_create_syntax_error;
|
|
83
|
+
|
|
84
|
+
// NOLINTEND(misc-unused-using-decls)
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
module;
|
|
2
|
+
#include <js_native_api_types.h>
|
|
3
|
+
export module nodejs:js_native_api_types;
|
|
4
|
+
// NOLINTBEGIN(misc-unused-using-decls)
|
|
5
|
+
|
|
6
|
+
export using ::napi_env;
|
|
7
|
+
export using ::node_api_basic_env;
|
|
8
|
+
|
|
9
|
+
export using ::napi_callback_info;
|
|
10
|
+
export using ::napi_deferred;
|
|
11
|
+
export using ::napi_escapable_handle_scope;
|
|
12
|
+
export using ::napi_handle_scope;
|
|
13
|
+
export using ::napi_ref;
|
|
14
|
+
export using ::napi_value;
|
|
15
|
+
|
|
16
|
+
export using ::napi_callback;
|
|
17
|
+
export using ::napi_extended_error_info;
|
|
18
|
+
export using ::napi_finalize;
|
|
19
|
+
export using ::napi_property_descriptor;
|
|
20
|
+
export using ::napi_type_tag;
|
|
21
|
+
export using ::node_api_basic_finalize;
|
|
22
|
+
export using ::node_api_nogc_finalize;
|
|
23
|
+
|
|
24
|
+
// napi_valuetype
|
|
25
|
+
export using ::napi_valuetype;
|
|
26
|
+
export using ::napi_bigint;
|
|
27
|
+
export using ::napi_boolean;
|
|
28
|
+
export using ::napi_external;
|
|
29
|
+
export using ::napi_function;
|
|
30
|
+
export using ::napi_null;
|
|
31
|
+
export using ::napi_number;
|
|
32
|
+
export using ::napi_object;
|
|
33
|
+
export using ::napi_string;
|
|
34
|
+
export using ::napi_symbol;
|
|
35
|
+
export using ::napi_undefined;
|
|
36
|
+
|
|
37
|
+
// napi_typedarray_type
|
|
38
|
+
export using ::napi_typedarray_type;
|
|
39
|
+
export using ::napi_bigint64_array;
|
|
40
|
+
export using ::napi_biguint64_array;
|
|
41
|
+
export using ::napi_float32_array;
|
|
42
|
+
export using ::napi_float64_array;
|
|
43
|
+
export using ::napi_int16_array;
|
|
44
|
+
export using ::napi_int32_array;
|
|
45
|
+
export using ::napi_int8_array;
|
|
46
|
+
export using ::napi_typedarray_type;
|
|
47
|
+
export using ::napi_uint16_array;
|
|
48
|
+
export using ::napi_uint32_array;
|
|
49
|
+
export using ::napi_uint8_array;
|
|
50
|
+
export using ::napi_uint8_clamped_array;
|
|
51
|
+
|
|
52
|
+
// napi_status
|
|
53
|
+
export using ::napi_status;
|
|
54
|
+
export using ::napi_array_expected;
|
|
55
|
+
export using ::napi_arraybuffer_expected;
|
|
56
|
+
export using ::napi_bigint_expected;
|
|
57
|
+
export using ::napi_boolean_expected;
|
|
58
|
+
export using ::napi_callback_scope_mismatch;
|
|
59
|
+
export using ::napi_cancelled;
|
|
60
|
+
export using ::napi_cannot_run_js;
|
|
61
|
+
export using ::napi_closing;
|
|
62
|
+
export using ::napi_date_expected;
|
|
63
|
+
export using ::napi_detachable_arraybuffer_expected;
|
|
64
|
+
export using ::napi_escape_called_twice;
|
|
65
|
+
export using ::napi_function_expected;
|
|
66
|
+
export using ::napi_generic_failure;
|
|
67
|
+
export using ::napi_handle_scope_mismatch;
|
|
68
|
+
export using ::napi_invalid_arg;
|
|
69
|
+
export using ::napi_name_expected;
|
|
70
|
+
export using ::napi_no_external_buffers_allowed;
|
|
71
|
+
export using ::napi_number_expected;
|
|
72
|
+
export using ::napi_object_expected;
|
|
73
|
+
export using ::napi_ok;
|
|
74
|
+
export using ::napi_pending_exception;
|
|
75
|
+
export using ::napi_queue_full;
|
|
76
|
+
export using ::napi_string_expected;
|
|
77
|
+
export using ::napi_would_deadlock;
|
|
78
|
+
|
|
79
|
+
// napi_property_attributes
|
|
80
|
+
export using ::napi_property_attributes;
|
|
81
|
+
export using ::napi_default;
|
|
82
|
+
export using ::napi_writable;
|
|
83
|
+
export using ::napi_enumerable;
|
|
84
|
+
export using ::napi_configurable;
|
|
85
|
+
export using ::napi_static;
|
|
86
|
+
|
|
87
|
+
// NOLINTEND(misc-unused-using-decls)
|
package/node_api.cc
ADDED
package/nodejs.cc
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@auto_js/napi_exports",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "C++ module exports for nodejs & n-api",
|
|
5
|
+
"author": "https://github.com/laverdet/",
|
|
6
|
+
"homepage": "https://github.com/laverdet/isolated-vm/tree/experimental/packages/third_party/nodejs",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/laverdet/isolated-vm.git"
|
|
11
|
+
}
|
|
12
|
+
}
|
package/uv.cc
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module;
|
|
2
|
+
#include <uv.h>
|
|
3
|
+
export module nodejs:uv;
|
|
4
|
+
|
|
5
|
+
// NOLINTBEGIN(misc-unused-using-decls)
|
|
6
|
+
|
|
7
|
+
export using ::uv_async_t;
|
|
8
|
+
export using ::uv_handle_t;
|
|
9
|
+
export using ::uv_handle_type;
|
|
10
|
+
export using ::uv_loop_t;
|
|
11
|
+
|
|
12
|
+
export using ::uv_async_init;
|
|
13
|
+
export using ::uv_async_send;
|
|
14
|
+
export using ::uv_close;
|
|
15
|
+
export using ::uv_is_active;
|
|
16
|
+
export using ::uv_ref;
|
|
17
|
+
export using ::uv_unref;
|
|
18
|
+
|
|
19
|
+
// NOLINTEND(misc-unused-using-decls)
|