Skip to content
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

SyntaxError: Invalid regular expression: unmatched parentheses #2893

Closed
vxna opened this issue May 16, 2023 · 1 comment · Fixed by #2909
Closed

SyntaxError: Invalid regular expression: unmatched parentheses #2893

vxna opened this issue May 16, 2023 · 1 comment · Fixed by #2909
Labels
bug Something isn't working

Comments

@vxna
Copy link

vxna commented May 16, 2023

What version of Bun is running?

0.6.0

What platform is your computer?

Darwin 22.4.0 arm64 arm

What steps can reproduce the bug?

$ bun install hex-rgb
import hexRgb from 'hex-rgb'
console.log(hexRgb('4183c4'))
$ bun run index.mjs

What is the expected behavior?

$ node -v
v16.20.0

$ node index.mjs
{ red: 65, green: 131, blue: 196, alpha: 1 }

What do you see instead?

$ bun index.mjs
1 | const hexCharacters = 'a-f\\d';
2 | const match3or4Hex = `#?[${hexCharacters}]{3}[${hexCharacters}]?`;
3 | const match6or8Hex = `#?[${hexCharacters}]{6}([${hexCharacters}]{2})?`;
4 | const nonHexChars = new RegExp(`[^#${hexCharacters}]`, 'gi');
5 | const validHexSize = new RegExp(`^${match3or4Hex}$|^${match6or8Hex}$`, 'i');
                         ^
SyntaxError: Invalid regular expression: unmatched parentheses
      at /Users/vxna/dev/public/bun-repro/node_modules/hex-rgb/index.js:5:21

Additional information

No response

@vxna vxna added the bug Something isn't working label May 16, 2023
@Jarred-Sumner
Copy link
Collaborator

Jarred-Sumner commented May 16, 2023

this reads like an inlining bug in the transpiler

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants