From 91a61681353be2a848b9e13b2f1b5100df69155a Mon Sep 17 00:00:00 2001 From: Vidar Tonaas Fauske Date: Sun, 22 Dec 2019 13:20:53 +0000 Subject: [PATCH 01/13] Create package nbformat --- dev_mode/package.json | 2 ++ packages/metapackage/package.json | 1 + packages/metapackage/tsconfig.json | 7 ++++- packages/nbformat/package.json | 41 ++++++++++++++++++++++++++++++ packages/nbformat/src/index.ts | 4 +++ packages/nbformat/tsconfig.json | 8 ++++++ 6 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 packages/nbformat/package.json create mode 100644 packages/nbformat/src/index.ts create mode 100644 packages/nbformat/tsconfig.json diff --git a/dev_mode/package.json b/dev_mode/package.json index fd2d7a46458f..15c3acbe9014 100644 --- a/dev_mode/package.json +++ b/dev_mode/package.json @@ -138,6 +138,7 @@ "@jupyterlab/mathjax2-extension": "~2.0.0-alpha.4", "@jupyterlab/metapackage": "~2.0.0-alpha.4", "@jupyterlab/nbconvert-css": "~2.0.0-alpha.4", + "@jupyterlab/nbformat": "~2.0.0-alpha.4", "@jupyterlab/notebook": "~2.0.0-alpha.4", "@jupyterlab/notebook-extension": "~2.0.0-alpha.4", "@jupyterlab/observables": "~3.0.0-alpha.4", @@ -324,6 +325,7 @@ "@jupyterlab/mathjax2-extension": "../packages/mathjax2-extension", "@jupyterlab/metapackage": "../packages/metapackage", "@jupyterlab/nbconvert-css": "../packages/nbconvert-css", + "@jupyterlab/nbformat": "../packages/nbformat", "@jupyterlab/notebook": "../packages/notebook", "@jupyterlab/notebook-extension": "../packages/notebook-extension", "@jupyterlab/observables": "../packages/observables", diff --git a/packages/metapackage/package.json b/packages/metapackage/package.json index 23a899614206..b444b62805e7 100644 --- a/packages/metapackage/package.json +++ b/packages/metapackage/package.json @@ -81,6 +81,7 @@ "@jupyterlab/mathjax2": "^2.0.0-alpha.4", "@jupyterlab/mathjax2-extension": "^2.0.0-alpha.4", "@jupyterlab/nbconvert-css": "^2.0.0-alpha.4", + "@jupyterlab/nbformat": "^2.0.0-alpha.4", "@jupyterlab/notebook": "^2.0.0-alpha.4", "@jupyterlab/notebook-extension": "^2.0.0-alpha.4", "@jupyterlab/observables": "^3.0.0-alpha.4", diff --git a/packages/metapackage/tsconfig.json b/packages/metapackage/tsconfig.json index 7f7563ea2b88..f45290f65e55 100644 --- a/packages/metapackage/tsconfig.json +++ b/packages/metapackage/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../application" @@ -239,6 +241,9 @@ }, { "path": "../vega5-extension" + }, + { + "path": "../nbformat" } ] } diff --git a/packages/nbformat/package.json b/packages/nbformat/package.json new file mode 100644 index 000000000000..1ab5f6659504 --- /dev/null +++ b/packages/nbformat/package.json @@ -0,0 +1,41 @@ +{ + "name": "@jupyterlab/nbformat", + "version": "2.0.0-alpha.4", + "description": "Notebook format interfaces", + "homepage": "https://github.com/jupyterlab/jupyterlab", + "bugs": { + "url": "https://github.com/jupyterlab/jupyterlab/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/jupyterlab/jupyterlab.git" + }, + "license": "BSD-3-Clause", + "author": "Project Jupyter", + "files": [ + "lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}", + "schema/*.json", + "style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}" + ], + "sideEffects": [ + "style/**/*" + ], + "main": "lib/index.js", + "types": "lib/index.d.ts", + "directories": { + "lib": "lib/" + }, + "scripts": { + "build": "tsc", + "clean": "rimraf lib", + "prepublishOnly": "npm run build", + "watch": "tsc -w --listEmittedFiles" + }, + "devDependencies": { + "rimraf": "~3.0.0", + "typescript": "~3.7.3" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/nbformat/src/index.ts b/packages/nbformat/src/index.ts new file mode 100644 index 000000000000..215ca5d2e743 --- /dev/null +++ b/packages/nbformat/src/index.ts @@ -0,0 +1,4 @@ +/*----------------------------------------------------------------------------- +| Copyright (c) Jupyter Development Team. +| Distributed under the terms of the Modified BSD License. +|----------------------------------------------------------------------------*/ diff --git a/packages/nbformat/tsconfig.json b/packages/nbformat/tsconfig.json new file mode 100644 index 000000000000..a1e4ba13c4bc --- /dev/null +++ b/packages/nbformat/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfigbase", + "compilerOptions": { + "outDir": "lib", + "rootDir": "src" + }, + "include": ["src/*"] +} From 5b40e006017176e355447165339dacb738e36a46 Mon Sep 17 00:00:00 2001 From: Vidar Tonaas Fauske Date: Sun, 22 Dec 2019 13:46:03 +0000 Subject: [PATCH 02/13] Move nbformat code to separate package --- packages/attachments/package.json | 2 +- packages/attachments/src/model.ts | 2 +- packages/attachments/tsconfig.json | 6 +- packages/cells/package.json | 1 + packages/cells/src/celldragutils.ts | 2 +- packages/cells/src/model.ts | 4 +- packages/cells/src/widget.ts | 9 +- packages/cells/tsconfig.json | 7 +- packages/codeeditor/package.json | 1 + packages/codeeditor/src/mimetype.ts | 2 +- packages/codeeditor/tsconfig.json | 7 +- packages/codemirror/package.json | 1 + packages/codemirror/src/mimetype.ts | 4 +- packages/codemirror/tsconfig.json | 7 +- packages/console/package.json | 1 + packages/console/src/foreign.ts | 2 +- packages/console/src/widget.ts | 2 +- packages/console/tsconfig.json | 7 +- packages/coreutils/src/index.ts | 1 - packages/coreutils/src/nbformat.ts | 530 ------------------ packages/logconsole-extension/package.json | 1 + packages/logconsole-extension/src/nboutput.ts | 2 +- packages/logconsole-extension/tsconfig.json | 7 +- packages/logconsole/package.json | 1 + packages/logconsole/src/logger.ts | 2 +- packages/logconsole/src/tokens.ts | 6 +- packages/logconsole/src/widget.ts | 4 +- packages/logconsole/tsconfig.json | 7 +- packages/metapackage/tsconfig.json | 6 +- packages/nbformat/package.json | 3 + packages/nbformat/src/index.ts | 529 ++++++++++++++++- packages/notebook-extension/package.json | 1 + packages/notebook-extension/src/index.ts | 3 +- packages/notebook-extension/tsconfig.json | 7 +- packages/notebook/package.json | 1 + packages/notebook/src/actions.tsx | 4 +- packages/notebook/src/default-toolbar.tsx | 2 +- packages/notebook/src/model.ts | 2 +- packages/notebook/src/notebooktools.ts | 2 +- packages/notebook/src/widget.ts | 4 +- packages/notebook/tsconfig.json | 7 +- packages/outputarea/package.json | 2 +- packages/outputarea/src/model.ts | 2 +- packages/outputarea/src/widget.ts | 2 +- packages/outputarea/tsconfig.json | 6 +- packages/rendermime/package.json | 1 + packages/rendermime/src/attachmentmodel.ts | 2 +- packages/rendermime/src/outputmodel.ts | 2 +- packages/rendermime/tsconfig.json | 7 +- packages/services/package.json | 1 + packages/services/src/kernel/messages.ts | 2 +- packages/services/tsconfig.json | 11 +- tests/test-cells/package.json | 1 + tests/test-cells/src/model.spec.ts | 4 +- tests/test-cells/tsconfig.json | 11 +- tests/test-coreutils/package.json | 1 + tests/test-coreutils/src/nbformat.spec.ts | 2 +- tests/test-coreutils/tsconfig.json | 11 +- tests/test-notebook/package.json | 1 + tests/test-notebook/src/model.spec.ts | 2 +- tests/test-notebook/tsconfig.json | 11 +- tests/test-rendermime/package.json | 1 + tests/test-rendermime/src/outputmodel.spec.ts | 2 +- tests/test-rendermime/tsconfig.json | 12 +- testutils/package.json | 1 + testutils/src/notebook-utils.ts | 2 +- testutils/tsconfig.json | 11 +- 67 files changed, 710 insertions(+), 600 deletions(-) delete mode 100644 packages/coreutils/src/nbformat.ts diff --git a/packages/attachments/package.json b/packages/attachments/package.json index 5d6ebde98511..6ac988632620 100644 --- a/packages/attachments/package.json +++ b/packages/attachments/package.json @@ -35,7 +35,7 @@ "watch": "tsc -b --watch" }, "dependencies": { - "@jupyterlab/coreutils": "^4.0.0-alpha.4", + "@jupyterlab/nbformat": "^2.0.0-alpha.4", "@jupyterlab/observables": "^3.0.0-alpha.4", "@jupyterlab/rendermime": "^2.0.0-alpha.4", "@jupyterlab/rendermime-interfaces": "^2.0.0-alpha.4", diff --git a/packages/attachments/src/model.ts b/packages/attachments/src/model.ts index 777239356cf4..973e4d0d6b7d 100644 --- a/packages/attachments/src/model.ts +++ b/packages/attachments/src/model.ts @@ -1,7 +1,7 @@ // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. -import { nbformat } from '@jupyterlab/coreutils'; +import * as nbformat from '@jupyterlab/nbformat'; import { IObservableMap, diff --git a/packages/attachments/tsconfig.json b/packages/attachments/tsconfig.json index 0738f0d99ad6..2f9fdcc93baa 100644 --- a/packages/attachments/tsconfig.json +++ b/packages/attachments/tsconfig.json @@ -4,10 +4,12 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { - "path": "../coreutils" + "path": "../nbformat" }, { "path": "../observables" diff --git a/packages/cells/package.json b/packages/cells/package.json index 714487a27066..2c6a06795a60 100644 --- a/packages/cells/package.json +++ b/packages/cells/package.json @@ -41,6 +41,7 @@ "@jupyterlab/codemirror": "^2.0.0-alpha.4", "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/filebrowser": "^2.0.0-alpha.4", + "@jupyterlab/nbformat": "^2.0.0-alpha.4", "@jupyterlab/observables": "^3.0.0-alpha.4", "@jupyterlab/outputarea": "^2.0.0-alpha.4", "@jupyterlab/rendermime": "^2.0.0-alpha.4", diff --git a/packages/cells/src/celldragutils.ts b/packages/cells/src/celldragutils.ts index 2717fdc220f4..8a243c7184c9 100644 --- a/packages/cells/src/celldragutils.ts +++ b/packages/cells/src/celldragutils.ts @@ -13,7 +13,7 @@ import { each, IterableOrArrayLike } from '@lumino/algorithm'; import { ICodeCellModel } from './model'; import { Cell } from './widget'; import { h, VirtualDOM } from '@lumino/virtualdom'; -import { nbformat } from '@jupyterlab/coreutils'; +import * as nbformat from '@jupyterlab/nbformat'; /** * Constants for drag diff --git a/packages/cells/src/model.ts b/packages/cells/src/model.ts index 05fb642f8340..0c37c7375cf1 100644 --- a/packages/cells/src/model.ts +++ b/packages/cells/src/model.ts @@ -11,7 +11,9 @@ import { IAttachmentsModel, AttachmentsModel } from '@jupyterlab/attachments'; import { CodeEditor } from '@jupyterlab/codeeditor'; -import { IChangedArgs, nbformat } from '@jupyterlab/coreutils'; +import { IChangedArgs } from '@jupyterlab/coreutils'; + +import * as nbformat from '@jupyterlab/nbformat'; import { UUID } from '@lumino/coreutils'; diff --git a/packages/cells/src/widget.ts b/packages/cells/src/widget.ts index b26ece06fa3d..97cd8eb56a6b 100644 --- a/packages/cells/src/widget.ts +++ b/packages/cells/src/widget.ts @@ -7,17 +7,14 @@ import { AttachmentsResolver } from '@jupyterlab/attachments'; import { ISessionContext } from '@jupyterlab/apputils'; -import { - IChangedArgs, - ActivityMonitor, - nbformat, - URLExt -} from '@jupyterlab/coreutils'; +import { IChangedArgs, ActivityMonitor, URLExt } from '@jupyterlab/coreutils'; import { CodeEditor, CodeEditorWrapper } from '@jupyterlab/codeeditor'; import { DirListing } from '@jupyterlab/filebrowser'; +import * as nbformat from '@jupyterlab/nbformat'; + import { IObservableMap, IObservableJSON } from '@jupyterlab/observables'; import { diff --git a/packages/cells/tsconfig.json b/packages/cells/tsconfig.json index 27177c5eac5e..8a7562271f15 100644 --- a/packages/cells/tsconfig.json +++ b/packages/cells/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../apputils" @@ -24,6 +26,9 @@ { "path": "../filebrowser" }, + { + "path": "../nbformat" + }, { "path": "../observables" }, diff --git a/packages/codeeditor/package.json b/packages/codeeditor/package.json index 4ec631b23752..b3b596578cfd 100644 --- a/packages/codeeditor/package.json +++ b/packages/codeeditor/package.json @@ -36,6 +36,7 @@ }, "dependencies": { "@jupyterlab/coreutils": "^4.0.0-alpha.4", + "@jupyterlab/nbformat": "^2.0.0-alpha.4", "@jupyterlab/observables": "^3.0.0-alpha.4", "@lumino/coreutils": "^1.4.0", "@lumino/disposable": "^1.3.2", diff --git a/packages/codeeditor/src/mimetype.ts b/packages/codeeditor/src/mimetype.ts index b9456cc4a6ab..8a64ce959b8a 100644 --- a/packages/codeeditor/src/mimetype.ts +++ b/packages/codeeditor/src/mimetype.ts @@ -1,7 +1,7 @@ // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. -import { nbformat } from '@jupyterlab/coreutils'; +import * as nbformat from '@jupyterlab/nbformat'; /** * The mime type service of a code editor. diff --git a/packages/codeeditor/tsconfig.json b/packages/codeeditor/tsconfig.json index b6147c37b786..af8047dc5732 100644 --- a/packages/codeeditor/tsconfig.json +++ b/packages/codeeditor/tsconfig.json @@ -4,11 +4,16 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../coreutils" }, + { + "path": "../nbformat" + }, { "path": "../observables" } diff --git a/packages/codemirror/package.json b/packages/codemirror/package.json index 09d548edf89a..1ed4e90b9509 100644 --- a/packages/codemirror/package.json +++ b/packages/codemirror/package.json @@ -36,6 +36,7 @@ "@jupyterlab/apputils": "^2.0.0-alpha.4", "@jupyterlab/codeeditor": "^2.0.0-alpha.4", "@jupyterlab/coreutils": "^4.0.0-alpha.4", + "@jupyterlab/nbformat": "^2.0.0-alpha.4", "@jupyterlab/observables": "^3.0.0-alpha.4", "@jupyterlab/statusbar": "^2.0.0-alpha.4", "@lumino/algorithm": "^1.2.1", diff --git a/packages/codemirror/src/mimetype.ts b/packages/codemirror/src/mimetype.ts index 6b02e2204925..7e8656081a3f 100644 --- a/packages/codemirror/src/mimetype.ts +++ b/packages/codemirror/src/mimetype.ts @@ -3,7 +3,9 @@ import { IEditorMimeTypeService } from '@jupyterlab/codeeditor'; -import { nbformat, PathExt } from '@jupyterlab/coreutils'; +import { PathExt } from '@jupyterlab/coreutils'; + +import * as nbformat from '@jupyterlab/nbformat'; import { Mode } from './mode'; diff --git a/packages/codemirror/tsconfig.json b/packages/codemirror/tsconfig.json index cef6c8e4442d..1de89ff421fd 100644 --- a/packages/codemirror/tsconfig.json +++ b/packages/codemirror/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../apputils" @@ -15,6 +17,9 @@ { "path": "../coreutils" }, + { + "path": "../nbformat" + }, { "path": "../observables" }, diff --git a/packages/console/package.json b/packages/console/package.json index 8fcbea3f99ea..1dbd83f3bb12 100644 --- a/packages/console/package.json +++ b/packages/console/package.json @@ -39,6 +39,7 @@ "@jupyterlab/cells": "^2.0.0-alpha.4", "@jupyterlab/codeeditor": "^2.0.0-alpha.4", "@jupyterlab/coreutils": "^4.0.0-alpha.4", + "@jupyterlab/nbformat": "^2.0.0-alpha.4", "@jupyterlab/observables": "^3.0.0-alpha.4", "@jupyterlab/rendermime": "^2.0.0-alpha.4", "@jupyterlab/services": "^5.0.0-alpha.4", diff --git a/packages/console/src/foreign.ts b/packages/console/src/foreign.ts index 1bdf3a197530..890aebc94f0e 100644 --- a/packages/console/src/foreign.ts +++ b/packages/console/src/foreign.ts @@ -5,7 +5,7 @@ import { ISessionContext } from '@jupyterlab/apputils'; import { CodeCell } from '@jupyterlab/cells'; -import { nbformat } from '@jupyterlab/coreutils'; +import * as nbformat from '@jupyterlab/nbformat'; import { KernelMessage } from '@jupyterlab/services'; diff --git a/packages/console/src/widget.ts b/packages/console/src/widget.ts index 0ef362b02d02..e5e94f03abec 100644 --- a/packages/console/src/widget.ts +++ b/packages/console/src/widget.ts @@ -18,7 +18,7 @@ import { import { IEditorMimeTypeService, CodeEditor } from '@jupyterlab/codeeditor'; -import { nbformat } from '@jupyterlab/coreutils'; +import * as nbformat from '@jupyterlab/nbformat'; import { IObservableList, ObservableList } from '@jupyterlab/observables'; diff --git a/packages/console/tsconfig.json b/packages/console/tsconfig.json index 5ad754f1cd78..793803d0f0bc 100644 --- a/packages/console/tsconfig.json +++ b/packages/console/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../apputils" @@ -18,6 +20,9 @@ { "path": "../coreutils" }, + { + "path": "../nbformat" + }, { "path": "../observables" }, diff --git a/packages/coreutils/src/index.ts b/packages/coreutils/src/index.ts index b4748788b3a0..2fdbd267e5ef 100644 --- a/packages/coreutils/src/index.ts +++ b/packages/coreutils/src/index.ts @@ -5,7 +5,6 @@ export * from './activitymonitor'; export * from './dataconnector'; export * from './interfaces'; export * from './markdowncodeblocks'; -export * from './nbformat'; export * from './pageconfig'; export * from './path'; export * from './restorablepool'; diff --git a/packages/coreutils/src/nbformat.ts b/packages/coreutils/src/nbformat.ts deleted file mode 100644 index 998ab2c9e189..000000000000 --- a/packages/coreutils/src/nbformat.ts +++ /dev/null @@ -1,530 +0,0 @@ -// Copyright (c) Jupyter Development Team. -// Distributed under the terms of the Modified BSD License. - -// Notebook format interfaces -// https://nbformat.readthedocs.io/en/latest/format_description.html -// https://github.com/jupyter/nbformat/blob/master/nbformat/v4/nbformat.v4.schema.json - -import { PartialJSONObject, JSONExt } from '@lumino/coreutils'; - -/** - * A namespace for nbformat interfaces. - */ -export namespace nbformat { - /** - * The major version of the notebook format. - */ - export const MAJOR_VERSION: number = 4; - - /** - * The minor version of the notebook format. - */ - export const MINOR_VERSION: number = 4; - - /** - * The kernelspec metadata. - */ - export interface IKernelspecMetadata extends PartialJSONObject { - name: string; - display_name: string; - } - - /** - * The language info metatda - */ - export interface ILanguageInfoMetadata extends PartialJSONObject { - name: string; - codemirror_mode?: string | PartialJSONObject; - file_extension?: string; - mimetype?: string; - pygments_lexer?: string; - } - - /** - * The default metadata for the notebook. - */ - export interface INotebookMetadata extends PartialJSONObject { - kernelspec?: IKernelspecMetadata; - language_info?: ILanguageInfoMetadata; - orig_nbformat: number; - } - - /** - * The notebook content. - */ - export interface INotebookContent extends PartialJSONObject { - metadata: INotebookMetadata; - nbformat_minor: number; - nbformat: number; - cells: ICell[]; - } - - /** - * A multiline string. - */ - export type MultilineString = string | string[]; - - /** - * A mime-type keyed dictionary of data. - */ - export interface IMimeBundle extends PartialJSONObject { - [key: string]: MultilineString | PartialJSONObject; - } - - /** - * Media attachments (e.g. inline images). - */ - export interface IAttachments { - [key: string]: IMimeBundle | undefined; - } - - /** - * The code cell's prompt number. Will be null if the cell has not been run. - */ - export type ExecutionCount = number | null; - - /** - * Cell output metadata. - */ - export type OutputMetadata = PartialJSONObject; - - /** - * Validate a mime type/value pair. - * - * @param type - The mimetype name. - * - * @param value - The value associated with the type. - * - * @returns Whether the type/value pair are valid. - */ - export function validateMimeValue( - type: string, - value: MultilineString | PartialJSONObject - ): boolean { - // Check if "application/json" or "application/foo+json" - const jsonTest = /^application\/(.*?)+\+json$/; - const isJSONType = type === 'application/json' || jsonTest.test(type); - - let isString = (x: any) => { - return Object.prototype.toString.call(x) === '[object String]'; - }; - - // If it is an array, make sure if is not a JSON type and it is an - // array of strings. - if (Array.isArray(value)) { - if (isJSONType) { - return false; - } - let valid = true; - (value as string[]).forEach(v => { - if (!isString(v)) { - valid = false; - } - }); - return valid; - } - - // If it is a string, make sure we are not a JSON type. - if (isString(value)) { - return !isJSONType; - } - - // It is not a string, make sure it is a JSON type. - if (!isJSONType) { - return false; - } - - // It is a JSON type, make sure it is a valid JSON object. - return JSONExt.isObject(value); - } - - /** - * A type which describes the type of cell. - */ - export type CellType = 'code' | 'markdown' | 'raw'; - - /** - * The Jupyter metadata namespace. - */ - export interface IBaseCellJupyterMetadata extends PartialJSONObject { - /** - * Whether the source is hidden. - */ - source_hidden: boolean; - } - - /** - * Cell-level metadata. - */ - export interface IBaseCellMetadata extends PartialJSONObject { - /** - * Whether the cell is trusted. - * - * #### Notes - * This is not strictly part of the nbformat spec, but it is added by - * the contents manager. - * - * See https://jupyter-notebook.readthedocs.io/en/latest/security.html. - */ - trusted: boolean; - - /** - * The cell's name. If present, must be a non-empty string. - */ - name: string; - - /** - * The Jupyter metadata namespace - */ - jupyter: Partial; - - /** - * The cell's tags. Tags must be unique, and must not contain commas. - */ - tags: string[]; - } - - /** - * The base cell interface. - */ - export interface IBaseCell extends PartialJSONObject { - /** - * String identifying the type of cell. - */ - cell_type: string; - - /** - * Contents of the cell, represented as an array of lines. - */ - source: MultilineString; - - /** - * Cell-level metadata. - */ - metadata: Partial; - } - - /** - * Metadata for the raw cell. - */ - export interface IRawCellMetadata extends IBaseCellMetadata { - /** - * Raw cell metadata format for nbconvert. - */ - format: string; - } - - /** - * A raw cell. - */ - export interface IRawCell extends IBaseCell { - /** - * String identifying the type of cell. - */ - cell_type: 'raw'; - - /** - * Cell-level metadata. - */ - metadata: Partial; - - /** - * Cell attachments. - */ - attachments?: IAttachments; - } - - /** - * A markdown cell. - */ - export interface IMarkdownCell extends IBaseCell { - /** - * String identifying the type of cell. - */ - cell_type: 'markdown'; - - /** - * Cell attachments. - */ - attachments?: IAttachments; - } - - /** - * The Jupyter metadata namespace for code cells. - */ - export interface ICodeCellJupyterMetadata extends IBaseCellJupyterMetadata { - /** - * Whether the outputs are hidden. See https://github.com/jupyter/nbformat/issues/137. - */ - outputs_hidden: boolean; - } - - /** - * Metadata for a code cell. - */ - export interface ICodeCellMetadata extends IBaseCellMetadata { - /** - * Whether the cell is collapsed/expanded. - */ - collapsed: boolean; - - /** - * The Jupyter metadata namespace - */ - jupyter: Partial; - - /** - * Whether the cell's output is scrolled, unscrolled, or autoscrolled. - */ - scrolled: boolean | 'auto'; - } - - /** - * A code cell. - */ - export interface ICodeCell extends IBaseCell { - /** - * String identifying the type of cell. - */ - cell_type: 'code'; - - /** - * Cell-level metadata. - */ - metadata: Partial; - - /** - * Execution, display, or stream outputs. - */ - outputs: IOutput[]; - - /** - * The code cell's prompt number. Will be null if the cell has not been run. - */ - execution_count: ExecutionCount; - } - - /** - * An unrecognized cell. - */ - export interface IUnrecognizedCell extends IBaseCell {} - - /** - * A cell union type. - */ - export type ICell = IRawCell | IMarkdownCell | ICodeCell | IUnrecognizedCell; - - /** - * Test whether a cell is a raw cell. - */ - export function isRaw(cell: ICell): cell is IRawCell { - return cell.cell_type === 'raw'; - } - - /** - * Test whether a cell is a markdown cell. - */ - export function isMarkdown(cell: ICell): cell is IMarkdownCell { - return cell.cell_type === 'markdown'; - } - - /** - * Test whether a cell is a code cell. - */ - export function isCode(cell: ICell): cell is ICodeCell { - return cell.cell_type === 'code'; - } - - /** - * A union metadata type. - */ - export type ICellMetadata = - | IBaseCellMetadata - | IRawCellMetadata - | ICodeCellMetadata; - - /** - * The valid output types. - */ - export type OutputType = - | 'execute_result' - | 'display_data' - | 'stream' - | 'error' - | 'update_display_data'; - - /** - * The base output type. - */ - export interface IBaseOutput extends PartialJSONObject { - /** - * Type of cell output. - */ - output_type: string; - } - - /** - * Result of executing a code cell. - */ - export interface IExecuteResult extends IBaseOutput { - /** - * Type of cell output. - */ - output_type: 'execute_result'; - - /** - * A result's prompt number. - */ - execution_count: ExecutionCount; - - /** - * A mime-type keyed dictionary of data. - */ - data: IMimeBundle; - - /** - * Cell output metadata. - */ - metadata: OutputMetadata; - } - - /** - * Data displayed as a result of code cell execution. - */ - export interface IDisplayData extends IBaseOutput { - /** - * Type of cell output. - */ - output_type: 'display_data'; - - /** - * A mime-type keyed dictionary of data. - */ - data: IMimeBundle; - - /** - * Cell output metadata. - */ - metadata: OutputMetadata; - } - - /** - * Data displayed as an update to existing display data. - */ - export interface IDisplayUpdate extends IBaseOutput { - /** - * Type of cell output. - */ - output_type: 'update_display_data'; - - /** - * A mime-type keyed dictionary of data. - */ - data: IMimeBundle; - - /** - * Cell output metadata. - */ - metadata: OutputMetadata; - } - - /** - * Stream output from a code cell. - */ - export interface IStream extends IBaseOutput { - /** - * Type of cell output. - */ - output_type: 'stream'; - - /** - * The name of the stream. - */ - name: StreamType; - - /** - * The stream's text output. - */ - text: MultilineString; - } - - /** - * An alias for a stream type. - */ - export type StreamType = 'stdout' | 'stderr'; - - /** - * Output of an error that occurred during code cell execution. - */ - export interface IError extends IBaseOutput { - /** - * Type of cell output. - */ - output_type: 'error'; - - /** - * The name of the error. - */ - ename: string; - - /** - * The value, or message, of the error. - */ - evalue: string; - - /** - * The error's traceback. - */ - traceback: string[]; - } - - /** - * Unrecognized output. - */ - export interface IUnrecognizedOutput extends IBaseOutput {} - - /** - * Test whether an output is an execute result. - */ - export function isExecuteResult(output: IOutput): output is IExecuteResult { - return output.output_type === 'execute_result'; - } - - /** - * Test whether an output is from display data. - */ - export function isDisplayData(output: IOutput): output is IDisplayData { - return output.output_type === 'display_data'; - } - - /** - * Test whether an output is from updated display data. - */ - export function isDisplayUpdate(output: IOutput): output is IDisplayUpdate { - return output.output_type === 'update_display_data'; - } - - /** - * Test whether an output is from a stream. - */ - export function isStream(output: IOutput): output is IStream { - return output.output_type === 'stream'; - } - - /** - * Test whether an output is an error. - */ - export function isError(output: IOutput): output is IError { - return output.output_type === 'error'; - } - - /** - * An output union type. - */ - export type IOutput = - | IUnrecognizedOutput - | IExecuteResult - | IDisplayData - | IStream - | IError; -} diff --git a/packages/logconsole-extension/package.json b/packages/logconsole-extension/package.json index d4e2e4e064c7..ca4652fabaaa 100644 --- a/packages/logconsole-extension/package.json +++ b/packages/logconsole-extension/package.json @@ -38,6 +38,7 @@ "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/logconsole": "^2.0.0-alpha.4", "@jupyterlab/mainmenu": "^2.0.0-alpha.4", + "@jupyterlab/nbformat": "^2.0.0-alpha.4", "@jupyterlab/notebook": "^2.0.0-alpha.4", "@jupyterlab/rendermime": "^2.0.0-alpha.4", "@jupyterlab/services": "^5.0.0-alpha.4", diff --git a/packages/logconsole-extension/src/nboutput.ts b/packages/logconsole-extension/src/nboutput.ts index a7513ff8e172..38fbd6526a9d 100644 --- a/packages/logconsole-extension/src/nboutput.ts +++ b/packages/logconsole-extension/src/nboutput.ts @@ -6,7 +6,7 @@ import { JupyterFrontEndPlugin } from '@jupyterlab/application'; -import { nbformat } from '@jupyterlab/coreutils'; +import * as nbformat from '@jupyterlab/nbformat'; import { ILoggerRegistry, LogLevel } from '@jupyterlab/logconsole'; diff --git a/packages/logconsole-extension/tsconfig.json b/packages/logconsole-extension/tsconfig.json index d482ee60b9c6..5eb0a6abf0ac 100644 --- a/packages/logconsole-extension/tsconfig.json +++ b/packages/logconsole-extension/tsconfig.json @@ -5,7 +5,9 @@ "rootDir": "src", "strictNullChecks": false }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../application" @@ -36,6 +38,9 @@ }, { "path": "../ui-components" + }, + { + "path": "../nbformat" } ] } diff --git a/packages/logconsole/package.json b/packages/logconsole/package.json index b59cf293246e..80d4e660b405 100644 --- a/packages/logconsole/package.json +++ b/packages/logconsole/package.json @@ -33,6 +33,7 @@ }, "dependencies": { "@jupyterlab/coreutils": "^4.0.0-alpha.4", + "@jupyterlab/nbformat": "^2.0.0-alpha.4", "@jupyterlab/outputarea": "^2.0.0-alpha.4", "@jupyterlab/rendermime": "^2.0.0-alpha.4", "@jupyterlab/services": "^5.0.0-alpha.4", diff --git a/packages/logconsole/src/logger.ts b/packages/logconsole/src/logger.ts index 79f67e9ba96d..4394a0ba0d2d 100644 --- a/packages/logconsole/src/logger.ts +++ b/packages/logconsole/src/logger.ts @@ -1,7 +1,7 @@ // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. -import { nbformat } from '@jupyterlab/coreutils'; +import * as nbformat from '@jupyterlab/nbformat'; import { IOutputAreaModel, OutputAreaModel } from '@jupyterlab/outputarea'; diff --git a/packages/logconsole/src/tokens.ts b/packages/logconsole/src/tokens.ts index 2b3b745be54f..198829861624 100644 --- a/packages/logconsole/src/tokens.ts +++ b/packages/logconsole/src/tokens.ts @@ -1,12 +1,14 @@ // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. -import { nbformat, IChangedArgs } from '@jupyterlab/coreutils'; +import { IChangedArgs } from '@jupyterlab/coreutils'; -import { IRenderMimeRegistry } from '@jupyterlab/rendermime'; +import * as nbformat from '@jupyterlab/nbformat'; import { IOutputAreaModel } from '@jupyterlab/outputarea'; +import { IRenderMimeRegistry } from '@jupyterlab/rendermime'; + import { Token } from '@lumino/coreutils'; import { ISignal } from '@lumino/signaling'; diff --git a/packages/logconsole/src/widget.ts b/packages/logconsole/src/widget.ts index e663ae9e57d4..096f595b122d 100644 --- a/packages/logconsole/src/widget.ts +++ b/packages/logconsole/src/widget.ts @@ -1,7 +1,9 @@ // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. -import { nbformat, IChangedArgs } from '@jupyterlab/coreutils'; +import { IChangedArgs } from '@jupyterlab/coreutils'; + +import * as nbformat from '@jupyterlab/nbformat'; import { OutputArea, IOutputPrompt } from '@jupyterlab/outputarea'; diff --git a/packages/logconsole/tsconfig.json b/packages/logconsole/tsconfig.json index 3feb64f1dae1..60e240e3f54f 100644 --- a/packages/logconsole/tsconfig.json +++ b/packages/logconsole/tsconfig.json @@ -5,11 +5,16 @@ "rootDir": "src", "strictNullChecks": false }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../coreutils" }, + { + "path": "../nbformat" + }, { "path": "../outputarea" }, diff --git a/packages/metapackage/tsconfig.json b/packages/metapackage/tsconfig.json index f45290f65e55..53bbaa710318 100644 --- a/packages/metapackage/tsconfig.json +++ b/packages/metapackage/tsconfig.json @@ -155,6 +155,9 @@ { "path": "../mathjax2-extension" }, + { + "path": "../nbformat" + }, { "path": "../notebook" }, @@ -241,9 +244,6 @@ }, { "path": "../vega5-extension" - }, - { - "path": "../nbformat" } ] } diff --git a/packages/nbformat/package.json b/packages/nbformat/package.json index 1ab5f6659504..bfc4fc0d5cc7 100644 --- a/packages/nbformat/package.json +++ b/packages/nbformat/package.json @@ -31,6 +31,9 @@ "prepublishOnly": "npm run build", "watch": "tsc -w --listEmittedFiles" }, + "dependencies": { + "@lumino/coreutils": "^1.4.0" + }, "devDependencies": { "rimraf": "~3.0.0", "typescript": "~3.7.3" diff --git a/packages/nbformat/src/index.ts b/packages/nbformat/src/index.ts index 215ca5d2e743..9e92b6098916 100644 --- a/packages/nbformat/src/index.ts +++ b/packages/nbformat/src/index.ts @@ -1,4 +1,525 @@ -/*----------------------------------------------------------------------------- -| Copyright (c) Jupyter Development Team. -| Distributed under the terms of the Modified BSD License. -|----------------------------------------------------------------------------*/ +// Copyright (c) Jupyter Development Team. +// Distributed under the terms of the Modified BSD License. + +// Notebook format interfaces +// https://nbformat.readthedocs.io/en/latest/format_description.html +// https://github.com/jupyter/nbformat/blob/master/nbformat/v4/nbformat.v4.schema.json + +import { PartialJSONObject, JSONExt } from '@lumino/coreutils'; + +/** + * The major version of the notebook format. + */ +export const MAJOR_VERSION: number = 4; + +/** + * The minor version of the notebook format. + */ +export const MINOR_VERSION: number = 4; + +/** + * The kernelspec metadata. + */ +export interface IKernelspecMetadata extends PartialJSONObject { + name: string; + display_name: string; +} + +/** + * The language info metatda + */ +export interface ILanguageInfoMetadata extends PartialJSONObject { + name: string; + codemirror_mode?: string | PartialJSONObject; + file_extension?: string; + mimetype?: string; + pygments_lexer?: string; +} + +/** + * The default metadata for the notebook. + */ +export interface INotebookMetadata extends PartialJSONObject { + kernelspec?: IKernelspecMetadata; + language_info?: ILanguageInfoMetadata; + orig_nbformat: number; +} + +/** + * The notebook content. + */ +export interface INotebookContent extends PartialJSONObject { + metadata: INotebookMetadata; + nbformat_minor: number; + nbformat: number; + cells: ICell[]; +} + +/** + * A multiline string. + */ +export type MultilineString = string | string[]; + +/** + * A mime-type keyed dictionary of data. + */ +export interface IMimeBundle extends PartialJSONObject { + [key: string]: MultilineString | PartialJSONObject; +} + +/** + * Media attachments (e.g. inline images). + */ +export interface IAttachments { + [key: string]: IMimeBundle | undefined; +} + +/** + * The code cell's prompt number. Will be null if the cell has not been run. + */ +export type ExecutionCount = number | null; + +/** + * Cell output metadata. + */ +export type OutputMetadata = PartialJSONObject; + +/** + * Validate a mime type/value pair. + * + * @param type - The mimetype name. + * + * @param value - The value associated with the type. + * + * @returns Whether the type/value pair are valid. + */ +export function validateMimeValue( + type: string, + value: MultilineString | PartialJSONObject +): boolean { + // Check if "application/json" or "application/foo+json" + const jsonTest = /^application\/(.*?)+\+json$/; + const isJSONType = type === 'application/json' || jsonTest.test(type); + + let isString = (x: any) => { + return Object.prototype.toString.call(x) === '[object String]'; + }; + + // If it is an array, make sure if is not a JSON type and it is an + // array of strings. + if (Array.isArray(value)) { + if (isJSONType) { + return false; + } + let valid = true; + (value as string[]).forEach(v => { + if (!isString(v)) { + valid = false; + } + }); + return valid; + } + + // If it is a string, make sure we are not a JSON type. + if (isString(value)) { + return !isJSONType; + } + + // It is not a string, make sure it is a JSON type. + if (!isJSONType) { + return false; + } + + // It is a JSON type, make sure it is a valid JSON object. + return JSONExt.isObject(value); +} + +/** + * A type which describes the type of cell. + */ +export type CellType = 'code' | 'markdown' | 'raw'; + +/** + * The Jupyter metadata namespace. + */ +export interface IBaseCellJupyterMetadata extends PartialJSONObject { + /** + * Whether the source is hidden. + */ + source_hidden: boolean; +} + +/** + * Cell-level metadata. + */ +export interface IBaseCellMetadata extends PartialJSONObject { + /** + * Whether the cell is trusted. + * + * #### Notes + * This is not strictly part of the nbformat spec, but it is added by + * the contents manager. + * + * See https://jupyter-notebook.readthedocs.io/en/latest/security.html. + */ + trusted: boolean; + + /** + * The cell's name. If present, must be a non-empty string. + */ + name: string; + + /** + * The Jupyter metadata namespace + */ + jupyter: Partial; + + /** + * The cell's tags. Tags must be unique, and must not contain commas. + */ + tags: string[]; +} + +/** + * The base cell interface. + */ +export interface IBaseCell extends PartialJSONObject { + /** + * String identifying the type of cell. + */ + cell_type: string; + + /** + * Contents of the cell, represented as an array of lines. + */ + source: MultilineString; + + /** + * Cell-level metadata. + */ + metadata: Partial; +} + +/** + * Metadata for the raw cell. + */ +export interface IRawCellMetadata extends IBaseCellMetadata { + /** + * Raw cell metadata format for nbconvert. + */ + format: string; +} + +/** + * A raw cell. + */ +export interface IRawCell extends IBaseCell { + /** + * String identifying the type of cell. + */ + cell_type: 'raw'; + + /** + * Cell-level metadata. + */ + metadata: Partial; + + /** + * Cell attachments. + */ + attachments?: IAttachments; +} + +/** + * A markdown cell. + */ +export interface IMarkdownCell extends IBaseCell { + /** + * String identifying the type of cell. + */ + cell_type: 'markdown'; + + /** + * Cell attachments. + */ + attachments?: IAttachments; +} + +/** + * The Jupyter metadata namespace for code cells. + */ +export interface ICodeCellJupyterMetadata extends IBaseCellJupyterMetadata { + /** + * Whether the outputs are hidden. See https://github.com/jupyter/nbformat/issues/137. + */ + outputs_hidden: boolean; +} + +/** + * Metadata for a code cell. + */ +export interface ICodeCellMetadata extends IBaseCellMetadata { + /** + * Whether the cell is collapsed/expanded. + */ + collapsed: boolean; + + /** + * The Jupyter metadata namespace + */ + jupyter: Partial; + + /** + * Whether the cell's output is scrolled, unscrolled, or autoscrolled. + */ + scrolled: boolean | 'auto'; +} + +/** + * A code cell. + */ +export interface ICodeCell extends IBaseCell { + /** + * String identifying the type of cell. + */ + cell_type: 'code'; + + /** + * Cell-level metadata. + */ + metadata: Partial; + + /** + * Execution, display, or stream outputs. + */ + outputs: IOutput[]; + + /** + * The code cell's prompt number. Will be null if the cell has not been run. + */ + execution_count: ExecutionCount; +} + +/** + * An unrecognized cell. + */ +export interface IUnrecognizedCell extends IBaseCell {} + +/** + * A cell union type. + */ +export type ICell = IRawCell | IMarkdownCell | ICodeCell | IUnrecognizedCell; + +/** + * Test whether a cell is a raw cell. + */ +export function isRaw(cell: ICell): cell is IRawCell { + return cell.cell_type === 'raw'; +} + +/** + * Test whether a cell is a markdown cell. + */ +export function isMarkdown(cell: ICell): cell is IMarkdownCell { + return cell.cell_type === 'markdown'; +} + +/** + * Test whether a cell is a code cell. + */ +export function isCode(cell: ICell): cell is ICodeCell { + return cell.cell_type === 'code'; +} + +/** + * A union metadata type. + */ +export type ICellMetadata = + | IBaseCellMetadata + | IRawCellMetadata + | ICodeCellMetadata; + +/** + * The valid output types. + */ +export type OutputType = + | 'execute_result' + | 'display_data' + | 'stream' + | 'error' + | 'update_display_data'; + +/** + * The base output type. + */ +export interface IBaseOutput extends PartialJSONObject { + /** + * Type of cell output. + */ + output_type: string; +} + +/** + * Result of executing a code cell. + */ +export interface IExecuteResult extends IBaseOutput { + /** + * Type of cell output. + */ + output_type: 'execute_result'; + + /** + * A result's prompt number. + */ + execution_count: ExecutionCount; + + /** + * A mime-type keyed dictionary of data. + */ + data: IMimeBundle; + + /** + * Cell output metadata. + */ + metadata: OutputMetadata; +} + +/** + * Data displayed as a result of code cell execution. + */ +export interface IDisplayData extends IBaseOutput { + /** + * Type of cell output. + */ + output_type: 'display_data'; + + /** + * A mime-type keyed dictionary of data. + */ + data: IMimeBundle; + + /** + * Cell output metadata. + */ + metadata: OutputMetadata; +} + +/** + * Data displayed as an update to existing display data. + */ +export interface IDisplayUpdate extends IBaseOutput { + /** + * Type of cell output. + */ + output_type: 'update_display_data'; + + /** + * A mime-type keyed dictionary of data. + */ + data: IMimeBundle; + + /** + * Cell output metadata. + */ + metadata: OutputMetadata; +} + +/** + * Stream output from a code cell. + */ +export interface IStream extends IBaseOutput { + /** + * Type of cell output. + */ + output_type: 'stream'; + + /** + * The name of the stream. + */ + name: StreamType; + + /** + * The stream's text output. + */ + text: MultilineString; +} + +/** + * An alias for a stream type. + */ +export type StreamType = 'stdout' | 'stderr'; + +/** + * Output of an error that occurred during code cell execution. + */ +export interface IError extends IBaseOutput { + /** + * Type of cell output. + */ + output_type: 'error'; + + /** + * The name of the error. + */ + ename: string; + + /** + * The value, or message, of the error. + */ + evalue: string; + + /** + * The error's traceback. + */ + traceback: string[]; +} + +/** + * Unrecognized output. + */ +export interface IUnrecognizedOutput extends IBaseOutput {} + +/** + * Test whether an output is an execute result. + */ +export function isExecuteResult(output: IOutput): output is IExecuteResult { + return output.output_type === 'execute_result'; +} + +/** + * Test whether an output is from display data. + */ +export function isDisplayData(output: IOutput): output is IDisplayData { + return output.output_type === 'display_data'; +} + +/** + * Test whether an output is from updated display data. + */ +export function isDisplayUpdate(output: IOutput): output is IDisplayUpdate { + return output.output_type === 'update_display_data'; +} + +/** + * Test whether an output is from a stream. + */ +export function isStream(output: IOutput): output is IStream { + return output.output_type === 'stream'; +} + +/** + * Test whether an output is an error. + */ +export function isError(output: IOutput): output is IError { + return output.output_type === 'error'; +} + +/** + * An output union type. + */ +export type IOutput = + | IUnrecognizedOutput + | IExecuteResult + | IDisplayData + | IStream + | IError; diff --git a/packages/notebook-extension/package.json b/packages/notebook-extension/package.json index b5e4ff22fabf..1a5cb6be998f 100644 --- a/packages/notebook-extension/package.json +++ b/packages/notebook-extension/package.json @@ -45,6 +45,7 @@ "@jupyterlab/filebrowser": "^2.0.0-alpha.4", "@jupyterlab/launcher": "^2.0.0-alpha.4", "@jupyterlab/mainmenu": "^2.0.0-alpha.4", + "@jupyterlab/nbformat": "^2.0.0-alpha.4", "@jupyterlab/notebook": "^2.0.0-alpha.4", "@jupyterlab/property-inspector": "^2.0.0-alpha.4", "@jupyterlab/rendermime": "^2.0.0-alpha.4", diff --git a/packages/notebook-extension/src/index.ts b/packages/notebook-extension/src/index.ts index 7e5a5fff7c1e..280f3681cb58 100644 --- a/packages/notebook-extension/src/index.ts +++ b/packages/notebook-extension/src/index.ts @@ -23,13 +23,14 @@ import { IEditorServices } from '@jupyterlab/codeeditor'; import { ISettingRegistry, IStateDB, - nbformat, PageConfig, URLExt } from '@jupyterlab/coreutils'; import { IDocumentManager } from '@jupyterlab/docmanager'; +import * as nbformat from '@jupyterlab/nbformat'; + import { ArrayExt } from '@lumino/algorithm'; import { diff --git a/packages/notebook-extension/tsconfig.json b/packages/notebook-extension/tsconfig.json index 3a5126da7f84..1c8586e7d959 100644 --- a/packages/notebook-extension/tsconfig.json +++ b/packages/notebook-extension/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../application" @@ -33,6 +35,9 @@ { "path": "../mainmenu" }, + { + "path": "../nbformat" + }, { "path": "../notebook" }, diff --git a/packages/notebook/package.json b/packages/notebook/package.json index 954a6cdf0f7a..9aa5c8ac6191 100644 --- a/packages/notebook/package.json +++ b/packages/notebook/package.json @@ -40,6 +40,7 @@ "@jupyterlab/codeeditor": "^2.0.0-alpha.4", "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/docregistry": "^2.0.0-alpha.4", + "@jupyterlab/nbformat": "^2.0.0-alpha.4", "@jupyterlab/observables": "^3.0.0-alpha.4", "@jupyterlab/rendermime": "^2.0.0-alpha.4", "@jupyterlab/services": "^5.0.0-alpha.4", diff --git a/packages/notebook/src/actions.tsx b/packages/notebook/src/actions.tsx index 42b2c536b661..aa20ff417e13 100644 --- a/packages/notebook/src/actions.tsx +++ b/packages/notebook/src/actions.tsx @@ -10,8 +10,6 @@ import { showDialog } from '@jupyterlab/apputils'; -import { nbformat } from '@jupyterlab/coreutils'; - import { ICellModel, ICodeCellModel, @@ -20,6 +18,8 @@ import { MarkdownCell } from '@jupyterlab/cells'; +import * as nbformat from '@jupyterlab/nbformat'; + import { ArrayExt, each, toArray } from '@lumino/algorithm'; import { JSONObject, JSONExt } from '@lumino/coreutils'; diff --git a/packages/notebook/src/default-toolbar.tsx b/packages/notebook/src/default-toolbar.tsx index 5efe86b7a116..32f6bb7af401 100644 --- a/packages/notebook/src/default-toolbar.tsx +++ b/packages/notebook/src/default-toolbar.tsx @@ -20,7 +20,7 @@ import { ToolbarButton } from '@jupyterlab/apputils'; -import { nbformat } from '@jupyterlab/coreutils'; +import * as nbformat from '@jupyterlab/nbformat'; import { HTMLSelect } from '@jupyterlab/ui-components'; diff --git a/packages/notebook/src/model.ts b/packages/notebook/src/model.ts index 29a069919a60..aa9b5fe4cba8 100644 --- a/packages/notebook/src/model.ts +++ b/packages/notebook/src/model.ts @@ -14,7 +14,7 @@ import { CellModel } from '@jupyterlab/cells'; -import { nbformat } from '@jupyterlab/coreutils'; +import * as nbformat from '@jupyterlab/nbformat'; import { UUID } from '@lumino/coreutils'; diff --git a/packages/notebook/src/notebooktools.ts b/packages/notebook/src/notebooktools.ts index f5c25ff869bf..6ce08b9cf020 100644 --- a/packages/notebook/src/notebooktools.ts +++ b/packages/notebook/src/notebooktools.ts @@ -24,7 +24,7 @@ import { JSONEditor } from '@jupyterlab/codeeditor'; -import { nbformat } from '@jupyterlab/coreutils'; +import * as nbformat from '@jupyterlab/nbformat'; import { IObservableMap, ObservableJSON } from '@jupyterlab/observables'; diff --git a/packages/notebook/src/widget.ts b/packages/notebook/src/widget.ts index 768233b26591..1013e229c7a5 100644 --- a/packages/notebook/src/widget.ts +++ b/packages/notebook/src/widget.ts @@ -32,7 +32,9 @@ import { import { IEditorMimeTypeService, CodeEditor } from '@jupyterlab/codeeditor'; -import { IChangedArgs, nbformat } from '@jupyterlab/coreutils'; +import { IChangedArgs } from '@jupyterlab/coreutils'; + +import * as nbformat from '@jupyterlab/nbformat'; import { IObservableMap, IObservableList } from '@jupyterlab/observables'; diff --git a/packages/notebook/tsconfig.json b/packages/notebook/tsconfig.json index 76cf38a985be..4bd0d442d252 100644 --- a/packages/notebook/tsconfig.json +++ b/packages/notebook/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../apputils" @@ -21,6 +23,9 @@ { "path": "../docregistry" }, + { + "path": "../nbformat" + }, { "path": "../observables" }, diff --git a/packages/outputarea/package.json b/packages/outputarea/package.json index 57dfea5a9d40..01b98b3c26db 100644 --- a/packages/outputarea/package.json +++ b/packages/outputarea/package.json @@ -36,7 +36,7 @@ }, "dependencies": { "@jupyterlab/apputils": "^2.0.0-alpha.4", - "@jupyterlab/coreutils": "^4.0.0-alpha.4", + "@jupyterlab/nbformat": "^2.0.0-alpha.4", "@jupyterlab/observables": "^3.0.0-alpha.4", "@jupyterlab/rendermime": "^2.0.0-alpha.4", "@jupyterlab/rendermime-interfaces": "^2.0.0-alpha.4", diff --git a/packages/outputarea/src/model.ts b/packages/outputarea/src/model.ts index 712ee4f06b5c..d8ea41e271e3 100644 --- a/packages/outputarea/src/model.ts +++ b/packages/outputarea/src/model.ts @@ -7,7 +7,7 @@ import { IDisposable } from '@lumino/disposable'; import { ISignal, Signal } from '@lumino/signaling'; -import { nbformat } from '@jupyterlab/coreutils'; +import * as nbformat from '@jupyterlab/nbformat'; import { IObservableList, ObservableList } from '@jupyterlab/observables'; diff --git a/packages/outputarea/src/widget.ts b/packages/outputarea/src/widget.ts index 84458c2fb53e..99d359d86856 100644 --- a/packages/outputarea/src/widget.ts +++ b/packages/outputarea/src/widget.ts @@ -20,7 +20,7 @@ import { Widget } from '@lumino/widgets'; import { ISessionContext } from '@jupyterlab/apputils'; -import { nbformat } from '@jupyterlab/coreutils'; +import * as nbformat from '@jupyterlab/nbformat'; import { IOutputModel, IRenderMimeRegistry } from '@jupyterlab/rendermime'; diff --git a/packages/outputarea/tsconfig.json b/packages/outputarea/tsconfig.json index 21861f5318cd..cb3f04be6b2d 100644 --- a/packages/outputarea/tsconfig.json +++ b/packages/outputarea/tsconfig.json @@ -4,13 +4,15 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../apputils" }, { - "path": "../coreutils" + "path": "../nbformat" }, { "path": "../observables" diff --git a/packages/rendermime/package.json b/packages/rendermime/package.json index d01102d3d5ff..ec22d41dd46a 100644 --- a/packages/rendermime/package.json +++ b/packages/rendermime/package.json @@ -38,6 +38,7 @@ "@jupyterlab/apputils": "^2.0.0-alpha.4", "@jupyterlab/codemirror": "^2.0.0-alpha.4", "@jupyterlab/coreutils": "^4.0.0-alpha.4", + "@jupyterlab/nbformat": "^2.0.0-alpha.4", "@jupyterlab/observables": "^3.0.0-alpha.4", "@jupyterlab/rendermime-interfaces": "^2.0.0-alpha.4", "@jupyterlab/services": "^5.0.0-alpha.4", diff --git a/packages/rendermime/src/attachmentmodel.ts b/packages/rendermime/src/attachmentmodel.ts index 0255172ab579..1441deac5c95 100644 --- a/packages/rendermime/src/attachmentmodel.ts +++ b/packages/rendermime/src/attachmentmodel.ts @@ -3,7 +3,7 @@ | Distributed under the terms of the Modified BSD License. |----------------------------------------------------------------------------*/ -import { nbformat } from '@jupyterlab/coreutils'; +import * as nbformat from '@jupyterlab/nbformat'; import { IObservableJSON, ObservableJSON } from '@jupyterlab/observables'; diff --git a/packages/rendermime/src/outputmodel.ts b/packages/rendermime/src/outputmodel.ts index c359175b5ac5..6bc92184ad74 100644 --- a/packages/rendermime/src/outputmodel.ts +++ b/packages/rendermime/src/outputmodel.ts @@ -13,7 +13,7 @@ import { import { ISignal, Signal } from '@lumino/signaling'; -import { nbformat } from '@jupyterlab/coreutils'; +import * as nbformat from '@jupyterlab/nbformat'; import { IObservableJSON, ObservableJSON } from '@jupyterlab/observables'; diff --git a/packages/rendermime/tsconfig.json b/packages/rendermime/tsconfig.json index 7498c987854d..1a7d15cf997e 100644 --- a/packages/rendermime/tsconfig.json +++ b/packages/rendermime/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../apputils" @@ -15,6 +17,9 @@ { "path": "../coreutils" }, + { + "path": "../nbformat" + }, { "path": "../observables" }, diff --git a/packages/services/package.json b/packages/services/package.json index 8aa0f9c9f84c..bd04a690be7a 100644 --- a/packages/services/package.json +++ b/packages/services/package.json @@ -42,6 +42,7 @@ }, "dependencies": { "@jupyterlab/coreutils": "^4.0.0-alpha.4", + "@jupyterlab/nbformat": "^2.0.0-alpha.4", "@jupyterlab/observables": "^3.0.0-alpha.4", "@lumino/algorithm": "^1.2.1", "@lumino/coreutils": "^1.4.0", diff --git a/packages/services/src/kernel/messages.ts b/packages/services/src/kernel/messages.ts index 6260d2f81fe9..128532d8a1b7 100644 --- a/packages/services/src/kernel/messages.ts +++ b/packages/services/src/kernel/messages.ts @@ -1,7 +1,7 @@ // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. -import { nbformat } from '@jupyterlab/coreutils'; +import * as nbformat from '@jupyterlab/nbformat'; import { UUID, JSONObject } from '@lumino/coreutils'; export interface IOptions { diff --git a/packages/services/tsconfig.json b/packages/services/tsconfig.json index 1c324ae71e11..bfd8accc29b1 100644 --- a/packages/services/tsconfig.json +++ b/packages/services/tsconfig.json @@ -4,13 +4,20 @@ "outDir": "lib", "rootDir": "src", "module": "commonjs", - "types": ["node"] + "types": [ + "node" + ] }, - "include": ["src/**/*"], + "include": [ + "src/**/*" + ], "references": [ { "path": "../coreutils" }, + { + "path": "../nbformat" + }, { "path": "../observables" } diff --git a/tests/test-cells/package.json b/tests/test-cells/package.json index 7b800da70a4e..62b679edfedf 100644 --- a/tests/test-cells/package.json +++ b/tests/test-cells/package.json @@ -16,6 +16,7 @@ "@jupyterlab/cells": "^2.0.0-alpha.4", "@jupyterlab/codeeditor": "^2.0.0-alpha.4", "@jupyterlab/coreutils": "^4.0.0-alpha.4", + "@jupyterlab/nbformat": "^2.0.0-alpha.4", "@jupyterlab/outputarea": "^2.0.0-alpha.4", "@jupyterlab/testutils": "^2.0.0-alpha.4", "@lumino/algorithm": "^1.2.1", diff --git a/tests/test-cells/src/model.spec.ts b/tests/test-cells/src/model.spec.ts index 1dd84b8f8713..7f706ff2d188 100644 --- a/tests/test-cells/src/model.spec.ts +++ b/tests/test-cells/src/model.spec.ts @@ -5,7 +5,7 @@ import { expect } from 'chai'; import { toArray } from '@lumino/algorithm'; -import { IChangedArgs, nbformat } from '@jupyterlab/coreutils'; +import { IChangedArgs } from '@jupyterlab/coreutils'; import { CellModel, @@ -14,6 +14,8 @@ import { CodeCellModel } from '@jupyterlab/cells'; +import * as nbformat from '@jupyterlab/nbformat'; + import { OutputAreaModel } from '@jupyterlab/outputarea'; import { NBTestUtils } from '@jupyterlab/testutils'; diff --git a/tests/test-cells/tsconfig.json b/tests/test-cells/tsconfig.json index 5a5aa6973bbc..7ba407f4ec14 100644 --- a/tests/test-cells/tsconfig.json +++ b/tests/test-cells/tsconfig.json @@ -2,11 +2,15 @@ "extends": "../../tsconfigbase", "compilerOptions": { "outDir": "build", - "types": ["jest"], + "types": [ + "jest" + ], "composite": false, "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../../packages/apputils" @@ -25,6 +29,9 @@ }, { "path": "../../testutils" + }, + { + "path": "../../packages/nbformat" } ] } diff --git a/tests/test-coreutils/package.json b/tests/test-coreutils/package.json index 9d3b263b9bd1..3c1380cab553 100644 --- a/tests/test-coreutils/package.json +++ b/tests/test-coreutils/package.json @@ -13,6 +13,7 @@ }, "dependencies": { "@jupyterlab/coreutils": "^4.0.0-alpha.4", + "@jupyterlab/nbformat": "^2.0.0-alpha.4", "@jupyterlab/testutils": "^2.0.0-alpha.4", "@lumino/coreutils": "^1.4.0", "@lumino/disposable": "^1.3.2", diff --git a/tests/test-coreutils/src/nbformat.spec.ts b/tests/test-coreutils/src/nbformat.spec.ts index 02f4a0b3c8fa..9baa335a734c 100644 --- a/tests/test-coreutils/src/nbformat.spec.ts +++ b/tests/test-coreutils/src/nbformat.spec.ts @@ -3,7 +3,7 @@ import { expect } from 'chai'; -import { nbformat } from '@jupyterlab/coreutils'; +import * as nbformat from '@jupyterlab/nbformat'; const VALIDATE = nbformat.validateMimeValue; diff --git a/tests/test-coreutils/tsconfig.json b/tests/test-coreutils/tsconfig.json index 0da3b93cba82..fdd3a10ced90 100644 --- a/tests/test-coreutils/tsconfig.json +++ b/tests/test-coreutils/tsconfig.json @@ -3,16 +3,23 @@ "compilerOptions": { "outDir": "build", "rootDir": "src", - "types": ["jest"], + "types": [ + "jest" + ], "composite": false }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../../packages/coreutils" }, { "path": "../../testutils" + }, + { + "path": "../../packages/nbformat" } ] } diff --git a/tests/test-notebook/package.json b/tests/test-notebook/package.json index cd162308d065..03bbfa4035d0 100644 --- a/tests/test-notebook/package.json +++ b/tests/test-notebook/package.json @@ -23,6 +23,7 @@ "@jupyterlab/codemirror": "^2.0.0-alpha.4", "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/docregistry": "^2.0.0-alpha.4", + "@jupyterlab/nbformat": "^2.0.0-alpha.4", "@jupyterlab/notebook": "^2.0.0-alpha.4", "@jupyterlab/observables": "^3.0.0-alpha.4", "@jupyterlab/testutils": "^2.0.0-alpha.4", diff --git a/tests/test-notebook/src/model.spec.ts b/tests/test-notebook/src/model.spec.ts index 8fa8d0b52caf..0cbb3a344222 100644 --- a/tests/test-notebook/src/model.spec.ts +++ b/tests/test-notebook/src/model.spec.ts @@ -7,7 +7,7 @@ import { ArrayExt, toArray } from '@lumino/algorithm'; import { CodeCellModel } from '@jupyterlab/cells'; -import { nbformat } from '@jupyterlab/coreutils'; +import * as nbformat from '@jupyterlab/nbformat'; import { NotebookModel } from '@jupyterlab/notebook'; diff --git a/tests/test-notebook/tsconfig.json b/tests/test-notebook/tsconfig.json index adfa285aca74..4c953989594c 100644 --- a/tests/test-notebook/tsconfig.json +++ b/tests/test-notebook/tsconfig.json @@ -2,11 +2,15 @@ "extends": "../../tsconfigbase", "compilerOptions": { "outDir": "build", - "types": ["mocha"], + "types": [ + "mocha" + ], "composite": false, "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../../packages/apputils" @@ -31,6 +35,9 @@ }, { "path": "../../testutils" + }, + { + "path": "../../packages/nbformat" } ] } diff --git a/tests/test-rendermime/package.json b/tests/test-rendermime/package.json index 3bd1815693e7..0d31a09d5a10 100644 --- a/tests/test-rendermime/package.json +++ b/tests/test-rendermime/package.json @@ -19,6 +19,7 @@ "@jupyterlab/apputils": "^2.0.0-alpha.4", "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/mathjax2": "^2.0.0-alpha.4", + "@jupyterlab/nbformat": "^2.0.0-alpha.4", "@jupyterlab/rendermime": "^2.0.0-alpha.4", "@jupyterlab/services": "^5.0.0-alpha.4", "@jupyterlab/testutils": "^2.0.0-alpha.4", diff --git a/tests/test-rendermime/src/outputmodel.spec.ts b/tests/test-rendermime/src/outputmodel.spec.ts index e42955eaa3b1..5e23f8d1f745 100644 --- a/tests/test-rendermime/src/outputmodel.spec.ts +++ b/tests/test-rendermime/src/outputmodel.spec.ts @@ -3,7 +3,7 @@ import { expect } from 'chai'; -import { nbformat } from '@jupyterlab/coreutils'; +import * as nbformat from '@jupyterlab/nbformat'; import { OutputModel } from '@jupyterlab/rendermime'; diff --git a/tests/test-rendermime/tsconfig.json b/tests/test-rendermime/tsconfig.json index 0b934738dead..aaf617ae5db6 100644 --- a/tests/test-rendermime/tsconfig.json +++ b/tests/test-rendermime/tsconfig.json @@ -2,11 +2,16 @@ "extends": "../../tsconfigbase", "compilerOptions": { "outDir": "build", - "types": ["mocha", "node"], + "types": [ + "mocha", + "node" + ], "composite": false, "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../../packages/apputils" @@ -25,6 +30,9 @@ }, { "path": "../../testutils" + }, + { + "path": "../../packages/nbformat" } ] } diff --git a/testutils/package.json b/testutils/package.json index 88315f47a595..8e3dfa8ecf44 100644 --- a/testutils/package.json +++ b/testutils/package.json @@ -37,6 +37,7 @@ "@jupyterlab/codemirror": "^2.0.0-alpha.4", "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/docregistry": "^2.0.0-alpha.4", + "@jupyterlab/nbformat": "^2.0.0-alpha.4", "@jupyterlab/notebook": "^2.0.0-alpha.4", "@jupyterlab/rendermime": "^2.0.0-alpha.4", "@jupyterlab/services": "^5.0.0-alpha.4", diff --git a/testutils/src/notebook-utils.ts b/testutils/src/notebook-utils.ts index a885623edcad..e6e8e9b5a4dc 100644 --- a/testutils/src/notebook-utils.ts +++ b/testutils/src/notebook-utils.ts @@ -7,7 +7,7 @@ import { CodeEditorWrapper } from '@jupyterlab/codeeditor'; import { Clipboard } from '@jupyterlab/apputils'; -import { nbformat } from '@jupyterlab/coreutils'; +import * as nbformat from '@jupyterlab/nbformat'; import { Context } from '@jupyterlab/docregistry'; diff --git a/testutils/tsconfig.json b/testutils/tsconfig.json index 6f436a47fe03..8453f446784c 100644 --- a/testutils/tsconfig.json +++ b/testutils/tsconfig.json @@ -4,9 +4,13 @@ "outDir": "lib", "rootDir": "src", "module": "commonjs", - "types": ["node"] + "types": [ + "node" + ] }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../packages/apputils" @@ -34,6 +38,9 @@ }, { "path": "../packages/services" + }, + { + "path": "../packages/nbformat" } ] } From 28492f24a0143a5014accecb56195b8599c2da64 Mon Sep 17 00:00:00 2001 From: Vidar Tonaas Fauske Date: Sun, 22 Dec 2019 13:48:48 +0000 Subject: [PATCH 03/13] Create package settingsregistry --- dev_mode/package.json | 2 + packages/logconsole-extension/tsconfig.json | 6 +-- packages/metapackage/package.json | 1 + packages/metapackage/tsconfig.json | 3 ++ packages/settingsregistry/package.json | 41 +++++++++++++++++++++ packages/settingsregistry/src/index.ts | 4 ++ packages/settingsregistry/tsconfig.json | 8 ++++ tests/test-cells/tsconfig.json | 6 +-- tests/test-coreutils/tsconfig.json | 4 +- tests/test-notebook/tsconfig.json | 6 +-- tests/test-rendermime/tsconfig.json | 6 +-- testutils/tsconfig.json | 6 +-- 12 files changed, 76 insertions(+), 17 deletions(-) create mode 100644 packages/settingsregistry/package.json create mode 100644 packages/settingsregistry/src/index.ts create mode 100644 packages/settingsregistry/tsconfig.json diff --git a/dev_mode/package.json b/dev_mode/package.json index 15c3acbe9014..30fe86c31cc5 100644 --- a/dev_mode/package.json +++ b/dev_mode/package.json @@ -153,6 +153,7 @@ "@jupyterlab/services": "~5.0.0-alpha.4", "@jupyterlab/settingeditor": "~2.0.0-alpha.4", "@jupyterlab/settingeditor-extension": "~2.0.0-alpha.4", + "@jupyterlab/settingsregistry": "~2.0.0-alpha.4", "@jupyterlab/shortcuts-extension": "~2.0.0-alpha.4", "@jupyterlab/statusbar": "~2.0.0-alpha.4", "@jupyterlab/statusbar-extension": "~2.0.0-alpha.4", @@ -340,6 +341,7 @@ "@jupyterlab/services": "../packages/services", "@jupyterlab/settingeditor": "../packages/settingeditor", "@jupyterlab/settingeditor-extension": "../packages/settingeditor-extension", + "@jupyterlab/settingsregistry": "../packages/settingsregistry", "@jupyterlab/shortcuts-extension": "../packages/shortcuts-extension", "@jupyterlab/statusbar": "../packages/statusbar", "@jupyterlab/statusbar-extension": "../packages/statusbar-extension", diff --git a/packages/logconsole-extension/tsconfig.json b/packages/logconsole-extension/tsconfig.json index 5eb0a6abf0ac..b46accdf3f8a 100644 --- a/packages/logconsole-extension/tsconfig.json +++ b/packages/logconsole-extension/tsconfig.json @@ -24,6 +24,9 @@ { "path": "../mainmenu" }, + { + "path": "../nbformat" + }, { "path": "../notebook" }, @@ -38,9 +41,6 @@ }, { "path": "../ui-components" - }, - { - "path": "../nbformat" } ] } diff --git a/packages/metapackage/package.json b/packages/metapackage/package.json index b444b62805e7..42f2f43aa3b0 100644 --- a/packages/metapackage/package.json +++ b/packages/metapackage/package.json @@ -96,6 +96,7 @@ "@jupyterlab/services": "^5.0.0-alpha.4", "@jupyterlab/settingeditor": "^2.0.0-alpha.4", "@jupyterlab/settingeditor-extension": "^2.0.0-alpha.4", + "@jupyterlab/settingsregistry": "^2.0.0-alpha.4", "@jupyterlab/shortcuts-extension": "^2.0.0-alpha.4", "@jupyterlab/statusbar": "^2.0.0-alpha.4", "@jupyterlab/statusbar-extension": "^2.0.0-alpha.4", diff --git a/packages/metapackage/tsconfig.json b/packages/metapackage/tsconfig.json index 53bbaa710318..4bda76c37511 100644 --- a/packages/metapackage/tsconfig.json +++ b/packages/metapackage/tsconfig.json @@ -244,6 +244,9 @@ }, { "path": "../vega5-extension" + }, + { + "path": "../settingsregistry" } ] } diff --git a/packages/settingsregistry/package.json b/packages/settingsregistry/package.json new file mode 100644 index 000000000000..ff2f40a69646 --- /dev/null +++ b/packages/settingsregistry/package.json @@ -0,0 +1,41 @@ +{ + "name": "@jupyterlab/settingsregistry", + "version": "2.0.0-alpha.4", + "description": "Settings registry for Jupyterlab", + "homepage": "https://github.com/jupyterlab/jupyterlab", + "bugs": { + "url": "https://github.com/jupyterlab/jupyterlab/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/jupyterlab/jupyterlab.git" + }, + "license": "BSD-3-Clause", + "author": "Project Jupyter", + "files": [ + "lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}", + "schema/*.json", + "style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}" + ], + "sideEffects": [ + "style/**/*" + ], + "main": "lib/index.js", + "types": "lib/index.d.ts", + "directories": { + "lib": "lib/" + }, + "scripts": { + "build": "tsc", + "clean": "rimraf lib", + "prepublishOnly": "npm run build", + "watch": "tsc -w --listEmittedFiles" + }, + "devDependencies": { + "rimraf": "~3.0.0", + "typescript": "~3.7.3" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/settingsregistry/src/index.ts b/packages/settingsregistry/src/index.ts new file mode 100644 index 000000000000..215ca5d2e743 --- /dev/null +++ b/packages/settingsregistry/src/index.ts @@ -0,0 +1,4 @@ +/*----------------------------------------------------------------------------- +| Copyright (c) Jupyter Development Team. +| Distributed under the terms of the Modified BSD License. +|----------------------------------------------------------------------------*/ diff --git a/packages/settingsregistry/tsconfig.json b/packages/settingsregistry/tsconfig.json new file mode 100644 index 000000000000..a1e4ba13c4bc --- /dev/null +++ b/packages/settingsregistry/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfigbase", + "compilerOptions": { + "outDir": "lib", + "rootDir": "src" + }, + "include": ["src/*"] +} diff --git a/tests/test-cells/tsconfig.json b/tests/test-cells/tsconfig.json index 7ba407f4ec14..4b90f07baedb 100644 --- a/tests/test-cells/tsconfig.json +++ b/tests/test-cells/tsconfig.json @@ -25,13 +25,13 @@ "path": "../../packages/coreutils" }, { - "path": "../../packages/outputarea" + "path": "../../packages/nbformat" }, { - "path": "../../testutils" + "path": "../../packages/outputarea" }, { - "path": "../../packages/nbformat" + "path": "../../testutils" } ] } diff --git a/tests/test-coreutils/tsconfig.json b/tests/test-coreutils/tsconfig.json index fdd3a10ced90..36b19fd90846 100644 --- a/tests/test-coreutils/tsconfig.json +++ b/tests/test-coreutils/tsconfig.json @@ -16,10 +16,10 @@ "path": "../../packages/coreutils" }, { - "path": "../../testutils" + "path": "../../packages/nbformat" }, { - "path": "../../packages/nbformat" + "path": "../../testutils" } ] } diff --git a/tests/test-notebook/tsconfig.json b/tests/test-notebook/tsconfig.json index 4c953989594c..cfedc8d9ce4e 100644 --- a/tests/test-notebook/tsconfig.json +++ b/tests/test-notebook/tsconfig.json @@ -27,6 +27,9 @@ { "path": "../../packages/docregistry" }, + { + "path": "../../packages/nbformat" + }, { "path": "../../packages/notebook" }, @@ -35,9 +38,6 @@ }, { "path": "../../testutils" - }, - { - "path": "../../packages/nbformat" } ] } diff --git a/tests/test-rendermime/tsconfig.json b/tests/test-rendermime/tsconfig.json index aaf617ae5db6..8022e883cf31 100644 --- a/tests/test-rendermime/tsconfig.json +++ b/tests/test-rendermime/tsconfig.json @@ -22,6 +22,9 @@ { "path": "../../packages/mathjax2" }, + { + "path": "../../packages/nbformat" + }, { "path": "../../packages/rendermime" }, @@ -30,9 +33,6 @@ }, { "path": "../../testutils" - }, - { - "path": "../../packages/nbformat" } ] } diff --git a/testutils/tsconfig.json b/testutils/tsconfig.json index 8453f446784c..e547be308687 100644 --- a/testutils/tsconfig.json +++ b/testutils/tsconfig.json @@ -30,6 +30,9 @@ { "path": "../packages/docregistry" }, + { + "path": "../packages/nbformat" + }, { "path": "../packages/notebook" }, @@ -38,9 +41,6 @@ }, { "path": "../packages/services" - }, - { - "path": "../packages/nbformat" } ] } From df1a3dd1088579554086fa24ceb205de18eff708 Mon Sep 17 00:00:00 2001 From: Vidar Tonaas Fauske Date: Sun, 22 Dec 2019 14:23:56 +0000 Subject: [PATCH 04/13] Some cleanup after package creation --- packages/nbformat/package.json | 7 ++++--- packages/settingsregistry/package.json | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/nbformat/package.json b/packages/nbformat/package.json index bfc4fc0d5cc7..b2fe023048c0 100644 --- a/packages/nbformat/package.json +++ b/packages/nbformat/package.json @@ -26,10 +26,11 @@ "lib": "lib/" }, "scripts": { - "build": "tsc", - "clean": "rimraf lib", + "build": "tsc -b", + "clean": "rimraf lib && rimraf tsconfig.tsbuildinfo", + "docs": "typedoc src --tsconfig typedoc-tsconfig.json", "prepublishOnly": "npm run build", - "watch": "tsc -w --listEmittedFiles" + "watch": "tsc -b -w --listEmittedFiles" }, "dependencies": { "@lumino/coreutils": "^1.4.0" diff --git a/packages/settingsregistry/package.json b/packages/settingsregistry/package.json index ff2f40a69646..fabb2d5d6196 100644 --- a/packages/settingsregistry/package.json +++ b/packages/settingsregistry/package.json @@ -26,10 +26,11 @@ "lib": "lib/" }, "scripts": { - "build": "tsc", - "clean": "rimraf lib", + "build": "tsc -b", + "clean": "rimraf lib && rimraf tsconfig.tsbuildinfo", + "docs": "typedoc src --tsconfig typedoc-tsconfig.json", "prepublishOnly": "npm run build", - "watch": "tsc -w --listEmittedFiles" + "watch": "tsc -b -w --listEmittedFiles" }, "devDependencies": { "rimraf": "~3.0.0", From 1a9c264edceb851ef727c332b3fb4845ca84223b Mon Sep 17 00:00:00 2001 From: Vidar Tonaas Fauske Date: Sun, 22 Dec 2019 14:35:23 +0000 Subject: [PATCH 05/13] Rename --- .../package.json | 14 ++++++++++---- .../src/index.ts | 3 +++ packages/settingregistry/tsconfig.json | 18 ++++++++++++++++++ packages/settingsregistry/tsconfig.json | 8 -------- 4 files changed, 31 insertions(+), 12 deletions(-) rename packages/{settingsregistry => settingregistry}/package.json (78%) rename packages/{settingsregistry => settingregistry}/src/index.ts (80%) create mode 100644 packages/settingregistry/tsconfig.json delete mode 100644 packages/settingsregistry/tsconfig.json diff --git a/packages/settingsregistry/package.json b/packages/settingregistry/package.json similarity index 78% rename from packages/settingsregistry/package.json rename to packages/settingregistry/package.json index fabb2d5d6196..54fe37180d9b 100644 --- a/packages/settingsregistry/package.json +++ b/packages/settingregistry/package.json @@ -1,5 +1,5 @@ { - "name": "@jupyterlab/settingsregistry", + "name": "@jupyterlab/settingregistry", "version": "2.0.0-alpha.4", "description": "Settings registry for Jupyterlab", "homepage": "https://github.com/jupyterlab/jupyterlab", @@ -17,9 +17,7 @@ "schema/*.json", "style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}" ], - "sideEffects": [ - "style/**/*" - ], + "sideEffects": false, "main": "lib/index.js", "types": "lib/index.d.ts", "directories": { @@ -32,6 +30,14 @@ "prepublishOnly": "npm run build", "watch": "tsc -b -w --listEmittedFiles" }, + "dependencies": { + "@jupyterlab/coreutils": "^4.0.0-alpha.4", + "@lumino/coreutils": "^1.4.0", + "@lumino/disposable": "^1.3.2", + "@lumino/signaling": "^1.3.2", + "ajv": "^6.10.2", + "json5": "^2.1.1" + }, "devDependencies": { "rimraf": "~3.0.0", "typescript": "~3.7.3" diff --git a/packages/settingsregistry/src/index.ts b/packages/settingregistry/src/index.ts similarity index 80% rename from packages/settingsregistry/src/index.ts rename to packages/settingregistry/src/index.ts index 215ca5d2e743..b064a1c831a1 100644 --- a/packages/settingsregistry/src/index.ts +++ b/packages/settingregistry/src/index.ts @@ -2,3 +2,6 @@ | Copyright (c) Jupyter Development Team. | Distributed under the terms of the Modified BSD License. |----------------------------------------------------------------------------*/ + +export * from './settingregistry'; +export * from './tokens'; diff --git a/packages/settingregistry/tsconfig.json b/packages/settingregistry/tsconfig.json new file mode 100644 index 000000000000..8591e8ba00e7 --- /dev/null +++ b/packages/settingregistry/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../../tsconfigbase", + "compilerOptions": { + "outDir": "lib", + "rootDir": "src" + }, + "files": [ + "src/plugin-schema.json" + ], + "include": [ + "src/*" + ], + "references": [ + { + "path": "../coreutils" + } + ] +} diff --git a/packages/settingsregistry/tsconfig.json b/packages/settingsregistry/tsconfig.json deleted file mode 100644 index a1e4ba13c4bc..000000000000 --- a/packages/settingsregistry/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfigbase", - "compilerOptions": { - "outDir": "lib", - "rootDir": "src" - }, - "include": ["src/*"] -} From f242de7385fb04972f861d994c74d90a70d69340 Mon Sep 17 00:00:00 2001 From: Vidar Tonaas Fauske Date: Sun, 22 Dec 2019 14:54:55 +0000 Subject: [PATCH 06/13] settingregistry package + tests --- dev_mode/package.json | 6 +- packages/application-extension/package.json | 1 + packages/application-extension/src/index.tsx | 9 +- packages/application-extension/tsconfig.json | 7 +- packages/apputils-extension/package.json | 1 + .../src/settingconnector.ts | 3 +- .../apputils-extension/src/settingsplugin.ts | 10 +- .../apputils-extension/src/themeplugins.ts | 4 +- packages/apputils-extension/tsconfig.json | 7 +- packages/apputils/package.json | 1 + packages/apputils/src/thememanager.ts | 4 +- packages/apputils/tsconfig.json | 7 +- packages/codemirror-extension/package.json | 2 +- packages/codemirror-extension/src/index.ts | 4 +- packages/codemirror-extension/tsconfig.json | 10 +- packages/console-extension/package.json | 1 + packages/console-extension/src/index.ts | 4 +- packages/console-extension/tsconfig.json | 7 +- packages/coreutils/package.json | 2 - packages/coreutils/src/index.ts | 1 - packages/coreutils/src/tokens.ts | 456 +---------------- packages/coreutils/tsconfig.json | 1 - packages/docmanager-extension/package.json | 1 + packages/docmanager-extension/src/index.ts | 4 +- packages/docmanager-extension/tsconfig.json | 7 +- .../extensionmanager-extension/package.json | 4 +- .../extensionmanager-extension/src/index.ts | 4 +- .../extensionmanager-extension/tsconfig.json | 10 +- packages/filebrowser-extension/package.json | 1 + packages/filebrowser-extension/src/index.ts | 10 +- packages/filebrowser-extension/tsconfig.json | 7 +- packages/fileeditor-extension/package.json | 1 + packages/fileeditor-extension/src/commands.ts | 8 +- packages/fileeditor-extension/src/index.ts | 4 +- packages/fileeditor-extension/tsconfig.json | 7 +- packages/logconsole-extension/package.json | 1 + packages/logconsole-extension/src/index.tsx | 4 +- packages/logconsole-extension/tsconfig.json | 3 + .../markdownviewer-extension/package.json | 4 +- .../markdownviewer-extension/src/index.ts | 14 +- .../markdownviewer-extension/tsconfig.json | 10 +- packages/metapackage/package.json | 2 +- packages/metapackage/tsconfig.json | 6 +- packages/notebook-extension/package.json | 1 + packages/notebook-extension/src/index.ts | 9 +- packages/notebook-extension/tsconfig.json | 3 + packages/services/package.json | 1 + packages/services/src/setting/index.ts | 4 +- packages/services/tsconfig.json | 3 + packages/settingeditor-extension/package.json | 3 +- packages/settingeditor-extension/src/index.ts | 4 +- .../settingeditor-extension/tsconfig.json | 7 +- packages/settingeditor/package.json | 1 + packages/settingeditor/src/inspector.ts | 4 +- packages/settingeditor/src/plugineditor.ts | 4 +- packages/settingeditor/src/pluginlist.tsx | 2 +- packages/settingeditor/src/raweditor.ts | 4 +- packages/settingeditor/src/settingeditor.tsx | 4 +- packages/settingeditor/tsconfig.json | 7 +- .../src/plugin-schema.json | 0 .../src/settingregistry.ts | 2 +- packages/settingregistry/src/tokens.ts | 463 ++++++++++++++++++ packages/shortcuts-extension/package.json | 2 +- packages/shortcuts-extension/src/index.ts | 5 +- packages/shortcuts-extension/tsconfig.json | 6 +- packages/statusbar-extension/package.json | 2 +- packages/statusbar-extension/src/index.ts | 4 +- packages/statusbar-extension/tsconfig.json | 10 +- packages/terminal-extension/package.json | 2 +- packages/terminal-extension/src/index.ts | 4 +- packages/terminal-extension/tsconfig.json | 14 +- tests/test-coreutils/package.json | 1 - tests/test-coreutils/src/nbformat.spec.ts | 38 -- tests/test-coreutils/tsconfig.json | 3 - tests/test-nbformat/babel.config.js | 1 + tests/test-nbformat/jest.config.js | 2 + tests/test-nbformat/package.json | 27 + tests/test-nbformat/run.py | 8 + tests/test-nbformat/src/nbformat.spec.ts | 36 ++ tests/test-nbformat/tsconfig.json | 19 + tests/test-notebook/package.json | 1 - tests/test-notebook/tsconfig.json | 3 - tests/test-settingregistry/babel.config.js | 1 + tests/test-settingregistry/jest.config.js | 2 + tests/test-settingregistry/package.json | 30 ++ tests/test-settingregistry/run.py | 8 + .../src/settingregistry.spec.ts | 9 +- tests/test-settingregistry/tsconfig.json | 25 + testutils/package.json | 1 - testutils/tsconfig.json | 3 - 90 files changed, 831 insertions(+), 622 deletions(-) rename packages/{coreutils => settingregistry}/src/plugin-schema.json (100%) rename packages/{coreutils => settingregistry}/src/settingregistry.ts (99%) create mode 100644 packages/settingregistry/src/tokens.ts delete mode 100644 tests/test-coreutils/src/nbformat.spec.ts create mode 100644 tests/test-nbformat/babel.config.js create mode 100644 tests/test-nbformat/jest.config.js create mode 100644 tests/test-nbformat/package.json create mode 100644 tests/test-nbformat/run.py create mode 100644 tests/test-nbformat/src/nbformat.spec.ts create mode 100644 tests/test-nbformat/tsconfig.json create mode 100644 tests/test-settingregistry/babel.config.js create mode 100644 tests/test-settingregistry/jest.config.js create mode 100644 tests/test-settingregistry/package.json create mode 100644 tests/test-settingregistry/run.py rename tests/{test-coreutils => test-settingregistry}/src/settingregistry.spec.ts (99%) create mode 100644 tests/test-settingregistry/tsconfig.json diff --git a/dev_mode/package.json b/dev_mode/package.json index 30fe86c31cc5..e3059a30c678 100644 --- a/dev_mode/package.json +++ b/dev_mode/package.json @@ -153,7 +153,7 @@ "@jupyterlab/services": "~5.0.0-alpha.4", "@jupyterlab/settingeditor": "~2.0.0-alpha.4", "@jupyterlab/settingeditor-extension": "~2.0.0-alpha.4", - "@jupyterlab/settingsregistry": "~2.0.0-alpha.4", + "@jupyterlab/settingregistry": "~2.0.0-alpha.4", "@jupyterlab/shortcuts-extension": "~2.0.0-alpha.4", "@jupyterlab/statusbar": "~2.0.0-alpha.4", "@jupyterlab/statusbar-extension": "~2.0.0-alpha.4", @@ -341,7 +341,7 @@ "@jupyterlab/services": "../packages/services", "@jupyterlab/settingeditor": "../packages/settingeditor", "@jupyterlab/settingeditor-extension": "../packages/settingeditor-extension", - "@jupyterlab/settingsregistry": "../packages/settingsregistry", + "@jupyterlab/settingregistry": "../packages/settingregistry", "@jupyterlab/shortcuts-extension": "../packages/shortcuts-extension", "@jupyterlab/statusbar": "../packages/statusbar", "@jupyterlab/statusbar-extension": "../packages/statusbar-extension", @@ -381,11 +381,13 @@ "@jupyterlab/test-inspector": "../tests/test-inspector", "@jupyterlab/test-logconsole": "../tests/test-logconsole", "@jupyterlab/test-mainmenu": "../tests/test-mainmenu", + "@jupyterlab/test-nbformat": "../tests/test-nbformat", "@jupyterlab/test-notebook": "../tests/test-notebook", "@jupyterlab/test-observables": "../tests/test-observables", "@jupyterlab/test-outputarea": "../tests/test-outputarea", "@jupyterlab/test-rendermime": "../tests/test-rendermime", "@jupyterlab/test-services": "../tests/test-services", + "@jupyterlab/test-settingregistry": "../tests/test-settingregistry", "@jupyterlab/test-statusbar": "../tests/test-statusbar", "@jupyterlab/test-terminal": "../tests/test-terminal", "@jupyterlab/testutils": "../testutils", diff --git a/packages/application-extension/package.json b/packages/application-extension/package.json index 660f5d7d7f21..d6b52d4d0c4f 100644 --- a/packages/application-extension/package.json +++ b/packages/application-extension/package.json @@ -40,6 +40,7 @@ "@jupyterlab/apputils": "^2.0.0-alpha.4", "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/property-inspector": "^2.0.0-alpha.4", + "@jupyterlab/settingregistry": "^2.0.0-alpha.4", "@lumino/algorithm": "^1.2.1", "@lumino/coreutils": "^1.4.0", "@lumino/disposable": "^1.3.2", diff --git a/packages/application-extension/src/index.tsx b/packages/application-extension/src/index.tsx index 26387a794e1f..1dea06d5b112 100644 --- a/packages/application-extension/src/index.tsx +++ b/packages/application-extension/src/index.tsx @@ -24,12 +24,9 @@ import { showErrorMessage } from '@jupyterlab/apputils'; -import { - PathExt, - IStateDB, - ISettingRegistry, - URLExt -} from '@jupyterlab/coreutils'; +import { PathExt, IStateDB, URLExt } from '@jupyterlab/coreutils'; + +import { ISettingRegistry } from '@jupyterlab/settingregistry'; import { IPropertyInspectorProvider, diff --git a/packages/application-extension/tsconfig.json b/packages/application-extension/tsconfig.json index 12c04cc94302..2d5c2258ec76 100644 --- a/packages/application-extension/tsconfig.json +++ b/packages/application-extension/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../application" @@ -17,6 +19,9 @@ }, { "path": "../property-inspector" + }, + { + "path": "../settingregistry" } ] } diff --git a/packages/apputils-extension/package.json b/packages/apputils-extension/package.json index 16918942fabd..a39e258df909 100644 --- a/packages/apputils-extension/package.json +++ b/packages/apputils-extension/package.json @@ -41,6 +41,7 @@ "@jupyterlab/apputils": "^2.0.0-alpha.4", "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/mainmenu": "^2.0.0-alpha.4", + "@jupyterlab/settingregistry": "^2.0.0-alpha.4", "@jupyterlab/ui-components": "^2.0.0-alpha.4", "@lumino/algorithm": "^1.2.1", "@lumino/commands": "^1.9.0", diff --git a/packages/apputils-extension/src/settingconnector.ts b/packages/apputils-extension/src/settingconnector.ts index 4fd7eb4553d3..1011b3d485c8 100644 --- a/packages/apputils-extension/src/settingconnector.ts +++ b/packages/apputils-extension/src/settingconnector.ts @@ -1,10 +1,11 @@ import { DataConnector, IDataConnector, - ISettingRegistry, PageConfig } from '@jupyterlab/coreutils'; +import { ISettingRegistry } from '@jupyterlab/settingregistry'; + /** * A data connector for fetching settings. * diff --git a/packages/apputils-extension/src/settingsplugin.ts b/packages/apputils-extension/src/settingsplugin.ts index dab9d4b80c9c..b43ee359e429 100644 --- a/packages/apputils-extension/src/settingsplugin.ts +++ b/packages/apputils-extension/src/settingsplugin.ts @@ -7,11 +7,13 @@ import { JupyterFrontEnd, JupyterFrontEndPlugin } from '@jupyterlab/application'; + +import { PageConfig } from '@jupyterlab/coreutils'; + import { - ISettingRegistry, - PageConfig, - SettingRegistry -} from '@jupyterlab/coreutils'; + SettingRegistry, + ISettingRegistry +} from '@jupyterlab/settingregistry'; import { SettingConnector } from './settingconnector'; diff --git a/packages/apputils-extension/src/themeplugins.ts b/packages/apputils-extension/src/themeplugins.ts index 3d5a4e0782de..e1d434caebe0 100644 --- a/packages/apputils-extension/src/themeplugins.ts +++ b/packages/apputils-extension/src/themeplugins.ts @@ -15,10 +15,12 @@ import { ThemeManager } from '@jupyterlab/apputils'; -import { ISettingRegistry, URLExt } from '@jupyterlab/coreutils'; +import { URLExt } from '@jupyterlab/coreutils'; import { IMainMenu } from '@jupyterlab/mainmenu'; +import { ISettingRegistry } from '@jupyterlab/settingregistry'; + import { Menu } from '@lumino/widgets'; namespace CommandIDs { diff --git a/packages/apputils-extension/tsconfig.json b/packages/apputils-extension/tsconfig.json index 298728e8d135..985f9f999bc2 100644 --- a/packages/apputils-extension/tsconfig.json +++ b/packages/apputils-extension/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../application" @@ -18,6 +20,9 @@ { "path": "../mainmenu" }, + { + "path": "../settingregistry" + }, { "path": "../ui-components" } diff --git a/packages/apputils/package.json b/packages/apputils/package.json index 89eee2386de9..e2990f7bf56b 100644 --- a/packages/apputils/package.json +++ b/packages/apputils/package.json @@ -37,6 +37,7 @@ "dependencies": { "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/services": "^5.0.0-alpha.4", + "@jupyterlab/settingregistry": "^2.0.0-alpha.4", "@jupyterlab/ui-components": "^2.0.0-alpha.4", "@lumino/algorithm": "^1.2.1", "@lumino/commands": "^1.9.0", diff --git a/packages/apputils/src/thememanager.ts b/packages/apputils/src/thememanager.ts index 327cc6894f09..1d2ee18a7970 100644 --- a/packages/apputils/src/thememanager.ts +++ b/packages/apputils/src/thememanager.ts @@ -1,7 +1,9 @@ // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. -import { IChangedArgs, ISettingRegistry, URLExt } from '@jupyterlab/coreutils'; +import { IChangedArgs, URLExt } from '@jupyterlab/coreutils'; + +import { ISettingRegistry } from '@jupyterlab/settingregistry'; import { each } from '@lumino/algorithm'; diff --git a/packages/apputils/tsconfig.json b/packages/apputils/tsconfig.json index 1bf40b794279..357a46ee0ba6 100644 --- a/packages/apputils/tsconfig.json +++ b/packages/apputils/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../coreutils" @@ -12,6 +14,9 @@ { "path": "../services" }, + { + "path": "../settingregistry" + }, { "path": "../ui-components" } diff --git a/packages/codemirror-extension/package.json b/packages/codemirror-extension/package.json index bad81e97d23e..6f3da348cdda 100644 --- a/packages/codemirror-extension/package.json +++ b/packages/codemirror-extension/package.json @@ -39,10 +39,10 @@ "@jupyterlab/application": "^2.0.0-alpha.4", "@jupyterlab/codeeditor": "^2.0.0-alpha.4", "@jupyterlab/codemirror": "^2.0.0-alpha.4", - "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/docregistry": "^2.0.0-alpha.4", "@jupyterlab/fileeditor": "^2.0.0-alpha.4", "@jupyterlab/mainmenu": "^2.0.0-alpha.4", + "@jupyterlab/settingregistry": "^2.0.0-alpha.4", "@jupyterlab/statusbar": "^2.0.0-alpha.4", "@lumino/widgets": "^1.9.4", "codemirror": "~5.49.2" diff --git a/packages/codemirror-extension/src/index.ts b/packages/codemirror-extension/src/index.ts index 7b92163d5148..c2c1f9feaab0 100644 --- a/packages/codemirror-extension/src/index.ts +++ b/packages/codemirror-extension/src/index.ts @@ -22,12 +22,12 @@ import { Mode } from '@jupyterlab/codemirror'; -import { ISettingRegistry } from '@jupyterlab/coreutils'; - import { IDocumentWidget } from '@jupyterlab/docregistry'; import { IEditorTracker, FileEditor } from '@jupyterlab/fileeditor'; +import { ISettingRegistry } from '@jupyterlab/settingregistry'; + import { IStatusBar } from '@jupyterlab/statusbar'; /** diff --git a/packages/codemirror-extension/tsconfig.json b/packages/codemirror-extension/tsconfig.json index d6f1fff4d420..865d1c9ee08c 100644 --- a/packages/codemirror-extension/tsconfig.json +++ b/packages/codemirror-extension/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../application" @@ -15,9 +17,6 @@ { "path": "../codemirror" }, - { - "path": "../coreutils" - }, { "path": "../docregistry" }, @@ -27,6 +26,9 @@ { "path": "../mainmenu" }, + { + "path": "../settingregistry" + }, { "path": "../statusbar" } diff --git a/packages/console-extension/package.json b/packages/console-extension/package.json index d4fae7efceee..d863d68101c3 100644 --- a/packages/console-extension/package.json +++ b/packages/console-extension/package.json @@ -45,6 +45,7 @@ "@jupyterlab/launcher": "^2.0.0-alpha.4", "@jupyterlab/mainmenu": "^2.0.0-alpha.4", "@jupyterlab/rendermime": "^2.0.0-alpha.4", + "@jupyterlab/settingregistry": "^2.0.0-alpha.4", "@lumino/algorithm": "^1.2.1", "@lumino/coreutils": "^1.4.0", "@lumino/disposable": "^1.3.2", diff --git a/packages/console-extension/src/index.ts b/packages/console-extension/src/index.ts index 557abee44468..c57e19f7dab3 100644 --- a/packages/console-extension/src/index.ts +++ b/packages/console-extension/src/index.ts @@ -21,7 +21,7 @@ import { IEditorServices } from '@jupyterlab/codeeditor'; import { ConsolePanel, IConsoleTracker } from '@jupyterlab/console'; -import { ISettingRegistry, PageConfig, URLExt } from '@jupyterlab/coreutils'; +import { PageConfig, URLExt } from '@jupyterlab/coreutils'; import { IFileBrowserFactory } from '@jupyterlab/filebrowser'; @@ -38,6 +38,8 @@ import { import { IRenderMimeRegistry } from '@jupyterlab/rendermime'; +import { ISettingRegistry } from '@jupyterlab/settingregistry'; + import { find } from '@lumino/algorithm'; import { diff --git a/packages/console-extension/tsconfig.json b/packages/console-extension/tsconfig.json index 9a0a20a4d8f5..5a09cfd2dec5 100644 --- a/packages/console-extension/tsconfig.json +++ b/packages/console-extension/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../application" @@ -32,6 +34,9 @@ }, { "path": "../rendermime" + }, + { + "path": "../settingregistry" } ] } diff --git a/packages/coreutils/package.json b/packages/coreutils/package.json index 5d9cc8166a93..1cb11016e2d7 100644 --- a/packages/coreutils/package.json +++ b/packages/coreutils/package.json @@ -37,8 +37,6 @@ "@lumino/disposable": "^1.3.2", "@lumino/properties": "^1.1.4", "@lumino/signaling": "^1.3.2", - "ajv": "^6.10.2", - "json5": "^2.1.1", "minimist": "~1.2.0", "moment": "^2.24.0", "path-posix": "~1.0.0", diff --git a/packages/coreutils/src/index.ts b/packages/coreutils/src/index.ts index 2fdbd267e5ef..865af4558863 100644 --- a/packages/coreutils/src/index.ts +++ b/packages/coreutils/src/index.ts @@ -8,7 +8,6 @@ export * from './markdowncodeblocks'; export * from './pageconfig'; export * from './path'; export * from './restorablepool'; -export * from './settingregistry'; export * from './statedb'; export * from './text'; export * from './time'; diff --git a/packages/coreutils/src/tokens.ts b/packages/coreutils/src/tokens.ts index 275e342e508d..c594d377adb4 100644 --- a/packages/coreutils/src/tokens.ts +++ b/packages/coreutils/src/tokens.ts @@ -1,464 +1,10 @@ // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. -import { - PartialJSONObject, - Token, - PartialJSONValue, - ReadonlyPartialJSONObject, - ReadonlyPartialJSONValue -} from '@lumino/coreutils'; - -import { IDisposable } from '@lumino/disposable'; - -import { ISignal } from '@lumino/signaling'; - -import { ISchemaValidator } from './settingregistry'; +import { Token, ReadonlyPartialJSONValue } from '@lumino/coreutils'; import { IDataConnector } from './interfaces'; -/* tslint:disable */ -/** - * The setting registry token. - */ -export const ISettingRegistry = new Token( - '@jupyterlab/coreutils:ISettingRegistry' -); -/* tslint:enable */ - -/** - * The settings registry interface. - */ -export interface ISettingRegistry { - /** - * The data connector used by the setting registry. - */ - readonly connector: IDataConnector; - - /** - * The schema of the setting registry. - */ - readonly schema: ISettingRegistry.ISchema; - - /** - * The schema validator used by the setting registry. - */ - readonly validator: ISchemaValidator; - - /** - * A signal that emits the name of a plugin when its settings change. - */ - readonly pluginChanged: ISignal; - - /** - * The collection of setting registry plugins. - */ - readonly plugins: { - [name: string]: ISettingRegistry.IPlugin | undefined; - }; - - /** - * Get an individual setting. - * - * @param plugin - The name of the plugin whose settings are being retrieved. - * - * @param key - The name of the setting being retrieved. - * - * @returns A promise that resolves when the setting is retrieved. - */ - get( - plugin: string, - key: string - ): Promise<{ - composite: PartialJSONValue | undefined; - user: PartialJSONValue | undefined; - }>; - - /** - * Load a plugin's settings into the setting registry. - * - * @param plugin - The name of the plugin whose settings are being loaded. - * - * @returns A promise that resolves with a plugin settings object or rejects - * if the plugin is not found. - */ - load(plugin: string): Promise; - - /** - * Reload a plugin's settings into the registry even if they already exist. - * - * @param plugin - The name of the plugin whose settings are being reloaded. - * - * @returns A promise that resolves with a plugin settings object or rejects - * with a list of `ISchemaValidator.IError` objects if it fails. - */ - reload(plugin: string): Promise; - - /** - * Remove a single setting in the registry. - * - * @param plugin - The name of the plugin whose setting is being removed. - * - * @param key - The name of the setting being removed. - * - * @returns A promise that resolves when the setting is removed. - */ - remove(plugin: string, key: string): Promise; - - /** - * Set a single setting in the registry. - * - * @param plugin - The name of the plugin whose setting is being set. - * - * @param key - The name of the setting being set. - * - * @param value - The value of the setting being set. - * - * @returns A promise that resolves when the setting has been saved. - * - */ - set(plugin: string, key: string, value: PartialJSONValue): Promise; - - /** - * Register a plugin transform function to act on a specific plugin. - * - * @param plugin - The name of the plugin whose settings are transformed. - * - * @param transforms - The transform functions applied to the plugin. - * - * @returns A disposable that removes the transforms from the registry. - * - * #### Notes - * - `compose` transformations: The registry automatically overwrites a - * plugin's default values with user overrides, but a plugin may instead wish - * to merge values. This behavior can be accomplished in a `compose` - * transformation. - * - `fetch` transformations: The registry uses the plugin data that is - * fetched from its connector. If a plugin wants to override, e.g. to update - * its schema with dynamic defaults, a `fetch` transformation can be applied. - */ - transform( - plugin: string, - transforms: { - [phase in ISettingRegistry.IPlugin.Phase]?: ISettingRegistry.IPlugin.Transform; - } - ): IDisposable; - - /** - * Upload a plugin's settings. - * - * @param plugin - The name of the plugin whose settings are being set. - * - * @param raw - The raw plugin settings being uploaded. - * - * @returns A promise that resolves when the settings have been saved. - */ - upload(plugin: string, raw: string): Promise; -} - -/** - * A namespace for setting registry interfaces. - */ -export namespace ISettingRegistry { - /** - * The primitive types available in a JSON schema. - */ - export type Primitive = - | 'array' - | 'boolean' - | 'null' - | 'number' - | 'object' - | 'string'; - - /** - * The settings for a specific plugin. - */ - export interface IPlugin extends PartialJSONObject { - /** - * The name of the plugin. - */ - id: string; - - /** - * The collection of values for a specified plugin. - */ - data: ISettingBundle; - - /** - * The raw user settings data as a string containing JSON with comments. - */ - raw: string; - - /** - * The JSON schema for the plugin. - */ - schema: ISchema; - - /** - * The published version of the NPM package containing the plugin. - */ - version: string; - } - - /** - * A namespace for plugin functionality. - */ - export namespace IPlugin { - /** - * A function that transforms a plugin object before it is consumed by the - * setting registry. - */ - export type Transform = (plugin: IPlugin) => IPlugin; - - /** - * The phases during which a transformation may be applied to a plugin. - */ - export type Phase = 'compose' | 'fetch'; - } - - /** - * A minimal subset of the formal JSON Schema that describes a property. - */ - export interface IProperty extends PartialJSONObject { - /** - * The default value, if any. - */ - default?: PartialJSONValue; - - /** - * The schema description. - */ - description?: string; - - /** - * The schema's child properties. - */ - properties?: { [property: string]: IProperty }; - - /** - * The title of a property. - */ - title?: string; - - /** - * The type or types of the data. - */ - type?: Primitive | Primitive[]; - } - - /** - * A schema type that is a minimal subset of the formal JSON Schema along with - * optional JupyterLab rendering hints. - */ - export interface ISchema extends IProperty { - /** - * Whether the schema is deprecated. - * - * #### Notes - * This flag can be used by functionality that loads this plugin's settings - * from the registry. For example, the setting editor does not display a - * plugin's settings if it is set to `true`. - */ - 'jupyter.lab.setting-deprecated'?: boolean; - - /** - * The JupyterLab icon class hint. - */ - 'jupyter.lab.setting-icon-class'?: string; - - /** - * The JupyterLab icon label hint. - */ - 'jupyter.lab.setting-icon-label'?: string; - - /** - * A flag that indicates plugin should be transformed before being used by - * the setting registry. - * - * #### Notes - * If this value is set to `true`, the setting registry will wait until a - * transformation has been registered (by calling the `transform()` method - * of the registry) for the plugin ID before resolving `load()` promises. - * This means that if the attribute is set to `true` but no transformation - * is registered in time, calls to `load()` a plugin will eventually time - * out and reject. - */ - 'jupyter.lab.transform'?: boolean; - - /** - * The JupyterLab shortcuts that are created by a plugin's schema. - */ - 'jupyter.lab.shortcuts'?: IShortcut[]; - - /** - * The root schema is always an object. - */ - type: 'object'; - } - - /** - * The setting values for a plugin. - */ - export interface ISettingBundle extends PartialJSONObject { - /** - * A composite of the user setting values and the plugin schema defaults. - * - * #### Notes - * The `composite` values will always be a superset of the `user` values. - */ - composite: PartialJSONObject; - - /** - * The user setting values. - */ - user: PartialJSONObject; - } - - /** - * An interface for manipulating the settings of a specific plugin. - */ - export interface ISettings extends IDisposable { - /** - * A signal that emits when the plugin's settings have changed. - */ - readonly changed: ISignal; - - /** - * The composite of user settings and extension defaults. - */ - readonly composite: ReadonlyPartialJSONObject; - - /** - * The plugin's ID. - */ - readonly id: string; - - /* - * The underlying plugin. - */ - readonly plugin: ISettingRegistry.IPlugin; - - /** - * The plugin settings raw text value. - */ - readonly raw: string; - - /** - * The plugin's schema. - */ - readonly schema: ISettingRegistry.ISchema; - - /** - * The user settings. - */ - readonly user: ReadonlyPartialJSONObject; - - /** - * The published version of the NPM package containing these settings. - */ - readonly version: string; - - /** - * Return the defaults in a commented JSON format. - */ - annotatedDefaults(): string; - - /** - * Calculate the default value of a setting by iterating through the schema. - * - * @param key - The name of the setting whose default value is calculated. - * - * @returns A calculated default JSON value for a specific setting. - */ - default(key: string): PartialJSONValue | undefined; - - /** - * Get an individual setting. - * - * @param key - The name of the setting being retrieved. - * - * @returns The setting value. - */ - get( - key: string - ): { - composite: ReadonlyPartialJSONValue | undefined; - user: ReadonlyPartialJSONValue | undefined; - }; - - /** - * Remove a single setting. - * - * @param key - The name of the setting being removed. - * - * @returns A promise that resolves when the setting is removed. - * - * #### Notes - * This function is asynchronous because it writes to the setting registry. - */ - remove(key: string): Promise; - - /** - * Save all of the plugin's user settings at once. - */ - save(raw: string): Promise; - - /** - * Set a single setting. - * - * @param key - The name of the setting being set. - * - * @param value - The value of the setting. - * - * @returns A promise that resolves when the setting has been saved. - * - * #### Notes - * This function is asynchronous because it writes to the setting registry. - */ - set(key: string, value: PartialJSONValue): Promise; - - /** - * Validates raw settings with comments. - * - * @param raw - The JSON with comments string being validated. - * - * @returns A list of errors or `null` if valid. - */ - validate(raw: string): ISchemaValidator.IError[] | null; - } - - /** - * An interface describing a JupyterLab keyboard shortcut. - */ - export interface IShortcut extends PartialJSONObject { - /** - * The optional arguments passed into the shortcut's command. - */ - args?: PartialJSONObject; - - /** - * The command invoked by the shortcut. - */ - command: string; - - /** - * Whether a keyboard shortcut is disabled. `False` by default. - */ - disabled?: boolean; - - /** - * The key combination of the shortcut. - */ - keys: string[]; - - /** - * The CSS selector applicable to the shortcut. - */ - selector: string; - } -} - /* tslint:disable */ /** * The default state database token. diff --git a/packages/coreutils/tsconfig.json b/packages/coreutils/tsconfig.json index c09f12e656e3..216bdd12d9e3 100644 --- a/packages/coreutils/tsconfig.json +++ b/packages/coreutils/tsconfig.json @@ -6,6 +6,5 @@ "module": "commonjs", "types": ["node"] }, - "files": ["src/plugin-schema.json"], "include": ["src/*"] } diff --git a/packages/docmanager-extension/package.json b/packages/docmanager-extension/package.json index fc19f1d3b03d..60346f50d478 100644 --- a/packages/docmanager-extension/package.json +++ b/packages/docmanager-extension/package.json @@ -43,6 +43,7 @@ "@jupyterlab/docregistry": "^2.0.0-alpha.4", "@jupyterlab/mainmenu": "^2.0.0-alpha.4", "@jupyterlab/services": "^5.0.0-alpha.4", + "@jupyterlab/settingregistry": "^2.0.0-alpha.4", "@jupyterlab/statusbar": "^2.0.0-alpha.4", "@lumino/algorithm": "^1.2.1", "@lumino/coreutils": "^1.4.0", diff --git a/packages/docmanager-extension/src/index.ts b/packages/docmanager-extension/src/index.ts index 731ecd95dba6..98ba193e1d90 100644 --- a/packages/docmanager-extension/src/index.ts +++ b/packages/docmanager-extension/src/index.ts @@ -15,7 +15,7 @@ import { ICommandPalette } from '@jupyterlab/apputils'; -import { IChangedArgs, ISettingRegistry, Time } from '@jupyterlab/coreutils'; +import { IChangedArgs, Time } from '@jupyterlab/coreutils'; import { renameDialog, @@ -31,6 +31,8 @@ import { IMainMenu } from '@jupyterlab/mainmenu'; import { Contents, Kernel } from '@jupyterlab/services'; +import { ISettingRegistry } from '@jupyterlab/settingregistry'; + import { IStatusBar } from '@jupyterlab/statusbar'; import { each, map, some, toArray } from '@lumino/algorithm'; diff --git a/packages/docmanager-extension/tsconfig.json b/packages/docmanager-extension/tsconfig.json index 5b7be26660c2..11dbf1a944a5 100644 --- a/packages/docmanager-extension/tsconfig.json +++ b/packages/docmanager-extension/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../application" @@ -27,6 +29,9 @@ { "path": "../services" }, + { + "path": "../settingregistry" + }, { "path": "../statusbar" } diff --git a/packages/extensionmanager-extension/package.json b/packages/extensionmanager-extension/package.json index 9443314a17eb..565dc243a84f 100644 --- a/packages/extensionmanager-extension/package.json +++ b/packages/extensionmanager-extension/package.json @@ -38,9 +38,9 @@ "dependencies": { "@jupyterlab/application": "^2.0.0-alpha.4", "@jupyterlab/apputils": "^2.0.0-alpha.4", - "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/extensionmanager": "^2.0.0-alpha.4", - "@jupyterlab/mainmenu": "^2.0.0-alpha.4" + "@jupyterlab/mainmenu": "^2.0.0-alpha.4", + "@jupyterlab/settingregistry": "^2.0.0-alpha.4" }, "devDependencies": { "rimraf": "~3.0.0", diff --git a/packages/extensionmanager-extension/src/index.ts b/packages/extensionmanager-extension/src/index.ts index 040f942fbb26..72674576edaa 100644 --- a/packages/extensionmanager-extension/src/index.ts +++ b/packages/extensionmanager-extension/src/index.ts @@ -10,12 +10,12 @@ import { import { Dialog, showDialog, ICommandPalette } from '@jupyterlab/apputils'; -import { ISettingRegistry } from '@jupyterlab/coreutils'; - import { IMainMenu } from '@jupyterlab/mainmenu'; import { ExtensionView } from '@jupyterlab/extensionmanager'; +import { ISettingRegistry } from '@jupyterlab/settingregistry'; + /** * IDs of the commands added by this extension. */ diff --git a/packages/extensionmanager-extension/tsconfig.json b/packages/extensionmanager-extension/tsconfig.json index 0960e8d31f07..8c4fe2e1139e 100644 --- a/packages/extensionmanager-extension/tsconfig.json +++ b/packages/extensionmanager-extension/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../application" @@ -12,14 +14,14 @@ { "path": "../apputils" }, - { - "path": "../coreutils" - }, { "path": "../extensionmanager" }, { "path": "../mainmenu" + }, + { + "path": "../settingregistry" } ] } diff --git a/packages/filebrowser-extension/package.json b/packages/filebrowser-extension/package.json index 6eda63f9186c..5ca15745db47 100644 --- a/packages/filebrowser-extension/package.json +++ b/packages/filebrowser-extension/package.json @@ -44,6 +44,7 @@ "@jupyterlab/launcher": "^2.0.0-alpha.4", "@jupyterlab/mainmenu": "^2.0.0-alpha.4", "@jupyterlab/services": "^5.0.0-alpha.4", + "@jupyterlab/settingregistry": "^2.0.0-alpha.4", "@jupyterlab/statusbar": "^2.0.0-alpha.4", "@jupyterlab/ui-components": "^2.0.0-alpha.4", "@lumino/algorithm": "^1.2.1", diff --git a/packages/filebrowser-extension/src/index.ts b/packages/filebrowser-extension/src/index.ts index 514c4317c12a..a055c51f28e6 100644 --- a/packages/filebrowser-extension/src/index.ts +++ b/packages/filebrowser-extension/src/index.ts @@ -19,13 +19,7 @@ import { showErrorMessage } from '@jupyterlab/apputils'; -import { - IStateDB, - PageConfig, - PathExt, - URLExt, - ISettingRegistry -} from '@jupyterlab/coreutils'; +import { IStateDB, PageConfig, PathExt, URLExt } from '@jupyterlab/coreutils'; import { IDocumentManager } from '@jupyterlab/docmanager'; @@ -42,6 +36,8 @@ import { IMainMenu } from '@jupyterlab/mainmenu'; import { Contents } from '@jupyterlab/services'; +import { ISettingRegistry } from '@jupyterlab/settingregistry'; + import { IStatusBar } from '@jupyterlab/statusbar'; import { IIconRegistry } from '@jupyterlab/ui-components'; diff --git a/packages/filebrowser-extension/tsconfig.json b/packages/filebrowser-extension/tsconfig.json index 863de97f9c19..0d201e316802 100644 --- a/packages/filebrowser-extension/tsconfig.json +++ b/packages/filebrowser-extension/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../application" @@ -30,6 +32,9 @@ { "path": "../services" }, + { + "path": "../settingregistry" + }, { "path": "../statusbar" }, diff --git a/packages/fileeditor-extension/package.json b/packages/fileeditor-extension/package.json index edb3811e0ca8..4ae2bf6add61 100644 --- a/packages/fileeditor-extension/package.json +++ b/packages/fileeditor-extension/package.json @@ -46,6 +46,7 @@ "@jupyterlab/fileeditor": "^2.0.0-alpha.4", "@jupyterlab/launcher": "^2.0.0-alpha.4", "@jupyterlab/mainmenu": "^2.0.0-alpha.4", + "@jupyterlab/settingregistry": "^2.0.0-alpha.4", "@jupyterlab/statusbar": "^2.0.0-alpha.4", "@lumino/commands": "^1.9.0", "@lumino/coreutils": "^1.4.0", diff --git a/packages/fileeditor-extension/src/commands.ts b/packages/fileeditor-extension/src/commands.ts index 14b47d0c3a27..b91971d79c9e 100644 --- a/packages/fileeditor-extension/src/commands.ts +++ b/packages/fileeditor-extension/src/commands.ts @@ -9,11 +9,7 @@ import { CodeEditor } from '@jupyterlab/codeeditor'; import { IConsoleTracker } from '@jupyterlab/console'; -import { - ISettingRegistry, - MarkdownCodeBlocks, - PathExt -} from '@jupyterlab/coreutils'; +import { MarkdownCodeBlocks, PathExt } from '@jupyterlab/coreutils'; import { IDocumentWidget } from '@jupyterlab/docregistry'; @@ -31,6 +27,8 @@ import { IViewMenu } from '@jupyterlab/mainmenu'; +import { ISettingRegistry } from '@jupyterlab/settingregistry'; + import { CommandRegistry } from '@lumino/commands'; import { JSONObject, ReadonlyPartialJSONObject } from '@lumino/coreutils'; diff --git a/packages/fileeditor-extension/src/index.ts b/packages/fileeditor-extension/src/index.ts index 2ff5ddfb5892..54d5a47f9113 100644 --- a/packages/fileeditor-extension/src/index.ts +++ b/packages/fileeditor-extension/src/index.ts @@ -13,8 +13,6 @@ import { CodeEditor, IEditorServices } from '@jupyterlab/codeeditor'; import { IConsoleTracker } from '@jupyterlab/console'; -import { ISettingRegistry } from '@jupyterlab/coreutils'; - import { IDocumentWidget } from '@jupyterlab/docregistry'; import { IFileBrowserFactory } from '@jupyterlab/filebrowser'; @@ -30,6 +28,8 @@ import { ILauncher } from '@jupyterlab/launcher'; import { IMainMenu } from '@jupyterlab/mainmenu'; +import { ISettingRegistry } from '@jupyterlab/settingregistry'; + import { IStatusBar } from '@jupyterlab/statusbar'; import { JSONObject } from '@lumino/coreutils'; diff --git a/packages/fileeditor-extension/tsconfig.json b/packages/fileeditor-extension/tsconfig.json index d121a9ec33ab..59f2e6286bbc 100644 --- a/packages/fileeditor-extension/tsconfig.json +++ b/packages/fileeditor-extension/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../application" @@ -36,6 +38,9 @@ { "path": "../mainmenu" }, + { + "path": "../settingregistry" + }, { "path": "../statusbar" } diff --git a/packages/logconsole-extension/package.json b/packages/logconsole-extension/package.json index ca4652fabaaa..ddd9e5f14a61 100644 --- a/packages/logconsole-extension/package.json +++ b/packages/logconsole-extension/package.json @@ -42,6 +42,7 @@ "@jupyterlab/notebook": "^2.0.0-alpha.4", "@jupyterlab/rendermime": "^2.0.0-alpha.4", "@jupyterlab/services": "^5.0.0-alpha.4", + "@jupyterlab/settingregistry": "^2.0.0-alpha.4", "@jupyterlab/statusbar": "^2.0.0-alpha.4", "@jupyterlab/ui-components": "^2.0.0-alpha.4", "@lumino/coreutils": "^1.4.0", diff --git a/packages/logconsole-extension/src/index.tsx b/packages/logconsole-extension/src/index.tsx index 687870c0d2ef..10b80be3fdd8 100644 --- a/packages/logconsole-extension/src/index.tsx +++ b/packages/logconsole-extension/src/index.tsx @@ -16,7 +16,7 @@ import { ReactWidget } from '@jupyterlab/apputils'; -import { ISettingRegistry, IChangedArgs } from '@jupyterlab/coreutils'; +import { IChangedArgs } from '@jupyterlab/coreutils'; import { ILoggerRegistry, @@ -31,6 +31,8 @@ import { INotebookTracker, NotebookPanel } from '@jupyterlab/notebook'; import { IRenderMimeRegistry } from '@jupyterlab/rendermime'; +import { ISettingRegistry } from '@jupyterlab/settingregistry'; + import { IStatusBar } from '@jupyterlab/statusbar'; import { HTMLSelect } from '@jupyterlab/ui-components'; diff --git a/packages/logconsole-extension/tsconfig.json b/packages/logconsole-extension/tsconfig.json index b46accdf3f8a..44a166639f7c 100644 --- a/packages/logconsole-extension/tsconfig.json +++ b/packages/logconsole-extension/tsconfig.json @@ -36,6 +36,9 @@ { "path": "../services" }, + { + "path": "../settingregistry" + }, { "path": "../statusbar" }, diff --git a/packages/markdownviewer-extension/package.json b/packages/markdownviewer-extension/package.json index 5ac0eb6b64b0..d5010bc37dbc 100644 --- a/packages/markdownviewer-extension/package.json +++ b/packages/markdownviewer-extension/package.json @@ -38,9 +38,9 @@ "dependencies": { "@jupyterlab/application": "^2.0.0-alpha.4", "@jupyterlab/apputils": "^2.0.0-alpha.4", - "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/markdownviewer": "^2.0.0-alpha.4", - "@jupyterlab/rendermime": "^2.0.0-alpha.4" + "@jupyterlab/rendermime": "^2.0.0-alpha.4", + "@jupyterlab/settingregistry": "^2.0.0-alpha.4" }, "devDependencies": { "rimraf": "~3.0.0", diff --git a/packages/markdownviewer-extension/src/index.ts b/packages/markdownviewer-extension/src/index.ts index 47c1567aa7dd..9c55e13a63d5 100644 --- a/packages/markdownviewer-extension/src/index.ts +++ b/packages/markdownviewer-extension/src/index.ts @@ -9,13 +9,6 @@ import { import { WidgetTracker } from '@jupyterlab/apputils'; -import { ISettingRegistry } from '@jupyterlab/coreutils'; - -import { - IRenderMimeRegistry, - markdownRendererFactory -} from '@jupyterlab/rendermime'; - import { MarkdownViewer, MarkdownViewerFactory, @@ -23,6 +16,13 @@ import { IMarkdownViewerTracker } from '@jupyterlab/markdownviewer'; +import { + IRenderMimeRegistry, + markdownRendererFactory +} from '@jupyterlab/rendermime'; + +import { ISettingRegistry } from '@jupyterlab/settingregistry'; + /** * The command IDs used by the markdownviewer plugin. */ diff --git a/packages/markdownviewer-extension/tsconfig.json b/packages/markdownviewer-extension/tsconfig.json index 32c82d2a5203..8ee03954ab3b 100644 --- a/packages/markdownviewer-extension/tsconfig.json +++ b/packages/markdownviewer-extension/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../application" @@ -12,14 +14,14 @@ { "path": "../apputils" }, - { - "path": "../coreutils" - }, { "path": "../markdownviewer" }, { "path": "../rendermime" + }, + { + "path": "../settingregistry" } ] } diff --git a/packages/metapackage/package.json b/packages/metapackage/package.json index 42f2f43aa3b0..acb4521c1108 100644 --- a/packages/metapackage/package.json +++ b/packages/metapackage/package.json @@ -96,7 +96,7 @@ "@jupyterlab/services": "^5.0.0-alpha.4", "@jupyterlab/settingeditor": "^2.0.0-alpha.4", "@jupyterlab/settingeditor-extension": "^2.0.0-alpha.4", - "@jupyterlab/settingsregistry": "^2.0.0-alpha.4", + "@jupyterlab/settingregistry": "^2.0.0-alpha.4", "@jupyterlab/shortcuts-extension": "^2.0.0-alpha.4", "@jupyterlab/statusbar": "^2.0.0-alpha.4", "@jupyterlab/statusbar-extension": "^2.0.0-alpha.4", diff --git a/packages/metapackage/tsconfig.json b/packages/metapackage/tsconfig.json index 4bda76c37511..7a043d5857b2 100644 --- a/packages/metapackage/tsconfig.json +++ b/packages/metapackage/tsconfig.json @@ -200,6 +200,9 @@ { "path": "../settingeditor-extension" }, + { + "path": "../settingregistry" + }, { "path": "../shortcuts-extension" }, @@ -244,9 +247,6 @@ }, { "path": "../vega5-extension" - }, - { - "path": "../settingsregistry" } ] } diff --git a/packages/notebook-extension/package.json b/packages/notebook-extension/package.json index 1a5cb6be998f..fb408cad0812 100644 --- a/packages/notebook-extension/package.json +++ b/packages/notebook-extension/package.json @@ -50,6 +50,7 @@ "@jupyterlab/property-inspector": "^2.0.0-alpha.4", "@jupyterlab/rendermime": "^2.0.0-alpha.4", "@jupyterlab/services": "^5.0.0-alpha.4", + "@jupyterlab/settingregistry": "^2.0.0-alpha.4", "@jupyterlab/statusbar": "^2.0.0-alpha.4", "@lumino/algorithm": "^1.2.1", "@lumino/commands": "^1.9.0", diff --git a/packages/notebook-extension/src/index.ts b/packages/notebook-extension/src/index.ts index 280f3681cb58..e974ef8e5b44 100644 --- a/packages/notebook-extension/src/index.ts +++ b/packages/notebook-extension/src/index.ts @@ -20,17 +20,14 @@ import { CodeCell } from '@jupyterlab/cells'; import { IEditorServices } from '@jupyterlab/codeeditor'; -import { - ISettingRegistry, - IStateDB, - PageConfig, - URLExt -} from '@jupyterlab/coreutils'; +import { IStateDB, PageConfig, URLExt } from '@jupyterlab/coreutils'; import { IDocumentManager } from '@jupyterlab/docmanager'; import * as nbformat from '@jupyterlab/nbformat'; +import { ISettingRegistry } from '@jupyterlab/settingregistry'; + import { ArrayExt } from '@lumino/algorithm'; import { diff --git a/packages/notebook-extension/tsconfig.json b/packages/notebook-extension/tsconfig.json index 1c8586e7d959..f97ba6aed3d2 100644 --- a/packages/notebook-extension/tsconfig.json +++ b/packages/notebook-extension/tsconfig.json @@ -50,6 +50,9 @@ { "path": "../services" }, + { + "path": "../settingregistry" + }, { "path": "../statusbar" } diff --git a/packages/services/package.json b/packages/services/package.json index bd04a690be7a..40323a2d688a 100644 --- a/packages/services/package.json +++ b/packages/services/package.json @@ -44,6 +44,7 @@ "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/nbformat": "^2.0.0-alpha.4", "@jupyterlab/observables": "^3.0.0-alpha.4", + "@jupyterlab/settingregistry": "^2.0.0-alpha.4", "@lumino/algorithm": "^1.2.1", "@lumino/coreutils": "^1.4.0", "@lumino/disposable": "^1.3.2", diff --git a/packages/services/src/setting/index.ts b/packages/services/src/setting/index.ts index c239efa72a36..1666e91678f0 100644 --- a/packages/services/src/setting/index.ts +++ b/packages/services/src/setting/index.ts @@ -1,7 +1,9 @@ // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. -import { DataConnector, ISettingRegistry, URLExt } from '@jupyterlab/coreutils'; +import { DataConnector, URLExt } from '@jupyterlab/coreutils'; + +import { ISettingRegistry } from '@jupyterlab/settingregistry'; import { ServerConnection } from '../serverconnection'; diff --git a/packages/services/tsconfig.json b/packages/services/tsconfig.json index bfd8accc29b1..1f243b8690d7 100644 --- a/packages/services/tsconfig.json +++ b/packages/services/tsconfig.json @@ -20,6 +20,9 @@ }, { "path": "../observables" + }, + { + "path": "../settingregistry" } ] } diff --git a/packages/settingeditor-extension/package.json b/packages/settingeditor-extension/package.json index 5228301b8c03..717089ea5fa6 100644 --- a/packages/settingeditor-extension/package.json +++ b/packages/settingeditor-extension/package.json @@ -41,7 +41,8 @@ "@jupyterlab/codeeditor": "^2.0.0-alpha.4", "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/rendermime": "^2.0.0-alpha.4", - "@jupyterlab/settingeditor": "^2.0.0-alpha.4" + "@jupyterlab/settingeditor": "^2.0.0-alpha.4", + "@jupyterlab/settingregistry": "^2.0.0-alpha.4" }, "devDependencies": { "rimraf": "~3.0.0", diff --git a/packages/settingeditor-extension/src/index.ts b/packages/settingeditor-extension/src/index.ts index fe73f602ad17..0bc35d9627c5 100644 --- a/packages/settingeditor-extension/src/index.ts +++ b/packages/settingeditor-extension/src/index.ts @@ -17,7 +17,7 @@ import { import { IEditorServices } from '@jupyterlab/codeeditor'; -import { ISettingRegistry, IStateDB } from '@jupyterlab/coreutils'; +import { IStateDB } from '@jupyterlab/coreutils'; import { IRenderMimeRegistry } from '@jupyterlab/rendermime'; @@ -26,6 +26,8 @@ import { SettingEditor } from '@jupyterlab/settingeditor'; +import { ISettingRegistry } from '@jupyterlab/settingregistry'; + /** * The command IDs used by the setting editor. */ diff --git a/packages/settingeditor-extension/tsconfig.json b/packages/settingeditor-extension/tsconfig.json index 999a1a2fdfb6..c65be496328e 100644 --- a/packages/settingeditor-extension/tsconfig.json +++ b/packages/settingeditor-extension/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../application" @@ -23,6 +25,9 @@ }, { "path": "../settingeditor" + }, + { + "path": "../settingregistry" } ] } diff --git a/packages/settingeditor/package.json b/packages/settingeditor/package.json index 8dc118e75190..028835d1e105 100644 --- a/packages/settingeditor/package.json +++ b/packages/settingeditor/package.json @@ -40,6 +40,7 @@ "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/inspector": "^2.0.0-alpha.4", "@jupyterlab/rendermime": "^2.0.0-alpha.4", + "@jupyterlab/settingregistry": "^2.0.0-alpha.4", "@jupyterlab/ui-components": "^2.0.0-alpha.4", "@lumino/commands": "^1.9.0", "@lumino/coreutils": "^1.4.0", diff --git a/packages/settingeditor/src/inspector.ts b/packages/settingeditor/src/inspector.ts index 1606005d2874..86d81b9c10f0 100644 --- a/packages/settingeditor/src/inspector.ts +++ b/packages/settingeditor/src/inspector.ts @@ -3,7 +3,7 @@ | Distributed under the terms of the Modified BSD License. |----------------------------------------------------------------------------*/ -import { DataConnector, ISchemaValidator } from '@jupyterlab/coreutils'; +import { DataConnector } from '@jupyterlab/coreutils'; import { InspectionHandler, InspectorPanel } from '@jupyterlab/inspector'; @@ -13,6 +13,8 @@ import { standardRendererFactories } from '@jupyterlab/rendermime'; +import { ISchemaValidator } from '@jupyterlab/settingregistry'; + import { ReadonlyJSONObject } from '@lumino/coreutils'; import { RawEditor } from './raweditor'; diff --git a/packages/settingeditor/src/plugineditor.ts b/packages/settingeditor/src/plugineditor.ts index e1a4f3ccc036..e150ad1291ed 100644 --- a/packages/settingeditor/src/plugineditor.ts +++ b/packages/settingeditor/src/plugineditor.ts @@ -7,10 +7,10 @@ import { Dialog, showDialog } from '@jupyterlab/apputils'; import { CodeEditor } from '@jupyterlab/codeeditor'; -import { ISettingRegistry } from '@jupyterlab/coreutils'; - import { IRenderMimeRegistry } from '@jupyterlab/rendermime'; +import { ISettingRegistry } from '@jupyterlab/settingregistry'; + import { CommandRegistry } from '@lumino/commands'; import { JSONExt } from '@lumino/coreutils'; diff --git a/packages/settingeditor/src/pluginlist.tsx b/packages/settingeditor/src/pluginlist.tsx index 8f962583b79a..7728327bf494 100644 --- a/packages/settingeditor/src/pluginlist.tsx +++ b/packages/settingeditor/src/pluginlist.tsx @@ -3,7 +3,7 @@ | Distributed under the terms of the Modified BSD License. |----------------------------------------------------------------------------*/ -import { ISettingRegistry } from '@jupyterlab/coreutils'; +import { ISettingRegistry } from '@jupyterlab/settingregistry'; import { combineClasses, diff --git a/packages/settingeditor/src/raweditor.ts b/packages/settingeditor/src/raweditor.ts index 01f4db71a879..2caac4e1fdac 100644 --- a/packages/settingeditor/src/raweditor.ts +++ b/packages/settingeditor/src/raweditor.ts @@ -5,10 +5,10 @@ import { Toolbar, CommandToolbarButton } from '@jupyterlab/apputils'; import { CodeEditor, CodeEditorWrapper } from '@jupyterlab/codeeditor'; -import { ISettingRegistry } from '@jupyterlab/coreutils'; - import { IRenderMimeRegistry } from '@jupyterlab/rendermime'; +import { ISettingRegistry } from '@jupyterlab/settingregistry'; + import { CommandRegistry } from '@lumino/commands'; import { Message } from '@lumino/messaging'; diff --git a/packages/settingeditor/src/settingeditor.tsx b/packages/settingeditor/src/settingeditor.tsx index 3b1dd4564211..1e55920835bc 100644 --- a/packages/settingeditor/src/settingeditor.tsx +++ b/packages/settingeditor/src/settingeditor.tsx @@ -5,10 +5,12 @@ import { CodeEditor } from '@jupyterlab/codeeditor'; -import { ISettingRegistry, IStateDB } from '@jupyterlab/coreutils'; +import { IStateDB } from '@jupyterlab/coreutils'; import { IRenderMimeRegistry } from '@jupyterlab/rendermime'; +import { ISettingRegistry } from '@jupyterlab/settingregistry'; + import { CommandRegistry } from '@lumino/commands'; import { JSONExt, JSONObject, JSONValue } from '@lumino/coreutils'; diff --git a/packages/settingeditor/tsconfig.json b/packages/settingeditor/tsconfig.json index 75553a5273ab..2bc96aa088d1 100644 --- a/packages/settingeditor/tsconfig.json +++ b/packages/settingeditor/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../apputils" @@ -21,6 +23,9 @@ { "path": "../rendermime" }, + { + "path": "../settingregistry" + }, { "path": "../ui-components" } diff --git a/packages/coreutils/src/plugin-schema.json b/packages/settingregistry/src/plugin-schema.json similarity index 100% rename from packages/coreutils/src/plugin-schema.json rename to packages/settingregistry/src/plugin-schema.json diff --git a/packages/coreutils/src/settingregistry.ts b/packages/settingregistry/src/settingregistry.ts similarity index 99% rename from packages/coreutils/src/settingregistry.ts rename to packages/settingregistry/src/settingregistry.ts index 311281ff86e8..066c83a93ec4 100644 --- a/packages/coreutils/src/settingregistry.ts +++ b/packages/settingregistry/src/settingregistry.ts @@ -22,7 +22,7 @@ import { DisposableDelegate, IDisposable } from '@lumino/disposable'; import { ISignal, Signal } from '@lumino/signaling'; -import { IDataConnector } from './interfaces'; +import { IDataConnector } from '@jupyterlab/coreutils'; import { ISettingRegistry } from './tokens'; diff --git a/packages/settingregistry/src/tokens.ts b/packages/settingregistry/src/tokens.ts new file mode 100644 index 000000000000..9fa6d1347fb8 --- /dev/null +++ b/packages/settingregistry/src/tokens.ts @@ -0,0 +1,463 @@ +/*----------------------------------------------------------------------------- +| Copyright (c) Jupyter Development Team. +| Distributed under the terms of the Modified BSD License. +|----------------------------------------------------------------------------*/ + +import { + PartialJSONObject, + Token, + PartialJSONValue, + ReadonlyPartialJSONObject, + ReadonlyPartialJSONValue +} from '@lumino/coreutils'; + +import { IDisposable } from '@lumino/disposable'; + +import { ISignal } from '@lumino/signaling'; + +import { IDataConnector } from '@jupyterlab/coreutils'; + +import { ISchemaValidator } from './settingregistry'; + + +/* tslint:disable */ +/** + * The setting registry token. + */ +export const ISettingRegistry = new Token( + '@jupyterlab/coreutils:ISettingRegistry' +); +/* tslint:enable */ + +/** + * The settings registry interface. + */ +export interface ISettingRegistry { + /** + * The data connector used by the setting registry. + */ + readonly connector: IDataConnector; + + /** + * The schema of the setting registry. + */ + readonly schema: ISettingRegistry.ISchema; + + /** + * The schema validator used by the setting registry. + */ + readonly validator: ISchemaValidator; + + /** + * A signal that emits the name of a plugin when its settings change. + */ + readonly pluginChanged: ISignal; + + /** + * The collection of setting registry plugins. + */ + readonly plugins: { + [name: string]: ISettingRegistry.IPlugin | undefined; + }; + + /** + * Get an individual setting. + * + * @param plugin - The name of the plugin whose settings are being retrieved. + * + * @param key - The name of the setting being retrieved. + * + * @returns A promise that resolves when the setting is retrieved. + */ + get( + plugin: string, + key: string + ): Promise<{ + composite: PartialJSONValue | undefined; + user: PartialJSONValue | undefined; + }>; + + /** + * Load a plugin's settings into the setting registry. + * + * @param plugin - The name of the plugin whose settings are being loaded. + * + * @returns A promise that resolves with a plugin settings object or rejects + * if the plugin is not found. + */ + load(plugin: string): Promise; + + /** + * Reload a plugin's settings into the registry even if they already exist. + * + * @param plugin - The name of the plugin whose settings are being reloaded. + * + * @returns A promise that resolves with a plugin settings object or rejects + * with a list of `ISchemaValidator.IError` objects if it fails. + */ + reload(plugin: string): Promise; + + /** + * Remove a single setting in the registry. + * + * @param plugin - The name of the plugin whose setting is being removed. + * + * @param key - The name of the setting being removed. + * + * @returns A promise that resolves when the setting is removed. + */ + remove(plugin: string, key: string): Promise; + + /** + * Set a single setting in the registry. + * + * @param plugin - The name of the plugin whose setting is being set. + * + * @param key - The name of the setting being set. + * + * @param value - The value of the setting being set. + * + * @returns A promise that resolves when the setting has been saved. + * + */ + set(plugin: string, key: string, value: PartialJSONValue): Promise; + + /** + * Register a plugin transform function to act on a specific plugin. + * + * @param plugin - The name of the plugin whose settings are transformed. + * + * @param transforms - The transform functions applied to the plugin. + * + * @returns A disposable that removes the transforms from the registry. + * + * #### Notes + * - `compose` transformations: The registry automatically overwrites a + * plugin's default values with user overrides, but a plugin may instead wish + * to merge values. This behavior can be accomplished in a `compose` + * transformation. + * - `fetch` transformations: The registry uses the plugin data that is + * fetched from its connector. If a plugin wants to override, e.g. to update + * its schema with dynamic defaults, a `fetch` transformation can be applied. + */ + transform( + plugin: string, + transforms: { + [phase in ISettingRegistry.IPlugin.Phase]?: ISettingRegistry.IPlugin.Transform; + } + ): IDisposable; + + /** + * Upload a plugin's settings. + * + * @param plugin - The name of the plugin whose settings are being set. + * + * @param raw - The raw plugin settings being uploaded. + * + * @returns A promise that resolves when the settings have been saved. + */ + upload(plugin: string, raw: string): Promise; +} + +/** + * A namespace for setting registry interfaces. + */ +export namespace ISettingRegistry { + /** + * The primitive types available in a JSON schema. + */ + export type Primitive = + | 'array' + | 'boolean' + | 'null' + | 'number' + | 'object' + | 'string'; + + /** + * The settings for a specific plugin. + */ + export interface IPlugin extends PartialJSONObject { + /** + * The name of the plugin. + */ + id: string; + + /** + * The collection of values for a specified plugin. + */ + data: ISettingBundle; + + /** + * The raw user settings data as a string containing JSON with comments. + */ + raw: string; + + /** + * The JSON schema for the plugin. + */ + schema: ISchema; + + /** + * The published version of the NPM package containing the plugin. + */ + version: string; + } + + /** + * A namespace for plugin functionality. + */ + export namespace IPlugin { + /** + * A function that transforms a plugin object before it is consumed by the + * setting registry. + */ + export type Transform = (plugin: IPlugin) => IPlugin; + + /** + * The phases during which a transformation may be applied to a plugin. + */ + export type Phase = 'compose' | 'fetch'; + } + + /** + * A minimal subset of the formal JSON Schema that describes a property. + */ + export interface IProperty extends PartialJSONObject { + /** + * The default value, if any. + */ + default?: PartialJSONValue; + + /** + * The schema description. + */ + description?: string; + + /** + * The schema's child properties. + */ + properties?: { [property: string]: IProperty }; + + /** + * The title of a property. + */ + title?: string; + + /** + * The type or types of the data. + */ + type?: Primitive | Primitive[]; + } + + /** + * A schema type that is a minimal subset of the formal JSON Schema along with + * optional JupyterLab rendering hints. + */ + export interface ISchema extends IProperty { + /** + * Whether the schema is deprecated. + * + * #### Notes + * This flag can be used by functionality that loads this plugin's settings + * from the registry. For example, the setting editor does not display a + * plugin's settings if it is set to `true`. + */ + 'jupyter.lab.setting-deprecated'?: boolean; + + /** + * The JupyterLab icon class hint. + */ + 'jupyter.lab.setting-icon-class'?: string; + + /** + * The JupyterLab icon label hint. + */ + 'jupyter.lab.setting-icon-label'?: string; + + /** + * A flag that indicates plugin should be transformed before being used by + * the setting registry. + * + * #### Notes + * If this value is set to `true`, the setting registry will wait until a + * transformation has been registered (by calling the `transform()` method + * of the registry) for the plugin ID before resolving `load()` promises. + * This means that if the attribute is set to `true` but no transformation + * is registered in time, calls to `load()` a plugin will eventually time + * out and reject. + */ + 'jupyter.lab.transform'?: boolean; + + /** + * The JupyterLab shortcuts that are created by a plugin's schema. + */ + 'jupyter.lab.shortcuts'?: IShortcut[]; + + /** + * The root schema is always an object. + */ + type: 'object'; + } + + /** + * The setting values for a plugin. + */ + export interface ISettingBundle extends PartialJSONObject { + /** + * A composite of the user setting values and the plugin schema defaults. + * + * #### Notes + * The `composite` values will always be a superset of the `user` values. + */ + composite: PartialJSONObject; + + /** + * The user setting values. + */ + user: PartialJSONObject; + } + + /** + * An interface for manipulating the settings of a specific plugin. + */ + export interface ISettings extends IDisposable { + /** + * A signal that emits when the plugin's settings have changed. + */ + readonly changed: ISignal; + + /** + * The composite of user settings and extension defaults. + */ + readonly composite: ReadonlyPartialJSONObject; + + /** + * The plugin's ID. + */ + readonly id: string; + + /* + * The underlying plugin. + */ + readonly plugin: ISettingRegistry.IPlugin; + + /** + * The plugin settings raw text value. + */ + readonly raw: string; + + /** + * The plugin's schema. + */ + readonly schema: ISettingRegistry.ISchema; + + /** + * The user settings. + */ + readonly user: ReadonlyPartialJSONObject; + + /** + * The published version of the NPM package containing these settings. + */ + readonly version: string; + + /** + * Return the defaults in a commented JSON format. + */ + annotatedDefaults(): string; + + /** + * Calculate the default value of a setting by iterating through the schema. + * + * @param key - The name of the setting whose default value is calculated. + * + * @returns A calculated default JSON value for a specific setting. + */ + default(key: string): PartialJSONValue | undefined; + + /** + * Get an individual setting. + * + * @param key - The name of the setting being retrieved. + * + * @returns The setting value. + */ + get( + key: string + ): { + composite: ReadonlyPartialJSONValue | undefined; + user: ReadonlyPartialJSONValue | undefined; + }; + + /** + * Remove a single setting. + * + * @param key - The name of the setting being removed. + * + * @returns A promise that resolves when the setting is removed. + * + * #### Notes + * This function is asynchronous because it writes to the setting registry. + */ + remove(key: string): Promise; + + /** + * Save all of the plugin's user settings at once. + */ + save(raw: string): Promise; + + /** + * Set a single setting. + * + * @param key - The name of the setting being set. + * + * @param value - The value of the setting. + * + * @returns A promise that resolves when the setting has been saved. + * + * #### Notes + * This function is asynchronous because it writes to the setting registry. + */ + set(key: string, value: PartialJSONValue): Promise; + + /** + * Validates raw settings with comments. + * + * @param raw - The JSON with comments string being validated. + * + * @returns A list of errors or `null` if valid. + */ + validate(raw: string): ISchemaValidator.IError[] | null; + } + + /** + * An interface describing a JupyterLab keyboard shortcut. + */ + export interface IShortcut extends PartialJSONObject { + /** + * The optional arguments passed into the shortcut's command. + */ + args?: PartialJSONObject; + + /** + * The command invoked by the shortcut. + */ + command: string; + + /** + * Whether a keyboard shortcut is disabled. `False` by default. + */ + disabled?: boolean; + + /** + * The key combination of the shortcut. + */ + keys: string[]; + + /** + * The CSS selector applicable to the shortcut. + */ + selector: string; + } +} diff --git a/packages/shortcuts-extension/package.json b/packages/shortcuts-extension/package.json index 2da1a1bd59fe..c4c83f99d425 100644 --- a/packages/shortcuts-extension/package.json +++ b/packages/shortcuts-extension/package.json @@ -33,7 +33,7 @@ }, "dependencies": { "@jupyterlab/application": "^2.0.0-alpha.4", - "@jupyterlab/coreutils": "^4.0.0-alpha.4", + "@jupyterlab/settingregistry": "^2.0.0-alpha.4", "@lumino/commands": "^1.9.0", "@lumino/coreutils": "^1.4.0", "@lumino/disposable": "^1.3.2" diff --git a/packages/shortcuts-extension/src/index.ts b/packages/shortcuts-extension/src/index.ts index 742129b20f57..e153c41b5a28 100644 --- a/packages/shortcuts-extension/src/index.ts +++ b/packages/shortcuts-extension/src/index.ts @@ -6,7 +6,10 @@ import { JupyterFrontEndPlugin } from '@jupyterlab/application'; -import { ISettingRegistry, SettingRegistry } from '@jupyterlab/coreutils'; +import { + ISettingRegistry, + SettingRegistry +} from '@jupyterlab/settingregistry'; import { CommandRegistry } from '@lumino/commands'; diff --git a/packages/shortcuts-extension/tsconfig.json b/packages/shortcuts-extension/tsconfig.json index a8a8211b2397..81cfc29fe297 100644 --- a/packages/shortcuts-extension/tsconfig.json +++ b/packages/shortcuts-extension/tsconfig.json @@ -4,13 +4,15 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../application" }, { - "path": "../coreutils" + "path": "../settingregistry" } ] } diff --git a/packages/statusbar-extension/package.json b/packages/statusbar-extension/package.json index 5a26b0a58744..aa430da9b096 100644 --- a/packages/statusbar-extension/package.json +++ b/packages/statusbar-extension/package.json @@ -40,11 +40,11 @@ "@jupyterlab/apputils": "^2.0.0-alpha.4", "@jupyterlab/cells": "^2.0.0-alpha.4", "@jupyterlab/console": "^2.0.0-alpha.4", - "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/docregistry": "^2.0.0-alpha.4", "@jupyterlab/fileeditor": "^2.0.0-alpha.4", "@jupyterlab/mainmenu": "^2.0.0-alpha.4", "@jupyterlab/notebook": "^2.0.0-alpha.4", + "@jupyterlab/settingregistry": "^2.0.0-alpha.4", "@jupyterlab/statusbar": "^2.0.0-alpha.4", "@lumino/widgets": "^1.9.4" }, diff --git a/packages/statusbar-extension/src/index.ts b/packages/statusbar-extension/src/index.ts index f2ab73898349..af7de78263bf 100644 --- a/packages/statusbar-extension/src/index.ts +++ b/packages/statusbar-extension/src/index.ts @@ -36,10 +36,10 @@ import { StatusBar } from '@jupyterlab/statusbar'; -import { ISettingRegistry } from '@jupyterlab/coreutils'; - import { IMainMenu } from '@jupyterlab/mainmenu'; +import { ISettingRegistry } from '@jupyterlab/settingregistry'; + import { Title, Widget } from '@lumino/widgets'; export const STATUSBAR_PLUGIN_ID = '@jupyterlab/statusbar-extension:plugin'; diff --git a/packages/statusbar-extension/tsconfig.json b/packages/statusbar-extension/tsconfig.json index 494257101a73..92640ef7aa48 100644 --- a/packages/statusbar-extension/tsconfig.json +++ b/packages/statusbar-extension/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/**/*"], + "include": [ + "src/**/*" + ], "references": [ { "path": "../application" @@ -18,9 +20,6 @@ { "path": "../console" }, - { - "path": "../coreutils" - }, { "path": "../docregistry" }, @@ -33,6 +32,9 @@ { "path": "../notebook" }, + { + "path": "../settingregistry" + }, { "path": "../statusbar" } diff --git a/packages/terminal-extension/package.json b/packages/terminal-extension/package.json index 71dd198e52c3..1e487d3d50d5 100644 --- a/packages/terminal-extension/package.json +++ b/packages/terminal-extension/package.json @@ -38,11 +38,11 @@ "dependencies": { "@jupyterlab/application": "^2.0.0-alpha.4", "@jupyterlab/apputils": "^2.0.0-alpha.4", - "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/launcher": "^2.0.0-alpha.4", "@jupyterlab/mainmenu": "^2.0.0-alpha.4", "@jupyterlab/running": "^2.0.0-alpha.4", "@jupyterlab/services": "^5.0.0-alpha.4", + "@jupyterlab/settingregistry": "^2.0.0-alpha.4", "@jupyterlab/terminal": "^2.0.0-alpha.4", "@lumino/algorithm": "^1.2.1", "@lumino/widgets": "^1.9.4" diff --git a/packages/terminal-extension/src/index.ts b/packages/terminal-extension/src/index.ts index 3c304312d5da..ea580ef73df8 100644 --- a/packages/terminal-extension/src/index.ts +++ b/packages/terminal-extension/src/index.ts @@ -1,8 +1,6 @@ // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. -import { ISettingRegistry } from '@jupyterlab/coreutils'; - import { ILayoutRestorer, JupyterFrontEnd, @@ -18,6 +16,8 @@ import { import { Terminal } from '@jupyterlab/services'; +import { ISettingRegistry } from '@jupyterlab/settingregistry'; + import { ILauncher } from '@jupyterlab/launcher'; import { IFileMenu, IMainMenu } from '@jupyterlab/mainmenu'; diff --git a/packages/terminal-extension/tsconfig.json b/packages/terminal-extension/tsconfig.json index c4f42d12458a..0150a4195749 100644 --- a/packages/terminal-extension/tsconfig.json +++ b/packages/terminal-extension/tsconfig.json @@ -3,9 +3,13 @@ "compilerOptions": { "outDir": "lib", "rootDir": "src", - "types": ["webpack-env"] + "types": [ + "webpack-env" + ] }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../application" @@ -13,9 +17,6 @@ { "path": "../apputils" }, - { - "path": "../coreutils" - }, { "path": "../launcher" }, @@ -28,6 +29,9 @@ { "path": "../services" }, + { + "path": "../settingregistry" + }, { "path": "../terminal" } diff --git a/tests/test-coreutils/package.json b/tests/test-coreutils/package.json index 3c1380cab553..9d3b263b9bd1 100644 --- a/tests/test-coreutils/package.json +++ b/tests/test-coreutils/package.json @@ -13,7 +13,6 @@ }, "dependencies": { "@jupyterlab/coreutils": "^4.0.0-alpha.4", - "@jupyterlab/nbformat": "^2.0.0-alpha.4", "@jupyterlab/testutils": "^2.0.0-alpha.4", "@lumino/coreutils": "^1.4.0", "@lumino/disposable": "^1.3.2", diff --git a/tests/test-coreutils/src/nbformat.spec.ts b/tests/test-coreutils/src/nbformat.spec.ts deleted file mode 100644 index 9baa335a734c..000000000000 --- a/tests/test-coreutils/src/nbformat.spec.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Jupyter Development Team. -// Distributed under the terms of the Modified BSD License. - -import { expect } from 'chai'; - -import * as nbformat from '@jupyterlab/nbformat'; - -const VALIDATE = nbformat.validateMimeValue; - -describe('@jupyterlab/coreutils', () => { - describe('nbformat', () => { - describe('validateMimeValue', () => { - it('should return true for a valid json object', () => { - expect(VALIDATE('application/json', { foo: 1 })).to.equal(true); - }); - - it('should return true for a valid json-like object', () => { - expect(VALIDATE('application/foo+json', { foo: 1 })).to.equal(true); - }); - - it('should return true for a valid string object', () => { - expect(VALIDATE('text/plain', 'foo')).to.equal(true); - }); - - it('should return true for a valid array of strings object', () => { - expect(VALIDATE('text/plain', ['foo', 'bar'])).to.equal(true); - }); - - it('should return false for a json type with string data', () => { - expect(VALIDATE('application/foo+json', 'bar')).to.equal(false); - }); - - it('should return false for a string type with json data', () => { - expect(VALIDATE('foo/bar', { foo: 1 })).to.equal(false); - }); - }); - }); -}); diff --git a/tests/test-coreutils/tsconfig.json b/tests/test-coreutils/tsconfig.json index 36b19fd90846..8328cc99674c 100644 --- a/tests/test-coreutils/tsconfig.json +++ b/tests/test-coreutils/tsconfig.json @@ -15,9 +15,6 @@ { "path": "../../packages/coreutils" }, - { - "path": "../../packages/nbformat" - }, { "path": "../../testutils" } diff --git a/tests/test-nbformat/babel.config.js b/tests/test-nbformat/babel.config.js new file mode 100644 index 000000000000..8b5c76420c60 --- /dev/null +++ b/tests/test-nbformat/babel.config.js @@ -0,0 +1 @@ +module.exports = require('@jupyterlab/testutils/lib/babel.config'); diff --git a/tests/test-nbformat/jest.config.js b/tests/test-nbformat/jest.config.js new file mode 100644 index 000000000000..81e541f621bd --- /dev/null +++ b/tests/test-nbformat/jest.config.js @@ -0,0 +1,2 @@ +const func = require('@jupyterlab/testutils/lib/jest-config'); +module.exports = func('fileeditor', __dirname); diff --git a/tests/test-nbformat/package.json b/tests/test-nbformat/package.json new file mode 100644 index 000000000000..0b15d6df8faa --- /dev/null +++ b/tests/test-nbformat/package.json @@ -0,0 +1,27 @@ +{ + "name": "@jupyterlab/test-nbformat", + "version": "2.0.0-alpha.4", + "private": true, + "scripts": { + "build": "tsc -b", + "clean": "rimraf build && rimraf coverage", + "coverage": "python run.py --coverage", + "test": "python run.py", + "watch": "python run.py --debug", + "watch:all": "python run.py --debug --watchAll", + "watch:src": "tsc -b --watch" + }, + "dependencies": { + "@jupyterlab/nbformat": "^2.0.0-alpha.4", + "chai": "^4.2.0", + "jest": "^24.9.0", + "jest-junit": "^10.0.0", + "ts-jest": "^24.2.0" + }, + "devDependencies": { + "@types/chai": "^4.2.7", + "@types/jest": "^24.0.23", + "rimraf": "~3.0.0", + "typescript": "~3.7.3" + } +} diff --git a/tests/test-nbformat/run.py b/tests/test-nbformat/run.py new file mode 100644 index 000000000000..b9bd9c302be4 --- /dev/null +++ b/tests/test-nbformat/run.py @@ -0,0 +1,8 @@ +# Copyright (c) Jupyter Development Team. +# Distributed under the terms of the Modified BSD License. + +import os.path as osp +from jupyterlab.tests.test_app import run_jest + +if __name__ == '__main__': + run_jest(osp.dirname(osp.realpath(__file__))) diff --git a/tests/test-nbformat/src/nbformat.spec.ts b/tests/test-nbformat/src/nbformat.spec.ts new file mode 100644 index 000000000000..a033ed2e6d14 --- /dev/null +++ b/tests/test-nbformat/src/nbformat.spec.ts @@ -0,0 +1,36 @@ +// Copyright (c) Jupyter Development Team. +// Distributed under the terms of the Modified BSD License. + +import { expect } from 'chai'; + +import * as nbformat from '@jupyterlab/nbformat'; + +const VALIDATE = nbformat.validateMimeValue; + +describe('@jupyterlab/nbformat', () => { + describe('validateMimeValue', () => { + it('should return true for a valid json object', () => { + expect(VALIDATE('application/json', { foo: 1 })).to.equal(true); + }); + + it('should return true for a valid json-like object', () => { + expect(VALIDATE('application/foo+json', { foo: 1 })).to.equal(true); + }); + + it('should return true for a valid string object', () => { + expect(VALIDATE('text/plain', 'foo')).to.equal(true); + }); + + it('should return true for a valid array of strings object', () => { + expect(VALIDATE('text/plain', ['foo', 'bar'])).to.equal(true); + }); + + it('should return false for a json type with string data', () => { + expect(VALIDATE('application/foo+json', 'bar')).to.equal(false); + }); + + it('should return false for a string type with json data', () => { + expect(VALIDATE('foo/bar', { foo: 1 })).to.equal(false); + }); + }); +}); diff --git a/tests/test-nbformat/tsconfig.json b/tests/test-nbformat/tsconfig.json new file mode 100644 index 000000000000..7089a8381cce --- /dev/null +++ b/tests/test-nbformat/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../../tsconfigbase", + "compilerOptions": { + "outDir": "build", + "rootDir": "src", + "types": [ + "jest" + ], + "composite": false + }, + "include": [ + "src/*" + ], + "references": [ + { + "path": "../../packages/nbformat" + } + ] +} diff --git a/tests/test-notebook/package.json b/tests/test-notebook/package.json index 03bbfa4035d0..a4573cc6fa33 100644 --- a/tests/test-notebook/package.json +++ b/tests/test-notebook/package.json @@ -21,7 +21,6 @@ "@jupyterlab/apputils": "^2.0.0-alpha.4", "@jupyterlab/cells": "^2.0.0-alpha.4", "@jupyterlab/codemirror": "^2.0.0-alpha.4", - "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/docregistry": "^2.0.0-alpha.4", "@jupyterlab/nbformat": "^2.0.0-alpha.4", "@jupyterlab/notebook": "^2.0.0-alpha.4", diff --git a/tests/test-notebook/tsconfig.json b/tests/test-notebook/tsconfig.json index cfedc8d9ce4e..f00d6d27ef1e 100644 --- a/tests/test-notebook/tsconfig.json +++ b/tests/test-notebook/tsconfig.json @@ -21,9 +21,6 @@ { "path": "../../packages/codemirror" }, - { - "path": "../../packages/coreutils" - }, { "path": "../../packages/docregistry" }, diff --git a/tests/test-settingregistry/babel.config.js b/tests/test-settingregistry/babel.config.js new file mode 100644 index 000000000000..8b5c76420c60 --- /dev/null +++ b/tests/test-settingregistry/babel.config.js @@ -0,0 +1 @@ +module.exports = require('@jupyterlab/testutils/lib/babel.config'); diff --git a/tests/test-settingregistry/jest.config.js b/tests/test-settingregistry/jest.config.js new file mode 100644 index 000000000000..d9b783931a85 --- /dev/null +++ b/tests/test-settingregistry/jest.config.js @@ -0,0 +1,2 @@ +const func = require('@jupyterlab/testutils/lib/jest-config'); +module.exports = func('logconsole', __dirname); diff --git a/tests/test-settingregistry/package.json b/tests/test-settingregistry/package.json new file mode 100644 index 000000000000..25df8825bc2f --- /dev/null +++ b/tests/test-settingregistry/package.json @@ -0,0 +1,30 @@ +{ + "name": "@jupyterlab/test-settingregistry", + "version": "2.0.0-alpha.4", + "private": true, + "scripts": { + "build": "tsc -b", + "clean": "rimraf build && rimraf coverage", + "coverage": "python run.py --coverage", + "test": "python run.py", + "watch": "python run.py --debug", + "watch:all": "python run.py --debug --watchAll", + "watch:src": "tsc -b --watch" + }, + "dependencies": { + "@jupyterlab/coreutils": "^4.0.0-alpha.4", + "@jupyterlab/settingregistry": "^2.0.0-alpha.4", + "@jupyterlab/testutils": "^2.0.0-alpha.4", + "@lumino/coreutils": "^1.4.0", + "chai": "^4.2.0", + "jest": "^24.9.0", + "jest-junit": "^10.0.0", + "ts-jest": "^24.2.0" + }, + "devDependencies": { + "@types/chai": "^4.2.7", + "@types/jest": "^24.0.23", + "rimraf": "~3.0.0", + "typescript": "~3.7.3" + } +} diff --git a/tests/test-settingregistry/run.py b/tests/test-settingregistry/run.py new file mode 100644 index 000000000000..b9bd9c302be4 --- /dev/null +++ b/tests/test-settingregistry/run.py @@ -0,0 +1,8 @@ +# Copyright (c) Jupyter Development Team. +# Distributed under the terms of the Modified BSD License. + +import os.path as osp +from jupyterlab.tests.test_app import run_jest + +if __name__ == '__main__': + run_jest(osp.dirname(osp.realpath(__file__))) diff --git a/tests/test-coreutils/src/settingregistry.spec.ts b/tests/test-settingregistry/src/settingregistry.spec.ts similarity index 99% rename from tests/test-coreutils/src/settingregistry.spec.ts rename to tests/test-settingregistry/src/settingregistry.spec.ts index de32595f06ab..9d0873e1efd5 100644 --- a/tests/test-coreutils/src/settingregistry.spec.ts +++ b/tests/test-settingregistry/src/settingregistry.spec.ts @@ -3,13 +3,14 @@ import { expect } from 'chai'; +import { StateDB } from '@jupyterlab/coreutils'; + import { DefaultSchemaValidator, ISettingRegistry, SettingRegistry, - Settings, - StateDB -} from '@jupyterlab/coreutils'; + Settings +} from '@jupyterlab/settingregistry'; import { signalToPromise } from '@jupyterlab/testutils'; @@ -39,7 +40,7 @@ class TestConnector extends StateDB { } } -describe('@jupyterlab/coreutils', () => { +describe('@jupyterlab/settingregistry', () => { describe('DefaultSchemaValidator', () => { describe('#constructor()', () => { it('should create a new schema validator', () => { diff --git a/tests/test-settingregistry/tsconfig.json b/tests/test-settingregistry/tsconfig.json new file mode 100644 index 000000000000..876b7a9489a6 --- /dev/null +++ b/tests/test-settingregistry/tsconfig.json @@ -0,0 +1,25 @@ +{ + "extends": "../../tsconfigbase", + "compilerOptions": { + "outDir": "build", + "types": [ + "jest" + ], + "composite": false, + "rootDir": "src" + }, + "include": [ + "src/*" + ], + "references": [ + { + "path": "../../packages/coreutils" + }, + { + "path": "../../packages/settingregistry" + }, + { + "path": "../../testutils" + } + ] +} diff --git a/testutils/package.json b/testutils/package.json index 8e3dfa8ecf44..357d56ee0ef1 100644 --- a/testutils/package.json +++ b/testutils/package.json @@ -35,7 +35,6 @@ "@jupyterlab/cells": "^2.0.0-alpha.4", "@jupyterlab/codeeditor": "^2.0.0-alpha.4", "@jupyterlab/codemirror": "^2.0.0-alpha.4", - "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/docregistry": "^2.0.0-alpha.4", "@jupyterlab/nbformat": "^2.0.0-alpha.4", "@jupyterlab/notebook": "^2.0.0-alpha.4", diff --git a/testutils/tsconfig.json b/testutils/tsconfig.json index e547be308687..762331ab4497 100644 --- a/testutils/tsconfig.json +++ b/testutils/tsconfig.json @@ -24,9 +24,6 @@ { "path": "../packages/codemirror" }, - { - "path": "../packages/coreutils" - }, { "path": "../packages/docregistry" }, From f098918859fd2eadcad401ee5a3d746f64353ced Mon Sep 17 00:00:00 2001 From: Vidar Tonaas Fauske Date: Sun, 22 Dec 2019 15:51:59 +0000 Subject: [PATCH 07/13] Create package statedb --- dev_mode/package.json | 2 ++ packages/metapackage/package.json | 1 + packages/metapackage/tsconfig.json | 3 +++ packages/statedb/package.json | 42 ++++++++++++++++++++++++++++++ packages/statedb/src/index.ts | 4 +++ packages/statedb/tsconfig.json | 8 ++++++ 6 files changed, 60 insertions(+) create mode 100644 packages/statedb/package.json create mode 100644 packages/statedb/src/index.ts create mode 100644 packages/statedb/tsconfig.json diff --git a/dev_mode/package.json b/dev_mode/package.json index e3059a30c678..51e40e7c0ad7 100644 --- a/dev_mode/package.json +++ b/dev_mode/package.json @@ -155,6 +155,7 @@ "@jupyterlab/settingeditor-extension": "~2.0.0-alpha.4", "@jupyterlab/settingregistry": "~2.0.0-alpha.4", "@jupyterlab/shortcuts-extension": "~2.0.0-alpha.4", + "@jupyterlab/statedb": "~2.0.0-alpha.4", "@jupyterlab/statusbar": "~2.0.0-alpha.4", "@jupyterlab/statusbar-extension": "~2.0.0-alpha.4", "@jupyterlab/tabmanager-extension": "~2.0.0-alpha.4", @@ -343,6 +344,7 @@ "@jupyterlab/settingeditor-extension": "../packages/settingeditor-extension", "@jupyterlab/settingregistry": "../packages/settingregistry", "@jupyterlab/shortcuts-extension": "../packages/shortcuts-extension", + "@jupyterlab/statedb": "../packages/statedb", "@jupyterlab/statusbar": "../packages/statusbar", "@jupyterlab/statusbar-extension": "../packages/statusbar-extension", "@jupyterlab/tabmanager-extension": "../packages/tabmanager-extension", diff --git a/packages/metapackage/package.json b/packages/metapackage/package.json index acb4521c1108..e19298c61b73 100644 --- a/packages/metapackage/package.json +++ b/packages/metapackage/package.json @@ -98,6 +98,7 @@ "@jupyterlab/settingeditor-extension": "^2.0.0-alpha.4", "@jupyterlab/settingregistry": "^2.0.0-alpha.4", "@jupyterlab/shortcuts-extension": "^2.0.0-alpha.4", + "@jupyterlab/statedb": "^2.0.0-alpha.4", "@jupyterlab/statusbar": "^2.0.0-alpha.4", "@jupyterlab/statusbar-extension": "^2.0.0-alpha.4", "@jupyterlab/tabmanager-extension": "^2.0.0-alpha.4", diff --git a/packages/metapackage/tsconfig.json b/packages/metapackage/tsconfig.json index 7a043d5857b2..d020cade36f5 100644 --- a/packages/metapackage/tsconfig.json +++ b/packages/metapackage/tsconfig.json @@ -247,6 +247,9 @@ }, { "path": "../vega5-extension" + }, + { + "path": "../statedb" } ] } diff --git a/packages/statedb/package.json b/packages/statedb/package.json new file mode 100644 index 000000000000..ba5e8a837d95 --- /dev/null +++ b/packages/statedb/package.json @@ -0,0 +1,42 @@ +{ + "name": "@jupyterlab/statedb", + "version": "2.0.0-alpha.4", + "description": "Package for managing state in Jupyterlab", + "homepage": "https://github.com/jupyterlab/jupyterlab", + "bugs": { + "url": "https://github.com/jupyterlab/jupyterlab/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/jupyterlab/jupyterlab.git" + }, + "license": "BSD-3-Clause", + "author": "Project Jupyter", + "files": [ + "lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}", + "schema/*.json", + "style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}" + ], + "sideEffects": [ + "style/**/*" + ], + "main": "lib/index.js", + "types": "lib/index.d.ts", + "directories": { + "lib": "lib/" + }, + "scripts": { + "build": "tsc -b", + "clean": "rimraf lib && rimraf tsconfig.tsbuildinfo", + "docs": "typedoc src --tsconfig typedoc-tsconfig.json", + "prepublishOnly": "npm run build", + "watch": "tsc -b -w --listEmittedFiles" + }, + "devDependencies": { + "rimraf": "~3.0.0", + "typescript": "~3.7.3" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/statedb/src/index.ts b/packages/statedb/src/index.ts new file mode 100644 index 000000000000..215ca5d2e743 --- /dev/null +++ b/packages/statedb/src/index.ts @@ -0,0 +1,4 @@ +/*----------------------------------------------------------------------------- +| Copyright (c) Jupyter Development Team. +| Distributed under the terms of the Modified BSD License. +|----------------------------------------------------------------------------*/ diff --git a/packages/statedb/tsconfig.json b/packages/statedb/tsconfig.json new file mode 100644 index 000000000000..a1e4ba13c4bc --- /dev/null +++ b/packages/statedb/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfigbase", + "compilerOptions": { + "outDir": "lib", + "rootDir": "src" + }, + "include": ["src/*"] +} From 234100523ba175cf10ca1d52ab34617d9161870a Mon Sep 17 00:00:00 2001 From: Vidar Tonaas Fauske Date: Sun, 22 Dec 2019 16:27:11 +0000 Subject: [PATCH 08/13] Move StateDB code to new package --- dev_mode/package.json | 1 + packages/application-extension/package.json | 1 + packages/application-extension/src/index.tsx | 4 +- packages/application-extension/tsconfig.json | 3 + packages/application/package.json | 1 + packages/application/src/layoutrestorer.ts | 2 +- packages/application/tsconfig.json | 7 +- packages/apputils-extension/package.json | 1 + packages/apputils-extension/src/index.ts | 4 +- .../src/settingconnector.ts | 8 +- packages/apputils-extension/tsconfig.json | 3 + packages/apputils/package.json | 1 + packages/apputils/src/widgettracker.ts | 2 +- packages/apputils/src/windowresolver.ts | 2 +- packages/apputils/tsconfig.json | 3 + packages/completer/package.json | 1 + packages/completer/src/connector.ts | 2 +- packages/completer/src/contextconnector.ts | 2 +- packages/completer/src/handler.ts | 4 +- packages/completer/src/kernelconnector.ts | 2 +- packages/completer/src/tokens.ts | 2 +- packages/completer/tsconfig.json | 7 +- packages/coreutils/package.json | 3 - packages/coreutils/src/index.ts | 4 - packages/coreutils/src/interfaces.ts | 270 ----------------- packages/coreutils/tsconfig.json | 3 +- packages/filebrowser-extension/package.json | 1 + packages/filebrowser-extension/src/index.ts | 4 +- packages/filebrowser-extension/tsconfig.json | 3 + packages/filebrowser/package.json | 1 + packages/filebrowser/src/model.ts | 9 +- packages/filebrowser/src/tokens.ts | 2 +- packages/filebrowser/tsconfig.json | 7 +- packages/inspector/package.json | 1 + packages/inspector/src/handler.ts | 4 +- packages/inspector/src/kernelconnector.ts | 2 +- packages/inspector/tsconfig.json | 7 +- packages/metapackage/tsconfig.json | 6 +- packages/notebook-extension/package.json | 1 + packages/notebook-extension/src/index.ts | 4 +- packages/notebook-extension/tsconfig.json | 3 + packages/services/package.json | 1 + packages/services/src/setting/index.ts | 4 +- packages/services/src/workspace/index.ts | 4 +- packages/services/tsconfig.json | 3 + packages/settingeditor-extension/package.json | 4 +- packages/settingeditor-extension/src/index.ts | 2 +- .../settingeditor-extension/tsconfig.json | 6 +- packages/settingeditor/package.json | 2 +- packages/settingeditor/src/inspector.ts | 2 +- packages/settingeditor/src/settingeditor.tsx | 4 +- packages/settingeditor/tsconfig.json | 6 +- packages/settingregistry/package.json | 3 +- .../settingregistry/src/settingregistry.ts | 2 +- packages/settingregistry/src/tokens.ts | 2 +- packages/settingregistry/tsconfig.json | 2 +- packages/statedb/package.json | 12 +- .../src/dataconnector.ts | 0 packages/statedb/src/index.ts | 6 + packages/statedb/src/interfaces.ts | 272 ++++++++++++++++++ .../src/restorablepool.ts | 0 .../{coreutils => statedb}/src/statedb.ts | 0 packages/{coreutils => statedb}/src/tokens.ts | 0 packages/statedb/tsconfig.json | 4 +- tests/test-application/package.json | 2 +- .../src/layoutrestorer.spec.ts | 2 +- tests/test-application/tsconfig.json | 10 +- tests/test-coreutils/package.json | 2 - tests/test-filebrowser/package.json | 1 + tests/test-filebrowser/src/model.spec.ts | 4 +- tests/test-filebrowser/tsconfig.json | 11 +- tests/test-settingregistry/package.json | 2 +- .../src/settingregistry.spec.ts | 4 +- tests/test-settingregistry/tsconfig.json | 4 +- tests/test-statedb/babel.config.js | 1 + tests/test-statedb/jest.config.js | 2 + tests/test-statedb/package.json | 31 ++ tests/test-statedb/run.py | 8 + .../src/restorablepool.spec.ts | 2 +- .../src/statedb.spec.ts | 2 +- tests/test-statedb/tsconfig.json | 22 ++ 81 files changed, 497 insertions(+), 352 deletions(-) rename packages/{coreutils => statedb}/src/dataconnector.ts (100%) create mode 100644 packages/statedb/src/interfaces.ts rename packages/{coreutils => statedb}/src/restorablepool.ts (100%) rename packages/{coreutils => statedb}/src/statedb.ts (100%) rename packages/{coreutils => statedb}/src/tokens.ts (100%) create mode 100644 tests/test-statedb/babel.config.js create mode 100644 tests/test-statedb/jest.config.js create mode 100644 tests/test-statedb/package.json create mode 100644 tests/test-statedb/run.py rename tests/{test-coreutils => test-statedb}/src/restorablepool.spec.ts (99%) rename tests/{test-coreutils => test-statedb}/src/statedb.spec.ts (99%) create mode 100644 tests/test-statedb/tsconfig.json diff --git a/dev_mode/package.json b/dev_mode/package.json index 51e40e7c0ad7..8de123796414 100644 --- a/dev_mode/package.json +++ b/dev_mode/package.json @@ -390,6 +390,7 @@ "@jupyterlab/test-rendermime": "../tests/test-rendermime", "@jupyterlab/test-services": "../tests/test-services", "@jupyterlab/test-settingregistry": "../tests/test-settingregistry", + "@jupyterlab/test-statedb": "../tests/test-statedb", "@jupyterlab/test-statusbar": "../tests/test-statusbar", "@jupyterlab/test-terminal": "../tests/test-terminal", "@jupyterlab/testutils": "../testutils", diff --git a/packages/application-extension/package.json b/packages/application-extension/package.json index d6b52d4d0c4f..629adf5a868c 100644 --- a/packages/application-extension/package.json +++ b/packages/application-extension/package.json @@ -41,6 +41,7 @@ "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/property-inspector": "^2.0.0-alpha.4", "@jupyterlab/settingregistry": "^2.0.0-alpha.4", + "@jupyterlab/statedb": "^2.0.0-alpha.4", "@lumino/algorithm": "^1.2.1", "@lumino/coreutils": "^1.4.0", "@lumino/disposable": "^1.3.2", diff --git a/packages/application-extension/src/index.tsx b/packages/application-extension/src/index.tsx index 1dea06d5b112..a028990ccc28 100644 --- a/packages/application-extension/src/index.tsx +++ b/packages/application-extension/src/index.tsx @@ -24,7 +24,9 @@ import { showErrorMessage } from '@jupyterlab/apputils'; -import { PathExt, IStateDB, URLExt } from '@jupyterlab/coreutils'; +import { PathExt, URLExt } from '@jupyterlab/coreutils'; + +import { IStateDB } from '@jupyterlab/statedb'; import { ISettingRegistry } from '@jupyterlab/settingregistry'; diff --git a/packages/application-extension/tsconfig.json b/packages/application-extension/tsconfig.json index 2d5c2258ec76..f6ec47e4e198 100644 --- a/packages/application-extension/tsconfig.json +++ b/packages/application-extension/tsconfig.json @@ -22,6 +22,9 @@ }, { "path": "../settingregistry" + }, + { + "path": "../statedb" } ] } diff --git a/packages/application/package.json b/packages/application/package.json index 31795f188e27..f18ed5eea7f0 100644 --- a/packages/application/package.json +++ b/packages/application/package.json @@ -41,6 +41,7 @@ "@jupyterlab/rendermime": "^2.0.0-alpha.4", "@jupyterlab/rendermime-interfaces": "^2.0.0-alpha.4", "@jupyterlab/services": "^5.0.0-alpha.4", + "@jupyterlab/statedb": "^2.0.0-alpha.4", "@jupyterlab/ui-components": "^2.0.0-alpha.4", "@lumino/algorithm": "^1.2.1", "@lumino/application": "^1.7.4", diff --git a/packages/application/src/layoutrestorer.ts b/packages/application/src/layoutrestorer.ts index 37f9995bfb88..591fe98f9826 100644 --- a/packages/application/src/layoutrestorer.ts +++ b/packages/application/src/layoutrestorer.ts @@ -5,7 +5,7 @@ import { WidgetTracker } from '@jupyterlab/apputils'; -import { IDataConnector, IRestorer } from '@jupyterlab/coreutils'; +import { IDataConnector, IRestorer } from '@jupyterlab/statedb'; import { CommandRegistry } from '@lumino/commands'; diff --git a/packages/application/tsconfig.json b/packages/application/tsconfig.json index 27ada107b7cf..c7bd9e6d0976 100644 --- a/packages/application/tsconfig.json +++ b/packages/application/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../apputils" @@ -24,6 +26,9 @@ { "path": "../services" }, + { + "path": "../statedb" + }, { "path": "../ui-components" } diff --git a/packages/apputils-extension/package.json b/packages/apputils-extension/package.json index a39e258df909..549c1d31b40d 100644 --- a/packages/apputils-extension/package.json +++ b/packages/apputils-extension/package.json @@ -42,6 +42,7 @@ "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/mainmenu": "^2.0.0-alpha.4", "@jupyterlab/settingregistry": "^2.0.0-alpha.4", + "@jupyterlab/statedb": "^2.0.0-alpha.4", "@jupyterlab/ui-components": "^2.0.0-alpha.4", "@lumino/algorithm": "^1.2.1", "@lumino/commands": "^1.9.0", diff --git a/packages/apputils-extension/src/index.ts b/packages/apputils-extension/src/index.ts index 5c586a4375a9..48488cbc4d8e 100644 --- a/packages/apputils-extension/src/index.ts +++ b/packages/apputils-extension/src/index.ts @@ -19,7 +19,9 @@ import { Printing } from '@jupyterlab/apputils'; -import { IStateDB, StateDB, URLExt } from '@jupyterlab/coreutils'; +import { URLExt } from '@jupyterlab/coreutils'; + +import { IStateDB, StateDB } from '@jupyterlab/statedb'; import { defaultIconRegistry } from '@jupyterlab/ui-components'; diff --git a/packages/apputils-extension/src/settingconnector.ts b/packages/apputils-extension/src/settingconnector.ts index 1011b3d485c8..d64cf1ee8a0d 100644 --- a/packages/apputils-extension/src/settingconnector.ts +++ b/packages/apputils-extension/src/settingconnector.ts @@ -1,8 +1,6 @@ -import { - DataConnector, - IDataConnector, - PageConfig -} from '@jupyterlab/coreutils'; +import { PageConfig } from '@jupyterlab/coreutils'; + +import { DataConnector, IDataConnector } from '@jupyterlab/statedb'; import { ISettingRegistry } from '@jupyterlab/settingregistry'; diff --git a/packages/apputils-extension/tsconfig.json b/packages/apputils-extension/tsconfig.json index 985f9f999bc2..de0449d11f18 100644 --- a/packages/apputils-extension/tsconfig.json +++ b/packages/apputils-extension/tsconfig.json @@ -23,6 +23,9 @@ { "path": "../settingregistry" }, + { + "path": "../statedb" + }, { "path": "../ui-components" } diff --git a/packages/apputils/package.json b/packages/apputils/package.json index e2990f7bf56b..2844f797bf8d 100644 --- a/packages/apputils/package.json +++ b/packages/apputils/package.json @@ -38,6 +38,7 @@ "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/services": "^5.0.0-alpha.4", "@jupyterlab/settingregistry": "^2.0.0-alpha.4", + "@jupyterlab/statedb": "^2.0.0-alpha.4", "@jupyterlab/ui-components": "^2.0.0-alpha.4", "@lumino/algorithm": "^1.2.1", "@lumino/commands": "^1.9.0", diff --git a/packages/apputils/src/widgettracker.ts b/packages/apputils/src/widgettracker.ts index b5e13854afe2..e5e228077c52 100644 --- a/packages/apputils/src/widgettracker.ts +++ b/packages/apputils/src/widgettracker.ts @@ -1,7 +1,7 @@ // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. -import { IRestorable, RestorablePool } from '@jupyterlab/coreutils'; +import { IRestorable, RestorablePool } from '@jupyterlab/statedb'; import { IDisposable } from '@lumino/disposable'; diff --git a/packages/apputils/src/windowresolver.ts b/packages/apputils/src/windowresolver.ts index 7f590d1057a1..d6b869c32844 100644 --- a/packages/apputils/src/windowresolver.ts +++ b/packages/apputils/src/windowresolver.ts @@ -64,7 +64,7 @@ namespace Private { /** * The internal prefix for private local storage keys. */ - const PREFIX = '@jupyterlab/coreutils:StateDB'; + const PREFIX = '@jupyterlab/statedb:StateDB'; /** * The local storage beacon key. diff --git a/packages/apputils/tsconfig.json b/packages/apputils/tsconfig.json index 357a46ee0ba6..0e311f25e0bc 100644 --- a/packages/apputils/tsconfig.json +++ b/packages/apputils/tsconfig.json @@ -17,6 +17,9 @@ { "path": "../settingregistry" }, + { + "path": "../statedb" + }, { "path": "../ui-components" } diff --git a/packages/completer/package.json b/packages/completer/package.json index a879bd944cb8..8dfd9a8231ba 100644 --- a/packages/completer/package.json +++ b/packages/completer/package.json @@ -39,6 +39,7 @@ "@jupyterlab/codeeditor": "^2.0.0-alpha.4", "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/services": "^5.0.0-alpha.4", + "@jupyterlab/statedb": "^2.0.0-alpha.4", "@lumino/algorithm": "^1.2.1", "@lumino/coreutils": "^1.4.0", "@lumino/disposable": "^1.3.2", diff --git a/packages/completer/src/connector.ts b/packages/completer/src/connector.ts index 8fe063e1a7a1..2fd422ee27ed 100644 --- a/packages/completer/src/connector.ts +++ b/packages/completer/src/connector.ts @@ -1,7 +1,7 @@ // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. -import { DataConnector } from '@jupyterlab/coreutils'; +import { DataConnector } from '@jupyterlab/statedb'; import { KernelConnector } from './kernelconnector'; diff --git a/packages/completer/src/contextconnector.ts b/packages/completer/src/contextconnector.ts index f2c04bdf2388..7bd8e58232f0 100644 --- a/packages/completer/src/contextconnector.ts +++ b/packages/completer/src/contextconnector.ts @@ -3,7 +3,7 @@ import { CodeEditor } from '@jupyterlab/codeeditor'; -import { DataConnector } from '@jupyterlab/coreutils'; +import { DataConnector } from '@jupyterlab/statedb'; import { CompletionHandler } from './handler'; diff --git a/packages/completer/src/handler.ts b/packages/completer/src/handler.ts index a1cc82279440..979bef5b6ac1 100644 --- a/packages/completer/src/handler.ts +++ b/packages/completer/src/handler.ts @@ -3,7 +3,9 @@ import { CodeEditor } from '@jupyterlab/codeeditor'; -import { IDataConnector, Text } from '@jupyterlab/coreutils'; +import { Text } from '@jupyterlab/coreutils'; + +import { IDataConnector } from '@jupyterlab/statedb'; import { ReadonlyJSONObject, JSONObject, JSONArray } from '@lumino/coreutils'; diff --git a/packages/completer/src/kernelconnector.ts b/packages/completer/src/kernelconnector.ts index 99877c976d65..3a9348cb688b 100644 --- a/packages/completer/src/kernelconnector.ts +++ b/packages/completer/src/kernelconnector.ts @@ -1,7 +1,7 @@ // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. -import { DataConnector } from '@jupyterlab/coreutils'; +import { DataConnector } from '@jupyterlab/statedb'; import { KernelMessage, Session } from '@jupyterlab/services'; diff --git a/packages/completer/src/tokens.ts b/packages/completer/src/tokens.ts index 8579725199d6..0b234a1ac7bc 100644 --- a/packages/completer/src/tokens.ts +++ b/packages/completer/src/tokens.ts @@ -3,7 +3,7 @@ import { CodeEditor } from '@jupyterlab/codeeditor'; -import { IDataConnector } from '@jupyterlab/coreutils'; +import { IDataConnector } from '@jupyterlab/statedb'; import { Token } from '@lumino/coreutils'; diff --git a/packages/completer/tsconfig.json b/packages/completer/tsconfig.json index edad9823e338..fed74f8d43bb 100644 --- a/packages/completer/tsconfig.json +++ b/packages/completer/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../apputils" @@ -17,6 +19,9 @@ }, { "path": "../services" + }, + { + "path": "../statedb" } ] } diff --git a/packages/coreutils/package.json b/packages/coreutils/package.json index 1cb11016e2d7..deb020c99a02 100644 --- a/packages/coreutils/package.json +++ b/packages/coreutils/package.json @@ -32,10 +32,8 @@ "watch": "tsc -b --watch" }, "dependencies": { - "@lumino/commands": "^1.9.0", "@lumino/coreutils": "^1.4.0", "@lumino/disposable": "^1.3.2", - "@lumino/properties": "^1.1.4", "@lumino/signaling": "^1.3.2", "minimist": "~1.2.0", "moment": "^2.24.0", @@ -43,7 +41,6 @@ "url-parse": "~1.4.7" }, "devDependencies": { - "@types/json5": "^0.0.30", "@types/minimist": "^1.2.0", "rimraf": "~3.0.0", "typedoc": "^0.15.4", diff --git a/packages/coreutils/src/index.ts b/packages/coreutils/src/index.ts index 865af4558863..4bdb99870561 100644 --- a/packages/coreutils/src/index.ts +++ b/packages/coreutils/src/index.ts @@ -2,14 +2,10 @@ // Distributed under the terms of the Modified BSD License. export * from './activitymonitor'; -export * from './dataconnector'; export * from './interfaces'; export * from './markdowncodeblocks'; export * from './pageconfig'; export * from './path'; -export * from './restorablepool'; -export * from './statedb'; export * from './text'; export * from './time'; -export * from './tokens'; export * from './url'; diff --git a/packages/coreutils/src/interfaces.ts b/packages/coreutils/src/interfaces.ts index 86a816e555c8..3a1356bc4d4a 100644 --- a/packages/coreutils/src/interfaces.ts +++ b/packages/coreutils/src/interfaces.ts @@ -1,17 +1,6 @@ // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. -import { CommandRegistry } from '@lumino/commands'; - -import { - ReadonlyPartialJSONObject, - ReadonlyPartialJSONValue -} from '@lumino/coreutils'; - -import { IDisposable, IObservableDisposable } from '@lumino/disposable'; - -import { ISignal } from '@lumino/signaling'; - /** * A generic interface for change emitter payloads. */ @@ -31,262 +20,3 @@ export interface IChangedArgs { */ newValue: T; } - -/** - * The description of a general purpose data connector. - * - * @typeparam T - The basic entity response type a service's connector. - * - * @typeparam U - The basic entity request type, which is conventionally the - * same as the response type but may be different if a service's implementation - * requires input data to be different from output responses. Defaults to `T`. - * - * @typeparam V - The basic token applied to a request, conventionally a string - * ID or filter, but may be set to a different type when an implementation - * requires it. Defaults to `string`. - * - * @typeparam W - The type of the optional `query` parameter of the `list` - * method. Defaults to `string`; - */ -export interface IDataConnector { - /** - * Retrieve an item from the data connector. - * - * @param id - The identifier used to retrieve an item. - * - * @returns A promise that bears a data payload if available. - * - * #### Notes - * The promise returned by this method may be rejected if an error occurs in - * retrieving the data. Nonexistence of an `id` resolves with `undefined`. - */ - fetch(id: V): Promise; - - /** - * Retrieve the list of items available from the data connector. - * - * @param query - The optional query filter to apply to the connector request. - * - * @returns A promise that bears a list of `values` and an associated list of - * fetch `ids`. - * - * #### Notes - * The promise returned by this method may be rejected if an error occurs in - * retrieving the data. The two lists will always be the same size. If there - * is no data, this method will succeed with empty `ids` and `values`. - */ - list(query?: W): Promise<{ ids: V[]; values: T[] }>; - - /** - * Remove a value using the data connector. - * - * @param id - The identifier for the data being removed. - * - * @returns A promise that is rejected if remove fails and succeeds otherwise. - * - * #### Notes - * This promise may resolve with a back-end response or `undefined`. - * Existence of resolved content in the promise is not prescribed and must be - * tested for. For example, some back-ends may return a copy of the item of - * type `T` being removed while others may return no content. - */ - remove(id: V): Promise; - - /** - * Save a value using the data connector. - * - * @param id - The identifier for the data being saved. - * - * @param value - The data being saved. - * - * @returns A promise that is rejected if saving fails and succeeds otherwise. - * - * #### Notes - * This promise may resolve with a back-end response or `undefined`. - * Existence of resolved content in the promise is not prescribed and must be - * tested for. For example, some back-ends may return a copy of the item of - * type `T` being saved while others may return no content. - */ - save(id: V, value: U): Promise; -} - -/** - * A pool of objects whose disposable lifecycle is tracked. - * - * @typeparam T - The type of object held in the pool. - */ -export interface IObjectPool - extends IDisposable { - /** - * A signal emitted when an object is added. - * - * #### - * This signal does not emit if an object is added using `inject()`. - */ - readonly added: ISignal; - - /** - * The current object. - */ - readonly current: T | null; - - /** - * A signal emitted when the current object changes. - * - * #### Notes - * If the last object being tracked is disposed, `null` will be emitted. - */ - readonly currentChanged: ISignal; - - /** - * The number of objects held by the pool. - */ - readonly size: number; - - /** - * A signal emitted when an object is updated. - */ - readonly updated: ISignal; - - /** - * Find the first object in the pool that satisfies a filter function. - * - * @param - fn The filter function to call on each object. - * - * #### Notes - * If nothing is found, the value returned is `undefined`. - */ - find(fn: (obj: T) => boolean): T | undefined; - - /** - * Iterate through each object in the pool. - * - * @param fn - The function to call on each object. - */ - forEach(fn: (obj: T) => void): void; - - /** - * Filter the objects in the pool based on a predicate. - * - * @param fn - The function by which to filter. - */ - filter(fn: (obj: T) => boolean): T[]; - - /** - * Check if this pool has the specified object. - * - * @param obj - The object whose existence is being checked. - */ - has(obj: T): boolean; -} - -/** - * An interface for a state restorer. - * - * @typeparam T - The restorable collection's type. - * - * @typeparam U - The type of object held by the restorable collection. - * - * @typeparam V - The `restored` promise resolution type. Defaults to `any`. - */ -export interface IRestorer< - T extends IRestorable = IRestorable, - U extends IObservableDisposable = IObservableDisposable, - V = any -> { - /** - * Restore the objects in a given restorable collection. - * - * @param restorable - The restorable collection being restored. - * - * @param options - The configuration options that describe restoration. - * - * @returns A promise that settles when restored with `any` results. - * - */ - restore(restorable: T, options: IRestorable.IOptions): Promise; - - /** - * A promise that settles when the collection has been restored. - */ - readonly restored: Promise; -} - -/** - * A namespace for `IRestorer` interface definitions. - */ -export namespace IRestorer { - /** - * The state restoration configuration options. - * - * @typeparam T - The type of object held by the restorable collection. - */ - export interface IOptions { - /** - * The command to execute when restoring instances. - */ - command: string; - - /** - * A function that returns the args needed to restore an instance. - */ - args?: (obj: T) => ReadonlyPartialJSONObject; - - /** - * A function that returns a unique persistent name for this instance. - */ - name: (obj: T) => string; - - /** - * The point after which it is safe to restore state. - */ - when?: Promise | Array>; - } -} - -/** - * An interface for objects that can be restored. - * - * @typeparam T - The type of object held by the restorable collection. - * - * @typeparam U - The `restored` promise resolution type. Defaults to `any`. - */ -export interface IRestorable { - /** - * Restore the objects in this restorable collection. - * - * @param options - The configuration options that describe restoration. - * - * @returns A promise that settles when restored with `any` results. - * - */ - restore(options: IRestorable.IOptions): Promise; - - /** - * A promise that settles when the collection has been restored. - */ - readonly restored: Promise; -} - -/** - * A namespace for `IRestorable` interface definitions. - */ -export namespace IRestorable { - /** - * The state restoration configuration options. - * - * @typeparam T - The type of object held by the restorable collection. - */ - export interface IOptions - extends IRestorer.IOptions { - /** - * The data connector to fetch restore data. - */ - connector: IDataConnector; - - /** - * The command registry which holds the restore command. - */ - registry: CommandRegistry; - } -} diff --git a/packages/coreutils/tsconfig.json b/packages/coreutils/tsconfig.json index 216bdd12d9e3..b58a898918f4 100644 --- a/packages/coreutils/tsconfig.json +++ b/packages/coreutils/tsconfig.json @@ -3,8 +3,7 @@ "compilerOptions": { "outDir": "lib", "rootDir": "src", - "module": "commonjs", - "types": ["node"] + "module": "commonjs" }, "include": ["src/*"] } diff --git a/packages/filebrowser-extension/package.json b/packages/filebrowser-extension/package.json index 5ca15745db47..da31d98ac2f6 100644 --- a/packages/filebrowser-extension/package.json +++ b/packages/filebrowser-extension/package.json @@ -45,6 +45,7 @@ "@jupyterlab/mainmenu": "^2.0.0-alpha.4", "@jupyterlab/services": "^5.0.0-alpha.4", "@jupyterlab/settingregistry": "^2.0.0-alpha.4", + "@jupyterlab/statedb": "^2.0.0-alpha.4", "@jupyterlab/statusbar": "^2.0.0-alpha.4", "@jupyterlab/ui-components": "^2.0.0-alpha.4", "@lumino/algorithm": "^1.2.1", diff --git a/packages/filebrowser-extension/src/index.ts b/packages/filebrowser-extension/src/index.ts index a055c51f28e6..8f0789c48e8d 100644 --- a/packages/filebrowser-extension/src/index.ts +++ b/packages/filebrowser-extension/src/index.ts @@ -19,7 +19,7 @@ import { showErrorMessage } from '@jupyterlab/apputils'; -import { IStateDB, PageConfig, PathExt, URLExt } from '@jupyterlab/coreutils'; +import { PageConfig, PathExt, URLExt } from '@jupyterlab/coreutils'; import { IDocumentManager } from '@jupyterlab/docmanager'; @@ -38,6 +38,8 @@ import { Contents } from '@jupyterlab/services'; import { ISettingRegistry } from '@jupyterlab/settingregistry'; +import { IStateDB } from '@jupyterlab/statedb'; + import { IStatusBar } from '@jupyterlab/statusbar'; import { IIconRegistry } from '@jupyterlab/ui-components'; diff --git a/packages/filebrowser-extension/tsconfig.json b/packages/filebrowser-extension/tsconfig.json index 0d201e316802..8bf69acf192c 100644 --- a/packages/filebrowser-extension/tsconfig.json +++ b/packages/filebrowser-extension/tsconfig.json @@ -35,6 +35,9 @@ { "path": "../settingregistry" }, + { + "path": "../statedb" + }, { "path": "../statusbar" }, diff --git a/packages/filebrowser/package.json b/packages/filebrowser/package.json index 907932ba3b9a..a09785d9529e 100644 --- a/packages/filebrowser/package.json +++ b/packages/filebrowser/package.json @@ -40,6 +40,7 @@ "@jupyterlab/docmanager": "^2.0.0-alpha.4", "@jupyterlab/docregistry": "^2.0.0-alpha.4", "@jupyterlab/services": "^5.0.0-alpha.4", + "@jupyterlab/statedb": "^2.0.0-alpha.4", "@jupyterlab/statusbar": "^2.0.0-alpha.4", "@jupyterlab/ui-components": "^2.0.0-alpha.4", "@lumino/algorithm": "^1.2.1", diff --git a/packages/filebrowser/src/model.ts b/packages/filebrowser/src/model.ts index 057f69148afb..750b8d9dfee6 100644 --- a/packages/filebrowser/src/model.ts +++ b/packages/filebrowser/src/model.ts @@ -3,17 +3,14 @@ import { showDialog, Dialog } from '@jupyterlab/apputils'; -import { - IChangedArgs, - IStateDB, - PathExt, - PageConfig -} from '@jupyterlab/coreutils'; +import { IChangedArgs, PathExt, PageConfig } from '@jupyterlab/coreutils'; import { IDocumentManager, shouldOverwrite } from '@jupyterlab/docmanager'; import { Contents, KernelSpec, Session } from '@jupyterlab/services'; +import { IStateDB } from '@jupyterlab/statedb'; + import { IIconRegistry } from '@jupyterlab/ui-components'; import { diff --git a/packages/filebrowser/src/tokens.ts b/packages/filebrowser/src/tokens.ts index fa2f4d712d0d..f8b37af4ef29 100644 --- a/packages/filebrowser/src/tokens.ts +++ b/packages/filebrowser/src/tokens.ts @@ -3,7 +3,7 @@ import { WidgetTracker } from '@jupyterlab/apputils'; -import { IStateDB } from '@jupyterlab/coreutils'; +import { IStateDB } from '@jupyterlab/statedb'; import { Token } from '@lumino/coreutils'; diff --git a/packages/filebrowser/tsconfig.json b/packages/filebrowser/tsconfig.json index 19a64feeabb3..504b8b77c6e5 100644 --- a/packages/filebrowser/tsconfig.json +++ b/packages/filebrowser/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../apputils" @@ -21,6 +23,9 @@ { "path": "../services" }, + { + "path": "../statedb" + }, { "path": "../statusbar" }, diff --git a/packages/inspector/package.json b/packages/inspector/package.json index ab9e70fc1804..4bf712f3133d 100644 --- a/packages/inspector/package.json +++ b/packages/inspector/package.json @@ -40,6 +40,7 @@ "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/rendermime": "^2.0.0-alpha.4", "@jupyterlab/services": "^5.0.0-alpha.4", + "@jupyterlab/statedb": "^2.0.0-alpha.4", "@lumino/coreutils": "^1.4.0", "@lumino/disposable": "^1.3.2", "@lumino/polling": "^1.0.1", diff --git a/packages/inspector/src/handler.ts b/packages/inspector/src/handler.ts index 7b78fbde21a4..981c9e828c6d 100644 --- a/packages/inspector/src/handler.ts +++ b/packages/inspector/src/handler.ts @@ -3,7 +3,9 @@ import { CodeEditor } from '@jupyterlab/codeeditor'; -import { IDataConnector, Text } from '@jupyterlab/coreutils'; +import { Text } from '@jupyterlab/coreutils'; + +import { IDataConnector } from '@jupyterlab/statedb'; import { MimeModel, IRenderMimeRegistry } from '@jupyterlab/rendermime'; diff --git a/packages/inspector/src/kernelconnector.ts b/packages/inspector/src/kernelconnector.ts index c6881a8ad420..f31f3e0fbf5a 100644 --- a/packages/inspector/src/kernelconnector.ts +++ b/packages/inspector/src/kernelconnector.ts @@ -3,7 +3,7 @@ import { ISessionContext } from '@jupyterlab/apputils'; -import { DataConnector } from '@jupyterlab/coreutils'; +import { DataConnector } from '@jupyterlab/statedb'; import { KernelMessage } from '@jupyterlab/services'; diff --git a/packages/inspector/tsconfig.json b/packages/inspector/tsconfig.json index 74c0bf9cb2a4..bdaf25815058 100644 --- a/packages/inspector/tsconfig.json +++ b/packages/inspector/tsconfig.json @@ -4,7 +4,9 @@ "outDir": "lib", "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../apputils" @@ -20,6 +22,9 @@ }, { "path": "../services" + }, + { + "path": "../statedb" } ] } diff --git a/packages/metapackage/tsconfig.json b/packages/metapackage/tsconfig.json index d020cade36f5..86292b032d08 100644 --- a/packages/metapackage/tsconfig.json +++ b/packages/metapackage/tsconfig.json @@ -206,6 +206,9 @@ { "path": "../shortcuts-extension" }, + { + "path": "../statedb" + }, { "path": "../statusbar" }, @@ -247,9 +250,6 @@ }, { "path": "../vega5-extension" - }, - { - "path": "../statedb" } ] } diff --git a/packages/notebook-extension/package.json b/packages/notebook-extension/package.json index fb408cad0812..da5e63f01a31 100644 --- a/packages/notebook-extension/package.json +++ b/packages/notebook-extension/package.json @@ -51,6 +51,7 @@ "@jupyterlab/rendermime": "^2.0.0-alpha.4", "@jupyterlab/services": "^5.0.0-alpha.4", "@jupyterlab/settingregistry": "^2.0.0-alpha.4", + "@jupyterlab/statedb": "^2.0.0-alpha.4", "@jupyterlab/statusbar": "^2.0.0-alpha.4", "@lumino/algorithm": "^1.2.1", "@lumino/commands": "^1.9.0", diff --git a/packages/notebook-extension/src/index.ts b/packages/notebook-extension/src/index.ts index e974ef8e5b44..3e02c7460e87 100644 --- a/packages/notebook-extension/src/index.ts +++ b/packages/notebook-extension/src/index.ts @@ -20,7 +20,7 @@ import { CodeCell } from '@jupyterlab/cells'; import { IEditorServices } from '@jupyterlab/codeeditor'; -import { IStateDB, PageConfig, URLExt } from '@jupyterlab/coreutils'; +import { PageConfig, URLExt } from '@jupyterlab/coreutils'; import { IDocumentManager } from '@jupyterlab/docmanager'; @@ -28,6 +28,8 @@ import * as nbformat from '@jupyterlab/nbformat'; import { ISettingRegistry } from '@jupyterlab/settingregistry'; +import { IStateDB } from '@jupyterlab/statedb'; + import { ArrayExt } from '@lumino/algorithm'; import { diff --git a/packages/notebook-extension/tsconfig.json b/packages/notebook-extension/tsconfig.json index f97ba6aed3d2..0c3487df9727 100644 --- a/packages/notebook-extension/tsconfig.json +++ b/packages/notebook-extension/tsconfig.json @@ -53,6 +53,9 @@ { "path": "../settingregistry" }, + { + "path": "../statedb" + }, { "path": "../statusbar" } diff --git a/packages/services/package.json b/packages/services/package.json index 40323a2d688a..d5d7afe1a2e4 100644 --- a/packages/services/package.json +++ b/packages/services/package.json @@ -45,6 +45,7 @@ "@jupyterlab/nbformat": "^2.0.0-alpha.4", "@jupyterlab/observables": "^3.0.0-alpha.4", "@jupyterlab/settingregistry": "^2.0.0-alpha.4", + "@jupyterlab/statedb": "^2.0.0-alpha.4", "@lumino/algorithm": "^1.2.1", "@lumino/coreutils": "^1.4.0", "@lumino/disposable": "^1.3.2", diff --git a/packages/services/src/setting/index.ts b/packages/services/src/setting/index.ts index 1666e91678f0..edb4977eae4c 100644 --- a/packages/services/src/setting/index.ts +++ b/packages/services/src/setting/index.ts @@ -1,10 +1,12 @@ // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. -import { DataConnector, URLExt } from '@jupyterlab/coreutils'; +import { URLExt } from '@jupyterlab/coreutils'; import { ISettingRegistry } from '@jupyterlab/settingregistry'; +import { DataConnector } from '@jupyterlab/statedb'; + import { ServerConnection } from '../serverconnection'; /** diff --git a/packages/services/src/workspace/index.ts b/packages/services/src/workspace/index.ts index 37445fa0b62e..dd609e253349 100644 --- a/packages/services/src/workspace/index.ts +++ b/packages/services/src/workspace/index.ts @@ -1,7 +1,9 @@ // Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. -import { DataConnector, URLExt } from '@jupyterlab/coreutils'; +import { URLExt } from '@jupyterlab/coreutils'; + +import { DataConnector } from '@jupyterlab/statedb'; import { ReadonlyPartialJSONObject } from '@lumino/coreutils'; diff --git a/packages/services/tsconfig.json b/packages/services/tsconfig.json index 1f243b8690d7..e41565795417 100644 --- a/packages/services/tsconfig.json +++ b/packages/services/tsconfig.json @@ -23,6 +23,9 @@ }, { "path": "../settingregistry" + }, + { + "path": "../statedb" } ] } diff --git a/packages/settingeditor-extension/package.json b/packages/settingeditor-extension/package.json index 717089ea5fa6..2a4f5175b21c 100644 --- a/packages/settingeditor-extension/package.json +++ b/packages/settingeditor-extension/package.json @@ -39,10 +39,10 @@ "@jupyterlab/application": "^2.0.0-alpha.4", "@jupyterlab/apputils": "^2.0.0-alpha.4", "@jupyterlab/codeeditor": "^2.0.0-alpha.4", - "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/rendermime": "^2.0.0-alpha.4", "@jupyterlab/settingeditor": "^2.0.0-alpha.4", - "@jupyterlab/settingregistry": "^2.0.0-alpha.4" + "@jupyterlab/settingregistry": "^2.0.0-alpha.4", + "@jupyterlab/statedb": "^2.0.0-alpha.4" }, "devDependencies": { "rimraf": "~3.0.0", diff --git a/packages/settingeditor-extension/src/index.ts b/packages/settingeditor-extension/src/index.ts index 0bc35d9627c5..7fe2b7ce7e56 100644 --- a/packages/settingeditor-extension/src/index.ts +++ b/packages/settingeditor-extension/src/index.ts @@ -17,7 +17,7 @@ import { import { IEditorServices } from '@jupyterlab/codeeditor'; -import { IStateDB } from '@jupyterlab/coreutils'; +import { IStateDB } from '@jupyterlab/statedb'; import { IRenderMimeRegistry } from '@jupyterlab/rendermime'; diff --git a/packages/settingeditor-extension/tsconfig.json b/packages/settingeditor-extension/tsconfig.json index c65be496328e..a6e3dce510be 100644 --- a/packages/settingeditor-extension/tsconfig.json +++ b/packages/settingeditor-extension/tsconfig.json @@ -17,9 +17,6 @@ { "path": "../codeeditor" }, - { - "path": "../coreutils" - }, { "path": "../rendermime" }, @@ -28,6 +25,9 @@ }, { "path": "../settingregistry" + }, + { + "path": "../statedb" } ] } diff --git a/packages/settingeditor/package.json b/packages/settingeditor/package.json index 028835d1e105..ff584f27b819 100644 --- a/packages/settingeditor/package.json +++ b/packages/settingeditor/package.json @@ -37,10 +37,10 @@ "dependencies": { "@jupyterlab/apputils": "^2.0.0-alpha.4", "@jupyterlab/codeeditor": "^2.0.0-alpha.4", - "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/inspector": "^2.0.0-alpha.4", "@jupyterlab/rendermime": "^2.0.0-alpha.4", "@jupyterlab/settingregistry": "^2.0.0-alpha.4", + "@jupyterlab/statedb": "^2.0.0-alpha.4", "@jupyterlab/ui-components": "^2.0.0-alpha.4", "@lumino/commands": "^1.9.0", "@lumino/coreutils": "^1.4.0", diff --git a/packages/settingeditor/src/inspector.ts b/packages/settingeditor/src/inspector.ts index 86d81b9c10f0..d82f492c1398 100644 --- a/packages/settingeditor/src/inspector.ts +++ b/packages/settingeditor/src/inspector.ts @@ -3,7 +3,7 @@ | Distributed under the terms of the Modified BSD License. |----------------------------------------------------------------------------*/ -import { DataConnector } from '@jupyterlab/coreutils'; +import { DataConnector } from '@jupyterlab/statedb'; import { InspectionHandler, InspectorPanel } from '@jupyterlab/inspector'; diff --git a/packages/settingeditor/src/settingeditor.tsx b/packages/settingeditor/src/settingeditor.tsx index 1e55920835bc..522055ecb960 100644 --- a/packages/settingeditor/src/settingeditor.tsx +++ b/packages/settingeditor/src/settingeditor.tsx @@ -5,12 +5,12 @@ import { CodeEditor } from '@jupyterlab/codeeditor'; -import { IStateDB } from '@jupyterlab/coreutils'; - import { IRenderMimeRegistry } from '@jupyterlab/rendermime'; import { ISettingRegistry } from '@jupyterlab/settingregistry'; +import { IStateDB } from '@jupyterlab/statedb'; + import { CommandRegistry } from '@lumino/commands'; import { JSONExt, JSONObject, JSONValue } from '@lumino/coreutils'; diff --git a/packages/settingeditor/tsconfig.json b/packages/settingeditor/tsconfig.json index 2bc96aa088d1..c3cd49d20729 100644 --- a/packages/settingeditor/tsconfig.json +++ b/packages/settingeditor/tsconfig.json @@ -14,9 +14,6 @@ { "path": "../codeeditor" }, - { - "path": "../coreutils" - }, { "path": "../inspector" }, @@ -26,6 +23,9 @@ { "path": "../settingregistry" }, + { + "path": "../statedb" + }, { "path": "../ui-components" } diff --git a/packages/settingregistry/package.json b/packages/settingregistry/package.json index 54fe37180d9b..a31d77a9de40 100644 --- a/packages/settingregistry/package.json +++ b/packages/settingregistry/package.json @@ -31,7 +31,7 @@ "watch": "tsc -b -w --listEmittedFiles" }, "dependencies": { - "@jupyterlab/coreutils": "^4.0.0-alpha.4", + "@jupyterlab/statedb": "^2.0.0-alpha.4", "@lumino/coreutils": "^1.4.0", "@lumino/disposable": "^1.3.2", "@lumino/signaling": "^1.3.2", @@ -39,6 +39,7 @@ "json5": "^2.1.1" }, "devDependencies": { + "@types/json5": "^0.0.30", "rimraf": "~3.0.0", "typescript": "~3.7.3" }, diff --git a/packages/settingregistry/src/settingregistry.ts b/packages/settingregistry/src/settingregistry.ts index 066c83a93ec4..c6499c31ae8d 100644 --- a/packages/settingregistry/src/settingregistry.ts +++ b/packages/settingregistry/src/settingregistry.ts @@ -22,7 +22,7 @@ import { DisposableDelegate, IDisposable } from '@lumino/disposable'; import { ISignal, Signal } from '@lumino/signaling'; -import { IDataConnector } from '@jupyterlab/coreutils'; +import { IDataConnector } from '@jupyterlab/statedb'; import { ISettingRegistry } from './tokens'; diff --git a/packages/settingregistry/src/tokens.ts b/packages/settingregistry/src/tokens.ts index 9fa6d1347fb8..a6dea7895834 100644 --- a/packages/settingregistry/src/tokens.ts +++ b/packages/settingregistry/src/tokens.ts @@ -15,7 +15,7 @@ import { IDisposable } from '@lumino/disposable'; import { ISignal } from '@lumino/signaling'; -import { IDataConnector } from '@jupyterlab/coreutils'; +import { IDataConnector } from '@jupyterlab/statedb'; import { ISchemaValidator } from './settingregistry'; diff --git a/packages/settingregistry/tsconfig.json b/packages/settingregistry/tsconfig.json index 8591e8ba00e7..42e4e99f144d 100644 --- a/packages/settingregistry/tsconfig.json +++ b/packages/settingregistry/tsconfig.json @@ -12,7 +12,7 @@ ], "references": [ { - "path": "../coreutils" + "path": "../statedb" } ] } diff --git a/packages/statedb/package.json b/packages/statedb/package.json index ba5e8a837d95..9df277fc2606 100644 --- a/packages/statedb/package.json +++ b/packages/statedb/package.json @@ -17,9 +17,7 @@ "schema/*.json", "style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}" ], - "sideEffects": [ - "style/**/*" - ], + "sideEffects": false, "main": "lib/index.js", "types": "lib/index.d.ts", "directories": { @@ -32,8 +30,16 @@ "prepublishOnly": "npm run build", "watch": "tsc -b -w --listEmittedFiles" }, + "dependencies": { + "@lumino/commands": "^1.9.0", + "@lumino/coreutils": "^1.4.0", + "@lumino/disposable": "^1.3.2", + "@lumino/properties": "^1.1.4", + "@lumino/signaling": "^1.3.2" + }, "devDependencies": { "rimraf": "~3.0.0", + "typedoc": "^0.15.4", "typescript": "~3.7.3" }, "publishConfig": { diff --git a/packages/coreutils/src/dataconnector.ts b/packages/statedb/src/dataconnector.ts similarity index 100% rename from packages/coreutils/src/dataconnector.ts rename to packages/statedb/src/dataconnector.ts diff --git a/packages/statedb/src/index.ts b/packages/statedb/src/index.ts index 215ca5d2e743..2ec63766c530 100644 --- a/packages/statedb/src/index.ts +++ b/packages/statedb/src/index.ts @@ -2,3 +2,9 @@ | Copyright (c) Jupyter Development Team. | Distributed under the terms of the Modified BSD License. |----------------------------------------------------------------------------*/ + +export * from './dataconnector'; +export * from './interfaces'; +export * from './restorablepool'; +export * from './statedb'; +export * from './tokens'; diff --git a/packages/statedb/src/interfaces.ts b/packages/statedb/src/interfaces.ts new file mode 100644 index 000000000000..623d0ec96d60 --- /dev/null +++ b/packages/statedb/src/interfaces.ts @@ -0,0 +1,272 @@ +// Copyright (c) Jupyter Development Team. +// Distributed under the terms of the Modified BSD License. + +import { CommandRegistry } from '@lumino/commands'; + +import { + ReadonlyPartialJSONObject, + ReadonlyPartialJSONValue +} from '@lumino/coreutils'; + +import { IDisposable, IObservableDisposable } from '@lumino/disposable'; + +import { ISignal } from '@lumino/signaling'; + +/** + * The description of a general purpose data connector. + * + * @typeparam T - The basic entity response type a service's connector. + * + * @typeparam U - The basic entity request type, which is conventionally the + * same as the response type but may be different if a service's implementation + * requires input data to be different from output responses. Defaults to `T`. + * + * @typeparam V - The basic token applied to a request, conventionally a string + * ID or filter, but may be set to a different type when an implementation + * requires it. Defaults to `string`. + * + * @typeparam W - The type of the optional `query` parameter of the `list` + * method. Defaults to `string`; + */ +export interface IDataConnector { + /** + * Retrieve an item from the data connector. + * + * @param id - The identifier used to retrieve an item. + * + * @returns A promise that bears a data payload if available. + * + * #### Notes + * The promise returned by this method may be rejected if an error occurs in + * retrieving the data. Nonexistence of an `id` resolves with `undefined`. + */ + fetch(id: V): Promise; + + /** + * Retrieve the list of items available from the data connector. + * + * @param query - The optional query filter to apply to the connector request. + * + * @returns A promise that bears a list of `values` and an associated list of + * fetch `ids`. + * + * #### Notes + * The promise returned by this method may be rejected if an error occurs in + * retrieving the data. The two lists will always be the same size. If there + * is no data, this method will succeed with empty `ids` and `values`. + */ + list(query?: W): Promise<{ ids: V[]; values: T[] }>; + + /** + * Remove a value using the data connector. + * + * @param id - The identifier for the data being removed. + * + * @returns A promise that is rejected if remove fails and succeeds otherwise. + * + * #### Notes + * This promise may resolve with a back-end response or `undefined`. + * Existence of resolved content in the promise is not prescribed and must be + * tested for. For example, some back-ends may return a copy of the item of + * type `T` being removed while others may return no content. + */ + remove(id: V): Promise; + + /** + * Save a value using the data connector. + * + * @param id - The identifier for the data being saved. + * + * @param value - The data being saved. + * + * @returns A promise that is rejected if saving fails and succeeds otherwise. + * + * #### Notes + * This promise may resolve with a back-end response or `undefined`. + * Existence of resolved content in the promise is not prescribed and must be + * tested for. For example, some back-ends may return a copy of the item of + * type `T` being saved while others may return no content. + */ + save(id: V, value: U): Promise; +} + +/** + * A pool of objects whose disposable lifecycle is tracked. + * + * @typeparam T - The type of object held in the pool. + */ +export interface IObjectPool + extends IDisposable { + /** + * A signal emitted when an object is added. + * + * #### + * This signal does not emit if an object is added using `inject()`. + */ + readonly added: ISignal; + + /** + * The current object. + */ + readonly current: T | null; + + /** + * A signal emitted when the current object changes. + * + * #### Notes + * If the last object being tracked is disposed, `null` will be emitted. + */ + readonly currentChanged: ISignal; + + /** + * The number of objects held by the pool. + */ + readonly size: number; + + /** + * A signal emitted when an object is updated. + */ + readonly updated: ISignal; + + /** + * Find the first object in the pool that satisfies a filter function. + * + * @param - fn The filter function to call on each object. + * + * #### Notes + * If nothing is found, the value returned is `undefined`. + */ + find(fn: (obj: T) => boolean): T | undefined; + + /** + * Iterate through each object in the pool. + * + * @param fn - The function to call on each object. + */ + forEach(fn: (obj: T) => void): void; + + /** + * Filter the objects in the pool based on a predicate. + * + * @param fn - The function by which to filter. + */ + filter(fn: (obj: T) => boolean): T[]; + + /** + * Check if this pool has the specified object. + * + * @param obj - The object whose existence is being checked. + */ + has(obj: T): boolean; +} + +/** + * An interface for a state restorer. + * + * @typeparam T - The restorable collection's type. + * + * @typeparam U - The type of object held by the restorable collection. + * + * @typeparam V - The `restored` promise resolution type. Defaults to `any`. + */ +export interface IRestorer< + T extends IRestorable = IRestorable, + U extends IObservableDisposable = IObservableDisposable, + V = any +> { + /** + * Restore the objects in a given restorable collection. + * + * @param restorable - The restorable collection being restored. + * + * @param options - The configuration options that describe restoration. + * + * @returns A promise that settles when restored with `any` results. + * + */ + restore(restorable: T, options: IRestorable.IOptions): Promise; + + /** + * A promise that settles when the collection has been restored. + */ + readonly restored: Promise; +} + +/** + * A namespace for `IRestorer` interface definitions. + */ +export namespace IRestorer { + /** + * The state restoration configuration options. + * + * @typeparam T - The type of object held by the restorable collection. + */ + export interface IOptions { + /** + * The command to execute when restoring instances. + */ + command: string; + + /** + * A function that returns the args needed to restore an instance. + */ + args?: (obj: T) => ReadonlyPartialJSONObject; + + /** + * A function that returns a unique persistent name for this instance. + */ + name: (obj: T) => string; + + /** + * The point after which it is safe to restore state. + */ + when?: Promise | Array>; + } +} + +/** + * An interface for objects that can be restored. + * + * @typeparam T - The type of object held by the restorable collection. + * + * @typeparam U - The `restored` promise resolution type. Defaults to `any`. + */ +export interface IRestorable { + /** + * Restore the objects in this restorable collection. + * + * @param options - The configuration options that describe restoration. + * + * @returns A promise that settles when restored with `any` results. + * + */ + restore(options: IRestorable.IOptions): Promise; + + /** + * A promise that settles when the collection has been restored. + */ + readonly restored: Promise; +} + +/** + * A namespace for `IRestorable` interface definitions. + */ +export namespace IRestorable { + /** + * The state restoration configuration options. + * + * @typeparam T - The type of object held by the restorable collection. + */ + export interface IOptions + extends IRestorer.IOptions { + /** + * The data connector to fetch restore data. + */ + connector: IDataConnector; + + /** + * The command registry which holds the restore command. + */ + registry: CommandRegistry; + } +} diff --git a/packages/coreutils/src/restorablepool.ts b/packages/statedb/src/restorablepool.ts similarity index 100% rename from packages/coreutils/src/restorablepool.ts rename to packages/statedb/src/restorablepool.ts diff --git a/packages/coreutils/src/statedb.ts b/packages/statedb/src/statedb.ts similarity index 100% rename from packages/coreutils/src/statedb.ts rename to packages/statedb/src/statedb.ts diff --git a/packages/coreutils/src/tokens.ts b/packages/statedb/src/tokens.ts similarity index 100% rename from packages/coreutils/src/tokens.ts rename to packages/statedb/src/tokens.ts diff --git a/packages/statedb/tsconfig.json b/packages/statedb/tsconfig.json index a1e4ba13c4bc..216bdd12d9e3 100644 --- a/packages/statedb/tsconfig.json +++ b/packages/statedb/tsconfig.json @@ -2,7 +2,9 @@ "extends": "../../tsconfigbase", "compilerOptions": { "outDir": "lib", - "rootDir": "src" + "rootDir": "src", + "module": "commonjs", + "types": ["node"] }, "include": ["src/*"] } diff --git a/tests/test-application/package.json b/tests/test-application/package.json index f1d740aec67b..62e9a6bee370 100644 --- a/tests/test-application/package.json +++ b/tests/test-application/package.json @@ -14,7 +14,7 @@ "dependencies": { "@jupyterlab/application": "^2.0.0-alpha.4", "@jupyterlab/apputils": "^2.0.0-alpha.4", - "@jupyterlab/coreutils": "^4.0.0-alpha.4", + "@jupyterlab/statedb": "^2.0.0-alpha.4", "@jupyterlab/testutils": "^2.0.0-alpha.4", "@lumino/algorithm": "^1.2.1", "@lumino/commands": "^1.9.0", diff --git a/tests/test-application/src/layoutrestorer.spec.ts b/tests/test-application/src/layoutrestorer.spec.ts index 5ac1e46b3848..4231187bae04 100644 --- a/tests/test-application/src/layoutrestorer.spec.ts +++ b/tests/test-application/src/layoutrestorer.spec.ts @@ -7,7 +7,7 @@ import { ILabShell, LayoutRestorer } from '@jupyterlab/application'; import { WidgetTracker } from '@jupyterlab/apputils'; -import { StateDB } from '@jupyterlab/coreutils'; +import { StateDB } from '@jupyterlab/statedb'; import { CommandRegistry } from '@lumino/commands'; diff --git a/tests/test-application/tsconfig.json b/tests/test-application/tsconfig.json index 787718295989..fdb221038728 100644 --- a/tests/test-application/tsconfig.json +++ b/tests/test-application/tsconfig.json @@ -3,10 +3,14 @@ "compilerOptions": { "composite": false, "outDir": "build", - "types": ["jest"], + "types": [ + "jest" + ], "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../../packages/application" @@ -15,7 +19,7 @@ "path": "../../packages/apputils" }, { - "path": "../../packages/coreutils" + "path": "../../packages/statedb" }, { "path": "../../testutils" diff --git a/tests/test-coreutils/package.json b/tests/test-coreutils/package.json index 9d3b263b9bd1..74ac662eff7b 100644 --- a/tests/test-coreutils/package.json +++ b/tests/test-coreutils/package.json @@ -14,8 +14,6 @@ "dependencies": { "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/testutils": "^2.0.0-alpha.4", - "@lumino/coreutils": "^1.4.0", - "@lumino/disposable": "^1.3.2", "@lumino/signaling": "^1.3.2", "chai": "^4.2.0", "jest": "^24.9.0", diff --git a/tests/test-filebrowser/package.json b/tests/test-filebrowser/package.json index c8bd1548076f..9dc4b9c76561 100644 --- a/tests/test-filebrowser/package.json +++ b/tests/test-filebrowser/package.json @@ -21,6 +21,7 @@ "@jupyterlab/docregistry": "^2.0.0-alpha.4", "@jupyterlab/filebrowser": "^2.0.0-alpha.4", "@jupyterlab/services": "^5.0.0-alpha.4", + "@jupyterlab/statedb": "^2.0.0-alpha.4", "@jupyterlab/testutils": "^2.0.0-alpha.4", "@jupyterlab/ui-components": "^2.0.0-alpha.4", "@lumino/algorithm": "^1.2.1", diff --git a/tests/test-filebrowser/src/model.spec.ts b/tests/test-filebrowser/src/model.spec.ts index 7994827607fa..5242c943bebc 100644 --- a/tests/test-filebrowser/src/model.spec.ts +++ b/tests/test-filebrowser/src/model.spec.ts @@ -3,7 +3,7 @@ import { expect } from 'chai'; -import { StateDB, PageConfig } from '@jupyterlab/coreutils'; +import { PageConfig } from '@jupyterlab/coreutils'; import { UUID } from '@lumino/coreutils'; @@ -11,6 +11,8 @@ import { DocumentManager, IDocumentManager } from '@jupyterlab/docmanager'; import { DocumentRegistry, TextModelFactory } from '@jupyterlab/docregistry'; +import { StateDB } from '@jupyterlab/statedb'; + import { FileBrowserModel, LARGE_FILE_SIZE, diff --git a/tests/test-filebrowser/tsconfig.json b/tests/test-filebrowser/tsconfig.json index fe415b7aed6a..323def32b31f 100644 --- a/tests/test-filebrowser/tsconfig.json +++ b/tests/test-filebrowser/tsconfig.json @@ -2,11 +2,15 @@ "extends": "../../tsconfigbase", "compilerOptions": { "outDir": "build", - "types": ["mocha"], + "types": [ + "mocha" + ], "composite": false, "rootDir": "src" }, - "include": ["src/*"], + "include": [ + "src/*" + ], "references": [ { "path": "../../packages/coreutils" @@ -23,6 +27,9 @@ { "path": "../../packages/services" }, + { + "path": "../../packages/statedb" + }, { "path": "../../testutils" }, diff --git a/tests/test-settingregistry/package.json b/tests/test-settingregistry/package.json index 25df8825bc2f..09c8e82a6c56 100644 --- a/tests/test-settingregistry/package.json +++ b/tests/test-settingregistry/package.json @@ -12,8 +12,8 @@ "watch:src": "tsc -b --watch" }, "dependencies": { - "@jupyterlab/coreutils": "^4.0.0-alpha.4", "@jupyterlab/settingregistry": "^2.0.0-alpha.4", + "@jupyterlab/statedb": "^2.0.0-alpha.4", "@jupyterlab/testutils": "^2.0.0-alpha.4", "@lumino/coreutils": "^1.4.0", "chai": "^4.2.0", diff --git a/tests/test-settingregistry/src/settingregistry.spec.ts b/tests/test-settingregistry/src/settingregistry.spec.ts index 9d0873e1efd5..f65f978badd7 100644 --- a/tests/test-settingregistry/src/settingregistry.spec.ts +++ b/tests/test-settingregistry/src/settingregistry.spec.ts @@ -3,8 +3,6 @@ import { expect } from 'chai'; -import { StateDB } from '@jupyterlab/coreutils'; - import { DefaultSchemaValidator, ISettingRegistry, @@ -12,6 +10,8 @@ import { Settings } from '@jupyterlab/settingregistry'; +import { StateDB } from '@jupyterlab/statedb'; + import { signalToPromise } from '@jupyterlab/testutils'; import { JSONObject } from '@lumino/coreutils'; diff --git a/tests/test-settingregistry/tsconfig.json b/tests/test-settingregistry/tsconfig.json index 876b7a9489a6..a0da29d685f4 100644 --- a/tests/test-settingregistry/tsconfig.json +++ b/tests/test-settingregistry/tsconfig.json @@ -13,10 +13,10 @@ ], "references": [ { - "path": "../../packages/coreutils" + "path": "../../packages/settingregistry" }, { - "path": "../../packages/settingregistry" + "path": "../../packages/statedb" }, { "path": "../../testutils" diff --git a/tests/test-statedb/babel.config.js b/tests/test-statedb/babel.config.js new file mode 100644 index 000000000000..8b5c76420c60 --- /dev/null +++ b/tests/test-statedb/babel.config.js @@ -0,0 +1 @@ +module.exports = require('@jupyterlab/testutils/lib/babel.config'); diff --git a/tests/test-statedb/jest.config.js b/tests/test-statedb/jest.config.js new file mode 100644 index 000000000000..d9b783931a85 --- /dev/null +++ b/tests/test-statedb/jest.config.js @@ -0,0 +1,2 @@ +const func = require('@jupyterlab/testutils/lib/jest-config'); +module.exports = func('logconsole', __dirname); diff --git a/tests/test-statedb/package.json b/tests/test-statedb/package.json new file mode 100644 index 000000000000..ef284981a8a7 --- /dev/null +++ b/tests/test-statedb/package.json @@ -0,0 +1,31 @@ +{ + "name": "@jupyterlab/test-statedb", + "version": "2.0.0-alpha.4", + "private": true, + "scripts": { + "build": "tsc -b", + "clean": "rimraf build && rimraf coverage", + "coverage": "python run.py --coverage", + "test": "python run.py", + "watch": "python run.py --debug", + "watch:all": "python run.py --debug --watchAll", + "watch:src": "tsc -b --watch" + }, + "dependencies": { + "@jupyterlab/statedb": "^2.0.0-alpha.4", + "@jupyterlab/testutils": "^2.0.0-alpha.4", + "@lumino/coreutils": "^1.4.0", + "@lumino/disposable": "^1.3.2", + "@lumino/signaling": "^1.3.2", + "chai": "^4.2.0", + "jest": "^24.9.0", + "jest-junit": "^10.0.0", + "ts-jest": "^24.2.0" + }, + "devDependencies": { + "@types/chai": "^4.2.7", + "@types/jest": "^24.0.23", + "rimraf": "~3.0.0", + "typescript": "~3.7.3" + } +} diff --git a/tests/test-statedb/run.py b/tests/test-statedb/run.py new file mode 100644 index 000000000000..b9bd9c302be4 --- /dev/null +++ b/tests/test-statedb/run.py @@ -0,0 +1,8 @@ +# Copyright (c) Jupyter Development Team. +# Distributed under the terms of the Modified BSD License. + +import os.path as osp +from jupyterlab.tests.test_app import run_jest + +if __name__ == '__main__': + run_jest(osp.dirname(osp.realpath(__file__))) diff --git a/tests/test-coreutils/src/restorablepool.spec.ts b/tests/test-statedb/src/restorablepool.spec.ts similarity index 99% rename from tests/test-coreutils/src/restorablepool.spec.ts rename to tests/test-statedb/src/restorablepool.spec.ts index f7533edf8d0c..b312595f52a9 100644 --- a/tests/test-coreutils/src/restorablepool.spec.ts +++ b/tests/test-statedb/src/restorablepool.spec.ts @@ -3,7 +3,7 @@ import { expect } from 'chai'; -import { RestorablePool } from '@jupyterlab/coreutils'; +import { RestorablePool } from '@jupyterlab/statedb'; import { signalToPromise } from '@jupyterlab/testutils'; diff --git a/tests/test-coreutils/src/statedb.spec.ts b/tests/test-statedb/src/statedb.spec.ts similarity index 99% rename from tests/test-coreutils/src/statedb.spec.ts rename to tests/test-statedb/src/statedb.spec.ts index 615db791f964..a2a725b80568 100644 --- a/tests/test-coreutils/src/statedb.spec.ts +++ b/tests/test-statedb/src/statedb.spec.ts @@ -3,7 +3,7 @@ import { expect } from 'chai'; -import { StateDB } from '@jupyterlab/coreutils'; +import { StateDB } from '@jupyterlab/statedb'; import { PromiseDelegate, ReadonlyJSONObject } from '@lumino/coreutils'; diff --git a/tests/test-statedb/tsconfig.json b/tests/test-statedb/tsconfig.json new file mode 100644 index 000000000000..14f8dd590a1c --- /dev/null +++ b/tests/test-statedb/tsconfig.json @@ -0,0 +1,22 @@ +{ + "extends": "../../tsconfigbase", + "compilerOptions": { + "outDir": "build", + "types": [ + "jest" + ], + "composite": false, + "rootDir": "src" + }, + "include": [ + "src/*" + ], + "references": [ + { + "path": "../../packages/statedb" + }, + { + "path": "../../testutils" + } + ] +} From 17c91eef97142da65ce12e34ff7f36a1e2804bc1 Mon Sep 17 00:00:00 2001 From: Vidar Tonaas Fauske Date: Sun, 22 Dec 2019 17:06:44 +0000 Subject: [PATCH 09/13] lint --- packages/application-extension/tsconfig.json | 4 +--- packages/application/tsconfig.json | 4 +--- packages/apputils-extension/src/settingsplugin.ts | 5 +---- packages/apputils-extension/tsconfig.json | 4 +--- packages/apputils/tsconfig.json | 4 +--- packages/attachments/tsconfig.json | 4 +--- packages/cells/tsconfig.json | 4 +--- packages/codeeditor/tsconfig.json | 4 +--- packages/codemirror-extension/tsconfig.json | 4 +--- packages/codemirror/tsconfig.json | 4 +--- packages/completer/tsconfig.json | 4 +--- packages/console-extension/tsconfig.json | 4 +--- packages/console/tsconfig.json | 4 +--- packages/docmanager-extension/tsconfig.json | 4 +--- packages/extensionmanager-extension/tsconfig.json | 4 +--- packages/filebrowser-extension/tsconfig.json | 4 +--- packages/filebrowser/tsconfig.json | 4 +--- packages/fileeditor-extension/tsconfig.json | 4 +--- packages/inspector/tsconfig.json | 4 +--- packages/logconsole-extension/tsconfig.json | 4 +--- packages/logconsole/tsconfig.json | 4 +--- packages/markdownviewer-extension/tsconfig.json | 4 +--- packages/metapackage/tsconfig.json | 4 +--- packages/notebook-extension/tsconfig.json | 4 +--- packages/notebook/tsconfig.json | 4 +--- packages/outputarea/tsconfig.json | 4 +--- packages/rendermime/tsconfig.json | 4 +--- packages/services/tsconfig.json | 8 ++------ packages/settingeditor-extension/tsconfig.json | 4 +--- packages/settingeditor/tsconfig.json | 4 +--- packages/settingregistry/src/tokens.ts | 5 ++--- packages/settingregistry/tsconfig.json | 8 ++------ packages/shortcuts-extension/src/index.ts | 5 +---- packages/shortcuts-extension/tsconfig.json | 4 +--- packages/statusbar-extension/tsconfig.json | 4 +--- packages/terminal-extension/tsconfig.json | 8 ++------ tests/test-application/tsconfig.json | 8 ++------ tests/test-cells/tsconfig.json | 8 ++------ tests/test-coreutils/tsconfig.json | 8 ++------ tests/test-filebrowser/tsconfig.json | 8 ++------ tests/test-nbformat/tsconfig.json | 8 ++------ tests/test-notebook/tsconfig.json | 8 ++------ tests/test-rendermime/tsconfig.json | 9 ++------- tests/test-settingregistry/tsconfig.json | 8 ++------ tests/test-statedb/tsconfig.json | 8 ++------ testutils/tsconfig.json | 8 ++------ 46 files changed, 60 insertions(+), 180 deletions(-) diff --git a/packages/application-extension/tsconfig.json b/packages/application-extension/tsconfig.json index f6ec47e4e198..593f06c68dab 100644 --- a/packages/application-extension/tsconfig.json +++ b/packages/application-extension/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../application" diff --git a/packages/application/tsconfig.json b/packages/application/tsconfig.json index c7bd9e6d0976..08c7b34d8f4c 100644 --- a/packages/application/tsconfig.json +++ b/packages/application/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../apputils" diff --git a/packages/apputils-extension/src/settingsplugin.ts b/packages/apputils-extension/src/settingsplugin.ts index b43ee359e429..2cca4da33650 100644 --- a/packages/apputils-extension/src/settingsplugin.ts +++ b/packages/apputils-extension/src/settingsplugin.ts @@ -10,10 +10,7 @@ import { import { PageConfig } from '@jupyterlab/coreutils'; -import { - SettingRegistry, - ISettingRegistry -} from '@jupyterlab/settingregistry'; +import { SettingRegistry, ISettingRegistry } from '@jupyterlab/settingregistry'; import { SettingConnector } from './settingconnector'; diff --git a/packages/apputils-extension/tsconfig.json b/packages/apputils-extension/tsconfig.json index de0449d11f18..aecec18ebe63 100644 --- a/packages/apputils-extension/tsconfig.json +++ b/packages/apputils-extension/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../application" diff --git a/packages/apputils/tsconfig.json b/packages/apputils/tsconfig.json index 0e311f25e0bc..f99a1567150a 100644 --- a/packages/apputils/tsconfig.json +++ b/packages/apputils/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../coreutils" diff --git a/packages/attachments/tsconfig.json b/packages/attachments/tsconfig.json index 2f9fdcc93baa..22da79531c90 100644 --- a/packages/attachments/tsconfig.json +++ b/packages/attachments/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../nbformat" diff --git a/packages/cells/tsconfig.json b/packages/cells/tsconfig.json index 8a7562271f15..2abd8f12fef5 100644 --- a/packages/cells/tsconfig.json +++ b/packages/cells/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../apputils" diff --git a/packages/codeeditor/tsconfig.json b/packages/codeeditor/tsconfig.json index af8047dc5732..fb4124ab1a54 100644 --- a/packages/codeeditor/tsconfig.json +++ b/packages/codeeditor/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../coreutils" diff --git a/packages/codemirror-extension/tsconfig.json b/packages/codemirror-extension/tsconfig.json index 865d1c9ee08c..fab448c8ef00 100644 --- a/packages/codemirror-extension/tsconfig.json +++ b/packages/codemirror-extension/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../application" diff --git a/packages/codemirror/tsconfig.json b/packages/codemirror/tsconfig.json index 1de89ff421fd..dd9396b2c0e7 100644 --- a/packages/codemirror/tsconfig.json +++ b/packages/codemirror/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../apputils" diff --git a/packages/completer/tsconfig.json b/packages/completer/tsconfig.json index fed74f8d43bb..7edb64b2bab4 100644 --- a/packages/completer/tsconfig.json +++ b/packages/completer/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../apputils" diff --git a/packages/console-extension/tsconfig.json b/packages/console-extension/tsconfig.json index 5a09cfd2dec5..4cb1893a20ca 100644 --- a/packages/console-extension/tsconfig.json +++ b/packages/console-extension/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../application" diff --git a/packages/console/tsconfig.json b/packages/console/tsconfig.json index 793803d0f0bc..98093b214cb6 100644 --- a/packages/console/tsconfig.json +++ b/packages/console/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../apputils" diff --git a/packages/docmanager-extension/tsconfig.json b/packages/docmanager-extension/tsconfig.json index 11dbf1a944a5..baf14856b07a 100644 --- a/packages/docmanager-extension/tsconfig.json +++ b/packages/docmanager-extension/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../application" diff --git a/packages/extensionmanager-extension/tsconfig.json b/packages/extensionmanager-extension/tsconfig.json index 8c4fe2e1139e..538160f60806 100644 --- a/packages/extensionmanager-extension/tsconfig.json +++ b/packages/extensionmanager-extension/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../application" diff --git a/packages/filebrowser-extension/tsconfig.json b/packages/filebrowser-extension/tsconfig.json index 8bf69acf192c..60a580e5aadd 100644 --- a/packages/filebrowser-extension/tsconfig.json +++ b/packages/filebrowser-extension/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../application" diff --git a/packages/filebrowser/tsconfig.json b/packages/filebrowser/tsconfig.json index 504b8b77c6e5..a635b14ce756 100644 --- a/packages/filebrowser/tsconfig.json +++ b/packages/filebrowser/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../apputils" diff --git a/packages/fileeditor-extension/tsconfig.json b/packages/fileeditor-extension/tsconfig.json index 59f2e6286bbc..039a1a5021e2 100644 --- a/packages/fileeditor-extension/tsconfig.json +++ b/packages/fileeditor-extension/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../application" diff --git a/packages/inspector/tsconfig.json b/packages/inspector/tsconfig.json index bdaf25815058..cd6b22ec8038 100644 --- a/packages/inspector/tsconfig.json +++ b/packages/inspector/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../apputils" diff --git a/packages/logconsole-extension/tsconfig.json b/packages/logconsole-extension/tsconfig.json index 44a166639f7c..6a8336975597 100644 --- a/packages/logconsole-extension/tsconfig.json +++ b/packages/logconsole-extension/tsconfig.json @@ -5,9 +5,7 @@ "rootDir": "src", "strictNullChecks": false }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../application" diff --git a/packages/logconsole/tsconfig.json b/packages/logconsole/tsconfig.json index 60e240e3f54f..7974ce130c47 100644 --- a/packages/logconsole/tsconfig.json +++ b/packages/logconsole/tsconfig.json @@ -5,9 +5,7 @@ "rootDir": "src", "strictNullChecks": false }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../coreutils" diff --git a/packages/markdownviewer-extension/tsconfig.json b/packages/markdownviewer-extension/tsconfig.json index 8ee03954ab3b..f5e214752db4 100644 --- a/packages/markdownviewer-extension/tsconfig.json +++ b/packages/markdownviewer-extension/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../application" diff --git a/packages/metapackage/tsconfig.json b/packages/metapackage/tsconfig.json index 86292b032d08..4ca137d41211 100644 --- a/packages/metapackage/tsconfig.json +++ b/packages/metapackage/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../application" diff --git a/packages/notebook-extension/tsconfig.json b/packages/notebook-extension/tsconfig.json index 0c3487df9727..69a64dfa1cc2 100644 --- a/packages/notebook-extension/tsconfig.json +++ b/packages/notebook-extension/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../application" diff --git a/packages/notebook/tsconfig.json b/packages/notebook/tsconfig.json index 4bd0d442d252..7193997adf2c 100644 --- a/packages/notebook/tsconfig.json +++ b/packages/notebook/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../apputils" diff --git a/packages/outputarea/tsconfig.json b/packages/outputarea/tsconfig.json index cb3f04be6b2d..e4e0c39ed150 100644 --- a/packages/outputarea/tsconfig.json +++ b/packages/outputarea/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../apputils" diff --git a/packages/rendermime/tsconfig.json b/packages/rendermime/tsconfig.json index 1a7d15cf997e..4687ab19784a 100644 --- a/packages/rendermime/tsconfig.json +++ b/packages/rendermime/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../apputils" diff --git a/packages/services/tsconfig.json b/packages/services/tsconfig.json index e41565795417..ca037253c291 100644 --- a/packages/services/tsconfig.json +++ b/packages/services/tsconfig.json @@ -4,13 +4,9 @@ "outDir": "lib", "rootDir": "src", "module": "commonjs", - "types": [ - "node" - ] + "types": ["node"] }, - "include": [ - "src/**/*" - ], + "include": ["src/**/*"], "references": [ { "path": "../coreutils" diff --git a/packages/settingeditor-extension/tsconfig.json b/packages/settingeditor-extension/tsconfig.json index a6e3dce510be..27787924f186 100644 --- a/packages/settingeditor-extension/tsconfig.json +++ b/packages/settingeditor-extension/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../application" diff --git a/packages/settingeditor/tsconfig.json b/packages/settingeditor/tsconfig.json index c3cd49d20729..56d7ecfd95ac 100644 --- a/packages/settingeditor/tsconfig.json +++ b/packages/settingeditor/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../apputils" diff --git a/packages/settingregistry/src/tokens.ts b/packages/settingregistry/src/tokens.ts index a6dea7895834..e31a194cc476 100644 --- a/packages/settingregistry/src/tokens.ts +++ b/packages/settingregistry/src/tokens.ts @@ -19,7 +19,6 @@ import { IDataConnector } from '@jupyterlab/statedb'; import { ISchemaValidator } from './settingregistry'; - /* tslint:disable */ /** * The setting registry token. @@ -338,8 +337,8 @@ export namespace ISettingRegistry { readonly id: string; /* - * The underlying plugin. - */ + * The underlying plugin. + */ readonly plugin: ISettingRegistry.IPlugin; /** diff --git a/packages/settingregistry/tsconfig.json b/packages/settingregistry/tsconfig.json index 42e4e99f144d..8a31ba357f84 100644 --- a/packages/settingregistry/tsconfig.json +++ b/packages/settingregistry/tsconfig.json @@ -4,12 +4,8 @@ "outDir": "lib", "rootDir": "src" }, - "files": [ - "src/plugin-schema.json" - ], - "include": [ - "src/*" - ], + "files": ["src/plugin-schema.json"], + "include": ["src/*"], "references": [ { "path": "../statedb" diff --git a/packages/shortcuts-extension/src/index.ts b/packages/shortcuts-extension/src/index.ts index e153c41b5a28..ac5bb91e24a8 100644 --- a/packages/shortcuts-extension/src/index.ts +++ b/packages/shortcuts-extension/src/index.ts @@ -6,10 +6,7 @@ import { JupyterFrontEndPlugin } from '@jupyterlab/application'; -import { - ISettingRegistry, - SettingRegistry -} from '@jupyterlab/settingregistry'; +import { ISettingRegistry, SettingRegistry } from '@jupyterlab/settingregistry'; import { CommandRegistry } from '@lumino/commands'; diff --git a/packages/shortcuts-extension/tsconfig.json b/packages/shortcuts-extension/tsconfig.json index 81cfc29fe297..08ea885f411a 100644 --- a/packages/shortcuts-extension/tsconfig.json +++ b/packages/shortcuts-extension/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../application" diff --git a/packages/statusbar-extension/tsconfig.json b/packages/statusbar-extension/tsconfig.json index 92640ef7aa48..0344ff0ae184 100644 --- a/packages/statusbar-extension/tsconfig.json +++ b/packages/statusbar-extension/tsconfig.json @@ -4,9 +4,7 @@ "outDir": "lib", "rootDir": "src" }, - "include": [ - "src/**/*" - ], + "include": ["src/**/*"], "references": [ { "path": "../application" diff --git a/packages/terminal-extension/tsconfig.json b/packages/terminal-extension/tsconfig.json index 0150a4195749..a053ce8778c5 100644 --- a/packages/terminal-extension/tsconfig.json +++ b/packages/terminal-extension/tsconfig.json @@ -3,13 +3,9 @@ "compilerOptions": { "outDir": "lib", "rootDir": "src", - "types": [ - "webpack-env" - ] + "types": ["webpack-env"] }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../application" diff --git a/tests/test-application/tsconfig.json b/tests/test-application/tsconfig.json index fdb221038728..4cebedab681b 100644 --- a/tests/test-application/tsconfig.json +++ b/tests/test-application/tsconfig.json @@ -3,14 +3,10 @@ "compilerOptions": { "composite": false, "outDir": "build", - "types": [ - "jest" - ], + "types": ["jest"], "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../../packages/application" diff --git a/tests/test-cells/tsconfig.json b/tests/test-cells/tsconfig.json index 4b90f07baedb..d93ae5cc1b93 100644 --- a/tests/test-cells/tsconfig.json +++ b/tests/test-cells/tsconfig.json @@ -2,15 +2,11 @@ "extends": "../../tsconfigbase", "compilerOptions": { "outDir": "build", - "types": [ - "jest" - ], + "types": ["jest"], "composite": false, "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../../packages/apputils" diff --git a/tests/test-coreutils/tsconfig.json b/tests/test-coreutils/tsconfig.json index 8328cc99674c..0da3b93cba82 100644 --- a/tests/test-coreutils/tsconfig.json +++ b/tests/test-coreutils/tsconfig.json @@ -3,14 +3,10 @@ "compilerOptions": { "outDir": "build", "rootDir": "src", - "types": [ - "jest" - ], + "types": ["jest"], "composite": false }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../../packages/coreutils" diff --git a/tests/test-filebrowser/tsconfig.json b/tests/test-filebrowser/tsconfig.json index 323def32b31f..89d0f985d726 100644 --- a/tests/test-filebrowser/tsconfig.json +++ b/tests/test-filebrowser/tsconfig.json @@ -2,15 +2,11 @@ "extends": "../../tsconfigbase", "compilerOptions": { "outDir": "build", - "types": [ - "mocha" - ], + "types": ["mocha"], "composite": false, "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../../packages/coreutils" diff --git a/tests/test-nbformat/tsconfig.json b/tests/test-nbformat/tsconfig.json index 7089a8381cce..3ebf90392c14 100644 --- a/tests/test-nbformat/tsconfig.json +++ b/tests/test-nbformat/tsconfig.json @@ -3,14 +3,10 @@ "compilerOptions": { "outDir": "build", "rootDir": "src", - "types": [ - "jest" - ], + "types": ["jest"], "composite": false }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../../packages/nbformat" diff --git a/tests/test-notebook/tsconfig.json b/tests/test-notebook/tsconfig.json index f00d6d27ef1e..8aecda4bf447 100644 --- a/tests/test-notebook/tsconfig.json +++ b/tests/test-notebook/tsconfig.json @@ -2,15 +2,11 @@ "extends": "../../tsconfigbase", "compilerOptions": { "outDir": "build", - "types": [ - "mocha" - ], + "types": ["mocha"], "composite": false, "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../../packages/apputils" diff --git a/tests/test-rendermime/tsconfig.json b/tests/test-rendermime/tsconfig.json index 8022e883cf31..c52cae16dde0 100644 --- a/tests/test-rendermime/tsconfig.json +++ b/tests/test-rendermime/tsconfig.json @@ -2,16 +2,11 @@ "extends": "../../tsconfigbase", "compilerOptions": { "outDir": "build", - "types": [ - "mocha", - "node" - ], + "types": ["mocha", "node"], "composite": false, "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../../packages/apputils" diff --git a/tests/test-settingregistry/tsconfig.json b/tests/test-settingregistry/tsconfig.json index a0da29d685f4..aec856ca4b1b 100644 --- a/tests/test-settingregistry/tsconfig.json +++ b/tests/test-settingregistry/tsconfig.json @@ -2,15 +2,11 @@ "extends": "../../tsconfigbase", "compilerOptions": { "outDir": "build", - "types": [ - "jest" - ], + "types": ["jest"], "composite": false, "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../../packages/settingregistry" diff --git a/tests/test-statedb/tsconfig.json b/tests/test-statedb/tsconfig.json index 14f8dd590a1c..4b4a8761d025 100644 --- a/tests/test-statedb/tsconfig.json +++ b/tests/test-statedb/tsconfig.json @@ -2,15 +2,11 @@ "extends": "../../tsconfigbase", "compilerOptions": { "outDir": "build", - "types": [ - "jest" - ], + "types": ["jest"], "composite": false, "rootDir": "src" }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../../packages/statedb" diff --git a/testutils/tsconfig.json b/testutils/tsconfig.json index 762331ab4497..2ab139dc98ff 100644 --- a/testutils/tsconfig.json +++ b/testutils/tsconfig.json @@ -4,13 +4,9 @@ "outDir": "lib", "rootDir": "src", "module": "commonjs", - "types": [ - "node" - ] + "types": ["node"] }, - "include": [ - "src/*" - ], + "include": ["src/*"], "references": [ { "path": "../packages/apputils" From 3399cdcb37e53012b4009389a5b4c29d40bdb270 Mon Sep 17 00:00:00 2001 From: Vidar Tonaas Fauske Date: Sun, 22 Dec 2019 17:08:42 +0000 Subject: [PATCH 10/13] Fix settingeditor-extension README link --- packages/settingeditor-extension/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/settingeditor-extension/README.md b/packages/settingeditor-extension/README.md index f81b0561e8c0..eaed3fcacebe 100644 --- a/packages/settingeditor-extension/README.md +++ b/packages/settingeditor-extension/README.md @@ -1,3 +1,3 @@ # @jupyterlab/settingeditor-extension -An extension for JupyterLab which provides a user-editable interface for the JupyterLab [settings registry](../coreutils/src/settingregistry.ts). +An extension for JupyterLab which provides a user-editable interface for the JupyterLab [settings registry](../settingregistry/src/settingregistry.ts). From 001e5890123519b552e2a733bd09c58d7cdf417d Mon Sep 17 00:00:00 2001 From: Vidar Tonaas Fauske Date: Sun, 22 Dec 2019 17:27:13 +0000 Subject: [PATCH 11/13] Fix docs for new packages --- package.json | 2 +- packages/coreutils/package.json | 2 +- packages/nbformat/package.json | 2 +- packages/nbformat/typedoc.json | 6 ++++++ packages/settingregistry/package.json | 2 +- packages/settingregistry/typedoc.json | 6 ++++++ packages/statedb/package.json | 2 +- packages/statedb/typedoc.json | 6 ++++++ 8 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 packages/nbformat/typedoc.json create mode 100644 packages/settingregistry/typedoc.json create mode 100644 packages/statedb/typedoc.json diff --git a/package.json b/package.json index cd870584a2b4..839675422ec8 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "create:test": "node buildutils/lib/create-test-package.js", "create:theme": "node buildutils/lib/create-theme.js", "deduplicate": "jlpm yarn-deduplicate -s fewer", - "docs": "lerna run docs --ignore \"@jupyterlab/coreutils\" ", + "docs": "lerna run docs --ignore \"@jupyterlab/settingregistry\" ", "eslint": "eslint --fix .", "eslint:check": "eslint .", "get:dependency": "node buildutils/lib/get-dependency.js", diff --git a/packages/coreutils/package.json b/packages/coreutils/package.json index deb020c99a02..0e536b8b26a4 100644 --- a/packages/coreutils/package.json +++ b/packages/coreutils/package.json @@ -27,7 +27,7 @@ "scripts": { "build": "tsc -b", "clean": "rimraf lib && rimraf tsconfig.tsbuildinfo", - "docs": "typedoc src --tsconfig typedoc-tsconfig.json", + "docs": "typedoc src", "prepublishOnly": "npm run build", "watch": "tsc -b --watch" }, diff --git a/packages/nbformat/package.json b/packages/nbformat/package.json index b2fe023048c0..11b25f0a1c25 100644 --- a/packages/nbformat/package.json +++ b/packages/nbformat/package.json @@ -28,7 +28,7 @@ "scripts": { "build": "tsc -b", "clean": "rimraf lib && rimraf tsconfig.tsbuildinfo", - "docs": "typedoc src --tsconfig typedoc-tsconfig.json", + "docs": "typedoc src", "prepublishOnly": "npm run build", "watch": "tsc -b -w --listEmittedFiles" }, diff --git a/packages/nbformat/typedoc.json b/packages/nbformat/typedoc.json new file mode 100644 index 000000000000..24f3ced07663 --- /dev/null +++ b/packages/nbformat/typedoc.json @@ -0,0 +1,6 @@ +{ + "excludeNotExported": true, + "mode": "file", + "out": "../../docs/api/nbformat", + "theme": "../../typedoc-theme" +} diff --git a/packages/settingregistry/package.json b/packages/settingregistry/package.json index a31d77a9de40..8a7e3e918225 100644 --- a/packages/settingregistry/package.json +++ b/packages/settingregistry/package.json @@ -26,7 +26,7 @@ "scripts": { "build": "tsc -b", "clean": "rimraf lib && rimraf tsconfig.tsbuildinfo", - "docs": "typedoc src --tsconfig typedoc-tsconfig.json", + "docs": "typedoc src", "prepublishOnly": "npm run build", "watch": "tsc -b -w --listEmittedFiles" }, diff --git a/packages/settingregistry/typedoc.json b/packages/settingregistry/typedoc.json new file mode 100644 index 000000000000..ac3ab8cfa65a --- /dev/null +++ b/packages/settingregistry/typedoc.json @@ -0,0 +1,6 @@ +{ + "excludeNotExported": true, + "mode": "file", + "out": "../../docs/api/settingregistry", + "theme": "../../typedoc-theme" +} diff --git a/packages/statedb/package.json b/packages/statedb/package.json index 9df277fc2606..5285d5a2ed7b 100644 --- a/packages/statedb/package.json +++ b/packages/statedb/package.json @@ -26,7 +26,7 @@ "scripts": { "build": "tsc -b", "clean": "rimraf lib && rimraf tsconfig.tsbuildinfo", - "docs": "typedoc src --tsconfig typedoc-tsconfig.json", + "docs": "typedoc src", "prepublishOnly": "npm run build", "watch": "tsc -b -w --listEmittedFiles" }, diff --git a/packages/statedb/typedoc.json b/packages/statedb/typedoc.json new file mode 100644 index 000000000000..c9d6442a56b9 --- /dev/null +++ b/packages/statedb/typedoc.json @@ -0,0 +1,6 @@ +{ + "excludeNotExported": true, + "mode": "file", + "out": "../../docs/api/statedb", + "theme": "../../typedoc-theme" +} From 608d82d76943bc79383af66a02aefe4a6d9c2593 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 23 Dec 2019 13:10:19 -0600 Subject: [PATCH 12/13] fix jest config --- tests/test-nbformat/jest.config.js | 2 +- tests/test-settingregistry/jest.config.js | 2 +- tests/test-statedb/jest.config.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test-nbformat/jest.config.js b/tests/test-nbformat/jest.config.js index 81e541f621bd..d30de090c24b 100644 --- a/tests/test-nbformat/jest.config.js +++ b/tests/test-nbformat/jest.config.js @@ -1,2 +1,2 @@ const func = require('@jupyterlab/testutils/lib/jest-config'); -module.exports = func('fileeditor', __dirname); +module.exports = func('nbformat', __dirname); diff --git a/tests/test-settingregistry/jest.config.js b/tests/test-settingregistry/jest.config.js index d9b783931a85..8033732fcd34 100644 --- a/tests/test-settingregistry/jest.config.js +++ b/tests/test-settingregistry/jest.config.js @@ -1,2 +1,2 @@ const func = require('@jupyterlab/testutils/lib/jest-config'); -module.exports = func('logconsole', __dirname); +module.exports = func('settingregistry', __dirname); diff --git a/tests/test-statedb/jest.config.js b/tests/test-statedb/jest.config.js index d9b783931a85..48cbd4d29a1c 100644 --- a/tests/test-statedb/jest.config.js +++ b/tests/test-statedb/jest.config.js @@ -1,2 +1,2 @@ const func = require('@jupyterlab/testutils/lib/jest-config'); -module.exports = func('logconsole', __dirname); +module.exports = func('statedb', __dirname); From a2c3089389b7e6ec857945ff47fdb469ac614a4e Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 23 Dec 2019 13:38:42 -0600 Subject: [PATCH 13/13] integrity --- packages/settingregistry/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/settingregistry/package.json b/packages/settingregistry/package.json index 8a7e3e918225..5eceb86cec00 100644 --- a/packages/settingregistry/package.json +++ b/packages/settingregistry/package.json @@ -32,6 +32,7 @@ }, "dependencies": { "@jupyterlab/statedb": "^2.0.0-alpha.4", + "@lumino/commands": "^1.9.0", "@lumino/coreutils": "^1.4.0", "@lumino/disposable": "^1.3.2", "@lumino/signaling": "^1.3.2",