Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[AssetMapper] Fix import map package parsing with an @ namespace#50206
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[AssetMapper] Fix import map package parsing with an @ namespace#50206
Uh oh!
There was an error while loading.Please reload this page.
Conversation
nicolas-grekas commentedMay 2, 2023
Thank you@weaverryan. |
| { | ||
| // https://regex101.com/r/58bl9L/1 | ||
| $regex ='/(?:(?P<registry>[^:\n]+):)?(?P<package>[^@\n]+)(?:@(?P<version>[^\s\n]+))?/'; | ||
| // https://regex101.com/r/d99BEc/1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I would remove this comment entirely. Someone wanting to get the regex explanation on regex101.com can copy-paste the regex instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I got this idea from@dunglas - the nice thing about it is that the regex includes a bunch of examples. So if there is a problem in the future, you can quickly open this to see what the passing test cases are and then either validate that (A) the situation you are having trouble with SHOULD be working or (B) that your test case was never included.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Exactly, the main benefit it that we can add tests for the regex.
This method is used with the
importmap:requirecommand - e.g.It parses the string into the package name and potential version (and something called a "registry" which is specific to jspm). The original regex didn't account for namespaced packages.
Cheers!