# JavaScript Builtins **TLDR** — When files in this directory change, run: ```bash # Delete the built files $ make regenerate-bindings # Re-link the binary without compiling zig (so it's faster) $ make bun-link-lld-debug ``` TypeScript files in [./ts](./ts) are bundled into C++ Headers that can access JavaScriptCore intrinsics. These files use special globals that are prefixed with `$`. ```js $getter export 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. We use a custom code generator located in `./codegen` which contains a regex-based parser that separates each function into it's own bundling context, so syntax like top level variables / functions will not work. You can also use `process.platform` and `process.arch` in these files. The values are inlined and DCE'd. ## Generating builtins To regenerate the builtins, run this from Bun's project root (where the `Makefile` is) ```bash $ make builtins ``` You'll want to also rebuild all the C++ bindings or you will get strange crashes on start ```bash $ make clean-bindings ``` The `make regenerate-bindings` command will clean and rebuild the bindings. Also, you can run the code generator manually. ```bash $ bun ./codegen/index.ts # pass --minify to minify (make passes this by default) # pass --keep-tmp to keep the temporary ./tmp folder, which contains processed pre-bundled .ts files ``` e='ciro/proxy-connect-tests'>ciro/proxy-connect-tests Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/import-require-tla.js (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2022-12-17Update globals.d.tsGravatar Jarred Sumner 1-2/+5
2022-12-17Add warning in import.meta.requireGravatar Jarred Sumner 1-0/+5
2022-12-17Delete Oniguruma (#1625)Gravatar Jarred Sumner 69-3531/+19
2022-12-17Missing from commitGravatar Jarred Sumner 1-23/+22
2022-12-17Fixes https://github.com/oven-sh/bun/issues/1624Gravatar Jarred Sumner 1-41/+1
2022-12-17Regenerate builtinsGravatar Jarred Sumner 1-7/+2
2022-12-17Update transpiler.test.jsGravatar Jarred Sumner 1-17/+24
2022-12-17Update WebKitGravatar Jarred Sumner 6-28/+28