From 40891bd4248854cc1f94c93be5a0bbc0ff3a6a9a Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Fri, 21 Mar 2025 15:30:09 +0100 Subject: [PATCH] Support `ServiceManagerPlugin` (#7616) --- app/index.template.js | 18 +++++++++++++++--- app/package.json | 3 +++ yarn.lock | 14 +++++++++++++- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/app/index.template.js b/app/index.template.js index 523ea36d7..e5d8a5b26 100644 --- a/app/index.template.js +++ b/app/index.template.js @@ -5,6 +5,8 @@ import { PageConfig, URLExt } from '@jupyterlab/coreutils'; +import { PluginRegistry } from '@lumino/coreutils'; + require('./style.js'); require('./extraStyle.js'); @@ -213,10 +215,20 @@ async function main() { // plugin even if the debugger is only loaded on the notebook page. PageConfig.setOption('allPlugins', '{{{ json notebook_plugins }}}'); - const NotebookApp = require('@jupyter-notebook/application').NotebookApp; - const app = new NotebookApp({ mimeExtensions, availablePlugins }); - app.registerPluginModules(mods); + const pluginRegistry = new PluginRegistry(); + const NotebookApp = require('@jupyter-notebook/application').NotebookApp; + + pluginRegistry.registerPlugins(mods); + const IServiceManager = require('@jupyterlab/services').IServiceManager; + const serviceManager = await pluginRegistry.resolveRequiredService(IServiceManager); + + const app = new NotebookApp({ + pluginRegistry, + serviceManager, + mimeExtensions, + availablePlugins + }); // Expose global app instance when in dev mode or when toggled explicitly. const exposeAppInBrowser = diff --git a/app/package.json b/app/package.json index 47d6b5695..3cc53395e 100644 --- a/app/package.json +++ b/app/package.json @@ -169,6 +169,7 @@ "@jupyterlab/pdf-extension": "~4.4.0-beta.2", "@jupyterlab/pluginmanager-extension": "~4.4.0-beta.2", "@jupyterlab/running-extension": "~4.4.0-beta.2", + "@jupyterlab/services-extension": "~4.4.0-beta.2", "@jupyterlab/settingeditor": "~4.4.0-beta.2", "@jupyterlab/settingeditor-extension": "~4.4.0-beta.2", "@jupyterlab/shortcuts-extension": "~5.2.0-beta.2", @@ -181,6 +182,7 @@ "@jupyterlab/translation-extension": "~4.4.0-beta.2", "@jupyterlab/ui-components-extension": "~4.4.0-beta.2", "@jupyterlab/vega5-extension": "~4.4.0-beta.2", + "@lumino/coreutils": "~2.2.0", "react": "^18.2.0", "react-dom": "^18.2.0", "yjs": "^13.5.40" @@ -296,6 +298,7 @@ "@jupyterlab/notebook-extension:widget-factory" ], "@jupyterlab/pluginmanager-extension": true, + "@jupyterlab/services-extension": true, "@jupyterlab/shortcuts-extension": true, "@jupyterlab/terminal-extension": true, "@jupyterlab/theme-light-extension": true, diff --git a/yarn.lock b/yarn.lock index a5e470128..f898ce06a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2179,6 +2179,7 @@ __metadata: "@jupyterlab/pdf-extension": ~4.4.0-beta.2 "@jupyterlab/pluginmanager-extension": ~4.4.0-beta.2 "@jupyterlab/running-extension": ~4.4.0-beta.2 + "@jupyterlab/services-extension": ~4.4.0-beta.2 "@jupyterlab/settingeditor": ~4.4.0-beta.2 "@jupyterlab/settingeditor-extension": ~4.4.0-beta.2 "@jupyterlab/shortcuts-extension": ~5.2.0-beta.2 @@ -2191,6 +2192,7 @@ __metadata: "@jupyterlab/translation-extension": ~4.4.0-beta.2 "@jupyterlab/ui-components-extension": ~4.4.0-beta.2 "@jupyterlab/vega5-extension": ~4.4.0-beta.2 + "@lumino/coreutils": ~2.2.0 "@types/rimraf": ^3.0.2 css-loader: ~5.0.1 extra-watch-webpack-plugin: ^1.0.3 @@ -4454,6 +4456,16 @@ __metadata: languageName: node linkType: hard +"@jupyterlab/services-extension@npm:~4.4.0-beta.2": + version: 4.4.0-beta.2 + resolution: "@jupyterlab/services-extension@npm:4.4.0-beta.2" + dependencies: + "@jupyterlab/services": ^7.4.0-beta.2 + "@lumino/coreutils": ^2.2.0 + checksum: bdc141b91af525ec33cfa6f767a93e3cd6c0663afc65314e262779501a66e4cbba56a523e168916d5aab39daa6c92b406e773a68a91f9c451d4aedc954172084 + languageName: node + linkType: hard + "@jupyterlab/services@npm:^7.3.4": version: 7.3.4 resolution: "@jupyterlab/services@npm:7.3.4" @@ -5281,7 +5293,7 @@ __metadata: languageName: node linkType: hard -"@lumino/coreutils@npm:^1.11.0 || ^2.0.0, @lumino/coreutils@npm:^1.11.0 || ^2.2.0, @lumino/coreutils@npm:^2.2.0": +"@lumino/coreutils@npm:^1.11.0 || ^2.0.0, @lumino/coreutils@npm:^1.11.0 || ^2.2.0, @lumino/coreutils@npm:^2.2.0, @lumino/coreutils@npm:~2.2.0": version: 2.2.0 resolution: "@lumino/coreutils@npm:2.2.0" dependencies: