@@ -23,25 +23,35 @@ using node::contextify::ContextifyContext;
2323using v8::Array;
2424using v8::ArrayBufferView;
2525using v8::Context;
26+ using v8::Data;
2627using v8::EscapableHandleScope;
28+ using v8::Exception;
2729using v8::FixedArray;
2830using v8::Function;
2931using v8::FunctionCallbackInfo;
3032using v8::FunctionTemplate;
33+ using v8::Global;
3134using v8::HandleScope;
3235using v8::Int32;
3336using v8::Integer;
3437using v8::Isolate;
38+ using v8::Just;
3539using v8::Local;
40+ using v8::LocalVector;
41+ using v8::Maybe;
3642using v8::MaybeLocal;
3743using v8::MemorySpan;
44+ using v8::Message;
3845using v8::MicrotaskQueue;
3946using v8::Module;
4047using v8::ModuleRequest;
48+ using v8::Name;
49+ using v8::Null;
4150using v8::Object;
4251using v8::ObjectTemplate;
4352using v8::PrimitiveArray;
4453using v8::Promise;
54+ using v8::PromiseRejectEvent;
4555using v8::ScriptCompiler;
4656using v8::ScriptOrigin;
4757using v8::String;
@@ -103,7 +113,7 @@ ModuleWrap* ModuleWrap::GetFromModule(Environment* env,
103113 return nullptr ;
104114}
105115
106- v8:: Maybe<bool > ModuleWrap::CheckUnsettledTopLevelAwait () {
116+ Maybe<bool > ModuleWrap::CheckUnsettledTopLevelAwait () {
107117 Isolate* isolate = env ()->isolate ();
108118 Local<Context> context = env ()->context ();
109119
@@ -115,17 +125,17 @@ v8::Maybe<bool> ModuleWrap::CheckUnsettledTopLevelAwait() {
115125 Local<Module> module = module_.Get (isolate);
116126 // It's a synthetic module, likely a facade wrapping CJS.
117127 if (!module ->IsSourceTextModule ()) {
118- return v8:: Just (true );
128+ return Just (true );
119129 }
120130
121131 if (!module ->IsGraphAsync ()) { // There is no TLA, no need to check.
122- return v8:: Just (true );
132+ return Just (true );
123133 }
124134
125135 auto stalled_messages =
126136 std::get<1 >(module ->GetStalledTopLevelAwaitMessages (isolate));
127137 if (stalled_messages.empty ()) {
128- return v8:: Just (true );
138+ return Just (true );
129139 }
130140
131141 if (env ()->options ()->warnings ) {
@@ -138,7 +148,7 @@ v8::Maybe<bool> ModuleWrap::CheckUnsettledTopLevelAwait() {
138148 }
139149 }
140150
141- return v8:: Just (false );
151+ return Just (false );
142152}
143153
144154Local<PrimitiveArray> ModuleWrap::GetHostDefinedOptions (
@@ -229,7 +239,7 @@ void ModuleWrap::New(const FunctionCallbackInfo<Value>& args) {
229239 Local<Array> export_names_arr = args[2 ].As <Array>();
230240
231241 uint32_t len = export_names_arr->Length ();
232- std::vector<Local< String>> export_names (len);
242+ LocalVector< String> export_names (realm-> isolate (), len);
233243 for (uint32_t i = 0 ; i < len; i++) {
234244 Local<Value> export_name_val =
235245 export_names_arr->Get (context, i).ToLocalChecked ();
@@ -245,7 +255,7 @@ void ModuleWrap::New(const FunctionCallbackInfo<Value>& args) {
245255 // When we are compiling for the default loader, this will be
246256 // std::nullopt, and CompileSourceTextModule() should use
247257 // on-disk cache.
248- std::optional<v8:: ScriptCompiler::CachedData*> user_cached_data;
258+ std::optional<ScriptCompiler::CachedData*> user_cached_data;
249259 if (id_symbol !=
250260 realm->isolate_data ()->source_text_module_default_hdo ()) {
251261 user_cached_data = nullptr ;
@@ -324,7 +334,7 @@ void ModuleWrap::New(const FunctionCallbackInfo<Value>& args) {
324334 // be stored in an internal field.
325335 Local<Object> context_object = context->GetExtrasBindingObject ();
326336 Local<Value> synthetic_evaluation_step =
327- synthetic ? args[3 ] : Undefined (realm->isolate ()).As <v8:: Value>();
337+ synthetic ? args[3 ] : Undefined (realm->isolate ()).As <Value>();
328338
329339 ModuleWrap* obj = new ModuleWrap (
330340 realm, that, module , url, context_object, synthetic_evaluation_step);
@@ -405,22 +415,22 @@ static Local<Object> createImportAttributesContainer(
405415 const int elements_per_attribute) {
406416 CHECK_EQ (raw_attributes->Length () % elements_per_attribute, 0 );
407417 size_t num_attributes = raw_attributes->Length () / elements_per_attribute;
408- std::vector<Local<v8:: Name>> names (num_attributes);
409- std::vector<Local<v8:: Value>> values (num_attributes);
418+ LocalVector< Name> names (isolate, num_attributes);
419+ LocalVector< Value> values (isolate, num_attributes);
410420
411421 for (int i = 0 ; i < raw_attributes->Length (); i += elements_per_attribute) {
412422 int idx = i / elements_per_attribute;
413- names[idx] = raw_attributes->Get (realm->context (), i).As <v8:: Name>();
423+ names[idx] = raw_attributes->Get (realm->context (), i).As <Name>();
414424 values[idx] = raw_attributes->Get (realm->context (), i + 1 ).As <Value>();
415425 }
416426
417427 return Object::New (
418- isolate, v8:: Null (isolate), names.data (), values.data (), num_attributes);
428+ isolate, Null (isolate), names.data (), values.data (), num_attributes);
419429}
420430
421431static Local<Array> createModuleRequestsContainer (
422432 Realm* realm, Isolate* isolate, Local<FixedArray> raw_requests) {
423- std::vector<Local< Value>> requests (raw_requests->Length ());
433+ LocalVector< Value> requests (isolate, raw_requests->Length ());
424434
425435 for (int i = 0 ; i < raw_requests->Length (); i++) {
426436 Local<ModuleRequest> module_request =
@@ -434,7 +444,7 @@ static Local<Array> createModuleRequestsContainer(
434444 Local<Object> attributes =
435445 createImportAttributesContainer (realm, isolate, raw_attributes, 3 );
436446
437- Local<v8:: Name> names[] = {
447+ Local<Name> names[] = {
438448 realm->isolate_data ()->specifier_string (),
439449 realm->isolate_data ()->attributes_string (),
440450 };
@@ -444,8 +454,8 @@ static Local<Array> createModuleRequestsContainer(
444454 };
445455 DCHECK_EQ (arraysize (names), arraysize (values));
446456
447- Local<Object> request = Object::New (
448- isolate, v8:: Null (isolate), names, values, arraysize (names));
457+ Local<Object> request =
458+ Object::New ( isolate, Null (isolate), names, values, arraysize (names));
449459
450460 requests[i] = request;
451461 }
@@ -481,11 +491,11 @@ void ModuleWrap::Link(const FunctionCallbackInfo<Value>& args) {
481491 Local<Array> modules = args[1 ].As <Array>();
482492 CHECK_EQ (specifiers->Length (), modules->Length ());
483493
484- std::vector<v8:: Global<Value>> specifiers_buffer;
494+ std::vector<Global<Value>> specifiers_buffer;
485495 if (FromV8Array (context, specifiers, &specifiers_buffer).IsNothing ()) {
486496 return ;
487497 }
488- std::vector<v8:: Global<Value>> modules_buffer;
498+ std::vector<Global<Value>> modules_buffer;
489499 if (FromV8Array (context, modules, &modules_buffer).IsNothing ()) {
490500 return ;
491501 }
@@ -669,19 +679,18 @@ void ModuleWrap::EvaluateSync(const FunctionCallbackInfo<Value>& args) {
669679 // before handler was added which would remove it from the unhandled
670680 // rejection handling, since we are converting it into an error and throw
671681 // from here directly.
672- Local<Value> type = v8::Integer::New (
673- isolate,
674- static_cast <int32_t >(
675- v8:: PromiseRejectEvent::kPromiseHandlerAddedAfterReject ));
682+ Local<Value> type =
683+ Integer::New ( isolate,
684+ static_cast <int32_t >(
685+ PromiseRejectEvent::kPromiseHandlerAddedAfterReject ));
676686 Local<Value> args[] = {type, promise, Undefined (isolate)};
677687 if (env->promise_reject_callback ()
678688 ->Call (context, Undefined (isolate), arraysize (args), args)
679689 .IsEmpty ()) {
680690 return ;
681691 }
682692 Local<Value> exception = promise->Result ();
683- Local<v8::Message> message =
684- v8::Exception::CreateMessage (isolate, exception);
693+ Local<Message> message = Exception::CreateMessage (isolate, exception);
685694 AppendExceptionLine (
686695 env, exception, message, ErrorHandlingMode::MODULE_ERROR);
687696 isolate->ThrowException (exception);
@@ -718,15 +727,15 @@ void ModuleWrap::GetNamespaceSync(const FunctionCallbackInfo<Value>& args) {
718727 Local<Module> module = obj->module_ .Get (isolate);
719728
720729 switch (module ->GetStatus ()) {
721- case v8:: Module::Status::kUninstantiated :
722- case v8:: Module::Status::kInstantiating :
730+ case Module::Status::kUninstantiated :
731+ case Module::Status::kInstantiating :
723732 return realm->env ()->ThrowError (
724733 " Cannot get namespace, module has not been instantiated" );
725- case v8:: Module::Status::kInstantiated :
726- case v8:: Module::Status::kEvaluated :
727- case v8:: Module::Status::kErrored :
734+ case Module::Status::kInstantiated :
735+ case Module::Status::kEvaluated :
736+ case Module::Status::kErrored :
728737 break ;
729- case v8:: Module::Status::kEvaluating :
738+ case Module::Status::kEvaluating :
730739 UNREACHABLE ();
731740 }
732741
@@ -746,14 +755,14 @@ void ModuleWrap::GetNamespace(const FunctionCallbackInfo<Value>& args) {
746755 Local<Module> module = obj->module_ .Get (isolate);
747756
748757 switch (module ->GetStatus ()) {
749- case v8:: Module::Status::kUninstantiated :
750- case v8:: Module::Status::kInstantiating :
758+ case Module::Status::kUninstantiated :
759+ case Module::Status::kInstantiating :
751760 return realm->env ()->ThrowError (
752761 " cannot get namespace, module has not been instantiated" );
753- case v8:: Module::Status::kInstantiated :
754- case v8:: Module::Status::kEvaluating :
755- case v8:: Module::Status::kEvaluated :
756- case v8:: Module::Status::kErrored :
762+ case Module::Status::kInstantiated :
763+ case Module::Status::kEvaluating :
764+ case Module::Status::kEvaluated :
765+ case Module::Status::kErrored :
757766 break ;
758767 default :
759768 UNREACHABLE ();
@@ -825,7 +834,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback(
825834
826835static MaybeLocal<Promise> ImportModuleDynamically (
827836 Local<Context> context,
828- Local<v8:: Data> host_defined_options,
837+ Local<Data> host_defined_options,
829838 Local<Value> resource_name,
830839 Local<String> specifier,
831840 Local<FixedArray> import_attributes) {
@@ -1011,7 +1020,7 @@ void ModuleWrap::CreateCachedData(const FunctionCallbackInfo<Value>& args) {
10111020
10121021 Local<Module> module = obj->module_ .Get (isolate);
10131022
1014- CHECK_LT (module ->GetStatus (), v8:: Module::Status::kEvaluating );
1023+ CHECK_LT (module ->GetStatus (), Module::Status::kEvaluating );
10151024
10161025 Local<UnboundModuleScript> unbound_module_script =
10171026 module ->GetUnboundModuleScript ();
0 commit comments