New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
internal: remove secret hidden internals and introduce new way to call native code from js #8166
Conversation
Exciting We can keep DO_NOT_USE_OR_YOU_WILL_BE_FIRED_mimalloc_dump imo |
v fancy |
deb72c4
to
ea4d610
Compare
❌ @paperdave 4 files with test failures on bun-darwin-x64: |
❌🪟 @paperdave, there are 9 test regressions on Windows x86_64
|
merge conflicts |
this PR is marked breaking as it removes some hidden apis. we will merge this before 1.1 but before the last 1.0.x |
❌ @paperdave 3 files with test failures on linux-x64-baseline: |
test/js/bun/wasm/wasi.test.js test i think is real |
❌ @paperdave 3 files with test failures on linux-x64: |
* run-eval.test.ts * transpiler-cache.test.ts * node net * some open things * a * a * yikes * incredible * run it back * a * this code is what i like to call, incorrect * ok its all worng * remove an assertion that is wrong again * update test things and rebase * performance test * mark filesink with mkfifo as todo. see #8166 * hehe * not done * awa * fs test pass --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
* run-eval.test.ts * transpiler-cache.test.ts * node net * some open things * a * a * yikes * incredible * run it back * a * this code is what i like to call, incorrect * ok its all worng * remove an assertion that is wrong again * update test things and rebase * performance test * mark filesink with mkfifo as todo. see #8166 * hehe * not done * awa * fs test pass --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
What does this PR do?
ooooh magic javascript preprocessor shenanigans.
This PR removes
$lazy
, and replaces it with two alternatives:$cpp
and$zig
. These both take a filename and a function name, and they will call the function defined with no arguments.@lazy
Examples:
With this done, I will also be removing the following definitions
globalThis[Symbol.for("Bun.lazy")]
Bun.fs
Bun._Path
Bun._Os()
The API
Bun.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_mimalloc_dump
has been renamed toBun.unsafe.dumpMimalloc()
. While left undocumented, this will hopefully reduce the number of people fired from bun.If internals are required for unit testing, two mechanisms will be provided. In order for either to work, the environment variables
BUN_GARBAGE_COLLECTOR_LEVEL
andBUN_FEATURE_FLAG_INTERNAL_FOR_TESTING
must be set, or you must be running in a debug build.From there, runtime versions of$zig
and$cpp
will exist on the global object. These work the same as the bundled ones, but only map to symbols that have a used binding in thesrc/js
. Perhaps we can add a way to add additional bindings that aren't used insrc/js
but able to be exposed for testing, such as the syntax highlighter.From there, you can use
bun:internal-for-testing
, which currently contains three declarations:Extra Tasks