Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! esm: use import attributes instead of import assertions
  • Loading branch information
aduh95 committed Oct 11, 2023
commit 0246cdaf051d55ebd80ebc2979e0fc12aa7d5bb3
16 changes: 8 additions & 8 deletions src/module_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,13 @@ void ModuleWrap::New(const FunctionCallbackInfo<Value>& args) {
static Local<Object> createImportAttributesContainer(Environment* env,
Isolate* isolate, Local<FixedArray> raw_attributes) {
Local<Object> attributes =
Object::New(isolate, v8::Null(env->isolate()), nullptr, nullptr, 0);
Object::New(isolate, v8::Null(env->isolate()), nullptr, nullptr, 0);
for (int i = 0; i < raw_attributes->Length(); i += 3) {
attributes
->Set(env->context(),
raw_attributes->Get(env->context(), i).As<String>(),
raw_attributes->Get(env->context(), i + 1).As<Value>())
.ToChecked();
attributes
->Set(env->context(),
raw_attributes->Get(env->context(), i).As<String>(),
raw_attributes->Get(env->context(), i + 1).As<Value>())
.ToChecked();
}

return attributes;
Expand Down Expand Up @@ -299,7 +299,7 @@ void ModuleWrap::Link(const FunctionCallbackInfo<Value>& args) {

Local<FixedArray> raw_attributes = module_request->GetImportAssertions();
Local<Object> attributes =
createImportAttributesContainer(env, isolate, raw_attributes);
createImportAttributesContainer(env, isolate, raw_attributes);

Local<Value> argv[] = {
specifier,
Expand Down Expand Up @@ -581,7 +581,7 @@ static MaybeLocal<Promise> ImportModuleDynamically(
options->Get(context, HostDefinedOptions::kID).As<Symbol>();

Local<Object> attributes =
createImportAttributesContainer(env, isolate, import_attributes);
createImportAttributesContainer(env, isolate, import_attributes);

Local<Value> import_args[] = {
id,
Expand Down
3 changes: 2 additions & 1 deletion src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,8 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args,
}
// TODO(aduh95): remove this when the harmony-import-attributes flag
// is removed in V8.
if (std::find(v8_args.begin(), v8_args.end(),
if (std::find(v8_args.begin(),
v8_args.end(),
"--no-harmony-import-attributes") == v8_args.end()) {
v8_args.emplace_back("--harmony-import-attributes");
}
Expand Down