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 full Semantic Versioning for Shared Modules #11105
Conversation
For maintainers only:
|
This should encode as |
Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon. |
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.
A few notes from looking through things so far.
The minimum test ratio has been reached. Thanks! |
another interesting trick for you =) Probably there is further improvement with
|
change storage format in the share scope choose shared module deterministic from the same origin remove array syntax from version and requiredVersion in schema
versions are in a contiguous range of: 0, 1, ..., 9, 10, 11, ..., 100, ..., a, b, c, ..., alpha, ..., beta, ..., etc, ...
share scope uses string version instead of parsed one
build version should be ignored in matching ranges
That's actually a useful order. I only tries this with the first char, which had Char 5 is also interesting as allows to check with If you are interested to optimize this, feel free to. There are many unit tests to test this against. Currently this PR adds about 750b bundle overhead compared to the old solution. I think I will merge it in this state, as it seems to work. I did a little refactoring to make all the parsed version and internal representations internal. So this is no longer part of the container API and we can change it in any way. The container API as now the version as string stored. That makes it more portable anyway. |
I've created an issue to document this in webpack/webpack.js.org. |
I'm still seeing
I thought all semver ranges were going to be encoded as strings in the js bundles, and the list encoding was going to be internal implementation detail and not exposed in the bundled js files. Did you intend for the parsed and list-encoded semver ranges to be in the files? |
It's not exposed on the container API. |
@sokra |
shareScope[shareKey][version] = { get, loaded, from }
from
is now the uniqueName. When providing to the shareScope implementations should now override a version whenfrom
is equal or higher.output.uniqueName
is used as second criteria if multiple builds provide the same versionVersion are encoding this way:
This format allows easy walking and decision based on
typeof item
. The duplicate,,
is intentional and creates a hole, which istypeof undefined
, but very short to print^^The format is SemVer compatible but less restrictive. We allow more and less version numbers. We allow strings as version numbers (might be useful for a/b tests). We do not apply additional restrictions on the possible chars.
Ranges are encoding this way:
The version and range encoding is only used webpack internal.
Sadly all this additional logic increases the bundle size by about 750b. The most logic is on the consuming shared modules side. But as the needed logic depends on the consumed shared version ranges in the application, there is improvement possible in future PRs. If only simple ranges (without prerelease/build tag) are used we could use a reduced
satisfy
version. In production we could omitrangeToString
and useJSON.stringify
instead. This would decrease the quality of errors/warnings, but might make sense for production.What kind of change does this PR introduce?
feature
Did you add tests for your changes?
yes
Does this PR introduce a breaking change?
yes (containers are not compatible to previous beta versions)
What needs to be documented once your changes are merged?
The semver limitation can be removed.