feat: Add support for Bun
Purpose
It supports another JavaScript runtime, a rising star - bun.
Shortly, I added a new variable, isBun, which detects if the Bun is defined and its property - version is defined.
Of course, I've added it quickly to the documentation and tests. There's a separate file - ./test/bun.ts, which can be tested by running in the terminal:
bun run ./test/bun.ts
The documentation for the Bun global object is in progress. At the current moment, you can only verify by using Bun's REPL:
bun x bun-repl
How reliant is this check @xeho91? If the documentation for Bun global object is still in progress, should we wait to write a reliable check?
How reliant is this check @xeho91? If the documentation for Bun global object is still in progress, should we wait to write a reliable check?
Sure, I am cool with waiting until the documentation for the Bun global object is present.👍
I doubt they would do any breaking changes in this object, but please do not take my word for it.
@flexdinesh
There is now a documented approach from Bun. @xeho91 pull request has done 90% of the work so its probably easier to just change this one than for me to create a new pull request.
@see https://bun.sh/guides/util/detect-bun
const isBun = typeof process !== "undefined" && process.versions != null && process.versions.bun != null;
@flexdinesh
There is now a documented approach from Bun. @xeho91 pull request has done 90% of the work so its probably easier to just change this one than for me to create a new pull request.
@see https://bun.sh/guides/util/detect-bunconst isBun = typeof process !== "undefined" && process.versions != null && process.versions.bun != null;
Thanks, ~~I'll update today after work ASAP~~
EDIT: Updated via GitHub mobile 😅 https://github.com/flexdinesh/browser-or-node/commit/a7aaa970f3cf8d2ce94cc412d2fca761c7439ffd
Thanks @xeho91. Looking good. Could you remove the files in test dir? We got rid of all tests recently because they were not really testing anything. I'll merge and publish a new version as soon as it's done.
Thanks @xeho91. Looking good. Could you remove the files in
testdir? We got rid of all tests recently because they were not really testing anything. I'll merge and published a new version as soon as it's done.
Done. Thank you for your patience.
hi @flexdinesh giving this merge request a bump
@paradoxloop good to merge. Looks like there are some conflicts. Once that's resolved, I'll merge and ship a new minor. Thanks for following this through.
@paradoxloop good to merge. Looks like there are some conflicts. Once that's resolved, I'll merge and ship a new minor. Thanks for following this through.
Hi @flexdinesh,
I am slightly confused, where are the conflicts?
Sorry I was on rebase view. My bad. Merged now. 😀
Changes published in v3.0.0 🎉 Thanks everyone!