fb990ba1eb
* chore: bump node in DEPS to v16.6.0 * chore: bump node in DEPS to v16.6.1 * crypto: fix generateKeyPair with encoding 'jwk' https://github.com/nodejs/node/pull/39319 * build: add library_files to gyp variables https://github.com/nodejs/node/pull/39293 * debugger: rename internal module https://github.com/nodejs/node/pull/39378 * chore: fixup patch indices * deps: extract gtest source files to deps/googletest https://github.com/nodejs/node/pull/39386 * crypto: fix generateKeyPair with encoding 'jwk' https://github.com/nodejs/node/pull/39319 * deps: bump HdrHistogram_C to 0.11.2 https://github.com/nodejs/node/pull/39462 * fixup! deps: extract gtest source files to deps/googletest * chore: bump node in DEPS to v16.6.2 * chore: update patches * deps: reflect c-ares source tree https://github.com/nodejs/node/pull/39653 * deps: update c-ares to 1.17.2 https://github.com/nodejs/node/pull/39724 * fix: _ReadBarrier undefined symbol error on WOA arm64 * chore: update patches * chore: bump node in DEPS to v16.7.0 * deps: upgrade to libuv 1.42.0 https://github.com/nodejs/node/pull/39525 * chore: update filenames * src: remove extra semicolons outside fns * chore: fixup patch filenames * chore: sort and alphabetize disabled tests Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.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 8258a46076d1d4905298016cb52247e2cf8432c5..71059956705d1299a19cc9c940a998d9e9717a21 100644
|
|
--- a/lib/internal/modules/cjs/loader.js
|
|
+++ b/lib/internal/modules/cjs/loader.js
|
|
@@ -127,6 +127,13 @@ const {
|
|
CHAR_COLON
|
|
} = 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');
|
|
@@ -1096,10 +1103,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;
|