db5a3c014a
* chore: bump node in DEPS to v16.14.0 * src: add flags for controlling process behavior https://github.com/nodejs/node/pull/40339 * src: add x509.fingerprint512 to crypto module https://github.com/nodejs/node/pull/39809 * deps: upgrade to libuv 1.43.0 https://github.com/nodejs/node/pull/41398 * chore: fixup patch indices * chore: add missing filenames https://github.com/nodejs/node/pull/39283 https://github.com/nodejs/node/pull/40665 * crypto: trim input for NETSCAPE_SPKI_b64_decode https://github.com/nodejs/node/pull/40757 * chore: update patches * chore: bump node in DEPS to v16.14.1 * tools: enable no-empty ESLint rule https://github.com/nodejs/node/pull/41831 * chore: update patches * chore: update patches * chore: bump node in DEPS to v16.14.2 * chore: update patches 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 cfe2982bf22c245d3249a743e341c9948d98c18b..2c188ae0b5cb86493a7fd701c343b36370369f20 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');
|
|
@@ -1098,10 +1105,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;
|