rspack icon indicating copy to clipboard operation
rspack copied to clipboard

all the rust plugin stage should be changed to f64

Open hardfist opened this issue 1 year ago • 5 comments

currently rust plugin stage use i32 which cause it can't accept Infinity and float points in js side, which is not compatible with webpack, so the stage should be changed to f64 to be compatible with webpack

hardfist avatar Sep 11 '24 07:09 hardfist

Can I jump on it? Rspack looks so promising :)

pawel-twardziak avatar Sep 11 '24 16:09 pawel-twardziak

thanks in advance,go try it

hardfist avatar Sep 11 '24 21:09 hardfist

@pawel-twardziak are you still working on it or met any problems?

hardfist avatar Sep 19 '24 14:09 hardfist

@hardfist was busy, couldn't even kick it off :( Today and tomorrow I am on my sick leave so I could finally give it a shot. Any rush? I might need some help. But if you need it sooner feel free to haned it over to someone else.

pawel-twardziak avatar Sep 19 '24 15:09 pawel-twardziak

Hi, @hardfist I've just raised the job - is that all that should get done?

pawel-twardziak avatar Sep 20 '24 17:09 pawel-twardziak

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

stale[bot] avatar Nov 19 '24 17:11 stale[bot]

bump

hardfist avatar Jan 16 '25 05:01 hardfist

in Rust side, we can't change the stage type to f64.

if i32 changed to f64 in proc macro define_hook , it generates code like

        fn stage(&self) -> f64 {
            0.0
        }
                             f64 doesn't  meet the 'Eq' and 'Hash' trait in HashSet
                                                                         |
                                                                         |
                                                                        \/
        fn used_stages(&self) -> rspack_hook::__macro_helper::FxHashSet<f64> {
            rspack_hook::__macro_helper::FxHashSet::from_iter(
                self.taps.iter().map(|h| h.stage()),
            )
        }

and ( either the 'ord ' trait in sort_by_key )

            let mut all_taps = std::vec::Vec::new();
            all_taps.extend(&self.taps);
            all_taps.extend(&additional_taps);
            all_taps.sort_by_key(|hook| hook.stage());

maybe we need to find other ways to support float stage number.

stormslowly avatar Jan 21 '25 02:01 stormslowly

@hardfist let's try a newType

stormslowly avatar Jan 21 '25 02:01 stormslowly

rust plugin is no needs to change stage into float, the internal usage i32 is enough.

stormslowly avatar Jan 22 '25 07:01 stormslowly