diff options
author | 2023-07-10 21:12:00 +0800 | |
---|---|---|
committer | 2023-07-10 21:12:00 +0800 | |
commit | cc0d9200187de8d405dffcdb23c588e182ceccef (patch) | |
tree | c5fbccb010297f763f2a8bb697c2ab4282a98447 /src/bun.js/bindings/CommonJSModuleRecord.cpp | |
parent | 438d54f1869a11a7219f6e93c3bb05f6c52ee27b (diff) | |
parent | ec1117031197dbce434473492c85bb2654a91248 (diff) | |
download | bun-cc0d9200187de8d405dffcdb23c588e182ceccef.tar.gz bun-cc0d9200187de8d405dffcdb23c588e182ceccef.tar.zst bun-cc0d9200187de8d405dffcdb23c588e182ceccef.zip |
Merge branch 'main' into fix-http
Diffstat (limited to 'src/bun.js/bindings/CommonJSModuleRecord.cpp')
-rw-r--r-- | src/bun.js/bindings/CommonJSModuleRecord.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bun.js/bindings/CommonJSModuleRecord.cpp b/src/bun.js/bindings/CommonJSModuleRecord.cpp index c7dac89c2..8adba197c 100644 --- a/src/bun.js/bindings/CommonJSModuleRecord.cpp +++ b/src/bun.js/bindings/CommonJSModuleRecord.cpp @@ -817,6 +817,12 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionRequireCommonJS, (JSGlobalObject * lexicalGlo WTF::String specifier = specifierValue.toWTFString(globalObject); RETURN_IF_EXCEPTION(throwScope, {}); + // Special-case for "process" to just return the process object directly. + if (UNLIKELY(specifier == "process"_s || specifier == "node:process"_s)) { + jsDynamicCast<JSCommonJSModule*>(callframe->argument(1))->putDirect(vm, builtinNames(vm).exportsPublicName(), globalObject->processObject(), 0); + return JSValue::encode(globalObject->processObject()); + } + WTF::String referrer = thisObject->id().toWTFString(globalObject); RETURN_IF_EXCEPTION(throwScope, {}); |