@@ -33,7 +33,9 @@ async function loadComponent(url, scope) {
3333async function createModule ( scope , module ) {
3434 try {
3535 const factory = await window . _JUPYTERLAB [ scope ] . get ( module ) ;
36- return factory ( ) ;
36+ const instance = factory ( ) ;
37+ instance . __scope__ = scope ;
38+ return instance ;
3739 } catch ( e ) {
3840 console . warn (
3941 `Failed to create module: package: ${ scope } ; module: ${ module } `
@@ -79,6 +81,7 @@ async function main() {
7981
8082 // populate the list of disabled extensions
8183 const disabled = [ ] ;
84+ const availablePlugins = [ ] ;
8285
8386 /**
8487 * Iterate over active plugins in an extension.
@@ -98,7 +101,18 @@ async function main() {
98101
99102 let plugins = Array . isArray ( exports ) ? exports : [ exports ] ;
100103 for ( let plugin of plugins ) {
101- if ( PageConfig . Extension . isDisabled ( plugin . id ) ) {
104+ const isDisabled = PageConfig . Extension . isDisabled ( plugin . id ) ;
105+ availablePlugins . push ( {
106+ id : plugin . id ,
107+ description : plugin . description ,
108+ requires : plugin . requires ?? [ ] ,
109+ optional : plugin . optional ?? [ ] ,
110+ provides : plugin . provides ?? null ,
111+ autoStart : plugin . autoStart ,
112+ enabled : ! isDisabled ,
113+ extension : extension . __scope__
114+ } ) ;
115+ if ( isDisabled ) {
102116 disabled . push ( plugin . id ) ;
103117 continue ;
104118 }
@@ -200,7 +214,7 @@ async function main() {
200214 PageConfig . setOption ( 'allPlugins' , '{{{ json notebook_plugins }}}' ) ;
201215
202216 const NotebookApp = require ( '@jupyter-notebook/application' ) . NotebookApp ;
203- const app = new NotebookApp ( { mimeExtensions } ) ;
217+ const app = new NotebookApp ( { mimeExtensions, availablePlugins } ) ;
204218
205219 app . registerPluginModules ( mods ) ;
206220
0 commit comments