Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions spyder_notebook/server/app/index.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

// Inspired by: https://github.com/jupyterlab/jupyterlab/blob/master/dev_mode/index.js

// Spyder: Added below import to polyfill Array.at()
// so that we can use Qt5's WebEngine.
import 'core-js/es/array/at';

import { PageConfig, URLExt } from '@jupyterlab/coreutils';

import { PluginRegistry } from '@lumino/coreutils';
Expand Down Expand Up @@ -38,7 +42,9 @@ async function loadComponent(url, scope) {
async function createModule(scope, module) {
try {
const factory = await window._JUPYTERLAB[scope].get(module);
return factory();
const instance = factory();
instance.__scope__ = scope;
return instance;
} catch (e) {
console.warn(
`Failed to create module: package: ${scope}; module: ${module}`
Expand Down Expand Up @@ -84,6 +90,7 @@ async function main() {

// populate the list of disabled extensions
const disabled = [];
const availablePlugins = [];

/**
* Iterate over active plugins in an extension.
Expand All @@ -103,7 +110,18 @@ async function main() {

let plugins = Array.isArray(exports) ? exports : [exports];
for (let plugin of plugins) {
if (PageConfig.Extension.isDisabled(plugin.id)) {
const isDisabled = PageConfig.Extension.isDisabled(plugin.id);
availablePlugins.push({
id: plugin.id,
description: plugin.description,
requires: plugin.requires ?? [],
optional: plugin.optional ?? [],
provides: plugin.provides ?? null,
autoStart: plugin.autoStart,
enabled: !isDisabled,
extension: extension.__scope__
});
if (isDisabled) {
disabled.push(plugin.id);
continue;
}
Expand Down Expand Up @@ -204,22 +222,22 @@ async function main() {
// plugin even if the debugger is only loaded on the notebook page.
PageConfig.setOption('allPlugins', '{{{ json notebook_plugins }}}');

const pluginRegistry = new PluginRegistry;
const pluginRegistry = new PluginRegistry();

// Spyder: Use our own app class
const NotebookApp = require('@spyder-notebook/application').SpyderNotebookApp;

pluginRegistry.registerPlugins(mods);
const IServiceManager = require('@jupyterlab/services').IServiceManager;
const serviceManager = await pluginRegistry.resolveRequiredService(IServiceManager);

const app = new NotebookApp({
pluginRegistry,
serviceManager,
mimeExtensions
mimeExtensions,
availablePlugins
});

app.registerPluginModules(mods);

// Expose global app instance when in dev mode or when toggled explicitly.
const exposeAppInBrowser =
(PageConfig.getOption('exposeAppInBrowser') || '').toLowerCase() === 'true';
Expand Down
9 changes: 5 additions & 4 deletions spyder_notebook/server/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"@jupyter-notebook/help-extension": "~7.4.7",
"@jupyter-notebook/notebook-extension": "~7.4.7",
"@jupyter-notebook/ui-components": "~7.4.7",
"@jupyter/react-components": "^0.16.6",
"@jupyter/web-components": "^0.16.6",
"@jupyter/ydoc": "~3.0.0",
"@jupyter/react-components": "~0.16.7",
"@jupyter/web-components": "~0.16.7",
"@jupyter/ydoc": "~3.1.0",
"@jupyterlab/application": "~4.4.9",
"@jupyterlab/application-extension": "~4.4.9",
"@jupyterlab/apputils": "~4.5.9",
Expand Down Expand Up @@ -140,7 +140,8 @@
"@jupyterlab/vega5-extension": "~4.4.9",
"@lumino/coreutils": "~2.2.1",
"@spyder-notebook/application": "^0.7.1-dev.0",
"@spyder-notebook/application-extension": "^0.7.1-dev.0"
"@spyder-notebook/application-extension": "^0.7.1-dev.0",
"core-js": "^3.17.0"
},
"devDependencies": {
"@jupyterlab/builder": "~4.4.9",
Expand Down
9 changes: 5 additions & 4 deletions spyder_notebook/server/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3294,6 +3294,7 @@ __metadata:
"@lumino/coreutils": ~2.2.1
"@spyder-notebook/application": ^0.7.1-dev.0
"@spyder-notebook/application-extension": ^0.7.1-dev.0
core-js: ^3.17.0
css-loader: ~5.0.1
fs-extra: ^8.1.0
glob: ~7.1.6
Expand Down Expand Up @@ -5746,7 +5747,7 @@ __metadata:
languageName: node
linkType: hard

"core-js@npm:3.37.1":
"core-js@npm:3.37.1, core-js@npm:^3.17.0":
version: 3.37.1
resolution: "core-js@npm:3.37.1"
checksum: 2d58a5c599f05c3e04abc8bc5e64b88eb17d914c0f552f670fb800afa74ec54b4fcc7f231ad6bd45badaf62c0fb0ce30e6fe89cedb6bb6d54e6f19115c3c17ff
Expand Down Expand Up @@ -11619,11 +11620,11 @@ __metadata:
linkType: hard

"react@npm:>=17.0.0 <19.0.0, react@npm:^18.2.0":
version: 18.3.1
resolution: "react@npm:18.3.1"
version: 18.2.0
resolution: "react@npm:18.2.0"
dependencies:
loose-envify: ^1.1.0
checksum: a27bcfa8ff7c15a1e50244ad0d0c1cb2ad4375eeffefd266a64889beea6f6b64c4966c9b37d14ee32d6c9fcd5aa6ba183b6988167ab4d127d13e7cb5b386a376
checksum: 88e38092da8839b830cda6feef2e8505dec8ace60579e46aa5490fc3dc9bba0bd50336507dc166f43e3afc1c42939c09fe33b25fae889d6f402721dcd78fca1b
languageName: node
linkType: hard

Expand Down
Loading