From 376665d1154501660e7b20f760a0482509cff8b0 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Thu, 25 Aug 2022 20:24:18 -0400 Subject: fix: avoid global declaration collisions in cjs (#15608) * Use a default stack size * 2 in debug for Windows because swc using so much stack size. We should look into this more later though. --- ext/node/02_require.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'ext') diff --git a/ext/node/02_require.js b/ext/node/02_require.js index f2b42da53..6f06d3269 100644 --- a/ext/node/02_require.js +++ b/ext/node/02_require.js @@ -656,11 +656,10 @@ }; Module.wrapper = [ - // TODO: - // We provide non standard timer APIs in the CommonJS wrapper + // We provide the non-standard APIs in the CommonJS wrapper // to avoid exposing them in global namespace. - "(function (exports, require, module, __filename, __dirname, globalThis) { (function (exports, require, module, __filename, __dirname, globalThis, Buffer, clearImmediate, clearInterval, clearTimeout, global, process, setImmediate, setInterval, setTimeout) {", - "\n}).call(this, exports, require, module, __filename, __dirname, globalThis, globalThis.Buffer, globalThis.clearImmediate, globalThis.clearInterval, globalThis.clearTimeout, globalThis.global, globalThis.process, globalThis.setImmediate, globalThis.setInterval, globalThis.setTimeout); })", + "(function (exports, require, module, __filename, __dirname, globalThis) { const { Buffer, clearImmediate, clearInterval, clearTimeout, global, process, setImmediate, setInterval, setTimeout} = globalThis; (function () {", + "\n}).call(this); })", ]; Module.wrap = function (script) { script = script.replace(/^#!.*?\n/, ""); -- cgit v1.2.3