aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/builtins/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js/builtins/cpp')
-rw-r--r--src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.cpp34
-rw-r--r--src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.h9
2 files changed, 43 insertions, 0 deletions
diff --git a/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.cpp b/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.cpp
index d44656f75..c2276138e 100644
--- a/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.cpp
+++ b/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.cpp
@@ -48,6 +48,40 @@
namespace WebCore {
+const JSC::ConstructAbility s_processObjectInternalsBindingCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const JSC::ConstructorKind s_processObjectInternalsBindingCodeConstructorKind = JSC::ConstructorKind::None;
+const JSC::ImplementationVisibility s_processObjectInternalsBindingCodeImplementationVisibility = JSC::ImplementationVisibility::Public;
+const int s_processObjectInternalsBindingCodeLength = 688;
+static const JSC::Intrinsic s_processObjectInternalsBindingCodeIntrinsic = JSC::NoIntrinsic;
+const char* const s_processObjectInternalsBindingCode =
+ "(function (bindingName) {\n" \
+ " \"use strict\";\n" \
+ " bindingName !== \"constants\" &&\n" \
+ " @throwTypeError(\n" \
+ " 'process.binding() is not supported in Bun. If that breaks something, please file an issue and include a reproducible code sample.'\n" \
+ " );\n" \
+ "\n" \
+ " var cache = globalThis.Symbol.for(\"process.bindings.constants\");\n" \
+ " var constants = globalThis[cache];\n" \
+ " if (!constants) {\n" \
+ " const {constants: fs} = globalThis[globalThis.Symbol.for(\"Bun.lazy\")](\n" \
+ " \"createImportMeta\",\n" \
+ " \"node:process\"\n" \
+ " ).require(\n" \
+ " \"node:fs\"\n" \
+ " )\n" \
+ " constants = {\n" \
+ " fs,\n" \
+ " zlib: {},\n" \
+ " crypto: {},\n" \
+ " os: @Bun._Os().constants,\n" \
+ " };\n" \
+ " globalThis[cache] = constants;\n" \
+ " }\n" \
+ " return constants;\n" \
+ "})\n" \
+;
+
const JSC::ConstructAbility s_processObjectInternalsGetStdioWriteStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const JSC::ConstructorKind s_processObjectInternalsGetStdioWriteStreamCodeConstructorKind = JSC::ConstructorKind::None;
const JSC::ImplementationVisibility s_processObjectInternalsGetStdioWriteStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public;
diff --git a/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.h b/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.h
index c3af84061..a109d2de0 100644
--- a/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.h
+++ b/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.h
@@ -47,6 +47,11 @@ class FunctionExecutable;
namespace WebCore {
/* ProcessObjectInternals */
+extern const char* const s_processObjectInternalsBindingCode;
+extern const int s_processObjectInternalsBindingCodeLength;
+extern const JSC::ConstructAbility s_processObjectInternalsBindingCodeConstructAbility;
+extern const JSC::ConstructorKind s_processObjectInternalsBindingCodeConstructorKind;
+extern const JSC::ImplementationVisibility s_processObjectInternalsBindingCodeImplementationVisibility;
extern const char* const s_processObjectInternalsGetStdioWriteStreamCode;
extern const int s_processObjectInternalsGetStdioWriteStreamCodeLength;
extern const JSC::ConstructAbility s_processObjectInternalsGetStdioWriteStreamCodeConstructAbility;
@@ -59,17 +64,21 @@ extern const JSC::ConstructorKind s_processObjectInternalsGetStdinStreamCodeCons
extern const JSC::ImplementationVisibility s_processObjectInternalsGetStdinStreamCodeImplementationVisibility;
#define WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_DATA(macro) \
+ macro(binding, processObjectInternalsBinding, 1) \
macro(getStdioWriteStream, processObjectInternalsGetStdioWriteStream, 2) \
macro(getStdinStream, processObjectInternalsGetStdinStream, 3) \
+#define WEBCORE_BUILTIN_PROCESSOBJECTINTERNALS_BINDING 1
#define WEBCORE_BUILTIN_PROCESSOBJECTINTERNALS_GETSTDIOWRITESTREAM 1
#define WEBCORE_BUILTIN_PROCESSOBJECTINTERNALS_GETSTDINSTREAM 1
#define WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(macro) \
+ macro(processObjectInternalsBindingCode, binding, ASCIILiteral(), s_processObjectInternalsBindingCodeLength) \
macro(processObjectInternalsGetStdioWriteStreamCode, getStdioWriteStream, ASCIILiteral(), s_processObjectInternalsGetStdioWriteStreamCodeLength) \
macro(processObjectInternalsGetStdinStreamCode, getStdinStream, ASCIILiteral(), s_processObjectInternalsGetStdinStreamCodeLength) \
#define WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_FUNCTION_NAME(macro) \
+ macro(binding) \
macro(getStdinStream) \
macro(getStdioWriteStream) \