koffi 2.7.2 → 2.7.4-beta.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/CHANGELOG.md +4 -0
- package/build/koffi/darwin_arm64/koffi.node +0 -0
- package/build/koffi/darwin_x64/koffi.node +0 -0
- package/build/koffi/freebsd_arm64/koffi.node +0 -0
- package/build/koffi/freebsd_ia32/koffi.node +0 -0
- package/build/koffi/freebsd_x64/koffi.node +0 -0
- package/build/koffi/linux_arm32hf/koffi.node +0 -0
- package/build/koffi/linux_arm64/koffi.node +0 -0
- package/build/koffi/linux_ia32/koffi.node +0 -0
- package/build/koffi/linux_riscv64hf64/koffi.node +0 -0
- package/build/koffi/linux_x64/koffi.node +0 -0
- package/build/koffi/openbsd_ia32/koffi.node +0 -0
- package/build/koffi/openbsd_x64/koffi.node +0 -0
- package/build/koffi/win32_arm64/koffi.node +0 -0
- package/build/koffi/win32_ia32/koffi.node +0 -0
- package/build/koffi/win32_x64/koffi.node +0 -0
- package/doc/misc.md +1 -1
- package/index.js +2 -2
- package/indirect.js +2 -2
- package/package.json +2 -2
- package/src/koffi/src/abi_arm32.cc +4 -4
- package/src/koffi/src/abi_arm64.cc +4 -4
- package/src/koffi/src/abi_riscv64.cc +4 -4
- package/src/koffi/src/abi_x64_sysv.cc +4 -4
- package/src/koffi/src/abi_x64_win.cc +4 -4
- package/src/koffi/src/abi_x86.cc +4 -4
- package/src/koffi/src/call.cc +6 -6
- package/src/koffi/src/call.hh +2 -2
- package/src/koffi/src/ffi.cc +0 -9
- package/src/koffi/src/ffi.hh +0 -1
- package/src/koffi/src/util.cc +7 -13
- package/src/koffi/src/util.hh +9 -1
- package/vendor/node-addon-api/CHANGELOG.md +76 -0
- package/vendor/node-addon-api/LICENSE.md +2 -6
- package/vendor/node-addon-api/README.md +10 -9
- package/vendor/node-addon-api/benchmark/binding.gyp +4 -4
- package/vendor/node-addon-api/common.gypi +1 -2
- package/vendor/node-addon-api/doc/array.md +1 -1
- package/vendor/node-addon-api/doc/async_worker_variants.md +16 -16
- package/vendor/node-addon-api/doc/cmake-js.md +1 -1
- package/vendor/node-addon-api/doc/env.md +11 -0
- package/vendor/node-addon-api/doc/hierarchy.md +2 -0
- package/vendor/node-addon-api/doc/setup.md +53 -71
- package/vendor/node-addon-api/doc/syntax_error.md +66 -0
- package/vendor/node-addon-api/doc/value.md +2 -0
- package/vendor/node-addon-api/index.js +2 -1
- package/vendor/node-addon-api/napi-inl.h +68 -65
- package/vendor/node-addon-api/napi.h +15 -5
- package/vendor/node-addon-api/node_addon_api.gyp +32 -0
- package/vendor/node-addon-api/package.json +14 -3
- package/vendor/node-addon-api/test/addon.cc +7 -1
- package/vendor/node-addon-api/test/addon.js +5 -9
- package/vendor/node-addon-api/test/addon_data.cc +3 -3
- package/vendor/node-addon-api/test/addon_data.js +16 -38
- package/vendor/node-addon-api/test/bigint.cc +0 -1
- package/vendor/node-addon-api/test/binding.cc +12 -1
- package/vendor/node-addon-api/test/binding.gyp +10 -8
- package/vendor/node-addon-api/test/child_processes/addon.js +11 -0
- package/vendor/node-addon-api/test/child_processes/addon_data.js +24 -0
- package/vendor/node-addon-api/test/child_processes/objectwrap_function.js +22 -0
- package/vendor/node-addon-api/test/child_processes/threadsafe_function_exception.js +33 -0
- package/vendor/node-addon-api/test/child_processes/typed_threadsafe_function_exception.js +19 -0
- package/vendor/node-addon-api/test/common/index.js +57 -3
- package/vendor/node-addon-api/test/env_misc.cc +25 -0
- package/vendor/node-addon-api/test/env_misc.js +12 -0
- package/vendor/node-addon-api/test/error.cc +47 -0
- package/vendor/node-addon-api/test/error.js +16 -0
- package/vendor/node-addon-api/test/index.js +5 -0
- package/vendor/node-addon-api/test/objectwrap_function.cc +10 -12
- package/vendor/node-addon-api/test/objectwrap_function.js +4 -20
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_exception.cc +50 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_exception.js +20 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_exception.cc +39 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_exception.js +13 -0
package/CHANGELOG.md
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/doc/misc.md
CHANGED
|
@@ -69,7 +69,7 @@ You can alias a type with `koffi.alias(name, type)`. Aliased types are completel
|
|
|
69
69
|
For synchronous/normal calls, Koffi uses two preallocated memory blocks:
|
|
70
70
|
|
|
71
71
|
- One to construct the C stack and assign registers, subsequently used by the platform-specific assembly code (1 MiB by default)
|
|
72
|
-
- One to allocate strings and
|
|
72
|
+
- One to allocate strings and objects/structs (2 MiB by default)
|
|
73
73
|
|
|
74
74
|
Unless very big strings or objects (at least more than one page of memory) are used, Koffi does not directly allocate any extra memory during calls or callbacks. However, please note that the JS engine (V8) might.
|
|
75
75
|
|
package/index.js
CHANGED
|
@@ -378,8 +378,8 @@ var require_package = __commonJS({
|
|
|
378
378
|
"build/dist/src/koffi/package.json"(exports2, module2) {
|
|
379
379
|
module2.exports = {
|
|
380
380
|
name: "koffi",
|
|
381
|
-
version: "2.7.
|
|
382
|
-
stable: "2.7.
|
|
381
|
+
version: "2.7.4-beta.1",
|
|
382
|
+
stable: "2.7.3",
|
|
383
383
|
description: "Fast and simple C FFI (foreign function interface) for Node.js",
|
|
384
384
|
keywords: [
|
|
385
385
|
"foreign",
|
package/indirect.js
CHANGED
|
@@ -378,8 +378,8 @@ var require_package = __commonJS({
|
|
|
378
378
|
"build/dist/src/koffi/package.json"(exports2, module2) {
|
|
379
379
|
module2.exports = {
|
|
380
380
|
name: "koffi",
|
|
381
|
-
version: "2.7.
|
|
382
|
-
stable: "2.7.
|
|
381
|
+
version: "2.7.4-beta.1",
|
|
382
|
+
stable: "2.7.3",
|
|
383
383
|
description: "Fast and simple C FFI (foreign function interface) for Node.js",
|
|
384
384
|
keywords: [
|
|
385
385
|
"foreign",
|
package/package.json
CHANGED
|
@@ -564,7 +564,7 @@ Napi::Value CallData::Complete(const FunctionInfo *func)
|
|
|
564
564
|
RG_UNREACHABLE();
|
|
565
565
|
}
|
|
566
566
|
|
|
567
|
-
void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool
|
|
567
|
+
void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_stack, BackRegisters *out_reg)
|
|
568
568
|
{
|
|
569
569
|
if (env.IsExceptionPending()) [[unlikely]]
|
|
570
570
|
return;
|
|
@@ -827,11 +827,11 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool async,
|
|
|
827
827
|
|
|
828
828
|
// Make the call
|
|
829
829
|
napi_value ret;
|
|
830
|
-
if (
|
|
831
|
-
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
832
|
-
} else {
|
|
830
|
+
if (switch_stack) {
|
|
833
831
|
ret = CallSwitchStack(&func, (size_t)arguments.len, arguments.data, old_sp, &mem->stack,
|
|
834
832
|
[](Napi::Function *func, size_t argc, napi_value *argv) { return (napi_value)func->Call(argv[0], argc - 1, argv + 1); });
|
|
833
|
+
} else {
|
|
834
|
+
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
835
835
|
}
|
|
836
836
|
Napi::Value value(env, ret);
|
|
837
837
|
|
|
@@ -709,7 +709,7 @@ Napi::Value CallData::Complete(const FunctionInfo *func)
|
|
|
709
709
|
RG_UNREACHABLE();
|
|
710
710
|
}
|
|
711
711
|
|
|
712
|
-
void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool
|
|
712
|
+
void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_stack, BackRegisters *out_reg)
|
|
713
713
|
{
|
|
714
714
|
if (env.IsExceptionPending()) [[unlikely]]
|
|
715
715
|
return;
|
|
@@ -1143,11 +1143,11 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool async,
|
|
|
1143
1143
|
|
|
1144
1144
|
// Make the call
|
|
1145
1145
|
napi_value ret;
|
|
1146
|
-
if (
|
|
1147
|
-
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
1148
|
-
} else {
|
|
1146
|
+
if (switch_stack) {
|
|
1149
1147
|
ret = CallSwitchStack(&func, (size_t)arguments.len, arguments.data, old_sp, &mem->stack,
|
|
1150
1148
|
[](Napi::Function *func, size_t argc, napi_value *argv) { return (napi_value)func->Call(argv[0], argc - 1, argv + 1); });
|
|
1149
|
+
} else {
|
|
1150
|
+
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
1151
1151
|
}
|
|
1152
1152
|
Napi::Value value(env, ret);
|
|
1153
1153
|
|
|
@@ -506,7 +506,7 @@ Napi::Value CallData::Complete(const FunctionInfo *func)
|
|
|
506
506
|
RG_UNREACHABLE();
|
|
507
507
|
}
|
|
508
508
|
|
|
509
|
-
void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool
|
|
509
|
+
void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_stack, BackRegisters *out_reg)
|
|
510
510
|
{
|
|
511
511
|
if (env.IsExceptionPending()) [[unlikely]]
|
|
512
512
|
return;
|
|
@@ -740,11 +740,11 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool async,
|
|
|
740
740
|
|
|
741
741
|
// Make the call
|
|
742
742
|
napi_value ret;
|
|
743
|
-
if (
|
|
744
|
-
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
745
|
-
} else {
|
|
743
|
+
if (switch_stack) {
|
|
746
744
|
ret = CallSwitchStack(&func, (size_t)arguments.len, arguments.data, old_sp, &mem->stack,
|
|
747
745
|
[](Napi::Function *func, size_t argc, napi_value *argv) { return (napi_value)func->Call(argv[0], argc - 1, argv + 1); });
|
|
746
|
+
} else {
|
|
747
|
+
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
748
748
|
}
|
|
749
749
|
Napi::Value value(env, ret);
|
|
750
750
|
|
|
@@ -541,7 +541,7 @@ Napi::Value CallData::Complete(const FunctionInfo *func)
|
|
|
541
541
|
RG_UNREACHABLE();
|
|
542
542
|
}
|
|
543
543
|
|
|
544
|
-
void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool
|
|
544
|
+
void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_stack, BackRegisters *out_reg)
|
|
545
545
|
{
|
|
546
546
|
if (env.IsExceptionPending()) [[unlikely]]
|
|
547
547
|
return;
|
|
@@ -764,11 +764,11 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool async,
|
|
|
764
764
|
|
|
765
765
|
// Make the call
|
|
766
766
|
napi_value ret;
|
|
767
|
-
if (
|
|
768
|
-
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
769
|
-
} else {
|
|
767
|
+
if (switch_stack) {
|
|
770
768
|
ret = CallSwitchStack(&func, (size_t)arguments.len, arguments.data, old_sp, &mem->stack,
|
|
771
769
|
[](Napi::Function *func, size_t argc, napi_value *argv) { return (napi_value)func->Call(argv[0], argc - 1, argv + 1); });
|
|
770
|
+
} else {
|
|
771
|
+
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
772
772
|
}
|
|
773
773
|
Napi::Value value(env, ret);
|
|
774
774
|
|
|
@@ -350,7 +350,7 @@ Napi::Value CallData::Complete(const FunctionInfo *func)
|
|
|
350
350
|
RG_UNREACHABLE();
|
|
351
351
|
}
|
|
352
352
|
|
|
353
|
-
void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool
|
|
353
|
+
void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_stack, BackRegisters *out_reg)
|
|
354
354
|
{
|
|
355
355
|
if (env.IsExceptionPending()) [[unlikely]]
|
|
356
356
|
return;
|
|
@@ -587,11 +587,11 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool async,
|
|
|
587
587
|
|
|
588
588
|
// Make the call
|
|
589
589
|
napi_value ret;
|
|
590
|
-
if (
|
|
591
|
-
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
592
|
-
} else {
|
|
590
|
+
if (switch_stack) {
|
|
593
591
|
ret = CallSwitchStack(&func, (size_t)arguments.len, arguments.data, old_sp, &mem->stack,
|
|
594
592
|
[](Napi::Function *func, size_t argc, napi_value *argv) { return (napi_value)func->Call(argv[0], argc - 1, argv + 1); });
|
|
593
|
+
} else {
|
|
594
|
+
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
595
595
|
}
|
|
596
596
|
Napi::Value value(env, ret);
|
|
597
597
|
|
package/src/koffi/src/abi_x86.cc
CHANGED
|
@@ -464,7 +464,7 @@ Napi::Value CallData::Complete(const FunctionInfo *func)
|
|
|
464
464
|
RG_UNREACHABLE();
|
|
465
465
|
}
|
|
466
466
|
|
|
467
|
-
void CallData::Relay(Size idx, uint8_t *, uint8_t *caller_sp, bool
|
|
467
|
+
void CallData::Relay(Size idx, uint8_t *, uint8_t *caller_sp, bool switch_stack, BackRegisters *out_reg)
|
|
468
468
|
{
|
|
469
469
|
if (env.IsExceptionPending()) [[unlikely]]
|
|
470
470
|
return;
|
|
@@ -700,11 +700,11 @@ void CallData::Relay(Size idx, uint8_t *, uint8_t *caller_sp, bool async, BackRe
|
|
|
700
700
|
|
|
701
701
|
// Make the call
|
|
702
702
|
napi_value ret;
|
|
703
|
-
if (
|
|
704
|
-
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
705
|
-
} else {
|
|
703
|
+
if (switch_stack) {
|
|
706
704
|
ret = CallSwitchStack(&func, (size_t)arguments.len, arguments.data, old_sp, &mem->stack,
|
|
707
705
|
[](Napi::Function *func, size_t argc, napi_value *argv) { return (napi_value)func->Call(argv[0], argc - 1, argv + 1); });
|
|
706
|
+
} else {
|
|
707
|
+
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
708
708
|
}
|
|
709
709
|
Napi::Value value(env, ret);
|
|
710
710
|
|
package/src/koffi/src/call.cc
CHANGED
|
@@ -101,7 +101,7 @@ void CallData::Dispose()
|
|
|
101
101
|
instance = nullptr;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
void CallData::RelaySafe(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool
|
|
104
|
+
void CallData::RelaySafe(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool outside_call, BackRegisters *out_reg)
|
|
105
105
|
{
|
|
106
106
|
if (std::this_thread::get_id() != instance->main_thread_id) {
|
|
107
107
|
// JS/V8 is single-threaded, and runs on main_thread_id. Forward the call
|
|
@@ -110,7 +110,7 @@ void CallData::RelaySafe(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool dis
|
|
|
110
110
|
RelayContext ctx;
|
|
111
111
|
|
|
112
112
|
ctx.call = this;
|
|
113
|
-
ctx.dispose_call =
|
|
113
|
+
ctx.dispose_call = outside_call;
|
|
114
114
|
ctx.idx = idx;
|
|
115
115
|
ctx.own_sp = own_sp;
|
|
116
116
|
ctx.caller_sp = caller_sp;
|
|
@@ -124,8 +124,8 @@ void CallData::RelaySafe(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool dis
|
|
|
124
124
|
ctx.cv.wait(lock);
|
|
125
125
|
}
|
|
126
126
|
} else {
|
|
127
|
-
|
|
128
|
-
Relay(idx, own_sp, caller_sp,
|
|
127
|
+
Napi::HandleScope scope(env);
|
|
128
|
+
Relay(idx, own_sp, caller_sp, !outside_call, out_reg);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
|
|
@@ -133,7 +133,7 @@ void CallData::RelayAsync(napi_env, napi_value, void *, void *udata)
|
|
|
133
133
|
{
|
|
134
134
|
RelayContext *ctx = (RelayContext *)udata;
|
|
135
135
|
|
|
136
|
-
ctx->call->Relay(ctx->idx, ctx->own_sp, ctx->caller_sp,
|
|
136
|
+
ctx->call->Relay(ctx->idx, ctx->own_sp, ctx->caller_sp, false, ctx->out_reg);
|
|
137
137
|
|
|
138
138
|
if (ctx->dispose_call) {
|
|
139
139
|
ctx->call->Dispose();
|
|
@@ -1269,7 +1269,7 @@ void CallData::PopOutArguments()
|
|
|
1269
1269
|
RG_ASSERT(array.IsArray());
|
|
1270
1270
|
RG_ASSERT(array.Length() == 1);
|
|
1271
1271
|
|
|
1272
|
-
Size len =
|
|
1272
|
+
Size len = NullTerminatedLength((const char16_t *)out.ptr, out.max_len);
|
|
1273
1273
|
Napi::String str = Napi::String::New(env, (const char16_t *)out.ptr, len);
|
|
1274
1274
|
|
|
1275
1275
|
array.Set(0u, str);
|
package/src/koffi/src/call.hh
CHANGED
|
@@ -107,8 +107,8 @@ public:
|
|
|
107
107
|
|
|
108
108
|
#undef INLINE_IF_UNITY
|
|
109
109
|
|
|
110
|
-
void Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool
|
|
111
|
-
void RelaySafe(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool
|
|
110
|
+
void Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_stack, BackRegisters *out_reg);
|
|
111
|
+
void RelaySafe(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool outside_call, BackRegisters *out_reg);
|
|
112
112
|
static void RelayAsync(napi_env, napi_value, void *, void *udata);
|
|
113
113
|
|
|
114
114
|
void DumpForward(const FunctionInfo *func) const;
|
package/src/koffi/src/ffi.cc
CHANGED
|
@@ -48,10 +48,6 @@
|
|
|
48
48
|
#endif
|
|
49
49
|
|
|
50
50
|
#include <napi.h>
|
|
51
|
-
#if NODE_WANT_INTERNALS
|
|
52
|
-
#include <env-inl.h>
|
|
53
|
-
#include <js_native_api_v8.h>
|
|
54
|
-
#endif
|
|
55
51
|
|
|
56
52
|
namespace RG {
|
|
57
53
|
|
|
@@ -2084,11 +2080,6 @@ bool InitAsyncBroker(Napi::Env env, InstanceData *instance)
|
|
|
2084
2080
|
return true;
|
|
2085
2081
|
}
|
|
2086
2082
|
|
|
2087
|
-
CallData *GetThreadCall()
|
|
2088
|
-
{
|
|
2089
|
-
return exec_call;
|
|
2090
|
-
}
|
|
2091
|
-
|
|
2092
2083
|
static void RegisterPrimitiveType(Napi::Env env, Napi::Object map, std::initializer_list<const char *> names,
|
|
2093
2084
|
PrimitiveKind primitive, int32_t size, int16_t align, const char *ref = nullptr)
|
|
2094
2085
|
{
|
package/src/koffi/src/ffi.hh
CHANGED
package/src/koffi/src/util.cc
CHANGED
|
@@ -779,17 +779,6 @@ void DecodeObject(Napi::Object obj, const uint8_t *origin, const TypeInfo *type)
|
|
|
779
779
|
}
|
|
780
780
|
}
|
|
781
781
|
|
|
782
|
-
Size WideStringLength(const char16_t *str16, Size max)
|
|
783
|
-
{
|
|
784
|
-
Size len = 0;
|
|
785
|
-
|
|
786
|
-
while (len < max && str16[len]) {
|
|
787
|
-
len++;
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
return len;
|
|
791
|
-
}
|
|
792
|
-
|
|
793
782
|
Napi::Value DecodeArray(Napi::Env env, const uint8_t *origin, const TypeInfo *type)
|
|
794
783
|
{
|
|
795
784
|
InstanceData *instance = env.GetInstanceData<InstanceData>();
|
|
@@ -873,7 +862,7 @@ Napi::Value DecodeArray(Napi::Env env, const uint8_t *origin, const TypeInfo *ty
|
|
|
873
862
|
case PrimitiveKind::Int16: {
|
|
874
863
|
if (type->hint == ArrayHint::String) {
|
|
875
864
|
const char16_t *ptr = (const char16_t *)origin;
|
|
876
|
-
Size count =
|
|
865
|
+
Size count = NullTerminatedLength(ptr, len);
|
|
877
866
|
|
|
878
867
|
Napi::String str = Napi::String::New(env, ptr, count);
|
|
879
868
|
return str;
|
|
@@ -1186,7 +1175,12 @@ Napi::Value Decode(Napi::Env env, const uint8_t *ptr, const TypeInfo *type, cons
|
|
|
1186
1175
|
} break;
|
|
1187
1176
|
case PrimitiveKind::Int16:
|
|
1188
1177
|
case PrimitiveKind::UInt16: {
|
|
1189
|
-
Size count =
|
|
1178
|
+
Size count = NullTerminatedLength((const char16_t *)ptr, RG_SIZE_MAX);
|
|
1179
|
+
type = MakeArrayType(instance, type, count);
|
|
1180
|
+
} break;
|
|
1181
|
+
|
|
1182
|
+
case PrimitiveKind::Pointer: {
|
|
1183
|
+
Size count = NullTerminatedLength((const void **)ptr, RG_SIZE_MAX);
|
|
1190
1184
|
type = MakeArrayType(instance, type, count);
|
|
1191
1185
|
} break;
|
|
1192
1186
|
|
package/src/koffi/src/util.hh
CHANGED
|
@@ -156,7 +156,15 @@ T GetNumber(Napi::Value value)
|
|
|
156
156
|
RG_UNREACHABLE();
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
template <typename T>
|
|
160
|
+
Size NullTerminatedLength(const T *ptr, Size max)
|
|
161
|
+
{
|
|
162
|
+
Size len = 0;
|
|
163
|
+
while (len < max && ptr[len]) {
|
|
164
|
+
len++;
|
|
165
|
+
}
|
|
166
|
+
return len;
|
|
167
|
+
}
|
|
160
168
|
|
|
161
169
|
Napi::Object DecodeObject(Napi::Env env, const uint8_t *origin, const TypeInfo *type);
|
|
162
170
|
void DecodeObject(Napi::Object obj, const uint8_t *origin, const TypeInfo *type);
|
|
@@ -1,5 +1,81 @@
|
|
|
1
1
|
# node-addon-api Changelog
|
|
2
2
|
|
|
3
|
+
## 2024-01-18 Version 7.1.0, @legendecas
|
|
4
|
+
|
|
5
|
+
### Notable changes
|
|
6
|
+
|
|
7
|
+
#### API
|
|
8
|
+
|
|
9
|
+
- Add Env::GetModuleFileName
|
|
10
|
+
- Add SyntaxError
|
|
11
|
+
- Allow NAPI\_VERSION env var and templatize AttachData callback
|
|
12
|
+
- Add common gyp dependency targets.
|
|
13
|
+
|
|
14
|
+
### Commits
|
|
15
|
+
|
|
16
|
+
* \[[`864fed488c`](https://github.com/nodejs/node-addon-api/commit/864fed488c)] - build(deps): bump github/codeql-action from 3.22.12 to 3.23.0 (dependabot\[bot]) [#1428](https://github.com/nodejs/node-addon-api/pull/1428)
|
|
17
|
+
* \[[`81a8d43130`](https://github.com/nodejs/node-addon-api/commit/81a8d43130)] - build(deps): bump actions/dependency-review-action from 3.1.4 to 3.1.5 (dependabot\[bot]) [#1427](https://github.com/nodejs/node-addon-api/pull/1427)
|
|
18
|
+
* \[[`e20088941b`](https://github.com/nodejs/node-addon-api/commit/e20088941b)] - build(deps): bump github/codeql-action from 3.22.11 to 3.22.12 (dependabot\[bot]) [#1426](https://github.com/nodejs/node-addon-api/pull/1426)
|
|
19
|
+
* \[[`76c7b12e4e`](https://github.com/nodejs/node-addon-api/commit/76c7b12e4e)] - build(deps): bump actions/setup-node from 4.0.0 to 4.0.1 (dependabot\[bot]) [#1425](https://github.com/nodejs/node-addon-api/pull/1425)
|
|
20
|
+
* \[[`cd58edde1d`](https://github.com/nodejs/node-addon-api/commit/cd58edde1d)] - build(deps): bump actions/upload-artifact from 3.1.3 to 4.0.0 (dependabot\[bot]) [#1424](https://github.com/nodejs/node-addon-api/pull/1424)
|
|
21
|
+
* \[[`0fd1b9e0e1`](https://github.com/nodejs/node-addon-api/commit/0fd1b9e0e1)] - build(deps): bump github/codeql-action from 2.22.8 to 3.22.11 (dependabot\[bot]) [#1423](https://github.com/nodejs/node-addon-api/pull/1423)
|
|
22
|
+
* \[[`c181b19d68`](https://github.com/nodejs/node-addon-api/commit/c181b19d68)] - build(deps): bump actions/stale from 8.0.0 to 9.0.0 (dependabot\[bot]) [#1418](https://github.com/nodejs/node-addon-api/pull/1418)
|
|
23
|
+
* \[[`6fa67791a1`](https://github.com/nodejs/node-addon-api/commit/6fa67791a1)] - build(deps): bump actions/setup-python from 4.7.1 to 5.0.0 (dependabot\[bot]) [#1417](https://github.com/nodejs/node-addon-api/pull/1417)
|
|
24
|
+
* \[[`1fff346fa6`](https://github.com/nodejs/node-addon-api/commit/1fff346fa6)] - build(deps): bump actions/dependency-review-action from 3.1.3 to 3.1.4 (dependabot\[bot]) [#1415](https://github.com/nodejs/node-addon-api/pull/1415)
|
|
25
|
+
* \[[`ecb9690fe5`](https://github.com/nodejs/node-addon-api/commit/ecb9690fe5)] - build(deps): bump github/codeql-action from 2.22.7 to 2.22.8 (dependabot\[bot]) [#1414](https://github.com/nodejs/node-addon-api/pull/1414)
|
|
26
|
+
* \[[`969547b871`](https://github.com/nodejs/node-addon-api/commit/969547b871)] - build(deps): bump github/codeql-action from 2.22.5 to 2.22.7 (dependabot\[bot]) [#1413](https://github.com/nodejs/node-addon-api/pull/1413)
|
|
27
|
+
* \[[`183d1522a9`](https://github.com/nodejs/node-addon-api/commit/183d1522a9)] - build(deps): bump step-security/harden-runner from 2.6.0 to 2.6.1 (dependabot\[bot]) [#1412](https://github.com/nodejs/node-addon-api/pull/1412)
|
|
28
|
+
* \[[`25f977724a`](https://github.com/nodejs/node-addon-api/commit/25f977724a)] - build(deps): bump actions/dependency-review-action from 3.1.0 to 3.1.3 (dependabot\[bot]) [#1410](https://github.com/nodejs/node-addon-api/pull/1410)
|
|
29
|
+
* \[[`f6d125a407`](https://github.com/nodejs/node-addon-api/commit/f6d125a407)] - build(deps): bump actions/setup-python from 4.7.0 to 4.7.1 (dependabot\[bot]) [#1406](https://github.com/nodejs/node-addon-api/pull/1406)
|
|
30
|
+
* \[[`ce78a39ec7`](https://github.com/nodejs/node-addon-api/commit/ce78a39ec7)] - build(deps): bump github/codeql-action from 2.22.4 to 2.22.5 (dependabot\[bot]) [#1400](https://github.com/nodejs/node-addon-api/pull/1400)
|
|
31
|
+
* \[[`dc211ebb48`](https://github.com/nodejs/node-addon-api/commit/dc211ebb48)] - build(deps): bump actions/setup-node from 3.8.1 to 4.0.0 (dependabot\[bot]) [#1398](https://github.com/nodejs/node-addon-api/pull/1398)
|
|
32
|
+
* \[[`cab559e3bd`](https://github.com/nodejs/node-addon-api/commit/cab559e3bd)] - build(deps): bump ossf/scorecard-action from 2.3.0 to 2.3.1 (dependabot\[bot]) [#1397](https://github.com/nodejs/node-addon-api/pull/1397)
|
|
33
|
+
* \[[`f71ff5582d`](https://github.com/nodejs/node-addon-api/commit/f71ff5582d)] - build(deps): bump github/codeql-action from 2.22.3 to 2.22.4 (dependabot\[bot]) [#1396](https://github.com/nodejs/node-addon-api/pull/1396)
|
|
34
|
+
* \[[`21c1d08680`](https://github.com/nodejs/node-addon-api/commit/21c1d08680)] - build(deps): bump actions/checkout from 4.1.0 to 4.1.1 (dependabot\[bot]) [#1394](https://github.com/nodejs/node-addon-api/pull/1394)
|
|
35
|
+
* \[[`e4eec0939c`](https://github.com/nodejs/node-addon-api/commit/e4eec0939c)] - build(deps): bump github/codeql-action from 2.21.9 to 2.22.3 (dependabot\[bot]) [#1393](https://github.com/nodejs/node-addon-api/pull/1393)
|
|
36
|
+
* \[[`94f3459474`](https://github.com/nodejs/node-addon-api/commit/94f3459474)] - build(deps): bump ossf/scorecard-action from 2.2.0 to 2.3.0 (dependabot\[bot]) [#1388](https://github.com/nodejs/node-addon-api/pull/1388)
|
|
37
|
+
* \[[`90a741ef10`](https://github.com/nodejs/node-addon-api/commit/90a741ef10)] - build(deps): bump step-security/harden-runner from 2.5.1 to 2.6.0 (dependabot\[bot]) [#1386](https://github.com/nodejs/node-addon-api/pull/1386)
|
|
38
|
+
* \[[`7e1aa06132`](https://github.com/nodejs/node-addon-api/commit/7e1aa06132)] - Update LICENSE.md (Michael Dawson) [#1385](https://github.com/nodejs/node-addon-api/pull/1385)
|
|
39
|
+
* \[[`0a0612362e`](https://github.com/nodejs/node-addon-api/commit/0a0612362e)] - build(deps): bump github/codeql-action from 2.21.7 to 2.21.9 (dependabot\[bot]) [#1384](https://github.com/nodejs/node-addon-api/pull/1384)
|
|
40
|
+
* \[[`47bd430da2`](https://github.com/nodejs/node-addon-api/commit/47bd430da2)] - build(deps): bump actions/checkout from 4.0.0 to 4.1.0 (dependabot\[bot]) [#1383](https://github.com/nodejs/node-addon-api/pull/1383)
|
|
41
|
+
* \[[`b3f7f73cb9`](https://github.com/nodejs/node-addon-api/commit/b3f7f73cb9)] - build(deps): bump actions/dependency-review-action from 3.0.8 to 3.1.0 (dependabot\[bot]) [#1377](https://github.com/nodejs/node-addon-api/pull/1377)
|
|
42
|
+
* \[[`12c1655387`](https://github.com/nodejs/node-addon-api/commit/12c1655387)] - build(deps): bump github/codeql-action from 2.21.6 to 2.21.7 (dependabot\[bot]) [#1380](https://github.com/nodejs/node-addon-api/pull/1380)
|
|
43
|
+
* \[[`6abed318e4`](https://github.com/nodejs/node-addon-api/commit/6abed318e4)] - build(deps): bump github/codeql-action from 2.21.5 to 2.21.6 (dependabot\[bot]) [#1378](https://github.com/nodejs/node-addon-api/pull/1378)
|
|
44
|
+
* \[[`89eda59930`](https://github.com/nodejs/node-addon-api/commit/89eda59930)] - build(deps): bump actions/upload-artifact from 3.1.2 to 3.1.3 (dependabot\[bot]) [#1376](https://github.com/nodejs/node-addon-api/pull/1376)
|
|
45
|
+
* \[[`90870dbffa`](https://github.com/nodejs/node-addon-api/commit/90870dbffa)] - build(deps): bump actions/checkout from 3.6.0 to 4.0.0 (dependabot\[bot]) [#1375](https://github.com/nodejs/node-addon-api/pull/1375)
|
|
46
|
+
* \[[`b860793eff`](https://github.com/nodejs/node-addon-api/commit/b860793eff)] - build(deps): bump github/codeql-action from 2.21.2 to 2.21.5 (dependabot\[bot]) [#1372](https://github.com/nodejs/node-addon-api/pull/1372)
|
|
47
|
+
* \[[`f9b9974b4a`](https://github.com/nodejs/node-addon-api/commit/f9b9974b4a)] - build(deps): bump actions/checkout from 3.5.3 to 3.6.0 (dependabot\[bot]) [#1371](https://github.com/nodejs/node-addon-api/pull/1371)
|
|
48
|
+
* \[[`9596e3de2d`](https://github.com/nodejs/node-addon-api/commit/9596e3de2d)] - build(deps): bump actions/setup-node from 3.7.0 to 3.8.1 (dependabot\[bot]) [#1370](https://github.com/nodejs/node-addon-api/pull/1370)
|
|
49
|
+
* \[[`e969210747`](https://github.com/nodejs/node-addon-api/commit/e969210747)] - build(deps): bump actions/dependency-review-action from 3.0.6 to 3.0.8 (dependabot\[bot]) [#1368](https://github.com/nodejs/node-addon-api/pull/1368)
|
|
50
|
+
* \[[`13ef96a5a9`](https://github.com/nodejs/node-addon-api/commit/13ef96a5a9)] - build(deps): bump step-security/harden-runner from 2.5.0 to 2.5.1 (dependabot\[bot]) [#1364](https://github.com/nodejs/node-addon-api/pull/1364)
|
|
51
|
+
* \[[`9776d148b3`](https://github.com/nodejs/node-addon-api/commit/9776d148b3)] - build(deps): bump github/codeql-action from 2.21.1 to 2.21.2 (dependabot\[bot]) [#1358](https://github.com/nodejs/node-addon-api/pull/1358)
|
|
52
|
+
* \[[`59dc6be097`](https://github.com/nodejs/node-addon-api/commit/59dc6be097)] - build(deps): bump github/codeql-action from 2.21.0 to 2.21.1 (dependabot\[bot]) [#1357](https://github.com/nodejs/node-addon-api/pull/1357)
|
|
53
|
+
* \[[`5e72796cd5`](https://github.com/nodejs/node-addon-api/commit/5e72796cd5)] - build(deps): bump step-security/harden-runner from 2.4.1 to 2.5.0 (dependabot\[bot]) [#1356](https://github.com/nodejs/node-addon-api/pull/1356)
|
|
54
|
+
* \[[`4e62db45e4`](https://github.com/nodejs/node-addon-api/commit/4e62db45e4)] - build(deps): bump github/codeql-action from 2.20.3 to 2.21.0 (dependabot\[bot]) [#1353](https://github.com/nodejs/node-addon-api/pull/1353)
|
|
55
|
+
* \[[`0c093a33e8`](https://github.com/nodejs/node-addon-api/commit/0c093a33e8)] - build(deps): bump github/codeql-action from 2.20.1 to 2.20.3 (dependabot\[bot]) [#1349](https://github.com/nodejs/node-addon-api/pull/1349)
|
|
56
|
+
* \[[`5523b2d3fa`](https://github.com/nodejs/node-addon-api/commit/5523b2d3fa)] - build(deps): bump actions/setup-node from 3.6.0 to 3.7.0 (dependabot\[bot]) [#1348](https://github.com/nodejs/node-addon-api/pull/1348)
|
|
57
|
+
* \[[`afa494ef7f`](https://github.com/nodejs/node-addon-api/commit/afa494ef7f)] - Add Node.js version restrictions (Ingo Fischer) [#1340](https://github.com/nodejs/node-addon-api/pull/1340)
|
|
58
|
+
* \[[`ac4c87f660`](https://github.com/nodejs/node-addon-api/commit/ac4c87f660)] - build(deps): bump ossf/scorecard-action from 2.0.6 to 2.2.0 (dependabot\[bot]) [#1344](https://github.com/nodejs/node-addon-api/pull/1344)
|
|
59
|
+
* \[[`47aeb6689d`](https://github.com/nodejs/node-addon-api/commit/47aeb6689d)] - build(deps): bump github/codeql-action from 2.2.12 to 2.20.1 (dependabot\[bot]) [#1343](https://github.com/nodejs/node-addon-api/pull/1343)
|
|
60
|
+
* \[[`bd45a8fffc`](https://github.com/nodejs/node-addon-api/commit/bd45a8fffc)] - build(deps): bump step-security/harden-runner from 2.3.0 to 2.4.1 (dependabot\[bot]) [#1342](https://github.com/nodejs/node-addon-api/pull/1342)
|
|
61
|
+
* \[[`343a1e1708`](https://github.com/nodejs/node-addon-api/commit/343a1e1708)] - build(deps-dev): bump fs-extra from 9.1.0 to 11.1.1 (dependabot\[bot]) [#1335](https://github.com/nodejs/node-addon-api/pull/1335)
|
|
62
|
+
* \[[`4168c10182`](https://github.com/nodejs/node-addon-api/commit/4168c10182)] - build(deps): bump actions/stale from 5.2.1 to 8.0.0 (dependabot\[bot]) [#1333](https://github.com/nodejs/node-addon-api/pull/1333)
|
|
63
|
+
* \[[`1c182abd1f`](https://github.com/nodejs/node-addon-api/commit/1c182abd1f)] - build(deps): bump actions/dependency-review-action from 2.5.1 to 3.0.6 (dependabot\[bot]) [#1331](https://github.com/nodejs/node-addon-api/pull/1331)
|
|
64
|
+
* \[[`717a61931d`](https://github.com/nodejs/node-addon-api/commit/717a61931d)] - build(deps): bump actions/checkout from 3.5.2 to 3.5.3 (dependabot\[bot]) [#1329](https://github.com/nodejs/node-addon-api/pull/1329)
|
|
65
|
+
* \[[`d605d62c89`](https://github.com/nodejs/node-addon-api/commit/d605d62c89)] - **chore**: lock python version in actions (Chengzhong Wu) [#1403](https://github.com/nodejs/node-addon-api/pull/1403)
|
|
66
|
+
* \[[`734e3f2509`](https://github.com/nodejs/node-addon-api/commit/734e3f2509)] - **doc**: fix rendering of code blocks in list (Tobias Nießen) [#1401](https://github.com/nodejs/node-addon-api/pull/1401)
|
|
67
|
+
* \[[`dfdf6eb6e6`](https://github.com/nodejs/node-addon-api/commit/dfdf6eb6e6)] - **doc**: add missing title IsBigInt (Marx) [#1352](https://github.com/nodejs/node-addon-api/pull/1352)
|
|
68
|
+
* \[[`8850997f38`](https://github.com/nodejs/node-addon-api/commit/8850997f38)] - **doc**: fix typo AsyncProgressWorker::ExecutionProgress (JerryZhongJ) [#1350](https://github.com/nodejs/node-addon-api/pull/1350)
|
|
69
|
+
* \[[`8192a471a1`](https://github.com/nodejs/node-addon-api/commit/8192a471a1)] - **docs**: fixed Broken Links (Ömer AKGÜL) [#1405](https://github.com/nodejs/node-addon-api/pull/1405)
|
|
70
|
+
* \[[`16a18c047a`](https://github.com/nodejs/node-addon-api/commit/16a18c047a)] - **fix**: handle c++ exception in TSFN callback (Chengzhong Wu) [#1345](https://github.com/nodejs/node-addon-api/pull/1345)
|
|
71
|
+
* \[[`ab14347080`](https://github.com/nodejs/node-addon-api/commit/ab14347080)] - **gyp**: add common targets (Chengzhong Wu) [#1389](https://github.com/nodejs/node-addon-api/pull/1389)
|
|
72
|
+
* \[[`fa3518bc08`](https://github.com/nodejs/node-addon-api/commit/fa3518bc08)] - **src**: remove duplicate buffer info calls (Chengzhong Wu) [#1354](https://github.com/nodejs/node-addon-api/pull/1354)
|
|
73
|
+
* \[[`b83e453e6e`](https://github.com/nodejs/node-addon-api/commit/b83e453e6e)] - **src**: add Env::GetModuleFileName (Kevin Eady) [#1327](https://github.com/nodejs/node-addon-api/pull/1327)
|
|
74
|
+
* \[[`d9828c6264`](https://github.com/nodejs/node-addon-api/commit/d9828c6264)] - **src**: add SyntaxError (Kevin Eady) [#1326](https://github.com/nodejs/node-addon-api/pull/1326)
|
|
75
|
+
* \[[`c52e764bb2`](https://github.com/nodejs/node-addon-api/commit/c52e764bb2)] - **src,test,build**: allow NAPI\_VERSION env var and templatize AttachData callback (Gabriel Schulhof) [#1399](https://github.com/nodejs/node-addon-api/pull/1399)
|
|
76
|
+
* \[[`8f028d630a`](https://github.com/nodejs/node-addon-api/commit/8f028d630a)] - **test**: remove experimental flag from bigint (Gabriel Schulhof) [#1395](https://github.com/nodejs/node-addon-api/pull/1395)
|
|
77
|
+
* \[[`414be9e000`](https://github.com/nodejs/node-addon-api/commit/414be9e000)] - **test**: run interfering tests in their own process (Gabriel Schulhof) [#1325](https://github.com/nodejs/node-addon-api/pull/1325)
|
|
78
|
+
|
|
3
79
|
## 2023-06-13 Version 7.0.0, @KevinEady
|
|
4
80
|
|
|
5
81
|
### Notable changes
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
|
-
=====================
|
|
3
2
|
|
|
4
|
-
Copyright (c) 2017 Node.js API collaborators
|
|
5
|
-
-----------------------------------
|
|
6
|
-
|
|
7
|
-
*Node.js API collaborators listed at <https://github.com/nodejs/node-addon-api#collaborators>*
|
|
3
|
+
Copyright (c) 2017 [Node.js API collaborators](https://github.com/nodejs/node-addon-api#collaborators)
|
|
8
4
|
|
|
9
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
10
6
|
|
|
11
7
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
12
8
|
|
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -70,7 +70,7 @@ and node-addon-api.
|
|
|
70
70
|
- **[Contributors](#contributors)**
|
|
71
71
|
- **[License](#license)**
|
|
72
72
|
|
|
73
|
-
## **Current version: 7.
|
|
73
|
+
## **Current version: 7.1.0**
|
|
74
74
|
|
|
75
75
|
(See [CHANGELOG.md](CHANGELOG.md) for complete Changelog)
|
|
76
76
|
|
|
@@ -132,6 +132,7 @@ The following is the documentation for node-addon-api.
|
|
|
132
132
|
- [Error](doc/error.md)
|
|
133
133
|
- [TypeError](doc/type_error.md)
|
|
134
134
|
- [RangeError](doc/range_error.md)
|
|
135
|
+
- [SyntaxError](doc/syntax_error.md)
|
|
135
136
|
- [Object Lifetime Management](doc/object_lifetime_management.md)
|
|
136
137
|
- [HandleScope](doc/handle_scope.md)
|
|
137
138
|
- [EscapableHandleScope](doc/escapable_handle_scope.md)
|
|
@@ -152,14 +153,14 @@ The following is the documentation for node-addon-api.
|
|
|
152
153
|
|
|
153
154
|
Are you new to **node-addon-api**? Take a look at our **[examples](https://github.com/nodejs/node-addon-examples)**
|
|
154
155
|
|
|
155
|
-
- **[Hello World](https://github.com/nodejs/node-addon-examples/tree/
|
|
156
|
-
- **[Pass arguments to a function](https://github.com/nodejs/node-addon-examples/tree/
|
|
157
|
-
- **[Callbacks](https://github.com/nodejs/node-addon-examples/tree/
|
|
158
|
-
- **[Object factory](https://github.com/nodejs/node-addon-examples/tree/
|
|
159
|
-
- **[Function factory](https://github.com/nodejs/node-addon-examples/tree/
|
|
160
|
-
- **[Wrapping C++ Object](https://github.com/nodejs/node-addon-examples/tree/
|
|
161
|
-
- **[Factory of wrapped object](https://github.com/nodejs/node-addon-examples/tree/
|
|
162
|
-
- **[Passing wrapped object around](https://github.com/nodejs/node-addon-examples/tree/
|
|
156
|
+
- **[Hello World](https://github.com/nodejs/node-addon-examples/tree/main/src/1-getting-started/1_hello_world)**
|
|
157
|
+
- **[Pass arguments to a function](https://github.com/nodejs/node-addon-examples/tree/main/src/1-getting-started/2_function_arguments/node-addon-api)**
|
|
158
|
+
- **[Callbacks](https://github.com/nodejs/node-addon-examples/tree/main/src/1-getting-started/3_callbacks/node-addon-api)**
|
|
159
|
+
- **[Object factory](https://github.com/nodejs/node-addon-examples/tree/main/src/1-getting-started/4_object_factory/node-addon-api)**
|
|
160
|
+
- **[Function factory](https://github.com/nodejs/node-addon-examples/tree/main/src/1-getting-started/5_function_factory/node-addon-api)**
|
|
161
|
+
- **[Wrapping C++ Object](https://github.com/nodejs/node-addon-examples/tree/main/src/1-getting-started/6_object_wrap/node-addon-api)**
|
|
162
|
+
- **[Factory of wrapped object](https://github.com/nodejs/node-addon-examples/tree/main/src/1-getting-started/7_factory_wrap/node-addon-api)**
|
|
163
|
+
- **[Passing wrapped object around](https://github.com/nodejs/node-addon-examples/tree/main/src/2-js-to-native-conversion/8_passing_wrapped/node-addon-api)**
|
|
163
164
|
|
|
164
165
|
<a name="tests"></a>
|
|
165
166
|
|
|
@@ -4,22 +4,22 @@
|
|
|
4
4
|
{
|
|
5
5
|
'target_name': 'function_args',
|
|
6
6
|
'sources': [ 'function_args.cc' ],
|
|
7
|
-
'
|
|
7
|
+
'dependencies': ['../node_addon_api.gyp:node_addon_api_except'],
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
'target_name': 'function_args_noexcept',
|
|
11
11
|
'sources': [ 'function_args.cc' ],
|
|
12
|
-
'
|
|
12
|
+
'dependencies': ['../node_addon_api.gyp:node_addon_api'],
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
'target_name': 'property_descriptor',
|
|
16
16
|
'sources': [ 'property_descriptor.cc' ],
|
|
17
|
-
'
|
|
17
|
+
'dependencies': ['../node_addon_api.gyp:node_addon_api_except'],
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
'target_name': 'property_descriptor_noexcept',
|
|
21
21
|
'sources': [ 'property_descriptor.cc' ],
|
|
22
|
-
'
|
|
22
|
+
'dependencies': ['../node_addon_api.gyp:node_addon_api'],
|
|
23
23
|
},
|
|
24
24
|
]
|
|
25
25
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
'variables': {
|
|
3
|
-
'NAPI_VERSION%': "<!(node -p \"process.versions.napi\")",
|
|
3
|
+
'NAPI_VERSION%': "<!(node -p \"process.env.NAPI_VERSION || process.versions.napi\")",
|
|
4
4
|
'disable_deprecated': "<!(node -p \"process.env['npm_config_disable_deprecated']\")"
|
|
5
5
|
},
|
|
6
6
|
'conditions': [
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
}
|
|
16
16
|
}]
|
|
17
17
|
],
|
|
18
|
-
'include_dirs': ["<!(node -p \"require('../').include_dir\")"],
|
|
19
18
|
'cflags': [ '-Werror', '-Wall', '-Wextra', '-Wpedantic', '-Wunused-parameter' ],
|
|
20
19
|
'cflags_cc': [ '-Werror', '-Wall', '-Wextra', '-Wpedantic', '-Wunused-parameter' ]
|
|
21
20
|
}
|
|
@@ -9,7 +9,7 @@ around `napi_value` representing a JavaScript Array.
|
|
|
9
9
|
types such as [`Napi::Int32Array`][] and [`Napi::ArrayBuffer`][], respectively,
|
|
10
10
|
that can be used for transferring large amounts of data from JavaScript to the
|
|
11
11
|
native side. An example illustrating the use of a JavaScript-provided
|
|
12
|
-
`ArrayBuffer` in native code is available [here](https://github.com/nodejs/node-addon-examples/tree/
|
|
12
|
+
`ArrayBuffer` in native code is available [here](https://github.com/nodejs/node-addon-examples/tree/main/src/2-js-to-native-conversion/array_buffer_to_native/node-addon-api).
|
|
13
13
|
|
|
14
14
|
## Constructor
|
|
15
15
|
```cpp
|