[whatwg/url] Proposal: file: URL separator deduplication (#552)

I would like to propose that file URLs include separator deduplication in the spec as a rule to match the file system identifiers themselves more closely.

The reason for this is that Node.js, Deno, and other platforms, build tools and tooling use `file:` URLs as their key in the module registry when loading ES modules. Whenever there are duplicate separators, this causes a double entry in the registry which can lead to duplicate module execution and a lack of code sharing.

These platforms and build tools are now the primary consumers of `file:` URLs since browsers no longer encourage the use case at all, therefore it is important that this spec can aim to meet their needs as primary consumers of this aspect of the spec going forward.

URL resolution already converts `\` into `/`. This leaves only casing, percent encoding, query parameters and hashes as the comprehensive list of remaining non-unique components of the file URL representation's associated path representation.

I understand a major consideration for such a change is considering the potentially major change in browsers, but perhaps it would not be so difficult since browsers so carefully discourage file URLs and the issue is rather that until now there hasn't been pressure on this use case from these new file modules platform directions.

This would smooth a number of environment bugs that otherwise need custom code to handle.

In Node.js we effectively add this renormalization step to all module resolution usage of file URLs. Other cases of fileURL resolution would benefit.

References:
* https://github.com/whatwg/url/issues/405
* https://github.com/whatwg/url/issues/405
* https://github.com/nodejs/node/pull/35477

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/552

Received on Thursday, 8 October 2020 08:50:11 UTC