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

Enable blacklisting of optimizations #200

Merged
merged 1 commit into from
Dec 3, 2019
Merged

Enable blacklisting of optimizations #200

merged 1 commit into from
Dec 3, 2019

Conversation

voxpelli
Copy link
Contributor

@voxpelli voxpelli commented Dec 3, 2019

Makes it easier to disable some optimizations, as requested in eg. #199. Also adds some specific tests for one of the feature that's highlighted in #199 and is a partial fix for that issue.

Makes it easier to disable some optimizations, as requested in eg. #199. Also adds some specific tests for one of the feature that's highlighted in #199 and is a partial fix for that issue.
@@ -123,8 +123,8 @@ const regexpTree = {
*
* @return TransformResult object
*/
optimize(regexp, whitelist) {
return optimizer.optimize(regexp, whitelist);
optimize(regexp, whitelist, {blacklist} = {}) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, so it's not a breaking change, and existing code which pass just the whitelist will continue to work 👍 Later we can add a deprecation notice, and eventually migrate to the single param with {whitelist, blacklist}.


expect(
optimizer
.optimize(original, {blacklist: ['charClassClassrangesMerge']})
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The blacklist is fine, although it disables the full transform. I think eventually we should also have options property, which would allow more granular configuring. Something like:

{
  whitelist: ['charClassClassrangesMerge'],
  options: {
    charClassClassrangesMerge: {
      preserveCharOrder: true,
    }
  }
}

@DmitrySoshnikov
Copy link
Owner

Thanks!

Merging this one, and if you'd like also to add support for per-transform options, would be great.

@DmitrySoshnikov DmitrySoshnikov merged commit 6a602b4 into DmitrySoshnikov:master Dec 3, 2019
@voxpelli voxpelli deleted the feature/blacklist-optimizations branch December 4, 2019 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants