Open wighawag opened 1 month ago
Hi @wighawag , can I be assigned this please? I’m ready to work
hello @wighawag Can i be assigned to this task? I propose restructuring Starknet.js to export utilities more modularly by utilizing the package.json exports field. This change will allow for better dead code elimination and enhance the ability to import only the needed utilities.
The benefit of doing this are:
@wighawag can I be assigned this task? I'll deliver as soon as possible
To tackle this task, I’d start by updating the package.json to configure exports for modular access. This involves restructuring the exports field so that individual utility functions, like those in utils and specifically num, are accessible as separate entry points. This setup will allow for better dead code elimination by letting users import only the utilities they need, such as toBigInt from starknet/utils/num, which reduces bundle size and improves performance. After setting up the exports, I’d test the changes by importing functions selectively in a test environment to confirm that only the required code is included in the output bundle. Additionally, I’d verify that type declarations are correctly accessible to ensure a seamless developer experience.
Is your feature request related to a problem? Please describe. Currently starknet.js export many of its utilities as object, which prevent best dead code elimination
Describe the solution you'd like It would be better to expose the utils via package.json
exports
fieldso if you were to export num utils this way in your package.json:
we would then be able to import it this way and benefit from dead code elimination if we were to only use part of the num exports:
Also another bonus is that it will let us access types defined there too