![electron-roller[bot]](/assets/img/avatar_default.png)
* chore: bump node in DEPS to v22.14.0 * src: move more crypto impl detail to ncrypto dep https://github.com/nodejs/node/pull/56421 * test: move crypto related common utilities in common/crypto https://github.com/nodejs/node/pull/56714 * module: add findPackageJSON util https://github.com/nodejs/node/pull/55412 * module: mark evaluation rejection in require(esm) as handled https://github.com/nodejs/node/pull/56122 * chore: fixup patch indices * deps: move inspector_protocol to deps https://github.com/nodejs/node/pull/56649 * fixup! src: move more crypto impl detail to ncrypto dep * fixup! deps: move inspector_protocol to deps * fixup! src: move more crypto impl detail to ncrypto dep * crypto: fix checkPrime crash with large buffers https://github.com/nodejs/node/pull/56559 * tls: fix error stack conversion in cryptoErrorListToException() https://github.com/nodejs/node/pull/56554 * module: add findPackageJSON util https://github.com/nodejs/node/pull/55412 Our revert of native legacyMainResolve makes this very difficult to make work, so disable for now. * lib: add typescript support to STDIN eval https://github.com/nodejs/node/pull/56359 * chore: fix patch --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
40 lines
1.9 KiB
Diff
40 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 62c33730ed17cb98b6dd8d69b61360a419518ba5..9b5772fe9b8babbb892c7a5ec79258472da55a76 100644
|
|
--- a/lib/internal/modules/cjs/loader.js
|
|
+++ b/lib/internal/modules/cjs/loader.js
|
|
@@ -185,6 +185,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');
|
|
@@ -1549,10 +1556,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; }
|