Files
electron/patches/node/pass_all_globals_through_require.patch
electron-roller[bot] f149efe32e chore: bump node to v24.13.0 (main) (#49189)
* chore: bump node in DEPS to v24.12.0

* src: use CP_UTF8 for wide file names on win32

https://github.com/nodejs/node/pull/60575

* test,crypto: handle a few more BoringSSL tests

https://github.com/nodejs/node/pull/59030

* chore: fixup patch indices

* chore: re-add accidentally removed sslv23 test

* chore: fixup crypto patch rebase

* test: make buffer sizes 32bit-aware in test-internal-util-construct-sab

https://github.com/nodejs/node/pull/61026

* src: add internal binding for constructing SharedArrayBuffers

https://github.com/nodejs/node/pull/60497

* chore: bump node in DEPS to v24.13.0

* chore: fixup patch indices

* chore: fixup sandboxed pointers patch

* tls: route callback exceptions through error handlers

https://github.com/nodejs-private/node-private/pull/782

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2026-01-16 11:08:38 -05:00

41 lines
1.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cheng Zhao <zcbenz@gmail.com>
Date: Sun, 27 Mar 2016 14:42:26 +0900
Subject: Pass all globals through "require"
(cherry picked from commit 7d015419cb7a0ecfe6728431a4ed2056cd411d62)
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
index 414e450ee3a8110b8249dd831fef1ab885cc6fa1..c6ff40d814a49536808a2fd79ee6918c3ac118c9 100644
--- a/lib/internal/modules/cjs/loader.js
+++ b/lib/internal/modules/cjs/loader.js
@@ -209,6 +209,13 @@ const {
CHAR_FORWARD_SLASH,
} = require('internal/constants');
+// Store the "global" variable from global scope into a local scope, so we can
+// still reference it from this file even after we deleted the "global" variable
+// from the global scope.
+const localGlobal = (typeof global !== 'undefined') ? global : undefined;
+// Do the same for "Buffer".
+const localBuffer = (typeof Buffer !== 'undefined') ? Buffer : undefined;
+
const {
isProxy,
} = require('internal/util/types');
@@ -1756,10 +1763,12 @@ Module.prototype._compile = function(content, filename, format) {
if (this[kIsMainSymbol] && getOptionValue('--inspect-brk')) {
const { callAndPauseOnStart } = internalBinding('inspector');
result = callAndPauseOnStart(compiledWrapper, thisValue, exports,
- require, module, filename, dirname);
+ require, module, filename, dirname,
+ process, localGlobal, localBuffer);
} else {
result = ReflectApply(compiledWrapper, thisValue,
- [exports, require, module, filename, dirname]);
+ [exports, require, module, filename, dirname,
+ process, localGlobal, localBuffer]);
}
this[kIsExecuting] = false;
if (requireDepth === 0) { statCache = null; }