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
feat: conditional exports #419
Conversation
Codecov Report
@@ Coverage Diff @@
## main #419 +/- ##
==========================================
+ Coverage 96.44% 96.46% +0.01%
==========================================
Files 23 23
Lines 197 198 +1
Branches 44 45 +1
==========================================
+ Hits 190 191 +1
Misses 7 7
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works in theory :-) i'd have to look at the build output to be sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems good; short of an actual node 4 test
@ljharb alright i've spent waaaay to long reading up on these exports and manually testing but I think we're finally good to go after a node 4 test. I'll merge after getting that done. Thanks for your feedback! |
I will point out that adding "exports" is almost always a breaking change, so you may want to do this as a semver-major bump. |
4a5cb52
to
76d9139
Compare
Co-authored-by: ljharb <ljharb@gmail.com> BREAKING CHANGE: This package now includes [conditional package exports][docs]. Most consumers should be able to upgrade without any issues, however, package exports limits the allowed entry points inside of Node.js and also affects consumption in other bundlers. - `main` targets been updated to support down to node 4 (ES5) - `module` targets has update to support down to node 6 (ES2015) - `exports` targets have been set to node 12 (ES2019) - `unpkg` targets have been set to browserslist `defaults` [docs]: https://nodejs.org/api/packages.html#conditional-exports
Co-authored-by: Novolokov <83767977+Novolokov@users.noreply.github.com> Squashed commit of the following: commit 32afa52 Merge: d0b4620 37af5b7 Author: Rico Kahler <ricokahler@gmail.com> Date: Sun Feb 13 19:41:05 2022 -0500 Merge branch 'main' into patch-1 commit d0b4620 Author: Novolokov <83767977+Novolokov@users.noreply.github.com> Date: Sat Dec 4 13:04:24 2021 +0100 allow custom background color
9d2b5a7
to
d1c87a7
Compare
🎉 This PR is included in version 2.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This PR:
Color2k handles its own bundle with the following entry points and targets:
main
—node 4
unpkg
— browserslistdefaults
module
—node 6
for ES2015 support defined by rollup a while agoexports.import
—node 12
for ES2019 support (esbuild and node >12 in ES mode uses this entry point)exports.default
—node 12
for CJS node 12 support, since export maps weren't support until node 12exports.package.json
— for backwards compat to importingpackage.json
(since it's restricted to import other files now)The following consumers have been manually tested:
<script type="module">
via skypackresolve
(maintained by none other than @ljharb! 😄). This works but uses the legacymain
CJS bundle due to the complexity of closing Support ESM resolution browserify/resolve#222. Note from the jest folks, they are highly unlikely to switch from resolve.@babel/register
with[@babel/preset-env, {targets: 'node 12'}]
— uses the CJSexports.require
entry point@rollup/plugin-node-resolve
— uses theexports.import
entry point["require", "module"]
for CJS and["import", "module"]
for ESM. resolves to theexports.import
entry pointmodule
entry pointCloses #413