oxc/tasks
leaysgur 5a73a663dc refactor(regular_expression)!: Simplify public APIs (#6262)
This PR makes 2 changes to improve the existing API that are not very useful.

- Remove `(Literal)Parser` and `FlagsParser` and their ASTs
- Add `with_flags(flags_text)` helper to `ParserOptions`

Here are the details.

> Remove `(Literal)Parser` and `FlagsParser` and their ASTs

Previously, the `oxc_regular_expression` crate exposed 3 parsers.

- `(Literal)Parser`: assumes `/pattern/flags` format
- `PatternParser`: assumes `pattern` part only
- `FlagsParser`: assumes `flags` part only

However, it turns out that in actual usecases, only the `PatternParser` is actually sufficient, as the pattern and flags are validated and sliced in advance on the `oxc_parser` side.

The current usecase for `(Literal)Parser` is mostly for internal testing.

There were also some misuses of `(Literal)Parser` that restore `format!("/{pattern}/{flags}")` back and use `(Literal)Parser`.

Therefore, only `PatternParser` is now published, and unnecessary ASTs have been removed.
(This also obsoletes #5592 .)

> Added `with_flags(flags_text)` helper to `ParserOptions`

Strictly speaking, there was a subtle difference between the "flag" strings that users were aware of and the "mode" recognised by the parser.

Therefore, it was a common mistake to forget to enable `unicode_mode` when using the `v` flag.

With this helper, crate users no longer need to distinguish between flags and modes.
2024-10-03 02:47:08 +00:00
..
ast_tools perf(linter, ast-tools, coverage): Use FxHashSet instead of std::collections::HashSet (#6001) 2024-09-24 19:29:08 +08:00
benchmark refactor(transformer)!: remove source_type param from Transformer::new (#6251) 2024-10-03 00:21:01 +00:00
common perf(rust): use cow_utils instead (#5664) 2024-09-11 18:39:30 +08:00
coverage refactor(regular_expression)!: Simplify public APIs (#6262) 2024-10-03 02:47:08 +00:00
javascript_globals perf(ast-tools): use FxHashMap over std::collections::HashMap (#5997) 2024-09-23 18:28:54 +00:00
lint_rules chore: use dprint to format js, json and markdown 2024-09-08 13:24:58 +08:00
minsize feat(minifier): fold true / false comparison. (#6225) 2024-10-02 13:37:17 +00:00
prettier_conformance perf(linter, ast-tools, coverage): Use FxHashSet instead of std::collections::HashSet (#6001) 2024-09-24 19:29:08 +08:00
rulegen feat(rulegen): add diagnostic for rule template (#6187) 2024-10-01 11:04:50 +08:00
transform_conformance refactor(transformer): shared VarDeclarations (#6170) 2024-09-30 03:53:00 +00:00
website feat(linter): add oxc-security/api-keys (#5906) 2024-09-22 22:39:56 +00:00