@@ -1071,6 +1071,9 @@ class V8_EXPORT Module {
1071
1071
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Evaluate(Local<Context> context);
1072
1072
};
1073
1073
1074
+ // Node.js-specific: This will be implemented by a later V8 upgrade!
1075
+ class DynamicImportResult;
1076
+
1074
1077
/**
1075
1078
* A compiled JavaScript script, tied to a Context which was active when the
1076
1079
* script was compiled.
@@ -5794,6 +5797,25 @@ typedef void (*BeforeCallEnteredCallback)(Isolate*);
5794
5797
typedef void (*CallCompletedCallback)(Isolate*);
5795
5798
typedef void (*DeprecatedCallCompletedCallback)();
5796
5799
5800
+ /**
5801
+ * HostImportDynamicallyCallback is called when we require the
5802
+ * embedder to load a module. This is used as part of the dynamic
5803
+ * import syntax. The behavior of this callback is not specified in
5804
+ * EcmaScript.
5805
+ *
5806
+ * The referrer is the name of the file which calls the dynamic
5807
+ * import. The referrer can be used to resolve the module location.
5808
+ *
5809
+ * The specifier is the name of the module that should be imported.
5810
+ *
5811
+ * The DynamicImportResult object is used to signal success or failure
5812
+ * by calling it's respective methods.
5813
+ *
5814
+ */
5815
+ typedef void (*HostImportModuleDynamicallyCallback)(
5816
+ Isolate* isolate, Local<String> referrer, Local<String> specifier,
5817
+ Local<DynamicImportResult> result);
5818
+
5797
5819
/**
5798
5820
* PromiseHook with type kInit is called when a new promise is
5799
5821
* created. When a new promise is created as part of the chain in the
@@ -6343,7 +6365,8 @@ class V8_EXPORT Isolate {
6343
6365
add_histogram_sample_callback(nullptr),
6344
6366
array_buffer_allocator(nullptr),
6345
6367
external_references(nullptr),
6346
- allow_atomics_wait(true) {}
6368
+ allow_atomics_wait(true),
6369
+ host_import_module_dynamically_callback_(nullptr) {}
6347
6370
6348
6371
/**
6349
6372
* The optional entry_hook allows the host application to provide the
@@ -6405,6 +6428,16 @@ class V8_EXPORT Isolate {
6405
6428
* this isolate.
6406
6429
*/
6407
6430
bool allow_atomics_wait;
6431
+
6432
+ /**
6433
+ * This is an unfinished experimental feature, and is only exposed
6434
+ * here for internal testing purposes. DO NOT USE.
6435
+ *
6436
+ * This specifies the callback called by the upcoming dynamic
6437
+ * import() language feature to load modules.
6438
+ */
6439
+ HostImportModuleDynamicallyCallback
6440
+ host_import_module_dynamically_callback_;
6408
6441
};
6409
6442
6410
6443
0 commit comments