-
-
Notifications
You must be signed in to change notification settings - Fork 183
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
adds sort option #79
adds sort option #79
Conversation
Codecov Report
@@ Coverage Diff @@
## master #79 +/- ##
========================================
+ Coverage 98.57% 100% +1.42%
========================================
Files 2 2
Lines 70 78 +8
========================================
+ Hits 69 78 +9
+ Misses 1 0 -1
Continue to review full report at Codecov.
|
Hi thank you That's something I was planning to do Can you explain me the topsort ? |
i added a test for sort which is working fine EDIT: ok i figured it out and added a test for dependency sorting as well topological sort is a sorting of vertices on a directed acyclic graph such that for or every directed edge if your edges are parent child relationships |
allows users to sort the file list before it is passed to reduce, sorting is defaulted to dependency order using topological vertice sort on edges [parent, child] (adapted from html-webpack-plugin);
I'm not yet on board on the top sorts part Do you think it could be possible to export that into a @a-x- thoughts? |
I think that this logic should be in the main codebase. |
is there a consensus? should I be doing any more work on this or is this good to merge? |
My reasoning behind removing ordering was that nobody is using it (array output was only added on the latest release one month ago and this plugin has been around for years) So now with this PR, rather than having thing more lightweight by removing the order, we add something that barely nobody is going to use and is relatively heavy I prefer the helper approach as user can opt-in if they need it |
I did not understand this, can you be clearer? |
Ok, it seems so good |
I went through a lot of thinking this week-end I'm starting to think it was a mistake introducing In the current state of the plugin, @SeeThruHead changes can't be extracted out, I was thinking we should replace <option name>: (seed, files) => {
return files.reduce((manifest, {name, path}) => ({...manifest, [name]: path}));
} That way @SeeThruHead will have access to the full array to do it's sorting What should we do?
|
^ much better than only allowing to pass the callbacks for sort and reduce, doesn't really have much to do with this PR though. this pr mainly cares about topological sorting. which still has to happen before this, unless you want to pass all the chunk data to the (seed, files) function. |
The thing is I don't think topological sorting is something that should be added... My arguments are:
Although, we should allow you to do it |
you'd need to expose a point for a person to sort chunks, which then get turned into files, internally, and then another api point to create manifests. replacing reduce with (seed, files) => ... doesn't help me sort things based on chunk parents |
I believe it will... as you will have access to |
oh i see, so we have access to chunks currently in the reducer option, but we don't know when the last file is, so we can't build edges. I'd say this new replacement for reduce is a good compromise it might be nice to have some default manifest types though. object mapping, vs ordered topological array, would be nice defaults to choose from |
Yeah exactly :) I never really liked |
it's going to be in place of manifest generation |
@SeeThruHead I'm going to merge #90 tonight (if I don't get any rejections) Once that's done, would you mind:
After that, we will be ready to release |
ok i can do that. |
suit yourself ;) |
\o/ for this @SeeThruHead |
@joscha I'm going to take care of that over lunch @SeeThruHead I will let you take care of the example (not really urgent) |
Sort option was added by ae03fbd |
i didn't realize you still wanted sort in @mastilver :D |
Yeah... I'm not sure anymore if it was a good idea... :D @joscha I'm curious how you are going to use it? |
@SeeThruHead @mastilver I need to sort topologically, like the example in this PR. I think it would be best if the manifest plugin had an option to do that, but if not I am happy to use the code in this PR - however I'd still need access to the compilation, which is not covered by the current sort API? |
Hello! Awesome plugin you've got here.
I was needing a way to have a sorted by dependency manifest (like how html-webpack-plugin works)
while I was looking around i found that i could adapt your plugin to do what I needed without affecting it's functionality in any way.
(by passing
to the plugin, which gives me an array of filenames sorted by dependency.
I was hoping you might accept this PR
allows users to sort the file list before it is passed to reduce, can disable aphabetical sorting by passing () => -1
array passed to sort is presorted based on the dependency graph using topological sort on [parentChunk, chunk], this was adapted from html-webpack-plugin