aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/modules/ProcessModule.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js/modules/ProcessModule.h')
-rw-r--r--src/bun.js/modules/ProcessModule.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/bun.js/modules/ProcessModule.h b/src/bun.js/modules/ProcessModule.h
new file mode 100644
index 000000000..2c82d6b3d
--- /dev/null
+++ b/src/bun.js/modules/ProcessModule.h
@@ -0,0 +1,39 @@
+#include "../bindings/ZigGlobalObject.h"
+#include "JavaScriptCore/JSGlobalObject.h"
+
+namespace Zig {
+
+inline void generateProcessSourceCode(JSC::JSGlobalObject* lexicalGlobalObject, JSC::Identifier moduleKey, Vector<JSC::Identifier, 4>& exportNames, JSC::MarkedArgumentBuffer& exportValues) {
+ JSC::VM& vm = lexicalGlobalObject->vm();
+ GlobalObject* globalObject = reinterpret_cast<GlobalObject*>(lexicalGlobalObject);
+
+ JSC::JSObject* process = globalObject->processObject();
+
+ auto exportFromProcess = [&] (const String& string) {
+ auto identifier = JSC::Identifier::fromString(vm, string);
+ exportNames.append(identifier);
+ exportValues.append(process->getDirect(vm, identifier));
+ };
+
+ exportFromProcess("arch"_s);
+ exportFromProcess("argv"_s);
+ exportFromProcess("browser"_s);
+ exportFromProcess("chdir"_s);
+ exportFromProcess("cwd"_s);
+ exportFromProcess("dlopen"_s);
+ exportFromProcess("exitCode"_s);
+ exportFromProcess("exit"_s);
+ exportFromProcess("hrtime"_s);
+ exportFromProcess("pid"_s);
+ exportFromProcess("ppid"_s);
+ exportFromProcess("nextTick"_s);
+ exportFromProcess("revision"_s);
+ exportFromProcess("title"_s);
+ exportFromProcess("version"_s);
+ exportFromProcess("versions"_s);
+ exportFromProcess("platform"_s);
+
+ exportFromProcess("isBun"_s);
+}
+
+}