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

refactor: export cjs and esm modules #615

Merged

Conversation

magicmatatjahu
Copy link
Member

@magicmatatjahu magicmatatjahu commented Sep 15, 2022

Description

Export cjs and esm (with TS typings) modules from package. It's needed to packages which will consume parser-js. ESM is for website and treeshakable apps and CJS is for NodeJS app (but never versions can use ESM).

cc @smoya

Related issue(s)
Part of #481
Part of #482

@sonarcloud
Copy link

sonarcloud bot commented Sep 15, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Member

@jonaslagoni jonaslagoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why you don't use the same behavior as we have with other TS projects i.e. having it under lib/cjs etc 🤔 ?

Not that's it's important but you know, consistency is great 😆

@magicmatatjahu
Copy link
Member Author

magicmatatjahu commented Sep 15, 2022

Is there a reason why you don't use the same behavior as we have with other TS projects i.e. having it under lib/cjs etc 🤔 ?

Tbh our other projects had bad decision to put everything to lib, separate esm and cjs folders is "better" for me and I saw that solution in another projects. Also by this decision we can easily support https://nodejs.org/api/packages.html#package-entry-points (in the future) but I checked and that feature doesn't work very well with current TS entry points and in old NodeJS versions. So yeah, wait 6months-1year and we can enable it :)

@magicmatatjahu
Copy link
Member Author

/rtm

@asyncapi-bot asyncapi-bot merged commit 820fae3 into asyncapi:next-major Sep 15, 2022
@magicmatatjahu magicmatatjahu deleted the next/package-exports branch September 15, 2022 12:42
magicmatatjahu added a commit to magicmatatjahu/parser-js that referenced this pull request Oct 3, 2022
derberg pushed a commit that referenced this pull request Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ready-to-merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants