@@ -8,10 +8,10 @@ an API override to replace the native `ReadFileSync` in the `modules`
88binding.
99
1010diff --git a/src/env_properties.h b/src/env_properties.h
11- index 82225b0a53dd828750991a4e15a060b736b6ea2b..4b0d31356a2496a7fc67876a22da2453efc54f53 100644
11+ index 2884149d82d..dded4bf3d71 100644
1212--- a/src/env_properties.h
1313+++ b/src/env_properties.h
14- @@ -508 ,6 +508 ,7 @@
14+ @@ -490 ,6 +490 ,7 @@
1515 V(maybe_cache_generated_source_map, v8::Function) \
1616 V(messaging_deserialize_create_object, v8::Function) \
1717 V(message_port, v8::Object) \
@@ -20,26 +20,26 @@ index 82225b0a53dd828750991a4e15a060b736b6ea2b..4b0d31356a2496a7fc67876a22da2453
2020 V(performance_entry_callback, v8::Function) \
2121 V(prepare_stack_trace_callback, v8::Function) \
2222diff --git a/src/node_modules.cc b/src/node_modules.cc
23- index c06779dea471b6f6a8dd29d4657162ef0faec043..6204986dc97686a248d6ae483f3a413ee5c51e47 100644
23+ index b93ccedaf70..bdbc511ef3f 100644
2424--- a/src/node_modules.cc
2525+++ b/src/node_modules.cc
26- @@ -21,6 +21,7 @@ namespace modules {
27-
26+ @@ -23,6 +23,7 @@ namespace modules {
2827 using v8::Array;
2928 using v8::Context;
29+ using v8::External;
3030+ using v8::Function;
3131 using v8::FunctionCallbackInfo;
3232 using v8::HandleScope;
33- using v8::Isolate ;
34- @@ -89 ,6 +90 ,7 @@ Local<Array> BindingData::PackageConfig::Serialize(Realm* realm) const {
33+ using v8::Integer ;
34+ @@ -94 ,6 +95 ,7 @@ Local<Array> BindingData::PackageConfig::Serialize(Realm* realm) const {
3535
3636 const BindingData::PackageConfig* BindingData::GetPackageJSON(
3737 Realm* realm, std::string_view path, ErrorContext* error_context) {
3838+ auto isolate = realm->isolate();
3939 auto binding_data = realm->GetBindingData<BindingData>();
4040
4141 auto cache_entry = binding_data->package_configs_.find(path.data());
42- @@ -98 ,8 +100 ,36 @@ const BindingData::PackageConfig* BindingData::GetPackageJSON(
42+ @@ -103 ,8 +105 ,36 @@ const BindingData::PackageConfig* BindingData::GetPackageJSON(
4343
4444 PackageConfig package_config{};
4545 package_config.file_path = path;
@@ -76,8 +76,8 @@ index c06779dea471b6f6a8dd29d4657162ef0faec043..6204986dc97686a248d6ae483f3a413e
7676+ if (read_err < 0) {
7777 return nullptr;
7878 }
79- // In some systems, std::string is annotated to generate an
80- @@ -249 ,6 +279 ,12 @@ const BindingData::PackageConfig* BindingData::GetPackageJSON(
79+ simdjson::ondemand::document document;
80+ @@ -242 ,6 +272 ,12 @@ const BindingData::PackageConfig* BindingData::GetPackageJSON(
8181 return &cached.first->second;
8282 }
8383
@@ -90,7 +90,7 @@ index c06779dea471b6f6a8dd29d4657162ef0faec043..6204986dc97686a248d6ae483f3a413e
9090 void BindingData::ReadPackageJSON(const FunctionCallbackInfo<Value>& args) {
9191 CHECK_GE(args.Length(), 1); // path, [is_esm, base, specifier]
9292 CHECK(args[0]->IsString()); // path
93- @@ -643 ,6 +679 ,8 @@ void InitImportMetaPathHelpers (const FunctionCallbackInfo<Value>& args) {
93+ @@ -674 ,6 +710 ,8 @@ void SaveCompileCacheEntry (const FunctionCallbackInfo<Value>& args) {
9494 void BindingData::CreatePerIsolateProperties(IsolateData* isolate_data,
9595 Local<ObjectTemplate> target) {
9696 Isolate* isolate = isolate_data->isolate();
@@ -99,17 +99,17 @@ index c06779dea471b6f6a8dd29d4657162ef0faec043..6204986dc97686a248d6ae483f3a413e
9999 SetMethod(isolate, target, "readPackageJSON", ReadPackageJSON);
100100 SetMethod(isolate,
101101 target,
102- @@ -685 ,6 +723 ,8 @@ void BindingData::CreatePerContextProperties(Local<Object> target,
102+ @@ -733 ,6 +771 ,8 @@ void BindingData::CreatePerContextProperties(Local<Object> target,
103103
104104 void BindingData::RegisterExternalReferences(
105105 ExternalReferenceRegistry* registry) {
106106+ registry->Register(OverrideReadFileSync);
107107+
108108 registry->Register(ReadPackageJSON);
109109 registry->Register(GetNearestParentPackageJSONType);
110- registry->Register(GetNearestParentPackageJSON );
110+ registry->Register(GetPackageScopeConfig<false> );
111111diff --git a/src/node_modules.h b/src/node_modules.h
112- index eb2900d8f8385238f89a6dcc972a28e5fcb1d288..e28f38d98f4f8749048af135f0dcbe55aa69c4fe 100644
112+ index e4ba6b75bc8..ae77f9ec81b 100644
113113--- a/src/node_modules.h
114114+++ b/src/node_modules.h
115115@@ -54,6 +54,8 @@ class BindingData : public SnapshotableObject {
@@ -119,5 +119,5 @@ index eb2900d8f8385238f89a6dcc972a28e5fcb1d288..e28f38d98f4f8749048af135f0dcbe55
119119+ static void OverrideReadFileSync(
120120+ const v8::FunctionCallbackInfo<v8::Value>& args);
121121 static void ReadPackageJSON(const v8::FunctionCallbackInfo<v8::Value>& args);
122- static void GetNearestParentPackageJSON (
122+ static void GetNearestParentPackageJSONType (
123123 const v8::FunctionCallbackInfo<v8::Value>& args);
0 commit comments