@@ -266,6 +266,15 @@ void IsSea(const FunctionCallbackInfo<Value>& args) {
266266 args.GetReturnValue ().Set (IsSingleExecutable ());
267267}
268268
269+ void IsVfsEnabled (const FunctionCallbackInfo<Value>& args) {
270+ bool enabled = false ;
271+ if (IsSingleExecutable ()) {
272+ SeaResource sea_resource = FindSingleExecutableResource ();
273+ enabled = static_cast <bool >(sea_resource.flags & SeaFlags::kEnableVfs );
274+ }
275+ args.GetReturnValue ().Set (enabled);
276+ }
277+
269278void IsExperimentalSeaWarningNeeded (const FunctionCallbackInfo<Value>& args) {
270279 bool is_building_sea =
271280 !per_process::cli_options->experimental_sea_config .empty ();
@@ -952,11 +961,9 @@ void Initialize(Local<Object> target,
952961 Environment* env = Environment::GetCurrent (context);
953962 Isolate* isolate = env->isolate ();
954963
955- // isVfsEnabled is a boolean property (only used by embedding.js).
956- bool is_vfs_enabled = false ;
957964 if (IsSingleExecutable ()) {
958965 SeaResource sea_resource = FindSingleExecutableResource ();
959- is_vfs_enabled =
966+ bool is_vfs_enabled =
960967 static_cast <bool >(sea_resource.flags & SeaFlags::kEnableVfs );
961968 // Expose the main code path so VFS can construct the correct entry point.
962969 if (is_vfs_enabled) {
@@ -974,13 +981,9 @@ void Initialize(Local<Object> target,
974981 }
975982 }
976983 }
977- target
978- ->Set (context,
979- FIXED_ONE_BYTE_STRING (isolate, " isVfsEnabled" ),
980- Boolean::New (isolate, is_vfs_enabled))
981- .Check ();
982984
983985 SetMethod (context, target, " isSea" , IsSea);
986+ SetMethod (context, target, " isVfsEnabled" , IsVfsEnabled);
984987 SetMethod (context,
985988 target,
986989 " isExperimentalSeaWarningNeeded" ,
@@ -991,6 +994,7 @@ void Initialize(Local<Object> target,
991994
992995void RegisterExternalReferences (ExternalReferenceRegistry* registry) {
993996 registry->Register (IsSea);
997+ registry->Register (IsVfsEnabled);
994998 registry->Register (IsExperimentalSeaWarningNeeded);
995999 registry->Register (GetAsset);
9961000 registry->Register (GetAssetKeys);
0 commit comments