Explorar o código

convert all files to TS

Steven Silvester %!s(int64=8) %!d(string=hai) anos
pai
achega
43a0584b5a

+ 0 - 15
jupyterlab/index.js

@@ -1,15 +0,0 @@
-// Copyright (c) Jupyter Development Team.
-// Distributed under the terms of the Modified BSD License.
-
-var JupyterLab = require('../lib/application').JupyterLab;
-
-// ES6 Promise polyfill
-require('es6-promise').polyfill();
-
-require('font-awesome/css/font-awesome.min.css');
-require('../lib/default-theme/index.css');
-
-module.exports = new JupyterLab({
-  version: require('../package.json').version,
-  gitDescription: process.env.GIT_DESCRIPTION
-});

+ 1 - 1
jupyterlab/lab.html

@@ -44,7 +44,7 @@ Distributed under the terms of the Modified BSD License.
 
 {% block script %}
 <script>
-  var lab = window.jupyterlab = jupyter.require("{{ jupyterlab_main }}");
+  var lab = window.jupyterlab = jupyter.requireModule("{{ jupyterlab_main }}").lab;
   var plugins = [];
 
   {% for plugin_entry in plugin_entries %}

+ 34 - 0
jupyterlab/src/extensions.ts

@@ -0,0 +1,34 @@
+// Copyright (c) Jupyter Development Team.
+// Distributed under the terms of the Modified BSD License.
+
+module.exports = [
+  require('../../lib/about/plugin').aboutExtension,
+  require('../../lib/clipboard/plugin').clipboardProvider,
+  require('../../lib/commandlinker/plugin').commandLinkerProvider,
+  require('../../lib/commandpalette/plugin').commandPaletteProvider,
+  require('../../lib/console/plugin').consoleTrackerProvider,
+  require('../../lib/console/codemirror/plugin').rendererProvider,
+  require('../../lib/csvwidget/plugin').csvHandlerExtension,
+  require('../../lib/docmanager/plugin').docManagerProvider,
+  require('../../lib/docregistry/plugin').docRegistryProvider,
+  require('../../lib/editorwidget/plugin').editorHandlerProvider,
+  require('../../lib/faq/plugin').faqExtension,
+  require('../../lib/filebrowser/plugin').fileBrowserProvider,
+  require('../../lib/help/plugin').helpHandlerExtension,
+  require('../../lib/imagewidget/plugin').imageHandlerExtension,
+  require('../../lib/inspector/plugin').inspectorProvider,
+  require('../../lib/landing/plugin').landingExtension,
+  require('../../lib/launcher/plugin').launcherProvider,
+  require('../../lib/layoutrestorer/plugin').layoutRestorerProvider,
+  require('../../lib/main/plugin').mainExtension,
+  require('../../lib/mainmenu/plugin').mainMenuProvider,
+  require('../../lib/markdownwidget/plugin').markdownHandlerExtension,
+  require('../../lib/notebook/plugin').notebookTrackerProvider,
+  require('../../lib/notebook/codemirror/plugin').rendererProvider,
+  require('../../lib/rendermime/plugin').renderMimeProvider,
+  require('../../lib/running/plugin').runningSessionsExtension,
+  require('../../lib/services/plugin').servicesProvider,
+  require('../../lib/shortcuts/plugin').shortcutsExtension,
+  require('../../lib/statedb/plugin').stateProvider,
+  require('../../lib/terminal/plugin').terminalExtension
+];

+ 17 - 8
jupyterlab/loader.ts → jupyterlab/src/loader.ts

@@ -9,6 +9,15 @@ import {
   extractPlugins
 } from '@jupyterlab/extension-builder/lib/extract';
 
+import {
+  Application
+} from 'phosphor/lib/ui/application';
+
+import {
+  Widget
+} from 'phosphor/lib/ui/widget';
+
+
 
 /**
  * A module loader instance.
@@ -27,8 +36,8 @@ const loader = new ModuleLoader();
  *   range of the request.
  */
 export
-function require(path: string): ModuleLoader.IModule {
-  return loader.require.call(loader, mod);
+function requireModule(path: string): any {
+  return loader.require.call(loader, path);
 }
 
 
@@ -42,7 +51,7 @@ function require(path: string): ModuleLoader.IModule {
  */
 export
 function define(path: string, callback: ModuleLoader.DefineCallback): void {
-  loader.define.call(loader, mod, callback);
+  loader.define.call(loader, path, callback);
 }
 
 
@@ -54,8 +63,8 @@ function define(path: string, callback: ModuleLoader.DefineCallback): void {
  * @returns A promise that resolves with the requested bundle.
  */
 export
-function requireBundle(mod: string): Promise<ModuleLoader.IBundle> {
-  return loader.ensureBundle.call(loader, mod);
+function requireBundle(path: string): Promise<void> {
+  return loader.ensureBundle.call(loader, path);
 }
 
 
@@ -63,13 +72,13 @@ function requireBundle(mod: string): Promise<ModuleLoader.IBundle> {
  * Get an entry point given by the user after validating.
  */
 export
-function getEntryPoint(entryPoint: string): JupyterLabPlugin[] {
-  let plugins = require(entryPoint);
+function getEntryPoint(entryPoint: string): Application.IPlugin<Widget, any>[] {
+  let plugins = requireModule(entryPoint);
   try {
     plugins = extractPlugins(plugins);
   } catch (err) {
     console.error(err);
     plugins = [];
   }
-  return plugins as JupyterLabPlugin[];
+  return plugins;
 }

+ 23 - 0
jupyterlab/src/main.ts

@@ -0,0 +1,23 @@
+// Copyright (c) Jupyter Development Team.
+// Distributed under the terms of the Modified BSD License.
+
+import {
+  polyfill
+} from 'es6-promise';
+
+import {
+  JupyterLab
+} from '../../lib/application';
+
+import 'font-awesome/css/font-awesome.min.css';
+import '../../lib/default-theme/index.css';
+
+
+polyfill();
+
+export
+const lab = new JupyterLab({
+  version: require('../../package.json').version,
+  gitDescription: process.env.GIT_DESCRIPTION
+});
+

+ 1 - 1
jupyterlab/tsconfig.json → jupyterlab/src/tsconfig.json

@@ -8,7 +8,7 @@
     "module": "commonjs",
     "moduleResolution": "node",
     "target": "ES5",
-    "outDir": ".",
+    "outDir": "../build",
     "sourceMap": true
   }
 }

+ 3 - 3
jupyterlab/webpack.config.js

@@ -16,7 +16,7 @@ var notice = childProcess.execSync('git describe', { encoding: 'utf8' });
 
 buildExtension({
   name: 'main',
-  entry: './index',
+  entry: './build/main',
   outputDir: './build',
   config: {
     output: {
@@ -34,7 +34,7 @@ buildExtension({
 
 buildExtension({
   name: 'extensions',
-  entry: './extensions',
+  entry: './build/extensions',
   outputDir: './build',
   config: {
     output: {
@@ -49,7 +49,7 @@ buildExtension({
 
 module.exports = {
   entry: {
-    loader: './loader'
+    loader: './build/loader'
   },
   output: {
     path: __dirname + '/build',