-
Notifications
You must be signed in to change notification settings - Fork 632
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
suggestion(path): remove posix.toNamespacedPath()
#4069
Comments
posix.toNamespacedPath()
posix.toNamespacedPath()
There was a feedback from @jollytoad that they like to see |
I understand but disagree. It being consistent isn't a reasonable justification for having a no-op function. |
I still don't fully understand the benefit of @jollytoad Could you elaborate on what can be achieved with it? |
The idea was that you could remap |
It unfortunately doesn't work though, we really needed the platform specific modules to not be a sub-path of |
Mapping per file still works with current structure: {
"imports": {
"https://deno.land/[email protected]/path/mod.ts": "https://deno.land/[email protected]/path/posix/mod.ts"
}
} import { basename } from "https://deno.land/[email protected]/path/mod.ts";
console.log(basename.toString()); The above only maps |
Remapping seems like an edge case that doesn't justify having a function that does nothing but return its argument. |
If remapping like the above works, that could be a part of best practice for deploying to prod environment, I guess (You can remove some dependency for free). Also keeping |
Yes. Keeping Either way, feel free to close this issue if you feel strongly enough about it. It's no big deal, either way. |
@kt3k remapping the single mod.ts isn't effective, as other modules use the individual modules directly, for remapping to be truely effective you need to remap the folder (trailing /), but the fact that the target is a sub-path path complicates things (ie. path/ -> path/posix/), if it were a sibling (ie. path/ -> path_posix/) it would make the remapping simple and effective. import maps allow a very simple and efficient static dependency injection mechanism, i find it a shame that it hasn't been embraced more by the Deno community (maybe I need to write a blog!) I'd love to see it become a standard practice in the std lib wherever a implementation choice may occur, although it would require another round of reorganisation (see the PR I linked to earlier). Here's a more concrete example of a simple Deno library I've created that utilises import mapping to chose an implementation of a simple storage interface, the choice being Deno.KV, web storage, filesystem etc... https://github.com/jollytoad/deno_storage_modules |
Sticking to the subject, are we fine with removing |
I'm not convinced. The benefit by getting rid of it feels too minimal or nothing. And remapping of {
"imports": {
"https://deno.land/[email protected]/path/mod.ts": "https://deno.land/[email protected]/path/posix/mod.ts",
"https://deno.land/[email protected]/path/basename.ts": "https://deno.land/[email protected]/path/posix/basename.ts",
"https://deno.land/[email protected]/path/common.ts": "https://deno.land/[email protected]/path/posix/common.ts",
...
}
} So this can be free perf improvement of any app when deployed to certain platform. |
Ok. Closing. |
No description provided.
The text was updated successfully, but these errors were encountered: