Skip to content

Commit f311fff

Browse files
committed
vfs: restore isSea as function, align modules/ with upstream
Restore isSea as a C++ function (was incorrectly changed to a boolean property), fixing cctest failures where helpers.js calls isSea(). Align all files under lib/internal/modules/ with upstream/main so VFS introduces zero changes to the module loader internals.
1 parent 551e0e6 commit f311fff

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

lib/internal/main/embedding.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ const {
1313
prepareMainThreadExecution,
1414
} = require('internal/process/pre_execution');
1515
const {
16-
isSea: isLoadingSea,
16+
isSea,
1717
isVfsEnabled: isVfsEnabledFlag,
1818
isExperimentalSeaWarningNeeded,
1919
} = internalBinding('sea');
20+
const isLoadingSea = isSea();
2021
const { emitExperimentalWarning } = require('internal/util');
2122
const { emitWarningSync } = require('internal/process/warning');
2223
const { Module } = require('internal/modules/cjs/loader');

src/node_sea.cc

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,10 @@ SeaResource FindSingleExecutableResource() {
259259
return sea_resource;
260260
}
261261

262+
void IsSea(const FunctionCallbackInfo<Value>& args) {
263+
args.GetReturnValue().Set(IsSingleExecutable());
264+
}
265+
262266
void IsExperimentalSeaWarningNeeded(const FunctionCallbackInfo<Value>& args) {
263267
bool is_building_sea =
264268
!per_process::cli_options->experimental_sea_config.empty();
@@ -899,27 +903,20 @@ void Initialize(Local<Object> target,
899903
Environment* env = Environment::GetCurrent(context);
900904
Isolate* isolate = env->isolate();
901905

902-
// Set boolean flags as properties (computed once, avoids repeated calls).
903-
bool is_sea = IsSingleExecutable();
906+
// isVfsEnabled is a boolean property (only used by embedding.js).
904907
bool is_vfs_enabled = false;
905-
906-
if (is_sea) {
908+
if (IsSingleExecutable()) {
907909
SeaResource sea_resource = FindSingleExecutableResource();
908910
is_vfs_enabled =
909911
static_cast<bool>(sea_resource.flags & SeaFlags::kEnableVfs);
910912
}
911-
912-
target
913-
->Set(context,
914-
FIXED_ONE_BYTE_STRING(isolate, "isSea"),
915-
Boolean::New(isolate, is_sea))
916-
.Check();
917913
target
918914
->Set(context,
919915
FIXED_ONE_BYTE_STRING(isolate, "isVfsEnabled"),
920916
Boolean::New(isolate, is_vfs_enabled))
921917
.Check();
922918

919+
SetMethod(context, target, "isSea", IsSea);
923920
SetMethod(context,
924921
target,
925922
"isExperimentalSeaWarningNeeded",
@@ -929,6 +926,7 @@ void Initialize(Local<Object> target,
929926
}
930927

931928
void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
929+
registry->Register(IsSea);
932930
registry->Register(IsExperimentalSeaWarningNeeded);
933931
registry->Register(GetAsset);
934932
registry->Register(GetAssetKeys);

0 commit comments

Comments
 (0)