diff options
author | 2022-06-22 22:52:03 -0700 | |
---|---|---|
committer | 2022-06-22 22:52:03 -0700 | |
commit | a77825799e83b05833f22b4d7f8950ff2bc3fe00 (patch) | |
tree | bad8460540733f8ede8048fdd6b6c11457a570c2 /src/javascript/jsc/builtins/README.md | |
parent | 7db88ca6b5614463d70bdf048b42abc9996b3a4f (diff) | |
download | bun-a77825799e83b05833f22b4d7f8950ff2bc3fe00.tar.gz bun-a77825799e83b05833f22b4d7f8950ff2bc3fe00.tar.zst bun-a77825799e83b05833f22b4d7f8950ff2bc3fe00.zip |
Move builtins to src/javascript/jsc/builtins
Diffstat (limited to 'src/javascript/jsc/builtins/README.md')
-rw-r--r-- | src/javascript/jsc/builtins/README.md | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/javascript/jsc/builtins/README.md b/src/javascript/jsc/builtins/README.md new file mode 100644 index 000000000..8ec32e8b5 --- /dev/null +++ b/src/javascript/jsc/builtins/README.md @@ -0,0 +1,30 @@ +# JavaScript Builtins + +JavaScript files in [./js](./js) use JavaScriptCore's builtins syntax + +```js +@getter +function foo() { + return @getByIdDirectPrivate(this, "superSecret"); +} +``` + +It looks kind of like decorators but they're not. They let you directly call engine intrinsics and help with avoiding prototype pollution issues. + +V8 has a [similar feature](https://v8.dev/blog/embedded-builtins) (they use `%` instead of `@`) + +They usually are accompanied by a C++ file. + +The `js` directory is necessary for the bindings generator to work. + +To regenerate the builtins, run this from Bun's project root (where the `Makefile` is) + +```bash +make generate-builtins +``` + +You'll want to also rebuild all the C++ bindings or you will get strange crashes on start + +```bash +make clean-bindings +``` |