blakeembrey / free-style

Make CSS easier and more maintainable by using JavaScript
MIT License
707 stars 29 forks source link

Newer version 3.1.0+ breaks in strict mode - Octal escape sequences are not allowed in template strings #85

Closed zhou closed 4 years ago

zhou commented 4 years ago

Octal escape sequences are invalid in strict mode. We discovered this because typestyle made a major update a few weeks back and brought in free-style 3.1.0. And our app could not start and shows an error: 🚨 //node_modules/typestyle/node_modules/free-style/dist.es2015/index.js: Octal escape sequences are not allowed in template strings

After some googling, we found out that: In Line 260 and 268, patterns like \0 should be escaped: \0. For example: 260: isUnique ? u\0${(++uniqueId).toString(36)} : s\0${pid}\0${style} should be 260: isUnique ? u\\0${(++uniqueId).toString(36)} : s\\0${pid}\\0${style}

For your reference, a related issue in Babel is here: https://github.com/choojs/nanohtml/issues/141

blakeembrey commented 4 years ago

Sorry, can you clarify where it doesn’t work? I’m happy to catch this but I’ve been using it in node and browsers for a while without any issues.

blakeembrey commented 4 years ago

Fixed with https://github.com/blakeembrey/free-style/commit/20079f018127989626852401a31ef1f771759326 and https://github.com/blakeembrey/free-style/releases/tag/v3.2.3.

zhou commented 4 years ago

Thanks for prompt resolution. Now we need to convey the message to typestyle to bring in the fix.