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

Cannot convert ECMASCRIPT_2018 feature "RegExp unicode property escape" #4121

Open
haraleib opened this issue Sep 12, 2023 · 2 comments
Open
Labels
feat Feature Request

Comments

@haraleib
Copy link

I wonder if there is a reason why google closure-compiler can't convert the following snippet while Babel can do it. (Snippet available with the links below)

Maybe somebody can help me out here or have some input concerning this issue.

Google closure-compiler:
https://closure-compiler.appspot.com/home#code%3D%252F%252F%2520%253D%253DClosureCompiler%253D%253D%250A%252F%252F%2520%2540compilation_level%2520SIMPLE_OPTIMIZATIONS%250A%252F%252F%2520%2540output_file_name%2520default.js%250A%252F%252F%2520%253D%253D%252FClosureCompiler%253D%253D%250A%250A%252F%252F%2520ADD%2520YOUR%2520CODE%2520HERE%250Afunction%2520proper(ast%252C%2520state)%2520%257B%250A%2520%2520%2520%2520return%2520this.runFunction(ast.args%252C%2520state%252C%2520this.metadata('PROPER')%252C%2520arg%2520%253D%253E%2520%257B%250A%2520%2520%2520%2520%2520%2520return%2520arg.replace(%252F%255Cp%257BL%257D%252B%252Fgu%252C%2520word%2520%253D%253E%2520word.charAt(0).toUpperCase()%2520%252B%2520word.substring(1).toLowerCase())%253B%250A%2520%2520%2520%2520%257D)%253B%250A%257D%250A%250A,

Babel:
https://babeljs.io/repl#?browsers=&build=&builtIns=false&corejs=3.21&spec=false&loose=false&code_lz=GYVwdgxgLglg9mABABwE52QU1QCgIYDOUANIkXlJgJSIDeAUIk4qplCKklABYwEB0qcADFw0eGHxF-eVAHMCpcpVI8-_ALZs8AEwp4cAcgAKAJQDyxgKKnDVUrLmIAvAD46jZk1btOiR4KYyAA2eBCYOAD0ADrItAAyAL4A1JFyIKQA7nCoOi7u2bn8ENyyAIJQOAAMVPxQcACqyFioAMKEETTJiIU6_AQgAEZEqDBgcjgAjLX18XCZ2O0EnVQA3J5MiWv0iUA&debug=false&forceAllTransforms=false&modules=false&shippedProposals=false&circleciRepo=&evaluate=false&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=env%2Cstage-2&prettier=false&targets=&version=7.22.17&externalPlugins=&assumptions=%7B%7D

@lauraharker lauraharker changed the title JSC_UNTRANSPILABLE: Cannot convert ECMASCRIPT_2018 feature Cannot convert ECMASCRIPT_2018 feature "RegExp unicode property escape" Sep 12, 2023
@lauraharker
Copy link
Contributor

Hi @haraleib, Closure Compiler doesn't have any support for transpiling regular expressions to work on older browsers. I'll leave this open as a feature request but I think it's unlikely to change.

As the Babel example shows, transpiling regular expression syntax can be very verbose, and Closure Compiler's design is more focused on code size minification.

I think your options are to use Babel, avoid newer regex syntax, or set a newer --language_out.

@lauraharker lauraharker added the feat Feature Request label Sep 12, 2023
@haraleib
Copy link
Author

@lauraharker thank you for your explanation. Would be a cool feature. But nevertheless everything is clear for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Feature Request
Projects
None yet
Development

No branches or pull requests

2 participants