Implement selective imports for Base64URL and UTF-8 utilities #425
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
This Pull Request proposes an optimization in the way Node-Jose handles the export of common utilities such as Base64URL and UTF-8. Currently, importing any utility from the
util
package requires loading the entire module, unnecessarily increasing the bundle size.My proposal is to allow the export of Base64URL and UTF-8 as independent modules, enabling developers to import only what they need. This will be done while maintaining the existing exports to ensure backward compatibility.
Proposed Changes:
index.js
.Future Considerations:
In the long run, we could consider separating all Node-Jose utilities in this manner. This modularity would further improve performance and development efficiency. Performance is critical in today's development environment, and a more modular architecture would greatly benefit the Node-Jose community.
I am open to discussing these ideas and working together to implement the best solutions for the project. I appreciate any feedback you can provide and look forward to your opinions 😀