Skip to content

Commit a947cf9

Browse files
addaleaxjasnell
authored andcommitted
v8: backport header diff from 94283dcf4459f
Backport ABI-incompatible changes from 94283dcf4459f (“[ESNext] Implement DynamicImportCall”). Ref: https://codereview.chromium.org/2703563002 Ref: v8/v8@94283dcf4459f PR-URL: #12875 Reviewed-By: James M Snell <[email protected]>
1 parent 1bb880b commit a947cf9

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

deps/v8/include/v8.h

+34-1
Original file line numberDiff line numberDiff line change
@@ -1071,6 +1071,9 @@ class V8_EXPORT Module {
10711071
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Evaluate(Local<Context> context);
10721072
};
10731073

1074+
// Node.js-specific: This will be implemented by a later V8 upgrade!
1075+
class DynamicImportResult;
1076+
10741077
/**
10751078
* A compiled JavaScript script, tied to a Context which was active when the
10761079
* script was compiled.
@@ -5794,6 +5797,25 @@ typedef void (*BeforeCallEnteredCallback)(Isolate*);
57945797
typedef void (*CallCompletedCallback)(Isolate*);
57955798
typedef void (*DeprecatedCallCompletedCallback)();
57965799

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+
57975819
/**
57985820
* PromiseHook with type kInit is called when a new promise is
57995821
* created. When a new promise is created as part of the chain in the
@@ -6343,7 +6365,8 @@ class V8_EXPORT Isolate {
63436365
add_histogram_sample_callback(nullptr),
63446366
array_buffer_allocator(nullptr),
63456367
external_references(nullptr),
6346-
allow_atomics_wait(true) {}
6368+
allow_atomics_wait(true),
6369+
host_import_module_dynamically_callback_(nullptr) {}
63476370

63486371
/**
63496372
* The optional entry_hook allows the host application to provide the
@@ -6405,6 +6428,16 @@ class V8_EXPORT Isolate {
64056428
* this isolate.
64066429
*/
64076430
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_;
64086441
};
64096442

64106443

0 commit comments

Comments
 (0)