-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
0.8.0 #1571
0.8.0 #1571
Conversation
This pull request is being automatically deployed with ZEIT Now (learn more). 🔍 Inspect: https://zeit.co/markedjs/markedjs/7ocppg1jw |
While this is going to be a breaking change - maybe you would like to consider changing a few more things? I would like to propose changing exported shape for better tree-shakeability. Mainly I don't believe using a default export is a good fit here (especially the way it is used right now) and also I would like to propose to skip using static properties on functions - but this one would have to be evaluated first because by a quick glance at the source code I'm not sure why they are used in the first place (maybe they are for some reason needed, not sure) I'm of course offering my help in refactoring and I'm open to discussing this more. |
@Andarist if you want to create a PR with your proposed changes we could squeeze it in here if we think it is necessary. |
@UziTech Ok, I'm going to prepare something later tonight. Stay tuned! |
Keep in mind that your main & module entries (cjs & esm) have incompatible shapes right now. // webpack consumer
require('./foo')
// foo.js
var localMarked = require('marked') // webpack will expose `{ default: marked }` as `localMarked`
localMarked('**md**') // error! This example maybe doesn't illustrate it best - but to describe it in more details: webpack will see that "module" field and will load it instead of "main", but this "module" exposes different shape than what was expected by |
This seems to be a known issue with webpack webpack/webpack#4742 I have found the following solutions:
I prefer #1 so when webpack fixes this we won't need to change anything. |
I don't think webpack is going to change, the issue is over 2 years old. I also think the maintainer is correct, packages should not export different things from module and main. What are the implications for number 2: remove |
Some existing tools rely on that field as indicator of the "modern" packages shipping ES modules. See for example |
@styfle I believe Without the We could move the esm build to |
I think removing the module field would be the easiest solution. It would make marked backwards compatible and we can always fix code splitting/tree shaking in a later version if we need to. |
I don't think Node supports the Perhaps you are thinking of the |
Yes - if you dont want to change CJS export shape right now then I would also recommend dropping the "module" field right now. I would love "module" being added - as the community, I believe we should move towards ESM as much as we can as it's the part of the language - but only if it's done right (so without any drawbacks). At the moment |
I think this is ready to publish once we get one more approval from @joshbruce or @davisjam |
v0.8.0 has been released 🎉 @Andarist Thanks for your PRs and the help with this release. |
No problem. If you'd like to discuss tree-shakeability and changing exports shape in the future I would gladly help you out on this one. Configuring things "right" for bundlers and other possible consumers is surprisingly hard and I have good expertise on that matter. |
Thanks @Andarist 👍 A related issue has been opened in pikapkg that you might want to engage in. |
0.8.0
Release Notes
Breaking changes
Fixes
baseUrl
option relative baseUrl #1526Docs
Dev Dependencies
Publisher
$ npm version
has been run.master
with correct version number.$ npm publish
has been run.Note: If merges to
master
occur after submitting this PR and before running$ npm pubish
you should be able toupstream/master
(git pull upstream master
) into the branch holding this version,$ npm run build
to regenerate themin
file, andCommitter
In most cases, this should be someone different than the publisher.
package.json
has been updated (see PUBLISHING.md).marked.min.js
has been updated; or,