@@ -33,7 +33,9 @@ async function loadComponent(url, scope) {
33
33
async function createModule ( scope , module ) {
34
34
try {
35
35
const factory = await window . _JUPYTERLAB [ scope ] . get ( module ) ;
36
- return factory ( ) ;
36
+ const instance = factory ( ) ;
37
+ instance . __scope__ = scope ;
38
+ return instance ;
37
39
} catch ( e ) {
38
40
console . warn (
39
41
`Failed to create module: package: ${ scope } ; module: ${ module } `
@@ -79,6 +81,7 @@ async function main() {
79
81
80
82
// populate the list of disabled extensions
81
83
const disabled = [ ] ;
84
+ const availablePlugins = [ ] ;
82
85
83
86
/**
84
87
* Iterate over active plugins in an extension.
@@ -98,7 +101,18 @@ async function main() {
98
101
99
102
let plugins = Array . isArray ( exports ) ? exports : [ exports ] ;
100
103
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 ) {
102
116
disabled . push ( plugin . id ) ;
103
117
continue ;
104
118
}
@@ -200,7 +214,7 @@ async function main() {
200
214
PageConfig . setOption ( 'allPlugins' , '{{{ json notebook_plugins }}}' ) ;
201
215
202
216
const NotebookApp = require ( '@jupyter-notebook/application' ) . NotebookApp ;
203
- const app = new NotebookApp ( { mimeExtensions } ) ;
217
+ const app = new NotebookApp ( { mimeExtensions, availablePlugins } ) ;
204
218
205
219
app . registerPluginModules ( mods ) ;
206
220
0 commit comments