diff options
author | 2023-01-16 16:47:08 -0800 | |
---|---|---|
committer | 2023-01-16 16:47:08 -0800 | |
commit | b23327c2830b6e5a76f6c96fd5a5f238aaac0377 (patch) | |
tree | 3c99983978e5cc8696f1c07cc3df0b78bb74b2d2 | |
parent | c83d56c75defc8af8e843429743a073aa106e5e1 (diff) | |
download | bun-b23327c2830b6e5a76f6c96fd5a5f238aaac0377.tar.gz bun-b23327c2830b6e5a76f6c96fd5a5f238aaac0377.tar.zst bun-b23327c2830b6e5a76f6c96fd5a5f238aaac0377.zip |
[node] Add `process.config`
-rw-r--r-- | src/bun.js/bindings/Process.cpp | 31 | ||||
-rw-r--r-- | test/bun.js/process.test.js | 9 |
2 files changed, 40 insertions, 0 deletions
diff --git a/src/bun.js/bindings/Process.cpp b/src/bun.js/bindings/Process.cpp index 1511b0302..039489ed1 100644 --- a/src/bun.js/bindings/Process.cpp +++ b/src/bun.js/bindings/Process.cpp @@ -668,6 +668,37 @@ void Process::finishCreation(JSC::VM& vm) this->putDirectNativeFunction(vm, globalObject, JSC::Identifier::fromString(this->vm(), "umask"_s), 1, Process_functionUmask, ImplementationVisibility::Public, NoIntrinsic, 0); + + // target_defaults: + // { cflags: [], + // default_configuration: 'Release', + // defines: [], + // include_dirs: [], + // libraries: [] }, + // variables: + // { + // host_arch: 'x64', + // napi_build_version: 5, + // node_install_npm: 'true', + // node_prefix: '', + // node_shared_cares: 'false', + // node_shared_http_parser: 'false', + // node_shared_libuv: 'false', + // node_shared_zlib: 'false', + // node_use_openssl: 'true', + // node_shared_openssl: 'false', + // strict_aliasing: 'true', + // target_arch: 'x64', + // v8_use_snapshot: 1 + // } + // } + JSC::JSObject* config = JSC::constructEmptyObject(globalObject, globalObject->objectPrototype(), 2); + JSC::JSObject* variables = JSC::constructEmptyObject(globalObject, globalObject->objectPrototype(), 1); + variables->putDirect(vm, JSC::Identifier::fromString(vm, "v8_enable_i8n_support"_s), + JSC::jsNumber(1), 0); + config->putDirect(vm, JSC::Identifier::fromString(vm, "target_defaults"_s), JSC::constructEmptyObject(globalObject), 0); + config->putDirect(vm, JSC::Identifier::fromString(vm, "variables"_s), variables, 0); + this->putDirect(vm, JSC::Identifier::fromString(vm, "config"_s), config, 0); } const JSC::ClassInfo Process::s_info = { "Process"_s, &Base::s_info, nullptr, nullptr, diff --git a/test/bun.js/process.test.js b/test/bun.js/process.test.js index 8ea57a28b..48fc61a7e 100644 --- a/test/bun.js/process.test.js +++ b/test/bun.js/process.test.js @@ -167,3 +167,12 @@ it("process.versions", () => { expect(process.versions[name]).toBe(versions[name]); } }); + +it("process.config", () => { + expect(process.config).toEqual({ + variables: { + v8_enable_i8n_support: 1, + }, + target_defaults: {}, + }); +}); |