From 81fac00ab20809eb44c9ef37fb41dc9abe183dd3 Mon Sep 17 00:00:00 2001 From: LiviaMedeiros Date: Sat, 28 Nov 2026 23:03:18 +0800 Subject: [PATCH] module: simplify `getAllBuiltinModuleIds` Signed-off-by: LiviaMedeiros --- lib/internal/bootstrap/realm.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/lib/internal/bootstrap/realm.js b/lib/internal/bootstrap/realm.js index fd3e4eb64c80..5742e9c64a0d 100644 --- a/lib/internal/bootstrap/realm.js +++ b/lib/internal/bootstrap/realm.js @@ -54,7 +54,6 @@ const { ArrayPrototypeIncludes, ArrayPrototypeMap, ArrayPrototypePush, - ArrayPrototypePushApply, ArrayPrototypeSlice, Error, ObjectDefineProperty, @@ -356,16 +355,11 @@ class BuiltinModule { static getAllBuiltinModuleIds() { const allBuiltins = ArrayFrom(canBeRequiredByUsersWithoutSchemeList); - ArrayPrototypePushApply( - allBuiltins, - ArrayPrototypeMap( - ArrayPrototypeFilter( - ArrayFrom(schemelessBlockList), - (id) => canBeRequiredByUsersList.has(id), - ), - (id) => 'node:' + id, - ), - ); + for (const id of schemelessBlockList) { + if (canBeRequiredByUsersList.has(id)) { + ArrayPrototypePush(allBuiltins, `node:${id}`); + } + } return allBuiltins; }