From 9282647e6ce47d521dc81f01a1813baf2d96a5f7 Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Fri, 6 Sep 2024 12:02:44 +0000 Subject: [PATCH] docs(transformer): comment on RegExp transform for potential improvement (#5514) I think it's correct that we could do better here. Or is there some difference in behavior between `RegExp(...)` and `new RegExp(...)`? --- crates/oxc_transformer/src/regexp/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/oxc_transformer/src/regexp/mod.rs b/crates/oxc_transformer/src/regexp/mod.rs index 8d0b63352d878..53a992bfc555a 100644 --- a/crates/oxc_transformer/src/regexp/mod.rs +++ b/crates/oxc_transformer/src/regexp/mod.rs @@ -39,6 +39,10 @@ //! #### Set notation + properties of strings (`v`) //! - @babel/plugin-transform-unicode-sets-regex: //! - TC39 Proposal: +//! +//! TODO(improve-on-babel): We could convert to plain `RegExp(...)` instead of `new RegExp(...)`. +//! TODO(improve-on-babel): When flags is empty, we could output `RegExp("(?<=x)")` instead of `RegExp("(?<=x)", "")`. +//! (actually these would be improvements on ESBuild, not Babel) use std::borrow::Cow;