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

add URL Dependencies support for module federation(consume shared module) #14035

Closed
wants to merge 20 commits into from

Conversation

liulangyu90316
Copy link

For module federation shared, without requiredVersion configured, it will infer version base on package.json, as we can see in ConsumeSharedPlugin.js.
But when we get requiredVersion from package.json, it just get dep / dev / peer / optional dependencies value, without consideration of some URL Dependencies cases.
For example, "isarray": "git+https://github.com/juliangruber/isarray.git#v2.0.3", it's real version should be v2.0.3, but we can not get that.
This pr will add a good support for URL Dependencies with versions.

What kind of change does this PR introduce?
Feature, add URL Dependencies support for module federation.

Did you add tests for your changes?
Already did.

Does this PR introduce a breaking change?
No.

What needs to be documented once your changes are merged?
Nothing.

@webpack-bot
Copy link
Contributor

For maintainers only:

  • This needs to be documented (issue in webpack/webpack.js.org will be filed when merged)
  • This needs to be backported to webpack 4 (issue will be created when merged)

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

We need a package to parse it, because there is a lot of edge cases

@liulangyu90316
Copy link
Author

@alexander-akait Sorry but I do not get you, maybe I should provide a demo package or add some test cases?

@alexander-akait
Copy link
Member

@liulangyu90316
Copy link
Author

@alexander-akait Thx, I know, I will add handler for more edge cases, and it will be more simple than hosted-git-info.

@alexander-akait
Copy link
Member

Simple version is good, but as minimum we need adapt test from this repo to ensure we have the same logic

@webpack-bot
Copy link
Contributor

Hi @liulangyu90316.

Just a little hint from a friendly bot about the best practice when submitting pull requests:

Don't submit pull request from your own main branch. It's recommended to create a feature branch for the PR.

You don't have to change it for this PR, just make sure to follow this hint the next time you submit a PR.

@liulangyu90316
Copy link
Author

@alexander-akait Already add more edge cases handlers according to hosted-git-info. And tests can cover all the cases provided by hosted-git-info.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Sep 5, 2021

CLA Signed

The committers are authorized under a signed CLA.

/^((git\+)?(ssh|https?|file)|git|github|gitlab|bitbucket|gist):$/;

// Has custom protocol
const RE_CUSTOM_PROTOCOL = /^((git\+)?(ssh|https?|file)|git):\/\//;
Copy link
Member

Choose a reason for hiding this comment

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

Protocols can be FILE:// i.e. uppercased, same for domains

@webpack-bot
Copy link
Contributor

@liulangyu90316 Thanks for your update.

I labeled the Pull Request so reviewers will review it again.

@alexander-akait Please review the new changes.

@liulangyu90316
Copy link
Author

@alexander-akait Changes intergration and project intergration checks couldn't pass, maybe that's because I fetched some commits from main branch? Could you help giving some clue?

@webpack-bot
Copy link
Contributor

Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon.

@buksy90
Copy link

buksy90 commented Nov 5, 2021

Hi, great work, we will need support for this at my company too, but we have self hosted version of bitbucket at bitbucket.companyName.com, from a quick look at code it looks like it wont be supported.

Therefore, could you support adding custom parsers into extractCommithashByDomain via webpack options?

@TheLarkInn
Copy link
Member

@liulangyu90316 thank you so much for the contribution we will attribute your work from #16945 into the release notes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants