dart-lang / source_gen

Automatic source code generation for Dart
https://pub.dev/packages/source_gen
BSD 3-Clause "New" or "Revised" License
484 stars 105 forks source link

Support path with parenthesis #703

Closed hypen-flutter closed 6 months ago

hypen-flutter commented 6 months ago

Parenthesized path like (this)

I am creating a nextjs-like file-based routing system. It contains a path grouping mechanism that uses the (parenthesized) path. source_gen currently depends on glob, and the glob uses the regular expression. In regular expression, () works as a capture. Thus, if the path contains the (this)-like path, source_gen throws an error.

image

To support this path, I change the code that appends the escaping character \ before the parenthesis.

This is a one-line change, so I did not add the test, modify the changelog, or change the pubspec package version. If those are required, please let me know.

Contribution guidelines:
- See our [contributor guide](https://github.com/dart-lang/.github/blob/main/CONTRIBUTING.md) for general expectations for PRs. - Larger or significant changes should be discussed in an issue before creating a PR. - Contributions to our repos should follow the [Dart style guide](https://dart.dev/guides/language/effective-dart) and use `dart format`. - Most changes should add an entry to the changelog and may need to [rev the pubspec package version](https://github.com/dart-lang/sdk/wiki/External-Package-Maintenance#making-a-change). - Changes to packages require [corresponding tests](https://github.com/dart-lang/.github/blob/main/CONTRIBUTING.md#Testing). Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.
jakemac53 commented 6 months ago

This is a one-line change, so I did not add the test, modify the changelog, or change the pubspec package version. If those are required, please let me know.

We should add a test, but the version can stay as is. An entry in the changelog should be added for the 1.5.1-wip version which will be the next release.

hypen-flutter commented 6 months ago

I've added a test and modified the changelog.

hypen-flutter commented 6 months ago

I've refactored the code to conform to the lint rule.