oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.31k stars 2.78k forks source link

regexp loading false error #1486

Closed Mantou1233 closed 1 year ago

Mantou1233 commented 2 years ago

What version of Bun is running?

0.2.2

What platform is your computer?

Linux 4.4.0-19041-Microsoft #1237-Microsoft Sat Sep 11 14:32:00 PST 2021 x86_64 x86_64

What steps can reproduce the bug?

install discord.js cannot load because image regexp cannot load

How often does it reproduce? Is there a required condition?

n

What is the expected behavior?

it loading manually

What do you see instead?

image

Additional information

n

Jarred-Sumner commented 2 years ago

cc @dylan-conway

dylan-conway commented 2 years ago

@Jarred-Sumner oniguruma requires only the property value in property escapes. The fix would be to remove the equals sign and almost everything before it (\p{^Script=Deva} => \p{^Deva} and \p{Script=Thai} => \p{Thai}). The problem is there doesn't seem to be support for Script_Extensions:

"٢".match(/\p{Script=Thaana}/u);
// null as Thaana is not the predominant script

"٢".match(/\p{Script_Extensions=Thaana}/u);
// ["٢", index: 0, input: "٢", groups: undefined]

Both will return null with oniguruma. I'm pretty sure discord.js doesn’t use Script_Extensions anywhere so it’s not a problem here, but other libraries might

Jarred-Sumner commented 1 year ago

Fixed in Bun 0.3.1