Skip to content

Commit

Permalink
Merge pull request #322 from krassowski/federated-extensions
Browse files Browse the repository at this point in the history
Port to federated extensions (with eager loading of shared extensions)
  • Loading branch information
mbektas authored Nov 2, 2021
2 parents 3a3b1ae + d820591 commit de39afd
Show file tree
Hide file tree
Showing 9 changed files with 619 additions and 216 deletions.
248 changes: 200 additions & 48 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -271,54 +271,206 @@
"js-yaml": "^4.1.0",
"@types/js-yaml": "^4.0.3"
},
"resolutions": {
"@jupyterlab/application": "~3.2.1",
"@jupyterlab/application-extension": "~3.2.1",
"@jupyterlab/apputils": "~3.2.1",
"@jupyterlab/apputils-extension": "~3.2.1",
"@jupyterlab/attachments": "~3.2.1",
"@jupyterlab/cells": "~3.2.1",
"@jupyterlab/celltags": "~3.2.1",
"@jupyterlab/celltags-extension": "~3.2.1",
"@jupyterlab/codeeditor": "~3.2.1",
"@jupyterlab/codemirror": "~3.2.1",
"@jupyterlab/codemirror-extension": "~3.2.1",
"@jupyterlab/completer": "~3.2.1",
"@jupyterlab/completer-extension": "~3.2.1",
"@jupyterlab/console": "~3.2.1",
"@jupyterlab/console-extension": "~3.2.1",
"@jupyterlab/coreutils": "~5.2.1",
"@jupyterlab/csvviewer": "~3.2.1",
"@jupyterlab/csvviewer-extension": "~3.2.1",
"@jupyterlab/debugger": "~3.2.1",
"@jupyterlab/debugger-extension": "~3.2.1",
"@jupyterlab/docmanager": "~3.2.1",
"@jupyterlab/docmanager-extension": "~3.2.1",
"@jupyterlab/docprovider": "~3.2.1",
"@jupyterlab/docprovider-extension": "~3.2.1",
"@jupyterlab/docregistry": "~3.2.1",
"@jupyterlab/documentsearch": "~3.2.1",
"@jupyterlab/documentsearch-extension": "~3.2.1",
"@jupyterlab/extensionmanager": "~3.2.1",
"@jupyterlab/extensionmanager-extension": "~3.2.1",
"@jupyterlab/filebrowser": "~3.2.1",
"@jupyterlab/filebrowser-extension": "~3.2.1",
"@jupyterlab/fileeditor": "~3.2.1",
"@jupyterlab/fileeditor-extension": "~3.2.1",
"@jupyterlab/help-extension": "~3.2.1",
"@jupyterlab/htmlviewer": "~3.2.1",
"@jupyterlab/htmlviewer-extension": "~3.2.1",
"@jupyterlab/hub-extension": "~3.2.1",
"@jupyterlab/imageviewer": "~3.2.1",
"@jupyterlab/imageviewer-extension": "~3.2.1",
"@jupyterlab/inspector": "~3.2.1",
"@jupyterlab/inspector-extension": "~3.2.1",
"@jupyterlab/javascript-extension": "~3.2.1",
"@jupyterlab/json-extension": "~3.2.1",
"@jupyterlab/launcher": "~3.2.1",
"@jupyterlab/launcher-extension": "~3.2.1",
"@jupyterlab/logconsole": "~3.2.1",
"@jupyterlab/logconsole-extension": "~3.2.1",
"@jupyterlab/mainmenu": "~3.2.1",
"@jupyterlab/mainmenu-extension": "~3.2.1",
"@jupyterlab/markdownviewer": "~3.2.1",
"@jupyterlab/markdownviewer-extension": "~3.2.1",
"@jupyterlab/mathjax2": "~3.2.1",
"@jupyterlab/mathjax2-extension": "~3.2.1",
"@jupyterlab/metapackage": "~3.2.1",
"@jupyterlab/nbconvert-css": "~3.2.1",
"@jupyterlab/nbformat": "~3.2.1",
"@jupyterlab/notebook": "~3.2.1",
"@jupyterlab/notebook-extension": "~3.2.1",
"@jupyterlab/observables": "~4.2.1",
"@jupyterlab/outputarea": "~3.2.1",
"@jupyterlab/pdf-extension": "~3.2.1",
"@jupyterlab/property-inspector": "~3.2.1",
"@jupyterlab/rendermime": "~3.2.1",
"@jupyterlab/rendermime-extension": "~3.2.1",
"@jupyterlab/rendermime-interfaces": "~3.2.1",
"@jupyterlab/running": "~3.2.1",
"@jupyterlab/running-extension": "~3.2.1",
"@jupyterlab/services": "~6.2.1",
"@jupyterlab/settingeditor": "~3.2.1",
"@jupyterlab/settingeditor-extension": "~3.2.1",
"@jupyterlab/settingregistry": "~3.2.1",
"@jupyterlab/shared-models": "~3.2.1",
"@jupyterlab/shortcuts-extension": "~3.2.1",
"@jupyterlab/statedb": "~3.2.1",
"@jupyterlab/statusbar": "~3.2.1",
"@jupyterlab/statusbar-extension": "~3.2.1",
"@jupyterlab/terminal": "~3.2.1",
"@jupyterlab/terminal-extension": "~3.2.1",
"@jupyterlab/theme-dark-extension": "~3.2.1",
"@jupyterlab/theme-light-extension": "~3.2.1",
"@jupyterlab/toc": "~5.2.1",
"@jupyterlab/toc-extension": "~5.2.1",
"@jupyterlab/tooltip": "~3.2.1",
"@jupyterlab/tooltip-extension": "~3.2.1",
"@jupyterlab/translation": "~3.2.1",
"@jupyterlab/translation-extension": "~3.2.1",
"@jupyterlab/ui-components": "~3.2.1",
"@jupyterlab/ui-components-extension": "~3.2.1",
"@jupyterlab/vdom": "~3.2.1",
"@jupyterlab/vdom-extension": "~3.2.1",
"@jupyterlab/vega5-extension": "~3.2.1",
"@lumino/algorithm": "^1.3.3",
"@lumino/application": "^1.16.0",
"@lumino/commands": "^1.12.0",
"@lumino/coreutils": "^1.5.3",
"@lumino/disposable": "^1.4.3",
"@lumino/domutils": "^1.2.3",
"@lumino/dragdrop": "^1.7.1",
"@lumino/messaging": "^1.4.3",
"@lumino/properties": "^1.2.3",
"@lumino/signaling": "^1.4.3",
"@lumino/virtualdom": "^1.8.0",
"@lumino/widgets": "^1.19.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"yjs": "^13.5.6"
},
"jupyterlab": {
"extensions": {
"@jupyterlab/apputils-extension": "",
"@jupyterlab/celltags-extension": "",
"@jupyterlab/codemirror-extension": "",
"@jupyterlab/completer-extension": "",
"@jupyterlab/console-extension": "",
"@jupyterlab/csvviewer-extension": "",
"@jupyterlab/debugger-extension": "",
"@jupyterlab/docmanager-extension": "",
"@jupyterlab/docprovider-extension": "",
"@jupyterlab/documentsearch-extension": "",
"@jupyterlab/filebrowser-extension": "",
"@jupyterlab/fileeditor-extension": "",
"@jupyterlab/help-extension": "",
"@jupyterlab/htmlviewer-extension": "",
"@jupyterlab/imageviewer-extension": "",
"@jupyterlab/inspector-extension": "",
"@jupyterlab/launcher-extension": "",
"@jupyterlab/logconsole-extension": "",
"@jupyterlab/mainmenu-extension": "",
"@jupyterlab/markdownviewer-extension": "",
"@jupyterlab/mathjax2-extension": "",
"@jupyterlab/notebook-extension": "",
"@jupyterlab/rendermime-extension": "",
"@jupyterlab/running-extension": "",
"@jupyterlab/settingeditor-extension": "",
"@jupyterlab/shortcuts-extension": "",
"@jupyterlab/statusbar-extension": "",
"@jupyterlab/terminal-extension": "",
"@jupyterlab/theme-dark-extension": "",
"@jupyterlab/theme-light-extension": "",
"@jupyterlab/toc-extension": "",
"@jupyterlab/tooltip-extension": "",
"@jupyterlab/translation-extension": "",
"@jupyterlab/ui-components-extension": "",
"@jupyterlab/vdom-extension": ""
},
"mimeExtensions": {
"@jupyterlab/javascript-extension": "",
"@jupyterlab/json-extension": "",
"@jupyterlab/pdf-extension": "",
"@jupyterlab/vega5-extension": ""
},
"excludedExtensions": {
"@jupyterlab/application-extension": "",
"@jupyterlab/extensionmanager-extension": "",
"@jupyterlab/hub-extension": ""
}
"singletonPackages": [
"@jupyterlab/application",
"@jupyterlab/apputils",
"@jupyterlab/codeeditor",
"@jupyterlab/completer",
"@jupyterlab/console",
"@jupyterlab/coreutils",
"@jupyterlab/debugger",
"@jupyterlab/docmanager",
"@jupyterlab/documentsearch",
"@jupyterlab/extensionmanager",
"@jupyterlab/filebrowser",
"@jupyterlab/fileeditor",
"@jupyterlab/imageviewer",
"@jupyterlab/inspector",
"@jupyterlab/launcher",
"@jupyterlab/logconsole",
"@jupyterlab/mainmenu",
"@jupyterlab/notebook",
"@jupyterlab/rendermime",
"@jupyterlab/rendermime-interfaces",
"@jupyterlab/services",
"@jupyterlab/settingeditor",
"@jupyterlab/settingregistry",
"@jupyterlab/statedb",
"@jupyterlab/statusbar",
"@jupyterlab/terminal",
"@jupyterlab/tooltip",
"@jupyterlab/ui-components",
"@lumino/algorithm",
"@lumino/application",
"@lumino/commands",
"@lumino/coreutils",
"@lumino/disposable",
"@lumino/domutils",
"@lumino/dragdrop",
"@lumino/messaging",
"@lumino/properties",
"@lumino/signaling",
"@lumino/virtualdom",
"@lumino/widgets",
"react",
"react-dom"
],
"extensions": [
"@jupyterlab/apputils-extension",
"@jupyterlab/celltags-extension",
"@jupyterlab/codemirror-extension",
"@jupyterlab/completer-extension",
"@jupyterlab/console-extension",
"@jupyterlab/csvviewer-extension",
"@jupyterlab/debugger-extension",
"@jupyterlab/docmanager-extension",
"@jupyterlab/docprovider-extension",
"@jupyterlab/documentsearch-extension",
"@jupyterlab/filebrowser-extension",
"@jupyterlab/fileeditor-extension",
"@jupyterlab/help-extension",
"@jupyterlab/htmlviewer-extension",
"@jupyterlab/imageviewer-extension",
"@jupyterlab/inspector-extension",
"@jupyterlab/launcher-extension",
"@jupyterlab/logconsole-extension",
"@jupyterlab/mainmenu-extension",
"@jupyterlab/markdownviewer-extension",
"@jupyterlab/mathjax2-extension",
"@jupyterlab/notebook-extension",
"@jupyterlab/rendermime-extension",
"@jupyterlab/running-extension",
"@jupyterlab/settingeditor-extension",
"@jupyterlab/shortcuts-extension",
"@jupyterlab/statusbar-extension",
"@jupyterlab/terminal-extension",
"@jupyterlab/theme-dark-extension",
"@jupyterlab/theme-light-extension",
"@jupyterlab/toc-extension",
"@jupyterlab/tooltip-extension",
"@jupyterlab/translation-extension",
"@jupyterlab/ui-components-extension",
"@jupyterlab/vdom-extension"
],
"mimeExtensions": [
"@jupyterlab/javascript-extension",
"@jupyterlab/json-extension",
"@jupyterlab/pdf-extension",
"@jupyterlab/vega5-extension"
],
"excludedExtensions": [
"@jupyterlab/application-extension",
"@jupyterlab/extensionmanager-extension",
"@jupyterlab/hub-extension"
]
}
}
20 changes: 12 additions & 8 deletions scripts/buildutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ function checkExtensionImports() {
} catch (e) {
console.error('Error loading "extensions/index.ts"', e);
}

for (const extension in {...extensions, ...mimeExtensions}) {
for (const extension of [...extensions, ...mimeExtensions]) {
if (!extensionsFileContent.includes(`require('${extension}')`)) {
console.error(`${extension} is not imported in "extensions/index.ts"`);
process.exit(1);
Expand Down Expand Up @@ -232,8 +231,9 @@ if (cli.flags.setJupyterlabVersion !== "") {
console.error(`Invalid package.json format for v${newVersion}!`);
process.exit(1);
}

const newDependencies = {...newPkgData.devDependencies, ...newPkgData.resolutions};

const newResolutions = {...newPkgData.resolutions}
const newDependencies = {...newPkgData.devDependencies, ...newResolutions};

const pkgjsonFileData = fs.existsSync(pkgjsonFilePath)
? fs.readJSONSync(pkgjsonFilePath)
Expand All @@ -251,6 +251,10 @@ if (cli.flags.setJupyterlabVersion !== "") {
}
}

// copy resolutions and singleton packages as-is
pkgjsonFileData.resolutions = newResolutions;
pkgjsonFileData.singletonPackages = newPkgData.singletonPackages;

fs.writeFileSync(pkgjsonFilePath, JSON.stringify(pkgjsonFileData, null, 2));

console.log(`JupyterLab dependencies updated to v${newVersion}`);
Expand All @@ -264,11 +268,11 @@ if (cli.flags.setJupyterlabVersion !== "") {
const mimeExtensions = pkgjsonFileData.jupyterlab.mimeExtensions;
const excludedExtensions = pkgjsonFileData.jupyterlab.excludedExtensions;

const extensionSet = {...extensions, ...excludedExtensions};
const mimeExtensionSet = {...mimeExtensions, ...excludedExtensions};
const extensionSet = new Set([...extensions, ...excludedExtensions]);
const mimeExtensionSet = new Set([...mimeExtensions, ...excludedExtensions]);

for (const extension in newPkgData.jupyterlab.extensions) {
if (!(extension in extensionSet)) {
if (!extensionSet.has(extension)) {
console.error(
`JupyterLab v${newVersion} ${extension} is not bundled into the application!`
);
Expand All @@ -277,7 +281,7 @@ if (cli.flags.setJupyterlabVersion !== "") {
}

for (const extension in newPkgData.jupyterlab.mimeExtensions) {
if (!(extension in mimeExtensionSet)) {
if (!mimeExtensionSet.has(extension)) {
console.error(
`JupyterLab v${newVersion} ${extension} is not bundled into the application!`
);
Expand Down
Loading

0 comments on commit de39afd

Please sign in to comment.