-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
fix: support tree-shakable models/utils #285
fix: support tree-shakable models/utils #285
Conversation
shouldn't model utils go to were there any change in the logic of utils once you moved them, hard to spot when there is a change in code location. Hilfe! |
@derberg I thought about that, but
Nope, only moved utils to Thanks for review! |
then do |
@derberg Ok, I moved to |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
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.
lgtm
Thanks! |
🎉 This PR is included in version 1.4.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
Working on asyncapi/shape-up-process#88 I have to remove unnecessary dependencies as much as possible while bundling. I wanna create two bundles for browser:
In the second case I have to remove all parser unnecessary stuff, but unfornatelly bundler cannot properly tree-shakable unnecessary utils from models - in component we use directly two models
AsyncAPIDocument
andSchemas
to support parser-js API. Problem is with this file - bundler treatscjs
module as JS object, not likeesm
module so includes everything from "module". This PR moves every util related to models to separate file.Examples with weight:
Component without parser after my changes has also included
Buffer
due to this line https://github.com/asyncapi/parser-js/blob/master/lib/models/message.js#L16 Buffer works only on NodeJS and bundler tried to resolve it by adding about 64kb additional code related only toBuffer
polyfill... I will try to handle the Buffer later in this cycle, but I prefer to leave it and go with completing more important tasks. Removing almost 650kb is a big deal anyway.Related issue(s)
Part of asyncapi/shape-up-process#88
Part of asyncapi/html-template#166