question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Avoid using RegExp special symbols in virtual paths, e.g. $$virtual -> __virtual

See original GitHub issue

First of all, I want to say thanks to the yarn team for a great work. It made my js package-management workflow actually enjoyable.

And now to the issue itself.

Using $$virtual as a base for virtual paths breaks people’s naive RegExp code in the packages, which work completely fine in node_modules scenario.

Maintainers of such packages are not going to react to PRs fast enough, and it just makes it harder to work on actual issues in forks using portal: for no apparent reason.

Such PRs could actually break something else, which is not obvious right away, because lack of tests, etc.

https://github.com/sveltejs/svelte-loader/pull/149 https://github.com/sveltejs/svelte-loader/pull/155 https://github.com/rixo/svelte-hmr/pull/23

It also requires a dedicated @merceyz to save the day, whether he wants it at the moment or not. 🙂

I’ve been working on svelte-loader, where this situation occured and this was just getting in the way, spoiling my amazing yarn berry experience.

I wanted to just check if my fork is actually working and get done with the day, but after digging through unrelated code had to ask @merceyz to help me fix it.

I feel like the probability of having $ somewhere around node_modules is too low to justify making $-proof RegExp’s everywhere in people’s packages.

If it isn’t gonna break existing commited .pnp.js’es in user’s PnP zero-install repos, maybe it is reasonable to save some frustration for almost no cost?

What do you think?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
arcaniscommented, Jan 26, 2021

I think I’m open to reconsider, I don’t want us to lose more time and energy over this (problem happened again in a fairly known project). It’s still a bad idea for the ecosystem to do this since it’ll break with $$-paths regardless of Yarn, but we have better things to do than to fight for it 😅

Would /home/foo/app/__virtual__/xyz/0/ be acceptable? Can someone find a way to break it?

2reactions
arcaniscommented, Mar 11, 2021

Will be fixed by #2595

Read more comments on GitHub >

github_iconTop Results From Across the Web

Validating a url path with regex and excluding special characters
I would phrase the regex as: ^(?:#/|#/[A-Za-z]+(?:/[A-Za-z]+)*)$. This regex says to match: ^ from the start of the string; (?:.
Read more >
Path Matching :: Gloo Edge Docs
The route rules in a Virtual Service can use path matching rules to match requests to routes based on the context path. There...
Read more >
Removing special characters from a string field - ServiceNow
Is there a way to prevent/remove special characters from displaying in the Short Description (string) field on a form? For example, users ...
Read more >
Regular expressions with Cloudlets rules - Akamai TechDocs
If your regular expression includes any characters that have a special use in regular expressions (like “.”, “+”, or “?”), you must use...
Read more >
How to configure Content Rules (Examples Included)
this tool with take the a URL and will output the regex syntax that is ... On the LoadMaster: Go to Virtual Services...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found