327af3b03c
* chore: bump node in DEPS to v18.16.1 * chore: update patches * deps: update c-ares to 1.19.1 https://github.com/nodejs/node/pull/48115 * chore: fix -Wunreachable-code,-Werror FTBFS in c-ares * chore: disable x509 bssl test new test added in bf3e2c892 * fixup! chore: fix -Wunreachable-code,-Werror FTBFS in c-ares also fix related -Werror,-Wunused-function FTBFS * fixup! chore: fix -Wunreachable-code,-Werror FTBFS in c-ares also fix another related -Werror,-Wunused-function FTBFS * fixup! chore: disable x509 bssl test fix yet another -Werror,-Wunused-function FTBFS --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
40 lines
1.7 KiB
Diff
40 lines
1.7 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 55931329dcddb60fff0bdf681bbfad6f62fdcbb7..65e685a7cacf3f70fddf15b1068d59fa604323ea 100644
|
|
--- a/lib/internal/modules/cjs/loader.js
|
|
+++ b/lib/internal/modules/cjs/loader.js
|
|
@@ -142,6 +142,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 = global;
|
|
+// Do the same for "Buffer".
|
|
+const localBuffer = Buffer;
|
|
+
|
|
const {
|
|
isProxy,
|
|
} = require('internal/util/types');
|
|
@@ -1251,10 +1258,12 @@ Module.prototype._compile = function(content, filename) {
|
|
if (requireDepth === 0) statCache = new SafeMap();
|
|
if (inspectorWrapper) {
|
|
result = inspectorWrapper(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]);
|
|
}
|
|
hasLoadedAnyUserCJSModule = true;
|
|
if (requireDepth === 0) statCache = null;
|