-
Notifications
You must be signed in to change notification settings - Fork 36
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
Proposal: Break the dependencies on node_io
and dart:io
by using package:file
.
#1991
Comments
node_io
and dart:io
by using package:file
.node_io
and dart:io
by using package:file
.
The primary alternative here is to drop Node support entirely by default. I would also move the Then some other package could add a similar extension for Node using |
Moving Why not just have this package depend on |
We're going to move it to a different library either way as an extension method. If we need to we'll use an Being able to have a real cross-platform implementation of
We're hoping to avoid additional dependencies, although that one is certainly easier for us to handle than |
Expandos are fairly expensive in their own right.
Why avoid additional dependencies? It's not like |
Moving it out to another library means that users don't have to pay the build time penalty for that dependency during development unless they import the extra library. I think the expando solution would be a pretty reasonable compromise, although I haven't looked at all the details here. |
Breaking up every package into absolutely minimal functional units in the name of "only downloading what you actually use" will ultimately produce much more developer pain than the marginal cost of an extra 300kb, as you can see in the npm ecosystem. Do what you're going to do, but you asked for my thoughts and they're "don't split out this functionality". |
Thanks for your feedback. I am in favor of the As far as a separate library goes there are other reasons to prefer that as well, such as moving runtime failures to static failures. Today on the web you can use the So this is less about splitting it up into small parts and more about separating out the platform specific bits in a way that is easier to reason about. |
But if you use |
The current design leaves |
I definitely like that better than just having no listing at all in the base package. At that point, though, why even bother having a separate package that just contains a one-line extension method? |
The extension exists in a new library under the The extension method library doesn't have a ton of value but it does make the migration easier and eliminates some boilerplate of constantly creating and passing a local file system. |
Oh, I see—in that case, I'm on board with the design 😃. |
Closing this as it has landed in the null safety branch. |
Today we leak the
FileSystemEntity
api fromdart:io
orpackage:node_io
respectively out to users, even though they don't all need this functionality. This also means the public api of this package actually changes on thenode
platform, which is less than ideal.I propose that we migrate the
list
api to usepackage:file
, andaccept an optionalrequire a file system as a parameter. We would also rename these apis tolistFileSystem
By default it would use thedart:io
file system and if not available it would throw.We will also provide an extension method in a separate library in this package, which can be used to glob the local file system without providing it explicitly, and this would match exactly the current api (
list
,listSync
).This would be a breaking change, and would require a new dependency on
package:file
. We would release this with null safety. The premise is thatpackage:file
is at least a more general package, and better than leaking a node specific dep to all downstream users.cc @nex3 for thoughts as well since I believe that Sass is the primary user of the Node functionality.
The text was updated successfully, but these errors were encountered: