20
20
#include < memory>
21
21
22
22
node_napi_env__::node_napi_env__ (v8::Local<v8::Context> context,
23
- const std::string& module_filename)
24
- : napi_env__(context), filename(module_filename) {
23
+ const std::string& module_filename,
24
+ napi_feature* features)
25
+ : napi_env__(context, features), filename(module_filename) {
25
26
CHECK_NOT_NULL (node_env ());
26
27
}
27
28
@@ -126,10 +127,11 @@ class BufferFinalizer : private Finalizer {
126
127
};
127
128
128
129
inline napi_env NewEnv (v8::Local<v8::Context> context,
129
- const std::string& module_filename) {
130
+ const std::string& module_filename,
131
+ napi_feature* features) {
130
132
node_napi_env result;
131
133
132
- result = new node_napi_env__ (context, module_filename);
134
+ result = new node_napi_env__ (context, module_filename, features );
133
135
// TODO(addaleax): There was previously code that tried to delete the
134
136
// napi_env when its v8::Context was garbage collected;
135
137
// However, as long as N-API addons using this napi_env are in place,
@@ -586,6 +588,13 @@ class AsyncContext {
586
588
587
589
} // end of namespace v8impl
588
590
591
+ void napi_module_register_by_symbol_with_features (
592
+ v8::Local<v8::Object> exports,
593
+ v8::Local<v8::Value> module,
594
+ v8::Local<v8::Context> context,
595
+ napi_addon_register_func init,
596
+ napi_feature* features);
597
+
589
598
// Intercepts the Node-V8 module registration callback. Converts parameters
590
599
// to NAPI equivalents and then calls the registration callback specified
591
600
// by the NAPI module.
@@ -604,6 +613,16 @@ void napi_module_register_by_symbol(v8::Local<v8::Object> exports,
604
613
v8::Local<v8::Value> module,
605
614
v8::Local<v8::Context> context,
606
615
napi_addon_register_func init) {
616
+ napi_module_register_by_symbol_with_features (
617
+ exports, module, context, init, nullptr );
618
+ }
619
+
620
+ void napi_module_register_by_symbol_with_features (
621
+ v8::Local<v8::Object> exports,
622
+ v8::Local<v8::Value> module,
623
+ v8::Local<v8::Context> context,
624
+ napi_addon_register_func init,
625
+ napi_feature* features) {
607
626
node::Environment* node_env = node::Environment::GetCurrent (context);
608
627
std::string module_filename = " " ;
609
628
if (init == nullptr ) {
@@ -631,7 +650,7 @@ void napi_module_register_by_symbol(v8::Local<v8::Object> exports,
631
650
}
632
651
633
652
// Create a new napi_env for this specific module.
634
- napi_env env = v8impl::NewEnv (context, module_filename);
653
+ napi_env env = v8impl::NewEnv (context, module_filename, features );
635
654
636
655
napi_value _exports;
637
656
env->CallIntoModule ([&](napi_env env) {
0 commit comments