Skip to content

Commit

Permalink
Minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc committed Oct 7, 2022
1 parent 0986508 commit 3cca434
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 27 deletions.
2 changes: 1 addition & 1 deletion docs/source/contribute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ About the Voila Frontend

The Voila frontend is built as a JupyterLab-based application using JupyterLab components.

This makes it possible to reuse existing plugins and extensions for Jupyterlab such as core JupyterLab plugin like the JSON viewer,
This makes it possible to reuse existing plugins and extensions for Jupyterlab such as core JupyterLab plugins like the JSON viewer,
as well as third-party mime renderers like the `FASTA viewer <https://github.com/jupyterlab/jupyter-renderers>`_.

The Voila frontend is able to load existing JupyterLab extensions installed as prebuilt extensions under ``${PREFIX}/share/labextensions``,
Expand Down
25 changes: 13 additions & 12 deletions packages/voila/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@
"dependencies": {
"@jupyter-widgets/base": "^6.0.1",
"@jupyter-widgets/controls": "^5.0.1",
"@jupyter-widgets/output": "^6.0.1",
"@jupyter-widgets/jupyterlab-manager": "^5.0.3",
"@jupyterlab/json-extension": "^3.0.0",
"@jupyterlab/markdownviewer-extension": "^3.0.0",
"@jupyterlab/mathjax2-extension": "^3.0.0",
"@jupyterlab/rendermime-extension": "^3.0.0",
"@jupyter-widgets/output": "^6.0.1",
"@jupyterlab/application": "^3.0.0",
"@jupyterlab/apputils": "^3.0.0",
"@jupyterlab/coreutils": "^5.0.0",
"@jupyterlab/docregistry": "^3.0.0",
"@jupyterlab/json-extension": "^3.0.0",
"@jupyterlab/logconsole": "^3.0.0",
"@jupyterlab/mainmenu": "^3.0.0",
"@jupyterlab/markdownviewer-extension": "^3.0.0",
"@jupyterlab/mathjax2-extension": "^3.0.0",
"@jupyterlab/nbformat": "^3.0.0",
"@jupyterlab/notebook": "^3.0.0",
"@jupyterlab/outputarea": "^3.0.0",
"@jupyterlab/rendermime": "^3.0.0",
"@jupyterlab/rendermime-extension": "^3.0.0",
"@jupyterlab/services": "^6.1.8",
"@jupyterlab/settingregistry": "^3.0.0",
"@jupyterlab/translation": "^3.0.0",
Expand All @@ -46,24 +46,25 @@
"@babel/core": "^7.2.2",
"@babel/preset-env": "^7.3.1",
"@jupyterlab/builder": "^3.0.0",
"@types/node": "^18.8.3",
"babel-loader": "^8.0.5",
"css-loader": "~5.0.2",
"file-loader": "^6.2.0",
"npm-run-all": "^4.1.5",
"p-limit": "^2.2.2",
"style-loader": "^2.0.0",
"typescript": "~4.1.3",
"url-loader": "^4.1.1",
"webpack": "^5.24.1",
"webpack-cli": "^4.5.0",
"fs-extra": "^9.1.0",
"glob": "~7.1.6",
"mini-css-extract-plugin": "~0.9.0",
"npm-run-all": "^4.1.5",
"p-limit": "^2.2.2",
"raw-loader": "^4.0.2",
"rimraf": "^3.0.2",
"style-loader": "^2.0.0",
"svg-url-loader": "^7.1.1",
"typescript": "~4.1.3",
"url-loader": "^4.1.1",
"watch": "^1.0.2",
"webpack": "^5.24.1",
"webpack-bundle-analyzer": "^4.4.0",
"webpack-cli": "^4.5.0",
"webpack-merge": "^5.7.3",
"whatwg-fetch": "^3.0.0"
},
Expand Down
7 changes: 4 additions & 3 deletions packages/voila/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { IRenderMime } from '@jupyterlab/rendermime';

import { IShell, VoilaShell } from './shell';

const PACKAGE = require('../package.json');

/**
* App is the main application class. It is instantiated once and shared.
*/
Expand All @@ -19,12 +21,11 @@ export class VoilaApp extends JupyterFrontEnd<IShell> {
*
* @param options The instantiation options for an application.
*/
constructor(options: App.IOptions = { shell: new VoilaShell() }) {
constructor(options: App.IOptions) {
super({
...options,
shell: options.shell ?? new VoilaShell()
});

if (options.mimeExtensions) {
for (const plugin of createRendermimePlugins(options.mimeExtensions)) {
this.registerPlugin(plugin);
Expand All @@ -45,7 +46,7 @@ export class VoilaApp extends JupyterFrontEnd<IShell> {
/**
* The version of the application.
*/
readonly version = 'unknown';
readonly version = PACKAGE['version'];

/**
* The JupyterLab application paths dictionary.
Expand Down
20 changes: 10 additions & 10 deletions packages/voila/src/output.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { IBackboneModelOptions } from '@jupyter-widgets/base';
import { LabWidgetManager } from '@jupyter-widgets/jupyterlab-manager';

import * as outputBase from '@jupyter-widgets/output';

import * as nbformat from '@jupyterlab/nbformat';

import { OutputAreaModel } from '@jupyterlab/outputarea';

import { KernelMessage } from '@jupyterlab/services';

/**
Expand All @@ -19,14 +16,13 @@ export class OutputModel extends outputBase.OutputModel {
return { ...super.defaults(), msg_id: '', outputs: [] };
}

initialize(attributes: any, options: any): void {
initialize(
attributes: Backbone.ObjectHash,
options: IBackboneModelOptions
): void {
super.initialize(attributes, options);
// The output area model is trusted since widgets are only rendered in trusted contexts.
this._outputs = new OutputAreaModel({ trusted: true });
this._msgHook = (msg): boolean => {
this.add(msg);
return false;
};

this.listenTo(this, 'change:msg_id', this.reset_msg_id);
this.listenTo(this, 'change:outputs', this.setOutputs);
Expand Down Expand Up @@ -93,6 +89,10 @@ export class OutputModel extends outputBase.OutputModel {

widget_manager!: LabWidgetManager;

private _msgHook!: (msg: KernelMessage.IIOPubMessage) => boolean;
private _msgHook = (msg: KernelMessage.IIOPubMessage): boolean => {
this.add(msg);
return false;
};

private _outputs!: OutputAreaModel;
}
3 changes: 2 additions & 1 deletion packages/voila/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"extends": "../../tsconfigbase",
"compilerOptions": {
"outDir": "lib",
"rootDir": "src"
"rootDir": "src",
"types": ["node"]
},
"include": ["src/**/*"]
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3190,6 +3190,11 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.7.18.tgz#633184f55c322e4fb08612307c274ee6d5ed3154"
integrity sha512-m+6nTEOadJZuTPkKR/SYK3A2d7FZrgElol9UP1Kae90VVU4a6mxnPuLiIW1m4Cq4gZ/nWb9GrdVXJCoCazDAbg==

"@types/node@^18.8.3":
version "18.8.3"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.8.3.tgz#ce750ab4017effa51aed6a7230651778d54e327c"
integrity sha512-0os9vz6BpGwxGe9LOhgP/ncvYN5Tx1fNcd2TM3rD/aCGBkysb+ZWpXEocG24h6ZzOi13+VB8HndAQFezsSOw1w==

"@types/normalize-package-data@^2.4.0":
version "2.4.1"
resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz#d3357479a0fdfdd5907fe67e17e0a85c906e1301"
Expand Down

0 comments on commit 3cca434

Please sign in to comment.