[go: up one dir, main page]

Skip to content
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

Implement selective imports for Base64URL and UTF-8 utilities #425

Closed
wants to merge 1 commit into from
Closed

Implement selective imports for Base64URL and UTF-8 utilities #425

wants to merge 1 commit into from

Conversation

franmc01
Copy link
@franmc01 franmc01 commented Jan 18, 2024

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:

  • Separate export of Base64URL and UTF-8 in the index.js.
  • Retention of the existing entry point for combined imports.
  • Implementation of tests to ensure no backward compatibility issues are introduced.

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 😀

@bifurcation
Copy link
Contributor

I'm sympathetic to what you're saying, but it's not clear to me that this patch actually does what you want. It seems like loading index.js causes all the submodules to load anyway, due to the require() calls. Have you validated that your change actually makes a difference in bundle size?

@franmc01 franmc01 closed this Jan 19, 2024
@franmc01 franmc01 deleted the feature/selective-utility-imports branch January 19, 2024 18:39
@franmc01
Copy link
Author

I close the pr after observing that the package does offer what I wanted to do and seeing that it solves what I want. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants