From db6fc12b9e2d5cb55c1f3c61b054805505ae11a6 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Sun, 15 Sep 2024 08:15:28 +0530 Subject: [PATCH] fix(ext/node): add `vm.constants` (#25630) --- ext/node/polyfills/vm.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ext/node/polyfills/vm.js b/ext/node/polyfills/vm.js index eb9a0375d0..183ddad2f4 100644 --- a/ext/node/polyfills/vm.js +++ b/ext/node/polyfills/vm.js @@ -27,7 +27,7 @@ import { ERR_INVALID_ARG_TYPE } from "ext:deno_node/internal/errors.ts"; import { primordials } from "ext:core/mod.js"; -const { Symbol, ArrayPrototypeForEach } = primordials; +const { Symbol, ArrayPrototypeForEach, ObjectFreeze } = primordials; const kParsingContext = Symbol("script parsing context"); @@ -349,8 +349,22 @@ export function measureMemory(_options) { notImplemented("measureMemory"); } +const USE_MAIN_CONTEXT_DEFAULT_LOADER = Symbol( + "USE_MAIN_CONTEXT_DEFAULT_LOADER", +); +const DONT_CONTEXTIFY = Symbol("DONT_CONTEXTIFY"); + +export const constants = { + __proto__: null, + USE_MAIN_CONTEXT_DEFAULT_LOADER, + DONT_CONTEXTIFY, +}; + +ObjectFreeze(constants); + export default { Script, + constants, createContext, createScript, runInContext,