bun
bun copied to clipboard
Terminal Issues
What version of Bun is running?
0.5.6
What platform is your computer?
Darwin 22.3.0 arm64 arm
What steps can reproduce the bug?
git clone https://github.com/yaronn/blessed-contrib.git
cd blessed-contrib
bun install
bun run ./examples/dashboard.js
What is the expected behavior?
git clone https://github.com/yaronn/blessed-contrib.git
cd blessed-contrib
bun install
node ./examples/dashboard.js
Running with node (the last line is changed) works as expected
What do you see instead?
40 | if ('NETLIFY' in env) {
41 | return true;
42 | }
43 |
44 | // If they specify no colors, they probably don't want hyperlinks.
45 | if (!supportsColor.supportsColor(stream)) {
^
TypeError: supportsColor.supportsColor is not a function. (In 'supportsColor.supportsColor(stream)', 'supportsColor.supportsColor' is an instance of Object)
at supportsHyperlink (/Users/steve/Code/blessed-contrib/node_modules/supports-hyperlinks/index.js:45:7)
at /Users/steve/Code/blessed-contrib/node_modules/supports-hyperlinks/index.js:98:10
at /Users/steve/Code/blessed-contrib/node_modules/marked-terminal/index.cjs:9:4
at /Users/steve/Code/blessed-contrib/lib/widget/markdown.js:5:4
at /Users/steve/Code/blessed-contrib/index.js:18:8
at /Users/steve/Code/blessed-contrib/examples/dashboard.js:2:4
Additional information
Even getting past the TTY color issue (by commenting those lines out), terminal screen info is corrupted and size calculations end up being negative.
But this does make for an entertaining test!
Thanks for reporting
Likely related to #2025 and/or maybe #1774 as well, we can test after the PR for #2025 is in soon
See here: https://github.com/oven-sh/bun/discussions/3132
~It's related to commonjs module resolution.~
~I think there is a bug in this algorithm specified here: https://bun.sh/docs/runtime/modules#importing-commonjs-from-commonjs~
EDIT: See next comment.
Workaround
This line:
const supportsColor = require('supports-color');
...needs to be changed to:
const supportsColor = require('supports-color/index.js');
supports-color is included as a "node fallback" that breaks things because its a later version where the api changed.
It probably shouldn't be a fallback.
https://github.com/search?q=repo%3Aoven-sh%2Fbun+supports-color&type=code
https://discord.com/channels/876711213126520882/888839314056839309/1113478448288120892