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
Revert "Don't allow :
in file names. (#3972)"
#4050
Conversation
This reverts commit 85304f2.
Thank you for your contribution! ❤️You can try out this pull request locally by installing Rollup via npm install guybedford/rollup#revert-3972 or load it into the REPL: |
Codecov Report
@@ Coverage Diff @@
## master #4050 +/- ##
==========================================
- Coverage 97.48% 97.48% -0.01%
==========================================
Files 192 192
Lines 6788 6786 -2
Branches 1996 1995 -1
==========================================
- Hits 6617 6615 -2
Misses 84 84
Partials 87 87
Continue to review full report at Codecov.
|
Unfortunately, I'm not familiar with JSPM, or the "readFile level" you mention, so I'm probably not the best person to make that fix. I'm curious if Rollup aims to support Windows in the future though. |
Additionally, if we've got contention between rewriting Is it worth adding a unit test explicitly for JSPM build support? |
And just to explicitly call this out -- this revert likely won't fix that issue on Windows, if the code relies on writing directory paths that contain |
Maybe instead of reverting and back, we should find a solution that helps everyone? As for myself, I would be super happy to really support arbitrary strings as ids as assuming as little as possible about the target system is part of Rollup's philosophy. Maybe a switch "sanitizeFileNames" which, when activated, sanitizes for maximum compatibility while without the switch, it does not sanitize (but risks failing if you let Rollup just blindly write files to disk). What do you think? |
Definitely would prefer a solution that fixes both cases! 😊 In my experience, two separate functions with different names is less error prone than one with a switch. Something like “sanitizeModuleURL” and “sanitizeFilesystemPath”? |
Not sure I understand. First of all, I do not think we have any issue when reading files. Arbitrary ids for modules should be ok here and should always have been ok. |
@NfNitLoop I've posted some thoughts on the root cause of your original issue in NfNitLoop/feoblog#16 (comment). Perhaps one fix is to rename In terms of more generally tackling this sanitization function, it could be interesting to trace back the original reason for the I'd prefer to treat solving the general sanitization problem as separate to this PR, and this PR as a bug fix. But I'm happy to continue discussion here as well. |
It does sound to me though like renaming |
(and specifically in the node resolve plugin itself at https://github.com/rollup/plugins/blame/master/packages/node-resolve/src/index.js#L15) |
That is unfortunately no longer true thanks to the |
At this point, I am not convinced this is a bug fix but rather trading one bug for another, though in different scenarios experienced by different people. |
@lukastaegert would you like to suggest a route forward then? |
IMO sanitization should not be a core feature, but a plugin feature, and externals should be properly sanitized by the appropriate resolver during externalization. Does anyone disagree with this revert explicitly because it is deemed a necessary feature for sanitization to handle |
I think it is currently necessary to make |
Actually looking at your initial reason for posting this, there is one wrong assumption
This is not true. Rollup chunks names are path fragments of the form My feeling is you have a very different issue from the one you are fixing here. |
@lukastaegert a switch to disable sanitization could well work. The chunk name sanitization is definitely what is failing for me, since I have |
Out of curiosity, what do your chunk names look like? Another question to think about, if we allow to disable sanitation, I would assume we disable it altogether, i.e. also keep |
See eg https://jspm.dev/npm:uuid@8!cjs. JSPM does an in-memory build for URLs only. For the sanitization problem, I guess I'm still not clear on what value is provided by |
Is this PR superseded by #4058? |
Currently, yes, per the feedback here. Although I would still prefer this approach of simplifying and removing over adding as a general principle especially since I believe the original reason for the original PR was misguided. But I will not argue this further. |
Closing, see above |
This reverts commit 85304f2.
Modules are URLs in Node.js and on the Web. RollupJS outputs relative paths which are relative URLs.
Banning relative URLs that contain
:
is thus banning valid URL usages, and this breaks support for eg JSPM builds which rely on relative paths like'../npm:pkg@version'
to be possible to build.@NfNitLoop perhaps you could ban
:
at the readFile level when assuming a path rather? I think there would be more flexibility for RollupJS to keep it open for the internal format to be fully URL compatible (eg building URLs in future as well for eg Deno workflows).This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
Description