Merge pull request #262 from jtpio/fix-plotly

Fix handling of federated mime extensions
This commit is contained in:
Jeremy Tuloup 2021-10-30 13:01:40 +02:00 committed by GitHub
commit 2990526ecb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,15 +69,13 @@ async function main() {
// load extra packages
require('@jupyterlab/celltags');
const mimeExtensions = [
const mimeExtensionsMods = [
require('@jupyterlab/javascript-extension'),
require('@jupyterlab/json-extension'),
require('@jupyterlab/pdf-extension'),
require('@jupyterlab/vega5-extension')
];
const RetroApp = require('@retrolab/application').RetroApp;
const app = new RetroApp({ mimeExtensions });
const mimeExtensions = await Promise.all(mimeExtensionsMods);
const disabled = [];
// TODO: formalize the way the set of initial extensions and plugins are specified
@ -302,6 +300,20 @@ async function main() {
}
});
// Add the federated mime extensions.
const federatedMimeExtensions = await Promise.allSettled(
federatedMimeExtensionPromises
);
federatedMimeExtensions.forEach(p => {
if (p.status === 'fulfilled') {
for (let plugin of activePlugins(p.value)) {
mimeExtensions.push(plugin);
}
} else {
console.error(p.reason);
}
});
// Load all federated component styles and log errors for any that do not
(await Promise.allSettled(federatedStylePromises))
.filter(({ status }) => status === 'rejected')
@ -309,6 +321,9 @@ async function main() {
console.error(reason);
});
const RetroApp = require('@retrolab/application').RetroApp;
const app = new RetroApp({ mimeExtensions });
app.registerPluginModules(mods);
// Expose global app instance when in dev mode or when toggled explicitly.