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

feat: add RegExp converter #368

Merged
merged 5 commits into from
Mar 6, 2024
Merged

Conversation

serkodev
Copy link
Contributor

@serkodev serkodev commented Jan 6, 2024

πŸ”— Linked issue

Apologies, there's no linked issue, as this was originally a feature for my personal use.

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

The purpose of creating this converter is due to some of my projects having a large amount of Regex that are difficult to maintain and read. I hope to revamp them using magic-regexp. However, given the vast and complex quantity of Regex, I aim to facilitate their transformation with this converter.

While developing the converter, I discovered some regex syntaxes not yet supported by magic-regexp. Therefore, I've specifically marked these instances in the code with comments or throw error messages. This is to facilitate future modifications when these features are supported. Hence, this converter might also serve as a tracking tool for a functionality todo list, identifying missing regex features.

If this converter could be developed into a UI and integrated into the documentation page in the future, it might enable developers who are new to magic-regexp to get up to speed more quickly. Additionally, it could also encourage more developers to contribute test cases to the converter.

I believe there are many areas where the current converter can be improved, such as accommodating some unforeseen test cases. I'm uncertain whether I should create a PR for the current progress of the converter into this repository, or if it should be split into a separate project. I would appreciate any advice on this matter.

For details usage description and demo, please refer to ./converter/README.md.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@serkodev serkodev changed the title feat: add regex converter feat: add RegExp converter Jan 7, 2024
@danielroe
Copy link
Member

Goodness, I can't believe I didn't see this previously! Thank you. I'll review more fully later.

test/converter.test.ts Dismissed Show dismissed Hide dismissed
Copy link

codecov bot commented Mar 6, 2024

Codecov Report

All modified and coverable lines are covered by tests βœ…

Project coverage is 100.00%. Comparing base (892a9e9) to head (ed9d2b3).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #368   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         7           
  Lines          629       629           
  Branches        65        65           
=========================================
  Hits           629       629           

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

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

I love this! ❀️

I'd also like to get a playground up so people can play with converting regular expressions back and forth - so it couldn't have come at a better time.

Let's merge as a subpath export, and then iterate. πŸ™

@danielroe danielroe merged commit 5fa24dd into unjs:main Mar 6, 2024
6 checks passed
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.

None yet

2 participants