aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/ZigGlobalObject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js/bindings/ZigGlobalObject.cpp')
-rw-r--r--src/bun.js/bindings/ZigGlobalObject.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp
index d79048ea3..6d20a63d2 100644
--- a/src/bun.js/bindings/ZigGlobalObject.cpp
+++ b/src/bun.js/bindings/ZigGlobalObject.cpp
@@ -2462,13 +2462,7 @@ void GlobalObject::finishCreation(VM& vm)
m_processEnvObject.initLater(
[](const JSC::LazyProperty<JSC::JSGlobalObject, JSC::JSObject>::Initializer& init) {
- auto jsClass = reinterpret_cast<Zig::GlobalObject*>(init.owner)->m_dotEnvClassRef;
-
- JSC::JSCallbackObject<JSNonFinalObject>* object = JSC::JSCallbackObject<JSNonFinalObject>::create(
- init.owner, init.owner->callbackObjectStructure(), jsClass, nullptr);
- if (JSObject* prototype = jsClass->prototype(init.owner))
- object->setPrototypeDirect(init.vm, prototype);
- init.set(object);
+ init.set(Bun::createEnvironmentVariablesMap(reinterpret_cast<Zig::GlobalObject*>(init.owner)).getObject());
});
m_processObject.initLater(
@@ -3177,6 +3171,16 @@ void GlobalObject::installAPIGlobals(JSClassRef* globals, int count, JSC::VM& vm
{
+ JSC::Identifier identifier = JSC::Identifier::fromString(vm, "env"_s);
+ object->putDirectCustomAccessor(vm, identifier,
+ JSC::CustomGetterSetter::create(vm, lazyProcessEnvGetter, lazyProcessEnvSetter),
+ JSC::PropertyAttribute::DontDelete
+ | JSC::PropertyAttribute::CustomValue
+ | 0);
+ }
+
+ {
+
JSC::Identifier identifier = JSC::Identifier::fromString(vm, pathToFileURLString);
object->putDirectNativeFunction(vm, this, identifier, 1, functionPathToFileURL, ImplementationVisibility::Public, NoIntrinsic,
JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly);