@jupyterlite/terminal 1.0.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # jupyterlite-terminal
1
+ # JupyterLite Terminal
2
2
 
3
3
  [![Github Actions Status](https://github.com/jupyterlite/terminal/workflows/Build/badge.svg)](https://github.com/jupyterlite/terminal/actions/workflows/build.yml)
4
- [![lite-badge](https://jupyterlite.rtfd.io/en/latest/_static/badge.svg)](https://jupyterlite-terminal.vercel.app/)
4
+ [![lite-badge](https://jupyterlite.rtfd.io/en/latest/_static/badge.svg)](https://jupyterlite.github.io/terminal/)
5
5
 
6
6
  A terminal for JupyterLite.
7
7
 
@@ -11,7 +11,7 @@ A terminal for JupyterLite.
11
11
 
12
12
  ## Requirements
13
13
 
14
- - JupyterLite >= 0.6.0
14
+ - JupyterLite >= 0.7.0, < 0.8.0
15
15
 
16
16
  ## Install
17
17
 
@@ -52,10 +52,12 @@ Each `jupyterlite-terminal` release is built against a specific version of `cock
52
52
  include imports from both `jupyterlite-terminal` and `cockle`, such as if you are implementing
53
53
  `cockle` external commands, you should ensure that you are using the correct version combination.
54
54
 
55
- | `jupyterlite-terminal` | `cockle` | `jupyterlite-core` |
56
- | ---------------------- | -------- | ------------------ |
57
- | 1.0.0 | 1.0.0 | >= 0.6, < 0.7 |
58
- | 0.2.2 | 0.1.3 | >= 0.6, < 0.7 |
55
+ | `jupyterlite-terminal` | `cockle` | `jupyterlite-core` | Release date |
56
+ | ---------------------- | -------- | ------------------ | ------------ |
57
+ | 1.1.0 | 1.2.0 | >= 0.6, < 0.8 | 2025-10-27 |
58
+ | 1.0.1 | 1.0.0 | >= 0.6, < 0.8 | 2025-09-03 |
59
+ | 1.0.0 | 1.0.0 | >= 0.6, < 0.7 | 2025-08-11 |
60
+ | 0.2.2 | 0.1.3 | >= 0.6, < 0.7 | 2025-06-27 |
59
61
 
60
62
  ## Contributing
61
63
 
@@ -118,6 +120,25 @@ or:
118
120
  jupyter lite serve --LiteBuildConfig.extra_http_headers=Cross-Origin-Embedder-Policy=require-corp --LiteBuildConfig.extra_http_headers=Cross-Origin-Opener-Policy=same-origin
119
121
  ```
120
122
 
123
+ ### Building the documentation
124
+
125
+ The project documentation includes a demo deployment, and is built on every PR so that the changes can be checked manually before merging. To build the documentation and demo locally use:
126
+
127
+ ```bash
128
+ micromamba create -f docs/environment-docs.yml
129
+ micromamba activate terminal-docs
130
+ pip install -v .
131
+ cd docs
132
+ make html
133
+ ```
134
+
135
+ To serve this locally use:
136
+
137
+ ```bash
138
+ cd _build/html
139
+ python -m http.server
140
+ ```
141
+
121
142
  ### Packaging the extension
122
143
 
123
144
  See [RELEASE](RELEASE.md)
package/lib/client.d.ts CHANGED
@@ -1,6 +1,8 @@
1
- import { ServerConnection, Terminal } from '@jupyterlab/services';
2
- import { IExternalCommand, IStdinReply, IStdinRequest } from '@jupyterlite/cockle';
3
- import { ILiteTerminalAPIClient } from './tokens';
1
+ import type { Terminal } from '@jupyterlab/services';
2
+ import { ServerConnection } from '@jupyterlab/services';
3
+ import type { IExternalCommand, IStdinReply, IStdinRequest } from '@jupyterlite/cockle';
4
+ import type { ISignal } from '@lumino/signaling';
5
+ import type { ILiteTerminalAPIClient } from './tokens';
4
6
  export declare class LiteTerminalAPIClient implements ILiteTerminalAPIClient {
5
7
  constructor(options?: {
6
8
  serverSettings?: ServerConnection.ISettings;
@@ -21,6 +23,7 @@ export declare class LiteTerminalAPIClient implements ILiteTerminalAPIClient {
21
23
  registerEnvironmentVariable(key: string, value: string | undefined): void;
22
24
  registerExternalCommand(options: IExternalCommand.IOptions): void;
23
25
  shutdown(name: string): Promise<void>;
26
+ get terminalDisposed(): ISignal<this, string>;
24
27
  themeChange(isDarkMode?: boolean): void;
25
28
  private get _models();
26
29
  private _nextAvailableName;
@@ -30,4 +33,5 @@ export declare class LiteTerminalAPIClient implements ILiteTerminalAPIClient {
30
33
  private _externalCommands;
31
34
  private _shellManager;
32
35
  private _shells;
36
+ private _terminalDisposed;
33
37
  }
package/lib/client.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { PageConfig, URLExt } from '@jupyterlab/coreutils';
2
2
  import { ServerConnection } from '@jupyterlab/services';
3
3
  import { ShellManager } from '@jupyterlite/cockle';
4
+ import { Signal } from '@lumino/signaling';
4
5
  import { Server as WebSocketServer } from 'mock-socket';
5
6
  import { Shell } from './shell';
6
7
  export class LiteTerminalAPIClient {
@@ -8,6 +9,7 @@ export class LiteTerminalAPIClient {
8
9
  var _a;
9
10
  this._externalCommands = [];
10
11
  this._shells = new Map();
12
+ this._terminalDisposed = new Signal(this);
11
13
  this.serverSettings =
12
14
  (_a = options.serverSettings) !== null && _a !== void 0 ? _a : ServerConnection.makeSettings();
13
15
  this._shellManager = new ShellManager();
@@ -83,6 +85,7 @@ export class LiteTerminalAPIClient {
83
85
  shell.disposed.connect(() => {
84
86
  this.shutdown(name);
85
87
  wsServer.close();
88
+ this._terminalDisposed.emit(shell.shellId);
86
89
  });
87
90
  return { name };
88
91
  }
@@ -114,11 +117,12 @@ export class LiteTerminalAPIClient {
114
117
  shell.dispose();
115
118
  }
116
119
  }
120
+ get terminalDisposed() {
121
+ return this._terminalDisposed;
122
+ }
117
123
  themeChange(isDarkMode) {
118
124
  for (const shell of this._shells.values()) {
119
- // Can pass isDarkMode when cockle is released with PR #232.
120
- //shell.themeChange(isDarkMode);
121
- shell.themeChange();
125
+ shell.themeChange(isDarkMode);
122
126
  }
123
127
  }
124
128
  get _models() {
package/lib/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { JupyterFrontEndPlugin } from '@jupyterlab/application';
2
- import { ServiceManagerPlugin, Terminal } from '@jupyterlab/services';
1
+ import type { JupyterFrontEndPlugin } from '@jupyterlab/application';
2
+ import type { ServiceManagerPlugin, Terminal } from '@jupyterlab/services';
3
3
  import { ILiteTerminalAPIClient } from './tokens';
4
4
  declare const _default: (ServiceManagerPlugin<Terminal.ITerminalAPIClient> | ServiceManagerPlugin<Terminal.IManager> | JupyterFrontEndPlugin<void>)[];
5
5
  export default _default;
package/lib/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // Distributed under the terms of the Modified BSD License.
3
3
  import { IThemeManager } from '@jupyterlab/apputils';
4
4
  import { IServerSettings, ITerminalManager, ServerConnection, TerminalManager } from '@jupyterlab/services';
5
- import { IServiceWorkerManager } from '@jupyterlite/server';
5
+ import { IServiceWorkerManager } from '@jupyterlite/apputils';
6
6
  import { ISettingRegistry } from '@jupyterlab/settingregistry';
7
7
  import { WebSocket } from 'mock-socket';
8
8
  import { LiteTerminalAPIClient } from './client';
package/lib/shell.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { BaseShell, IShell } from '@jupyterlite/cockle';
2
- import { Client as WebSocketClient } from 'mock-socket';
1
+ import type { IShell } from '@jupyterlite/cockle';
2
+ import { BaseShell } from '@jupyterlite/cockle';
3
+ import type { Client as WebSocketClient } from 'mock-socket';
3
4
  /**
4
5
  * Shell class that uses web worker that plugs into a DriveFS via the service worker.
5
6
  */
package/lib/tokens.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { Terminal } from '@jupyterlab/services';
2
- import { IExternalCommand, IStdinReply, IStdinRequest } from '@jupyterlite/cockle';
1
+ import type { Terminal } from '@jupyterlab/services';
2
+ import type { IExternalCommand, IStdinReply, IStdinRequest } from '@jupyterlite/cockle';
3
3
  import { Token } from '@lumino/coreutils';
4
+ import type { ISignal } from '@lumino/signaling';
4
5
  export declare const ILiteTerminalAPIClient: Token<ILiteTerminalAPIClient>;
5
6
  export interface ILiteTerminalAPIClient extends Terminal.ITerminalAPIClient {
6
7
  /**
@@ -26,6 +27,11 @@ export interface ILiteTerminalAPIClient extends Terminal.ITerminalAPIClient {
26
27
  * Register an external command that will be available in all terminals.
27
28
  */
28
29
  registerExternalCommand(options: IExternalCommand.IOptions): void;
30
+ /**
31
+ * Signal emitted when a terminal is disposed.
32
+ * The string argument is the terminal `name` which is the same as the Shell's `shellId`.
33
+ */
34
+ terminalDisposed: ISignal<this, string>;
29
35
  /**
30
36
  * Inform all terminals that the theme has changed so that they can react to it if they wish.
31
37
  */
package/lib/worker.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { expose } from 'comlink';
2
2
  import { BaseShellWorker } from '@jupyterlite/cockle';
3
- import { DriveFS } from '@jupyterlite/contents';
3
+ import { DriveFS } from '@jupyterlite/services';
4
4
  /**
5
5
  * Shell web worker that uses DriveFS via service worker.
6
6
  * Note that this is not exported as it is accessed from Shell via the filename.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyterlite/terminal",
3
- "version": "1.0.1",
3
+ "version": "1.2.0",
4
4
  "description": "A terminal for JupyterLite",
5
5
  "keywords": [
6
6
  "jupyter",
@@ -59,19 +59,21 @@
59
59
  "watch:labextension": "jupyter labextension watch ."
60
60
  },
61
61
  "dependencies": {
62
- "@jupyterlab/apputils": "^4.5.3",
63
- "@jupyterlab/coreutils": "^6.4.3",
64
- "@jupyterlab/services": "^7.4.3",
65
- "@jupyterlab/settingregistry": "^4.4.3",
66
- "@jupyterlite/cockle": "^1.0.0",
67
- "@jupyterlite/contents": "^0.6.0",
68
- "@jupyterlite/server": "^0.6.0",
69
- "@lumino/coreutils": "^2.2.0",
62
+ "@jupyterlab/apputils": "^4.6.0",
63
+ "@jupyterlab/coreutils": "^6.5.0",
64
+ "@jupyterlab/pluginmanager": "^4.5.0",
65
+ "@jupyterlab/services": "^7.5.0",
66
+ "@jupyterlab/settingregistry": "^4.5.0",
67
+ "@jupyterlite/apputils": "^0.7.0",
68
+ "@jupyterlite/cockle": "^1.3.0",
69
+ "@jupyterlite/services": "^0.7.0",
70
+ "@lumino/coreutils": "^2.2.1",
71
+ "@lumino/signaling": "^2.1.4",
70
72
  "mock-socket": "^9.3.1"
71
73
  },
72
74
  "devDependencies": {
73
- "@jupyterlab/builder": "^4.4.3",
74
- "@jupyterlab/testutils": "^4.4.3",
75
+ "@jupyterlab/builder": "^4.5.0",
76
+ "@jupyterlab/testutils": "^4.5.0",
75
77
  "@types/jest": "^29.2.0",
76
78
  "@types/json-schema": "^7.0.11",
77
79
  "@types/react": "^18.0.26",
@@ -122,11 +124,11 @@
122
124
  "bundled": false,
123
125
  "singleton": true
124
126
  },
125
- "@jupyterlite/contents": {
127
+ "@jupyterlite/apputils": {
126
128
  "bundled": false,
127
129
  "singleton": true
128
130
  },
129
- "@jupyterlite/server": {
131
+ "@jupyterlite/services": {
130
132
  "bundled": false,
131
133
  "singleton": true
132
134
  }
@@ -157,6 +159,13 @@
157
159
  "@typescript-eslint"
158
160
  ],
159
161
  "rules": {
162
+ "@typescript-eslint/consistent-type-imports": [
163
+ "error",
164
+ {
165
+ "prefer": "type-imports",
166
+ "fixStyle": "separate-type-imports"
167
+ }
168
+ ],
160
169
  "@typescript-eslint/naming-convention": [
161
170
  "error",
162
171
  {
package/src/client.ts CHANGED
@@ -1,21 +1,22 @@
1
1
  import { PageConfig, URLExt } from '@jupyterlab/coreutils';
2
- import { ServerConnection, Terminal } from '@jupyterlab/services';
3
- import {
2
+ import type { Terminal } from '@jupyterlab/services';
3
+ import { ServerConnection } from '@jupyterlab/services';
4
+ import type {
4
5
  IExternalCommand,
5
6
  IShellManager,
6
7
  IStdinReply,
7
- IStdinRequest,
8
- ShellManager
8
+ IStdinRequest
9
9
  } from '@jupyterlite/cockle';
10
- import { JSONPrimitive } from '@lumino/coreutils';
10
+ import { ShellManager } from '@jupyterlite/cockle';
11
+ import type { JSONPrimitive } from '@lumino/coreutils';
12
+ import type { ISignal } from '@lumino/signaling';
13
+ import { Signal } from '@lumino/signaling';
11
14
 
12
- import {
13
- Server as WebSocketServer,
14
- Client as WebSocketClient
15
- } from 'mock-socket';
15
+ import type { Client as WebSocketClient } from 'mock-socket';
16
+ import { Server as WebSocketServer } from 'mock-socket';
16
17
 
17
18
  import { Shell } from './shell';
18
- import { ILiteTerminalAPIClient } from './tokens';
19
+ import type { ILiteTerminalAPIClient } from './tokens';
19
20
 
20
21
  export class LiteTerminalAPIClient implements ILiteTerminalAPIClient {
21
22
  constructor(options: { serverSettings?: ServerConnection.ISettings } = {}) {
@@ -111,6 +112,7 @@ export class LiteTerminalAPIClient implements ILiteTerminalAPIClient {
111
112
  shell.disposed.connect(() => {
112
113
  this.shutdown(name);
113
114
  wsServer.close();
115
+ this._terminalDisposed.emit(shell.shellId);
114
116
  });
115
117
 
116
118
  return { name };
@@ -148,12 +150,13 @@ export class LiteTerminalAPIClient implements ILiteTerminalAPIClient {
148
150
  }
149
151
  }
150
152
 
153
+ get terminalDisposed(): ISignal<this, string> {
154
+ return this._terminalDisposed;
155
+ }
156
+
151
157
  themeChange(isDarkMode?: boolean): void {
152
158
  for (const shell of this._shells.values()) {
153
- // Can pass isDarkMode when cockle is released with PR #232.
154
- //shell.themeChange(isDarkMode);
155
-
156
- shell.themeChange();
159
+ shell.themeChange(isDarkMode);
157
160
  }
158
161
  }
159
162
 
@@ -178,4 +181,5 @@ export class LiteTerminalAPIClient implements ILiteTerminalAPIClient {
178
181
  private _externalCommands: IExternalCommand.IOptions[] = [];
179
182
  private _shellManager: IShellManager;
180
183
  private _shells = new Map<string, Shell>();
184
+ private _terminalDisposed = new Signal<this, string>(this);
181
185
  }
package/src/index.ts CHANGED
@@ -1,20 +1,19 @@
1
1
  // Copyright (c) Jupyter Development Team.
2
2
  // Distributed under the terms of the Modified BSD License.
3
3
 
4
- import {
4
+ import type {
5
5
  JupyterFrontEnd,
6
6
  JupyterFrontEndPlugin
7
7
  } from '@jupyterlab/application';
8
8
  import { IThemeManager } from '@jupyterlab/apputils';
9
+ import type { ServiceManagerPlugin, Terminal } from '@jupyterlab/services';
9
10
  import {
10
11
  IServerSettings,
11
12
  ITerminalManager,
12
13
  ServerConnection,
13
- ServiceManagerPlugin,
14
- Terminal,
15
14
  TerminalManager
16
15
  } from '@jupyterlab/services';
17
- import { IServiceWorkerManager } from '@jupyterlite/server';
16
+ import { IServiceWorkerManager } from '@jupyterlite/apputils';
18
17
  import { ISettingRegistry } from '@jupyterlab/settingregistry';
19
18
 
20
19
  import { WebSocket } from 'mock-socket';
package/src/shell.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { BaseShell, IShell } from '@jupyterlite/cockle';
1
+ import type { IShell } from '@jupyterlite/cockle';
2
+ import { BaseShell } from '@jupyterlite/cockle';
2
3
 
3
- import { Client as WebSocketClient } from 'mock-socket';
4
+ import type { Client as WebSocketClient } from 'mock-socket';
4
5
 
5
6
  /**
6
7
  * Shell class that uses web worker that plugs into a DriveFS via the service worker.
package/src/tokens.ts CHANGED
@@ -1,10 +1,11 @@
1
- import { Terminal } from '@jupyterlab/services';
2
- import {
1
+ import type { Terminal } from '@jupyterlab/services';
2
+ import type {
3
3
  IExternalCommand,
4
4
  IStdinReply,
5
5
  IStdinRequest
6
6
  } from '@jupyterlite/cockle';
7
7
  import { Token } from '@lumino/coreutils';
8
+ import type { ISignal } from '@lumino/signaling';
8
9
 
9
10
  export const ILiteTerminalAPIClient = new Token<ILiteTerminalAPIClient>(
10
11
  '@jupyterlite/terminal:client'
@@ -39,6 +40,12 @@ export interface ILiteTerminalAPIClient extends Terminal.ITerminalAPIClient {
39
40
  */
40
41
  registerExternalCommand(options: IExternalCommand.IOptions): void;
41
42
 
43
+ /**
44
+ * Signal emitted when a terminal is disposed.
45
+ * The string argument is the terminal `name` which is the same as the Shell's `shellId`.
46
+ */
47
+ terminalDisposed: ISignal<this, string>;
48
+
42
49
  /**
43
50
  * Inform all terminals that the theme has changed so that they can react to it if they wish.
44
51
  */
package/src/worker.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { expose } from 'comlink';
2
2
 
3
- import { BaseShellWorker, IDriveFSOptions } from '@jupyterlite/cockle';
4
- import { DriveFS } from '@jupyterlite/contents';
3
+ import type { IDriveFSOptions } from '@jupyterlite/cockle';
4
+ import { BaseShellWorker } from '@jupyterlite/cockle';
5
+ import { DriveFS } from '@jupyterlite/services';
5
6
 
6
7
  /**
7
8
  * Shell web worker that uses DriveFS via service worker.