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
Built-in extensions using federated dependencies #9310
Conversation
There should not be any substantial changes in this. It is just reorganizing, deleting duplicate code (fixing a bug?), and updating code to be a bit more modern.
This ensures that the extensions can be packed into larger bundles, rather than individually bundled. The assumption here is that built-in things will all be needed, or at least that relatively few will be disabled. Individual extensions can still load parts of themselves asynchronously to be separately bundled and loaded on-demand (for example, codemirror themes, the codemirror vim extension, etc.).
Thanks for making a pull request to JupyterLab! To try out this branch on binder, follow this link: |
externalExtensions are extra extensions automatically added to extensions/mimeExtensions data
This makes built-in extensions more consistent with federated extensions - dependencies are shared by default.
This handles the case where one extension says a shared package should not be bundled, but another says it should be bundled.
f885166
to
51a5ebb
Compare
Since index.out.js was directly importing compiled extensions, webpack was loading the dependencies before index.out.js was initialized. Since federated extensions were loaded in index.out.js, they did not get a chance to provide packages for compiled extensions. This was a problem if you had a compiled extension that depended on a package a federated extension would provide (for example, a custom ipywidgets extension as a compiled extension, with the ipywidget manager as a federated extension). This loads all federated modules and initializes their containers in the bootstrap phase, making their packages available to the system, before loading the index.out.js file that actually uses them.
51a5ebb
to
da8a4ff
Compare
A few tests are failing because we have a new file that will appear in staging when we make a release, but since it's not there now, the python commands to copy it over to share/jupyter/lab/staging are failing. To test this:
Check things with Now do
and not the expected logs of Now we apply this PR manually. For the patches below, skip any patches that don't apply.
Now run Provider token is PROVIDER_STRING |
@jtpio pointed out that extensions installed from npm are not added to resolutions, but they are top-level extensions that should be shared.
Thanks Jason!
Following these steps locally lead to the same observations I also tested this PR using the same setup as the one described in #9300 (comment), with an extra In this case, the dependencies of the provider (namely the token package) are correctly added to the shared scope, and the consumer (installed as federated) is able to specify the token package (a dependency of both the consumer and the provider) as
For extra context and for those interested, here is the setup with a concrete example:
With this PR, and in particular d17aca7 and 721c70d, dependencies of the extension are also added to the shared scope. Which makes it possible for the consumer package installed as federated to define its |
@jtpio - is that a positive review? If it is, I'll merge. (or even better, you can merge) |
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.
Thanks!
References
This fixes the last half of #9289. It allows built-in extensions to use dependencies shared by federated extensions. It also cleans up the built-in extension configuration.
Code changes
jupyterlab.sharedConfig
key listing sharing config that overrides these defaults.We are careful to merge the extension sharing config for the compiled build. We never override the core set of resolutions (those are always shared), and any shared config that says to bundle a dependency takes precedence over a config saying not to bundle a dependency.
User-facing changes
Compiled extensions can use federated dependencies. For example, with this, a user should be able to
jupyter labextension install
an ipywidgets plugin with thejupyterlab_widgets
federated extension base widget package. The ipywidgets plugin should be able to use the ipywidgets manager provided by the federated extension.Backwards-incompatible changes