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

Add Support for CommonJS #8

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Add Support for CommonJS #8

wants to merge 3 commits into from

Conversation

qbytx
Copy link

@qbytx qbytx commented Sep 27, 2024

Transpiled desm with babel for CommonJS Compatibility

Description

I understand that using import.meta.url is an ESM feature, but I've noticed the join function being utilized in boilerplate code across various projects I'm converting to CommonJS.

To enhance compatibility and ease of use for others relying on this as a dependency, I've implemented a quick Babel transpilation of the join function. This change will eliminate the need for users to directly import node:path.join while maintaining the functionality of your original implementation.

Changes Made

  • Transpiled the join function to be compatible with CommonJS.
  • Tested the newly transpiled ./src/esm/index.js ESM to make sure it still passed your tests.
  • Wrote tests of my own for ./src/cjs/index.js CJS (in another branch) to make sure it had feature parity.

Checklist

  • I have performed a self-review of my code.
  • My changes generate no new warnings.
  • All existing tests passed.

Sign-off

@qbytx Eva O'Brien | evaobrien.contact@gmail.com

@mcollina
Copy link
Owner

Unfortunately this is not really a long-term solution, as it's a one-time transpilation. I'm not strictly opposed in dual-publishing this, but it needs to have a full solution for doing so, something that is done via a script (and with tests too).

@qbytx
Copy link
Author

qbytx commented Sep 28, 2024

Understood 🙂

@qbytx
Copy link
Author

qbytx commented Sep 28, 2024

I am interested in attempting a full solution, with tests, in the future when I have time. Will understand if you close this PR request at the moment, appreciate the feedback.

@mcollina
Copy link
Owner

Go for it!

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