diff options
author | 2022-11-03 00:18:26 -0700 | |
---|---|---|
committer | 2022-11-03 00:18:26 -0700 | |
commit | 6142715c06d5eb3dbaa07901a6281ae1394483a9 (patch) | |
tree | c549d8597ba4f89b1e3a19efdcd2351297d5b5cb /src/bun.js/bindings/ZigGlobalObject.h | |
parent | 34e130a3e0cb251cb163071b75228c6d521edf95 (diff) | |
download | bun-6142715c06d5eb3dbaa07901a6281ae1394483a9.tar.gz bun-6142715c06d5eb3dbaa07901a6281ae1394483a9.tar.zst bun-6142715c06d5eb3dbaa07901a6281ae1394483a9.zip |
Introduce `import.meta.primordials` for builtin JS
the `import.meta` object in Bun now has a `primordials` object which makes a handful of globals safe for access. Inside of bun: or node: modules, it is a special object (ownKeys is not implemented, so Object.keys() wont work on it)
- Array
- String
- `isPromise`
- `isCallable`
- `isConstructable`
- `tryGetById(foo, "bar')` which is like foo?.bar
- `arrayPush` which is like `Array.prototype.push`
- `Bun`
- `isAbortSignal`
cc @ThatOneBro @lawrencecchen
Diffstat (limited to 'src/bun.js/bindings/ZigGlobalObject.h')
-rw-r--r-- | src/bun.js/bindings/ZigGlobalObject.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/bun.js/bindings/ZigGlobalObject.h b/src/bun.js/bindings/ZigGlobalObject.h index e91cf86bf..6863f72af 100644 --- a/src/bun.js/bindings/ZigGlobalObject.h +++ b/src/bun.js/bindings/ZigGlobalObject.h @@ -219,6 +219,7 @@ public: JSC::JSObject* encodeIntoObjectPrototype() { return m_encodeIntoObjectPrototype.getInitializedOnMainThread(this); } JSC::JSObject* performanceObject() { return m_performanceObject.getInitializedOnMainThread(this); } + JSC::JSObject* primordialsObject() { return m_primordialsObject.getInitializedOnMainThread(this); } JSC::JSObject* processObject() { @@ -417,6 +418,8 @@ private: LazyClassStructure m_JSReadableStateClassStructure; LazyClassStructure m_OnigurumaRegExpClassStructure; + LazyProperty<JSGlobalObject, JSObject> m_primordialsObject; + LazyProperty<JSGlobalObject, JSObject> m_navigatorObject; LazyProperty<JSGlobalObject, JSObject> m_JSArrayBufferControllerPrototype; |