summaryrefslogtreecommitdiff
path: root/ext/node
diff options
context:
space:
mode:
Diffstat (limited to 'ext/node')
-rw-r--r--ext/node/global.rs4
-rw-r--r--ext/node/polyfills/01_require.js11
-rw-r--r--ext/node/polyfills/_events.mjs8
-rw-r--r--ext/node/polyfills/process.ts3
4 files changed, 14 insertions, 12 deletions
diff --git a/ext/node/global.rs b/ext/node/global.rs
index 61bcc3343..4d6695431 100644
--- a/ext/node/global.rs
+++ b/ext/node/global.rs
@@ -54,7 +54,6 @@ const fn str_to_utf16<const N: usize>(s: &str) -> [u16; N] {
// - clearTimeout (both, but different implementation)
// - global (node only)
// - performance (both, but different implementation)
-// - process (node only)
// - setImmediate (node only)
// - setInterval (both, but different implementation)
// - setTimeout (both, but different implementation)
@@ -62,7 +61,7 @@ const fn str_to_utf16<const N: usize>(s: &str) -> [u16; N] {
// UTF-16 encodings of the managed globals. THIS LIST MUST BE SORTED.
#[rustfmt::skip]
-const MANAGED_GLOBALS: [&[u16]; 13] = [
+const MANAGED_GLOBALS: [&[u16]; 12] = [
&str_to_utf16::<6>("Buffer"),
&str_to_utf16::<17>("WorkerGlobalScope"),
&str_to_utf16::<14>("clearImmediate"),
@@ -70,7 +69,6 @@ const MANAGED_GLOBALS: [&[u16]; 13] = [
&str_to_utf16::<12>("clearTimeout"),
&str_to_utf16::<6>("global"),
&str_to_utf16::<11>("performance"),
- &str_to_utf16::<7>("process"),
&str_to_utf16::<4>("self"),
&str_to_utf16::<12>("setImmediate"),
&str_to_utf16::<11>("setInterval"),
diff --git a/ext/node/polyfills/01_require.js b/ext/node/polyfills/01_require.js
index d666b3927..e4a781cc4 100644
--- a/ext/node/polyfills/01_require.js
+++ b/ext/node/polyfills/01_require.js
@@ -940,12 +940,11 @@ Module.prototype.require = function (id) {
// The module wrapper looks slightly different to Node. Instead of using one
// wrapper function, we use two. The first one exists to performance optimize
-// access to magic node globals, like `Buffer` or `process`. The second one
-// is the actual wrapper function we run the users code in.
-// The only observable difference is that in Deno `arguments.callee` is not
-// null.
+// access to magic node globals, like `Buffer`. The second one is the actual
+// wrapper function we run the users code in. The only observable difference is
+// that in Deno `arguments.callee` is not null.
Module.wrapper = [
- "(function (exports, require, module, __filename, __dirname, Buffer, clearImmediate, clearInterval, clearTimeout, global, process, setImmediate, setInterval, setTimeout, performance) { (function (exports, require, module, __filename, __dirname) {",
+ "(function (exports, require, module, __filename, __dirname, Buffer, clearImmediate, clearInterval, clearTimeout, global, setImmediate, setInterval, setTimeout, performance) { (function (exports, require, module, __filename, __dirname) {",
"\n}).call(this, exports, require, module, __filename, __dirname); })",
];
Module.wrap = function (script) {
@@ -1030,7 +1029,6 @@ Module.prototype._compile = function (content, filename, format) {
clearInterval,
clearTimeout,
global,
- process,
setImmediate,
setInterval,
setTimeout,
@@ -1049,7 +1047,6 @@ Module.prototype._compile = function (content, filename, format) {
clearInterval,
clearTimeout,
global,
- process,
setImmediate,
setInterval,
setTimeout,
diff --git a/ext/node/polyfills/_events.mjs b/ext/node/polyfills/_events.mjs
index bb3498594..12b0935e6 100644
--- a/ext/node/polyfills/_events.mjs
+++ b/ext/node/polyfills/_events.mjs
@@ -46,7 +46,6 @@ import {
} from "ext:deno_node/internal/validators.mjs";
import { spliceOne } from "ext:deno_node/_utils.ts";
import { nextTick } from "ext:deno_node/_process/process.ts";
-import { nodeGlobals } from "ext:deno_node/00_globals.js";
const kCapture = Symbol("kCapture");
const kErrorMonitor = Symbol("events.errorMonitor");
@@ -55,6 +54,11 @@ const kMaxEventTargetListenersWarned = Symbol(
"events.maxEventTargetListenersWarned",
);
+let process;
+export function setProcess(p) {
+ process = p;
+}
+
/**
* Creates a new `EventEmitter` instance.
* @param {{ captureRejections?: boolean; }} [opts]
@@ -469,7 +473,7 @@ function _addListener(target, type, listener, prepend) {
w.emitter = target;
w.type = type;
w.count = existing.length;
- nodeGlobals.process.emitWarning(w);
+ process.emitWarning(w);
}
}
diff --git a/ext/node/polyfills/process.ts b/ext/node/polyfills/process.ts
index 8d5442935..2130087fb 100644
--- a/ext/node/polyfills/process.ts
+++ b/ext/node/polyfills/process.ts
@@ -69,6 +69,7 @@ import * as constants from "ext:deno_node/internal_binding/constants.ts";
import * as uv from "ext:deno_node/internal_binding/uv.ts";
import type { BindingName } from "ext:deno_node/internal_binding/mod.ts";
import { buildAllowedFlags } from "ext:deno_node/internal/process/per_thread.mjs";
+import { setProcess } from "ext:deno_node/_events.mjs";
const notImplementedEvents = [
"multipleResolves",
@@ -960,4 +961,6 @@ internals.__bootstrapNodeProcess = function (
}
};
+setProcess(process);
+
export default process;